1

Suppose I mention Aristotle in one context at the top of page 40. And then there is a discussion of a quite different argument of Aristotle's from the bottom of page 41 to page 43. I'd like the index entry to read

Aristotle, 40, 41–43

But putting \index{Aristotle} on p. 40, and then \index{Aristotle|(} on 41, and \index{Aristotle|)} on p.43 gives the unwanted

Aristotle, 40–43

So -- headline question -- is there a way to force indexing to ONLY collapse adjacent page numbers into page ranges when EXPLICITLY told to?

I'm using the Memoir class, if that makes a difference! And apologies if I've overlooked an existing answer to what seems a pretty basic question.

1 Answer 1

1

You can run MakeIndex with the -r command line option.

In the following example I use imakeidx for convenience, so I can directly pass the option for the automatic call of makeindex.

\documentclass{memoir}
\usepackage{imakeidx}

\makeindex[options=-r]

\begin{document}

A page with a reference to \index{Aristotle}Aristotle.

\clearpage

A group of pages that describe \index{Aristotle|(}Aristotle

\clearpage

Again about Aristotle.

\clearpage

Again about \index{Aristotle|)}Aristotle.

\printindex

\end{document}

enter image description here

From the man page:

       -r        Disable implicit page range formation; page ranges  must  be  created  by
                 using  explicit  range operators; see SPECIAL EFFECTS below.  By default,
                 three or more successive pages are automatically abbreviated as  a  range
                 (e.g. 1--5).
1
  • Thanks! Very oddly, when I had tried this before I got consistent error messages, and just couldn't get imakeidx to play nicely. But having since cleaned up the doc's preamble removing some unused packages, all works perfectly. Heaven knows what was causing the glitch! Aug 13, 2019 at 10:59

You must log in to answer this question.

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