How to label equations from this question?

First, please change name of this question (I didn't know how to name this question in appropriate way).

In this my recently asked question I asked how to align some centered equations. Now, I would like to have same result, but with labeled first, third and last equation. I suppose now we can not use multline environment, because with that environment we can label only last equation. @Gonzalo Medina suggested to ask this as new question. Here you MWE (from his answer):

\documentclass{article}
\usepackage{amsmath,amssymb}
\usepackage{lipsum}

\begin{document}

\lipsum

\begin{multline}
A = \lim _{n\rightarrow \infty }\Delta x \Bigl( a^{2}+\bigl( a^{2}+2a\Delta x
+ ( \Delta x ) ^{2}\bigr) \\
\begin{aligned}
&+ \bigl( a^{2}+2\cdot 2a\Delta x+2^{2} ( \Delta x ) ^{2} \bigr)\\
&+ \bigl( a^{2}+2\cdot 3a\Delta x+3^{2} ( \Delta x ) ^{2} \bigr)\\
&+ \cdots\\
&+\bigl( a^{2}+2\cdot (n-1)a\Delta x +(n-1)^{2} ( \Delta x ) ^{2} \bigr)     \Bigr)\\
\end{aligned} \\
= \frac{1}{3} ( b^{3}-a^{3} ) + \text{something}
\end{multline}

\lipsum

\end{document} • you have only one equation. You like to number their parts? Jul 19 '15 at 18:57
• @Zarko Yes, parts of the whole equation. Jul 19 '15 at 18:59
• wouldn't it really be better if the equals sign on the last line were aligned with the equals sign on the first line? (please see comments to the answer in this regard.) Jul 19 '15 at 22:08
• @barbarabeeton I suppose that answer is yes, but this is just an example. I have some other equations (which I didn't want to show here, it's from my master thesis), and I just wanted to imitate multline environment (that is left, centered, ..., centered, right, with labels). Jul 20 '15 at 9:25

Here is a slightly different solution, with the alignat environment, and the \mathrlap command from mathtools, an extension of amsmath. I also suggest another layout, using alignat and aligned:

\documentclass{article}
\usepackage{mathtools,amssymb}
\usepackage{lipsum}
\usepackage{eqparbox}
\def\cdotsfill{\leavevmode \leaders\hbox{$\cdots$}\hfill \kern0pt}

\begin{document}

\lipsum

\begin{alignat}{2}
A = \lim _{n\rightarrow \infty }\Delta x \Bigl( a^{2} & +\bigl( a^{2}+2a\Delta x
+ ( \Delta x ) ^{2}\bigr) & & \\
& + \mathrlap{\bigl( a^{2}+2\cdot 2a\Delta x+2^{2} ( \Delta x ) ^{2} \bigr)} & & \notag \\
& +\mathrlap{ \bigl( a^{2}+2\cdot 3a\Delta x+3^{2} ( \Delta x ) ^{2} \bigr)} & & \\
& + \cdots & & \notag \\
& +\mathrlap{\bigl( a^{2}+2\cdot (n-1)a\Delta x +(n-1)^{2} ( \Delta x ) ^{2} \bigr) \Bigr)} & & \notag \\
& & & = \frac{1}{3} ( b^{3}-a^{3} ) + \text{something}
\end{alignat}
%
\begin{alignat}{2}
A & = \lim _{n\rightarrow \infty }\Delta x \Bigl( a^{2} +\bigl( a^{2}&& +2a\Delta x
+ ( \Delta x ) ^{2}\bigr) \\[-1ex]
& & & \!\begin{aligned} & +\bigl( a^{2}+2\cdot 2a\Delta x+2^{2} ( \Delta x ) ^{2} \bigr) \\
& + \eqmakebox[A]{$\bigl( a^{2}+2\cdot 3a\Delta x+3^{2} ( \Delta x ) ^{2} \bigr)$} \\
& + \eqmakebox[A]{$\cdotsfill$}\\[-1ex]
& + \bigl( a^{2}+2\cdot (n-1)a\Delta x +(n-1)^{2} ( \Delta x ) ^{2} \bigr) \Bigr)
\end{aligned} \\
& =\mathrlap{\smash[t]{\frac{1}{3}} ( b^{3}-a^{3} ) + \text{something}} &
\end{alignat}

\lipsum

\end{document} • Thank you Bernand! I didn't know for alignat environment. Just one question: I suppose it is safe to use mathtools because that is extension of amsmath as you said? I mean, I suppose I can't use both in the same time? That is, I need to switch amsmath with mathtools and that is it? I am worried because maybe something gone wrong if I use mathtools instead amsmath. I am probably silly guy, but... Jul 19 '15 at 19:17
• Oh, I see now question tex.stackexchange.com/questions/43860/mathtools-vs-amsmath, so I will just use mathtools. Thanks! Jul 19 '15 at 19:18
• As you've probably seen, it loads amsmath, so you don't need to load it. In addition, it fixes two amsmath bugs. You should take a look at its documentation, you will see it's really helpful. Jul 19 '15 at 19:25
• Yes, of course, I will look at its documentation to see what new benefits this package gives (I am really happy). Thank you again, you really helped me. (I didn't forget to accept your answer, but I will leaved it unanswered for some more time because maybe someone other find different solution) Jul 19 '15 at 19:31
• wouldn't it really be better if the equals sign on the last line were aligned with the equals sign on the first line? also, lines 2--(n-1) could be handled by split, which would then produce only one tag, so \notag wouldn't be needed. (i'm not in a position to test and i won't post an answer unless i can do that so if you want to extend your answer, feel free.) Jul 19 '15 at 21:52