[Tex/LaTex] Latex Standalone always rebuilds / apostroph in filename

standalonetikz-externaltikz-pgf

I have started toying around with Martin Scharrer's standalone package because tikz external does not work with todonotes and I feel that the workflow for standalone makes more sense as far as I have understood it.

Now to the problem: It seems that standalone always rebuilds the subfiles that I include, no matter which mode I select.
Am I getting confused by the changing filetime and is there only a touch being performed? I have only started using this, so I can't tell if I am saving compile time.

I also observed that the filename for my subfile does come out as 'test3'.pdf with extra apostrophs. If I later switch to mode=image, the files are then not found.
Is this related to the always-rebuilding problem?

Current source is as follows:

subfile called: test3.tex

\documentclass[tikz]{standalone}

\begin{document}

\begin{tikzpicture}
\draw (0,0) -- (1,1);
\end{tikzpicture}

\end{document}

Main file:

\documentclass{article}
\usepackage[mode=buildnew]{standalone}
\usepackage{tikz}

\begin{document}
\begin{figure}
\includestandalone{test3}
\caption{test}
\end{figure}
asdfasdf
\end{document}

Best Answer

This issue is caused because the standalone package uses single quotes for the filename in the internal command call. This is done to avoid issues with filenames which contain spaces (which should be avoided anyway) or special characters. Unfortunately, Linux/Unix/Mac OS X require single quotes here which are not even recognized as quotes by MikTeX under MS Windows. Therefore the single quotes are taken as part of the filename. For some reason single quotes work fine with the MS Windows version of TeX Live.

I removed the hard-coded quotes now and added a macro which is set to double quotes for MikTeX and single quotes otherwise. This can be overwritten using the build={quote={<char>}} package option.

This version will be released as v1.2 2012/12/31. It should be available on CTAN in the next days and is already available at the package own repository https://bitbucket.org/martin_scharrer/standalone/downloads.