I am trying to document some LaTeX macros concerning marginals. I think a good way for the documentation would be the LaTeX code on the verso page and the output on the recto page. So I came up with this MWE:
\documentclass{article}
\usepackage{lipsum}
\usepackage{verbatim}
\newenvironment{documentationpage}%
{\endgraf\verbatim}%
{\endverbatim}
\begin{document}
%
\begin{documentationpage}
This is a sentence explaining the footnote macro.\footnote{This is a footnote.}
This is a sentence explaining the footnote macro.\footnote{This is a footnote, too.}
\end{documentationpage}
%
\end{document}
Now, I would like to typeset This is a sentence...footnote, too.} first with and then without the framing documentationpage environment.
So, the output is supposed to be similar to
\begin{documentationpage}
This is a sentence explaining the footnote macro.\footnote{This is a footnote.}
This is a sentence explaining the footnote macro.\footnote{This is a footnote, too.}
\end{documentationpage}
\newpage
This is a sentence explaining the footnote macro.\footnote{This is a footnote.}
This is a sentence explaining the footnote macro.\footnote{This is a footnote, too.}
\newpage
Can I achieve this with (Lua-)LaTeX?

! Undefined control sequence. \endexamplecode ...begingroup \MakePercentComment \catcode=5\relax \Prin... l.24 \end{examplecode}` (and works when ignoring it) and the second one works fine. – Andy Nov 13 '11 at 21:40