\usepackage{color}To highlight text in the body of your document, use
\newcommand{\hilight}[1]{\colorbox{yellow}{#1}}
\hilight{this is some highlighted text}Voila!
Of course, you can change the color from yellow to any of the supported colors. For a list of those, check: http://en.wikibooks.org/wiki/LaTeX/Colors
UPDATE:
There is a problem with the previous method is that the color box does not wrap properly. Here's a much easier and robust way of doing this
\usepackage{soul}To highlight text in the body of your document, use
\hl{this is some highlighted text}
That doesn't quite work for me - the yellow box can't follow line wraps so the highlighted text goes off the edge of the page...
ReplyDeleteHi Charlie, I have updated the post with a more robust method.
ReplyDeleteHi, just wante to point out that sometimes normal use of the soul package causes \hl to create underlines. this can be fixed by
ReplyDelete\usepackage{color,soul}
Thanks for the post ! works for me
Deleteusing windows 8.1, and Ubuntu 13.10
try \hl{\emph{some text}} to see how badly it breaks.
ReplyDeleteIn this case, \hilight command works much better!
This whole information is absolutely interesting. i like this blog because is easily understandable, and that is invaluable to the readers. Beyond all doubt La Tex will be very useful for everybody who want to prove it.
ReplyDeletebuy viagra
whenever there is {} within the hilighted region {}, I got error messages using soul.
ReplyDeletethanks for this info I need it for my blog usagamezone.blogspot.com
ReplyDeleteis there a way to highlight a letters in html ? please post a tutorial about how to do that easily.
ReplyDeletePackage soul works fine for me. I'm able to highlight text within LaTeX easily without undesired behaviour.
ReplyDeleteHowever, is there an option to highlight text in one document using soul with different colours? For example line 1 with colour yellow, line 2 with colour magenta?
Thanks for responses.
Package soul also works fine for me. Trouble with color package.
ReplyDeleteAwesome thanks!
ReplyDeleteI do not understand what is \usepackage{color}
ReplyDelete\newcommand{\hilight}[1]{\colorbox{yellow}{#1}}????? please help me!! I think that it is a little bit confused!!
@yNot and @Silencer, your combined solution did it for me, thanks!
ReplyDeleteI got error messages if I use multibyte languages in the \hl{...}.
ReplyDeleteIf by chance you're using the beamer document class for presentations:
ReplyDelete\colorbox{yellow}{your text}
ichbinrene thanks dude, i was using "soul" but your post it's useful.
ReplyDeleteVery cool. Thank you!
ReplyDeleteIt works very well. Btw, how to change the color of highlight part?
ReplyDeleteuseful, thank you
ReplyDeleteTo fix the emph break, dont include the initial { after emph. Then end the \hl command at the end of the text to be italicized. The ending } will end the emph as well as the \hl command. Start the \hl command again after the italicized part.
ReplyDelete