diff options
author | Karl Berry <karl@freefriends.org> | 2013-03-10 22:38:10 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2013-03-10 22:38:10 +0000 |
commit | 89135e7e1b6a211b066867735c41e9a1a4310c5f (patch) | |
tree | 2196faea0cf74bd49d034d56443ae7644a638c35 | |
parent | 6380d0315e1132891b4735999c26b0a41e6d1aaa (diff) |
pst2pdf (10mar13)
git-svn-id: svn://tug.org/texlive/trunk@29333 c570f23f-e606-0410-a88d-b1316a301751
34 files changed, 2132 insertions, 2173 deletions
diff --git a/Build/source/texk/texlive/linked_scripts/Makefile.am b/Build/source/texk/texlive/linked_scripts/Makefile.am index a57d828b3be..e4d32e1c757 100644 --- a/Build/source/texk/texlive/linked_scripts/Makefile.am +++ b/Build/source/texk/texlive/linked_scripts/Makefile.am @@ -137,7 +137,7 @@ texmf_dist_other_scripts = \ pkfix/pkfix.pl \ pkfix-helper/pkfix-helper \ pmx/pmx2pdf.lua \ - pst2pdf/pst2pdf \ + pst2pdf/pst2pdf.pl \ purifyeps/purifyeps \ splitindex/perl/splitindex.pl \ sty2dtx/sty2dtx.pl \ diff --git a/Build/source/texk/texlive/linked_scripts/Makefile.in b/Build/source/texk/texlive/linked_scripts/Makefile.in index 5a2eeb4d833..bce3c7105c5 100644 --- a/Build/source/texk/texlive/linked_scripts/Makefile.in +++ b/Build/source/texk/texlive/linked_scripts/Makefile.in @@ -318,7 +318,7 @@ texmf_dist_other_scripts = \ pkfix/pkfix.pl \ pkfix-helper/pkfix-helper \ pmx/pmx2pdf.lua \ - pst2pdf/pst2pdf \ + pst2pdf/pst2pdf.pl \ purifyeps/purifyeps \ splitindex/perl/splitindex.pl \ sty2dtx/sty2dtx.pl \ diff --git a/Build/source/texk/texlive/linked_scripts/pst2pdf/pst2pdf b/Build/source/texk/texlive/linked_scripts/pst2pdf/pst2pdf deleted file mode 100755 index da0aba08e4d..00000000000 --- a/Build/source/texk/texlive/linked_scripts/pst2pdf/pst2pdf +++ /dev/null @@ -1,524 +0,0 @@ -eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' && eval 'exec perl -S $0 $argv:q' - if 0; - -use strict; # to be sure, that all is safe ... :-) - -# $Id: pst2pdf.pl 611 2011-12-14 08:41:35Z herbert $ -# v. 0.13 simplify the use of PSTricks with pdf -# 2011-12-12 (c) Herbert Voss <hvoss@tug.org> -# Pablo González Luengo and http://perlenespanol.com -# -# 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 -# -use File::Path; # creating/removing dirs -use File::Copy; # copying files -use File::Basename; # scan argument -use IO::File; # simple IO operation -use Getopt::Long; # read parameter -#----------------------- User part begin ------------------------ -my $imageDir = "images"; # where to save the images -my $Iext = ".pdf"; # leave empty, if not a special one -my $tempDir = "."; # temporary directory -my $verbose = 1; # 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 $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 $miktex = 0; # 1->runs pdlatex for miktex -my $eps = 0; # 1->create .eps files -#----------------------- User part end --------------------------- -#----------------------- program identification, options and help -my $program = "pst2pdf"; -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> -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 $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 and/or eps and/or png and/or ...) - and then runs pdflatex. 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 - --verbose - 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 - --miktex - for miktex users -enable-write18 -Examples: -* $program test.tex --clear --ppm --eps -* produce test-pdf.tex and .ppm,.eps,.tex and .pdf for all images in image dir -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 - "runBibTeX" => \$runBibTeX, # flag - "ppm" => \$ppm, # flag - "norun" => \$norun, # flag - "miktex" => \$miktex, # flag - "eps" => \$eps, # flag - "runBiber" => \$runBiber, # flag - "verbose" => \$verbose, -) or die $usage; -# help functions -sub debug { print STDERR "* @_\n" if $::opt_debug; } -sub warning { print STDERR "==> Warning: @_\n"; } -sub error { die "$title!!! Error: @_\n"; } -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); -} -if ($::opt_license) { - print $licensetxt; - exit (0); -} -# open file -my $InputFilename = ""; -if ($::opt_filter) { - @ARGV == 0 or - errorUsage "Input file cannot be used with filter option"; - debug "Filtering: will read standard input"; -} else { - @ARGV > 0 or errorUsage "Input filename missing"; - @ARGV < 2 or errorUsage "Unknown option or too many input files"; - $InputFilename = $ARGV[0]; - debug "Input filename:", $InputFilename; -} -my @SuffixList = (".tex","",".ltx"); # possible extensions -my ($name,$path,$ext) = fileparse($ARGV[0],@SuffixList); -if ($ext eq "") { $ext = ".tex"; } # me need the extension as well -my $TeXfile = "$path$name$ext"; -my $Logfile = "$tempDir/$name.plog"; # our own log file -open (LOGfile,">$Logfile") or die "cannot open $Logfile!"; -LOG ("Parameters:"); -LOG ("==> imageDir = $imageDir"); -LOG ("==> Iext = $Iext"); -LOG ("==> DPI = $DPI"); -LOG ("==> Iscale = $Iscale"); -LOG ("==> tempDir = $tempDir"); -LOG ("==> verbose = $verbose"); -LOG ("==> clear = $clear"); -LOG ("==> noImages = $noImages"); -LOG ("==> runBibTeX= $runBibTeX"); -LOG ("==> runBiber = $runBiber"); -LOG ("==> ppm = $ppm"); -LOG ("==> norun = $norun"); -LOG ("==> miktex = $miktex"); -LOG ("==> eps = $eps"); - -if ($runBibTeX && $runBiber) { - LOG ("!!! you cannot run BibTeX and Biber at the same document ..."); - LOG ("!!! Assuming to run Biber"); - $runBibTeX = 0; -} -if ($ppm) { - LOG ("Generate .ppm files ..."); - $ppm = 1; -} -if ($norun) { - LOG ("no compile file-pdf.tex"); - $norun = 1; -} -if ($miktex) { - LOG ("enable write 18 ..."); - $miktex = 1; -} -if ($eps) { - LOG ("Generate .eps files ..."); - $eps = 1; -} - -my $imgNo = 1; # internal image counter -my $pstExaLoaded = 0; # Document loads pst-exa - -LOG ("Running on [$path][$name][$ext]"); -open (FILE, "<$TeXfile") or die "cannot open source file $TeXfile!"; # the source -if (!$noImages ) { - if (-d $imageDir) { LOG ("$imageDir exists") } - else { mkdir("$imageDir", 0744) || die "cannot mkdir $imageDir: $!"; -LOG ("Imagedir created"); } -LOG ("go to savePreamble ... "); -savePreamble($name); -runBurst("$tempDir"); -LOG ("done!\n go to runFile ..."); -runFile($name); -LOG ("done!"); -close FILE; # close source file -}# !noImages - -#------------ Create filename-pics.pdf, split and generate .ppm -sub runBurst{ -if ($miktex){system("pdflatex -enable-write18 -interaction=nonstopmode $tempDir/$name");} -else{system("pdflatex -shell-escape -interaction=nonstopmode $tempDir/$name");} -system("pdftk $name-pics.pdf burst output $imageDir/$name-tmp-\%1d.pdf"); -if ($ppm){system("pdftoppm -r $DPI $name-pics.pdf $imageDir/$name-tmp"); -# Renaming .ppm neded for windows -if ($^O eq 'MSWin32') { -my $dren = "$tempDir/$imageDir"; -my $fichero = ''; -my $ppmren = ''; -my $renNo = 1; -if(opendir(DIR,$dren)){ - foreach (readdir DIR){ - $fichero = $_; - if ($fichero =~ /([^\d]+)(\d+).ppm/){ - my $renNo=int($2); - my $newname="$1$renNo.ppm"; - $ppmren = rename("$dren/$fichero","$dren/$newname"); - } - } - } - else - { - print "dont open".$dren; - } -closedir DIR; -} -# end renaming -} -} -#------------ end pdftk burst -LOG ("runpdfTeX ... "); -runpdfTeX("$path$name",$name); -LOG ("all finished ... :-)"); -close LOGfile; - -if ( $clear ) { -unlink "$path$name.txt"; -unlink "$path$name.log"; -unlink "$path$name.plog"; -unlink "$path$name.preamble"; -unlink "$path$name.pdf"; - } -# 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. -sub savePreamble { - my $filename = pop; # get the file name - LOG ("----- Start Preamble -----"); - open (FILEp, ">$tempDir/$filename.preamble") - or die "cannot open preamble file $tempDir/$filename.preamble!"; - while (<FILE>) { # read all until \begin{document} - $pstExaLoaded = index($_,"usepackage{pst-exa}"); - my $i = index($_,"begin{document}"); - if ($i > 0) { - if ($i > 1) { print FILEp substr($_,0,--$i); } # write all until \begin{document} - close(FILEp); # close preamble - LOG ("----- Close Preamble ------"); - return; - } else { - print FILEp "$_"; # write into preamble - LOG ("$_"); - } - } - close(FILEp); - if ( $verbose ) { LOG("<-----Preamble<----"); } - return; -} - -sub searchPS { # search the PostScript parts - my @PS = (); # single PS sequence - my @PStotal = (); # all PS sequences as list of arrays - my $depth = -1; # counts nested macros - my $type = -1; # -1-> none; 1->PST; 2->PS; - my $EndDocument = 0; # ignore all after \end{document} - my $iVerb = 0; # test for verbatim or lstlisting environment, must be ignored - while (<FILE>) { # scan the input file - if (!$EndDocument) { - chomp; # delete EOL character - my $line = $_; # save line - if ( !$iVerb ) { - $iVerb = ((index($line,"begin{verbatim}") > 0) or (index($line,"begin{lstlisting}") > 0)); - } # do nothing until \end{verbatim} - if ( !$iVerb ) { - my $iPS = index($line,"begin{postscript}"); - my $iPST = index($line,"begin{pspicture*}"); - if ($iPST < 0) { $iPST = index($line,"begin{pspicture}"); } # alternative - if ($iPST < 0) { $iPST = index($line,"pspicture"); } # alternative \pspicture... - if (($iPS > 0) && ( $type == 1 )){ print "postscript environment must be of outer level!\n"; exit 1; } - if ( $type < 0 ) { # no active environment - if ($iPS > 0) { # we have \begin{postscript} - $type = 2; - $line = substr($line,$iPS-1); # add rest of the line - LOG("PS-Zeile: $line"); - } - elsif ( $iPST > 0 ) { # we have \begin{pspicture} or \pspicture - $type = 1; - $depth++; - $line = substr($line,$iPST-1); # add all unitl pspicture - LOG("PST-Zeile: $line"); - } - } -# we have now \begin{pspicture} or \begin{postscript} - if ($type > 0) { # start Scan, we have an environment - LOG ("searchPS: set \$type=$type"); - $iPST = index($line,"end{pspicture*}"); - if ($iPST < 0) { $iPST = index($line,"end{pspicture}"); } # alternative - if ($iPST < 0) { $iPST = index($line,"endpspicture"); } # alternative \endpspicture... - $iPS = index($line,"end{postscript}"); - if ($iPST > 0) { # test, we can have postscript and pspicture in one line - if ( $type < 2) { # found end of pspicture environment - LOG ("searchPS: $line"); - $depth--; - if ($depth < 0) { - $type = -1; - if (index($line,"endpspicture") > 0) # add line, depends to type - { push @PS,substr($line,0,$iPST+12); } # \endpspicture - elsif (index($line,"pspicture*") > 0) - { push @PS,substr($line,0,$iPST+15); }# \end{pspicture} - else { push @PS,substr($line,0,$iPST+14); } # \end{pspicture} - LOG ("searchPS: set \$type=$type"); - push @PStotal,[@PS]; # add PS sequence - LOG ("---->PS---->\n@PS\n<----PS<----"); - @PS = (); # start new PS sequence - } # no pspicture env left - } else { push @PS,$line; } # pspicture inside postscript - } elsif ($iPS > 0) { # must be type=1 -> stop Scan - LOG ("searchPS: $line"); - $type = -1; - push @PS,substr($line,0,$iPS+15); # add line - LOG ("searchPS: set \$type=$type"); - push @PStotal,[@PS]; # add PS sequence - LOG ("---->PS---->\n@PS\n<----PS<----"); - @PS =(); # start new PS sequence - } else { push @PS,$line; } # add line - } - my $i = index($line,"end{document}"); - if ($i > 0) { $EndDocument++; LOG("EndDocument in searchPS"); } - } # if ( $iVerb ) - if (( index($line,"end{verbatim}") > 0 ) or ( index($line,"end{lstlisting}") > 0 )) { $iVerb = 0; } - }} - if ( $verbose ) { - LOG("---->PStotal---->"); - for my $aref ( @PStotal ) { - my @a = @$aref; - my $i = 0; - foreach ( @a ) { LOG ($a[$i]); $i++; } - } - LOG ("<----PStotal<----"); - } - close(FILE); - return @PStotal; # return all PS sequences -} - -# Creating subfiles.tex and .eps for images -sub runTeX{ - my $filename = pop; - my $name = "$filename"; - copy("$filename.tex", "$imageDir/$filename-$imgNo.tex") or die "Cannot copy Source file!"; - if ($eps){ - system("pdftops -level3 -eps $imageDir/$filename-$imgNo.pdf $imageDir/$filename-$imgNo.eps"); - } -$imgNo=$imgNo+1; -} - -sub runFile { - my $filename = pop; - my @PSarray = searchPS(); - if ( $verbose ) { - LOG("---->PSarray---->"); - for my $aref ( @PSarray ) { - my @a = @$aref; - my $i = 0; - foreach ( @a ) { print LOG $a[$i]."\n"; $i++; } - } - LOG("<----PSarray<----"); - my $no = @PSarray; - LOG("PS: ".$no." PS sequence(s)"); - } - for my $aref ( @PSarray ) { - my @PS = @$aref; - open (FILEp,"<$tempDir/$filename.preamble") or die "cannot open $tempDir/$filename.preamble!"; - open (FILEsub,">$tempDir/$filename-tmp.tex") or die "cannot open $tempDir/$filename-tmp.tex!"; - while (<FILEp>) {print FILEsub $_; } - print FILEsub "\\pagestyle{empty}\n"; - print FILEsub "\\begin{document}\n"; - if ( $verbose ) { LOG("\@PS: $_"); } - foreach ( @PS ) { print FILEsub "$_\n"; } - print FILEsub "\\end{document}\n"; - close (FILEsub); - close (FILEp); - runTeX("$tempDir/$filename-tmp"); - } -} -# Replace files -sub runpdfTeX() { - my ($name,$pdfname) = @_; - open (PDF, ">$tempDir/$pdfname-pdf.tex") or die "cannot open $tempDir/$pdfname-pdf.tex!"; - open (FILE, "<$name.tex") or die "cannot open $name!"; - my $ignore = 0; - my $IMGno = 1; - my $depth = -1; - my $type = -1; - my $EndDocument = 0; # ignore all after \end{document} - my $iVerb = 0; - while (<FILE>) { # scan the input file - if ( !$iVerb ) { - $iVerb = ((index($_,"begin{verbatim}") > 0) or (index($_,"begin{lstlisting}") > 0)); - } # do nothing until \end{verbatim}|| \end{lstlisting} - if ( !$iVerb ) { - my $i = index($_,"end{document}"); - if ($i > 0) { print PDF $_; $EndDocument++; LOG("EndDocument in runpdfTeX"); } - if ( !$EndDocument ) { - my $iPS = index($_,"begin{postscript}"); - if ( $iPS > 0 ) { - $type = 2; - $ignore = 1; - if ($iPS > 1) { print PDF substr($_,0,--$iPS); } # add preceeding text - print PDF "\\includegraphics[scale=$Iscale]{$pdfname-tmp-$IMGno}"; # use pdfname - $IMGno=$IMGno+1; - } # postscript env - if ( $type < 2 ) { - my $iPST = index($_,"begin{pspicture*}"); - if ($iPST < 0) { $iPST = index($_,"begin{pspicture}"); } # alternative ... - if ($iPST < 0) { $iPST = index($_,"\\pspicture"); } # alternative \endpspicture... - if ( $iPST >= 0 ) { # start Scan - $ignore = 1; - $type = 1; - $depth++; # pspicture env - LOG("Increase depth: $depth"); - if ( $depth == 0 ) { - if ($iPST > 1) { print PDF substr($_,0,--$iPST); } # add preceeding text - print PDF "\\includegraphics[scale=$Iscale]{$pdfname-tmp-$IMGno}"; # use \graphicspath - $IMGno=$IMGno+1; - LOG("Increase Image counter: $IMGno"); - } - } - } - if ( !$ignore ) { print PDF "$_"; } # default line - if ( $type == 2 ) { # postscript env - my $iPS = index($_,"end{postscript}"); - if ($iPS > 0) { - print PDF substr($_,$iPS+15); # rest of line - $ignore = 0; - $type=-1; - } # end Scan - } elsif ( $type == 1 ) { # pspicture env - my $iPST = index($_,"end{pspicture*}"); - if ($iPST < 0) { $iPST = index($_,"end{pspicture}"); } # alternative ... - if ($iPST < 0) { $iPST = index($_,"endpspicture"); } # alternative \endpspicture... - if ($iPST > 0) { # end Scan - if (index($_,"endpspicture") > 0) # add rest of line, depends to type - { print PDF substr($_,$iPST+12); } # \endpspicture - elsif (index($_,"pspicture*") > 0) - { print PDF substr($_,$iPST+15); } # \end{pspicture*} - else { print PDF substr($_,$iPST+14); } # \end{pspicture} - $depth--; - LOG("Decrease depth: $depth"); - if ($depth < 0) { $ignore = 0; } - } - } - } # if ( !$EndDocument ) - } else { print PDF $_; } # if ( $iVerb ) - if (( index($_,"end{verbatim}") > 0 ) or ( index($_,"end{lstlisting}") > 0 )) { $iVerb = 0; } - } # while (<FILE>) - close (FILE); - close (PDF); -# Coment pst-package - open (IPDF, "<$tempDir/$pdfname-pdf.tex"); - undef $/; # read all file - my ($uno,$dos) = split(/\\begin\{document\}/,<IPDF>,2); - close IPDF; - - my @coment = split /\n/, $uno; # split in two - my @preamb; - - foreach my $line (@coment) { - chomp($line); - $line =~ s/\\usepackage(?:\[.+?\])?\{pst.+?}//g; # delete - $line =~ s/\\usepackage(?:\[.+?\])?\{psfr.+?}//g; # delete - $line =~ s/(\\usepackage(?:\[.+?\])?)\{auto-pst.+?}//g; # delete - $line =~ s/(\\usepackage(?:\[.+?\])?)\{vaucanson-.+?}//g; # delete - $line =~ s/(\\usepackage(?:\[.+?\])?)\{psgo}//g; # delete - $line =~ s/(\\usepackage(?:\[.+?\])?)\{graph/\%$1\{graph/g; # comment - next if $line =~ m/^\s*$/; - push(@preamb,$line); # adding changes -} -my $clean = join("\n", @preamb, "\\usepackage{grfext}\n\\\PrependGraphicsExtensions*{$Iext}\n\\usepackage{graphicx}\n\\graphicspath{{$imageDir/}}\n\\begin{document}\n". $dos); - -open (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 {system("pdflatex -interaction=nonstopmode $pdfname-pdf");} -if (-e "$tempDir/$pdfname-pdf.idx") { system("makeindex $tempDir/$pdfname-pdf.idx"); $runAgain++; } -if ($runBibTeX && -e "$tempDir/$pdfname-pdf.aux") { system("bibtex $tempDir/$pdfname-pdf"); $runAgain++; } -if ($runBiber && -e "$tempDir/$pdfname-pdf.bcf") { system("biber $tempDir/$pdfname-pdf"); $runAgain++; } -if ($runAgain) { system("pdflatex $tempDir/$pdfname-pdf"); } -if ( $clear ) { - unlink "$name.txt"; - unlink "$tempDir/$name.aux"; - unlink "$tempDir/$pdfname-pdf.log"; - unlink "$tempDir/$pdfname-pdf.aux"; - unlink "$tempDir/$pdfname-pdf-autopp.txt"; - unlink "$tempDir/$pdfname-pics.pdf"; - unlink "$tempDir/doc_data.txt"; - unlink "$tempDir/$pdfname-tmp.tex"; - } -} - -sub LOG() { - if ( $verbose ) { print LOGfile "@_\n"; } -} -__END__ diff --git a/Build/source/texk/texlive/linked_scripts/pst2pdf/pst2pdf.pl b/Build/source/texk/texlive/linked_scripts/pst2pdf/pst2pdf.pl new file mode 100755 index 00000000000..040cdf7e7dd --- /dev/null +++ b/Build/source/texk/texlive/linked_scripts/pst2pdf/pst2pdf.pl @@ -0,0 +1,659 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' && eval 'exec perl -S $0 $argv:q' + if 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 +# 2011-12-12 (c) Herbert Voss <hvoss@tug.org> +# 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 +# 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 +# +use File::Path; # creating/removing dirs +use File::Copy; # copying files +use File::Basename; # scan argument +use IO::File; # simple IO operation +use Getopt::Long; # read parameter +use autodie; +#----------------------- User part begin ------------------------ +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 $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. +#----------------------- User part end --------------------------- +#-------------- program identification, options and help --------- +my $program = "pst2pdf"; +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> +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 $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 +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. +Examples: +* $program test.tex --all +* produce test-pdf.tex and ppm,eps,tex and pdf for pst-enviroment in image dir +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, +) or die $usage; +#---------------- 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); +} +if ($::opt_license) { + print $licensetxt; + exit (0); +} +# open file +my $InputFilename = ""; + @ARGV > 0 or errorUsage "Input filename missing"; + @ARGV < 2 or errorUsage "Unknown option or too many input files"; + $InputFilename = $ARGV[0]; + +my @SuffixList = (".tex","",".ltx"); # possible extensions +my ($name,$path,$ext) = fileparse($ARGV[0],@SuffixList); +if ($ext eq "") { $ext = ".tex"; } # me need the extension as well +my $TeXfile = "$path$name$ext"; +open my $LOGfile,'>', "$tempDir/$name.plog"; # our own log file + LOG ("Parameters:"); + LOG ("==> imageDir = $imageDir"); + LOG ("==> Iext = $Iext"); + LOG ("==> DPI = $DPI"); + LOG ("==> Iscale = $Iscale"); + LOG ("==> tempDir = $tempDir"); + LOG ("==> verbose = $verbose"); + LOG ("==> clear = $clear"); + LOG ("==> noImages = $noImages"); + LOG ("==> single = $single"); + LOG ("==> runBibTeX= $runBibTeX"); + LOG ("==> runBiber = $runBiber"); + LOG ("==> ppm = $ppm"); + LOG ("==> norun = $norun"); + LOG ("==> eps = $eps"); + LOG ("==> files = $files"); + LOG ("==> xetex = $xetex"); + +if ($runBibTeX && $runBiber) { + LOG ("!!! you cannot run BibTeX and Biber at the same document ..."); + LOG ("!!! Assuming to run Biber"); + $runBibTeX = 0; +} +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 ($files) { + LOG ("Generate .tex images files ..."); + $files=1; +} +if ($all) { + LOG ("Generate all images files ..."); + $files=$eps = $ppm = $clear = 1; +} +if ($nopdftk) { + LOG ("single mode generate all images files ..."); + $single=$files=$eps = $ppm = $clear = 1; +} +if ($xetex) { + LOG ("Compiling using XeLaTeX ..."); + $xetex=1; +} + +my $imgNo = 1; # internal image counter +#----------- single mode no need pdftk and auto-pst-pdf ---------------------- +if ($single) { +LOG ("Running on [$path][$name][$ext]"); +open my $FILE,'<', "$TeXfile" ; # the source +LOG ("single mode generate images..."); +if (-d $imageDir) { LOG ("$imageDir exists") } +else { mkdir("$imageDir", 0744) ;} +savePreamble($name); +runFile($name); +close $FILE; # close source file +close $LOGfile; +} +#---------------- end single -------------- +else{ +LOG ("Running on [$path][$name][$ext]"); +open my $FILE,'<', "$TeXfile" ; # the source +if (!$noImages ) { +if (-d $imageDir) { LOG ("$imageDir exists") } +else { mkdir("$imageDir", 0744) ; +LOG ("Imagedir created"); } +LOG ("go to savePreamble ... "); +runBurst($tempDir); +savePreamble($name); +runFile($name); +LOG ("done!\n go to runFile ..."); +LOG ("done!"); +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");} + } +} +#------------ end pdftk burst +LOG ("runpdfTeX ... "); +runpdfTeX("$path$name",$name); +LOG ("all finished ... :-)"); +# 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 ---------------------------------------- +sub savePreamble { +my $filename = pop; # get the file name + LOG ("----- Start Preamble -----"); +open my $FILEp,'>',"$tempDir/$filename.preamble"; +open my $FILE, '<', "$name.tex"; + while (<$FILE>) { # read all until \begin{document} + my $i = index($_,"begin{document}"); + if ($i > 0) { + if ($i > 1) { print $FILEp substr($_,0,--$i); } # write all until \begin{document} + if ($single) { + print $FILEp "\\newenvironment{postscript}{}{}\n"; + print $FILEp "\\pagestyle{empty}\n"; + } +close $FILEp; # close preamble + LOG ("----- Close Preamble ------"); + return; + } +else { + print $FILEp "$_"; # write into preamble + LOG ("$_"); + } +} +close $FILE; +close $FILEp; + if ( $verbose ) { LOG("<-----Preamble<----"); } + return; +} + +sub searchPS { # search the PostScript parts + my @PS = (); # single PS sequence + my @PStotal = (); # all PS sequences as list of arrays + my $depth = -1; # counts nested macros + my $type = -1; # -1-> none; 1->PST; 2->PS; + my $EndDocument = 0;# ignore all after \end{document} + my $iVerb = 0; # test for verbatim or lstlisting environment, must be ignored + open my $FILE, '<', "$name.tex"; + while (<$FILE>) { # scan the input file + if (!$EndDocument) { + chomp; # delete EOL character + my $line = $_; # save line + if ( !$iVerb ) { + $iVerb = ((index($line,"begin{verbatim}") > 0) + or (index($line,"begin{lstlisting}") > 0) + or (index($line,"begin{Verbatim}") > 0) + or (index($line,"begin{verbatim*}") > 0)); + } # do nothing until \end{verbatim} + if ( !$iVerb ) { + my $iPS = index($line,"begin{postscript}"); + my $iPST = index($line,"begin{pspicture*}"); + if ($iPST < 0) { $iPST = index($line,"begin{pspicture}"); } # alternative + if ($iPST < 0) { $iPST = index($line,"pspicture"); } # alternative \pspicture... + if (($iPS > 0) && ( $type == 1 )){ print "postscript environment must be of outer level!\n"; exit 1; } + if ( $type < 0 ) { # no active environment + if ($iPS > 0) { # we have \begin{postscript} + $type = 2; + $line = substr($line,$iPS-1); # add rest of the line + LOG("PS-Zeile: $line"); + } + elsif ( $iPST > 0 ) { # we have \begin{pspicture} or \pspicture + $type = 1; + $depth++; + $line = substr($line,$iPST-1);# add all unitl pspicture + LOG("PST-Zeile: $line"); + } + } +# we have now \begin{pspicture} or \begin{postscript} + if ($type > 0) { # start Scan, we have an environment + LOG ("searchPS: set \$type=$type"); + $iPST = index($line,"end{pspicture*}"); + if ($iPST < 0) { $iPST = index($line,"end{pspicture}"); } # alternative + if ($iPST < 0) { $iPST = index($line,"endpspicture"); } # alternative \endpspicture... + $iPS = index($line,"end{postscript}"); + if ($iPST > 0) { # test, we can have postscript and pspicture in one line + if ( $type < 2) { # found end of pspicture environment + LOG ("searchPS: $line"); + $depth--; + if ($depth < 0) { + $type = -1; + if (index($line,"endpspicture") > 0) # add line, depends to type + { push @PS,substr($line,0,$iPST+12); } # \endpspicture + elsif (index($line,"pspicture*") > 0) + { push @PS,substr($line,0,$iPST+15); }# \end{pspicture} + else { push @PS,substr($line,0,$iPST+14); } # \end{pspicture} + LOG ("searchPS: set \$type=$type"); + push @PStotal,[@PS]; # add PS sequence + LOG ("---->PS---->\n@PS\n<----PS<----"); + @PS = (); # start new PS sequence + } # no pspicture env left + } else { push @PS,$line; } # pspicture inside postscript + } elsif ($iPS > 0) { # must be type=1 -> stop Scan + LOG ("searchPS: $line"); + $type = -1; + push @PS,substr($line,0,$iPS+15); # add line + LOG ("searchPS: set \$type=$type"); + push @PStotal,[@PS]; # add PS sequence + LOG ("---->PS---->\n@PS\n<----PS<----"); + @PS =(); # start new PS sequence + } else { push @PS,$line; } # add line + } + my $i = index($line,"end{document}"); + if ($i > 0) { $EndDocument++; LOG("EndDocument in searchPS"); } + } # if ( $iVerb ) + if (( index($line,"end{verbatim}") > 0 ) + or ( index($line,"end{lstlisting}") > 0 ) + or ( index($line,"end{Verbatim}") > 0 ) + or ( index($line,"end{verbatim*}") > 0 )) { $iVerb = 0; } + }} + if ( $verbose ) { + LOG("---->PStotal---->"); + for my $aref ( @PStotal ) { + my @a = @$aref; + my $i = 1; + foreach ( @a ) { LOG ($a[$i]); $i=$i+1; } + } + LOG ("<----PStotal<----"); + } + close $FILE; + return @PStotal; # return all PS sequences +} +# Creating ifile.tex and eps, pdf and ppm for images +if ($single){ +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; + } +} +else{ +#----------------- Creating files.tex and .eps for images -------------- +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; +} +} +sub runFile { + my $filename = pop; + my @PSarray = searchPS(); + if ( $verbose ) { + LOG("---->PSarray---->"); + for my $aref ( @PSarray ) { + my @a = @$aref; + my $i = 1; + foreach ( @a ) { print LOG $a[$i]."\n"; $i=$i+1; } + } + LOG("<----PSarray<----"); + my $no = @PSarray; + LOG("PS: ".$no." PS sequence(s)"); + } + for my $aref ( @PSarray ) { + my @PS = @$aref; + open my $FILEp,'<',"$tempDir/$filename.preamble"; + open my $FILEsub,'>',"$tempDir/$filename-fig.tex"; + while (<$FILEp>) {print $FILEsub $_; } + print $FILEsub "\\begin{document}\n"; + if ( $verbose ) { LOG("\@PS: $_"); } + foreach ( @PS ) { print $FILEsub "$_\n"; } + print $FILEsub "\\end{document}"; + close $FILEsub; + close $FILEp; + if ($single) { + runsingle("$name"); + } + else{ + runTeX("$tempDir/$name-fig"); + } +} +} +# ----------------Renaming ppm need for correct name +if(!$noImages){ + my $dren = "$tempDir/$imageDir"; + my $fichero = ''; + my $ppmren = ''; + my $renNo = 1; + if(opendir(DIR,$dren)){ + foreach (readdir DIR){ + $fichero = $_; + if ( $fichero =~ /($name-fig-)(\d+|\d+[-]\d+).ppm/) { + my $renNo = int($2); + my $newname="$1$renNo.ppm"; + $ppmren = rename("$dren/$fichero","$dren/$newname"); + } + } +} +closedir DIR; +}# end renaming +#--------------------------- Replace files---------------------- +sub runpdfTeX() { + my ($name,$pdfname) = @_; + open my $PDF,'>',"$tempDir/$pdfname-pdf.tex"; + open my $FILE,'<',"$name.tex"; + my $ignore = 0; + my $IMGno = 1; + my $depth = -1; + my $type = -1; + my $EndDocument = 0; # ignore all after \end{document} + my $iVerb = 0; + while (<$FILE>) { # scan the input file + if ( !$iVerb ) { + $iVerb = ((index($_,"begin{verbatim}") > 0) + or (index($_,"begin{lstlisting}") > 0) + or (index($_,"begin{Verbatim}") > 0) + or (index($_,"begin{verbatim*}") > 0)); + } # do nothing until \end{verbatim}|| \end{lstlisting} + if ( !$iVerb ) { + my $i = index($_,"end{document}"); + if ($i > 0) { print $PDF $_; $EndDocument++; LOG("EndDocument in runpdfTeX"); } + if ( !$EndDocument ) { + my $iPS = index($_,"begin{postscript}"); + if ( $iPS > 0 ) { + $type = 2; + $ignore = 1; + if ($iPS > 1) { print $PDF substr($_,0,--$iPS); } # add preceeding text + print $PDF "\\includegraphics[scale=$Iscale]{$pdfname-fig-$IMGno}"; # use pdfname + $IMGno=$IMGno+1; + } # postscript env + if ( $type < 2 ) { + my $iPST = index($_,"begin{pspicture*}"); + if ($iPST < 0) { $iPST = index($_,"begin{pspicture}"); } # alternative ... + if ($iPST < 0) { $iPST = index($_,"\\pspicture"); } # alternative \\pspicture... + if ( $iPST >= 0 ) { # start Scan + $ignore = 1; + $type = 1; + $depth++; # pspicture env + LOG("Increase depth: $depth"); + if ( $depth == 0 ) { + if ($iPST > 1) { print $PDF substr($_,0,--$iPST); } # add preceeding text + print $PDF "\\includegraphics[scale=$Iscale]{$pdfname-fig-$IMGno}"; # use \graphicspath + $IMGno=$IMGno+1; + LOG("Increase Image counter: $IMGno"); + } + } + } + if ( !$ignore ) { print $PDF "$_"; } # default line + if ( $type == 2 ) { # postscript env + my $iPS = index($_,"end{postscript}"); + if ($iPS > 0) { + print $PDF substr($_,$iPS+15); # rest of line + $ignore = 0; + $type=-1; + } # end Scan + } + elsif ( $type == 1 ) { # pspicture env + my $iPST = index($_,"end{pspicture*}"); + if ($iPST < 0) { $iPST = index($_,"end{pspicture}"); } # alternative ... + if ($iPST < 0) { $iPST = index($_,"endpspicture"); } # alternative \endpspicture... + if ($iPST > 0) { # end Scan + if (index($_,"endpspicture") > 0) # add rest of line, depends to type + { print $PDF substr($_,$iPST+12); } # \endpspicture + elsif (index($_,"pspicture*") > 0) + { print $PDF substr($_,$iPST+15); } # \end{pspicture*} + else{ print $PDF substr($_,$iPST+14); } # \end{pspicture} + $depth--; + LOG("Decrease depth: $depth"); + if ($depth < 0) { $ignore = 0; } + } + } + } # if ( !$EndDocument ) + } + else { print $PDF $_; } # if ( $iVerb ) + if (( index($_,"end{verbatim}") > 0 ) + or ( index($_,"end{lstlisting}") > 0 ) + or ( index($_,"end{Verbatim}") > 0 ) + or ( index($_,"end{verbatim*}") > 0 )) { $iVerb = 0; } + } # while (<$FILE>) + close $FILE; + close $PDF; +#------------------- Coment pst-package for pdfLaTeX -------------------- + open my $IPDF,'<', "$tempDir/$pdfname-pdf.tex"; + undef $/; # read all file + my ($uno,$dos) = split(/\\begin\{document\}/,<$IPDF>,2); + close $IPDF; + + my @coment = split /\n/, $uno; # split in two + my @preamb; + + foreach my $line (@coment) { + chomp($line); + if(!$xetex){ + $line =~ s/\\usepackage(?:\[.+?\])?\{pst.+?}//g; # delete + $line =~ s/\\usepackage(?:\[.+?\])?\{psfr.+?}//g; # delete + $line =~ s/(\\usepackage(?:\[.+?\])?)\{auto-pst.+?}//g; # delete + $line =~ s/(\\usepackage(?:\[.+?\])?)\{vaucanson-.+?}//g; # delete + $line =~ s/(\\usepackage(?:\[.+?\])?)\{psgo}//g; # delete + } + $line =~ s/(\\usepackage(?:\[.+?\])?)\{graph/\%$1\{graph/g; # comment + next if $line =~ m/^\s*$/; + push(@preamb,$line);} # adding changes + +my $clean = join("\n", @preamb, "\\usepackage{grfext}\n\\\PrependGraphicsExtensions*{$Iext}\n\\usepackage{graphicx}\n\\graphicspath{{$imageDir/}}\n\\begin{document}". $dos); + + 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 (-e "$tempDir/$pdfname-pdf.idx") { + system("makeindex $tempDir/$pdfname-pdf.idx"); $runAgain++;} + if ($runBibTeX && -e "$tempDir/$pdfname-pdf.aux") { + system("bibtex $tempDir/$pdfname-pdf"); $runAgain++; } + if ($runBiber && -e "$tempDir/$pdfname-pdf.bcf") { + system("biber $tempDir/$pdfname-pdf"); $runAgain++; } + if ($runAgain){ + if($xetex){ + system("xelatex -interaction=batchmode $tempDir/$pdfname-pdf");} + 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"; + } + } + } + +sub LOG() { + if ( $verbose ) { print $LOGfile "@_\n"; } + } +__END__ diff --git a/Build/source/texk/texlive/linked_scripts/texlive/tlmgr.pl b/Build/source/texk/texlive/linked_scripts/texlive/tlmgr.pl index dfcf2a0e483..51580081030 100755 --- a/Build/source/texk/texlive/linked_scripts/texlive/tlmgr.pl +++ b/Build/source/texk/texlive/linked_scripts/texlive/tlmgr.pl @@ -1,12 +1,12 @@ #!/usr/bin/env perl -# $Id: tlmgr.pl 28995 2013-01-31 00:45:52Z preining $ +# $Id: tlmgr.pl 29313 2013-03-08 13:24:40Z preining $ # -# Copyright 2008, 2009, 2010, 2011, 2012 Norbert Preining +# Copyright 2008-2013 Norbert Preining # This file is licensed under the GNU General Public License version 2 # or any later version. -my $svnrev = '$Revision: 28995 $'; -my $datrev = '$Date: 2013-01-31 01:45:52 +0100 (Thu, 31 Jan 2013) $'; +my $svnrev = '$Revision: 29313 $'; +my $datrev = '$Date: 2013-03-08 14:24:40 +0100 (Fri, 08 Mar 2013) $'; my $tlmgrrevision; my $prg; if ($svnrev =~ m/: ([0-9]+) /) { @@ -24,6 +24,7 @@ our $loadmediasrcerror; our $packagelogfile; our $packagelogged; our $tlmgr_config_file; +our $pinfile; BEGIN { $^W = 1; @@ -161,6 +162,7 @@ sub main { "dry-run|n" => 1 }, "paper" => { "list" => 1 }, "path" => { "w32mode" => "=s" }, + "pinning" => { "all" => 1 }, "platform" => { "dry-run|n" => 1 }, "postaction" => { "w32mode" => "=s", "all" => 1, @@ -3510,7 +3512,76 @@ sub show_list_of_packages { # tlmgr pinning remove <repo> <pkgglob> [<pkgglob>, ...] # tlmgr pinning remove <repo> --all sub action_pinning { - tlwarn("Not implemented by now, sorry!\n"); + my $what = shift @ARGV; + $what || ($what = 'show'); + init_local_db(); + init_tlmedia_or_die(); + if (!$remotetlpdb->is_virtual) { + tlwarn("tlmgr: not a virtual database, no pinning actions supported!\n"); + return; + } + my $pinref = $remotetlpdb->virtual_pindata(); + my $pf = $remotetlpdb->virtual_pinning(); + my @pins = @$pinref; + if ($what =~ m/^show$/i) { + print "Defined pinning data:\n"; + for my $p (@pins) { + print " ", $p->{'repo'}, ":", $p->{'glob'}, "\n"; + } + } elsif ($what =~ m/^check$/i) { + tlwarn("Not implemented by now, sorry!\n"); + return 0; + } elsif ($what =~ m/^add$/i) { + # we need at least two more arguments + if ($#ARGV < 1) { + tlwarn("missing arguments to pinning add\n"); + return; + } + my $repo = shift @ARGV; + my @ov = $pf->value($repo); + push @ov, @ARGV; + $pf->value($repo, @ov); + $remotetlpdb->virtual_update_pins(); + $pf->save; + info("Added/Updated pinning data for $repo\n"); + return 1; + } elsif ($what =~ m/^remove$/i) { + my $repo = shift @ARGV; + if (!defined($repo)) { + tlwarn("missing arguments to pinning add\n"); + return; + } + my $pf = $remotetlpdb->virtual_pinning(); + if ($opts{'all'}) { + if ($#ARGV >= 0) { + tlwarn("no additional argument allowed when --all is given\n"); + return; + } + $pf->delete_key($repo); + $remotetlpdb->virtual_update_pins(); + $pf->save; + return; + } + # complicated case, we want to remove only one setting + my @ov = $pf->value($repo); + my @nv; + for my $pf (@ov) { + push @nv, $pf if (!member($pf, @ARGV)); + } + $pf->value($repo, @nv); + $remotetlpdb->virtual_update_pins(); + $pf->save; + info("Removed pinning data for $repo\n"); + return 1; + } else { + tlwarn("Unknown argument to pinning action: $what\n"); + return 0; + } + # $pin{'repo'} = $repo; + # $pin{'glob'} = $glob; + # $pin{'re'} = $re; + # $pin{'line'} = $line; # for debug/warning purpose + return 0; } # REPOSITORY @@ -5185,24 +5256,19 @@ sub init_tlmedia # now check/setup pinning # TODO for now no default pinning file! - if ($opts{"pin-file"}) { - my @pins = read_pinning_file($opts{"pin-file"}); - if (@pins) { - $remotetlpdb->virtual_pinning(@pins); - } - } else { + if (!$opts{"pin-file"}) { # check for pinning file in TEXMFLOCAL/tlpkg/pinning.txt chomp (my $TEXMFLOCAL = `kpsewhich -var-value=TEXMFLOCAL`); debug("trying to load pinning file $TEXMFLOCAL/tlpkg/pinning.txt\n"); if (-r "$TEXMFLOCAL/tlpkg/pinning.txt") { - my @pins = read_pinning_file("$TEXMFLOCAL/tlpkg/pinning.txt"); - if (@pins) { - info("tlmgr: using pinning file $TEXMFLOCAL/tlpkg/pinning.txt\n"); - $remotetlpdb->virtual_pinning(@pins); - } + $opts{"pin-file"} = "$TEXMFLOCAL/tlpkg/pinning.txt"; } } - + if ($opts{"pin-file"} && -r $opts{"pin-file"}) { + # $pinfile is global var + $pinfile = TeXLive::TLConfFile->new($opts{"pin-file"}, "#", ":", 'multiple'); + $remotetlpdb->virtual_pinning($pinfile); + } # this "location-url" line should not be changed since GUI programs # depend on it: print "location-url\t$locstr\n" if $::machinereadable; @@ -5419,26 +5485,6 @@ FROZEN return($remotetlpdb); } -sub read_pinning_file { - my $pf = shift; - my @pins; - my $pfh; - if (!open($pfh, "<$pf")) { - tlwarn("Pinning file $pf cannot be read: $!\n"); - return; - } - debug("Reading pinning file $pf\n"); - while (my $l = TeXLive::TLUtils::get_full_line($pfh)) { - chomp($l); - # comments and empty lines are allowed - next if ($l =~ m/^\s*#/); - next if ($l =~ m/^\s*$/); - my ($a, $b) = split(/:/, $l); - push @pins, $remotetlpdb->make_pin_data_from_line($l); - } - close($pfh); - return @pins; -} # finish handles the -pause option (wait for input from stdin), @@ -5878,420 +5924,392 @@ Gives version information (same as C<--version>). If C<-v> has been given the revisions of the used modules are reported, too. -=head2 gui - -Start the graphical user interface. See B<GUI> below. +=head2 backup [--clean[=I<N>]] [--backupdir I<dir>] [--all | I<pkg>]... +If the C<--clean> option is not specified, this action makes a backup of +the given packages, or all packages given C<--all>. These backups are +saved to the value of the C<--backupdir> option, if that is an existing and +writable directory. If C<--backupdir> is not given, the C<backupdir> +option setting in the TLPDB is used, if present. If both are missing, +no backups are made. -=head2 install [I<option>]... I<pkg>... +If the C<--clean> option is specified, backups are pruned (removed) +instead of saved. The optional integer value I<N> may be specified to +set the number of backups that will be retained when cleaning. If C<N> +is not given, the value of the C<autobackup> option is used. If both are +missing, an error is issued. For more details of backup pruning, see +the C<option> action. -Install each I<pkg> given on the command line. By default this installs -all packages on which the given I<pkg>s are dependent, also. Options: +Options: =over 4 -=item B<--file> +=item B<--backupdir> I<directory> -Instead of fetching a package from the installation repository, use -the packages files given on the command line. These files need -to be proper TeX Live package files (with contained tlpobj file). +Overrides the C<backupdir> option setting in the TLPDB. +The I<directory> argument is required and must specify an existing, +writable directory where backups are to be placed. -=item B<--reinstall> +=item B<--all> -Reinstall a package (including dependencies for collections) even if it -seems to be already installed (i.e, is present in the TLPDB). This is -useful to recover from accidental removal of files in the hierarchy. +If C<--clean> is not specified, make a backup of all packages in the TeX +Live installation; this will take quite a lot of space and time. If +C<--clean> is specified, all packages are pruned. -When re-installing, only dependencies on normal packages are followed -(not those of category Scheme or Collection). +=item B<--clean>[=I<N>] -=item B<--no-depends> +Instead of making backups, prune the backup directory of old backups, as +explained above. The optional integer argument I<N> overrides the +C<autobackup> option set in the TLPDB. You must use C<--all> or a list +of packages together with this option, as desired. -Do not install dependencies. (By default, installing a package ensures -that all dependencies of this package are fulfilled.) +=item B<--dry-run> -=item B<--no-depends-at-all> +Nothing is actually backed up or removed; instead, the actions to be +performed are written to the terminal. -When you install a package which ships binary files the respective -binary package will also be installed. That is, for a package C<foo>, -the package C<foo.i386-linux> will also be installed on an C<i386-linux> -system. This switch suppresses this behavior, and also implies -C<--no-depends>. Don't use it unless you are sure of what you are -doing. +=back -=item B<--dry-run> -Nothing is actually installed; instead, the actions to be performed are -written to the terminal. +=head2 candidates -=item B<--force> +=over 4 -If updates to C<tlmgr> itself (or other parts of the basic -infrastructure) are present, C<tlmgr> will bail out and not perform the -installation unless this option is given. Not recommended. +=item B<candidates I<pkg>> -=back +Shows the available candidate repositories for package I<pkg>. +See L</"MULTIPLE REPOSITORIES"> below. -=head2 update [I<option>]... [I<pkg>]... +=back -Updates the packages given as arguments to the latest version available -at the installation source. Either C<--all> or at least one I<pkg> name -must be specified. Options: +=head2 check [I<option>]... [files|depends|executes|runfiles|all] + +Executes one (or all) check(s) on the consistency of the installation. =over 4 -=item B<--all> +=item B<files> -Update all installed packages except for C<tlmgr> itself. Thus, if -updates to C<tlmgr> itself are present, this will simply give an error, -unless also the option C<--force> or C<--self> is given. (See below.) +Checks that all files listed in the local TLPDB (C<texlive.tlpdb>) are +actually present, and lists those missing. -In addition to updating the installed packages, during the update of a -collection the local installation is (by default) synchronized to the -status of the collection on the server, for both additions and removals. +=item B<depends> -This means that if a package has been removed on the server (and thus -has also been removed from the respective collection), C<tlmgr> will -remove the package in the local installation. This is called -``auto-remove'' and is announced as such when using the option -C<--list>. This auto-removal can be suppressed using the option -C<--no-auto-remove>. +Lists those packages which occur as dependencies in an installed collections, +but are themselves not installed, and those packages that are not +contained in any collection. -Analogously, if a package has been added to a collection on the server -that is also installed locally, it will be added to the local -installation. This is called ``auto-install'' and is announced as such -when using the option C<--list>. This auto-installation can be -suppressed using the option C<--no-auto-install>. +If you call C<tlmgr check collections> this test will be carried out +instead since former versions for C<tlmgr> called it that way. -An exception to the collection dependency checks (including the -auto-installation of packages just mentioned) are those that have been -``forcibly removed'' by you, that is, you called C<tlmgr remove --force> -on them. (See the C<remove> action documentation.) To reinstall any -such forcibly removed packages use C<--reinstall-forcibly-removed>. +=item B<executes> -If you want to exclude some packages from the current update run (e.g., -due to a slow link), see the C<--exclude> option below. +Check that the files referred to by C<execute> directives in the TeX +Live Database are present. -=item B<--self> +=item B<runfiles> -Update C<tlmgr> itself (that is, the infrastructure packages) if updates -to it are present. On Windows this includes updates to the private Perl -interpreter shipped inside TeX Live. +List those filenames that are occurring more than one time in the runfiles. -If this option is given together with either C<--all> or a list of -packages, then C<tlmgr> will be updated first and, if this update -succeeds, the new version will be restarted to complete the rest of the -updates. +=back -In short: +Options: - tlmgr update --self # update infrastructure only - tlmgr update --self --all # update infrastructure and all packages - tlmgr update --force --all # update all packages but *not* infrastructure - # ... this last at your own risk, not recommended! +=over 4 -=item B<--dry-run> +=item B<--use-svn> -Nothing is actually installed; instead, the actions to be performed are -written to the terminal. This is a more detailed report than C<--list>. +Use the output of C<svn status> instead of listing the files; for +checking the TL development repository. -=item B<--list> [I<pkg>] +=back -Concisely list the packages which would be updated, newly installed, or -removed, without actually changing anything. -If C<--all> is also given, all available updates are listed. -If C<--self> is given, but not C<--all>, only updates to the -critical packages (tlmgr, texlive infrastructure, perl on Windows, etc.) -are listed. -If neither C<--all> nor C<--self> is given, and in addition no I<pkg> is -given, then C<--all> is assumed (thus, C<tlmgr update --list> is the -same as C<tlmgr update --list --all>). -If neither C<--all> nor C<--self> is given, but specific package names are -given, those packages are checked for updates. -=item B<--exclude> I<pkg> +=head2 conf [texmf|tlmgr [I<key> [I<value>]]] -Exclude I<pkg> from the update process. If this option is given more -than once, its arguments accumulate. +With only C<conf>, show general configuration information for TeX Live, +including active configuration files, path settings, and more. This is +like the C<texconfig conf> call, but works on all supported platforms. -An argument I<pkg> excludes both the package I<pkg> itself and all -its related platform-specific packages I<pkg.ARCH>. For example, +With either C<conf texmf> or C<conf tlmgr> given in addition, shows all +key/value pairs (i.e., all settings) as saved in C<ROOT/texmf.cnf> or +the tlmgr configuration file (see below), respectively. - tlmgr update --all --exclude a2ping +If I<key> is given in addition, shows the value of only that given +I<key> in the respective file. -will not update C<a2ping>, C<a2ping.i386-linux>, or -any other C<a2ping.>I<ARCH> package. +If I<value> is given in addition, I<key> is set to I<value> in the +respective file. I<No error checking is done!> -If this option specifies a package that would otherwise be a candidate -for auto-installation, auto-removal, or reinstallation of a forcibly -removed package, C<tlmgr> quits with an error message. Excludes are not -supported in these circumstances. +Practical application: if the execution of (some or all) system commands +via C<\write18> was left enabled during installation, you can disable +it afterwards: + + tlmgr conf texmf shell_escape 0 -=item B<--no-auto-remove> [I<pkg>]... +Warning: The general facility is here, but tinkering with settings in +this way is very strongly discouraged. Again, no error checking is +done, so any sort of breakage is possible. -Under normal circumstances C<tlmgr> tries to remove packages which have -disappeared on the server, as described above under C<--all>. This -option prevents any such removals, either for all packages (with -C<--all>), or the given I<pkg> names. -=item B<--no-auto-install> [I<pkg>]... +=head2 dump-tlpdb [--local|--remote] -Under normal circumstances C<tlmgr> will install packages which are new -on the server, as described above under C<--all>. This option prevents -any such automatic installation, either for all packages (with -C<--all>), or the given I<pkg> names. +Dump complete local or remote TLPDB to standard output, as-is. The +output is analogous to the C<--machine-readable> output; see +L<MACHINE-READABLE OUTPUT> section. -Furthermore, after the C<tlmgr> run using this has finished, the -packages that would have been auto-installed I<will be considered as -forcibly removed>. So, if C<foobar> is the only new package on the -server, then +Options: - tlmgr update --all --no-auto-install +=over 4 -is equivalent to +=item B<--local> - tlmgr update --all - tlmgr remove --force foobar +Dump the local tlpdb. -=item B<--reinstall-forcibly-removed> +=item B<--remote> -Under normal circumstances C<tlmgr> will not install packages that have -been forcibly removed by the user; that is, removed with C<remove ---force>, or whose installation was prohibited by C<--no-auto-install> -during an earlier update. +Dump the remote tlpdb. -This option makes C<tlmgr> ignore the forcible removals and re-install -all such packages. This can be used to completely synchronize an -installation with the server's idea of what is available: +=back - tlmgr update --reinstall-forcibly-removed --all +Exactly one of C<--local> and C<--remote> must be given. -=item B<--backup> and B<--backupdir> I<directory> +In either case, the first line of the output specifies the repository +location, in this format: -These two options control the creation of backups of packages I<before> -updating; that is, backup of packages as currently installed. If -neither of these options are given, no backup package will be saved. If -C<--backupdir> is given and specifies a writable directory then a backup -will be made in that location. If only C<--backup> is given, then a -backup will be made to the directory previously set via the C<option> -action (see below). If both are given then a backup will be made to the -specified I<directory>. + "location-url" "\t" location -You can set options via the C<option> action to automatically create -backups for all packages, and/or keep only a certain number of -backups. Please see the C<option> action for details. +where C<location-url> is the literal field name, followed by a tab, and +I<location> is the file or url to the repository. -C<tlmgr> always makes a temporary backup when updating packages, in case -of download or other failure during an update. In contrast, the purpose -of this C<--backup> option is to allow you to save a persistent backup -in case the actual I<content> of the update causes problems, e.g., -introduces an incompatibility. +Line endings may be either LF or CRLF depending on the current platform. -The C<restore> action explains how to restore from a backup. -=item B<--no-depends> +=head2 generate [I<option>]... I<what> -If you call for updating a package normally all depending packages -will also be checked for updates and updated if necessary. This switch -suppresses this behavior. +=over 4 -=item B<--no-depends-at-all> +=item B<generate language> -See above under B<install> (and beware). +=item B<generate language.dat> -=item B<--force> +=item B<generate language.def> -Force update of normal packages, without updating C<tlmgr> itself -(unless the C<--self> option is also given). Not recommended. +=item B<generate language.dat.lua> -Also, C<update --list> is still performed regardless of this option. +=item B<generate fmtutil> =back -If the package on the server is older than the package already installed -(e.g., if the selected mirror is out of date), C<tlmgr> does not -downgrade. Also, packages for uninstalled platforms are not installed. - - -=head2 backup [--clean[=I<N>]] [--backupdir I<dir>] [--all | I<pkg>]... - -If the C<--clean> option is not specified, this action makes a backup of -the given packages, or all packages given C<--all>. These backups are -saved to the value of the C<--backupdir> option, if that is an existing and -writable directory. If C<--backupdir> is not given, the C<backupdir> -option setting in the TLPDB is used, if present. If both are missing, -no backups are made. +The C<generate> action overwrites any manual changes made in the +respective files: it recreates them from scratch based on the +information of the installed packages, plus local adaptions. +The TeX Live installer and C<tlmgr> routinely call C<generate> for +all of these files. -If the C<--clean> option is specified, backups are pruned (removed) -instead of saved. The optional integer value I<N> may be specified to -set the number of backups that will be retained when cleaning. If C<N> -is not given, the value of the C<autobackup> option is used. If both are -missing, an error is issued. For more details of backup pruning, see -the C<option> action. +For managing your own fonts, please read the C<updmap --help> +information and/or L<http://tug.org/fonts/fontinstall.html>. -Options: +In more detail: C<generate> remakes any of the configuration files +C<language.dat>, C<language.def>, C<language.dat.lua>, and +C<fmtutil.cnf>, from the information present in the local TLPDB, plus +locally-maintained files. -=over 4 +The locally-maintained files are C<language-local.dat>, +C<language-local.def>, C<language-local.dat.lua>, or +C<fmtutil-local.cnf>, searched for in C<TEXMFLOCAL> in the respective +directories. If local additions are present, the final file is made by +starting with the main file, omitting any entries that the local file +specifies to be disabled, and finally appending the local file. -=item B<--backupdir> I<directory> +(Historical note: The formerly supported C<updmap-local.cfg> is no longer +read, since C<updmap> now supports multiple C<updmap.cfg> files. Thus, +local additions can and should be put into an C<updmap.cfg> file in +C<TEXMFLOCAL>. The C<generate updmap> action no longer exists.) -Overrides the C<backupdir> option setting in the TLPDB. -The I<directory> argument is required and must specify an existing, -writable directory where backups are to be placed. +Local files specify entries to be disabled with a comment line, namely +one of these: -=item B<--all> + #!NAME + %!NAME + --!NAME -If C<--clean> is not specified, make a backup of all packages in the TeX -Live installation; this will take quite a lot of space and time. If -C<--clean> is specified, all packages are pruned. +where C<fmtutil.cnf> uses C<#>, C<language.dat> and C<language.def> use +C<%>, and C<language.dat.lua> use C<-->. In all cases, the I<name> is +the respective format name or hyphenation pattern identifier. +Examples: -=item B<--clean>[=I<N>] + #!pdflatex + %!german + --!usenglishmax -Instead of making backups, prune the backup directory of old backups, as -explained above. The optional integer argument I<N> overrides the -C<autobackup> option set in the TLPDB. You must use C<--all> or a list -of packages together with this option, as desired. +(Of course, you're not likely to actually want to disable those +particular items. They're just examples.) -=item B<--dry-run> +After such a disabling line, the local file can include another entry +for the same item, if a different definition is desired. In general, +except for the special disabling lines, the local files follow the same +syntax as the master files. -Nothing is actually backed up or removed; instead, the actions to be -performed are written to the terminal. +The form C<generate language> recreates all three files C<language.dat>, +C<language.def>, and C<language.dat.lua>, while the forms with an +extension recreates only that given language file. -=back +Options: +=over 4 -=head2 restore [--backupdir I<dir>] [--all | I<pkg> [I<rev>]] +=item B<--dest> I<output_file> -Restore a package from a previously-made backup. +specifies the output file (defaults to the respective location in +C<TEXMFSYSVAR>). If C<--dest> is given to C<generate language>, it +serves as a basename onto which C<.dat> will be appended for the name of +the C<language.dat> output file, C<.def> will be appended to the value +for the name of the C<language.def> output file, and C<.dat.lua> to the +name of the C<language.dat.lua> file. (This is just to avoid +overwriting; if you want a specific name for each output file, we +recommend invoking C<tlmgr> twice.) -If C<--all> is given, try to restore the latest revision of all -package backups found in the backup directory. +=item B<--localcfg> I<local_conf_file> -Otherwise, if neither I<pkg> nor I<rev> are given, list the available backup -revisions for all packages. +specifies the (optional) local additions (defaults to the respective +location in C<TEXMFLOCAL>). -With I<pkg> given but no I<rev>, list all available backup revisions of -I<pkg>. +=item B<--rebuild-sys> -When listing available packages tlmgr shows the revision and in -parenthesis the creation time if available (in format yyyy-mm-dd hh:mm). +tells tlmgr to run necessary programs after config files have been +regenerated. These are: +C<fmtutil-sys --all> after C<generate fmtutil>, +C<fmtutil-sys --byhyphen .../language.dat> after C<generate language.dat>, +and +C<fmtutil-sys --byhyphen .../language.def> after C<generate language.def>. -With both I<pkg> and I<rev>, tries to restore the package from the -specified backup. +These subsequent calls cause the newly-generated files to actually take +effect. This is not done by default since those calls are lengthy +processes and one might want to made several related changes in +succession before invoking these programs. -Options: +=back -=over 4 +The respective locations are as follows: -=item B<--all> + tex/generic/config/language.dat (and language-local.dat); + tex/generic/config/language.def (and language-local.def); + tex/generic/config/language.dat.lua (and language-local.dat.lua); + web2c/fmtutil.cnf (and fmtutil-local.cnf); -Try to restore the latest revision of all package backups found in the -backup directory. Additional non-option arguments (like I<pkg>) are not -allowed. -=item B<--backupdir> I<directory> +=head2 gui -Specify the directory where the backups are to be found. If not given it -will be taken from the configuration setting in the TLPDB. +Start the graphical user interface. See B<GUI> below. -=item B<--dry-run> -Nothing is actually restored; instead, the actions to be performed are -written to the terminal. +=head2 info [I<option>...] [collections|schemes|I<pkg>...] -=item B<--force> +With no argument, lists all packages available at the package +repository, prefixing those already installed with C<i>. -Don't ask questions. +With the single word C<collections> or C<schemes> as the argument, lists +the request type instead of all packages. -=back +With any other arguments, display information about I<pkg>: the name, +category, short and long description, installation status, and TeX Live +revision number. If I<pkg> is not locally installed, searches in the +remote installation source. +It also displays information taken from the TeX Catalogue, namely the +package version, date, and license. Consider these, especially the +package version, as approximations only, due to timing skew of the +updates of the different pieces. By contrast, the C<revision> value +comes directly from TL and is reliable. -=head2 remove [I<option>]... I<pkg>... +The former actions C<show> and C<list> are merged into this action, +but are still supported for backward compatibility. -Remove each I<pkg> specified. Removing a collection removes all package -dependencies (unless C<--no-depends> is specified), but not any -collection dependencies of that collection. However, when removing a -package, dependencies are never removed. Options: +Options: =over 4 -=item B<--no-depends> +=item B<--list> -Do not remove dependent packages. +If the option C<--list> is given with a package, the list of contained +files is also shown, including those for platform-specific dependencies. +When given with schemes and collections, C<--list> outputs their +dependencies in a similar way. -=item B<--no-depends-at-all> +=item B<--only-installed> -See above under B<install> (and beware). +If this options is given, the installation source will +not be used; only locally installed packages, collections, or schemes +are listed. +(Does not work for listing of packages for now) -=item B<--force> +=item B<--taxonomy> -By default, removal of a package or collection that is a dependency of -another collection or scheme is not allowed. With this option, the -package will be removed unconditionally. Use with care. +=item B<--keyword> -A package that has been removed using the C<--force> option because it -is still listed in an installed collection or scheme will not be -updated, and will be mentioned as B<forcibly removed> in the output of -B<tlmgr update --list>. +=item B<--functionality> -=item B<--dry-run> +=item B<--characterization> -Nothing is actually removed; instead, the actions to be performed are -written to the terminal. +In addition to the normal data displayed, also display information for +given packages from the corresponding taxonomy (or all of them). See +L</"TAXONOMIES"> below for details. =back -=head2 repository - -=over 4 - -=item B<repository list> +=head2 install [I<option>]... I<pkg>... -=item B<repository list I<path|tag>> +Install each I<pkg> given on the command line. By default this installs +all packages on which the given I<pkg>s are dependent, also. Options: -=item B<repository add I<path> [I<tag>]> +=over 4 -=item B<repository remove I<path|tag>> +=item B<--file> -=item B<repository set I<path>[#I<tag>] [I<path>[#I<tag>] ...]> +Instead of fetching a package from the installation repository, use +the packages files given on the command line. These files need +to be proper TeX Live package files (with contained tlpobj file). -This action manages the list of repositories. See L</"MULTIPLE -REPOSITORIES"> below for detailed explanations. +=item B<--reinstall> -The first form (C<list>) lists all configured repositories and the -respective tags if set. If a path, url, or tag is given after the -C<list> keyword, it is interpreted as source from where to -initialize a TeX Live Database and lists the contained packages. -This can also be an up-to-now not used repository, both locally -and remote. If one pass in addition C<--with-platforms>, for each -package the available platforms (if any) are listed, too. +Reinstall a package (including dependencies for collections) even if it +seems to be already installed (i.e, is present in the TLPDB). This is +useful to recover from accidental removal of files in the hierarchy. -The third form (C<add>) adds a repository -(optionally attaching a tag) to the list of repositories. The forth -form (C<remove>) removes a repository, either by full path/url, or by -tag. The last form (C<set>) sets the list of repositories to the items -given on the command line, not keeping previous settings +When re-installing, only dependencies on normal packages are followed +(not those of category Scheme or Collection). -In all cases, one of the repositories must be tagged as C<main>; -otherwise, all operations will fail! +=item B<--no-depends> -=back +Do not install dependencies. (By default, installing a package ensures +that all dependencies of this package are fulfilled.) +=item B<--no-depends-at-all> -=head2 candidates +When you install a package which ships binary files the respective +binary package will also be installed. That is, for a package C<foo>, +the package C<foo.i386-linux> will also be installed on an C<i386-linux> +system. This switch suppresses this behavior, and also implies +C<--no-depends>. Don't use it unless you are sure of what you are +doing. -=over 4 +=item B<--dry-run> -=item B<candidates I<pkg>> +Nothing is actually installed; instead, the actions to be performed are +written to the terminal. -Shows the available candidate repositories for package I<pkg>. -See L</"MULTIPLE REPOSITORIES"> below. +=item B<--force> +If updates to C<tlmgr> itself (or other parts of the basic +infrastructure) are present, C<tlmgr> will bail out and not perform the +installation unless this option is given. Not recommended. =back + =head2 option =over 4 @@ -6391,33 +6409,6 @@ to the registry and the menus are done for all users on the system instead of only the current user. All three options are on by default. -=head2 conf [texmf|tlmgr [I<key> [I<value>]]] - -With only C<conf>, show general configuration information for TeX Live, -including active configuration files, path settings, and more. This is -like the C<texconfig conf> call, but works on all supported platforms. - -With either C<conf texmf> or C<conf tlmgr> given in addition, shows all -key/value pairs (i.e., all settings) as saved in C<ROOT/texmf.cnf> or -the tlmgr configuration file (see below), respectively. - -If I<key> is given in addition, shows the value of only that given -I<key> in the respective file. - -If I<value> is given in addition, I<key> is set to I<value> in the -respective file. I<No error checking is done!> - -Practical application: if the execution of (some or all) system commands -via C<\write18> was left enabled during installation, you can disable -it afterwards: - - tlmgr conf texmf shell_escape 0 - -Warning: The general facility is here, but tinkering with settings in -this way is very strongly discouraged. Again, no error checking is -done, so any sort of breakage is possible. - - =head2 paper =over 4 @@ -6453,6 +6444,63 @@ settings for some programs, notably C<dvips>. C<tlmgr> does not support those extra settings at present. +=head2 path [--w32mode=user|admin] [add|remove] + +On Unix, merely adds or removes symlinks for binaries, man pages, and +info pages in the system directories specified by the respective options +(see the L<option> description above). Does not change any +initialization files, either system or personal. + +On Windows, the registry part where the binary directory is added or +removed is determined in the following way: + +If the user has admin rights, and the option C<--w32mode> is not given, +the setting I<w32_multi_user> determines the location (i.e., if it is +on then the system path, otherwise the user path is changed). + +If the user has admin rights, and the option C<--w32mode> is given, this +option determines the path to be adjusted. + +If the user does not have admin rights, and the option C<--w32mode> +is not given, and the setting I<w32_multi_user> is off, the user path +is changed, while if the setting I<w32_multi_user> is on, a warning is +issued that the caller does not have enough privileges. + +If the user does not have admin rights, and the option C<--w32mode> +is given, it must be B<user> and the user path will be adjusted. If a +user without admin rights uses the option C<--w32mode admin> a warning +is issued that the caller does not have enough privileges. + + +=head2 pinning + +The pinning action manages the pinning file, see L<Pinning> for details. + +=over 4 + +=item B<pinning show> + +Shows the current pinning data. + +=item B<pinning check> + +Not implemented at the moment. + +=item B<pinning add I<repo> I<pgkglob> [I<pkgglob>]> + +Pins the packages specified by I<pkgglob> to the repo I<repo>. + +=item B<pinning remove I<repo> I<pgkglob> [I<pkgglob>]> + +If there is a the very package glob <pkgglob> recorded in the pinning file +for the given repo I<repo>, it is removed. + +=item B<pinning remove I<repo> --all> + +Remove all pinning data for repo I<repo>. + +=back + =head2 platform list|add|remove I<platform>... =head2 platform set I<platform> @@ -6492,6 +6540,32 @@ written to the terminal. =back +=cut + +# keep the following on *ONE* line otherwise Losedows perldoc does +# not show it!!!! + +=pod + +=head2 postaction [--w32mode=user|admin] [--fileassocmode=1|2] [--all] [install|remove] [shortcut|fileassoc|script] [I<pkg>]... + +Carry out the postaction C<shortcut>, C<fileassoc>, or C<script> given +as the second required argument in install or remove mode (which is the +first required argument), for either the packages given on the command +line, or for all if C<--all> is given. + +If the option C<--w32mode> is given the value C<user>, all actions will +only be carried out in the user-accessible parts of the +registry/filesystem, while the value C<admin> selects the system-wide +parts of the registry for the file associations. If you do not have +enough permissions, using C<--w32mode=admin> will not succeed. + +C<--fileassocmode> specifies the action for file associations. If it is +set to 1 (the default), only new associations are added; if it is set to +2, all associations are set to the TeX Live programs. (See also +C<option fileassocs>.) + + =head2 print-platform Print the TeX Live identifier for the detected platform @@ -6499,57 +6573,121 @@ Print the TeX Live identifier for the detected platform C<--print-arch> is a synonym. -=head2 info [I<option>...] [collections|schemes|I<pkg>...] +=head2 restore [--backupdir I<dir>] [--all | I<pkg> [I<rev>]] -With no argument, lists all packages available at the package -repository, prefixing those already installed with C<i>. +Restore a package from a previously-made backup. -With the single word C<collections> or C<schemes> as the argument, lists -the request type instead of all packages. +If C<--all> is given, try to restore the latest revision of all +package backups found in the backup directory. -With any other arguments, display information about I<pkg>: the name, -category, short and long description, installation status, and TeX Live -revision number. If I<pkg> is not locally installed, searches in the -remote installation source. +Otherwise, if neither I<pkg> nor I<rev> are given, list the available backup +revisions for all packages. -It also displays information taken from the TeX Catalogue, namely the -package version, date, and license. Consider these, especially the -package version, as approximations only, due to timing skew of the -updates of the different pieces. By contrast, the C<revision> value -comes directly from TL and is reliable. +With I<pkg> given but no I<rev>, list all available backup revisions of +I<pkg>. -The former actions C<show> and C<list> are merged into this action, -but are still supported for backward compatibility. +When listing available packages tlmgr shows the revision and in +parenthesis the creation time if available (in format yyyy-mm-dd hh:mm). + +With both I<pkg> and I<rev>, tries to restore the package from the +specified backup. Options: =over 4 -=item B<--list> +=item B<--all> -If the option C<--list> is given with a package, the list of contained -files is also shown, including those for platform-specific dependencies. -When given with schemes and collections, C<--list> outputs their -dependencies in a similar way. +Try to restore the latest revision of all package backups found in the +backup directory. Additional non-option arguments (like I<pkg>) are not +allowed. -=item B<--only-installed> +=item B<--backupdir> I<directory> -If this options is given, the installation source will -not be used; only locally installed packages, collections, or schemes -are listed. -(Does not work for listing of packages for now) +Specify the directory where the backups are to be found. If not given it +will be taken from the configuration setting in the TLPDB. -=item B<--taxonomy> +=item B<--dry-run> -=item B<--keyword> +Nothing is actually restored; instead, the actions to be performed are +written to the terminal. -=item B<--functionality> +=item B<--force> -=item B<--characterization> +Don't ask questions. -In addition to the normal data displayed, also display information for -given packages from the corresponding taxonomy (or all of them). See -L</"TAXONOMIES"> below for details. +=back + + +=head2 remove [I<option>]... I<pkg>... + +Remove each I<pkg> specified. Removing a collection removes all package +dependencies (unless C<--no-depends> is specified), but not any +collection dependencies of that collection. However, when removing a +package, dependencies are never removed. Options: + +=over 4 + +=item B<--no-depends> + +Do not remove dependent packages. + +=item B<--no-depends-at-all> + +See above under B<install> (and beware). + +=item B<--force> + +By default, removal of a package or collection that is a dependency of +another collection or scheme is not allowed. With this option, the +package will be removed unconditionally. Use with care. + +A package that has been removed using the C<--force> option because it +is still listed in an installed collection or scheme will not be +updated, and will be mentioned as B<forcibly removed> in the output of +B<tlmgr update --list>. + +=item B<--dry-run> + +Nothing is actually removed; instead, the actions to be performed are +written to the terminal. + +=back + + +=head2 repository + +=over 4 + +=item B<repository list> + +=item B<repository list I<path|tag>> + +=item B<repository add I<path> [I<tag>]> + +=item B<repository remove I<path|tag>> + +=item B<repository set I<path>[#I<tag>] [I<path>[#I<tag>] ...]> + +This action manages the list of repositories. See L</"MULTIPLE +REPOSITORIES"> below for detailed explanations. + +The first form (C<list>) lists all configured repositories and the +respective tags if set. If a path, url, or tag is given after the +C<list> keyword, it is interpreted as source from where to +initialize a TeX Live Database and lists the contained packages. +This can also be an up-to-now not used repository, both locally +and remote. If one pass in addition C<--with-platforms>, for each +package the available platforms (if any) are listed, too. + +The third form (C<add>) adds a repository +(optionally attaching a tag) to the list of repositories. The forth +form (C<remove>) removes a repository, either by full path/url, or by +tag. The last form (C<set>) sets the list of repositories to the items +given on the command line, not keeping previous settings + +In all cases, one of the repositories must be tagged as C<main>; +otherwise, all operations will fail! =back @@ -6622,261 +6760,198 @@ Search for package names, descriptions, and taxonomies, but not files. =back -=head2 dump-tlpdb [--local|--remote] - -Dump complete local or remote TLPDB to standard output, as-is. The -output is analogous to the C<--machine-readable> output; see -L<MACHINE-READABLE OUTPUT> section. +=head2 uninstall -Options: +Uninstalls the entire TeX Live installation. Options: =over 4 -=item B<--local> - -Dump the local tlpdb. - -=item B<--remote> +=item B<--force> -Dump the remote tlpdb. +Do not ask for confirmation, remove immediately. =back -Exactly one of C<--local> and C<--remote> must be given. - -In either case, the first line of the output specifies the repository -location, in this format: - - "location-url" "\t" location - -where C<location-url> is the literal field name, followed by a tab, and -I<location> is the file or url to the repository. - -Line endings may be either LF or CRLF depending on the current platform. - - -=head2 check [I<option>]... [files|depends|executes|runfiles|all] - -Executes one (or all) check(s) on the consistency of the installation. - -=over 4 - -=item B<files> - -Checks that all files listed in the local TLPDB (C<texlive.tlpdb>) are -actually present, and lists those missing. - -=item B<depends> - -Lists those packages which occur as dependencies in an installed collections, -but are themselves not installed, and those packages that are not -contained in any collection. - -If you call C<tlmgr check collections> this test will be carried out -instead since former versions for C<tlmgr> called it that way. - -=item B<executes> -Check that the files referred to by C<execute> directives in the TeX -Live Database are present. - -=item B<runfiles> - -List those filenames that are occurring more than one time in the runfiles. - -=back +=head2 update [I<option>]... [I<pkg>]... -Options: +Updates the packages given as arguments to the latest version available +at the installation source. Either C<--all> or at least one I<pkg> name +must be specified. Options: =over 4 -=item B<--use-svn> - -Use the output of C<svn status> instead of listing the files; for -checking the TL development repository. - -=back - - -=head2 path [--w32mode=user|admin] [add|remove] - -On Unix, merely adds or removes symlinks for binaries, man pages, and -info pages in the system directories specified by the respective options -(see the L<option> description above). Does not change any -initialization files, either system or personal. - -On Windows, the registry part where the binary directory is added or -removed is determined in the following way: - -If the user has admin rights, and the option C<--w32mode> is not given, -the setting I<w32_multi_user> determines the location (i.e., if it is -on then the system path, otherwise the user path is changed). - -If the user has admin rights, and the option C<--w32mode> is given, this -option determines the path to be adjusted. - -If the user does not have admin rights, and the option C<--w32mode> -is not given, and the setting I<w32_multi_user> is off, the user path -is changed, while if the setting I<w32_multi_user> is on, a warning is -issued that the caller does not have enough privileges. - -If the user does not have admin rights, and the option C<--w32mode> -is given, it must be B<user> and the user path will be adjusted. If a -user without admin rights uses the option C<--w32mode admin> a warning -is issued that the caller does not have enough privileges. +=item B<--all> +Update all installed packages except for C<tlmgr> itself. Thus, if +updates to C<tlmgr> itself are present, this will simply give an error, +unless also the option C<--force> or C<--self> is given. (See below.) -=cut +In addition to updating the installed packages, during the update of a +collection the local installation is (by default) synchronized to the +status of the collection on the server, for both additions and removals. -# keep the following on *ONE* line otherwise Losedows perldoc does -# not show it!!!! +This means that if a package has been removed on the server (and thus +has also been removed from the respective collection), C<tlmgr> will +remove the package in the local installation. This is called +``auto-remove'' and is announced as such when using the option +C<--list>. This auto-removal can be suppressed using the option +C<--no-auto-remove>. -=pod +Analogously, if a package has been added to a collection on the server +that is also installed locally, it will be added to the local +installation. This is called ``auto-install'' and is announced as such +when using the option C<--list>. This auto-installation can be +suppressed using the option C<--no-auto-install>. -=head2 postaction [--w32mode=user|admin] [--fileassocmode=1|2] [--all] [install|remove] [shortcut|fileassoc|script] [I<pkg>]... +An exception to the collection dependency checks (including the +auto-installation of packages just mentioned) are those that have been +``forcibly removed'' by you, that is, you called C<tlmgr remove --force> +on them. (See the C<remove> action documentation.) To reinstall any +such forcibly removed packages use C<--reinstall-forcibly-removed>. -Carry out the postaction C<shortcut>, C<fileassoc>, or C<script> given -as the second required argument in install or remove mode (which is the -first required argument), for either the packages given on the command -line, or for all if C<--all> is given. +If you want to exclude some packages from the current update run (e.g., +due to a slow link), see the C<--exclude> option below. -If the option C<--w32mode> is given the value C<user>, all actions will -only be carried out in the user-accessible parts of the -registry/filesystem, while the value C<admin> selects the system-wide -parts of the registry for the file associations. If you do not have -enough permissions, using C<--w32mode=admin> will not succeed. +=item B<--self> -C<--fileassocmode> specifies the action for file associations. If it is -set to 1 (the default), only new associations are added; if it is set to -2, all associations are set to the TeX Live programs. (See also -C<option fileassocs>.) +Update C<tlmgr> itself (that is, the infrastructure packages) if updates +to it are present. On Windows this includes updates to the private Perl +interpreter shipped inside TeX Live. +If this option is given together with either C<--all> or a list of +packages, then C<tlmgr> will be updated first and, if this update +succeeds, the new version will be restarted to complete the rest of the +updates. -=head2 uninstall +In short: -Uninstalls the entire TeX Live installation. Options: + tlmgr update --self # update infrastructure only + tlmgr update --self --all # update infrastructure and all packages + tlmgr update --force --all # update all packages but *not* infrastructure + # ... this last at your own risk, not recommended! -=over 4 +=item B<--dry-run> -=item B<--force> +Nothing is actually installed; instead, the actions to be performed are +written to the terminal. This is a more detailed report than C<--list>. -Do not ask for confirmation, remove immediately. +=item B<--list> [I<pkg>] -=back +Concisely list the packages which would be updated, newly installed, or +removed, without actually changing anything. +If C<--all> is also given, all available updates are listed. +If C<--self> is given, but not C<--all>, only updates to the +critical packages (tlmgr, texlive infrastructure, perl on Windows, etc.) +are listed. +If neither C<--all> nor C<--self> is given, and in addition no I<pkg> is +given, then C<--all> is assumed (thus, C<tlmgr update --list> is the +same as C<tlmgr update --list --all>). +If neither C<--all> nor C<--self> is given, but specific package names are +given, those packages are checked for updates. +=item B<--exclude> I<pkg> -=head2 generate [I<option>]... I<what> +Exclude I<pkg> from the update process. If this option is given more +than once, its arguments accumulate. -=over 4 +An argument I<pkg> excludes both the package I<pkg> itself and all +its related platform-specific packages I<pkg.ARCH>. For example, -=item B<generate language> + tlmgr update --all --exclude a2ping -=item B<generate language.dat> +will not update C<a2ping>, C<a2ping.i386-linux>, or +any other C<a2ping.>I<ARCH> package. -=item B<generate language.def> +If this option specifies a package that would otherwise be a candidate +for auto-installation, auto-removal, or reinstallation of a forcibly +removed package, C<tlmgr> quits with an error message. Excludes are not +supported in these circumstances. -=item B<generate language.dat.lua> +=item B<--no-auto-remove> [I<pkg>]... -=item B<generate fmtutil> +Under normal circumstances C<tlmgr> tries to remove packages which have +disappeared on the server, as described above under C<--all>. This +option prevents any such removals, either for all packages (with +C<--all>), or the given I<pkg> names. -=back +=item B<--no-auto-install> [I<pkg>]... -The C<generate> action overwrites any manual changes made in the -respective files: it recreates them from scratch based on the -information of the installed packages, plus local adaptions. -The TeX Live installer and C<tlmgr> routinely call C<generate> for -all of these files. +Under normal circumstances C<tlmgr> will install packages which are new +on the server, as described above under C<--all>. This option prevents +any such automatic installation, either for all packages (with +C<--all>), or the given I<pkg> names. -For managing your own fonts, please read the C<updmap --help> -information and/or L<http://tug.org/fonts/fontinstall.html>. +Furthermore, after the C<tlmgr> run using this has finished, the +packages that would have been auto-installed I<will be considered as +forcibly removed>. So, if C<foobar> is the only new package on the +server, then -In more detail: C<generate> remakes any of the configuration files -C<language.dat>, C<language.def>, C<language.dat.lua>, and -C<fmtutil.cnf>, from the information present in the local TLPDB, plus -locally-maintained files. + tlmgr update --all --no-auto-install -The locally-maintained files are C<language-local.dat>, -C<language-local.def>, C<language-local.dat.lua>, or -C<fmtutil-local.cnf>, searched for in C<TEXMFLOCAL> in the respective -directories. If local additions are present, the final file is made by -starting with the main file, omitting any entries that the local file -specifies to be disabled, and finally appending the local file. +is equivalent to -(Historical note: The formerly supported C<updmap-local.cfg> is no longer -read, since C<updmap> now supports multiple C<updmap.cfg> files. Thus, -local additions can and should be put into an C<updmap.cfg> file in -C<TEXMFLOCAL>. The C<generate updmap> action no longer exists.) + tlmgr update --all + tlmgr remove --force foobar -Local files specify entries to be disabled with a comment line, namely -one of these: +=item B<--reinstall-forcibly-removed> - #!NAME - %!NAME - --!NAME +Under normal circumstances C<tlmgr> will not install packages that have +been forcibly removed by the user; that is, removed with C<remove +--force>, or whose installation was prohibited by C<--no-auto-install> +during an earlier update. -where C<fmtutil.cnf> uses C<#>, C<language.dat> and C<language.def> use -C<%>, and C<language.dat.lua> use C<-->. In all cases, the I<name> is -the respective format name or hyphenation pattern identifier. -Examples: +This option makes C<tlmgr> ignore the forcible removals and re-install +all such packages. This can be used to completely synchronize an +installation with the server's idea of what is available: - #!pdflatex - %!german - --!usenglishmax + tlmgr update --reinstall-forcibly-removed --all -(Of course, you're not likely to actually want to disable those -particular items. They're just examples.) +=item B<--backup> and B<--backupdir> I<directory> -After such a disabling line, the local file can include another entry -for the same item, if a different definition is desired. In general, -except for the special disabling lines, the local files follow the same -syntax as the master files. +These two options control the creation of backups of packages I<before> +updating; that is, backup of packages as currently installed. If +neither of these options are given, no backup package will be saved. If +C<--backupdir> is given and specifies a writable directory then a backup +will be made in that location. If only C<--backup> is given, then a +backup will be made to the directory previously set via the C<option> +action (see below). If both are given then a backup will be made to the +specified I<directory>. -The form C<generate language> recreates all three files C<language.dat>, -C<language.def>, and C<language.dat.lua>, while the forms with an -extension recreates only that given language file. +You can set options via the C<option> action to automatically create +backups for all packages, and/or keep only a certain number of +backups. Please see the C<option> action for details. -Options: +C<tlmgr> always makes a temporary backup when updating packages, in case +of download or other failure during an update. In contrast, the purpose +of this C<--backup> option is to allow you to save a persistent backup +in case the actual I<content> of the update causes problems, e.g., +introduces an incompatibility. -=over 4 +The C<restore> action explains how to restore from a backup. -=item B<--dest> I<output_file> +=item B<--no-depends> -specifies the output file (defaults to the respective location in -C<TEXMFSYSVAR>). If C<--dest> is given to C<generate language>, it -serves as a basename onto which C<.dat> will be appended for the name of -the C<language.dat> output file, C<.def> will be appended to the value -for the name of the C<language.def> output file, and C<.dat.lua> to the -name of the C<language.dat.lua> file. (This is just to avoid -overwriting; if you want a specific name for each output file, we -recommend invoking C<tlmgr> twice.) +If you call for updating a package normally all depending packages +will also be checked for updates and updated if necessary. This switch +suppresses this behavior. -=item B<--localcfg> I<local_conf_file> +=item B<--no-depends-at-all> -specifies the (optional) local additions (defaults to the respective -location in C<TEXMFLOCAL>). +See above under B<install> (and beware). -=item B<--rebuild-sys> +=item B<--force> -tells tlmgr to run necessary programs after config files have been -regenerated. These are: -C<fmtutil-sys --all> after C<generate fmtutil>, -C<fmtutil-sys --byhyphen .../language.dat> after C<generate language.dat>, -and -C<fmtutil-sys --byhyphen .../language.def> after C<generate language.def>. +Force update of normal packages, without updating C<tlmgr> itself +(unless the C<--self> option is also given). Not recommended. -These subsequent calls cause the newly-generated files to actually take -effect. This is not done by default since those calls are lengthy -processes and one might want to made several related changes in -succession before invoking these programs. +Also, C<update --list> is still performed regardless of this option. =back -The respective locations are as follows: - - tex/generic/config/language.dat (and language-local.dat); - tex/generic/config/language.def (and language-local.def); - tex/generic/config/language.dat.lua (and language-local.dat.lua); - web2c/fmtutil.cnf (and fmtutil-local.cnf); +If the package on the server is older than the package already installed +(e.g., if the selected mirror is out of date), C<tlmgr> does not +downgrade. Also, packages for uninstalled platforms are not installed. =head1 TLMGR CONFIGURATION FILE diff --git a/Master/bin/alpha-linux/pst2pdf b/Master/bin/alpha-linux/pst2pdf index 7254506bdeb..60a28335578 120000 --- a/Master/bin/alpha-linux/pst2pdf +++ b/Master/bin/alpha-linux/pst2pdf @@ -1 +1 @@ -../../texmf-dist/scripts/pst2pdf/pst2pdf
\ No newline at end of file +../../texmf-dist/scripts/pst2pdf/pst2pdf.pl
\ No newline at end of file diff --git a/Master/bin/amd64-freebsd/pst2pdf b/Master/bin/amd64-freebsd/pst2pdf index 7254506bdeb..60a28335578 120000 --- a/Master/bin/amd64-freebsd/pst2pdf +++ b/Master/bin/amd64-freebsd/pst2pdf @@ -1 +1 @@ -../../texmf-dist/scripts/pst2pdf/pst2pdf
\ No newline at end of file +../../texmf-dist/scripts/pst2pdf/pst2pdf.pl
\ No newline at end of file diff --git a/Master/bin/amd64-kfreebsd/pst2pdf b/Master/bin/amd64-kfreebsd/pst2pdf index 7254506bdeb..60a28335578 120000 --- a/Master/bin/amd64-kfreebsd/pst2pdf +++ b/Master/bin/amd64-kfreebsd/pst2pdf @@ -1 +1 @@ -../../texmf-dist/scripts/pst2pdf/pst2pdf
\ No newline at end of file +../../texmf-dist/scripts/pst2pdf/pst2pdf.pl
\ No newline at end of file diff --git a/Master/bin/armel-linux/pst2pdf b/Master/bin/armel-linux/pst2pdf index 7254506bdeb..60a28335578 120000 --- a/Master/bin/armel-linux/pst2pdf +++ b/Master/bin/armel-linux/pst2pdf @@ -1 +1 @@ -../../texmf-dist/scripts/pst2pdf/pst2pdf
\ No newline at end of file +../../texmf-dist/scripts/pst2pdf/pst2pdf.pl
\ No newline at end of file diff --git a/Master/bin/i386-cygwin/pst2pdf b/Master/bin/i386-cygwin/pst2pdf index 7254506bdeb..60a28335578 120000 --- a/Master/bin/i386-cygwin/pst2pdf +++ b/Master/bin/i386-cygwin/pst2pdf @@ -1 +1 @@ -../../texmf-dist/scripts/pst2pdf/pst2pdf
\ No newline at end of file +../../texmf-dist/scripts/pst2pdf/pst2pdf.pl
\ No newline at end of file diff --git a/Master/bin/i386-freebsd/pst2pdf b/Master/bin/i386-freebsd/pst2pdf index 7254506bdeb..60a28335578 120000 --- a/Master/bin/i386-freebsd/pst2pdf +++ b/Master/bin/i386-freebsd/pst2pdf @@ -1 +1 @@ -../../texmf-dist/scripts/pst2pdf/pst2pdf
\ No newline at end of file +../../texmf-dist/scripts/pst2pdf/pst2pdf.pl
\ No newline at end of file diff --git a/Master/bin/i386-kfreebsd/pst2pdf b/Master/bin/i386-kfreebsd/pst2pdf index 7254506bdeb..60a28335578 120000 --- a/Master/bin/i386-kfreebsd/pst2pdf +++ b/Master/bin/i386-kfreebsd/pst2pdf @@ -1 +1 @@ -../../texmf-dist/scripts/pst2pdf/pst2pdf
\ No newline at end of file +../../texmf-dist/scripts/pst2pdf/pst2pdf.pl
\ No newline at end of file diff --git a/Master/bin/i386-linux/pst2pdf b/Master/bin/i386-linux/pst2pdf index 7254506bdeb..60a28335578 120000 --- a/Master/bin/i386-linux/pst2pdf +++ b/Master/bin/i386-linux/pst2pdf @@ -1 +1 @@ -../../texmf-dist/scripts/pst2pdf/pst2pdf
\ No newline at end of file +../../texmf-dist/scripts/pst2pdf/pst2pdf.pl
\ No newline at end of file diff --git a/Master/bin/i386-solaris/pst2pdf b/Master/bin/i386-solaris/pst2pdf index 7254506bdeb..60a28335578 120000 --- a/Master/bin/i386-solaris/pst2pdf +++ b/Master/bin/i386-solaris/pst2pdf @@ -1 +1 @@ -../../texmf-dist/scripts/pst2pdf/pst2pdf
\ No newline at end of file +../../texmf-dist/scripts/pst2pdf/pst2pdf.pl
\ No newline at end of file diff --git a/Master/bin/mipsel-linux/pst2pdf b/Master/bin/mipsel-linux/pst2pdf index 7254506bdeb..60a28335578 120000 --- a/Master/bin/mipsel-linux/pst2pdf +++ b/Master/bin/mipsel-linux/pst2pdf @@ -1 +1 @@ -../../texmf-dist/scripts/pst2pdf/pst2pdf
\ No newline at end of file +../../texmf-dist/scripts/pst2pdf/pst2pdf.pl
\ No newline at end of file diff --git a/Master/bin/powerpc-aix/pst2pdf b/Master/bin/powerpc-aix/pst2pdf index 7254506bdeb..60a28335578 120000 --- a/Master/bin/powerpc-aix/pst2pdf +++ b/Master/bin/powerpc-aix/pst2pdf @@ -1 +1 @@ -../../texmf-dist/scripts/pst2pdf/pst2pdf
\ No newline at end of file +../../texmf-dist/scripts/pst2pdf/pst2pdf.pl
\ No newline at end of file diff --git a/Master/bin/powerpc-linux/pst2pdf b/Master/bin/powerpc-linux/pst2pdf index 7254506bdeb..60a28335578 120000 --- a/Master/bin/powerpc-linux/pst2pdf +++ b/Master/bin/powerpc-linux/pst2pdf @@ -1 +1 @@ -../../texmf-dist/scripts/pst2pdf/pst2pdf
\ No newline at end of file +../../texmf-dist/scripts/pst2pdf/pst2pdf.pl
\ No newline at end of file diff --git a/Master/bin/sparc-solaris/pst2pdf b/Master/bin/sparc-solaris/pst2pdf index 7254506bdeb..60a28335578 120000 --- a/Master/bin/sparc-solaris/pst2pdf +++ b/Master/bin/sparc-solaris/pst2pdf @@ -1 +1 @@ -../../texmf-dist/scripts/pst2pdf/pst2pdf
\ No newline at end of file +../../texmf-dist/scripts/pst2pdf/pst2pdf.pl
\ No newline at end of file diff --git a/Master/bin/universal-darwin/pst2pdf b/Master/bin/universal-darwin/pst2pdf index 7254506bdeb..60a28335578 120000 --- a/Master/bin/universal-darwin/pst2pdf +++ b/Master/bin/universal-darwin/pst2pdf @@ -1 +1 @@ -../../texmf-dist/scripts/pst2pdf/pst2pdf
\ No newline at end of file +../../texmf-dist/scripts/pst2pdf/pst2pdf.pl
\ No newline at end of file diff --git a/Master/bin/x86_64-darwin/pst2pdf b/Master/bin/x86_64-darwin/pst2pdf index 7254506bdeb..60a28335578 120000 --- a/Master/bin/x86_64-darwin/pst2pdf +++ b/Master/bin/x86_64-darwin/pst2pdf @@ -1 +1 @@ -../../texmf-dist/scripts/pst2pdf/pst2pdf
\ No newline at end of file +../../texmf-dist/scripts/pst2pdf/pst2pdf.pl
\ No newline at end of file diff --git a/Master/bin/x86_64-linux/pst2pdf b/Master/bin/x86_64-linux/pst2pdf index 7254506bdeb..60a28335578 120000 --- a/Master/bin/x86_64-linux/pst2pdf +++ b/Master/bin/x86_64-linux/pst2pdf @@ -1 +1 @@ -../../texmf-dist/scripts/pst2pdf/pst2pdf
\ No newline at end of file +../../texmf-dist/scripts/pst2pdf/pst2pdf.pl
\ No newline at end of file diff --git a/Master/bin/x86_64-solaris/pst2pdf b/Master/bin/x86_64-solaris/pst2pdf index 7254506bdeb..60a28335578 120000 --- a/Master/bin/x86_64-solaris/pst2pdf +++ b/Master/bin/x86_64-solaris/pst2pdf @@ -1 +1 @@ -../../texmf-dist/scripts/pst2pdf/pst2pdf
\ No newline at end of file +../../texmf-dist/scripts/pst2pdf/pst2pdf.pl
\ No newline at end of file diff --git a/Master/texmf-dist/doc/latex/pst2pdf/Changes b/Master/texmf-dist/doc/latex/pst2pdf/Changes index c5cdd174931..cea7a71ded3 100644 --- a/Master/texmf-dist/doc/latex/pst2pdf/Changes +++ b/Master/texmf-dist/doc/latex/pst2pdf/Changes @@ -1,4 +1,5 @@ pst2pdf.pl -------- +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 bibtex or biber @@ -6,9 +7,9 @@ pst2pdf.pl -------- allow working with Windows - test for pst-exa to write \psset in the pdf file -0.10 2010-01-04 allow using the package pst-exa -0.09 2009-10-01 allow pspicture* -0.08 2009-08-28 test for png files (only for Linux) +0.10 2010-01-04 - allow using the package pst-exa +0.09 2009-10-01 - allow pspicture* +0.08 2009-08-28 - test for png files (only for Linux) 0.07 2009-07-24 - fix bug with \begin{postscript} and following pspicture environment - add some more documentation @@ -17,7 +18,7 @@ pst2pdf.pl -------- e.g. tex, ltx - 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.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 diff --git a/Master/texmf-dist/doc/latex/pst2pdf/Makefile b/Master/texmf-dist/doc/latex/pst2pdf/Makefile.doc index 442e4f0040d..442e4f0040d 100644 --- a/Master/texmf-dist/doc/latex/pst2pdf/Makefile +++ b/Master/texmf-dist/doc/latex/pst2pdf/Makefile.doc diff --git a/Master/texmf-dist/doc/latex/pst2pdf/README b/Master/texmf-dist/doc/latex/pst2pdf/README index 37db62ada72..1b488d664b0 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,22 +30,10 @@ 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-tmp-<No>.pdf - -Options: ---imageDir=<path> ---Iext=<.ext> ---DPI=<int> ---Iscale=<real> ---tempDir=<dir> ---verbose ---clear ---noImages ---runBibtex ---runBiber - -for more documentation => perldoc pst2pdf or read the documentation +images are named file-pst-<No>.pdf + +for more documentation => pst2pdf --help or read the documentation -- Herbert Voss 2010-01-04 -</pre>
\ No newline at end of file +</pre> diff --git a/Master/texmf-dist/doc/latex/pst2pdf/pst2pdf-doc.bib b/Master/texmf-dist/doc/latex/pst2pdf/pst2pdf-doc.bib index 75da5a14ec5..b42b1c01a15 100644 --- a/Master/texmf-dist/doc/latex/pst2pdf/pst2pdf-doc.bib +++ b/Master/texmf-dist/doc/latex/pst2pdf/pst2pdf-doc.bib @@ -125,10 +125,10 @@ @Book{PSTricks2, author = {Herbert Vo\ss}, - title = {\texttt{PSTricks} -- {G}rafik f\"ur \TeX{} und \LaTeX}, - edition = {6.}, - publisher = {DANTE -- Lehmanns}, + title = {\texttt{PSTricks} -- {G}rafics for \TeX{} and \LaTeX}, + edition = {1.}, + publisher = {UIT}, year = {2011}, - address = {Heidelberg/Hamburg} + address = {Cambridge} } diff --git a/Master/texmf-dist/doc/latex/pst2pdf/pst2pdf-doc.pdf b/Master/texmf-dist/doc/latex/pst2pdf/pst2pdf-doc.pdf Binary files differindex be11194109e..7ecd33bfc39 100644 --- a/Master/texmf-dist/doc/latex/pst2pdf/pst2pdf-doc.pdf +++ b/Master/texmf-dist/doc/latex/pst2pdf/pst2pdf-doc.pdf diff --git a/Master/texmf-dist/doc/latex/pst2pdf/pst2pdf-doc.tex b/Master/texmf-dist/doc/latex/pst2pdf/pst2pdf-doc.tex index c0b893bc843..238bf937673 100644 --- a/Master/texmf-dist/doc/latex/pst2pdf/pst2pdf-doc.tex +++ b/Master/texmf-dist/doc/latex/pst2pdf/pst2pdf-doc.tex @@ -1,8 +1,8 @@ -%% $Id: pst-func-doc.tex 245 2010-01-04 17:07:30Z herbert $ -\documentclass[11pt,english,BCOR10mm,DIV12,bibliography=totoc,parskip=false, - smallheadings, headexclude,footexclude,oneside]{pst-doc} +\documentclass[10pt,english,BCOR10mm,DIV12,bibliography=totoc,parskip=false,smallheadings + headexclude,footexclude,oneside]{pst-doc} \usepackage[utf8]{inputenc} -\usepackage{pst-text,pst-grad,pst-exa} +\RequirePackage{xspace} +\usepackage{pst-text,pst-grad} \let\pstFV\fileversion \DeclareFixedFont{\RM}{T1}{ptm}{b}{n}{4cm} \renewcommand\bgImage{\pscharpath[fillstyle=gradient, @@ -16,8 +16,8 @@ \begin{document} \title{\texttt{pst2pdf}} -\subtitle{Running a PSTricks document with pdflatex;\\ \small v. 0.13} -\author{Herbert Vo\ss \\ Pablo Gonzales Luengo} +\subtitle{Running a PSTricks document with pdflatex;\\ \small v. 0.14} +\author{Herbert Vo\ss \\ Pablo Gonz\'{a}lez Luengo} \docauthor{} \date{\today} \maketitle @@ -26,131 +26,163 @@ \clearpage -\begin{abstract} -\noindent -\Lprog{pst2pdf} is a Perl script for running a PSTricks document in a last run -with pdflatex. -%\LPack{pst-exa} is a package that supports the printing of -%code and output of PSTricks examples when running in pdf mode. +%\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 +%\vfill\noindent +%Thanks to: +%Rolf Niepraschk -\end{abstract} +%\end{abstract} + +%\clearpage -\clearpage \section{Introduction} -\PST as \PS-related package uses the programming language \PS for internal -calculations. This is an important adavantage, because floating point arithmetic is no +\PST\ as \PS\ related package uses the programming language \PS\ for internal +calculations. This is an important advantage, because floating point arithmetic is no problem. Nearly all mathematical calculation can be done when running the \DVI-file -with \gs. However, creating a \PDF file in a direct way with \Lprog{pdflatex} is -not possible. \Lprog{pdflatex} cannot understand the \PS related stuff. Instead -of running \Lprog{pdflatex} one can use the Perl script \Lprog{pdf2eps}, it extracts -all \PST-related code into single documents with the same preamble as the original -main document. Then the script runs this document, clips all whitespace arounf the -image and creates a \Lext{pdf}, \Lext{eps}, and \Lext{png} image of the \PST -related code. In a last run which is the \Lprog{pdflatex} the \PST code in the -main dcouemnt is replaced by the created images. - -\section{Running the Perl script} -The genral syntax for the Perl script is simple - -\begin{BDef} -\Lprog{pst2pdf} \Larg{file}\OptArg*{\Lext{tex}} \OptArg*{options} -\end{BDef} +with \gs. However, creating a \PDF\ file in a direct way with \Lprog{pdflatex} is +not possible. \Lprog{pdflatex} cannot understand the \PS\ related stuff. -The options listed in Table~\ref{perloptions} refer only to the script and not the \LaTeX\ file. +Instead of running \Lprog{pdflatex} one can use the \Lprog{perl} \emph{script} \Lprog{pst2pdf}, it extracts +all \PST\ related code into single documents with the same preamble as the original +main document. -\begin{table} -\caption{Possible optional arguments for the Perl script \nxLprog{pst2pdf}}\label{perloptions} -\begin{tabularx}{\linewidth}{@{} l l >{\ttfamily}l X @{}}\\\toprule -\emph{name} & \emph{values} & \textrm{\emph{default}} & \emph{description}\\\midrule -\Loption{--imageDir} & literal & imgages/ & the directory for the created images\\ -\Loption{--Iext} & literal & .pdf & the extension for \Lcs{includegraphics}, can be empty, then - \Lcs{includegraphics} decides which image is used.\\ -\Loption{--DPI} & integer & 75 & the dots per inch for a created png file, if possible\\ -\Loption{--Iscale} & real & 1 & the value for the option \Loption{scale} in \Lcs{includegraphics}. - Important when using a greater dpi value.\\ -\Loption{--tempDir} & literal & . & the temporary directory for the temp files\\ -\Loption{--verbose} & boolean & 1 & for a long \Lprog{pst2pdf} log\\ -\Loption{--clear} & boolean & 0 & delete all temporary files\\ -\Loption{--noImages} & boolean & 0 & create no images, build only the pdf with the alread existing 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} -\end{table} +The \nxLprog{pst2pdf} \emph{script} runs document, clips all whitespace around the +image and creates a \Lext{pdf} (and \Lext{eps},\Lext{ppm}) image of the \PST\ +related code. In a last run which is the \Lprog{pdflatex} the \PST\ code in the +main document is replaced by the created images. -After the \Lprog{pst2pdf} run there exists a pdf file called \texttt{\Lcs{jobname}-pdf.pdf}. And when not using -the \Loption{--clear} option also the corresponding \TeX{} file \texttt{\Lcs{jobname}-pdf.tex}. -The preamble of the document should contain all code which is important to the \PST code. +\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}). -\section{\PST\ code} -The per scripts scans the files for \Lenv{pspicture} and \Lenv{postscript} environments, +\subsection{Preparating file} +The script scan the file for \Lenv{pspicture} and \Lenv{postscript} environments, which are then taken with its contents from the main file to create stand alone documents with the same preamble as the main document. The \Lenv{pspicture} environment can be nested, the \Lenv{postscript} one not! But it can contain an environment \Lenv{pspicture}, but not vice versa. The \Lenv{postscript} environment should always be used, when there is some code before a \Lenv{pspicture} environment or for some code which is not inside of a \Lenv{pspicture} environment. +Put all related \PST\ package in separate lines in your preamble, \nxLprog{pst2pdf} delete al lines contains \PST\ package before last run. + +This is an example of environments that support for \nxLprog{pst2pdf}: + +\vspace{10pt} +\begin{minipage}[c]{0.25\textwidth} +\begin{verbatim} +\pspicture* +\psset{...} +pstricks code +\endpspicture +\end{verbatim} +\end{minipage} +\begin{minipage}[c]{0.25\textwidth} +\begin{verbatim} +\begin{pspicture} +\psset{...} +pstricks code +\end{pspicture} +\end{verbatim} +\end{minipage} +\begin{minipage}[c]{0.25\textwidth} +\begin{verbatim} +\begin{pspicture*} +\psset{...} +pstricks code +\end{pspicture*} +\end{verbatim} +\end{minipage} +\begin{minipage}[c]{0.25\textwidth} +\begin{verbatim} +\begin{postscript} +\psset{...} +pstricks code +\end{postscript} +\end{verbatim} +\end{minipage} + +\section{Running the script} +\subsection{Default mode} +The general syntax for the \Lprog{perl} \emph{script} is simple: -\bgroup -\raggedright -\nocite{*} -\bibliographystyle{plain} -\bibliography{pst2pdf-doc} -\egroup - -\printindex +\begin{BDef} +\nxLprog{perl} \nxLprog{pst2pdf} \Larg{file.tex} \OptArg*{--options} +\end{BDef} +For \TeX Live users: -\end{document} +\begin{BDef} +\nxLprog{pst2pdf} \Larg{file.tex} \OptArg*{--options} +\end{BDef} +\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: +\begin{BDef} +\nxLprog{pst2pdf} \Larg{file.tex} \OptArg*{--pdf} \OptArg*{--single} +\end{BDef} -\section{The package \nxLPack{pst-exa}} -The package \LPack{pst-exa} was created to realize examples with printed code and output -side by side or on top of each other. The package looks in the image directory for the source -code of the examples and inserts only the code between the environment \Lenv{document}, -which is the sequence \LBEG{document} \ldots\ \LEND{document}. +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}). -The package provides the environment \Lenv{PSTexample} with the optional -arguments listed in Table~\ref{pst-exaoptions}. +\section{Options} +\label{options} +The options listed in Table~\ref{perloptions} refer only to the \emph{script} and not the \LaTeX\ file. -\begin{table} -\caption{Possible optional arguments for the package \LPack{pst-exa}}\label{pst-exaoptions} -\begin{tabularx}{\linewidth}{@{} l l l X @{}}\\\toprule +\begin{table}[htp] +\caption{Optional arguments for \nxLprog{pst2pdf}}\label{perloptions} +\begin{tabularx}{\linewidth}{@{} l l >{\ttfamily}l X @{}}\\\toprule \emph{name} & \emph{values} & \textrm{\emph{default}} & \emph{description}\\\midrule -\Lkeyword{pos} & \Lkeyval{l},\Lkeyval{r},\Lkeyval{b},\Lkeyval{t} & \Lkeyval{l} & position of the image, maybe left, right, bottom ot top of the code.\\ -\Lkeyword{halign} & \Lkeyval{l},\Lkeyval{r},\Lkeyval{c} & \Lkeyval{c} & the horizontal alignment of the image.\\ -\Lkeyword{valign} & \Lkeyval{l},\Lkeyval{r},\Lkeyval{c} & \Lkeyval{c} & the vertical alignment of the image.\\ -\Lkeyword{frame} & see lst & & option is passed to \Lcs{lstinputlisting} from the package \LPack{listings}.\\ -\Lkeyword{width} & length &0.5\Ldim{linewidth} & the width of the example box.\\ -\Lkeyword{sep} & length &1em & separation between image and code.\\ -\Lkeyword{imageDir} & literal &images/ & directory for the created images and tex files.\\\bottomrule +\Loption{--imageDir} & literal & images/ & the directory for the created images.\\ +\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{--verbose} & boolean & 1 & for a long \nxLprog{pst2pdf} log.\\ +\Loption{--norun} & boolean & 0 & create files, but no compile.\\ +\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{--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{--runBibTeX}& boolean & 0 & runs \Lprog{bibtex} \\ +\Loption{--runBiber} & boolean & 0 & runs \Lprog{biber} if a file with extension \Lext{bcf} exists \\\bottomrule \end{tabularx} \end{table} +For Help in command line use: +\begin{BDef} +\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{Examples} -The package contains some example files for running the script without and -with the package \LPack{pst-exa}. - -\begin{compactdesc} -\item[test1.tex] running \verb=pst2pdf test1=. The test file contains a jpg-image, which is only possible with pdflatex. -\item[test2.tex] same as \LFile{test1}, but with using \LPack{pst-exa} and example--code combination. -\item[test3.tex] another example -\end{compactdesc} - -%\section{List of all optional arguments for \texttt{pst-exa}} -% -%\xkvview{family=pst-exa,columns={key,type,default}} - - - +\begin{BDef} +\nxLprog{mogrify} -format \OptArg*{png *.ppm} +\end{BDef} +generate PNG images files and \\ +\begin{BDef} +\nxLprog{mogrify} -format \OptArg*{jpg *.ppm} +\end{BDef} +generate JPG images files. +\bgroup +\raggedright +\nocite{*} +\bibliographystyle{plain} +\bibliography{pst2pdf-doc} +\egroup +\printindex +\end{document} diff --git a/Master/texmf-dist/doc/latex/pst2pdf/test.pdf b/Master/texmf-dist/doc/latex/pst2pdf/test.pdf Binary files differdeleted file mode 100644 index 8ffafa7a152..00000000000 --- a/Master/texmf-dist/doc/latex/pst2pdf/test.pdf +++ /dev/null diff --git a/Master/texmf-dist/doc/latex/pst2pdf/test.tex b/Master/texmf-dist/doc/latex/pst2pdf/test.tex deleted file mode 100644 index c664fb0a0d7..00000000000 --- a/Master/texmf-dist/doc/latex/pst2pdf/test.tex +++ /dev/null @@ -1,408 +0,0 @@ -\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 Binary files differdeleted file mode 100644 index e92616a5433..00000000000 --- a/Master/texmf-dist/doc/latex/pst2pdf/test2.pdf +++ /dev/null diff --git a/Master/texmf-dist/scripts/pst2pdf/pst2pdf b/Master/texmf-dist/scripts/pst2pdf/pst2pdf deleted file mode 100755 index da0aba08e4d..00000000000 --- a/Master/texmf-dist/scripts/pst2pdf/pst2pdf +++ /dev/null @@ -1,524 +0,0 @@ -eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' && eval 'exec perl -S $0 $argv:q' - if 0; - -use strict; # to be sure, that all is safe ... :-) - -# $Id: pst2pdf.pl 611 2011-12-14 08:41:35Z herbert $ -# v. 0.13 simplify the use of PSTricks with pdf -# 2011-12-12 (c) Herbert Voss <hvoss@tug.org> -# Pablo González Luengo and http://perlenespanol.com -# -# 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 -# -use File::Path; # creating/removing dirs -use File::Copy; # copying files -use File::Basename; # scan argument -use IO::File; # simple IO operation -use Getopt::Long; # read parameter -#----------------------- User part begin ------------------------ -my $imageDir = "images"; # where to save the images -my $Iext = ".pdf"; # leave empty, if not a special one -my $tempDir = "."; # temporary directory -my $verbose = 1; # 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 $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 $miktex = 0; # 1->runs pdlatex for miktex -my $eps = 0; # 1->create .eps files -#----------------------- User part end --------------------------- -#----------------------- program identification, options and help -my $program = "pst2pdf"; -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> -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 $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 and/or eps and/or png and/or ...) - and then runs pdflatex. 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 - --verbose - 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 - --miktex - for miktex users -enable-write18 -Examples: -* $program test.tex --clear --ppm --eps -* produce test-pdf.tex and .ppm,.eps,.tex and .pdf for all images in image dir -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 - "runBibTeX" => \$runBibTeX, # flag - "ppm" => \$ppm, # flag - "norun" => \$norun, # flag - "miktex" => \$miktex, # flag - "eps" => \$eps, # flag - "runBiber" => \$runBiber, # flag - "verbose" => \$verbose, -) or die $usage; -# help functions -sub debug { print STDERR "* @_\n" if $::opt_debug; } -sub warning { print STDERR "==> Warning: @_\n"; } -sub error { die "$title!!! Error: @_\n"; } -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); -} -if ($::opt_license) { - print $licensetxt; - exit (0); -} -# open file -my $InputFilename = ""; -if ($::opt_filter) { - @ARGV == 0 or - errorUsage "Input file cannot be used with filter option"; - debug "Filtering: will read standard input"; -} else { - @ARGV > 0 or errorUsage "Input filename missing"; - @ARGV < 2 or errorUsage "Unknown option or too many input files"; - $InputFilename = $ARGV[0]; - debug "Input filename:", $InputFilename; -} -my @SuffixList = (".tex","",".ltx"); # possible extensions -my ($name,$path,$ext) = fileparse($ARGV[0],@SuffixList); -if ($ext eq "") { $ext = ".tex"; } # me need the extension as well -my $TeXfile = "$path$name$ext"; -my $Logfile = "$tempDir/$name.plog"; # our own log file -open (LOGfile,">$Logfile") or die "cannot open $Logfile!"; -LOG ("Parameters:"); -LOG ("==> imageDir = $imageDir"); -LOG ("==> Iext = $Iext"); -LOG ("==> DPI = $DPI"); -LOG ("==> Iscale = $Iscale"); -LOG ("==> tempDir = $tempDir"); -LOG ("==> verbose = $verbose"); -LOG ("==> clear = $clear"); -LOG ("==> noImages = $noImages"); -LOG ("==> runBibTeX= $runBibTeX"); -LOG ("==> runBiber = $runBiber"); -LOG ("==> ppm = $ppm"); -LOG ("==> norun = $norun"); -LOG ("==> miktex = $miktex"); -LOG ("==> eps = $eps"); - -if ($runBibTeX && $runBiber) { - LOG ("!!! you cannot run BibTeX and Biber at the same document ..."); - LOG ("!!! Assuming to run Biber"); - $runBibTeX = 0; -} -if ($ppm) { - LOG ("Generate .ppm files ..."); - $ppm = 1; -} -if ($norun) { - LOG ("no compile file-pdf.tex"); - $norun = 1; -} -if ($miktex) { - LOG ("enable write 18 ..."); - $miktex = 1; -} -if ($eps) { - LOG ("Generate .eps files ..."); - $eps = 1; -} - -my $imgNo = 1; # internal image counter -my $pstExaLoaded = 0; # Document loads pst-exa - -LOG ("Running on [$path][$name][$ext]"); -open (FILE, "<$TeXfile") or die "cannot open source file $TeXfile!"; # the source -if (!$noImages ) { - if (-d $imageDir) { LOG ("$imageDir exists") } - else { mkdir("$imageDir", 0744) || die "cannot mkdir $imageDir: $!"; -LOG ("Imagedir created"); } -LOG ("go to savePreamble ... "); -savePreamble($name); -runBurst("$tempDir"); -LOG ("done!\n go to runFile ..."); -runFile($name); -LOG ("done!"); -close FILE; # close source file -}# !noImages - -#------------ Create filename-pics.pdf, split and generate .ppm -sub runBurst{ -if ($miktex){system("pdflatex -enable-write18 -interaction=nonstopmode $tempDir/$name");} -else{system("pdflatex -shell-escape -interaction=nonstopmode $tempDir/$name");} -system("pdftk $name-pics.pdf burst output $imageDir/$name-tmp-\%1d.pdf"); -if ($ppm){system("pdftoppm -r $DPI $name-pics.pdf $imageDir/$name-tmp"); -# Renaming .ppm neded for windows -if ($^O eq 'MSWin32') { -my $dren = "$tempDir/$imageDir"; -my $fichero = ''; -my $ppmren = ''; -my $renNo = 1; -if(opendir(DIR,$dren)){ - foreach (readdir DIR){ - $fichero = $_; - if ($fichero =~ /([^\d]+)(\d+).ppm/){ - my $renNo=int($2); - my $newname="$1$renNo.ppm"; - $ppmren = rename("$dren/$fichero","$dren/$newname"); - } - } - } - else - { - print "dont open".$dren; - } -closedir DIR; -} -# end renaming -} -} -#------------ end pdftk burst -LOG ("runpdfTeX ... "); -runpdfTeX("$path$name",$name); -LOG ("all finished ... :-)"); -close LOGfile; - -if ( $clear ) { -unlink "$path$name.txt"; -unlink "$path$name.log"; -unlink "$path$name.plog"; -unlink "$path$name.preamble"; -unlink "$path$name.pdf"; - } -# 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. -sub savePreamble { - my $filename = pop; # get the file name - LOG ("----- Start Preamble -----"); - open (FILEp, ">$tempDir/$filename.preamble") - or die "cannot open preamble file $tempDir/$filename.preamble!"; - while (<FILE>) { # read all until \begin{document} - $pstExaLoaded = index($_,"usepackage{pst-exa}"); - my $i = index($_,"begin{document}"); - if ($i > 0) { - if ($i > 1) { print FILEp substr($_,0,--$i); } # write all until \begin{document} - close(FILEp); # close preamble - LOG ("----- Close Preamble ------"); - return; - } else { - print FILEp "$_"; # write into preamble - LOG ("$_"); - } - } - close(FILEp); - if ( $verbose ) { LOG("<-----Preamble<----"); } - return; -} - -sub searchPS { # search the PostScript parts - my @PS = (); # single PS sequence - my @PStotal = (); # all PS sequences as list of arrays - my $depth = -1; # counts nested macros - my $type = -1; # -1-> none; 1->PST; 2->PS; - my $EndDocument = 0; # ignore all after \end{document} - my $iVerb = 0; # test for verbatim or lstlisting environment, must be ignored - while (<FILE>) { # scan the input file - if (!$EndDocument) { - chomp; # delete EOL character - my $line = $_; # save line - if ( !$iVerb ) { - $iVerb = ((index($line,"begin{verbatim}") > 0) or (index($line,"begin{lstlisting}") > 0)); - } # do nothing until \end{verbatim} - if ( !$iVerb ) { - my $iPS = index($line,"begin{postscript}"); - my $iPST = index($line,"begin{pspicture*}"); - if ($iPST < 0) { $iPST = index($line,"begin{pspicture}"); } # alternative - if ($iPST < 0) { $iPST = index($line,"pspicture"); } # alternative \pspicture... - if (($iPS > 0) && ( $type == 1 )){ print "postscript environment must be of outer level!\n"; exit 1; } - if ( $type < 0 ) { # no active environment - if ($iPS > 0) { # we have \begin{postscript} - $type = 2; - $line = substr($line,$iPS-1); # add rest of the line - LOG("PS-Zeile: $line"); - } - elsif ( $iPST > 0 ) { # we have \begin{pspicture} or \pspicture - $type = 1; - $depth++; - $line = substr($line,$iPST-1); # add all unitl pspicture - LOG("PST-Zeile: $line"); - } - } -# we have now \begin{pspicture} or \begin{postscript} - if ($type > 0) { # start Scan, we have an environment - LOG ("searchPS: set \$type=$type"); - $iPST = index($line,"end{pspicture*}"); - if ($iPST < 0) { $iPST = index($line,"end{pspicture}"); } # alternative - if ($iPST < 0) { $iPST = index($line,"endpspicture"); } # alternative \endpspicture... - $iPS = index($line,"end{postscript}"); - if ($iPST > 0) { # test, we can have postscript and pspicture in one line - if ( $type < 2) { # found end of pspicture environment - LOG ("searchPS: $line"); - $depth--; - if ($depth < 0) { - $type = -1; - if (index($line,"endpspicture") > 0) # add line, depends to type - { push @PS,substr($line,0,$iPST+12); } # \endpspicture - elsif (index($line,"pspicture*") > 0) - { push @PS,substr($line,0,$iPST+15); }# \end{pspicture} - else { push @PS,substr($line,0,$iPST+14); } # \end{pspicture} - LOG ("searchPS: set \$type=$type"); - push @PStotal,[@PS]; # add PS sequence - LOG ("---->PS---->\n@PS\n<----PS<----"); - @PS = (); # start new PS sequence - } # no pspicture env left - } else { push @PS,$line; } # pspicture inside postscript - } elsif ($iPS > 0) { # must be type=1 -> stop Scan - LOG ("searchPS: $line"); - $type = -1; - push @PS,substr($line,0,$iPS+15); # add line - LOG ("searchPS: set \$type=$type"); - push @PStotal,[@PS]; # add PS sequence - LOG ("---->PS---->\n@PS\n<----PS<----"); - @PS =(); # start new PS sequence - } else { push @PS,$line; } # add line - } - my $i = index($line,"end{document}"); - if ($i > 0) { $EndDocument++; LOG("EndDocument in searchPS"); } - } # if ( $iVerb ) - if (( index($line,"end{verbatim}") > 0 ) or ( index($line,"end{lstlisting}") > 0 )) { $iVerb = 0; } - }} - if ( $verbose ) { - LOG("---->PStotal---->"); - for my $aref ( @PStotal ) { - my @a = @$aref; - my $i = 0; - foreach ( @a ) { LOG ($a[$i]); $i++; } - } - LOG ("<----PStotal<----"); - } - close(FILE); - return @PStotal; # return all PS sequences -} - -# Creating subfiles.tex and .eps for images -sub runTeX{ - my $filename = pop; - my $name = "$filename"; - copy("$filename.tex", "$imageDir/$filename-$imgNo.tex") or die "Cannot copy Source file!"; - if ($eps){ - system("pdftops -level3 -eps $imageDir/$filename-$imgNo.pdf $imageDir/$filename-$imgNo.eps"); - } -$imgNo=$imgNo+1; -} - -sub runFile { - my $filename = pop; - my @PSarray = searchPS(); - if ( $verbose ) { - LOG("---->PSarray---->"); - for my $aref ( @PSarray ) { - my @a = @$aref; - my $i = 0; - foreach ( @a ) { print LOG $a[$i]."\n"; $i++; } - } - LOG("<----PSarray<----"); - my $no = @PSarray; - LOG("PS: ".$no." PS sequence(s)"); - } - for my $aref ( @PSarray ) { - my @PS = @$aref; - open (FILEp,"<$tempDir/$filename.preamble") or die "cannot open $tempDir/$filename.preamble!"; - open (FILEsub,">$tempDir/$filename-tmp.tex") or die "cannot open $tempDir/$filename-tmp.tex!"; - while (<FILEp>) {print FILEsub $_; } - print FILEsub "\\pagestyle{empty}\n"; - print FILEsub "\\begin{document}\n"; - if ( $verbose ) { LOG("\@PS: $_"); } - foreach ( @PS ) { print FILEsub "$_\n"; } - print FILEsub "\\end{document}\n"; - close (FILEsub); - close (FILEp); - runTeX("$tempDir/$filename-tmp"); - } -} -# Replace files -sub runpdfTeX() { - my ($name,$pdfname) = @_; - open (PDF, ">$tempDir/$pdfname-pdf.tex") or die "cannot open $tempDir/$pdfname-pdf.tex!"; - open (FILE, "<$name.tex") or die "cannot open $name!"; - my $ignore = 0; - my $IMGno = 1; - my $depth = -1; - my $type = -1; - my $EndDocument = 0; # ignore all after \end{document} - my $iVerb = 0; - while (<FILE>) { # scan the input file - if ( !$iVerb ) { - $iVerb = ((index($_,"begin{verbatim}") > 0) or (index($_,"begin{lstlisting}") > 0)); - } # do nothing until \end{verbatim}|| \end{lstlisting} - if ( !$iVerb ) { - my $i = index($_,"end{document}"); - if ($i > 0) { print PDF $_; $EndDocument++; LOG("EndDocument in runpdfTeX"); } - if ( !$EndDocument ) { - my $iPS = index($_,"begin{postscript}"); - if ( $iPS > 0 ) { - $type = 2; - $ignore = 1; - if ($iPS > 1) { print PDF substr($_,0,--$iPS); } # add preceeding text - print PDF "\\includegraphics[scale=$Iscale]{$pdfname-tmp-$IMGno}"; # use pdfname - $IMGno=$IMGno+1; - } # postscript env - if ( $type < 2 ) { - my $iPST = index($_,"begin{pspicture*}"); - if ($iPST < 0) { $iPST = index($_,"begin{pspicture}"); } # alternative ... - if ($iPST < 0) { $iPST = index($_,"\\pspicture"); } # alternative \endpspicture... - if ( $iPST >= 0 ) { # start Scan - $ignore = 1; - $type = 1; - $depth++; # pspicture env - LOG("Increase depth: $depth"); - if ( $depth == 0 ) { - if ($iPST > 1) { print PDF substr($_,0,--$iPST); } # add preceeding text - print PDF "\\includegraphics[scale=$Iscale]{$pdfname-tmp-$IMGno}"; # use \graphicspath - $IMGno=$IMGno+1; - LOG("Increase Image counter: $IMGno"); - } - } - } - if ( !$ignore ) { print PDF "$_"; } # default line - if ( $type == 2 ) { # postscript env - my $iPS = index($_,"end{postscript}"); - if ($iPS > 0) { - print PDF substr($_,$iPS+15); # rest of line - $ignore = 0; - $type=-1; - } # end Scan - } elsif ( $type == 1 ) { # pspicture env - my $iPST = index($_,"end{pspicture*}"); - if ($iPST < 0) { $iPST = index($_,"end{pspicture}"); } # alternative ... - if ($iPST < 0) { $iPST = index($_,"endpspicture"); } # alternative \endpspicture... - if ($iPST > 0) { # end Scan - if (index($_,"endpspicture") > 0) # add rest of line, depends to type - { print PDF substr($_,$iPST+12); } # \endpspicture - elsif (index($_,"pspicture*") > 0) - { print PDF substr($_,$iPST+15); } # \end{pspicture*} - else { print PDF substr($_,$iPST+14); } # \end{pspicture} - $depth--; - LOG("Decrease depth: $depth"); - if ($depth < 0) { $ignore = 0; } - } - } - } # if ( !$EndDocument ) - } else { print PDF $_; } # if ( $iVerb ) - if (( index($_,"end{verbatim}") > 0 ) or ( index($_,"end{lstlisting}") > 0 )) { $iVerb = 0; } - } # while (<FILE>) - close (FILE); - close (PDF); -# Coment pst-package - open (IPDF, "<$tempDir/$pdfname-pdf.tex"); - undef $/; # read all file - my ($uno,$dos) = split(/\\begin\{document\}/,<IPDF>,2); - close IPDF; - - my @coment = split /\n/, $uno; # split in two - my @preamb; - - foreach my $line (@coment) { - chomp($line); - $line =~ s/\\usepackage(?:\[.+?\])?\{pst.+?}//g; # delete - $line =~ s/\\usepackage(?:\[.+?\])?\{psfr.+?}//g; # delete - $line =~ s/(\\usepackage(?:\[.+?\])?)\{auto-pst.+?}//g; # delete - $line =~ s/(\\usepackage(?:\[.+?\])?)\{vaucanson-.+?}//g; # delete - $line =~ s/(\\usepackage(?:\[.+?\])?)\{psgo}//g; # delete - $line =~ s/(\\usepackage(?:\[.+?\])?)\{graph/\%$1\{graph/g; # comment - next if $line =~ m/^\s*$/; - push(@preamb,$line); # adding changes -} -my $clean = join("\n", @preamb, "\\usepackage{grfext}\n\\\PrependGraphicsExtensions*{$Iext}\n\\usepackage{graphicx}\n\\graphicspath{{$imageDir/}}\n\\begin{document}\n". $dos); - -open (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 {system("pdflatex -interaction=nonstopmode $pdfname-pdf");} -if (-e "$tempDir/$pdfname-pdf.idx") { system("makeindex $tempDir/$pdfname-pdf.idx"); $runAgain++; } -if ($runBibTeX && -e "$tempDir/$pdfname-pdf.aux") { system("bibtex $tempDir/$pdfname-pdf"); $runAgain++; } -if ($runBiber && -e "$tempDir/$pdfname-pdf.bcf") { system("biber $tempDir/$pdfname-pdf"); $runAgain++; } -if ($runAgain) { system("pdflatex $tempDir/$pdfname-pdf"); } -if ( $clear ) { - unlink "$name.txt"; - unlink "$tempDir/$name.aux"; - unlink "$tempDir/$pdfname-pdf.log"; - unlink "$tempDir/$pdfname-pdf.aux"; - unlink "$tempDir/$pdfname-pdf-autopp.txt"; - unlink "$tempDir/$pdfname-pics.pdf"; - unlink "$tempDir/doc_data.txt"; - unlink "$tempDir/$pdfname-tmp.tex"; - } -} - -sub LOG() { - if ( $verbose ) { print LOGfile "@_\n"; } -} -__END__ diff --git a/Master/texmf-dist/scripts/pst2pdf/pst2pdf.pl b/Master/texmf-dist/scripts/pst2pdf/pst2pdf.pl new file mode 100755 index 00000000000..040cdf7e7dd --- /dev/null +++ b/Master/texmf-dist/scripts/pst2pdf/pst2pdf.pl @@ -0,0 +1,659 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' && eval 'exec perl -S $0 $argv:q' + if 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 +# 2011-12-12 (c) Herbert Voss <hvoss@tug.org> +# 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 +# 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 +# +use File::Path; # creating/removing dirs +use File::Copy; # copying files +use File::Basename; # scan argument +use IO::File; # simple IO operation +use Getopt::Long; # read parameter +use autodie; +#----------------------- User part begin ------------------------ +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 $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. +#----------------------- User part end --------------------------- +#-------------- program identification, options and help --------- +my $program = "pst2pdf"; +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> +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 $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 +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. +Examples: +* $program test.tex --all +* produce test-pdf.tex and ppm,eps,tex and pdf for pst-enviroment in image dir +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, +) or die $usage; +#---------------- 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); +} +if ($::opt_license) { + print $licensetxt; + exit (0); +} +# open file +my $InputFilename = ""; + @ARGV > 0 or errorUsage "Input filename missing"; + @ARGV < 2 or errorUsage "Unknown option or too many input files"; + $InputFilename = $ARGV[0]; + +my @SuffixList = (".tex","",".ltx"); # possible extensions +my ($name,$path,$ext) = fileparse($ARGV[0],@SuffixList); +if ($ext eq "") { $ext = ".tex"; } # me need the extension as well +my $TeXfile = "$path$name$ext"; +open my $LOGfile,'>', "$tempDir/$name.plog"; # our own log file + LOG ("Parameters:"); + LOG ("==> imageDir = $imageDir"); + LOG ("==> Iext = $Iext"); + LOG ("==> DPI = $DPI"); + LOG ("==> Iscale = $Iscale"); + LOG ("==> tempDir = $tempDir"); + LOG ("==> verbose = $verbose"); + LOG ("==> clear = $clear"); + LOG ("==> noImages = $noImages"); + LOG ("==> single = $single"); + LOG ("==> runBibTeX= $runBibTeX"); + LOG ("==> runBiber = $runBiber"); + LOG ("==> ppm = $ppm"); + LOG ("==> norun = $norun"); + LOG ("==> eps = $eps"); + LOG ("==> files = $files"); + LOG ("==> xetex = $xetex"); + +if ($runBibTeX && $runBiber) { + LOG ("!!! you cannot run BibTeX and Biber at the same document ..."); + LOG ("!!! Assuming to run Biber"); + $runBibTeX = 0; +} +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 ($files) { + LOG ("Generate .tex images files ..."); + $files=1; +} +if ($all) { + LOG ("Generate all images files ..."); + $files=$eps = $ppm = $clear = 1; +} +if ($nopdftk) { + LOG ("single mode generate all images files ..."); + $single=$files=$eps = $ppm = $clear = 1; +} +if ($xetex) { + LOG ("Compiling using XeLaTeX ..."); + $xetex=1; +} + +my $imgNo = 1; # internal image counter +#----------- single mode no need pdftk and auto-pst-pdf ---------------------- +if ($single) { +LOG ("Running on [$path][$name][$ext]"); +open my $FILE,'<', "$TeXfile" ; # the source +LOG ("single mode generate images..."); +if (-d $imageDir) { LOG ("$imageDir exists") } +else { mkdir("$imageDir", 0744) ;} +savePreamble($name); +runFile($name); +close $FILE; # close source file +close $LOGfile; +} +#---------------- end single -------------- +else{ +LOG ("Running on [$path][$name][$ext]"); +open my $FILE,'<', "$TeXfile" ; # the source +if (!$noImages ) { +if (-d $imageDir) { LOG ("$imageDir exists") } +else { mkdir("$imageDir", 0744) ; +LOG ("Imagedir created"); } +LOG ("go to savePreamble ... "); +runBurst($tempDir); +savePreamble($name); +runFile($name); +LOG ("done!\n go to runFile ..."); +LOG ("done!"); +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");} + } +} +#------------ end pdftk burst +LOG ("runpdfTeX ... "); +runpdfTeX("$path$name",$name); +LOG ("all finished ... :-)"); +# 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 ---------------------------------------- +sub savePreamble { +my $filename = pop; # get the file name + LOG ("----- Start Preamble -----"); +open my $FILEp,'>',"$tempDir/$filename.preamble"; +open my $FILE, '<', "$name.tex"; + while (<$FILE>) { # read all until \begin{document} + my $i = index($_,"begin{document}"); + if ($i > 0) { + if ($i > 1) { print $FILEp substr($_,0,--$i); } # write all until \begin{document} + if ($single) { + print $FILEp "\\newenvironment{postscript}{}{}\n"; + print $FILEp "\\pagestyle{empty}\n"; + } +close $FILEp; # close preamble + LOG ("----- Close Preamble ------"); + return; + } +else { + print $FILEp "$_"; # write into preamble + LOG ("$_"); + } +} +close $FILE; +close $FILEp; + if ( $verbose ) { LOG("<-----Preamble<----"); } + return; +} + +sub searchPS { # search the PostScript parts + my @PS = (); # single PS sequence + my @PStotal = (); # all PS sequences as list of arrays + my $depth = -1; # counts nested macros + my $type = -1; # -1-> none; 1->PST; 2->PS; + my $EndDocument = 0;# ignore all after \end{document} + my $iVerb = 0; # test for verbatim or lstlisting environment, must be ignored + open my $FILE, '<', "$name.tex"; + while (<$FILE>) { # scan the input file + if (!$EndDocument) { + chomp; # delete EOL character + my $line = $_; # save line + if ( !$iVerb ) { + $iVerb = ((index($line,"begin{verbatim}") > 0) + or (index($line,"begin{lstlisting}") > 0) + or (index($line,"begin{Verbatim}") > 0) + or (index($line,"begin{verbatim*}") > 0)); + } # do nothing until \end{verbatim} + if ( !$iVerb ) { + my $iPS = index($line,"begin{postscript}"); + my $iPST = index($line,"begin{pspicture*}"); + if ($iPST < 0) { $iPST = index($line,"begin{pspicture}"); } # alternative + if ($iPST < 0) { $iPST = index($line,"pspicture"); } # alternative \pspicture... + if (($iPS > 0) && ( $type == 1 )){ print "postscript environment must be of outer level!\n"; exit 1; } + if ( $type < 0 ) { # no active environment + if ($iPS > 0) { # we have \begin{postscript} + $type = 2; + $line = substr($line,$iPS-1); # add rest of the line + LOG("PS-Zeile: $line"); + } + elsif ( $iPST > 0 ) { # we have \begin{pspicture} or \pspicture + $type = 1; + $depth++; + $line = substr($line,$iPST-1);# add all unitl pspicture + LOG("PST-Zeile: $line"); + } + } +# we have now \begin{pspicture} or \begin{postscript} + if ($type > 0) { # start Scan, we have an environment + LOG ("searchPS: set \$type=$type"); + $iPST = index($line,"end{pspicture*}"); + if ($iPST < 0) { $iPST = index($line,"end{pspicture}"); } # alternative + if ($iPST < 0) { $iPST = index($line,"endpspicture"); } # alternative \endpspicture... + $iPS = index($line,"end{postscript}"); + if ($iPST > 0) { # test, we can have postscript and pspicture in one line + if ( $type < 2) { # found end of pspicture environment + LOG ("searchPS: $line"); + $depth--; + if ($depth < 0) { + $type = -1; + if (index($line,"endpspicture") > 0) # add line, depends to type + { push @PS,substr($line,0,$iPST+12); } # \endpspicture + elsif (index($line,"pspicture*") > 0) + { push @PS,substr($line,0,$iPST+15); }# \end{pspicture} + else { push @PS,substr($line,0,$iPST+14); } # \end{pspicture} + LOG ("searchPS: set \$type=$type"); + push @PStotal,[@PS]; # add PS sequence + LOG ("---->PS---->\n@PS\n<----PS<----"); + @PS = (); # start new PS sequence + } # no pspicture env left + } else { push @PS,$line; } # pspicture inside postscript + } elsif ($iPS > 0) { # must be type=1 -> stop Scan + LOG ("searchPS: $line"); + $type = -1; + push @PS,substr($line,0,$iPS+15); # add line + LOG ("searchPS: set \$type=$type"); + push @PStotal,[@PS]; # add PS sequence + LOG ("---->PS---->\n@PS\n<----PS<----"); + @PS =(); # start new PS sequence + } else { push @PS,$line; } # add line + } + my $i = index($line,"end{document}"); + if ($i > 0) { $EndDocument++; LOG("EndDocument in searchPS"); } + } # if ( $iVerb ) + if (( index($line,"end{verbatim}") > 0 ) + or ( index($line,"end{lstlisting}") > 0 ) + or ( index($line,"end{Verbatim}") > 0 ) + or ( index($line,"end{verbatim*}") > 0 )) { $iVerb = 0; } + }} + if ( $verbose ) { + LOG("---->PStotal---->"); + for my $aref ( @PStotal ) { + my @a = @$aref; + my $i = 1; + foreach ( @a ) { LOG ($a[$i]); $i=$i+1; } + } + LOG ("<----PStotal<----"); + } + close $FILE; + return @PStotal; # return all PS sequences +} +# Creating ifile.tex and eps, pdf and ppm for images +if ($single){ +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; + } +} +else{ +#----------------- Creating files.tex and .eps for images -------------- +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; +} +} +sub runFile { + my $filename = pop; + my @PSarray = searchPS(); + if ( $verbose ) { + LOG("---->PSarray---->"); + for my $aref ( @PSarray ) { + my @a = @$aref; + my $i = 1; + foreach ( @a ) { print LOG $a[$i]."\n"; $i=$i+1; } + } + LOG("<----PSarray<----"); + my $no = @PSarray; + LOG("PS: ".$no." PS sequence(s)"); + } + for my $aref ( @PSarray ) { + my @PS = @$aref; + open my $FILEp,'<',"$tempDir/$filename.preamble"; + open my $FILEsub,'>',"$tempDir/$filename-fig.tex"; + while (<$FILEp>) {print $FILEsub $_; } + print $FILEsub "\\begin{document}\n"; + if ( $verbose ) { LOG("\@PS: $_"); } + foreach ( @PS ) { print $FILEsub "$_\n"; } + print $FILEsub "\\end{document}"; + close $FILEsub; + close $FILEp; + if ($single) { + runsingle("$name"); + } + else{ + runTeX("$tempDir/$name-fig"); + } +} +} +# ----------------Renaming ppm need for correct name +if(!$noImages){ + my $dren = "$tempDir/$imageDir"; + my $fichero = ''; + my $ppmren = ''; + my $renNo = 1; + if(opendir(DIR,$dren)){ + foreach (readdir DIR){ + $fichero = $_; + if ( $fichero =~ /($name-fig-)(\d+|\d+[-]\d+).ppm/) { + my $renNo = int($2); + my $newname="$1$renNo.ppm"; + $ppmren = rename("$dren/$fichero","$dren/$newname"); + } + } +} +closedir DIR; +}# end renaming +#--------------------------- Replace files---------------------- +sub runpdfTeX() { + my ($name,$pdfname) = @_; + open my $PDF,'>',"$tempDir/$pdfname-pdf.tex"; + open my $FILE,'<',"$name.tex"; + my $ignore = 0; + my $IMGno = 1; + my $depth = -1; + my $type = -1; + my $EndDocument = 0; # ignore all after \end{document} + my $iVerb = 0; + while (<$FILE>) { # scan the input file + if ( !$iVerb ) { + $iVerb = ((index($_,"begin{verbatim}") > 0) + or (index($_,"begin{lstlisting}") > 0) + or (index($_,"begin{Verbatim}") > 0) + or (index($_,"begin{verbatim*}") > 0)); + } # do nothing until \end{verbatim}|| \end{lstlisting} + if ( !$iVerb ) { + my $i = index($_,"end{document}"); + if ($i > 0) { print $PDF $_; $EndDocument++; LOG("EndDocument in runpdfTeX"); } + if ( !$EndDocument ) { + my $iPS = index($_,"begin{postscript}"); + if ( $iPS > 0 ) { + $type = 2; + $ignore = 1; + if ($iPS > 1) { print $PDF substr($_,0,--$iPS); } # add preceeding text + print $PDF "\\includegraphics[scale=$Iscale]{$pdfname-fig-$IMGno}"; # use pdfname + $IMGno=$IMGno+1; + } # postscript env + if ( $type < 2 ) { + my $iPST = index($_,"begin{pspicture*}"); + if ($iPST < 0) { $iPST = index($_,"begin{pspicture}"); } # alternative ... + if ($iPST < 0) { $iPST = index($_,"\\pspicture"); } # alternative \\pspicture... + if ( $iPST >= 0 ) { # start Scan + $ignore = 1; + $type = 1; + $depth++; # pspicture env + LOG("Increase depth: $depth"); + if ( $depth == 0 ) { + if ($iPST > 1) { print $PDF substr($_,0,--$iPST); } # add preceeding text + print $PDF "\\includegraphics[scale=$Iscale]{$pdfname-fig-$IMGno}"; # use \graphicspath + $IMGno=$IMGno+1; + LOG("Increase Image counter: $IMGno"); + } + } + } + if ( !$ignore ) { print $PDF "$_"; } # default line + if ( $type == 2 ) { # postscript env + my $iPS = index($_,"end{postscript}"); + if ($iPS > 0) { + print $PDF substr($_,$iPS+15); # rest of line + $ignore = 0; + $type=-1; + } # end Scan + } + elsif ( $type == 1 ) { # pspicture env + my $iPST = index($_,"end{pspicture*}"); + if ($iPST < 0) { $iPST = index($_,"end{pspicture}"); } # alternative ... + if ($iPST < 0) { $iPST = index($_,"endpspicture"); } # alternative \endpspicture... + if ($iPST > 0) { # end Scan + if (index($_,"endpspicture") > 0) # add rest of line, depends to type + { print $PDF substr($_,$iPST+12); } # \endpspicture + elsif (index($_,"pspicture*") > 0) + { print $PDF substr($_,$iPST+15); } # \end{pspicture*} + else{ print $PDF substr($_,$iPST+14); } # \end{pspicture} + $depth--; + LOG("Decrease depth: $depth"); + if ($depth < 0) { $ignore = 0; } + } + } + } # if ( !$EndDocument ) + } + else { print $PDF $_; } # if ( $iVerb ) + if (( index($_,"end{verbatim}") > 0 ) + or ( index($_,"end{lstlisting}") > 0 ) + or ( index($_,"end{Verbatim}") > 0 ) + or ( index($_,"end{verbatim*}") > 0 )) { $iVerb = 0; } + } # while (<$FILE>) + close $FILE; + close $PDF; +#------------------- Coment pst-package for pdfLaTeX -------------------- + open my $IPDF,'<', "$tempDir/$pdfname-pdf.tex"; + undef $/; # read all file + my ($uno,$dos) = split(/\\begin\{document\}/,<$IPDF>,2); + close $IPDF; + + my @coment = split /\n/, $uno; # split in two + my @preamb; + + foreach my $line (@coment) { + chomp($line); + if(!$xetex){ + $line =~ s/\\usepackage(?:\[.+?\])?\{pst.+?}//g; # delete + $line =~ s/\\usepackage(?:\[.+?\])?\{psfr.+?}//g; # delete + $line =~ s/(\\usepackage(?:\[.+?\])?)\{auto-pst.+?}//g; # delete + $line =~ s/(\\usepackage(?:\[.+?\])?)\{vaucanson-.+?}//g; # delete + $line =~ s/(\\usepackage(?:\[.+?\])?)\{psgo}//g; # delete + } + $line =~ s/(\\usepackage(?:\[.+?\])?)\{graph/\%$1\{graph/g; # comment + next if $line =~ m/^\s*$/; + push(@preamb,$line);} # adding changes + +my $clean = join("\n", @preamb, "\\usepackage{grfext}\n\\\PrependGraphicsExtensions*{$Iext}\n\\usepackage{graphicx}\n\\graphicspath{{$imageDir/}}\n\\begin{document}". $dos); + + 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 (-e "$tempDir/$pdfname-pdf.idx") { + system("makeindex $tempDir/$pdfname-pdf.idx"); $runAgain++;} + if ($runBibTeX && -e "$tempDir/$pdfname-pdf.aux") { + system("bibtex $tempDir/$pdfname-pdf"); $runAgain++; } + if ($runBiber && -e "$tempDir/$pdfname-pdf.bcf") { + system("biber $tempDir/$pdfname-pdf"); $runAgain++; } + if ($runAgain){ + if($xetex){ + system("xelatex -interaction=batchmode $tempDir/$pdfname-pdf");} + 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"; + } + } + } + +sub LOG() { + if ( $verbose ) { print $LOGfile "@_\n"; } + } +__END__ diff --git a/Master/tlpkg/libexec/ctan2tds b/Master/tlpkg/libexec/ctan2tds index 01a07625069..09510ea49ef 100755 --- a/Master/tlpkg/libexec/ctan2tds +++ b/Master/tlpkg/libexec/ctan2tds @@ -832,6 +832,7 @@ chomp ($Build = `cd $Master/../Build/source && pwd`); 'pst-tvz', "&MAKEpst", 'pst-uml', "&MAKEpst", 'pst-vue3d', "&MAKEpst", + 'pst2pdf', "&MAKEflatten", 'pstdoc', "die 'skipping, requires python'", 'pstrees', "die 'skipping, obsolete (for latex 2.09)'", 'pstricks', "&MAKEpstricks", @@ -2338,7 +2339,7 @@ $standardxmt='\.xmt'; 'pkfix' => '\.pl$', 'pkfix-helper' => 'pkfix-helper$', 'pmx' => '\.lua$', - 'pst2pdf' => 'pst2pdf$', + 'pst2pdf' => 'pst2pdf\.pl$', 'purifyeps' => 'purifyeps$', 'sty2dtx' => '\.pl$', 'svn-multi' => 'svn-multi\.pl$', |