[tex-k] Bug-report for the TeXbook: Not all non-primitive control-sequences are defined, ultimately, in terms of the primitive ones.

Laurence.Finston at gmx.net Laurence.Finston at gmx.net
Tue Dec 13 21:13:57 CET 2022


This is another way of demonstrating what Heiko said:

tex
This is TeX, Version 3.141592653 (TeX Live 2022/Debian) (preloaded format=tex)
**\relax

*\tracingall
{vertical mode: \tracingstats}
{\tracingpages}
{\tracingoutput}
{\tracinglostchars}
{\tracingmacros}
{\tracingparagraphs}
{\tracingrestores}
{\showboxbreadth}
{\showboxdepth}

*\csname\endcsname
{\csname}
{\relax}

*\end
{\end}
No pages of output.
Transcript written on texput.log.

> Therefore \csname\endcsname is a primitive CS only specifiable using two primitive CSes.

I would be a bit cautious about making a statement like this.  It is very difficult to draw conclusions about how TeX is actually implemented from its behavior.  I've never managed to plow through _TeX:  The Program_ myself, though I'm sure others have.

The normal way of implementing something like this, in my opinion, would be to read in whatever lies between \csname and \endcsname as a string and test its length.  If it's 0, just don't do anything; exit the function or whatever.  So it wouldn't be a control sequence or anything else, it would just be nothing.

That's not to say that Knuth implemented it exactly like this.

> Gesendet: Dienstag, 13. Dezember 2022 um 19:39 Uhr
> Von: "Doug McKenna" <doug at mathemaesthetics.com>
> An: "tex-k" <tex-k at tug.org>
> Betreff: Re: [tex-k] Bug-report for the TeXbook: Not all non-primitive control-sequences are defined, ultimately, in terms of the primitive ones.
>
> 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?
>
> The following typesets "AB" (using plain.tex and pdftex in TL 2021) without error:
>
> \def\test{A\csname\endcsname B}
> \test
> \end
>
> So either the plain.tex format defines the empty control sequence to do nothing, or the empty control sequence is a primitive that does nothing (otherwise when expanding \test there ought to be an error message for an undefined control sequence whose name has length 0).  But plain.tex doesn't define the empty control sequence, and there's no error.  Therefore \csname\endcsname is a primitive CS only specifiable using two primitive CSes.
>
> Either I'm missing something, or the project of getting the wording precisely and perfectly correct in The TeXbook is doomed.  Or both.
>
>
> Doug McKenna
>



More information about the tex-k mailing list.