I'm trying to align equations with already aligned case by case answers in them

What I am currently getting is:

and what I need is to align all the equals signs throughout the function

The required excerpt from my LaTex is

\documentclass[10pt,a4paper]{article}
\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\usepackage{mathtools}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{csquotes}

\begin{document}

\begin{multline}
\langle \cos(m \omega x), \cos(n \omega x) \rangle =\frac{1}{T}\int_{-T/2}^{T/2}\cos({m \omega x}) \cos({n \omega x}) dx =
\begin{cases}
0 & \text{if } {m \neq n }  \\
\frac{1}{2} & \text{if } {m = n} > 0 \\
1 & \text{if } {m = n} = 0 \\
\end{cases} \\
\langle \sin(m \omega x), \sin(n \omega x) \rangle =\frac{1}{T}\int_{-T/2}^{T/2}\sin({m \omega x}) \sin({n \omega x}) dx =
\begin{cases}
0 & \text{if } {m \neq n }  \\
\frac{1}{2} & \text{if } {m = n} > 0 \\
1 & \text{if } {m = n} = 0 \\
\end{cases}\\
\langle \sin(m \omega x), \cos(n \omega x) \rangle =\frac{1}{T}\int_{-T/2}^{T/2}\sin({m \omega x}) \cos({n \omega x}) dx = 0
\end{multline}

\end{document}


I've tried using

\begin{aligned}[t]
one function with cases
\end{aligned}\\
\begin{algined}[t]
next function with cases
\end{aligned}\\
\begin{algined}[t]
next function without cases
\end{aligned}\\


inside the \begin{multline}...\end{multiline}, but I've had no success.

I assume it can be done given that I can see it in this paper, but I am very new to LaTex. It would be interesting to know how it is able to deal with this sort of alignment issue, given that for each equation, there are different amounts of equals signs, and therefore different amounts of alignments required.

Is there are way of replacing the active symbol & for aligned and not case?

There is a simple solution, instead of multiline directly use the align-environment, which is automatically in math-mode and allows various alignment operations. To simply align at the = sign, use the &-sign. You can also have additional &-signs for formatting.

 \documentclass[11pt]{article}
\usepackage{amsmath}
\begin{document}
\begin{align}
\langle \cos(m \omega x), \cos(n \omega x) \rangle &=\frac{1}{T}\int_{-T/2}^{T/2}\cos({m \omega x}) \cos({n \omega x}) dx =
\begin{cases}
0 & \text{if } {m \neq n }  \\
\frac{1}{2} & \text{if } {m = n} > 0 \\
1 & \text{if } {m = n} = 0 \\
\end{cases} \\
\langle \sin(m \omega x), \sin(n \omega x) \rangle &=\frac{1}{T}\int_{-T/2}^{T/2}\sin({m \omega x}) \sin({n \omega x}) dx =
\begin{cases}
0 & \text{if } {m \neq n }  \\
\frac{1}{2} & \text{if } {m = n} > 0 \\
1 & \text{if } {m = n} = 0 \\
\end{cases}\\
\langle \sin(m \omega x), \cos(n \omega x) \rangle &=\frac{1}{T}\int_{-T/2}^{T/2}\sin({m \omega x}) \cos({n \omega x}) dx = 0
\end{align}
\end{document}

• You genius. I wish I'd put this up an hour ago! I was trying to only have one equation number for all the orthogonal relationships, hence the multiline, but hey, it's latex so all the references will update. Cheers Jan 20, 2016 at 22:02
• I also realise now that trying to have one equation number for multiple equations is completely illogical and that's why Latex didn't like it. Thanks again Jan 20, 2016 at 22:03
• If you don't want to use equation numbers on the right, you can use align*, then no equation number on the right is shown. Jan 20, 2016 at 22:08
• if you want just one equation number, then use equation with a nested aligned. Jan 21, 2016 at 15:51
• a nested align doesn't work with the cases. I've found out now what to do to only get one equation number for multiple equations is to do a single split inside the equation (no align, gives one equation number) Feb 16, 2016 at 22:31