# Do the different rules generated by booktabs have the same thickness?

I use the booktabs package and excel2latex to generate my tables. I work in TeXmaker. As I zoom in or zoom out on my table, I find that, sometimes the \toprule, sometimes \midrule and sometimes the \bottomrule appear to be wider than other lines. On the other hand, when I print such a table, the top and bottom rule are wider while the mid rule is thinner.

Is it normal? I like the printed looks of my table but I don't want it to randomly change if I decide to print the whole thesis.

Here is my code and examples:

% Table generated by Excel2LaTeX from sheet 'Tabelle3'
\begin{table}[htbp]
\centering
\begin{tabular}{rrr}
\toprule
\multicolumn{1}{c}{Anzahl der Kanäle} & \multicolumn{1}{c}{Streifenbreite in [mm]} & \multicolumn{1}{c}{Kanalbreite in [mm]} \\
\midrule
\multicolumn{1}{c}{n} & \multicolumn{1}{c}{c} & \multicolumn{1}{c}{b} \\
5     & 13    & 2,80  \\
6     & 11    & 2,50  \\
7     & 9     & 2,86  \\
8     & 8     & 2,50  \\
\bottomrule
\end{tabular}%
\end{table}%


-
\toprule and \bottomrule are equally thick and both are thicker than \midrule. –  Harish Kumar Mar 4 at 10:53
the specified widths are as Harish Kumar states note however that a pdf viewer has to snap the rules to pixel boundaries so (depending on the resolution of your display, and your pdf viewer) you may see the width of the line change by one or two pixels as you zoom in or out or just scroll the document, if the line is one pixel wide and you position it exactly on a pixel boundary it may appear as 1 or 2 pixels wide depending on the viewer's rules. –  David Carlisle Mar 4 at 10:58
In case you want to modify the thickness try \heavyrulewidth=2pt and \lightrulewidth=2pt. But sometimes the pdf-viewer plays you tricks, and they seem to be of different thickness. –  samcarter Mar 4 at 11:00

Your PDF viewer is playing tricks on you. See David's comment. In fact, by default, \toprule and \bottomrule produce a rule slightly thicker than that produced by \midrule.

If you don't trust me (or your eyes), you can always check this for yourself by printing the values of the relevant thickness macros in your document. According to section 3 of the booktabs documentation,

The rule commands here all take a default which may be reset within the document (preferably, but not necessarily, in the preamble). For the top and bottom rules this default is \heavyrulewidth and for midrules it is \lightrulewidth [...]

\documentclass{article}

\usepackage{booktabs}

\begin{document}

\bgroup
\ttfamily
\begin{tabular}{ll}
\string\toprule\ \& \string\bottomrule\ thickness & \the\heavyrulewidth\\
\string\midrule\ thickness                        & \the\lightrulewidth
\end{tabular}
\egroup

\begin{table}[htbp]
\centering
\begin{tabular}{rrr}
\toprule
\multicolumn{1}{c}{Anzahl der Kanäle} & \multicolumn{1}{c}{Streifenbreite in [mm]} & \multicolumn{1}{c}{Kanalbreite in [mm]} \\
\midrule
\multicolumn{1}{c}{n} & \multicolumn{1}{c}{c} & \multicolumn{1}{c}{b} \\
5     & 13    & 2,80  \\
6     & 11    & 2,50  \\
7     & 9     & 2,86  \\
8     & 8     & 2,50  \\
\bottomrule
\end{tabular}%
\end{table}%
\end{document}

-

It's a precise choice by the author of booktabs: the rules produced by \toprule and \bottomrule, besides applying different vertical spacing, have different thickness than those produced by \midrule.

I use “thickness” where the package author would use “width” in order not to make confusion with the horizontal extent of the rules which is the same for \toprule, \midrule and \bottomrule.

The top and bottom rules are used to clearly separate the table from the context, so they are drawn a bit thicker. You can modify the setup by giving different values to some parameters; here are the defaults

\setlength{\heavyrulewidth}{0.08em}
\setlength{\lightrulewidth}{0.05em}
\setlength{\cmidrulewidth}{0.03em}


The em is computed at package loading, which is possibly a bad choice; it would have been better to delay this setting \AtBeginDocument, which is executed after \normalfont has been issued.

The \heavyrulewidth is used for \toprule and \bottomrule, while \lightrulewidth is used for \midrule. For \cmidrule the third parameter is used, which is slightly less than \lightrulewidth.

Don't trust PDF viewers at low resolutions when comparing rule thicknesses: pixel adjustments can make different rules look alike or conversely.

-
Any idea why \cmidrulewidth is smaller than \lightrulewidth? –  daleif Mar 4 at 11:06
@daleif \cmidrule is not the same as \midrule that separates distinct parts of the table from each other; \cmidrule is a “local separator”. –  egreg Mar 4 at 11:07
but can anyone actually see the difference visually? ;-) –  daleif Mar 4 at 11:22