Highlight text in LaTeX

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

How to highlight text in LaTeX
How to highlight text in LaTeX

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 readers’ attention. How do you do this in LaTeX?.

Indeed, there exists several ways be able to you to do your need. But in this case I show you the simplest steps. It’s still pretty easy, but you’ll need to download a package named soul.

In the following paragraphs, I shall show you the steps to activate and use the functionality. Add the following to your preamble:

\usepackage{soul}

To highlight text in the body of your document, use:

\hl{this is some highlighted text}

If you want to change the highlight color, use the following command:

\sethlcolor{lightblue}

Otherwise, you can search and think of the interesting and cool way on Stack Exchange.

I hope this post helps you a lot. Please sharing it!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.