I'm a Canadian based in Berlin, Germany. My day job is a Technical Writer in the API space. I write about topics such as technology, usability, creative writing and Canadian history. All views mine. I tweet at @glennjlea. Read more about me here or at LinkedIn.
Site version: 3.0

Creating custom tables

You can add simple to complex tables to a LaTeX document using several types of packages, depending on the requirements of the table.

## Packages for tables

LaTeX provides several packages for adding tables to a LaTeX document. From the many table packages available, the examples in this topic include the tabular package and the supertabular package. I used both when creating a user guide for a product.

Note: When using tabular or supertabular, the cell contents are in text mode.

## A basic table using tabular

You can insert a basic table using the tabular environment.

The line \begin{tabular}{|l|l|l|} creates a table with three columns that are left aligned and have a vertical line between each column.

Next, column headings are added where each heading is marked off by a & symbol and where the row is ended with the command \\.

A horizontal line is added using \hline.

## A more complex table using supertabular

I added the following commands to my stylesheet to use the supertabular package. The additional commands allowed me to create more complex tables.

To insert a table using the supertabular package, you create the table as shown in the following example:

The environment command \begin{flushleft}places the table left aligned to the margin. The command \tablehead{} adds a table heading. In this case, it is empty so no table heading is used.

## Adding spacing to table cells

You can add spacing above and below the text in table row. Use the following:

Here is an example of it used in a table.