TeX source:
g(x) = \left\{ \begin{array}{llll} x & \text { if } x < –1 \\2 & \text { if } –1 ≤ x < 1 \\ –x & \text { if } 1 < x ≤ 3 \\ 1 & \text { if } 4 < x \end {array} \right.