[XeTeX] newcommand with optional arguments
Bruno Voisin
bvoisin at mac.com
Tue Mar 4 14:35:03 CET 2008
Le 4 mars 08 à 12:40, Morten Høgholm a écrit :
> On Tue, Mar 4, 2008 at 11:37 AM, Bruno Voisin <bvoisin at mac.com> wrote:
>
>> Even after reading this several times, and trying to figure out how
>> the LaTeX 3 experimental code converts to LaTeX 2e, I still don't get
>> it: why all these \expandafter, what \\ (which in LaTeX means
>> carriage
>> return I think and in plain TeX can mean anything)
>
> If you find out what \\ means in plain TeX, you'll realize how big of
> a jester Knuth is. :-)
Hi Morten,
Thanks for the clarification and for your erudition.
So far I had only met \\ in plain TeX in exercise 11.5 of the TeXbook,
used as the basis for tracking.sty which in turn I had used for a
macro in a in-house letter format:
> % Tricky macro for increasing interletter spacing
>
> \def\dolist{\afterassignment\dodolist\let\next= }
> \def\dodolist{\ifx\next\endlist \let\next\relax
> \else \\\let\next\dolist \fi
> \next}
> \def\endlist{\endlist}
> \def\track#1\by#2{\def\\{\next\kern#2}%
> \leavevmode \hbox{\expandafter\dolist#1\endlist}}
I must admit I had failed to understand how this code worked (the
intricacies of \\ and \afterassignment and in other contexts
\futurelet) and I had just copied it verbatim, changing only the
definition of \track by trial-and-error, noticing that it worked for
my purposes.
Motivated by your answer I just had a look at the index of the
TeXbook, directing for \\ to section 2 "List macros'" of Appendix D.
It seems \\ by default does nothing: as you said it is just a marker
which is not a character and is used as a delimiter for list items,
but it can also be redefined by macros to perform specific actions on
these items.
Bruno
More information about the XeTeX
mailing list