Equation Alignment with Hierarchical Left Alignment

I was able to produce this set of left-aligned equations with aligned indenting to emphasize hierarchy:

with this code:

\begin{align}
x &= y + z \\
&\mathrel{\phantom{=}} y = a + b\\
&\mathrel{\phantom{=}} z = c + d\\
&\mathrel{\phantom{=y=}}  c = u + v\\
&\mathrel{\phantom{=}} w = s + t
\end{align}


But this feels very hacky. Q: Is there a better-practice method for doing this? I tried playing with falign to no avail. NOTE: I do intend for the equations to overlap vertically as they're displayed. I don't want them in their own cells, as they would be in an array environment

1 Answer

If you don't need all equations numbered, a pair of nested split environments can help:

\documentclass{article}
\usepackage{amsmath}
\begin{document}

$\begin{split} x ={} & y + z \\ & y = a + b\\ & \begin{split} z ={} & c + d\\ & c = u + v \end{split}\\ & w = s + t \end{split}$
\end{document}


Update:

In case you need numbered equations, you need align, but only one phantom is enough.

\documentclass{article}
\usepackage{amsmath}
\begin{document}

\begin{align}
x ={} & y + z \\
& y = a + b\\
& z =  c + d\\
&\phantom{z ={}}c = u + v\\
& w = s + t
\end{align}
\end{document}


• This is helpful, but I do actually need the equations numbered. Also, wondering why there's some wonky spacing in the z=c – lowndrul Feb 28 '16 at 18:11
• @lowndrul I've updated the answer with an align solution. – Ignasi Feb 28 '16 at 19:02
• very clever with the =\ &. I haven't seen this. Using it did simplify my code. – lowndrul Feb 28 '16 at 20:29
• if the = comes before the &, enter it as ={} to fix the spacing. – barbara beeton Feb 28 '16 at 22:15
• @barbarabeeton Thanks, I didn't know it. – Ignasi Feb 28 '16 at 22:22