I'm trying to make a sort of "trainer's guide" from a beamer presentation using pgfpage (cf. example below), but I have one problem: the handout does not work correctly for the last frame - and I don't know why.
As a workaround, I have to add an empty frame, but I find this not very clean.
Why does the code of \AtEveryBeginFrame seem to be not executed for the last frame?
\documentclass[a4paper,handout]{beamer}
\usepackage{pgfpages}
\usepackage[T1]{fontenc}
\usepackage{tikz}
\usepackage{lipsum}
\usepackage{xparse}
\makeatletter
\g@addto@macro\beamer@frameslide{\form@everybeginframe@hook \beamer@checkframetitle}
\def\form@everybeginframe@hook{}
\long\def\AtEveryBeginFrame#1{\g@addto@macro\form@everybeginframe@hook{#1}}
\makeatother
\pgfpagesdeclarelayout{myHandout}{% before action
}
{ % afteraction
\setkeys{pgfpagesuselayoutoption}{landscape}
\pgfpagesphysicalpageoptions{%
logical pages=2,%
physical height=29.7cm,%
physical width=21cm,%
first logical shipout=2,%
last logical shipout=2%
}
\pgfpageslogicalpageoptions{2}{%
resized width=.5\pgfphysicalwidth,
resized height=.28\pgfphysicalheight,
center=\pgfpoint{.37\pgfphysicalwidth}{.8\pgfphysicalheight},%
border code=\pgfstroke
}
\pgfpageslogicalpageoptions{1}{%
original width=\pgfphysicalwidth,
original height=\pgfphysicalheight,
resized width=\pgfphysicalwidth,
resized height=\pgfphysicalheight,
center=\pgfpoint{.5\pgfphysicalwidth}{.5\pgfphysicalheight},%
}
}
\makeatletter
\def\tmp@frame{}
\long\def\@notes{}
\long\def\mynote#1{%
\long\gdef\@notes{ #1 } %
\long\xdef\tmp@frame{\insertframenumber}%
}
\newsavebox{\tmpboxA} % page
\newsavebox{\tmpboxB} % infos
\newsavebox{\tmpboxC} % notes
\AtEveryBeginFrame{%
\savebox{\tmpboxB}{%
\parbox[t][7.5cm][t]{5cm}{%
\Large%
Frame: \dotfill \tmp@frame \par
Duration: \dotfill \par
}
}
\savebox{\tmpboxC}{ \parbox{15cm}{\@notes} }
\savebox{\tmpboxA}[16cm][r]{%
\parbox{16cm}{%
\raggedleft
\usebox{\tmpboxB}\par
\usebox{\tmpboxC} \long\def\@notes{}
}
}
\pgfpagesshipoutlogicalpage{1}\copy\tmpboxA
}
\makeatother
\pgfpagesuselayout{myHandout}
\begin{document}
\section{Section 1}
\begin{frame}{Frame 1}
\begin{enumerate}
\item<1-> enum 1
\item<2-> enum 2
\item<3-> enum 3
\item<4-> enum 4
\end{enumerate}
\mynote{\lipsum[6]}
\end{frame}
\section{Section 2}
\begin{frame}{Frame 1}
\begin{enumerate}
\item<1-> enum 1
\item<2-> enum 2
\item<3-> enum 3
\item<4-> enum 4
\end{enumerate}
\mynote{\lipsum[5]}
\end{frame}
%\clearpage
%\begin{frame}
%\end{frame}
\end{document}

%hid a closing brace. – Qrrbrbirlbel Sep 25 '12 at 19:29\AtBeginDocumentshows that this command is being excuted. So there is something wrong in the code that it is calling. – Andrew Swann Oct 7 '12 at 16:33