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

  • 1
    What do you mean with too thin? Can you show a screenshot? – samcarter_is_at_topanswers.xyz May 15 '17 at 9:18
  • It is not too visible. Just added the screenshots – User01 May 15 '17 at 13:37
10

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

| improve this answer | |
  • You really took it to heart to turn the "not too visible" into a clear "too visible", there :D thanks, I really can use that answer! – thymaro Mar 21 '18 at 9:16
  • @thymaro :) ___ – samcarter_is_at_topanswers.xyz Mar 21 '18 at 10:01
  • How to change only the section page background? – John Pirata Aug 4 at 17:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.