Beamer: Index of Listing

In beamer presentation I have a few headwords distributed on different slides. The appearance of these headwords I defined before and they don't be numbered.

Before these headwords started, I want to insert an overview/index of them on an extra slide and there should be the headwords numbered (but it's not so important, only listed without numbers would be also ok). I have no idea how to realize them -- I tried a bit with label but it don't works.

Currenty I realize this, while copy the headwords on the index-slide in an enumerate environment. This is not very elegant.

I hope I could make understandable the issue. And btw: How I declare a codeblock here? Four spaces at begin of every line -- it's a bit troublesome for longer codeblocks.

\documentclass[t]{beamer}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage{amsmath,amssymb}
\usepackage{xcolor}

\author{Max Mustermann}
\title{Title}

\newcommand{\hervor}[1]{\textbf{\textcolor{blue}{#1}}}
\newcommand{\lipsum}{Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus
elit, vestibulum ut, placerat ac, adipiscing vitae, felis.}

\begin{document}

%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}

\frametitle{This should be the index}
\begin{enumerate}
\item Blah blah
\item Foo bar
\end{enumerate}

\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}

\frametitle{Theorys}
\hervor{Blah blah}
\lipsum
\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}

\frametitle{Theorys}
\lipsum
\hervor{Foo bar}
\lipsum

\end{frame}

\end{document}

-
Should the headwords be separated by section or something? To mark code block you can use the button {}. – Marco Daniel May 19 '12 at 9:12
– Marco Daniel May 19 '12 at 15:00

1 Answer

Here's a possible basic solution; the idea is to use the kernel \@starttoc command to generate a new "List of" with .lof extension. The \hervor command now typesets its argument in the document and also adds the information for the new list to the .loh file. The list is generated by issuing \listofhervors:

\documentclass[t]{beamer}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage{amsmath,amssymb}
\usepackage{xcolor}

\newcounter{hervor}

% this commands typesets the text in the document with the given format
% and also adds it to the .loh file
\newcommand{\hervor}[1]{%
\textbf{\textcolor{blue}{#1}}%
\stepcounter{hervor}%
\addcontentsline{loh}{section}{%
\protect\makebox[1cm][l]{\protect\usebeamercolor[fg]{enumerate item}\thehervor.\hfill}#1\par}%
}

\newcommand{\lipsum}{Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus
elit, vestibulum ut, placerat ac, adipiscing vitae, felis.}

% the command that will generate the new list
\makeatletter
\newcommand\listofhervors{\@starttoc{loh}}
\makeatother

\author{Max Mustermann}
\title{Title}

\begin{document}

\begin{frame}
\frametitle{This is the index}
\listofhervors
\end{frame}

\begin{frame}
\frametitle{Theorys}
\hervor{First relevant text}
\lipsum
\end{frame}

\begin{frame}
\frametitle{Theorys}
\lipsum\ \hervor{Second relevant text}\lipsum
\end{frame}

\end{document}


-