0

I am using Beamer and my slides will have many tables. Currently I have the following:

\documentclass[aspectratio=169, xcolor=dvipsnames]{beamer}
\author[]{bla bla bla}
\title{bla bla bla}
\usetheme{Boadilla}


\setbeamertemplate{caption}[numbered]
\usepackage{caption}
\captionsetup{skip=0pt,belowskip=-5pt}
\usepackage{booktabs}

% ---- Begin document ----
\begin{document}
\maketitle

\begin{frame}
\begin{table}

\caption{CAPM with local returns}
\centering
\resizebox{\linewidth}{!}{
\begin{tabular}[t]{lcccccccccccc}
\toprule
  & BusEquip & Chemicals & Durables & Energy & Finance & Health & Manufacturing & NonDurables & Other & Retail & Telecom & Utilities\\
\midrule
SPY Window & 1.05*** & 1.51*** & 0.38 & 2.25*** & 0.83 & 1.74*** & 1.21*** & 1.49*** & 1.53*** & 1.38*** & 0.93* & 2.11***\\
 & (0.40) & (0.34) & (0.50) & (0.55) & (0.61) & (0.38) & (0.32) & (0.36) & (0.33) & (0.32) & (0.48) & (0.47)\\
Surprise & 0.31 & 0.17 & 0.18 & 0.46 & 0.37 & 0.30* & 0.14 & 0.31* & 0.28 & 0.14 & 0.25 & 0.39*\\
 & (0.20) & (0.20) & (0.25) & (0.30) & (0.24) & (0.17) & (0.21) & (0.17) & (0.19) & (0.17) & (0.18) & (0.21)\\
Interaction & −0.37 & −0.96* & 0.56 & −1.55** & −0.34 & −1.29** & −0.35 & −0.97** & −0.87 & −0.75 & −0.56 & −1.48**\\
 & (0.62) & (0.54) & (0.83) & (0.64) & (1.02) & (0.54) & (0.66) & (0.48) & (0.62) & (0.62) & (0.66) & (0.66)\\
R2 & 0.077 & 0.088 & 0.055 & 0.092 & 0.027 & 0.120 & 0.087 & 0.123 & 0.085 & 0.088 & 0.046 & 0.133\\
R2 Adj. & 0.050 & 0.062 & 0.028 & 0.066 & −0.001 & 0.095 & 0.061 & 0.098 & 0.059 & 0.061 & 0.019 & 0.108\\
\bottomrule
\multicolumn{13}{l}{\rule{0pt}{1em}* p  0.1, ** p < 0.05, *** p < 0.01}\\
\end{tabular}}
\end{table}
\end{frame}

\begin{frame}
\begin{table}

\caption{CAPM with daily SPY returns}
\centering
\resizebox{\linewidth}{!}{
\begin{tabular}[t]{lcccccccccccc}
\toprule
  & BusEquip & Chemicals & Durables & Energy & Finance & Health & Manufacturing & NonDurables & Other & Retail & Telecom & Utilities\\
\midrule
SPY Daily & 0.64** & 0.83*** & 0.71*** & 1.03*** & 0.80*** & 0.84*** & 0.79*** & 0.66*** & 0.87*** & 0.74*** & 0.57** & 0.87***\\
 & (0.25) & (0.21) & (0.20) & (0.31) & (0.22) & (0.23) & (0.23) & (0.21) & (0.19) & (0.17) & (0.22) & (0.29)\\
Surprise & 0.22 & 0.04 & 0.16 & 0.24 & 0.30** & 0.14 & 0.03 & 0.16 & 0.15 & 0.01 & 0.17 & 0.19\\
 & (0.15) & (0.13) & (0.16) & (0.22) & (0.14) & (0.11) & (0.12) & (0.12) & (0.11) & (0.11) & (0.12) & (0.15)\\
SPY daily:Surprise & 0.39 & 0.21 & 0.82*** & 0.27 & 0.80*** & −0.02 & 0.51** & 0.16 & 0.38* & 0.33* & 0.35 & 0.07\\
 & (0.26) & (0.22) & (0.23) & (0.28) & (0.28) & (0.24) & (0.24) & (0.22) & (0.22) & (0.18) & (0.24) & (0.30)\\
R2 & 0.598 & 0.702 & 0.723 & 0.559 & 0.711 & 0.608 & 0.768 & 0.638 & 0.784 & 0.701 & 0.596 & 0.521\\
R2 Adj. & 0.586 & 0.694 & 0.715 & 0.546 & 0.703 & 0.597 & 0.761 & 0.627 & 0.778 & 0.692 & 0.585 & 0.507\\
\bottomrule
\multicolumn{13}{l}{\rule{0pt}{1em}* p < 0.1, ** p < 0.05, *** p < 0.01}\\
\end{tabular}}
\end{table}

\end{frame}

\begin{frame}
\begin{table}

\caption{Industry Regressions: BusEquip}
\centering
\fontsize{9}{11}\selectfont
\begin{tabular}[t]{lccccccccc}
\toprule
  & BK & NS & BK + NS & FFR & FG & LSAP & JME & Only MP & All\\
\midrule
SPY Window & 0.73 & 0.53 & 0.55 & 0.82* & 0.53 & 0.67 & 0.58 &  & 0.71\\
 & (0.45) & (0.58) & (0.57) & (0.42) & (0.50) & (0.42) & (0.55) &  & (0.47)\\
BK & 0.04 &  & 0.12 &  &  &  &  & −0.47 & −0.66\\
 & (0.22) &  & (0.22) &  &  &  &  & (0.51) & (0.50)\\
NS &  & −0.13 & −0.20 &  &  &  &  & 0.05 & 0.07\\
 &  & (0.19) & (0.21) &  &  &  &  & (0.48) & (0.44)\\
FFR &  &  &  & 0.13 &  &  & 0.10 & 0.43 & 0.71\\
 &  &  &  & (0.23) &  &  & (0.23) & (0.71) & (0.70)\\
FG &  &  &  &  & −0.22 &  & −0.22 & −0.32 & −0.22\\
 &  &  &  &  & (0.20) &  & (0.20) & (0.44) & (0.40)\\
LSAP &  &  &  &  &  & −0.08 & −0.13 & −0.16 & −0.14\\
 &  &  &  &  &  & (0.09) & (0.10) & (0.14) & (0.13)\\
R2 & 0.063 & 0.072 & 0.080 & 0.073 & 0.095 & 0.066 & 0.112 & 0.097 & 0.141\\
R2 Adj. & 0.045 & 0.054 & 0.053 & 0.055 & 0.078 & 0.049 & 0.078 & 0.053 & 0.090\\
\bottomrule
\multicolumn{10}{l}{\rule{0pt}{1em}* p < 0.1, ** p < 0.05, *** p < 0.01}\\
\end{tabular}
\end{table}
    
\end{frame}
\end{document}

I want to globally control the space between the table captions and the tables themselves. I am uisng the caption package and trying to perform this control with \captionsetup{skip=0pt,belowskip=-5pt} as you can see above.

The problem is that the spacing is not consistent across tables, as one can see here:

enter image description here

I want the behavior of Table 3 everywhere. Table 1 and 2 are not like that (their captions are way higher than the other one) because of \resizebox{\linewidth} being called. I don't understand resizebox very well (these tables were generated by kable in R). My understanding is that it is somewhat breaking the global adjustment.

What is the best way to make the behavior consistent? For reference, I am compiling with XeLaTex.

2
  • If you use \hrule\fbox{...} around the tabulars, the \hrule shows up where you expect it but the \fbox{} is separated by a variable sized gap. This must be peculiar to beamer, but I don't see how they can do it. Commented Jan 16, 2022 at 17:01
  • If you place the table contents (including the \caption) inside a minipage {\linewidth} it will behave normally. Commented Jan 16, 2022 at 17:11

1 Answer 1

2

I would not use \resizebox, rather reduce font size and column separation in table. Also for numbers in table use of S columns gives nicer looking table.

Edit: From MWE in question are added the last two frames:

\documentclass[aspectratio=169, xcolor=dvipsnames]{beamer}
\usetheme{Boadilla}
\setbeamertemplate{caption}[numbered]
%
\usepackage{tabularray}
\UseTblrLibrary{booktabs, siunitx}
\SetTblrStyle{caption}{font=\footnotesize}
\SetTblrStyle{caption-tag}{font=\bfseries, blue3}
  \ExplSyntaxOn
\NewChildSelector{eachtwo}
  {
    \int_step_inline:nnnn {2}{2}{\l_tblr_childs_total_tl}
      { \clist_put_right:Nn \l_tblr_childs_clist {##1} }
  }
\ExplSyntaxOff
\sisetup{table-format=-1.3{***},
         table-align-text-pre=false,
         table-align-text-post=false,
         input-close-uncertainty=,
         input-open-uncertainty=
         }

\author[]{bla bla bla}
\title{bla bla bla}

% ---- Begin document ----
\begin{document}
\maketitle

\begin{frame}
    \begin{table}
\centering
\tiny
\begin{talltblr}[
caption = {CAPM with local returns},
  label = {tab:talltblr-1},
remark{Note} = {Standard errors in parentheses:\quad
                *: $p < 0.1$, **: $p < 0.05$, ***: $p < 0.01$},
                ]{colsep = {1pt},
                row{2-Z} = {rowsep=0pt},
            row{eachtwo} = {abovesep=1ex},
             }   
    \toprule
    & {{{BusEquip}}}    & {{{Chemicals}}}   & {{{Durables}}}        & {{{Energy}}} 
    & {{{Finance}}}     & {{{Health}}}      & {{{Manufacturing}}}   & {{{NonDurables}}}
    & {{{Other}}}       & {{{Retail}}}      & {{{Telecom}}}         & {{{Utilities}}}\\
    \midrule
SPY Window 
SPY Window 
    & 1.05*** & 1.51*** & 0.38    & 2.25*** & 0.83   & 1.74*** 
    & 1.21*** & 1.49*** & 1.53*** & 1.38*** & 0.93*  & 2.11***  \\
    & (0.40)  & (0.34)  & (0.50)  & (0.55)  & (0.61) & (0.38) 
    & (0.32)  & (0.36)  & (0.33)  & (0.32)  & (0.48) & (0.47)   \\
Surprise 
    & 0.31    & 0.17    & 0.18    & 0.46    & 0.37   & 0.30* 
    & 0.14    & 0.31*   & 0.28    & 0.14    & 0.25   & 0.39*    \\
    & (0.20)  & (0.20)  & (0.25)  & (0.30)  & (0.24) & (0.17) 
    & (0.21)  & (0.17)  & (0.19)  & (0.17)  & (0.18) & (0.21)   \\
Interaction 
    & −0.37   & −0.96*  & 0.56    & −1.55** & −0.34  & −1.29** 
    & −0.35   & −0.97** & −0.87   & −0.75   & −0.56  & −1.48**  \\
    & (0.62)  & (0.54)  & (0.83)  & (0.64)  & (1.02) & (0.54) 
    & (0.66)  & (0.48)  & (0.62)  & (0.62)  & (0.66) & (0.66)   \\
R2  & 0.077   & 0.088   & 0.055   & 0.092   & 0.027  & 0.120 
    & 0.087   & 0.123   & 0.085   & 0.088   & 0.046  & 0.133    \\
R2 Adj. 
    & 0.050   & 0.062   & 0.028   & 0.066   & −0.001 & 0.095 
    & 0.061   & 0.098   & 0.059   & 0.061   & 0.019  & 0.108    \\
\bottomrule
\multicolumn{13}{l}{\rule{0pt}{1em}* p  0.1, ** p < 0.05, *** p < 0.01}\\
\end{tblr}
    \end{table}
\end{frame}

\begin{frame}
    \begin{table}
\centering
\tiny
\begin{talltblr}[
caption = {CAPM with daily SPY returns},
  label = {tab:talltblr-2},
remark{Note} = {Standard errors in parentheses:\quad
                *: $p < 0.1$, **: $p < 0.05$, ***: $p < 0.01$},
                ]{colsep = {1pt},
                 colspec = {@{} Q[l,m] *{12}{X[c, si]} @{}},
                row{2-Z} = {rowsep=0pt},
            row{eachtwo} = {abovesep=1ex},
                 }
    \toprule
    & {{{BusEquip}}}    & {{{Chemicals}}}   & {{{Durables}}}        & {{{Energy}}}
    & {{{Finance}}}     & {{{Health}}}      & {{{Manufacturing}}}   & {{{NonDurables}}}
    & {{{Other}}}       & {{{Retail}}}      & {{{Telecom}}}         & {{{Utilities}}}\\
    \midrule
SPY Daily 
    & 0.64**  & 0.83*** & 0.71*** & 1.03*** & 0.80*** & 0.84*** 
    & 0.79*** & 0.66*** & 0.87*** & 0.74*** & 0.57**  & 0.87*** \\
    & (0.25)  & (0.21)  & (0.20)  & (0.31)  & (0.22)  & (0.23) 
    & (0.23)  & (0.21)  & (0.19)  & (0.17)  & (0.22)  & (0.29)  \\
Surprise 
    & 0.22    & 0.04    & 0.16    & 0.24    & 0.30**  & 0.14 
    & 0.03    & 0.16    & 0.15    & 0.01    & 0.17    & 0.19    \\
    & (0.15)  & (0.13)  & (0.16)  & (0.22)  & (0.14)  & (0.11) 
    & (0.12)  & (0.12)  & (0.11)  & (0.11)  & (0.12)  & (0.15)  \\
{SPY daily:\\ Surprise} 
    & 0.39    & 0.21    & 0.82*** & 0.27    & 0.80*** & −0.02 
    & 0.51**  & 0.16    & 0.38*   & 0.33*   & 0.35    & 0.07    \\
    & (0.26)  & (0.22)  & (0.23)  & (0.28)  & (0.28)  & (0.24) 
    & (0.24)  & (0.22)  & (0.22)  & (0.18)  & (0.24)  & (0.30)  \\
R2  & 0.598   & 0.702   & 0.723   & 0.559   & 0.711   & 0.608 
    & 0.768   & 0.638   & 0.784   & 0.701   & 0.596   & 0.521   \\
R2 Adj. 
    & 0.586   & 0.694   & 0.715   & 0.546   & 0.703   & 0.597 
    & 0.761   & 0.627   & 0.778   & 0.692   & 0.585   & 0.507   \\
    \bottomrule
\end{talltblr}
   \end{table}
\end{frame}

\begin{frame}
    \begin{table}
\centering
\tiny
\begin{talltblr}[
caption = {CAPM with daily SPY returns},
  label = {tab:talltblr-1},
remark{Note} = {Standard errors in parentheses:\quad
                *: $p < 0.1$, **: $p < 0.05$, ***: $p < 0.01$},
                ]{colsep = {3pt},
                 colspec = {@{} l *{9}{X[c, si]} @{}},
                row{2-Z} = {rowsep=0pt},
            row{eachtwo} = {abovesep=1ex},
                 }
    \toprule
    & {{{BK}}}  & {{{NS}}}      & {{{BK + NS}}} & {{{FFR}}} 
    & {{{FG}}}  & {{{LSAP}}}    & {{{JME}}}     & {{{Only MP}}} 
    & {{{All}}} \\
    \midrule
SPY Window 
    & 0.73    & 0.53    & 0.55    & 0.82*   & 0.53    & 0.67 
    & 0.58    &         & 0.71      \\
    & (0.45)  & (0.58)  & (0.57)  & (0.42)  & (0.50)  & (0.42) 
    & (0.55)  &         & (0.47)    \\
BK  & 0.04    &         & 0.12    &         &         &  
    &         & −0.47   & −0.66     \\
    & (0.22)  &         & (0.22)  &         &         &  
    &         & (0.51)  & (0.50)    \\
NS  &         & −0.13   & −0.20   &         &         &  
    &         & 0.05    & 0.07      \\
    &         & (0.19)  & (0.21)  &         &         &  
    &         & (0.48)  & (0.44)    \\
FFR &         &         &         & 0.13    &         &  
    & 0.10    & 0.43    & 0.71      \\
    &         &         &         & (0.23)  &         &  
    & (0.23)  & (0.71)  & (0.70)    \\
FG  &         &         &         &         & −0.22   &  
    & −0.22   & −0.32   & −0.22     \\
    &         &         &         &         & (0.20)  &  
    & (0.20)  & (0.44)  & (0.40)    \\
LSAP 
    &         &         &         &         &         & −0.08 
    & −0.13   & −0.16   & −0.14     \\
    &         &         &         &         &         & (0.09) 
    & (0.10)  & (0.14)  & (0.13)    \\
R2  & 0.063   & 0.072   & 0.080   & 0.073   & 0.095   & 0.066 
    & 0.112   & 0.097   & 0.141     \\
R2 Adj. 
    & 0.045   & 0.054   & 0.053   & 0.055   & 0.078   & 0.049 
    & 0.078   & 0.053   & 0.090     \\
    \bottomrule
\end{talltblr}
    \end{table}
\end{frame}
\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .