[texhax] if condition: is macro body empty? [\newcommand]

Uwe Lück uwe.lueck at web.de
Tue Feb 17 10:55:18 CET 2009

How LaTeX's \newcommand and the TeX primitive \ifx interact:

At 11:02 12.02.09, Philip G. Ratcliffe wrote:
>Evidently, \newcommand does something strange
>(I left it in for the useual protection against
>inadvertently overwriting a previous definition),
>but \def is obviously cleaner.
[... fill buffer or don't ...]
>   \begin{itemize}
>     \buffer
>   \end{itemize}

\newcommand{\buffer}{} makes \buffer \long while \empty isn't, therefore 
\ifx\buffer\empty is \iffalse.
\newcommand*{\buffer}{} would have rendered \ifx\buffer\empty \iftrue, just 
like \def\buffer{}. See TeXbook p. 210: "same status with respect to long".



More information about the texhax mailing list