1

I am trying to include a tikz figure in the chapter 6 of my thesis. I am using separate folders and .tex files for each chapter, as you may notice in the example. This means that in my main document I have the following code:

\input{H6}

Inside H6.tex, I have the following

\begin{figure}
\centering
\input{./H6Figs/Eyeartable.tikz}
\end{figure}

The folder structure in a nutshell:

Main folder:
main.tex
H6.tex
  |
   --H6 (folder)
      Eyeartable.tikz
      Eyear.dat

The file Eyeartable.tikz:

\begin{tikzpicture}

\begin{axis}[
ylabel={$Daily \; Energy \; [kWh]$},
xmin=-7, xmax=371,
ymin=-50, ymax=40,
axis on top,
width=\figurewidth,
height=\figureheight,
xtick={0,59,120,181,243,304},
xticklabels={Jan 1,Mar 1,May 1,Jul 1,Sep 1,Nov 1},
legend entries={Consumed,Generated,Exchanged},
xticklabel style={anchor=north east,rotate=45}
]

\addplot[mark=none,color=blue] table[x index=0,y index=1,header=false] {"Eyear.dat"}; 
\addplot[mark=none,color=green!50.0!black] table[x index=0,y index=2,header=false] {"Eyear.dat"}; 
\addplot[mark=none,color=red] table[x index=0,y index=3,header=false] {"Eyear.dat"}; 


\end{axis}

\end{tikzpicture}

This figure shows perfectly in qtikz, but when trying to compile it in my document I get:

Package pgfplots Error: Could not read table file '"Eyear.dat"

Any help would be greatly appreciated.

Ludovic C.
  • 8,888
BartV
  • 135

1 Answers1

2

Namefiles are relative to the path of your main document, not to the path of the last input document. So you have to put your .dat file in the main folder, or to write the relative route H6Figs/ before the filename in each \addplot.

Alternatively, you can set TEXINPUTS=.//: before compiling. This basically "flattens" all your directory tree at the eyes of latex. It is not advisable if files with the same name appear in different directories.

JLDiaz
  • 55,732