[Tex/LaTex] Weird equation array error

arraysequations

When I use the following code to generate a simple equation array:

\begin{equation}
f(x)=\left \{\begin{array}{ll}
\frac{\pi-x}{2},\quad 0<x\leqslant 2\pi;\\
-\frac{\pi}{2},\quad x \text{are other points}
\end{array}
\right.
\end{equation}

I got the following result:
enter image description here

Why the array overlaps a little bit? Is there anything wrong with the code?

I know I can use a \nicefrac{}{} to change the second line, but still weird:

enter image description here

How would you guys generate a beautiful bracket at left in math mode?

Thanks.

Best Answer

Insert a larger line-break using \\[<len>]. Using the cases would require the same increased line-break. However, using dcases (from mathtools) works better:

enter image description here

\documentclass{article}

\usepackage{mathtools,amssymb}

\begin{document}

\begin{equation}
  f(x) = \left \{\begin{array}{ll}
      \frac{\pi-x}{2},\quad 0<x\leqslant 2\pi;\\
      -\frac{\pi}{2},\quad x \text{are other points}
    \end{array}
  \right.
\end{equation}

\begin{equation}
  f(x) = \begin{cases}
     \dfrac{\pi-x}{2}, & 0 < x \leqslant 2\pi; \\[2\jot]
    -\dfrac {\pi} {2}, & \text{$x$ are other points}
  \end{cases}
\end{equation}

\begin{equation}
  f(x) = \begin{dcases}
     \frac{\pi-x}{2}, & 0 < x \leqslant 2\pi; \\
    -\frac {\pi} {2}, & \text{$x$ are other points}
  \end{dcases}
\end{equation}

\end{document}