The package import makes it posible to \input (and \include) a .tex document which itself \input (or \includegraphics etc.) stuff using relative paths. I was hoping that this also would work with the \addplot file in pgfplots, but it does not. Is there a way to use relative paths in pgfplots?
Failing example: Place main.tex anywhere and edit path to fig.tex. - File fig.tex, input.tex and plot.dat in same directory. I can compile the standalone fig.tex, but main.tex can not find plot.dat.
main.tex
\documentclass{article}
\usepackage{import}
\usepackage{standalone}
\usepackage{pgfplots}
\begin{document}
mainMain
\import{\absolute\path\to\fig.tex}{fig.tex}
\end{document}
fig.tex
\documentclass{standalone}
\usepackage{pgfplots}
\begin{document}
\input{input.tex} %this is ok
\begin{tikzpicture}
\begin{axis}
\addplot file {plot.dat}; %this is not working
\end{axis}
\end{tikzpicture}
\end{document}
input.tex
anything
plot.dat
1 2