忽略 \pause 但仅计算 beamer 中的幻灯片编号

忽略 \pause 但仅计算 beamer 中的幻灯片编号

Beamer 显示的页码过多,因为它将每个 \pause 命令都算作一个额外的页面,从技术上讲它在 PDF 中是这样的,但逻辑上却不是。

回答类似问题,我试过了 \setbeamertemplate{footline}[frame number]{},但是这会引入一个相反的问题,即\only只使用一次命令来计算页数,即使从逻辑上讲它们是多张幻灯片。

有没有办法在计算页脚中的页面/框架号时仅忽略\pause但仍跟踪?\only

例子

\documentclass{beamer}
\usepackage[utf8x]{inputenc}
\setbeamertemplate{navigation symbols}{}
\setbeamertemplate{footline}[frame number]

\begin{document}

\begin{frame}{Slide with Pause}                                                                                                                               
This should all be slide one.\\
One\pause{} Two\pause{} Three
\end{frame}

\begin{frame}{Slide with Only}
\only<1>{This should be page 2.}
\only<2>{This should be page 3.}
\end{frame}

\end{document}

如果我使用“页码”,我会得到 5 页。如果我使用“帧数”,我会得到 2 页。但是我想要得到 3 页。

答案1

显而易见的解决方案:说实话

\begin{frame}{Slide without Only}
This should be page 2.
\end{frame}

\begin{frame}{Slide without Only}
This should be page 3.
\end{frame}

完整名称:

\documentclass{beamer}
\usepackage{ulem}
\setbeamertemplate{navigation symbols}{}
\setbeamertemplate{footline}[frame number]
\begin{document}
\begin{frame}{Slide with Pause}
This should all be \sout{slide} frame \insertframenumber.\\
(page \insertpagenumber,  slide \insertslidenumber)\par\pause
(page \insertpagenumber,  slide \insertslidenumber)\par\pause
\end{frame}

\begin{frame}{Slide without Only}
This is the \sout{slide} frame \insertframenumber.
(page \insertpagenumber,  slide \insertslidenumber)
\end{frame}

\begin{frame}{Slide without Only}
This is \sout{slide} frame \insertframenumber.
(page \insertpagenumber,  slide \insertslidenumber)
\end{frame}
\end{document}

不必要的复杂解决方案:隐瞒和撒谎

\begin{frame}{Slide with Only}
\only<1>{This should be page 2.}
\only<2>{\addtocounter{framenumber}{1}This should be page 3.}
\end{frame}

完整名称:

\documentclass{beamer}
\usepackage{ulem}
\setbeamertemplate{navigation symbols}{}
\setbeamertemplate{footline}[frame number]
\begin{document}
\begin{frame}{Slide with Pause}
This should all be \sout{slide} frame \insertframenumber.\\
(page \insertpagenumber,  slide \insertslidenumber)\par\pause
(page \insertpagenumber,  slide \insertslidenumber)\par\pause
\end{frame}

\begin{frame}{Slide with Only}
\only<1>{This should be \sout{slide} frame \insertframenumber. 
(but page in \insertpagenumber,  slide \insertslidenumber)}
\only<2>{\addtocounter{framenumber}{1}This should be \sout{slide} frame \insertframenumber.
(but page in \insertpagenumber,  slide \insertslidenumber)}
\end{frame}
    
\end{document}

相关内容