A LaTeX indexing trick

Oh, the joys of indexing … Though using the LaTeX indexing tools reduces the pain a bit. Encountered one problem, however:

Suppose you mention Aristotle (as you do) at the top of p. 40. And then you discuss a quite different point from Aristotle e.g. from the bottom of p. 41 over to page 43. Then you surely want the index entry to read

Aristotle, 40, 41–43

So you put \index{Aristotle} in your text around the top p. 40, and then mark the start of the page range with \index{Aristotle|(} near the bottom of p. 41 and finish the range with \index{Aristotle|)}. Only to find to your annoyance that Makeindex produces

Aristotle, 40–43

Drat! What to do?

As I discovered from tex.stackexchange, the thing to do is to use the imakeidx package, and so your preamble has


The option suppresses adjacent page numbers for an index heading being crunched into a page range, so that page ranges are given only in response to explicit codings for ranges using \index{headword|(} and \index{headword|)}.

Maybe everyone except me knew that! — but I will add a note for posterity to LaTeX for Logicians.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top