Updated «align» section

This commit is contained in:
Kenneth John Odle 2023-07-31 15:55:33 -04:00
parent a524eda084
commit 98c52b7678

View File

@ -7,6 +7,7 @@
\usepackage{graphicx} \usepackage{graphicx}
\usepackage{kpfonts} \usepackage{kpfonts}
\usepackage{float} \usepackage{float}
\usepackage{longtable}
\raggedbottom \raggedbottom
\usepackage{nicefrac} \usepackage{nicefrac}
@ -849,28 +850,30 @@ You can typeset matrices and other similar objects using an \texttt{array} envir
\begin{itemize}[noitemsep] \begin{itemize}[noitemsep]
\item \texttt{array} can only be used in a math environment. \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}{ccl}+. In this instance, we are declaring two centered columns and one left-aligned column. \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.
\end{itemize} \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=array Example]
\[ \[
Zoo~animals = \left\{ \begin{array}{crl} Zoo~animals = \left\{ \begin{array}{crl}
lion & tiger & gnu \\ lion & hippopotamus & gnu \\
elephant & zebra & kangaroo \\ elephant & zebra & kangaroo \\
bear & camel & wallaby bear & camel & wallaby
\end{array}\right\} \end{array}\right\}
\] \]
\end{Verbatim} \end{Verbatim}
\[ \[
Zoo~animals = \left\{ \begin{array}{crl} Zoo~animals = \left\{ \begin{array}{crl}
lion & tiger & gnu \\ lion & hippopotamus & gnu \\
elephant & zebra & kangaroo \\ elephant & zebra & kangaroo \\
bear & camel & wallaby bear & camel & wallaby
\end{array}\right\} \end{array}\right\}
\] \]
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} \section{Special Math Environments}