3

I have the code below and at the last section the progress bar doesn't get completed and in the header the progress bar is too thin. How can I change those?

    \documentclass[10pt]{beamer}

    \usetheme[progressbar=frametitle]{metropolis}

    \usepackage[utf8]{inputenc}
    \usepackage[portuguese]{babel}
    \usepackage{appendixnumberbeamer}
    \usepackage{booktabs}
    \usepackage[scale=2]{ccicons}

    \title{Title}
    \subtitle{Subtitle}
    \date{\today}
    \author{Name}
    \institute{Institute}

    \begin{document}
    \maketitle

    \begin{frame}{Contents}
        \setbeamertemplate{section in toc}[sections numbered]
        \tableofcontents[hideallsubsections]
    \end{frame}

    \section{Introduction}
    \begin{frame}{Introduction}
            blablablablablablabla
    \end{frame}

    \end{document}

First:This is the last section and the progress bar isn't completed.

Second:We can barely see the progress bar in the header

This is the last section and the progress bar isn't completed We can barely see the progress bar in the header

User01
  • 169

1 Answers1

12

To adjust the width of the progress bar on normal frames, you can use

 \setlength{\metropolis@progressinheadfoot@linewidth}{3pt}

(similarly the width of the lines on the title and section pages can be modified).


The progress bar on the last section page is incomplete, because it does not visualize the progress in section but in page numbers, the same value which is also displayed by the progress bar on normal frames. You can change the definition to display the fraction of section number / total section number (however it might be confusing the audience if the meaning of the progress bar changes between normal frames and section pages....):

\documentclass[10pt]{beamer}

\usetheme[progressbar=frametitle]{metropolis}

\usepackage[utf8]{inputenc}
\usepackage[portuguese]{babel}
\usepackage{appendixnumberbeamer}
\usepackage{booktabs}
\usepackage[scale=2]{ccicons}

\title{Title}
\subtitle{Subtitle}
\date{\today}
\author{Name}
\institute{Institute}

\makeatletter
\setlength{\metropolis@progressinheadfoot@linewidth}{3pt}
\setlength{\metropolis@titleseparator@linewidth}{3pt}
\setlength{\metropolis@progressonsectionpage@linewidth}{3pt}

\setbeamertemplate{progress bar in section page}{
  \setlength{\metropolis@progressonsectionpage}{%
    \textwidth * \ratio{\thesection pt}{\totvalue{totalsection} pt}%
  }%
  \begin{tikzpicture}
    \fill[bg] (0,0) rectangle (\textwidth, \metropolis@progressonsectionpage@linewidth);
    \fill[fg] (0,0) rectangle (\metropolis@progressonsectionpage, \metropolis@progressonsectionpage@linewidth);
  \end{tikzpicture}%
}

\makeatother

\usepackage{totcount}

\newcounter{totalsection}
\regtotcounter{totalsection}

\AtBeginDocument{%
    \pretocmd{\section}{\refstepcounter{totalsection}}{\typeout{Yes, prepending was successful}}{\typeout{No, prepending was not it was successful}}%
}%

\begin{document}
\maketitle

\begin{frame}{Contents}
    \setbeamertemplate{section in toc}[sections numbered]
    \tableofcontents[hideallsubsections]
\end{frame}

\section{Introduction}
\begin{frame}{Introduction}
        blablablablablablabla
\end{frame}

\section{Introduction}
\begin{frame}{Introduction}
        blablablablablablabla
\end{frame}

\end{document}

enter image description here