Minimales Arbeitsbeispiel (MWE)

Minimales Arbeitsbeispiel (MWE)

Hallo zusammen und ein frohes neues Jahr!

Ich poste hier zum ersten Mal und habe nur eine kurze Frage, die ich nicht lösen kann. Ich habe ein MWE mit grundlegendem LaTeX-Beamer-Code unter Verwendung des Metropolis-Themas gepostet.* Ich möchte (global) einen Rahmen um den Fortschrittsbalken haben und die Farbe und Dicke des Rahmens angeben (sagen wir einen blauen Rahmen mit einer Dicke von 0,25 pt). Wie kann dies erreicht werden?

Bitte lassen Sie mich wissen, wenn ich etwas klären kann. Vielen Dank im Voraus an alle, die so freundlich sind, meine Frage zu berücksichtigen.

Ich wünsche Ihnen allen ein frohes und gesundes Jahr 2024!


*Insbesondere dieOverleaf-Vorlage, mit ersetzten Frames und mit geringfügigen Änderungen in der ersten Zeile des MWE-Codes und im Abschnitt „Meine Mods“ der Präambel.


Minimales Arbeitsbeispiel (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}


Antwort1

Das Styling des Fortschrittsbalkens wird mit TikZ in den Beamer-Vorlagen progress bar in section pageund definiert progress bar in head/foot. Die Definitionen dieser Vorlagen finden Sie immetropolisDokumentation. Indem ich diese Definitionen in Ihr MWE kopiert und eingefügt und den TikZ-Code geändert habe, konnte ich einen sehr einfachen Rahmen um den Fortschrittsbalken erstellen (2pt Dicke für bessere Sichtbarkeit):

\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}

Inhaltsrahmen des Metropolis-Beamer-Themas mit 2pt blauem Rand um den Fortschrittsbalken

Abschnittsrahmen des Metropolis-Beamer-Themas mit 2pt blauem Rand um den Fortschrittsbalken

verwandte Informationen