3

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?

2
  • makeidx is necessary, and \makeindedx does not take an argument. makeidx provides the missing \printindex that article does not.
    – daleif
    Jan 16, 2015 at 8:42
  • indexes are supported only in ams document classes, not in ams packages. Jan 16, 2015 at 13:44

2 Answers 2

3

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.

2

There is indeed a package by Barbara Beeton, released as part of the AMS facilities for LaTeX, that introduces a syntax like the one you want and is called amsmidx, but it works only with the AMS classes which support \chapter.

\documentclass[12pt]{amsbook}
\usepackage{amsmidx}
\makeindex{terms}
\begin{document}
body
\index{terms}{abc}
\Printindex{terms}{Index of Terms}
\end{document}

Note \Printindex and not \printindex.

Patching it for making it work with article would be possible. But the best, in my opinion, is to use imakeidx.

1
  • imakeidx can replace amsmidx even with most instances using ams document classes, but if the class redefines the running footer to use anything but "plain" style, the [original]{imakeidx} option must be used, and the indexes processed separately before rerunning latex. when [original] is used, the last page of a multi-column index isn't balanced. (if the problem with how imakeidx fails to honor a document-specific running foot design could be solved, amsmidx could be retired. imakeidx is better; it just didn't exist when amsmidx was needed and created.) Jan 16, 2015 at 13:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .