2

Comments in the thread Is there an easy way to create a partial \toprule? provide a solution for creating a "partial" \toprule. Is there a way to create an analogous partial \bottomrule?

I.e. what characteristic must be added to a \cmidrule to make it simulate the behaviour of \bottomrule?

9

Let's assume your tabular-like environment has 5 columns and that the "partial bottomrule" should span columns 2-4, with trimming on the left and the right. The following directives should work for you:

\cmidrule[\heavyrulewidth](lr){2-4}
\addlinespace[-\belowrulesep] 

Addendum: If your document calls for repeated uses of partial top and bottom rules, it's worth setting up dedicated macros; they're called \partialtoprule and \partialbottomrule in the following example. Note that the macros take 2 arguments: the first argument, if non-empty, indicates any trimming that should be performed. In the following screenshot, the first tabular environment employs standard \toprule and \bottomrule directives, while the second employs "partial" top and bottom rules. (The thin longer lines in the following screenshot are there just to indicate what's above and below the tabular environments.)

enter image description here

\documentclass{article}

\usepackage{booktabs}
\newcommand\partialtoprule[2]{%
   \addlinespace[-\aboverulesep]
   \cmidrule[\heavyrulewidth](#1){#2}}
\newcommand\partialbottomrule[2]{%
   \cmidrule[\heavyrulewidth](#1){#2}
   \addlinespace[-\belowrulesep]}

\begin{document}

\hrule
\begin{tabular}{@{}ccccc@{}}
\toprule
   AAA & BBB & CCC & DDD & EEE \\
\bottomrule
\end{tabular}
\hrule
\begin{tabular}{@{}ccccc@{}}
\partialtoprule{r}{1-2}     % right-trimming only
   AAA & BBB & CCC & DDD & EEE \\
\partialbottomrule{lr}{3-4} % left- and right-trimming 
\end{tabular}
\hrule

\end{document} 

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.