[Tex/LaTex] Indexing, subentries, and see also

indexingpunctuation

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:

entry1
~~~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:

\documentclass[12pt]{memoir}
\makeindex

\begin{document}

Lorem ipsum
\index{entry1!subentry1}
\index{entry1!subentry2}
\index{entry1!z@{}|seealso{entry2}}

\printindex
\end{document}  

Best Answer

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
\makeindex
\makeatletter
\newcommand{\gobblecomma}[1]{\@gobble{#1}\ignorespaces}
\makeatother
\begin{document}

Lorem ipsum
\index{entry1!subentry1}
\index{entry1!subentry2}
\index{entry1!subentry3@\gobblecomma|seealso{entry2}}

\printindex
\end{document}

The index file after running makeindex resembles:

\begin{theindex}

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

\end{theindex}

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.