在稿件的修订版本中,我们通常用彩色文本标记新的更改。这个问题涉及对文件中的特定参考文献进行标记的不同方法.bib
。之前有关于此问题的解决方案,但它们并不令我满意。这个仅做一次参考即可。这里是前一种方法的扩展,通过使用多个嵌套的 来提供多个引用ifstreqal
。但是,当彩色引用的数量增加时,这种方法就变得毫无用处了。
我想到的是拥有一个代码,它可以获取所有彩色参考的标签,而无需用户参与制作嵌套结构。
我们也欢迎其他新的解决方案。
这里有一个 MWE 作为开始。
\documentclass{article}
\usepackage{filecontents}
\usepackage{color}
\usepackage{etoolbox}
\begin{filecontents}{jobname.bib}
@article{greenwade93,
author = "George D. Greenwade",
title = "The {C}omprehensive {T}ex {A}rchive {N}etwork ({CTAN})",
year = "1993",
journal = "TUGBoat",
volume = "14",
number = "3",
pages = "342--351"
}
@book{goossens93,
author = "Michel Goossens and Frank Mittelbach and Alexander Samarin",
title = "The LaTeX Companion",
year = "1993",
publisher = "Addison-Wesley",
address = "Reading, Massachusetts"
}
@article{fuente,
author = "D. de la Fuente and J.G. Castaño and M. Morcillo",
title = "Long-term atmospheric corrosion of zinc",
journal = "Corrosion Science",
volume = "49",
year = "2007",
pages = "1420–1436",
}
@article{nature,
author = "Rosa Rademakers and Manuela Neumann and Ian R. Mackenzie",
title = "Advances in understanding the molecular basis of frontotemporal dementia - elongated title",
journal = "Nature Reviews Neurology",
volume = "8",
year = "2012",
pages = "423-434",
doi = "10.1038/nrneurol.2012.117",
}
}
\end{filecontents}
\let\mybibitem\bibitem
\renewcommand{\bibitem}[1]{%
\ifstrequal{#1}{greenwade93}
{\color{blue}\mybibitem{#1}}
{\color{black}\mybibitem{#1}}%
}
\begin{document}
This is my document \cite{fuente} and we have another \cite{nature}. We can speak also about \LaTeX! So two more reference are \cite{greenwade93} and \cite{goossens93}
\bibliographystyle{ieeetr}
\bibliography{jobname}
\end{document}
答案1
使用 biblatex/biber 可以很容易地标记参考文献:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{xcolor}
\usepackage[style=ieee]{biblatex}
\addbibresource{biblatex-examples.bib}
\DeclareBibliographyCategory{changed}
\addtocategory{changed}{doody,angenendt}
\AtEveryBibitem{\ifcategory{changed}{\color{red}}{}}
\DeclareFieldFormat{labelnumberwidth}{\ifcategory{changed}{\textcolor{green}{\mkbibbrackets{#1}}}{\mkbibbrackets{#1}}}
\begin{document}
\cite{doody,herrmann,angenendt}
\printbibliography
\end{document}