Exercise 17.21 of The TeXbook asks a question concerning \delcode
:
Appendix B defines
\delcode‘<
so that there is a shorthand notation for angle brackets. Why do you think Appendix B doesn’t go further and define\delcode‘{
?
(quotation from that source). The first sentence of the answer reads:
If
\delcode‘{
were set to some nonnegative delimiter code, you would get no error message when you wrote something like ‘\left{
’.
But this is not true, at least as long as {
retains its usual \catcode
. Indeed, the syntax rules in Chapter 26 explain that \left
must be followed by a <delim>
, which may be either
<filler>\delimiter<27-bit number>
,<filler><letter>
, or<filler><otherchar>
.
Now, leaving the first alternative alone, <letter>
and <otherchar>
are described informally in Chapter 24, more precisely on page 283 after the syntax for <horizontal command>
, as being “explicit or implicit character tokens of categories 11 and 12” (respectively): thus, certainly not a {
of category 1. Actually, if you try the plain TeX code
\delcode`{="266308
\delcode`}="267309
Text before.
$$f(x)=\left{x+1\over x-1\right}+x$$
Text after.
\bye
you do get error messages (and the situation doesn’t change with LaTeX either).
I was reflecting about this inconsistency, which, as you can understand, threw me in bewilderment, all the more so in that the 2014 version of the The TeXbook reproduces the same wording I quoted above. What should I think? An incorrect statement that has incredibly slipped through all revisions and bug reports made so far? A minor, unimportant, and well known issue that the Author decided to ignore? Searching on Google for “TeXbook exercise 17.21” or on this site for “17.21” didn’t lead to anything. Please help.
Addition
Some comments suggest that I should not be asking this question at all. But please understand that we are speaking, here, of a conceptual error that would have remained hidden for more than thirty years. It seems to me that, if I were correct, the whole sense of Exercise 17.21 would be in doubt.
The answer I am expecting to get is one of the following:
- No, it is not an error in The TeXbook: it’s you who are in error, because…
- Yes, strictly speaking it is an error, but it is well known and has been ignored (and therefore, it has not been corrected) because…
- Yes, it is an error and I had never heard of it before (and I am pretty sure of what I’m saying).
Second addition
I also intended to mention, but I forgot to do so, the remark made on p. 345, line -13, which is even more curious: it seems indeed that Knuth had in mind {
characters of category 12.
Third Addition
Regarding the comment made on line 131 of plain.tex
, mentioned by Arthur Reutenauer, that reads
% N.B. { and } should NOT get delcodes; otherwise parameter grouping fails!
the following sample code
%&plain
\delcode`{="266308
\delcode`}="267309
\def\test#1{This is the argument: ``#1''.}
\def\mathtest#1{#1^{2}}
Text before, including a test. \test{My argument}
$$f(x)=\left\{\mathtest{x}+1\over \mathtest{x}-1\right\}+x$$
Text after.
\bye
confirms that the function of parameter-delimiting of braces of category 1 and 2 is not affected when those character do get \delcode
s (not even in math mode).
karl AT freefriends DOT org
(as suggested at www-cs-faculty.stanford.edu/~uno/abcde.html).{
of category 12 in mind. That’s what you can read between the lines in the relevant place of plain.tex too (“N.B. { and } should NOT get delcodes; otherwise parameter grouping fails!”). To know why, well, you’ll have to ask him :-) If he remember ...