Latex-Highlighting Text

In order to highlight text in latex, we need to use two packages. The highlighted text will be in a yellow background. I will post a detailed tutorial on how to change colors for highlighting later.

First we need the soul package. Import it using \usepackage{soul} in your latex preamble. The second package we need is the color package. Import that also using \usepackage{color} in your latex preamble.

The command to use to highlight some text is \hl{some text that needs to be highlighted}

Here is my example



(The code snippet is available at https://gist.github.com/3189864 )

It produces the following highlight in the output pdf file.



If you don't import the color package as I did here



(This code snippet is also available at https://gist.github.com/3189874 )

You will receive the following file, when you compile it



What you receive is just a simple underline if you don't import the color package.

I read similar tutorials at http://cxwangyi.wordpress.com/2010/02/15/highlights-in-latex/, http://pleasemakeanote.blogspot.com/2009/08/how-to-highlight-text-in-latex.html and it gave me inspiration to write this one.