在幻灯片间对齐方程式(/only)

在幻灯片间对齐方程式(/only)

大家好,我目前正在准备一个关于变分法的演示文稿。在其中,我给出了欧拉方程的证明。目前我使用以下 Latex 代码:

\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}

但不幸的是,正如预期的那样,它变得跳跃并且看起来非常混乱。我希望能够正确对齐它。我该怎么做呢?

先感谢您。

答案1

一个选项使用overlayarea和几个\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}

在此处输入图片描述

相关内容