# [Tex/LaTex] \string command behavior – Plain TeX

plain-texstringstex-core

I would like to learn Plain TeX and I'm reading Knuth's "The TeXBook". At Chapter 7, Knuth talks about the \string command and how it converts control sequences into lists of characters tokens.

Why when I typed \string\TeX, I got "TeX, but when I wrote {\tt \string\TeX} I got \TeX ?

I guess it's something related to \escapechar, because when I changed that control sequence the output changed too:

\escapechar=^
\string\TeX


it generates ^TeX.

The ASCII code of \ is 92, and this is also TeX's internal code for the backslash. Now have a look at Appendix F of the TeXbook (F like Font Tables). There you see that the typewriter font cmtt10 indeed has a \ sitting in position 92 (which is ´134 in octal notation), whereas the standard text font cmr10 has a quotation mark “ in that position. The reason for the latter is that in a standard text you'll need quotation marks quite often, but hardly ever a backslash.

If you want to procude the font tables yourself, use the following code (thanks to Stefan Kottwitz for the suggestion!):

\documentclass{article}
`