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.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using Sphinx and the plantuml package to include UML diagrams.

The plantuml package for Sphinx generates the following LaTeX code:


Anyways - the diagrams are to big, so what I want is


Can I - without patching the plantum package - set a default scale for \includegraphics in my LaTeX preamble?

share|improve this question

There are two ways.

First way: set a default value for some keys.

\setkeys{Gin}{width=.75\csname Gin@nat@width\endcsname,keepaspectratio}

(the natural width is stored in \Gin@nat@width)

Second way: add scale=0.75 to the passed options.

share|improve this answer
First way seems to set the size right, but now one graphic is placed at the end of one page and running over the page border. Second way seems to cause an endless loop: pdflatex is not returning ... – Alex Nov 17 '12 at 13:32
@Alex Sorry, but without an example of TeX code that shows the bad behaviors it's difficult to help. – egreg Nov 17 '12 at 13:36

There is a way to define standard options for \includegraphics, but unfortunately, it doesn't seem to work for scale. It works for width though, which might be an option, too? See section 4.6 of grfguide: Global setting of keys.


    \setkeys{Gin}{width=.75\textwidth, height=1cm}
    % in your case, you'd obviously only specify the width
    % I just used height as well for demonstration purposes.

\usepackage{mwe}% just for the example images







Note that the images originally all have different aspect ratios.


share|improve this answer
Thank you but I think I need scale because I want to have the elements of the UML graphs all to have the same size. And as the UML drawings can be big and small, stretching them to a fixed would change the element's size. – Alex Nov 16 '12 at 21:16
@Alex I was afraid the situation would be like that. I think I'll still leave the answer up, as it might be helpful for other people with a similar problem. I also pinged David Carlisle, author of grfguide, on chat; he might be able to help. – doncherry Nov 16 '12 at 21:27
hmm scale coding looks a bit odd (who did that:-) but you can go \setkeys{Gin}{width=.75\natwidth,keepaspectratio} which comes to the same thing – David Carlisle Nov 16 '12 at 22:34
@DavidCarlisle This gives me ! Undefined control sequence. \Gin@@ewidth ->.75\natwidth and ! Illegal unit of measure (pt inserted). (each of them twice per image). – doncherry Nov 16 '12 at 22:42

Your Answer


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.