Wrapping \NewEnviron into \newenvironment fails

Posted by o_O Tync on Stack Overflow See other posts from Stack Overflow or by o_O Tync
Published on 2010-05-26T02:20:46Z Indexed on 2010/05/26 14:01 UTC
Read the original article Hit count: 347

Hello! I am trying to wrap an environment created with \NewEnviron (package 'environ') into an old good \newenvironment:

\NewEnviron{test}{aaa(\BODY)bbb}
\newenvironment{wrapper}{\begin{test}}{\end{test}}

\begin{wrapper}
debug me
\end{wrapper}

However, this gives me a strange error:

LaTeX Error: \begin{test} on input line 15 ended by \end{wrapper}. LaTeX Error: \begin{wrapper} on input line 15 ended by \end{document}.

If I replace \NewEnviron{test}{aaa(\BODY)bbb} with \newenvironment{test}{aaa(}{)bbb} — everything works as expected! It seems like \NewEnviron fails to find its end for some reason.

I'm trying to do some magic with 'floatfig' wrapped into a \colorbox so I need a way to convert \colorbox to an environment and wrap it into another one. I can define a new command but it's not a very good idea.

Thanks in advance!

© Stack Overflow or respective owner

Related posts about latex

Related posts about wrapper