# Split within align* environment

Here's what I'm trying to achieve:

Here's my MWE:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align*}
\displaystyle\int_{-a}^{+a}f(x)e^{-i\frac{n\pi x}{a}}\; dx = \sum_{n=-\infty}^{+\infty}c_n\int_{-a}^{+a}e^{i(n-m)\frac{\pi x}{a}}\; dx = \\
\text{for } n \neq m: \quad \int_{-a}^{+a}e^{-i\frac{n\pi x}{a}}\; dx
\begin{split}
&=  \left[\frac{e^{i(n-m)\frac{\pi x}{a}}}{i(n-m)\frac{\pi}{a}}\right]^{+a}_{-a} = \frac{e^{i(n-m)\pi}-e^{-i(n-m)\pi}}{i(n-m)\frac{\pi}{a}}\\
&=\frac{(-1)^{n-m}-(-1)^{n-m}}{i(n-m)\frac{\pi}{a}} = 0
\end{split}\\
\text{for } n   =  m: \quad \int_{-a}^{+a}e^{-i\frac{n\pi x}{a}}\; dx
\end{align*}
\end{document}

• Not \begin{split}, but \begin{aligned}[t]. Remove \displaystyle that doesn nothing at all. The space before the differential should be \, and not \;. Commented Sep 17, 2015 at 22:36

With some improvements:

\documentclass{article}
\usepackage{amsmath}
\begin{document}

\begin{align*}
&\int_{-a}^{+a}f(x)e^{-i\frac{n\pi x}{a}}\, dx
= \sum_{n=-\infty}^{+\infty}c_n\int_{-a}^{+a}e^{i(n-m)\frac{\pi x}{a}}\, dx\\
&\text{for $n \neq m$:} \quad \int_{-a}^{+a}e^{-i\frac{n\pi x}{a}}\, dx
\begin{aligned}[t]
&=  \left[\frac{e^{i(n-m)\frac{\pi x}{a}}}{i(n-m)\frac{\pi}{a}}\right]^{+a}_{-a} =
\frac{e^{i(n-m)\pi}-e^{-i(n-m)\pi}}{i(n-m)\frac{\pi}{a}}\\
&=\frac{(-1)^{n-m}-(-1)^{n-m}}{i(n-m)\frac{\pi}{a}} = 0
\end{aligned}\\
&\text{for $n=m$:} \quad \int_{-a}^{+a}e^{-i\frac{n\pi x}{a}}\, dx = \int_{-a}^a dx = 2a
\end{align*}

\end{document}

The trick is aligned with the [t] specifier.

• Excellent! Thanks for the improvements too - all duly noted. Commented Sep 17, 2015 at 23:08