I am trying to make a big table fit into a beamer slide. My table has 2 panels which are 2 tabularx
environments. My attempt involves one \resizebox
for each tabularx
environment (see code below).
If I put the 2 tabularx
in the same \resizebox
, then I get an error because I'm using \\ [0.3cm]
to have some space between the 2 panels. I'm wondering whether there exists a better solution than this.
Any help would be highly appreciated.
\documentclass{beamer}
\usepackage[english]{babel}
\usepackage{tabularx,booktabs,dcolumn}
\pdfmapfile{+sansmathaccent.map}
\newcolumntype{d}{D..{-1}}
\begin{document}
\begin{frame}
\frametitle{Title of my slide}
\begin{table}
\tiny
\begin{tabular}{c*{7}{d}}
\midrule
\multicolumn{1}{c}{$CCCCC$}
& \multicolumn{1}{c}{$CCCCC$}
& \multicolumn{1}{c}{$CCCC$}
& \multicolumn{1}{c}{$CCC$}
& \multicolumn{1}{c}{$CCCCCCC$}
& \multicolumn{1}{c}{$CCCCCC$}
& \multicolumn{1}{c}{$CCCCCC$}
& \multicolumn{1}{c}{$CCCCCCCCCCCCCC$}
\\
\midrule
\multicolumn{8}{c}{\textbf{Panel A: AAA}} \\
\midrule
0 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
& (0.00) & (0.00) & (0.00) & (0.00) & (0.00) & (0.00) & (0.00) \\
& & & & & & & \\
0 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
& (0.00) & (0.00) & (0.00) & (0.00) & (0.00) & (0.00) & (0.00) \\
& & & & & & & \\
0 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
& (0.00) & (0.00) & (0.00) & (0.00) & (0.00) & (0.00) & (0.00) \\
\end{tabular}
\vfill
\begin{tabular}{c*{7}{d}}
\multicolumn{8}{c}{\textbf{Panel B: BBB}} \\
\midrule
0 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
& (0.00) & (0.00) & (0.00) & (0.00) & (0.00) & (0.00) & (0.00) \\
& & & & & & & \\
0 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
& (0.00) & (0.00) & (0.00) & (0.00) & (0.00) & (0.00) & (0.00) \\
& & & & & & & \\
0 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
& (0.00) & (0.00) & (0.00) & (0.00) & (0.00) & (0.00) & (0.00) \\
\midrule
\end{tabular}
\end{table}
\end{frame}
\end{document}
`
to mark your inline code as I did in my edit.\\[0.3cm] % space between panels
is wrong. use\bigskip
or\vspace{.3cm}
or whatever\resizebox{8cm}{!} { \begin{tabularx}{\linewidth}
you are making tabularx force the table width to be\textwidth
then scaling it (and two word spaces) to 8cm? Why not set the table to the desired size without scaling?{ \tiny \begin{table}[htb] ... \end{table} }
group.