diff options
author | Karl Berry <karl@freefriends.org> | 2021-05-31 20:24:44 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2021-05-31 20:24:44 +0000 |
commit | 43f5ef960aa5e3a6ed8845d7577deab29d0baff4 (patch) | |
tree | b731db3e3c4ba2ecf34c2df5d1a4c2e6733cb850 /Master/texmf-dist/source/latex | |
parent | b48bb6a909ebbc5a1af3a01a6fb187e8770e799c (diff) |
siunitx (31may21)
git-svn-id: svn://tug.org/texlive/trunk@59410 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex')
4 files changed, 150 insertions, 37 deletions
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\<name>\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 |