This article presents how to customize the header, navigation symbols and footer in Beamer.
目录
Fig. 1: Header, navigation symbols and footer in Beamer
% get rid of header navigation bar
%\setbeamertemplate{headline}{}
%get rid of bottom navigation symbols
%\setbeamertemplate{navigation symbols}{}
% get rid of footer
%\setbeamertemplate{footline}{}
It is quite common to add text (such as the presenter’s name, the presentation’s title, university, and more) to the bottom of one or more slides. The footer in Fig. 1 is corresponding the following code.
% footer
\makeatletter
\setbeamertemplate{footline}
{
\leavevmode%
\hbox{%
\begin{beamercolorbox}[wd=.15\paperwidth,ht=2.25ex,dp=1ex,center]{institute in head/foot}%
\usebeamerfont{title in head/foot}%
\insertshortauthor
\end{beamercolorbox}%
\begin{beamercolorbox}[wd=.6\paperwidth,ht=2.25ex,dp=1ex,center]{institute in head/foot}%
\usebeamerfont{title in head/foot}%
\insertshorttitle
\end{beamercolorbox}%
\begin{beamercolorbox}[wd=.15\paperwidth,ht=2.25ex,dp=1ex,center]{institute in head/foot}%
\usebeamerfont{title in head/foot}%
\insertshortdate
\end{beamercolorbox}%
\begin{beamercolorbox}[wd=.1\paperwidth,ht=2.25ex,dp=1ex,right]{institute in head/foot}%
\usebeamerfont{title in head/foot}
\insertframenumber{} / \inserttotalframenumber\hspace*{2ex}
\end{beamercolorbox}}%
}
\makeatother
More information about inside template inserts can be found in,
- Insert-like Commands in BEAMER appearance cheat sheet.pdf
- Inside template inserts in Beamer application notes: a title page
- The beamer class User Guide for version 3.36.pdf
4. Header
For instance, insert a horizontal navigation bar containing all sections, with the current section highlighted.
\makeatletter
\setbeamertemplate{headline}{%
\leavevmode%
\hbox{%
\begin{beamercolorbox}[wd=\paperwidth,ht=2.5ex,dp=1.125ex]{palette quaternary}%
% Flush the bar to the left
\insertsectionnavigationhorizontal{\paperwidth}{}{\hskip0pt plus1filll}
% Flush the bar to the left
%\insertsectionnavigationhorizontal{\paperwidth}{\hskip0pt plus1filll}{}
% Flush the bar to the center
%\insertsectionnavigationhorizontal{\paperwidth}{\hskip0pt plus1filll}{\hskip0pt plus1filll}
\insertsectionnavigationhorizontal{\paperwidth}{left}{right}
\end{beamercolorbox}%
}
}
\makeatother
%% Usage
\insertsectionnavigationhorizontal{⟨width⟩}{⟨left insert⟩}{⟨right insert⟩}
\insertsubsectionnavigationhorizontal{⟨width⟩}{⟨left insert⟩}{⟨right insert⟩}
left insert
will be inserted to the left of the sectionsright insert
will be inserted to the right.\hskip0pt plus1filll
inserts a triple fill to flush the bar to the left/right/center.
More options for the navigation bars,
\insertnavigation{⟨width⟩}
\insertverticalnavigation{⟨width⟩}
\insertsectionnavigation{⟨width⟩}
\insertsectionnavigationhorizontal{⟨width⟩}{⟨left insert⟩}{⟨right insert⟩}
\insertsubsectionnavigation{⟨width⟩}
\insertsubsectionnavigationhorizontal{⟨width⟩}{⟨left insert⟩}{⟨right insert⟩}
PS: the source code related to this post is hosted on my GitHub, here.
赞赏微信赞赏
支付宝赞赏