# Right/left align lines after the first one inside multline and across (math mode)

I have an external align environment and the computations inside each line are longer than the available width, so I wrapped each of those inside a multlined environment. Inside each of these multlined environments I'd like to right align (or left align with an additional indentation with respect to the first line) the lines following the first one. How can I achieve it?

Here is an example of what I have so far and I need the three lines that I marked with % at the end to be all right aligned (or left aligned with an addition indentation with respect to the main line).

\phi(asdfg) &= \phi(asd asd asd asd asd asd asd asd asd)\\
&= \begin{multlined}[t]
(fgh fgh fgh fgh fgh fgh fgh fgh) (fghfghfgh) \cdot \\
\cdot (fghfghfghfghfghfghfghfghfgh)^{-1} (asd) %
\end{multlined}\\
&= \begin{multlined}[t]
(qwe qwe qwe qwe qwe)(qweqweqwe)(qweqwe)^{-1} \cdot \\
\cdot (asdasdasd asdasdasd) (asdasdas) (asdasdadasd) \cdot\\%
\cdot (asdasdasdasdasd) %
\end{multlined}\\
&= \begin{multlined}[t]
...and so on...
\end{multlined}
\end{align*}


To clarify my question here is a picture of what I need.

Any other suggestion on how to nicely typeset the above computations is more than welcome!

If I've well understood what you want, you simply can use aligned in the place of multlined, without any ampersand:

\documentclass{article}%
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{mathtools}

\begin{document}

\begin{align*}\phi(asdfg) &= \phi(asd asd asd asd asd asd asd asd asd)\\
&= \begin{aligned}[t]
(fgh fgh fgh fgh fgh fgh fgh fgh) (fghfghfgh) \cdot{}  \\
{} \cdot (fghfghfghfghfghfghfghfghfgh)^{-1} (asd) %
\end{aligned}\\
&= \begin{aligned}[t]
(qwe qwe qwe qwe qwe)(qweqweqwe)(qweqwe)^{-1} \cdot{} \\
{} \cdot (asdasdasd asdasdasd) (asdasdas) (asdasdadasd) \cdot\\%
\cdot (asdasdasdasdasd) %
\end{aligned}\\
&= \begin{aligned}[t]
\textit{ ...and so on...}
\end{aligned}
\end{align*}

\end{document}


Unless you mean this:

• The expression following the third equal sign should really be in the same horizontal position as on all the other lines with equal signs. Nov 20, 2019 at 20:01
• @barbarabeeton: I agree it's not very nice and Iwondered what the O.P. had in mind exactly. That's why I added another solution. Nov 20, 2019 at 20:04
• @Bernard: I updated my question with a picture that should clarify my needs. The second option you provided seems what I need, but I don't see the related latex code, how did you achieve it? Also, now that I see it, it is not as nice as I thought, maybe aligning on the left leads to a better result. Do you know how to do it? Or do you have any other suggestion on how to typeset those computation? Nov 20, 2019 at 23:45
• For my second version, I added the second optional argument of multlined: the width of the environment, approximately found by trial and error. To align on the left, use aligned as in the first solution, but with an ampersand at the beginning of each line. Nov 21, 2019 at 0:16