1

I created a Beamer presentation that has 15 frames of content and 5 frames of references. I also enabled the progress bar, which indicates how far along I am through my presentation. However, the progress is calculated based on the total 20 frames of my presentation. Thus, when I'm on my last slide, it says that I'm only 3/4 into the presentation.

Is there a way to indicate which is the last slide of content, so that no frames beyond the point are counted toward my progress? I would rather not use the \appendix command for two reasons: (1) I already have appendix slides included in my presentation, and (2) I would like for the page count to continue unchanged throughout the bibliography. I've looked for an answer online, but I haven't come across anything that addresses my concern.

FYI, I'm using the biblatex package for my bibliography and the command \printbibliography.

MWE below:

\documentclass{beamer}

\usetheme{metropolis}

%make progress-bar thicker
\makeatletter
\setlength{\metropolis@progressonsectionpage@linewidth}{2.5pt}
\makeatother

\title{My title}
\author{Me}

\usepackage{lipsum}

% Set bibliography
\usepackage[style=authoryear]{biblatex}
\addbibresource{ref.bib}
\usepackage{filecontents}

% Add references
\begin{filecontents}{ref.bib}
    @book{key1,
        author = {Author, A.},
        year = {2001},
        title = {Title1},
        publisher = {Publisher},
    }
    @book{key2,
        author = {Author, B.},
        year = {2002},
        title = {Title2},
        publisher = {Publisher},
    }
\end{filecontents}

\begin{document}
    
    \maketitle
    
\section{First concept}
    
    \begin{frame}{First frame}
        \lipsum[1]
    \end{frame}
    
\section{First citation}

    \begin{frame}
        \frametitle{First citation}
        ``First quote.'' \cite{key1}
    \end{frame}
    
\section{Last citation}
    
    \begin{frame}{Last frame}
        ``Second quote.'' \cite{key2}
    \end{frame}
    
    
    \begin{frame}[t]{References}
        \printbibliography[heading=none]
    \end{frame}
    
\end{document}

Result of this code is shown below:

Image_1 Image_2 Image_3 Image_4 Image_5 Image_6 Image_7 Image_8

In general, I'd like for the progress-bar under 'First Concept' to be at zero, since we are about to get to the 'first frame'; I want the progress-bar under 'First citation' at 1/3 because 'First citation' is my second frame; and the progress-bar under 'Last citation' should be at 2/3, since 'Last frame' is the last content frame.

Nonetheless, the last section has a progress-bar at 1/2 because it's counting 'References' as a content frame and it takes up one quarter of my presentation.

@moewe, here's the error I receive

enter image description here

2
  • You have much better chance of getting a good answer if you can post a short example document/presentation that shows what you have so far. – moewe Jul 2 '20 at 18:14
  • If you put \appendix before your bibliography you can use the solution given here to exclude the appendix from the progress. – Alan Munn Jul 3 '20 at 2:48
1

You may want to try the following, which remembers the frame number of the bibliography and uses that (minus 1) instead of the total frame number to calculate the progress bar.

\documentclass{beamer}

\usetheme{metropolis}

\title{My title}
\author{Me}

\usepackage{lipsum}

\usepackage[style=authoryear]{biblatex}
\addbibresource{biblatex-examples.bib}

\makeatletter
\setlength{\metropolis@progressonsectionpage@linewidth}{2.5pt}

\newcommand*\beamer@startframeofbib{2}
\newcommand*\beamer@bibframes[1]{\gdef\beamer@startframeofbib{#1}}

\defbibheading{pagenumber}[\refname]{%
  \addtocontents{nav}{\protect\headcommand{\protect\beamer@bibframes{\the\c@framenumber}}}}

\setbeamertemplate{progress bar in section page}{%
  \setlength{\metropolis@progressonsectionpage}{%
    \textwidth * \ratio{\insertframenumber pt}{\the\numexpr\beamer@startframeofbib-1\relax 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



\begin{document}

    \maketitle

\section{First concept}

    \begin{frame}{First frame}
        \lipsum[1]
    \end{frame}

\section{First citation}

    \begin{frame}
        \frametitle{First citation}
        ``First quote.'' \cite{sigfridsson}
    \end{frame}

\section{Last citation}

    \begin{frame}{Last frame}
        ``Second quote.'' \cite{nussbaum}
    \end{frame}

    \appendix
    \begin{frame}[t]{References}
        \printbibliography[heading=pagenumber]
    \end{frame}

\end{document}

Progress bar on "Last Citation" slide 2/3 full

6
  • When I run your edits on my file, I get the following error: Package biblatex Error: Heading 'pagenumber' not found. \end{frame} – Ernesto Jul 3 '20 at 18:44
  • @Ernesto I get no such error from the MWE. Indeed the \defbibheading{pagenumber}... makes sure that the heading pagenumber is defined. Did you copy that bit into your document? You need everything between \makeatletter and \makeatother. – moewe Jul 3 '20 at 18:45
  • I did copy all of it. I also have another \makeatletter and \makeatother for a different feature. Could that be the problem? What would be the right way to have both chunks simultaneously? – Ernesto Jul 3 '20 at 18:53
  • @Ernesto No that shouldn't be a problem. I'm afraid I will have to see a small example document that reproduces the error even if the \makeatletter...\makeatother block is present. – moewe Jul 3 '20 at 18:59
  • I've added a screenshot of the error to my original post (see above). – Ernesto Jul 5 '20 at 22:18

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.