# Tables, Arrays, and Matrices¶

In text mode, tables are created using the `tabular` environment. The analagous structure for math mode is the `array` environment. There is also an envoronment in math mode specifically for matrices, `matrix`.

## The Tabular Environment¶

Like any environment, the tabular environment is started with `\begin{tabular}{}` and ended with `\end{tabular}`. It takes one mandatory arguments and one optional argument. The mandatory argument tells LaTeX how to format the columns.

Columns

### Packages for Tables¶

`longtable`¶

Sometimes the native `tabular` environment just doesn’t cut it. For example, LaTeX typesets the entire `tabular` environment in one page, but sometimes it is okay for tables to be split between pages or to go on for multiple pages. In this case, declare `\usepackage{tabular}` in the preamble and use `\begin{longtable}` and `\end{longtable}` just as you would with the `tabular` environment.

## The Matrix Environment¶

This works much like the previous two environments, but the matrix environemt is specifically designed for mathematical matrices. Note that there are several modified versions of the matrix environment which may come in handy.

```
\begin{matrix}{1&0\\0&1}\end{matrix}
\begin{pmatrix}{1&0\\0&1}\end{matrix}
\begin{bmatrix}{1&0\\0&1}\end{matrix}
\begin{Bmatrix}{1&0\\0&1}\end{matrix}
\begin{vmatrix}{1&0\\0&1}\end{matrix}
\begin{Vmatrix}{1&0\\0&1}\end{matrix}
```

The smallmatrix environment is useful for creating inline matrices which do not disrupt line spacing.

```
The identity matrix, $\begin{matrix}1&0\\0&1\end{matrix}$
The identity matrix, $\begin{smallmatrix}1&0\\0&1\end{smallmatrix}$
```