# Where can I find documentation on what "\char" does?

I've seen samples of TeX using

\char\\


to produce a literal backslash. Where can I find documentation on what the \char command does? Is it a generic construct to safely produce reserved literals?

• In the TeXBook by D. E. Knuth perhaps? It's a primitive, anyway
– user31729
Jul 17, 2015 at 7:10
• \char number outputs the letter/symbol according to the encoding: \char 65 would print 'A' (Ascii code), \def\foo{66} and \char\foo would print 'B' then
– user31729
Jul 17, 2015 at 7:22
• note that if you are using latex the supported syntax is \symbol{\\} Jul 17, 2015 at 8:14
• \char\\  does not typeset a \  it typesets whatever is in slot 92 in the current font which is a double quote in classic TeX (OT1) encoding. Jul 17, 2015 at 8:28
• There are three independent problems. First: knowledge about \char number ... it prints the character from the slot number of the current font. That is whole documentation. Second: number can be written in more TeX primitive formats. One of them is backtie some where some is backslash character or directly character (like \b or b). The backslash character format is more compact when you are using special characters. Third: you need to have the right character in the given slot of actual font. This is not always true in classical Knuth's fonts as mentioned by David. Jul 18, 2015 at 5:20

I cite the TeX By Topic book by Viktor Eijkhout.

Here is a an excerpt

\char is basically just for conversion of numbers to a character representation, using the underlying encoding.

'82 uses octal numbers, "82 means hexadecimal numbers.

The last sentence in this excerpt says all: typeset character number so-and-so

• texdoc texbytopic to get a PDF of the book. Jul 17, 2015 at 7:31
• @TorbjørnT: I've done that, but perhaps not everybody has the full TL installed, that's why I provided the link
– user31729
Jul 17, 2015 at 7:32
• I started writing my comment (which I also edited to include a link) before you added the link. Jul 17, 2015 at 7:35
• @retorquere That's no different from if you type in the character yourself. There's no certainly that the font used for output will look like the input: probably the most obvious example of this is using a pifont. Jul 17, 2015 at 8:10
• +1 I'd just emphasize more the word typeset: it's a rather common misunderstanding that \char produces the character for later usage in a token list, but this is false. With XeTeX and LuaTeX one can use \Uchar` for that. Jul 17, 2015 at 8:18