This question already has an answer here:

Suppose we want to write about a function in a question that is defined by cases. In our note books we generally write "$f(x) =$" and then we give a big curly left bracket, and then define various values the function is to take in different domains. How to write this here? I mean can someone give me the syntax?


marked as duplicate by user642796 Dec 8 '15 at 20:41

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • $\begingroup$ Specifically, this answer in the MathJax tutorial thread. $\endgroup$ – user642796 Dec 8 '15 at 20:41

The environment for that is cases, you use it as

$$f(x) = \begin{cases} 0 &, x < 0 \\
                       1 & 0 \leqslant x \leqslant 2 \\
                     -\pi &, x > 2.\end{cases}$$

(line breaks and indentation to be adjusted by personal preference, I chose an odd layout here to avoid scroll bars for the code sample) to produce

$$f(x) = \begin{cases} 0 &, x < 0 \\ 1 & 0 \leqslant x \leqslant 2 \\ -\pi &, x > 2.\end{cases}$$

  • $\begingroup$ Extremely useful. Thank you very much @Daniel Fisher $\endgroup$ – Qwerty Dec 8 '15 at 20:45

Not the answer you're looking for? Browse other questions tagged .