1

I am trying to make header of the CambridgeUS theme similar to the Copenhagen theme. I want to add section/subsection navigation similar to the split outer theme.

\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 Answer 1

1

Add \useoutertheme{split} after \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}

enter image description here

Update

split outer theme changes both template and color styles used in headline and footline. To leave the color styles and style of footline untouched, I manually pick the definition of new headline style from 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}

enter image description here

2
  • The above answer is accepted but the split outer theme does not solve the purpose. It changes theme colour and more importantly it changes three parts of footer into two parts. What am I missing with the headline defined above? It will alter only header part. Jul 19, 2020 at 8:00
  • 1
    @Praveen25488 See my updated answer. Jul 20, 2020 at 20:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .