4

How can one create a new environment eframe so that some element is added (the place can be hardcoded) on the last slide of the frame?

Suppose I have many frames with lots of \pauses:

\begin{frame}{Frame 1}
    one\pause two
\end{frame}

\begin{frame}{Frame 2}
    one\pause two\pause three
\end{frame}

Replacing frame by eframe I would like to end up with the following behaviour:

\begin{frame}{Frame 1{\onslide<3>{END}}}
    one\pause two
\end{frame}

\begin{frame}{Frame 2{\onslide<4>{END}}}
    one\pause two\pause three
\end{frame}

I don't want to hardcode this numbers 3 and 4 because if later I decide to add more pauses, I would have to change those numbers.

  • 1
    Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. – jub0bs Aug 25 '13 at 16:50
  • I'm sorry I didn't make my self clear enough earlier. Unfortunately I won't be here for the next hours to comment/accept possible solutions – Anonymous31415 Aug 25 '13 at 17:49
4

The eframe environment defined below works just like a normal frame but appends (END) on the last slide of that frame.

This solution rests on mainly two tricks:

  1. accessing the value of the beamerpauses counter (which, at a given point of a frame environment, contains the number of overlay specifications used so far in that frame) only at the very end of the environment, in order to get the total number of overlay specifications in that frame; and
  2. Joseph Wright's solution for programmatically changing the frame title mid frame.

You can easily redefined the eframe environment to suit your needs.

enter image description here

\documentclass{beamer}

\makeatletter
\newcommand*{\augmentframetitle}[1]
{%
    \expandafter\frametitle\expandafter%
    {\beamer@frametitle #1}%
}
\makeatother

\newenvironment{eframe}
{%
    \begin{frame}
}{%
    \augmentframetitle{\ \onslide<\value{beamerpauses}>{(END)}}         
    \end{frame}
}

\begin{document}
    \begin{eframe}
    \frametitle{My last topic}
        foo\\
        \pause
        bar
    \end{eframe}
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.