I have the following for collecting contents of an environment and printing them later, it works but for my real task i want to use the environ package because i need to be able to have access to \BODY
. How can i produce the same output with \NewEnviron
instead of \newenvironment
used?
\documentclass{article}
\usepackage{collect}
\usepackage{environ}
\definecollection{notes}
%works but not what i realy want i need access to \BODY and for that i cant use \newenvironment command
\makeatletter
\newenvironment{note}
{\@nameuse{collect}{notes}{\par\noindent}{\par}{}{}}
{\@nameuse{endcollect}}
\makeatother
%what i realy want
%\NewEnviron{note}{
%\@nameuse{collect}{notes}{\par\noindent}{\par}{}{}
%\BODY
%\@nameuse{endcollect}
%}
\begin{document}
\begin{note}
First note
\end{note}
\begin{note}
Second note
\end{note}
\begin{note}
Third note
\end{note}
\section{collected}
\includecollection{notes}
\end{document}
Best Answer
If your collected notes are only needed at the end of the document, you can avoid writing out files: just use token registers.