I am trying to add a table to my Beamer presentation and is trying to resize it to the frame. To illustrate here is a working example where the table is originally too high to fit into the page. When I use \textheight
to determine the height of the \resizebox
it is still way outside the frame and it only comes into the frame whenever I use a fraction of \textheight
as the command. What I am doing wrong or how is the height of the beamer page determined? Is there another command that will give me the frame size to determine the resizing? Have added a picture to show. The example is just for simplicity and showing that it happens for me even with the simplest setup possible.
\documentclass{beamer}
\mode<presentation> {
\usetheme{Boadilla}
}
\begin{document}
\begin{frame}
\resizebox{\textheight}{!}{%
\begin{tabular}{ccc}
& something & anything \\
Yes & 10 & 20 \\
No & 55 & 4 \\
Yes & 10 & 20 \\
No & 55 & 4 \\
Yes & 10 & 20 \\
No & 55 & 4 \\
Yes & 10 & 20 \\
No & 55 & 4 \\
Yes & 10 & 20 \\
No & 55 & 4 \\
Yes & 10 & 20 \\
No & 55 & 4 \\
\end{tabular}
}%
\end{frame}
\end{document}
Best Answer
The first argument to
\resizebox
refers to the horizontal dimension (width) and the second one to the vertical dimension (height).However, a
tabular
also has a depth (that is, it extends below the baseline), so we need\resizebox*
in order to refer to the total height (height plus depth); I changed the last entry to show that the table fits completely.