我正在尝试使用 pgfpage 从 beamer 演示文稿中制作一种“培训师指南”(参见下面的示例),但遇到一个问题:讲义在最后一帧无法正常工作 - 我不知道为什么。
作为一种解决方法,我必须添加一个空框架,但我发现这不是很干净。
\AtEveryBeginFrame
为什么最后一帧的代码好像没有执行?
\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}
答案1
有一些时间问题,我只是部分理解。但问题的一部分是,在帧的开头,当您尝试构建周围的音符时,尚未定义此音符的材料。 pgfpages
等待这个就足够了,我相信您在第 1 页上看到的内容是由在第 2 帧开头执行的代码触发的。无论如何,在最后一个实例中,命令不会被触发。因此,一种解决方案是将该代码打包到单独的命令中,并在最后一帧之后明确调用它。(将其修补\endframe
不起作用,因为“beamer”会弄乱该命令。)
\documentclass[a4paper,handout]{beamer}
\usepackage{pgfpages}
\usepackage[T1]{fontenc}
\usepackage{tikz}
\usepackage{lipsum}
\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
\def\layoutnotes{%
\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
}
\AtEveryBeginFrame{\layoutnotes}
\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 2}
\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}
\layoutnotes
\end{document}