Beamer,使用 Tikzmark 注释表格

Beamer,使用 Tikzmark 注释表格

我正在尝试根据此处的建议使用 tikzmark 和 tikzpicture 在 beamer 上注释我的表格:在 Beamer 中注释 Tikzmark 突出显示的表格行

但是,当我尝试复制代码时,我的评论“评论”没有出现在幻灯片上。

有人能帮我吗?我的代码附在下面。我用系数“Slider”突出显示两行,并在行末添加注释(当前注释只是“评论”)。

谢谢。

\documentclass{beamer}
\mode<presentation>
{
\usetheme{CambridgeUS}
\usecolortheme{dolphin}
\setbeamercovered{transparent}
}

\usepackage{color,colortbl}
\usepackage{amsmath,amssymb,amsthm} %%% INCLUDE
\usepackage{multirow,booktabs,dcolumn}
\usepackage[beamer,customcolors]{hf-tikz}
\usetikzlibrary{calc}
\tikzset{hl/.style={
set fill color=red!80!black!40,
set border color=red!80!black,
},
}
\begin{document}


\begin{frame}{Regression Results}{Participation}

\begin{table}
\resizebox{\textwidth}{0.4\textheight}{
\begin{tabular}{lcccccc} \hline
& \multicolumn{3}{c}{Dependent Variable:} &  \multicolumn{3}{c}{Dependent Variable:} \\
& \multicolumn{3}{c}{Effort>0} &  \multicolumn{3}{c}{Effort>5} \\
\cline{2-4} \cline{5-7}
Variables & (1) & (2) & (3) & (4) & (5) & (6) \\
\hline
 &  &  &  &  &  &  \\
\tikzmarkin<2>[hl]{H1}Slider & -0.019 & -0.031 & -0.038 & -0.037 & -0.051 & -0.055 \\
 & (0.069) & (0.068) & (0.068) & (0.068) & (0.067) & (0.066)\tikzmarkend{H1}\\
Early Departure  & -0.143** & -0.160** & -0.147** & -0.204*** & -0.222*** & -0.209*** \\
 & (0.070) & (0.070) & (0.070) & (0.069) & (0.068) & (0.069) \\
Pause  & -0.427*** & -0.430*** & -0.425*** & -0.694*** & -0.697*** & -0.691*** \\
 & (0.068) & (0.068) & (0.067) & (0.067) & (0.066) & (0.066) \\
20-Minute  & -0.036 & -0.040 & -0.037 & -0.035 & -0.040 & -0.036 \\
 & (0.069) & (0.068) & (0.068) & (0.067) & (0.066) & (0.066) \\
Threshold  & -0.284*** & -0.282*** & -0.272*** & -0.266*** & -0.263*** & -0.254*** \\
 & (0.068) & (0.068) & (0.067) & (0.067) & (0.066) & (0.066) \\
Flat Wage  & 0.037 & 0.020 & 0.031 & 0.056 & 0.038 & 0.041 \\
 & (0.069) & (0.069) & (0.069) & (0.068) & (0.067) & (0.067) \\
Effort Choice & -0.606*** & -0.608*** & -0.601*** & -0.766*** & -0.769*** & -0.759*** \\
 & (0.068) & (0.068) & (0.068) & (0.067) & (0.066) & (0.066) \\
Constant & 0.963*** & 1.111*** & 0.989*** & 0.944*** & 1.102*** & 1.051*** \\
 & (0.049) & (0.064) & (0.159) & (0.048) & (0.062) & (0.155) \\
 &  &  &  &  &  &  \\
Observations & 434 & 434 & 434 & 434 & 434 & 434 \\
R-squared & 0.277 & 0.298 & 0.316 & 0.429 & 0.448 & 0.463 \\
\% invested in Risk Task & N & Y & Y & N & Y & Y \\
Controls & N & N & Y & N & N & Y \\
\hline
\multicolumn{7}{c}{ Standard errors in parentheses} \\
\multicolumn{7}{c}{ *** p$<$0.01, ** p$<$0.05, * p$<$0.10} \\
\end{tabular}
}
\end{table}

\begin{tikzpicture}[remember picture,overlay]
\node<2>[left,font=\small] at ([yshift=0.5ex]{pic cs:H1}) {Comment};
\end{tikzpicture}

\end{frame}

\end{document}

答案1

您必须将节点“注释”放在包含表格的框内。

我将框的宽度从 改为\textwidth以便0.86\textwidth在表格的右侧显示“评论”。

您的代码

\documentclass{beamer}
\mode<presentation>
{
\usetheme{CambridgeUS}
\usecolortheme{dolphin}
\setbeamercovered{transparent}
}

\usepackage{color,colortbl}
\usepackage{amsmath,amssymb,amsthm} %%% INCLUDE
\usepackage{multirow,booktabs,dcolumn}
\usepackage[beamer,customcolors]{hf-tikz}
\usetikzlibrary{calc}
\tikzset{hl/.style={
set fill color=red!80!black!40,
set border color=red!80!black,
},
}

\begin{document}


\begin{frame}{Regression Results}{Participation}

\begin{table}
\resizebox{0.86\textwidth}{0.4\textheight}{
\begin{tabular}{lcccccc} \hline
& \multicolumn{3}{c}{Dependent Variable:} &  \multicolumn{3}{c}{Dependent Variable:} \\
& \multicolumn{3}{c}{Effort>0} &  \multicolumn{3}{c}{Effort>5} \\
\cline{2-4} \cline{5-7}
Variables & (1) & (2) & (3) & (4) & (5) & (6) \\
\hline
 &  &  &  &  &  &  \\
\tikzmarkin<2>[hl]{H1}Slider & -0.019 & -0.031 & -0.038 & -0.037 & -0.051 & -0.055 \\
 & (0.069) & (0.068) & (0.068) & (0.068) & (0.067) & (0.066)\tikzmarkend{H1}\\
Early Departure  & -0.143** & -0.160** & -0.147** & -0.204*** & -0.222*** & -0.209*** \\
 & (0.070) & (0.070) & (0.070) & (0.069) & (0.068) & (0.069) \\
Pause  & -0.427*** & -0.430*** & -0.425*** & -0.694*** & -0.697*** & -0.691*** \\
 & (0.068) & (0.068) & (0.067) & (0.067) & (0.066) & (0.066) \\
20-Minute  & -0.036 & -0.040 & -0.037 & -0.035 & -0.040 & -0.036 \\
 & (0.069) & (0.068) & (0.068) & (0.067) & (0.066) & (0.066) \\
Threshold  & -0.284*** & -0.282*** & -0.272*** & -0.266*** & -0.263*** & -0.254*** \\
 & (0.068) & (0.068) & (0.067) & (0.067) & (0.066) & (0.066) \\
Flat Wage  & 0.037 & 0.020 & 0.031 & 0.056 & 0.038 & 0.041 \\
 & (0.069) & (0.069) & (0.069) & (0.068) & (0.067) & (0.067) \\
Effort Choice & -0.606*** & -0.608*** & -0.601*** & -0.766*** & -0.769*** & -0.759*** \\
 & (0.068) & (0.068) & (0.068) & (0.067) & (0.066) & (0.066) \\
Constant & 0.963*** & 1.111*** & 0.989*** & 0.944*** & 1.102*** & 1.051*** \\
 & (0.049) & (0.064) & (0.159) & (0.048) & (0.062) & (0.155) \\
 &  &  &  &  &  &  \\
Observations & 434 & 434 & 434 & 434 & 434 & 434 \\
R-squared & 0.277 & 0.298 & 0.316 & 0.429 & 0.448 & 0.463 \\
\% invested in Risk Task & N & Y & Y & N & Y & Y \\
Controls & N & N & Y & N & N & Y \\
\hline
\multicolumn{7}{c}{ Standard errors in parentheses} \\
\multicolumn{7}{c}{ *** p$<$0.01, ** p$<$0.05, * p$<$0.10} \\
\end{tabular}
\begin{tikzpicture}[remember picture,overlay]
\node<2>[left=-3pt,anchor=west,yshift=1.5ex,font=\small] at (pic cs:H1) {Comment};
\end{tikzpicture}
}
\end{table}

\end{frame}

\end{document}

输出

在此处输入图片描述

相关内容