3

I'm going through a number of old documents where I used siunitx to display numbers in scientific notation with non-integer exponents, like:

\documentclass{article}
\usepackage{siunitx}

\begin{document}
\num{e8.2}
\end{document}

(a very common way to write equilibrium constants in chemistry)

Unfortunately, with TeX Live 2021 those documents can't be recompiled as is, because newer siunitx seems unable to process non-integer exponents, so I have to fall back to:

10^{\num{8.2}}

Is there a more elegant to do that within the siunitx package? Thanks for your attention.

2
  • 2
    I'm a chemist and I can't think of every seeing equilibrium constants given this way: it would be very had to compare them.
    – Joseph Wright
    Mar 28, 2022 at 12:47
  • 3
    It may vary from country to country, then. But here (France), the strength of an acid is typically described with its pKa, so that its acid dissociation constant is written 10^{-pKa}, where pKa is usually a non-integer value.
    – Miyase
    Mar 28, 2022 at 13:56

1 Answer 1

1

The exponent part of a number in siunitx was always intended to be an integer, for use with SI prefixes. In v2, the fact this was not enforced was more-or-less an oversight. If you need values with non-integer exponents, you can format them yourself

\num[parse-numbers = false]{10^{8.2}}

which is of course essentially just math mode ($10^{8.2}$) but with the font control set up.

5
  • Non-integer exponents make comparison of values very tricky: I am very reluctant to add this back in
    – Joseph Wright
    Mar 28, 2022 at 12:47
  • 1
    Writing non-integer powers of 10 is a very common occurrence in my field of teaching, so knowing that this feature will not be coming back to siunitx is useful information. I'll just write my own macro. Is there any drawback to a one-line macro like \newcommand{\powerten}[1]{\ensuremath{10^{\num{#1}}}} ?
    – Miyase
    Mar 28, 2022 at 14:07
  • As for your first suggestion with parse-numbers = false, I just tried it and it doesn't produce the expected result. My siunitx is configured for French output (where the decimal separator is a comma), and with your suggestion the point is no longer replaced automatically with a comma. Hence the macro I suggested above.
    – Miyase
    Mar 28, 2022 at 14:12
  • 1
    @Miyase I was about to make a suggestion about a custom command: from your comment under the question, the 10 isn't really part of the value, it's part of the presentation of the value (a pKa is by definition a log10 value, so adding the 10 back in is not altering the value, rather how it's displayed).
    – Joseph Wright
    Mar 28, 2022 at 14:14
  • Yes, that'd be a correct way of looking at it. I'll go with a macro, then. Thanks.
    – Miyase
    Mar 28, 2022 at 14:53

You must log in to answer this question.

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