Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm creating an index using makeindex and I can't get the output to look the way I want. Basically, I would like to create an entry formatted as follows:

~~~subentry1, 2
~~~subentry2, 3
~~~see also entry2

I can't figure out how to format the \index command so that the last line appears properly. The best I've come up with is \index{entry1!z@{}|seealso{entry2}}, but starts the entry off with a comma.

Anyone else encounter this incredibly specific and OCD problem?

EDIT: Ok, here's an example that demonstrates the issue:



Lorem ipsum

share|improve this question
Well, \renewcommand*\seealso[2]{\subitem \emph{\alsoname} #1} will force the 'seealso' macro to start a new 'subitem', but the that will sort under '\emph' and therefore ahead of virtually all sub-entries. –  jon Dec 12 '12 at 4:31

2 Answers 2

Here's a mild hack that inserts a gobble macro in the index file to discard the ,:

enter image description here

\documentclass[12pt]{memoir}% http://ctan.org/pkg/memoir

Lorem ipsum


The index file after running makeindex resembles:


  \item entry1
    \subitem subentry1, 1
    \subitem subentry2, 1
    \subitem \gobblecomma, \seealso{entry2}{1}


clearly showing that it gobbles the comma, but would also remove any following spaces (via \ignorespaces). The use of subentry3@\gobblecomma is to accurately place the "comma gobbler" alphabetized to subentry3.

share|improve this answer
Perhaps you should make it clearer that 'subentry3' is used in this case to make sure it follows 'subentry2' and 'subentry1' (whereas 'subentry' would put it first). For general purposes, it would probably be better to write \index{entry1!zzz@\gobblecomma|seealso{entry2}}. –  jon Dec 12 '12 at 6:00
Bingo. That solved my problem. Thanks everyone! –  Evan Dec 13 '12 at 1:03
@Evan: You could consider marking the answer as such. See How do you accept an answer? –  Werner Dec 13 '12 at 1:07

i think it's easiest to create an entirely new command:

  \index{#1!zzzzz@\emph{\alsoname} {#2}}}

i've used \providecommand rather than \newcommand as this is a candidate for inclusion in the ams document classes, and it's not polite to cause old files to suddenly generate errors when a class change like this is known ahead of time.

\indexalso would be used like this:

\indexalso{<main heading>}{<see-also heading>}

the zzzzz ensures that this will be listed last, unless an author has a really odd second-level entry. if multiple "see also"s are to be used, they should all be included in the single \indexalso entry:

\indexalso{<main heading>}{<see-also heading; another see-also>}

i've been writing up some tips on how to produce a "clean" index, including everything i've had to answer questions about for ams publications; your question came at just the right time, since this is problem was still on the "todo" list.

after consulting in-house editorial staff and the chicago manual, we've determined that, for ams books, the style you request is best -- and that's what will be recommended in our indexing document. i'll be posting the document on the ams web site when it's released, and will add the link here when that happens.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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