3

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).


Settings

  • 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.

MWE

I have the following file tree

mwe.tex
spa ces/mwefig.tex

The files are as follows:

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

\begin{document}%

\includestandalone{"spa ces/mwefig"}%

\end{document}%

and

% spa ces/mwefig.tex
\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat = newest}

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

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 Jan 28 '16 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 Jan 28 '16 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 Jan 28 '16 at 10:52
  • @Ritz: asked because didn't work for me on Linux, but worked fine after adding -shell-escape – filippo Jan 28 '16 at 11:16
2

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

\documentclass{article}
\usepackage[mode = buildnew]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat = newest}
\makeatletter

\begin{document}%

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

\end{document}

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 Jan 28 '16 at 12:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.