[texhax] if condition: is macro body empty?
Donald Arseneau
asnd at triumf.ca
Thu Feb 12 20:49:32 CET 2009
"Philip G. Ratcliffe" <philip.ratcliffe at uninsubria.it> writes:
> This works too, doesn't need the "ifthen" package and shouldn't expand the
> macro:
>
> \newcommand{\buffer}{\relax}
> \makeatletter
> \newcommand{\fillbuffer}[1]{%
> \if\buffer\relax
> \g at addto@macro{\buffer}{#1}%
> \else
> \g at addto@macro{\buffer}{\newline #1}%
> \fi
> }
> \makeatother
A tricky solution is shorter:
> \newcommand{\buffer}{\@gobble}
> \makeatletter
> \newcommand{\fillbuffer}[1]{%
> \g at addto@macro{\buffer}{\newline #1}%
> }
> \makeatother
but it is slightly wrong for the "empty" buffer case.
--
Donald Arseneau asnd at triumf.ca
More information about the texhax
mailing list