6

I'm trying to have a text with fixed position across two consecutive frames. When I try overprint, it works, but the frame number stays the same for the two frames. How can I have it incremented on the second frame?

Example of what I have:

\begin{frame}
Common text, that keeps its position in the two frames \\

\begin{overprint}

\onslide<1>
  First slide \\
  Frame - \insertframenumber{} of \inserttotalframenumber \\

\onslide<2>
  Second slide \\
  Frame - \insertframenumber{} of \inserttotalframenumber \\
  Some more text

\end{overprint}
\end{frame}

The first slide shows "Frame - 6 of 10" and the second one also shows "Frame - 6 of 10". I want it to show "Frame - 7 of 11". Is there a way I can manually increase the counters? Or is there a better way?

Thank you very much.

Raphael
  • 564
  • You could show the page number instead of the frame number. However, this would increment with every overlay. – erik Sep 16 '16 at 15:26
  • Quick hack: \only<2>{\addtocounter{framenumber}{1}}, but in the long run, it seems you don't want the framenumber to be shown, but the pagenumber. – samcarter_is_at_topanswers.xyz Sep 16 '16 at 15:26
  • Yeah, the problem with page number is that it would increment every time I use \pause. I just found a good solution for my specific case by using vbox. I posted the code as an answer. Thanks, guys! – Raphael Sep 16 '16 at 15:57

3 Answers3

6

You can trick beamer into increasing the framenumber in between the overlays.

\documentclass{beamer}

\begin{document}

\begin{frame}
Common text, that keeps its position in the two frames \\

\begin{overprint}

\onslide<1>
  First slide \\
  Frame - \insertframenumber{} of \inserttotalframenumber \\

\only<2>{\addtocounter{framenumber}{1}}

\onslide<2>
  Second slide \\
  Frame - \insertframenumber{} of \inserttotalframenumber \\
  Some more text

\end{overprint}
\end{frame}


\end{document}

enter image description here

5

Technically you're on the same frame, but a different slide. For this you should either separate the content on different frames making space or using boxes/\phantoms to replicate the overprint area:

\documentclass{beamer}

\let\Tiny\tiny% http://tex.stackexchange.com/a/94159/5764

\begin{document}

\begin{frame}
Common text, that keeps its position in the two frames

First slide \\
Frame - \insertframenumber{} of \inserttotalframenumber \\
\phantom{Some more text}

\end{frame}

\begin{frame}
Common text, that keeps its position in the two frames

Second slide \\
Frame - \insertframenumber{} of \inserttotalframenumber \\
Some more text

\end{frame}

\end{document}

Or, you can step the counter manually within the same frame:

\documentclass{beamer}

\let\Tiny\tiny% http://tex.stackexchange.com/a/94159/5764

\begin{document}

\begin{frame}
Common text, that keeps its position in the two frames

\begin{overprint}

\onslide<1>
  First slide \\
  Frame - \insertframenumber{} of \inserttotalframenumber \\

\only<2>{\stepcounter{framenumber}}

\onslide<2>
  Second slide \\
  Frame - \insertframenumber{} of \inserttotalframenumber \\
  Some more text

\end{overprint}
\end{frame}

\end{document}
Werner
  • 603,163
4

I just got a solution with vbox:

\begin{frame} %1
\vbox to 0.13\textheight{%
 Common text \\
 }

\vbox to 0.45\textheight{%
  First slide \\
  Frame - \insertframenumber{} of \inserttotalframenumber \\
}
\end{frame}


\begin{frame} %2
\vbox to 0.13\textheight{%
 Common text \\
 }

\vbox to 0.45\textheight{%
  Second slide \\
  Frame - \insertframenumber{} of \inserttotalframenumber \\
  Some more text
}
\end{frame}
Raphael
  • 564