![将 pagenote 与 tex4ebook 一起打包不会产生令人满意的电子书链接](https://linux22.com/image/462678/%E5%B0%86%20pagenote%20%E4%B8%8E%20tex4ebook%20%E4%B8%80%E8%B5%B7%E6%89%93%E5%8C%85%E4%B8%8D%E4%BC%9A%E4%BA%A7%E7%94%9F%E4%BB%A4%E4%BA%BA%E6%BB%A1%E6%84%8F%E7%9A%84%E7%94%B5%E5%AD%90%E4%B9%A6%E9%93%BE%E6%8E%A5.png)
我需要一个包pagenote
来获取带有页码的尾注,这些页码引用了 pdflatex 的打印版 pdf。tex4ebook
我需要相应地获取这些页注,但不带页码,并带有超链接,以便从 epub 文本内容转到 epub 末尾的尾注/页注,反之亦然。此外,引用作者时应该可以进入参考书目。
使用以下 MWE,我获得了 pdf 打印版本的良好效果。但是,当使用 tex4ebook 将其转换为 epub 时,文本文档中的 endnote/pagenote 和 epub 文档末尾之间的链接缺乏功能,并且页码显示方式与打印版本 pdf 文件中的类似。
\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}
怎样做才能在电子书中获得页面注释的超引用功能?
编辑1:
hyperfootnotes
包中添加了选项hyperref
和包csquotes
。但 epub 中仍然看不到超脚注/分页注释。相反,在 tex4ebook 运行期间出现以下警告:
Package biblatex Warning: Patching footnotes failed.
(biblatex) Footnote detection will not work.
有人知道该怎么办吗?
编辑2
以下内容已在回答 1 之后使用 pdflatex 成功编译。使用软件包pagenote
(答案 1 中 Michal 提供的 pagenote.4ht 文件)时bibliography
和 indexing
Undefined control sequence
如果使用以下方式编译,则会 发生tex4ebook -a debug -c configfile.cfg -e buildfile.mk4 -m index Sourcefile.tex
LaTeX 文件Sourcefile.tex
以 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}
这就是问题所在:
Kapitel 1.
(./Testdocument_pagenote.ent
! Undefined control sequence.
l.1 ...Ct \relax \let \prOteCt \relax \Protect \gl
:removeindenttrue \unhbox ...
如果不索引答案 1,则 tex4ebook 的效果最佳。该怎么办?
答案1
该pagenote
软件包尚未得到 TeX4ht 的支持,但添加基本支持相当容易。尝试这个配置文件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
此配置添加了指向脚注的链接以及从脚注返回文本的链接。
编辑:
使用更新的 TeX 文件,您需要在 中使用\protect
for 。为了防止出现虚假文本,您还需要更新用于检测章节更改的计数器:\noindent
\addtonotesnewcommand
Kapitel 0
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}}%
}
这是完整的 TeX 文件:
\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}
结果如下:
以及来自注释页面的反向链接: