LaTeX results tables: booktabs rules, decimal alignment, and grouped headers
A results table in a paper is usually built from three pieces: booktabs for the horizontal rules, the siunitx S column for aligning numbers on the decimal point, and \multicolumn with \cmidrule for grouped headers such as "Dataset A / Dataset B". This article starts from a small sample dataset, gives complete source that compiles, and then covers bold best values, missing values, units, table notes, and checking the numbers.
Sample data
The numbers below are for demonstration only and do not come from real experiments. Assume four methods were each run three times on two datasets, and the means were collected into a CSV file:
method,params_m,acc_a,f1_a,acc_b,f1_bBaseline,11.2,84.3,82.1,76.5,74.0Prior work,340,87.1,85.6,,Baseline + aug.,11.2,86.7,85.0,78.9,77.2Ours,12.8,88.2,86.4,80.3,79.6Prior work has no reported results on Dataset B, so its last two fields are empty. The parameter column contains both 11.2 and the integer 340, which makes it a good test for decimal alignment.
Complete source
Save this as main.tex and compile with pdfLaTeX. The example uses the article class and loads booktabs, siunitx, and caption.
\documentclass[a4paper,11pt]{article}\usepackage{booktabs}\usepackage{siunitx}\usepackage{caption}\captionsetup[table]{position=above}\sisetup{ reset-text-series = false, text-series-to-math = true,}\begin{document}\begin{table}[htbp] \centering \caption{Results on two benchmarks (illustrative data). Best values in each column are in bold.} \label{tab:results} \begin{tabular}{ l S[table-format=3.1] S[table-format=2.1] S[table-format=2.1] S[table-format=2.1] S[table-format=2.1] } \toprule & & \multicolumn{2}{c}{Dataset A} & \multicolumn{2}{c}{Dataset B} \\ \cmidrule(lr){3-4} \cmidrule(lr){5-6} Method & {Params (M)} & {Acc (\%)} & {F1 (\%)} & {Acc (\%)} & {F1 (\%)} \\ \midrule Baseline & 11.2 & 84.3 & 82.1 & 76.5 & 74.0 \\ Prior work & 340 & 87.1 & 85.6 & {--} & {--} \\ Baseline + aug. & 11.2 & 86.7 & 85.0 & 78.9 & 77.2 \\ Ours & 12.8 & \bfseries 88.2 & \bfseries 86.4 & \bfseries 80.3 & \bfseries 79.6 \\ \bottomrule \end{tabular} \medskip \footnotesize Mean of three runs; -- means not reported.\end{table}Table~\ref{tab:results} compares four methods.\end{document}The PDF should contain a captioned table with three main rules. At the top, Dataset A and Dataset B each span two columns and have a short rule underneath. In the parameter column, 340 lines up with the integer parts of 11.2 and 12.8. The four metrics in the last row are bold, and a line of small text below the table serves as the note.
Flow overview: the numbers in the CSV, the LaTeX source, and the typeset table correspond one to one. For readability, the figure keeps only two rows and three columns.
Table rules with booktabs
booktabs provides four commands:
| Command | Position | Purpose |
|---|---|---|
\toprule | Before the first row | Heavier top rule |
\midrule | Between header and data | Lighter middle rule |
\bottomrule | After the last row | Heavier bottom rule |
\cmidrule(lr){a-b} | Below a grouped header | Short rule spanning only columns a to b |
These rules come with built-in vertical spacing, so the table does not look cramped. With booktabs you normally leave out vertical lines and do not mix in \hline, since the rule widths would not match. If a journal template has its own rules, follow the template.
The caption package and \captionsetup[table]{position=above} in the example take care of caption spacing. Table captions are conventionally placed above the table, but article sets the spacing as if the caption were below. Without these two lines, the caption sits right on top of the top rule. Put \label after \caption so that references get the correct number.
Decimal alignment with the siunitx S column
A plain c column centers each cell. When numbers have different numbers of digits, the decimal points do not line up:
\begin{tabular}{lcc} \hline Method & Params (M) & Acc (\%) \\ \hline Baseline & 11.2 & 84.3 \\ Prior work & 340 & 87.1 \\ \hline\end{tabular}Here 340 is centered and does not line up with the decimal point of 11.2. If you change the column type to S, siunitx splits each number into its integer and decimal parts and aligns them on the decimal point:
Alignment comparison: a c column on the left, S[table-format=3.1] on the right. 340 has no decimal part, and its units digit lines up with the units digits of the other numbers.
table-format tells siunitx how many digits to reserve:
3.1: up to 3 integer digits and 1 decimal digit, used for values from11.2to340.2.1: 2 integer digits and 1 decimal digit, used for percentages such as84.3.- For signed values use a form such as
+2.1. For values with an uncertainty use2.1(1), covered below.
table-format only affects column width and alignment; it does not change the numbers. If it is too small, numbers overflow the reserved width and no longer line up with the header. Adjust it to fit the longest number in the column.
Any non-numeric content in an S column must be wrapped in braces. The header {Acc (\%)} and the missing value {--} are both handled this way. Without the braces, siunitx tries to parse them as numbers, reports an Invalid number error, and compilation stops.
Grouped headers with \multicolumn and \cmidrule
A grouped header takes two rows:
& & \multicolumn{2}{c}{Dataset A} & \multicolumn{2}{c}{Dataset B} \\\cmidrule(lr){3-4} \cmidrule(lr){5-6}Method & {Params (M)} & {Acc (\%)} & {F1 (\%)} & {Acc (\%)} & {F1 (\%)} \\- The two
&at the start of the first row leave the Method and Params columns empty.\multicolumn{2}{c}{Dataset A}merges columns 3 and 4, and Dataset B merges columns 5 and 6. The merged column counts plus the empty cells must add up to the total of 6 columns. \cmidrule(lr){3-4}draws a short rule under columns 3 to 4.(lr)trims both ends of the rule slightly, leaving a gap between the two groups so readers can see they are separate.\multicolumnis built into LaTeX;\cmidrulecomes frombooktabs. When\multicolumnis used over S columns, the merged cell uses the givencalignment and is not parsed as a number, so Dataset A does not need braces.
If a header has to span two rows, for example to center Method vertically on the left, you can use \multirow from the multirow package. In tables of this style it is more common to put such labels in the second row and leave the first row empty, which is what the example does.
Best values, missing values, units, and table notes
Bold best values
To make a value bold in an S column, the example uses \bfseries 88.2 and sets this in the preamble:
\sisetup{ reset-text-series = false, text-series-to-math = true,}By default siunitx resets the font weight. These two options let \bfseries in a cell take effect while the numbers stay aligned on the decimal point. The detect-weight option found in older tutorials triggers a deprecation warning in siunitx v3.6.7, the version tested here, and the log recommends the two options above instead.
Check the maximum in each column before bolding. In this example Ours is highest on all four metrics: 88.2 and 86.4 on Dataset A, 80.3 and 79.6 on Dataset B. For the parameter count, smaller is better, so it is not a "highest is best" column and the example leaves it unbolded. State the bolding rule in the header or caption, and mark metrics where lower is better, for example with Loss ($\downarrow$) in the header.
Missing values
The example uses {--} for results that were not reported. It appears as a dash in the PDF, and the table note explains what it means. {n/a} also works; just use one form throughout the paper. Do not write a missing value as 0, because readers will take the result to be 0.
Units
Put units in the header and only numbers in the cells, for example {Acc (\%)} and {Params (M)}. For standard units you can use \unit from siunitx:
\begin{tabular}{l S[table-format=2.1(1)] S[table-format=3.0]} \toprule Method & {Acc (\%)} & {Latency (\unit{\milli\second})} \\ \midrule Baseline & 84.3(4) & 12 \\ Ours & 88.2(3) & 105 \\ \bottomrule\end{tabular}With \sisetup{uncertainty-mode = separate} added to the preamble, 84.3(4) is displayed as 84.3 ± 0.4 and 88.2(3) as 88.2 ± 0.3. The number in parentheses is the uncertainty in the last digit, and table-format=2.1(1) reserves one digit for it. If the paper reports a standard deviation or standard error, say which one in the table note and how many runs it is based on.
Table notes
After the tabular, the example adds a one-line note in \footnotesize giving the number of runs and the meaning of --. If you have several notes that need markers such as a and b, consider the threeparttable package. Journal templates often specify a format for table notes, so check the author guidelines before submitting.
Checking the numbers: values must not change between data and table
The most common problem in results tables is a mistyped number. Check the following after every change:
- Round at the data stage. Use the same number of digits in the table as in the CSV.
siunitxcan round too:\num[round-mode=places, round-precision=1]{88.15}outputs 88.2 and86.449outputs 86.4. But then the numbers in the source differ from the numbers in the PDF, which makes them easy to miss during review. - Compare row by row. The sample CSV has 4 data rows, so the table should have 4 rows. Each row has 5 numeric fields, matching the table's 5 S columns. Empty fields correspond to
{--}. - Recheck the best values. After adding or removing a row or changing data, the bold cells may no longer be correct.
- Check units and percent signs. 0.843 and 84.3% must not appear in the same column.
With a lot of data, you can generate the table rows from the CSV with a script and paste the output into LaTeX to avoid copying by hand. Either way, check the final PDF against the data.
Common problems
| Symptom | Cause | Fix |
|---|---|---|
Package siunitx Error: Invalid number '(' | Header text in an S column is not wrapped in braces | Write {Acc (\%)} |
Invalid number '--' | Missing value is not wrapped in braces | Write {--} |
Undefined control sequence pointing at \toprule or \cmidrule | booktabs is not loaded | Add \usepackage{booktabs} to the preamble |
| Caption touches the top rule | Caption is above the table but spacing assumes below | Load caption and set position=above |
\bfseries has no effect | siunitx resets the font weight by default | Set reset-text-series = false and text-series-to-math = true |
| Numbers misaligned with the header | table-format reserves too few digits | Adjust it to the longest number in the column |
Extra alignment tab has been changed to \cr | A row has more & than columns | Count the separators in each row; a merged cell counts as the number of columns it spans |
For more table errors, see Fixing common problems in AI-generated LaTeX tables.
Verifying locally or in EasyLaTeX
With a local TeX Live or MiKTeX installation, run the following twice in the directory containing main.tex. The second run resolves \ref:
pdflatex -interaction=nonstopmode -halt-on-error main.texpdflatex -interaction=nonstopmode -halt-on-error main.texThen check main.log for errors or Overfull \hbox, open the PDF, and compare every number, the bold cells, and the table note against the CSV.
In EasyLaTeX, put the source in the project's main file, make sure the correct main file is selected, and choose pdfLaTeX for this English article example. If compilation fails, check the messages and the Original Log in the Bug panel. If you need help locating the problem, you can give the table source and log to the Agent, review its changes one by one, and recompile. When using a journal template, keep the compiler and package settings the template requires, and check whether it already loads booktabs or siunitx.
The complete example, the units and uncertainty snippet, the rounding examples, and the c column comparison in this article were compiled with pdfLaTeX on TeXLive.net (LaTeX 2026-11-01, siunitx v3.6.7). The logs showed no errors, and the PDFs were checked. The two errors in the table above were reproduced in the same environment. They were not tested in the product's compiler or with specific journal templates.
For basic table syntax, see Basic tables, merged cells, and long tables. For captions and floats, see Captions, labels, and floats. For formatting requirements across a whole paper, see LaTeX paper formatting help.
References
- booktabs package documentation: usage of
\toprule,\midrule, and\cmidrule, with advice on table layout. - siunitx package documentation: the
Scolumn,table-format, uncertainty, and rounding options. - caption package documentation:
positionand caption spacing.