Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}
share|improve this question

2 Answers 2

up vote 15 down vote accepted

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.

share|improve this answer

I do not know why, but:

1) If you want 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! :-)

share|improve this answer
    
[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
    
Thanks, David, I've inferred that. :) –  masu Dec 11 '13 at 22:43

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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