How to highlight paragraph (linebreak preserving) as well as itemize, tabular etc.?
Concerning your question about \hl
support for \cite
: while \hl{text\cite{book}}
gives an error, it works if you additionally group the \cite
command by curly braces.
\documentclass{article}
\usepackage{soul}
\begin{document}
\hl{text{\cite{texbook}}}
\begin{thebibliography}{Knuth86]}
\bibitem[Knuth86]{texbook} D.E. Knuth, The TeXbook, 1986
\end{thebibliography}
\end{document}
gives
Related videos on Youtube
math
Updated on August 01, 2022Comments
-
math over 1 year
I want to highlight changes which are introduced by myself in the pdf document. So far the
soul
package is very neat but it does throw errors when I want to highlight not only paragraphs but also someitemize
environments, and I don't want to highlight the items separately. Also the\cite{...}
command is not supported by\hl
. I recently posted a slightly different question: Change text background within paragraph (with automatic linebreaks)BTW: What I liked most over other approaches like pdfcomments etc. is that the
\hl
command fromsoul
has a very exact and clear output, no icons, no clicking etc. involved. Together withtodonotes
it's very good and almost all I need.-
math over 12 yearsClumsy me: when this is a single paragraph I could clearly use \colorbox. Even with \cite commands inside. When its a phrase without \cite commands inside a paragraph I can use \hl from soul package. The only problem left is when I have a phrase with \cite commands, \hl will not work :(
-
-
Filipe Correia over 10 yearsI had instead to use
\hl{text\mbox{\cite{texbook}}}
for it to work for me, otherwise I got "Reconstruction failed" errors. -
math about 10 yearsIs there a way to automate this encapsulation into curly braces? I though of a custom macro
\newcommand{\mycite}[1]{{\cite{#1}}}
.. and then maybe\soulregister{\mycite}{1}
?