When using copy paste from the PDF generated from my Latex document, the text comes out garbled. What could be causing this?

This is an example of the original text:

At last, and taking the risk a being too abstract, I should point out that evolutionary algorithms are inspired by nature's evolutionary process. This is a good opportunity to gain some insight how deeply can that metaphor hold. Specially since life itself is less a phenomena of optimising functionality but more of getting good results with what you already have while not becoming too sensitive to internal and external variation. This last aspect must not stand in the way of obtaining phenotypes with biological interest but is relevant nonetheless.

And this is the garbled copy-paste:

❆t ❧❛st✱ ❛♥❞ t❛❦✐♥❣ t❤❡ r✐s❦ ❛ ❜❡✐♥❣ t♦♦ ❛❜str❛❝t✱ ■ s❤♦✉❧❞ ♣♦✐♥t ♦✉t t❤❛t ❡✈♦❧✉t✐♦♥❛r2 ❛❧❣♦r✐t❤♠s ❛r❡ ✐♥s♣✐r❡❞ ❜2 ♥❛t✉r❡✬s ❡✈♦❧✉t✐♦♥❛r2 ♣r♦❝❡ss✳ ❚❤✐s ✐s ❛ ❣♦♦❞ ♦♣♣♦rt✉♥✐t2 t♦ ❣❛✐♥ s♦♠❡ ✐♥s✐❣❤t ❤♦✇ ❞❡❡♣❧2 ❝❛♥ t❤❛t ♠❡t❛♣❤♦r ❤♦❧❞✳ ❙♣❡❝✐❛❧❧2 s✐♥❝❡ ❧✐❢❡ ✐ts❡❧❢ ✐s ❧❡ss ❛ ♣❤❡♥♦♠❡♥❛ ♦❢ ♦♣t✐♠✐s✐♥❣ ❢✉♥❝t✐♦♥❛❧✐t2 ❜✉t ♠♦r❡ ♦❢ ❣❡tt✐♥❣ ❣♦♦❞ r❡s✉❧ts ✇✐t❤ ✇❤❛t 2♦✉ ❛❧r❡❛❞2 ❤❛✈❡ ✇❤✐❧❡ ♥♦t ❜❡❝♦♠✐♥❣ t♦♦ s❡♥s✐t✐✈❡ t♦ ✐♥t❡r♥❛❧ ❛♥❞ ❡1t❡r♥❛❧ ✈❛r✐❛t✐♦♥✳ ❚❤✐s ❧❛st ❛s♣❡❝t ♠✉st ♥♦t st❛♥❞ ✐♥ t❤❡ ✇❛2 ♦❢ ♦❜t❛✐♥✐♥❣ ♣❤❡♥♦t2♣❡s ✇✐t❤ ❜✐♦❧♦❣✐❝❛❧ ✐♥t❡r❡st ❜✉t ✐s r❡❧❡✈❛♥t ♥♦♥❡t❤❡❧❡ss✳

The commands I run to generate the pdf are:

    pdflatex thesis.tex
    bibtex thesis
    pdflatex thesis.tex
    pdflatex thesis.tex

I am using the debian packages from debian wheezy.

This is the minimum example with the problem.


% The Unicode character encoding UTF8 includes several special characters and characters with accents.
% The following code specifies that the encoding of the LaTeX document source file is UTF8.
% Font encoding is specified as T1, because it supports the encoding of extended character sets in fonts.

\title{A optimisation tool for the functional improvement\\ of Biological Models}

Some garbled text with an accented à.

Some garbled text.

  • 2
    Are you loading the fontenc package; for example, \usepackage[T1]{fontenc}? Sep 17, 2012 at 13:51
  • You should post a minimal example which reproduces the error. Probably interesting are fontenc, cmap, and your used font. Also maybe your pdf reader.
    – Juri Robl
    Sep 17, 2012 at 13:52
  • 1
    A MWE (minimal (non)Working Example) would be really useful. Sep 17, 2012 at 13:59
  • 2
    No, you should really use fontenc. See here
    – Juri Robl
    Sep 17, 2012 at 14:09
  • 1
    @AlexandreMartins Your example works fine for me. Maybe it's a problem with your pdf reader. Have you tried another one? (I included fontenc in the test).
    – Juri Robl
    Sep 17, 2012 at 14:12

2 Answers 2


It depends on the fonts that you are using:

pdffonts test.pdf

Type 3 fonts

Try to avoid them, because they are bitmapped fonts that do not scale well. Also the characters do not have glyph names that make it easier for text extraction tools.

If you are using \usepackage[T1]{fontenc} with standard fonts, then you get the EC fonts. Install cm-super to get the Type 1 versions. Alternatively use the successor fonts Latin Modern (\usepackage{lmodern}).

Package cmap

It is based on LaTeX's font encodings and adds map entries from slot positions to Unicode slots.

The package should be loaded at the very beginning:


The package does not depend on correct glyph names in the font or the font type. On the other side, undefined encodings (for symbol fonts, …) are not well supported.


This primitive of pdfTeX adds the Unicode mapping based on font glyph names. It does not work for Type 3 fonts. The support is better if the fonts contain the correct glyph names and a mapping is provided.


\pdfgentounicode=1 %
\input glyphtounicode.tex %

The file glyphtounicode.tex contains predefined mappings for many glyhp names to Unicode.

Package accsupp

The package uses the /ActualText feature of PDF that allows to say what text should be used for the displayed glyphs. This allows the support and finer control of symbols, for example.

PDF viewer/text extractor

Also it depends on the PDF viewer or tool that extracts the text, what features they support to detect the characters. Some might only work with glyph names and slot positions, others support the Unicode mappings (they should) and more advanced support the /ActualText feature.

Addition: Package cmap and the method \pdfgentounicode should not be used together, because they add the same data structures to the fonts in the PDF file. If these are the same exactly it would not be too much of a problem, but there might be differences and this violates the PDF structure causing unpredictable behavior of the PDF reader applications that are free to choose, which value they use for the same key.

  • Should you use cmap together with glyphtounicode, or only one of them?
    – Juri Robl
    Sep 17, 2012 at 14:17
  • 2
    And installing cm-super solves the problem and makes copy-paste work well with all the pdf viewers I tried. Evince, PDF-XChange and Okular Sep 17, 2012 at 14:54
  • @HeikoOberdiek Just one question. Is there any advantage in using lmodern instead of cm-super? Sep 17, 2012 at 14:56
  • Thanks for the thorough listing of options and possibilities @HeikoOberdiek. And here is an answer to my own question tex.stackexchange.com/questions/1390/latin-modern-vs-cm-super . Sep 17, 2012 at 15:32
  1. Remove this package \usepackage[T1]{fontenc} and see. It worked for me.
  2. Or retain this package \usepackage[T1]{fontenc} and add \usepackage{lmodern}. It worked for me, too.
  • This answer is not helpful at all. Why does this work? What are the side effects of the proposed solution. 1. is not a good idea at all and 2. is covered in the other answer.
    – schtandard
    Jun 17, 2019 at 14:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .