# Splitting single equation at multiple points

I wish to split a single equation into 3 lines aligning the front of the first line with the front of the second and the end of the third line with the end of the second. This equation needs a number aligned vertically in the middle. The closest I came is using align:

\begin{align}\label{e:5.39}
\bigg(&y_{tt}(x,t)+2v(t)y_{xt}(x,t)+v(t)^2y_{xx}(x,t)\nonumber\\
&\begin{split}+\Big(\dot{v}(t)+\frac{L_0\rho v(t)^2}{m}+\big(\frac{g t_c^2}{L_0}-\epsilon_a\dot{v}(t)\big)+\frac{c_m t_c v(t)^2}{m}\Big)y_{x}(x,t)&\\
+\Big(\frac{L_0\rho v(t)}{m}+\frac{c_m t_c}{m}\Big)y_{t}(x,t)-\frac{t_c^2}{L_0m}\big(\bar{P}(t t_c)+\bar{R}(L_0 x)\big)&\bigg)_{x=l(t)}=0
\end{split}\end{align}


I do not see the code generating correctly so I am also attaching an image:

The red lines indicate desired alignment. If this is possible, could someone give me a simple example of how to do it correctly?

Thank You,

• Use equation instead of align; move the split-environment "up" one line; have only one ampersand per line and put each of them directly before the + signs. Also, please provide a full MWE. Feb 1, 2021 at 12:25
• with manual tweak: \begin{alignat}{2}\label{e:5.39} \biggl( &y_{tt}(x,t)+2v(t)y_{xt}(x,t)+v(t)^2y_{xx}(x,t) & \notag \\ & {} + \biggl(\dot{v}(t)+\frac{L_0\rho v(t)^2}{m}+ \biggl(\frac{g t_c^2}{L_0}-\epsilon_a\dot{v}(t)\biggr)+\frac{c_m t_c v(t)^2}{m}\biggr)y_{x}(x,t) & \\ &\qquad\ + \biggl(\frac{L_0\rho v(t)}{m}+\frac{c_m t_c}{m}\biggr) y_{t}(x,t)-\frac{t_c^2}{L_0m} \Bigl(\bar{P}(t_c)+\bar{R}(L_0 x)\Bigr) &\biggr)_{x=l(t)}=0 \notag \end{alignat} Feb 1, 2021 at 12:39

I've changed a couple of brackets (my taste, you can of course change it back). Note that you should never use \big but rather \bigl/\bigr, otherwise you might get wrong spacing.

\documentclass{article}

\usepackage{amsmath}

% for snapshot
\usepackage{xcolor}
\newcommand*{\foo}{\setbox0=\hbox to 0pt{\hss\textcolor{red}{\vrule width.2pt depth1.5cm\hss}}\dp0=0pt\box0}

\begin{document}

\begin{aligned} \biggl[ & \foo y_{tt}(x,t) + 2v(t) y_{xt}(x,t) + v(t)^2 y_{xx}(x,t) \\ & \begin{aligned}[t] {}+ \biggl(\dot{v}(t) + \frac{L_0\rho v(t)^2}{m} + \Bigl(\frac{g t_c^2}{L_0}-\epsilon_a\dot{v}(t)\Bigr) + \frac{c_m t_c v(t)^2}{m} \biggr) y_{x}(x,t) \foo & \\ {}+ \Bigl(\frac{L_0\rho v(t)}{m}+\frac{c_m t_c}{m}\Bigr)y_{t}(x,t) -\frac{t_c^2}{L_0m}\bigl(\bar{P}(t t_c)+\bar{R}(L_0 x)\bigr)&\biggr]_{x=l(t)}=0 \end{aligned} \end{aligned}

\end{document}


If you really want the plus sign to be aligned with the upper line you need to correct the spacing manually

\begin{aligned} \biggl[ & \foo y_{tt}(x,t) + 2v(t) y_{xt}(x,t) + v(t)^2 y_{xx}(x,t) \\ & \begin{aligned}[t] + \mkern\medmuskip \biggl(\dot{v}(t) + \frac{L_0\rho v(t)^2}{m} + \Bigl(\frac{g t_c^2}{L_0}-\epsilon_a\dot{v}(t)\Bigr) + \frac{c_m t_c v(t)^2}{m} \biggr) y_{x}(x,t) \foo & \\ {}+ \Bigl(\frac{L_0\rho v(t)}{m}+\frac{c_m t_c}{m}\Bigr)y_{t}(x,t) -\frac{t_c^2}{L_0m}\bigl(\bar{P}(t t_c)+\bar{R}(L_0 x)\bigr)&\biggr]_{x=l(t)}=0 \end{aligned} \end{aligned}


• The alignment in your version is semantically as well as structurally misleading: Within the outermost brackets, all three lines are on the same level, mathematically speaking; however, by indenting the third line more than the second one you imply that this third line is somewhat subordinate to the second line. When you align at the + signs, the reader immediately sees that those lines are summands of the same addition. Feb 1, 2021 at 13:35
• @Lupino In principle I fully agree with you, and I would never type the equation like this. However, this was precisely the request of the question. I know, we shouldn't always give the answers we are asked for... Feb 1, 2021 at 13:39
• Yes, this is exactly what I was looking for. Thank you. Feb 1, 2021 at 13:54

align is usually used to distinguish a single equation from equation systems. If you want to split a single equation across multiple lines, you may use the split environemnt within the equation environment.

What you basicly did in your example was to tell LaTeX that you have an equation system with two equations, where the first one should have no number, and the second one does have a number and is split across two lines (therefore, the number was placed between "lines" 2 and 3).

In order to fix this, you need to tell LaTeX that there is one equation only (equation-environment), that is split across three lines (split environment with two \\). This will place the number of that single equation vertically centered across the three lines. You further want to tell LaTeX where to align those equation lines by placing the &: split can only have one & that are positioned right below each other. Text left of the & is right-aligned; text right of the & is left-aligned:

\documentclass{book}
\RequirePackage{amsmath}
\begin{document}
$$\label{e:5.39} \begin{split} \bigg(&y_{tt}(x,t)+2v(t)y_{xt}(x,t)+v(t)^2y_{xx}(x,t)\\ &+\Big(\dot{v}(t)+\frac{L_0\rho v(t)^2}{m}+\big(\frac{g t_c^2}{L_0}-\epsilon_a\dot{v}(t)\big)+\frac{c_m t_c v(t)^2}{m}\Big)y_{x}(x,t)\\ &+\Big(\frac{L_0\rho v(t)}{m}+\frac{c_m t_c}{m}\Big)y_{t}(x,t)-\frac{t_c^2}{L_0m}\big(\bar{P}(t t_c)+\bar{R}(L_0 x)\big)\bigg)_{x=l(t)}=0 \end{split}$$
\end{document}


Output:

• Yes, this would be my default way of splitting this equation. I just wanted to know if it is possible for the outer brackets to horizontally encompass the equation thus shifting the third line to the right. Thanks. Feb 1, 2021 at 13:49
• @Matsz09 i would strongly advice against it as it would make your equation harder to comprehend. However, if you insist, you could "move" the third line to the right by adding \quad or even \qquad between the & and the + in the third line. Feb 1, 2021 at 13:52