![使用 biblatex 取消分组反向引用](https://linux22.com/image/413281/%E4%BD%BF%E7%94%A8%20biblatex%20%E5%8F%96%E6%B6%88%E5%88%86%E7%BB%84%E5%8F%8D%E5%90%91%E5%BC%95%E7%94%A8.png)
我正在用 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}