# Complex objects delay compiling time - how to make latex faster for draft versions?

Working on my phd thesis has become a nightmare since I tried to insert some very large (sideways)tables with many columns and cells all containing citations.

A complete compiling run with latexmk took more than 5 minutes. Before I inserted the tables, it was about 3 minutes which is still long enough.

As the tables contain references (\cite), they can not be handled as "static", as the numeric references might change with changes of the document. (Otherwise I'd typeset the tables in a separate document and insert the pdf with includegraphics.)

What possibilities are there to speed up compiling?

• Is there a way to exclude parts of a document (similar to includeonly), so that I could normally replace the tables (which will normally fill an entire page) by a large rectangle?

Sure I could remove chapters I'm currently not working on, but it partially need them for cross-referencing and cross-checking information...

_and sure, I could compile less often, but to avoid mistakes and see what I'll get after small changes, I'd like to compile directly after making changes to the text, if possible.

Any ideas?

-

You can use the draft option to speed up things a bit, but using \includeonly is the only efficient solution that I am aware of.

Note that it is smarter than you think. In particular, it preserves cross reference. I cannot see any reason why not to use it while you are in the process of writing.

-
Thank you, Olivier! I don't like the draft option because then I don't see my graphics any more. (I'm having mostly vector images, embedded as PDF, so I think they are not as "problematic" as included bitmap graphics). –  Martin Sep 26 '11 at 21:03

use the option -draftmode for pdflatex and delete this one only for the last run, which can then be done without using latexmk

pdflatex -draftmode <file>


it doesn't create a pdf but all the auxiliary files. That is a useful option.

To exclude some parts of your document use:

\iffalse
... to ignore ...
\fi

-

You could use the \ifdraft switch provided by the ifdraft package for this purpose:

\documentclass[draft]{article}
%% \documentclass[final]{article}

\usepackage{ifdraft}

\begin{document}

\ifdraft{%
placeholder for draft document%
}{%
stuff for final document%
}

\end{document}

-

You can run a full compilation of your document and keep the pdf aside for reference, since you mention that you need this. Then exclude the parts you don't need and compile the remaining parts quickly. This way, all the references will be fine, too, since all the .aux files will be created.

Another cause of slowness could be many (and high resolution) images. If you can't afford the draft option, you may use lower-resolution ones while you work and incorporate the full-resolution ones only for final compilation. By keeping them in separate directories this could be very easy and error-free.

-