summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/xelatex/persian-bib/gen_pdf.pl
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2011-07-29 14:11:15 +0000
committerKarl Berry <karl@freefriends.org>2011-07-29 14:11:15 +0000
commit3af8d5df17178a99b098a782c231b0060fd29b4d (patch)
treea361060a2e13cc7c591b7a0d19e657b67efe1320 /Master/texmf-dist/doc/xelatex/persian-bib/gen_pdf.pl
parenta236120bc64ff6dadaf9fcc1494099fcfb7ca7da (diff)
persian-bib (11jul11)
git-svn-id: svn://tug.org/texlive/trunk@23267 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/xelatex/persian-bib/gen_pdf.pl')
-rw-r--r--Master/texmf-dist/doc/xelatex/persian-bib/gen_pdf.pl55
1 files changed, 55 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/xelatex/persian-bib/gen_pdf.pl b/Master/texmf-dist/doc/xelatex/persian-bib/gen_pdf.pl
new file mode 100644
index 00000000000..5e2e56a944e
--- /dev/null
+++ b/Master/texmf-dist/doc/xelatex/persian-bib/gen_pdf.pl
@@ -0,0 +1,55 @@
+##########################################################
+# Author: Mahmood Amintoosi #
+# Date: 10 Feb 2011 #
+# Version: .10 #
+# Application: Produce pdf files of Persian-bib styles #
+##########################################################
+
+use File::Copy;
+
+open(INFILE,"bibtex-example.tex");
+
+@styleList = ("acm-fa","plain-fa","unsrt-fa","ieeetr-fa","asa-fa","chicago-fa","plainnat-fa");
+@natbibStyles = ("asa-fa","chicago-fa","plainnat-fa");
+
+@lines = <INFILE>;
+foreach $style (@styleList)
+{
+ $fileName = $style.".pdf";
+ $tmpFile = "tmp";
+ open(OUTFILE,">".$tmpFile.".tex");
+ print $fileName;
+ foreach $line(@lines)
+ {
+
+ $a = $line;
+ #Checking wether natbib package is required or not
+ $natbibRequired = 0;
+ foreach $natbibStyle(@natbibStyles)
+ {
+ if($style eq $natbibStyle)
+ {
+ $natbibRequired = 1;
+ #last;
+ }
+ }
+# print $natbibRequired;
+ if ($natbibRequired==1 && $a =~ /usepackage{xepersian}/)
+ {
+ print OUTFILE "\\usepackage{natbib}\n";
+ }
+ $a =~ s/acm-fa/$style/;
+ print OUTFILE $a;
+ }
+
+ close (OUTFILE);
+ system("xelatex",$tmpFile);
+ system("bibtex8","-W","-c","cp1256fa",$tmpFile);
+ system("xelatex",$tmpFile);
+ system("xelatex",$tmpFile);
+ copy($tmpFile.".pdf",$fileName) or die "Copy failed: $!";
+ unlink <tmp.*>;
+ #seek(INFILE,0,SEEK_SET);
+ }
+ close (INFILE);
+