From 43f5ef960aa5e3a6ed8845d7577deab29d0baff4 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 31 May 2021 20:24:44 +0000 Subject: siunitx (31may21) git-svn-id: svn://tug.org/texlive/trunk@59410 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/siunitx/CHANGELOG.md | 15 ++- .../texmf-dist/doc/latex/siunitx/siunitx-code.pdf | Bin 1442135 -> 1447215 bytes Master/texmf-dist/doc/latex/siunitx/siunitx.pdf | Bin 598863 -> 603229 bytes .../source/latex/siunitx/siunitx-emulation.dtx | 85 +++++++++++++---- .../source/latex/siunitx/siunitx-number.dtx | 18 ++-- Master/texmf-dist/source/latex/siunitx/siunitx.dtx | 2 +- Master/texmf-dist/source/latex/siunitx/siunitx.tex | 82 ++++++++++++++-- Master/texmf-dist/tex/latex/siunitx/siunitx.sty | 103 +++++++++++++++------ 8 files changed, 240 insertions(+), 65 deletions(-) (limited to 'Master') diff --git a/Master/texmf-dist/doc/latex/siunitx/CHANGELOG.md b/Master/texmf-dist/doc/latex/siunitx/CHANGELOG.md index f91a3e17e46..2e71ec3ecad 100644 --- a/Master/texmf-dist/doc/latex/siunitx/CHANGELOG.md +++ b/Master/texmf-dist/doc/latex/siunitx/CHANGELOG.md @@ -7,6 +7,18 @@ Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to ## [Unreleased] +## [v3.0.8] + +### Changed +- Documentation improvements +- Add `\barn`, `\knot`, `\mmHg`, `\nauticalmile` to list of + deprecated units +- Provide a fallback route for deprecated units + +### Fixed +- Correct printing of `10^{0}` (issue #459) +- Emulation of `group-four-digits` (issue #461) + ## [v3.0.7] ### Fixed @@ -1322,7 +1334,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.7...HEAD +[Unreleased]: https://github.com/josephwright/siunitx/compare/v3.0.8...HEAD +[v3.0.8]: https://github.com/josephwright/siunitx/compare/v3.0.7...v3.0.8 [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 diff --git a/Master/texmf-dist/doc/latex/siunitx/siunitx-code.pdf b/Master/texmf-dist/doc/latex/siunitx/siunitx-code.pdf index 09c3c9538d6..6ba4bd131f0 100644 Binary files a/Master/texmf-dist/doc/latex/siunitx/siunitx-code.pdf and b/Master/texmf-dist/doc/latex/siunitx/siunitx-code.pdf differ diff --git a/Master/texmf-dist/doc/latex/siunitx/siunitx.pdf b/Master/texmf-dist/doc/latex/siunitx/siunitx.pdf index 5e0b6c269da..4388753d2f6 100644 Binary files a/Master/texmf-dist/doc/latex/siunitx/siunitx.pdf and b/Master/texmf-dist/doc/latex/siunitx/siunitx.pdf differ diff --git a/Master/texmf-dist/source/latex/siunitx/siunitx-emulation.dtx b/Master/texmf-dist/source/latex/siunitx/siunitx-emulation.dtx index dc2e9f90350..0878c37d74e 100644 --- a/Master/texmf-dist/source/latex/siunitx/siunitx-emulation.dtx +++ b/Master/texmf-dist/source/latex/siunitx/siunitx-emulation.dtx @@ -446,6 +446,20 @@ } { \@@_option_removed:V \l_keys_key_tl } } , + group-four-digits .choice: , + group-four-digits / false .code:n = + { + \@@_option_deprecated:nn + { group-four-digits~=~false } + { group-minimum-digits~=~5 } + } , + group-four-digits / true .code:n = + { + \@@_option_deprecated:nn + { group-four-digits~=~false } + { group-minimum-digits~=~4 } + } , + bracket-numbers .default:n = true , omit-uncertainty .code:n = { \@@_option_deprecated:nnV @@ -996,30 +1010,69 @@ % \end{macrocode} % \end{macro} % -% Units that have been removed. +% Units that have been removed: to avoid issues, we mark them as deprecated. % \begin{macrocode} -\msg_new:nnnn { siunitx } { unit-removed } - { Unit~macro~#1~has~been~removed~in~this~release. } +\msg_new:nnnn { siunitx } { unit-deprecated } + { Unit~macro~#1~has~been~deprecated~in~this~release. } { The~BIPM~have~removed~this~unit~from~the~SI~Brochure.~ - You~will~need~to~define~it~yourself~using~\token_to_str:N \DeclareSIUnit. + You~should~define~it~yourself~using~\token_to_str:N \DeclareSIUnit + in~your~source. } -\clist_map_inline:nn +\cs_gset_protected:Npn \@@_tmp:w #1#2 { - \angstrom , - \atomicmassunit , - \bar , - \bohr , - \clight , - \electronmass , - \elementarycharge , - \hartree , - \planckbar + \quark_if_recursion_tail_stop:N #1 + \bool_new:c { g_@@_unit_warning_ \token_to_str:N #1 _bool } + \siunitx_declare_unit:Nx #1 + { + \exp_not:N \bool_if:NF + \exp_not:c { g_@@_unit_warning_ \token_to_str:N #1 _bool } + { + \exp_not:N \bool_gset_true:N + \exp_not:c { g_@@_unit_warning_ \token_to_str:N #1 _bool } + \msg_warning:nnn { siunitx } { unit-deprecated } + { \token_to_str:N #1 } + } + #2 + } + \@@_tmp:w } +\@@_tmp:w + \atomicmassunit { u } + \bar { bar } + \barn { b } + \bohr + { \text { \ensuremath { a } } \char_generate:nn { `\_ } { 8 } { 0 } } + \clight + { \text { \ensuremath { c } } \char_generate:nn { `\_ } { 8 } { 0 } } + \electronmass + { + \text { \ensuremath { m } } + \char_generate:nn { `\_ } { 8 } { \exp_not:N \mathrm { e } } + } + \elementarycharge { \text { \ensuremath { e } } } + \hartree + { + \text { \ensuremath { E } } + \char_generate:nn { `\_ } { 8 } { \exp_not:N \mathrm { h } } + } + \knot { kn } + \mmHg { mmHg } + \nauticalmile { M } + \planckbar + { \text { \ensuremath { \exp_not:N \hbar } } } + \q_recursion_tail { } + \q_recursion_stop +\@ifpackageloaded { fontspec } { - \siunitx_declare_unit:Nx #1 - { \msg_error:nnn { siunitx } { unit-removed } { \token_to_str:N #1 } } + \@@_tmp:w \angstrom { \@@_non_latin:n { "00C5 } } + } + { + \@@_tmp:w \angstrom + { \exp_not:N \text { \@@_non_latin:n { "00C5 } } } } + \q_recursion_tail { } + \q_recursion_stop % \end{macrocode} % % \begin{macrocode} diff --git a/Master/texmf-dist/source/latex/siunitx/siunitx-number.dtx b/Master/texmf-dist/source/latex/siunitx/siunitx-number.dtx index cfbff37d9c9..070b9c5e9d5 100644 --- a/Master/texmf-dist/source/latex/siunitx/siunitx-number.dtx +++ b/Master/texmf-dist/source/latex/siunitx/siunitx-number.dtx @@ -3127,13 +3127,9 @@ % \begin{macrocode} \cs_new:Npn \@@_output_integer:nnn #1#2#3 { - \bool_lazy_all:nF - { - { \str_if_eq_p:nn {#1} { 1 } } - { \tl_if_blank_p:n {#2} } - { ! \str_if_eq_p:nn {#3} { 0 } } - { ! \l_@@_unity_mantissa_bool } - } + \bool_lazy_or:nnT + { \l_@@_unity_mantissa_bool } + { ! \str_if_eq_p:nn { #1 . #2 } { 1. } } { \@@_output_digits:nn { integer } {#1} } } \cs_new:Npn \@@_output_decimal:nn #1#2 @@ -3389,10 +3385,9 @@ } \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_lazy_or:nnTF + { \l_@@_unity_mantissa_bool } + { ! \str_if_eq_p:nn {#3} { 1. } } { \bool_if:NTF \l_@@_tight_bool { \exp_not:N \mathord } @@ -3400,6 +3395,7 @@ { \exp_not:V \l_@@_exponent_product_tl } \exp_not:n {#4} } + { \exp_not:n {#4} } \exp_not:V \l_@@_exponent_base_tl ^ { \@@_output_exponent_auxiii:nn {#1} {#2} } diff --git a/Master/texmf-dist/source/latex/siunitx/siunitx.dtx b/Master/texmf-dist/source/latex/siunitx/siunitx.dtx index e553abc6b08..33b6776591d 100644 --- a/Master/texmf-dist/source/latex/siunitx/siunitx.dtx +++ b/Master/texmf-dist/source/latex/siunitx/siunitx.dtx @@ -121,7 +121,7 @@ % % Identify the package and give the over all version information. % \begin{macrocode} -\ProvidesExplPackage {siunitx} {2021-05-28} {3.0.7} +\ProvidesExplPackage {siunitx} {2021-05-31} {3.0.8} {A comprehensive (SI) units package} % \end{macrocode} % diff --git a/Master/texmf-dist/source/latex/siunitx/siunitx.tex b/Master/texmf-dist/source/latex/siunitx/siunitx.tex index 3cb5f25ed55..76afc348615 100644 --- a/Master/texmf-dist/source/latex/siunitx/siunitx.tex +++ b/Master/texmf-dist/source/latex/siunitx/siunitx.tex @@ -1593,7 +1593,6 @@ conveys. The options are summarised in Table~\ref{tab:opt:num:out}. \end{table} \DescribeOption{group-digits} -\DescribeOption{group-four-digits} \DescribeOption{group-separator} Grouping digits into blocks of three is a common method to increase the ease of reading of numbers. The \opt{group-digits} choice controls whether this @@ -2849,19 +2848,14 @@ letters may be used: these must be single tokens. For example, provided the \pkg{numprint} package has not been loaded, the letter |n| could be used as this would suggest a numerical column. -\section{Upgrading from version~\texorpdfstring{$2$}{2}} +\section{Upgrading from version~\texorpdfstring{$2$}{2}% + \label{sec:upgrading}} The package has been largely re-written internally between versions $2$ and $3$. A significant number of key--value settings have new, more descriptive, names. Where possible, older names are mapped to newer ones internally: you will be warned in the log if this is the case. -Updating to the latest edition of the \acro{SI} Brochure means that a small -number of unit macros have been removed: of those accepted for use, -\cs{angstrom} is no longer present, whilst the units determined experimentally -are all no longer listed (\cs{atomicmassunit}, \cs{bohr}, \cs{clight}, -\cs{electronmass}, \cs{elementarycharge}, \cs{hartree}, \cs{planckbar}). - It is possible to use the \LaTeXe{} kernel mechanism to load the last version~$2$ release for documents that cannot be successfully processed using version~$3$. This can be achieved using @@ -2936,6 +2930,54 @@ or If you are using \opt{table-column-width} to have fixed-width columns, you also now need \opt{table-fixed-width} to set this option active. +Direct support for loading a local configuration file, \texttt{siunitx.cfg}, +has been removed. However, the approach described in +Section~\ref{sec:hint:config} may be used to achieve the same effect with the +additions more clearly shown in document sources. + +\section{Unit changes made by \acro{BIPM}% + \label{sec:BIPM8}} + +In addition to the changes in the \pkg{siunitx} package described in +Section~\ref{sec:upgrading}, there are changes in the units defined by the +\acro{BIPM} in the 9th Edition of the \acro{SI} Brochure which are reflected +here. There are two major areas of change. + +The first is in respect of units accepted for use with \acro{SI} units. In the +8th Edition of the \acro{SI} Brochure, the following units were listed as +accepted for use in specialist fields +\begin{itemize} + \item ångström (\cs{angstrom}) + \item bar (\cs{bar}) + \item barn (\cs{barn}) + \item knot (\cs{knot}) + \item millimetre of mercury (\cs{mmHg}) + \item nautical mile (\cs{nauticalmile}) +\end{itemize} +These are no longer listed in the 9th Edition, and so are deprecated as +pre-defined units by \pkg{siunitx}. These units will issue a warning on first +use, and users should add their own definitions to the start of their sources +to avoid this. + +Secondly, the move to a new definition of base units means that the table of +units determined experimentally has been removed from the \acro{SI} Brochure. +This covers the following units defined by \pkg{siunitx} in previous releases +\begin{itemize} + \item \cs{bohr} + \item \cs{clight} + \item \cs{electronmass} + \item \cs{elementarycharge} + \item \cs{hartree} + \item \cs{planckbar} +\end{itemize} +These are also deprecated in \pkg{siunitx} and users should provide their own +definitions. + +In addition to these two major blocks, the unit \cs{atomicmassunit} has similar +deprecated status: this was listed as with experimentally-determined units in +the 8th Edition of the \acro{SI} Brochure but is equivalent to the dalton, a +unit which remains accepted. + \section{Localisation} The \pkg{translations} package provides a structured framework for localisation @@ -3346,7 +3388,7 @@ output mode is known. It may be necessary to make some tokens robust using \qty{0,4066\dots}{\metre\squared} \end{LaTeXdemo} -\subsection{Demonstrating prefixes +\subsection{Demonstrating prefixes% \label{sec:hint:prefixes}} As \pkg{siunitx} contains data about the numerical values of unit prefixes, @@ -3372,6 +3414,28 @@ This may be conveniently wrapped up inside a document command, for example } \end{LaTeXdemo} +\subsection{Creating a set of pre-defined units% + \label{sec:hint:config}} + +There are many units which sit outside of those defined in the (current) +\acro{SI} Brochure which are of use to many people. Most obvious are those +which have been detailed in previous editions of the Brochure, as described +in Section~\ref{sec:BIPM8}, but there are many others. + +It is often convenient to have a pre-defined set of useful units available +without needing to copy the full set of definitions into each source file. At +the same time, it is important that such sources do show that they are using +units not defined by the core part of \pkg{siunitx}. The most straight-forward +way to acheive this is to create a separate file, for example +\texttt{siunitx-local-units.tex}, and place it in your local \TeX{} tree +(usually \verb|~/texmf/tex/latex/| on Linux, \verb|~/Library/texmf/tex/latex/| +on macOS or \verb|C:\Users\\texmf\tex\latex| on Windows). This can then +be loaded in the preamble using +\begin{LaTeXdemo}[code only] + % Load useful 'local' units + \input{siunitx-local-units} +\end{LaTeXdemo} + \section{Using (\acro{SI}) units} Consistent and logical units are a necessity for scientific work, and have diff --git a/Master/texmf-dist/tex/latex/siunitx/siunitx.sty b/Master/texmf-dist/tex/latex/siunitx/siunitx.sty index 7c0d3387b3a..1e3411436d2 100644 --- a/Master/texmf-dist/tex/latex/siunitx/siunitx.sty +++ b/Master/texmf-dist/tex/latex/siunitx/siunitx.sty @@ -42,7 +42,7 @@ }% \endinput }% -\ProvidesExplPackage {siunitx} {2021-05-28} {3.0.7} +\ProvidesExplPackage {siunitx} {2021-05-31} {3.0.8} {A comprehensive (SI) units package} \msg_new:nnnn { siunitx } { incompatible-package } { Package~'#1'~incompatible. } @@ -3112,13 +3112,9 @@ } \cs_new:Npn \__siunitx_number_output_integer:nnn #1#2#3 { - \bool_lazy_all:nF - { - { \str_if_eq_p:nn {#1} { 1 } } - { \tl_if_blank_p:n {#2} } - { ! \str_if_eq_p:nn {#3} { 0 } } - { ! \l__siunitx_number_unity_mantissa_bool } - } + \bool_lazy_or:nnT + { \l__siunitx_number_unity_mantissa_bool } + { ! \str_if_eq_p:nn { #1 . #2 } { 1. } } { \__siunitx_number_output_digits:nn { integer } {#1} } } \cs_new:Npn \__siunitx_number_output_decimal:nn #1#2 @@ -3334,10 +3330,9 @@ } \cs_new:Npn \__siunitx_number_output_exponent_auxi:nnnn #1#2#3#4 { - \bool_lazy_and:nnTF - { \str_if_eq_p:nn {#3} { 1. } } - { ! \l__siunitx_number_unity_mantissa_bool } - { \exp_not:n {#4} } + \bool_lazy_or:nnTF + { \l__siunitx_number_unity_mantissa_bool } + { ! \str_if_eq_p:nn {#3} { 1. } } { \bool_if:NTF \l__siunitx_number_tight_bool { \exp_not:N \mathord } @@ -3345,6 +3340,7 @@ { \exp_not:V \l__siunitx_number_exponent_product_tl } \exp_not:n {#4} } + { \exp_not:n {#4} } \exp_not:V \l__siunitx_number_exponent_base_tl ^ { \__siunitx_number_output_exponent_auxiii:nn {#1} {#2} } @@ -6663,6 +6659,20 @@ } { \__siunitx_option_removed:V \l_keys_key_tl } } , + group-four-digits .choice: , + group-four-digits / false .code:n = + { + \__siunitx_option_deprecated:nn + { group-four-digits~=~false } + { group-minimum-digits~=~5 } + } , + group-four-digits / true .code:n = + { + \__siunitx_option_deprecated:nn + { group-four-digits~=~false } + { group-minimum-digits~=~4 } + } , + bracket-numbers .default:n = true , omit-uncertainty .code:n = { \__siunitx_option_deprecated:nnV @@ -7107,28 +7117,67 @@ } } \siunitx_declare_unit:Nn \celsius { \degreeCelsius } -\msg_new:nnnn { siunitx } { unit-removed } - { Unit~macro~#1~has~been~removed~in~this~release. } +\msg_new:nnnn { siunitx } { unit-deprecated } + { Unit~macro~#1~has~been~deprecated~in~this~release. } { The~BIPM~have~removed~this~unit~from~the~SI~Brochure.~ - You~will~need~to~define~it~yourself~using~\token_to_str:N \DeclareSIUnit. + You~should~define~it~yourself~using~\token_to_str:N \DeclareSIUnit + in~your~source. } -\clist_map_inline:nn +\cs_gset_protected:Npn \__siunitx_emulation_tmp:w #1#2 { - \angstrom , - \atomicmassunit , - \bar , - \bohr , - \clight , - \electronmass , - \elementarycharge , - \hartree , - \planckbar + \quark_if_recursion_tail_stop:N #1 + \bool_new:c { g__siunitx_emulation_unit_warning_ \token_to_str:N #1 _bool } + \siunitx_declare_unit:Nx #1 + { + \exp_not:N \bool_if:NF + \exp_not:c { g__siunitx_emulation_unit_warning_ \token_to_str:N #1 _bool } + { + \exp_not:N \bool_gset_true:N + \exp_not:c { g__siunitx_emulation_unit_warning_ \token_to_str:N #1 _bool } + \msg_warning:nnn { siunitx } { unit-deprecated } + { \token_to_str:N #1 } + } + #2 + } + \__siunitx_emulation_tmp:w + } +\__siunitx_emulation_tmp:w + \atomicmassunit { u } + \bar { bar } + \barn { b } + \bohr + { \text { \ensuremath { a } } \char_generate:nn { `\_ } { 8 } { 0 } } + \clight + { \text { \ensuremath { c } } \char_generate:nn { `\_ } { 8 } { 0 } } + \electronmass + { + \text { \ensuremath { m } } + \char_generate:nn { `\_ } { 8 } { \exp_not:N \mathrm { e } } + } + \elementarycharge { \text { \ensuremath { e } } } + \hartree + { + \text { \ensuremath { E } } + \char_generate:nn { `\_ } { 8 } { \exp_not:N \mathrm { h } } + } + \knot { kn } + \mmHg { mmHg } + \nauticalmile { M } + \planckbar + { \text { \ensuremath { \exp_not:N \hbar } } } + \q_recursion_tail { } + \q_recursion_stop +\@ifpackageloaded { fontspec } + { + \__siunitx_emulation_tmp:w \angstrom { \__siunitx_emulation_non_latin:n { "00C5 } } } { - \siunitx_declare_unit:Nx #1 - { \msg_error:nnn { siunitx } { unit-removed } { \token_to_str:N #1 } } + \__siunitx_emulation_tmp:w \angstrom + { \exp_not:N \text { \__siunitx_emulation_non_latin:n { "00C5 } } } } + \q_recursion_tail { } + \q_recursion_stop \IfFormatAtLeastTF { 2020-10-01 } { } { \RequirePackage { xparse } } -- cgit v1.2.3