2 % lltjp-unicode-math.sty
5 \NeedsTeXFormat{LaTeX2e}
6 \ProvidesPackage{lltjp-unicode-math}[2015/10/28 Patch to unicode-math for LuaTeX-ja]
8 \RequirePackage{unicode-math,luatexja}
13 \bool_new:N \lltjp_um_patch_mathgroup_bool
14 \@ifpackagelater{unicode-math}{2015/09/24}{%
15 %%%%%%%% 2015/09/24 0.8c
16 \bool_set_true:N \lltjp_um_patch_mathgroup_bool
17 \cs_gset:Nn \__um_define_math_chars: {
19 \cs_set:Npn \__um_sym:nnn ##1##2##3
22 { \mathord \mathalpha \mathbin \mathrel \mathpunct \mathop \mathfence }
25 \exp_last_unbraced:NNx \cs_gset_eq:NN ##2 { \Ucharcat ##1 ~ 12 ~ }
26 \ltjsetmathletter{ ##1 }
29 \__um_input_math_symbol_table:
33 \cs_if_exist:cTF { __um_cs_set_eq_active_char:Nw } {
34 \tl_set:Nn \l_tmpa_tl { __um_cs_set_eq_active_char:Nw }
35 \bool_set_true:N \lltjp_um_patch_mathgroup_bool
37 \tl_set:Nn \l_tmpa_tl { um_cs_set_eq_active_char:Nw }
39 \cs_gset:cpn { \tl_use:N \l_tmpa_tl } #1 = "#2 \q_nil {%"
41 %\typeout {um: \string#1, \int_from_hex:n {#2}, #2}% <- for debug
42 \char_set_lccode:nn { `! } { "#2 }%"
44 \tl_set:Nn \l_tmpa_tl { \relax
45 \ifmmode!\else{\directlua{tex.globaldefs = 0}\ltj@allalchar!}\fi}
46 \cs_gset_eq:NN #1 \l_tmpa_tl
48 \ltjsetmathletter{ \int_from_hex:n {#2} }
53 \bool_if:NT \lltjp_um_patch_mathgroup_bool {
54 \cs_gset:Npn \use@mathgroup #1 #2
56 \mode_if_math:T % <- not sure if this is really necessary since we've just checked for mmode and raised an error if not!
59 \cs_if_eq:cNF {M@\f@encoding} #1 {#1}
60 \__um_switchto_literal:
61 \ltj@tempcnta=#2 \expandafter\ltj@@mathJapaneseFonts\string#1\relax%
62 \ifin@ \jfam #2 \relax \else \mathgroup #2 \relax \fi