booktabs vs \hline: why paper tables use clean rules
booktabs is a LaTeX package that replaces the \hline grid with three kinds of horizontal rule (\toprule, \midrule, \bottomrule) and no vertical lines. Many journal and conference style guides ask for that look because rows read more easily and spacing stays consistent. Converting an existing table takes a minute: load the package, delete the | characters, and swap each \hline for the right rule.
Convert a table from a PDF or screenshot →By TableToLatex · · Examples tested with pdfLaTeX, TeX Live 2023, booktabs
What booktabs changes
A grid built from \hline and | column separators draws every line at one weight, flush against the text, and the vertical bars chop the horizontal rules into boxes. The booktabs package does the opposite: a heavy rule above and below the table, one light rule under the header, padding around each rule, and no vertical rules. Its documentation tells authors never to use vertical rules or double rules.
That is why many venues prefer it. The NeurIPS formatting instructions say publication-quality tables do not contain vertical rules and strongly suggest booktabs, and the ACM acmart class loads the package for you. It is not universal: some template sample tables still use \hline, and IEEEtran does not load booktabs. Read your venue's author instructions before restyling, and if the template's own example differs, follow the template.
\begin{table}[htbp]
\centering
\caption{Validation accuracy (\%) on two datasets.}
\label{tab:acc}
\begin{tabular}{|l|c|c|}
\hline
Method & Dataset A & Dataset B \\
\hline
Baseline & 71.2 & 64.8 \\
\hline
Ours & 74.8 & 67.1 \\
\hline
\end{tabular}
\end{table}% preamble: \usepackage{booktabs}
\begin{table}[htbp]
\centering
\caption{Validation accuracy (\%) on two datasets.}
\label{tab:acc}
\begin{tabular}{lcc}
\toprule
Method & Dataset A & Dataset B \\
\midrule
Baseline & 71.2 & 64.8 \\
Ours & 74.8 & 67.1 \\
\bottomrule
\end{tabular}
\end{table}In the second version the text no longer touches the rules, the heavy outer rules frame the data, and nothing crosses the columns. Only the rule commands and the column specification changed. Grouped headers need partial rules, covered in the guide to multicolumn and multirow headers.
Convert an hline table to booktabs in seven steps
- 1
Load the package
Add \usepackage{booktabs} to the preamble. It ships with TeX Live and with Overleaf, so there is nothing to upload.
- 2
Remove the vertical bars
Change {|l|c|c|} to {lcc}. Leave the alignment letters and any p{...} widths alone.
- 3
Swap the outer rules
The first \hline becomes \toprule and the last one becomes \bottomrule.
- 4
Swap the header rule
The \hline under the header row becomes \midrule.
- 5
Delete the remaining rules
Lines between ordinary body rows go. To separate groups of rows, use one \midrule or an \addlinespace instead.
- 6
Convert partial rules
Replace \cline{2-3} with \cmidrule(lr){2-3}. The (lr) trims both ends so neighbouring rules do not touch.
- 7
Compile and check
Look for "Undefined control sequence" (package missing) and "Misplaced \noalign" (a row without its closing \\). Then compare the result with your template's sample table.
The booktabs rules at a glance
| Command | What it draws | Use it for |
|---|---|---|
| \toprule | Heavy rule, 0.08em thick by default | First line of the tabular |
| \midrule | Light full-width rule, 0.05em | Between header and body, or above a totals row |
| \bottomrule | Heavy rule, same weight as the top | Last line before \end{tabular} |
| \cmidrule(lr){2-3} | Thin partial rule, 0.03em, trimmed at both ends | Under a header that spans columns 2 to 3 |
| \addlinespace[3pt] | Vertical space only, no line | Separating groups of rows without another rule |
What goes wrong
- Undefined control sequence on
\toprule. The package is not loaded or its name is misspelt. The error points at the first rule line. - Gaps in the rules. If
|stays in the column specification, booktabs rules break wherever a vertical bar crosses them. Remove the bars rather than fighting the gaps. - Misplaced
\noalign. The last row before\midruleor\bottomruleis missing its closing\\. - Mixed rule weights. A leftover
\hlinenext to a booktabs rule draws a second, differently weighted line. Search the table for every\hlineand\cline. - Rows look too tight or too loose. If you raised
\arraystretchto give the old grid room, remove that change first; booktabs already pads each rule. Caption spacing is a separate matter, see caption position.
How TableToLatex helps
TableToLatex writes booktabs directly: its output uses \toprule, \midrule and \bottomrule with no \hline and no vertical bars, and \usepackage{booktabs} is the only package it needs. If the old hline table exists as a PDF page or a screenshot, the LaTeX table generator reads it and returns the converted table; numeric columns come out right-aligned, and you can line them up on the decimal point with siunitx S columns. The table tool is free and runs in your browser. Paste a tab-separated range from a spreadsheet. See pricing.
Questions about booktabs and hline
What is booktabs in LaTeX?+
booktabs is a package that provides \toprule, \midrule, \bottomrule, \cmidrule and \addlinespace for typesetting professional-looking tables. It uses rules of different weights, adds spacing around them, and is designed for tables without vertical lines.
What is the difference between \hline and \midrule?+
\hline draws a full-width line at one weight with no extra padding. \midrule draws a lighter line, adds space above and below it, and belongs to booktabs, which also offers the heavier \toprule and \bottomrule for the outer edges.
Can I use vertical lines with booktabs?+
You can, but the booktabs rules will have gaps wherever a | crosses them, and the package documentation advises against vertical rules altogether. If a template requires vertical lines, follow the template and use \hline.
Will a journal reject a table that uses \hline?+
Not automatically in most cases, but practice differs. Some style guides ask for booktabs-style tables and a typesetter may restyle yours. Check the author instructions and the template's sample table; rules differ by publisher.
Do I need to install booktabs to use it in Overleaf?+
No. Overleaf's TeX Live includes booktabs, so adding \usepackage{booktabs} to the preamble is enough. On a local machine with a minimal TeX installation you may need to add the package through its package manager.
How do I make the booktabs rules thicker or thinner?+
Set the lengths in the preamble, for example \setlength{\heavyrulewidth}{0.1em} for the outer rules and \setlength{\lightrulewidth}{0.06em} for \midrule. The defaults are 0.08em and 0.05em.
Does booktabs work inside longtable and tabularx?+
Yes. The rule commands work in longtable, tabularx and similar environments, so a table that runs across pages can keep the same style.
Keep reading
- Grouped headers
Grouped headers with \multicolumn, \multirow and trimmed \cmidrule rules.
- Caption position
Where \caption goes, what templates expect, spacing, and the \label order trap.
- Decimal alignment
S columns, table-format, signs and ± without misaligned decimals.
Have a table in a spreadsheet? Paste it into the table tool, or see all LaTeX table guides.