Search Contact information
University of Cambridge Home Department of Engineering
University of Cambridge >  Engineering Department >  computing help
next up previous contents
Next: Macros Up: Maths Previous: Numbering and labelling

Matrices

The array environment is like LATEX's tabular environment except that each element is in math mode. The number and alignment of columns is controlled by the arguments - use l, c or r to represent each column with either left, center or right alignment. The default font style used is \textstyle but you can override this by changing the \displaystyle.

\begin{math}
\begin{array}{clrr} %
      a+b+c & uv & x-y & 27 \\
       x+y  & w  & +z  & 363 
\end{array}
\end{math}
produces $\begin{array}{clrr}
a+b+c & uv & x-y & 27 \\
x+y & w & +z & 363
\end{array}$

The rows are arranged so that their centres are aligned. You can align their tops or bottoms instead by using a further argument when you create the array.

\begin{array}{clrr}[t]
would produce top-aligned lines, and `[b]' would produce bottom-aligned ones. The Delimiters section of this document shows how to bracket matrices.

TEX has a few maths facilities not mentioned in the LATEX book. The following TEX construction might be useful.

\begin{math}
\bordermatrix{&a_1&a_2&...&a_n\cr
          b_1 & 1.2  & 3.3  & 5.1  & 2.8  \cr
          c_1 & 4.7  & 7.8  & 2.4  & 1.9  \cr
          ... & ...  & ...  & ...  & ...  \cr
          z_1 & 8.0  & 9.9  & 0.9  & 9.99  \cr}
\end{math}

$\bordermatrix{&a_1&a_2&...&a_n\cr
b_1 & 1.2 & 3.3 & 5.1 & 2.8 \cr
c_1 & 4.7 &...
...4 & 1.9 \cr
... & ... & ... & ... & ... \cr
z_1 & 8.0 & 9.9 & 0.9 & 9.99 \cr}$



© Cambridge University Engineering Dept
Information provided by Tim Love
2006-07-27