[Tex/LaTex] resizebox doesn’t resize a tabular vertically

scalingtables

Why is that? Shouldn't they both be 2cmx2cm in size?!

enter image description here

\documentclass{article}
\usepackage{graphicx}

\begin{document}

\resizebox{2cm}{2cm}{\rule{6cm}{7cm}}
\resizebox{2cm}{2cm}{\begin{tabular}{l l}A&B\\C&D\end{tabular}}

\end{document}

Best Answer

You want \resizebox* not \resizebox the latter scales the height whereas the former scales height + depth. A tabular is vertically centred so the height is half its vertical extent.