44

I'm currently working on an essay written in LaTeX form. I'm facing problems with ligatures - in my pdf output (rendered using pdftex) opened in Adobe Reader I get X's and V's when copy-pasting words including ligatures (ffi, fi, etc.).

I have tried both the cmap and the mmap package - I have tried the mmap package with and without the noTeX parameter without success. To speed up rendering time, I'm pre-compiling headers - can this cause problems do you think? I am putting the \usepackage{mmap} directly under the \documentclass command, however it is in the header that I have pre-compiled - do you suspect this might be of a problem? If so, what would you recommend I do? I would like to, as much as possible, keep my header-hierarchy for the sake of compiling time, but then again, if that's the only way to go then I'm willing to get rid of it.

I am using the Linux Libertine font - might this be of trouble?

Below is my header and the beginning and end of my document: http://latex.pastebin.com/51MUAfA6

The lettrine command and package is used to create dropped caps. I am on a Windows system, running the latest MiKTeX version. Is there anything else you would need to know in order to help me out?

1
  • Why don't you try other fonts and other PDF viewers (with and without precompiling headers...) and compare the results? I do get the problem with the libertine package with Adobe Reader, but the same document copies and pastes correctly with the evince PDF reader. Switching to computer modern makes it work with either reader.
    – frabjous
    Oct 21, 2010 at 16:42

1 Answer 1

36

Try the following. And next time make an example with less fancy formatting. Concentrate on the problem.

\documentclass[a4paper,12pt]{article}

\usepackage[ansinew]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{libertine}
\input{glyphtounicode}

\pdfglyphtounicode{f_f}{FB00}
\pdfglyphtounicode{f_f_i}{FB03}
\pdfglyphtounicode{f_f_l}{FB04}
\pdfglyphtounicode{f_i}{FB01}

\pdfgentounicode=1
\begin{document}
ff fl ffi
\end{document}

glyphtounicode.tex should be in your texsystem in tex/generic/pdftex. But you can also find it in the texlive source: https://www.tug.org/svn/texlive/trunk/Master/texmf-dist/tex/generic/pdftex/glyphtounicode.tex

6
  • I deemed it necessary to include the fancy formatting simply because I wasn't sure that it wasn't causing the problem. Your solution works but is somewhat hefty - are you sure there isn't a better way of doing this? I did a c&p in evince and that worked better - why doesn't AReader like ligatures?
    – Doggie52
    Oct 21, 2010 at 17:26
  • 6
    The best would be that libertine corrects the glyph names. cmap will not work (it doesn't work with virtual fonts). ntg.nl/pipermail/ntg-pdftex/2009-December/003870.html, tug.org/TUGboat/Articles/tb29-1/tb91thanh-fonts.pdf Oct 21, 2010 at 18:09
  • 21
    @Doggie52: It's better that the person asking the question does the work of figuring out which aspects of their document are responsible for their problem, and removing everything superfluous. It makes it much easier for people to answer the question if it has only the minimal packages and formatting necessary to demonstrate the issue. That way you are likely to get more answers and better ones.
    – Lev Bishop
    Oct 21, 2010 at 19:10
  • 4
    I shall keep this in mind, Lev!
    – Doggie52
    Oct 24, 2010 at 10:10
  • 2
    This does not, however, work if you compile with XeTeX/XeLaTeX, cf. tex.stackexchange.com/questions/110354/…
    – Sverre
    Apr 23, 2013 at 19:56

You must log in to answer this question.

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