0

The beamer theme metropolis includes an option to show frame numbers as a fraction of total frames. But it does not add a vertical strut for the eventuality that someone (me!!) would add additional text to the frame footer template. When comparing the numbered slides in the main document and the unnumbered in the appendix, then this causes the additional text to jump annoyingly. The jump is even more pronounced when I build the MWE with pdfLaTeX instead of with XeLaTeX as in the screenshot.

How would I go about to add the needed vertical strut to prevent the jumping? I know that I could add \setbeamertemplate{frame numbering}{\vphantom{/}} after \appendix, but I would really prefer to include the fix in the preamble rather than adding things in the document environment.

\documentclass{beamer}
\usetheme{metropolis}
\metroset{numbering=fraction}
\begin{document}
  {
    \setbeamertemplate{frame footer}{Some random text}
    \begin{frame}[label=slide1]{Slide 1}
    \end{frame}
  }

  \appendix

  {
    \setbeamertemplate{frame footer}{Some random text}
    \begin{frame}[label=slide2]{Slide 2}
    \end{frame}
  }
\end{document}

Animated MWE to emphasize the jumping footer text

1 Answer 1

2

This solution will remove the observed jump in the text, even when descenders are present.

LuaLateX using the Fira fonts

xl

pdfLaTex using cm fonts

pl

\documentclass{beamer}
\usetheme{metropolis}
\metroset{numbering=fraction}

\setbeamerfont{frame footer}{size=\scriptsize\strut,series=\normalfont} % added <<<<<<<<<<<

\begin{document}
    {%
        \setbeamertemplate{frame footer}{Some random text (1)}
        \begin{frame}[label=slide1]{Slide 1}
        \end{frame}
    }
    
    \appendix
    
    {%
        \setbeamertemplate{frame footer}{Some random text 2}
        \begin{frame}[label=slide2]{Slide 2}
        \end{frame}
    }

\end{document}
2
  • Is the strut computed using \normalsize when \strut precedes \scriptsize?
    – Fredrik P
    Jul 1, 2021 at 20:42
  • 1
    @Fredrik P In the general case you are right. The right way is to use <fontsize>\strut. I updated the answer. In this case, when \strut precedes fontsize it happens to be generated for scriptsize, like the page number. The main point is to insert the same vertical space with depth, in the non apendix frames and in the appendix frames to eliminante their respective disalignment when the text lacks descenders. Notice how both texts move up, through a different distance to line up. Jul 1, 2021 at 22:06

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.