Matricesarray

arrayEnvironment

Used for custom mathematical arrays, matrices, and piecewise-style layouts where the author supplies an explicit column preamble.

\begin{array}{cc} a & b \end{array}
Topic
Matrices
Available in
base
Allowed mode
math
Body mode
math
Frequency
3.24% of corpus formulasrank 6 of 31
Commonality
high
Tags
math-alignment, nestable
Renderer support
PackageMathJaxKaTeXXeTeX
baseMathJax: FullKaTeX: PartialXeTeX: Partial
About the test scope

Syntax#

\begin{array}o[a]optional math contentm:C{cc}column template…math body\end{array}

Argspec o m:C — one optional and one mandatory argument. Reading argspecs

Common tasks#

How to write a custom-column array#

\begin{array}{cc} a & b \\ c & d \end{array}

How to add a vertical rule in an array#

\begin{array}{c|c} a & b \\ \hline c & d \end{array}

How to right-align numeric columns#

The preamble uses the same l/c/r letters as tabular.

\begin{array}{rcr} 12 & + & 3 \\ 4 & + & 56 \end{array}

Examples#

\begin{array}[t]{cc} a & b \end{array}

In TeXForm#

TeXForm reads the environment body in math mode.

See also#

Test cases#

base
InputCaseMathJaxKaTeXXeTeX
\begin{array}{cc} a & b \end{array}Positive · baselinePassPassPass
\begin{array}[a]{cc} a & b \end{array}Positive · vary:o[0]PassFailPass
\begin{array}cc a & b \end{array}Positive · bare[1]PassPassFail
All 18 in Matrices