6

If I use

\usepackage[draft]{pdfpages}

and include

\includepdf[...]{...}

everything works fine, i.e. instead of the included pages I get empty boxes. But if I use

\includegraphics[...]{...}

the actual picture is included. I cannot separately load "graphicx" because it is already loaded by "pdfpages".

How can I pass the draft option to \includegraphics?

8

You can use \PassOptionsToPackage:

\PassOptionsToPackage{draft}{graphicx}
\documentclass{article}
\usepackage[draft]{pdfpages}

or you can use draft as a class option

\documentclass[draft]{article}
\usepackage{pdfpages}
\usepackage{graphicx}

and it will be picked by pdfpages and graphicx. Another option would be to load graphicx before pdfpages, so you can use the desired option:

\documentclass{article}
\usepackage[draft]{graphicx}
\usepackage[draft]{pdfpages}
0
4
\usepackage[draft]{graphics} % or \usepackage[draft]{graphicx}
\usepackage[draft]{pdfpages}

LaTeX does not load packages more than once. Loading the package graphics the first time, enables draft mode. Package pdfpages loads graphicx and graphicx loads graphics without options each, thus LaTeX will not complain. The important thing is that the superset of all options specified in all load requests must be present at the first loading of the package.

Other alternatives are given in Gonzalo Medina's answer:

  • Global option draft is seen by packages graphics and graphicx.

  • Calling \PassOptionsToPackage before the first loading of graphics or graphicx.

Key value setting

And yet another way is possible:

\usepackage[draft]{pdfpages}
\setkeys{Gin}{draft}

Package graphicx adds a key value interface for some of the options. draft can be set and unset later:

\setkeys{Gin}{draft}
... \includegraphics{...} ...
\setkeys{Gin}{draft=false}
... \includegraphics{...} ...

Or the option can be set explicitly in \includegraphics:

\includegraphics[draft=false]{...}

However final is not defined this way. This option can only be used as package option.

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.