texlive[73529] Master/texmf-dist: siunitx (20jan25)

commits+karl at tug.org commits+karl at tug.org
Mon Jan 20 22:23:32 CET 2025


Revision: 73529
          https://tug.org/svn/texlive?view=revision&revision=73529
Author:   karl
Date:     2025-01-20 22:23:32 +0100 (Mon, 20 Jan 2025)
Log Message:
-----------
siunitx (20jan25)

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-quantity.dtx
    trunk/Master/texmf-dist/source/latex/siunitx/siunitx.dtx
    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-01-20 21:23:09 UTC (rev 73528)
+++ trunk/Master/texmf-dist/doc/latex/siunitx/CHANGELOG.md	2025-01-20 21:23:32 UTC (rev 73529)
@@ -7,6 +7,13 @@
 
 ## [Unreleased]
 
+## [v3.4.3] - 2025-01-20
+
+### Fixed
+- Correct behavior of `inline-per-mode = symbol` with an alternative setting
+  for `display-per-mode` when units are entirely in the denominator (see issue
+  [\#765](https://github.com/josephwright/siunitx/issues/765))
+
 ## [v3.4.2] - 2025-01-17
 
 ### Changed
@@ -2221,7 +2228,8 @@
 ### Added
 - First public testing release (as `si`)
 
-[Unreleased]: https://github.com/josephwright/siunitx/compare/v3.4.2...HEAD
+[Unreleased]: https://github.com/josephwright/siunitx/compare/v3.4.3...HEAD
+[v3.4.3]: https://github.com/josephwright/siunitx/compare/v3.4.2...v3.4.3
 [v3.4.2]: https://github.com/josephwright/siunitx/compare/v3.4.1...v3.4.2
 [v3.4.1]: https://github.com/josephwright/siunitx/compare/v3.4.0...v3.4.1
 [v3.4.0]: https://github.com/josephwright/siunitx/compare/v3.3.24...v3.4.0

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-quantity.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/siunitx/siunitx-quantity.dtx	2025-01-20 21:23:09 UTC (rev 73528)
+++ trunk/Master/texmf-dist/source/latex/siunitx/siunitx-quantity.dtx	2025-01-20 21:23:32 UTC (rev 73529)
@@ -382,12 +382,16 @@
 %     \siunitx_quantity_print:nn, \siunitx_quantity_print:nV,
 %     \siunitx_quantity_print:VV, \siunitx_quantity_print:eV
 %   }
+% \begin{macro}{\@@_print_unit:n}
+% \begin{macro}{\@@_print_mathchoice:Nnnnn}
+% \begin{macro}{\@@_print_mathchoice:nnN}
 %   For printing a single part of a quantity. This is needed for compound
 %   quantities and so is public: that's also the reason for passing both
-%   argument explicitly. The lazy test here is looking for the case where
-%   a |1| has been inserted at the start of a format unit \emph{and} we
-%   have some other number to print: the |1| is then removed and there is
-%   no space inserted.
+%   argument explicitly. The semantics here require that the penalty and
+%   spacing are always applied: the number argument may be empty. The lazy test
+%   here is looking for the case where a |1| has been inserted at the start of
+%   a format unit \emph{and} we have some other number to print: the |1| is
+%   then removed and there is no space inserted.
 %    \begin{macrocode}
 \cs_new_protected:Npn \siunitx_quantity_print:nn #1#2
   {
@@ -394,22 +398,56 @@
     \siunitx_print_number:n {#1}
     \tl_if_blank:nF {#2}
       {
-        \bool_lazy_or:nnTF
-          { \tl_if_blank_p:n {#1} }
-          { ! \tl_if_head_eq_charcode_p:nN {#2} { 1 } }
+        \tl_if_blank:nTF {#1}
+          { \@@_print_unit:n {#2} }
           {
-            \bool_if:NTF \l_@@_break_bool
-              { \penalty \binoppenalty }
-              { \nobreak }
-            \tl_use:N \l_@@_product_tl
-            \siunitx_print_unit:n {#2}
+            \tl_if_head_eq_charcode:nNTF {#2} 1
+              { \siunitx_print_unit:o { \use_none:n #2 } }
+              {
+                \tl_if_head_eq_meaning:nNTF {#2} \mathchoice
+                  { \@@_print_mathchoice:Nnnnn #2 }
+                  { \@@_print_unit:n {#2} }
+              }
           }
-          { \siunitx_print_unit:o { \use_none:n #2 } }
       }
   }
 \cs_generate_variant:Nn \siunitx_quantity_print:nn { nV , VV , eV , xV }
+\cs_new_protected:Npn \@@_print_unit:n #1
+  {
+    \bool_if:NTF \l_@@_break_bool
+      { \penalty \binoppenalty }
+      { \nobreak }
+    \tl_use:N \l_@@_product_tl
+    \siunitx_print_unit:n {#1}
+  }
 %    \end{macrocode}
+%  If the first token of the unit is |\mathchoice|, we are looking at
+%  formatting differently in display and inline math modes. If we then have a
+%  leading |1|, then it needs to be lopped off. We also need to remember here
+%  that the spacing also needs to be inside the |\mathchoice|, as it only
+%  applies in display mode. To get all of this to work, there is then some
+%  nesting of print functions: unavoidable. As |#3|, |#4| and |#5| are
+%  identical, expansion can take place just once to pass the trimmed tokens.
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_print_mathchoice:Nnnnn #1#2#3#4#5
+  {
+    \tl_if_head_eq_charcode:nNTF {#3} 1
+      {
+        \exp_args:No \@@_print_mathchoice:nnN
+          { \use_none:n #3 } {#2} #1
+      }
+      { \@@_print_unit:n { #1 {#2} {#3} {#4} {#5} } }
+  }
+\cs_new_protected:Npn \@@_print_mathchoice:nnN #1#2#3
+  {
+    \siunitx_print_unit:n
+      { #3 { \@@_print_unit:n {#2} } {#1} {#1} {#1} }
+  }
+%    \end{macrocode}
 % \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
 %
 % \subsection{Standard settings for module options}
 %

Modified: trunk/Master/texmf-dist/source/latex/siunitx/siunitx.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/siunitx/siunitx.dtx	2025-01-20 21:23:09 UTC (rev 73528)
+++ trunk/Master/texmf-dist/source/latex/siunitx/siunitx.dtx	2025-01-20 21:23:32 UTC (rev 73529)
@@ -137,7 +137,7 @@
 %
 % Identify the package and give the over all version information.
 %    \begin{macrocode}
-\ProvidesExplPackage {siunitx} {2025-01-17} {3.4.2}
+\ProvidesExplPackage {siunitx} {2025-01-20} {3.4.3}
   {A comprehensive (SI) units package}
 %    \end{macrocode}
 %

Modified: trunk/Master/texmf-dist/tex/latex/siunitx/siunitx.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/siunitx/siunitx.sty	2025-01-20 21:23:09 UTC (rev 73528)
+++ trunk/Master/texmf-dist/tex/latex/siunitx/siunitx.sty	2025-01-20 21:23:32 UTC (rev 73529)
@@ -47,7 +47,7 @@
       }%
     \endinput
   }%
-\ProvidesExplPackage {siunitx} {2025-01-17} {3.4.2}
+\ProvidesExplPackage {siunitx} {2025-01-20} {3.4.3}
   {A comprehensive (SI) units package}
 \msg_new:nnnn { siunitx } { incompatible-package }
   { Package~'#1'~incompatible. }
@@ -7867,20 +7867,42 @@
     \siunitx_print_number:n {#1}
     \tl_if_blank:nF {#2}
       {
-        \bool_lazy_or:nnTF
-          { \tl_if_blank_p:n {#1} }
-          { ! \tl_if_head_eq_charcode_p:nN {#2} { 1 } }
+        \tl_if_blank:nTF {#1}
+          { \__siunitx_quantity_print_unit:n {#2} }
           {
-            \bool_if:NTF \l__siunitx_quantity_break_bool
-              { \penalty \binoppenalty }
-              { \nobreak }
-            \tl_use:N \l__siunitx_quantity_product_tl
-            \siunitx_print_unit:n {#2}
+            \tl_if_head_eq_charcode:nNTF {#2} 1
+              { \siunitx_print_unit:o { \use_none:n #2 } }
+              {
+                \tl_if_head_eq_meaning:nNTF {#2} \mathchoice
+                  { \__siunitx_quantity_print_mathchoice:Nnnnn #2 }
+                  { \__siunitx_quantity_print_unit:n {#2} }
+              }
           }
-          { \siunitx_print_unit:o { \use_none:n #2 } }
       }
   }
 \cs_generate_variant:Nn \siunitx_quantity_print:nn { nV , VV , eV , xV }
+\cs_new_protected:Npn \__siunitx_quantity_print_unit:n #1
+  {
+    \bool_if:NTF \l__siunitx_quantity_break_bool
+      { \penalty \binoppenalty }
+      { \nobreak }
+    \tl_use:N \l__siunitx_quantity_product_tl
+    \siunitx_print_unit:n {#1}
+  }
+\cs_new_protected:Npn \__siunitx_quantity_print_mathchoice:Nnnnn #1#2#3#4#5
+  {
+    \tl_if_head_eq_charcode:nNTF {#3} 1
+      {
+        \exp_args:No \__siunitx_quantity_print_mathchoice:nnN
+          { \use_none:n #3 } {#2} #1
+      }
+      { \__siunitx_quantity_print_unit:n { #1 {#2} {#3} {#4} {#5} } }
+  }
+\cs_new_protected:Npn \__siunitx_quantity_print_mathchoice:nnN #1#2#3
+  {
+    \siunitx_print_unit:n
+      { #3 { \__siunitx_quantity_print_unit:n {#2} } {#1} {#1} {#1} }
+  }
 \keys_set:nn { siunitx }
   {
     allow-quantity-breaks      = false  ,



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