# Beamer: index frames (with notes), instead of pages

I am making a beamer presentation in overleaf. I want to flag/mark the frames with something, like a keyword, and generate some text that tells me on what frames (not pages) that this flag/mark/keyword/index appears. This text should be either in the same pdf or better in a separate file.

I have chapter tex-files

\documentclass{beamer}
\usepackage{pgfpages}

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

\setbeameroption{show notes on second screen}

\begin{document}
\title{ChapterName}
\begin{frame}
\huge{\inserttitle}
\end{frame}
\input{Subchapter1.tex}
\input{Subchapter2.tex}
\end{document}


and Subchapter-files

\section{Subchapter name}
\begin{frame}{\insertsection}
\end{frame}

\begin{frame}{Frame 3}
\begin{itemize}
\item
\end{itemize}
\note<1>{Notes on first page of frame 3.}\note<2>{Notes on second page of
frame 3.}
\index{index1}\index{index2}
\end{frame}

\begin{frame}{Frame 4}
\note<1>{Notes for frame 4.}
\index{index1}
\end{frame}

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


I have tried the makeidx and imakeidx packages (what is the difference btw), but without success in overleaf. Maybe it has to do with my custom beamer theme because the code above returns an index, with page numbers and not frame numbers as I want, but still something.

Is it possible to use index in overleaf with beamer class? Can \makeindex return frame number instead of page number? Maybe there is another solution than using index?

• Welcome to TeX.Stackexchange! Can you make a minimal working example (MWE) that is a) actually compilable for people who don't have your custom beamer theme and peramble b) also has index words? – samcarter_is_at_topanswers.xyz Apr 3 '19 at 9:33
• @samcarter Is this better? Suppose I have to find out why I'm not able to use makeidx/imakeidx in my overleaf project even if it works with this code. But hopefully someone can help me with getting frame number instead of page number. ...and maybe some tip about what could be wrong in my huge project, common errors etc. – Aron Apr 3 '19 at 10:03
• To make the code at least compilable, you can use the answer tex.stackexchange.com/a/6798/36296 (this will still give page numbers and not frame numbers) – samcarter_is_at_topanswers.xyz Apr 3 '19 at 11:18
• If there are further problems related to your custom theme, please make a minimal working example (MWE) that reproduces these problems. – samcarter_is_at_topanswers.xyz Apr 3 '19 at 11:23
• It seems you need to have the main file in the root folder of the overleaf project. So my custom theme is probably unrelated to this. Having my chapter files at root level I can bear with but the problem with index referencing to page numbers instead of the desired frame numbers remains. Anyone? – Aron Apr 3 '19 at 12:47

With the imakeidx package one could use the following hacks:

\documentclass{beamer}
\usepackage{pgfpages}

\newenvironment{theindex}{}{}
%\newcommand\indexspace{}
\usepackage{imakeidx}

\setbeameroption{show notes on second screen}

\makeatletter

\def\@idxitem{\par}

\def\imki@wrindexsplit#1#2{%
\endgroup\imki@showidxentry{#1}{#2}%
\@esphack%
}
\def\imki@wrindexunique#1#2{%
\endgroup\imki@showidxentry{#1}{#2}%
\@esphack%
}

\let\imki@startidx\imki@startidxsplit
\let\@wrindex\imki@wrindexsplit
\let\imki@putindex\imki@putindexsplit
\let\imki@wrindexentry\imki@wrindexentrysplit
\let\imki@startidxunique\@undefined
\let\imki@wrindexunique\@undefined
\let\imki@putindexunique\@undefined

\def\imki@firstpagestyle{empty}

\makeatother

\makeindex

\begin{document}
\title{ChapterName}
\begin{frame}
{\huge \inserttitle}
\end{frame}

\section{Subchapter name}
\begin{frame}{\insertsection}
\end{frame}

\begin{frame}{Frame 3}
\begin{itemize}
\item
\end{itemize}
\note<1>{Notes on first page of frame 3.}\note<2>{Notes on second page of
frame 3.}
index1\index{index1}
\end{frame}

\begin{frame}{Frame 4}
\begin{itemize}
\item
\end{itemize}
\note<1>{Notes on first page of frame 4.}\note<2>{Notes on second page of
frame 4.}
index1\index{index1}
index2\index{index2}
\end{frame}

\begin{frame}{Index}
\printindex
\end{frame}
\end{document}


• First of all big thanks! However I found a small bug. Not really a big deal but if the last frame only covers one page I don't get the index for that frame. I can solve this by adding a note page so that the frame covers two pages but do you know any other solution? – Aron Apr 5 '19 at 6:17
• @Aron Mmmm, good question. I don't know why this is happening. – samcarter_is_at_topanswers.xyz Apr 5 '19 at 8:58