[Tex/LaTex] Equation number in long equation

amsmathequationsnumbering

I have a long equation that goes over two lines. The first line takes up the full horizontal space and the second line is indented. I use amsmath's split for that.

My problem is that the equation number jumps into the row below the second line. I want it right next to the second line. How can I achieve this?

My formula looks like this (I cannot post the exact same formula, but since I actually use KOMA-Script anyway, I think it is not dependent on the exact spacing):
enter image description here

\documentclass{article}
\usepackage{amsmath}
\begin{document}
    \begin{equation}
    \begin{split}
    \max \Biggl\{\sum_{(a,b)\in MW} a_ba_{bc} &- \sum_{(a,b)\in M} a_ba_{bc} - \sum_{a\in A} \sum_{(a,b)\in M} \sum_{(a,b)\in M} a_ba_{bc} - \zeta \sum_{(a,b)\in MW} a_{bc} \\
    &- \sum_{(a,b)\in M} a_ba_{bc} - \sum_{(a,b)\in M} a_b (a^+_b+a^-_b) \Biggr\}
    \end{split}
    \end{equation}
\end{document}

Best Answer

I think it can be useful to suggest a trick which is more general, in the sense that it can be applied also in situations where it is not that easy to reformat the equation to fit.

The equation number is moved down because the split environment produces a single block that has the width of the longest of its lines, thus the surrounding equation environment treats it as a single line that, in this case, is too wide to fit together with the number and hence moves it down. However, we see that the number would fit in the second line, if only this line could be regarded as an equation in itself.

Now, from a logical standpoint, the markup in the question is correct, and, generally speaking, is the only one that should be employed: there is one equation, to which the number refers as a whole, and this equation consists of two lines. However, in a case like this, a little trick based on visual markup can solve the problem: specify two equations instead of one, by using an align environment, each, in theory, with its own number; but suppress the number on the first line by means of a \notag command placed at the end of the first “equation”. Here’s the code:

\documentclass[a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage{amsmath}

\begin{document}
\begin{align}
    \max \Biggl\{\sum_{(a,b)\in MW} a_ba_{bc}
        &- \sum_{(a,b)\in M} a_ba_{bc}
            - \sum_{a\in A} \sum_{(a,b)\in M} \sum_{(a,b)\in M} a_ba_{bc}
            - \zeta \sum_{(a,b)\in MW} a_{bc} \notag \\ % \notag suppresses the
                                                        % equation number
        &- \sum_{(a,b)\in M} a_ba_{bc}
            - \sum_{(a,b)\in M} a_b (a^+_b+a^-_b) \Biggr\}
\end{align}
\end{document}

And here’s the output it yields:

Output of the above code