[texhax] environment from command
Barbara Sánta
santa.barbi at gmail.com
Sat Nov 20 14:13:22 CET 2010
Hi Reinhard, thanks your answer, but this is not the solution I hoped,
as you *have to* apply braces, so the argument of the command remains
an argument of the environment, and the body of the environment must
be empty.
The real problem with other words is the next:
when I define an environment, how could I open a block in the second
argument of the \newenvironment, and how could I close it in the third
one.
Barbara
2010/11/20 Reinhard Kotucha <reinhard.kotucha at web.de>:
> 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.
> ----------------------------------------------------------------------------
>
More information about the texhax
mailing list