diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/lwarp/lwarp-siunitx.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/lwarp/lwarp-siunitx.sty | 155 |
1 files changed, 144 insertions, 11 deletions
diff --git a/Master/texmf-dist/tex/latex/lwarp/lwarp-siunitx.sty b/Master/texmf-dist/tex/latex/lwarp/lwarp-siunitx.sty index c32278d70e9..b57c67a0fce 100644 --- a/Master/texmf-dist/tex/latex/lwarp/lwarp-siunitx.sty +++ b/Master/texmf-dist/tex/latex/lwarp/lwarp-siunitx.sty @@ -227,7 +227,6 @@ \__siunitx_number_output:n {#2} \group_end:% lwarp } - \RenewDocumentCommand \numrange { o m m } { \leavevmode \group_begin:% lwarp @@ -239,7 +238,6 @@ \__siunitx_range_numbers:nn {#2} {#3} \group_end:% lwarp } - \RenewDocumentCommand \ang { o > { \SplitArgument { 2 } { ; } } m } { \group_begin:% lwarp \LetLtxMacro\@ensuredmath\LWR@origensuredmath% lwarp @@ -249,7 +247,6 @@ \__siunitx_angle_output:nnn #2 \group_end:% lwarp } - \RenewDocumentCommand \si { o m } { \leavevmode \group_begin:% lwarp @@ -264,7 +261,6 @@ } \group_end:% lwarp } - \RenewDocumentCommand{\SIrange}{o m m m} {% \leavevmode @@ -280,23 +276,160 @@ } \group_end:% lwarp } - \ExplSyntaxOff \begin{warpMathJax} \LWR@infoprocessingmathjax{siunitx} \CustomizeMathJax{\newcommand{\tothe}[1]{^{#1}}} \CustomizeMathJax{\newcommand{\raiseto}[2]{{#2}^{#1}}} +\CustomizeMathJax{\newcommand{\LWRsiunitxEND}{}} +\CustomizeMathJax{\def\LWRsiunitxang#1;#2;#3;#4\LWRsiunitxEND{% + \ifblank{#1}{}{\num{#1}\degree}% + \ifblank{#2}{}{\num{#2}^{\unicode{x2032}}}% \prime + \ifblank{#3}{}{\num{#3}^{\unicode{x2033}}}% \dblprime +}} +\CustomizeMathJax{\newcommand{\ang}[2][]{\LWRsiunitxang#2;;;\LWRsiunitxEND}} +\CustomizeMathJax{\newcommand{\LWRsiunitxnumscientific}[2]{% + \ifblank{#1}% + {}% + {% + \ifstrequal{#1}{-}% + {-}% + {\LWRsiunitxprintdecimal{#1}\times}% + }% + 10^{\LWRsiunitxprintdecimal{#2}} +}} +\ExplSyntaxOn +\AtBeginDocument{ +\ifdefstring{\l__siunitx_output_decimal_tl}{{,}} + {% Use decimal comma + \CustomizeMathJax{\def\LWRsiunitxprintdecimalsub#1.#2.#3\LWRsiunitxEND{% + \mathrm{#1}% + \ifblank{#2} + {}% + {,\mathrm{#2}} + }} + + \CustomizeMathJax{\newcommand{\LWRsiunitxprintdecimal}[1]{% + \LWRsiunitxprintdecimalsub#1...\LWRsiunitxEND% + }} + } + {% Use decimal point + \CustomizeMathJax{\def\LWRsiunitxprintdecimalsub#1,#2,#3\LWRsiunitxEND{% + \mathrm{#1}% + \ifblank{#2} + {}% + {.\mathrm{#2}} + }} + + \CustomizeMathJax{\newcommand{\LWRsiunitxprintdecimal}[1]{% + \LWRsiunitxprintdecimalsub#1,,,\LWRsiunitxEND% + }} + } +} +\ExplSyntaxOff +\CustomizeMathJax{\def\LWRsiunitxnumplus#1+#2+#3\LWRsiunitxEND{% + \ifblank{#2} + {\LWRsiunitxprintdecimal{#1}}% no plus + {% + \ifblank{#1}% + {\LWRsiunitxprintdecimal{#2}}% leading plus, ignore + {% a+b + \LWRsiunitxprintdecimal{#1}% + \unicode{x02B}% plus sign + \LWRsiunitxprintdecimal{#2}% + }% + }% +}} + +\CustomizeMathJax{\def\LWRsiunitxnumminus#1-#2-#3\LWRsiunitxEND{% + \ifblank{#2} + {\LWRsiunitxnumplus#1+++\LWRsiunitxEND}% + {% + \LWRsiunitxprintdecimal{#1}% + \unicode{x02212}% mathematical minus sign + \LWRsiunitxprintdecimal{#2}% + }% +}} + +\CustomizeMathJax{\def\LWRsiunitxnumpm#1+-#2+-#3\LWRsiunitxEND{% + \ifblank{#2}% + {\LWRsiunitxnumminus#1---\LWRsiunitxEND}% + {% + \LWRsiunitxprintdecimal{#1}% + \unicode{x0B1}% \pm + \LWRsiunitxprintdecimal{#2}% + }% +}} + +\CustomizeMathJax{\def\LWRsiunitxnumx#1x#2x#3x#4\LWRsiunitxEND{% + \ifblank{#2}% + {\LWRsiunitxnumpm#1+-+-\LWRsiunitxEND}% + {% + \ifblank{#3}% + {% + \LWRsiunitxprintdecimal{#1}% + \times% + \LWRsiunitxprintdecimal{#2}% + }% + {% + \LWRsiunitxprintdecimal{#1}% + \times% + \LWRsiunitxprintdecimal{#2}% + \times% + \LWRsiunitxprintdecimal{#3}% + }% + }% +}} -\CustomizeMathJax{\newcommand{\ang}[2][]{(\mathrm{#2})\degree}} -\CustomizeMathJax{\newcommand{\num}[2][]{\mathrm{#2}}} +\CustomizeMathJax{\def\LWRsiunitxnumD#1D#2D#3\LWRsiunitxEND{% + \ifblank{#2}% + {\LWRsiunitxnumx#1xxxxx\LWRsiunitxEND}% + {\mathrm{\LWRsiunitxnumscientific{#1}{#2}}}% +}} + +\CustomizeMathJax{\def\LWRsiunitxnumd#1d#2d#3\LWRsiunitxEND{% + \ifblank{#2}% + {\LWRsiunitxnumD#1DDD\LWRsiunitxEND}% + {\mathrm{\LWRsiunitxnumscientific{#1}{#2}}}% +}} + +\CustomizeMathJax{\def\LWRsiunitxnumE#1E#2E#3\LWRsiunitxEND{% + \ifblank{#2}% + {\LWRsiunitxnumd#1ddd\LWRsiunitxEND}% + {\mathrm{\LWRsiunitxnumscientific{#1}{#2}}}% +}} + +\CustomizeMathJax{\def\LWRsiunitxnume#1e#2e#3\LWRsiunitxEND{% + \ifblank{#2}% + {\LWRsiunitxnumE#1EEE\LWRsiunitxEND}% + {\mathrm{\LWRsiunitxnumscientific{#1}{#2}}}% +}} + +\CustomizeMathJax{\def\LWRsiunitxnumcomma#1,#2,#3\LWRsiunitxEND{% + \ifblank{#2} + {\LWRsiunitxnume#1eee\LWRsiunitxEND} + {\LWRsiunitxnume#1.#2eee\LWRsiunitxEND} +}} + +\CustomizeMathJax{\newcommand{\num}[2][]{\LWRsiunitxnumcomma#2,,,\LWRsiunitxEND}} \CustomizeMathJax{\newcommand{\si}[2][]{\mathrm{#2}}} -\CustomizeMathJax{\newcommand{\LWRSI}[2][]{\mathrm{#1\LWRSInumber\,#2}}} -\CustomizeMathJax{\newcommand{\SI}[2][]{\def\LWRSInumber{#2}\LWRSI}} +\CustomizeMathJax{\def\LWRsiunitxSIopt#1[#2]#3{% + {#2}\num{#1}{#3}% +}} + +\CustomizeMathJax{\newcommand{\LWRsiunitxSI}[2]{% + \num{#1}\,{#2}% +}} +\CustomizeMathJax{\newcommand{\SI}[2][]{% + \ifnextchar[% + {\LWRsiunitxSIopt{#2}}% + {\LWRsiunitxSI{#2}}% +}} \CustomizeMathJax{\newcommand{\numlist}[2][]{\mathrm{#2}}} -\CustomizeMathJax{\newcommand{\numrange}[3][]{\mathrm{#2\,\unicode{x2013}\,#3}}} +\CustomizeMathJax{\newcommand{\numrange}[3][]{\num{#2}\,\unicode{x2013}\,\num{#3}}} \CustomizeMathJax{\newcommand{\SIlist}[3][]{\mathrm{#2\,#3}}} -\CustomizeMathJax{\newcommand{\SIrange}[4][]{\mathrm{#2\,#4\,\unicode{x2013}\,#3\,#4}}} +\CustomizeMathJax{\newcommand{\SIrange}[4][]{\num{#2}\,#4\,\unicode{x2013}\,\num{#3}\,#4}} \CustomizeMathJax{\newcommand{\tablenum}[2][]{\mathrm{#2}}} \CustomizeMathJax{\newcommand{\ampere}{\mathrm{A}}} \CustomizeMathJax{\newcommand{\candela}{\mathrm{cd}}} |