I would like to speed up the building of my latex documents, and I'm curious if it's possible to use all four of my processor cores when building documents.
There are instructions for windows users, but I haven't found any for linux users.
I would like to speed up the building of my latex documents, and I'm curious if it's possible to use all four of my processor cores when building documents.
There are instructions for windows users, but I haven't found any for linux users.
TeX engines are one-threaded, so they cannot distribute the load to multiple cores. TeX processing often require running external programs (biber, bibtex, makeindex), but since they need files produced by TeX and send their results to TeX as files, you cannot do much here either.
Still, there is an advantage of having a multicore machine: if your editor (or TeXStudio) runs on one core, and a TeX engine on another one, this will speed things up. However, this is usually automatically done by your OS, and is transparent to you.
Another situation is processing rnw documents with knitr or Sweave. While R is also one-threaded, it can parallelize computations using multicore package. This can speed R parts considerably.
The pgf-manual describes a way to process tikzpictures with multiple cores in parallel: see the entry for /tikz/external/mode for details.
You first need to externalize the creation of tikzpictures by including the following in your preamble:
\usetikzlibrary{external}
\tikzset{external/mode=list and make}
(see this answer, and also this answer in case you are using AucTeX)
This will create several auxiliary files in your working directory for each tikzpicture. You may want to keep these auxiliary files in a separate subdirectory like this:
\tikzexternalize[prefix=figures/]
Note that the subdirectory specified needs to exists.
Now you can compile with the following routine:
%step 1: generate main.makefile:
pdflatex main
% step 2: generate ALL graphics on 2 processors:
make -j 2 -f main.makefile
% step 3: include the graphics:
pdflatex main