From 28885f3399755436fff3ffc8ab90e11f31b5b968 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 18 Dec 2006 18:11:28 +0000 Subject: pst-code part of pstricks, 17dec06 git-svn-id: svn://tug.org/texlive/trunk@2791 c570f23f-e606-0410-a88d-b1316a301751 --- .../texmf-dist/doc/generic/pstricks/code/Changes | 4 + .../texmf-dist/doc/generic/pstricks/code/Makefile | 38 + Master/texmf-dist/doc/generic/pstricks/code/README | 20 + .../texmf-dist/doc/generic/pstricks/code/art11.sty | 175 + .../doc/generic/pstricks/code/pst-code.pdf | Bin 0 -> 279460 bytes .../doc/generic/pstricks/code/pst-code.tex | 138 + .../doc/generic/pstricks/code/pst-coil.doc | 221 + .../doc/generic/pstricks/code/pst-node.doc | 1066 +++++ .../doc/generic/pstricks/code/pstricks.doc | 4739 ++++++++++++++++++++ .../doc/generic/pstricks/code/tvz-code.sty | 271 ++ .../doc/generic/pstricks/code/tvz-hax.sty | 172 + Master/texmf-dist/tpm/pstricks.tpm | 15 +- Master/texmf/lists/pstricks | 11 + 13 files changed, 6868 insertions(+), 2 deletions(-) create mode 100644 Master/texmf-dist/doc/generic/pstricks/code/Changes create mode 100644 Master/texmf-dist/doc/generic/pstricks/code/Makefile create mode 100644 Master/texmf-dist/doc/generic/pstricks/code/README create mode 100644 Master/texmf-dist/doc/generic/pstricks/code/art11.sty create mode 100644 Master/texmf-dist/doc/generic/pstricks/code/pst-code.pdf create mode 100644 Master/texmf-dist/doc/generic/pstricks/code/pst-code.tex create mode 100644 Master/texmf-dist/doc/generic/pstricks/code/pst-coil.doc create mode 100644 Master/texmf-dist/doc/generic/pstricks/code/pst-node.doc create mode 100644 Master/texmf-dist/doc/generic/pstricks/code/pstricks.doc create mode 100644 Master/texmf-dist/doc/generic/pstricks/code/tvz-code.sty create mode 100644 Master/texmf-dist/doc/generic/pstricks/code/tvz-hax.sty diff --git a/Master/texmf-dist/doc/generic/pstricks/code/Changes b/Master/texmf-dist/doc/generic/pstricks/code/Changes new file mode 100644 index 00000000000..53f76bc9ed3 --- /dev/null +++ b/Master/texmf-dist/doc/generic/pstricks/code/Changes @@ -0,0 +1,4 @@ +pst-code.tex -------- + +2006-12-17 make it run with pdflatex (hv) + diff --git a/Master/texmf-dist/doc/generic/pstricks/code/Makefile b/Master/texmf-dist/doc/generic/pstricks/code/Makefile new file mode 100644 index 00000000000..58a4fec923a --- /dev/null +++ b/Master/texmf-dist/doc/generic/pstricks/code/Makefile @@ -0,0 +1,38 @@ +input=pst-code + +all: + $(MAKE) dvi + $(MAKE) ps + $(MAKE) pdf + +index: + makeindex -s gind.ist $(input).idx + +dvi: + latex $(input).tex + $(MAKE) index + latex $(input).tex + xdvi $(input).dvi + +ps: + latex $(input).tex + $(MAKE) index + latex $(input).tex + dvips $(input) + gv $(input).ps + +pdf: + pdflatex $(input).tex + $(MAKE) index + pdflatex $(input).tex + xpdf $(input).pdf + + +zip: + $(RM) $(input).zip + zip -r $(input).zip * + +clean: + $(RM) *.pdf + $(RM) *.ps + diff --git a/Master/texmf-dist/doc/generic/pstricks/code/README b/Master/texmf-dist/doc/generic/pstricks/code/README new file mode 100644 index 00000000000..9a4b312a921 --- /dev/null +++ b/Master/texmf-dist/doc/generic/pstricks/code/README @@ -0,0 +1,20 @@ +latex pst-code +makeindex -s gind.ist pst-code.idx +latex pst-code + +or + +pdflatex pst-code +makeindex -s gind.ist pst-code.idx +pdflatex pst-code + +or use one of the alternative make commands + +make dvi +make pdf +make ps +make clean +make zip + +------------- +2006-12-17 Herbert Voss \ No newline at end of file diff --git a/Master/texmf-dist/doc/generic/pstricks/code/art11.sty b/Master/texmf-dist/doc/generic/pstricks/code/art11.sty new file mode 100644 index 00000000000..d08dfe2e0fd --- /dev/null +++ b/Master/texmf-dist/doc/generic/pstricks/code/art11.sty @@ -0,0 +1,175 @@ +% ARTICLE STANDARD DOCUMENT STYLE -- Released 14 Jan 1992 +% for LaTeX version 2.09 +% Copyright (C) 1992 by Leslie Lamport + +\lineskip 1pt +\normallineskip 1pt +\def\baselinestretch{1} + +\def\@normalsize{\@setsize\normalsize{13.6pt}\xipt\@xipt +\abovedisplayskip 11\p@ plus3\p@ minus6\p@ +\belowdisplayskip \abovedisplayskip +\abovedisplayshortskip \z@ plus3\p@ +\belowdisplayshortskip 6.5\p@ plus3.5\p@ minus3\p@ +\let\@listi\@listI} + +\def\small{\@setsize\small{12pt}\xpt\@xpt +\abovedisplayskip 10\p@ plus2\p@ minus5\p@ +\belowdisplayskip \abovedisplayskip +\abovedisplayshortskip \z@ plus3\p@ +\belowdisplayshortskip 6\p@ plus3\p@ minus3\p@ +\def\@listi{\leftmargin\leftmargini +\topsep 6\p@ plus2\p@ minus2\p@\parsep 3\p@ plus2\p@ minus\p@ +\itemsep \parsep}} + +\def\footnotesize{\@setsize\footnotesize{11pt}\ixpt\@ixpt +\abovedisplayskip 8\p@ plus2\p@ minus4\p@ +\belowdisplayskip \abovedisplayskip +\abovedisplayshortskip \z@ plus\p@ +\belowdisplayshortskip 4\p@ plus2\p@ minus2\p@ +\def\@listi{\leftmargin\leftmargini +\topsep 4\p@ plus2\p@ minus2\p@\parsep 2\p@ plus\p@ minus\p@ +\itemsep \parsep}} + +\def\scriptsize{\@setsize\scriptsize{9.5pt}\viiipt\@viiipt} +\def\tiny{\@setsize\tiny{7pt}\vipt\@vipt} +\def\large{\@setsize\large{14pt}\xiipt\@xiipt} +\def\Large{\@setsize\Large{18pt}\xivpt\@xivpt} +\def\LARGE{\@setsize\LARGE{22pt}\xviipt\@xviipt} +\def\huge{\@setsize\huge{25pt}\xxpt\@xxpt} +\def\Huge{\@setsize\Huge{30pt}\xxvpt\@xxvpt} + +\normalsize + +\if@twoside + \oddsidemargin 36pt + \evensidemargin 74pt + \marginparwidth 100pt +\else + \oddsidemargin 54pt + \evensidemargin 54pt + \marginparwidth 83pt +\fi +\marginparsep 10pt + +\topmargin 27pt + +\headheight 12pt +\headsep 25pt +\topskip = 11pt + +\footskip 30pt + +\textheight = 38\baselineskip +\advance\textheight by \topskip +\textwidth 360pt + +\columnsep 10pt +\columnseprule 0pt + +\footnotesep 7.7pt + +\skip\footins 10pt plus 4pt minus 2pt + +\floatsep 12pt plus 2pt minus 2pt + +\textfloatsep 20pt plus 2pt minus 4pt + +\intextsep 12pt plus 2pt minus 2pt + +\@maxsep 20pt + +\dblfloatsep 12pt plus 2pt minus 2pt + +\dbltextfloatsep 20pt plus 2pt minus 4pt + +\@dblmaxsep 20pt + +\@fptop 0pt plus 1fil + +\@fpsep 8pt plus 2fil +\@fpbot 0pt plus 1fil + +\@dblfptop 0pt plus 1fil + +\@dblfpsep 8pt plus 2fil +\@dblfpbot 0pt plus 1fil + +\marginparpush 5pt + +\parskip 0pt plus 1pt + +\parindent 17pt + +\partopsep 3pt plus 1pt minus 2pt + +\@lowpenalty 51 +\@medpenalty 151 +\@highpenalty 301 + +\@beginparpenalty -\@lowpenalty + +\@endparpenalty -\@lowpenalty + +\@itempenalty -\@lowpenalty + +\def\section{\@startsection {section}{1}{\z@}{-3.5ex plus-1ex minus + -.2ex}{2.3ex plus.2ex}{\reset@font\Large\bf}} +\def\subsection{\@startsection{subsection}{2}{\z@}{-3.25ex plus-1ex + minus-.2ex}{1.5ex plus.2ex}{\reset@font\large\bf}} +\def\subsubsection{\@startsection{subsubsection}{3}{\z@}{-3.25ex plus + -1ex minus-.2ex}{1.5ex plus.2ex}{\reset@font\normalsize\bf}} +\def\paragraph{\@startsection + {paragraph}{4}{\z@}{3.25ex plus1ex minus.2ex}{-1em}{\reset@font + \normalsize\bf}} +\def\subparagraph{\@startsection + {subparagraph}{4}{\parindent}{3.25ex plus1ex minus + .2ex}{-1em}{\reset@font\normalsize\bf}} + +\setcounter{secnumdepth}{3} + +\def\appendix{\par + \setcounter{section}{0} + \setcounter{subsection}{0} + \def\thesection{\Alph{section}}} + +\leftmargini 2.5em +\leftmarginii 2.2em +\leftmarginiii 1.87em +\leftmarginiv 1.7em +\leftmarginv 1em +\leftmarginvi 1em + +\leftmargin\leftmargini +\labelsep .5em +\labelwidth\leftmargini\advance\labelwidth-\labelsep + +\def\@listI{\leftmargin\leftmargini \parsep 4.5\p@ plus2\p@ minus\p@ +\topsep 9\p@ plus3\p@ minus5\p@ +\itemsep 4.5\p@ plus2\p@ minus\p@} + +\let\@listi\@listI +\@listi + +\def\@listii{\leftmargin\leftmarginii + \labelwidth\leftmarginii\advance\labelwidth-\labelsep + \topsep 4.5\p@ plus2\p@ minus\p@ + \parsep 2\p@ plus\p@ minus\p@ + \itemsep \parsep} + +\def\@listiii{\leftmargin\leftmarginiii + \labelwidth\leftmarginiii\advance\labelwidth-\labelsep + \topsep 2\p@ plus\p@ minus\p@ + \parsep \z@ \partopsep\p@ plus\z@ minus\p@ + \itemsep \topsep} + +\def\@listiv{\leftmargin\leftmarginiv + \labelwidth\leftmarginiv\advance\labelwidth-\labelsep} + +\def\@listv{\leftmargin\leftmarginv + \labelwidth\leftmarginv\advance\labelwidth-\labelsep} + +\def\@listvi{\leftmargin\leftmarginvi + \labelwidth\leftmarginvi\advance\labelwidth-\labelsep} + +\endinput diff --git a/Master/texmf-dist/doc/generic/pstricks/code/pst-code.pdf b/Master/texmf-dist/doc/generic/pstricks/code/pst-code.pdf new file mode 100644 index 00000000000..aa1ce5ecc19 Binary files /dev/null and b/Master/texmf-dist/doc/generic/pstricks/code/pst-code.pdf differ diff --git a/Master/texmf-dist/doc/generic/pstricks/code/pst-code.tex b/Master/texmf-dist/doc/generic/pstricks/code/pst-code.tex new file mode 100644 index 00000000000..c0aae3c50ae --- /dev/null +++ b/Master/texmf-dist/doc/generic/pstricks/code/pst-code.tex @@ -0,0 +1,138 @@ +%% BEGIN pst-code.tex +%% +%% For printing documented code for PSTricks. +%% +%% COPYRIGHT 1993, by Timothy Van Zandt, tvz@Princeton.EDU +%% +%% This LaTeX file inputs pstricks.doc and pst-node.doc, +%% and prints the documented code. +%% +%% You must also have Frank Mittelbach's +%% doc.sty and gind.ist +%% (available from rusmv1.rus.uni-stuttgart.de), as well as my +%% tvz-hax.sty, tvz-code.sty and fancybox.sty +%% (distributed with PSTricks). +%% +%% gind.ist is for the index. I.e., +%% makeindex -s gind.ist pst-code.idx +%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Change these for a4 paper: +% \def\paperwidth{8.5in} +% \def\paperheight{11in} + +\def\paperwidth{210mm} +\def\paperheight{297mm} + +\documentstyle{tvz-code} + +\def\fileversion{0.93a-97} +\def\filedate{1997/03/25} + +% Comment out to suppress generation of .idx file. Speeds things up. +% \MakeIndex + +% Include to suppress checksums for drafts: +\def\StopEventually#1{\let\Finale\relax} + +\makeatletter + +%%%%%%%%%%%%%%%%%%% More DoNotIndex for pst-code %%%%%%%%%%%%%%% +\DoNotIndex{\pst@dima,\pst@dimb,\pst@dimc,\pst@dimd,\pst@dimg,\pst@cnta,% +\pst@cntb,\pst@cntc,\pst@cntg,\pst@tempa,\pst@tempb,\pst@tempc,\pst@tempd,% +\pst@tempg,\pst@boxa,\pst@boxg,\if@pst,\@psttrue,\@pstfalse} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\makeatother + +\MakeShortVerb\" + +\ShortMeta + +\def\n#1{{\tt \string#1}} + +\newbox\junkbox +\def\DocInput#1{% + \MakePercentIgnore + \setbox\junkbox=\hbox\bgroup + \input{#1}% + \MakePercentComment} +\let\EndDocPreamble\egroup + +\begin{document} + +\def\thetitle{PSTricks: Documented Code} + +\begin{titlepage} + +\let\footnotesize\small +\let\footnoterule\relax +\setcounter{page}{0} + +\null +\vfil +\vskip 25pt + +\begin{center} + + {\LARGE\bf PSTricks}:\\[5pt] + {\large\bf PostScript macros for Generic TeX}\\[7pt] + {\LARGE\bf\em Documented Code}\par + + \vskip 3em + + {\large \lineskip .75em Timothy Van Zandt}% + \thanks{% + Author's address: + Department of Economics, Princeton University, + Princeton, NJ 08544-1021, USA. Internet: {\tt tvz@Princeton.EDU}}% + \par + + \vskip 1.5em + + {\large \thefiledate\\[2pt] Version \fileversion}\par + +\end{center} + +\par + +\makeatletter\@thanks\makeatother + +\vfil + +PSTricks is a collection of PostScript macros that is compatible with most +\TeX\ macro packages, including Plain \TeX\ and \LaTeX. Included are macros +for color, graphics, rotation and overlays. + +This is the documented code. There is also a {\em User's Guide} and a read-me +file. + +\vfil +\null + +\end{titlepage} + +\setcounter{footnote}{0} +\pagenumbering{roman} +\tableofcontents +\clearpage +\pagenumbering{arabic} + +\StopEventually{} +\DocInput{pstricks.doc} +\Finale +\clearpage + +\StopEventually{} +\DocInput{pst-node.doc} +\Finale +\clearpage + +\DeleteShortMeta + +\PrintIndex + +\end{document} + +%% END pst-code.tex diff --git a/Master/texmf-dist/doc/generic/pstricks/code/pst-coil.doc b/Master/texmf-dist/doc/generic/pstricks/code/pst-coil.doc new file mode 100644 index 00000000000..c412ed4595c --- /dev/null +++ b/Master/texmf-dist/doc/generic/pstricks/code/pst-coil.doc @@ -0,0 +1,221 @@ +%% BEGIN pst-coil.doc +\def\fileversion{0.93a} +\def\filedate{93/03/12} +%% +%% For stroking and filling characters with PSTricks' line and fill styles. +%% +%% COPYRIGHT 1993, by Timothy Van Zandt, tvz@Princeton.EDU +%% See pstricks.doc or pstricks.tex for copying restrictions. +%% +%% See the PSTricks read-me file and the User's Guide for documentation. +% +% ************************************************************************** +% This is `pst-coil.doc'. Use as is, or create a header file and stripped +% input file with pst-make.tex. See the PSTricks read-me file for details. +% ************************************************************************** + +\message{ v\fileversion, \filedate} + +\csname PSTcoilsLoaded\endcsname +\let\PSTcoilsLoaded\endinput + +\ifx\PSTricksLoaded\endinput\else + \def\next{\input pstricks.tex}\expandafter\next +\fi + +\edef\TheAtCode{\the\catcode`\@} +\catcode`\@=11 + +\pst@ATH<\% Version \fileversion, \filedate.> +\pst@ATH<\% For use with \pstdriver.> +\pst@ATH + +\ifx\pst@useheader\iftrue + \pstheader{pst-coil.pro} + \edef\pst@theheaders{\pst@theheaders,pst-coil.pro} + \def\pst@coildict{tx@CoilDict begin } +\else + \def\pst@coildict{% + /tx@CoilDict where + { pop tx@CoilDict begin} + { userdict begin /tx@CoilDict 40 dict def end + tx@CoilDict begin } + ifelse } +\fi + +\def\psset@coilwidth#1{\pst@getlength{#1}\psk@coilwidth} +\psset@coilwidth{1cm} + +\def\psset@coilheight#1{\pst@checknum{#1}\pscoilheight} +\psset@coilheight{1} + +\def\psset@coilarmA#1{\pst@getlength{#1}\psk@coilarmA} +\def\psset@coilarmB#1{\pst@getlength{#1}\psk@coilarmB} +\def\psset@coilarm#1{% + \pst@getlength{#1}\psk@coilarmA + \let\psk@coilarmB\psk@coilarmA} +\psset@coilarm{.5cm} + +\def\psset@coilaspect#1{\pst@getangle{#1}\psk@coilaspect} +\psset@coilaspect{45} + +\def\psset@coilinc#1{\pst@getangle{#1}\psk@coilinc} +\psset@coilinc{10} + +\def\pscoil{\def\pst@par{}\pst@object{pscoil}} +\def\pscoil@i{\pst@getarrows\pscoil@ii} +\def\pscoil@ii(#1){% + \@ifnextchar(% + {\pscoil@iii{1}(#1)}% + {\pscoil@iii{\z@}(0,0)(#1)}} +\def\pscoil@iii#1(#2)(#3){% + \begin@OpenObj + \pst@getcoor{#2}\pst@tempa + \pst@getcoor{#3}\pst@tempb + \pst@optcp{#1}\pst@tempa + \addto@pscode{% + \pst@tempa \pst@tempb + \psk@coilwidth \pscoilheight + \psk@coilarmA \psk@coilarmB + \psk@coilaspect \psk@coilinc + \pst@coildict \tx@Coil end}% + \showpointsfalse + \end@OpenObj} + +\pst@def{CoilLoop}<% + /t ED + t sin AspectSin mul t 180 div AspectCos mul add + t cos + lineto> + +\pst@def{Coil}<% + /Inc ED + dup sin /AspectSin ED cos /AspectCos ED + /ArmB ED /ArmA ED + /h ED /w ED + /y1 ED /x1 ED /y0 ED /x0 ED + x0 y0 translate + y1 y0 sub x1 x0 sub + 2 copy \tx@Pyth /TotalLength ED + \tx@Atan rotate + /BeginAngle ArmA AspectCos \tx@Div w h mul \tx@Div 360 mul def + /EndAngle + TotalLength ArmB sub AspectCos \tx@Div + w h mul \tx@Div 360 mul + def + 1 0 0 0 ArrowA + ArmA 0 lineto + /mtrx CM def + w h mul 2 \tx@Div w 2 \tx@Div scale + BeginAngle Inc EndAngle { \tx@CoilLoop } for + EndAngle \tx@CoilLoop + mtrx setmatrix + TotalLength ArmB sub 0 lineto + CP TotalLength 0 ArrowB + lineto> + +\def\psCoil{\def\pst@par{}\pst@object{psCoil}} +\def\psCoil@i#1#2{% + \begin@AltOpenObj + \showpointsfalse + \pst@getangle{#1}\pst@tempa + \pst@getangle{#2}\pst@tempb + \addto@pscode{% + \pst@tempa + \pst@tempb + \psk@coilwidth + \pscoilheight + \psk@coilaspect + \psk@coilinc + \pst@coildict \tx@AltCoil end + \@nameuse{psls@\pslinestyle}}% + \end@OpenObj} + +\pst@def{AltCoil}<% + /Inc ED + dup sin /AspectSin ED cos /AspectCos ED + /h ED /w ED + /EndAngle ED /BeginAngle ED + /mtrx CM def + w h mul 2 \tx@Div w 2 \tx@Div scale + BeginAngle sin AspectSin mul BeginAngle 180 div AspectCos mul add + BeginAngle cos + /lineto load stopped { moveto } if + BeginAngle Inc EndAngle { \tx@CoilLoop } for + EndAngle \tx@CoilLoop + mtrx setmatrix> + +\def\pszigzag{\def\pst@par{}\pst@object{pszigzag}} +\def\pszigzag@i{\pst@getarrows\pszigzag@ii} +\def\pszigzag@ii(#1){% + \@ifnextchar({\pszigzag@iii{1}(#1)}{\pszigzag@iii{\z@}(0,0)(#1)}} +\def\pszigzag@iii#1(#2)(#3){% + \begin@OpenObj + \pst@getcoor{#2}\pst@tempa + \pst@getcoor{#3}\pst@tempb + \pst@optcp{#1}\pst@tempa + \addto@pscode{% + \pst@tempa + \pst@tempb + \pscoilheight + \psk@coilwidth + \psk@coilarmA + \psk@coilarmB + \pst@coildict \tx@ZigZag end + \psline@iii + \tx@Line}% + \end@OpenObj} + +\pst@def{ZigZag}<% + /ArmB ED /ArmA ED + 2 div /w ED w mul /h ED + /y1 ED /x1 ED /y0 ED /x0 ED + x1 y1 translate + y0 y1 sub x0 x1 sub + 2 copy \tx@Pyth /TotalLength ED + \tx@Atan rotate + TotalLength ArmA sub ArmB sub dup h div cvi /n ED + n h mul sub 2 div dup ArmA add /ArmA ED ArmB add /ArmB ED + /x ArmB h 2 div add def + mark + 0 0 ArmB 0 + n { x w /w w neg def /x x h add def } repeat + TotalLength ArmA sub 0 TotalLength 0> + +\def\nccoil{\def\pst@par{}\pst@object{nccoil}} +\def\nccoil@i{\check@arrow{\nccoil@ii}} +\def\nccoil@ii#1#2{\nc@object{#1}{#2}{.5}{% + \tx@NCCoor + tx@Dict begin + \psk@coilwidth \pscoilheight + \psk@coilarmA \psk@coilarmB + \psk@coilaspect \psk@coilinc + \pst@coildict \tx@Coil end + end}} + +\def\pccoil{\def\pst@par{}\pst@object{pccoil}} +\def\pccoil@i{\pc@object\nccoil@ii} + +\def\nczigzag{\def\pst@par{}\pst@object{nczigzag}} +\def\nczigzag@i{\check@arrow{\nczigzag@ii}} +\def\nczigzag@ii#1#2{\nc@object{#1}{#2}{.5}{% + \tx@NCCoor + tx@Dict begin + \pscoilheight + \psk@coilwidth + \psk@coilarmA + \psk@coilarmB + \pst@coildict \tx@ZigZag end + \psline@iii + \tx@Line + end}} + +\def\pczigzag{\def\pst@par{}\pst@object{pczigzag}} +\def\pczigzag@i{\pc@object\nczigzag@ii} + +\pst@ATH + +\catcode`\@=\TheAtCode\relax + +\endinput +%% END pst-coil.doc diff --git a/Master/texmf-dist/doc/generic/pstricks/code/pst-node.doc b/Master/texmf-dist/doc/generic/pstricks/code/pst-node.doc new file mode 100644 index 00000000000..8f725482dd3 --- /dev/null +++ b/Master/texmf-dist/doc/generic/pstricks/code/pst-node.doc @@ -0,0 +1,1066 @@ +%% BEGIN: pst-node.doc +\def\fileversion{0.93a} +\def\filedate{93/03/12} +%% +%% pst-node.tex: Node macros for PSTricks. +%% See the PSTricks read-me file and the User's Guide for documentation. +%% +%% COPYRIGHT 1993, by Timothy Van Zandt, tvz@Princeton.EDU +%% +%% Copying of part or all of any file in the pstricks.tex package +%% is allowed under the following conditions only: +%% (1) You may freely distribute unchanged copies of the files. Please +%% include the documentation when you do so. +%% (2) You may modify a renamed copy of any file, but only for personal +%% use or use within an organization. +%% (3) You may copy fragments from the files, for personal use or for use +%% in a macro package for distribution, as long as credit is given +%% where credit is due. +%% +%% You are NOT ALLOWED to take money for the distribution or use of +%% these files or modified versions or fragments thereof, except for +%% a nominal charge for copying etc. +%% +% ************************************************************************** +% This file contains the documented code for pst-node.tex and pst-node.pro. +% See the PSTricks read-me file for information on how to use this file. +% ************************************************************************** +% +% \EndDocPreamble +% +% \CheckSum{5874} +% \CharacterTable +% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z +% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z +% Digits \0\1\2\3\4\5\6\7\8\9 +% Exclamation \! Double quote \" Hash (number) \# +% Dollar \$ Percent \% Ampersand \& +% Acute accent \' Left paren \( Right paren \) +% Asterisk \* Plus \+ Comma \, +% Minus \- Point \. Solidus \/ +% Colon \: Semicolon \; Less than \< +% Equals \= Greater than \> Question mark \? +% Commercial at \@ Left bracket \[ Backslash \\ +% Right bracket \] Circumflex \^ Underscore \_ +% Grave accent \` Left brace \{ Vertical bar \| +% Right brace \} Tilde \~} +% +% +% \part{pst-node.doc} +% +% Check whether file has been loaded already. +% \begin{macrocode} +\csname PSTnodesLoaded\endcsname +\let\PSTnodesLoaded\endinput +% \end{macrocode} +% +% Load "pstricks.tex" if necessary: +% \begin{macrocode} +\ifx\PSTricksLoaded\endinput\else + \def\next{\input pstricks.tex}\expandafter\next +\fi +% \end{macrocode} +% +% Take care of the catcode of "@": +% \begin{macrocode} +\edef\TheAtCode{\the\catcode`\@} +\catcode`\@=11 +% \end{macrocode} +% +% +% \section{Node header} +% +% Nodes use the dictionary "tx@NodeDict", which is always put on the stack +% after "tx@Dict". "tx@NodeDict" should avoid using the same procedure names +% as are found in "tx@Dict", especially those that do not use scratch +% variables and hence can be used without problem when "tx@NodeDict" is on top +% of the stack. When invoking a "tx@Dict" procedure that does use scratch +% variables, "tx@Dict" should be put on top. +% +% \begin{macro}{\pst@nodedict} +% \begin{macrocode} +\pst@ATH<\% Version \fileversion, \filedate.> +\pst@ATH<\% For use with \pstdriver.> +\pst@ATH +\ifx\pst@useheader\iftrue + \pstheader{pst-node.pro} + \def\pst@nodedict{tx@NodeDict begin } +\else + \def\pst@nodedict{% + /tx@NodeDict where + { pop } + { userdict begin /tx@NodeDict 200 dict def end } + ifelse + tx@NodeDict begin } +\fi +% \end{macrocode} +% \end{macro} +% +% +% \section{Nodes} +% +% +% \begin{macro}{\pst@getnode} +% \begin{macrocode} +% A node is a dictionary. To reduce the chance of errors, we check that the +% name begins with a letter and does not contain any spaces. +% \begin{macrocode} +\def\pst@getnode#1#2{% + \pst@expandafter\pst@@getnode{#1} * \@nil{#1}#2} +\def\pst@@getnode#1#2 #3\@nil#4#5{% + \ifcat#1a\relax + \def#5{/TheNode#1#2 }% + \else + \def#5{/BadNode }% + \@pstrickserr{Bad node name: `#4'}\@ehpa + \fi} +% \end{macrocode} +% \end{macro} +% +% Before a node is defined, the coordinate system is scaled to PSTricks' +% standard coordinate system, with the origin at \TeX's current point. The +% following objects should then be added to the node dictionary: +% \begin{description} +% \item[NodeMtrx] The current matrix. +% \item[X] The x-coordinate of the center. +% \item[Y] The y-coordinate of the center. +% \item[NodePos] A procedure that, given the values of "Sin", "Cos", and +% "Nodesep", gives the relative position of the point that is distance +% "Nodesep"from the edge of the node, in the direction "(Cos,Sin)" from the +% center. ``Relative'' means relative to "(X,Y)" and for the coordinate system +% in effect when the node was defined. +% \end{description} +% +% \begin{macro}{\tx@NewNode,\pst@newnode} +% The node's dictionary size should be large enough for the 7 key's mentioned +% above, plus any keys the node needs for "NodePos", plus a few more to avoid +% mistakes. +% +% Syntax for "NewNode" +% \begin{LVerbatim} +% {} / {} NewNode" +% \end{LVerbatim} +% "" is stuff to be done with "tx@Dict". It might leave +% things on the stack for use by "". +% +% Syntax for "\pst@newnode": +% \begin{LVerbatim} +% \pst@newnode{}{}{}{} +% \end{LVerbatim} +% \begin{macrocode} +\pst@def{NewNode}<% + gsave + /next ED + dict + dup 3 -1 roll ED + begin + tx@Dict begin + \tx@STV + CP T + exec + end + /NodeMtrx CM def + next + end + grestore> +\def\pst@newnode#1#2#3#4{% + \leavevmode + \pst@getnode{#1}\pst@thenode + \pst@Verb{% + \pst@nodedict + { #3 } \pst@thenode #2 { #4 } \tx@NewNode + end}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\tx@InitPnode,\pnode} +% \begin{macrocode} +\pst@def{InitPnode}<% + /Y ED /X ED + /NodePos { Nodesep Cos mul Nodesep Sin mul } def> +\def\pnode{\@ifnextchar({\pnode@}{\pnode@(0,0)}} +\def\pnode@(#1)#2{% + \pst@@getcoor{#1}% + \pst@newnode{#2}{10}{\pst@coor}{\tx@InitPnode}% + \ignorespaces} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\tx@InitCnode,\cnode} +% \begin{macrocode} +\pst@def{InitCnode}<% + /r ED /Y ED /X ED + /NodePos { Nodesep r add dup Cos mul exch Sin mul } def> +\def\cnode{\def\pst@par{}\pst@object{cnode}} +\def\cnode@i{\@ifnextchar({\cnode@ii}{\cnode@ii(0,0)}} +\def\cnode@ii(#1)#2#3{% + \begingroup + \use@par + \pscircle@do(#1){#2}% + \pst@@getcoor{#1}% + \pssetlength\pst@dimc{#2}% + \pst@newnode{#3}{11}{% + \pst@coor + \pst@number\pst@dimc + \pst@number\pslinewidth + \psk@dimen .5 sub mul sub}% + {\tx@InitCnode}% + \endgroup + \ignorespaces} +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\def\cnodeput{\def\pst@par{}\pst@object{cnodeput}} +\def\cnodeput@i{% + \begingroup + \pst@killglue + \leavevmode + \pst@getrputrot + \cnodeput@ii} +\def\cnodeput@ii(#1)#2{% + \pst@makebox{\cput@iii{\cnodeput@iii{#2}}(#1)}} +\def\cnodeput@iii#1{% + \pst@newnode{#1}{11}{\pscirclebox@iv \pst@number\pslinewidth add}% + {\tx@InitCnode}} +% \end{macrocode} +% +% \begin{macro}{\circlenode} +% \begin{macrocode} +\def\circlenode{\def\pst@par{}\pst@object{circlenode}} +\def\circlenode@i#1{\pst@makebox{\pscirclebox@ii{\cnodeput@iii{#1}}}} +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\pst@def{GetRnodePos}<% + Cos 0 gt + { /dx r Nodesep add def } + { /dx l Nodesep sub def } + ifelse + Sin 0 gt + { /dy u Nodesep add def } + { /dy d Nodesep sub def } + ifelse + dx Sin mul abs dy Cos mul abs gt + { dy Cos mul Sin div dy } + { dx dup Sin mul Cos \tx@Div } + ifelse> +% \end{macrocode} +% +% \begin{macro}{InitRnode} +% Syntax: +% \begin{Ex} +% InitRnode +% \end{Ex} +% Additional keys: "r", "l", "d", "u", "dx" and "dy". +% \begin{macrocode} +\pst@def{InitRnode}<% + /r ED r mul neg /l ED /r r l add def + /X l neg def + { neg /d ED /u ED /Y 0 def } + { neg /Y ED + Y sub /u ED + u mul neg /d ED + /u u d add def + /Y Y d sub def } + ifelse + /NodePos { \tx@GetRnodePos } def> +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\rnode} +% The ability to set the refpoint is an undocumented feature that may be +% omitted. +% \begin{macrocode} +\def\rnode{\begingroup\pst@getref\rnode@} +\def\rnode@#1{\pst@makebox{\rnode@@{#1}}} +\def\rnode@@#1{% + \ifx\refpoint@x\relax + \def\refpoint@y{.5}% + \def\refpoint@x{.5}% + \fi + \pst@newnode{#1}{16}{}{% + \ifx\refpoint@x\relax .5 \else \refpoint@y\space \fi + \pst@number{\ht\pst@hbox}% + \pst@number{\dp\pst@hbox}% + \ifx\refpoint@y\@empty true \else false \fi + \refpoint@x\space + \pst@number{\wd\pst@hbox}% + \tx@InitRnode}% + \box\pst@hbox + \endgroup} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{InitRNode} +% Syntax: +% \begin{Ex} +% "InitRNode" +% \end{Ex} +% \begin{macrocode} +\pst@def{InitRNode}<% + /Y ED /X ED /r ED /X r 2 div X add def /r r X sub def /l X neg def + Y add neg /d ED Y sub /u ED + /NodePos { \tx@GetRnodePos } def> +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\Rnode} +% \begin{macrocode} +\def\Rnode{\@ifnextchar({\Rnode@}{\Rnode@(\RnodeRef)}} +\def\Rnode@(#1)#2{\pst@makebox{\Rnode@@(#1){#2}}} +\def\Rnode@@(#1)#2{% + \begingroup + \pst@@getcoor{#1}% + \pst@newnode{#2}{16}{% + \pst@number{\ht\pst@hbox}\pst@number{\dp\pst@hbox}% + \pst@number{\wd\pst@hbox}\pst@coor}{\tx@InitRNode}% + \box\pst@hbox + \endgroup} +\def\RnodeRef{0,.7ex} +% \end{macrocode} +% \end{macro} + +% \begin{macro}{GetOnodePos} +% \begin{macrocode} +\pst@def{GetOnodePos}<% + /ww w Nodesep add def /hh h Nodesep add def + Sin ww mul Cos hh mul \tx@Atan dup + cos ww mul exch sin hh mul> +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\ovalnode} +% Additional keys: "w", "h", "ww", "hh". +% \begin{macrocode} +\def\ovalnode{\def\pst@par{}\pst@object{ovalnode}} +\def\ovalnode@i#1{\pst@makebox{\psovalbox@ii{\ovalnode@ii{#1}}}} +\def\ovalnode@ii#1{% + \pst@newnode{#1}{14}{}{% + /X \pst@number{\wd\pst@hbox}2 div def + /Y \pst@number\pst@dimg 2 div \pst@number{\dp\pst@hbox}sub def + /w \pst@number\pst@dima def + /h \pst@number\pst@dimb def + /NodePos { \tx@GetOnodePos } def}} +% \end{macrocode} +% \end{macro} +% +% +% \section{Node connections: Preliminaries} +% +% \begin{macro}{\tx@GetCenter,\tx@GetAngle} +% Syntax: +% \begin{Ex} +% - "GetCenter" \hskip 1em (Center coordinates)\\ +% - "GetAngle" \hskip 1em (Angle from A to B) +% \end{Ex} +% \begin{macrocode} +\pst@def{GetCenter} +\pst@def{GetAngle}<% + nodeA \tx@GetCenter + nodeB \tx@GetCenter + 3 -1 roll sub 3 1 roll sub neg \tx@Atan> +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\tx@GetEdge,\tx@GetPos} +% Syntax: +% \begin{Ex} +% "GetEdge" +% \end{Ex} +% "GetPos" defines "(x1,y1)" and "(x2,y2)" to be coordinates of position for +% node A and B, taking into account "AngleA", "AngleB", "OffsetA", "OffsetB", +% "NodesepA" and "NodesepB". +% \begin{macrocode} +\pst@def{GetEdge}<% + begin + /Nodesep ED + dup + 1 0 NodeMtrx dtransform CM idtransform exch atan sub + dup sin /Sin ED cos /Cos ED + NodePos Y add exch X add exch + NodeMtrx transform CM itransform + end % offset angle x y + 4 2 roll +% Now add the offsets: + 1 index 0 eq + { pop pop } + { 2 copy 5 2 roll % x offset angle y offset angle + cos mul add + 4 1 roll + sin mul sub + exch } + ifelse> +\pst@def{GetPos}<% + OffsetA AngleA NodesepA nodeA \tx@GetEdge /y1 ED /x1 ED + OffsetB AngleB NodesepB nodeB \tx@GetEdge /y2 ED /x2 ED> +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\def\check@arrow#1#2{% + \check@@arrow#2-\@nil + \if@pst + \addto@par{arrows=#2}% + \def\next{#1}% + \else + \def\next{#1{#2}}% + \fi + \next} +\def\check@@arrow#1-#2\@nil{% + \ifx\@nil#2\@nil\@pstfalse\else\@psttrue\fi} +% \end{macrocode} +% +% \begin{macrocode} +\pst@def{InitNC}<% + /nodeB ED /nodeA ED + /NodesepB ED /NodesepA ED + /OffsetB ED /OffsetA ED + tx@NodeDict nodeA known tx@NodeDict nodeB known and dup + { /nodeA nodeA load def /nodeB nodeB load def } if> +% \end{macrocode} +% +% \begin{macrocode} +\def\nc@object#1#2#3#4{% + \begin@OpenObj + \showpointsfalse + \pst@getnode{#1}\pst@tempa + \pst@getnode{#2}\pst@tempb + \gdef\lputpos@default{#3}% + \addto@pscode{% + \pst@nodedict + \psk@offsetA + \psk@offsetB neg + \psk@nodesepA + \psk@nodesepB + \pst@tempa + \pst@tempb + \tx@InitNC { #4 } if + end}% + \def\use@pscode{% + \pst@Verb{gsave \tx@STV newpath \pst@code\space grestore}% + \gdef\pst@code{}}% + \end@OpenObj} +\def\lputpos@default{.5} +% \end{macrocode} +% +% \begin{macrocode} +\def\pc@object#1{% + \@ifnextchar({\pc@@object#1}{\pst@getarrows{\pc@@object#1}}} +\def\pc@@object#1(#2)(#3){% + \pnode(#2){@@A}\pnode(#3){@@B}% + #1{@@A}{@@B}} +% \end{macrocode} +% +% \begin{macrocode} +\def\psset@nodesepA#1{\pst@getlength{#1}\psk@nodesepA} +\def\psset@nodesepB#1{\pst@getlength{#1}\psk@nodesepB} +\def\psset@nodesep#1{% + \psset@nodesepA{#1}\let\psk@nodesepB\psk@nodesepA} +\psset@nodesep{0} +% \end{macrocode} +% +% \begin{macro}{\psset@offset,\psk@offsetA,\psk@offsetB} +% \begin{macrocode} +\def\psset@offsetA#1{\pst@getlength{#1}\psk@offsetA} +\def\psset@offsetB#1{\pst@getlength{#1}\psk@offsetA} +\def\psset@offset#1{% + \psset@offsetA{#1}\let\psk@offsetB\psk@offsetA} +\psset@offset{0} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\psset@arm,\psk@armA,\psk@armB} +% \begin{macrocode} +\def\psset@armA#1{\pst@getlength{#1}\psk@armA} +\def\psset@armB#1{\pst@getlength{#1}\psk@armB} +\def\psset@arm#1{\psset@armA{#1}\let\psk@armB\psk@armA} +\psset@arm{10pt} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\psset@angle,\psk@angleA,\psk@angleB} +% \begin{macrocode} +\def\psset@angleA#1{\pst@getangle{#1}\psk@angleA} +\def\psset@angleB#1{\pst@getangle{#1}\psk@angleB}% +\def\psset@angle#1{\pst@getangle{#1}\psk@angleA + \let\psk@angleB\psk@angleA} +\psset@angle{0} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\psset@arcangle,\psk@arcangleA,\psk@arcangleB} +% \begin{macrocode} +\def\psset@arcangleA#1{\pst@getangle{#1}\psk@arcangleA} +\def\psset@arcangleB#1{\pst@getangle{#1}\psk@arcangleB}% +\def\psset@arcangle#1{\pst@getangle{#1}\psk@arcangleA + \let\psk@arcangleB\psk@arcangleA} +\psset@arcangle{8} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\psset@ncurv,\psk@ncurvA,\psk@ncurvB} +% \begin{macrocode} +\def\psset@ncurvA#1{\pst@checknum{#1}\psk@ncurvA} +\def\psset@ncurvB#1{\pst@checknum{#1}\psk@ncurvB}% +\def\psset@ncurv#1{\psset@ncurvA{#1}\let\psk@ncurvB\psk@ncurvA} +\psset@ncurv{.67} +% \end{macrocode} +% \end{macro} +% +% +% \section{Node connections: The real thing} +% +% \begin{macrocode} +\pst@def{LineMP}<% + 4 copy + 1 t sub mul exch t mul add 3 1 roll + 1 t sub mul exch t mul add exch 6 2 roll + sub 3 1 roll sub \tx@Atan> +% \end{macrocode} +% +% \begin{macro}{\tx@NCCoor,\tx@NCLine} +% Syntax: +% \begin{Ex} +% NCLine +% \end{Ex} +% Leaves coordinates on stack rather than actually drawing line. +% \begin{macrocode} +\pst@def{NCCoor}<% + \tx@GetAngle + /AngleA ED /AngleB AngleA 180 add def + \tx@GetPos + /LPutVar [ x2 x1 y2 y1 ] cvx def + /LPutPos { LPutVar \tx@LineMP } def + x1 y1 x2 y2> +\pst@def{NCLine}<% + \tx@NCCoor + tx@Dict begin + ArrowB + 4 2 roll + ArrowA + lineto + end> +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\def\ncline{\def\pst@par{}\pst@object{ncline}} +\def\ncline@i{\check@arrow{\ncline@ii}} +\def\ncline@ii#1#2{\nc@object{#1}{#2}{.5}{\tx@NCLine}} +% \end{macrocode} +% +% \begin{macrocode} +\def\pcline{\def\pst@par{}\pst@object{pcline}} +\def\pcline@i{\pc@object\ncline@ii} +% \end{macrocode} +% +% +% \begin{macrocode} +\def\ncLine{\def\pst@par{}\pst@object{ncLine}} +\def\ncLine@i{\check@arrow{\ncLine@ii}} +\def\ncLine@ii#1#2{\nc@object{#1}{#2}{.5}% + {\tx@NCLine + /LPutVar [ + nodeA \tx@GetCenter + nodeB \tx@GetCenter + 3 1 roll 4 1 roll + ] cvx def }} +% \end{macrocode} +% +% \begin{macrocode} +\pst@def{BezierMidpoint}<% + /y3 ED /x3 ED + /y2 ED /x2 ED + /y1 ED /x1 ED + /y0 ED /x0 ED + /t ED + /cx x1 x0 sub 3 mul def + /cy y1 y0 sub 3 mul def + /bx x2 x1 sub 3 mul cx sub def + /by y2 y1 sub 3 mul cy sub def + /ax x3 x0 sub cx sub bx sub def + /ay y3 y0 sub cy sub by sub def + ax t 3 exp mul bx t t mul mul add cx t mul add x0 add + ay t 3 exp mul by t t mul mul add cy t mul add y0 add + 3 ay t t mul mul mul 2 by t mul mul add cy add + 3 ax t t mul mul mul 2 bx t mul mul add cx add + atan> +% \end{macrocode} +% +% \begin{macrocode} +\pst@def{GetArms}<% + /x1a armA AngleA cos mul x1 add def + /y1a armA AngleA sin mul y1 add def + /x2a armB AngleB cos mul x2 add def + /y2a armB AngleB sin mul y2 add def> +% \end{macrocode} +% +% \begin{macrocode} +\pst@def{NCCurve}<% + \tx@GetPos + x1 x2 sub y1 y2 sub \tx@Pyth + 2 div dup + 3 -1 roll mul /armA ED mul /armB ED + \tx@GetArms + x1a y1a x1 y1 tx@Dict begin ArrowA end + x2a y2a x2 y2 tx@Dict begin ArrowB end + curveto + /LPutVar [ x1 y1 x1a y1a x2a y2a x2 y2 ] cvx def + /LPutPos { t LPutVar \tx@BezierMidpoint } def> +% \end{macrocode} +% +% \begin{macrocode} +\def\nccurve{\def\pst@par{}\pst@object{nccurve}} +\def\nccurve@i{\check@arrow{\nccurve@ii}} +\def\nccurve@ii#1#2{\nc@object{#1}{#2}{.5}{% + /AngleA \psk@angleA\space def /AngleB \psk@angleB\space def + \psk@ncurvB\space \psk@ncurvA\space + \tx@NCCurve}} +% \end{macrocode} +% +% \begin{macrocode} +\def\pccurve{\def\pst@par{}\pst@object{pccurve}} +\def\pccurve@i{\pc@object\nccurve@ii} +% \end{macrocode} +% +% +% \begin{macrocode} +\def\ncarc{\def\pst@par{}\pst@object{ncarc}} +\def\ncarc@i{\check@arrow{\ncarc@ii}} +\def\ncarc@ii#1#2{\nc@object{#1}{#2}{.5}{% + \tx@GetAngle dup + \psk@arcangleA\space add /AngleA ED + \psk@arcangleB\space sub 180 add /AngleB ED + \psk@ncurvB\space \psk@ncurvA\space + \tx@NCCurve}} +% \end{macrocode} +% +% \begin{macrocode} +\def\pcarc{\def\pst@par{}\pst@object{pcarc}} +\def\pcarc@i{\pc@object\ncarc@ii} +% \end{macrocode} +% +% \begin{macrocode} +\pst@def{AnglesMP}<% + LPutVar + t 3 gt + { /t t 3 sub def } + { t 2 gt + { /t t 2 sub def 10 -2 roll } + { t 1 gt + { /t t 1 sub def 10 -4 roll } + { 10 4 roll } + ifelse } + ifelse } + ifelse + 6 { pop } repeat + 3 -1 roll exch \tx@LineMP> +% \end{macrocode} +% +% \begin{macrocode} +\pst@def{NCAngles}<% + \tx@GetPos + \tx@GetArms + /mtrx AngleA matrix rotate def + x1a y1a mtrx transform pop + x2a y2a mtrx transform exch pop + mtrx itransform + /y0 ED /x0 ED + mark + armB 0 ne { x2 y2 } if x2a y2a x0 y0 x1a y1a armA 0 ne { x1 y1 } if + tx@Dict begin false \tx@Line end + /LPutVar [ x2 y2 x2a y2a x0 y0 x1a y1a x1 y1 ] cvx def + /LPutPos { \tx@AnglesMP } def> +% \end{macrocode} +% +% \begin{macrocode} +\def\ncangles{\def\pst@par{}\pst@object{ncangles}} +\def\ncangles@i{\check@arrow{\ncangles@ii}} +\def\ncangles@ii#1#2{% + \nc@object{#1}{#2}{1.5}{\ncangles@iii \tx@NCAngles}} +\def\ncangles@iii{% + tx@Dict begin + \ifdim\pslinearc>\z@ + /r \pst@number\pslinearc def + /Lineto { \tx@Arcto } def + \else + /Lineto { L } def + \fi + end + /AngleA \psk@angleA\space def /AngleB \psk@angleB\space def + /armA \psk@armA\space def /armB \psk@armB\space def } +% \end{macrocode} +% +% \begin{macrocode} +\def\pcangles{\def\pst@par{}\pst@object{pcangles}} +\def\pcangles@i{\pc@object\ncangles@ii} +% \end{macrocode} +% +% \begin{macrocode} +\pst@def{NCAngle}<% + \tx@GetPos + /x2a armB AngleB cos mul x2 add def + /y2a armB AngleB sin mul y2 add def + /mtrx AngleA matrix rotate def + x2a y2a mtrx transform pop + x1 y1 mtrx transform exch pop + mtrx itransform + /y0 ED /x0 ED + mark + armB 0 ne { x2 y2 } if x2a y2a x0 y0 x1 y1 + tx@Dict begin false \tx@Line end + /LPutVar [ x2 y2 x2 y2 x2a y2a x0 y0 x1 y1 ] cvx def + /LPutPos { \tx@AnglesMP } def> +% \end{macrocode} +% +% \begin{macrocode} +\def\ncangle{\def\pst@par{}\pst@object{ncangle}} +\def\ncangle@i{\check@arrow{\ncangle@ii}} +\def\ncangle@ii#1#2{% + \nc@object{#1}{#2}{1.5}{\ncangles@iii \tx@NCAngle}} +% \end{macrocode} +% +% \begin{macrocode} +\def\pcangle{\def\pst@par{}\pst@object{pcangle}} +\def\pcangle@i{\pc@object\ncangle@ii} +% \end{macrocode} +% +% \begin{macrocode} +\pst@def{NCBar}<% + \tx@GetPos + \tx@GetArms + /mtrx AngleA matrix rotate def + x1a y1a mtrx transform pop + x2a y2a mtrx transform pop sub + dup 0 mtrx itransform + 3 -1 roll 0 gt + { /y2a exch y2a add def /x2a exch x2a add def } + { /y1a exch neg y1a add def /x2a exch neg x2a add def } + ifelse + mark + x2 y2 x2a y2a x1a y1a x1 y1 + tx@Dict begin false \tx@Line end + /LPutVar [ x2 y2 x2 y2 x2a y2a x1a y1a x1 y1 ] cvx def + /LPutPos { LPutVar \tx@AnglesMP } def> +% \end{macrocode} +% +% \begin{macrocode} +\def\ncbar{\def\pst@par{}\pst@object{ncbar}} +\def\ncbar@i{\check@arrow{\ncbar@ii}} +\def\ncbar@ii#1#2{\nc@object{#1}{#2}{1.5}{% + \ncangles@iii /AngleB \psk@angleA def \tx@NCBar}} +% \end{macrocode} +% +% \begin{macrocode} +\def\pcbar{\def\pst@par{}\pst@object{pcbar}} +\def\pcbar@i{\pc@object\ncbar@ii} +% \end{macrocode} +% +% \begin{macrocode} +\pst@def{NCDiag}<% + \tx@GetPos + \tx@GetArms + mark + x2 y2 x2a y2a x1a y1a x1 y1 + tx@Dict begin false \tx@Line end + /LPutVar [ x2 y2 x2 y2 x2a y2a x1a y1a x1 y1 ] cvx def + /LPutPos { \tx@AnglesMP } def> +% \end{macrocode} +% +% \begin{macrocode} +\def\ncdiag{\def\pst@par{}\pst@object{ncdiag}} +\def\ncdiag@i{\check@arrow{\ncdiag@ii}} +\def\ncdiag@ii#1#2{% + \nc@object{#1}{#2}{1.5}{\ncangles@iii \tx@NCDiag}} +% \end{macrocode} +% +% \begin{macro}{\pcdiag} +% \begin{macrocode} +\def\pcdiag{\def\pst@par{}\pst@object{pcdiag}} +\def\pcdiag@i{\pc@object\ncdiag@ii} +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\pst@def{NCDiagg}<% + OffsetA AngleA NodesepA nodeA \tx@GetEdge + /y1 ED /x1 ED + /x1a armA AngleA cos mul x1 add def + /y1a armA AngleA sin mul y1 add def + nodeB \tx@GetCenter + y1a sub exch x1a sub \tx@Atan 180 add /AngleB ED + OffsetB AngleB NodesepB nodeB \tx@GetEdge + /y2 ED /x2 ED + mark + x2 y2 x1a y1a x1 y1 + tx@Dict begin false \tx@Line end + /LPutVar [ x2 y2 x2 y2 x2 y2 x1a y1a x1 y1] cvx def + /LPutPos { \tx@AnglesMP } def> +% \end{macrocode} +% +% \begin{macrocode} +\def\ncdiagg{\def\pst@par{}\pst@object{ncdiagg}} +\def\ncdiagg@i{\check@arrow{\ncdiagg@ii}} +\def\ncdiagg@ii#1#2{% + \nc@object{#1}{#2}{.5}{\ncangles@iii \tx@NCDiagg}} +% \end{macrocode} +% +% \begin{macro}{\pcdiagg} +% \begin{macrocode} +\def\pcdiagg{\def\pst@par{}\pst@object{pcdiagg}} +\def\pcdiagg@i{\pc@object\ncdiagg@ii} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\tx@LoopMP} +% \begin{macrocode} +\pst@def{LoopMP}<% + /t t abs def + [ LPutVar ] length 2 div 1 sub dup t lt { /t ED } { pop } ifelse + mark LPutVar + t cvi { /t t 1 sub def pop pop } repeat + counttomark 1 add 4 roll cleartomark + 3 -1 roll exch \tx@LineMP> +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\pst@def{NCLoop}<% + \tx@GetPos + \tx@GetArms + /mtrx AngleA matrix rotate def + x1a y1a mtrx transform loopsize add /y1b ED /x1b ED + /x2b x2a y2a mtrx transform pop def + x2b y1b mtrx itransform /y2b ED /x2b ED + x1b y1b mtrx itransform /y1b ED /x1b ED + mark + armB 0 ne { x2 y2 } if x2a y2a x2b y2b x1b y1b x1a y1a armA + 0 ne { x1 y1 } if + tx@Dict begin false \tx@Line end + /LPutVar [ x2 y2 x2a y2a x2b y2b x1b y1b x1a y1a x1 y1 ] cvx def + /LPutPos { \tx@LoopMP } def> +% \end{macrocode} +% +% \begin{macro}{\psset@loopsize} +% \begin{macrocode} +\def\psset@loopsize#1{\pst@getlength{#1}\psk@loopsize} +\psset@loopsize{1cm} +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\def\ncloop{\def\pst@par{}\pst@object{ncloop}} +\def\ncloop@i{\check@arrow{\ncloop@ii}} +\def\ncloop@ii#1#2{% + \nc@object{#1}{#2}{2.5}% + {\ncangles@iii /loopsize \psk@loopsize\space def \tx@NCLoop}} +% \end{macrocode} +% +% \begin{macrocode} +\def\pcloop{\def\pst@par{}\pst@object{pcloop}} +\def\pcloop@i{\pc@object\ncloop@ii} +% \end{macrocode} +% +% \begin{macro}{\tx@NCCircle} +% \begin{macrocode} +\pst@def{NCCircle}<% + nodeA \tx@GetCenter + 0 0 NodesepA nodeA \tx@GetEdge + % Stack: x-center y-center x-edge y-origin + pop 3 1 roll + /Y ED /X ED % center + X sub 2 div % half distance to edge + dup 2 exp r r mul sub abs sqrt atan 2 mul /a ED % angle to edge + r AngleA 90 add \tx@PtoC % displacement to origin + Y add exch X add exch % origin + 2 copy /LPutVar [ 4 2 roll r a ] def + /LPutPos { LPutVar aload pop t 360 mul add dup 5 1 roll + 90 sub \tx@PtoC 3 -1 roll add 3 1 roll add exch 3 -1 roll } def + r + AngleA 90 sub a add % begin arc angle + AngleA 270 add a sub % end arc angle + % Stack: x0 y0 r a1 a2 + tx@Dict begin + /angleB ED + /angleA ED + /r ED + /c 57.2957 r \tx@Div def + /y ED + /x ED> +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\def\nccircle{\def\pst@par{}\pst@object{nccircle}} +\def\nccircle@i{\check@arrow{\nccircle@ii}} +\def\nccircle@ii#1#2{% + \pssetlength\pst@dima{#2}% + \nc@object{#1}{#1}{.5}{% + /AngleA \psk@angleA def + /r \pst@number\pst@dima def + \tx@NCCircle \psarc@v end}} +% \end{macrocode} +% +% +% \section{Node Labels} +% +% +% \begin{macro}{\pst@getlputrot} +% \begin{macrocode} +\def\pst@getlputrot#1{% + \@ifnextchar(% + {\def\pst@rot{}#1}% + {\pst@@getlputrot{\@ifnextchar({#1}{#1(\lputpos@default)}}}} +\def\pst@@getlputrot#1#2{% + \pst@expandafter{\@ifnextchar:{\pst@@@getlputrot}% + {\@ifstar{\pst@@@getrot}{\pst@@getrot}}}{#2}\@nil + \ifx\pst@rotlist\@empty\else + \edef\pst@rotlist{\pst@rotlist \pst@rot add }% + \fi + #1} +\def\pst@@@getlputrot#1#2\@nil{% + \pst@@getrot#2\@nil + \edef\pst@rot{langle \ifx\pst@rot\@empty\else\pst@rot add \fi}}% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{LPutCoor} +% \begin{macrocode} +\pst@def{LPutCoor}<% + tx@NodeDict /LPutPos known + { gsave + LPutPos + tx@Dict begin + /langle ED + CM 3 1 roll + \tx@STV + CP 3 -1 roll sub neg 3 1 roll sub exch + moveto + setmatrix + CP + end + grestore } + { 0 0 tx@Dict /langle 0 def end } + ifelse> +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\psput@lput} +% \begin{macrocode} +\def\psput@lput#1#2{% + \pst@checknum{#1}\pst@tempa + \hbox{% + \pst@Verb{% + \pst@nodedict + /t \pst@tempa\space def + \tx@LPutCoor + end + \tx@PutBegin}% + \box#2% + \pst@Verb{\tx@PutEnd}}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\lput} +% \begin{macrocode} +\def\lput{\begin@psput{\pst@getref{\pst@getlputrot{\end@psput\lput@i}}}} +\def\lput@i(#1){% + \pst@makesmall\pst@hbox + \ifx\pst@rot\@empty\else\pst@rotate\pst@hbox\fi + \psput@lput{#1}\pst@hbox} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\mput} +% \begin{macrocode} +\def\mput{% + \begin@psput{\def\pst@rot{}\pst@getref{\end@psput\lput@i(\lputpos@default)}}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\aput,\Aput,\bput,\Bput} +% \begin{macrocode} +\def\aput@#1{\begin@psput{% + \def\pst@refangle{#1 }% + \@ifnextchar[{\aput@i}{\pst@getlputrot{\end@psput\aput@ii}}}} +\def\aput@i[#1]{% + \pssetlength\pslabelsep{#1}\pst@getlputrot{\end@psput\aput@ii}} +\def\aput@ii(#1){% + \uput@iv\aput@iii + \psput@lput{#1}\pst@hbox} +\def\aput@iii{exch pop add a \tx@PtoC h1 add exch w1 add exch } +\def\aput{\aput@{langle 90 add}} +\def\bput{\aput@{langle 90 sub}} +\def\Aput@#1{\begin@psput{% + \def\pst@refangle{#1 }% + \def\pst@rot{}% + \@ifnextchar[{\Aput@i}{\end@psput\aput@ii(\lputpos@default)}}} +\def\Aput@i[#1]{% + \pssetlength\pslabelsep{#1}% + \end@psput\aput@ii(\lputpos@default)} +\def\Aput{\Aput@{langle 90 add}} +\def\Bput{\Aput@{langle 90 sub}} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\Lput,\Mput} +% These are obsolete. +% \begin{macrocode} +\def\Lput{% + \begin@psput{\pst@getlabelsep{\pst@getlputrot{\end@psput{\Rput@i\lput@i}}}}} +\def\Mput{% + \begin@psput{% + \def\pst@rot{}% + \pst@getlabelsep{\end@psput{\Rput@i\lput@i}(\lputpos@default)}}} +% \end{macrocode} +% \end{macro} +% +% +% \section{Node coordinates} +% +% \begin{macro}{\node@coor} +% \begin{macrocode} +\def\node@coor#1;#2\@nil{% + \pst@getnode{#1}\pst@tempg + \edef\pst@coor{% + \pst@nodedict + tx@NodeDict \pst@tempg known + { \pst@tempg load \tx@GetCenter } + { 0 0 } + ifelse + end }} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\Node@coor} +% \begin{macrocode} +\def\Node@coor[#1]#2;#3\@nil{% + \begingroup + \psset{#1}% + \pst@getnode{#2}\pst@tempg + \xdef\pst@tempg{% + \pst@nodedict + tx@NodeDict \pst@tempg known + { \psk@offsetA \psk@angleA \psk@nodesepA \pst@tempg load \tx@GetEdge } + { 0 0 } + ifelse + end }% + \endgroup + \let\pst@coor\pst@tempg} +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\pst@ATH +\catcode`\@=\TheAtCode\relax +\endinput +% \end{macrocode} +% +% \Finale +% \endinput +% +%% END: pst-node.doc diff --git a/Master/texmf-dist/doc/generic/pstricks/code/pstricks.doc b/Master/texmf-dist/doc/generic/pstricks/code/pstricks.doc new file mode 100644 index 00000000000..e7cf2b591c9 --- /dev/null +++ b/Master/texmf-dist/doc/generic/pstricks/code/pstricks.doc @@ -0,0 +1,4739 @@ +%% BEGIN pstricks.doc +\def\fileversion{0.93a} +\def\filedate{93/03/12} +% +% File `pstricks.doc': PostScript macros for Generic TeX. +%% +%% See the PSTricks read-me file and the User's Guide for documentation. +%% +%% COPYRIGHT 1993, by Timothy Van Zandt, tvz@Princeton.EDU +%% +%% Copying of part or all of any file in the pstricks.tex package +%% is allowed under the following conditions only: +%% (1) You may freely distribute unchanged copies of the files. Please +%% include the documentation when you do so. +%% (2) You may modify a renamed copy of any file, but only for personal +%% use or use within an organization. +%% (3) You may copy fragments from the files, for personal use or for use +%% in a macro package for distribution, as long as credit is given +%% where credit is due. +%% +%% You are NOT ALLOWED to take money for the distribution or use of +%% these files or modified versions or fragments thereof, except for +%% a nominal charge for copying etc. +%% +% ************************************************************************** +% This is `pstricks.doc', which contains the documented code for the PSTricks +% package. See the PSTricks read-me file for information on how to +% use this file. +% ************************************************************************** +% +% \EndDocPreamble +% +% \CheckSum{5048} +% \CharacterTable +% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z +% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z +% Digits \0\1\2\3\4\5\6\7\8\9 +% Exclamation \! Double quote \" Hash (number) \# +% Dollar \$ Percent \% Ampersand \& +% Acute accent \' Left paren \( Right paren \) +% Asterisk \* Plus \+ Comma \, +% Minus \- Point \. Solidus \/ +% Colon \: Semicolon \; Less than \< +% Equals \= Greater than \> Question mark \? +% Commercial at \@ Left bracket \[ Backslash \\ +% Right bracket \] Circumflex \^ Underscore \_ +% Grave accent \` Left brace \{ Vertical bar \| +% Right brace \} Tilde \~} +% +% +% \section{Disclaimers, Guidelines and Other Comments} +% +% \paragraph*{Disclaimer} +% These macros are extensive and were written hurriedly. Only modest attempts +% have been made to clean up and optimize the code. The internals may change +% substantially until version 1.0 comes up. +% +% \paragraph*{PostScript Guidelines} +% The following guidelines were followed for macros using PostScript +% "\special"'s: +% \begin{enumerate} +% \item Almost no "gsave" and "grestore" commands are used (reducing the +% likelihood of conflicts with dvi-to-ps drivers or an unmatched "gsave" or +% "grestore" ending up on a page). +% \item Most end-user macros (those without "@") have error-checking so that +% bad arguments or other misuse will not generate PostScript errors. +% \end{enumerate} +% +% \iffalse +% \paragraph*{Prefixes} +% (This list is not complete.) Here are the conventions on prefixes, such as +% the "pst" is "\pst@Verb": +% \begin{center} +% \begin{tabular}{ll} +% {\em Prefix} & {\em Use}\\ +% "pst" & This and that.\\ +% "psk" & Graphics parameters ("k"={\em key}).\\ +% "psset" & Macros that set graphics parameters.\\ +% "psls" & Line styles.\\ +% "psfs" & Fill styles.\\ +% "psas" & Arrow styles.\\ +% "pscs" & Custom styles.\\ +% \end{tabular} +% \end{center} +% \fi +% +% \paragraph*{Macros} +% A ``macro'' means any command sequence that is documented in this with a +% heading entry. Macros with "@" are internal, and others are part of the user +% interface. Commands that are not in the heading preceding their definition +% are internal commands of a macro, and are not meant to be used directly by +% other macros. +% +% \paragraph*{Local and global variables} +% There are various classes of scratch registers and commands: +% \begin{description} +% \item[Global] These can be changed using "\global", etc. +% \begin{LVerbatim} +% \pst@tempg +% \pst@temph +% \pst@dimg +% \pst@dimh +% \pst@cntg +% \pst@cnth +% \pst@boxg +% \end{LVerbatim} +% +% \item[Local-I] These cannot be changed with "\global", but otherwise there +% are no restrictions. +% \begin{LVerbatim} +% \next +% \@tempa +% \end{LVerbatim} +% +% \item[Local-I] +% Changes to these must be local to the macro in which they occur (be +% grouping). +% \begin{LVerbatim} +% \pst@tempa +% \pst@tempb +% \pst@tempc +% \pst@tempd +% \end{LVerbatim} +% +% \item[Local-II] Changes to these must be local to the macro in which they +% occur, and it must be possible to use these as arguments of macros. +% \begin{LVerbatim} +% \pst@dima +% \pst@dimb +% \pst@dimc +% \pst@dimd +% \if@pst +% \end{LVerbatim} +% There is one exception. When using these in coordinates that are processed +% directly as Cartesian coordinates rather than with "\pst@getcoor", they must +% be used in this order: +% \begin{LVerbatim} +% (\pst@dima,\pst@dimb)(\pst@dimc,\pst@dimd) +% \end{LVerbatim} +% +% \item[Shared] These are used to share information between macros. Their +% value may be set by one macro and then used by another. Use with care. Do +% not set with "\global". +% \begin{quote} +% \begin{tabular}{ll} +% \em command & \em usage\\ +% "\pst@hbox" & Box created and manipulated in HR-box macros.\\ +% "\pst@coor" & PostScript code for a coordinate.\\ +% "\pst@angle" & PostScript code for an angle.\\ +% "\pst@rot" & PostScript code for a rotation angle.\\ +% "\if@star" & This is a flag to keep track of optional "*". +% \end{tabular} +% \end{quote} +% +% \end{description} +% +% \paragraph*{Plain \TeX\ commands} +% The commands +% \begin{LVerbatim} +% \newbox +% \newcount +% \newdimen +% \newif +% \loop ... \repeat ... \fi +% \z@ +% \sixt@@n +%\end{LVerbatim} +% are defined in "plain.tex" are part of most macro packages. PSTricks assumes +% that they are defined. Other than these, PSTricks only makes use of \TeX\ +% primitives. +% +% \paragraph*{Dividing the file} +% +% {\bf\em Breaking up the file}\hskip 1em "pstricks.tex" can be broken up into +% the following components: +% \begin{description} +% \item[Basics] (Including color and simple rotation.) Sections \ref{Prelim}, +% \ref{Config}, \ref{Header}, \ref{Errors}, \ref{Colors}, \ref{Colortab}, +% \ref{Rotation:simple} and \ref{Config:revisited}. +% \item[Graphics] Sections \ref{Parameters}, \ref{Objects}, \ref{Linestyles}, +% \ref{Arrowheads}, \ref{Lines}, \ref{Grids}, \ref{Fillstyles}, \ref{Frames}, +% \ref{Frameboxes} and \ref{Circles}. Requires also {\bf Basics}. +% \item[Rotation] (Including picture environment.) Sections \ref{Arithmetic}, +% \ref{Rotation:prelim}, \ref{Rotation:main} and \ref{Pictures}. Requires also +% {\bf Basics}. +% \end{description} +% + +% \section{Preliminaries\label{Prelim}} +% +% Check whether file has been loaded already. +% \begin{macrocode} +\csname PSTricksLoaded\endcsname +\let\PSTricksLoaded\endinput +% \end{macrocode} +% +% Take care of the catcode of "@": +% \begin{macrocode} +\edef\PstAtCode{\the\catcode`\@} +\catcode`\@=11\relax +% \end{macrocode} +% +% Here are some hacks borrowed from \LaTeX{}, which are defined if \LaTeX{} is +% not being used. +% +% \begin{macrocode} +\expandafter\ifx\csname @latexerr\endcsname\relax + \long\def\@ifundefined#1#2#3{\expandafter\ifx\csname + #1\endcsname\relax#2\else#3\fi} + \def\@namedef#1{\expandafter\def\csname #1\endcsname} + \def\@nameuse#1{\csname #1\endcsname} + \def\@eha{% + Your command was ignored.^^J + Type \space I \space to replace + it with another command,^^J + or \space \space to continue without it.} + \def\@spaces{\space\space\space\space} + \def\typeout#1{\immediate\write\@unused{#1}} + \alloc@7\write\chardef\sixt@@n\@unused + \def\@empty{} + \def\@gobble#1{} + \def\@nnil{\@nil} + \def\@ifnextchar#1#2#3{% + \let\@tempe#1\def\@tempa{#2}\def\@tempb{#3}\futurelet\@tempc\@ifnch} + \def\@ifnch{% + \ifx\@tempc\@sptoken + \let\@tempd\@xifnch + \else + \ifx\@tempc\@tempe \let\@tempd\@tempa \else \let\@tempd\@tempb \fi + \fi + \@tempd} + \begingroup + \def\:{\global\let\@sptoken= } \: + \def\:{\@xifnch} \expandafter\gdef\: {\futurelet\@tempc\@ifnch} + \endgroup +\fi +% \end{macrocode} +% +% Announce that the file is being loaded: +% \begin{macrocode} +\typeout{`PSTricks' v\fileversion\space\space <\filedate> (tvz)} +% \end{macrocode} +% +% +% \section{Error messages} +% +% \begin{macro}{\@pstrickserr} +% "\@pstrickserr" is analogous to "\@latexerr". +% \begin{macrocode} +\def\@pstrickserr#1#2{% + \begingroup + \newlinechar`\^^J + \edef\pst@tempc{#2}% + \expandafter\errhelp\expandafter{\pst@tempc}% + \typeout{% + PSTricks error. \space See User's Guide for further information.^^J + \@spaces\@spaces\@spaces\@spaces + Type \space H \space for immediate help.}% + \errmessage{#1}% + \endgroup} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@ehpa,\@ehpb,\@ehpc} +% Here are some extra "\errhelp" message: +% \begin{macrocode} +\def\@ehpa{% + Your command was ignored. Default value substituted.^^J + Type \space \space to procede.} +\def\@ehpb{% + Your command was ignored. Will recover best I can.^^J + Type \space \space to procede.} +\def\@ehpc{% + You better fix this before proceding.^^J + See the PSTricks User's Guide or ask your system administrator for help.^^J + Type \space X \space to quit.} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pst@misplaced} +% \begin{macrocode} +\def\pst@misplaced#1{\@pstrickserr{Misplaced \string#1 command}\@ehpb} +% \end{macrocode} +% \end{macro} +% +% \section{Scratch registers} +% +% \begin{macrocode} +\newdimen\pst@dima +\newdimen\pst@dimb +\newdimen\pst@dimc +\newdimen\pst@dimd +\newdimen\pst@dimg +\newdimen\pst@dimh +\newbox\pst@hbox +\newbox\pst@boxg +\newcount\pst@cnta +\newcount\pst@cntb +\newcount\pst@cntc +\newcount\pst@cntd +\newcount\pst@cntg +\newcount\pst@cnth +\newif\if@pst +% \end{macrocode} +% +% +% \section{Useful hacks} +% +% \begin{macro}{\pst@ifstar,\if@star} +% \begin{macrocode} +\newif\if@star +\def\pst@ifstar#1{% + \@ifnextchar*{\@startrue\def\next*{#1}\next}{\@starfalse#1}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pst@expandafter} +% \begin{macrocode} +\def\pst@expandafter#1#2{% + \def\next{#1}% + \edef\@tempa{#2}% + \ifx\@tempa\@empty + \@pstrickserr{Unexpected empty argument!}\@ehpb + \def\@tempa{\@empty}% + \fi + \expandafter\next\@tempa} +% \end{macrocode} +% \end{macro} +% +% +% \section{Arithmetic} +% +% \begin{macro}{\pst@dimtonum,\pst@@dimtonum} +% This macro strips the value of "#1", a dimension register, of the "pt", and +% assigns the result to "#2", a command sequence. This is used for arithmetic +% and for converting \TeX\ dimensions to PostScript. +% \begin{macrocode} +\def\pst@dimtonum#1#2{\edef#2{\pst@@dimtonum#1}} +\def\pst@@dimtonum#1{\expandafter\pst@@@dimtonum\the#1} +{\catcode`\p=12 \catcode`\t=12 \global\@namedef{pst@@@dimtonum}#1pt{#1}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pst@pyth} +% This is a piecewise-linear approximation to $("#1"^2+"#2"^2)^(1/2)$. The +% answer is assigned to "#3". All arguments should be dimension registers. +% \begin{macrocode} +\def\pst@pyth#1#2#3{% + \ifdim#1>#2\pst@@pyth#1#2#3\else\pst@@pyth#2#1#3\fi} +\def\pst@@pyth#1#2#3{% + \ifdim4#1>9#2% + #3=#1\advance#3 .2122#2% + \else + #3=.8384#1\advance#3 .5758#2% + \fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pst@divide} +% This computes "#3"="#1"/"#2" reasonably quickly. "#1" and "#2" should be +% dimensions, and "#3" should be a command sequence. +% \begin{macrocode} +\def\pst@divide#1#2#3{% + \begingroup + \pst@dimg=#1\relax\pst@dimh=#2\relax + \pst@cnta=\pst@dimg + \pst@cntb=1073741824 + \pst@cntc=65536 + \def\pst@tempa{\fi\ifnum}% + \loop\ifnum\pst@cnta<\pst@cntb + \pst@tempa\pst@cntc>\@ne + \multiply\pst@cnta2\divide\pst@cntc2 + \repeat + \divide\pst@dimh\pst@cntc + \divide\pst@cnta\pst@dimh + \global\pst@dimg\number\pst@cnta sp + \endgroup + \pst@dimtonum\pst@dimg#3} +% \end{macrocode} +% \end{macro} +% +% +% \section{Configuration file\label{Config}} +% +% \begin{macro}{\pst@configerr} +% \begin{macrocode} +\def\pst@configerr#1{% + \@pstrickserr{\string#1 not defined in pstricks.con}\@ehpc} +% \end{macrocode} +% \end{macro} +% +% % \begin{macrocode} +\def\pstVerb#1{\pst@configerr\pstVerb} +\def\pstverb#1{\pst@configerr\pstverb} +\def\pstverbscale{\pst@configerr\pstverbscale} +\def\pstrotate{\pst@configerr\pstrotate} +\def\pstheader#1{\pst@configerr\pstheader} +\def\pstdriver{\pst@configerr\pstdriver} +\@ifundefined{pstcustomize}% + {\def\pstcustomize{\endinput\let\pstcustomize\relax}}{} +\input pstricks.con +% \end{macrocode} +% +% \begin{macro}{\PSTricksOff} +% \begin{macrocode} +\newif\ifPSTricks +\PSTrickstrue +\def\PSTricksOff{% + \def\pstheader##1{}% + \def\pstverb##1{}% + \def\pstVerb##1{}% + \PSTricksfalse} +% \end{macrocode} +% \end{macro} +% +% \section{PostScript header file\label{Header}} +% +% \begin{macro}{\pst@def,\pst@ATH,\pst@useheader} +% There are three ways to use PSTricks: +% \begin{enumerate} +% \item Use "pstricks.doc" directly. No header file is used. +% \item Use "\pst-make.tex" to generate a stripped input file for use without +% a header. +% \item Use "\pst-make.tex" to generate a header and a stripped input file for +% use with the header. +% \end{enumerate} +% PSTricks has been optimized for use with a header file (and the difference +% is speed and memory is very significant), but the flexible system described +% above makes it easier to maintain the code and allows one to use PSTricks +% with a DVI-to-PS driver that does not support header files. +% +% The following commands should be used in this ".doc" file for PostScript +% macros and other goodies related to the header file. Their behavior for each +% of the three cases list above is given below. These commands should always +% come {\em at the beginning of the line}, and should not inside conditionals. +% +% \begin{itemize} +% +% \item "\pst@def{foo}" +% \begin{enumerate} +% \item "\tx@foo" is defined to be "bar". +% \item Writes +% \begin{LVerbatim} +% \def\tx@foo{bar} +% \end{LVerbatim} +% to "pstricks.tex". +% \item Writes +% \begin{LVerbatim} +% /foo { bar } def +% \end{LVerbatim} +% to "pstricks.pro" and +% \begin{LVerbatim} +% \def\tx@foo{foo} +% \end{LVerbatim} +% to "pstricks.tex". +% \end{enumerate} +% +% \item "\pst@ATH" +% \begin{enumerate} +% \item Gobbles "foo". +% \item Ignores line. +% \item Writes "foo" to "pstricks.pro". +% \end{enumerate} +% Note: "\pst@ATH" must come at the beginning of the line. +% +% \item "\ifx\pst@useheader\iftrue foo \else bar \fi" +% \begin{enumerate} +% \item Ignores "foo" and includes "bar". +% \item Ignores "foo" and processes "bar". +% \item Processes "foo" and ignores "bar". +% \end{enumerate} +% Note: "\ifx\pst@useheader\iftrue", "\else" and "\fi" must each be on their +% own line. +% +% \end{itemize} +% +% "pst@make.tex" can be used to process other files at well, in the right +% order. +% +% \begin{macrocode} +\@ifundefined{pst@def}{\def\pst@def#1<#2>{\@namedef{tx@#1}{#2 }}}{} +\@ifundefined{pst@ATH}{\def\pst@ATH<#1>{}}{} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pst@dict} +% The PostScript dictionary "tx@Dict" is set up in the header file, if one is +% used. Otherwise, it is set up with each procedure that uses the dictionary, +% if it is not currently defined. +% \begin{macrocode} +\pst@ATH<\% Version \fileversion, \filedate.> +\pst@ATH<\% For use with \pstdriver.> +\pst@ATH +\pst@ATH +\pst@ATH +\pst@ATH +\pst@ATH +\pst@ATH +\pst@ATH +\pst@ATH +\pst@ATH +\ifx\pst@useheader\iftrue + \pstheader{pstricks.pro} + \def\pst@dict{tx@Dict begin } + \def\pst@theheaders{pstricks.pro} +\else + \def\pst@dict{% + /tx@Dict where + { pop tx@Dict begin} + { userdict begin + /tx@Dict 200 dict def + end + tx@Dict begin + /ADict 25 dict def + /CM { matrix currentmatrix } bind def + /SLW /setlinewidth load def + /CLW /currentlinewidth load def + /CP /currentpoint load def + /ED { exch def } bind def + /L /lineto load def } + ifelse } + \def\pst@theheaders{}% +\fi +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pst@Verb} +% \begin{macrocode} +\def\pst@Verb#1{\pstVerb{\pst@dict #1 end}} +% \end{macrocode} +% \end{macro} +% +% +% \section{PostScript hacks} +% +% +% \begin{macro}{\tx@Atan,\tx@Div} +% These are variants of "atan", and "div", that recover when result is not +% defined. +% \begin{macrocode} +\pst@def{Atan} +\pst@def{Div} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\tx@NET} +% \begin{macrocode} +\pst@def{NET} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\tx@Pyth} +% $A$ $B$ "Pyth" $(A^2 + B^2)^{1/2}$ +% \begin{macrocode} +\pst@def{Pyth} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\tx@PtoC} +% Polar to Cartesian: +% \begin{LVerbatim} +% PtoC +% \end{LVerbatim} +% \begin{macrocode} +\pst@def{PtoC}<2 copy cos mul 3 1 roll sin mul> +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\tx@PathLength} +% "PathLength" is taken from the Blue Book. It leaves on the stack the length +% of the current path. +% \begin{macrocode} +\pst@def{PathLength@}<% + /z z y y1 sub x x1 sub \tx@Pyth add def + /y1 y def /x1 x def> +\pst@def{PathLength}<% + flattenpath /z 0 def + { /y1 ED /x1 ED /y2 y1 def /x2 x1 def } % moveto + { /y ED /x ED \tx@PathLength@ } % lineto + {} % curveto; ignore because of flattenpath. + { /y y2 def /x x2 def \tx@PathLength@ } % closepath + pathforall z> +% \end{macrocode} +% \end{macro} +% +% +% \section{Converting \TeX\ things to PostScript} +% +% \begin{macro}{\pst@number,\tx@STP,\tx@STV} +% \begin{itemize} +% \item PSTricks' PostScript unit is 1pt, rather than 1bp, because this is +% more efficient. +% \item "\pst@number{}" converts to PostScript, in +% points (pt). +% \item "\tx@STP" scales the DVI-to-PS driver's "\pstverb" environment to +% points (pt). +% \item "\tx@STV" scales the DVI-to-PS drivers's ungrouped PostScript +% "\special" environment ("\pstVerb") to points (pt). +% \end{itemize} +% \begin{macrocode} +\pst@dimg=\pstunit\relax +\ifdim\pst@dimg=1bp + \def\pst@stp{.996264 dup scale} +\else + \edef\pst@stp{1 \pst@@dimtonum\pst@dimg\space div dup scale} +\fi +\pst@def{STP}<\pst@stp> +\pst@def{STV}<\pstverbscale\space\tx@STP> +\def\pst@number#1{\pst@@dimtonum#1\space} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pst@checknum} +% The first argument of "\pst@checknum" should be a number, and the second +% argument is a command. There are three possible outcomes: +% \begin{enumerate} +% \item The number is suitable for PostScript consumption, the command is set +% to the number, and "\pst@num" is set to "1" if the number is positive and to +% "2" if the number is negative. +% \item "\pst@checknum" detects that the number is not suitable for +% PostScript; "\pst@num" is set to "0", an error is given, and the command is +% defined to be {\tt 0 }. +% \item The number is not suitable for PostScript consumption, but +% "\pst@checknum" does not detect this. "\pst@num" is set to "1" or "2", and +% the command is set to some number that {\em is} suitable for PostScript. +% \end{enumerate} +% +% A trailing space is always added. +% +% "\pst@checknum" should generate no extraneous errors nor output, even if the +% first argument is a bad number. +% +% This macro is probably pretty close to optimal for what it does, as many +% variations have been tried. +% +% \begin{macrocode} +\def\pst@checknum#1#2{% + \edef\next{#1}% + \ifx\next\@empty + \let\pst@num\z@ + \else + \expandafter\pst@@checknum\next..\@nil + \fi + \ifnum\pst@num=\z@ + \@pstrickserr{Bad number: `#1'. 0 substituted.}\@ehpa + \def#2{0 }% + \else + \edef#2{\ifnum\pst@num=2 -\fi\the\pst@cntg.% + \expandafter\@gobble\the\pst@cnth\space}% + \fi} +\def\pst@@checknum{% + \@ifnextchar-% + {\def\pst@num{2}\expandafter\pst@@@checknum\@gobble}% + {\def\pst@num{1}\pst@@@checknum}} +\def\pst@@@checknum#1.#2.#3\@nil{% + \afterassignment\pst@@@@checknum\pst@cntg=0#1\relax\@nil + \afterassignment\pst@@@@checknum\pst@cnth=1#2\relax\@nil} +\def\pst@@@@checknum#1\relax\@nil{% + \ifx\@nil#1\@nil\else\let\pst@num\z@\fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pst@getnumii,\pst@getnumiii,\pst@getnumiv} +% These are for processing comma-separated lists of numbers. They assign the +% numbers to "\pst@tempg", "\pst@temph", etc. Use like +% \begin{LVerbatim} +% \pst@expandafter\pst@getnumiii{foo} {} {} {} {}\@ni +% \end{LVerbatim} +% If there are too few numbers, an error results. If there are too many, the +% extra numbers are ignored. +% \begin{macrocode} +\def\pst@getnumii#1 #2 #3\@nil{% + \pst@checknum{#1}\pst@tempg + \pst@checknum{#2}\pst@temph} +\def\pst@getnumiii#1 #2 #3 #4\@nil{% + \pst@checknum{#1}\pst@tempg + \pst@checknum{#2}\pst@temph + \pst@checknum{#3}\pst@tempi} +\def\pst@getnumiv#1 #2 #3 #4 #5\@nil{% + \pst@checknum{#1}\pst@tempg + \pst@checknum{#2}\pst@temph + \pst@checknum{#3}\pst@tempi + \pst@checknum{#4}\pst@tempj} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pst@getdimnum} +% Like "\pst@getnumii", but first item is a dimension and second is a number. +% \begin{macrocode} +\def\pst@getdimnum#1 #2 #3\@nil{% + \pssetlength\pst@dimg{#1}% + \pst@checknum{#2}\pst@tempg} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pst@getscale} +% "\pst@getscale" can have one or two numbers in its first argument. +% \begin{macrocode} +\def\pst@getscale#1#2{% + \pst@expandafter\pst@getnumii{#1 #1} {} {} {}\@nil + \edef#2{\pst@tempg\space \pst@temph\space scale }% + \ifdim\pst@tempg\p@=\z@ + \@pstrickserr{Bad scaling argument `#1'}\@ehpa + \def#2{}% + \else + \ifdim\pst@temph\p@=\z@ + \@pstrickserr{Bad scaling argument}\@ehpa + \def#2{}% + \else + \ifdim\pst@tempg\p@=\p@ \ifdim\pst@temph\p@=\p@ \def#2{}\fi\fi + \fi + \fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pst@getint} +% \begin{macrocode} +\def\pst@getint#1#2{% + \pst@cntg=#1\relax + \edef#2{\the\pst@cntg\space}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pslbrace,\psrbrace} +% When balanced braces are used, they work without problems in "\special"'s. +% "\pslbrace" and "\psrbrace" let you use unbalanced braces. +% \begin{macrocode} +\begingroup + \catcode`\{=12 + \catcode`\}=12 + \catcode`\[=1 + \catcode`\]=2 + \gdef\pslbrace[{ ] + \gdef\psrbrace[} ] +\endgroup +% \end{macrocode} +% \end{macro} +% +% +% \section{Colors\label{Colors}} +% +% \begin{macro}{\@newcolor} +% "\@newcolor{}{}", where is a name and is the +% associated PostScript color specification , sets +% \begin{itemize} +% \item "\" to "\pst@color{}", and +% \item "\color@" to . +% \end{itemize} +% Then "\" can be used by the user to color text, etc., and +% "\color@" is used by PSTricks graphics objects to find the +% specification for . +% \begin{macrocode} +\def\@newcolor#1#2{% + \expandafter\edef\csname #1\endcsname{\noexpand\pst@color{#2}}% + \expandafter\edef\csname color@#1\endcsname{#2}% + \ignorespaces} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pst@color,\pst@endcolor} +% The argument of "\pst@color" should be a PostScript command for setting the +% color; e.g., "0 setgray". It saves the command in "\pst@currentcolor", and +% then switches to "\pst@currentcolor" at the end of the current group. The +% color changes do not extend across pages, although this capability could be +% written into the output routines (so that "\pst@currentcolor" is set at the +% beginning of the page, and headers and footers begin with "\black", etc.). +% Moving boxes cause problems, but there is no way around this until \TeX{} +% supports color internally. +% \begin{macrocode} +\def\pst@color#1{% + \def\pst@currentcolor{#1}\pstVerb{#1}\aftergroup\pst@endcolor} +\def\pst@endcolor{\pstVerb{\pst@currentcolor}} +\def\pst@currentcolor{0 setgray} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\altcolormode,\pst@grestore} +% The color macros defined above can conflict with other color macros. +% "\altcolormode" sets up a different scheme that uses "gsave" and "grestore" +% to reset colors. This may reduce the likelihood of such conflict. It also +% makes moving boxes less of a problem, as long as the color command is itself +% grouped within the box. However, if the scope of a color command extends +% across pages in a \TeX{} input file, unmatched "gsave"'s and "grestore"'s +% will be left on pages, wreaking havok on the output. "\pst@grestore" is +% defined to do various things that makes using "grestore" more robust. +% \begin{macrocode} +\def\altcolormode{% + \def\pst@color##1{% + \pstVerb{gsave ##1}\aftergroup\pst@endcolor}% + \def\pst@endcolor{\pstVerb{\pst@grestore}}} +\def\pst@grestore{% + currentpoint + matrix currentmatrix + currentfont + grestore + setfont + setmatrix + moveto} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pst@usecolor} +% This looks up the color specification. +% \begin{macrocode} +\def\pst@usecolor#1{\csname color@#1\endcsname\space} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\newgray} +% "\newgray" uses PostScript's "setgray" operator. +% \begin{macrocode} +\def\newgray#1#2{% + \pst@checknum{#2}\pst@tempg + \@newcolor{#1}{\pst@tempg setgray}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\newrgbcolor} +% This works like "\newgray", but the color specification should consist of 3 +% numbers rather than just 1, and the "setrgbcolor" operator is used. +% \begin{macrocode} +\def\newrgbcolor#1#2{% + \pst@expandafter\pst@getnumiii{#2} {} {} {} {}\@nil + \@newcolor{#1}{\pst@tempg \pst@temph \pst@tempi setrgbcolor}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\newhsbcolor} +% This is just like "\newrgbcolor", but the "sethsbcolor" operator is used. +% \begin{macrocode} +\def\newhsbcolor#1#2{% + \pst@expandafter\pst@getnumiii{#2} {} {} {} {}\@nil + \@newcolor{#1}{\pst@tempg \pst@temph \pst@tempi sethsbcolor}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\newcmykcolor} +% This is like "\newrgbcolor", the color specification consists of 4 numbers +% and the "setcmykcolor" operator is used. +% \begin{macrocode} +\def\newcmykcolor#1#2{% + \pst@expandafter\pst@getnumiv{#2} {} {} {} {} {}\@nil + \@newcolor{#1}{\pst@tempg \pst@temph \pst@tempi \pst@tempj setcmykcolor}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\black,\darkgray,\gray,\lightgray,\white} +% Here are some default gray definitions: +% \begin{macrocode} +\newgray{black}{0} +\newgray{darkgray}{.25} +\newgray{gray}{.5} +\newgray{lightgray}{.75} +\newgray{white}{1} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\red,\green,\blue,\yellow,\cyan,\magenta} +% And some default rgb color definitions. +% \begin{macrocode} +\newrgbcolor{red}{1 0 0} +\newrgbcolor{green}{0 1 0} +\newrgbcolor{blue}{0 0 1} +\newrgbcolor{yellow}{1 1 0} +\newrgbcolor{cyan}{0 1 1} +\newrgbcolor{magenta}{1 0 1} +% \end{macrocode} +% \end{macro} +% +% +% \section{Setting graphics parameters\label{Parameters}} +% +% \begin{macro}{\psset} +% For each "=" pair in its argument, "\psset" invokes +% \begin{LVerbatim} +% \psset@{} +% \end{LVerbatim} +% The value is processed and typically stored in "\ps" if the +% value is user-accessible and "\psk@" if not. "\psset" ignores +% spaces that follow the comma that separates key-value pairs. +% +% When initializing in this file, preferable use +% \begin{LVerbatim} +% \psset@{} +% \end{LVerbatim} +% so that default values can be easily extracted for the {\em User's Guide}. +% \begin{macrocode} +\def\psset#1{\@psset#1,\@nil\ignorespaces} +\def\@psset#1,{% + \@@psset#1==\@nil + \@ifnextchar\@nil{\@gobble}{\@psset}} +\def\@@psset#1=#2=#3\@nil{% + \@ifundefined{psset@#1}% + {\@pstrickserr{Graphics parameter `#1' not defined.}\@ehpa}% + {\@nameuse{psset@#1}{#2}}}% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\newpsstyle} +% \begin{macrocode} +\def\psset@style#1{% + \@ifundefined{pscs@#1}% + {\@pstrickserr{Custom style `#1' undefined}\@ehpa}% + {\@nameuse{pscs@#1}}} +\def\newpsstyle#1#2{\@namedef{pscs@#1}{\psset{#2}}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@none} +% Use to check when a parameter value is "none". +% \begin{macrocode} +\def\@none{none} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pst@getcolor} +% This is used by various graphics parameters that are colors. +% \begin{macrocode} +\def\pst@getcolor#1#2{% + \@ifundefined{color@#1}% + {\@pstrickserr{Color `#1' not defined}\@eha}% + {\edef#2{#1}}} +% \end{macrocode} +% \end{macro} +% +% +% \section{Dimensions} +% +% \begin{macro}{\psunit,\psxunit,\psyunit} +% \begin{macrocode} +\newdimen\psunit \psunit 1cm +\newdimen\psxunit \psxunit 1cm +\newdimen\psyunit \psyunit 1cm +\let\psrunit\psunit +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pssetlength,\psaddtolength,\pssetxlength,\pssetylength} +% \begin{macrocode} +\def\pstunit@off{\let\@psunit\ignorespaces\ignorespaces} +\def\pssetlength#1#2{% + \let\@psunit\psunit + \afterassignment\pstunit@off + #1 #2\@psunit} +\def\psaddtolength#1#2{% + \let\@psunit\psunit + \afterassignment\pstunit@off + \advance#1 #2\@psunit} +\def\pssetxlength#1#2{% + \let\@psunit\psxunit + \afterassignment\pstunit@off + #1 #2\@psunit} +\def\pssetylength#1#2{% + \let\@psunit\psyunit + \afterassignment\pstunit@off + #1 #2\@psunit} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\psset@unit,\psset@xunit,\psset@yunit} +% \begin{macrocode} +\def\psset@unit#1{% + \pssetlength\psunit{#1}% + \psxunit=\psunit + \psyunit=\psunit} +\def\psset@runit#1{\pssetlength\psrunit{#1}} +\def\psset@xunit#1{\pssetxlength\psxunit{#1}} +\def\psset@yunit#1{\pssetylength\psyunit{#1}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pst@getlength,pst@@getlength} +% "#1" is a \TeX\ dimensions. "\pst@getlength" sets "#2" to the PostScript +% code for "#1", and "\pst@@getlength" set "#2" to the \TeX\ code for "#1". +% \begin{macrocode} +\def\pst@getlength#1#2{% + \pssetlength\pst@dimg{#1}% + \edef#2{\pst@number\pst@dimg}} +\def\pst@@getlength#1#2{% + \pssetlength\pst@dimg{#1}% + \edef#2{\number\pst@dimg sp}} +% \end{macrocode} +% \end{macro} +% +% +% \section{Normal Coordinates and angles} +% +% \begin{macro}{\pst@getcoor,\pst@coor} +% "\pst@@getcoor" should be defined to read a coordinate and convert it to +% PostScript, assigning the result to "\pst@coor" (including the trailing +% space). +% +% "\pst@getcoor" invokes "\pst@@getcoor" and then sets its second argument to +% "\pst@coor". +% \begin{macrocode} +\def\pst@getcoor#1#2{\pst@@getcoor{#1}\let#2\pst@coor} +\def\pst@coor{0 0 } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pst@getcoors,\pst@coors} +% "\pst@getcoors" reads coordinates until there are none left, adding them +% {\em in reverse order} to "\pst@coors". +% \begin{macrocode} +\def\pst@getcoors#1#2{% + \def\pst@aftercoors{\addto@pscode{#1 \pst@coors }#2}% + \def\pst@coors{}% + \pst@@getcoors} +\def\pst@@getcoors(#1){% + \pst@@getcoor{#1}% + \edef\pst@coors{\pst@coor\pst@coors}% + \@ifnextchar({\pst@@getcoors}{\pst@aftercoors}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pst@getangle,\pst@angle} +% \n\pst@@getangle\ should be defined to read an angle and convert it to +% PostScript, assigning the result to \n\pst@angle\ (including the trailing +% space). +% +% \n\pst@getangle\ invokes \n\pst@@getangle\ and then sets its second argument +% to \n\pst@angle. +% \begin{macrocode} +\def\pst@getangle#1#2{\pst@@getangle{#1}\let#2\pst@angle} +\def\pst@angle{0 } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{getcoor@c,\NormalCoor} +% By default, coordinates are read as Cartesian coordinates by +% "\cartesian@coor". +% +% Angles are read as numbers, scaled by \n\pst@angleunit. +% +% "\NormalCoor" sets these two defaults, and also defines the translation for +% the put commands to be done by \TeX\ using Cartesian coordinates. +% \begin{macrocode} +\def\cartesian@coor#1,#2,#3\@nil{% + \pssetxlength\pst@dimg{#1}% + \pssetylength\pst@dimh{#2}% + \edef\pst@coor{\pst@number\pst@dimg \pst@number\pst@dimh}} +\def\NormalCoor{% + \def\pst@@getcoor##1{\pst@expandafter\cartesian@coor{##1},\relax,\@nil}% + \def\pst@@getangle##1{% + \pst@checknum{##1}\pst@angle + \edef\pst@angle{\pst@angle \pst@angleunit}}% + \def\psput@##1{\pst@@getcoor{##1}\leavevmode\psput@cartesian}} +\NormalCoor +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pst@angleunit,\degrees,\radians} +% "\degrees" sets "\pst@angleunit" to the PostScript code for scaling the +% angle, including the trailing space. +% \begin{macrocode} +\def\degrees{\@ifnextchar[{\@degrees}{\def\pst@angleunit{}}} +\def\@degrees[#1]{% + \pst@checknum{#1}\pst@tempg + \edef\pst@angleunit{360 \pst@tempg div mul }% + \ignorespaces} +\def\radians{\def\pst@angleunit{57.2956 mul }} +\def\pst@angleunit{} +% \end{macrocode} +% \end{macro} +% +% +% \section{Special coordinates and angles} +% +% This is a tedious but useful. +% +% \begin{macro}{\SpecialCoor} +% \begin{macrocode} +\def\SpecialCoor{% + \def\pst@@getcoor##1{\pst@expandafter\special@coor{##1}||\@nil}% + \def\pst@@getangle##1{\pst@expandafter\special@angle{##1}\@empty)\@nil}% + \def\psput@##1{\pst@@getcoor{##1}\leavevmode\psput@special}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\specialcoor} +% \begin{macrocode} +\def\special@coor#1|#2|#3\@nil{% + \ifx#3|\relax + \mixed@coor{#1}{#2}% + \else + \special@@coor#1;;\@nil + \fi} +\def\special@@coor#1{% + \ifcat#1a\relax + \def\next{\node@coor#1}% + \else + \ifx#1[\relax + \def\next{\Node@coor[}% + \else + \ifx#1!\relax + \def\next{\raw@coor}% + \else + \def\next{\special@@@coor#1}% + \fi + \fi + \fi + \next} +\def\special@@@coor#1;#2;#3\@nil{% + \ifx#3;\relax + \polar@coor{#1}{#2}% + \else + \cartesian@coor#1,\relax,\@nil + \fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\mixed@coor} +% This allows mixing of coordinate types with \n\SpecialCoor. +% \begin{macrocode} +\def\mixed@coor#1#2{% + \begingroup + \specialcoor@ii#1;;\@nil + \let\pst@tempa\pst@coor + \specialcoor@ii#2;;\@nil + \xdef\pst@tempg{\pst@tempa pop \pst@coor exch pop }% + \endgroup + \let\pst@coor\pst@tempg} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\polar@coor} +% For polar coordinates +% \begin{macrocode} +\def\polar@coor#1#2{% + \pssetlength\pst@dimg{#1}% + \pst@@getangle{#2}% + \edef\pst@coor{\pst@number\pst@dimg \pst@angle \tx@PtoC}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\raw@coor} +% For raw PostScript. +% \begin{macrocode} +\def\raw@coor#1;#2\@nil{% + \edef\pst@coor{% + #1 \pst@number\psyunit mul exch \pst@number\psxunit mul exch }} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\node@coor,\Node@coor} +% These are defined in "pst-node.tex". +% \begin{macrocode} +\def\node@coor#1\@nil{% + \@pstrickserr{You must load `pst-node.tex' to use node coordinates.}\@ehps + \def\pst@coor{0 0 }} +\def\Node@coor{\node@coor} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\special@angle} +% \begin{macrocode} +\def\special@angle#1#2)#3\@nil{% + \ifx#1!\relax + \edef\pst@angle{#2 \pst@angleunit}% + \else + \ifx#1(\relax + \pst@@getcoor{#2}% + \edef\pst@angle{\pst@coor exch \tx@Atan}% + \else + \pst@checknum{#1#2}\pst@angle + \edef\pst@angle{\pst@angle \pst@angleunit}% + \fi + \fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\Cartesian,\Polar} +% These are obsolete. +% \begin{macrocode} +\def\Cartesian{% + \def\cartesian@coor##1,##2,##3\@nil{% + \pssetxlength\pst@dimg{##1}% + \pssetylength\pst@dimh{##2}% + \edef\pst@coor{\pst@number\pst@dimg \pst@number\pst@dimh}}% + \@ifnextchar({\Cartesian@}{}} +\def\Cartesian@(#1,#2){% + \pssetxlength\psxunit{#1}% + \pssetylength\psyunit{#2}% + \ignorespaces} +\def\Polar{% + \def\psput@cartesian{\psput@special}% + \def\cartesian@coor##1,##2,##3\@nil{\polar@coor{##1}{##2}}}% +% \end{macrocode} +% \end{macro} +% +% +% \section{Basic graphics parameters} +% +% +% \begin{macro}{\psset@origin,\psk@origin} +% \begin{macrocode} +\def\psset@origin#1{% + \pst@@getcoor{#1}% + \edef\psk@origin{\pst@coor \tx@NET }} +\def\psk@origin{} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\psset@swapaxes,\ifpsswapaxes} +% \begin{macrocode} +\newif\ifswapaxes +\def\psset@swapaxes#1{% + \@nameuse{@pst#1}% + \if@pst + \def\psk@swapaxes{-90 rotate -1 1 scale }% + \else + \def\psk@swapaxes{}% + \fi} +\psset@swapaxes{false} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\psset@showpoints,\ifshowpoints} +% \begin{macrocode} +\newif\ifshowpoints +\def\psset@showpoints#1{\@nameuse{showpoints#1}} +\psset@showpoints{false} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\psset@border,\psk@border} +% \begin{macrocode} +\let\pst@setrepeatarrowsflag\relax +\def\psset@border#1{% + \pst@getlength{#1}\psk@border + \pst@setrepeatarrowsflag} +\psset@border{0pt} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\psset@bordercolor,\psbordercolor} +% \begin{macrocode} +\def\psset@bordercolor#1{\pst@getcolor{#1}\psbordercolor} +\psset@bordercolor{white} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\psset@doubleline,\ifpsdoubleline} +% \begin{macrocode} +\newif\ifpsdoubleline +\def\psset@doubleline#1{% + \@nameuse{psdoubleline#1}% + \pst@setrepeatarrowsflag} +\psset@doubleline{false} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\psset@doublesep,\psdoublesep} +% \begin{macrocode} +\def\psset@doublesep#1{\def\psdoublesep{#1}} +\psset@doublesep{1.25\pslinewidth} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\psset@doublecolor,\psdoublecolor} +% \begin{macrocode} +\def\psset@doublecolor#1{\pst@getcolor{#1}\psdoublecolor} +\psset@doublecolor{white} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\psset@shadow,\ifpsshadow} +% \begin{macrocode} +\newif\ifpsshadow +\def\psset@shadow#1{% + \@nameuse{psshadow#1}% + \pst@setrepeatarrowsflag} +\psset@shadow{false} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\psset@shadowsize,\psk@shadowsize} +% \begin{macrocode} +\def\psset@shadowsize#1{\pst@getlength{#1}\psk@shadowsize} +\psset@shadowsize{3pt} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\psset@shadowangle,\psk@shadowangle} +% \begin{macrocode} +\def\psset@shadowangle#1{\pst@getangle{#1}\psk@shadowangle} +\psset@shadowangle{-45} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\psset@shadowcolor,\psshadowcolor} +% \begin{macrocode} +\def\psset@shadowcolor#1{\pst@getcolor{#1}\psshadowcolor} +\psset@shadowcolor{darkgray} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pst@setrepeatarrowsflag} +% \begin{macrocode} +\def\pst@repeatarrowsflag{\z@} +\def\pst@setrepeatarrowsflag{% + \edef\pst@repeatarrowsflag{% + \ifdim\psk@border\p@>\z@ 1\else\ifpsdoubleline 1\else + \ifpsshadow 1\else \z@\fi\fi\fi}} +% \end{macrocode} +% \end{macro} +% +% +% +% \section{Line styles\label{Linestyles}} +% +% For each "linestyle"