[XeTeX] newcommand with optional arguments
Morten Høgholm
morten.hoegholm at gmail.com
Tue Mar 4 10:24:32 CET 2008
On Tue, Mar 4, 2008 at 10:19 AM, Sven Siegmund <sven.siegmund at gmail.com> wrote:
> And I think the ultimate aolution to all this fuss may be what is written here:
>
> http://tex.loria.fr/texlive-htmldoc/eplain/eplain_6.html#SEC50
>
> But again: I do not really understand these TeX source codes...
Sven, I have a feeling you are getting increasingly confused. Here is
a complete example showing how it can be done.
\documentclass{article}
\makeatletter
\long\def\tlist at if@empty at nTF #1{%
\expandafter\ifx\expandafter\\\detokenize{#1}\\%
\expandafter\@firstoftwo
\else
\expandafter\@secondoftwo
\fi
}
\newcommand*\nuu[2][]{%
\textit{#2}%
\tlist at if@empty at nTF{#1}{}{ `#1'}% only the false code executed
}
\makeatother
\begin{document}
\nuu{this} \nuu[22]{this} \nuu[goat]{mudi}
\end{document}
--
Morten
More information about the XeTeX
mailing list