0

I am using pdfLaTeX with the tikzexternalizecommand, but can seemingly only set folders in the same directory as my main tex file.

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

works, while all relative paths of the form

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

give me the error:

! I can't write on file `../externalize/main-figure0.md5'.
<to be read again> 

\documentclass{article}
\usepackage{pgfplots}
\usepgfplotslibrary{external}
\tikzexternalize[prefix=tikz/]

\begin{document}

\begin{figure}
  \begin{tikzpicture}
  \begin{axis}
    \addplot {x^2};
  \end{axis}
 \end{tikzpicture}
\end{figure}
\begin{figure}

\end{document}
Stefan Pinnow
  • 29,535
Wasserwaage
  • 233
  • 3
  • 12
  • 3
    I am not sure if TeX is willing to, say, write arbitrary files to arbitrary paths. You may either put a (fake) root file at the parent folder so TeX will be execute there. Or you write a shell script that does similar trick. – Symbol 1 Mar 01 '20 at 20:31
  • 1
    I agree to Symbol 1's comment. Due to security reasons for quite some time TeX doesn't allow any more to write to path "higher" than that of the main file/\jobname.tex. – Stefan Pinnow Mar 02 '20 at 09:05

1 Answers1

1

As Symbol 1 and Stefan Pinnow pointed out in the comments, TeX does not allow to write in parent directories by default. You can change the security settings according to Write to a file outside of the current folder , however this is not recommended because you open up for any code snippet you might get from someone else or find on the internet to write anything anywhere on your computer.

aknott
  • 372