#!/bin/bash
PATH=$PATH:/mnt/vm/programme/texlive/bin/x86_64-linux/

# build pdf
# one page per image
pdflatex exp
rm exp.log
rm exp.aux

# convert each PDF page to a PNG image
convert -density 300 exp.pdf -background white -alpha remove image%d.png

# convert each PDF page to an EPS image
for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
do
	pdftops -f $i -l $i -eps "exp.pdf" "image$i.eps"
done