[OS X TeX] feed env contents to command
Morten Høgholm
morten.hoegholm at gmail.com
Mon Jun 19 11:25:37 CEST 2006
On 6/19/06, Bruno Voisin <bvoisin at mac.com> wrote:
> Le 19 juin 06 à 10:56, Alex Scorpan a écrit :
>
> > How do I define an environment gaga so that
> >
> > \begin{gaga}
> > blah
> > \end{gaga}
> >
> > interprets to
> >
> > \gugu{blah}
>
> Something along the lines of:
>
> \newenvironment{gaga}
> {\gugu\begingroup}
> {\endgroup}
>
> might work,
No, that will not work. This will cause \gugu to use \begingroup as
its argument.
Try
\documentclass{article}
\usepackage{amsmath}
\makeatletter
\newenvironment{gaga}{Pre\collect at body\gugu}{Post}
\newcommand*\gugu[1]{``#1''}
\makeatother
\begin{document}
\begin{gaga}
Some text.
\end{gaga}
\end{document}
Caveat: Does not work for multi paragraph contents.
> taken (so that the environment remains robust even with multi-
> paragraph content, or when a page break occurs within the
> environment; and also so that the environment content does not risk
> saturating TeX's memory before the end of the environment is
> reached). For insight into these issues, I'd recommend the TeXbook. I
The memory barriers are quite hard to hit unless you make an error
these days. Fortunately I might add... :-)
Morten
------------------------- Info --------------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
& FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Archive: http://tug.org/pipermail/macostex-archives/
More information about the macostex-archives
mailing list