# Zooming in and highlighting parts of a table

I would like to add regression results to a beamer presentation, since it's a vector autoregressive model there are a lot of coefficients. Therefore, I would like to show the whole table just to give an idea on the dimensions and the lags used in the analysis but then I would like to only highlight certain parts of the table, i.e. certain coefficients.

There is the possibility to use framezoom, but this does have the disadvantage, that it does more than zooming in on the box, but shows all that fits on the slide, which again clutters the resulting highligh slide. I can fix that by always creating zoomed areas in the same aspect ratio as my presentation, but that's not really satisfactory. Please see beamer framezoom: restrict zoomed frame to border for a description of this problem.

Therefore, I would like to know if there's another tool as flexible as tikz and spy to highlight not a certain part of a picture, but of a table. Zooming in and highlighting part of picture

MWE showing the usage of framezoom, which should be replace with tikz.

% !TeX spellcheck = en_US
\documentclass[13pt
,aspectratio=43
%,handout
]{beamer}

\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage{amsmath,amsfonts,amssymb}

\usepackage{gensymb}
\usepackage{color}
\usepackage{lmodern}
%\renewcommand{\rmdefault}{lmss}
\usepackage{hyperref}

%Remove indentation in footnotes
%\usepackage[hang,flushmargin]{footmisc}
%Table Packages
\usepackage{tabularx}
\usepackage{longtable,booktabs,tabu}
\usepackage{makecell}
\usepackage[detect-all]{siunitx}
\sisetup{input-symbols = ()} % "(" and ")" are ordinary inputs
\usepackage{setspace}

\def\V#1,#2/#3/{\Entry[#3]{#1}{#2}}
\usepackage{siunitx} %align numbers by decimal point

\usepackage{csquotes}
% Options for captions
\usepackage[hypcap,format = plain, justification=raggedright, singlelinecheck=off]{caption}
\captionsetup[table]{belowskip=0em,aboveskip=2pt}
\captionsetup[figure]{belowskip=0em,aboveskip=2pt}

\usepackage{textcomp,ragged2e}
\usepackage{appendixnumberbeamer}

%Turn on and of the display of the notes by commenting out the following line
%\setbeameroption{show notes}
\setbeamertemplate{note page}[plain]

\usepackage{tikz}
\usepackage{pgfplots}
\usetikzlibrary{positioning}

% % % Theme
%\usetheme{Frankfurt}
\usetheme[titleformat = regular
, sectionpage = progressbar
, subsectionpage = none
, numbering = counter %none,counter, fraction
, progressbar = foot % none, head, frametitle, foot
]{metropolis}

\usepackage{standalone}
\usepackage{tikz}

% % % % % % % % % % % % % % % % % % % % % % % % % % % % % %

\begin{document}

\setstretch{1,5}

\begin{frame}[shrink = 0.2]
\frametitle{Distribution of Leverage prior to Price Decline in 2008 and 2014}

\framezoom<1><2>[border](2.5cm,1.5cm)(3cm,2cm)
\begin{table}[htb]
\footnotesize
\begin{center}
\begin{tabularx}{\textwidth}{>{\centering}p{0.19\textwidth}
>{\centering}p{0.01em}
>{\centering}X
S[table-format=6.0
,round-mode=places
,round-precision=0
,table-align-text-post = false
]
S[table-format=6.0
,round-mode=places
,round-precision=0
,table-align-text-post = false
]
>{\centering}p{0.01em}
>{\centering}X
S[table-format=6.0
,round-mode=places
,round-precision=0
,table-align-text-post = false
]
S[table-format=6.0
,round-mode=places
,round-precision=0
,table-align-text-post = false
]
}
\toprule
Leverage Percentile &  & \multicolumn{4}{c}{2008~Q2}  &  \multicolumn{3}{c}{2014~Q3}  \tabularnewline
\cmidrule{3-5} \cmidrule{7-9}
&  & No.  & {Assets} & {Debt} & & No.  & {Assets} & {Debt}\tabularnewline
\cmidrule{1-1}      \cmidrule{3-5}  \cmidrule{7-9}
$1^{st} Quartile$   &  & 33 & 3094.25 & 493.08 & & 33 & 5871.65  & 948.29  \tabularnewline  %   $0 < P_{0.25} \leq 0.25$
$2^{nd} Quartile$   &  & 36 & 11868.81 & 2494.08 & & 36 & 12894.65 & 2749.38 \tabularnewline        % $0.25 < P_{0.50} \leq 0.50$
$3^{rd} Quartile$   &  & 35 & 5018.03 & 1380.06 & & 36 & 4279.47 & 1328.07  \tabularnewline         % $0.50 < P_{0.75} \leq 0.75$
$4^{th} Quartile$       &  & 35 & 2844.71 & 1208.22 & & 36 & 2001.95 & 884.75 \tabularnewline   % $0.75 < P_{1} \leq 1$
Non-calculable Leverage &  & 5  & 1172.49 & 338.66 & &  7 & 1304.48  & 390.58 \tabularnewline
\bottomrule
\end{tabularx}
\captionof{table}{Comparison of the number of companies for each leverage group prior to price declines in 2008~Q2 and 2014~Q3 and their average value of total assets and debt in million US-Dollar.}\label{t.Leverage.Groups}
\end{center}
\end{table}

\end{frame}

\end{document}

• Not really a Latex or Tikz solution, but since you use beamer, Impressive might be of interest. It offers some great functionality for presenting with PDF files, such as highlight boxes, a spotlight, and zooming in.
– Max
Jul 17 '18 at 14:22
• why not use tikz and spy? Jul 17 '18 at 14:26
• @samcarter I just found examples using a picture as basis, so I thought it's not possible. Jul 17 '18 at 14:35
• @hannes101 It is certainly possible. Can you make a MWE with a table to give us something to start with? Jul 17 '18 at 14:40
• I agree with @samcarter. After all the authors of beamer and TikZ are very close to each other ;-)
– user121799
Jul 17 '18 at 14:58

Proof of principle: using the tikz spy library and @marmots nice answer https://tex.stackexchange.com/a/438238/36296

% !TeX spellcheck = en_US
\documentclass[13pt
,aspectratio=43
%,handout
]{beamer}

\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage{amsmath,amsfonts,amssymb}

\usepackage{gensymb}
%\usepackage{color}
\usepackage{lmodern}
%\renewcommand{\rmdefault}{lmss}
%\usepackage{hyperref}

%Remove indentation in footnotes
%\usepackage[hang,flushmargin]{footmisc}
%Table Packages
\usepackage{tabularx}
\usepackage{longtable,booktabs,tabu}
\usepackage{makecell}
\usepackage[detect-all]{siunitx}
\sisetup{input-symbols = ()} % "(" and ")" are ordinary inputs
\usepackage{setspace}

\def\V#1,#2/#3/{\Entry[#3]{#1}{#2}}
\usepackage{siunitx} %align numbers by decimal point

\usepackage{csquotes}
% Options for captions
\usepackage[hypcap,format = plain, justification=raggedright, singlelinecheck=off]{caption}
\captionsetup[table]{belowskip=0em,aboveskip=2pt}
\captionsetup[figure]{belowskip=0em,aboveskip=2pt}

\usepackage{textcomp,ragged2e}
\usepackage{appendixnumberbeamer}

%Turn on and of the display of the notes by commenting out the following line
%\setbeameroption{show notes}
\setbeamertemplate{note page}[plain]

\usepackage{tikz}
\usepackage{pgfplots}
\usetikzlibrary{positioning}
\usetikzlibrary{tikzmark}
\usetikzlibrary{spy}

% % % Theme
%\usetheme{Frankfurt}
\usetheme[titleformat = regular
, sectionpage = progressbar
, subsectionpage = none
, numbering = counter %none,counter, fraction
, progressbar = foot % none, head, frametitle, foot
]{metropolis}

\usetikzlibrary{matrix}
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % %

\tikzset{
invisible/.style={opacity=0,text opacity=0},
visible on/.style={alt={#1{}{invisible}}},
connect on/.style={alt={#1{connect spies}{}}},
alt/.code args={<#1>#2#3}{%
\alt<#1>{\pgfkeysalso{#2}}{\pgfkeysalso{#3}}
},
}

\begin{document}

\begin{frame}
\frametitle{Distribution of Leverage prior to Price Decline in 2008 and 2014}

\begin{table}
\footnotesize
\begin{tikzpicture}[spy using outlines={rectangle, magnification=3, width=\textwidth, height=.8\textheight,
every spy in node/.style={fill=bg}
}
]
\matrix[ampersand replacement=\&] {
\node (species1) {
\begin{tabularx}{\textwidth}{>{\centering}p{0.19\textwidth}
>{\centering}p{0.01em}
>{\centering}X
S[table-format=6.0
,round-mode=places
,round-precision=0
,table-align-text-post = false
]
S[table-format=6.0
,round-mode=places
,round-precision=0
,table-align-text-post = false
]
>{\centering}p{0.01em}
>{\centering}X
S[table-format=6.0
,round-mode=places
,round-precision=0
,table-align-text-post = false
]
S[table-format=6.0
,round-mode=places
,round-precision=0
,table-align-text-post = false
]
}
\toprule
Leverage Percentile &  & \multicolumn{4}{c}{2008~Q2}  &  \multicolumn{3}{c}{2014~Q3}  \tabularnewline
\cmidrule{3-5} \cmidrule{7-9}
&  & No.  & {Assets} & {Debt} & & No.  & {Assets} & {Debt}\tabularnewline
\cmidrule{1-1}      \cmidrule{3-5}  \cmidrule{7-9}
$1^{st} Quartile$   &  & 33 & 3094.25 & 493.08 & & 33 & 5871.65  & 948.29  \tabularnewline  %   $0 < P_{0.25} \leq 0.25$
$2^{nd} Quartile$   &  & 36 & 11868.81 & 2494.08 & & 36 & 12894.65 & 2749.38 \tabularnewline        % $0.25 < P_{0.50} \leq 0.50$
$3^{rd} Quartile$   &  & 35 & 5018.03 & 1380.06 & & 36 & 4279.47 & 1328.07  \tabularnewline         % $0.50 < P_{0.75} \leq 0.75$
$4^{th} Quartile$       &  & 35 & 2844.71 & 1208.22 & & 36 & 2001.95 & 884.75 \tabularnewline   % $0.75 < P_{1} \leq 1$
Non-calculable Leverage &  & 5  & 1172.49 & 338.66 & &  7 & 1304.48  & 390.58 \tabularnewline
\bottomrule
\end{tabularx}
};\\
\node[text width=\textwidth] (species2) {\addtocounter{table}{1}\textbf{Table \thetable:} Comparison of the number of companies for each leverage group prior to price declines in 2008~Q2 and 2014~Q3 and their average value of total assets and debt in million US-Dollar.};\\
};
\spy on (-0.5,0.4) in node[visible on=<2->] at (0,0);
\end{tikzpicture}
\end{table}

\end{frame}

\end{document}


• you don't need

\usepackage{color}
\usepackage{hyperref}


with beamer

• please don't load the same package multiple times, specially not with different options, e.g. siunitx and tikz

• Do you mean \setstretch{1.5} instead of 1,5?

• using \begin{frame}[shrink = 0.2] is usually a bad idea, it will waste space at the right hand site. Better use a suitable fontsize instead

• using floating specifier such as \begin{table}[htb] in a documentclass without floats does not make sense

• don't use \begin{center}...\end{center} in table environments, this will add additional vertical space and is not necessary because tables are centred per default in beamer

• Why \captionof{table}{...} if you are in a table environment? Simply use \caption{...}

• Thanks for this. The reason that the table does have some unnecessary stuff is based on the fact that it's copied from my paper. But of course will fix that! Thanks a lot Jul 17 '18 at 18:25