8

If one uses

\index{invariant!\relax|seealso{Lorentz invariance}}%
\index{invariant!\relax|seealso{speed of light}}%

in a .tex file, the makeindex program produces a warning in the .ilg file, when it processes the second entry:

## Warning (input = motionmountain-volume4.idx, line = 29; output = motionmountain-volume4.ind, line = 618):
   -- Conflicting entries: multiple encaps for the same page under same key.

What is the proper way to have several \seealso under one entry, without generating any warnings?

Clarification: the result at present is that despite the warnings all the entries get added, in a series that looks like seealso entry1 seealso entry2 etc.

In my dream, the wanted result is that every seealso starts its own subentry, and that no warnings appear.

  • 4
    since \seealso omits the page number, the best approach i've found so far is to combine the entries: \index{invariant!\gobbble |seealso{Lorentz invariance; speed of light}} with \providecommand{\gobble}[1]{}. this gets rid of the leading comma, but leaves a leading space. (been working on this for a long time, but have yet to find a satisfying solution.) – barbara beeton Mar 7 '15 at 16:07
  • A provocative proposal: Could one not take the warning out? – Motion Mountain Mar 7 '15 at 18:46
  • i'm not really prepared to undertake modification of makeindex, but am trying to find an approach that can produce acceptable output with the possible necessity of redefining some macros. – barbara beeton Mar 7 '15 at 19:12
7

the following test file produces see also references from entries where multiple targets are combined in a single input. since \seealso omits page numbers, i don't see any reason not to combine the targets. (just don't forget to enclose them in braces, so that \seealso sees them as a single argument.)

this coding will set the see also text as the last second-level entry for the main item. \igobble removes the leading comma and space. it should be trivial to create a simple two-argument command to insert the "extra" coding.

this method produces no warnings, a problem noted in the original question.

\documentclass{article}
\usepackage{makeidx}
\makeindex
\def\igobble#1 {}

\begin{document}

some text\index{a} with some index entries\index{b}
and some\index{c} \emph{see also} entries as well.
\index{a!zzzzz@\igobble |seealso {b, c}}
\index{a!bcd}
\index{c!zzzzz@\igobble |seealso {a, b}}

\printindex
\end{document}

output of example code

thanks to andrew swann for the suggestion to use a plain-style definition that will solve the problem of removing an unwanted space. (my latex friends have been trying to break me of the habit of using plain-style commands. but in some situations, latex(2e) has no satisfactory approach.)

edit:
the op would prefer to have each see also entry on a separate line. this can be done, but requires additional attention, mostly bookkeeping. if the dummy sort field is the same for all see also entries for one main entry, warnings are unavoidable, although the output would be okay. to avoid the warnings, different dummy sort fields can be applied. if doing this, it's necessary to assign them so that the desired final order will be achieved; this is easy enough if all the \seealso entries are located together in the input file.

\documentclass{article}
\usepackage{makeidx}
\makeindex
\def\igobble#1 {}

\begin{document}

some text\index{a} with some index entries\index{b}
and some\index{c} \emph{see also} entries as well.
\index{a!zzzza@\igobble |seealso {b}}
\index{a!zzzzb@\igobble |seealso {c}}
\index{a!bcd}
\index{c!zzzza@\igobble |seealso {a}}
\index{c!zzzzb@\igobble |seealso {b}}

\printindex
\end{document}

output of example code

the choice of the dummy sort field will govern where in the index the entry will be placed. in this example, zzzzx (with x variable) was used to force them to the end. if, instead, they are preferred at the beginning, something like 0 00x can be used, since digits sort before letters, and the likelihood of actual second-level index entries beginning "zero space" is vanishingly small.

  • The issue I have here I that sometimes the entry after \seealso has a comma. Ideally, I would like to have two separate lines, each one starting with \seealso. – Motion Mountain Mar 8 '15 at 8:19
  • You can remove the space too by using \igobble defined by \def\igobble#1 {} – Andrew Swann Mar 8 '15 at 9:49
  • @AndrewSwann -- brilliant! thanks! (this goes into my in-progress tome on indexing. as well as an update here.) – barbara beeton Mar 8 '15 at 12:24
  • Thank you for all the details. By the way, the trick works well without \igooble for me (with \igobble it takes out the whole entry). (I use texlive on OSX.) Maybe we should add and explanation, for future ereference, on what to do when we want the seealsos to appear at the beginning of the entry list, instead of at the end. – Motion Mountain Mar 9 '15 at 5:41
  • @MotionMountain -- good suggestion about the initial sort, thanks. added. i'm not sure why you don't need \igobble; with the default setup and no special instructions to makeindex, the comma is inserted by makeindex itself, not defined in a .cls or .sty file. so that's the reason for needing to get rid of it. but your comment should serve as fair warning to users of non-default setups. – barbara beeton Mar 9 '15 at 12:15

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.