Please, how one could directly include epslatex graphics into main latex file, say main.tex
? main.tex
has its own template provided by a third party. I used this command within main.tex
file to include the fig:
\def \Fig{figures/results1/figure}
...
\begin{figure*}[thpb]
\centerline{
\subfigure[]{\bimOther{\input{\Fig}} }
...
}
\end{figure*}
where figure is first generated under gnuplot as follows
set terminal epslatex 8 color colortext
set output '/tmp/figure.tex'
...
set macros
filename = "'/tmp/data/signal.dat'"
plot @filename u 1:2 w l ls 1 linecolor rgb "red" notitle
The issue is that when using \input
command, the main latex file (main.tex) will look to the path specified by gnuplot, and not that specified in its core, i.e. figures/results1/
in our example. This does not allow for portability. Assume that we have different successive trial results, i.e, figure_1, …., figure_n. How one could include them, after noticing that the /tmp file would be reverted after each trial?
One solution would be to create for each trial a separate gnuplot code, which is clearly aberrant!
Any help please? I spend more than one day trying to fix this issue….
Best Answer
Directory structure
Assume the following directory structure
File contents
The two document files yield the following content
figure.gnuplot
:main.tex
:Instructions to reproduce
Go to the directory
figures/results1/
and executeTwo files will appear:
figure.tex
andfigure.pdf
.Now go back to the root folder of your document (where
main.tex
is) and compilemain.tex
using any engine, that can handle PDF files (notlatex
, butpdflatex
,xelatex
orlualatex
).DONE!
Remarks
Using this method you get a PDF file of your figure instead of an EPS, which needs to be converted to PDF.
On the other hand, you need to change all the filenames (maybe directories as well) for every new plot.