Previous: , Up: Commands for graphics   [Contents][Index]


22.3.4 \resizebox

Synopses:

\resizebox{horizontal length}{vertical length}{material}
\resizebox*{horizontal length}{vertical length}{material}

Given a size, such as 3cm, transform material to make it that size. If either horizontal length or vertical length is an exclamation point ! then the other argument is used to determine a scale factor for both directions.

This example makes the graphic be a half inch wide and scales it vertically by the same factor to keep it from being distorted.

\resizebox{0.5in}{!}{\includegraphics{lion}}

The unstarred form \resizebox takes vertical length to be the box’s height while the starred form \resizebox* takes it to be height+depth. For instance, make the text have a height+depth of a quarter inch with \resizebox*{!}{0.25in}{\parbox{1in}{This box has both height and depth.}}.

You can use \depth, \height, \totalheight, and \width to refer to the original size of the box. Thus, make the text two inches wide but keep the original height with \resizebox{2in}{\height}{Two inches}.


Unofficial LaTeX2e reference manual