#!/bin/bash # # shell script to produce EPS from gnuplot commands, using LaTeX. # # adapted from a script found on the 'Net somewhere, author unknown. # msg="usage is `basename $0` [-d] gnuplotinput.plotin" if [ -z "$1" ] then echo $msg exit 1 fi if [ "$1" = '-d' ] then debug=yes shift 1 fi if [ -z "$1" ] then echo $msg exit 1 fi file=`dirname $1`/`basename $1 .plotin` if [ ! -f ${file}.plotin ] then echo ${file}.plotin not found exit 2 fi output=${file}-temp.OUT if [ -f $output ] then rm $output fi gnuplot << EOF set terminal epslatex color set output "${file}-plot.tex" load "${file}.plotin" EOF cat << EOF >| ${file}-temp.tex \documentclass{article} \usepackage{graphicx} \usepackage{latexsym} \usepackage{mathptmx} \usepackage[scaled=.90]{helvet} \pagestyle{empty} \begin{document} \input{${file}-plot} \end{document} EOF latex -interaction nonstopmode ${file}-temp.tex 1>>$output 2>&1 if [ $? -ne 0 ] then echo "error running latex" echo output in $output exit 1 fi dvips -E -o ${file}.eps ${file}-temp.dvi 1>>$output 2>&1 if [ $? -ne 0 ] then echo "error running dvips" echo output in $output exit 1 fi if grep "Can't make it EPSF" $output 1>/dev/null 2>/dev/null then echo "error running dvips" echo output in $output exit 1 fi if [ "$debug" != "yes" ] then rm ${file}-plot.tex rm ${file}-plot.eps rm ${file}-temp.* else echo output left in $output fi