[Tex/LaTex] Align equations with conditions

alignequationsspacing

I am using the following equation with boundary conditions,

enter image description here

I would like to position the equation centrally aligned and would like to keep the boundary condition to the right. But the equation is a little bit centre-left aligned and boundary conditions are not exactly at right. Would anyone suggest a better alignment for this case? Here is the snippet, if anyone likes to help!

\subsubsection{Outflow}
For the outflow boundary condition, the pressure is specified as a Dirichlet boundary condition, assigned with free-stream pressure and the density $\rho$ and the velocity $\vec{u}$ are specified as a Neumann boundary condition,
\begin{align}
p &= p_\infty & \text{ on }  \Gamma_{out} \\
\frac{\partial \rho}{\partial \hat{n}} &= 0  & \text{ on }  \Gamma_{out} \\ 
\frac{\partial \vec{u}}{\partial \hat{n}} &= 0  & \text{ on }  \Gamma_{out}
\end{align}

Best Answer

I would't use center alignment for the three equations: either you align them at the equals sign or left align them because of the side conditions. I wouldn't put the conditions too far from the equations, either: the conditions are part of the equations, after all. A \quad or \qquad seems sufficient.

\documentclass{article}
\usepackage{amsmath}
\numberwithin{equation}{section}

\begin{document}

\section{Outflow}
For the outflow boundary condition, the pressure is specified as a Dirichlet boundary 
condition, assigned with free-stream pressure and the density $\rho$ and the velocity 
$\vec{u}$ are specified as a Neumann boundary condition,
\begin{alignat}{2}
&p = p_\infty\qquad                            && \text{on $\Gamma_{\mathrm{out}}$} \\
&\frac{\partial\rho}{\partial\hat{n}} = 0      && \text{on $\Gamma_{\mathrm{out}}$} \\
&\frac{\partial \vec{u}}{\partial \hat{n}} = 0 && \text{on $\Gamma_{\mathrm{out}}$}
\end{alignat}

\end{document}

enter image description here

If you want alignment on the equals signs, just change the position of the first &:

\documentclass{article}
\usepackage{amsmath}
\numberwithin{equation}{section}

\begin{document}

\section{Outflow}
For the outflow boundary condition, the pressure is specified as a Dirichlet boundary
condition, assigned with free-stream pressure and the density $\rho$ and the velocity
$\vec{u}$ are specified as a Neumann boundary condition,
\begin{alignat}{2}
p &= p_\infty\qquad                            && \text{on $\Gamma_{\mathrm{out}}$} \\
\frac{\partial\rho}{\partial\hat{n}} &= 0      && \text{on $\Gamma_{\mathrm{out}}$} \\
\frac{\partial \vec{u}}{\partial \hat{n}} &= 0 && \text{on $\Gamma_{\mathrm{out}}$}
\end{alignat}

\end{document}

enter image description here

My personal preference goes to the first solution.