I am sorry that I am unable to extract a minimal working example.

I downloaded the source code from arxiv, commented out \usepackage{times,fullpage} and \usepackage{xr-hyper} in the preamble:


% For cross-file-references

% Package for hypertext links:

and compiled with the configure file



  \expandafter\def\csname #1\endcsname##1{\Picture+{}\csname orig#1\endcsname{##1}\EndPicture}


and the mk4 file

if mode == "draft" then
  Make:htlatex {}
  -- Make:add("biber","biber ${input}")
  Make:htlatex {}
  -- Make:biber {}
  Make:htlatex {}
  Make:htlatex {}


I found that the generated epub file has many incorrect hyperlinks of references. For example, the generated code of label of Lemma 2.4:

<a id="x3-3002r3"></a>
<span class="cmbx-10">Lemma 2.4.</span>

while in the reference code of Lemma 2.4 in Remark 2.5 is

The following fact was used in the proof of Lemma <a href="#x3-3002r4">2.4<!--tex4ht:ref: lemma-cech --></a>:

The reference ID is incorrect (and in fact, there is no #x3-3002r4 according to the generated .aux file). It's weird that some of the references are correct, while others are wrong.

I look forward to a fix of this.



I produced a minimal working example:





\section{First section}



  This is a theorem

Look at Theorem \ref{thm:nul}.

Look at Theorem \ref{thm:this}.


compiled with tex4ebook without any extra arguments.

Note that the environment thm uses the counter of subsection. See the wikibook for such a usage.

  • I can see that this happens, but it seems to be completely random. When I copy parts of this document to a new one, with the same preamble, links works. – michal.h21 Apr 5 at 12:46
  • @michal.h21 It seems that there is some confliction between counting/labeling system. I found that all lemmas are referred by Lemma <a href="#x3-****r?">*.? where two question marks indicates the same number, while the label of lemma looks like #x3-****r, where the number after r is not necessarily the number of the lemma. – Yai0Phah Apr 6 at 12:53
  • @michal.h21 I understood what's happening. I produced an MWE and will update the answer soon. It is very probable a typo of the template that author uses, but since pdflatex will give us the right hyperlink, it is still reasonable to see whether we can do something. – Yai0Phah Apr 6 at 13:55

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.