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

Jonathan Kew jfkthame at gmail.com
Wed Dec 14 19:00:23 CET 2022


On 14/12/2022 17:30, Doug McKenna wrote:
> I agree I was missing something, and as Heiko corrected, whatever is between \csname and \endcsname, even if empty, is equivalent to a \relax.
> 
> But ... TeX's source code, contains the following:
> 
> @<Basic printing...@>=
> procedure print_cs(@!p:integer); {prints a purported control sequence}
> begin if p<hash_base then {single character}
>    if p>=single_base then
>      if p=null_cs then
>        begin print_esc("csname"); print_esc("endcsname"); print_char(" ");
> ...
> 
> and similar tests elsewhere.
> 
> In other words, the control sequence |null_cs| with no characters to its name is always output to the world as the two primitive CSes, "\csname\endcsname".  So I guess the pertinent question is, can |null_cs|'s meaning be redefined?

That's how its *name* is output; that has no bearing on what you can do 
with its *meaning*.

Try it:

# # # # # # # # #
$ tex
This is TeX, Version 3.14159265 (TeX Live 2017) (preloaded format=tex)
**\relax

*\csname\endcsname

*\expandafter\def\csname\endcsname{\message{Hello from the null control 
sequence}}

*\csname\endcsname
Hello from the null control sequence
*\end
No pages of output.
Transcript written on texput.log.
# # # # # # # # #

JK



More information about the tex-k mailing list.