summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/pstricks/pstricks-pdf.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/pstricks/pstricks-pdf.sty')
-rw-r--r--Master/texmf-dist/tex/latex/pstricks/pstricks-pdf.sty158
1 files changed, 150 insertions, 8 deletions
diff --git a/Master/texmf-dist/tex/latex/pstricks/pstricks-pdf.sty b/Master/texmf-dist/tex/latex/pstricks/pstricks-pdf.sty
index e3907c28d7e..71e462a98d6 100644
--- a/Master/texmf-dist/tex/latex/pstricks/pstricks-pdf.sty
+++ b/Master/texmf-dist/tex/latex/pstricks/pstricks-pdf.sty
@@ -3,7 +3,7 @@
%%
%% IMPORTANT NOTICE:
%%
-%% pstricks-pdf.sty Copyright (C) 2016 Herbert Voss <hvoss@tug.org>
+%% pstricks-pdf.sty Copyright (C) 2017 Herbert Voss <hvoss@tug.org>
%%
%% This package may be distributed under the terms of the LaTeX Project
%% Public License, as described in lppl.txt in the base LaTeX distribution.
@@ -14,15 +14,157 @@
\ProvidesPackage{pstricks-pdf}[2015/11/11 v0.01 wrapper for `pstricks.sty' (HV)]
%
-\DeclareOption*{%
- \PassOptionsToPackage\CurrentOption{auto-pst-pdf}%
- \PassOptionsToPackage\CurrentOption{pstricks}}%
-\ProcessOptions\relax
-%
-\RequirePackage{auto-pst-pdf}%
+\RequirePackage{ifpdf,xkeyval,pst-platform,ifluatex,ifxetex}
+
+\newif\if@app@off@
+\newif\if@app@crop@
+\newcounter{app@runs}
+\def\app@suffix{autopp}
+\edef\app@jobname{\jobname-\app@suffix}
+\edef\app@pics{\jobname-pics.pdf}
+
+%%%
+% the following code is adapted from auto-pst-pdf
+%%%
+\DeclareOptionX{off}[]{\@app@off@true}
+\define@choicekey{pstricks-pdf.sty}{crop}[\@tempa\@tempb]{on,off}{%
+ \ifcase\@tempb\relax
+ \@app@crop@true
+ \or
+ \@app@crop@false
+ \fi}
+\DeclareOptionX{on}[]{\@app@off@false}
+\DeclareOptionX{ext}{\def\app@ext{#1}}
+\DeclareOptionX{latex}{%
+ \def\app@latex@opts{%
+ \ifwindows
+ -disable-write18
+ \else
+ -no-shell-escape
+ \fi
+ -jobname="\app@jobname"
+ -interaction=batchmode
+ #1}}
+\DeclareOptionX{dvips}{\def\app@dvips@opts{#1}}
+\DeclareOptionX{pspdf}{\def\app@pspdf@opts{#1}}
\def\app@pdfcrop@opts{--hres}%%% hv 20130405
-\@ifclassloaded{beamer}{\ifpdf\else\setbeamertemplate{navigation symbols}\fi}{}%
+\DeclareOptionX{pdfcrop}{\def\app@pdfcrop@opts{#1}}
+
+\DeclareOptionX{cleanup}{%
+ \let\app@rm@files\@empty
+ \@for\@ii:=#1\do{%
+ \edef\app@rm@files{\app@rm@files,\app@jobname.\@ii}}}
+
+\DeclareOptionX{runs}{%
+ \setcounter{app@runs}{#1}% support calc
+ \ifnum\c@app@runs > \z@
+ \else
+ \app@PackageWarning{The number of runs must be at least one.}%
+ \c@app@runs\@ne
+ \fi}
+
+\DeclareOptionX*{%
+ \PassOptionsToPackage{prologue}{xcolor}% to get named colors into the ps file
+ \PassOptionsToPackage\CurrentOption{pstricks}%
+ \PassOptionsToPackage\CurrentOption{pst-pdf}%
+}
+
+\ExecuteOptionsX{%
+ ext=tex,
+ crop=on,
+ latex={},
+ dvips={-Ppdf},
+ pdfcrop={},
+ cleanup={log,aux,dvi,ps,pdf},
+ runs=1
+}
+\ifwindows
+ \ExecuteOptionsX{pspdf={}}
+\else
+ \ExecuteOptionsX{pspdf={-dAutoRotatePages=/None}}
+\fi
+%
+\ProcessOptionsX\relax
+%
+\ifxetex\@app@off@true\fi
+%
+\def\app@nl{^^J\space\space\space\space}
+\newcommand\app@PackageError[2]{\PackageError{pstricks-pdf}{\app@nl #1^^J}{#2}}
+\newcommand\app@PackageWarning[1]{%
+ \PackageWarning{pstricks-pdf}{\app@nl #1^^JThis warning occured}}
+\newcommand\app@PackageInfo[1]{\PackageInfo{pstricks-pdf}{#1}}
+\newcommand\OnlyIfFileExists[2]{\IfFileExists{#1}{#2}{}}
+\newcommand\NotIfFileExists[2]{\IfFileExists{#1}{}{#2}}
+\def\app@convert#1#2#3{%
+ \OnlyIfFileExists{#2}{%
+% \expandafter\typeout\expandafter{\csname app@cmd@#1\endcsname}%
+ \typeout{filenameIN: #2}%
+ \typeout{filenameOUT: #3}%
+ \ShellEscape{\csname app@cmd@#1\endcsname{#2}{#3}}%
+ \NotIfFileExists{#3}{\app@PackageWarning{Creation of #3 failed.}}}}
+\def\app@compile{%
+ \app@cleanup
+ \app@remove@container
+ \loop\ifnum\c@app@runs > \@ne
+ \app@convert{extralatex}{\jobname.\app@ext}{}%
+ \advance\c@app@runs\m@ne
+ \repeat
+ \app@convert{latex}{\jobname.\app@ext}{}%
+ \app@convert{dvips}{\app@jobname.dvi}{\app@jobname.ps}%
+ \if@app@crop@
+ \app@convert{pstopdf}{\app@jobname.ps}{\app@jobname.pdf}%
+ \app@convert{pdfcrop}{\app@jobname.pdf}{\app@pics}%
+ \else
+ \app@convert{pstopdf}{\app@jobname.ps}{\app@pics}%
+ \fi
+ \IfFileExists{\app@pics}
+ {\app@cleanup}
+ {\app@PackageWarning{Could not create \app@pics.
+ Auxiliary files not deleted.}}}
+\edef\app@rm{\ifwindows del \else rm -- \fi}
+\newcommand\app@try@rm[1]{%
+ \@for\@tempa:=#1\do{%
+ \OnlyIfFileExists{\@tempa}{\ShellEscape{\app@rm "\@tempa"}}}}
+\def\app@remove@container{\app@try@rm{\app@pics}}
+\def\app@cleanup{\app@try@rm{\app@rm@files}}
+\ifluatex
+ \def\app@cmd@latex#1#2{lualatex --output-format=dvi \app@latex@opts\space "\unexpanded{\let\APPmakepictures\empty\input} #1"}
+ \def\app@cmd@extralatex#1#2{lualatex --output-format=dvi \app@latex@opts\space "\unexpanded{\let\APPmakepictures\undefined\input} #1"}
+\else
+ \def\app@cmd@latex#1#2{latex \app@latex@opts\space "\unexpanded{\let\APPmakepictures\empty\input} #1"}
+ \def\app@cmd@extralatex#1#2{\@app@prog\space \app@latex@opts\space "\unexpanded{\let\APPmakepictures\undefined\input} #1"}
+\fi
+\def\app@cmd@dvips#1#2{dvips \app@dvips@opts\space -o "#2" "#1"}
+\def\app@cmd@pstopdf#1#2{ps2pdf \app@pspdf@opts\space "#1" "#2"}
+\def\app@cmd@pdfcrop#1#2{pdfcrop \app@pdfcrop@opts\space "#1" "#2"}
+\ifpdf
+ \if@app@off@\else
+ \ShellEscape{echo " "}
+ \ShellEscape{echo "-------------------------------------------------"}
+ \ShellEscape{echo "pstricks-pdf: Auxiliary LaTeX compilation"}
+ \ShellEscape{echo "-------------------------------------------------"}
+ \app@compile
+ \ShellEscape{echo "-------------------------------------------------"}
+ \ShellEscape{echo "pstricks-pdf: End auxiliary LaTeX compilation"}
+ \ShellEscape{echo "-------------------------------------------------"}
+ \fi
+ \if@app@crop@
+ \PassOptionsToPackage{notightpage}{pst-pdf}
+ \fi
+\else
+ \ifx\APPmakepictures\@undefined
+ \PassOptionsToPackage{inactive}{pst-pdf}
+ \else
+ \if@app@crop@
+ \PassOptionsToPackage{notightpage}{pst-pdf}
+ \fi
+ \fi
+\fi
+\RequirePackage{pst-pdf}
\RequirePackage{pstricks}
+\@ifclassloaded{beamer}{\setbeamertemplate{navigation symbols}}{}%
+%
+\let\app@ig\includegraphics
%
%%
%% End of file `pstricks-pdf.sty'.