使用不同背景色在“参考”部分中突出显示引文

问题描述 投票:0回答:1

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

\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}

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

enter image description here

[我的引文以单独的格式存储在]

@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"
}
latex pdflatex biblatex
1个回答
1
投票

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

\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}

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.