# How to use the amsmidx package to include multiple indices

I am using the gsm-l class file to write a small text. I want to have two indices at the end, one for names, and one for subjects. So, as instructed in the AMS instructions, I include then line

\usepackage{amsmidx}


and then I have the following two lines in the preamble:

\makeindex{name}

\makeindex{subj}


At the end, I put the two commands

\Printindex{name}{Name Index}

\Printindex{subj}{Subject Index}


But things are not going as expected. First, if I include the hyperref package, I get about two errors for every \index command. But even if I don't include the hyperref package, my document doesn't contain an index. According to the log, the processor can't find name.idx or subj.idx, even though I can see both files in the directory, and they contain all the entries just fine. I will include a small sample to show what is going wrong:

\documentclass[makeidx]{gsm-l}

\usepackage[latin1]{inputenc}

\usepackage{amsmidx}

%\usepackage{hyperref}

\makeindex{name}

\makeindex{subj}

\def\thechapter{\Roman{chapter}}

\begin{document}

\frontmatter

\title{TeX}

\maketitle

\tableofcontents

\mainmatter

\chapter{Test}

Here are some things\index{subj}{things} I\index{name}{This Guy} have been working on.

\appendix

\include{}

\backmatter

\Printindex{name}{Name Index}

\Printindex{subj}{Subject Index}

\end{document}


I would appreciate any help on this.

-

I don't use the gsm-l class or the amsmidx package, but I suspect that the following quote from amsmidx.txt is relevant:

When the file is processed, files of index terms, (filename).idx, will be generated. To sort the index terms, process the .idx files separately with Makeindex; this will create (filename).ind files, which will in turn be input by \Printindex the next time the .tex file is processed.

Check if your working directory contains the files name.ind and subj.ind. If not, after your first LaTeX run you have to run makeindex two times (presumably from the command line):

makeindex name

makeindex subj


As for hyperref: It patches a lot of LaTeX kernel and class commands and so may well be incompatible with your custom class.

-
Yes, this pretty much is what I ended up doing. It's mentioned somewhere in the hyperrer documentation (I think) that it doesn't play well with amsmidx, and so I have to load amsmidx after hyperref (which of course means my indices aren't linked). I'm thinking of just using the book class and multind at this point (I really like linked PDFs!) – Steve D Sep 12 '10 at 20:04
Consider also using splitidx instead of multind. – lockstep Sep 12 '10 at 20:12