# Makeindex - Styling the \printindex?

I have two questions:

1. Is it possible to change the titel of the printindex command? It is "Index" by default.
2. How can I format the index as a multi column, alphabetic sorted list?

-

the answers depend on what document class you're using. however,

1. both the basic latex classes (book et al.) and and ams-latex classes (amsbook et al.) provide the command \indexname with a default value "Index". so

\renewcommand{\indexname}{New name}


will change the title. (the babel package does this already for a number of languages.)

2. both book.cls and amsbook.cls provide a two-column index style. if you're creating your own class, you might consider "borrowing" the code from one of those classes. documented code is given in the .dtx files classes for basic latex and amsclass for the ams-latex classes. "human readable" versions of the documented code are given in .pdf files of the same names as the .dtx files. all are on ctan, and they are probably also on your tex installation; try typing texdoc classes or texdoc amsclass at the command line.

to get the content sorted, you need to use makeindex; that is well documented in several places, including lamport's latex manual and the "companionn", as well as with texdoc makeindex. be sure to pay attention to the use of the "sort field" for math entries, entries with accented letters, and other special cases that may cause entries to diverge from the expected alphabetical order.

-
1. Redefine \indexname. For example:

\renewcommand\indexname{The Index}

2. There are imakeidx and idxlayout packages to change the style of the index. Columns and headings, and other settings.

3. You can specify a .ist file when using makeindex program to change the output of makeindex. See the document of makeindex.

A sample .ist file:

% sample.ist
% Usage
%     makeindex -s sample.ist foo.aux
preamble "
\\begin{theindex}
\\providecommand*\\indexgroup[1]{\\indexspace
\\item \\textbf{#1}\\nopagebreak}
"

postamble "\n\n\\end{theindex}\n"

group_skip "  %\n  \\indexspace\n  %\n"


-

I'm just expanding Leo Liu's item #2 a little. imakeidx can easily help you on setting a custom index title and column numbers through (from documentation):

• title: is the title that is typeset at the beginning of the specific index; if not specified, the \indexname value is used.

• columns: accepts an integer representing the number of columns in the index; this is silently ignored if the original or the twocolumn options are set; the number can even be 1.

\usepackage{imakeidx}
\makeindex[title=My custom index title,columns=2]


will do the job. If you have, say, a custom mystyle.ist style, you can also use the options option as well:

• options: is the list of options to be passed to the sorting and formatting program; this list is a balanced text of program options, separated with the syntax required by the sorting and formatting program. For example, in order to use a different makeindex sorting and formatting style mystyle.ist and avoiding any message in the screen output write options=-s mystyle.

Regarding a custom makeidx style, unfortunately I have no experience with it. I strongly recommend chapter 11 from "The LaTeX Companion" book, called Index Generation. :)

-
1. Redefine \indexname like this : \renewcommand{\indexname}{My index}.

2. You define a .ist file that stores your preferences for the style of the index. For the example you want (alphabetic list starting by the letters and dots before page numbers), you add the following lines to your .ist file :

>     heading_prefix "{\\bfseries\\hfil "


and also

delim_0 "\\dotfill"
delim_1 "\\dotfill"
delim_2 "\\dotfill"


If it based on a book derived class, the index will be on two columns anyway.

-

I am using amsmidx. I had to use

\backmatter

Don't add the index name to \printindex or you will get two indexes with each name, use \renewcommand{\indexname}{My Index Name} instead. Thanks to two commenters below, but adding a \clearpage just before the second \addcontentsline made my table of contents disappear.
The \clearpage after \backmatter is superfluous because \backmatter will issue \clearpage resp. \cleardoublepage (depending on the state of @openright). On the other hand, a \clearpage before the second \addcontentsline is missing, and this will cause a wrong page number entry in the ToC. –  lockstep Jan 1 '12 at 21:40
amsmidx is meant to be used with amsbook, and is presumed to be incompatible with any non-ams document class. when used with amsbook, the proper access is \Printindex{author}{Author Index} \Printindex{subject}{Subject Index} (note the uppercase \Printindex); the toc entries are added automatically. amsmidx was created long before imakeidx; now that imakeidx exists, it's a much better choice. –  barbara beeton Nov 8 '14 at 13:57