Take the following simple latex file
\documentclass{article}
\usepackage{amsfonts,amsmath}
\newcommand\R{\mathbb{R}}
\begin{document}
$\overrightarrow{AB}$
$|\mathbf{v}|$
$e^{x^2+y^2}$
$\{ x\in\R | x<0 \}$
\begin{align*}
f & = 1+2+3+4+\dots+n\\
& = \binom{n+1}2
\end{align*}
\end{document}
and run it through tex4ht/make4ht using the configuration file from TeX4ht issue with chrome
\Preamble{xhtml,mathml,html5}
\Configure{HTML}{\HCode{<html lang="en">\Hnewline}}{\HCode{\Hnewline</html>}}
\Configure{@HEAD}{\HCode{\Hnewline<script type="text/javascript"
src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=MML_CHTML">
</script>\Hnewline}}
\begin{document}
\EndPreamble
(for example, use make4ht -u -c file.cfg file.tex
). On firefox, safari and chrome this produces a web page with errors that look something like
The problem is with the mathjax settings. If, instead, I change the configuration file to use
\Configure{@HEAD}{\HCode{\Hnewline<script type="text/javascript"
src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_CHTML">
</script>\Hnewline}}
then this page displays correctly on firefox but superscripts and subscripts, for example, do not display correctly on chrome and everything is pear-shaped on safari:
This shows how this web page produced by tex4ht displays on firefox, chrome and safari, respectively.
I have tried all of the mathjax settings given on http://docs.mathjax.org/en/latest/config-files.html, as well as trying to configure mathjax directly using MathJax.Hub.Config
, but I cannot find a way to get these examples to work. Firefox displays this page well with several of the mathjax configurations, chrome does OK with some and safari is not happy at all.
I have also tried using Michal's mathjax-latex-4ht
package, described in Converting latex to html using exsheets, and keeping equations as latex. This is almost perfect except that it doesn't cope with the \R
macro in my MWE:
Is there a way to configure tex4ht and mathjax to play well with this example on all browsers? Annoyingly, pandoc seems to produce sensible output here but in my real application I have some significant post-processing to do, which is possible using tex4ht and I am not sure if this can be done starting with pandoc.