siunitx
has an option which renders \num[retain-unity-mantissa=false]{1e9}
as "10^9", while \num{1e9}
renders as "1 \times 10^9"; \pgfmathprintnumber{1e9}
renders "1 \cdot 10^9", and provides no option to just render "10^9".
A similar option would be nice to have in PGF as well; for example when used in a \datavisualization
with logarithmic axes, printing the mantissa on each tick label wastes a lot of space.
It would also be nice to be able to completely replace \pgfmathprintnumber
, for example with siunitx
' \num,
using just a .code
option, without having to manually patch things.
I have implemented the requested feature
retain unit mantissa=true|false
(default true).It applies after rounding in all styles which involve the scientific format.
I added (undocumented) support to exchange
\pgfmathprintnumber
usingimplementation/.code=\num
. However, I will keep this private for now. You can experiment with it as soon as you have the revision... I cannot judge what happens in other parts of pgf (or pgfplots) which expect that keys in/pgf/number format
are accepted -- but\num
would not know them.Last edit: Stefan Pinnow 2018-12-29
Note that
\pgfmathprintnumber
applies to normal text typesetting, not log axes (at least not inpgfplots
).Last edit: Stefan Pinnow 2018-12-29