# .eps file not generated using epslatex

I am trying to do a plot using epslatex interface of gnuplot where I am using latex command for labelling the y-axis and then include the plot in another TeX file. I am writing the following steps but somehow the .eps file is not generated, only the .tex file is generated. Please help.

reset
set terminal epslatex
set term postscript colour enhanced
set term postscript eps enhanced 26
set output "pb_sp_I=6.tex"

set style data lines
set size 1,1
set origin 0,0
set multiplot
set size 1,1
set origin 0,0
set log

set xlabel "t" font "Times-Roman,30"
set ylabel "$P_t(\\ell)$"

set format y  "10^{%L}"
set format x  "10^{%L}"

set xr [0.1:10000]
set yr [0.000001:1.2]

p 'sp_I=6.out' u 1:2 w l title 'I=6' lc 1 lw 2, 1800/x**1.5 lw 2 title 't^{-1.5}', 1.7/x**0.5 lw 2 title 't^{-0.5}'


I removed the line

set term postscript eps enhanced


and it is now producing 2 files, pb_sp_I=6.eps and pb_sp_I=6.tex. Then I converted EPS to PDF. I included the .tex file above in another .tex file, say a.tex, by writing the following :

\begin{center}
\input{pb_sp_I=6.tex}
\end{center}


Then I compile a.tex using the command :

pdflatex a.tex


But the output contains the figure file only with the axes, tics, lines but the y-axis labeling in latex ($P_t(\\ell)$) is not there. Please advise if I am missing something.

Your gnuplot script has many flaws:

• you can use only one terminal, so the set term postscript lines should be removed;
• avoid using underscores in your files, because they will cause problems;
• the multiplot mode should be closed and the output should be reset, otherwise the output file won't be closed;
• as pointed out by Christoph, the set origins and set sizes are useless;
• you have to wrap dollar signs around all labels, otherwise ^ will throw errors.

This is a revised version of your gnuplot script:

reset
set terminal epslatex color colortext
set output "pbspI=6.tex"

set style data lines
set multiplot
set log

set xlabel "$t$"
set ylabel '$P_\ell(t)-P_\ell(\infty)$'

set format y  '$10^{%L}$'
set format x  '$10^{%L}$'

set xr [0.1:10000]
set yr [0.000001:1.2]

plot 'sp_I=6.out' u 1:2 w l title '$\ell=6,N=20$' lc 1 lw 2, \
1800/x**1.5 lw 2 title '$t^{-1.5}$', \
1.7/x**0.5 lw 2 title '$t^{-0.5}$'
unset multiplot
set output


This is the .tex file in which the picture will be included:

\documentclass{article}
\usepackage{graphicx}
\begin{document}
\begin{figure}
\centering
\input{pbspI=6.tex}
\end{figure}
\end{document}

• @S.D do you mind marking the answer as accepted? This will remove it from the unanswered queue. Thank you :-). – giordano Jan 19 '14 at 16:42
• Not at all ! :-D – S.D Jan 19 '14 at 16:47
• I made some changes in the revised version of the gnu postscript by Sir giordano. They are 1.set terminal epslatex color colortext 2. set ylabel "$P_\\ell(t)-P_\\ell(\\infty)$" 3.plot title as "$\\ell=6\\,N=10$". Again I get 2 files but the tex file is not generated properly I guess. The error I am getting is File pbspI=6' not found and \put(0,0){\includegraphics{pbspI=6}} at line no.103 of tex file. Kindly advise. – S.D Jan 20 '14 at 18:32
• @S.D I updated the answer with your changes, excluding the third because I didn't get it (which title do you want to change?). You say that running the gnuplot script generates two files, which? pbspI=6.tex and pbspI=6.eps (this file should be converted to PDF, if you have a recent TeX Live distribution this will be done automatically)? – giordano Jan 20 '14 at 19:51
• Some other remarks: You can omit all those set size and set origin stuff. And you should use the standalone terminal option. Last point: for convenience, at the end of the document you can write a system('latex pbspI=6.tex && dvips pbspI=6.dvi && ps2pdf pbspI=6.ps && pdfcrop --margins 1 pbspI=6.pdf pbspI=6.pdf'). If you're using Windows you must split that single system` call in one call for each command. – Christoph Jan 21 '14 at 14:55