3

I want to circle the cell as shown in image. How do I do this inside a beamer frame?

I followed this similar question but couldn't figure out how to make the circle bold and red.

\documentclass{beamer}

\usepackage{tikz} \usetikzlibrary{fit,shapes.geometric}

\begin{document} \begin{frame}{} \begin{table} \begin{tabular}{l | c | c | c | c } Competitor Name & Swim & Cycle & Run & Total \ \hline \hline John T & 13:04 & 24:15 & 18:34 & 55:53 \ Norman P & 8:00 & 22:45 & 23:02 & 53:47\ Alex K & 14:00 & 28:00 & n/a & n/a\ Sarah H & 9:22 & 21:10 & 24:03 & 54:35 \end{tabular} \caption{Triathlon results} \end{table} \end{frame} \end{document}

enter image description here

4 Answers4

4

Use tikz as described in this answer to "How to add arrow in equations and matrix?":

  • Define \tikznode in the preamble.
  • Assign a label to the text that you want to decorate using \tikznode.
  • Add a tikzpicture environment with the decoration (using the label from the last step).
  • Don't forget to run LaTeX at least twice to get the positions right.

enter image description here

\documentclass{beamer}
\usepackage{tikz}
\newcommand\tikznode[3][]{%
  \tikz[remember picture,baseline=(#2.base)]
    \node[minimum size=0pt,inner sep=0pt,#1](#2){#3};%
}
\begin{document}
\begin{frame}
  \begin{tabular}{l | c | c | c | c }
    Competitor Name & Swim & Cycle & Run & Total \\
    \hline\hline
    John T & 13:04 & 24:15 & 18:34 & 55:53 \\ 
    Norman P & 8:00 & 22:45 & 23:02 & 53:47\\
    Alex K & 14:00 & \tikznode{alex}{28:00} & n/a & n/a\\
    Sarah H & 9:22 & 21:10 & 24:03 & 54:35 
  \end{tabular}
  \begin{tikzpicture}[remember picture,overlay]
    \draw[red,very thick] (alex) circle[x radius=8mm,y radius=4mm]; 
  \end{tikzpicture}
\end{frame}
\end{document}
gernot
  • 49,614
2

With use of the tikzmark library. Based on highlight cell:

\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{fit,             
                tikzmark,       % <---
                shapes.geometric}  
\tikzset{FIT/.style = {%
    ellipse, draw=red, thick, inner xsep=0pt, fit=#1}
        }
\usepackage{hhline}

\begin{document} \begin{frame} \frametitle{Use of \texttt{tikzmark} library} \begin{table} \centering \begin{tabular}{l | c | c | c | c } Competitor Name & Swim & Cycle & Run & Total \ \hhline{=:=:=:=:=} John T & 13:04 & 24:15 & 18:34 & 55:53 \ Norman P & 8:00 & 22:45 & 23:02 & 53:47 \ Alex K & 14:00 & \tikzmarknode{a}{28:00} & n/a & n/a \ Sarah H & 9:22 & 21:10 & 24:03 & 54:35 \end{tabular} \begin{tikzpicture}[overlay,remember picture] \node[FIT=(a)] {}; \end{tikzpicture} \caption{Table} \end{table} \end{frame} \end{document}

enter image description here

Zarko
  • 296,517
2

With {NiceTabular} of nicematrix and TikZ to draw the ellipsis.

\documentclass{beamer}
\usepackage{nicematrix}
\usepackage{tikz}
\usetikzlibrary{fit,shapes.geometric}  
\tikzset{FIT/.style = {ellipse, draw=red, thick, inner xsep=0pt, fit=#1} }

\begin{document}

\begin{frame} \frametitle{Use of the \texttt{nicematrix}} \begin{table} \centering \begin{NiceTabular}{l | c | c | c | c } Competitor Name & Swim & Cycle & Run & Total \ \Hline\Hline John T & 13:04 & 24:15 & 18:34 & 55:53 \ Norman P & 8:00 & 22:45 & 23:02 & 53:47 \ Alex K & 14:00 & 28:00 & n/a & n/a \ Sarah H & 9:22 & 21:10 & 24:03 & 54:35 \ \CodeAfter \tikz \node[FIT=(4-3)] {} ; \end{NiceTabular} \caption{Table} \end{table} \end{frame}

\end{document}

Output of the above code

F. Pantigny
  • 40,250
1

As I don't know what the \h command is, I replaced it with a couple of\hlines. You can circle a cell contents with the circledsteps package:

\documentclass[svgnames]{beamer}
\usepackage{circledsteps}
\begin{document}

\begin{frame}{title}

\begin{table} \color{NavyBlue} \begin{tabular}{l | c | c | c | c } Competitor Name & Swim & Cycle & Run & Total \ \hline\hline John T & 13:04 & 24:15 & 18:34 & 55:53 \ Norman P & \phantom{0}8:00 & 22:45 & 23:02 & 53:47\ Alex K & 14:00 & \Circled[outer color=IndianRed, inner ysep=8pt]{28:00} & n/a & n/a\ Sarah H & \phantom{0}9:22 & 21:10 & 24:03 & 54:35 \end{tabular} \caption{Triathlon results} \end{table}

\end{frame}

\end{document}

enter image description here

Bernard
  • 271,350