Updated «array» section

This commit is contained in:
Kenneth John Odle 2023-10-28 16:00:58 -04:00
parent ab83643d5d
commit e91812bfb3

View File

@ -883,17 +883,17 @@ You can typeset matrices and other similar objects using an \texttt{array} envir
\begin{itemize}[noitemsep]
\item \texttt{array} can only be used in a math environment.
\item You must declare the number and alignment of the columns by using \verb+\begin{array}{crl}+. In this instance, we are declaring one centered column, one right-aligned column, and one left-aligned column.
\item You must declare the number and alignment of the columns by using something like this:\vspace{0.5em} \\ \vspace{0.5em} \verb+\begin{array}{crl}+ \\ In this instance, we are declaring one centered column, one right-aligned column, and one left-aligned column.
\end{itemize}
In the example below, I've chose animal names to make the column alignment more explicit.
\begin{Verbatim}[frame=lines, numbers=left, xleftmargin=5mm, framesep=3mm, breaklines=true, label=array Example]
\begin{Verbatim}[frame=lines, numbers=left, xleftmargin=5mm, framesep=3mm, breaklines=true, label=\fbox{array Example}]
\[
Zoo~animals = \left\{ \begin{array}{crl}
lion & hippopotamus & gnu \\
elephant & zebra & kangaroo \\
bear & camel & wallaby
bear & camel & naked~mole~rats
\end{array}\right\}
\]
\end{Verbatim}
@ -902,10 +902,12 @@ bear & camel & wallaby
Zoo~animals = \left\{ \begin{array}{crl}
lion & hippopotamus & gnu \\
elephant & zebra & kangaroo \\
bear & camel & wallaby
bear & camel & naked~mole~rats
\end{array}\right\}
\]
\paragraph{Note:} Because the \texttt{array} environment is designed for math applications, rather than a text application like our example, I had to use a $\sim$ to add the spaces in ``naked mole rats''.
If the built-in \texttt{array} environment cannot do all that you want, use the \texttt{amsmath} package and its \texttt{matrix} environment, which provides more options.
\section{Special Math Environments}