The following latex source generates two pdf pages. Page 1 has title "Exercise 1 I" and page 2 "Exercise 2 II".
\documentclass[t]{beamer}
\let\Tiny=\tiny
\newcounter{mycounter}
\setcounter{mycounter}{0}
\def\exercise{\refstepcounter{mycounter}Exercise \arabic{mycounter}}
\begin{document}
\begin{frame}[allowframebreaks]
\frametitle{\exercise} % this seems expanded in each frame
ABC
\framebreak
DEF
\end{frame}
\end{document}
The resulting page 1 is
Exercise 1 I
ABC
and page 2
Exercise 2 II % I want Exercise 1 II
DEF
I want "Exercise 1 II" on page 2 instead. One way is to delete \refstepcounter{mycounter}
from the \exercise
macro and to manually do \refstepcounter
outside. This is nuisance, and I would make mistakes. Would there be a better way?
\refstepcounter
command before\begin{frame}
, then it is executed only once.