%%
%% This is file `pst-pdf.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% pst-pdf.dtx  (with options: `package')
%% 
%% This is a generated file.
%% 
%% Copyright (C) 2004--2008 by Rolf Niepraschk <Rolf.Niepraschk@gmx.de>
%%                            and Hubert Gaesslein
%%               2008--      Rolf Niepraschk <Rolf.Niepraschk@gmx.de>
%% 
%% This file may be distributed and/or modified under the conditions of
%% the LaTeX Project Public License, either version 1.2 of this license
%% or (at your option) any later version.  The latest version of this
%% license is in:
%% 
%%    http://www.latex-project.org/lppl.txt
%% 
%% and version 1.2 or later is part of all distributions of LaTeX version
%% 1999/12/01 or later.
%% 
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{pst-pdf}
    [2020/10/10 v1.2f PS graphics for pdfLaTeX (RN,HjG)]
\newcommand*\ppf@TeX@mode{-1}
\newcommand*\ppf@draft{false}
\newif\if@ppf@PST@used\@ppf@PST@usedtrue
\newif\if@ppf@tightpage \@ppf@tightpagetrue
\DeclareOption{active}{\OptionNotUsed}
\DeclareOption{inactive}{\def\ppf@TeX@mode{9}}
\DeclareOption{ignore}{\def\ppf@TeX@mode{999}}
\DeclareOption{pstricks}{\@ppf@PST@usedtrue}
\DeclareOption{nopstricks}{\@ppf@PST@usedfalse}
\DeclareOption{displaymath}{%
  \PassOptionsToPackage\CurrentOption{preview}}
\DeclareOption{draft}{\def\ppf@draft{true}}
\DeclareOption{final}{\def\ppf@draft{false}%
  \PassOptionsToPackage\CurrentOption{graphicx}}
\DeclareOption{notightpage}{\@ppf@tightpagefalse}%
\DeclareOption{tightpage}{\@ppf@tightpagetrue}%
\DeclareOption*{%
  \PassOptionsToPackage\CurrentOption{pstricks}}
\ProcessOptions\relax
\ifnum\ppf@TeX@mode=999\relax\expandafter\endinput\fi
\RequirePackage{ifpdf,ifxetex,ifvtex}
\ifnum\ppf@TeX@mode=-1\relax
  \ifpdf
    \def\ppf@TeX@mode{1}%
    \RequirePackage{luatex85}%
  \else
    \ifvtex
      \def\ppf@TeX@mode{9}%
    \else
      \ifxetex
        \def\ppf@TeX@mode{9}%
      \else
        \def\ppf@TeX@mode{0}%
      \fi
    \fi
  \fi
\fi
\newcommand*\PDFcontainer{}
\edef\PDFcontainer{\jobname-pics.pdf}
\newcounter{pspicture}
\newcommand*\ppf@other@extensions[1]{}
\newcommand*\usepicture[2][]{}
\newcommand*\savepicture[1]{}
\newenvironment*{pst-pdf-defs}{%
  \endgroup
}{%
  \begingroup
  \def\@currenvir{pst-pdf-defs}%
}
\RequirePackage{graphicx}[2017/06/01]%
\let\ppf@Ginclude@graphics\Ginclude@graphics
\let\ppf@Gin@extensions\Gin@extensions
\let\ppf@Gin@ii\Gin@ii
\newif\if@ppf@pdftex@graphic
\newif\ifGin@frame\Gin@framefalse
\newif\ifGin@innerframe\Gin@innerframefalse
\newif\ifGin@showname\Gin@shownamefalse
\newif\ifGin@ignore\Gin@ignorefalse
\newif\ifpr@outer
\newcommand*\ppf@is@pdfTeX@graphic[5]{%
  \@ppf@pdftex@graphicfalse%
  \begingroup
    \edef\pdfTeXext{,#2,}%
    \edef\pdfTeXext{\detokenize\expandafter{\pdfTeXext}}%
    \def\Gin@setfile##1##2##3{%
      \edef\@tempa{,##2,}%
      \@expandtwoargs\in@{\detokenize\expandafter{\@tempa}}{\pdfTeXext}%
      \ifin@\global\@ppf@pdftex@graphictrue\fi}%
    \edef\Gin@extensions{#2,#3}%
    \pr@outerfalse\ppf@Ginclude@graphics{#1}%
  \endgroup
  \if@ppf@pdftex@graphic#4\else#5\fi
}
\ifcase\ppf@TeX@mode\relax
  \PackageInfo{pst-pdf}{%
    MODE: \ppf@TeX@mode\space (dvi -- extraction mode)}%
  \nofiles
  \let\makeindex\@empty \let\makeglossary\@empty \let\printindex\@empty
  \renewcommand*\makeindex[1][]{}%
  \renewcommand*\makeglossary[1][]{}%
  \renewcommand*\printindex[1][]{}%
  \AtBeginDocument{\overfullrule=\z@}%
  \if@ppf@PST@used\RequirePackage{pstricks}\fi
  \RequirePackage[active,dvips,tightpage]{preview}[2005/01/29]%
  \newcommand*\ppf@PreviewBbAdjust{}%
  \newcommand*\ppf@RestoreBbAdjust{%
    \let\PreviewBbAdjust\ppf@PreviewBbAdjust}%
  \def\ppf@other@extensions{%
    .pdf,.png,.jpg,.mps,.jpeg,.jbig2,.jb2,%
    .PDF,.PNG,.JPG,.JPEG,.JBIG2,.JB2%
  }
  \AtBeginDocument{%
    \@ifpackageloaded{keyval}{%
      \def\KV@errx#1{\PackageInfo{keyval}{#1}}%
      }{}%
    \@ifpackageloaded{xkeyval}{%
      \def\XKV@err#1{\PackageInfo{xkeyval}{#1}}%
    }{}%
    \@for\@tempa:=\ppf@other@extensions\do{%
      \expandafter\let\csname Gin@rule@\@tempa\endcsname\relax}%
    \DeclareGraphicsRule{*}{eps}{*}{}}%
  \define@key{Gin}{innerframe}[true]{}%
  \define@key{Gin}{frame}[true]{}%
  \define@key{Gin}{ignore}[true]{}%
  \define@key{Gin}{showname}[true]{}%
  \define@key{Gin}{namefont}{}%
  \@ifundefined{Gin@page}{\define@key{Gin}{page}{}}{}%
  \if@ppf@tightpage\else
    \def\PreviewBbAdjust{%
      -600pt -600pt 600pt 600pt}%
    \AtEndDocument{%
      \PackageWarningNoLine{pst-pdf}{Picture container needs cropping.}}%
  \fi
  \newenvironment{postscript}[1][]%
  {%
    \global\let\ppf@PreviewBbAdjust\PreviewBbAdjust
    \if@ppf@tightpage
      \begingroup
        \setkeys{Gin}{#1}%
        \xdef\PreviewBbAdjust{%
          -\Gin@vllx bp -\Gin@vlly bp \Gin@vurx bp \Gin@vury bp}%
      \endgroup
    \fi
    \ignorespaces
  }%
  {\aftergroup\ppf@RestoreBbAdjust}%
  \PreviewEnvironment{postscript}%
  \AtBeginDocument{%
    \@ifundefined{PSTricksLoaded}{}%
    {%
      \PreviewEnvironment{pspicture}%
      \@ifundefined{psmatrix}{}%
      {%
        \PreviewEnvironment{psmatrix}%
        \newcommand*\ppf@set@mode{}%
        \newcommand*\ppf@test@mmode{%
        \ifmmode
          \ifinner
            \let\ppf@set@mode=$%
          \else
            \def\ppf@set@mode{$$}%
          \fi
        \else
          \let\ppf@set@mode=\@empty
        \fi
        }%
        \let\ppf@psmatrix=\psmatrix
        \expandafter\let\expandafter\ppf@pr@psmatrix%
          \expandafter=\csname pr@\string\psmatrix\endcsname
        \let\ppf@endpsmatrix=\endpsmatrix
        \def\psmatrix{\ppf@test@mmode\ppf@psmatrix}%
        \expandafter\def\csname pr@\string\psmatrix\endcsname{%
          \ppf@set@mode\ppf@pr@psmatrix}%
        \def\endpsmatrix{\ppf@endpsmatrix\ppf@set@mode}%
      }%
      \PreviewMacro[{{}*[]%
        ?\bgroup{#{#1}{{#1}}}{}%
        ?\bgroup{#{#1}{{#1}}}{}%
        ?({#{(#1)}{({#1})}}{}%
        ?({#{(#1)}{({#1})}}{}%
        ?({#{(#1)}{({#1})}}{}%
        }]{\pst@object}}%
    \@ifundefined{tabularx}{}{%
      \newcolumntype{X}{c}%
      \expandafter\let\expandafter\tabularx\csname tabular*\endcsname
      \expandafter\let\expandafter\endtabularx\csname endtabular*\endcsname
    }%
    \@ifundefined{pfx@includegraphicx}{}{%
      \PreviewMacro[{{}{}}]{\pfx@includegraphicx}}%
  }%
  \def\Gscale@@box#1#2#3{%
    \toks@{\mbox}%
  }%
  \def\Ginclude@graphics#1{%
    \ifpr@outer
      \ppf@is@pdfTeX@graphic{#1}{\ppf@other@extensions}{\Gin@extensions}%
      {\rule{10pt}{10pt}}%
      {\ppf@Ginclude@graphics{#1}}%
    \else
      \ppf@Ginclude@graphics{#1}%
    \fi
  }%
  \PreviewMacro[{{}}]{\ppf@Ginclude@graphics}%
  \let\pdfliteral\@gobble%
\or
  \PackageInfo{pst-pdf}{MODE: \ppf@TeX@mode\space (pdfTeX mode)}%
  \if@ppf@PST@used
    \let\ppf@temp\AtBeginDvi\let\AtBeginDvi\@gobble
    \def\c@lor@to@ps#1 #2\@@{}%
    \RequirePackage{pstricks}\let\AtBeginDvi\ppf@temp
  \fi
  \@temptokena{%
    \let\Gin@PS@file@header\@gobble\let\Gin@PS@literal@header\@gobble
    \let\Gin@PS@raw\@gobble\let\Gin@PS@restored\@gobble
    \@ifundefined{PSTricksLoaded}{}{%
      \PSTricksOff%
      \def\c@lor@to@ps#1 #2\@@{}%
    }%
  }%
  \the\@temptokena%
  \expandafter\AtBeginDocument\expandafter
    {\the\@temptokena\@temptokena{}}%
  \@ifundefined{PSTricksLoaded}{}{%
    \newtoks\ppf@output
    \ppf@output\expandafter{\the\output}%
    \let\ppf@nofiles=\nofiles \let\nofiles=\relax
    \let\ppf@shipout=\shipout
    \RequirePackage[active]{preview}[2005/01/29]%
    \let\shipout=\ppf@shipout \let\ppf@shipout=\relax
    \let\nofiles=\ppf@nofiles \let\ppf@nofiles=\relax
    \output\expandafter{\the\ppf@output} \ppf@output{}%
    \long\def\pr@startbox#1#2{%
      \ifpr@outer
        \toks@{#2}%
        \edef\pr@cleanup{\the\toks@}%
        \setbox\@tempboxa\vbox\bgroup
        \everydisplay{}%
        \pr@outerfalse%
        \expandafter\@firstofone
      \else
        \expandafter\@gobble
      \fi{#1}}%
    \def\pr@endbox{%
      \egroup
      \setbox\@tempboxa\box\voidb@x
      \ppf@@getpicture
      \pr@cleanup}%
    \AtBeginDocument{%
      \@ifundefined{pst@object}{}%
      {%
        \PreviewMacro[{{}*[]%
          ?\bgroup{#{#1}{{#1}}}{}%
          ?\bgroup{#{#1}{{#1}}}{}%
          ?({#{(#1)}{({#1})}}{}%
          ?({#{(#1)}{({#1})}}{}%
          ?({#{(#1)}{({#1})}}{}%
          }]{\pst@object}}%
      }%
    }%
  \def\ppf@other@extensions{.eps,.ps,.eps.gz,.ps.gz,.eps.Z,.mps}%
  \DeclareGraphicsRule{*}{eps}{*}{}%
  \define@key{Gin}{innerframe}[true]{%
    \lowercase{\Gin@boolkey{#1}}{innerframe}}%
  \define@key{Gin}{frame}[true]{%
    \lowercase{\Gin@boolkey{#1}}{frame}}%
  \define@key{Gin}{ignore}[true]{%
    \lowercase{\Gin@boolkey{#1}}{ignore}}%
  \define@key{Gin}{frame@@}{%
    \edef\@tempa{\toks@{\noexpand\frame{\the\toks@}}}%
    \ifcase#1\relax
      \ifGin@innerframe\else\let\@tempa\relax\fi
    \or
      \ifGin@frame\else\let\@tempa\relax\fi
    \fi
    \@tempa%
  }%
  \define@key{Gin}{showname}[true]{%
    \lowercase{\Gin@boolkey{#1}}{showname}}%
  \define@key{Gin}{namefont}{%
    \begingroup
      \@temptokena\expandafter{\ppf@namefont#1}%
      \edef\x{\endgroup\def\noexpand\ppf@namefont{\the\@temptokena}}%
    \x%
  }%
  \newcommand*\ppf@filename{}%
  \newcommand*\ppf@namefont{\tiny\ttfamily}%
  \newcommand*\ppf@Gin@keys{}%
  \let\ppf@Gin@setfile\Gin@setfile
  \def\Gin@setfile#1#2#3{\ppf@Gin@setfile{#1}{#2}{#3}%
    \xdef\ppf@filename{%
      #3\ifx\Gin@page\@empty\else(\Gin@page)\fi}}%
  \def\Gin@ii[#1]#2{%
    \begingroup
      \@temptokena{#1}\def\ppf@tempb{#2}%
      \ifx\ppf@tempb\@empty\else
        \ppf@is@pdfTeX@graphic{#2}{\Gin@extensions}{\ppf@other@extensions}%
        {%
          \setkeys{Gin}{#1}%
          \ifx\ppf@tempb\PDFcontainer
            \@temptokena{page=\Gin@page}%
          \fi
        }%
        {%
          \refstepcounter{pspicture}%
          \@temptokena{page=\the\c@pspicture}\def\ppf@tempb{\PDFcontainer}%
        }%
      \fi
      \ifGin@ignore\else
        \edef\@tempa{\noexpand\ppf@Gin@ii[frame@@=0,\the\@temptokena,%
          frame@@=1]{\ppf@tempb}}%
        \@tempa%
        \ifGin@showname
          \ppf@namefont%
          \raisebox{-\ht\strutbox}[0pt][0pt]{\llap{\ppf@filename}}%
          \gdef\ppf@filename{}%
        \fi
      \fi
    \endgroup
  }%
  \IfFileExists{\PDFcontainer}%
  {%
    \pdfximage{\PDFcontainer}%
    \edef\ppf@container@max{\the\pdflastximagepages}%
    \AtEndDocument{%
      \ifnum\c@pspicture>\z@
        \ifnum\c@pspicture=\ppf@container@max\else
          \PackageWarningNoLine{pst-pdf}{%
            `\PDFcontainer' contains \ppf@container@max\space pages
            \MessageBreak but \the\c@pspicture\space pages are requested:
            \MessageBreak File `\PDFcontainer' is no more valid!
            \MessageBreak Recreate it
          }%
        \fi
      \fi
    }%
  }%
  {%
    \def\ppf@container@max{0}%
    \AtEndDocument{%
      \ifnum\c@pspicture>\z@
        \filename@parse{\PDFcontainer}%
        \PackageWarningNoLine{pst-pdf}{%
          File `\PDFcontainer' not found. \MessageBreak
          Use the following commands to create it: \MessageBreak
          ----------------------------------------------------
          \MessageBreak
          latex \jobname.tex\MessageBreak
          dvips -o \filename@base.ps \jobname.dvi\MessageBreak
          ps2pdf \filename@base.ps\MessageBreak
          ----------------------------------------------------
        }%
      \fi
    }%
  }%
  \newcommand\ppf@isnum[1]{%
    \if!\ifnum9<1#1!\else_\fi\expandafter\@firstoftwo
    \else\expandafter\@secondoftwo\fi}%
  \newcommand*\ppf@set@mode{}%
  \newcommand*\ppf@test@mmode{%
  \ifmmode
    \ifinner
      \let\ppf@set@mode=$%
    \else
      \def\ppf@set@mode{$$}%
    \fi
  \else
    \let\ppf@set@mode=\@empty
  \fi
  }
  \RequirePackage{environ}%
  \newenvironment{postscript}[1][]{%
    \def\@tempa{postscript}%
    \ifx\@tempa\@currenvir
      \def\ppf@Gin@keys{#1}%
    \else
      \def\ppf@Gin@keys{}%
    \fi
    \ppf@@getpicture%
    \Collect@Body\@gobble}{}%
  \AtBeginDocument{%
    \@ifundefined{PSTricksLoaded}{}{%
      \def\pst@@@picture[#1](#2,#3)(#4,#5){\postscript}%
      \def\endpspicture{\endpostscript\endgroup}%
      \@ifundefined{psmatrix}{}{%
        \let\psmatrix=\postscript
        \let\endpsmatrix=\endpostscript}%
    }%
    \@ifundefined{pfx@includegraphicx}{}{%
      \let\includegraphics=\pfx@includegraphics
      \def\pfx@includegraphicx#1#2{\ppf@@getpicture}%
    }%
  }%
  \def\savepicture#1{%
    \expandafter\xdef\csname ppf@@@#1\endcsname{\the\pdflastximage}}%
  \renewcommand*\usepicture[2][]{%
    \@ifundefined{ppf@@@#2}%
    {%
      \ppf@isnum{#2}%
      {\ppf@getpicture{#1}{#2}}%
      {\@latex@error{picture `#2' undefined}\@ehc}%
    }%
    {%
      \begingroup
        \def\Ginclude@graphics##1{%
          \xdef\ppf@filename{#2}%
          \setbox\z@\hbox{\pdfrefximage\@nameuse{ppf@@@#2}}%
          \Gin@nat@height\ht\z@ \Gin@nat@width\wd\z@
          \def\Gin@llx{0}\let\Gin@lly\Gin@llx
          \Gin@defaultbp\Gin@urx{\Gin@nat@width}%
          \Gin@defaultbp\Gin@ury{\Gin@nat@height}%
          \Gin@bboxtrue\Gin@viewport@code%
          \Gin@nat@height\Gin@ury bp%
          \advance\Gin@nat@height-\Gin@lly bp%
          \Gin@nat@width\Gin@urx bp%
          \advance\Gin@nat@width-\Gin@llx bp%
          \Gin@req@sizes%
          \ht\z@\Gin@req@height \wd\z@\Gin@req@width
          \leavevmode\box\z@}%
        \define@key{Gin}{type}{}%
        \includegraphics[scale=1,#1]{}%
      \endgroup
    }}%
  \newcommand*\ppf@getpicture[2]{%
    \@tempcnta=#2\relax%
    \ifnum\@tempcnta>\ppf@container@max
      \PackageWarningNoLine{pst-pdf}{%
        pspicture No. \the\@tempcnta\space undefined}%
    \else
      \includegraphics[draft=\ppf@draft,#1,page=\the\@tempcnta]%
        {\PDFcontainer}%
    \fi
    \gdef\ppf@Gin@keys{}}%
  \newcommand*\ppf@@getpicture{%
    \ifpr@outer
      \refstepcounter{pspicture}%
      \expandafter\ppf@getpicture\expandafter{\ppf@Gin@keys}%
      {\the\c@pspicture}%
    \fi}%
  \renewenvironment*{pst-pdf-defs}%
  {%
    \endgroup
    \chardef\ppf@temp=\catcode`\&%
    \@makeother\&%
  }{%
    \catcode`\&=\ppf@temp
    \begingroup
    \def\@currenvir{pst-pdf-defs}%
  }
\else
  \PackageInfo{pst-pdf}{MODE: \ppf@TeX@mode\space (inactive mode)}%
  \newenvironment{postscript}[1][]{\ignorespaces}{}%
  \let\ppf@is@pdfTeX@graphic\relax
\fi
\InputIfFileExists{pst-pdf.cfg}{%
  \PackageInfo{pst-pdf}{Local config file pst-pdf.cfg used}}{}%
\endinput
%%
%% End of file `pst-pdf.sty'.
