[Tex/LaTex] Problem with \printindex. No index created

indexinglogging

I tried to create an index to a document I write, but when viewing the .pdf output there was no index. Also no error messages were displayed. I managed to find this in the LOG FILE:
No file "Actual Document".ind.
("Actual Document.aux") )

Indeed, when I check the folder supposed to have these files, I found only a file Actual Document.idx with all my indices, but no .ind file. Changing the extension .idx to .ind produced an error.
Here is what I have written:

\documentclass[12pt]{book}
\usepackage{makeidx}
\makeindex
\begin{document}
continuous \index{continuous}
\clearpage
\printindex
\end{document}

What have I done wrong and what is going on with these files?

Best Answer

The makeidx package doesn't produce the index on its own; it just writes the entries, unsorted, to a separate file. You need to use an external processor, such as makeindex or xindy, to sort the index and format it in a way appropriate for inclusion in your document.

So your compilation process might look like this:

pdflatex jobname.tex

This produces a jobname.pdf file and writes the index entries to jobname.idx.

makeindex jobname.idx

This sorts and formats the index entries and outputs jobname.ind.

pdflatex jobname.tex

This produces a pdf file and includes jobname.ind at whatever point in the document you issued \printindex.

Oftentimes, it's good to put these commands into a script so you don't forget to run them.

Remember that every time you compile your document, it is both including the contents of jobname.ind at whatever point you issued \printindex and writing all your index entires to jobname.idx. Once you have your ind file, you don't need to rerun makeindex unless your page numbers have changed or you've changed entries in the index.

Related Question