Skip to content

Commit

Permalink
Deprecate "input-uncertainty-signs"
Browse files Browse the repository at this point in the history
Replacement is "input-symmetrical-uncertainty-signs". This will be needed to address #675.
  • Loading branch information
josephwright committed Jul 26, 2023
1 parent 1c99694 commit eff12a0
Show file tree
Hide file tree
Showing 5 changed files with 142 additions and 85 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Expand Up @@ -18,12 +18,16 @@ Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to
[\#664](https://github.com/josephwright/siunitx/issues/664))
- Option `uncertainty-round-direction` (see issue
[\#628](https://github.com/josephwright/siunitx/issues/628))
- Option `input-symmetrical-uncertainty-signs`

### Changed
- Support bracing of decimal marker in tables as an alternative
to `\mathord` (see issue
[\#527](https://github.com/josephwright/siunitx/issues/527))

### Deprecated
- Option `input-uncertainty-signs`

## [v3.2.9] - 2023-07-26

### Fixed
Expand Down
140 changes: 78 additions & 62 deletions siunitx-number.dtx
Expand Up @@ -405,9 +405,9 @@
% \end{syntax}
% \end{function}
%
% \begin{function}{input-uncertainty-signs}
% \begin{function}{input-symmetrical-uncertainty-signs}
% \begin{syntax}
% |input-uncertainty-signs| = \meta{tokens}
% |input-symmetrical-uncertainty-signs| = \meta{tokens}
% \end{syntax}
% \end{function}
%
Expand Down Expand Up @@ -859,7 +859,7 @@
\l_@@_input_uncert_open_tl ,
input-signs .tl_set:N =
\l_siunitx_number_input_sign_tl ,
input-uncertainty-signs .code:n =
input-symmetrical-uncertainty-signs .code:n =
{
\tl_set:Nn \l_@@_input_uncert_sign_tl {#1}
\tl_map_inline:nn {#1}
Expand Down Expand Up @@ -4642,6 +4642,22 @@
}
% \end{macrocode}
%
% \subsection{Deprecated options}
%
% \begin{macrocode}
\keys_define:nn { siunitx }
{
input-uncertainty-signs .code:n =
{
\msg_info:nnnn { siunitx } { option-deprecated }
{ input-symmetrical-uncertainty-signs }
{ input-uncertainty-signs }
\keys_set:nn { siunitx }
{ input-symmetrical-uncertainty-signs = {#1} }
}
}
% \end{macrocode}
%
% \subsection{Standard settings for module options}
%
% Some of these follow naturally from the point of definition
Expand All @@ -4650,65 +4666,65 @@
% \begin{macrocode}
\keys_set:nn { siunitx }
{
bracket-ambiguous-numbers = true ,
bracket-negative-numbers = false ,
drop-exponent = false ,
drop-uncertainty = false ,
drop-zero-decimal = false ,
evaluate-expression = false ,
exponent-base = 10 ,
exponent-mode = input ,
exponent-product = \times ,
expression = #1 ,
fixed-exponent = 0 ,
digit-group-size = 3 ,
digit-group-first-size = 3 ,
digit-group-other-size = 3 ,
group-digits = all ,
group-minimum-digits = 5 ,
group-separator = \, , % (
input-close-uncertainty = ) ,
input-comparators = { <=>\approx\ge\geq\gg\le\leq\ll\sim } ,
input-decimal-markers = { ., } ,
input-digits = 0123456789 ,
input-exponent-markers = dDeE ,
input-ignore = \, ,
input-open-uncertainty = ( , % )
input-signs = +-\mp\pm ,
input-uncertainty-signs = \pm ,
minimum-decimal-digits = 0 ,
minimum-integer-digits = 0 ,
negative-color = , % (
output-close-uncertainty = ) ,
output-decimal-marker = . ,
output-open-uncertainty = ( , % )
parse-numbers = true ,
print-exponent-implicit-plus = false ,
print-implicit-plus = false ,
print-mantissa-implicit-plus = false ,
print-unity-mantissa = true ,
print-zero-exponent = false ,
print-zero-integer = true ,
retain-explicit-decimal-marker = false ,
retain-explicit-plus = false ,
retain-negative-zero = false ,
retain-zero-uncertainty = false ,
round-direction = nearest ,
round-half = up ,
round-minimum = 0 ,
round-mode = none ,
round-pad = true ,
round-precision = 2 ,
round-zero-positive = true ,
tight-spacing = false ,
uncertainty-descriptor-mode = bracket-separator ,
uncertainty-descriptor-separator = \ ,
uncertainty-descriptors = ,
uncertainty-mode = compact ,
uncertainty-round-direction = nearest ,
uncertainty-separator = ,
zero-decimal-as-symbol = false ,
zero-symbol = \mbox { --- }
bracket-ambiguous-numbers = true ,
bracket-negative-numbers = false ,
drop-exponent = false ,
drop-uncertainty = false ,
drop-zero-decimal = false ,
evaluate-expression = false ,
exponent-base = 10 ,
exponent-mode = input ,
exponent-product = \times ,
expression = #1 ,
fixed-exponent = 0 ,
digit-group-size = 3 ,
digit-group-first-size = 3 ,
digit-group-other-size = 3 ,
group-digits = all ,
group-minimum-digits = 5 ,
group-separator = \, , % (
input-close-uncertainty = ) ,
input-comparators = { <=>\approx\ge\geq\gg\le\leq\ll\sim } ,
input-decimal-markers = { ., } ,
input-digits = 0123456789 ,
input-exponent-markers = dDeE ,
input-ignore = \, ,
input-open-uncertainty = ( , % )
input-signs = +-\mp\pm ,
input-symmetrical-uncertainty-signs = \pm ,
minimum-decimal-digits = 0 ,
minimum-integer-digits = 0 ,
negative-color = , % (
output-close-uncertainty = ) ,
output-decimal-marker = . ,
output-open-uncertainty = ( , % )
parse-numbers = true ,
print-exponent-implicit-plus = false ,
print-implicit-plus = false ,
print-mantissa-implicit-plus = false ,
print-unity-mantissa = true ,
print-zero-exponent = false ,
print-zero-integer = true ,
retain-explicit-decimal-marker = false ,
retain-explicit-plus = false ,
retain-negative-zero = false ,
retain-zero-uncertainty = false ,
round-direction = nearest ,
round-half = up ,
round-minimum = 0 ,
round-mode = none ,
round-pad = true ,
round-precision = 2 ,
round-zero-positive = true ,
tight-spacing = false ,
uncertainty-descriptor-mode = bracket-separator ,
uncertainty-descriptor-separator = \ ,
uncertainty-descriptors = ,
uncertainty-mode = compact ,
uncertainty-round-direction = nearest ,
uncertainty-separator = ,
zero-decimal-as-symbol = false ,
zero-symbol = \mbox { --- }
}
% \end{macrocode}
% One awkward setting.
Expand Down
40 changes: 20 additions & 20 deletions siunitx.tex
Expand Up @@ -1299,24 +1299,24 @@ \subsection{Parsing numbers}
Type &
\multicolumn{1}{l@{}}{Default} \\
\midrule
evaluate-expression & Switch & false \\
expression & Literal & |#1| \\^^A (
input-close-uncertainty & Literal & ) \\
input-comparators & Literal &
evaluate-expression & Switch & false \\
expression & Literal & |#1| \\^^A (
input-close-uncertainty & Literal & ) \\
input-comparators & Literal &
<=>\cs{approx}\cs{ge}\cs{geq} \\
& & \cs{gg}\cs{le}\cs{leq}\cs{ll} \cs{sim} \\
input-decimal-markers & Literal & ., \\
input-digits & Literal & 0123456789 \\
input-exponent-markers & Literal & dDeE \\
input-ignore & Literal & \meta{none} \\
input-open-uncertainty & Literal & ( \\ ^^A )
input-signs & Literal & +-\cs{pm}\cs{mp} \\
input-uncertainty-signs & Literal & \cs{pm} \\
parse-numbers & Switch & true \\
retain-explicit-decimal-marker & Switch & false \\
retain-explicit-plus & Switch & false \\
retain-negative-zero & Switch & false \\
retain-zero-uncertainty & Switch & false \\
input-decimal-markers & Literal & ., \\
input-digits & Literal & 0123456789 \\
input-exponent-markers & Literal & dDeE \\
input-ignore & Literal & \meta{none} \\
input-open-uncertainty & Literal & ( \\ ^^A )
input-signs & Literal & +-\cs{pm}\cs{mp} \\
input-symmetrical-uncertainty-signs & Literal & \cs{pm} \\
parse-numbers & Switch & true \\
retain-explicit-decimal-marker & Switch & false \\
retain-explicit-plus & Switch & false \\
retain-negative-zero & Switch & false \\
retain-zero-uncertainty & Switch & false \\
\bottomrule
\end{tabular}
\end{table}
Expand Down Expand Up @@ -1349,15 +1349,15 @@ \subsection{Parsing numbers}

\DescribeOption{input-open-uncertainty}
\DescribeOption{input-close-uncertainty}
\DescribeOption{input-uncertainty-signs}
\DescribeOption{input-symmetrical-uncertainty-signs}
In some fields, it is common to give the uncertainty in a number in brackets
after the main part of the number, for example \enquote{\num{1.234(5)}}. The
opening and closing symbols used for this type of input are set as
\opt{input-open-uncertainty} and \opt{input-close-uncertainty}. Alternatively,
the uncertainty may be given as a separate part following a sign. Which signs
are valid for this operation is determined by the \opt{input-uncertainty-signs}
option. As with other signs, the combination |+-| will automatically be
converted to |\pm| internally.
are valid for this operation is determined by the
\opt{input-symmetrical-uncertainty-signs} option. As with other signs, the
combination |+-| will automatically be converted to |\pm| internally.
\begin{LaTeXdemo}
\num{9.99(9)} \\
\num{9.99 +- 0.09} \\
Expand Down
15 changes: 13 additions & 2 deletions testfiles/siunitx-number.lvt
Expand Up @@ -537,11 +537,11 @@
\test:n { +1234 }
}

\TEST { Option~setting~"input-uncertainty-signs" }
\TEST { Option~setting~"input-symmetrical-uncertainty-signs" }
{
\test:n { 12.34 }
\test:n { 12.34 \pm 5 }
\keys_set:nn { siunitx } { input-uncertainty-signs = }
\keys_set:nn { siunitx } { input-symmetrical-uncertainty-signs = }
\test:n { 12.34 }
\test:n { 12.34 \pm 5 }
}
Expand Down Expand Up @@ -1181,4 +1181,15 @@
\siunitx_if_number_token:NTF H { \ERROR } { \FALSE } \NEWLINE
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\TEST { Deprecated~option~setting~"input-uncertainty-signs" }
{
\test:n { 12.34 }
\test:n { 12.34 \pm 5 }
\keys_set:nn { siunitx } { input-uncertainty-signs = }
\test:n { 12.34 }
\test:n { 12.34 \pm 5 }
}

\END
28 changes: 27 additions & 1 deletion testfiles/siunitx-number.tlg
Expand Up @@ -1355,7 +1355,7 @@ in module documentation.
l. ... }
============================================================
============================================================
TEST 38: Option setting "input-uncertainty-signs"
TEST 38: Option setting "input-symmetrical-uncertainty-signs"
============================================================
> \l_tmpa_tl=12.34.
<recently read> }
Expand Down Expand Up @@ -2746,3 +2746,29 @@ TRUE
TRUE
FALSE
============================================================
============================================================
TEST 82: Deprecated option setting "input-uncertainty-signs"
============================================================
> \l_tmpa_tl=12.34.
<recently read> }
l. ... }
> \l_tmpa_tl=12.34(500).
<recently read> }
l. ... }
Package siunitx Info: Option "input-symmetrical-uncertainty-signs" has been
(siunitx) deprecated in this release.
(siunitx)
(siunitx) Use "input-uncertainty-signs" as a replacement.
> \l_tmpa_tl=12.34.
<recently read> }
l. ... }
! Package siunitx Error: Invalid number '12.34\pm 5'.
For immediate help type H <return>.
...
l. ... }
The input '12.34\pm 5' could not be parsed as a number following the format
defined in module documentation.
> \l_tmpa_tl=.
<recently read> }
l. ... }
============================================================

0 comments on commit eff12a0

Please sign in to comment.