On page 45 of The TeXbook,

TEX has a standard way to refer to the invisible characters of ASCII: Code 0 can be typed as the sequence of three characters ^^@, code 1 can be typed ^^A, and so on up to code 31, which is ^^_ (see Appendix C).

The ^^@, ^^B and ^^C and so on all works but ^^A doesn't.



enter image description here

but ^^A causes an error

! Missing $ inserted.
<inserted text> 
<to be read again> 
l.5 ^^A

Why can't use ^^A in TeX?

  • 1
    The input method does not change the catcode. So if you use the ^^ syntax to input a character, that will result in a math token, it still requires the math mode. This is the case with ^^A but neither with ^^@ not ^^B, ^^C or ^^D.
    – cabohah
    Nov 27, 2023 at 8:12
  • @cabohah $^^A$ fails too.
    – Y. zeng
    Nov 27, 2023 at 8:13
  • 1
    But with another error message. Try for example $x^^A{y}$. (Note: In plainTeX (not in LaTeX) ^^A has catcode 8 and therefore is a math subscript.)
    – cabohah
    Nov 27, 2023 at 8:15
  • @cabohah How do you know it has catcode 8?
    – Y. zeng
    Nov 27, 2023 at 8:18
  • 3
    Please read, how \mathcode works.
    – cabohah
    Nov 27, 2023 at 8:29

3 Answers 3


The error message you get, indicates that ^^A results in a math token. In plain.TeX you can find:

\catcode`\_=8 \catcode`\^^A=8 % underline and downarrow are for subscripts

(Note: This part of plain.tex can also be found in Appendix B of “The TeXbook”, page 343.)

From this point ^^A is a math subscript. This corresponds with the terminal output of

l.1 \showthe\catcode`\^^A

Note: The later

\mathcode`\^^A="3223 % \downarrow

in plain.tex is irrelevant for the catcode of ^^A. And because the catcode of ^^A is neither 11 (letter) nor 12 (other) the mathcode is also not relevant for the output. But it can become relevant, e.g., after changing the catcode of ^^A:


\catcode`\^^A=12 $x^^A{y}$

enter image description here

For more information about \mathcode, how it works and the difference to \catcode see “The TeXbook” and “What is the differences between mathcode and catcode and how can I use mathcode?

  • 1
    If I remember correctly my TeXbook, the ascii code 1 was rendered as ↓ in some terminal DEK used at the time (and the same for the uparrow at ^^K)
    – Rmano
    Nov 27, 2023 at 9:09
  • Thanks. How can I see the code in plain.tex as I don't know where it is?
    – Y. zeng
    Nov 27, 2023 at 9:22
  • 1
    @Y.zeng kpsewhich plain.tex and then search for ^^A in that file. Or because you are reading The TeXbook, have a look into Appendix B. But as I have also shown, you can alternatively ask TeX for the catcode.
    – cabohah
    Nov 27, 2023 at 9:37

You can refer to invisible ASCII characters, but the TeXbook doesn't say you can, or should, use them just for fun.

For instance, ^^@ (the null byte) has category code 9, so

Hell^^@ w^^@rld

would result in “Hell wrld”. And indeed you obtain three characters in output and not four.

To the contrary, ^^A (the 1 byte), has category code 8. Here's the table of category codes as set up in plain TeX:

enter image description here

Why the choice for ^^@? Because some operating systems used the null byte in order to fill their fixed length records. There should be no surprise in seeing category code 5 assigned to ^^M. Two cases remain, namely ^^A and ^^K.

The keyboard which Knuth used to work with could produce and when pressing CtrlA and CtrlK, respectively, and he liked these visual hints more than ^ and _. A consequence of this is that


has the same effect as $x_0$. And, of course, $^^A$ raises an error, because it would be like $_$.

You find the symbols on Knuth's keyboard in the table on page 369. This table also explains why some of these bytes are assigned a mathcode.

For instance CtrlD would produce on Knuth's screen and indeed we find

\mathcode`\^^D="225E % \land

in plain.tex.

Just for completeness, you can use ^^00 instead of ^^@. This convention is also described in chapter 8 and was added in TeX version 3.

  • 1
    Thanks. 1. Why did you say "And indeed you obtain three characters in output and not four.", witch are 8 characters? 2. Why does hello1 ^^M hello2 \bye output hello1? 3. Does ^^ always find symbols from ASCII?
    – Y. zeng
    Nov 27, 2023 at 10:10
  • @Y.zeng Look at the output: you get Theta, Lambda and Xi, which are the characters in slots 1, 2 and 3 in cmr10, but nothing for character 0 (which has a Gamma, by the way). For the second question, reread chapter 7: upon finding a character with catcode 5, TeX discards it and everything that may remain on the current line and replaces it with the \endlinechar. Question 3: what do you mean?
    – egreg
    Nov 27, 2023 at 10:20
  • 1
    1. What is Theta, Lambda, Xi and Gamma here? What I get is Hell wrld. 3. For example, in ^^t, t is 116th symbol of ASCII. As 116 is bigger than 64, 116-64=52. In ASCII table, 52th symbol is 4, so ^^t ouputs 4. Doesn't this state that ^^ always outputs symbols from ASCII?
    – Y. zeng
    Nov 27, 2023 at 10:37
  • 1
    @Y.zeng You've already read, that \char 127 after switching to font manfnt results in a symbol different from ASCII and that the same can be done using ^^? after setting up catcode of ^^? and the font. And I've already shown, that ^^A can result in output of a down arrow or a math subscript. So you should already know, that ^^ does not always output a symbol from ASCII. As already explained, ^^ is an input method. The output is more or less independent from the input, because the input can also result in, e.g., active character tokens.
    – cabohah
    Nov 27, 2023 at 11:04

Because on an old computer system with old keyboards that Don Knuth used, the character set had a down-arrow as character 1 (^^A). That seemed like a useful synonym for the underscore as math subscript character, so it has catcode 8. Likewise for an up-arrow character at location 11 given catcode 7 like ^. The character set is shown in Appendix C.

  • From Appendix C, ^ is 136 and _ is 137, from witch how to know it is the up-arrow key and down-arrow key?
    – Y. zeng
    Nov 27, 2023 at 9:49
  • 1
    That character set is the third table in Appendix C, on page 369 in my book. Nov 27, 2023 at 9:53

You must log in to answer this question.

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