25.2.3 makeindex

Synopsis, one of:

makeindex filename
makeindex -s style-file filename
makeindex options filename0 ...

Sort, and otherwise process, the index information in the auxiliary file filename. This is a command line program. It takes one or more raw index files, filename.idx files, and produces the actual index file, the filename.ind file that is input by \printindex (see \printindex).

The first form of the command suffices for many uses. The second allows you to format the index by using an index style file, a .isty file. The third form is the most general; see the full documentation on CTAN.

This is a simple .isty file.

% book.isty 
%   $ makeindex -s book.isty -p odd book.idx
% creates the index as book.ind, starting on an odd page. 
preamble
"\\pagestyle{empty}
\\small
\\begin{theindex}
\\thispagestyle{empty}"

postamble
"\n
\\end{theindex}"

The description here covers only some of the index formatting possibilities in style-file. For a full list see the documentation on CTAN.

A style file consists of a list of pairs: specifier and attribute. These can appear in the file in any order. All of the attributes are strings, except where noted. Strings are surrounded with double quotes, ", and the maximum length of a string is 144 characters. The \n is for a newline and \t is for a tab. Backslashes are escaped with another backslash, \\. If a line begins with a percent sign, %, then it is a comment.

preamble

Preamble of the output index file. Defines the context in which the index is formatted. Default: "\\begin{theindex}\n".

postamble

Postamble of the output index file. Default: "\n\n\\end{theindex}\n".

group_skip

Traditionally index items are broken into groups, typically a group for entries starting with letter ‘a’, etc. This specifier gives what is inserted when a new group begins. Default: "\n\n \\indexspace\n" (\indexspace is a command inserting a rubber length, by default 10pt plus5pt minus3pt).

lethead_flag

An integer. It governs what is inserted for a new group or letter. If it is 0 (which is the default) then other than group_skip nothing will be inserted before the group. If it is positive then at a new letter the lethead_prefix and lethead_suffix will be inserted, with that letter in uppercase between them. If it is negative then what will be inserted is the letter in lowercase. The default is 0.

lethead_prefix

If a new group begins with a different letter then this is the prefix inserted before the new letter header. Default: ""

lethead_suffix

If a group begins with a different letter then this is the suffix inserted after the new letter header. Default: "".

item_0

What is put between two level 0 items. Default: "\n \\item ".

item_1

Put between two level 1 items. Default: "\n \\subitem ".

item_2

put between two level 2 items. Default: "\n \\subsubitem ".

item_01

What is put between a level 0 item and a level 1 item. Default: "\n \\subitem ".

item_x1

What is put between a level 0 item and a level 1 item in the case that the level 0 item doesn’t have any page numbers (as in \index{aaa|see{bbb}}). Default: "\n \\subitem ".

item_12

What is put between a level 1 item and a level 2 item. Default: "\n \\subsubitem ".

item_x2

What is put between a level 1 item and a level 2 item, if the level 1 item doesn’t have page numbers. Default: "\n \\subsubitem ".

delim_0

Delimiter put between a level 0 key and its first page number. Default: a comma followed by a blank, ", ".

delim_1

Delimiter put between a level 1 key and its first page number. Default: a comma followed by a blank, ", ".

delim_2

Delimiter between a level 2 key and its first page number. Default: a comma followed by a blank, ", ".

delim_n

Delimiter between two page numbers for the same key (at any level). Default: a comma followed by a blank, ", ".

delim_r

What is put between the starting and ending page numbers of a range. Default: "--".

line_max

An integer. Maximum length of an index entry’s line in the output, beyond which the line wraps. Default: 72.

indent_space

What is inserted at the start of a wrapped line. Default: "\t\t".

indent_length

A number. The length of the wrapped line indentation. The default indent_space is two tabs and each tab is eight spaces so the default here is 16.

page_precedence

A document may have pages numbered in different ways. For example, a book may have front matter pages numbered in lowercase roman while main matter pages are in arabic. This string specifies the order in which they will appear in the index. The makeindex command supports five different types of numerals: lowercase roman r, and numeric or arabic n, and lowercase alphabetic a, and uppercase roman R, and uppercase alphabetic A. Default: "rnaRA".

There are a number of other programs that do the job makeindex does. One is xindy (https://ctan.org/pkg/xindy), which does internationalization and can process indexes for documents marked up using LaTeX and a number of other languages. It is written in Lisp, highly configurable, both in markup terms and in terms of the collating order of the text, as described in its documentation.

A more recent indexing program supporting Unicode is xindex, written in Lua (https://ctan.org/pkg/xindex).


Unofficial LaTeX2e reference manual