Fonts & Character SetsCut & Paste from PDF File generated by XeLaTeX

Information and discussion about fonts and character sets (e.g. how to use language specific characters)
Post Reply
novicedude
Posts: 16
Joined: Tue May 25, 2010 10:38 pm

Cut & Paste from PDF File generated by XeLaTeX

Post by novicedude »

Any ligatures (fi, fl, ffi, etc) I have that in the PDF file I generate are not able to be cut and pasted from acrobat to other text editors. When I was using PDFLaTeX, I could use the command \pdfglyphtounicode to map these ligatures to the letters they're made of. But that command doesn't seem to work with XeLaTeX.

Is there a comparable command for XeLaTeX to achieve the same result? Or is there a patch to XeLaTeX (I'm currently using version "This is XeTeX, Version 3.1415926-2.3-0.9997.5 (MiKTeX 2.9 64-bit)")?

(I know I can switch back to PDFLaTeX, but that's not feasible for the stuff I'm needing to do)

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Cut & Paste from PDF File generated by XeLaTeX

Post by localghost »

As always, minimal example please.


Thorsten
novicedude
Posts: 16
Joined: Tue May 25, 2010 10:38 pm

Cut & Paste from PDF File generated by XeLaTeX

Post by novicedude »

The ff, ffi, ffl ligatures copy okay, but the fi and fl ones don't. Another side effect is that these ligatures make it impossible to search for text that has any of them.

A fix for cutting/pasting the quotes would be nice, but isn't as important (for my needs).

Code: Select all

\documentclass [11pt]{article}
\usepackage{xltxtra,fontspec,xunicode}

\setromanfont{Adobe Garamond Pro}

%% these use to work. but not with xelatex
%\pdfglyphtounicode{fi}{0066 0069}
%\pdfglyphtounicode{fl}{0066 006C}
%\pdfglyphtounicode{quoteleft}{0027}
%\pdfglyphtounicode{quotedblleft}{0022}

\begin {document}
files flow
\end {document}
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Cut & Paste from PDF File generated by XeLaTeX

Post by localghost »

The fontspec package manual suggests to turn on TeX ligatures.

Code: Select all

\setromanfont[Ligatures=TeX]{Adobe Garamond Pro}
This comes with no warranty because I have the font not present.
Post Reply