LaTeX soul - How to highlight text in a LaTeX document

Summary: Use the LaTeX soul package to highlight text in a LaTeX document.

Suppose you want to provide a highlight color or background color for text in a LaTeX document. A good example is when you want to highlight the background yellow, so it looks like it was highlighted with a marker, to catch a reader's attention. "How do you do this in LaTeX?" you ask.

Normally I like to answer "simple", but in this case there is a multi-step answer. It's still pretty easy, but you'll need to download a package named "soul".

Here are the basic steps to follow to enable text highlighting:

  • Download the LaTeX package named "soul". You can find it by searching at tug.org
  • Install that package
  • Include a statement like this in the preamble of your document so you can use the package:
    \usepackage{soul}
  • Mark your text with a \hl command wherever you want it highlighted, like this:
    this is some \hl{highlighted text} blah blah

That's it. Use the soul package, and mark your text with the \hl command. (Note that the letters in this command are the lowercase versions of the letters 'H' and 'L', respectively.)

I've read where this command has problems occassionally, but I have not experienced those. Read the PDF that comes with the soul package for more information and other uses.