Sign up ×
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.

I’d like to make all my graphic a little smaller and tried to set the scale-value of \includegraphics globally with \setkeys{Gin} but while changing width works fine scale has no effect.


\usepackage[demo]{graphicx}% use some grafic from you computer and switch of demo
    \setkeys{Gin}{width=0.75\textwidth}% works fine
%   \setkeys{Gin}{scale=0.5}% doesn't work

Nulla facilisi. Sed aliquam nulla quis nunc porttitor pellentesque. Nunc.
Nulla facilisi. Sed aliquam nulla quis nunc porttitor pellentesque. Nunc.

I know that it’s better to produce graphics in the right size but I’m using vector graphics and it’s ok for me to scale them a bit in this case.

BTW: Is there an image that is available in most TeX-systems for creating an MWE

share|improve this question

1 Answer 1

up vote 12 down vote accepted

The width key of graphicx sets a macro which then stays valid for the rest of the scope, while scale modifies the internal token register used to accumulate the required code for the current image. This token register is reset at the begin of the internal \includegraphics code and therefore any previous changes are lost. Anyway, the order of the keys and the code they put into the token register is very meaningful and so global settings wouldn't work. The temporary(!) token register first has to be initialized properly.

I studied graphics/x a lot for my adjustbox package which uses the same technique and which most keys can also be used for \includegraphics, if the export option was used. I'm planning to provide macros to allow for such kind of global settings. These would then simply store the keys and insert it to the list of \includegraphics or \adjustbox keys. In the meantime you could use some code like this:


% ...

\expandafter\includegraphics\expandafter[\globalinclgrphkeys,<other options]{<file>}

or directly:


Update 31. Oct 2011:

Using the new version 0.7 from 2011/10/30 you could use \adjustboxset{scale=0.5} to set a global scale key for all \adjustbox macros. Then use \adjustimage{<other options>}{<filename>} instead of the usual \includegraphics[<options>]{<filename>}.

share|improve this answer
Thanks @Martin, the \newcommand-way was my workaround too but I was hoping for an “official way” … – Tobi Oct 9 '11 at 12:14
There is no official way in graphicx, but have a look at the next released of adjustbox. – Martin Scharrer Oct 9 '11 at 12:17

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.