9

I just saw this question but it doesn't answer mine. How do I define a function something like

f(x) = { bla bla if x<0 bla bla if x>0

The above question doesn't answer how to write f(x) before the bracket

Please help.

1
  • 5
    If you want f(x)= before the bracket, then just write f(x)= before the \begin{cases} (and after the $ or \[)
    – marsupilam
    Apr 21, 2017 at 17:38

2 Answers 2

21

LaTeX is very flexible. Although it is not WYSIWYG you can write it in a very logical way. So if you want to have to have f(x) precede your cases, just write it that way. Here with the example of the linked question.

cases

\documentclass{article}
\usepackage{amsmath}

\begin{document}
    \[ f(x) = \begin{cases} 
          0 & x\leq 0 \\
          \frac{100-x}{100} & 0\leq x\leq 100 \\
          0 & 100\leq x 
       \end{cases}
    \]
\end{document}
3
  • @Zarko C&P from the linked post in OP. I should have looked at it ;) But I'm too lazy to change for now.
    – TeXnician
    Apr 21, 2017 at 17:46
  • Say, instead of a left curly brace is it possible to define a left bracket i.e, "[" for this command
    – Cristofer
    Jan 30 at 13:44
  • @Cristofer That's not built into LaTeX. While you can cheat using \left[\begin{array}{ll}…\end{array}\right. it's better to ask a new question with your specific requirements.
    – TeXnician
    Jan 31 at 9:41
5

TeX is very flexible. Although it is not WYSIWYG you can write it in a very logical way. So if you want to have to have f(x) precede your cases, just write it that way.

$$
  f(x) = \cases{        0       & $x\le 0$ \cr
                 100-x\over 100 & $0\le x\le 100$ \cr
                        0       & $100\le x$ }
$$
\bye
1
  • 3
    Maybe someone didn't understand the joke :-)
    – wipet
    Jun 9, 2020 at 17:26

You must log in to answer this question.

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