リビジョン | 5b9f51e9f262df7fe3adea0956afb59ba9d2dede (tree) |
---|---|
日時 | 2011-11-22 08:56:50 |
作者 | Hironori Kitagawa <h_kitagawa2001@yaho...> |
コミッター | Hironori Kitagawa |
Improve lltjp-unicode-math.sty and fix pretreat.lua.
@@ -17,11 +17,13 @@ require('luatexja.stack'); local ltjs = luatexja.stack | ||
17 | 17 | local has_attr = node.has_attribute |
18 | 18 | local set_attr = node.set_attribute |
19 | 19 | local unset_attr = node.unset_attribute |
20 | +local node_type = node.type | |
20 | 21 | local node_remove = node.remove |
21 | 22 | local node_next = node.next |
22 | 23 | local node_free = node.free |
23 | 24 | |
24 | 25 | local id_glyph = node.id('glyph') |
26 | +local id_math = node.id('math') | |
25 | 27 | local id_whatsit = node.id('whatsit') |
26 | 28 | local sid_user = node.subtype('user_defined') |
27 | 29 |
@@ -39,21 +41,26 @@ box_stack_level = 0 | ||
39 | 41 | -- This is used in jfmglue.lua. |
40 | 42 | |
41 | 43 | local function suppress_hyphenate_ja(head) |
42 | - for p in node.traverse_id(id_glyph, head) do | |
43 | - local i = has_attr(p, attr_icflag) or 0 | |
44 | - if i==0 and ltjc.is_ucs_in_japanese_char(p) then | |
45 | - local v = has_attr(p, attr_curjfnt) | |
46 | - if v then | |
47 | - p.font = v | |
44 | + local non_math = true | |
45 | + for p in node.traverse(head) do | |
46 | + if p.id == id_glyph and non_math then | |
47 | + local i = has_attr(p, attr_icflag) or 0 | |
48 | + if i==0 and ltjc.is_ucs_in_japanese_char(p) then | |
49 | + local v = has_attr(p, attr_curjfnt) | |
50 | + if v then | |
51 | + p.font = v | |
52 | + end | |
53 | + v = has_attr(p, attr_ykblshift) | |
54 | + if v then | |
55 | + set_attr(p, attr_yablshift, v) | |
56 | + else | |
57 | + unset_attr(p, attr_yablshift) | |
58 | + end | |
59 | + if p.subtype%2==1 then p.subtype = p.subtype - 1 end | |
60 | + -- p.lang=lang_ja | |
48 | 61 | end |
49 | - v = has_attr(p, attr_ykblshift) | |
50 | - if v then | |
51 | - set_attr(p, attr_yablshift, v) | |
52 | - else | |
53 | - unset_attr(p, attr_yablshift) | |
54 | - end | |
55 | - if p.subtype%2==1 then p.subtype = p.subtype - 1 end | |
56 | - -- p.lang=lang_ja | |
62 | + elseif p.id == id_math then | |
63 | + non_math = (p.subtype ~= 0) | |
57 | 64 | end |
58 | 65 | end |
59 | 66 | lang.hyphenate(head) |
@@ -23,4 +23,14 @@ | ||
23 | 23 | \mathchar@type#2 \csname sym#3\endcsname \int_eval:n {#4} \scan_stop: |
24 | 24 | \directlua{luatexja.math.is_math_letters[\int_eval:n {#4}]=true} |
25 | 25 | } |
26 | +\group_begin: | |
27 | + \char_set_catcode_other:N \^ | |
28 | + \gdef\q{hoge}\gdef\r{piyo} | |
29 | + \cs_gset:Npn \um_cs_set_eq_active_char:Nw #1 = "#2 \q_nil {%" | |
30 | + \tl_set:Nn \l_tmpa_tl {\ifmmode\char"#2\else\ltjalchar"#2\relax\fi} | |
31 | + \cs_gset_eq:NN #1 \l_tmpa_tl | |
32 | + } | |
33 | +\group_end: | |
34 | + | |
35 | +\ExplSyntaxOff | |
26 | 36 | \endinput |
@@ -67,7 +67,6 @@ | ||
67 | 67 | \expandafter\expandafter\expandafter |
68 | 68 | {\expandafter\csname#6\endcsname}{\UTFchar}{#8}{#9}\relax |
69 | 69 | \fi} |
70 | -%\gdef\add@UTF@accent#1#2#3{#2\ltjalchar"#1\relax} | |
71 | 70 | \gdef\add@UTF@accent#1#2#3{\ifx\relax#2\relax\ltjalchar"#3\else |
72 | 71 | \ifx\ #2\relax\ltjalchar"#3\else |
73 | 72 | \expandafter\ifx\UTF@space#2\relax\ltjalchar"#3\else |
@@ -19,6 +19,16 @@ | ||
19 | 19 | =\frac16\cdot \pi\times\pi,\qquad a_1,\dots,a_n. |
20 | 20 | \] |
21 | 21 | |
22 | +$ | |
23 | + \frac1{1^2}+\frac1{2^2}+\cdots= | |
24 | +\sum_{n=1}^\infty \frac1{n^s\zeta}=\zeta(2)=\frac{\pi^2}{6} | |
25 | +=\frac16\cdot \pi\times\pi,\qquad a_1,\dots,a_n. \hbar | |
26 | +$ | |
27 | + | |
28 | +{\tt\meaning\sum} | |
29 | + | |
22 | 30 | |
23 | -○×○漢×漢\times え\ltjjachar`\“え\ltjalchar`\“え\textquotedblleft え“え←数式外では和文文字扱いのままになっている. | |
31 | +○×○漢\ltjjachar`\×漢\ltjalchar`\×漢\times 漢 | |
32 | +え\ltjjachar`\“え\ltjalchar`\“え\textquotedblleft え“え | |
33 | +←数式外では和文文字扱いのままになっている. | |
24 | 34 | \end{document} |