使用帧中断禁用投影仪帧编号

使用帧中断禁用投影仪帧编号

在我的 Beamer 演示中,参考书目帧(即最后的帧)被设置为不包含在编号中。因此,总帧数(打印为“当前帧数/总帧数”)不计算参考书目帧。我为此使用了以下代码:

\documentclass[xcolor={dvipsnames,table},11pt]{beamer}
\setbeamertemplate{footline}{\insertframenumber/\inserttotalframenumber}
\begin{document}
\begin{frame}[noframenumbering]
\begin{thebibliography}{}
\bibitem{} The total frame number is displayed as zero,
\bibitem{} which means the frames are not countered.
\end{thebibliography}
\end{frame}
\end{document}

一切运行正常。然后我决定使用以下命令来包含框架中断:

\begin{frame}[noframenumbering, allowframebreaks]

框架已正确分解,但现在除第一个之外的书目框架已编号。例如,如果有三个书目幻灯片,则总数将增加到“x+(3-1)=x+2”。我需要的是不变的总框架编号(即“x+0”)。

任何建议都会有帮助。提前致谢。

答案1

手动破解:

\documentclass[xcolor={dvipsnames,table},11pt]{beamer}
\setbeamertemplate{footline}{\insertframenumber/\inserttotalframenumber}
\begin{document}
\frame{}

\begin{frame}[allowframebreaks]
\begin{thebibliography}{}
\bibitem{} The total frame number is displayed as zero,
\framebreak
\bibitem{} which means the frames are not countered.
\end{thebibliography}
\end{frame}
\addtocounter{framenumber}{-2}
\end{document}

或者,如果您可以接受所有allowframebreak帧均未编号,则可以使用自动解决方案:

\documentclass[xcolor={dvipsnames,table},11pt]{beamer}

\setbeamertemplate{footline}{%
    \ifnum\insertcontinuationcount>0
        \addtocounter{framenumber}{-1}
    \fi
    \insertframenumber/\inserttotalframenumber
}

\begin{document}
\frame{}

\begin{frame}[allowframebreaks]
\begin{thebibliography}{}
\bibitem{} The total frame number is displayed as zero,
\framebreak
\bibitem{} which means the frames are not countered.
\end{thebibliography}
\end{frame}

\end{document}

在此处输入图片描述

答案2

samcarters 的答案甚至可以得到改进,通过增加帧中断序列的第一个帧号,而不是增加附加的帧号。

    \documentclass[11pt]{beamer}

\newcounter{continuationFirstSlide}
\setcounter{continuationFirstSlide}{1}

  \setbeamertemplate{footline}{%
    \ifnum\insertcontinuationcount>0 % decide is this a framebreak slide ("split frame"), if yes, decide whether its the first slide of the split or a continuation, if second, then reduce frame number by one to omit counting
        \ifnum\thecontinuationFirstSlide=1
            \setcounter{continuationFirstSlide}{0}
        \else
             \addtocounter{framenumber}{-1}
        \fi
    \else % no continuation, so the next framebreak slide is a first slide, that gets a new number
        \setcounter{continuationFirstSlide}{1}
    \fi
    \insertframenumber/\inserttotalframenumber
}

\begin{document}
\frame{}

\begin{frame}[allowframebreaks]
abc

\framebreak

XYZ
\end{frame}

\frame{last frame}

\end{document}

在此处输入图片描述

相关内容