LaTeX Wiki
No edit summary
No edit summary
Line 1: Line 1:
  +
{{LenvTop}}
 
The <code>array</code> environment is used to make a table of information, with column alignment (left, center, or right) and optional vertical lines separating the columns.
 
The <code>array</code> environment is used to make a table of information, with column alignment (left, center, or right) and optional vertical lines separating the columns.
 
<div style="padding-left:1cm">
 
<div style="padding-left:1cm">
Line 47: Line 48:
 
{{UsageTable-end}}
 
{{UsageTable-end}}
   
  +
{{LenvBottom}}
\begin{array}{lcl}
 
z & = & a \\
 
f(x,y,z) & = & x + y + z
 
\end{array}
 

Revision as of 23:48, 16 October 2010

The array environment is used to make a table of information, with column alignment (left, center, or right) and optional vertical lines separating the columns.

\begin{array}{col1col2…coln}
item11 & item12 … & item1n\\
item21 & item22 … & item2n\\

...

itemn1 & itemn2 … & itemnn\\
\end{array}

Each of col1, col2, etc. is a single letter,

c - for centred
l - for flush left
r - for flush right
The column format letters can be interspersed with vertical bars (|), which result in rendering vertical bars as needed in the formatted matrix.

If a horizontal line is needed in the matrix, \hline can be used.

Within the array itself, columns are separated by an &, and each row ends with a double backslash, \\.

LaTeX markup... ...results in: ...is used for:
\begin{array}{|l|cr}
left1 & center1 & right1\\
\hline
d & e & f
\end{array}
array.
|l|cr means
left-align, center,
and right align columns;
vertical bars before and
after first column.
\hline draws a
horizontal line.
\begin{array}{lcl}
z & = & a \\
& = & a \\
f(x,y,z) & = & x + y + z
\end{array}
using an array
to align equations