2

It takes ~15-30 seconds to run PDFLaTeX for my PhD thesis. This is killing my productivity.

Each included chapter is called, e.g., \include{theory}, and the relevant .tex file starts with the respective \chapter{Theory}.

A single change in one chapter causes PDFLaTeX to rebuild all chapters; this takes a long time. Does Kile have a built-in way to only "recompile" changed chapters, a la make on Linux, so I don't have to wait so long for minor edits?

Details:

  • The thesis is only about 100 pages long so far.
  • There are some large photos included (necessary for being able to zoom on specific features). The whole pdf is ~12 MB right now.
  • Quickpreview returns with errors since I include graphics and .sty files (it works for very small snippets only).
  • My project's main .tex file consists of only \usepackage commands, \include statements and a handful of other commands (frontmatter, tableofcontents, backmatter, etc).

If I cannot fix this I will have to make ~5-10 separate projects for different chapters, then concatenate them all at the end. This is undesirable because there are cross-chapter label/references to images and other shared resources across chapters.

Has anybody come across this and solved the problem?

  • 2
    ule of thumb, the longer the thesis the longer the compile time. The last thesis i was compiling took 18 minutes on my machine for a full run. – Johannes_B Apr 01 '15 at 14:19
  • 15-30 seconds? I get that easily on one chapter of my thesis... – Benedikt Bauer Apr 01 '15 at 14:22
  • 6
    There are people on the site who remember it taking 15 minutes to load article, let alone do any work! – Joseph Wright Apr 01 '15 at 14:25
  • 6
    Nothing automatic I think, though you could of course use \includeonly{filename} to compile just one included file. – Torbjørn T. Apr 01 '15 at 14:31
  • @JosephWright Those people must be really really old, aren't they? ;-) – Benedikt Bauer Apr 01 '15 at 14:34
  • @TorbjørnT., Yes!! This is exactly what I was looking for. If you post as an answer I will mark accepted. – user1717828 Apr 01 '15 at 14:38
  • Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. A suggestion: Do us a favour and change your username to something more telling than "user1234". – Martin Schröder Apr 01 '15 at 14:44
  • 3
    Similar questions has been asked before, e.g. Speed up compilation by (pre-)compiling chapters separately? and Does LaTeX have to reprocess included files that haven't changed? so I guess we can rather close as duplicate. – Torbjørn T. Apr 01 '15 at 14:55
  • @TorbjørnT., fair enough. We can close as duplicate, but this may not help people searching for long compile times if they don't know \includeonly exists (e.g., me 1 hour ago). Thoughts? – user1717828 Apr 01 '15 at 15:05
  • Google will find your question, people will see it as well as the link to the dupe to come. – Johannes_B Apr 01 '15 at 15:13
  • 5
    if you're happy with the way the images are placed and behaving in a chapter, you can suppress inclusion in an interim compilation by applying the [draft] option on either the \documentclass or the relevant \usepackage line for graphics. by "suppress" i mean that the image itself won't be included, but that the proper space is left, with the name of the file printed as a place marker. – barbara beeton Apr 01 '15 at 16:48
  • @barbarabeeton, yes! Another great answer. I'm not sure why tex.stackexchange.com users are putting these answers in comments, but I will copy them below. – user1717828 Apr 01 '15 at 17:47
  • @TorbjørnT., see @barbarbeeton's answer for an example of something that answers the heart of this question but not the linked ones. Please use discretion to closed/mark-as-dup the thread (I only seem to be able to share edit delete flag). – user1717828 Apr 01 '15 at 17:49
  • @user1717828 -- i put my suggestion in a comment because i didn't (and don't) think it is a complete answer. but i noticed that none of the linked answers (these should almost always be in cmments) mentioned draft so i did, because you specifically mentioned large graphics. – barbara beeton Apr 01 '15 at 18:12

2 Answers2

6

if you think that including the large images is what's taking most time, process just the images and enough surrounding text to make sure they're doing what you want them to do. then add [draft] using one of these methods in the preamble:

\documentclass[draft]{...}
\usepackage[draft]{...}

this will suppress loading and processing of the images, but will leave a space of the proper size in the proper location, with the name of the file printed as a place marker.

remember to remove the draft for the final run, and be resigned to the fact that this run will probably take a long time.

to compile a book piecemeal, a chapter at a time, put each chapter in a separate file, and call them in with \include. then use \includeonly{...} in the preamble to specify which chapter(s) should be processed in a particular run. this will make use of the .aux files for other chapters already processed, so that cross-references will be resolved properly.

2

If you would like to avoid the draft option of the graphicx package, you could duplicate all your images with lower resolution copies, thus you retain the actual images with their respective sizes, however, due to the lower quality the resulting pdf will be smaller and compiling will probably be faster. During writing you probably do not need the high-end quality of your images, but it is not too bad to have them there instead of the empty rectangles.

  • copy your images folder to imagesHighQ
  • put low-quality copies of your images into the images folder

When you are done, delete or rename the images folder; and rename imagesHighQ. Run the final compilation.

Dohn Joe
  • 1,912