我在 Beamer 中有一些幻灯片,我想在某个时候停止幻灯片数量的计数器:在下面的例子中,我希望得到的不是 1/5、1/5、2/5、3/5、4/5、5/5,而是 1/3、1/3、2/3、2/3、2/3、3/3。非常感谢
\documentclass{beamer}
\usepackage{appendixnumberbeamer}
\setbeamertemplate{footline}
{
\begin{beamercolorbox}{author in head/foot}
\usebeamerfont{authorinhead/foot}
\vskip2pt \hskip5pt \insertsection \hfill
(\insertframenumber/\inserttotalframenumber)
\hskip3pt
\end{beamercolorbox}
}
\newcommand{\Blue}{\color[rgb]{0,0,1}}
\newcommand{\beginbackup}{
\newcounter{framenumbervorappendix}
\setcounter{framenumbervorappendix}{\value{framenumber}}
}
\newcommand{\backupend}{
\addtocounter{framenumbervorappendix}{-\value{framenumber}}
\addtocounter{framenumber}{\value{framenumbervorappendix}}
}
%--------------------------------------------------------------
\title{Model}
\author{}
\vfill
\date{Today}
%--------------------------------------------------------------
%--------------------------------------------------------------
\begin{document}
%--------------------------------------------------------------
%--------------------------------------------------------------
\beginbackup
\begin{frame}
\titlepage
\end{frame}
\backupend
%--------------------------------------------------------------------------------------------------------
\section{Introduction}
%--------------------------------------------------------------------------------------------------------
\begin{frame}{Motivation and preview of the model}
\begin{itemize}
\item bla
\item bla2
\end{itemize}
\end{frame}
%-------------------------------------------------------------------------------------------------------------
\begin{frame}{Example}
\begin{itemize}
\item bla
\item bla2
\end{itemize}
\end{frame}
%-------------------------------------------------------------------------------------------------------------
\begin{frame}{Example}
\begin{itemize}
\item bla3
\item bla4
\end{itemize}
\end{frame}
%-------------------------------------------------------------------------------------------------------------
\begin{frame}{Example}
\begin{itemize}
\item bla4
\item bla5
\end{itemize}
\end{frame}
%-------------------------------------------------------------------------------------------------------------
\begin{frame}{Conclusions}
\begin{itemize}
\item ble
\item ble1
\end{itemize}
\end{frame}
\end{document}
答案1
目前尚不清楚指的是哪个计数器,但我假设是framenumber
计数器。
我使用这个assoccnt
包(仍然是实验性的,但可以在 TeXLive/CTAN 上使用,请参阅关联柜台) 得到一个关联计数器totalframenumber
,始终增加framenumber
一个驱动计数器,然后使用命令\SuspendCounters{framenumber,totalframenumber}
停止这两个计数器的计数。只有globalsuspend=true
使用包选项时才能暂停驱动计数器。
经过 3 张幻灯片之后(如 OP 中所述),\ResumeSuspendedCounters
用于撤销暂停。
\documentclass{beamer}
\usepackage[globalsuspend=true]{assoccnt}%
\usepackage{blindtext}%
\usepackage{etoolbox}%
\newcounter{totalframenumber}%
\newcounter{totalframetrigger}%
\DeclareAssociatedCounters{framenumber}{totalframenumber}%
\renewcommand{\theframenumber}{\arabic{framenumber}/\arabic{totalframetrigger}}%
\makeatletter
\AtEndDocument{%
\immediate\write\@auxout{%
\string\setcounter{totalframetrigger}{\number\value{totalframenumber}}%
}%
}
\makeatother
\begin{document}
\begin{frame}{This is frame number \theframenumber}
\end{frame}
\begin{frame}{This is frame number \theframenumber}
\blindtext
\end{frame}
\begin{frame}{This is frame number \theframenumber}
\blindtext
\end{frame}
\SuspendCounters{framenumber,totalframenumber}%
\begin{frame}{This is frame number \theframenumber}
\blindtext
\end{frame}
\begin{frame}{This is frame number \theframenumber}
\blindtext[2]
\end{frame}
\begin{frame}{This is frame number \theframenumber}
\blindtext
\end{frame}
\ResumeSuspendedCounters
\begin{frame}{This is frame number \theframenumber}
\blindtext
\end{frame}
\end{document}
屏幕截图中显示了带有“id”的第二和第三帧3/4
,但是文本对于左侧帧来说太大(见左图)