1

Primer: I'm very new to LaTeX. I am creating a table with the following code. Here is part of the table:

\usepackage{tabularx, multirow, booktabs}
\begin{table}[tp]
\caption{Rain garden site characteristics}
\label{table:11}
\begin{tabular}{c r @{.} l c r @{.} l r @{.} l r @{.} l r @{.} l}
Site ID &   Surface Area        &   Install Date    &   Roof Catchment Area &   Total Cactchment Area   &   $A_garden$/$A_imper$    &   $A_garden$/$A_total$    \\\otoprule
1   &   10&2    &   2007    &   49&7    &   49&7    &   20&6    &   20&6        \\\midrule
\end{tabular}
\end{table}

I cannot, for the life of me, figure out why it has a problem with \otoprule. I've seen it in many table style guides, and can't figure out what I'm missing. The error code I get is:

! Undefined control sequence.
<recently read> \otoprule
1.5 ... A_imp$ & $A_garden$/$A_total$ \\\otoprule

Thanks for any suggestions!

3
  • 1
    It is \toprule.
    – user11232
    Sep 11 '13 at 22:08
  • Yeah, that's what I thought too. But if you look at page 3 of the PDF I linked in the question, you'll see \otoprule%. What do you make of that?
    – AndMan21
    Sep 11 '13 at 22:11
  • Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format.
    – Corentin
    Sep 11 '13 at 22:33
4

In the cited source\otoprule is defined as follows:

\newcommand{\otoprule}{\midrule[\heavyrulewidth]}

So you should add the preceeding line to obtain the desired result.

2
  • Could you enlighten me as to what that command does? Is it overriding the thickness of toprule?
    – AndMan21
    Sep 11 '13 at 22:17
  • No, it produces some rule of defined thickness. Sep 11 '13 at 22:23
3

The required definition that you're missing is given in the document (p 10):

In this article the line below the heading of the tables has always thickness equal to \toprule and \bottomrule but it is vertically centered with respect to the row above and below (which is typical of the lines \midrule). To obtain this result, a new line type has been defined with the following command

\newcommand{\otoprule}{\midrule[\heavyrulewidth]}

The definition of \midrule from booktabs resembles:

\def\midrule{\noalign{\ifnum0=`}\fi
  \@aboverulesep=\aboverulesep
  \global\@belowrulesep=\belowrulesep
  \global\@thisruleclass=\@ne
  \@ifnextchar[{\@BTrule}{\@BTrule[\lightrulewidth]}}

This definition sets the separation above and below the impending horizontal rule to be equal-ish (\belowrulesep=.65ex and aboverulesep=.4ex). It also allows for the optional specification of the rule thickness. \midrule alone defaults to \@BTrule[\lightrulewidth], although you can otherwise specific the rule width in the optional argument; exactly what \otoprule does through it's definition as \midrule[\heavyrulewidth]. \heavyrulewidth is the length definition used to shape the thickness of \toprule and \bottomrule, as mentioned in the article:

\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]}}
\def\bottomrule{\noalign{\ifnum0=`}\fi
  \@aboverulesep=\aboverulesep
  \global\@belowrulesep=\belowbottomsep
  \global\@thisruleclass=\@ne
  \@ifnextchar[{\@BTrule}{\@BTrule[\heavyrulewidth]}}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.