5

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.)

To recall, 0 is for escape, 7 is for superscript, 10 is for space, and 11 is for letters.

The answer given is: ^^B7 ^^B7 M11 |^^B| 10 ^^M7 |M^^M|.
(I have used |cs| to denote the control sequence name "cs".)

Question: Why is 10 there!? Firstly, ^^C is a non-letter character that follows ^^A^^B (an escape character followed by a non-letter), and thus goes into state S (not M), and it's clearly written that in such a case, any space character is "simply passed by".

2 Answers 2

7

This is explained in page 47:

if TeX sees a character of category 10, the action depends on the current state. If is in state N or S it is passed by and remained in same state. Otherwise in state M the character is converted to space (character code 32) with catcode 10, and entering state S. The character code in a space token is always 32.

And on page 46,

If TeX sees a category 0 in any state, … (b) if the next character is not of category 11, the name consists of that symbol. … This name becomes a control sequence token. TeX goes to state S … in case (b) with respect to a character of category 10, otherwise TeX goes into state M.

So it is in state M after ^^A^^B, because ^^B is not of category 10.

1
  • Ah! I had earlier thought that "with respect to a character of cat 10" meant that TeX will ignore any character of cat 10. The wording stumped me.
    – Atom
    Commented Jul 24, 2023 at 15:12
5

after an escape character followed by a character not of catcode 11, tex goes in to state M unless the character was a space. so spaces are skipped after \ but not after \$ or after ^^A^^B

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .