[Tex/LaTex] siunitx: how can I avoid adding decimal zeroes

siunitxtables

How can I format a table column with siunitxwithout adding additional zeroes after the decimal separator?

I'd like to see 5,2 in the output instead of 5,200 (however: 0,246 shall still be displayed as 0,246 and e. g. 0,200 shall still be displayed as 0,200 if it is given like that in the source code), but I can not find the correction options (siunitxis too flexible – at least much more flexible then my brain ;-)).

The package options in the preamble have to stay as they are, as this otherwise would affect other tables.

\documentclass{scrbook}

\usepackage[round-mode=places, round-integer-to-decimal, round-precision=2,
    table-format = 1.2, 
    table-number-alignment=center,
    round-integer-to-decimal,
    output-decimal-marker={,}
    ]{siunitx} 

\usepackage[version=3]{mhchem}
\usepackage[tight]{units}
\usepackage{booktabs}


\begin{document}

\begin{tabular}{lllS[table-format=1.3, round-precision=3, table-comparator=true, round-integer-to-decimal=false]}
\toprule
Eigenschaft & Einheit & Spezifikation & {Wert}\\
\midrule
{\ce{Y2O3}} & {(\unit{\%})} & {4,95--5,35} & 5,2 \\
{\ce{Al2O3}} & {(\unit{\%})} & {0,15--0,35} & 0,246 \\
{\ce{SiO2}} & {(\unit{\%})} & {$<0,02$} & <0,002 \\
{\ce{Fe2O2}} & {(\unit{\%})} & {$<0,01$} & <0,002 \\
{\ce{Na2O}} & {(\unit{\%})} & {$<0,04$} & 0,007 \\
GV    & {(\unit{\%})} & {$<1,2$} & 0,42 \\
Spez. Obfl. & {(\unitfrac{m$^2$}{g})} & {5--9} & 6,9 \\
Partikelgröße & {(\unit{\AA})} & {k. A.} & 390 \
\bottomrule
\end{tabular}%
\end{document}

Best Answer

I think what you need is the round-mode=off switch. [Addendum, Nov. 2021: see the remark at the bottom of this answer for an explanation on how to get his answer to work if you're working with version 3.x of the siunitx package.] Here's your MWE, slightly reworked:

\documentclass{scrbook}

\usepackage[round-mode=places, round-integer-to-decimal, round-precision=2,
    table-format = 1.2, 
    table-number-alignment=center,
    round-integer-to-decimal,
    output-decimal-marker={,}
    ]{siunitx} 
\usepackage{booktabs}

\begin{document}

\begin{table}
\centering
\sisetup{table-format=1.3, round-precision=3, table-comparator=true, round-integer-to-decimal=false}
\begin{tabular}{S[round-mode=places]S[round-mode=off]}
\toprule
{``Places''} & {``Off''}\\
\midrule
  5,2   &   5,2   \\
  0,246 &   0,246 \\
 <0,002 &  <0,002 \\
 <0,002 &  <0,002 \\
  0,007 &   0,007 \\
  0,42  &   0,42  \\
  6,9   &   6,9   \\
390     & 390     \\
\bottomrule
\end{tabular}
\end{table}
\end{document}

Addendum, Nov. 2021: In version 3 of the siunitx package, the valid choices for the round-mode option are none, places, figures, and uncertainty. Obseve that off is no longer a valid choice. Thus, in order to get the code shown above to run under v3 of siunitx, one needs to replace round-mode=off with round-mode=none.