# How can I highlight blocks of text which include citations and display equations?

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,}
$$2 + 2 = 4$$
\hl{where $4$ is the number that comes after $3$.}

\begin{thebibliography}{9}

\bibitem{lamport94}
Leslie Lamport,
\textit{\LaTeX: a document preparation system},
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,
$$2 + 2 = 4$$
where $4$ is the number that comes after $3$.
}

\begin{thebibliography}{9}

\bibitem{lamport94}
Leslie Lamport,
\textit{\LaTeX: a document preparation system},
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.

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,
$$2 + 2 = 4$$
where $4$ is the number that comes after $3$.
\end{hlbreakable}

\begin{thebibliography}{9}

\bibitem{lamport94}
Leslie Lamport,
\textit{\LaTeX: a document preparation system},