# Export HTML + MathML is skipping some math. Why? How to fix?

Using Mathematica's HTML export feature with MathML often skips some expressions, instead rendering them as plain HTML instead of MathML. Probably, in the options there is a way to force it, but how? Take the following text cell with three expressions:

Cell[TextData[{
"Essentially the difference between two things is not an \
intermediate between them, but ",
Cell[BoxData[
FormBox[
RowBox[{
RowBox[{"5", "-", "1"}], "=", "4"}], TraditionalForm]]],
" and ",
Cell[BoxData[
FormBox[
RowBox[{"1", "<", "4", "<", "5"}], TraditionalForm]]],
", so the difference (4) is an intermediate between one and \
five.  Here is a test: ",
Cell[BoxData[
FormBox[
RowBox[{
}], "Text",
CellChangeTimes->{{3.751540236169451*^9,
3.7515404896234426*^9}, {3.773268004192507*^9,
3.773268024247969*^9}, {3.7732686493460913*^9,
3.773268695855316*^9}, {3.7733035478874927*^9,
3.773303584909192*^9}, 3.773305573837632*^9, {
3.7733056076311727*^9, 3.773305613603734*^9}, {
3.773305750759776*^9, 3.7733057516892467*^9}, {
3.7733072295237126*^9, 3.773307239505965*^9},
3.773307700314678*^9}]


A plain text rendering of the above expression is:

Essentially the difference between two things is not an intermediate between them, but 5-1=4 and 1<4<5, so the difference (4) is an intermediate between one and five. Here is a test: 6^2=X

And finally, the ExportString version set to XHTMLMathML reads below:

(here is the command)

ExportString[nb, "XHTMLMathML", "FullDocument" -> False]


(here is the output)

<p class="Text">

Essentially the difference between two things is not an intermediate \
between them, but <span><span>5-1=4</span></span> and \
<span><em>1</em><em>&lt;</em><em>4</em><em>&lt;</em><em>5</em></span>,\
so the difference (4) is an intermediate between one and \
five.&nbsp;&nbsp;Here is a test: <span><span><math \
xmlns='http://www.w3.org/1998/Math/MathML'

xmlns:mathematica='http://www.wolfram.com/XML/'>

<mrow>

<msup>

<mn>6</mn>

<mn>2</mn>

</msup>

<mo>=</mo>

<mi>X</mi>

</mrow>

[/itex]</span></span>

</p>


Why does the exporter convert only one of the three expressions into MathML? Apparently the converter is lazy, and it only converts the last one because the superscript 6^2 makes the typeset necessary, whereas the other two equations are readable doing just HTML (so the converter ignores them). Where the problem crops up is that when this document goes later on through the conversion to a Kindle format, for instance, the style looks annoyingly inconsistent, since only the one expression gets the mathjax and the others look worse.