38

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?

Hendrik Vogt
  • 37,935
  • 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 Dec 01 '10 at 18:05
  • @Joseph: Puh, reporting any other differences means a long list, but the only AMS differences are in amssymb and amsfonts. – Hendrik Vogt Dec 01 '10 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. – Hendrik Vogt Sep 13 '12 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?) – Hendrik Vogt Sep 13 '12 at 20:02
  • I'd use the TeX Live SVN for this: http://tug.org/svn/texlive/trunk/Master/ – Joseph Wright Sep 13 '12 at 20:06
  • @Joseph: Thanks a lot! I was lucky: they only have the versions starting from 0.03r, and the last "working" version is 0.03t. From 0.04 I get the observed buggy behaviour. – Hendrik Vogt Sep 13 '12 at 20:24

5 Answers5

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."

Matthew Leingang
  • 44,937
  • 14
  • 131
  • 195
17

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.

Hendrik Vogt
  • 37,935
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.

Krishna
  • 101
  • Welcome to TeX.sx! Feel free to visit our TeX.SX starter guide to get the most out of our site. – Peter Jansson May 16 '13 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. – Hendrik Vogt May 17 '13 at 06:09
  • 5
    Switching to eqnarray* worked for me. – Amritanshu Prasad May 07 '14 at 07: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 Aug 27 '19 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. – Amritanshu Prasad Aug 31 '19 at 06: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}
Hendrik Vogt
  • 37,935
2

(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}
Mirlan
  • 171