56

I am relatively new to LaTeX and I was playing around with figures and came across the scalebox command. This apparently lets you scale a graph that you create or import into your LaTeX document by a certain amount. How do you know how much scalebox will scale your figure by? I read somewhere that typing \scalebox{0.5} scales a graph to 0.8 times the original size. Is there any way to figure out what fraction of the original size your graph will become?

lockstep
  • 250,273
Dragonlord74
  • 1,183
  • 2
  • 10
  • 8

2 Answers2

73

It is not true that \scalebox{0.5} of the graphics package scales a graph to 0.8 times of the original size. It scales it simply by this factor, as Ian Thompson already said in his answer.

Note that their is also \resizebox{<width>}{<height>}{<content>} which allows you to scale the image to a given size. This can be more useful for adjusting bigger graphics or pictures: \resizebox{\textwidth}{!}{<content>} scales the content directly to the size of the main text. The ! for the height states that it should scale with the width. See my answer to Quickest way to include graphics for more explanation about scale vs. direct width/height.

See the graphics/x manual for the other commands like \rotatebox. Note that if you want to resize images you can use the optional arguments of \includegraphics[height=<height>,width=<width>,angle=<angle>,keepaspectratio]{<filename>}.

For other things like diagrams drawn using TeX commands (pgf/tikz, pstricks, etc.) there is the adjustbox package which gives you \adjustbox{height=<height>,width=<width>,angle=<angle>,keepaspectratio}{<TeX content>} or the similar and very new gincltex which allows you to include .tex files like images using \includegraphics.

Martin Scharrer
  • 262,582
54

\scalebox{0.5}{stuff}

scales stuff by 1/2 in the horizontal direction, and 1/2 in the vertical direction, so the result will be 1/4 the original size. A vertical scaling that is different from the horizontal scaling can be specified with an optional argument, e.g.

\scalebox{0.5}[0.25]{stuff}.

Applying this command will scale horizontally by 0.5 and vertically by 0.25.

Andrew Swann
  • 95,762
Ian Thompson
  • 43,767