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}
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}
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.
Best Answer
Here's a mild hack that inserts a gobble macro in the index file to discard the
,
:The index file after running
makeindex
resembles:clearly showing that it gobbles the comma, but would also remove any following spaces (via
\ignorespaces
). The use ofsubentry3@\gobblecomma
is to accurately place the "comma gobbler" alphabetized tosubentry3
.