4

Question: I have an example of maths. My question is how can i display step by step solution in presentation i mean i would like to add animation effect.

MWE:

\documentclass[12pt]{beamer}
\usepackage{xcolor}
\usetheme{AnnArbor}
\usecolortheme{beaver}
\usepackage{enumitem}
\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 University]{\textbf{Example}}

\author[Prof. xyz]{}
\date[\today]{}
\begin{document}
\begin{frame}[t]{}
%\setstretch{2.5}
\begin{align*}
x^2 -2x-15 &=0&\\[8pt]
x^2-5x+3x-15&=0&\\[8pt]
x(x-5)+3(x-5)&=0&\\[8pt]
(x-5)(x+3)&=0&
\end{align*}
\end{frame}
\end{document} 
1

The amsmath environments like align do not work with \pause. But you do not need them here either, a simple array does the job. So all you need to do then is to add \pause wherever appropriate. (I also added fleqn because this looks IMHO cleaner.)

\documentclass[12pt,fleqn]{beamer}
\usepackage{xcolor}
\usetheme{AnnArbor}
\usecolortheme{beaver}
\usepackage{enumitem}
\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 University]{\textbf{Example}}

\author[Prof. xyz]{}
\date[\today]{}
\begin{document}
\begin{frame}[t]
\frametitle{Equations revealed step by step}
\[
\begin{array}{@{}r @{{}={}} l@{}} 
x^2 -2x-15 &0\pause\\[8pt]
x^2-5x+3x-15&0\pause\\[8pt]
x(x-5)+3(x-5)&0\pause\\[8pt]
(x-5)(x+3)&0
\end{array}
\]
\end{frame}
\end{document} 

enter image description here

An automatic animation can be obtained with \animate. The time the nth overlay is on display is set by \transduration<n>{...}, where ... is the time in seconds. This animation will play from overlay 2 on when viewed with Acrobat Reader in fullscreen mode.

\documentclass[12pt,fleqn]{beamer}
\usepackage{xcolor}
\usetheme{AnnArbor}
\usecolortheme{beaver}
\usepackage{enumitem}
\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 University]{\textbf{Example}}

\author[Prof. xyz]{}
\date[\today]{}
\begin{document}
\begin{frame}[t]
\frametitle{Equations revealed step by step}
\animate<2-5>
\transduration<2>{2}%
\transduration<3>{4}%
\transduration<4>{6}%
\[
\begin{array}{@{}r @{{}={}} l@{}} 
x^2 -2x-15 &0\pause\\[8pt]
x^2-5x+3x-15&0\pause\\[8pt]
x(x-5)+3(x-5)&0\pause\\[8pt]
(x-5)(x+3)&0
\end{array}
\]
\end{frame}
\end{document} 
| improve this answer | |
  • Great, once again you come forward for replying my question. Thanks a lot. – SDP Jun 1 at 4:08
  • Suppose I want to stop at any line for 2 or 3 minutes is it possible? – SDP Jun 1 at 4:09
  • 1
    @Maths4Sandy Ah, I thought this is a presentation in which you press a key when you want to see the next step. If you want to have an automatic animation, you could could use the \animate facility of beamer and use \transduration. I added an example. – user194703 Jun 1 at 4:21
  • 1
    @Maths4Sandy If you remove the \pause commands, there will be no steps. Is this what you are asking? – user194703 Jun 1 at 4:53
  • 1
    @Maths4Sandy This is how overlays on beamer work: technically these are several slides, however, when you present them, they look like an animation. You can use the animate package, where this is a bit hidden, but again it produces some pdf file for each step. – user194703 Jun 1 at 5:00

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.