Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am trying to generate a pgfplot with data in a textfile as a standalone document. I am using the 1.2 version of standalone from https://bitbucket.org/martin_scharrer/standalone/downloads because it makes the package useable on Windows in the first place. I am not sure why this hasn't found its way to CTAN yet.

My file structure is as follows:

/main.tex
/tikzdir/myplot.tex
/tikzdir/plotdata/input_all.txt

In input_all.txt I have some data:

x y u v
1 1 1.0391310000000000269 0.95451609999999997846 
0.96086930000000003727 1.0454840000000000799 1.0099340000000001094 1.0800190000000000623 

myplot.tex is the standalone document that creates the plot

\documentclass[tikz]{standalone}
\usepackage{pgfplots} 

\begin{document}
\providecommand{\plotdataDir}{plotdata}

\begin{tikzpicture}
\begin{axis}
\addplot table {\plotdataDir/input_all.txt};
\end{axis}
\end{tikzpicture}
\end{document}

main.tex includes myplot.tex

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

\begin{document}
\providecommand{\plotdataDir}{tikzdir/plotdata}

\begin{figure}
\includestandalone{tikzdir/myplot}
\caption{test}
\end{figure}

\end{document}

Now, when I compile myplot.tex directly everything works as expected. If I then compile main.tex, the created pdf is found and again, everything is fine.

However, if I directly want to compile main.tex then the data in input_all.txt is somehow missing and I get an empty plot without data. I tried to remedy this by using \providecommand to specify \plotdataDir, but it didn't help. There is also no error indicating that the data could not be found, so I'm a bit stumped.

Do you have other tips to handle a situation like this?

share|improve this question

closed as off-topic by Joseph Wright Aug 10 '13 at 9:29

  • This question does not fall within the scope of TeX, LaTeX or related typesetting systems as defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

    
Perhaps a problem with the underscore? You could try "\plotdataDir/input_all.txt". –  Peter Grill Mar 12 '13 at 7:43
3  
I had no problem to compile your file with the standalone version v1.1b (which comes with miktex) after I added \usepackage{pgfplots} to the main file (and naturally used --shell-escape). –  Ulrike Fischer Mar 12 '13 at 8:45
    
Hi, thanks for the suggestions: I tried your suggestions: 1) removing the underscore and adding quotes: no effect. 2) already using shell-escape (Process started: pdflatex -synctex=1 -shell-escape -interaction=nonstopmode "main".tex). 3) adding pgfplots also did not help. Let me reiterate that the issue is not that it won't compile, but that the plot is empty (no data) if I only compile the main document. –  Matthias Kauer Mar 19 '13 at 10:50
    
This question appears to be off-topic because it is about an issue which is not reproducible. –  Joseph Wright Aug 10 '13 at 9:29

Browse other questions tagged or ask your own question.