TeX - ! Extra alignment tab has been changed to \cr

Taylor, P P.Taylor at rhul.ac.uk
Sun Jul 7 20:09:20 CEST 2019


Carlos wrote:

Philip and David, and list in general. The message 'Extra alignment tab has been changed to \cr' is as misleading as the code from tabular environment, because it does absolutely nothing but implying that a \cr has been applied and hence, a newline follows thereof.

What leads you to believe that (1) \cr, and (2) a newline, have any connection whatsoever ?

if as the TeXbook says, TeX looks only for \cr commands, from which I infer is thus expanded,

Why would you infer that \cr is expanded ?  It is a primitive, and does not occur in the list of primitives that "are expanded whenever expansion has not been disabled" [p.~212 et seq.].

and '&', '#' and so forth and the glue in '\tabskip' which is scanned  as usual - note the macro expansion of \cr,

There is no "macro expansion of \cr"; \cr is a non-expandable primitive (as above).

then it follows that TeX under your tabular environment must have missed the macro expansion of \cr.

Sigh.  There is no "macro expansion of \cr".

One thing is a misplaced alignment tab character '&' and and another entirely different is extra alignment tab has been changed to '\cr.' Two different things and by  now you ougth already know.

A misplaced alignment tab character '&' might result from (for example) the usage of '&' (with its default catcode) outside of an alignment.  One '&' too many within an alignment, however, is not "misplaced", it is "an extra alignment tab".


If you were to say and this is from the TeXbook

\settabs 2 \columns
\+ this material is flushed right & \cr
this material is set centered & \cr

You'd have the expected 'misplaced alignment tab character '&'


I am not a LaTeX user, but I would not expect \begin {tabular} to involve \settabs; I would expect it to involve \halign.  Therefore, unless I am mistaken in this belief, bringing \settabs into the discussion is completely irrelevant.


But lo and behold if you were to have the same under your environment. Your implementation. Silly environment as it is.

look closely for posterity

\begin{tabular}{cccc}
\hbox to 2cm {una} & prueba && \cr
para ver &&&& \cr} & & & &      % look at the closing brace and hence the missing \cr.
\end{tabular}

I have no idea what this code is intended to accomplish, but if I feed it into LaTeX (with a suitable wrapper) I am told :

! Extra alignment tab has been changed to \cr.

<recently read> \endtemplate

as I would expect.

Philip Taylor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://tug.org/pipermail/texhax/attachments/20190707/782522d0/attachment-0001.html>


More information about the texhax mailing list