13

I have a large document which consists of ~100 smaller files which are compiled together using the subfiles package. To be able to use a common style file for them, whose relative path should be the same from every compilable file, I use the following folder structure:

Project folder

   projectstyle.sty

-- Main folder
     main.tex

-- Subfolder 1
     subfile1a.tex
     subfile1b.tex

-- Subfolder 2
     subfile2a.tex
     subfile2b.tex

and write

\usepackage{../projectstyle}

at the top of the file main.tex. However, since the project is large and contains a lot of tikz file, the compilation now takes quite a long time. I can speed up the compilation of the main file by using the externalize command from the tikz/pgf package by writing e.g.

\usetikzlibrary{external}
\tikzexternalize[prefix=tikz/] 

at the top of the main file. This works when compiling the main file, given that I put a folder named tikz in the Main folder. However, I would also make this work when compiling the subfiles by them selves, as this is the whole point of using the subfiles package. Here it would be optimal if I could use a relative path to the folder in which to externalize the graphics, and put this on the same level as the style file, and then write

\tikzexternalize[prefix=../tikz/] 

but this does not seem to work, as the compiler (pdflatex) complains that

! I can't write on file `../../tikz/main-figure0.md5'.

when I try to compile the main file. Is there any way to get around this?

I do realize one solution would be to write

\tikzexternalize[prefix=tikz/]

in the main file (or in the style file), and then add a folder named tikz to all folders which contains compilable documents, but then I would have two copies of each image, which seems to be quite a waste of space...

1 Answer 1

3

If it is really just about disk space (as indicated in the last paragraph), you can use symbolic links instead of real copies of the tikz directory.

1
  • 4
    Welcome to TeX.SE! Depends on which operating system is used ... Please explain a little bit more, for example how to set the symbolic link ...
    – Mensch
    Jun 11, 2015 at 16:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .