# \textheight in LaTeX does not correspond to the size of the frame when using \resizebox

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> {
}
\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}


-

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.

\documentclass{beamer}

\mode<presentation> {
}
\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 & last \\
\end{tabular}% <-- Notice the missing %
}
\end{frame}

\end{document}


-
\resizebox*{!}{\dimexpr\textheight-\lineskip\relax}{% ? –  David Carlisle Sep 5 '13 at 12:33
Than you. The switching of the height and the width was of course a mistake in my working example. Thank you for the clarification of the table. It made it clear to me why it didn't work for tables. –  Siv Sep 5 '13 at 13:55