# Columns in tables produced using booktabs

I'm trying to make a table using the booktabs package. Here's the code:

\documentclass[11pt,amssymb]{amsart}
\usepackage{booktabs} % Allows the use of \toprule, \midrule and \bottomrule in tables
\usepackage{amsmath}
\usepackage{caption}
\usepackage{mathtools}
\usepackage{amsthm}
\usepackage{fullpage}

\begin{document}

\begin{table}\hspace*{-1cm}
\centering
\begin{tabular}[h]{ccccccc}
\toprule
$\circ$ & $1$ & $r$ & $r^2$ & $s$ & $sr$ & $sr^2$  \\
\midrule
$1$ & $1$ & $r$ & $r^2$ & $s$ & $sr$ & $sr^2$  \\
\midrule
$r$ & $r$ & $r^2$ & $1$ & $sr^2$ & $s$ & $sr$  \\
\midrule
$r^2$ & $r^2$ & $1$ & $r$ & $sr$ & $sr^2$ & $sr$  \\
\midrule
$s$ & $s$ & $sr$ & $sr^2$ & $1$ & $r$ & $r^2$  \\
\midrule
$sr$ & $sr$ & $sr^2$ & $s$ & $r^2$ & $1$ & $r$  \\
\midrule
$sr^2$ & $sr^2$ & $s$ & $sr$ & $r$ & $r^2$ & $1$  \\
\bottomrule
\end{tabular}
\caption{Group Table for $D_6$}
\end{table}

\end{document}


Here's the output:

I would like to add vertical columns, but the package produces vertical lines that are broken by each row.

• Welcome to TeX.SE. It's part of the unabashed design philosophy of the booktabs package never to use vertical rules. :-)
– Mico
Nov 9, 2017 at 18:29
• Nov 9, 2017 at 18:30
• If you read the booktabs manual you will see that making vertical lines unusable is a design aim. also }[h] tabular does not have an h option, unfortunately latex doesn't flag that error, it just ignores the h (the only allowed values are t c or b) Nov 9, 2017 at 18:35
• Off-topic: What's the purpose of the \hspace*{-1cm} directive? It causes the tabular environment to be shifted 1cm to the left, causing a noticeably asymmetric placement of the caption.
– Mico
Nov 9, 2017 at 18:50
• What do you mean with ‘adding vertical columns’? Nov 9, 2017 at 18:55

A hallmark of well-designed tables is that they (a) hardly ever use vertical lines and (b) use few, but well-spaced, horizontal lines. Whitespace can be every bit as effective as a visual separator.

Applied to your table, I would like to suggest that you not use any \midrule directives; instead, simply increase the value of \arraystretch a bit. (I use a value of 1.25 in the example below.)

Separately, since every single cell in the 7*7 table contains a math formula, you may want to use an array environment instead of a tabular environment. This lets you avoid having to type 2*7*7=98 [!] separate $ symbols -- two per cell... \documentclass[11pt,amssymb]{amsart} \usepackage{mathtools,booktabs,caption,fullpage} \begin{document} \begin{table} \centering \renewcommand\arraystretch{1.25}$\begin{array}{@{} *{7}{c} @{}}
\toprule
\circ& 1   & r   & r^2 & s   & sr  & sr^2 \\
1    & 1   & r   & r^2 & s   & sr  & sr^2 \\
r    & r   & r^2 & 1   & sr^2& s   & sr   \\
r^2  & r^2 & 1   & r   & sr  & sr^2& sr   \\
s    & s   & sr  & sr^2& 1   & r   & r^2  \\
sr   & sr  & sr^2& s   & r^2 & 1   & r    \\
sr^2 & sr^2& s   & sr  & r   & r^2 & 1    \\
\bottomrule
\end{array}$\caption{Group Table for$D_6$} \end{table} \end{document}  Cayley tables are not normal tables for data, so I suggest not using booktabs for them. \documentclass[11pt]{amsart} \usepackage{array} \usepackage{caption} \begin{document} \begin{table} \centering % adjustments for this table \setlength{\extrarowheight}{.3ex} % add to the height \renewcommand{\arraystretch}{1.2} % add some space between rows \captionsetup{belowskip=2ex}$\begin{array}{c|cccccc}
\circ & 1 & r & r^2 & s & sr & sr^2  \\
\hline
1 & 1 & r & r^2 & s & sr & sr^2  \\
r & r & r^2 & 1 & sr^2 & s & sr  \\
r^2 & r^2 & 1 & r & sr & sr^2 & sr  \\
s & s & sr & sr^2 & 1 & r & r^2  \\
sr & sr & sr^2 & s & r^2 & 1 & r  \\
sr^2 & sr^2 & s & sr & r & r^2 & 1  \\
\end{array}$\caption{Group Table for$D_6$} \end{table} \end{document}  I only added the necessary packages; perhaps the \captionsetup command should go in the preamble, if you prefer table caption to be at the bottom. The option amssymb to \documentclass doesn't make sense. Also, amsmath and amsthm are automatically loaded with amsart. A couple of adjustments are made: some additional height for the cells and some more spacing between rows. Using array avoids the need for $ commands.