2

I have created tables, which as far as I know have worked fine before. But now I changed some things, added a row and changed the values, and after this one of the columns are not aligned with the text. What could be the reason for this?

\begin{table}[htbp!]
\small

\caption{Descriptive Statistics for Electricty Prices}
\label{table:3:1}

\begin{tabular*}{\textwidth}{
  @{\extracolsep{\fill}}
  l
  *{8}{S[table-format=2.2]}
  @{}
} 
\toprule
{zone} & {count} & {mean} & {std} & {min} & {max} & {skewness} & {kurtosis}  \\
\midrule
1 & 24840 & 32.02 & 34.22 & -1.97 & 506.50 &      3.82 &     25.60 \\
2 & 24840 & 33.06 & 36.16 & -1.97 & 506.50 &      3.87 &     24.73 \\
3 & 24840 & 65.49 & 84.39 & -1.97 & 799.97 &      3.06 &     12.86 \\
4 & 24840 & 80.17 & 97.07 & -1.97 & 799.97 &      2.67 &      9.15 \\
\bottomrule
\end{tabular*}

\smallskip

\footnotesize
Each zone refers to the respective electricty price zone in Sweden, see figure \ref{fig:3:1}. The kurtosis is calculated as the excess kurtosis, i.e. a normal distribution would take the value zero.

\end{table}
1
  • 1
    Please revise your question to include a full "Minimal Working Example" (MWE) that starts with \documentclass, includes all relevant \usepackage commands, ends with \end{document} and compiles without errors, even if it does not produce your desired output.
    – Sandy G
    Dec 4, 2022 at 22:25

1 Answer 1

2
  • The reason may be your definitions of S columns. So far you defined that all has the same table format but they haven't.
  • Instead of use of \extracolsep macro I would rather use \tblr of tabularray package and X[c, si={...}] columns:
\documentclass{article}
\usepackage{tabularray}
\UseTblrLibrary{booktabs, siunitx}


\begin{document}
    \begin{table}[htbp!]
\caption{Descriptive Statistics for Electricty Prices}
\label{table:3:1}
\small
\begin{tblr}{colsep=4pt,
             colspec={@{}   c X[c, si={table-format=5.0}]
                       *{2}{X[c, si={table-format=2.2}]}
                            X[c, si={table-format=-1.2}]
                            X[c, si={table-format=3.2}]
                            X[c, si={table-format=1.2}]
                            X[c, si={table-format=2.2}]
                      @{}},
             row{1} = {guard}
            }
    \toprule
zone    & count & mean  & std   & min   & max    & skewness & kurtosis  \\
    \midrule
1       & 24840 & 32.02 & 34.22 & -1.97 & 506.50 & 3.82     & 25.60     \\
2       & 24840 & 33.06 & 36.16 & -1.97 & 506.50 & 3.87     & 24.73     \\
3       & 24840 & 65.49 & 84.39 & -1.97 & 799.97 & 3.06     & 12.86     \\
4       & 24840 & 80.17 & 97.07 & -1.97 & 799.97 & 2.67     & 9.15      \\
\bottomrule
\end{tblr}

\smallskip
\footnotesize
Each zone refers to the respective electricity price zone in Sweden, see figure \ref{fig:3:1}. The kurtosis is calculated as the excess kurtosis, i.e. a normal distribution would take the value zero.
    \end{table}
\end{document}

enter image description here

  • if you will change any number in columns with numbers, you must check if it has the same number of integers and decimals as are defined for this column.
2
  • Thank you. Is there any difference between for example S columns and the c column you use? Where can I read about this? Dec 4, 2022 at 23:40
  • 1
    @SimonRydstedt, all is described in tabularray package documentation. See 5.7 Library siunitx, page 50.
    – Zarko
    Dec 5, 2022 at 0:41

You must log in to answer this question.

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