Alex Rivera | Logout

Latex, TikZ and separate compilation of chapters and figures

Asked 2010-07-14T17:31:40.623
10

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 ?

Edit
Report

2 Answers

13

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 document class 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}
answered 2010-07-14T20:41:08.200
2

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...

answered 2010-07-15T14:44:01.407

Your Answer