[tex4ht] problems using mathjax mode with siunitx package
Nasser M. Abbasi
nma at 12000.org
Sat Dec 29 06:01:58 CET 2018
Hello;
I am trying the new mathjax mode with some old latex files
that make heavy use of \usepackage{siunitx}
None of the siunitx code works in mathjax but works OK
in lualatex and in png or svg for math with make4ht.
Here is a MWE
--------------------------------
\documentclass[11pt]{article}%
\usepackage{amsmath}
\usepackage{siunitx}
\DeclareSIUnit\ft{ft}
\begin{document}
\begin{align*}
S &= \SI{2775}{\square\ft}
\end{align*}
\end{document}
----------------------
Compiled using
make4ht foo1.tex "htm,mathjax"
It looks like this in HTML
https://www.12000.org/tmp/122818/mathjax.png
The HTML generated is
--------------------------------------
<!DOCTYPE html>
<html lang="en-US" xml:lang="en-US" >
<head><title></title>
<meta charset="iso-8859-1" />
<meta name="generator" content="TeX4ht (http://www.tug.org/tex4ht/)" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<link rel="stylesheet" type="text/css" href="foo1.css" />
<meta name="src" content="foo1.tex" />
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ 'fast-preview': {disabled: true},
TeX: { extensions: ["color.js","AMSmath.js"], equationNumbers: { autoNumber: "AMS" } },
extensions: ["tex2jax.js"], tex2jax: { inlineMath: [ ["\\\(","\\\)"] ],
displayMath: [ ['$$','$$'], ["\\[","\\]"] ], processEscapes: true, processEnvironments: true } });
</script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?config=TeX-AMS-MML_HTMLorMML"></script>
</head><body>
<!--l. 10--><p class="noindent" >\begin{align*} S &= \SI{2775}{\square \ft } \end{align*}
</p>
</body>
</html>
---------------------------
So mathjax does not know about siunitx. Other than rewriting all the
latex code so not to use this package, which I really do not want
to do, is there a way to work around this? Is new
configuration needed somewhere? I have other\DeclareSIUnit macros
in the code such as
\DeclareSIUnit\ft{ft}
\DeclareSIUnit\deg{deg}
etc...
Using TL 2018
Thank you for any hints how to handle this.
--Nasser
More information about the tex4ht
mailing list