# What is the correct way to generate an index?

For creating an index I am currently including

\usepackage{makeidx}
\usepackage{index}
\makeindex

[...] \index{...} [...]

\printindex


into the document (and run makeindex inbetween compilations). I was told some time ago that this is the way to create indexes.

So, I'm wondering whether there is some more modern and flexible way to do this (similar to have BibLaTeX is a modern replacement for BibTeX). In particular, are there ways to add some styling options to the \printindex call. Currently I'd have to create an index style file or patch theindex just to remove \MakeUppercase from \markboth for the index.

If it matters, I usually use the KOMA-Script classes.

-

The imakeidx package will call makeindex (or xindy, or other index compilers) in the LaTeX compilation, provided you call LaTeX with -shell-escape. It also allows you to pass options to \makeindex.

As for styling, you can use .ist files and pass them as argument (-s flag) to makeindex (or as an option to \makeindex if you use imakeidx).

The possible fields you can put in the .ist file are described in the manpage. It cannot do everything though. In my case, I had to play with sed between two LaTeX call (I know, shame on me) to get the results I wanted.

Here is a sample .ist file I'm using:

% Dotfill style
delim_0 "\\dotfill "
delim_1 "\\dotfill "
delim_2 "\\dotfill "
% M-dash style

% Force subitems to be raggedleft when they overflow the line
% and make sure to keep items raggedright
item_0 "\n  \\item\\raggedright"
item_1 "\n    \\subitem\\raggedleft"

% When using Old/New Testament parts in index
% Make them scshape
preamble "\\begin{multicols}{2}
\\makeatletter
\\let\\item\\@idxitem\\scshape
\\makeatother"
postamble "\\end{multicols}"


As you can see, you can already do a lot of things with that.

As mentioned by Thorsten, you can also use the idxlayout package, which controls some other parameters (such as paragraph lenghts, column lengths, etc.). Both imakeidx and idxlayout and compatible with Koma-Script classes (I'm using imakeidx with scrbook) and with each other.

-

I think you are looking for something like the idxlayout package. It does not work like biblatex, but it may be a good point to start.

-