summaryrefslogtreecommitdiff
path: root/graphics/pdftricks2
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /graphics/pdftricks2
Initial commit
Diffstat (limited to 'graphics/pdftricks2')
-rw-r--r--graphics/pdftricks2/README5
-rw-r--r--graphics/pdftricks2/pdftricks2-doc.pdfbin0 -> 69719 bytes
-rw-r--r--graphics/pdftricks2/pdftricks2-doc.tex91
-rw-r--r--graphics/pdftricks2/pdftricks2.sty620
4 files changed, 716 insertions, 0 deletions
diff --git a/graphics/pdftricks2/README b/graphics/pdftricks2/README
new file mode 100644
index 0000000000..c2eea275d4
--- /dev/null
+++ b/graphics/pdftricks2/README
@@ -0,0 +1,5 @@
+Pdftricks2
+
+A LaTeX package to use PSTricks code with PDF output.
+
+For comments and bug-reports contact ChrReibiger{at}operamail.com. \ No newline at end of file
diff --git a/graphics/pdftricks2/pdftricks2-doc.pdf b/graphics/pdftricks2/pdftricks2-doc.pdf
new file mode 100644
index 0000000000..44fb630f78
--- /dev/null
+++ b/graphics/pdftricks2/pdftricks2-doc.pdf
Binary files differ
diff --git a/graphics/pdftricks2/pdftricks2-doc.tex b/graphics/pdftricks2/pdftricks2-doc.tex
new file mode 100644
index 0000000000..e8d7118bb4
--- /dev/null
+++ b/graphics/pdftricks2/pdftricks2-doc.tex
@@ -0,0 +1,91 @@
+\documentclass{scrartcl}
+
+\usepackage[left=2.35cm,right=2.35cm]{geometry}
+\setlength{\marginparwidth}{0pt}
+\setlength{\marginparsep}{0pt}
+\usepackage{marvosym}
+\reversemarginpar
+
+\usepackage{expdlist}
+\usepackage[english]{babel}
+\usepackage{hyperref}
+
+\newcommand\prob{\marginpar{\hbox to 0pt{\Lightning\hss}}}
+\makeatletter
+\edef\lbr{\expandafter\@gobble\string\{}
+\edef\rbr{\expandafter\@gobble\string\}}
+\makeatother
+
+\begin{document}
+
+\title{The pdftricks2 package}
+\author{Christian Reibiger\\inspired by the pdftricks package}
+
+\maketitle
+
+\tableofcontents
+
+\section{Introduction}
+
+This package provides automatization facilities to use the pstricks package with \emph{pdflatex}. It is intended to be of easy use and interoperability with \emph{latex} and \emph{pdflatex}, namely both show the same result. To use this package you only have to say \verb@\usepackage{pdftricks2}@ instead of \verb@\usepackage{pstricks}@.
+
+The pdftricks2 package circumvents the problem that \emph{pdflatex} can not handle \emph{ps}-code by writing an extra \emph{latex} file that contains only the figure. This files are converted to dvi to ps and then to pdf. Finally the resulting pdf-pictures are included in the text as a graphic. This process can be handled automatically by the package but it needs to have the possibility to execute system commands (start \emph{pdflatex} with option \texttt{--enable-write18} or \texttt{-shell-escape}). If you do not want to grant this rights you still can use the package but you have to execute a shell script the package writes yourself to produce the pdf-pictures. In this case you have to run \textit{pdftex} again to include the pictures in your document.
+
+The package tries to show the same results when used with \textit{latex} as for \textit{psflatex}. However there are some side effects of using this package as described below. Lightnings (\Lightning) on the margin of the page mark parts where changes to pstricks syntax or important flaws are stated.
+
+Although this package is inspired by the pdftricks package, it is coded from scratch. The pdftricks package has some flaws that are circumvented by pdftricks2. For example you have to gather all configurations you need for your pictures in one place. Furthermore it is not possible to share configuration code between your figures and the main text. Also the pdftricks package does not use the provided limits of the figure you produce but rather assumes it fits on a standard page and cuts everything away that does not look like being important.
+
+\section{Installation}
+
+Just copy the file `pdftricks2.sty' to your tex directory (for example `\textasciitilde/texmf/tex/latex/pdftricks2' on a linux or `C:\textbackslash Programs\textbackslash MikTeX\textbackslash tex\textbackslash latex\textbackslash pdftricks2' on a windows system). After that you have to update \LaTeX's hash table by invoking `texhash' on a linux system or by executing `Start \frqq{} Programs \frqq{} MikTeX \frqq{} Maintenance \frqq{} Settings, General \frqq{} Refresh FNDB' on a windows system.
+
+\section{Usage}
+
+\begin{description}[\breaklabel]
+\item[\tt \string\usepackage\lbr pdftricks2\rbr]
+ To use this package you have to load it via \verb@\usepackage{pdftricks2}@. The package loads automatically the pstricks package, so there is no need to say \verb@\usepackage{pstricks}@. All options you pass to pdftricks2 that are not recognized are passed to pstricks. So you can give the pstricks options just to the pdftricks2 package.
+
+\item[\tt \string\usepackageps, \string\usepackagepsonly]
+ After loading the pdftricks2 package you can load a \textsl{package} you want to use for your text and your figures by saying \verb@\usepackageps{@\textsl{package}\verb@}@. Also you have the possibility to load packages only for the figures and not in your other text by saying \prob\verb@\usepackagepsonly{@\textsl{pack\-age}\verb@}@ but this may have side effects if you use pdftricks2 with \emph{latex} because they get included in the text as well.
+
+\item[\tt \string\psset, \string\newpsstyle, \string\addtopsstyle, \string\degrees, \string\radians, \string\SpecialCoor]
+ Also you can use the pstricks commands that change the configuration of drawing outside of a \texttt{pspicture}-environment. But you must be aware \prob that their effect is always global. Inside of \texttt{pspicture}-environments the commands stated above obey the usual grouping rules.
+
+\item[\tt \string\configps, configpsblock]
+ In addition to this commands there are new ones to share definitions between your text and the figures. They are intended to be used for custom commands you want to use in text and in figures. The command \verb@\configps{@\textsl{code}\verb@}@ executes the given \textsl{code} in the text and in every figure. The same is true for the \textsl{code} in \verb@\begin{configpsblock}@\textsl{code}\verb@\end{configps@\-\verb@block}@ but this second version is better for a large amount of code.
+
+\item[\tt \string\configpsonly, configpsonlyblock]
+ As in case of package loading these commands provide the possibility to include some \textsl{code} only in the figures. They are used the same way as \verb@\configps@ and \verb@configpsblock@
+
+\item[\tt pspicture]
+ A \verb@pspicture@-environment can be started as usual by saying \verb@\begin{pspicture}@. This is fine if you keep your drawing inside the picture. However, you should say \verb@\begin{pspic@\-\verb@ture*}@ to clip your drawing to the box of the \texttt{pspicture}. Keep in mind that \emph{pdflatex} will clip your drawing anyway. Therefore the use of the \texttt{pspicture} is discouraged and pdftricks2 will warn you when you use it. For technical reasons it is not possible to \prob continue your \LaTeX{} code right after \verb@\end{pspicture*}@, instead you have to end the line there. If you do not want to have a space after your \verb@pspicture@-environment you can end the line with a comment. In contrast to the current pstricks implementation you can not use the \prob\texttt{shift} attribute to produce a \texttt{pspicture} that is not aligned by its lower border. Instead you have to use the old pstricks syntax \verb@\begin{pspicture*}[@\textsl{a}\verb@]@ to produce a \texttt{pspicture} that's baseline is at the \textsl{a}-th part of its vertical size. Therefore it is not possible to slip configuration commands for pstricks in the optional argument of the \texttt{pspicture}-environment.
+\end{description}
+
+\section{Package options}
+
+In the following the options that are processed by the pdftricks2 package are stated. All other options you provide are passed to the pstricks package.
+
+\begin{description}[\breaklabel]
+\item[\tt info]
+ When this option is set pdftricks2 prints out additional information via package warnings. Especially it shows what files it will use and when it opens and closes them.
+
+\item[\tt shell, noshell]
+ This options control whether the package tries to execute system commands for translating the figures itself or not. The default is to use the shell if possible. When no shell is used pdftricks2 writes a script that handles the translation of the figures. You just have to execute it as will be described in a package warning.
+
+\item[\tt windows, unix]
+ For some system commands it is necessary to distinguish between windows and unix systems. The package tries to guess the system you have by using the ifplatform package. However, you can disable the automatic detection by giving the platform explicitly. This is mainly intended to be used if problems occur.
+
+\item[\tt figpath=\textsl{path}]
+ Normally pdftricks2 creates the additional files it needs in the same directory as the one you run \emph{pdflatex} from. This may be a bit messy. Therefore you can give an alternate \textsl{path} where the temporary files are stored. But this \textsl{path} has to exist. The path you can choose has to be given in unix style (it is converted to windows style internally if needed) and must meet the requirements for paths imposed by \LaTeX.
+
+\item[\tt scriptpaths, noscriptpaths]
+ This options enable you to control whether pdftricks2 writes the \textsl{path} given via \texttt{figpath} to the script and figure files or whether it omits them when writing these files. By default the paths are written to the files which is necessary if the translation is handled by the package itself. However, if you translate them by hand it might be useful to omit the paths.
+\end{description}
+
+\section{Changelog}
+
+\subsection{Version 1.01}
+
+Fixed the commands \texttt{\string\usepackageps} and \texttt{\string\usepackagepsonly}.
+
+\end{document} \ No newline at end of file
diff --git a/graphics/pdftricks2/pdftricks2.sty b/graphics/pdftricks2/pdftricks2.sty
new file mode 100644
index 0000000000..c30a0528bc
--- /dev/null
+++ b/graphics/pdftricks2/pdftricks2.sty
@@ -0,0 +1,620 @@
+%
+% pdftricks2.sty
+%
+% Copyright (c) 2012, Christian Reibiger
+%
+% 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 (gpl.txt); if not, write to the Free
+% Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+% MA 02111-1307, USA.
+%
+% This package is motivated by the pdftricks package
+%
+
+\NeedsTeXFormat{LaTeX2e}
+\def\Fileversion$#1: #2 ${\gdef\fileversion{#2}}
+\def\Filedate$#1: #2 #3 ${\gdef\filedate{#2}}
+\Fileversion$Revision: 1.01 $
+\Filedate$Date: 2013/06/7 16:05:15 $
+\ProvidesPackage{pdftricks2}[\filedate\space\fileversion\space psTricks support in PDF]
+
+\newif\if@additionalInfo\@additionalInfofalse
+\newif\if@autotranslate\@autotranslatetrue
+\newif\if@iswin\@iswinfalse
+\newif\if@sysdetect\@sysdetecttrue
+\newif\if@scriptpaths\@scriptpathstrue
+\newcount\ps@figno
+\ps@figno=1
+\def\processfp figpath=#1,{\def\PdfT@tmpDir{#1}}
+\processfp figpath=.,
+\newwrite\psconfigs@out
+\newif\ifconfigout@open\configout@openfalse
+\let\pst@args\@gobble
+
+\def\PdfTInfo#1{\if@additionalInfo\PackageWarning{pdftricks2}{%
+ ************************************INFO\MessageBreak%
+ #1\MessageBreak%
+ ****************************************}\fi}
+\def\PdfTInfoNoLine#1{\if@additionalInfo\PackageWarningNoLine{pdftricks2}{%
+ ************************************INFO\MessageBreak%
+ #1\MessageBreak%
+ ****************************************}\fi}
+
+\DeclareOption{info}{\@additionalInfotrue} % show additional info
+\DeclareOption{noshell}{\@autotranslatefalse} % don't use w18 to translate transcripted figure files
+\DeclareOption{shell}{\@autotranslatetrue} % use w18 to translate transcripted figure files
+\DeclareOption{windows}{\@iswintrue\@sysdetectfalse} % this is a windows system, disabeling autodetection
+\DeclareOption{unix}{\@iswinfalse\@sysdetectfalse} % this is a unix system, disabeling autodetection
+\DeclareOption{scriptpaths}{\@scriptpathstrue} % write paths to the transcripted figure files and translate script
+\DeclareOption{noscriptpaths}{\@scriptpathsfalse} % ignore paths while writing the transcripted figure files and translate script if using pdf mode without w18
+
+
+\DeclareOption*{{
+ \def\test #1=#2,{\def\cmp{#1}}\def\cmpto{figpath}
+ \expandafter\test\CurrentOption=,
+ \ifx\cmp\cmpto % test if given option is figpath
+ \def\next{\expandafter\processfp\CurrentOption,} % use given figpath
+ \else
+ \PdfTInfoNoLine{Unknown package option `\CurrentOption'.\MessageBreak Pass option to pstricks.}
+ \def\next{\edef\pst@args{\pst@args,\CurrentOption}
+ \PassOptionsToPackage{\CurrentOption}{pstricks}} % pass unused options to pstricks
+ \fi
+ \expandafter}\next}
+
+\ProcessOptions\relax
+
+% initial work of package
+\RequirePackage{pstricks,graphicx,ifpdf,moreverb,ifplatform}
+
+\@ifundefined{verbatim@out}{\newwrite\verbatim@out}{}
+\def\PackageInfoNoLine#1#2{\PackageInfo{#1}{#2\@gobble}}
+\def\PdfT@temporariesName{\PdfT@tmpDir/\jobname}
+\def\PdfT@figName{\PdfT@temporariesName-fig\the\ps@figno}
+\def\PdfT@confName#1{\PdfT@temporariesName-fig\the#1-config}
+\newif\if@figuresnotfound\@figuresnotfoundfalse
+\let\old@verbatim@rescan\verbatim@rescan
+
+{ \def\the#1{\string##}
+ \def\msg{{The used temporary files are\MessageBreak
+ \PdfT@figName.tex,\MessageBreak
+ \PdfT@confName\ps@figno.tex and\MessageBreak
+ \PdfT@temporariesName-special.tex}}
+ \expandafter\PdfTInfoNoLine\msg}
+
+% ignore paths only in pdf mode without w18
+\ifpdf
+ \ifshellescape
+ \@scriptpathstrue
+ \fi
+\else
+ \@scriptpathstrue
+\fi
+
+% detect system if needed
+\if@sysdetect
+ \ifwindows
+ \@iswintrue
+ \else
+ \@iswinfalse
+ \fi
+\fi
+% test for w18 and inform about usage
+\ifpdf
+ \if@autotranslate
+ \ifshellescape
+ \PackageInfoNoLine{pdftricks2}{%
+ ****************************************\MessageBreak
+ Using \csname write\endcsname18 capability \MessageBreak
+ for producing PDF-figures. \MessageBreak
+ ****************************************}
+ \else
+ \PackageWarningNoLine{pdftricks2}{%
+ ****************************************\MessageBreak
+ No \csname write\endcsname18 capability.\MessageBreak
+ You'll have to run a script by yourself!\MessageBreak
+ ****************************************}
+ \@autotranslatefalse
+ \fi
+ \else
+ \PackageInfoNoLine{pdftricks2}{%
+ ****************************************\MessageBreak
+ No \csname write\endcsname18 capability.\MessageBreak
+ You'll have to run a script by yourself!\MessageBreak
+ ****************************************}
+ \fi
+\else
+ \PackageInfoNoLine{pdftricks2}{%
+ ****************************************\MessageBreak
+ No special translation needed.\MessageBreak
+ ****************************************}
+\fi
+
+% needed supporting stuff
+% process a linux style path to produce a windows style path
+\if@iswin
+ \def\process@Dir#1{%
+ \verbatim@startline
+ \expandafter\process@Dir@#1/\@nil}
+%
+ \begingroup % hack from verbatim.sty - in this part every ~ is read as the \ char, nevertheless all definitions are not local
+ \catcode`\~=12
+ \lccode`\~=`\\
+ \lowercase{\endgroup
+ \def\process@Dir@#1/#2{%
+ \ifx\@nil#2
+ \verbatim@addtoline{#1}
+ \let\next\relax
+ \else
+ \verbatim@addtoline{#1~}
+ \def\next{\process@Dir@#2}
+ \fi
+ \next}
+
+ \process@Dir\PdfT@tmpDir
+ \edef\PdfT@temporariesNameW{\the\verbatim@line~\jobname}
+
+ \def\PdfT@figNameW{\PdfT@temporariesNameW-fig\the\ps@figno}
+ }% end of hack
+\fi
+
+% eat an argument group enclosed in {, } verbatim, respect inner grouping with {, }
+\newcount\grouping@depth
+\let\verbgroup@end\relax
+
+\def\verbgroup{% eat one group and process it with \verbatim@processline, after doing so execute \verbgroup@end
+ \begingroup
+ \grouping@depth=0
+ \let\do\@makeother
+ \dospecials
+ \catcode`\^^M=\active \catcode`\^^I=10
+ \catcode`\ =10
+ \verbgroup@start}
+
+\begingroup % hack from verbatim.sty - in this part every [,] is read as the char {,} respectively, nevertheless all definitions are not local
+ \catcode`\[=12 \catcode`\]=12
+ \lccode`\[=`\{ \lccode`\]=`\}
+\lowercase{\endgroup
+%
+ \def\verbgroup@start#1{%
+ \if \noexpand#1[
+ \catcode`\ =12
+ \catcode`\^^I=12
+ \verbatim@startline
+ \let\next\verbgroup@read
+ \else
+ \endgroup
+ \PackageError{pdftricks2}{%
+% \PackageWarning{pdftricks2}{%
+ ****************************************\MessageBreak
+ Expected a \expandafter\@gobble\string\{ to start argument.\MessageBreak
+ ****************************************}{%
+ Expected a \expandafter\@gobble\string\{ to start an argument of a command. But received an other token.}
+ \let\next\relax
+ \fi
+ \next}
+%
+ \def\verbgroup@read#1]{%
+ \verbgroup@read@#1[\@nil}
+%
+ \def\verbgroup@read@#1[#2{
+ \verbatim@addtoline{#1}
+ \ifx #2\@nil % no new group is opend inside
+ \ifnum\grouping@depth=0
+ \verbatim@processline
+ \def\next{\endgroup\verbgroup@end\relax\let\verbgroup@end\relax}
+ \else
+ \advance \grouping@depth by -1
+ \verbatim@addtoline{]}
+ \let\next\verbgroup@read
+ \fi
+ \else
+ \advance \grouping@depth by 1
+ \verbatim@addtoline{[}
+ \def\next{\verbgroup@read@#2}
+ \fi
+ \next}
+} % end of hack
+
+% tools for writing to a pspicture config file
+\def\config@opentested{%
+ \ifconfigout@open\else
+ \PdfTInfo{Opening `\PdfT@confName\ps@figno.tex'.}
+ \immediate\openout\psconfigs@out=\PdfT@confName\ps@figno.tex
+ \global\configout@opentrue
+ \fi}
+
+\def\config@write#1{%
+ \config@opentested
+ \immediate\write\psconfigs@out{#1}}
+
+\def\config@writeNT{\immediate\write\psconfigs@out}
+
+\def\config@finish{%
+ \ifconfigout@open
+ \PdfTInfo{Closing `\PdfT@confName\ps@figno.tex'.}%
+ \global\configout@openfalse
+ \else
+ \PdfTInfo{Creating `\PdfT@confName\ps@figno.tex'.}%
+ \immediate\openout\psconfigs@out=\PdfT@confName\ps@figno.tex
+ \fi
+ \immediate\write\psconfigs@out{\string\endinput}%
+ \immediate\closeout\psconfigs@out}
+
+\AtEndDocument{%
+ \ifconfigout@open
+ \PdfTInfo{Closing `\PdfT@confName\ps@figno.tex'.}
+ \immediate\closeout\psconfigs@out
+ \fi}
+
+% collect ps settings
+\ifpdf
+ \newcommand{\usepackageps}[2][]{% import the package and import it into the transcripted figure files
+ \PassOptionsToPackage{#1}{#2}
+ \RequirePackage{#2}
+ \config@write{\string\usepackage[#1]{#2}}}
+ \newcommand{\usepackagepsonly}[2][]{% import the package only into the transcripted figure files
+ \config@write{\string\usepackage[#1]{#2}}}
+\else
+ % define substitutional behaviour when there is no pdf-mode, intended to show same result
+ \def\usepackageps{\usepackage}
+ \def\usepackagepsonly{\usepackage}
+\fi
+
+\AtBeginDocument{%
+ \let\old@psset\psset
+ \def\psset{% write the config commands to the transcripted config file
+ \def\verbatim@processline{\config@write{\string\psset{\the\verbatim@line}}}
+ \verbgroup}
+%
+ \let\old@newpsstyle\newpsstyle
+ \def\newpsstyle#1{% write the config commands to the transcripted config file
+ \def\verbatim@processline{\config@write{\string\newpsstyle{#1}{\the\verbatim@line}}}
+ \verbgroup}
+%
+ \let\old@addtopsstyle\addtopsstyle
+ \def\addtopsstyle#1{% write the config commands to the transcripted config file
+ \def\verbatim@processline{\config@write{\string\addtopsstyle{#1}{\the\verbatim@line}}}
+ \verbgroup}
+%
+ \let\old@degrees\degrees
+ \def\degrees{\@ifnextchar[{\degrees@I}{\config@write{\string\degrees}}}
+ \def\degrees@I[#1]{\@bsphack\config@write{\string\degrees[#1]}\@esphack}
+%
+ \let\old@radians\radians
+ \def\radians{\config@write{\string\radians}}
+%
+ \let\old@SpecialCoor\SpecialCoor
+ \def\SpecialCoor{\config@write{\string\SpeciaCoor}}}
+
+\def\configps{%
+ \PdfTInfo{Opening `\PdfT@temporariesName-special.tex'.}
+ \immediate\openout\verbatim@out=\PdfT@temporariesName-special.tex
+ \def\verbatim@processline{%
+ \config@write{\the\verbatim@line}\immediate\write\verbatim@out{\the\verbatim@line}}
+ \def\verbgroup@end{%
+ \PdfTInfo{Closing `\PdfT@temporariesName-special.tex'.}
+ \immediate\closeout\verbatim@out
+ \input{\PdfT@temporariesName-special.tex}}
+ \verbgroup}
+
+\def\configpsonly{
+ \def\verbatim@processline{\config@write{\the\verbatim@line}}
+ \verbgroup}
+
+\def\configpsblock{%
+ \@bsphack
+ \let\old@endcmd\end
+ \def\end##1{\old@endcmd{##1}\input{\PdfT@temporariesName-special.tex}}
+ \PdfTInfo{Opening `\PdfT@temporariesName-special.tex'.}
+ \immediate\openout\verbatim@out=\PdfT@temporariesName-special.tex
+ \config@opentested
+ \let\do\@makeother\dospecials
+ \catcode`\^^M=\active \catcode`\^^I=12
+ \def\verbatim@processline{%
+ \config@writeNT{\the\verbatim@line}\immediate\write\verbatim@out{\the\verbatim@line}}
+ \verbatim@start}
+\def\endconfigpsblock{%
+ \PdfTInfo{Closing `\PdfT@temporariesName-special.tex'.}
+ \immediate\closeout\verbatim@out
+ \@esphack}
+
+\def\configpsonlyblock{%
+ \@bsphack
+ \config@opentested
+ \let\do\@makeother\dospecials
+ \catcode`\^^M\active \catcode`\^^I=12
+ \def\verbatim@processline{%
+ \config@writeNT{\the\verbatim@line}}
+ \verbatim@start}
+\def\endconfigpsonlyblock{%
+ \@esphack}
+
+% transcript figure files
+\let\old@pspicture\pspicture
+\let\old@endpspicture\endpspicture
+\ifpdf
+ \def\pspicture{%
+ \config@finish
+ \PdfTInfo{Opening `\PdfT@figName.tex'.}%
+ \immediate\openout\verbatim@out=\PdfT@figName.tex
+ % write preamble
+ \write@PSFigureFileHeaderI
+ \begingroup
+ \if@scriptpaths\else
+ \let\PdfT@temporariesName\jobname
+ \fi
+ \pst@cnta=1
+ \loop
+ \immediate\write\verbatim@out{\string\input{\PdfT@confName\pst@cnta.tex}}%
+ \ifnum\pst@cnta<\ps@figno
+ \advance\pst@cnta by 1
+ \repeat
+ \endgroup
+ % start reading figure
+ \pst@ifstar
+ \pspicture@normalize}
+
+ \def\pspicture@normalize{%
+ \let\do\@makeother\dospecials
+ \catcode`\^^M\active \catcode`\^^I=12
+ \if@star
+ \else
+ \PackageWarning{pdftricks2}{You use pspicture environment. This might have not\MessageBreak the same result when using pdflatex. Consider\MessageBreak using pspicture* environment instead.\MessageBreak}%
+ \fi
+ \@ifnextchar[{\read@psbaseline}{\def\ps@baseline{0}\pspicture@normalize@}}
+
+ \def\read@psbaseline[#1]{\def\ps@baseline{#1}\pspicture@normalize@}
+
+ \def\pspicture@normalize@#1(#2,#3){%
+ \@ifnextchar({\pspicture@readtofile(#2,#3)}{\pspicture@readtofile(0,0)(#2,#3)}}
+
+ \def\pspicture@readtofile(#1,#2)(#3,#4){%
+ \write@PSFigureFileHeaderII{#1}{#2}{#3}{#4}%
+ \def\verbatim@processline{%
+ \immediate\write\verbatim@out{\the\verbatim@line}}%
+ \verbatim@start}
+
+ \def\endpspicture{%
+ \immediate\write\verbatim@out{\string\end{\@currenvir}}%
+ \immediate\write\verbatim@out{\string\end{document}}%
+ \PdfTInfo{Closing `\PdfT@figName.tex'.}%
+ \immediate\closeout\verbatim@out
+ \if@autotranslate
+ \PdfTInfo{Process `\PdfT@figName.tex'.}%
+ \if@iswin
+ \immediate\write18{del \PdfT@figNameW.pdf}%
+ \else
+ \immediate\write18{rm \PdfT@figName.pdf}%
+ \fi
+ \IfFileExists{\PdfT@figName.tex}{%
+ \PdfTInfoNoLine{Invoke latex for \PdfT@figName.tex.}%
+ \immediate\write18{latex -output-directory=\PdfT@tmpDir\space -interaction=batchmode \PdfT@figName.tex}%
+ \IfFileExists{\PdfT@figName.dvi}{%
+ \PdfTInfoNoLine{Invoke dvips for \PdfT@figName.dvi.}%
+ \immediate\write18{dvips -o \PdfT@figName.ps \PdfT@figName}%
+ \IfFileExists{\PdfT@figName.ps}{%
+ \PdfTInfoNoLine{Invoke ps2pdf for \PdfT@figName.ps.}%
+ \immediate\write18{ps2pdf \PdfT@figName.ps \PdfT@figName.pdf}%
+ \IfFileExists{\PdfT@figName.pdf}{%
+ \PdfTInfoNoLine{Cleaning up temorary files for transcrip \the\ps@figno}%
+ \if@iswin
+ \immediate\write18{del \PdfT@figNameW.aux \PdfT@figNameW.dvi \PdfT@figNameW.ps}%
+ \else
+ \immediate\write18{rm \PdfT@figName.aux \PdfT@figName.dvi \PdfT@figName.ps}%
+ \fi}{%
+ \PackageError{pdftricks2}{%
+ ****************************************\MessageBreak
+ Could not create \PdfT@figName.pdf.\MessageBreak
+ ****************************************}}}{%
+ \PackageError{pdftricks2}{%
+ ****************************************\MessageBreak
+ Could not create \PdfT@figName.ps.\MessageBreak
+ ****************************************}}}{%
+ \PackageError{pdftricks2}{%
+ ****************************************\MessageBreak
+ Could not create \PdfT@figName.dvi.\MessageBreak
+ ****************************************}}}{%
+ \PackageError{pdftricks2}{%
+ ****************************************\MessageBreak
+ Could not write \PdfT@figName.tex.\MessageBreak
+ ****************************************}}%
+ \fi
+ \IfFileExists{\PdfT@figName.pdf}{%
+ %\includegraphics{\PdfT@figName.pdf}
+ \setbox\pst@hbox=\hbox{\includegraphics{\PdfT@figName.pdf}}%
+ \pst@dima=\dp\pst@hbox
+ \advance\pst@dima by \ht\pst@hbox
+ \pst@dimb=\ps@baseline\pst@dima
+ \advance\pst@dimb by -\dp\pst@hbox
+ \leavevmode\hbox{\lower\pst@dimb\box\pst@hbox}}{%
+ \@figuresnotfoundtrue}%
+ \global\advance\ps@figno by 1
+ \global\let\verbatim@rescan\pspicture@rescan}
+
+ \begingroup % hack from verbatim.sty - in this part every !,~,[,] is read as the char <cr>,%, ,<tab> respectively, preserving the char C, nevertheless all definitions are not local
+ \catcode`\!=\active \catcode`\~=12 \catcode`\[=12 \catcode`\]=12
+ \lccode`\!=`\^^M \lccode`\~=`\% \lccode`\[=`\ \lccode`\]=`\^^I
+ \lccode`\C=`\C
+ \lowercase{\endgroup
+ \def\pspicture@rescan#1#2!{%
+ \if\noexpand!\noexpand#2!
+ \else
+ \let\next\relax
+ \pspicture@rescan@{#1}#2\@nil
+ \fi
+ \global\let\verbatim@rescan\old@verbatim@rescan}
+
+ \def\pspicture@rescan@#1#2#3\@nil{%
+ \if[\noexpand#2%
+ \let\next\space
+ \pspicture@rescan@{#1}#3\@nil%
+ \else
+ \if]\noexpand#2%
+ \let\next\space
+ \pspicture@rescan@{#1}#3\@nil%
+ \else
+ \if~\noexpand#2\next\else
+ \PackageWarning{pdftricks2}{Characters lost after `\string\end{#1}'}
+ \fi
+ \fi
+ \fi}
+ }% end of hack
+
+ \def\write@PSFigureFileHeaderI{%
+ \immediate\write\verbatim@out{\string\documentclass{scrartcl}}%
+ \immediate\write\verbatim@out{\string\usepackage[driver=dvips]{geometry}}%
+ \immediate\write\verbatim@out{\string\pagestyle{empty}}%
+ \immediate\write\verbatim@out{\string\setlength{\string\parindent}{0pt}}%
+ \immediate\write\verbatim@out{\string\setlength{\string\parskip}{0pt}}%
+ \ifx\pst@args\@gobble
+ \immediate\write\verbatim@out{\string\usepackage{pstricks}}%
+ \else
+ \immediate\write\verbatim@out{\string\usepackage[\pst@args]{pstricks}}%
+ \fi}
+
+ \def\write@PSFigureFileHeaderII#1#2#3#4{%
+ \immediate\write\verbatim@out{\string\makeatletter}% setting needed document size
+ \immediate\write\verbatim@out{\string\pst@dima=#3\string\psxunit}%
+ \immediate\write\verbatim@out{\string\pst@dimc=#1\string\psxunit}%
+ \immediate\write\verbatim@out{\string\advance\string\pst@dima\space by -\string\pst@dimc}%
+ \immediate\write\verbatim@out{\string\ifdim\string\pst@dima<0pt \string\pst@dima=-\string\pst@dima\string\fi}%
+ \immediate\write\verbatim@out{\string\pst@dimb=#4\string\psyunit}%
+ \immediate\write\verbatim@out{\string\pst@dimc=#2\string\psyunit}%
+ \immediate\write\verbatim@out{\string\advance\string\pst@dimb\space by -\string\pst@dimc}%
+ \immediate\write\verbatim@out{\string\ifdim\string\pst@dimb<0pt \string\pst@dimb=-\string\pst@dimb\string\fi}%
+ \immediate\write\verbatim@out{\string\geometry{paperwidth=\string\pst@dima, paperheight=\string\pst@dimb, margin=0pt}}%
+ \immediate\write\verbatim@out{\string\makeatother}%
+ \immediate\write\verbatim@out{\string\begin{document}}%
+ \immediate\write\verbatim@out{\string\begin{\@currenvir}(#1,#2)(#3,#4)}}
+\else
+ \def\pspicture{%
+ \config@finish
+ \let\psset\old@psset
+ \let\newpsstyle\old@newpsstyle
+ \let\addtopsstyle\old@addtopsstyle
+ \let\degrees\old@degrees
+ \let\radians\old@radians
+ \let\SpecialCoor\old@SpecialCoor
+ \pst@cnta=1
+ \leavevmode\hbox to 0pt{}% trick to remove spaces from reading the config files but not the spaces in front of the pspicture
+ \loop
+ \input{\PdfT@confName\pst@cnta.tex}\unskip\unskip%
+ \ifnum\pst@cnta<\ps@figno
+ \advance\pst@cnta by 1
+ \repeat
+ \begingroup
+ \pst@ifstar
+ \pspicture@}
+
+ \def\pspicture@{%
+ \if@star
+ \else
+ \PackageWarning{pdftricks2}{You use pspicture environment. This might have not\MessageBreak the same result when using pdflatex. Consider\MessageBreak using pspicture* environment instead.}%
+ \fi
+ \@ifnextchar[{\pspicture@I}{\psset{shift=0}\pst@picture}}
+
+ \def\pspicture@I[#1]{%
+ \def\ps@baseline{#1}%
+ \pspicture@II}
+
+ \def\pspicture@II#1(#2,#3){%
+ \@ifnextchar({\pspicture@III(#2,#3)}{\pspicture@III(0,0)(#2,#3)}}
+
+ \def\pspicture@III(#1,#2)(#3,#4){%
+ \@ifundefined{pst@shift}{%
+ \pst@picture[\ps@baseline](#1,#2)(#3,#4)}{%
+ \pst@dima=#4\psyunit
+ \pst@dimb=#2\psyunit
+ \advance\pst@dima by -\pst@dimb
+ \ifdim\pst@dima>0pt \pst@dima=-\pst@dima\fi
+ \pst@dima=\ps@baseline\pst@dima
+ \edef\ps@shift@cmd{[shift=\the\pst@dima]}%
+ \expandafter\pst@picture\ps@shift@cmd(#1,#2)(#3,#4)}}
+
+ \def\endpspicture{%
+ \old@endpspicture%
+ \global\advance\ps@figno by 1\relax}
+\fi
+
+\def\configpsonlyblock{%
+ \@bsphack
+ \config@opentested
+ \let\do\@makeother\dospecials
+ \catcode`\^^M\active \catcode`\^^I=12
+ \def\verbatim@processline{%
+ \config@writeNT{\the\verbatim@line}}
+ \verbatim@start}
+\def\endconfigpsonlyblock{%
+ \@esphack}
+
+% end document handle
+\AtEndDocument{%
+ \if@figuresnotfound
+ \PackageWarningNoLine{pdftricks2}{%
+ ****************************************\MessageBreak
+ Not all figure files were found.\MessageBreak
+ ****************************************}
+ \fi
+ \ifpdf\if@autotranslate\else
+ \Write@TranslateScript
+ \if@iswin
+ \PackageWarningNoLine{pdftricks2}{%
+ ****************************************\MessageBreak
+ You have to rename `\PdfT@tmpDir /transscr.txt'\MessageBreak
+ to `\PdfT@tmpDir /transscr.bat' and run it.\MessageBreak
+ ****************************************}
+ \else
+ \PackageWarningNoLine{pdftricks2}{%
+ ****************************************\MessageBreak
+ You have to make `\PdfT@tmpDir /transscr.sh'\MessageBreak
+ executable and run it.
+ ****************************************}
+ \fi
+ \fi\fi}
+
+\def\Write@TranslateScript{%
+ \PdfTInfoNoLine{Writing script for manual translation.}
+ \if@iswin
+ \immediate\openout\verbatim@out=\PdfT@tmpDir /transscr.txt
+ \else
+ \immediate\openout\verbatim@out=\PdfT@tmpDir /transscr.sh
+ \fi
+ \if@scriptpaths\else
+ \let\PdfT@temporariesName\jobname
+ \fi
+ \pst@cnta=\ps@figno
+ \ps@figno=1
+ \loop
+ \ifnum\ps@figno<\pst@cnta
+ \Write@TranslateScript@
+ \advance\ps@figno by 1
+ \repeat
+ \immediate\closeout\verbatim@out}
+
+\def\Write@TranslateScript@{%
+ \immediate\write\verbatim@out{echo Process \PdfT@figName.}
+ \if@scriptpaths
+ \immediate\write\verbatim@out{latex -output-directory=\PdfT@tmpDir\space -interaction=batchmode \PdfT@figName.tex}
+ \else
+ \immediate\write\verbatim@out{latex -interaction=batchmode \PdfT@figName.tex}
+ \fi
+ \immediate\write\verbatim@out{dvips -o \PdfT@figName.ps \PdfT@figName}
+ \immediate\write\verbatim@out{ps2pdf \PdfT@figName.ps \PdfT@figName.pdf}
+ \if@iswin
+ \immediate\write\verbatim@out{del \PdfT@figNameW.aux \PdfT@figNameW.dvi \PdfT@figNameW.ps}
+ \else
+ \immediate\write\verbatim@out{rm \PdfT@figName.aux \PdfT@figName.dvi \PdfT@figName.ps}
+ \fi}
+
+\endinput
+