• R/O
  • HTTP
  • SSH
  • HTTPS

luatexja: コミット

ソースコードの管理場所


コミットメタ情報

リビジョン5b9f51e9f262df7fe3adea0956afb59ba9d2dede (tree)
日時2011-11-22 08:56:50
作者Hironori Kitagawa <h_kitagawa2001@yaho...>
コミッターHironori Kitagawa

ログメッセージ

Improve lltjp-unicode-math.sty and fix pretreat.lua.

変更サマリ

差分

--- a/src/luatexja/pretreat.lua
+++ b/src/luatexja/pretreat.lua
@@ -17,11 +17,13 @@ require('luatexja.stack'); local ltjs = luatexja.stack
1717 local has_attr = node.has_attribute
1818 local set_attr = node.set_attribute
1919 local unset_attr = node.unset_attribute
20+local node_type = node.type
2021 local node_remove = node.remove
2122 local node_next = node.next
2223 local node_free = node.free
2324
2425 local id_glyph = node.id('glyph')
26+local id_math = node.id('math')
2527 local id_whatsit = node.id('whatsit')
2628 local sid_user = node.subtype('user_defined')
2729
@@ -39,21 +41,26 @@ box_stack_level = 0
3941 -- This is used in jfmglue.lua.
4042
4143 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
4861 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)
5764 end
5865 end
5966 lang.hyphenate(head)
--- a/src/patches/lltjp-unicode-math.sty
+++ b/src/patches/lltjp-unicode-math.sty
@@ -23,4 +23,14 @@
2323 \mathchar@type#2 \csname sym#3\endcsname \int_eval:n {#4} \scan_stop:
2424 \directlua{luatexja.math.is_math_letters[\int_eval:n {#4}]=true}
2525 }
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
2636 \endinput
--- a/src/patches/lltjp-xunicode.sty
+++ b/src/patches/lltjp-xunicode.sty
@@ -67,7 +67,6 @@
6767 \expandafter\expandafter\expandafter
6868 {\expandafter\csname#6\endcsname}{\UTFchar}{#8}{#9}\relax
6969 \fi}
70-%\gdef\add@UTF@accent#1#2#3{#2\ltjalchar"#1\relax}
7170 \gdef\add@UTF@accent#1#2#3{\ifx\relax#2\relax\ltjalchar"#3\else
7271 \ifx\ #2\relax\ltjalchar"#3\else
7372 \expandafter\ifx\UTF@space#2\relax\ltjalchar"#3\else
Binary files a/test/test07-math-unicode.pdf and b/test/test07-math-unicode.pdf differ
--- a/test/test07-math-unicode.tex
+++ b/test/test07-math-unicode.tex
@@ -19,6 +19,16 @@
1919 =\frac16\cdot \pi\times\pi,\qquad a_1,\dots,a_n.
2020 \]
2121
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+
2230
23-○×○漢×漢\times え\ltjjachar`\“え\ltjalchar`\“え\textquotedblleft え“え←数式外では和文文字扱いのままになっている.
31+○×○漢\ltjjachar`\×漢\ltjalchar`\×漢\times 漢
32+え\ltjjachar`\“え\ltjalchar`\“え\textquotedblleft え“え
33+←数式外では和文文字扱いのままになっている.
2434 \end{document}
旧リポジトリブラウザで表示