Take the 2-minute tour ×
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.
\documentclass{article}
\usepackage[T1,OT4]{fontenc}
\begin{document}
Text with \_.
\end{document}

In PDF there is a correct output: Text with _.
But when I select and copy it I get: Text with .

It happens on Adobe Reader, Foxit Reader and on Sumatra PDF so I think it is not a reader issue.

How can it be fixed?

share|improve this question
    
WHy do you need the two encodings (OT4 and T1)? –  Gonzalo Medina Aug 27 '12 at 12:19
    
I really don't know :P. I have always had T1 and OT4 in my docs... –  Ichibann Aug 27 '12 at 12:23
    
I've added a remark to my answer. –  Gonzalo Medina Aug 27 '12 at 12:25
1  
@Ichibann The T1 encoding has complete coverage for Polish diacritics. There is no need for OT4 for typesetting Polish. –  egreg Aug 27 '12 at 14:08
    
It's 2012. Go Unicode and use XeLaTeX or LuaLaTeX and forget about encodings. –  Martin Schröder Aug 27 '12 at 21:01
add comment

2 Answers

up vote 3 down vote accepted

Change to

\usepackage[OT4,T1]{fontenc}

As far as I can see it, you don't really need the OT4 encoding; according to this remark from the fontenc documentation referring to OT4:

While Knuth included the means of typesetting the ‘lost L’ (Ł) in his OT1 encoding, he omitted the ogonek, a diacritic mark that is also needed in Polish text; hence the appearance, well before the T1 encoding, of fonts using this encoding.

So you can simply say

\usepackage[T1]{fontenc}
share|improve this answer
    
I have \usepackage[T1,OT4]{fontenc} in my real document. I think I need OT4. –  Ichibann Aug 27 '12 at 12:12
    
@Ichibann use \usepackage[OT4,T1]{fontenc}; by the way, you should have mentioned this in the question. –  Gonzalo Medina Aug 27 '12 at 12:14
    
Gonzalo, I didn't know it was causing the problem. I tried to make a real MWE. So I removed everything that didn't change the output. This included \usepackage[T1,OT4]{fontenc}. –  Ichibann Aug 27 '12 at 12:16
add comment

"Old" fontencodings like OT1 or OT4 don't have a glyph for \_ (\textunderscore), they use the default defined in the kernel which is a small rule. But you can change this default so that the glyph from the T1-encoding is used instead:

\documentclass{article}
\usepackage[T1,OT4]{fontenc}
\DeclareTextSymbolDefault{\textunderscore}{T1}
\begin{document}
Text with \_.
\end{document}
share|improve this answer
add comment

Your Answer

 
discard

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.