7

I want pdflatex to produce a PDF with the images shown as empty rectangles.

pdflatex thesis.tex 

Will compile my thesis normally with pictures, but it takes about 5 min to compile

pdflatex -draftmode thesis.tex 

Will compile my thesis, showing that pdflatex has interpreted all of my commands, but it won't show a PDF so that I can see that it has actually done what I want. It takes about 20 sec to run.

\includeonly{Chapter4} 

Is faster, but gives a lot of errors making it harder to work out if my new bit of formatting code has done what I want. Also it isn't much faster.

I want something like

pdflatex -noimages thesis.tex

Which will create a PDF with empty rectangles where the images go, so that I can quickly check that the figures are in the right place, and any formatting, without having to wait 5 min between each attempt at formatting.

Any help is appreciated.

  • 2
    Are the figures included with \includegraphcis, if so the draft option will do the trick. How are you including the pictures? – StrongBad May 28 '13 at 10:14
  • This is peripheral to your question, but may be of interest: here's a way of removing all tikzpicture's in your document. – jub0bs May 28 '13 at 10:46
8

What about

\usepackage[draft]{graphicx}

in your .tex file?

  • 4
    The options dvips and pdftex should not be passed to graphicx; the package detects by itself what driver to use for output. – egreg May 28 '13 at 10:24
  • 2
    You might also give the draft option as a class option instead (compared to the package option given in the answer). It might save some additional time depending on the other packages used. As the other packages then also use their draft mode (if they support one), this might change the document. – Patrick Häcker May 28 '13 at 10:33
  • 2
    @John1923 instead of doing \usepackage[draft]{graphicx} do \documentclass[draft]{article}, or whatever class you are using, this way all packages get the draft option. – StrongBad May 28 '13 at 11:07
  • 1
    @egreg Some drivers are detectable (pdftex, xetex, vtex), others are not. Thus a package cannot detect dvips, for example. The user might run dvipdfm afterwards. IMHO it is perfectly ok, if someone specifies a DVI driver option that is not detectable. – Heiko Oberdiek May 28 '13 at 14:04
  • 3
    @John1923 @DanielEShub Options can be given to a package loaded by the document class by \PassOptionsToPackage before \documentclass. In this case \PassOptionsToPackage{draft}{graphicx}. Package graphicx also provides an alternative, option draft can also be changed after package loading: \setkeys{Gin}{draft}. – Heiko Oberdiek May 28 '13 at 14:09
3

The other answer suggests

\usepackage[draft]{graphicx}

which is perfect for simple tex documents. However many of us use custom class files provided by universities or journals, and these files often contain

\usepackage[foo,bar,baz]{graphicx}

and we would rather not edit the provided class file.

There are two alternative solutions.

1) Call the custom class file with the draft class option

\documentclass[draft]{CustomClass}

This will send the draft option to every package declared in the file, causing many changes, but the graphics will be replaced by white boxes.

2) Send the draft option to the graphicx package. This must be done before the custom class is called.

\PassOptionsToPackage{draft}{graphicx}
\documentclass{CustomClass}    

Thank you to Daniel.E.Shub, MMM and Heiko Oberdiek for saying this in the comments to the other question.

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.