How can I format a table column with siunitx
without 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 (siunitx
is 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 thesiunitx
package.] Here's your MWE, slightly reworked:Addendum, Nov. 2021: In version 3 of the
siunitx
package, the valid choices for theround-mode
option arenone
,places
,figures
, anduncertainty
. Obseve thatoff
is no longer a valid choice. Thus, in order to get the code shown above to run under v3 ofsiunitx
, one needs to replaceround-mode=off
withround-mode=none
.