使用 biblatex 取消分组反向引用

使用 biblatex 取消分组反向引用

我正在用 Overleaf 撰写报告并biblatex进行引文管理。

我已经启用backref,但希望将 backref 中的页码取消分组,如下所示(理想情况下不会破坏文本中引用的分组):

所需引用格式

MWE 如下所示:

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

\usepackage[
backend=biber,
style=nature, backref]{biblatex}

\usepackage{hyperref}

\hypersetup{
  colorlinks=true,
  citecolor={blue},
  citebordercolor={blue},
}

%This part is to colorize the brackets%
\DeclareCiteCommand{\cite}[\color{blue}\mkbibbrackets]
  {\usebibmacro{cite:init}%
   \usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \usebibmacro{cite:comp}}
  {}
  {\usebibmacro{cite:dump}%
   \usebibmacro{postnote}}

\newrobustcmd{\mkbibcoloursuperscript}[2]{%
  \unspace\allowhyphens\textsuperscript{%
    \begingroup
    \protected\long\def\mkbibsuperscript##1{%
      \blx@warning{Nested superscript}%
      \mkbibbrackets{##1}}%
    \color{#1}%
    #2\endgroup}}

%This part is to put brackets around the supercitation%   
\DeclareCiteCommand{\supercite}[\mkbibcoloursuperscript{blue}]
  {\usebibmacro{cite:init}%
   \let\multicitedelim=\supercitedelim
   \iffieldundef{prenote}
     {}
     {\BibliographyWarning{Ignoring prenote argument}}%
   \iffieldundef{postnote}
     {}
     {\BibliographyWarning{Ignoring postnote argument}}%
  \bibopenbracket}%
  {\usebibmacro{citeindex}%
   \usebibmacro{cite:comp}}
  {}
  {\usebibmacro{cite:dump}\bibclosebracket}

\addbibresource{biblatex-examples.bib}


\begin{document}

Test.\cite{sigfridsson}

\clearpage

Test.\cite{sigfridsson}

\clearpage

Test.\cite{sigfridsson}

\clearpage

Test.\cite{sigfridsson}

\clearpage

Test.\cite{sigfridsson}

\printbibliography[
heading=bibintoc,
title={Bibliography}
]
\end{document}

答案1

反向引用的格式由backrefstyle选项控制。如果将其设置为backrefstyle=none,biblatex则不会尝试压缩页面范围。

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

\usepackage[backend=biber,
  style=nature,
  backref=true, backrefstyle=none,
]{biblatex}

\usepackage{hyperref}

\hypersetup{
  colorlinks=true,
  citecolor={blue},
  citebordercolor={blue},
}

%This part is to colorize the brackets
\DeclareCiteCommand{\cite}[\color{blue}\mkbibbrackets]
  {\usebibmacro{cite:init}%
   \usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \usebibmacro{cite:comp}}
  {}
  {\usebibmacro{cite:dump}%
   \usebibmacro{postnote}}

\newrobustcmd{\mkbibcoloursuperscript}[2]{%
  \unspace\allowhyphens\textsuperscript{%
    \begingroup
    \protected\long\def\mkbibsuperscript##1{%
      \blx@warning{Nested superscript}%
      \mkbibbrackets{##1}}%
    \color{#1}%
    #2\endgroup}}

%This part is to put brackets around the supercitation 
\DeclareCiteCommand{\supercite}[\mkbibcoloursuperscript{blue}]
  {\usebibmacro{cite:init}%
   \let\multicitedelim=\supercitedelim
   \iffieldundef{prenote}
     {}
     {\BibliographyWarning{Ignoring prenote argument}}%
   \iffieldundef{postnote}
     {}
     {\BibliographyWarning{Ignoring postnote argument}}%
  \bibopenbracket}%
  {\usebibmacro{citeindex}%
   \usebibmacro{cite:comp}}
  {}
  {\usebibmacro{cite:dump}\bibclosebracket}

\addbibresource{biblatex-examples.bib}


\begin{document}

Test.\cite{sigfridsson}

\clearpage

Test.\cite{sigfridsson}

\clearpage

Test.\cite{sigfridsson}

\clearpage

Test.\cite{sigfridsson}

\clearpage

Test.\cite{sigfridsson}

\printbibliography[
heading=bibintoc,
title={Bibliography}
]
\end{document}

(引自第 1、2、3、4、5 页)。

相关内容