[XeTeX] newcommand with optional arguments

Ulrike Fischer news2 at nililand.de
Mon Mar 3 12:44:18 CET 2008


Am Mon, 3 Mar 2008 12:25:27 +0100 schrieb Sven Siegmund:

> Hi,
> 
> I need to define a command with an optional parameter. 
> 
> \providecommand{\nuu}[1][1]{\textit{#2} `#1'} % all words of nuu write
> in this style

> When I try to compile the document with xelatex, it complains:

> ! Illegal parameter number in definition of \\nuu.
> <to be read again>
>                    2
> l.9 \providecommand{\nuu}[1][1]{\textit{#2} `#1'}
>                                               % all words of nuu write in th...
> 
> What have I done wrong? I have tried to swap those number in the
> command definition, but he complains again the same way.

 \providecommand{\nuu}[2][]{...}

The first [] contains the total number of argument. The second [] should
contain the default for the optional argument #1. 

-- 
Ulrike Fischer 



More information about the XeTeX mailing list