I want to use yhe adjustbox package to include graphics in beamer presentations. I prefer it over graphicx because it has max size option which only scales the figure when its size is larger than a certain size.

But I've found a problem when I need to select a page from a multipage figure (usually made with \documentclass[tikz]{standalone}). When using \includegraphics it's possible to use page=x (defined in pdftex.def) option to select which page to be included but this option is not available in adjustbox. Therefore the best command I could do to include certain page from a multipage pdf file with fixed maximum size in beamer is:

     \adjustbox{max size={\textwidth}{.9\textheight}}%

where #1 is an optional parameter used to fix page selection when needed and #2 is the mandatory filename.

My questions are:

  1. Is it possible to avoid using includegraphics inside adjustbox if I want to use page=x option?
  2. Is it possible to fix max size with a general adjustboxset command? (I think it isn't with export class option but I'm not sure)
  • Ignasi, @UlrikeFischer: adjustbox v1.1 2018/04/08 now passes the page key (and others) correctly. For images use \adjustimage{key=value,...}{imagefilename}. – Martin Scharrer Apr 9 '18 at 7:14

This works for me:


\centering % just to avoid overfull box
\includegraphics[page=2,max size={\textwidth}{0.9\textheight}]{l3fp}


enter image description here

  • Thanks! Once you know the solution it's easier to find it in documentation, I've read export class option several times but with your example I've finally understood it. – Ignasi Apr 23 '14 at 14:35

The adjustbox v1.1 from 2018/04/08 now correctly supports the page key. Instead of using the export option you can just use the macro \adjustimage{<options>}{<filename>}. Instead of using \centering just use the center key at the end.


     \adjustimage{#1,max size={\textwidth}{.9\textheight},center}{#2}%

After bouncing back between this and this other question, I decided I wanted to both set global keys for adjustbox (part 2 of your question) and sometimes also use page=… (part 1).1 So I did this—note the use of capitalized Export:


% Load graphicx first and save its original \includegraphics

% Using the capitalized 'Export' option replaces \includegraphics with
% \adjincludegraphics

% Set some global adjustbox keys
\adjustboxset{trim=0.5in 0in}

% Define a new three-argument command:
%   \includegraphicspage{adjbox args}{graphicx args}{filename}

This allows me to do all of the following and have my \adjustboxset options apply in every case:


% This is actually \adjincludegraphics; 'page' won't work

% Pass an argument for graphicx

% Also pass arguments for adjustbox


1 Why? Mainly because I already had a long document with many \includegraphics. It was easier to modify the few appearances of multi-page images.

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.