I found when adding the line \usepackage{newtxtext,newtxmath}
breaks mathml generated by tex4ht and hence the math looks bad when viewed in the browser. It seems to be a font issue.
I am using texlive 2014, and I've updated it weeks ago. Here is MWE
\documentclass[10pt,notitlepage]{article}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{newtxtext,newtxmath}
\usepackage{etex}
\begin{document}
\[
\int \sin(x) \, dx
\]
\end{document}
I build this to mathml with mathjax support using standard .cfg. I will show the command used, the HTML output and the .cfg I am using.
To compile the above:
htlatex foo.tex "nma.cfg,charset=utf-8" " -cunihtf -utf8"
(/usr/local/texlive/2014/texmf-dist/fonts/tfm/public/newtx/ntxmia.tfm)
--- warning --- Couldn't find font `ntxmia.htf' (char codes: 0--255)
(/usr/local/texlive/2014/texmf-dist/fonts/tfm/public/newtx/ntxmia.tfm)
--- warning --- Couldn't find font `ntxmia.htf' (char codes: 0--255)
....
The HTML generated is
The source code for the above HTML is
<!DOCTYPE html>
<html>
<head> <title></title>
<meta charset="UTF-8" />
<meta name="generator" content="TeX4ht (http://www.cse.ohio-state.edu/~gurari/TeX4ht/)" />
<link rel="stylesheet" type="text/css" href="foo.css" />
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ extensions: ["tex2jax.js"], jax: ["input/TeX", "output/HTML-CSS"], tex2jax: { inlineMath: [ ['$','$'], ["\\(","\\)"] ], displayMath: [ ['$$','$$'], ["\\[","\\]"] ], processEscapes: true }, "HTML-CSS": { availableFonts: ["TeX"] } }); </script> <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"> </script><style type="text/css"> .MathJax_MathML {text-indent: 0;} </style></head><body
>
<div class="par-math-display"><!--l. 8--><math
xmlns="http://www.w3.org/1998/Math/MathML"
display="block" ><mrow
>
<mo
class="MathClass-op">Z
<!--nolimits--></mo><!--nolimits--><mo class="qopname"> sin</mo><!--nolimits--><mrow ><mo
class="MathClass-open">}</mo><mrow><mo
class="MathClass-op">x</mo></mrow><mo
class="MathClass-close">~</mo></mrow><mspace width="0.3em" class="thinspace"/><mrow ><mo
class="MathClass-open">d</mo><mrow><mo
class="MathClass-op">x</mo>
</mrow></math></div>
<!--l. 10--><p class="nopar" >
</body>
</html>
Now when commenting %\usepackage{newtxtext,newtxmath}
and running the same compile command above, this is the result
And the HTML source code is
<!DOCTYPE html>
<html>
<head> <title></title>
<meta charset="UTF-8" />
<meta name="generator" content="TeX4ht (http://www.cse.ohio-state.edu/~gurari/TeX4ht/)" />
<link rel="stylesheet" type="text/css" href="foo.css" />
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ extensions: ["tex2jax.js"], jax: ["input/TeX", "output/HTML-CSS"], tex2jax: { inlineMath: [ ['$','$'], ["\\(","\\)"] ], displayMath: [ ['$$','$$'], ["\\[","\\]"] ], processEscapes: true }, "HTML-CSS": { availableFonts: ["TeX"] } }); </script> <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"> </script><style type="text/css"> .MathJax_MathML {text-indent: 0;} </style></head><body
>
<div class="par-math-display"><!--l. 8--><math
xmlns="http://www.w3.org/1998/Math/MathML"
display="block" ><mrow
>
<mo
class="MathClass-op">∫
<!--nolimits--></mo><!--nolimits--><mo class="qopname">sin</mo><!--nolimits--><mrow ><mo
class="MathClass-open">(</mo><mrow><mi
>x</mi></mrow><mo
class="MathClass-close">)</mo></mrow><mspace width="0.3em" class="thinspace"/><mi
>d</mi><mi
>x</mi>
</mrow></math></div>
<!--l. 10--><p class="nopar" >
</body>
</html>
The nma.cfg
file I used in the compile command is:
\Preamble{mathml}
\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{<meta name="generator" content="TeX4ht
(http://www.cse.ohio-state.edu/\string~gurari/TeX4ht/)" />\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">
MathJax.Hub.Config({
extensions: ["tex2jax.js"],
jax: ["input/TeX", "output/HTML-CSS"],
tex2jax: {
\unexpanded{inlineMath: [ ['$','$'], ["\\(","\\)"] ],}
\unexpanded{displayMath: [ ['$$','$$'], ["\\[","\\]"] ],}
processEscapes: true
},
"HTML-CSS": { availableFonts: ["TeX"] }
});
</script>
}}
\Configure{@HEAD}{\HCode{<script type="text/javascript"
src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>}}
\Configure{@HEAD}{\HCode{<style type="text/css">
.MathJax_MathML {text-indent: 0;}
</style>}}
\begin{document}
\EndPreamble
\ifdefined\HCode\else\usepackage{newtxtext,newtxmath}\fi
The problem is that there are no.htf
files for the NewTX fonts.