# [texhax] environment from command

Reinhard Kotucha reinhard.kotucha at web.de
Sat Nov 20 00:24:07 CET 2010

On 19 November 2010 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}

If the first and third arguments are constants, you can create another
command in order to reduce the number of arguments:

\newcommand{\foo}[1]{\command{arg1}{#1}{arg3}}

> Construct the next environment:
> \begin{environment}
>   variable second arg
> \end{environment}

and then you can use it in \newenvironment:

\newenvironment{bar}[1]{\foo{#1}}{}

\begin{bar}{hello}
...
\end{bar}

Regards,
Reinhard

--
----------------------------------------------------------------------------
Reinhard Kotucha			              Phone: +49-511-3373112
Marschnerstr. 25
D-30167 Hannover	                      mailto:reinhard.kotucha at web.de
----------------------------------------------------------------------------
Microsoft isn't the answer. Microsoft is the question, and the answer is NO.
----------------------------------------------------------------------------