getting the equation numbering right using align and a long equation that splits

So I've got a system of equations. One equation is very long. I want them all aligned, but I want the long equation to split over two lines.

\begin{align}
\theta &= \theta(t-1) -p \theta(t-1) +p
\frac{\hat{\psi}'(\theta(t-1))}{\ave{K}} +p \phi_R(0)\nonumber\\
R   &= R(t-1)+I(t-1)
\end{align}


As it stands, the equation for \theta spans two lines and is numbered on the second line. I'd like the number to be centered (rather like split appears to do). I haven't found a good way to do this.

• Use aligned inside equation. Commented Jan 19, 2016 at 0:17

split ought to work inside align, but it has some problems; a trick solves the issue:

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

\newcommand{\ave}[1]{\langle #1\rangle}% <--- guess

\begin{document}

\begin{align}
\begin{split}
\mathllap{\theta}
&= \theta(t-1) -p \theta(t-1) +p
\frac{\hat{\psi}'(\theta(t-1))}{\ave{K}} +p \phi_R(0)\\
\end{split}
\\[1.5ex]
R &= R(t-1)+I(t-1)
\end{align}

\end{document}


Some space is needed to make clearer what the numbers refer to, in my opinion.

• great guess on \ave - nailed it. Can you tell me why mathllap is needed? I see it fixes the alignment, but it's not clear to me how.
– Joel
Commented Jan 19, 2016 at 8:31
• @Joel I'd like to know, too. ;-) Commented Jan 19, 2016 at 8:40

The trick is to use the aligned environment, which acts as a single line for the purposes of equation numbering, alignment inside other environments, etc. You'll also want to remove the \nonumber:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{aligned} \theta &= \theta(t-1) -p \theta(t-1) +p \frac{\hat{\psi}'(\theta(t-1))}{K} +p \phi_R(0)\\ &\qquad + (1-p)(1-\theta(t-1))\\ R &= R(t-1)+I(t-1) \end{aligned}
\end{document}


it's possible to use aligned within align, as follows:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align}
\theta & =
\begin{aligned}[t]
& \! \theta(t-1) -p \theta(t-1) +p
\frac{\hat{\psi}'(\theta(t-1))}{K} +p \phi_R(0)\\

• to get the top line of the aligned block even with the left side, it's necessary to specify [t].
• for reasons lost in the mists of time, an aligned block starts with \,, and this must be reversed with the negative equivalent, \!. (i didn't bother doing that on the second line, since it would probably not be obvious in the presence of the \qquad.)