[Tex/LaTex] Footer navigation bar for subsection in Metropolis theme

beamerbeamer-metropolisnavigation

I'm trying to create a subsection navigation bar in the footer.
Effectively, I'd like the footer to show only the subsections for a given section.

Here's what I currently have:

\documentclass{beamer}
\usetheme[
sectionpage=progressbar,
progressbar=frametitle]{metropolis}
\usepackage{graphicx}
\definecolor{prettyBlue}{HTML}{2196F3}
\setbeamercolor{progress bar}{fg=prettyBlue, bg=gray}
\title{Proof of $C_4$ photosynthesis without Kranz anatomy in \textit{Bienertia cycloptera} (Chenopodiaceae)}
\subtitle{Methods}

%%% TEST
% see: https://tex.stackexchange.com/questions/364904/adding-section-indicator-to-metropolis-theme
\setbeamertemplate{mini frame}{}
\setbeamertemplate{mini frame in current section}{}
\setbeamertemplate{mini frame in current subsection}{}
\makeatletter
\setbeamertemplate{footline}{%
    \begin{beamercolorbox}[colsep=1.5pt]{upper separation line head}
    \end{beamercolorbox}
    \begin{beamercolorbox}{section in head/foot}
        \vskip2pt\insertsubsectionnavigation{\paperwidth}\vskip-2pt
    \end{beamercolorbox}%
    \begin{beamercolorbox}[colsep=1.5pt]{lower separation line head}
    \end{beamercolorbox}
}
\makeatother

\setbeamercolor{section in head/foot}{fg=normal text.bg, bg=structure.fg}
\setbeamercovered{}
%%% TEST END

\begin{document}
    
\maketitle

\begin{frame}{Aim}
To identify the 'class' of photosynthesis for 
\textit{Bienertia cycloptera}.
\end{frame}

%% See if we can get a flowchart at top to show 'sequence'
\section{Observing the structure through microscopy}

\subsection{Fixing the tissue}
\begin{frame}{Fixing the tissue}
\begin{itemize}[<+->]
    \item[] Before microscopy, tissues must first be preserved.\\~\\
    \item[] Here, \textit{paraformaldehyde} and \textit{glutaraldehyde} is used.
\end{itemize}
\end{frame}

\begin{frame}{Fixing the tissue}
\begin{itemize}[<+->]
    \item[] Before microscopy, tissues must first be preserved.\\~\\
    \item[] Here, \textit{paraformaldehyde} and \textit{glutaraldehyde} is used.
\end{itemize}
\end{frame}

\begin{frame}{Staining the tissue}
Blah blah blah
\end{frame}


\section{In situ immunolocalisation}% need italics

\section{Enzymatic analysis}

\section{Exposure of leaves to $^{14}CO_2$}
\end{document}

enter image description here
Notably, the subsection is there, but it's bleeding off the page.

But what I'd like is something closer to –
enter image description here

where the current subsection is highlighted and other subsections are slightly transparent.

How would I set up the navigation box so that it's working 'as intended'?

Best Answer

Two problems:

  • you need \insertsubsectionnavigationhorizontal and not \insertsubsectionnavigation otherwise the subsections will be stacked on top of each other and disappear below the page border

  • to set the colour of the subsection names, you need \setbeamercolor{subsection in head/foot} in addition to \setbeamercolor{section in head/foot} which sets the colour of the colorbox.


\documentclass{beamer}
\usetheme[
sectionpage=progressbar,
progressbar=frametitle]{metropolis}


\setbeamertemplate{mini frame}{}
\setbeamertemplate{mini frame in current section}{}
\setbeamertemplate{mini frame in current subsection}{}
\setbeamercolor{section in head/foot}{fg=normal text.bg, bg=structure.fg}
\setbeamercolor{subsection in head/foot}{fg=normal text.bg, bg=structure.fg}

\makeatletter
\setbeamertemplate{footline}{%
    \begin{beamercolorbox}[colsep=1.5pt]{upper separation line head}
    \end{beamercolorbox}
    \begin{beamercolorbox}{section in head/foot}
      \insertsubsectionnavigationhorizontal{\paperwidth}{}{\hskip0pt plus1filll}\vskip3pt%
    \end{beamercolorbox}%
    \begin{beamercolorbox}[colsep=1.5pt]{lower separation line head}
    \end{beamercolorbox}
}
\makeatother


\begin{document}

\section{sec}
\begin{frame}a\end{frame}

\subsection{sub1}
\begin{frame}a\end{frame}

\subsection{sub2}
\begin{frame}a\end{frame}

\subsection{sub3}
\begin{frame}a\end{frame}

\end{document}

enter image description here