1. 公式多行多列对齐
当讨论一个函数因自定义变量取值不同而表达不同时,通常是写一个大括号,用cases完成,源代码如下:
- \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}
结果如下:
你也看到了,上面的等式不够美观,g(x)不对齐。期待的结果是这样的:
源代码如下:
- \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}
参考资料:
[1]TeX:
How can I align multirow and multicolumn equations?