I want to store contents of an environment and add them to a macro or command I could easily retrieve them, but I do not want to use the collect package. Are there any alternatives?
\documentclass{article}
\usepackage{environ}
\usepackage{blindtext}
\NewEnviron{env}{
\global\let\content\BODY
%i want to add content to running list and later get whole contents
}
\begin{document}
\begin{env}
text text text\\
\end{env}
\blindtext
\begin{env}
moretext moretext more text\\
\end{env}
\end{document}
Best Answer
You can print the saved environments by “name” or all of them.
This requires two runs (when the saved environments change), because of the usage of
\label
.Update
Since
etex
methods are now discouraged, here's a reimplementation withexpl3
.Original code
You can save up to 1000 environments, but you can change the number in the obvious way. Don't try setting the number to much more than 30000.