# Is it bug or feature? I cannot use makeidx in beamer.

I attempted to use makeidx.sty in my beamer project.

The first two compilation using latex, the input file can be processed successfully.

Then I execute makeindex, it also run without error.

But when I call latex.exe again, I got an error message saying

!LaTeX Error: Environment theindex undefined.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
1.1 \begin{\theindex}


\documentclass{beamer}
\usepackage{makeidx}
\makeindex

\begin{document}

\begin{frame}{test 1}
\index{Laplace}Laplace transform is...
\LaTeXe\ can make you happy!
\end{frame}

\begin{frame}{test 2}
\printindex
\end{frame}

\end{document}

• Where is the sense of an index in a presentation? Apart from this the error message clearly says there is no theindex environment defined. Thus I'd consider this as a feature. – Thorsten Donig Dec 9 '10 at 10:00
• @Thorsten, thank you for answering. I am writing a math book that will be shipped with a pdf presentation. Indexing is needed because the presentation may contain more than 500 frames. :-) – xport Dec 9 '10 at 10:12
• the context is useful in this sort of situation. Where you're trying to do something that might not normally be done, it's helpful to explain (briefly) why. – Loop Space Dec 9 '10 at 12:50

You will have to define theindex and the commands used in the theindex-environment. Look e.g. in article.cls for ideas (you shouldn't copy it verbatim, for presentations you need a different look).

\documentclass{beamer}
\usepackage{makeidx}
\makeindex
\newenvironment{theindex}
{\let\item\par
%definitions for subitem etc
}{}
\newcommand\indexspace{}
\begin{document}

\begin{frame}{test 1}
\index{Laplace}Laplace transform is... \LaTeXe\ can make you happy!
\index{Test}
\end{frame}

\begin{frame}{test 2}
\printindex
\end{frame}

\end{document}

• @Ulrike, thank you for the solution. It works. :-) – xport Dec 9 '10 at 11:07
• Dear Ulrike (or xport, or someone else), could you please write a slightly more detailed example of how to use printindex in a beamer presentation? I have the same problem as xport, but Ulrike's example did not work in my case. Thanks, Hendrik – Hendrik Jan 3 '11 at 17:04
• @Hendrik: Welcome :-) If you've got a question, then you should ask it in a new post. Please do this with the "Ask Question" link. You should link to the question here in your new question. – Hendrik Vogt Jan 3 '11 at 17:43

In case one would like to use imakeidx instead of makeidx:

\documentclass{beamer}

\newenvironment{theindex}{}{}
\usepackage{imakeidx}

\makeatletter
\def\@idxitem{\par}
\def\imki@firstpagestyle{empty}
\makeatother

\makeindex

\begin{document}

\begin{frame}
index1\index{index1}
\end{frame}

\begin{frame}
index1\index{index1}
index2\index{index2}
\end{frame}

\begin{frame}
\printindex
\end{frame}

\end{document}