[texhax] aliasing document environment

Moshe Kamensky moshe.kamensky at googlemail.com
Fri Feb 25 05:52:42 CET 2011


Thanks, that works! Moshe

* Heiko Oberdiek <heiko.oberdiek at googlemail.com> [24/02/11 23:12]:
> On Thu, Feb 24, 2011 at 10:35:46PM -0500, Moshe Kamensky wrote:
> 
> > When I try to latex the following:
> > 
> > \documentclass{article}
> > \newenvironment{foo}{\begin{document}}{\end{document}}
> > \begin{foo}
> > \end{foo}
> > 
> > I get:
> > 
> > LaTeX Error: \begin{foo} on input line 3 ended by \end{document}.
> > 
> > Why is that?
> 
> The environment `document' uses some trickery to remove the
> grouping level introduced by the \begin and \end.
> (Memory reasons, save stack, ...)
> 
> > Is there a way to do this without errors?
> 
> \newenvironment{foo}{\document}{\enddocument}
> 
> Yours sincerely
>   Heiko Oberdiek


More information about the texhax mailing list