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?
[Tex/LaTex] How to have two or more distinct indexes
indexingsubdividing
Related Solutions
You are mixing two different problems. An .ist
file doesn't influence the final appearance of the index, apart from enabling grouping, for instance. It doesn't have anything to do with the number of columns, which is LaTeX's duty to determine via the definition of theindex
(that imakeidx
modifies to have, for instance, a different number of columns than two).
Say you want a main index, typeset in two columns, using the main.ist
style, and a name index, typeset in three columns, using the names.ist
style. Then the following declarations will do:
\usepackage{imakeidx}
\makeindex[title=Main Index,columns=2,options=-s main]
\makeindex[name=names,title=Index of Names,colums=3,options=-s names]
An entry for the main index will be defined by \index{tetrapiloctomy}
, while an entry for the name index will be defined by \index[names]{Doe, John}
.
In general, the options
key tells makeindex
or xindy
what command line options to use (the input and output file names are determined by the package).
In case you have many indices, it's wise to use the splitindex
option to imakeidx
(\usepackage[splitindex]{imakeidx}
), but this requires running LaTeX with the -shell-escape
option or to run separately makeindex
.
The authorindex
and natbib
packages collide at first glance, but in section
7.2.3 of the manual (http://mirrors.ctan.org/indexing/authorindex/authorindex.pdf) a solution is provided by using a local natbib.cfg, which I just copy from the manual, I have not developed that material:
Content of natbib.cfg
:
\AtBeginDocument{%
\@ifpackageloaded{authorindex}{%
\ifNAT@numbers
\let\org@@citex\NAT@citexnum
\else
\let\org@@citex\NAT@citex
\fi
\def\@citex[#1][#2]#3{%
\typeout{indexing: [#1][#2]{#3}}%
\org@@citex[#1][#2]{#3}%
\@aicitey{#3}}%
\renewcommand\NAT@wrout[5]{%
\if@filesw{%
\let\protect\noexpand\let~\relax
\immediate\write\@auxout{\string\aibibcite{#5}{#1}}%
\immediate\write\@auxout{\string\bibcite{#5}{{#1}{#2}{{#3}}{{#4}}}}}%
\fi}}{}}
\endinput
Place this file (exactly with this name!) in the folder where your document source is stored.
The next step is to replace all \aicite
commands with 'traditional' \cite
(otherwise it does not work. Why???? I have no clue, but I did not look into the package files either)
I added the rather simple command \listofauthors
, which includes the authorindex, further formatting is not done, however.
\documentclass[12pt]{book}
\usepackage{natbib}
\usepackage{blindtext}
\usepackage{makeidx}
\usepackage[pdftex,plainpages=false]{hyperref}
\RequirePackage{authorindex}
% Use this, if you want hyperlinks back from list of author entry to page
% where the citation was placed
\def\theaipage{\string\hyperpage{\thepage}}
\newcommand{\listofauthorsname}{List of Authors}%
\newcommand{\listofauthors}{%
\chapter*{\listofauthorsname}%
\phantomsection%
\addcontentsline{toc}{chapter}{\listofauthorsname}%
\noindent%
\printauthorindex%
}%
\makeindex
\begin{document}
\tableofcontents
\chapter{Introduction}
Einstein showed that \[ E = m \cdot c^2,\]
i.e. the equivalence\index{Equivalence} of mass\index{Mass} and energy\index{Energy}.\par
In their books \cite{GSM97} or \cite{Lam94} show how to typeset those equation ;-)
\blindtext
\printindex
\bibliographystyle{alpha}
\bibliography{biblio}
\listofauthors
\end{document}
Workflow on
foo.tex
- pdflatex foo.tex
- makeindex foo
- bibtex foo
- authorindex foo
- pdflatex foo
Best Answer
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:To complete the job, run LaTeX on your file enough times that labels, etc., are stable, and then execute the commands
See also this FAQ: Multiple indexes
Update
multind
is a package for LaTeX 2.09Consider the following alternatives: