我正在尝试使 CambridgeUS 主题的标题类似于 Copenhagen 主题。我想添加类似于拆分外部主题的部分/子部分导航。
\documentclass{beamer}
\usetheme{CambridgeUS}
\setbeamertemplate{headline}
{
\leavevmode%
\begin{beamercolorbox}[wd=.5\paperwidth]{section in head/foot}%
\insertsectionnavigation{.5\paperwidth}%
\end{beamercolorbox}%
\begin{beamercolorbox}[wd=.5\paperwidth]{subsection in head/foot}%
\insertsubsectionnavigation{.5\paperwidth}%
\end{beamercolorbox}%
}
\begin{document}
\frame{\titlepage}
\section{This is my first section}
\begin{frame}
\frametitle{title 1}
\end{frame}
\section{This is my second section}
\subsection{This is my first subsection}
\begin{frame}
\frametitle{title 2}
\end{frame}
\subsection{This is my second subsection}
\begin{frame}
\frametitle{title 3}
\end{frame}
\end{document}
答案1
\useoutertheme{split}
后添加\usetheme{CambridgeUS}
。
\documentclass{beamer}
\usetheme{CambridgeUS}
\useoutertheme{split}
\begin{document}
\frame{\titlepage}
\section{This is my first section}
\begin{frame}
\frametitle{title 1}
\end{frame}
\section{This is my second section}
\subsection{This is my first subsection}
\subsection{This is my second subsection}
\begin{frame}
\frametitle{title 2}
\end{frame}
\subsection{This is my second subsection}
\begin{frame}
\frametitle{title 3}
\end{frame}
\end{document}
更新
split
外部主题更改了标题和脚注中使用的模板和颜色样式。为了保持脚注的颜色样式和样式不变,我手动从中选择了新标题样式的定义beameroutertemplatesplit.sty
。
\documentclass{beamer}
\usetheme{CambridgeUS}
%%
%% Define and install beamer template "headline", option "split theme".
%% This is copied from beamerouterthemesplit.sty.
%%
\makeatletter
\usesectionheadtemplate
{\hfill\insertsectionhead}
{\hfill\color{fg!50!bg}\insertsectionhead}
% Head
\ifbeamer@compress
\defbeamertemplate*{headline}{split theme}
{%
\leavevmode%
\begin{beamercolorbox}[wd=.5\paperwidth,ht=2.5ex,dp=1.125ex]{section in head/foot}%
\insertsectionnavigationhorizontal{.5\paperwidth}{\hskip0pt plus1filll}{}%
\end{beamercolorbox}%
\begin{beamercolorbox}[wd=.5\paperwidth,ht=2.5ex,dp=1.125ex]{subsection in head/foot}%
\insertsubsectionnavigationhorizontal{.5\paperwidth}{}{\hskip0pt plus1filll}%
\end{beamercolorbox}%
}
\else
\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%
}
\fi
\makeatother
%%
%% end of lines from beamerouterthemesplit.sty
%%
\begin{document}
\frame{\titlepage}
\section{This is my first section}
\begin{frame}
\frametitle{title 1}
\end{frame}
\section{This is my second section}
\subsection{This is my first subsection}
\begin{frame}
\frametitle{title 2}
\end{frame}
\subsection{This is my second subsection}
\begin{frame}
\frametitle{title 3}
\end{frame}
\end{document}