# Equation numbering

Suppose that when we write an equation in the align environment and we break the equation in two lines. There is only one equation number. How can I place this number not in the last equation line, but in the middle of the two lines?

I am writting a book in the book class.)

-

You can use aligned sub-environment, like this:

\label{eq:my} \begin{aligned} 10&=1+2 \\&+3+4 \end{aligned}


For this, the package \usepackage{amsmath} is needed.

Besides aligned, there exist also split, gathered and multlined (the last one is provided by mathtools package). All are documented in the documentation of either amsmath or mathtools.

However, this can be further improved. First, multlined can do its job very nicely and you don't even need any &s:

$$\label{eq:my} \begin{multlined} 10=1+2 \\+3+4 \end{multlined}$$


If you still prefer the alignment, some spaces at the beginnin of the 2nd line might be proper:

\label{eq:my} \begin{aligned} 10&=1+2 \\& \phantom{=} +3+4 % space of the width of = \\& \quad +3+4 % fixed space \end{aligned}

-
just curious. why is mathtools needed for this? (it's a great package, but what's asked for is provided already by amsmath.) regarding formatting, the second line of your example would be improved by coding it as &\quad{}+3+4. – barbara beeton Dec 4 '12 at 18:05
Sorry, it is not, it is only for multlined, which I prefer. I'll elaborate it. – yo' Dec 4 '12 at 18:32

This is really only a variation on what tohecz did above

\documentclass{article}
\usepackage{amsmath}
\pagestyle{empty}
\begin{document}

\begin{align}
\begin{split}
10 =&1+2 \\
&    +3+4
\end{split} \\
=& 4x - 5
\end{align}
\end{document}


But it does illustrate how you can align across split lines (numbered as you would like) and non-split lines.

-
Put the & in front of the = to get the proper spacing please... – yo' Dec 4 '12 at 18:29
Either &= or ={}&. The second form is justified here because you don't want the + to align with the =. – egreg Dec 4 '12 at 18:31
@egreg true, I forgot the 2nd option. I usually put \phantom{=} there. – yo' Dec 4 '12 at 18:31

The following example is taken directly from the mathmode document (p 25), with small modifications to the spacing around operators:

\documentclass{article}
\begin{document}
$$\begin{array}{r@{}c@{}l} \frac{1}{2}\Delta(f_{ij}f^{ij}) & {}={} & 2\Bigg({\displaystyle \sum_{i<j}}\chi_{ij}(\sigma_{i}-\sigma_{j})^{2}+f^{ij}% \nabla_{j}\nabla_{i}(\Delta f)+{}\\ & & {}+\nabla_{k}f_{ij}\nabla^{k}f^{ij}+f^{ij}f^{k}[2 \nabla_{i}R_{jk}-\nabla_{k}R_{ij}]\Bigg) \end{array}$$
\end{document}


Fundamentally, the entire equation (split in this case) is boxed in an array in order to make TeX think that you're still only working with a sincle equation.

-
however, I think that we have aligned and its siblings exactly to avoid doing manual tweaks like \arraycolsep=2pt. – yo' Dec 4 '12 at 18:02
Thank you both ! – John Dec 4 '12 at 18:06
@tohecz: I forgot the \arraycolsep in there from the example; I've modified it with my column specification @{}c@{}, so it's not needed anymore. – Werner Dec 4 '12 at 18:28
But still, you have to say {r@{}c@{}l} and use {}={}. I mean: there are situtations where this is useful, but it is very time-consuming and you make errors there easier. – yo' Dec 4 '12 at 18:31
@tohecz : I agree. Your proposal is faster and avoids mistakes. Plus, it works fine in an align environment. – John Dec 4 '12 at 18:34