[Tex/LaTex] How to align multirow and multicolumn equations

amsmathequations

There is a multiline and multirow equation:

\begin{equation}
\begin{cases}
f(x)=\frac{1}{12} \cdot x \quad g(x) = \frac{1}{24} \cdot x, & x<12 \\
f(x)=1 \quad g(x) = \frac{1}{8} \cdot x - 1, & 12 \le x < 16 \\
f(x)=1 \quad g(x) = 1, & x \ge 16
\end{cases}
\end{equation}

The result is:

enter image description here

What I expect is: (align g(x) as well)

f(x)=*    g(x)=*
f(x)=*    g(x)=*
f(x)=*    g(x)=*

Best Answer

You'd probably need something like this (simple cases cannot handle this)

\documentclass[a4paper]{article}
\usepackage{amsmath}
\begin{document}

\begin{equation}
  \left\{\begin{aligned}
      f(x)&=\tfrac{1}{12} \cdot r, & g(x) &= \tfrac{1}{24} \cdot x, & x&<12 \\
      f(x)&=1, &g(x) &= \tfrac{1}{8} \cdot x - 1, & 12 &\le x < 16 \\
      f(x)&=1, &g(x) &= 1, & x &\ge 16
    \end{aligned}
    \right.
\end{equation}


\end{document}

Here is the result:

enter image description here