# Tip for using standalone with pgfplots & data files (and a question about CTAN)

Issue #10 open
Matthias Kauer created an issue

Dear Mr Scharrer, I want to use the standalone package in conjunction with pgfplots and additional data csv files in different subfolders. I am trying to indicate the subfolders by issuing \providecommand{\plotdataDir}{../data} in myplot.tex vs \providecommand{\plotdataDir}{./data} in main.tex (notice single dot)

This was a question on http://tex.stackexchange.com/questions/102055/standalone-pgfplot-with-extra-include-in-subdirectory-no-output (closed there as non-reproducible, probably because I wasn't clear enough, so I'll try again - MWE files are slightly different)

I am using standalone version 1.2 from 2012/12/31, installed by compiling latex standalone.ins (Miktex on Win7).

I attached the minimal example that I'd like to set up. To reproduce the issue, do the following: 1) Delete all the pdf that standalone may have already created. 2) Compile main.tex => plot is empty (this didn't occur with v1.1 (or whichever version Miktex had installed by default before I upgraded; it was quite recent though) 3) Compile tikz/myplot.tex => now you see a line in tikz/myplot.pdf 4) Compile main.tex => line also in main.pdf now (unsurprisingly)

I am unsure why providecommand now doesn't work anymore as I would have expected.

Best Regards, Matthias Kauer

PS: I tried selecting v1.2 below, but it wasn't there yet. PPS: Will v1.2 make it to CTAN/Miktex soon?

1. reporter

Ok, this is weird. I downloaded my own MWE again and now it is working here; I'll have to check some more and will probably have to include the cls, sty files etc. that I created during installation.

2. reporter

Going at it again: standalone 1.1b => works, but actually recreates the pdf file every time (issue with apostrophe that you fixed in 1.2, thank you again)

latex standalone.ins creates standalone.cls, sty, tex, cfg

Now running again with standalone 1.2 and it still works (confusion sets in)

I am wondering if this has to do with the fact that I am now compiling from a subfolder of the original folder => move somewhere else, compile again and the behavior is as in post 1.

Here is some additional info from my side:

I have downloaded your minimal example and it does produces an empty plot, without any error message or warning, if I use

```pdflatex -shell-escape main.tex
```

However, the problem disappears if I use

```pdflatex main.tex
```

or if I set mode=tex. Is this behavior intended, or a bug? I have TeX 3.1415926 (TeX Live 2013/Debian) and standalone 1.1b

3. repo owner
• changed status to open

I tested this now with the current trunk and get the same behaviour.

4. repo owner

The problem here seems to be that the automated build happens in the main folder, not in the tikz subfolder. Therefore the `\plotdataDir` macro points to the wrong directory.

Note that the internal call is like this:

```pdflatex -interaction=batchmode -shell-escape -jobname 'tikz/myplot' tikz/myplot
```

In the tikz/myplot.log file you then find the following error message:

```! Package pgfplots Error: Could not read table file '../data/myplot.csv'. In case you intended to provide inline data: maybe TeX screwed up your end-of-lines?
Try `row sep=crcr' and terminate your lines with `\\' (refer to the pgfplotstable manual for details).
```