[XeTeX] newcommand with optional arguments

Sven Siegmund sven.siegmund at gmail.com
Tue Mar 4 10:37:36 CET 2008


Oh, how simple. Now I understand what the \ifx command does.
 (-:

S.
2008/3/4, Ulrike Fischer <news2 at nililand.de>:
> 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
>
>
>  _______________________________________________
>  XeTeX mailing list
>  postmaster at tug.org
>  http://tug.org/mailman/listinfo/xetex
>


More information about the XeTeX mailing list