I want to include a TikZ figure located in a subdirectory that has a space in its name using the standalone package with the option mode = buildnew. However, I encounter an error, which seems related to the type of quotes that are used. Please only suggest to change the file tree to have no spaces if that is the only possible way to resolve this issue (my actual problem involves many subdirectories and files in various different locations).


  • My OS is Windows 7 SP 1;
  • I use WinEdt 9.1 and compile using the PDFTeXify button;
  • In Options > Executions Modes > Console Applications > Accessoiries PDFLaTeX I have added the switch --enable-write18;
  • The MiKTeX version is 2.9;
  • The pgfplots package is version 1.13;
  • The standalone package is version 1.2.


I have the following file tree

spa ces/mwefig.tex

The files are as follows:

% mwe.tex
\usepackage[mode = buildnew]{standalone}
\pgfplotsset{compat = newest}


\includestandalone{"spa ces/mwefig"}%



% spa ces/mwefig.tex
\pgfplotsset{compat = newest}

\draw (0,0) -- (1,1);%

The error that I get is

Package standalone Warning: Graphic '"spa ces/mwefig".pdf' could not be build.
Shell escape activated? on input line 9.

Edit It seems the problem at the moment has nothing to do with the spaces. I added the exact same file mwefig.tex to a different subdirectory to create the location nospaces/mwefig.tex and when I then replace \includestandalone{"spa ces/mwefig"}% by \includestandalone{nospaces/mwefig}% I get the similar error

Package standalone Warning: Graphic 'nospace/mwefig.pdf' could not be build.
Shell escape activated? on input line 9.

So, the problem indeed seems to lie with the shell escape. I should resolve this issue first, any ideas?

Edit 2 The case without spaces (nospace/mwefig.tex) now works by doing: In Options > Executions Modes > Console Applications > Accessoiries PDFTeXify I have set the switches to --pdf --tex-option=-shell-escape. The issue with spaces persists, however.

  • Guess you already tried what the error message suggests, right? I mean, adding -shell-escape to command line options
    – filippo
    Commented Jan 28, 2016 at 10:30
  • @filippo I thought that the --enable-write18 switch took care of that. I tried these switches (see third bullet point in the OP): --enable-write18; --enable-write18 -shell-escape; and -shell-escape, but all of those reproduced the exact same error message.
    – Ritz
    Commented Jan 28, 2016 at 10:41
  • Works ok on Linux without any change. So it must be some strange thing with / versus ` \ ` (although I suppose it should be taken care of...). I tried to add a tag in that sense, I hope you don't mind.
    – Rmano
    Commented Jan 28, 2016 at 10:52
  • @Ritz: asked because didn't work for me on Linux, but worked fine after adding -shell-escape
    – filippo
    Commented Jan 28, 2016 at 11:16

1 Answer 1


Imho it is a standalone bug. It quotes the jobname but not the file name. You can try something like this:

\usepackage[mode = buildnew]{standalone}
\pgfplotsset{compat = newest}


\includestandalone[build={quote={}}]{"test with space/mwefig"}%


But you can save yourself a lot of time and trouble if you simply avoid spaces in file and folder names. It is quite possible that the solution breaks if you move the file to some other OS or use another texsystem in the future and then you will struggle again with the spaces ...

  • Thanks, it seems I'll just need to go through the one-time pain of fixing all folder names.
    – Ritz
    Commented Jan 28, 2016 at 12:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .