# The minus sign and the case

$$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}$$


When it gets rendered, I am getting a fairly long minus sign before the 1 and a space between the minus sign and the 1. I do not like that. Any suggestions?

• please post complete documents that can be run to show the problem, but you can force the prefix spacing with {-1} (but note $$ is not latex syntax) – David Carlisle Dec 5 '19 at 23:41 • – Werner Dec 5 '19 at 23:47 ## 2 Answers 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}$ 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): \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.

• Fine and useful explanation for beginners! (+1) – Bernard Dec 6 '19 at 0:02