[texhax] \usebox in environment to save text for future use

Lars Madsen daleif at imf.au.dk
Tue May 5 16:57:46 CEST 2009

Stefan Björk wrote:
> I expect the following code to define the \mybox within the
> environment info for later use, but it does not work. The use of lrbox
> environment seem restricted to the info environment only. How to get
> around this?
> \documentclass{article}
> \newsavebox{\mybox}
> \newenvironment{info}{\begin{lrbox}{\mybox}}{\end{lrbox}}
> \begin{document}
> \begin{info}
> This is some text.
> \end{info}
> \usebox{\mybox}
> \end{document}
> /S

presumably because info adds grouping

bepahs you might want to have a look at the environ package, I use that 
to store the contentes of environments and use it later.



More information about the texhax mailing list