0

I want to align multiple split environments. As of now, I've checked these answers, but none of them did the trick. How can I align two split environments at the equal signs? , how to get two align point with split equations and Multiple alignment

I want that in the code below all the = signs to be aligned, while having separate numbers each. However, I am not sure if I am taking the correct approach. Thank you in advance.

enter image description here

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\begin{document}
\begin{align}
\begin{split}
Y^{\text{I}}_{n} &= \alpha_{i} + \delta X_{1,n} \\
    & +X_{2,int} \times[ 
    \beta_{1} + 
    \beta_{2} z_{1} +
    \beta_{3} z_{2} +
    \beta_{4} z_{3} \\
& +\beta_{5} z_{1} z_{2} +
    \beta_{6} z_{1} z_{3} +
    \beta_{7} z_{2} z_{3} ]\\
 & +X_{3,int} \times[  
    \gamma_{1} + 
    \gamma_{2} z_{1} +
    \gamma_{3} z_{2} +
    \gamma_{4} z_{3} \\
& + \gamma_{5} z_{1} z_{2} +
    \gamma_{6} z_{1} z_{3} +
    \gamma_{7} z_{2} z_{3} ]\\
\end{split}\\
\begin{split}
Y^{\text{II}}_{int} &= \alpha_{i} +\delta X_{1,n} \\
& + X_{2,n}\times\exp[ \mu_{1}  + \sigma_{1} u_{1}] - X_{2,n}\times\exp[\eta_{1}  + \sigma_{2} u_{2}]
\end{split} \\
\begin{split}
Y^{\text{III}}_{n} &= \alpha_{i} + \delta X_{1,n} \\
& + \exp[\mu_{1} + 
\mu_{2} z_{1} +
\mu_{3} z_{2} +
\mu_{4} z_{3}  + \sigma_{1} u_{1}]\times X_{2,n}\\
& + \exp[\eta_{1} + 
\eta_{2} z_{1,n} +
\eta_{3} z_{2,n} +
\eta_{4} z_{3,n} + \sigma_{2} u_{2}]\times X_{3,n}
\end{split}         
\end{align}
\end{document}
David Carlisle
  • 757,742
  • 1
    Unrelated, don't use \text here, it does not do what you think, \mathrm is better. – daleif Nov 22 '22 at 11:07
  • 1
    I'd align the Y line via ={} &. Plus remove the \\ from the last row of the first split what seems to do things it shouldn't and then things align again. – daleif Nov 22 '22 at 11:14
  • 1
    also _{int} should be _{\mathrm{int}} math italic makes it look like i times n times t – David Carlisle Nov 22 '22 at 11:16
  • You could just use align and \notag to put the equation numbers on the last line instead of the middle. – John Kormylo Nov 22 '22 at 13:33

2 Answers2

2

split is very sensitive to \\ and you have one extra one at the end of the first split.

Change

    \gamma_{7} z_{2} z_{3} ]\\

to

    \gamma_{7} z_{2} z_{3} ]

enter image description here

Or with some minor adjustments

enter image description here

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\begin{document}
\begin{align}
\begin{split}
Y^{\mathrm{I}}_{n} ={}& \alpha_{i} + \delta X_{1,n} \\
    & +X_{2,int} \times[ 
    \beta_{1} + 
    \beta_{2} z_{1} +
    \beta_{3} z_{2} +
    \beta_{4} z_{3} \\
& +\beta_{5} z_{1} z_{2} +
    \beta_{6} z_{1} z_{3} +
    \beta_{7} z_{2} z_{3} ]\\
 & +X_{3,int} \times[  
    \gamma_{1} + 
    \gamma_{2} z_{1} +
    \gamma_{3} z_{2} +
    \gamma_{4} z_{3} \\
& + \gamma_{5} z_{1} z_{2} +
    \gamma_{6} z_{1} z_{3} +
    \gamma_{7} z_{2} z_{3} ]
\end{split}\\
\begin{split}
Y^{\mathrm{II}}_{\mathrm{int}} ={}& \alpha_{i} +\delta X_{1,n} \\
& + X_{2,n}\times\exp[ \mu_{1}  + \sigma_{1} u_{1}] - X_{2,n}\times\exp[\eta_{1}  + \sigma_{2} u_{2}]
\end{split} \\
\begin{split}
Y^{\mathrm{III}}_{n} ={}& \alpha_{i} + \delta X_{1,n} \\
& + \exp[\mu_{1} + 
\mu_{2} z_{1} +
\mu_{3} z_{2} +
\mu_{4} z_{3}  + \sigma_{1} u_{1}]\times X_{2,n}\\
& + \exp[\eta_{1} + 
\eta_{2} z_{1,n} +
\eta_{3} z_{2,n} +
\eta_{4} z_{3,n} + \sigma_{2} u_{2}]\times X_{3,n}
\end{split}         
\end{align}
\end{document}
David Carlisle
  • 757,742
2

In addition to Davids answer, here's what I'd do

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\begin{document}
\begin{align}
  \begin{split}
    Y^{\mathrm{I}}_{n} = {} & \alpha_{i} + \delta X_{1,n} \\
    & +X_{2,int} \times[ 
    \beta_{1} + 
    \beta_{2} z_{1} +
    \beta_{3} z_{2} +
    \beta_{4} z_{3} \\
    & +\beta_{5} z_{1} z_{2} +
    \beta_{6} z_{1} z_{3} +
    \beta_{7} z_{2} z_{3} ]\\
    & +X_{3,int} \times[  
    \gamma_{1} + 
    \gamma_{2} z_{1} +
    \gamma_{3} z_{2} +
    \gamma_{4} z_{3} \\
    & + \gamma_{5} z_{1} z_{2} +
    \gamma_{6} z_{1} z_{3} +
    \gamma_{7} z_{2} z_{3} ]
  \end{split}
  \\
  \begin{split}
    Y^{\mathrm{II}}_{int} = {} & \alpha_{i} +\delta X_{1,n} \\
    & + X_{2,n}\times\exp[ \mu_{1}  + \sigma_{1} u_{1}] - X_{2,n}\times\exp[\eta_{1}  + \sigma_{2} u_{2}]
  \end{split}
  \\
  \begin{split}
    Y^{\mathrm{III}}_{n} = {} & \alpha_{i} + \delta X_{1,n} \\
    & + \exp[\mu_{1} + 
    \mu_{2} z_{1} +
    \mu_{3} z_{2} +
    \mu_{4} z_{3}  + \sigma_{1} u_{1}]\times X_{2,n}\\
    & + \exp[\eta_{1} + 
    \eta_{2} z_{1,n} +
    \eta_{3} z_{2,n} +
    \eta_{4} z_{3,n} + \sigma_{2} u_{2}]\times X_{3,n}
  \end{split}         
\end{align}
\end{document}

Here we move the + alignment such that it is not below the = as that looks bad. I also replaced \text by \mathrm. Why, try adding \itshape before \begin{align}!

enter image description here

daleif
  • 54,450