We all use the \onslide
command inside the overprint
environment in beamer
. However, I find that assigning hard coded slide values, like \onslide<5>
in this environment is really cumbersome. This situation becomes difficult whenever we have to insert a new slide in the middle of twenty some overlay slides. We have to manually renumber every subsequent slide after a new slide is inserted. That is why, I tried to define a \nextslide
command in beamer
.
The idea is very simple, the \nextslide
command will increment a predefined counter and will use this value with the \onslide
command.
\documentclass{beamer}
\newcounter{slidecounter}
\setcounter{slidecounter}{0}
\def\nextslide{\addtocounter{slidecounter}{1}\onslide<\value{slidecounter}>}
\begin{document}
\begin{frame}{Title}
\begin{overprint}
\nextslide
On one
\nextslide
On two
\end{overprint}
\end{frame}
\end{document}
I understand that I still need to implement resetting the counter at the start of overprint
environment once I am successful with this part.
However, whenever I run the code with pdflatex
, it keeps on generating page after page, which I have to interrupt with Ctrl-C
.
[1{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}] [2] [3] [4] [5]
[6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20]
[21] [22] [23] [24] [25] [26] [27] [28] [29] [30] [31] [32] [33] [34]
[35] [36] [37] [38] [39] [40] [41] [42] [43] [44] [45] [46] [47] [48]
[49] [50] [51] [52] [53] [54] [55] [56] [57] [58] [59] [60] [61] [62]
[63] [64] [65] [66] [67] [68] [69] [70] [71] [72] [73] [74]^C !
Interruption. \pgfsysprotocol@literalbuffered …tocol@temp {{#1
\space }}\expandafter \pgf… l.20 \end{frame}
? x
The beamer
code is too myriad for me to find out where this infinite loop is happening.
Any suggestion will be appreciated.
Best Answer
That's what the
+
overlay specification is made for (cf. thebeamer
user guide, section 9.6.4):So your MWE can be solved with