[Tex/LaTex] Why is there too much space between S (siunitx) columns

siunitxtables

I have a table with values. See the code:

\documentclass[paper = landscape, pagesize]{scrartcl}
\usepackage{siunitx}
\begin{document}
  \setlength\tabcolsep{3pt}
  \begin{tabular}{rSSSSSSSSSSS}
    $k$                                    & 1       & 2       & 3       & 4      & 5       & 6    & 7       & 8        & 9        & 10      & 11\\
    $\frac{\vartheta}{\si{\celsius}}$      & 30      & 35      & 40      & 45     & 50      & 55   & 60      & 65       & 70       & 75      & 80\\
    $\frac{U_{AB,m}(\vartheta)}{\si{\mV}}$ & 14,9    & 15,8    & 7,7     & 18,3   & 19      & 20   & 21,1    & 22,2     & 24,3     & 26,9    & 30,1\\
    $\frac{R_{i}(\vartheta)}{\si{\ohm}}$   & 4,26162 & 3,29091 & 3,38843 & 2,0983 & 0,91519 & ,053 & -,70179 & -1,45605 & -1,13902 & -,28405 & 1,21793
  \end{tabular}\\[\baselineskip]
  Some text from Wikipedia\footnote{https://en.wikipedia.org/wiki/Entropy}: In statistical thermodynamics, entropy is a measure of the number of microscopic configurations that a thermodynamic system can have when in a state as specified by some macroscopic variables.\\[\baselineskip]
  \begin{tabular}{rccccccccccc}
    $k$                                    & 1       & 2       & 3       & 4      & 5       & 6     & 7        & 8        & 9        & 10       & 11\\
    $\frac{\vartheta}{\si{\celsius}}$      & 30      & 35      & 40      & 45     & 50      & 55    & 60       & 65       & 70       & 75       & 80\\
    $\frac{U_{AB,m}(\vartheta)}{\si{\mV}}$ & 14,9    & 15,8    & 17,7    & 18,3   & 19      & 20    & 21,1     & 22,2     & 24,3     & 26,9     & 30,1\\
    $\frac{R_{i}(\vartheta)}{\si{\ohm}}$   & 4,26162 & 3,29091 & 3,38843 & 2,0983 & 0,91519 & 0,053 & -0,70179 & -1,45605 & -1,13902 & -0,28405 & 1,21793
  \end{tabular}
\end{document}

And the result:

result

But why is there so much space between the columns compared to for example a c-column. Even if I use very small space between the columns: \setlength\tabcolsep{3pt}.

Why it happens? How can I solve it?

Thank you for your help and effort in advance!

Best Answer

You should guide siunitx by providing a proper table-format in the column definition:

\documentclass[paper = landscape, pagesize]{scrartcl}
\usepackage{siunitx}
\begin{document}
\setlength\tabcolsep{3pt}

\noindent\begin{tabular}{r*{11}{S[table-format = 2.5]}}
    $k$                                    & 1       & 2       & 3       & 4      & 5       & 6    & 7       & 8        & 9        & 10      & 11\\
    $\frac{\vartheta}{\si{\celsius}}$      & 30      & 35      & 40      & 45     & 50      & 55   & 60      & 65       & 70       & 75      & 80\\
    $\frac{U_{AB,m}(\vartheta)}{\si{\mV}}$ & 14,9    & 15,8    & 7,7     & 18,3   & 19      & 20   & 21,1    & 22,2     & 24,3     & 26,9    & 30,1\\
    $\frac{R_{i}(\vartheta)}{\si{\ohm}}$   & 4,26162 & 3,29091 & 3,38843 & 2,0983 & 0,91519 & ,053 & -,70179 & -1,45605 & -1,13902 & -,28405 & 1,21793
  \end{tabular}

  Some text from Wikipedia\footnote{https://en.wikipedia.org/wiki/Entropy}: In statistical thermodynamics, entropy is a measure of the number of microscopic configurations that a thermodynamic system can have when in a state as specified by some macroscopic variables.

\noindent\begin{tabular}{rccccccccccc}
    $k$                                    & 1       & 2       & 3       & 4      & 5       & 6     & 7        & 8        & 9        & 10       & 11\\
    $\frac{\vartheta}{\si{\celsius}}$      & 30      & 35      & 40      & 45     & 50      & 55    & 60       & 65       & 70       & 75       & 80\\
    $\frac{U_{AB,m}(\vartheta)}{\si{\mV}}$ & 14,9    & 15,8    & 17,7    & 18,3   & 19      & 20    & 21,1     & 22,2     & 24,3     & 26,9     & 30,1\\
    $\frac{R_{i}(\vartheta)}{\si{\ohm}}$   & 4,26162 & 3,29091 & 3,38843 & 2,0983 & 0,91519 & 0,053 & -0,70179 & -1,45605 & -1,13902 & -0,28405 & 1,21793
  \end{tabular}
\end{document}

The results is still wider, because it always reserves space for 2.5 digits, adds leading zeros and uses - in math mode.

Maybe you could also transpose the whole table to 4 columns and 12 rows. Then you probably would have less trouble fitting it on a page. Also check out: My table doesn't fit; what are my options?

Related Question