# Align equations with conditions

I am using the following equation with boundary conditions,

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}


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}


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}


My personal preference goes to the first solution.

• Thanks for the \mathrm add on the subscripts. Would use them for all subscripts
– SKPS
Feb 15, 2014 at 18:01

To achieve your stated objective of placing the main equations in the middle of the textbock, you could augment your current system of equations with an additional, invisible column to the left of the main equations, and have new new column contain \text{on $\Gamma_{out}$ as well. The text can be made invisible by encasing it in a \phantom statement.

Note that it's not necessary to provide the invisible stuff in all three rows -- providing it once, e.g., in the first row, suffices to achieve the desired effect.

\documentclass{article}
\usepackage{amsmath}
\newcommand\Gout{\Gamma_{\!\textit{out}}} % occurs repeatedly
\begin{document}
\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}
&\phantom{\text{on $\Gout$}} & p &= p_\infty & \text{on $\Gout$} \\
&& \frac{\partial\rho}{\partial \hat{n}} &= 0  & \text{on $\Gout$} \\
&& \frac{\partial\vec{u}}{\partial\hat{n}} &= 0  & \text{on $\Gout$}
\end{align}
\end{document}