I am using power to 1/2 in siunitx:


\usepackage[per-mode = symbol-or-fraction]{siunitx}





It works fine when \per is not used. However, with \per I get strange errors:

<argument> \???  
                 ! LaTeX Error: Erroneous variable \protect used!
l.XX ...{\meter\per\second\tothe{\text{\sfrac12}}}

It seems that there is some bug in siunitx. Anyone has any idea how to solve this problem?

  • seems to work if you replace the \tothe with the ^ carrot. Might be a bug, or might just be that the m/s construction doesn't like the exponent for whatever reason.
    – Jake
    Aug 15, 2023 at 19:19
  • @Jake Yes, but this workaround does not work if you use something like \DeclareSIPostPower\rooted{\text{\sfrac{1}{2}}} and then \rooted
    – Pygmalion
    Aug 15, 2023 at 19:24

1 Answer 1


By using \tothe{\sfrac{1}{2}} you are relying on siunitx printing the power with no mathematical intervention: the unit is handled in 'parsed' mode as everything 'looks' parsable (there are no out-and-out literals). However, once you add \per, in parsed mode siunitx needs to do maths with the exponent. That fails as \sfrac{1}{2} is not a number.

What you should be doing here is helping out siunitx using parse-units = false: that forces literal printing, and no inversion of the fraction is attempted.

I will think a bit about whether this should always be an error. I have in the past toyed with conversion of fractions in exponents, but it looks quite a lot of code and not 100% reliable. I will though look at this again: I'll log some issues.

  • To be clear, an easy 'fix' for me is to always evaluate the input, then you'd always get an error - consistent but likely not what's wanted. So I'll treat as a feature request and sort that before making a change.
    – Joseph Wright
    Aug 16, 2023 at 5:58
  • As it is, it just works to my needs. \unit{\W\s\rooted\per\m\squared\per\K} is the unit for effusion and \unit[parse-units = false]{\m\per\s\rooted} for sorptivity. Both in per-mode = symbol-or-fraction.
    – Pygmalion
    Aug 16, 2023 at 6:39

You must log in to answer this question.

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