Skip to content

Commit

Permalink
Correct spacing of sign with "output-exponent-marker" (fixes #600)
Browse files Browse the repository at this point in the history
  • Loading branch information
josephwright committed Apr 4, 2022
1 parent 66ef56b commit ce4f102
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 8 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to
## [Unreleased]

### Fixed
- Spacing of sign when using "output-exponent-marker" (see issue
[\#600](https://github.com/josephwright/siunitx/issues/600))
- Behavior of "minimum-decimal-digits" with uncertainties (see issue
[\#601](https://github.com/josephwright/siunitx/issues/601))

Expand Down
16 changes: 8 additions & 8 deletions siunitx-number.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -3649,25 +3649,25 @@
\exp_not:n {#5}
\exp_not:V \l_@@_exponent_base_tl
^
{ \@@_output_exponent_auxiii:nn {#1} {#2} }
{ \@@_output_exponent_auxiii:nnn { } {#1} {#2} }
}
\cs_new:Npn \@@_output_exponent_auxii:nnnnn #1#2#3#4#5
{
\exp_not:n {#5}
\exp_not:V \l_@@_output_exp_marker_tl
\@@_output_exponent_auxiii:nn {#1} {#2}
\@@_output_exponent_auxiii:nnn { \mathord } {#1} {#2}
}
\cs_new:Npn \@@_output_exponent_auxiii:nn #1#2
\cs_new:Npn \@@_output_exponent_auxiii:nnn #1#2#3
{
\tl_if_blank:nTF {#1}
\tl_if_blank:nTF {#2}
{
\bool_lazy_and:nnT
{ \l_@@_implicit_plus_bool }
{ ! \str_if_eq_p:nn {#2} { 0 } }
{ + }
{ ! \str_if_eq_p:nn {#3} { 0 } }
{ #1 + }
}
{ \exp_not:n {#1} }
\@@_output_digits:nn { integer } {#2}
{ \exp_not:n {#1#2} }
\@@_output_digits:nn { integer } {#3}
}
% \end{macrocode}
% A do-nothing marker used to allow shuffling of the output and so expandable
Expand Down
3 changes: 3 additions & 0 deletions testfiles/siunitx-number.lvt
Original file line number Diff line number Diff line change
Expand Up @@ -615,10 +615,13 @@
\TEST { Option~setting~"output-exponent-marker" }
{
\test:n { 12.34e3 }
\test:n { 12.34e-3 }
\keys_set:nn { siunitx } { output-exponent-marker = e }
\test:n { 12.34e3 }
\test:n { 12.34e-3 }
\keys_set:nn { siunitx } { output-exponent-marker = E }
\test:n { 12.34e3 }
\test:n { 12.34e-3 }
}

\TEST { Option~setting~"output-open-uncertainty" }
Expand Down
9 changes: 9 additions & 0 deletions testfiles/siunitx-number.tlg
Original file line number Diff line number Diff line change
Expand Up @@ -1286,12 +1286,21 @@ TEST 39: Option setting "output-exponent-marker"
> \l_tmpa_tl=12.34\times 10^{3}.
<recently read> }
l. ... }
> \l_tmpa_tl=12.34\times 10^{-3}.
<recently read> }
l. ... }
> \l_tmpa_tl=12.34e3.
<recently read> }
l. ... }
> \l_tmpa_tl=12.34e\mathord -3.
<recently read> }
l. ... }
> \l_tmpa_tl=12.34E3.
<recently read> }
l. ... }
> \l_tmpa_tl=12.34E\mathord -3.
<recently read> }
l. ... }
============================================================
============================================================
TEST 40: Option setting "output-open-uncertainty"
Expand Down

0 comments on commit ce4f102

Please sign in to comment.