# Why does adjust box not resize to the dimensions given

Hi looking to understand this a little better. Why does adjustbox not resize the text in the following example so that it fits the dimensions I think I'm specifying. e.g a 4in x 4in box. Am I doing something wrong and how do I fix it?

\documentclass{article}
\usepackage{lipsum}
\begin{document}
\parbox{4in}{
\lipsum[1-3]}
\end{document}

-
As @IanThompson mentioned, you're specifying max height, which is different from max totalheight, since your \parbox has depth (included in totalheight but not in height). –  Werner Aug 31 '12 at 16:08

Boxes in TeX have both height and depth. We can enquire about the dimensions of the box in question as follows.

\documentclass[10pt]{article}
\usepackage{lipsum}
\begin{document}
\newsavebox\Abox
\savebox\Abox{\parbox{4in}{\lipsum[1-3]}}
\newlength\mydp
\newlength\myhg
\settodepth\mydp{\usebox{\Abox}}
\settoheight\myhg{\usebox{\Abox}}
\showthe\mydp
\showthe\myhg
\end{document}


In this way, we obtain a height of 204.97221pt and a depth of 209.97223pt. Since 1in=72.27pt, this means that the height and depth of the box are approximately 2.84in and 2.91in, respectively. Consequently, setting max height=4in has no effect. According to page 5 of the adjustbox package manual, totalheight is height plus depth, so if you want the actual height of the box on the page to be restricted to 4in you should use totalheight in place of height. To make the width of the box remain the same (so the aspect ratio of the box changes), you need to set width and totalheight.

\documentclass[10pt]{article}

\setlength{\mydp}{\dp\Abox} is much more efficient (although not officially documented in LaTeX). –  egreg Aug 31 '12 at 13:08
@TahnoonPasha --- What you want is not clear from the question; maybe you could edit it to clarify. In my answer, the box is scaled so that it fits within your settings for maximum width and height, while keeping the aspect ratio. If you want a 4in by 4in box you can use scale (see section 4.4 of the package manual). –  Ian Thompson Aug 31 '12 at 15:27