# [tex4ht] Issues with unpaired brackets

Michal Hoftich michal.h21 at gmail.com
Wed Apr 12 22:16:37 CEST 2017

Hi all,

incidentally, I found one issue in documents compiled to MathML, from
two independent sources. Meaningless MWE:

\documentclass{article}
\begin{document}
[this is for test $a+b=c]$
\end{document}

What is important is ] at the end of inline math. It produces the
following result with mathml option:

<!--l. 3--><p class="noindent" >[this is for test <!--l. 3--><math
xmlns="http://www.w3.org/1998/Math/MathML"
display="inline" ><mi
>a</mi> <mo
class="MathClass-bin">+</mo> <mi
>b</mi> <mo
class="MathClass-rel">=</mo> <mi
>c</mi></mrow><mo
class="MathClass-close">]</mo></mrow>[/itex]
</p>

The issue is that there are two clossing </mrow> tags, but none is
opened. I've found that it can be fixed using mathml- option:

<!--l. 3--><p class="noindent" >[this is for test <!--l. 3--><math
xmlns="http://www.w3.org/1998/Math/MathML"
display="inline" ><mi
>a</mi> <mo
class="MathClass-bin">+</mo> <mi
>b</mi> <mo
class="MathClass-rel">=</mo> <mi
>c</mi><mo
class="MathClass-close">]</mo>[/itex]
</p>

It seems that one must use paired brackets (they don't have to be the
same kind $(a+b=c]$ works as well) with default tex4ht configuration.
Every opening bracket add two opening <mrow> tags and closing bracket
closes that.

As I am not math expert, my question is:
Is the original example actually correct? Shouldn't be all brackets
paired, or is the default tex4ht configuration wrong in assuming this? I
know that one must use \left. if there is no opening bracket for
\right). Is there similar mechanism for normal brackets?

Could anybody test if mathml- option gives correct results for more
complicated real world examples?

Best regards,
Michal