我从 Beamer 中的基本 Berkeley 主题开始。我想修改页脚以包含幻灯片中央的页码。但是,修改后的页脚元素似乎“堆叠”在幻灯片底部,这会使幻灯片内容向上移动并切断侧边栏的底角。
我希望幻灯片看起来与基本主题完全一样,只是页码粘贴在底部居中。我希望侧边栏一直延伸到幻灯片底部。我需要修改什么才能做到这一点?
示例代码:
\documentclass{beamer}
\usetheme[width=2.0cm]{Berkeley}
%% **this part modifies footline to include slide numbers**
\setbeamertemplate{footline}{%
\leavevmode%
\hbox{\begin{beamercolorbox}[wd=\paperwidth,ht=2.25ex,dp=1ex,center]{frame number}%
\vskip0pt
\usebeamerfont{footline}\usebeamercolor[fg]{footline}\insertframenumber/\inserttotalframenumber
\vskip0pt
\end{beamercolorbox}%
}%
\vskip0pt%
}
\usepackage[utf8]{inputenc}
\title{Sample title}
\author{Anonymous}
\institute{ShareLaTeX}
\date{2013}
\begin{document}
\frame{\titlepage}
\begin{frame}
\frametitle{Sample frame title}
This is a text in first frame. This is a text in first frame. This is a text in first frame.
\end{frame}
\end{document}
答案1
您可以设置ht=0pt, dp=0pt
的beamercolorbox
高度为零。然后,调整第二个\vskip
以从底部边缘提高页码。要删除导航栏,只需使用\setbeamertemplate{navigation symbols}{}
,这不会影响页码。
代码
\documentclass{beamer}
\usetheme[width=2.0cm]{Berkeley}
%% **this part modifies footline to include slide numbers**
\setbeamertemplate{footline}{%
\leavevmode%
\hbox{\begin{beamercolorbox}[wd=\paperwidth,ht=0ex,dp=0ex,center]{frame number}%
\vskip0pt
\usebeamerfont{footline}\usebeamercolor[fg]{footline}
\insertframenumber/\inserttotalframenumber
\vskip.5ex
\end{beamercolorbox}%
}%
\vskip0pt%
}
% \setbeamertemplate{navigation symbols}{} % to remove navigation bar
\usepackage[utf8]{inputenc}
\title{Sample title}
\author{Anonymous}
\institute{ShareLaTeX}
\date{2013}
\begin{document}
\frame{\titlepage}
\begin{frame}
\frametitle{Sample frame title}
This is a text in first frame. This is a text in first frame. This is a text in first frame.
\end{frame}
\end{document}