I would like to completely understand all the differences between using the amsmath environment cases and using the array environment to write functions with cases.
Here is my current understanding after reading other questions in the forum:
arraycomes with padding on the left and the right. It can be suppressed using{@{}ll@{}}as explained in this related question.arraycreates vertical spacing issues that I don't fully understand. See this related question.- Both
arrayandcasesallow changing the space between lines using, for instance,\\[2ex]. - It is much easier to change the alignment of columns with
arraythan withcases. - The left brace from
casesseems to be taller than the left brace fromarray. But I don't understand why. - Using
casesis semantically more appropriate. casesrequires loadingamsmath
Overall, it seems like the default version of cases is better, but array is more customizable.
Are there other differences that I am missing? Is there an aspect of functions with cases that can be formatted using one of the environments but not the other one?
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\[
|x| =
\begin{cases}
x & \text{if}\ x\geq 0\\
-x & \text{if}\ x<0\\
\end{cases}.
\]
\end{document}
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\[
|x| =
\left\{\begin{array}{ll}
x & \text{if}\ x\geq 0\\
-x & \text{if}\ x<0\\
\end{array}\right..
\]
\end{document}
What I really want to know is which of the two environments is better and why. I have been using array for years, but I am considering switching to cases.


cases*frommathtools, which allowsr/ladjustments. And, although not used in a "cases" situation,arrayalso allowscto center a column. (May as well be complete.) – barbara beeton Mar 21 '20 at 22:02