About
Shop
LaTeX
Software
Books
Gallery
News
Contact
Blog
Settings
Account
Latest news 2024-12-13: Ebook sale (12th December 2024 – 1st January 2025): cybercrime fiction short stories Unsocial Media and Smile for the Camera free; crime fiction short story The Briefcase free; short story noir crime fiction I’ve Heard the Mermaid Sing free; crime fiction novel The Private Enemy US$1.99; illustrated children’s story The Foolish Hedgehog US$0.99.


4.6.3 Rules

In general, vertical rules are considered superfluous [11]. Although Turabian [17] allows for the possibility of vertical rules for tabulated material containing more than two columns but still advises against having too many and deprecates the use of them at either end.

Horizontal rules may be used at the top and bottom of the tabulated material, but other horizontal rules should be kept to a minimum. In general, the top and bottom rule should be thicker than the mid rules.

The booktabs package provides:

\toprule[<wd>]

for the top horizontal rule,

\bottomrule[<wd>]

for the bottom horizontal rule, and

\midrule[<wd>]

for horizontal rules in between rows, such as after the header row.

These commands should all go at the start of the appropriate row. This means that if you want a bottom rule, you need to add \\ followed by \bottomrule at the end of the tabulated material.

Example:

\begin{tabular}{lrr}
\toprule
          & \multicolumn{1}{c}{Year1}
          & \multicolumn{1}{c}{Year2}\\
\midrule
Travel    & 100,000 & 110,000\\
Equipment & 50,000 & 60,000\\
\bottomrule
\end{tabular}

results in:

Image: as previous example but with horizontal rules
at the start and end and between the first and second rows.

The thickness of the top and bottom rule is given by the length register \heavyrulewidth, and the thickness of the mid rule is given by the length register \lightrulewidth. These rule thicknesses can be overridden using the optional argument <wd> for \toprule, \midrule and \bottomrule.

Exercise 7: Aligning Material

Go back to the document you created in Exercise 2 (and later modified in Exercise 3), and add the following:

Note that the tabular environment doesn't create a caption, all it does is arrange its contents in rows and columns. You can find out how to turn your tabular environment into a table in §7.2. Tables.

You can download or view the solution to this exercise. (Remember to check Appendix B. Common Errors if you encounter an error message.)

For more information about using the tabular environment see LaTeX: A Document Preparation System [9], A Guide to LaTeX [7] or The LaTeX Companion [3]. The LaTeX Companion also describes how to span rows using the multirow package. For information on how to create coloured tables using the colortbl package, see The LaTeX Graphics Companion [5].

Related UK FAQ topics:


This book is also available as A4 PDF or 12.8cm x 9.6cm PDF or paperback (ISBN 978-1-909440-00-5).

© 2012 Dickimaw Books. "Dickimaw", "Dickimaw Books" and the Dickimaw parrot logo are trademarks. The Dickimaw parrot was painted by Magdalene Pritchett.

Terms of Use Privacy Policy Cookies Site Map FAQs