# Splitting a sum

I have some equations that are long and run off the page if I don't break them onto multiple lines. Some of these equations have a constant on the left and a sum of terms on the right. I find that when I split the right side with the split command, the results are kind of ugly:

\documentclass[11 pt]{report}
\usepackage{amsmath}
\begin{document}
$\begin{split}16801 =& \text{DG:H:HICAP} + \text{DG:H:HIPP} + \text{DG:H:Hilar proj} +\\ & \text{DG:H:Aspiny Hilar}\end{split}$
\end{document}


Two things are wrong with this picture:

• the spacing around the equals sign is clearly off
• the plus ending the first line is unusually close to the preceding "j"

How can I fix these things? BTW, I got identical results using align in place of split.

-
Note that the option is 11pt rather than 11 pt; this form works, but mostly by accident. – egreg Nov 18 '13 at 23:08

I can suggest to move aligning & to the left of = and move ending + to next line:

\documentclass[11pt]{report}
\usepackage{amsmath}

\begin{document}
$\begin{split} 16801 & = \text{DG:H:HICAP} + \text{DG:H:HIPP} + \text{DG:H:Hilar proj}\\ &\quad + \text{DG:H:Aspiny Hilar} \end{split}$
\end{document}

-
You can also use &\hphantom{{}=} in the second line to get the correct alignment. – Svend Tveskæg Nov 18 '13 at 10:54
@SvendTveskæg I would personally be fine with \quad. Aligning multi-line equations is much a matter of taste ;) – yo' Nov 18 '13 at 11:04
@SvendTveskæg I also prefer to use \quad and \phantom{...} only for more complicated alignments like integral bodies or nested expressions. – Ignasi Nov 18 '13 at 11:08
Fair enough. :) The reason why I perfer \phantom is because it is more general but I fully understand your points of view. – Svend Tveskæg Nov 18 '13 at 11:19
If I were to use a phantom, it would be \hphantom{{}={}} since it needs to replace the equal sign and the spaces on both sides of it. On the other hand \quad is simpler and good enough for me. – Dan Nov 18 '13 at 22:44

i would certainly use multline, and binary operators always go after the line-break:

\documentclass[11pt]{report}
\usepackage{amsmath}
\begin{document}

\begin{multline*}
16801 = \textnormal{DG:H:HICAP}
+ \textnormal{DG:H:HIPP} + \textnormal{DG:H:Hilar proj}
\\
+ \textnormal{DG:H:Aspiny Hilar}
\end{multline*}

\end{document}


As pointed out in one of the other answers and in comments, \text is quite incorrect here, since it would be italic in a theorem statement, which you probably don't want.

-
Thanks tohecz. I have to say in my opinion the rendered result of this looks pretty strange. I prefer to keep lines aligned on the left. Also, as far as I can tell it makes no difference whether or not there's a space in the argument to \documentclass, but correct me if I'm wrong. – Sean Mackesey Nov 18 '13 at 18:29
@SeanMackesey You seem to be right about 11 pt, I've never seen it, apologies. As for multline, I consider it very distracting when something is aligned at a place where it makes little or no sense. This is such a place. Moreover, usage of multline makes the formula start on the left margin and end of the right one, therefore it looks like one formula even "from distance" and you don't need to think on where the formula ends. – yo' Nov 18 '13 at 19:17
The problem of possible italic is solved using \textnormal instead of \text; within \mathrm space are ignored, so you should use \mathrm{DG:H:Hilar\ proj} – egreg Nov 18 '13 at 23:07
@egreg You're right, as always. – yo' Nov 18 '13 at 23:29

I suggest putting a pair of braces between the equals sign and the ampersand to get better spacing: = {} &.

I would normally also move the plus to the start of the next line. I find that sometimes the spacing between this and the first term isn't quite right, but that can be simply fixed by inserting a \left. delimiter after the plus (remembering to close it at the end of the line), such that the second line would be: & + \left. \text{DG:H:Aspiny Hilar} \right..

In general I would also use \mathrm in place of \text.

-
Don't use \left...\right in splits, there are no guarantee that the sizes will match. Scale manually – daleif Nov 18 '13 at 12:16
I was unaware of this, but it should be irrelevant here. – CPLB Nov 18 '13 at 14:05