# Overlaying parts of Beamer table with a “see-thru” (i.e., opaque) textbox

This seems like it should be simple! After creating a very complex table using multirow and many other table related beamer packages that I have just learned about, I now want to highlight parts of it during my talk with successful overlays (controlled by \pause or somesuch).

I had envisioned doing three textblock calls such as:

\begin{textblock}{14.5}(0.75,3)
\textblockcolor{yellow}
\vspace{.5cm}
\center
\vspace{.5cm}
\end{textblock}


Where each one has a different x-y location, a different colored background, different words.

My problem is that I want the textblockcolor to be opaque or translucent so that the text below it (i.e., the table text) is visable.

I have tried the "transparent" package - with much failure, I have tried many other false leads (so many that I have forgotten them all). I have studied the documentation for textpos (thinking that maybe I could do what I wanted with its overlay setting), any ideas?

Naturally I don't want the text to be translucent, opaque, or transparent. It seems like I would want to use "opacity" but searching on that thread doesn't lead me where I want to do -- of course, it would be nice if I could vary the color of text in each textblock but I can live with black.

Thanks for any help and thoughts.

-

One possibility is to use the improved version of \tikzmark (by Andrew Stacey). The idea is simple: inside the table you use \tikzmark to put "marks" for each block (say, \tikzmark{start1} where you want the first block to begin and \tikzmark{end1} where the first block should end; \tikzmark{start2} where you want the second block to begin and \tikzmark{end2} where the second block should end, and so forth).

Then, for each block, you simply use the \MyBox macro to draw the boxes with their text; the syntax is

\MyBox[<left|right>]{<color>}{<start-mark>}{<end-mark>}{<text>}


where the optional argument controls the position of <text>, <color> specifies the color used for the block and the text, <start-mark> and <end-mark> are the marks from the previous step, and <text> is the text that will accompany the box. Of course, you can define \MyBox in a different way to draw the colored box and to place the text according to your needs.

\documentclass{beamer}
\usepackage{booktabs}
\usepackage{tikz}
\usetikzlibrary{calc,fit}

% code by Andrew Stacey
% http://tex.stackexchange.com/a/50054/3954
\makeatletter
\tikzset{%
remember picture with id/.style={%
remember picture,
overlay,
save picture id=#1,
},
save picture id/.code={%
\edef\pgf@temp{#1}%
\immediate\write\pgfutil@auxout{%
\noexpand\savepointas{\pgf@temp}{\pgfpictureid}}%
},
if picture id/.code args={#1#2#3}{%
\@ifundefined{save@pt@#1}{%
\pgfkeysalso{#3}%
}{
\pgfkeysalso{#2}%
}
}
}

\def\savepointas#1#2{%
\expandafter\gdef\csname save@pt@#1\endcsname{#2}%
}

\def\tmk@labeldef#1,#2\@nil{%
\def\tmk@label{#1}%
\def\tmk@def{#2}%
}

\tikzdeclarecoordinatesystem{pic}{%
\pgfutil@in@,{#1}%
\ifpgfutil@in@%
\tmk@labeldef#1\@nil
\else
\tmk@labeldef#1,(0pt,0pt)\@nil
\fi
\@ifundefined{save@pt@\tmk@label}{%
\tikz@scan@one@point\pgfutil@firstofone\tmk@def
}{%
\pgfsys@getposition{\csname save@pt@\tmk@label\endcsname}\save@orig@pic%
\pgfsys@getposition{\pgfpictureid}\save@this@pic%
\pgf@process{\pgfpointorigin\save@this@pic}%
\pgf@xa=\pgf@x
\pgf@ya=\pgf@y
\pgf@process{\pgfpointorigin\save@orig@pic}%
}%
}
\newcommand\tikzmark[2][]{%
\tikz[remember picture with id=#2] #1;}
\makeatother
% end of code by Andrew Stacey

\newcommand<>\MyBox[5][right]{%
\tikz[remember picture,overlay,pin distance=0cm]
{\draw[draw=#2,fill=#2!40,line width=1pt,rectangle,rounded corners]
( $(pic cs:#3) + (0,2ex)$ ) rectangle ( $(pic cs:#4) + (0,-1ex)$ );
\node[fit = (pic cs:#3) (pic cs:#4),label=#1:\textcolor{#2!80!black}{\parbox{2cm}{\raggedright#5}}]
{};}%
}%

\begin{document}

\begin{frame}{Test Frame}

\onslide<2>{\MyBox{blue}{start1}{end1}{Some text 1}}
\onslide<3>{\MyBox[left]{green!40!black}{start2}{end2}{Some text 2}}
\onslide<4>{\MyBox{orange}{start3}{end3}{Some text 3}}
\onslide<5>{\MyBox{yellow!70!black}{start4}{end4}{Some text 4}}

\centering
\begin{tabular}{lll}
\toprule
\midrule
\tikzmark{start1}Column1a & Column2a & Column3a \\
Column1a & Column2a & Column3a\tikzmark{end1} \\
\tikzmark{start4}Column1b & Column2b & Column3b \\
Column1c & Column2c & Column3c \\
\tikzmark{start2}Column1d & Column2d & Column3d \\
Column1e & Column2e & Column3e \\
Column1f & Column2f & Column3f \\
Column1g & Column2g & Column3g \\
Column1h & Column2h & Column3h\tikzmark{end4} \\
Column1i & Column2i & Column3i \\
Column1j & \tikzmark{start3}Column2j & Column3j \\
Column1k & Column2k\tikzmark{end2} & Column3k\tikzmark{end3} \\
\bottomrule
\end{tabular}

\end{frame}

\end{document}


Here's an animation of the resulting document:

-