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

When I use \textunderscore to print an underscore "_" character, the copy-paste functionality of Adobe Acrobat Reader does not appear to work properly. For instances, when I copy


from Acrobat, and paste it in notepad, I get

test case

How to ensure that underscore is copied properly?

share|improve this question
You have to use T1 encoded fonts (\usepackage[T1]{fontenc}), otherwise the underscore is emulated with a rule and is not a character. – egreg Jan 30 '12 at 12:57
@willem: You can use \_ instead, and this will copy the underscore no problem such as: test\_case. Try this for yourself to see. – night owl Jan 30 '12 at 13:00
including \usepackage[T1]{fontenc} does the trick, both when using \textunderscore and when using \_. \_ doesn't work without using \usepackage[T1]{fontenc}. Perhaps post your fix as answer, as I didn't know that underscore gets emulated without T1? – willem Jan 30 '12 at 13:24
up vote 6 down vote accepted

The fonts used with the "Original TeX" encoding (aka OT1) don't have an underscore character: they are only 7 bit fonts (128 characters) and some positions are hijacked to make room for more useful characters. For example in the position of the underscore there is the "dot accent", in place of < and > there are ¡ and ¿.

So with the default OT1 encoding, the command \textunderscore (or \_) is defined to produce a small rule, which is not recognized by PDF viewers as a character.

The problem doesn't show when T1 encoded fonts are used, because this encoding has all the printable ASCII characters in their slots. So the answer is


Make sure to have available the CM-Super font package, or the T1 fonts will be in bitmap form. An alternative is to use also


since the Latin Modern fonts are almost the same as the European Modern that are chosen by default with T1 and are surely available as Type1 fonts.

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.