I was reading Why can't "fi" be separated when being copied from a compiled pdf? and had a thought:

I know that v1.4 and up PDF documents have an OCR layer. Would it be possible to have PDFTeX or luaTeX place the un-ligatured text into the OCR layer, so that you don't have inconstant or odd behaviour when copying ligatures?

It also occurs to me that this also be a workaround for my troubles copying mathmode greek characters, discussed in Proper way to use greek letters in an English document . This also seemed like an ideal way to provide more accessible code for equations, as trying to copy them right now is not exactly useful.

  • 2
    I would rather use some technique as shown in Is it possible to provide alternative text to use when copying text from the PDF?. This should result in a much smaller file size than having all text twice in different layers. Also the OCR layer might not be accessible from LaTeX because of the lack of support. Nov 2, 2011 at 20:12
  • I don't see any way of doing that for my whole document though- I would have to do that for every ligature, wouldn't I? (I did look at that question as I posted this, but dismissed it) Also I don't worry about text file size- One image, even a small one, will increase my file size by more then the entire text of the document. You can fit the entire text contained in the library of congress on 1 CD-ROM.
    – Canageek
    Nov 2, 2011 at 20:20
  • I don't see any way to put all text of the whole document in the normal and the OCR layer. AFAIK you need to connect both layers, i.e. every character in the OCR layer to every character in the normal layer. This requires some PDF formatting code which takes far more space than the character itself. Nov 2, 2011 at 20:24
  • @MartinScharrer I regularly download scientific journals that are OCRed images, and these are not totally insane files sizes, so yes, there would be a hit, but in some cases it might be worth it. Too bad, it would be something I'd like to experiment with.
    – Canageek
    Nov 3, 2011 at 18:13

1 Answer 1


Two possible tools you can use to achieve what you are after:

The first one is calibre-ebook, which can do pdf to pdf conversions, plus a tonne of other formats.

The second is Heiko Oberdiek's experimental package accsupp. This enables you to map alternatives to characters and text for accessibility purposes, but will achieve what you want as well. At the end of the day I think it is high time we stop using ligatures. They don't offer much in terms of improving typography on a screen.

The below example is from the package. You need to adapt to suit.

        a\texttwosuperior +b\texttwosuperior
    a^2 + b^2 = c^2

Your suggestion to map it to the OCR layer is not an option unless you scan the PDF and OCR it. To summarize start with calibre-ebook and if it cannot offer you what you want explore the other options.

  • 5
    I strongly disagree that we need to stop using ligatures: Once you start to notice them reading text without them becomes more and more painful.
    – Canageek
    Mar 10, 2012 at 22:41
  • @Canageek Most of our documents are now in electronic form. Text with ligatures gives problems with search. Put this dœs through a spell checker. Mar 11, 2012 at 2:12
  • 9
    Which is why documents & search algorithms should be adapted to deal with this automatically.
    – Canageek
    Mar 12, 2012 at 16:01
  • Additionally, this is not only a problem with ligatures, you will have issues when using "OldStyle" numbering as well. So there is a real issue here.
    – Dan
    Jun 1, 2012 at 10:16

You must log in to answer this question.

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