How to Make Tables in LaTeX (Complete Guide)
To make a table in LaTeX, use the tabular environment with column specifiers, and add booktabs rules for clean lines. Copy-paste templates for every table type.
To make a table in LaTeX, use the tabular environment and declare one column specifier per column. Wrap it in a table float for captioning and numbering, and use the booktabs package for clean horizontal rules. The result is a publication-quality table that numbers itself and can be referenced anywhere in your document.
1. The basic table
tabular takes a column spec: l left, c center, r right. Cells are separated by &, rows end with \\.
\begin{tabular}{l c r}
Method & Accuracy & Time (s) \\
Baseline & 0.81 & 12 \\
Ours & 0.94 & 9 \\
\end{tabular}
2. Make it publication-grade with booktabs
The single biggest upgrade is booktabs. It replaces ugly \hline rules with \toprule, \midrule, and \bottomrule, and adds correct spacing. Avoid vertical lines entirely.
\usepackage{booktabs}
...
\begin{table}[t]
\centering
\caption{Model comparison on the test set.}
\label{tab:results}
\begin{tabular}{l c r}
\toprule
Method & Accuracy & Time (s) \\
\midrule
Baseline & 0.81 & 12 \\
Ours & \textbf{0.94} & 9 \\
\bottomrule
\end{tabular}
\end{table}
Reference it with Table~\ref{tab:results}, and the number updates automatically.
3. Column types cheat sheet
| Specifier | Effect |
|---|---|
| l c r | Left / center / right aligned |
| p{3cm} | Fixed-width paragraph (wraps text) |
| X (tabularx) | Flexible width that fills the line |
| S (siunitx) | Aligns numbers on the decimal point |
| @{} | Removes inter-column padding |
For numeric data, the siunitx S column aligns decimals perfectly — essential for results tables.
4. Wide tables, merged cells, and multi-page tables
- Too wide? Use
tabularxwith anXcolumn, or\resizebox{\textwidth}{!}{...}. - Merge columns:
\multicolumn{2}{c}{Spans two}. - Merge rows:
\multirow{2}{*}{Spans two}(loadmultirow). - Spans many pages: the
longtablepackage repeats headers across page breaks.
\usepackage{tabularx}
\begin{tabularx}{\textwidth}{l X}
Term & Definition that wraps automatically to the column width \\
\end{tabularx}
5. Generate tables from data
Hand-coding a 40-row table is error-prone. Export LaTeX directly from a spreadsheet, or from a pandas DataFrame with df.to_latex() — see LaTeX for Data Science: Tables From CSV. Pair tables with figures using the images and figures guide.
→ Preview tables live as you edit in LetX. Building a full document? Start from LaTeX for Beginners.
Written by Shihab Shahriar Antor — AI Engineer & Founder of Shahriar Labs, maker of LetX.
Frequently Asked Questions
How do I stop my LaTeX table from running off the page?
Three reliable fixes: use the tabularx package with an X column type so a column wraps text to fill the line width; wrap the whole table in \resizebox{\textwidth}{!}{...} from graphicx to scale it; or switch wide tables to landscape with the rotating package's sidewaystable. For genuinely huge tables, the longtable package lets a table break across multiple pages with repeated headers.
Why are the vertical lines in my table considered bad style?
Typographers and the booktabs documentation discourage vertical rules because they clutter the table and rarely aid reading. Professional tables in journals like Nature and IEEE use only three horizontal rules: \toprule, \midrule, and \bottomrule from the booktabs package, with generous spacing. Dropping vertical lines and double rules instantly makes a table look publication-grade.
How do I merge cells in a LaTeX table?
Merge columns with \multicolumn{n}{c}{text}, which spans n columns with centered alignment. Merge rows with \multirow{n}{*}{text} from the multirow package. Combine both to build a header that spans several columns above sub-columns. Add \cmidrule{2-3} from booktabs to draw a partial rule under just the spanned columns.