summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/siunitx/siunitx-print.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/siunitx/siunitx-print.dtx')
-rw-r--r--macros/latex/contrib/siunitx/siunitx-print.dtx27
1 files changed, 16 insertions, 11 deletions
diff --git a/macros/latex/contrib/siunitx/siunitx-print.dtx b/macros/latex/contrib/siunitx/siunitx-print.dtx
index 8f1e4bb467..10a316da89 100644
--- a/macros/latex/contrib/siunitx/siunitx-print.dtx
+++ b/macros/latex/contrib/siunitx/siunitx-print.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-% File: siunitx-print.dtx Copyright (C) 2016-2019,2021 Joseph Wright
+% File: siunitx-print.dtx Copyright (C) 2016-2019,2021,2022 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
@@ -791,6 +791,7 @@
%
% \begin{macro}{\siunitx_print_text:n}
% \begin{macro}{\@@_text_replace:n, \@@_text_replace_aux:n}
+% \begin{macro}[EXP]{\@@_text_replace_first:N}
% \begin{macro}{\@@_text_replace:N}
% \begin{macro}{\@@_text_replace:NNn}
% \begin{macro}{\@@_text_replace:Nnnn}
@@ -844,28 +845,31 @@
\tl_if_empty:NF \l_siunitx_unit_font_tl
{ \exp_after:wN \cs_set_eq:NN \l_siunitx_unit_font_tl \use:n }
\cs_set:Npn \mathord ##1
- {
- \str_case:nnF {##1}
- {
- { \cdot } { \exp_not:N \textperiodcentered }
- { \pm } { \exp_not:N \textpm }
- { \times } { \exp_not:N \texttimes }
- }
- {##1}
- }
+ { \@@_text_replace_first:N ##1 }
\cs_set:Npn \pm { \: \exp_not:N \textpm \: }
\tl_map_inline:nn
{ \mp \ge \le \gg \ll }
{ \cs_set:Npn ##1 { \exp_not:N \ensuremath { \exp_not:N ##1 } } }
\cs_set:Npn \cdot { \: \exp_not:N \textperiodcentered \: }
\cs_set:Npn \times { \: \exp_not:N \texttimes \: }
- \protected@edef \l_@@_tmp_tl { \l_@@_tmp_tl }
+ \protected@edef \l_@@_tmp_tl
+ { \exp_after:wN \@@_text_replace_first:N \l_@@_tmp_tl }
\@@_text_replace:N \l_@@_tmp_tl
\@@_text_replace_aux:n { \tl_use:N \l_@@_tmp_tl }
}
\group_end:
}
\cs_new_protected:Npn \@@_text_replace_aux:n #1 {#1}
+\cs_new:Npn \@@_text_replace_first:N #1
+ {
+ \str_case:nnF {#1}
+ {
+ { \cdot } { \exp_not:N \textperiodcentered }
+ { \pm } { \exp_not:N \textpm }
+ { \times } { \exp_not:N \texttimes }
+ }
+ {#1}
+ }
\cs_new_protected:Npx \@@_text_replace:N #1
{
\exp_not:N \@@_text_replace:NNn #1
@@ -1022,6 +1026,7 @@
% \end{macro}
% \end{macro}
% \end{macro}
+% \end{macro}
%
% \subsection{Standard settings for module options}
%