3

Hi all and happy new year!

First time poster here and I just had a quick question that I am having trouble solving. I posted a MWE of basic LaTeX beamer code using the Metropolis theme.* I would like to (globally) have the progress bar have a border around it, specifying the color and thickness of the border (let's say a blue border that is 0.25pt thick). How can this be accomplished?

Please let me know if there is anything I can clarify. Thank you very much in advance to anyone kind enough to consider my question.

I hope you all have a happy and healthy 2024!


*Specifically, the Overleaf template, with frames replaced and with minor modifications in the first line of the MWE code and in the "My Mods" section of the preamble.


Minimum Working Example (MWE)

\documentclass[12pt,aspectratio=169,xcolor={svgnames, dvipsnames}]{beamer}

\usetheme[progressbar=frametitle]{metropolis}
\usepackage{appendixnumberbeamer}

\usepackage{booktabs}
\usepackage[scale=2]{ccicons}

\usepackage{pgfplots}
\usepgfplotslibrary{dateplot}

\usepackage{xspace}
\newcommand{\themename}{\textbf{\textsc{metropolis}}\xspace}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% My Mods
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\makeatletter
\setlength{\metropolis@titleseparator@linewidth}{2pt}
\setlength{\metropolis@progressonsectionpage@linewidth}{2pt}
\setlength{\metropolis@progressinheadfoot@linewidth}{2pt}
\makeatother
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



\title{Metropolis -- Modified}
\subtitle{A modern beamer theme}
% \date{\today}
\date{}
\author{Matthias Vogelgesang}
\institute{Center for modern beamer themes}
% \titlegraphic{\hfill\includegraphics[height=1.5cm]{logo.pdf}}


\begin{document}

\maketitle

\begin{frame}{First Frame}
    blah blah blah?
    \begin{itemize}
        \item blah blah blah.
        \item blah blah.
        \item yadda yadda yadda.
    \end{itemize}
\end{frame}

\begin{frame}{Second Frame}
    blah blah!
    \begin{enumerate}
        \item blah blah blah.
        \item blah blah.
        \item blah blah bah.
    \end{enumerate}
\end{frame}

\end{document}


1 Answer 1

2

The progress bar styling is defined using TikZ in the beamer templates progress bar in section page and progress bar in head/foot. The definitions of these templates are available in the metropolis documentation. By copy-pasting those definitions into your MWE and modifying the TikZ code, I was able to get a very simple border around the progress bar (2pt thickness for ease of visibility):

\documentclass[12pt,aspectratio=169,xcolor={svgnames, dvipsnames}]{beamer}

\usetheme[progressbar=frametitle]{metropolis}
\usepackage{appendixnumberbeamer}

\usepackage{booktabs}
\usepackage[scale=2]{ccicons}

\usepackage{pgfplots}
\usepgfplotslibrary{dateplot}

\usepackage{xspace}
\newcommand{\themename}{\textbf{\textsc{metropolis}}\xspace}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% My Mods
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\makeatletter
\setlength{\metropolis@titleseparator@linewidth}{2pt}
\setlength{\metropolis@progressonsectionpage@linewidth}{2pt}
\setlength{\metropolis@progressinheadfoot@linewidth}{2pt}

% Redefine `progress bar in head/foot` to add border
\newlength{\metropolis@progressinheadfoot@borderwidth}
\setlength{\metropolis@progressinheadfoot@borderwidth}{2pt}
\setbeamertemplate{progress bar in head/foot}{
  \nointerlineskip
  \setlength{\metropolis@progressinheadfoot}{%
    \paperwidth * \ratio{\insertframenumber pt}{\inserttotalframenumber pt}%
  }%
  \begin{beamercolorbox}[wd=\paperwidth]{progress bar in head/foot}
  \begin{tikzpicture}
    % Add blue progress bar border
    \fill[blue] (0,-\metropolis@progressinheadfoot@borderwidth) rectangle (\paperwidth, \metropolis@progressinheadfoot@linewidth+\metropolis@progressinheadfoot@borderwidth);
    \fill[bg] (\metropolis@progressinheadfoot@borderwidth,0) rectangle (\paperwidth-\metropolis@progressinheadfoot@borderwidth, \metropolis@progressinheadfoot@linewidth);
    \fill[fg] (\metropolis@progressinheadfoot@borderwidth,0) rectangle (\metropolis@progressinheadfoot-\metropolis@progressinheadfoot@borderwidth, \metropolis@progressinheadfoot@linewidth);
  \end{tikzpicture}%
  \end{beamercolorbox}
}

% Redefine `progress bar in section page` to add border
\newlength{\metropolis@progressonsectionpage@borderwidth}
\setlength{\metropolis@progressonsectionpage@borderwidth}{2pt}
\setbeamertemplate{progress bar in section page}{
  \setlength{\metropolis@progressonsectionpage}{%
    \textwidth * \ratio{\insertframenumber pt}{\inserttotalframenumber pt}%
  }%
  \begin{tikzpicture}
    % Add blue progress bar border
    \fill[blue] (0,-\metropolis@progressonsectionpage@borderwidth) rectangle (\textwidth, \metropolis@progressonsectionpage@linewidth+\metropolis@progressonsectionpage@borderwidth);
    \fill[bg] (\metropolis@progressonsectionpage@borderwidth,0) rectangle (\textwidth-\metropolis@progressonsectionpage@borderwidth, \metropolis@progressonsectionpage@linewidth);
    \fill[fg] (\metropolis@progressonsectionpage@borderwidth,0) rectangle (\metropolis@progressonsectionpage-\metropolis@progressonsectionpage@borderwidth, \metropolis@progressonsectionpage@linewidth);
  \end{tikzpicture}%
}

\makeatother
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



\title{Metropolis -- Modified}
\subtitle{A modern beamer theme}
% \date{\today}
\date{}
\author{Matthias Vogelgesang}
\institute{Center for modern beamer themes}
% \titlegraphic{\hfill\includegraphics[height=1.5cm]{logo.pdf}}


\begin{document}

\maketitle

\begin{frame}{First Frame}
    blah blah blah?
    \begin{itemize}
        \item blah blah blah.
        \item blah blah.
        \item yadda yadda yadda.
    \end{itemize}
\end{frame}

\begin{frame}{Second Frame}
    blah blah!
    \begin{enumerate}
        \item blah blah blah.
        \item blah blah.
        \item blah blah bah.
    \end{enumerate}
\end{frame}

\section{Test section}

\begin{frame}{Third Frame}
    blah blah!
    \begin{enumerate}
        \item blah blah blah.
        \item blah blah.
        \item blah blah bah.
    \end{enumerate}
\end{frame}

\end{document}

Content frame of Metropolis beamer theme with 2pt blue border around the progress bar

Section frame of Metropolis beamer theme with 2pt blue border around the progress bar

1
  • Hello! First of all, thank you so much for helping, and apologies for the response. Secondly, I apologize, it seems that there is a detail I should have made more clear. I meant for a border on the progress bar itself (i.e. the orange bar in your screenshot) not the “container” of the progress bar. You have been so kind to me, but could you please show me how to implement what I just described? Commented Jan 8 at 23:48

You must log in to answer this question.

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