3
\documentclass[ebook,12pt,oneside,openany]{memoir}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{xurl}

\usepackage[hyperindex=true]{hyperref}
\hypersetup{
    colorlinks   = true, %Colours links instead of ugly boxes
    urlcolor     = blue, %Colour for external hyperlinks
    linkcolor    = blue, %Colour of internal links
    citecolor   = red %Colour of citations
}
\title{Test}
\author{Author}
\date{}

\begin{document}

    \maketitle  
    \frontmatter    
    \tableofcontents \newpage   
    \mainmatter     
    \pagenumbering{arabic}

    \chapter{New Chapter}
    I am citing a book \footnote{sample footnote}.


    \backmatter     
\end{document}

I get following error message.

! LaTeX Error: No counter 'Hfootnote' defined.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                      

My .mk4 file is as follows:

Make:htlatex {}
Make:htlatex {}
8
  • 2
    Your code can not be tested as we don't have the input files. Show a real minimal example. Sep 5, 2019 at 13:33
  • Added a simplified code. There is some issue with HFootnote. Sep 5, 2019 at 14:13
  • Does the problem actually have anything to do with biblatex or can you reproduce the same error without biblatex? (If the latter is the case, please simplify your MWE further.)
    – moewe
    Sep 5, 2019 at 15:09
  • The error exists independent of biblatex. As soon as I add \usepackage[hyperindex=true]{hyperref}, it gives error. Sep 5, 2019 at 15:13
  • If the question has otherwise nothing to do with biblatex I recommend you remove the code for the bibliography (and the biblatex tag) to streamline the question and provide only the code necessary to reproduce the issue and nothing more.
    – moewe
    Sep 5, 2019 at 15:17

1 Answer 1

3

There is a clash between Memoir, Hyperref and tex4ht in a definition of footnotes. The simplest fix is to define the Hfootnote counter in tex4ht. This can be done in a custom configuration file. Save the following code as mycfg.cfg:

\Preamble{xhtml}
\makeatletter
\@ifpackageloaded{hyperref}{%
\ifHy@hyperfootnotes
\newcounter{Hfootnote}
\fi
}{}
\makeatother
\begin{document}
\EndPreamble

Request the config file using

tex4ebook -c mycfg.cfg filename.tex

The compilation should run without errors.

3
  • Thanks! this works. However, when a bibliography entry is clicked, it comes back to the first page of the chapter instead of bibliography page. Sep 6, 2019 at 11:59
  • @JyotiranjanBeuria I think this is another issue. or did it work before this fix?
    – michal.h21
    Sep 6, 2019 at 12:25
  • Yes, it worked before this trick. Now with this .cfg file, I am not able to reach an appropriate bibliography page. Sep 6, 2019 at 12:29

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.