[Tex/LaTex] makeindex doesn’t work

amsmathamssymbindexing

I have a file statuts.tex, and I would like to add indexes. Somebody says indexes belong to ams packages, so I did the following:

\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsfonts}
\makeindex{terms}
\begin{document}
body
\index{terms}{abc}
% \printindex{terms}{Index of Terms}
\end{document}

a part of my makefile:

statuts.pdf: statuts.tex
    latex statuts.tex && \
    makeindex statuts.idx && \
    latex statuts.tex && \
    makeindex statuts.idx && \
    latex statuts.tex && \
    dvips statuts.dvi -o statuts.ps && \
    ps2pdf statuts.ps statuts.pdf

However, I have got an error in the very beginning:

Writing index file statuts.idx

! LaTeX Error: Missing \begin{document}.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.3 \makeindex{t
                erms}
?

I don't want to use the package makeidx, because I have already used ams packages in my document and there is a conflict. In addition, I don't think the package amsmidx is necessary…

Could anyone help?

Best Answer

I would use imakeidx for all my indexing needs. It is so easy.

Save the following as myfile.tex

\documentclass[12pt]{article}
\usepackage{imakeidx}
\makeindex[name=terms,title=Index of terms,columns=1]
\begin{document}
  body
  \index[terms]{abc}
  \printindex[terms]
\end{document}

Then compile it with pdflatex --shell-escape myfile. (or latexdvipsps2pdf) That is all. No need of compiling with makeindex by yourself.

enter image description here

There is a nice blog by the author himself here. Now guess the author yourself.

Related Question