I need to notate this function:
\begin{align*}
f(x)=\begin{cases}
-1,-\pi<x<0 \\
1,0<x<\pi
\end{cases}
\end{align*}
How can I get the two conditions to align by the x? Simply putting an ampersand before the x doesn't work (that causes strange space from the lower bound to the x.)



equation;alignis for multiline displays (casesisn't). – egreg Sep 21 '17 at 13:12$$? – minseong Sep 21 '17 at 13:22$$should never be used in LaTeX. See Why is\[ … \]preferable to$$? – egreg Sep 21 '17 at 13:41