[tex4ht] another mathml/mathjax issue, \operatorname{} problem with mathjax

Nasser M. Abbasi nma at 12000.org
Thu Aug 7 16:39:53 CEST 2014


On 8/7/2014 6:33 AM, Michal Hoftich wrote:
> Hi Nasser,
>
> I don't think this is related to mathjax, your code generates mathml
> which is invalid according to w3c html validator. What about this?:
>
> \[
>         \operatorname{I}_{\frac{4}{3}}
> \]
>
> output from pdflatex is same as in your version, but mathml produced
> by tex4ht is valid and looks same as pdf version.
>
> Regards,
> Michal
>

The above latex was produced by software Sage version 6.2.

http://www.sagemath.org/doc/tutorial/latex.html

I do not understand what you mean by

     "your code generates mathml which is invalid"

I am using tex4ht? Isn't tex4ht which generates the mathml?

The latex itself is generated by sage and I process it by
tex4ht. If you meant the latex itself is not valid, then I'll
try to let someone at Sage know they are producing invalid
Latex then.

Thank you,

--Nasser

> 2014-08-06 21:51 GMT+02:00 Nasser M. Abbasi <nma at 12000.org>:
>> fyi,
>>
>> This might be known issue. This MWE generate mathml that mathjax does not
>> like.
>>
>> --------------------------------
>>      \documentclass[12pt]{article}
>>      \usepackage{amsmath}
>>      \begin{document}
>>      \[
>>         \operatorname{I_{\frac{4}{3}}}
>>      \]
>>      \end{document}
>> -----------------------
>>
>> compile with:
>>
>> htlatex foo.tex "nma,htm,pic-align,charset=utf-8,notoc*" " -cunihtf -utf8"
>>
>> The foo.htm file, on firefox shows an error
>>
>>           Unexpected text node: 'I'
>>
>> the file nma.cfg just loads the mathjax. Here it is in case someone
>> wants to reproduce the above:
>>
>> -------------------------------
>>>
>>> cat  nma.cfg
>>
>>
>> \Preamble{xhtml,mathml,ext=htm,charset="utf-8",p-width,pic-align}  %does
>> mathml, not png !
>> \Configure{VERSION}{}
>>    \Configure{DOCTYPE}{\HCode{<!DOCTYPE html>\Hnewline}}
>>    \Configure{HTML}{\HCode{<html>\Hnewline}}{\HCode{\Hnewline</html>}}
>>    \Configure{@HEAD}{}
>>    \Configure{@HEAD}{\HCode{<meta charset="UTF-8" />\Hnewline}}
>>    \Configure{@HEAD}{\HCode{<link
>>             rel="stylesheet" type="text/css"
>>             href="\expandafter\csname aa:CssFile\endcsname" />\Hnewline}}
>>               \Configure{@HEAD}{\HCode{%
>>       <script type="text/x-mathjax-config">\Hnewline
>>         MathJax.Hub.Config({\Hnewline
>>           extensions: ["tex2jax.js"],
>>           jax: ["input/TeX", "output/HTML-CSS"],
>>           tex2jax: {
>>             \unexpanded{inlineMath: [ ['$','$'], ["\\(","\\)"] ],}\Hnewline
>>             \unexpanded{displayMath: [ ['$$','$$'], ["\\[","\\]"]
>> ],}\Hnewline
>>             ignoreClass: "fancyvrb|verbatim",\Hnewline
>>             processEscapes: true
>>           },
>>           "HTML-CSS": { availableFonts: ["TeX"] }
>>         });\Hnewline
>>       </script>
>>    }}
>>               \Configure{@HEAD}{\HCode{<script
>> type="text/javascript"\Hnewline
>>
>> src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"\Hnewline
>>    ></script>\Hnewline}}
>>    \Configure{@HEAD}{\HCode{<style type="text/css">\Hnewline
>>      .MathJax_MathML {text-indent: 0;}\Hnewline
>>    </style>\Hnewline}}
>>
>> \begin{document}
>>
>> \EndPreamble
>> ------------------------------------------------
>>
>> Here is the HTML source for the above:
>>
>> ---------------------------------------------
>> <div class="par-math-display"><!--l. 8--><math
>>   xmlns="http://www.w3.org/1998/Math/MathML"
>> display="block" ><mrow
>>>
>>>
>>       <mo class="qopname"><msub><mrow
>>>
>>> I</mrow><mrow
>>> <mfrac><mrow
>>> 4</mrow>
>>
>> <mrow
>>>
>>> 3</mrow></mfrac> </mrow></msub
>>> </mo><!--nolimits-->
>>
>> </mrow></math></div>
>> <!--l. 10--><p class="nopar" >
>> </p>
>> ---------------------------------
>>
>> texlive 2014 on Linux
>>
>> thank you,
>> --Nasser
>>
>



More information about the tex4ht mailing list