I would like to animate an equation in Beamer with the \alt
command. Unfortunately, there is some "movement" between the two equations. Consider the following example:
\documentclass{beamer}
\begin{document}
\begin{frame}<-2>{Example}
\[\alt<1>{\max}{\min}(1,2)=\alt<1>{2}{1}\]
\end{frame}
\end{document}
Then, my \max
and \min
commands have not the exact same length. Therefore, the sign =
for instance (but also the (1,2)
) moves between slides 1 and 2.
Is there a way to avoid this?
Best Answer
\minx
, a\min
that is right-aligned in a box of the width of\max
.\minxx
, a\min
that is\llap
ed at the end of a\hphantom{\max}
.With the
mathtools
package one can replace\llap
with\mathllap
and\makebox
with\mathmakebox
.Addition care is needed if
\max
/\min
is preceeded by any content as\hphantom
and\widthof
would hide this content from\max
and\min
.Code