# What are the latest/best practices for index generation?

I would like to know what the current best practices are for index generation. What are the best packages/programs to use and which ones to avoid. What are the best ones to use for generating multiple indices?

I know that this kind of a question can generate a variety of responses based upon one's personal opinion. Please share why you like your particular options.

-
The reason I ask: I inherited a LaTeX document that was very old (LaTeX 2.09) and was tasked with updating it. I have updated it to LaTeX 2e, but I'm having trouble creating the index. The old document used the makeidx option and \input{XXXX.ind} which, if I understand correctly is a bad/old way of doing things. The old document used commands like \index{xyz} and \index{abcd@{\ty abcd}}. When I include \usepackage{makeidx} then I get an error that the \index command doesn't exist. Are these still the correct way to add index entries? –  Jeremy Oct 27 '11 at 14:23
It's quite strange that \index is undefined, as it has a (dummy) definition in the kernel. It's probably some other command that doesn't exist, check the log file. The method is still \usepackage{makeidx}, then \index{...}; the index is printed with \printindex (as it was also in LaTeX209). –  egreg Oct 27 '11 at 17:19
Try adding \makeindex after \usepackage{makeidx} in the preamble. With documents somewhere in-between LaTeX 2.09 and 2e it might help. (And please give feedback whether this worked.) –  Stephen Oct 27 '11 at 17:51
Okay, so I'm kind of embarrassed. I found out that there was a makeidx.sty file in the directory of TeX files. That was messing things up. Once I removed that file, LaTeX compiles just fine until after makeindex is run. Then I get the error (not sure if you'll be able to see the formatting correctly, the line break comes after \ty): ! Undefined control sequence. l.23 \item {\ty a10}, \hyperpage{41} ?  –  Jeremy Oct 28 '11 at 19:56

\documentclass{book}
...
\usepackage{makeidx}
\makeindex
...

\begin{document}
...
text\index{abc@{\ty abc}} and other text...
...

\printindex

\end{document}


This should work and, apart from \usepackage instead of an option to \documentstyle has always been the method also in LaTeX209.

Check what the undefined command is, it would be very strange if it were \index.

For multiple indices there is a choice between a few packages:

• multind (actually a LaTeX209 package)
• index
• splitidx
• imakeidx

I wouldn't recommend index that's not as customizable as the last two ones. The advantages of imakeidx over splitidx are that it can compile automatically all indices during the LaTeX run and that it's compatible with idxlayout that extends its customization possibilities. It also supports xindy (as splitidx does). (Disclaimer: I'm one of the authors of imakeidx.)

-
Thanks for the simple example. I tried it with success (after removing the \ty command. See my comment above. –  Jeremy Oct 28 '11 at 20:05

for multiple indexes look at the packages splitidx or index from the camel bundle, which I prefer. If you have utf8 characters to sort then give xindy a try, it is more powerful than the old makeindex program

-
I have used splitidx, but it seemed a little cumbersome to me. I think I had seen index before but never tried it. What are some benefits of index over splitidx? –  Jeremy Oct 28 '11 at 20:00
it is easier to use, from my point of view ... –  Herbert Oct 28 '11 at 20:06
it looks like an equivalent of biblatex (a super package able to address all possibilities with the new engine biber) for indices would be welcome. –  pluton Oct 29 '11 at 0:09
A big problem with the index package is that it redefines a bunch of basic tex macros that primarily have nothing to do with index generation, like \markright/\markboth, \addtocontents, \@starttoc, and \raggedbottom/\flushbottom. So be carefull if you use other packages that also mess with these macros. –  Lupino May 27 '14 at 9:36
All of these commands are used when creating an index! –  Herbert May 27 '14 at 18:29