1

I am addressing reviewer comments for a scientific article. I would like to highlight significant changes to make it easier for reviewers to spot the changes. However, I find that when using the soul package and wrapping any display equations or citations in

\hl{ ... }

that it breaks compilation.

As an example, highlighting the paragraph in this document requires opening and closing multiple \hls:

\documentclass{article}

\usepackage{soul}
\usepackage[usenames,dvipsnames]{xcolor}

\begin{document}

\hl{This is a sentence with a citation}~\cite{lamport94}.
\hl{This is a sentence with another citation}~\cite{lamport94}.
\hl{Here is a display equation,}
\begin{equation}
  2 + 2 = 4
\end{equation}
\hl{where $4$ is the number that comes after $3$.}

\begin{thebibliography}{9}

\bibitem{lamport94}
  Leslie Lamport,
  \textit{\LaTeX: a document preparation system},
  Addison Wesley, Massachusetts,
  2nd edition,
  1994.

\end{thebibliography}

\end{document}

I would much prefer:

\documentclass{article}

\usepackage{soul}
\usepackage[usenames,dvipsnames]{xcolor}

\begin{document}

\hl{
This is a sentence with a citation~\cite{lamport94}.
This is a sentence with another citation~\cite{lamport94}.
Here is a display equation,
\begin{equation}
  2 + 2 = 4
\end{equation}
where $4$ is the number that comes after $3$.
}

\begin{thebibliography}{9}

\bibitem{lamport94}
  Leslie Lamport,
  \textit{\LaTeX: a document preparation system},
  Addison Wesley, Massachusetts,
  2nd edition,
  1994.

\end{thebibliography}

\end{document}

but this breaks compilation.

I have seen the answer How to highlight text that includes glossaries and citations?, but this seems fairly messy. I have a lot of citations and display equations (and equation references, section references, lists, etc.) and would prefer not to need to wrap everything in \mbox or extra braces. Is there a cleaner solution? Note: this is purely for the reviewers' reference so it does not need to look perfect.

0

There are many variants on this question. While on my first read through them I did not find a satisfactory answer, it turns out that the very end of the accepted answer to this question How to highlight citations in a revised manuscript did the trick. To be specific, the answer proposed defining a new environment

\newenvironment{hlbreakable}%
{\color{red}}%
{}

which, while not the prettiest, works quite well. The complete example:

\documentclass{article}

\usepackage{soul}
\usepackage[usenames,dvipsnames]{xcolor}

\newenvironment{hlbreakable}%
{\color{red}}%
{}

\begin{document}

\begin{hlbreakable}
This is a sentence with a citation~\cite{lamport94}.
This is a sentence with inline math, $2 + 2 = 4$.
Here is a display equation,
\begin{equation}
  2 + 2 = 4
\end{equation}
where $4$ is the number that comes after $3$.
\end{hlbreakable}

\begin{thebibliography}{9}

\bibitem{lamport94}
  Leslie Lamport,
  \textit{\LaTeX: a document preparation system},
  Addison Wesley, Massachusetts,
  2nd edition,
  1994.

\end{thebibliography}

\end{document}

compiles and gives the desired result.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.