BibLaTeX backref 使用 hyperref 链接到错误页面

BibLaTeX backref 使用 hyperref 链接到错误页面

我尝试使用 BibLaTeX 的 backref 选项进行反向引用,但参考书目中的页面链接到错误的页面(即使列出的页面是正确的)。链接似乎系统地提前了大约 12 页(对应于前言的长度)。Backref 应该能够正确链接到给定的页码,因为前言用罗马数字编号,而正文用阿拉伯数字编号,因此页码是唯一的(我使用了plainpages=falsehyperref 选项,如下所建议:为什么 backref 引用了错误的页面?)。

我尝试提出 MWE,但无法用较小的示例重现错误。这是一个相当完整的示例(我不得不删除注释以使其适合)。

Thesis.tex 的内容:

\documentclass[11pt, a4paper, oneside]{Thesis}

\graphicspath{{./Figures/}}

\hypersetup{urlcolor=blue, colorlinks=true, plainpages=false}
\title{\ttitle}

\usepackage[style=authoryear-comp,citetracker=true,natbib=true,hyperref=true,backend=biber,maxbibnames=99,maxcitenames=2,firstinits=true,uniquename=init,parentracker=true,backref=true,backrefstyle=three]{biblatex}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@misc{A01,
  author = {Author, A. and Buthor, B. and Cuthor, C.},
  year = {2001},
  title = {Alpha},
}
@misc{A02,
  author = {Duthor, D. and Euthor, E. and Futhor, F.},
  year = {2010},
  title = {Beta},
}
\end{filecontents}

\addbibresource{\jobname.bib}

\DeclareNameAlias{sortname}{last-first}

\renewbibmacro{in:}{}

\AtEveryBibitem{
  \clearfield{month}{}
  \clearlist{language}{}
  }

\let\citealp\cite
\let\cite\textcite

\setlength\bibitemsep{0.5ex}
\setlength\bibnamesep{1.2ex}

\renewbibmacro*{volume+number+eid}{
  \setunit*{\addcomma\space}
  \textit{\printfield{volume}}
  \textit{\printfield{number}}
  \printfield{eid}}
  \DeclareFieldFormat[article]{number}{(#1)}

\DefineBibliographyStrings{english}{
backrefpage={cited on p\adddot},
backrefpages={cited on pp\adddot}
}

\DeclareFieldFormat{pages}{#1}

\DeclareFieldFormat[article]{title}{#1}
\DeclareFieldFormat[incollection]{title}{#1}
\DeclareFieldFormat[unpublished]{title}{#1}

\setcounter{biburllcpenalty}{7000}
\setcounter{biburlucpenalty}{8000}

\AtEveryCitekey{
  \ifciteseen{}{\defcounter{maxnames}{6}\clearfield{namehash}}}

\AtBeginBibliography{
  \renewcommand*{\finalnamedelim}{
    \ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}
    \addspace\&\space}
}

\let\origparencite\parencite
\renewrobustcmd{\parencite}{
  \AtNextCite{
  \renewcommand*{\finalnamedelim}{
    \ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}
    \addspace\&\space}
  }
  \origparencite
}

\makeatletter
\renewbibmacro*{cite}{
  \iffieldundef{shorthand}
    {\ifthenelse{\ifnameundef{labelname}\OR\iffieldundef{labelyear}}
       {\printtext[bibhyperref]{
          \DeclareFieldAlias{bibhyperref}{default}
          \usebibmacro{cite:label}
          \setunit{\addspace}
          \usebibmacro{cite:labelyear+extrayear}}
          \usebibmacro{cite:reinit}}
       {\iffieldequals{namehash}{\cbx@lasthash}
          {\ifthenelse{\iffieldequals{labelyear}{\cbx@lastyear}\AND
                       \(\value{multicitecount}=0\OR\iffieldundef{postnote}\)}
             {\setunit{\addcomma}
              \usebibmacro{cite:extrayear}}
             {\setunit{\compcitedelim}
              \usebibmacro{cite:labelyear+extrayear}
              \savefield{labelyear}{\cbx@lastyear}}}
          {\printtext[bibhyperref]{
             \DeclareFieldAlias{bibhyperref}{default}
             \printnames{labelname}
             \setunit{\nameyeardelim}
             \usebibmacro{cite:labelyear+extrayear}}
             \savefield{namehash}{\cbx@lasthash}
             \savefield{labelyear}{\cbx@lastyear}}}}
    {\usebibmacro{cite:shorthand}
     \usebibmacro{cite:reinit}}
  \setunit{\multicitedelim}}

\renewbibmacro*{textcite}{
  \iffieldequals{namehash}{\cbx@lasthash}
    {\iffieldundef{shorthand}
       {\ifthenelse{\iffieldequals{labelyear}{\cbx@lastyear}\AND
                    \(\value{multicitecount}=0\OR\iffieldundef{postnote}\)}
          {\setunit{\addcomma}
           \usebibmacro{cite:extrayear}}
          {\setunit{\compcitedelim}
           \usebibmacro{cite:labelyear+extrayear}
           \savefield{labelyear}{\cbx@lastyear}}}
       {\setunit{\compcitedelim}
        \usebibmacro{cite:shorthand}
        \global\undef\cbx@lastyear}}
    {\ifnameundef{labelname}
       {\printtext[bibhyperref]{
          \DeclareFieldAlias{bibhyperref}{default}
          \iffieldundef{shorthand}
            {\usebibmacro{cite:label}
             \setunit{
               \global\booltrue{cbx:parens}
               \addspace\bibopenparen}
             \ifnumequal{\value{citecount}}{1}
               {\usebibmacro{prenote}}
               {}
             \usebibmacro{cite:labelyear+extrayear}}
            {\usebibmacro{cite:shorthand}}
          \ifthenelse{\iffieldundef{postnote}\AND
                      \(\value{multicitetotal}=0\AND\value{citetotal}=1\)}
            {\bibcloseparen
             \global\boolfalse{cbx:parens}}
            {}}}
       {\printtext[bibhyperref]{
          \DeclareFieldAlias{bibhyperref}{default}
          \printnames{labelname}
          \setunit{
            \global\booltrue{cbx:parens}
            \addspace\bibopenparen}
          \ifnumequal{\value{citecount}}{1}
            {\usebibmacro{prenote}}
            {}
          \iffieldundef{shorthand}
            {\iffieldundef{labelyear}
               {\usebibmacro{cite:label}}
               {\usebibmacro{cite:labelyear+extrayear}}
             \savefield{labelyear}{\cbx@lastyear}}
            {\usebibmacro{cite:shorthand}
             \global\undef\cbx@lastyear}
          \ifthenelse{\iffieldundef{postnote}\AND
                      \(\value{multicitetotal}=0\AND\value{citetotal}=1\)}
            {\bibcloseparen
             \global\boolfalse{cbx:parens}}
            {}}
          \savefield{namehash}{\cbx@lasthash}}}
  \setunit{
    \ifbool{cbx:parens}
      {\bibcloseparen\global\boolfalse{cbx:parens}}
      {}
    \multicitedelim}}

\makeatother

\usepackage{units}
\usepackage{titlesec}
\usepackage{tabu} 
\usepackage{threeparttablex}
\usepackage{rotating}
\usepackage{lscape}
\usepackage{multirow}
\usepackage{afterpage}
\usepackage{hyperref}

\setcounter{secnumdepth}{4}
\setcounter{tocdepth}{4}

\usepackage[]{graphicx}
\usepackage[]{color}

\makeatletter
\def\maxwidth{
  \ifdim\Gin@nat@width>\linewidth
    \linewidth
  \else
    \Gin@nat@width
  \fi
}
\makeatother

\definecolor{fgcolor}{rgb}{0.345, 0.345, 0.345}
\newcommand{\hlnum}[1]{\textcolor[rgb]{0.686,0.059,0.569}{#1}}
\newcommand{\hlstr}[1]{\textcolor[rgb]{0.192,0.494,0.8}{#1}}
\newcommand{\hlcom}[1]{\textcolor[rgb]{0.678,0.584,0.686}{\textit{#1}}}
\newcommand{\hlopt}[1]{\textcolor[rgb]{0,0,0}{#1}}
\newcommand{\hlstd}[1]{\textcolor[rgb]{0.345,0.345,0.345}{#1}}
\newcommand{\hlkwa}[1]{\textcolor[rgb]{0.161,0.373,0.58}{\textbf{#1}}}
\newcommand{\hlkwb}[1]{\textcolor[rgb]{0.69,0.353,0.396}{#1}}
\newcommand{\hlkwc}[1]{\textcolor[rgb]{0.333,0.667,0.333}{#1}}
\newcommand{\hlkwd}[1]{\textcolor[rgb]{0.737,0.353,0.396}{\textbf{#1}}}

\usepackage{framed}
\makeatletter
\newenvironment{kframe}{
 \def\at@end@of@kframe{}
 \ifinner\ifhmode
  \def\at@end@of@kframe{\end{minipage}}
  \begin{minipage}{\columnwidth}
 \fi\fi
 \def\FrameCommand##1{\hskip\@totalleftmargin \hskip-\fboxsep
 \colorbox{shadecolor}{##1}\hskip-\fboxsep
     \hskip-\linewidth \hskip-\@totalleftmargin \hskip\columnwidth}
 \MakeFramed {\advance\hsize-\width
   \@totalleftmargin\z@ \linewidth\hsize
   \@setminipage}}
 {\par\unskip\endMakeFramed
 \at@end@of@kframe}
\makeatother

\definecolor{shadecolor}{rgb}{.97, .97, .97}
\definecolor{messagecolor}{rgb}{0, 0, 0}
\definecolor{warningcolor}{rgb}{1, 0, 1}
\definecolor{errorcolor}{rgb}{1, 0, 0}
\newenvironment{knitrout}{}{}

\usepackage{alltt}
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}

\begin{document}

\frontmatter

\setstretch{1.3}

\fancyhead{}
\rhead{\thepage}
\lhead{}

\pagestyle{fancy}

\newcommand{\HRule}{\rule{\linewidth}{0.5mm}}

\hypersetup{pdftitle={\ttitle}}
\hypersetup{pdfsubject=\subjectname}
\hypersetup{pdfauthor=\authornames}
\hypersetup{pdfkeywords=\keywordnames}

\begin{titlepage}
\begin{center}

\textsc{\LARGE \univname}\\[1.5cm]
\textsc{\Large Doctoral Thesis}\\[0.5cm]

\HRule \\[0.4cm]
{\huge \bfseries \ttitle}\\[0.4cm]
\HRule \\[1.5cm]

\begin{minipage}{0.4\textwidth}
\begin{flushleft} \large
\emph{Author:}\\
\href{http://www.google.com}{\authornames}
\end{flushleft}
\end{minipage}
\begin{minipage}{0.4\textwidth}
\begin{flushright} \large
\emph{Supervisor:} \\
\href{http://www.google.com}{\supname}
\end{flushright}
\end{minipage}\\[3cm]

\large \textit{A thesis submitted in fulfillment of the requirements\\ for the degree of \degreename}\\[0.3cm]
\textit{in the}\\[0.4cm]
\groupname \\ of the\\\deptname\\[2cm]

{\large \today}\\[4cm]

\vfill
\end{center}

\end{titlepage}

\Declaration{

\addtocontents{toc}{\vspace{1em}}

I, \authornames, declare that this thesis titled, `\ttitle' and the work presented in it are my own. I confirm that:

\begin{itemize} 
\item[\tiny{$\blacksquare$}] This work was done wholly or mainly while in candidature for a research degree at this University.\\
\end{itemize}

Signed:\\
\rule[1em]{25em}{0.5pt}

Date:\\
\rule[1em]{25em}{0.5pt}
}

\clearpage

\pagestyle{empty}

\null\vfill

\textit{``Quote''}

\begin{flushright}
Author
\end{flushright}

\vfill\vfill\vfill\vfill\vfill\vfill\null

\clearpage

\addtotoc{Abstract}

\abstract{\addtocontents{toc}{\vspace{1em}}

The Thesis Abstract is written here
}

\clearpage

\setstretch{1.3}

\acknowledgments{\addtocontents{toc}{\vspace{1em}}

Acknowledments text.

}
\clearpage

\pagestyle{fancy}

\lhead{\emph{Contents}}
\tableofcontents

\lhead{\emph{List of Figures}}
\listoffigures

\lhead{\emph{List of Tables}}
\listoftables

\clearpage

\setstretch{1.5}

\lhead{\emph{Abbreviations}}
\listofsymbols{ll}
{
\textbf{Acronym} & \textbf{W}hat (it) \textbf{S}tands \textbf{F}or \\
}

\clearpage

\lhead{\emph{Physical Constants}}

\listofconstants{lrcl}
{
Speed of Light & $c$ & $=$ & $2.997\ 924\ 58\times10^{8}\ \mbox{ms}^{-\mbox{s}}$ (exact)\\
 Constant Name & Symbol & = & Constant Value (with units) \\
}

\clearpage

\lhead{\emph{Symbols}}

\listofnomenclature{lll}
{
$a$ & distance & m \\
$P$ & power & W (Js$^{-1}$) \\

& & \\

$\omega$ & angular frequency & rads$^{-1}$ \\
}

\setstretch{1.3}

\pagestyle{empty}

\dedicatory{Dedication text.}

\addtocontents{toc}{\vspace{2em}}

\mainmatter

\pagestyle{fancy}

\section{Introduction}
Test 1 \citep{A01}.

\clearpage
Test 2 \citep{A02}.

\addtocontents{toc}{\vspace{2em}}

\appendix

\addtocontents{toc}{\vspace{2em}}

\backmatter

\label{Bibliography}
\lhead{\emph{Bibliography}}
\printbibliography
\end{document}

Thesis.cls的内容:

\NeedsTeXFormat{LaTeX2e}[1996/12/01]
\ProvidesClass{Thesis}
              [2007/22/02 v1.0
   LaTeX document class]
\def\baseclass{book}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{\baseclass}}
\def\@checkoptions#1#2{
  \edef\@curroptions{\@ptionlist{\@currname.\@currext}}
  \@tempswafalse
  \@tfor\@this:=#2\do{
    \@expandtwoargs\in@{,\@this,}{,\@curroptions,}
    \ifin@ \@tempswatrue \@break@tfor \fi}
  \let\@this\@empty
  \if@tempswa \else \PassOptionsToClass{#1}{\baseclass}\fi
}
\@checkoptions{11pt}{{10pt}{11pt}{12pt}}
\PassOptionsToClass{a4paper}{\baseclass}
\ProcessOptions\relax
\LoadClass{\baseclass}
\newcommand\bhrule{\typeout{------------------------------------------------------------------------------}}

\newcommand\Declaration[1]{
\btypeout{Declaration of Authorship}
\addtotoc{Declaration of Authorship}
\thispagestyle{plain}
\null\vfil
\begin{center}{\huge\bf Declaration of Authorship\par}\end{center}
{\normalsize #1}
\vfil\vfil\null
}

\newcommand\btypeout[1]{\bhrule\typeout{\space #1}\bhrule}
\def\today{\ifcase\month\or
  January\or February\or March\or April\or May\or June\or
  July\or August\or September\or October\or November\or December\fi
  \space \number\year}
\usepackage{setspace}
\onehalfspacing
\setlength{\parindent}{0pt}
\setlength{\parskip}{2.0ex plus0.5ex minus0.2ex}
\usepackage{vmargin}

\RequirePackage[utf8]{inputenc}

\setmarginsrb  { 1.5in}
                        { 0.6in}
                        { 1.0in}
                        { 0.8in}
                        {  20pt}
                        {0.25in}
                        {   9pt}
                        { 0.3in}
\raggedbottom
\setlength{\topskip}{1\topskip \@plus 5\p@}
\doublehyphendemerits=10000
\brokenpenalty=10000
\widowpenalty=9999
\clubpenalty=9999
\interfootnotelinepenalty=9999
\usepackage{fancyhdr}
\lhead[\rm\thepage]{\fancyplain{}{\sl{\rightmark}}}
\rhead[\fancyplain{}{\sl{\leftmark}}]{\rm\thepage}
\chead{}\lfoot{}\rfoot{}\cfoot{}
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\btypeout{\thechapter\space #1}\markboth{\@chapapp\ \thechapter\ #1}{\@chapapp\ \thechapter\ #1}}
\renewcommand{\sectionmark}[1]{}
\renewcommand{\subsectionmark}[1]{}
\def\cleardoublepage{\clearpage\if@twoside \ifodd\c@page\else
\hbox{}
\thispagestyle{empty}
\newpage
\if@twocolumn\hbox{}\newpage\fi\fi\fi}
\usepackage{amsmath,amsfonts,amssymb,amscd,amsthm,xspace}
\theoremstyle{plain}
\newtheorem{example}{Example}[chapter]
\newtheorem{theorem}{Theorem}[chapter]
\newtheorem{corollary}[theorem]{Corollary}
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{axiom}[theorem]{Axiom}
\theoremstyle{definition}
\newtheorem{definition}[theorem]{Definition}
\theoremstyle{remark}
\newtheorem{remark}[theorem]{Remark}
\usepackage[centerlast,small,sc]{caption}
\setlength{\captionmargin}{20pt}
\newcommand{\fref}[1]{Figure~\ref{#1}}
\newcommand{\tref}[1]{Table~\ref{#1}}
\newcommand{\eref}[1]{Equation~\ref{#1}}
\newcommand{\cref}[1]{Chapter~\ref{#1}}
\newcommand{\sref}[1]{Section~\ref{#1}}
\newcommand{\aref}[1]{Appendix~\ref{#1}}
\renewcommand{\topfraction}{0.85}
\renewcommand{\bottomfraction}{.85}
\renewcommand{\textfraction}{0.1}
\renewcommand{\dbltopfraction}{.85}
\renewcommand{\floatpagefraction}{0.75}
\renewcommand{\dblfloatpagefraction}{.75}
\setcounter{topnumber}{9}
\setcounter{bottomnumber}{9}
\setcounter{totalnumber}{20}
\setcounter{dbltopnumber}{9}
\usepackage{graphicx}
\usepackage{epstopdf}
\usepackage[scriptsize]{subfigure}
\usepackage{booktabs}
\usepackage{rotating}
\usepackage{listings}
\usepackage{lstpatch}
\lstset{captionpos=b,
        frame=tb,
        basicstyle=\scriptsize\ttfamily,
        showstringspaces=false,
        keepspaces=true}
\lstdefinestyle{matlab} {
        language=Matlab,
        keywordstyle=\color{blue},
        commentstyle=\color[rgb]{0.13,0.55,0.13}\em,
        stringstyle=\color[rgb]{0.7,0,0} }
\usepackage[pdfpagemode={UseOutlines},bookmarks=true,bookmarksopen=true,
   bookmarksopenlevel=0,bookmarksnumbered=true,hypertexnames=false,
   colorlinks,linkcolor={blue},citecolor={blue},urlcolor={red},
   pdfstartview={FitV},unicode,breaklinks=true]{hyperref}
\pdfstringdefDisableCommands{
   \let\\\space
}
\newcommand*{\supervisor}[1]{\def\supname{#1}}
\newcommand*{\thesistitle}[1]{\def\ttitle{#1}}
\newcommand*{\examiner}[1]{\def\examname{#1}}
\newcommand*{\degree}[1]{\def\degreename{#1}}
\newcommand*{\authors}[1]{\def\authornames{#1}}
\newcommand*{\addresses}[1]{\def\addressnames{#1}}
\newcommand*{\university}[1]{\def\univname{#1}}
\newcommand*{\UNIVERSITY}[1]{\def\UNIVNAME{#1}}
\newcommand*{\department}[1]{\def\deptname{#1}}
\newcommand*{\DEPARTMENT}[1]{\def\DEPTNAME{#1}}
\newcommand*{\group}[1]{\def\groupname{#1}}
\newcommand*{\GROUP}[1]{\def\GROUPNAME{#1}}
\newcommand*{\faculty}[1]{\def\facname{#1}}
\newcommand*{\FACULTY}[1]{\def\FACNAME{#1}}
\newcommand*{\subject}[1]{\def\subjectname{#1}}
\newcommand*{\keywords}[1]{\def\keywordnames{#1}}

\thesistitle{Thesis Title}
\supervisor{Dr. Faculty \textsc{Name}} 
\examiner{}
\degree{Doctor of Philosophy}
\authors{My \textsc{Name}}
\addresses{}
\subject{}
\keywords{}
\university{\texorpdfstring{\href{http://www.iub.edu}
                {University}}
                {University}} 
\UNIVERSITY{\texorpdfstring{\href{http://www.iub.edu}
                {UNIVERSITY}}
                {UNIVERSITY}}
\department{\texorpdfstring{\href{http://psych.indiana.edu/index.php}
                {Department}}
                {Department}}
\DEPARTMENT{\texorpdfstring{\href{http://psych.indiana.edu/index.php}
                {DEPARTMENT}}
                {DEPARTMENTS}}
\group{\texorpdfstring{\href{http://psych.indiana.edu/clinical.php}
                {Research group}}
                {Research group}}       
\GROUP{\texorpdfstring{\href{http://psych.indiana.edu/clinical.php}
                {RESEARCH GROUP}}
                {RESEARCH GROUP}}
\faculty{\texorpdfstring{\href{http://psych.indiana.edu/faculty/batesj.php}
                {Faculty}}
                {Faculty}}
\FACULTY{\texorpdfstring{\href{http://psych.indiana.edu/faculty/batesj.php}
                {FACULTY)}}
                {FACULTY}}

\renewcommand\maketitle{
  \btypeout{Title Page}
  \hypersetup{pdftitle={\@title}}
  \hypersetup{pdfsubject=\subjectname}
  \hypersetup{pdfauthor=\authornames}
  \hypersetup{pdfkeywords=\keywordnames}
  \thispagestyle{empty}
  \begin{titlepage}
    \let\footnotesize\small
    \let\footnoterule\relax
    \let \footnote \thanks
    \setcounter{footnote}{0}
    \null\vfil
    \vskip 60\p@
    \begin{center}
      \setlength{\parskip}{0pt}
      {\large\textbf{\UNIVNAME}\par}
      \vfill
      {\huge \bf \@title \par}
      \vfill
      {\LARGE by \par}
      \smallskip
      {\LARGE \authornames \par}
      \vfill
      {\large A thesis submitted in partial fulfillment for the \par}
      {\large degree of \degreename \par}
      \bigskip
      \bigskip
      {\large in the \par}
      {\large \facname \par}
      {\large \deptname \par} 
      \bigskip
      \bigskip
      \bigskip
      {\Large \@date \par}
      \bigskip
    \end{center}
    \par
    \@thanks
    \vfil\null
  \end{titlepage}
  \setcounter{footnote}{0}
  \global\let\thanks\relax
  \global\let\maketitle\relax
  \global\let\@thanks\@empty
  \global\let\@author\@empty
  \global\let\@date\@empty
  \global\let\@title\@empty
  \global\let\title\relax
  \global\let\author\relax
  \global\let\date\relax
  \global\let\and\relax
  \cleardoublepage
}
\newenvironment{abstract}
{
  \btypeout{Abstract Page}
  \thispagestyle{empty}
  \null\vfil
  \begin{center}
    \setlength{\parskip}{0pt}
    {\normalsize \UNIVNAME \par}
    \bigskip
    {\huge{\textit{Abstract}} \par}
    \bigskip
    {\normalsize \facname \par}
    {\normalsize \deptname \par}
    \bigskip
    {\normalsize \degreename\par}
    \bigskip
    {\normalsize\bf \@title \par}
    \medskip
    {\normalsize by \authornames \par}
    \bigskip
  \end{center}
}
{
  \vfil\vfil\vfil\null
  \cleardoublepage
}
\addtocounter{secnumdepth}{1}
\setcounter{tocdepth}{6}
\newcounter{dummy}
\newcommand\addtotoc[1]{
\refstepcounter{dummy}
\addcontentsline{toc}{chapter}{#1}}
\renewcommand\tableofcontents{
\btypeout{Table of Contents}
\begin{spacing}{1}{
    \setlength{\parskip}{1pt}
    \if@twocolumn
      \@restonecoltrue\onecolumn
    \else
      \@restonecolfalse
    \fi
    \chapter*{\contentsname
        \@mkboth{
           \MakeUppercase\contentsname}{\MakeUppercase\contentsname}}
    \@starttoc{toc}
    \if@restonecol\twocolumn\fi
   \cleardoublepage
}\end{spacing}
}
\renewcommand\listoffigures{
\btypeout{List of Figures}
\addtotoc{List of Figures}
\begin{spacing}{1}{
    \setlength{\parskip}{1pt}
    \if@twocolumn
      \@restonecoltrue\onecolumn
    \else
      \@restonecolfalse
    \fi
    \chapter*{\listfigurename
      \@mkboth{\MakeUppercase\listfigurename}
              {\MakeUppercase\listfigurename}}
    \@starttoc{lof}
    \if@restonecol\twocolumn\fi
    \cleardoublepage
}\end{spacing}
}
\renewcommand\listoftables{
\btypeout{List of Tables}
\addtotoc{List of Tables}
\begin{spacing}{1}{
    \setlength{\parskip}{1pt}
    \if@twocolumn
      \@restonecoltrue\onecolumn
    \else
      \@restonecolfalse
    \fi
    \chapter*{\listtablename
      \@mkboth{
          \MakeUppercase\listtablename}{\MakeUppercase\listtablename}}
    \@starttoc{lot}
    \if@restonecol\twocolumn\fi
    \cleardoublepage
}\end{spacing}
}
\newcommand\listsymbolname{Abbreviations}
\usepackage{longtable}
\newcommand\listofsymbols[2]{
\btypeout{\listsymbolname}
\addtotoc{\listsymbolname}
    \chapter*{\listsymbolname
      \@mkboth{
          \MakeUppercase\listsymbolname}{\MakeUppercase\listsymbolname}}
\begin{longtable}[c]{#1}#2\end{longtable}\par
    \cleardoublepage
}
\newcommand\listconstants{Physical Constants}
\usepackage{longtable}
\newcommand\listofconstants[2]{
\btypeout{\listconstants}
\addtotoc{\listconstants}
    \chapter*{\listconstants
      \@mkboth{
          \MakeUppercase\listconstants}{\MakeUppercase\listconstants}}
\begin{longtable}[c]{#1}#2\end{longtable}\par
    \cleardoublepage
}
\newcommand\listnomenclature{Symbols}
\usepackage{longtable}
\newcommand\listofnomenclature[2]{
\btypeout{\listnomenclature}
\addtotoc{\listnomenclature}
    \chapter*{\listnomenclature
      \@mkboth{
          \MakeUppercase\listnomenclature}{\MakeUppercase\listnomenclature}}
\begin{longtable}[c]{#1}#2\end{longtable}\par
    \cleardoublepage
}
\newcommand\acknowledgments[1]{
\btypeout{Acknowledgments}
\addtotoc{Acknowledgments}
\thispagestyle{plain}
\begin{center}{\huge{\textit{Acknowledgments}} \par}\end{center}
{\normalsize #1}
\vfil\vfil\null

}
\newcommand\dedicatory[1]{
\btypeout{Dedicatory}
\thispagestyle{plain}
\null\vfil
\vskip 60\p@
\begin{center}{\Large \sl #1}\end{center}
\vfil\null
\cleardoublepage
}
\renewcommand\backmatter{
  \if@openright
    \cleardoublepage
  \else
    \clearpage
  \fi
  \addtotoc{\bibname}
  \btypeout{\bibname}
  \@mainmatterfalse}
\endinput

要运行,您可能需要 lstpatch.sty,可以从这里下载:http://www.atscire.de/download/lstpatch.sty

加分点:如何删除每个括号引用中左括号后的多余空格?

答案1

您正在使用的模板/类正在加载hyperref。但 hyperref 应该最后加载,除了一些例外。的文档biblatex明确指出,只有在 biblatex 之后加载 hyperref 时,反向引用才会起作用。
您必须删除与 hyperref 相关的所有内容,.cls并将其输入到您自己的序言中。

您永远不应该修改类或包文件,因为更新时所有更改都会丢失。在您的模板中,不仅鼓励修改,而且必须修改才能使一切正确。这不能算作质量标志。我会完全放弃这个模板。

关于参考文献中的空格:
在(重新)定义自己的命令时,你需要小心,因为 LaTeX 会将行结束作为一个空格。您可以使用注释字符 ( %) 覆盖它们。有关详细信息,请访问行末百分号(%)有什么用?
例如,(_此处覆盖/删除了开头括号后的第一个空格:

\AtEveryCitekey{%<- This % is needed
\ifciteseen{}{\defcounter{maxnames}{6}\clearfield{namehash}}}

你可以很容易地找到类似的东西,通过使用方法来准备一个最小工作示例

答案2

经过数月的斗争,尝试了各种建议的解决方案后,我终于找到了一种适合我的方法。我的论文类别使用“报告”(而不是“书籍”或“文章”),我的前言没有页码。前言有 8 页(这对于诊断很重要)。我的目录和图表列表有罗马页码,论文的其余部分有阿拉伯页码。就像 OP 一样,biblatex 反向引用 1-8 页会链接到相应的前言页面,而不是正确的页面。反向引用到第 9 页及以后的页面将正确链接。

我的解决方案依赖于重置页数计数器。我知道这是不被接受的,但让我举例说明,因为我重置的是罗马字体页面的页数计数器,而不是阿拉伯字体页面的页数计数器:

\singlespacing{\maketitle}             

%start counting pages in roman, but they won't show since dedication et c. are empty pagestyle
\cleardoublepage
\pagenumbering{roman} 

\include{dedication}        % include a dedication.tex file
\include{acknowledgements}   % include an acknowledgements.tex file
\include{abstract}          % include the abstract.tex file

\cleardoublepage
\setcounter{page}{1}  % resets the ROMAN page counter to 1 for the TOC

\tableofcontents       % generate and include a tbl of contents

\listoffigures              % generate and include a list of figures

\cleardoublepage
\pagenumbering{arabic} %change to arabic counting. Resets to 1 automatically

\doublespacing %works right through thesis

%now include the latex source files for each of the chapters

\include{chapter1-intro}
\include{nextchapter}
...

\cleardoublepage
...

\printbibliography[heading=bibintoc] % ensure the bib is linked in TOC
\end{document}

关键是要在标题页之后立即开始页码编号。献词、致谢、摘要等都是空页面样式,因此页码不显示。然后我在目录中重置页码,这是罗马页码第一次显示。然后我将页码样式设置为阿拉伯语,然后再包含实际内容。

作为参考,我的 biblatex 导入如下所示:

\usepackage[natbib=true,
    style=authoryear-comp,
    hyperref=true,
    backend=biber,
    maxbibnames=99,
    firstinits=true,
    uniquename=false,
    uniquelist=false,
    useprefix=true, %for `van', `von' et c.
    maxcitenames=1,
    parentracker=true,
    url=false,
    doi=false,
    isbn=false,
    eprint=false,
    backref=true,
    bibencoding=auto,
    sortcites=false,
    sorting=anyt, %sort the citations by increasing year (oldest first)
    ]{biblatex}

希望这可以帮助!

答案3

hyperref正如评论中某人所强调的那样,解决方案设置为hypertexnames必须将选项设置为 true。无论类是否预加载。例如,在 MastersDoctoralThesis 类中,预加载注释是

\AtEndPreamble{\RequirePackage{hyperref}
\hypersetup{pdfpagemode={UseOutlines},
bookmarksopen=true,
bookmarksopenlevel=0,
hypertexnames=true,
colorlinks=true,% Set to false to disable coloring links
citecolor=mycitecolor!\myshade!black,% The color of citations
linkcolor=mylinkcolor!\myshade!black,% The color of references to document elements (sections, figures, etc)
urlcolor=myurlcolor!\myshade!black,% The color of hyperlinks (URLs)
pdfstartview={FitV},
unicode,
breaklinks=true,
}

如您所见,我进行了更改hypertexnames=true,。这解决了错误反向引用的问题。

相关内容