gptex2eps: Using gnuplot with latex to produce eps and pdf

gptex2eps is a bash script for automating the process of creating postscript or pdf images from gnuplot with embedded latex-commands and font.


Brief usage

Code your plot in a gnuplot file (with extension .gp for example, say Use at least the gnuplot commands:
set term pslatex
set output 'myfigure.tex'
And then put any latex-code inside $-signs. Note that in the plot-titles, double backslash must be used. See this full example:
set term pslatex
set output 'example2.tex'
set xlabel '$x$'
set ylabel '$\gamma(x)$'
set xrange [-2:2]
set yrange [-0.5:1.5]
plot 1/(1+x*x) title '$\\gamma(x) = \\frac{1}{1+x^2}$' with lines lt 2
which results in this postscript file: example2.eps after running the command (the gnuplot-code saved to
$ gptex2eps

Consult the postscript or pdf documentation for further help and hints.




Copy the two bash scripts to some bin-directory, for example bin in your home-directory, /usr/local/bin or something alike. Make sure they are executable by running chmod 755 gptex2eps gptex2pdf.




Håvard Berland


Steinar Kragset, for testing and comments