# [Tex/LaTex] Equations (to be tagged, but how?) too long to fit in a Beamer alertblock

beamerequationsnaming

In the following code the 3rd equation is going out of the alert block. I want to align those equations beautifully inside the alert block. And also I want to indicate that the first equation is 'Mass conservation', second is 'Momentum conservation' and last as 'Total fluid energy conservation'. How can I do that? \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{frame}

\end{document}


Here is one option using 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{frame}

\end{document} Also, you don't need \dfrac in display math and you should use  over double dollars.

Why is $...$ preferable to $$...$$?

By naming, do mean numbering and referencing a label name later on? \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}


To change the numbers to names, add \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}