100 `elegantbook`宏包的使用`biblatex`选项backref=true时跳转位置不准确?

发布于 2026-01-17 15:57:15

Claim:这种跳转似乎只在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,文末参考文献的索引将错误地跳转到「封面首页」

情况1.gif

情况二:

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

情况2.gif


问题:

  • 这种现象出现的原因是什么?
  • 在不改动「elegantbook.cls」的绝对前提下,修复\ExecuteBibliographyOptions{backref=true}在添加了\maketitle时功能的最佳实践是?

Edited

一点探索,基本文档类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自定义的封面命令中....

查看更多

关注者
0
被浏览
78
1 个回答
Sagittarius Rover
Sagittarius Rover 13小时前
这家伙很懒,什么也没写!

问题冲突的根源在于\maketitle内的这一行

\renewcommand*{\maketitle}{%
\hypersetup{pageanchor=false}
\pagenumbering{Alph}
\begin{titlepage}
...
\end{titlepage}
\restoregeometry
\thispagestyle{empty}}

至于模板设计时为何要在标题去掉pageanchor,有没有其他重要的考量....暂时没什么头绪...

image.png


应该可以直接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}

撰写答案

请登录后再发布答案,点击登录

发布
问题

分享
好友

手机
浏览

扫码手机浏览