makeindex
Generate document indexes
SYNOPSIS
makeindex [options] [input_file_name...]
PARAMETERS
-c
Compress multiple blanks in an index entry to a single blank character.
-g
Use German-style ordering for sorting index entries. This affects how certain characters and ligatures are sorted.
-i input_file
Explicitly specify an input file. If this option is used, makeindex will process the given file as an index input, even if its extension is not .idx.
-o output_file
Specify the name of the output index file. By default, it uses the input base name with an .ind extension.
-s style_file
Specify the name of the index style file (.ist) to use. This file dictates the formatting and structure of the generated index. If not specified, makeindex looks for input_base_name.ist.
-t log_file
Specify the name of the transcript (log) file. This file records messages, errors, and warnings generated during processing. Defaults to input_base_name.ilg.
-L
Use a long language definition file for sorting, which provides more comprehensive rules for specific languages (e.g., complex rules for German or French characters). This is often used in conjunction with -g for German.
-q
Enable quiet mode. Suppresses all progress and informational messages, printing only error messages.
-r
Discard page number ranges. Instead of showing "1-3", it will list "1, 2, 3" for the index entry.
-p num
Set the starting page number for page number ranges. For example, if num is '1', '1-3' becomes '1-3'. If '0', '1-3' might be '1, 2, 3'.
-P string
Print the specified string instead of the page number for entries whose page number has been discarded (e.g., due to -p 0 or -r). This is typically used for entries that should not have a page number.
-v
Enable verbose mode. Prints detailed progress and diagnostic messages during processing.
-h
Display a help message with usage information and exit.
DESCRIPTION
makeindex is a utility program designed to process raw index information generated by LaTeX into a formatted, human-readable index. When a LaTeX document contains \index{} commands, LaTeX writes the index entries to a file with the .idx extension. makeindex then takes this .idx file as input, sorts the entries, resolves page ranges, and applies formatting rules defined in an index style (.ist) file. The result is an output file with the .ind extension, which can then be included back into the LaTeX document using the \printindex command. This process typically requires an additional LaTeX compilation pass to incorporate the newly generated index.
It is an essential tool for creating professional indexes, lists of figures, lists of tables, and glossaries in complex documents, allowing authors to automatically manage and format cross-references and page numbers for numerous terms.
CAVEATS
makeindex is highly dependent on the correct generation of .idx files by LaTeX and the proper configuration of .ist style files. Issues often arise from incorrect indexing commands in LaTeX, malformed .ist files, or character encoding mismatches. While powerful, for highly complex indexing needs, especially with multi-language support or advanced sorting, alternatives like xindy may offer more flexibility.
INDEX COMPILATION WORKFLOW
Creating an index with makeindex typically involves a multi-pass compilation:
1. Run latex or pdflatex on your .tex document. This generates the raw index file (.idx) based on \index{} commands.
2. Run makeindex on the generated .idx file (e.g., makeindex mydocument). This processes the .idx file and creates the formatted index file (.ind).
3. Run latex or pdflatex again on your .tex document. This time, LaTeX includes the newly generated .ind file into your document, rendering the index.
INDEX STYLE (.IST) FILES
The appearance and structure of the generated index are controlled by an Index Style file, typically with a .ist extension. These plain text files contain directives that define things like:
* How page numbers are formatted (e.g., bold for main entries).
* The separators used between page numbers or sub-entries.
* Headings for index sections (e.g., 'A', 'B', 'C').
* The layout of group headers and main index entries.
Customizing these files allows for highly flexible and professional index designs.
HISTORY
makeindex was developed by Jonathan Fine as an integral part of the LaTeX typesetting system. It addresses the need for automated index generation, a labor-intensive task in manual document production. Since its inception, it has been a stable and widely used component within the TeX Live and MiKTeX distributions, though more modern alternatives like xindy have emerged to handle challenges posed by Unicode and complex linguistic sorting rules.