5

I have the following table:

\documentclass{scrartcl}
\usepackage[locale = DE, round-mode = places, round-precision =
4]{siunitx}
\usepackage{booktabs}
\begin{document}
\begin{table}[h]
\centering
\begin{tabular}{lS*6{S[table-format=-1.8]}}
\toprule
& {Reference} & {FML} & {IFM} & {IFM (NV)} & {PML} & {MM} \\
\midrule
{MSE} & 0.05924657 & 0.07423921 & 0.08774748 & 0.18118911 & 0.13403073
                                                                 & 0.16849250 \\
{Bias} & 0.01030783 & 0.01524758 & -0.06442111 & -0.18893351 & -0.02010527 & 0.03427978 \\
{Std.dev.}  & 0.2433095 & 0.2721779 & 0.2892768 & 0.3816266  & 0.3657325 & 0.40924921 \\
\bottomrule
\end{tabular}
\caption{My table}
\end{table}
\end{document}

However, the alignment of the column headers is off. I'd like them centred over the column content. I've tried various options such as table-alignment to no avail.

1 Answer 1

6

table-format=-1.8 reserves place for eight decimal digits after the decimal marker, but only four are actually used. Also not all columns contain negative numbers.

\documentclass{scrartcl}
\usepackage[
  locale = DE,
  round-mode = places,
  round-precision = 4]{siunitx}
\usepackage{booktabs}
\begin{document}
\begin{table}[h]
\centering
\begin{tabular}{
  l
  *2{S[table-format=1.4]}
  *3{S[table-format=-1.4]}
  S[table-format=1.4]
}
\toprule
& {Reference} & {FML} & {IFM} & {IFM (NV)} & {PML} & {MM} \\
\midrule
{MSE} & 0.05924657 & 0.07423921 & 0.08774748 & 0.18118911 & 0.13403073 & 0.16849250 \\
{Bias} & 0.01030783 & 0.01524758 & -0.06442111 & -0.18893351 & -0.02010527 & 0.03427978 \\
{Std.dev.} & 0.2433095 & 0.2721779 & 0.2892768 & 0.3816266  & 0.3657325 & 0.40924921 \\
\bottomrule
\end{tabular}
\caption{My table}
\end{table}
\end{document}

Result

With vertical rules to make it easier to see the centering of the header row cells:

\setlength{\tabcolsep}{0pt}% no extra space around columns
\begin{tabular}{
  l|
  *2{S[table-format=1.4]|}
  *3{S[table-format=-1.4]|}
  S[table-format=1.4]|
}

Result

2
  • While the Reference, FML, MM and IFM (NV) columns seem to be properly centred, it seems like the PML and IFM columns aren't. Sep 9, 2015 at 17:11
  • @user2249626 An optical illusion, because the minus sign is quite large and is not present at the first data row, see the updated answer. Sep 9, 2015 at 17:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .