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

Could you explain to me why

a\_b {\ttfamily a\_b} \\
a\_b {\ttfamily a\_b}


alt text


I would like to have the short underscore in the normal text and the long one in fixed-width font. I cannot change {\ttfamily a\_b}. The other a\_b I can change.

Thanks for your help!

EDIT: I realized that a\textunderscore b solves my immediate problem in text. I would still like to know where the mysterious dot is comming from.

In math mode,


LaTeX stops compiling altogether on my installation (without error, it just halts).

share|improve this question
up vote 7 down vote accepted

Your \chardef defines \_ to be the character in position "5F (ASCII for the underscore character), and that position just happens to contain the mysterious dot. At least it does in cmr10, and apparently it does in the font you're using as well (run (pdf)tex testfont to make font tables for any font you're curious about). The standard definition of \_ in plain TeX just typesets a rule of some suitable width, as there isn't any underscore glyph in the cmr font. I assume something similar is true in LaTeX, though I haven't bother to dig my way past the \textunderscore magic.

I am not too sure about what you can do, though. The whole LaTeX font selection business is a weak point of my TeX foo.

share|improve this answer

In a fix-width font every symbol should have the same width. So a long underscore is a bit unusual. In any case: in OT1-encoding (which you are obviously using) \_ calls internally \textunderscore, which in turn is define as a rule of width 0.3em and some space. You can redefine \_ to get a longer rule and use \textunderscore at other places:

  \leavevmode \kern.06em\vbox{\hrule width.6em}}

a\textunderscore b  {\ttfamily a\_b}


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.