The minus sign and the case

This is because the - acts like a binary operator within your context (\text{for } on the left and 1 on the right). You can either place everything in the conditional clause of cases inside \text and escape math as necessary, or make the operator unary (with braces; actually making it ordinary):

enter image description here

\documentclass{article}

\usepackage{amsmath}

\begin{document}

\[
  g(y) = \begin{cases}
    y + 1, & \text{for $-1 \leq y \leq 0$} \\
    1 - y, & \text{for $0 \leq y \leq 1$} \\
    0, & \text{otherwise}
  \end{cases}
\]

\[
  g(y) = \begin{cases}
    y + 1, & \text{for } {-}1 \leq y \leq 0 \\
    1 - y, & \text{for } 0 \leq y \leq 1 \\
    0, & \text{otherwise}
  \end{cases}
\]

\end{document}

Using {-1} would also work, forcing - to be an ordinary symbol, similar to {-}1.


Note you shouldn't use the plain TeX construct $$ ... $$. You can solve the problem with a pair of braces. I added an improvement for the inequalities:

  \[ g(y) = \begin{cases}
y + 1, & \text{for } {-1} \leq y \leq 0 \\
1 - y, & \text{for } {\phantom{-}0} \leq y \leq 1 \\
0, & \text{otherwise }
\end{cases} \]

enter image description here

Tags:

Spacing