我对 Beamer 有一个问题:我希望总帧数只考虑具有实际内容的帧。
这里有一个 MWE:
\documentclass[envcountsect]{beamer}
\usetheme[secheader]{Madrid}
\usecolortheme{seahorse}
\useoutertheme{infolines}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\title[Title]{Title}
\subtitle{\small Title}
\author[Author]{Author}
\institute{University of Disneyworld}
\date{02/07/2022}
\makeatletter
\setbeamertemplate{footline}
{
\leavevmode%
\hbox{%
\begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,center]{author in head/foot}%
\usebeamerfont{author in head/foot}\insertshortauthor
\end{beamercolorbox}%
\begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,center]{title in head/foot}%
\usebeamerfont{title in head/foot}\insertshorttitle
\end{beamercolorbox}%
\begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,center]{date in head/foot}% %''right'' as option
\usebeamerfont{date in head/foot}\insertshortdate{}\hspace*{2em}
% Making the next line a comment, erases the number of slides
\insertframenumber{} / \inserttotalframenumber\hspace*{2ex}
\end{beamercolorbox}}%
\vskip0pt%
}
\makeatother
\AtBeginSection[]
{
\begin{frame}<beamer>
\frametitle{Outline}
\tableofcontents[currentsection]
\end{frame}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\begin{frame}
\titlepage
\end{frame}
\begin{frame}
\frametitle{Frametitle}
Frame
\end{frame}
\begin{frame}
\frametitle{Outline}
\tableofcontents[hideallsubsections]
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Section}
\begin{frame}
\frametitle{Frame}
Frame
\end{frame}
\subsection{Subsection}
\begin{frame}
\frametitle{Frame}
Frame
\end{frame}
\subsection{Subsection}
\begin{frame}
\frametitle{Frame}
Frame
\end{frame}
\subsection{Subsection}
\begin{frame}
\frametitle{Frame}
Frame
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Section}
\begin{frame}
\frametitle{Frame}
Frame
\end{frame}
\end{document}
目前,“部分”框架以及带有“部分与子部分”框架的框架都计入了总计数,我想将其与第一页一起删除。此外,此 MWE 中没有参考书目,但解决方案应考虑到有专门用于参考书目的幻灯片的可能性。
提前感谢您的帮助!
PS:有没有什么办法可以去掉第一帧的帧号?
答案1
您可以使用框架选项排除某些框架不增加框架编号noframenumbering
(我只会将此选项与选项一起使用plain
或删除这些框架上的脚注线 - 否则,如果这些框架与它们之后的框架具有相同的编号,则看起来很奇怪)
\documentclass[envcountsect]{beamer}
\usetheme[secheader]{Madrid}
\usecolortheme{seahorse}
\useoutertheme{infolines}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\title[Title]{Title}
\subtitle{\small Title}
\author[Author]{Author}
\institute{University of Disneyworld}
\date{02/07/2022}
\makeatletter
\setbeamertemplate{footline}
{
\leavevmode%
\hbox{%
\begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,center]{author in head/foot}%
\usebeamerfont{author in head/foot}\insertshortauthor
\end{beamercolorbox}%
\begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,center]{title in head/foot}%
\usebeamerfont{title in head/foot}\insertshorttitle
\end{beamercolorbox}%
\begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,center]{date in head/foot}% %''right'' as option
\usebeamerfont{date in head/foot}\insertshortdate{}\hspace*{2em}
% Making the next line a comment, erases the number of slides
\insertframenumber{} / \inserttotalframenumber\hspace*{2ex}
\end{beamercolorbox}}%
\vskip0pt%
}
\makeatother
\AtBeginSection[]
{
\begin{frame}<beamer>[noframenumbering,plain]
\frametitle{Outline}
\tableofcontents[currentsection]
\end{frame}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\begin{frame}[noframenumbering,plain]
\titlepage
\end{frame}
\begin{frame}
\frametitle{Frametitle}
Frame
\end{frame}
\begin{frame}[noframenumbering,plain]
\frametitle{Outline}
\tableofcontents[hideallsubsections]
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Section}
\begin{frame}
\frametitle{Frame}
Frame
\end{frame}
\subsection{Subsection}
\begin{frame}
\frametitle{Frame}
Frame
\end{frame}
\subsection{Subsection}
\begin{frame}
\frametitle{Frame}
Frame
\end{frame}
\subsection{Subsection}
\begin{frame}
\frametitle{Frame}
Frame
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Section}
\begin{frame}
\frametitle{Frame}
Frame
\end{frame}
\end{document}