# Use \setkeys{Gin} to set default scale value doesn’t work

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.

\documentclass{scrartcl}

\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

\begin{document}
Nulla facilisi. Sed aliquam nulla quis nunc porttitor pellentesque. Nunc.
Nulla facilisi. Sed aliquam nulla quis nunc porttitor pellentesque. Nunc.
\begin{figure}
\centering
\includegraphics{somegraphic}
\end{figure}
\end{document}


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

-

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:

\newcommand{\globalinclgrphkeys}{scale=0.5}

% ...

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


or directly:

\newcommand{\myincludegraphics}[2][]{%
\includegraphics[scale=0.5,#1]{#2}%
}


### 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>}.

-
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