# When I use [shrink], I lose vertical centering. How do I get my stuff shrunk and centered?

I am creating a beamer slide with a table on it. This table is too big with the normal font size, so I am using the shrink command to try to make it smaller.

shrink is working, however it is completely throwing off vertical centering. Rather than being vertically centered, my text is now all crammed up at the top of the slide. Could you please suggest a way to force it lower down the slide?

Here is the code for the frame:

\begin{frame}[shrink=35]{Correlations between Harm, Unfairness and Disgust}
\begin{center}
\begin{tabular}{lllllllll}
\multicolumn{8}{l}{\textbf{Table 3.} All possible regressions of harm, unfairness, and disgust predicting punishment} \\
\toprule
& M1 & M2 & M3 & M4 & M5 & M6 & M7 \\
\midrule
Harm & .35 (.01) & & & .20 (.15) & & .24 (.07) & .14 (.31) \\
Unfairness & & .41 (.01) & & .31 (.02) & .34 (.01) & & .28 (.04) \\
Disgust & & &.34 (.01) & & .23 (.07) & .25 (.05) & .19 (.13) \\
R^2 & .12 & .11 & .11 & .20 & .17 & .17 & .22 \\
\bottomrule
\multicolumn{8}{l}{Note: Standardized beta coefficients, with p value in parenthesis} \\
\end{tabular}
\end{center}
\end{frame}

-
Welcome to TeX.SE. While code snippets are useful in explanations, it is always best to compose a fully compilable MWE that illustrates the problem including the \documentclass and the appropriate packages so that those trying to help don't have to recreate it. –  Peter Grill Dec 5 '11 at 23:48
Thanks, Peter. I will make sure to do that in the future! –  evt Dec 6 '11 at 0:17

You could wrap the table in \resizebox from the graphicx package.

\documentclass{beamer}
\usepackage{booktabs}
\usepackage{graphicx} % loaded by beamer, but included here for explicitness
\begin{document}
\begin{frame}{Correlations between Harm, Unfairness and Disgust}
\begin{center}
\resizebox{\textwidth}{!}{%
\begin{tabular}{lllllllll}
\multicolumn{8}{l}{\textbf{Table 3.} All possible regressions of harm, unfairness, and disgust predicting punishment} \\
\toprule
& M1 & M2 & M3 & M4 & M5 & M6 & M7 \\
\midrule
Harm & .35 (.01) & & & .20 (.15) & & .24 (.07) & .14 (.31) \\
Unfairness & & .41 (.01) & & .31 (.02) & .34 (.01) & & .28 (.04) \\
Disgust & & &.34 (.01) & & .23 (.07) & .25 (.05) & .19 (.13) \\
R$^2$ & .12 & .11 & .11 & .20 & .17 & .17 & .22 \\
\bottomrule
\multicolumn{8}{l}{Note: Standardized beta coefficients, with p value in parenthesis} \\
\end{tabular}}
\end{center}
\end{frame}
\end{document}

-
This also worked great. Thanks. –  evt Dec 6 '11 at 2:37
You miss a % after {. –  Martin Scharrer Dec 6 '11 at 9:11

You can use a minipage with a predefined height and optional positioning arguments c to force vertical centering:

\documentclass{beamer}
\usepackage{booktabs}

\begin{document}

\begin{frame}[shrink=35]{Correlations between Harm, Unfairness and Disgust}

\begin{minipage}[c][1.3\paperheight][c]{\textwidth}
\centering
\begin{tabular}{lllllllll}
\multicolumn{8}{l}{\textbf{Table 3.} All possible regressions of harm, unfairness, and disgust predicting punishment} \\
\toprule
& M1 & M2 & M3 & M4 & M5 & M6 & M7 \\
\midrule
Harm & .35 (.01) & & & .20 (.15) & & .24 (.07) & .14 (.31) \\
Unfairness & & .41 (.01) & & .31 (.02) & .34 (.01) & & .28 (.04) \\
Disgust & & &.34 (.01) & & .23 (.07) & .25 (.05) & .19 (.13) \\
$R^{2}$ & .12 & .11 & .11 & .20 & .17 & .17 & .22 \\
\bottomrule
\multicolumn{8}{l}{Note: Standardized beta coefficients, with p value in parenthesis} \\
\end{tabular}
\end{minipage}
\end{frame}

\end{document}


-
Excellent. Thank you. –  evt Dec 6 '11 at 2:36

Rather than shrink or resize the entire tabular environment, which may render its real contents (the numbers) barely legible, it may be preferable to reduce the amount of inter-column whitespace selectively, by reducing the value of the macro \tabcolsep; the edited MWE below reduces its value from 6pt (the default) to about 4.5pt, while also setting the fontsize to \scriptsize. (In addition, I've taken the liberty of applying a few stylistic changes here and there, e.g., replacing \toprule and \bottomrule with \midrule[\heavyrulewidth] in order to get better spacing to the adjacent text, and a bit more vertical separation before the $R^2$ line. Finally, I've also replaced tabular with tabular* in order to get a table that occupies the full \textwidth.)

By the way, I can't help but remark on the fact that the frame's title includes the word "correlations", whereas the table's caption and legend refer to regression coefficients rather than correlation coefficients. Might this discrepancy cause some puzzlement or resistance among the members of your audience?

\documentclass{beamer}
\usepackage{booktabs}
\renewcommand{\tabcolsep}{4.45pt}
\begin{document}\scriptsize
\begin{frame}{Correlations between Harm, Unfairness and Disgust}

\begin{tabular*}{\textwidth}{@{}l@{\extracolsep{\fill}}*{7}{l}@{}}
\multicolumn{8}{@{}p{\textwidth}}{\textbf{Table 3.} All possible regressions
of harm, unfairness, and disgust predicting punishment} \\
\midrule[\heavyrulewidth]
& M1 & M2 & M3 & M4 & M5 & M6 & M7 \\
\midrule
Harm       & .35 (.01) & & & .20 (.15) & & .24 (.07) & .14 (.31) \\
Unfairness & & .41 (.01) & & .31 (.02) & .34 (.01) & & .28 (.04) \\
Disgust    & & &.34 (.01) & & .23 (.07) & .25 (.05) & .19 (.13) \\[1.5ex]
$R^2$      & .12 & .11 & .11 & .20 & .17 & .17 & .22 \\
\midrule[\heavyrulewidth]
\multicolumn{8}{@{}l}{Note: Standardized beta coefficients,
with p values in parentheses} \\
\end{tabular*}
\end{frame}
\end{document}


-

You can use \scalebox from the graphicx package to scale the text:

\documentclass{beamer}
\usepackage{multirow}
\usepackage{booktabs}
\usepackage{graphicx}

\begin{document}
\begin{frame}{Correlations between Harm, Unfairness and Disgust}
\centering\scalebox{0.7}{
\begin{tabular}{lllllllll}
\multicolumn{8}{l}{\textbf{Table 3.} All possible regressions of harm, unfairness, and disgust predicting punishment} \\
\toprule
& M1 & M2 & M3 & M4 & M5 & M6 & M7 \\
\midrule
Harm & .35 (.01) & & & .20 (.15) & & .24 (.07) & .14 (.31) \\
Unfairness & & .41 (.01) & & .31 (.02) & .34 (.01) & & .28 (.04) \\
Disgust & & &.34 (.01) & & .23 (.07) & .25 (.05) & .19 (.13) \\
$R^2$ & .12 & .11 & .11 & .20 & .17 & .17 & .22 \\
\bottomrule
\multicolumn{8}{l}{Note: Standardized beta coefficients, with p value in parenthesis} \\
\end{tabular}}
\end{frame}
\end{document}

-

Check the warning message you get when you compile. Adjust the shrinkage factor to match the information in the waring massage, compile again and Voila!

-
Please explaine a little better: how does the warning look, were is the factor I have to change in the message and in the code? –  Kurt Oct 9 '13 at 8:29