1

I have a table similar to this one

\begin{center}
\begin{tabular}{llcc|}
  &   & \multicolumn{2}{c}{Blah}\\ \cline{3-4}
  & \multicolumn{1}{l|}{} & A & B\\ \cline{2-4}
Bleh1 & \multicolumn{1}{|l|}{C} & \begin{tabular}{l}E\\F\end{tabular}& \begin{tabular}{l}I\\J\end{tabular} \\ \cline{2-4}
Bleh2 & \multicolumn{1}{|l|}{D} & × & \begin{tabular}{l}G\\H\end{tabular}\\ \cline{2-4}
\end{tabular}
\end{center}

and I would like to add some circles or ellipses to highlight particular entries and add some text, outside the table. For example, I would like to add a red circle or ellipsis around E and F (having them inside the same circle) and draw a line, maybe also red, from the ellipsis to some text outside the table, say "Hello", linking this text to the entry in the table. Any ideas?

Thanks,

2

Here I use tikzpicture with [rember picture and overly] approach to achieve the objective.

  1. You may need to compile twice for the first time.

  2. The connecting lines can have different in/out angles of your choice -- edge [out=0, in=180]

  3. Use short hand notation \tikz in a tabular

  4. Some comments are added for explanations.

enter image description here

\documentclass[a4paper]{article}
\usepackage{tikz}
\usetikzlibrary{arrows,shapes}

\begin{document}

\tikzstyle{every picture}=[remember picture, overlay]      % overlay

\begin{center}
\begin{tabular}{llcc|}
  &   & \multicolumn{2}{c}{Blah}\\ \cline{3-4}
  & \multicolumn{1}{l|}{} & A & B\\ \cline{2-4}
Bleh1 & \multicolumn{1}{|l|}{C} & 
\begin{tabular}{l}
\tikz[baseline]
{
\node[fill=blue,rectangle,anchor=base] (t1) % internal name in table
{E};  % assign an internal name to E 
}\\ 
\tikz[baseline]
{
\node[fill=red,rectangle,anchor=base] (t2)  % internal name in table
{F};  % Assign an internal name to F 
}
\end{tabular}& 
\begin{tabular}{l}
I\\J
\end{tabular} \\ \cline{2-4}
Bleh2 & \multicolumn{1}{|l|}{D} & × & \begin{tabular}{l}G\\H\end{tabular}\\ \cline{2-4}
\end{tabular}
\end{center}

\begin{itemize}                   
\item Hello to E
\tikz \node [coordinate] (n1) {};  % define an internal name outside the table 
\item Hello to F
\tikz \node [coordinate] (n2) {};  % define an internal name outside the table
\end{itemize}

\begin{tikzpicture}
 \path[->,blue] (n1) edge [out=0, in=180] (t1);       % points form a line
 \path[->,red] (n2) edge [out=0, in=0] (t2);          % points form a line
\end{tikzpicture}

\end{document}
  • Thanks! However, I was looking for a way to avoid using itemize, but where the 'outside text' is placed at any point outside the table. I just found something similar so I'll try to modify it for what I need (see tex.stackexchange.com/questions/9442/…). Thanks for your help. – flucoe Oct 13 '13 at 16:44
  • @flucoe -- No worries. Actually, tikz node can be inline too. For example, This is what it means \tikz \node here. And some text \tikz \node there. I simply think itemize is good for sum up. Thus, for demo. Good to know that you find sth useful. Thanks. – Jesse Oct 13 '13 at 16:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.