Index & bib commands

Indexes and bibliographies are not finished in a single compile. First LaTeX writes out the raw material (\index entries go to .idx, \cite keys to .aux); then a separate program sorts and formats it; then LaTeX runs again to fold the result into the text. This page covers those behind-the-scenes helpers: the index processors makeindex / mendex / upmendex, and the bibliography processors bibtex / pbibtex / upbibtex / biber.

A separate program does the work

Writing \index{...} or \cite{...} in your text does not make LaTeX sort anything itself. The first compile emits raw data (.idx, .aux); you then run the index or bibliography program over it to produce a formatted file (.ind, .bbl); and you compile again to pull it in. Managing that order and number of passes by hand is tedious, so in practice you hand it to a build tool like latexmk.

makeindex / mendex / upmendex — building the index

makeindex is the baseline. It reads the .idx written by \index, sorts it, and produces .ind. You control the output format with -s style.ist. Its internals are single-byte, though, so it does not sort Japanese in proper reading order.

mendex is the Japanese-aware version: it orders kanji by their reading (yomi). Give a reading with the reading@term syntax and it sorts by that kana in Japanese order. upmendex is the Unicode/multilingual successor — its internals are Unicode, and it sorts Japanese, Latin, Greek, Cyrillic, and more using ICU (the Unicode Collation Algorithm). It is upward-compatible with makeindex/mendex styles and is the standard choice for indexes under modern upLaTeX or LuaLaTeX-ja.

terminal
makeindex document.idx              # → document.ind
upmendex -s mystyle.ist document.idx # 多言語・スタイル指定 / multilingual, with a style

A minimal index loads makeidx, declares \makeindex in the preamble, places \index{...} in the body, and calls \printindex where the index should appear. The key point is that \index does not print visible text on the page; it writes material for the index processor. When sorting and display should differ, use sort-key@printed-term, for example latex@LaTeX.

latex
\documentclass{jsarticle}
\usepackage{makeidx}
\makeindex
\begin{document}
LaTeX\index{らてふ@LaTeX} で索引を作ります。
\printindex
\end{document}

bibtex / pbibtex / upbibtex / biber — building the bibliography

bibtex (Oren Patashnik, 1985) is the classic tool. It matches the \cite keys in .aux against your .bib database and produces .bbl according to a .bst style. For Japanese fields and sorting, use pbibtex (pTeX family) or the Unicode-aware upbibtex (upTeX family).

biber is the backend for the modern biblatex. Written in Perl, it provides full Unicode support, sorting based on the Unicode Collation Algorithm, powerful cross-referencing, data-model validation, and other features beyond traditional BibTeX. If your document uses biblatex, assume biber first. The shared -min-crossrefs=N (default 2) sets the threshold for crossref: an entry referenced by at least N others becomes its own bibliography entry; otherwise its fields are folded into the citing entries.

terminal
bibtex document     # 拡張子なし。document.aux を読む / no extension; reads document.aux
biber  document     # biblatex を使う場合 / when the document uses biblatex

Rule of thumb: for the traditional \bibliography + .bst, use bibtex (or up/pbibtex for Japanese). If you want the multilingual, full-featured route via biblatex, use biber. When a lab or journal template specifies a .bst, follow that template instead of forcing a migration. For a new project where you control the citation stack, biblatex + biber is stronger for Unicode and fine-grained control.

In the BibTeX family, the .bst file controls the output style, so use jplain, plainnat, or whatever the journal or lab specifies. With biblatex, the LaTeX options choose the style while biber handles the data processing underneath. In either route, citations will not resolve unless the citation keys in the body match the keys in .bib. Build a one-entry minimal example first, then move the full bibliography over; that keeps failures small.

When the workflow fails, first ask whether LaTeX wrote the raw material: .idx for an index, .aux and .bcf for biblatex bibliographies. Then read the log from makeindex, upmendex, bibtex, or biber. Finally, run LaTeX again and check that the generated .ind or .bbl was actually pulled into the body. Debugging in that order narrows the failure quickly.

Running them in order

The typical sequence is “compile → bibliography/index → compile → compile.” For upLaTeX, for example, it looks like this. Still, rather than typing it by hand, it is safest to let latexmk and friends work out the order and the number of passes.

terminal
uplatex  document      # .aux / .idx を生成
upbibtex document      # 文献を整形 (.bbl)
upmendex document      # 索引を整形 (.ind)
uplatex  document      # 取り込み(番号確定のためもう一度流すことも)
uplatex  document