Латексное выделение цитат в разделе «Справочная информация» с использованием разных цветов фона.

Я использую три разных цвета фона, чтобы выделить правки, которые я делаю, против трех разных типов комментариев, полученных для моей статьи, отправленной в журнал. Мне удалось выделить текст, цитаты и ссылки в основной части статьи. Однако выделить цитаты в справочном разделе мне не удалось. Я хотел бы выделить их тем же цветом фона, что и в тексте.

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

Мой текущий результат: выделяет цитаты желтым цветом по умолчанию, что также создает два пробела.

введите описание изображения здесь

Мои цитаты хранятся в отдельном файле bib как

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

person Mainland    schedule 16.04.2020    source источник
comment
Я предлагаю вам переместить свой вопрос на tex.stackexchange.com. Более того, уверены ли вы, что весь этот цветной текст будет принят журналом даже после повторной отправки?   -  person Eddymage    schedule 16.04.2020
comment
@Eddymage Да! это необходимо для подтверждения того, что комментарии рецензента были учтены в статье. Я видел, как люди делали это, используя слово MS.   -  person Mainland    schedule 16.04.2020


Ответы (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}

введите описание изображения здесь

person samcarter_is_at_topanswers.xyz    schedule 16.04.2020
comment
Это сработало отлично. Еще одна вещь, которую я только что обнаружил: я поместил это \citecolor[3]{r1}{cite1} \citecolor[2]{r2}{cite2} \citecolor[3]{r3}{cite3} в бегущий текст сразу после места его цитирования, а не в преамбуле. Да! это действительно сработало. Так что мне не нужно возвращаться к преамбуле каждый раз, когда я цитирую новую. - person Mainland; 16.04.2020