diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/unicode-math/unicode-math-luatex.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/unicode-math/unicode-math-luatex.sty | 237 |
1 files changed, 130 insertions, 107 deletions
diff --git a/Master/texmf-dist/tex/latex/unicode-math/unicode-math-luatex.sty b/Master/texmf-dist/tex/latex/unicode-math/unicode-math-luatex.sty index 46768acc474..a82e463debc 100644 --- a/Master/texmf-dist/tex/latex/unicode-math/unicode-math-luatex.sty +++ b/Master/texmf-dist/tex/latex/unicode-math/unicode-math-luatex.sty @@ -43,7 +43,7 @@ %%^^A%% Metadata for the package code, including files and versioning \ProvidesExplPackage{unicode-math-luatex} - {2018/07/29} {v0.8m} {Unicode maths in XeLaTeX and LuaLaTeX} + {2019/02/15} {0.8n} {Unicode maths in XeLaTeX and LuaLaTeX} %%^^A%% um-code-opening.dtx -- part of UNICODE-MATH <wspr.io/unicode-math> %%^^A%% Assorted initialisation tasks, including some low-level function definitions. @@ -54,7 +54,7 @@ \RequirePackage{fix-cm} \RequirePackage{lualatex-math} \cs_set_protected_nopar:Npn \exp_last_unbraced:NNx { \::N \::x_unbraced \::: } -\cs_generate_variant:Nn \fontspec_set_family:Nnn {Nx} +\cs_generate_variant:Nn \fontspec_set_family:Nnn {Nx,Nxx} \cs_generate_variant:Nn \prop_get:NnNTF {cx} \cs_generate_variant:Nn \tl_if_eq:nnF {o} \cs_set_eq:NN \__um_group_begin: \group_begin: @@ -63,7 +63,7 @@ \cs_set_eq:NN \__um_group_end_frozen:n \__um_group_end:n \prg_new_conditional:Nnn \__um_glyph_if_exist:Nn {p,TF,T,F} { - \etex_iffontchar:D #1 #2 \scan_stop: + \tex_iffontchar:D #1 #2 \scan_stop: \prg_return_true: \else: \prg_return_false: @@ -140,6 +140,10 @@ \lua_now:n { fontspec.mathfontdimen(font.current(),"#2") } \scan_stop: } +\prg_new_conditional:Nnn \__um_int_if_zero:n {p,TF,T,F} + { + \int_compare:nNnTF {#1} = 0 {\prg_return_true:} {\prg_return_false:} + } \cs_new:Nn \usv_set:nnn { \tl_const:cn { c__um_#1_#2_usv } {#3} } \cs_new:Nn \__um_to_usv:nn { \use:c { c__um_#1_#2_usv } } \prg_new_conditional:Nnn \__um_usv_if_exist:nn {T,F,TF} @@ -175,13 +179,28 @@ \cs_generate_variant:Nn \msg_new:nnn {nnx} \cs_generate_variant:Nn \msg_new:nnnn {nnxx} \cs_new:Nn \__um_msg_new:nn { \msg_new:nnx {unicode-math} {#1} { \tl_trim_spaces:n {#2} } } +\cs_new:Npn \__um_cs_set:Nn #1 #2 + { + \cs_if_exist:NF #1 { \ERROR{CS~ DOES~ NOT~ EXIST,~ USE~ "NEW"} } + \cs_set_protected:Nn #1 + { + #2 + } + } +\cs_new:Npn \__um_cs_new:Nn #1 #2 + { + \cs_new_protected:Nn #1 + { + #2 + } + } %%^^A%% um-code-variables.dtx -- part of UNICODE-MATH <wspr.io/unicode-math> %%^^A%% Declaration of all code-level variables used in the package. \bool_new:N \g__um_ot_math_bool \bool_new:N \g__um_main_font_defined_bool -\bool_new:N \l__um_init_bool +\bool_new:N \g__um_init_bool \bool_new:N \l__um_implicit_alph_bool \bool_new:N \g__um_literal_bool \bool_new:N \g__um_upLatin_bool @@ -209,6 +228,7 @@ \int_new:N \g__um_fam_int \int_new:N \g__um_fonts_used_int \int_new:N \l__um_primecount_int +\tl_if_exist:NF \g__um_secret_hook_tl { \tl_new:N \g__um_secret_hook_tl } \tl_const:Nn \c__um_math_alphabet_name_latin_tl {Latin,~lowercase} \tl_const:Nn \c__um_math_alphabet_name_Latin_tl {Latin,~uppercase} \tl_const:Nn \c__um_math_alphabet_name_greek_tl {Greek,~lowercase} @@ -225,13 +245,18 @@ \tl_new:N \l__um_fam_three_tl \tl_new:N \l__um_curr_named_slot \tl_new:N \l__um_tmpa_tl +\tl_new:N \l__um_tmpb_tl +\tl_new:N \l__um_tmpc_tl \tl_new:N \l__um_mathstyle_tl \tl_new:N \l__um_radicals_tl \tl_new:N \l__um_nolimits_tl \tl_new:N \l__um_trial_family_tl +\tl_new:N \l__um_ss_chain_tl +\tl_new:N \l__um_tmpa_key_tl \tl_new:N \g__um_operator_mathfont_tl \tl_new:N \g__um_slash_delimiter_usv \tl_new:N \g__um_mathparam_settings_tl +\tl_new:N \l__um_mathtable_tl \tl_new:N \g__um_mathtable_tl \tl_new:N \g__um_fontname_tl \tl_new:N \g__um_mversion_tl @@ -250,7 +275,7 @@ \clist_new:N \g__um_alphabet_clist \clist_new:N \l__um_mathmap_charints_clist \clist_new:N \l__um_unknown_keys_clist -\clist_new:N \l__um_font_keyval_clist +\clist_new:N \l__um_keyval_clist \clist_new:N \l__um_alphabet_clist \clist_new:N \g__um_bad_alpha_clist \clist_gput_right:Nx \g__um_bad_alpha_clist { \tl_to_str:n {bf} } @@ -580,7 +605,7 @@ } \__um_msg_new:nn {missing-alphabets} { - Missingmathalphabetsinfont "\fontname\g__um_curr_font_cmd_tl" \\ \\ + Missing math alphabets in font "\fontname\g__um_curr_font_cmd_tl" \\ \\ \seq_map_function:NN \l__um_missing_alph_seq \__um_print_indent:n } \cs_new:Nn \__um_print_indent:n { \space\space\space\space #1 \\ } @@ -650,6 +675,13 @@ No main maths font has been set up yet.\\If you simply want ^^e2^^80^^98the default^^e2^^80^^99, use: \\ \iow_indent:n {\token_to_str:N\setmathfont{latinmodern-math.otf}} } +\__um_msg_new:nn {not-ot-math} + { + The first font loaded by unicode-math must be an OpenType Math font (with script=math). + If you simply want ^^e2^^80^^98the default^^e2^^80^^99 before loading supplementary fonts over the top for certain + ranges, use: \\ + \iow_indent:n {\token_to_str:N\setmathfont{latinmodern-math.otf}} + } \char_set_catcode_ignore:n {32} %%^^A%% um-code-usv.dtx -- part of UNICODE-MATH <wspr.io/unicode-math> @@ -903,17 +935,17 @@ %%^^A%% um-code-setchar.dtx -- part of UNICODE-MATH <wspr.io/unicode-math> %%^^A%% General assignment of maths symbols. -\cs_new:Npn \__um_symbol_setup: - { - \cs_set:Npn \UnicodeMathSymbol ##1##2##3##4 - { - \exp_not:n { \__um_sym:nnn {##1} {##2} {##3} } - } - } -\tl_gset_from_file_x:Nnn \g__um_mathtable_tl {\__um_symbol_setup:} {unicode-math-table.tex} -\cs_new:Nn \__um_input_math_symbol_table: {\g__um_mathtable_tl} +\group_begin: + \file_get:nnN {unicode-math-table.tex} {} \l__um_mathtable_tl + \cs_set:Npn \UnicodeMathSymbol #1#2#3#4 + { + \exp_not:n { \__um_sym:nnn {#1} {#2} {#3} } + } + \tl_gset:Nx \g__um_mathtable_tl {\l__um_mathtable_tl} +\group_end: +\__um_cs_new:Nn \__um_input_math_symbol_table: {\g__um_mathtable_tl} \AtBeginDocument{\__um_define_math_chars:} -\cs_new:Nn \__um_define_math_chars: +\__um_cs_new:Nn \__um_define_math_chars: { \group_begin: \cs_set:Npn \__um_sym:nnn ##1##2##3 @@ -1051,14 +1083,15 @@ { version .tl_set:N = \l__um_mversion_tl } -\cs_set:Nn \__um_setmathfontface:Nnn +\__um_cs_new:Nn \__um_setmathfontface:Nnn { \tl_clear:N \l__um_mversion_tl \keys_set_known:nnN {__um_mathface} {#2} \l__um_keyval_clist - \exp_args:Nnx \fontspec_set_family:Nxn \l__um_tmpa_tl - { ItalicFont={}, BoldFont={}, \exp_not:V \l__um_keyval_clist } {#3} + \fontspec_set_family:Nxx \l__um_tmpa_tl + { ItalicFont={}, BoldFont={}, SmallCapsFont={}, \exp_not:V \l__um_keyval_clist } + { #3 } \tl_if_empty:NT \l__um_mversion_tl { @@ -1097,55 +1130,55 @@ { \cs_set_eq:NN \__um_group_begin: \__um_group_begin_frozen: \cs_set_eq:NN \__um_group_end:n \__um_group_end_frozen:n - \cs_set_eq:NN \math@bgroup \__ummath@bgroup - \cs_set_eq:NN \math@egroup \__ummath@egroup + \cs_set_eq:NN \math@bgroup \@@math@bgroup + \cs_set_eq:NN \math@egroup \@@math@egroup } \cs_set_eq:NN \math@egroup \__um_group_end:n #1 \scan_stop: } \cs_generate_variant:Nn \tl_if_eq:nnT {o} -\cs_set:Nn \__fontspec_setmainfont_hook:nn +\__um_cs_set:Nn \__fontspec_setmainfont_hook:nn { \tl_if_eq:onT {\g__fontspec_mathrm_tl} {\rmdefault} { - \fontspec_set_family:Nnn \g__fontspec_mathrm_tl {Renderer=Basic,#1} {#2} + \fontspec_gset_family:Nnn \g__fontspec_mathrm_tl {Renderer=Basic,#1} {#2} \__fontspec_setmathrm_hook:nn {#1} {#2} } } -\cs_set:Nn \__fontspec_setsansfont_hook:nn +\__um_cs_set:Nn \__fontspec_setsansfont_hook:nn { \tl_if_eq:onT {\g__fontspec_mathsf_tl} {\sfdefault} { - \fontspec_set_family:Nnn \g__fontspec_mathsf_tl {Renderer=Basic,#1} {#2} + \fontspec_gset_family:Nnn \g__fontspec_mathsf_tl {Renderer=Basic,#1} {#2} \__fontspec_setmathsf_hook:nn {#1} {#2} } } -\cs_set:Nn \__fontspec_setmonofont_hook:nn +\__um_cs_set:Nn \__fontspec_setmonofont_hook:nn { \tl_if_eq:onT {\g__fontspec_mathtt_tl} {\ttdefault} { - \fontspec_set_family:Nnn \g__fontspec_mathtt_tl {Renderer=Basic,#1} {#2} + \fontspec_gset_family:Nnn \g__fontspec_mathtt_tl {Renderer=Basic,#1} {#2} \__fontspec_setmathtt_hook:nn {#1} {#2} } } -\cs_set:Nn \__fontspec_setmathrm_hook:nn +\__um_cs_set:Nn \__fontspec_setmathrm_hook:nn { \SetMathAlphabet\mathrm{normal}\g_fontspec_encoding_tl\g__fontspec_mathrm_tl\mddefault\updefault \SetMathAlphabet\mathit{normal}\g_fontspec_encoding_tl\g__fontspec_mathrm_tl\mddefault\itdefault \SetMathAlphabet\mathbf{normal}\g_fontspec_encoding_tl\g__fontspec_mathrm_tl\bfdefault\updefault } -\cs_set:Nn \__fontspec_setboldmathrm_hook:nn +\__um_cs_set:Nn \__fontspec_setboldmathrm_hook:nn { \SetMathAlphabet\mathrm{bold}\g_fontspec_encoding_tl\g__fontspec_bfmathrm_tl\mddefault\updefault \SetMathAlphabet\mathbf{bold}\g_fontspec_encoding_tl\g__fontspec_bfmathrm_tl\bfdefault\updefault \SetMathAlphabet\mathit{bold}\g_fontspec_encoding_tl\g__fontspec_bfmathrm_tl\mddefault\itdefault } -\cs_set:Nn \__fontspec_setmathsf_hook:nn +\__um_cs_set:Nn \__fontspec_setmathsf_hook:nn { \SetMathAlphabet\mathsf{normal}\g_fontspec_encoding_tl\g__fontspec_mathsf_tl\mddefault\updefault \SetMathAlphabet\mathsf{bold} \g_fontspec_encoding_tl\g__fontspec_mathsf_tl\bfdefault\updefault } -\cs_set:Nn \__fontspec_setmathtt_hook:nn +\__um_cs_set:Nn \__fontspec_setmathtt_hook:nn { \SetMathAlphabet\mathtt{normal}\g_fontspec_encoding_tl\g__fontspec_mathtt_tl\mddefault\updefault \SetMathAlphabet\mathtt{bold} \g_fontspec_encoding_tl\g__fontspec_mathtt_tl\bfdefault\updefault @@ -1163,7 +1196,7 @@ %%^^A%% um-code-main.dtx -- part of UNICODE-MATH <wspr.io/unicode-math> %%^^A%% Definition of `\setmainfont`. -\cs_set:Nn \__um_setmathfont:nn +\__um_cs_new:Nn \__um_setmathfont:nn { \__um_init:n {#2} @@ -1173,14 +1206,12 @@ \keys_set_known:nnN {unicode-math} {#1} \l__um_unknown_keys_clist - \bool_if:NT \l__um_init_bool - { - \__um_fontspec_trial_font: - \__um_declare_math_sizes: - } + \bool_if:NT \g__um_init_bool \__um_fontspec_trial_font: + \bool_if:NT \g__um_init_bool \__um_declare_math_sizes: + \__um_fontspec_select_font: \__um_setup_math_fam: - \bool_if:NT \l__um_init_bool + \bool_if:NT \g__um_init_bool { \__um_setup_legacy_fam_two: \__um_setup_legacy_fam_three: @@ -1188,7 +1219,7 @@ \__um_input_math_symbol_table: - \bool_if:NT \l__um_init_bool \__um_onceoff_setup: + \bool_if:NT \g__um_init_bool \__um_onceoff_setup: \__um_remap_symbols: \__um_setup_mathactives: \__um_setup_delcodes: @@ -1196,7 +1227,7 @@ %% TODO: what of the above should only be run for the "default"/"main" font? - \bool_if:NTF \l__um_init_bool + \bool_if:NTF \g__um_init_bool { \bool_gset_true:N \g__um_main_font_defined_bool \__um_mathparam_store: @@ -1206,16 +1237,12 @@ \__um_mathparam_restore: } } -\AtBeginDocument { \__um_load_lm_if_necessary: } -\cs_new:Nn \__um_load_lm_if_necessary: +\AtBeginDocument { \bool_if:NF \g__um_main_font_defined_bool \__um_load_lm: } +\__um_cs_new:Nn \__um_load_lm: { - \bool_if:NF \g__um_main_font_defined_bool - { - \setmathfont{latinmodern-math.otf} - [BoldFont={latinmodern-math.otf}] - } + \setmathfont{latinmodern-math.otf}[BoldFont={latinmodern-math.otf}] } -\cs_new:Nn \__um_init:n +\__um_cs_new:Nn \__um_init:n { \tl_set:Nn \l__um_fontname_tl {#1} \bool_gset_true:N \g__um_ot_math_bool @@ -1227,7 +1254,7 @@ \tl_set_eq:NN \l__um_script_font_tl \l__um_fontname_tl \tl_set_eq:NN \l__um_sscript_font_tl \l__um_fontname_tl - \bool_set_true:N \l__um_init_bool + \bool_gset_true:N \g__um_init_bool \seq_gclear:N \g__um_char_range_seq \clist_clear:N \l__um_mathmap_charints_clist \seq_gclear:N \g__um_mathalph_seq @@ -1240,21 +1267,21 @@ \cs_set_eq:NN \__um_make_mathactive:nNN \__um_make_mathactive_noparse:nNN } \tl_new:N \g__um_main_font_cmd_tl -\cs_new:Nn \__um_declare_math_sizes: +\cs_new:Nn \__um_sf_size: { \__um_fontdimen_to_scale:nN {10} \g__um_trial_font } +\cs_new:Nn \__um_ssf_size: { \__um_fontdimen_to_scale:nN {11} \g__um_trial_font } +\__um_cs_new:Nn \__um_declare_math_sizes: { \dim_compare:nF { \fontdimen 10 \g__um_trial_font == 0pt } { - \DeclareMathSizes { \f@size } { \f@size } - { \__um_fontdimen_to_scale:nN {10} \g__um_trial_font } - { \__um_fontdimen_to_scale:nN {11} \g__um_trial_font } + \DeclareMathSizes { \f@size } { \f@size } { \__um_sf_size: } { \__um_ssf_size: } } } -\cs_new:Nn \__um_fontspec_trial_font: +\__um_cs_new:Nn \__um_fontspec_trial_font: { \tl_set:Nx \l__um_font_keyval_tl { Renderer = Basic, - BoldItalicFont = {}, ItalicFont = {}, + BoldItalicFont = {}, ItalicFont = {}, SmallCapsFont = {}, Script = Math, FontAdjustment = { \__um_luatex_copy_fontdimens: }, \l__um_unknown_keys_clist @@ -1267,21 +1294,22 @@ \exp_last_unbraced:NNo \__um_fontface_gset_eq:NN \g__um_trial_font \font@name \fontspec_if_script:nF {math} { + \__um_warning:n {not-ot-math} \bool_gset_false:N \g__um_ot_math_bool \bool_gset_false:N \g__um_init_bool } \group_end: } -\cs_new:Nn \__um_fontspec_select_font: +\__um_cs_new:Nn \__um_fontspec_select_font: { - \fp_gset:Nn \g__um_size_tfsf_fp { (\f@size +\sf@size )/2 } - \fp_gset:Nn \g__um_size_sfssf_fp { (\sf@size+\ssf@size)/2 } + \fp_gset:Nn \g__um_size_tfsf_fp { (\f@size + \__um_sf_size: )/2 } + \fp_gset:Nn \g__um_size_sfssf_fp { (\__um_sf_size: + \__um_ssf_size:)/2 } \tl_set:Nx \l__um_font_keyval_tl { Renderer = Basic, - BoldItalicFont = {}, ItalicFont = {}, + BoldItalicFont = {}, ItalicFont = {}, SmallCapsFont = {}, Script = Math, SizeFeatures = { @@ -1310,21 +1338,16 @@ \fontfamily { \l__um_family_tl } \selectfont \exp_last_unbraced:Nno \__um_fontface_gset_eq:cN {g__um_mathfont_ \int_use:N \g__um_fonts_used_int _font} \font@name \tl_gset:Nx \g__um_curr_font_cmd_tl { \exp_not:c {g__um_mathfont_ \int_use:N \g__um_fonts_used_int _font} } - \bool_if:NT \l__um_init_bool + \bool_if:NT \g__um_init_bool { \exp_last_unbraced:NNo \__um_fontface_gset_eq:NN \l__um_font \font@name } - \fontspec_if_script:nF {math} - { - \bool_gset_false:N \g__um_ot_math_bool - \bool_gset_false:N \g__um_init_bool - } \group_end: } \tl_gset:Nn \g__um_main_font_cmd_tl { \l__um_font } \tl_gset:Nn \g__um_sqrt_font_cmd_tl { \l__um_font } \tl_gset:Nn \g__um_prime_font_cmd_tl { \l__um_font } -\cs_new_protected:Nn \__um_luatex_copy_fontdimens: +\__um_cs_new:Nn \__um_luatex_copy_fontdimens: { \__um_fontdimen_from_param:nn {10} {ScriptPercentScaleDown} \__um_fontdimen_from_param:nn {11} {ScriptScriptPercentScaleDown} @@ -1345,7 +1368,7 @@ \__um_fontdimen_from_param:nn {45} {FractionDenominatorDisplayStyleShiftDown} \__um_fontdimen_from_param:nn {48} {FractionRuleThickness} } -\cs_new:Nn \__um_setup_math_fam: +\__um_cs_new:Nn \__um_setup_math_fam: { \cs_if_exist:cF { sym \l__um_symfont_label_tl } { @@ -1354,18 +1377,18 @@ } \SetSymbolFont{\l__um_symfont_label_tl}{\l__um_mversion_tl} {\encodingdefault}{\l__um_family_tl}{\mddefault}{\updefault} - \str_if_eq_x:nnT {\l__um_mversion_tl} {normal} + \str_if_eq:eeT {\l__um_mversion_tl} {normal} { \SetSymbolFont{\l__um_symfont_label_tl}{bold} {\encodingdefault}{\l__um_family_tl}{\bfdefault}{\updefault} } } -\cs_new:Nn \__um_setup_legacy_fam_two: +\__um_cs_new:Nn \__um_setup_legacy_fam_two: { \fontspec_set_family:Nxn \l__um_fam_two_tl { \l__um_font_keyval_tl, - Scale=1.00001, + ScaleAgain = 1.00001, FontAdjustment = { \__um_copy_fontdimen:nnN { 8} {43} \g__um_main_font_cmd_tl @@ -1389,18 +1412,18 @@ \SetSymbolFont{symbols}{\l__um_mversion_tl} {\encodingdefault}{\l__um_fam_two_tl}{\mddefault}{\updefault} - \str_if_eq_x:nnT {\l__um_mversion_tl} {normal} + \str_if_eq:eeT {\l__um_mversion_tl} {normal} { \SetSymbolFont{symbols}{bold} {\encodingdefault}{\l__um_fam_two_tl}{\bfdefault}{\updefault} } } -\cs_new:Nn \__um_setup_legacy_fam_three: +\__um_cs_new:Nn \__um_setup_legacy_fam_three: { \fontspec_set_family:Nxn \l__um_fam_three_tl { \l__um_font_keyval_tl, - Scale=0.99999, + ScaleAgain = 0.99999, FontAdjustment = { \__um_copy_fontdimen:nnN { 8} {48} \g__um_main_font_cmd_tl \__um_copy_fontdimen:nnN { 9} {28} \g__um_main_font_cmd_tl @@ -1414,15 +1437,15 @@ \SetSymbolFont{largesymbols}{\l__um_mversion_tl} {\encodingdefault}{\l__um_fam_three_tl}{\mddefault}{\updefault} - \str_if_eq_x:nnT {\l__um_mversion_tl} {normal} + \str_if_eq:eeT {\l__um_mversion_tl} {normal} { \SetSymbolFont{largesymbols}{bold} {\encodingdefault}{\l__um_fam_three_tl}{\bfdefault}{\updefault} } } -\cs_new:Nn \__um_onceoff_setup: +\__um_cs_new:Nn \__um_onceoff_setup: { - \__um_set_delcode:nnn {operators} {`\.} {\c_zero} + \__um_set_delcode:nnn {operators} {`\.} {0} } \cs_set:Nn \__um_process_symbol_noparse:nnn { @@ -1435,7 +1458,7 @@ \__um_process_symbol_noparse:nnn {#1} {#2} {#3} } } -\cs_new:Nn \__um_remap_symbols: +\__um_cs_new:Nn \__um_remap_symbols: { \__um_remap_symbol:nnn {`\-} {\mathbin} {"2212} \__um_remap_symbol:nnn {`\*} {\mathbin} {"02217}% text asterisk to "centred asterisk" @@ -1454,7 +1477,7 @@ \clist_map_inline:nn {#1} { \__um_set_mathcode:nnnn {##1} {#2} {\l__um_symfont_label_tl} {#3} } } -\cs_new:Npn \__um_setup_mathactives: +\__um_cs_new:Nn \__um_setup_mathactives: { \__um_make_mathactive:nNN {"2032} \__um_prime_single_mchar \mathord \__um_make_mathactive:nNN {"2033} \__um_prime_double_mchar \mathord @@ -1488,7 +1511,7 @@ } } \cs_new:Nn \__um_assign_delcode:n { \__um_assign_delcode:nn {#1} {#1} } -\cs_new:Npn \__um_setup_delcodes: +\__um_cs_new:Nn \__um_setup_delcodes: { \__um_assign_delcode:nn {`\/} {\g__um_slash_delimiter_usv} \__um_assign_delcode:nn {"2044} {\g__um_slash_delimiter_usv} % fracslash @@ -1533,12 +1556,12 @@ \intcap\intcup\upint\lowint } \tl_set:Nn \l__um_radicals_tl {\sqrt \longdivision \cuberoot \fourthroot} -\cs_set:Nn \__um_mathparam_restore: +\__um_cs_new:Nn \__um_mathparam_restore: { \glb@settings \tl_use:N \g__um_mathparam_settings_tl } -\cs_set:Nn \__um_mathparam_store: +\__um_cs_new:Nn \__um_mathparam_store: { \glb@settings \tl_gset:Nx \g__um_mathparam_settings_tl @@ -1621,7 +1644,7 @@ range .code:n = { \bool_if:NF \g__um_main_font_defined_bool { \__um_error:n {no-main-font} } - \bool_set_false:N \l__um_init_bool + \bool_gset_false:N \g__um_init_bool \__um_range_init: \group_begin: \seq_map_inline:Nn \g__um_mathclasses_seq @@ -1637,7 +1660,7 @@ \group_end: } } -\cs_new:Nn \__um_range_init: +\__um_cs_new:Nn \__um_range_init: { \int_gincr:N \g__um_fam_int \tl_set:Nx \l__um_symfont_label_tl {__um_fam\int_use:N\g__um_fam_int} @@ -1659,7 +1682,6 @@ } \cs_new:Nn \__um_mathalph_decl:nF { - \tl_set:Nn \l__um_tmpa_tl {#1} \tl_clear:N \l__um_tmpb_tl \tl_clear:N \l__um_tmpc_tl @@ -1864,11 +1886,11 @@ \__um_font_param:n { connector_overlap_min } \cs_new:Nn \__um_fontdimen_to_percent:nN { - \fp_eval:n { \dim_to_decimal:n { \fontdimen #1 #2 } * 65536 / 100 } + \fp_eval:n { \dim_to_decimal:n { 65536 \fontdimen #1 #2 } / 100 } } \cs_new:Nn \__um_fontdimen_to_scale:nN { - \fp_eval:n { \__um_fontdimen_to_percent:nN {#1} #2 * \f@size } pt + \fp_eval:n { \__um_fontdimen_to_percent:nN {#1} #2 * \f@size } } \cs_new:Nn \__um_mathstyle_scale:NnnN { @@ -1886,15 +1908,15 @@ %%^^A%% um-code-mathmap.dtx -- part of UNICODE-MATH <wspr.io/unicode-math> %%^^A%% Setup of symbol alphabets. -\cs_new:Npn \__um_setup_alphabets: +\__um_cs_new:Nn \__um_setup_alphabets: { - \bool_if:NTF \l__um_init_bool { \__um_setup_alphabets_implicit: } + \bool_if:NTF \g__um_init_bool { \__um_setup_alphabets_implicit: } { \seq_if_empty:NF \g__um_mathalph_seq { \__um_setup_alphabets_explicit: } \clist_if_empty:NF \l__um_mathmap_charints_clist { \__um_setup_alphabets_inherit: } } } -\cs_new:Nn \__um_setup_alphabets_implicit: +\__um_cs_new:Nn \__um_setup_alphabets_implicit: { \__um_log:n {setup-implicit} \seq_gset_eq:NN \g__um_mathalph_seq \g__um_default_mathalph_seq @@ -1907,7 +1929,7 @@ \__um_mathalph_map: \seq_if_empty:NF \l__um_missing_alph_seq { \__um_log:n { missing-alphabets } } } -\cs_new:Nn \__um_setup_alphabets_explicit: +\__um_cs_new:Nn \__um_setup_alphabets_explicit: { \__um_log:n {setup-explicit} \bool_set_false:N \l__um_implicit_alph_bool @@ -1916,7 +1938,7 @@ \__um_mathalph_map: \seq_if_empty:NF \l__um_missing_alph_seq { \__um_log:n { missing-alphabets } } } -\cs_new:Nn \__um_setup_alphabets_inherit: +\__um_cs_new:Nn \__um_setup_alphabets_inherit: { \seq_gclear:N \g__um_mathalph_seq \seq_map_inline:Nn \g__um_default_mathalph_seq @@ -1974,7 +1996,7 @@ \tl_set:Nn \l__um_alphabet_tl {##1} \__um_if_alphabet_exists:nnTF \l__um_style_tl \l__um_alphabet_tl { - \str_if_eq_x:nnTF {\l__um_alphabet_tl} {misc} + \str_if_eq:eeTF {\l__um_alphabet_tl} {misc} { \__um_maybe_init_alphabet:n \l__um_style_tl \clist_map_break: @@ -1994,7 +2016,7 @@ } } } -\cs_new:Nn \__um_setup_math_alphabet: +\__um_cs_new:Nn \__um_setup_math_alphabet: { \clist_map_inline:Nn \l__um_alphabet_clist { @@ -2238,7 +2260,7 @@ %%^^A%% um-code-sym-commands.dtx -- part of UNICODE-MATH <wspr.io/unicode-math> %%^^A%% Definition of "math symbol alphabet" commands such as `\symbf` and co. -\cs_new:Nn \__um_prepare_mathstyle:n +\__um_cs_new:Nn \__um_prepare_mathstyle:n { \seq_gput_right:Nn \g__um_mathstyles_seq {#1} \__um_init_alphabet:n {#1} @@ -2255,7 +2277,7 @@ \__um_group_end:n } } -\cs_set:Nn \__um_init_alphabet:n +\__um_cs_new:Nn \__um_init_alphabet:n { \__um_log:nx {alph-initialise} {#1} \tl_gclear_new:c {g__um_switchto_#1_tl} @@ -2265,7 +2287,7 @@ { \tl_use:c {g__um_switchto_#1_tl} } -\cs_new:Nn \__um_default_mathalph:nnn +\__um_cs_new:Nn \__um_default_mathalph:nnn { \prop_new:c {g__um_named_range_#1_prop} \seq_gput_right:Nn \g__um_default_mathalph_seq {{#1}{#2}{#3}} @@ -2308,16 +2330,17 @@ { \cs_set:cpx { math #1 } { \exp_not:c { sym #1 } } } -\AtBeginDocument +\AtBeginDocument { \__um_setup_mathtext: } +\__um_cs_new:Nn \__um_setup_mathtext: { \clist_map_inline:nn { rm, it, bf, sf, tt } { - \cs_set_protected:cpx { math #1 } + \cs_set_protected:cpx { math ##1 } { - \exp_not:n { \bool_if:NTF } \exp_not:c { g__um_ math #1 _text_bool} - { \exp_not:c { mathtext #1 } } - { \exp_not:c { sym #1 } } + \exp_not:n { \bool_if:NTF } \exp_not:c { g__um_ math ##1 _text_bool} + { \exp_not:c { mathtext ##1 } } + { \exp_not:c { sym ##1 } } } } } @@ -3469,13 +3492,13 @@ \__um_scan_sscript: } } -\cs_new:Nn \__um_scan_sscript: +\__um_cs_new:Nn \__um_scan_sscript: { \__um_scan_sscript:TF { \__um_scan_sscript: } { \__um_sub_or_super:n {\l__um_ss_chain_tl} } } -\cs_new:Nn \__um_scan_sscript:TF +\__um_cs_new:Nn \__um_scan_sscript:TF { \peek_N_type:TF { @@ -3484,7 +3507,7 @@ } {#2} } -\cs_new:Nn \__um_scan_sscript_aux:nnN +\__um_cs_new:Nn \__um_scan_sscript_aux:nnN { \tl_set:Nx \l__um_tmpa_key_tl { \tl_to_str:n {#3} } \prop_get:cxNTF {g__um_\l__um_tmpa_tl _prop} @@ -3632,7 +3655,7 @@ } \AtEndOfPackageFile * {url} { - \tl_put_left:Nn \Url@FormatString { \__um_switch_to:n {up} } + \tl_put_left:Nn \Url@FormatString { \__um_switch_to:n {literal} } \tl_put_right:Nn \UrlSpecials { \do \` { \mathchar`\` } @@ -3724,8 +3747,7 @@ { \bool_if:nTF { - \int_compare_p:nNn { \uproot@ } = { \c_zero } - && \int_compare_p:nNn { \leftroot@ } = { \c_zero } + \__um_int_if_zero_p:n \uproot@ && \__um_int_if_zero_p:n \leftroot@ } { \Uroot \c__um_radical_sqrt_tl { #1 } { #2 } @@ -3956,5 +3978,6 @@ \__um_undeclare_symbol:N \arrowvert \__um_undeclare_symbol:N \Arrowvert \__um_undeclare_symbol:N \bracevert +\AtBeginDocument{\g__um_secret_hook_tl} \endinput |