diff --git a/luamml-tex.lua b/luamml-tex.lua index 1dd3eb2..c76d1f7 100644 --- a/luamml-tex.lua +++ b/luamml-tex.lua @@ -40,6 +40,9 @@ local mlist_result local function save_result(xml, style) mlist_result = write_xml(make_root(xml, style)) + if tex.count.tracingmathml > 1 then + texio.write_nl(mlist_result .. '\n') + end end luatexbase.add_to_callback('pre_mlist_to_hlist_filter', function(mlist, style) @@ -87,6 +90,9 @@ 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 + if tex.count.tracingmathml == 1 then + texio.write_nl(mlist_result .. '\n') + end tex.sprint(-2, tostring(pdf.immediateobj('stream', mlist_result, '/Subtype/application#2Fmathml+xml' .. token.scan_argument(true)))) mlist_result = nil end diff --git a/luamml.sty b/luamml.sty index d78d4a2..d9ef869 100644 --- a/luamml.sty +++ b/luamml.sty @@ -2,6 +2,7 @@ {Feel free to add a description here} \int_new:N \l__luamml_flag_int +\int_new:N \tracingmathml \lua_now:n { require'luamml-tex' } \cs_new:Nn \luamml_flag_save: { diff --git a/test_tex.tex b/test_tex.tex index 18b1c24..90f3d7e 100644 --- a/test_tex.tex +++ b/test_tex.tex @@ -6,6 +6,7 @@ \RegisterFamilyMapping\symletters{oml} \RegisterFamilyMapping\symlargesymbols{omx} \ExplSyntaxOn +\tracingmathml2 \pdfvariable compresslevel0 \cs_new_protected:Npn \ShowMathMLObj { \message { \luamml_get_last_mathml_stream:e{}~0~R }