5

Is there a quick way to access the relative slide number in Beamer? I'm trying to simplify the following syntax:

\documentclass{beamer}

\begin{document}
\begin{frame}
  $
   t = \only<1> 0
       \only<2> 1
       \only<3> 2
  $
\end{frame}
\end{document}
2
  • You might be interested in this tex.stackexchange.com/questions/154521/… In your case a simple + would do
    – bloodworks
    May 4, 2014 at 17:48
  • @bloodworks Yes, that would work, but it still has me repeating code. (Although it's certainly possible that such a counter is never kept.) May 4, 2014 at 17:53

1 Answer 1

5

The value is stored in \beamer@slideinframe; you can use this to define either a counter or a user command to have easy access to it (it was not clear to me what you wanted to do with the slide number in your example, so I use here another simple example):

\documentclass{beamer}

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

\begin{document}
\begin{frame}
\frametitle{Slide \arabic{slideinframe}}
\only<1>{A}
\only<2>{B}
\only<3>{C}
\end{frame}
\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .