Skip to content

Commit

Permalink
Only suppress math font at one level (fixes #694)
Browse files Browse the repository at this point in the history
  • Loading branch information
josephwright committed Sep 1, 2023
1 parent d27081d commit 7272ea9
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 55 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to

## [Unreleased]

### Fixed
- Corrected handling of font commands inside `\ensuremath` in text
mode (see issue
[\#694](https:/josephwright/siunitx/issues/694))

## [v3.3.5] - 2023-08-30

### Fixed
Expand Down
23 changes: 13 additions & 10 deletions siunitx-print.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -891,15 +891,15 @@
\tl_set:Nn \l_@@_tmp_tl {#1}
\tl_if_empty:NF \l_@@_tmp_tl
{
\@@_text_replace_font:N \l_@@_tmp_tl
\tl_if_empty:NF \l_siunitx_unit_font_tl
{
\exp_after:wN
\cs_set_eq:NN \l_siunitx_unit_font_tl \scan_stop:
}
\cs_set:Npn \mathord ##1
{ \@@_text_replace_first:N ##1 }
\group_begin:
\group_begin:
\@@_text_replace_font:N \l_@@_tmp_tl
\cs_set:Npn \mathord ##1
{ \@@_text_replace_first:N ##1 }
\tl_if_empty:NF \l_siunitx_unit_font_tl
{
\exp_after:wN
\cs_set_eq:NN \l_siunitx_unit_font_tl \scan_stop:
}
\tl_map_inline:nn
{ \mp \approx \sim \ge \le \geq \leq \gg \ll \angle }
{
Expand All @@ -909,7 +909,10 @@
\cs_set:Npn \sqrt ##1
{
\exp_not:N \ensuremath
{ \exp_not:N \sqrt { \exp_not:N \text {##1} } }
{
\exp_not:N \sqrt
{ \exp_not:N \text { \@@_text_replace:n {##1} } }
}
}
\protected@edef \l_@@_tmp_tl
{ \exp_after:wN \@@_text_replace_first:N \l_@@_tmp_tl }
Expand Down
28 changes: 13 additions & 15 deletions testfiles/siunitx-print.luatex.tlg
Original file line number Diff line number Diff line change
Expand Up @@ -255,29 +255,27 @@ l. ... }
<argument> \l_tmpa_box
l. ... }
> \box...=
\hbox(6.94444+0.0)x16.80794, direction TLT
.\hbox(6.94444+0.0)x16.80794, direction TLT
\hbox(6.94444+0.0)x16.11116, direction TLT
.\hbox(6.94444+0.0)x16.11116, direction TLT
..\mathon
..\hbox(6.94444+0.0)x16.80794, direction TLT
...\OML/cmm/m/it/10 m
...\OML/cmm/m/it/10 o
...\OML/cmm/m/it/10 l
...\kern0.19678 (italic)
..\hbox(6.94444+0.0)x16.11116, direction TLT
...\OT1/cmr/m/n/10 m
...\OT1/cmr/m/n/10 o
...\OT1/cmr/m/n/10 l
..\mathoff
! OK.
<argument> \l_tmpa_box
l. ... }
> \box...=
\hbox(6.94444+0.0)x16.80794, direction TLT
\hbox(6.94444+0.0)x16.11116, direction TLT
.\mathon
.\hbox(6.94444+0.0)x16.80794, direction TLT
..\hbox(6.94444+0.0)x16.80794, direction TLT
.\hbox(6.94444+0.0)x16.11116, direction TLT
..\hbox(6.94444+0.0)x16.11116, direction TLT
...\mathon
...\hbox(6.94444+0.0)x16.80794, direction TLT
....\OML/cmm/m/it/10 m
....\OML/cmm/m/it/10 o
....\OML/cmm/m/it/10 l
....\kern0.19678 (italic)
...\hbox(6.94444+0.0)x16.11116, direction TLT
....\OT1/cmr/m/n/10 m
....\OT1/cmr/m/n/10 o
....\OT1/cmr/m/n/10 l
...\mathoff
.\mathoff
! OK.
Expand Down
28 changes: 13 additions & 15 deletions testfiles/siunitx-print.tlg
Original file line number Diff line number Diff line change
Expand Up @@ -249,29 +249,27 @@ l. ... }
<argument> \l_tmpa_box
l. ... }
> \box...=
\hbox(6.94444+0.0)x16.80794
.\hbox(6.94444+0.0)x16.80794
\hbox(6.94444+0.0)x16.11116
.\hbox(6.94444+0.0)x16.11116
..\mathon
..\hbox(6.94444+0.0)x16.80794
...\OML/cmm/m/it/10 m
...\OML/cmm/m/it/10 o
...\OML/cmm/m/it/10 l
...\kern0.19678
..\hbox(6.94444+0.0)x16.11116
...\OT1/cmr/m/n/10 m
...\OT1/cmr/m/n/10 o
...\OT1/cmr/m/n/10 l
..\mathoff
! OK.
<argument> \l_tmpa_box
l. ... }
> \box...=
\hbox(6.94444+0.0)x16.80794
\hbox(6.94444+0.0)x16.11116
.\mathon
.\hbox(6.94444+0.0)x16.80794
..\hbox(6.94444+0.0)x16.80794
.\hbox(6.94444+0.0)x16.11116
..\hbox(6.94444+0.0)x16.11116
...\mathon
...\hbox(6.94444+0.0)x16.80794
....\OML/cmm/m/it/10 m
....\OML/cmm/m/it/10 o
....\OML/cmm/m/it/10 l
....\kern0.19678
...\hbox(6.94444+0.0)x16.11116
....\OT1/cmr/m/n/10 m
....\OT1/cmr/m/n/10 o
....\OT1/cmr/m/n/10 l
...\mathoff
.\mathoff
! OK.
Expand Down
28 changes: 13 additions & 15 deletions testfiles/siunitx-print.xetex.tlg
Original file line number Diff line number Diff line change
Expand Up @@ -225,29 +225,27 @@ l. ... }
<argument> \l_tmpa_box
l. ... }
> \box...=
\hbox(6.94444+0.0)x16.80794
.\hbox(6.94444+0.0)x16.80794
\hbox(6.94444+0.0)x16.11116
.\hbox(6.94444+0.0)x16.11116
..\mathon
..\hbox(6.94444+0.0)x16.80794
...\OML/cmm/m/it/10 m
...\OML/cmm/m/it/10 o
...\OML/cmm/m/it/10 l
...\kern0.19678
..\hbox(6.94444+0.0)x16.11116
...\OT1/cmr/m/n/10 m
...\OT1/cmr/m/n/10 o
...\OT1/cmr/m/n/10 l
..\mathoff
! OK.
<argument> \l_tmpa_box
l. ... }
> \box...=
\hbox(6.94444+0.0)x16.80794
\hbox(6.94444+0.0)x16.11116
.\mathon
.\hbox(6.94444+0.0)x16.80794
..\hbox(6.94444+0.0)x16.80794
.\hbox(6.94444+0.0)x16.11116
..\hbox(6.94444+0.0)x16.11116
...\mathon
...\hbox(6.94444+0.0)x16.80794
....\OML/cmm/m/it/10 m
....\OML/cmm/m/it/10 o
....\OML/cmm/m/it/10 l
....\kern0.19678
...\hbox(6.94444+0.0)x16.11116
....\OT1/cmr/m/n/10 m
....\OT1/cmr/m/n/10 o
....\OT1/cmr/m/n/10 l
...\mathoff
.\mathoff
! OK.
Expand Down

0 comments on commit 7272ea9

Please sign in to comment.