From 65cabf7a3fee66e5699ed072b7b5bdb10c26fb34 Mon Sep 17 00:00:00 2001 From: Simon Bruder Date: Sun, 11 Oct 2020 17:26:00 +0200 Subject: [PATCH] Remove siunitx --- latex/brom/siunitx-abbreviations.cfg | 122 - latex/brom/siunitx-binary.cfg | 45 - latex/brom/siunitx-version-1.cfg | 747 --- latex/brom/siunitx.ins | 73 - latex/brom/siunitx.sty | 7744 -------------------------- 5 files changed, 8731 deletions(-) delete mode 100644 latex/brom/siunitx-abbreviations.cfg delete mode 100644 latex/brom/siunitx-binary.cfg delete mode 100644 latex/brom/siunitx-version-1.cfg delete mode 100644 latex/brom/siunitx.ins delete mode 100644 latex/brom/siunitx.sty diff --git a/latex/brom/siunitx-abbreviations.cfg b/latex/brom/siunitx-abbreviations.cfg deleted file mode 100644 index 32d3093..0000000 --- a/latex/brom/siunitx-abbreviations.cfg +++ /dev/null @@ -1,122 +0,0 @@ -%% -%% This is file `siunitx-abbreviations.cfg', -%% generated with the docstrip utility. -%% -%% The original source files were: -%% -%% siunitx.dtx (with options: `config,abbreviations') -%% --------------------------------------------------------------- -%% The siunitx package --- A comprehensive (SI) units package -%% Maintained by Joseph Wright -%% E-mail: joseph.wright@morningstar2.co.uk -%% Released under the LaTeX Project Public License v1.3c or later -%% See http://www.latex-project.org/lppl.txt -%% --------------------------------------------------------------- -%% -\ProvidesExplFile {siunitx-abbreviations.cfg} {2017/11/26} {2.7k} - {siunitx: Abbreviated units} -\DeclareSIUnit \A { \ampere } -\DeclareSIUnit \pA { \pico \ampere } -\DeclareSIUnit \nA { \nano \ampere } -\DeclareSIUnit \uA { \micro \ampere } -\DeclareSIUnit \mA { \milli \ampere } -\DeclareSIUnit \kA { \kilo \ampere } -\DeclareSIUnit \Hz { \hertz } -\DeclareSIUnit \mHz { \milli \hertz } -\DeclareSIUnit \kHz { \kilo \hertz } -\DeclareSIUnit \MHz { \mega \hertz } -\DeclareSIUnit \GHz { \giga \hertz } -\DeclareSIUnit \THz { \tera \hertz } -\DeclareSIUnit \mol { \mole } -\DeclareSIUnit \fmol { \femto \mole } -\DeclareSIUnit \pmol { \pico \mole } -\DeclareSIUnit \nmol { \nano \mole } -\DeclareSIUnit \umol { \micro \mole } -\DeclareSIUnit \mmol { \milli \mole } -\DeclareSIUnit \kmol { \kilo \mole } -\DeclareSIUnit \V { \volt } -\DeclareSIUnit \pV { \pico \volt } -\DeclareSIUnit \nV { \nano \volt } -\DeclareSIUnit \uV { \micro \volt } -\DeclareSIUnit \mV { \milli \volt } -\DeclareSIUnit \kV { \kilo \volt } -\DeclareSIUnit \hl { \hecto \litre } -\DeclareSIUnit \l { \litre } -\DeclareSIUnit \ml { \milli \litre } -\DeclareSIUnit \ul { \micro \litre } -\DeclareSIUnit \hL { \hecto \liter } -\DeclareSIUnit \L { \liter } -\DeclareSIUnit \mL { \milli \liter } -\DeclareSIUnit \uL { \micro \liter } -\DeclareSIUnit \fg { \femto \gram } -\DeclareSIUnit \pg { \pico \gram } -\DeclareSIUnit \ng { \nano \gram } -\DeclareSIUnit \ug { \micro \gram } -\DeclareSIUnit \mg { \milli \gram } -\DeclareSIUnit \g { \gram } -\DeclareSIUnit \kg { \kilo \gram } -\DeclareSIUnit \amu { \atomicmassunit } -\DeclareSIUnit \W { \watt } -\DeclareSIUnit \uW { \micro \watt } -\DeclareSIUnit \mW { \milli \watt } -\DeclareSIUnit \kW { \kilo \watt } -\DeclareSIUnit \MW { \mega \watt } -\DeclareSIUnit \GW { \giga \watt } -\DeclareSIUnit \J { \joule } -\DeclareSIUnit \kJ { \kilo \joule } -\DeclareSIUnit \eV { \electronvolt } -\DeclareSIUnit \meV { \milli \electronvolt } -\DeclareSIUnit \keV { \kilo \electronvolt } -\DeclareSIUnit \MeV { \mega \electronvolt } -\DeclareSIUnit \GeV { \giga \electronvolt } -\DeclareSIUnit \TeV { \tera \electronvolt } -\DeclareSIUnit [ inter-unit-product = ] \kWh { \kilo \watt \hour } -\DeclareSIUnit \m { \metre } -\DeclareSIUnit \pm { \pico \metre } -\DeclareSIUnit \nm { \nano \metre } -\DeclareSIUnit \um { \micro \metre } -\DeclareSIUnit \mm { \milli \metre } -\DeclareSIUnit \cm { \centi \metre } -\DeclareSIUnit \dm { \deci \metre } -\DeclareSIUnit \km { \kilo \metre } -\DeclareSIUnit \K { \kelvin } -\DeclareSIUnit \dB { \deci \bel } -\DeclareSIUnit \F { \farad } -\DeclareSIUnit \fF { \femto \farad } -\DeclareSIUnit \pF { \pico \farad } -\DeclareSIUnit \N { \newton } -\DeclareSIUnit \mN { \milli \newton } -\DeclareSIUnit \kN { \kilo \newton } -\DeclareSIUnit \MN { \mega \newton } -\DeclareSIUnit \Pa { \pascal } -\DeclareSIUnit \kPa { \kilo \pascal } -\DeclareSIUnit \MPa { \mega \pascal } -\DeclareSIUnit \GPa { \giga \pascal } -\DeclareSIUnit \mohm { \milli \ohm } -\DeclareSIUnit \kohm { \kilo \ohm } -\DeclareSIUnit \Mohm { \mega \ohm } -\DeclareSIUnit \s { \second } -\DeclareSIUnit \as { \atto \second } -\DeclareSIUnit \fs { \femto \second } -\DeclareSIUnit \ps { \pico \second } -\DeclareSIUnit \ns { \nano \second } -\DeclareSIUnit \us { \micro \second } -\DeclareSIUnit \ms { \milli \second } -%% Copyright (C) 2008-2017 by -%% Joseph Wright -%% -%% It may be distributed and/or modified under the conditions of -%% the LaTeX Project Public License (LPPL), either version 1.3c of -%% this license or (at your option) any later version. The latest -%% version of this license is in the file: -%% http://www.latex-project.org/lppl.txt -%% -%% This work is "maintained" (as per LPPL maintenance status) by -%% Joseph Wright. -%% -%% This work consists of the file siunitx.dtx -%% and the derived files siunitx.pdf, -%% siunitx.sty and -%% siunitx.ins. -%% -%% End of file `siunitx-abbreviations.cfg'. diff --git a/latex/brom/siunitx-binary.cfg b/latex/brom/siunitx-binary.cfg deleted file mode 100644 index ae0ef1a..0000000 --- a/latex/brom/siunitx-binary.cfg +++ /dev/null @@ -1,45 +0,0 @@ -%% -%% This is file `siunitx-binary.cfg', -%% generated with the docstrip utility. -%% -%% The original source files were: -%% -%% siunitx.dtx (with options: `config,binary') -%% --------------------------------------------------------------- -%% The siunitx package --- A comprehensive (SI) units package -%% Maintained by Joseph Wright -%% E-mail: joseph.wright@morningstar2.co.uk -%% Released under the LaTeX Project Public License v1.3c or later -%% See http://www.latex-project.org/lppl.txt -%% --------------------------------------------------------------- -%% -\ProvidesExplFile {siunitx-binary.cfg} {2017/11/26} {2.7k} - {siunitx: Binary units} -\DeclareBinaryPrefix \kibi { Ki } { 10 } -\DeclareBinaryPrefix \mebi { Mi } { 20 } -\DeclareBinaryPrefix \gibi { Gi } { 30 } -\DeclareBinaryPrefix \tebi { Ti } { 40 } -\DeclareBinaryPrefix \pebi { Pi } { 50 } -\DeclareBinaryPrefix \exbi { Ei } { 60 } -\DeclareBinaryPrefix \zebi { Zi } { 70 } -\DeclareBinaryPrefix \yobi { Yi } { 80 } -\DeclareSIUnit \bit { bit } -\DeclareSIUnit \byte { B } -%% Copyright (C) 2008-2017 by -%% Joseph Wright -%% -%% It may be distributed and/or modified under the conditions of -%% the LaTeX Project Public License (LPPL), either version 1.3c of -%% this license or (at your option) any later version. The latest -%% version of this license is in the file: -%% http://www.latex-project.org/lppl.txt -%% -%% This work is "maintained" (as per LPPL maintenance status) by -%% Joseph Wright. -%% -%% This work consists of the file siunitx.dtx -%% and the derived files siunitx.pdf, -%% siunitx.sty and -%% siunitx.ins. -%% -%% End of file `siunitx-binary.cfg'. diff --git a/latex/brom/siunitx-version-1.cfg b/latex/brom/siunitx-version-1.cfg deleted file mode 100644 index e372354..0000000 --- a/latex/brom/siunitx-version-1.cfg +++ /dev/null @@ -1,747 +0,0 @@ -%% -%% This is file `siunitx-version-1.cfg', -%% generated with the docstrip utility. -%% -%% The original source files were: -%% -%% siunitx.dtx (with options: `config,version-1') -%% --------------------------------------------------------------- -%% The siunitx package --- A comprehensive (SI) units package -%% Maintained by Joseph Wright -%% E-mail: joseph.wright@morningstar2.co.uk -%% Released under the LaTeX Project Public License v1.3c or later -%% See http://www.latex-project.org/lppl.txt -%% --------------------------------------------------------------- -%% -\ProvidesExplFile {siunitx-version-1.cfg} {2017/11/26} {2.7k} - {siunitx: Version 1 settings} -\keys_define:nn { siunitx } { - addsign .choice: , - addsign / - all .meta:n = { explicit-sign = + }, - addsign / - exp .meta:n = { explicit-sign = + }, - addsign / - false .meta:n = { explicit-sign = }, - addsign / - mant .meta:n = { explicit-sign = + }, - addsign / - none .meta:n = { explicit-sign = }, - addsign / - true .meta:n = { explicit-sign = + }, - addsign .default:n = { true }, - allowlitunits .meta:n = { free-standing-units = #1 }, - allowlitunits .default:n = { true }, - allowoptarg .meta:n = { unit-optional-argument = #1 }, - allowoptargs .default:n = { true }, - allowzeroexp .meta:n = { retain-zero-exponent = #1 }, - allowzeroexp .default:n = { true }, - alsoload .code:n = , - angformat .code:n = , - anglesep .choice: , - anglesep / - cdot .meta:n = - { arc-separator = \ensuremath { { } \cdot { } } }, - anglesep / - comma .meta:n = { arc-separator = \ensuremath { { {,} } } }, - anglesep / - fullstop .meta:n = { arc-separator = \ensuremath { { { . } } } }, - anglesep / - med .meta:n = { arc-separator = \ensuremath { \: } }, - anglesep / - medium .meta:n = { arc-separator = \ensuremath { \: } }, - anglesep / - none .meta:n = { arc-separator = }, - anglesep / - period .meta:n = { arc-separator = \ensuremath { { { . } } } }, - anglesep / - space .meta:n = { arc-separator = \text { ~ } }, - anglesep / - stop .meta:n = { arc-separator = \ensuremath { { { . } } } }, - anglesep / - thick .meta:n = { arc-separator = \ensuremath { \; } }, - anglesep / - thin .meta:n = { arc-separator = \ensuremath { \, } }, - anglesep / - tightcdot .meta:n = - { arc-separator = \ensuremath { \bgroup \cdot \egroup } }, - anglesep / - tighttimes .meta:n = - { arc-separator = \ensuremath { \bgroup \times \egroup } }, - anglesep / - times .meta:n = { arc-separator = \ensuremath { \times } }, - anglesep / - unknown .meta:n = { arc-separator = \ensuremath {#1} }, - astroang .meta:n = - { angle-symbol-over-decimal = #1 }, - astroang .default:n = { true }, - closeerr .meta:n = { close-bracket = \ensuremath {#1} }, - closefrac .meta:n = { close-bracket = \ensuremath {#1} }, - closerange .meta:n = { close-bracket = \ensuremath {#1} }, - colour .code:n = { color = #1 }, - colorall .code:n = , - colourall .code:n = , - colorneg .code:n = , - colourneg .code:n = , - colorunits .meta:n = , - colourunits .meta:n = , - colorvalues .meta:n = , - colourvalues .meta:n = , - decimalsymbol .choice: , - decimalsymbol / - cdot .meta:n = - { output-decimal-marker = \ensuremath { { } \cdot { } } }, - decimalsymbol / - comma .meta:n = { output-decimal-marker = { \ensuremath { { , } } } }, - decimalsymbol / - fullstop .meta:n = { output-decimal-marker = { \ensuremath { { . } } } }, - decimalsymbol / - period .meta:n = { output-decimal-marker = { \ensuremath { { . } } } }, - decimalsymbol / - stop .meta:n = { output-decimal-marker = { \ensuremath { { . } } } }, - decimalsymbol / - tightcdot .code:n = - { output-decimal-marker = \ensuremath { \bgroup \cdot \egroup } }, - decimalsymbol / - unknown .meta:n = { output-decimal-marker = \ensuremath {#1} }, - debug .code:n = , - detectdisplay .meta:n = { detect-display-math = #1 }, - detectdisplay .default:n = { true }, - digitsep .choice: , - digitsep / - cdot .meta:n = - { group-separator = \ensuremath { { } \cdot { } } }, - digitsep / - comma .meta:n = { group-separator = \ensuremath { { , } } }, - digitsep / - fullstop .meta:n = { group-separator = \ensuremath { . } }, - digitsep / - med .meta:n = { group-separator = \ensuremath { \: } }, - digitsep / - medium .meta:n = { group-separator = \ensuremath { \: } }, - digitsep / - none .meta:n = { group-separator = }, - digitsep / - period .meta:n = { group-separator = \ensuremath { . } }, - digitsep / - space .meta:n = { group-separator = \text { ~ } }, - digitsep / - stop .meta:n = { group-separator = \ensuremath { . } }, - digitsep / - thick .meta:n = { group-separator = \ensuremath { \; } }, - digitsep / - thin .meta:n = { group-separator = \ensuremath { \, } }, - digitsep / - tightcdot .meta:n = - { group-separator = \ensuremath { \bgroup \cdot \egroup } }, - digitsep / - tighttimes .meta:n = - { group-separator = \ensuremath { \bgroup \times \egroup } }, - digitsep / - times .meta:n = { group-separator = \ensuremath { \times } }, - digitsep / - unknown .meta:n = { group-separator = \ensuremath {#1} }, - dp .meta:n = - { - round-mode = places, - round-precision = #1, - }, - emulate .code:n = , - errspace .choice: , - errspace / - med .meta:n = { uncertainty-separator = \ensuremath { \: } }, - errspace / - medium .meta:n = { uncertainty-separator = \ensuremath { \: } }, - errspace / - none .meta:n = { uncertainty-separator = }, - errspace / - space .meta:n = { uncertainty-separator = \text { ~ } }, - errspace / - thick .meta:n = { uncertainty-separator = \ensuremath { \; } }, - errspace / - thin .meta:n = { uncertainty-separator = \ensuremath { \, } }, - errspace / - unknown .meta:n = { uncertainty-separator = \ensuremath {#1} }, - eVcorra .code:n = , - eVcorrb .code:n = , - expbase .choice: , - expbase / - ten .meta:n = { exponent-base = 10 }, - expbase / - two .meta:n = { exponent-base = 2 }, - expbase / - unknown .meta:n = { exponent-base = #1 }, - expproduct .choice: , - expproduct / - cdot .meta:n = - { exponent-product = \ensuremath { { } \cdot { } } }, - expproduct / - tightcdot .meta:n = - { exponent-product = \ensuremath { \bgroup \cdot \egroup } }, - expproduct / - tighttimes .meta:n = - { exponent-product = \ensuremath { \bgroup \times \egroup } }, - expproduct / - times .meta:n = { exponent-product = \ensuremath { \times } }, - expproduct / - unknown .meta:n = { exponent-product = \ensuremath {#1} }, - fixdp .choice:, - fixdp / - false .meta:n = { round-mode = none }, - fixdp / - true .meta:n = { round-mode = places }, - fixdp .default:n = { true }, - fixsf .choice: , - fixsf / - false .meta:n = { round-mode = none }, - fixsf / - true .meta:n = { round-mode = figures }, - fixsf .default:n = { true }, - fraction .choice: , - fraction / - frac .meta:n = { fraction-function = \frac }, - fraction / - nice .meta:n = { fraction-function = \frac }, - fraction / - sfrac .meta:n = { fraction-function = \sfrac }, - fraction / - ugly .meta:n = - { - fraction-function = \frac , - per-mode = symbol-or-fraction - }, - inlinebold .meta:n = { detect-inline-weight = #1 }, - log .code:n = , - load .code:n = , - loctolang .code:n = , - mathOmega .meta:n = { math-ohm = #1 }, - mathcelsius .meta:n = { math-celsius = #1 }, - mathdegree .meta:n = { math-degree = #1 }, - mathminute .meta:n = { math-arcminute = #1 }, - mathmu .meta:n = { math-micro = #1 }, - mathringA .meta:n = { math-angstrom = #1 }, - mathrm .code:n = - { \use:x { \keys_set:nn { siunitx } { math-rm = \exp_not:c {#1} } } }, - mathsOmega .meta:n = { math-ohm = #1 }, - mathscelsius .meta:n = { math-celsius = #1 }, - mathsdegree .meta:n = { math-degree = #1 }, - mathsecond .meta:n = { math-arcsecond = #1 }, - mathsf .code:n = - { \use:x { \keys_set:nn { siunitx } { math-sf = \exp_not:c {#1} } } }, - mathsminute .meta:n = { math-arcminute = #1 }, - mathsmu .meta:n = { math-micro = #1 }, - mathsringA .meta:n = { math-angstrom = #1 }, - mathsrm .code:n = - { \use:x { \keys_set:nn { siunitx } { math-rm= \exp_not:c {#1} } } }, - mathssecond .meta:n = { math-arcsecond = #1 }, - mathssf .code:n = - { \use:x { \keys_set:nn { siunitx } { math-sf = \exp_not:c {#1} } } }, - mathstt .code:n = - { \use:x { \keys_set:nn { siunitx } { math-tt = \exp_not:c {#1} } } }, - mathtt .code:n = - { \use:x { \keys_set:nn { siunitx } { math-tt = \exp_not:c {#1} } } }, - negcolor .meta:n = { negative-color = #1 }, - negcolour .meta:n = { negative-color = #1 }, - noload .code:n = , - numaddn .meta:n = { input-symbols = #1 }, - numcloseerr .meta:n = { input-close-uncertainty = #1 }, - numdecimal .meta:n = { input-decimal-markers = #1 }, - numdigits .meta:n = { input-digits = #1 }, - numdiv .meta:n = { input-quotient = #1 }, - numexp .meta:n = { input-exponent-markers = #1 }, - numgobble .meta:n = { input-ignore = #1 }, - numopenerr .meta:n = { input-open-uncertainty = #1 }, - numprod .meta:n = { input-product = #1 }, - numsign .meta:n = { input-signs = #1 }, - obeyall .meta:n = { detect-all = #1 }, - obeyall .default:n = { true }, - obeybold .meta:n = { detect-weight = #1 }, - obeybold .default:n = { true }, - obeyfamily .meta:n = { detect-family = #1 }, - obeyfamily .default:n = { true }, - obeyitalic .meta:n = { detect-shape = #1 }, - obeyitalic .default:n = { true }, - obeymode .meta:n = { detect-mode = #1 }, - obeymode .default:n = { true }, - openerr .meta:n = { open-bracket = \ensuremath {#1} }, - openfrac .meta:n = { open-bracket = \ensuremath {#1} }, - openrange .meta:n = { open-bracket = \ensuremath {#1} }, - padangle .choice: , - padangle / - all .meta:n = - { - add-arc-degree-zero = true, - add-arc-minute-zero = true, - add-arc-second-zero = true - }, - padangle / - both .meta:n = - { - add-arc-degree-zero = true, - add-arc-minute-zero = true, - add-arc-second-zero = true - }, - padangle / - false .meta:n = - { - add-arc-degree-zero = false, - add-arc-minute-zero = false, - add-arc-second-zero = false - }, - padangle / - large .meta:n = - { - add-arc-degree-zero = true, - add-arc-minute-zero = true, - add-arc-second-zero = false - }, - padangle / - none .meta:n = - { - add-arc-degree-zero = false, - add-arc-minute-zero = false, - add-arc-second-zero = false - }, - padangle / - small .meta:n = - { - add-arc-degree-zero = false, - add-arc-minute-zero = true, - add-arc-second-zero = true - }, - true .meta:n = - { - add-arc-degree-zero = true, - add-arc-minute-zero = true, - add-arc-second-zero = true - }, - padnumber .choice: , - padnumber / - all .meta:n = - { - add-decimal-zero = true, - add-integer-zero = true - }, - padnumber / - both .meta:n = - { - add-decimal-zero = true, - add-integer-zero = true - }, - padnumber / - false .meta:n = - { - add-decimal-zero = false, - add-integer-zero = false - }, - padnumber / - leading .meta:n = - { - add-decimal-zero = true, - add-integer-zero = false - }, - padnumber / - none .meta:n = - { - add-decimal-zero = false, - add-integer-zero = false - }, - padnumber / - trailing .meta:n = - { - add-decimal-zero = false, - add-integer-zero = true - }, - padnumber / - true .meta:n = - { - add-decimal-zero = true, - add-integer-zero = true - }, - per .choice: , - per / - frac .meta:n = { per-mode = fraction }, - per / - fraction .meta:n = { per-mode = fraction }, - per / - reciprocal .meta:n = { per-mode = reciprocal }, - per / - slash .meta:n = { per-mode = symbol }, - prefixbase .code:n = , - prefixproduct .code:n = , - prefixsymbolic .meta:n = { prefixes-as-symbols = #1 }, - prefixsymbolic .default:n = { true }, - prespace .meta:n = { space-before-unit = #1 }, - prespace .default:n = { true }, - redefsymbols .meta:n = { redefine-symbols = #1 }, - redefsymbols .default:n = { true }, - repeatunits .choice: , - repeatunits / - false .meta:n = - { - multi-part-units = single, - product-units = single, - }, - repeatunits / - power .meta:n = - { - multi-part-units = repeat, - product-units = power, - }, - repeatunits / - true .meta:n = - { - multi-part-units = repeat, - product-units = repeat, - }, - repeatunits .default:n = { true }, - retainplus .meta:n = { retain-explicit-plus = #1 }, - retainplus .default:n = { true }, - seperr .meta:n = { separate-uncertainty = #1 }, - seperr .default:n = { true }, - sepfour .meta:n = { group-four-digits = true }, - sepfour .default:n = { true }, - sf .meta:n = - { - round-mode = figures, - round-precision = #1, - }, - sign .meta:n = { explicit-sign = #1 }, - slash .choice: , - slash / - slash .meta:n = { per-symbol = \ensuremath { / } }, - slash / - unknown .meta:n = { per-symbol = \ensuremath {#1} }, - stickyper .meta:n = { sticky-per = #1 }, - stickyper .default:n = { true }, - strictarc .code:n = , - tabalign .code:n = - { - \str_if_eq:nnTF {#1} { centre } - { \keys_set:nn { siunitx } { table-alignment = center } } - { \keys_set:nn { siunitx } { table-alignment = #1 } } - }, - tabalignexp .code:n = { table-align-exponent = #1 }, - tabautofit .meta:n = { table-auto-round = #1 }, - tabautofit .default:n = { true }, - tabexpalign .code:n = { table-align-exponent = #1 }, - tabformat .meta:n = { table-format = #1 }, - tabnumalign .code:n = - { - \str_if_eq:nnTF {#1} { centre } - { \keys_set:nn { siunitx } { table-number-alignment = center } } - { - \str_if_eq:nnTF {#1} { centredecimal } - { - \keys_set:nn { siunitx } - { table-number-alignment = center-decimal-marker } - } - { - \str_if_eq:nnTF {#1} { centerdecimal } - { - \keys_set:nn { siunitx } - { table-number-alignment = center-decimal-marker } - } - { - \keys_set:nn { siunitx } - { table-number-alignment = #1 } - } - } - } - }, - tabparseonly .meta:n = { table-parse-only = #1 }, - tabparseonly .default:n = { true }, - tabtextalign .code:n = - { - \str_if_eq:nnTF {#1} { centre } - { \keys_set:nn { siunitx } { table-text-alignment = center } } - { \keys_set:nn { siunitx } { table-text-alignment = #1 } } - }, - tabunitalign .code:n = - { - \str_if_eq:nnTF {#1} { centre } - { \keys_set:nn { siunitx } { table-unit-alignment = center } } - { \keys_set:nn { siunitx } { table-unit-alignment = #1 } } - }, - textOmega .meta:n = { text-ohm = #1 }, - textcelsius .meta:n = { text-celsius = #1 }, - textdegree .meta:n = { text-degree = #1 }, - textminute .meta:n = { text-arcminute = #1 }, - textmode .choice: , - textmode / - true .meta:n = { mode = text }, - textmode / - false .meta:n = { mode = math }, - textmode .default:n = { true }, - textmu .meta:n = { text-micro = #1 }, - textringA .meta:n = { text-angstrom = #1 }, - textrm .code:n = - { \use:x { \keys_set:nn { siunitx } { text-rm = \exp_not:c {#1} } } }, - textsecond .meta:n = { text-arcsecond = #1 }, - textsf .code:n = - { \use:x { \keys_set:nn { siunitx } { text-sf = \exp_not:c {#1} } } }, - texttt .code:n = - { \use:x { \keys_set:nn { siunitx } { text-tt = \exp_not:c {#1} } } }, - tightpm .meta:n = { tight-spacing = #1 }, - tightpm .default:n = { true }, - tophrase .meta:n = { range-phrase = #1 }, - trapambigerr .choice: , - trapambigerr - / false .meta:n = { multi-part-units = single }, - trapambigerr - / true .meta:n = { multi-part-units = brackets }, - trapambigerr .default:n = { true }, - trapambigfrac .meta:n = { bracket-numbers = #1 }, - trapambigfrac .default:n = { true }, - trapambigrange .choice: , - trapambigrange - / false .meta:n = { range-units = single }, - trapambigrange - / true .meta:n = { range-units = brackets }, - trapambigrange .default:n = { true }, - unitcolor .meta:n = { unit-color = #1 }, - unitcolour .meta:n = { unit-color = #1 }, - unitmathrm .code:n = - { \use:x { \keys_set:nn { siunitx } { unit-math-rm = \exp_not:c {#1} } } }, - unitmathsf .code:n = - { \use:x { \keys_set:nn { siunitx } { unit-math-sf = \exp_not:c {#1} } } }, - unitmathsrm .code:n = - { \use:x { \keys_set:nn { siunitx } { unit-math-rm = \exp_not:c {#1} } } }, - unitmathssf .code:n = - { \use:x { \keys_set:nn { siunitx } { unit-math-sf = \exp_not:c {#1} } } }, - unitmathstt .code:n = - { \use:x { \keys_set:nn { siunitx } { unit-math-tt = \exp_not:c {#1} } } }, - unitmathtt .code:n = - { \use:x { \keys_set:nn { siunitx } { unit-math-tt = \exp_not:c {#1} } } }, - unitmode .meta:n = { unit-mode = #1 }, - unitsep .choice: , - unitsep / - cdot .meta:n = - { inter-unit-product = \ensuremath { { } \cdot { } } }, - unitsep / - comma .meta:n = { inter-unit-product = { {,} } }, - unitsep / - fullstop .meta:n = { inter-unit-product = { { . } } }, - unitsep / - med .meta:n = { inter-unit-product = \ensuremath { \: } }, - unitsep / - medium .meta:n = { inter-unit-product = \ensuremath { \: } }, - unitsep / - none .meta:n = { inter-unit-product = }, - unitsep / - period .meta:n = { inter-unit-product = { { . } } }, - unitsep / - space .meta:n = { inter-unit-product = \text { ~ } }, - unitsep / - stop .meta:n = { inter-unit-product = { { . } } }, - unitsep / - thick .meta:n = { inter-unit-product = \ensuremath { \; } }, - unitsep / - thin .meta:n = { inter-unit-product = \, }, - unitsep / - tightcdot .meta:n = - { inter-unit-product = \ensuremath { \bgroup \cdot \egroup } }, - unitsep / - tighttimes .meta:n = - { inter-unit-product = \ensuremath { \bgroup \times \egroup } }, - unitsep / - times .meta:n = { inter-unit-product = \ensuremath { \times } }, - unitsep / - unknown .meta:n = { inter-unit-product = \ensuremath {#1} }, - unitspace .choice: , - unitspace / - med .meta:n = { inter-unit-product = \ensuremath { \: } }, - unitspace / - medium .meta:n = { inter-unit-product = \ensuremath { \: } }, - unitspace / - none .meta:n = { inter-unit-product = }, - unitspace / - space .meta:n = { inter-unit-product = \text { ~ } }, - unitspace / - thick .meta:n = { inter-unit-product = \ensuremath { \; } }, - unitspace / - thin .meta:n = { inter-unit-product = \, }, - unitspace / - unknown .meta:n = { inter-unit-product = \ensuremath {#1} }, - valuecolor .meta:n = { number-color = #1 }, - valuecolour .meta:n = { number-color = #1 }, - valuemathrm .code:n = - { \use:x { \keys_set:nn { siunitx } { number-math-rm = \exp_not:c {#1} } } }, - valuemathsf .code:n = - { \use:x { \keys_set:nn { siunitx } { number-math-sf = \exp_not:c {#1} } } }, - valuemathsrm .code:n = - { \use:x { \keys_set:nn { siunitx } { number-math-rm = \exp_not:c {#1} } } }, - valuemathssf .code:n = - { \use:x { \keys_set:nn { siunitx } { number-math-sf = \exp_not:c {#1} } } }, - valuemathstt .code:n = - { \use:x { \keys_set:nn { siunitx } { number-math-tt = \exp_not:c {#1} } } }, - valuemathtt .code:n = - { \use:x { \keys_set:nn { siunitx } { number-math-tt = \exp_not:c {#1} } } }, - valuemode .meta:n = { number-mode = #1 }, - valuesep .choice: , - valuesep / - cdot .meta:n = - { number-unit-product = \ensuremath { { } \cdot { } } }, - valuesep / - comma .meta:n = { number-unit-product = { {,} } }, - valuesep / - fullstop .meta:n = { number-unit-product = { { . } } }, - valuesep / - med .meta:n = { number-unit-product = \ensuremath { \: } }, - valuesep / - medium .meta:n = { number-unit-product = \ensuremath { \: } }, - valuesep / - none .meta:n = { number-unit-product = }, - valuesep / - period .meta:n = { number-unit-product = { { . } } }, - valuesep / - space .meta:n = { number-unit-product = \text { ~ } }, - valuesep / - stop .meta:n = { number-unit-product = { { . } } }, - valuesep / - thick .meta:n = { number-unit-product = \ensuremath { \; } }, - valuesep / - thin .meta:n = { number-unit-product = \, }, - valuesep / - tightcdot .meta:n = - { number-unit-product = \ensuremath { \bgroup \cdot \egroup } }, - valuesep / - tighttimes .meta:n = - { number-unit-product = \ensuremath { \bgroup \times \egroup } }, - valuesep / - times .meta:n = { number-unit-product = \ensuremath { \times } }, - valuesep / - unknown .meta:n = { number-unit-product = \ensuremath {#1} }, - xspace .meta:n = { use-xspace = #1 }, - xspace .default:n = { true }, -} -\keys_define:nn { siunitx } { - unknown .code:n = - { - \msg_error:nnx { siunitx } { unknown-option } - { \exp_not:V \l_keys_key_tl } - } -} -\keys_set:nn { siunitx } {free-standing-units = true} -\cs_new_eq:NN \newunit \DeclareSIUnit -\cs_new_eq:NN \renewunit \DeclareSIUnit -\cs_new_eq:NN \provideunit \DeclareSIUnit -\NewDocumentCommand \newpower { o m m } { - \IfNoValueTF {#1} - { \DeclareSIPrePower #2 {#3} } - { \DeclareSIPostPower #2 {#3} } -} -\NewDocumentCommand \renewpower { o m m } { - \IfNoValueTF {#1} - { \DeclareSIPrePower #2 {#3} } - { \DeclareSIPostPower #2 {#3} } -} -\NewDocumentCommand \providepower { o m m } { - \IfNoValueTF {#1} - { \DeclareSIPrePower #2 {#3} } - { \DeclareSIPostPower #2 {#3} } -} -\NewDocumentCommand \newprefix { o m m m } { - \IfNoValueTF {#1} - { \DeclareSIPrefix #2 {#3} {#4} } - { \DeclareBinaryPrefix #2 {#3} {#4} } -} -\NewDocumentCommand \renewprefix { o m m m } { - \IfNoValueTF {#1} - { \DeclareSIPrefix #2 {#3} {#4} } - { \DeclareBinaryPrefix #2 {#3} {#4} } -} -\NewDocumentCommand \provideprefix { o m m m } { - \IfNoValueTF {#1} - { \DeclareSIPrefix #2 {#3} {#4} } - { \DeclareBinaryPrefix #2 {#3} {#4} } -} -\NewDocumentCommand \newqualifier { m m } { - \__siunitx_declare_qualifier:Nn #1 {#2} -} -\cs_new_eq:NN \renewqualifier \newqualifier -\cs_new_eq:NN \providequalifier \newqualifier -\DeclareSIPrePower \Square { 2 } -\DeclareSIPrePower \ssquare { 2 } -\DeclareSIUnit \BAR { \bar } -\DeclareSIUnit \bbar { \bar } -\DeclareSIUnit \Day { \day } -\DeclareSIUnit \dday { \day } -\DeclareSIUnit \Gray { \gray } -\DeclareSIUnit \ggray { \gray } -\DeclareSIUnit \atomicmass { \atomicmassunit } -\DeclareSIUnit \arcmin { \arcminute } -\DeclareSIUnit \arcsec { \arcsecond } -\DeclareSIUnit \are { a } -\DeclareSIUnit \curie { Ci } -\DeclareSIUnit \gal { Gal } -\DeclareSIUnit \millibar { \milli \bar } -\DeclareSIUnit \rad { rad } -\DeclareSIUnit \rem { rem } -\DeclareSIUnit \roentgen { R } -\DeclareSIUnit \micA { \micro \ampere } -\DeclareSIUnit \micmol { \micro \mole } -\DeclareSIUnit \micl { \micro \litre } -\DeclareSIUnit \micL { \micro \liter } -\DeclareSIUnit \nanog { \nano \gram } -\DeclareSIUnit \micg { \micro \gram } -\DeclareSIUnit \picm { \pico \metre } -\DeclareSIUnit \micm { \micro \metre } -\DeclareSIUnit \Sec { \second } -\DeclareSIUnit \mics { \micro \second } -\DeclareSIUnit \cmc { \centi \metre \cubed } -\DeclareSIUnit \dmc { \deci \metre \cubed } -\DeclareSIUnit \cms { \centi \metre \squared } -\DeclareSIUnit \centimetrecubed { \centi \metre \cubed } -\DeclareSIUnit \centimetresquared { \centi \metre \squared } -\DeclareSIUnit \cubiccentimetre { \centi \metre \cubed } -\DeclareSIUnit \cubicdecimetre { \deci \metre \cubed } -\DeclareSIUnit \squarecentimetre { \centi \metre \squared } -\DeclareSIUnit \squaremetre { \metre \squared } -\DeclareSIUnit \squarekilometre { \kilo \metre \squared } -\DeclareSIUnit \parsec { pc } -\DeclareSIUnit \lightyear { ly } -\DeclareSIUnit \gmol { g \text { - } mol } -\DeclareSIUnit \kgmol { kg \text { - } mol } -\DeclareSIUnit \lbmol { lb \text { - } mol } -\DeclareSIUnit \molar { \mole \per \cubic \deci \metre } -\DeclareSIUnit \Molar { \textsc { m } } -\DeclareSIUnit \torr { Torr } -\DeclareSIUnit \gon { gon } -\DeclareSIUnit \clight { \text { \ensuremath { c } } } -\DeclareSIUnit \micron { \micro \metre } -\DeclareSIUnit \mrad { \milli \rad } -\DeclareSIUnit \gauss { G } -\DeclareSIUnit \eVperc { \eV \per \clight } -\DeclareSIUnit \nanobarn { \nano \barn } -\DeclareSIUnit \picobarn { \pico \barn } -\DeclareSIUnit \femtobarn { \femto \barn } -\DeclareSIUnit \attobarn { \atto \barn } -\DeclareSIUnit \zeptobarn { \zepto \barn } -\DeclareSIUnit \yoctobarn { \yocto \barn } -\DeclareSIUnit \nb { \nano \barn } -\DeclareSIUnit \pb { \pico \barn } -\DeclareSIUnit \fb { \femto \barn } -\DeclareSIUnit \ab { \atto \barn } -\DeclareSIUnit \zb { \zepto \barn } -\DeclareSIUnit \yb { \yocto \barn } -\NewDocumentCommand \requiresiconfigs { m } - { \keys_set:nn { siunitx } { version-1-compatibility } } -%% Copyright (C) 2008-2017 by -%% Joseph Wright -%% -%% It may be distributed and/or modified under the conditions of -%% the LaTeX Project Public License (LPPL), either version 1.3c of -%% this license or (at your option) any later version. The latest -%% version of this license is in the file: -%% http://www.latex-project.org/lppl.txt -%% -%% This work is "maintained" (as per LPPL maintenance status) by -%% Joseph Wright. -%% -%% This work consists of the file siunitx.dtx -%% and the derived files siunitx.pdf, -%% siunitx.sty and -%% siunitx.ins. -%% -%% End of file `siunitx-version-1.cfg'. diff --git a/latex/brom/siunitx.ins b/latex/brom/siunitx.ins deleted file mode 100644 index fb20fce..0000000 --- a/latex/brom/siunitx.ins +++ /dev/null @@ -1,73 +0,0 @@ -%% -%% This is file `siunitx.ins', -%% generated with the docstrip utility. -%% -%% The original source files were: -%% -%% siunitx.dtx (with options: `install') -%% --------------------------------------------------------------- -%% The siunitx package --- A comprehensive (SI) units package -%% Maintained by Joseph Wright -%% E-mail: joseph.wright@morningstar2.co.uk -%% Released under the LaTeX Project Public License v1.3c or later -%% See http://www.latex-project.org/lppl.txt -%% --------------------------------------------------------------- -%% -\input l3docstrip.tex -\keepsilent -\askforoverwritefalse -\preamble ---------------------------------------------------------------- -The siunitx package --- A comprehensive (SI) units package -Maintained by Joseph Wright -E-mail: joseph.wright@morningstar2.co.uk -Released under the LaTeX Project Public License v1.3c or later -See http://www.latex-project.org/lppl.txt ---------------------------------------------------------------- - -\endpreamble -\postamble -Copyright (C) 2008-2017 by - Joseph Wright - -It may be distributed and/or modified under the conditions of -the LaTeX Project Public License (LPPL), either version 1.3c of -this license or (at your option) any later version. The latest -version of this license is in the file: - http://www.latex-project.org/lppl.txt - -This work is "maintained" (as per LPPL maintenance status) by - Joseph Wright. - -This work consists of the file siunitx.dtx - and the derived files siunitx.pdf, - siunitx.sty and - siunitx.ins. -\endpostamble -\usedir{tex/latex/siunitx} -\generate{ - \file{\jobname.sty}{\from{\jobname.dtx}{package}} - \file{siunitx-abbreviations.cfg} - {\from{\jobname.dtx}{config,abbreviations}} - \file{siunitx-binary.cfg}{\from{\jobname.dtx}{config,binary}} - \file{siunitx-version-1.cfg}{\from{\jobname.dtx}{config,version-1}} -} -\endbatchfile -%% Copyright (C) 2008-2017 by -%% Joseph Wright -%% -%% It may be distributed and/or modified under the conditions of -%% the LaTeX Project Public License (LPPL), either version 1.3c of -%% this license or (at your option) any later version. The latest -%% version of this license is in the file: -%% http://www.latex-project.org/lppl.txt -%% -%% This work is "maintained" (as per LPPL maintenance status) by -%% Joseph Wright. -%% -%% This work consists of the file siunitx.dtx -%% and the derived files siunitx.pdf, -%% siunitx.sty and -%% siunitx.ins. -%% -%% End of file `siunitx.ins'. diff --git a/latex/brom/siunitx.sty b/latex/brom/siunitx.sty deleted file mode 100644 index d089679..0000000 --- a/latex/brom/siunitx.sty +++ /dev/null @@ -1,7744 +0,0 @@ -%% -%% This is file `siunitx.sty', -%% generated with the docstrip utility. -%% -%% The original source files were: -%% -%% siunitx.dtx (with options: `package') -%% --------------------------------------------------------------- -%% The siunitx package --- A comprehensive (SI) units package -%% Maintained by Joseph Wright -%% E-mail: joseph.wright@morningstar2.co.uk -%% Released under the LaTeX Project Public License v1.3c or later -%% See http://www.latex-project.org/lppl.txt -%% --------------------------------------------------------------- -%% -\RequirePackage{expl3}[2015/09/11] -\RequirePackage{xparse} -\ProvidesExplPackage {siunitx} {2017/11/26} {2.7k} - {A comprehensive (SI) units package} -\@ifpackagelater { expl3 } { 2015/11/15 } - { } - { - \PackageError { siunitx } { Support~package~expl3~too~old } - { - You~need~to~update~your~installation~of~the~bundles~'l3kernel'~and~ - 'l3packages'.\MessageBreak - Loading~siunitx~will~abort! - } - \tex_endinput:D - } -\msg_new:nnnn { siunitx } { incompatible-package } - { Package~'#1'~incompatible. } - { The~#1~package~and~siunitx~are~incompatible. } -\cs_new_protected:Npn \__siunitx_load_check:n #1 { - \group_begin: - \@ifpackageloaded {#1} - { \msg_error:nnx { siunitx } { incompatible-package } {#1} } - { } - \group_end: -} -\clist_map_function:nN - { SIunits , sistyle , siunits , SIstyle , unitsdef , fancyunits } - \__siunitx_load_check:n -\AtBeginDocument { - \clist_map_function:nN { SIunits , sistyle , siunits , SIstyle } - \__siunitx_load_check:n -} -\RequirePackage{ amstext , array , l3keys2e } -\cs_new:Npn \__siunitx_tmp:w { } -\cs_generate_variant:Nn \clist_map_function:nN { nc } -\cs_generate_variant:Nn \tl_if_blank:nTF { V } -\cs_generate_variant:Nn \tl_replace_all:Nnn { No, NV , Nx } -\bool_new:N \l__siunitx_tmp_bool -\box_new:N \l__siunitx_tmp_box -\dim_new:N \l__siunitx_tmp_dim -\int_new:N \l__siunitx_tmp_int -\tl_new:N \l__siunitx_tmpa_tl -\tl_new:N \l__siunitx_tmpb_tl -\cs_new_protected:Npn \__siunitx_error:nxx #1#2#3 { - \bool_set_true:N \l__siunitx_error_bool - \msg_error:nnxx { siunitx } {#1} {#2} {#3} -} -\cs_new_protected:Npn \__siunitx_error:nx #1#2 { - \__siunitx_error:nxx {#1} {#2} { } -} -\cs_new_protected:Npn \__siunitx_error:n #1 { - \__siunitx_error:nxx {#1} { } { } -} -\bool_new:N \l__siunitx_error_bool -\AtBeginDocument { - \cs_if_free:cT { T@TS1 } - { - \DeclareFontEncoding { TS1 } { } { } - \DeclareFontSubstitution { TS1 } { cmr } { m } { n } - } -} -\DeclareTextSymbolDefault \c__siunitx_minus_tl { TS1 } -\DeclareTextSymbol \c__siunitx_minus_tl { TS1 } { 61 } -\AtBeginDocument { - \@ifpackageloaded { fontspec } - { - \@ifpackageloaded { eulervm } - { } - { - \int_const:Nn \c__siunitx_minus_int { 8722 } - \tl_set:Nn \c__siunitx_minus_tl - { \tex_char:D \c__siunitx_minus_int } - } - } - { } -} -\DeclareTextSymbol \c__siunitx_mu_tl { TS1 } { 181 } -\DeclareTextSymbolDefault \c__siunitx_mu_tl { TS1 } -\AtBeginDocument { - \@ifpackageloaded { fontspec } - { - \int_const:Nn \c__siunitx_mu_int { 181 } - \tl_set:Nn \c__siunitx_mu_tl { \tex_char:D \c__siunitx_mu_int } - } - { } -} -\tl_new:N \c__siunitx_omega_tl -\tl_set:Nn \c__siunitx_omega_tl { \Omega } -\AtBeginDocument { - \cs_if_exist:NT \upOmega - { \tl_set:Nn \c__siunitx_omega_tl { \upOmega } } -} -\cs_new_protected:Npn \__siunitx_tl_put_left_math:Nn #1#2 - { \tl_put_left:Nn #1 { \ensuremath {#2} } } -\cs_generate_variant:Nn \__siunitx_tl_put_left_math:Nn { NV } -\seq_new:N \c__siunitx_old_options_seq -\cs_set_protected:Npn \__siunitx_tmp:w #1 { - \seq_put_right:No \c__siunitx_old_options_seq { \tl_to_str:n {#1} } -} -\__siunitx_tmp:w { addsign } -\__siunitx_tmp:w { allowlitunits } -\__siunitx_tmp:w { allowoptarg } -\__siunitx_tmp:w { allowzeroexp } -\__siunitx_tmp:w { alsoload } -\__siunitx_tmp:w { angformat } -\__siunitx_tmp:w { anglesep } -\__siunitx_tmp:w { astroang } -\__siunitx_tmp:w { closeerr } -\__siunitx_tmp:w { closrfrac } -\__siunitx_tmp:w { closerange } -\__siunitx_tmp:w { colour } -\__siunitx_tmp:w { colorall } -\__siunitx_tmp:w { colourall } -\__siunitx_tmp:w { colorneg } -\__siunitx_tmp:w { colourneg } -\__siunitx_tmp:w { colourunits } -\__siunitx_tmp:w { colourunits } -\__siunitx_tmp:w { colorvalues } -\__siunitx_tmp:w { colourvalues } -\__siunitx_tmp:w { decimalsymbol } -\__siunitx_tmp:w { debug } -\__siunitx_tmp:w { detectdisplay } -\__siunitx_tmp:w { digitsep } -\__siunitx_tmp:w { dp } -\__siunitx_tmp:w { emulate } -\__siunitx_tmp:w { errspace } -\__siunitx_tmp:w { eVcorra } -\__siunitx_tmp:w { eVcorrb } -\__siunitx_tmp:w { expbase } -\__siunitx_tmp:w { expproduct } -\__siunitx_tmp:w { fixdp } -\__siunitx_tmp:w { fixsf } -\__siunitx_tmp:w { fraction } -\__siunitx_tmp:w { inlinebold } -\__siunitx_tmp:w { loctolang } -\__siunitx_tmp:w { log } -\__siunitx_tmp:w { load } -\__siunitx_tmp:w { mathOmega } -\__siunitx_tmp:w { mathcelsius } -\__siunitx_tmp:w { mathdegree } -\__siunitx_tmp:w { mathminute } -\__siunitx_tmp:w { mathmu } -\__siunitx_tmp:w { mathringA } -\__siunitx_tmp:w { mathrm } -\__siunitx_tmp:w { mathsOmega } -\__siunitx_tmp:w { mathscelsius } -\__siunitx_tmp:w { mathsdegree } -\__siunitx_tmp:w { mathsecond } -\__siunitx_tmp:w { mathsf } -\__siunitx_tmp:w { mathsminute } -\__siunitx_tmp:w { mathsmu } -\__siunitx_tmp:w { mathsringA } -\__siunitx_tmp:w { mathsrm } -\__siunitx_tmp:w { mathssecond } -\__siunitx_tmp:w { mathssf } -\__siunitx_tmp:w { mathstt } -\__siunitx_tmp:w { mathtt } -\__siunitx_tmp:w { negcolor } -\__siunitx_tmp:w { negcolour } -\__siunitx_tmp:w { noload } -\__siunitx_tmp:w { numaddn } -\__siunitx_tmp:w { numcloseerr } -\__siunitx_tmp:w { numdecimal } -\__siunitx_tmp:w { numdigits } -\__siunitx_tmp:w { numdiv } -\__siunitx_tmp:w { numexp } -\__siunitx_tmp:w { numgobble } -\__siunitx_tmp:w { numopenerr } -\__siunitx_tmp:w { numprod } -\__siunitx_tmp:w { numsign } -\__siunitx_tmp:w { obeyall } -\__siunitx_tmp:w { obeybold } -\__siunitx_tmp:w { obeyfamily } -\__siunitx_tmp:w { obeymode } -\__siunitx_tmp:w { obeyitalic } -\__siunitx_tmp:w { openerr } -\__siunitx_tmp:w { openfrac } -\__siunitx_tmp:w { openrange } -\__siunitx_tmp:w { padangle } -\__siunitx_tmp:w { padnumber } -\__siunitx_tmp:w { per } -\__siunitx_tmp:w { prefixbase } -\__siunitx_tmp:w { prefixproduct } -\__siunitx_tmp:w { prefixsymbolic } -\__siunitx_tmp:w { prespace } -\__siunitx_tmp:w { redefsymbols } -\__siunitx_tmp:w { repeatunits } -\__siunitx_tmp:w { retainplus } -\__siunitx_tmp:w { seperr } -\__siunitx_tmp:w { sepfour } -\__siunitx_tmp:w { sf } -\__siunitx_tmp:w { sign } -\__siunitx_tmp:w { slash } -\__siunitx_tmp:w { stickyper } -\__siunitx_tmp:w { strictarc } -\__siunitx_tmp:w { tabalign } -\__siunitx_tmp:w { tabalignexp } -\__siunitx_tmp:w { tabautofit } -\__siunitx_tmp:w { tabexpalign } -\__siunitx_tmp:w { tabformat } -\__siunitx_tmp:w { tabnumalign } -\__siunitx_tmp:w { tabparseonly } -\__siunitx_tmp:w { tabtextalign } -\__siunitx_tmp:w { textOmega } -\__siunitx_tmp:w { textcelsius } -\__siunitx_tmp:w { textdegree } -\__siunitx_tmp:w { textminute } -\__siunitx_tmp:w { textmode } -\__siunitx_tmp:w { textmu } -\__siunitx_tmp:w { textringA } -\__siunitx_tmp:w { textrm } -\__siunitx_tmp:w { textsecond } -\__siunitx_tmp:w { textsf } -\__siunitx_tmp:w { texttt } -\__siunitx_tmp:w { tightpm } -\__siunitx_tmp:w { tophrase } -\__siunitx_tmp:w { trapamigerr } -\__siunitx_tmp:w { trapambigfrac } -\__siunitx_tmp:w { trapambigrange } -\__siunitx_tmp:w { unitcolor } -\__siunitx_tmp:w { unitcolour } -\__siunitx_tmp:w { unitmathrm } -\__siunitx_tmp:w { unitmathsf } -\__siunitx_tmp:w { unitmathsrm } -\__siunitx_tmp:w { unitmathssf } -\__siunitx_tmp:w { unitmathstt } -\__siunitx_tmp:w { unitmathtt } -\__siunitx_tmp:w { unitmode } -\__siunitx_tmp:w { unitsep } -\__siunitx_tmp:w { unitspace } -\__siunitx_tmp:w { valuecolor } -\__siunitx_tmp:w { valuecolour } -\__siunitx_tmp:w { valuemathrm } -\__siunitx_tmp:w { valuemathsf } -\__siunitx_tmp:w { valuemathsrm } -\__siunitx_tmp:w { valuemathssf } -\__siunitx_tmp:w { valuemathstt } -\__siunitx_tmp:w { valuemathtt } -\__siunitx_tmp:w { valuemode } -\__siunitx_tmp:w { valuesep } -\__siunitx_tmp:w { xpace } -\tl_new:N \l__siunitx_key_tl -\keys_define:nn { siunitx } { - unknown .code:n = - { - \seq_if_in:NVTF \c__siunitx_old_options_seq \l_keys_key_tl - { - \msg_warning:nnx { siunitx } { version-1-option } - { \exp_not:V \l_keys_key_tl } - \tl_set:Nx \l__siunitx_key_tl - { - \keys_set:nn { siunitx } - { - \exp_not:V \l_keys_key_tl - \tl_if_blank:nF {#1} { = \exp_not:n {#1} } - } - } - \keys_set:nn { siunitx } { version-1-compatibility } - \tl_use:N \l__siunitx_key_tl - } - { - \msg_error:nnx { siunitx } { unknown-option } - { \exp_not:V \l_keys_key_tl } - } - } -} -\AtBeginDocument { - \keys_define:nn { siunitx } { - unknown .code:n = - { - \seq_if_in:NVTF \c__siunitx_old_options_seq \l_keys_key_tl - { - \msg_error:nnx { siunitx } { version-1-option } - { \exp_not:V \l_keys_key_tl } - } - { - \msg_error:nnx { siunitx } { unknown-option } - { \exp_not:V \l_keys_key_tl } - } - } -} -} -\cs_new_protected:Npn \__siunitx_option_deactivate:n #1 { - \clist_put_right:Nn \l__siunitx_option_deactivate_clist {#1} -} -\cs_new_protected:Npn \__siunitx_option_deactivate_aux:n #1 { - \keys_define:nn { siunitx } - { - #1 .code:n = - { \msg_warning:nnx { siunitx } { option-preamble-only } {#1} } - } -} -\AtBeginDocument { - \clist_map_function:NN \l__siunitx_option_deactivate_clist - \__siunitx_option_deactivate_aux:n -} -\clist_new:N \l__siunitx_option_deactivate_clist -\cs_new_protected:Npn \__siunitx_option_unchanged:Nnn #1#2#3 - { - \str_if_eq:VnT #1 {#2} - { \tl_set:Nn #1 {#3} } - } -\cs_generate_variant:Nn \tl_if_empty_p:n { f } -\cs_generate_variant:Nn \tl_if_empty:nT { f } -\cs_generate_variant:Nn \tl_if_in:NnTF { NV } -\cs_generate_variant:Nn \tl_replace_all:Nnn { NnV } -\prg_new_conditional:Npnn \__siunitx_cs_if_tl:N #1 { T, F , TF , p } - { - \bool_lazy_and:nnTF - { - \tl_if_empty_p:f - { - \token_get_prefix_spec:N #1 - \token_get_arg_spec:N #1 - } - } - { \bool_not_p:n { \cs_if_exist_p:c { \cs_to_str:N #1 ~ } } } - { \prg_return_true: } - { \prg_return_false: } - } -\prg_new_conditional:Npnn \__siunitx_number_if_zero:n #1 { p , TF } - { - \tl_map_function:nN {#1} \__siunitx_number_if_zero_aux:n - \prg_return_true: - } -\cs_generate_variant:Nn \__siunitx_number_if_zero_p:n { V } -\cs_new:Npn \__siunitx_number_if_zero_aux:n #1 - { - \token_if_eq_charcode:NNF #1 0 - { \tl_map_break:n { \prg_return_false: \use_none:n } } - } -\AtBeginDocument - { - \@ifpackageloaded { tex4ht } - { - \cs_set_eq:NN \__siunitx_print_text_super:n \textsuperscript - \__siunitx_option_unchanged:Nnn \l__siunitx_qualifier_mode_tl - { subscript } { brackets } - \keys_set:nn { siunitx } { mode = text } - \tl_set:Nn \c__siunitx_minus_tl { \HCode { &\#x2212; } } - } - { } - } -\cs_new_eq:NN \__siunitx_ensure_ltr:n \use:n -\AtBeginDocument - { - \@ifpackageloaded { bidi } - { - \sys_if_engine_xetex:T - { \cs_set_protected:Npn \__siunitx_ensure_ltr:n #1 { \LRE {#1} } } - } - { } - } -\cs_new_protected:Npn \__siunitx_textsuperscript:n #1 - { - \m@th - \ensuremath { ^ { \mbox { \fontsize \sf@size \z@ \selectfont #1 } } } - } -\bool_new:N \l__siunitx_display_math_bool -\tex_everydisplay:D \exp_after:wN - { - \tex_the:D \tex_everydisplay:D - \bool_set_true:N \l__siunitx_display_math_bool - } -\cs_generate_variant:Nn \prop_get:NnNT { NV } -\cs_generate_variant:Nn \prop_get:NnNF { NV } -\cs_generate_variant:Nn \prop_get:NnNTF { NV } -\cs_new_protected:Npn \__siunitx_set_math_fam:n #1 { - \int_new:c { c__siunitx_math #1 _int } - \group_begin: - \hbox_set:Nn \l__siunitx_tmp_box - { - \ensuremath - { - \use:c { math #1 } - { - \int_gset:cn { c__siunitx_math #1 _int } { \fam } - } - } - } - \group_end: -} -\tl_put_right:Nn \document - { - \__siunitx_set_math_fam:n { sf } - \__siunitx_set_math_fam:n { tt } - \ignorespaces - } -\cs_new_protected:Npn \__siunitx_set_text_fam:n #1 { - \tl_new:c { c__siunitx_text #1 _tl } - \tl_set:cx { c__siunitx_text #1 _tl } { \use:c { #1 default } } -} -\AtBeginDocument { - \__siunitx_set_text_fam:n { sf } - \__siunitx_set_text_fam:n { tt } -} -\tl_new:N \l__siunitx_detect_inline_weight_tl -\tl_new:N \l__siunitx_detect_inline_family_tl -\keys_define:nn { siunitx } { - detect-all .choice:, - detect-all .default:n = true, - detect-all / false .meta:n = - { - detect-family = false , - detect-mode = false , - detect-shape = false , - detect-weight = false , - }, - detect-all / true .meta:n = - { - detect-family = true , - detect-mode = true , - detect-shape = true , - detect-weight = true , - }, - detect-display-math .bool_set:N = - \l__siunitx_detect_display_math_bool, - detect-family .bool_set:N = \l__siunitx_detect_family_bool, - detect-inline-family .choice:, - detect-inline-family .value_required:n = true, - detect-inline-family / - math .code:n = - { \tl_set:Nn \l__siunitx_detect_inline_family_tl { math } }, - detect-inline-family / - text .code:n = - { \tl_set:Nn \l__siunitx_detect_inline_family_tl { text } }, - detect-inline-weight .choice:, - detect-inline-weight .value_required:n = true, - detect-inline-weight / - math .code:n = - { \tl_set:Nn \l__siunitx_detect_inline_weight_tl { math } }, - detect-inline-weight / - text .code:n = - { \tl_set:Nn \l__siunitx_detect_inline_weight_tl { text } }, - detect-italic .bool_set:N = \l__siunitx_detect_shape_bool, - detect-mode .bool_set:N = \l__siunitx_detect_mode_bool, - detect-none .choice:, - detect-none .default:n = true, - detect-none / false .meta:n = - { - detect-family = true, - detect-mode = true, - detect-shape = true, - detect-weight = true - }, - detect-none / true .meta:n = - { - detect-family = false, - detect-mode = false, - detect-shape = false, - detect-weight = false - }, - detect-shape .bool_set:N = \l__siunitx_detect_shape_bool, - detect-weight .bool_set:N = \l__siunitx_detect_weight_bool -} -\keys_set:nn { siunitx } { - detect-inline-family = text , - detect-inline-weight = text , -} -\bool_new:N \l__siunitx_font_set_bool -\bool_new:N \l__siunitx_font_math_mode_bool -\tl_new:N \l__siunitx_font_family_tl -\cs_new:Npn \__siunitx_font_shape: { } -\cs_new:Npn \__siunitx_font_weight: { } -\cs_new_protected:Npn \__siunitx_detect_font: { - \bool_if:NF \l__siunitx_font_set_bool - { - \__siunitx_detect_font_init: - \bool_if:NT \l__siunitx_detect_weight_bool - { \__siunitx_detect_font_weight: } - \bool_if:NT \l__siunitx_detect_family_bool - { \__siunitx_detect_font_family: } - \bool_if:NT \l__siunitx_detect_shape_bool - { \__siunitx_detect_font_shape: } - \bool_if:NT \l__siunitx_detect_mode_bool - { \__siunitx_detect_font_mode: } - } -} -\cs_new_protected:Npn \__siunitx_detect_font_init: { - \bool_set_true:N \l__siunitx_font_set_bool - \cs_set:Npn \__siunitx_font_weight: - { - \unboldmath - \mdseries - } - \cs_set:Npn \__siunitx_font_shape: { \upshape } - \tl_set:Nn \l__siunitx_font_family_tl { rm } - \bool_set_true:N \l__siunitx_font_math_mode_bool -} -\cs_new_protected:Npn \__siunitx_detect_font_weight: { - \mode_if_math:TF - { - \bool_if:NTF \l__siunitx_display_math_bool - { - \bool_if:NTF \l__siunitx_detect_display_math_bool - { \__siunitx_detect_font_weight_math: } - { \__siunitx_detect_font_weight_text: } - } - { - \use:c - { - __siunitx_detect_font_weight_ - \l__siunitx_detect_inline_weight_tl - : - } - } - } - { \__siunitx_detect_font_weight_text: } -} -\cs_new_protected:Npn \__siunitx_detect_font_weight_math: { - \str_if_eq:VnT \math@version { bold } - { - \cs_set:Npn \__siunitx_font_weight: - { - \boldmath - \bfseries - } - } - \str_if_eq:VnT \math@version { light } - { \cs_set:Npn \__siunitx_font_weight: { \lseries } } -} -\cs_new_protected:Npn \__siunitx_detect_font_weight_text: { - \tl_set:Nx \l__siunitx_tmpa_tl { \tl_head:N \f@series } - \str_if_eq:VnT \l__siunitx_tmpa_tl { b } - { - \cs_set:Npn \__siunitx_font_weight: - { - \boldmath - \bfseries - } - } - \str_if_eq:VnT \l__siunitx_tmpa_tl { l } - { \cs_set:Npn \__siunitx_font_weight: { \lseries } } -} -\cs_new_protected:Npn \__siunitx_detect_font_family: { - \mode_if_math:TF - { - \bool_if:NTF \l__siunitx_display_math_bool - { - \bool_if:NTF \l__siunitx_detect_display_math_bool - { \__siunitx_detect_font_family_math: } - { \__siunitx_detect_font_family_text: } - } - { - \use:c - { - __siunitx_detect_font_family_ - \l__siunitx_detect_inline_family_tl - : - } - } - } - { \__siunitx_detect_font_family_text: } -} -\cs_new_protected:Npn \__siunitx_detect_font_family_math: { - \tl_set:Nn \l__siunitx_font_family_tl { rm } - \int_compare:nNnT { \fam } = { \c__siunitx_mathsf_int } - { \tl_set:Nn \l__siunitx_font_family_tl { sf } } - \int_compare:nNnT { \fam } = { \c__siunitx_mathtt_int } - { \tl_set:Nn \l__siunitx_font_family_tl { tt } } -} -\cs_new_protected:Npn \__siunitx_detect_font_family_text: { - \tl_if_eq:NNT \f@family \c__siunitx_textsf_tl - { \tl_set:Nn \l__siunitx_font_family_tl { sf } } - \tl_if_eq:NNT \f@family \c__siunitx_texttt_tl - { \tl_set:Nn \l__siunitx_font_family_tl { tt } } -} -\cs_new_protected:Npn \__siunitx_detect_font_shape: - { - \cs_if_exist:cT { \f@shape shape } - { - \cs_set:Npx \__siunitx_font_shape: { \exp_not:c { \f@shape shape } } - } - } -\cs_new_protected:Npn \__siunitx_detect_font_mode: { - \mode_if_math:F - { - \bool_set_false:N \l__siunitx_font_math_mode_bool - \bool_set_false:N \l__siunitx_number_math_mode_bool - \bool_set_false:N \l__siunitx_unit_math_mode_bool - } -} -\bool_new:N \l__siunitx_number_math_mode_bool -\bool_new:N \l__siunitx_unit_math_mode_bool -\cs_new:Npn \__siunitx_number_mathrm:n #1 { } -\cs_new:Npn \__siunitx_number_mathsf:n #1 { } -\cs_new:Npn \__siunitx_number_mathtt:n #1 { } -\cs_new:Npn \__siunitx_number_textrm: { } -\cs_new:Npn \__siunitx_number_textsf: { } -\cs_new:Npn \__siunitx_number_texttt: { } -\keys_define:nn { siunitx } { - number-color .tl_set:N = \l__siunitx_number_color_tl, - number-math-rm .code:n = - { \cs_set:Npn \__siunitx_number_mathrm:n ##1 { #1 {##1} } }, - number-math-sf .code:n = - { \cs_set:Npn \__siunitx_number_mathsf:n ##1 { #1 {##1} } }, - number-math-tt .code:n = - { \cs_set:Npn \__siunitx_number_mathtt:n ##1 { #1 {##1} } }, - number-mode .choice:, - number-mode / math .code:n = - { \bool_set_true:N \l__siunitx_number_math_mode_bool }, - number-mode / text .code:n = - { \bool_set_false:N \l__siunitx_number_math_mode_bool }, - number-text-rm .code:n = - { \cs_set:Npn \__siunitx_number_textrm: {#1} }, - number-text-sf .code:n = - { \cs_set:Npn \__siunitx_number_textsf: {#1} }, - number-text-tt .code:n = - { \cs_set:Npn \__siunitx_number_texttt: {#1} } -} -\cs_new:Npn \__siunitx_unit_mathrm: { } -\cs_new:Npn \__siunitx_unit_mathsf: { } -\cs_new:Npn \__siunitx_unit_mathtt: { } -\cs_new:Npn \__siunitx_unit_textrm: { } -\cs_new:Npn \__siunitx_unit_textsf: { } -\cs_new:Npn \__siunitx_unit_texttt: { } -\keys_define:nn { siunitx } { - unit-color .tl_set:N = \l__siunitx_unit_color_tl, - unit-math-rm .code:n = - { \cs_set:Npn \__siunitx_unit_mathrm:n ##1 { #1 {##1} } }, - unit-math-sf .code:n = - { \cs_set:Npn \__siunitx_unit_mathsf:n ##1 { #1 {##1} } }, - unit-math-tt .code:n = - { \cs_set:Npn \__siunitx_unit_mathtt:n ##1 { #1 {##1} } }, - unit-mode .choice:, - unit-mode / math .code:n = - { \bool_set_true:N \l__siunitx_unit_math_mode_bool }, - unit-mode / text .code:n = - { \bool_set_false:N \l__siunitx_unit_math_mode_bool }, - unit-text-rm .code:n = - { \cs_set:Npn \__siunitx_unit_textrm: {#1} }, - unit-text-sf .code:n = - { \cs_set:Npn \__siunitx_unit_textsf: {#1} }, - unit-text-tt .code:n = - { \cs_set:Npn \__siunitx_unit_texttt: {#1} } -} -\keys_define:nn { siunitx } { - color .meta:n = - { - number-color = #1, - unit-color = #1 - }, - math-rm .meta:n = - { - number-math-rm = #1, - unit-math-rm = #1 - }, - math-sf .meta:n = - { - number-math-sf = #1, - unit-math-sf = #1 - }, - math-tt .meta:n = - { - number-math-tt = #1, - unit-math-tt = #1 - }, - mode .choice:, - mode / math .meta:n = - { - number-mode = math, - unit-mode = math - }, - mode / text .meta:n = - { - number-mode = text, - unit-mode = text - }, - text-rm .meta:n = - { - number-text-rm = #1, - unit-text-rm = #1 - }, - text-sf .meta:n = - { - number-text-sf = #1, - unit-text-sf = #1 - }, - text-tt .meta:n = - { - number-text-tt = #1, - unit-text-tt = #1 - } -} -\keys_set:nn { siunitx } { - math-rm = \mathrm, - math-sf = \mathsf, - math-tt = \mathtt, - mode = math, - text-rm = \rmfamily, - text-sf = \sffamily, - text-tt = \ttfamily, -} -\AtBeginDocument { - \tl_set:Nx \l__siunitx_tmpa_tl { \familydefault } - \@ifpackageloaded { eulervm } - { - \cs_set:Npn \__siunitx_tmp:w #1 { \mathrm {#1} } - \cs_if_eq:NNT \__siunitx_number_mathrm:n \__siunitx_tmp:w - { \keys_set:nn { siunitx } { number-math-rm = \mathnormal } } - \cs_if_eq:NNT \__siunitx_unit_mathrm:n \__siunitx_tmp:w - { \keys_set:nn { siunitx } { unit-math-rm = \mathnormal } } - } - { } - \tl_if_eq:NNT \l__siunitx_tmpa_tl \c__siunitx_textsf_tl - { - \@ifpackageloaded { arev } - { } - { - \@ifpackageloaded { cmbright } - { } - { - \cs_set:Npn \__siunitx_tmp:w #1 { \mathrm {#1} } - \cs_if_eq:NNT \__siunitx_number_mathrm:n \__siunitx_tmp:w - { \keys_set:nn { siunitx } { number-math-rm = \mathsf } } - \cs_if_eq:NNT \__siunitx_unit_mathrm:n \__siunitx_tmp:w - { \keys_set:nn { siunitx } { unit-math-rm = \mathsf } } - } - } - \cs_set:Npn \__siunitx_tmp:w { \rmfamily } - \cs_if_eq:NNT \__siunitx_number_textrm: \__siunitx_tmp:w - { \keys_set:nn { siunitx } { number-text-rm = \sffamily } } - \cs_if_eq:NNT \__siunitx_unit_textrm: \__siunitx_tmp:w - { \keys_set:nn { siunitx } { unit-text-rm = \sffamily } } - } - \tl_if_eq:NNT \l__siunitx_tmpa_tl \c__siunitx_texttt_tl - { - \cs_set:Npn \__siunitx_tmp:w #1 { \mathrm {#1} } - \cs_if_eq:NNT \__siunitx_number_mathrm:n \__siunitx_tmp:w - { \keys_set:nn { siunitx } { number-math-rm = \mathtt } } - \cs_if_eq:NNT \__siunitx_unit_mathrm:n \__siunitx_tmp:w - { \keys_set:nn { siunitx } { unit-math-rm = \mathtt } } - \cs_set:Npn \__siunitx_tmp:w { \rmfamily } - \cs_if_eq:NNT \__siunitx_number_textrm: \__siunitx_tmp:w - { \keys_set:nn { siunitx } { number-text-rm = \ttfamily } } - \cs_if_eq:NNT \__siunitx_unit_textrm: \__siunitx_tmp:w - { \keys_set:nn { siunitx } { unit-text-rm = \ttfamily } } - } -} -\tl_new:N \l__siunitx_print_arg_tl -\tl_new:N \l__siunitx_print_type_tl -\cs_new_protected:Npn \__siunitx_print:nn #1#2 { - \group_begin: - \tl_set:Nn \l__siunitx_print_type_tl {#1} - \tl_set:Nn \l__siunitx_print_arg_tl {#2} - \__siunitx_detect_font: - \bool_if:NF \l__siunitx_detect_mode_bool - { - \bool_if:cTF { l__siunitx_ #1 _math_mode_bool } - { \bool_set_true:N \l__siunitx_font_math_mode_bool } - { \bool_set_false:N \l__siunitx_font_math_mode_bool } - } - \__siunitx_print_aux: - \group_end: -} -\cs_generate_variant:Nn \__siunitx_print:nn { nV } -\cs_new_protected:Npn \__siunitx_print_aux: - { - \text - { - \__siunitx_ensure_ltr:n - { - \color@begingroup - \__siunitx_print_color: - \__siunitx_font_shape: - \__siunitx_font_weight: - \use:c - { - __siunitx_ \l__siunitx_print_type_tl _ - text \l__siunitx_font_family_tl : - } - \bool_if:NTF \l__siunitx_font_math_mode_bool - { \__siunitx_print_math: } - { \__siunitx_print_text: } - \color@endgroup - } - } - } -\cs_new_protected:Npn \__siunitx_print_color: { - \tl_if_empty:cF { l__siunitx_ \l__siunitx_print_type_tl _color_tl } - { - \color - { - \tl_use:c { l__siunitx_ \l__siunitx_print_type_tl _color_tl } - } - } -} -\AtBeginDocument { - \@ifpackageloaded { color } - { \cs_new_eq:NN \__siunitx_textcolor:n \textcolor } - { - \cs_set_protected:Npn \__siunitx_print_color: - { - \tl_if_empty:cF { l__siunitx_ \l__siunitx_print_type_tl _color_tl } - { - \cs_gset_eq:NN \__siunitx_print_color: \scan_stop: - \msg_warning:nn { siunitx } { color-not-loaded } - } - } - \cs_new_protected:Npn \__siunitx_textcolor:n #1 - { - \cs_gset_eq:NN \__siunitx_textcolor:n \use_none:n - \msg_warning:nn { siunitx } { color-not-loaded } - } - } -} -\cs_new_protected:Npn \__siunitx_print_math: - { - \cs_set_eq:NN \PrintSubscript \sb - \cs_set_eq:NN \PrintSuperscript \sp - \ensuremath - { - \use:c - { - __siunitx_ \l__siunitx_print_type_tl _ - math \l__siunitx_font_family_tl :n - } - { \l__siunitx_print_arg_tl } - } - } -\cs_new_protected:Npn \__siunitx_print_text: - { - \tl_replace_all:Nnn \l__siunitx_print_arg_tl { - } - { \c__siunitx_minus_tl } - \__siunitx_print_text_aux: - \tl_replace_all:Nnn \l__siunitx_print_arg_tl { \mp } - { \ensuremath { \mp } } - \tl_remove_all:Nn \l__siunitx_print_arg_tl { \mathord } - \cs_set_eq:NN \PrintSubscript \__siunitx_print_text_sub:n - \cs_set_eq:NN \PrintSuperscript \__siunitx_print_text_super:n - \__siunitx_print_text_aux:NnN - _ { math_subscript } \__siunitx_print_text_sub:n - _ { active } \__siunitx_print_text_sub:n - ^ { math_superscript } \__siunitx_print_text_super:n - ^ { active } \__siunitx_print_text_super:n - \q_recursion_tail ? ? - \q_recursion_stop - \l__siunitx_print_arg_tl - } -\cs_new_protected:Npn \__siunitx_print_text_aux: - { - \tl_replace_all:Nnn \l__siunitx_print_arg_tl { \pm } - { \ensuremath { \pm } } - } -\cs_new_protected:Npn \__siunitx_print_text_aux:NnN #1#2#3 - { - \quark_if_recursion_tail_stop:N #1 - \tl_set_rescan:Nnn \l__siunitx_tmpa_tl - { \use:c { char_set_catcode_ #2 :N } #1 } - {#1} - \tl_replace_all:NVn \l__siunitx_print_arg_tl \l__siunitx_tmpa_tl {#3} - \__siunitx_print_text_aux:NnN - } -\AtBeginDocument - { - \@ifpackageloaded { textcomp } - { - \cs_set_protected:Npn \__siunitx_print_text_aux: - { - \tl_replace_all:Nnn \l__siunitx_print_arg_tl { \pm } - { \textpm } - } - } - { } - } -\cs_new_protected:Npn \__siunitx_print_text_sub:n #1 - { - \cs_set:Npn \__siunitx_print_text_sub_super:n ##1 - { - \ensuremath - { - \sb { \text {#1} } - \sp { \text {##1} } - } - } - \cs_set_protected:Npn \__siunitx_peek_true: - { - \tex_afterassignment:D \__siunitx_print_text_sub_super:n - \cs_set_eq:NN \__siunitx_tmp:w - } - \cs_set_protected:Npn \__siunitx_peek_false: - { \ensuremath { \sb { \text {#1} } } } - \peek_after:Nw \__siunitx_print_text_sub_peek: - } -\cs_new_protected:Npn \__siunitx_print_text_sub_peek: - { - \if_meaning:w \l_peek_token \__siunitx_print_text_super:n - \exp_after:wN \__siunitx_peek_true: - \else: - \exp_after:wN \__siunitx_peek_false: - \fi: - } -\cs_new_protected:Npn \__siunitx_peek_true: { } -\cs_new_protected:Npn \__siunitx_peek_false: { } -\cs_new_protected:Npn \__siunitx_print_text_sub_super:n { } -\cs_new_protected:Npn \__siunitx_print_text_super:n #1 { - \tl_set:Nn \l__siunitx_tmpa_tl {#1} - \tl_replace_all:Nnn \l__siunitx_tmpa_tl { - } - { \c__siunitx_minus_tl } - \tl_set:Nx \l__siunitx_tmpa_tl - { - \exp_not:N \ensuremath - { \sp { \exp_not:N \text { \exp_not:V \l__siunitx_tmpa_tl } } } - } - \l__siunitx_tmpa_tl -} -\keys_define:nn { siunitx } { - input-product .tl_set:N = \l__siunitx_input_product_tl, - input-quotient .tl_set:N = \l__siunitx_input_quotient_tl, -} -\keys_set:nn { siunitx } { - input-product = x, - input-quotient = / -} -\tl_new:N \l__siunitx_number_arg_tl -\tl_new:N \l__siunitx_number_next_tl -\tl_new:N \l__siunitx_number_multi_tl -\tl_new:N \l__siunitx_number_denominator_tl -\tl_new:N \l__siunitx_number_numerator_tl -\cs_new_protected:Npn \__siunitx_number_preprocess:n #1 { - \__siunitx_number_preprocess_init: - \tl_set:Nn \l__siunitx_number_arg_tl {#1} - \__siunitx_number_preprocess_product: - \tl_if_empty:NT \l__siunitx_number_multi_tl - { \__siunitx_number_preprocess_quotient: } -} -\cs_generate_variant:Nn \__siunitx_number_preprocess:n { V } -\cs_new_protected:Npn \__siunitx_number_preprocess_init: { - \bool_set_false:N \l__siunitx_error_bool - \tl_clear:N \l__siunitx_number_multi_tl -} -\cs_new_protected:Npn \__siunitx_number_preprocess_product: { - \tl_map_function:NN \l__siunitx_input_product_tl - \__siunitx_number_preprocess_product_aux:N -} -\cs_new_protected:Npn \__siunitx_number_preprocess_product_aux:N #1 { - \tl_if_in:NnT \l__siunitx_number_arg_tl {#1} - { - \cs_set:Npn \__siunitx_tmp:w ##1 #1 ##2 \q_stop - { - \tl_set:Nn \l__siunitx_number_arg_tl {##1} - \tl_set:Nn \l__siunitx_number_next_tl {##2} - \tl_set:Nn \l__siunitx_number_multi_tl { product } - } - \exp_after:wN \__siunitx_tmp:w \l__siunitx_number_arg_tl \q_stop - \tl_if_empty:NT \l__siunitx_number_arg_tl - { \__siunitx_error:n { starting-product-token } } - \tl_if_empty:NT \l__siunitx_number_next_tl - { \__siunitx_error:n { ending-product-token } } - \tl_map_break: - } -} -\cs_new_protected:Npn \__siunitx_number_preprocess_quotient: { - \tl_map_function:NN \l__siunitx_input_quotient_tl - \__siunitx_number_preprocess_quotient_aux:N -} -\cs_new_protected:Npn \__siunitx_number_preprocess_quotient_aux:N #1 { - \tl_if_in:NnT \l__siunitx_number_arg_tl {#1} - { - \cs_set:Npn \__siunitx_tmp:w ##1 #1 ##2 \q_stop - { - \tl_set:Nn \l__siunitx_number_numerator_tl {##1} - \tl_set:Nn \l__siunitx_number_denominator_tl {##2} - \tl_set:Nn \l__siunitx_number_multi_tl { quotient } - } - \exp_after:wN \__siunitx_tmp:w \l__siunitx_number_arg_tl \q_stop - \tl_if_empty:NT \l__siunitx_number_numerator_tl - { \__siunitx_error:n { starting-quotient-token } } - \tl_if_empty:NT \l__siunitx_number_denominator_tl - { \__siunitx_error:n { ending-quotient-token } } - \tl_if_in:NnT \l__siunitx_number_denominator_tl {#1} - { \__siunitx_error:n { duplicate-quotient-token } } - \tl_map_break: - } -} -\tl_new:N \c__siunitx_number_part_complex_tl -\tl_set:Nn \c__siunitx_number_part_complex_tl { complex } -\bool_new:N \l__siunitx_number_in_complex_bool -\bool_new:N \l__siunitx_number_in_complex_root_bool -\bool_new:N \l__siunitx_number_in_decimal_bool -\bool_new:N \l__siunitx_number_in_exponent_bool -\bool_new:N \l__siunitx_number_in_first_bool -\bool_new:N \l__siunitx_number_in_sign_bool -\bool_new:N \l__siunitx_number_in_uncert_bool -\bool_new:N \l__siunitx_number_in_value_bool -\prop_new:N \l__siunitx_number_in_prop -\tl_new:N \l__siunitx_number_parsed_tl -\tl_new:N \l__siunitx_number_part_tl -\tl_new:N \l__siunitx_number_part_decimal_tl -\tl_new:N \l__siunitx_number_part_decimal_marker_tl -\tl_new:N \l__siunitx_number_part_integer_tl -\tl_new:N \l__siunitx_number_part_sign_tl -\tl_new:N \l__siunitx_number_part_uncert_tl -\int_new:N \l__siunitx_number_mantissa_length_int -\tl_new:N \l__siunitx_number_uncert_tl -\int_new:N \l__siunitx_number_uncert_length_int -\tl_new:N \l__siunitx_input_uncert_sign_tl -\keys_define:nn { siunitx } { - input-close-uncertainty .tl_set:N = \l__siunitx_input_uncert_close_tl , - input-complex-roots .tl_set:N = \l__siunitx_input_complex_tl , - input-comparators .tl_set:N = \l__siunitx_input_comparator_tl , - input-decimal-markers .tl_set:N = \l__siunitx_input_decimal_tl , - input-digits .tl_set:N = \l__siunitx_input_digit_tl , - input-exponent-markers .tl_set:N = \l__siunitx_input_exponent_tl , - input-ignore .tl_set:N = \l__siunitx_input_ignore_tl , - input-open-uncertainty .tl_set:N = \l__siunitx_input_uncert_open_tl , - input-protect-tokens .tl_set:N = \l__siunitx_input_protect_tl , - input-signs .tl_set:N = \l__siunitx_input_sign_tl , - input-symbols .tl_set:N = \l__siunitx_input_symbol_tl , - input-uncertainty-signs .code:n = - { - \tl_set:Nn \l__siunitx_input_uncert_sign_tl {#1} - \tl_map_inline:nn {#1} - { - \tl_if_in:NnF \l__siunitx_input_sign_tl {##1} - { \tl_put_right:Nn \l__siunitx_input_sign_tl {##1} } - } - } , -} -\keys_set:nn { siunitx } { % ( - input-close-uncertainty = ), - input-complex-roots = ij, - input-comparators = {<=>\approx\ge\geq\gg\le\leq\ll\sim}, - input-decimal-markers = {.,}, - input-digits = 0123456789, - input-exponent-markers = dDeE, - input-open-uncertainty = (, % ) - input-protect-tokens = \approx\dots\ge\geq\gg\le\leq\ll\mp\pi\pm\sim, - input-signs = +-\mp\pm, - input-symbols = \dots\pi, - input-uncertainty-signs = \pm, -} -\cs_new_protected:Npn \__siunitx_number_in_parse:n #1 { - \tl_if_empty:nF {#1} - { - \__siunitx_number_in_init: - \cs_set_eq:NN \__siunitx_number_in_parse_more:N - \__siunitx_number_in_parse_mantissa_aux:N - \__siunitx_number_in_parse_aux:n {#1} - } -} -\cs_generate_variant:Nn \__siunitx_number_in_parse:n { V } -\group_begin: - \char_set_catcode_active:N \~ - \char_set_catcode_space:N \ % - \cs_new_protected:Npn \__siunitx_number_in_parse_aux:n#1% - {% - \group_begin: - \__siunitx_number_in_protect: - \cs_set_eq:NN\,\prg_do_nothing: - \cs_set_eq:NN~\prg_do_nothing: - \tl_set_rescan:Nnx\l__siunitx_number_arg_tl - {% - \char_set_catcode_ignore:N\ % - \char_set_catcode_other:N\,% - \char_set_catcode_other:N\.% - }% - {#1}% - \exp_args:NNNV\group_end: - \tl_set:Nn\l__siunitx_number_arg_tl\l__siunitx_number_arg_tl - \__siunitx_number_in_sign_replace:N\l__siunitx_number_arg_tl - \__siunitx_number_in_parse_relation:N\l__siunitx_number_arg_tl - \tl_map_function:NN\l__siunitx_number_arg_tl - \__siunitx_number_in_parse_loop:N - \tl_if_empty:NF\l__siunitx_number_parsed_tl - {% - \bool_if:NTF\l__siunitx_number_in_uncert_bool - {\__siunitx_error:nx{invalid-number}{#1}}% - {% - \prop_put:NVn \l__siunitx_number_in_prop - \l__siunitx_number_part_tl {true}% - \bool_if:NTF\l__siunitx_number_in_decimal_bool - {% - \prop_put:NVV\l__siunitx_number_in_prop - \l__siunitx_number_part_decimal_tl - \l__siunitx_number_parsed_tl - }% - {% - \prop_put:NVV\l__siunitx_number_in_prop - \l__siunitx_number_part_integer_tl - \l__siunitx_number_parsed_tl - }% - }% - }% - \__siunitx_number_in_check:n {#1}% - } -\group_end: -\cs_new_protected:Npn \__siunitx_number_in_init: { - \cs_set_eq:NN \__siunitx_number_in_parse_loop:N - \__siunitx_number_in_parse_mantissa:N - \cs_set_eq:NN \__siunitx_number_in_check:n - \__siunitx_number_in_check_short:n - \tl_clear:N \l__siunitx_number_parsed_tl - \prop_clear:N \l__siunitx_number_in_prop - \bool_set_false:N \l__siunitx_error_bool - \bool_set_false:N \l__siunitx_number_in_complex_bool - \bool_set_false:N \l__siunitx_number_in_complex_root_bool - \bool_set_false:N \l__siunitx_number_in_exponent_bool - \bool_set_false:N \l__siunitx_number_in_uncert_bool - \__siunitx_number_in_init_part:n { mantissa } -} -\cs_new_protected:Npn \__siunitx_number_in_init_part:n #1 { - \bool_set_false:N \l__siunitx_number_in_decimal_bool - \bool_set_true:N \l__siunitx_number_in_first_bool - \bool_set_false:N \l__siunitx_number_in_sign_bool - \bool_set_false:N \l__siunitx_number_in_value_bool - \tl_set:Nn \l__siunitx_number_part_tl {#1} - \tl_set:Nn \l__siunitx_number_part_decimal_tl { #1 -decimal } - \tl_set:Nn \l__siunitx_number_part_decimal_marker_tl - { #1 -decimal-marker } - \tl_set:Nn \l__siunitx_number_part_integer_tl { #1 -integer } - \tl_set:Nn \l__siunitx_number_part_sign_tl { #1 -sign } - \tl_set:Nn \l__siunitx_number_part_uncert_tl { #1 -uncertainty } -} -\cs_new_protected:Npn \__siunitx_number_in_protect: { - \tl_map_function:NN \l__siunitx_input_protect_tl - \__siunitx_number_in_protect_aux:N -} -\cs_new_protected:Npn \__siunitx_number_in_protect_aux:N #1 { - \cs_set_eq:NN #1 \scan_stop: -} -\cs_new_protected:Npn \__siunitx_number_in_sign_replace:N #1 - { - \__siunitx_number_in_sign_replace_aux:N #1 - \__siunitx_number_in_sign_replace_aux:NnN #1 - { -+ } \mp - { +- } \pm - { << } \ll - { <= } \le - { >> } \gg - { >= } \ge - { ?? } \q_recursion_tail - \q_recursion_stop - } -\group_begin: - \char_set_catcode_active:N - - \cs_new_protected:Npx \__siunitx_number_in_sign_replace_aux:N #1 - { \tl_replace_all:Nnn #1 { \exp_not:N - } { \token_to_str:N - } } -\group_end: -\cs_new_protected:Npn \__siunitx_number_in_sign_replace_aux:NnN #1#2#3 - { - \quark_if_recursion_tail_stop:N #3 - \tl_replace_all:Nnn #1 {#2} {#3} - \__siunitx_number_in_sign_replace_aux:NnN #1 - } -\cs_new_protected:Npn \__siunitx_number_in_parse_error:nn #1#2 { - \__siunitx_error:nx {#1} { \exp_not:n {#2} } - \tl_map_break: -} -\cs_generate_variant:Nn \__siunitx_number_in_parse_error:nn { nV } -\cs_new_protected:Npn \__siunitx_number_in_parse_loop:N #1 { } -\cs_new_protected:Npn \__siunitx_number_in_parse_more:N #1 { } -\cs_new_protected:Npn \__siunitx_number_in_parse_relation:N #1 { - \exp_after:wN \__siunitx_number_in_parse_relation:w #1 \q_stop #1 -} -\cs_new_protected:Npn \__siunitx_number_in_parse_relation:w - #1#2 \q_stop #3 { - \tl_if_in:NnT \l__siunitx_input_comparator_tl {#1} - { - \prop_put:Nnn \l__siunitx_number_in_prop { comparator } {#1} - \tl_set:Nn #3 {#2} - } -} -\cs_new_protected:Npn \__siunitx_number_in_parse_restricted:N #1 { - \tl_if_in:NnTF \l__siunitx_input_exponent_tl {#1} - { - \__siunitx_number_in_parse_error:nn - { restricted-number } {#1} - } - { - \tl_if_in:NnTF \l__siunitx_input_uncert_open_tl {#1} - { - \__siunitx_number_in_parse_error:nV - { restricted-number } \l__siunitx_number_arg_tl - } - { - \tl_if_in:NnTF \l__siunitx_input_uncert_close_tl {#1} - { - \__siunitx_number_in_parse_error:nV - { restricted-number } \l__siunitx_number_arg_tl - } - { - \tl_if_in:NnTF \l__siunitx_input_complex_tl {#1} - { - \__siunitx_number_in_parse_error:nV - { restricted-number } \l__siunitx_number_arg_tl - } - { - \__siunitx_number_in_parse_error:nn - { restricted-number } {#1} - } - } - } - } -} -\cs_new_protected:Npn \__siunitx_number_in_parse_complex:N #1 { - \tl_if_in:NnTF \l__siunitx_input_exponent_tl {#1} - { - \cs_set_eq:NN \__siunitx_number_in_parse_loop:N - \__siunitx_number_in_parse_mantissa:N - \__siunitx_number_in_exponent:N #1 - } - { - \tl_if_in:NnF \l__siunitx_input_ignore_tl {#1} - { - \__siunitx_number_in_parse_error:nV - { misplaced-complex-root-token } - \l__siunitx_number_arg_tl - } - } -} -\cs_new_protected:Npn \__siunitx_number_in_parse_exponent:N #1 { - \tl_if_in:NnTF \l__siunitx_input_exponent_tl {#1} - { - \__siunitx_number_in_parse_error:nn - { duplicate-exponent-token } { \token_to_str:N #1 } - } - { - \tl_if_in:NnTF \l__siunitx_input_uncert_open_tl {#1} - { - \__siunitx_number_in_parse_error:nV - { invalid-token-in-exponent } \l__siunitx_number_arg_tl - } - { - \tl_if_in:NnTF \l__siunitx_input_uncert_close_tl {#1} - { - \__siunitx_number_in_parse_error:nV - { invalid-token-in-exponent } \l__siunitx_number_arg_tl - } - { - \tl_if_in:NnTF \l__siunitx_input_complex_tl {#1} - { - \__siunitx_number_in_parse_error:nV - { invalid-token-in-exponent } - \l__siunitx_number_arg_tl - } - { - \__siunitx_number_in_parse_error:nn - { invalid-token-in-number } {#1} - } - } - } - } -} -\cs_new_protected:Npn \__siunitx_number_in_parse_mantissa:N #1 { - \tl_if_in:NnTF \l__siunitx_input_digit_tl {#1} - { \__siunitx_number_in_digit:n {#1} } - { - \tl_if_in:NnTF \l__siunitx_input_decimal_tl {#1} - { \__siunitx_number_in_decimal:N #1 } - { - \tl_if_in:NnTF \l__siunitx_input_sign_tl {#1} - { \__siunitx_number_in_sign:N #1 } - { - \tl_if_in:NnTF \l__siunitx_input_symbol_tl {#1} - { - \prop_put:Nnn \l__siunitx_number_in_prop { symbolic } - { true } - \__siunitx_number_in_digit:n { \ensuremath {#1} } - } - { - \tl_if_in:NnF \l__siunitx_input_ignore_tl {#1} - { \__siunitx_number_in_parse_more:N #1 } - } - } - } - } -} -\cs_new_protected:Npn \__siunitx_number_in_parse_mantissa_aux:N #1 { - \tl_if_in:NnTF \l__siunitx_input_exponent_tl {#1} - { \__siunitx_number_in_exponent:N #1 } - { - \tl_if_in:NnTF \l__siunitx_input_uncert_open_tl {#1} - { \__siunitx_number_in_uncert_open:N #1 } - { - \tl_if_in:NnTF \l__siunitx_input_uncert_close_tl {#1} - { - \__siunitx_number_in_parse_error:nn - { misplaced-uncertainty-token } {#1} - } - { - \tl_if_in:NnTF \l__siunitx_input_complex_tl {#1} - { \__siunitx_number_in_complex:N #1 } - { - \__siunitx_number_in_parse_error:nn - { invalid-token-in-number } {#1} - } - } - } - } -} -\cs_new_protected:Npn \__siunitx_number_in_parse_uncert:N #1 { - \tl_if_in:NnTF \l__siunitx_input_digit_tl {#1} - { \__siunitx_number_in_digit:n {#1} } - { - \tl_if_in:NnTF \l__siunitx_input_decimal_tl {#1} - { - \__siunitx_number_in_parse_error:nV - { invalid-token-in-uncertainty } - \l__siunitx_number_arg_tl - } - { - \tl_if_in:NnTF \l__siunitx_input_sign_tl {#1} - { - \__siunitx_number_in_parse_error:nV - { invalid-token-in-uncertainty } - \l__siunitx_number_arg_tl - } - { - \tl_if_in:NnTF \l__siunitx_input_symbol_tl {#1} - { - \prop_put:Nnn \l__siunitx_number_in_prop { symbolic } - { true } - \__siunitx_number_in_digit:n {#1} - } - { - \tl_if_in:NnF \l__siunitx_input_ignore_tl {#1} - { - \tl_if_in:NnTF \l__siunitx_input_uncert_close_tl - {#1} - { \__siunitx_number_in_uncert_close:N #1 } - { - \__siunitx_number_in_parse_error:nV - { invalid-token-in-uncertainty } - \l__siunitx_number_arg_tl - } - } - } - } - } - } -} -\cs_new_protected:Npn \__siunitx_number_in_parse_uncert_after:N #1 { - \tl_if_in:NnTF \l__siunitx_input_exponent_tl {#1} - { - \cs_set_eq:NN \__siunitx_number_in_parse_loop:N - \__siunitx_number_in_parse_mantissa:N - \__siunitx_number_in_exponent:N #1 - } - { - \tl_if_in:NnTF \l__siunitx_input_sign_tl {#1} - { - \cs_set_eq:NN \__siunitx_number_in_parse_loop:N - \__siunitx_number_in_parse_mantissa:N - \__siunitx_number_in_sign:N #1 - } - { - \tl_if_in:NnF \l__siunitx_input_ignore_tl {#1} - { - \tl_if_in:NnTF \l__siunitx_input_complex_tl {#1} - { - \cs_set_eq:NN \__siunitx_number_in_parse_loop:N - \__siunitx_number_in_parse_mantissa:N - \__siunitx_number_in_complex:N #1 - } - { - \__siunitx_number_in_parse_error:nV { invalid-number } - \l__siunitx_number_arg_tl - } - } - } - } -} -\cs_new_protected:Npn \__siunitx_number_in_complex:N #1 { - \bool_set_false:N \l__siunitx_number_in_first_bool - \bool_if:NTF \l__siunitx_number_in_complex_root_bool - { - \__siunitx_number_in_parse_error:nn - { duplicate-complex-root-token } { \token_to_str:N #1 } - } - { - \cs_set_eq:NN \__siunitx_number_in_check:n - \__siunitx_number_in_check_full:n - \bool_set_true:N \l__siunitx_number_in_complex_root_bool - \prop_put:Nnn \l__siunitx_number_in_prop { complex-root } {#1} - \tl_if_empty:NF \l__siunitx_number_parsed_tl - { - \cs_set_eq:NN \__siunitx_number_in_parse_loop:N - \__siunitx_number_in_parse_complex:N - } - \bool_if:NT \l__siunitx_number_in_decimal_bool - { - \bool_if:NF \l__siunitx_number_in_complex_bool - { - \prop_if_in:NnT \l__siunitx_number_in_prop - { mantissa-uncertainty } - { - \__siunitx_number_in_complex_aux:nn - { mantissa-decimal } { complex-decimal } - \__siunitx_number_in_complex_aux:nn - { mantissa-uncertainty } { complex-uncertainty } - } - \__siunitx_number_in_complex_aux:nn { mantissa-integer } - { complex-integer } - \__siunitx_number_in_complex_aux:nn - { mantissa-decimal-marker } { complex-decimal-marker } - \prop_remove:Nn \l__siunitx_number_in_prop { mantissa } - \prop_put:Nnn \l__siunitx_number_in_prop { complex } - { true } - } - } - \prop_if_in:NnF \l__siunitx_number_in_prop { mantissa } - { - \prop_if_in:NnT \l__siunitx_number_in_prop { mantissa-sign } - { - \__siunitx_number_in_complex_aux:nn { mantissa-sign } - { complex-sign } - } - } - \bool_set_true:N \l__siunitx_number_in_complex_bool - \bool_set_false:N \l__siunitx_number_in_first_bool - \__siunitx_number_in_init_part:n { complex } - \prop_if_in:NnT \l__siunitx_number_in_prop - { complex-decimal-marker } - { \bool_set_true:N \l__siunitx_number_in_decimal_bool } - \prop_if_in:NnTF \l__siunitx_number_in_prop - { complex-sign } - { \bool_set_true:N \l__siunitx_number_in_sign_bool } - { \prop_remove:Nn \l__siunitx_number_in_prop { mantissa } } - } -} -\cs_new_protected:Npn \__siunitx_number_in_complex_aux:nn #1#2 { - \prop_get:NnNT \l__siunitx_number_in_prop {#1} \l__siunitx_tmpa_tl - { - \prop_remove:Nn \l__siunitx_number_in_prop {#1} - \prop_put:NnV \l__siunitx_number_in_prop {#2} \l__siunitx_tmpa_tl - } -} -\cs_new_protected:Npn \__siunitx_number_in_decimal:N #1 { - \bool_set_false:N \l__siunitx_number_in_first_bool - \bool_if:NTF \l__siunitx_number_in_decimal_bool - { - \__siunitx_number_in_parse_error:nn { duplicate-decimal-token } - {#1} - } - { - \bool_set_true:N \l__siunitx_number_in_decimal_bool - \tl_if_empty:NF \l__siunitx_number_parsed_tl - { - \prop_put:NVn \l__siunitx_number_in_prop - \l__siunitx_number_part_tl { true } - \prop_put:NVV \l__siunitx_number_in_prop - \l__siunitx_number_part_integer_tl - \l__siunitx_number_parsed_tl - \tl_clear:N \l__siunitx_number_parsed_tl - } - \prop_put:NVn \l__siunitx_number_in_prop - \l__siunitx_number_part_decimal_marker_tl {#1} - } -} -\cs_new_protected:Npn \__siunitx_number_in_digit:n #1 { - \bool_set_false:N \l__siunitx_number_in_first_bool - \bool_if:NTF \l__siunitx_number_in_uncert_bool - { \tl_put_right:Nn \l__siunitx_number_parsed_tl {#1} } - { - \bool_if:NTF \l__siunitx_number_in_decimal_bool - { - \tl_put_right:Nn \l__siunitx_number_parsed_tl {#1} - \str_if_eq:nnF {#1} { 0 } - { \bool_set_true:N \l__siunitx_number_in_value_bool } - } - { - \str_if_eq:nnTF {#1} { 0 } - { - \prop_put:NVn \l__siunitx_number_in_prop - \l__siunitx_number_part_tl { true } - \prop_put:NVn \l__siunitx_number_in_prop - \l__siunitx_number_part_integer_tl { 0 } - } - { \bool_set_true:N \l__siunitx_number_in_value_bool } - \bool_if:NT \l__siunitx_number_in_value_bool - { \tl_put_right:Nn \l__siunitx_number_parsed_tl {#1} } - } - } -} -\cs_new_protected:Npn \__siunitx_number_in_exponent:N #1 { - \bool_if:NTF \l__siunitx_number_in_exponent_bool - { - \__siunitx_number_in_parse_error:nn { duplicate-exponent-token } - { \token_to_str:N #1 } - } - { - \cs_set_eq:NN \__siunitx_number_in_parse_more:N - \__siunitx_number_in_parse_exponent:N - \tl_if_empty:NF \l__siunitx_number_parsed_tl - { \__siunitx_number_in_store: } - \bool_set_true:N \l__siunitx_number_in_exponent_bool - \__siunitx_number_in_init_part:n { exponent } - } -} -\cs_new_protected:Npn \__siunitx_number_in_sign:N #1 { - \bool_if:NTF \l__siunitx_number_in_first_bool - { - \bool_set_false:N \l__siunitx_number_in_first_bool - \bool_set_true:N \l__siunitx_number_in_sign_bool - \prop_put:NVn \l__siunitx_number_in_prop - \l__siunitx_number_part_sign_tl {#1} - } - { - \bool_if:NTF \l__siunitx_number_in_exponent_bool - { - \__siunitx_number_in_parse_error:nn { misplaced-sign-token } - {#1} - } - { - \bool_if:NTF \l__siunitx_number_in_complex_bool - { - \__siunitx_number_in_parse_error:nn - { misplaced-sign-token } {#1} - } - { - \tl_if_empty:NF \l__siunitx_number_parsed_tl - { \__siunitx_number_in_store: } - \cs_set_eq:NN \__siunitx_number_in_check:n - \__siunitx_number_in_check_full:n - \__siunitx_number_in_init_part:n { complex } - \prop_put:Nnn \l__siunitx_number_in_prop - { complex-sign } {#1} - \bool_set_true:N \l__siunitx_number_in_complex_bool - } - } - } -} -\cs_new_protected:Npn \__siunitx_number_in_uncert_open:N #1 { - \bool_set_false:N \l__siunitx_number_in_first_bool - \cs_set_eq:NN \__siunitx_number_in_parse_loop:N - \__siunitx_number_in_parse_uncert:N - \bool_set_true:N \l__siunitx_number_in_uncert_bool - \tl_if_empty:NTF \l__siunitx_number_parsed_tl - { - \prop_if_in:NVF \l__siunitx_number_in_prop - \l__siunitx_number_part_integer_tl - { - \__siunitx_number_in_parse_error:nV { invalid-number } - \l__siunitx_number_arg_tl - } - } - { \__siunitx_number_in_store: } -} -\cs_new_protected:Npn \__siunitx_number_in_uncert_close:N #1 { - \bool_set_false:N \l__siunitx_number_in_uncert_bool - \tl_if_empty:NTF \l__siunitx_number_parsed_tl - { - \__siunitx_number_in_parse_error:nV { empty-uncertainty } - \l__siunitx_number_arg_tl - } - { - \prop_put:NVV \l__siunitx_number_in_prop - \l__siunitx_number_part_uncert_tl \l__siunitx_number_parsed_tl - \prop_put:Nnn \l__siunitx_number_in_prop - { uncertainty } { true } - \tl_clear:N \l__siunitx_number_parsed_tl - \cs_set_eq:NN \__siunitx_number_in_parse_loop:N - \__siunitx_number_in_parse_uncert_after:N - } -} -\cs_new_protected:Npn \__siunitx_number_in_store: { - \prop_put:NVn \l__siunitx_number_in_prop \l__siunitx_number_part_tl - { true } - \bool_if:NTF \l__siunitx_number_in_decimal_bool - { - \prop_put:NVV \l__siunitx_number_in_prop - \l__siunitx_number_part_decimal_tl \l__siunitx_number_parsed_tl - } - { - \prop_put:NVV \l__siunitx_number_in_prop - \l__siunitx_number_part_integer_tl \l__siunitx_number_parsed_tl - } - \tl_clear:N \l__siunitx_number_parsed_tl -} -\cs_new_protected:Npn \__siunitx_number_in_check:n #1 { } -\cs_new_protected:Npn \__siunitx_number_in_check_short:n #1 { - \prop_if_in:NVF \l__siunitx_number_in_prop - \l__siunitx_number_part_integer_tl - { - \prop_if_in:NVF \l__siunitx_number_in_prop - \l__siunitx_number_part_decimal_tl - { \__siunitx_error:nx { invalid-number } {#1} } - } - \bool_if:NF \l__siunitx_number_in_value_bool - { - \tl_if_eq:NNF \l__siunitx_number_part_tl - \c__siunitx_number_part_complex_tl - { - \prop_get:NVNT \l__siunitx_number_in_prop - \l__siunitx_number_part_sign_tl \l__siunitx_tmpa_tl - { - \tl_set:Nx \l__siunitx_tmpb_tl - { \l__siunitx_number_part_sign_tl -deleted } - \prop_put:NVV \l__siunitx_number_in_prop - \l__siunitx_tmpb_tl \l__siunitx_tmpa_tl - } - \prop_remove:NV \l__siunitx_number_in_prop - \l__siunitx_number_part_sign_tl - } - } -} -\cs_new_protected:Npn \__siunitx_number_in_check_full:n #1 { - \tl_if_eq:NNF \l__siunitx_number_part_tl - \c__siunitx_number_part_complex_tl - { \__siunitx_number_in_check_short:n {#1} } - \bool_if:NF \l__siunitx_number_in_complex_root_bool - { - \prop_get:NnN \l__siunitx_number_in_prop { complex-sign } - \l__siunitx_tmpa_tl - \tl_if_in:NVTF \l__siunitx_input_uncert_sign_tl \l__siunitx_tmpa_tl - { - \prop_if_in:NnTF \l__siunitx_number_in_prop { uncertainty } - { - \__siunitx_error:nx { misplaced-sign-token } - { \exp_not:n {#1} } - } - { \__siunitx_number_in_complex_to_uncert:n {#1} } - } - { - \__siunitx_error:nx { misplaced-sign-token } - { \exp_not:n {#1} } - } - } - \prop_get:NnNT \l__siunitx_number_in_prop { mantissa-sign } - \l__siunitx_tmpa_tl - { - \prop_if_in:NnF \l__siunitx_number_in_prop { mantissa } - { - \prop_remove:Nn \l__siunitx_number_in_prop { mantissa-sign } - \prop_put:NnV \l__siunitx_number_in_prop { complex-sign } - \l__siunitx_tmpa_tl - } - } -} -\cs_new_protected:Npn \__siunitx_number_in_complex_to_uncert:n #1 { - \prop_remove:Nn \l__siunitx_number_in_prop { complex } - \prop_remove:Nn \l__siunitx_number_in_prop { complex-decimal-marker } - \prop_remove:Nn \l__siunitx_number_in_prop { complex-sign } - \prop_put:Nnn \l__siunitx_number_in_prop { uncertainty } { true } - \prop_get:NnNTF \l__siunitx_number_in_prop { complex-integer } - \l__siunitx_number_uncert_tl - { - \tl_if_single:NTF \l__siunitx_number_uncert_tl - { - \int_compare:nNnTF \l__siunitx_number_uncert_tl = 0 - { \__siunitx_number_in_complex_to_uncert_dec:n {#1} } - { \__siunitx_number_in_complex_to_uncert_int: } - } - { \__siunitx_number_in_complex_to_uncert_int: } - } - { \__siunitx_number_in_complex_to_uncert_dec:n {#1} } - \prop_remove:Nn \l__siunitx_number_in_prop { complex-integer } - \prop_remove:Nn \l__siunitx_number_in_prop { complex-decimal } -} -\cs_new_protected:Npn \__siunitx_number_in_complex_to_uncert_int: { - \prop_get:NnNF \l__siunitx_number_in_prop { complex-decimal } - \l__siunitx_tmpa_tl - { \tl_clear:N \l__siunitx_tmpa_tl } - \prop_get:NnNF \l__siunitx_number_in_prop { mantissa-decimal } - \l__siunitx_tmpb_tl - { \tl_clear:N \l__siunitx_tmpb_tl } - \__siunitx_number_in_complex_to_uncert_pad: -} -\cs_new_protected:Npn \__siunitx_number_in_complex_to_uncert_dec:n - #1 - { - \tl_clear:N \l__siunitx_number_uncert_tl - \prop_get:NnNTF \l__siunitx_number_in_prop { complex-decimal } - \l__siunitx_tmpa_tl - { - \prop_get:NnN \l__siunitx_number_in_prop { mantissa-decimal } - \l__siunitx_tmpb_tl - \quark_if_no_value:NT \l__siunitx_tmpb_tl - { \tl_clear:N \l__siunitx_tmpb_tl } - \tl_map_function:NN - \l__siunitx_tmpa_tl - \__siunitx_number_in_complex_to_uncert_dec_loop:N - \__siunitx_number_in_complex_to_uncert_pad: - } - { \__siunitx_error:nx { misplaced-sign-token } { \exp_not:n {#1} } } - } -\cs_new_protected:Npn - \__siunitx_number_in_complex_to_uncert_dec_loop:N #1 - { - \str_if_eq:nnTF {#1} { 0 } - { - \tl_set:Nx \l__siunitx_tmpa_tl - { \tl_tail:N \l__siunitx_tmpa_tl } - \tl_if_empty:NF \l__siunitx_tmpb_tl - { - \tl_set:Nx \l__siunitx_tmpb_tl - { \tl_tail:N \l__siunitx_tmpb_tl } - } - } - { \tl_map_break: } - } -\cs_new_protected:Npn \__siunitx_number_in_complex_to_uncert_pad: - { - \int_set:Nn \l__siunitx_number_uncert_length_int - { \tl_count:N \l__siunitx_tmpa_tl } - \int_set:Nn \l__siunitx_number_mantissa_length_int - { \tl_count:N \l__siunitx_tmpb_tl } - \int_compare:nNnTF - { \l__siunitx_number_mantissa_length_int } - > { \l__siunitx_number_uncert_length_int } - { - \tl_set:Nx \l__siunitx_tmpa_tl - { - \exp_not:V \l__siunitx_tmpa_tl - \prg_replicate:nn - { - \l__siunitx_number_mantissa_length_int - - \l__siunitx_number_uncert_length_int - } - { 0 } - } - } - { - \prop_get:NnNF \l__siunitx_number_in_prop { mantissa-decimal } - \l__siunitx_tmpb_tl - { \tl_clear:N \l__siunitx_tmpb_tl } - \tl_set:Nx \l__siunitx_tmpb_tl - { - \exp_not:V \l__siunitx_tmpb_tl - \prg_replicate:nn - { - \l__siunitx_number_uncert_length_int - - \l__siunitx_number_mantissa_length_int - } - { 0 } - } - \tl_if_empty:NF \l__siunitx_tmpb_tl - { - \prop_put:NnV \l__siunitx_number_in_prop { mantissa-decimal } - \l__siunitx_tmpb_tl - \prop_if_in:NnF \l__siunitx_number_in_prop - { mantissa-decimal-marker } - { - \prop_put:Nnn \l__siunitx_number_in_prop - { mantissa-decimal-marker } { . } - } - } - } - \tl_put_right:NV \l__siunitx_number_uncert_tl \l__siunitx_tmpa_tl - \prop_put:NnV \l__siunitx_number_in_prop { mantissa-uncertainty } - \l__siunitx_number_uncert_tl - } -\int_new:N \l__siunitx_round_int -\tl_new:N \l__siunitx_round_tl -\bool_new:N \l__siunitx_round_bool -\tl_new:N \l__siunitx_round_decimal_in_tl -\tl_new:N \l__siunitx_round_decimal_out_tl -\tl_new:N \l__siunitx_round_discard_tl -\tl_new:N \l__siunitx_round_even_bool -\tl_new:N \l__siunitx_round_integer_in_tl -\tl_new:N \l__siunitx_round_integer_out_tl -\bool_new:N \l__siunitx_round_half_up_bool -\int_new:N \l__siunitx_process_decimal_int -\int_new:N \l__siunitx_process_uncertainty_int -\tl_new:N \l__siunitx_uncertainty_decimal_tl -\tl_new:N \l__siunitx_uncertainty_integer_tl -\bool_new:N \l__siunitx_process_fixed_bool -\bool_new:N \l__siunitx_process_engineering_bool -\bool_new:N \l__siunitx_process_scientific_bool -\bool_new:N \l__siunitx_process_drop_exponent_bool -\keys_define:nn { siunitx } - { - add-decimal-zero .bool_set:N = \l__siunitx_process_decimal_zero_bool, - add-integer-zero .bool_set:N = \l__siunitx_process_integer_zero_bool, - explicit-sign .tl_set:N = \l__siunitx_process_sign_tl, - fixed-exponent .int_set:N = \l__siunitx_process_fixed_int, - minimum-integer-digits .int_set:N = - \l__siunitx_process_integer_min_int, - retain-explicit-plus .bool_set:N = \l__siunitx_process_plus_bool, - omit-uncertainty .bool_set:N = \l__siunitx_omit_uncert_bool, - retain-unity-mantissa .bool_set:N = - \l__siunitx_process_unity_mantissa_bool, - retain-zero-exponent .bool_set:N = - \l__siunitx_process_zero_exponent_bool, - round-half .choice:, - round-half / even .code:n = - { \bool_set_false:N \l__siunitx_round_half_up_bool }, - round-half / up .code:n = - { \bool_set_true:N \l__siunitx_round_half_up_bool }, - round-integer-to-decimal .bool_set:N = - \l__siunitx_process_int_to_dec_bool, - round-minimum .tl_set:N = \l__siunitx_process_round_min_tl, - round-mode .choice: , - round-mode / figures .code:n = - { \tl_set:Nn \l__siunitx_round_tl { figures } }, - round-mode / off .code:n = { \tl_clear:N \l__siunitx_round_tl }, - round-mode / places .code:n = - { \tl_set:Nn \l__siunitx_round_tl { places } }, - round-precision .int_set:N = \l__siunitx_process_precision_int, - scientific-notation .choice: , - scientific-notation - / false .code:n = - { - \bool_set_false:N \l__siunitx_process_fixed_bool - \bool_set_false:N \l__siunitx_process_engineering_bool - \bool_set_false:N \l__siunitx_process_scientific_bool - }, - scientific-notation - / engineering .code:n = - { - \bool_set_false:N \l__siunitx_process_fixed_bool - \bool_set_true:N \l__siunitx_process_engineering_bool - \bool_set_true:N \l__siunitx_process_scientific_bool - }, - scientific-notation - / fixed .code:n = - { - \bool_set_true:N \l__siunitx_process_fixed_bool - \bool_set_false:N \l__siunitx_process_engineering_bool - \bool_set_false:N \l__siunitx_process_scientific_bool - }, - scientific-notation - / true .code:n = - { - \bool_set_false:N \l__siunitx_process_fixed_bool - \bool_set_false:N \l__siunitx_process_engineering_bool - \bool_set_true:N \l__siunitx_process_scientific_bool - }, - zero-decimal-to-integer .bool_set:N = - \l__siunitx_zero_decimal_to_integer_bool - } -\keys_set:nn { siunitx } - { - add-decimal-zero = true, - add-integer-zero = true, - retain-unity-mantissa = true, - round-half = up, - round-minimum = 0, - round-precision = 2 - } -\cs_new_protected:Npn \__siunitx_number_process: - { - \__siunitx_number_process_sign: - \__siunitx_number_process_zero_fill: - \__siunitx_number_process_mantissa: - \prop_if_in:NnF \l__siunitx_number_in_prop { symbolic } - { - \bool_if:NTF \l__siunitx_process_fixed_bool - { \__siunitx_number_process_fixed: } - { - \bool_if:NT \l__siunitx_process_scientific_bool - { \__siunitx_number_process_scientific: } - } - \__siunitx_number_process_exponent: - \__siunitx_number_process_uncertainty: - \bool_if:NT \l__siunitx_exp_to_prefix_bool - { - \tl_if_empty:NF \l__siunitx_unit_tl - { \__siunitx_number_exp_to_prefix: } - } - \prop_if_in:NnTF \l__siunitx_number_in_prop { uncertainty } - { - \bool_if:NT \l__siunitx_omit_uncert_bool - { - \prop_remove:Nn \l__siunitx_number_in_prop { uncertainty } - \prop_remove:Nn \l__siunitx_number_in_prop { mantissa-uncertainty } - } - } - { \__siunitx_number_process_round: } - } - \__siunitx_number_process_zero_to_integer: - \__siunitx_number_process_integer_digits: - \bool_if:NT \l__siunitx_process_drop_exponent_bool - { - \prop_remove:Nn \l__siunitx_number_in_prop { exponent } - \prop_remove:Nn \l__siunitx_number_in_prop { exponent-integer } - } - } -\cs_new_protected:Npn \__siunitx_number_process_exponent: { - \bool_if:NF \l__siunitx_process_zero_exponent_bool - { - \prop_if_in:NnT \l__siunitx_number_in_prop { exponent } - { - \bool_set_false:N \l__siunitx_tmp_bool - \__siunitx_number_process_exponent_aux:n { integer } - \bool_if:NF \l__siunitx_tmp_bool - { \__siunitx_number_process_exponent_aux:n { decimal } } - \bool_if:NF \l__siunitx_tmp_bool - { - \prop_remove:Nn \l__siunitx_number_in_prop { exponent } - \prop_remove:Nn \l__siunitx_number_in_prop - { exponent-integer } - \prop_remove:Nn \l__siunitx_number_in_prop - { exponent-decimal } - \prop_if_in:NnF \l__siunitx_number_in_prop { mantissa } - { - \prop_put:Nnn \l__siunitx_number_in_prop { mantissa } { true } - \prop_put:Nnn \l__siunitx_number_in_prop { mantissa-integer } { 1 } - } - } - } - } -} -\cs_new_protected:Npn \__siunitx_number_process_exponent_aux:n #1 { - \prop_get:NnNT \l__siunitx_number_in_prop { exponent- #1 } - \l__siunitx_tmpa_tl - { - \int_compare:nNnF { \l__siunitx_tmpa_tl } = { 0 } - { \bool_set_true:N \l__siunitx_tmp_bool } - } -} -\cs_new_protected:Npn \__siunitx_number_process_figures:n #1 - { - \int_compare:nNnTF \l__siunitx_process_precision_int > 0 - { - \prop_if_in:NnT \l__siunitx_number_in_prop {#1} - { \__siunitx_number_process_figures_aux:n {#1} } - } - { - \prop_remove:Nn \l__siunitx_number_in_prop { #1 -sign } - \prop_put:Nnn \l__siunitx_number_in_prop { #1 -integer } { 0 } - \prop_remove:Nn \l__siunitx_number_in_prop { #1 -decimal } - \bool_if:NF \l__siunitx_process_int_to_dec_bool - { \prop_remove:Nn \l__siunitx_number_in_prop { #1 -decimal-marker } } - } - } -\cs_new_protected:Npn \__siunitx_number_process_figures_aux:n #1 - { - \__siunitx_number_process_figures_init:n {#1} - \__siunitx_number_process_figures_count:n { integer } - \__siunitx_number_process_figures_count:n { decimal } - \bool_if:NTF \l__siunitx_round_bool - { - \bool_set_false:N \l__siunitx_round_bool - \int_compare:nNnTF - \l__siunitx_round_int > \l__siunitx_process_precision_int - { - \__siunitx_number_process_figures_round: - \__siunitx_number_process_round_tidy:n {#1} - } - { \__siunitx_number_process_figures_pad:n {#1} } - } - { - \prop_put:Nnn \l__siunitx_number_in_prop { #1 -integer } { 0 } - \prop_remove:Nn \l__siunitx_number_in_prop { #1 -decimal } - } - } -\cs_new_protected:Npn \__siunitx_number_process_figures_init:n #1 - { - \int_zero:N \l__siunitx_round_int - \bool_set_false:N \l__siunitx_round_bool - \bool_set_false:N \l__siunitx_round_even_bool - \prop_get:NnNF \l__siunitx_number_in_prop { #1 -decimal } - \l__siunitx_round_decimal_in_tl - { \tl_clear:N \l__siunitx_round_decimal_in_tl } - \prop_get:NnNF \l__siunitx_number_in_prop { #1 -integer } - \l__siunitx_round_integer_in_tl - { \tl_clear:N \l__siunitx_round_integer_in_tl } - \tl_clear:N \l__siunitx_round_decimal_out_tl - \tl_clear:N \l__siunitx_round_integer_out_tl - \tl_clear:N \l__siunitx_round_discard_tl - } -\cs_new_protected:Npn \__siunitx_number_process_figures_count:n #1 - { - \tl_if_empty:cF { l__siunitx_round_ #1 _in_tl } - { - \prop_if_in:NnF \l__siunitx_number_in_prop { #1 -uncertainty } - { \__siunitx_number_process_figures_count_aux:n {#1} } - } - } -\cs_new_protected:Npn \__siunitx_number_process_figures_count_aux:n #1 - { - \int_set:Nn \l__siunitx_tmp_int - { \tl_head:v { l__siunitx_round_ #1 _in_tl } } - \tl_set:cx { l__siunitx_round_ #1 _in_tl } - { \tl_tail:v { l__siunitx_round_ #1 _in_tl } } - \tl_put_left:cV { l__siunitx_round_ #1 _out_tl } \l__siunitx_tmp_int - \bool_if:NF \l__siunitx_round_bool - { - \int_compare:nNnF \l__siunitx_tmp_int = 0 - { \bool_set_true:N \l__siunitx_round_bool } - } - \bool_if:NT \l__siunitx_round_bool - { \int_incr:N \l__siunitx_round_int } - \tl_if_empty:cTF { l__siunitx_round_ #1 _in_tl } - { - \tl_set_eq:cc { l__siunitx_round_ #1 _in_tl } - { l__siunitx_round_ #1 _out_tl } - \tl_clear:c { l__siunitx_round_ #1 _out_tl } - } - { \__siunitx_number_process_figures_count_aux:n {#1} } - } -\cs_new_protected:Npn \__siunitx_number_process_figures_round: - { - \int_set:Nn \l__siunitx_round_int - { \l__siunitx_round_int - \l__siunitx_process_precision_int } - \tl_if_empty:NF \l__siunitx_round_decimal_in_tl - { \__siunitx_number_process_figures_round_loop: } - \tl_if_empty:NF \l__siunitx_round_integer_in_tl - { \__siunitx_number_process_figures_integer: } - \bool_if:NT \l__siunitx_round_bool - { \tl_put_left:Nn \l__siunitx_round_integer_out_tl { 1 } } - } -\cs_new_protected:Npn \__siunitx_number_process_figures_round_loop: - { - \__siunitx_number_process_round_decimal: - \tl_if_empty:NF \l__siunitx_round_decimal_in_tl - { \__siunitx_number_process_figures_round_loop: } - } -\cs_new_protected:Npn \__siunitx_number_process_figures_integer: - { - \int_compare:nNnT \l__siunitx_round_int > 0 - { \tl_put_left:Nn \l__siunitx_round_integer_out_tl { 0 } } - \int_compare:nNnF \l__siunitx_round_int > 1 - { - \int_set:Nn \l__siunitx_tmp_int - { \tl_head:N \l__siunitx_round_integer_in_tl } - \__siunitx_number_process_round_up: - \int_compare:nNnTF \l__siunitx_round_int = 1 - { - \int_compare:nNnT \l__siunitx_tmp_int > 4 - { \bool_set_true:N \l__siunitx_round_bool } - } - { - \int_compare:nNnT \l__siunitx_tmp_int = { 10 } - { - \bool_set_true:N \l__siunitx_round_bool - \int_zero:N \l__siunitx_tmp_int - } - \tl_put_left:NV \l__siunitx_round_integer_out_tl - \l__siunitx_tmp_int - } - } - \int_decr:N \l__siunitx_round_int - \tl_set:Nx \l__siunitx_round_integer_in_tl - { \tl_tail:N \l__siunitx_round_integer_in_tl } - \tl_if_empty:NF \l__siunitx_round_integer_in_tl - { \__siunitx_number_process_figures_integer: } - } -\cs_new_protected:Npn \__siunitx_number_process_figures_pad:n #1 { - \prop_get:NnN \l__siunitx_number_in_prop { #1 -integer } - \l__siunitx_round_integer_in_tl - \prop_get:NnN \l__siunitx_number_in_prop { #1 -decimal } - \l__siunitx_round_decimal_in_tl - \int_set:Nn \l__siunitx_round_int - { \l__siunitx_process_precision_int - \l__siunitx_round_int } - \__siunitx_number_process_pad:n {#1} -} -\cs_new_protected:Npn \__siunitx_number_process_fixed: { - \prop_if_in:NnF \l__siunitx_number_in_prop { complex } - { - \prop_get:NnNF \l__siunitx_number_in_prop { mantissa-integer } - \l__siunitx_tmpa_tl - { \tl_set:Nn \l__siunitx_tmpa_tl { 0 } } - \prop_get:NnNF \l__siunitx_number_in_prop { mantissa-decimal } - \l__siunitx_tmpb_tl - { \tl_clear:N \l__siunitx_tmpb_tl } - \tl_set:Nx \l__siunitx_tmpa_tl - { { \l__siunitx_tmpa_tl } { \l__siunitx_tmpb_tl } } - \prop_get:NnNF \l__siunitx_number_in_prop { exponent-integer } - \l__siunitx_tmpb_tl - { \tl_set:Nn \l__siunitx_tmpb_tl { 0 } } - \group_begin: - \prop_get:NnNT \l__siunitx_number_in_prop { exponent-sign } - \l__siunitx_tmpa_tl - { - \tl_put_left:NV \l__siunitx_tmpb_tl \l__siunitx_tmpa_tl - } - \exp_args:NNNV \group_end: - \tl_set:Nn \l__siunitx_tmpb_tl \l__siunitx_tmpb_tl - \tl_set:Nx \l__siunitx_tmpa_tl - { \l__siunitx_tmpa_tl { \l__siunitx_tmpb_tl } } - \exp_after:wN \__siunitx_number_process_fixed_aux_i:nnn - \l__siunitx_tmpa_tl - } -} -\cs_new_protected:Npn \__siunitx_number_process_fixed_aux_i:nnn #1#2#3 - { - \prop_put:Nnn \l__siunitx_number_in_prop { exponent } { true } - \int_compare:nNnTF \l__siunitx_process_fixed_int > 0 - { - \prop_put:NnV \l__siunitx_number_in_prop { exponent-integer } - \l__siunitx_process_fixed_int - \prop_remove:Nn \l__siunitx_number_in_prop { exponent-sign } - } - { - \prop_put:Nnx \l__siunitx_number_in_prop { exponent-integer } - { \int_eval:n { - \l__siunitx_process_fixed_int } } - \prop_put:Nnn \l__siunitx_number_in_prop { exponent-sign } { - } - } - \__siunitx_number_process_fixed_aux_ii:nnn {#1} {#2} {#3} - } -\cs_new_protected:Npn \__siunitx_number_process_fixed_aux_ii:nnn #1#2#3 - { - \bool_set_true:N \l__siunitx_tmp_bool - \tl_map_inline:nn {#1#2} - { - \str_if_eq:nnF {##1} { 0 } - { - \bool_set_false:N \l__siunitx_tmp_bool - \tl_map_break: - } - } - \bool_if:NF \l__siunitx_tmp_bool - { \__siunitx_number_process_fixed_aux_iii:nnn {#1} {#2} {#3} } - } -\cs_new_protected:Npn - \__siunitx_number_process_fixed_aux_iii:nnn #1#2#3 { - \int_compare:nNnTF {#3} > { \l__siunitx_process_fixed_int } - { \__siunitx_number_process_fixed_large:nnn {#1} {#2} {#3} } - { - \int_compare:nNnTF {#3} < { \l__siunitx_process_fixed_int } - { \__siunitx_number_process_fixed_small:nnn {#1} {#2} {#3} } - { - \prop_put:Nnn \l__siunitx_number_in_prop - { mantissa-integer } {#1} - \tl_if_empty:nTF {#2} - { - \prop_remove:Nn \l__siunitx_number_in_prop - { mantissa-decimal } - \prop_remove:Nn \l__siunitx_number_in_prop - { mantissa-decimal-marker } - } - { - \prop_put:Nnn \l__siunitx_number_in_prop - { mantissa-decimal } {#2} - \prop_if_in:NnF \l__siunitx_number_in_prop - { mantissa-decimal-marker } - { - \prop_put:Nnn \l__siunitx_number_in_prop - { mantissa-decimal-marker } { . } - } - } - } - } -} -\cs_new_protected:Npn \__siunitx_number_process_fixed_large:nnn #1 - { - \__siunitx_number_if_zero:nTF {#1} - { \__siunitx_number_process_fixed_large_aux:nnn { } } - { \__siunitx_number_process_fixed_large_aux:nnn {#1} } - } -\cs_new_protected:Npn \__siunitx_number_process_fixed_large_aux:nnn #1#2#3 - { - \cs_set_protected:Npn - \__siunitx_number_process_fixed_large_aux:w ##1##2 \q_stop - { - \tl_if_empty:nTF {##2} - { - \int_compare:nNnTF - { #3 - 1 } = { \l__siunitx_process_fixed_int } - { - \__siunitx_number_process_fixed_aux_ii:nnn { #1 ##1 } - { } { #3 - 1 } - } - { - \__siunitx_number_process_fixed_aux_ii:nnn { #1 ##1 } - { 0 } { #3 - 1 } - } - } - { - \__siunitx_number_if_zero:nTF {#1} - { - \__siunitx_number_process_fixed_aux_ii:nnn {##1} {##2} - { #3 - 1 } - } - { - \__siunitx_number_process_fixed_aux_ii:nnn { #1 ##1 } - {##2} { #3 - 1 } - } - } - } - \tl_if_empty:nTF {#2} - { \__siunitx_number_process_fixed_aux_ii:nnn { #1 0 } { } { #3 - 1 } } - { \__siunitx_number_process_fixed_large_aux:w #2 \q_stop } -} -\cs_new_protected:Npn \__siunitx_number_process_fixed_large_aux:w - { } -\cs_new_protected:Npn - \__siunitx_number_process_fixed_small:nnn #1#2#3 { - \cs_set_protected:Npn - \__siunitx_number_process_fixed_small_aux:w ##1##2 \q_stop ##3 - { - \tl_if_empty:nTF {##2} - { - \tl_if_empty:nTF {##3} - { - \__siunitx_number_process_fixed_aux_ii:nnn { 0 } - { ##1 #2 } { #3 + 1 } - } - { - \__siunitx_number_process_fixed_aux_ii:nnn {##3} - { ##1 #2 } { #3 + 1 } - } - } - { - \__siunitx_number_process_fixed_small_aux:w ##2 \q_stop - { ##3 ##1 } - } - } - \__siunitx_number_process_fixed_small_aux:w #1 \q_stop { } -} -\cs_new_protected:Npn \__siunitx_number_process_fixed_small_aux:w - { } -\cs_new_protected:Npn \__siunitx_number_process_integer_digits: { - \int_compare:nNnT \l__siunitx_process_integer_min_int > 0 - { - \prop_get:NnNT \l__siunitx_number_in_prop { mantissa-integer } - \l__siunitx_tmpa_tl - { - \int_set:Nn \l__siunitx_tmp_int - { - \l__siunitx_process_integer_min_int - - \tl_count:N \l__siunitx_tmpa_tl - } - \int_compare:nNnT \l__siunitx_tmp_int > 0 - { - \tl_set:Nx \l__siunitx_tmpa_tl - { - \prg_replicate:nn { \l__siunitx_tmp_int } { 0 } - \exp_not:V \l__siunitx_tmpa_tl - } - \prop_put:NnV \l__siunitx_number_in_prop - { mantissa-integer } \l__siunitx_tmpa_tl - } - } - } -} -\cs_new_protected:Npn \__siunitx_number_process_mantissa: { - \bool_if:NF \l__siunitx_process_unity_mantissa_bool - { - \prop_if_in:NnT \l__siunitx_number_in_prop { exponent } - { - \prop_get:NnNT \l__siunitx_number_in_prop { mantissa-integer } - \l__siunitx_tmpa_tl - { - \tl_if_eq:NNT \c__siunitx_unity_tl \l__siunitx_tmpa_tl - { - \prop_if_in:NnF \l__siunitx_number_in_prop - { mantissa-decimal-marker } - { - \prop_remove:Nn \l__siunitx_number_in_prop - { mantissa } - \prop_remove:Nn \l__siunitx_number_in_prop - { mantissa-integer } - } - } - } - } - } -} -\tl_new:N \c__siunitx_unity_tl -\tl_set:Nn \c__siunitx_unity_tl { 1 } -\cs_new_protected:Npn \__siunitx_number_process_pad:n #1 { - \prop_get:NnNT \l__siunitx_number_in_prop { #1 -decimal } - \l__siunitx_tmpa_tl - { - \int_while_do:nNnn { \l__siunitx_round_int } > { 0 } - { - \tl_put_right:Nn \l__siunitx_tmpa_tl { 0 } - \int_decr:N \l__siunitx_round_int - } - \prop_put:NnV \l__siunitx_number_in_prop { #1 -decimal } - \l__siunitx_tmpa_tl - } -} -\cs_new_protected:Npn \__siunitx_number_process_places:n #1 - { - \prop_if_in:NnT \l__siunitx_number_in_prop {#1} - { - \prop_if_in:NnF \l__siunitx_number_in_prop { #1 -uncertainty } - { \__siunitx_number_process_places_aux_i:n {#1} } - } - } -\cs_new_protected:Npn \__siunitx_number_process_places_aux_i:n #1 - { - \int_compare:nNnTF \l__siunitx_process_precision_int = 0 - { \__siunitx_number_process_places_none:n {#1} } - { - \prop_get:NnNT \l__siunitx_number_in_prop { #1 -decimal } - \l__siunitx_tmpa_tl - { - \tl_if_empty:NT \l__siunitx_tmpa_tl - { \tl_set:Nn \l__siunitx_tmpa_tl { 0 } } - \__siunitx_number_process_places_aux_i:TF - { - \prop_put:Nnn \l__siunitx_number_in_prop { #1 -decimal } { } - \int_set:Nn \l__siunitx_round_int - { \l__siunitx_process_precision_int } - \__siunitx_number_process_pad:n {#1} - } - { - \int_set:Nn \l__siunitx_round_int - { \tl_count:N \l__siunitx_tmpa_tl } - \__siunitx_number_process_places_aux_ii:n {#1} - } - } - } - } -\cs_new_protected:Npn \__siunitx_number_process_places_aux_i:TF - { - \bool_set_true:N \l__siunitx_tmp_bool - \tl_map_inline:Nn \l__siunitx_tmpa_tl - { - \int_compare:nNnF {##1} = 0 - { - \bool_set_false:N \l__siunitx_tmp_bool - \tl_map_break: - } - } - \bool_if:NTF \l__siunitx_tmp_bool - } -\cs_new_protected:Npn \__siunitx_number_process_places_none:n #1 - { - \prop_get:NnNT \l__siunitx_number_in_prop { #1 -decimal } \l__siunitx_tmpa_tl - { - \int_compare:nNnTF { \tl_head:N \l__siunitx_tmpa_tl } > 4 - { - \prop_get:NnNTF \l__siunitx_number_in_prop { #1 -integer } - \l__siunitx_tmpb_tl - { - \tl_set:Nx \l__siunitx_tmpb_tl - { \int_eval:n { \l__siunitx_tmpb_tl + 1 } } - \bool_if:NF \l__siunitx_round_half_up_bool - { - \int_compare:nNnT - { 0 \tl_tail:N \l__siunitx_tmpa_tl } = 0 - { - \int_if_odd:nT \l__siunitx_tmpb_tl - { - \tl_set:Nx \l__siunitx_tmpb_tl - { \int_eval:n { \l__siunitx_tmpb_tl - 1 } } - } - } - } - } - { \tl_set:Nn \l__siunitx_tmpb_tl { 1 } } - \prop_put:NnV \l__siunitx_number_in_prop - { #1 -integer } \l__siunitx_tmpb_tl - } - { - \prop_if_in:NnF \l__siunitx_number_in_prop { #1 -integer } - { - \prop_put:Nnn \l__siunitx_number_in_prop - { #1 -integer } { 0 } - } - } - } - \prop_remove:Nn \l__siunitx_number_in_prop { #1 -decimal } - \bool_if:NF \l__siunitx_process_int_to_dec_bool - { \prop_remove:Nn \l__siunitx_number_in_prop { #1 -decimal-marker } } - } -\cs_new_protected:Npn \__siunitx_number_process_places_aux_ii:n #1 - { - \int_sub:Nn \l__siunitx_round_int - { \l__siunitx_process_precision_int } - \int_compare:nNnTF \l__siunitx_round_int < 0 - { - \int_set:Nn \l__siunitx_round_int { - \l__siunitx_round_int } - \__siunitx_number_process_pad:n {#1} - } - { - \__siunitx_number_process_places_init:n {#1} - \__siunitx_number_process_places_loop:n {#1} - \__siunitx_number_process_round_tidy:n {#1} - } - } -\cs_new_protected:Npn \__siunitx_number_process_places_init:n #1 - { - \prop_get:NnNF \l__siunitx_number_in_prop { #1 -integer } - \l__siunitx_round_integer_in_tl - { \tl_clear:N \l__siunitx_round_integer_in_tl } - \prop_get:NnN \l__siunitx_number_in_prop { #1 -decimal } - \l__siunitx_round_decimal_in_tl - \tl_reverse:N \l__siunitx_round_integer_in_tl - \tl_reverse:N \l__siunitx_round_decimal_in_tl - \tl_clear:N \l__siunitx_round_integer_out_tl - \tl_clear:N \l__siunitx_round_decimal_out_tl - \tl_clear:N \l__siunitx_round_discard_tl - \bool_set_false:N \l__siunitx_round_bool - \bool_set_false:N \l__siunitx_round_even_bool - } -\cs_new_protected:Npn \__siunitx_number_process_places_loop:n #1 - { - \tl_if_empty:NTF \l__siunitx_round_decimal_in_tl - { - \tl_if_empty:NF \l__siunitx_round_integer_in_tl - { - \__siunitx_number_process_places_integer:n {#1} - \__siunitx_number_process_places_loop:n {#1} - } - \bool_if:NT \l__siunitx_round_bool - { - \tl_put_left:Nn \l__siunitx_round_integer_out_tl { 1 } - \bool_set_false:N \l__siunitx_round_bool - } - } - { - \__siunitx_number_process_round_decimal: - \__siunitx_number_process_places_loop:n {#1} - } - } -\cs_new_protected:Npn \__siunitx_number_process_places_integer:n #1 - { - \int_set:Nn \l__siunitx_tmp_int - { \tl_head:N \l__siunitx_round_integer_in_tl } - \tl_set:Nx \l__siunitx_round_integer_in_tl - { \tl_tail:N \l__siunitx_round_integer_in_tl } - \__siunitx_number_process_round_up: - \bool_set_false:N \l__siunitx_round_bool - \int_compare:nNnT \l__siunitx_tmp_int = { 10 } - { - \int_zero:N \l__siunitx_tmp_int - \bool_set_true:N \l__siunitx_round_bool - } - \tl_put_left:NV \l__siunitx_round_integer_out_tl \l__siunitx_tmp_int - } -\cs_new_protected:Npn \__siunitx_number_process_round: - { - \tl_if_empty:NF \l__siunitx_round_tl - { - \bool_if:NT \l__siunitx_process_int_to_dec_bool - { - \prop_if_in:NnF \l__siunitx_number_in_prop { mantissa-decimal } - { - \prop_put:Nnn \l__siunitx_number_in_prop { mantissa-decimal } - { 0 } - } - \prop_if_in:NnF \l__siunitx_number_in_prop - { mantissa-decimal-marker } - { - \prop_put:Nnn \l__siunitx_number_in_prop - { mantissa-decimal-marker } { . } - } - } - \clist_map_function:nc { mantissa , complex } - { __siunitx_number_process_ \l__siunitx_round_tl :n } - } - } -\cs_new_protected:Npn \__siunitx_number_process_round_decimal: - { - \int_compare:nNnF \l__siunitx_round_int > 1 - { \__siunitx_number_process_round_decimal_aux: } - \tl_put_right:Nx \l__siunitx_round_discard_tl - { \tl_head:N \l__siunitx_round_decimal_in_tl } - \tl_set:Nx \l__siunitx_round_decimal_in_tl - { \tl_tail:N \l__siunitx_round_decimal_in_tl } - \int_decr:N \l__siunitx_round_int - } -\cs_new_protected:Npn \__siunitx_number_process_round_decimal_aux: - { - \int_set:Nn \l__siunitx_tmp_int - { \tl_head:N \l__siunitx_round_decimal_in_tl } - \__siunitx_number_process_round_up: - \int_compare:nNnTF \l__siunitx_round_int = 1 - { - \int_compare:nNnT \l__siunitx_tmp_int > 4 - { - \bool_set_true:N \l__siunitx_round_bool - \bool_if:NF \l__siunitx_round_half_up_bool - { - \int_compare:nNnT - { \l__siunitx_round_discard_tl \int_use:N \l__siunitx_tmp_int } = 5 - { \bool_set_true:N \l__siunitx_round_even_bool } - } - } - } - { - \int_compare:nNnT \l__siunitx_tmp_int = { 10 } - { - \bool_set_true:N \l__siunitx_round_bool - \int_zero:N \l__siunitx_tmp_int - } - \tl_put_left:NV \l__siunitx_round_decimal_out_tl - \l__siunitx_tmp_int - } - } -\cs_new_protected:Npn \__siunitx_number_process_round_up: - { - \bool_if:NT \l__siunitx_round_bool - { - \bool_if:NTF \l__siunitx_round_even_bool - { - \bool_set_false:N \l__siunitx_round_even_bool - \int_if_even:nF \l__siunitx_tmp_int - { \int_incr:N \l__siunitx_tmp_int } - } - { \int_incr:N \l__siunitx_tmp_int } - } - \bool_set_false:N \l__siunitx_round_bool - } -\cs_new_protected:Npn \__siunitx_number_process_round_tidy:n #1 - { - \bool_lazy_and:nnTF - { \__siunitx_number_if_zero_p:V \l__siunitx_round_integer_out_tl } - { \__siunitx_number_if_zero_p:V \l__siunitx_round_decimal_out_tl } - { - \str_if_eq:VnTF \l__siunitx_process_round_min_tl { 0 } - { - \prop_put:Nnn \l__siunitx_number_in_prop { #1 -integer } { 0 } - \prop_put:NnV \l__siunitx_number_in_prop { #1 -decimal } - \l__siunitx_round_decimal_out_tl - } - { - \exp_after:wN \__siunitx_number_process_round_tidy_aux:w - \l__siunitx_process_round_min_tl . . \q_stop {#1} - } - } - { - \prop_put:NnV \l__siunitx_number_in_prop { #1 -integer } - \l__siunitx_round_integer_out_tl - \tl_if_empty:NTF \l__siunitx_round_decimal_out_tl - { - \prop_remove:Nn \l__siunitx_number_in_prop { #1 -decimal } - \prop_remove:Nn \l__siunitx_number_in_prop { #1 -decimal-marker } - } - { - \prop_put:NnV \l__siunitx_number_in_prop { #1 -decimal } - \l__siunitx_round_decimal_out_tl - } - } - } -\cs_new_protected:Npn \__siunitx_number_process_round_tidy_aux:w - #1 . #2 . #3 \q_stop #4 - { - \prop_put:Nnn \l__siunitx_number_in_prop { comparator } { < } - \prop_put:Nnn \l__siunitx_number_in_prop { #4 -integer } {#1} - \tl_if_empty:nTF {#2} - { \prop_remove:Nn \l__siunitx_number_in_prop { #4 -decimal } } - { \prop_put:Nnn \l__siunitx_number_in_prop { #4 -decimal } {#2} } - } -\cs_new_protected:Npn \__siunitx_number_process_scientific: { - \prop_if_in:NnF \l__siunitx_number_in_prop { complex } - { - \prop_get:NnNF \l__siunitx_number_in_prop { mantissa-integer } - \l__siunitx_tmpa_tl - { \tl_set:Nn \l__siunitx_tmpa_tl { 0 } } - \prop_get:NnNF \l__siunitx_number_in_prop { mantissa-decimal } - \l__siunitx_tmpb_tl - { \tl_clear:N \l__siunitx_tmpb_tl } - \tl_set:Nx \l__siunitx_tmpa_tl - { { \l__siunitx_tmpa_tl } { \l__siunitx_tmpb_tl } } - \prop_get:NnNF \l__siunitx_number_in_prop { exponent-integer } - \l__siunitx_tmpb_tl - { \tl_set:Nn \l__siunitx_tmpb_tl { 0 } } - \group_begin: - \prop_get:NnNT \l__siunitx_number_in_prop { exponent-sign } - \l__siunitx_tmpa_tl - { \tl_put_left:NV \l__siunitx_tmpb_tl \l__siunitx_tmpa_tl } - \exp_args:NNNV \group_end: - \tl_set:Nn \l__siunitx_tmpb_tl \l__siunitx_tmpb_tl - \tl_set:Nx \l__siunitx_tmpa_tl - { \l__siunitx_tmpa_tl { \l__siunitx_tmpb_tl } } - \exp_after:wN \__siunitx_number_process_scientific_aux_i:nnn - \l__siunitx_tmpa_tl - } -} -\cs_new_protected:Npn \__siunitx_number_process_scientific_aux_i:nnn #1#2#3 - { - \bool_set_true:N \l__siunitx_tmp_bool - \tl_map_inline:nn {#1#2} - { - \str_if_eq:nnF {##1} { 0 } - { - \bool_set_false:N \l__siunitx_tmp_bool - \tl_map_break: - } - } - \bool_if:NF \l__siunitx_tmp_bool - { \__siunitx_number_process_scientific_aux_ii:nnn {#1} {#2} {#3} } - } -\cs_new_protected:Npn - \__siunitx_number_process_scientific_aux_ii:nnn #1#2#3 { - \int_compare:nNnTF { \tl_count:n {#1} } > 1 - { \__siunitx_number_process_scientific_large:nnn {#1} {#2} {#3} } - { - \__siunitx_number_if_zero:nTF {#1} - { - \__siunitx_number_process_scientific_small:wn - #2 \q_stop {#3} - } - { - \bool_if:NTF \l__siunitx_process_engineering_bool - { \__siunitx_number_process_scientific_engineering:nnn } - { \__siunitx_number_process_scientific_store:nnn } - {#1} {#2} {#3} - } - - } -} -\cs_new_protected:Npn \__siunitx_number_process_scientific_large:nnn #1#2#3 - { - \cs_set_protected:Npn \__siunitx_number_process_scientific_large_loop:nNN - ##1##2##3 - { - \quark_if_recursion_tail_stop_do:Nn ##3 - { - \__siunitx_number_process_scientific_aux_ii:nnn {##1} { ##2 #2 } - { #3 + 1 } - } - \__siunitx_number_process_scientific_large_loop:nNN { ##1 ##2 } ##3 - } - \__siunitx_number_process_scientific_large_loop:nNN { } #1 - \q_recursion_tail \q_recursion_stop - } -\cs_new_protected:Npn - \__siunitx_number_process_scientific_small:wn #1#2 \q_stop #3 - { \__siunitx_number_process_scientific_aux_ii:nnn {#1} {#2} { #3 - 1 } } -\cs_new_protected:Npn - \__siunitx_number_process_scientific_store:nnn #1#2#3 - { - \prop_put:Nnn \l__siunitx_number_in_prop { mantissa-integer } {#1} - \tl_if_empty:nTF {#2} - { - \prop_remove:Nn \l__siunitx_number_in_prop { mantissa-decimal } - \prop_remove:Nn \l__siunitx_number_in_prop - { mantissa-decimal-marker } - } - { - \prop_put:Nnn \l__siunitx_number_in_prop - { mantissa-decimal } {#2} - \prop_if_in:NnF \l__siunitx_number_in_prop - { mantissa-decimal-marker } - { - \prop_put:Nnn \l__siunitx_number_in_prop - { mantissa-decimal-marker } { . } - } - } - \int_compare:nNnTF {#3} = { 0 } - { - \prop_remove:Nn \l__siunitx_number_in_prop { exponent } - \prop_remove:Nn \l__siunitx_number_in_prop { exponent-sign } - \prop_remove:Nn \l__siunitx_number_in_prop { exponent-integer } - } - { - \prop_put:Nnn \l__siunitx_number_in_prop { exponent } { true } - \int_compare:nNnTF {#3} > { 0 } - { - \int_set:Nn \l__siunitx_tmp_int {#3} - \prop_put:NnV \l__siunitx_number_in_prop - { exponent-integer } \l__siunitx_tmp_int - \prop_remove:Nn \l__siunitx_number_in_prop { exponent-sign } - } - { - \int_set:Nn \l__siunitx_tmp_int { 0 - (#3) } - \prop_put:NnV \l__siunitx_number_in_prop - { exponent-integer } \l__siunitx_tmp_int - \prop_put:Nnn \l__siunitx_number_in_prop { exponent-sign } - { - } - } - } - } -\cs_new_protected:Npn - \__siunitx_number_process_scientific_engineering:nnn #1#2#3 - { - \use:c - { - __siunitx_number_process_scientific_engineering_ - \int_compare:nNnTF {#3} < { 0 } - { - \int_case:nnF { \int_mod:nn { 0 - (#3) } { 3 } } - { - { 1 } { 2 } - { 2 } { 1 } - } - { 0 } - } - { \int_mod:nn {#3} { 3 } } - :nnn - } - {#1} {#2} {#3} - } -\cs_new_eq:cN - { __siunitx_number_process_scientific_engineering_0:nnn } - \__siunitx_number_process_scientific_store:nnn -\cs_new_protected:cpn - { __siunitx_number_process_scientific_engineering_1:nnn } #1#2#3 - { - \tl_if_empty:nTF {#2} - { - \__siunitx_number_process_scientific_store:nnn { #1 0 } { } - { #3 - 1 } - } - { - \use:c - { __siunitx_number_process_scientific_engineering_1:nw } - {#1} #2 \q_stop {#3} - } - } -\cs_new_protected:cpn - { __siunitx_number_process_scientific_engineering_1:nw } - #1#2#3 \q_stop #4 - { - \__siunitx_number_process_scientific_store:nnn - {#1#2} {#3} { #4 - 1 } - } -\cs_new_protected:cpn - { __siunitx_number_process_scientific_engineering_2:nnn } #1#2#3 - { - \tl_if_empty:nTF {#2} - { - \__siunitx_number_process_scientific_store:nnn { #1 00 } { } - { #3 - 2 } - } - { - \use:c - { __siunitx_number_process_scientific_engineering_2_i:nw } - {#1} #2 \q_stop {#3} - } - } -\cs_new_protected:cpn - { __siunitx_number_process_scientific_engineering_2_i:nw } - #1#2#3 \q_stop #4 - { - \tl_if_empty:nTF {#3} - { - \__siunitx_number_process_scientific_store:nnn { #1#2 0 } { } - { #4 - 2 } - } - { - \use:c - { __siunitx_number_process_scientific_engineering_2_ii:nw } - {#1#2} #3 \q_stop {#4} - } - } -\cs_new_protected:cpn - { __siunitx_number_process_scientific_engineering_2_ii:nw } - #1#2#3 \q_stop #4 - { - \__siunitx_number_process_scientific_store:nnn { #1#2 } {#3} - { #4 - 2 } - } -\cs_new_protected:Npn \__siunitx_number_process_sign: { - \bool_if:NF \l__siunitx_process_plus_bool - { - \prop_if_in:NnTF \l__siunitx_number_in_prop { mantissa-sign } - { \__siunitx_number_process_sign_plus:n { mantissa } } - { - \prop_if_in:NnT \l__siunitx_number_in_prop { complex-sign } - { - \prop_if_in:NnF \l__siunitx_number_in_prop { mantissa } - { \__siunitx_number_process_sign_plus:n { complex } } - } - } - \prop_if_in:NnT \l__siunitx_number_in_prop { exponent-sign } - { \__siunitx_number_process_sign_plus:n { exponent } } - } - \tl_if_empty:NF \l__siunitx_process_sign_tl - { - \__siunitx_number_process_sign_add:n { mantissa } - \prop_if_in:NnTF \l__siunitx_number_in_prop { complex } - { \__siunitx_number_process_sign_add:n { complex } } - } -} -\cs_new_protected:Npn \__siunitx_number_process_sign_add:n #1 { - \prop_if_in:NnF \l__siunitx_number_in_prop { #1 -sign } - { - \prop_if_in:NnF \l__siunitx_number_in_prop { #1 -had-sign } - { - \prop_get:NnN \l__siunitx_number_in_prop {#1} - \l__siunitx_tmpa_tl - \tl_if_empty:NTF \l__siunitx_tmpa_tl - { - \prop_put:NnV \l__siunitx_number_in_prop { sign } - \l__siunitx_process_sign_tl - } - { - \prop_put:NnV \l__siunitx_number_in_prop { #1 -sign } - \l__siunitx_process_sign_tl - } - } - } -} -\cs_new_protected:Npn \__siunitx_number_process_sign_plus:n #1 { - \prop_get:NnN \l__siunitx_number_in_prop { #1 -sign } - \l__siunitx_tmpa_tl - \tl_if_eq:NNT \c__siunitx_plus_tl \l__siunitx_tmpa_tl - { - \prop_remove:Nn \l__siunitx_number_in_prop { #1 -sign } - \prop_put:Nnn \l__siunitx_number_in_prop { #1 -had-sign } { true } - } -} -\tl_new:N \c__siunitx_plus_tl -\tl_set:Nn \c__siunitx_plus_tl { + } -\cs_new_protected:Npn \__siunitx_number_process_uncertainty: { - \clist_map_function:nN { mantissa , complex } - \__siunitx_number_process_uncertainty_aux:n -} -\cs_new_protected:Npn - \__siunitx_number_process_uncertainty_aux:n #1 { - \prop_if_in:NnT \l__siunitx_number_in_prop { #1 -uncertainty } - { - \prop_if_in:NnTF \l__siunitx_number_in_prop { #1 -decimal-marker } - { \__siunitx_number_process_uncertainty_decimal:n {#1} } - { \__siunitx_number_process_uncertainty_integer:n {#1} } - } -} -\cs_new_protected:Npn - \__siunitx_number_process_uncertainty_decimal:n #1 { - \__siunitx_number_process_uncertainty_count:nn {#1} { decimal } - \__siunitx_number_process_uncertainty_count:nn {#1} { uncertainty } - \tl_clear:N \l__siunitx_uncertainty_decimal_tl - \tl_clear:N \l__siunitx_uncertainty_integer_tl - \int_compare:nNnTF - { \l__siunitx_process_uncertainty_int } > - { \l__siunitx_process_decimal_int } - { \__siunitx_number_process_uncertainty_separate: } - { \__siunitx_number_process_uncertainty_pad: } - \tl_if_empty:NF \l__siunitx_uncertainty_integer_tl - { - \prop_put:NnV \l__siunitx_number_in_prop - { #1 -uncertainty-integer } - \l__siunitx_uncertainty_integer_tl - } - \prop_put:NnV \l__siunitx_number_in_prop { #1 -uncertainty-decimal } - \l__siunitx_uncertainty_decimal_tl - \prop_get:NnN \l__siunitx_number_in_prop { #1 -decimal-marker } - \l__siunitx_tmpa_tl - \prop_put:NnV \l__siunitx_number_in_prop - { #1 -uncertainty-decimal-marker } \l__siunitx_tmpa_tl -} -\cs_new_protected:Npn - \__siunitx_number_process_uncertainty_count:nn #1#2 { - \prop_get:NnN \l__siunitx_number_in_prop { #1 - #2 } - \l__siunitx_tmpa_tl - \int_set:cn { l__siunitx_process_ #2 _int } - { \tl_count:N \l__siunitx_tmpa_tl } -} -\cs_new_protected:Npn \__siunitx_number_process_uncertainty_pad: { - \int_while_do:nNnn - { \l__siunitx_process_uncertainty_int } < - { \l__siunitx_process_decimal_int } - { - \tl_put_right:Nn \l__siunitx_uncertainty_decimal_tl {0} - \int_incr:N \l__siunitx_process_uncertainty_int - } - \tl_put_right:NV \l__siunitx_uncertainty_decimal_tl - \l__siunitx_tmpa_tl -} -\cs_new_protected:Npn - \__siunitx_number_process_uncertainty_separate: { - \tl_map_function:NN \l__siunitx_tmpa_tl - \__siunitx_number_process_uncertainty_separate_aux:N -} -\cs_new_protected:Npn - \__siunitx_number_process_uncertainty_separate_aux:N #1 { - \int_compare:nNnTF - { \l__siunitx_process_uncertainty_int } > - { \l__siunitx_process_decimal_int } - { \tl_put_right:Nn \l__siunitx_uncertainty_integer_tl {#1} } - { \tl_put_right:Nn \l__siunitx_uncertainty_decimal_tl {#1} } - \int_decr:N \l__siunitx_process_uncertainty_int -} -\cs_new_protected:Npn - \__siunitx_number_process_uncertainty_integer:n #1 { - \prop_get:NnN \l__siunitx_number_in_prop { #1 -uncertainty } - \l__siunitx_tmpa_tl - \prop_put:NnV \l__siunitx_number_in_prop { #1 -uncertainty-integer } - \l__siunitx_tmpa_tl -} -\cs_new_protected:Npn \__siunitx_number_process_zero_fill: { - \__siunitx_number_process_zero_fill_aux:n { integer } - \__siunitx_number_process_zero_fill_aux:n { decimal } -} -\cs_new:Npn \__siunitx_number_process_zero_fill_aux:n #1 { - \bool_if:cT { l__siunitx_process_ #1 _zero_bool } - { - \__siunitx_number_process_zero_fill_aux:nn { mantissa } {#1} - \__siunitx_number_process_zero_fill_aux:nn { complex } {#1} - \__siunitx_number_process_zero_fill_aux:nn { exponent } {#1} - } -} -\cs_new_protected:Npn - \__siunitx_number_process_zero_fill_aux:nn #1#2 { - \prop_if_in:NnT \l__siunitx_number_in_prop { #1 -decimal-marker } - { - \prop_if_in:NnF \l__siunitx_number_in_prop { #1 - #2 } - { \prop_put:Nnn \l__siunitx_number_in_prop { #1 - #2 } { 0 } } - } -} -\cs_new_protected:Npn \__siunitx_number_process_zero_to_integer: - { - \bool_if:NT \l__siunitx_zero_decimal_to_integer_bool - { - \__siunitx_number_process_zero_to_integer_aux:n { mantissa } - \__siunitx_number_process_zero_to_integer_aux:n { complex } - } - } -\cs_new_protected:Npn \__siunitx_number_process_zero_to_integer_aux:n #1 - { - \prop_get:NnNT \l__siunitx_number_in_prop { #1 -decimal } \l__siunitx_tmpa_tl - { - \bool_set_true:N \l__siunitx_tmp_bool - \tl_map_inline:Nn \l__siunitx_tmpa_tl - { - \str_if_eq:nnF {##1} { 0 } - { - \bool_set_false:N \l__siunitx_tmp_bool - \tl_map_break: - } - } - \bool_if:NT \l__siunitx_tmp_bool - { - \prop_remove:Nn \l__siunitx_number_in_prop { #1 -decimal } - \prop_remove:Nn \l__siunitx_number_in_prop { #1 -decimal-marker } - } - } - } -\cs_new_protected:Npn \__siunitx_number_exp_to_prefix: - { - \prop_set_eq:NN \l__siunitx_unit_prop \l__siunitx_unit_saved_prop - \prop_get:NnNT \l__siunitx_number_in_prop { exponent-integer } - \l__siunitx_tmpa_tl - { - \prop_get:NnNT \l__siunitx_number_in_prop { exponent-sign } - \l__siunitx_tmpb_tl - { \tl_put_left:NV \l__siunitx_tmpa_tl \l__siunitx_tmpb_tl } - \prop_if_in:NnT \l__siunitx_unit_prop { per-1 } - { - \tl_set:Nx \l__siunitx_tmpa_tl - { \int_eval:n { - \l__siunitx_tmpa_tl } } - } - \prop_get:NnNT \l__siunitx_unit_prop { prefix-1 } \l__siunitx_tmpb_tl - { - \prop_remove:Nn \l__siunitx_unit_prop { prefix-1 } - \prop_remove:Nn \l__siunitx_unit_prop { prefix-symbol-1 } - \prop_get:NVN \l__siunitx_prefix_forward_prop \l__siunitx_tmpb_tl - \l__siunitx_tmpb_tl - \tl_set:Nx \l__siunitx_tmpa_tl - { \int_eval:n { \l__siunitx_tmpa_tl + \l__siunitx_tmpb_tl } } - } - \prop_get:NnNT \l__siunitx_unit_prop { power-1 } \l__siunitx_tmpb_tl - { - \tl_set:Nx \l__siunitx_tmpa_tl - { \int_eval:n { \l__siunitx_tmpa_tl / \l__siunitx_tmpb_tl } } - } - \prop_get:NVNTF \l__siunitx_prefix_reverse_prop \l__siunitx_tmpa_tl - \l__siunitx_tmpb_tl - { - \prop_remove:Nn \l__siunitx_number_in_prop { exponent } - \use:c - { - __siunitx_ \exp_after:wN \token_to_str:N \l__siunitx_tmpb_tl - _function:w - } - \prop_get:NnN \l__siunitx_unit_prop { total-units } \l__siunitx_tmpa_tl - \int_set:Nn \l__siunitx_unit_int \l__siunitx_tmpa_tl - \cs_set_eq:NN \__siunitx_pm: \pm - \__siunitx_unit_format: - \cs_set_eq:NN \pm \__siunitx_pm: - } - { - \msg_error:nnx { siunitx } { non-convertible-exponent } - { \l__siunitx_tmpa_tl } - } - } - } -\prop_new:N \l__siunitx_number_out_prop -\tl_new:N \l__siunitx_group_sep_tl -\tl_new:N \l__siunitx_output_decimal_tl -\bool_new:N \l__siunitx_complex_after_bool -\bool_new:N \l__siunitx_group_decimal_bool -\bool_new:N \l__siunitx_group_integer_bool -\keys_define:nn { siunitx } { - bracket-negative-numbers .bool_set:N = - \l__siunitx_negative_bracket_bool , - bracket-numbers .bool_set:N = \l__siunitx_brackets_bool, - close-bracket .tl_set:N = \l__siunitx_bracket_close_tl, - complex-root-position .choice:, - complex-root-position - / after-number .code:n = - { \bool_set_true:N \l__siunitx_complex_after_bool } , - complex-root-position - / before-number .code:n = - { \bool_set_false:N \l__siunitx_complex_after_bool } , - copy-complex-root .bool_set:N = - \l__siunitx_output_complex_copy_bool, - copy-decimal-marker .bool_set:N = - \l__siunitx_output_decimal_copy_bool, - exponent-base .tl_set:N = \l__siunitx_exponent_base_tl, - exponent-product .tl_set:N = - \l__siunitx_exponent_product_tl, - group-decimal-digits .meta:n = { group-digits = decimal }, - group-digits .choice: , - group-digits / - decimal .code:n = - { - \bool_set_true:N \l__siunitx_group_decimal_bool - \bool_set_false:N \l__siunitx_group_integer_bool - }, - group-digits / - false .code:n = - { - \bool_set_false:N \l__siunitx_group_decimal_bool - \bool_set_false:N \l__siunitx_group_integer_bool - }, - group-digits / - integer .code:n = - { - \bool_set_false:N \l__siunitx_group_decimal_bool - \bool_set_true:N \l__siunitx_group_integer_bool - }, - group-digits / - true .code:n = - { - \bool_set_true:N \l__siunitx_group_decimal_bool - \bool_set_true:N \l__siunitx_group_integer_bool - }, - group-digits .default:n = true , - group-four-digits .choice:, - group-four-digits / - false .meta:n = { group-minimum-digits = 5 }, - group-four-digits / - true .meta:n = { group-minimum-digits = 4 }, - group-four-digits .default:n = true, - group-integer-digits .meta:n = { group-digits = integer }, - group-minimum-digits .int_set:N = \l__siunitx_group_min_int, - group-separator .code:n = - { \tl_set:Nn \l__siunitx_group_sep_tl { {#1} } }, - negative-color .tl_set:N = \l__siunitx_negative_color_tl, - open-bracket .tl_set:N = \l__siunitx_bracket_open_tl, - output-close-uncertainty .tl_set:N = - \l__siunitx_output_uncert_close_tl, - output-complex-root .tl_set:N = \l__siunitx_output_complex_tl , - output-decimal-marker .code:n = - { \tl_set:Nn \l__siunitx_output_decimal_tl { {#1} } }, - output-exponent-marker .tl_set:N = \l__siunitx_output_exponent_tl, - output-open-uncertainty .tl_set:N = - \l__siunitx_output_uncert_open_tl, - separate-uncertainty .bool_set:N = \l__siunitx_uncert_sep_bool, - tight-spacing .bool_set:N = \l__siunitx_tight_bool, - uncertainty-separator .tl_set:N = \l__siunitx_uncert_sep_tl, -} -\keys_set:nn { siunitx } - { - bracket-numbers = true , % ( - close-bracket = ) , - complex-root-position = after-number , - copy-decimal-marker = false , - exponent-base = 10 , - exponent-product = \times , - group-digits = true , - group-minimum-digits = 5 , - group-separator = \, , - open-bracket = ( , % ) ( - output-close-uncertainty = ) , - output-complex-root = \ensuremath { \mathrm { i } } , - output-decimal-marker = . , - output-open-uncertainty = ( % ) - } -\cs_new_protected:Npn \__siunitx_number_format: { - \prop_if_empty:NF \l__siunitx_number_in_prop - { - \prop_clear:N \l__siunitx_number_out_prop - \__siunitx_number_format_reassemble: - \__siunitx_number_format_complex: - \__siunitx_number_format_sign:n { mantissa } - \__siunitx_number_format_sign:n { exponent } - \__siunitx_number_format_relation: - \__siunitx_number_format_color: - \__siunitx_number_format_final: - } -} -\cs_new_protected:Npn \__siunitx_number_format_brackets:n #1 { - \bool_if:NT \l__siunitx_brackets_bool - { - \prop_if_in:NnT \l__siunitx_number_out_prop { #1 -bracket } - { - \__siunitx_number_format_brackets_aux:n {#1} - \prop_remove:Nn \l__siunitx_number_out_prop { #1 -bracket } - } - } -} -\cs_new_protected:Npn \__siunitx_number_format_brackets_aux:n #1 { - \prop_get:NnNF \l__siunitx_number_out_prop { #1 -result } - \l__siunitx_tmpa_tl - { - \prop_get:NnN \l__siunitx_number_out_prop {#1} \l__siunitx_tmpa_tl - } - \tl_put_left:NV \l__siunitx_tmpa_tl \l__siunitx_bracket_open_tl - \tl_put_right:NV \l__siunitx_tmpa_tl \l__siunitx_bracket_close_tl - \str_if_eq:nnTF {#1} { result } - { \prop_put:NnV \l__siunitx_number_out_prop {#1} \l__siunitx_tmpa_tl } - { - \prop_put:NnV \l__siunitx_number_out_prop { #1 -result } - \l__siunitx_tmpa_tl - } -} -\cs_new_protected:Npn \__siunitx_number_format_color: { - \tl_if_empty:NF \l__siunitx_negative_color_tl - { - \__siunitx_number_format_color_aux:n { mantissa-sign } - \__siunitx_number_format_color_aux:n { sign } - } -} -\cs_new_protected:Npn \__siunitx_number_format_color_aux:n #1 { - \prop_get:NnNT \l__siunitx_number_in_prop {#1} \l__siunitx_tmpa_tl - { - \str_if_eq:VnT \l__siunitx_tmpa_tl { - } - { - \prop_put:NnV \l__siunitx_number_out_prop { color } - \l__siunitx_negative_color_tl - } - } -} -\cs_new_protected:Npn \__siunitx_number_format_complex: { - \prop_if_in:NnT \l__siunitx_number_in_prop { complex-root } - { - \prop_if_in:NnTF \l__siunitx_number_out_prop { complex } - { - \__siunitx_number_format_brackets:n { complex } - \__siunitx_number_format_complex_aux:n { complex } - \__siunitx_number_format_complex_aux:n { complex-result } - \prop_if_in:NnT \l__siunitx_number_out_prop - { complex-uncertainty } - { - \__siunitx_number_format_complex_aux:n - { complex-uncertainty } - } - } - { - \prop_put:NnV \l__siunitx_number_out_prop { complex } - \l__siunitx_output_complex_tl - } - \__siunitx_number_format_join_complex: - } -} -\cs_new_protected:Npn \__siunitx_number_format_complex_aux:n #1 { - \bool_if:NTF \l__siunitx_output_complex_copy_bool - { - \prop_get:NnN \l__siunitx_number_in_prop { complex-root } - \l__siunitx_tmpa_tl - } - { \tl_set_eq:NN \l__siunitx_tmpa_tl \l__siunitx_output_complex_tl } - \prop_get:NnN \l__siunitx_number_out_prop {#1} \l__siunitx_tmpb_tl - \bool_if:NTF \l__siunitx_complex_after_bool - { \tl_put_right:NV \l__siunitx_tmpb_tl \l__siunitx_tmpa_tl } - { \tl_put_left:NV \l__siunitx_tmpb_tl \l__siunitx_tmpa_tl } - \prop_put:NnV \l__siunitx_number_out_prop {#1} \l__siunitx_tmpb_tl -} -\cs_new_protected:Npn \__siunitx_number_format_copy:n #1 { - \prop_get:NnN \l__siunitx_number_in_prop {#1} \l__siunitx_tmpa_tl - \prop_put:NnV \l__siunitx_number_out_prop {#1} \l__siunitx_tmpa_tl -} -\cs_new_protected:Npn \__siunitx_number_format_copy:nn #1#2 { - \prop_get:NnN \l__siunitx_number_out_prop {#1} \l__siunitx_tmpa_tl - \prop_put:NnV \l__siunitx_number_out_prop {#2} \l__siunitx_tmpa_tl -} -\cs_new_protected:Npn \__siunitx_number_format_final: { - \prop_if_in:NnT \l__siunitx_number_out_prop { complex } - { - \prop_if_in:NnF \l__siunitx_number_out_prop { mantissa-result } - { - \__siunitx_number_format_copy:nn { complex } - { mantissa-result } - } - } - \prop_if_in:NnTF \l__siunitx_number_out_prop { exponent } - { - \__siunitx_number_format_final_exponent: - \prop_if_in:NnTF \l__siunitx_number_out_prop { mantissa-result } - { \__siunitx_number_format_final_combined: } - { \__siunitx_number_format_final_exponent_only: } - } - { \__siunitx_number_format_copy:nn { mantissa-result } { result } } - \prop_if_in:NnT \l__siunitx_number_out_prop { mantissa-bracket } - { - \prop_put:Nnn \l__siunitx_number_out_prop { result-bracket } - { true } - \prop_remove:Nn \l__siunitx_number_out_prop { mantissa-bracket } - } - \prop_if_in:NnT \l__siunitx_number_out_prop { comparator } - { - \__siunitx_number_format_brackets:n { result } - \prop_get:NnN \l__siunitx_number_out_prop { comparator } - \l__siunitx_tmpa_tl - \prop_get:NnN \l__siunitx_number_out_prop { result } - \l__siunitx_tmpb_tl - \tl_set:Nx \l__siunitx_tmpa_tl - { - \exp_not:N \mathord - \exp_not:V \l__siunitx_tmpa_tl - \exp_not:V \l__siunitx_tmpb_tl - } - \prop_put:NnV \l__siunitx_number_out_prop { result } - \l__siunitx_tmpa_tl - } -} -\cs_new_protected:Npn \__siunitx_number_format_final_combined: { - \__siunitx_number_format_brackets:n { mantissa } - \prop_get:NnN \l__siunitx_number_out_prop { mantissa-result } - \l__siunitx_tmpa_tl - \tl_if_empty:NT \l__siunitx_output_exponent_tl - { - \tl_put_right:Nx \l__siunitx_tmpa_tl - { - \exp_not:N \ensuremath - { - \bool_if:NTF \l__siunitx_tight_bool - { { \exp_not:V \l__siunitx_exponent_product_tl } } - { { } \exp_not:V \l__siunitx_exponent_product_tl { } } - } - } - } - \prop_get:NnN \l__siunitx_number_out_prop { exponent-result } - \l__siunitx_tmpb_tl - \tl_put_right:NV \l__siunitx_tmpa_tl \l__siunitx_tmpb_tl - \prop_put:NnV \l__siunitx_number_out_prop { result } - \l__siunitx_tmpa_tl - \prop_put:Nnn \l__siunitx_number_out_prop - { result-bracket-exponent } { true } -} -\cs_new_protected:Npn \__siunitx_number_format_final_exponent: { - \prop_get:NnN \l__siunitx_number_out_prop { exponent } - \l__siunitx_tmpa_tl - \tl_if_empty:NTF \l__siunitx_output_exponent_tl - { - \tl_set:Nx \l__siunitx_tmpa_tl - { ^ { \exp_not:V \l__siunitx_tmpa_tl } } - \tl_put_left:NV \l__siunitx_tmpa_tl \l__siunitx_exponent_base_tl - } - { - \tl_set:Nx \l__siunitx_tmpa_tl - { - \exp_not:V \l__siunitx_output_exponent_tl - \exp_not:N \mathord - \exp_not:V \l__siunitx_tmpa_tl - } - } - \prop_put:NnV \l__siunitx_number_out_prop { exponent-result } - \l__siunitx_tmpa_tl -} -\cs_new_protected:Npn - \__siunitx_number_format_final_exponent_only: { - \prop_get:NnNT \l__siunitx_number_in_prop { mantissa-sign } - \l__siunitx_tmpa_tl - { - \prop_get:NnN \l__siunitx_number_out_prop { exponent-result } - \l__siunitx_tmpb_tl - \__siunitx_tl_put_left_math:NV \l__siunitx_tmpb_tl - \l__siunitx_tmpa_tl - \prop_put:NnV \l__siunitx_number_out_prop { exponent-result } - \l__siunitx_tmpb_tl - } - \__siunitx_number_format_copy:nn { exponent-result } { result } -} -\cs_new_protected:Npn \__siunitx_number_format_group:n #1 { - \__siunitx_number_format_group_aux:nn {#1} { integer } - \__siunitx_number_format_group_aux:nn {#1} { decimal } - \prop_if_in:NnTF \l__siunitx_number_out_prop { #1 -integer } - { \__siunitx_number_format_copy:nn { #1 -integer } {#1} } - { \tl_clear:N \l__siunitx_tmpa_tl } - \prop_get:NnNT \l__siunitx_number_in_prop { #1 -decimal-marker } - \l__siunitx_tmpb_tl - { - \bool_if:NTF \l__siunitx_output_decimal_copy_bool - { \tl_set:Nx \l__siunitx_tmpb_tl { { \l__siunitx_tmpb_tl } } } - { - \tl_set_eq:NN \l__siunitx_tmpb_tl - \l__siunitx_output_decimal_tl - } - \tl_put_right:NV \l__siunitx_tmpa_tl \l__siunitx_tmpb_tl - \prop_put:NnV \l__siunitx_number_out_prop { #1 -decimal-marker } - \l__siunitx_tmpb_tl - \prop_get:NnNF \l__siunitx_number_out_prop { #1 -decimal } - \l__siunitx_tmpb_tl - { \tl_clear:N \l__siunitx_tmpb_tl } - \tl_put_right:NV \l__siunitx_tmpa_tl \l__siunitx_tmpb_tl - \prop_put:NnV \l__siunitx_number_out_prop {#1} \l__siunitx_tmpa_tl - } -} -\cs_new_protected:Npn \__siunitx_number_format_group_aux:nn #1#2 { - \prop_if_in:NnT \l__siunitx_number_in_prop { #1 - #2 } - { - \bool_if:cTF { l__siunitx_group_ #2 _bool } - { \__siunitx_number_format_group:nn {#1} {#2} } - { \__siunitx_number_format_copy:n { #1 - #2 } } - } -} -\cs_new_protected:Npn \__siunitx_number_format_group:nn #1#2 - { - \prop_get:NnN \l__siunitx_number_in_prop { #1 - #2 } \l__siunitx_tmpa_tl - \int_compare:nNnTF - { \tl_count:N \l__siunitx_tmpa_tl } < \l__siunitx_group_min_int - { \__siunitx_number_format_copy:n { #1 - #2 } } - { - \tl_clear:N \l__siunitx_tmpb_tl - \use:c { __siunitx_number_format_group_ #2 : } - \prop_put:NnV \l__siunitx_number_out_prop { #1 - #2 } \l__siunitx_tmpb_tl - } - } -\cs_new_protected:Npn \__siunitx_number_format_group_decimal: { - \tl_if_empty:NF \l__siunitx_tmpa_tl - { - \exp_after:wN \__siunitx_number_format_group_decimal_aux:NNNN - \l__siunitx_tmpa_tl { } { } { } - } -} -\cs_new_protected:Npn \__siunitx_number_format_group_decimal_aux:NNNN - #1#2#3#4 { - \tl_if_empty:nTF {#2} - { \tl_put_right:Nn \l__siunitx_tmpb_tl {#1} } - { - \tl_if_empty:nTF {#3} - { \tl_put_right:Nn \l__siunitx_tmpb_tl { #1 #2 } } - { - \tl_put_right:Nn \l__siunitx_tmpb_tl { #1 #2 #3 } - \tl_if_empty:nF {#4} - { - \tl_put_right:NV \l__siunitx_tmpb_tl \l__siunitx_group_sep_tl - \__siunitx_number_format_group_decimal_aux:NNNN #4 - } - } - } -} -\cs_new_protected:Npn \__siunitx_number_format_group_integer: { - \tl_if_empty:NF \l__siunitx_tmpa_tl - { - \__siunitx_number_format_group_integer_setup:V \l__siunitx_tmpa_tl - } -} -\cs_new_protected:Npn \__siunitx_number_format_group_integer_setup:n #1 { - \__siunitx_number_format_group_integer_setup_aux:NNNN - { } #1 { } { } { } -} -\cs_generate_variant:Nn \__siunitx_number_format_group_integer_setup:n - { V } -\cs_new_protected:Npn - \__siunitx_number_format_group_integer_setup_aux:NNNN #1#2#3#4 { - \tl_if_empty:nTF {#2} - { \__siunitx_number_format_group_integer_aux:NNNN #1 \q_nil } - { - \tl_if_empty:nTF {#3} - { - \__siunitx_number_format_group_integer_aux:NNNN { } { } #1#2 - \q_nil - } - { - \tl_if_empty:nTF {#4} - { - \__siunitx_number_format_group_integer_aux:NNNN { } #1#2#3 - \q_nil - } - { - \__siunitx_number_format_group_integer_setup_aux:NNNN - {#1#2#3#4} - } - } - } -} -\cs_new_protected:Npn - \__siunitx_number_format_group_integer_aux:NNNN #1#2#3#4 { - \tl_put_right:Nn \l__siunitx_tmpb_tl {#1#2#3} - \quark_if_nil:nF {#4} - { - \tl_put_right:NV \l__siunitx_tmpb_tl \l__siunitx_group_sep_tl - \__siunitx_number_format_group_integer_aux:NNNN #4 - } -} -\cs_new_protected:Npn \__siunitx_number_format_join_complex: { - \__siunitx_number_format_sign_complex: - \prop_if_in:NnT \l__siunitx_number_out_prop { mantissa } - { - \__siunitx_number_format_brackets:n { mantissa } - \prop_get:NnN \l__siunitx_number_out_prop { mantissa-result } - \l__siunitx_tmpa_tl - \prop_get:NnNF \l__siunitx_number_out_prop { complex-result } - \l__siunitx_tmpb_tl - { - \prop_get:NnN \l__siunitx_number_out_prop { complex } - \l__siunitx_tmpb_tl - } - \tl_put_right:NV \l__siunitx_tmpa_tl \l__siunitx_tmpb_tl - \prop_put:NnV \l__siunitx_number_out_prop { mantissa-result } - \l__siunitx_tmpa_tl - \prop_put:Nnn \l__siunitx_number_out_prop { mantissa-bracket } - { true } - } -} -\cs_new_protected:Npn \__siunitx_number_format_join_uncert: { - \__siunitx_number_format_join_uncert:n { mantissa } - \__siunitx_number_format_join_uncert:n { complex } -} -\cs_new_protected:Npn \__siunitx_number_format_join_uncert:n #1 { - \prop_get:NnNT \l__siunitx_number_out_prop {#1} - \l__siunitx_tmpa_tl - { - \prop_get:NnNTF \l__siunitx_number_out_prop { #1 -uncertainty } - \l__siunitx_tmpb_tl - { - \bool_if:NT \l__siunitx_uncert_sep_bool - { \__siunitx_number_format_join_uncert_pm:N \l__siunitx_tmpb_tl } - \tl_put_right:NV \l__siunitx_tmpa_tl \l__siunitx_tmpb_tl - \prop_put:NnV \l__siunitx_number_out_prop { #1 -result } - \l__siunitx_tmpa_tl - \prop_put:Nnn \l__siunitx_number_out_prop { #1 -bracket } - { true } - } - { \__siunitx_number_format_copy:nn {#1} { #1 -result } } - } -} -\cs_new_protected:Npn \__siunitx_number_format_join_uncert_pm:N #1 - { - \bool_if:NTF \l__siunitx_tight_bool - { \tl_put_left:Nn #1 { \ensuremath { { \pm } } } } - { \tl_put_left:Nn #1 { \ensuremath { { } \pm { } } } } - } -\cs_new_protected:Npn \__siunitx_number_format_reassemble: { - \prop_if_in:NnT \l__siunitx_number_in_prop { mantissa } - { - \__siunitx_number_format_group:n { mantissa } - \__siunitx_number_format_uncertainty:n { mantissa } - } - \prop_if_in:NnT \l__siunitx_number_in_prop { complex } - { - \__siunitx_number_format_group:n { complex } - \__siunitx_number_format_uncertainty:n { complex } - } - \prop_if_in:NnT \l__siunitx_number_in_prop { exponent } - { \__siunitx_number_format_group:n { exponent } } -} -\cs_new_protected:Npn \__siunitx_number_format_relation: { - \prop_get:NnNT \l__siunitx_number_in_prop { comparator } - \l__siunitx_tmpa_tl - { - \tl_set:Nx \l__siunitx_tmpa_tl - { - \exp_not:N \ensuremath - { \exp_not:V \l__siunitx_tmpa_tl } - } - \prop_put:NnV \l__siunitx_number_out_prop { comparator } - \l__siunitx_tmpa_tl - } -} -\cs_new_protected:Npn \__siunitx_number_format_sign:n #1 { - \prop_if_in:NnT \l__siunitx_number_out_prop {#1} - { - \prop_get:NnNT \l__siunitx_number_in_prop { #1 -sign } - \l__siunitx_tmpa_tl - { - \bool_if:NTF \l__siunitx_negative_bracket_bool - { - \str_if_eq:VnTF \l__siunitx_tmpa_tl { - } - { \__siunitx_number_format_sign_negative_brackets:n {#1} } - { \__siunitx_number_format_sign_aux:n {#1} } - } - { \__siunitx_number_format_sign_aux:n {#1} } - } - } -} -\cs_new_protected:Npn \__siunitx_number_format_sign_aux:n #1 { - \tl_clear:N \l__siunitx_tmpb_tl - \tl_put_left:NV \l__siunitx_tmpb_tl \l__siunitx_tmpa_tl - \prop_put:NnV \l__siunitx_number_out_prop { #1 -sign } - \l__siunitx_tmpb_tl - \prop_get:NnN \l__siunitx_number_out_prop {#1} \l__siunitx_tmpa_tl - \tl_put_left:NV \l__siunitx_tmpa_tl \l__siunitx_tmpb_tl - \prop_put:NnV \l__siunitx_number_out_prop {#1} \l__siunitx_tmpa_tl - \prop_get:NnNT \l__siunitx_number_out_prop { #1 -result } - \l__siunitx_tmpa_tl - { - \tl_put_left:NV \l__siunitx_tmpa_tl \l__siunitx_tmpb_tl - \prop_put:NnV \l__siunitx_number_out_prop { #1 -result } - \l__siunitx_tmpa_tl - } -} -\cs_new_protected:Npn - \__siunitx_number_format_sign_negative_brackets:n #1 - { - \__siunitx_number_format_brackets_aux:n {#1} - \prop_get:NnNT \l__siunitx_number_out_prop { #1 } - \l__siunitx_tmpa_tl - { - \tl_put_left:NV \l__siunitx_tmpa_tl \l__siunitx_bracket_open_tl - \tl_put_right:NV \l__siunitx_tmpa_tl \l__siunitx_bracket_close_tl - \prop_put:NnV \l__siunitx_number_out_prop { #1 } - \l__siunitx_tmpa_tl - } - } -\cs_new_protected:Npn \__siunitx_number_format_sign_complex: { - \__siunitx_number_format_sign_complex:n { complex } - \__siunitx_number_format_sign_complex:n { complex-result } -} -\cs_new_protected:Npn \__siunitx_number_format_sign_complex:n #1 { - \prop_if_in:NnT \l__siunitx_number_out_prop {#1} - { - \prop_get:NnNT \l__siunitx_number_in_prop { complex-sign } - \l__siunitx_tmpa_tl - { - \bool_if:NTF \l__siunitx_tight_bool - { - \tl_set:Nx \l__siunitx_tmpa_tl - { \exp_not:N \mathord \exp_not:V \l__siunitx_tmpa_tl } - } - { - \prop_if_in:NnT \l__siunitx_number_out_prop { mantissa } - { - \tl_set:Nx \l__siunitx_tmpa_tl - { { } \exp_not:V \l__siunitx_tmpa_tl { } } - } - } - \tl_clear:N \l__siunitx_tmpb_tl - \tl_put_left:NV \l__siunitx_tmpb_tl \l__siunitx_tmpa_tl - \prop_put:NnV \l__siunitx_number_out_prop { complex-sign } - \l__siunitx_tmpb_tl - \prop_get:NnN \l__siunitx_number_out_prop {#1} - \l__siunitx_tmpa_tl - \tl_put_left:NV \l__siunitx_tmpa_tl \l__siunitx_tmpb_tl - \prop_put:NnV \l__siunitx_number_out_prop {#1} - \l__siunitx_tmpa_tl - } - } -} -\cs_new_protected:Npn \__siunitx_number_format_uncertainty:n #1 { - \prop_if_in:NnTF \l__siunitx_number_in_prop { #1 -uncertainty } - { - \bool_if:NTF \l__siunitx_uncert_sep_bool - { \__siunitx_number_format_uncertainty_sep:n {#1} } - { \__siunitx_number_format_uncertainty_joined:n {#1} } - \__siunitx_number_format_join_uncert: - } - { \__siunitx_number_format_copy:nn {#1} { #1 -result } } -} -\cs_new_protected:Npn - \__siunitx_number_format_uncertainty_joined:n #1 { - \prop_get:NnN \l__siunitx_number_in_prop { #1 -uncertainty } - \l__siunitx_tmpa_tl - \prop_remove:Nn \l__siunitx_number_in_prop { #1 -uncertainty } - \tl_put_left:NV \l__siunitx_tmpa_tl \l__siunitx_output_uncert_open_tl - \tl_put_left:NV \l__siunitx_tmpa_tl \l__siunitx_uncert_sep_tl - \tl_put_right:NV \l__siunitx_tmpa_tl \l__siunitx_output_uncert_close_tl - \prop_get:NnN \l__siunitx_number_out_prop {#1} \l__siunitx_tmpb_tl - \tl_put_right:NV \l__siunitx_tmpb_tl \l__siunitx_tmpa_tl - \prop_put:NnV \l__siunitx_number_out_prop {#1} \l__siunitx_tmpb_tl -} -\cs_new_protected:Npn - \__siunitx_number_format_uncertainty_sep:n #1 { - \prop_if_in:NnT \l__siunitx_number_out_prop { #1 -integer } - { - \prop_if_in:NnF \l__siunitx_number_out_prop - { #1 -uncertainty-integer } - { - \prop_put:Nnn \l__siunitx_number_out_prop - { #1 -uncertainty-integer } { 0 } - } - } - \__siunitx_number_format_group:n { #1 -uncertainty } - \prop_put:NnV \l__siunitx_number_out_prop { #1 -uncertainty } - \l__siunitx_tmpa_tl -} -\tl_new:N \l__siunitx_number_out_tl -\tl_new:N \l__siunitx_number_out_saved_tl -\tl_new:N \l__siunitx_number_fraction_tl -\bool_new:N \l__siunitx_number_compound_bool -\tl_new:N \l__siunitx_quotient_mode_tl -\cs_new_protected:Npn \__siunitx_fraction:nn { } -\keys_define:nn { siunitx } { - fraction-function .code:n = - { \cs_set_protected:Npn \__siunitx_fraction:nn {#1} }, - output-product .tl_set:N = \l__siunitx_output_product_tl, - output-quotient .tl_set:N = \l__siunitx_output_quotient_tl, - parse-numbers .bool_set:N = \l__siunitx_number_parse_bool, - quotient-mode .choice:, - quotient-mode / fraction .code:n = - { \tl_set:Nn \l__siunitx_quotient_mode_tl { fraction } }, - quotient-mode / symbol .code:n = - { \tl_set:Nn \l__siunitx_quotient_mode_tl { symbol } }, -} -\keys_set:nn { siunitx } { - fraction-function = \frac , - output-product = \times , - output-quotient = / , - parse-numbers = true , - quotient-mode = symbol -} -\cs_new_protected:Npn \__siunitx_number_output:n #1 { - \tl_clear:N \l__siunitx_unit_tl - \tl_clear:N \l__siunitx_preunit_tl - \__siunitx_combined_output:n {#1} -} -\cs_generate_variant:Nn \__siunitx_number_output:n { V } -\cs_new_protected:Npn \__siunitx_number_output_bracket: { - \bool_if:NF \l__siunitx_error_bool - { - \bool_if:NT \l__siunitx_number_compound_bool - { \__siunitx_number_format_brackets:n { result } } - } -} -\cs_new_protected:Npn \__siunitx_number_output_color: { - \prop_if_in:NnT \l__siunitx_number_out_prop { color } - { - \prop_get:NnN \l__siunitx_number_out_prop { color } - \l__siunitx_number_color_tl - } -} -\cs_new_protected:Npn \__siunitx_number_output_parse:n #1 { - \__siunitx_number_preprocess:n {#1} - \bool_if:NF \l__siunitx_error_bool - { - \tl_if_empty:NTF \l__siunitx_number_multi_tl - { \__siunitx_number_output_parse_aux: } - { - \use:c - { __siunitx_number_output_ \l__siunitx_number_multi_tl : } - } - } -} -\cs_generate_variant:Nn \__siunitx_number_output_parse:n { V } -\cs_new_protected:Npn \__siunitx_number_output_parse_aux: { - \__siunitx_number_in_parse:V \l__siunitx_number_arg_tl - \bool_if:NF \l__siunitx_error_bool - { - \__siunitx_number_process: - \__siunitx_number_format: - \__siunitx_number_output_color: - \bool_if:NTF \l__siunitx_brackets_bool - { \__siunitx_number_output_single: } - { - \prop_if_in:NnTF \l__siunitx_number_out_prop - { result-bracket } - { \__siunitx_number_output_parts: } - { \__siunitx_number_output_single: } - } - } -} -\cs_new_protected:Npn \__siunitx_number_output_parts: { - \bool_lazy_and:nnTF - { \tl_if_empty_p:N \l__siunitx_pre_unit_tl } - { \tl_if_empty_p:N \l__siunitx_unit_tl } - { \__siunitx_number_output_single: } - { \__siunitx_number_output_parts_aux: } -} -\cs_new_protected:Npn \__siunitx_number_output_parts_aux: { - \bool_if:NTF \l__siunitx_multi_repeat_bool - { - \prop_if_in:NnT \l__siunitx_number_out_prop { mantissa-result } - { - \__siunitx_number_output_parts_aux:n { mantissa } - \__siunitx_number_output_parts_aux:n { complex } - } - \prop_get:NnNT \l__siunitx_number_out_prop { exponent-result } - \l__siunitx_tmpa_tl - { - \prop_if_in:NnT \l__siunitx_number_out_prop { mantissa-result } - { - \tl_put_left:Nx \l__siunitx_tmpa_tl - { - \exp_not:N \ensuremath - { - \bool_if:NTF \l__siunitx_tight_bool - { { \exp_not:V \l__siunitx_exponent_product_tl } } - { { } \exp_not:V \l__siunitx_exponent_product_tl { } } - } - } - \prop_put:NnV \l__siunitx_number_out_prop { exponent } - \l__siunitx_tmpa_tl - } - \__siunitx_number_output_parts_print:n { exponent } - } - } - { \__siunitx_number_output_single: } -} -\cs_new_protected:Npn \__siunitx_number_output_parts_aux:n #1 { - \prop_if_in:NnT \l__siunitx_number_out_prop {#1} - { \__siunitx_number_output_parts_print:n {#1} } - \prop_if_in:NnT \l__siunitx_number_out_prop { #1 -uncertainty } - { - \bool_if:NTF \l__siunitx_tight_bool - { \__siunitx_print:nn { number } { \ensuremath { { \pm } } } } - { \__siunitx_print:nn { number } { \ensuremath { { } \pm { } } } } - \__siunitx_number_output_parts_print:n { #1 -uncertainty } - } -} -\cs_new_protected:Npn \__siunitx_number_output_parts_print:n #1 { - \__siunitx_unit_output_pre_print: - \prop_get:NnN \l__siunitx_number_out_prop {#1} \l__siunitx_tmpa_tl - \__siunitx_print:nV { number } \l__siunitx_tmpa_tl - \__siunitx_unit_output_print: -} -\cs_new_protected:Npn \__siunitx_number_output_product: { - \bool_if:NTF \l__siunitx_product_brackets_bool - { - \bool_lazy_and:nnTF - { \tl_if_empty_p:N \l__siunitx_pre_unit_tl } - { \tl_if_empty_p:N \l__siunitx_unit_tl } - { \__siunitx_number_output_product_aux: } - { \__siunitx_number_output_product_brackets: } - } - { - \bool_if:NTF \l__siunitx_product_repeat_bool - { \__siunitx_number_output_product_aux: } - { - \__siunitx_unit_output_pre_print: - \tl_set_eq:NN \l__siunitx_unit_saved_tl \l__siunitx_unit_tl - \tl_clear:N \l__siunitx_pre_unit_tl - \tl_clear:N \l__siunitx_unit_tl - \group_begin: - \__siunitx_number_output_product_aux: - \group_end: - \tl_set_eq:NN \l__siunitx_unit_tl \l__siunitx_unit_saved_tl - \__siunitx_unit_output_print: - } - } -} -\cs_new_protected:Npn \__siunitx_number_output_product_brackets: { - \__siunitx_unit_output_pre_print: - \__siunitx_print:nV { number } \l__siunitx_bracket_open_tl - \nobreak - \tl_set_eq:NN \l__siunitx_unit_saved_tl \l__siunitx_unit_tl - \tl_clear:N \l__siunitx_pre_unit_tl - \tl_clear:N \l__siunitx_unit_tl - \__siunitx_number_output_product_aux: - \nobreak - \tl_set_eq:NN \l__siunitx_unit_tl \l__siunitx_unit_saved_tl - \__siunitx_print:nV { number } \l__siunitx_bracket_close_tl - \__siunitx_unit_output_print: -} -\cs_new_protected:Npn \__siunitx_number_output_product_aux: { - \bool_set_true:N \l__siunitx_number_compound_bool - \__siunitx_number_preprocess:V \l__siunitx_number_arg_tl - \bool_if:NF \l__siunitx_error_bool - { - \tl_if_empty:NTF \l__siunitx_number_multi_tl - { \__siunitx_number_output_parse_aux: } - { \__siunitx_number_output_quotient: } - \tl_if_empty:NF \l__siunitx_number_next_tl - { - \bool_if:NTF \l__siunitx_tight_bool - { - \__siunitx_print:nn { number } - { \ensuremath { \l__siunitx_output_product_tl } } - } - { - \__siunitx_print:nn { number } - { \ensuremath { { } \l__siunitx_output_product_tl { } } } - } - \__siunitx_number_output_parse:V \l__siunitx_number_next_tl - } - } -} -\cs_new_protected:Npn \__siunitx_number_output_quotient: { - \use:c - { __siunitx_number_output_quotient_ \l__siunitx_quotient_mode_tl : } -} -\cs_new_protected:Npn \__siunitx_number_output_quotient_fraction: { - \bool_set_false:N \l__siunitx_number_compound_bool - \__siunitx_number_output_quotient_aux_i: - \tl_set:Nx \l__siunitx_number_out_tl - { { \exp_not:V \l__siunitx_number_numerator_tl } } - \tl_set:Nx \l__siunitx_tmpa_tl - { { \exp_not:V \l__siunitx_number_denominator_tl } } - \tl_put_right:NV \l__siunitx_number_out_tl \l__siunitx_tmpa_tl - \tl_put_left:Nn \l__siunitx_number_out_tl { \__siunitx_fraction:nn } - \tl_set:Nx \l__siunitx_number_out_tl - { - \exp_not:N \ensuremath - { \exp_not:V \l__siunitx_number_out_tl } - } - \__siunitx_number_output_single_aux: -} -\cs_new_protected:Npn \__siunitx_number_output_quotient_symbol: { - \bool_set_true:N \l__siunitx_number_compound_bool - \__siunitx_number_output_quotient_aux_i: - \tl_set_eq:NN \l__siunitx_number_out_tl - \l__siunitx_number_numerator_tl - \tl_put_right:NV \l__siunitx_number_out_tl \l__siunitx_output_quotient_tl - \tl_put_right:NV \l__siunitx_number_out_tl - \l__siunitx_number_denominator_tl - \__siunitx_number_output_single_aux: -} -\cs_new_protected:Npn \__siunitx_number_output_quotient_aux_i: { - \__siunitx_number_in_parse:V \l__siunitx_number_numerator_tl - \__siunitx_number_output_quotient_aux_ii: - \__siunitx_number_output_color: - \prop_if_in:NnT \l__siunitx_number_out_prop { complex } - { - \prop_if_in:NnT \l__siunitx_number_out_prop { mantissa } - { - \prop_put:Nnn \l__siunitx_number_out_prop - { result-bracket } { true } - \__siunitx_number_format_brackets:n { result } - } - } - \prop_get:NnN \l__siunitx_number_out_prop { result } - \l__siunitx_number_numerator_tl - \__siunitx_number_in_parse:V \l__siunitx_number_denominator_tl - \__siunitx_number_output_quotient_aux_ii: - \prop_if_in:NnT \l__siunitx_number_out_prop - { result-bracket-exponent } - { - \prop_put:Nnn \l__siunitx_number_out_prop { result-bracket } - { true } - } - \__siunitx_number_output_bracket: - \prop_get:NnN \l__siunitx_number_out_prop { result } - \l__siunitx_number_denominator_tl -} -\cs_new_protected:Npn \__siunitx_number_output_quotient_aux_ii: { - \__siunitx_number_process: - \__siunitx_number_format: -} -\cs_new_protected:Npn \__siunitx_number_output_single: { - \bool_lazy_and:nnF - { \tl_if_empty_p:N \l__siunitx_pre_unit_tl } - { \tl_if_empty_p:N \l__siunitx_unit_tl } - { - \prop_if_in:NnF \l__siunitx_number_out_prop { exponent } - { \__siunitx_number_format_brackets:n { result } } - } - \__siunitx_number_output_bracket: - \prop_get:NnN \l__siunitx_number_out_prop { result } - \l__siunitx_number_out_tl - \__siunitx_number_output_single_aux: -} -\cs_new_protected:Npn \__siunitx_number_output_single_aux: { - \__siunitx_unit_output_pre_print: - \quark_if_no_value:NTF \l__siunitx_number_out_tl - { \tl_clear:N \l__siunitx_number_unit_product_tl } - { \__siunitx_print:nV { number } \l__siunitx_number_out_tl } - \__siunitx_unit_output_print: -} -\bool_new:N \l__siunitx_angle_degree_space_bool -\bool_new:N \l__siunitx_angle_minute_space_bool -\box_new:N \l__siunitx_angle_marker_box -\box_new:N \l__siunitx_angle_unit_box -\dim_new:N \l__siunitx_angle_marker_dim -\dim_new:N \l__siunitx_angle_unit_dim -\prop_new:N \l__siunitx_angle_degree_prop -\prop_new:N \l__siunitx_angle_minute_prop -\prop_new:N \l__siunitx_angle_second_prop -\keys_define:nn { siunitx } { - add-arc-degree-zero .bool_set:N = - \l__siunitx_angle_degree_zero_bool , - add-arc-minute-zero .bool_set:N = - \l__siunitx_angle_minute_zero_bool , - add-arc-second-zero .bool_set:N = - \l__siunitx_angle_second_zero_bool , - angle-symbol-over-decimal .bool_set:N = - \l__siunitx_angle_astronomy_bool , - arc-separator .tl_set:N = - \l__siunitx_angle_arc_separator_tl , - number-angle-product .tl_set:N = - \l__siunitx_angle_unit_product_tl , - number-angle-separator .tl_set:N = - \l__siunitx_angle_unit_product_tl , -} -\cs_new_protected:Npn \__siunitx_angle_output:nnn #1#2#3 { - \__siunitx_angle_init: - \IfNoValueTF {#2} - { - \bool_set_false:N \l__siunitx_angle_minute_zero_bool - \bool_set_false:N \l__siunitx_angle_second_zero_bool - \__siunitx_angle_output_aux:nnn {#1} { } { } - } - { - \IfNoValueTF {#3} - { \__siunitx_error:nx { invalid-arc-format } { #1 ; #2 } } - { \__siunitx_angle_output_aux:nnn {#1} {#2} {#3} } - } -} -\cs_new_protected:Npn \__siunitx_angle_output_aux:nnn #1#2#3 { - \tl_if_empty:nTF { #1#2#3 } - { \__siunitx_error:n { empty-arc } } - { - \bool_if:NTF \l__siunitx_number_parse_bool - { \__siunitx_angle_parse:nnn {#1} {#2} {#3} } - { \__siunitx_angle_direct:nnn {#1} {#2} {#3} } - } -} -\cs_new_protected:Npn \__siunitx_angle_init: { - \bool_set_false:N \l__siunitx_angle_degree_space_bool - \bool_set_false:N \l__siunitx_angle_minute_space_bool - \prop_clear:N \l__siunitx_angle_degree_prop - \prop_clear:N \l__siunitx_angle_minute_prop - \prop_clear:N \l__siunitx_angle_second_prop - \tl_clear:N \l__siunitx_preunit_tl - \tl_set_eq:NN \l__siunitx_number_unit_product_tl - \l__siunitx_angle_unit_product_tl - \cs_set_eq:NN \__siunitx_number_in_parse_more:N - \__siunitx_number_in_parse_restricted:N -} -\cs_new_protected:Npn \__siunitx_angle_direct:nnn #1 { - \tl_if_empty:nTF {#1} - { - \bool_if:NTF \l__siunitx_angle_degree_zero_bool - { \__siunitx_angle_direct_aux_i:nnn { 0 } } - { \__siunitx_angle_direct_aux_i:nnn { } } - } - { \__siunitx_angle_direct_aux_i:nnn {#1} } -} -\cs_new_protected:Npn \__siunitx_angle_direct_aux_i:nnn #1#2 { - \tl_if_empty:nTF {#2} - { - \bool_if:NTF \l__siunitx_angle_minute_zero_bool - { \__siunitx_angle_direct_aux_ii:nnn {#1} { 0 } } - { \__siunitx_angle_direct_aux_ii:nnn {#1} { } } - } - { \__siunitx_angle_direct_aux_ii:nnn {#1} {#2} } -} -\cs_new_protected:Npn \__siunitx_angle_direct_aux_ii:nnn #1#2#3 { - \tl_if_empty:nTF {#3} - { - \bool_if:NTF \l__siunitx_angle_second_zero_bool - { \__siunitx_angle_direct_aux_iii:nnn {#1} {#2} { 0 } } - { \__siunitx_angle_direct_aux_iii:nnn {#1} {#2} { } } - } - { \__siunitx_angle_direct_aux_iii:nnn {#1} {#2} {#3} } -} -\cs_new_protected:Npn \__siunitx_angle_direct_aux_iii:nnn #1#2#3 { - \tl_if_empty:nF {#1} - { - \tl_if_empty:nF {#2#3} - { \bool_set_true:N \l__siunitx_angle_degree_space_bool } - } - \tl_if_empty:nF {#2} - { - \tl_if_empty:nF {#3} - { \bool_set_true:N \l__siunitx_angle_minute_space_bool } - } - \__siunitx_angle_print_direct:nnn {#1} {#2} {#3} -} -\cs_new_protected:Npn \__siunitx_angle_parse:nnn #1#2#3 { - \__siunitx_angle_parse_aux:nn {#1} { degree } - \__siunitx_angle_parse_aux:nn {#2} { minute } - \__siunitx_angle_parse_aux:nn {#3} { second } - \__siunitx_angle_check_sign: - \__siunitx_angle_zero_fill: - \prop_if_empty:NF \l__siunitx_angle_degree_prop - { - \prop_if_empty:NF \l__siunitx_angle_minute_prop - { \bool_set_true:N \l__siunitx_angle_degree_space_bool } - \prop_if_empty:NF \l__siunitx_angle_second_prop - { \bool_set_true:N \l__siunitx_angle_degree_space_bool } - } - \prop_if_empty:NF \l__siunitx_angle_minute_prop - { - \prop_if_empty:NF \l__siunitx_angle_second_prop - { \bool_set_true:N \l__siunitx_angle_minute_space_bool } - } - \__siunitx_angle_print: -} -\cs_new_protected:Npn \__siunitx_angle_parse_aux:nn #1#2 { - \prop_clear:N \l__siunitx_number_in_prop - \tl_if_empty:nF {#1} - { - \__siunitx_number_in_init: - \__siunitx_number_in_parse_aux:n {#1} - } - \prop_get:NnNT \l__siunitx_number_in_prop { mantissa-sign-deleted } - \l__siunitx_tmpa_tl - { - \prop_put:NnV \l__siunitx_number_in_prop { mantissa-sign } - \l__siunitx_tmpa_tl - } - \__siunitx_number_process: - \prop_set_eq:cN { l__siunitx_angle_ #2 _prop } - \l__siunitx_number_in_prop -} -\cs_new_protected:Npn \__siunitx_angle_check_sign: { - \prop_if_empty:NTF \l__siunitx_angle_degree_prop - { - \prop_if_empty:NF \l__siunitx_angle_minute_prop - { \__siunitx_angle_check_sign_aux:n { second } } - } - { - \__siunitx_angle_check_sign_aux:n { minute } - \__siunitx_angle_check_sign_aux:n { second } - } -} -\cs_new_protected:Npn \__siunitx_angle_check_sign_aux:n #1 { - \prop_if_in:cnTF { l__siunitx_angle_ #1 _prop } - { mantissa-sign } - { \msg_error:nn { siunitx } { bad-arc-sign } } - { - \prop_if_in:cnT { l__siunitx_angle_ #1 _prop } - { mantissa-sign-deleted } - { \msg_error:nn { siunitx } { bad-arc-sign } } - } -} -\cs_new_protected:Npn \__siunitx_angle_zero_fill: { - \bool_lazy_and:nnT - { \l__siunitx_angle_second_zero_bool } - { \prop_if_empty_p:N \l__siunitx_angle_second_prop } - { - \prop_put:Nnn \l__siunitx_angle_second_prop { mantissa } - { true } - \prop_put:Nnn \l__siunitx_angle_second_prop { mantissa-integer } - { 0 } - } - \bool_lazy_and:nnT - { \l__siunitx_angle_minute_zero_bool } - { \prop_if_empty_p:N \l__siunitx_angle_minute_prop } - { - \prop_put:Nnn \l__siunitx_angle_minute_prop { mantissa } - { true } - \prop_put:Nnn \l__siunitx_angle_minute_prop { mantissa-integer } - { 0 } - \__siunitx_angle_sign_shuffle:nn { second } { minute } - } - \bool_lazy_and:nnT - { \l__siunitx_angle_degree_zero_bool } - { \prop_if_empty_p:N \l__siunitx_angle_degree_prop } - { - \prop_put:Nnn \l__siunitx_angle_degree_prop { mantissa } - { true } - \prop_put:Nnn \l__siunitx_angle_degree_prop { mantissa-integer } - { 0 } - \__siunitx_angle_sign_shuffle:nn { second } { degree } - \__siunitx_angle_sign_shuffle:nn { minute } { degree } - } -} -\cs_new_protected:Npn \__siunitx_angle_sign_shuffle:nn #1#2 { - \__siunitx_angle_sign_shuffle_aux:nnn {#1} {#2} { } - \__siunitx_angle_sign_shuffle_aux:nnn {#1} {#2} { -deleted } -} -\cs_new_protected:Npn \__siunitx_angle_sign_shuffle_aux:nnn - #1#2#3 { - \prop_get:cnN { l__siunitx_angle_ #1 _prop } { mantissa-sign #3 } - \l__siunitx_tmpa_tl - \prop_remove:cn { l__siunitx_angle_ #1 _prop } { mantissa-sign #3 } - \quark_if_no_value:NF \l__siunitx_tmpa_tl - { - \prop_put:cnV { l__siunitx_angle_ #2 _prop } { mantissa-sign #3 } - \l__siunitx_tmpa_tl - } -} -\cs_new_protected:Npn \__siunitx_angle_print: { - \__siunitx_angle_print_aux:nn { degree } { \SIUnitSymbolDegree } - \bool_if:NT \l__siunitx_angle_degree_space_bool - { - \nobreak - \l__siunitx_angle_arc_separator_tl - } - \__siunitx_angle_print_aux:nn { minute } { \SIUnitSymbolArcminute } - \bool_if:NT \l__siunitx_angle_minute_space_bool - { - \nobreak - \l__siunitx_angle_arc_separator_tl - } - \__siunitx_angle_print_aux:nn { second } { \SIUnitSymbolArcsecond } -} -\cs_new_protected:Npn \__siunitx_angle_print_aux:nn #1#2 { - \prop_if_empty:cF { l__siunitx_angle_ #1 _prop } - { - \prop_set_eq:Nc \l__siunitx_number_in_prop - { l__siunitx_angle_ #1 _prop } - \tl_set:Nn \l__siunitx_unit_tl {#2} - \tl_clear:N \l__siunitx_number_out_tl - \__siunitx_number_format: - \__siunitx_number_output_color: - \bool_if:NTF \l__siunitx_angle_astronomy_bool - { \__siunitx_angle_print_astronomy: } - { \__siunitx_number_output_single: } - } -} -\cs_new_protected:Npn \__siunitx_angle_print_astronomy: { - \prop_if_in:NnTF \l__siunitx_number_in_prop - { mantissa-decimal-marker } - { \__siunitx_angle_print_astronomy_aux: } - { \__siunitx_number_output_single: } -} -\cs_new_protected:Npn \__siunitx_angle_print_astronomy_aux: { - \prop_get:NnNT \l__siunitx_number_out_prop { mantissa-integer } - \l__siunitx_tmpa_tl - { \__siunitx_print:nV { number } \l__siunitx_tmpa_tl } - \hbox_set:Nn \l__siunitx_angle_marker_box - { - \__siunitx_print:nn { number } { { \l__siunitx_output_decimal_tl } } - } - \hbox_set:Nn \l__siunitx_angle_unit_box - { - \__siunitx_print:nV { unit } \l__siunitx_unit_tl - \skip_horizontal:n { -\scriptspace } - } - \__siunitx_angle_print_astronomy_aux:n { marker } - \__siunitx_angle_print_astronomy_aux:n { unit } - \hbox_set:Nn \l__siunitx_angle_marker_box - { - \box_use:N \l__siunitx_angle_marker_box - \box_use:N \l__siunitx_angle_unit_box - } - \dim_compare:nNnTF - { \l__siunitx_angle_marker_dim } > { \l__siunitx_angle_unit_dim } - { \__siunitx_angle_print_astronomy_marker: } - { \__siunitx_angle_print_astronomy_unit: } - \prop_get:NnNT \l__siunitx_number_out_prop { mantissa-decimal } - \l__siunitx_tmpa_tl - { \__siunitx_print:nV { number } \l__siunitx_tmpa_tl } -} -\cs_new_protected:Npn \__siunitx_angle_print_astronomy_aux:n #1 { - \dim_set:cn { l__siunitx_angle_ #1 _dim } - { \box_wd:c { l__siunitx_angle_ #1 _box } } - \hbox_set_to_wd:cnn { l__siunitx_angle_ #1 _box } { \c_zero_skip } - { - \tex_hss:D - \hbox_unpack:c { l__siunitx_angle_ #1_box } - \tex_hss:D - } -} -\cs_new_protected:Npn \__siunitx_angle_print_astronomy_marker: { - \hbox_set_to_wd:Nnn \l__siunitx_angle_marker_box - { \l__siunitx_angle_marker_dim } - { - \tex_hss:D - \hbox_unpack:N \l__siunitx_angle_marker_box - \tex_hss:D - } - \box_use:N \l__siunitx_angle_marker_box -} -\cs_new_protected:Npn \__siunitx_angle_print_astronomy_unit: { - \hbox_set_to_wd:Nnn \l__siunitx_angle_marker_box - { \l__siunitx_angle_unit_dim } - { - \tex_hss:D - \hbox_unpack:N \l__siunitx_angle_marker_box - \tex_hss:D - } - \box_use:N \l__siunitx_angle_marker_box - \skip_horizontal:N \scriptspace -} -\cs_new_protected:Npn \__siunitx_angle_print_direct:nnn #1#2#3 { - \__siunitx_angle_print_direct_aux:nn {#1} { \SIUnitSymbolDegree } - \bool_if:NT \l__siunitx_angle_degree_space_bool - { - \nobreak - \l__siunitx_angle_arc_separator_tl - } - \__siunitx_angle_print_direct_aux:nn {#2} { \SIUnitSymbolArcminute } - \bool_if:NT \l__siunitx_angle_minute_space_bool - { - \nobreak - \l__siunitx_angle_arc_separator_tl - } - \__siunitx_angle_print_direct_aux:nn {#3} { \SIUnitSymbolArcsecond } -} -\cs_new_protected:Npn \__siunitx_angle_print_direct_aux:nn #1#2 { - \tl_if_empty:nF {#1} - { - \tl_set:Nn \l__siunitx_unit_tl {#2} - \__siunitx_print:nn { number } { \ensuremath {#1} } - \__siunitx_unit_output_print: - } -} -\seq_new:N \l_siunitx_unit_symbolic_seq -\seq_put_right:Nn \l_siunitx_unit_symbolic_seq { \of } -\seq_put_right:Nn \l_siunitx_unit_symbolic_seq { \highlight } -\seq_put_right:Nn \l_siunitx_unit_symbolic_seq { \per } -\seq_put_right:Nn \l_siunitx_unit_symbolic_seq { \raiseto } -\seq_put_right:Nn \l_siunitx_unit_symbolic_seq { \tothe } -\cs_new_protected:Npn \__siunitx_declare_power_after:Nn #1#2 { - \seq_put_right:Nn \l_siunitx_unit_symbolic_seq {#1} - \cs_set:cpn { __siunitx_ \token_to_str:N #1 _literal:w } - { \__siunitx_textsuperscript:n {#2} } - \cs_set:cpn { __siunitx_ \token_to_str:N #1 _function:w } - { \__siunitx_unit_parse_power_after:n {#2} } -} -\cs_new_protected:Npn \__siunitx_declare_power_before:Nn #1#2 { - \seq_put_right:Nn \l_siunitx_unit_symbolic_seq {#1} - \cs_set:cpn { __siunitx_ \token_to_str:N #1 _literal:w } ##1 - { ##1 \__siunitx_textsuperscript:n {#2} } - \cs_set:cpn { __siunitx_ \token_to_str:N #1 _function:w } - { \__siunitx_unit_parse_power_before:n {#2} } -} -\cs_new_protected:Npn \__siunitx_declare_prefix:Nnnn #1#2#3#4 - { - \seq_put_right:Nn \l_siunitx_unit_symbolic_seq {#1} - \prop_put:Nnn \l__siunitx_prefix_forward_prop {#1} {#4} - \prop_put:Nnn \l__siunitx_prefix_reverse_prop {#4} {#1} - \cs_set:cpn { __siunitx_ \token_to_str:N #1 _literal:w } {#2} - \cs_set:cpn { __siunitx_ \token_to_str:N #1 _function:w } - { - \bool_if:NTF \l__siunitx_prefix_symbols_bool - { \__siunitx_unit_parse_prefix:Nn #1 {#2} } - { \__siunitx_unit_parse_prefix:nn {#3} {#4} } - } - } -\prop_new:N \l__siunitx_prefix_forward_prop -\prop_new:N \l__siunitx_prefix_reverse_prop -\cs_new_protected:Npn \__siunitx_declare_qualifier:Nn #1#2 { - \seq_put_right:Nn \l_siunitx_unit_symbolic_seq {#1} - \cs_set:cpn { __siunitx_ \token_to_str:N #1 _literal:w } - { \text { ~ } ( #2 ) } - \cs_set:cpn { __siunitx_ \token_to_str:N #1 _function:w } - { \__siunitx_unit_parse_qualifier:n {#2} } -} -\cs_new_protected:Npn \__siunitx_declare_unit:Nnn #1#2#3 { - \seq_put_right:Nn \l_siunitx_unit_symbolic_seq {#1} - \cs_set:cpn { __siunitx_ \token_to_str:N #1 _literal:w } {#2} - \cs_set_protected:cpn { __siunitx_ \token_to_str:N #1 _function:w } - { - \__siunitx_unit_if_literal:nTF {#2} - { \__siunitx_unit_parse_unit:Nn #1 {#2} } - {#2} - } - \tl_if_empty:nTF {#3} - { \cs_undefine:c { l__siunitx_ \token_to_str:N #1 _options_tl } } - { - \tl_clear_new:c { l__siunitx_ \token_to_str:N #1 _options_tl } - \tl_set:cn { l__siunitx_ \token_to_str:N #1 _options_tl } {#3} - } -} -\cs_new_protected:Npn \__siunitx_unit_first_token:n #1 { - \exp_last_unbraced:No \token_to_str:N { \tl_head:w #1 \q_stop } -} -\cs_new:cpn { __siunitx_ \token_to_str:N \per _literal:w } { / } -\cs_new_protected:cpn { __siunitx_ \token_to_str:N \per _function:w } { - \bool_set_true:N \l__siunitx_per_bool - \__siunitx_unit_parse_per: -} -\cs_new:cpn { __siunitx_ \token_to_str:N \raiseto _literal:w } #1#2 { - #2 - \__siunitx_textsuperscript:n {#1} -} -\cs_new_protected:cpn { __siunitx_ \token_to_str:N \raiseto _function:w } - #1 { - \__siunitx_unit_parse_power_before:n {#1} -} -\cs_new:cpn { __siunitx_ \token_to_str:N \tothe _literal:w } #1 { - \__siunitx_textsuperscript:n {#1} -} -\cs_new_protected:cpn { __siunitx_ \token_to_str:N \tothe _function:w } - #1 { - \__siunitx_unit_parse_power_after:n {#1} -} -\cs_new:cpn { __siunitx_ \token_to_str:N \of _literal:w } #1 { - \text { ~ } ( #1 ) -} -\cs_new_protected:cpn { __siunitx_ \token_to_str:N \of _function:w } #1 { - \__siunitx_unit_parse_qualifier:n {#1} -} -\AtBeginDocument { - \cs_if_exist:NT \cancel - { - \cs_set_protected:Npn \__siunitx_cancel:n #1 - { \__siunitx__real_cancel:n { \__siunitx_print:nn { unit } {#1} } } - \cs_set_eq:NN \__siunitx__real_cancel:n \cancel - \seq_put_right:Nn \l_siunitx_unit_symbolic_seq { \cancel } - \cs_new_protected:cpn - { __siunitx_ \token_to_str:N \cancel _function:w } - { \__siunitx_unit_parse_special:n { \__siunitx_cancel:n } } - } -} -\cs_new:cpn - { __siunitx_ \token_to_str:N \highlight _literal:w } #1 - { \__siunitx_textcolor:n {#1} } -\cs_new_protected:cpn - { __siunitx_ \token_to_str:N \highlight _function:w } #1 - { \__siunitx_unit_parse_special:n { \__siunitx_textcolor:n {#1} } } -\keys_define:nn { siunitx } { - free-standing-units .bool_set:N = \l__siunitx_create_free_bool , - overwrite-functions .bool_set:N = \l__siunitx_create_overwrite_bool, - space-before-unit .bool_set:N = \l__siunitx_create_prespace_bool , - unit-optional-argument .bool_set:N = \l__siunitx_create_optional_bool , - use-xspace .bool_set:N = \l__siunitx_create_xspace_bool , -} -\__siunitx_option_deactivate:n { - free-standing-units , - overwrite-functions , - space-before-unit , - unit-optional-argument , - use-xspace , -} -\cs_new_protected:Npn \__siunitx_unit_create_empty_functions: - { - \__siunitx_unit_create_functions_aux_i: - \seq_map_function:NN \l_siunitx_unit_symbolic_seq - \__siunitx_unit_create_empty_functions_aux:N - \__siunitx_unit_create_functions_aux_ii: - } -\cs_new_protected:Npn \__siunitx_unit_create_empty_functions_aux:N #1 - { - \cs_if_free:NT #1 - { \cs_set_protected:Npn #1 { \ERROR } } - } -\cs_new_protected:Npn \__siunitx_unit_create_functions: - { - \__siunitx_unit_create_functions_aux_i: - \bool_if:NT \l__siunitx_create_overwrite_bool - { \seq_map_function:NN \l_siunitx_unit_symbolic_seq \cs_undefine:N } - \bool_if:NTF \l__siunitx_create_optional_bool - { - \seq_map_function:NN \l_siunitx_unit_symbolic_seq - \__siunitx_unit_create_with_arg:N - } - { - \seq_map_function:NN \l_siunitx_unit_symbolic_seq - \__siunitx_unit_create:N - } - \__siunitx_unit_create_functions_aux_ii: - \bool_if:NT \l__siunitx_create_xspace_bool - { \RequirePackage { xspace } } - } -\cs_new_protected:Npn \__siunitx_unit_create_functions_aux_i: - { - \@ifpackageloaded { soulpos } - { - \@ifpackageloaded { soul } - { } - { - \cs_set_protected:Npn \__siunitx_unit_create_functions_aux_ii: - { - \cs_undefine:N \hl - \cs_undefine:N \ul - } - } - } - { } - } -\cs_new_protected:Npn \__siunitx_unit_create_functions_aux_ii: { } -\cs_new_protected:Npn \__siunitx_unit_create:N #1 { - \cs_if_free:NT #1 - { - \cs_set:Npx \__siunitx_tmp:w - { - \ProvideDocumentCommand \exp_not:N #1 { } - { - \group_begin: - \exp_not:N \cs_if_free:NF - \exp_not:c - { l__siunitx_ \token_to_str:N #1 _options_tl } - { - \keys_set:nV { siunitx } - \exp_not:c - { l__siunitx_ \token_to_str:N #1 _options_tl } - } - \bool_if:NT \l__siunitx_create_prespace_bool - { \exp_not:N \l__siunitx_number_unit_product_tl } - \exp_not:n { \__siunitx_unit_output:nn {#1} { } } - \group_end: - \bool_if:NT \l__siunitx_create_xspace_bool - { \exp_not:N \xspace } - } - } - \__siunitx_tmp:w - } -} -\cs_new_protected:Npn \__siunitx_unit_create_with_arg:N #1 { - \cs_if_free:NT #1 - { - \cs_set:Npx \__siunitx_tmp:w - { - \ProvideDocumentCommand \exp_not:N #1 { o } - { - \group_begin: - \exp_not:N \cs_if_free:NF - \exp_not:c - { l__siunitx_ \token_to_str:N #1 _options_tl } - { - \keys_set:nV { siunitx } - \exp_not:c - { - l__siunitx_ \token_to_str:N #1 _options_tl - } - } - \exp_not:N \IfNoValueTF {####1} - { - \bool_if:NT \l__siunitx_create_prespace_bool - { \exp_not:N \l__siunitx_number_unit_product_tl } - \exp_not:n { \__siunitx_unit_output:nn {#1} { } } - } - { \SI {####1} { \exp_not:N #1 } } - \group_end: - \bool_if:NT \l__siunitx_create_xspace_bool - { \exp_not:N \xspace } - } - } - \__siunitx_tmp:w - } -} -\AtBeginDocument { - \cs_if_eq:NNT \color \use_none:n - { \cs_set_protected:Npn \color #1 { } } - \cs_set:Npn \__siunitx_tmp:w #1 { } - \cs_if_eq:NNT \color \__siunitx_tmp:w - { \cs_set_protected:Npn \color #1 { } } - \tl_map_function:nN { \bar \color \ng \pm \array@row@rst } - \__siunitx_protect_symbols:N -} -\tl_put_right:Nn \document { \__siunitx_protect_symbols:N \fg } -\cs_new_protected:Npn \__siunitx_protect_symbols:N #1 { - \cs_if_exist:NT #1 - { - \tl_if_empty:fT { \token_get_prefix_spec:N #1 } - { \cs_set_protected:Npx #1 { \exp_not:V #1 } } - } -} -\keys_define:nn { siunitx } { - forbid-literal-units .bool_set:N = - \l__siunitx_unit_forbid_literal_bool, - parse-units .bool_set:N = \l__siunitx_unit_parse_bool -} -\keys_set:nn { siunitx } { - forbid-literal-units = false, - parse-units = true -} -\cs_new_protected:Npn \__siunitx_unit_in:nn #1#2 { - \bool_if:NTF \l__siunitx_unit_parse_bool - { - \tl_if_empty:nF {#1} - { - \__siunitx_unit_if_literal:nTF {#1} - { - \tl_clear:N \l__siunitx_per_mode_tl - \bool_if:NTF \l__siunitx_unit_forbid_literal_bool - { - \msg_error:nnx { siunitx } { literal-unit } - { \exp_not:n {#1} } - } - { - \cs_set_eq:NN \__siunitx_pm: \pm - \__siunitx_unit_format_literal:n {#1} - \cs_set_eq:NN \pm \__siunitx_pm: - } - } - { - \cs_set_eq:NN \__siunitx_pm: \pm - \__siunitx_unit_parse:nn {#1} {#2} - \__siunitx_unit_format: - \prop_set_eq:NN \l__siunitx_unit_saved_prop \l__siunitx_unit_prop - \cs_set_eq:NN \pm \__siunitx_pm: - } - } - } - { \__siunitx_unit_format_literal:n {#1} } -} -\cs_generate_variant:Nn \__siunitx_unit_in:nn { V } -\cs_new:Npn \__siunitx_pm: { } -\cs_new_protected:Npn \__siunitx_unit_if_literal:nTF #1#2#3 { - \group_begin: - \seq_map_function:NN \l_siunitx_unit_symbolic_seq - \__siunitx_unit_if_literal_aux:N - \cs_set_eq:NN \of \use_none:n - \cs_set_eq:NN \highlight \use_none:n - \cs_set_eq:NN \raiseto \use_none:n - \cs_set_eq:NN \tothe \use_none:n - \protected@edef \l__siunitx_tmpa_tl {#1} - \exp_args:NNNV \group_end: - \tl_set:Nn \l__siunitx_tmpa_tl \l__siunitx_tmpa_tl - \tl_if_blank:VTF \l__siunitx_tmpa_tl {#3} {#2} -} -\cs_new_protected:Npn \__siunitx_unit_if_literal_aux:N #1 { - \cs_set_eq:NN #1 \prg_do_nothing: -} -\int_new:N \l__siunitx_unit_int -\prop_new:N \l__siunitx_unit_prop -\prop_new:N \l__siunitx_unit_saved_prop -\bool_new:N \l__siunitx_per_bool -\keys_define:nn { siunitx } - { - exponent-to-prefix .bool_set:N = \l__siunitx_exp_to_prefix_bool , - prefixes-as-symbols .bool_set:N = \l__siunitx_prefix_symbols_bool , - sticky-per .bool_set:N = \l__siunitx_sticky_per_bool - } -\keys_set:nn { siunitx } { prefixes-as-symbols = true } -\cs_new_protected:Npn \__siunitx_unit_parse:nn #1#2 { - \__siunitx_unit_parse_init: - \__siunitx_unit_parse_options:nn {#1} {#2} - #1 -} -\cs_new_protected:Npn \__siunitx_unit_parse_init: - { - \prop_clear:N \l__siunitx_unit_prop - \int_zero:N \l__siunitx_unit_int - \bool_set_false:N \l__siunitx_per_bool - \seq_map_inline:Nn \l_siunitx_unit_symbolic_seq - { \cs_set_eq:Nc ##1 { __siunitx_ \token_to_str:N ##1 _function:w } } - } -\cs_new_protected:Npn \__siunitx_unit_parse_options:nn #1#2 { - \tl_if_single:nT {#1} - { - \cs_if_free:cF - { l__siunitx_ \__siunitx_unit_first_token:n {#1} _options_tl } - { - \keys_set:nv { siunitx } - { l__siunitx_ \__siunitx_unit_first_token:n {#1} _options_tl } - \keys_set:nn { siunitx } {#2} - } - } -} -\cs_new_protected:Npn \__siunitx_unit_parse_power_before:n #1 { - \tl_set:Nx \l__siunitx_tmpa_tl - { power- \int_eval:n { \l__siunitx_unit_int + 1 } } - \prop_put:NVn \l__siunitx_unit_prop \l__siunitx_tmpa_tl {#1} -} -\cs_new_protected:Npn \__siunitx_unit_parse_power_after:n #1 { - \tl_set:Nx \l__siunitx_tmpa_tl - { power- \int_use:N \l__siunitx_unit_int } - \prop_put:NVn \l__siunitx_unit_prop \l__siunitx_tmpa_tl {#1} -} -\cs_new_protected:Npn \__siunitx_unit_parse_prefix:Nn #1#2 - { - \int_incr:N \l__siunitx_unit_int - \tl_set:Nx \l__siunitx_tmpa_tl - { prefix- \int_use:N \l__siunitx_unit_int } - \prop_put:NVn \l__siunitx_unit_prop \l__siunitx_tmpa_tl {#1} - \tl_set:Nx \l__siunitx_tmpa_tl - { prefix-symbol- \int_use:N \l__siunitx_unit_int } - \prop_put:NVn \l__siunitx_unit_prop \l__siunitx_tmpa_tl {#2} - } -\cs_new_protected:Npn \__siunitx_unit_parse_prefix:nn #1#2 - { - \__siunitx_unit_parse_prefix:Nn \ERROR {#2} - \tl_set:Nx \l__siunitx_tmpa_tl - { prefix-base- \int_use:N \l__siunitx_unit_int } - \prop_put:NVn \l__siunitx_unit_prop \l__siunitx_tmpa_tl {#1} - } -\cs_new_protected:Npn \__siunitx_unit_parse_per: { - \tl_set:Nx \l__siunitx_tmpa_tl - { per- \int_eval:n { \l__siunitx_unit_int + 1 } } - \prop_put:NVn \l__siunitx_unit_prop \l__siunitx_tmpa_tl { true } - \bool_if:NT \l__siunitx_sticky_per_bool - { \cs_set_eq:NN \per \__siunitx_unit_parse_per_error: } -} -\cs_new_protected:Npn \__siunitx_unit_parse_per_error: { - \msg_error:nn { siunitx } { duplicate-sticky-per } -} -\cs_new_protected:Npn \__siunitx_unit_parse_qualifier:n #1 { - \tl_set:Nx \l__siunitx_tmpa_tl - { symbol- \int_use:N \l__siunitx_unit_int } - \prop_if_in:NVF \l__siunitx_unit_prop \l__siunitx_tmpa_tl - { \msg_error:nn { siunitx } { qualifier-before-unit } } - \tl_set:Nx \l__siunitx_tmpa_tl - { qualifier- \int_use:N \l__siunitx_unit_int } - \prop_put:NVn \l__siunitx_unit_prop \l__siunitx_tmpa_tl {#1} -} -\cs_new_protected:Npn \__siunitx_unit_parse_special:n #1 { - \tl_set:Nx \l__siunitx_tmpa_tl - { special- \int_eval:n { \l__siunitx_unit_int + 1 } } - \prop_put:NVn \l__siunitx_unit_prop \l__siunitx_tmpa_tl {#1} -} -\cs_new_protected:Npn \__siunitx_unit_parse_unit:Nn #1#2 { - \tl_set:Nx \l__siunitx_tmpa_tl - { prefix-symbol- \int_use:N \l__siunitx_unit_int } - \prop_if_in:NVTF \l__siunitx_unit_prop \l__siunitx_tmpa_tl - { - \tl_set:Nx \l__siunitx_tmpa_tl - { symbol- \int_use:N \l__siunitx_unit_int } - \prop_if_in:NVT \l__siunitx_unit_prop \l__siunitx_tmpa_tl - { \int_incr:N \l__siunitx_unit_int } - } - { \int_incr:N \l__siunitx_unit_int } - \tl_set:Nx \l__siunitx_tmpa_tl - { unit- \int_use:N \l__siunitx_unit_int } - \prop_put:NVn \l__siunitx_unit_prop \l__siunitx_tmpa_tl {#1} - \tl_set:Nx \l__siunitx_tmpa_tl - { symbol- \int_use:N \l__siunitx_unit_int } - \prop_put:NVn \l__siunitx_unit_prop \l__siunitx_tmpa_tl {#2} - \__siunitx_unit_parse_unit_per: -} -\cs_new_protected:Npn \__siunitx_unit_parse_unit_per: { - \bool_if:NT \l__siunitx_sticky_per_bool - { - \bool_if:NT \l__siunitx_per_bool - { - \tl_set:Nx \l__siunitx_tmpa_tl - { per- \int_use:N \l__siunitx_unit_int } - \prop_put:NVn \l__siunitx_unit_prop \l__siunitx_tmpa_tl - { true } - } - } -} -\tl_new:N \l__siunitx_preunit_tl -\tl_new:N \l__siunitx_unit_tl -\tl_new:N \l__siunitx_unit_current_tl -\tl_new:N \l__siunitx_unit_denominator_tl -\tl_new:N \l__siunitx_unit_numerator_tl -\tl_new:N \l__siunitx_unit_saved_tl -\int_new:N \l__siunitx_unit_denominator_int -\int_new:N \l__siunitx_unit_numerator_int -\int_new:N \l__siunitx_unit_prefix_int -\int_new:N \l__siunitx_unit_prefix_base_int -\tl_new:N \l__siunitx_unit_prefix_current_tl -\int_new:N \l__siunitx_unit_prefix_gram_int -\bool_new:N \l__siunitx_omit_unit_space_bool -\bool_new:N \l__siunitx_per_auto_bool -\bool_new:N \l__siunitx_per_fraction_bool -\tl_new:N \l__siunitx_per_mode_tl -\bool_new:N \l__siunitx_power_number_bool -\bool_new:N \l__siunitx_per_two_parts_bool -\tl_new:N \l__siunitx_qualifier_mode_tl -\keys_define:nn { siunitx } { - bracket-unit-denominator .bool_set:N - = \l__siunitx_unit_denominator_bracket_bool, - inter-unit-product .tl_set:N = \l__siunitx_unit_product_tl , - inter-unit-separator .tl_set:N = \l__siunitx_unit_product_tl , - literal-superscript-as-power - .bool_set:N = \l__siunitx_literal_power_bool, - per-mode .choice:, - per-mode / fraction .code:n = - { - \bool_set_false:N \l__siunitx_per_auto_bool - \bool_set_true:N \l__siunitx_per_fraction_bool - \bool_set_true:N \l__siunitx_per_two_parts_bool - \tl_set:Nn \l__siunitx_per_mode_tl { fraction } - }, - per-mode / power .meta:n = { per-mode = reciprocal } , - per-mode / power-positive-first .meta:n = - { per-mode = reciprocal-positive-first } , - per-mode / reciprocal .code:n = - { - \bool_set_false:N \l__siunitx_per_auto_bool - \bool_set_false:N \l__siunitx_per_fraction_bool - \bool_set_false:N \l__siunitx_per_two_parts_bool - \tl_clear:N \l__siunitx_per_mode_tl - }, - per-mode / reciprocal-positive-first .code:n = - { - \bool_set_false:N \l__siunitx_per_auto_bool - \bool_set_false:N \l__siunitx_per_fraction_bool - \bool_set_true:N \l__siunitx_per_two_parts_bool - \tl_clear:N \l__siunitx_per_mode_tl - }, - per-mode / repeated-symbol .code:n = - { - \bool_set_false:N \l__siunitx_per_auto_bool - \bool_set_false:N \l__siunitx_per_fraction_bool - \bool_set_false:N \l__siunitx_per_two_parts_bool - \tl_set:Nn \l__siunitx_per_mode_tl { repeat } - }, - per-mode / symbol .code:n = - { - \bool_set_false:N \l__siunitx_per_auto_bool - \bool_set_true:N \l__siunitx_per_fraction_bool - \bool_set_true:N \l__siunitx_per_two_parts_bool - \tl_set:Nn \l__siunitx_per_mode_tl { symbol } - }, - per-mode / symbol-or-fraction .code:n = - { - \bool_set_true:N \l__siunitx_per_auto_bool - \bool_set_true:N \l__siunitx_per_fraction_bool - \bool_set_true:N \l__siunitx_per_two_parts_bool - \tl_set:Nn \l__siunitx_per_mode_tl { symbol } - }, - per-symbol .tl_set:N = \l__siunitx_per_symbol_tl, - power-font .choice:, - power-font / number .code:n = - { \bool_set_true:N \l__siunitx_power_number_bool }, - power-font / unit .code:n = - { \bool_set_false:N \l__siunitx_power_number_bool }, - qualifier-mode .choice:, - qualifier-mode / brackets .code:n = - { \tl_set:Nn \l__siunitx_qualifier_mode_tl { brackets } }, - qualifier-mode / phrase .code:n = - { \tl_set:Nn \l__siunitx_qualifier_mode_tl { phrase } }, - qualifier-mode / space .code:n = - { \tl_set:Nn \l__siunitx_qualifier_mode_tl { space } }, - qualifier-mode / subscript .code:n = - { \tl_set:Nn \l__siunitx_qualifier_mode_tl { subscript } }, - qualifier-mode / text .code:n = - { \tl_set:Nn \l__siunitx_qualifier_mode_tl { text } }, - qualifier-phrase .tl_set:N = \l__siunitx_qualifier_phrase_tl -} -\keys_set:nn { siunitx } { - bracket-unit-denominator = true, - inter-unit-product = \,, - literal-superscript-as-power = true, - per-mode = reciprocal, - per-symbol = /, - power-font = number, - qualifier-mode = subscript, - qualifier-phrase = { ~ of ~ } -} -\cs_new_protected:Npn \__siunitx_unit_format: { - \prop_put:Nnx \l__siunitx_unit_prop { total-units } - { \int_use:N \l__siunitx_unit_int } - \__siunitx_unit_format_init: - \int_while_do:nNnn { \l__siunitx_unit_int } > { 0 } - { - \__siunitx_unit_format_prefix: - \__siunitx_unit_format_symbol: - \__siunitx_unit_format_qualifier: - \__siunitx_unit_format_power: - \__siunitx_unit_format_add: - \int_decr:N \l__siunitx_unit_int - } - \bool_if:NT \l__siunitx_per_two_parts_bool - { - \bool_if:NTF \l__siunitx_per_fraction_bool - { \__siunitx_unit_format_fraction: } - { \__siunitx_unit_format_sorted: } - } -} -\cs_new_protected:Npn \__siunitx_unit_format_add: { - \bool_if:NTF \l__siunitx_per_two_parts_bool - { - \tl_set:Nx \l__siunitx_tmpb_tl - { per- \int_use:N \l__siunitx_unit_int } - \prop_if_in:NVTF \l__siunitx_unit_prop \l__siunitx_tmpb_tl - { - \__siunitx_unit_format_add_aux:n { _denominator } - \int_incr:N \l__siunitx_unit_denominator_int - } - { - \__siunitx_unit_format_add_aux:n { _numerator } - \int_incr:N \l__siunitx_unit_numerator_int - } - } - { \__siunitx_unit_format_add_aux:n { } } - \tl_clear:N \l__siunitx_unit_current_tl -} -\cs_new_protected:Npn \__siunitx_unit_format_add_aux:n #1 { - \tl_if_empty:cF { l__siunitx_unit #1 _tl } - { - \str_if_eq:VnTF \l__siunitx_per_mode_tl { repeat } - { - \tl_set:Nx \l__siunitx_tmpa_tl - { per- \int_eval:n { \l__siunitx_unit_int + 1 } } - \prop_if_in:NVF \l__siunitx_unit_prop \l__siunitx_tmpa_tl - { - \tl_put_right:NV \l__siunitx_unit_current_tl - \l__siunitx_unit_product_tl - } - } - { - \tl_put_right:NV \l__siunitx_unit_current_tl - \l__siunitx_unit_product_tl - } - } - \tl_set:Nx \l__siunitx_tmpa_tl - { special- \int_use:N \l__siunitx_unit_int } - \prop_get:NVNTF \l__siunitx_unit_prop \l__siunitx_tmpa_tl - \l__siunitx_tmpa_tl - { - \tl_put_left:cx { l__siunitx_unit #1 _tl } - { - \exp_not:V \l__siunitx_tmpa_tl - { \exp_not:V \l__siunitx_unit_current_tl } - } - } - { - \tl_put_left:cV { l__siunitx_unit #1 _tl } - \l__siunitx_unit_current_tl - } -} -\cs_new_protected:Npn \__siunitx_unit_format_fraction: { - \int_compare:nNnT { \l__siunitx_unit_numerator_int } = { 0 } - { - \str_if_eq:VnT \l__siunitx_per_mode_tl { symbol } - { \bool_set_true:N \l__siunitx_omit_unit_space_bool } - } - \int_compare:nNnTF { \l__siunitx_unit_denominator_int } > { 0 } - { - \bool_if:NTF \l__siunitx_per_auto_bool - { \__siunitx_unit_format_fraction_auto: } - { - \use:c - { __siunitx_unit_format_fraction_ \l__siunitx_per_mode_tl : } - } - } - { \tl_set_eq:NN \l__siunitx_unit_tl \l__siunitx_unit_numerator_tl } -} -\cs_new_protected:Npn \__siunitx_unit_format_fraction_fraction: { - \tl_if_empty:NT \l__siunitx_unit_numerator_tl - { \tl_set:Nn \l__siunitx_unit_numerator_tl { 1 } } - \tl_set:Nx \l__siunitx_unit_numerator_tl - { { \exp_not:V \l__siunitx_unit_numerator_tl } } - \tl_put_left:Nn \l__siunitx_unit_numerator_tl - { \__siunitx_print:nn { unit } } - \tl_set:Nx \l__siunitx_unit_numerator_tl - { { \exp_not:V \l__siunitx_unit_numerator_tl } } - \tl_set:Nx \l__siunitx_unit_denominator_tl - { { \exp_not:V \l__siunitx_unit_denominator_tl } } - \tl_put_left:Nn \l__siunitx_unit_denominator_tl - { \__siunitx_print:nn { unit } } - \tl_set:Nx \l__siunitx_unit_denominator_tl - { { \exp_not:V \l__siunitx_unit_denominator_tl } } - \tl_set:Nn \l__siunitx_unit_tl { \__siunitx_fraction:nn } - \tl_put_right:NV \l__siunitx_unit_tl \l__siunitx_unit_numerator_tl - \tl_put_right:NV \l__siunitx_unit_tl \l__siunitx_unit_denominator_tl - \tl_set:Nx \l__siunitx_unit_tl - { \exp_not:N \ensuremath { \exp_not:V \l__siunitx_unit_tl } } -} -\cs_new_protected:Npn \__siunitx_unit_format_fraction_auto: { - \mode_if_math:TF - { - \group_begin: - \__siunitx_unit_format_fraction_fraction: - \exp_args:NNNV \group_end: - \tl_set:Nn \l__siunitx_tmpa_tl \l__siunitx_unit_tl - \group_begin: - \__siunitx_unit_format_fraction_symbol: - \exp_args:NNNV \group_end: - \tl_set:Nn \l__siunitx_tmpb_tl \l__siunitx_unit_tl - \tl_set:Nx \l__siunitx_tmpb_tl - { - \__siunitx_print:nn { unit } - { \exp_not:V \l__siunitx_tmpb_tl } - } - \tl_set:Nx \l__siunitx_unit_tl - { - \exp_not:N \ensuremath { - \tex_mathchoice:D - { \exp_not:V \l__siunitx_tmpa_tl } - { \exp_not:V \l__siunitx_tmpb_tl } - { \exp_not:V \l__siunitx_tmpb_tl } - { \exp_not:V \l__siunitx_tmpb_tl } - } - } - } - { \__siunitx_unit_format_fraction_symbol: } -} -\cs_new_protected:Npn \__siunitx_unit_format_fraction_symbol: { - \__siunitx_unit_format_fraction_symbol_aux: - \int_compare:nNnT { \l__siunitx_unit_denominator_int } > { 1 } - { - \bool_if:NT \l__siunitx_unit_denominator_bracket_bool - { - \tl_put_left:NV \l__siunitx_unit_denominator_tl \l__siunitx_bracket_open_tl - \tl_put_right:NV \l__siunitx_unit_denominator_tl \l__siunitx_bracket_close_tl - } - } - \tl_set_eq:NN \l__siunitx_unit_tl \l__siunitx_unit_numerator_tl - \tl_put_right:NV \l__siunitx_unit_tl \l__siunitx_per_symbol_tl - \tl_put_right:NV \l__siunitx_unit_tl \l__siunitx_unit_denominator_tl -} -\cs_new_protected:Npn - \__siunitx_unit_format_fraction_symbol_aux: { } -\cs_new_protected:Npn - \__siunitx_unit_format_fraction_symbol_aux_alt: { - \tl_if_empty:NT \l__siunitx_unit_numerator_tl - { \tl_set:Nn \l__siunitx_unit_numerator_tl { 1 } } -} -\cs_new_protected:Npn \__siunitx_unit_format_init: { - \bool_set_false:N \l__siunitx_omit_unit_space_bool - \tl_clear:N \l__siunitx_unit_tl - \tl_clear:N \l__siunitx_unit_current_tl - \tl_clear:N \l__siunitx_unit_denominator_tl - \int_zero:N \l__siunitx_unit_prefix_gram_int - \tl_clear:N \l__siunitx_unit_numerator_tl - \int_zero:N \l__siunitx_unit_prefix_base_int - \int_zero:N \l__siunitx_unit_prefix_int - \int_zero:N \l__siunitx_unit_denominator_int - \int_zero:N \l__siunitx_unit_numerator_int - \seq_map_inline:Nn \l_siunitx_unit_symbolic_seq - { \__siunitx_unit_print_literal_aux:N ##1 } -} -\group_begin: - \char_set_catcode_active:N \~ - \cs_new_protected:Npn \__siunitx_unit_format_literal:n #1 - { - \int_zero:N \l__siunitx_unit_prefix_int - \seq_map_inline:Nn \l_siunitx_unit_symbolic_seq - { \__siunitx_unit_print_literal_aux:N ##1 } - \tl_set:Nn \l__siunitx_unit_tl {#1} - \tl_replace_all:NnV \l__siunitx_unit_tl { . } - \l__siunitx_unit_product_tl - \tl_replace_all:NnV \l__siunitx_unit_tl { ~ } - \l__siunitx_unit_product_tl - \bool_if:NT \l__siunitx_literal_power_bool - { - \tl_replace_all:Nnn \l__siunitx_unit_tl { ^ } - { \__siunitx_unit_format_literal_power:n } - \tl_replace_all:Non \l__siunitx_unit_tl { \token_to_str:N ^ } - { \__siunitx_unit_format_literal_power:n } - } - \__siunitx_unit_format_literal_extras: - } -\group_end: -\cs_new_protected:Npn \__siunitx_unit_print_literal_aux:N #1 - { \cs_set_eq:Nc #1 { __siunitx_ \token_to_str:N #1 _literal:w } } -\cs_new_protected:Npn \__siunitx_unit_format_literal_power:n #1 - { \PrintSuperscript { \__siunitx_unit_format_power_aux:n {#1} } } - %\end{macro} -\cs_new_protected:Npn \__siunitx_unit_format_literal_extras: - { - \__siunitx_unit_format_literal_extras_aux:nN { 176 } - \SIUnitSymbolDegree - \__siunitx_unit_format_literal_extras_aux:nN { 181 } - \SIUnitSymbolMicro - \__siunitx_unit_format_literal_extras_aux:nN { 197 } - \SIUnitSymbolAngstrom - } -\cs_new_protected:Npn \__siunitx_unit_format_literal_extras_aux:nN #1#2 - { - \tl_replace_all:Nxn \l__siunitx_unit_tl - { \char_generate:nn { #1 } { 12 } } - {#2} - } -\bool_lazy_or:nnF { \sys_if_engine_luatex_p: } { \sys_if_engine_xetex_p: } - { - \AtBeginDocument - { - \cs_if_exist:NTF \inputencodingname - { - \tl_set:Nn \l__siunitx_tmpa_tl { latin1 , latin5 , latin9 } - \clist_if_in:NVF \l__siunitx_tmpa_tl \inputencodingname - { - \cs_set_eq:NN \__siunitx_unit_format_literal_extras: - \scan_stop: - } - } - { - \cs_set_eq:NN \__siunitx_unit_format_literal_extras: - \scan_stop: - } - } - } -\cs_new_protected:Npn \__siunitx_unit_format_power: { - \tl_set:Nx \l__siunitx_tmpa_tl - { power- \int_use:N \l__siunitx_unit_int } - \prop_get:NVNTF \l__siunitx_unit_prop \l__siunitx_tmpa_tl - \l__siunitx_tmpa_tl - { \__siunitx_unit_format_power_aux: } - { - \tl_set:Nx \l__siunitx_tmpa_tl - { per- \int_use:N \l__siunitx_unit_int } - \prop_if_in:NVT \l__siunitx_unit_prop \l__siunitx_tmpa_tl - { - \tl_set:Nn \l__siunitx_tmpa_tl { 1 } - \__siunitx_unit_format_power_aux: - } - } -} -\cs_new_protected:Npn \__siunitx_unit_format_power_aux: { - \str_if_eq:VnTF \l__siunitx_per_mode_tl { repeat } - { \__siunitx_unit_format_power_repeat: } - { \__siunitx_unit_format_power_per: } - \str_if_eq:VnF \l__siunitx_tmpa_tl { 1 } - { - \__siunitx_unit_format_power_brackets: - \tl_put_right:Nx \l__siunitx_unit_current_tl - { - \exp_not:N \PrintSuperscript - { - \__siunitx_unit_format_power_aux:n - { \exp_not:V \l__siunitx_tmpa_tl } - } - } - } -} -\cs_new_protected:Npn \__siunitx_unit_format_power_aux:n #1 { - \bool_if:NTF \l__siunitx_power_number_bool - { \__siunitx_unit_format_power_aux:nn { number } {#1} } - { \__siunitx_unit_format_power_aux:nn { unit } {#1} } -} -\cs_new_protected:Npn \__siunitx_unit_format_power_aux:nn #1#2 { - \bool_if:cTF { l__siunitx_ #1 _math_mode_bool } - { \__siunitx_print:nn {#1} {#2} } - { - \tl_set:Nn \l__siunitx_tmpa_tl {#2} - \tl_replace_all:Nnn \l__siunitx_tmpa_tl { - } - { \text { \c__siunitx_minus_tl } } - \__siunitx_print:nV {#1} \l__siunitx_tmpa_tl - } -} -\cs_new_protected:Npn \__siunitx_unit_format_power_brackets: { - \tl_set:Nx \l__siunitx_tmpb_tl - { bracket- \int_use:N \l__siunitx_unit_int } - \prop_if_in:NVT \l__siunitx_unit_prop \l__siunitx_tmpb_tl - { - \tl_put_left:NV \l__siunitx_unit_current_tl \l__siunitx_bracket_open_tl - \tl_put_right:NV \l__siunitx_unit_current_tl \l__siunitx_bracket_close_tl - } -} -\cs_new_protected:Npn \__siunitx_unit_format_power_per: { - \tl_set:Nx \l__siunitx_tmpb_tl - { per- \int_use:N \l__siunitx_unit_int } - \prop_if_in:NVT \l__siunitx_unit_prop \l__siunitx_tmpb_tl - { - \bool_if:NF \l__siunitx_per_fraction_bool - { - \tl_if_in:NnTF \l__siunitx_tmpa_tl { - } - { - \cs_set:Npn \__siunitx_tmp:w ##1 - ##2 \q_stop - { \tl_set:Nn \l__siunitx_tmpa_tl {##2} } - \exp_after:wN \__siunitx_tmp:w \l__siunitx_tmpa_tl \q_stop - } - { \tl_put_left:Nn \l__siunitx_tmpa_tl { - } } - } - } -} -\cs_new_protected:Npn \__siunitx_unit_format_power_repeat: { - \tl_set:Nx \l__siunitx_tmpb_tl - { per- \int_use:N \l__siunitx_unit_int } - \prop_if_in:NVT \l__siunitx_unit_prop \l__siunitx_tmpb_tl - { - \tl_put_left:NV \l__siunitx_unit_current_tl \l__siunitx_per_symbol_tl - } -} -\cs_new_protected:Npn \__siunitx_unit_format_prefix: { - \tl_set:Nx \l__siunitx_tmpa_tl - { prefix-symbol- \int_use:N \l__siunitx_unit_int } - \prop_if_in:NVT \l__siunitx_unit_prop \l__siunitx_tmpa_tl - { - \prop_get:NVN \l__siunitx_unit_prop \l__siunitx_tmpa_tl - \l__siunitx_unit_prefix_current_tl - \bool_if:NTF \l__siunitx_prefix_symbols_bool - { \__siunitx_unit_format_prefix_symbol: } - { \__siunitx_unit_format_prefix_number: } - } -} -\cs_new_protected:Npn \__siunitx_unit_format_prefix_number: { - \tl_set:Nx \l__siunitx_tmpa_tl - { prefix-base- \int_use:N \l__siunitx_unit_int } - \prop_get:NVN \l__siunitx_unit_prop \l__siunitx_tmpa_tl - \l__siunitx_tmpa_tl - \int_compare:nNnT { \l__siunitx_unit_prefix_base_int } = { 0 } - { - \int_set:Nn \l__siunitx_unit_prefix_base_int - { \l__siunitx_tmpa_tl } - } - \int_compare:nNnTF - { \l__siunitx_unit_prefix_base_int } = { \l__siunitx_tmpa_tl } - { \__siunitx_unit_format_prefix_number_calc: } - { \msg_error:nn { siunitx } { prefix-base-mismatch } } -} -\cs_new_protected:Npn \__siunitx_unit_format_prefix_number_calc: { - \tl_set:Nx \l__siunitx_tmpa_tl - { power- \int_use:N \l__siunitx_unit_int } - \prop_get:NVNF \l__siunitx_unit_prop \l__siunitx_tmpa_tl - \l__siunitx_tmpa_tl - { \tl_set:Nn \l__siunitx_tmpa_tl { 1 } } - \tl_set:Nx \l__siunitx_tmpb_tl - { unit- \int_use:N \l__siunitx_unit_int } - \prop_get:NVN \l__siunitx_unit_prop \l__siunitx_tmpb_tl - \l__siunitx_tmpb_tl - \str_if_eq:VnT \l__siunitx_tmpb_tl { \gram } - { - \tl_set:Nx \l__siunitx_unit_prefix_current_tl - { \int_eval:n { \l__siunitx_unit_prefix_current_tl - 3 } } - \tl_set:Nx \l__siunitx_tmpb_tl - { symbol- \int_use:N \l__siunitx_unit_int } - \prop_put:NVn \l__siunitx_unit_prop \l__siunitx_tmpb_tl { kg } - } - \tl_set:Nx \l__siunitx_unit_prefix_current_tl - { - \int_eval:n - { \l__siunitx_unit_prefix_current_tl * \l__siunitx_tmpa_tl } - } - \tl_set:Nx \l__siunitx_tmpa_tl - { per- \int_use:N \l__siunitx_unit_int } - \prop_if_in:NVTF \l__siunitx_unit_prop \l__siunitx_tmpa_tl - { - \int_set:Nn \l__siunitx_unit_prefix_int - { - \l__siunitx_unit_prefix_int - - \l__siunitx_unit_prefix_current_tl - } - } - { - \int_set:Nn \l__siunitx_unit_prefix_int - { - \l__siunitx_unit_prefix_int - + \l__siunitx_unit_prefix_current_tl - } - } -} -\cs_new_protected:Npn \__siunitx_unit_format_prefix_symbol: { - \tl_set_eq:NN \l__siunitx_unit_current_tl - \l__siunitx_unit_prefix_current_tl -} -\cs_new_protected:Npn \__siunitx_unit_format_qualifier: { - \tl_set:Nx \l__siunitx_tmpa_tl - { qualifier- \int_use:N \l__siunitx_unit_int } - \prop_get:NVNT \l__siunitx_unit_prop \l__siunitx_tmpa_tl - \l__siunitx_tmpa_tl - { - \use:c - { - __siunitx_unit_format_qualifier_ - \l__siunitx_qualifier_mode_tl : - } - } -} -\cs_new_protected:Npn \__siunitx_unit_format_qualifier_brackets: { - \tl_put_right:NV \l__siunitx_unit_current_tl \l__siunitx_bracket_open_tl - \tl_put_right:NV \l__siunitx_unit_current_tl \l__siunitx_tmpa_tl - \tl_put_right:NV \l__siunitx_unit_current_tl \l__siunitx_bracket_close_tl -} -\cs_new_protected:Npn \__siunitx_unit_format_qualifier_phrase: - { - \tl_put_right:NV \l__siunitx_unit_current_tl \l__siunitx_qualifier_phrase_tl - \tl_put_right:NV \l__siunitx_unit_current_tl \l__siunitx_tmpa_tl - \tl_set:Nx \l__siunitx_tmpa_tl - { bracket- \int_use:N \l__siunitx_unit_int } - \prop_put:NVn \l__siunitx_unit_prop \l__siunitx_tmpa_tl { true } - } -\char_set_catcode_active:N \~ -\cs_new_protected:Npn \__siunitx_unit_format_qualifier_space: { - \tl_put_right:Nn \l__siunitx_unit_current_tl { \text { ~ } } - \tl_put_right:NV \l__siunitx_unit_current_tl \l__siunitx_tmpa_tl - \tl_set:Nx \l__siunitx_tmpa_tl - { bracket- \int_use:N \l__siunitx_unit_int } - \prop_put:NVn \l__siunitx_unit_prop \l__siunitx_tmpa_tl { true } -} -\char_set_catcode_space:N \~ -\cs_new_protected:Npn \__siunitx_unit_format_qualifier_subscript: { - \tl_put_right:Nx \l__siunitx_unit_current_tl - { \exp_not:N \PrintSubscript { \exp_not:V \l__siunitx_tmpa_tl } } -} -\cs_new_protected:Npn \__siunitx_unit_format_qualifier_text: { - \tl_put_right:NV \l__siunitx_unit_current_tl \l__siunitx_tmpa_tl -} -\cs_new_protected:Npn \__siunitx_unit_format_sorted: - { - \tl_set:Nx \l__siunitx_unit_tl - { - \exp_not:V \l__siunitx_unit_numerator_tl - \bool_lazy_or:nnF - { \tl_if_empty_p:N \l__siunitx_unit_numerator_tl } - { \tl_if_empty_p:N \l__siunitx_unit_denominator_tl } - { - \exp_not:N \l__siunitx_unit_product_tl - } - \exp_not:V \l__siunitx_unit_denominator_tl - } - } -\cs_new_protected:Npn \__siunitx_unit_format_symbol: { - \tl_set:Nx \l__siunitx_tmpa_tl - { symbol- \int_use:N \l__siunitx_unit_int } - \prop_get:NVNTF \l__siunitx_unit_prop \l__siunitx_tmpa_tl - \l__siunitx_tmpa_tl - { - \tl_put_right:NV \l__siunitx_unit_current_tl \l__siunitx_tmpa_tl - } - { \__siunitx_unit_format_symbol_aux: } -} -\cs_new_protected:Npn \__siunitx_unit_format_symbol_aux: { - \msg_error:nn { siunitx } { prefix-only } -} -\cs_new_protected:Npn \__siunitx_unit_format_symbol_aux_alt: { - \int_compare:nNnTF { \l__siunitx_unit_int } = { 1 } - { - \prop_remove:Nn \l__siunitx_unit_prop { prefix-1 } - \prop_remove:Nn \l__siunitx_unit_prop { prefix-symbol-1 } - \prop_remove:Nn \l__siunitx_unit_prop { prefix-base-1 } - \prop_remove:Nn \l__siunitx_unit_prop { total-units } - \prop_if_empty:NF \l__siunitx_unit_prop - { \msg_error:nn { siunitx } { prefix-only } } - } - { \msg_error:nn { siunitx } { prefix-only } } -} -\bool_new:N \l__siunitx_multi_brackets_bool -\bool_new:N \l__siunitx_multi_repeat_bool -\bool_new:N \l__siunitx_product_brackets_bool -\bool_new:N \l__siunitx_product_power_bool -\bool_new:N \l__siunitx_product_repeat_bool -\bool_new:N \l__siunitx_number_unit_repeat_bool -\keys_define:nn { siunitx } { - allow-number-unit-breaks .bool_set:N = - \l__siunitx_number_unit_breaks_bool, - multi-part-units .choice:, - multi-part-units - / brackets .code:n = - { - \bool_set_true:N \l__siunitx_multi_brackets_bool - \bool_set_false:N \l__siunitx_multi_repeat_bool - }, - multi-part-units - / repeat .code:n = - { - \bool_set_false:N \l__siunitx_multi_brackets_bool - \bool_set_true:N \l__siunitx_multi_repeat_bool - }, - multi-part-units - / single .code:n = - { - \bool_set_false:N \l__siunitx_multi_brackets_bool - \bool_set_false:N \l__siunitx_multi_repeat_bool - }, - number-unit-product .tl_set:N = - \l__siunitx_number_unit_product_tl, - number-unit-separator .tl_set:N = - \l__siunitx_number_unit_product_tl, - product-units .choice:, - product-units - / brackets .code:n = - { - \bool_set_true:N \l__siunitx_product_brackets_bool - \bool_set_false:N \l__siunitx_product_power_bool - \bool_set_false:N \l__siunitx_product_repeat_bool - }, - product-units - / brackets-power .code:n = - { - \bool_set_true:N \l__siunitx_product_brackets_bool - \bool_set_true:N \l__siunitx_product_power_bool - \bool_set_false:N \l__siunitx_product_repeat_bool - }, - product-units - / power .code:n = - { - \bool_set_false:N \l__siunitx_product_brackets_bool - \bool_set_true:N \l__siunitx_product_power_bool - \bool_set_false:N \l__siunitx_product_repeat_bool - }, - product-units - / repeat .code:n = - { - \bool_set_false:N \l__siunitx_product_brackets_bool - \bool_set_false:N \l__siunitx_product_power_bool - \bool_set_true:N \l__siunitx_product_repeat_bool - }, - product-units - / single .code:n = - { - \bool_set_false:N \l__siunitx_product_brackets_bool - \bool_set_false:N \l__siunitx_product_power_bool - \bool_set_false:N \l__siunitx_product_repeat_bool - }, -} -\keys_set:nn { siunitx } { - multi-part-units = brackets, - number-unit-product = \, , - product-units = repeat -} -\cs_new_protected:Npn \__siunitx_unit_output:nn #1#2 { - \cs_set_eq:NN \__siunitx_unit_format_symbol_aux: - \__siunitx_unit_format_symbol_aux_alt: - \cs_set_eq:NN \__siunitx_unit_format_fraction_symbol_aux_ii: - \__siunitx_unit_format_fraction_symbol_aux_alt: - \__siunitx_unit_in:nn {#1} {#2} - \int_compare:nNnTF { \l__siunitx_unit_prefix_int } = { 0 } - { - \str_if_eq:VnT \l__siunitx_per_mode_tl { symbol } - { - \int_compare:nNnT { \l__siunitx_unit_numerator_int } = { 0 } - { - \bool_if:NT \l__siunitx_unit_parse_bool - { \__siunitx_print:nn { unit } { 1 } } - } - } - } - { - \tl_set:Nx \l__siunitx_tmpa_tl - { - \int_use:N \l__siunitx_unit_prefix_base_int - \exp_not:N \PrintSuperscript - { \int_use:N \l__siunitx_unit_prefix_int } - } - \__siunitx_print:nV { number } \l__siunitx_tmpa_tl - \__siunitx_unit_output_number_sep: - } - \__siunitx_print:nV { unit } \l__siunitx_unit_tl -} -\cs_generate_variant:Nn \__siunitx_unit_output:nn { V } -\cs_new_protected:Npn \__siunitx_unit_output_number_sep: { - \bool_if:NTF \l__siunitx_number_unit_breaks_bool - { \penalty \binoppenalty } { \nobreak } - \bool_if:NTF \l__siunitx_per_auto_bool - { - \mode_if_math:TF - { - \tex_mathchoice:D - { \l__siunitx_number_unit_product_tl } - { \__siunitx_unit_output_number_sep_aux: } - { \__siunitx_unit_output_number_sep_aux: } - { \__siunitx_unit_output_number_sep_aux: } - } - { \__siunitx_unit_output_number_sep_aux: } - } - { \__siunitx_unit_output_number_sep_aux: } -} -\cs_new_protected:Npn \__siunitx_unit_output_number_sep_aux: { - \bool_if:NF \l__siunitx_omit_unit_space_bool - { \l__siunitx_number_unit_product_tl } -} -\cs_new_protected:Npn \__siunitx_unit_output_pre_print: { - \tl_if_empty:NF \l__siunitx_pre_unit_tl - { - \nobreak - \__siunitx_print:nV { unit } \l__siunitx_pre_unit_tl - } -} -\cs_new_protected:Npn \__siunitx_unit_output_print: { - \int_compare:nNnF { \l__siunitx_unit_prefix_int } = { 0 } - { - \tl_set:Nx \l__siunitx_tmpa_tl - { - \bool_if:NTF \l__siunitx_tight_bool - { - \exp_not:N \ensuremath - { { \exp_not:V \l__siunitx_exponent_product_tl } } - } - { - \exp_not:N \ensuremath - { { } \exp_not:V \l__siunitx_exponent_product_tl { } } - } - \int_use:N \l__siunitx_unit_prefix_base_int - ^ { \int_use:N \l__siunitx_unit_prefix_int } - } - \__siunitx_print:nV { number } \l__siunitx_tmpa_tl - } - \tl_if_empty:NF \l__siunitx_unit_tl - { - \__siunitx_unit_output_number_sep: - \__siunitx_print:nV { unit } \l__siunitx_unit_tl - } -} -\keys_define:nn { siunitx } { - preunit .tl_set:N = \l__siunitx_preunit_tl , -} -\tl_new:N \l__siunitx_pre_unit_tl -\int_new:N \l__siunitx_number_product_int -\cs_new_protected:Npn \__siunitx_combined:nnnn #1#2#3#4 { - \IfNoValueTF {#3} - { \tl_clear:N \l__siunitx_pre_unit_tl } - { - \group_begin: - \__siunitx_unit_in:nn {#3} {#1} - \cs_set_eq:NN \l__siunitx_pre_unit_tl \l__siunitx_unit_tl - \exp_args:NNNo \group_end: - \tl_set:Nn \l__siunitx_pre_unit_tl { \l__siunitx_unit_tl } - } - \cs_set_eq:NN \l__siunitx_brackets_bool - \l__siunitx_multi_brackets_bool - \__siunitx_combined_unit:nnn {#2} {#4} {#1} - \__siunitx_combined_output:n {#2} -} -\cs_new_protected:Npn \__siunitx_combined_output:n #1 { - \bool_if:NTF \l__siunitx_number_parse_bool - { - \tl_clear:N \l__siunitx_number_out_tl - \bool_set_false:N \l__siunitx_number_compound_bool - \__siunitx_number_output_parse:n {#1} - } - { - \__siunitx_unit_output_pre_print: - \__siunitx_print:nn { number } { \ensuremath {#1} } - \__siunitx_unit_output_print: - } -} -\cs_new_protected:Npn \__siunitx_combined_unit:nnn #1#2#3 { - \bool_if:NTF \l__siunitx_product_power_bool - { - \__siunitx_combined_product_count:n {#1} - \int_compare:nNnTF { \l__siunitx_number_product_int } > { 0 } - { - \int_incr:N \l__siunitx_number_product_int - \tl_set:Nn \l__siunitx_tmpa_tl {#2} - \tl_set:Nx \l__siunitx_tmpb_tl - { \tothe { \exp_not:V \l__siunitx_number_product_int } } - \tl_put_right:NV \l__siunitx_tmpa_tl \l__siunitx_tmpb_tl - \__siunitx_unit_in:Vn \l__siunitx_tmpa_tl {#3} - } - { \__siunitx_unit_in:nn {#2} {#3} } - } - { \__siunitx_unit_in:nn {#2} {#3} } -} -\cs_new_protected:Npn \__siunitx_combined_product_count:n #1 { - \int_zero:N \l__siunitx_number_product_int - \tl_set:Nn \l__siunitx_tmpa_tl {#1} - \tl_map_function:NN \l__siunitx_input_product_tl - \__siunitx_combined_product_count_aux:N -} -\cs_new_protected:Npn \__siunitx_combined_product_count_aux:N #1 { - \tl_if_in:NnT \l__siunitx_tmpa_tl {#1} - { - \int_incr:N \l__siunitx_number_product_int - \tl_remove_once:Nn \l__siunitx_tmpa_tl {#1} - \__siunitx_combined_product_count_aux:N #1 - } -} -\bool_new:N \l__siunitx_list_brackets_bool -\bool_new:N \l__siunitx_list_repeat_bool -\tl_new:N \l__siunitx_list_current_tl -\tl_new:N \l__siunitx_list_tl -\keys_define:nn { siunitx } - { - list-final-separator .tl_set:N = \l__siunitx_list_separator_final_tl , - list-pair-separator .tl_set:N = \l__siunitx_list_separator_pair_tl , - list-separator .tl_set:N = \l__siunitx_list_separator_tl , - list-units .choice:, - list-units - / brackets .code:n = - { - \bool_set_true:N \l__siunitx_list_brackets_bool - \bool_set_false:N \l__siunitx_list_repeat_bool - }, - list-units - / repeat .code:n = - { - \bool_set_false:N \l__siunitx_list_brackets_bool - \bool_set_true:N \l__siunitx_list_repeat_bool - }, - list-units - / single .code:n = - { - \bool_set_false:N \l__siunitx_list_brackets_bool - \bool_set_false:N \l__siunitx_list_repeat_bool - } - } -\keys_set:nn { siunitx } - { - list-final-separator = { ~ and ~ } , - list-pair-separator = { ~ and ~ } , - list-separator = { , ~ } , - list-units = repeat -} -\cs_new_protected:Npn \__siunitx_list_numbers:n #1 - { - \tl_clear:N \l__siunitx_unit_tl - \tl_clear:N \l__siunitx_preunit_tl - \__siunitx_list_numbers_aux_i:n {#1} - } -\cs_new_protected:Npn \__siunitx_list_numbers_aux_i:n #1 - { - \bool_set_true:N \l__siunitx_list_first_bool - \tl_clear:N \l__siunitx_list_current_tl - \int_compare:nNnTF { \tl_count:n {#1} } > 2 - { - \tl_map_function:nN {#1} \__siunitx_list_numbers_aux_ii:n - \l__siunitx_list_tl - \l__siunitx_list_separator_final_tl - \l__siunitx_list_current_tl - } - { - \int_compare:nNnTF { \tl_count:n {#1} } = 2 - { \__siunitx_list_numbers_aux:nn #1 } - { \__siunitx_combined_output:n #1 } - } - } -\cs_new_protected:Npn \__siunitx_list_numbers_aux_ii:n #1 - { - \tl_if_empty:NTF \l__siunitx_list_tl - { \tl_set_eq:NN \l__siunitx_list_tl \l__siunitx_list_current_tl } - { - \tl_put_right:NV \l__siunitx_list_tl \l__siunitx_list_separator_tl - \tl_put_right:NV \l__siunitx_list_tl \l__siunitx_list_current_tl - } - \tl_set:Nn \l__siunitx_list_current_tl { \__siunitx_combined_output:n {#1} } - } -\cs_new_protected:Npn \__siunitx_list_numbers_aux:nn #1#2 - { - \__siunitx_combined_output:n {#1} - \l__siunitx_list_separator_pair_tl - \__siunitx_combined_output:n {#2} - } -\cs_new_protected:Npn \__siunitx_list_units:nnn #1#2#3 - { - \__siunitx_unit_parse_options:nn {#2} {#3} - \bool_if:NTF \l__siunitx_list_repeat_bool - { - \__siunitx_unit_in:nn {#2} {#3} - \__siunitx_list_numbers_aux_i:n {#1} - } - { - \bool_if:NT \l__siunitx_process_fixed_bool - { \bool_set_true:N \l__siunitx_process_drop_exponent_bool } - \bool_if:NT \l__siunitx_list_brackets_bool - { \__siunitx_print:nV { number } \l__siunitx_bracket_open_tl } - \__siunitx_list_numbers:n {#1} - \bool_if:NT \l__siunitx_list_brackets_bool - { \__siunitx_print:nV { number } \l__siunitx_bracket_close_tl } - \__siunitx_range_exponent: - \__siunitx_unit_output_number_sep: - \__siunitx_unit_output:nn {#2} {#3} - } - } -\bool_new:N \l__siunitx_range_brackets_bool -\bool_new:N \l__siunitx_range_repeat_bool -\keys_define:nn { siunitx } { - range-phrase .tl_set:N = \l__siunitx_range_phrase_tl, - range-units .choice:, - range-units - / brackets .code:n = - { - \bool_set_true:N \l__siunitx_range_brackets_bool - \bool_set_false:N \l__siunitx_range_repeat_bool - }, - range-units - / repeat .code:n = - { - \bool_set_false:N \l__siunitx_range_brackets_bool - \bool_set_true:N \l__siunitx_range_repeat_bool - }, - range-units - / single .code:n = - { - \bool_set_false:N \l__siunitx_range_brackets_bool - \bool_set_false:N \l__siunitx_range_repeat_bool - }, -} -\keys_set:nn { siunitx } { - range-phrase = { ~ to ~ }, - range-units = repeat, -} -\cs_new_protected:Npn \__siunitx_range_numbers:nn #1#2 - { - \__siunitx_range_numbers_aux:n {#1} - \l__siunitx_range_phrase_tl - \__siunitx_range_numbers_aux:n {#2} - } -\cs_new_protected:Npn \__siunitx_range_numbers_aux:n #1 - { - \bool_if:NTF \l__siunitx_number_parse_bool - { - \tl_clear:N \l__siunitx_number_out_tl - \tl_clear:N \l__siunitx_number_out_saved_tl - \bool_set_false:N \l__siunitx_number_compound_bool - \__siunitx_number_output_parse:n {#1} - \bool_if:NT \l__siunitx_number_compound_bool - { \msg_error:nnx { siunitx } { multi-part-range } {#1} } - } - { - \__siunitx_unit_output_pre_print: - \__siunitx_print:nn { number } {#1} - \__siunitx_unit_output_print: - } - } -\cs_new_protected:Npn \__siunitx_range_unit:nnnn #1#2#3#4 { - \__siunitx_unit_parse_options:nn {#1} {#2} - \bool_if:NTF \l__siunitx_range_repeat_bool - { - \__siunitx_unit_in:nn {#1} {#2} - \__siunitx_range_numbers_aux:n {#3} - \l__siunitx_range_phrase_tl - \__siunitx_range_numbers_aux:n {#4} - } - { - \bool_if:NT \l__siunitx_process_fixed_bool - { \bool_set_true:N \l__siunitx_process_drop_exponent_bool } - \bool_if:NT \l__siunitx_range_brackets_bool - { \__siunitx_print:nV { number } \l__siunitx_bracket_open_tl } - \__siunitx_range_numbers:nn {#3} {#4} - \bool_if:NT \l__siunitx_range_brackets_bool - { \__siunitx_print:nV { number } \l__siunitx_bracket_close_tl } - \__siunitx_range_exponent: - \__siunitx_unit_output_number_sep: - \__siunitx_unit_output:nn {#1} {#2} - } -} -\cs_new_protected:Npn \__siunitx_range_exponent: - { - \bool_if:NT \l__siunitx_process_fixed_bool - { - \tl_set_eq:NN \l__siunitx_tmpa_tl \l__siunitx_exponent_product_tl - \bool_if:NT \l__siunitx_tight_bool - { - \tl_set:Nx \l__siunitx_tmpa_tl - { \exp_not:N \mathord \exp_not:o \l__siunitx_tmpa_tl } - } - \tl_set:Nx \l__siunitx_tmpa_tl - { - \exp_not:N \ensuremath { { } \exp_not:o \l__siunitx_tmpa_tl { } } - 10 \exp_not:N \PrintSuperscript - { \int_use:N \l__siunitx_process_fixed_int } - } - \__siunitx_print:nV { number } \l__siunitx_tmpa_tl - } - } -\AtBeginDocument { - \@ifpackageloaded { cellspace } - { - \newcolumntype { C } [1] - { > { \bcolumn #1 \@nil } #1 < { \ecolumn } } - \cs_set:Npn \__siunitx_tmp:w #1 \NC@do S #2 \q_stop - { \NC@list { #1 #2 } } - \exp_after:wN \__siunitx_tmp:w \tex_the:D \NC@list \q_stop - \cs_undefine:N \NC@find@S - \msg_new:nnn { siunitx } { moved-cellspace-column } - { Column~type~for~cellspace~package~moved~to~'#1'. } - \msg_warning:nnn { siunitx } { moved-cellspace-column } { C } - \ifcellspace@m - \def \env@matrix - { - \hskip -\arraycolsep - \let \@ifnextchar \new@ifnextchar - \array - { - * { \c@MaxMatrixCols } - { > { \bcolumn c \@nil $ } c < { $ \ecolumn } } @ { } - } - } - \fi - } - { } -} -\cs_new_protected:Npn \__siunitx_table_rewrite_create:N #1 { - \newcolumntype {#1} { } - \cs_set_protected:Npn - \__siunitx_table_rewrite_create_aux:w \NC@do ##1##2 \NC@do #1 - { \NC@list { \NC@do ##1 \NC@do #1 ##2 } } - \exp_after:wN \__siunitx_table_rewrite_create_aux:w \tex_the:D \NC@list - \exp_args:NNc \renewcommand * { NC@rewrite@ #1 } [1] [ ] - { - \@temptokena \exp_after:wN - { - \tex_the:D \@temptokena - > { \__siunitx_table_collect_begin:Nn #1 {##1} } - c - < { \__siunitx_table_print: } - } - \NC@find - } -} -\AtBeginDocument - { - \@ifpackageloaded { mdwtab } - { - \cs_set_protected:Npn \__siunitx_table_rewrite_create:N #1 - { - \newcolumntype {#1} [1] [] - { - > { \__siunitx_table_collect_begin:Nn #1 {##1} } - c - < { \__siunitx_table_print: } - } - } - } - { } - } -\cs_new_protected:Npn \__siunitx_table_rewrite_create_aux:w { } -\AtBeginDocument { \__siunitx_table_rewrite_create:N s } -\AtBeginDocument { \__siunitx_table_rewrite_create:N S } -\tl_new:N \l__siunitx_table_collect_tl -\tl_new:N \l__siunitx_table_collect_pre_tl -\tl_new:N \l__siunitx_table_collect_post_tl -\tl_new:N \l__siunitx_number_valid_tl -\bool_new:N \l__siunitx_table_math_bool -\bool_new:N \l__siunitx_table_collect_pre_bool -\bool_new:N \l__siunitx_table_collect_post_bool -\cs_new_protected:Npn \__siunitx_table_collect_begin:Nn #1#2 { - \keys_set:nn { siunitx } {#2} - \use:c { __siunitx_table_collect_begin_ #1 : } -} -\cs_new_protected:Npn \__siunitx_table_collect_begin_s: { - \cs_set_eq:NN \__siunitx_table_collect_token:N - \__siunitx_table_collect_token_s:N - \cs_set_eq:NN \__siunitx_table_print: \__siunitx_table_print_s: - \__siunitx_table_collect_init_s: - \__siunitx_table_collect_get: -} -\cs_new_protected:Npn \__siunitx_table_collect_begin_S: { - \cs_set_eq:NN \__siunitx_table_collect_token:N - \__siunitx_table_collect_token_S:N - \cs_set_eq:NN \__siunitx_table_print: \__siunitx_table_print_S: - \__siunitx_table_collect_init_S: - \__siunitx_detect_font: - \bool_if:NTF \l__siunitx_number_parse_bool - { \__siunitx_table_collect_get: } - { \__siunitx_table_print_S_direct:N } -} -\cs_new_protected:Npn \__siunitx_table_collect_braced:n #1 { } -\cs_new_protected:Npn \__siunitx_table_collect_expand:N #1 { - \cs_if_eq:NNTF #1 \color - { - \bool_if:NTF \l__siunitx_table_collect_pre_bool - { - \tl_clear:N \l__siunitx_number_color_tl - \tl_clear:N \l__siunitx_unit_color_tl - \tl_put_right:Nn \l__siunitx_table_collect_pre_tl {#1} - } - { - \bool_set_true:N \l__siunitx_table_collect_post_bool - \tl_put_right:Nn \l__siunitx_table_collect_post_tl {#1} - } - } - { - \__siunitx_cs_if_tl:NTF #1 - { - \tl_use:N \l__siunitx_table_collect_pre_tl - \tl_clear:N \l__siunitx_table_collect_pre_tl - \cs_set:Npn \__siunitx_table_collect_next: - { \exp_after:wN \__siunitx_table_collect_get: #1 } - } - { - \bool_if:NTF \l__siunitx_table_collect_pre_bool - { - \tl_put_right:Nn \l__siunitx_table_collect_pre_tl {#1} - \__siunitx_table_collect_expand_math:N #1 - } - { - \bool_set_true:N \l__siunitx_table_collect_post_bool - \tl_put_right:Nn \l__siunitx_table_collect_post_tl {#1} - } - } - } -} -\cs_new_protected:Npn \__siunitx_table_collect_expand_math:N #1 { - \token_if_math_toggle:NTF #1 - { - \bool_if:NTF \l__siunitx_table_math_bool - { \bool_set_false:N \l__siunitx_table_math_bool } - { \bool_set_true:N \l__siunitx_table_math_bool } - } - { - \cs_if_eq:NNTF #1 \( % \) - { \bool_set_true:N \l__siunitx_table_math_bool } - { % \( - \cs_if_eq:NNT #1 \) - { \bool_set_false:N \l__siunitx_table_math_bool } - } - } -} -\cs_new_protected:Npn \__siunitx_table_collect_get: { - \cs_set_eq:NN \__siunitx_table_collect_next: - \__siunitx_table_collect_get: - \cs_set:Npn \__peek_execute_branches: - { - \if_catcode:w \exp_not:N \l_peek_token \c_group_begin_token - \exp_after:wN \__siunitx_table_collect_braced:n - \else: - \exp_after:wN \__siunitx_table_collect_not_braced:N - \fi: - } - \peek_after:Nw \__peek_ignore_spaces_execute_branches: -} -\cs_new_protected:Npn \__siunitx_table_collect_init: { - \tl_clear:N \l__siunitx_table_collect_tl - \tl_clear:N \l__siunitx_table_collect_pre_tl - \tl_clear:N \l__siunitx_table_collect_post_tl - \bool_set_false:N \l__siunitx_table_collect_post_bool - \bool_set_false:N \l__siunitx_table_math_bool -} -\cs_new_protected:Npn \__siunitx_table_collect_init_s: { - \__siunitx_table_collect_init: - \bool_set_false:N \l__siunitx_table_collect_pre_bool - \cs_set_protected:Npn \__siunitx_table_collect_braced:n ##1 - { - \tl_put_right:Nn \l__siunitx_table_collect_tl { {##1} } - \__siunitx_table_collect_next: - } -} -\cs_new_protected:Npn \__siunitx_table_collect_init_S: { - \__siunitx_number_in_init: - \tl_set:Nx \l__siunitx_number_valid_tl - { - \exp_not:V \l__siunitx_input_complex_tl - \exp_not:V \l__siunitx_input_decimal_tl - \exp_not:V \l__siunitx_input_digit_tl - \exp_not:V \l__siunitx_input_exponent_tl - \exp_not:V \l__siunitx_input_ignore_tl - \exp_not:V \l__siunitx_input_comparator_tl - \exp_not:V \l__siunitx_input_uncert_close_tl - \exp_not:V \l__siunitx_input_uncert_open_tl - \exp_not:V \l__siunitx_input_sign_tl - \exp_not:V \l__siunitx_input_symbol_tl - } - \bool_set_true:N \l__siunitx_table_collect_pre_bool - \cs_set_protected:Npn \__siunitx_table_collect_braced:n ##1 - { - \bool_if:NTF \l__siunitx_table_collect_pre_bool - { \tl_put_right:Nn \l__siunitx_table_collect_pre_tl { {##1} } } - { - \bool_set_true:N \l__siunitx_table_collect_post_bool - \tl_put_right:Nn \l__siunitx_table_collect_post_tl { {##1} } - } - \__siunitx_table_collect_next: - } -} -\cs_new_protected:Npn \__siunitx_table_collect_next: { } -\cs_new_protected:Npn \__siunitx_table_collect_newline: { - \__siunitx_table_print: - \cs_set_eq:NN \__siunitx_table_print: \prg_do_nothing: - \tabularnewline -} -\cs_new_protected:Npn \__siunitx_table_collect_end: { - \__siunitx_table_print: - \cs_set_eq:NN \__siunitx_table_print: \prg_do_nothing: - \end -} -\cs_new_protected:Npn \__siunitx_table_collect_not_braced:N #1 - { - \token_if_eq_meaning:NNF #1 \tex_ignorespaces:D - { - \token_if_eq_meaning:NNF #1 \tex_unskip:D - { \__siunitx_table_collect_not_braced_aux_i:N #1 } - } - \__siunitx_table_collect_next: - } -\AtBeginDocument - { - \@ifpackageloaded { mdwtab } - { - \cs_set_protected:Npn \__siunitx_table_collect_not_braced:N #1 - { - \token_if_eq_meaning:NNF #1 \tex_ignorespaces:D - { - \token_if_eq_meaning:NNF #1 \tex_unskip:D - { - \token_if_eq_meaning:NNF #1 \tab@setcr - { - \token_if_eq_meaning:NNF #1 \@maybe@unskip - { \__siunitx_table_collect_not_braced_aux_i:N #1 } - } - } - } - \__siunitx_table_collect_next: - } - } - { } - } -\cs_new_protected:Npn \__siunitx_table_collect_not_braced_aux_i:N #1 { - \cs_set:Npn \__siunitx_table_collect_not_braced_aux_ii:N ##1 - { - \token_if_eq_meaning:NNT #1 ##1 - { \cs_set_eq:NN \__siunitx_table_collect_next: ##1 } - } - \tl_map_function:nN - { \cs:w \scan_stop: \__siunitx_table_print: } - \__siunitx_table_collect_not_braced_aux_ii:N - \token_if_eq_meaning:NNT \__siunitx_table_collect_next: - \__siunitx_table_collect_get: - { - \token_if_eq_meaning:NNTF #1 \tabularnewline - { - \cs_set_eq:NN \__siunitx_table_collect_next: - \__siunitx_table_collect_newline: - } - { - \token_if_eq_meaning:NNTF #1 \end - { - \cs_set_eq:NN \__siunitx_table_collect_next: - \__siunitx_table_collect_end: - } - { \__siunitx_table_collect_token:N #1 } - } - } -} -\cs_new_protected:Npn \__siunitx_table_collect_not_braced_aux_ii:N #1 { } -\cs_new_protected:Npn \__siunitx_table_collect_token:N #1 { } -\cs_new_protected:Npn \__siunitx_table_collect_token_s:N #1 { - \tl_put_right:Nn \l__siunitx_table_collect_tl {#1} -} -\cs_new_protected:Npn \__siunitx_table_collect_token_S:N #1 { - \bool_if:NTF \l__siunitx_table_collect_post_bool - { \tl_put_right:Nn \l__siunitx_table_collect_post_tl {#1} } - { - \tl_if_in:NnTF \l__siunitx_number_valid_tl {#1} - { - \bool_set_false:N \l__siunitx_table_collect_pre_bool - \tl_put_right:Nn \l__siunitx_table_collect_tl {#1} - } - { \__siunitx_table_collect_expand:N #1 } - } -} -\skip_new:N \c__siunitx_one_fill_skip -\skip_set:Nn \c__siunitx_one_fill_skip { 0pt plus 1fill } -\AtBeginDocument - { - \@ifpackageloaded { colortbl } - { - \cs_new_protected:Npn \__siunitx_table_colortbl_correction: - { - \skip_horizontal:n { 0pt plus -0.5fill } - \tex_kern:D \c_zero_skip - } - } - { \cs_new_protected:Npn \__siunitx_table_colortbl_correction: { } } - } -\cs_new_protected:Npn \__siunitx_table_align_left:n #1 - { - \__siunitx_table_colortbl_correction: - \skip_horizontal:n {#1} - \tex_kern:D \c_zero_skip - } -\cs_new_protected:Npn \__siunitx_table_align_right:n #1 - { - \skip_horizontal:n { \c__siunitx_one_fill_skip - #1 } - \tex_kern:D \c_zero_skip - \__siunitx_table_colortbl_correction: - } -\cs_new_eq:NN \__siunitx_table_column_begin:n \__siunitx_table_align_left:n -\cs_new_eq:NN \__siunitx_table_column_end:n \__siunitx_table_align_right:n -\keys_define:nn { siunitx } - { - table-column-width .code:n = - { - \dim_compare:nNnTF {#1} = { \c_zero_dim } - { - \cs_set_eq:NN \__siunitx_table_column_begin:n - \__siunitx_table_align_left:n - \cs_set_eq:NN \__siunitx_table_column_end:n - \__siunitx_table_align_right:n - } - { - \cs_set_protected:Npn \__siunitx_table_column_begin:n ##1 - { - \__siunitx_table_colortbl_correction: - \tex_hbox:D to \dim_eval:n {#1} - \c_group_begin_token - \skip_horizontal:n {##1} - \tex_kern:D \c_zero_skip - } - \cs_set_protected:Npn \__siunitx_table_column_end:n ##1 - { - \skip_horizontal:n { \c__siunitx_one_fill_skip - ##1 } - \tex_kern:D \c_zero_skip - \c_group_end_token - \__siunitx_table_colortbl_correction: - } - } - } - } -\skip_new:N \l__siunitx_table_unit_align_skip -\keys_define:nn { siunitx } - { - table-unit-alignment .choice:, - table-unit-alignment / - center .code:n = - { - \skip_set:Nn \l__siunitx_table_unit_align_skip - { 0pt plus 0.5fill } - }, - table-unit-alignment / - left .code:n = - { \skip_set:Nn \l__siunitx_table_unit_align_skip { \c_zero_skip } }, - table-unit-alignment / - right .code:n = - { - \skip_set:Nn \l__siunitx_table_unit_align_skip - { 0pt plus 1fill } - } - } -\keys_set:nn { siunitx } { table-unit-alignment = center } -\cs_new_protected:Npn \__siunitx_table_print_s: - { - \__siunitx_table_column_begin:n { \l__siunitx_table_unit_align_skip } - \tl_if_empty:NF \l__siunitx_table_collect_tl - { \__siunitx_unit_output:Vn \l__siunitx_table_collect_tl { } } - \__siunitx_table_column_end:n { \l__siunitx_table_unit_align_skip } - } -\prop_new:N \l__siunitx_table_model_prop -\dim_new:N \l__siunitx_table_exponent_dim -\dim_new:N \l__siunitx_table_integer_dim -\dim_new:N \l__siunitx_table_mantissa_dim -\dim_new:N \l__siunitx_table_marker_dim -\dim_new:N \l__siunitx_table_result_dim -\dim_new:N \l__siunitx_table_uncert_dim -\dim_new:N \l__siunitx_table_fill_pre_dim -\dim_new:N \l__siunitx_table_fill_post_dim -\dim_new:N \l__siunitx_table_fill_mid_dim -\box_new:N \l__siunitx_table_pre_box -\box_new:N \l__siunitx_table_post_box -\box_new:N \l__siunitx_table_mantissa_box -\box_new:N \l__siunitx_table_result_box -\skip_new:N \l__siunitx_table_number_align_skip -\skip_new:N \l__siunitx_table_text_align_skip -\cs_new_protected:Npn \__siunitx_table_print_S_direct_main: { } -\cs_new_protected:Npn \__siunitx_table_print_S_parsed: { } -\cs_new_protected:Npn \__siunitx_table_print_S_reserved_store_fill:n #1 { } -\keys_define:nn { siunitx } - { - table-align-comparator .choice:, - table-align-comparator / - false .code:n = - { - \cs_set_eq:NN \__siunitx_table_print_S_reserved_store_fill:n - \__siunitx_table_print_S_reserved_store_fill_pre:n - }, - table-align-comparator / - true .code:n = - { - \cs_set_eq:NN \__siunitx_table_print_S_reserved_store_fill:n - \__siunitx_table_print_S_reserved_store_fill_mid:n - }, - table-align-comparator .default:n = true, - table-align-exponent .bool_set:N = - \l__siunitx_table_align_exponent_bool, - table-align-text-pre .bool_set:N = - \l__siunitx_table_align_text_pre_bool, - table-align-text-post .bool_set:N = - \l__siunitx_table_align_text_post_bool, - table-align-uncertainty .bool_set:N = \l__siunitx_table_align_uncert_bool, - table-auto-round .bool_set:N = \l__siunitx_table_auto_round_bool, - table-number-alignment .choice:, - table-number-alignment / - center .code:n = - { - \skip_set:Nn \l__siunitx_table_number_align_skip - { 0pt plus 0.5fill } - \cs_set_eq:NN \__siunitx_table_print_S_direct_main: - \__siunitx_table_print_S_direct_reserved: - \cs_set_eq:NN \__siunitx_table_print_S_parsed: - \__siunitx_table_print_S_reserved: - }, - table-number-alignment / - center-decimal-marker .code:n = - { - \skip_set:Nn \l__siunitx_table_number_align_skip - { 0pt plus 0.5fill } - \cs_set_eq:NN \__siunitx_table_print_S_direct_main: - \__siunitx_table_print_S_direct_centered: - \cs_set_eq:NN \__siunitx_table_print_S_parsed: - \__siunitx_table_print_S_centered: - }, - table-number-alignment / - left .code:n = - { - \skip_zero:N \l__siunitx_table_number_align_skip - \cs_set_eq:NN \__siunitx_table_print_S_direct_main: - \__siunitx_table_print_S_direct_reserved: - \cs_set_eq:NN \__siunitx_table_print_S_parsed: - \__siunitx_table_print_S_reserved: - }, - table-number-alignment / - right .code:n = - { - \skip_set:Nn \l__siunitx_table_number_align_skip - { 0pt plus 1fill } - \cs_set_eq:NN \__siunitx_table_print_S_direct_main: - \__siunitx_table_print_S_direct_reserved: - \cs_set_eq:NN \__siunitx_table_print_S_parsed: - \__siunitx_table_print_S_reserved: - }, - table-omit-exponent .bool_set:N = - \l__siunitx_table_omit_exponent_bool, - table-text-alignment .choice:, - table-text-alignment / - center .code:n = - { - \skip_set:Nn \l__siunitx_table_text_align_skip - { 0pt plus 0.5fill } - }, - table-text-alignment / - left .code:n = - { \skip_zero:N \l__siunitx_table_text_align_skip }, - table-text-alignment / - right .code:n = - { - \skip_set:Nn \l__siunitx_table_text_align_skip - { 0pt plus 1fill } - }, - table-comparator .choice:, - table-comparator / - false .code:n = - { \prop_remove:Nn \l__siunitx_table_model_prop { comparator } }, - table-comparator / - true .code:n = - { \prop_put:Nnn \l__siunitx_table_model_prop { comparator } { > } }, - table-comparator .default:n = true, - table-figures-decimal .code:n = - { - \int_compare:nNnTF {#1} = 0 - { - \prop_remove:Nn \l__siunitx_table_model_prop { mantissa-decimal } - \prop_remove:Nn \l__siunitx_table_model_prop { mantissa-decimal-raw } - \prop_remove:Nn \l__siunitx_table_model_prop - { mantissa-decimal-marker } - \prop_if_in:NnTF \l__siunitx_table_model_prop { mantissa-integer } - { - \prop_put:Nnn \l__siunitx_table_model_prop { mantissa } - { true } - } - { \prop_remove:Nn \l__siunitx_table_model_prop { mantissa } } - } - { - \prop_put:Nnx \l__siunitx_table_model_prop { mantissa-decimal } - { \prg_replicate:nn {#1} { 8 } } - \prop_put:Nnn \l__siunitx_table_model_prop { mantissa-decimal-raw } - {#1} - \prop_put:Nnn \l__siunitx_table_model_prop { mantissa } { true } - \prop_put:NnV \l__siunitx_table_model_prop - { mantissa-decimal-marker } \l__siunitx_output_decimal_tl - } - }, - table-figures-exponent .code:n = - { - \int_compare:nNnTF {#1} = 0 - { \prop_remove:Nn \l__siunitx_table_model_prop { exponent-integer } } - { - \prop_put:Nnx \l__siunitx_table_model_prop { exponent-integer } - { \prg_replicate:nn {#1} { 8 } } - \prop_put:Nnn \l__siunitx_table_model_prop { exponent } { true } - } - }, - table-figures-integer .code:n = - { - \int_compare:nNnTF {#1} = 0 - { - \prop_remove:Nn \l__siunitx_table_model_prop { mantissa-integer } - \prop_if_in:NnTF \l__siunitx_table_model_prop { mantissa-decimal } - { - \prop_put:Nnn \l__siunitx_table_model_prop { mantissa } - { true } - } - { \prop_remove:Nn \l__siunitx_table_model_prop { mantissa } } - } - { - \prop_put:Nnx \l__siunitx_table_model_prop { mantissa-integer } - { \prg_replicate:nn {#1} { 8 } } - \prop_put:Nnn \l__siunitx_table_model_prop { mantissa } { true } - } - }, - table-figures-uncertainty .code:n = - { - \int_compare:nNnTF {#1} = 0 - { \prop_remove:Nn \l__siunitx_table_model_prop { mantissa-uncertainty } } - { - \prop_put:Nnx \l__siunitx_table_model_prop { mantissa-uncertainty } - { \prg_replicate:nn {#1} { 8 } } - } - }, - table-parse-only .bool_set:N = \l__siunitx_table_parse_only_bool, - table-space-text-pre .tl_set:N = \l__siunitx_table_pre_tl, - table-space-text-post .tl_set:N = \l__siunitx_table_post_tl, - table-sign-exponent .choice:, - table-sign-exponent / true .code:n = - { \prop_put:Nnn \l__siunitx_table_model_prop { exponent-sign } { - } }, - table-sign-exponent / false .code:n = - { \prop_remove:Nn \l__siunitx_table_model_prop { exponent-sign } }, - table-sign-exponent .default:n = true, - table-sign-mantissa .choice:, - table-sign-mantissa / true .code:n = - { \prop_put:Nnn \l__siunitx_table_model_prop { mantissa-sign } { - } }, - table-sign-mantissa / false .code:n = - { \prop_remove:Nn \l__siunitx_table_model_prop { mantissa-sign } }, - table-sign-mantissa .default:n = true, - } -\keys_define:nn { siunitx } - { - table-alignment .meta:n = - { - table-number-alignment = #1, - table-text-alignment = #1, - table-unit-alignment = #1 - } - } -\keys_define:nn { siunitx } - { - table-format .code:n = - { - \bool_set_eq:NN \l__siunitx_process_plus_saved_bool \l__siunitx_process_plus_bool - \bool_set_true:N \l__siunitx_process_plus_bool - \__siunitx_number_in_parse:n {#1} - \prop_set_eq:NN \l__siunitx_table_model_prop \l__siunitx_number_in_prop - \tl_clear:N \l__siunitx_tmpa_tl - \prop_get:NnNT \l__siunitx_number_in_prop { mantissa-integer } - \l__siunitx_tmpb_tl - { - \tl_set:Nx \l__siunitx_tmpa_tl - { table-figures-integer = \l__siunitx_tmpb_tl } - } - \prop_get:NnNT \l__siunitx_number_in_prop { mantissa-decimal } - \l__siunitx_tmpb_tl - { - \clist_put_right:Nx \l__siunitx_tmpa_tl - { table-figures-decimal = \l__siunitx_tmpb_tl } - } - \prop_get:NnNT \l__siunitx_number_in_prop { mantissa-uncertainty } - \l__siunitx_tmpb_tl - { - \clist_put_right:Nx \l__siunitx_tmpa_tl - { table-figures-uncertainty = \l__siunitx_tmpb_tl } - } - \prop_if_in:NnTF \l__siunitx_number_in_prop { mantissa-sign } - { - \clist_put_right:Nn \l__siunitx_tmpa_tl - { table-sign-mantissa =true } - } - { - \clist_put_right:Nn \l__siunitx_tmpa_tl - { table-sign-mantissa =false } - } - \prop_get:NnNT \l__siunitx_number_in_prop { exponent-integer } - \l__siunitx_tmpb_tl - { - \clist_put_right:Nx \l__siunitx_tmpa_tl - { table-figures-exponent = \l__siunitx_tmpb_tl } - } - \prop_if_in:NnTF \l__siunitx_number_in_prop { exponent-sign } - { - \clist_put_right:Nn \l__siunitx_tmpa_tl - { table-sign-exponent =true } - } - { - \clist_put_right:Nn \l__siunitx_tmpa_tl - { table-sign-exponent =false } - } - \clist_put_right:Nn \l__siunitx_tmpa_tl - { table-number-alignment = center } - \keys_set:nV { siunitx } \l__siunitx_tmpa_tl - \bool_set_eq:NN \l__siunitx_process_plus_bool \l__siunitx_process_plus_saved_bool - } - } -\bool_new:N \l__siunitx_process_plus_saved_bool -\cs_new_protected:Npn \__siunitx_table_print_S: - { - \bool_if:NTF \l__siunitx_table_collect_pre_bool - { - \__siunitx_table_column_begin:n { \l__siunitx_table_text_align_skip } - \l__siunitx_table_collect_pre_tl - \__siunitx_table_column_end:n { \l__siunitx_table_text_align_skip } - } - { - \__siunitx_table_column_begin:n { \l__siunitx_table_number_align_skip } - \bool_if:NTF \l__siunitx_table_parse_only_bool - { \__siunitx_table_print_S_no_alignment: } - { \__siunitx_table_print_S_alignment: } - \bool_if:NTF \l__siunitx_table_align_text_pre_bool - { \__siunitx_table_print_S_pre_aligned: } - { \__siunitx_table_print_S_pre_not_aligned: } - \box_use:N \l__siunitx_table_result_box - \bool_if:NTF \l__siunitx_table_align_text_post_bool - { \__siunitx_table_print_S_post_aligned: } - { \__siunitx_table_print_S_post_not_aligned: } - \__siunitx_table_column_end:n { \l__siunitx_table_number_align_skip } - } - } -\cs_new_protected:Npn \__siunitx_table_print_S_no_alignment: - { - \l__siunitx_table_collect_pre_tl - \__siunitx_number_output:V \l__siunitx_table_collect_tl - \l__siunitx_table_collect_post_tl - } -\cs_new_protected:Npn \__siunitx_table_print_S_alignment: - { \__siunitx_table_print_S_parsed: } -\cs_new_protected:Npn \__siunitx_table_print_S_parse: - { - \bool_set_false:N \l__siunitx_error_bool - \__siunitx_number_in_parse:V \l__siunitx_table_collect_tl - \bool_if:NF \l__siunitx_error_bool - { - \bool_if:NTF \l__siunitx_table_omit_exponent_bool - { - \bool_set_true:N \l__siunitx_process_fixed_bool - \__siunitx_number_process: - \prop_remove:Nn \l__siunitx_number_in_prop { exponent } - \prop_remove:Nn \l__siunitx_number_in_prop { exponent-integer } - } - { \__siunitx_number_process: } - \__siunitx_number_format: - \__siunitx_number_output_color: - } - } -\cs_new_protected:Npn \__siunitx_table_print_S_measure:NN #1#2 - { - \tl_if_empty:NTF #1 - { \dim_zero:N #2 } - { - \group_begin: - \hbox_set:Nn \l__siunitx_tmp_box - { \__siunitx_print:nV { number } #1 } - \exp_args:NNNo \group_end: - \dim_set:Nn #2 { \dim_use:N \box_wd:N \l__siunitx_tmp_box } - } - } -\cs_new_protected:Npn \__siunitx_table_print_S_pre_aligned: - { - \box_use:N \l__siunitx_table_pre_box - \hbox_to_wd:nn { \l__siunitx_table_fill_pre_dim } { \tex_hfil:D } - } -\cs_new_protected:Npn \__siunitx_table_print_S_pre_not_aligned: - { - \hbox_to_wd:nn { \l__siunitx_table_fill_pre_dim } { \tex_hfil:D } - \box_use:N \l__siunitx_table_pre_box - } -\cs_new_protected:Npn \__siunitx_table_print_S_post_aligned: - { - \hbox_to_wd:nn { \l__siunitx_table_fill_post_dim } { \tex_hfil:D } - \box_use:N \l__siunitx_table_post_box - } -\cs_new_protected:Npn \__siunitx_table_print_S_post_not_aligned: - { - \box_use:N \l__siunitx_table_post_box - \hbox_to_wd:nn { \l__siunitx_table_fill_post_dim } { \tex_hfil:D } - } -\cs_new_protected:Npn \__siunitx_table_print_S_centered: - { - \__siunitx_table_print_S_centered_ends: - \bool_if:NT \l__siunitx_table_math_bool { \c_math_toggle_token } - \__siunitx_table_print_S_parse: - \bool_if:NF \l__siunitx_error_bool - { - \__siunitx_table_print_S_centered_measure: - \bool_if:NT \l__siunitx_table_math_bool { \c_math_toggle_token } - \dim_set:Nn \l__siunitx_table_fill_pre_dim - { - \l__siunitx_table_result_dim - - \l__siunitx_table_integer_dim - - \l__siunitx_table_marker_dim - } - \dim_compare:nNnTF \l__siunitx_table_integer_dim > - \l__siunitx_table_fill_pre_dim - { \__siunitx_table_print_S_centered_integer: } - { \__siunitx_table_print_S_centered_decimal: } - } - } -\cs_new_protected:Npn \__siunitx_table_print_S_centered_ends: - { - \hbox_set:Nn \l__siunitx_table_pre_box - { - { - \l__siunitx_table_collect_pre_tl - \bool_if:NT \l__siunitx_table_math_bool - { - \scan_stop: - \c_math_toggle_token - } - } - } - \dim_compare:nNnT - { \box_wd:N \l__siunitx_table_pre_box } = \c_zero_dim - { - \box_clear:N \l__siunitx_table_pre_box - \l__siunitx_table_collect_pre_tl - \bool_set_false:N \l__siunitx_font_set_bool - } - \hbox_set:Nn \l__siunitx_table_post_box - { - \bool_if:NT \l__siunitx_table_math_bool - { - \c_math_toggle_token - \scan_stop: - } - \l__siunitx_table_collect_post_tl - } - \dim_compare:nNnTF - { \box_wd:N \l__siunitx_table_pre_box } > - { \box_wd:N \l__siunitx_table_post_box } - { - \hbox_set_to_wd:Nnn \l__siunitx_table_post_box - { \box_wd:N \l__siunitx_table_pre_box } - { - \hbox_unpack:N \l__siunitx_table_post_box - \tex_hfil:D - } - } - { - \hbox_set_to_wd:Nnn \l__siunitx_table_pre_box - { \box_wd:N \l__siunitx_table_post_box } - { - \tex_hfil:D - \hbox_unpack:N \l__siunitx_table_pre_box - } - } - } -\cs_new_protected:Npn \__siunitx_table_print_S_centered_measure: - { - \__siunitx_table_print_S_centered_measure_int_part: - \__siunitx_table_print_S_centered_measure_marker: - \__siunitx_table_print_S_centered_measure_result: - } -\cs_new_protected:Npn \__siunitx_table_print_S_centered_measure_int_part: - { - \prop_get:NnNF \l__siunitx_number_out_prop { comparator } \l__siunitx_tmpa_tl - { \tl_clear:N \l__siunitx_tmpa_tl } - \prop_get:NnNT \l__siunitx_number_out_prop { mantissa-sign } - \l__siunitx_tmpb_tl - { \tl_put_right:No \l__siunitx_tmpa_tl \l__siunitx_tmpb_tl } - \prop_get:NnNT \l__siunitx_number_out_prop { mantissa-integer } - \l__siunitx_tmpb_tl - { \tl_put_right:No \l__siunitx_tmpa_tl \l__siunitx_tmpb_tl } - \__siunitx_table_print_S_measure:NN \l__siunitx_tmpa_tl - \l__siunitx_table_integer_dim - } -\cs_new_protected:Npn \__siunitx_table_print_S_centered_measure_marker: - { - \__siunitx_table_print_S_measure:NN \l__siunitx_output_decimal_tl - \l__siunitx_table_marker_dim - } -\cs_new_protected:Npn \__siunitx_table_print_S_centered_measure_result: - { - \prop_get:NnN \l__siunitx_number_out_prop { result } \l__siunitx_tmpa_tl - \hbox_set:Nn \l__siunitx_table_result_box - { \__siunitx_print:nV { number } \l__siunitx_tmpa_tl } - \dim_set:Nn \l__siunitx_table_result_dim - { \box_wd:N \l__siunitx_table_result_box } - } -\cs_new_protected:Npn \__siunitx_table_print_S_centered_integer: - { - \dim_set:Nn \l__siunitx_table_fill_post_dim - { \l__siunitx_table_integer_dim - \l__siunitx_table_fill_pre_dim } - \dim_zero:N \l__siunitx_table_fill_pre_dim - } -\cs_new_protected:Npn \__siunitx_table_print_S_centered_decimal: - { - \dim_sub:Nn \l__siunitx_table_fill_pre_dim - { \l__siunitx_table_integer_dim } - \dim_zero:N \l__siunitx_table_fill_post_dim - } -\cs_new_protected:Npn \__siunitx_table_print_S_reserved: - { - \__siunitx_table_print_S_reserved_init: - \__siunitx_table_print_S_reserved_ends: - \bool_if:NT \l__siunitx_table_auto_round_bool - { \__siunitx_table_print_S_reserved_round_auto: } - \__siunitx_table_print_S_parse: - \bool_if:NF \l__siunitx_error_bool - { - \bool_if:NT \l__siunitx_table_math_bool { \c_math_toggle_token } - \__siunitx_table_print_S_reserved_comparator: - \__siunitx_table_print_S_reserved_mantissa: - \__siunitx_table_print_S_reserved_exponent: - \bool_if:NT \l__siunitx_table_math_bool { \c_math_toggle_token } - } - } -\cs_new_protected:Npn \__siunitx_table_print_S_reserved_init: - { - \dim_zero:N \l__siunitx_table_fill_mid_dim - \dim_zero:N \l__siunitx_table_fill_post_dim - \prop_set_eq:NN \l__siunitx_number_in_prop \l__siunitx_table_model_prop - \__siunitx_number_process_sign: - \__siunitx_number_process_zero_fill: - \__siunitx_number_process_mantissa: - \prop_if_in:NnF \l__siunitx_number_in_prop { symbolic } - { \__siunitx_number_process_uncertainty: } - \__siunitx_number_format: - \prop_get:NnNT \l__siunitx_table_model_prop { mantissa-decimal-raw } - \l__siunitx_tmpa_tl - { - \prop_put:NnV \l__siunitx_number_out_prop { mantissa-decimal-raw } - \l__siunitx_tmpa_tl - } - \prop_set_eq:NN \l__siunitx_table_model_prop \l__siunitx_number_out_prop - } -\cs_new_protected:Npn \__siunitx_table_print_S_reserved_ends: - { - \hbox_set:Nn \l__siunitx_table_pre_box - { - { - \l__siunitx_table_collect_pre_tl - \bool_if:NT \l__siunitx_table_math_bool - { - \scan_stop: - \c_math_toggle_token - } - } - } - \dim_compare:nNnT - { \box_wd:N \l__siunitx_table_pre_box } = \c_zero_dim - { - \box_clear:N \l__siunitx_table_pre_box - \l__siunitx_table_collect_pre_tl - \bool_set_false:N \l__siunitx_font_set_bool - } - \hbox_set:Nn \l__siunitx_tmp_box { { \l__siunitx_table_pre_tl } } - \hbox_set_to_wd:Nnn \l__siunitx_table_pre_box - { \box_wd:N \l__siunitx_tmp_box } - { - \tex_hfil:D - \hbox_unpack:N \l__siunitx_table_pre_box - } - \hbox_set:Nn \l__siunitx_tmp_box { \l__siunitx_table_post_tl } - \hbox_set_to_wd:Nnn \l__siunitx_table_post_box - { \box_wd:N \l__siunitx_tmp_box } - { - { - \bool_if:NT \l__siunitx_table_math_bool - { - \c_math_toggle_token - \scan_stop: - } - \l__siunitx_table_collect_post_tl - } - \tex_hfil:D - } - } -\cs_new_protected:Npn \__siunitx_table_print_S_reserved_round_auto: - { - \prop_get:NnNTF \l__siunitx_table_model_prop { mantissa-decimal-raw } - \l__siunitx_tmpa_tl - { \int_set:Nn \l__siunitx_process_precision_int { \l__siunitx_tmpa_tl } } - { \int_zero:N \l__siunitx_process_precision_int } - \tl_set:Nn \l__siunitx_round_tl { places } - } -\cs_new_protected:Npn \__siunitx_table_print_S_reserved_comparator: - { - \prop_get:NnNTF \l__siunitx_table_model_prop { comparator } - \l__siunitx_tmpa_tl - { - \hbox_set:Nn \l__siunitx_tmp_box - { \__siunitx_print:nV { number } \l__siunitx_tmpa_tl } - \prop_get:NnNTF \l__siunitx_number_out_prop { comparator } - \l__siunitx_tmpa_tl - { - \hbox_set_to_wd:Nnn \l__siunitx_table_result_box - { \box_wd:N \l__siunitx_tmp_box } - { \__siunitx_print:nV { number } \l__siunitx_tmpa_tl } - } - { - \dim_add:Nn \l__siunitx_table_fill_pre_dim - { \box_wd:N \l__siunitx_tmp_box } - \cs_set_eq:NN \__siunitx_table_print_S_reserved_store_fill:n - \__siunitx_table_print_S_reserved_store_fill_pre:n - } - } - { - \cs_set_eq:NN \__siunitx_table_print_S_reserved_store_fill:n - \__siunitx_table_print_S_reserved_store_fill_pre:n - \prop_if_in:NnT \l__siunitx_number_out_prop { comparator } - { - \msg_error:nnx { siunitx } { table-partial-number } - { a~comparator } - } - } - } -\cs_new_protected:Npn \__siunitx_table_print_S_reserved_store_fill_pre:n - { \dim_add:Nn \l__siunitx_table_fill_pre_dim } -\cs_new_protected:Npn \__siunitx_table_print_S_reserved_store_fill_mid:n - { \dim_add:Nn \l__siunitx_table_fill_mid_dim } -\cs_new_protected:Npn \__siunitx_table_print_S_reserved_mantissa: - { - \prop_get:NnNTF \l__siunitx_table_model_prop { mantissa } - \l__siunitx_tmpa_tl - { - \hbox_set:Nn \l__siunitx_tmp_box - { \__siunitx_print:nV { number } \l__siunitx_tmpa_tl } - \prop_get:NnNTF \l__siunitx_number_out_prop { mantissa } - \l__siunitx_tmpa_tl - { - \dim_set:Nn \l__siunitx_table_mantissa_dim - { \box_wd:N \l__siunitx_tmp_box } - \hbox_set:Nn \l__siunitx_table_mantissa_box - { \__siunitx_print:nV { number } \l__siunitx_tmpa_tl } - \__siunitx_table_print_S_reserved_mantissa_parts: - } - { - \__siunitx_table_print_S_reserved_store_fill:n - { \box_wd:N \l__siunitx_tmp_box } - } - } - { - \prop_if_in:NnT \l__siunitx_number_out_prop { mantissa } - { - \msg_error:nnx { siunitx } { table-partial-number } - { a~mantissa } - } - } - } -\cs_new_protected:Npn \__siunitx_table_print_S_reserved_mantissa_parts: - { - \__siunitx_table_print_S_reserved_mantissa_integer: - \hbox_set:Nn \l__siunitx_table_result_box - { - \hbox_unpack:N \l__siunitx_table_result_box - \hbox_to_wd:nn { \l__siunitx_table_fill_mid_dim } { \tex_hfil:D } - \hbox_unpack:N \l__siunitx_table_mantissa_box - } - \dim_set:Nn \l__siunitx_table_fill_mid_dim - { - \l__siunitx_table_mantissa_dim - - \box_wd:N \l__siunitx_table_mantissa_box - - \l__siunitx_table_integer_dim - } - \__siunitx_table_print_S_reserved_mantissa_uncert: - } -\cs_new_protected:Npn \__siunitx_table_print_S_reserved_mantissa_integer: - { - \prop_get:NnNF \l__siunitx_table_model_prop { mantissa-sign } - \l__siunitx_tmpa_tl - { \tl_clear:N \l__siunitx_tmpa_tl } - \prop_get:NnNT \l__siunitx_table_model_prop { mantissa-integer } - \l__siunitx_tmpb_tl - { \tl_put_right:No \l__siunitx_tmpa_tl \l__siunitx_tmpb_tl } - \__siunitx_table_print_S_measure:NN \l__siunitx_tmpa_tl - \l__siunitx_table_integer_dim - \prop_get:NnNF \l__siunitx_number_out_prop { mantissa-sign } - \l__siunitx_tmpa_tl - { \tl_clear:N \l__siunitx_tmpa_tl } - \prop_get:NnNT \l__siunitx_number_out_prop { mantissa-integer } - \l__siunitx_tmpb_tl - { \tl_put_right:No \l__siunitx_tmpa_tl \l__siunitx_tmpb_tl } - \tl_if_empty:NF \l__siunitx_tmpa_tl - { - \__siunitx_table_print_S_measure:NN \l__siunitx_tmpa_tl - \l__siunitx_tmp_dim - \dim_sub:Nn \l__siunitx_table_integer_dim { \l__siunitx_tmp_dim } - } - \__siunitx_table_print_S_reserved_store_fill:n - { \l__siunitx_table_integer_dim } - } -\cs_new_protected:Npn \__siunitx_table_print_S_reserved_mantissa_uncert: - { - \prop_get:NnNT \l__siunitx_table_model_prop { mantissa-uncertainty } - \l__siunitx_tmpa_tl - { - \__siunitx_number_format_join_uncert_pm:N \l__siunitx_tmpa_tl - \hbox_set:Nn \l__siunitx_tmp_box - { \__siunitx_print:nV { number } \l__siunitx_tmpa_tl } - \prop_get:NnNTF \l__siunitx_number_out_prop { mantissa-uncertainty } - \l__siunitx_tmpa_tl - { - \dim_set:Nn \l__siunitx_table_uncert_dim - { \box_wd:N \l__siunitx_tmp_box } - \__siunitx_number_format_join_uncert_pm:N \l__siunitx_tmpa_tl - \hbox_set:Nn \l__siunitx_tmp_box - { \__siunitx_print:nV { number } \l__siunitx_tmpa_tl } - \bool_if:NTF \l__siunitx_table_align_uncert_bool - { \__siunitx_table_print_S_reserved_mantissa_uncert_aligned: } - { \__siunitx_table_print_S_reserved_mantissa_uncert_not_aligned: } - } - { - \cs_set_eq:NN \__siunitx_table_print_S_reserved_store_fill:n - \__siunitx_table_print_S_reserved_store_fill_mid:n - \__siunitx_table_print_S_reserved_store_fill:n - { \box_wd:N \l__siunitx_tmp_box } - } - } - } -\cs_new_protected:Npn - \__siunitx_table_print_S_reserved_mantissa_uncert_aligned: - { - \hbox_set:Nn \l__siunitx_table_result_box - { - \hbox_unpack:N \l__siunitx_table_result_box - \hbox_to_wd:nn { \l__siunitx_table_fill_mid_dim } { \tex_hfil:D } - \hbox_unpack:N \l__siunitx_tmp_box - } - \dim_set:Nn \l__siunitx_table_fill_mid_dim - { \l__siunitx_table_uncert_dim - \box_wd:N \l__siunitx_tmp_box } - } -\cs_new_protected:Npn - \__siunitx_table_print_S_reserved_mantissa_uncert_not_aligned: - { - \hbox_set:Nn \l__siunitx_table_result_box - { - \hbox_unpack:N \l__siunitx_table_result_box - \hbox_unpack:N \l__siunitx_tmp_box - } - \dim_add:Nn \l__siunitx_table_fill_mid_dim - { - \l__siunitx_table_uncert_dim - - \box_wd:N \l__siunitx_tmp_box - } - } -\cs_new_protected:Npn \__siunitx_table_print_S_reserved_exponent: - { - \prop_get:NnNTF \l__siunitx_table_model_prop { exponent-result } - \l__siunitx_tmpa_tl - { - \prop_if_in:NnT \l__siunitx_table_model_prop { mantissa } - { \__siunitx_table_print_S_reserved_exponent_product: } - \hbox_set:Nn \l__siunitx_tmp_box - { \__siunitx_print:nV { number } \l__siunitx_tmpa_tl } - \prop_get:NnNTF \l__siunitx_number_out_prop { exponent-result } - \l__siunitx_tmpa_tl - { - \dim_set:Nn \l__siunitx_table_exponent_dim - { \box_wd:N \l__siunitx_tmp_box } - \tl_if_empty:NT \l__siunitx_output_exponent_tl - { - \prop_if_in:NnTF \l__siunitx_number_out_prop { mantissa } - { \__siunitx_table_print_S_reserved_exponent_product: } - { \__siunitx_table_print_S_reserved_exponent_product_correction: } - } - \hbox_set:Nn \l__siunitx_tmp_box - { \__siunitx_print:nV { number } \l__siunitx_tmpa_tl } - \bool_if:NTF \l__siunitx_table_align_exponent_bool - { \__siunitx_table_print_S_reserved_exponent_aligned: } - { \__siunitx_table_print_S_reserved_exponent_not_aligned: } - } - { - \dim_set:Nn \l__siunitx_table_fill_post_dim - { \l__siunitx_table_fill_mid_dim + \box_wd:N \l__siunitx_tmp_box } - } - } - { - \prop_if_in:NnT \l__siunitx_number_out_prop { exponent-result } - { - \msg_error:nnx { siunitx } { table-partial-number } - { an~exponent } - } - \dim_set_eq:NN \l__siunitx_table_fill_post_dim - \l__siunitx_table_fill_mid_dim - } - } -\cs_new_protected:Npn \__siunitx_table_print_S_reserved_exponent_product: - { - \tl_set_eq:NN \l__siunitx_tmpb_tl \l__siunitx_exponent_product_tl - \bool_if:NT \l__siunitx_tight_bool - { - \tl_set:Nx \l__siunitx_tmpb_tl - { \exp_not:N \mathord \exp_not:o \l__siunitx_tmpb_tl } - } - \tl_set:Nx \l__siunitx_tmpa_tl - { - \exp_not:N \ensuremath { { } \exp_not:o \l__siunitx_tmpb_tl { } } - \exp_not:o \l__siunitx_tmpa_tl - } - } -\cs_new_protected:Npn - \__siunitx_table_print_S_reserved_exponent_product_correction: - { - \group_begin: - \tl_clear:N \l__siunitx_tmpa_tl - \__siunitx_table_print_S_reserved_exponent_product: - \tl_set:Nx \l__siunitx_tmpa_tl - { { } \exp_not:o \l__siunitx_tmpa_tl { } } - \__siunitx_table_print_S_measure:NN \l__siunitx_tmpa_tl \l__siunitx_tmp_dim - \exp_args:NNNo \group_end: - \dim_set:Nn \l__siunitx_tmp_dim { \dim_use:N \l__siunitx_tmp_dim } - \__siunitx_table_print_S_reserved_store_fill:n { \l__siunitx_tmp_dim } - \dim_sub:Nn \l__siunitx_table_exponent_dim { \l__siunitx_tmp_dim } - } -\cs_new_protected:Npn \__siunitx_table_print_S_reserved_exponent_aligned: - { - \hbox_set:Nn \l__siunitx_table_result_box - { - \hbox_unpack:N \l__siunitx_table_result_box - \hbox_to_wd:nn { \l__siunitx_table_fill_mid_dim } { \tex_hfil:D } - \hbox_unpack:N \l__siunitx_tmp_box - } - \dim_set:Nn \l__siunitx_table_fill_post_dim - { - \l__siunitx_table_exponent_dim - - \box_wd:N \l__siunitx_tmp_box - } - } -\cs_new_protected:Npn - \__siunitx_table_print_S_reserved_exponent_not_aligned: - { - \hbox_set:Nn \l__siunitx_table_result_box - { - \hbox_unpack:N \l__siunitx_table_result_box - \hbox_unpack:N \l__siunitx_tmp_box - } - \dim_set:Nn \l__siunitx_table_fill_post_dim - { - \l__siunitx_table_fill_mid_dim - + \l__siunitx_table_exponent_dim - - \box_wd:N \l__siunitx_tmp_box - } - } -\cs_new_protected:Npn \__siunitx_table_print_S_direct:N #1 - { - #1 - \cs_set:Npn \__peek_execute_branches: - { - \if_catcode:w \exp_not:N \l_peek_token \c_group_begin_token - \exp_after:wN \__siunitx_table_print_S_direct_text:n - \else: - \m@th - \exp_after:wN \__siunitx_table_print_S_direct_main: - \fi: - } - \peek_after:Nw \__peek_ignore_spaces_execute_branches: - } -\cs_new_protected:Npn \__siunitx_table_print_S_direct_text:n #1 - { - \__siunitx_table_column_begin:n { \l__siunitx_table_text_align_skip } - #1 - \__siunitx_table_column_end:n { \l__siunitx_table_text_align_skip } - } -\cs_new_protected:Npn \__siunitx_table_print_S_direct_centered: - { - \cs_set_eq:NN \__siunitx_table_print: - \__siunitx_table_print_S_direct_centered_end: - \hbox_set:Nn \l__siunitx_tmp_box - { \ensuremath { \l__siunitx_output_decimal_tl } } - \hbox_set_to_wd:Nnn \l__siunitx_table_post_box - { \box_wd:N \l__siunitx_tmp_box } - { \tex_hfil:D } - \hbox_set:Nw \l__siunitx_table_pre_box - \c_math_toggle_token - \tl_map_function:NN \l__siunitx_input_decimal_tl - \__siunitx_table_print_S_direct_centered_aux:N - } -\cs_new_protected:Npn \__siunitx_table_print_S_direct_centered_aux:N #1 - { - \char_set_active_eq:NN #1 \__siunitx_table_print_S_direct_centered_begin: - \char_set_mathcode:nn { `#1 } { "8000 } - } -\cs_new_protected:Npn \__siunitx_table_print_S_direct_centered_begin: - { - \c_math_toggle_token - \hbox_set_end: - \hbox_set:Nw \l__siunitx_table_post_box - \c_math_toggle_token - \l__siunitx_output_decimal_tl - } -\cs_new_protected:Npn \__siunitx_table_print_S_direct_centered_end: - { - \c_math_toggle_token - \hbox_set_end: - \dim_compare:nNnTF - { \box_wd:N \l__siunitx_table_pre_box } > - { \box_wd:N \l__siunitx_table_post_box } - { - \hbox_set_to_wd:Nnn \l__siunitx_table_post_box - { \box_wd:N \l__siunitx_table_pre_box } - { - \hbox_unpack:N \l__siunitx_table_post_box - \tex_hfil:D - } - } - { - \hbox_set_to_wd:Nnn \l__siunitx_table_pre_box - { \box_wd:N \l__siunitx_table_post_box } - { - \tex_hfil:D - \hbox_unpack:N \l__siunitx_table_pre_box - } - } - \box_use:N \l__siunitx_table_pre_box - \box_use:N \l__siunitx_table_post_box - } -\cs_new_protected:Npn \__siunitx_table_print_S_direct_reserved: - { - \cs_set_eq:NN \__siunitx_table_print: - \__siunitx_table_print_S_direct_reserved_end: - \prop_get:NnNF \l__siunitx_table_model_prop { mantissa-integer } - \l__siunitx_tmpa_tl - { \tl_clear:N \l__siunitx_tmpa_tl } - \hbox_set:Nn \l__siunitx_tmp_box - { - \ensuremath - { - \prop_get:NnNT \l__siunitx_table_model_prop { mantissa-sign } - \l__siunitx_tmpb_tl - { \l__siunitx_tmpb_tl } - \l__siunitx_tmpa_tl - } - } - \dim_set:Nn \l__siunitx_table_integer_dim - { \box_wd:N \l__siunitx_tmp_box } - \prop_get:NnNF \l__siunitx_table_model_prop { mantissa-decimal } - \l__siunitx_tmpa_tl - { \tl_clear:N \l__siunitx_tmpa_tl } - \hbox_set:Nn \l__siunitx_tmp_box - { - \ensuremath - { - \l__siunitx_output_decimal_tl - \l__siunitx_tmpa_tl - } - } - \hbox_set_to_wd:Nnn \l__siunitx_table_post_box - { \box_wd:N \l__siunitx_tmp_box } - { \tex_hfil:D } - \tex_setbox:D \l__siunitx_table_pre_box \tex_hbox:D to \l__siunitx_table_integer_dim - \c_group_begin_token - \c_math_toggle_token - \tl_map_function:NN \l__siunitx_input_decimal_tl - \__siunitx_table_print_S_direct_reserved_aux:N - \tex_hfill:D - } -\cs_new_protected:Npn \__siunitx_table_print_S_direct_reserved_aux:N #1 - { - \char_set_active_eq:NN #1 \__siunitx_table_print_S_direct_reserved_begin: - \char_set_mathcode:nn { `#1 } { "8000 } - } -\cs_new_protected:Npn \__siunitx_table_print_S_direct_reserved_begin: - { - \c_math_toggle_token - \c_group_end_token - \tex_setbox:D \l__siunitx_table_post_box \tex_hbox:D to \box_wd:N \l__siunitx_tmp_box - \c_group_begin_token - \c_math_toggle_token - \l__siunitx_output_decimal_tl - } -\cs_new_protected:Npn \__siunitx_table_print_S_direct_reserved_end: - { - \c_math_toggle_token - \tex_hfil:D - \c_group_end_token - \__siunitx_table_align_left:n { \l__siunitx_table_number_align_skip } - \box_use:N \l__siunitx_table_pre_box - \box_use:N \l__siunitx_table_post_box - \__siunitx_table_align_right:n { \l__siunitx_table_number_align_skip } - } -\keys_set:nn { siunitx } - { - table-align-comparator = true, - table-align-exponent = true, - table-align-text-pre = true, - table-align-text-post = true, - table-align-uncertainty = true, - table-omit-exponent = false, - table-parse-only = false, - table-number-alignment = center-decimal-marker, - table-text-alignment = center, - table-figures-decimal = 2, - table-figures-integer = 3 - } -\keys_define:nn { siunitx } - { redefine-symbols .bool_set:N = \l__siunitx_redefine_symbols_bool } -\keys_set:nn { siunitx } { redefine-symbols = true } -\AtBeginDocument - { - \bool_if:NT \l__siunitx_redefine_symbols_bool - { - \@ifpackageloaded { textcomp } - { - \__siunitx_option_unchanged:Nnn \l__siunitx_degree_math_tl - { { } ^ { \circ } } - { \text { \textdegree } } - \__siunitx_option_unchanged:Nnn \l__siunitx_degree_text_tl - { \ensuremath { { } ^ { \circ } } } - { \textdegree } - \@ifpackageloaded { mathptmx } - { } - { - \__siunitx_option_unchanged:Nnn \l__siunitx_micro_text_tl - { \c__siunitx_mu_tl } - { \textmu } - \@ifpackageloaded { fourier } - { } - { - \__siunitx_option_unchanged:Nnn \l__siunitx_ohm_text_tl - { \ensuremath { \c__siunitx_omega_tl } } - { \textohm } - } - } - \str_if_eq:VnT \encodingdefault { OT1 } - { - \__siunitx_option_unchanged:Nnn \l__siunitx_angstrom_math_tl - { \text { \AA } } - { \text { \capitalring { A } } } - \__siunitx_option_unchanged:Nnn \l__siunitx_angstrom_text_tl - { \AA } - { \capitalring { A } } - } - } - { } - \@ifpackageloaded { upgreek } - { - \__siunitx_option_unchanged:Nnn \l__siunitx_ohm_math_tl - { \text { \ensuremath { \c__siunitx_omega_tl } } } - { \Upomega } - } - { } - } - } -\keys_define:nn { siunitx } { - math-angstrom .tl_set:N = \l__siunitx_angstrom_math_tl, - math-arcminute .tl_set:N = \l__siunitx_arcminute_math_tl, - math-arcsecond .tl_set:N = \l__siunitx_arcsecond_math_tl, - math-celsius .tl_set:N = \l__siunitx_celsius_math_tl, - math-degree .tl_set:N = \l__siunitx_degree_math_tl, - math-micro .tl_set:N = \l__siunitx_micro_math_tl, - math-ohm .tl_set:N = \l__siunitx_ohm_math_tl -} -\keys_set:nn { siunitx } { - math-angstrom = \text { \AA }, - math-arcminute = { } ^ { \prime }, - math-arcsecond = { } ^ { \prime \prime }, - math-celsius = { } ^ { \circ } \kern - \scriptspace \__siunitx_unit_mathrm:n { C } , - math-degree = { } ^ { \circ }, - math-micro = \text { \c__siunitx_mu_tl }, - math-ohm = \text { \ensuremath { \c__siunitx_omega_tl } }, -} -\keys_define:nn { siunitx } { - text-angstrom .tl_set:N = \l__siunitx_angstrom_text_tl, - text-arcminute .tl_set:N = \l__siunitx_arcminute_text_tl, - text-arcsecond .tl_set:N = \l__siunitx_arcsecond_text_tl, - text-celsius .tl_set:N = \l__siunitx_celsius_text_tl, - text-degree .tl_set:N = \l__siunitx_degree_text_tl, - text-micro .tl_set:N = \l__siunitx_micro_text_tl, - text-ohm .tl_set:N = \l__siunitx_ohm_text_tl, -} -\keys_set:nn { siunitx } { - text-angstrom = \AA, - text-arcminute = \ensuremath { { } ^ { \prime } }, - text-arcsecond = \ensuremath { { } ^ { \prime \prime } }, - text-celsius = - \ensuremath { { } ^ { \circ } } \kern -\scriptspace C , - text-degree = \ensuremath { { } ^ { \circ } }, - text-micro = \c__siunitx_mu_tl , - text-ohm = \ensuremath { \c__siunitx_omega_tl }, -} -\cs_new_protected:Npn \__siunitx_symbol_new:n #1 - { - \cs_set_protected:cpn { SIUnitSymbol #1 } - { - \use:c - { - l__siunitx_ - \str_fold_case:n {#1} - _ - \mode_if_math:TF { math } { text } - _tl - } - } - } -\__siunitx_symbol_new:n { Angstrom } -\__siunitx_symbol_new:n { Arcminute } -\__siunitx_symbol_new:n { Arcsecond } -\__siunitx_symbol_new:n { Celsius } -\__siunitx_symbol_new:n { Degree } -\__siunitx_symbol_new:n { Micro } -\__siunitx_symbol_new:n { Ohm } -\AtBeginDocument - { - \@ifpackageloaded { fontspec } - { - \int_const:Nn \c__siunitx_degree_int { 176 } - \@ifpackageloaded { unicode-math } - { \int_const:Nn \c__siunitx_micro_int { "003BC } } - { \int_const:Nn \c__siunitx_micro_int { "000B5 } } - \int_const:Nn \c__siunitx_angstrom_int { "0212B } - \int_const:Nn \c__siunitx_ohm_int { "003A9 } - \sys_if_engine_xetex:T - { - \__siunitx_option_unchanged:Nnn \l__siunitx_angstrom_math_tl - { \text { \AA } } - { \tex_char:D \c__siunitx_angstrom_int } - } - \__siunitx_option_unchanged:Nnn \l__siunitx_celsius_math_tl - { { } ^ { \circ } \kern - \scriptspace C } - { - \tex_char:D \c__siunitx_degree_int - C - } - \__siunitx_option_unchanged:Nnn \l__siunitx_degree_math_tl - { { } ^ { \circ } } - { \tex_char:D \c__siunitx_degree_int } - \__siunitx_option_unchanged:Nnn \l__siunitx_micro_math_tl - { \text { \c__siunitx_mu_tl } } - { \tex_char:D \c__siunitx_micro_int } - \__siunitx_option_unchanged:Nnn \l__siunitx_ohm_math_tl - { \text { \ensuremath { \c__siunitx_omega_tl } } } - { \tex_char:D \c__siunitx_ohm_int } - \sys_if_engine_xetex:T - { - \__siunitx_option_unchanged:Nnn \l__siunitx_angstrom_text_tl - { \AA } - { \tex_char:D \c__siunitx_angstrom_int } - } - \__siunitx_option_unchanged:Nnn \l__siunitx_celsius_text_tl - { - \ensuremath - { { } ^ { \circ } \kern - \scriptspace C } - } - { - \tex_char:D \c__siunitx_degree_int - C - } - \__siunitx_option_unchanged:Nnn \l__siunitx_degree_text_tl - { \ensuremath { { } ^ { \circ } } } - { \tex_char:D \c__siunitx_degree_int } - \__siunitx_option_unchanged:Nnn \l__siunitx_micro_text_tl - { \c__siunitx_mu_tl } - { \tex_char:D \c__siunitx_micro_int } - \__siunitx_option_unchanged:Nnn \l__siunitx_ohm_text_tl - { \ensuremath { \c__siunitx_omega_tl } } - { \tex_char:D \c__siunitx_ohm_int } - } - { } - \@ifpackageloaded { unicode-math } - { - \int_const:Nn \c__siunitx_arcminute_int { 8242 } - \int_const:Nn \c__siunitx_arcsecond_int { 8243 } - \__siunitx_option_unchanged:Nnn \l__siunitx_arcminute_math_tl - { { } ^ { \prime } } - { \ensuremath { \tex_char:D \c__siunitx_arcminute_int } } - \__siunitx_option_unchanged:Nnn \l__siunitx_arcsecond_math_tl - { { } ^ { \prime \prime } } - { \ensuremath { \tex_char:D \c__siunitx_arcsecond_int } } - \__siunitx_option_unchanged:Nnn \l__siunitx_arcminute_text_tl - { \ensuremath { { } ^ { \prime } } } - { \ensuremath { \tex_char:D \c__siunitx_arcminute_int } } - \__siunitx_option_unchanged:Nnn \l__siunitx_arcsecond_text_tl - { \ensuremath { { } ^ { \prime \prime } } } - { \ensuremath { \tex_char:D \c__siunitx_arcsecond_int } } - } - { } - } -\clist_new:N \l__siunitx_pgf_link_clist -\cs_new_protected:Npn \__siunitx_pgf_link: { - \clist_clear:N \l__siunitx_pgf_link_clist - \str_if_eq:VnT \l__siunitx_round_tl { figure } - { - \clist_put_right:Nn \l__siunitx_pgf_link_clist { fixed } - \clist_put_right:Nn \l__siunitx_pgf_link_clist - { fixed~zerofill = true } - } - \clist_put_right:Nx \l__siunitx_pgf_link_clist - { precision = \int_use:N \l__siunitx_process_precision_int } - \clist_put_right:Nx \l__siunitx_pgf_link_clist - { - set~decimal~separator = - { { \exp_not:V \l__siunitx_output_decimal_tl } } - } - \clist_put_right:Nx \l__siunitx_pgf_link_clist - { set~thousands~separator = { \exp_not:V \l__siunitx_group_sep_tl } } - \clist_put_right:Nx \l__siunitx_pgf_link_clist - { - min~exponent~for~1000~sep = \int_eval:n { \l__siunitx_group_min_int - 1 } - } - \bool_lazy_or:nnF - { \l__siunitx_group_decimal_bool } { \l__siunitx_group_integer_bool } - { - \clist_put_right:Nn \l__siunitx_pgf_link_clist - { min~exponent~for~1000~sep = 999 } - } - \bool_if:NTF \l__siunitx_process_integer_zero_bool - { - \clist_put_right:Nn \l__siunitx_pgf_link_clist - { skip~0. = false } - } - { - \clist_put_right:Nn \l__siunitx_pgf_link_clist - { skip~0. = true } - } - \str_if_eq:VnTF \l__siunitx_process_sign_tl { + } - { - \clist_put_right:Nn \l__siunitx_pgf_link_clist - { showpos = true } - } - { - \clist_put_right:Nn \l__siunitx_pgf_link_clist - { showpos = false } - } - \use:x - { - \exp_not:N \pgfqkeys - { /pgf/number~format } - { \exp_not:V \l__siunitx_pgf_link_clist } - } -} -\msg_new:nnnn { siunitx } { bad-arc-sign } - { Incorrect~use~of~sign~in~degree-minute-second~angle. } - { Only~the~highest~value~part~of~an~angle~can~have~a~sign. } -\msg_new:nnnn { siunitx } { color-not-loaded } - { Package~"color"~not~loaded. } - { The~command~\token_to_str:N \color \ is~not~available. } -\msg_new:nnnn { siunitx } { duplicate-complex-root-token } - { Duplicate~complex~root~token~'#1'~in~input. } - { Only~one~complex~root~token~can~appear~in~a~single~number. } -\msg_new:nnnn { siunitx } { duplicate-decimal-token } - { Duplicate~decimal~marker~token~'#1'~in~input. } - { Only~one~decimal~marker~token~can~appear~in~a~single~number. } -\msg_new:nnnn { siunitx } { duplicate-exponent-token } - { Duplicate~exponent~marker~token~'#1'~in~input. } - { Only~one~exponent~marker~token~can~appear~in~a~single~number. } -\msg_new:nnnn { siunitx } { duplicate-quotient-token } - { Duplicate~quotient~token. } - { Only~one~quotient~token~can~appear~in~a~single~number. } -\msg_new:nnnn { siunitx } { duplicate-sticky-per } - { Duplicate~\token_to_str:N \per. } - { - When~the~'sticky-per'~option~is~active,~only~one - \token_to_str:N \per may~appear~in~a~unit. - } -\msg_new:nnnn { siunitx } { empty-arc } - { Empty~degree-minute-second~angle. } - { The~angle~given~does~not~contain~any~numbers. } -\msg_new:nnnn { siunitx } { empty-uncertainty } - { Empty~uncertainty~given~in~'#1'. } - { The~number~given~contains~an~empty~uncertainty. } -\msg_new:nnnn { siunitx } { ending-product-token } - { Misplaced~product~token. } - { A~number~cannot~end~with~a~product~token. } -\msg_new:nnnn { siunitx } { ending-quotient-token } - { Misplaced~quotient~token. } - { A~number~cannot~end~with~a~quotient~token. } -\msg_new:nnnn { siunitx } { invalid-arc-format } - { Invalid~degree-minute-second angle~'#1'. } - { - Angles~given~in~degree-minute-second~format~should~contain~two~';' - symbols~to~divide~up~the~parts~of~the~input. - } -\msg_new:nnnn { siunitx } { invalid-number } - { Invalid~numerical~input~'#1'. } - { - The~input~given~as~a~number~does~not~make~logical~sense.~ - This~happens,~for~example,~if~a~number~only~contains~a~sign. - } -\msg_new:nnnn { siunitx } { invalid-token-in-exponent } - { Invalid~exponent~in~numerical~input~'#1'. } - { - The~exponent~part~of~a~number~cannot~contain~an~uncertainty~or~ - complex~part: \\ - the~input~given~appears~to~contain~one~of~these~in~the~exponent. - } -\msg_new:nnnn { siunitx } { invalid-token-in-number } - { Invalid~token~'#1'~in~numerical~input. } - { - Numbers~can~only~contain~tokens~defined~using~the~ - 'input-...'~options:\\ - the~token~'#1'~is~not~set~up~as~a~valid~part~of~a~number. - } -\msg_new:nnnn { siunitx } { invalid-token-in-uncertainty } - { Invalid~uncertainty~in~numerical~input~'#1'. } - { - The~uncertainty~part~of~a~number~may~only~contain~digits~or~ - symbols. - } -\msg_new:nnnn { siunitx } { literal-unit } - { Literal~units~disabled. } - { - You~gave~the~literal~input~'#1'~ - but~literal~unit~output~is~disabled. - } -\msg_new:nnnn { siunitx } { misplaced-sign-token } - { Misplaced~sign~token~'#1'. } - { Sign~tokens~can~only~come~at~the~beginning~of~a~number. } -\msg_new:nnnn { siunitx } { misplaced-complex-root-token } - { Misplaced~complex~token~in~numerical~input~'#1'. } - { - The~root~token~must~come~either~before~or~after~the~real~digits~ - of~the~complex~part. - } -\msg_new:nnnn { siunitx } { misplaced-uncertainty-token } - { Misplaced~uncertainty~token~'#1'. } - { - The~uncertainty~in~a~number~must~be~given~between~a~set~of~ - delimiters~as~defined~by~the\\ - \ \ 'input-open-uncertainty'~and~'input-close-uncertainty'~ - options. - } -\msg_new:nnnn { siunitx } { multi-part-range } - { Numerical~range~with~multiple~parts. } - { - The~input~'#1'~is~a~number~which~has~more~than~one~part: \\ - ranges~can~only~contain~one~number~in~each~part. - } -\msg_new:nnn { siunitx } { non-convertible-exponent } - { Exponent~'#1'~cannot~be~converted~into~a~symbolic~prefix. } -\msg_new:nnn { siunitx } { option-not-available } - { Option~'#1'~not~available~in~strict~mode. } -\msg_new:nnn { siunitx } { option-preamble-only } - { Option~'#1'~only~available~in~the~preamble. } -\msg_new:nnnn { siunitx } { prefix-base-mismatch } - { Prefix~bases~do~not~match. } - { - You~have~asked~for~prefixes~to~be~converted~into~a~power,~ - but~the~bases~do~not~match. - } -\msg_new:nnn { siunitx } { prefix-only } - { Prefix~with~no~unit. } -\msg_new:nnnn { siunitx } { qualifier-before-unit } - { Qualifier~before~unit. } - { Unit~qualifiers~have~to~follow~after~units,~not~before~them. } -\msg_new:nnnn { siunitx } { restricted-number } - { Token~'#1'~forbidden~in~restricted~numerical~input. } - { - The~current~input~must~be~a~real~number~and~cannot~contain: \\ - \ -~an~exponent; \\ - \ -~an~uncertainty; \\ - \ -~a~complex~part. - } -\msg_new:nnnn { siunitx } { starting-product-token } - { Misplaced~product~token. } - { A~number~cannot~begin~with~a~product~token. } -\msg_new:nnnn { siunitx } { starting-quotient-token } - { Misplaced~quotient~token. } - { A~number~cannot~begin~with~a~quotient~token. } -\msg_new:nnnn { siunitx } { table-partial-number } - { No~space~reserved~for~#1~\msg_line_context:. } - { - The~number~in~the~current~table~cell~contains~#1~part, - but~you~did~not~reserve~any~space~to~print~it: \\ - it~will~be~missing~in~the~output. - } -\msg_new:nnnn { siunitx } { unknown-option } - { Unknown~option~'#1'. } - { - The~option~file~'#1'~is~not~known~by~siunitx: - perhaps~it~is~spelled~incorrectly. - } -\msg_new:nnnn { siunitx } { version-1-option } - { Version~1~option~'#1'~detected. } - { - Use: \\ - \ \ \token_to_str:N \usepackage [ version-1-compatibility ] - \iow_char:N \{ siunitx \token_to_str:N \iow_char:N \} \\ - in~the~preamble~to~load~the~appropriate~code. - } -\NewDocumentCommand \DeclareBinaryPrefix { m m m } { - \__siunitx_declare_prefix:Nnnn #1 {#2} { 2 } {#3} -} -\NewDocumentCommand \DeclareSIPostPower { m m } { - \__siunitx_declare_power_after:Nn #1 {#2} -} -\NewDocumentCommand \DeclareSIPrefix { m m m } { - \__siunitx_declare_prefix:Nnnn #1 {#2} { 10 } {#3} -} -\NewDocumentCommand \DeclareSIPrePower { m m } { - \__siunitx_declare_power_before:Nn #1 {#2} -} -\NewDocumentCommand \DeclareSIQualifier { m m } { - \__siunitx_declare_qualifier:Nn #1 {#2} -} -\NewDocumentCommand \DeclareSIUnit { O { } m m } { - \__siunitx_declare_unit:Nnn #2 {#3} {#1} -} -\NewDocumentCommand \DeclareSIUnitWithOptions { m m m } { - \__siunitx_declare_unit:Nnn #1 {#2} {#3} -} -\@onlypreamble \DeclareBinaryPrefix -\@onlypreamble \DeclareSIPostPower -\@onlypreamble \DeclareSIPrefix -\@onlypreamble \DeclareSIPrePower -\@onlypreamble \DeclareSIQualifier -\@onlypreamble \DeclareSIUnit -\@onlypreamble \DeclareSIUnitWithOptions -\cs_new_protected:Npn \SendSettingsToPgf { \__siunitx_pgf_link: } -\NewDocumentCommand \ang { o > { \SplitArgument { 2 } { ; } } m } { - \group_begin: - \IfNoValueF {#1} - { \keys_set:nn { siunitx } {#1} } - \__siunitx_angle_output:nnn #2 - \group_end: -} -\NewDocumentCommand \num { o m } { - \leavevmode - \group_begin: - \bool_set_false:N \l__siunitx_font_set_bool - \IfNoValueF {#1} - { \keys_set:nn { siunitx } {#1} } - \__siunitx_number_output:n {#2} - \group_end: -} -\NewDocumentCommand \numlist { o > { \SplitList { ; } } m } { - \leavevmode - \group_begin: - \bool_set_false:N \l__siunitx_font_set_bool - \IfNoValueF {#1} - { \keys_set:nn { siunitx } {#1} } - \__siunitx_list_numbers:n {#2} - \group_end: -} -\NewDocumentCommand \numrange { o m m } { - \leavevmode - \group_begin: - \bool_set_false:N \l__siunitx_font_set_bool - \IfNoValueF {#1} - { \keys_set:nn { siunitx } {#1} } - \__siunitx_range_numbers:nn {#2} {#3} - \group_end: -} -\NewDocumentCommand \SIlist { o > { \SplitList { ; } } m m } { - \leavevmode - \group_begin: - \bool_set_false:N \l__siunitx_font_set_bool - \IfNoValueTF {#1} - { \__siunitx_list_units:nnn {#2} {#3} { } } - { - \keys_set:nn { siunitx } {#1} - \__siunitx_list_units:nnn {#2} {#3} {#1} - } - \group_end: -} -\NewDocumentCommand \SIrange { o m m m } { - \leavevmode - \group_begin: - \bool_set_false:N \l__siunitx_font_set_bool - \IfNoValueTF {#1} - { \__siunitx_range_unit:nnnn {#4} { } {#2} {#3} } - { - \keys_set:nn { siunitx } {#1} - \__siunitx_range_unit:nnnn {#4} {#1} {#2} {#3} - } - \group_end: -} -\NewDocumentCommand \SI { o m o m } { - \leavevmode - \group_begin: - \bool_set_false:N \l__siunitx_font_set_bool - \IfNoValueTF {#1} - { \__siunitx_combined:nnnn { } {#2} {#3} {#4} } - { - \keys_set:nn { siunitx } {#1} - \__siunitx_combined:nnnn {#1} {#2} {#3} {#4} - } - \group_end: -} -\NewDocumentCommand \sisetup { m } { - \keys_set:nn { siunitx } {#1} -} -\NewDocumentCommand \tablenum { o m } { - \leavevmode - \group_begin: - \bool_set_false:N \l__siunitx_font_set_bool - \IfNoValueF {#1} - { \keys_set:nn { siunitx } {#1} } - \bool_if:NTF \l__siunitx_number_parse_bool - { - \tl_set:Nn \l__siunitx_table_collect_tl {#2} - \bool_set_false:N \l__siunitx_table_collect_pre_bool - \__siunitx_table_print_S: - } - { \__siunitx_table_print_S_direct: #2 \__siunitx_table_print: } - \group_end: -} -\NewDocumentCommand \si { o m } { - \leavevmode - \group_begin: - \bool_set_false:N \l__siunitx_font_set_bool - \IfNoValueTF {#1} - { \__siunitx_unit_output:nn {#2} { } } - { - \keys_set:nn { siunitx } {#1} - \__siunitx_unit_output:nn {#2} {#1} - } - \group_end: -} -\AtBeginDocument - { - \cs_set:Npn \addtocontents #1#2 - { - \protected@write \@auxout - { - \cs_set_eq:NN \label \use_none:n - \cs_set_eq:NN \index \use_none:n - \cs_set_eq:NN \glossary \use_none:n - \seq_map_inline:Nn \l_siunitx_unit_symbolic_seq - { \__siunitx_contents_add:N ##1 } - } - { \token_to_str:N \@writefile {#1} {#2} } - } - } -\cs_new_protected:Npn \__siunitx_contents_add:N #1 - { - \cs_set:Npn #1 - { - \token_to_str:N #1 - \c_space_tl - } - } -\cs_new_protected:Npn \__siunitx_contents_bookmarks: - { - \seq_map_inline:Nn \l_siunitx_unit_symbolic_seq - { \__siunitx_unit_print_literal_aux:N ##1 } - \cs_if_exist:NT \FB@fg - { \cs_set_eq:NN \fg \FB@fg } - \msg_redirect_name:nnn { xparse } { redefine-command } { none } - \cs_set_eq:NN \num \numInBookmark - \cs_set_eq:NN \numrange \numrangeInBookmark - \cs_set_eq:NN \si \siInBookmark - \cs_set_eq:NN \SI \SIInBookmark - \cs_set_eq:NN \SIrange \SIrangeInBookmark - \cs_set_eq:NN \si \siInBookmark - \cs_set_eq:NN \highlight \use_ii:nn - \cs_set_eq:NN \__siunitx_textsuperscript:n \use:n - \cs_set:Npn \SIUnitSymbolAngstrom { \AA } - \cs_set:Npn \SIUnitSymbolArcminute { ' } - \cs_set:Npn \SIUnitSymbolArcsecond { '' } - \cs_set:Npn \SIUnitSymbolCelsius { \textcelsius } - \cs_set:Npn \SIUnitSymbolDegree { \textdegree } - \cs_set:Npn \SIUnitSymbolMicro { \textmu } - \cs_set:Npn \SIUnitSymbolOhm { [ohm] } - } -\DeclareExpandableDocumentCommand \numInBookmark { o m } {#2} -\DeclareExpandableDocumentCommand \numrangeInBookmark { o m m } - { #2 \l__siunitx_range_phrase_tl #3 } -\DeclareExpandableDocumentCommand \SIInBookmark { o m o m } - { \IfNoValueF {#3} {#3} #2 ~ #4 } -\DeclareExpandableDocumentCommand \SIlistInBookmark - { o m m } { \__siunitx_bookmark_SIlist_map:nn {#1} {#2} } -\DeclareExpandableDocumentCommand \SIrangeInBookmark - { o m m m } { #2 ~ #4 \l__siunitx_range_phrase_tl #3 ~ #4 } -\DeclareExpandableDocumentCommand \siInBookmark { o m } {#2} -\cs_new:Npn \__siunitx_bookmark_SIlist_map:nn #1#2 { - \__siunitx_bookmark_SIlist_map_aux:nw {#2} #1 ; \q_recursion_tail ; - \q_recursion_tail ; \q_recursion_stop -} -\cs_new:Npn \__siunitx_bookmark_SIlist_map_aux:nw #1#2 ; #3 ; #4 { - #2 ~ #1 - \quark_if_recursion_tail_stop:n {#3} - \quark_if_recursion_tail_stop_do:nn {#4} - { - \l__siunitx_list_separator_final_tl - #3 ~ #1 - } - \l__siunitx_list_separator_tl - \__siunitx_bookmark_SIlist_map_aux:nw {#1} #3 ; #4 -} -\AtBeginDocument { - \@ifpackageloaded { hyperref } - { \pdfstringdefDisableCommands { \__siunitx_contents_bookmarks: } } - { } -} -\DeclareSIUnit \kilogram { \kilo \gram } -\DeclareSIUnit \metre { m } -\DeclareSIUnit \meter { \metre } -\DeclareSIUnit \mole { mol } -\DeclareSIUnit \second { s } -\DeclareSIUnit \ampere { A } -\DeclareSIUnit \kelvin { K } -\DeclareSIUnit \candela { cd } -\DeclareSIUnit \gram { g } -\DeclareSIPrefix \yocto { y } { -24 } -\DeclareSIPrefix \zepto { z } { -21 } -\DeclareSIPrefix \atto { a } { -18 } -\DeclareSIPrefix \femto { f } { -15 } -\DeclareSIPrefix \pico { p } { -12 } -\DeclareSIPrefix \nano { n } { -9 } -\DeclareSIPrefix \micro { \SIUnitSymbolMicro } { -6 } -\DeclareSIPrefix \milli { m } { -3 } -\DeclareSIPrefix \centi { c } { -2 } -\DeclareSIPrefix \deci { d } { -1 } -\DeclareSIPrefix \deca { da } { 1 } -\DeclareSIPrefix \deka { da } { 1 } -\DeclareSIPrefix \hecto { h } { 2 } -\DeclareSIPrefix \kilo { k } { 3 } -\DeclareSIPrefix \mega { M } { 6 } -\DeclareSIPrefix \giga { G } { 9 } -\DeclareSIPrefix \tera { T } { 12 } -\DeclareSIPrefix \peta { P } { 15 } -\DeclareSIPrefix \exa { E } { 18 } -\DeclareSIPrefix \zetta { Z } { 21 } -\DeclareSIPrefix \yotta { Y } { 24 } -\DeclareSIUnit \becquerel { Bq } -\DeclareSIUnit \celsius { \SIUnitSymbolCelsius } -\DeclareSIUnit \degreeCelsius { \SIUnitSymbolCelsius } -\DeclareSIUnit \coulomb { C } -\DeclareSIUnit \farad { F } -\DeclareSIUnit \gray { Gy } -\DeclareSIUnit \hertz { Hz } -\DeclareSIUnit \henry { H } -\DeclareSIUnit \joule { J } -\DeclareSIUnit \katal { kat } -\DeclareSIUnit \lumen { lm } -\DeclareSIUnit \lux { lx } -\DeclareSIUnit \newton { N } -\DeclareSIUnit \ohm { \SIUnitSymbolOhm } -\DeclareSIUnit \pascal { Pa } -\DeclareSIUnit \radian { rad } -\DeclareSIUnit \siemens { S } -\DeclareSIUnit \sievert { Sv } -\DeclareSIUnit \steradian { sr } -\DeclareSIUnit \tesla { T } -\DeclareSIUnit \volt { V } -\DeclareSIUnit \watt { W } -\DeclareSIUnit \weber { Wb } -\DeclareSIUnit [ number-unit-product = ] \arcmin { \arcminute } -\DeclareSIUnit [ number-unit-product = ] - \arcminute { \SIUnitSymbolArcminute } -\DeclareSIUnit [ number-unit-product = ] - \arcsecond { \SIUnitSymbolArcsecond } -\DeclareSIUnit \day { d } -\DeclareSIUnit[ number-unit-product = ] \degree { \SIUnitSymbolDegree } -\DeclareSIUnit \hectare { ha } -\DeclareSIUnit \hour { h } -\DeclareSIUnit \litre { l } -\DeclareSIUnit \liter { L } -\DeclareSIUnit \minute { min } -\DeclareSIUnit \percent { \char 37 } -\DeclareSIUnit \tonne { t } -\DeclareSIUnit \astronomicalunit { ua } -\DeclareSIUnit \atomicmassunit { u } -\DeclareSIUnit \electronvolt { eV } -\DeclareSIUnit \dalton { Da } -\group_begin: -\cs_set_eq:NN \endgroup \group_end: -\char_set_catcode_math_subscript:N \_ -\use:n - { - \endgroup - \DeclareSIUnit \clight { \text { \ensuremath { c _ { 0 } } } } - \DeclareSIUnit \electronmass - { \text { \ensuremath { m _ { \textup { e } } } } } - } -\DeclareSIUnit \planckbar { \text { \ensuremath { \hbar } } } -\DeclareSIUnit \elementarycharge { \text { \ensuremath { e } } } -\group_begin: -\cs_set_eq:NN \endgroup \group_end: -\char_set_catcode_math_subscript:N \_ -\use:n - { - \endgroup - \DeclareSIUnit \bohr { \text { \ensuremath { a _ { 0 } } } } - \DeclareSIUnit \hartree - { \text { \ensuremath { E _ { \textup { h } } } } } - } -\DeclareSIUnit \angstrom { \SIUnitSymbolAngstrom } -\DeclareSIUnit \bar { bar } -\DeclareSIUnit \barn { b } -\DeclareSIUnit \bel { B } -\DeclareSIUnit \decibel { \deci \bel } -\DeclareSIUnit \knot { kn } -\DeclareSIUnit \mmHg { mmHg } -\DeclareSIUnit \nauticalmile { M } -\DeclareSIUnit \neper { Np } -\DeclareSIPrePower \square { 2 } -\DeclareSIPostPower \squared { 2 } -\DeclareSIPrePower \cubic { 3 } -\DeclareSIPostPower \cubed { 3 } -\keys_define:nn { siunitx } { - strict .code:n = - { - \keys_set:nn { siunitx } - { - bracket-numbers = true, - detect-family = false, - detect-mode = false, - detect-shape = false, - detect-weight = false, - multi-part-units = brackets, - parse-numbers = true, - parse-units = true, - product-units = repeat - } - \__siunitx_strict_option:n - { - bracket-numbers , - detect-family , - detect-italic , - detect-mode , - detect-shape , - detect-weight , - multi-part-units , - parse-numbers , - parse-units , - product-units - } - \keys_define:nn { siunitx } - { - per-mode / repeated-symbol .code:n = - { - \msg_warning:nnx { siunitx } { option-not-available } - { per-mode~=~repeated-symbol } - } - } - } -} -\__siunitx_option_deactivate:n { strict } -\cs_new_protected:Npn \__siunitx_strict_option:n #1 { - \clist_map_function:nN {#1} \__siunitx_strict_option_aux:n -} -\cs_new_protected:Npn \__siunitx_strict_option_aux:n #1 { - \keys_define:nn { siunitx } - { #1 .code:n = - { \msg_warning:nnx { siunitx } { option-not-available } {#1} } - } -} -\keys_define:nn { siunitx } { - locale .choice:, - locale / - DE .meta:n = - { - exponent-product = \ensuremath { \cdot } , - inter-unit-product = \, , - output-decimal-marker = { , } - }, - locale / - FR .meta:n = - { - exponent-product = \ensuremath { \times } , - inter-unit-product = \, , - output-decimal-marker = { , } - }, - locale / - UK .meta:n = - { - exponent-product = \ensuremath { \times } , - inter-unit-product = \, , - output-decimal-marker = . - }, - locale / - US .meta:n = { locale = UK }, - locale / - USA .meta:n = { locale = UK }, - locale / - ZA .meta:n = - { - exponent-product = \ensuremath { \times } , - inter-unit-product = \ensuremath { \cdot } , - output-decimal-marker = { , } - }, -} -\file_if_exist:nT { translator.sty } - { - \RequirePackage { translator } - \usedictionary { translator-basic-dictionary } - \providetranslation [ to = English ] - { to~(numerical~range) } { to } - \providetranslation [ to = French ] - { to~(numerical~range) } { \`a } - \providetranslation [ to = German ] - { to~(numerical~range) } { bis } - \providetranslation [ to = Spanish ] - { to~(numerical~range) } { a } - \sisetup - { - list-final-separator = { ~ \translate { and } ~ }, - list-pair-separator = { ~ \translate { and } ~ }, - range-phrase = { ~ \translate { to~(numerical~range) } ~ } - } - } -\tl_const:Nn \c__siunitx_configuration_ext_tl { cfg } -\keys_define:nn { siunitx } - { - abbreviations .choice:, - abbreviations / - true .code:n = { \__siunitx_load_abbreviations: }, - abbreviations / - false .code:n = - { \cs_set_eq:NN \__siunitx_load_abbreviations: \prg_do_nothing: } , - abbreviations .default:n = true , - binary-units .choice:, - binary-units / - true .code:n = { \AtBeginDocument { \__siunitx_load_binary: } }, - binary-units / - false .code:n = - { \cs_set_eq:NN \__siunitx_load_binary: \prg_do_nothing: } , - binary-units .default:n = true - } -\cs_new_protected:Npn \__siunitx_load_abbreviations: - { - \@onefilewithoptions { siunitx-abbreviations } [ ] [ ] - \c__siunitx_configuration_ext_tl - } -\cs_new_protected:Npn \__siunitx_load_binary: - { - \@onefilewithoptions { siunitx-binary } [ ] [ ] - \c__siunitx_configuration_ext_tl - } -\AtBeginDocument { \__siunitx_load_abbreviations: } -\__siunitx_option_deactivate:n { abbreviations , binary } -\keys_define:nn { siunitx } - { - version-1-compatibility .choice: , - version-1-compatibility / - true .code:n = - { - \@onefilewithoptions { siunitx-version-1 } [ ] [ ] - \c__siunitx_configuration_ext_tl - }, - version-1-compatibility / - false .code:n = { } , - version-1-compatibility .default:n = true - } -\__siunitx_option_deactivate:n { version-1-compatibility } -\keys_define:nn { siunitx } { - load-configurations .code:n = - { - \clist_if_in:nnT {#1} { version-1 } - { - \@onefilewithoptions { siunitx-version-1 } [ ] [ ] - \c__siunitx_configuration_ext_tl - } - } -} -\__siunitx_option_deactivate:n { load-configurations } -\file_if_exist:nT { siunitx . \c__siunitx_configuration_ext_tl } - { - \@onefilewithoptions { siunitx } [ ] [ ] - \c__siunitx_configuration_ext_tl - } -\ProcessKeysOptions { siunitx } -\AtBeginDocument { - \bool_if:NTF \l__siunitx_create_free_bool - { \__siunitx_unit_create_functions: } - { \__siunitx_unit_create_empty_functions: } -} -%% Copyright (C) 2008-2017 by -%% Joseph Wright -%% -%% It may be distributed and/or modified under the conditions of -%% the LaTeX Project Public License (LPPL), either version 1.3c of -%% this license or (at your option) any later version. The latest -%% version of this license is in the file: -%% http://www.latex-project.org/lppl.txt -%% -%% This work is "maintained" (as per LPPL maintenance status) by -%% Joseph Wright. -%% -%% This work consists of the file siunitx.dtx -%% and the derived files siunitx.pdf, -%% siunitx.sty and -%% siunitx.ins. -%% -%% End of file `siunitx.sty'.