3

I have a table that contains lots of number on it. I want to use it in a beamer presentation and I wonder whether it is possible to focus different regions at different slides. This is the code I use for creating the table:

\documentclass{article}
\usepackage{booktabs,caption}
\newcommand\mc[1]{\multicolumn{1}{c}{#1}} % handy shortcut macro
\begin{document}
\begin{table}
\captionsetup{font=small,skip=0.333\baselineskip}
\caption*{Data statistics Treebanks} 
\medskip
\setlength\tabcolsep{0pt}
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}
    *{2}{l*{5}{r}}}
\toprule
\textbf{lang} & \mc{\textbf{train}} & \mc{\textbf{dev}} 
  & \mc{\textbf{test}} & \mc{$|\mathbf{T}|$} & \mc{$|\mathbf{F}|$} &
\textbf{lang} & \mc{\textbf{train}} & \mc{\textbf{dev}} 
  & \mc{\textbf{test}} & \mc{$|\mathbf{T}|$} & \mc{$|\mathbf{F}|$} \\
\cmidrule{1-6} \cmidrule{7-12} 
ar & 1   & 4 & 2  & 123 & 123123 &
es & 123 & 902 & 123  & 234 & 31567  \\
bg & 3425  & 45  & 234  & 5252  & 1231634 &
pt & 755 & 234 & 645  & 2464  & 242  \\
cs & 767 & 23  & 86 & 345453 & 23422 &
sk & 3453  & 1231 & 235  & 43243 & 34663  \\
en &     &   &    &     &     & 
sl &     &   &    &     &      \\
et &     &   &    &     &     & 
ru &     &   &    &     &      \\
fr &     &   &    &     &     & 
hi &     &   &    &     &      \\
hu &     &   &    &     &     & 
lv &     &   &    &     &      \\
ro &     &   &    &     &     & 
nl &     &   &    &     &      \\
tr &     &   &    &     &     & 
pl &     &   &    &     &      \\
hr &     &   &    &     &     & 
de &     &   &    &     &      \\
it &     &   &    &     &     & 
gr &     &   &    &     &      \\
da &     &   &    &     &     & 
la &     &   &    &     &      \\
ca &     &   &    &     &     & 
ko &     &   &    &     &      \\
fi &     &   &    &     &     & 
ir &     &   &    &     &     \\
\bottomrule
\end{tabular*}
\end{table}
\end{document}

It creates the following table:

enter image description here

So, I want to focus on lets say here in one slide:

enter image description here

And this part in another slide:

enter image description here

Is there a way to do that like this ?

2
  • 1
    with tikzmark library? search for question with this tag. here is many similar question ...
    – Zarko
    May 26 '18 at 17:50
  • 1
    Yes, with \framezoom. (Or with the spy library in TikZ.)
    – user121799
    May 26 '18 at 17:50
2

A rather simple way is to use the \framezoom command.

\documentclass{beamer}
\usepackage{booktabs,caption}
\newcommand\mc[1]{\multicolumn{1}{c}{#1}} % handy shortcut macro
\hypersetup{linkbordercolor={red}} % see https://tex.stackexchange.com/a/130110/121799
\begin{document}
\begin{frame}[t]{A table}
\setlength\tabcolsep{0pt}
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}
    *{2}{l*{5}{r}}}
\toprule
\textbf{lang} & \mc{\textbf{train}} & \mc{\textbf{dev}} 
  & \mc{\textbf{test}} & \mc{$|\mathbf{T}|$} & \mc{$|\mathbf{F}|$} &
\textbf{lang} & \mc{\textbf{train}} & \mc{\textbf{dev}} 
  & \mc{\textbf{test}} & \mc{$|\mathbf{T}|$} & \mc{$|\mathbf{F}|$} \\
\cmidrule{1-6} \cmidrule{7-12} 
ar & 1   & 4 & 2  & 123 & 123123 &
es & 123 & 902 & 123  & 234 & 31567  \\
bg & 3425  & 45  & 234  & 5252  & 1231634 &
pt & 755 & 234 & 645  & 2464  & 242  \\
cs & 767 & 23  & 86 & 345453 & 23422 &
sk & 3453  & 1231 & 235  & 43243 & 34663  \\
en &     &   &    &     &     & 
sl &     &   &    &     &      \\
et &     &   &    &     &     & 
ru &     &   &    &     &      \\
fr &     &   &    &     &     & 
hi &     &   &    &     &      \\
hu &     &   &    &     &     & 
lv &     &   &    &     &      \\
ro &     &   &    &     &     & 
nl &     &   &    &     &      \\
tr &     &   &    &     &     & 
pl &     &   &    &     &      \\
hr &     &   &    &     &     & 
de &     &   &    &     &      \\
it &     &   &    &     &     & 
gr &     &   &    &     &      \\
da &     &   &    &     &     & 
la &     &   &    &     &      \\
ca &     &   &    &     &     & 
ko &     &   &    &     &      \\
fi &     &   &    &     &     & 
ir &     &   &    &     &     \\
\bottomrule
\end{tabular*}
\only<2>{
\framezoom<2><3>[border=4](0cm,0.8cm)(5.6cm,1.05cm)
}
\end{frame}
\end{document}

The second slide will then be

enter image description here

If you remove the \only thingy, the last third slide will be zoom of the relevant part.

enter image description here

If you don't want to guess the coordinates and/or not zoom, you could do as @Zarko suggests, namely draw the boundary with TikZ.

\documentclass{beamer}
\usepackage{booktabs,caption}
\usepackage{tikz}
\usetikzlibrary{fit}
\newcommand\mc[1]{\multicolumn{1}{c}{#1}} % handy shortcut macro
\newcommand{\tikznode}[2]{\relax
\ifmmode%
  \tikz[remember picture,baseline=(#1.base),inner sep=0pt] \node (#1) {$%\tikznodestyle 
  #2$};
\else
  \tikz[remember picture,baseline=(#1.base),inner sep=0pt] \node (#1) {#2};%
\fi}
\begin{document}
\begin{frame}[t]{A table}
\setlength\tabcolsep{0pt}
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}
    *{2}{l*{5}{r}}}
\toprule
\textbf{lang} & \mc{\textbf{train}} & \mc{\textbf{dev}} 
  & \mc{\textbf{test}} & \mc{$|\mathbf{T}|$} & \mc{$|\mathbf{F}|$} &
\textbf{lang} & \mc{\textbf{train}} & \mc{\textbf{dev}} 
  & \mc{\textbf{test}} & \mc{$|\mathbf{T}|$} & \mc{$|\mathbf{F}|$} \\
\cmidrule{1-6} \cmidrule{7-12} 
\tikznode{ar}{ar} & 1   & 4 & 2  & 123 & \tikznode{tr}{123123} &
es & 123 & 902 & 123  & 234 & 31567  \\
\tikznode{bg}{bg} & 3425  & 45  & 234  & 5252  & \tikznode{br}{1231634} &
pt & 755 & 234 & 645  & 2464  & 242  \\
cs & 767 & 23  & 86 & 345453 & 23422 &
sk & 3453  & 1231 & 235  & 43243 & 34663  \\
en &     &   &    &     &     & 
sl &     &   &    &     &      \\
et &     &   &    &     &     & 
ru &     &   &    &     &      \\
fr &     &   &    &     &     & 
hi &     &   &    &     &      \\
hu &     &   &    &     &     & 
lv &     &   &    &     &      \\
ro &     &   &    &     &     & 
nl &     &   &    &     &      \\
tr &     &   &    &     &     & 
pl &     &   &    &     &      \\
hr &     &   &    &     &     & 
de &     &   &    &     &      \\
it &     &   &    &     &     & 
gr &     &   &    &     &      \\
da &     &   &    &     &     & 
la &     &   &    &     &      \\
ca &     &   &    &     &     & 
ko &     &   &    &     &      \\
fi &     &   &    &     &     & 
ir &     &   &    &     &     \\
\bottomrule
\end{tabular*}
\only<2>{\begin{tikzpicture}[overlay,remember picture]
\node[draw,red,fit=(ar) (bg) (tr) (br)]{};
\end{tikzpicture}
}
\end{frame}
\end{document}

enter image description here

3

The focus could be a color background ?

mwe

\documentclass[xcolor=table]{beamer}
\usepackage[size=custom,width=5,height=5,scale=.5,debug]{beamerposter}
\def\grco{}\def\reco{}
\begin{document}

\begin{frame}

\only<2,4>{\def\grco{\rowcolor{green!30}}}
\only<3,4>{\def\reco{\rowcolor{red!30}}}

\begin{tabular}{llll}
    11 & 12 & 13 & 14\\\grco
    21 & 22 & 23 & 24\\
    31 & 32 & 33 & 34\\\reco
    41 & 42 & 43 & 44\\
\end{tabular}
\end{frame}
\end{document}
2
  • I also wonder weather is it possible to highlight background as in the first screenshot I shared in my question? I mean half of the two rows (consecutive or not) the half of the lines that starts with ar and bg
    – zwlayer
    May 27 '18 at 18:34
  • 1
    @zwlayer You can use \cellcolor instead of \rowcolor in the definition of \grco, for instance, then use in every \grco highlighted cell, e.g., \grco 11 & \clco 12 & 12 & 14 \\ ....
    – Fran
    May 27 '18 at 19:53

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.