[tex-k] Scratch Registers in The TeXbook

Sebastian Miele sebastian.miele at gmail.com
Sun Nov 24 11:56:56 CET 2019


Appendix B of knuth-dist/tex/texbook.tex correctly states the following:

  (1)~Registers numbered 0~to~9 are always free for
  temporary ``^{scratch}'' use, but their values are always assumed to be
  clobbered whenever any other macro might get into control.  \ (This applies
  to registers like |\dimen0|, |\toks0|, |\skip1|, |\box3|, etc.; but \TeX\
  has already reserved |\count0| through |\count9| for page number
  identification.) \ (2)~The registers |\count255|, |\dimen255|, and
  |\skip255| are freely available in the same way.

But Chapter 15 states:

  Sometimes, however, you want to use a register just for temporary
  storage, and you know that it won't conflict with anybody else's macros.
  Registers |\count255|, |\dimen255|, |\skip255|, and |\muskip255| are
  traditionally kept available for such purposes.  Furthermore, plain \TeX\
  reserves |\dimen0| to |\dimen9|, |\skip0| to |\skip9|, |\muskip0| to
  |\muskip9|, and |\box0| to |\box9| for ``scratchwork''; these registers
  are never allocated by the |\new...|\null\ operations.

There seem to be two issues here: (1) According to the definiton of
\newmuskip in knuth-dist/lib/plain.tex, \muskip255 is not reserved for
scratch usage. (2) On the other hand, \toks0 to \toks9 do seem to be
reserved for scratch usage.

This time I searched the errata files before reporting.

The excerpt from Chapter 15 given above may in some sense still be true.
If "traditionally" means: In some past it was that way, but today it is
not. And if "Furthermore, plain TeX reserves ..." is interpreted as: But
this is not exhaustive; one kind of register out of five kinds total has
been omitted here. :-)

Best wishes
Sebastian


More information about the tex-k mailing list