5

Thanks to Change the page number of slides in notes when using | handout: command I can count the slides in a frame.

What I would also like is a counter for the total number of slides in a frame. Something like this:

\documentclass{beamer}

\makeatletter
\def\c@slideinframe{\beamer@slideinframe}
\makeatother

\begin{document}

\begin{frame}{Frame 1}
This is slide \arabic{slideinframe} of %here I'd like the total number of slides, 2 in this case
\pause
\end{frame}

\end{document}

Is it possible to have a counter for the total number of slides in a frame?

  • Note that @KevinC's trick requires two passes. – jub0bs Oct 13 '13 at 9:45
5

To calculate the total number of slides in each frame, you can use

\insertframeendpage - \insertframestartpage + 1

Full Code:

\documentclass{beamer}

\makeatletter
\def\c@slideinframe{\beamer@slideinframe}
\makeatother

\newcounter{totalslideinframe}

\begin{document}

\begin{frame}{Frame 1}

\setcounter{totalslideinframe}{\insertframeendpage}
\addtocounter{totalslideinframe}{-\insertframestartpage}
\addtocounter{totalslideinframe}{1}

This is slide \arabic{slideinframe} of \arabic{totalslideinframe}%here I'd like the total number of slides, 2 in this case
\pause
\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.