#!/bin/bash
#
# $Id: runAll 3 2010-04-25 12:53:25Z herbert $
#

for FILE in `ls *.ltxbps 2>/dev/null`
do
    F=`basename $FILE .ltxbps` 
    echo "run file $FILE ($F) with latex ... "
    latex $FILE
    bibtex $F.aux
    latex $FILE
    latex $FILE
#    dvips -T 297mm,210mm $F.dvi
    echo "run file $F.dvi with dvips ..."
    dvips $F.dvi -o $F.ps
    echo "run file $F.ps with ps2pdf ..."
    ps2pdf -dAutoRotatePages=/None -dNoSafer $F.ps
    rm -f *.log *.bm *.vrb *.toc *.blg *.dvi *.ps *.nav *.out *.snm *.aux *.bbl
done

for FILE in `ls *.ltxpd 2>/dev/null`
do
    F=`basename $FILE .ltxpd` 
    echo "run file $FILE ($F) with latex ... "
    latex $FILE
    bibtex $F.aux
    latex $FILE
    latex $FILE
#    dvips -T 297mm,210mm $F.dvi
    echo "run file $F.dvi with dvips ..."
    dvips $F.dvi -o $F.ps
    echo "run file $F.ps with ps2pdf ..."
    ps2pdf -dAutoRotatePages=/None -dNoSafer $F.ps
    rm -f *.log *.bm *.vrb *.toc *.blg *.dvi *.ps *.nav *.out *.snm *.aux *.bbl
done

for FILE in `ls *.ltx2 2>/dev/null`
do
    F=`basename $FILE .ltx2`
    pdflatex $FILE
    bibtex $FILE
    pdflatex $FILE
    pdflatex $FILE
    rm -f *.log *.bm *.vrb *.toc *.blg *.dvi *.ps *.nav *.out *.snm *.aux *.bbl
done

for FILE in `ls *.ltxb 2>/dev/null`
do
    F=`basename $FILE .ltxb`
    pdflatex $FILE
    bibtex $FILE
    pdflatex $FILE
    pdflatex $FILE
    rm -f *.log *.bm *.vrb *.toc *.blg *.dvi *.ps *.nav *.out *.snm *.aux *.bbl
done

for FILE in `ls *.ltx 2>/dev/null`
do
    F=`basename $FILE .ltx`
    pdflatex $FILE
    bibtex $FILE
    pdflatex $FILE
    pdflatex $FILE
    rm -f *.log *.bm *.vrb *.toc *.blg *.dvi *.ps *.nav *.out *.snm *.aux *.bbl
done


exit 0
