How do I know which ligatures are used in my document?

In order to know which ligatures I might consider disabling, I would like to know which ones are actually used in my document. (Which ligatures are provided by a font is a more general question; I have created a separate question for this: Which ligatures do the fonts used in my document offer?)

The following code

\RequirePackage{fix-cm}
\documentclass[12pt]{memoir}
\usepackage{fixltx2e}[2006/09/13]
\usepackage{microtype}

\begin{document}

flicker -- fingers affliction affidavit

\end{document}


will ligate "fl", "--", "fi", "ffl", and "ffi", but not "ff" or "---". (I think this covers the standard ones for English. Of course en-dash (for "--") and em-dash (for "---") aren't normally considered ligatures, but I've seen them being referred to as such by at least some literature on (La)TeX, so I'm including them here. In this context this can be justified, as (La)TeX treats (creates/processes) them as ligatures.) How can I find out about this in an automated manner? I normally use pdflatex, if this matters.

-
Please have a look into the manual of microtype there you will find a command not to use ligatures ... Also see disabling selected ligatures .... – Kurt Mar 31 '13 at 3:00
@Kurt I'm familiar with the microtype manual. I would prefer to not indiscriminately disable all ligatures because that will disable the en- and em-dashes too (at least if they're called by -- and ---; I know I can produce them otherwise). For that reason it is advisable to manually specify what to disable (and perhaps I like some ligatures). But in order to do this appropriately, I need to know which ligatures are actually applied in my document (even better: which ligatures exist in the fonts I'm using, but that's probably a harder question to answer). This motivated my question. – Lover of Structure Mar 31 '13 at 3:04
As Ulrike said in her answer in the linked question there is no way to do this for exact one ligature. You have to change the metrics in the tfm files (there you can find all ligatures for your font). I wouldn't do that ... – Kurt Mar 31 '13 at 3:10
@Kurt I'm familiar with the linked-to question and the content there too. What you point out is a limitation of microtype, and in any case this limitation is not a reason for why it wouldn't be worth knowing what ligatures have actually been applied in my document. I might want to make sure they paste with certain Unicode code points. Or I might want to disable a subset of ligatures (to the extent microtype lets me do this). I might want to manually call ligatures into my document. I might just be curious and compare the result to another piece of software. And so on. – Lover of Structure Mar 31 '13 at 3:28
For a method that disables certain ligatures selectively or globally see, e.g., (Suppression of a ligature in XeLaTeX)[tex.stackexchange.com/q/86593/5001]. Note that the selnolig package mentioned in the answers requires the document to be typeset using LuaLaTeX rather than pdfLaTeX or XeLaTeX. – Mico Apr 1 '13 at 6:59

I would say you can't, not in an easy way.

At first you don't have a clear concept about what is a ligature and what not: from the technical point you could mean every replacement of one or more glyph by one or more other glyphs. Then the spanish ¿ would count as a ligature of "?" -- only because TeX converts this input to ¿. But from the typographical view only some glyphs count as ligatures: the fl combination is a ligature, but not —.

At second: you can look up the replacement ("ligature") rules of a font in the tfm. But I don't think that there is a way to get notified when one of these rules are applied (this could be different with luatex. There it is possible to inspect the nodes).

But even if you could mark somehow all glyphs that are results of the ligature process: It wouldn't mean that all ligature glyphs are marked. It is quite possible to input a ligature glyph directly:

\documentclass{article}
\usepackage[T1]{fontenc}

\begin{document}
ff \char"1B
\end{document}


So to really get a complete information about (ligature) glyphs used in a pdf you will have to inspect this very pdf.

-
First of all, I think this is a good answer. Some opinions: 1. I agree about ! and ? (which are in the same class as -- and ---), though I'd put them (together with -- and ---) into the category "predictable TeX quirks", so they can easily be excluded (or not, which would be interesting too). 2. I agree about the limitation wrt inputting ligature glyphs directly. 3. This still leaves us (the community) with two very sensible options: (i) wait for a LuaTeX guru to solve it :-) and (ii) figure out tfm-files. – Lover of Structure Apr 1 '13 at 0:17
I just opened a bunch of tfm-files randomly (they all look binary); is there an obvious "easy" way of extracting what I need (a ligature list) from them? If not, what might be the best source for me to look into to figure it out? (Of course "making it a separate question" is always a lazy possibility ...) – Lover of Structure Apr 1 '13 at 0:19
@LoverofStructure You can translate tfm files to human-readable format (pl: "property list") with tftopl`. – Robert Apr 1 '13 at 2:51
You need to look at the vf file if you use virtual fonts, too. These can be similarly converted with vftovp. – cfr Nov 21 '13 at 4:01