9

I am using siunitx to display values in my calculation.

\documentclass{report}
\usepackage[exponent-to-prefix]{siunitx}
\begin{document}
\begin{equation}
 \SI{2.5e-7}{\meter\cubed\per\second} 
\end{equation}
\end{document}

However, when I compile it, I end up with

enter image description here

As far as my understanding goes, that is incorrect, because it should be 0.25 cm³/s. Am I using siunitx wrong or is there some error in its unit conversion logic? The feature that causes the conversion is the exponent-to-prefix flag of siunitx.

This is the output of running Latex:

This is pdfTeX, Version 3.14159265-2.6-1.40.20 (TeX Live 2019/Arch Linux) (preloaded format=pdflatex)
 restricted \write18 enabled.
entering extended mode
(./thesis.tex
LaTeX2e <2019-10-01> patch level 1
(/usr/share/texmf-dist/tex/latex/base/report.cls
Document Class: report 2019/08/27 v1.4j Standard LaTeX document class
(/usr/share/texmf-dist/tex/latex/base/size10.clo))
(/usr/share/texmf-dist/tex/latex/siunitx/siunitx.sty
(/usr/share/texmf-dist/tex/latex/l3kernel/expl3.sty
(/usr/share/texmf-dist/tex/latex/l3kernel/expl3-code.tex
(/usr/share/texmf-dist/tex/latex/l3kernel/l3deprecation.def))
(/usr/share/texmf-dist/tex/latex/l3backend/l3backend-pdfmode.def))
(/usr/share/texmf-dist/tex/latex/l3packages/xparse/xparse.sty)
(/usr/share/texmf-dist/tex/latex/amsmath/amstext.sty
(/usr/share/texmf-dist/tex/latex/amsmath/amsgen.sty))
(/usr/share/texmf-dist/tex/latex/tools/array.sty)
(/usr/share/texmf-dist/tex/latex/l3packages/l3keys2e/l3keys2e.sty)
(/usr/share/texmf-dist/tex/latex/translator/translator.sty
(/usr/share/texmf-dist/tex/latex/graphics/keyval.sty))) (./thesis.aux)
(/usr/share/texmf-dist/tex/latex/base/ts1enc.dfu)
(/usr/share/texmf-dist/tex/latex/translator/translator-basic-dictionary-English
.dict) (/usr/share/texmf-dist/tex/latex/siunitx/siunitx-abbreviations.cfg)
[1{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}] (./thesis.aux) )</usr/sh
are/texmf-dist/fonts/type1/public/amsfonts/cm/cmmi10.pfb></usr/share/texmf-dist
/fonts/type1/public/amsfonts/cm/cmr10.pfb></usr/share/texmf-dist/fonts/type1/pu
blic/amsfonts/cm/cmr7.pfb></usr/share/texmf-dist/fonts/type1/public/amsfonts/cm
/cmsy7.pfb>
Output written on thesis.pdf (1 page, 33373 bytes).
Transcript written on thesis.log
5
  • 1
    I get 2.5 ⨉ 10^{-7} m^3/s. There is no conversion, so you should be clearer about what you're doing.
    – egreg
    Dec 20, 2019 at 17:10
  • 4
    And perhaps extend this to a full minimal example instead of a sniplet. That makes it easier for others to test.
    – daleif
    Dec 20, 2019 at 17:14
  • 3
    I don't think siunitx has a unit conversion feature. Perhaps you use some additional commands and packages, and those commands are buggy.
    – fractal
    Dec 20, 2019 at 17:20
  • 1
    Related: tex.stackexchange.com/q/273372/134144
    – leandriis
    Dec 20, 2019 at 19:20
  • 1
    It seems to always just round the exponent but then forget to correct the digits: \documentclass{report} \usepackage[exponent-to-prefix]{siunitx} \begin{document} 3:\SI{2.5e-3}{\meter\cubed\per\second}\par 4:\SI{2.5e-4}{\meter\cubed\per\second}\par 5:\SI{2.5e-5}{\meter\cubed\per\second}\par 6:\SI{2.5e-6}{\meter\cubed\per\second}\par 7:\SI{2.5e-7}{\meter\cubed\per\second}\par 8:\SI{2.5e-8}{\meter\cubed\per\second}\par 9:\SI{2.5e-9}{\meter\cubed\per\second}\par 10:\SI{2.5e-10}{\meter\cubed\per\second}\par \end{document}
    – user194703
    Dec 21, 2019 at 1:40

1 Answer 1

4

As you say, in version 2 this is buggy. Version 3 handles these situations better, but here you'll still need manual intervention. If you try your example with v3 you get


! Package siunitx Error: Exponent '-2.333333333333333' cannot be converted
(siunitx)                into a symbolic prefix.

For immediate help type H <return>.
 ...                                   

as conversion here does not try to shift numbers 'in range' - that's a separate concept.

1
  • Thank you, that will be a very useful improvement. For me the danger was primarily in not noticing these implicit changes in value, but being given an error at compile time prevents such changes to slip through in the first place.
    – ApolloLV
    May 11, 2021 at 15:43

You must log in to answer this question.

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