7

For some reason, I'm really struggling to articulate my question, so let me apologise in advance. I may not be approaching this from the right angle.

I'm working in XeTeX (and it's far too late to change to LuaTeX). The font I've chosen has the problem with ligatures displaying properly, but containing garbage when copy-and-pasted from the resulting PDF. This also makes the PDF much less searchable, since, e.g., "flow" won't be found because of the "fl" ligature.

After a significant amount of googling, it appears to me that there is no proper solution to address this yet. One less-than-ideal option is to use the accsupp package, and to provide XeTeX and the PDF with different strings. For example, this works:

\documentclass{article}
\usepackage{fontspec}
\setmainfont{Minion Pro}

\usepackage{accsupp}

\newcommand\ligfl{\BeginAccSupp{method=escape,ActualText=fl}fl\EndAccSupp{}}

\begin{document}
flow vs. {\ligfl}ow
\end{document}

(Before anyone suggests it, I'm not actually using Minion Pro, so \usepackage{MinionPro} is not the way to go for me.)

One option would be to do a find-and-replace on "fi", "ffi", "fl", and "ffl" to change them to commands like the \ligfl above. This is doable, and I may have to resort to it, but before I do, is there a more flexible, elegant way to do it than the hard-coding above?

What I would ideally like to do is either:

  1. make the "ligaturisable" character pairs or triplets active, and have, e.g., each fl automatically interpreted as {\ligfl}. I may have been searching incorrectly, but there appears to be no way to do this; or

  2. use some sort of pre-processor or similar which would change all fls to {\ligfl}s just before the document is built. (Realistically, though, I think I'd struggle with this option as I'm working in LyX.)

or, of course, a third option I haven't thought of.

Any help would be greatly appreciated.

  • 1
    you can't use active characters as if you make f active to look for fl fi etc then you won't be able to use any command with an f such as \footnote. It should be fairly simple in any editor with regular expressions to change every instance of fl not in a command name by \ligfl – David Carlisle May 2 '13 at 19:03
  • 1
    Am I mistaken if I think that you do not use ligatures everywhere where they are possible? For example, I thought I read that one were not to use the “fl” ligature for example in the (German) word Auflage, because the ligature would be across the morpheme boundary (Auflage has the two morphemes “Auf” and “lage”) … if this is correct, the suggested solution is improvable. But I am no expert typographer by any means, so any correction on this is appreciated. – brian-ammon May 31 '13 at 21:14
1

You could just disable the ligatures and try. It worked for me though and I don't seem to have any problem now.

\DisableLigatures[f]{encoding = *, family = *} – include this in the preamble.

Hope it works for you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.