From b87b8857ed65bd848247e01e07f2c335fbdef230 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Wed, 6 Jan 2010 01:24:51 +0000 Subject: pst2pdf 0.10 (4jan10) git-svn-id: svn://tug.org/texlive/trunk@16608 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/pst2pdf/Changes | 6 +- Master/texmf-dist/doc/latex/pst2pdf/README | 26 +- Master/texmf-dist/doc/latex/pst2pdf/pst2pdf | 421 +++++++++++++++++++++ .../texmf-dist/doc/latex/pst2pdf/pst2pdf-doc.bib | 159 ++++++++ .../texmf-dist/doc/latex/pst2pdf/pst2pdf-doc.pdf | Bin 0 -> 71139 bytes .../texmf-dist/doc/latex/pst2pdf/pst2pdf-doc.tex | 146 +++++++ Master/texmf-dist/doc/latex/pst2pdf/test-pdf.pdf | Bin 109313 -> 0 bytes Master/texmf-dist/doc/latex/pst2pdf/test-pdf.tex | 41 -- Master/texmf-dist/doc/latex/pst2pdf/test.tex | 60 --- Master/texmf-dist/doc/latex/pst2pdf/test1-pdf.pdf | Bin 0 -> 117779 bytes Master/texmf-dist/doc/latex/pst2pdf/test1.tex | 69 ++++ Master/texmf-dist/doc/latex/pst2pdf/test2-pdf.pdf | Bin 0 -> 176631 bytes Master/texmf-dist/doc/latex/pst2pdf/test2.pdf | Bin 0 -> 20917 bytes Master/texmf-dist/doc/latex/pst2pdf/test2.tex | 77 ++++ Master/texmf-dist/doc/latex/pst2pdf/test3-pdf.pdf | Bin 0 -> 73649 bytes Master/texmf-dist/doc/latex/pst2pdf/test3.tex | 23 ++ Master/texmf-dist/doc/latex/pst2pdf/tux.jpg | Bin 0 -> 51709 bytes Master/texmf-dist/scripts/pst2pdf/pst2pdf.pl | 394 ------------------- Master/texmf-dist/source/latex/pst2pdf/Makefile | 70 ++++ 19 files changed, 985 insertions(+), 507 deletions(-) create mode 100755 Master/texmf-dist/doc/latex/pst2pdf/pst2pdf create mode 100644 Master/texmf-dist/doc/latex/pst2pdf/pst2pdf-doc.bib create mode 100644 Master/texmf-dist/doc/latex/pst2pdf/pst2pdf-doc.pdf create mode 100644 Master/texmf-dist/doc/latex/pst2pdf/pst2pdf-doc.tex delete mode 100644 Master/texmf-dist/doc/latex/pst2pdf/test-pdf.pdf delete mode 100644 Master/texmf-dist/doc/latex/pst2pdf/test-pdf.tex delete mode 100644 Master/texmf-dist/doc/latex/pst2pdf/test.tex create mode 100644 Master/texmf-dist/doc/latex/pst2pdf/test1-pdf.pdf create mode 100644 Master/texmf-dist/doc/latex/pst2pdf/test1.tex create mode 100644 Master/texmf-dist/doc/latex/pst2pdf/test2-pdf.pdf create mode 100644 Master/texmf-dist/doc/latex/pst2pdf/test2.pdf create mode 100644 Master/texmf-dist/doc/latex/pst2pdf/test2.tex create mode 100644 Master/texmf-dist/doc/latex/pst2pdf/test3-pdf.pdf create mode 100644 Master/texmf-dist/doc/latex/pst2pdf/test3.tex create mode 100644 Master/texmf-dist/doc/latex/pst2pdf/tux.jpg delete mode 100755 Master/texmf-dist/scripts/pst2pdf/pst2pdf.pl create mode 100644 Master/texmf-dist/source/latex/pst2pdf/Makefile (limited to 'Master/texmf-dist') diff --git a/Master/texmf-dist/doc/latex/pst2pdf/Changes b/Master/texmf-dist/doc/latex/pst2pdf/Changes index 6af46dd9dc9..d9b6cb98bc4 100644 --- a/Master/texmf-dist/doc/latex/pst2pdf/Changes +++ b/Master/texmf-dist/doc/latex/pst2pdf/Changes @@ -1,6 +1,10 @@ pst2pdf.pl -------- -0.07 2008-09-29 - fix bug with \begin{postscript} and following +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 0.06 2007-08-28 - fix bug with \begin{pspicture} and \pspicture 0.05 2007-07-05 - allow different extensions for the source file e.g. tex, ltx diff --git a/Master/texmf-dist/doc/latex/pst2pdf/README b/Master/texmf-dist/doc/latex/pst2pdf/README index 72245360022..31e846d5d96 100644 --- a/Master/texmf-dist/doc/latex/pst2pdf/README +++ b/Master/texmf-dist/doc/latex/pst2pdf/README @@ -1,3 +1,4 @@ +
 pst2pdf is a Perl script which isolates all PostScript or
 PSTricks related parts of the TeX document into single
 LaTeX files, for which an eps and pdf image is created. 
@@ -5,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:
@@ -27,19 +28,22 @@ The postscript environment should be used for all other
 PostScript related commands, which are not part of
 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
+pst2pdf creates a document file-pdf.tex for use with
+pdflatex, which then creates file-pdf.pdf. The created
+images are named file-tmp-.pdf
 
 Options:
---imageDir=<path>
---Iext=<.ext>
---DPI=<int>
---Iscale=<real>
---tempDir=<dir>
+--imageDir=
+--Iext=<.ext>
+--DPI=
+--Iscale=
+--tempDir=
 --verbose 
 --clear 
 --noImages 
 
+for more documentation => perldoc pst2pdf or read the documentation
+
 --
-Herbert Voss 2008-09-24
+Herbert Voss 2010-01-04
+
\ No newline at end of file diff --git a/Master/texmf-dist/doc/latex/pst2pdf/pst2pdf b/Master/texmf-dist/doc/latex/pst2pdf/pst2pdf new file mode 100755 index 00000000000..238757135d0 --- /dev/null +++ b/Master/texmf-dist/doc/latex/pst2pdf/pst2pdf @@ -0,0 +1,421 @@ +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 ... :-) + +# v. 0.10 simplify the use of PSTricks with pdf +# 2010-01-04 (c) Herbert Voss +# $Id: pst2pdf.pl 239 2010-01-01 17:23:13Z herbert $ +# +# 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 @imageType = ("eps","pdf"); # all image types +push (@imageType, "png") if $^O ne 'MSWin32'; +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 +#----------------------- User part end --------------------------- + +@ARGV == 0 && die "file name expected!\n"; + +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!"; + +my $result = GetOptions ("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 + "verbose" => \$verbose); # flag + +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"); + +my $imgNo = 0; # 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); + LOG ("done!\n go to runFile ..."); + runFile($name); + LOG ("done!"); + close FILE; # close source file +}# !noImages + + +LOG ("runpdfTeX ... "); +runpdfTeX("$path$name",$name); +LOG ("all finished ... :-)"); +close LOGfile; +if ( $clear ) { + unlink "$path$name.aux"; + unlink "$path$name.log"; + unlink "$path$name.preamble"; + unlink "$path$name-tmp.aux"; + unlink "$path$name-tmp.dvi"; + unlink "$path$name-tmp.log"; + unlink "$path$name-tmp.pdf"; + unlink "$path$name-tmp.ps"; + unlink "$path$name-tmp.tex"; +} + +sub savePreamble { # 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. + 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 () { # 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} + print FILEp "\n\\usepackage{pst-exa}\n"; + 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 () { # 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 +} + +sub runTeX { + my $filename = pop; + system("latex $filename"); # or die "Error in the LaTeX run from file $filename!"; + system("dvips $filename"); # or die "Error in the dvips run from file $filename!"; + system("ps2pdf $filename.ps");# or die "Error in the ps2pdf run from file $filename!"; + copy("$filename.tex", "$imageDir/$filename-$imgNo.tex") or die "Cannot copy Source file!";; + for my $Itype ( @imageType ) { + if ($Itype eq "pdf") { system("pdfcrop $filename.pdf $imageDir/$filename-$imgNo.pdf"); } + if ($Itype eq "png") { + system("pdftoppm -f 1 -l 1 -r $DPI $imageDir/$filename-$imgNo.pdf $imageDir/"); + system("convert $imageDir/-1.ppm $imageDir/$filename-$imgNo.png"); + system("rm $imageDir/-1.ppm"); + } + if ($Itype eq "eps") { system("pdftops -f 1 -l 1 -eps $imageDir/$filename-$imgNo.pdf $imageDir/$filename-$imgNo.eps"); } + } + $imgNo++; +} + +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!"; +# print FILEsub "\\RequirePackage{listings}\n"; + while () { print FILEsub $_; } + print FILEsub "\\pagestyle{empty}\n"; + print FILEsub "\\newenvironment{postscript}{}{}\n"; + print FILEsub "\\providecommand\\IncludeGraphics[2][]{}\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"); + } +} + +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!"; + print PDF "\\RequirePackage{graphicx}\n"; + if ($pstExaLoaded < 1) { + print PDF "\\let\\IncludeGraphics\\includegraphics\n"; } +# print PDF "\\setkeys{Gin}{scale=0.25}\n"; +# print PDF "\\providecommand\\psset[1]{}\n"; +# print PDF "\\graphicspath{{$imageDir/}}\n"; + my $ignore = 0; + my $IMGno = 0; + my $depth = -1; + my $type = -1; + my $EndDocument = 0; # ignore all after \end{document} + my $iVerb = 0; + while () { # 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]{$imageDir/$name-tmp-$IMGno$Iext}"; + $IMGno++; + } # 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]{$imageDir/$name-tmp-$IMGno$Iext}"; +# print PDF "\\IncludeGraphics{$name-tmp-$IMGno$Iext}"; # use \graphicspath + $IMGno++; + 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 () + close (FILE); + close (PDF); + system("pdflatex $tempDir/$pdfname-pdf"); + system("makeindex $tempDir/$pdfname-pdf.idx"); + system("bibtex $tempDir/$pdfname-pdf"); + system("pdflatex $tempDir/$pdfname-pdf"); + if ( $clear ) { + unlink "$tempDir/$pdfname-pdf.log"; + unlink "$tempDir/$pdfname-pdf.aux"; + } +} + +sub LOG() { + if ( $verbose ) { print LOGfile "@_\n"; } +} + +__END__ + +=head1 NAME + +B - 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. + +=head1 SYNOPSIS + + pst2pdf.pl [Options] + +TODO + +=head1 DESCRIPTION + +runs latex and pdflatex on the TeX + +=head1 OPTIONS + +=over + +=item --imageDir - the dir for the created images + +=item --Iext=<.ext> - the extension for \includegraphics, can be empty + +=item --DPI= - the dots per inch for a cretaed png file + +=item --Iscale= - the value for \scale= in \includegraphics + +=item --tempDir= - temporary directory for the temp files + +=item --verbose - long log + +=item --clear - delete all temp files + +=item --noImages - create no images, build only pdf + +=back + +=head1 AUTHORS + +Herbert Voss + +=head1 COPYRIGHT + +Copyright (c) 2007-2009 Herbert Voss + +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 diff --git a/Master/texmf-dist/doc/latex/pst2pdf/pst2pdf-doc.bib b/Master/texmf-dist/doc/latex/pst2pdf/pst2pdf-doc.bib new file mode 100644 index 00000000000..8894fa5f494 --- /dev/null +++ b/Master/texmf-dist/doc/latex/pst2pdf/pst2pdf-doc.bib @@ -0,0 +1,159 @@ +%% -*-bibtex-*- +@STRING{tugboat = {TUGboat} } +@STRING{beiprogramm = {{\TeX}-Beiprogramm} } +@STRING{bretter = {Bretter, die die Welt bedeuten} } +@STRING{dtk = {{D}ie {\TeX}nische {K}om{\"o}die} } +@STRING{editorial = {Editorial} } +@STRING{fremdebuehne = {Von fremden B{\"u}hnen} } +@STRING{fundus = {Aus dem Fundus} } +@STRING{hinterbuehne = {Hinter der B{\"u}hne} } +@STRING{leserbrief = {Leserbrief(e)} } +@STRING{magazin = {Magazin} } +@STRING{rezension = {Rezensionen} } +@STRING{schonimmer = {Was Sie schon immer {\"u}ber {\TeX} wissen wollten \dots} } +@STRING{theaterkasse = {Von der Theaterkasse} } +@STRING{theatertage = {{\TeX}-Theatertage} } + +@Article{ dtk02.2:jackson.voss:plot-funktionen, + author = {Laura E. Jackson and Herbert Vo{\ss}}, + title = {Die {P}lot-{F}unktionen von {\texttt{pst-plot}}}, + journal = dtk, + year = 2002, + volume = {2/02}, + altvolume = 2, + altnumber = 14, + month = jun, + pages = {27--34}, + annote = bretter, + keywords = {}, + abstract = { Im letzten Heft wurden die mathematischen Funktionen von + \PS~im Zusammenhang mit dem {\LaTeX}-Paket + \texttt{pst-plot} zum Zeichnen von Funktionen beschrieben + und durch Beispiele erl{\"a}utert. In diesem Teil werden + die bislang nur erw{\"a}hnten Plot-Funktionen f{\"u}r + externe Daten behandelt. } +} + +@Article{ dtk02.1:voss:mathematischen, + author = {Herbert Vo{\ss}}, + title = {Die mathematischen {F}unktionen von {P}ost{S}cript}, + journal = dtk, + year = 2002, + volume = {1/02}, + altvolume = 1, + altnumber = 14, + month = mar, + pages = {}, + annote = bretter, + keywords = {}, + abstract = { \PS, faktisch genauso alt wie {\TeX}, ist im + Verh{\"a}ltnis dazu allgemein noch weniger bekannt, wenn es + darum geht zu beurteilen, was es denn nun im eigentlichen + Sinne ist. Au{\ss}erdem wird h{\"a}ufig vergessen, dass + sich mit den \PS-Funktionen viele Dinge erledigen lassen, + bei denen sonst auf externe Programme zur{\"u}ckgegriffen + wird. Dies wird im Folgenden f{\"u}r die mathematischen + Funktionen im Zusammenhang mit dem Paket \texttt{pst-plot} + gezeigt. } +} + +@Book{tlgc2, + author = {Michel Goosens and Frank Mittelbach and Sebastian Rahtz and Denis Roegel and Herbert Vo{\ss}}, + title = {The {\LaTeX} {G}raphics {C}ompanion}, + publisher = {{Addison-Wesley Publishing Company}}, + edition = second, + year = {2007}, + address = {Reading, Mass.} +} + + +@Book{voss:chaos, + author = {Herbert Vo{\ss}}, + title = {Chaos und {F}raktale selbst programmieren: von {M}andelbrotmengen + {\"u}ber {F}arbmanipulationen zur perfekten Darstellung}, + publisher = {{Franzis Verlag}}, + year = {1994}, + address = {Poing} +} + +@Article{girou:01:, + author = {Denis Girou}, + title = {Pr\'esentation de {PST}ricks}, + journal = {Cahier {GUT}enberg}, + year = 1994, + volume = {16}, + month = apr, + pages = {21-70} +} + +@Article{girou:02:, + author = {{Timothy van} Zandt and Denis Girou}, + title = {Inside {PST}ricks}, + journal = TUGboat, + year = 1994, + volume = {15}, + month = sep, + pages = {239-246} +} + +@Book{PostScript, + Author = {Kollock, Nikolai G.}, + Title = {Post{S}cript richtig eingesetzt: vom {K}onzept zum + praktischen {E}insatz}, + Publisher = {IWT}, + Address = {Vaterstetten}, + year = 1989, +} + +@Manual{pstricks, + Title = {PSTricks - {\PS} macros for generic {\TeX}}, + Author = {{Timothy van} Zandt}, + Organization = {}, + Address = {\url{http://www.tug.org/application/PSTricks}}, + Note = {}, + year = 1993 +} + +@Manual{pst-plot, + Title = {\texttt{pst-plot}: Plotting two dimensional functions and data}, + Author = {{Timothy van} Zandt}, + Organization = {}, + Address = {\url{CTAN:graphics/pstricks/generic/pst-plot.tex}}, + Note = {}, + year = 1999 +} + +@Manual{multido, + Title = {\texttt{multido.tex} - a loop macro, that supports fixed-point addition}, + Author = {{Timothy van} Zandt}, + Organization = {}, + Address = {\url{CTAN:/graphics/pstricks/generic/multido.tex}}, + Note = {}, + year = 1997 +} + +@Book{PSTricks2, + author = {Herbert Vo\ss}, + title = {\texttt{PSTricks} -- {G}rafik f\"ur \TeX{} und \LaTeX}, + edition = {5.}, + publisher = {DANTE -- Lehmanns}, + year = {2008}, + address = {Heidelberg/Hamburg} +} + +@Book{voss:math, + author = {Herbert Vo\ss}, + title = {\LaTeX\ in {M}athematik und {N}aturwissenschaften}, + publisher = {{Franzis-Verlag}}, + year = {2006}, + address = {Poing} +} + +@Manual{wolfram, + author = {Eric Weisstein}, + title = {Wolfram MathWorld}, + publisher = {{Wolfram}}, + year = {2007}, + address = {\url{http://mathworld.wolfram.com}} +} + diff --git a/Master/texmf-dist/doc/latex/pst2pdf/pst2pdf-doc.pdf b/Master/texmf-dist/doc/latex/pst2pdf/pst2pdf-doc.pdf new file mode 100644 index 00000000000..6636cce59f2 Binary files /dev/null and b/Master/texmf-dist/doc/latex/pst2pdf/pst2pdf-doc.pdf differ diff --git a/Master/texmf-dist/doc/latex/pst2pdf/pst2pdf-doc.tex b/Master/texmf-dist/doc/latex/pst2pdf/pst2pdf-doc.tex new file mode 100644 index 00000000000..c201a359881 --- /dev/null +++ b/Master/texmf-dist/doc/latex/pst2pdf/pst2pdf-doc.tex @@ -0,0 +1,146 @@ +%% $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} +\usepackage[utf8]{inputenc} +\usepackage{pst-exa,pst-text,pst-grad} +\let\pstFV\fileversion +\DeclareFixedFont{\RM}{T1}{ptm}{b}{n}{4cm} +\renewcommand\bgImage{\pscharpath[fillstyle=gradient, + gradbegin=red,gradend=blue,gradangle=-90]{\RM pst2pdf}} + +\lstset{language=PSTricks,basicstyle=\footnotesize\ttfamily} +\def\DVI{\textsc{DVI}} +\def\PDF{\textsc{PDF}} +\def\gs{\textsc{Ghostscript}} +% +\begin{document} + +\title{\texttt{pst2pdf}} +\subtitle{Running a PSTricks document with pdflatex and \nxLPack{pst-exa}; v.\pstFV} +\author{Herbert Vo\ss} +\docauthor{} +\date{\today} +\maketitle + +\tableofcontents + +\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. + +\vfill\noindent +Thanks to: \\ +Rolf Nirpraschk + +\end{abstract} + + +\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 +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} + +The options listed in Table~\ref{perloptions} refer only to the script and not the \LaTeX\ file. + +\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\\\bottomrule +\end{tabularx} +\end{table} + +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{\PST code} +The per scripts scans the files 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. + +\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}. + +The package provides the environment \Lenv{PSTexample} with the optional +arguments listed in Table~\ref{pst-exaoptions}. + +\begin{table} +\caption{Possible optional arguments for the Perl script \nxLprog{pst2pdf}}\label{pst-exaoptions} +\begin{tabularx}{\linewidth}{@{} l l 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.\\\bottomrule +\end{tabularx} +\end{table} + +\section{Examples} +The package contains some example files for uning 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} + +\clearpage +\section{List of all optional arguments for \texttt{pst-exa}} + +\xkvview{family=pst-exa,columns={key,type,default}} + + + + +\bgroup +\raggedright +\nocite{*} +\bibliographystyle{plain} +\bibliography{pst2pdf-doc} +\egroup + +\printindex + + + +\end{document} + + diff --git a/Master/texmf-dist/doc/latex/pst2pdf/test-pdf.pdf b/Master/texmf-dist/doc/latex/pst2pdf/test-pdf.pdf deleted file mode 100644 index b77085a3efa..00000000000 Binary files a/Master/texmf-dist/doc/latex/pst2pdf/test-pdf.pdf and /dev/null differ diff --git a/Master/texmf-dist/doc/latex/pst2pdf/test-pdf.tex b/Master/texmf-dist/doc/latex/pst2pdf/test-pdf.tex deleted file mode 100644 index b76f89aafbd..00000000000 --- a/Master/texmf-dist/doc/latex/pst2pdf/test-pdf.tex +++ /dev/null @@ -1,41 +0,0 @@ -\RequirePackage{graphicx} -\RequirePackage[pdftex]{xcolor} -\documentclass[12pt]{article} -\usepackage[T1]{fontenc} -\usepackage{pstricks} -\usepackage{pst-node} -\usepackage{pst-3dplot} -\usepackage{pst-calendar} -\usepackage{graphicx} -\usepackage{microtype} - -\begin{document} - -foo\includegraphics[scale=1]{images/./test-tmp-0.pdf}bar - -foo -\includegraphics[scale=1]{images/./test-tmp-1.pdf} -bar - -foo -\includegraphics[scale=1]{images/./test-tmp-2.pdf} -bar - -\clearpage -foo -\includegraphics[scale=1]{images/./test-tmp-3.pdf} -bar - -\includegraphics{tux}% a jpg image - -\clearpage - -foo bar baz foo bar baz - -\includegraphics[scale=1]{images/./test-tmp-4.pdf} - -foo bar baz - -\includegraphics[scale=1]{images/./test-tmp-5.pdf} - -\end{document} \ No newline at end of file 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 96f297026c5..00000000000 --- a/Master/texmf-dist/doc/latex/pst2pdf/test.tex +++ /dev/null @@ -1,60 +0,0 @@ -\documentclass[12pt]{article} -\usepackage[T1]{fontenc} -\usepackage{pstricks} -\usepackage{pst-node} -\usepackage{pst-3dplot} -\usepackage{pst-calendar} -\usepackage{graphicx} -\usepackage{microtype} - -\begin{document} - -foo\begin{pspicture}[showgrid=true](4,2)\psscaleboxto(8,2){foo}\end{pspicture}bar - -foo -\begin{pspicture}[showgrid=true](4,2) - \psscaleboxto(8,2){foo bar} -\end{pspicture} -bar - -foo -\begin{pspicture}[showgrid=true](4,2) - \psscaleboxto(8,2){foo bar baz} -\end{pspicture} -bar - -\clearpage -foo -\begin{postscript} -\psscalebox{0.5}{% -\psCalDodecaeder[style=july,unit=0.75,Year=2007] -} -\end{postscript} -bar - -\includegraphics{tux}% a jpg image - -\clearpage - -foo bar baz foo bar baz - -\begin{postscript}\rnode{foo}{foo} bar baz - -foo bar baz foo bar \rnode{baz}{baz} foo bar baz -\ncarc[linecolor=red]{<->}{foo}{baz}\end{postscript} - -foo bar baz - -\begin{postscript} -\psframebox{% -\begin{pspicture}(-3,-2)(3,6.5) -\pstThreeDCoor[zMax=7] -\pstIIIDCylinder[RotY=30,fillstyle=solid,fillcolor=red!20,linecolor=black!60](0,0,0){2}{5} -\pstThreeDLine[linecolor=red]{->}(0,0,5)(0,0,7) -\pstThreeDLine[linecolor=red]{->}(-1,0,0)(4,0,0) -\pstThreeDLine[linecolor=red]{->}(0,-1,0)(0,4,0) -\end{pspicture} -} -\end{postscript} - -\end{document} \ No newline at end of file diff --git a/Master/texmf-dist/doc/latex/pst2pdf/test1-pdf.pdf b/Master/texmf-dist/doc/latex/pst2pdf/test1-pdf.pdf new file mode 100644 index 00000000000..bb3659ee69e Binary files /dev/null and b/Master/texmf-dist/doc/latex/pst2pdf/test1-pdf.pdf differ diff --git a/Master/texmf-dist/doc/latex/pst2pdf/test1.tex b/Master/texmf-dist/doc/latex/pst2pdf/test1.tex new file mode 100644 index 00000000000..9d52356ba09 --- /dev/null +++ b/Master/texmf-dist/doc/latex/pst2pdf/test1.tex @@ -0,0 +1,69 @@ +\documentclass[12pt,english]{article} +\usepackage[T1]{fontenc} +\usepackage{pstricks} +\usepackage{pst-node} +\usepackage{pst-3dplot} +\usepackage{pst-calendar} +\usepackage{blindtext} +\usepackage{babel} +\usepackage{microtype}% for the last pdflatex run +\begin{document} + +foo\begin{pspicture}[showgrid=true](4,2)\psscaleboxto(8,2){foo}\end{pspicture}bar + +\begin{pspicture}[showgrid=true](4,2) + \psscaleboxto(8,2){foo bar} +\end{pspicture} + +\blindtext + +foo\begin{pspicture}[showgrid=true](4,2) + \psscaleboxto(8,2){foo bar baz} +\end{pspicture}bar + +\blindtext + + +\begin{postscript} +\psscalebox{0.5}{% +\psCalDodecaeder[style=january,unit=0.75,Year=2010]} +\end{postscript} + +\includegraphics{tux.jpg}% a jpg image + +\blindtext + +\begin{postscript}\rnode{foo}{foo} bar baz + +foo bar baz foo bar \rnode{baz}{baz} foo bar baz +\ncarc[linecolor=red]{<->}{foo}{baz}\end{postscript} + +\blindtext + +\begin{postscript} +\psframebox{% +\begin{pspicture}(-3,-2)(3,6.5) +\pstThreeDCoor[zMax=7] +\pstIIIDCylinder[RotY=30,fillstyle=solid,fillcolor=red!20,linecolor=black!60](0,0,0){2}{5} +\pstThreeDLine[linecolor=red]{->}(0,0,5)(0,0,7) +\pstThreeDLine[linecolor=red]{->}(-1,0,0)(4,0,0) +\pstThreeDLine[linecolor=red]{->}(0,-1,0)(0,4,0) +\end{pspicture} +} +\end{postscript} + +\blindtext + +\blindtext + +\begin{postscript} +\begin{pspicture*}(-4,-2)(3,6.5) +\pstThreeDCoor[zMax=7] +\pstIIIDCylinder[RotY=30,fillstyle=solid,fillcolor=red!20,linecolor=black!60](0,0,0){2}{5} +\pstThreeDLine[linecolor=red]{->}(0,0,5)(0,0,7) +\pstThreeDLine[linecolor=red]{->}(-1,0,0)(4,0,0) +\pstThreeDLine[linecolor=red]{->}(0,-1,0)(0,4,0) +\end{pspicture*} +\end{postscript} + +\end{document} \ No newline at end of file diff --git a/Master/texmf-dist/doc/latex/pst2pdf/test2-pdf.pdf b/Master/texmf-dist/doc/latex/pst2pdf/test2-pdf.pdf new file mode 100644 index 00000000000..5ea9adf0e73 Binary files /dev/null and b/Master/texmf-dist/doc/latex/pst2pdf/test2-pdf.pdf differ diff --git a/Master/texmf-dist/doc/latex/pst2pdf/test2.pdf b/Master/texmf-dist/doc/latex/pst2pdf/test2.pdf new file mode 100644 index 00000000000..e92616a5433 Binary files /dev/null and b/Master/texmf-dist/doc/latex/pst2pdf/test2.pdf differ diff --git a/Master/texmf-dist/doc/latex/pst2pdf/test2.tex b/Master/texmf-dist/doc/latex/pst2pdf/test2.tex new file mode 100644 index 00000000000..ca85de58694 --- /dev/null +++ b/Master/texmf-dist/doc/latex/pst2pdf/test2.tex @@ -0,0 +1,77 @@ +\documentclass[12pt,english]{article} +\usepackage[T1]{fontenc} +\usepackage{pstricks} +\usepackage{pst-node} +\usepackage{pst-3dplot} +\usepackage{pst-calendar} +\usepackage{pst-exa} +\usepackage{blindtext} +\usepackage{babel} +\usepackage{microtype}% for the last pdflatex run +\begin{document} + +foo\begin{pspicture}[showgrid=true](4,2)\psscaleboxto(8,2){foo}\end{pspicture}bar + +\begin{PSTexample}[width=4cm,pos=r] +\begin{pspicture}[showgrid=true](4,2) + \psscaleboxto(4,2){foo bar} +\end{pspicture} +\end{PSTexample} + + +foo\begin{pspicture}[showgrid=true](4,2) + \psscaleboxto(8,2){foo bar baz} +\end{pspicture}bar + + + +\begin{PSTexample}[pos=t] +\begin{postscript} +\psscalebox{0.5}{% +\psCalDodecaeder[style=january,unit=0.75,Year=2010]} +\end{postscript} +\end{PSTexample} + +\includegraphics{tux.jpg}% a jpg image + + +foo bar baz foo bar baz + +\begin{postscript}\rnode{foo}{foo} bar baz + +foo bar baz foo bar \rnode{baz}{baz} foo bar baz +\ncarc[linecolor=red]{<->}{foo}{baz}\end{postscript} + +foo bar baz + +\begin{PSTexample}[pos=b] +\begin{postscript} +\psframebox{% +\begin{pspicture}(-3,-2)(3,6.5) +\pstThreeDCoor[zMax=7] +\pstIIIDCylinder[RotY=30,fillstyle=solid,fillcolor=red!20,linecolor=black!60](0,0,0){2}{5} +\pstThreeDLine[linecolor=red]{->}(0,0,5)(0,0,7) +\pstThreeDLine[linecolor=red]{->}(-1,0,0)(4,0,0) +\pstThreeDLine[linecolor=red]{->}(0,-1,0)(0,4,0) +\end{pspicture} +} +\end{postscript} +\end{PSTexample} + + +\begin{PSTexample}[width=7.5cm] +\begin{postscript} +\begin{pspicture*}(-4,-2)(3,6.5) +\pstThreeDCoor[zMax=7] +\pstIIIDCylinder[RotY=30,fillstyle=solid,fillcolor=red!20,linecolor=black!60](0,0,0){2}{5} +\pstThreeDLine[linecolor=red]{->}(0,0,5)(0,0,7) +\pstThreeDLine[linecolor=red]{->}(-1,0,0)(4,0,0) +\pstThreeDLine[linecolor=red]{->}(0,-1,0)(0,4,0) +\end{pspicture*} +\end{postscript} +\end{PSTexample} + + + + +\end{document} \ No newline at end of file diff --git a/Master/texmf-dist/doc/latex/pst2pdf/test3-pdf.pdf b/Master/texmf-dist/doc/latex/pst2pdf/test3-pdf.pdf new file mode 100644 index 00000000000..39e83c9d5b7 Binary files /dev/null and b/Master/texmf-dist/doc/latex/pst2pdf/test3-pdf.pdf differ diff --git a/Master/texmf-dist/doc/latex/pst2pdf/test3.tex b/Master/texmf-dist/doc/latex/pst2pdf/test3.tex new file mode 100644 index 00000000000..fab1a0df4c2 --- /dev/null +++ b/Master/texmf-dist/doc/latex/pst2pdf/test3.tex @@ -0,0 +1,23 @@ +\documentclass{article} +\usepackage{graphicx,pst-calendar,pst-3dplot}% Pakete +\pagestyle{empty} +\parindent=0pt\begin{document} + +foo\begin{postscript} +\psframebox{% begin box +\pspicture(-3,-2)(3,6.5) +\pstThreeDCoor[zMax=7] +\pstIIIDCylinder[RotY=30,fillstyle=solid,fillcolor=red!20,linecolor=black!60](0,0,0){2}{5} +\pstThreeDLine[linecolor=red]{->}(0,0,5)(0,0,7) +\pstThreeDLine[linecolor=red]{->}(-1,0,0)(4,0,0) +\pstThreeDLine[linecolor=red]{->}(0,-1,0)(0,4,0) +\endpspicture}% end box +\end{postscript} +bar + +\pspicture(3,3) +\psframe[fillstyle=solid,fillcolor=red!30](3,3)\endpspicture + +\includegraphics{tux.jpg} +% Ende +\end{document} diff --git a/Master/texmf-dist/doc/latex/pst2pdf/tux.jpg b/Master/texmf-dist/doc/latex/pst2pdf/tux.jpg new file mode 100644 index 00000000000..275f977a3aa Binary files /dev/null and b/Master/texmf-dist/doc/latex/pst2pdf/tux.jpg differ diff --git a/Master/texmf-dist/scripts/pst2pdf/pst2pdf.pl b/Master/texmf-dist/scripts/pst2pdf/pst2pdf.pl deleted file mode 100755 index 837e7dbc11c..00000000000 --- a/Master/texmf-dist/scripts/pst2pdf/pst2pdf.pl +++ /dev/null @@ -1,394 +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 ... :-) - -# v. 0.06 simplify the use of PSTricks with pdf -# 2007-08-28 (c) hvoss@tug.org -# -# 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::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 @imageType = ("eps","pdf","png"); # all image types (png only for Linux) -my @imageType = ("eps","pdf"); # all image types -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 -my $Iscale = 1; # for \includegraphics -my $noImages = 0; # 1->create no images -#----------------------- User part end --------------------------- - -@ARGV == 0 && die "file name expected!\n"; - -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!"; - -my $result = GetOptions ("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 - "verbose" => \$verbose); # flag - -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"); - -my $imgNo = 0; # internal image counter - -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); - LOG ("done!\n go to runFile ..."); - runFile($name); - LOG ("done!"); - close FILE; # close source file -}# !noImages - - -LOG ("runpdfTeX ... "); -runpdfTeX("$path$name",$name); -LOG ("all finished ... :-)"); -close LOGfile; -if ( $clear ) { - unlink "$path$name.aux"; - unlink "$path$name.log"; - unlink "$path$name.preamble"; - unlink "$path$name-tmp.aux"; - unlink "$path$name-tmp.dvi"; - unlink "$path$name-tmp.log"; - unlink "$path$name-tmp.pdf"; - unlink "$path$name-tmp.ps"; - unlink "$path$name-tmp.tex"; -} - -sub savePreamble { # 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. - 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 () { # 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} - 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 () { # scan the input file - if (!$EndDocument) { - chomp; - my $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,"pspicture"); } # alternative \pspicture... - if (($iPS > 0) && ( $type == 1 )){ print "postscript environment must be 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,"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 - 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 -} - -sub runTeX { - my $filename = pop; - system("latex $filename"); - system("dvips $filename"); - system("ps2pdf $filename.ps"); - for my $Itype ( @imageType ) { - if ($Itype eq "pdf") { system("pdfcrop $filename.pdf $imageDir/$filename-$imgNo.pdf"); } - if ($Itype eq "eps") { system("pdftops -f 1 -l 1 -eps $imageDir/$filename-$imgNo.pdf $imageDir/$filename-$imgNo.eps"); } - if ($Itype eq "png") { - system("pdftoppm -f 1 -l 1 -r $DPI $imageDir/$filename-$imgNo.pdf $imageDir/"); - system("convert $imageDir/-000001.ppm $imageDir/$filename-$imgNo.png"); - system("rm $imageDir/-00001.ppm"); - } - } - $imgNo++; -} - -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 () { print FILEsub $_; } - print FILEsub "\\pagestyle{empty}\n"; - print FILEsub "\\newenvironment{postscript}{}{}\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"); - } -} - -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!"; - print PDF "\\RequirePackage{graphicx}\n"; -# print PDF "\\setkeys{Gin}{scale=0.25}\n"; - print PDF "\\RequirePackage[pdftex]{xcolor}\n"; -# print PDF "\\graphicspath{{$imageDir/}}\n"; - my $ignore = 0; - my $IMGno = 0; - my $depth = -1; - my $type = -1; - my $EndDocument = 0; # ignore all after \end{document} - my $iVerb = 0; - while () { # 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]{$imageDir/$name-tmp-$IMGno$Iext}"; -# print PDF "\\includegraphics{$name-tmp-$IMGno$Iext}"; # use \graphicspath - $IMGno++; - } # postscript env - if ( $type < 2 ) { - my $iPST = index($_,"begin{pspicture}"); - 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]{$imageDir/$name-tmp-$IMGno$Iext}"; -# print PDF "\\includegraphics{$name-tmp-$IMGno$Iext}"; # use \graphicspath - $IMGno++; - 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($_,"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 - 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 () - close (FILE); - close (PDF); - system("pdflatex $tempDir/$pdfname-pdf"); - system("makeindex $tempDir/$pdfname-pdf.idx"); - system("bibtex $tempDir/$pdfname-pdf"); - system("pdflatex $tempDir/$pdfname-pdf"); - if ( $clear ) { - unlink "$tempDir/$pdfname-pdf.log"; - unlink "$tempDir/$pdfname-pdf.aux"; - } -} - -sub LOG() { - if ( $verbose ) { print LOGfile "@_\n"; } -} - -__END__ - -=head1 NAME - -B - 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. - -=head1 SYNOPSIS - - pst2pdf.pl [Options] - -TODO - -=head1 DESCRIPTION - -runs latex and pdflatex on the TeX - -=head1 OPTIONS - ---imageDir ---Iext=<.ext> ---DPI= ---Iscale= ---tempDir= ---verbose ---clear ---noImages - -=head1 AUTHORS - -Herbert Voss - -=head1 COPYRIGHT - -Copyright (c) 2007 Herbert Voss - -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 -1;6H \ No newline at end of file diff --git a/Master/texmf-dist/source/latex/pst2pdf/Makefile b/Master/texmf-dist/source/latex/pst2pdf/Makefile new file mode 100644 index 00000000000..580978848e1 --- /dev/null +++ b/Master/texmf-dist/source/latex/pst2pdf/Makefile @@ -0,0 +1,70 @@ +# `Makefile' for `pst2pdf.pdf', hv, 2006/08/11 + +.SUFFIXES : .tex .ltx .dvi .ps .pdf .eps + +PACKAGE = pst2pdf + +MAIN = $(PACKAGE)-doc + +LATEX = latex + +ARCHNAME = $(MAIN)-$(shell date +%y%m%d) + +ARCHFILES = $(PACKAGE).sty $(PACKAGE).tex $(PACKAGE).pro $(MAIN).tex README Changes Makefile + +TDS = ~/PSTricks/PSTricks-TDS + +all : doc clean + +doc: $(MAIN).pdf + +$(MAIN).pdf : $(MAIN).ps + GS_OPTIONS=-dAutoRotatePages=/None ps2pdf $< + +$(MAIN).ps : $(MAIN).dvi + dvips $< + +$(MAIN).dvi : $(MAIN).tex + $(LATEX) $< + $(LATEX) $< + if ! test -f $(basename $<).glo ; then touch $(basename $<).glo; fi + if ! test -f $(basename $<).idx ; then touch $(basename $<).idx; fi + makeindex -s gglo.ist -t $(basename $<).glg -o $(basename $<).gls \ + $(basename $<).glo + makeindex -t $(basename $<).ilg -o $(basename $<).ind \ + $(basename $<).idx + bibtex $(basename $<) + $(LATEX) $< + $(LATEX) $< + +clean : + $(RM) $(addprefix $(MAIN), .log .aux .glg .glo .gls .ilg .idx .ind .tmp .toc .out ) + $(RM) $(addprefix $(MAIN), .dvi .ps) + +veryclean : clean + $(RM) $(addprefix $(MAIN), .pdf .bbl .blg) + +arch : + zip $(ARCHNAME).zip $(ARCHFILES) + +tds: + cp -u Changes $(TDS)/doc/generic/$(PACKAGE)/ + cp -u README $(TDS)/doc/generic/$(PACKAGE)/ + cp -u $(MAIN).pdf $(TDS)/doc/generic/$(PACKAGE)/ +# + cp -u Changes $(TDS)/tex/latex/$(PACKAGE)/ + cp -u $(PACKAGE).sty $(TDS)/tex/latex/$(PACKAGE)/ +# + cp -u Changes $(TDS)/tex/generic/$(PACKAGE)/ + cp -u $(PACKAGE).tex $(TDS)/tex/generic/$(PACKAGE)/ +# + cp -u Changes $(TDS)/dvips/$(PACKAGE)/ + cp -u $(PACKAGE).pro $(TDS)/dvips/$(PACKAGE)/ +# + cp -u Changes $(TDS)/source/$(PACKAGE)/ + cp -u $(MAIN).tex $(TDS)/source/$(PACKAGE)/ + cp -u $(MAIN).bib $(TDS)/source/$(PACKAGE)/ + cp -u Makefile $(TDS)/source/$(PACKAGE)/ + + +# EOF -- cgit v1.2.3