论文到了修改阶段,不可避免就要标记对应的修改部分,之前修改设计的都是正文部分的内容,修改颜色的代码相对简单,
如下所示:
\textcolor{blue}{正文修改后需要标记的句子}
这样的代码无法跨行标记,想要实现跨行标记的话逐段标记
\textcolor{blue}{第一段}
\textcolor{blue}{第二段}
那么这次涉及到参考文献部分需要标记成蓝色
方法代码放这里啦:
(一)text文件部分
\usepackage{xcolor}
\usepackage{xpatch}
\makeatletter
\def\changeBibColor#1{%
\in@{#1}{SUN2021107894,SZOPLIK2023126001}% list of colored bib items
\ifin@\color{blue}\else\normalcolor\fi
}
\xpatchcmd\@bibitem
{\item}
{\changeBibColor{#1}\item}
{}{\fail}
\xpatchcmd\@lbibitem
{\item}
{\changeBibColor{#2}\item}
{}{\fail}
\makeatother
\begin{document}
VVV
\bibliography{mybib}
\end{document}
代码里面的SUN2021107894,SZOPLIK2023126001就是我这里对应标记蓝色的文章,从bib文件里面对应Id
(二)bib文件部分
\begin{filecontents}{mybib.bib} %%%加在bib文件开头
@article{SUN2021107894,
title = {Multi-step wind speed forecasting based on secondary decomposition algorithm and optimized back propagation neural network},
journal = {Applied Soft Computing},
volume = {113},
pages = {107894},
year = {2021},
author = {Wei Sun and Bin Tan and Qiqi Wang},
}
@article{SZOPLIK2023126001,
title = {Using an artificial neural network model for natural gas compositions forecasting},
journal = {Energy},
volume = {263},
pages = {126001},
year = {2023},
author = {Jolanta Szoplik and Paulina Muchel},
}
\end{filecontents} %%%加在bib文件结尾
完成之后编译即可,其他的latex详细代码可见我之前的文章
文章参考: