# Align multiple equations at multiple points with \alignat

I'm trying to generate an aligned pair of equations with the alignat environment. However, I have two major problems:

1. There is extra horizontal space before my aligned points.
2. The euqation numbers are far too close to the page margin. I have already searched for a solution online but couldn't find anything that would help. I would really appreciate if somebody has a solution or work-around!

\begin{alignat}{5}
& \frac{\partial \rho k}{\partial t} &{}+{}&
\frac{\partial \rho u_j k}{\partial x_j} &{}={}&
\tau_{ij} \frac{u_i}{\partial x_j} -
\beta^* \rho \omega k +
\frac{\partial \left( \rho \left( \nu + \sigma_k \nu_\text{turb} \right )\frac{\partial k}{\partial x_j} \right )}{\partial x_j}
\\
& \frac{\partial \rho \omega}{\partial t} &{}+{}&
\frac{\partial \rho u_j \omega}{\partial x_j} &{}={}&
\frac{\gamma}{\nu_\text{turb}} {}\tau_{ij} \frac{\partial u_i}{\partial u_j} -
\beta \rho \omega^2 +
\frac{\partial \left(\rho \left(\nu + \sigma_\omega \nu_\text{turb} \right ) \frac{\partial \omega}{\partial k} \right )}{\partial x_j}
\notag
\\
& && && + 2 \left(1-F_1 \right ) \frac{\rho \sigma_{\omega2}}{\omega} \frac{\partial k}{\partial x_j}
\frac{\partial \omega}{\partial x_j}
\end{alignat}

• I get this with your code, and it seems to be okay. – user156344 Apr 10 at 16:18
• Welcome to tex.sx. Extra space is added before the relation when you enter it as &{}=; omit the {}. – barbara beeton Apr 10 at 16:30

I can't reproduce your picture with the code you show.

Anyway, here's a simplified version.

\documentclass{article}
\usepackage{amsmath}

\newcommand{\pder}[2]{\frac{\partial #1}{\partial #2}}

\begin{document}

\begin{alignat}{3}
& \pder{\rho k}{t} &&+ \pder{\rho u_j k}{x_j} &&=
\tau_{ij} \frac{u_i}{\partial x_j} -
\beta^* \rho \omega k +
\pder{\bigl( \rho (\nu + \sigma_k \nu_{\mathrm{turb}}) \pder{k}{x_j} \bigr)}{x_j}
\\
& \pder{\rho \omega}{t} &&+
\pder{\rho u_j \omega}{x_j} &&=
\frac{\gamma}{\nu_{\mathrm{turb}}} \tau_{ij} \pder{u_i}{u_j} -
\beta \rho \omega^2 +
\pder{\bigl(\rho (\nu + \sigma_\omega \nu_{\mathrm{turb}}) \pder{\omega}{k} \bigr)}{x_j}
\notag
\\
& && && \qquad + 2 (1-F_1) \frac{\rho \sigma_{\omega2}}{\omega} \pder{k}{x_j}
\pder{\omega}{x_j}
\end{alignat}

\end{document}


Note that \nu_\text{turb} is improper, because the word should be upright independently on the font in the surrounding text. Use \nu_{\mathrm{turb}}.

I also simplified the input for partial derivatives, that makes formulas shorter and more readable.

Welcome to TeX-SE! With align instead of alignat I get

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align}
\frac{\partial \rho k}{\partial t} +
\frac{\partial \rho u_j k}{\partial x_j} &=
\tau_{ij} \frac{u_i}{\partial x_j} -
\beta^* \rho \omega k +
\frac{\partial \left( \rho \left( \nu + \sigma_k \nu_\text{turb} \right )\frac{\partial k}{\partial x_j} \right )}{\partial x_j}
\\
\frac{\partial \rho \omega}{\partial t} +
\frac{\partial \rho u_j \omega}{\partial x_j} &=
\frac{\gamma}{\nu_\text{turb}} {}\tau_{ij} \frac{\partial u_i}{\partial u_j} -
\beta \rho \omega^2 +
\frac{\partial \left(\rho \left(\nu + \sigma_\omega \nu_\text{turb} \right ) \frac{\partial \omega}{\partial k} \right )}{\partial x_j}
\notag
\\
&\hphantom{=} + 2 \left(1-F_1 \right ) \frac{\rho \sigma_{\omega2}}{\omega} \frac{\partial k}{\partial x_j}
\frac{\partial \omega}{\partial x_j}
\end{align}
\end{document}


• It seems that the OP is trying to align the elements in the left hand side also. – user156344 Apr 10 at 16:22