I have a strange problem with pgfplots and using a macro to return a string to a file to be included.
MWE Code:
\documentclass[a4paper,10pt]{article}
\usepackage{pgfplots}
\usepgfplotslibrary{groupplots}
\newenvironment{type}[1]{%
\newcommand\getFile[1]{%
directory1/#1/##1}
}{}
\begin{document}
\begin{type}{directory2}
File:
\begin{tikzpicture}[baseline]
\begin{groupplot}[
group style={
group size=2 by 1,
},
]
\nextgroupplot
\addplot graphics[
xmin=0,
xmax=100,
ymin=0,
ymax=100,
] {directory1/directory2/test_1.eps};
\nextgroupplot
\addplot graphics[
xmin=0,
xmax=100,
ymin=0,
ymax=100,
] {\getFile{test_1.eps}};
\end{groupplot}
\end{tikzpicture}
\end{type}
\end{document}
Error:
LaTeX Error: File `directory1/directory2/test_1.eps' not found.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.33 \end{groupplot}
Comment out the second plot and the first plot works fine, so the file is there, the directories can be found and pgfplots can include the file fine. Include he second with the macro returning the correct file (it says so in the error) and it can't find it.
\foreach– Werner Nov 16 '15 at 05:20