[OS X TeX] Embedding environment contents in a macro

Michael Jeffries mj at cds.caltech.edu
Wed Aug 28 01:52:53 CEST 2002


I'm told this is a great place to write and ask questions. I'd like to 
define an environment, say env, that wraps its contents inside a macro. 
Something like:
\newenvironment{env}{\macroname \bgroup \begin{ anotherenv } }
{ \end{anotherenv} \egroup}
so that \begin{env} MANY PARAGRAPHS OF INFO \end{env{}  is the same as 

When I do this, I get
! Extra }, or forgotten \endgroup.
\env ->\end {anotherenv}\egroup

l.39 \end{env}
I tried prefixing the \bgroup with \protect on hopes it might work, but 
that seemed only to stop the effect of the macro. Any ideas or help on 
how I can do this? I have a similar set up where anotherenv is defined 
by newtheorem instead of newenvironment, and that works, but I don't see 
how that's helpful.

The end goal is to have the macro display its contents if a flag is set, 
or to execute other code if the flag is not set. If there is a better 
way to do this, please let me know.



Threaded list archives can be found at:
To UNSUBSCRIBE, send email to <info at email.esm.psu.edu> with
"unsubscribe macosx-tex" (no quotes) in the body.
For additional HELP, send email to <info at email.esm.psu.edu> with
"help" (no quotes) in the body.

More information about the macostex-archives mailing list