Skip to content

Commit

Permalink
Prevent accidental expansion of \mathord (fixes #716)
Browse files Browse the repository at this point in the history
  • Loading branch information
josephwright committed Jan 23, 2024
1 parent 2079643 commit 132a9c5
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to
### Changed
- Load `color` package in `begindocument/before` hook

### Fixed
- Prevent accidental expansion of `\mathord` (see issue
[\#716](https://github.com/josephwright/siunitx/issues/716))

## [v3.3.9] - 2023-11-14

### Fixed
Expand Down
4 changes: 2 additions & 2 deletions siunitx-number.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -4117,7 +4117,7 @@
{
\tl_if_blank:nTF {#1}
{ \use:n }
{ \mathord }
{ \exp_not:N \mathord }
{ \exp_not:n {#2} }
}
\cs_new:Npn
Expand Down Expand Up @@ -4520,7 +4520,7 @@
{
\exp_not:n {#2}
\bool_if:NTF \l_@@_tight_bool
{ \mathord }
{ \exp_not:N \mathord }
{ \use:n }
{ \exp_not:n { \pm } }
\exp_not:n {#2}
Expand Down
9 changes: 9 additions & 0 deletions testfiles/siunitx-number.lvt
Original file line number Diff line number Diff line change
Expand Up @@ -1227,4 +1227,13 @@
\siunitx_if_number_token:NTF H { \ERROR } { \FALSE } \NEWLINE
}

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

\TEST { Testing~expansion~of~\mathord }
{
\keys_set:nn { siunitx } { tight-spacing , uncertainty-mode = separate }
\cs_set:Npn \mathord #1 { [#1] }
\test:n { 1.23(4) }
}

\END
7 changes: 7 additions & 0 deletions testfiles/siunitx-number.tlg
Original file line number Diff line number Diff line change
Expand Up @@ -2819,3 +2819,10 @@ TRUE
TRUE
FALSE
============================================================
============================================================
TEST 85: Testing expansion of \mathord
============================================================
> \l_tmpa_tl=1.23\mathord {\pm }0.04.
<recently read> }
l. ... }
============================================================

0 comments on commit 132a9c5

Please sign in to comment.