[texhax] making LaTeX-environment from existing command
Alexander Grahn
A.Grahn at fzd.de
Thu Aug 16 13:32:12 CEST 2007
On Thu, Aug 16, 2007 at 12:42:53PM +0200, Morten Høgholm wrote:
>Look for amsmath's way of grabbing the contents of an environment:
Thanks, Morten. Do you think that this definition of my `storetoks'
environment based on \collect at body is correct?
-- 8< --
\documentclass{article}
\usepackage{amsmath}
\newtoks\mytoks
\makeatletter
\newenvironment{storetoks}{\collect at body\myfunc}{}
\def\myfunc#1{\global\mytoks={#1}}
\makeatother
\begin{document}
\begin{storetoks}%
Hello!%
\end{storetoks}
``\the\mytoks''
\end{document}
-- >8 --
I tried to figure out what they are doing in the \collect at body definition
in amsmat.sty but, I didn't get the essence. Is there a short and easy
way to re-implement this macro in order to be independent of amsmath.sty?
Alexander
More information about the texhax
mailing list