[tex-k] Exercise 8.6 of the TeXbook

Jonathan Kew jfkthame at gmail.com
Tue Jul 23 14:50:35 CEST 2024


On 22/07/2024 22:25, Hanson Char wrote:
> Hi,
>
> I think I may have found an error in the answer of exercise 8.6 on page 305 of the TeXbook.
>
>> EXERCISE 8.6
>> Assume that the category codes of plain TEX are in force, except that the characters
>> ^^A, ^^B, ^^C, ^^M belong respectively to categories 0, 7, 10, and 11. What tokens are produced from the (rather ridiculous) input line ‘^^B^^BM^^A^^B^^C^^M^^@\M␣’?
>> (Remember that this line is followed by ⟨return⟩, which is ^^M; and recall that ^^@ denotes the ⟨null⟩ character, which has category 9 when INITEX begins.)
> The current answer says the result is seven tokens as follows:
>
>      ^^B_7 ^^B_7 M_11 ^^B ␣_10 ^^M_11 M^^M
>
> But shouldn't it rather be:
>
>      ^^B_7 ^^B_7 M_11 ^^B ^^C_10 ^^M_11 M^^M
>
> ?  Only the category code of ^^C is changed to 10, but the character code remains the same (ie 3).
>
> Thoughts?


According to the 4th-from-last paragraph on page 47,

\begin{quote}
   If \TeX\ sees a character of category 10 (space) [...] the character 
is converted to
   a token of category 10 whose character code is 32, [...].
   The character code in a space token is always 32.
\end{quote}

So the current answer looks correct to me.

(There can also be ``funny space'' tokens---see page 377---but that 
doesn't apply here.)

JK
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://tug.org/pipermail/tex-k/attachments/20240723/d1d09496/attachment.htm>


More information about the tex-k mailing list.