pdflatex编译下可复现,在xelatex下跳转行为神秘...如题,考虑如下的MWE:
elegantbook.cls可以在这里获取。
\begin{filecontents*}[overwrite]{refs.bib}
@book{anima,
author = {Aristotle},
title = {De Anima},
date = 1907,
editor = {Hicks, Robert Drew},
publisher = cup,
location = {Cambridge},
keywords = {primary},
langid = {english},
langidopts = {variant=british},
annotation = {A \texttt{book} entry with an \texttt{author} and an \texttt{editor}},
}
\end{filecontents*}
\documentclass[11pt]{elegantbook}
\title{An Elegant \LaTeX{} Template for Books}
\subtitle{Classic Elegant\LaTeX{} Template}
\author{Ethan Deng, Liam Huang, syvshc, sikouhjw \& Osbert Wang}
\institute{Elegant\LaTeX{} Program}
\date{Dec. 31, 2022}
\version{4.5}
\bioinfo{Bio}{Information}
\extrainfo{\textcolor{red}{\bfseries Caution: This template will no longer be maintained since January 1st, 2023.}}
\logo{example-image-duck.pdf}
\cover{example-image-duck.pdf}
\ExecuteBibliographyOptions{backref=true}% add backref support here
\addbibresource{refs.bib}% bib
\begin{document}
\frontmatter
\maketitle%<-
\mainmatter
\lipsum[1-10]
\section{Bibliography}
This template uses biblatex to generate the bibliography, the default citestyle and bibliography style are both \lstinline{numeric}. Let's take a glance at the citation effect. ~\cite{anima} use data from a major peer-to-peer lending
In order to get the editors' auto-completion working, you need to add following code in your preamble:
\lipsum
\printbibliography[heading=bibintoc, title=\ebibname]
\end{document}含有\maketitle,文末参考文献的索引将错误地跳转到「封面首页」

如果去掉\maketitle,则行为符合预期

elegantbook.cls」的绝对前提下,修复\ExecuteBibliographyOptions{backref=true}在添加了\maketitle时功能的最佳实践是?一点探索,基本文档类book使用\maketitle不会有这个问题:
\begin{filecontents*}[overwrite]{refs.bib}
@book{anima,
author = {Aristotle},
title = {De Anima},
date = 1907,
editor = {Hicks, Robert Drew},
publisher = cup,
location = {Cambridge},
keywords = {primary},
langid = {english},
langidopts = {variant=british},
annotation = {A \texttt{book} entry with an \texttt{author} and an \texttt{editor}},
}
\end{filecontents*}
\documentclass[11pt]{book}
\usepackage{lipsum}
\title{test}
\usepackage[backref=true]{biblatex}
\addbibresource{refs.bib}% bib
\usepackage{hyperref}
\begin{document}
\frontmatter
\maketitle%<-
\mainmatter
\lipsum[1-10]
\section{Bibliography}
This template uses biblatex to generate the bibliography, the default citestyle and bibliography style are both Let's take a glance at the citation effect. ~\cite{anima} use data from a major peer-to-peer lending.
\lipsum
\printbibliography
\end{document}因此问题应该出在elegantbook自定义的封面命令中....
问题冲突的根源在于\maketitle内的这一行:
\renewcommand*{\maketitle}{%
\hypersetup{pageanchor=false}
\pagenumbering{Alph}
\begin{titlepage}
...
\end{titlepage}
\restoregeometry
\thispagestyle{empty}}至于模板设计时为何要在标题去掉pageanchor,有没有其他重要的考量....暂时没什么头绪...

应该可以直接patch掉...
\begin{filecontents*}[overwrite]{refs.bib}
@book{anima,
author = {Aristotle},
title = {De Anima},
date = 1907,
editor = {Hicks, Robert Drew},
publisher = cup,
location = {Cambridge},
keywords = {primary},
langid = {english},
langidopts = {variant=british},
annotation = {A \texttt{book} entry with an \texttt{author} and an \texttt{editor}},
}
\end{filecontents*}
\documentclass[11pt]{elegantbook}
\title{An Elegant \LaTeX{} Template for Books}
\subtitle{Classic Elegant\LaTeX{} Template}
\author{Ethan Deng, Liam Huang, syvshc, sikouhjw \& Osbert Wang}
\institute{Elegant\LaTeX{} Program}
\date{Dec. 31, 2022}
\version{4.5}
\bioinfo{Bio}{Information}
\extrainfo{\textcolor{red}{\bfseries Caution: This template will no longer be maintained since January 1st, 2023.}}
\logo{example-image-duck.pdf}
\cover{example-image-duck.pdf}
\ExecuteBibliographyOptions{backref=true}% add backref support here
\addbibresource{refs.bib}% bib
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\patchcmd{\maketitle}{\hypersetup{pageanchor=false}}{}{}{}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\frontmatter
\maketitle%<-
\mainmatter
\lipsum[1-10]
\section{Bibliography}
This template uses biblatex to generate the bibliography, the default citestyle and bibliography style are both \lstinline{numeric}. Let's take a glance at the citation effect. ~\cite{anima} use data from a major peer-to-peer lending
In order to get the editors' auto-completion working, you need to add following code in your preamble:
\lipsum
\printbibliography[heading=bibintoc, title=\ebibname]
\end{document}