# Aligned within align: Why are they right-aligned?

I want to align multiple equations. Some of them span multiple lines, some of them don't. I'd like for the equation tag of the multiple-line equations to be aligned with both lines, not just one of them, so just using align with \notag don't work.

So I tried using aligned within align but everything got right aligned. Also tried flalign as the outer environment, same result. Any idea?

\begin{align}
\begin{aligned}
X_{i+1} &= X_i + h (P_{X,i} + Y_{i+1}), \label{eq:symplectic-euler-X_i+1}
\end{aligned} \\
\begin{aligned}
Y_{i+1} &= Y_i + h (P_{Y,i} - X_{i+1}), \label{eq:symplectic-euler-Y_i+1}
\end{aligned} \\
\begin{aligned}
P_{X,i+1} &= P_{X,i} \\
&+ h \left(P_{Y,i} - \dfrac{(1-k)(k+X_{i+1})}{((k+X_{i+1})^2+Y_{i+1}^2)^{3/2}} + \dfrac{k(X_{i+1}-1+k)}{((X_{i+1}-1+k)^2+Y_{i+1}^2)^{3/2}}\right), % \label{eq:symplectic-euler-PX_i+1}
\end{aligned} \\[0.4cm]
\begin{aligned}
P_{Y,i+1} &= P_{Y,i} \\
&+ h \left(-P_{X,i} - \dfrac{(1-k)Y_{i+1}}{((k+X_{i+1})^2+Y_{i+1}^2)^{3/2}} - \dfrac{k Y_{i+1}}{((X_{i+1}-1+k)^2+Y_{i+1}^2)^{3/2}}\right). % \label{eq:symplectic-euler-PY_i+1}
\end{aligned}


\end{align}

Which gives this:

How do I get everything left aligned, and with centered tags?

• Can you provide an image of the expected output? You can cobble something together by moving the elements around. – Werner Sep 11 '18 at 19:47

Your different aligned environments are not introduced by an ampersand, so there's an implicit one at the end of each line, whence the right alignment.

Maybe the following code produces what you want?

\documentclass{article}

\usepackage{mathtools}
\usepackage{geometry}

\begin{document}

\begin{align}
X_{i+1} &=X_i + h (P_{X,i} + Y_{i+1}), \label{eq:symplectic-euler-X_i+1} \\[1ex]
Y_{i+1} &= Y_i + h (P_{Y,i} - X_{i+1}), \label{eq:symplectic-euler-Y_i+1} \\[1ex]
\begin{split} P_{X,i+1} &=P_{X,i} \\[-1ex]
&\phantom{ = {}}+ h \left(P_{Y,i} - \dfrac{(1-k)(k+X_{i+1})}{((k+X_{i+1})^2+Y_{i+1}^2)^{3/2}} + \dfrac{k(X_{i+1}-1+k)}{((X_{i+1}-1+k)^2+Y_{i+1}^2)^{3/2}}\right), % \label{eq:symplectic-euler-PX_i+1}
\end{split} \\[1ex]
\begin{split} P_{Y,i+1} &=P_{Y,i} \\[-1ex]
& \phantom{ ={} } + h \left(-P_{X,i} - \dfrac{(1-k)Y_{i+1}}{((k+X_{i+1})^2+Y_{i+1}^2)^{3/2}} - \dfrac{k Y_{i+1}}{((X_{i+1}-1+k)^2+Y_{i+1}^2)^{3/2}}\right). % \label{eq:symplectic-euler-PY_i+1}
\end{split}
\end{align}

\end{document}


• Thanks, that works (sorry for late reply) :) – Gandalf Saxe Dec 20 '18 at 20:44
• Could you explain what this bit does? \phantom{ = {}} – Gandalf Saxe Dec 20 '18 at 20:49