5

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!

1 Answer 1

9

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?

7
  • 2
    Also one can improve adding \sisetup{table-number-alignment=center}. The default is that the decimal dot is centred, not the number, whence the large blank on the left of cells, due to the much larger number of digits in the decimal part.
    – Bernard
    Apr 10, 2017 at 7:58
  • 2
    You're right: the table should be transposed.
    – egreg
    Apr 10, 2017 at 8:25
  • @Bernard surely that defeats the object of using S columns? The issue here is more that dissimilar numbers share a column, which would be addressed by transposing the table (along with the row/column counts swapping)
    – Chris H
    Apr 10, 2017 at 9:06
  • 1
    I quite agree with the idea of a transposed table. But why centring numbers in their columns while keeping alignment on the decimal dot would be defeating the object of S columns?
    – Bernard
    Apr 10, 2017 at 10:10
  • @Bernard table-number-alignment=center is implicitly set by table-format
    – Joseph Wright
    Apr 10, 2017 at 11:23

You must log in to answer this question.

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