Triple packing \ colorbox → \ NewEnviron → \ newenvironment fails

I am trying to wrap an environment created using \NewEnviron(package 'environ') in a good old one \newenvironment:

\NewEnviron{test}{\colorbox[gray]{0.7}{\BODY}}
\newenvironment{wrapper}{\begin{test}}{\end{test}}

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

However, this gives me a strange error:

LaTeX: \ begin {test} error on input line 15 ending with \ end {wrapper}. LaTeX: \ begin {wrapper} error on input line 15 ending with \ end {document}.

If I replaced \NewEnviron{test}{aaa(\BODY)bbb}with \newenvironment{test}{aaa(}{)bbb}- everything works as expected! It seems that \NewEnvironfor some reason it does not find its end.

I am trying to do magic with a "floatfig" wrapped in \colorbox, so I need a way to convert \colorboxto the environment and transfer it to another. I can define a new team, but this is not a good idea.

+5
2

, \NewEviron \newenvironment -.

1) \newenvironment{test}{aaa(}{)bbb} : \test is aaa( \endtest is )bbb.

\begin{test} \test.

\end{test} \endtest , begin{test} \begin{something else}, \begin{wrapper}.

2) \NewEviron{test}{aaa(\BODY)bbb} \test -. \test \BODY,

\def\test#1\end{\def\BODY{#1}aaa(\BODY)bbb\testcontinue}

( \testcontinue ) aaa(\BODY)bbb. \testcontinue , \end \end{test}, \end{something else}. \endtest , .

:

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

\begin{wrapper} \begin{test}. \begin{test} \test. \test catch \BODY. ! \BODY debug me. \testcontionue \end \BODY \end{test}. . \end{test} . \end{wrapper}.

, \end{wrapper} \end{test}. \end ,

macro \test: #1\end{\def\BODY{#1}aaa(\BODY)bbb\testcontinue}

.

, .

+6

, , . saveBoxes :

\newenvironment{example}[2][]{%
    \newsavebox{\exampleStore} % Box storage
    \begin{lrbox}{\exampleStore} % Start capturing the input
    }{%
        \end{lrbox} % Stop capturing the input
    \colorbox[gray]{0.7}{%
            \usebox{\NBstorage} % Load the box contents
            }%
        }%
    }%
+1

All Articles