Makeindex - Styling the \printindex?
the answers depend on what document class you're using. however,
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.)both
book.cls
andamsbook.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
filesclasses
for basic latex andamsclass
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 typingtexdoc classes
ortexdoc 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.
addendum: the imakeidx
package is a good choice if more than one index
is being produced. it isn't necessary to identify an entry for the main index by anything other than the basic \index
command; for an odditional index, the
designation of that index is entered as an option: \index[<name>]{<entry>}
. a
further advantage of imakeidx
is that in most cases, a second compilation pass
isn't needed. there are some caveats; for details, see the package documentation.
Redefine
\indexname
. For example:\renewcommand\indexname{The Index}
There are
imakeidx
andidxlayout
packages to change the style of the index. Columns and headings, and other settings.You can specify a
.ist
file when usingmakeindex
program to change the output ofmakeindex
. See the document ofmakeindex
.
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"
headings_flag 1
heading_prefix " %\n \\indexgroup{"
heading_suffix "}\n %\n"
numhead_positive "Numbers";
numhead_negative "Numbers";
symhead_positive "Symbols";
symhead_negative "Symbols";
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 theoriginal
or thetwocolumn
options are set; the number can even be 1.
A quick addition to your document preamble:
\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 differentmakeindex
sorting and formatting stylemystyle.ist
and avoiding any message in the screen output writeoptions=-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. :)