这是关于如何为参考书目中的特定条目着色。
除了参考书目(使用上述解决方案)之外,我还想为文本中的相应参考文献着色(也在多参考文献中\cite{ref1,ref2,ref3}
) - 我该如何实现?
首先十分感谢!
答案1
以下内容适用于引文和参考书目。它不会为引文中的括号着色,因为这可能会导致多重引用的问题。
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[backend=biber,
isbn=true,
giveninits=true,
style=numeric,
maxnames=99,
sorting=ydnt,
defernumbers=true,
autocite=superscript]{biblatex}
\addbibresource{biblatex-examples.bib}
\renewbibmacro{in:}{}
\usepackage[usenames,dvipsnames]{xcolor}
\DeclareBibliographyCategory{important}
\addtocategory{important}{knuth:ct:a}
\addtocategory{important}{knuth:ct:c}
\DeclareFieldFormat{labelprefix}{%
\ifcategory{important}
{\textcolor{orange}{#1}}
{#1}}
\DeclareFieldFormat{labelnumber}{%
\ifcategory{important}
{\textcolor{orange}{#1}}
{#1}}
\DeclareFieldFormat{labelnumberwidth}{%
\ifcategory{important}
{\textcolor{orange}{\mkbibbrackets{#1}}}
{\mkbibbrackets{#1}}}
\AtEveryBibitem{%
\ifcategory{important}
{\color{orange}}
{}}
\begin{document}
\cite{knuth:ct}
\cite{knuth:ct:a}
\cite{knuth:ct:b}
\cite{knuth:ct:c}
\cite{companion}
\cite{knuth:ct,knuth:ct:a,knuth:ct:b,knuth:ct:c,companion}
\printbibliography
\end{document}