3

The example bellow comes from the documentation of TikZ (p610). It does not work my computer. Note that it works when I comment the option [prefix=figures/]. Any idea of what could go wrong here?

\documentclass{article}
% main document, called main.tex
\usepackage{tikz}
\usetikzlibrary{external}
\tikzexternalize[prefix=figures/] % activate

\begin{document}
\tikzsetnextfilename{trees}
\begin{tikzpicture} % will be written to ’figures/trees.pdf’
\node {root}
child {node {left}}
child {node {right}
child {node {child}}
child {node {child}}
};
\end{tikzpicture}
\tikzsetnextfilename{simple}
A simple image is \tikz \fill (0,0) circle(5pt);. % will be written to ’figures/simple.pdf’
\begin{tikzpicture} % will be written to ’figures/main-figure0.pdf’
\draw[help lines] (0,0) grid (5,5);
\end{tikzpicture}
\end{document}
  • 2
    Do you have a directory named figures in your working directory? I just added this directory to my code sandbox and it worked! – user31729 Dec 23 '15 at 11:03
  • Oh! The shame is on me! It was so simple! Thanks – Gilles Bonnet Dec 23 '15 at 11:05
  • 1
    If all would be that easy ;-) – user31729 Dec 23 '15 at 11:08
  • @ChristianHupfer I created an answer from your comment, in order to tick the question as answered (in two days). But of course, if you add yourself the answer I will choose yours! – Gilles Bonnet Dec 23 '15 at 11:13
  • 1
    No, that's ok... It will give you a self-learner badge then :D – user31729 Dec 23 '15 at 11:14
3

Thanks to the comment of Christian Hupfer: The directory named figure must already exist in the working directory. That's all!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.