# Ligatures with Libertine: issue with pdflatex (and Windows)

If you compile the piece of code given below using pdflatex, then open the resulting PDF file with your preferred viewer, copy the word "efficient" and paste it in a text editor, you will read "efcient". This does not happen with xelatex or lualatex. Is there a way to fix this issue with pdflatex?

\documentclass[fleqn,10pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{libertine}
%\usepackage{lmodern}
\begin{document}
efficient
\end{document}

• Doesn't happen to me. Can you be more precise about your TeX system? Sep 11, 2018 at 11:13
• Add \input glyphtounicode \pdfgentounicode=1. Sep 11, 2018 at 12:13
• @Mico yes I could but it looks like there is an easier fix, see above. Sep 11, 2018 at 12:30
• @Mico I see the problem also with tl2018. Imho it is (also) viewer (and so OS) dependant. Sep 11, 2018 at 12:47

\input glyphtounicode
\pdfgentounicode=1


glyphtounicode.tex contains a lot of mappings like

\pdfglyphtounicode{ffi}{0066 0066 0069}


which are added to the pdf and helps the viewer to correctly interprete special chars. I didn't check which of the mappings is needed for libertine, imho it doesn't harm to simply load the whole lot.

The issue itself can be viewer dependant -- some are better in guessing than other.

• Why not simply load cmap, see pdftex-a.pdf, p. 31: »LaTeX users could load the cmap package to achieve the same effect.« ? Sep 14, 2018 at 12:03
• @KeksDose cmap doesn't work for all fonts (and here not with libertine). "The main limitation currently is inability to work with virtual fonts". Sep 14, 2018 at 12:24
• Aha, thank you! I should have had a look into the cmap manual. Which says, by the way, the inablity to work with virtual fonts were a limitation of pdftex. So on the pdftex side this is no longer a limitation? Sep 14, 2018 at 12:26