[tex4ht] text/html with mathjax as small mod of tex4ht/xhmlatex

Michal Hoftich michal.h21 at gmail.com
Thu Aug 2 12:41:55 CEST 2012


Hi,
I managed to get points 1 -  4 from your list with following config
file "mathjax.cfg"

------------------

\Preamble{xhtml,mathml}
\Configure{VERSION}{}
\Configure{DOCTYPE}{\HCode{<!DOCTYPE html>\Hnewline}}
\Configure{HTML}{\HCode{<html>\Hnewline}}{\HCode{\Hnewline</html>}}
\Configure{@HEAD}{}
\Configure{@HEAD}{\HCode{<meta \expandafter\csname a:charset\endcsname
>\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">\Hnewline
  MathJax.Hub.Config({\Hnewline
    extensions: ["mml2jax.js"],\Hnewline
    jax: ["input/MathML","output/HTML-CSS"],\Hnewline
    "HTML-CSS": { availableFonts: ["TeX"] },\Hnewline
    MMLorHTML: {\Hnewline
      prefer: {\Hnewline
        MSIE:    "HTML",\Hnewline
        Firefox: "HTML",\Hnewline
        Opera:   "HTML",\Hnewline
        other:   "HTML"\Hnewline
           }\Hnewline
         }\Hnewline
  });\Hnewline
</script>\Hnewline
}}
\Configure{@HEAD}{\HCode{<script type="text/javascript"
   src="http://cdn.mathjax.org/mathjax/latest/MathJax.js">
</script>\Hnewline}}
\begin{document}
\EndPreamble

--------------------

I don't know about xhmlatex script, but after compiling one of your
sample files with

htlatex 1109.1881v2.tex "mathjax, charset=utf-8,NoFonts" " -cunihtf -utf8"

I got only few errors from w3c validator, caused with conversion of
some math construct to png image and including this image to mathml.

I think your point no. 5 isn't really necessary, in html5 elements,
which cannot have any content, like <mspace />, can be self-closing.

Michal

2012/7/30 William F Hammond <hammond at csc.albany.edu>
>
>
> It's not clear to me how to configure things so that html5
> (text/html serialization) with mathjax is spun out of
> tex4ht, but small ad hoc adjustments to the examples from
> arXiv referenced below suggest that it ought to be fairly
> easy to create a variant of xhmlatex for it.
>
>     http://www.albany.edu/~hammond/demos/Html5/arXiv/
>
>                                     -- Bill
>


More information about the tex4ht mailing list