I want to convert the following (minimized) TeX file to HTML:

We have $a = a$, \(a = a\) and also
\[c = c\] and even
  E = mc^2.
All seems to work, except for
$$F = ma.$$

My config file is



tex: {
      tags: "ams",
      inlineMath: [ [’$’,’$’], ["\\\(","\\\)"] ],
      displayMath: [ [’$$’,’$$’], ["\\[","\\]"] ],}
      processEscapes: true,
      processEnvironments: true,
      packages: [’base’, ’color’, ’ams’, ’boldsymbol’, ’newcommand’, ’verb’]




and the command I run is

make4ht -c /CONF/sample.cfg markup.tex "mathjax"

Unfortunately, this produces images for every formula that is wrapped between two dollar signs $$. How can I fix this? I have tried to mimic the solutions to this and this answers by Michal by detokenizing everything between two dollar signs but it did not work.

Also, I do not want to use MathML as it does not parse my formulas as good as TeX-to-MathJax.

  • 1
    someone may provide a make4ht config, but the input latex files should not have $$ which is not supported latex syntax. Oct 10, 2022 at 18:51
  • I don't quite understand what you mean by that. Are you saying make4ht cannot deal with $$?
    – qarabala
    Oct 10, 2022 at 18:56
  • See tex.stackexchange.com/q/503/107497
    – Teepeemm
    Oct 10, 2022 at 19:02
  • No I am saying $$ is not latex, if make4ht supports it that is because it is supporting some non-latex primitive tex constructs. Oct 10, 2022 at 19:02
  • 2
    as @DG' said, if you have up-to-date TeX Live installation, your code should work (except for the error message caused by equation* not defined, you need to use amsmath). I've added code to support $$ few weeks ago.
    – michal.h21
    Oct 10, 2022 at 19:59

1 Answer 1


It should work with the up-to-date TeX Live distribution, but you can add the support also using the following configuration file:


It converts $$ in your source to \[ in the output, so you don't even need to provide any configuration to MathJax. This is the resulting HTML code:

<!-- l. 4 --><p class='noindent'>We have \(a = a\), \(a = a\) and also \[c = c\] and even \begin {equation*}  E = mc^2.  \end {equation*} All seems to work, except for
                                 \[F = ma.\]

enter image description here

  • I confirm that the problem was caused by the old version of texlive. As always, thanks a lot michal!
    – qarabala
    Oct 11, 2022 at 15:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .