0

I use gnuplot with the term cairolatex to create and incorporate graphics to my LaTeX projects. This terminal returns two files. One is *.tex and the other one is *.svg.

But I'm having trouble when I try to organize the project into different directories. For instance, I've created a folder \fig for all the figures. To include them, I use the piece of code below.

\begin{figure}[H]
  \centering
  \scalebox{0.55}{\input{project/fig/fig1.tex}}
  \caption{some caption}
  \label{fig:some label}
\end{figure}

But when I do so, even though, when both files are in the directory project/fig/ it seems like just the file *.tex is imported.

I've got something like this:

What I get

But I'm expecting this:

What I expect

It's a bit annoying because sometimes I have to manage several figures.

1 Answers1

1

If you look inside the file fig1.tex, you will find a line like this

\put(0,0){\includegraphics{fig1}}%

This means that TeX expects the file fig.svg or fig1.pdf in the current directory, i.e. the directory where your main tex file resides. However, the file is in project/fig/ directory, so TeX cannot find it.

Try adding the subdirectory to graphicspath:

\graphicspath{{project/fig1/}{another subdirectory}{yet another directory}...}

Another option is directly editing tex files produces by gnuplot to give the explicit location of included graphics files.

Boris
  • 38,129
  • It didn't work :c I added the line \graphicspath{{project/fig}} in the header of the main.tex file. – Gabriel Sandoval May 12 '19 at 20:32
  • 1
    You should use project/fig/ with the trailing slash, see https://tex.stackexchange.com/questions/139401/how-to-use-graphicspath – Boris May 12 '19 at 21:22