\tikzmarkin 没有突出显示表格中的整行(beamer)

\tikzmarkin 没有突出显示表格中的整行(beamer)

由于某种原因,当我尝试使用 \tikzmarkin 突出显示表格行时,最后一个字符未包含在突出显示中。请参阅下面的示例。

\documentclass[notes,11pt, aspectratio=169]{beamer}
\usepackage{graphicx}
\usepackage{lmodern}
\usepackage[beamer,customcolors]{hf-tikz}
\usepackage{tabularx}
\usepackage{beamerthemesplit}
\usepackage{amsmath,amssymb}
\usepackage{setspace}
\usepackage{booktabs}
\usepackage{tikz}
\usetheme{Warsaw}
\definecolor{UFblue}{rgb}{0, 0.33, 1.65}
\definecolor{UForange}{rgb}{2.5, 0.70, 0.22}
\beamertemplatenavigationsymbolsempty
\setbeamercolor{palette primary}{bg=UFblue,fg=white}
\setbeamercolor{palette secondary}{bg=UFblue,fg=white}
\setbeamercolor{palette tertiary}{bg=UFblue,fg=white}
\setbeamercolor{palette quaternary}{bg=UFblue,fg=white}
\setbeamercolor{structure}{fg=UFblue} % itemize, enumerate, etc
\setbeamercolor{section in toc}{fg=UFblue} % TOC sections
\expandafter\def\expandafter\insertshorttitle\expandafter{%
    \insertshorttitle\hfill%
    \insertframenumber\,/\,\inserttotalframenumber}
\setbeamercolor{subsection in head/foot}{bg=UForange,fg=white}
\useoutertheme[subsection=false]{smoothbars}
\tikzset{hl/.style={
        set fill color=orange!25,
        set border color=orange,
    },
}
\setbeamertemplate{frametitle}[default][colsep=-4bp,rounded=false,shadow=false]
\setbeamertemplate{title page}[default][colsep=-4bp,rounded=false,shadow=false]

\begin{document}
        
        \frame{\frametitle{Results}
    \begin{table}\centering
        \makebox[0pt]{\resizebox{\textheight}{!}{           
                \begin{tabular}{lccccc}
                    \toprule
                    &(1)                &(2)            &(3)        &Predicted  &Predicted \\
                    &                   &               &           & sign, SQ  & sign, MO \\
                    \midrule
                    \tikzmarkin<2>[hl]{a}$\sigma$       &   2258.0         &    832.9       &   -324.9 & $<0$ & $\lessgtr 0$\\
                    & (2446.0)         & (1859.7)       & (3143.5) &        &\tikzmarkend{a}\\
                    \addlinespace
                    \tikzmarkin<3>[hl]{b}$\lambda$      &   -721.4\textsuperscript{**} &   -488.8\textsuperscript{**} &   -183.4   & $<0$ & $>0$\\
                    &  (305.7)                     &  (228.3)                     &  (349.4)   &      &\tikzmarkend{b}\\
                    \addlinespace 
                    
                    $\alpha$        &   2333.3         &   2305.5         &   2278.0   & &       \\
                    & (3266.5)         & (3471.3)         & (3492.5)   & &      \\
                    \addlinespace
                    \tikzmarkin<4>[hl]{c}HBR        &                  &  -4036.0\textsuperscript{*}&  -2458.3 & $<0$   & $<0$ \\
                    &                  & (1961.5)                   & (2194.7) &        &\tikzmarkend{c}\\
                    \addlinespace
                    
                    \tikzmarkin<5>[hl]{d}HBR x $\sigma$ &                  &                  &   1877.4 & $>0$ & $>0$ \\
                    &                  &                  & (3845.9) &      & \tikzmarkend{d}\\
                    \addlinespace
                    \tikzmarkin<6>[hl]{e}HBR x $\lambda$    &                  &                  &   -526.0 & $<0$ & $<0$  \\
                    &                  &                  &  (423.7) &      &\tikzmarkend{e} \\
                    
                    \midrule
                    Observations            &     1,666        &     1,666       &     1,666  & &      \\
                    R-squared               &    0.474         &    0.445        &    0.446   & &      \\
                    \bottomrule
                \end{tabular}
        }}
    \end{table}
}
\end{document}

答案1

您需要将其放置\tikzmarkend{a}在内容之后(右侧)。您可以使用\phantom{...}它使单元格与上面的单元格一样宽。

\documentclass[notes,11pt, aspectratio=169]{beamer}
\usepackage{graphicx}
\usepackage{lmodern}
\usepackage[beamer,customcolors]{hf-tikz}
\usepackage{tabularx}
\usepackage{beamerthemesplit}
\usepackage{amsmath,amssymb}
\usepackage{setspace}
\usepackage{booktabs}
\usepackage{tikz}
\usetheme{Warsaw}
\definecolor{UFblue}{rgb}{0, 0.33, 1.65}
\definecolor{UForange}{rgb}{2.5, 0.70, 0.22}
\beamertemplatenavigationsymbolsempty
\setbeamercolor{palette primary}{bg=UFblue,fg=white}
\setbeamercolor{palette secondary}{bg=UFblue,fg=white}
\setbeamercolor{palette tertiary}{bg=UFblue,fg=white}
\setbeamercolor{palette quaternary}{bg=UFblue,fg=white}
\setbeamercolor{structure}{fg=UFblue} % itemize, enumerate, etc
\setbeamercolor{section in toc}{fg=UFblue} % TOC sections
\expandafter\def\expandafter\insertshorttitle\expandafter{%
    \insertshorttitle\hfill%
    \insertframenumber\,/\,\inserttotalframenumber}
\setbeamercolor{subsection in head/foot}{bg=UForange,fg=white}
\useoutertheme[subsection=false]{smoothbars}
\tikzset{hl/.style={
        set fill color=orange!25,
        set border color=orange,
    },
}
\setbeamertemplate{frametitle}[default][colsep=-4bp,rounded=false,shadow=false]
\setbeamertemplate{title page}[default][colsep=-4bp,rounded=false,shadow=false]

\begin{document}
        
        \frame{\frametitle{Results}
    \begin{table}\centering
        \makebox[0pt]{\resizebox{\textheight}{!}{           
                \begin{tabular}{lccccc}
                    \toprule
                    &(1)                &(2)            &(3)        &Predicted  &Predicted \\
                    &                   &               &           & sign, SQ  & sign, MO \\
                    \midrule
                    \tikzmarkin<2>[hl]{a}$\sigma$       &   2258.0         &    832.9       &   -324.9 & $<0$ & $\lessgtr 0$\\
                    & (2446.0)         & (1859.7)       & (3143.5) &        &\phantom{$\lessgtr 0$}\tikzmarkend{a}\\
                    \addlinespace
                    \tikzmarkin<3>[hl]{b}$\lambda$      &   -721.4\textsuperscript{**} &   -488.8\textsuperscript{**} &   -183.4   & $<0$ & $>0$\\
                    &  (305.7)                     &  (228.3)                     &  (349.4)   &      &\phantom{$>0$}\tikzmarkend{b}\\
                    \addlinespace 
                    
                    $\alpha$        &   2333.3         &   2305.5         &   2278.0   & &       \\
                    & (3266.5)         & (3471.3)         & (3492.5)   & &      \\
                    \addlinespace
                    \tikzmarkin<4>[hl]{c}HBR        &                  &  -4036.0\textsuperscript{*}&  -2458.3 & $<0$   & $<0$ \\
                    &                  & (1961.5)                   & (2194.7) &        &\phantom{$<0$}\tikzmarkend{c}\\
                    \addlinespace
                    
                    \tikzmarkin<5>[hl]{d}HBR x $\sigma$ &                  &                  &   1877.4 & $>0$ & $>0$ \\
                    &                  &                  & (3845.9) &      &\phantom{ $>0$}\tikzmarkend{d}\\
                    \addlinespace
                    \tikzmarkin<6>[hl]{e}HBR x $\lambda$    &                  &                  &   -526.0 & $<0$ & $<0$  \\
                    &                  &                  &  (423.7) &      &\phantom{ $<0$}\tikzmarkend{e} \\
                    
                    \midrule
                    Observations            &     1,666        &     1,666       &     1,666  & &      \\
                    R-squared               &    0.474         &    0.445        &    0.446   & &      \\
                    \bottomrule
                \end{tabular}
        }}
    \end{table}
}
\end{document}

带有突出显示行的表格

相关内容