0

The \newenvironment command allows the environment to take arguments:

\begin{article}
\newenvironment{preecho}[1]{#1}{}
\begin{document}
\begin{preecho}{Hi!}\end{preecho} % => Hi!
\end{document}

However, this argument cannot be accessed in the destructor:

\begin{article}
\newenvironment{postecho}[1]{}{#1} % => Illegal parameter number #1 in definition of \endpostecho.
\begin{document}
\begin{postecho}{Hi!}\end{postecho}
\end{document}

The error message makes it clear why this is happening. However:

  1. Is this behaviour intentional?

  2. Is there a \newenvironment-type command that makes the argument accessible in the destructor?

LSpice
  • 1,448

0 Answers0