As usual, this L^{A}TEX document contains a bunch of lines at the beginning which include certain template files, etc.

In order to create a table, we use the usual “begin” and “end” commands to define a section of the input file which will go into the table. The name of this environment is tabular. The tabular environment requires that we immediately provide the basic layout of the table within a pair of curly brackets. To specify a table with two columns, put two letters between the curly brackets, like this:

\begin{tabular}{l r}
  1  &  222    \\
  33333  &  4  \\
\end{tabular}

The resulting table looks like this:

1  222 33333  4

Inside the tabular section, use ampersand characters & to separate the columns, and place a double backslash \\ at the end of each line.

The letter “l” means “make each element inside the column left-justified”, while “r” means “right-justified” and “c” means “centered.” If your table is full of numbers, then probably right-justified is a good idea; if the table is full of text, then perhaps left-justified is better.

The following table has one left-justified column, then a centered column, and finally a right-justified column.

\begin{tabular}{l c r}
  left for me & centered!  &  this is right  \\
    short     &  sweet     &  terse \\
  avoid verbosity & lots of letters here &  blah blah blah blah  \\
\end{tabular}

left for me  centered!  this is right
short  sweet  terse
avoid verbosity lots of letters here blah blah blah blah

You can get a little fancy by adding horizontal and vertical lines to your table in a relatively simple manner: use vertical bar characters in the “table setup” argument, before or after or between the letters for each column.

\begin{tabular}{| l | r | }
  1  &  222    \\
  33333  &  4  \\
\end{tabular}

1  222 33333  4

You can add horizontal lines between rows of the table using the \hline command:

\begin{tabular}{ l  r  }
 \hline
  1  &  222    \\
 \hline
  33333  &  4  \\
 \hline
\end{tabular}

1  222
33333  4

It’s often nice to be able to add a title to the table which spans the entire width, across all the columns. You can use the \multiline command to cause one entry to span multiple columns:

\begin{tabular}{ | l | r | }
 \multicolumn{2}{c}{A two-column title} \\
 \hline
  1  &  222    \\
 \hline
  33333  &  4  \\
 \hline
\end{tabular}

A two-column title

1  222
33333  4