# Split an equation into two lines

I have four consecutive equations. The third equation needs to be split into two. I need all the equations aligned. Also, instead of having each equation numbered separately, I want only one number indexing all the equations. I have written the following codes to implement it. However, the third equation's split does not look too nice. In addition, the right-hand side of each equation is very close to the "=" sign. Here is my output:

\begin{aligned} SRI = & P\hat{P_x}+(1-P)(1-\hat{P_x}) \\ Var(SR)= & m^{-1}SRI(1-SRI) \\ Var(SRI) = & m^{-1}(2P-1)^2\hat{P_x}(1-\hat{P_x})+ m^{-1}(2\hat{P_x}-1)^2P_y(1-P_y)+ \\ & 4m^{-2}\hat{P_y}\hat{P_x}(1-P_y(1-\hat{P_x}) \\ P= & m^{-1}\sum_{j=1}^mI(\bar{\sigma}_{t+j}) \end{aligned}


Could you suggest some improvements, please?

I would do this with alignedat and \widehat. Also, maybe I'm wrong, but I doubt that SRI and the like denote the product of the three variables S, R, I or Var is the product of V, a, r.

\documentclass{article}
\usepackage{mathtools}
\DeclareMathOperator{\Var}{Var}
\newcommand{\SR}{\mathit{SR}}
\newcommand{\SRI}{\mathit{SRI}}

\begin{document}

\begin{alignedat}{2} \SRI &= P\widehat{P}_x+(1-P)(1-\widehat{P}_x) \\ \Var(\SR) &= m^{-1}\SRI(1-\SRI) \\ \Var(\SRI) &= m^{-1}(2P-1)^2\widehat{P}_x(1-\widehat{P}_x) & &{}+ m^{-1}(2\widehat{P}_x-1)^2P_y(1-P_y) \\ & & &{}+ 4m^{-2}\widehat{P}_y\widehat{P}_x(1-P_y(1-\widehat{P}_x) \\ P &= m^{-1}\sum_{j=1}^mI(\bar{\sigma }_{t+j}) \end{alignedat}

\end{document}


• This is exactly what I wanted. The third equation is placed nicely. I am still in my early days in Latex. Would you please care to explain a few things? (1) Why use {}? (2) Why did you alignedat instead of aligned? I read online that alignedat requires you to specify the the number positions where you want alignments. But I don't quite understand that in this context. (3) Why use "&&{}" in the third equation? (4) In the second equation, you used both "\mathit{\SRI}" and "\SRI". Instead of using "\mathit{\SRI}", could you not just type "\SRI"? Finally, thanks a lot for chiming in. – TRa Oct 29 '17 at 21:59
• Yes, of course: (1) {}= is for a correct spacing of the = sign when there's nothing on the left. (2) and (3): alignedat gives you control on the spacing between columns of alignment. Here the first & denotes the beginning of the second column and immediately afterwards the alignment point, so there's no spacing between the two columns. (4) I forgot to replace , that's all. I've fixed it. – Bernard Oct 29 '17 at 22:12

Some suggestions and observations:

• In the fourth line, change & to &\quad, to provide some indentation of the line.

• Change all instances of = & to & = to improve the spacing around the = symbols.

• Change \hat{P_y} to \widehat{P}_y. Ditto for \hat{P_x}.

• Optional: If Var denotes "variance", it's a good idea to treat is a math operator (in TeX jargon) and to typeset using an upright rather than a slanted font.

• Optional: Typeset SRI and SR as variable names rather than as the products of the symbols S, R, and I.

Aside: I think a closing parenthesis is missing at the end of line 4.

\documentclass{article}
\usepackage{amsmat h} % for '\DeclareMathOperator' macro and 'split env.
\DeclareMathOperator{\Var}{Var}
\newcommand\vn[1]{\mathit{#1}}  % "variable name"
\begin{document}

$$\begin{split} \vn{SRI} &= P\widehat{P}_x+(1-P)(1-\widehat{P}_x) \\ \Var(\vn{SR}) &= m^{-1}\vn{SRI}(1-\vn{SRI}) \\ \Var(\vn{SRI})&= m^{-1}(2P-1)^2\widehat{P}_x(1-\widehat{P}_x) + m^{-1}(2\widehat{P}_x-1)^2P_y(1-P_y) \\ &\quad + 4m^{-2}\widehat{P}_y\widehat{P}_x(1-P_y(1-\widehat{P}_x) \\ P &= m^{-1} \sum_{j=1}^m I(\bar{\sigma}_{t+j}) \end{split}$$

\end{document}

• Thank you so much for all your inputs. Can you please explain why you use "split" instead of "aligned"? – TRa Oct 29 '17 at 7:59
• @TRa - Compared with the split environment, the aligned environment provides additional placement options. Since you're not using any of these options, I thought it was more straightforward to use split. – Mico Oct 29 '17 at 8:03
• Thank you so much for your time. I really appreciate it. – TRa Oct 29 '17 at 8:04
• I'd actually use aligned in most cases and not split. If the lines are short equation +aligned still uses equations space saving feature. AFAIR equation+split does not. So in a lot of cases using aligned looks a little better. But then again, you need to know what to look for to notice it. – daleif Oct 29 '17 at 16:27
• @daleif - Thanks. To be sure, for the equation at hand, the spacing is exactly the same whether a split or an aligned environment is used, regardless of the length of the final line of the immediately preceding paragraph. – Mico Oct 29 '17 at 16:57

Wrongly placed alignment tabs: they should be placed before the equal symbols.

My try:

\documentclass{article}
\usepackage{mathtools}
\begin{document}
\begin{aligned} SRI &= P\hat{P_x}+(1-P)(1-\hat{P_x}) \\ Var(SR) &= m^{-1}SRI(1-SRI) \\ Var(SRI) &= m^{-1}(2P-1)^2\hat{P_x}(1-\hat{P_x}) + m^{-1}(2\hat{P_x}-1)^2P_y(1-P_y) +\\ &\quad 4m^{-2}\hat{P_y}\hat{P_x}(1-P_y(1-\hat{P_x})\\ P &= m^{-1}\sum_{j=1}^mI(\bar{\sigma}_{t+j}) \end{aligned}
\end{document}


• Thanks, @Franck Pastor. That solves my problem partially. My third equation still needs some visual improvement. Preferably, the second line of the third equation more indented toward right... – TRa Oct 29 '17 at 7:52
• Then add a \quad before this second line, as Mico suggests. I've edited my answer accordingly. Don't forget, next time, to give us a complete minimal example (i.e. with \documentclass, \begin{document} and so on, it would be easier for us :-) – Franck Pastor Oct 29 '17 at 8:02
• although the plus at the end of the third line would really be better at the beginning of the next line, if it's really wanted where it is now, the spacing should be fixed. add an empty group, {} at the end of the line so that the plus is between two elements. – barbara beeton Oct 29 '17 at 15:25

I would typeset this as:

\begin{aligned} SRI & = P\hat{P_x}+(1-P)(1-\hat{P_x}) \\ Var(SR)& = m^{-1}SRI(1-SRI) \\ Var(SRI) & = m^{-1}(2P-1)^2\hat{P_x}(1-\hat{P_x})+ m^{-1}(2\hat{P_x}-1)^2P_y(1-P_y)+ \\ & \qquad +4m^{-2}\hat{P_y}\hat{P_x}(1-P_y(1-\hat{P_x}) \\ P& = m^{-1}\sum_{j=1}^mI(\bar{\sigma}_{t+j}) \end{aligned}


Note that I've written & =and not = &. Furthermore, I used a \qquad` at the sixth line.