Menu

#92 pgfmathprintnumber: no unity mantissa

Next Release
closed-fixed
9
2018-12-28
2015-02-07
No

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.

Discussion

  • Christian Feuersänger

    • status: open --> closed-fixed
     
  • Christian Feuersänger

    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 using implementation/.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
  • Christian Feuersänger

    Note that \pgfmathprintnumber applies to normal text typesetting, not log axes (at least not in pgfplots).

     

    Last edit: Stefan Pinnow 2018-12-29