1

I am able to convert a LaTeX file foo.tex to foo.html using make4ht like this,

make4ht foo mathjax

Where is this argument mathjax documented? I searched the documentation at http://mirrors.ctan.org/support/make4ht/make4ht-doc.pdf. It documents mathjaxnode which seems to do something else but I don't see mathjax mentioned anywhere.

2

Some work in progress documentation is available here.

Basically, there are two modes. The first mode keeps LaTeX math source in the generated HTML file and uses MathJax to render it. If you use custom math macros you may need to pass their configuration to MathJax. This can be done using \Configure{MathJaxConfig}:

\Preamble{xhtml}
\Configure{MathJaxConfig}{{
    tex: {
      tags: "ams",
      \detokenize{%
      macros: {
        sc: "\\small\\rm",
        sl: "\\it",
      }
  }
}
}}
\begin{document}
\EndPreamble

It is necessary to do some tricks in order to prevent LaTeX from interpreting your macros, hence the use of \detokenize. If macros expect parameters, then the configuration is even more complicated, see the second example in the documentation.

Another method is to use MathML. MathJax is used in that case only for MathML rendering. It supports most of the custom macros out of the box, and it is better for cross-referencing, as it is handled completely by LaTeX. The downside is that the MathML support in TeX4ht is more dependent on the correct LaTeX input and some stuff, especially regarding superscripts and subscripts doesn't work. To use the MathML mode use:

make4ht filename.tex "mathml,mathjax"

One last note is that you can change the address of MathJax script using:

\Configure{MathjaxSource}{https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml-full.js}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.