#!/usr/bin/perl -w use strict; my @bstfiles= qw(qje jf jfe abbrv abbrvnat abstract abstract acm adrconv adrfax aer alpha amsalpha amsplain amsxport apalike apsrev apsrmp birthday chicago chicagoa cje email gerabbrv geralpha gerapali gerplain gerunsrt ieeetr jpe jurabib jureco jurunsrt plabbrv plain plainnat plalpha plplain plunsrt siam unsrt unsrtnat jb jf jf jfe jfe neweconometrica rfs); if (@ARGV) { @bstfiles= @ARGV; } foreach my $bstfile (@bstfiles) { print STDERR "working on $bstfile!\n"; system("sed 's/REPLACEME/$bstfile/' < template.tex > $bstfile.tex"); my $i=system("pdflatex --interaction batchmode $bstfile.tex"); ($i==0) or warn "\n\nLATEX PROBLEM\n\n"; $i=system("bibtex $bstfile"); ($i==0) or warn "\n\nBIBTEX PROBLEM\n\n"; system("pdflatex --interaction batchmode $bstfile.tex"); system("pdflatex --interaction batchmode $bstfile.tex"); system("rm $bstfile.aux $bstfile.blg $bstfile.log $bstfile.tex $bstfile.bbl"); system("cp -rf `locate $bstfile.bst` ."); }