Center subequation of multiple lines

I would like to keep my style of subequations but I also would like to center these subequation, which is on multiple lines (because it's length). So that means, the second part/line of the subequation must be in the center of the first one. Anyone has an idea?

\begin{subequations}
$$\ddot{x}=R\cdot\left(\underbrace{-2\cdot\dot{\theta}\cdot\dot{\phi}\cdot cos(\theta)\cdot sin(\phi)}_\text{Coriolisversnelling} - \underbrace{ (\dot{\theta}^2+\dot{\phi}^2)\cdot sin(\theta)\cdot cos(\phi)}_\text{Middelpuntzoekende versnellingen} \right. \\+ \left.\underbrace{\ddot{\theta}\cdot cos(\theta)\cdot cos(\phi) - \ddot{\phi}\cdot sin(\theta)\cdot sin(\phi)}_\text{Hoekversnellingen}\right)$$
$$---$$
\end{subequations}

• When I compile your code, the equation does not break. Did you alredy managed to do this? Anyways, to make life easier just provide a minimal working example starting with \documentclass{...} and ending with \end{document}. – Ruben Oct 8 '13 at 8:05
• The equation environment never breaks formulas across lines; you have to use split inside equation for this, where you tell precisely where to split and the inner alignment point. It's not clear what you mean by "the second part/line of the subequation must be in the center of the first one". – egreg Oct 8 '13 at 8:13
• I already manage to make the complete document... Just not realized it was handy to write here... I'm sorry! – Ruben Oct 8 '13 at 21:00

3 Answers

There are various options, none of which contemplates consecutive display environments. In all the proposed solutions, I use a single gather.

1. The equation is split across two lines, the first with \nonumber
2. The equation is set with multlined (requires mathtools)
3. The equation is set with aligned, using (perhaps abusing) the fact that the first column in aligned

In the third example I removed all the \cdot and the parentheses around the arguments to sine and cosine. Since it's my preferred one, I also showed how to avoid a too long subscript to the underbrace, by splitting it across two lines. Use \begin{aligned}[b] if you prefer that the equation number is aligned with the second row.

\documentclass{article}
\usepackage{mathtools}
\begin{document}
\begin{subequations}
\begin{gather}
\ddot{x}=R\cdot\Bigl(
\underbrace{-2\cdot\dot{\theta}\cdot\dot{\phi}
\cdot \cos(\theta)\cdot \sin(\phi)}_\text{Coriolisversnelling} -
\underbrace{(\dot{\theta}^2+\dot{\phi}^2)\cdot \sin(\theta)\cdot
\cos(\phi)}_\text{Middelpuntzoekende versnellingen}
\nonumber\\
+ \underbrace{\ddot{\theta}\cdot \cos(\theta)\cdot \cos(\phi) -
\ddot{\phi}\cdot \sin(\theta)\cdot \sin(\phi)}_\text{Hoekversnellingen}
\Bigr)\\
a+b+x+y=z
\end{gather}
\end{subequations}
\begin{subequations}
\begin{gather}
\begin{multlined}
\ddot{x}=R\cdot\Bigl(
\underbrace{-2\cdot\dot{\theta}\cdot\dot{\phi}
\cdot \cos(\theta)\cdot \sin(\phi)}_\text{Coriolisversnelling} -
\underbrace{(\dot{\theta}^2+\dot{\phi}^2)\cdot \sin(\theta)\cdot
\cos(\phi)}_\text{Middelpuntzoekende versnellingen}
\\
+ \underbrace{\ddot{\theta}\cdot \cos(\theta)\cdot \cos(\phi) -
\ddot{\phi}\cdot \sin(\theta)\cdot \sin(\phi)}_\text{Hoekversnellingen}
\Bigr)
\end{multlined}\\
a+b+x+y=z
\end{gather}
\end{subequations}

\begin{subequations}
\begin{gather}
\begin{aligned}
\ddot{x}=R\Bigl(
\underbrace{-2\dot{\theta}\dot{\phi}\cos\theta\sin\phi}%
_\text{Coriolisversnelling} -
\underbrace{(\dot{\theta}^2+\dot{\phi}^2)\sin\theta\cos\phi}%
_{\substack{\text{Middelpuntzoekende}\\\text{versnellingen}}}
\\
{} + \underbrace{\ddot{\theta}\cos\theta\cos\phi -
\ddot{\phi}\sin\theta\sin\phi}%
_\text{Hoekversnellingen}
\Bigr)
\end{aligned}\\
a+b+x+y=z
\end{gather}
\end{subequations}

\end{document}


Since you OP's equation does not break, I use gather* and gather math environment from amsmath to generate a break case and center the equation.

\documentclass{minimal}
\usepackage{amsmath}
\begin{document}
\begin{subequations}
\begin{gather*}
\ddot{x}=R\cdot\left(\underbrace{-2\cdot\dot{\theta}\cdot\dot{\phi}
\cdot cos(\theta)\cdot sin(\phi)}_\text{Coriolisversnelling} -
\underbrace{ (\dot{\theta}^2+\dot{\phi}^2)\cdot sin(\theta)\cdot
cos(\phi)}_\text{Middelpuntzoekende versnellingen} \right.
\end{gather*}
\begin{gather}
+ \left.\underbrace{\ddot{\theta}\cdot cos(\theta)\cdot cos(\phi) -
\ddot{\phi}\cdot sin(\theta)\cdot sin(\phi)}_\text{Hoekversnellingen}\right)
\end{gather}
$$a+b+x+y=z$$
\end{subequations}
\end{document}

• i don't think the parentheses need to be quite so enormous. \bigg should do quite well enough (and avoids the "dummy" matching). – barbara beeton Oct 8 '13 at 12:55
• I already used the gather stuff... But it was inside an 'equation' environment, so because of that it didn't work I see now!@Jesse I didn't know of the existence of the \bigg, I used it and I like it! – Ruben Oct 8 '13 at 20:56
• @barbarabeeton -- That is a very good suggestion. It seems that Ruben like it too. – Jesse Oct 8 '13 at 22:49

Here's a slightly different approach, and I'll let someone like Barbara tell me whether it is or is not editorially acceptable. The parens have been made smaller (which is good), but in the process, they become misaligned with the math axis. Unfortunately, to align them with the math axis would misalign the equation part from the axis. The other alternative is where the OP started... with over large parens.

I used right alignment on the second part of eq 1a, which can be changed (to l or c) with the argument to \def\stackalignment.

\documentclass{article}
\usepackage{amsmath}
\usepackage{stackengine}
\usepackage{scalerel}
\stackMath
\begin{document}
\begin{subequations}
\abovebaseline[-4.3ex]{% \ddot{x}=R\cdot\def\stackalignment{r}\stackunder[12pt]% {\scaleleftright[1.5ex]{(}{\underbrace{-2\cdot\dot{\theta}\cdot\dot{\phi}\cdot \cos(\theta)\cdot \sin(\phi)}_\text{Coriolisversnelling} - \underbrace{ (\dot{\theta}^2+\dot{\phi}^2)\cdot \sin(\theta)\cdot \cos(\phi)}_\text{Middelpuntzoekende versnellingen}}{.} } {+ \scaleleftright[1.5ex]{.}{\underbrace{\ddot{\theta}\cdot \cos(\theta)\cdot \cos(\phi) - \ddot{\phi}\cdot \sin(\theta)\cdot \sin(\phi)}_\text{Hoekversnellingen}}{)}}}
$$y=mx + b$$
\end{subequations}
\end{document}


Here's an alternative with the parens normal size, the 2nd line of the equation horizontally centered, and the equation number vertically centered.

\documentclass{article}
\usepackage{amsmath}
\usepackage{stackengine}
\usepackage{scalerel}
\stackMath
\begin{document}
\begin{subequations}
\abovebaseline[-7.5ex]{% \ddot{x}=R\cdot\def\stackalignment{c}\stackunder[12pt]% {(\underbrace{-2\cdot\dot{\theta}\cdot\dot{\phi}\cdot \cos(\theta)\cdot \sin(\phi)}_\text{Coriolisversnelling} - \underbrace{ (\dot{\theta}^2+\dot{\phi}^2)\cdot \sin(\theta)\cdot \cos(\phi)}_\text{Middelpuntzoekende versnellingen} } {+ \underbrace{\ddot{\theta}\cdot \cos(\theta)\cdot \cos(\phi) - \ddot{\phi}\cdot \sin(\theta)\cdot \sin(\phi)}_\text{Hoekversnellingen})}}
$$y=mx + b$$
\end{subequations}
\end{document}