# Use of \midrule in booktabs table

Are there any formal guidelines/suggestions on the use of \midrule inside a booktabs table with just rows of identically formatted data? The booktabs manual is very specific about vertical rules, stating that you should

[n]ever, ever use vertical rules.

But what about horizontal rules between data items of the same type?

This question occurred when deciding if a LaTeX table generator should insert \midrules between each line. The picture below (shamelessly stolen from there) shows the difference for the same data (but with slightly different formatting of the figures):

• I use to say that each rule in a table is like a wall that blocks reading the table when encountered. The wall between column headers and entries is good; a block between the Datsun and the Hornet 4 lines would require motivation. There's no need to have a rule between each pair of rows: the eye can follow a row (unless the table has been artificially widened to cover the line width, which is another no-no). – egreg Nov 26 '13 at 8:52
• @egreg I'd argue that you can see the rule as either a wall, or a guide. It makes sure your sight won't fall off a row/column while your eyes are moving horizontally/vertically (vertical is easier in general). If the table has more rows than the examples above, I can challenge you to, for example, find out the value of the column qsec of the 12th car in the data. I think you will have to be careful when reading that row without horizontal rules guiding your eyes. I agree these rules are more of a clutter when the table is small, though. – Yihui Xie Nov 26 '13 at 19:20
• @Yihui That's more easily obtained by slightly increasing the leading. – egreg Nov 26 '13 at 20:18

The \midrule instruction generates a horizontal line that's (i) a bit thinner than either \toprule or \bottomrule and (ii) provides some extra vertical spacing both above and below the rule. As such, a \midrule is best used to separate a table's header row(s) from the body of the table, and a table's body from the footer material (if present, of course).

If the table contains rows and rows of identically formatted data but no header or footer components, I would not use a \midrule at all. Inserting a \midrule between each and every row constitutes, to me at least, a violation of the spirit of the booktabs package that's nearly as egregious as using vertical rules. :-)

If it's absolutely necessary to provide some separation between the rows, I'd either adjust the amount of default vertical space or add a bit of extra vertical space -- via an instruction such as \\[0.5ex] -- after every fifth row or so. The amount of extra space will depend on the table's width: the wider the table, the more whitespace should be inserted after a group of rows.

Addendum: Here's a comparison of the look of the table you've linked to in your posting, first with all midrules present, and second with a midrule used only to separate the header material from the table's body. (I've also applied a few additional tweaks, such as inserting a touch of extra vertical space after the third row). I believe most readers will find the second table to be more readable -- and certainly much less cluttered -- than is the first.

\documentclass{article}
\usepackage{booktabs}
\setlength\parindent{0pt} % just for this example
\begin{document}
\emph{Before: Lots of midrules}

\smallskip
\begin{tabular}{lrrrrrrrrrrr}
\toprule
& mpg & cyl & disp & hp & drat & wt & qsec & vs & am & gear & carb\\
\midrule
Mazda RX4 & 21.0 & 6 & 160 & 110 & 3.90 & 2.620 & 16.46 & 0 & 1 & 4 & 4\\
\midrule
Mazda RX4 Wag & 21.0 & 6 & 160 & 110 & 3.90 & 2.875 & 17.02 & 0 & 1 & 4 & 4\\
\midrule
Datsun 710 & 22.8 & 4 & 108 &  93 & 3.85 & 2.320 & 18.61 & 1 & 1 & 4 & 1\\
\midrule
Hornet 4 Drive & 21.4 & 6 & 258 & 110 & 3.08 & 3.215 & 19.44 & 1 & 0 & 3 & 1\\
\midrule
Hornet Sportabout & 18.7 & 8 & 360 & 175 & 3.15 & 3.440 & 17.02 & 0 & 0 & 3 & 2\\
\midrule
Valiant & 18.1 & 6 & 225 & 105 & 2.76 & 3.460 & 20.22 & 1 & 0 & 3 & 1\\
\bottomrule
\end{tabular}

\bigskip
\emph{After: Only one midrule, and some additional tweaks}

\smallskip
\begin{tabular}{ @{} l *{7}{r} *{4}{c} @{} }
\toprule
& mpg & cyl & disp & hp & drat & wt & qsec & vs & am & gear & carb\\
\midrule
Mazda RX4 & 21.0 & 6 & 160 & 110 & 3.90 & 2.620 & 16.46 & 0 & 1 & 4 & 4\\
Mazda RX4 Wag & 21.0 & 6 & 160 & 110 & 3.90 & 2.875 & 17.02 & 0 & 1 & 4 & 4\\
Datsun 710 & 22.8 & 4 & 108 &  93 & 3.85 & 2.320 & 18.61 & 1 & 1 & 4 & 1\\[0.6ex]
Hornet 4 Drive & 21.4 & 6 & 258 & 110 & 3.08 & 3.215 & 19.44 & 1 & 0 & 3 & 1\\
Hornet Sportabout & 18.7 & 8 & 360 & 175 & 3.15 & 3.440 & 17.02 & 0 & 0 & 3 & 2\\
Valiant & 18.1 & 6 & 225 & 105 & 2.76 & 3.460 & 20.22 & 1 & 0 & 3 & 1\\
\bottomrule
\end{tabular}
\end{document}

• \addlinespace might be a bit more visual to the coder than \\[...] which often gets lost. – daleif Nov 26 '13 at 15:58
• @daleif - To my taste, the default amount of vertical whitespace inserted by \addlinespace (the parameter \defaultaddspace, default value 0.5em) is a bit too generous. Hence, I'd have to type something like \addlinespace[0.6ex] to get the space I feel right. :-) – Mico Nov 26 '13 at 21:32
• I kind of like the larger size. In your image the extra space is hardly noticable. – daleif Nov 27 '13 at 8:41
• @daleif - De gustibus non est disputandum, right? I happen to like typographic settings that are only barely noticeable; others, of course, have different preferences... – Mico Nov 27 '13 at 10:54