summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2013-07-06 21:46:50 +0000
committerKarl Berry <karl@freefriends.org>2013-07-06 21:46:50 +0000
commitc1b826d7ea445481132bbc36bf68b152bf5e1091 (patch)
tree9266a555fd14e21a5e0bdafc8b48f35624cfd876
parent832b5ce3848de5ca76c493570fc066f450ec8011 (diff)
pst2pdf (6jul13)
git-svn-id: svn://tug.org/texlive/trunk@31118 c570f23f-e606-0410-a88d-b1316a301751
-rwxr-xr-xBuild/source/texk/texlive/linked_scripts/pst2pdf/pst2pdf.pl513
-rw-r--r--Master/texmf-dist/doc/latex/pst2pdf/Changes9
-rw-r--r--Master/texmf-dist/doc/latex/pst2pdf/README26
-rw-r--r--Master/texmf-dist/doc/latex/pst2pdf/pst2pdf-doc.bib21
-rw-r--r--Master/texmf-dist/doc/latex/pst2pdf/pst2pdf-doc.pdfbin72601 -> 76161 bytes
-rw-r--r--Master/texmf-dist/doc/latex/pst2pdf/pst2pdf-doc.tex55
-rw-r--r--Master/texmf-dist/doc/latex/pst2pdf/test.pdfbin0 -> 68528 bytes
-rw-r--r--Master/texmf-dist/doc/latex/pst2pdf/test.tex408
-rw-r--r--Master/texmf-dist/doc/latex/pst2pdf/test2.pdfbin0 -> 20917 bytes
-rw-r--r--Master/texmf-dist/doc/latex/pst2pdf/test2.tex10
-rw-r--r--Master/texmf-dist/doc/latex/pst2pdf/test3.tex10
-rwxr-xr-xMaster/texmf-dist/scripts/pst2pdf/pst2pdf.pl513
12 files changed, 1067 insertions, 498 deletions
diff --git a/Build/source/texk/texlive/linked_scripts/pst2pdf/pst2pdf.pl b/Build/source/texk/texlive/linked_scripts/pst2pdf/pst2pdf.pl
index 040cdf7e7dd..568f0aef049 100755
--- a/Build/source/texk/texlive/linked_scripts/pst2pdf/pst2pdf.pl
+++ b/Build/source/texk/texlive/linked_scripts/pst2pdf/pst2pdf.pl
@@ -4,9 +4,9 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' && eval 'exec perl -S $0 $
use strict; # to be sure, that all is safe ... :-)
# $Id: pst2pdf.pl 611 2011-12-14 08:41:35Z herbert $
-# v. 0.14 simplify the use of PSTricks with pdf
+# v. 0.15 simplify the use of PSTricks with pdf
# 2011-12-12 (c) Herbert Voss <hvoss@tug.org>
-# Pablo González Luengo
+# Pablo González Luengo
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -28,116 +28,104 @@ use File::Copy; # copying files
use File::Basename; # scan argument
use IO::File; # simple IO operation
use Getopt::Long; # read parameter
-use autodie;
+use autodie; # more safe
#----------------------- User part begin ------------------------
-my $imageDir = "images";# where to save the images
+my $imageDir = "images"; # where to save the images
my $Iext = ".pdf"; # leave empty, if not a special one
my $tempDir = "."; # temporary directory
-my $verbose = 0; # 0 or 1, logfile
-my $clear = 0; # 0 or 1, clears all temporary files
-my $DPI = 75; # very low value for the png's
-my $Iscale = 1; # for \includegraphics
-my $noImages = 0; # 1->create no images
-my $single = 0; # 1->single create images
+my $verbose = 0; # 0 or 1, logfile
+my $clear = 0; # 0 or 1, clears all temporary files
+my $DPI = 75; # very low value for the png's
+my $Iscale = 1; # for \includegraphics
+my $noImages = 0; # 1->no create images
+my $single = 0; # 1->create images in single mode
my $runBibTeX = 0; # 1->runs bibtex
-my $runBiber = 0; # 1->runs biber and sets $runBibTeX=0
-my $ppm = 0; # 1->create .ppm files
-my $norun = 0; # 1->runs pdflatex
-my $eps = 0; # 1->create .eps files
-my $files = 0; # 1->create image files .tex
-my $all = 0; # 1->create all images and files for type
-my $nopdftk = 0; # 1->create all images and files for type in single mode
-my $xetex = 0; # 1->Using XeLaTeX for compilation.
+my $runBiber = 0; # 1->runs biber and sets $runBibTeX=0
+my $jpg = 0; # 1->create .jpg files
+my $png = 0; # 1->create .png files
+my $ppm = 0; # 1->create .ppm files
+my $eps = 0; # 1->create .eps files
+my $files = 1; # 1->create image files .tex
+my $all = 0; # 1->create all images and files for type
+my $xetex = 0; # 1->Using (Xe)LaTeX for compilation.
+my $PS2 = " "; # Options for ps2pdf
#----------------------- User part end ---------------------------
#-------------- program identification, options and help ---------
my $program = "pst2pdf";
+my $nv="0.15";
my $ident = '$Id: pst2pdf.pl 611 2011-12-14 08:41:35Z herbert $';
my $copyright = <<END_COPYRIGHT ;
-Copyright 2011-01-18 (c) Herbert Voss <hvoss\@tug.org>
+Copyright 2011-2013 (c) Herbert Voss <hvoss\@tug.org> and Pablo González.
END_COPYRIGHT
my $licensetxt= <<END_LICENSE ;
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
-
- This program is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- MA 02111-1307 USA
+
END_LICENSE
-my $title = "$program $ident\n";
+my $title = "$program $nv $ident\n";
my $usage = <<"END_OF_USAGE";
${title}Usage: $program <texfile.tex> [Options]
-pst2pdf run a TeX source, and convert all PS-related part as
- single images (pdf or eps or ppm, default pdf)
- and then runs pdflatex. See pst2pdf documentation for more info
+pst2pdf run a TeX source, read all PS-related part and convert in
+ single images in pdf,eps,jpg or png format (default pdf) and
+ create new file whitout pst-enviroment and runs (pdf/Xe)latex.
+ See pst2pdf documentation for more info.
Options:
- --help - display this help and exit
- --version - display version information and exit
- --license - display license information and exit
- --imageDir - the dir for the created images (default images)
- --DPI=<int> - the dots per inch for a cretaed ppm files (default 75)
- --ppm - create .ppm files
- --eps - create .eps files
- --Iscale=<real> - the value for [scale=] in \\includegraphics
- --noImages - generate files without compile (need -norun)
- --verbose - creates long log
- --clear - delete all temp files
- --norun - create file-pdf.tex, but, no run pdflatex
- --runBibTeX - run bibtex on the aux file, if exists
- --runBiber - run biber on the bcf file, if exists
- --files - create images files (.tex) for all pst enviroment
- --single - create images whitout pdftk and auto-pst-pdf
- --all - create all image type and images.tex
- --nopdftk - create all image type and images.tex in single mode
- --xetex - using XeLaTeX for compilation.
+ -h,-help - display this help and exit
+ -l,-license - display license information and exit
+ -imageDir= - the dir for the created images (default images)
+ -d,-DPI=<int> - the dots per inch for a cretaed ppm files (default 75)
+ -j,-jpg - create .jpg files (need pdftoppm and ImageMagick)
+ -p,-png - create .png files (need pdftoppm and ImageMagick)
+ -e,-eps - create .eps files (need pdftops)
+ -Iscale=<real> - the value for [scale=] in \\includegraphics
+ -noImages - generate file-pdf.tex, but not images
+ -v,-verbose - creates log file (.plog)
+ -c,-clear - delete all tmp files
+ -runBibTeX - run bibtex on the aux file, if exists
+ -runBiber - run biber on the bcf file, if exists
+ -s,-single - create images whitout pdftk
+ -a,-all - create all image type and images.tex
+ -x,-xetex - using (Xe)LaTeX for compilation
+ -PS2=<opt> - pass options to ps2pdf (default empty)
Examples:
-* $program test.tex --all
-* produce test-pdf.tex and ppm,eps,tex and pdf for pst-enviroment in image dir
+* $program test.tex -all
+* produce test-pdf.tex whitout pst-enviroment and create image dir
+* whit all images (pdf,eps,jpg,png) and source(.tex) for all pst-enviroment
END_OF_USAGE
#
my $result=GetOptions (
- "help",
- "version",
- "license",
- "DPI=i" => \$DPI, # numeric
- "Iscale=f" => \$Iscale, # real
- "imageDir=s" => \$imageDir, # string
- "tempDir=s" => \$tempDir, # string
- "Iext=s" => \$Iext, # string
- "clear" => \$clear, # flag
- "noImages" => \$noImages, # flag
- "single" => \$single, # flag
- "runBibTeX" => \$runBibTeX, # flag
- "ppm" => \$ppm, # flag
- "norun" => \$norun, # flag
- "eps" => \$eps, # flag
- "files" => \$files, # flag
- "all" => \$all, # flag
- "nopdftk" => \$nopdftk, # flag
- "xetex" => \$xetex, # flag
- "runBiber" => \$runBiber, # flag
- "verbose" => \$verbose,
+ 'h|help' => \$::opt_help,
+ 'l|license' => \$::opt_license,
+ 'd|DPI=i' => \$DPI, # numeric
+ "Iscale=f" => \$Iscale, # real
+ "imageDir=s" => \$imageDir, # string
+ "PS2=s" => \$PS2, # string
+ "tempDir=s" => \$tempDir, # string
+ "Iext=s" => \$Iext, # string
+ 'c|clear' => \$clear, # flag
+ "noImages" => \$noImages, # flag
+ 's|single' => \$single, # flag
+ "runBibTeX" => \$runBibTeX, # flag
+ 'e|eps' => \$eps, # flag
+ 'j|jpg' => \$jpg, # flag
+ 'p|png' => \$png, # flag
+ 'a|all' => \$all, # flag
+ 'x|xetex' => \$xetex, # flag
+ "runBiber" => \$runBiber, # flag
+ 'v|verbose' => \$verbose,
) or die $usage;
-#---------------- help functions --------------------------------
+#------------------------ Help functions --------------------------
sub errorUsage { die "Error: @_ (try --help for more information)\n"; }
# options for command line
if ($::opt_help) {
print $usage;
- exit (0);
-}
-if ($::opt_version) {
- print $title;
- print $copyright;
- exit (0);
+ exit (0);
}
if ($::opt_license) {
+ print $title;
+ print "$copyright\n";
print $licensetxt;
exit (0);
}
@@ -156,6 +144,7 @@ open my $LOGfile,'>', "$tempDir/$name.plog"; # our own log file
LOG ("==> imageDir = $imageDir");
LOG ("==> Iext = $Iext");
LOG ("==> DPI = $DPI");
+ LOG ("==> PS2 = $PS2");
LOG ("==> Iscale = $Iscale");
LOG ("==> tempDir = $tempDir");
LOG ("==> verbose = $verbose");
@@ -165,8 +154,9 @@ open my $LOGfile,'>', "$tempDir/$name.plog"; # our own log file
LOG ("==> runBibTeX= $runBibTeX");
LOG ("==> runBiber = $runBiber");
LOG ("==> ppm = $ppm");
- LOG ("==> norun = $norun");
LOG ("==> eps = $eps");
+ LOG ("==> jpg = $jpg");
+ LOG ("==> png = $png");
LOG ("==> files = $files");
LOG ("==> xetex = $xetex");
@@ -179,33 +169,43 @@ if ($ppm) {
LOG ("Generate .ppm files ...");
$ppm = 1;
}
-if ($norun) {
- LOG ("no compile $name-pdf.tex");
- $norun = 1;
-}
if ($eps) {
LOG ("Generate .eps files ...");
$eps = 1;
}
+if ($jpg) {
+ LOG ("Generate .jpg files ...");
+ $ppm = 1;
+ $jpg = 1;
+}
+if ($png) {
+ LOG ("Generate .png files ...");
+ $ppm = 1;
+ $png = 1;
+}
if ($files) {
LOG ("Generate .tex images files ...");
$files=1;
}
if ($all) {
- LOG ("Generate all images files ...");
- $files=$eps = $ppm = $clear = 1;
+ LOG ("Generate all images eps/pdf/files and clear...");
+ $eps =$ppm=$jpg=$png=$clear = 1;
}
-if ($nopdftk) {
- LOG ("single mode generate all images files ...");
- $single=$files=$eps = $ppm = $clear = 1;
+if ($single) {
+ LOG ("single mode generate images files ...");
+ $single= 1;
}
if ($xetex) {
LOG ("Compiling using XeLaTeX ...");
$xetex=1;
}
+if ($noImages ) {
+ LOG ("no create images");
+ $single= 0;
+ }
my $imgNo = 1; # internal image counter
-#----------- single mode no need pdftk and auto-pst-pdf ----------------------
+#----------- single mode, no need pdftk ----------------------
if ($single) {
LOG ("Running on [$path][$name][$ext]");
open my $FILE,'<', "$TeXfile" ; # the source
@@ -213,11 +213,11 @@ LOG ("single mode generate images...");
if (-d $imageDir) { LOG ("$imageDir exists") }
else { mkdir("$imageDir", 0744) ;}
savePreamble($name);
+runXPD($name);
runFile($name);
close $FILE; # close source file
close $LOGfile;
-}
-#---------------- end single --------------
+}#---------------- Default way, using pdftk --------------
else{
LOG ("Running on [$path][$name][$ext]");
open my $FILE,'<', "$TeXfile" ; # the source
@@ -226,8 +226,8 @@ if (-d $imageDir) { LOG ("$imageDir exists") }
else { mkdir("$imageDir", 0744) ;
LOG ("Imagedir created"); }
LOG ("go to savePreamble ... ");
-runBurst($tempDir);
savePreamble($name);
+runXPD($name);
runFile($name);
LOG ("done!\n go to runFile ...");
LOG ("done!");
@@ -235,49 +235,24 @@ close $FILE; # close source file
close $LOGfile;
}# !noImages
}
-#------------ Create filename-pics.pdf, split and generate .ppm
-sub runBurst{
-if ($single){ print "single mode";}
-else{
-my $entrada = "$TeXfile";
-my $salida = "$name-pics.tex";
- open my $ENTRADA,'<', "$entrada";
- open my $SALIDA,'>',"$salida";
- print $SALIDA "\\AtBeginDocument\{\n";
-if ($xetex){
- print $SALIDA "\\RequirePackage\[xetex,active,tightpage\]\{preview\}\n";}
-else{
- print $SALIDA "\\RequirePackage\[active,dvips,tightpage\]\{preview\}\n";}
- print $SALIDA "\\renewcommand\\PreviewBbAdjust\{-600pt -600pt 600pt 600pt\}\n";
- print $SALIDA "\\newenvironment{postscript}{}{}\n";
- print $SALIDA "\\PreviewEnvironment\{postscript\}\n";
- print $SALIDA "\\PreviewEnvironment\{pspicture\}\}\n";
- while ( my $linea = <$ENTRADA> ) {
- print $SALIDA $linea;}
- close $ENTRADA;
- close $SALIDA;
-# --------------------Compiling File --------------------------
-if ($xetex){
- system("xelatex -interaction=batchmode $tempDir/$name-pics.tex");
- system("pdfcrop -xetex $tempDir/$name-pics.pdf $tempDir/$name-pics.pdf");}
-else{
- system("latex -interaction=batchmode $tempDir/$name-pics.tex");
- system("dvips $tempDir/$name-pics.dvi");
- system("ps2pdf -dProcessColorModel=/DeviceCMYK -dPDFSETTINGS=/prepress $tempDir/$name-pics.ps");
- system("pdfcrop $tempDir/$name-pics.pdf $tempDir/$name-pics.pdf");}
- system("pdftk $tempDir/$name-pics.pdf burst output $imageDir/$name-fig-\%1d.pdf");
-if ($ppm){
- system("pdftoppm -r $DPI $tempDir/$name-pics.pdf $imageDir/$name-fig");}
- }
+# Create xpdfrc conf for silent output pdftops/pdftoppm mesagge in windows
+
+sub runXPD{
+if ($^O eq 'MSWin32'){
+open my $ppmconf, '>', "$tempDir/xpd";
+print $ppmconf <<'EOH';
+errQuiet yes
+EOH
+close $ppmconf;
+ }
}
-#------------ end pdftk burst
-LOG ("runpdfTeX ... ");
-runpdfTeX("$path$name",$name);
-LOG ("all finished ... :-)");
+# end fix
+
# create a preamble file
# if we have a \input command inside the preamble, it doesn't hurt, we need
# it anyway for the postscript files and the pdf one.
-# ----------------- Save Preamble ----------------------------------------
+
+# ----------------- Save Preamble ---------------------
sub savePreamble {
my $filename = pop; # get the file name
LOG ("----- Start Preamble -----");
@@ -395,46 +370,61 @@ sub searchPS { # search the PostScript parts
LOG ("<----PStotal<----");
}
close $FILE;
- return @PStotal; # return all PS sequences
+ return @PStotal; # return all PS sequences
}
-# Creating ifile.tex and eps, pdf and ppm for images
-if ($single){
+# Creating file.tex and .pdf(eps,ppm) for images in single mode
+
sub runsingle{
my $filename = pop;
- if ($xetex){
- system("xelatex -interaction=batchmode $tempDir/$filename-fig");
- system("pdfcrop -xetex $tempDir/$filename-fig.pdf $imageDir/$filename-fig-$imgNo.pdf");}
- else{
- system("latex -interaction=batchmode $tempDir/$filename-fig");
- system("dvips $tempDir/$filename-fig");
- system("ps2pdf -dProcessColorModel=/DeviceCMYK -dPDFSETTINGS=/prepress $tempDir/$filename-fig.ps");
- system("pdfcrop $tempDir/$filename-fig.pdf $imageDir/$filename-fig-$imgNo.pdf");}
- if ($files){
- copy("$filename-fig.tex", "$imageDir/$filename-fig-$imgNo.tex");}
- system("pdfcrop $tempDir/$filename-fig.pdf $imageDir/$filename-fig-$imgNo.pdf");
- if ($eps) {
- system("pdftops -level3 -eps $imageDir/$filename-fig-$imgNo.pdf $imageDir/$filename-fig-$imgNo.eps");}
- if ($ppm) {
- system("pdftoppm -r $DPI $imageDir/$filename-fig-$imgNo.pdf $imageDir/$filename-fig-$imgNo");}
- $imgNo=$imgNo+1;
+
+if ($xetex){
+ system("xelatex -interaction=batchmode $filename");
+ system("pdfcrop -margins 1 -xetex $filename.pdf $imageDir/$filename-$imgNo.pdf");
+ }
+else{
+ system("latex -interaction=batchmode $filename");
+ system("dvips -q -Ppdf $filename");
+ system("ps2pdf $PS2 $filename.ps");
+ system("pdfcrop -margins 1 $filename.pdf $imageDir/$filename-$imgNo.pdf");
+ }
+if ($files){
+ copy("$filename.tex", "$imageDir/$filename-$imgNo.tex");
}
-}
+
+if ($eps) {
+ if ($^O eq 'MSWin32'){
+ system("pdftops -cfg $tempDir/xpd -q -level3 -eps $imageDir/$filename-$imgNo.pdf $imageDir/$filename-$imgNo.eps");
+ }
+ else{
+ system("pdftops -q -level3 -eps $imageDir/$filename-$imgNo.pdf $imageDir/$filename-$imgNo.eps");
+ }
+ }
+if ($ppm) {
+ if ($^O eq 'MSWin32'){
+ system("pdftoppm -cfg xpd -q -r $DPI $imageDir/$filename-$imgNo.pdf $imageDir/$filename-$imgNo");
+ }
else{
-#----------------- Creating files.tex and .eps for images --------------
+ system("pdftoppm -q -r $DPI $imageDir/$filename-$imgNo.pdf $imageDir/$filename-$imgNo");
+ }
+ }
+
+ $imgNo=$imgNo+1;
+}
+#------------------- Copy files.tex for images in default mode ---------
sub runTeX{
my $filename = pop;
- if ($eps){
- system("pdftops -level3 -eps $imageDir/$filename-$imgNo.pdf $imageDir/$filename-$imgNo.eps");
- }
if ($files){
- copy("$filename.tex", "$imageDir/$filename-$imgNo.tex");
-}
- $imgNo=$imgNo+1;
+ copy("$filename.tex", "$imageDir/$filename-$imgNo.tex");
}
+ $imgNo=$imgNo+1;
}
+
+#------------------ Create files.tex for images --------------
sub runFile {
+
my $filename = pop;
my @PSarray = searchPS();
+
if ( $verbose ) {
LOG("---->PSarray---->");
for my $aref ( @PSarray ) {
@@ -458,33 +448,47 @@ sub runFile {
close $FILEsub;
close $FILEp;
if ($single) {
- runsingle("$name");
- }
- else{
- runTeX("$tempDir/$name-fig");
- }
-}
+ runsingle("$tempDir/$filename-fig");
+ }
+ else{runTeX("$tempDir/$filename-fig");}
+ }
}
+LOG ("runpdfTeX ... ");
+runpdfTeX("$path$name",$name);
+LOG ("all finished ... :-)");
+
# ----------------Renaming ppm need for correct name
if(!$noImages){
my $dren = "$tempDir/$imageDir";
- my $fichero = '';
+ my $fich = '';
my $ppmren = '';
+ my $PPMno = 1;
my $renNo = 1;
- if(opendir(DIR,$dren)){
+ if(opendir(DIR,$dren)){
foreach (readdir DIR){
- $fichero = $_;
- if ( $fichero =~ /($name-fig-)(\d+|\d+[-]\d+).ppm/) {
+ $fich = $_;
+ if ( $fich =~ /($name-fig-)(\d+|\d+[-]\d+).ppm/) {
my $renNo = int($2);
my $newname="$1$renNo.ppm";
- $ppmren = rename("$dren/$fichero","$dren/$newname");
- }
+ $ppmren = rename("$dren/$fich","$dren/$newname");
+ if($jpg){
+ system("convert $imageDir/$name-fig-$renNo.ppm $imageDir/$name-fig-$renNo.jpg");
+ }
+ if($png){
+ system("convert $imageDir/$name-fig-$renNo.ppm $imageDir/$name-fig-$renNo.png");
+ }
+ }
+ }
}
-}
closedir DIR;
-}# end renaming
-#--------------------------- Replace files----------------------
+ if($clear){
+ unlink <$imageDir/*.ppm>;
+ }
+}# end renaming ppm
+
+#------------------ Replace pst enviroment for images---------
sub runpdfTeX() {
+
my ($name,$pdfname) = @_;
open my $PDF,'>',"$tempDir/$pdfname-pdf.tex";
open my $FILE,'<',"$name.tex";
@@ -492,7 +496,7 @@ sub runpdfTeX() {
my $IMGno = 1;
my $depth = -1;
my $type = -1;
- my $EndDocument = 0; # ignore all after \end{document}
+ my $EndDocument = 0; # ignore all after \end{document}
my $iVerb = 0;
while (<$FILE>) { # scan the input file
if ( !$iVerb ) {
@@ -564,7 +568,77 @@ sub runpdfTeX() {
} # while (<$FILE>)
close $FILE;
close $PDF;
-#------------------- Coment pst-package for pdfLaTeX --------------------
+# ------------- Create one file contain all pst (default mode) ----------------
+if (!$single==!$noImages){
+my ($name,$pdfname) = @_;
+my @PSTarray = searchPS();
+my @pstfiles = glob("$imageDir/*.tex");
+@pstfiles =
+ map { $_->[1] }
+ sort { $a->[0] <=> $b->[0] }
+ map { [ ($_ =~ /(\d+)\.tex$/), $_ ] }
+ @pstfiles;
+my @container;
+for my $archivo (@pstfiles) {
+
+ open my $FH, '<:crlf', $archivo; # EOL
+ my $tex = join q{}, <$FH>; #
+ close $FH;
+ my($pstimg) = $tex =~ m/\\begin\{document\}\n(.+?)\n\\end\{document\}/sm;
+ push @container, $pstimg if $pstimg;
+}
+open my $FILE,'<',"$tempDir/$name.preamble";
+open my $OUTPST,'>',"$tempDir/$name-pst.tex";
+ while (<$FILE>) {print $OUTPST $_; }
+ print $OUTPST "\\newenvironment{postscript}{}{}\n";
+ print $OUTPST "\\pagestyle{empty}\n";
+ print $OUTPST "\\begin{document}\n";
+my $fig = 1;
+for my $item (@container) {
+ print $OUTPST $item;
+ print $OUTPST "\n%fig" . "$fig\n";
+ print $OUTPST "\\newpage\n";
+ $fig++;
+}
+ print $OUTPST "\\end{document}";
+ close $OUTPST;
+ close $FILE;
+# close all
+# -------------------- Compiling File using pdftk ----------------------
+my ($name,$pdfname) = @_;
+if ($xetex){
+ system("xelatex -interaction=batchmode $tempDir/$pdfname-pst.tex");
+ system("pdfcrop -xetex $tempDir/$name-pst.pdf $tempDir/$pdfname-pst.pdf");
+ }
+else{
+ system("latex -interaction=batchmode $tempDir/$pdfname-pst");
+ system("dvips -q -Ppdf $tempDir/$pdfname-pst");
+ system("ps2pdf $PS2 $tempDir/$pdfname-pst.ps $tempDir/$pdfname-pst.pdf");
+ system("pdfcrop -margins 1 $tempDir/$pdfname-pst.pdf $tempDir/$pdfname-pst.pdf");
+ }
+ system("pdftk $tempDir/$pdfname-pst.pdf burst output $imageDir/$pdfname-fig-\%1d.pdf");
+if ($eps){
+for my $fichero_pdf (<$imageDir/*.pdf>) {
+ (my $fichero_eps = $fichero_pdf) = s/ppm$/png/i;
+ if ($^O eq 'MSWin32'){
+ system("pdftops -cfg xpd -q -level3 -eps $fichero_pdf $fichero_eps"); # conversión
+ }
+ else{
+ system("pdftops -q -level3 -eps $fichero_pdf $fichero_eps"); # conversión
+ }
+ }
+}
+if ($ppm){
+ if ($^O eq 'MSWin32'){
+ system("pdftoppm -cfg xpd -q -r $DPI $tempDir/$pdfname-pst.pdf $imageDir/$pdfname-fig");
+ }
+ else{
+ system("pdftoppm -q -r $DPI $tempDir/$pdfname-pst.pdf $imageDir/$pdfname-fig");
+ }
+ }
+ }
+
+#---------------- Coment pst-package in file-pdf.tex for (pdf/Xe)LaTeX ----------------
open my $IPDF,'<', "$tempDir/$pdfname-pdf.tex";
undef $/; # read all file
my ($uno,$dos) = split(/\\begin\{document\}/,<$IPDF>,2);
@@ -591,15 +665,22 @@ my $clean = join("\n", @preamb, "\\usepackage{grfext}\n\\\PrependGraphicsExtensi
open my $OPDF,'>',"$tempDir/$pdfname-pdf.tex"; # write changes
print $OPDF $clean;
close $OPDF;
-# ------------------------- close coment pst-package ------------------------------
+
my $runAgain = 0;
- if ($norun){print "Done\n";}
- else {
- if($xetex){
- system("xelatex -interaction=batchmode $tempDir/$pdfname-pdf"); print "Done\n";}
- else{
- system("pdflatex -interaction=batchmode $tempDir/$pdfname-pdf"); print "Done\n";}
- }
+
+ if($xetex){ # xelatex mode
+ if ($noImages){print "The file $pdfname-pdf.tex are created (Xe)LaTeX\n";}
+ else{
+ system("xelatex -interaction=batchmode $tempDir/$pdfname-pdf");
+ print "Done, compiled $pdfname-pdf.tex using (Xe)LaTeX\n";}}
+ else{ #pdflatex mode
+ if ($noImages){
+ print "The file $pdfname-pdf.tex are created (pdf)LaTeX\n";}
+ else{
+ system("pdflatex -interaction=batchmode $tempDir/$pdfname-pdf.tex");
+ print "Done, compiled $pdfname-pdf.tex using (pdf)LaTeX\n";}
+ }
+
if (-e "$tempDir/$pdfname-pdf.idx") {
system("makeindex $tempDir/$pdfname-pdf.idx"); $runAgain++;}
if ($runBibTeX && -e "$tempDir/$pdfname-pdf.aux") {
@@ -612,47 +693,37 @@ my $runAgain = 0;
else{
system("pdflatex -interaction=batchmode $tempDir/$pdfname-pdf");}
}
- if ($ppm){
- print "If you need to create jpg/png/svg type cd $imageDir and run\n";
- print "mogrify -format [ext] *.ppm\n";
- }
+
if ($clear) {
- if ($norun){}
- if ($single) {
- unlink "$tempDir/$name-fig.pdf";
- if(!$xetex){
- unlink "$tempDir/$name-fig.dvi";
- unlink "$tempDir/$name-fig.ps";
- }
- unlink "$tempDir/$name-fig.aux";
- unlink "$tempDir/$name-fig.log";
- unlink "$tempDir/$name-fig.tex";
- if(!$verbose) {
- unlink "$tempDir/$name.plog";
- }
- unlink "$tempDir/$name.preamble";
- unlink "$tempDir/$name-pdf.aux";
- unlink "$tempDir/$name-pdf.log";
- }
- else{
- if(!$verbose) {
- unlink "$tempDir/$name.plog";
- }
unlink "$tempDir/$name.preamble";
unlink "$tempDir/$name-pdf.aux";
unlink "$tempDir/$name-pdf.log";
- unlink "$tempDir/$name-pics.pdf";
- unlink "$tempDir/$name-pics.tex";
- unlink "$tempDir/$name-pics.aux";
- if(!$xetex){
- unlink "$tempDir/$name-pics.dvi";
- unlink "$tempDir/$name-pics.ps";}
- unlink "$tempDir/$name-pics.log";
unlink "$tempDir/$name-fig.tex";
- }
+ if ($eps or $ppm){
+ if ($^O eq 'MSWin32'){unlink "$tempDir/xpd";}
+ }
+ if(!$verbose) {unlink "$tempDir/$name.plog";}
+ if ($single) {#comon
+ unlink "$tempDir/$name-fig.pdf";
+ unlink "$tempDir/$name-fig.aux";
+ unlink "$tempDir/$name-fig.log";
+ if($xetex){ }
+ else{
+ unlink "$tempDir/$name-fig.dvi";
+ unlink "$tempDir/$name-fig.ps";}
+ }
+ else{ #clean for pdftk mode
+ unlink "$tempDir/$name-pst.log";
+ unlink "$tempDir/$name-pst.pdf";
+ unlink "$tempDir/$name-pst.aux";
+ if($xetex){ }
+ else{
+ unlink "$tempDir/$name-pst.dvi";
+ unlink "$tempDir/$name-pst.ps";
}
}
-
+}
+}
sub LOG() {
if ( $verbose ) { print $LOGfile "@_\n"; }
}
diff --git a/Master/texmf-dist/doc/latex/pst2pdf/Changes b/Master/texmf-dist/doc/latex/pst2pdf/Changes
index cea7a71ded3..00844724a41 100644
--- a/Master/texmf-dist/doc/latex/pst2pdf/Changes
+++ b/Master/texmf-dist/doc/latex/pst2pdf/Changes
@@ -1,4 +1,7 @@
pst2pdf.pl --------
+0.15 2013-06-16 - adding short options for command line
+ - create png and jpg files in Linux and Windows
+ - pass options to ps2pdf
0.14 2013-02-27 - suport xelatex and -help from command line
0.13 2011-12-12 - some more improvements to the code
0.12 2011-01-19 - new optional arguments for running
@@ -16,9 +19,9 @@ pst2pdf.pl --------
0.06 2007-08-28 - fix bug with \begin{pspicture} and \pspicture
0.05 2007-07-05 - allow different extensions for the source file
e.g. tex, ltx
- - ignore verbatim environment
- - better log file support
+ - ignore verbatim environment
+ - better log file support
0.04 2007-07-04 - allow all \begin ..\end sequences anywhere
in a line, see testcase
0.03 2007-06-21 - fix nested environments
-0.02 2007-06-20 - first (public) version
+0.02 2007-06-20 - first (public) version
diff --git a/Master/texmf-dist/doc/latex/pst2pdf/README b/Master/texmf-dist/doc/latex/pst2pdf/README
index 1b488d664b0..62bc39fa882 100644
--- a/Master/texmf-dist/doc/latex/pst2pdf/README
+++ b/Master/texmf-dist/doc/latex/pst2pdf/README
@@ -6,9 +6,9 @@ The pdf ones are then imported in a last pdflatex run
for the pdf output of the main document. The eps and
pdf files are saved in a subdirectory images.
-Syntax: pst2pdf.pl file[.tex] [-options]
+Syntax: pst2pdf.pl file[.tex] [options]
-alternative: perl pst2pdf.pl file[.tex] [-options]
+alternative: perl pst2pdf.pl file[.tex] [options]
Some restrictions:
@@ -30,10 +30,28 @@ a pspicture environment, e.g. nodes inside normal text.
pst2pdf creates a document file-pdf.tex for use with
pdflatex, which then creates file-pdf.pdf. The created
-images are named file-pst-<No>.pdf
+images are named file-fig-<No>.pdf
+
+Options:
+ -h,-help - display this help and exit
+ -l,-license - display license information and exit
+ -imageDir - the dir for the created images (default images)
+ -d,-DPI=<int> - the dots per inch for a cretaed ppm files (default 75)
+ -j,-jpg - create .jpg files (need pdftoppm and ImageMagick)
+ -p,-png - create .png files (need pdftoppm and ImageMagick)
+ -e,-eps - create .eps files (need pdftops)
+ -Iscale=<real> - the value for [scale=] in \\includegraphics
+ -noImages - generate file-pdf.tex, but not images
+ -v,-verbose - creates log file (.plog)
+ -c,-clear - delete all tmp files
+ -runBibTeX - run bibtex on the aux file, if exists
+ -runBiber - run biber on the bcf file, if exists
+ -s,-single - create images whitout pdftk
+ -a,-all - create all image type and images.tex
+ -x,-xetex - using (Xe)LaTeX for compilation
+ -PS2=<opt> - pass options to ps2pdf (default empty)
for more documentation => pst2pdf --help or read the documentation
-
--
Herbert Voss 2010-01-04
</pre>
diff --git a/Master/texmf-dist/doc/latex/pst2pdf/pst2pdf-doc.bib b/Master/texmf-dist/doc/latex/pst2pdf/pst2pdf-doc.bib
index b42b1c01a15..b51192400d3 100644
--- a/Master/texmf-dist/doc/latex/pst2pdf/pst2pdf-doc.bib
+++ b/Master/texmf-dist/doc/latex/pst2pdf/pst2pdf-doc.bib
@@ -125,10 +125,25 @@
@Book{PSTricks2,
author = {Herbert Vo\ss},
- title = {\texttt{PSTricks} -- {G}rafics for \TeX{} and \LaTeX},
- edition = {1.},
- publisher = {UIT},
+ title = {\texttt{PSTricks} -- {G}rafik f\"ur \TeX{} und \LaTeX},
+ edition = {6.},
+ publisher = {DANTE -- Lehmanns},
year = {2011},
+ address = {Heidelberg/Hamburg}
+}
+
+@Book{voss:math,
+ author = {Herbert Vo\ss},
+ title = {Typesetting mathematics with \LaTeX},
+ publisher = {UIT},
+ year = {2010},
address = {Cambridge}
}
+@Book{PSTricks2-UIT,
+ author = {Herbert Vo\ss},
+ title = {PSTricks -- Graphics for \TeX\ and \LaTeX},
+ publisher = {UIT},
+ year = {2011},
+ address = {Cambridge}
+}
diff --git a/Master/texmf-dist/doc/latex/pst2pdf/pst2pdf-doc.pdf b/Master/texmf-dist/doc/latex/pst2pdf/pst2pdf-doc.pdf
index 7ecd33bfc39..928f35f43b2 100644
--- a/Master/texmf-dist/doc/latex/pst2pdf/pst2pdf-doc.pdf
+++ b/Master/texmf-dist/doc/latex/pst2pdf/pst2pdf-doc.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/pst2pdf/pst2pdf-doc.tex b/Master/texmf-dist/doc/latex/pst2pdf/pst2pdf-doc.tex
index 238bf937673..a89995f74b8 100644
--- a/Master/texmf-dist/doc/latex/pst2pdf/pst2pdf-doc.tex
+++ b/Master/texmf-dist/doc/latex/pst2pdf/pst2pdf-doc.tex
@@ -16,7 +16,7 @@
\begin{document}
\title{\texttt{pst2pdf}}
-\subtitle{Running a PSTricks document with pdflatex;\\ \small v. 0.14}
+\subtitle{Running a PSTricks document with pdflatex;\\ \small v. 0.15}
\author{Herbert Vo\ss \\ Pablo Gonz\'{a}lez Luengo}
\docauthor{}
\date{\today}
@@ -26,20 +26,6 @@
\clearpage
-%\begin{abstract}
-%\noindent
-%\Lprog{pst2pdf} is a \Lprog{perl} \emph{script} for running a PSTricks document in a last run
-%with pdflatex.
-
-%\vfill\noindent
-%Thanks to:
-%Rolf Niepraschk
-
-%\end{abstract}
-
-%\clearpage
-
-
\section{Introduction}
\PST\ as \PS\ related package uses the programming language \PS\ for internal
calculations. This is an important advantage, because floating point arithmetic is no
@@ -58,7 +44,8 @@ main document is replaced by the created images.
\section{Requirements}
\subsection{Programs needed}
-\nxLprog{pst2pdf} needs \Lprog{pdftk}, \Lprog{ImageMagick} and \Lprog{poppler-utils} (or \Lprog{xpdf-utils}) for the process file in usual way. If you need a create .pdf image files (whitout related software) use single mode (see \ref{single}).
+\nxLprog{pst2pdf} needs \Lprog{pdftk}, \Lprog{ImageMagick}, \Lprog{pdftoppm} and \Lprog{pdftops}
+(from \Lprog{poppler-utils} or \Lprog{xpdf-utils}) for the process file. If you need a create .pdf image files (whitout \Lprog{pdftk}) use single mode (see \ref{single}).
\subsection{Preparating file}
The script scan the file for \Lenv{pspicture} and \Lenv{postscript} environments,
@@ -120,16 +107,17 @@ For \TeX Live users:
\nxLprog{pst2pdf} \Larg{file.tex} \OptArg*{--options}
\end{BDef}
+In this way \nxLprog{pst2pdf} creates a new file called \Larg{file-pst.tex} and copy all \Lenv{pspicture}
+and \Lenv{postscript} environments, then processed and create file-pdf.pdf and file-fig-1.pdf, file-fig-2.pdf, file-fig-\dots.pdf and file-fig-1.tex, file-fig-2.tex, file-fig-\dots.tex for all \Lenv{pspicture} and \Lenv{postscript} using \nxLprog{pdftk}.
\subsection{Single mode}
\label{single}
-If \nxLprog{pst2pdf} can not process a file, used the option \Loption{--single} this process will create the file, whiout pdftk
-(take a more time to create images files) by default create PDF files. For exampple:
+If you do not have \nxLprog{pdftk} use the option \Loption{--single} in this mode the files are processed separately (take a more time to create images files) by default create PDF files. For example:
\begin{BDef}
-\nxLprog{pst2pdf} \Larg{file.tex} \OptArg*{--pdf} \OptArg*{--single}
+\nxLprog{pst2pdf} \Larg{file.tex} \OptArg*{--single}
\end{BDef}
-create file-pdf.pdf and file-pst-1.pdf, file-pst-2.pdf, file-pst-\dots.pdf for all \Lenv{pspicture} and \Lenv{postscript} environments in the directory for the created images (see \ref{options}).
+create file-pdf.pdf and file-fig-1.pdf, file-fig-2.pdf, file-fig-\dots.pdf and file-fig-1.tex, file-fig-2.tex, file-fig-\dots.tex for all \Lenv{pspicture} and \Lenv{postscript} environments (see \ref{options}).
\section{Options}
\label{options}
@@ -143,19 +131,18 @@ The options listed in Table~\ref{perloptions} refer only to the \emph{script} an
\Loption{--Iext} & literal & .pdf & the extension for \Loption{PrependGraphicsExtensions}.\\
\Loption{--DPI} & integer & 75 & the dots per inch for a created \Lext{ppm} file.\\
\Loption{--Iscale} & real & 1 & the value for the option \Loption{scale} in \Lcs{includegraphics}.\\
-\Loption{--eps} & boolean & 0 & creates \Lext{eps} images files (need pdftops).\\
-\Loption{--ppm} & boolean & 0 & creates \Lext{ppm} images files (need pdftoppm).\\
-\Loption{--files} & boolean & 0 & creates \Lext{tex} for all images.\\
+\Loption{--eps} & boolean & 0 & creates \Lext{eps} images (need \Lprog{pdftops}).\\
+\Loption{--jpg} & boolean & 0 & creates \Lext{jpg} images (need \Lprog{pdftoppm} and \Lprog{ImageMagick}).\\
+\Loption{--png} & boolean & 0 & creates \Lext{png} images (need \Lprog{pdftoppm} and \Lprog{ImageMagick}).\\
\Loption{--verbose} & boolean & 1 & for a long \nxLprog{pst2pdf} log.\\
-\Loption{--norun} & boolean & 0 & create files, but no compile.\\
+\Loption{--PS2} & literal & empty & pass options to \nxLprog{ps2pdf}.\\
\Loption{--clear} & boolean & 0 & delete all temporary files.\\
\Loption{--help} & boolean & 1 & print help and exit.\\
\Loption{--single} & boolean & 0 & create images type (whitout pdftk).\\
-\Loption{--all} & boolean & 0 & generte all image type (.pdf, .eps, .tex).\\
-\Loption{--version} & boolean & 0 & print version and exit.\\
+\Loption{--all} & boolean & 0 & generte all image (.pdf, .eps, .jpg, .png, .tex) and clear.\\
\Loption{--license} & boolean & 0 & print license and exit.\\
\Loption{--xetex} & boolean & 0 & using \Lprog{xelatex} instead of \Lprog{latex} for the process.\\
-\Loption{--noImages} & boolean & 0 & generate files but no images (need \Loption{--norun}).\\
+\Loption{--noImages} & boolean & 0 & generate file-pdf.tex, but no images.\\
\Loption{--runBibTeX}& boolean & 0 & runs \Lprog{bibtex} \\
\Loption{--runBiber} & boolean & 0 & runs \Lprog{biber} if a file with extension \Lext{bcf} exists \\\bottomrule
\end{tabularx}
@@ -167,17 +154,19 @@ For Help in command line use:
\nxLprog{pst2pdf} \OptArg*{--help}
\end{BDef}
-\section{Other image format}
-If your need \Lext{png}, \Lext{jpg} or other image type use \nxLprog{pst2pdf} \Larg{file.tex} \OptArg*{--ppm} , than move to images dir and use \nxLprog{mogrify} command (from \Lprog{ImageMagick}), for examples:\\
+\section{Image format}
+\nxLprog{pst2pdf} can create image files in the formats: \Lext{pdf}, \Lext{eps}, \Lext{jpg} and \Lext{png}. If you need to create other image formats use \nxLprog{pst2pdf} \Larg{file.tex} \OptArg*{-png} without the option
+\OptArg*{-clear} , than move to images dir and use \nxLprog{mogrify} command (from \Lprog{ImageMagick}), for examples:\\
\begin{BDef}
-\nxLprog{mogrify} -format \OptArg*{png *.ppm}
+\nxLprog{mogrify} -format gif \OptArg*{*.ppm}
\end{BDef}
-generate PNG images files and \\
+generate \Lext{gif} images files and \\
\begin{BDef}
-\nxLprog{mogrify} -format \OptArg*{jpg *.ppm}
+\nxLprog{mogrify} -format tiff \OptArg*{*.ppm}
\end{BDef}
-generate JPG images files.
+generate \Lext{tiff} images files.
+\enlargethispage{1cm}
\bgroup
\raggedright
\nocite{*}
diff --git a/Master/texmf-dist/doc/latex/pst2pdf/test.pdf b/Master/texmf-dist/doc/latex/pst2pdf/test.pdf
new file mode 100644
index 00000000000..8ffafa7a152
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/pst2pdf/test.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/pst2pdf/test.tex b/Master/texmf-dist/doc/latex/pst2pdf/test.tex
new file mode 100644
index 00000000000..c664fb0a0d7
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/pst2pdf/test.tex
@@ -0,0 +1,408 @@
+\documentclass{article}
+\usepackage[utf8]{inputenc}
+\usepackage[T1]{fontenc}
+\usepackage{textcomp}
+\usepackage{lmodern}
+\usepackage[dvipsnames]{xcolor}
+\usepackage{pst-solides3d}
+\usepackage{psgo}
+\usepackage{pst-text}
+\usepackage{pst-blur}
+\usepackage[tiling]{pst-fill}
+\usepackage{pst-calendar}
+\usepackage{pst-eucl}
+\usepackage{pst-labo}
+\usepackage{pst-3d}
+\usepackage{psfrag}
+\usepackage{pst-bar}
+\usepackage{pst-barcode}
+\usepackage{pst-gr3d}
+\usepackage{pst-ob3d}
+\usepackage{pst-3dplot}
+\usepackage{pst-tree}
+\usepackage{pst-coil}
+\usepackage{pst-bezier}
+\usepackage{pst-coxeterp}
+\usepackage{pst-circ}
+\usepackage{pst-func}
+\usepackage{pstricks-add}
+\usepackage{pst-plot,pst-math}
+\usepackage{pst-slpe}
+\usepackage{pst-fr3d}
+\usepackage{vaucanson-g}
+\usepackage{blindtext}
+\usepackage{multido}
+\usepackage{pst-grad}
+\usepackage{pstricks-add}
+%\usepackage[pspdf={-dPDFSETTINGS=/prepress}]{auto-pst-pdf}
+\begin{document}
+A test for pst2pdf ...
+\texttt{blindtext,pst-node}
+\begin{postscript}
+\SpecialCoor
+\rnode{A}{The beginning of it all:}
+\blindtext
+\rnode{E}{And this is the end my friend.}
+\nccurve[linewidth=5pt,strokeopacity=0 .4,ncurvB=0.9,arrowscale=1.5,arrows=->]{A}{E}
+\end{postscript}
+
+\texttt{pstricks-add}
+\begin{pspicture}(-0.04,-0.04)(1,1)
+\psset{unit=5}
+\psgrid[subgriddiv=5,subgridcolor=lightgray]
+\psplotDiffEqn[whichabs=0,whichord=1,linecolor=red,
+method=rk4,algebraic,plotpoints=400,
+showpoints=true]{0}{10}{0 0}%
+{cos(Pi*x^2/2)|sin(Pi*x^2/2)}
+\end{pspicture}
+
+\texttt{pst-solides3d}
+\begin{pspicture}[solidmemory](-4,-5)(7,4)
+\psset{viewpoint=50 -40 10 rtp2xyz,Decran=50,
+linecolor=darkgray,lightsrc=viewpoint}
+\psSolid[object=grille,action=draw,base=-3 5 -3 5,
+linecolor=Salmon!40](0,0,-3)
+\psSolid[object=cylindre,r=2,h=6,ngrid=6 24,
+plansepare={[0.707 0 0.707 0]},name=Zylinder,
+action=none](0,0,-3)
+\psSolid[object=load,load=Zylinder1,
+fillcolor=black!5,fcol=0 (Goldenrod)]
+\psSolid[object=load,load=Zylinder0,RotZ=90,
+fillcolor=black!5,rm=0,hollow,incolor=Goldenrod](0,4,0)
+\psSolid[object=plan,action=draw,definition=equation,
+args={[0.707 0 0.707 0] 90},base=-2 2 -3 3,planmarks]
+\psSolid[object=line,args=0 0 0 0 5.5 0,
+linecolor=blue]% first half of y axis
+\color{white}\axesIIID[showOrigin=false,
+linecolor=blue](0,6.8,0)(3.5,8,3.5)
+\end{pspicture}
+
+\texttt{pstricks}
+\begin{postscript}
+\psset{unit=0.05mm}% 1:20,or=0.1mm for 1:10
+\begin{pspicture}(-100,-100)(1000,650)
+\pspolygon[linewidth=2pt,fillcolor=gray!10,
+fillstyle=solid](0,0)(0,470)(860,625)(860,0)
+\psset{linewidth=0.2pt,arrowscale=2,tbarsize=10pt}
+\psline{|<->|}(0,-100)(860,-100)
+\rput*(430,-100){430mm}
+\psline{|<->|}(960,0)(960,625)
+\rput*{90}(960,312.5){625mm}
+\psline{|<->|}(-100,0)(-100,470)
+\rput*{90}(-100,235){470mm}
+\end{pspicture}
+\end{postscript}
+
+\texttt{pstricks, pst-node, and pst-plot}
+\begin{pspicture}(-1,-3)(4.75,3)
+\psscalebox{0.75}{
+\psaxes{->}(0,0)(-1,-3)(5,3)
+\psplot[polarplot,linewidth=2pt,algebraic,
+plotpoints=500]{0}{6.289}{2*(1+cos(x))}
+\multido{\r=0.000+0.314}{21}{ %
+\psplotTangent[polarplot,Derive=-2*sin(x),
+algebraic,arrows=<->]{\r}{1.5}{2*(1+cos(x))}}
+}
+\end{pspicture}
+
+\texttt{pst-plot}
+\begin{pspicture}[showgrid=true](-1.1,-1.1)(1.1,1.1)
+\psset{xunit=1.5cm,yunit=1.5cm}
+\psparametricplot[plotstyle=curve,linewidth=1.5pt,
+plotpoints=200]{-360}{360}%
+{t 1.5 mul sin t 2 mul 60 add sin}
+\end{pspicture}
+
+\texttt{pst-tree}
+\begin{postscript}
+\pstree[levelsep=1cm,radius=3pt]{\Toval{Wurzel}}{%
+\pstree{\TC}{%
+\TC
+\pstree{\TC*}{\TC\TC\TC\TC}%
+\TC\TC}}
+\end{postscript}
+
+\texttt{pst-bezier}
+\begin{pspicture}[showgrid=true](5,3)
+\psset{showpoints=true}
+\psbcurve[linecolor=blue,linewidth=0.01](1,1)%
+(2,2)(3,1)(4,2)
+\psbcurve(1,1)(2,2)l(2,1)(3,1)(4,2)
+\uput[-90](2,1){$\vec{l}_{2}$}
+\end{pspicture}
+
+\texttt{pst-text}
+\begin{pspicture}(0,0)(.25\linewidth,8)
+\DeclareFixedFont{\ps}{U}{psy}{m}{n}{8cm}
+\psboxfill{\footnotesize$\pi$}
+\pscharpath[fillstyle=solid,
+fillcolor=cyan!20,
+addfillstyle=boxfill,fillangle=30,
+fillsep=0.6mm]{%
+\rput[b](-0.5,0){\ps\char112}}
+\end{pspicture}
+
+\texttt{pst-fill}
+\begin{postscript}
+\psset{unit=1.5,dimen=middle}
+\begin{pspicture*}(3,3)
+\psboxfill{\begin{pspicture}(1,1)
+\psframe(1,1)\end{pspicture}}
+\psframe[fillstyle=boxfill](3,3)
+\psboxfill{\begin{pspicture}(1,1)
+\rput{-37}{\psframe[linecolor=red](0.8,0.8)}
+\end{pspicture}}
+\psframe[fillstyle=boxfill](3,4)
+\pspolygon[fillstyle=hlines,hatchangle=90](1,2)(1.64,1.53)(2,2)
+\end{pspicture*}
+\end{postscript}
+
+
+\texttt{pst-coils}
+\begin{pspicture}(4,3)
+\cnode*(0.5,0.5){0.5}{A}
+\cnode*(3.5,2.5){0.5}{B}
+\pccoil[coilwidth=0.4,coilaspect=35,coilheight=0.5,linecolor=white]{<->}(A)(B)
+\nccoil[coilwidth=0.4,coilaspect=35,coilheight=0.5]{A}{B}
+\end{pspicture}
+
+
+\texttt{pst-grad}
+\begin{pspicture}(5,3.5)
+\psframe[fillstyle=gradient,gradbegin=white](5,1.5)
+\newrgbcolor{gradbegin}{0 1 1}
+\psframe[fillstyle=gradient](0,2)(5,3.5)
+\end{pspicture}
+
+\texttt{pst-slpe}
+\begin{pspicture}(2.5,2.5)
+\def\st#1{\makebox[2.75cm]{$\vcenter to 55pt{}#1$}}
+\psset{fading,endfading=0.75,linecolor=black!40}
+\psframe*(-0.3,-0.25)(3.5,20pt)
+\psframebox[fillstyle=slope]{\LARGE\st{slope}}
+\end{pspicture}
+
+\texttt{pst-blur}
+\begin{postscript}
+\DeclareFixedFont{\RM}{T1}{ptm}{b}{n}{1.75cm}
+\psset{shadow=true,blur=true,shadowsize=10pt,blurradius=5pt}
+\pscharpath{\RM PSTricks}
+\end{postscript}
+
+\texttt{pst-3d}
+
+\begin{pspicture}(-4.5,-3)(3,4.75)
+\psset{viewpoint=1 1.5 0.8}
+{\psset{gridlabels=0pt,subgriddiv=0,gridcolor=black!50}
+\ThreeDput[normal=0 0 1]{\psgrid(5,5)}
+\ThreeDput[normal=0 -1 0] {\ psgrid(5,5)}
+\ThreeDput[normal=1 0 0]{\psgrid(5,5)}}
+\ThreeDput[normal=0 0 1] {%
+\psline[linewidth=3pt,linecolor=blue]{->}(4,4)(4,5.5)
+\uput[90](4,5.5){%
+\psrotateleft{\textcolor{blue}{$\vec{n}_A$}}}}%$%xy
+\ThreeDput[normal=0 -1 0]{%
+\psline[linewidth=3pt,linecolor=green]{->}(4,0)(5.5,0)
+\uput[90](5.5,0){ \ psscalebox{-1 1}{%
+\textcolor{green}{$\vec{n}_B$}}}}%$%xz
+\ThreeDput[normal=1 0 0]{%
+\psline[linewidth=3pt,linecolor=red]{->}(0,4)(0,5.5)
+\uput[0](0,5.5){$\vec{n}_{top}$}} %yz
+\ThreeDput[normal=0 0 1] (0,0,4){%
+\psframe*[linecolor=gray!25] (4,4)
+\rput(2,2){\Huge\textbf{TOP}}}
+\ThreeDput[normal=0 1 0](4,4,0){%
+\psframe*[linecolor=gray!5](4,4)
+\rput(2,2){\Huge\textbf{side A}}}
+\ThreeDput[normal=1 0 0] (4,0,0){%
+\psframe*[linecolor=gray!15](4,4)
+\rput(2,2){\Huge\textbf{side B}}}
+% Die kleinen Achsen
+\ThreeDput[normal=0 0 1](0,0,4){%
+\psline(4,0)\uput[90](3,0){X$_{top}$}
+\psline(0,4)\uput[0] (0,3){Y$_{top}$}}
+\ThreeDput[normal=0 1 0](4,4,0){%
+\psline(4,0)\uput[90](3,0){X$_{A}$}
+\psline(0,4)\uput[0] (0,3){Y$_{A}$}}
+\ThreeDput[normal=1 0 0] (4,0,0){%
+\psline(4,0)\uput[90](3,0){X$_{B}$}
+\psline(0,4)\uput[0](0,3){Y$_{B}$}}
+\end{pspicture}
+
+\texttt{pst-ob3d}
+\begin{pspicture}(-1,-0.5)(3,1.7)
+\psset{fillstyle=solid,fillcolor=yellow,RandomFaces=true}
+\PstDie[viewpoint=1 -3 1]
+\rput(1.5,0){\PstCube[Corners=true,CornersColor=blue,
+fillstyle=solid,fillcolor=cyan,viewpoint=1 2 1]
+{1}{1}{1}}
+\end{pspicture}
+
+\texttt{pst-gr3d}
+\begin{postscript}
+\psscalebox{0.5}{\footnotesize
+\PstGridThreeD[GridThreeDNodes,unit=2.5](2,3,2)
+\multido{\ix=0+1}{3}{%
+\multido{\iy=0+1}{4}{%
+\multido{\iz=0+1}{3}{%
+\rput*(Gr3dNode\ix\iy\iz){$\ix\iy\iz$}}}}
+\psset{linecolor=blue,linestyle=dashed,
+linewidth=0.3pt,arrowscale=2,nodesep=8pt}
+\pcline{->}(Gr3dNode000)(Gr3dNode202)
+\pccurve{->}(Gr3dNode000)(Gr3dNode232)}
+\end{postscript}
+
+\texttt{pst-fr3d}
+\begin{postscript}
+\PstFrameBoxThreeD[FrameBoxThreeDOn=false]
+{\Large Off}
+\quad
+\PstFrameBoxThreeD{\Large On}% default
+\end{postscript}
+
+\texttt{pst-3dplot}
+\begin{pspicture}(-4.8,-1.75)(4.8,3.75)
+\psset{unit=4cm,drawCoor,beginAngle=90,endAngle=180,linestyle=dotted}
+\def\oA{\pstThreeDLine[linecolor=blue,linewidth=3pt,
+arrows=c-> ](0,0,0)(1,60,70)}
+\def\oB{\pstThreeDLine[linecolor=red,linewidth=3pt,
+arrows=c->](0,0,0)(1,10,50)}
+\def\oAB{\pstThreeDEllipse[beginAngle=58,
+endAngle=90](0,0,0)(1,140,40)(1,10,50)}
+
+\pstThreeDCoor[drawing,linewidth=1pt,linecolor=black,
+linestyle=solid,xMin=0,xMax=1.1,yMin=0,yMax=1.1,
+zMin=0,zMax=1.1]
+\pstThreeDEllipse(0,0,0)(-1,0,0)(0,1,0)
+\pstThreeDEllipse(0,0,0)(-1,0,0)(0,0,1)
+\pstThreeDEllipse[beginAngle=0,
+endAngle=90](0,0,0)(0,0,1)(0,1,0)
+\psset{SphericalCoor,linestyle=solid}
+\pstThreeDDot[dotstyle=none](1,10,50)
+\pstThreeDDot[dotstyle=none](1,60,70)
+\pscustom[fillstyle=solid,fillcolor=black!20,
+linestyle=none]{\oB\oAB\oA} \oA\oB\oAB
+\pstThreeDPut[origin=lb](1.1,60,70){$\vec\Omega_1$}
+\pstThreeDPut[origin=rb](1.2,10,50){$\vec\Omega_2$}
+\pstThreeDPut[origin=lb](1,10,65){$\gamma_{12}$}
+\end{pspicture}
+
+\texttt{pst-solides3d}
+\begin{pspicture}(-2,-2)(2,2)
+\psset{viewpoint=100 50 20 rtp2xyz,
+Decran=60,lightsrc=10 15 10}
+\defFunction[algebraic]{corne}(u,v)%
+{(2 + u*cos(v))*sin(2*pi*u)}%
+{(2 + u*cos(v))*cos(2*pi*u)+2*u}%
+{u *sin(v)}
+\psSolid[object=surfaceparametree,base=0 1 0 2 pi mul,function=corne,ngrid=20]
+\end{pspicture}
+
+\texttt{pst-circ}
+\begin{pspicture}(4,3.5)
+\pnode(0,3){A}\pnode(0,0){B}
+\pnode(4,1.5){C}
+\OA[OAperfect=false,OAiplus,
+OAiminus,OAiout,
+OAipluslabel=$i_P$,
+OAiminuslabel=$i_M$,
+OAioutlabel=$i_A$,
+intensitycolor=red,
+intensitylabelcolor=red](A)(B)(C)
+\end{pspicture}
+
+
+
+\texttt{pst-barcode}
+\begin{postscript}
+\psframebox{\begin{pspicture}(2.5,1in)
+\psbarcode{12345678}{includetext}{ean8}
+\end{pspicture}}
+\end{postscript}
+
+\texttt{pst-bar}
+\begin{postscript}
+\psset{unit=0.5in}%
+\begin{pspicture}(0,-0.5)(3,4.5)%
+\psgrid[xunit=1.5in,gridlabels=0,%
+subgriddiv=0,griddots=30](0,0)(1,4)%
+\psaxes[axesstyle=frame,Ox=0,Dx=1,labels=y,%
+ticks=y](0,0)(3,4)%
+\readpsbardata{\data}{example2.csv}%
+\psbarchart[barstyle={red,blue}]{\data}%
+\end{pspicture}
+\end{postscript}
+
+\texttt{pst-math}
+\begin{pspicture*}(-0.75,-.75)(6,5)
+\psaxes{->}(6,5)
+\psset{linewidth=1.5pt,plotpoints=200}
+\psplot{.1}{6}{x GAMMA}
+\psplot{.1}{6}{x GAMMALN}
+\end{pspicture*}
+
+\texttt{pst-func}
+\begin{pspicture*}(-3,-2.2)(3.6,2.5)
+\psaxes{->}(0,0)(-3,-2)(3.2,2)[$x$,0][$y$,90]
+\psplotImp[linewidth=2pt,algebraic](-5,-2.2)(5,2.4){%
+(x^2+y^2)^2-8*(x^2-y^2)}
+\rput*(2,1.5){$\left(x^2+y^2\right)^2-8(x^2-y^2)=0$}
+\psplotImp[linewidth=1pt,linecolor=red,
+algebraic](-5,-2.2)(5,2.4){(x^2+y^2)^2-4*(x^2-y^2)}
+\end{pspicture*}
+
+\texttt{pst-eucl}
+\begin{postscript}
+\pstGeonode[PosAngle={0,90}](2,2){A_0}(-2,2){B_0}%
+\psset{RotAngle=90}
+\pstRotation[PosAngle=270]{A_0}{B_0}[D_0]
+\pstRotation[PosAngle=180]{D_0}{A_0}[C_0]
+\pspolygon(A_0)(B_0)(C_0)(D_0)%
+\psset{PointSymbol=none, PointName=none, HomCoef=.2}
+\multido{\n=1+1,\i=0+1}{20}{%
+\pstHomO[PosAngle=0]{B_\i}{A_\i}[A_\n]
+\pstHomO[PosAngle=90]{C_\i}{B_\i}[B_\n]
+\pstHomO[PosAngle=180]{D_\i}{C_\i}[C_\n]
+\pstHomO[PosAngle=270]{A_\i}{D_\i}[D_\n]
+\pspolygon(A_\n)(B_\n)(C_\n)(D_\n)}% fin multido
+\end{postscript}
+
+\texttt{pst-labo}
+\begin{postscript}
+\psset{unit=0.5cm,
+glassType=becher,
+burette=false}
+\pstDosage[phmetre]
+\end{postscript}
+
+\texttt{psgo}
+\begin{postscript}
+\psscalebox{0.7}{%
+\begin{psgopartialboard}[9]{(4,1)(9,6)}
+\stone{white}{c}{3} \stone{white}{e}{3}
+\stone{white}{d}{2} \stone{white}{d}{4}
+\stone{black}{f}{3} \stone{black}{e}{2}
+\stone{black}{e}{4}
+\end{psgopartialboard}}
+\end{postscript}
+
+\texttt{vaucanson-g}
+\begin{postscript}
+\begin{VCPicture}{(0,-2)(5.5,2)}
+\State[p]{(0,0)}{A} \State{(2.5,0)}{B}
+\State[r]{(5.5,0)}{C}\Initial{A} \Final{C}
+\EdgeL{A}{B}{a} \ArcL{B}{C}{b}
+\ArcL{C}{B}{b} \LoopN{A}{a} \LoopS{C}{d}
+\end{VCPicture}
+\end{postscript}
+
+Example for PSFRAG (from auto-pst-pdf)
+psfrag example with replacements defined in example-psfrag.tex:\par
+\begin{postscript}
+\psfragfig{example}
+\end{postscript}
+The same example with a psfrag override (bottom left):
+\begin{postscript}
+\psfragfig{example}[\psfrag{[Mp]}{$N_Q*$}]
+\end{postscript}
+\end{document}
diff --git a/Master/texmf-dist/doc/latex/pst2pdf/test2.pdf b/Master/texmf-dist/doc/latex/pst2pdf/test2.pdf
new file mode 100644
index 00000000000..e92616a5433
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/pst2pdf/test2.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/pst2pdf/test2.tex b/Master/texmf-dist/doc/latex/pst2pdf/test2.tex
index ca85de58694..c29479b54ec 100644
--- a/Master/texmf-dist/doc/latex/pst2pdf/test2.tex
+++ b/Master/texmf-dist/doc/latex/pst2pdf/test2.tex
@@ -12,11 +12,9 @@
foo\begin{pspicture}[showgrid=true](4,2)\psscaleboxto(8,2){foo}\end{pspicture}bar
-\begin{PSTexample}[width=4cm,pos=r]
\begin{pspicture}[showgrid=true](4,2)
\psscaleboxto(4,2){foo bar}
\end{pspicture}
-\end{PSTexample}
foo\begin{pspicture}[showgrid=true](4,2)
@@ -25,12 +23,10 @@ foo\begin{pspicture}[showgrid=true](4,2)
-\begin{PSTexample}[pos=t]
\begin{postscript}
\psscalebox{0.5}{%
\psCalDodecaeder[style=january,unit=0.75,Year=2010]}
\end{postscript}
-\end{PSTexample}
\includegraphics{tux.jpg}% a jpg image
@@ -44,7 +40,6 @@ foo bar baz foo bar \rnode{baz}{baz} foo bar baz
foo bar baz
-\begin{PSTexample}[pos=b]
\begin{postscript}
\psframebox{%
\begin{pspicture}(-3,-2)(3,6.5)
@@ -56,10 +51,8 @@ foo bar baz
\end{pspicture}
}
\end{postscript}
-\end{PSTexample}
-\begin{PSTexample}[width=7.5cm]
\begin{postscript}
\begin{pspicture*}(-4,-2)(3,6.5)
\pstThreeDCoor[zMax=7]
@@ -69,9 +62,6 @@ foo bar baz
\pstThreeDLine[linecolor=red]{->}(0,-1,0)(0,4,0)
\end{pspicture*}
\end{postscript}
-\end{PSTexample}
-
-
\end{document} \ No newline at end of file
diff --git a/Master/texmf-dist/doc/latex/pst2pdf/test3.tex b/Master/texmf-dist/doc/latex/pst2pdf/test3.tex
index fab1a0df4c2..db581e1b374 100644
--- a/Master/texmf-dist/doc/latex/pst2pdf/test3.tex
+++ b/Master/texmf-dist/doc/latex/pst2pdf/test3.tex
@@ -1,9 +1,11 @@
\documentclass{article}
\usepackage{graphicx,pst-calendar,pst-3dplot}% Pakete
\pagestyle{empty}
-\parindent=0pt\begin{document}
+\parindent=0pt
+\begin{document}
-foo\begin{postscript}
+foo
+\begin{postscript}
\psframebox{% begin box
\pspicture(-3,-2)(3,6.5)
\pstThreeDCoor[zMax=7]
@@ -13,10 +15,12 @@ foo\begin{postscript}
\pstThreeDLine[linecolor=red]{->}(0,-1,0)(0,4,0)
\endpspicture}% end box
\end{postscript}
+
bar
\pspicture(3,3)
-\psframe[fillstyle=solid,fillcolor=red!30](3,3)\endpspicture
+\psframe[fillstyle=solid,fillcolor=red!30](3,3)
+\endpspicture
\includegraphics{tux.jpg}
% Ende
diff --git a/Master/texmf-dist/scripts/pst2pdf/pst2pdf.pl b/Master/texmf-dist/scripts/pst2pdf/pst2pdf.pl
index 040cdf7e7dd..568f0aef049 100755
--- a/Master/texmf-dist/scripts/pst2pdf/pst2pdf.pl
+++ b/Master/texmf-dist/scripts/pst2pdf/pst2pdf.pl
@@ -4,9 +4,9 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' && eval 'exec perl -S $0 $
use strict; # to be sure, that all is safe ... :-)
# $Id: pst2pdf.pl 611 2011-12-14 08:41:35Z herbert $
-# v. 0.14 simplify the use of PSTricks with pdf
+# v. 0.15 simplify the use of PSTricks with pdf
# 2011-12-12 (c) Herbert Voss <hvoss@tug.org>
-# Pablo González Luengo
+# Pablo González Luengo
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -28,116 +28,104 @@ use File::Copy; # copying files
use File::Basename; # scan argument
use IO::File; # simple IO operation
use Getopt::Long; # read parameter
-use autodie;
+use autodie; # more safe
#----------------------- User part begin ------------------------
-my $imageDir = "images";# where to save the images
+my $imageDir = "images"; # where to save the images
my $Iext = ".pdf"; # leave empty, if not a special one
my $tempDir = "."; # temporary directory
-my $verbose = 0; # 0 or 1, logfile
-my $clear = 0; # 0 or 1, clears all temporary files
-my $DPI = 75; # very low value for the png's
-my $Iscale = 1; # for \includegraphics
-my $noImages = 0; # 1->create no images
-my $single = 0; # 1->single create images
+my $verbose = 0; # 0 or 1, logfile
+my $clear = 0; # 0 or 1, clears all temporary files
+my $DPI = 75; # very low value for the png's
+my $Iscale = 1; # for \includegraphics
+my $noImages = 0; # 1->no create images
+my $single = 0; # 1->create images in single mode
my $runBibTeX = 0; # 1->runs bibtex
-my $runBiber = 0; # 1->runs biber and sets $runBibTeX=0
-my $ppm = 0; # 1->create .ppm files
-my $norun = 0; # 1->runs pdflatex
-my $eps = 0; # 1->create .eps files
-my $files = 0; # 1->create image files .tex
-my $all = 0; # 1->create all images and files for type
-my $nopdftk = 0; # 1->create all images and files for type in single mode
-my $xetex = 0; # 1->Using XeLaTeX for compilation.
+my $runBiber = 0; # 1->runs biber and sets $runBibTeX=0
+my $jpg = 0; # 1->create .jpg files
+my $png = 0; # 1->create .png files
+my $ppm = 0; # 1->create .ppm files
+my $eps = 0; # 1->create .eps files
+my $files = 1; # 1->create image files .tex
+my $all = 0; # 1->create all images and files for type
+my $xetex = 0; # 1->Using (Xe)LaTeX for compilation.
+my $PS2 = " "; # Options for ps2pdf
#----------------------- User part end ---------------------------
#-------------- program identification, options and help ---------
my $program = "pst2pdf";
+my $nv="0.15";
my $ident = '$Id: pst2pdf.pl 611 2011-12-14 08:41:35Z herbert $';
my $copyright = <<END_COPYRIGHT ;
-Copyright 2011-01-18 (c) Herbert Voss <hvoss\@tug.org>
+Copyright 2011-2013 (c) Herbert Voss <hvoss\@tug.org> and Pablo González.
END_COPYRIGHT
my $licensetxt= <<END_LICENSE ;
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
-
- This program is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- MA 02111-1307 USA
+
END_LICENSE
-my $title = "$program $ident\n";
+my $title = "$program $nv $ident\n";
my $usage = <<"END_OF_USAGE";
${title}Usage: $program <texfile.tex> [Options]
-pst2pdf run a TeX source, and convert all PS-related part as
- single images (pdf or eps or ppm, default pdf)
- and then runs pdflatex. See pst2pdf documentation for more info
+pst2pdf run a TeX source, read all PS-related part and convert in
+ single images in pdf,eps,jpg or png format (default pdf) and
+ create new file whitout pst-enviroment and runs (pdf/Xe)latex.
+ See pst2pdf documentation for more info.
Options:
- --help - display this help and exit
- --version - display version information and exit
- --license - display license information and exit
- --imageDir - the dir for the created images (default images)
- --DPI=<int> - the dots per inch for a cretaed ppm files (default 75)
- --ppm - create .ppm files
- --eps - create .eps files
- --Iscale=<real> - the value for [scale=] in \\includegraphics
- --noImages - generate files without compile (need -norun)
- --verbose - creates long log
- --clear - delete all temp files
- --norun - create file-pdf.tex, but, no run pdflatex
- --runBibTeX - run bibtex on the aux file, if exists
- --runBiber - run biber on the bcf file, if exists
- --files - create images files (.tex) for all pst enviroment
- --single - create images whitout pdftk and auto-pst-pdf
- --all - create all image type and images.tex
- --nopdftk - create all image type and images.tex in single mode
- --xetex - using XeLaTeX for compilation.
+ -h,-help - display this help and exit
+ -l,-license - display license information and exit
+ -imageDir= - the dir for the created images (default images)
+ -d,-DPI=<int> - the dots per inch for a cretaed ppm files (default 75)
+ -j,-jpg - create .jpg files (need pdftoppm and ImageMagick)
+ -p,-png - create .png files (need pdftoppm and ImageMagick)
+ -e,-eps - create .eps files (need pdftops)
+ -Iscale=<real> - the value for [scale=] in \\includegraphics
+ -noImages - generate file-pdf.tex, but not images
+ -v,-verbose - creates log file (.plog)
+ -c,-clear - delete all tmp files
+ -runBibTeX - run bibtex on the aux file, if exists
+ -runBiber - run biber on the bcf file, if exists
+ -s,-single - create images whitout pdftk
+ -a,-all - create all image type and images.tex
+ -x,-xetex - using (Xe)LaTeX for compilation
+ -PS2=<opt> - pass options to ps2pdf (default empty)
Examples:
-* $program test.tex --all
-* produce test-pdf.tex and ppm,eps,tex and pdf for pst-enviroment in image dir
+* $program test.tex -all
+* produce test-pdf.tex whitout pst-enviroment and create image dir
+* whit all images (pdf,eps,jpg,png) and source(.tex) for all pst-enviroment
END_OF_USAGE
#
my $result=GetOptions (
- "help",
- "version",
- "license",
- "DPI=i" => \$DPI, # numeric
- "Iscale=f" => \$Iscale, # real
- "imageDir=s" => \$imageDir, # string
- "tempDir=s" => \$tempDir, # string
- "Iext=s" => \$Iext, # string
- "clear" => \$clear, # flag
- "noImages" => \$noImages, # flag
- "single" => \$single, # flag
- "runBibTeX" => \$runBibTeX, # flag
- "ppm" => \$ppm, # flag
- "norun" => \$norun, # flag
- "eps" => \$eps, # flag
- "files" => \$files, # flag
- "all" => \$all, # flag
- "nopdftk" => \$nopdftk, # flag
- "xetex" => \$xetex, # flag
- "runBiber" => \$runBiber, # flag
- "verbose" => \$verbose,
+ 'h|help' => \$::opt_help,
+ 'l|license' => \$::opt_license,
+ 'd|DPI=i' => \$DPI, # numeric
+ "Iscale=f" => \$Iscale, # real
+ "imageDir=s" => \$imageDir, # string
+ "PS2=s" => \$PS2, # string
+ "tempDir=s" => \$tempDir, # string
+ "Iext=s" => \$Iext, # string
+ 'c|clear' => \$clear, # flag
+ "noImages" => \$noImages, # flag
+ 's|single' => \$single, # flag
+ "runBibTeX" => \$runBibTeX, # flag
+ 'e|eps' => \$eps, # flag
+ 'j|jpg' => \$jpg, # flag
+ 'p|png' => \$png, # flag
+ 'a|all' => \$all, # flag
+ 'x|xetex' => \$xetex, # flag
+ "runBiber" => \$runBiber, # flag
+ 'v|verbose' => \$verbose,
) or die $usage;
-#---------------- help functions --------------------------------
+#------------------------ Help functions --------------------------
sub errorUsage { die "Error: @_ (try --help for more information)\n"; }
# options for command line
if ($::opt_help) {
print $usage;
- exit (0);
-}
-if ($::opt_version) {
- print $title;
- print $copyright;
- exit (0);
+ exit (0);
}
if ($::opt_license) {
+ print $title;
+ print "$copyright\n";
print $licensetxt;
exit (0);
}
@@ -156,6 +144,7 @@ open my $LOGfile,'>', "$tempDir/$name.plog"; # our own log file
LOG ("==> imageDir = $imageDir");
LOG ("==> Iext = $Iext");
LOG ("==> DPI = $DPI");
+ LOG ("==> PS2 = $PS2");
LOG ("==> Iscale = $Iscale");
LOG ("==> tempDir = $tempDir");
LOG ("==> verbose = $verbose");
@@ -165,8 +154,9 @@ open my $LOGfile,'>', "$tempDir/$name.plog"; # our own log file
LOG ("==> runBibTeX= $runBibTeX");
LOG ("==> runBiber = $runBiber");
LOG ("==> ppm = $ppm");
- LOG ("==> norun = $norun");
LOG ("==> eps = $eps");
+ LOG ("==> jpg = $jpg");
+ LOG ("==> png = $png");
LOG ("==> files = $files");
LOG ("==> xetex = $xetex");
@@ -179,33 +169,43 @@ if ($ppm) {
LOG ("Generate .ppm files ...");
$ppm = 1;
}
-if ($norun) {
- LOG ("no compile $name-pdf.tex");
- $norun = 1;
-}
if ($eps) {
LOG ("Generate .eps files ...");
$eps = 1;
}
+if ($jpg) {
+ LOG ("Generate .jpg files ...");
+ $ppm = 1;
+ $jpg = 1;
+}
+if ($png) {
+ LOG ("Generate .png files ...");
+ $ppm = 1;
+ $png = 1;
+}
if ($files) {
LOG ("Generate .tex images files ...");
$files=1;
}
if ($all) {
- LOG ("Generate all images files ...");
- $files=$eps = $ppm = $clear = 1;
+ LOG ("Generate all images eps/pdf/files and clear...");
+ $eps =$ppm=$jpg=$png=$clear = 1;
}
-if ($nopdftk) {
- LOG ("single mode generate all images files ...");
- $single=$files=$eps = $ppm = $clear = 1;
+if ($single) {
+ LOG ("single mode generate images files ...");
+ $single= 1;
}
if ($xetex) {
LOG ("Compiling using XeLaTeX ...");
$xetex=1;
}
+if ($noImages ) {
+ LOG ("no create images");
+ $single= 0;
+ }
my $imgNo = 1; # internal image counter
-#----------- single mode no need pdftk and auto-pst-pdf ----------------------
+#----------- single mode, no need pdftk ----------------------
if ($single) {
LOG ("Running on [$path][$name][$ext]");
open my $FILE,'<', "$TeXfile" ; # the source
@@ -213,11 +213,11 @@ LOG ("single mode generate images...");
if (-d $imageDir) { LOG ("$imageDir exists") }
else { mkdir("$imageDir", 0744) ;}
savePreamble($name);
+runXPD($name);
runFile($name);
close $FILE; # close source file
close $LOGfile;
-}
-#---------------- end single --------------
+}#---------------- Default way, using pdftk --------------
else{
LOG ("Running on [$path][$name][$ext]");
open my $FILE,'<', "$TeXfile" ; # the source
@@ -226,8 +226,8 @@ if (-d $imageDir) { LOG ("$imageDir exists") }
else { mkdir("$imageDir", 0744) ;
LOG ("Imagedir created"); }
LOG ("go to savePreamble ... ");
-runBurst($tempDir);
savePreamble($name);
+runXPD($name);
runFile($name);
LOG ("done!\n go to runFile ...");
LOG ("done!");
@@ -235,49 +235,24 @@ close $FILE; # close source file
close $LOGfile;
}# !noImages
}
-#------------ Create filename-pics.pdf, split and generate .ppm
-sub runBurst{
-if ($single){ print "single mode";}
-else{
-my $entrada = "$TeXfile";
-my $salida = "$name-pics.tex";
- open my $ENTRADA,'<', "$entrada";
- open my $SALIDA,'>',"$salida";
- print $SALIDA "\\AtBeginDocument\{\n";
-if ($xetex){
- print $SALIDA "\\RequirePackage\[xetex,active,tightpage\]\{preview\}\n";}
-else{
- print $SALIDA "\\RequirePackage\[active,dvips,tightpage\]\{preview\}\n";}
- print $SALIDA "\\renewcommand\\PreviewBbAdjust\{-600pt -600pt 600pt 600pt\}\n";
- print $SALIDA "\\newenvironment{postscript}{}{}\n";
- print $SALIDA "\\PreviewEnvironment\{postscript\}\n";
- print $SALIDA "\\PreviewEnvironment\{pspicture\}\}\n";
- while ( my $linea = <$ENTRADA> ) {
- print $SALIDA $linea;}
- close $ENTRADA;
- close $SALIDA;
-# --------------------Compiling File --------------------------
-if ($xetex){
- system("xelatex -interaction=batchmode $tempDir/$name-pics.tex");
- system("pdfcrop -xetex $tempDir/$name-pics.pdf $tempDir/$name-pics.pdf");}
-else{
- system("latex -interaction=batchmode $tempDir/$name-pics.tex");
- system("dvips $tempDir/$name-pics.dvi");
- system("ps2pdf -dProcessColorModel=/DeviceCMYK -dPDFSETTINGS=/prepress $tempDir/$name-pics.ps");
- system("pdfcrop $tempDir/$name-pics.pdf $tempDir/$name-pics.pdf");}
- system("pdftk $tempDir/$name-pics.pdf burst output $imageDir/$name-fig-\%1d.pdf");
-if ($ppm){
- system("pdftoppm -r $DPI $tempDir/$name-pics.pdf $imageDir/$name-fig");}
- }
+# Create xpdfrc conf for silent output pdftops/pdftoppm mesagge in windows
+
+sub runXPD{
+if ($^O eq 'MSWin32'){
+open my $ppmconf, '>', "$tempDir/xpd";
+print $ppmconf <<'EOH';
+errQuiet yes
+EOH
+close $ppmconf;
+ }
}
-#------------ end pdftk burst
-LOG ("runpdfTeX ... ");
-runpdfTeX("$path$name",$name);
-LOG ("all finished ... :-)");
+# end fix
+
# create a preamble file
# if we have a \input command inside the preamble, it doesn't hurt, we need
# it anyway for the postscript files and the pdf one.
-# ----------------- Save Preamble ----------------------------------------
+
+# ----------------- Save Preamble ---------------------
sub savePreamble {
my $filename = pop; # get the file name
LOG ("----- Start Preamble -----");
@@ -395,46 +370,61 @@ sub searchPS { # search the PostScript parts
LOG ("<----PStotal<----");
}
close $FILE;
- return @PStotal; # return all PS sequences
+ return @PStotal; # return all PS sequences
}
-# Creating ifile.tex and eps, pdf and ppm for images
-if ($single){
+# Creating file.tex and .pdf(eps,ppm) for images in single mode
+
sub runsingle{
my $filename = pop;
- if ($xetex){
- system("xelatex -interaction=batchmode $tempDir/$filename-fig");
- system("pdfcrop -xetex $tempDir/$filename-fig.pdf $imageDir/$filename-fig-$imgNo.pdf");}
- else{
- system("latex -interaction=batchmode $tempDir/$filename-fig");
- system("dvips $tempDir/$filename-fig");
- system("ps2pdf -dProcessColorModel=/DeviceCMYK -dPDFSETTINGS=/prepress $tempDir/$filename-fig.ps");
- system("pdfcrop $tempDir/$filename-fig.pdf $imageDir/$filename-fig-$imgNo.pdf");}
- if ($files){
- copy("$filename-fig.tex", "$imageDir/$filename-fig-$imgNo.tex");}
- system("pdfcrop $tempDir/$filename-fig.pdf $imageDir/$filename-fig-$imgNo.pdf");
- if ($eps) {
- system("pdftops -level3 -eps $imageDir/$filename-fig-$imgNo.pdf $imageDir/$filename-fig-$imgNo.eps");}
- if ($ppm) {
- system("pdftoppm -r $DPI $imageDir/$filename-fig-$imgNo.pdf $imageDir/$filename-fig-$imgNo");}
- $imgNo=$imgNo+1;
+
+if ($xetex){
+ system("xelatex -interaction=batchmode $filename");
+ system("pdfcrop -margins 1 -xetex $filename.pdf $imageDir/$filename-$imgNo.pdf");
+ }
+else{
+ system("latex -interaction=batchmode $filename");
+ system("dvips -q -Ppdf $filename");
+ system("ps2pdf $PS2 $filename.ps");
+ system("pdfcrop -margins 1 $filename.pdf $imageDir/$filename-$imgNo.pdf");
+ }
+if ($files){
+ copy("$filename.tex", "$imageDir/$filename-$imgNo.tex");
}
-}
+
+if ($eps) {
+ if ($^O eq 'MSWin32'){
+ system("pdftops -cfg $tempDir/xpd -q -level3 -eps $imageDir/$filename-$imgNo.pdf $imageDir/$filename-$imgNo.eps");
+ }
+ else{
+ system("pdftops -q -level3 -eps $imageDir/$filename-$imgNo.pdf $imageDir/$filename-$imgNo.eps");
+ }
+ }
+if ($ppm) {
+ if ($^O eq 'MSWin32'){
+ system("pdftoppm -cfg xpd -q -r $DPI $imageDir/$filename-$imgNo.pdf $imageDir/$filename-$imgNo");
+ }
else{
-#----------------- Creating files.tex and .eps for images --------------
+ system("pdftoppm -q -r $DPI $imageDir/$filename-$imgNo.pdf $imageDir/$filename-$imgNo");
+ }
+ }
+
+ $imgNo=$imgNo+1;
+}
+#------------------- Copy files.tex for images in default mode ---------
sub runTeX{
my $filename = pop;
- if ($eps){
- system("pdftops -level3 -eps $imageDir/$filename-$imgNo.pdf $imageDir/$filename-$imgNo.eps");
- }
if ($files){
- copy("$filename.tex", "$imageDir/$filename-$imgNo.tex");
-}
- $imgNo=$imgNo+1;
+ copy("$filename.tex", "$imageDir/$filename-$imgNo.tex");
}
+ $imgNo=$imgNo+1;
}
+
+#------------------ Create files.tex for images --------------
sub runFile {
+
my $filename = pop;
my @PSarray = searchPS();
+
if ( $verbose ) {
LOG("---->PSarray---->");
for my $aref ( @PSarray ) {
@@ -458,33 +448,47 @@ sub runFile {
close $FILEsub;
close $FILEp;
if ($single) {
- runsingle("$name");
- }
- else{
- runTeX("$tempDir/$name-fig");
- }
-}
+ runsingle("$tempDir/$filename-fig");
+ }
+ else{runTeX("$tempDir/$filename-fig");}
+ }
}
+LOG ("runpdfTeX ... ");
+runpdfTeX("$path$name",$name);
+LOG ("all finished ... :-)");
+
# ----------------Renaming ppm need for correct name
if(!$noImages){
my $dren = "$tempDir/$imageDir";
- my $fichero = '';
+ my $fich = '';
my $ppmren = '';
+ my $PPMno = 1;
my $renNo = 1;
- if(opendir(DIR,$dren)){
+ if(opendir(DIR,$dren)){
foreach (readdir DIR){
- $fichero = $_;
- if ( $fichero =~ /($name-fig-)(\d+|\d+[-]\d+).ppm/) {
+ $fich = $_;
+ if ( $fich =~ /($name-fig-)(\d+|\d+[-]\d+).ppm/) {
my $renNo = int($2);
my $newname="$1$renNo.ppm";
- $ppmren = rename("$dren/$fichero","$dren/$newname");
- }
+ $ppmren = rename("$dren/$fich","$dren/$newname");
+ if($jpg){
+ system("convert $imageDir/$name-fig-$renNo.ppm $imageDir/$name-fig-$renNo.jpg");
+ }
+ if($png){
+ system("convert $imageDir/$name-fig-$renNo.ppm $imageDir/$name-fig-$renNo.png");
+ }
+ }
+ }
}
-}
closedir DIR;
-}# end renaming
-#--------------------------- Replace files----------------------
+ if($clear){
+ unlink <$imageDir/*.ppm>;
+ }
+}# end renaming ppm
+
+#------------------ Replace pst enviroment for images---------
sub runpdfTeX() {
+
my ($name,$pdfname) = @_;
open my $PDF,'>',"$tempDir/$pdfname-pdf.tex";
open my $FILE,'<',"$name.tex";
@@ -492,7 +496,7 @@ sub runpdfTeX() {
my $IMGno = 1;
my $depth = -1;
my $type = -1;
- my $EndDocument = 0; # ignore all after \end{document}
+ my $EndDocument = 0; # ignore all after \end{document}
my $iVerb = 0;
while (<$FILE>) { # scan the input file
if ( !$iVerb ) {
@@ -564,7 +568,77 @@ sub runpdfTeX() {
} # while (<$FILE>)
close $FILE;
close $PDF;
-#------------------- Coment pst-package for pdfLaTeX --------------------
+# ------------- Create one file contain all pst (default mode) ----------------
+if (!$single==!$noImages){
+my ($name,$pdfname) = @_;
+my @PSTarray = searchPS();
+my @pstfiles = glob("$imageDir/*.tex");
+@pstfiles =
+ map { $_->[1] }
+ sort { $a->[0] <=> $b->[0] }
+ map { [ ($_ =~ /(\d+)\.tex$/), $_ ] }
+ @pstfiles;
+my @container;
+for my $archivo (@pstfiles) {
+
+ open my $FH, '<:crlf', $archivo; # EOL
+ my $tex = join q{}, <$FH>; #
+ close $FH;
+ my($pstimg) = $tex =~ m/\\begin\{document\}\n(.+?)\n\\end\{document\}/sm;
+ push @container, $pstimg if $pstimg;
+}
+open my $FILE,'<',"$tempDir/$name.preamble";
+open my $OUTPST,'>',"$tempDir/$name-pst.tex";
+ while (<$FILE>) {print $OUTPST $_; }
+ print $OUTPST "\\newenvironment{postscript}{}{}\n";
+ print $OUTPST "\\pagestyle{empty}\n";
+ print $OUTPST "\\begin{document}\n";
+my $fig = 1;
+for my $item (@container) {
+ print $OUTPST $item;
+ print $OUTPST "\n%fig" . "$fig\n";
+ print $OUTPST "\\newpage\n";
+ $fig++;
+}
+ print $OUTPST "\\end{document}";
+ close $OUTPST;
+ close $FILE;
+# close all
+# -------------------- Compiling File using pdftk ----------------------
+my ($name,$pdfname) = @_;
+if ($xetex){
+ system("xelatex -interaction=batchmode $tempDir/$pdfname-pst.tex");
+ system("pdfcrop -xetex $tempDir/$name-pst.pdf $tempDir/$pdfname-pst.pdf");
+ }
+else{
+ system("latex -interaction=batchmode $tempDir/$pdfname-pst");
+ system("dvips -q -Ppdf $tempDir/$pdfname-pst");
+ system("ps2pdf $PS2 $tempDir/$pdfname-pst.ps $tempDir/$pdfname-pst.pdf");
+ system("pdfcrop -margins 1 $tempDir/$pdfname-pst.pdf $tempDir/$pdfname-pst.pdf");
+ }
+ system("pdftk $tempDir/$pdfname-pst.pdf burst output $imageDir/$pdfname-fig-\%1d.pdf");
+if ($eps){
+for my $fichero_pdf (<$imageDir/*.pdf>) {
+ (my $fichero_eps = $fichero_pdf) = s/ppm$/png/i;
+ if ($^O eq 'MSWin32'){
+ system("pdftops -cfg xpd -q -level3 -eps $fichero_pdf $fichero_eps"); # conversión
+ }
+ else{
+ system("pdftops -q -level3 -eps $fichero_pdf $fichero_eps"); # conversión
+ }
+ }
+}
+if ($ppm){
+ if ($^O eq 'MSWin32'){
+ system("pdftoppm -cfg xpd -q -r $DPI $tempDir/$pdfname-pst.pdf $imageDir/$pdfname-fig");
+ }
+ else{
+ system("pdftoppm -q -r $DPI $tempDir/$pdfname-pst.pdf $imageDir/$pdfname-fig");
+ }
+ }
+ }
+
+#---------------- Coment pst-package in file-pdf.tex for (pdf/Xe)LaTeX ----------------
open my $IPDF,'<', "$tempDir/$pdfname-pdf.tex";
undef $/; # read all file
my ($uno,$dos) = split(/\\begin\{document\}/,<$IPDF>,2);
@@ -591,15 +665,22 @@ my $clean = join("\n", @preamb, "\\usepackage{grfext}\n\\\PrependGraphicsExtensi
open my $OPDF,'>',"$tempDir/$pdfname-pdf.tex"; # write changes
print $OPDF $clean;
close $OPDF;
-# ------------------------- close coment pst-package ------------------------------
+
my $runAgain = 0;
- if ($norun){print "Done\n";}
- else {
- if($xetex){
- system("xelatex -interaction=batchmode $tempDir/$pdfname-pdf"); print "Done\n";}
- else{
- system("pdflatex -interaction=batchmode $tempDir/$pdfname-pdf"); print "Done\n";}
- }
+
+ if($xetex){ # xelatex mode
+ if ($noImages){print "The file $pdfname-pdf.tex are created (Xe)LaTeX\n";}
+ else{
+ system("xelatex -interaction=batchmode $tempDir/$pdfname-pdf");
+ print "Done, compiled $pdfname-pdf.tex using (Xe)LaTeX\n";}}
+ else{ #pdflatex mode
+ if ($noImages){
+ print "The file $pdfname-pdf.tex are created (pdf)LaTeX\n";}
+ else{
+ system("pdflatex -interaction=batchmode $tempDir/$pdfname-pdf.tex");
+ print "Done, compiled $pdfname-pdf.tex using (pdf)LaTeX\n";}
+ }
+
if (-e "$tempDir/$pdfname-pdf.idx") {
system("makeindex $tempDir/$pdfname-pdf.idx"); $runAgain++;}
if ($runBibTeX && -e "$tempDir/$pdfname-pdf.aux") {
@@ -612,47 +693,37 @@ my $runAgain = 0;
else{
system("pdflatex -interaction=batchmode $tempDir/$pdfname-pdf");}
}
- if ($ppm){
- print "If you need to create jpg/png/svg type cd $imageDir and run\n";
- print "mogrify -format [ext] *.ppm\n";
- }
+
if ($clear) {
- if ($norun){}
- if ($single) {
- unlink "$tempDir/$name-fig.pdf";
- if(!$xetex){
- unlink "$tempDir/$name-fig.dvi";
- unlink "$tempDir/$name-fig.ps";
- }
- unlink "$tempDir/$name-fig.aux";
- unlink "$tempDir/$name-fig.log";
- unlink "$tempDir/$name-fig.tex";
- if(!$verbose) {
- unlink "$tempDir/$name.plog";
- }
- unlink "$tempDir/$name.preamble";
- unlink "$tempDir/$name-pdf.aux";
- unlink "$tempDir/$name-pdf.log";
- }
- else{
- if(!$verbose) {
- unlink "$tempDir/$name.plog";
- }
unlink "$tempDir/$name.preamble";
unlink "$tempDir/$name-pdf.aux";
unlink "$tempDir/$name-pdf.log";
- unlink "$tempDir/$name-pics.pdf";
- unlink "$tempDir/$name-pics.tex";
- unlink "$tempDir/$name-pics.aux";
- if(!$xetex){
- unlink "$tempDir/$name-pics.dvi";
- unlink "$tempDir/$name-pics.ps";}
- unlink "$tempDir/$name-pics.log";
unlink "$tempDir/$name-fig.tex";
- }
+ if ($eps or $ppm){
+ if ($^O eq 'MSWin32'){unlink "$tempDir/xpd";}
+ }
+ if(!$verbose) {unlink "$tempDir/$name.plog";}
+ if ($single) {#comon
+ unlink "$tempDir/$name-fig.pdf";
+ unlink "$tempDir/$name-fig.aux";
+ unlink "$tempDir/$name-fig.log";
+ if($xetex){ }
+ else{
+ unlink "$tempDir/$name-fig.dvi";
+ unlink "$tempDir/$name-fig.ps";}
+ }
+ else{ #clean for pdftk mode
+ unlink "$tempDir/$name-pst.log";
+ unlink "$tempDir/$name-pst.pdf";
+ unlink "$tempDir/$name-pst.aux";
+ if($xetex){ }
+ else{
+ unlink "$tempDir/$name-pst.dvi";
+ unlink "$tempDir/$name-pst.ps";
}
}
-
+}
+}
sub LOG() {
if ( $verbose ) { print $LOGfile "@_\n"; }
}