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

Stefan Björk stefan.bjork at gmail.com
Thu May 7 21:07:32 CEST 2009


2009/5/5 Ulrike Fischer <news3 at nililand.de>:
>> 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}
>
> \newenvironment{info}{\global\lrbox{\mybox}}{\endlrbox}

Can't make this work. Just adding \global does not seem to solve the issue.

/S


More information about the texhax mailing list