Using "cases" inside "equation" gives error[with "amsmath" loaded]
In the displaymath mode, you can not use any paragraph triggering commands such as blank lines or \par
commands. (Not a good idea, but you can use it inside the cases environment). Also you don't need to switch to text mode and then again to math mode. You can just use text on the text and leave the rest as it is.
Another point is the use of &
characters which is the column delimiter that should be used inside the cases
environment. This would be apparent if one of the cases starts with 1250
and the other is 1
which would lead to a bad alignment (try without the &
characters!).
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{equation*}
X(\omega) = \begin{cases}
1 &\text{se $\omega\in A$}\\
1250 &\text{se $\omega \in A^c$}
\end{cases}
\end{equation*}
\end{document}
Also mathtools
package provides some nice extensions and bugfixes of amsmath
, so here is an example of dcases*
environment which automatically switches to text mode in the second entry of the case declaration:
\documentclass{article}
\usepackage{mathtools}
\begin{document}
\[
X(\omega) = \begin{dcases*}
1 & se $\omega\in A$\\
0 & se $\omega \in A^c$
\end{dcases*}
\]
\end{document}
If you are using the standalone
class (which gives errors) then you have to use it as
\documentclass[preview]{standalone}