Here is a solution that patches an auxiliary macro in \frametitle
, adding code that adds a bookmark and table-of-contents line as if it were a subsection (you can just comment this out if not wanted):
\documentclass{beamer}
\AtBeginSection{\frame{\tableofcontents[currentsection]}}
\usepackage{bookmark}
\usepackage{etoolbox}
\makeatletter
% save the current definition of \beamer@@frametitle
\let\nobookmarkbeamer@@frametitle\beamer@@frametitle
% then patch it to do the bookmarks and/or TOC entries
\apptocmd{\beamer@@frametitle}{%
% keep this to add the frame title to the TOC at the "subsection level"
\addtocontents{toc}{\protect\beamer@subsectionintoc{\the\c@section}{0}{#1}{\the\c@page}{\the\c@part}%
{\the\beamer@tocsectionnumber}}%
% keep this line to add a bookmark that shows up in the PDF TOC at the subsection level
\bookmark[page=\the\c@page,level=3]{#1}%
}%
{\message{** patching of \string\beamer@@frametitle succeeded **}}%
{\errmessage{** patching of \string\beamer@@frametitle failed **}}%
\pretocmd{\beamer@checknoslide}{%
% ensure the bookmark is not created if the slide is filtered out
\let\beamer@@frametitle\nobookmarkbeamer@@frametitle
}%
{\message{** patching of \string\beamer@checknoslide succeeded **}}%
{\errmessage{** patching of \string\beamer@checknoslide failed **}}%
\makeatother
\begin{document}
\section{First Section}
\begin{frame}{First frame}Text\end{frame}
\begin{frame}{Second frame}Text\end{frame}
\section{Second Section}
\begin{frame}{Third frame}Text\end{frame}
\begin{frame}\frametitle{Fourth frame}Text\end{frame}
\begin{frame}<handout>\frametitle{Fifth frame}Text\end{frame}
\end{document}
I had to dig around in beamerbasesection.sty
to figure that out. But it seems to work.
EDIT. (by cyberSingularity): Now prevents unwanted bookmarks when the slide is not shown by also patching \beamer@checknoslide
, and provided an additional frame to test.
Note: if there are frames with multiple slides (e.g. due to \pause
s), you may also be interested in this follow up question.
\makeatletter
\apptocmd{\beamer@@frametitle}{\only<1>{\bookmark[page=\the\c@page,level=3]{#1}}}%
{\message{** patching of \string\beamer@@frametitle succeeded **}}%
{\message{** patching of \string\beamer@@frametitle failed **}}%
\makeatother
adds the bookmark just for the first slide in each frame (or at least it seems to work on your MWE)
Best Answer
You can first define a "6 on 1" pgf page layout, then activate it in, say, the
handout
mode. I use the code below -- I've probably modified it from somewhere but I can't remember. Perhaps you can fine tune it further for your own needs: