# Redefining \toprule to default line thickness to use in tables

How can I change the width of a line in a table produced by \toprule to a default of 0.25em?

I know it would be something along the lines of \renewcommand{\toprule}{??} but what would be in the parameter braces?

Or is it easier to simply use \toprule[0.25ex] per table?

I assume that if you want to change the width of \toprule, you also want to change the width of \bottomrule. If that's the case, just issue the instruction

\setlength\heavyrulewidth{0.25ex}


in the preamble after booktabs is loaded.

• Thanks. Can the same be done for \midrule? – Mr Morgan Jan 11 '15 at 22:21
• @MrMorgan Yes, in this case change \lightrulewidth – karlkoeller Jan 11 '15 at 22:22
• @MrMorgan - Sure. The parameter is called \lightrulewidth. For \cmidrules, the parameter is called, drumroll, \cmidrulewidth... – Mico Jan 11 '15 at 22:22
• Note to future self: \cmidrule[thickness](shortening){colstart-colend} so a "local" change can be made with the first square-bracketed option. – PatrickT Mar 5 '18 at 7:26

You should look at the definition of \toprule inside booktabs.sty:

\def\toprule{\noalign{\ifnum0=}\fi
\@aboverulesep=\abovetopsep
\global\@belowrulesep=\belowrulesep %global cos for use in the next noalign
\global\@thisruleclass=\@ne
\@ifnextchar[{\@BTrule}{\@BTrule[\heavyrulewidth]}}


After setting some predefined macro, \toprule uses \@BTrule[\heavyrulewidth] if you don't specify an optional argument. As such, you can redefine the \heavyrulewidth length (default is .08em; which will also affect \bottomrule and perhaps other rules). Better yet, make a new \toprulewidth and replace it inside \toprule using a patch:

\documentclass{article}
\usepackage{booktabs,etoolbox}

\newlength{\toprulewidth}
\setlength{\toprulewidth}{0.25ex}
\patchcmd{\toprule}% <cmd>
{\heavyrulewidth}{\toprulewidth}% <search><replace>
{}{}% <success><failure>

\begin{document}

\begin{tabular}{ccc}
\toprule
A & B & C \\
\midrule
1 & 2 & 3 \\
\bottomrule
\end{tabular}
\end{document}
`