# Exercise 17.21 of Knuth’s TeXbook: a (known) error?

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.

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:

1. No, it is not an error in The TeXbook: it’s you who are in error, because…
2. Yes, strictly speaking it is an error, but it is well known and has been ignored (and therefore, it has not been corrected) because…
3. Yes, it is an error and I had never heard of it before (and I am pretty sure of what I’m saying).

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.

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 \delcodes (not even in math mode).

• Whether it has reported or not, you can send a bug report at karl AT freefriends DOT org (as suggested at www-cs-faculty.stanford.edu/~uno/abcde.html). – egreg Jun 25 '15 at 17:15
• Three is true. Of course, this is bug in TeXbook, no in TeX. – wipet Jun 25 '15 at 17:46
• @wipet would you write an answer? (Nice to see you around, by the way). – Gonzalo Medina Jun 25 '15 at 19:04
• +1 I don't know how many times I've read that and thought "that sounds strange what does he mean there" but never thought to make a test, I guess you are right and it's an error in the book! – David Carlisle Jun 25 '15 at 19:15
• @GustavoMezzetti I think your second addition is correct: Knuth simply wrote these remarks with a { 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 ... – Arthur Reutenauer Jun 26 '15 at 1:19

• It's qurious if a test case can be devised where { has catcode 12. Did you try it? Will \left{ produce errors then? (suppose that Appendix B is not to be concerned) – Igor Liferenko Sep 17 '15 at 6:13