4

I am trying to apply a simple transition in beamer, after writing the operation without having to repeat the equation every time. I try the code :

\begin{frame}

\frametitle{Exemples} \begin{exampleblock}{2.1.2.Exemples} Effectuer les opérations suivantes: \begin{multicols}{2} % two columns \begin{itemize}[<+->]

\item<1-> $A = \underbrace{(15 - 7)\onslide<2>}- 6 + 3$
\item<2-> $A = \underbrace{8 - 6\onslide<3>} + 3 $
\item<3-> $A = \underbrace{2 + 3\onslide<4>} $ \item<4-> $A = 5 $

\columnbreak

\item<5-> $B =\underbrace{(9 + 13)\onslide<2->}- 7.2 - 1 $ \item<6-> $B = \underbrace{22 - 7.2} - 1 $
\item<7-> $B = \underbrace{14.8 - 1} $ \item<8-> $B = 13.8 $

\end{itemize} \end{multicols} \end{exampleblock} \end{frame}

I am trying to make the equations A and B appear at first, let the students have a time of reflection, then show the correction step by step, first by showing the underbrace beneath each operation, then transition to display the next line $ A = 8 - 6 + 3 $ ... so I use \only<1-> but its not working, I think its a basic question, Now I already inserted the transition between item correctly and I get the result:

enter image description here

I am just not familiar with this \onslide<2> action yet, please help fix this problem ,

thanks for the help !

2 Answers2

5

Here is a (somewhat lengthy) option that sequentially displays the elements with the appropriate \underbrace constructions frame-by-frame:

enter image description here

\documentclass{beamer}

\usetheme{Warsaw} \usepackage{multicol,mathtools,eqparbox}

% https://tex.stackexchange.com/a/34412/5764 \makeatletter \NewDocumentCommand{\eqmathbox}{o O{c} m}{% \IfValueTF{#1} {\def\eqmathbox@##1##2{\eqmakebox[#1][#2]{$##1##2$}}} {\def\eqmathbox@##1##2{\eqmakebox{$##1##2$}}} \mathpalette\eqmathbox@{#3} } \makeatother

\begin{document}

\begin{frame}

\frametitle{Exemples}

\begin{exampleblock}{2.1.2.Exemples} Effectuer les opérations suivantes: \begin{multicols}{2} % two columns \begin{itemize}[<+->]

    \item $A = \alt&lt;2-&gt;
      {\eqmathbox[A1]{\underbrace{(15 - 7)}}}% Slide 2+
      {\eqmathbox[A1]{\vphantom{\underbrace{(15 - 7)}}(15 - 7)}}% Slide 2 only
      - 6 + 3$
    \item $A = \alt&lt;3-&gt;
      {\eqmathbox[A2]{\underbrace{\eqmathbox[A1]{8} - 6}}}% Slide 3+
      {\eqmathbox[A2]{\vphantom{\underbrace{\eqmathbox[A1]{8} - 6}}\eqmathbox[A1]{8} - 6}}% Slide 3 only
      + 3$
    \item $A = \alt&lt;4-&gt;
      {\eqmathbox[A3]{\underbrace{\eqmathbox[A2]{2} + 3}}}% Slide 4+
      {\eqmathbox[A3]{\vphantom{\underbrace{\eqmathbox[A2]{2} + 3}}\eqmathbox[A2]{2} + 3}}% Slide 4 only
      $
    \item $A = \eqmathbox[A3]{5}$

    \columnbreak

    \item $B = \alt&lt;6-&gt;
      {\eqmathbox[B1]{\underbrace{(9 + 13)}}}% Slide 6+
      {\eqmathbox[B1]{\vphantom{\underbrace{(9 + 13)}}(9 + 13)}}% Slide 6 only
      - 7.2 - 1$
    \item $B = \alt&lt;7-&gt;
      {\eqmathbox[B2]{\underbrace{\eqmathbox[B1]{22} - 7.2}}}% Slide 7+
      {\eqmathbox[B2]{\vphantom{\underbrace{\eqmathbox[B1]{22} - 7.2}}\eqmathbox[B1]{22} - 7.2}}% Slide 7 only
      - 1$
    \item $B = \alt&lt;8-&gt;
      {\eqmathbox[B3]{\underbrace{\eqmathbox[B2]{14.8} - 1}}}% Slide 8+
      {\eqmathbox[B3]{\vphantom{\underbrace{\eqmathbox[B2]{14.8} - 1}}\eqmathbox[B2]{14.8} - 1}}% Slide 8 only
      $
    \item $B = \eqmathbox[B3]{13.8}$

  \end{itemize}
\end{multicols}

\end{exampleblock} \end{frame}

\end{document}

I'm using boxes captured through eqparbox for measuring equally-sized areas, any change in the maximum width of <stuff> by <tag> in \eqmathbox[<tag>][<align>]{<stuff>} will require a re-compilation.

Werner
  • 603,163
  • THANKS A LOT MAN, I wasted all day trying to find a fix with \onslide but it seems \alt is the way to go – user2161721 Aug 02 '21 at 22:10
  • 1
    @user2161721: \alt<os>{<default>}{<other>} prints <default> on <os> and <other> otherwise. – Werner Aug 03 '21 at 03:28
  • indeed, bc I really didn't grasp the principle behind eqparbox, I am having trouble recompiling this one 25+3.5 \times 4 using the same structure, can you endolge me on this one too please – user2161721 Aug 03 '21 at 12:01
0

I FOUND THE ANSWER HERE, link

\documentclass{beamer}
\setbeamercovered{transparent}
\begin{document}
\begin{frame}
\begin{displaymath}
    \onslide<2-> \underbrace{ \onslide<1->
    foo
    \onslide<2-> }_{bar} \onslide<1->
    \text{some more stuff for slide 1}
    \end{displaymath}
  \end{frame}
 \end{document}

its the smartest way to encircle the display the under brace separately