我正在使用 Beamer Warsaw 进行演示。我需要修改标题和页脚,因为作品的标题很长。因此,对于页脚,调整如下:
\setbeamertemplate{footline}
{
\leavevmode%
\hbox{%
\begin{beamercolorbox}[wd=.25\paperwidth,ht=2.25ex,dp=1ex,center]{author in head/foot}%
\usebeamerfont{author in head/foot}\insertshortauthor
\end{beamercolorbox}%
\begin{beamercolorbox}[wd=.75\paperwidth,ht=2.25ex,dp=1ex,center]{title in head/foot}%
\usebeamerfont{title in head/foot}\insertshorttitle\hspace*{3em}
\end{beamercolorbox}}%
\vskip0pt%
}
至于标题,我不知道该修改什么。我尝试了:
\setbeamertemplate{headline}
{
\leavevmode%
\hbox{%
\begin{beamercolorbox}[wd=.25\paperwidth]{section in head/foot}%
\usebeamerfont{subsection in head/foot}\insertsectionhead
\end{beamercolorbox}%
\begin{beamercolorbox}[wd=.75\paperwidth]{subsection in head/foot}%
\usebeamerfont{section in head/foot}\insertsubsectionhead
\end{beamercolorbox}}%
\vskip0pt%
}
但显然它不起作用。
答案1
Warsaw
内部使用shadow
外部主题,而外部主题又使用split
外部主题定义headline
(当compress
未激活选项时)为
\defbeamertemplate*{headline}{split theme}
{%
\leavevmode%
\@tempdimb=2.4375ex%
\ifnum\beamer@subsectionmax<\beamer@sectionmax%
\multiply\@tempdimb by\beamer@sectionmax%
\else%
\multiply\@tempdimb by\beamer@subsectionmax%
\fi%
\ifdim\@tempdimb>0pt%
\advance\@tempdimb by 1.825ex%
\begin{beamercolorbox}[wd=.5\paperwidth,ht=\@tempdimb]{section in head/foot}%
\vbox to\@tempdimb{\vfil\insertsectionnavigation{.5\paperwidth}\vfil}%
\end{beamercolorbox}%
\begin{beamercolorbox}[wd=.5\paperwidth,ht=\@tempdimb]{subsection in head/foot}%
\vbox to\@tempdimb{\vfil\insertsubsectionnavigation{.5\paperwidth}\vfil}%
\end{beamercolorbox}%
\fi%
}
然后您可以轻松改变条纹的宽度:
\documentclass{beamer}
\usetheme{Warsaw}
\setbeamertemplate{footline}
{
\leavevmode%
\hbox{%
\begin{beamercolorbox}[wd=.25\paperwidth,ht=2.25ex,dp=1ex,center]{author in head/foot}%
\usebeamerfont{author in head/foot}\insertshortauthor
\end{beamercolorbox}%
\begin{beamercolorbox}[wd=.75\paperwidth,ht=2.25ex,dp=1ex,center]{title in head/foot}%
\usebeamerfont{title in head/foot}\insertshorttitle\hspace*{3em}
\end{beamercolorbox}}%
\vskip0pt%
}
\makeatletter
\setbeamertemplate{headline}
{%
\leavevmode%
\@tempdimb=2.4375ex%
\ifnum\beamer@subsectionmax<\beamer@sectionmax%
\multiply\@tempdimb by\beamer@sectionmax%
\else%
\multiply\@tempdimb by\beamer@subsectionmax%
\fi%
\ifdim\@tempdimb>0pt%
\advance\@tempdimb by 1.825ex%
\begin{beamercolorbox}[wd=.25\paperwidth,ht=\@tempdimb]{section in head/foot}%
\vbox to\@tempdimb{\vfil\insertsectionnavigation{.25\paperwidth}\vfil}%
\end{beamercolorbox}%
\begin{beamercolorbox}[wd=.75\paperwidth,ht=\@tempdimb]{subsection in head/foot}%
\vbox to\@tempdimb{\vfil\insertsubsectionnavigation{.75\paperwidth}\vfil}%
\end{beamercolorbox}%
\fi%
}
\makeatother
\title{A reallly really really really long title just for the example}
\begin{document}
\section{A test section}
\begin{frame} test\end{frame}
\subsection{Test subsection one one}
\begin{frame} test\end{frame}
\subsection{Test subsection one two}
\begin{frame} test\end{frame}
\section{Another test section}
\begin{frame} test\end{frame}
\subsection{Test subsection two one}
\begin{frame} test\end{frame}
\subsection{Test subsection two two}
\begin{frame} test\end{frame}
\subsection{Test subsection two three}
\begin{frame} test\end{frame}
\end{document}
其中一个框架的图像:
但是,使用 的可选参数\title
,您可以使用较短的标题作为 `footlinev,以避免重新定义:
\title[Short title]{A reallly really really really long title just for the example}