When reading the "u"-part of the preamble for each column of an \halign
, namely the part which will be inserted before the cell contents, TeX ignores any leading "spacer". In this context, a "spacer" is defined as any implicit or explicit character token with category code 10. See @<Scan the template \<u_j>...@>=
in tex.web for those who understand Pascal code.
At the start of each cell, i.e., just after each &
or \cr
(or \crcr
), TeX fully expands tokens and ignores "spacers". This is done by calling @<Get the next non-blank non-call token@>
before any call to init_col
.
A test to show that indeed arbitrary implicit space tokens are ignored:
% Define \sp as an implicit space token "q".
\lccode` =`q\def\\{\let\sp= }\lowercase{\\ }
% Store an \halign in a box. The \sp in the u-part
% preamble is completely ignored, directly when TeX
% stores the preamble. To prove this, we redefine
% \sp globally, and see that it doesn't appear at
% the next line.
%
\setbox0=\vbox{\halign{
\sp x # \cr
\sp \space A\gdef\sp{!} \cr
\space B \cr
}}
% Show the box. Leading spaces have all been ignored.
% Not trailing spaces.
\tracingall\showbox0