TransWikia.com

circle table cell in beamer

TeX - LaTeX Asked by afsara_ben on December 7, 2020

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

3 Answers

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}
newcommandtikznode[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 
    hlinehline
    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}

Correct answer by gernot on December 7, 2020

As I don't know what the h command is, I replaced it with a couple ofhlines. 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 
hlinehline
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

Answered by Bernard on December 7, 2020

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

Answered by Zarko on December 7, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP