summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/siunitx/siunitx.dtx
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2022-04-26 03:02:04 +0000
committerNorbert Preining <norbert@preining.info>2022-04-26 03:02:04 +0000
commit6f7554fc6cab67e3dc397ce7a942889eedbc4967 (patch)
treecd63f9ed43b147e44b3f1981bf7bda23680416b1 /macros/latex/contrib/siunitx/siunitx.dtx
parent4688b855bb6f8b817901a7c777e8aecd1a189622 (diff)
CTAN sync 202204260302
Diffstat (limited to 'macros/latex/contrib/siunitx/siunitx.dtx')
-rw-r--r--macros/latex/contrib/siunitx/siunitx.dtx112
1 files changed, 88 insertions, 24 deletions
diff --git a/macros/latex/contrib/siunitx/siunitx.dtx b/macros/latex/contrib/siunitx/siunitx.dtx
index d1de5e34da..a5219ad957 100644
--- a/macros/latex/contrib/siunitx/siunitx.dtx
+++ b/macros/latex/contrib/siunitx/siunitx.dtx
@@ -121,7 +121,7 @@
%
% Identify the package and give the over all version information.
% \begin{macrocode}
-\ProvidesExplPackage {siunitx} {2022-04-04} {3.0.50}
+\ProvidesExplPackage {siunitx} {2022-04-25} {3.1.0}
{A comprehensive (SI) units package}
% \end{macrocode}
%
@@ -144,11 +144,11 @@
{ }
}
\clist_map_function:nN
- { SIunits , sistyle , unitsdef , fancyunits }
+ { SIunits , sistyle , units , unitsdef , fancyunits }
\@@_load_check:n
\AtBeginDocument
{
- \clist_map_function:nN { SIunits , sistyle }
+ \clist_map_function:nN { SIunits , sistyle , units }
\@@_load_check:n
}
% \end{macrocode}
@@ -199,6 +199,35 @@
%
% \subsection{Option handling}
%
+% Some messages.
+% \begin{macrocode}
+\msg_new:nnn { siunitx } { option-deprecated }
+ {
+ Option~"#1"~has~been~deprecated~in~this~release.\\ \\
+ Use~"#2"~as~a~replacement.
+ }
+% \end{macrocode}
+%
+% \begin{variable}{\g_@@_deprecated_seq}
+% Used to avoid repeatedly warning about deprecated options: needed at the
+% top level.
+% \begin{macrocode}
+\seq_new:N \g_@@_deprecated_seq
+% \end{macrocode}
+% \end{variable}
+%
+% \begin{macro}{\@@_deprecated_info:nn}
+% To avoid repeated messages.
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_deprecated_info:nn #1#2
+ {
+ \seq_if_in:NnF \g_@@_deprecated_seq {#1}
+ { \msg_info:nnnn { siunitx } { option-deprecated } {#1} {#2} }
+ \seq_gput_right:Nn \g_@@_deprecated_seq {#1}
+ }
+% \end{macrocode}
+% \end{macro}
+%
% \begin{macrocode}
\IfFormatAtLeastTF { 2022-06-01 }
{ \ProcessKeyOptions [ siunitx ] }
@@ -266,16 +295,34 @@
%
% \begin{macro}{\qty}
% \begin{macrocode}
-\@ifpackageloaded { physics }
+\AtBeginDocument
{
- \msg_new:nnn { siunitx } { physics-pkg }
+ \@ifpackageloaded { physics }
{
- Detected~the~"physics"~package: \\
- Omitting~definition~of~\token_to_str:N \qty.
+ \msg_new:nnn { siunitx } { physics-pkg }
+ {
+ Detected~the~"physics"~package: \\
+ omitting~definition~of~\token_to_str:N \qty.
+ \\ \\
+ If~you~want~to~use~\qty with~the~siunitx~definition,~add~
+ \\ \\
+ \iow_indent:n
+ {
+ \token_to_str:N \AtBeginDocument
+ {
+ \token_to_str:N \RenewCommandCopy
+ \token_to_str:N \qty \token_to_str:N \SI
+ }
+ }
+ \\ \\
+ to~your~preamble.
+ }
+ \msg_warning:nn { siunitx } { physics-pkg }
}
- \msg_warning:nn { siunitx } { physics-pkg }
- \use_none:nnnn
+ { }
}
+\@ifpackageloaded { physics }
+ { \use_none:nnnn }
{ }
\NewDocumentCommand \qty { O { } m > { \TrimSpaces } m }
{
@@ -310,17 +357,6 @@
\siunitx_print_number:V \l_@@_tmp_tl
\group_end:
}
-\@ifpackageloaded { units }
- {
- \msg_new:nnn { siunitx } { units-pkg }
- {
- Detected~the~"units"~package: \\
- Omitting~definition~of~\token_to_str:N \unit.
- }
- \msg_warning:nn { siunitx } { units-pkg }
- \use_none:nnnn
- }
- { }
\NewDocumentCommand \unit { O { } > { \TrimSpaces } m }
{
\mode_leave_vertical:
@@ -398,21 +434,29 @@
% \begin{macro}{\complexnum, \complexqty}
% Interfaces for complex numbers.
% \begin{macrocode}
-\NewDocumentCommand \complexnum { O { } m }
+\use:e
+ {
+ \NewDocumentCommand \exp_not:N \complexnum
+ { O { } > { \SplitArgument { 1 } { \c_colon_str } } m }
+ }
{
\mode_leave_vertical:
\group_begin:
\keys_set:nn { siunitx } {#1}
- \siunitx_complex_number:n {#2} \l_@@_tmp_tl
+ \@@_complex_number_aux:nn #2
\group_end:
}
-\NewDocumentCommand \complexqty { O { } m m }
+\use:e
+ {
+ \NewDocumentCommand \exp_not:N \complexqty
+ { O { } > { \SplitArgument { 1 } { \c_colon_str } } m m }
+ }
{
\mode_leave_vertical:
\group_begin:
\siunitx_unit_options_apply:n {#3}
\keys_set:nn { siunitx } {#1}
- \siunitx_complex_quantity:nn {#2} {#3}
+ \@@_complex_quantity_aux:nnn #2 {#3}
\group_end:
}
% \end{macrocode}
@@ -461,6 +505,26 @@
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{\@@_complex_number_aux:nn}
+% \begin{macro}{\@@_complex_quantity_aux:nnn}
+% The same idea for complex values.
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_complex_number_aux:nn #1#2
+ {
+ \tl_if_novalue:nTF {#2}
+ { \siunitx_complex_number:n {#1} }
+ { \siunitx_complex_number:nn {#1} {#2} }
+ }
+\cs_new_protected:Npn \@@_complex_quantity_aux:nnn #1#2#3
+ {
+ \tl_if_novalue:nTF {#2}
+ { \siunitx_complex_quantity:nn {#1} {#3} }
+ { \siunitx_complex_quantity:nnn {#1} {#2} {#3} }
+ }
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
% \subsection{Table column}
%
% User interfaces in tabular constructs are provided using the mechanisms from