3

My MWE is:

\documentclass{article} 
\usepackage{amsmath}

\begin{document}
\[
\boxed{A} \boxed{B}
\]
\end{document}

When I compile using pdflatex I got the two boxes side by side, but when compiling with something like make4ht test.tex "mathml, mathjax" only the first box is rendered right. This only occurs when using mathml, if I compile using make4ht test.tex "mathjax" everything is right.

1
  • 1
    I can reproduce the problem, with mathml the boxes are wrong and there is a warning [WARNING] domfilter: .../texlive/texmf-dist/tex/luatex/luaxml/luaxml-mod-xml.lua:175: Unbalanced Tag (/mrow) [char=816] during compilation.
    – Marijn
    Jan 30 at 15:36

1 Answer 1

2

You can see that something went wrong from this warning message during the compilation:

[WARNING] domfilter: /home/mint/texmf/scripts/lua/LuaXML/luaxml-mod-xml.lua:175: Unbalanced Tag (/mrow) [char=847]

This means the generated HTML code contains some severe error and may look wrong.

The generated HTML + MathML code is following:

   <table class="equation-star"><tr><td>
<!--l. 5--><math 
 xmlns="http://www.w3.org/1998/Math/MathML"  
display="block" class="equation">
<menclose notation="box"><mrow>   <mi 
>A</mi>                                                             </mrow></menclose><menclose notation="box"><mrow><!--l. 6--><p class="indent" >   <mi 
>B</mi>                                                             </mrow></menclose>
</math></p></td></tr></table>

The problem is this tag inserted into MathML: <p class="indent" >. It shouldn't be there. Fortunatelly, we can block it easily by the following configuration for boxed:

\Preamble{xhtml}

\catcode`\:=11
\Configure{boxed}
   {\ifmathml \Tg<\a:mathml menclose \a:mathml notation="box">\Tg<\a:mathml mrow>%
    \else     \HCode{<span class="boxed">}\fi\IgnorePar}
   {\ifmathml \Tg</\a:mathml mrow>\Tg</\a:mathml menclose>%
    \else \HCode{</span>}\fi}
\catcode`\:=12
\begin{document}
\EndPreamble

It reuses the original TeX4ht code. The only change is that we use the \IgnorePar command in the second argument. It should prevent the insertion of the spurious <p> tag.

The result is correct with this change:

  <table class='equation-star'><tr><td>
<!-- l. 5 --><math class='equation' display='block' xmlns='http://www.w3.org/1998/Math/MathML'><mrow>
<menclose notation='box'><mrow>   <mi>A</mi>                                                             </mrow></menclose><menclose notation='box'><mrow>   <mi>B</mi>                                                             </mrow></menclose>
</mrow></math></td></tr></table>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .