# Table formatting

I use the following table:

\documentclass[a4paper,
12pt,
bibliography=totoc,
index=totoc,
abstracton,
headsepline,
]{scrreprt}

\usepackage{booktabs}

\begin{document}

\begin{table}[H]\hspace*{-1cm}
\centering
\begin{tabular}{lcclll}
\toprule

Company& \multicolumn{2}{c}{exceedances (empirical)}&exeedances (expected)&no. of obs.\\
\cmidrule(r){2-3}\\
&standard normal&standardized Student's-t&&\\
\midrule
Company1&1&5&9&13\\
Company2&2&6&10&14\\
Company3&3&11&15\\
Company4&4&8&12&16\\
\bottomrule
\multicolumn{4}{l}{\begin{footnotesize}an additional hint about a detail\end{footnotesize}}
\end{tabular}
\caption{Here is the caption.}
\label{labelhere}
\end{table}

\end{document}


Which gives

I have two problems:

1. The space after the \cmidrule(r){2-3} is too big, how can I change this?
2. The table looks not that good, how can I improve it in general?

## 2 Answers

Here are some specific suggestions:

• group the table headers a bit more to emphasize the logical structure;
• break up the headers for columns 2 and 3 across two lines to make them less wide;
• don't use vertical whitespace to the left of the first column and to the right of the last column;
• use \midrule[\heavyruleweight] instead of \bottomrule to provide a bit more "breathing room for the next line.

Of course, these suggestions are personal and lay no claim to representing some greater truth...

\documentclass[a4paper,12pt]{scrreprt}
\usepackage{booktabs}
\begin{document}
\begin{table}
\centering
\begin{tabular}{@{} lcccc @{}} % suppress vertical whitespace at start and end
\toprule
Company& \multicolumn{3}{c}{Exceedances} & No.\ of Obs.\\
\cmidrule(lr){2-4}
& \multicolumn{2}{c}{Empirical} & Expected\\
\cmidrule(lr){2-3} \cmidrule(lr){4-4}
&standard & standardized\\    % make columns 2 and 3 narrower
&normal   & Student's-$t$\\
\midrule
Company 1&1&5&9&13\\
Company 2&2&6&10&14\\
Company 3&3&11&15\\
Company 4&4&8&12&16\\
\midrule[\heavyrulewidth] % use "thick" \midrule instead of \bottomrule
\multicolumn{4}{@{}l}{\footnotesize An additional hint about a detail}
\end{tabular}
\caption{Here is the caption.}
\label{labelhere}
\end{table}
\end{document}

• +1, but I’d replace \midrule[\heavyrulewidth] with \bottomrule\addlinespace[\belowrulesep] (both booktabs macros), which yields the same output, but is nicer semantically. I’m not sure if I like the @{}, but that’s a matter of taste. Apr 25 '13 at 19:09

You do not have to add a linebreak (\\) after \cmidrule. This fixes your first problem.

Improvements

• align numbers. You could correctly align numbers (at the decimal point which is not there) using the siunitx-package and the S column type (see below).
• columns. You have defined 6 columns but you only have five of them.

Table with siunitx

\documentclass[a4paper,
12pt,
bibliography=totoc,
index=totoc,
abstracton,
headsepline,
]{scrreprt}

\usepackage{siunitx}

\usepackage{booktabs}

\begin{document}

\begin{table}[H]\hspace*{-1cm}
\centering
\begin{tabular}{lSSSS}
\toprule
Company& \multicolumn{2}{c}{exceedances (empirical)}&{exeedances (expected)}&{no. of obs.}\\
\cmidrule(r){2-3}
&{standard normal}&{standardized Student's-t}&\\
\midrule
Company1&1&5&9&13\\
Company2&2&6&10&14\\
Company3&3&11&15\\
Company4&4&8&12&16\\
\bottomrule
\multicolumn{4}{l}{\begin{footnotesize}an additional hint about a detail\end{footnotesize}}
\end{tabular}
\caption{Here is the caption.}
\label{labelhere}
\end{table}

\end{document}


• thanks for your answer, but I did not understand your first point: "You could correctly align numbers (at the decimal point which is not there)" What do you mean? I am not using a decimal seperator? Apr 25 '13 at 18:30
• You see the result in the screenshot. The 9 is aligned to the 0 of 10. Like this it is easier to compare the numbers. Apr 25 '13 at 18:32