参考书目文本中的彩色文本

参考书目文本中的彩色文本

我正在尝试将一些参考书目中的文本设为蓝色。我尝试了以下代码。但是没有用。请帮帮我。

//myReference.bib file

@article{nature,
author = {\color{blue}Rosa Rademakers and Manuela Neumann and Ian R. Mackenzie}},
title = {\color{blue}Advances in understanding the molecular basis of frontotemporal dementia - elongated title}},
journal = {\color{blue} {Nature Reviews Neurology}},
volume = {\color{blue}{8}},
year = {\color{blue}{2012}},
pages = {\color{blue}{423-434}},
doi = {\color{blue}{10.1038/nrneurol.2012.117}},
}

@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},
}



\documentclass{article}
\begin{document}
This is my document \cite{nature} and we have another \cite{fuente}
\bibliography{myReference}
\end{document}

答案1

看起来,整个条目应该被涂成蓝色。因此,下面的示例重新定义\bibitem为查找nature。如果找到,则将条目设置为蓝色。这样,bibtex 就不会被参考书目条目中的颜色标记所混淆。

\RequirePackage{filecontents}
\begin{filecontents*}{myReference.bib}
@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},
}
@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{xy,
  author = {Xaver Zorro},
  title = {Vampires},
}
\end{filecontents*}

\documentclass{article}
\usepackage{color}

\makeatletter
\let\myorg@bibitem\bibitem
\def\bibitem#1#2\par{%
  \@ifundefined{bibitem@#1}{%
    \myorg@bibitem{#1}#2\par
  }{%
    \begingroup
      \color{\csname bibitem@#1\endcsname}%
      \myorg@bibitem{#1}#2\par
    \endgroup
  }%
}
\newcommand*{\bibitem@nature}{blue}
\makeatother

\begin{document}
This is my document \cite{nature} and we have another \cite{fuente}
and \cite{xy}.
\bibliographystyle{plain}
\bibliography{myReference}
\end{document}

结果

相关内容