我正在使用 Beamer 编写演示文稿,使用 Dresden 主题。从主题预览我看到我的演示文稿章节标题下方的顶部栏上应该出现白色圆圈(以指示幻灯片每一个框架,我猜)。问题是,当我编译脚本时它们没有出现。我必须指定特定命令才能获得它吗?
此外,我如何添加幻灯片的编号(相对于演示文稿中的幻灯片总数)?例如,假设我希望它们出现在每张幻灯片的右下角。
答案1
Dreden 主题使用外部主题miniframes
指定脚注类型authorinstitutetitle
\useoutertheme[footline=authorinstitutetitle]{miniframes}
因此,要插入\insertframenumber
相对于总帧数(命令)的帧数(命令\inserttotalframenumber
),我们应该考虑如何authorinstitutetitle
定义:
\def\beamer@theme@footline@authorinstitutetitle{
\defbeamertemplate*{footline}{miniframes theme}
{%
\begin{beamercolorbox}[colsep=1.5pt]{upper separation line foot}
\end{beamercolorbox}
\begin{beamercolorbox}[ht=2.5ex,dp=1.125ex,%
leftskip=.3cm,rightskip=.3cm plus1fil]{author in head/foot}%
\leavevmode{\usebeamerfont{author in head/foot}\insertshortauthor}%
\hfill%
{\usebeamerfont{institute in head/foot}\usebeamercolor[fg]{institute in head/foot}\insertshortinstitute}%
\end{beamercolorbox}%
\begin{beamercolorbox}[ht=2.5ex,dp=1.125ex,%
leftskip=.3cm,rightskip=.3cm plus1fil]{title in head/foot}%
{\usebeamerfont{title in head/foot}\insertshorttitle}%
\end{beamercolorbox}%
\begin{beamercolorbox}[colsep=1.5pt]{lower separation line foot}
\end{beamercolorbox}
}
}
现在,右下角没有任何东西,因此可以利用该空间:
\begin{beamercolorbox}[ht=2.5ex,dp=1.125ex,%
leftskip=.3cm,rightskip=.3cm plus1fil]{title in head/foot}%
{\usebeamerfont{title in head/foot}\insertshorttitle}%
\end{beamercolorbox}%
通过增加:
\begin{beamercolorbox}[ht=2.5ex,dp=1.125ex,%
leftskip=.3cm,rightskip=.3cm plus1fil]{title in head/foot}%
{\usebeamerfont{title in head/foot}\insertshorttitle}%
\hfill%
{\usebeamerfont{frame number}\usebeamercolor[fg]{frame number}\insertframenumber~\frameofframes~\inserttotalframenumber}
请注意,帧编号之间的分隔符是命令:\frameofframes
。其定义如下:
\newcommand{\frameofframes}{/}
\newcommand{\setframeofframes}[1]{\renewcommand{\frameofframes}{#1}}
这允许您使用其他内容修改标准表示(1/5
例如);例如:
\setframeofframes{of}
会提供1 of 5
。
代码:
\documentclass{beamer}
\usepackage{lmodern}
\usetheme{Dresden}
\author{My name}
\title{My presentation}
\institute{My institute}
\newcommand{\frameofframes}{/}
\newcommand{\setframeofframes}[1]{\renewcommand{\frameofframes}{#1}}
\setframeofframes{of}
\makeatletter
\setbeamertemplate{footline}
{%
\begin{beamercolorbox}[colsep=1.5pt]{upper separation line foot}
\end{beamercolorbox}
\begin{beamercolorbox}[ht=2.5ex,dp=1.125ex,%
leftskip=.3cm,rightskip=.3cm plus1fil]{author in head/foot}%
\leavevmode{\usebeamerfont{author in head/foot}\insertshortauthor}%
\hfill%
{\usebeamerfont{institute in head/foot}\usebeamercolor[fg]{institute in head/foot}\insertshortinstitute}%
\end{beamercolorbox}%
\begin{beamercolorbox}[ht=2.5ex,dp=1.125ex,%
leftskip=.3cm,rightskip=.3cm plus1fil]{title in head/foot}%
{\usebeamerfont{title in head/foot}\insertshorttitle}%
\hfill%
{\usebeamerfont{frame number}\usebeamercolor[fg]{frame number}\insertframenumber~\frameofframes~\inserttotalframenumber}
\end{beamercolorbox}%
\begin{beamercolorbox}[colsep=1.5pt]{lower separation line foot}
\end{beamercolorbox}
}
\makeatother
\begin{document}
\section{One}
\subsection{One-one}
\frame{\frametitle{X-one} bla bla bla}
\frame{\frametitle{X-one-a} bla bla bla}
\frame{\frametitle{X-one-b} bla bla bla}
\subsection{One-two}
\frame{\frametitle{X-one} bla bla bla}
\frame{\frametitle{X-one-a} bla bla bla}
\frame{\frametitle{X-one-b} bla bla bla}
\section{Two}
\subsection{Two-one}
\frame{\frametitle{X-one} bla bla bla}
\frame{\frametitle{X-one-a} bla bla bla}
\frame{\frametitle{X-one-b} bla bla bla}
\subsection{Two-two}
\frame{\frametitle{X-one} bla bla bla}
\frame{\frametitle{X-one-a} bla bla bla}
\frame{\frametitle{X-one-b} bla bla bla}
\section{Three}
\subsection{Three-one}
\frame{\frametitle{X-one} bla bla bla}
\frame{\frametitle{X-one-a} bla bla bla}
\frame{\frametitle{X-one-b} bla bla bla}
\subsection{Three-two}
\frame{\frametitle{X-one} bla bla bla}
\frame{\frametitle{X-one-a} bla bla bla}
\frame{\frametitle{X-one-b} bla bla bla}
\end{document}
结果为一帧: