summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/siunitx/siunitx-symbol.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/siunitx/siunitx-symbol.dtx')
-rw-r--r--macros/latex/contrib/siunitx/siunitx-symbol.dtx32
1 files changed, 24 insertions, 8 deletions
diff --git a/macros/latex/contrib/siunitx/siunitx-symbol.dtx b/macros/latex/contrib/siunitx/siunitx-symbol.dtx
index 8ba65fc417..251d257c4b 100644
--- a/macros/latex/contrib/siunitx/siunitx-symbol.dtx
+++ b/macros/latex/contrib/siunitx/siunitx-symbol.dtx
@@ -114,12 +114,14 @@
}
\cs_new:Npn \@@_non_latin:nnnn #1#2#3#4
{
+ \@@_deal_with_utf:
\exp_after:wN \exp_after:wN \exp_after:wN
\exp_not:N \char_generate:nn {#1} { 13 }
\exp_after:wN \exp_after:wN \exp_after:wN
\exp_not:N \char_generate:nn {#2} { 13 }
}
}
+\cs_new:Npn \@@_deal_with_utf: { }
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -128,13 +130,17 @@
% A test to see if the unit definition which applies is still one we expect:
% here that means it is just using a (Unicode) codepoint. The comparison
% is string-based as \pkg{unicode-math} (at least) can alter some of them.
+% Active characters are set to \cs{scan_stop:} so that the code here gives
+% exactly the tokens (bytes) we want: needed for encodings other than
+% \textsc{utf}-8.
% \begin{macrocode}
\prg_new_protected_conditional:Npnn \@@_if_replace:Nn #1#2 { T , TF }
{
\group_begin:
- \tl_set:Nx \l_@@_tmpa_tl { \@@_non_latin:n {#2} }
\protected@edef \l_@@_tmpa_tl
- { \exp_not:N \mathrm { \l_@@_tmpa_tl } }
+ { \exp_not:N \mathrm { \@@_non_latin:n {#2} } }
+ \int_step_inline:nnn { "80 } { "FF }
+ { \char_set_active_eq:nN {##1} \scan_stop: }
\keys_set:nn { siunitx } { parse-units = false }
\siunitx_unit_format:nN {#1} \l_@@_tmpb_tl
\str_if_eq:VVTF \l_@@_tmpa_tl \l_@@_tmpb_tl
@@ -143,6 +149,7 @@
\prg_return_true:
}
{
+ \show\l_@@_tmpa_tl \show\l_@@_tmpb_tl
\group_end:
\prg_return_false:
}
@@ -178,8 +185,12 @@
{
\siunitx_declare_unit:Nxn \degree
{
- \siunitx_print_text:n
- { \@@_non_latin:n { "00B0 } }
+ \exp_not:N \text
+ {
+ \@ifpackageloaded { inputenc }
+ { \exp_not:N \textdegree }
+ { \@@_non_latin:n { "00B0 } }
+ }
}
{ quantity-product = { } }
}
@@ -202,8 +213,13 @@
{
\siunitx_declare_unit:Nx \degreeCelsius
{
- \siunitx_print_text:n
- { \@@_non_latin:n { "00B0 } } C
+ \exp_not:N \text
+ {
+ \@ifpackageloaded { inputenc }
+ { \exp_not:N \textdegree }
+ { \@@_non_latin:n { "00B0 } }
+ }
+ C
}
}
}
@@ -221,7 +237,7 @@
{ \exp_not:N \upOmega }
{ \exp_not:N \Omega }
\exp_not:N \else
- \siunitx_print_text:n
+ \exp_not:N \text
{
\bool_lazy_or:nnTF
{ \sys_if_engine_luatex_p: }
@@ -240,7 +256,7 @@
{
\siunitx_declare_prefix:Nnx \micro { -6 }
{
- \siunitx_print_text:n
+ \exp_not:N \text
{
\bool_lazy_or:nnTF
{ \sys_if_engine_luatex_p: }