background image
done
If you want you may even insert the following line at the end of your gnuplot files and the
figs will be created instantly.
system "~/figconverter *.fig"
This converts all files so please change if necessary!
B
Script: gnuplot
⇒ Xfig ⇒ PDF+TEX
This is a more advanced Bash script that will save your plots and convert the fig-file to pdf-
and pdf t-files and put them in folder of your choice. You should place it in same directory as
your gp-files and run it from there.
It has been used in the creation of this document and its settings suppose the gp-files are
located in a directory called gp, directly under the TEX-document. It will look for the fig-files
in the directory gp/plot and also save all plots to that directory. This results in typing
\input
gp/plot/xxx.pdf t to insert a figure.
#!/bin/bash
#### Set your paths:
# Path to fig-file relative this script’s location, ie where gnuplot saves the fig:
figpath="plot/"
# Path to pdf- and pdf_t-files relative this script’s location, where to output pdf*:
pdfpath="plot/"
# Path to pdf- and pdf_t-files relative your TeX document:
texpath="gp/plot/"
#### Settings done!
if [[ $# -eq 0 ]]
then
echo "Usage: $0 file1 [file2 ... fileN]"
exit 1
fi
for filename; do
file=${filename%.gp} # Removes file ending ".gp"
file_gp="$filename"
file_fig="$file.fig"
file_pdf="$file.pdf"
file_pdf_t="$file.pdf_t"
gnuplot $file_gp
fig2dev -L pdftex $figpath$file_fig $pdfpath$file_pdf
fig2dev -L pdftex_t -p $texpath$file_pdf $figpath$file_fig $pdfpath$file_pdf_t
done
16