TransWikia.com

Beamer boxing a formula after a pause

TeX - LaTeX Asked by user268193 on December 28, 2020

I am doing a presentation with Beamer and I need help with the use of only<.> and boxed{}.

I would like to get the following effect:

  1. a=b+c

  2. a=b+c

    c=d

  3. a=b+d

    c=d

  4. a=b+boxed{d}

    c=d

I used the following code but I don’t like the effect because when it put the box around d it moves also "c=d". Could someone help me to find a different code?

begin{align*}
a=b+only<1-2>c
only<3>{d}
only<4>{boxed{d}}
end{align*}
pause
c=d

So I would like to get the "d boxed" after that "a=b+d" appears without moving "c=d".

Could someone help me?

One Answer

First: you don't use align properly. You have to write "c=d" inside the environementalign, and "glue" the two equations with an &.

Second: you have to precisely align "d" correspondig to the differences between the width of d and boxed{d}.

There are two solutions (assuming that the frame is center-aligned); both of the should work, but shomehow the second is better.

documentclass{beamer}

% For both solutions
usepackage{calc}

% Just for the second solution
newlength{firslength}
settowidth{firslength}{boxed{d}}
newlength{secondlength}
settowidth{secondlength}{d}

begin{document}

begin{frame}

% First solution
begin{align*}
a=&b+only<1-2>{hspace*{(widthof{boxed{d}}-widthof{d})/2}chspace*{(widthof{boxed{d}}-widthof{d})/2}}%
only<3>{hspace*{(widthof{boxed{d}}-widthof{d})/2}dhspace*{(widthof{boxed{d}}-widthof{d})/2}}%
only<4>{boxed{d}}%
uncover<2->{c=&d}%
end{align*}

% Second solution
begin{align*}
a=&b+only<1-2>{hspace*{dimexpr(firslength-secondlength)/2}chspace{dimexpr(firslength-secondlength)/2}}%
only<3>{hspace*{dimexpr(firslength-secondlength)/2}dhspace{dimexpr(firslength-secondlength)/2}}%
only<4>{boxed{d}}%
uncover<2->{c=&d}%
end{align*}

end{frame}

end{document}

enter image description here

Answered by Tom Solid on December 28, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP