# Accessing the current frame number in beamer

I know how to manually reset the page counter using a fix value. In the MWE below this fix value 0. Now I wonder how to use a variable value like \framenumber - 1. In this question it was asked for the counter of the overlay with the solution \overlaynumber; but \framenumber is an "unidentified controll sequence". Reading this question I experimented with \beamer@slideinframe and \arabic{slideinframe} finding, that the latter will always give the same number, and does not increases when called later in the document.

\documentclass{beamer}
\usetheme{metropolis}

\begin{document}
\begin{frame}{Counter should be 1}
\end{frame}
\begin{frame}{Counter should again be 1}
\end{frame}
\begin{frame}{Counter should be 2}
\end{frame}
\begin{frame}{Counter should again be 2}
\end{frame}
\end{document}

• Are you looking for \addtocounter{framenumber}{-1}? Or if you want frames no not contribute to the framenumbering you could use noframenumbering as optional argument – user36296 Nov 15 '18 at 10:34
• I posted a few possible approaches – user36296 Nov 15 '18 at 12:12

3 different possibilities how not to increase the frame counter from one page to the next:

Excluding a frame from contributing to the frame counter

\documentclass{beamer}
\usetheme{metropolis}

\begin{document}
\begin{frame}{Counter should be 1}
\end{frame}

\end{frame}

\begin{frame}{Counter should be 2}
\end{frame}

\end{frame}

\end{document}


\documentclass{beamer}
\usetheme{metropolis}

\begin{document}
\begin{frame}{Counter should be 1}
\end{frame}

\begin{frame}{Counter should again be 1}
\end{frame}

\begin{frame}{Counter should be 2}
\end{frame}

\begin{frame}{Counter should again be 2}
\end{frame}

\end{document}


Not using different frames

\documentclass{beamer}
\usetheme{metropolis}

\begin{document}

\begin{frame}
\frametitle<1>{Counter should be 1}
\frametitle<2>{Counter should again be 1}
\only<1>{slide 1}
\only<2>{slide 2}
\end{frame}

\begin{frame}
\frametitle<1>{Counter should be 2}
\frametitle<2>{Counter should again be 2}
\only<1>{slide 1}
\only<2>{slide 2}
\end{frame}

\end{document}

• \addtocounter{framenumber}{-1} is different to what I expected, but it solved my issue. – Qaswed Nov 15 '18 at 13:29
• Albeit a long-term heavy beamer user, the noframenumbering option is new to me. Seems to be way more elegant than my current fiddling with framenumber. – Daniel Nov 15 '18 at 16:08
• @Daniel This option was there for a long time but just recently made it into the documentation :) – user36296 Nov 15 '18 at 16:11
• – user36296 Nov 15 '18 at 16:12
• Oh, it’s just two months old? I will forgive myself 🙂 – Daniel Nov 15 '18 at 18:42