14

I'm using the multlined environment inside an align environment and want have the = aligned at the top and the equation numbering at the bottom. Is this possible?

Here my MWE:

\documentclass{article}
\usepackage{mathtools,amsmath}
\begin{document}
\begin{align}
y &= a+b+c \\
&= \begin{multlined}[t]
a+b+ \\
c
\end{multlined}
\end{align}
\begin{align}
y &= a+b+c \\
&= \begin{multlined}[b]
a+b+ \\
c
\end{multlined}
\end{align}
\end{document}

enter image description here

bonanza
  • 2,141
  • 2
  • 26
  • 37

1 Answers1

16

You have to place the = inside multlined; in order to get alignment, though, a \! is necessary (multlined does the same as aligned and gathered that add \, at their left border).

\documentclass{article}
\usepackage{amsmath,mathtools}

\begin{document}

\begin{align}
y &= a+b+c \\
  &  \!\begin{multlined}[b]
     = a+b+{} \\
          c
     \end{multlined}
\end{align}

\end{document}

enter image description here

egreg
  • 1,121,712
  • thanks! also for the comment about the negative spacing. Can you explain to me why the {} is needed? And one off-topic question: is it more common to place the last operator in the first or in the second line? Meaning: a+b+\\c or a+b\\+c ? – bonanza May 27 '14 at 07:04
  • 2
    @bonanza The {} is necessary to get correct spacing of +: a binary operator needs to have operands on both sides. You can compare with your output and see that b and + are next to each other without any space. Whether having the operand on the top or bottom line is a stylistic decision; in general I prefer to have it at the end of the top line, which makes clearer that the formula is not finished. – egreg May 27 '14 at 07:49
  • 1
  • @egreg Is there an easy solution for the case when the first line (the one with $y$) spans two lines? – Luca Citi Aug 26 '17 at 13:03
  • @LucaCiti Can't you do the same? – egreg Aug 27 '17 at 08:33
  • @egreg Unless I'm missing something obvious, you can't get the eq number to have any vertical alignment other than to the top row, otherwise $y$ too will have the wrong alignment. – Luca Citi Aug 27 '17 at 13:08
  • The only solution I can think of is to have $&y=$ too inside the multlined and then add a &\phantom{y}= to the other equations. – Luca Citi Aug 27 '17 at 13:17
  • @LucaCiti Please, make a new question with an example. – egreg Aug 27 '17 at 13:38
  • @egerg I have made a new question (an provided my tentative answer) here. – Luca Citi Aug 27 '17 at 19:59