2

I have a beamer doc in which there are a few section and subsection title slides. Those slides do not have a page number footer, and the footer page numbering do not take them into account.

In the example below, when I use label{page:mylabel} combined with {page:mylabel}, I get p5, however, mylabel is on p2 according to the footer page number.

How can I make {page:mylabel} reference the correct page number at the footer (in this case p2)?

\documentclass{beamer}
\usetheme{metropolis} % Use metropolis theme
\title{A minimal example}
\date{\today}
\author{Matthias Vogelgesang}
\institute{Centre for Modern Beamer Themes}
\begin{document}
    \maketitle
    \section{First Section}
    \begin{frame}{First Slide}
        Hello, world!
    \end{frame}
    \section{Second Section}
    \begin{frame}{Second Slide}
        Hello, world!
        \label{page:mylabel}
    \end{frame}
    \begin{frame}{Third Slide}
        A reference to p\pageref{page:mylabel}
    \end{frame}
\end{document}
  • As you can imagine, it is next-to-impossible to reproduce the issue without an explicit example. – marmot Feb 28 at 4:28
  • @marmot, sorry, my bad. A MWE is added to illustrate the problem – Skyork Feb 28 at 6:05
  • Thanks! Is it possible that you confuse page number with frame number (see e.g. tex.stackexchange.com/a/452863/121799 but there are most likely other threads on this). – marmot Feb 28 at 6:10
1

As @marmot already explained, \pageref won't give the same numbers as shown in the footline because there the framenumber is shown.

However beamer has an easy method to reference frames by their frame number: You just have to label the frame with \begin{frame}[label=mylabel] and then you can use \ref{mylabel} and get the correct frame number

\documentclass{beamer}
\usetheme{metropolis} % Use metropolis theme
\title{A minimal example}
\date{\today}
\author{Matthias Vogelgesang}
\institute{Centre for Modern Beamer Themes}
\begin{document}
    \maketitle
    \section{First Section}
    \begin{frame}{First Slide}
        Hello, world!
    \end{frame}
    \section{Second Section}
    \begin{frame}[label=mylabel]{Second Slide}
        Hello, world!
    \end{frame}
    \begin{frame}{Third Slide}
        A reference to p\ref{mylabel}
    \end{frame}
\end{document}

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.