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:
for the top horizontal rule,
for the bottom horizontal rule, and
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:
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 MaterialGo 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:
- How to change a whole row of a table
- Merging cells in a column of a table
- Fixed width tables
- Variable-width columns in tables
- Spacing lines in tables
This book is also available as A4 PDF or 12.8cm x 9.6cm PDF or paperback (ISBN 978-1-909440-00-5).