1

I need the package pagenote to get endnotes with pagenumbers refering in the print version of the pdf with pdflatex. With tex4ebook I need to get this pagenotes accordingly, but without pagenumbers, and with hyperlinks to get from the epub text content to the endnote/pagenote at the end of the epub, and vice versa. In addition it should be possible to get into bibliography when cited an author.

With the follow MWE I get good result for the pdf print version. But when converting it into epub with tex4ebook, the links between endnote/pagenote in text document and at the end of the epub document lacks functionality and the pagenumbers are shown like in the print version pdf file.

\documentclass[11pt,a4paper]{report}
\usepackage{ebgaramond-maths}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage{tex4ebook}
\ifdefined\HCode
\usepackage[hyperfootnotes=true,
pdfauthor={Autor},
pdftitle={Titel},
pdfkeywords={Philosophy}]{hyperref}
\else\fi
\usepackage[sortlocale=auto,bibstyle=authoryear,citestyle=authortitle-ticomp]{biblatex}
\addbibresource{biblatex-examples.bib}
\usepackage[continuous,page]{pagenote}
\makepagenote
\let\footnote=\pagenote
\usepackage{csquotes}

\begin{document}
\section{Beginn einer Freundschaft}
    "`Ein zitierter Satz eines Autors."'\footcite{sigfridsson}
\clearpage
\section{Fortsetzung einer Freundschaft}
    "`Ein weiterer, zitierter Satz."'\footfullcite{sigfridsson}
\clearpage
\section{Kür einer Freundschaft}
    Etwas mit Fußnote/Pagenote.\footnote{A footnote that should become a pagenote, respectively a hyperref at the end of the ebook/epub file.}

\clearpage
\printnotes

\clearpage
\printbibliography

\end{document}

What should be done to get in the ebook a hyperref functionality for the pagenotes?

Edit 1:

Option hyperfootnotes in package hyperref added and package csquotes. But still no hyperfootnotes/pagenotes in epub visible. Instead the following warning during tex4ebook run:

Package biblatex Warning: Patching footnotes failed.
(biblatex)                Footnote detection will not work.

Does anybody know what to do?

Edit 2

The following has been successfully with pdflatex compiled after answer 1. When using the package pagenote (with pagenote.4ht file by Michal in answer 1) with bibliography and indexing an Undefined control sequence occurs if it is compiled with tex4ebook -a debug -c configfile.cfg -e buildfile.mk4 -m index Sourcefile.tex

The LaTeX file Sourcefile.tex shows like this as a MWE:

\documentclass[11pt,a4paper]{report}
\usepackage{ebgaramond-maths}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage{tex4ebook}
\ifdefined\HCode
\usepackage[xindy,noautomatic]{imakeidx}
\else
\usepackage[]{imakeidx}
\fi
\makeindex
\ifdefined\HCode
\usepackage[hyperfootnotes=true,hyperindex=true,
pdfauthor={Autor},
pdftitle={Titel},
pdfkeywords={Philosophy}]{hyperref}
\else\fi
\usepackage[sortlocale=auto,bibstyle=authoryear,citestyle=authortitle-ticomp]{biblatex}
\addbibresource{biblatex-examples.bib}
\usepackage[continuous,page]{pagenote}
\makepagenote
\let\footnote=\pagenote
\newcommand*{\addtonotesnewcommand}[1]{\addtonotes{\vspace*{0.7\baselineskip}\noindent\textsc{\vspace*{0.35\baselineskip}\large #1}}}
\renewcommand*{\notesname}{Anmerkungen und Verweise}
\usepackage{csquotes}
\renewcommand{\thesection}{\arabic{section}}
\begin{document}

\section{Beginn einer Freundschaft}
\addtonotesnewcommand{\thesection. Beginn einer Freundschaft}
    "`Ein zitierter Satz eines Autors.\index{Autor}"'\footcite{sigfridsson}

\clearpage
\section{Fortsetzung einer Freundschaft}
\addtonotesnewcommand{\thesection. Fortsetzung einer Freundschaft}
    "`Ein weiterer, zitierter Satz.\index{Satz}"'\footfullcite{sigfridsson}

\clearpage
\section{Kür einer Freundschaft}
\addtonotesnewcommand{\thesection. Kür einer Freundschaft}
    Etwas\index{Etwas} mit Fußnote/Pagenote.\footnote{A footnote that should become a pagenote}

\clearpage
\printnotes

\clearpage
\printindex

\clearpage
\printbibliography

\end{document}

And this is the problem:

Kapitel 1.
(./Testdocument_pagenote.ent
! Undefined control sequence.
l.1 ...Ct \relax \let \prOteCt \relax \Protect \gl
                                                  :removeindenttrue \unhbox ...

Without indexing the answer 1 here works best with tex4ebook. What can be done?

1
  • hyperref cannot help you, this will need separate configuration for this package. I will post it tomorrow.
    – michal.h21
    Commented Mar 21, 2023 at 23:00

1 Answer 1

0

The pagenote package is not supported by TeX4ht yet, but it is quite easy to add basic support. Try this configuration file, pagenote.4ht:

% patch commands that print note numbers, so we can add links
\NewConfigure{notenumintext}{2}
\def\:tempa#1{\a:notenumintext\o:notenumintext:{#1}\b:notenumintext}
\HLet\notenumintext\:tempa

\NewConfigure{notenuminnotes}{2}
% we must save the note id in \:currentnoteid, to make it available in \Configure{notenuminnotes}
\def\:tempa#1{\def\:currentnoteid{#1}\a:notenuminnotes\o:notenuminnotes:{#1}\b:notenuminnotes}
\HLet\notenuminnotes\:tempa

% to remove the page numbers
\HLet\pageinnotes\:gobble

% default configuration
\Configure{notenumintext}{\Link{pagenote\thepagenote}{pagenote-bk\thepagenote}}{\EndLink}
\Configure{notenuminnotes}{\Link{pagenote-bk\:currentnoteid}{pagenote\:currentnoteid}}{\EndLink}

\Hinput{pagenote}

\endinput

This configuration adds links to footnotes and back to text from footnotes.

Edit:

With the updated TeX file, you need to use \protect for \noindent in your \addtonotesnewcommand. To prevent the spurious Kapitel 0 text, you also need to update the counter that pagenote keeps to detect chapter changes:

\newcommand*{\addtonotesnewcommand}[1]{%
  \ifpnhaschapter%
    \ifnum\value{pnotesavechap}=\value{chapter}\else%
      \setcounter{pnotesavechap}{\value{chapter}}%
    \fi%
  \else%
    \ifnum\value{pnotesavechap}=\value{section}\else%
      \setcounter{pnotesavechap}{\value{section}}%
    \fi%
  \fi%
  \addtonotes{\vspace*{0.7\baselineskip}\protect\noindent\vspace*{0.35\baselineskip}\textsc{\large #1}}%
}

This is the full TeX file:

\documentclass[11pt,a4paper]{report}
\usepackage{ebgaramond-maths}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage{tex4ebook}
\ifdefined\HCode
\usepackage[xindy,noautomatic]{imakeidx}
\else
\usepackage[]{imakeidx}
\fi
\makeindex
\ifdefined\HCode
\usepackage[hyperfootnotes=true,hyperindex=true,
pdfauthor={Autor},
pdftitle={Titel},
pdfkeywords={Philosophy}]{hyperref}
\else\fi
\usepackage[sortlocale=auto,bibstyle=authoryear,citestyle=authortitle-ticomp]{biblatex}
\addbibresource{biblatex-examples.bib}
\usepackage[continuous,page]{pagenote}
\makepagenote
\let\footnote=\pagenote
\newcommand*{\addtonotesnewcommand}[1]{%
  \ifpnhaschapter%
    \ifnum\value{pnotesavechap}=\value{chapter}\else%
      \setcounter{pnotesavechap}{\value{chapter}}%
    \fi%
  \else%
    \ifnum\value{pnotesavechap}=\value{section}\else%
      \setcounter{pnotesavechap}{\value{section}}%
    \fi%
  \fi%
  \addtonotes{\vspace*{0.7\baselineskip}\protect\noindent\vspace*{0.35\baselineskip}\textsc{\large #1}}%
}
% \newcommand*{\addtonotesnewcommand}[1]{\addtonotes{#1}}
\renewcommand*{\notesname}{Anmerkungen und Verweise}
\usepackage{csquotes}
\renewcommand{\thesection}{\arabic{section}}
\begin{document}

\section{Beginn einer Freundschaft}
\addtonotesnewcommand{\thesection. Beginn einer Freundschaft}
    "`Ein zitierter Satz eines Autors.\index{Autor}"'\footcite{sigfridsson}

\clearpage
\section{Fortsetzung einer Freundschaft}
\addtonotesnewcommand{\thesection. Fortsetzung einer Freundschaft}
    "`Ein weiterer, zitierter Satz.\index{Satz}"'\footfullcite{sigfridsson}

\clearpage
\section{Kür einer Freundschaft}
\addtonotesnewcommand{\thesection. Kür einer Freundschaft}
    Etwas\index{Etwas} mit Fußnote/Pagenote.\footnote{A footnote that should become a pagenote}

\clearpage
\printnotes

\clearpage
\printindex

\clearpage
\printbibliography

\end{document}

This is the result:

enter image description here

And backlinks from the notes page:

enter image description here

13
  • Thank you very much, Michal. I will try it later in the evening. But it seems that you have solved the task. Is it planed to implement this functionality in TeX4ht depending on loaded package pagenote?
    – Thomkrates
    Commented Mar 22, 2023 at 13:36
  • @Thomkrates yes, I will add it
    – michal.h21
    Commented Mar 22, 2023 at 13:42
  • Thank you, it works like intended for the epub. - But in the pdf the "Kapitel 0" in the "Notes" is not necessary. With \renewcommand*{\chaptername}{} it is not possible to "delete" it. I use my own definition of \addtonotes to have separate section titles dividing the continuous pagenotes. But the "Kapitel 0" remains. It seems that it comes from \printnotes. But how to suppress "Kapitel 0" in pdf file?
    – Thomkrates
    Commented Mar 22, 2023 at 16:43
  • I added Edit 2 to my question; here indexing is added, but with error message of undefined control sequence when running tex4ebook. What needs to be done to fix this?
    – Thomkrates
    Commented Mar 22, 2023 at 19:31
  • @Thomkrates the error is not caused by the indexing, but by the \addtonotesnewcommand command. I've updated my answer with a fix.
    – michal.h21
    Commented Mar 23, 2023 at 11:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .