8

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}
3
  • 3
    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. Commented Dec 9, 2010 at 10:00
  • 1
    @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. :-) Commented Dec 9, 2010 at 10:12
  • 3
    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. Commented Dec 9, 2010 at 12:50

2 Answers 2

13

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}
3
  • @Ulrike, thank you for the solution. It works. :-) Commented Dec 9, 2010 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
    Commented Jan 3, 2011 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. Commented Jan 3, 2011 at 17:43
0

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}

You must log in to answer this question.

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