2

I have the below two equations,

\begin{eqnarray}
\begin{split}
C_{N+1} &= h\left( X_{N+1}; \hat{\phi}_{N+1} \right)  + \left[ h\left( X_{N+1}; \phi_{N+1} \right) - h\left( X_{N+1}; \hat{\phi}_{N+1} \right)  \right] \\ 
& + u^{g}_{N+1} + u^{r}_{N+1}
\end{split}
\end{eqnarray}
\begin{eqnarray}
C_{N+1} &= h\left( X_{N+1}; \hat{\phi}_{N+1} \right)  + u^{\phi}_{N+1}  + u^{g}_{N+1} + u^{r}_{N+1}
\end{eqnarray}

which gets displayed as below:

enter image description here

How could I align both these equations at the = sign ?

What I intend to do is :

enter image description here

2 Answers 2

2

You don't really want to align the + sign with the = sign.

You can use split, but don't ever use eqnarray.

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{align}
\begin{split}
C_{N+1} &= h( X_{N+1}; \hat{\phi}_{N+1} )  + [ h( X_{N+1}; \phi_{N+1} ) - h( X_{N+1}; \hat{\phi}_{N+1} ) ] \\    
        &\qquad + u^{g}_{N+1} + u^{r}_{N+1}
\end{split}
\\[1ex]
C_{N+1} &= h( X_{N+1}; \hat{\phi}_{N+1} )  + u^{\phi}_{N+1}  + u^{g}_{N+1} + u^{r}_{N+1}
\end{align}

\end{document}

I removed all \left and \right commands and you can see that the formulas have become more readable.

enter image description here

1

The align package works without the eqnarray package! Solution as follows:

\begin{align}
C_{N+1} &= h\left( X_{N+1}; \hat{\phi}_{N+1} \right)  + \left[ h\left( X_{N+1}; \phi_{N+1} \right) - h\left( X_{N+1}; \hat{\phi}_{N+1} \right)  \right] \nonumber \\
& + u^{g}_{N+1} + u^{r}_{N+1} \\
C_{N+1} &= h\left( X_{N+1}; \hat{\phi}_{N+1} \right)  + u^{\phi}_{N+1}  + u^{g}_{N+1} + u^{r}_{N+1}
\end{align}

enter image description here

1
  • 1
    It is also common to use &\phantom{=}
    – Werner
    Commented Jan 27, 2022 at 4:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .