[XeTeX] newcommand with optional arguments
Stephen Moye
stephenmoye at mac.com
Mon Mar 3 12:46:42 CET 2008
On Mar 3, 2008, at 6:25 AM, Sven Siegmund wrote:
> \providecommand{\nuu}[1][1]{\textit{#2} `#1'}
Try this:
\newcommand{\nuu}[2][]{%
\textit{#2}\ %
\ifx#1\empty
\else
`#1'
\fi
}
The way this works is this:
\newcommand{\commandname}[<TOTAL number of args>][<default content of
optional arg>]{<TeX commands...}
Where #1 is the optional argument
Your example needs something a little more complex, because your macro
needs to determine if there is anything in the optional argument, and
then to act accordingly.
You were on the right track...
Stephen Moye
More information about the XeTeX
mailing list