OSDN Git Service

0b6e556373318e8f20a197fd65f9b79f7e094baf
[luatex-ja/luatexja.git] / src / patches / lltjp-unicode-math.sty
1 %
2 % lltjp-unicode-math.sty
3 %
4
5 \NeedsTeXFormat{LaTeX2e}
6 \ProvidesPackage{lltjp-unicode-math}[2015/08/27 Patch to unicode-math for LuaTeX-ja]
7
8 \RequirePackage{unicode-math,luatexja}
9
10 \ExplSyntaxOn
11
12 \group_begin:
13   \tl_set:Nn \l_tmpa_tl { um_cs_set_eq_active_char:Nw }
14   \cs_if_exist:cT { __um_cs_set_eq_active_char:Nw } {
15     \tl_set:Nn \l_tmpa_tl { __um_cs_set_eq_active_char:Nw }
16     \cs_gset:Npn \use@mathgroup #1 #2
17      {
18       \mode_if_math:T % <- not sure if this is really necessary since we've just checked for mmode and raised an error if not!
19        {
20         \math@bgroup
21           \cs_if_eq:cNF {M@\f@encoding} #1 {#1}
22           \__um_switchto_literal:
23           \ltj@tempcnta=#2 \expandafter\ltj@@mathJapaneseFonts\string#1\relax%
24           \ifin@ \jfam #2 \relax \else \mathgroup #2 \relax \fi
25         \math@egroup
26        }
27      }
28   }
29   \cs_gset:cpn { \tl_use:N \l_tmpa_tl } #1 = "#2 \q_nil {%"
30     \group_begin:
31       %\typeout {um: \string#1, \int_from_hexadecimal:n {#2}, #2}% <- for debug
32       \char_set_lccode:nn { `! } { "#2 }%"
33       \tex_lowercase:D {
34         \tl_set:Nn \l_tmpa_tl {  \relax
35           \ifmmode!\else{\directlua{tex.globaldefs = 0}\ltj@allalchar!}\fi}
36         \cs_gset_eq:NN #1 \l_tmpa_tl
37       }
38       \ltjsetmathletter{ \int_from_hexadecimal:n {#2} }
39     \group_end:
40   }
41 \group_end:
42
43 \ExplSyntaxOff
44
45 \endinput