0

I have an equation:

\begin{equation}
MMAV1 = \frac{1}{N} \sum_{n=1}^N \omega_n|x_n|, \\
\omega_n =
\begin{cases}
1 & if 0.25N \leq n \leq 0.75N \\
0.5 & otherwise \\
\end{cases}
\label{equ:MMAV1}
\end{equation}

and I want the cases to be displayed on the next line. I have tried using \begin{align} but that splits it into two equations with two reference numbers.

Does somebody know how to do this?

  • 1
    Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. – Pier Paolo Feb 19 '15 at 14:13
1

You can use aligned instead of align environment

\begin{equation}
\begin{aligned}
\text{MMAV1} &= \frac{1}{N} \sum_{n=1}^N \omega_n|x_n|\,, \\
\omega_n &=
\begin{cases}
1 & \text{if $0.25N \leq n \leq 0.75N$} \\
0.5 & \text{otherwise}
\end{cases}\,.
\end{aligned}
\label{equ:MMAV1}
\end{equation}

Of course, you can ommit the \\ after \omega_n, if you do not want only the cases to be in a different line.

Also the split environment can do the trick (same use).

Both of the above need the amsmath package.

  • Ah yes. It is as simple as that. I wonder why it did not auto complete to "aligned" for me when I started typing "\begin{align...". Also, what does the & do in front of the equal sign that you added? – Sigmundur Feb 19 '15 at 14:26
  • @Sigmundur the & sign in the first equation set a "column" where every other & will be placed. In the above example, the two equal signs will be the one under the other. Try to move the first & before \sum to see the difference, or the second one before \begin. – Theo Feb 19 '15 at 14:50
  • i don't think you want the \\ after the \omega_n on the second line. and there also needs to be an \end{equation] since that environment has been begun. – barbara beeton Feb 19 '15 at 14:50
  • Ah yes. I see now. It aligns the two equal signs just like in the cases to keep them aligned. @barbara beeton correct. I don't want it and thus have removed it. Ending the equation was a given :) Thanks for the help. Now I have everything I need for my equations to be properly formatted. :) – Sigmundur Feb 19 '15 at 14:55
  • @barbara beeton you are right for the \end{equation}. However, I tried to change the examlpe that Sigmundur asked and to do exactly what he asked for (I want the cases to be displayed on the next line). I commented the other issues right after my example. – Theo Feb 19 '15 at 14:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.