I want to use an environment defined with NewEnviron from environ in another environment definition:
\documentclass{article}
\usepackage{environ}
\NewEnviron{inner}[1]{%
\textbf{#1:} \BODY
}
\newenvironment{out}{%
\begin{inner}{Using outer}%
}{%
\end{inner}%
}
\begin{document}
\begin{inner}{Using inner}
Lorem ipsum\ldots
\end{inner}
\begin{out}
Lorem ipsum\ldots
\end{out}
\end{document}
The resulting PDF looks as desired:

But the log shows some erros:
./test.tex:22: LaTeX Error: \begin{inner} on input line 20 ended by \end{out}.
...
l.22 \end{out}
./test.tex:23: LaTeX Error: \begin{out} on input line 20 ended by \end{document
}.
...
l.23 \end{document}
...
(\end occurred inside a group at level 1)
### semi simple group (level 1) entered at line 20 (\begingroup)
### bottom level
If I define out using NewEnviron, that is
\NewEnviron{out}{%
\begin{inner}{Using outer}%
\BODY
\end{inner}%
}
then pdflatex does not terminate.
Apparently, something is mixed up (presented to the parser in the wrong order). What is going wrong?

environin the first place. But nesting two\NewEnvirondefined (pseudo)environments will lead to assign to\BODYsomething that contains\BODY: an infinite loop is waiting for you. – egreg Oct 22 '12 at 17:48xifthen, I did not see a (LaTeX) way to do it withoutNewEnviron, and it works beautifully with. Ah, right,\BODYprevents nesting; I think I encountered that one before. – Raphael Oct 22 '12 at 17:50