3

Question: In my simplification why \pause command is not working actually i want to assign \pause command to every equation. please help me.

This is what i have

\documentclass[12pt,fleqn]{beamer}
\usepackage{xcolor}
\usetheme{AnnArbor}
\usecolortheme{beaver}
\usepackage{enumitem}
\usepackage{parskip}
\usefonttheme{professionalfonts} % using non standard fonts for beamer
\usefonttheme{serif} % default family is serif
\usepackage{setspace}
\addtobeamertemplate{frametitle}{}{\vspace{-0.4em}} % decrease
%make new line after item
\makeatother
%\title[ABC School]{\textbf{Example}}

%\author[ABC]{}
%\date[\today]{}
\begin{document}
\begin{frame}[t]
%\frametitle{Equations revealed step by step}
%\setbeamercovered{transparent}<<<<use to transparency of next steps
Simplification is given below\pause
\begin{align*}
(a+b)^2&=(a+b)(a+b)&\\
&=(a)(a)+(a)(b)+(b)(a)+(b)(b)&\\
&=a^2+ab+ba+b^2&\\
&=a^2+ab+ab+b^2&\\
&=a^2+2ab+b^2&
\end{align*}
\end{frame}
\end{document}
4

The beamer manual states on p. 24 that

Euclid finds that he can also add a \pause between the definition and the example. So, \pauses seem to transcend 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.

The wicked thing mentioned there is probably that align "executes" its contents twice. Recently F. Patigny introduced the command \WhenNotMeasuring in https://tex.stackexchange.com/a/548004 to solve related problems. All I did was to try out whether or not this happens to solve the problem here. At least in the following example this seems to be the case. All one has to do is to use \WhenNotMeasuring{\pause} instead of \pause in align environments.

\documentclass[12pt,fleqn]{beamer}
\usepackage{amsmath}
\usepackage{xparse}
\makeatletter% from https://tex.stackexchange.com/a/548004
\ExplSyntaxOn
\NewDocumentCommand\WhenNotMeasuring { } { \legacy_if:nF {measuring@} }
\ExplSyntaxOff
\makeatother
\begin{document}
\begin{frame}[t]
\frametitle{Test}
\begin{align*}
E &=mc^2\WhenNotMeasuring{\pause}\\
&=h\nu
\end{align*}
\end{frame}
\end{document}

enter image description here

Of course, if you find the @ scary enough, you can strip off the xparse and \ExplSyntaxOn/\ExplSyntaxOff part, but it is still F. Patigny's observation that is at work here. Since outside of align one is (hopefully) never measuring, one can just define a universal command, e.g. \Pause, for that.

\documentclass[12pt,fleqn]{beamer}
\usetheme{AnnArbor}
\usecolortheme{beaver}
\usefonttheme{professionalfonts} % using non standard fonts for beamer
\usefonttheme{serif} % default family is serif
\addtobeamertemplate{frametitle}{}{\vspace{-0.4em}} % decrease
\makeatletter
\newcommand{\Pause}[1][]{\unless\ifmeasuring@\relax
\pause[#1]%
\fi}
\makeatother

%\title[ABC School]{\textbf{Example}}

%\author[ABC]{}
%\date[\today]{}
\begin{document}
\begin{frame}[t]
\frametitle{Equations revealed step by step}
\setbeamercovered{transparent}
Simplification is given below\Pause
\begin{align*}
(a+b)^2&=(a+b)(a+b)\\ \Pause
&=(a)(a)+(a)(b)+(b)(a)+(b)(b)\\ \Pause
&=a^2+ab+ba+b^2\\ \Pause
&=a^2+ab+ab+b^2\\ \Pause
&=a^2+2ab+b^2
\end{align*}
\end{frame}
\end{document}

enter image description here

This seems to survive at least some simple tests. Wish I had known this trick some years back.

| improve this answer | |
  • 1
    Wonderful, great solution whichever I was looking. Thanks a lot for sharing nice information. – SDP Jun 17 at 9:03
  • 2
    @SDP Thanks! I also upvoted your post, and, as I said, I wish I had known this trick before I wrote literally 500 times equations with the workaround from the manual. – user194703 Jun 17 at 9:05

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.