[XeTeX] newcommand with optional arguments

Ulrike Fischer news2 at nililand.de
Tue Mar 4 10:26:35 CET 2008


Am Tue, 4 Mar 2008 09:09:43 +0100 schrieb Sven Siegmund:

> In fact I do not understand why
> Stephen's code ...
> 
> \newcommand{\nuu}[2][]{%
>        \textit{#2}\ %
>        \ifx#1\empty
>        \else
>                `#1'
>        \fi
> }
> 
> ... does not work if I write \nuu[22]{this} but does work when I write
> \nuu[goat]{mudi}.

Because the \ifx compares the two following tokens. So
\ifx 22\empty compares 2 with 2 and that is true.
\ifx goat\empty compares g with o and that is false.


http://www.tex.ac.uk/cgi-bin/texfaq2html?label=empty


-- 
Ulrike Fischer 



More information about the XeTeX mailing list