Why using {newtxtext,newtxmath} packages breaks MathML generation in tex4ht?











up vote
3
down vote

favorite
1












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



Mathematica graphics



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



Mathematica graphics



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="expandaftercsname aa:CssFileendcsname" />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









share|improve this question


















  • 1




    ifdefinedHCodeelseusepackage{newtxtext,newtxmath}fi The problem is that there are no .htf files for the NewTX fonts.
    – egreg
    Jan 3 '15 at 23:22






  • 1




    even if there were .htf fonts to support newtx in tex4ht I don't think it would help with this configuration as mathjax can not use those fonts (unless you go to the effort of contributing web font versions and font data of the format mathjax needs) so simply not using the package when using tex4ht seems the correct thing to do.
    – David Carlisle
    Jan 4 '15 at 0:00















up vote
3
down vote

favorite
1












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



Mathematica graphics



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



Mathematica graphics



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="expandaftercsname aa:CssFileendcsname" />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









share|improve this question


















  • 1




    ifdefinedHCodeelseusepackage{newtxtext,newtxmath}fi The problem is that there are no .htf files for the NewTX fonts.
    – egreg
    Jan 3 '15 at 23:22






  • 1




    even if there were .htf fonts to support newtx in tex4ht I don't think it would help with this configuration as mathjax can not use those fonts (unless you go to the effort of contributing web font versions and font data of the format mathjax needs) so simply not using the package when using tex4ht seems the correct thing to do.
    – David Carlisle
    Jan 4 '15 at 0:00













up vote
3
down vote

favorite
1









up vote
3
down vote

favorite
1






1





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



Mathematica graphics



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



Mathematica graphics



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="expandaftercsname aa:CssFileendcsname" />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









share|improve this question













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



Mathematica graphics



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



Mathematica graphics



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="expandaftercsname aa:CssFileendcsname" />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






tex4ht mathml newtxmath






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jan 3 '15 at 22:55









Nasser

8,01153081




8,01153081








  • 1




    ifdefinedHCodeelseusepackage{newtxtext,newtxmath}fi The problem is that there are no .htf files for the NewTX fonts.
    – egreg
    Jan 3 '15 at 23:22






  • 1




    even if there were .htf fonts to support newtx in tex4ht I don't think it would help with this configuration as mathjax can not use those fonts (unless you go to the effort of contributing web font versions and font data of the format mathjax needs) so simply not using the package when using tex4ht seems the correct thing to do.
    – David Carlisle
    Jan 4 '15 at 0:00














  • 1




    ifdefinedHCodeelseusepackage{newtxtext,newtxmath}fi The problem is that there are no .htf files for the NewTX fonts.
    – egreg
    Jan 3 '15 at 23:22






  • 1




    even if there were .htf fonts to support newtx in tex4ht I don't think it would help with this configuration as mathjax can not use those fonts (unless you go to the effort of contributing web font versions and font data of the format mathjax needs) so simply not using the package when using tex4ht seems the correct thing to do.
    – David Carlisle
    Jan 4 '15 at 0:00








1




1




ifdefinedHCodeelseusepackage{newtxtext,newtxmath}fi The problem is that there are no .htf files for the NewTX fonts.
– egreg
Jan 3 '15 at 23:22




ifdefinedHCodeelseusepackage{newtxtext,newtxmath}fi The problem is that there are no .htf files for the NewTX fonts.
– egreg
Jan 3 '15 at 23:22




1




1




even if there were .htf fonts to support newtx in tex4ht I don't think it would help with this configuration as mathjax can not use those fonts (unless you go to the effort of contributing web font versions and font data of the format mathjax needs) so simply not using the package when using tex4ht seems the correct thing to do.
– David Carlisle
Jan 4 '15 at 0:00




even if there were .htf fonts to support newtx in tex4ht I don't think it would help with this configuration as mathjax can not use those fonts (unless you go to the effort of contributing web font versions and font data of the format mathjax needs) so simply not using the package when using tex4ht seems the correct thing to do.
– David Carlisle
Jan 4 '15 at 0:00










1 Answer
1






active

oldest

votes

















up vote
2
down vote



accepted










The issue is that there are missing mapping files between newtx fonts and Unicode. Such mapping file, with .htf extension must exist for every font which should be supported by tex4ht.



These mappings had to be created by hand, which is quite tedious work. Here is a sample of such mapping:



ntxmia 0 255
'Γ' '' Gamma 0
'∆' '' Delta 1
'Θ' '' Theta 2
'Λ' '' Lambda 3
'Ξ' '' Xi 4
'Π' '' Pi 5
'Σ' '' Sigma 6
'Υ' '' Upsilon 7
'Φ' '' Phi 8
'Ψ' '' Psi 9
....
Much more lines


The first line contains the font name, number of first character and number of the last character supported by the font. Then starts the actual mappings. It starts from the first character number until the last character. The line contains three records - first is the mapping used for the character, the second specifies if it should be converted to picture and the rest is a comment, usually glyph name and character number. The mapping contains XML entity of the character or ASCII string in the single quotes. More details about the htf format can be found in the tex4ht documentation.



Anyway, I've created a tool for automatic htf file generation, called Htfgen. I started the development at the time this question was posted and developed bunch of scripts and libraries that tried to achieve this target. After almost four years, the results finally seem to be interesting. I've created a new library, which can take a font name, detect if it is real or virtual font, find all used glyphs and find Unicode characters for them. This library is used by new script dvitohtf, which can detect all used fonts in a dvi file and generate TeX file which will generate .htf files for all fonts which don't have one yet.



It can be used like this



 dvitohtf foo.htf > newtx.tex
tex newtx.tex


This will generate bunch of htf files. Note that there is lot of messages like this in the newtx.tex file:



 Missing glyph npropersuperset 


This message means that there is no known mapping from this glyph to Unicode. There is lot of such missing glyphs in the Newtx fonts, the support for them must be added to Htfgen, once correct Unicode mapping is found. If it exist.



The nextxt.tex file is too large to be posted here, so you can download it here.



This is your sample with the new htf files:



enter image description here






share|improve this answer





















    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "85"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














     

    draft saved


    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f220555%2fwhy-using-newtxtext-newtxmath-packages-breaks-mathml-generation-in-tex4ht%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    2
    down vote



    accepted










    The issue is that there are missing mapping files between newtx fonts and Unicode. Such mapping file, with .htf extension must exist for every font which should be supported by tex4ht.



    These mappings had to be created by hand, which is quite tedious work. Here is a sample of such mapping:



    ntxmia 0 255
    'Γ' '' Gamma 0
    '∆' '' Delta 1
    'Θ' '' Theta 2
    'Λ' '' Lambda 3
    'Ξ' '' Xi 4
    'Π' '' Pi 5
    'Σ' '' Sigma 6
    'Υ' '' Upsilon 7
    'Φ' '' Phi 8
    'Ψ' '' Psi 9
    ....
    Much more lines


    The first line contains the font name, number of first character and number of the last character supported by the font. Then starts the actual mappings. It starts from the first character number until the last character. The line contains three records - first is the mapping used for the character, the second specifies if it should be converted to picture and the rest is a comment, usually glyph name and character number. The mapping contains XML entity of the character or ASCII string in the single quotes. More details about the htf format can be found in the tex4ht documentation.



    Anyway, I've created a tool for automatic htf file generation, called Htfgen. I started the development at the time this question was posted and developed bunch of scripts and libraries that tried to achieve this target. After almost four years, the results finally seem to be interesting. I've created a new library, which can take a font name, detect if it is real or virtual font, find all used glyphs and find Unicode characters for them. This library is used by new script dvitohtf, which can detect all used fonts in a dvi file and generate TeX file which will generate .htf files for all fonts which don't have one yet.



    It can be used like this



     dvitohtf foo.htf > newtx.tex
    tex newtx.tex


    This will generate bunch of htf files. Note that there is lot of messages like this in the newtx.tex file:



     Missing glyph npropersuperset 


    This message means that there is no known mapping from this glyph to Unicode. There is lot of such missing glyphs in the Newtx fonts, the support for them must be added to Htfgen, once correct Unicode mapping is found. If it exist.



    The nextxt.tex file is too large to be posted here, so you can download it here.



    This is your sample with the new htf files:



    enter image description here






    share|improve this answer

























      up vote
      2
      down vote



      accepted










      The issue is that there are missing mapping files between newtx fonts and Unicode. Such mapping file, with .htf extension must exist for every font which should be supported by tex4ht.



      These mappings had to be created by hand, which is quite tedious work. Here is a sample of such mapping:



      ntxmia 0 255
      'Γ' '' Gamma 0
      '∆' '' Delta 1
      'Θ' '' Theta 2
      'Λ' '' Lambda 3
      'Ξ' '' Xi 4
      'Π' '' Pi 5
      'Σ' '' Sigma 6
      'Υ' '' Upsilon 7
      'Φ' '' Phi 8
      'Ψ' '' Psi 9
      ....
      Much more lines


      The first line contains the font name, number of first character and number of the last character supported by the font. Then starts the actual mappings. It starts from the first character number until the last character. The line contains three records - first is the mapping used for the character, the second specifies if it should be converted to picture and the rest is a comment, usually glyph name and character number. The mapping contains XML entity of the character or ASCII string in the single quotes. More details about the htf format can be found in the tex4ht documentation.



      Anyway, I've created a tool for automatic htf file generation, called Htfgen. I started the development at the time this question was posted and developed bunch of scripts and libraries that tried to achieve this target. After almost four years, the results finally seem to be interesting. I've created a new library, which can take a font name, detect if it is real or virtual font, find all used glyphs and find Unicode characters for them. This library is used by new script dvitohtf, which can detect all used fonts in a dvi file and generate TeX file which will generate .htf files for all fonts which don't have one yet.



      It can be used like this



       dvitohtf foo.htf > newtx.tex
      tex newtx.tex


      This will generate bunch of htf files. Note that there is lot of messages like this in the newtx.tex file:



       Missing glyph npropersuperset 


      This message means that there is no known mapping from this glyph to Unicode. There is lot of such missing glyphs in the Newtx fonts, the support for them must be added to Htfgen, once correct Unicode mapping is found. If it exist.



      The nextxt.tex file is too large to be posted here, so you can download it here.



      This is your sample with the new htf files:



      enter image description here






      share|improve this answer























        up vote
        2
        down vote



        accepted







        up vote
        2
        down vote



        accepted






        The issue is that there are missing mapping files between newtx fonts and Unicode. Such mapping file, with .htf extension must exist for every font which should be supported by tex4ht.



        These mappings had to be created by hand, which is quite tedious work. Here is a sample of such mapping:



        ntxmia 0 255
        'Γ' '' Gamma 0
        '∆' '' Delta 1
        'Θ' '' Theta 2
        'Λ' '' Lambda 3
        'Ξ' '' Xi 4
        'Π' '' Pi 5
        'Σ' '' Sigma 6
        'Υ' '' Upsilon 7
        'Φ' '' Phi 8
        'Ψ' '' Psi 9
        ....
        Much more lines


        The first line contains the font name, number of first character and number of the last character supported by the font. Then starts the actual mappings. It starts from the first character number until the last character. The line contains three records - first is the mapping used for the character, the second specifies if it should be converted to picture and the rest is a comment, usually glyph name and character number. The mapping contains XML entity of the character or ASCII string in the single quotes. More details about the htf format can be found in the tex4ht documentation.



        Anyway, I've created a tool for automatic htf file generation, called Htfgen. I started the development at the time this question was posted and developed bunch of scripts and libraries that tried to achieve this target. After almost four years, the results finally seem to be interesting. I've created a new library, which can take a font name, detect if it is real or virtual font, find all used glyphs and find Unicode characters for them. This library is used by new script dvitohtf, which can detect all used fonts in a dvi file and generate TeX file which will generate .htf files for all fonts which don't have one yet.



        It can be used like this



         dvitohtf foo.htf > newtx.tex
        tex newtx.tex


        This will generate bunch of htf files. Note that there is lot of messages like this in the newtx.tex file:



         Missing glyph npropersuperset 


        This message means that there is no known mapping from this glyph to Unicode. There is lot of such missing glyphs in the Newtx fonts, the support for them must be added to Htfgen, once correct Unicode mapping is found. If it exist.



        The nextxt.tex file is too large to be posted here, so you can download it here.



        This is your sample with the new htf files:



        enter image description here






        share|improve this answer












        The issue is that there are missing mapping files between newtx fonts and Unicode. Such mapping file, with .htf extension must exist for every font which should be supported by tex4ht.



        These mappings had to be created by hand, which is quite tedious work. Here is a sample of such mapping:



        ntxmia 0 255
        'Γ' '' Gamma 0
        '∆' '' Delta 1
        'Θ' '' Theta 2
        'Λ' '' Lambda 3
        'Ξ' '' Xi 4
        'Π' '' Pi 5
        'Σ' '' Sigma 6
        'Υ' '' Upsilon 7
        'Φ' '' Phi 8
        'Ψ' '' Psi 9
        ....
        Much more lines


        The first line contains the font name, number of first character and number of the last character supported by the font. Then starts the actual mappings. It starts from the first character number until the last character. The line contains three records - first is the mapping used for the character, the second specifies if it should be converted to picture and the rest is a comment, usually glyph name and character number. The mapping contains XML entity of the character or ASCII string in the single quotes. More details about the htf format can be found in the tex4ht documentation.



        Anyway, I've created a tool for automatic htf file generation, called Htfgen. I started the development at the time this question was posted and developed bunch of scripts and libraries that tried to achieve this target. After almost four years, the results finally seem to be interesting. I've created a new library, which can take a font name, detect if it is real or virtual font, find all used glyphs and find Unicode characters for them. This library is used by new script dvitohtf, which can detect all used fonts in a dvi file and generate TeX file which will generate .htf files for all fonts which don't have one yet.



        It can be used like this



         dvitohtf foo.htf > newtx.tex
        tex newtx.tex


        This will generate bunch of htf files. Note that there is lot of messages like this in the newtx.tex file:



         Missing glyph npropersuperset 


        This message means that there is no known mapping from this glyph to Unicode. There is lot of such missing glyphs in the Newtx fonts, the support for them must be added to Htfgen, once correct Unicode mapping is found. If it exist.



        The nextxt.tex file is too large to be posted here, so you can download it here.



        This is your sample with the new htf files:



        enter image description here







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 19 at 23:01









        michal.h21

        28.7k445103




        28.7k445103






























             

            draft saved


            draft discarded



















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f220555%2fwhy-using-newtxtext-newtxmath-packages-breaks-mathml-generation-in-tex4ht%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            How to change which sound is reproduced for terminal bell?

            Can I use Tabulator js library in my java Spring + Thymeleaf project?

            Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents