Table of Contents
TexLive Tables
Tables are created with the tabular environment. Columns are separated by &, rows by \\. The first argument specifies column alignment: l (left), c (center), r (right).
\begin{tabular}{l c r} Left & Center & Right \\ A & B & C \\ 1 & 2 & 3 \end{tabular}
renders as a left-center-right aligned table. Each column inherits its alignment from the format string.
Column separators (vertical lines) and row separators (horizontal lines) use | and \hline:
\begin{tabular}{| l | c | r |} \hline Left & Center & Right \\ \hline A & B & C \\ 1 & 2 & 3 \\ \hline \end{tabular}
| creates vertical lines between columns; \hline creates horizontal lines. Too many lines make tables hard to read—prefer minimal lines (top, bottom, header separator).
Multirow and multicolumn span multiple cells. Use the multirow and multicolumn packages:
\usepackage{multirow} \begin{tabular}{l l} \multicolumn{2}{c}{Header} \\ A & B \\ \end{tabular}
\multicolumn{2}{c}{Header} spans 2 columns, centered. \multirow{2}{*}{A} spans 2 rows (requires the multirow package).
The table environment wraps tabular to add captions, labels, and positioning. Tables float to the top of a page by default with [t] option, or [h] (here), [b] (bottom), [p] (page).
\begin{table}[h] \centering \begin{tabular}{l c r} A & B & C \\ 1 & 2 & 3 \end{tabular} \caption{Example table} \label{tab:example} \end{table}
The caption appears below the table. \label{tab:example} lets you reference it with \ref{tab:example} or Table~\ref{tab:example} (note the ~ tilde prevents line breaks between “Table” and its number).
Formatting cells: Bold headers with \textbf, colors with \textcolor, or alignment-specific commands. Long tables that span pages use the longtable package.
Spacing: Control column width with p{width} for paragraph columns: \begin{tabular}{l p{5cm} r} constrains the middle column to 5cm width with wrapping text.
