# Problem with \printindex. No index created

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?

• you need to run makeindex to generate the index – David Carlisle Oct 30 '15 at 18:18
• Hello! :) You need to run makeindex "Actual Document.idx", which will give you a "Actual Document.ilg" file, containing your index. Then rerun pdflatex "Actual Document.tex". – Paulo Cereda Oct 30 '15 at 18:18

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.

• The problem is that \makeindex doesn't produce the jobname.idn file. I do have the .idx file, though. – Jim Oct 31 '15 at 1:21
• Right; makeindex does that. – dgoodmaniii Oct 31 '15 at 2:00
• This is exactly my problem. I do have \makeindex. I don't have the .idn file. @dgoodmaniii – Jim Oct 31 '15 at 9:51
• Not \makeindex; makeindex. It's not a command you issue in your document; it's a command you run outside your document, on the idx file that LaTeX created. As the answer explains, compiling your document produces the idx file. You need to process the idx file now with makeindex. So don't run LaTeX again; run makeindex jobname.idx, from the command line or your IDE. That will produce the ind file. Run LaTeX on your document again now, and you'll get your index wherever you have \printindex. – dgoodmaniii Oct 31 '15 at 11:39
• OK, I think I got now how it is working, but I'm not sure how to run an external program. I tried through run of Windows where I typed makeindex Actual Document.idx and some other variations. No .idn prodused. What am I missing again? – Jim Oct 31 '15 at 21:50

Although the question has been answered, there still some clarifications that need to be made regarding Windows users.

To run makeindex in Windows you have to go to the terminal which is what Windows call Command Prompt or cmd. You can search for these manually or type them into the run program that appears in Start. Once you have opened the terminal, you can use Unix commands to do whatever. makeindex is a Unix command, too, and only works into this terminal.

• I think every decent LaTeX editor has a button to run makeindex. No need to get into a terminal. – Johannes_B Dec 13 '15 at 10:28
• @Johannes_B: That's true but it does not prevent to use a terminal. I prefer terminal commands even on Windows (although I use that 'system' very rarely) – user31729 Dec 13 '15 at 10:44
• @Johannes_B I'm using TexMaker version 4.5. I cannot find a built-in button anywhere. – Jim Dec 13 '15 at 10:49
• In my version of texmaker, it is called by pressing F12. Or clicking on makeindex in the tools menu. – Johannes_B Dec 13 '15 at 11:05
• F12 works perfectly. Thank's a lot! – Jim Dec 13 '15 at 11:11

I had the problem of running

makeindex "filename with spaces.idx"


I wrote a batch file index.bat in order to avoid these white spaces either in the file name or in the path name:

e:
cd "my path to my document"
makeindex main.idx
set /p DUMMY=Hit ENTER to continue...


The batch file waits for a keyboard hit after having run. Do not call the batch file makeindex.bat because then it can occur that it calls itself in an infinite loop!