[Tex/LaTex] Making a booktabs table

booktabs

I don't really know how to make tables with booktabs and other posts on this don't seem to help me too much.

I have to make a table similar to the one with the image below. How would I get on with something like this?
enter image description here

Best Answer

Here's an implementation using also siunitx. You should adjust the settings for table-format according to the real data.

\documentclass{article}
\usepackage[margin=1in,landscape]{geometry}
\usepackage[table]{xcolor}
\usepackage{booktabs,siunitx}
\usepackage{caption}

\newcommand{\splitcell}[1]{%
  \begingroup
  \renewcommand{\arraystretch}{1}%
  \begin{tabular}{@{}c@{}}#1\end{tabular}%
  \endgroup
}

\captionsetup{font=bf}

\begin{document}

\begin{table}[htp]

\caption{Processed Data}

\renewcommand{\arraystretch}{1.2}
\rowcolors{1}{gray!30}{white}

\begin{tabular}{
  S[table-format=2.0]
  *{3}{% fix here the values
   S[table-format=1.0]
   S[table-format=1.0]
   S[table-format=1.0]
  }
}
\toprule
\rowcolor{white}
{\splitcell{Number of sheets of \\ Dielectric Material}} &
\multicolumn{3}{c}{Dry Paper (C)/\si{pF} \SI{\pm 0.01}{\percent}} &
\multicolumn{3}{c}{Waxed Paper (C)/\si{pF} \SI{\pm 0.01}{\percent}} &
\multicolumn{3}{c}{Impregnated Paper (C)/\si{pF} \SI{\pm 0.01}{\percent}} \\
\cmidrule(lr){2-4}\cmidrule(lr){5-7}\cmidrule(lr){8-10}
\rowcolor{white}
& {Average} & {\splitcell{Standard \\ Deviation}} & {\splitcell{Absolute \\ Uncertainty}}
& {Average} & {\splitcell{Standard \\ Deviation}} & {\splitcell{Absolute \\ Uncertainty}}
& {Average} & {\splitcell{Standard \\ Deviation}} & {\splitcell{Absolute \\ Uncertainty}} \\
\midrule
 8 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 \\
16 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 \\
24 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 \\
32 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 \\
\specialrule{\lightrulewidth}{0pt}{0pt}
40 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 \\
48 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 \\
56 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 \\
64 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 \\
\specialrule{\lightrulewidth}{0pt}{0pt}
72 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 \\
80 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 \\
88 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 \\
96 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 \\
\specialrule{\heavyrulewidth}{0pt}{0pt}
\end{tabular}

\end{table}

\end{document}

enter image description here

I don't think that the stripes are good, though, so I also add the “stripe free” version (removing \rowcolors and \rowcolor commands).

enter image description here

Related Question