[Tex/LaTex] Alignment in a piecewise function

horizontal alignmentmath-mode

I would like to have the following two equalities displayed with the = aligned. I use the following code. The = are not aligned, and 2.5pt is typeset before the = in each line! Also, there is an unseemly amount of space between the left brace and the first equality. (The cases environment gives "the right" space between the left brace and the first equality, but it does not align the =.)

\documentclass{article}
\usepackage{amsmath}
\begin{document}

\begin{equation*}
\left\{
\begin{array}{c@{2.5pt}c}
a^{3} + b^{3} &= -q \\
ab &= \dfrac{-1}{3} \, p
\end{array}
\right.
\end{equation*}

\end{document}

Best Answer

I would use aligned rather than array here, because semantically it's not really a cases situation nor an array:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{equation*}
\left\{
\begin{aligned}
a^{3} + b^{3} &= -q \\
ab &= \dfrac{-1}{3} \, p
\end{aligned}
\right.
\end{equation*}
\end{document}

enter image description here