Reproducible output

This commit is contained in:
Marcel Fabian Krüger 2021-04-26 16:01:57 +02:00
parent 91ac3ca2fa
commit 3995c7ae05
4 changed files with 31 additions and 5 deletions

View File

@ -41,11 +41,32 @@ local remap_oms = { [0] =
0x1D4B3, 0x1D4B4, 0x1D4B5, 0x222A, 0x2229, 0x228E, 0x2227, 0x2228,
0x22A2, 0x22A3, 0x230A, 0x230B, 0x2308, 0x2309, 0x7B, 0x7D,
0x27E8, 0x27E9, 0x7C, 0x2016, 0x2195, 0x21D5, 0x5C, 0x2240,
0x221A, 0x2210, 0x2207, 0x222B, 0x2294, 0x2293, 0x2291, 0x2292,
0x221A, 0x2A3F, 0x2207, 0x222B, 0x2294, 0x2293, 0x2291, 0x2292,
0xA7, 0x2020, 0x2021, 0xB6, 0x2663, 0x2662, 0x2661, 0x2660,
}
-- We are not remapping symbols which are only used as large variants
local remap_omx = { [0] =
nil, nil, nil, nil, nil, nil, nil, nil,
nil, nil, nil, nil, nil, nil, nil, nil,
nil, nil, nil, nil, nil, nil, nil, nil,
nil, nil, nil, nil, nil, nil, nil, nil,
nil, nil, nil, nil, nil, nil, nil, nil,
nil, nil, nil, nil, nil, nil, nil, nil,
nil, nil, nil, nil, nil, nil, nil, nil,
nil, nil, 0x27EE, 0x27EF, nil, nil, nil, nil,
nil, nil, nil, nil, nil, nil, 0x2A06, nil,
0x222E, nil, 0x2A00, nil, 0x2A01, nil, 0x2A02, nil,
0x2211, 0x220F, 0x222B, 0x22C3, 0x22C2, 0x2A04, 0x22C0, 0x22C1,
nil, nil, nil, nil, nil, nil, nil, nil,
0x2210, nil, 0x5E, 0x5E, 0x5E, 0x7E, 0x7E, 0x7E,
nil, nil, nil, nil, nil, nil, nil, nil,
nil, nil, nil, nil, nil, nil, nil, nil,
nil, nil, 0x23B0, 0x23B1, nil, nil, nil, nil,
}
return {
oml = remap_oml,
oms = remap_oms,
omx = remap_omx,
}

View File

@ -87,7 +87,7 @@ lua.get_functions_table()[funcid] = function()
"I was asked to provide MathML code for the last formula, but there weren't any new formulas since you last asked."
})
end
tex.sprint(-2, tostring(pdf.immediateobj('stream', mlist_result, '/Subtype /application#2Fmathml+xml\n' .. token.scan_argument(true))))
tex.sprint(-2, tostring(pdf.immediateobj('stream', mlist_result, '/Subtype/application#2Fmathml+xml' .. token.scan_argument(true))))
mlist_result = nil
end

View File

@ -13,14 +13,18 @@ local function escape_text(text)
return string.gsub(tostring(text), '("<>&)', escapes)
end
local attrs = {}
local function write_elem(tree, indent)
if not tree[0] then print('ERR', require'inspect'(tree)) end
local escaped_name = escape_name(assert(tree[0]))
local out = "<" .. escaped_name
if indent then out = indent .. out end
local i = 0
for attr, val in next, tree do if type(attr) == 'string' then
out = out .. ' ' .. escape_name(attr) .. '="' .. escape_text(val) .. '"'
i = i + 1
attrs[i] = string.format(' %s="%s"', escape_name(attr), escape_text(val))
end end
table.sort(attrs)
local out = string.format('%s<%s%s', indent or '', escaped_name, table.concat(attrs))
for j = 1, i do attrs[j] = nil end
if not tree[1] then
return out .. '/>'
end

View File

@ -4,6 +4,7 @@
\usepackage{luamml}
\RegisterFamilyMapping\symsymbols{oms}
\RegisterFamilyMapping\symletters{oml}
\RegisterFamilyMapping\symlargesymbols{omx}
\ExplSyntaxOn
\pdfvariable compresslevel0
\cs_new_protected:Npn \ShowMathMLObj {