In the math mode, I am typing an equation and I am constantly getting errors such as

Undefined Control Sequence etc.

I have tried all things to my knowledge, but I am missing something. Can someone help me?

\begin{equation}
    \large \alpha_b = \left\{
      {\text{1, I_{i,r}^b \geq I_{thr}} \atop
      \text{0, I_{i,r}^b < I_{thr}}
    \right}
\end{equation}
  • 1
    _ is a math mode command. It must only appear in math mode. You have it within \text{ ... } which puts you in text mode unsurprisingly. So _ is undefined and fails – Au101 Nov 9 '16 at 3:53
  • Also you seem to have \right} at the end, where I assume you want \right\} – Au101 Nov 9 '16 at 3:58
up vote 8 down vote accepted

This is the correct way to type in the equation.

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{equation}
\alpha_b =
\begin{cases}
1, & I_{i,r}^b \geq I_{thr} \\
0, & I_{i,r}^b < I_{thr}
\end{cases}
\end{equation}

\end{document}

enter image description here

Depending on its meaning, “thr” could be better as

I_{\mathrm{thr}}

Use this if it's a textual abbreviation.


About your code, it's hard to find something right, I'm afraid.

The command \large is not allowed in math mode. Probably you wanted to use it for enlarging the result of \atop. But \atop is not to be used anywhere in LaTeX, if you load amsmath (and you do, because you have \text).

The command \text is used to insert textual parts in an equation, but you're using it for math parts; finally \right} is not allowed and it should be \right. for a null delimiter.

However, using a fraction for doing a cases environment is wrong to begin with. I'm quite surprised you know about \atop and not about cases. If \atop has been suggested to you by a friend, this could be a good occasion for breaking this friendship. ;-)

  • takes his TeX seriously, you understand? You don't wanna know what happened to the guy who ended all his paragraphs with \\ :P :) – Au101 Nov 9 '16 at 12:37
  • 2
    @Au101 Students who do that don't get their degree! – egreg Nov 9 '16 at 12:44
  • Maybe it's better to load mathtools instead of amsmath. (I know it doesn't make a difference here.) Also, what's the difference between \mathrm and \textup in the subscript? – Svend Tveskæg Nov 13 '16 at 20:16
  • 1
    @SvendTveskæg I think that mathtools should be rewritten from scratch, so I load it only when it's really necessary. – egreg Nov 13 '16 at 20:18
  • 1
    @Dr.ManuelKuehner The code is an unreadable mix of classical and obsolete expl3-like style. Very difficult to maintain. – egreg May 16 at 21:17

Here is a possible solution:

\documentclass{article}

\begin{document}

\begin{equation}
  \alpha_b
  = \left\{\frac{1, I_{i,r}^b \geq I_{thr}}{0, I_{i,r}^b < I_{thr}}\right\}
\end{equation}
or
\begin{equation}
  \alpha_b
  = \left\{\frac{1, I_{i,r}^b \geq I_{\mathrm{thr}}}{0, I_{i,r}^b < I_{\mathrm{thr}}}\right\}
\end{equation}

\end{document}

output

The latter should be used if the subscripts to the right are text.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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