# How can I make the copied-pasted text from an pdflatex output still readable/compilable by pdflatex?

## The issue

I compile a latex document which contains accents ("é" for instance), then I copy the text from the pdf generated by pdflatex. Then, I paste this text to my latex file.

The resulting file cannot be completed, for some encoding reason.

Is there a way to solve this problem?

### PS:

My system is OSX. My TeX distribution is TeXLive. My PDF previewer is Preview (the default Apple previewer application).

### PPS:

This problem seems to be related more to Apple's Preview application than anything else.

## Minimal non-working example

\documentclass{article}

\usepackage{cmap}
\usepackage[french]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

\begin{document}

Copy this text "éàoùôêèç" and then paste it here : éàoùôêèç

Then compile again.

\end{document}


## The error

./Sans-titre.tex:10: Package inputenc Error: Unicode char \u8:Ì not set up for use with LaTeX.

See the inputenc package documentation for explanation. Type H for immediate help. ...

                                               l.10 ... oÃ¹ÃŽÃªÃšÃ§" and then paste it here : eÌ
aÌouÌoÌeÌeÌcÌ§


• Works fine for me (with and without cmap) on windows and sumatra or adobe reader. – Ulrike Fischer May 6 '14 at 11:33
• My system is OSX. My TeX distribution is TeXLive. My PDF previewer is Preview (the default Apple previewer application). – Colas May 6 '14 at 11:58
• Imho Apple decompose sometimes the glyphs in char+combining accent when you copy & paste. If you don't have this problem when you copy from other pdf's then it is perhaps due to the glyph names. You could then try \pdfglyphtounicode to change them. tex.stackexchange.com/a/4398/2388. – Ulrike Fischer May 6 '14 at 12:09
• Yes, it works with Acrobat Reader. – Colas May 6 '14 at 12:23
• I am using \input glyphtounicode \pdfgentounicode=1 when I am using the IL2 font encoding, or, I am using xelatex and lualatex engines without the inputenc package (I am using fontspec instead). – Malipivo May 6 '14 at 12:26

This problem comes from Apple's Preview application up to OS X 10.9. I have not tested on newer versions.