2

I am trying to convert to HTML a big LaTeX document (book class) subdivided into several chapters. I am using tex4ht. My problem is that, if I choose to export each chapter as separate pages, when I reference an equation from a different chapter, I get ??? instead of the equation number. The following snippet illustrates this issue.

\documentclass{book}

\begin{document}

\chapter{First}
\begin{equation}
  1+1=2
  \label{eq1}
\end{equation}

\chapter{Second}
Reference to first chapter's equation: $\ref{eq1}$.
\begin{equation}
  2+2=4
  \label{eq2}
\end{equation}

\end{document}

If I convert this file (snippet.tex) to HTML using make4ht --utf8 snippet.tex "mathlm,mathjax", then it works fine. I get the following:

enter image description here

However, if I use make4ht --utf8 snippet.tex "mathlm,mathjax,2" instead, the page corresponding to chapter 2 looks like that:

enter image description here

Notice also that, in this second case, the equation number is now 1, which means that there are two equations 1 within the same document. I have tried to add the chapter number in the equation number, by adding \renewcommand{\theequation}{\thechapter.\arabic{equation}} in the preamble of my TeX file, but it has no effect.

2
  • 1
    I think you use a wrong option: it should be mathml instead of mathlm. You use pure MathJax now, which means that references to equations don't work correctly.
    – michal.h21
    Sep 23 at 20:41
  • Indeed, that was a stupid mistake. Thank you very much for your help. Sep 24 at 19:47

0

Your Answer

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

Browse other questions tagged or ask your own question.