[tex-k] \showthe followed with undefined control sequence misbehaves

Doug McKenna doug at mathemaesthetics.com
Fri Jul 19 17:14:10 CEST 2024


For the MWE code

\showthe\foo
\let\foo\relax
\bye

Karl wrote:

>| Since \foo is undefined, that token is effectively skipped.
>\ So the \showthe, more or less implemented like \show\the,
>\ is still active, and the next token it sees is the \let.

The \showthe command expands the input in search of a next token.  \foo is undefined, and all undefined CSes map to an expansion command that issues an error message, but allows expansion to continue, so the token returned to \showthe is \let, which is not a legal parameter or register and thus causes \showthe to issue the second error message.

If an undefined command replaced itself (after the error message) with \relax, then that would end expansion for the \showthe command and the cascade of error messages would be correct (from the user's point of view).  I'm not sure how that might introduce a substantive incompatibility; even if it did, once an error occurs, compatibility is the least of one's problems.


Doug McKenna


More information about the tex-k mailing list.