在下面的代码中,第三个方程超出了警告块。我想将这些方程整齐地排列在警告块内。我还想指出第一个方程是“质量守恒”,第二个方程是“动量守恒”,最后一个方程是“总流体能量守恒”。我该怎么做?
\documentclass[handout,13pt,compress,c]{beamer}
\usepackage{amsmath}
\usepackage{xcolor}
\usepackage{mathtools}
\usetheme{PaloAlto}
\begin{document}
\begin{frame}
\frametitle{Physical equations}
\framesubtitle{The equations that we are solving by Enzo during the simulation}
\begin{alertblock}{Eulerian equations of ideal magnetohydrodynamics (MHD) including gravity, in comoving coordinate}
$$ \dfrac{\partial \rho }{\partial t} + \dfrac{1}{a}\nabla .(\rho \vec{v}) = 0 $$
$$ \dfrac{\partial \rho \vec{v}}{\partial t} + \dfrac{1}{a}\nabla .\left(\rho \vec{v}\vec{v} + \vec{I}p^* - \dfrac{\vec{B}\vec{B}}{a}\right) = -\dfrac{\dot{a}}{a}\rho \vec{v} - \dfrac{1}{a}\rho \nabla \phi $$
$$ \dfrac {\partial E} {\partial t} + \dfrac {1}{a} \nabla . \left[ (E+p^*) - \dfrac{1}{a}\vec{B}(\vec{B}.\vec{v})\right] = - \dfrac{\dot{a}}{a}\left( 2E - \dfrac{B^2}{2a}\right) - \dfrac{\rho }{a}\vec{v}.\nabla \phi - \Lambda + \Gamma + \dfrac{1}{a^2}\nabla . \vec{F}_{cond}, $$
\end{alertblock}
\end{frame}
\end{document}
答案1
这是一个使用选项alignat*
\documentclass[handout,13pt,compress,c]{beamer}
\usepackage{amsmath}
\usepackage{xcolor}
\usepackage{mathtools}
\usetheme{PaloAlto}
\begin{document}
\begin{frame}
\frametitle{Physical equations}
\framesubtitle{The equations that we are solving by Enzo during the
simulation}
\begin{alertblock}{Eulerian equations of ideal magnetohydrodynamics (MHD)
including gravity, in comoving coordinate}
\[ \frac{\partial \rho }{\partial t} + \frac{1}{a}\nabla .(\rho \vec{v}) =
0
\]
\[ \frac{\partial \rho \vec{v}}{\partial t} + \dfrac{1}{a}\nabla
.\left(\rho \vec{v}\vec{v} + \vec{I}p^* - \frac{\vec{B}\vec{B}}{a}\right) =
-\frac{\dot{a}}{a}\rho \vec{v} - \frac{1}{a}\rho \nabla \phi
\]
\begin{alignat*}{2}
\frac {\partial E} {\partial t} + \frac {1}{a} \nabla . \left[ (E+p^*) -
\frac{1}{a}\vec{B}(\vec{B}.\vec{v})\right] &= &&-
\frac{\dot{a}}{a}\left(2E - \frac{B^2}{2a}\right) \\
& && - \frac{\rho}{a}\vec{v}.\nabla \phi
- \Lambda + \Gamma\\
& && + \dfrac{1}{a^2}\nabla . \vec{F}_{cond},
\end{alignat*}
\end{alertblock}
\end{frame}
\end{document}
此外,您不需要\dfrac
显示数学,而应该使用\[\]
超过双倍的美元。
为什么 \[ ... \] 比 $$ ... $$ 更可取?
命名是否意味着稍后编号并引用标签名称?
\begin{align}
\dfrac{\partial \rho }{\partial t} + \dfrac{1}{a}\nabla .(\rho \vec{v}) &=
0\label{eqname}\\
\dfrac{\partial \rho \vec{v}}{\partial t} + \dfrac{1}{a}\nabla
.\left(\rho \vec{v}\vec{v} + \vec{I}p^* - \dfrac{\vec{B}\vec{B}}{a}\right)
&=
-\dfrac{\dot{a}}{a}\rho \vec{v} - \dfrac{1}{a}\rho \nabla
\phi\label{eq2name}
\end{align}
\vspace*{-.6cm} \begin{alignat}{2}
\dfrac {\partial E} {\partial t} + \dfrac {1}{a} \nabla . \left[ (E+p^*) -
\dfrac{1}{a}\vec{B}(\vec{B}.\vec{v})\right] &= &&-
\dfrac{\dot{a}}{a}\left(2E - \dfrac{B^2}{2a}\right) \notag\\
& && - \frac{\rho}{a}\vec{v}.\nabla \phi
- \Lambda + \Gamma\notag\\
& && + \dfrac{1}{a^2}\nabla . \vec{F}_{cond},\label{eq3name}
\end{alignat}
要将数字更改为名称,请添加\tag{name}
。
\begin{align}
\dfrac{\partial \rho }{\partial t} + \dfrac{1}{a}\nabla .(\rho \vec{v}) &=
0\tag{Mass Conservation}\\
\dfrac{\partial \rho \vec{v}}{\partial t} + \dfrac{1}{a}\nabla
.\left(\rho \vec{v}\vec{v} + \vec{I}p^* - \dfrac{\vec{B}\vec{B}}{a}\right)
&=
-\dfrac{\dot{a}}{a}\rho \vec{v} - \dfrac{1}{a}\rho \nabla
\phi\tag{Momentum Conservation}
\end{align}
\vspace*{-.6cm}
\begin{alignat}{2}
\dfrac {\partial E} {\partial t} + \dfrac {1}{a} \nabla . \left[ (E+p^*) -
\dfrac{1}{a}\vec{B}(\vec{B}.\vec{v})\right] &= &&-
\dfrac{\dot{a}}{a}\left(2E - \dfrac{B^2}{2a}\right) \notag\\
& && - \frac{\rho}{a}\vec{v}.\nabla \phi
- \Lambda + \Gamma\notag\\
& && + \dfrac{1}{a^2}\nabla . \vec{F}_{cond},
\tag{Total Fluid Energy}
\end{alignat}
答案2
“完美对齐”在这里的含义是开放的。由于标签是必需的,而且空间有限,所以我
- 本地将字体大小设置为
\footnotesize
- 选择
gather
由两种split
环境相结合的环境。
为了避免混淆,在连续的方程式之间留出更多的垂直空间而不是简单的换行符可能也是一个好主意。
\documentclass[handout,13pt,compress,c]{beamer}
\usepackage{amsmath}
\usepackage{xcolor}
\usepackage{mathtools}
\usetheme{PaloAlto}
\begin{document}
\begin{frame}
\frametitle{Physical equations}
\framesubtitle{The equations that we are solving by Enzo during the simulation}
\begin{alertblock}{Eulerian equations of ideal magnetohydrodynamics (MHD)
including gravity, in comoving coordinate}
\footnotesize
\begin{gather*}
\dfrac{\partial \rho }{\partial t} + \dfrac{1}{a}\nabla .(\rho \vec{v}) =
0 \tag{Mass Conservation} \\[1em]
\begin{split}
&\dfrac{\partial \rho \vec{v}}{\partial t} + \dfrac{1}{a}\nabla .
\left(\rho \vec{v}\vec{v} + \vec{I}p^* - \dfrac{\vec{B}\vec{B}}{a}\right) \\
&\qquad = -\dfrac{\dot{a}}{a}\rho \vec{v} - \dfrac{1}{a}\rho \nabla \phi
\end{split} \tag{Momentum Conservation}\\[1em]
\begin{split}
&\dfrac {\partial E} {\partial t} + \dfrac {1}{a} \nabla . \left[ (E+p^*)
- \dfrac{1}{a}\vec{B}(\vec{B}.\vec{v})\right] \\
&\qquad = - \dfrac{\dot{a}}{a}\left( 2E - \dfrac{B^2}{2a}\right) -
\dfrac{\rho }{a}\vec{v}.\nabla \phi - \Lambda\\
&\qquad \phantom{=} + \Gamma + \dfrac{1}{a^2}\nabla . \vec{F}_{cond},
\end{split} \tag{Total Fluid Energy}
\end{gather*}
\end{alertblock}
\end{frame}
\end{document}