5

I'm working on a big document in which there are many images.

Usually, I compile it with latexmk and it works quite well. But: with all these images it's quite slow when compiling.

Is it somehow possible to compile it as a draft for the first few rounds and then as a non-draft, so the images are ignored the first few times and properly included in the last round, without editing the file inbetween?

That would save quite a lot of time.

  • 2
    arara should be the right tool for this, right @PauloCereda? – percusse Nov 17 '14 at 19:53
  • Have you tried the draft option to \includegraphics? – sgmoye Nov 17 '14 at 20:57
  • I don't see how the \includegraphics-draft would help me here. Before compiling the last time, I'd need to remove that code parts again. My idea is to run everything in draft-mode except for the last run or so. And I have never heard of arara, how would that help me here? thanks. – Perik Onti Nov 17 '14 at 21:18
  • @PerikOnti draft may change several aspects of the typesetting, depending on which packages you load, so just the final run without it may not be sufficient. The draft option should be only to graphicx. It's an interesting question anyway. – egreg Nov 17 '14 at 22:11
  • do you mean you are running latex multiple times after each edit? if so why? If you are editing between latex runs why is adding/removing [draft] a problem? – David Carlisle Nov 17 '14 at 22:11
2

Note that latexmk can't know which LaTeX run will be the last, so you will need to run it twice.

The first time call it like

latexmk -pdf -pdflatex="pdflatex %O '\PassOptionsToPackage{draft}{graphicx}\input{%S}'" <filename>

and the second time just with

latexmk -pdf -g <filename>

In the document you'll just have \usepackage{graphicx}. In my test, just one run is performed with the second command.

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.