# TikZ externalize fails to recognize changes [duplicate]

This question already has an answer here:

Using XeTeX(xelatex) [i got the same using pdflatex] on Debian I am trying to save some compilation time using tikz external. Yet, the figures are never updated unless I delete the corresponding files. Otherwise I get

===== Image 'figures/mwe-figure0' is up-to-date. ======

eventhough I changed something, e.g. labels or coordinates

\pgfversion gives me 2.10

mwe:

\documentclass{scrartcl}
\usepackage[english]{babel}
\usepackage{tikz}
\usetikzlibrary{external}
\tikzexternalize[prefix=figures/]
\tikzset{external/system call={%
xelatex \tikzexternalcheckshellescape
-halt-on-error -shell-escape -interaction=batchmode
-jobname "\image" "\texsource"}}
\begin{document}
\begin{tikzpicture}
\node (f) at (0,0){d};
\end{tikzpicture}
\end{document}


Interestingly, when I add

\tikzset{external/up to date check=md5}


to the preamble I get

! Package pgfkeys Error: I do not know the key '/tikz/external/up to date check
'and I am going to ignore it. Perhaps you misspelled it.

What could be the cause of that?

PS: If it provides any insights to you, the *.dpth files are empty.

-

## marked as duplicate by Alexander, lockstep, Thorsten, Kurt, Claudio FiandrinoJul 17 '13 at 9:52

I have an implementation for an automatic recognition of changes already for quite a while and it works I think for all versions of pgf with the externalization feature. Just add the following into your preamble:

\usepackage{filemod}
\newcommand{\includetikz}[2]{%
\tikzsetnextfilename{#2}%
\filemodCmp{#1#2.tikz}{#1tikz_external/#2.pdf}%
{\tikzset{external/remake next}}{}%
\input{#1#2.tikz}%
}


You can include tikz files by the following code:

\begin{figure}[pt!]
\centering
\footnotesize\includetikz{figures/}{testfigure}
\caption{testcaption}
\label{fig:testlabel}
\end{figure}


You don't need the \footnotesize but that's how I usually include diagrams.

-
bene's solution is appealing to me because it doesn't require fiddling with apt and tex-life so i can leave updating my distribution to apt-get entirely. yet, it only works with pdftex, not with xetex, due to filemode. In case somebody is looking for that in the future: I just modified the perl script so that it simply deletes the pdf if it is older than the tikz image, consequently it will then be recompiled, of course i also had to adapt the tex code accordingly. That solves the issue for now –  sheß Jul 17 '13 at 15:03