TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I know a number of ways to fix this (e.g. \usepackage[T1]{fontenc}), but I want to understand what's happening in the following example.

\$ \% \& \{ \} \_ \# \textbackslash \\
\ttfamily \$ \% \& \{ \} \_ \# \textbackslash \\
\verb+$ % & { } _ # \ +

escaped characters

  • Why does attempting to obtain a \ttfamily brace, underscore or backslash result in the substitution of the ordinary roman symbol? The glyphs are clearly not missing, because verbatim mode can access them.

  • How exactly is verbatim mode accessing these glyphs?

  • Deleting the braces and the backslash, so that the underscore is the only remaining 'problem' character eliminates the font warnings, despite the fact that a substitution is still taking place. Why is this?

share|improve this question
up vote 16 down vote accepted

\verb and verbatim assume the font has these characters in their ascii positions and locally makes the characters be catcode 12 (like punctuation) with no special defintion.

\textbackslash (and friends) is defined to be a encoding-specific command and (to fake an air of sanity over the original TeX encodings) LaTeX assumes that OT1 encoding is the encoding of cmr10 which does not have a backslash char. So in OT the default definition is used (which uses the math fonts). \ttfamily changes the family but not the encoding and so in that case you get the OT1 definition even though the cmtt font is really encoded differently.

Things work better in T1 because the fonts labelled as T1 encoded do in fact have the same encoding.

\_ is different because \textunderscore has a default definition that doesn't use a font at all but a horizontal rule.

share|improve this answer
+1 - What a beautiful answer. Thanks. – Sigur Aug 21 '12 at 0:44

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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