1

I want to change the background (as a rectangle around, similar to the footer) in the two head navigation bars, for section and subsection. So that the currently active elements have one color, e.g. white, and the shaded elements have a different color, e.g. green.

Here is the mwe:

\documentclass[aspectratio=169]{beamer}

\usetheme{AnnArbor}
\usetheme{Singapore}
\usecolortheme{spruce}

\title{MWE}
\author{trylks}
\date{\today}
\newcommand{\easection}[4]{\section{#1}

\subsection{What}\begin{frame}#2\end{frame}
\subsection{Why}\begin{frame}#3\end{frame}
\subsection{Who}\begin{frame}#4\end{frame}}

\makeatletter
\setbeamertemplate{headline}
{%
\insertsectionnavigationhorizontal{\paperwidth}{}{}
\insertsubsectionnavigationhorizontal{\paperwidth}{}{}
}%
\makeatother

\begin{document}

\frame{\titlepage}
\easection{A}{a}{b}{c}
\easection{B}{d}{e}{f}
\easection{C}{g}{h}{i}
\easection{E}{j}{k}{l}
\easection{D}{m}{n}{o}
\frame{\titlepage}

\end{document}
1

1 Answer 1

2

You can wrap the navigation bars into beamercolorboxes:

\documentclass[aspectratio=169]{beamer}

\usetheme{AnnArbor}
\usetheme{Singapore}
\usecolortheme{spruce}

\title{MWE}
\author{trylks}
\date{\today}
\newcommand{\easection}[4]{\section{#1}

\subsection{What}\begin{frame}#2\end{frame}
\subsection{Why}\begin{frame}#3\end{frame}
\subsection{Who}\begin{frame}#4\end{frame}}

\AtBeginDocument{%
  \setbeamercolor{section in head/foot}{bg=white!50!MSUgreen,fg=white}
}


\makeatletter
\setbeamertemplate{headline}
{%
  \leavevmode%
  \begin{beamercolorbox}[wd=\paperwidth,ht=2.5ex,dp=1.125ex]{section in head/foot}%
    \insertsectionnavigationhorizontal{\paperwidth}{}{}
  \end{beamercolorbox}%
  
  \begin{beamercolorbox}[wd=\paperwidth,ht=2.5ex,dp=1.125ex]{subsection in head/foot}%
    \insertsubsectionnavigationhorizontal{\paperwidth}{}{}
  \end{beamercolorbox}%
}%
\makeatother

\begin{document}

\frame{\titlepage}
\easection{A}{a}{b}{c}
\easection{B}{d}{e}{f}
\easection{C}{g}{h}{i}
\easection{E}{j}{k}{l}
\easection{D}{m}{n}{o}
\frame{\titlepage}

\end{document}

enter image description here

1
  • Thank you. How can I use beamercolorbox to have a different background color in the active section with respect to other sections?
    – Trylks
    Jul 20, 2022 at 10:51

You must log in to answer this question.

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