Latex Standalone always rebuilds / apostroph in filename?

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}

-
Are you compiling with the -shell-escape option? –  T. Verron Dec 1 '12 at 9:31
I added it to the options in TexStudio and I assume it is working because the files are in fact getting built. This question is about why they are rebuilt more often than necessary. –  Matthias Kauer Dec 1 '12 at 9:48
after testing some more, I now feel like something is off with the way filenames and paths are handled under Windows. For instance, tikz pictures are now being generated as 'tikz/filename'.pdf to be precise folder is "'tikz" filename is "filename'.pdf" The log keeps warning me that the file could not be built, the pdf is there however and I can open it just fine. –  Matthias Kauer Dec 1 '12 at 14:17
There is the issue that filenames need to be quoted differently under MS Windows and Linux/Unix. Also MikTeX and the Windows Version of TeXLive act differently here. This was for example the problem with this bug bitbucket.org/martin_scharrer/standalone/issue/2/…;. What version of standalone are you using with what LaTeX distribution (TeXLive 20?? or MikTeX ?.?)? –  Martin Scharrer Dec 7 '12 at 18:10

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.

-
without being able to contribute to the topic as such, I would be interested in your solution for OS-specific presets. The external lib uses double quotes as preset because I ran into the same problem. –  Christian Feuersänger Jan 1 '13 at 11:22
@ChristianFeuersänger: I actually just check \pdftexbanner at the moment if it includes "MikTeX". TeX Live under Windows actually works with single quotes. You can see the code at bitbucket.org/martin_scharrer/standalone/src/… –  Martin Scharrer Jan 1 '13 at 11:26
I see. Thanks for the details! –  Christian Feuersänger Jan 1 '13 at 11:30
This is great news. I have to admit that I am currently fighting to get this installed however. Is there a rule of thumb how long it will take until it can be downloaded via MikTeX? If it is short, I'd wait, otherwise I'm gonna have to figure out why MikTeX does not accept my new texmf folder. –  Matthias Kauer Jan 10 '13 at 17:08
alright, I got it installed. I used the tds package from bitbucket. I created a localtexmf as described here: tex.stackexchange.com/questions/69483/… and here tex.stackexchange.com/questions/2063/… –  Matthias Kauer Jan 11 '13 at 6:10
show 1 more comment