如何在 allowframbreaks 框架标题中插入总延续数?

如何在 allowframbreaks 框架标题中插入总延续数?

我想将 的编号改为allowframbreaks frame,例如从I II III改为(1/3) (2/3) (3/3),但找不到获取总延续数的命令。这是 MWE。

\documentclass[compress]{beamer}
\usetheme{Warsaw} 

%allowframebreaks numbering in the title
\setbeamertemplate{frametitle continuation}{(\insertcontinuationcount/)}
%\setbeamertemplate{frametitle continuation}{(\insertcontinuationcount/\inserttotalcontinuationcount)}

\title{title}
\author{author}

%%%%%
\begin{document}

\begin{frame}[allowframebreaks]{allowframebreaks title}
frame 1
\framebreak

frame 2
\framebreak

frame 3
\framebreak
\end{frame}

\end{document}

答案1

可以\inserttotalcontinuationcount根据帧的开始和结束轻松计算:

\documentclass[compress]{beamer}
\usetheme{Warsaw} 

\newcounter{cont}

\makeatletter
%allowframebreaks numbering in the title
\setbeamertemplate{frametitle continuation}{%
    \setcounter{cont}{\beamer@endpageofframe}%
    \addtocounter{cont}{1}%
    \addtocounter{cont}{-\beamer@startpageofframe}%
    (\insertcontinuationcount/\arabic{cont})%
}
\makeatother

\title{title}
\author{author}

%%%%%
\begin{document}   

\begin{frame}[allowframebreaks]{allowframebreaks title}
    frame 1
    \framebreak

    frame 2
    \framebreak

    frame 3
    \framebreak
\end{frame}

\end{document}

在此处输入图片描述

相关内容