# TikZ External and tikzscale: Figure is regenerated every time

I am using tikzscale with tikz external library in the list and make mode. Before using tikzscale, if I issued make -f main.makefile command, only the figures that were not present would be generated. But since I have started using tikzscale, all the figures are regenerated even if they exist already. This takes a lot of time for compilation of a long document. Please go through the MWE and let me know if I have set up everything correctly.

The testing sequence on a linux machine is:

pdflatex main.tex
make -f main.makefile
ls -l main-figure0.pdf
make -f main.makefile
ls -l main-figure0.pdf

One can see that the figure is generated again from the timestamp.

MWE

\documentclass{report}
\usepackage[showframe=true]{geometry}
\usepackage{filecontents,tikz}
\usetikzlibrary{external}
\tikzexternalize[mode=list and make]
%Comment out to external work properly without tikzscale
\usepackage{tikzscale}

\begin{filecontents}{fig.tikz}
\begin{tikzpicture}
\draw (0,0) rectangle (1,1);
\end{tikzpicture}
\end{filecontents}

\begin{document}
\begin{figure}
\includegraphics[width=\textwidth]{fig.tikz}
%Uncomment to see externalize work properly without tikzscale
%\input{fig.tikz}
\caption{Test figure}
\end{figure}
\end{document}
-
@MartinScharrer external works with tikzpicture \input from external files. Please see the modified MWE. Since .dep files are being create, I am assuming that external sees the environment. I will have to look into your package. –  devendra Jan 3 '13 at 9:22
Sorry, forget me previous comments (I deleted them now including your response). tikzscale works differently then the mentioned gincltex because the latter scales the text size as well. standalone also doesn't have support for keeping the text size constant because it is not TikZ-specific. The tikzscale manual actually states in section 3.2 that it is compatible with the external library. –  Martin Scharrer Jan 3 '13 at 9:22
Did you see this in the tikzscale package? Section 4: When the external library is used, the graphic files get regenerated more often than necessary. This is, because the axis ratio is not saved, thus assumed unknown and the graphic is thus regenerated. For performance reasons if a default axis ratio is used, the plot is not regenerated. If a nondefault axis ratio has been used for generating the externalized graphic and the default axis ratio is used in the current run, this is not detected and the graphic has the wrong size at the moment. You can, of course, delete the [..] –  Martin Scharrer Jan 3 '13 at 9:26
@MartinScharrer - Yes. That happens and written down in the main-figure0.log file. However, once the figure is generated, and there has been no change in the figure.tikz file and the main.tex file then the usual external behaviour of stating that all the figures are up-to-date doesn't happen if tikzscale is used. It keeps regenerating the figures with every make run. –  devendra Jan 3 '13 at 9:34