[Tex/LaTex] How to highlight citations in a revised manuscript

highlighting

I am submitting a revised manuscript to a journal (Medical Physics), and the journal requires that changes that are made in the revised manuscript should be highlighted. I've been attempting to use the soul package with the \hl command, but it seems that there is a known bug where you can't highlight citations. (You get a compilation error.) I have found some workarounds, but they don't seem to work for multiple citations like this: \cite{rockafellar1997convex,rudin1992nonlinear}.
Also, the workarounds seem ugly, and I don't want to submit a latex file contaminated with ugly hacks for highlighting that the editors will not understand.

How do people handle this? It must be a common issue.

Should I just highlight the pdf using Adobe Acrobat and then submit a highlighted version of the pdf along with my latex file? I'm not sure that the journal will accept that — they may want to receive just one manuscript that has the highlighting built in, rather than a manuscript and a separate pdf with highlighting.

Here is a minimal working example:

\documentclass[aapm,graphicx,preprint,showkeys]{revtex4-1} 
\usepackage{amsmath,amssymb,enumitem,mathtools}
\usepackage{xcolor}
\usepackage{soul}

\begin{document}

\hl{This text is highlighted}.

Here's a citation \cite{rockafellar1997convex,rudin1992nonlinear}.

%\hl{ Highlighting a citation causes a compilation error \cite{rockafellar1997convex,rudin1992nonlinear}. }

\begin{thebibliography}{10}

\bibitem{rockafellar1997convex}
R.T. Rockafellar.
\newblock {\em Convex analysis}.
\newblock Number~28. Princeton university press, 1997.

\bibitem{rudin1992nonlinear}
L.~Rudin, S.~Osher, and E.~Fatemi.
\newblock Nonlinear total variation based noise removal algorithms.
\newblock {\em Physica D: Nonlinear Phenomena}, 60(1):259--268, 1992.

\end{thebibliography}

\end{document}

Best Answer

I don't know your other reasons for using the soul package, but doesn't the xcolor package suffice? Moreover, if I read the author's instructions correctly, you can also choose to use just a different text color.

Here are some possibilities for highlighting. Changing the background color usually entails some limitations, like boxes that don't wrap or restrictions on what can be put inside the highlighted area; but citations work with all approaches.

\documentclass[aapm,graphicx,preprint,showkeys]{revtex4-1} 
\usepackage{amsmath,amssymb,enumitem,mathtools}
\usepackage{xcolor}
\newcommand\hl[1]{\colorbox{yellow}{\textcolor{red}{#1}}}
\newcommand\hlbreakable[1]{\textcolor{red}{#1}}
\usepackage[most]{tcolorbox}
\newtcolorbox{highlighted}{colback=yellow,coltext=red,breakable}
\usepackage{lipsum}
\begin{document}

\hl{This text is highlighted.}

\hl{Highlighting a citation causes no compilation error \cite{rockafellar1997convex,rudin1992nonlinear}.}

\hlbreakable{Highlighting a citation causes no compilation error \cite{rockafellar1997convex,rudin1992nonlinear}.
\lipsum}

\begin{highlighted}
Highlighting a citation causes no compilation error \cite{rockafellar1997convex,rudin1992nonlinear}.
\lipsum
\end{highlighted}

\begin{thebibliography}{10}
\bibitem{rockafellar1997convex}
  R.T. Rockafellar.
  \newblock {\em Convex analysis}.
  \newblock Number~28. Princeton university press, 1997.
\bibitem{rudin1992nonlinear}
  L.~Rudin, S.~Osher, and E.~Fatemi.
  \newblock Nonlinear total variation based noise removal algorithms.
  \newblock {\em Physica D: Nonlinear Phenomena}, 60(1):259--268, 1992.
\end{thebibliography}
\end{document}

enter image description here enter image description here

enter image description here enter image description here

enter image description here

Edit: It may be more convenient to define the \hlbreakable command as an environment, since \begin-\end pairs are easier to trace than pairs of braces.

\newenvironment{hlbreakable}%
  {\color{red}}%
  {}
...
\begin{hlbreakable}
Highlighting a citation causes no compilation error \cite{rockafellar1997convex,rudin1992nonlinear}.
\lipsum
\end{hlbreakable}
Related Question