[Tex/LaTex] alignment of table numbers

horizontal alignmentsiunitxtables

why the numbers indicated from the arrows are not aligned compared to the columns above ?

enter image description here

\documentclass[border=10.0mm]{standalone}

\usepackage{booktabs,caption}

\usepackage{siunitx}

\sisetup{%
         output-decimal-marker={,}%
        }



\begin{document}
\begin{tabular}{*{4}{S}}
\toprule
{Distanza} & {$p$-$q$} & {$f$}  & {$f$} \\
{(mm)}     & {(mm)}    & {(mm)} & {(\%)} \\
\midrule
200        & 100       & 193,5  & 96,7 \\
           & 660       & 197,0  & 98,0 \\
           & 592       & 195,3  & 97,7 \\
\cmidrule(rl){1-4}
150        & 320       & 144    & 96 \\
           & 424       & 147    & 98 \\
           & 150       & 144    & 96 \\
\cmidrule(rl){1-4}
100        & 940       & 100    & 100,0 \\
           & 884       & 974    & 97,4 \\
           & 292       & 955    & 95,5 \\
\bottomrule
\end{tabular}
\end{document}

Best Answer

The standard settings for siunitx centre the decimal marker, but if there is no decimal marker at all in some numbers you will get a slight offset. The recommended method for using siunitx is to set the table-format appropriately for each table

\sisetup{table-format = 3.1}

as this allows the package to revise the correct space and also deals with numbers without decimal markers.