# Why do TeX list items use two backslashes?

In TeX packages one finds definitions of lists as:

\def\l{\\\alpha\\\beta\\\gamma}


The one backslash is understandable, it represent the active character for the macro i.e, \gamma, but what do the other two do, why are they there?

-
Can you point out which packages define these? Normally \ maps to new line and to \cr in \halign based environments. So, depending on the context, it could mean different things. –  Aditya Oct 5 '10 at 4:04
I have been reading citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.102.2532 and trying to understand the example on sorting a list! –  Yiannis Lazarides Oct 5 '10 at 4:27

The \\ is just an arbitrary (short) control sequence. It allows you to do something with the list just by defining it as a one-parameter macro:

\begingroup
\def\\#1{\typeout{\string#1}}
\l  % prints out the tokens in the list
\endgroup


However, I think \\ is a bad choice because it has a meaning in TeX/LaTeX. LaTeX generally uses \do for this purpose, and packages such as expl3 use a special hidden separator so that you can add \\ or \do as normal list elements.

-
\\ has no meaning in plain TeX. One of the questions in the TeXbook asks why the author (meaning Knuth) didn't give it a meaning. The answer is that it is just too convenient for other uses. Personally, I find \\\foo\\\bar harder to read. I think something like \do\foo\do\bar is more clear. –  TH. Oct 6 '10 at 4:30

If you want a list of control sequences, you don't need the extra \\ — you can use token lists and "pop" off the first item. Eijkhout's TeX by Topic gives some code that does that in his chapter on token lists.

If you want more general contents in the list, you need a separator. The \\ is what Knuth used as a separator in Appendix D of The TeXbook, so I guess that is the convention, but you could use an active character like ~ as a separator.

-