# How to manage the position of intertext within align

\begin{equation*}
\begin{aligned}
E(X) & = \sum_{x=0}^{\infty}x\frac{e^{ - \lambda }\lambda ^x}{x!} \\
& = \sum_{x=0}^{\infty} \frac{e^{ - \lambda }\lambda ^x }{(x-1)!} \\
& = \sum_{x=1}^{\infty}\frac{e^{ - \lambda } \lambda ^x }{(x-1)!} \\
& = \lambda \sum_{x=1}^{\infty} \frac{e^{ - \lambda } \lambda ^{(x-1)} }{(x-1)!} \\
\shortintertext{Now, let us substitute x-1 by y, then}
E(X) & = \lambda \sum_{y=0}^{\infty} \frac{e^{ - \lambda } \lambda^y }{y!} \\
& = \lambda
\end{aligned}
\end{equation*}


My code and the result displayed are as above, how can I move that intertext to the left? Also, how can I reduce the space before the aligned part? I'm using packages amsmath and mathtools.

You write your equation an quite complicated way. Tray:

\documentclass{article}
\usepackage{mathtools}

\usepackage[active,displaymath,tightpage]{preview}% for show only tcolorbox
\setlength\PreviewBorder{1em}

\begin{document}
\begin{align*}
E(X) & = \sum_{x=0}^{\infty}x\frac{e^{ - \lambda }\lambda ^x}{x!} \\
& = \sum_{x=0}^{\infty} \frac{e^{ - \lambda }\lambda ^x }{(x-1)!} \\
& = \sum_{x=1}^{\infty}\frac{e^{ - \lambda } \lambda ^x }{(x-1)!} \\
& = \lambda \sum_{x=1}^{\infty} \frac{e^{ - \lambda } \lambda ^{(x-1)} }{(x-1)!}
\shortintertext{Now, let us substitute $x-1$ by $y$, then}
E(X) & = \lambda \sum_{y=0}^{\infty} \frac{e^{ - \lambda } \lambda^y }{y!} \\
& = \lambda
\end{align*}
\end{document}


which gives:

The cause of your problem seems to be equation* environment which doesn't allow to use \intertext or shortintertext in it.

• @AudreyFeng, glad to hear this! Than you can accept answer (by tick on the check mark at the top left of answer ...) :-) – Zarko Jan 22 '16 at 4:27