Math Piecewise style, which one is correct/best?

100 Views Asked by At

I am writing my Computer Science Master Thesis. I am wondering what is the correct or in your opinion best looking style for piecewises:

See examples below:

  1. Do I use a comma at the end of each line (ex last line)?
  2. Do I end the last line with a dot?
  3. Do I use a separator, and if yes which (in this example a colon) to seperate condition and formula?
  4. What other things are stylewise wrong in the example below?

$$f(x) = \left\{ \begin{array}{lr} 0 & : x \leq 0, \\ 1 & : x > 0. \end{array} \right.$$

4

There are 4 best solutions below

1
On

I usually would write with a semicolon, so $$\begin{cases}0;& x\leq 0\\ 1;& x>0\end{cases}$$ but it's a matter of preference. I remember having the same question, I just asked my supervisor.

3
On

I wouldn't use an array command; there already exists the cases environment which takes care of the brackets etc.:

$$f(x)=\begin{cases}0, & x<0, \\ 1, & x\geq 1.\end{cases}$$

I personally would use a colon as the separator, but these style-questions shouldn't really matter. If you want to be absolutely sure ask your supervisor.

0
On

Best practice is to ask your master's thesis supervisor if your Computer Science department has a required/recommended LaTeX style/class file that you should/could use for writing up your master's thesis as a whole (and that's not just for piecewise definitions of functions). If said file is not available, ask your CS department for the thesis layout guidelines, if there are any.

0
On

I use

$$f(x)=\begin{cases}0, & \text{if $x<0$;} \\ 
    1, & \text{if $x\geq 0$.}\end{cases}$$

resulting in

$$f(x)=\begin{cases}0, & \text{if $x<0$;} \\ 1, & \text{if $x\geq 0$.}\end{cases}$$

IIRC this was also suggested by the authors of AMSmath.