# How can I have two or more distinct indexes?

I often want to have more than one index in a longer LaTeX document. For instance, I might want a general concept index, an index of named persons, and an index of symbolism. How can I have two or more distinct indexes in LaTeX?

The multind package provides simple and straightforward multiple indexing.

You tag each \makeindex, \index and \printindex command with a file name, and indexing commands are written to (or read from) the name with the appropriate (.idx or .ind) extension appended. To create a “general” and an “authors” index, one might write:

\usepackage{multind}
\makeindex{general}
\makeindex{authors}
...
\index{authors}{Another Idiot}
...
\index{general}{FAQs}
...
\printindex{general}{General index}
\printindex{authors}{Author index}


To complete the job, run LaTeX on your file enough times that labels, etc., are stable, and then execute the commands

makeindex general
makeindex authors


Update

multind is a package for LaTeX 2.09

Consider the following alternatives:

• multind is not in TeXLive, it seems. Is it obsolete? – Joachim Breitner Aug 11 '16 at 13:38
• yes, multind is a package for LaTeX 2.09 – rcs Aug 11 '16 at 13:59
• I tried index following one of the answers below and it works perfectly – Nisba Dec 6 '18 at 14:43

There is also imakeidx designed to provide multiple indexes (has been mentioned in a comment already, but the usage isn't shown)

Just say \makeindex[name=symbolicname,title={Foo}] to provide a special index (choose symbolicname appropiately) and \index[symbolicname]{foo} to make an index entry to this special index.

The special index is printed with \printindex[symbolicname].

Using \makeindex, \index and \printindex without optional argument will give the usual index as with makeidx.

The advantage of imakeidx is the automatic call of makeindex or texindy (if \write18 is enabled).

\documentclass{article}

\usepackage{imakeidx}

\usepackage{blindtext}

\makeindex[name=person,title={Index of persons}]

\makeindex

\begin{document}

Einstein\index[person]{Einstein}
\blindtext

Heisenberg\index[person]{Heisenberg} % Person index

\blindtext[4]

\index{foo}
\index{bar}
\blindtext

\printindex[person] % Person index
\printindex % usual index

\end{document}


• i'd like to put in a plug for imakeidx because it's compatible with the ams document classes, whereas the other packages that support multiple indexes aren't. it also makes excellent use of the "latex way" of using optional arguments to specify the particular index -- if it's the main index, no option needed, and it names the one index file in the same way as makeidx, so completely substitutable there. this should be the first choice when starting a new project. – barbara beeton Feb 11 '16 at 20:29
• @barbarabeeton: Do you refer to a new amsmath release (there are plans to do so, I think?) – user31729 Feb 11 '16 at 20:55
• there are ongoing discussions about amsmath, but nothing that i can quote. sorry. (as soon as something is definitive, it will be announced.) – barbara beeton Feb 11 '16 at 21:03
• @barbarabeeton: You't can't quote because it is top-secret or just because the direction is not clear? ;-) – user31729 Feb 11 '16 at 21:05
• the direction depends on decisions that haven't been made yet. – barbara beeton Feb 11 '16 at 21:09

One problem with multind is that the index heading(s) will not be formatted corresponding to your other chapter (or section) headings but simply with \Large\bf.

If you want multiple indexes that respect the general formatting of your document class (and also work with other than the standard classes), use the splitidx package.

• I wouldn't forget imakeidx; perhaps because I'm one of the authors. :) – egreg Sep 16 '11 at 19:11
• I have a book with 23 indexes (say again?!) and splitidx handles them perfectly. I also recommend the use of idxlayout, in case you stumble upon LaTeX bug 3126 (it happened to me when using splitidx in a book layout, because \twocolumn was interfering with \topskip). :-) – Paulo Cereda Sep 16 '11 at 19:18

The index package lets you define additional indexes in addition to the “default” one. (You don't have to use the default one if you don't want to.) This package makes a few other improvements, including making the \index command more robust and providing the \index* variant to both typeset its argument and add it to the index.

When you use this package, the \index and \printindex commands take an optional argument which is an internal name for the index. To define a new index, use the \newindex command in the preamble:

\usepackage{index}
\newindex{person}{pdx}{pnd}{Index of named persons}
\newindex{symbol}{sdx}{snd}{Index of symbolism}

\begin{document}
Hello, \index*[person]{vanden}.

\printindex[person]
\printindex[symbol]
\end{document}


The first argument to \newindex is the index's internal name which you then pass to \index and \printindex. The last argument is the title that appears before the index. The second and third argument are the extensions used for the temporary files for the index. For the example above, you'd run makeindex as

makeindex -t mydoc.plg -o mydoc.pnd mydoc.pdx
makeindex -t mydoc.slg -o mydoc.snd mydoc.sdx


Here's a completely different approach that doesn't use \index but instead uses glossaries-extra and bib2gls. First the terms used in the document are defined in one or more .bib files. For example, vegetables.bib starts with:

% Encoding: UTF-8

@entry{cabbage,
name={cabbage},
description={vegetable with thick green or purple leaves},
identifier={vegetable}
}

@entry{brussels-sprout,
name={Brussels sprout},
description={small leafy green vegetable buds},
identifier={vegetable}
}

@entry{artichoke,
name={artichoke},
description={a variety of thistle cultivated as food},
identifier={vegetable}
}


The sample-multi2.tex example file defines a list for each type:

\newglossary*{bacteria}{Bacteria}
\newglossary*{markuplanguage}{Markup Languages}
\newglossary*{vegetable}{Vegetables}
\newglossary*{mineral}{Minerals}
\newglossary*{animal}{Animals}
\newglossary*{chemical}{Chemical Formula}
\newglossary*{baseunit}{SI Units}
\newglossary*{measurement}{Measurements}
\newglossary*{film}{Films}
\newglossary*{book}{Books}
\newglossary*{person}{People}
\newglossary*{mediacontrol}{Media Control Symbols}
\newglossary*{information}{Information Symbols}
\newglossary*{weather}{Weather Symbols}


The required .bib files are identified in the document with \GlsXtrLoadResources. The above example file is quite complicated (the result is sample-multi2.pdf), so here's a simplified version that just uses vegetables.bib:

\documentclass{book}

\usepackage[
record,% using bib2gls
nostyles,stylemods={bookindex},
nomain,% don't create default 'main' glossary
index% create index list
]{glossaries-extra}

% define custom list:
\newglossary*{vegetable}{Vegetables}

src={vegetables},% data in vegetables.bib
sort={en-GB},% sort by language identified by this locale
entry-type-aliases={
entry=dualindexentry% make @entry behave like @dualindexentry
},
field-aliases={
identifier=category % convert identifier field to category field
},
type={index},
dual-type={same as category}
]

\begin{document}
\chapter{Sample}

\Glspl{cabbage} are bigger than \glspl{brussels-sprout}.
An \gls{artichoke} is another type of vegetable.

\printunsrtglossary[type=vegetable,style=tree]
\printunsrtglossary[type=index,style=bookindex]

\end{document}


If the document is called myDoc.tex then the build process is:

pdflatex myDoc
bib2gls -g myDoc
pdflatex myDoc


First page:

The list of vegetables doesn't show the locations (page numbers) where the term was used:

The index does show the locations:

There is a new package manyind. It supports multiple indexes. There is just one index file and LaTeX knows how to find the indexes in there. One runs latex and makeindex as if there is just one index. No further programs are required. The user indicates what goes where with commands like \setindex{main}. See the documentation for details of use. See also the robustindex package. But all this fails for other alphabets.

• Hi, since you are the maintainer of this package, could you please expand a bit your answer ? You can apply the hyperlink formatting by replacing {} by () – BambOo Apr 25 '18 at 14:42