resultwizard / ResultWizard

Intelligent interface between Python-computed values and your LaTeX work.
https://resultwizard.github.io/ResultWizard
MIT License
7 stars 0 forks source link

Make better use of `siunitx` syntax #22

Closed Splines closed 7 months ago

Splines commented 8 months ago

In version v3.1.0 (2022-04-25), siunitx introduced "support for multiple uncertainty values in both short and long form in input". This means, we can do something like:

\begin{align}
    \num{123.4 \pm 1.25 \pm 3.15 \pm 1.0}
\end{align}

With uncertainties, it could look like:

\sisetup{separate-uncertainty=true, exponent-product=\cdot}
\NewDocumentCommand{\UncertSys}{}{_{\text{sys}}}
\NewDocumentCommand{\UncertStat}{}{_{\text{stat}}}
\sisetup{input-digits=0123456789\UncertStat\UncertSys}
\begin{align}
    \num{1.3 \pm 0.3\UncertSys \pm 0.02\UncertStat e10}\\
    \qty{1.3 \pm 0.2\UncertSys}{\N\per\g}
\end{align}

Unfortunately, the Ubuntu 22.04 LTS texlive-science package comes with an older version of siunitx. We therefore need the old way of doing this (manually construct the string, e.g. \num{...} \pm \num{...}) as well. A troubleshooting section is already written with more details.

Splines commented 8 months ago

image

working as of 124cddf (in the screenshot I use the exponent-product=\times sisetup option)