The xcolor provides support for coloring table rows in a variety of patterns. The colortbl can color rows, columns, cells and rules.
There is a nice article by Lapo Filippo Mori in the PracTeX Journal that describes the usage of both packages. Scroll down to section 4.
Generally I agree with lockstep that circling might not be the best way to highlight text. In addition to his suggestions, you could also try using a light gray background.
Having said that, here is a way to circle text using TikZ:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{fit,shapes.geometric}
\newcounter{nodemarkers}
\newcommand\circletext[1]{%
\tikz[overlay,remember picture]
\node (marker-\arabic{nodemarkers}-a) at (0,1.5ex) {};%
#1%
\tikz[overlay,remember picture]
\node (marker-\arabic{nodemarkers}-b) at (0,0){};%
\tikz[overlay,remember picture,inner sep=2pt]
\node[draw,ellipse,fit=(marker-\arabic{nodemarkers}-a.center) (marker-\arabic{nodemarkers}-b.center)] {};%
\stepcounter{nodemarkers}%
}
\begin{document}
\begin{tabular}{*6{c}}\hline
Col 1 & Col 2 & Col 3 & Col 4 & Col 5 & Col 6 \\\hline
bla & bla & \circletext{bla} & bla & bla & bla \\
bla & bla & bla & bla & bla & bla \\
ble & ble & ble & bla & \circletext{bla} & bla \\
bla & bla & bla & bla & bla & bla \\ \hline
\end{tabular}
\end{document}
The \circletext
command defines a node to the left and right of the text and then fits an ellipse around them. More fanciful graphics are of course possible, this is a rather basic example (since I do not know what your table looks like). Two LaTeX runs are necessary to have everything show up in the right place.
Edit: Here is an example of how to mark arbitrary blocks. Ellipses don't look good with large blocks, so it is using rounded rectangles instead:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{fit,shapes.misc}
\newcommand\marktopleft[1]{%
\tikz[overlay,remember picture]
\node (marker-#1-a) at (0,1.5ex) {};%
}
\newcommand\markbottomright[1]{%
\tikz[overlay,remember picture]
\node (marker-#1-b) at (0,0) {};%
\tikz[overlay,remember picture,thick,dashed,inner sep=3pt]
\node[draw,rounded rectangle,fit=(marker-#1-a.center) (marker-#1-b.center)] {};%
}
\begin{document}
\begin{tabular}{*6{c}}\hline
Col 1 & Col 2 & Col 3 & Col 4 & Col 5 & Col 6 \\\hline
bla & bla & \marktopleft{c1}bla & bla & bla & bla \\
bla & bla & bla & bla & bla & bla \\
ble & ble & ble & bla & bla\markbottomright{c1} & bla \\
bla & bla & bla & bla & bla & bla \\
bla & \marktopleft{c2}bla & bla & bla & bla\markbottomright{c2} & bla \\ \hline
\end{tabular}
\end{document}
Best Answer
Please check out the (excellent!) Embedded Objects manual that comes with Lyx (directly available from the
Help
menu). Section 2.11 describes in detail how to color tables, table cells, and cell backgrounds.As Martin has already pointed out, the solution is based on
colortbl
:which leads to this PDF output: