9

At the beginning of Chapter 3: Controlling TeX of his TeXbook, Knuth explains that control sequences come in two flavours: control words and control symbols.

Control words

The first kind, like \input, is called a control word; it consists of an escape character followed by one or more letters, followed by a space or by something besides a letter. [...] In case you're wondering what a "letter" is, the answer is that TeX normally regards the 52 symbols A...Z and a...z as letters. The digits 0...9 are not considered to be letters, so they don't appear in control sequences of the first kind.

Control symbols

A control sequence of the other kind, like \', is called a control symbol; it consists of the escape character followed by a single nonletter.

To test my understanding of those categories, I tried compiling the following code (with pdftex)... and was surprised not to get any error!

\def\10{foo}
\def\20{bar}
\10\20
\bye

In fact, a PDF output was generated without mishap:

enter image description here

The reason I'm puzzled is that \10 and \20 don't seem to fall into either category of allowed control-sequence names (as defined above):

  1. They contain nonletters; therefore, they can't be considered control words.
  2. They consist of the escape character (\) followed by more than just one nonletter; therefore, they can't be considered control symbols.

What am I missing?

  • 2
    @Roelof has the answer, but if you'd tried \10 and \11 it would have been obvious. – barbara beeton Nov 2 '13 at 12:59
  • @barbarabeeton I know; I chose the two names poorly. However, I understand how a newcomer to TeX can be fooled... – jub0bs Nov 2 '13 at 13:20
  • 1
    It should be added to the most common mistakes.... – kiss my armpit Nov 2 '13 at 13:30
  • @Marienplatz Do you really think this is common? – marczellm Nov 2 '13 at 15:38
  • @marczellm: Yes. – kiss my armpit Nov 2 '13 at 15:52
15

In this case the 0 is part of the parameter text and acts as a delimiter token. So you are really defining \1 and \2 and are specifying that a 0 delimiter token is required after. You can use this mechanism for delimiting parameters.

  • 1
    Haaaaaa.... You're right! I'm so dumb -_-' Thanks! – jub0bs Nov 2 '13 at 12:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.