Processing the index entries
17.3 Processing the index entries
Once you are satisfied with the \index commands, the index is ready to be created. Step 1 Typeset intrarti.tex (see Figure 17.3).
Step 2 Run the MakeIndex application on intrarti.idx (see Figure 17.4). Step 3 Typeset intrarti.tex again.
You find the index on page 3 of the typeset document. Let us look at this process in detail. In step 1 (see Figure 17.3), L A TEX creates the intrarti.idx file:
\indexentry{Main Theorem}{1} \indexentry{pistar@$\Pi^{*}$ construction}{1} \indexentry{Main Theorem!exposition|(}{1} \indexentry{Moynahan, Ernest~T.}{1} \indexentry{lattice|textbf}{1} \indexentry{lattice!distributive}{1} \indexentry{lattice!distributive!complete}{1} \indexentry{Main Theorem!exposition|)}{2} \indexentry{Foo, Soo-Key}{2} \indexentry{Menuhin, George~A.}{2} \indexentry{Moynahan, Ernest~T.}{2} \indexentry{Moynahan, Ernest~T.}{2}
In step 2 (see Figure 17.4), MakeIndex processes intrarti.idx and creates the index file intrarti.ind, which contains a theindex environment with all the index entries:
\begin{theindex} \item Foo, Soo-Key, 2 \indexspace
460 Chapter 17 MakeIndex
L TEX intrarti.idx
intrarti.tex
the source file index entry listing
typeset file
Figure 17.3: Using MakeIndex, step 1.
intrarti.idx MakeIndex intrarti.ind
index entry listing index file
file
intrarti.ilg
the log file
Figure 17.4: Using MakeIndex, step 2.
\item lattice, \textbf{1} \subitem distributive, 1 \subsubitem complete, 1
\indexspace \item Main Theorem, 1
\subitem exposition, 1--2 \item Menuhin, George~A., 2
17.3 Processing the index entries 461
\item Moynahan, Ernest~T., 1, 2 \indexspace \item $\Pi^{*}$ construction, 1
\end{theindex} The \printindex command reads intrarti.ind during the next typesetting cycle.
MakeIndex also produces the index log file intrarti.ilg: This is makeindex, version 2.14 [02-Oct-2002]
(kpathsea + Thai support). Scanning input file intrarti.idx....done (12 entries accepted, 0 rejected). Sorting entries....done (43 comparisons). Generating output file intrarti.ind....done (22 lines written, 0 warnings). Output written in intrarti.ind. Transcript written in intrarti.ilg.
It is important to understand that in step 1, L A TEX does not process the index en- tries, it simply writes the arguments of the \index commands in the source file to the idx file as arguments of \indexentry commands verbatim (that is, with no change). MakeIndex then processes the idx file by removing the double quote marks for the special characters, sorting the entries, and collating the page numbers. The resulting
ind file is a normal L A TEX source file (you can edit it, if necessary) that is included in the original document by the \printindex command the next time you run L A TEX. In Step 2, we run the MakeIndex application on intrarti.idx. How we do this depends on the L A TEX installation you have. In UNIX installations, you type
MakeIndex intrarti at the command line. In newer user interfaces, MakeIndex is represented by an icon,
and you drop intrarti.idx into it. In modern installations, your editor also runs MakeIndex . In WinEdt (see Section A.1.2), run MakeIndex by clicking on the MakeIn- dex button. In TeXShop (see Section A.2.1), change the LaTeX button to MakeIndex with Typeset>MakeIndex and click on the Typeset button. Now change the MakeIn- dex button back to LaTeX with Typeset>LaTeX. Click on the Typeset button, and you have the typeset article with the index.
462 Chapter 17 MakeIndex