[Tex/LaTex] .eps file not generated using epslatex

epsgnuplot

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.

Best Answer

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}