I am looking for a way to align separate lines but always relative to some marker in the previous line. My use-case is to align equations in a math environment in a specific way but for demonstration purposes let me first showcase it with the following lines:
----a----
a------b
c--b
d---c
e--d
In this case, I want to have align every line relative to the previous one, such that the letters match up:
----a----
a------b
c--b
d---c
e--d
I am sure it is possible to do this using tables. But to make this work by using tables, it seems to me that you need to already know in advance how many columns you are going to need (which might change when you ever want to add more lines), while I am seeking a solution which is flexible, since every line is only supposed to be aligned in reference to the previous one.
Or am I missing some feature about tables, which resolves my problem in exactly that way?
To make this very concrete, here is one instance where I would like to use it. This is the code:
\documentclass{article}
\begin{document}
$$
\phi(G\,a\,n)
\\ \phi \circ g (~\phi (a) [\overline n] ~)
\\ \phi (a) [\overline n]
\\ \phi \circ g (\, \forall y. \, \phi(d)[z,y] \to \varphi[y] \, ) [\overline n]
\\ (\forall y. \, \phi(d)[z,y] \to \varphi[y] \, )[\overline n]
\\ \forall y. \, \phi(d)[\overline n,y] \to \varphi[y]
\\ \forall y. \, \overline{\Delta \,n} = y \to \varphi[y]
\\ \varphi[\overline{\Delta \,n}]
\\ \varphi[\overline{G \,n \,n}]
$$
\end{document}
How it looks:
And how I would like it to look:
alignat
...tabbing
environment can help... tex.stackexchange.com/a/263766/38080