I have been highlighting certain parts of text in order to make it easier for me to search through a long document to find parts that need expanded on or some sort of work is left to do; however, I've been having issues with highlighting equations. I have a bit of a workaround (courtesy of this answer). Inserting this every time seems a bit cumbersome, so I am looking for something that will perform the intended operation below seamlessly.
MWE
\documentclass{article}
\usepackage{amsmath}
\usepackage{xcolor}
\usepackage{soul}
\newcommand{\hll}[1]{\colorbox{yellow}{$\displaystyle #1$}}
\begin{document}
{\color{red}\hl{Here is some text, and now we make the observation}
\[ \hll{\lim_{n\to\infty}\frac{1}{n}=0.} \]}
\end{document}
I have tried using \colorbox
, but only once because it didn't wrap the text in the way I expected (in fact, in that instance, no wrapping occurred whatsoever).
Update: Gonzalo Medina has provided a marvelous answer, though I'm not sure I was entirely clear above. The ideal answer to this question will have something that needs to be declared only once, just as the color of the font can be declared only once and pass through math mode, other environments such as lemmas, theorems, remarks, etc. without needing to be ended and declared again.
pdfcomment
package, which allows for annotations and hovering up tooltips.