#!/bin/bash
for i in $* ; do
 i=`basename $i .tex`
 latex $i

 dvips -t a5 -pp2 $i -o /tmp/hfstlumpi.ps;

# Usage: pstogif [-h(elp)] [-out <output file>] 
#                [-depth <color depth 1, 8 or 24>]  
#                [-flip <Flip_code>] [-density <pixel density>] <file>.ps

# pstogif -out ./"$i"_2.gif /tmp/hfstlumpi.ps;
echo quit|gs -dNOPAUSE -sDEVICE=pngmono -sOutputFile=./"$i"_2.png -sPAPERSIZE=a5 /tmp/hfstlumpi.ps;

 dvips -t a5 -pp3 $i -o /tmp/hfstlumpi.ps;
echo quit|gs -dNOPAUSE -sDEVICE=pngmono -sOutputFile=./"$i"_3.png -sPAPERSIZE=a5 /tmp/hfstlumpi.ps;
done
