The link to Lisp is quite true (it's mentioned somewhere in the sources, but I can't put my finger on it just now). The way this works is very simple. The definitions are
\def\@car#1#2\@nil{#1}
\def\@cdr#1#2\@nil{#2}
In this context, \@nil
is being used as a delimiter, so what it expands to does not matter at all. This is a classic 'delimited argument' situation in TeX. (The only thing that is important is that TeX finds the appropriate token in the input stream, in this case before any \par
tokens.) TeX will allow us one blank the last item of this type of delimited macro to be empty. As a result, both \@cdr
and \@car
need to have at least one token supplied: something like
\expandafter\@cdr\@empty\@nil
will give an error.
Notice that these are TeX functions, not Lisp ones, and so we get the first <balanced text> separated off from the rest.
In PDFTeX/XeTeX colouring is done by inserting pdfliteral nodes around coloured items, these nodes would then interfere with mark positioning in this case, something like:
<base><start-color><mark><stop-color>
LuaTeX can use an alternate mechanism thanks to its "attribute" registers; attributes is a way to annotate input without interfering with pdfliterals and likes and can be employed for many things including colouring. But attributes is a low level mechanism and need to be employed by higher level packages.
In ConTeXt, attributes are used out of box, so it just works:
\definefontfeature[hebrew][arabic][script=hebr]
\definefont[hebrew][name:sblhebrew*hebrew]
\starttext
\textdir TRT
\hebrew
\color[red]{א}\color[blue]{֣}\color[green]{֚}ב\color[blue]{ָ}\color[green]{ג}֦ד\color[green]{֘}
\stoptext
In LuaLaTeX you need luacolor
to use the attributes mechanism,
\documentclass{minimal}
\usepackage{fontspec}
\usepackage{xcolor}
\usepackage{luacolor}
\newfontface\hebrew[Script=Hebrew]{SBL Hebrew}
\begin{document}
\textdir TRT
\hebrew
\textcolor{red}{א}\textcolor{blue}{֣}\textcolor{green}{֚}ב\textcolor{blue}{ָ}\textcolor{green}{ג}֦ד\textcolor{green}{֘}
\end{document}
P.S. I don't have Arial here and the only font I've with those marks is SBL Hebrew, so I used it for testing.
Best Answer
You can use the
\textcolor
command from thexcolor
package to give a color to each character of the logo. Runningin a terminal, you can get the implememtation of the LaTeX2e logo:
Since the
\LaTeXe
command is built upon the\LaTeX
command which, in its turn, uses the\TeX
command (you can usetexdef
to see their definition), I defined three commands\ClrTeX
,\ClrLaTeX
, and\ClrLaTeXe
to assign a color to each character of the three logos: