Skip to content

Commit

Permalink
Correct formatting of units with separ uncer. (fixes #717)
Browse files Browse the repository at this point in the history
  • Loading branch information
josephwright committed Feb 7, 2024
1 parent 272bcdc commit edf6033
Show file tree
Hide file tree
Showing 4 changed files with 214 additions and 71 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,17 @@ Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to

## [Unreleased]

### Fixed
- Formatting of units with separated uncertainties in 'compound' structures
when unit is not repeated (see issue
[\#717](https://github.com/josephwright/siunitx/issues/717))

## [v3.3.10] - 2024-01-25

### Changed
- Load `color` package in `begindocument/before` hook
- Normalize exponents when `exponent-mode = threshold` (see issue
[\#716](https://github.com/josephwright/siunitx/issues/711))
[\#711](https://github.com/josephwright/siunitx/issues/711))

### Fixed
- Prevent accidental expansion of `\mathord` (see issue
Expand Down
11 changes: 7 additions & 4 deletions siunitx-compound.dtx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
% File: siunitx-compound.dtx Copyright (C) 2018-2021,2023 Joseph Wright
% File: siunitx-compound.dtx Copyright (C) 2018-2021,2023,2024 Joseph Wright
%
% It may be distributed and/or modified under the conditions of the
% LaTeX Project Public License (LPPL), either version 1.3c of this
Expand Down Expand Up @@ -1032,9 +1032,12 @@
{ \@@_uncert_bracket:nnw {#1#2#3#4#5#6} {#7#8} #9 \q_stop }
\cs_new:Npn \@@_uncert_bracket:nnw #1#2 #3 \q_nil #4 \q_nil #5 \q_stop
{
\bool_lazy_or:nnTF
{ \tl_if_blank_p:n {#2#3} }
{ ! \tl_if_blank_p:n {#5} }
\bool_lazy_any:nTF
{
{ ! \l_@@_unit_repeat_bool }
{ \tl_if_blank_p:n {#2#3} }
{ ! \tl_if_blank_p:n {#5} }
}
{ \exp_not:n {#1#2#3#4#5} }
{
\exp_not:V \l_@@_bracket_open_tl
Expand Down
17 changes: 12 additions & 5 deletions testfiles/siunitx-compound.lvt
Original file line number Diff line number Diff line change
Expand Up @@ -492,13 +492,20 @@
\test:nn { { 1e2 } { 2e2 } { 3e2 } } { \kilo \metre }
}

\TEST { Option~setting~"uncertainty-mode~=~separate" }
\TEST { Option~settings~"uncertainty-mode~=~separate"~and~"compound-units" }
{
\test:nn { { 5.4(3) } { 7.8(2) } } { \metre }
\test:nn { { 5.4(3)e1 } { 7.8(2)e2 } } { \metre }
\keys_set:nn { siunitx } { uncertainty-mode = separate }
\test:nn { { 5.4(3) } { 7.8(2) } } { \metre }
\test:nn { { 5.4(3)e1 } { 7.8(2)e2 } } { \metre }
\test:nn { { 1e2 } { 2e2 } { 3e2 } } { \metre }
\keys_set:nn { siunitx } { compound-units = bracket }
\test:nn { { 1e2 } { 2e2 } { 3e2 } } { \metre }
\keys_set:nn { siunitx } { compound-units = bracket-power }
\test:nn { { 1e2 } { 2e2 } { 3e2 } } { \metre }
\keys_set:nn { siunitx } { compound-units = power }
\test:nn { { 1e2 } { 2e2 } { 3e2 } } { \metre }
\keys_set:nn { siunitx } { compound-units = repeat }
\test:nn { { 1e2 } { 2e2 } { 3e2 } } { \metre }
\keys_set:nn { siunitx } { compound-units = single }
\test:nn { { 1e2 } { 2e2 } { 3e2 } } { \metre }
}

\TEST { Option~settings~"mode"~and~"output-decimal-marker" }
Expand Down

0 comments on commit edf6033

Please sign in to comment.