Set mathvariant to avoid automatic italic

This commit is contained in:
Marcel Fabian Krüger 2021-04-19 17:29:08 +02:00
parent 7ca21203ac
commit 3cb9600964

View File

@ -28,7 +28,7 @@ local function kernel_to_table(kernel, cur_style)
local char = kernel.char local char = kernel.char
local elem = char >= 0x30 and char < 0x39 and 'mn' or 'mi' local elem = char >= 0x30 and char < 0x39 and 'mn' or 'mi'
local fam = kernel.fam local fam = kernel.fam
return {[0] = elem, utf8.char(kernel.char), ['tex:family'] = fam ~= 0 and fam or nil } return {[0] = elem, utf8.char(kernel.char), ['tex:family'] = fam ~= 0 and fam or nil, mathvariant = char < 0x10000 and 'normal' or nil }
elseif id == sub_box_t then elseif id == sub_box_t then
return {[0] = 'mi', {[0] = 'mglyph', ['tex:box'] = kernel.list}} return {[0] = 'mi', {[0] = 'mglyph', ['tex:box'] = kernel.list}}
elseif id == sub_mlist_t then elseif id == sub_mlist_t then
@ -64,6 +64,7 @@ local function noad_to_table(noad, sub, cur_style)
-- TODO -- TODO
else else
nucleus[0] = 'mo' nucleus[0] = 'mo'
if nucleus.mathvariant == 'normal' then nucleus.mathvariant = nil end
end end
nucleus['tex:class'] = class nucleus['tex:class'] = class
@ -101,6 +102,7 @@ local function accent_to_table(accent, sub, cur_style)
local bot_acc = kernel_to_table(accent.bot_accent, cur_style) local bot_acc = kernel_to_table(accent.bot_accent, cur_style)
if top_acc then if top_acc then
top_acc[0] = 'mo' top_acc[0] = 'mo'
if top_acc.mathvariant == 'normal' then top_acc.mathvariant = nil end
if sub & 1 == 1 then if sub & 1 == 1 then
top_acc.stretchy = 'false' top_acc.stretchy = 'false'
end end
@ -108,6 +110,7 @@ local function accent_to_table(accent, sub, cur_style)
end end
if bot_acc then if bot_acc then
bot_acc[0] = 'mo' bot_acc[0] = 'mo'
if bot_acc.mathvariant == 'normal' then bot_acc.mathvariant = nil end
if sub & 2 == 2 then if sub & 2 == 2 then
bot_acc.stretchy = 'false' bot_acc.stretchy = 'false'
end end