11

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}
15

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.

2

I do not know why, but:

1) If you want to have proper dimensions, use:

\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}}
\resizebox{2cm}{2cm}{\begin{tabular}[b]{|l l|}\hline A&B\\C&D\\  \hline\end{tabular}}

\end{document}

enter image description here

2) If you want to see a horror, please change [b] onto [t]. I know that it is not a proper answer, but one should to see THAT! :-)

  • [b] is closer but not what is wanted, as with b more of the total vertical extent is in the height, but the depth of the bottom row is not taken into account. with [t] you are scaling by 2cm/\ht\strutbox which is rather a bigger scale than intended, probably. (actually with an \hline at the bottom, the reference point is at the bottom so you get lucky:-) – David Carlisle Dec 11 '13 at 22:27
  • It have useful info (+1) (but I'm going to accept David's answer). I've seen weirder stuff than the one you mentioned in 2) when I used parbox and minipage in resizebox while I was trying to construct an answer for this question. – masu Dec 11 '13 at 22:30
  • @masu the situation with parbox is identical to that with tabular, normally it has height and depth and resizebox scales the height. – David Carlisle Dec 11 '13 at 22:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.