[XeTeX] newcommand with optional arguments

Manuel Pégourié-Gonnard mpg at elzevir.fr
Tue Mar 4 04:29:52 CET 2008


Hi again,

Ross Moore a écrit :
> Actually the \expandafter s  are not needed here.

Oops, I didn't see this message and I said the same in my earlier answer.

> \newcommand{\nuu}[2][]{%
>   \begingroup
>    \def\testtheargument{#1}%
>    \textit{#2}%
>    \ifx\testtheargument\myempty@
>     \typeout{no 1st argument for \string\nuu{#2}}%
>    \else
>     \ `#1'
>    \fi
>   \endgroup
> }
> 
By the way, such refinement is probably useless here, but I prefer the
following way :

\newcommand{\nuu}[2][]{%
  \textit{#2}%
  \begingroup\def\testtheargument{#1}\expandafter\endgroup
  \ifx\testtheargument\@empty
  \ETC.

Manuel.


More information about the XeTeX mailing list