I am using make4ht on the file Test.tex containing:



    Testing cross references for equations. 
        e^{\mathrm{i}\pi}+1=0 \label{eq:test equation}
    Equation \ref{eq:test equation} is known as Euler's identity.

using the command

make4ht Test.tex "mathjax"

to get the HTML code (excluding the header)

    <!-- l. 6 --><p class='noindent'>Testing cross references for equations. \begin {equation} e^{\mathrm 
    {i}\pi }+1=0 \label {eq:test equation} \end {equation}
    Equation <span class='cmbx-12'>??</span> is known as Euler’s identity. </p> 

Am I missing something obvious I need to do to get the correct equation number instead of the ???

  • 2
    As all math content is passed to MathJax, it is not possible to reference to that easily. Either use MathML using make4ht Test.tex "mathml,mathjax", or try the Lua code from here: tex.stackexchange.com/a/378359/2891
    – michal.h21
    Mar 26 at 20:08
  • I was able to get it to work, kind of, using something similar to the link @michal.h21 posted. I added \renewcommand\eqref[1]{\NoFonts\HChar{92}eqref\{#1\}\EndNoFonts} to my .cfg file for make4ht. It breaks if the label contains an underscore, but works well enough for my needs otherwise.
    – Rushi
    Mar 26 at 23:20
  • 1
    If it breaks with underscore, try something like \renewcommand\eqref[1]{\NoFonts\HChar{92}eqref\{\detokenize{#1}\}\EndNoFonts} (untested, but it should work)
    – michal.h21
    Mar 27 at 10:25

As long as all equations are referenced using \eqref{} (not (\ref{})), the following hack, as suggested by @michal.h21 in another answer, works:


Save the above in a configuration file, say MyConfig.cfg and run

make4ht filename.tex "xhtml,mathjax" --config MyConfig

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.