# How to use booktab or type this Table in REVTex4 / REVTex4-1

I wish to type this table in REVTex, however, the code below does not work for \documentclass{revtex4} but only for \documentclass{article}:

\documentclass{revtex4}
\usepackage{array,mathtools,amssymb,booktabs}
\newcolumntype{C}{>{$}c<{$}}
\begin{document}
\begin{tabular}{cCCC}
\toprule
\multicolumn{2}{c}{} & K & H\\\midrule
A & a & 1& 4\\\cmidrule(lr){2-4}
B & b & 2 & 5\\\cmidrule(lr){1-4}
\multicolumn{2}{c}{C}& 3 & 6\\\bottomrule
\end{tabular}
\end{document}


The code is from the source of this page. Thanks to the generous cfr.

booktabs sets the default widths in a font dependent way (em units) but it seems that revtex does not set up the font until \begin{document} so you need to delay setting the rule widths:

\documentclass{revtex4}
\usepackage{array,mathtools,amssymb,booktabs}
\newcolumntype{C}{>{$}c<{$}}
\AtBeginDocument{
\heavyrulewidth=.08em
\lightrulewidth=.05em
\cmidrulewidth=.03em
\belowrulesep=.65ex
\belowbottomsep=0pt
\aboverulesep=.4ex
\abovetopsep=0pt
\cmidrulesep=\doublerulesep
\cmidrulekern=.5em
}
\begin{document}
\begin{tabular}{cCCC}
\toprule
\multicolumn{2}{c}{} & K & H\\\midrule
A & a & 1& 4\\\cmidrule(lr){2-4}
B & b & 2 & 5\\\cmidrule(lr){1-4}
\multicolumn{2}{c}{C}& 3 & 6\\\bottomrule
\end{tabular}
\end{document}

• Thank you. What is the purpose for this paragraph "\AtBeginDocument{...}" ? Where should I input this? – wonderich Jan 12 '15 at 1:20
• To avoid the duplicated code, couldn't one just do \AtBeginDocument{\usepackage{booktabs}} (also removing booktabs from the \usepackage on line 2, of course)? – Paul Gessler Jan 12 '15 at 1:20
• This is overwriting revtex4's own definition of commands such as \toprule. If this is for submission somewhere requiring the use of revtex4, I doubt this is a good idea at all. – cfr Jan 12 '15 at 1:22
• But it defines \toprule etc., right? So loading booktabs overwrites those definitions. – cfr Jan 12 '15 at 2:03
• @DavidCarlisle After these comments, it's hard to figure out what's the right way to proceed and whether the definitions get overwritten... – Dr_Zaszuś Aug 2 '17 at 13:31