I have the following code:
\documentclass[fleqn, 12pt]{article}
\usepackage{amsmath,amsfonts,amssymb}
\usepackage{graphicx}
\graphicspath{ {./images/} }
\setlength{\parskip}{\baselineskip}%
\setlength{\parindent}{0pt}%
\begin{document}
\raggedright
From the model,
\begin{align}
&E( Y_i - \bar{ Y } ) = E[ ( \beta_0 + \beta_1 X_i ) - ( \beta_0 - \beta_1 \bar{ X } ) ] \nonumber \\
&( \text{Since the first normal equation gives} \ \ Y_i = \beta_0 + \beta_1 X_i \ \ \text{and} \ \ \bar{Y} = \beta_0 + \beta_1 \bar{X}) \nonumber \\
& \ \ \ \ \ \ \ \ \ \ \ \ \ \ = \beta_1( X_i - \bar{X} ) \nonumber
\end{align}
\end{document}
Notice that the lines
&E( Y_i - \bar{ Y } ) = E[ ( \beta_0 + \beta_1 X_i ) - ( \beta_0 - \beta_1 \bar{ X } ) ] \nonumber \\
and
& \ \ \ \ \ \ \ \ \ \ \ \ \ \ = \beta_1( X_i - \bar{X} ) \nonumber
are separated by the line
&( \text{Since the first normal equation gives} \ \ Y_i = \beta_0 + \beta_1 X_i \ \ \text{and} \ \ \bar{Y} = \beta_0 + \beta_1 \bar{X}) \nonumber \\
Despite this, I want the line
& \ \ \ \ \ \ \ \ \ \ \ \ \ \ = \beta_1( X_i - \bar{X} ) \nonumber
to line up at the = sign with the first line
&E( Y_i - \bar{ Y } ) = E[ ( \beta_0 + \beta_1 X_i ) - ( \beta_0 - \beta_1 \bar{ X } ) ] \nonumber \\
This is why I put the \ \ \ \ \ \ \ \ \ \ \ \ \ \
Is it possible to somehow do this using &
, whilst maintaining the line in the middle as it is? Or, perhaps, some other way to automatically have them align?
EDIT: The reason I had to use &
to put the middle line as its own line is because, if I put it on the same line as the first equation, then it would go off the page margin.
Thanks.
since the first normal equation gives $Y_i = \beta_0 + \beta_1 X_i$ and $\bar{Y} = \beta_0 + \beta_1 \bar{X}$.
after the display? There's little added value (if any) from putting the comment in the middle. – egreg Jun 3 '18 at 14:07