BibLaTeX - 参考书目中的反向引用链接编号

BibLaTeX - 参考书目中的反向引用链接编号

ASTM 手册对其参考文献进行了排版,以便参考书目中的反向引用就是参考书目中的标签编号。

参考文献用括号内的红色粗体数字编号,单击后可转到论文内文引用的位置。

我知道如何使反向引用显示在引用的末尾。

有人知道如何将我的书目标签(深蓝色粗体数字)转换为反向引用吗?也就是说,我不希望将页码列为反向引用链接。我希望书目标签编号作为论文中使用参考的位置的链接。这就是 ASTM(美国材料与试验协会)手册的做法。

这是我的 MWE:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{mathptmx}
\usepackage{xcolor}

\usepackage[hyperref=true,url=false,isbn=false,backref=true,style=science,maxcitenames=3,maxbibnames=100,block=none,backend=biber,natbib=true,sorting=none]{biblatex}
\DefineBibliographyStrings{english}{%
backrefpage  = {see p.}, % for single page number
backrefpages = {see pp.} % for multiple page numbers
}

% code to make supercitations in brackets
\DeclareCiteCommand{\supercite}[\mkbibsuperscript]
{\usebibmacro{cite:init}%
\let\multicitedelim=\supercitedelim
\iffieldundef{prenote}
 {}
 {\BibliographyWarning{Ignoring prenote argument}}%
 \iffieldundef{postnote}
 {}
 {\BibliographyWarning{Ignoring postnote argument}}%
 [}%
 {\usebibmacro{citeindex}%
 \usebibmacro{cite:comp}}
 {}
 {\usebibmacro{cite:dump}]}

\renewcommand{\finentrypunct}{}%remove period at end of citation in bibliography
\DeclareFieldFormat{labelnumber}{\mkbibbold{#1}}%make in-text citation number bold
\AtBeginBibliography{
\DeclareFieldFormat{labelnumber}{\color{blue!75!black}\mkbibbold{#1}}}% make bibliography label number bold and dark blue
%% The label number I want to be the backreference link instead of what I have now.

\DeclareFieldFormat{pagerefformat}{\color{blue!75!black}\{\mkbibbold{#1}\}}% I made braces around the backreference text: ''see p. 1'', bold, and dark blue 

\renewbibmacro*{pageref}{%
  \iflistundef{pageref}
    {}
    {\printtext[pagerefformat]{%
       \ifnumgreater{\value{pageref}}{1}
         {\bibstring{backrefpages}\ppspace}
         {\bibstring{backrefpage}\ppspace}%
       \printlist[pageref][-\value{listtotal}]{pageref}}}}% this makes the backreference text ''see p. 1'' with the pagerefformat bold, dark blue


\usepackage{filecontents}
\begin{filecontents}{test.bib}
@book{A01,
  author = {Author, A.},
  year = {2001},
  title = {Alpha},
 }
@book{B02,
  author = {Buthor, B.},
  year = {2002},
  title = {Bravo},
}
@article{C03,
  author = {Cuthor, C.},
  year = {2003},
  title = {Charlie},
}
\end{filecontents}

\addbibresource{test.bib}

\usepackage[hidelinks,hyperfootnotes=false,plainpages=false]{hyperref} %
\hypersetup{
    citecolor={blue!75!black},% in-text citations dark blue
    linkcolor={blue!75!black},%the backreference is dark blue also
    colorlinks=true
 }

\begin{document}
We are citing \supercite{A01,C03} and \supercite{A01,C03,B02} and \cite{C03}

\printbibliography

\end{document}

答案1

该链接指向出现特定引用的第一个页面,但并不链接到该引用的确切位置。

biblatex已经创建了引用参考文献的页面列表,我们只需要一种方法来从该列表中提取第一页,以便我们可以将结果传递给\hyperlink。 特别\printlist[pageref][1-1]{pageref}是不能在这里使用,因为它很健壮。

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{mathptmx}
\usepackage{xcolor}

\usepackage[hyperref=true,url=false,isbn=false,backref=true,style=science,maxcitenames=3,maxbibnames=100,block=none,backend=biber,natbib=true,sorting=none]{biblatex}
\DefineBibliographyStrings{english}{%
  backrefpage  = {see p\adddot},
  backrefpages = {see pp\adddot},
}

\DeclareCiteCommand{\supercite}[\mkbibsuperscript]
  {[%
   \usebibmacro{cite:init}%
   \let\multicitedelim=\supercitedelim
   \iffieldundef{prenote}
     {}
     {\BibliographyWarning{Ignoring prenote argument}}%
   \iffieldundef{postnote}
     {}
     {\BibliographyWarning{Ignoring postnote argument}}%
   }%
  {\usebibmacro{citeindex}%
   \usebibmacro{cite:comp}}
  {}
  {\usebibmacro{cite:dump}%
   ]}

\renewcommand{\finentrypunct}{}
\DeclareFieldFormat{labelnumber}{\mkbibbold{#1}}

\renewbibmacro*{pageref}{%
  \iflistundef{pageref}
    {}
    {\printtext[pagerefformat]{%
       \ifnumgreater{\value{pageref}}{1}
         {\bibstring{backrefpages}\ppspace}
         {\bibstring{backrefpage}\ppspace}%
       \printlist[pageref][-\value{listtotal}]{pageref}}}}

\makeatletter
\def\blxjk@grabfirslisttitem#1#2\@nil{#1}

\DeclareFieldFormat{labelnumberwidth}{%
  \iflistundef{pageref}
    {\mkbibbold{#1\adddot}}
    {\edef\blxjk@firstpage{\expandafter\blxjk@grabfirslisttitem\abx@list@pageref{}\@nil}%
     \ifhyperref
       {\hyperlink{page.\blxjk@firstpage}{\mkbibbold{#1\adddot}}}
       {\mkbibbold{#1\adddot}}}}
\makeatletter


\addbibresource{biblatex-examples.bib}

\usepackage[hidelinks,hyperfootnotes=false,plainpages=false]{hyperref} %
\hypersetup{
    citecolor={blue!75!black},% in-text citations dark blue
    linkcolor={blue!75!black},%the backreference is dark blue also
    colorlinks=true
 }

\begin{document}
We are citing \supercite{sigfridsson} and \supercite{sigfridsson,worman} and \cite{sigfridsson}

\printbibliography

\clearpage
We are citing \supercite{nussbaum,sigfridsson} and \supercite{nussbaum,sigfridsson} and \cite{sigfridsson}
\clearpage
We are citing \supercite{sigfridsson} and \supercite{sigfridsson,worman} and \cite{sigfridsson}
\end{document}

在此处输入图片描述

相关内容