投影机阴影柱和突出显示额外

投影机阴影柱和突出显示额外

我希望中间两列的背景为灰色(常量),顶部覆盖一个方块以突出显示特定内容(只需在某个时刻输入)。以下是我想要的示例 - 数字与我的 MVE 不同。

    \documentclass{beamer}
\usepackage[utf8]{inputenc}
\usepackage{psfrag}
\usepackage{tikz}
\usetikzlibrary{intersections,patterns,pgfplots.fillbetween}
\usetikzlibrary{decorations.pathreplacing}
\usepackage{booktabs, dcolumn}
\usepackage{fontawesome}
\usetheme{CambridgeUS}
\usecolortheme{seahorse}
\usepackage{multirow}
\usepackage{hyperref}
\usepackage{pgfplots}
\usepgfplotslibrary{dateplot}
\usepackage{datetime}
\usepackage[scale=2]{ccicons}
\newdateformat{monthyeardate}{%
  \monthname[\THEMONTH], \THEYEAR}
\usepackage{animate}
%\usepackage{colortbl}
\usepackage[beamer,customcolors]{hf-tikz}
\usetikzlibrary{calc}
\title{beamer}
% To set the highlighting boxes red.
\tikzset{%
    hl/.style={
align=center,
set fill color=white,
    set border color=red,
 right offset={0.35,-0.2},
  },
hl2/.style={
align=center,
set fill color=gray!10,
    set border color = white,
right offset={0.35,-0.2},
  },
}


\begin{document}

\maketitle

\begin{frame}
\begin{table}
    \centering
\begin{tabular}{l*{6}{c}}
\toprule
                   & \multicolumn{2}{c}{x} & \tikzmarkin<1->[hl2]{c} \multicolumn{2}{c}{y} & \multicolumn{2}{c}{555} \\
                  \cmidrule(r){2-3} \cmidrule(r){4-5} \cmidrule(r){6-7} &\multicolumn{1}{c}{Probit}&\multicolumn{1}{c}{Heckman Prob}&\multicolumn{1}{c}{Probit}&\multicolumn{1}{c}{Heckman Prob}&\multicolumn{1}{c}{Probit}&\multicolumn{1}{c}{Heckman Prob}\\
                  & (1) & (2) & (3) & (4) & (5) &(6) \\

\midrule
wwwww &      75  &    85   &      850  &      980&    00   &       800\\
                    &    80   &    1400   &    250  &    70 &    199   &   60   \\

\multicolumn{7}{l}{cccccccccccccccc} \\                    
1                   &  \tikzmarkin<2>[hl]{bH5}   50 &      30 &    40 &     10 \tikzmarkend{c}\tikzmarkend{bH5} &      20       5\\
\end{tabular}
\end{table}
\end{frame}
\end{document}

在此处输入图片描述

答案1

作为起点:使用tikzmark库(最新版本)。从序言中删除未使用的包并注释其他包后,这些包beamer姆韦(最小工作示例)是:

\documentclass[xcolor=table]{beamer}
\usetheme{CambridgeUS}
\usecolortheme{seahorse}
%\usepackage[utf8]{inputenc}    % default at recent version of document classes
%\usepackage{psfrag}
\usepackage{fontawesome}
\usepackage{tikz}
\usetikzlibrary{fit,            % new
                tikzmark}       % new
\usepackage{booktabs,
            cellspace,          % new
            multirow}
\setlength\cellspacetoplimit{4pt}
\setlength\cellspacebottomlimit{4pt}
%\addparagraphcolumntypes{X}  % in case of use tabularx

%\usepackage{multirow} doesn't exist
%\usepackage{hyperref} loaded by beamer
%\usepackage{colortbl} loaded by beamer option "xcolor=table"

\begin{document}
%\maketitle

\begin{frame}
\begin{table}
    \centering
    \renewcommand{\aboverulesep}{0pt}
    \renewcommand{\belowrulesep}{0pt}
\begin{tabular}{l cc
    >{\columncolor{gray!30}}Sc
    >{\columncolor{gray!30}}Sc
                cc}
\toprule
        & \multicolumn{2}{c}{x}
                & \multicolumn{2}{c}{\cellcolor{gray!30}{y}}
                        & \multicolumn{2}{c}{555}
                        \\
        \cmidrule(r){2-3} \cmidrule{4-5} \cmidrule(l){6-7}
        & Probit    & HP    &  Probit   & HP    & Probit    & HP    \\
        & (1)       & (2)   & (3)       & (4)   & (5)       & (6)   \\
\midrule
wwwww   & 75        & 85    & 850       & 980   & 00        & 800   \\
        & 80        & 1400  & 250       & 70    & 199       & 60    \\
\multicolumn{3}{l}{cccccccccccccccc}
                            &           &       &           &       \\
1       &  \tikzmarknode{a}{50}
                    &       &    40     & 10    & \tikzmarknode{b}{20}
                                                            & 5      \\
    \midrule[\heavyrulewidth]
\multicolumn{7}{l}{HP: Heckman Prob}
\end{tabular}
\end{table}
    \begin{tikzpicture}[overlay,remember picture]
\node[draw=red, thick, inner sep=2pt, rounded corners, fit=(a) (b)] {};
    \end{tikzpicture}
\end{frame}
\end{document}

经过两次编译后得到:

在此处输入图片描述

答案2

{NiceTabular}这是使用进行此类表格制作的一种方法nicematrix。您需要进行多次编译。

\documentclass{beamer}
\usetheme{CambridgeUS}
\usecolortheme{seahorse}
\usepackage{fontawesome}

\usepackage{nicematrix}

\usepackage{tikz}
\usetikzlibrary{fit}

\usepackage{booktabs}

\begin{document}

\begin{frame}
\begin{table}
\centering
\renewcommand{\arraystretch}{1.2}
\begin{NiceTabular}{lcccccc}[tabularnote = HP: Heckman Prob]
\CodeBefore
  \columncolor{gray!30}{4,5}
\Body
  \toprule
          & \Block{1-2}{x} && \Block{1-2}{y} && \Block{1-2}{555} \\
          \cmidrule(r){2-3} \cmidrule{4-5} \cmidrule(l){6-7}
          & Probit    & HP    &  Probit   & HP    & Probit    & HP    \\
          & (1)       & (2)   & (3)       & (4)   & (5)       & (6)   \\
  \midrule
  wwwww   & 75        & 85    & 850       & 980   & 00        & 800   \\
          & 80        & 1400  & 250       & 70    & 199       & 60    \\
  \rlap{cccccccccccccccc} \\
  1       & 50 &      & 40    & 10        & 20    & 5      \\
  \bottomrule
\CodeAfter
  \tikz \node[draw=red, thick, inner sep = 2pt, rounded corners, fit=(7-2) (7-6)] {} ;
\end{NiceTabular}
\end{table}
\end{frame}
\end{document}

上述代码的输出

相关内容