Build tables in LaTeX with tabular and booktabs: column specifiers, rules, multicolumn and multirow cells, the table float with captions, wide tables, and common alignment mistakes.
Tables
A LaTeX table has two layers: the tabular environment that lays out rows and columns, and the table float that adds a caption and a number. Once you know the column specifier syntax and the & / \\ separators, most tables are routine. This page uses booktabs for professional-looking rules; it is available in Coauthor's compiler and suggested by the \usepackage{ autocomplete.
A Basic Table
% preamble
\usepackage{booktabs}
% body
\begin{table}[t]
\centering
\caption{Accuracy (\%) on the three benchmarks. Best result per column in bold.}
\label{tab:results}
\begin{tabular}{lccc}
\toprule
Method & CIFAR-10 & CIFAR-100 & ImageNet \\
\midrule
Baseline & 93.1 & 71.4 & 76.2 \\
Ours (small) & 94.0 & 73.9 & 77.8 \\
Ours (large) & \textbf{95.2} & \textbf{76.1} & \textbf{79.4} \\
\bottomrule
\end{tabular}
\end{table}
How it works:
{lccc}declares four columns: one left-aligned (l) and three centered (c).rright-aligns;p{3cm}makes a fixed-width paragraph column that wraps text.- Cells are separated by
&, rows end with\\. \toprule,\midrule,\bottomrulecome frombooktabsand replace\hlinewith correctly spaced rules. Avoid vertical lines (|in the specifier); they are considered poor style in most venues.- For tables,
\captionconventionally goes above the tabular, and\labelmust follow\caption.
Type \begin{tab in the editor and choose \begin{tabular} or \begin{table} to insert the environment skeleton.
Spanning Cells
\usepackage{multirow} % preamble
\begin{tabular}{llcc}
\toprule
\multirow{2}{*}{Model} & \multirow{2}{*}{Params} & \multicolumn{2}{c}{Accuracy} \\
\cmidrule(lr){3-4}
& & Clean & Noisy \\
\midrule
ResNet-50 & 25M & 76.2 & 61.0 \\
ViT-B/16 & 86M & 81.1 & 66.3 \\
\bottomrule
\end{tabular}
\multicolumn{2}{c}{Accuracy}merges two columns into one centered cell; the row must still add up to the total number of columns.\multirow{2}{*}{Model}(packagemultirow) merges two rows; leave the cell below it empty.\cmidrule(lr){3-4}draws a partial rule under columns 3 to 4, trimmed on both sides.
Numbers, Units, and Alignment
- Align decimals with
siunitx:\usepackage{siunitx}and use theScolumn type, e.g.{lS[table-format=2.1]}. - Put units in the header (
Time (s)), not in every cell. - Write
\%for a literal percent sign and\num{1e-4}(siunitx) for scientific notation.
Wide and Long Tables
| Need | Solution |
|---|---|
| Table wider than the column in a two-column paper | \begin{table*} spans both columns (appears at the top of the next page) |
| Table slightly too wide | \resizebox{\linewidth}{!}{ \begin{tabular}...\end{tabular} } from graphicx, or reduce font with \small before the tabular |
| Columns that should share the available width | \usepackage{tabularx} and \begin{tabularx}{\linewidth}{lXX} where X columns stretch |
| Table longer than a page | \usepackage{longtable} and \begin{longtable}{lcc}; it is not a float, so captions go inside it |
| Landscape page for a huge table | \usepackage{pdflscape} and wrap the float in \begin{landscape}...\end{landscape} |
Referencing Tables
Table~\ref{tab:results} summarizes the results.
The number becomes ?? until the next compile if the label is new; see Cross-References and Labels. Placement specifiers ([t], [h], [H]) work exactly as for figures; see Figures and Images.
Common Table Errors
| Message | Cause | Fix |
|---|---|---|
Misplaced alignment tab character & | A literal & in text, or & outside a tabular | Write \&, or check that the row is inside \begin{tabular} |
Extra alignment tab has been changed to \cr | A row has more & than the specifier allows | Count the columns; check \multicolumn totals |
Missing \cr inserted | Row not ended with \\ | Add \\ to the previous row |
Illegal character in array arg | Typo in the specifier such as {lcx} | Use only l c r p{} S X and ` |
| Table appears far away | Normal float behavior | Refer by number, use [t], or [H] with float |
All of these carry a line number in the Compilation Results panel; click the entry to jump there. See Fixing Common LaTeX Errors.
Generating Tables with the AI Coauthor
Tables are tedious to type. Paste CSV or a Markdown table into the AI coauthor thread, or attach a results file, and ask for "a booktabs table with the best value per column in bold, caption and label included". The AI writes the LaTeX directly into your file and you review the change in the editor. See Tools: What the AI Can Read and Change.
Related articles
Prefer to ask?
Inside Coauthor, ask the AI coauthor how any feature works — it answers from these same help articles. For anything else, use the ? button in the top-right corner of the app.