我想要幻灯片 2 上的数字 3480 周围有一个圆角框。幻灯片 1 上有这个框。我在幻灯片 2 中使用了相同的格式以及 reveal。但我没有得到这个框。请查看代码并告诉我错误。另外,在使用 reveal 时,有没有更简单的方法来在文本周围绘制框?
\documentclass[notes,11pt, aspectratio=169]{beamer}
\usepackage{pgfpages}
\usepackage{helvet}
\usepackage[default]{lato}
\usepackage{array}
\usepackage{tikz}
\usepackage{verbatim}
\setbeamertemplate{note page}{\pagecolor{yellow!5}\insertnote}
\usetikzlibrary{positioning}
\usetikzlibrary{calc}
\usetikzlibrary{arrows}
\usetikzlibrary{decorations.markings}
\usetikzlibrary{shapes.misc}
\usetikzlibrary{matrix,shapes,arrows,fit,tikzmark}
\usepackage{amsmath}
\usepackage{mathpazo}
\usepackage{hyperref}
\usepackage{lipsum}
\usepackage{multimedia}
\usepackage{graphicx}
\usepackage{multirow}
\usepackage[space]{grffile}
\usepackage{booktabs}
\begin{document}
%%% TIKZ STUFF
\tikzset{
every picture/.style={remember picture,baseline},
every node/.style={anchor=base,align=center,outer sep=1.5pt},
every path/.style={thick},
}
\newcommand\marktopleft[1]{%
\tikz[overlay,remember picture]
\node (marker-#1-a) at (-.3em,.3em) {};%
}
\newcommand\markbottomright[2]{%
\tikz[overlay,remember picture]
\node (marker-#1-b) at (0em,0em) {};%
}
\tikzstyle{every picture}+=[remember picture]
\tikzstyle{mybox} =[draw=black, very thick, rectangle, inner sep=10pt, inner ysep=20pt]
\tikzstyle{fancytitle} =[draw=black,fill=red, text=white]
%%%% END TIKZ STUFF
\begin{frame}{Slide 1}
\makebox[\linewidth][c]{
\begin{tabular}{l cc ccc}
\toprule
& Mean at && \multicolumn{3}{c}{Difference-in-Differences Estimates} \\
\cmidrule{4-6}
& $ t=-1 $ &&\multicolumn{1}{c}{1 Year} & \multicolumn{1}{c}{2 Years} & \multicolumn{1}{c}{3 Years} \\
\cmidrule{2-2} \cmidrule{4-6}
& \multicolumn{1}{c}{(1)} &&\multicolumn{1}{c}{(2)} & \multicolumn{1}{c}{(3)} & \multicolumn{1}{c}{(4)} \\
\cmidrule{2-6}
Outcome 1 & 2.58 && 0.11 &0.08 &\marktopleft{a1} 0.12\\
& (2.55) && (0.04) & (0.04) & (0.04)\\
Outcome 2 & 60.90 && -0.73 &-1.13 & -1.58\\
& (17.02) && (0.10) & (0.11) & (0.12)\markbottomright{a1}{red} \\
Outcome 3 & 18.98 && 0.77 &1.28 & 1.62\\
& (6.74) && (0.13) & (0.13) & (0.12)\\
\bottomrule
\end{tabular}
}
\uncover<2->{\tikz[overlay,remember picture,inner sep=1pt]
\node[draw=red,rounded corners,fit=(marker-a1-a.north west) (marker-a1-b.south east)] {};}
\end{frame}
\begin{frame}{Highlight the minimum cost cell using tikz (Slide 2)}
\begin{itemize}[<alert@+|+->]
\item[] \begin{table}
\centering
\resizebox{\linewidth}{!}{
\begin{tabular}{ c | c | c | c | c | c }
\toprule
Order quantity & Unit price & Annual OC & Annual HC & Annual product cost & Total annual cost\\
\midrule
840 & \uncover<+->{$\$0.85$} & \uncover<+->{10} & \uncover<+->{30} & \uncover<+->{50} & \uncover<+->{\$3686} \\
\midrule
1000 & \uncover<+->{$\$0.80$} & \uncover<+->{20} & \uncover<+->{40} & \uncover<+->{45} & \uncover<+->{ \marktopleft{a1} \$3480 \markbottomright{a1}{red}} \\
\bottomrule
\end{tabular}
}
\end{table}
\end{itemize}
\uncover<+->{\tikz[overlay,remember picture,inner sep=1pt]
\node[draw=red,rounded corners,fit=(marker-a1-a.north west) (marker-a1-b.south east)] {};}
\end{frame}
\end{document}
答案1
您可以使用该hf-tikz
包来突出显示某些覆盖层上的数字:
\documentclass[11pt, aspectratio=169]{beamer}
\usepackage{booktabs}
\usepackage{tikz}
\usepackage[beamer,customcolors]{hf-tikz}
\hfsetfillcolor{bg}
\hfsetbordercolor{red}
\begin{document}
\begin{frame}
\frametitle{Highlight the minimum cost cell using tikz (Slide 2)}
\scriptsize
\begin{tabular}{cccccc}
\toprule
Order quantity & Unit price & Annual OC & Annual HC & Annual product cost & Total annual cost\\
\midrule
840 & $\$0.85$ & 10 & 30 & 50 & \tikzmarkin<0>{a}\$3686\tikzmarkend{a} \\
\midrule
1000 & $\$0.80$ & 20 & 40 & 45 & \tikzmarkin<2->{b}\$3480\tikzmarkend{b} \\
\bottomrule
\end{tabular}
\end{frame}
\end{document}