texlive[74673] Master/texmf-dist: siunitx (17mar25)

commits+karl at tug.org commits+karl at tug.org
Mon Mar 17 20:53:41 CET 2025


Revision: 74673
          https://tug.org/svn/texlive?view=revision&revision=74673
Author:   karl
Date:     2025-03-17 20:53:41 +0100 (Mon, 17 Mar 2025)
Log Message:
-----------
siunitx (17mar25)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/siunitx/CHANGELOG.md
    trunk/Master/texmf-dist/doc/latex/siunitx/siunitx-code.pdf
    trunk/Master/texmf-dist/doc/latex/siunitx/siunitx.pdf
    trunk/Master/texmf-dist/source/latex/siunitx/siunitx-complex.dtx
    trunk/Master/texmf-dist/source/latex/siunitx/siunitx-table.dtx
    trunk/Master/texmf-dist/source/latex/siunitx/siunitx-unit.dtx
    trunk/Master/texmf-dist/source/latex/siunitx/siunitx.dtx
    trunk/Master/texmf-dist/source/latex/siunitx/siunitx.tex
    trunk/Master/texmf-dist/tex/latex/siunitx/siunitx.sty

Modified: trunk/Master/texmf-dist/doc/latex/siunitx/CHANGELOG.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/siunitx/CHANGELOG.md	2025-03-17 19:46:11 UTC (rev 74672)
+++ trunk/Master/texmf-dist/doc/latex/siunitx/CHANGELOG.md	2025-03-17 19:53:41 UTC (rev 74673)
@@ -7,12 +7,25 @@
 
 ## [Unreleased]
 
+## [v3.4.7] - 2025-03-17
+
+### Changed
+- Adjust for `tabularray` changes (see issue
+  [\#783](https://github.com/josephwright/siunitx/issues/#783))
+
+### Fixed
+- Error cleanly if conversion of `\pm` in complex value to polar
+  form is attempted (see issue
+  [\#781](https://github.com/josephwright/siunitx/issues/#781))
+- Detect duplicate complex root symbols (see issue
+  [\#782](https://github.com/josephwright/siunitx/issues/#782))
+
 ## [v3.4.6] - 2025-02-27
 
 ### Fixed
 - Application of option setting `prefix-mode = combine-exponent` to complex
   numbers (see issue
-  [\#779](https://github.com/josephwright/siunitx/issues/770))
+  [\#779](https://github.com/josephwright/siunitx/issues/779))
 
 ## [v3.4.5] - 2025-02-19
 
@@ -726,7 +739,7 @@
 - Rounding to an uncertainty of the same magnitude as the
   value (issue
   [\#524](https://github.com/josephwright/siunitx/issues/524))
-- Extend `propogate-math-font` to cover `\mathbf` and `\mathit`
+- Extend `propagate-math-font` to cover `\mathbf` and `\mathit`
   (issue [\#525](https://github.com/josephwright/siunitx/issues/525))
 - Position of non-aligned non-numeric material in table cells when
   centering decimal marker (issue
@@ -2248,7 +2261,8 @@
 ### Added
 - First public testing release (as `si`)
 
-[Unreleased]: https://github.com/josephwright/siunitx/compare/v3.4.6...HEAD
+[Unreleased]: https://github.com/josephwright/siunitx/compare/v3.4.7...HEAD
+[v3.4.7]: https://github.com/josephwright/siunitx/compare/v3.4.6...v3.4.7
 [v3.4.6]: https://github.com/josephwright/siunitx/compare/v3.4.5...v3.4.6
 [v3.4.5]: https://github.com/josephwright/siunitx/compare/v3.4.4...v3.4.5
 [v3.4.4]: https://github.com/josephwright/siunitx/compare/v3.4.3...v3.4.4

Modified: trunk/Master/texmf-dist/doc/latex/siunitx/siunitx-code.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/siunitx/siunitx.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/source/latex/siunitx/siunitx-complex.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/siunitx/siunitx-complex.dtx	2025-03-17 19:46:11 UTC (rev 74672)
+++ trunk/Master/texmf-dist/source/latex/siunitx/siunitx-complex.dtx	2025-03-17 19:53:41 UTC (rev 74673)
@@ -310,8 +310,21 @@
 %
 % \subsection{Parsing}
 %
-% \begin{macro}{\@@_parse:nNN}
-% \begin{macro}{\@@_parse_end:}
+% \begin{macro}{\@@_expand:nN}
+%   A small auxiliary to expand input and replace symbols: we need to do this
+%   quite early so it is separated out. The storage is hard-coded as this is
+%   low-level stuff.
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_expand:n #1
+  {
+    \protected at edef \l_@@_arg_tl {#1}
+    \tl_set_eq:NN \l_@@_input_tl \l_@@_arg_tl
+    \siunitx_number_normalize_symbols:N \l_@@_arg_tl
+  }
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_parse:n, \@@_parse:V}
 % \begin{macro}{\@@_parse_clear:}
 %   Parsing for complex numbers needs some of the same approaches as the
 %   general parser. However, as the aim here is to do only enough to split
@@ -320,25 +333,14 @@
 %   function here is not only there to make this function shorter: it
 %   also allows a single way to zap any stored data if a parse error occurs.
 %    \begin{macrocode}
-\cs_new_protected:Npn \@@_parse:nNN #1#2#3
+\cs_new_protected:Npn \@@_parse:n #1  
   {
-    \group_begin:
-      \@@_parse_clear:
-      \protected at edef \l_@@_arg_tl {#1}
-      \tl_set_eq:NN \l_@@_input_tl \l_@@_arg_tl
-      \siunitx_number_normalize_symbols:N \l_@@_arg_tl
-      \tl_if_empty:NF \l_@@_arg_tl
-        { \@@_parse_comparator: }
-      \@@_parse_check:
-      \cs_set_protected:Npx \@@_parse_end:
-        {
-          \tl_set:Nn \exp_not:N #2 { \exp_not:V \l_@@_real_tl }
-          \tl_set:Nn \exp_not:N #3 { \exp_not:V \l_@@_img_tl }
-        }
-    \exp_after:wN \group_end:
-    \@@_parse_end:
+    \@@_parse_clear:
+    \tl_if_empty:NF \l_@@_arg_tl
+      { \@@_parse_comparator: }
+    \@@_parse_check:
   }
-\cs_new_protected:Npn \@@_parse_end: { }
+\cs_generate_variant:Nn \@@_parse:n { V }
 \cs_new_protected:Npn \@@_parse_clear:
   {
     \tl_clear:N \l_@@_real_tl
@@ -350,7 +352,6 @@
 %    \end{macrocode}
 % \end{macro}
 % \end{macro}
-% \end{macro}
 %
 % \begin{macro}{\@@_parse_check:}
 % \begin{macro}{\@@_parse_check:N}
@@ -472,7 +473,7 @@
 %
 % \begin{macro}{\@@_parse_root:}
 % \begin{macro}{\@@_parse_root_auxi:w}
-% \begin{macro}{\@@_parse_root_auxii:nn}
+% \begin{macro}{\@@_parse_root_auxii:nnnN}
 %   Splitting at the complex root is much like splitting the exponent.
 %   After dealing with the case where there is no complex root allowed,
 %   use the first possible symbol to do the work.
@@ -491,13 +492,16 @@
           }
         \use:x
           {
-            \cs_set_protected:Npn
+            \cs_set_protected:Npx
               \exp_not:N \@@_parse_root_auxi:w
               ####1 \exp_not:V \l_@@_tmp_tl
               ####2 \exp_not:V \l_@@_tmp_tl
               ####3 \exp_not:N \q_stop
           }
-            { \@@_parse_root_auxii:nn {##1} {##2} }
+            {
+              \@@_parse_root_auxii:nnnN {##1} {##2} {##3}
+                \exp_not:V \l_@@_tmp_tl
+            }
         \use:x
           {
             \@@_parse_root_auxi:w
@@ -509,9 +513,11 @@
   }
 \cs_new_protected:Npn \@@_parse_root_auxi:w  { }
 %    \end{macrocode}
-%   This is where the business end lies. We have four possibilities:
+%   This is where the business end lies. We have five possibilities:
 %   \begin{itemize}
 %     \item There was no complex root at all: |#2| will be |\q_nil|
+%     \item More than one complex root sign was present: |#3| will not
+%       be equal to |\q_nil i|.
 %     \item All of the number is in the complex part with a leading
 %       root: |#1| will be empty. This includes the case where
 %       the input was \emph{just} a root symbol (plus possibly sign,
@@ -523,21 +529,28 @@
 %       with the root symbol: just the last token needs to be separated.
 %   \end{itemize}
 %    \begin{macrocode}
-\cs_new_protected:Npn \@@_parse_root_auxii:nn #1#2
+\cs_new_protected:Npn \@@_parse_root_auxii:nnnN #1#2#3#4
   {
     \quark_if_nil:nTF {#2}
       { \tl_set:Nn \l_@@_real_tl {#1} }
       {
-        \tl_set:Nn \l_@@_img_tl {#2}
-        \tl_if_blank:nTF {#1}
+        \str_if_eq:nnTF {#3} { \q_nil #4 }
           {
-            \tl_if_blank:nT {#2}
-              { \tl_set:Nn \l_@@_img_tl { 1 } }
+            \tl_set:Nn \l_@@_img_tl {#2}
+            \tl_if_blank:nTF {#1}
+              {
+                \tl_if_blank:nT {#2}
+                  { \tl_set:Nn \l_@@_img_tl { 1 } }
+              }
+              {
+                \tl_if_blank:nTF {#2}
+                  { \@@_parse_split:n {#1} }
+                  { \@@_parse_sign_check:n {#1} }
+              }
           }
           {
-            \tl_if_blank:nTF {#2}
-              { \@@_parse_split:n {#1} }
-              { \@@_parse_sign_check:n {#1} }
+            \msg_error:nnV { siunitx } { duplicate-complex-root }
+              \l_@@_input_tl
           }
       }
   }
@@ -701,26 +714,27 @@
 %    \begin{macrocode}
 \cs_new_protected:Npn \siunitx_complex_number:n #1
   {
-    \bool_lazy_and:nnTF
-      { \l_@@_force_polar_bool }
-      { \l_siunitx_number_parse_bool }
+    \bool_if:NTF \l_siunitx_number_parse_bool
       {
-        \use:e
-          {
-            \siunitx_complex_number:nn
-               \@@_convert_polar:n {#1}
-          }
+        \group_begin:
+          \@@_expand:n {#1}
+          \bool_if:NTF \l_@@_force_polar_bool
+            {
+              \use:e
+                {
+                  \siunitx_complex_number:nn
+                     \@@_convert_polar:V \l_@@_arg_tl
+                 }
+            }
+            {
+              \@@_parse:V \l_@@_arg_tl
+              \@@_format_cartesian:n { }
+            }
+        \group_end:
       }
       {
-        \bool_if:NTF \l_siunitx_number_parse_bool
-          {
-            \@@_parse:nNN {#1} \l_@@_real_tl \l_@@_img_tl
-            \@@_format_cartesian:n { }
-          }
-          {
-            \siunitx_number_format:nN {#1} \l_@@_tmp_tl
-            \siunitx_print_number:V \l_@@_tmp_tl
-          }
+        \siunitx_number_format:nN {#1} \l_@@_tmp_tl
+        \siunitx_print_number:V \l_@@_tmp_tl
       }
   }
 \cs_generate_variant:Nn \siunitx_complex_number:n { e, x }
@@ -751,25 +765,26 @@
   }
 \cs_new_protected:Npn \siunitx_complex_quantity:nn #1#2
   {
-    \bool_lazy_and:nnTF
-      { \l_@@_force_polar_bool }
-      { \l_siunitx_number_parse_bool }
+    \bool_if:NTF \l_siunitx_number_parse_bool
       {
-        \use:e
-          {
-            \siunitx_complex_quantity:nnn
-               \@@_convert_polar:n {#1}
-          }
-            {#2}
+        \group_begin:
+          \@@_expand:n {#1}
+          \bool_if:NTF \l_@@_force_polar_bool
+            {
+              \use:e
+                {
+                  \siunitx_complex_quantity:nnn
+                     \@@_convert_polar:V \l_@@_arg_tl
+                 }
+            }
+            {
+              \@@_parse:V \l_@@_arg_tl
+              \@@_format_cartesian:n
+            }
+              {#2}
+        \group_end:
       }
-      {
-        \bool_if:NTF \l_siunitx_number_parse_bool
-          {
-            \@@_parse:nNN {#1} \l_@@_real_tl \l_@@_img_tl
-            \@@_format_cartesian:n {#2}
-          }
-          { \siunitx_quantity:nn {#1} {#2} }
-      }
+      { \siunitx_quantity:nn {#1} {#2} }
   }
 \cs_generate_variant:Nn \siunitx_complex_quantity:nn { e , x }
 \cs_new_protected:Npn \siunitx_complex_quantity:nnn #1#2#3
@@ -1173,16 +1188,17 @@
 % \end{macro}
 % \end{macro}
 %
-% \begin{macro}[EXP]{\@@_convert_polar:n}
+% \begin{macro}[EXP]{\@@_convert_polar:n, \@@_convert_polar:V}
 % \begin{macro}[EXP]{\@@_convert_polar_auxi:w}
 % \begin{macro}[EXP]{\@@_convert_polar_auxii:nw}
-% \begin{macro}[EXP]{\@@_convert_polar_auxiii:nnw}
+% \begin{macro}[EXP]{\@@_convert_polar_auxiii:nw}
 % \begin{macro}[EXP]{\@@_convert_polar_auxiv:nnw}
 % \begin{macro}[EXP]{\@@_convert_polar_auxv:nnw}
-% \begin{macro}[EXP]{\@@_convert_polar_auxvi:nnn, \@@_convert_polar_auxvi:enn}
-% \begin{macro}[EXP]{\@@_convert_polar_auxvii:nnn}
+% \begin{macro}[EXP]{\@@_convert_polar_auxvi:nnw}
+% \begin{macro}[EXP]{\@@_convert_polar_auxvii:nnn, \@@_convert_polar_auxvii:enn}
+% \begin{macro}[EXP]{\@@_convert_polar_auxviii:nnn}
 % \begin{macro}[EXP]
-%   {\@@_convert_polar_auxviii:nnn, \@@_convert_polar_auxviii:eee}
+%   {\@@_convert_polar_auxix:nnn, \@@_convert_polar_auxix:eee}
 % \begin{macro}[EXP]
 %   {\@@_convert_polar_auxix:nn, \@@_convert_polar_auxix:ee}
 %    A simplified parser for complex numbers which works by expansion,
@@ -1190,6 +1206,7 @@
 %    \begin{macrocode}
 \cs_new:Npn \@@_convert_polar:n #1
   { \@@_convert_polar_auxi:w #1 e e \q_stop }
+\cs_generate_variant:Nn \@@_convert_polar:n { V }
 \cs_new:Npn \@@_convert_polar_auxi:w #1 e #2 e #3 \q_stop
   { \@@_convert_polar_auxii:nw {#2} #1 \q_stop }
 \cs_new:Npn \@@_convert_polar_auxii:nw #1#2#3 \q_stop
@@ -1197,62 +1214,79 @@
     \bool_lazy_or:nnTF
       { \str_if_eq_p:nn {#2} { i } }
       { \str_if_eq_p:nn {#2#3} { +i } }
-      { \@@_convert_polar_auxvii:nnn { } { 1 } {#1} }
+      { \@@_convert_polar_auxviii:nnn { } { 1 } {#1} }
       {
         \str_if_eq:nnTF {#2#3} { -i }
-          { \@@_convert_polar_auxvii:nnn { } { -1 } {#1} }
-          { \@@_convert_polar_auxiii:nnw {#1} {#2} #3 + + \q_stop }
+          { \@@_convert_polar_auxviii:nnn { } { -1 } {#1} }
+          {
+            \str_if_eq:nnTF {#2} { \pm }
+              {
+                \msg_expandable_error:nn { siunitx }
+                  { cannot-convert-to-polar }
+                  { 0 } { }
+              }
+              { \@@_convert_polar_auxiii:nnw {#1} {#2} #3 \pm \pm \q_stop }
+          }
       }
   }
-\cs_new:Npn \@@_convert_polar_auxiii:nnw #1#2#3 + #4 + #5 \q_stop
+\cs_new:Npn \@@_convert_polar_auxiii:nnw #1#2#3 \pm #4 \pm #5 \q_stop
   {
+    \tl_if_blank:nTF {#5}
+      { \@@_convert_polar_auxiv:nnw {#1} {#2} #3 + + \q_stop }
+      {
+        \msg_expandable_error:nn { siunitx } { cannot-convert-to-polar }
+        { 0 } { }
+      }
+  }
+\cs_new:Npn \@@_convert_polar_auxiv:nnw #1#2#3 + #4 + #5 \q_stop
+  {
     \tl_if_blank:nTF {#4}
-      { \@@_convert_polar_auxiv:nnw {#1} {#2} #3 - - \q_stop }
+      { \@@_convert_polar_auxv:nnw {#1} {#2} #3 - - \q_stop }
       {
         \str_if_eq:eeTF { \use:n #4 } { i }
-          { \@@_convert_polar_auxvii:nnn {#2#3} { 1 } {#1} }
-          { \@@_convert_polar_auxv:nnw {#2#3} {#1} #4 i \q_nil i \q_stop }
+          { \@@_convert_polar_auxviii:nnn {#2#3} { 1 } {#1} }
+          { \@@_convert_polar_auxvi:nnw {#2#3} {#1} #4 i \q_nil i \q_stop }
       }
   }
-\cs_new:Npn \@@_convert_polar_auxiv:nnw #1#2#3 - #4 - #5 \q_stop
+\cs_new:Npn \@@_convert_polar_auxv:nnw #1#2#3 - #4 - #5 \q_stop
   {
     \tl_if_blank:nTF {#4}
-      { \@@_convert_polar_auxv:nnw { } {#1} #2#3 i \q_nil i \q_stop }
+      { \@@_convert_polar_auxvi:nnw { } {#1} #2#3 i \q_nil i \q_stop }
       {
         \str_if_eq:eeTF { \use:n #4 } { i }
-          { \@@_convert_polar_auxvii:nnn { } { -1 } {#1} }
-          { \@@_convert_polar_auxv:nnw {#2#3} {#1} -#4 i \q_nil i \q_stop }
+          { \@@_convert_polar_auxviii:nnn { } { -1 } {#1} }
+          { \@@_convert_polar_auxvi:nnw {#2#3} {#1} -#4 i \q_nil i \q_stop }
       }
   }
 %    \end{macrocode}
 %   Negative real values are special-cased here for efficiency.
 %    \begin{macrocode}
-\cs_new:Npn \@@_convert_polar_auxv:nnw #1#2#3 i #4 i #5 \q_stop
+\cs_new:Npn \@@_convert_polar_auxvi:nnw #1#2#3 i #4 i #5 \q_stop
   {
     \quark_if_nil:nTF {#4}
       {
         \tl_if_head_eq_meaning:nNTF {#3} -
-          { \@@_convert_polar_auxvi:enn { \use_none:n #3 } { 180 } }
-          { \@@_convert_polar_auxvi:nnn {#3} { 0 } }
+          { \@@_convert_polar_auxvii:enn { \use_none:n #3 } { 180 } }
+          { \@@_convert_polar_auxvii:nnn {#3} { 0 } }
             {#2}
       }
-      { \@@_convert_polar_auxvii:nnn {#1} {#3} {#2} }
+      { \@@_convert_polar_auxviii:nnn {#1} {#3} {#2} }
   }
-\cs_new:Npn \@@_convert_polar_auxvi:nnn #1#2#3
+\cs_new:Npn \@@_convert_polar_auxvii:nnn #1#2#3
   {
     { #1 \tl_if_blank:nF {#3} { e#3 } } {#2}
   }
-\cs_generate_variant:Nn \@@_convert_polar_auxvi:nnn { e }
-\cs_new:Npn \@@_convert_polar_auxvii:nnn #1#2#3
+\cs_generate_variant:Nn \@@_convert_polar_auxvii:nnn { e }
+\cs_new:Npn \@@_convert_polar_auxviii:nnn #1#2#3
   {
-    \@@_convert_polar_auxviii:eee
+    \@@_convert_polar_auxix:eee
       { \tl_if_blank:nTF {#1} { 0 } {#1} }
       { \tl_if_blank:nTF {#2} { 0 } {#2} }
       { \tl_if_blank:nF {#3} { e#3 } }
   }
-\cs_new:Npn \@@_convert_polar_auxviii:nnn #1#2#3
+\cs_new:Npn \@@_convert_polar_auxix:nnn #1#2#3
   {
-    \@@_format_polar_auxix:ee
+    \@@_format_polar_auxx:ee
       { \fp_eval:n { sqrt ( (#1#3)^2 + (#2#3)^2 ) } }
       {
         \fp_eval:n
@@ -1259,9 +1293,9 @@
           { atan \bool_if:NT \l_@@_polar_degree_bool { d } (#2 , #1) }
       }
   }
-\cs_generate_variant:Nn \@@_convert_polar_auxviii:nnn { eee }
-\cs_new:Npn \@@_format_polar_auxix:nn #1#2 { {#1} {#2} }
-\cs_generate_variant:Nn \@@_format_polar_auxix:nn { ee }
+\cs_generate_variant:Nn \@@_convert_polar_auxix:nnn { eee }
+\cs_new:Npn \@@_format_polar_auxx:nn #1#2 { {#1} {#2} }
+\cs_generate_variant:Nn \@@_format_polar_auxx:nn { ee }
 %    \end{macrocode}
 % \end{macro}
 % \end{macro}
@@ -1273,10 +1307,18 @@
 % \end{macro}
 % \end{macro}
 % \end{macro}
+% \end{macro}
 %
 % \subsection{Messages}
 %
 %    \begin{macrocode}
+\msg_new:nnn { siunitx } { cannot-convert-to-polar }
+  { Cannot~convert~input~to~polar~form. }
+\msg_new:nnnn { siunitx } { duplicate-complex-root }
+  { Duplicate~complex~root~in~"#1". }
+  {
+    Complex~numbers~may~have~only~exactly~one~root~symbol~present.
+  }
 \msg_new:nnnn { siunitx } { invalid-polar-form }
   { Invalid~polar~form~"#1:#2". }
   {

Modified: trunk/Master/texmf-dist/source/latex/siunitx/siunitx-table.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/siunitx/siunitx-table.dtx	2025-03-17 19:46:11 UTC (rev 74672)
+++ trunk/Master/texmf-dist/source/latex/siunitx/siunitx-table.dtx	2025-03-17 19:53:41 UTC (rev 74673)
@@ -64,7 +64,7 @@
 %
 % This submodule is concerned with formatting numbers in table cells or
 % similar fixed-width contexts. The main function, \cs{siunitx_cell_begin:w},
-% is designed to work with the normal \LaTeXe{} tablular cell construct
+% is designed to work with the normal \LaTeXe{} tabular cell construct
 % featuring \cs{ignorespaces}. Therefore, if used outside of a \LaTeXe{}
 % tabular, it is necessary to provide this token.
 %
@@ -421,7 +421,7 @@
 %   \TeX{} inserts these tokens when it sees the \tn{cr} primitive, so
 %   there is no expansion to consider. Whilst in most cases the group formed
 %   by each cell will tidy up, nested tabulars (for example in a header row)
-%   will break if \tn{cr} is redefined too widely. Thus we use a targetted
+%   will break if \tn{cr} is redefined too widely. Thus we use a targeted
 %   approach: only apply when needed, and use the additional group inside the
 %   cell to keep control.
 %    \begin{macrocode}
@@ -690,9 +690,13 @@
             \cs_new_eq:NN
               \@@_align_auxiii:nn
               \@@_align_auxi:nn
-            \cs_gset_protected:Npn \@@_align_auxi:nn #1#2
+            \cs_gset_protected:Npx \@@_align_auxi:nn #1#2
               {
-                \int_compare:nNnTF \g_tblr_level_int = 0
+                \exp_not:N \int_compare:nNnTF
+                  \cs_if_exist:NTF \gTblrLevelInt
+                   { \exp_not:N \gTblrLevelInt }
+                   { \exp_not:N \g_tblr_level_int }
+                    = 0
                   { \@@_align_auxii:nn }
                   { \@@_align_auxiii:nn }
                     {#1} {#2}

Modified: trunk/Master/texmf-dist/source/latex/siunitx/siunitx-unit.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/siunitx/siunitx-unit.dtx	2025-03-17 19:46:11 UTC (rev 74672)
+++ trunk/Master/texmf-dist/source/latex/siunitx/siunitx-unit.dtx	2025-03-17 19:53:41 UTC (rev 74673)
@@ -2007,7 +2007,7 @@
 %
 % \begin{macro}
 %   {
-%     \@@_format_init_fracton:              ,
+%     \@@_format_init_fraction:             ,
 %     \@@_format_init_power:                ,
 %     \@@_format_init_power-positive-first: ,
 %     \@@_format_init_repeated-symbol:      ,

Modified: trunk/Master/texmf-dist/source/latex/siunitx/siunitx.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/siunitx/siunitx.dtx	2025-03-17 19:46:11 UTC (rev 74672)
+++ trunk/Master/texmf-dist/source/latex/siunitx/siunitx.dtx	2025-03-17 19:53:41 UTC (rev 74673)
@@ -140,7 +140,7 @@
 %
 % Identify the package and give the over all version information.
 %    \begin{macrocode}
-\ProvidesExplPackage {siunitx} {2025-02-27} {3.4.6}
+\ProvidesExplPackage {siunitx} {2025-03-17} {3.4.7}
   {A comprehensive (SI) units package}
 %    \end{macrocode}
 %

Modified: trunk/Master/texmf-dist/source/latex/siunitx/siunitx.tex
===================================================================
--- trunk/Master/texmf-dist/source/latex/siunitx/siunitx.tex	2025-03-17 19:46:11 UTC (rev 74672)
+++ trunk/Master/texmf-dist/source/latex/siunitx/siunitx.tex	2025-03-17 19:53:41 UTC (rev 74673)
@@ -1677,9 +1677,9 @@
 the uncertainty strictly upward.
 \begin{LaTeXdemo}
   \sisetup{round-mode = uncertainty}
-  \num{0.123(41)} \\
+  \num{0.123(141)} \\
   \sisetup{uncertainty-round-direction = up}%
-  \num{0.123(41)}
+  \num{0.123(141)}
 \end{LaTeXdemo}
 
 \DescribeOption{round-minimum}

Modified: trunk/Master/texmf-dist/tex/latex/siunitx/siunitx.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/siunitx/siunitx.sty	2025-03-17 19:46:11 UTC (rev 74672)
+++ trunk/Master/texmf-dist/tex/latex/siunitx/siunitx.sty	2025-03-17 19:53:41 UTC (rev 74673)
@@ -47,7 +47,7 @@
       }%
     \endinput
   }%
-\ProvidesExplPackage {siunitx} {2025-02-27} {3.4.6}
+\ProvidesExplPackage {siunitx} {2025-03-17} {3.4.7}
   {A comprehensive (SI) units package}
 \msg_new:nnnn { siunitx } { incompatible-package }
   { Package~'#1'~incompatible. }
@@ -3423,25 +3423,20 @@
     print-complex-unity .bool_set:N =
       \l__siunitx_complex_print_unity_bool
   }
-\cs_new_protected:Npn \__siunitx_complex_parse:nNN #1#2#3
+\cs_new_protected:Npn \__siunitx_complex_expand:n #1
   {
-    \group_begin:
-      \__siunitx_complex_parse_clear:
-      \protected at edef \l__siunitx_complex_arg_tl {#1}
-      \tl_set_eq:NN \l__siunitx_complex_input_tl \l__siunitx_complex_arg_tl
-      \siunitx_number_normalize_symbols:N \l__siunitx_complex_arg_tl
-      \tl_if_empty:NF \l__siunitx_complex_arg_tl
-        { \__siunitx_complex_parse_comparator: }
-      \__siunitx_complex_parse_check:
-      \cs_set_protected:Npx \__siunitx_complex_parse_end:
-        {
-          \tl_set:Nn \exp_not:N #2 { \exp_not:V \l__siunitx_complex_real_tl }
-          \tl_set:Nn \exp_not:N #3 { \exp_not:V \l__siunitx_complex_img_tl }
-        }
-    \exp_after:wN \group_end:
-    \__siunitx_complex_parse_end:
+    \protected at edef \l__siunitx_complex_arg_tl {#1}
+    \tl_set_eq:NN \l__siunitx_complex_input_tl \l__siunitx_complex_arg_tl
+    \siunitx_number_normalize_symbols:N \l__siunitx_complex_arg_tl
   }
-\cs_new_protected:Npn \__siunitx_complex_parse_end: { }
+\cs_new_protected:Npn \__siunitx_complex_parse:n #1
+  {
+    \__siunitx_complex_parse_clear:
+    \tl_if_empty:NF \l__siunitx_complex_arg_tl
+      { \__siunitx_complex_parse_comparator: }
+    \__siunitx_complex_parse_check:
+  }
+\cs_generate_variant:Nn \__siunitx_complex_parse:n { V }
 \cs_new_protected:Npn \__siunitx_complex_parse_clear:
   {
     \tl_clear:N \l__siunitx_complex_real_tl
@@ -3548,13 +3543,16 @@
           }
         \use:x
           {
-            \cs_set_protected:Npn
+            \cs_set_protected:Npx
               \exp_not:N \__siunitx_complex_parse_root_auxi:w
               ####1 \exp_not:V \l__siunitx_complex_tmp_tl
               ####2 \exp_not:V \l__siunitx_complex_tmp_tl
               ####3 \exp_not:N \q_stop
           }
-            { \__siunitx_complex_parse_root_auxii:nn {##1} {##2} }
+            {
+              \__siunitx_complex_parse_root_auxii:nnnN {##1} {##2} {##3}
+                \exp_not:V \l__siunitx_complex_tmp_tl
+            }
         \use:x
           {
             \__siunitx_complex_parse_root_auxi:w
@@ -3565,21 +3563,28 @@
       }
   }
 \cs_new_protected:Npn \__siunitx_complex_parse_root_auxi:w  { }
-\cs_new_protected:Npn \__siunitx_complex_parse_root_auxii:nn #1#2
+\cs_new_protected:Npn \__siunitx_complex_parse_root_auxii:nnnN #1#2#3#4
   {
     \quark_if_nil:nTF {#2}
       { \tl_set:Nn \l__siunitx_complex_real_tl {#1} }
       {
-        \tl_set:Nn \l__siunitx_complex_img_tl {#2}
-        \tl_if_blank:nTF {#1}
+        \str_if_eq:nnTF {#3} { \q_nil #4 }
           {
-            \tl_if_blank:nT {#2}
-              { \tl_set:Nn \l__siunitx_complex_img_tl { 1 } }
+            \tl_set:Nn \l__siunitx_complex_img_tl {#2}
+            \tl_if_blank:nTF {#1}
+              {
+                \tl_if_blank:nT {#2}
+                  { \tl_set:Nn \l__siunitx_complex_img_tl { 1 } }
+              }
+              {
+                \tl_if_blank:nTF {#2}
+                  { \__siunitx_complex_parse_split:n {#1} }
+                  { \__siunitx_complex_parse_sign_check:n {#1} }
+              }
           }
           {
-            \tl_if_blank:nTF {#2}
-              { \__siunitx_complex_parse_split:n {#1} }
-              { \__siunitx_complex_parse_sign_check:n {#1} }
+            \msg_error:nnV { siunitx } { duplicate-complex-root }
+              \l__siunitx_complex_input_tl
           }
       }
   }
@@ -3675,26 +3680,27 @@
 \tl_new:N \l__siunitx_complex_unit_tl
 \cs_new_protected:Npn \siunitx_complex_number:n #1
   {
-    \bool_lazy_and:nnTF
-      { \l__siunitx_complex_force_polar_bool }
-      { \l_siunitx_number_parse_bool }
+    \bool_if:NTF \l_siunitx_number_parse_bool
       {
-        \use:e
-          {
-            \siunitx_complex_number:nn
-               \__siunitx_complex_convert_polar:n {#1}
-          }
+        \group_begin:
+          \__siunitx_complex_expand:n {#1}
+          \bool_if:NTF \l__siunitx_complex_force_polar_bool
+            {
+              \use:e
+                {
+                  \siunitx_complex_number:nn
+                     \__siunitx_complex_convert_polar:V \l__siunitx_complex_arg_tl
+                 }
+            }
+            {
+              \__siunitx_complex_parse:V \l__siunitx_complex_arg_tl
+              \__siunitx_complex_format_cartesian:n { }
+            }
+        \group_end:
       }
       {
-        \bool_if:NTF \l_siunitx_number_parse_bool
-          {
-            \__siunitx_complex_parse:nNN {#1} \l__siunitx_complex_real_tl \l__siunitx_complex_img_tl
-            \__siunitx_complex_format_cartesian:n { }
-          }
-          {
-            \siunitx_number_format:nN {#1} \l__siunitx_complex_tmp_tl
-            \siunitx_print_number:V \l__siunitx_complex_tmp_tl
-          }
+        \siunitx_number_format:nN {#1} \l__siunitx_complex_tmp_tl
+        \siunitx_print_number:V \l__siunitx_complex_tmp_tl
       }
   }
 \cs_generate_variant:Nn \siunitx_complex_number:n { e, x }
@@ -3725,25 +3731,26 @@
   }
 \cs_new_protected:Npn \siunitx_complex_quantity:nn #1#2
   {
-    \bool_lazy_and:nnTF
-      { \l__siunitx_complex_force_polar_bool }
-      { \l_siunitx_number_parse_bool }
+    \bool_if:NTF \l_siunitx_number_parse_bool
       {
-        \use:e
-          {
-            \siunitx_complex_quantity:nnn
-               \__siunitx_complex_convert_polar:n {#1}
-          }
-            {#2}
+        \group_begin:
+          \__siunitx_complex_expand:n {#1}
+          \bool_if:NTF \l__siunitx_complex_force_polar_bool
+            {
+              \use:e
+                {
+                  \siunitx_complex_quantity:nnn
+                     \__siunitx_complex_convert_polar:V \l__siunitx_complex_arg_tl
+                 }
+            }
+            {
+              \__siunitx_complex_parse:V \l__siunitx_complex_arg_tl
+              \__siunitx_complex_format_cartesian:n
+            }
+              {#2}
+        \group_end:
       }
-      {
-        \bool_if:NTF \l_siunitx_number_parse_bool
-          {
-            \__siunitx_complex_parse:nNN {#1} \l__siunitx_complex_real_tl \l__siunitx_complex_img_tl
-            \__siunitx_complex_format_cartesian:n {#2}
-          }
-          { \siunitx_quantity:nn {#1} {#2} }
-      }
+      { \siunitx_quantity:nn {#1} {#2} }
   }
 \cs_generate_variant:Nn \siunitx_complex_quantity:nn { e , x }
 \cs_new_protected:Npn \siunitx_complex_quantity:nnn #1#2#3
@@ -4039,6 +4046,7 @@
 \cs_generate_variant:Nn \__siunitx_complex_convert_cartesian_aux:nnn { e , ne }
 \cs_new:Npn \__siunitx_complex_convert_polar:n #1
   { \__siunitx_complex_convert_polar_auxi:w #1 e e \q_stop }
+\cs_generate_variant:Nn \__siunitx_complex_convert_polar:n { V }
 \cs_new:Npn \__siunitx_complex_convert_polar_auxi:w #1 e #2 e #3 \q_stop
   { \__siunitx_complex_convert_polar_auxii:nw {#2} #1 \q_stop }
 \cs_new:Npn \__siunitx_complex_convert_polar_auxii:nw #1#2#3 \q_stop
@@ -4046,59 +4054,76 @@
     \bool_lazy_or:nnTF
       { \str_if_eq_p:nn {#2} { i } }
       { \str_if_eq_p:nn {#2#3} { +i } }
-      { \__siunitx_complex_convert_polar_auxvii:nnn { } { 1 } {#1} }
+      { \__siunitx_complex_convert_polar_auxviii:nnn { } { 1 } {#1} }
       {
         \str_if_eq:nnTF {#2#3} { -i }
-          { \__siunitx_complex_convert_polar_auxvii:nnn { } { -1 } {#1} }
-          { \__siunitx_complex_convert_polar_auxiii:nnw {#1} {#2} #3 + + \q_stop }
+          { \__siunitx_complex_convert_polar_auxviii:nnn { } { -1 } {#1} }
+          {
+            \str_if_eq:nnTF {#2} { \pm }
+              {
+                \msg_expandable_error:nn { siunitx }
+                  { cannot-convert-to-polar }
+                  { 0 } { }
+              }
+              { \__siunitx_complex_convert_polar_auxiii:nnw {#1} {#2} #3 \pm \pm \q_stop }
+          }
       }
   }
-\cs_new:Npn \__siunitx_complex_convert_polar_auxiii:nnw #1#2#3 + #4 + #5 \q_stop
+\cs_new:Npn \__siunitx_complex_convert_polar_auxiii:nnw #1#2#3 \pm #4 \pm #5 \q_stop
   {
+    \tl_if_blank:nTF {#5}
+      { \__siunitx_complex_convert_polar_auxiv:nnw {#1} {#2} #3 + + \q_stop }
+      {
+        \msg_expandable_error:nn { siunitx } { cannot-convert-to-polar }
+        { 0 } { }
+      }
+  }
+\cs_new:Npn \__siunitx_complex_convert_polar_auxiv:nnw #1#2#3 + #4 + #5 \q_stop
+  {
     \tl_if_blank:nTF {#4}
-      { \__siunitx_complex_convert_polar_auxiv:nnw {#1} {#2} #3 - - \q_stop }
+      { \__siunitx_complex_convert_polar_auxv:nnw {#1} {#2} #3 - - \q_stop }
       {
         \str_if_eq:eeTF { \use:n #4 } { i }
-          { \__siunitx_complex_convert_polar_auxvii:nnn {#2#3} { 1 } {#1} }
-          { \__siunitx_complex_convert_polar_auxv:nnw {#2#3} {#1} #4 i \q_nil i \q_stop }
+          { \__siunitx_complex_convert_polar_auxviii:nnn {#2#3} { 1 } {#1} }
+          { \__siunitx_complex_convert_polar_auxvi:nnw {#2#3} {#1} #4 i \q_nil i \q_stop }
       }
   }
-\cs_new:Npn \__siunitx_complex_convert_polar_auxiv:nnw #1#2#3 - #4 - #5 \q_stop
+\cs_new:Npn \__siunitx_complex_convert_polar_auxv:nnw #1#2#3 - #4 - #5 \q_stop
   {
     \tl_if_blank:nTF {#4}
-      { \__siunitx_complex_convert_polar_auxv:nnw { } {#1} #2#3 i \q_nil i \q_stop }
+      { \__siunitx_complex_convert_polar_auxvi:nnw { } {#1} #2#3 i \q_nil i \q_stop }
       {
         \str_if_eq:eeTF { \use:n #4 } { i }
-          { \__siunitx_complex_convert_polar_auxvii:nnn { } { -1 } {#1} }
-          { \__siunitx_complex_convert_polar_auxv:nnw {#2#3} {#1} -#4 i \q_nil i \q_stop }
+          { \__siunitx_complex_convert_polar_auxviii:nnn { } { -1 } {#1} }
+          { \__siunitx_complex_convert_polar_auxvi:nnw {#2#3} {#1} -#4 i \q_nil i \q_stop }
       }
   }
-\cs_new:Npn \__siunitx_complex_convert_polar_auxv:nnw #1#2#3 i #4 i #5 \q_stop
+\cs_new:Npn \__siunitx_complex_convert_polar_auxvi:nnw #1#2#3 i #4 i #5 \q_stop
   {
     \quark_if_nil:nTF {#4}
       {
         \tl_if_head_eq_meaning:nNTF {#3} -
-          { \__siunitx_complex_convert_polar_auxvi:enn { \use_none:n #3 } { 180 } }
-          { \__siunitx_complex_convert_polar_auxvi:nnn {#3} { 0 } }
+          { \__siunitx_complex_convert_polar_auxvii:enn { \use_none:n #3 } { 180 } }
+          { \__siunitx_complex_convert_polar_auxvii:nnn {#3} { 0 } }
             {#2}
       }
-      { \__siunitx_complex_convert_polar_auxvii:nnn {#1} {#3} {#2} }
+      { \__siunitx_complex_convert_polar_auxviii:nnn {#1} {#3} {#2} }
   }
-\cs_new:Npn \__siunitx_complex_convert_polar_auxvi:nnn #1#2#3
+\cs_new:Npn \__siunitx_complex_convert_polar_auxvii:nnn #1#2#3
   {
     { #1 \tl_if_blank:nF {#3} { e#3 } } {#2}
   }
-\cs_generate_variant:Nn \__siunitx_complex_convert_polar_auxvi:nnn { e }
-\cs_new:Npn \__siunitx_complex_convert_polar_auxvii:nnn #1#2#3
+\cs_generate_variant:Nn \__siunitx_complex_convert_polar_auxvii:nnn { e }
+\cs_new:Npn \__siunitx_complex_convert_polar_auxviii:nnn #1#2#3
   {
-    \__siunitx_complex_convert_polar_auxviii:eee
+    \__siunitx_complex_convert_polar_auxix:eee
       { \tl_if_blank:nTF {#1} { 0 } {#1} }
       { \tl_if_blank:nTF {#2} { 0 } {#2} }
       { \tl_if_blank:nF {#3} { e#3 } }
   }
-\cs_new:Npn \__siunitx_complex_convert_polar_auxviii:nnn #1#2#3
+\cs_new:Npn \__siunitx_complex_convert_polar_auxix:nnn #1#2#3
   {
-    \__siunitx_complex_format_polar_auxix:ee
+    \__siunitx_complex_format_polar_auxx:ee
       { \fp_eval:n { sqrt ( (#1#3)^2 + (#2#3)^2 ) } }
       {
         \fp_eval:n
@@ -4105,9 +4130,16 @@
           { atan \bool_if:NT \l__siunitx_complex_polar_degree_bool { d } (#2 , #1) }
       }
   }
-\cs_generate_variant:Nn \__siunitx_complex_convert_polar_auxviii:nnn { eee }
-\cs_new:Npn \__siunitx_complex_format_polar_auxix:nn #1#2 { {#1} {#2} }
-\cs_generate_variant:Nn \__siunitx_complex_format_polar_auxix:nn { ee }
+\cs_generate_variant:Nn \__siunitx_complex_convert_polar_auxix:nnn { eee }
+\cs_new:Npn \__siunitx_complex_format_polar_auxx:nn #1#2 { {#1} {#2} }
+\cs_generate_variant:Nn \__siunitx_complex_format_polar_auxx:nn { ee }
+\msg_new:nnn { siunitx } { cannot-convert-to-polar }
+  { Cannot~convert~input~to~polar~form. }
+\msg_new:nnnn { siunitx } { duplicate-complex-root }
+  { Duplicate~complex~root~in~"#1". }
+  {
+    Complex~numbers~may~have~only~exactly~one~root~symbol~present.
+  }
 \msg_new:nnnn { siunitx } { invalid-polar-form }
   { Invalid~polar~form~"#1:#2". }
   {
@@ -5757,9 +5789,13 @@
             \cs_new_eq:NN
               \__siunitx_table_align_auxiii:nn
               \__siunitx_table_align_auxi:nn
-            \cs_gset_protected:Npn \__siunitx_table_align_auxi:nn #1#2
+            \cs_gset_protected:Npx \__siunitx_table_align_auxi:nn #1#2
               {
-                \int_compare:nNnTF \g_tblr_level_int = 0
+                \exp_not:N \int_compare:nNnTF
+                  \cs_if_exist:NTF \gTblrLevelInt
+                   { \exp_not:N \gTblrLevelInt }
+                   { \exp_not:N \g_tblr_level_int }
+                    = 0
                   { \__siunitx_table_align_auxii:nn }
                   { \__siunitx_table_align_auxiii:nn }
                     {#1} {#2}



More information about the tex-live-commits mailing list.