Speeding up LaTeX compilation
Beware of Greeks bearing gifts... Apparently, the nice todonotes
package that I used dragged Tikz along with it, and introduced a major slowdown. Switching to simple marginpars gave a nice speedup. It should be noted that this package is a performance Trojan horse.
large documents start with pages >500 ... Create a script which runs:
pdflatex -draftmode file
bibtex file # or biber
makeindex file.idx # if needed
makeindex -s style.gls ...# for glossary if needed
pdflatex -draftmode file
pdflatex file
The compilation can now be speedup if you run bibtex/makeindex/...
only when there were changes in this area. Can be detected with a diff
for the auxiliary files.
I think the most effective way to save time is to avoid compiling the document time and time again. Compilations are often not really needed, when we change several words or a simple equation.
For large documents, we can split them into small pieces using \include
command. Then \includeonly
helps us to compile the only piece we are interested in, leaving the whole compilation to the last stage.
For complex tables or graphs made by TeX, put them into seperate TeX files first to verify the code, then add them to the document.
Sometimes compilation options may affect the speed. pdflatex -interaction=batchmode foo
is often faster than pdflatex foo
, this avoid scrolling informations. There may be more, say, xelatex -no-pdf foo
is faster than xelatex foo
, if it isn't the last round.