# [texhax] making LaTeX-environment from existing command

Morten Høgholm morten.hoegholm at gmail.com
Thu Aug 16 13:51:49 CEST 2007

On Thu, 16 Aug 2007 13:32:12 +0200, Alexander Grahn wrote:

> Thanks, Morten. Do you think that this definition of my storetoks'
> environment based on \collect at body is correct?

> \makeatletter
> \newenvironment{storetoks}{\collect at body\myfunc}{}
> \def\myfunc#1{\global\mytoks={#1}}
> \makeatother

Looks okay to me.

> 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?

Not really except for copying the definitions from amsmath.sty. One slight
change you could introduce for your version (with different name I expect)
is to make \collect at body \long.

Cheers,
--
Morten
`