[tex4ht] Problem using mjcli on Cygwin

Michal Hoftich michal.h21 at gmail.com
Fri Apr 2 21:03:19 CEST 2021


Dear Francis,

ah I see. It seems that I was wrong, mjcli uses MathML by default. When 
you use the "mathjax" option, it uses the LaTeX math syntax for the 
command line MathJax, but it doesn't remove the MathJax <script> element 
from the HTML file. You can remove the MathJax <script> using following 
.mk4 build file:

--------------------------------------
local domfilter = require "make4ht-domfilter"

local process = domfilter {
   function(dom)
     for _, el in ipairs(dom:query_selector("#MathJax-script")) do
       el:remove_node()
     end
     return dom
   end
}

Make:match("html$", process)
------------------------------------

Then there is the issue with MathML. It seems that there is an issue 
with the LaTeX to MathML conversion in your case, so several things 
fail.

First, make4ht process MathML and fixes some common issues. It fails, as 
it reports the issue "Unbalanced Tag (/mstyle)". I suppose that the 
mjcli error is caused by the invalid MathML too.

Could you try to make a MWE that runs into this issue? As I said, there 
can be some issues that need to be fixed in the LaTeX source in the 
worst cases.

Best regards,
Michal


>I didn't explicitly use the "mathml" option. I wanted to use LaTeX 
>input to MathJax (because I've had problems with the MathML generated 
>by TeX4ht before), so I originally used the mathjax option, but that 
>included MathJax <script> elements in the generated HTML files, so you 
>advised me not to use it. I assumed that make4ht would then use MathML 
>because your document "The make4ht build system", Version v0.3g, says 
>in section 7.6 that:
>-----
>mjcli detects whether to use MathML or LATEX input by use of the mathjax
>option for make4ht. By default, it uses MathML. LATEX input can be required
>using:
>make4ht -f html5+mjcli filename.tex "mathjax"
>-----
>
>I used the command
>
>make4ht -f html5+mjcli manual reduce,3,xhtml " -cunihtf -utf8" -cvalidate
>
>At the end of the run, make4ht reported several errors that all have this form:
>-----
>[WARNING] domfilter: DOM parsing of manualse28.html failed:
>[WARNING] domfilter: ...ive/2020/texmf-dist/tex/luatex/luaxml/luaxml-mod-xml.lua:175: Unbalanced Tag (/mstyle) [char=51491]
>
>D:\Program Files\mjcli-main\node_modules\mathjax-full\js\core\HandlerList.js:58
>        throw new Error("Can't find handler for document");
>        ^
>
>Error: Can't find handler for document
>    at HandlerList.handlesDocument (D:\Program Files\mjcli-main\node_modules\mathjax-full\js\core\HandlerList.js:58:15)
>    at HandlerList.document (D:\Program Files\mjcli-main\node_modules\mathjax-full\js\core\HandlerList.js:62:21)
>    at Object.document (D:\Program Files\mjcli-main\node_modules\mathjax-full\js\mathjax.js:10:41)
>    at Object.<anonymous> (D:\Program Files\mjcli-main\bin\mjcli.js:127:22)
>    at Module._compile (internal/modules/cjs/loader.js:1063:30)
>    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
>    at Module.load (internal/modules/cjs/loader.js:928:32)
>    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
>    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
>    at internal/main/run_main_module.js:17:47
>-----
>Each of the HTML files referenced in a similar message is empty and the other messages reference the tags /msup, /mrow, and /munderover, which all look to me like MathML tags.
>
>On the non-empty output pages, some of the maths looks fine but some if it is rendered noticeably differently from the version rendered by MathJax running in a browser. The maths all looks slightly bigger, some brackets are too tall, and the calligraphic font looks very different. In fact, I'm wondering whether the browser is picking up the wrong font files. I haven't investigated further yet.
>
>Francis
>


More information about the tex4ht mailing list.