makeindex
Processes and generates hierarchical indexes from document markup, converting raw index entries into properly formatted, sortable output for typesetting.
Overview
Serves as a crucial tool for creating professional-quality indexes in academic books, technical documentation, and other long-form documents. The package handles the complex task of collecting, sorting, and formatting index entries with hierarchical relationships.
- Automatically processes raw index entries from LaTeX's \index commands
- Supports customizable sorting rules and formatting through style files
- Manages cross-references, sub-entries, and multiple levels of indexing
- Particularly valuable for textbooks, reference manuals, and scholarly publications requiring comprehensive navigation aids
- Works seamlessly with LaTeX's default index generation workflow while offering advanced customization options
Getting Started
makeindex
is a command-line tool for generating indexes, not a LaTeX package to be loaded with \usepackage.
Usage: makeindex [options] filename.idx
Example: makeindex document.idx
This will process the index entries in document.idx (generated during LaTeX compilation) and create document.ind, which can be included in your document with:
\documentclass{article}
\usepackage{makeidx}
\makeindex
\begin{document}
% Your document content with \index{} commands
\printindex
\end{document}
Examples
Creating a simple index in a LaTeX document.
\documentclass{article}
\usepackage{makeidx}
\makeindex
\begin{document}
\section{Introduction}
This is a document with an index. Let's index some terms.
\index{LaTeX}LaTeX\index{document preparation} is a document preparation system.
\index{indexing}Indexing\index{cross-references} helps readers find information quickly.
\index{makeindex package}The makeindex package\index{packages!makeindex} processes the index entries.
\section{More Content}
Here's another mention of \index{LaTeX!features}LaTeX features.
\index{cross-references|see{indexing}}Some terms can have cross-references.
\printindex
\end{document}
Creating an index with subentries and formatting.
\documentclass{article}
\usepackage{makeidx}
\makeindex
\begin{document}
\section{Advanced Indexing}
Let's create an index with subentries and special formatting.
\index{mathematics}Mathematics is important in science.
\index{mathematics!algebra}Algebra is a branch of mathematics.
\index{mathematics!calculus}Calculus is another branch.
\index{mathematics!geometry}Geometry studies shapes and spaces.
\index{formatting|textbf}Formatting can be applied to page numbers.
\index{formatting!bold|textbf}This will have bold page numbers.
\index{formatting!italic|textit}This will have italic page numbers.
\index{see also|see{cross-references}}Some entries can point to others.
\printindex
\end{document}