--
--- luatexja/math.lua
+-- luatexja/ltj-math.lua
--
-luatexbase.provides_module({
- name = 'luatexja.math',
- date = '2012/07/19',
- version = '0.2',
- description = 'Handling routines for Japanese characters in math mode',
-})
-module('luatexja.math', package.seeall)
luatexja.load_module('base'); local ltjb = luatexja.base
luatexja.load_module('charrange'); local ltjc = luatexja.charrange
local id_simple = node.id('noad')
local id_sub_mlist = node.id('sub_mlist')
-local PROCESSED = 11
+local PROCESSED = luatexja.icflag_table.PROCESSED
local ltjf_font_metric_table = ltjf.font_metric_table
local ltjf_find_char_class = ltjf.find_char_class
-- table of mathematical characters
-is_math_letters = {}
+local is_math_letters = {}
local conv_jchar_to_hbox_A
return head
end
+local MJT = luatexja.stack_table_index.MJT
+local MJS = luatexja.stack_table_index.MJS
+local MJSS = luatexja.stack_table_index.MJSS
+
conv_jchar_to_hbox_A =
function (p, sty)
if not p then return nil
elseif p.id == id_mchar then
local fam = has_attr(p, attr_jfam) or -1
if (not is_math_letters[p.char]) and ltjc.is_ucs_in_japanese_char(p) and fam>=0 then
- local mode = 'mjss'
- if sty == 0 then mode = 'mjtext'
- elseif sty == 1 then mode = 'mjscr'
- end
- local f = ltjs.get_penalty_table(mode, fam, -1, tex_getcount('ltj@@stack'))
+ local f = ltjs.get_penalty_table(MJT + 0x100 * sty + fam, -1, tex_getcount('ltj@@stack'))
if f ~= -1 then
local q = node_new(id_sub_box)
local r = node_new(id_glyph); r.next = nil
head = node.mlist_to_hlist(head, display_type, penalties)
return head
end,'ltj.mlist_to_hlist', 1)
+
+luatexja.math = { is_math_letters = is_math_letters }