[tex-k] Bug-report for the TeXbook: Not all non-primitive control-sequences are defined, ultimately, in terms of the primitive ones.
Heiko Oberdiek
heiko.oberdiek at googlemail.com
Tue Dec 13 19:53:21 CET 2022
Hello,
On 2022-12-13 19:39, Doug McKenna wrote:
> Just to add some complexity/nuance to the discussion ...
>
> Is the empty control sequence
>
> \csname\endsname
>
> constructed from two TeX primitives a TeX primitive or not?
It is an undefined control sequence with the meaning of \relax
due to a side effect of the primitive \csname that undefined
commands are getting defined with the meaning of \relax.
\expandafter\show\csname\endcsname
Result:
> \csname\endcsname=\relax.
e-TeX has \ifcsname that checks, if a command sequence exists
*without* defining it in the undefined case:
\ifcsname\endcsname
\message{1=exists}
\else
\message{1=undefined}
\fi
\csname\endcsname % the "empty control sequence" gets defined
\ifcsname\endcsname
\message{2=exists}
\else
\message{2=undefined}
\fi
\end
Result:
1=undefined 2=exists
> The following typesets "AB" (using plain.tex and pdftex in TL 2021) without error:
>
> \def\test{A\csname\endcsname B}
> \test
> \end
Same effect as
\def\test{A\relax B}
\test
\end
Yours sincerely
Heiko
More information about the tex-k
mailing list.