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}
Sean Allred
  • 27,421
  • You might be interested in this http://tex.stackexchange.com/questions/154521/relative-overlay-specification-in-beamer?rq=1 In your case a simple + would do – bloodworks May 04 '14 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.) – Sean Allred May 04 '14 at 17:53

1 Answers1

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

Gonzalo Medina
  • 505,128