TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

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

Fair warning: I know approximately zero things about fonts and font encodings, so this is perhaps another naive question on my part.

Recently, I asked about the behavior of \detokenize{_}, as one needs to specify \usepackage[T1]{fontenc} for it to work as expected.

Apparently, the default font encoding for LaTeX is OT1, and there is no _ in OT1. Thus, for something like \detokenize{_} or \string_ to render as _ and not ˙, one must specify T1 font encoding.

Yet, as @egreg points out in a comment on that question and as we all are likely aware, \_ renders as _ in LaTeX without having to do anything to the font encoding.

So, my question is how can LaTeX actually render \_ as _ if there is no _ in OT1, which is the default encoding?

share|improve this question
up vote 14 down vote accepted

plain.tex includes

\def\_{\leavevmode \kern.06em \vbox{\hrule width.3em}}

latex.ltx includes

  \leavevmode \kern.06em\vbox{\hrule\@width.3em}}



but t1enc.def includes


so that the actual underscore from the font is used if T1 is loaded. In that case, the \DeclareTextSymbol from t1enc.def overrides the default meaning of \textunderscore from latex.ltx and, hence, of \_. If T1 is not loaded, of course, and OT1 is used, the default definition is not overridden and TeX essentially fakes the underscore when \textunderscore or \_ is typeset.

share|improve this answer

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.