I like the default behavior of the siunitx
package in that the thousands separator is not applied to four digit numbers, but is applied when the number of digits exceeds four. In documents that contain pgfplots
, \pgfmathprintnumber
is used for the formatting of the numbers, but it does not exhibit this behavior:
Is there a setting for \pgfmathprintnumber
to format numbers similar to the \num
macro from the siunitx
package so either method can be freely used with for formatting numbers
Code:
\documentclass{article}
\usepackage{siunitx}
\usepackage{pgf}
\sisetup{
group-digits=true,
group-separator={\,},
}
\pgfkeys{/pgf/number format/.cd, set thousands separator={\,}}%
\begin{document}
\begin{tabular}{rll}
siunitx: &\num{9000} &\num{19000} \\
pgf: &\pgfmathprintnumber{9000} &\pgfmathprintnumber{19000} \\
\end{tabular}
\end{document}
Best Answer
siunitx
-independent PGF solutionThe same behaviour of
siunitx
’ optiongroup-four-digits
set to false can be achieved in PGF with the/pgf/number format/min exponent for 1000 sep
style.From the PGF manual, section 66.1 “Changing display styles”, p. 547:
Code
Output
siunitx
and PGFIf you want to use
siunitx
and PGF’s number printing system consistently together you should check outsiunitx
“little”\SendSettingsToPgf
macro.From the
siunitx
manual, section 7.9 “Transferring settings to PGF”, p. 63:As
group-four-digits
is set tofalse
per default there are no further adjustment needed in your example.Code
Output