texlive[72080] Master/texmf-dist: siunitx (21aug24)

commits+karl at tug.org commits+karl at tug.org
Wed Aug 21 23:54:10 CEST 2024


Revision: 72080
          https://tug.org/svn/texlive?view=revision&revision=72080
Author:   karl
Date:     2024-08-21 23:54:10 +0200 (Wed, 21 Aug 2024)
Log Message:
-----------
siunitx (21aug24)

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-angle.dtx
    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.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	2024-08-21 21:53:17 UTC (rev 72079)
+++ trunk/Master/texmf-dist/doc/latex/siunitx/CHANGELOG.md	2024-08-21 21:54:10 UTC (rev 72080)
@@ -7,6 +7,16 @@
 
 ## [Unreleased]
 
+## [v3.3.21] - 2024-08-20
+
+### Fixed
+- Conversion of negative angles to arc notation (see issue
+  [\#743](https://github.com/josephwright/siunitx/issues/743))
+- Rounding of angles in arc mode (see issue
+  [\#744](https://github.com/josephwright/siunitx/issues/744))
+- Polar form of negative real values (see issue
+  [\#745](https://github.com/josephwright/siunitx/issues/745))
+
 ## [v3.3.20] - 2024-08-01
 
 ### Fixed
@@ -2126,7 +2136,8 @@
 ### Added
 - First public testing release (as `si`)
 
-[Unreleased]: https://github.com/josephwright/siunitx/compare/v3.3.20...HEAD
+[Unreleased]: https://github.com/josephwright/siunitx/compare/v3.3.21...HEAD
+[v3.3.21]: https://github.com/josephwright/siunitx/compare/v3.3.20...v3.3.21
 [v3.3.20]: https://github.com/josephwright/siunitx/compare/v3.3.19...v3.3.20
 [v3.3.19]: https://github.com/josephwright/siunitx/compare/v3.3.18...v3.3.19
 [v3.3.18]: https://github.com/josephwright/siunitx/compare/v3.3.17...v3.3.18

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-angle.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/siunitx/siunitx-angle.dtx	2024-08-21 21:53:17 UTC (rev 72079)
+++ trunk/Master/texmf-dist/source/latex/siunitx/siunitx-angle.dtx	2024-08-21 21:54:10 UTC (rev 72080)
@@ -303,18 +303,23 @@
       }
   }
 \cs_generate_variant:Nn \siunitx_angle:nnn { eee , xxx }
+%    \end{macrocode}
+%   Here, the need for absolute values is to handle conversion of negative
+%   values: the result should be exactly one sign in the integer part.
+%    \begin{macrocode}
 \cs_new_protected:Npn \@@_arc_convert:n #1
   {
     \siunitx_angle:eee
       { \fp_eval:n { trunc(#1,0) } }
-      { \fp_eval:n { trunc((#1 - trunc(#1,0)) * 60,0) } }
+      { \fp_eval:n { abs(trunc((#1 - trunc(#1,0)) * 60,0)) } }
       {
         \fp_eval:n
           {
-            (
-                      (#1 - trunc(#1,0)) * 60
-              - trunc((#1 - trunc(#1,0)) * 60,0)
-            )
+            abs
+              (
+                        (#1 - trunc(#1,0)) * 60
+                - trunc((#1 - trunc(#1,0)) * 60,0)
+              )
             * 60
           }
       }
@@ -325,6 +330,13 @@
 % \end{macro}
 % \end{macro}
 %
+% \begin{variable}{\c_@@_parts_tl}
+%   For mappings.
+%    \begin{macrocode}
+\clist_const:Nn \c_@@_parts_tl { degrees , minutes , seconds }
+%    \end{macrocode}
+% \end{variable}
+%
 % \begin{variable}{\l_@@_degrees_tl, \l_@@_minutes_tl, \l_@@_seconds_tl}
 %   Space for formatting parsed numbers.
 %    \begin{macrocode}
@@ -341,7 +353,14 @@
 %    \end{macrocode}
 % \end{variable}
 %
-% \begin{macro}{\@@_suppress_exp_uncert:, \@@_suppress_comp_sign:}
+% \begin{variable}{\l_@@_signed_bool}
+%   To check that only one sign is seen in arc mode.
+%    \begin{macrocode}
+\tl_new:N \l_@@_signed_bool
+%    \end{macrocode}
+% \end{variable}
+%
+% \begin{macro}{\@@_suppress_exp_uncert:, \@@_suppress_comp:}
 %   Pre-compilation of keys to suppress uncertainties and exponents,
 %   and 
 %    \begin{macrocode}
@@ -358,9 +377,9 @@
   { \exp_not:V \l_@@_tmp_tl }
 \keys_precompile:nnN
   { siunitx }
-  { input-comparators = , input-signs = }
+  { input-comparators = }
   \l_@@_tmp_tl
-\cs_set_protected:Npx \@@_suppress_comp_sign:
+\cs_set_protected:Npx \@@_suppress_comp:
   { \exp_not:V \l_@@_tmp_tl }
 %    \end{macrocode}
 % \end{macro}
@@ -367,11 +386,13 @@
 %
 % \begin{macro}{\@@_arc_sign:nnn}
 % \begin{macro}{\@@_arc_sign:nn}
+% \begin{macro}{\@@_arc_sign_auxi:, \@@_arc_sign_auxii:}
 % \begin{macro}{\@@_extract_sign:nnnnnnnn}
 % \begin{macro}[EXP]{\@@_sign:nnnnnnn}
 %   To get the sign in the right place whilst dealing with zero filling
 %   means doing some shuffling. That means doing processing of each number
-%   manually.
+%   manually. For degrees, auto-conversion can give |-0|, which needs to be
+%   picked up early to set the sign.
 %    \begin{macrocode}
 \cs_new_protected:Npn \@@_arc_sign:nnn #1#2#3
   {
@@ -378,40 +399,23 @@
     \group_begin:
       \@@_suppress_exp_uncert:
       \tl_clear:N \l_@@_sign_tl
-      \@@_arc_sign:nn {#1} { degrees }
+      \bool_set_false:N \l_@@_signed_bool
+      \str_if_eq:nnTF {#1} { -0 }
+        {
+          \@@_arc_sign:nn { } { degrees }
+          \@@_suppress_comp:
+          \tl_set:Nn \l_@@_sign_tl { - }
+          \bool_set_true:N \l_@@_signed_bool
+        }
+        { \@@_arc_sign:nn {#1} { degrees } }      
       \@@_arc_sign:nn {#2} { minutes }
       \@@_arc_sign:nn {#3} { seconds }
       \tl_if_empty:NF \l_@@_sign_tl
         {
-          \clist_map_inline:nn { degrees , minutes , seconds }
-            {
-              \tl_if_empty:cF { l_@@_ ##1 _tl }
-                {
-                  \tl_set:cx { l_@@_ ##1 _tl }
-                    {
-                       { }
-                       { \exp_not:V \l_@@_sign_tl }
-                       \exp_after:wN \exp_after:wN \exp_after:wN
-                         \@@_sign:nnnnnnn
-                           \cs:w l_@@_ ##1 _tl \cs_end:
-                    }
-                  \clist_map_break:
-                }
-            }
+          \clist_map_function:NN \c_@@_parts_tl
+            \@@_arc_sign_auxi:n
         }
-      \clist_map_inline:nn { degrees , minutes , seconds }
-        {
-          \tl_if_empty:cF { l_@@_ ##1 _tl }
-            {
-              \siunitx_number_process:cc
-                { l_@@_ ##1 _tl } { l_@@_ ##1 _tl }
-              \tl_set:cx { l_@@_ ##1 _tl }
-                {
-                  \siunitx_number_output:cN
-                    { l_@@_ ##1 _tl } \q_nil
-                }
-            }
-        }
+      \clist_map_function:NN \c_@@_parts_tl \@@_arc_sign_auxii:n
       \@@_arc_print:VVV
         \l_@@_degrees_tl
         \l_@@_minutes_tl
@@ -432,17 +436,53 @@
       {
         \siunitx_number_parse:nN {#1} \l_@@_tmp_tl
         \exp_after:wN \@@_extract_sign:nnnnnnnn \l_@@_tmp_tl {#2}
+        \bool_set_true:N \l_@@_signed_bool
       }
   }
+\cs_new_protected:Npn \@@_arc_sign_auxi:n #1
+  {
+    \tl_if_empty:cF { l_@@_ #1 _tl }
+      {
+        \tl_set:cx { l_@@_ #1 _tl }
+          {
+            { }
+            { \exp_not:V \l_@@_sign_tl }
+            \exp_after:wN \exp_after:wN \exp_after:wN
+              \@@_sign:nnnnnnn
+                \cs:w l_@@_ #1 _tl \cs_end:
+           }
+        \clist_map_break:
+      }
+  }
+\cs_new_protected:Npn \@@_arc_sign_auxii:n #1
+  {
+    \tl_if_empty:cF { l_@@_ #1 _tl }
+      {
+        \bool_lazy_and:nnF
+          { \l_@@_force_arc_bool }
+          { ! \str_if_eq_p:nn {#1} { seconds } }
+          {
+            \siunitx_number_process:cc
+              { l_@@_ #1 _tl } { l_@@_ #1 _tl }
+          }
+        \tl_set:cx { l_@@_ #1 _tl }
+          {
+            \siunitx_number_output:cN
+              { l_@@_ #1 _tl } \q_nil
+          }
+      }
+  }
 \cs_new_protected:Npn \@@_extract_sign:nnnnnnnn #1#2#3#4#5#6#7#8
   {
     \tl_if_blank:nTF {#2}
       { \tl_set_eq:cN { l_@@_ #8 _tl } \l_@@_tmp_tl }
       {
+        \bool_if:NTF \l_@@_signed_bool
+          { \msg_error:nnn { siunitx } { arc-multi-sign } }
+          { \tl_set:Nn \l_@@_sign_tl {#2} }
         \tl_set:cn { l_@@_ #8 _tl }
           { {#1} { } {#3} {#4} {#5} {#6} {#7} }
-        \tl_set:Nn \l_@@_sign_tl {#2}
-        \@@_suppress_comp_sign:
+        \@@_suppress_comp:
       }
   }
 \cs_new:Npn \@@_sign:nnnnnnn #1#2#3#4#5#6#7
@@ -452,6 +492,7 @@
 % \end{macro}
 % \end{macro}
 % \end{macro}
+% \end{macro}
 %
 %  \begin{variable}{\l_@@_marker_box, \l_@@_unit_box}
 %    For \enquote{astronomy style} angles.
@@ -602,6 +643,15 @@
 % \end{macro}
 %
 %    \begin{macrocode}
+\msg_new:nnnn { siunitx } { arc-multi-sign }
+  { Multiple~signs~given~for~arc~angle! }
+  {
+    An~angle~given~as~an~arc~should~have~at~most~one~sign:~
+    only~the~first~sign~will~be~used.
+  }
+%    \end{macrocode}
+%
+%    \begin{macrocode}
 \keys_set:nn { siunitx }
   {
     angle-mode                = input      ,

Modified: trunk/Master/texmf-dist/source/latex/siunitx/siunitx-complex.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/siunitx/siunitx-complex.dtx	2024-08-21 21:53:17 UTC (rev 72079)
+++ trunk/Master/texmf-dist/source/latex/siunitx/siunitx-complex.dtx	2024-08-21 21:54:10 UTC (rev 72080)
@@ -1143,11 +1143,12 @@
 % \begin{macro}[EXP]{\@@_convert_polar_auxiii:nnw}
 % \begin{macro}[EXP]{\@@_convert_polar_auxiv:nnw}
 % \begin{macro}[EXP]{\@@_convert_polar_auxv:nnw}
-% \begin{macro}[EXP]{\@@_convert_polar_auxvi:nnn}
+% \begin{macro}[EXP]{\@@_convert_polar_auxvi:nnn, \@@_convert_polar_auxvi:enn}
+% \begin{macro}[EXP]{\@@_convert_polar_auxvii:nnn}
 % \begin{macro}[EXP]
-%   {\@@_convert_polar_auxvii:nnn, \@@_convert_polar_auxvii:eee}
+%   {\@@_convert_polar_auxviii:nnn, \@@_convert_polar_auxviii:eee}
 % \begin{macro}[EXP]
-%   {\@@_convert_polar_auxviii:nn, \@@_convert_polar_auxviii:ee}
+%   {\@@_convert_polar_auxix:nn, \@@_convert_polar_auxix:ee}
 %    A simplified parser for complex numbers which works by expansion,
 %    then converts to polar form.
 %    \begin{macrocode}
@@ -1160,10 +1161,10 @@
     \bool_lazy_or:nnTF
       { \str_if_eq_p:nn {#2} { i } }
       { \str_if_eq_p:nn {#2#3} { +i } }
-      { \@@_convert_polar_auxvi:nnn { } { 1 } {#1} }
+      { \@@_convert_polar_auxvii:nnn { } { 1 } {#1} }
       {
         \str_if_eq:nnTF {#2#3} { -i }
-          { \@@_convert_polar_auxvi:nnn { } { -1 } {#1} }
+          { \@@_convert_polar_auxvii:nnn { } { -1 } {#1} }
           { \@@_convert_polar_auxiii:nnw {#1} {#2} #3 + + \q_stop }
       }
   }
@@ -1173,7 +1174,7 @@
       { \@@_convert_polar_auxiv:nnw {#1} {#2} #3 - - \q_stop }
       {
         \str_if_eq:nnTF {#4} { i }
-          { \@@_convert_polar_auxvi:nnn {#2#3} { 1 } {#1} }
+          { \@@_convert_polar_auxvii:nnn {#2#3} { 1 } {#1} }
           { \@@_convert_polar_auxv:nnw {#2#3} {#1} #4 i \q_nil i \q_stop }
       }
   }
@@ -1183,26 +1184,39 @@
       { \@@_convert_polar_auxv:nnw { } {#1} #2#3 i \q_nil i \q_stop }
       {
         \str_if_eq:nnTF {#4} { i }
-          { \@@_convert_polar_auxvi:nnn { } { -1 } {#1} }
+          { \@@_convert_polar_auxvii:nnn { } { -1 } {#1} }
           { \@@_convert_polar_auxv: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
   {
     \quark_if_nil:nTF {#4}
-      { { #3 \tl_if_blank:nF {#2} { e#2 } } { 0 } }
-      { \@@_convert_polar_auxvi:nnn {#1} {#3} {#2} }
+      {
+        \tl_if_head_eq_meaning:nNTF {#3} -
+          { \@@_convert_polar_auxvi:enn { \use_none:n #3 } { 180 } }
+          { \@@_convert_polar_auxvi:nnn {#3} { 0 } }
+            {#2}
+      }
+      { \@@_convert_polar_auxvii:nnn {#1} {#3} {#2} }
   }
 \cs_new:Npn \@@_convert_polar_auxvi:nnn #1#2#3
   {
-    \@@_convert_polar_auxvii:eee
+    { #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
+  {
+    \@@_convert_polar_auxviii: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_auxvii:nnn #1#2#3
+\cs_new:Npn \@@_convert_polar_auxviii:nnn #1#2#3
   {
-    \@@_format_polar_auxviii:ee
+    \@@_format_polar_auxix:ee
       { \fp_eval:n { sqrt ( (#1#3)^2 + (#2#3)^2 ) } }
       {
         \fp_eval:n
@@ -1209,9 +1223,9 @@
           { atan \bool_if:NT \l_@@_polar_degree_bool { d } (#2 , #1) }
       }
   }
-\cs_generate_variant:Nn \@@_convert_polar_auxvii:nnn { eee }
-\cs_new:Npn \@@_format_polar_auxviii:nn #1#2 { {#1} {#2} }
-\cs_generate_variant:Nn \@@_format_polar_auxviii:nn { ee }
+\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 }
 %    \end{macrocode}
 % \end{macro}
 % \end{macro}
@@ -1222,6 +1236,7 @@
 % \end{macro}
 % \end{macro}
 % \end{macro}
+% \end{macro}
 %
 % \subsection{Messages}
 %

Modified: trunk/Master/texmf-dist/source/latex/siunitx/siunitx-table.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/siunitx/siunitx-table.dtx	2024-08-21 21:53:17 UTC (rev 72079)
+++ trunk/Master/texmf-dist/source/latex/siunitx/siunitx-table.dtx	2024-08-21 21:54:10 UTC (rev 72080)
@@ -297,13 +297,10 @@
 %   Collecting a tabular cell means doing a token-by-token collection.
 %   In previous versions of \pkg{siunitx} that was done along with picking
 %   out the numerical part, but the code flow ends up very tricky. Here,
-%   therefore, we just collect up the unchanged tokens first. The definition of
-%   \cs{cr} is used to allow collection of any tokens
-%   inserted after the main content when dealing with the last cell of a row:
-%   the \enquote{group} around it is needed to avoid issues with the underlying
-%   |\halign|. (The approach is based on that in \pkg{collcell}.) Whilst the
-%   group formed by a cell will normally tidy up |\cr|, we add an extra one as
-%   the collected material could be a tabular in itself. We use an auxiliary to
+%   therefore, we just collect up the unchanged tokens first. Whilst each
+%   cell forms a group, as we require definitions to say local
+%   to the collections code, an additional group is required.
+%   We use an auxiliary to
 %   fish out the |\ignorespaces| from the template: that has to go to avoid
 %   issues with the peek-ahead code (everything before the |#| needs to be
 %   read \emph{before} the Appendix~D trick gets applied). Some packages
@@ -314,13 +311,6 @@
   {
     \group_begin:
       \tl_clear:N \l_@@_collect_tl
-      \if_false: { \fi:
-      \cs_set_protected:Npn \cr
-        {
-          \@@_collect_loop:
-          \tex_cr:D
-        }
-      \if_false: } \fi:
       \@@_collect_begin:w
   }
 \cs_new_protected:Npn \@@_collect_begin:w #1 \ignorespaces
@@ -365,9 +355,9 @@
       {
         \unskip            { \@@_collect_loop: }
         \textonly at unskip   { \@@_collect_loop: }
-        \end               { \tabularnewline \end }
+        \end               { \@@_collect_pre_cr: \tabularnewline \end }
         \relax             { \@@_collect_relax:N #1 }
-        \tabularnewline    { \tabularnewline }
+        \tabularnewline    { \@@_collect_pre_cr: \tabularnewline }
         \siunitx_cell_end: { \siunitx_cell_end: }
       }
       { \@@_collect_token_aux:N #1 }
@@ -394,9 +384,9 @@
                 \@maybe at unskip     { \@@_collect_loop: }
                 \tab at setcr         { \@@_collect_loop: }
                 \unskip            { \@@_collect_loop: }
-                \end               { \tabularnewline \end }
+                \end               { \@@_collect_pre_cr: \tabularnewline \end }
                 \relax             { \@@_collect_relax:N #1 }
-                \tabularnewline    { \tabularnewline }
+                \tabularnewline    { \@@_collect_pre_cr: \tabularnewline }
                 \siunitx_cell_end: { \siunitx_cell_end: }
               }
               { \@@_collect_token_aux:N #1 }
@@ -425,6 +415,30 @@
 % \end{macro}
 % \end{macro}
 %
+% \begin{macro}{\@@_collect_pre_cr:}
+%   The definition of \cs{cr} is used to allow collection of any tokens
+%   from the \tn{halign} template after |#| when we are in the last cell of 
+%   the row. (The approach is based on that in \pkg{collcell}.) Note that
+%   \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
+%   approach: only apply when needed, and use the additional group inside the
+%   cell to keep control.
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_collect_pre_cr:
+  {
+    \if_false: { \fi:
+    \cs_set_protected:Npn \cr
+      {
+        \@@_collect_loop:
+        \tex_cr:D
+      }
+    \if_false: } \fi:
+  }
+%    \end{macrocode}
+% \end{macro}
+%
 % \subsection{Separating collected material}
 %
 % The input needs to be divided into numerical tokens and those which appear

Modified: trunk/Master/texmf-dist/source/latex/siunitx/siunitx.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/siunitx/siunitx.dtx	2024-08-21 21:53:17 UTC (rev 72079)
+++ trunk/Master/texmf-dist/source/latex/siunitx/siunitx.dtx	2024-08-21 21:54:10 UTC (rev 72080)
@@ -124,7 +124,7 @@
 %
 % Identify the package and give the over all version information.
 %    \begin{macrocode}
-\ProvidesExplPackage {siunitx} {2024-08-01} {3.3.20}
+\ProvidesExplPackage {siunitx} {2024-08-20} {3.3.21}
   {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	2024-08-21 21:53:17 UTC (rev 72079)
+++ trunk/Master/texmf-dist/source/latex/siunitx/siunitx.tex	2024-08-21 21:54:10 UTC (rev 72080)
@@ -1911,7 +1911,7 @@
 numbers: when formatting quantities, the need for brackets also depends on the
 placement of units, so is controlled by \opt{separate-uncertainty-units}.
 \begin{LaTeXdemo}
-  \sisetup{separate-uncertainty}
+  \sisetup{uncertainty-mode = separate}
   \num{1.2(3)e4} \\
   \num[bracket-ambiguous-numbers = false]{1.2(3)e4}
 \end{LaTeXdemo}
@@ -2760,7 +2760,7 @@
 each part of the number) and \opt{single} (print only one unit symbol:
 mathematically incorrect).
 \begin{LaTeXdemo}
-  \sisetup{separate-uncertainty}
+  \sisetup{uncertainty-mode = separate}
   \qty{12.3(4)}{\kilo\gram} \\
   \qty[separate-uncertainty-units = bracket]{12.3(4)}{\kilo\gram} \\
   \qty[separate-uncertainty-units = repeat]{12.3(4)}{\kilo\gram}  \\
@@ -2887,7 +2887,7 @@
       S[table-format = 2.2]
       S[table-format = 2.2, table-number-alignment = right]
       S[table-format = 2.2(1)]
-      S[table-format = 2.2(1), separate-uncertainty]
+      S[table-format = 2.2(1), uncertainty-mode = separate]
       S[table-format = +2.2]
       S[table-format = 2.2e1]
      @{}}
@@ -2970,7 +2970,7 @@
     \caption{The \opt{table-align-uncertainty} option.%
       \label{tab:align:uncert}}
     \sisetup{
-      separate-uncertainty,
+      uncertainty-mode = separate,
       table-format = 1.3(1),
     }
     \begin{tabular}{@{}SS[table-align-uncertainty = false]@{}}

Modified: trunk/Master/texmf-dist/tex/latex/siunitx/siunitx.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/siunitx/siunitx.sty	2024-08-21 21:53:17 UTC (rev 72079)
+++ trunk/Master/texmf-dist/tex/latex/siunitx/siunitx.sty	2024-08-21 21:54:10 UTC (rev 72080)
@@ -41,7 +41,7 @@
       }%
     \endinput
   }%
-\ProvidesExplPackage {siunitx} {2024-08-01} {3.3.20}
+\ProvidesExplPackage {siunitx} {2024-08-20} {3.3.21}
   {A comprehensive (SI) units package}
 \msg_new:nnnn { siunitx } { incompatible-package }
   { Package~'#1'~incompatible. }
@@ -2989,23 +2989,26 @@
   {
     \siunitx_angle:eee
       { \fp_eval:n { trunc(#1,0) } }
-      { \fp_eval:n { trunc((#1 - trunc(#1,0)) * 60,0) } }
+      { \fp_eval:n { abs(trunc((#1 - trunc(#1,0)) * 60,0)) } }
       {
         \fp_eval:n
           {
-            (
-                      (#1 - trunc(#1,0)) * 60
-              - trunc((#1 - trunc(#1,0)) * 60,0)
-            )
+            abs
+              (
+                        (#1 - trunc(#1,0)) * 60
+                - trunc((#1 - trunc(#1,0)) * 60,0)
+              )
             * 60
           }
       }
   }
 \cs_generate_variant:Nn \__siunitx_angle_arc_convert:n { e }
+\clist_const:Nn \c__siunitx_angle_parts_tl { degrees , minutes , seconds }
 \tl_new:N \l__siunitx_angle_degrees_tl
 \tl_new:N \l__siunitx_angle_minutes_tl
 \tl_new:N \l__siunitx_angle_seconds_tl
 \tl_new:N \l__siunitx_angle_sign_tl
+\tl_new:N \l__siunitx_angle_signed_bool
 \keys_precompile:nnN
   { siunitx }
   {
@@ -3019,9 +3022,9 @@
   { \exp_not:V \l__siunitx_angle_tmp_tl }
 \keys_precompile:nnN
   { siunitx }
-  { input-comparators = , input-signs = }
+  { input-comparators = }
   \l__siunitx_angle_tmp_tl
-\cs_set_protected:Npx \__siunitx_angle_suppress_comp_sign:
+\cs_set_protected:Npx \__siunitx_angle_suppress_comp:
   { \exp_not:V \l__siunitx_angle_tmp_tl }
 \cs_new_protected:Npn \__siunitx_angle_arc_sign:nnn #1#2#3
   {
@@ -3028,40 +3031,23 @@
     \group_begin:
       \__siunitx_angle_suppress_exp_uncert:
       \tl_clear:N \l__siunitx_angle_sign_tl
-      \__siunitx_angle_arc_sign:nn {#1} { degrees }
+      \bool_set_false:N \l__siunitx_angle_signed_bool
+      \str_if_eq:nnTF {#1} { -0 }
+        {
+          \__siunitx_angle_arc_sign:nn { } { degrees }
+          \__siunitx_angle_suppress_comp:
+          \tl_set:Nn \l__siunitx_angle_sign_tl { - }
+          \bool_set_true:N \l__siunitx_angle_signed_bool
+        }
+        { \__siunitx_angle_arc_sign:nn {#1} { degrees } }
       \__siunitx_angle_arc_sign:nn {#2} { minutes }
       \__siunitx_angle_arc_sign:nn {#3} { seconds }
       \tl_if_empty:NF \l__siunitx_angle_sign_tl
         {
-          \clist_map_inline:nn { degrees , minutes , seconds }
-            {
-              \tl_if_empty:cF { l__siunitx_angle_ ##1 _tl }
-                {
-                  \tl_set:cx { l__siunitx_angle_ ##1 _tl }
-                    {
-                       { }
-                       { \exp_not:V \l__siunitx_angle_sign_tl }
-                       \exp_after:wN \exp_after:wN \exp_after:wN
-                         \__siunitx_angle_sign:nnnnnnn
-                           \cs:w l__siunitx_angle_ ##1 _tl \cs_end:
-                    }
-                  \clist_map_break:
-                }
-            }
+          \clist_map_function:NN \c__siunitx_angle_parts_tl
+            \__siunitx_angle_arc_sign_auxi:n
         }
-      \clist_map_inline:nn { degrees , minutes , seconds }
-        {
-          \tl_if_empty:cF { l__siunitx_angle_ ##1 _tl }
-            {
-              \siunitx_number_process:cc
-                { l__siunitx_angle_ ##1 _tl } { l__siunitx_angle_ ##1 _tl }
-              \tl_set:cx { l__siunitx_angle_ ##1 _tl }
-                {
-                  \siunitx_number_output:cN
-                    { l__siunitx_angle_ ##1 _tl } \q_nil
-                }
-            }
-        }
+      \clist_map_function:NN \c__siunitx_angle_parts_tl \__siunitx_angle_arc_sign_auxii:n
       \__siunitx_angle_arc_print:VVV
         \l__siunitx_angle_degrees_tl
         \l__siunitx_angle_minutes_tl
@@ -3082,17 +3068,53 @@
       {
         \siunitx_number_parse:nN {#1} \l__siunitx_angle_tmp_tl
         \exp_after:wN \__siunitx_angle_extract_sign:nnnnnnnn \l__siunitx_angle_tmp_tl {#2}
+        \bool_set_true:N \l__siunitx_angle_signed_bool
       }
   }
+\cs_new_protected:Npn \__siunitx_angle_arc_sign_auxi:n #1
+  {
+    \tl_if_empty:cF { l__siunitx_angle_ #1 _tl }
+      {
+        \tl_set:cx { l__siunitx_angle_ #1 _tl }
+          {
+            { }
+            { \exp_not:V \l__siunitx_angle_sign_tl }
+            \exp_after:wN \exp_after:wN \exp_after:wN
+              \__siunitx_angle_sign:nnnnnnn
+                \cs:w l__siunitx_angle_ #1 _tl \cs_end:
+           }
+        \clist_map_break:
+      }
+  }
+\cs_new_protected:Npn \__siunitx_angle_arc_sign_auxii:n #1
+  {
+    \tl_if_empty:cF { l__siunitx_angle_ #1 _tl }
+      {
+        \bool_lazy_and:nnF
+          { \l__siunitx_angle_force_arc_bool }
+          { ! \str_if_eq_p:nn {#1} { seconds } }
+          {
+            \siunitx_number_process:cc
+              { l__siunitx_angle_ #1 _tl } { l__siunitx_angle_ #1 _tl }
+          }
+        \tl_set:cx { l__siunitx_angle_ #1 _tl }
+          {
+            \siunitx_number_output:cN
+              { l__siunitx_angle_ #1 _tl } \q_nil
+          }
+      }
+  }
 \cs_new_protected:Npn \__siunitx_angle_extract_sign:nnnnnnnn #1#2#3#4#5#6#7#8
   {
     \tl_if_blank:nTF {#2}
       { \tl_set_eq:cN { l__siunitx_angle_ #8 _tl } \l__siunitx_angle_tmp_tl }
       {
+        \bool_if:NTF \l__siunitx_angle_signed_bool
+          { \msg_error:nnn { siunitx } { arc-multi-sign } }
+          { \tl_set:Nn \l__siunitx_angle_sign_tl {#2} }
         \tl_set:cn { l__siunitx_angle_ #8 _tl }
           { {#1} { } {#3} {#4} {#5} {#6} {#7} }
-        \tl_set:Nn \l__siunitx_angle_sign_tl {#2}
-        \__siunitx_angle_suppress_comp_sign:
+        \__siunitx_angle_suppress_comp:
       }
   }
 \cs_new:Npn \__siunitx_angle_sign:nnnnnnn #1#2#3#4#5#6#7
@@ -3212,6 +3234,12 @@
     \siunitx_unit_format:nN {#1} \l__siunitx_angle_tmp_tl
     \siunitx_print_unit:V \l__siunitx_angle_tmp_tl
   }
+\msg_new:nnnn { siunitx } { arc-multi-sign }
+  { Multiple~signs~given~for~arc~angle! }
+  {
+    An~angle~given~as~an~arc~should~have~at~most~one~sign:~
+    only~the~first~sign~will~be~used.
+  }
 \keys_set:nn { siunitx }
   {
     angle-mode                = input      ,
@@ -3877,10 +3905,10 @@
     \bool_lazy_or:nnTF
       { \str_if_eq_p:nn {#2} { i } }
       { \str_if_eq_p:nn {#2#3} { +i } }
-      { \__siunitx_complex_convert_polar_auxvi:nnn { } { 1 } {#1} }
+      { \__siunitx_complex_convert_polar_auxvii:nnn { } { 1 } {#1} }
       {
         \str_if_eq:nnTF {#2#3} { -i }
-          { \__siunitx_complex_convert_polar_auxvi:nnn { } { -1 } {#1} }
+          { \__siunitx_complex_convert_polar_auxvii:nnn { } { -1 } {#1} }
           { \__siunitx_complex_convert_polar_auxiii:nnw {#1} {#2} #3 + + \q_stop }
       }
   }
@@ -3890,7 +3918,7 @@
       { \__siunitx_complex_convert_polar_auxiv:nnw {#1} {#2} #3 - - \q_stop }
       {
         \str_if_eq:nnTF {#4} { i }
-          { \__siunitx_complex_convert_polar_auxvi:nnn {#2#3} { 1 } {#1} }
+          { \__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 }
       }
   }
@@ -3900,7 +3928,7 @@
       { \__siunitx_complex_convert_polar_auxv:nnw { } {#1} #2#3 i \q_nil i \q_stop }
       {
         \str_if_eq:nnTF {#4} { i }
-          { \__siunitx_complex_convert_polar_auxvi:nnn { } { -1 } {#1} }
+          { \__siunitx_complex_convert_polar_auxvii:nnn { } { -1 } {#1} }
           { \__siunitx_complex_convert_polar_auxv:nnw {#2#3} {#1} -#4 i \q_nil i \q_stop }
       }
   }
@@ -3907,19 +3935,29 @@
 \cs_new:Npn \__siunitx_complex_convert_polar_auxv:nnw #1#2#3 i #4 i #5 \q_stop
   {
     \quark_if_nil:nTF {#4}
-      { { #3 \tl_if_blank:nF {#2} { e#2 } } { 0 } }
-      { \__siunitx_complex_convert_polar_auxvi:nnn {#1} {#3} {#2} }
+      {
+        \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 } }
+            {#2}
+      }
+      { \__siunitx_complex_convert_polar_auxvii:nnn {#1} {#3} {#2} }
   }
 \cs_new:Npn \__siunitx_complex_convert_polar_auxvi:nnn #1#2#3
   {
-    \__siunitx_complex_convert_polar_auxvii:eee
+    { #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
+  {
+    \__siunitx_complex_convert_polar_auxviii: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_auxvii:nnn #1#2#3
+\cs_new:Npn \__siunitx_complex_convert_polar_auxviii:nnn #1#2#3
   {
-    \__siunitx_complex_format_polar_auxviii:ee
+    \__siunitx_complex_format_polar_auxix:ee
       { \fp_eval:n { sqrt ( (#1#3)^2 + (#2#3)^2 ) } }
       {
         \fp_eval:n
@@ -3926,9 +3964,9 @@
           { atan \bool_if:NT \l__siunitx_complex_polar_degree_bool { d } (#2 , #1) }
       }
   }
-\cs_generate_variant:Nn \__siunitx_complex_convert_polar_auxvii:nnn { eee }
-\cs_new:Npn \__siunitx_complex_format_polar_auxviii:nn #1#2 { {#1} {#2} }
-\cs_generate_variant:Nn \__siunitx_complex_format_polar_auxviii:nn { ee }
+\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 }
 \msg_new:nnnn { siunitx } { invalid-polar-form }
   { Invalid~polar~form~"#1:#2". }
   {
@@ -5314,13 +5352,6 @@
   {
     \group_begin:
       \tl_clear:N \l__siunitx_table_collect_tl
-      \if_false: { \fi:
-      \cs_set_protected:Npn \cr
-        {
-          \__siunitx_table_collect_loop:
-          \tex_cr:D
-        }
-      \if_false: } \fi:
       \__siunitx_table_collect_begin:w
   }
 \cs_new_protected:Npn \__siunitx_table_collect_begin:w #1 \ignorespaces
@@ -5345,9 +5376,9 @@
       {
         \unskip            { \__siunitx_table_collect_loop: }
         \textonly at unskip   { \__siunitx_table_collect_loop: }
-        \end               { \tabularnewline \end }
+        \end               { \__siunitx_table_collect_pre_cr: \tabularnewline \end }
         \relax             { \__siunitx_table_collect_relax:N #1 }
-        \tabularnewline    { \tabularnewline }
+        \tabularnewline    { \__siunitx_table_collect_pre_cr: \tabularnewline }
         \siunitx_cell_end: { \siunitx_cell_end: }
       }
       { \__siunitx_table_collect_token_aux:N #1 }
@@ -5374,9 +5405,9 @@
                 \@maybe at unskip     { \__siunitx_table_collect_loop: }
                 \tab at setcr         { \__siunitx_table_collect_loop: }
                 \unskip            { \__siunitx_table_collect_loop: }
-                \end               { \tabularnewline \end }
+                \end               { \__siunitx_table_collect_pre_cr: \tabularnewline \end }
                 \relax             { \__siunitx_table_collect_relax:N #1 }
-                \tabularnewline    { \tabularnewline }
+                \tabularnewline    { \__siunitx_table_collect_pre_cr: \tabularnewline }
                 \siunitx_cell_end: { \siunitx_cell_end: }
               }
               { \__siunitx_table_collect_token_aux:N #1 }
@@ -5397,6 +5428,16 @@
       { \use_i_delimit_by_q_stop:nw {#3} }
       { \__siunitx_table_collect_search_aux:NNn #1 }
   }
+\cs_new_protected:Npn \__siunitx_table_collect_pre_cr:
+  {
+    \if_false: { \fi:
+    \cs_set_protected:Npn \cr
+      {
+        \__siunitx_table_collect_loop:
+        \tex_cr:D
+      }
+    \if_false: } \fi:
+  }
 \tl_new:N \l__siunitx_table_before_tl
 \tl_new:N \l__siunitx_table_number_tl
 \tl_new:N \l__siunitx_table_after_tl



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