[texhax] Some puzzling TeX
Philipp Stephani
st_philipp at yahoo.de
Thu Feb 17 01:50:09 CET 2011
Am 17.02.2011 um 00:44 schrieb Rod Harries:
> I am trying to understand why one would write
>
> \def\:{\let\@sptoken= } \: %
>
> instead of just \let\@sptoken= %
> or \def\@sptoken{ }
\let\@sptoken= % doesn't work because TeX allows an optional space token after the equals sign. Therefore you need *two* space tokens after the equals sign: one that is gobbled, and the other that is assigned to the control sequence. But you cannot easily place two space tokens next to each other because the input processor collapses adjacent spaces into a single space token. The \: trick does produce two space tokens: one between = and }, and one after \:. After expansion, there will be two space tokens next to each other.
Your second suggestion does something different: It declares \@sptoken as a macro that expands to an explicit space token. While this is often useful (LaTeX provides this as the macro \space), it is not the same than the implicit character token that the first construct produces. For example, you couldn't use it in an \ifx test for comparing tokens.
More information about the texhax
mailing list