I include plots using matlab2tikz to generate tikz-files. There was a nice feature added which enables external datasets. A file plot.tikz is generated with the following code (unnecessary code is skipped):
\begin{tikzpicture}
\begin{axis}
\addplot table[row sep=crcr]{plot-1.tsv};
\end{axis}
\end{tikzpicture}%
plot-1.tsv is located in the same directory as plot.tikz and has the following content
0 1.10061021788087
0.1 1.54421189550395
In my latex directory I have my figures organized in /fig/chapterXX
I have a custom command with which I include my figures: \includetikz{folder}{tikz-file}, e.g. \includetikz{fig/chapter3}{plot} (this custom command includes the file plot.tikz with the \input{}-command)
My problem is now: Latex expects the file plot-1.tsv relative to its tex-file. If I want to get it to run, I need to manually change the \addplot in the file plot.tikz to \addplot table[row sep=crcr]{fig/chapter3/plot-1.tsv};. I have to do this in each tikz-file and I need to know in advance where I will put the tikz-file.
Is it possible to tell pgfplots that plot-1.tsv is relative to the file plot.tikz?
\newcommand{\myinsertplot}[1]{\addplot table[row sep=crcr] {fig/chapter3/#1.tsv};}. – 1010011010 Oct 17 '14 at 09:05\subimportfrom the import package, instead of\input? See http://tex.stackexchange.com/a/60227/12440 – Fritz Oct 17 '14 at 09:20\importor\subimportit is not working. I guess, it is because of pgf which loads the tsv-file within the tikz-file using the\addplot-command. – bene Oct 17 '14 at 10:44\addplot table[row sep=crcr]{\relativepath plot-1.tsv};– bene Oct 17 '14 at 12:55table/search pathoption that was introduced in PGFPlots v1.13 and works similar to\graphicspath? (Have a look at http://tex.stackexchange.com/questions/35863/pgfplots-from-file-search-path-looking-for-graphicspath-equivalent for more details.) – Stefan Pinnow Nov 02 '16 at 22:54