# Multiline equation with specific indentation style

I have a multiline equation of the following type:

$$\begin{split} f(x,y) & =a\\ & =b\\ & +c\\ & +d. \end{split}$$


But the output I would like to have is as follows:

 f(x,y) = a
= b
+ c
+ d


That is, the lines continuing the sum shall have additional indentation, that is, the +'s shall not be directly below the "=". Whatever I tried didn't work as intended. Do you have any suggestions as of how to accomplish this?

A simple solution with \phantom command:

$$\begin{split} f(x,y) & =a\\ & =b\\ &\phantom{=}\, +c\\ &\phantom{=}\, +d. \end{split}$$


gives:

This is the better looking alignment, in my opinion. Anyway, you can adjust it with spacing commands. For example, the following code

$$\begin{split} f(x,y) & =a\\ & =b\\ &\phantom{=}\, +c\\ &\quad +d\\ &\phantom{=}\; +e. \end{split}$$


produces:

As you can see, a little spacing is added in consecutive lines.

• I typically use \quad with is roughly of the size of \phantom{=}. – Bruno Le Floch Jul 10 '13 at 0:15

You can just "flip around" the use of the alignment character &:

\documentclass{article}
\usepackage{amsmath}% http://ctan.org/pkg/amsmath
\begin{document}
$$\begin{split} f(x,y) & =a \\ & =b \\ & +c \\ & +d. \end{split}$$

$$\begin{split} f(x,y) ={}& a\\ ={}& b \\ & {}+c \\ & {}+d. \end{split}$$
\end{document}


The additional empty groups {} ensure the correct spacing around binary operators/relations. If you wish the alignment of the +s to be more aligned with the RHS of the equations above, you could also use:

$$\begin{split} f(x,y) ={}& a\\ ={}& b \\ & \mskip-\medmuskip +c \\ & \mskip-\medmuskip +d. \end{split}$$


which removes the space around the binary operator +.

There are various answers here that explain how to achieve this manually, but I think that it is worth mentioning the breqn package, which attempts to automatically break long display math equations. Here is an example:

\documentclass{article}

\usepackage[a6paper]{geometry}
\usepackage{breqn}

\begin{document}

\begin{dmath*}
f(x,y) = 2x( x^2 + 2x + 1) + 2y(y^2 + 2y + 1)
+ 2z(z^2 + 2z + 1).
\end{dmath*}
\end{document}


which gives

Note that the + is automatically aligned at the right location. The breqn package is somewhat experimental. Do read its documentation for caveats; but when it works, it works beautifully.

While @Werner's answer works well for your particular case, if you actually need two (or more) explicit lines of alignment, you can use the alignedat environment:

\documentclass{report}
\usepackage{amsmath}
\begin{document}
\begin{alignedat}{2} f(x) & ={} && a \\ & ={} && b \\ & && + c \\ & && + d. \end{alignedat}
\end{document}


(I do not include the picture, since the result is exactly the same as in Werner's answer; the trick with \mskip/\medmuskip can be applied as well).