6

How does one uncover lines in a multi-line equation one by one? I have taken a careful look at the answers provided here. It hasn't solved my problem. For example, my equation is the following and I want to uncover the two lines one at a time. Any help would be greatly appreciated.

\documentclass{beamer}
\usepackage{amsmath, amsfonts, amssymb, cancel}
\begin{document}
\begin{frame}
\frametitle{Steady State Relationship between $O^m, O^a$}
\begin{equation}
\begin{split}
(\rho +\sigma\bar\omega^m)O^m&=O^a-\phi L^a-\phi L^r-\eta O^r\\
\frac{O^m}{O^a}&=\frac{1-\phi l^a-(\phi l^r+\eta) O^r/O^a}{\rho +\sigma\bar\omega^m}
\end{split}
\end{equation}
\end{frame}
\end{document}
David Carlisle
  • 757,742

2 Answers2

4

The following inserts the math content using \alt. \phantom is used to maintain the appropriate spacing on slides where the content is not needed. All of this is contained within a macro \disponslide{<overlay>}{<stuff>}, which prints <stuff> using the overlay specification <overlay>, and \phantom{<stuff>} outside of <overlay>:

enter image description here

\documentclass{beamer}% http://ctan.org/pkg/beamer
\let\Tiny\tiny% http://tex.stackexchange.com/q/58087/5764
\usepackage{amsmath}% http://ctan.org/pkg/amsmath
\newcommand{\disponslide}[2]{%
  \alt<#1>{#2}{\phantom{#2}}}
\begin{document}
\begin{frame}
  \frametitle{Steady State Relationship between $O^m, O^a$}
  \begin{align}
    (\rho +\sigma\bar\omega^m)O^m    &= O^a-\phi L^a-\phi L^r-\eta O^r \\
    \disponslide{2}{\frac{O^m}{O^a}} & \disponslide{2}{{}=\frac{1-\phi l^a-(\phi l^r+\eta) O^r/O^a}{\rho +\sigma\bar\omega^m}}\only<1>{\notag}
  \end{align}
\end{frame}
\end{document}

You have to split the overlay between the alignment positions &.

Moriambar
  • 11,466
Werner
  • 603,163
  • The equation number is wrong. If you add a numbered equation after the align environment (without overlays), you'll see the problem. – Leo Liu Sep 08 '14 at 14:17
  • @LeoLiu: Yes. Then one should use ...\only<1>{\notag\refstepcounter{equation}}. – Werner Sep 09 '14 at 04:33
0

The overlay specifications do not work inside amsmath environments, including split. Indeed the beamer documentation says:

\pause[⟨number ⟩] This command causes the text following it to be shown only from the next slide on, or, if the optional ⟨number⟩ is given, from the slide with the number ⟨number⟩. If the optional ⟨number⟩ is given, the counter beamerpauses is set to this number. This command uses the \onslide command, internally. This command does not work inside amsmath environments like align, since these do really wicked things.

Instead I suggest you display this as two separate equations - in the given example the alignment is not essential.

If such displays are necessary you could consider the equationarray environment from eqnarray:

\documentclass{beamer}

\usepackage{eqnarray,amsmath, amsfonts, amssymb, cancel}

\begin{document}

\begin{frame}
\frametitle{Steady State Relationship between $O^m, O^a$}
\begin{equationarray}{r@{}l}
    (\rho +\sigma\bar\omega^m)O^m&{}=O^a-\phi L^a-\phi L^r-\eta
    O^r\pause \\
    \frac{O^m}{O^a}&{}=\frac{1-\phi l^a-(\phi l^r+\eta) O^r/O^a}{\rho
    +\sigma\bar\omega^m}
  \end{equationarray}
\end{frame}

\end{document}

As you see, will have to take more care with spacing near alignment points. For example, writing &{}= instead of &=, above.

Sample output

Moriambar
  • 11,466
Andrew Swann
  • 95,762
  • That was just one equation for an example, there are others where alignment becomes essential to keep track of the steps involved. I was asking a more general question. So, your answer implies that I leave the amsmath option? And then use \uncover? – Rohit Azad Nov 06 '13 at 21:47