I'm using many pictures within my beamer presentation. Somehow I'm tired of writing:


It works fine and does what I want, but I want to write less code :-)) e.g.:


Yes, I know scale but it works relative to the image size, but not (what I want) relative to the page size … Is there a lightweight and genuine way to achieve this?


2 Answers 2


You could define your own include command, like so:





edit by Claudio Fiandrino

To have the possibility of shrink the image with custom values, one could proceed with a small change to the \mycommand:

\usepackage{mwe}% for dummy images
% mycommand:
% #1: optional -> "shrink" value (default value to 0.8)
% #2: mandatory -> image


\begin{figure}% notice that in Beamer having floating figures is not necessary


The result:

enter image description here

  • See below: Sometimes I want to have a "shrink" of 0.8, sometimes of 0.4 or sth. else… this one would fix the page-image-ratio to 0.8, wouldn't it? But if I modify your solution using two parameters, I could achieve my goal… Jan 13, 2013 at 15:47
  • 4
    @Vincent: just change a bit the command: \newcommand{\mycommand}[2][0.8]{\includegraphics[width=#1\textwidth,height=#1\textheight,keepaspectratio]{#2}}. The use \mycommand{source} will use 0.8 by default, while \mycommand[0.1]{source} will shrink more the image. Jan 13, 2013 at 15:51
  • @ClaudioFiandrino: this is what I'm looking for and trying to build! Thank you. Jan 13, 2013 at 15:55

You can use


and it will apply to all following \includegraphics

If you want to make it paramatersised by argument then perhaps simplest is to observe that the keys you are using are defined by


so all you need is


Then myscale=0.8 does what you ask (\linewidth will be \textwidth or \columnwidth or some other length relevant for the current context.)

  • Note that \setkeys{Gin}{..} doesn't work with all graphicx keys (but with the three shown here it does), because some will try to affect the current image directly and if used like this there is no current image. Because of this I added a feature to adjustbox to also set such keys globally. Jan 13, 2013 at 20:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .