11

Why overfull in the following code? If I well understood, the tabular has space enough to fit the data.

enter image description here

MWE

\documentclass[11pt,draft]{report}
\usepackage{tabularx}
\usepackage{siunitx,array,booktabs}
\usepackage{showframe}

\begin{document}
\begin{table}[hb]\centering
%\setlength\tabcolsep{8pt}
\begin{tabularx}{\linewidth}{%
c@{\extracolsep{\fill}}%
S[table-format=2]%
S[table-format=4]%
S[table-format=2]%
S[table-format=2]%
S[table-format=2.2]%
S[table-format=1.2]%
S[table-format=2.2]%
c@{\extracolsep{\fill}}%
}
\\\toprule
&  1 &   75 & 15 &  5 & 44.42 & 8.89 & 14.67\% & \\
&  2 &  150 & 30 &  5 & 36.92 & 8.29 & 14.67\% & \\
&  3 &  300 & 60 &  5 & 49.73 & 9.01 & 40.67\% & \\
& 40 &  450 & 90 &  5 & 51.50 & 9.59 & 25.44\% & \\
& 17 &  600 & 15 & 40 & 23.28 & 7.24 & 11.50\% & \\
& 18 & 1200 & 30 & 40 & 27.18 & 7.27 & 07.00\% & \\
& 19 & 2400 & 60 & 40 & 17.82 & 6.62 & 03.75\% & \\
& 20 & 3600 & 90 & 40 & 21.06 & 7.16 & 12.07\% & \\
\bottomrule
\end{tabularx}
\caption{Why overfull?}
\end{table}
\end{document}
0

1 Answer 1

13

siunitx expects the last column to contain a number with two digits in front and two after the decimal sign. It cannot know about the % sign.

\documentclass[11pt,draft]{report}
\usepackage{tabularx}
\usepackage{siunitx,array,booktabs}
\usepackage{showframe}

\begin{document}
\begin{table}[hb]\centering
%\setlength\tabcolsep{8pt}
\begin{tabularx}{\linewidth}{%
c@{\extracolsep{\fill}}%
S[table-format=2]%
S[table-format=4]%
S[table-format=2]%
S[table-format=2]%
S[table-format=2.2]%
S[table-format=1.2]%
S[table-format=2.2,table-space-text-post=\%]%
c@{\extracolsep{\fill}}%
}
\\\toprule
&  1 &   75 & 15 &  5 & 44.42 & 8.89 & 14.67\% & \\
&  2 &  150 & 30 &  5 & 36.92 & 8.29 & 14.67\% & \\
&  3 &  300 & 60 &  5 & 49.73 & 9.01 & 40.67\% & \\
& 40 &  450 & 90 &  5 & 51.50 & 9.59 & 25.44\% & \\
& 17 &  600 & 15 & 40 & 23.28 & 7.24 & 11.50\% & \\
& 18 & 1200 & 30 & 40 & 27.18 & 7.27 & 07.00\% & \\
& 19 & 2400 & 60 & 40 & 17.82 & 6.62 & 03.75\% & \\
& 20 & 3600 & 90 & 40 & 21.06 & 7.16 & 12.07\% & \\
\bottomrule
\end{tabularx}
\caption{Why overfull?}
\end{table}
\end{document}
4
  • That was fast! :) (and precise, +1)
    – gusbrs
    Commented Apr 18, 2018 at 13:22
  • @gusbrs With a clear question that includes a MWE it is easy to be fast, as everything was ready to copy and paste :) Commented Apr 18, 2018 at 13:24
  • How could I discover this by myself? Maybe after reading the whole documentation. So simple solution, from experts. Thanks a lot.
    – Sigur
    Commented Apr 18, 2018 at 13:26
  • I have to wait 3 min to accept. What a waste of time.
    – Sigur
    Commented Apr 18, 2018 at 13:27

You must log in to answer this question.

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