2

I use the following code to draw a table, with a red rectangle around a cell; and a text referring to this cell.

But this code neither give me a control of the slide on which the rectangle is displayed, nor of the position of the arrow and text in relation to the targeted cell.

I would like to draw the rectangle on slide 2 with a node attached to it containing the arrow and text instead of drawing and aligning them manually. If possible with a tikzset to control the x and y relation between the node and rectangle according to the position of the targeted cell inside the table.

\documentclass{beamer}
\beamertemplatenavigationsymbolsempty % suppress navigation bar
\usepackage{verbatim}
\usepackage{tikz}
\usepackage{pgfplots}
\usetikzlibrary{arrows, arrows.meta, positioning, shapes, 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, red, inner sep=3pt]
 \node[draw, rounded rectangle, fit=(marker-#1-a.center) (marker-#1-b.center)] {};
}
\begin{document}
\begin{frame}[fragile,t]
\frametitle{}
\hspace {-1.cm}
\begin{tabular}{*6{c}}\hline
  A & B & C & D & E & F \\
 A1 & B1 & \marktopleft{c1}C1\markbottomright{c1} & D1 & E1 & F1 \\
 A2 & B2 & C2 & D2 & E2 & F2 \\
 A3 & B3 & C3 & D3 & E3 & F3 \\
 A4 & B4 & C4 & D4 & E4 & F4 \\
 \hline
\end{tabular}
\begin{tikzpicture}
\hspace {-3.cm}
\draw<2-> [ultra thick, red, -latex'] (0,0) -- +(180:3.36) node [text width=2.2cm, draw=red, very thick, fill=red!15!white, align=center, xshift=4.5cm, yshift=0cm, rounded corners=5pt] {\bf Appreciation};
\end{tikzpicture}
\end{frame}
\end{document}

enter image description here

enter image description here

1 Answer 1

2

Something like this?

\documentclass{beamer}
\beamertemplatenavigationsymbolsempty % suppress navigation bar
\usepackage{verbatim}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,positioning,fit,shapes.misc}
\usetikzlibrary{tikzmark,overlay-beamer-styles,bending}
\begin{document}
\begin{frame}[fragile,t]
\frametitle{}
\hspace {-1.cm}
\begin{tabular}{*6{c}}\hline
  A & B & C & D & E & F \\
 A1 & B1 & \tikzmarknode[rounded rectangle,draw=red,inner sep=1pt,visible
 on=<2>,text opacity=1]{C1}{C1} & D1 & E1 & F1 \\
 A2 & B2 & C2 & D2 & E2 & F2 \\
 A3 & B3 & C3 & D3 & E3 & F3 \\
 A4 & B4 & C4 & D4 & E4 & F4 \\
 \hline
\end{tabular}
\begin{tikzpicture}[overlay,remember picture]
\draw<2-> [ultra thick, red, {Latex[length=2mm,bend]}-] (C1.-25) to[out=-45,in=180,looseness=0.2] 
++(3.3,-0.1) 
node [right,text width=2.2cm, draw=red, very thick, fill=red!15!white, align=center, rounded corners=5pt] {\bf Appreciation};
\end{tikzpicture}
\end{frame}
\end{document}

enter image description here

5
  • Thank you. Your code does not place the mark on slide 2
    – Hany
    Commented Nov 20, 2018 at 16:23
  • @Hany Now it does. Sorry, to me it was not clear that this is what you want when reading your question. After you told me, and I reread your question, I understand better what rectangle you mean in "I would like to draw the rectangle on slide 2", but before that I thought it was the additional rectangle.
    – user121799
    Commented Nov 20, 2018 at 16:31
  • Thank you for your answer. Unfortunately when I tried to compile your code I got the message "You have requested, on input line 48, version 2012/12/07' of package l3names, but only version 2010/03/21 v1853 L3 Experimental Naming Scheme for TeX Primitives' is available. ! Package expl3 Error: Mismatched LaTeX3 packages detected". Would you please use my code to apply your idea. Thank you
    – Hany
    Commented Nov 21, 2018 at 4:34
  • 1
    @Hany I compiled my code on my updated TeXLive 2018 distribution with pdflatex, lualatex and xelatex without problems. When was the last time you updated your TeX installation? The error message suggests that you have not the latest files of l3names.
    – user121799
    Commented Nov 21, 2018 at 4:40
  • I am sorry for the delay of my response to your answer. We had a problem in the internet connection in my area for the last couple of weeks. I will try to install l3names package. Thank you again for your time.
    – Hany
    Commented Dec 1, 2018 at 13:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .