2

For the following example, I need to use align environment and uncover/alert each equation. The conventional way is shown below

\documentclass{beamer}
\usepackage{amsmath,mathtools}

\begin{document}
\begin{frame}

\begin{align}
    \uncover<1->{\alert<1>{X}   & \alert<1>{=Y} \\
                                & \alert<1>{=1} \\}
    %
    \uncover<2->{\alert<2>{A}   & \alert<2>{=B}}%
\end{align}
\end{frame}
\end{document}

enter image description here


enter image description here


However, it will be more cumbersome with long and additional equations.

So, is there any way to define a new align-like environment to put the code as in the conventional align environment and get the above result considering:

  1. the additional equation number (3) in the first slide does not show in the first slide
  2. equation number gets highlighted with its equation
7
  • 1
    tex.stackexchange.com/questions/60689/… is able to deal with the equation number Jun 24 '16 at 15:09
  • Many thanks for pointing to this answer. Additionally, do you have any idea how to piecewise alert each uncovered line instead of my manual approach?
    – Diaa
    Jun 24 '16 at 17:21
  • 1
    Unfortunately not. But are you open for different ways to highlight the lines? I saw questions on this side about adding coloured backgrounds or frames to the line to be highlighted. Jun 24 '16 at 18:26
  • Thanks, I will consider looking at relevant questions. Do I need to delete my question since it may seem not to contribute that much?
    – Diaa
    Jun 24 '16 at 19:32
  • 1
    I do not see a need for deletion. Maybe someone knows some magic and is able to answer the question, or find a duplicate to close it. Jun 24 '16 at 20:54
2

According to the Beamer manual amsmath environments are problematic in terms of compatibility with overlay specifications because of the way they process their arguments internally. For example, the manual explains the incompatibility of \pause with the align environment on page 78 as follows.

This command does not work inside amsmath environments like align, since these do really wicked things.

Hence, Beamer's own varieties of evil trickery cannot be accommodated in standard (or convenient) fashion in such cases.

The solution for the equation tags is, however, provided later in the manual. This does not succeed in highlighting the tags, but it does at least get the correct tags onto the correct slides. The solution requires the addition of an empty line within align, combined with \notag, and a compensating negative skip.

\documentclass{beamer}
\usepackage{mathtools}
\begin{document}
\begin{frame}
  \begin{align}% based on solution on page 217 of the Beamer manual
    \alert<1>{X}   & \alert<1>{=Y} \\
    & \alert<1>{=1} \\
    \uncover<+(1)->{\alert{A}   & \alert{=B}\\}
    \notag
  \end{align}
  \vskip-1.5em
\end{frame}
\end{document}

tags to slides

It is always wise to consult the documentation, especially if the problem is likely to be a relatively common one, such as attempting to use amsmath environments with Beamer overlay specifications. It would be astonishing if Beamer's manual didn't have anything to say about this, even if it is just that amsmath is really wicked!

[It is sorely tempting at this point to mention the pot calling the kettle black, but no doubt wickedness is very much in the eye of the coder in such cases.]

1
  • Thanks for comprehensively explaining it and giving a highly infromative answer.
    – Diaa
    Aug 5 '16 at 13:44

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.