views:

74

answers:

4

I have fairly large Latex document with a lot of TikZ figures inside. I have a habit of frequent recompilation and it takes forever to compile it using pdflatex. Figures in TikZ take most of the time.

My question is what is the best way to split the document into separate tex files (figures/chapters) to achieve separate compilation of figures and chapters, separate chapter pdfs, and a whole document pdf file ?

A: 

Does it help to use the class option draft? This should make compilation a lot faster.

qbi
Draft doesn't cause inline tikz pictures to not be compiled. By default at least. But I'd endorse some solution along this line.
Seamus
+3  A: 

Have you tried compiling each picture on its own and then including them in your tex file as pdf rather than the tikz code? You can use the package standalone so that the picture will be the exact size you need. So :

\documentclass{standalone}

\usepackage{tikz,pgf} %and any other packages or tikzlibraries your picture needs

\begin{document}

\begin{tikzpicture}

%your tikz code here

\end{tikzpicture}

\end{document}

The good thing about this is that you can either include the compile this document directly to get a pdf figure to include in your document, or you can use the command \input to include it in your main document as a tikz code by adding

\usepackage{standalone}

in your main document (together with the tikz packages and libraries), and then

\begin{figure}
\input{tikzfile.tex}
\end{figure}
Vivi
A: 

The way I generally do this is to apply Latex to just part of the file: Emacs and several other Latex editors allow you to compiler regions: with Auctex, you can run TeX-pin-region to specify the current chapter, and then TeX-command-region to run Latex on the selected region.

The traditional way to do this is cut parts of the big file into smaller parts that are \included, and then either comment out parts you don't want to work on, or put some macrology at the beginning and end of each file that allows them to be compiled separately.

Charles Stewart
+1  A: 

How about putting each chapter in a separate file and then using \include to put them into some master file? Then you can use \includeonly to only compile the chapter you're currently working on. That should save some time at least.

I expect some sort of makefile based solution would be even better than this, but I don't know anything about makefiles...

Seamus