2

I would like to use the resize function from thegraphicx package to fit a large threeparttable into a beamer presentation, however I can't seem to get code from examples that you use tabular environments to work. Using the following code:

\documentclass{beamer}
\usepackage{graphicx}
\usepackage{booktabs}
 \usepackage{graphicx,threeparttable,caption}

\begin{document}

\begin{frame}
\begin{table}[h!] \small
\begin{threeparttable}
\caption{\textbf{Descriptive Statistics} \label{tab:descriptivestats}}
    \begin{tabular}{  p{3.5cm} p{1.0cm} p{1.0cm}  p{1.0cm} p{1.0cm} p{1.0cm}}
    \hline
\textbf{Var} & \textbf{Min} & \textbf{Max} & \textbf{Mean} & \textbf{SD} & \textit{N} \\ 
    \hline
  \hline
   XYZ & 0 & 1 & 2 & 3 & 4 \\ 
   XYZ & 0 & 1 & 2 & 3 & 4 \\ 
   XYZ & 0 & 1 & 2 & 3 & 4 \\ 
   XYZ & 0 & 1 & 2 & 3 & 4 \\ 
   XYZ & 0 & 1 & 2 & 3 & 4 \\ 
   XYZ & 0 & 1 & 2 & 3 & 4 \\ 
   XYZ & 0 & 1 & 2 & 3 & 4 \\ 
   XYZ & 0 & 1 & 2 & 3 & 4 \\ 
   XYZ & 0 & 1 & 2 & 3 & 4 \\ 
   XYZ & 0 & 1 & 2 & 3 & 4 \\ 
   XYZ & 0 & 1 & 2 & 3 & 4 \\ 
   XYZ & 0 & 1 & 2 & 3 & 4 \\ 
   XYZ & 0 & 1 & 2 & 3 & 4 \\ 
   XYZ & 0 & 1 & 2 & 3 & 4 \\ 
   XYZ & 0 & 1 & 2 & 3 & 4 \\ 
   XYZ & 0 & 1 & 2 & 3 & 4 \\ 
   XYZ & 0 & 1 & 2 & 3 & 4 \\ 
   XYZ & 0 & 1 & 2 & 3 & 4 \\ 
   XYZ & 0 & 1 & 2 & 3 & 4 \\ 
  \hline
  \hline
\end{tabular}
   \begin{tablenotes}
      \footnotesize
     \item \textbf{Note:}  XYZ 
    \end{tablenotes}
\end{threeparttable}
\end{table}
\end{frame}

\end{document}

Any thoughts on how to get this to fit, using resize or another command?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
coding_heart
  • 1,245
  • 3
  • 25
  • 46
  • Hi! If the answer below was a valid solution for you, mark it as accepted. Otherwise post some further details in a comment. – MattAllegro Jan 07 '16 at 22:14

1 Answers1

1

One first possible solution is to use \tiny instead of \small: it makes the job in this specific case, despite it may be puzzling to manage if you have more than one such matrices in your document.

The second way (reference) is probably more appropriate and systematic:

\documentclass{beamer}
\usepackage{graphicx}
\usepackage{booktabs}
\usepackage{graphicx,threeparttable,caption}

\begin{document}

\begin{frame}
  \begin{table}[h!]
    \resizebox{.75\textwidth}{!}{%% begins here
      \begin{threeparttable}

        %% contents of threeparttable

      \end{threeparttable}
    }%% ends here
  \end{table}
\end{frame}

\end{document}
Community
  • 1
  • 1
MattAllegro
  • 6,455
  • 5
  • 45
  • 52