I notice that in a pdf file compiled from Latex, "fi" such as in "field" cannot be separated as "f" and "i" when copying text out of the pdf file. I wonder why and if this can be changed? Thanks and regards!
The following is taken "verbatim" from the TeX Book (Chapter 9 TeX's Roman Fonts, p 51):
Of course, TeX writes ligatures for most of its accents as well, as in
Note how some of the symbols occur in a single box, implying that are "joined at the hip" so to speak, representing a single character (or ligature) in the typeset output. Additionally, this is font specific, with different fonts having different (more or less) ligatures.
cmap package was written to solve this problem. From the documentation:
This works for me:
Update: Ulrike Fisher in comments says that pdfglyphtounicode is better, see Make ligatures in Linux Libertine copyable (and searchable)
If it's already in the compiled pdf, there's not much you can do. Consider the following MWE:
If you compile this program with pdflatex, you should get this:
Note the appearance of the five ligated characters. However, if you copy-and-paste the output (I'm using TeXLive 2011 and TeXworks as the front end as I'm writing this), you'll get:
I'm afraid that the data entry system for this site doesn't seem to render the various weird symbols properly, so you'll have to trust me when I say I see a pair of musical notes, a masculine and a feminine gender symbol, and some unrecognizable shapes. (Interestingly, the "fl" glyph appears to be represented by an invisible newline character, hence the characters "at" show up on the second line.)
However, if I change "OT1" to "T1" (the more-modern font encoding scheme for English-language text -- also OK for many non-English languages) in the MWE, recompile it, and copy-and-paste the output from the resulting pdf file to an ascii editor, I get:
as one would hope to get, i.e., all five ligated character combinations are now recovered correctly.
I haven't repeated this experiment with other modern font encodings, but I suspect that the problems -- i.e., the ligated glyphs being rendered incorrectly when copied from the pdf file to a plain-text file -- are specific to the OT1 font encoding method. If you come across a pdf file that was created with latex and the ligature glyphs look all funny, and if the opportunity presents itself, you may wish to ask the paper's author if he/she might be willing to recompile it with the