# [texhax] environment from command

Barbara Sánta santa.barbi at gmail.com
Sat Nov 20 14:23:20 CET 2010

Hi Heiko, thanks, this is a perfect solution, I could solve my problem
with it, but it surprised me if a package have to be applied for this
type of problem, I thought it must be elementary.

Barbara

On Sat, Nov 20, 2010 at 2:10 AM, Heiko Oberdiek
> Hi,
>
> On Fri, Nov 19, 2010 at 09:56:28PM +0100, Barbara Sánta wrote:
>
>> Hi, an elementary question, but I couldn't find the answer: how could
>> I define an environment from a command such that an argument of it be
>> inside the environment.
>>
>> Example:
>>
>> given the next command:
>> \command{fix first argument}{variable second arg}{fix third arg}
>>
>> Construct the next environment:
>> \begin{environment}
>>   variable second arg
>> \end{environment}
>
> You want to catch the contents of an environment in order
> to use it later as argument of a command?
>
> \usepackage{environ}
> \NewEnviron{environment}{%
>  \command{fix first argument}{\BODY}{fix third arg}%
> }
>
> Yours sincerely
>  Heiko Oberdiek
> _______________________________________________
> TeX FAQ: http://www.tex.ac.uk/faq
> Mailing list archives: http://tug.org/pipermail/texhax/