I'm creating an index using makeidx. When I have a "see also" cross-reference in an entry, I want it to appear after the listing of page numbers. But instead it appears before the listing.

Here's what the output currently looks like:

quantifiers see also numbers, cardinal, 2

Here's what I want the output to look like:

quantifiers 2, see also numbers, cardinal

Is there a straightforward way to change this behavior, say, in my index style file?

  • 2
    Given that the output is supposed to be the latter, based on what indexing professionals do, I'm sort of surprised that isn't the default.
    – kcrisman
    Jun 28 '19 at 20:55

The order is controlled by the page number. The feature "see" is implemented as encapsulating command:

\index{quantifiers|textbf}% bold page number
\index{quantifiers|see{numbers, cardinal}}%

Makeindex appends the page number, thus the following macro is called in \printindex:

\textbf{1} and \see{numbers, cardinal}{1}

The implementation of \see ignores the page number, but Makeindex sorts the page numbers. With them, the page numbers and see statements are sorted.

The following example defines \indexsee{<index entry>}{<see entry>} that writes the index entry with a quite large page number to sort it at the end. Also the page number is increased each time to avoid warnings of Makeindex, if it sees different encapsulating commands for the same entry.

Macro \index reads it argument in verbatim mode. Therefore \indexsee should do the same to avoid different outcome of the same index keys (more less spaces, expansion, ...).



\index{numbers, cardinal}
\index{numbers, funny}
\indexsee{quantifiers}{numbers, funny}
\indexsee{quantifiers}{numbers, cardinal}


File test.idx, written by the LaTeX run:

\indexentry{numbers, cardinal}{1}
\indexentry{numbers, funny}{1}
\indexentry{quantifiers|see{numbers, funny}}{10001}
\indexentry{quantifiers|see{numbers, cardinal}}{10002}

File test.ind, generated by Makeindex:


  \item numbers, cardinal, 1
  \item numbers, funny, 1


  \item quantifiers, 2, \see{numbers, funny}{10001}, 
                \see{numbers, cardinal}{10002}

  • I have to remark that the book "Indexing for Editors and Authors" by the American Society of Indexers (yes! there is such a thing!) specifically says "A see reference will never have locators." But I presume your solution would work with some modification for seealso?
    – kcrisman
    Jun 28 '19 at 20:54

We could use Xindy for this task, the order of location classes is in our favor and can be used right away. We run some LaTeX engine, e.g.:

lualatex mal-xindy-see.tex
xindy -M texindy -L general -C utf8 mal-xindy-see.idx
lualatex mal-xindy-see.tex

% run: *latex mal-xindy-see.tex
% xindy -M texindy -L general -C utf8 mal-xindy-see.idx
% and *latex again
Text before.
\index{numbers, cardinal}
\index{numbers, funny}
\index{quantifiers|see{numbers, funny}}
\index{quantifiers|see{numbers, cardinal}}
Text after.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.