I'm trying to use the cases
environment inside an equation
environment.
The sample code is quite simple:
\begin{equation*}
X(\omega) = \begin{cases}
1 \text{se $\omega \in A$} \\
0 \text{se $\omega \in A^c$}
\end{cases}
\end{equation*}
Compiling it with Kile results in this error:
Missing $ inserted
and some other messages about ending delimiters not present.
I have \usepackage{amsmath}
at the beginning of my document.
Also I must tell you that I have an other piece of code, which is identical, and which works fine:
\begin{equation*}
B_i = \begin{cases}
A_i^c \text{se $i \in I$,}
\\
A_i \text{se $i \in I \smallsetminus I'$}.
\end{cases}
\end{equation*}
Also this piece gave me some errors the other day, then I changed the \begin{equation*} ... \end{equation*}
to $$
and $$
and it worked.
Replace $$
with the equation environment and the error was magically gone.
I've already tried doing this with that piece of code, but nothing changes.
cases
environment. You should be putting&
in front of\text
, but this isn't related to the error. – egreg Aug 18 '12 at 14:45\end{cases}
and\end{equation*}
fixes this issue. But I'm still interested in why something like this happens. I'll do some tests when I've got time, maybe this error is caused by thedefn
environment I'm using(defined using\newtheorem
). – Bakuriu Aug 18 '12 at 14:52