Exercise 8.2(f) of the TeXbook (by Knuth) says it is not possible for an ignored character to appear in the midst of a control sequence name. But the following works...

\catcode`\t=9 \def\t{\TeX} \t \end

Why is that?

  • 1
    control sequence is not control character. You have got the TeXbook, so you can look it up :-)
    – yo'
    Jan 29, 2016 at 8:39
  • this even works with "invalid" characters, like the NULL character in LaTeX: you can use \^^@, but if a bare ^^@ appears in the token (or rather input, as there is here the extra ^^ mechanism) stream LaTeX will complain.
    – user4686
    Jan 29, 2016 at 9:16
  • @yo' Please read the two paragraphs before Exercise 3.1 of the TeXbook. Knuth says control symbols are a special kind of control sequences.
    – user36184
    Jan 29, 2016 at 12:21
  • @jfbu Very interesting!---although the null character is not invalid in TeX. On the other hand ^^?, ie <delete>, is.
    – user36184
    Jan 29, 2016 at 12:36
  • 1
    @user71815 ... you probably heard also about TeX by Topic which has much to be recommended for.
    – user4686
    Jan 29, 2016 at 12:41

3 Answers 3


He means that while, with that catcode, t is ignored so TetX is printed as TeX, it is not ignored while tokenizing so \TetX does not tokenize as \TeX. (and for the same reason actually \t is a normal token as you show.

  • Thank you. Your answer is the only one which attempted to interpret what Knuth meant in Exercise 8.2.
    – user36184
    Jan 31, 2016 at 7:12

I will cite from my book "TeXbook naruby", page 22.

The precedence of rules of token processor is important. First rule (with highest precedence) is (a) "double caret" rule. Second rule is "creating control sequences" (b) when a character with catcode 0 occurs. And this rule says:

There are two ways. If the first character (after catcode 0) has catcode 11 (letter) then the control sequence is created from all consecutively followed characters of catcode 11 until end of line or until first character with different catcode. The token processor goes to the state S (skipping spaces) in such case. Else the first character is not the catcode 11. Then the identifier of the control sequence includes only this character. The state S after this is applied here only if the control sequence \ (backslash space) is created.

Next rule (with less priority) is (c) "normal tokens" and (d) "ignoring characters" and many other rules (e)--(i).

We can see from the text above, that only 11 and non-11 catcode is treated at the level (b) "creating control sequence". Of course, the ignored catcode is non-11, so the control sequence consisting from letters stops here. But ignored character can be single non-11 control sequence.

  • Thank you. Your explanation is a summary of what goes right before Exercise 8.2 in the TeXbook. Sorry for not phrasing my question clearly: I was not confused about why my code worked (in fact I expected it to work since I already understood the mechanisms you described before I asked this question), but rather I didn't know what Knuth meant when he apparently contradicted himself by saying ignored characters cannot appear in a control sequence name. So David Carlisle's answer is the only one which addressed my confusion. I will try and read your book when I have the time.
    – user36184
    Jan 31, 2016 at 7:07

As noted in other answers, we have here a control sequence which is not a control word (the escape char then one or more letters) but rather a control symbol (the escape char then exactly one non-letter). Thus this case is not different from say \%.

The point that ignored chars cannot appear in a control word follows from the rules as described by wipet. Thus

\se up
\se oops

will give an error on the second and third uses but not the first: we have defined a macro \se which must be followed by up, not a macro called \seup. (It will also work if you use \setup as the t is ignored, of course.)

  • Thanks, this is very interesting, but I suppose there's little reason to use this technique (deliberately using an ignored character to mark the end of a control word name) in practice.
    – user36184
    Jan 31, 2016 at 7:18

You must log in to answer this question.