Pages

Friday, August 28, 2009

How to add space after \hline in LaTeX tables

Try the following:
\hline \\[-1.0em]
Voila!

Of course, you can change the numbers and units inside the brackets.

Thursday, August 27, 2009

How to highlight text in LaTeX

Add the following to your preamble:
\usepackage{color}
\newcommand{\hilight}[1]{\colorbox{yellow}{#1}}
To highlight text in the body of your document, use
\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}