Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.)

share|improve this question
add comment

3 Answers

You can use aligned sub-environment, like this:

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

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:

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

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

\begin{equation}\label{eq:my}
\begin{aligned}
10&=1+2
\\& \phantom{=} +3+4 % space of the width of `=`
\\& \quad +3+4 % fixed space
\end{aligned}
\end{equation}
share|improve this answer
    
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. –  tohecz Dec 4 '12 at 18:32
add comment

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}

enter image description here

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

share|improve this answer
1  
Put the & in front of the = to get the proper spacing please... –  tohecz Dec 4 '12 at 18:29
2  
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. –  tohecz Dec 4 '12 at 18:31
add comment

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

enter image description here

\documentclass{article}
\begin{document}
\begin{equation}
  \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{equation}
\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.

share|improve this answer
    
however, I think that we have aligned and its siblings exactly to avoid doing manual tweaks like \arraycolsep=2pt. –  tohecz 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. –  tohecz 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
show 2 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.