In my PhD thesis in engineering, I expect to have approximately hundred plots which are vector graphics (in PDF format) created close to the final size (but not exactly).

I'd like to declare a global size in the preamble, say 75% of the textwidth. Then I can simply use \includegraphics{filename.pdf} for each figure, without worrying about the [scale=xx] option. Later, if one needs to tweak figure sizes to prevent awkward paginations, one can simply change this to (say) 70%. Then, all figures would obey this setting, thereby helping to maintain consistency in the document.

I have used the following setting in the preamble

\setkeys{Gin}{width=0.75\textwidth} % default width of graphics

However, now I lost manual control for individual figures, i.e. Latex does not obey the [scale=xx] option anymore. I have a couple of illustrations that do not belong to this global paradigm, and need to scale just these.

Is there some way achieve the desired behavior?

  • Can you manually overwrite the scaling with [width=.9\textwidth]? Jun 18 '18 at 14:55
  • @samcarter Yes. But this is not what I want. It also skews the figure making it appear squashed or elongated. I would like to scale uniformly the width and height. Jun 18 '18 at 14:57
  • 2
    Specifying width alone will keep the aspect ratio intact. No squashing happens unless you specify both width and height with different ratios from the original width and height. I've rarely used scale instead of width. Jun 18 '18 at 14:58
  • check the adjustbox package. Imho it has code for this. Jun 18 '18 at 14:58
  • 1
    Unless you are explicitly setting the height as well, this should not distort the aspect ratio. Please make a minimal working example (MWE) that demonstrates your problem. Jun 18 '18 at 14:59

This problem is now solved thanks to the community here.

Even though the [scale=xx] option for \includegraphics does not work anymore (I don't know why?) after setting \setkeys{Gin}{width=0.75\textwidth} in the preamble, the [width=xx] option works.

Thus, one can get consistent sizing of figures in the document, and yet retain manual control for individual figures. Note that this question and answer are largely applicable for vector graphics sizes. Otherwise, arbitrary scaling of raster images would lead to pixelisation.

PS: IMHO, this feature should be offered at a more fundamental level, perhaps as an option to the graphicx package.

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.