39

I have the following code, (edit:) now without aligned.

\documentclass{beamer}
\mode<presentation> { \setbeamercovered{transparent} }

\begin{document}
\begin{frame}
\[
  \begin{cases}
  %\begin{aligned}
  v(t,x) &= g(t,x), \\
  \pause
  u(x) &= f(x) %& (x\in\mathbb R)
  %\end{aligned}
  \end{cases}
\]
\end{frame}
\end{document}

(In the first version of the question, nothing was commented out.)

It compiles nicely, but everything except "u(x)" already shows up on the first slide if I use beamer.cls v 1.70 2007/03/11 18:50:44. On another computer at work we have an older version installed, namely v 1.55 2004/10/11 16:09:50; there everything works as expected: On the first slide, the full second line is shown in transparent style.

The same happens if I use plain TeX's \halign, so cases is not the culprit. Moreover, if I don't use \setbeamercovered{transparent}, then everything works as expected. In other words, \pause doesn't work together with \setbeamercovered{transparent} and \halign.

Is this a bug in beamer introduced between versions 1.55 and 1.70? (If yes, then I'm surprised since it'd regard it quite a serious one.) Does anyone know a workaround that doesn't involve as much markup as Matthew's answer to my original question?

6
  • This is true with v3.10, but I wonder if it might also be an AMS thing. Perhaps do \listfiles on both systems and report any other differences in addition to beamer. (Also, this might be best as a bug report for beamer.)
    – Joseph Wright
    Commented Dec 1, 2010 at 18:05
  • @Joseph: Puh, reporting any other differences means a long list, but the only AMS differences are in amssymb and amsfonts. Commented Dec 1, 2010 at 19:45
  • 1
    @Joseph: I finally found the "culprit": It's pdftex.def. On my old installation I have the version 2002/06/19 v0.03k, and with this it works as expected! I haven't yet the slightest clue why this is so. Commented Sep 13, 2012 at 19:26
  • @Joseph: (I should have listened to you earlier!! By the way, even though align does wicked things, \pause works amazingly well inside align with my old pdftex.def. Do you know by any chance where I can find all the other old versions? So that I can look for the last "working" version?) Commented Sep 13, 2012 at 20:02
  • I'd use the TeX Live SVN for this: tug.org/svn/texlive/trunk/Master
    – Joseph Wright
    Commented Sep 13, 2012 at 20:06

5 Answers 5

38

From the beamer manual, in the middle of a use case:

Euclid finds that he can also add a \pause between the definition and the example. So, \pauses seem to transcede environments, which Euclid finds quite useful. After some experimentation he finds that \pause only does not work in align environments. He immediately writes an email about this to beamer’s author, but receives a polite answer stating that the implementation of align does wicked things and there is no fix for this. Also, Euclid is pointed to the last part of the user’s guide, where a workaround is described. (emphasis added)

Here is my workaround, using \action:

\documentclass{beamer}
\mode<presentation> { \setbeamercovered{transparent} }

\begin{document}
\begin{frame}
\[
  \begin{cases}
  \begin{aligned}
  \action<+->{v(t,x) &= g(t,x), \\}
  \action<+->{u(x)} &\action<.->{=f(x)} & \action<.->{(x\in\mathbb R)}
  \end{aligned}
  \end{cases}
\]
\end{frame}
\end{document}

It's surprising that the second line has to have each cell of the align enclosed in an action specification while the first line can go in a single one (maybe that has something to do with the fact that it's shown by default on all slides). But I remember Till's advice to Euclid:

align does wicked things and there is no fix for this.

Added: \action is a generic \only if I recall correctly. And the incremental overlay specifications like <+-> are very much worth learning. See Section 8 of the beamer manual, or at least it's Section 8 of my 3.06 manual: "Creating Overlays."

6
  • Ah yes: now I remember reading this :-)
    – Joseph Wright
    Commented Dec 1, 2010 at 19:16
  • Tsk, tsk: you forgot to indent all your code. More seriously, I must look up \action; I've no idea what that does. Commented Dec 1, 2010 at 19:20
  • Thanks for telling me about \action. I'll try it tomorrow. However, I do know a fix for the wicked things: Use the old installation. Not quite satisfactory, obviously. Commented Dec 1, 2010 at 19:47
  • Well, it works, thanks. But for the moment I'll stay with the old installation since it's too many \action s to type, and the code won't be as clear any more. Perhaps you know a less wicked replacement for aligned? Commented Dec 2, 2010 at 13:15
  • 1
    There is a fix for this! Commented Oct 6, 2012 at 16:42
18

Finally I followed Joseph's advice, and in the end found an easy fix for my problem: redefine \beamerorig@set@color and \beamerorig@reset@color to what they were before 2007. With the code below, the \pauses work exactly like expected:

animated output of 1 frame with 3 overlays

I also tested this with two sets of real-world slides, and encountered no unwanted side effects.

\documentclass{beamer}
\mode<presentation> { \setbeamercovered{transparent} }
\setbeamertemplate{navigation symbols}{}
\makeatletter
\def\beamerorig@set@color{%
  \pdfliteral{\current@color}%
  \aftergroup\reset@color
}
\def\beamerorig@reset@color{\pdfliteral{\current@color}}
\makeatother
\begin{document}
\begin{frame}
\[
  \begin{cases}
  \begin{aligned}
  v(t,x)&= g(t,x), \\ \pause
   u(x) &= f(x) & \pause
           (x\in\mathbb R)
  \end{aligned}
  \end{cases}
\]
\end{frame}
\end{document}

So it might well be that "align does wicked things" (see Matthew's answer), but before 2007, this was not relevant if \setbeamercovered{transparent} was used, so for me, \pause worked amazingly well within align. (A fix for the case that \setbeamercovered{transparent} is not used can be found in this answer of mine.)

And what happened in 2007? Version 0.04a of pdftex.def was released, with support of color stacks. For this, new definitions of \set@color and \reset@color were used; these are what \beamerorig@set@color and \beamerorig@reset@color are \let to in beamerbasecolor.sty. And it appears that this color stack version doesn't work properly in align and friends. In the code above, I used the definitions of \set@color and \reset@color form version 0.03t of pdftex.def.

2
  • Just wanted to say that this worked flawlessly. Thank you very much.
    – Wheepy
    Commented Sep 25, 2018 at 8:28
  • Worked very well with \pause and \uncover. However, the answer by Matthew didn't worked for me.
    – Kazh
    Commented Jun 19, 2023 at 16:41
10

If you don't mind using eqnarray in place of align, then you can get the pauses to work. At least that is my experience.

5
  • Welcome to TeX.sx! Feel free to visit our TeX.SX starter guide to get the most out of our site. Commented May 16, 2013 at 21:50
  • Sorry to ask, but did you test your answer? I get the same problem with eqnarray. Moreover, note that I don't use align at all, only cases. Commented May 17, 2013 at 6:09
  • 5
    Switching to eqnarray* worked for me. Commented May 7, 2014 at 7:59
  • @AmritanshuPrasad - Thanks, that helped. Although eqnarray defaults to center rather than left alignment. One can use equation environment along with left aligned. A minimal example is \begin{equation*} \left.\begin{aligned} 2 + 3 = 5 \pause \end{aligned} \right. \end{equation*}
    – User3568
    Commented Aug 27, 2019 at 11:25
  • 2
    @User3568 Try using eqnarray with an extra ampersand, like: "a&=& b+1\\c&=&d+1". The first column is right-aligned, the second is centred, and the third is left-aligned. Commented Aug 31, 2019 at 6:24
7

(Posting this as a separate answer since I seriously propose the code here as a bug fix for beamer, or maybe even better for pgfsys-pdftex.def.)

In the end I found out the real cause of my trouble: beamerbasecolor.sty redefines the \reset@color command, and the redefinition contains the line

\pgfsys@color@unstacked{beamer@tempcolor}%

The pgf manual explains:

\pgfsys@color@unstacked{<LATEX color>}
This slightly obscure command causes the color stack to be tricked. When called, this command should set the current color to <LATEX color> without causing any change in the color stack.

The command \pgfsys@color@unstacked is defined in pgfsys.code.tex as

\def\pgfsys@color@unstacked#1{}

so usually it does nothing! However, if the dvips driver is used, then pgfsys-dvips.def is loaded, which contains the line

\def\pgfsys@color@unstacked#1{\special{ps: \XC@usecolor{#1}}}

There is no such line in pgfsys-pdftex.def, i.e., the command really does nothing if the document is compiled with pdflatex. (And this was quite alright with pdftex.def up to version 0.03t.)

Now the interesting thing is: if you compile the code from the question with latex -> dvips, then the output is just as one would expect! Thus, the solution is to also give a proper definition of \pgfsys@color@unstacked for the case that the pdftex driver is used. This definition should then go to pgfsys-pdftex.def. Here's a quick fix that defines the command in the preamble if needed:

animated output of 1 frame with 3 overlays

\documentclass{beamer}
\mode<presentation> { \setbeamercovered{transparent} }
\makeatletter
\def\pdftex@driver{pdftex.def}
\ifx\Gin@driver\pdftex@driver
  \def\pgfsys@color@unstacked#1{%
    \pdfliteral{\csname\string\color@#1\endcsname}%
  }
\fi
\makeatother
\begin{document}
\begin{frame}
\[
  \begin{cases}
  \begin{aligned}
  v(t,x)&= g(t,x), \\ \pause
   u(x) &= f(x) & \pause
           (x\in\mathbb R)
  \end{aligned}
  \end{cases}
\]
\end{frame}
\end{document}
7
  • Please report to the pgf people: beamer just uses the code from this 'layer', and I am very reluctant to start patching other peoples stuff unless really necessary.
    – Joseph Wright
    Commented Sep 20, 2012 at 13:51
  • @Joseph: I'll do that. (I'll just ping Christian Feuersänger here.) Commented Sep 20, 2012 at 13:56
  • @Hendrik: Excellent analysis. I agree that it sounds like a good patch for the driver. But I honestly can't judge about the risk of that change... could you post it on the pgf mailing list? lists.sourceforge.net/lists/listinfo/pgf-users Commented Sep 20, 2012 at 19:42
  • @Christian: Thanks! The risk should be 0: I did a grep in my root tex directory, and \pgfsys@color@unstacked is only ever used in beamerbasecolor.sty. About posting this on the pgf mailing list: Could you please do that for me? Commented Sep 20, 2012 at 20:28
  • @Christian: Thanks a lot for posting the possible patch. Commented Sep 23, 2012 at 8:40
3

(Resurrecting the question because I had the same issue.) Simply replacing \pause inside AMS environments by an incremental overlay specification \uncover<+(1)->{...} works nicely:

\begin{frame}{Title}
  Stuff.\pause
  \[
    \begin{cases}
    \begin{aligned}
      v(t,x) &= g(t,x), \\
      \uncover<+(1)->{
        u(x) &= f(x) \quad (x\in\mathbb R)
      }
    \end{aligned}
    \end{cases}
  \]
  \pause
  More stuff.
\end{frame}
1
  • With align this is the only solution which works for me consistently. Thx. Commented Jun 7 at 17:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .