乳胶使用不同的背景颜色突出显示“参考"部分中的引文 [英] Latex highlighting the citations in the Reference section using different background colors

查看:69
本文介绍了乳胶使用不同的背景颜色突出显示“参考"部分中的引文的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用三种不同的背景色来突出显示我针对针对期刊提交的文章收到的三种不同类型评论所做的编辑.我成功地突出了本文的正文,引文和参考文献.但是,我没有成功在参考"部分突出显示引文.我想使用与文字相同的背景色来突出显示它们.

I am using three different background colors to highlight edits I am doing against three different types of comments received for my submitted article to a journal. I am successful in highlighting the text and citations and references in main body of the paper. However, I was not successful in highlighting the citations in the Reference section. I would like to highlight them using same background color as in the text.

\documentclass[journal]{IEEEtran}
\ifCLASSINFOpdf
\else
\fi
%\usepackage[left=0.5in, right=0.5in,top=0.1in,bottom=0.1in]{geometry}
\usepackage{graphicx}
\usepackage{float}
\usepackage[skip=2pt,font=scriptsize]{caption} %\usepackage{caption}
\usepackage{subcaption}
\usepackage{array}
\usepackage{mdwmath}
\usepackage{mdwtab}
\usepackage{multirow}
\usepackage{amsmath}
\usepackage{siunitx}
%\usepackage{xcolor, soul}
%\sethlcolor{lightgray}
\usepackage{cancel}
\usepackage{amssymb}% http://ctan.org/pkg/amssymb
\usepackage{pifont}% http://ctan.org/pkg/pifont
%\usetikzlibrary{calc,matrix}
\usepackage{color,soul}
\usepackage{cite}
\newtheorem{theorem}{Theorem}{}
\newtheorem{corollary}{Corollary}{}
\newtheorem{remark}{Remark}{}
\hyphenation{op-tical net-works semi-conduc-tor}
%% different color for different reviewer  \textcolor{r1}{text}
\usepackage[dvipsnames]{xcolor}
\usepackage{soul}
\colorlet{r1}{ForestGreen!20}
\colorlet{r2}{Red!20}
\colorlet{r3}{RoyalPurple!20}
%\definecolor{r1}{r1!50}%{rgb}{0.8, 0.5, 0.2}
%\definecolor{r2}{rgb}{0.61, 0.87, 1}
%\definecolor{r3}{rgb}{1, 0.87, 0.8}
\newcommand{\Hl}[2][\empty]{%
    \ifx#1\empty
    \else
    \sethlcolor{#1}%
    \fi
    \hl{#2}}
%% Highlighting the citations and references as well using different background color
\soulregister\Hl{7}
\soulregister\cite7
\soulregister\ref7
\soulregister\pageref7
%% Highlighting citations in the Reference section using different background color
\usepackage{etoolbox}
\makeatletter 
\pretocmd\@bibitem{\csname keycolor#1\endcsname}{}{\fail}
\newcommand\citecolor[1]{\@namedef{keycolor#1}{\hspace*{-\labelwidth}\hspace*{-\labelsep}{\color{yellow}\rule[-0.3em]{\linewidth}{1\baselineskip}}\vspace*{\itemsep}\vspace*{-\baselineskip}}}
\makeatother
\citecolor{miguel14anestimator}
\begin{document}
I want to highlight \Hl[r1]{\cite{cite1}}, \Hl[r2]{\cite{cite2}} ,\Hl[r3]{\cite{cite3}} in Reference section using appropriate colors. 
\bibliography{BIBfile}{}
\bibliographystyle{IEEEtran}

\end{document}

我现在的输出:通过产生两个空白来突出显示默认黄色的引文.

My present output: Highlights the citations in default yellow color that too by producing two white spaces.

我的引文以

@ARTICLE{cite1,
    author={M. {Carrasco} and F. {Mancilla-David} and R. {Ortega}},
    journal={IEEE Trans. Ind. Electron.},
    title={An Estimator of Solar Irradiance in Photovoltaic Arrays With Guaranteed Stability Properties},
    year={2014},
    volume={61},
    number={7},
    pages={3359-3366},}


@ONLINE{cite2,
    author={Licor},
    title={Pyranometer products specifications},
    year={2020},
    month={Apr.},
    url={https://www.licor.com/documents/3bjwy50xsb49jqof0wz4}
}

@article{cite3,
    title = "An assessment of series resistance estimation techniques for different silicon based SPV modules",
    journal = "Renewable and Sustainable Energy Reviews",
    volume = "98",
    pages = "199 - 216",
    year = "2018",
    author = "Rashmi Singh and Madhu Sharma and Rahul Rawat and Chandan Banerjee"
}

推荐答案

我在 \ citecolor 中添加了一个可选参数,可让您指定每个bibitem有多少行

I added an optional argument to \citecolor that allows you to specify how many lines each bibitem has

\documentclass[journal]{IEEEtran}
\ifCLASSINFOpdf
\else
\fi
%\usepackage[left=0.5in, right=0.5in,top=0.1in,bottom=0.1in]{geometry}
\usepackage{graphicx}
\usepackage{float}
\usepackage[skip=2pt,font=scriptsize]{caption} %\usepackage{caption}
\usepackage{subcaption}
\usepackage{array}
\usepackage{mdwmath}
\usepackage{mdwtab}
\usepackage{multirow}
\usepackage{amsmath}
\usepackage{siunitx}
%\usepackage{xcolor, soul}
%\sethlcolor{lightgray}
\usepackage{cancel}
\usepackage{amssymb}% http://ctan.org/pkg/amssymb
\usepackage{pifont}% http://ctan.org/pkg/pifont
%\usetikzlibrary{calc,matrix}
\usepackage{color,soul}
\usepackage{cite}
\newtheorem{theorem}{Theorem}{}
\newtheorem{corollary}{Corollary}{}
\newtheorem{remark}{Remark}{}
\hyphenation{op-tical net-works semi-conduc-tor}
%% different color for different reviewer  \textcolor{r1}{text}
\usepackage[dvipsnames]{xcolor}
\usepackage{soul}
\colorlet{r1}{ForestGreen!20}
\colorlet{r2}{Red!20}
\colorlet{r3}{RoyalPurple!20}
%\definecolor{r1}{r1!50}%{rgb}{0.8, 0.5, 0.2}
%\definecolor{r2}{rgb}{0.61, 0.87, 1}
%\definecolor{r3}{rgb}{1, 0.87, 0.8}
\newcommand{\Hl}[2][\empty]{%
    \ifx#1\empty
    \else
    \sethlcolor{#1}%
    \fi
    \hl{#2}}
%% Highlighting the citations and references as well using different background color
\soulregister\Hl{7}
\soulregister\cite7
\soulregister\ref7
\soulregister\pageref7
%% Highlighting citations in the Reference section using different background color
\usepackage{etoolbox}
\makeatletter 
\pretocmd\@bibitem{\csname keycolor#1\endcsname}{}{\fail}
\newcommand\citecolor[3][1]{\@namedef{keycolor#3}{\hspace*{-\labelwidth}\hspace*{-\labelsep}{\color{#2}\rule[-0.3em]{\dimexpr\linewidth+\labelwidth+\labelsep\relax}{#1\baselineskip}}\vspace*{\itemsep}\vspace*{-#1\baselineskip}}}
\makeatother

\citecolor[3]{r1}{cite1}
\citecolor[2]{r2}{cite2}
\citecolor[3]{r3}{cite3}

\begin{filecontents*}[overwrite]{\jobname.bib}

@article{einstein,
    author = {Einstein, A.},
    title = {Die Grundlage der allgemeinen Relativitätstheorie},
    journal = {Annalen der Physik},
    volume = {354},
    number = {7},
    doi = {10.1002/andp.19163540702},
    pages = {769--822},
    year = {1916}
}


@ARTICLE{cite1,
    author={M. {Carrasco} and F. {Mancilla-David} and R. {Ortega}},
    journal={IEEE Trans. Ind. Electron.},
    title={An Estimator of Solar Irradiance in Photovoltaic Arrays With Guaranteed Stability Properties},
    year={2014},
    volume={61},
    number={7},
    pages={3359-3366},}


@ONLINE{cite2,
    author={Licor},
    title={Pyranometer products specifications},
    year={2020},
    month={Apr.},
    url={https://www.licor.com/documents/3bjwy50xsb49jqof0wz4}
}

@article{cite3,
    title = "An assessment of series resistance estimation techniques for different silicon based SPV modules",
    journal = "Renewable and Sustainable Energy Reviews",
    volume = "98",
    pages = "199 - 216",
    year = "2018",
    author = "Rashmi Singh and Madhu Sharma and Rahul Rawat and Chandan Banerjee"
}
\end{filecontents*}

\begin{document}

normal cite: \cite{einstein}

I want to highlight \Hl[r1]{\cite{cite1}}, \Hl[r2]{\cite{cite2}} ,\Hl[r3]{\cite{cite3}} in Reference section using appropriate colors. 
\bibliography{\jobname}
\bibliographystyle{IEEEtran}

\end{document}

这篇关于乳胶使用不同的背景颜色突出显示“参考"部分中的引文的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆