summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/siunitx
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2021-05-29 03:01:39 +0000
committerNorbert Preining <norbert@preining.info>2021-05-29 03:01:39 +0000
commitc735cad430ba6a619963ad7248020b781a0a45f3 (patch)
treeea6084fa9eea4a658d4f3eb9f2495cf269c7f790 /macros/latex/contrib/siunitx
parentfd03eb3aab9edb9b15484a1130509cebe187d8bd (diff)
CTAN sync 202105290301
Diffstat (limited to 'macros/latex/contrib/siunitx')
-rw-r--r--macros/latex/contrib/siunitx/CHANGELOG.md13
-rw-r--r--macros/latex/contrib/siunitx/siunitx-code.pdfbin1444886 -> 1442135 bytes
-rw-r--r--macros/latex/contrib/siunitx/siunitx-emulation.dtx8
-rw-r--r--macros/latex/contrib/siunitx/siunitx-number.dtx71
-rw-r--r--macros/latex/contrib/siunitx/siunitx-print.dtx8
-rw-r--r--macros/latex/contrib/siunitx/siunitx-symbol.dtx56
-rw-r--r--macros/latex/contrib/siunitx/siunitx-unit.dtx122
-rw-r--r--macros/latex/contrib/siunitx/siunitx.dtx2
-rw-r--r--macros/latex/contrib/siunitx/siunitx.pdfbin598829 -> 598863 bytes
-rw-r--r--macros/latex/contrib/siunitx/siunitx.tex12
10 files changed, 153 insertions, 139 deletions
diff --git a/macros/latex/contrib/siunitx/CHANGELOG.md b/macros/latex/contrib/siunitx/CHANGELOG.md
index 0ff02b0443..f91a3e17e4 100644
--- a/macros/latex/contrib/siunitx/CHANGELOG.md
+++ b/macros/latex/contrib/siunitx/CHANGELOG.md
@@ -7,6 +7,16 @@ Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to
## [Unreleased]
+## [v3.0.7]
+
+### Fixed
+- Formatting of some literal units (issue #449)
+- Issue a warning for removed option `load-configurations`
+ (issue #455)
+- Printing of `\times` and `\cdot` in text mode when using a
+ locale (issue #457)
+- Implement missing `output-exponent-marker` (issue #458)
+
## [v3.0.6]
### Changed
@@ -1312,7 +1322,8 @@ Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to
### Added
- First public testing release (as `si`)
-[Unreleased]: https://github.com/josephwright/siunitx/compare/v3.0.6...HEAD
+[Unreleased]: https://github.com/josephwright/siunitx/compare/v3.0.7...HEAD
+[v3.0.7]: https://github.com/josephwright/siunitx/compare/v3.0.6...v3.0.7
[v3.0.6]: https://github.com/josephwright/siunitx/compare/v3.0.5...v3.0.6
[v3.0.5]: https://github.com/josephwright/siunitx/compare/v3.0.4...v3.0.5
[v3.0.4]: https://github.com/josephwright/siunitx/compare/v3.0.3...v3.0.4
diff --git a/macros/latex/contrib/siunitx/siunitx-code.pdf b/macros/latex/contrib/siunitx/siunitx-code.pdf
index ec731faa3f..09c3c9538d 100644
--- a/macros/latex/contrib/siunitx/siunitx-code.pdf
+++ b/macros/latex/contrib/siunitx/siunitx-code.pdf
Binary files differ
diff --git a/macros/latex/contrib/siunitx/siunitx-emulation.dtx b/macros/latex/contrib/siunitx/siunitx-emulation.dtx
index 48648e3c13..dc2e9f9035 100644
--- a/macros/latex/contrib/siunitx/siunitx-emulation.dtx
+++ b/macros/latex/contrib/siunitx/siunitx-emulation.dtx
@@ -125,7 +125,13 @@
% \subsection{Load-time option}
%
% \begin{macrocode}
-\clist_map_inline:nn { abbreviations , binary-units , version-1-compatibility }
+\clist_map_inline:nn
+ {
+ abbreviations ,
+ binary-units ,
+ load-configurations ,
+ version-1-compatibility
+ }
{
\keys_define:nn { siunitx } { #1 .code:n = \@@_option_removed:n {#1} }
}
diff --git a/macros/latex/contrib/siunitx/siunitx-number.dtx b/macros/latex/contrib/siunitx/siunitx-number.dtx
index 22fff7cdb9..cfbff37d9c 100644
--- a/macros/latex/contrib/siunitx/siunitx-number.dtx
+++ b/macros/latex/contrib/siunitx/siunitx-number.dtx
@@ -2860,6 +2860,7 @@
% \l_@@_group_minimum_int ,
% \l_@@_group_separator_tl ,
% \l_@@_negative_color_tl ,
+% \l_@@_output_exp_marker_tl ,
% \l_@@_output_uncert_close_tl ,
% \l_@@_output_uncert_open_tl ,
% \l_@@_uncert_mode_tl ,
@@ -2912,6 +2913,8 @@
\l_@@_output_uncert_close_tl ,
output-decimal-marker .tl_set:N =
\l_siunitx_number_output_decimal_tl ,
+ output-exponent-marker .tl_set:N =
+ \l_@@_output_exp_marker_tl ,
output-open-uncertainty .tl_set:N =
\l_@@_output_uncert_open_tl ,
print-implicit-plus .bool_set:N =
@@ -2980,7 +2983,13 @@
% \@@_output_uncert_S_compact-marker:nn ,
% \@@_output_uncert_S_full:nn
% }
-% \begin{macro}[rEXP]{\@@_output_exponent:nnnn}
+% \begin{macro}[rEXP]
+% {
+% \@@_output_exponent:nnnn ,
+% \@@_output_exponent_auxi:nnnn ,
+% \@@_output_exponent_auxii:nnnn
+% }
+% \begin{macro}[rEXP]{\@@_output_exponent_auxiii:nn}
% \begin{macro}[rEXP]{\@@_output_end:}
% The approach to formatting a single number is to split into
% the constituent parts. All of the parts are assembled including
@@ -3371,31 +3380,46 @@
{ \l_@@_zero_exponent_bool }
{ ! \str_if_eq_p:nn {#2} { 0 } }
{
- \bool_lazy_and:nnTF
- { \str_if_eq_p:nn {#3} { 1. } }
- { ! \l_@@_unity_mantissa_bool }
- { \exp_not:n {#4} }
- {
- \bool_if:NTF \l_@@_tight_bool
- { \exp_not:N \mathord }
- { \use:n }
- { \exp_not:V \l_@@_exponent_product_tl }
- \exp_not:n {#4}
- }
- \exp_not:V \l_@@_exponent_base_tl
- ^
- {
- \tl_if_blank:nTF {#1}
- {
- \bool_if:NT \l_@@_implicit_plus_bool
- { \@@_output_sign:N + }
- }
- { \@@_output_sign:N #1 }
- \@@_output_digits:nn { integer } {#2}
- }
+ \tl_if_empty:NTF \l_@@_output_exp_marker_tl
+ { \@@_output_exponent_auxi:nnnn }
+ { \@@_output_exponent_auxii:nnnn }
+ {#1} {#2} {#3} {#4}
}
{ \exp_not:n {#4} }
}
+\cs_new:Npn \@@_output_exponent_auxi:nnnn #1#2#3#4
+ {
+ \bool_lazy_and:nnTF
+ { \str_if_eq_p:nn {#3} { 1. } }
+ { ! \l_@@_unity_mantissa_bool }
+ { \exp_not:n {#4} }
+ {
+ \bool_if:NTF \l_@@_tight_bool
+ { \exp_not:N \mathord }
+ { \use:n }
+ { \exp_not:V \l_@@_exponent_product_tl }
+ \exp_not:n {#4}
+ }
+ \exp_not:V \l_@@_exponent_base_tl
+ ^
+ { \@@_output_exponent_auxiii:nn {#1} {#2} }
+ }
+\cs_new:Npn \@@_output_exponent_auxii:nnnn #1#2#3#4
+ {
+ \exp_not:n {#4}
+ \exp_not:V \l_@@_output_exp_marker_tl
+ \@@_output_exponent_auxiii:nn {#1} {#2}
+ }
+\cs_new:Npn \@@_output_exponent_auxiii:nn #1#2
+ {
+ \tl_if_blank:nTF {#1}
+ {
+ \bool_if:NT \l_@@_implicit_plus_bool
+ { \@@_output_sign:N + }
+ }
+ { \@@_output_sign:N #1 }
+ \@@_output_digits:nn { integer } {#2}
+ }
% \end{macrocode}
% A do-nothing marker used to allow shuffling of the output and so expandable
% operations for formatting.
@@ -3437,6 +3461,7 @@
% \end{macro}
% \end{macro}
% \end{macro}
+% \end{macro}
%
% \subsection{Miscellaneous tools}
%
diff --git a/macros/latex/contrib/siunitx/siunitx-print.dtx b/macros/latex/contrib/siunitx/siunitx-print.dtx
index cc26177ef1..15d4452055 100644
--- a/macros/latex/contrib/siunitx/siunitx-print.dtx
+++ b/macros/latex/contrib/siunitx/siunitx-print.dtx
@@ -78,8 +78,8 @@
% also required to provide the functionality detailed.
% \begin{itemize}
% \item \pkg{color}: support for color using \cs{textcolor}
-% \item \pkg{textcomp}: \cs{textminus} and \cs{textpm} for printing
-% in text mode
+% \item \pkg{textcomp}: \cs{textminus}, \cs{textpm} \cs{texttimes} and
+% \cs{textcenteredperiod} for printing in text mode
% \item \pkg{amstext}: the \cs{text} command for printing in text mode
% \end{itemize}
% For detection of math mode fonts, as well as \cs{mathrm}, the existence of
@@ -779,6 +779,10 @@
{ \exp_not:n { \ensuremath { \mp } } }
-
{ \exp_not:N \textminus }
+ \exp_not:N \times
+ { \exp_not:N \texttimes }
+ \exp_not:N \cdot
+ { \exp_not:N \textperiodcentered }
\char_generate:nn { `\_ } { 8 }
{ \exp_not:N \@@_text_sub:n }
^
diff --git a/macros/latex/contrib/siunitx/siunitx-symbol.dtx b/macros/latex/contrib/siunitx/siunitx-symbol.dtx
index a517c4e34f..8ba65fc417 100644
--- a/macros/latex/contrib/siunitx/siunitx-symbol.dtx
+++ b/macros/latex/contrib/siunitx/siunitx-symbol.dtx
@@ -253,62 +253,6 @@
}
% \end{macrocode}
%
-% For the times symbol, only \LuaTeX{} allows us to use the math mode symbol
-% directly. However, that likely won't follow the surrounding font appearance,
-% so in all cases we use the |TS1| version for text. Otherwise much the
-% same as |\textmu| support. It's hard to check for the product symbol, so
-% we just go with it an hope for the best!
-% \begin{macrocode}
-\keys_set:nn { siunitx }
- { product-symbol = \ifmmode \times \else \texttimes \fi }
-\AtBeginDocument
- {
- \group_begin:
- \tl_set:Nn \l_@@_tmpa_tl
- { { } { } { 2 } { } { } { } { 1 } }
- \tl_set:Nx \l_@@_tmpa_tl
- { \siunitx_number_output:N \l_@@_tmpa_tl }
- \tl_set:Nn \l_@@_tmpb_tl { 2 \times 10 ^ { 1 } }
- \tl_if_eq:NNTF \l_@@_tmpa_tl \l_@@_tmpb_tl
- {
- \group_end:
- \keys_set:nn { siunitx }
- {
- exponent-product =
- \ifmmode \times \else \texttimes \fi
- }
- }
- {
- \tl_set:Nn \l_@@_tmpb_tl { 2 \cdot 10 ^ { 1 } }
- \tl_if_eq:NNTF \l_@@_tmpa_tl \l_@@_tmpb_tl
- {
- \group_end:
- \keys_set:nn { siunitx }
- {
- exponent-product =
- \ifmmode \cdot \else \textperiodcentered \fi
- }
- }
- { \group_end: }
- }
- \group_begin:
- \keys_set:nn { siunitx } { forbid-literal-units = false }
- \tl_set:Nn \l_@@_tmpa_tl { \mathrm { m } \cdot \mathrm { s } }
- \tl_set:Nn \l_siunitx_unit_font_tl { \mathrm }
- \siunitx_unit_format:nN { m . s } \l_@@_tmpb_tl
- \tl_if_eq:NNTF \l_@@_tmpa_tl \l_@@_tmpb_tl
- {
- \group_end:
- \keys_set:nn { siunitx }
- {
- inter-unit-product =
- \ifmmode \cdot \else \textperiodcentered \fi
- }
- }
- { \group_end: }
- }
-% \end{macrocode}
-%
% \subsection{Bookmark definitions}
%
% Inside PDF strings we disable the text printing function. The definition of
diff --git a/macros/latex/contrib/siunitx/siunitx-unit.dtx b/macros/latex/contrib/siunitx/siunitx-unit.dtx
index f066530439..604883dfa6 100644
--- a/macros/latex/contrib/siunitx/siunitx-unit.dtx
+++ b/macros/latex/contrib/siunitx/siunitx-unit.dtx
@@ -1179,8 +1179,12 @@
% \begin{macro}{\@@_format_literal_auxi:w}
% \begin{macro}{\@@_format_literal_auxii:w}
% \begin{macro}{\@@_format_literal_auxiii:w}
-% \begin{macro}{\@@_format_literal_auxiv:w}
-% \begin{macro}{\@@_format_literal_auxv:w}
+% \begin{macro}{\@@_format_literal_auxiv:n}
+% \begin{macro}{\@@_format_literal_auxv:nw}
+% \begin{macro}{\@@_format_literal_auxvi:nN}
+% \begin{macro}{\@@_format_literal_super:nn, \@@_format_literal_sub:nn}
+% \begin{macro}{\@@_format_literal_add:n}
+% \begin{macro}{\@@_format_literal_auxvii:nn}
% \begin{variable}{\l_@@_separator_tl}
% To format literal units, there are two tasks to do. The input is
% \texttt{x}-type expanded to force any symbolic units to be converted into
@@ -1254,71 +1258,79 @@
\cs_new_protected:Npn \@@_format_literal_auxiii:w #1 /
{
\quark_if_recursion_tail_stop:n {#1}
- \@@_format_literal_auxiv:w #1 ^ ^ \q_stop
+ \@@_format_literal_auxiv:n {#1}
\tl_set:Nn \l_@@_separator_tl { / }
\@@_format_literal_auxiii:w
}
+\cs_new_protected:Npn \@@_format_literal_auxiv:n #1
+ {
+ \@@_format_literal_auxv:nw { }
+ #1 \q_recursion_tail \q_recursion_stop
+ }
% \end{macrocode}
-% Within each unit any sub- and superscript parts need to be separated out:
-% wrapping everything in the font command is incorrect. The superscript part
-% is relatively easy as there is no catcode issue or font command to add,
-% while the subscript part needs a bit more work. As the user might have the
-% two parts in either order, picking up the subscript needs to look in two
-% places. We assume that only one is given: odd input here is simply accepted.
+% To deal properly with literal formatting, we have to worry about super-
+% and subscript markers. That can be complicated as they could come anywhere
+% in the input: we handle that by iterating through the input and picking
+% them out. This avoids any issue with loosing braces for mid-input scripts.
+% We also have to deal with fractions, hence needing a series of nested
+% loops and a change of separator.
% \begin{macrocode}
-\use:x
+\cs_new_protected:Npn \@@_format_literal_auxv:nw
+ #1#2 \q_recursion_stop
+ {
+ \tl_if_head_is_N_type:nTF {#2}
+ { \@@_format_literal_auxvi:nN }
+ { \@@_format_literal_auxvii:nn }
+ {#1} #2 \q_recursion_stop
+ }
+\cs_new_protected:Npx \@@_format_literal_auxvi:nN #1#2
{
- \cs_new_protected:Npn \exp_not:N \@@_format_literal_auxiv:w
- ##1 ^ ##2 ^ ##3 \exp_not:N \q_stop
+ \exp_not:N \quark_if_recursion_tail_stop_do:Nn #2
+ { \exp_not:N \@@_format_literal_add:n {#1} }
+ \exp_not:N \token_if_eq_meaning:NNTF #2 ^
+ { \exp_not:N \@@_format_literal_super:nn {#1} }
{
- \exp_not:N \@@_format_literal_auxv:w
- ##1
- \c_@@_math_subscript_tl
- \c_@@_math_subscript_tl
- \exp_not:N \q_mark
- ##2
- \c_@@_math_subscript_tl
- \c_@@_math_subscript_tl
- \exp_not:N \q_stop
+ \exp_not:N \token_if_eq_meaning:NNTF
+ #2 \c_@@_math_subscript_tl
+ { \exp_not:N \@@_format_literal_sub:nn {#1} }
+ { \exp_not:N \@@_format_literal_auxvi:nN {#1#2} }
}
- \cs_new_protected:Npn \exp_not:N \@@_format_literal_auxv:w
- ##1 \c_@@_math_subscript_tl
- ##2 \c_@@_math_subscript_tl ##3
- \exp_not:N \q_mark
- ##4 \c_@@_math_subscript_tl
- ##5 \c_@@_math_subscript_tl ##6
- \exp_not:N \q_stop
+ }
+\cs_new_protected:Npn \@@_format_literal_super:nn #1#2
+ {
+ \quark_if_recursion_tail_stop:n {#2}
+ \@@_format_literal_add:n {#1}
+ \tl_put_right:Nn \l_@@_formatted_tl { ^ {#2} }
+ \@@_format_literal_auxvi:nN { }
+ }
+\cs_new_protected:Npx \@@_format_literal_sub:nn #1#2
+ {
+ \exp_not:N \quark_if_recursion_tail_stop:n {#2}
+ \exp_not:N \@@_format_literal_add:n {#1}
+ \tl_put_right:Nx \exp_not:N \l_@@_formatted_tl
{
- \tl_set:Nx \exp_not:N \l_@@_formatted_tl
+ \c_@@_math_subscript_tl
{
\exp_not:N \exp_not:V
- \exp_not:N \l_@@_formatted_tl
- \exp_not:N \tl_if_empty:NF
- \exp_not:N \l_@@_formatted_tl
- {
- \exp_not:N \exp_not:V
- \exp_not:N \l_@@_separator_tl
- }
- \exp_not:N \tl_if_blank:nF {##1}
- {
- \exp_not:N \exp_not:V
- \exp_not:N \l_siunitx_unit_font_tl
- { \exp_not:N \exp_not:n {##1} }
- }
- \exp_not:N \tl_if_blank:nF {##4}
- { ^ { \exp_not:N \exp_not:n {##4} } }
- \exp_not:N \tl_if_blank:nF {##2##5}
- {
- \c_@@_math_subscript_tl
- {
- \exp_not:N \exp_not:V
- \exp_not:N \l_siunitx_unit_font_tl
- { \exp_not:N \exp_not:n {##2##5} }
- }
- }
+ \exp_not:N \l_siunitx_unit_font_tl
+ { \exp_not:N \exp_not:n {#2} }
}
}
+ \exp_not:N \@@_format_literal_auxvi:nN { }
}
+\cs_new_protected:Npn \@@_format_literal_add:n #1
+ {
+ \tl_put_right:Nx \l_@@_formatted_tl
+ {
+ \tl_if_empty:NF \l_@@_formatted_tl
+ { \exp_not:V \l_@@_separator_tl }
+ \tl_if_empty:nF {#1}
+ { \exp_not:V \l_siunitx_unit_font_tl { \exp_not:n {#1} } }
+ }
+ \tl_clear:N \l_@@_separator_tl
+ }
+\cs_new_protected:Npn \@@_format_literal_auxvii:nn #1#2
+ { \@@_format_literal_auxvi:nN { #1 {#2} } }
\tl_new:N \l_@@_separator_tl
% \end{macrocode}
% \end{variable}
@@ -1329,6 +1341,10 @@
% \end{macro}
% \end{macro}
% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
%
% \subsection{(PDF) String creation}
%
diff --git a/macros/latex/contrib/siunitx/siunitx.dtx b/macros/latex/contrib/siunitx/siunitx.dtx
index 5c86624afb..e553abc6b0 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} {2021-05-25} {3.0.6}
+\ProvidesExplPackage {siunitx} {2021-05-28} {3.0.7}
{A comprehensive (SI) units package}
% \end{macrocode}
%
diff --git a/macros/latex/contrib/siunitx/siunitx.pdf b/macros/latex/contrib/siunitx/siunitx.pdf
index a13fa3ea8b..5e0b6c269d 100644
--- a/macros/latex/contrib/siunitx/siunitx.pdf
+++ b/macros/latex/contrib/siunitx/siunitx.pdf
Binary files differ
diff --git a/macros/latex/contrib/siunitx/siunitx.tex b/macros/latex/contrib/siunitx/siunitx.tex
index a45c979be1..3cb5f25ed5 100644
--- a/macros/latex/contrib/siunitx/siunitx.tex
+++ b/macros/latex/contrib/siunitx/siunitx.tex
@@ -484,7 +484,7 @@ Runs of products of of numbers with units can be handled using the
\cs{qtyrange}\oarg{options}\marg{number1}\marg{number2}\marg{unit}
\end{syntax}
\end{function}
-Products of numbers with units can be handled using the \cs{qtyrange}
+Ranges of numbers with units can be handled using the \cs{qtyrange}
function. The behaviour of this function is similar to \cs{numrange}, but
with the addition of a unit to each number.
\begin{LaTeXdemo}
@@ -493,7 +493,7 @@ with the addition of a unit to each number.
The input of lists, products and ranges of quantities using a single command
allows them to be adjusted together. These commands are intended to allow
-consistent formatting of related values: as such, they apply a a single
+consistent formatting of related values: as such, they apply a single
unit to all of the values. This is particularly notable when using
adjustment of the numerical values.
@@ -1580,6 +1580,7 @@ conveys. The options are summarised in Table~\ref{tab:opt:num:out}.
negative-color & Literal & \meta{none} \\ ^^A (
output-close-uncertainty & Literal & ) \\
output-decimal-marker & Literal & . \\
+ output-exponent-marker & Literal & \meta{none} \\
output-open-uncertainty & Literal & ( \\ ^^A )
print-implicit-plus & Switch & false \\
print-unity-mantissa & Switch & true \\
@@ -1648,6 +1649,13 @@ When exponents are present in the input, the \opt{exponent-base} and
\num[exponent-product = \cdot]{1e2} \\
\num[exponent-base = 2]{1e2}
\end{LaTeXdemo}
+\DescribeOption{output-exponent-marker}
+Alternatively, if the \opt{output-exponent-marker} option is set then the value
+stored will be used in place of the normal product and base combination.
+\begin{LaTeXdemo}
+ \num[output-exponent-marker = e]{1e2} \\
+ \num[output-exponent-marker = \mathrm{E}]{1e2}
+\end{LaTeXdemo}
\DescribeOption{uncertainty-separator}
\DescribeOption{output-open-uncertainty}