Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Goodday, I am currently working on a presentation on the Calculus of Variations. In it I present a proof for the Euler equation. Currently I use the following Latex code:

\begin{frame}
\frametitle{Euler}
\framesubtitle{Bewijs}
\begin{align*}
0 = \frac{\partial \mathcal{F}}{\partial \alpha} &= \frac{\partial}{\partial \alpha} \int_{x_0}^{x_1}f\{y(\alpha,x),y'(\alpha,x);x\}dx\\
\only<4-8>{&=...\\}
\only<2-3>{&= \int_{x_0}^{x_1} \frac{\partial}{\partial \alpha} f\{y(\alpha,x),y'(\alpha,x);x\}dx\\}
\only<3-4>{&= \int_{x_0}^{x_1} \left(\frac{\partial f}{\partial y}\frac{\partial y}{\partial \alpha} + \frac{\partial f}{\partial y'}\frac{\partial y'}{\partial \alpha}\right)dx\\}
\only<4-5>{&= \int_{x_0}^{x_1} \frac{\partial f}{\partial y}\eta(x)dx + \int_{x_0}^{x_1}\frac{\partial f}{\partial y'}\eta'(x) dx\\}
\only<5-6>{&= \int_{x_0}^{x_1} \frac{\partial f}{\partial y}\eta(x)dx - \int_{x_0}^{x_1}\frac{d}{dx}\left(\frac{\partial f}{\partial y'}\right)\eta(x)dx\\}
\only<6-8>{&= \int_{x_0}^{x_1} \left( \frac{\partial f}{\partial y} - \frac{d}{dx}\frac{\partial f}{\partial y'} \right)\eta(x)dx\\}
\only<8>{\implies &\frac{\partial f}{\partial y} - \frac{d}{dx}\frac{\partial f}{\partial y'} =0}
\end{align*}
\end{frame}

But unfortunately, as expected, it gets jumpy and looks really messy. I want to be able to align it properly. How would I go about doing this?

Thank you in advance.

share|improve this question
    
Use \uncover instead of \only. –  Sigur Feb 16 at 23:49

1 Answer 1

up vote 6 down vote accepted

One option using overlayarea and a couple of \phantoms:

\documentclass{beamer}

\begin{document}

\begin{frame}
\frametitle{Euler}
\framesubtitle{Bewijs}
\begin{overlayarea}{\textwidth}{.8\textheight}
\begin{align*}
0 = \frac{\partial \mathcal{F}}{\partial \alpha} &= \frac{\partial}{\partial \alpha} \int_{x_0}^{x_1}f\{y(\alpha,x),y'(\alpha,x);x\}dx\phantom{mmmm}\\
\only<4-8>{&=\cdots\phantom{\int_{x_0}^{x_1}}\\}
\only<2-3>{&= \int_{x_0}^{x_1} \frac{\partial}{\partial \alpha} f\{y(\alpha,x),y'(\alpha,x);x\}dx\\}
\only<3-4>{&= \int_{x_0}^{x_1} \left(\frac{\partial f}{\partial y}\frac{\partial y}{\partial \alpha} + \frac{\partial f}{\partial y'}\frac{\partial y'}{\partial \alpha}\right)dx\\}
\only<4-5>{&= \int_{x_0}^{x_1} \frac{\partial f}{\partial y}\eta(x)dx + \int_{x_0}^{x_1}\frac{\partial f}{\partial y'}\eta'(x)dx\vphantom{\left(\frac{\partial f}{\partial y'}\right)}\\}
\only<5-6>{&= \int_{x_0}^{x_1} \frac{\partial f}{\partial y}\eta(x)dx - \int_{x_0}^{x_1}\frac{d}{dx}\left(\frac{\partial f}{\partial y'}\right)\eta(x)dx\\}
\only<6-8>{&= \int_{x_0}^{x_1} \left( \frac{\partial f}{\partial y} - \frac{d}{dx}\frac{\partial f}{\partial y'} \right)\eta(x)dx\\}
\only<8>{\implies &\frac{\partial f}{\partial y} - \frac{d}{dx}\frac{\partial f}{\partial y'} =0}
\end{align*}
\end{overlayarea}
\end{frame}

\end{document}

enter image description here

share|improve this answer
    
Beautifully done! Thanks a lot! :) –  Knaapje Feb 17 at 0:23

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.