diff options
author | Karl Berry <karl@freefriends.org> | 2018-02-01 23:06:27 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2018-02-01 23:06:27 +0000 |
commit | e526edff1f4884090f58dfaf692bd9a4a6c177d1 (patch) | |
tree | d8994bc76c475d3c112c1fa44cf08b13aafd48d7 /Master/texmf-dist/tex/latex/unicode-math | |
parent | bc61db48b8a70b7211fef576059edbacb9a36d0d (diff) |
unicode-math (1feb18)
git-svn-id: svn://tug.org/texlive/trunk@46515 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/unicode-math')
3 files changed, 130 insertions, 110 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 950a76f2a99..0fe53583f55 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/01/13} {v0.8k} {Unicode maths in XeLaTeX and LuaLaTeX} + {2018/02/02} {v0.8l} {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. @@ -58,9 +58,9 @@ \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: -\cs_set_eq:NN \__um_group_end: \group_end: +\cs_set_protected:Npn \__um_group_end:n #1 { #1 \group_end: } \cs_set_eq:NN \__um_group_begin_frozen: \__um_group_begin: -\cs_set_eq:NN \__um_group_end_frozen: \__um_group_end: +\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: @@ -122,6 +122,10 @@ \char_gset_active_eq:nN {#1} \__um_tmp: \group_end: } +\cs_new_protected:Nn \__um_mathgroup_set:n + { + \tex_fam:D #1 \scan_stop: + } \cs_new:Nn \__um_copy_fontdimen:nnN { \fontdimen #1 \font = \the \fontdimen #2 #3 \relax @@ -132,7 +136,9 @@ } \cs_new_protected:Nn \__um_fontdimen_from_param:nn { - \fontdimen #1 \font = \directlua{fontspec.mathfontdimen(font.current(),"#2")}\relax + \fontdimen #1 \font = + \lua_now:n { fontspec.mathfontdimen(font.current(),"#2") } + \scan_stop: } \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 } } @@ -174,6 +180,7 @@ %%^^A%% Declaration of all code-level variables used in the package. \bool_new:N \l__um_ot_math_bool +\bool_new:N \g__um_main_font_defined_bool \bool_new:N \l__um_init_bool \bool_new:N \l__um_implicit_alph_bool \bool_new:N \g__um_literal_bool @@ -622,6 +629,11 @@ since they relate to input commands not output glyphs. Use `bfit` or `bfup` (etc.) to specify which. } +\__um_msg_new:nn {no-main-font} + { + 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}} + } \char_set_catcode_ignore:n {32} %%^^A%% um-code-usv.dtx -- part of UNICODE-MATH <wspr.io/unicode-math> @@ -1038,6 +1050,33 @@ \mathtt { \cs_set_eq:NN \g__fontspec_mathtt_tl \l__um_tmpa_tl } } } +\cs_set:Npn \use@mathgroup #1 #2 + { + \__um_group_begin: + \cs_if_eq:cNF {M@\f@encoding} #1 {#1} + \__um_switchto_literal: + \__um_mathgroup_set:n {#2} + \__um_group_end:n + } +\cs_set:Npn \operator@font + { + \__um_switchto_literal: + \__um_fontswitch:n { \g__um_operator_mathfont_tl } + } +\cs_set:Nn \__um_fontswitch:n + { + \cs_set_eq:NN \math@bgroup \scan_stop: + \cs_set_eq:NN \__um_group_begin: \scan_stop: + \cs_set:Npn \__um_group_end:n % takes no argument in this case + { + \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@egroup \__um_group_end:n + #1 \scan_stop: + } \cs_generate_variant:Nn \tl_if_eq:nnT {o} \cs_set:Nn \__fontspec_setmainfont_hook:nn { @@ -1133,6 +1172,7 @@ \bool_if:NTF \l__um_init_bool { + \bool_gset_true:N \g__um_main_font_defined_bool \__um_mathparam_store: \__um_log:n {default-math-font} } @@ -1143,7 +1183,7 @@ \AtBeginDocument { \__um_load_lm_if_necessary: } \cs_new:Nn \__um_load_lm_if_necessary: { - \cs_if_exist:NF \l__um_fontname_tl + \bool_if:NF \g__um_main_font_defined_bool { \setmathfont{latinmodern-math.otf} [BoldFont={latinmodern-math.otf}] @@ -1190,7 +1230,7 @@ Renderer = Basic, BoldItalicFont = {}, ItalicFont = {}, Script = Math, - FontAdjustment = { \g__um_luatex_copy_fontdimens_tl }, + FontAdjustment = { \__um_luatex_copy_fontdimens: }, \l__um_unknown_keys_clist } @@ -1233,7 +1273,7 @@ \l__um_sscript_features_tl } } , - FontAdjustment = { \g__um_luatex_copy_fontdimens_tl }, + FontAdjustment = { \__um_luatex_copy_fontdimens: }, \l__um_unknown_keys_clist } @@ -1258,7 +1298,7 @@ \tl_set:Nn \g__um_main_font_cmd_tl { \l__um_font } \tl_set:Nn \g__um_sqrt_font_cmd_tl { \l__um_font } \tl_set:Nn \g__um_prime_font_cmd_tl { \l__um_font } -\tl_const:Nn \g__um_luatex_copy_fontdimens_tl +\cs_new_protected:Nn \__um_luatex_copy_fontdimens: { \__um_fontdimen_from_param:nn {10} {ScriptPercentScaleDown} \__um_fontdimen_from_param:nn {11} {ScriptScriptPercentScaleDown} @@ -1554,6 +1594,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 \__um_range_init: \group_begin: @@ -1637,17 +1678,19 @@ \cs_new_protected:Nn \__um_range_decl:n { \bool_lazy_and:nnTF { \tl_if_single_p:n {#1} } { \token_if_cs_p:N #1 } + % IF A CSNAME: { \tl_if_in:VnTF #1 { \q_unicode_math } { \seq_if_in:NnTF \g__um_mathclasses_seq {#1} { \seq_gput_right:Nn \g__um_mclass_range_seq {#1} } - { \seq_gput_right:Nx \g__um_char_range_seq {#1} } + { \seq_gput_right:Nx \g__um_char_range_seq { #1 } } } { \__um_error:nx {bad-cs-in-range} { \tl_to_str:n {#1} } } } + % ELSE ASSUME NUMERIC INPUT: { - \seq_gput_right:Nx \g__um_char_range_seq {#1} + \seq_gput_right:Nx \g__um_char_range_seq { #1 } } } \cs_new:Nn \__um_if_char_spec:nNT @@ -1857,14 +1900,17 @@ \clist_map_inline:Nn \l__um_alphabet_clist { - \clist_map_inline:cn {g__um_named_slots_ \l__um_style_tl _ ####1 _clist} + \clist_if_exist:cT {g__um_named_slots_ \l__um_style_tl _ ####1 _clist} { - \clist_map_inline:Nn \l__um_mathmap_charints_clist + \clist_map_inline:cn {g__um_named_slots_ \l__um_style_tl _ ####1 _clist} { - \__um_int_if_slot_in_range:nnT {################1} {########1} + \clist_map_inline:Nn \l__um_mathmap_charints_clist { - \seq_gput_right:Nn \g__um_mathalph_seq {##1} - \clist_map_break:n { \clist_map_break:n { \clist_map_break: } } + \__um_int_if_slot_in_range:nnT {################1} {########1} + { + \seq_gput_right:Nn \g__um_mathalph_seq {##1} + \clist_map_break:n { \clist_map_break:n { \clist_map_break: } } + } } } } @@ -2166,56 +2212,21 @@ %%^^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_set:Npn \use@mathgroup #1 #2 - { - \mode_if_math:T % <- not sure if this is really necessary since we've just checked for mmode and raised an error if not! - { - \math@bgroup - \cs_if_eq:cNF {M@\f@encoding} #1 {#1} - \__um_switchto_literal: - \mathgroup #2 \relax - \math@egroup - } - } -\cs_set:Npn \operator@font - { - \__um_switchto_literal: - \__um_fontswitch:n { \g__um_operator_mathfont_tl } - } -\cs_set:Nn \__um_fontswitch:n - { - \mode_if_math:T - { - \cs_set_eq:NN \math@bgroup \scan_stop: - \cs_set_eq:NN \__um_group_begin: \scan_stop: - \cs_set:Npn \__um_group_end: - { - \cs_set_eq:NN \__um_group_begin: \__um_group_begin_frozen: - \cs_set_eq:NN \__um_group_end: \__um_group_end_frozen: - \cs_set_eq:NN \math@bgroup \__ummath@bgroup - \cs_set_eq:NN \math@egroup \__ummath@egroup - } - \cs_set_eq:NN \math@egroup \__um_group_end: - #1 \scan_stop: - } - } \cs_new:Nn \__um_prepare_mathstyle:n { \seq_gput_right:Nn \g__um_mathstyles_seq {#1} \__um_init_alphabet:n {#1} - \cs_set_protected:cpx {sym#1} ##1 + \cs_set_protected:cpx {sym#1} { \__um_group_begin: \exp_not:n { - \mode_if_math:F - { - \exp_args:Nc \non@alpherr {sym#1} - } + \mode_if_math:F { \exp_args:Nc \non@alpherr {sym#1} } \tl_set:Nn \l__um_mathstyle_tl {#1} } - \exp_not:c {__um_switchto_#1:} ##1 - \__um_group_end: + \exp_not:c {__um_switchto_#1:} + \__um_mathgroup_set:n {-1} + \__um_group_end:n } } \cs_set:Nn \__um_init_alphabet:n diff --git a/Master/texmf-dist/tex/latex/unicode-math/unicode-math-xetex.sty b/Master/texmf-dist/tex/latex/unicode-math/unicode-math-xetex.sty index bf50a848004..31c4df21812 100644 --- a/Master/texmf-dist/tex/latex/unicode-math/unicode-math-xetex.sty +++ b/Master/texmf-dist/tex/latex/unicode-math/unicode-math-xetex.sty @@ -43,7 +43,7 @@ %%^^A%% Metadata for the package code, including files and versioning \ProvidesExplPackage{unicode-math-xetex} - {2018/01/13} {v0.8k} {Unicode maths in XeLaTeX and LuaLaTeX} + {2018/02/02} {v0.8l} {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. @@ -57,9 +57,9 @@ \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: -\cs_set_eq:NN \__um_group_end: \group_end: +\cs_set_protected:Npn \__um_group_end:n #1 { #1 \group_end: } \cs_set_eq:NN \__um_group_begin_frozen: \__um_group_begin: -\cs_set_eq:NN \__um_group_end_frozen: \__um_group_end: +\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: @@ -121,6 +121,10 @@ \char_gset_active_eq:nN {#1} \__um_tmp: \group_end: } +\cs_new_protected:Nn \__um_mathgroup_set:n + { + \tex_fam:D #1 \scan_stop: + } \cs_new:Nn \__um_copy_fontdimen:nnN { \fontdimen #1 \font = \the \fontdimen #2 #3 \relax @@ -169,6 +173,7 @@ %%^^A%% Declaration of all code-level variables used in the package. \bool_new:N \l__um_ot_math_bool +\bool_new:N \g__um_main_font_defined_bool \bool_new:N \l__um_init_bool \bool_new:N \l__um_implicit_alph_bool \bool_new:N \g__um_literal_bool @@ -616,6 +621,11 @@ since they relate to input commands not output glyphs. Use `bfit` or `bfup` (etc.) to specify which. } +\__um_msg_new:nn {no-main-font} + { + 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}} + } \char_set_catcode_ignore:n {32} %%^^A%% um-code-usv.dtx -- part of UNICODE-MATH <wspr.io/unicode-math> @@ -1032,6 +1042,33 @@ \mathtt { \cs_set_eq:NN \g__fontspec_mathtt_tl \l__um_tmpa_tl } } } +\cs_set:Npn \use@mathgroup #1 #2 + { + \__um_group_begin: + \cs_if_eq:cNF {M@\f@encoding} #1 {#1} + \__um_switchto_literal: + \__um_mathgroup_set:n {#2} + \__um_group_end:n + } +\cs_set:Npn \operator@font + { + \__um_switchto_literal: + \__um_fontswitch:n { \g__um_operator_mathfont_tl } + } +\cs_set:Nn \__um_fontswitch:n + { + \cs_set_eq:NN \math@bgroup \scan_stop: + \cs_set_eq:NN \__um_group_begin: \scan_stop: + \cs_set:Npn \__um_group_end:n % takes no argument in this case + { + \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@egroup \__um_group_end:n + #1 \scan_stop: + } \cs_generate_variant:Nn \tl_if_eq:nnT {o} \cs_set:Nn \__fontspec_setmainfont_hook:nn { @@ -1127,6 +1164,7 @@ \bool_if:NTF \l__um_init_bool { + \bool_gset_true:N \g__um_main_font_defined_bool \__um_log:n {default-math-font} } { @@ -1135,7 +1173,7 @@ \AtBeginDocument { \__um_load_lm_if_necessary: } \cs_new:Nn \__um_load_lm_if_necessary: { - \cs_if_exist:NF \l__um_fontname_tl + \bool_if:NF \g__um_main_font_defined_bool { \setmathfont{latinmodern-math.otf} [BoldFont={latinmodern-math.otf}] @@ -1457,6 +1495,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 \__um_range_init: \group_begin: @@ -1540,17 +1579,19 @@ \cs_new_protected:Nn \__um_range_decl:n { \bool_lazy_and:nnTF { \tl_if_single_p:n {#1} } { \token_if_cs_p:N #1 } + % IF A CSNAME: { \tl_if_in:VnTF #1 { \q_unicode_math } { \seq_if_in:NnTF \g__um_mathclasses_seq {#1} { \seq_gput_right:Nn \g__um_mclass_range_seq {#1} } - { \seq_gput_right:Nx \g__um_char_range_seq {#1} } + { \seq_gput_right:Nx \g__um_char_range_seq { #1 } } } { \__um_error:nx {bad-cs-in-range} { \tl_to_str:n {#1} } } } + % ELSE ASSUME NUMERIC INPUT: { - \seq_gput_right:Nx \g__um_char_range_seq {#1} + \seq_gput_right:Nx \g__um_char_range_seq { #1 } } } \cs_new:Nn \__um_if_char_spec:nNT @@ -1788,14 +1829,17 @@ \clist_map_inline:Nn \l__um_alphabet_clist { - \clist_map_inline:cn {g__um_named_slots_ \l__um_style_tl _ ####1 _clist} + \clist_if_exist:cT {g__um_named_slots_ \l__um_style_tl _ ####1 _clist} { - \clist_map_inline:Nn \l__um_mathmap_charints_clist + \clist_map_inline:cn {g__um_named_slots_ \l__um_style_tl _ ####1 _clist} { - \__um_int_if_slot_in_range:nnT {################1} {########1} + \clist_map_inline:Nn \l__um_mathmap_charints_clist { - \seq_gput_right:Nn \g__um_mathalph_seq {##1} - \clist_map_break:n { \clist_map_break:n { \clist_map_break: } } + \__um_int_if_slot_in_range:nnT {################1} {########1} + { + \seq_gput_right:Nn \g__um_mathalph_seq {##1} + \clist_map_break:n { \clist_map_break:n { \clist_map_break: } } + } } } } @@ -2097,56 +2141,21 @@ %%^^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_set:Npn \use@mathgroup #1 #2 - { - \mode_if_math:T % <- not sure if this is really necessary since we've just checked for mmode and raised an error if not! - { - \math@bgroup - \cs_if_eq:cNF {M@\f@encoding} #1 {#1} - \__um_switchto_literal: - \mathgroup #2 \relax - \math@egroup - } - } -\cs_set:Npn \operator@font - { - \__um_switchto_literal: - \__um_fontswitch:n { \g__um_operator_mathfont_tl } - } -\cs_set:Nn \__um_fontswitch:n - { - \mode_if_math:T - { - \cs_set_eq:NN \math@bgroup \scan_stop: - \cs_set_eq:NN \__um_group_begin: \scan_stop: - \cs_set:Npn \__um_group_end: - { - \cs_set_eq:NN \__um_group_begin: \__um_group_begin_frozen: - \cs_set_eq:NN \__um_group_end: \__um_group_end_frozen: - \cs_set_eq:NN \math@bgroup \__ummath@bgroup - \cs_set_eq:NN \math@egroup \__ummath@egroup - } - \cs_set_eq:NN \math@egroup \__um_group_end: - #1 \scan_stop: - } - } \cs_new:Nn \__um_prepare_mathstyle:n { \seq_gput_right:Nn \g__um_mathstyles_seq {#1} \__um_init_alphabet:n {#1} - \cs_set_protected:cpx {sym#1} ##1 + \cs_set_protected:cpx {sym#1} { \__um_group_begin: \exp_not:n { - \mode_if_math:F - { - \exp_args:Nc \non@alpherr {sym#1} - } + \mode_if_math:F { \exp_args:Nc \non@alpherr {sym#1} } \tl_set:Nn \l__um_mathstyle_tl {#1} } - \exp_not:c {__um_switchto_#1:} ##1 - \__um_group_end: + \exp_not:c {__um_switchto_#1:} + \__um_mathgroup_set:n {-1} + \__um_group_end:n } } \cs_set:Nn \__um_init_alphabet:n @@ -3525,7 +3534,7 @@ { \box_ht:N \l_tmpa_box - \__um_radical_vgap:N #1 } - \box_use_clear:N \l_tmpa_box + \box_use_drop:N \l_tmpa_box } } \AtEndOfPackageFile * { mathtools } @@ -3679,7 +3688,7 @@ { \box_use:N \rootbox } \__um_mathstyle_scale:NnnN #1 { \kern } { \fontdimen 64 \g__um_sqrt_font_cmd_tl } \g__um_sqrt_font_cmd_tl \mkern \leftroot@ mu - \box_use_clear:N \l_tmpa_box + \box_use_drop:N \l_tmpa_box } } @@ -3721,7 +3730,7 @@ } { \box_use:N \rootbox } \__um_mathstyle_scale:NnnN ##1 { \kern } { \fontdimen 64 \g__um_sqrt_font_cmd_tl } \g__um_sqrt_font_cmd_tl - \box_use_clear:N \l_tmpa_box + \box_use_drop:N \l_tmpa_box } } \cs_new:Nn \__um_which_frac:nn diff --git a/Master/texmf-dist/tex/latex/unicode-math/unicode-math.sty b/Master/texmf-dist/tex/latex/unicode-math/unicode-math.sty index 24cc8e1f4b0..1d111d77bd6 100644 --- a/Master/texmf-dist/tex/latex/unicode-math/unicode-math.sty +++ b/Master/texmf-dist/tex/latex/unicode-math/unicode-math.sty @@ -24,7 +24,7 @@ \RequirePackage{expl3} \ProvidesExplPackage{unicode-math} - {2018/01/13} {v0.8k} {Unicode maths in XeLaTeX and LuaLaTeX} + {2018/02/02} {v0.8l} {Unicode maths in XeLaTeX and LuaLaTeX} \sys_if_engine_luatex:T { \RequirePackageWithOptions{unicode-math-luatex} } \sys_if_engine_xetex:T { \RequirePackageWithOptions{unicode-math-xetex} } \sys_if_engine_pdftex:T |