[XeTeX] newcommand with optional arguments
Sven Siegmund
sven.siegmund at gmail.com
Mon Mar 3 12:58:10 CET 2008
Sorry, but that does not work for me. It compiles ok, but does
something different.
when I define \providecommand{\nuu}[2][]{\textit{#2} `#1'}
and write \nuu{mudi} the result is consequently mudi ''
But the thing is, that when I do not enter any optional argument I do
not want the word in italics being followed by any enquoted text nor
by the quotes alone.
I googled again and think I need to define the command another way.
Something like in 10.4 in here
(http://hevea.inria.fr/doc/manual020.html#toc37)
But I did not yet manage to change the source code to my demands. /-:
S.
2008/3/3, Ulrike Fischer <news2 at nililand.de>:
> 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
>
> _______________________________________________
> XeTeX mailing list
> postmaster at tug.org
> http://tug.org/mailman/listinfo/xetex
>
More information about the XeTeX
mailing list