How to prepare eps files with beautiful LaTeX letters?


Scientific figures frequently require LaTeX letters for mathematical symbols as the axis label, for instance.


One solution is to use the "epslatex" option of gnuplot (v4).

Necessary softwares


Let be the test script file of gnuplot(v4) to create a beautiful eps file. The file name ( is arbitrary. You have
  1. Prepare a gnuplot script file (named
  2. Create tex and eps files (test.tex, test.eps)
  3. Include test.tex in a tex file (named include.tex)
  4. Compile the include.tex
  5. Get out the figure part

Step1: Prepare a gnuplot script file (
set term epslatex color
set output "test.eps"
set xlabel '{\Large $x$}'
set ylabel '{\Large $e^{\alpha x}$}'
set label 1 '{\Large $\alpha=0.1$}' at 1,1
plot exp(0.1*x)
unset label

Step2: Create tex and eps files (test.tex, test.eps)

prompt> gnuplot
prompt> ls test*
test.eps test.tex
The created test.eps has the graph part only as:

Step3: Include test.tex in a tex file (include.tex : name is arbitrary)


Step4: Compile the include.tex

prompt> latex include.tex
The created include.dvi has unnecessary space. In the next step, we get out the figure part only.

Step5: Get out the figure part

prompt> dvips -E include.dvi
prompt> epstopdf --outfile=include.pdf
prompt> pdftops -eps include.pdf test.eps
prompt> rm include.{aux,dvi,log,ps,pdf}
The 2nd and 3rd lines are for nice preview by xdvi with the package:

The created eps file is:
test.eps (final form)


It is convenient to use a shell script file to automatically execute the above commands.
#!/bin/csh -f
set includefile="include"
foreach gpfile ( "test" ) (You may add the script files as ( "test" "test2" "test3" ) )
ech ${gpfile}.gp
gnuplot ${gpfile}.gp
latex ${includefile}
dvips -E ${includefile}.dvi
epstopdf --outfile=${includefile}.pdf ${includefile}.ps
pdftops -eps ${includefile}.pdf ${gpfile}.eps
rm ${includefile}.{aux,dvi,log,ps,pdf} ${gpfile}.{tex,log} (cleaning up unnecessary files)

prompt> chmod u+x
prompt> ./

Last modified: Fri Aug 25 09:54:01 JST 2017