7

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 some itemize 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 from soul has a very exact and clear output, no icons, no clicking etc. involved. Together with todonotes it's very good and almost all I need.

1
  • Clumsy 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 :(
    – math
    Jun 9, 2011 at 8:42

1 Answer 1

7

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

highlighted \cite

2
  • 5
    I had instead to use \hl{text\mbox{\cite{texbook}}} for it to work for me, otherwise I got "Reconstruction failed" errors. May 17, 2013 at 19:53
  • Is 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}?
    – math
    Aug 16, 2013 at 11:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .