I've got a book containing multiple articles. Since each article is a text on its own, I reset the footnote counter to 0, whenever a new article starts, so that the numbering of the footnotes starts with 1 for each article.

When generating PDFs something like this works great (simplified):

    \setcounter{footnote}{0} % reset footnote counter
    \chapter{#1} % treat article title as a new chapter in the book

And then use \myArticle{my article's title} for each new article.

However, when using tex4ebook to generate ebooks of the same source, the duplicate footnote numbers cause issues with how TeX4ht handles footnotes.

First, it warns about the duplicates:

l.XXX --- TeX4ht warning --- Multiple footnote texts for mark 1 ---

Since the content for each footnote is written in a file with the footnote number as suffix (i.e. my_book11.html for footnote 11 of the my_book.epub book), it cannot possibly include multiple footnotes with the same number.

In the resulting HTML file of an article (and thus the generated epub file), only the footnotes of the first article therefore work correcly. Later footnotes with the same numbers link to the footnotes of the first article. TeX4Ht also decides to write the footnote content of the duplicates directly into the article's text after the wrong footnote link.

Is there way to modify how tex4ht generates the file names for footnote files and the links in the footnote markers? I was thinking that maybe one could identify the footnote by adding a prefix of the chapter number, so that "1-11" is the 11th footnote of article #1, and "2-11" is footnote 11 of article 2 etc.

I found uses of \Configure{footnotemark}, \Configure{footnotetext} and \LinkCommand\fnlink in the tex4ebook-epub3.4ht file, but could not figure out how to use those for my purpose. I have not found any documentation about them in the tex4ht docs or by googling. Maybe they can help or is there an easier way?

  • could you post a full mwe here, please? I can't reproduce this behavior, it may be caused by some additional package you use. – michal.h21 Apr 4 '17 at 11:16

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.