Highlighting table cells

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}

exampl

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}

example


I cannot offer a "TeXnical" answer, only typographical advice: A circle put around a subset of cells within a large table may look like a superimposed figure unrelated to the table - in other words, it may be very confusing. Instead, I would try one of the following:

  • Draw a rectangle around the particular cells (may still not look pretty);

  • Use a raster as background;

  • Typeset the cell content in bold or italic.


I think replacing the matrix with a TiKZ matrix would allow you to fit paths around groups of cells.