siunitxis now updated with the feature requested/bug fix, and is available in Tex Live, and it works great.

Reason for dragging this question up again

With the answers I got the last time, I felt I was misunderstood, and I understand that I must have not made my point very clear. I will try again to explain myself.

Requirements for accepted answer, leading to bounty

I will accept an answer that can show either of these types of answers:

  • My input is wrong, and giving some different commands will result in the result I am hoping for.
  • My understanding of mathematics is wrong. The result that I am expecting is totally wrong, and show my why.
  • siunitxhas a bug. Should I report it? Is there a quick fix for it?
  • Custom-code which gives me the result I am expecting. See below, under siunitx just doesn't do this?

The question itself:

Siunitxcan turn exponents into prefixes, and does this very nicely for many inputs. However, when giving \si-commands with cubed,squared doesn't work correctly. My example should make this clear now. I might add, that this happens with cubicand squared too, and I of course understand that exponent-to-prefix might be a new feature and that it may takes a lot of work to create a package like this.

Siunitx just doesn't do this?

As mentioned in some of the answers and comments, siunitx is not meant to do this. Well, I think that is misleading, and I think siunitxcould benefit from this feature a lot. It would make automatic typesetting a lot easier. I have made some script which takes some calculated inputs and gives typesets these with clear, easy to read inputs. This works for all numbers, but not the mentioned cubed,squared-units. For all of those, I need to edit manually, one by one. Now, if the community all agrees that this feature should not go into siunitx, then I would like to ask for a custom-solution for this problem.

    exponent-to-prefix = true        ,
    round-mode         = places     ,
    round-precision    = 2           ,
    scientific-notation = engineering,
    zero-decimal-to-integer = false,


\SI{0,0001}{\metre\squared} (should print {\SI{100}{\milli\metre\squared}})

\SI{0,0001}{\metre\cubed} (should print {\SI{100}{\centi\metre\squared}})

\SI{5000}{\deci\metre\squared} (should print {\SI{50}{\metre\squared}})

which produces this: example of wrong results

Also, have a look at these from Wolfram Alpha(1) and Wolfram Alpha(2) :

enter image description hereenter image description here

  • A feature that's, at the least, unexpected. ;-)
    – egreg
    Commented Oct 16, 2015 at 16:20
  • Your example doesn't show any discrepancy in units conversion. All three examples are gives correct example. So, your claim for third line is wrong. Please add example which you mentioned in comment below, this seems show some problem in unit number/unit conversion.
    – Zarko
    Commented Jan 4, 2016 at 21:19
  • 1
    I found discrepancy in conversion ` \SI{5000}{\deci\metre\squared} ` which should give 50 square meters (0,5 are). Given examples in question gives expected result, doesn't it? I will check latter again.
    – Zarko
    Commented Jan 4, 2016 at 22:57
  • 1
    agreed with OP. if \SI{0,0001}{\metre\squared} syntax produces counter-intuitive 100µm^2 rather than correct 100mm^2 for the reason that \squared only means "extend with ^2" at some point, couldn't there be a \metrecarre or \squaremetre provided by siunitx, or a use of \squared as prefix like \squared\metre to tell the parser the user is really meaning m^2 ? (or perhaps this is already in siunitx ?)
    – user4686
    Commented Jan 5, 2016 at 8:16
  • 2
    Note that the 'transformations' here were only every really intended for simple cases: metres to centimetres, etc., and that I've simply not tried to cover more complex cases. I will take a look at the code and see if I can extend readily to powers of one unit, but note that I'm not going to take on more complex units (\centi\metre\per\kilo\gram or whatever).
    – Joseph Wright
    Commented Jan 5, 2016 at 9:32

3 Answers 3


The exponent-to-prefix conversion is quite 'simple minded' and is meant for easy-to-handle cases. Initially that meant that the behaviour with power in units was undefined. However, it is simple to extend the conversion code for the case


or similar. This has therefore been done and will be present in v2.6o onward (sent to CTAN 2016-01-05).

  • great work, and really fast. I will have a look at it as soon as it is available.
    – Runar
    Commented Jan 5, 2016 at 21:19

siunitx just provides \squared as a notation macro, not a computation. So 0,0001 metre is (correctly) converted to 100 micrometre and the square symbol is added, resulting in 100 μm². Cf.

\usepackage[per-mode=fraction]{siunitx} % also loads xparse and expl3

which gives 5m² (and not 25m²).

  • With exponent-to-prefix one would think that it should pay attention to whether the number is squared or cubed. Currently, exponent-to-prefix works great for any other number.
    – Runar
    Commented Oct 16, 2015 at 14:24
  • I might not be clear enough. 5m² is of course not 25m², but it is 5000dm². For the example 5m², it should give 5m², but if you gave it 5000dm² as inputCurrently, Siunitx makes errors when converting these. currently, for \SI{5000}{\deci\metre\squared} it gives 5 hm², which is incorrect.
    – Runar
    Commented Oct 16, 2015 at 18:20

If you need to perform a calculation (e.g., squaring a number) along with printing it out in a formatted manner, you may achieve your objective by using LuaLaTeX. (The result should be 10 nm, right?

% !TEX TS-program = lualatex
\usepackage{siunitx} % also loads xparse and expl3
  { per-mode           = fraction    ,
    exponent-to-prefix = true        ,
    round-mode         = places      ,
    round-precision    = 2           ,
    scientific-notation = engineering,
    zero-decimal-to-integer = true

  • Actaully, it should output 100mm². And, is this not a bug in siunitx? I mean, it should be able to convert these numbers correctly, if it can do normal numbers which are not squared. 1m = 1000mm, 1m² ≠ 1000Mmm² but 1000000mm^2
    – Runar
    Commented Oct 16, 2015 at 16:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .