1

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?

  • 1
    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? – user36296 Apr 3 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 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) – user36296 Apr 3 at 11:18
  • If there are further problems related to your custom theme, please make a minimal working example (MWE) that reproduces these problems. – user36296 Apr 3 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 at 12:47
0

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{%
\imki@wrindexentrysplit{#1}{#2}{\the\c@framenumber}%
\endgroup\imki@showidxentry{#1}{#2}%
  \@esphack%
}
\def\imki@wrindexunique#1#2{%
\imki@wrindexentryunique{#1}{#2}{\the\c@framenumber}%
\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}

enter image description here

  • 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 at 6:17
  • @Aron Mmmm, good question. I don't know why this is happening. – user36296 Apr 5 at 8:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.