Skip to content

Commit

Permalink
Switch from \ifmmode ... \fi to \TextOrMath
Browse files Browse the repository at this point in the history
  • Loading branch information
josephwright committed Oct 3, 2024
1 parent 2fcf9b1 commit cb57b9d
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 37 deletions.
28 changes: 14 additions & 14 deletions siunitx-compound.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -1340,41 +1340,41 @@
compound-exponents = individual ,
compound-final-separator =
{
\ifmmode \ \else \space \fi
\TextOrMath { \space } { \ }
\text { and }
\ifmmode \ \else \space \fi
\TextOrMath { \space } { \ }
} ,
compound-independent-prefix = false ,
compound-open-boundary = ,
compound-open-bracket = ( , % )
compound-pair-separator =
{
\ifmmode \ \else \space \fi
\TextOrMath { \space } { \ }
\text { and }
\ifmmode \ \else \space \fi
\TextOrMath { \space } { \ }
} ,
compound-separator =
{ , \ifmmode \ \else \space \fi } ,
{ , \TextOrMath { \space } { \ } } ,
compound-separator-mode = text ,
compound-units = repeat , % (
list-close-bracket = ) ,
list-exponents = individual ,
list-final-separator =
{
\ifmmode \ \else \space \fi
\TextOrMath { \space } { \ }
\text { and }
\ifmmode \ \else \space \fi
\TextOrMath { \space } { \ }
} ,
list-independent-prefix = false ,
list-open-bracket = ( , % )
list-pair-separator =
{
\ifmmode \ \else \space \fi
\TextOrMath { \space } { \ }
\text { and }
\ifmmode \ \else \space \fi
\TextOrMath { \space } { \ }
} ,
list-separator =
{ , \ifmmode \ \else \space \fi } ,
{ , \TextOrMath { \space } { \ } } ,
list-units = repeat , % (
product-close-bracket = ) ,
product-exponents = individual ,
Expand All @@ -1383,9 +1383,9 @@
product-open-bracket = ( , % )
product-phrase =
{
\ifmmode \ \else \space \fi
\TextOrMath { \space } { \ }
\text { by }
\ifmmode \ \else \space \fi
\TextOrMath { \space } { \ }
} ,
product-symbol = \times ,
product-units = repeat , % (
Expand All @@ -1396,9 +1396,9 @@
range-open-phrase = ,
range-phrase =
{
\ifmmode \ \else \space \fi
\TextOrMath { \space } { \ }
\text { to }
\ifmmode \ \else \space \fi
\TextOrMath { \space } { \ }
} ,
range-units = repeat
}
Expand Down
30 changes: 16 additions & 14 deletions siunitx-emulation.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -1006,20 +1006,22 @@
}
\cs_new_protected:Npx \SIUnitSymbolOhm
{
\exp_not:N \ifmmode
\cs_if_exist:NTF \upOmega
{ \exp_not:N \upOmega }
{ \exp_not:N \Omega }
\exp_not:N \else
\siunitx_print_text:n
{
\bool_lazy_or:nnTF
{ \sys_if_engine_luatex_p: }
{ \sys_if_engine_xetex_p: }
{ \@@_non_latin:n { "03A9 } }
{ \exp_not:N \textohm }
}
\exp_not:N \fi
\exp_not:N \TextOrMath
{
\siunitx_print_text:n
{
\bool_lazy_or:nnTF
{ \sys_if_engine_luatex_p: }
{ \sys_if_engine_xetex_p: }
{ \@@_non_latin:n { "03A9 } }
{ \exp_not:N \textohm }
}
}
{
\cs_if_exist:NTF \upOmega
{ \exp_not:N \upOmega }
{ \exp_not:N \Omega }
}
}
}
% \end{macrocode}
Expand Down
16 changes: 8 additions & 8 deletions siunitx-locale.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -173,15 +173,15 @@
{
list-final-separator =
{
\ifmmode \ \else \space \fi
\TextOrMath { \space } { \ }
\text { \GetTranslation { and } }
\ifmmode \ \else \space \fi
\TextOrMath { \space } { \ }
} ,
list-pair-separator =
{
\ifmmode \ \else \space \fi
\TextOrMath { \space } { \ }
\text { \GetTranslation { and } }
\ifmmode \ \else \space \fi
\TextOrMath { \space } { \ }
} ,
range-open-phrase =
{
Expand All @@ -196,16 +196,16 @@
{ from~(numerical~range) }
}
{
\ifmmode \ \else \space \fi
\TextOrMath { \space } { \ }
\text { \GetTranslation { from~(numerical~range) } }
\ifmmode \ \else \space \fi
\TextOrMath { \space } { \ }
}
} ,
range-phrase =
{
\ifmmode \ \else \space \fi
\TextOrMath { \space } { \ }
\text { \GetTranslation { to~(numerical~range) } }
\ifmmode \ \else \space \fi
\TextOrMath { \space } { \ }
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion testfiles/siunitx-compound.lvt
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@
range-open-phrase =
{
\text { from }
\ifmmode \ \else \space \fi
\TextOrMath { \space } { \ }
}
}
\test:nn { 1 } { 2 }
Expand Down

0 comments on commit cb57b9d

Please sign in to comment.