From e0c6872cf40896c7be36b11dcc744620f10adf1d Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 2 Sep 2019 13:46:59 +0900 Subject: Initial commit --- usergrps/uktug/baskervi/6_2/spqr/boxfill.tex | 232 +++ usergrps/uktug/baskervi/6_2/spqr/calc.sty | 150 ++ usergrps/uktug/baskervi/6_2/spqr/changes.tex | 147 ++ usergrps/uktug/baskervi/6_2/spqr/charpath.sty | 4 + usergrps/uktug/baskervi/6_2/spqr/charpath.tex | 79 + usergrps/uktug/baskervi/6_2/spqr/colortab.sty | 4 + usergrps/uktug/baskervi/6_2/spqr/colortab.tex | 220 +++ usergrps/uktug/baskervi/6_2/spqr/defaults.pst | 103 + usergrps/uktug/baskervi/6_2/spqr/fancybox.sty | 949 +++++++++ usergrps/uktug/baskervi/6_2/spqr/fancyvrb.rc | 265 +++ usergrps/uktug/baskervi/6_2/spqr/fancyvrb.sty | 1672 ++++++++++++++++ usergrps/uktug/baskervi/6_2/spqr/gradient.pro | 80 + usergrps/uktug/baskervi/6_2/spqr/gradient.sty | 4 + usergrps/uktug/baskervi/6_2/spqr/gradient.tex | 74 + usergrps/uktug/baskervi/6_2/spqr/multido.sty | 4 + usergrps/uktug/baskervi/6_2/spqr/multido.tex | 279 +++ usergrps/uktug/baskervi/6_2/spqr/palette.sty | 4 + usergrps/uktug/baskervi/6_2/spqr/palette.tex | 253 +++ usergrps/uktug/baskervi/6_2/spqr/pie-data.sh | 190 ++ usergrps/uktug/baskervi/6_2/spqr/piechart.sh | 364 ++++ usergrps/uktug/baskervi/6_2/spqr/pst-3d.tex | 691 +++++++ usergrps/uktug/baskervi/6_2/spqr/pst-code.tex | 135 ++ usergrps/uktug/baskervi/6_2/spqr/pst-coil.pro | 28 + usergrps/uktug/baskervi/6_2/spqr/pst-coil.sty | 4 + usergrps/uktug/baskervi/6_2/spqr/pst-coil.tex | 128 ++ usergrps/uktug/baskervi/6_2/spqr/pst-dots.pro | 107 ++ usergrps/uktug/baskervi/6_2/spqr/pst-node.pro | 203 ++ usergrps/uktug/baskervi/6_2/spqr/pst-node.sty | 4 + usergrps/uktug/baskervi/6_2/spqr/pst-node.tex | 1079 +++++++++++ usergrps/uktug/baskervi/6_2/spqr/pst-plot.sty | 4 + usergrps/uktug/baskervi/6_2/spqr/pst-plot.tex | 643 +++++++ usergrps/uktug/baskervi/6_2/spqr/pst2eps.sty | 4 + usergrps/uktug/baskervi/6_2/spqr/pst2eps.tex | 244 +++ usergrps/uktug/baskervi/6_2/spqr/pstree.rea | 37 + usergrps/uktug/baskervi/6_2/spqr/pstree.tex | 2280 ++++++++++++++++++++++ usergrps/uktug/baskervi/6_2/spqr/pstricks.con | 361 ++++ usergrps/uktug/baskervi/6_2/spqr/pstricks.pro | 204 ++ usergrps/uktug/baskervi/6_2/spqr/pstricks.sty | 17 + usergrps/uktug/baskervi/6_2/spqr/pstricks.tex | 2554 +++++++++++++++++++++++++ usergrps/uktug/baskervi/6_2/spqr/pstrix2.tex | 1085 +++++++++++ usergrps/uktug/baskervi/6_2/spqr/spqr.sty | 150 ++ usergrps/uktug/baskervi/6_2/spqr/textpath.pro | 99 + usergrps/uktug/baskervi/6_2/spqr/textpath.sty | 4 + usergrps/uktug/baskervi/6_2/spqr/textpath.tex | 97 + 44 files changed, 15239 insertions(+) create mode 100644 usergrps/uktug/baskervi/6_2/spqr/boxfill.tex create mode 100644 usergrps/uktug/baskervi/6_2/spqr/calc.sty create mode 100644 usergrps/uktug/baskervi/6_2/spqr/changes.tex create mode 100644 usergrps/uktug/baskervi/6_2/spqr/charpath.sty create mode 100644 usergrps/uktug/baskervi/6_2/spqr/charpath.tex create mode 100644 usergrps/uktug/baskervi/6_2/spqr/colortab.sty create mode 100644 usergrps/uktug/baskervi/6_2/spqr/colortab.tex create mode 100644 usergrps/uktug/baskervi/6_2/spqr/defaults.pst create mode 100644 usergrps/uktug/baskervi/6_2/spqr/fancybox.sty create mode 100644 usergrps/uktug/baskervi/6_2/spqr/fancyvrb.rc create mode 100644 usergrps/uktug/baskervi/6_2/spqr/fancyvrb.sty create mode 100644 usergrps/uktug/baskervi/6_2/spqr/gradient.pro create mode 100644 usergrps/uktug/baskervi/6_2/spqr/gradient.sty create mode 100644 usergrps/uktug/baskervi/6_2/spqr/gradient.tex create mode 100644 usergrps/uktug/baskervi/6_2/spqr/multido.sty create mode 100644 usergrps/uktug/baskervi/6_2/spqr/multido.tex create mode 100644 usergrps/uktug/baskervi/6_2/spqr/palette.sty create mode 100644 usergrps/uktug/baskervi/6_2/spqr/palette.tex create mode 100644 usergrps/uktug/baskervi/6_2/spqr/pie-data.sh create mode 100644 usergrps/uktug/baskervi/6_2/spqr/piechart.sh create mode 100644 usergrps/uktug/baskervi/6_2/spqr/pst-3d.tex create mode 100644 usergrps/uktug/baskervi/6_2/spqr/pst-code.tex create mode 100644 usergrps/uktug/baskervi/6_2/spqr/pst-coil.pro create mode 100644 usergrps/uktug/baskervi/6_2/spqr/pst-coil.sty create mode 100644 usergrps/uktug/baskervi/6_2/spqr/pst-coil.tex create mode 100644 usergrps/uktug/baskervi/6_2/spqr/pst-dots.pro create mode 100644 usergrps/uktug/baskervi/6_2/spqr/pst-node.pro create mode 100644 usergrps/uktug/baskervi/6_2/spqr/pst-node.sty create mode 100644 usergrps/uktug/baskervi/6_2/spqr/pst-node.tex create mode 100644 usergrps/uktug/baskervi/6_2/spqr/pst-plot.sty create mode 100644 usergrps/uktug/baskervi/6_2/spqr/pst-plot.tex create mode 100644 usergrps/uktug/baskervi/6_2/spqr/pst2eps.sty create mode 100644 usergrps/uktug/baskervi/6_2/spqr/pst2eps.tex create mode 100644 usergrps/uktug/baskervi/6_2/spqr/pstree.rea create mode 100644 usergrps/uktug/baskervi/6_2/spqr/pstree.tex create mode 100644 usergrps/uktug/baskervi/6_2/spqr/pstricks.con create mode 100644 usergrps/uktug/baskervi/6_2/spqr/pstricks.pro create mode 100644 usergrps/uktug/baskervi/6_2/spqr/pstricks.sty create mode 100644 usergrps/uktug/baskervi/6_2/spqr/pstricks.tex create mode 100644 usergrps/uktug/baskervi/6_2/spqr/pstrix2.tex create mode 100644 usergrps/uktug/baskervi/6_2/spqr/spqr.sty create mode 100644 usergrps/uktug/baskervi/6_2/spqr/textpath.pro create mode 100644 usergrps/uktug/baskervi/6_2/spqr/textpath.sty create mode 100644 usergrps/uktug/baskervi/6_2/spqr/textpath.tex (limited to 'usergrps/uktug/baskervi/6_2/spqr') diff --git a/usergrps/uktug/baskervi/6_2/spqr/boxfill.tex b/usergrps/uktug/baskervi/6_2/spqr/boxfill.tex new file mode 100644 index 0000000000..fbc02b5799 --- /dev/null +++ b/usergrps/uktug/baskervi/6_2/spqr/boxfill.tex @@ -0,0 +1,232 @@ +%% BEGIN boxfill.tex +%% +%% Defines the \psboxfill macro. +%% For use with PSTricks v0.94 (or perhaps later). +%% +\def\fileversion{0.94} +\def\filedate{94/06/08} +%% +%% COPYRIGHT 1994, by Timothy Van Zandt, tvz@Princeton.EDU +%% See pstricks.tex or pstricks.doc for copying restrictions. + +% Preliminaries: + +\message{ v\fileversion, \filedate} + +\csname PSTboxfillLoaded\endcsname +\let\PSTboxfillLoaded\endinput + +\ifx\PSTricksLoaded\endinput\else + \def\next{\input pstricks.tex} + \expandafter\next +\fi + +\edef\TheAtCode{\the\catcode`\@} +\catcode`\@=11 + +% The box: + +\newbox\pst@fillbox +\def\psboxfill{\pst@killglue\pst@makebox\psboxfill@i} +\def\psboxfill@i{\setbox\pst@fillbox\box\pst@hbox\ignorespaces} + +% Parameters: + +\def\psset@boxfillsize#1{% + \def\pst@tempg{#1}\def\pst@temph{auto}% + \ifx\pst@tempg\pst@temph + \let\psk@boxfillsize\relax + \else + \psset@@boxfillsize#1(\z@,\z@)\@empty(\z@,\z@)(\@nil + \fi} +\def\psset@@boxfillsize#1(#2,#3)#4(#5,#6)#7(#8\@nil{% + \begingroup + \ifx\@empty#7\relax + \pst@dima\z@ + \pst@dimb\z@ + \pssetxlength\pst@dimc{#2}% + \pssetylength\pst@dimd{#3}% + \else + \pssetxlength\pst@dima{#2}% + \pssetylength\pst@dimb{#3}% + \pssetxlength\pst@dimc{#5}% + \pssetylength\pst@dimd{#6}% + \fi + \xdef\pst@tempg{% + \pst@dima=\number\pst@dima sp + \pst@dimb=\number\pst@dimb sp + \pst@dimc=\number\pst@dimc sp + \pst@dimd=\number\pst@dimd sp }% + \endgroup + \let\psk@boxfillsize\pst@tempg} + +\psset{boxfillsize={(-15cm,-15cm)(15cm,15cm)}} + +\def\psset@boxfillcolor#1{\pst@getcolor{#1}\psboxfillcolor} +\psset@boxfillcolor{black} + +\def\psset@boxfillangle#1{\pst@getangle{#1}\psk@boxfillangle} +\psset@boxfillangle{0} + +\def\psset@fillsepx#1{\pst@getlength{#1}\psk@fillsepx} +\def\psset@fillsepy#1{\pst@getlength{#1}\psk@fillsepy} +\def\psset@fillsep#1{\psset@fillsepx{#1}\let\psk@fillsepy\psk@fillsepx} +\psset@fillsep{2pt} + +\def\psset@fillcycle#1{\pst@getint{#1}\psk@fillcycle} +\psset@fillcycle{0} + +% Main macro: + +\def\psfs@boxfill{% + \ifvoid\pst@fillbox + \@pstrickserr{Fill box is empty. Use \string\psboxfill\space first.}\@ehpa + \else + \ifx\psk@boxfillsize\relax + \pst@AutoBoxFill + \else + \pst@ManualBoxFill + \fi + \fi} + +% Manual box fill: + +\def\pst@ManualBoxFill{% + \leavevmode + \begingroup + \pst@FlushCode + \begin@psclip + \pstVerb{clip}% + \expandafter\pst@AddFillBox\psk@boxfillsize + \end@psclip + \endgroup} + +\def\pst@FlushCode{% + \pst@Verb{% + /mtrxc CM def + CP CP T + \tx@STV + \psk@origin + \psk@swapaxes + \pst@newpath + \pst@code + mtrxc setmatrix + moveto + 0 setgray}% + \gdef\pst@code{}} + +\def\pst@AddFillBox#1 #2 #3 #4 {% + \begingroup + \setbox\pst@fillbox=\vbox{% + \hbox{\unhcopy\pst@fillbox\kern\psk@fillsepx\p@}% + \vskip\psk@fillsepy\p@}% + \psk@boxfillsize + \pst@cnta=\pst@dimc + \advance\pst@cnta-\pst@dima + \divide\pst@cnta\wd\pst@fillbox + \pst@cntb=\pst@dimd + \advance\pst@cntb-\pst@dimb + \pst@dimd=\ht\pst@fillbox + \divide\pst@cntb\pst@dimd + \def\pst@tempa{% + \pst@tempg + \copy\pst@fillbox + \advance\pst@cntc\@ne + \ifnum\pst@cntc<\pst@cntd\expandafter\pst@tempa\fi}% + \let\pst@tempg\relax + \pst@cntc-\tw@ + \pst@cntd\pst@cnta + \setbox\pst@fillbox=\hbox to \z@{% + \kern\pst@dima + \kern-\wd\pst@fillbox + \pst@tempa + \hss}% + \pst@cntd\pst@cntb + \ifnum\psk@fillcycle=\z@\pst@ManualFillCycle\fi + \global\setbox\pst@boxg=\vbox to\z@{% + \offinterlineskip + \vss + \pst@tempa + \vskip\pst@dimb}% + \endgroup + \setbox\pst@fillbox\box\pst@boxg + \pst@rotate\psk@boxfillangle\pst@fillbox + \box\pst@fillbox} + +\def\pst@ManualFillCycle{% + \pst@cntg=\psk@fillcycle + \pst@dimg=\wd\pst@fillbox + \divide\pst@dimg\pst@cntg + \ifnum\pst@cntg<\z@\pst@cntg=-\pst@cntg\fi + \advance\pst@cntg\m@ne + \pst@cnth=\pst@cntg + \def\pst@tempg{% + \ifnum\pst@cnth<\pst@cntg\advance\pst@cnth\@ne\else\pst@cnth\z@\fi + \moveright\pst@cnth\pst@dimg}} + +% Auto box fill: !! Fix dictionary + +\pst@def{AutoFillCycle}<% + /c ED + /n 0 def + /s { + /x x w c div n mul add def + /n n c abs 1 sub lt { n 1 add } { 0 } ifelse def + } def> + +\pst@def{BoxFill}<% + gsave + gsave \tx@STV CM grestore dtransform CM idtransform + abs /h ED abs /w ED + pathbbox + h div round 2 add cvi /y2 ED + w div round 2 add cvi /x2 ED + h div round 2 sub cvi /y1 ED + w div round 2 sub cvi /x1 ED + /y2 y2 y1 sub def + /x2 x2 x1 sub def + CP + y1 h mul sub neg /y1 ED + x1 w mul sub neg /x1 ED + clip + y2 { + /x x1 def + s + x2 { + save CP x y1 T moveto Box restore + /x x w add def + } repeat + /y1 y1 h add def + } repeat + CP x y1 T moveto Box + currentpoint currentfont grestore setfont moveto> + +\def\pst@AutoBoxFill{% + \leavevmode + \begingroup + \pst@FlushCode + \pst@Verb{\psk@boxfillangle \tx@RotBegin}% + \pstVerb{\pst@dict /Box \pslbrace end}% + \hbox to \z@{\vbox to\z@{\vss\copy\pst@fillbox\vskip-\dp\pst@fillbox}\hss}% + \pstVerb{% + tx@Dict begin \psrbrace def + \ifnum\psk@fillcycle=\z@ + /s {} def + \else + \psk@fillcycle \tx@AutoFillCycle + \fi + \pst@number{\wd\pst@fillbox}% + \psk@fillsepx add + \pst@number{\ht\pst@fillbox}% + \pst@number{\dp\pst@fillbox}% + \psk@fillsepy add add + \tx@BoxFill + end}% + \pst@Verb{\tx@RotEnd}% + \endgroup} + +\catcode`\@=\TheAtCode\relax + +\endinput + +%% END boxfill.tex diff --git a/usergrps/uktug/baskervi/6_2/spqr/calc.sty b/usergrps/uktug/baskervi/6_2/spqr/calc.sty new file mode 100644 index 0000000000..086273e3ae --- /dev/null +++ b/usergrps/uktug/baskervi/6_2/spqr/calc.sty @@ -0,0 +1,150 @@ +%% +%% This is file `calc.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% calc.dtx (with options: `package') + +%% File `calc.dtx'. +%% Copyright (C) 1992--1995 Kresten Krab Thorup and Frank Jensen. +%% All rights reserved. + +\def\fileversion{v4.0c (TEST)} +\def\filedate{1995/04/10} + +%% \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 \~} +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{calc}[\filedate\space\fileversion] +\typeout{Package: `calc' \fileversion\space <\filedate> (KKT and FJ)} +\def\calc@assign@generic#1#2#3#4{\let\calc@A#1\let\calc@B#2% + \expandafter\calc@open\expandafter(#4!% + \global\calc@A\calc@B\endgroup#3\calc@B} +\def\calc@assign@count{\calc@assign@generic\calc@Acount\calc@Bcount} +\def\calc@assign@dimen{\calc@assign@generic\calc@Adimen\calc@Bdimen} +\def\calc@assign@skip{\calc@assign@generic\calc@Askip\calc@Bskip} +\newcount\calc@Acount \newcount\calc@Bcount +\newdimen\calc@Adimen \newdimen\calc@Bdimen +\newskip\calc@Askip \newskip\calc@Bskip +\def\setcounter#1#2{\@ifundefined{c@#1}{\@nocounterr{#1}}% + {\calc@assign@count{\global\csname c@#1\endcsname}{#2}}} +\def\addtocounter#1#2{\@ifundefined{c@#1}{\@nocounterr{#1}}% + {\calc@assign@count{\global\advance\csname c@#1\endcsname}{#2}}} +\DeclareRobustCommand\setlength{\calc@assign@skip} +\DeclareRobustCommand\addtolength[1]{\calc@assign@skip{\advance#1}} +\def\calc@pre@scan#1{% + \ifx(#1% + \let\calc@next\calc@open + \else + \let\calc@next\calc@numeric + \fi + \calc@next#1} +\def\calc@open({\begingroup\aftergroup\calc@initB + \begingroup\aftergroup\calc@initB + \calc@pre@scan} +\def\calc@initB{\calc@B\calc@A} +\def\calc@numeric{\afterassignment\calc@post@scan \global\calc@A} +\def\calc@post@scan#1{% + \ifx#1!\let\calc@next\endgroup \else + \ifx#1+\let\calc@next\calc@add \else + \ifx#1-\let\calc@next\calc@subtract \else + \ifx#1*\let\calc@next\calc@multiplyx \else + \ifx#1/\let\calc@next\calc@dividex \else + \ifx#1)\let\calc@next\calc@close \else \calc@error#1% + \fi + \fi + \fi + \fi + \fi + \fi + \calc@next} +\def\calc@add{\calc@generic@add\calc@addAtoB} +\def\calc@subtract{\calc@generic@add\calc@subtractAfromB} +\def\calc@generic@add#1{\endgroup\global\calc@A\calc@B\endgroup + \begingroup\aftergroup#1\begingroup\aftergroup\calc@initB + \calc@pre@scan} +\def\calc@addAtoB{\advance\calc@B\calc@A} +\def\calc@subtractAfromB{\advance\calc@B-\calc@A} +\def\calc@multiplyx#1{\def\calc@tmp{#1}% + \ifx\calc@tmp\calc@ratio@x \let\calc@next\calc@ratio@multiply \else + \ifx\calc@tmp\calc@real@x \let\calc@next\calc@real@multiply \else + \let\calc@next\calc@multiply + \fi + \fi + \calc@next#1} +\def\calc@dividex#1{\def\calc@tmp{#1}% + \ifx\calc@tmp\calc@ratio@x \let\calc@next\calc@ratio@divide \else + \ifx\calc@tmp\calc@real@x \let\calc@next\calc@real@divide \else + \let\calc@next\calc@divide + \fi + \fi + \calc@next#1} +\def\calc@ratio@x{\ratio} +\def\calc@real@x{\real} +\def\calc@multiply{\calc@generic@multiply\calc@multiplyBbyA} +\def\calc@divide{\calc@generic@multiply\calc@divideBbyA} +\def\calc@generic@multiply#1{\endgroup\begingroup + \let\calc@A\calc@Acount \let\calc@B\calc@Bcount + \aftergroup#1\calc@pre@scan} +\def\calc@multiplyBbyA{\multiply\calc@B\calc@Acount} +\def\calc@divideBbyA{\divide\calc@B\calc@Acount} +\def\calc@close + {\endgroup\global\calc@A\calc@B + \endgroup\global\calc@A\calc@B + \calc@post@scan} +\def\calc@ratio@multiply\ratio{\calc@ratio@evaluate} +\def\calc@ratio@divide\ratio#1#2{\calc@ratio@evaluate{#2}{#1}} +\let\calc@numerator=\calc@Bcount +\newcount\calc@denominator +\def\calc@ratio@evaluate#1#2{% + \endgroup\begingroup + \calc@assign@dimen\calc@numerator{#1}% + \calc@assign@dimen\calc@denominator{#2}% + \gdef\calc@the@ratio{}% + \ifnum\calc@numerator<0 \calc@numerator-\calc@numerator + \gdef\calc@the@ratio{-}% + \fi + \ifnum\calc@denominator<0 \calc@denominator-\calc@denominator + \xdef\calc@the@ratio{\calc@the@ratio-}% + \fi + \calc@Acount\calc@numerator + \divide\calc@Acount\calc@denominator + \xdef\calc@the@ratio{\calc@the@ratio\number\calc@Acount.}% + \calc@next@digit \calc@next@digit \calc@next@digit + \calc@next@digit \calc@next@digit \calc@next@digit + \endgroup + \calc@multiply@by@real\calc@the@ratio + \begingroup + \calc@post@scan} +\def\calc@next@digit{% + \multiply\calc@Acount\calc@denominator + \advance\calc@numerator -\calc@Acount + \multiply\calc@numerator 10 + \calc@Acount\calc@numerator + \divide\calc@Acount\calc@denominator + \xdef\calc@the@ratio{\calc@the@ratio\number\calc@Acount}} +\def\calc@multiply@by@real#1{\calc@Bdimen #1\calc@B \calc@B\calc@Bdimen} +\def\calc@real@multiply\real#1{\endgroup + \calc@multiply@by@real{#1}\begingroup + \calc@post@scan} +\def\calc@real@divide\real#1{\calc@ratio@evaluate{1pt}{#1pt}} +\def\calc@error#1{% + \errhelp{Calc error: I expected to see one of: + - * / )}% + \errmessage{Invalid character `#1' in arithmetic expression}} +\endinput +%% +%% End of file `calc.sty'. diff --git a/usergrps/uktug/baskervi/6_2/spqr/changes.tex b/usergrps/uktug/baskervi/6_2/spqr/changes.tex new file mode 100644 index 0000000000..ceb73d350a --- /dev/null +++ b/usergrps/uktug/baskervi/6_2/spqr/changes.tex @@ -0,0 +1,147 @@ +%% BEGIN changes.tex +%% +%% Changes listing for PSTricks. +%% Run with LaTeX, with or without the NFSS. +%% +%% Change these for a4 paper: +\def\paperwidth{8.5in} +\def\paperheight{11in} + +\def\FileVersion{0.94-Beta} +\def\FileDate{April 16, 1993} + +\documentstyle[12pt,fancybox]{article} + +%% PAGE PARAMETERS + +% Paragraphs are marked by large space rather than indentation: +\parindent 0pt +\parskip 6pt plus 1pt minus 1pt + +% No headers, 1in top margin +\topmargin 0pt +\headheight 0pt +\headsep 0pt + +% Total bottom margin 1in, text height 9in +\textheight 9in +\footskip .625in + +% Now adjust for different paper size: +\newdimen\mydim +\mydim=\paperwidth +\advance\mydim-8.5in +\divide\mydim 2 +\advance\oddsidemargin \mydim +\advance\evensidemargin \mydim +\mydim=\paperheight +\advance\mydim-11in +\divide\mydim 2 +\advance\topmargin \mydim + +%% OTHER + +\renewcommand{\EveryVerbatimLine}[2]{} + +% Short meta (works in verbatim. Can't use < for other purposes. +\catcode`\<=13 \def<#1>{{\rm\it #1\/}} % (works in verbatim) + +% Short verbatim. +\catcode`\"=13 +\def"{\verb"} + +\catcode`\@=12 % In case I'm using AmS-LaTeX + +\begin{document} + +\begin{center} +{\large\bf Changes listing for PSTricks}\\[6pt] + Version \FileVersion\\ + \FileDate\\[6pt] + Timothy Van Zandt\\ + tvz@Princeton.EDU +\end{center} + + The PSTricks package is still preliminary. The features list + and user interface are unlikely to change much in the short term, but + the internal code is not stable. + +\section{VERSION 0.94 (Beta)} + +\subsection{Incompatible changes} + + \begin{enumerate} + + \item "\Rnode" uses the graphics parameters "href" and "vref" to set the +reference point, rather than having a coordinate argument. + + \end{enumerate} + +\subsection{New features} + + \begin{enumerate} + + \item New graphics objects: "\pstriangle", "\psdiamond", "\psdot". + + \item New box frames: "\pstribox", "\psdiabox". + + \item New nodes: "\dotnode", "\dianode", "trinode". + + \item Tree macros! + + \item "\psmatrix": Good for math diagrams and graphs. + + \item Negative nodesep and offset measure distance from center of node. + + \item New node connections: "\ncbox", "\ncarcbox". + + \item New node label puts: "\ncput", "\naput", "\nbput". (These replace +"\lput", "\mput", "\aput", "\Aput", "\bput" and "\Bput", which are still +supported.) + + \item New node label puts (especially good for trees): "\thput", "\tvput", +"\tlput", "\trput", "\taput", "\tbput". (Make "\ncline" obsolete, but this is +still supported.) + + \item "\nput", for attaching labels to nodes. + + \item New arrow styles: {\catcode`\<=12 "|<->|" and "|<*->|*"}. + + \item New dot styles: "diamond", "diamond*", "oplus", "ominus", "x", +"asterisk". + + \end{enumerate} + +\subsection{Obsolete but supported features} + + \begin{enumerate} + + \item "\lput", "\mput", "\aput", "\Aput", "\bput" and "\Bput". + + \item "\ncline". + + \end{enumerate} +\subsection{Bug fixes} + + \begin{enumerate} + + \item Fixed "\ncangle" so that it would work properly with non-right angle +values of "angleA" and "angleB". + + \end{enumerate} + + +\subsection{Other changes} + + \begin{enumerate} + + \item "\OldPsput" and "\NewPsput" are back in "pstricks.tex". + + \item The in "arrowsize=", "tbarsize=", and +"dotsize=" is optional (default=0). + + \end{enumerate} + + +\end{document} +%% END changes.tex diff --git a/usergrps/uktug/baskervi/6_2/spqr/charpath.sty b/usergrps/uktug/baskervi/6_2/spqr/charpath.sty new file mode 100644 index 0000000000..5d8be8ac99 --- /dev/null +++ b/usergrps/uktug/baskervi/6_2/spqr/charpath.sty @@ -0,0 +1,4 @@ +%% BEGIN: charpath.sty +\input charpath.tex +\endinput +%% END: charpath.sty diff --git a/usergrps/uktug/baskervi/6_2/spqr/charpath.tex b/usergrps/uktug/baskervi/6_2/spqr/charpath.tex new file mode 100644 index 0000000000..8e096c5690 --- /dev/null +++ b/usergrps/uktug/baskervi/6_2/spqr/charpath.tex @@ -0,0 +1,79 @@ +%% BEGIN charpath.tex/charpath.sty +%% +%% For stroking and filling characters with PSTricks' line and fill styles. +%% +\def\fileversion{0.93a} +\def\filedate{93/03/12} +%% +%% COPYRIGHT 1993, by Timothy Van Zandt, tvz@Princeton.EDU +%% See pstricks.tex or pstricks.doc for copying restrictions. +%% +%% See the PSTricks User's Guide for description. +%% See chartest.tex for sample input. +%% See chartest.ps for sample output. +%% + +\message{ v\fileversion, \filedate} + +\csname PSTcharpathLoaded\endcsname +\let\PSTcharpathLoaded\endinput + +\ifx\PSTricksLoaded\endinput\else + \def\next{\input pstricks.tex} + \expandafter\next +\fi + +\edef\TheAtCode{\the\catcode`\@} +\catcode`\@=11 + +\def\tx@CharPathShow{% + /tx@CharPathSavedShow /show load def + /show { + % These 3 lines check whether charpath yields anything interesting. + dup gsave newpath 0 0 moveto + true charpath pathbbox grestore + 3 -1 roll eq 3 1 roll eq and + % If not, just use show. + { tx@CharPathSavedShow } + % Otherwise, use charpath. + { true charpath } + ifelse } + def } + +\def\pscharpath{\def\pst@par{}\pst@object{pscharpath}} +\def\pscharpath@i{\pst@makebox\pscharpath@ii} +\def\pscharpath@ii{% + \leavevmode\hbox{% + \pstVerb{\tx@CharPathShow}% + \box\pst@hbox + \pstVerb{/show /tx@CharPathSavedShow load def}% + \begin@ClosedObj + \def\pst@linetype{1}% + \psdashadjustfalse + \showpointsfalse + \let\pst@newpath\@empty + \def\use@pscode{% + \pst@Verb{% + gsave + \tx@STV + \pst@code + grestore + \if@star\else CP newpath moveto \fi}}% + \end@ClosedObj}} + +\def\pscharclip{\def\pst@par{}\pst@object{pscharclip}} +\def\pscharclip@i{\pst@makebox\pscharclip@ii} +\def\pscharclip@ii{% + \leavevmode + \begingroup + \begin@psclip + {\@startrue\pscharpath@ii}% + \pstVerb{clip \if@star\else currentpoint newpath moveto\fi}% + \def\endpscharclip{\end@psclip\endgroup}% + \ignorespaces} +\def\endpscharclip{\pst@misplaced\endpscharclip} + +\catcode`\@=\TheAtCode\relax + +\endinput +%% END charpath.tex/charpath.sty diff --git a/usergrps/uktug/baskervi/6_2/spqr/colortab.sty b/usergrps/uktug/baskervi/6_2/spqr/colortab.sty new file mode 100644 index 0000000000..b80a83ba85 --- /dev/null +++ b/usergrps/uktug/baskervi/6_2/spqr/colortab.sty @@ -0,0 +1,4 @@ +%% BEGIn colortab.sty +\input colortab.tex +\endinput +%% END colortab.sty diff --git a/usergrps/uktug/baskervi/6_2/spqr/colortab.tex b/usergrps/uktug/baskervi/6_2/spqr/colortab.tex new file mode 100644 index 0000000000..8dd218e874 --- /dev/null +++ b/usergrps/uktug/baskervi/6_2/spqr/colortab.tex @@ -0,0 +1,220 @@ +%% BEGIN colortab.tex/colortab.sty +%% +\def\fileversion{0.9} +\def\filedate{93/01/11} +%% +%% COPYRIGHT 1993, by Timothy Van Zandt, tvz@Princeton.EDU +%% +%% DESCRIPTION: +%% colortab.tex/colortab.sty lets you shade or color the cells in a +%% alignment environments (e.g., \halign and \LaTeX's tabular and +%% array environments). It is compatible with most TeX macro packages, +%% including Plain TeX, LaTeX, AmSTeX, and Ams-LaTeX. You must be +%% use in conjunction with other color commands. +%% +%% INSTALLATION: +%% Put this file where your TeX looks for inputs, under the name +%% colortab.tex. Name a copy colortab.sty to use as a LaTeX style option, +%% or create a file colortab.sty with the lines: +%% \input colortab.tex +%% \endinput +%% +%% DOCUMENTATION: +%% See colortab.doc, which might be appended to this file. +%% +%% COPYING: +%% Copying of part or all of this file is allowed under the following +%% conditions only: +%% (1) You may freely distribute unchanged copies of the file. Please +%% include the documentation when you do so. +%% (2) You may modify a renamed copy of the file, but only for personal +%% use or use within an organization. +%% (3) You may copy fragments from the file, for personal use or 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 +%% this file or modified versions or fragments thereof, except for +%% a nominal charge for copying etc. +%% +%% CODE: +% +% colortab.tex uses TeX primitives, plus the Plain TeX commands: +% \newcount, \newtoks, \newbox, \newif and \z@. +% +% The LaTeX specific macros also use some LaTeX commands. +% +\csname ColortabLoaded\endcsname +\let\ColortabLoaded\endinput +% +\message{\space\space v\fileversion\space\space\filedate\space\space } +\edef\TheAtCode{\the\catcode`\@}\catcode`\@=11 +% +% These scratch registers are set globally: +% +\newcount\CT@cnt +\newdimen\CT@dim +\newbox\CT@box +% +% This flag is used to shut off colortab: +% +\newif\ifcolortab +\colortabtrue +% +% To color row cells of unknown height we first have to put the rows in an +% alignment and measure the resulting height, then put down a row of blobs +% (with \hrule, and then move back up the page. +% +% For TeX's \halign primitive, \coloralign saves the preamble in the token +% register \CT@preamble. This is used to calculate the height of the columns +% that are to be colored in. +% +\newtoks\CT@preamble +\def\coloralign{% + \afterassignment\coloralign@ + \setbox\CT@box=\hbox} +\def\coloralign@#1\cr{% + \egroup + \CT@preamble{\halign\bgroup#1\cr}% + \the\CT@preamble} +% +% \CC reads the next row, which should contain the color commands, and then +% the rows to be colored. The height of the latter rows is calculated, and +% then the row of colors is processed. \CT@columncolor uses \leaders to get +% each color to fill the column horizontally, and it uses the previously +% calculated height to fill the columns vertically. +% \begin{macrocode} +\def\CT@columncolor{% + \ifx\next\@nil + \def\next##1&\@nil{\gdef\CT@next{##1}}% + \expandafter\next\CT@next\@nil + \def\CT@temp\@nil{}% + \else + \ifx\next\CT@space + \def\CT@temp{% + \def\next{\futurelet\next\CT@columncolor}% + \afterassignment\next\let\CT@temp= }% + \else + \def\CT@temp{\CT@@columncolor}% + \fi + \fi + \CT@temp} +\def\CT@@columncolor#1&{% + \ifx\next&% + \expandafter\gdef\expandafter\CT@next\expandafter{\CT@next\omit{}&}% + \else + \expandafter\gdef\expandafter\CT@next\expandafter{\CT@next + \omit{{\ignorespaces#1{\leaders\hrule height\CT@dim\hfil}}}&}% + \fi + \futurelet\next\CT@columncolor} +{\def\\{\global\let\CT@space= }\\ } +\def\CC@#1#2#3{% + \ifcolortab + \noalign{% + \setbox\CT@box=\vbox{#1#3\crcr\egroup}% + \CT@dim=\ht\CT@box + \global\advance\CT@dim by \dp\CT@box + \def\CT@next{}% + \futurelet\next\CT@columncolor#2&\@nil}% + \CT@next\cr + \noalign{\vskip-\CT@dim}% + \fi + #3} +\def\CC#1\cr#2\ECC{\CC@{\the\CT@preamble}{#1}{#2}} +% +% With \LaTeX's alignment macros, the preamble is saved for us in \@preamble. +% Otherwise, \LCC is the same as \CC. +% +\def\LCC#1\\#2\ECC{\CC@{\@preamble}{#1}{#2}} +% +% This unaligned color stuff only works with PSTricks: +% +\def\AC#1{\pstVerb{\pst@usecolor{#1}}} +\def\EAC{\pstVerb{\pst@currentcolor}} +\def\NAC#1{\noalign{\AC{#1}}} +\def\ENAC{\noalign{\EAC}} +% +\def\SP{\noalign{\global\let\CT@savedpreamble\@preamble}} +\def\RP{\noalign{\global\let\@preamble\CT@savedpreamble}} +% +\newcount\CT@LCnum +\def\LColors#1\\{% + \noalign{% + \ifnum\CT@LCinitflag=\c@LT@tables\else\CT@LCinit\fi + \ifnum\CT@LCflag=\z@ + \global\CT@LCnum 1 + \CT@LColors#1&\@nil + \global\CT@LCnum\CT@LCmax + \fi}} +\def\CT@LColors#1&{% + \global\@namedef{LColor@\the\CT@LCnum}{#1}% + \@ifnextchar\@nil{\@gobble}{% + \global\advance\CT@LCnum 1 + \CT@LColors}} +\def\CT@LCinit{% + \ifcolortab + \@ifundefined{LT@\romannumeral\c@LT@tables}% + {\gdef\CT@LCflag{1}}{\gdef\CT@LCflag{\z@}}% + \else + \gdef{CT@LCflag{1}}% + \fi + \ifnum\CT@LCflag=\z@ + \begingroup + \def\omit\kern##1&{% + \advance\CT@LCnum 1 + \CT@dim=##1\relax + \expandafter\xdef\csname LCdim@\the\CT@LCnum\endcsname{% + \number\CT@dim sp}}% + \CT@LCnum\z@ + \@nameuse{LT@\romannumeral\c@LT@tables}&% + \xdef\CT@LCmax{\the\CT@LCnum}% + \endgroup + \fi + \xdef\CT@LCinitflag{\the\c@LT@tables}} +\def\CT@LCinitflag{\z@} +\def\LC@Cell{% + \kern-\@tempdima + \ifnum\CT@LCflag=\z@ + \ifnum\CT@LCnum=\CT@LCmax\relax + \global\CT@LCnum 1 + \else + \global\advance\CT@LCnum 1 + \fi + \CT@dim=\@nameuse{LCdim@\the\CT@LCnum}\relax + \advance\CT@dim-\@tempdimb + \expandafter\ifx\csname LColor@\the\CT@LCnum\endcsname\@empty\else + \begingroup + \@nameuse{LColor@\the\CT@LCnum}{% + \vrule width\CT@dim}% + \endgroup + \kern-\CT@dim + \fi + \fi} +\def\LC{\@tempdima=\z@\@tempdimb=\z@\LC@Cell} +\def\LCi{\LCi@\LC@Cell} +\def\LCi@{% + \@tempdima=\doublerulesep + \ifnum\CT@LCflag=\z@ + \ifnum\CT@LCnum=\CT@LCmax\relax + \@tempdimb=\arrayrulewidth + \else + \@tempdimb=\z@ + \fi + \fi} +\def\LCii{% + \@tempdima=\z@ + \@tempdimb=\doublerulesep + \advance\@tempdimb=\arrayrulewidth + \LC@Cell} +\def\LCiii{% + \LCi@ + \advance\@tempdimb\doublerulesep + \advance\@tempdimb\arrayrulewidth + \LC@Cell} +\def\LCz#1#2{% + \@tempdima=#1 + \@tempdimb=#2 + \LC@Cell} +% +\catcode`\@=\TheAtCode\relax +\endinput +%% END colortab.tex/colortab.sty diff --git a/usergrps/uktug/baskervi/6_2/spqr/defaults.pst b/usergrps/uktug/baskervi/6_2/spqr/defaults.pst new file mode 100644 index 0000000000..95718537a3 --- /dev/null +++ b/usergrps/uktug/baskervi/6_2/spqr/defaults.pst @@ -0,0 +1,103 @@ +%% defaults.pst +%% Created with unix csh commands: +%% grep ^.psset\@ pstricks.doc > defaults.pst +%% grep ^.psset\@ pst-node.doc >> defaults.pst +%% grep ^.psset\@ gradient.tex >> defaults.pst +%% grep ^.psset\@ pst-coil.doc >> defaults.pst +%% grep ^.psset\@ pst2eps.tex >> defaults.pst +%% grep ^.psset\@ pst-plot.tex >> defaults.pst +%% Input by pst-user.tex +\psset@swapaxes{false} +\psset@showpoints{false} +\psset@border{0pt} +\psset@bordercolor{white} +\psset@doubleline{false} +\psset@doublesep{1.25\pslinewidth} +\psset@doublecolor{white} +\psset@shadow{false} +\psset@shadowsize{3pt} +\psset@shadowangle{-45} +\psset@shadowcolor{darkgray} +\psset@linewidth{.8pt} +\psset@linecolor{black} +\psset@dash{5pt 3pt} +\psset@dotsep{3pt} +\psset@linestyle{solid} +\psset@fillcolor{white} +\psset@hatchwidth{.8pt} +\psset@hatchsep{4pt} +\psset@hatchcolor{black} +\psset@hatchangle{45} +\psset@fillstyle{none} +\psset@arrowscale{1} +\psset@arrowsize{2pt 3} +\psset@arrowlength{1.4} +\psset@arrowinset{.4} +\psset@tbarsize{2pt 5} +\psset@bracketlength{.15} +\psset@rbracketlength{.15} +\psset@arrows{-} +\psset@liftpen{0} +\psset@linetype{0} +\psset@dotstyle{*} +\psset@curvature{1 .1 0} +\psset@dotsize{.5pt 2.5} +\psset@dotscale{1} +\psset@dotangle{0} +\psset@linearc{0pt} +\psset@framearc{0} +\psset@cornersize{relative} +\psset@dimen{outer} +\psset@gridwidth{.8pt} +\psset@griddots{0} +\psset@gridcolor{black} +\psset@subgridwidth{.4pt} +\psset@subgridcolor{gray} +\psset@subgriddots{0} +\psset@subgriddiv{5} +\psset@gridlabels{10pt} +\psset@gridlabelcolor{black} +\psset@framesep{3pt} +\psset@boxsep{true} +\psset@arcsep{0} +\psset@labelsep{5pt} +\psset@nodesep{0} +\psset@offset{0} +\psset@arm{10pt} +\psset@angle{0} +\psset@arcangle{8} +\psset@ncurv{.67} +\psset@loopsize{1cm} +\psset@gradbegin{gradbegin} +\psset@gradend{gradend} +\psset@gradlines{500} +\psset@gradmidpoint{.9} +\psset@gradangle{0} +\psset@coilwidth{1cm} +\psset@coilheight{1} +\psset@coilarm{.5cm} +\psset@coilaspect{45} +\psset@coilinc{10} +\psset@bbllx{-1pt} +\psset@bblly{-1pt} +\psset@bburx{1pt} +\psset@bbury{1pt} +\psset@headers{none} +\psset@checkfile{true} +\psset@makeeps{new} +\psset@headerfile{} +\psset@plotstyle{line} +\psset@plotpoints{50} +\psset@ticksize{3pt} +\psset@tickstyle{full} +\psset@ticks{all} +\psset@labels{all} +\psset@Ox{0} +\psset@Dx{1} +\psset@dx{0} +\psset@Oy{0} +\psset@Dy{1} +\psset@dy{0} +\psset@showorigin{true} +\psset@axesstyle{axes} +\endinput diff --git a/usergrps/uktug/baskervi/6_2/spqr/fancybox.sty b/usergrps/uktug/baskervi/6_2/spqr/fancybox.sty new file mode 100644 index 0000000000..eb823ed143 --- /dev/null +++ b/usergrps/uktug/baskervi/6_2/spqr/fancybox.sty @@ -0,0 +1,949 @@ +%% BEGIN fancybox.sty +%% +\def\fileversion{1.0} +\def\filedate{93/02/10} +%% +%% COPYRIGHT 1993, by Timothy Van Zandt, tvz@Princeton.EDU +%% +%% DESCRIPTION: +%% fancybox.sty is a LaTeX style option, consisting of: +%% * Variants of \fbox: \shadowbox, \doublebox, \ovalbox, \Ovalbox. +%% * Helpful tools for using box macros. +%% * Extensive documentation about how to use box macros. +%% * Flexible verbatim macros. +%% +%% INSTALLATION: +%% Put this file where your TeX looks for inputs. +%% +%% DOCUMENTATION: +%% See fancybox.doc, which might be appended to this file. +%% +%% COPYING: +%% Copying of part or all of this file is allowed under the following +%% conditions only: +%% (1) You may freely distribute unchanged copies of the file. Please +%% include the documentation when you do so. +%% (2) You may modify a renamed copy of the file, but only for personal +%% use or use within an organization. +%% (3) You may copy fragments from the file, for personal use or 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 +%% this file or modified versions or fragments thereof, except for +%% a nominal charge for copying etc. +%% +%% CODE: +\expandafter\ifx\csname fb@framepage\endcsname\relax\else + \expandafter\endinput +\fi +\typeout{Style option: `fancybox' v\fileversion \space <\filedate> (tvz)} + +\newbox\@fancybox +\@ifundefined{@tempdimc}{\newdimen\@tempdimc}{} + +%% \shadowbox + +\newdimen\shadowsize +\shadowsize 4pt + +\def\shadowbox{\VerbBox\@shadowbox} +\def\@shadowbox#1{% + \setbox\@fancybox\hbox{\fbox{#1}}% + \leavevmode\vbox{% + \offinterlineskip + \dimen@=\shadowsize + \advance\dimen@ .5\fboxrule + \hbox{\copy\@fancybox\kern-.5\fboxrule\lower\shadowsize\hbox{% + \vrule \@height\ht\@fancybox \@depth\dp\@fancybox \@width\dimen@}}% + \vskip-\dimen@ + \moveright\shadowsize\vbox{% + \hrule \@width\wd\@fancybox \@height\dimen@}}} + +% \fancyoval + +\def\cornersize{\@ifstar{\@cornersize}{\@@cornersize}} +\def\@cornersize#1{% + \@tempdima=#1\relax + \edef\the@cornersize{\number\@tempdima sp}} +\def\@@cornersize#1{% + \edef\the@cornersize{#1\noexpand\@tempdimb}} +\cornersize{.5} + +% This is just a simple change to \oval, making use of the \cornersize +% parameter instead of making the corner arcs are large as possible. + +\def\fancyoval(#1,#2){\@ifnextchar[{\fancy@oval(#1,#2)}{\fancy@oval(#1,#2)[]}} + +\def\fancy@oval(#1,#2)[#3]{% + \begingroup + \fancy@@oval{#1\unitlength}{#2\unitlength}{#3}% + \@put{-.5\wd\@tempboxa}{-.5\ht\@tempboxa}{\ht\@tempboxa=\z@\box\@tempboxa}% + \endgroup} + +\def\fancy@@oval#1#2#3{% + \boxmaxdepth \maxdimen + \@ovttrue \@ovbtrue \@ovltrue \@ovrtrue + \@tfor\@tempa :=#3\do{\csname @ov\@tempa false\endcsname}% + \@ovxx#1\relax + \advance\@ovxx-\@wholewidth + \@ovyy#2\relax + \advance\@ovyy-\@wholewidth + \@tempdimb \ifdim \@ovyy >\@ovxx \@ovxx\else \@ovyy \fi + \advance\@tempdimb-2\p@ + \ifdim\@tempdimb>\the@cornersize\relax + \@tempdimb=\the@cornersize + \fi + \@getcirc\@tempdimb + \@ovro\ht\@tempboxa \@ovri\dp\@tempboxa + \@ovdx\@ovxx \advance\@ovdx-\@tempdima \divide\@ovdx \tw@ + \@ovdy\@ovyy \advance\@ovdy-\@tempdima \divide\@ovdy \tw@ + \@circlefnt + \setbox\@tempboxa\hbox{% + \if@ovr \@ovvert32\kern -\@tempdima \fi + \if@ovl \kern \@ovxx \@ovvert01\kern -\@tempdima \kern -\@ovxx \fi + \if@ovt \@ovhorz \kern -\@ovxx \fi + \if@ovb \raise \@ovyy \@ovhorz \fi}% + \advance\@ovdx\@ovro + \advance\@ovdy\@ovro + \advance\@ovxx\@wholewidth + \wd\@tempboxa=\@ovxx + \dp\@tempboxa=\z@} + +% \ovalbox + +\def\ovalbox{\VerbBox{\@ovalbox\thinlines}} +\def\Ovalbox{\VerbBox{\@ovalbox\thicklines}} +\def\@ovalbox#1#2{% + \begingroup + #1\relax + \setbox\@fancybox\hbox{{#2}}% + \@tempdimc\fboxsep \advance\@tempdimc\@wholewidth + \@tempdima\ht\@fancybox \advance\@tempdima\dp\@fancybox + \advance\@tempdima2\@tempdimc + \@tempdimb\wd\@fancybox \advance\@tempdimb2\@tempdimc + \fancy@@oval\@tempdimb\@tempdima{}% + \@tempdima\dp\@fancybox \advance\@tempdima\@tempdimc + \wd\@tempboxa=\z@ + \leavevmode\hbox{% + \lower\@tempdima\box\@tempboxa + \kern\@tempdimc\box\@fancybox\kern\@tempdimc}% + \endgroup} + +% \doublebox + +\def\doublebox{\VerbBox\@doublebox} +\def\@doublebox#1{% + \begingroup + \setbox\@fancybox\hbox{{#1}}% + \fboxrule=.75\fboxrule + \setbox\@fancybox\hbox{\fbox{\box\@fancybox}}% + \fboxrule=2\fboxrule + \fboxsep=\fboxrule + \advance\fboxsep .5pt + \fbox{\box\@fancybox}% + \endgroup} + +% Frames for seminar.sty: + +\@ifundefined{newslideframe}{}{% + \newslideframe{shadow}{\shadowbox{#1}} + \newslideframe{double}{\doublebox{#1}} + \newslideframe{oval}{\ovalbox{#1}} + \newslideframe{Oval}{\Ovalbox{#1}}} + +% Sbox environment + +\newbox\@Sbox + +\def\Sbox{\global\setbox\@Sbox\hbox\bgroup\ignorespaces} + +\def\endSbox{% + \@testtrue\ifhmode\ifinner\@testfalse\fi\fi + \if@test\@latexerr{Misplaced \string\endSbox! Should be in LR mode}\@ehd\fi + \egroup} + +\def\TheSbox{% + \ifvoid\@Sbox + \@latexerr{\string\TheSbox\space is empty!}\@ehd + \else + \box\@Sbox + \fi} + +\def\beginsbox#1{\setbox#1\hbox\bgroup\ignorespaces} + +\def\endsbox{\endSbox} + +% \VerbBox + +\newtoks\do@VerbBox + +\def\VerbBox#1{% + \do@VerbBox{#1}% + \afterassignment\begin@VerbBox + \setbox\@fancybox=\hbox} +\def\begin@VerbBox{\aftergroup\end@VerbBox} +\def\end@VerbBox{\the\do@VerbBox{\box\@fancybox}}% + +% \Btrivlist + +\def\@Blistrestore{% + \let\par\relax + \let\-\@dischyph \let\'\@acci \let\`\@accii \let\=\@acciii + \lineskip\normallineskip \baselineskip\normalbaselineskip} + +\def\Btrivlist#1{\@ifnextchar[{\@Btrivlist{#1}}{\@Btrivlist{#1}[]}} +\def\@Btrivlist#1[#2]{% + \@Blistrestore + \let\\=\@Btrivlistcr + \fb@beginvbox{#2}% + \halign\bgroup + \if#1l\else\@empty\hfil\fi + \ignorespaces##\unskip + \if#1r\@empty\else\hfil\fi\cr} +\def\endBtrivlist{\crcr\egroup\egroup\if@pboxsw$\fi} + +\def\fb@beginvbox#1{% + \leavevmode + \@pboxswfalse + \if#1b\@empty\vbox\else\if#1t\@empty\vtop\else + \ifmmode\vcenter\else\@pboxswtrue$\vcenter\fi + \fi\fi\bgroup} + +\def\@Btrivlistcr{\@ifstar + {\@ifnextchar[{@@Btrivlistcr}{\cr}}{\@ifnextchar[{\@@Btrivlistcr}{\cr}}} +\def\@@Btrivlistcr[#1]{\cr\noalign{\vskip #1}} + +\def\Bcenter{\Btrivlist{c}} +\def\endBcenter{\endBtrivlist} + +\def\Bflushleft{\Btrivlist{l}} +\def\endBflushleft{\endBtrivlist} + +\def\Bflushright{\Btrivlist{r}} +\def\endBflushright{\endBtrivlist} + +% \Blist + +\def\Blist#1#2{\@ifnextchar[{\@Blist{#1}{#2}}{\@Blist{#1}{#2}[]}} + +\def\@Blist#1#2[#3]{% + \ifnum\@listdepth>5 + \@toodeep + \else + \global\advance\@listdepth\@ne + \fi + \itemindent\z@ + \csname @list\romannumeral\the\@listdepth\endcsname + \def\@itemlabel{#1}% + \let\makelabel\@mklab + \@nmbrlistfalse + \@Blistrestore + \let\\=\@Blistcr + \let\item\Bitem + \@Bitemswfalse + #2\relax + \fb@beginvbox{#3}% + \halign\bgroup + \ignorespaces##&\hskip\labelsep\ignorespaces##\unskip\hfil\cr} + +\def\endBlist{\endBtrivlist\global\advance\@listdepth\m@ne} + +\newif\if@Bitemsw + +\def\Bitem{\@ifnextchar({\@Bitemcr\Bitem@skip}{\@Bitemcr\@Bitem}} + +\def\@Bitemcr{% + \if@Bitemsw + \def\next{\cr\noalign{\vskip\itemsep}}% + \else + \def\next{\global\@Bitemswtrue}% + \fi + \next} + +\def\Bitem@skip(#1){\noalign{\vskip #1}\@Bitem} + +\def\@Bitem{\@ifnextchar[{\Bitem@label}{\Bitem@nolabel}} + +\def\Bitem@label[#1]{\makelabel{#1}&} + +\def\Bitem@nolabel{% + \if@nmbrlist + \expandafter\advance\csname c@\@listctr\endcsname1 \fi + \makelabel{\@itemlabel}% + &% + \if@nmbrlist\refstepcounter{\@listctr}\fi} + +\def\@Blistcr{\@ifstar + {\@ifnextchar[{@@Blistcr}{\cr&}}{\@ifnextchar[{\@@Blistcr}{\cr&}}} + +\def\@@Blistcr[#1]{\cr\noalign{\vskip #1}&} + +% \Bitemize + +\def\Bitemize{% + \ifnum\@itemdepth>3 + \@toodeep + \else + \advance\@itemdepth\@ne + \fi + \edef\@itemitem{labelitem\romannumeral\the\@itemdepth}% + \Blist{\csname\@itemitem\endcsname}{\def\makelabel####1{\hfil####1}}} +\def\endBitemize{\endBlist} + +% \Bdescription + +\def\Bdescription{\Blist{}{\def\makelabel####1{\bf####1\hfil}}} +\def\endBdescription{\endBlist} + +% \Benumerate + +\def\Benumerate{% + \ifnum\@enumdepth>3 + \@toodeep + \else + \advance\@enumdepth\@ne + \fi + \edef\@enumctr{enum\romannumeral\the\@enumdepth}% + \Blist{\csname label\@enumctr\endcsname}% + {\usecounter{\@enumctr}\def\makelabel####1{\hfil####1}}} +\def\endBenumerate{\endBlist} + +% Beqnarray + +\def\Beqnarray{% + \stepcounter{equation}% + \let\@currentlabel\theequation + \def\@eqnnum{{\csname reset@font\endcsname\rm (\theequation)}}% + \global\@eqnswtrue\m@th + \global\@eqcnt\z@ + \tabskip\@centering + \let\\\@eqncr + \vbox\bgroup + \halign\bgroup + \@eqnsel + \hskip\@centering + $\displaystyle\tabskip\z@{##}$% + &\global\@eqcnt\@ne + \hskip 2\arraycolsep + \hfil${##}$\hfil + &\global\@eqcnt\tw@ + \hskip 2\arraycolsep + $\displaystyle\tabskip\z@{##}$% + \hfil + \tabskip\@centering + &\if@eqnsw\hskip 1em\fi + \hfil{##}\tabskip\z@ + \cr} + +\def\endBeqnarray{% + \@@eqncr + \egroup + \global\advance\c@equation\m@ne + \egroup + \global\@ignoretrue} + +\@namedef{Beqnarray*}{\def\@eqncr{\nonumber\@seqncr}\Beqnarray} +\@namedef{endBeqnarray*}{\nonumber\endBeqnarray} + +% \fb@outputage + +% Here we insert various hooks for rotating or framing the page. +% Otherwise, it is the usual \@outputpage + +\def\fb@outputpage{% + \begingroup + \catcode`\ =10 + \let\-\@dischyph + \let\'\@acci + \let\`\@accii + \let\=\@acciii + \if@specialpage + \global\@specialpagefalse\@nameuse{ps@\@specialstyle}% + \fi + \if@twoside + \ifodd\count\z@ + \let\@thehead\@oddhead + \let\@thefoot\@oddfoot + \let\@themargin\oddsidemargin + \else + \let\@thehead\@evenhead + \let\@thefoot\@evenfoot + \let\@themargin\evensidemargin + \fi + \fi + \csname reset@font\endcsname + \normalsize + \baselineskip\z@ + \lineskip\z@ + \let\par\@@par + \ifx\this@fancypage\@empty\else + \this@fancypage + \gdef\this@fancypage{}% + \fi + \ifx\the@fancypage\@empty\else + \setbox\@outputbox\hbox{\the@fancypage{\box\@outputbox}}% + \fi + \ifx\fb@@rotatepage\@empty\else + \setbox\@outputbox\hbox{\fb@@rotatepage{\box\@outputbox}}% + \fi + \setbox\@outputbox\vbox{% + \@tempdima=\wd\@outputbox + \setbox\@tempboxa=\hbox to\@tempdima{% + \let\label\@gobble + \let\index\@gobble + \let\glossary\@gobble + \@thehead}% + \ht\@tempboxa\headheight + \dp\@tempboxa\z@ + \box\@tempboxa + \vskip\headsep + \box\@outputbox + \baselineskip\footskip + \hbox to\@tempdima{% + \let\label\@gobble + \let\index\@gobble + \let\glossary\@gobble + \@thefoot}} + \ifx\the@@fancypage\@empty\else + \setbox\@outputbox\hbox{\the@@fancypage{\box\@outputbox}}% + \fi + \setbox\@outputbox\vbox{% + \ifnum\fancyput@flag>-1 \do@fancyput\fi + \vskip\topmargin + \moveright\@themargin\box\@outputbox}% + \ifx\fb@rotatepage\@empty\else + \setbox\@outputbox\hbox{\lower\ht\@outputbox\box\@outputbox}% + \dp\@outputbox\z@ + \wd\@outputbox\z@ + \setbox\@outputbox\hbox{\fb@rotatepage{\box\@outputbox}}% + \expandafter\fb@setoffsets\fb@theoffsets + \fi + \shipout\box\@outputbox + \global\@colht\textheight + \endgroup + \stepcounter{page}% + \let\firstmark\botmark} + +% \fancypage + +\def\the@fancypage{} +\def\the@@fancypage{} +\def\this@fancypage{} + +\def\fancypage#1#2{% + \def\the@fancypage{#1}% + \def\the@@fancypage{#2}% + \def\@outputpage{\fb@outputpage}} + +\def\thisfancypage#1#2{% + \gdef\@outputpage{\fb@outputpage}% + \gdef\this@fancypage{\def\the@fancypage{#1}\def\the@@fancypage{#2}}} + +% \fancyput + +% Token registers used to make it easier to put definitions in argument. +% Boxes not processed until output so that contents can depend, e.g., on +% current page or marks or whatever. This makes everything slightly more +% complicated than one would expect. + +\newtoks\the@fancyput +\newtoks\this@fancyput +\def\fancyput@flag{-1}% + +% \fancyput@flag=-1 if no fancyput, 0 if regular fancyput, 1 if thisfancyput. + +\def\fancyput{% + \def\@outputpage{\fb@outputpage} + \@ifstar{\@testtrue\@fancyput}{\@testfalse\@fancyput}} +\def\@fancyput{\@ifnextchar({\@@fancyput}{\@@fancyput(\z@,\z@)}} +\def\@@fancyput(#1,#2)#3{% + \if@test + \expandafter\the@fancyput\expandafter{\the\the@fancyput\do{#1}{#2}{#3}}% + \else + \the@fancyput{\do{#1}{#2}{#3}}% + \fi + \gdef\fancyput@flag{\z@}} + +\def\thisfancyput{% + \gdef\@outputpage{\fb@outputpage} + \@ifstar{\@testtrue\@thisfancyput}{\@testfalse\@thisfancyput}} +\def\@thisfancyput{\@ifnextchar({\@@thisfancyput}{\@@thisfancyput(\z@,\z@)}} +\def\@@thisfancyput(#1,#2)#3{% + \if@test + \ifnum\fancyput@flag=\z@ + \expandafter\global\expandafter\this@fancyput\expandafter{% + \the\this@fancyput\do{#1}{#2}{#3}}% + \else + \expandafter\global\expandafter\this@fancyput\expandafter{% + \the\the@fancyput\do{#1}{#2}{#3}}% + \fi + \else + \global\this@fancyput{\do{#1}{#2}{#3}}% + \fi + \gdef\fancyput@flag{1}} + +\def\do@fancyput{% + \def\do##1##2##3{\raise##2\hbox to\z@{\kern##1\relax##3\hss}}% + \setbox\@tempboxa=\hbox to\z@{% + \kern-\hoffset + \raise\voffset\hbox{% + \ifnum\fancyput@flag=\z@\the\the@fancyput\else\the\this@fancyput\fi}% + \hss}% + \ht\@tempboxa=\z@ \dp\@tempboxa=\z@ + \box\@tempboxa + \gdef\fancyput@flag{\z@}% + \global\this@fancyput{}} + +% \Landscape + +\def\UsePageParameters{% + \clearpage + \global\@colht\textheight + \onecolumn} + +\def\fb@rotatepage{} + +\def\Landscape{\@ifstar{\@testtrue\@Landscape}{\@testfalse\@Landscape}} +\def\@Landscape#1#2#3{% + \clearpage + \def\fb@rotatepage{#3}% + \def\@outputpage{\fb@outputpage}% + \@tempdima#1\relax + \@tempdimb#2\relax + \if@test + \edef\fb@theoffsets{{\voffset}{\hoffset}{\number\@tempdima sp}}% + \else + \edef\fb@theoffsets{{\hoffset}{\voffset}{\number\@tempdimb sp}}% + \fi + \advance\@tempdimb-\@tempdima + \advance\textwidth\@tempdimb + \advance\textheight-\@tempdimb + \UsePageParameters} +\def\endLandscape{\clearpage\aftergroup\UsePageParameters} + +\def\fb@setoffsets#1#2#3{% + \@tempdima#1% + \advance#1#2% + #2#3 + \advance#2-2in + \advance#2-\@tempdima} + +\@namedef{Landscape*}{\@testtrue\@Landscape} +\@namedef{endLandscape*}{\endLandscape} + +% \LandScape + +\def\fb@@rotatepage{} + +\def\LandScape#1{% + \clearpage + \def\fb@@rotatepage{#1}% + \def\@outputpage{\fb@outputpage}% + \@tempdima\textheight + \textheight\textwidth + \textwidth\@tempdima + \UsePageParameters} +\def\endLandScape{\clearpage\aftergroup\UsePageParameters} + +% \GenericCaption + +\def\GenericCaption#1{% + \par + \begingroup + \@parboxrestore + \normalsize + \vskip 10\p@ + \setbox\@tempboxa\hbox{#1}% + \ifdim\wd\@tempboxa>\hsize + #1\par + \else + \hbox to\hsize{\hfil\box\@tempboxa\hfil}% + \fi + \endgroup + \par} + +% \landfloat + +\def\landfloat#1#2{% + \gdef\curr@landfloat{#1}% + \gdef\float@rotation{#2}% + \begin{#1}[p]% + \setbox\@tempboxa\vbox\bgroup + \hsize\@colht + \@parboxrestore} +\def\endlandfloat{% + \par\vskip\z@ + \egroup + \setbox\@tempboxa\hbox{\float@rotation{\box\@tempboxa}}% + \centerline{\box\@tempboxa}% + \expandafter\end\expandafter{\curr@landfloat}} + +% \boxput + +\def\boxput{\@ifstar{\@testtrue\@boxput}{\@testfalse\@boxput}} +\def\@boxput{\@ifnextchar({\@@boxput}{\@@boxput(0,0)}} +\long\def\@@boxput(#1,#2)#3#4{% + \setbox\@fancybox\hbox{{#4}}% + \setbox\@tempboxa\vbox to\z@{\vss\hbox to\z@{\hss{#3}\hss}\vss}% + \@tempdima=#1\wd\@fancybox + \advance\@tempdima\wd\@fancybox + \divide\@tempdima 2 + \ifcat a#2\relax + \@tempdimb=\z@ + \else + \@tempdimb=.5\ht\@fancybox + \advance\@tempdimb.5\dp\@fancybox + \@tempdimc=\@tempdimb + \advance\@tempdimc-\dp\@fancybox + \@tempdimb=#2\@tempdimb + \advance\@tempdimb\@tempdimc + \fi + \setbox\@tempboxa\hbox to \z@{% + \if@test\kern-\wd\@fancybox\fi + \kern\@tempdima\raise\@tempdimb\box\@tempboxa\hss}% + \ht\@tempboxa=\z@ \dp\@tempboxa=\z@ + \leavevmode + \if@test + \hbox{\box\@fancybox\box\@tempboxa}% + \else + \hbox{\box\@tempboxa\box\@fancybox}% + \fi} + +% \Vfootnotes + +\def\VerbatimFootnotes{\let\@footnotetext\V@footnotetext} + +\long\def\V@footnotetext{% + \afterassignment\V@@footnotetext + \let\@tempa} +\def\V@@footnotetext{% + \insert\footins\bgroup + \csname reset@font\endcsname + \footnotesize + \interlinepenalty\interfootnotelinepenalty + \splittopskip\footnotesep + \splitmaxdepth\dp\strutbox + \floatingpenalty \@MM + \hsize\columnwidth + \@parboxrestore + \edef\@currentlabel{\csname p@footnote\endcsname\@thefnmark}% + \@makefntext{}% + \rule{\z@}{\footnotesep}% + \bgroup + \aftergroup\V@@@footnotetext + \ignorespaces} +\def\V@@@footnotetext{\strut\egroup} + +% Verbatim + +% The main idea is to separate the reading and formatting of the +% verbatim listing. It's pretty simple. + +\def\Verbatim@Codes{% + \let\do\@makeother + \dospecials + \Verbatim@ObeyThings + \ThisVerbCodes\relax\gdef\ThisVerbCodes{}} + +\def\EveryVerbatimCodes{} + +% \Verbatim is redefined temporarilly in \Get@Verbatim to scan the +% verbatim text. \Verbatim is used so that error messages are more +% enlightening. \next checks whether \Verbatim found its argument, +% and attempts to recover if not. +% +% Heuristically, if current environment is `foo' and argument of +% \Get@Verbatim is \The@Verbatim, then definition of \Verbatim is +% +% \def\Verbatim#1^^M#2^^M\the\EndVerbatimTokens\end{foo}{% +% \xdef\The@Verbatim{\noexpand\Every@VerbatimLine#2}% +% \endgroup\end{foo}} +% +% \The@Verbatim is then equal to the verbatim text, with spaces +% replaced by \Verbatim@Space, tabs replaced by \Verbatim@Tab, +% and ` replaced by \@lquote. In addition, each line begins with +% \Every@VerbatimLine, and each line but the last ends with +% \Verbatim@Par. It is then possible to redefine these when formatting +% the verbatim text. To insert each line as an argument to \foo, use +% \def\Every@VerbatimLine#1\Verbatim@Par{\foo{#1}} +% \The@Verbatim\Verbatim@Par +% +\newtoks\EndVerbatimTokens +\begingroup + \catcode`\|=0 + \catcode`\[=1 + \catcode`\]=2 + \catcode`\{=12 + \catcode`\}=12 + \catcode`\^^M=13% + \catcode`\\=12% + |gdef|Get@Verbatim#1[% + |begingroup% + |Verbatim@Codes|EveryVerbatimCodes% + |let|protect|noexpand% + |VerbatimEnvironment% + |edef|next[|noexpand|def|noexpand|Verbatim####1|noexpand^^M####2% + |noexpand^^M|the|EndVerbatimTokens\end{|@VerbEnvir}]% + |edef|endVerbatim[|noexpand|endgroup|noexpand|end[|@VerbEnvir]]% + |global|let|@VerbEnvir|relax% + |next[|@nil|xdef#1[|noexpand|Every@VerbatimLine##2]|endVerbatim]% + |def|next[|@ifnextchar|@nil[|@gobble]% If \@nil is there, then + [|gdef#1[]|endVerbatim|end[document]]]% \Verbatim found its argument. + |expandafter|next|Verbatim]% Otherwise, try to recover. + |gdef|AltGet@Verbatim#1[% + |begingroup% + |Verbatim@Codes|EveryVerbatimCodes% + |def^^M##1^^M##2[% + |ifx|@nil##2|@empty|else% + |noexpand|Verbatim@Par|noexpand|Every@VerbatimLine##1% + |expandafter^^M|expandafter##2% + |fi]% + |let|protect|noexpand% + |VerbatimEnvironment% + |edef|next[|noexpand|def|noexpand|Verbatim####1|noexpand^^M####2% + \end{|@VerbEnvir}]% + |edef|endVerbatim[|noexpand|endgroup|noexpand|end[|@VerbEnvir]]% + |global|let|@VerbEnvir|relax% + |next[|@nil|xdef#1[|noexpand|Every@VerbatimLine##2^^M|@nil]|endVerbatim]% + |def|next[|@ifnextchar|@nil[|@gobble]% + [|gdef#1[]|endVerbatim|end[document]]]% + |expandafter|next|Verbatim]% +|endgroup +\def\AltGetVerbatim{\let\Get@Verbatim\AltGet@Verbatim} + +% It is enough to not use \begin or \end when defining new verbatim +% environments, as the default is for \Get@Verbatim to look for the +% end of the current environment, but using \VerbatimEnvironment +% is easier to explain to users. + +\def\VerbatimEnvironment{% + \ifx\@VerbEnvir\relax\xdef\@VerbEnvir{\@currenvir}\fi} + +\let\@VerbEnvir\relax + +\def\The@VerbatimErr{% + \gdef\The@Verbatim{\@latexerr{Misplaced \string\end{Verbatim}}\@ehd}} +\The@VerbatimErr + +\begingroup +\catcode`\^^M=\active% +\catcode`\ =\active% +\catcode`\^^I=\active% +\gdef\Verbatim@ObeyThings{% +\catcode`\^^M=\active% +\catcode`\ =\active% +\catcode`\^^I=\active% +\catcode``=\active% +\def^^M{\noexpand\Verbatim@Par\noexpand\Every@VerbatimLine}% +\def^^I{\noexpand\Verbatim@Tab}% +\def {\noexpand\Verbatim@Space}% +\Verbatim@NoLigs}% +\gdef\Verbatim@DontObeyLines{\outer\def^^M{}}% +\endgroup + +\def\SaveVerbatim{\@bsphack\Get@Verbatim} + +\def\endSaveVerbatim{\@esphack} + +{\catcode``13 \gdef\Verbatim@NoLigs{\def`{\noexpand\@lquote}}} + +\def\Verbatim@Prep{% + \frenchspacing + \ThisVerb\relax\gdef\ThisVerb{}% + \VerbatimFont + \EveryVerbatim + \let\Every@VerbatimLine\EveryVerbatimLine + \def\Verbatim@Space{\leavevmode\penalty\@M\VerbatimSpace}% + \def\Verbatim@Tab{\leavevmode\penalty\@M\VerbatimTab}}% + +\def\Verb@Prep{% + \frenchspacing + \ThisVerb\relax\gdef\ThisVerb{}% + \VerbFont + \EveryVerb + \let\Every@VerbatimLine\EveryVerbatimLine + \def\Verbatim@Space{\leavevmode\penalty\@M\VerbSpace}% + \def\Verbatim@Tab{\leavevmode\penalty\@M\VerbTab}}% + +\def\Verbatim@Par{\leavevmode\null\@@par\penalty\interlinepenalty} + +% Parameter initialization: + +\def\VerbatimSpace{\ } + +{\catcode`\ =12\gdef\ttspace{{\tt }}} + +\def\VerbSpace{\ } + +\def\VerbatimTab{\ \ \ \ \ \ \ \ } + +\def\VerbTab{\ } + +\def\EveryVerbatim{} + +\def\EveryVerb{} + +\def\ThisVerb{} + +\def\EveryVerbatimLine{}% + +\def\EveryVerbOutLine{} + +\def\VerbatimFont{\tt} + +\def\VerbFont{\tt} + +\def\VerbatimFuzz{2pt}% + +\def\EveryVerbatimCodes{} + +\def\EveryVerbCodes{} + +\def\EveryVerbOutCodes{} + +\def\ThisVerbCodes{} + +\def\Verbatim@List#1{% + \if@minipage\else\vskip\parskip\fi + \leftskip\@totalleftmargin + \@rightskip\@flushglue \rightskip\@rightskip + \parindent\z@ + \parskip\z@ + \parfillskip\@flushglue + \hfuzz\VerbatimFuzz\relax + \@@par + \global\@inlabelfalse %Prevents vspace from being inserted when + \Verbatim@Prep %first line exceeds \hsize. + #1% + \Verbatim@Par}% + +\def\UseVerbatim#1{% + \begingroup\trivlist\item[]\Verbatim@List{#1}\endtrivlist\endgroup} + +\def\Verbatim{\Get@Verbatim\The@Verbatim} +\def\endVerbatim{\UseVerbatim\The@Verbatim\The@VerbatimErr} + +\def\LUseVerbatim#1{% + \begingroup\list{}{}\item[]\Verbatim@List{#1}\endlist\endgroup} + +\def\LVerbatim{\Get@Verbatim\The@Verbatim} +\def\endLVerbatim{\LUseVerbatim\The@Verbatim\The@VerbatimErr} + +\def\BUseVerbatim{% + \@ifnextchar[{\@BUseVerbatim}{\@BUseVerbatim[]}} +\def\@BUseVerbatim[#1]#2{% + \begingroup + \Verbatim@Prep + \let\Verbatim@Par\@Btrivlistcr + \@Btrivlist{l}[#1]% + #2% + \endBtrivlist + \endgroup}% + +\def\BVerbatim{% + \catcode`\^^M=13\relax + \@ifnextchar[{\@BVerbatim}{\@BVerbatim[]}} +\def\@BVerbatim[#1]{\def\@tempa{[#1]}\Get@Verbatim\The@Verbatim} +\def\endBVerbatim{ + \expandafter\@BUseVerbatim\@tempa\The@Verbatim\The@VerbatimErr} + +\newwrite\Verbatim@Outfile +\def\VerbatimOut#1{% + \@bsphack + \begingroup + \immediate\openout\Verbatim@Outfile #1\relax + \def\EveryVerbatimCodes{\EveryVerbOutCodes}% + \Get@Verbatim\The@Verbatim} +\def\endVerbatimOut{% + \Verbatim@ObeyThings + \def\Verbatim@Par{^^J}% + \def\Verbatim@Space{\space}% + \def\Verbatim@Tab{\space}% + \def\@lquote{\string`}% + \ThisVerb\relax\gdef\ThisVerb{}% + \let\Every@VerbatimLine\EveryVerbOutLine + \immediate\write\Verbatim@Outfile{\The@Verbatim}% + \immediate\closeout\Verbatim@Outfile + \endgroup + \The@VerbatimErr + \@esphack} + +% This one is a little tricky because: +% * we want to ignore the ^^M at the end of the last line, +% * we want to handle files that end with newline and files that don't +% * we want comment characters to work properly, +% * we want to expand each line before inserting \Every@VerbatimLine and +% \Verbatim@Par, +% +% \The@GVerbatim is used as scratch with global redefinition. +\newread\Verbatim@Infile +\def\Verbatim@Input#1#2{% + \begingroup + \Verbatim@Codes\EveryVerbatimCodes + \immediate\openin\Verbatim@Infile #1\relax + \ifeof\Verbatim@Infile + \@latexerr{No verbatim file #1}\@ehd + \else + \def\The@GVerbatim{}\Verbatim@NextLine + \ifeof\Verbatim@Infile + \@latexerr{Verbatim file #1 is empty}\@ehd + \else + \let\The@Verbatim\The@GVerbatim + \def\The@GVerbatim{}\Verbatim@NextLine + #2{\Verbatim@@Input}% + \fi + \fi + \immediate\closein\Verbatim@Infile + \endgroup} +\def\Verbatim@@Input{% + \let\protect\noexpand + \edef\The@Verbatim{% + \noexpand\Every@VerbatimLine + \The@Verbatim + \ifeof\Verbatim@Infile\else\noexpand\Verbatim@Par\fi}% + \let\protect\relax + \The@Verbatim + \ifeof\Verbatim@Infile\else + \let\The@Verbatim\The@GVerbatim + \def\The@GVerbatim{}\Verbatim@NextLine + \expandafter\Verbatim@@Input + \fi}% +\begingroup\catcode`\^^M=\active% +\gdef\Verbatim@NextLine{% + \ifeof\Verbatim@Infile\else% + \immediate\read\Verbatim@Infile to\@tempa% + \expandafter\Verbatim@@NextLine\@tempa^^M\relax^^M\@nil% + \fi}% +% #2 is empty if line ends in ^^M, #2=\relax otherwise. +\gdef\Verbatim@@NextLine#1^^M#2^^M#3\@nil{% + \expandafter\gdef\expandafter\The@GVerbatim\expandafter{\The@GVerbatim#1}% + \ifx#2\@empty\@empty\else\expandafter\Verbatim@NextLine\fi}% +\endgroup% + +\def\UseVerb#1{\begingroup\Verb@Prep#1\endgroup} + +\def\SaveVerb{\@ifnextchar[{\Save@Verb}{\Save@Verb[]}} + +\long\def\Save@Verb[#1]#2{% + \begingroup + \Verbatim@Codes\Verbatim@DontObeyLines\EveryVerbCodes + \Save@@Verb{#1}{#2}} + +\long\def\Save@@Verb#1#2#3{% + \let\protect\noexpand + \def\next{\@ifnextchar\@nil{\@gobble}{\endgroup}}% + \long\def\Verb##1#3{\@nil\xdef#2{##1}\endgroup#1}% + \expandafter\next\Verb} + +\def\Verb{\Save@Verb[\UseVerb{\The@Verbatim}]{\The@Verbatim}} + +\def\VerbatimInput#1{\begingroup\Verbatim@Input{#1}\UseVerbatim\endgroup} + +\def\LVerbatimInput#1{\begingroup\Verbatim@Input{#1}\LUseVerbatim\endgroup} + +\def\BVerbatimInput{\@ifnextchar[{\@BVerbatimInput}{\@BVerbatimInput[]}} +\def\@BVerbatimInput[#1]#2{% + \begingroup\Verbatim@Input{#2}{\@BUseVerbatim[#1]}\endgroup} + +\endinput +%% END fancybox.sty diff --git a/usergrps/uktug/baskervi/6_2/spqr/fancyvrb.rc b/usergrps/uktug/baskervi/6_2/spqr/fancyvrb.rc new file mode 100644 index 0000000000..acbd45e99a --- /dev/null +++ b/usergrps/uktug/baskervi/6_2/spqr/fancyvrb.rc @@ -0,0 +1,265 @@ +% Define verbatim and example environments: +% verbatim - indented like quote environment +% Verbatim - indented like quote environment, \small font. +% nVerbatim - Like "Verbatim", but numbered. +% example - code and output, side by side +% example* - one above other +% example** - one above other, with frames +% Example - Rendered as PS, like original, side by side +% Example* - Rendered as PS, one above other +% Example** - Rendered as PS, one above other, with frames +% Escape - Rendered as PS, with *no* verbatim text +% GridPSExample - PSTricks (gridded) picture, like original, side by side +% PSExample - PSTricks picture, like original, side by side +% The example environments have the following steps in common: +% 1. Save example verbatim to numbered example file +% 2. Input file verbatim or EPS file +% 3. Input again +% All of them save their text as files in the \EXdir directory +% (this needs a trailing / as part of the definition) +% +\RequirePackage{ifthen} +\RequirePackage{graphicx} +\RequirePackage{calc} +% +% variable features +% +\def\EXdir{} +\def\EXprefix{} +\def\EXclass{article} +% +\@ifundefined{fullwidth}{\let\fullwidth\textwidth}{} +\@ifundefined{thechapter}{\newcounter{chapter}}{} +% +\newcounter{eps@counter}[section] +\renewcommand\theeps@counter{% + \arabic{chapter}-\arabic{section}-\arabic{eps@counter}} +\newcounter{side@count} +%\newwrite\exepsfile +%\immediate\openout\exepsfile \EXdir\jobname.expslist\relax + +\def\EPSinput#1{% +\IfFileExists{\EXdir\EXprefix#1.eps}% + {\includegraphics{\EXdir\EXprefix#1.eps}}% + {\underline{\EXdir\EXprefix#1}}% +} + +\def\SideBySideEx#1{% +\trivlist\item[]% + \leavevmode + \global\advance\c@side@count by 1 + \label{\thechapter.\theside@count}% + \ifthenelse{\isodd{\pageref{\thechapter.\theside@count}}}{% + \makebox[\fullwidth][l]{\@@Display{#1}\hspace{5mm} + \BVerbatimInput[fontsize=\small]{\EXdir\EXprefix\theeps@counter}}% + }{% + \makebox[\fullwidth][r]{\@@Display{#1}\hspace{5mm} + \BVerbatimInput[fontsize=\small]{\EXdir\EXprefix\theeps@counter}}% + }% + \endtrivlist +} +\newsavebox{\@display} +\def\@@Display#1{% + \savebox{\@display}{% +\begin{minipage}[b]{.5\fullwidth}#1\end{minipage}% +} + \raisebox{\depth}{\usebox{\@display}}% +} + +\newcommand{\BeginExample}{% + \multiply\topsep by 2 + \global\advance\c@eps@counter\@ne + \edef\@tempa{% + \write\@auxout{\string + \newlabel{ex-\theeps@counter}{{\theeps@counter}{\noexpand\the\c@page}}}} + \@tempa + \nobreak + \VerbatimEnvironment + \catcode`\<=12 + \begin{VerbatimOut}{\EXdir\EXprefix\theeps@counter.tex}% +} +\newcommand{\EndExample}{% + \end{VerbatimOut}% +} + +\def\EndRuleExample{\vskip 7pt \hrule height 1.5pt\relax} + +\newif\ifgrid +\gridfalse + +\def\PSExample(#1,#2)(#3,#4){% + \def\PictureSize{(#1,#2)(#3,#4)}% + \def\Write@Ex##1{}\BeginExample + } +\def\endPSExample{% + \EndExample + \SideBySideEx{% + %\ifgrid\vskip 8pt \else\relax\fi + \expandafter\pspicture\PictureSize + \ifgrid\usergrid\else\relax\fi + \input{\EXdir\theeps@counter}% + \endpspicture + %\ifgrid\vskip 8pt \fi + }% +} + +\newenvironment{GridPSExample}{\gridtrue\PSExample}{\endPSExample} + +\def\PSTInlineExample(#1,#2){% + \def\PictureSize{(-.2,-.5)(#1,#2)}% + \def\Write@Ex##1{}\BeginExample + } +\def\endPSTInlineExample{% + \EndExample + \expandafter\pspicture\PictureSize + \usergrid + \input{\EXdir\theeps@counter}% + \endpspicture + \hspace{16pt}% + \BVerbatimInput[gobble=0,fontsize=\small]{\EXdir\theeps@counter}% +} +% side by side +\newenvironment{example}{\def\Write@Ex##1{}\BeginExample} % + {\EndExample\SideBySideEx{\input{\EXdir\theeps@counter}}} + +% one above the other +\newenvironment{example*}% + {\def\Write@Ex##1{}\BeginExample}% + {% + \EndExample + \VerbatimInput[gobble=0,fontsize=\small]{\EXdir\theeps@counter}% + \begin{center} + \leavevmode\input{\EXdir\theeps@counter}\par + \end{center} +} +% one above the other +\newenvironment{numexample*}% + {\def\Write@Ex##1{}\BeginExample}% + {% + \EndExample + \VerbatimInput[gobble=0,numbers=left, + fontsize=\small]{\EXdir\theeps@counter}% + \begin{center} + \leavevmode\input{\EXdir\theeps@counter}\par + \end{center} +} + +% with a frame, one above the other +\newenvironment{example**}% +{\def\Write@Ex##1{}\BeginExample}% +{% +\EndExample +\VerbatimInput[gobble=0,fontsize=\small, + frame=topline,framerule=1.5pt]{\EXdir\theeps@counter}% +\begin{center} +\input{\EXdir\theeps@counter} + \EndRuleExample +\end{center} +} + +% now the ones which write stuff for an EPS file +% for side by side examples, the text width of the separate file +% needs to be half the normal width. +\def\EX@extra{} +\def\HalfWidth{% + \def\EX@extra{% + \string\makeatletter + \string\@tempdima\string\textwidth + \string\textwidth.5\string\@tempdima + \string\addtolength{\string\textwidth}{-6mm} + \string\makeatother} +} +\def\Setup@Escape{% + \edef\FancyVerbStopString{\string\end{document}}% + \edef\FancyVerbStartString{\string\begin{document}}% +} +% side by side +\newenvironment{Example}{% + \HalfWidth + \BeginExample} % + {\EndExample +\Setup@Escape +\SideBySideEx{\EPSinput{\theeps@counter}}} + +% first verbatimcode, then actual example +\newenvironment{Example*}{\BeginExample}% + {\EndExample + \Setup@Escape + \begin{center}\leavevmode + \VerbatimInput[gobble=0,fontsize=\small]{\EXdir\EXprefix\theeps@counter}% + \EPSinput{\theeps@counter}% + \end{center}% +} + +% one above the other, framed +\newenvironment{Example**}% +{\BeginExample}% +{% +\EndExample +\Setup@Escape + \VerbatimInput[gobble=0,fontsize=\small, + frame=topline,framerule=1.5pt]{\EXdir\EXprefix\theeps@counter}% +\EPSinput{\theeps@counter} +\EndRuleExample +} + +% no verbatim text at all, just to run the thing separately +\newenvironment{Escape}% +{\BeginExample}% +{% +\EndExample +\Setup@Escape +\EPSinput{\theeps@counter}% +} + +\def\CurrentPackages{} + +\def\FVE@VerbatimOut{\Write@Ex{\string\end{document}}% +\immediate\closeout\FV@OutFile\endgroup\@esphack} + +\def\Write@Ex#1{% + \begingroup + \let\protect\@unexpandable@protect + \edef\reserved@a{\immediate\write\FV@OutFile{#1}} + \reserved@a + \endgroup +} + +\def\FVB@VerbatimOut#1{% + \@bsphack + \begingroup + \FV@UseKeyValues + \FV@DefineWhiteSpace + \def\FV@Space{\space}% + \FV@DefineTabOut + \def\FV@ProcessLine{\immediate\write\FV@OutFile}% + \immediate\openout\FV@OutFile #1\relax + \Write@Ex{\string\documentclass{\EXclass}}% + \Write@Ex{\string\nonstopmode}% + \Write@Ex{\string\usepackage{\CurrentPackages}}% + \Write@Ex{\string\pagestyle{empty}}% + \Write@Ex{\EX@extra}% + \Write@Ex{\string\begin{document}}% + \let\FV@FontScanPrep\relax + \FV@Scan} +% +% compatibility with Michel, with moreverb, and verbatim package +% +\def\SixPt{\fontsize{6}{7\p@}\selectfont} +% +% input files verbatim, numbered and unnumbered +% +\def\verbfile#1{\VerbatimInput[fontsize=\small]{#1}} +\let\verbatiminput\verbfile +\def\listinginput#1#2{\VerbatimInput[fontsize=\small,firstnumber=#1,numbers=left]{#2}} +% +% verbatim in various sizes +\DefineVerbatimEnvironment{sssverbatim}{LVerbatim}{fontsize=\SixPt} +\DefineVerbatimEnvironment{ssverbatim}{LVerbatim}{fontsize=\scriptsize} +\DefineVerbatimEnvironment{fverbatim}{LVerbatim}{fontsize=\footnotesize} +\DefineVerbatimEnvironment{sverbatim}{LVerbatim}{fontsize=\small} +\DefineVerbatimEnvironment{Verbatim}{LVerbatim}{fontsize=\normalsize} +\DefineVerbatimEnvironment{verbatim}{LVerbatim}{fontsize=\normalsize} +% numbered +\DefineVerbatimEnvironment{nVerbatim}{LVerbatim}{fontsize=\small,numbers=left} +\endinput diff --git a/usergrps/uktug/baskervi/6_2/spqr/fancyvrb.sty b/usergrps/uktug/baskervi/6_2/spqr/fancyvrb.sty new file mode 100644 index 0000000000..df4b38298d --- /dev/null +++ b/usergrps/uktug/baskervi/6_2/spqr/fancyvrb.sty @@ -0,0 +1,1672 @@ +%% BEGIN fancyvrb.sty +%% +\def\fileversion{2.0-beta, with DG/SPQR fixes} +\def\filedate{1996/01/01} +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{fancyvrb}[\filedate] +%% +%% COPYRIGHT 1992-1994, by Timothy Van Zandt, tvz@Princeton.EDU +%% +%% DESCRIPTION: +%% fancyvrb.sty is a LaTeX style option, containing flexible +%% verbatim environments and commands and extensive documentation. +%% +%% This is a companion to fancybox.sty, which is probably available +%% from whereever you found fancyvrb.sty. +%% +%% INSTALLATION: +%% Put this file where your TeX looks for inputs. +%% +%% DOCUMENTATION: +%% See fancybox.doc, which might be appended to this file. +%% +%% COPYING: +%% Copying of part or all of this file is allowed under the following +%% conditions only: +%% (1) You may freely distribute unchanged copies of the file. Please +%% include the documentation when you do so. +%% (2) You may modify a renamed copy of the file, but only for personal +%% use or use within an organization. +%% (3) You may copy fragments from the file, for personal use or 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 +%% this file or modified versions or fragments thereof, except for +%% a nominal charge for copying etc. +%% +%% CODE: + +\csname fancyvrb@loaded\endcsname +\let\fancyvrb@loaded\endinput + +\typeout{Style option: `fancyvrb' v\fileversion \space <\filedate> (tvz)} + +%% ERRORS: + +\def\FV@Error#1#2{% + \edef\@tempc{#2}\expandafter\errhelp\expandafter{\@tempc}% + \errmessage{FancyVerb Error:^^J\space\space #1^^J}} + +\def\FV@eha{Your command was ignored. Type to continue.} + +%% VERBATIM FOOTNOTES: + +% Color has to be protected. +% Won't work for some definitions of \@makefntext. +% If it weren't for \@makefntext, I would do this properly by +% defining a footnote environment. + +\def\VerbatimFootnotes{\let\@footnotetext\V@footnotetext} + +\long\def\V@footnotetext{% + \afterassignment\V@@footnotetext + \let\@tempa} +\def\V@@footnotetext{% + \insert\footins\bgroup + \csname reset@font\endcsname + \footnotesize + \interlinepenalty\interfootnotelinepenalty + \splittopskip\footnotesep + \splitmaxdepth\dp\strutbox + \floatingpenalty \@MM + \hsize\columnwidth + \@parboxrestore + \edef\@currentlabel{\csname p@footnote\endcsname\@thefnmark}% + \@makefntext{}% + \rule{\z@}{\footnotesep}% + \bgroup + \aftergroup\V@@@footnotetext + \ignorespaces} +\def\V@@@footnotetext{\strut\egroup} + +%% KEY=VALUE: + +\RequirePackage{keyval} + +% Extensions to keyval.sty: + +% \define@booleankey{}{}{}{} +% +% Defines a for that executes: +% clause when value begins with `t' or `T', or is omitted. +% clause otherwise. + +\def\define@booleankey#1#2#3#4{% + \@namedef{KV@#1@#2@default}{#3}% + \@namedef{KV@#1@#2@false}{#4}% + \@namedef{KV@#1@#2}##1{\KV@booleankey{##1}{#1}{#2}}} +\def\KV@booleankey#1#2#3{% + \edef\@tempa{#1}\expandafter\KV@@booleankey\@tempa\relax\@nil{#2}{#3}} +\def\KV@@booleankey#1#2\@nil#3#4{% + \@nameuse{KV@#3@#4@\if t#1default\else\if T#1default\else false\fi\fi}} + +\def\FV@None{none} +\def\FV@Auto{auto} + +\def\fvset#1{\setkeys{FV}{#1}} + +% \FV@Command is for verbatim commands. Example: +% +% \def\VerbatimInput{\FV@Command{}{VerbatimInput}} +% +% \FV@Command{}{}: +% +% 1. Defines \FV@KeyValues to be . +% 2. Looks for *, and adds `showspaces' to \FV@KeyValues if found. +% 3. Looks for [] argument, and adds it to \FV@KeyValues if found. +% 4. Executes \FVC@. + +\def\FV@Command#1#2{% + \@ifstar + {\def\FV@KeyValues{#1,showspaces}\FV@@Command{#2}}% + {\def\FV@KeyValues{#1}\FV@@Command{#2}}} +\def\FV@@Command#1{% + \@ifnextchar[% + {\FV@GetKeyValues{\@nameuse{FVC@#1}}}% + {\@nameuse{FVC@#1}}} + +\def\FV@GetKeyValues#1[#2]{% + \expandafter\def\expandafter\FV@KeyValues\expandafter{\FV@KeyValues,#2}#1} + +\def\@CustomVerbatimCommand#1#2#3#4{% + \begingroup\fvset{#4}\endgroup % If there are errors, it easier to locate. + \def\@tempa##1##2\@nil{\def\@tempa{##2}}% + \expandafter\@tempa\string#3\@empty\@nil + \@ifundefined{FVC@\@tempa}% + {\FV@Error{Command `\string#3' is not a FancyVerb command.}\@eha}% + {#1{#2}{\FV@Command{#4}{#3}}}} + +\def\CustomVerbatimCommand{\@CustomVerbatimCommand\newcommand} +\def\RecustomVerbatimCommand{\@CustomVerbatimCommand\renewcommand} + +% \FV@Environment is for verbatim enviroments. Example: +% +% \def\Verbatim{\FV@Environment{}{Verbatim}} +% \@namedef{Verbatim*}{\FV@Environment{showspaces}{Verbatim}} +% +% \FV@Environment{}{}: +% +% 1. Defines \FV@KeyValues to be . +% 2. Sets \catcode`\^^M=13, checks for `[', and resets \catcode``^^M=5. +% 3. Reads [] and adds it to \FV@KeyValues if `[' was found. +% 4. Executes \FVB@. + +% \FV@Environment is like \FV@Command, except: +% +% - It omits step 2 (looking for *), and +% - It sets \catcode`\^^M=13 when checking for the `[' of the optional +% argument, so that it does not skip over ^^M if there is no `['. + +\def\FV@Environment#1#2{% + \def\FV@KeyValues{#1}% + \catcode`\^^M=\active + \@ifnextchar[% + {\catcode`\^^M=5 \FV@GetKeyValues{\@nameuse{FVB@#2}}}% + {\catcode`\^^M=5 \@nameuse{FVB@#2}}} + +\def\CustomVerbatimEnvironment{\@CustomVerbatimEnvironment\newenvironment} +\def\RecustomVerbatimEnvironment{\@CustomVerbatimEnvironment\renewenvironment} + +\def\@CustomVerbatimEnvironment#1#2#3#4{% + \begingroup\fvset{#4}\endgroup % If there are errors, it easier to locate. + \@ifundefined{FVB@#3}% + {\FV@Error{`#3' is not a FancyVerb environment.}\@eha}% + {#1{#2}{\FV@Environment{#4}{#3}}{\@nameuse{FVE@#3}}% + #1{#2*}{\FV@Environment{#4,showspaces}{#3}}{\@nameuse{FVE@#3}}}} + +\def\DefineVerbatimEnvironment#1#2#3{% + \@namedef{#1}{\FV@Environment{#3}{#2}}% + \@namedef{end#1}{\@nameuse{FVE@#2}}% + \@namedef{#1*}{\FV@Environment{#3,showspaces}{#2}}% + \@namedef{end#1*}{\@nameuse{FVE@#2}}} + +% Then commands or environments set key values with \FV@UseKeyValues, +% within a group. + +\def\FV@UseKeyValues{% + \ifx\FV@KeyValues\@empty\else + \def\KV@prefix{KV@FV@}% + \expandafter\KV@do\FV@KeyValues,\relax,% + \def\FV@KeyValues{}% + \fi} + +%% SCANNING: +% +% Scanning macros +% - read a line at a time from an environment or a file, +% - save the line in \FV@Line, and +% - execute \FV@PreProcessLine. +% +% \FV@PreProcessLine +% - Determines whether line is in a user-specified ranges, and if so, +% - Strips the line of a user-specified no. of tokens, and +% - executes \FV@ProcessLine{}. +% +% Two things are common to scanning an environment or reading a file: +% \FV@CatCodes --> Change \catcode's. +% \FV@PreProcessLine --> See above. + +%% CODES: + +\def\FV@CatCodes{% + \let\do\@makeother\dospecials + \FV@ActiveWhiteSpace % See below. + \FV@FontScanPrep % See below. + \FV@CatCodesHook % A style hook. + \FancyVerbCodes +} % A user-defined hook. + +\def\FV@ActiveWhiteSpace{% + \catcode`\^^M=\active % End of line + \catcode`\ =\active % Space + \catcode`\^^I=\active} % Tab + +% CM Ligatures: +% Left-quote: `` !` ?` +% Letter f: ff fi fl ffi ffl +% Hyphen: -- --- + +\def\FV@CatCodesHook{} + +\def\FV@AddToHook#1#2{% + \expandafter\def\expandafter#1\expandafter{#1#2\relax}} + +\define@key{FV}{codes}[]{\def\FancyVerbCodes{#1\relax}} +\define@key{FV}{codes*}{% + \expandafter\def\expandafter\FancyVerbCodes\expandafter{% + \FancyVerbCodes#1\relax}} +\fvset{codes} + +\define@key{FV}{commandchars}[\\\{\}]% + {\def\@tempa{#1}% + \ifx\@tempa\FV@None + \let\FV@CommandChars\relax + \else + \FV@DefineCommandChars#1\relax\relax\relax + \fi} + +\def\FV@DefineCommandChars#1#2#3{% + \def\FV@CommandChars{% + \catcode`#1=0\relax\catcode`#2=1\relax\catcode`#3=2\relax}} + +\FV@AddToHook\FV@CatCodesHook\FV@CommandChars + +\define@key{FV}{commentchar}[\%]{% + \def\@tempa{#1}% + \ifx\@tempa\FV@None + \let\FV@CommentChar\relax + \else + \def\FV@CommentChar{\catcode`#1=14}% + \fi} + +\FV@AddToHook\FV@CatCodesHook\FV@CommentChar + +\fvset{commandchars=none,commentchar=none} + +%% PREPROCESS LINE: + +% These is tedious and takes up macro space, but it doesn't slow things +% down much when the parameters are not used. + +% start, stop and gobble parameters: + +% If value is a number, then after the assignment the next token is \relax. + +\define@key{FV}{firstline}{% + \afterassignment\FV@ParseStart\@tempcnta=0#1\relax\@nil{#1}} +\def\FV@ParseStart#1\relax\@nil#2{% + \ifx\@nil#1\@nil + \edef\FancyVerbStartNum{\the\@tempcnta}% + \let\FancyVerbStartString\relax + \else + \edef\FancyVerbStartString{#2}% + \fi} +\def\KV@FV@firstline@default{% + \let\FancyVerbStartNum\z@ + \let\FancyVerbStartString\relax} + +\define@key{FV}{lastline}{% + \afterassignment\FV@ParseStop\@tempcnta=0#1\relax\@nil{#1}} +\def\FV@ParseStop#1\relax\@nil#2{% + \ifx\@nil#1\@nil + \edef\FancyVerbStopNum{\the\@tempcnta}% + \let\FancyVerbStopString\relax + \else + \edef\FancyVerbStopString{#2}% + \fi} +\def\KV@FV@lastline@default{% + \let\FancyVerbStopNum\z@ + \let\FancyVerbStopString\relax} + +\fvset{firstline,lastline} + +\newcount\FV@CodeLineNo + +% If \FV@FindStartStop determines the line should be printed, it +% executes \FV@@PreProcessLine + +\def\FV@PreProcessLine{% + \global\advance\FV@CodeLineNo\@ne + \FV@FindStartStop} + +\def\FV@@PreProcessLine{% + \FV@StepLineNo + \FV@Gobble + \expandafter\FV@ProcessLine\expandafter{\FV@Line}} + +% The definition of \FV@FindStartStop changes, so that we don't +% have to check irrelevant conditions with each line. + +\def\FV@FindStartStop{\FV@DefineFindStart\FV@FindStartStop} + +% \def\FV@DefinePreProcessLine{% +% \setcounter{FancyVerbLine}{0}% +% \FV@DefineFindStart} + +\def\FV@DefineFindStart{% + \ifx\FancyVerbStartString\relax + \ifnum\FancyVerbStartNum<\tw@ + \FV@DefineFindStop + \else + \let\FV@FindStartStop\FV@FindStartNum + \fi + \else + \let\FV@FindStartStop\FV@FindStartString + \fi} + +\def\FV@FindStartNum{% + \ifnum\FancyVerbStartNum>\FV@CodeLineNo\else + \FV@DefineFindStop + \expandafter\FV@@PreProcessLine + \fi} + +\def\FV@FindStartString{% + \expandafter\FV@@FindStartString +{\meaning\FV@Line}% +{\meaning\FancyVerbStartString}% +} +\def\FV@@FindStartString#1#2{% +\edef\@fooA{#1}\edef\@fooB{#2} + \ifx\@fooA\@fooB + \FV@DefineFindStop + \fi +} + +\def\FV@DefineFindStop{% + \ifx\FancyVerbStopString\relax + \ifnum\FancyVerbStopNum<\@ne + \let\FV@FindStartStop\FV@@PreProcessLine + \else + \let\FV@FindStartStop\FV@FindStopNum + \fi + \else + \let\FV@FindStartStop\FV@FindStopString + \fi} + +\def\FV@FindStopNum{% + \ifnum\FancyVerbStopNum=\FV@CodeLineNo + \let\FV@FindStartStop\relax + \ifeof\FV@InFile\else + \immediate\closein\FV@InFile + \fi + \fi + \FV@@PreProcessLine} + +\def\FV@FindStopString{% + \expandafter\FV@@FindStopString +{\meaning\FV@Line}% +{\meaning\FancyVerbStopString}% +} +\def\FV@@FindStopString#1#2{% +\edef\@fooA{#1}\edef\@fooB{#2} + \ifx\@fooA\@fooB + \let\FV@FindStartStop\relax + \ifeof\FV@InFile\else + \immediate\closein\FV@InFile + \fi + \else + \expandafter\FV@@PreProcessLine + \fi} + +% Gobblings. \FV@Gobble does nothing, or strips some tokens from +% the line and stores the result in \FV@Line again. We use +% \LaTeX's renewcommand to define a command for gobbling up to +% 9 arguments. This is not the same as removing 9 tokens, but is +% easier. + +\def\FV@@Gobble{% + \expandafter\expandafter\expandafter\FV@@@Gobble + \expandafter\FV@@@@Gobble\FV@Line + \@nil\@nil\@nil\@nil\@nil\@nil\@nil\@nil\@nil\@nil\@@nil} +\def\FV@@@Gobble#1\@nil#2\@@nil{\def\FV@Line{#1}} + +\define@key{FV}{gobble}{% + \@tempcnta=#1\relax + \ifnum\@tempcnta<\@ne + \let\FV@Gobble\relax + \else + \ifnum\@tempcnta>9 + \FV@Error{gobble parameter must be less than 10}\FV@eha + \else + \renewcommand{\FV@@@@Gobble}[\@tempcnta]{}% + \let\FV@Gobble\FV@@Gobble + \fi + \fi} +\def\FV@@@@Gobble{} +\def\KV@FV@gobble@default{\let\FV@Gobble\relax} + +\fvset{gobble} + +%% SCANNING ENVIRONMENTS: + +\def\FV@Scan{% + \FV@CatCodes + \VerbatimEnvironment + \FV@DefineCheckEnd + \FV@BeginScanning} + +% \VerbatimEnvironment: +% +% This saves the name of the current environment as +% \FV@EnvironName, if the latter is not already defined. +% Then \FV@CheckEnd knows how to find the end as long as either: +% * \begin and \end are not used within the definition of the environment, OR +% * \VerbatimEnvironment is used in the definition before the first \begin. + +\def\VerbatimEnvironment{% + \ifx\FV@EnvironName\relax\xdef\FV@EnvironName{\@currenvir}\fi} + +\let\FV@EnvironName\relax + +%% CHECK END: +% +% We have to check the argument of the first \end{} in each line, compare it +% with \FV@EnvironName, and return \iftrue if it matches and \iffalse +% otherwise. +% +% There are four cases (R=regular): +% +% case : i ii iii iv +% catcode of \ : R 12 12 R +% catcode of {} : R R 12 12 +% +% For uniformity, we use ![] instead of \{} in all the definitions. +% +% We first set the catcodes of \{} to those in effect in the +% verbatim environment. Then we define: +% +% !def!FV@CheckEnd#1[!FV@@CheckEnd#1\end{}!@nil] +% +% If {} have their usual catcodes, we define: +% +% !def!FV@@CheckEnd#1\end#2#3!@nil[!def!@tempa[#2]] +% +% If {} have catcode 12, we define: +% +% !def!FV@@CheckEnd#1\end{#2}#3!@nil[!def!@tempa[#2]] + +\begingroup +\catcode`\!=0 +\catcode`\[=1 +\catcode`\]=2 + +% Case i: + +!gdef!FV@CheckEnd@i#1[!FV@@CheckEnd#1\end{}!@nil] +!gdef!FV@@CheckEnd@i#1\end#2#3!@nil[!def!@tempa[#2]!def!@tempb[#3]] +!gdef!FV@@@CheckEnd@i[\end{}] + +% Case ii: + +\catcode`!\=12 + +!gdef!FV@CheckEnd@ii#1[!FV@@CheckEnd#1\end{}!@nil] +!gdef!FV@@CheckEnd@ii#1\end#2#3!@nil[!def!@tempa[#2]!def!@tempb[#3]] +!gdef!FV@@@CheckEnd@ii[\end{}] + +% Case iii: + +!catcode`!{=12 +!catcode`!}=12 + +!gdef!FV@CheckEnd@iii#1[!FV@@CheckEnd#1\end{}!@nil] +!gdef!FV@@CheckEnd@iii#1\end{#2}#3!@nil[!def!@tempa[#2]!def!@tempb[#3]] +!gdef!FV@@@CheckEnd@iii[\end{}] + +% Case iv: + +!catcode`!\=0 + +!gdef!FV@CheckEnd@iv#1[!FV@@CheckEnd#1\end{}!@nil] +!gdef!FV@@CheckEnd@iv#1\end{#2}#3!@nil[!def!@tempa[#2]!def!@tempb[#3]] +!gdef!FV@@@CheckEnd@iv[\end{}] + +\endgroup + +\def\FV@BadCodes#1{% + \FV@Error + {\string\catcode\space of \expandafter\@gobble\string#1 is wrong: + \the\catcode`#1}% + {Only the following catcode values are allowed: + ^^J\@spaces \expandafter\@gobble\string\\ \space\space --> 0 or 12. + ^^J\@spaces \string{ \string} --> 1 and 2, resp., or both 12. + ^^JTo get this error, either you are a hacker or you got bad advice.}% + \def\FV@CheckEnd##1{\iftrue}} + +\def\FV@DefineCheckEnd{% + \ifnum\catcode`\\=\z@ + \ifnum\catcode`\{=\@ne + \let\FV@CheckEnd\FV@CheckEnd@i + \let\FV@@CheckEnd\FV@@CheckEnd@i + \let\FV@@@CheckEnd\FV@@@CheckEnd@i + \else + \ifnum\catcode`\{=12 + \let\FV@CheckEnd\FV@CheckEnd@iv + \let\FV@@CheckEnd\FV@@CheckEnd@iv + \let\FV@@@CheckEnd\FV@@@CheckEnd@iv + \else + \FV@BadCodes\{% + \fi + \fi + \else + \ifnum\catcode`\\=12 + \ifnum\catcode`\{=\@ne + \let\FV@CheckEnd\FV@CheckEnd@ii + \let\FV@@CheckEnd\FV@@CheckEnd@ii + \let\FV@@@CheckEnd\FV@@@CheckEnd@ii + \else + \ifnum\catcode`\{=12 + \let\FV@CheckEnd\FV@CheckEnd@iii + \let\FV@@CheckEnd\FV@@CheckEnd@iii + \let\FV@@@CheckEnd\FV@@@CheckEnd@iii + \else + \FV@BadCodes\{% + \fi + \fi + \else + \FV@BadCodes\\% + \fi + \fi} + +%% LINE-BY-LINE SCANNING + +% We first skip everything after the beginning of the environment. + +\begingroup +\catcode`\^^M=\active + \gdef\FV@BeginScanning#1^^M{% + \def\@tempa{#1}\ifx\@tempa\@empty\else\FV@BadBeginError\fi + \FV@GetLine}% +\endgroup + +\def\FV@BadBeginError#1{% + \expandafter\@temptokena\expandafter{\@tempa}% + \FV@Error + {Extraneous input `\the\@temptokena' between + \string\begin{\FV@EnvironName}[] and line end}% + {This input will be discarded. Hit to continue.}} + +% If \FancyVerbGetLine does not find a ^^M, then we are at +% the end of the file, and \FV@EOF attempts to terminate the document. +% Otherwise, \FV@EOF is gobbled by \FancyVerbGetLine. + +\def\FV@GetLine{\expandafter\FV@CheckScan\FancyVerbGetLine} + +\begingroup +\catcode`\^^M=\active +\gdef\FancyVerbGetLine#1^^M{% + \@nil + \FV@CheckEnd{#1}% + \ifx\@tempa\FV@EnvironName% % True if end is found + \ifx\@tempb\FV@@@CheckEnd\else\FV@BadEndError\fi% + \let\next\FV@EndScanning% + \else% + \def\FV@Line{#1}% + \def\next{\FV@PreProcessLine\FV@GetLine}% + \fi% + \next}% +\endgroup + +\def\FV@BadEndError{% + \expandafter\@temptokena\expandafter{\@tempb}% + \FV@Error + {Extraneous input `\the\@temptokena' between + \string\end{\FV@EnvironName} and line end}% + {This input will be discarded. Type to continue.}} + +\def\FV@EndScanning{% + \edef\next{\noexpand\end{\FV@EnvironName}}% + \global\let\FV@EnvironName\relax + \next} + +\@ifundefined{@currenvline}{\let\@currenvline\@empty}{} + +\def\FV@CheckScan#1{\@ifnextchar\@nil{\@gobble}{\FV@EOF}} +\def\FV@CheckScan#1{\ifx\@nil#1\@empty\else\expandafter\FV@EOF\fi} + +\def\FV@EOF{% + \FV@Error{Couldn't find `\string\end{\FV@EnvironName}' to end + a verbatim environment\@currenvline.}% + {Probably you mistyped the environment name or included an extraneous + ^^Jspace, or are using an improperly defined verbatim environment. + ^^JHit return and I will try to terminate this job.}% + \FV@EndScanning + \end{document}} + +%% INPUT: + +\newread\FV@InFile + +\def\FV@Input#1{% + \immediate\openin\FV@InFile #1\relax + \ifeof\FV@InFile + \FV@Error{No verbatim file #1}\FV@eha + \immediate\closein\FV@InFile + \else + \FV@CatCodes + \expandafter\FV@@Input + \fi} + +% TeX reports EOF when reading after the last newline character. +% Thus, we read to InLine, and if TeX reports EOF: +% If InLine=Empty, previous line was last line in file (file ends nl). +% Otherwise, InLine holds last line in file (file doesn't end in nl). +% \FV@@Input handles both cases correctly. + +\def\FV@@Input{% + \def\FV@Line{}% + \FV@ReadLine + \ifeof\FV@InFile + \ifx\FV@Line\@empty\else + \FV@PreProcessLine + \fi + \immediate\closein\FV@InFile + \else + \FV@PreProcessLine + \expandafter\FV@@Input + \fi} + +% We also want to handle true comment characters correctly. This means that +% we keep accumulating text in InLine until we find a ^^M (indicating that +% the line did not contain a comment character). + +\begingroup +\catcode`\^^M=\active +\gdef\FV@ReadLine{% + \ifeof\FV@InFile\else + \immediate\read\FV@InFile to\@tempa% + \expandafter\FV@@ReadLine\@tempa^^M\relax^^M\@nil% + \fi} +% #2 is empty if line ends in ^^M, #2=\relax otherwise +\gdef\FV@@ReadLine#1^^M#2^^M#3\@nil{% + \expandafter\def\expandafter\FV@Line\expandafter{% + \FV@Line#1}% + \ifx\relax#2\@empty\expandafter\FV@ReadLine\fi}% +\endgroup + +%% FORMATTING - COMMON COMPONENTS: + +% Some things that are common to all verbatim formatting: + +\def\FV@FormattingPrep{% + \global\FV@CodeLineNo\z@ + \frenchspacing % Cancels special punctuation spacing. + \FV@SetupFont % See below. + \FV@DefineWhiteSpace % See below. + \FancyVerbDefineActive + \FancyVerbFormatCom} % A user-defined hook (formatcom parameter). + +% Fonts + +\expandafter\ifx\csname selectfont\endcsname\relax + +\def\FV@SetupFont{% + \FV@BaseLineStretch + \ifx\@currsize\small\normalsize\else\small\fi\@currsize + \FV@FontSize + \FV@FontFamily +} + +\else + +\def\FV@SetupFont{% + \FV@BaseLineStretch + \FV@FontSize + \FV@FontFamily + \FV@FontSeries + \FV@FontShape +% +% SPQR Jan 29 1996; added code to turn off ligatures +% + \selectfont\let\do\do@noligs\verbatim@nolig@list}% +\fi + +\define@key{FV}{fontsize}{% + \def\@tempa{#1}% + \ifx\@tempa\FV@Auto + \let\FV@FontSize\relax + \else + \def\FV@FontSize{#1}% + \fi} +\def\KV@FV@fontsize@default{\let\FV@FontSize\relax} + +\define@key{FV}{baselinestretch}[auto]{% + \def\@tempa{#1}% + \ifx\@tempa\FV@Auto + \let\FV@BaseLineStretch\relax + \else + \def\FV@BaseLineStretch{\def\baselinestretch{#1}}% + \fi} +\def\KV@FV@baselinestretch@default{\let\FV@BaseLineStretch\relax} + +\define@key{FV}{fontfamily}{% + \@ifundefined{FV@fontfamily@#1}% + {\def\FV@FontScanPrep{}\def\FV@FontFamily{\fontfamily{#1}}} + {\csname FV@fontfamily@#1\endcsname}} + +\define@key{FV}{fontseries}{% + \def\@tempa{#1}% + \ifx\@tempa\FV@Auto + \let\FV@FontSeries\relax + \else + \def\FV@FontSeries{\fontseries{#1}}% + \fi} + +\define@key{FV}{fontshape}{% + \def\@tempa{#1}% + \ifx\@tempa\FV@Auto + \let\FV@FontShape\relax + \else + \def\FV@FontShape{\fontshape{#1}}% + \fi} + +% Font family styles have to define \FV@FontScanPrep and \FV@FontFamily. + +\def\FV@MakeActive#1{% + \catcode`#1=\active + \def\next##1{\expandafter\def\expandafter\FV@MakeUnActive\expandafter{% + \FV@MakeUnActive\def##1{\string##1}}}% + \begingroup\lccode`~=`#1\relax\expandafter\next\expandafter~\endgroup} +\def\FV@MakeUnActive{} + +\begingroup +\catcode`\`=\active +\gdef\FV@fontfamily@tt{% + \def\FV@FontScanPrep{\FV@MakeActive\`}% + \def\FV@FontFamily{\tt\edef`{{\string`}}}} + +\gdef\FV@fontfamily@cmtt{% + \def\FV@FontScanPrep{\FV@MakeActive\`}% + \def\FV@FontFamily{\edef`{{\string`}}\fontfamily{cmtt}}} +\endgroup + +\@namedef{FV@fontfamily@cmtt-spanish}{% + \def\FV@FontScanPrep{}% + \def\FV@FontFamily{\fontfamily{cmtt}}} + +%% FIX ME + +\@namedef{FV@fontfamily@courier}{% + \def\FV@FontScanPrep{}% + \def\FV@FontFamily{\fontfamily{rpcr}}} + +\@namedef{FV@fontfamily@helvetica}{% + \def\FV@FontScanPrep{}% + \def\FV@FontFamily{\fontfamily{rphv}}} + +\fvset{fontfamily=tt,fontsize=auto,fontshape=auto,fontseries=auto, + baselinestretch=auto} + +% \FV@DefineWhiteSpace +% +% We just define the active characters to be ordinary commands, which +% are easier to redefine. We do with any macros that use verbatim text. + +\begingroup +\catcode`\ =\active +\catcode`\^^I=\active +\gdef\FV@DefineWhiteSpace{\def {\FV@Space}\def^^I{\FV@Tab}}% +\endgroup + +\define@key{FV}{defineactive}[]{\def\FancyVerbDefineActive{#1\relax}} +\define@key{FV}{defineactive*}{% + \expandafter\def\expandafter\FancyVerbDefineActive\expandafter{% + \FancyVerbDefineActive#1\relax}} +\fvset{defineactive} + +% \FV@Space: + +\define@booleankey{FV}{showspaces}% + {\def\FV@Space{{\FancyVerbSpace}}}% + {\def\FV@Space{\ }} + +{\catcode`\ =12 \gdef\FancyVerbSpace{\tt }} + +\fvset{showspaces=false} + +% \FV@Tab: + +\def\FV@Tab{\hbox to\FancyVerbTabSize\fontdimen2\font{\hss\FV@TabChar}} + +\define@key{FV}{tabsize}{% + \@tempcnta=#1\relax + \ifnum\@tempcnta>100 + \FV@Error{Tab size too large: `\the\@tempcnta'. (Max size = 100)}\FV@eha + \else + \edef\FancyVerbTabSize{\the\@tempcnta}% + \fi} + +\define@booleankey{FV}{showtabs}% + {\def\FV@TabChar{\FancyVerbTab}}% + {\let\FV@TabChar\relax} + +\fvset{tabsize=8,showtabs=false} + +% Here is a weak attempt at a tab character. It may exceed the width +% of a space character when the verbatim font is small. The only proper way +% to do this is making it part of the verbatim font. + +\def\FancyVerbTab{% + \valign{% + \vfil##\vfil\cr + \hbox{$\scriptscriptstyle-$}\cr + \hbox to 0pt{\hss$\scriptscriptstyle\rangle\mskip -.8mu$}\cr + \hbox{$\scriptstyle\mskip -3mu\mid\mskip -1.4mu$}\cr}} + +% Obey Tabs: + +\newbox\FV@TabBox + +\def\FV@@ObeyTabsInit{% + \@tempdimb=\FancyVerbTabSize\fontdimen\tw@\font + \edef\FV@ObeyTabSize{\number\@tempdimb}% + \advance\@tempdimb\fontdimen\tw@\font + \advance\@tempdimb-\FancyVerbTabSize sp % Allow for rounding errors. + \edef\FV@@ObeyTabSize{\number\@tempdimb}% + \let\FV@ObeyTabs\FV@@ObeyTabs + \let\FV@Tab\FV@TrueTab} + +\def\FV@@ObeyTabs#1{\setbox\FV@TabBox=\hbox{#1}\box\FV@TabBox} +\let\FV@ObeyTabs\relax + +\def\FV@TrueTab{% + \egroup + \@tempdima=\FV@ObeyTabSize sp\relax + \@tempcnta=\wd\FV@TabBox + \advance\@tempcnta\FV@@ObeyTabSize\relax + \divide\@tempcnta\@tempdima + \multiply\@tempdima\@tempcnta + \advance\@tempdima-\wd\FV@TabBox + \setbox\FV@TabBox=\hbox\bgroup + \unhbox\FV@TabBox\kern\@tempdima\hbox to\z@{\hss\FV@TabChar}} + +\define@booleankey{FV}{obeytabs}% + {\let\FV@ObeyTabsInit\FV@@ObeyTabsInit}% + {\let\FV@ObeyTabsInit\relax} + +\fvset{obeytabs=false} + +% \FancyVerbFormatCom + +\define@key{FV}{formatcom}[]{\def\FancyVerbFormatCom{#1\relax}} +\define@key{FV}{formatcom*}{% + \expandafter\def\expandafter\FancyVerbFormatCom\expandafter{% + \FancyVerbFormatCom#1\relax}} + +\fvset{formatcom} + +\def\FancyVerbFormatLine#1{\FV@ObeyTabs{#1}} + +% LIST ENVIRONMENTS: + +% Some parameters: + +\define@key{FV}{xleftmargin}{\def\FV@XLeftMargin{#1}} +\let\FV@XLeftMargin\z@ + +\define@key{FV}{xrightmargin}{\def\FV@XRightMargin{#1}} +\let\FV@XRightMargin\z@ + +\define@booleankey{FV}{resetmargins}% + {\let\if@FV@ResetMargins\iftrue} + {\let\if@FV@ResetMargins\iffalse} + +\fvset{resetmargins=false} + +\define@key{FV}{listparameters}{\def\FV@ListParameterHook{#1}} +\def\FV@ListParameterHook{} + +\define@key{FV}{hfuzz}{% + \@tempdima=#1\relax + \edef\FancyVerbHFuzz{\number\@tempdima sp}} + +\fvset{hfuzz=2pt} + +\define@booleankey{FV}{samepage}% + {\def\FV@InterLinePenalty{\interlinepenalty\@M}}% + {\let\FV@InterLinePenalty\relax} + +\fvset{samepage=false} + +% Lists: + +% \FV@List{} is a rewriting of \list{}{}\item[]. +% The rewrite gives me more control. +% I might not get the vertical spacing exactly the same, but it +% is more likely that it will get better than worse. +% +% The verbatim environment consists of a series of \hbox's inserted in +% vertical mode. +% +% We need to take care of the following: +% +% leftmargin +% rightmargin +% topskip +% botskip +% toppenalty +% botpenalty +% interlinepenalties +% +% Note: A verbatim environment immediately after an \item starts on +% the same line as the \item's label, unless we reset margins. +% The user can instead have the environment start on a new +% line by inserting `\ ' between \item and the environment. + +\def\FV@List#1{% + \begingroup + \FV@UseKeyValues + \FV@LeaveVMode + \if@inlabel\else\setbox\@labels=\box\voidb@x\fi + \FV@ListNesting{#1}% + \FV@ListParameterHook + \FV@ListVSpace + \FV@SetLineWidth + \FV@InterLinePenalty + \let\FV@ProcessLine\FV@ListProcessLine@i + \FV@CatCodes + \FV@FormattingPrep + \FV@ObeyTabsInit + \FV@BeginListFrame} + +% Cases where we need to leave vmode: +% - After an in-line section (\if@noskipsec=T). +% - After an \item command, if we reset margins. +% Then we end \vmode, using @noparlist as a flag if in vmode. +% (Not the usual meaning of @noparlist.) + +\def\FV@LeaveVMode{% + \if@noskipsec + \leavevmode + \else + \if@FV@ResetMargins\if@inlabel\leavevmode\fi\fi + \fi + \ifvmode\@noparlisttrue\else\@noparlistfalse\unskip\par\fi} + +\def\FV@ListNesting#1{% + \if@FV@ResetMargins + \@listdepth=\z@ + \else + \ifnum\@listdepth>5\relax + \@toodeep + \else + \advance\@listdepth\@ne + \fi + \fi + \rightmargin\z@ + \csname @list\romannumeral\the\@listdepth\endcsname + \ifnum#1=\z@ + \rightmargin\z@ + \leftmargin\z@ + \fi} + +% \FV@ListVSpace contains selected parts of \@trivlist and \@item. +% Here are the cases: +% +% VMODE NOT IN LABEL OR AFTER @NOBREAK: +% = \topsep + \partopsep + \parskip +% = \topsep + \partopsep +% = \@beginparpenalty +% = \@endparpenalty + +% VMODE IN LABEL: +% = \parskip % Expected anyway. +% = \topsep + \partopsep % Omitted in LaTeX--a bug? +% = None +% = \@endparpenalty % Ditto. + +% VMODE AFTER @NOBREAK: +% = \parskip +% = \topsep + \partopsep +% = None +% = \@endparpenalty + +% HMODE: +% = \topsep + \parskip +% = \topsep +% = \@beginparpenalty +% = \@endparpenalty +% +% Notes: +% - Except when in label or after nobreak, \parskip is added with +% \addvspace, so that net space is: +% MAX{\topsep (+\partopsep) + \parskip , \lastskip } +% (The usual \@item works the same way.) +% - \parskip is added afterwards by a new paragraph, if any. +% - == \@topsepadd + +\def\FV@ListVSpace{% + \@topsepadd\topsep + \if@noparlist\advance\@topsepadd\partopsep\fi + \if@inlabel + \vskip\parskip + \else + \if@nobreak + \vskip\parskip + \clubpenalty\@M + \else + \addpenalty\@beginparpenalty + \@topsep\@topsepadd + \advance\@topsep\parskip + \addvspace\@topsep + \fi + \fi + \global\@nobreakfalse + \global\@inlabelfalse + \global\@minipagefalse + \global\@newlistfalse} + +% \leftmargin := totalleftmargin +% \rightmargin := totalrightmargin +% \@totalleftmargin := totalleftmargin of enclosing environment. + +\def\FV@SetLineWidth{% + \if@FV@ResetMargins\else + \advance\leftmargin\@totalleftmargin + \fi + \advance\leftmargin\FV@XLeftMargin\relax + \advance\rightmargin\FV@XRightMargin\relax + \linewidth\hsize + \advance\linewidth-\leftmargin + \advance\linewidth-\rightmargin + \hfuzz\FancyVerbHFuzz\relax} + +% We have to insert the right interline penalties (\interlinepenalty, +% \clubpenalty, \widowpenalty). We could process the environment +% as one long paragraph and let TeX insert the penalties, but this +% might cause problems for a very long environment. +% +% Line 1 : Insert \@labels (maybe) plus current_line +% Line 2 : Save current line +% Line 3 : penalty = interline + club ; Insert last line ; Save current line. +% Line 4 : penalty = interline ; Insert last line ; Save current line. +% +% Then at the end: +% Next line = 1 : Add null line. +% Next line = 2 : Nothing. +% Next line = 3 : penalty = interline + club + widow ; Insert last line. +% Next line = 4 : penalty = interline + widow ; Insert last line. + +\def\FV@ListProcessLine#1{% + \hbox to \hsize{% + \kern\leftmargin + \hbox to \linewidth{% + \FV@LeftListNumber + \FV@LeftListFrame + \FancyVerbFormatLine{#1}\hss + \FV@RightListFrame}% + \hss}} + +\def\FV@ListProcessLine@i#1{% + \hbox{% + \ifvoid\@labels\else + \hbox to \z@{\kern\@totalleftmargin\box\@labels\hss}% + \fi + \FV@ListProcessLine{#1}}% + \let\FV@ProcessLine\FV@ListProcessLine@ii} + +\def\FV@ListProcessLine@ii#1{% + \setbox\@tempboxa=\FV@ListProcessLine{#1}% + \let\FV@ProcessLine\FV@ListProcessLine@iii} + +\def\FV@ListProcessLine@iii#1{% + {\advance\interlinepenalty\clubpenalty\penalty\interlinepenalty}% + \box\@tempboxa + \setbox\@tempboxa=\FV@ListProcessLine{#1}% + \let\FV@ProcessLine\FV@ListProcessLine@iv} + +\def\FV@ListProcessLine@iv#1{% + \penalty\interlinepenalty + \box\@tempboxa + \setbox\@tempboxa=\FV@ListProcessLine{#1}}% + +\def\FV@EndList{% + \FV@ListProcessLastLine + \FV@EndListFrame + \@endparenv + \endgroup + \@endpetrue} + +\def\FV@ListProcessLastLine{% + \ifx\FV@ProcessLine\FV@ListProcessLine@iv + {\advance\interlinepenalty\widowpenalty\penalty\interlinepenalty}% + \box\@tempboxa + \else + \ifx\FV@ProcessLine\FV@ListProcessLine@iii + {\advance\interlinepenalty\widowpenalty + \advance\interlinepenalty\clubpenalty + \penalty\interlinepenalty}% + \box\@tempboxa + \else + \ifx\FV@ProcessLine\FV@ListProcessLine@i + \FV@Error{Empty verbatim environment}{}% + \FV@ProcessLine{}% + \fi + \fi + \fi} + +% Verbatim environment: + +\def\FV@VerbatimBegin{\FV@List\z@} +\def\FV@VerbatimEnd{\FV@EndList} + +\def\FVB@Verbatim{\FV@VerbatimBegin\FV@Scan} +\def\FVE@Verbatim{\FV@VerbatimEnd} + +\DefineVerbatimEnvironment{Verbatim}{Verbatim}{} + +% With \UseVerbatim, we have to take care of some of the things +% \end{} would do. + +\def\FV@UseVerbatim#1{% + \FV@VerbatimBegin#1\FV@VerbatimEnd + \@doendpe\global\@ignorefalse\ignorespaces} + +\def\VerbatimInput{\FV@Command{}{VerbatimInput}} +\def\FVC@VerbatimInput#1{\FV@UseVerbatim{\FV@Input{#1}}} + +% LVerbatim environment: + +\def\FV@LVerbatimBegin{\FV@List\@ne} +\def\FV@LVerbatimEnd{\FV@EndList} + +\def\FVB@LVerbatim{\FV@LVerbatimBegin\FV@Scan} +\def\FVE@LVerbatim{\FV@LVerbatimEnd} + +\DefineVerbatimEnvironment{LVerbatim}{LVerbatim}{} + +\def\FV@LUseVerbatim#1{% + \FV@LVerbatimBegin#1\FV@LVerbatimEnd + \@doendpe\global\@ignorefalse\ignorespaces} + +\def\LVerbatimInput{\FV@Command{}{LVerbatimInput}} +\def\FVC@LVerbatimInput#1{\FV@LUseVerbatim{\FV@Input{#1}}} + +% Frames: + +\def\FV@Frame@none{% + \let\FV@BeginListFrame\relax + \let\FV@LeftListFrame\relax + \let\FV@RightListFrame\relax + \let\FV@EndListFrame\relax} + +\def\FV@Frame@single{% + \let\FV@BeginListFrame\FV@BeginListFrame@Single + \let\FV@LeftListFrame\FV@LeftListFrame@Single + \let\FV@RightListFrame\FV@RightListFrame@Single + \let\FV@EndListFrame\FV@EndListFrame@Single} + +\def\FV@Frame@lines{% + \let\FV@BeginListFrame\FV@BeginListFrame@Lines + \let\FV@LeftListFrame\relax + \let\FV@RightListFrame\relax + \let\FV@EndListFrame\FV@EndListFrame@Lines} + +\def\FV@Frame@topline{% + \let\FV@BeginListFrame\FV@BeginListFrame@Lines + \let\FV@LeftListFrame\relax + \let\FV@RightListFrame\relax + \let\FV@EndListFrame\relax} + +\def\FV@Frame@bottomline{% + \let\FV@BeginListFrame\relax + \let\FV@LeftListFrame\relax + \let\FV@RightListFrame\relax + \let\FV@EndListFrame\FV@EndListFrame@Lines} + +\def\FV@BeginListFrame@Single{% + \lineskip\z@ + \baselineskip\z@ + \ifx\FancyVerbFillColor\relax + \let\FV@FrameFillLine\relax + \else + \@tempdima\FV@FrameRule\relax + \multiply\@tempdima-\tw@ + \edef\FV@FrameFillLine{% + {\noexpand\FancyVerbFillColor{\vrule\@width\number\@tempdima sp}% + \kern-\number\@tempdima sp}}% + \fi + \FV@SingleFrameLine + \penalty\@M + \FV@SingleFrameSep + \penalty\@M} + +\def\FV@SingleFrameLine{% + \hbox to\z@{% + \kern\leftmargin + \FancyVerbRuleColor{\vrule \@width\linewidth \@height\FV@FrameRule}% + \hss}} + +\def\FV@BeginListFrame@Lines{% + \begingroup + \lineskip\z@skip + \baselineskip\z@skip + \FV@SingleFrameLine + \kern\FV@FrameSep\relax + \endgroup}% + +\def\FV@EndListFrame@Lines{% + \begingroup + \baselineskip\z@skip + \kern\FV@FrameSep\relax + \FV@SingleFrameLine + \endgroup} + +\def\FV@SingleFrameSep{% + \hbox to \z@{% + \kern\leftmargin + \hbox to\linewidth{% + \FancyVerbRuleColor{% + \vrule\@width\FV@FrameRule\relax + \ifx\FancyVerbFillColor\relax + \hfil + \else + {\FancyVerbFillColor\leaders\hrule\@height\FV@FrameSep\hfil}% + \fi + \vrule\@width\FV@FrameRule\relax}}% + \hss}} + +\def\FV@LeftListFrame@Single{% + \strut + {\FancyVerbRuleColor{\vrule \@width\FV@FrameRule}}% + \FV@FrameFillLine + \kern\FV@FrameSep} + +\def\FV@RightListFrame@Single{% + \kern\FV@FrameSep + {\noexpand\leavevmode\FancyVerbRuleColor{\vrule\@width\FV@FrameRule}}} + +\def\FV@EndListFrame@Single{% + \penalty\@M + \FV@SingleFrameSep + \penalty\@M + \FV@SingleFrameLine} + +\define@key{FV}{framerule}{% + \@tempdima=#1\relax + \edef\FV@FrameRule{\number\@tempdima sp\relax}} +\def\KV@FV@framerule@default{\let\FV@FrameRule\fboxrule} + +\define@key{FV}{framesep}{% + \@tempdima=#1\relax + \edef\FV@FrameSep{\number\@tempdima sp\relax}} +\def\KV@FV@framesep@default{\let\FV@FrameSep\fboxsep} + +\fvset{framerule,framesep} + +\define@key{FV}{rulecolor}{% + \def\@tempa{#1}% + \ifx\@tempa\FV@None + \let\FancyVerbRuleColor\relax + \else + \let\FancyVerbRuleColor\@tempa + \fi} + +\define@key{FV}{fillcolor}{% + \def\@tempa{#1}% + \ifx\@tempa\FV@None + \let\FancyVerbFillColor\relax + \else + \let\FancyVerbFillColor\@tempa + \fi} + +\fvset{rulecolor=none,fillcolor=none} + +\def\FV@Frame@double{% + \let\FV@FrameBegin\FV@FrameBegin@double + \let\FV@FrameLine\FV@FrameLine@double + \let\FV@FrameEnd\FV@FrameEnd@double} + +\define@key{FV}{frame}[none]{% + \@ifundefined{FV@Frame@#1}% + {\FV@Error{Frame style `#1' not defined.}\FV@eha}% + {\@nameuse{FV@Frame@#1}}} + +\fvset{frame=none} + +% Code line numbers: + +\newcounter{FancyVerbLine} + +\define@key{FV}{firstnumber}[auto]{% + \def\@tempa{#1}\def\@tempb{auto}% + \ifx\@tempa\@tempb + \def\FV@SetLineNo{% + \c@FancyVerbLine\FV@CodeLineNo + \advance\c@FancyVerbLine\m@ne}% + \else + \def\@tempb{last}% + \ifx\@tempa\@tempb + \let\FV@SetLineNo\relax + \else + \def\FV@SetLineNo{\c@FancyVerbLine#1}% + \fi + \fi} + +\def\FV@StepLineNo{% + \FV@SetLineNo + \def\FV@StepLineNo{\refstepcounter{FancyVerbLine}}% + \FV@StepLineNo} + +\def\theFancyVerbLine{\rmfamily\tiny\arabic{FancyVerbLine}} + +\define@key{FV}{numbers}[none]{% + \@ifundefined{FV@Numbers@#1}% + {\FV@Error{Numbers style `#1' not defined.}\FV@eha}% + {\@nameuse{FV@Numbers@#1}}} + +\def\FV@Numbers@none{\let\FV@LeftListNumber\relax} +\def\FV@Numbers@left{% + \def\FV@LeftListNumber{\hbox to\z@{% + \hss\theFancyVerbLine\kern\FV@NumberSep}}} + +\define@key{FV}{numbersep}{% + \@tempdima=#1\relax + \edef\FV@NumberSep{\number\@tempdima sp\relax}} + +\fvset{numbers=none,numbersep=12pt,firstnumber=auto} + +%% BVERBATIM: + +\def\FV@BVerbatimBegin{% + \begingroup + \FV@UseKeyValues + \FV@BeginVBox + \let\FV@ProcessLine\FV@BProcessLine + \FV@FormattingPrep + \FV@ObeyTabsInit}% +\def\FV@BVerbatimEnd{\FV@EndVBox\endgroup} + +\def\FV@BeginVBox{% + \leavevmode + \hbox\ifx\FV@boxwidth\relax\else to\FV@boxwidth\fi\bgroup + \ifcase\FV@baseline\vbox\or\vtop\or$\vcenter\fi\bgroup} +\def\FV@EndVBox{\egroup\ifmmode$\fi\hfil\egroup} + +\define@key{FV}{boxwidth}{% + \def\@tempa{#1}\def\@tempb{auto}% + \ifx\@tempa\@tempb + \let\FV@boxwidth\relax + \else + \@tempdima=#1\relax + \edef\FV@boxwidth{\number\@tempdima sp}% + \fi} +\def\KV@FV@boxwidth@default{\let\FV@boxwidth\relax} + +\define@key{FV}{baseline}{% + \if t#1\@empty\let\FV@baseline\@ne\else + \if c#1\@empty\let\FV@baseline\tw@\else\let\FV@baseline\z@\fi + \fi} + +\fvset{baseline=b,boxwidth} + +\def\FV@BProcessLine#1{\hbox{\FancyVerbFormatLine{#1}}} + +\def\FVB@BVerbatim{\FV@BVerbatimBegin\FV@Scan} +\def\FVE@BVerbatim{\FV@BVerbatimEnd} + +\DefineVerbatimEnvironment{BVerbatim}{BVerbatim}{} + +\def\FV@BUseVerbatim#1{\FV@BVerbatimBegin#1\FV@BVerbatimEnd} + +\def\BVerbatimInput{\FV@Command{}{BVerbatimInput}} +\def\FVC@BVerbatimInput#1{\FV@BUseVerbatim{\FV@Input{#1}}} + +%% SAVE VERBATIM: + +\def\SaveVerbatim{\FV@Environment{}{SaveVerbatim}} + +\def\FVB@SaveVerbatim#1{% + \@bsphack + \begingroup + \FV@UseKeyValues + \def\SaveVerbatim@Name{#1}% + \gdef\FV@TheVerbatim{}% + \def\FV@ProcessLine##1{% + \expandafter\gdef\expandafter\FV@TheVerbatim\expandafter{% + \FV@TheVerbatim\FV@ProcessLine{##1}}}% + \gdef\FV@TheVerbatim{}% + \FV@Scan} +\def\FVE@SaveVerbatim{% + \expandafter\global\expandafter\let + \csname FV@SV@\SaveVerbatim@Name\endcsname\FV@TheVerbatim + \endgroup\@esphack} + +\DefineVerbatimEnvironment{SaveVerbatim}{SaveVerbatim}{} + +\def\FV@CheckIfSaved#1#2{% + \@ifundefined{FV@SV@#1}% + {\FV@Error{No verbatim text has been saved under name `#1'}\FV@eha}% + {#2{\csname FV@SV@#1\endcsname}}} + +\def\UseVerbatim{\FV@Command{}{UseVerbatim}} +\def\FVC@UseVerbatim#1{\FV@CheckIfSaved{#1}{\FV@UseVerbatim}} + +\def\LUseVerbatim{\FV@Command{}{LUseVerbatim}} +\def\FVC@LUseVerbatim#1{\FV@CheckIfSaved{#1}{\FV@LUseVerbatim}} + +\def\BUseVerbatim{\FV@Command{}{BUseVerbatim}} +\def\FVC@BUseVerbatim#1{\FV@CheckIfSaved{#1}{\FV@BUseVerbatim}} + + +% VERBATIM OUT: + +\newwrite\FV@OutFile + +\def\VerbatimOut{\FV@Environment{}{VerbatimOut}} + +\DefineVerbatimEnvironment{VerbatimOut}{VerbatimOut}{} + +\def\FV@DefineTabOut{% + \def\FV@Tab{}% + \@tempcnta=\FancyVerbTabSize\relax + \loop\ifnum\@tempcnta>\z@ + \edef\FV@Tab{\FV@Tab\space}% + \advance\@tempcnta\m@ne + \repeat} + +%% SHORT VERBATIM: + +% \SaveVerb +% +% Note "\outer\def^^M{}". This is so that verbatim commands report an +% error when encountering an end-of-line, rather than scanning to +% the end of the file each time there is a missing verbatim delimiter. +% +% If scanning fails (and thus TeX ignores \FV@GetVerb), #1 is defined +% to be empty, a group is ended, but \FancyVerbAfterSave is not invoked. + +\def\SaveVerb{\FV@Command{}{SaveVerb}} + +\begingroup +\catcode`\^^M=\active% +\gdef\FVC@SaveVerb#1#2{% + \@namedef{FV@SV@#1}{}% + \begingroup% + \FV@UseKeyValues% + \FV@CatCodes% + \outer\def^^M{\FV@EOL}% + \global\let\@tempg\FancyVerbAfterSave% + \catcode`#2=12% + \def\@tempa{\def\FancyVerbGetVerb####1####2}% + \expandafter\@tempa\string#2{\endgroup\@namedef{FV@SV@#1}{##2}\@tempg}% + \FancyVerbGetVerb\FV@EOL}% +\endgroup + +\def\FV@EOL{% + \endgroup + \FV@Error% + {Could not find the end delimiter of a short verb command}% + {You probably just forget the end delimiter of a \string\Verb\space or + \string\SaveVerb^^J% + command, or you broke the literal text across input lines.^^J% + Hit to procede.}} + +\define@key{FV}{aftersave}{\def\FancyVerbAfterSave{#1}} +\fvset{aftersave=} + +\def\FV@UseVerb#1{\mbox{\FV@UseKeyValues\FV@FormattingPrep#1}} + +\def\UseVerb{\FV@Command{}{UseVerb}} +\def\FVC@UseVerb#1{% + \@ifundefined{FV@SV@#1}% + {\FV@Error{Short verbatim text never saved to name `#1'}\FV@eha}% + {\FV@UseVerb{\@nameuse{FV@SV@#1}}}} + +\def\Verb{\FV@Command{}{Verb}} + +\begingroup +\catcode`\^^M=\active% +\gdef\FVC@Verb#1{% + \begingroup% + \FV@UseKeyValues% + \FV@FormattingPrep% + \FV@CatCodes% + \outer\def^^M{}% + \catcode`#1=12% + \def\@tempa{\def\FancyVerbGetVerb####1####2}% + \expandafter\@tempa\string#1{\mbox{##2}\endgroup}% + \FancyVerbGetVerb\FV@EOL}% +\endgroup + +\def\DefineShortVerb{\FV@Command{}{DefineShortVerb}} +\def\FVC@DefineShortVerb#1{% + \@ifundefined{FV@CC@\string#1}% + {\FVC@@DefineShortVerb#1}% + {\FV@Error{`\expandafter\@gobble\string#1' is already a short + verb character.}\FV@eha}} + +\def\FVC@@DefineShortVerb#1{% + \begingroup + \lccode`\~=`#1% + \lowercase{\gdef\@tempg{\edef~}\global\let\@temph~}% + \endgroup + \expandafter\let\csname FV@AC@\string#1\endcsname\@temph + \expandafter\edef\csname FV@CC@\string#1\endcsname{\the\catcode`#1}% + \expandafter\let\csname FV@KV@\string#1\endcsname\FV@KeyValues + \@tempg{% + \let\noexpand\FV@KeyValues\expandafter\noexpand + \csname FV@KV@\string#1\endcsname + \noexpand\FVC@Verb\expandafter\@gobble\string#1}% + \expandafter\def\expandafter\dospecials\expandafter{\dospecials\do#1}% + \expandafter\def\expandafter\@sanitize\expandafter{\@sanitize\@makeother#1}% + \catcode`#1=\active}% + +\def\UndefineShortVerb#1{% + \@ifundefined{FV@CC@\string#1}% + {\FV@Error{`\expandafter\@gobble\string#1' is not a short + verb character}\FV@eha}% + {\FV@UndefineShortVerb#1}} +\def\FV@UndefineShortVerb#1{% + \catcode`#1=\csname FV@CC@\string#1\endcsname + \begingroup + \lccode`\~=`#1% + \lowercase{\gdef\@tempg{\let~}}% + \endgroup + \expandafter\@tempg\csname FV@AC@\string#1\endcsname + \def\@tempa##1\do#1##2\@nil##3\@nil##4\@@nil{##3\def\dospecials{##1##2}\fi}% + \expandafter\@tempa\dospecials\@nil\iftrue\@nil\do#1\@nil\iffalse\@nil\@@nil + \def\@tempa##1\@makeother#1##2\@nil##3\@nil##4\@@nil{% + ##3\def\@sanitize{##1##2}\fi}% + \expandafter\@tempa\@sanitize\@nil\iftrue\@nil\do#1\@nil\iffalse\@nil\@@nil} + +% Moving verbatim. Need to worry about about using separate identifier +% for this class of verbatim, and + +\def\SaveMVerb{\FV@Command{}{SaveMVerb}} + +\begingroup +\catcode`\^^M=\active% +\gdef\FVC@SaveMVerb#1#2{% + \@ifundefined{FV@SVM@#1}{}% + {\FV@Error{Moving verbatim name `#1' already used}% + {I will overwrite the old definition. Hit to continue.}}% + \global\@namedef{FV@SVM@#1}{}% + \begingroup% + \let\FV@SavedKeyValues\FV@KeyValues% + \FV@UseKeyValues% + \FV@CatCodes% + \outer\def^^M{}% + \global\let\@tempg\FancyVerbAfterSave% + \catcode`#2=12% + \def\@tempa{\def\FancyVerbGetVerb####1####2}% + \expandafter\@tempa\string#2{% + \if@filesw + \FV@DefineWhiteSpace% + \let\FV@Space\space% + \let\FV@Tab\space% + \FV@MakeUnActive% + \let\protect\string + \immediate\write\@auxout{% + \noexpand\SaveGVerb[\FV@SavedKeyValues]{#1}\string#2##2\string#2}% + \fi + \endgroup% + \@namedef{FV@SV@#1}{##2}% + \@tempg}% + \FancyVerbGetVerb\FV@EOL}% +\endgroup + +\def\SaveGVerb{\FV@Command{}{SaveGVerb}} + +\begingroup +\catcode`\^^M=\active% +\gdef\FVC@SaveGVerb#1#2{% + \global\@namedef{FV@SVG@#1}{}% + \begingroup% + \FV@UseKeyValues% + \FV@CatCodes% + \outer\def^^M{}% + \catcode`#2=12% + \def\@tempa{\def\FancyVerbGetVerb####1####2}% + \expandafter\@tempa\string#2{\endgroup\global\@namedef{FV@SVG@#1}{##2}}% + \FancyVerbGetVerb\FV@EOL}% +\endgroup + +\def\UseMVerb{\protect\pUseMVerb} + +\def\pUseMVerb{\FV@Command{}{pUseMVerb}} + +\def\FVC@pUseMVerb#1{% + \expandafter\ifx \csname FV@SVM@#1\endcsname\relax + \expandafter\ifx \csname FV@SVG@#1\endcsname\relax + \@warning{Moving verbatim text not defined for name `#1'}\FV@eha + {\bf ??}% + \else + \FV@UseVerb{\@nameuse{FV@SVG@#1}}% + \fi + \else + \FV@UseVerb{\@nameuse{FV@SVM@#1}}% + \fi} + +\expandafter\ifx\csname documentclass\endcsname\relax + + \def\lrbox#1{% + \edef\@tempa{% + \endgroup + \setbox#1\hbox{% + \begingroup\aftergroup}% + \def\noexpand\@currenvir{\@currenvir}}% + %\def\noexpand\@currenvline{\on@line}}% + \@tempa + \@endpefalse + \bgroup + \ignorespaces} + \def\endlrbox{\unskip\egroup} + +\fi + +\@input{fancyvrb.rc} + +\endinput +\define@key{FV}{noligs}{% + \def\FV@ActiveLigs{}% + \def\FV@DefineLigs{}% + \@tfor\@tempa:=#1\do{% + {\lccode`\~=`#1\relax\lowercase{\gdef\@tempg{~}}}% + \expandafter\FV@addtonoligs\@tempg}} +\def\FV@addtonoligs#1{% + \expandafter\def\expandafter\FV@ActiveLigs\expandafter{% + \FV@ActiveLigs\catcode`#1=\active}% + \expandafter\def\expandafter\FV@DefineLigs\expandafter{% + \FV@DefineLigs\edef#1{{\string#1}}}} + +%\fvset{noligs={>,-}} +%\fvset{suppressligs=\>} +%\fvset{suppressligs=\<} + +%% END fancyvrb.sty + +Error messages to void: + +\FV@CheckBadBegin +\FV@CheckBadEnd + + + +\def\FV@Error#1#2{% + \edef\@tempc{#2}\expandafter\errhelp\expandafter{\@tempc}% + \typeout{% + ^^J** FancyVerb Error:\space\space + Type \space H \space for immediate help. **}% + \errmessage{#1^^J}} + diff --git a/usergrps/uktug/baskervi/6_2/spqr/gradient.pro b/usergrps/uktug/baskervi/6_2/spqr/gradient.pro new file mode 100644 index 0000000000..44dba7a442 --- /dev/null +++ b/usergrps/uktug/baskervi/6_2/spqr/gradient.pro @@ -0,0 +1,80 @@ +%! +% PostScript header file gradient.ps +% For the PSTricks gradient fillstyle. +% Version: 0.94 +% Date: 93/05/12 +% For copying restrictions, see pstricks.doc or pstricks.tex. +% +% Based on some EPS files by leeweyr!bill@nuchat.sccsi.com (W. R. Lee). +% +% Syntax: +% R0 G0 B0 R1 G1 B1 MidPoint NumLines Angle GradientFill + +/tx@GradientDict 40 dict def +tx@GradientDict begin +/GradientFill { + rotate + /MidPoint ED + /NumLines ED + /LastBlue ED + /LastGreen ED + /LastRed ED + /FirstBlue ED + /FirstGreen ED + /FirstRed ED + % This avoids gaps due to rounding errors: + clip + pathbbox %leave llx,lly,urx,ury on stack + /y ED /x ED + 2 copy translate + y sub neg /y ED + x sub neg /x ED + % This avoids gaps due to rounding errors: + LastRed FirstRed add 2 div + LastGreen FirstGreen add 2 div + LastBlue FirstBlue add 2 div + setrgbcolor + fill + /YSizePerLine y NumLines div def + /CurrentY 0 def + /MidLine NumLines 1 MidPoint sub mul abs cvi def + MidLine NumLines 2 sub gt + { /MidLine NumLines def } + { MidLine 2 lt { /MidLine 0 def } if } + ifelse + MidLine 0 gt + { + /Red FirstRed def + /Green FirstGreen def + /Blue FirstBlue def + /RedIncrement LastRed FirstRed sub MidLine 1 sub div def + /GreenIncrement LastGreen FirstGreen sub MidLine 1 sub div def + /BlueIncrement LastBlue FirstBlue sub MidLine 1 sub div def + MidLine { GradientLoop } repeat + } if + MidLine NumLines lt + { + /Red LastRed def + /Green LastGreen def + /Blue LastBlue def + /RedIncrement FirstRed LastRed sub NumLines MidLine sub 1 sub div def + /GreenIncrement FirstGreen LastGreen sub NumLines MidLine sub 1 sub div def + /BlueIncrement FirstBlue LastBlue sub NumLines MidLine sub 1 sub div def + NumLines MidLine sub { GradientLoop } repeat + } if +} def +/GradientLoop { + 0 CurrentY moveto + x 0 rlineto + 0 YSizePerLine rlineto + x neg 0 rlineto + closepath + Red Green Blue setrgbcolor fill + /CurrentY CurrentY YSizePerLine add def + /Blue Blue BlueIncrement add def + /Green Green GreenIncrement add def + /Red Red RedIncrement add def +} def + +end +% END gradient.ps diff --git a/usergrps/uktug/baskervi/6_2/spqr/gradient.sty b/usergrps/uktug/baskervi/6_2/spqr/gradient.sty new file mode 100644 index 0000000000..46f1cc1580 --- /dev/null +++ b/usergrps/uktug/baskervi/6_2/spqr/gradient.sty @@ -0,0 +1,4 @@ +%% BEGIN: gradient.sty +\input gradient.tex +\endinput +%% END: gradient.sty diff --git a/usergrps/uktug/baskervi/6_2/spqr/gradient.tex b/usergrps/uktug/baskervi/6_2/spqr/gradient.tex new file mode 100644 index 0000000000..cbb4561be7 --- /dev/null +++ b/usergrps/uktug/baskervi/6_2/spqr/gradient.tex @@ -0,0 +1,74 @@ +%% BEGIN gradient.tex/gradient.sty +%% +%% Defines the gradient fillstyle for PSTricks. +%% +\def\fileversion{0.93a} +\def\filedate{93/03/12} +%% +%% COPYRIGHT 1993, by Timothy Van Zandt, tvz@Princeton.EDU +%% See pstricks.tex or pstricks.doc for copying restrictions. +%% +%% See the PSTricks User's Guide for description. +%% +%% This uses the header file gradient.ps. +%% +%% Based on some EPS files by leeweyr!bill@nuchat.sccsi.com (W. R. Lee). +% +% This defines a new fill style, "gradient", for use with PSTricks, +% which has gradiated color. The following parameters are used: +% +% gradbegin=color : Beginning color. +% gradend=color : Final color. +% gradlines=int : Number of lines to use. The higher the number, +% the slower the rendering. +% gradmidpoint=num : Gradient color goes from gradbegin to gradend, +% and then back to beginning. Midpoint (point +% where "gradend" color appears, is gradmidpoint +% from the top. (0 <= Gmidpoint <= 1). +% gradangle=angle : Rotate image by angle. + +\message{ v\fileversion, \filedate} + +\csname GradientLoaded\endcsname +\let\GradientLoaded\endinput + +\ifx\PSTricksLoaded\endinput\else + \def\next{\input pstricks.tex }\expandafter\next +\fi + +\pstheader{gradient.pro} + +\newrgbcolor{gradbegin}{0 .1 .95} +\def\psset@gradbegin#1{\pst@getcolor{#1}\psgradbegin} +\psset@gradbegin{gradbegin} + +\newrgbcolor{gradend}{0 1 1} +\def\psset@gradend#1{\pst@getcolor{#1}\psgradend} +\psset@gradend{gradend} + +\def\psset@gradlines#1{% + \pst@getint{#1}\psgradlines + \ifnum\psgradlines<2 + \@pstrickserr{gradlines must be at least 2}\@epha + \def\psgradlines{2 }% + \fi} +\psset@gradlines{300} + +\def\psset@gradmidpoint#1{\pst@checknum{#1}\psgradmidpoint} +\psset@gradmidpoint{.9} + +\def\psset@gradangle#1{\pst@getangle{#1}\psk@gradangle} +\psset@gradangle{0} + +\def\psfs@gradient{% + %\pst@fill{% +\addto@pscode{gsave + gsave \pst@usecolor\psgradbegin currentrgbcolor grestore + gsave \pst@usecolor\psgradend currentrgbcolor grestore + \psgradlines + \psgradmidpoint + \psk@gradangle + tx@GradientDict begin GradientFill end grestore}} + +\endinput +%% END gradient.tex diff --git a/usergrps/uktug/baskervi/6_2/spqr/multido.sty b/usergrps/uktug/baskervi/6_2/spqr/multido.sty new file mode 100644 index 0000000000..6e5bfec8af --- /dev/null +++ b/usergrps/uktug/baskervi/6_2/spqr/multido.sty @@ -0,0 +1,4 @@ +%% BEGIN multido.sty +\input multido.tex +\endinput +%% END multido.sty diff --git a/usergrps/uktug/baskervi/6_2/spqr/multido.tex b/usergrps/uktug/baskervi/6_2/spqr/multido.tex new file mode 100644 index 0000000000..22d0469c1d --- /dev/null +++ b/usergrps/uktug/baskervi/6_2/spqr/multido.tex @@ -0,0 +1,279 @@ +%% BEGIN multido.tex/multido.sty +%% +\def\fileversion{1.4} +\def\filedate{93/01/14} +%% +%% COPYRIGHT 1993, by Timothy Van Zandt, tvz@Princeton.EDU +%% +%% DESCRIPTION: +%% multido.tex/multido.sty contains a loop macro, \multido, that supports +%% fixed-point addition and has a nice interface. Among other things, it +%% is useful for pictures and putting numbers on axes. multido.tex +%% is compatible with most TeX macro packages, including Plain TeX, LaTeX, +%% AmSTeX, and Ams-LaTeX. +%% +%% INSTALLATION: +%% Put this file where your TeX looks for inputs, under the name multido.tex. +%% Name a copy multido.sty to use as a LaTeX style option, or create a file +%% multido.sty with the lines: +%% \input multido.tex +%% \endinput +%% +%% DOCUMENTATION: +%% See multido.doc, which might be appended to this file. +%% +%% COPYING: +%% Copying of part or all of this file is allowed under the following +%% conditions only: +%% (1) You may freely distribute unchanged copies of the file. Please +%% include the documentation when you do so. +%% (2) You may modify a renamed copy of the file, but only for personal +%% use or use within an organization. +%% (3) You may copy fragments from the file, for personal use or 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 +%% this file or modified versions or fragments thereof, except for +%% a nominal charge for copying etc. +%% +%% CODE: +% These macros use TeX primitives, plus the Plain TeX commands: +% \dimen@, \dimen@i, \count@, \newcount, \newtoks, \@ne, \tw@, \@z@. +% +% Check if file is loaded, announce file on terminal, and take care of @: +% + + +\message{ v\fileversion, \filedate\space } + +\csname MultidoLoaded\endcsname +\let\MultidoLoaded\endinput + +\edef\TheAtCode{\the\catcode`\@} +\catcode`\@=11 + +% These are some useful hacks. "\multido@dimtonum" strips the value of "#1", a dimension register, of the "pt", and assigns the result to "#2", a command sequence. + +\def\@empty{} +\def\@nnil{\@nil} +\def\multido@dimtonum#1#2{\edef#2{\multido@@dimtonum#1}} +\def\multido@@dimtonum#1{\expandafter\multido@@@dimtonum\the#1} +\edef\next{% + \noexpand\def\noexpand\multido@@@dimtonum##1\string p\string t{##1}} +\next + +% "\multido@count" stores the number of repetitions. "\multidocount" keeps track of the iteration. These are also used locally as scratch counters by "\FPadd@". "\multido@stuff" is used to store the that is to be repeated. + +\newcount\multido@count +\newcount\multidocount +\newtoks\multido@stuff + +\def\multido{\multido@{}{\begingroup}{\endgroup}} +\def\mmultido{\multido@{\multido@stepvar}{\begingroup}{\endgroup}} +\def\Multido{\multido@{}{}{}} +\def\MMultido{\multido@{\multido@stepvar}{}{}} + +% "\multido@initvar" processes the variable declarations, initializing the value of the variables and defining "\multido@stepvar" to increment the variables with each repetition. "\multido@count" is set to the number of repetitions. + +\long\def\multido@#1#2#3#4#5#6{% + #2% + \multido@count=#5\relax + \ifnum\multido@count=\z@\else\multido@@{#1}{#4}{#6}\fi + #3% + \ignorespaces} +\def\multido@@#1#2#3{% + \def\multido@stepvar{}% + \def\do{\noexpand\do\noexpand}% + \multido@initvar#2,\@nil,% + \let\do\noexpand + \edef\multido@stepvar{\multido@stepvar}% + \ifnum\multido@count<\z@\multido@count=-\multido@count\fi + \multidocount=1\relax + #1% + \multido@stuff{#3}% + \multido@loop} +\def\multido@loop{% + \the\multido@stuff + \ifnum\multidocount<\multido@count + \advance\multidocount\@ne + \multido@stepvar + \expandafter\multido@loop + \fi} +\def\multidostop{\multidocount=\multido@count} +\def\multido@badvar{% + \multido@count=0 + \errhelp{\multido command will be skipped.}% + \errmessage{Bad \string\multido\space variable declaration}} +\def\multido@initvar#1,{% + \def\multido@temp{#1}% + \ifx\multido@temp\@nnil\else + \ifx\multido@temp\@empty\else + \multido@@initvar#1\@nil=+\@nil\relax + \fi + \expandafter\multido@initvar + \fi} +\def\multido@@initvar#1=#2+#3\@nil#4\relax{% + \ifx\@empty#4\@empty + \multido@badvar + \else + \multido@vartype#1\@empty + \ifx\multido@temp\relax + \multido@badvar + \else + \multido@temp{#2}{#3}#1% + \fi + \fi} +\def\multido@vartype#1{% + \ifcat\noexpand\@nil\noexpand#1% + \expandafter\multido@@vartype\string#1\@nil + \else + \let\multido@temp\relax + \fi} +\def\multido@@vartype#1#2#3\@nil{% + \expandafter\let\expandafter\multido@temp + \csname multido@init@#2\endcsname} +\def\MultidoCheckNames{% + \let\multido@@@vartype\multido@vartype + \def\multido@vartype##1{% + \ifx\undefined##1% + \multido@@@vartype{##1}% + \else + \errhelp{\multido command will be skipped.}% + \errmessage{Multido variable \string##1 already defined}% + \let\multido@temp\relax + \fi}} + +% For each variable type, we must now define \multido@init. The syntax of these macros is: +% +% \multido@init@{initial value}{increment}{variable} +% +% and the outcome should be: +% +% 1. Set to the initial value. +% 2. Invoke \multido@addtostep{step stuff}, where is whatever should be done to increment the variable. is expanded first, with expansion suppressed by "\do". + +\def\multido@addtostep#1{\edef\multido@stepvar{\multido@stepvar#1}} + +% Variable type for dimensions ("d", "D"): + +\def\multido@init@d#1#2#3{% + \expandafter\ifx\csname pssetlength\endcsname\relax + \dimen@=#1\relax\dimen@i=#2\relax + \else + \pssetlength\dimen@{#1}\pssetlength\dimen@i{#2}% + \fi + \edef#3{\number\dimen@ sp}% + \ifnum\multido@count<\z@\dimen@i=-\dimen@i\fi + \multido@addtostep{\do\multido@step@d{\do#3}{\number\dimen@i sp}}} +\def\multido@step@d#1#2{% + \dimen@=#1\advance\dimen@#2 + \edef#1{\number\dimen@ sp}}% +\def\multido@init@D{\multido@init@d} + +% Variable type for integers ("i", "I"): + +\def\multido@init@i#1#2#3{% + \count@=#1\relax + \edef#3{\the\count@}% + \count@=#2\relax + \ifnum\multido@count<\z@\count@=-\count@\fi + \multido@addtostep{\do\multido@step@i{\do#3}{\the\count@}}} +\def\multido@step@i#1#2{% + \count@=#1\advance\count@ by #2 + \edef#1{\the\count@}} +\def\multido@init@I{\multido@init@i} + +% Variable type for reals ("r", "R"). + +\def\multido@init@r#1#2#3{% + \dimen@=#1pt + \multido@dimtonum\dimen@#3% + \dimen@=#2pt + \ifnum\multido@count<\z@\dimen@=-\dimen@\fi + \multido@addtostep{\do\multido@step@r{\do#3}{\number\dimen@ sp}}} +\def\multido@step@r#1#2{% + \dimen@=#1pt\advance\dimen@#2 + \multido@dimtonum\dimen@#1} +\def\multido@init@R{\multido@init@r} + +% Variable type for numbers ("n", "N"). + +\def\multido@init@n#1#2#3{% + \edef#3{#1}% + \ifnum\multido@count<\z@\expandafter\FPsub\else\expandafter\FPadd\fi + {0}{#2}\multido@temp + \multido@addtostep{\do\FPadd{\do#3}{\multido@temp}{\do#3}}} +\def\multido@init@N{\multido@init@n} + +% Simple fixed-point addition couldn't be harder. "\dimen@" and "\dimen@i" are used as scratch {\em counters} (to avoid creating a new counter). "\count@", "\multido@count" and "\multidocount" are also used as scratch counters. + +% This is probably pretty close to optimal, given the requirements that leading and trailing spaces be OK in the arguments, and that there need not be any numbers to the left of the decimal. + +\def\FPadd#1#2#3{% + \edef\multido@temp{#1..\noexpand\@nil#2}% + \expandafter\FPadd@\multido@temp..\@nil + \let#3\multido@temp} +\def\FPsub#1#2{% + \edef\multido@temp{\noexpand\FPsub@#2\noexpand\@empty}% + \FPadd{#1}{\multido@temp}} +\def\FPsub@#1{\ifx-#1\else-#1\fi} +\def\FPadd@#1.#2.#3\@nil#4.#5.#6\@nil{% + \begingroup + \def\multido@temp{\let\next\relax}% + \let\next\z@ + \afterassignment\multido@temp\count@=#1\next + \dimen@i=0#2sp\relax + \let\next\z@ + \afterassignment\multido@temp\multido@count=#4\next + \multidocount=0#5\relax + \dimen@=\number\count@ sp + \count@=\@ne + \FPadd@@@#500000000\@nil + \ifnum#11<\z@ + \count@=-\tw@ + \dimen@=-\dimen@ + \fi + \ifnum#41<\z@ + \count@=-\count@ + \multido@count=-\multido@count + \fi + \ifnum\count@>\z@ + \advance\multido@count\dimen@ + \advance\multidocount\dimen@i + \ifnum\multidocount<\multido@temp\relax + \advance\multidocount\multido@temp\relax + \else + \advance\multido@count\@ne + \fi + \advance\count@-3 + \else + \advance\multido@count-\dimen@ + \advance\multidocount-\dimen@i + \ifnum\multido@count<\z@ + \multido@count=-\multido@count + \multidocount=-\multidocount + \advance\count@\@ne + \else + \ifnum\multido@count=\z@ + \ifnum\multidocount<\z@ + \multidocount=-\multidocount + \advance\count@\@ne + \fi + \fi + \fi + \ifnum\multidocount<\z@ + \advance\multidocount\multido@temp + \advance\multido@count-\@ne + \fi + \advance\multidocount\multido@temp\relax + \fi + \expandafter\FPadd@@\the\multidocount\@empty\@nil + \endgroup} +\def\FPadd@@#1#2#3\@nil{\xdef\multido@temp{% + \ifnum\count@=-1-\fi + \the\multido@count\ifx#2\@empty\else.#2#3\fi}} +\def\FPadd@@@#1#2#3#4#5#6#7#8#9\@nil{\def\multido@temp{1#9}} + +\catcode`\@=\TheAtCode\relax +\endinput +%% END multido.tex/multido.sty diff --git a/usergrps/uktug/baskervi/6_2/spqr/palette.sty b/usergrps/uktug/baskervi/6_2/spqr/palette.sty new file mode 100644 index 0000000000..352b31e734 --- /dev/null +++ b/usergrps/uktug/baskervi/6_2/spqr/palette.sty @@ -0,0 +1,4 @@ +%% BEGIN palette.sty +\input palette.tex +\endinput +%% END palette.sty diff --git a/usergrps/uktug/baskervi/6_2/spqr/palette.tex b/usergrps/uktug/baskervi/6_2/spqr/palette.tex new file mode 100644 index 0000000000..6c96c02f03 --- /dev/null +++ b/usergrps/uktug/baskervi/6_2/spqr/palette.tex @@ -0,0 +1,253 @@ +\def\filename{palette.tex} +\def\fileversion{0.91} +\def\filedate{92/09/02} +% +% Send comments to the author: Fred Knight (knight@ll.mit.edu) +% +% Purpose: +% Macros to get colors from a palette. +% For use with PSTricks version v0.91 and later. +% These macros allow the user to select colors from a palette derived +% from the Openwindows file rgbcolors.txt, which contains about 140 +% distinct colors, not including different shades and gray levels. +% The user can also display the palette and add to it. +% Usage: +% \palette +% the list of colors and values, only an internal list of colors +% \addtopalette[type]{name}{values} +% add a color to \palette +% type---an integer denoting the type of values +% 1 = rgb, default, 3 numbers between 0 (low) and 1 (high) +% 2 = hsb, 3 numbers between 0 (low) and 1 (high) +% 3 = cmyk, 4 numbers between 0 (low) and 1 (high) +% 4 = gray, 1 number between 0 (low) and 1 (high) +% name---the color's name as stored in \palette, +% usually all lowercase +% values---numbers according to the type of color +% Examples: +% \addtopalette{mud}{0.6 0.4 0.2} +% \addtopalette[4]{mudgray}{0.4} +% \addrgb{name}{values} +% add an rgb color called name to the palette +% \addhsb{name}{values} +% add an hsb color called name to the palette +% \addcmyk{name}{values} +% add an cmyk color called name to the palette +% \addgray{name}{values} +% add an gray color called name to the palette +% \getcolor[altname]{name} +% analogous to \newrgbcolor but get values from +% \palette and define a macro \name or \altname, if present. +% Examples: +% \getcolor{thistle} {\thistle The color is slightly off purple.} +% \getcolor[goo]{brown} {\goo Its fragrance graced the table.} +% \showpalette +% macro to show all the colors in \palette +% Restrictions: +% Works only with PostScript and requires PSTricks. +% Acknowledgement: +% Thanks to Tim Van Zandt for many helpful comments. +% +% +% =====>> Preliminaries: Is PSTricks loaded? Change catcode of @. +% +\ifx\pstricksloaded\relax\else\input pstricks\fi +\typeout{`\filename' v\fileversion\space\space <\filedate> (Fred Knight)} +\edef\theatcode{\the\catcode`\@} +\ifnum\theatcode=13\let\theat @\fi +\catcode`\@=11\relax +% +% =====>> User macros for adding colors to \palette: 4 types +% +\def\addtopalette{\@ifnextchar [{\@addtopalette}{\@addtopalette[1]}} +\def\@addtopalette[#1]#2#3{\edef\palette{\palette(#2,#1,#3)}} +\def\addrgb{\addtopalette[1]} +\def\addhsb{\addtopalette[2]} +\def\addcmyk{\addtopalette[3]} +\def\addgray{\addtopalette[4]} +% +% =====>> User macro to define a new color name. +% +\def\getcolor{\@ifnextchar [{\@getcolor}{\@getcolor[\@nil]}} +\def\@getcolor[#1]#2{% + \ifx#1\@nil\def\altname{#2}\else\def\altname{#1}\fi + \def\pst@tempg##1(#2,##2,##3)##4\@nil{% + \ifcase##2\@pstrickserr{Color `#2' not found}\@eha + \or\newrgbcolor{\altname}{##3}% + \or\newhsbcolor{\altname}{##3}% + \or\newcmykcolor{\altname}{##3}% + \or\newgray{\altname}{##3}% + \fi}% + \expandafter\pst@tempg\palette(#2,0,)\@nil} +% +% =====>> \showpalette and its parts. +% +% Define 4 dimensions for \showpalette +\newdimen\PalBoxwd\PalBoxwd=\hsize +\newdimen\PalBoxht\PalBoxht=\baselineskip +\newdimen\savedparindent +\newdimen\savedparskip +% Each color gets a rule with text of two colors (black & white) in it. +\def\paletteBox{\vrule height\PalBoxht width\PalBoxwd depth1ex} +% Each color has 2 entries: one with black text, the other with white. +\def\paletteEntry#1#2#3{% + \hbox to 0.5\hsize{ #1\hss + \ifcase#2\or rgb\or hsb\or cmyk\or gray\fi:#3 }} +\def\showpalette{\edef\pst@tempa{\palette(NoMoreColors,0, 0)}% + \savedparskip=\parskip\parskip0pt + \savedparindent=\parindent\parindent0pt\par + \expandafter\thepalette\pst@tempa + \parindent=\savedparindent + \parskip=\savedparskip} +% \thepalette loops through the entries of \palette. +\def\thepalette(#1,#2,#3){% + \ifnum#2=0 + \let\next\relax + \else + \leavevmode + \hbox{% + \pstVerb{#3 \ifcase#2\or setrgbcolor\or sethsbcolor\or + setcmykcolor\or setgray\fi}% + \paletteBox\hskip-\hsize + \pstVerb{0 setgray}\paletteEntry{#1}{#2}{#3}% black text + \pstVerb{1 setgray}\paletteEntry{#1}{#2}{#3}}% white text + \let\next\thepalette + \par\vskip1pt + \fi\next} +% +% =====>> The palette of colors; derived from OPENWINDOWS/rgbcolors.txt. +% +\def\palette{% +% format: (name,type, values) +% where +% name = name of the color +% type = 1 for rgb, 2 for hsb, 3 for cmyk, 4 for gray +% values = color values in the type specified + (snow,1,1.00 0.98 0.98)% The color snow has r=1.00, b=0.98, and g=0.98. + (ghostwhite,1,0.97 0.97 1.00)% + (whitesmoke,1,0.96 0.96 0.96)% + (gainsboro,1,0.86 0.86 0.86)% + (floralwhite,1,1.00 0.98 0.94)% + (oldlace,1,0.99 0.96 0.90)% + (linen,1,0.98 0.94 0.90)% + (antiquewhite,1,0.98 0.92 0.84)% + (papayawhip,1,1.00 0.94 0.84)% + (blanchedalmond,1,1.00 0.92 0.80)% + (bisque,1,1.00 0.89 0.77)% + (peachpuff,1,1.00 0.85 0.73)% + (navajowhite,1,1.00 0.87 0.68)% + (moccasin,1,1.00 0.89 0.71)% + (cornsilk,1,1.00 0.97 0.86)% + (ivory,1,1.00 1.00 0.94)% + (lemonchiffon,1,1.00 0.98 0.80)% + (seashell,1,1.00 0.96 0.93)% + (honeydew,1,0.94 1.00 0.94)% + (mintcream,1,0.96 1.00 0.98)% + (azure,1,0.94 1.00 1.00)% + (aliceblue,1,0.94 0.97 1.00)% + (lavender,1,0.90 0.90 0.98)% + (lavenderblush,1,1.00 0.94 0.96)% + (mistyrose,1,1.00 0.89 0.88)% + (white,1,1.00 1.00 1.00)% + (black,1,0.00 0.00 0.00)% + (midnightblue,1,0.10 0.10 0.44)% + (navy,1,0.00 0.00 0.50)% + (navyblue,1,0.00 0.00 0.50)% + (cornflowerblue,1,0.39 0.58 0.93)% + (darkslateblue,1,0.28 0.24 0.55)% + (slateblue,1,0.42 0.35 0.80)% + (mediumslateblue,1,0.48 0.41 0.93)% + (lightslateblue,1,0.52 0.44 1.00)% + (mediumblue,1,0.00 0.00 0.80)% + (royalblue,1,0.25 0.41 0.88)% + (blue,1,0.00 0.00 1.00)% + (dodgerblue,1,0.12 0.56 1.00)% + (deepskyblue,1,0.00 0.75 1.00)% + (skyblue,1,0.53 0.81 0.92)% + (lightskyblue,1,0.53 0.81 0.98)% + (steelblue,1,0.27 0.51 0.71)% + (lightsteelblue,1,0.69 0.77 0.87)% + (lightblue,1,0.68 0.85 0.90)% + (powderblue,1,0.69 0.88 0.90)% + (paleturquoise,1,0.69 0.93 0.93)% + (darkturquoise,1,0.00 0.81 0.82)% + (mediumturquoise,1,0.28 0.82 0.80)% + (turquoise,1,0.25 0.88 0.82)% + (cyan,1,0.00 1.00 1.00)% + (lightcyan,1,0.88 1.00 1.00)% + (cadetblue,1,0.37 0.62 0.63)% + (mediumaquamarine,1,0.40 0.80 0.67)% + (aquamarine,1,0.50 1.00 0.83)% + (darkgreen,1,0.00 0.39 0.00)% + (darkolivegreen,1,0.33 0.42 0.18)% + (darkseagreen,1,0.56 0.74 0.56)% + (seagreen,1,0.18 0.55 0.34)% + (mediumseagreen,1,0.24 0.70 0.44)% + (lightseagreen,1,0.13 0.70 0.67)% + (palegreen,1,0.60 0.98 0.60)% + (springgreen,1,0.00 1.00 0.50)% + (lawngreen,1,0.49 0.99 0.00)% + (green,1,0.00 1.00 0.00)% + (chartreuse,1,0.50 1.00 0.00)% + (mediumspringgreen,1,0.00 0.98 0.60)% + (greenyellow,1,0.68 1.00 0.18)% + (limegreen,1,0.20 0.80 0.20)% + (yellowgreen,1,0.60 0.80 0.20)% + (forestgreen,1,0.13 0.55 0.13)% + (olivedrab,1,0.42 0.56 0.14)% + (darkkhaki,1,0.74 0.72 0.42)% + (khaki,1,0.94 0.90 0.55)% + (palegoldenrod,1,0.93 0.91 0.67)% + (lightgoldenrodyellow,1,0.98 0.98 0.82)% + (lightyellow,1,1.00 1.00 0.88)% + (yellow,1,1.00 1.00 0.00)% + (gold,1,1.00 0.84 0.00)% + (lightgoldenrod,1,0.93 0.87 0.51)% + (goldenrod,1,0.85 0.65 0.13)% + (darkgoldenrod,1,0.72 0.53 0.04)% + (rosybrown,1,0.74 0.56 0.56)% + (indianred,1,0.80 0.36 0.36)% + (saddlebrown,1,0.55 0.27 0.07)% + (sienna,1,0.63 0.32 0.18)% + (peru,1,0.80 0.52 0.25)% + (burlywood,1,0.87 0.72 0.53)% + (beige,1,0.96 0.96 0.86)% + (wheat,1,0.96 0.87 0.70)% + (sandybrown,1,0.96 0.64 0.38)% + (tan,1,0.82 0.71 0.55)% + (chocolate,1,0.82 0.41 0.12)% + (firebrick,1,0.70 0.13 0.13)% + (brown,1,0.65 0.16 0.16)% + (darksalmon,1,0.91 0.59 0.48)% + (salmon,1,0.98 0.50 0.45)% + (lightsalmon,1,1.00 0.63 0.48)% + (orange,1,1.00 0.65 0.00)% + (darkorange,1,1.00 0.55 0.00)% + (coral,1,1.00 0.50 0.31)% + (lightcoral,1,0.94 0.50 0.50)% + (tomato,1,1.00 0.39 0.28)% + (orangered,1,1.00 0.27 0.00)% + (red,1,1.00 0.00 0.00)% + (hotpink,1,1.00 0.41 0.71)% + (deeppink,1,1.00 0.08 0.58)% + (pink,1,1.00 0.75 0.80)% + (lightpink,1,1.00 0.71 0.76)% + (palevioletred,1,0.86 0.44 0.58)% + (maroon,1,0.69 0.19 0.38)% + (mediumvioletred,1,0.78 0.08 0.52)% + (violetred,1,0.82 0.13 0.56)% + (magenta,1,1.00 0.00 1.00)% + (violet,1,0.93 0.51 0.93)% + (plum,1,0.87 0.63 0.87)% + (orchid,1,0.85 0.44 0.84)% + (mediumorchid,1,0.73 0.33 0.83)% + (darkorchid,1,0.60 0.20 0.80)% + (darkviolet,1,0.58 0.00 0.83)% + (blueviolet,1,0.54 0.17 0.89)% + (purple,1,0.63 0.13 0.94)% + (mediumpurple,1,0.58 0.44 0.86)% + (thistle,1,0.85 0.75 0.85)% +} +\expandafter\catcode`\@=\theatcode\relax +\ifnum\theatcode=13\let @\theat\fi +\endinput diff --git a/usergrps/uktug/baskervi/6_2/spqr/pie-data.sh b/usergrps/uktug/baskervi/6_2/spqr/pie-data.sh new file mode 100644 index 0000000000..3e535c22f1 --- /dev/null +++ b/usergrps/uktug/baskervi/6_2/spqr/pie-data.sh @@ -0,0 +1,190 @@ +#! /bin/sh + +# -*- Mode: Ksh -*- +# piecharts-data.sh --- Automatic generation of data file for piecharts.sh +# Author : Denis GIROU (CNRS/CIRCE - France) +# Created the : Fri Dec 11 19:44:47 1992 +# Last mod. by : Denis GIROU (CNRS/CIRCE - France) +# Last mod. the : Tue Jan 26 22:06:10 1993 +# Version : 1.1 +# +# Description : piecharts-data.sh is a simple SHELL and AWK program to +# generate data files expected by the associated +# piecharts.sh script, to realize hight quality, greatly, +# customizable grayscaled or colored pie charts in (La)TeX + +# PostScript, with the PSTricks package of Timothy Van Zandt +# . +# The labels are written to be the outside labels of +# the parts of the pie chart (with the numbers itself +# below) and the percentages will be the inside labels +# of the parts (see the description of piecharts.sh). +# The parts will have gray colors, equally calculated +# between black and white in function of the number +# of the parts. +# The variable LABEL_OTHERS contains the label used +# to describe the part for the sum of the rest of the +# value ("Others" by default). +# +# Syntax : piecharts-data.sh title nb_parts [PLAIN] output_file +# If the title has several words, they must be enclose +# by the " symbol. +# nb_parts is the number of the parts requested for the +# pie chart. If they are more than nb_parts lines of data +# (generally the case), the last part is the sum of all +# the last parts. It must be less than 27. +# By default, some LaTeX commands (\small, \\) are +# inserted. If you want to generate plain TeX code, +# use the TEX option. +# You also can directly generate the pie chart, if you +# pipe the result with the piecharts.sh script (see the +# examples section): +# +# Input file format: Each line must contains two fields: a label and a +# quantity. The quantities can be in non increase order. +# Here is an example (suppress the first 2 characters +# of each line): +# LUU 3094 +# SOL 1438 +# LMD 365 +# LEG 267 +# PPM 248 +# MEF 236 +# ASF 122 +# DRT 57 +# AMB 33 +# TPR 18 +# RRS 9 +# +# Examples : If you name these file vpusers.dat, you can simply type: +# piecharts-data.sh "My title" 5 vp.tmp +# or directly: +# piecharts-data.sh "My title" 5 pie.tmp +# If you want to generate plain TeX code: +# piecharts-data.sh "My title" 5 plain pie.tmp +# +# Portability : Expected great. Tested on RS6000 under AIX 3.2 and +# DECStation 3100 under Ultrix 4.3 +# +# Known problems : None for the moment! +# +# History : (12/23/92) - rev. 1.0 +# (01/26/93) - rev. 1.1: +# * suppression of lines longer than 78 characters +# * add the PLAIN option to generate plain TeX code + + +LABEL_OTHERS="Others" # For english people +# LABEL_OTHERS="Autres" # For french people + +# Verification of the parameters +if [ $# -lt 2 ] + then echo "You must give 2 or 3 parameters." + echo "Syntax: piecharts-data.sh title number_of_parts [PLAIN] \ +out_file" + exit +fi +if [ $2 -lt 2 ] + then echo "The number_of_parts must be greater than 2." + exit +fi +if [ $2 -gt 26 ] + then echo "The number_of_parts must be less than 27." + exit +fi +if [ $# -eq 3 ] && [ $3 != "PLAIN" ] && [ $3 != "plain" ] + then echo "Syntax: piecharts-data.sh title number_of_parts [PLAIN] \ +out_file" + exit +fi + +# As some AWK versions doesn't accept the definition of external variables, +# we create a temporary file with a first line containing the parameters, +# and we copied the data after this line + +# The temporary files +FILENAME1=/tmp/file1-pie.tmp +FILENAME2=/tmp/file2-pie.tmp +if [ -f $FILENAME1 ] + then rm $FILENAME1 +fi +if [ -f $FILENAME2 ] + then rm $FILENAME2 +fi + +# The first line is : the title, the number of parts, the label for the others +# parts ("Others" by default) and the total of the quantities (the second +# fields of the data file) + +(echo $1 "|" $2 "|" $LABEL_OTHERS "|" `tee $FILENAME1 | awk '{TOT += $2} \ + END{print TOT}'` ; cat $FILENAME1) >$FILENAME2 + +# Beginning of the AWK program +awk ' +BEGIN{FS="|" + ALPHABET="ABCDEFGHIJKLMNOPQRSTUVWXYZ" + PARAM="NO" + } + +{ + if (PARAM == "NO") { + # Parameters: title, nb_parts, label for "others parts and total of + # the quantities + PARAM="YES" + TITLE=$1 + NB_PARTS=$2 + LABEL_OTHERS=$3 + TOTAL=$4 + # Generation of the gray colors that the pie chart will use + # (equally calculated between the first black and the last white) + for (I=1 ; I<=NB_PARTS ; I++) + print "## \\newgray{mygray" substr(ALPHABET,I,1) "}{" \ + 1 / (NB_PARTS-1) * (I-1) "}" + printf("\n%s\n\n",TITLE) + } + else {FS=" " + NB_DATA++ + if (NB_DATA < NB_PARTS) + {PERCENTAGE = $2 / TOTAL * 100 + printf("%s%s%3.1f%s%s%s%s%s%s\n",PERCENTAGE, \ + " | {\\small ",PERCENTAGE,"\\%} | ",$1,"\\\\{\\small ", \ + $2, "} | solid | mygray",substr(ALPHABET,NB_DATA,1)) + } + else + TOTAL_REST += $2 + LAST_LABEL = $1 + } +} + +# We must take care of the last part (the total for the last data lines if +# nb_parts is less than the number of lines, the part for the last line only +# otherwise) +END{PERCENTAGE = TOTAL_REST / TOTAL * 100 + if (NB_DATA == NB_PARTS) + printf("%s%s%3.1f%s%s%s%s%s%s\n",PERCENTAGE, \ + " | {\\small ",PERCENTAGE,"\\%} | ",LAST_LABEL, \ + "\\\\{\\small ",TOTAL_REST,"} | solid | mygray", \ + substr(ALPHABET,NB_DATA,1)) + else if (NB_DATA > NB_PARTS) + printf("%s%s%3.1f%s%s%s%s%s%s\n",PERCENTAGE, \ + " | {\\small ",PERCENTAGE,"\\%} |",LABEL_OTHERS, \ + "\\\\{\\small ",TOTAL_REST,"} | solid | mygray", \ + substr(ALPHABET,NB_PARTS,1)) + }' <$FILENAME2 >$FILENAME1 + + +# Check plain TeX mode +if [ $# -eq 3 ] + then sed -e /\\\\\\\\/s//\\\\cr\ /g -e /\\\\small\ /s///g $FILENAME1 + else cat $FILENAME1 +fi + +# Clean up the temporary files +if [ -f $FILENAME1 ] + then rm $FILENAME1 +fi +if [ -f $FILENAME2 ] + then rm $FILENAME2 +fi diff --git a/usergrps/uktug/baskervi/6_2/spqr/piechart.sh b/usergrps/uktug/baskervi/6_2/spqr/piechart.sh new file mode 100644 index 0000000000..626305fa19 --- /dev/null +++ b/usergrps/uktug/baskervi/6_2/spqr/piechart.sh @@ -0,0 +1,364 @@ +#! /bin/sh + +# -*- Mode: Ksh -*- +# piecharts.sh --- Creation of pie charts in (La)TeX + PostScript, +# with PSTricks +# Author : Denis GIROU (CNRS/CIRCE - France) +# Created the : Fri Oct 16 21:53:41 1992 +# Last mod. by : Denis GIROU (CNRS/CIRCE - France) +# Last mod. the : Tue Jan 26 21:15:55 1993 +# Version : 2.2 +# +# Description : piecharts.sh is a simple SHELL and AWK program to +# realize hight quality, greatly customizable, grayscaled +# or colored pie charts in PostScript. +# It uses (La)TeX and the splendid PSTricks package of +# Timothy Van Zandt , available in +# /anonymous@princeton.edu:/pub +# It creates the (La)TeX (+ PSTricks) code for direct +# insertion in a (La)TeX document of the pie chart generated. +# It use a data file which describe the parts and the labels +# for them. +# You always can modify the generated code for more +# personal and sophisticated result. +# +# Syntax : piecharts.sh [scale_factor] ([PLAIN] | [FIGURE] [BOXIT]) \ +# output_file +# Default scale factor is 1. +# Default mode is LaTeX. In this case, use the FIGURE +# option if you want to define the figure LaTeX environment +# for the pie chart, and use the BOXIT option if you want +# a box around this figure. +# Use the PLAIN option if you want to generate a plain TeX +# code (in this case, you cannot used the FIGURE and BOXIT +# options). +# +# Input file : The fill styles are: none, solid, vlines, vlines*, +# hlines, hlines*, crosshatch, crosshatch* +# The predefined colors are : black, darkgray, gray, +# lightgray, white, red, green, blue, cyan, magenta, yellow +# You can easily define new gray or colors, or access to a +# rgb palette with the palette.sty file of PSTricks. +# You can also change a lot of parameters. See the +# documentation of PSTricks for more customization. +# +# Input file format: You can add blanks lines and comments (beginning by #). +# The default field separator is | You can change it at +# the AWK level. +# The first non-comment line has 3 fields for titles +# (only the first is required), and after you must have one +# line by part of the pie chart, with 5 or 6 fields each +# (percentage, inside label, outside label, filling, color, +# explode). The last one is optional and must be "yes" if +# you want that this part will be explode in the pie chart. +# Obviously, the total of the percentages must be 100, or +# less. +# You can add (La)TeX commands in the labels (\em, \small, +# etc.), and separate lines by \\ in LaTeX and \cr in TeX. +# The text attributes cannot act on multiple lines : you +# must type {\em Paris}\\{\em France} for example in LaTeX. +# Be careful of some (La)TeX special characters (see $ +# and % in the examples). +# Here are two examples, using a LaTeX syntax (suppress +# the first 2 characters of each line): +# +# # Data for the first example of pie charts +# +# # Title of the figure | Title for the table of figures | Label +# Example 1 of pie chart +# +# # Value | Inside label | Outside label | Type of | Color +# # | filling | fill +# 20 | \small\$9.0M | {\em Paris}\\{\em France} | hlines | black +# 35 | \small\$16.7M | {\em London}\\Great Britain | vlines | black +# 45 | {\small\$23.1M}\\1991 | {\em Berlin}\\Germany | crosshatch | black +# +# +# # Data for the second example of pie charts +# +# # Title of the figure | Title for the table of figures | Label +# \bf Example 2 of pie chart | Pie Chart 2 | piechart2 +# +# # Value | Inside | Outside label | Type of | Color of | Explode part +# # | label | | filling | filling | +# 2 | | 2\% \\ Last | solid | red | yes +# 28 | | 28\% | solid | blue +# 4 | | 4\% | solid | green +# 47 | | 47\% \\ First | solid | magenta | yes +# 19 | | 19\% | solid | cyan +# +# +# Examples : If you name these files piechart1.dat and piechart2.dat, +# you can simply type: +# piecharts.sh 1.5 piechart1.tmp +# piecharts.sh 0.7 figure boxit pie2.tmp +# and just insert the two result files in a LaTeX document +# at the right place... +# There are no difference if you want to produce plain TeX +# code. You only must put valid plain TeX commands in the +# data files. +# +# Portability : Expected great. Tested on RS6000 under AIX 3.2 and +# DECStation 3100 under Ultrix 4.3 +# +# Known problems : - Obviously, take care of the labels for the small +# parts. If they are too long or in a too big font, the +# result will not be pretty... +# - You must have the LANG environment variable to En_US +# if your UNIX has the National Language Support (NLS) +# (by instance, amusing problems arrive with LANG=Fr_FR ...) +# +# Thanks : Timothy Van Zandt for the great work of PSTricks, tests +# and ideas for the plain TeX mode. +# +# History : (10/16/92) - rev. 1.0 +# (10/20/92) - rev. 1.1: +# * increase the portability by suppression of the usage +# of the sub builtin function of AWK +# * better tracking of blank/null and comments lines +# (12/04/92) - rev. 2.0: +# * increase the portability by transformation of the +# unique AWK program in a SHELL script calling an +# AWK program : +# - the program is renamed form piecharts.awk to +# piecharts.sh +# - input data file now given as parameter, not as +# standard input +# - the parameters are obtained in the SHELL script +# - the options (SCALE, FIGURE and BOXIT) are now +# treated by post-processing the AWK output file by +# SED (ugly but it's because some AWK versions +# doesn't accept the definition of external +# variables...) +# * change the unit for the values of the parts +# from fractions of 360 degrees to percentages +# * definition of the figure environment now optional, +# using the FIGURE option +# * new possibility to declare some explode parts in the +# piechart +# * use of the new \uput PSTricks macro for easy +# treatment of explode parts +# * possibility to have multiple (centered) line labels +# (inside and outside labels) +# * better tracking of syntax errors in the command line +# (12/11/92) - rev. 2.1: +# * generation of the tabular environment for labels only +# if they have multi-lines +# * the comment lines which begin with the ## are copied +# (without the ##) at the beginning of the result file. +# This allow automatic generation of input data file +# with a good specification of the colors, by automatic +# generation of the \newgray commands. It's to work in +# conjonction with the piecharts-data.sh script. +# * input data file read on the standard input +# * diminution of the width of the minipage to avoid +# the "overfull \hbox" problems +# * change the test of the sum of percentages from 100 to +# 100.0001, because it can occurs problem with 100... +# (01/26/93) - rev. 2.2: +# * suppression of lines longer than 78 characters +# * change the obsolete \Polar PSTricks order to +# \SpecialCoor +# * add the PLAIN option and the possibility to generate +# plain TeX code + + +# Interpretation of the parameters +if [ $# -gt 3 ] + then echo "You cannot give more than 3 parameters." + echo "Syntax: piecharts.sh [scale factor] ([PLAIN] | [FIGURE] \ +[BOXIT]) out_file" + exit +fi + +SCALE=1 +FIGURE="xx" +BOXIT="xx" +TEX="LATEX" +while [ $# -ne 0 ] + do if [ $1 = "BOXIT" ] || [ $1 = "boxit" ] + then BOXIT="BOXIT" + elif [ $1 = "FIGURE" ] || [ $1 = "figure" ] + then FIGURE="FIGURE" + elif [ $1 = "PLAIN" ] || [ $1 = "plain" ] + then TEX="PLAIN" + else SCALE=$1 + fi + shift +done + +# Verifications for the plain TeX mode +if [ $TEX = "PLAIN" ] && [ $BOXIT = "BOXIT" ] + then echo "You cannot give the BOXIT parameter in PLAIN TEX mode." + exit +fi +if [ $TEX = "PLAIN" ] && [ $FIGURE = "FIGURE" ] + then echo "You cannot give the FIGURE parameter in PLAIN TEX mode." + exit +fi + +# Beginning of the AWK program +awk ' +BEGIN{FS="|" # Fields separator + PARAM="NO" + BEGIN_VALUE=0 + END_VALUE=0 + TOTAL_PERCENT=0 + # Definition of a figure environment (if FIGURE is not use, this line + # will be remove later - ugly but it is because some AWK versions does + # not accept the definition of external variables...) + # if FIGURE + print "%figure\\begin{figure}[htbp]" + # Framebox around the figure, (if BOXIT is not use, this line will be + # remove later) + # if BOXIT + print "%boxit \\psframebox[framesep=8mm]{" + print "%latex {\\addtolength{\\textwidth}{-2.3cm}" + print "%latex \\begin{minipage}{\\textwidth}" + print "%latex \\begin{center}" + # if FIGURE + print "%figure \\vspace{6mm}" + print "%latex {\\setlength{\\tabcolsep}{0cm}" + print "%tex {%" + print " \\psset{unit=cm,xunit=cm,yunit=cm}" + print "%latex \\begin{pspicture}(-2,-2)(2,2)" + print " \\SpecialCoor" + print "%tex \\pspicture(-2,-2)(2,2)" + print "%tex \\def\\PieLabel\#1{\\vbox{\\halign{\\hfil\#\#"\ +"\\hfil\\cr\#1\\cr}}}%" + print " \\psset{framesep=1.5pt}" + } + +{ + # Suppression of the right and left blanks of the variables + for (I=1;I<=NF+1;I++) { + # On the left... + for (J=1;J<=length($I)+1;J++) + if (substr($I,1,1) == " ") + $I=substr($I,2) + else + break + # On the right... + for (J=length($I);J>0;J--) + if (substr($I,J,1) == " ") + $I=substr($I,1,J-1) + else + break + } + + # Special comments before title (beginning by ##): they are copied + # at the beginning of the result file, without the ## + if (substr($1,1,2) == "##") + print substr($1,3,length($1)) + + # Comments, null and blank lines + if (substr($1,1,1) == "#" || $1 == "" || $1 == " ") + break + + if (PARAM == "NO") { + # Generic parameters: title, title for the table of figures, label + # (the last two are optional) + PARAM="YES" + TITLE=$1 + TABLE_TITLE=$2 + LABEL=$3} + else { + # Verification of the sum of the parts + TOTAL_PERCENT=TOTAL_PERCENT+$1 + if (TOTAL_PERCENT > 100.0001) { + print "Error! Total of percentages greater than 100! (" \ + TOTAL_PERCENT ")" + exit} + # Transformation of percentages in fractions of 360 degrees + $1=$1*3.6 + END_VALUE=END_VALUE+$1 + VAL=BEGIN_VALUE+$1/2 + #Explode part + if ($6 == "YES" || $6 == "yes") + print " \\uput{0.3}[" VAL "](0;0){" + print " \\pswedge[fillstyle=" $4 ",fillcolor=" $5 "]{2}{" \ + BEGIN_VALUE "}{" END_VALUE "}" + # Inside label + if ($2 != "") { + print "%tex \\rput(1.2;" VAL "){\\psframebox*{\\PieLabel{" \ +$2 "}}}" + if (index($2,"\\\\") == 0) + print "%latex \\rput(1.2;" VAL "){\\psframebox*{" $2 "}}" + else { + print "%latex \\rput(1.2;" VAL \ + "){\\psframebox*{\\begin{tabular}{c}" + print "%latex " $2 + print "%latex \\end{tabular}}}" + } + } + # Outside label + if ($3 != "") { + print "%tex \\uput{2.2}[" VAL "](0;0){\\PieLabel{" $3 "}}" + if (index($3,"\\\\") == 0) + print "%latex \\uput{2.2}[" VAL "](0;0){" $3 "}" + else { + print "%latex \\uput{2.2}[" VAL "](0;0){\\begin{tabular}{c}" + print "%latex " $3 + print "%latex \\end{tabular}}" + } + } + # End of explode treatment + if ($6 == "YES" || $6 == "yes") + print " }" + BEGIN_VALUE=END_VALUE} + $1="" +} + +END{ + print "%latex \\end{pspicture}" + print "%tex \\endpspicture" + print " }" + # For the case of a multiple line outside label at the bottom... + # if FIGURE + print "%figure \\vspace{4mm}" + print "%latex \\end{center}" + # if FIGURE + if (TABLE_TITLE == "") + print "%figure \\caption{" TITLE "}" + else + print "%figure \\caption[" TABLE_TITLE "]{" TITLE "}" + if (LABEL != "") + print "%figure \\label{f:" LABEL "}" + print "%latex \\end{minipage}" + print "%latex }" + # if BOXIT + print "%boxit }" + # if FIGURE + print "%figure\\end{figure}" + }' >/tmp/piechart.tmp + +# Post-processing for the "scale factor", PLAIN, FIGURE and BOXIT parameters +# (ugly but it's because some AWK versions doesn't accept the definition +# of external variables...) +if [ $FIGURE = "FIGURE" ] + then sed -e /unit=/s/unit=/unit=$SCALE/g -e /\^%figure/s/// \ + /tmp/piechart.tmp >/tmp/piechart.tmp2 + else sed -e /unit=/s/unit=/unit=$SCALE/g -e /\^%figure/d \ + /tmp/piechart.tmp >/tmp/piechart.tmp2 +fi +mv /tmp/piechart.tmp2 /tmp/piechart.tmp +if [ $BOXIT = "BOXIT" ] + then sed -e /\^%boxit/s/// /tmp/piechart.tmp >/tmp/piechart.tmp2 + else sed -e /\^%boxit/d /tmp/piechart.tmp >/tmp/piechart.tmp2 +fi + +# plain TeX or LaTeX mode +mv /tmp/piechart.tmp2 /tmp/piechart.tmp +if [ $TEX = "LATEX" ] + then sed -e /\^%tex/d /tmp/piechart.tmp >/tmp/piechart.tmp2 + mv /tmp/piechart.tmp2 /tmp/piechart.tmp + sed -e /\^%latex/s/// /tmp/piechart.tmp >/tmp/piechart.tmp2 + else sed -e /\^%latex/d /tmp/piechart.tmp >/tmp/piechart.tmp2 + mv /tmp/piechart.tmp2 /tmp/piechart.tmp + sed -e /\^%tex/s/// /tmp/piechart.tmp >/tmp/piechart.tmp2 +fi + +# Deliver of the result! +cat /tmp/piechart.tmp2 + +rm /tmp/piechart.tmp /tmp/piechart.tmp2 diff --git a/usergrps/uktug/baskervi/6_2/spqr/pst-3d.tex b/usergrps/uktug/baskervi/6_2/spqr/pst-3d.tex new file mode 100644 index 0000000000..8d00861305 --- /dev/null +++ b/usergrps/uktug/baskervi/6_2/spqr/pst-3d.tex @@ -0,0 +1,691 @@ +%% BEGIN pst-3d.tex +%% +%% Tilting and other pseudo-3D tricks for PSTricks v0.93a. +%% This is experimental. See 3d-test.tex for a test file. +%% There is not yet any documentation. +%% +\def\fileversion{0.93a} +\def\filedate{93/08/26} +%% +%% COPYRIGHT 1993, by Timothy Van Zandt, tvz@Princeton.EDU +%% See pstricks.tex or pstricks.doc for copying restrictions. +%% + +\message{ v\fileversion, \filedate} + +\csname PSTthreeDLoaded\endcsname +\let\PSTthreeDLoaded\endinput + +\ifx\PSTricksLoaded\endinput\else + \def\next{\input pstricks.tex} + \expandafter\next +\fi + +\edef\TheAtCode{\the\catcode`\@} +\catcode`\@=11 + +% \begin{macro}{\tx@SetMatrixThreeD,\tx@ProjThreeD,\tx@SetMatrixEmbed} +% Viewpoint for 3D coordinates is given by three angles: $\alpha$, $\beta$ and +% $\gamma$. $\alpha$ and $\beta$ determine the direction from which one is +% looking. $\gamma$ then determines the orientation of the observing. +% +% When $\alpha$, $\beta$ and $\gamma$ are all zero, the observer is looking +% from the negative part of the $y$-axis, and sees the $xz$-plane the way in +% 2D one sees the $xy$ plan. Hence, to convert the 3D coordinates to their 2D +% project, $\la x, y, z\ra$ map to $\la x, z\ra$. +% +% When the orientation is different, we rotate the coordinates, and then +% perform the same projection. +% +% We move up to latitude $\beta$, over to longitude $\alpha$, and then rotate +% by $\gamma$. This means that we first rotate around $y$-axis by $\gamma$, +% then around $x$-axis by $\beta$, and the around $z$-axis by $\alpha$. +% +% Here are the matrices: +% \begin{eqnarray*} +% R_z(\alpha) & = & \left[ +% \begin{array}{ccc} +% \cos \alpha & -\sin \alpha & 0 \\ +% \sin \alpha & cos \alpha & 0 \\ +% 0 & 0 & 1 +% \end{array} \right] \\ +% R_x(\beta) & = & \left[ +% \begin{array}{ccc} +% 1 & 0 & 0 \\ +% 0 & \cos \beta & \sin \beta \\ +% 0 & -\sin \beta & \cos \beta +% \end{array} \right] \\ +% R_y(\gamma) & = & \left[ +% \begin{array}{ccc} +% \cos \gamma & 0 & -\sin \gamma \\ +% 0 & 1 & 0 \\ +% \sin \gamma & 0 & \cos \gamma +% \end{array} \right] +% \end{eqnarray*} +% +% The rotation of a coordinate is then performed by the matrix $R_z(\alpha) +% R_x(\beta) R_y(\gamma)$. The first and third columns of the matrix are the +% basis vectors of the plan upon which the 3D coordinates are project (the old +% basis vectors were $\la 1, 0, 0\ra$ and $\la 0, 0, 1$\ra; rotating these +% gives the first and third columns of the matrix). +% +% These new basis vectors are: +% \begin{eqnarray*} +% \tilde{x} & = & \left[ +% \begin{array}{c} +% \cos\alpha \cos\gamma - \sin\beta \sin\alpha \sin\gamma \\ +% \sin\alpha \cos\gamma + \sin\beta \cos\alpha \sin\gamma \\ +% \cos\beta \sin\gamma +% \end{array} \right] \\ +% \tilde{z} & = & \left[ +% \begin{array}{c} +% -\cos\alpha \sin\gamma - \sin\beta \sin\alpha \cos\gamma \\ +% -\sin\alpha \sin\gamma + \sin\beta \cos\alpha \cos\gamma \\ +% \cos\beta \cos\gamma +% \end{array} \right] +% \end{eqnarray*} +% +% Rather than specifying the angles $\alpha$ and $\beta$, the user gives a +% vector indicating where the viewpoint is. This new viewpoint is the rotation +% o the old viewpoint. The old viewpoint is $\la 0, -1, 0\ra$, and so the new +% viewpoint is +% \[ +% R_z(\alpha) R_x(\beta) \left[ \begin{array}{c} 0\\-1\\0 \end{array} \right] +% \, = \, +% \left[ \begin{array}{c} +% \cos\beta \sin\alpha \\ +% -\cos\beta \cos\alpha \\ +% \sin\beta +% \end{array} \right] +% \, = \, +% \left[ \begin{array}{c} v_1 \\ v_2 \\ v_3 \end{array} \right] +% \] +% Therefore, +% \begin{eqnarray*} +% \alpha & = & \arc\tan (v_1 / -v_2) \\ +% \beta & = & \arc\tan (v_3 \sin\alpha / v_1) +% \end{eqnarray*} +% Unless $p_1=p_2=0$, in which case $\alpha=0$ and $\beta=\sign(p_3)90$, or +% $p_1=p_3=0$, in which case $\beta=0$. +% +% The syntax of "SetMatrixThreeD" is +% \begin{Ex} +% $v_1$ $v_2$ $v_3$ $\gamma$ "SetMatrixThreeD" +% \end{Ex} +% "SetMatrixThreeD" first computes +% \[ +% \begin{array}{ll} +% a=\sin\alpha & b=\cos\alpha\\ +% c=\sin\beta & d=\cos\beta\\ +% e=\sin\gamma & f=\cos\gamma +% \end{array} +% \] +% and then sets "Matrix3D" to "["$\tilde{x}$ $\tilde{z}$"]". +% +% \begin{macrocode} +\pst@def{SetMatrixThreeD}<% + dup sin /e ED cos /f ED + /p3 ED /p2 ED /p1 ED + p1 0 eq + { /a 0 def /b p2 0 le { 1 } { -1 } ifelse def + p3 p2 abs + } + { p2 0 eq + { /a p1 0 lt { -1 } { 1 } ifelse def /b 0 def + p3 p1 abs + } + { p1 dup mul p2 dup mul add sqrt dup + p1 exch div /a ED + p2 exch div neg /b ED + p3 p1 a div + } + ifelse + } + ifelse + atan dup sin /c ED cos /d ED + /Matrix3D + [ + b f mul c a mul e mul sub + a f mul c b mul e mul add + d e mul + b e mul neg c a mul f mul sub + a e mul neg c b mul f mul add + d f mul + ] def> +% \end{macrocode} +% +% The syntax of "ProjThreeD" is +% \begin{Ex} +% $x$ $y$ $z$ ProjThreeD $x'$ $y'$ +% \end{Ex} +% where $x'=\la x, y, z\ra \cdot \tilde{x}$ and $y'=\la x, y, z\ra \cdot +% \tilde{z}$. +% +% \begin{macrocode} +\pst@def{ProjThreeD}<% + /z ED /y ED /x ED + Matrix3D aload pop + z mul exch y mul add exch x mul add + 4 1 roll + z mul exch y mul add exch x mul add + exch> +% \end{macrocode} +% +% To embed 2D $\la x, y\ra$ coordinates in 3D, the user specifies the normal +% vector and an angle. If we decompose this normal vector into an angle, as +% when converting 3D coordinates to 2D coordinates, and let $\hat\alpha$, +% $\hat\beta$ and $\hat\gamma$ be the three angles, then when these angles are +% all zero the coordinate $\la x, y\ra$ gets mapped to $\la x, 0, y\ra$, and +% otherwise $\la x, y\ra$ gets mapped to +% \[ +% R_z(\hat\alpha) R_x(\hat\beta) R_y(\hat\gamma) +% \left[ \begin{array}{c} x \\ 0 \\ y \end{array} \right] +% \, = \, +% \left[ \begin{array}{c} +% \hat{x}_1 x + \hat{z}_1 y\\ +% \hat{x}_2 x + \hat{z}_2 y\\ +% \hat{x}_3 x + \hat{z}_3 y +% \end{array} \right] +% \] +% where $\hat{x}$ and $\hat{z}$ are the first and third columns of +% $R_z(\hat\alpha) R_x(\hat\beta) R_y(\hat\gamma)$. +% +% Now add on a 3D-origin: +% \[ +% \left[ \begin{array}{c} +% \hat{x}_1 x + \hat{z}_1 y + x_0\\ +% \hat{x}_2 x + \hat{z}_2 y + y_0\\ +% \hat{x}_3 x + \hat{z}_3 y + z_0 +% \end{array} \right] +% \] +% +% Now when we project back onto 2D coordinates, we get +% \begin{eqnarray*} +% x' & = & \tilde{x}_1(\hat{x}_1 x + \hat{z}_1 y + x_0) + +% \tilde{x}_2(\hat{x}_2 x + \hat{z}_2 y + y_0) + +% \tilde{x}_3(\hat{x}_3 x + \hat{z}_3 y + z_0)\\ +% & = & +% (\tilde{x}_1\hat{x}_1 + \tilde{x}_2\hat{x}_2 + \tilde{x}_3\hat{x}_3) x\\ +% + (\tilde{x}_1\hat{z}_1 + \tilde{x}_2\hat{z}_2 + \tilde{x}_3\hat{z}_3) y\\ +% + \tilde{x}_1 x_0 + \tilde{x}_2 y_0 + \tilde{z}_3 z_0 +% y' & = & \tilde{z}_1(\hat{x}_1 x + \hat{z}_1 y + x_0) + +% \tilde{z}_2(\hat{x}_2 x + \hat{z}_2 y + y_0) + +% \tilde{z}_3(\hat{x}_3 x + \hat{z}_3 y + z_0)\\ +% & = & +% (\tilde{z}_1\hat{x}_1 + \tilde{z}_2\hat{x}_2 + \tilde{z}_3\hat{x}_3) x\\ +% + (\tilde{z}_1\hat{z}_1 + \tilde{z}_2\hat{z}_2 + \tilde{z}_3\hat{z}_3) y\\ +% + \tilde{z}_1 x_0 + \tilde{z}_2 y_0 + \tilde{z}_3 z_0 +% \end{eqnarray*} +% Hence, the transformation matrix is: +% \[ +% \left[ \begin{array}{c} +% \tilde{x}_1\hat{x}_1 + \tilde{x}_2\hat{x}_2 + \tilde{x}_3\hat{x}_3) \\ +% \tilde{z}_1\hat{x}_1 + \tilde{z}_2\hat{x}_2 + \tilde{z}_3\hat{x}_3) \\ +% \tilde{x}_1\hat{z}_1 + \tilde{x}_2\hat{z}_2 + \tilde{x}_3\hat{z}_3) \\ +% \tilde{z}_1\hat{z}_1 + \tilde{z}_2\hat{z}_2 + \tilde{z}_3\hat{z}_3) \\ +% \tilde{x}_1 x_0 + \tilde{x}_2 y_0 + \tilde{z}_3 z_0 \\ +% \tilde{z}_1 x_0 + \tilde{z}_2 y_0 + \tilde{z}_3 z_0 +% \end{array} \right] +% \] +% +% The syntax of "SetMatrixEmbed" is +% \begin{Ex} +% $x_0$ $y_0$ $z_0$ $\hat{v_1}$ $\hat{v_2}$ $\hat{v_3} $\hat{\gamma}$ +% $v_1$ $v_2$ $v_3$ $\gamma$ "SetMatrixEmbed" +% \end{Ex} +% "SetMatrixEmbed" first sets "" to the basis vectors for +% the viewpoint projection (the tilde stuff above). Then it sets "Matrix3D" to +% the basis vectors for the embedded plane. Finally, it sets the +% transformation matrix to the matrix given above. +% +% \begin{macrocode} +\pst@def{SetMatrixEmbed}<% + \tx@SetMatrixThreeD + Matrix3D aload pop + /z3 ED /z2 ED /z1 ED /x3 ED /x2 ED /x1 ED + \tx@SetMatrixThreeD + [ + Matrix3D aload pop + z3 mul exch z2 mul add exch z1 mul add 4 1 roll + z3 mul exch z2 mul add exch z1 mul add + Matrix3D aload pop + x3 mul exch x2 mul add exch x1 mul add 4 1 roll + x3 mul exch x2 mul add exch x1 mul add + 3 -1 roll 3 -1 roll 4 -1 roll 8 -3 roll 3 copy + x3 mul exch x2 mul add exch x1 mul add 4 1 roll + z3 mul exch z2 mul add exch z1 mul add + ] + concat> +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\psset@viewpoint,\psk@viewpoint} +% \begin{macrocode} +\let\pssetzlength\pssetylength +\def\psset@viewpoint#1{% + \pst@expandafter\psset@@viewpoint#1 {} {} {} \@nil + \let\psk@viewpoint\pst@tempg} +\def\psset@@viewpoint#1 #2 #3 #4\@nil{% + \begingroup + \pssetxlength\pst@dima{#1}% + \pssetylength\pst@dimb{#2}% + \pssetzlength\pst@dimc{#3}% + \xdef\pst@tempg{% + \pst@number\pst@dima \pst@number\pst@dimb \pst@number\pst@dimc}% + \endgroup} +\psset@viewpoint{1 -1 1} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\psset@viewangle,\psk@viewangle} +% \begin{macrocode} +\def\psset@viewangle#1{\pst@getangle{#1}\psk@viewangle} +\psset@viewangle{0} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\psset@normal,\psk@normal} +% \begin{macrocode} +\def\psset@normal#1{% + \pst@expandafter\psset@@viewpoint#1 {} {} {} \@nil + \let\psk@normal\pst@tempg} +\psset@normal{0 0 1} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\psset@embedangle,\psk@embedangle} +% \begin{macrocode} +\def\psset@embedangle#1{\pst@getangle{#1}\psk@embedangle} +\psset@embedangle{0} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\tx@TMSave,\tx@TMRestore} +% \begin{LVerbatim} +% {} TMChange +% \begin{macrocode} +\pst@def{TMSave}<% + tx@Dict /TMatrix known not { /TMatrix { } def /RAngle { 0 } def } if + /TMatrix [ TMatrix CM ] cvx def> +\pst@def{TMRestore}<% + CP /TMatrix [ TMatrix setmatrix ] cvx def moveto> +\pst@def{TMChange}<% + \tx@TMSave + /cp [ currentpoint ] cvx def % ??? Check this later. + CM +% Set "standard" coor. system , with "pt" units and origin at currentpoint. +% This let's us rotate, or whatever, around \TeX's current point, without +% having to worry about strange coordinate systems that the dvi-to-ps +% driver might be using. + CP T \tx@STV +% Let M = old matrix (on stack), and M' equal current matrix. Then +% go from M' to M by applying M Inv(M'). + CM matrix invertmatrix % Inv(M') + matrix concatmatrix % M Inv(M') +% Now modify transformation matrix: + exch exec +% Now apply M Inv(M') + concat cp moveto> +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\ThreeDput} +% \begin{macrocode} +\def\ThreeDput{\def\pst@par{}\pst@object{ThreeDput}} +\def\ThreeDput@i{\@ifnextchar({\ThreeDput@ii}{\ThreeDput@ii(\z@,\z@,\z@)}} +\def\ThreeDput@ii(#1,#2,#3){% + \pst@killglue\pst@makebox{\ThreeDput@iii(#1,#2,#3)}} +\def\ThreeDput@iii(#1,#2,#3){% + \begingroup + \use@par + \if@star\pst@starbox\fi + \pst@makesmall\pst@hbox + \pssetxlength\pst@dima{#1}% + \pssetylength\pst@dimb{#2}% + \pssetzlength\pst@dimc{#3}% + \leavevmode + \hbox{% + \pst@Verb{% + { \pst@number\pst@dima + \pst@number\pst@dimb + \pst@number\pst@dimc + \psk@normal + \psk@embedangle + \psk@viewpoint + \psk@viewangle + \tx@SetMatrixEmbed + } \tx@TMChange}% + \box\pst@hbox + \pst@Verb{\tx@TMRestore}}% + \endgroup + \ignorespaces} +% \end{macrocode} +% \end{macro} +% +% +% \section{Arithmetic\label{Arithmetic}} +% +% +% \begin{macro}{\pst@divide} +% This is adapted from Donald Arseneau's "shapepar.sty". +% Syntax: +% \begin{LVerbatim} +% \pst@divide{}{}{} +% \pst@@divide{}{} +% \end{LVerbatim} +% and should be dimensions. "\pst@divide" sets +% to / (in points). "\pst@@divide" sets "\pst@dimg" to +% /. +% \begin{macrocode} +\def\pst@divide#1#2#3{% + \pst@@divide{#1}{#2}% + \pst@dimtonum\pst@dimg{#3}} +\def\pst@@divide#1#2{% + \pst@dimg=#1\relax + \pst@dimh=#2\relax + \pst@cntg=\pst@dimh + \pst@cnth=67108863 + \pst@@@divide\pst@@@divide\pst@@@divide\pst@@@divide + \divide\pst@dimg\pst@cntg} +% \end{macrocode} +% The number 16 is the level of uncertainty. Use a lower power of 2 for more +% accuracy (2 is most precise). But if you change it, you must change the +% repetions of "\pst@@@divide" in "\pst@@divide" above: +% \[ +% \mbox{precision}^\mbox{repetitions} = 65536 +% \] +% (E.g., $16^4 = 65536$). +% \begin{macrocode} +\def\pst@@@divide{% + \ifnum + \ifnum\pst@dimg<\z@-\fi\pst@dimg<\pst@cnth + \multiply\pst@dimg\sixt@@n + \else + \divide\pst@cntg\sixt@@n + \fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pst@pyth} +% Syntax: +% \begin{LVerbatim} +% \pst@pyth{}{}{} +% \end{LVerbatim} +% is set to $((dim1)^2+(dim2)^2)^{1/2}$. +% +% The algorithm is copied from \PiCTeX, by Michael Wichura (with permission). +% Here is his description: +% \begin{quote} +% Suppose $x>0$, $y>0$. Put $s = x+y$. Let $z = (x^2+y^2)^{1/2}$. Then $z = +% s\times f$, where +% \[ +% f = (t^2 + (1-t)^2)^{1/2} = ((1+\tau^2)/2)^{1/2} +% \] +% and $t = x/s$ and $\tau = 2(t-1/2)$. +% \end{quote} +% \begin{macrocode} +\def\pst@pyth#1#2#3{% + \begingroup + \pst@dima=#1\relax + \ifnum\pst@dima<\z@\pst@dima=-\pst@dima\fi % dima=abs(x) + \pst@dimb=#2\relax + \ifnum\pst@dimb<\z@\pst@dimb=-\pst@dimb\fi % dimb=abs(y) + \advance\pst@dimb\pst@dima % dimb=s=abs(x)+abs(y) + \ifnum\pst@dimb=\z@ + \global\pst@dimg=\z@ % dimg=z=sqrt(x^2+y^2) + \else + \multiply\pst@dima 8\relax % dima= 8abs(x) + \pst@@divide\pst@dima\pst@dimb % dimg =8t=8abs(x)/s + \advance\pst@dimg -4pt % dimg = 4tau = (8t-4) + \multiply\pst@dimg 2 + \pst@dimtonum\pst@dimg\pst@tempa + \pst@dima=\pst@tempa\pst@dimg % dima=(8tau)^2 + \advance\pst@dima 64pt % dima=u=[64+(8tau)^2]/2 + \divide\pst@dima 2\relax % =(8f)^2 + \pst@dimd=7pt % initial guess at sqrt(u) + \pst@@pyth\pst@@pyth\pst@@pyth % dimd=sqrt(u) + \pst@dimtonum\pst@dimd\pst@tempa + \pst@dimg=\pst@tempa\pst@dimb + \global\divide\pst@dimg 8 % dimg=z=(8f)*s/8 + \fi + \endgroup + #3=\pst@dimg} +\def\pst@@pyth{% dimd = g <-- (g + u/g)/2 + \pst@@divide\pst@dima\pst@dimd + \advance\pst@dimd\pst@dimg + \divide\pst@dimd 2\relax} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pst@sinandcos} +% Syntax: +% \begin{LVerbatim} +% \pst@sinandcos{}{} +% \end{LVerbatim} +% , in "sp" units, should equal 100,000 times the angle, in degrees +% between 0 and 90. should equal the angle's quadrant (0, 1, 2 or 3). +% "\pst@dimg" is set to $\sin(\theta)$ and "\pst@dimh" is set to +% $\cos(\theta)$ (in pt's). +% +% The algorithms uses the usual McLaurin expansion. +% \begin{macrocode} +\def\pst@sinandcos#1{% + \begingroup + \pst@dima=#1\relax + \pst@dima=.366022\pst@dima %Now 1pt=1/32rad + \pst@dimb=\pst@dima % dimb->32sin(angle) in pts + \pst@dimc=32\p@ % dimc->32cos(angle) in pts + \pst@dimtonum\pst@dima\pst@tempa + \pst@cntb=\tw@ + \pst@cntc=-\@ne + \pst@cntg=32 + \loop + \ifnum\pst@dima>\@cclvi % 256 + \pst@dima=\pst@tempa\pst@dima + \divide\pst@dima\pst@cntg + \divide\pst@dima\pst@cntb + \ifodd\pst@cntb + \advance\pst@dimb \pst@cntc\pst@dima + \pst@cntc=-\pst@cntc + \else + \advance\pst@dimc by \pst@cntc\pst@dima + \fi + \advance\pst@cntb\@ne + \repeat + \divide\pst@dimb\pst@cntg + \divide\pst@dimc\pst@cntg + \global\pst@dimg\pst@dimb + \global\pst@dimh\pst@dimc + \endgroup} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pst@getsinandcos} +% "\pst@getsinandcos" normalizes the angle to be in the first quadrant, sets +% "\pst@quadrant" to 0 for the first quadrant, 1 for the second, 2 for the +% third, and 3 for the fourth, invokes "\pst@sinandcos", and sets "\pst@sin" +% to the sine and "\pst@cos" to the cosine. +% \begin{macrocode} +\def\pst@getsinandcos#1{% + \pst@dimg=100000sp + \pst@dimg=#1\pst@dimg + \pst@dimh=36000000sp + \pst@cntg=0 + \loop + \ifnum\pst@dimg<\z@ + \advance\pst@dimg\pst@dimh + \repeat + \loop + \ifnum\pst@dimg>\pst@dimh + \advance\pst@dimg-\pst@dimh + \repeat + \pst@dimh=9000000sp + \def\pst@tempg{% + \ifnum\pst@dimg<\pst@dimh\else + \advance\pst@dimg-\pst@dimh + \advance\pst@cntg\@ne + \ifnum\pst@cntg>\thr@@ \advance\pst@cntg-4 \fi + \expandafter\pst@tempg + \fi}% + \pst@tempg + \chardef\pst@quadrant\pst@cntg + \ifdim\pst@dimg=\z@ + \def\pst@sin{0}% + \def\pst@cos{1}% + \else + \pst@sinandcos\pst@dimg + \pst@dimtonum\pst@dimg\pst@sin + \pst@dimtonum\pst@dimh\pst@cos + \fi} +% \end{macrocode} +% \end{macro} +% +% \section{Tilting} +% +% \begin{macro}{\pstilt} +% \begin{macrocode} +\def\pstilt#1{\pst@makebox{\pstilt@{#1}}} +\def\pstilt@#1{% + \begingroup + \leavevmode + \pst@getsinandcos{#1}% + \hbox{% + \ifcase\pst@quadrant + \kern\pst@cos\dp\pst@hbox + \pst@dima=\pst@cos\ht\pst@hbox + \ht\pst@hbox=\pst@sin\ht\pst@hbox + \dp\pst@hbox=\pst@sin\dp\pst@hbox + \or + \kern\pst@sin\ht\pst@hbox + \pst@dima=\pst@sin\dp\pst@hbox + \ht\pst@hbox=\pst@cos\ht\pst@hbox + \dp\pst@hbox=\pst@cos\dp\pst@hbox + \or + \kern\pst@cos\ht\pst@hbox + \pst@dima=\pst@sin\dp\pst@hbox + \pst@dimg=\pst@sin\ht\pst@hbox + \ht\pst@hbox=\pst@sin\dp\pst@hbox + \dp\pst@hbox=\pst@dimg + \or + \kern\pst@sin\dp\pst@hbox + \pst@dima=\pst@sin\ht\pst@hbox + \pst@dimg=\pst@cos\ht\pst@hbox + \ht\pst@hbox=\pst@cos\dp\pst@hbox + \dp\pst@hbox=\pst@dimg + \fi + \pst@Verb{% + { [ 1 0 + \pst@cos\space \ifnum\pst@quadrant>\@ne neg \fi + \pst@sin\space + \ifnum\pst@quadrant>\z@\ifnum\pst@quadrant<\thr@@ neg \fi\fi + \ifodd\pst@quadrant exch \fi + 0 0 + ] concat + } \tx@TMChange}% + \box\pst@hbox + \pst@Verb{\tx@TMRestore}% + \kern\pst@dima}% + \endgroup} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\psTilt} +% \begin{macrocode} +\def\psTilt#1{\pst@makebox{\psTilt@{#1}}} +\def\psTilt@#1{% + \begingroup + \leavevmode + \pst@getsinandcos{#1}% + \hbox{% + \ifodd\pst@quadrant + \pst@@divide{\dp\pst@hbox}{\pst@cos\p@}% + \ifnum\pst@quadrant=\thr@@\kern\else\pst@dima=\fi\pst@sin\pst@dimg + \pst@@divide{\ht\pst@hbox}{\pst@cos\p@}% + \ifnum\pst@quadrant=\@ne\kern\else\pst@dima=\fi\pst@sin\pst@dimg + \else + \ifdim\pst@sin\p@=\z@ + \@pstrickserr{\string\psTilt\space angle cannot be 0 or 180}\@ehpa + \def\pst@sin{.7071}% + \def\pst@cos{.7071}% + \fi + \pst@@divide{\dp\pst@hbox}{\pst@sin\p@}% + \ifnum\pst@quadrant=\z@\kern\else\pst@dima=\fi\pst@cos\pst@dimg + \pst@@divide{\ht\pst@hbox}{\pst@sin\p@}% + \ifnum\pst@quadrant=\tw@\kern\else\pst@dima=\fi\pst@cos\pst@dimg + \fi + \ifnum\pst@quadrant>\@ne + \pst@dimg=\ht\pst@hbox + \ht\pst@hbox=\dp\pst@hbox + \dp\pst@hbox=\pst@dimg + \fi + \pst@Verb{% + { [ 1 0 + \pst@cos\space \pst@sin\space + \ifodd\pst@quadrant exch \fi + \tx@Div + \ifnum\pst@quadrant>\z@\ifnum\pst@quadrant<\thr@@ neg \fi\fi + \ifnum\pst@quadrant>\@ne -1 \else 1 \fi + 0 0 + ] concat + } \tx@TMChange}% + \box\pst@hbox + \pst@Verb{\tx@TMRestore}% + \kern\pst@dima}% + \endgroup} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\psset@Tshadowsize,\psTshadowsize} +% \begin{macrocode} +\def\psset@Tshadowsize#1{\pst@checknum{#1}\psTshadowsize} +\psset@Tshadowsize{1} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\psset@Tshadowangle,\psk@Tshadowangle} +% \begin{macrocode} +\def\psset@Tshadowangle#1{\pst@getangle{#1}\psk@Tshadowangle} +\psset@Tshadowangle{60} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\psset@Tshadowcolor,\psTshadowcolor} +% \begin{macrocode} +\def\psset@Tshadowcolor#1{\pst@getcolor{#1}\psTshadowcolor} +\psset@Tshadowcolor{lightgray} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\psshadow} +% \begin{macrocode} +\def\psshadow{\def\pst@par{}\pst@object{psshadow}} +\def\psshadow@i{\pst@makebox{\psshadow@ii}} +\def\psshadow@ii{% + \begingroup + \use@par + \leavevmode + \pst@getsinandcos{\psk@Tshadowangle}% + \hbox{% + \lower\dp\pst@hbox\hbox{% + \pst@Verb{% + { [ 1 0 + \pst@cos\space \psTshadowsize mul + \ifnum\pst@quadrant>\@ne neg \fi + \pst@sin\space \psTshadowsize mul + \ifnum\pst@quadrant>\z@\ifnum\pst@quadrant<\thr@@ neg \fi\fi + \ifodd\pst@quadrant exch \fi + 0 0 + ] concat + } \tx@TMChange}}% + \hbox to\z@{{\@nameuse{\psTshadowcolor}\copy\pst@hbox\hss}}% + \pst@Verb{\tx@TMRestore}% + \box\pst@hbox}% + \endgroup} +% \end{macrocode} +% \end{macro} + +\catcode`\@=\TheAtCode\relax + +\endinput + +%% END pst-3d.tex diff --git a/usergrps/uktug/baskervi/6_2/spqr/pst-code.tex b/usergrps/uktug/baskervi/6_2/spqr/pst-code.tex new file mode 100644 index 0000000000..72d19d14cc --- /dev/null +++ b/usergrps/uktug/baskervi/6_2/spqr/pst-code.tex @@ -0,0 +1,135 @@ +%% 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} + +\documentstyle{tvz-code} + +\def\fileversion{0.93a} +\def\filedate{93/03/12} + +% 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/usergrps/uktug/baskervi/6_2/spqr/pst-coil.pro b/usergrps/uktug/baskervi/6_2/spqr/pst-coil.pro new file mode 100644 index 0000000000..b266950f1e --- /dev/null +++ b/usergrps/uktug/baskervi/6_2/spqr/pst-coil.pro @@ -0,0 +1,28 @@ +%! +% PostScript prologue for pst-coil.tex. +% Created 1993/3/12. Source file was pst-coil.doc +% Version 0.93a, 93/03/12. +% For use with Rokicki's dvips. +/tx@CoilDict 40 dict def tx@CoilDict begin +/CoilLoop { /t ED t sin AspectSin mul t 180 div AspectCos mul add t cos +lineto } 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 Pyth /TotalLength ED Atan rotate /BeginAngle ArmA AspectCos +Div w h mul Div 360 mul def /EndAngle TotalLength ArmB sub AspectCos Div +w h mul Div 360 mul def 1 0 0 0 ArrowA ArmA 0 lineto /mtrx CM def w h +mul 2 Div w 2 Div scale BeginAngle Inc EndAngle { CoilLoop } for +EndAngle CoilLoop mtrx setmatrix TotalLength ArmB sub 0 lineto CP +TotalLength 0 ArrowB lineto } 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 Div w 2 Div scale +BeginAngle sin AspectSin mul BeginAngle 180 div AspectCos mul add +BeginAngle cos /lineto load stopped { moveto } if BeginAngle Inc +EndAngle { CoilLoop } for EndAngle CoilLoop mtrx setmatrix } 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 Pyth /TotalLength ED +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 +end diff --git a/usergrps/uktug/baskervi/6_2/spqr/pst-coil.sty b/usergrps/uktug/baskervi/6_2/spqr/pst-coil.sty new file mode 100644 index 0000000000..db2698955c --- /dev/null +++ b/usergrps/uktug/baskervi/6_2/spqr/pst-coil.sty @@ -0,0 +1,4 @@ +%% BEGIN: pst-coil.sty +\input pst-coil.tex +\endinput +%% END: pst-coil.sty diff --git a/usergrps/uktug/baskervi/6_2/spqr/pst-coil.tex b/usergrps/uktug/baskervi/6_2/spqr/pst-coil.tex new file mode 100644 index 0000000000..d54c7462db --- /dev/null +++ b/usergrps/uktug/baskervi/6_2/spqr/pst-coil.tex @@ -0,0 +1,128 @@ +%% BEGIN: pst-coil.tex +%% Generated on <1993/3/12> from `pst-coil.doc'. +%% For use with the PostScript header file `pst-coil.pro'. +%% +\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. +\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 +\pstheader{pst-coil.pro} +\edef\pst@theheaders{\pst@theheaders,pst-coil.pro} +\def\pst@coildict{tx@CoilDict begin } +\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} +\def\tx@CoilLoop{CoilLoop } +\def\tx@Coil{Coil } +\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} +\def\tx@AltCoil{AltCoil } +\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} +\def\tx@ZigZag{ZigZag } +\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} +\catcode`\@=\TheAtCode\relax +\endinput +%% +%% END: pst-coil.tex diff --git a/usergrps/uktug/baskervi/6_2/spqr/pst-dots.pro b/usergrps/uktug/baskervi/6_2/spqr/pst-dots.pro new file mode 100644 index 0000000000..461c6c6f9c --- /dev/null +++ b/usergrps/uktug/baskervi/6_2/spqr/pst-dots.pro @@ -0,0 +1,107 @@ +%!PS-Adobe-2.0 +%%Title: Dot Font for PSTricks +%%Creator: Timothy Van Zandt +%%Creation Date: May 7, 1993 +10 dict dup begin + /FontType 3 def + /FontMatrix [ .001 0 0 .001 0 0 ] def + /FontBBox [ 0 0 0 0 ] def + /Encoding 256 array def + 0 1 255 { Encoding exch /.notdef put } for + Encoding + dup (b) 0 get /Bullet put + dup (c) 0 get /Circle put + dup (C) 0 get /BoldCircle put + dup (u) 0 get /SolidTriangle put + dup (t) 0 get /Triangle put + dup (T) 0 get /BoldTriangle put + dup (r) 0 get /SolidSquare put + dup (s) 0 get /Square put + dup (S) 0 get /BoldSquare put + dup (q) 0 get /SolidPentagon put + dup (p) 0 get /Pentagon put + (P) 0 get /BoldPentagon put + /Metrics 13 dict def + Metrics begin + /Bullet 1000 def + /Circle 1000 def + /BoldCircle 1000 def + /SolidTriangle 1344 def + /Triangle 1344 def + /BoldTriangle 1344 def + /SolidSquare 886 def + /Square 886 def + /BoldSquare 886 def + /SolidPentagon 1093.2 def + /Pentagon 1093.2 def + /BoldPentagon 1093.2 def + /.notdef 0 def + end + /BBoxes 13 dict def + BBoxes begin + /Circle { -550 -550 550 550 } def + /BoldCircle /Circle load def + /Bullet /Circle load def + /Triangle { -571.5 -330 571.5 660 } def + /BoldTriangle /Triangle load def + /SolidTriangle /Triangle load def + /Square { -450 -450 450 450 } def + /BoldSquare /Square load def + /SolidSquare /Square load def + /Pentagon { -546.6 -465 546.6 574.7 } def + /BoldPentagon /Pentagon load def + /SolidPentagon /Pentagon load def + /.notdef { 0 0 0 0 } def + end + /CharProcs 20 dict def + CharProcs begin + /Adjust { + 2 copy dtransform floor .5 add exch floor .5 add exch idtransform + 3 -1 roll div 3 1 roll exch div exch scale + } def + /CirclePath { 0 0 500 0 360 arc closepath } def + /Bullet { 500 500 Adjust CirclePath fill } def + /Circle { 500 500 Adjust CirclePath .9 .9 scale CirclePath eofill } def + /BoldCircle { 500 500 Adjust CirclePath .8 .8 scale CirclePath eofill } def + /BoldCircle { CirclePath .8 .8 scale CirclePath eofill } def + /TrianglePath { + 0 660 moveto -571.5 -330 lineto 571.5 -330 lineto closepath + } def + /SolidTriangle { TrianglePath fill } def + /Triangle { TrianglePath .85 .85 scale TrianglePath eofill } def + /BoldTriangle { TrianglePath .7 .7 scale TrianglePath eofill } def + /SquarePath { + -450 450 moveto 450 450 lineto 450 -450 lineto -450 -450 lineto + closepath + } def + /SolidSquare { SquarePath fill } def + /Square { SquarePath .89 .89 scale SquarePath eofill } def + /BoldSquare { SquarePath .78 .78 scale SquarePath eofill } def + /PentagonPath { + -337.8 -465 moveto + 337.8 -465 lineto + 546.6 177.6 lineto + 0 574.7 lineto + -546.6 177.6 lineto + closepath + } def + /SolidPentagon { PentagonPath fill } def + /Pentagon { PentagonPath .89 .89 scale PentagonPath eofill } def + /BoldPentagon { PentagonPath .78 .78 scale PentagonPath eofill } def + /.notdef { } def + end + /BuildGlyph { + exch + begin + Metrics 1 index get exec 0 + BBoxes 3 index get exec + setcachedevice + CharProcs begin load exec end + end + } def + /BuildChar { + 1 index /Encoding get exch get + 1 index /BuildGlyph get exec + } bind def +end +/PSTricksDotFont exch definefont pop diff --git a/usergrps/uktug/baskervi/6_2/spqr/pst-node.pro b/usergrps/uktug/baskervi/6_2/spqr/pst-node.pro new file mode 100644 index 0000000000..fc76578d41 --- /dev/null +++ b/usergrps/uktug/baskervi/6_2/spqr/pst-node.pro @@ -0,0 +1,203 @@ +%! +% PostScript prologue for pst-node.tex. +% Created 1994/6/7. Source file was pst-node.doc +% Version 0.93a, 93/03/12. +% For use with Rokicki's dvips. +/tx@NodeDict 400 dict def tx@NodeDict begin +tx@Dict begin /T /translate load def end +/NewNode { gsave /next ED dict dup 3 1 roll def exch { dup 3 1 roll def } +if begin tx@Dict begin STV CP T exec end /NodeMtrx CM def next end +grestore } def +/InitPnode { /Y ED /X ED /NodePos { NodeSep Cos mul NodeSep Sin mul } def +} def +/InitCnode { /r ED /Y ED /X ED /NodePos { NodeSep r add dup Cos mul exch +Sin mul } def } 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 Div } ifelse } def +/InitRnode { /Y ED /X ED X sub /r ED /l X neg def Y add neg /d ED Y sub +/u ED /NodePos { GetRnodePos } def } def +/DiaNodePos { w h mul w Sin mul abs h Cos mul abs add Div NodeSep add dup +Cos mul exch Sin mul } def +/TriNodePos { Sin s lt { d NodeSep sub dup Cos mul Sin Div exch } { w h +mul w Sin mul h Cos abs mul add Div NodeSep add dup Cos mul exch Sin mul +} ifelse } def +/InitTriNode { sub 2 div exch 2 div exch 2 copy T 2 copy 4 index index /d +ED pop pop pop pop -90 mul rotate /NodeMtrx CM def /X 0 def /Y 0 def d +sub abs neg /d ED d add /h ED 2 div h mul h d sub Div /w ED /s d w Atan +sin def /NodePos { TriNodePos } def } def +/OvalNodePos { /ww w NodeSep add def /hh h NodeSep add def Sin ww mul Cos +hh mul Atan dup cos ww mul exch sin hh mul } def +/GetCenter { begin X Y NodeMtrx transform CM itransform end } def +/XYPos { dup sin exch cos Do /Cos ED /Sin ED /Dist ED Cos 0 gt { Dist +Dist Sin mul Cos div } { Cos 0 lt { Dist neg Dist Sin mul Cos div neg } +{ 0 Dist Sin mul } ifelse } ifelse Do } def +/GetEdge { dup 0 eq { pop begin 1 0 NodeMtrx dtransform CM idtransform +exch atan sub dup sin /Sin ED cos /Cos ED /NodeSep ED NodePos NodeMtrx +dtransform CM idtransform end } { 1 eq {{exch}} {{}} ifelse /Do ED pop +XYPos } ifelse } def +/AddOffset { 1 index 0 eq { pop pop } { 2 copy 5 2 roll cos mul add 4 1 +roll sin mul sub exch } ifelse } def +/GetEdgeA { NodeSepA AngleA NodeA NodeSepTypeA GetEdge OffsetA AngleA +AddOffset yA add /yA1 ED xA add /xA1 ED } def +/GetEdgeB { NodeSepB AngleB NodeB NodeSepTypeB GetEdge OffsetB AngleB +AddOffset yB add /yB1 ED xB add /xB1 ED } def +/GetArmA { ArmTypeA 0 eq { /xA2 ArmA AngleA cos mul xA1 add def /yA2 ArmA +AngleA sin mul yA1 add def } { ArmTypeA 1 eq {{exch}} {{}} ifelse /Do ED +ArmA AngleA XYPos OffsetA AngleA AddOffset yA add /yA2 ED xA add /xA2 ED +} ifelse } def +/GetArmB { ArmTypeB 0 eq { /xB2 ArmB AngleB cos mul xB1 add def /yB2 ArmB +AngleB sin mul yB1 add def } { ArmTypeB 1 eq {{exch}} {{}} ifelse /Do ED +ArmB AngleB XYPos OffsetB AngleB AddOffset yB add /yB2 ED xB add /xB2 ED +} ifelse } def +/InitNC { /b ED /a ED /NodeSepTypeB ED /NodeSepTypeA ED /NodeSepB ED +/NodeSepA ED /OffsetB ED /OffsetA ED tx@NodeDict a known tx@NodeDict b +known and dup { /NodeA a load def /NodeB b load def NodeA GetCenter /yA +ED /xA ED NodeB GetCenter /yB ED /xB ED } if } def +/LPutLine { 4 copy 3 -1 roll sub neg 3 1 roll sub Atan /NAngle ED 1 t sub +mul 3 1 roll 1 t sub mul 4 1 roll t mul add /Y ED t mul add /X ED } def +/LPutLines { mark LPutVar counttomark 2 div 1 sub /n ED t floor dup n gt +{ pop n 1 sub /t 1 def } { dup t sub neg /t ED } ifelse cvi 2 mul { pop +} repeat LPutLine cleartomark } 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 /NAngle ED /Y ED /X ED } def +/HPosBegin { yB yA ge { /t 1 t sub def } if /Y yB yA sub t mul yA add def +} def +/HPosEnd { /X Y yyA sub yyB yyA sub Div xxB xxA sub mul xxA add def +/NAngle yyB yyA sub xxB xxA sub Atan def } def +/HPutLine { HPosBegin /yyA ED /xxA ED /yyB ED /xxB ED HPosEnd } def +/HPutLines { HPosBegin yB yA ge { /check { le } def } { /check { ge } def +} ifelse /xxA xA def /yyA yA def mark xB yB LPutVar { dup Y check { exit +} { /yyA ED /xxA ED } ifelse } loop /yyB ED /xxB ED cleartomark HPosEnd +} def +/VPosBegin { xB xA lt { /t 1 t sub def } if /X xB xA sub t mul xA add def +} def +/VPosEnd { /Y X xxA sub xxB xxA sub Div yyB yyA sub mul yyA add def +/NAngle yyB yyA sub xxB xxA sub Atan def } def +/VPutLine { VPosBegin /yyA ED /xxA ED /yyB ED /xxB ED VPosEnd } def +/VPutLines { VPosBegin xB xA ge { /check { le } def } { /check { ge } def +} ifelse /xxA xA def /yyA yA def mark xB yB LPutVar { 1 index X check { +exit } { /yyA ED /xxA ED } ifelse } loop /yyB ED /xxB ED cleartomark +VPosEnd } def +/HPutCurve { gsave newpath /SaveLPutVar /LPutVar load def LPutVar 8 -2 +roll moveto curveto flattenpath /LPutVar [ {} {} {} {} pathforall ] cvx +def grestore exec /LPutVar /SaveLPutVar load def } def +/NCCoor { /AngleA yB yA sub xB xA sub Atan def /AngleB AngleA 180 add def +GetEdgeA GetEdgeB /LPutVar [ xB1 yB1 xA1 yA1 ] cvx def /LPutPos { +LPutVar LPutLine } def /HPutPos { LPutVar HPutLine } def /VPutPos { +LPutVar VPutLine } def LPutVar } def +/NCLine { NCCoor tx@Dict begin ArrowA CP 4 2 roll ArrowB lineto pop pop +end } def +/NCLines { false NArray n 0 eq { NCLine } { 2 copy yA sub exch xA sub +Atan /AngleA ED n 2 mul dup index exch index yB sub exch xB sub Atan +/AngleB ED GetEdgeA GetEdgeB /LPutVar [ xB1 yB1 n 2 mul 4 add 4 roll xA1 +yA1 ] cvx def mark LPutVar tx@Dict begin false Line end /LPutPos { +LPutLines } def /HPutPos { HPutLines } def /VPutPos { VPutLines } def } +ifelse } def +/NCCurve { GetEdgeA GetEdgeB xA1 xB1 sub yA1 yB1 sub Pyth 2 div dup 3 -1 +roll mul /ArmA ED mul /ArmB ED /ArmTypeA 0 def /ArmTypeB 0 def GetArmA +GetArmB xA2 yA2 xA1 yA1 tx@Dict begin ArrowA end xB2 yB2 xB1 yB1 tx@Dict +begin ArrowB end curveto /LPutVar [ xA1 yA1 xA2 yA2 xB2 yB2 xB1 yB1 ] +cvx def /LPutPos { t LPutVar BezierMidpoint } def /HPutPos { { HPutLines +} HPutCurve } def /VPutPos { { VPutLines } HPutCurve } def } def +/NCAngles { GetEdgeA GetEdgeB GetArmA GetArmB /mtrx AngleA matrix rotate +def xA2 yA2 mtrx transform pop xB2 yB2 mtrx transform exch pop mtrx +itransform /y0 ED /x0 ED mark ArmB 0 ne { xB1 yB1 } if xB2 yB2 x0 y0 xA2 +yA2 ArmA 0 ne { xA1 yA1 } if tx@Dict begin false Line end /LPutVar [ xB1 +yB1 xB2 yB2 x0 y0 xA2 yA2 xA1 yA1 ] cvx def /LPutPos { LPutLines } def +/HPutPos { HPutLines } def /VPutPos { VPutLines } def } def +/NCAngle { GetEdgeA GetEdgeB GetArmB /mtrx AngleA matrix rotate def xB2 +yB2 mtrx itransform pop xA1 yA1 mtrx itransform exch pop mtrx transform +/y0 ED /x0 ED mark ArmB 0 ne { xB1 yB1 } if xB2 yB2 x0 y0 xA1 yA1 +tx@Dict begin false Line end /LPutVar [ xB1 yB1 xB2 yB2 x0 y0 xA1 yA1 ] +cvx def /LPutPos { LPutLines } def /HPutPos { HPutLines } def /VPutPos { +VPutLines } def } def +/NCBar { GetEdgeA GetEdgeB GetArmA GetArmB /mtrx AngleA matrix rotate def +xA2 yA2 mtrx itransform pop xB2 yB2 mtrx itransform pop sub dup 0 mtrx +transform 3 -1 roll 0 gt { /yB2 exch yB2 add def /xB2 exch xB2 add def } +{ /yA2 exch neg yA2 add def /xA2 exch neg xA2 add def } ifelse mark ArmB +0 ne { xB1 yB1 } if xB2 yB2 xA2 yA2 ArmA 0 ne { xA1 yA1 } if tx@Dict +begin false Line end /LPutVar [ xB1 yB1 xB2 yB2 xA2 yA2 xA1 yA1 ] cvx +def /LPutPos { LPutLines } def /HPutPos { HPutLines } def /VPutPos { +VPutLines } def } def +/NCDiag { GetEdgeA GetEdgeB GetArmA GetArmB mark ArmB 0 ne { xB1 yB1 } if +xB2 yB2 xA2 yA2 ArmA 0 ne { xA1 yA1 } if tx@Dict begin false Line end +/LPutVar [ xB1 yB1 xB2 yB2 xA2 yA2 xA1 yA1 ] cvx def /LPutPos { +LPutLines } def /HPutPos { HPutLines } def /VPutPos { VPutLines } def } +def +/NCDiagg { GetEdgeA GetArmA yB yA2 sub xB xA2 sub Atan 180 add /AngleB ED +GetEdgeB mark xB1 yB1 xA2 yA2 ArmA 0 ne { xA1 yA1 } if tx@Dict begin +false Line end /LPutVar [ xB1 yB1 xA2 yA2 xA1 yA1 ] cvx def /LPutPos { +LPutLines } def /HPutPos { HPutLines } def /VPutPos { VPutLines } def } +def +/NCLoop { GetEdgeA GetEdgeB GetArmA GetArmB /mtrx AngleA matrix rotate +def xA2 yA2 mtrx transform loopsize add /yA3 ED /xA3 ED /xB3 xB2 yB2 +mtrx transform pop def xB3 yA3 mtrx itransform /yB3 ED /xB3 ED xA3 yA3 +mtrx itransform /yA3 ED /xA3 ED mark ArmB 0 ne { xB1 yB1 } if xB2 yB2 +xB3 yB3 xA3 yA3 xA2 yA2 ArmA 0 ne { xA1 yA1 } if tx@Dict begin false +Line end /LPutVar [ xB1 yB1 xB2 yB2 xB3 yB3 xA3 yA3 xA2 yA2 xA1 yA1 ] +cvx def /LPutPos { LPutLines } def /HPutPos { HPutLines } def /VPutPos { +VPutLines } def } def +/NCCircle { NodeSepA 0 NodeA 0 GetEdge pop 2 div dup 2 exp r r mul sub +abs sqrt atan 2 mul /a ED r AngleA 90 add PtoC yA add exch xA add exch 2 +copy /LPutVar [ 4 2 roll r AngleA ] cvx def /LPutPos { LPutVar t 360 mul +add dup 5 1 roll 90 sub PtoC 3 -1 roll add /Y ED add /X ED /NAngle ED } +def /HPutPos { LPutPos } def /VPutPos { LPutPos } def r AngleA 90 sub a +add AngleA 270 add a sub tx@Dict begin /angleB ED /angleA ED /r ED /c +57.2957 r Div def /y ED /x ED } def +/NCBox { /d ED /h ED /AngleB yB yA sub xB xA sub Atan def /AngleA AngleB +180 add def GetEdgeA GetEdgeB /dx d AngleB sin mul def /dy d AngleB cos +mul neg def /hx h AngleB sin mul neg def /hy h AngleB cos mul def +/LPutVar [ xA1 hx add yA1 hy add xB1 hx add yB1 hy add xB1 dx add yB1 dy +add xA1 dx add yA1 dy add ] cvx def /LPutPos { LPutLines } def /HPutPos +{ xB yB xA yA LPutLine } def /VPutPos { HPutPos } def mark LPutVar +tx@Dict begin false Polygon end } def +/NCArcBox { /l ED neg /d ED /h ED /a ED /AngleA yB yA sub xB xA sub Atan +def /AngleB AngleA 180 add def /tA AngleA a sub 90 add def /tB tA a 2 +mul add def /r xB xA sub tA cos tB cos sub Div dup 0 eq { pop 1 } if def +/x0 xA r tA cos mul add def /y0 yA r tA sin mul add def /c 57.2958 r div +def /AngleA AngleA a sub 180 add def /AngleB AngleB a add 180 add def +GetEdgeA GetEdgeB /AngleA tA 180 add yA yA1 sub xA xA1 sub Pyth c mul +sub def /AngleB tB 180 add yB yB1 sub xB xB1 sub Pyth c mul add def l 0 +eq { x0 y0 r h add AngleA AngleB arc x0 y0 r d add AngleB AngleA arcn } +{ x0 y0 translate /tA AngleA l c mul add def /tB AngleB l c mul sub def +0 0 r h add tA tB arc r h add AngleB PtoC r d add AngleB PtoC 2 copy 6 2 +roll l arcto 4 { pop } repeat r d add tB PtoC l arcto 4 { pop } repeat 0 +0 r d add tB tA arcn r d add AngleA PtoC r h add AngleA PtoC 2 copy 6 2 +roll l arcto 4 { pop } repeat r h add tA PtoC l arcto 4 { pop } repeat } +ifelse closepath /LPutVar [ x0 y0 r AngleA AngleB h d ] cvx def /LPutPos +{ LPutVar /d ED /h ED /AngleB ED /AngleA ED /r ED /y0 ED /x0 ED t 1 le { +r h add AngleA 1 t sub mul AngleB t mul add dup 90 add /NAngle ED PtoC } +{ t 2 lt { /NAngle AngleB 180 add def r 2 t sub h mul t 1 sub d mul add +add AngleB PtoC } { t 3 lt { r d add AngleB 3 t sub mul AngleA 2 t sub +mul add dup 90 sub /NAngle ED PtoC } { /NAngle AngleA 180 add def r 4 t +sub d mul t 3 sub h mul add add AngleA PtoC } ifelse } ifelse } ifelse +y0 add /Y ED x0 add /X ED } def /HPutPos { LPutPos } def /VPutPos { +LPutPos } def } def +/Tfan { /AngleA yB yA sub xB xA sub Atan def GetEdgeA w xA1 xB sub yA1 yB +sub Pyth Pyth w Div CLW 2 div mul 2 div dup AngleA sin mul yA1 add /yA1 +ED AngleA cos mul xA1 add /xA1 ED /LPutVar [ xA1 yA1 m { xB w add yB xB +w sub yB } { xB yB w sub xB yB w add } ifelse xA1 yA1 ] cvx def /LPutPos +{ LPutLines } def /VPutPos@ { LPutVar flag { 8 4 roll pop pop pop pop } +{ pop pop pop pop 4 2 roll } ifelse } def /VPutPos { VPutPos@ VPutLine } +def /HPutPos { VPutPos@ HPutLine } def mark LPutVar tx@Dict begin +/ArrowA { moveto } def /ArrowB { } def false Line closepath end } def +/LPutCoor { NAngle tx@Dict begin /NAngle ED end gsave CM STV CP Y sub neg +exch X sub neg exch moveto setmatrix CP grestore } def +/LPut { tx@NodeDict /LPutPos known { LPutPos } { CP /Y ED /X ED /NAngle 0 +def } ifelse LPutCoor } def +/HPutAdjust { Sin Cos mul 0 eq { 0 } { d Cos mul Sin div flag not { neg } +if h Cos mul Sin div flag { neg } if 2 copy gt { pop } { exch pop } +ifelse } ifelse s add flag { r add neg } { l add } ifelse X add /X ED } +def +/VPutAdjust { Sin Cos mul 0 eq { 0 } { l Sin mul Cos div flag { neg } if +r Sin mul Cos div flag not { neg } if 2 copy gt { pop } { exch pop } +ifelse } ifelse s add flag { d add } { h add neg } ifelse Y add /Y ED } +def +end diff --git a/usergrps/uktug/baskervi/6_2/spqr/pst-node.sty b/usergrps/uktug/baskervi/6_2/spqr/pst-node.sty new file mode 100644 index 0000000000..44be47495f --- /dev/null +++ b/usergrps/uktug/baskervi/6_2/spqr/pst-node.sty @@ -0,0 +1,4 @@ +%% BEGIN pst-node.sty +\input pst-node.tex +\endinput +%% END pst-node.sty diff --git a/usergrps/uktug/baskervi/6_2/spqr/pst-node.tex b/usergrps/uktug/baskervi/6_2/spqr/pst-node.tex new file mode 100644 index 0000000000..9322b44c43 --- /dev/null +++ b/usergrps/uktug/baskervi/6_2/spqr/pst-node.tex @@ -0,0 +1,1079 @@ +%% BEGIN: pst-node.tex +%% Generated on <1994/6/7> from `pst-node.doc'. +%% For use with the PostScript header file `pst-node.pro'. +%% +\def\fileversion{0.94-beta, width DG fixes} +\def\filedate{96/01/01} +%% +%% 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. +%% +\message{ v\fileversion, \filedate} +\csname PSTnodesLoaded\endcsname +\let\PSTnodesLoaded\endinput +\ifx\PSTricksLoaded\endinput\else\input pstricks.tex\fi\relax +\edef\TheAtCode{\the\catcode`\@} +\catcode`\@=11 +\pstheader{pst-node.pro} +\def\pst@nodedict{tx@NodeDict begin } +\def\pst@zapspace#1 #2{% +#1% +\ifx#2\@empty\else\expandafter\pst@zapspace\fi +#2} +\def\pst@getnode#1#2{% +\pst@expandafter\pst@@getnode{#1},,\@nil#2} +\def\pst@@getnode#1,#2,#3\@nil#4{% +\ifx\@empty#3\@empty +\edef#4{/N@\pst@zapspace#1 \@empty\space}% +\else +\pst@cntg=#1\relax +\pst@cnth=#2\relax +\edef#4{/N@M-\ifnum\psmatrixcnt=\z@ 1\else\the\psmatrixcnt\fi +-\the\pst@cntg-\the\pst@cnth\space}% +\fi} +\def\tx@NewNode{NewNode } +\def\pst@newnode#1#2#3#4{% +\leavevmode +\pst@getnode{#1}\pst@thenode +\pst@Verb{% +\pst@nodedict +{#3} +\ifx\psk@name\relax false \else \psk@name true \fi +\pst@thenode +#2 +{#4} +\tx@NewNode +end}% +\global\let\psk@name\relax +\pstree@nodehook +\global\let\pstree@nodehook\relax} +\let\pstree@nodehook\relax +\newif\ifnodealign +\def\psset@nodealign#1{\@nameuse{nodealign#1}} +\psset@nodealign{false} +\def\pst@nodealign{% +\pst@dimg=\ht\pst@hbox +\advance\pst@dimg-\dp\pst@hbox +\divide\pst@dimg2 +\lower\pst@dimg} +\def\tx@InitPnode{InitPnode } +\def\pnode{\@ifnextchar({\pnode@}{\pnode@(0,0)}} +\def\pnode@(#1)#2{% +\pst@@getcoor{#1}% +\pst@newnode{#2}{10}{\pst@coor}{\tx@InitPnode}% +\ignorespaces} +\def\tx@InitCnode{InitCnode } +\def\cnode{\pst@object{cnode}} +\def\cnode@i{\@ifnextchar({\cnode@ii}{\cnode@ii(0,0)}} +\def\cnode@ii(#1)#2#3{% +\leavevmode +\hbox{% +\use@par +\pst@@getcoor{#1}% +\pssetlength\pst@dimc{#2}% +\pst@dimg=\psk@dimen\pslinewidth +\advance\pst@dimc-\pst@dimg +\advance\pst@dimc.5\pslinewidth +\ifnodealign +\kern\pst@dimc +\vrule width\z@ height \pst@dimc depth \pst@dimc +\fi +\pscircle@do(#1){#2}% +\pst@newnode{#3}{11}{\pst@coor \pst@number\pst@dimc}{\tx@InitCnode}% +\ifnodealign \kern\pst@dimc\egroup \fi}% +\ignorespaces} +\def\Cnode{\pst@object{Cnode}} +\def\Cnode@i{\@ifnextchar({\Cnode@ii}{\Cnode@ii(0,0)}} +\def\Cnode@ii(#1)#2{\cnode@ii(#1){\psk@radius}{#2}}% +\def\cnodeput{\pst@object{cnodeput}} +\def\cnodeput@i{\@ifnextchar({\cnodeput@iii}{\cnodeput@ii}} +\def\cnodeput@ii#1{% +\addto@par{rot={#1}}% +\@ifnextchar({\cnodeput@iii}{\cnodeput@iii(\z@,\z@)}} +\def\cnodeput@iii(#1)#2{% +\pst@killglue +\@fixedradiusfalse +\def\pst@nodehook{\cnodeput@iv{#2}}% +\pst@makebox{\cput@v{#1}}} +\def\cnodeput@iv#1{% +\pst@newnode{#1}{11}{\pscirclebox@iv \pst@number\pslinewidth add}% +{\tx@InitCnode}% +\global\let\pst@nodehook\relax} +\def\Cnodeput{\pst@object{Cnodeput}} +\def\Cnodeput@i{\@ifnextchar({\Cnodeput@iii}{\Cnodeput@ii}} +\def\Cnodeput@ii#1{% +\addto@par{rot={#1}}% +\@ifnextchar({\Cnodeput@iii}{\Cnodeput@iii(\z@,\z@)}} +\def\Cnodeput@iii(#1)#2{% +\pst@killglue +\@fixedradiustrue +\def\pst@nodehook{\Cnodeput@iv{#2}}% +\pst@makebox{\cput@iv{#1}}} +\def\Cnodeput@iv#1{% +\pst@newnode{#1}{11}{% +\pst@number{\wd\pst@hbox} 2 div \pst@number\pst@dima % x y +\pst@number\pst@dimb \pst@number\pslinewidth \psk@dimen .5 sub mul sub }% r +{\tx@InitCnode}% +\global\let\pst@nodehook\relax} +\def\circlenode{\pst@object{circlenode}} +\def\circlenode@i#1{\pst@makebox{\circlenode@ii{#1}}} +\def\circlenode@ii#1{% +\begingroup +\pst@useboxpar +\setbox\pst@hbox=\hbox{% +\cnodeput@iv{#1}% +\pscirclebox@iii +\box\pst@hbox}% +\ifnodealign \psboxseptrue \fi +\ifpsboxsep \pscirclebox@sep \fi +\leavevmode +\ifnodealign\pst@nodealign\fi +\box\pst@hbox +\endgroup} +\def\Circlenode{\pst@object{Circlenode}} +\def\Circlenode@i#1{\pst@makebox{\Circlenode@ii{#1}}} +\def\Circlenode@ii#1{% +\begingroup +\pst@useboxpar +\pst@dima=\ht\pst@hbox +\advance\pst@dima\dp\pst@hbox +\divide\pst@dima\tw@ +\pssetlength\pst@dimb\psk@radius +\setbox\pst@hbox=\hbox{% +\Cnodeput@iv{#1}% +\pscircle(.5\wd\pst@hbox,\pst@dima){\pst@dimb}% +\box\pst@hbox}% +\ifnodealign \psboxseptrue \fi +\ifpsboxsep \psCirclebox@sep \fi +\leavevmode +\ifnodealign\pst@nodealign\fi +\box\pst@hbox +\endgroup} +\def\tx@GetRnodePos{GetRnodePos } +\def\tx@InitRnode{InitRnode } +\def\rnode{\@ifnextchar[{\rnode@i}{\def\pst@par{}\rnode@ii}} +\def\rnode@i[#1]{\def\pst@par{ref=#1}\rnode@ii} +\def\rnode@ii#1{\pst@makebox{\rnode@iii\rnode@iv{#1}}} +\def\rnode@iii#1#2{% +\begingroup +#1% +\if@star\pst@starbox\fi +\ifnodealign\lower\pst@dimb\fi +\hbox{% +\pst@newnode{#2}{16}{% +\pst@number{\ht\pst@hbox}% +\pst@number{\dp\pst@hbox}% +\pst@number{\wd\pst@hbox}% +\pst@number\pst@dima +\pst@number\pst@dimb}% +{\tx@InitRnode}% +\box\pst@hbox}% +\endgroup} +\def\rnode@iv{% +\pst@dima=\psk@xref\wd\pst@hbox +\ifx\psk@yref\relax +\pst@dimb=\z@ +\else +\pst@dimb=\ht\pst@hbox +\advance\pst@dimb\dp\pst@hbox +\pst@dimb=\psk@yref\pst@dimb +\advance\pst@dimb-\dp\pst@hbox +\fi} +\def\psset@href#1{\pst@checknum{#1}\psk@href} +\psset@href{0} +\def\psset@vref#1{\def\psk@vref{#1}} +\psset@vref{.7ex} +\def\Rnode{\pst@object{Rnode}} +\def\Rnode@i#1{\pst@makebox{\rnode@iii\Rnode@ii{#1}}} +\def\Rnode@ii{% +\pst@dima=\psk@href\wd\pst@hbox +\advance\pst@dima\wd\pst@hbox +\divide\pst@dima 2 +\pssetlength\pst@dimb{\psk@vref}} +\def\tx@DiaNodePos{DiaNodePos } +\def\dianode{\pst@object{dianode}} +\def\dianode@i#1{\pst@makebox{\dianode@ii{#1}}} +\def\dianode@ii#1{% +\begingroup +\pst@useboxpar +\psdiabox@iii +\setbox\pst@hbox=\hbox{% +\pst@newnode{#1}{14}{}{% +/X \pst@number\pst@dima def +/Y \pst@number\pst@dimb def +/w \pst@number\pst@dimc 2 mul def +/h \pst@number\pst@dimd 2 mul def +/NodePos { \tx@DiaNodePos } def}% +\box\pst@hbox}% +\ifnodealign\psboxseptrue\fi +\ifpsboxsep\psdiabox@sep\fi +\ifnodealign\lower\pst@dimb\fi +\box\pst@hbox +\endgroup} +\def\tx@TriNodePos{TriNodePos } +\def\tx@InitTriNode{InitTriNode } +\def\trinode{\pst@object{trinode}} +\def\trinode@i#1{\pst@makebox{\trinode@ii{#1}}} +\def\trinode@ii#1{% +\begingroup +\pst@useboxpar +\pstribox@iii +\setbox\pst@hbox=\hbox{% +\pst@newnode{#1}{14}{}{% +\pst@number\pst@dimc +\pst@number\pst@dimd +\ifodd\psk@trimode +exch +\pst@number\pst@dima +\else +\pst@number\pst@dimb +\fi +\psk@trimode +\pst@number{\wd\pst@hbox}% +\pst@number{\ht\pst@hbox}% +\pst@number{\dp\pst@hbox}% +\tx@InitTriNode}% +\box\pst@hbox}% +\ifnodealign\psboxseptrue\fi +\ifpsboxsep\pstribox@sep\fi +\ifnodealign\lower\pst@tempa\fi +\box\pst@hbox +\endgroup} +\def\tx@OvalNodePos{OvalNodePos } +\def\ovalnode{\pst@object{ovalnode}} +\def\ovalnode@i#1{\pst@makebox{\ovalnode@ii{#1}}} +\def\ovalnode@ii#1{% +\begingroup +\pst@useboxpar +\psovalbox@iii +\setbox\pst@hbox=\hbox{% +\pst@newnode{#1}{14}{}{% +/X \pst@number\pst@dima def +/Y \pst@number\pst@dimb def +/w \pst@number\pst@dimc def +/h \pst@number\pst@dimd def +/NodePos { \tx@OvalNodePos } def}% +\unhbox\pst@hbox}% +\ifnodealign\psboxseptrue\fi +\ifpsboxsep\psovalbox@sep\fi +\ifnodealign\lower\pst@dimb\fi +\box\pst@hbox +\endgroup} +\def\dotnode{\pst@object{dotnode}} +\def\dotnode@i{\@ifnextchar({\dotnode@ii}{\dotnode@ii(\z@,\z@)}} +\def\dotnode@ii(#1)#2{% +\leavevmode +\hbox{% +\use@par +\pst@@getcoor{#1}% +\pst@getdotsize +\pstree@nodehook +\ifnodealign +\pst@dima=\pst@dimg +\kern\pst@dima +\vrule width\z@ height \pst@dimh depth \pst@dimh +\fi +\pst@newnode{#2}{14}{}{% +\pst@coor +/Y ED /X ED +/w \pst@number\pst@dimg def +/h \pst@number\pst@dimh def +/NodePos { \tx@OvalNodePos } def}% +\psdot@ii(#1)% +\ifnodealign\kern\pst@dima\fi}% +\ignorespaces} +\def\psset@framesize#1{\pst@expandafter\psset@@framesize{#1} \@nil} +\def\psset@@framesize#1 #2\@nil{% +\pssetlength\pst@dimg{#1}% +\divide\pst@dimg2 +\edef\psk@framewidth{\pst@number\pst@dimg}% +\ifx\@empty#2\@empty +\let\psk@frameheight\psk@framewidth +\else +\pssetlength\pst@dimg{#2}% +\divide\pst@dimg2 +\edef\psk@frameheight{\pst@number\pst@dimg}% +\fi} +\psset@framesize{10pt} +\def\fnode{\pst@object{fnode}} +\def\fnode@i{\@ifnextchar({\fnode@ii}{\fnode@ii(\z@,\z@)}} +\def\fnode@ii(#1)#2{% +\leavevmode +\pst@killglue +\hbox{% +\use@par +\begin@ClosedObj +\ifnodealign +\kern\psk@framewidth\p@ +\vrule width\z@ height \psk@frameheight\p@ depth \psk@frameheight\p@ +\edef\pst@coor{0 0 }% +\else +\pst@@getcoor{#1}% +\fi +\pst@newnode{#2}{14}{}{% +\pst@coor +/Y ED /X ED +/d \psk@dimen .5 sub CLW mul neg def +/r \psk@framewidth d add def +/l r neg def +/u \psk@frameheight d add def +/d u neg def +/NodePos { \tx@GetRnodePos } def}% +\addto@pscode{% +/x2 \psk@framewidth CLW \psk@dimen mul sub def +/y2 \psk@frameheight CLW \psk@dimen mul sub def +\pst@coor 2 copy +y2 sub /y1 ED +x2 sub /x1 ED +y2 add /y2 ED +x2 add /x2 ED +\psk@cornersize +1 index 0 eq { pop pop \tx@Rect } { \tx@OvalFrame } ifelse}% +\def\pst@linetype{2}% +\showpointsfalse +\end@ClosedObj +\ifnodealign\kern\psk@framewidth\p@\fi}% +\ignorespaces} +\def\psset@nodesepA#1{% +\pst@getlength{#1}\psk@nodesepA +\def\psk@nodeseptypeA{0 }} +\def\psset@nodesepB#1{% +\pst@getlength{#1}\psk@nodesepB +\def\psk@nodeseptypeB{0 }} +\def\psset@nodesep#1{% +\pst@getlength{#1}\psk@nodesepA +\let\psk@nodesepB\psk@nodesepA +\def\psk@nodeseptypeA{0 }% +\def\psk@nodeseptypeB{0 }} +\psset@nodesep{0pt} +\def\psset@XnodesepA#1{% +\pst@getlength{#1}\psk@nodesepA +\def\psk@nodeseptypeA{1 }} +\def\psset@XnodesepB#1{% +\pst@getlength{#1}\psk@nodesepB +\def\psk@nodeseptypeB{1 }} +\def\psset@Xnodesep#1{% +\pst@getlength{#1}\psk@nodesepA +\let\psk@nodesepB\psk@nodesepA +\def\psk@nodeseptypeA{1 }% +\def\psk@nodeseptypeB{1 }} +\def\psset@YnodesepA#1{% +\pst@getlength{#1}\psk@nodesepA +\def\psk@nodeseptypeA{2 }} +\def\psset@YnodesepB#1{% +\pst@getlength{#1}\psk@nodesepB +\def\psk@nodeseptypeB{2 }} +\def\psset@Ynodesep#1{% +\pst@getlength{#1}\psk@nodesepA +\let\psk@nodesepB\psk@nodesepA +\def\psk@nodeseptypeA{2 }% +\def\psk@nodeseptypeB{2 }} +\def\psset@armA#1{% +\pst@getlength{#1}\psk@armA +\def\psk@armtypeA{0 }} +\def\psset@armB#1{% +\pst@getlength{#1}\psk@armB +\def\psk@armtypeB{0 }} +\def\psset@arm#1{% +\pst@getlength{#1}\psk@armA +\let\psk@armB\psk@armA +\def\psk@armtypeA{0 }% +\def\psk@armtypeB{0 }} +\psset@arm{10pt} +\def\psset@XarmA#1{% +\pst@getlength{#1}\psk@armA +\def\psk@armtypeA{1 }} +\def\psset@XarmB#1{% +\pst@getlength{#1}\psk@armB +\def\psk@armtypeB{1 }} +\def\psset@Xarm#1{% +\pst@getlength{#1}\psk@armA +\let\psk@armB\psk@armA +\def\psk@armtypeA{1 }% +\def\psk@armtypeB{1 }} +\def\psset@YarmA#1{% +\pst@getlength{#1}\psk@armA +\def\psk@armtypeA{2 }} +\def\psset@YarmB#1{% +\pst@getlength{#1}\psk@armB +\def\psk@armtypeB{2 }} +\def\psset@Yarm#1{% +\pst@getlength{#1}\psk@armA +\let\psk@armB\psk@armA +\def\psk@armtypeA{2 }% +\def\psk@armtypeB{2 }} +\def\psset@offsetA#1{\pst@getlength{#1}\psk@offsetA} +\def\psset@offsetB#1{\pst@getlength{#1}\psk@offsetB} +\def\psset@offset#1{\psset@offsetA{#1}\let\psk@offsetB\psk@offsetA} +\psset@offset{0pt} +\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} +\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} +\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} +\def\tx@GetCenter{GetCenter } +\def\tx@XYPos{XYPos } +\def\tx@GetEdge{GetEdge } +\def\tx@AddOffset{AddOffset } +\def\tx@GetEdgeA{GetEdgeA } +\def\tx@GetEdgeB{GetEdgeB } +\def\tx@GetArmA{GetArmA } +\def\tx@GetArmB{GetArmB } +\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} +\def\tx@InitNC{InitNC } +\def\nc@object#1#2#3#4#5{% +\csname begin@#1Obj\endcsname +\showpointsfalse +\pst@getnode{#2}\pst@tempa +\pst@getnode{#3}\pst@tempb +\gdef\npos@default{#4 }% +\addto@pscode{% +/NCLW CLW def +\pst@nodedict +\psk@offsetA +\psk@offsetB neg +\psk@nodesepA +\psk@nodesepB +\psk@nodeseptypeA +\psk@nodeseptypeB +\pst@tempa +\pst@tempb +\tx@InitNC { #5 } if +end}% +\def\use@pscode{% +\pst@Verb{gsave \tx@STV newpath \pst@code\space grestore}% +\gdef\pst@code{}}% +\csname end@#1Obj\endcsname +\pst@shortput} +\def\npos@default{.5 } +\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}} +\def\tx@LPutLine{LPutLine } +\def\tx@LPutLines{LPutLines } +\def\tx@BezierMidpoint{BezierMidpoint } +\def\tx@HPosBegin{HPosBegin } +\def\tx@HPosEnd{HPosEnd } +\def\tx@HPutLine{HPutLine } +\def\tx@HPutLines{HPutLines } +\def\tx@VPosBegin{VPosBegin } +\def\tx@VPosEnd{VPosEnd } +\def\tx@VPutLine{VPutLine } +\def\tx@VPutLines{VPutLines } +\def\tx@HPutCurve{HPutCurve } +\def\tx@NCCoor{NCCoor } +\def\tx@NCLine{NCLine } +\def\ncline{\pst@object{ncline}} +\def\ncline@i{\check@arrow{\ncline@ii}} +\def\ncline@ii#1#2{\nc@object{Open}{#1}{#2}{.5}{\tx@NCLine}} +\def\pcline{\pst@object{pcline}} +\def\pcline@i{\pc@object\ncline@ii} +\def\ncLine{\pst@object{ncLine}} +\def\ncLine@i{\check@arrow{\ncLine@ii}} +\def\ncLine@ii#1#2{\nc@object{Open}{#1}{#2}{.5}% +{\tx@NCLine /LPutPos { xB xA yB yA \tx@LPutLine } def}} +\def\tx@NCLines{NCLines } +\def\nclines{\pst@object{nclines}} +\def\nclines@i{\check@arrow\nclines@ii} +\def\nclines@ii#1#2{% +\begingroup +\use@par +\def\pst@aftercoors{\nclines@iii{#1}{#2}}% +\def\pst@coors{}% +\pst@@getcoors} +\def\nclines@iii#1#2{% +\nc@object{Open}{#1}{#2}{.5}{% +tx@Dict begin \psline@iii pop end +mark \pst@coors \tx@NCLines}% +\endgroup +\ignorespaces} +\def\tx@NCCurve{NCCurve } +\def\nccurve{\pst@object{nccurve}} +\def\nccurve@i{\check@arrow{\nccurve@ii}} +\def\nccurve@ii#1#2{\nc@object{Open}{#1}{#2}{.5}{% +/AngleA \psk@angleA\space def /AngleB \psk@angleB\space def +\psk@ncurvB\space \psk@ncurvA\space +\tx@NCCurve}} +\def\pccurve{\pst@object{pccurve}} +\def\pccurve@i{\pc@object\nccurve@ii} +\def\ncarc{\pst@object{ncarc}} +\def\ncarc@i{\check@arrow{\ncarc@ii}} +\def\ncarc@ii#1#2{\nc@object{Open}{#1}{#2}{.5}{% +yB yA sub xB xA sub \tx@Atan dup +\psk@arcangleA\space add /AngleA ED +\psk@arcangleB\space sub 180 add /AngleB ED +\psk@ncurvB\space \psk@ncurvA\space +\tx@NCCurve}} +\def\pcarc{\pst@object{pcarc}} +\def\pcarc@i{\pc@object\ncarc@ii} +\def\tx@NCAngles{NCAngles } +\def\ncangles{\pst@object{ncangles}} +\def\ncangles@i{\check@arrow{\ncangles@ii}} +\def\ncangles@ii#1#2{% +\nc@object{Open}{#1}{#2}{1.5}{\ncangles@iii \tx@NCAngles}} +\def\ncangles@iii{% +tx@Dict begin \psline@iii pop end +/AngleA \psk@angleA def +/AngleB \psk@angleB def +/ArmA \psk@armA def +/ArmB \psk@armB def +/ArmTypeA \psk@armtypeA def +/ArmTypeB \psk@armtypeB def } +\def\pcangles{\pst@object{pcangles}} +\def\pcangles@i{\pc@object\ncangles@ii} +\def\tx@NCAngle{NCAngle } +\def\ncangle{\pst@object{ncangle}} +\def\ncangle@i{\check@arrow{\ncangle@ii}} +\def\ncangle@ii#1#2{% +\nc@object{Open}{#1}{#2}{1.5}{\ncangles@iii \tx@NCAngle}} +\def\pcangle{\pst@object{pcangle}} +\def\pcangle@i{\pc@object\ncangle@ii} +\def\tx@NCBar{NCBar } +\def\ncbar{\pst@object{ncbar}} +\def\ncbar@i{\check@arrow{\ncbar@ii}} +\def\ncbar@ii#1#2{\nc@object{Open}{#1}{#2}{1.5}{% +\ncangles@iii /AngleB \psk@angleA def \tx@NCBar}} +\def\pcbar{\pst@object{pcbar}} +\def\pcbar@i{\pc@object\ncbar@ii} +\def\tx@NCDiag{NCDiag } +\def\ncdiag{\pst@object{ncdiag}} +\def\ncdiag@i{\check@arrow{\ncdiag@ii}} +\def\ncdiag@ii#1#2{% +\nc@object{Open}{#1}{#2}{1.5}{\ncangles@iii \tx@NCDiag}} +\def\pcdiag{\pst@object{pcdiag}} +\def\pcdiag@i{\pc@object\ncdiag@ii} +\def\tx@NCDiagg{NCDiagg } +\def\ncdiagg{\pst@object{ncdiagg}} +\def\ncdiagg@i{\check@arrow{\ncdiagg@ii}} +\def\ncdiagg@ii#1#2{% +\nc@object{Open}{#1}{#2}{.5}{\ncangles@iii \tx@NCDiagg}} +\def\pcdiagg{\pst@object{pcdiagg}} +\def\pcdiagg@i{\pc@object\ncdiagg@ii} +\def\tx@NCLoop{NCLoop } +\def\psset@loopsize#1{\pst@getlength{#1}\psk@loopsize} +\psset@loopsize{1cm} +\def\ncloop{\pst@object{ncloop}} +\def\ncloop@i{\check@arrow{\ncloop@ii}} +\def\ncloop@ii#1#2{% +\nc@object{Open}{#1}{#2}{2.5}% +{\ncangles@iii /loopsize \psk@loopsize def \tx@NCLoop}} +\def\pcloop{\pst@object{pcloop}} +\def\pcloop@i{\pc@object\ncloop@ii} +\def\tx@NCCircle{NCCircle } +\def\nccircle{\pst@object{nccircle}} +\def\nccircle@i{\check@arrow{\nccircle@ii}} +\def\nccircle@ii#1#2{% +\pssetlength\pst@dima{#2}% +\nc@object{Open}{#1}{#1}{.5}{% +/AngleA \psk@angleA def +/r \pst@number\pst@dima def +\tx@NCCircle \psarc@v end}} +\def\tx@NCBox{NCBox } +\def\ncbox{\pst@object{ncbox}} +\def\ncbox@i{\check@arrow{\ncbox@ii}} +\def\ncbox@ii#1#2{% +\def\pst@linetype{2}% +\nc@object{Closed}{#1}{#2}{.5}{% +tx@Dict begin \psline@iii pop end +\psk@boxheight \psk@boxdepth +\tx@NCBox}} +\def\pcbox{\pst@object{pcbox}} +\def\pcbox@i{\pc@object\ncbox@ii} +\def\tx@NCArcBox{NCArcBox } +\def\psset@boxheight#1{\pst@getlength{#1}\psk@boxheight} +\def\psset@boxdepth#1{\pst@getlength{#1}\psk@boxdepth} +\def\psset@boxsize#1{% +\psset@boxheight{#1}% +\let\psk@boxdepth\psk@boxheight} +\psset@boxsize{.4cm} +\def\ncarcbox{\pst@object{ncarcbox}} +\def\ncarcbox@i{\check@arrow{\ncarcbox@ii}} +\def\ncarcbox@ii#1#2{% +\def\pst@linetype{1}% +\nc@object{Closed}{#1}{#2}{.5}{% +\psk@arcangleA \psk@boxheight \psk@boxdepth \pst@number\pslinearc +\tx@NCArcBox}} +\def\pcarcbox{\pst@object{pcarcbox}} +\def\pcarcbox@i{\pc@object\ncarcbox@ii} +\def\tx@Tfan{Tfan } +\def\psset@nrot#1{% +\begingroup +\pst@expandafter{\@ifnextchar:{\psset@@nrot}{\psset@@rot}}{#1}\@nil +\global\let\pst@tempg\psk@rot +\endgroup +\let\psk@nrot\pst@tempg} +\def\psset@@nrot:#1\@nil{% +\psset@@rot#1\@nil +\edef\psk@rot{NAngle \ifx\psk@rot\@empty\else\psk@rot add \fi}} +\psset@nrot{0} +\def\tx@LPutCoor{LPutCoor } +\def\tx@LPut{LPut } +\def\psset@npos#1{% +\def\pst@tempa{#1}% +\ifx\pst@tempa\@empty +\def\psk@npos{\npos@default}% +\else +\pst@checknum{#1}\psk@npos +\fi} +\psset@npos{} +\def\ncput{\pst@object{ncput}} +\def\ncput@i{\pst@killglue\pst@makebox{\ncput@ii}} +\def\ncput@ii{% +\begingroup +\use@par +\if@star\pst@starbox\fi +\pst@makesmall\pst@hbox +\pst@rotate\psk@nrot\pst@hbox +\ncput@iii +\endgroup +\pst@shortput} +\def\ncput@iii{% +\leavevmode +\hbox{% +\pst@Verb{% +\pst@nodedict +/t \psk@npos def +\tx@LPut +end +\tx@PutBegin}% +\box\pst@hbox +\pst@Verb{\tx@PutEnd}}} +\def\naput{\pst@object{naput}} +\def\naput@i{\pst@killglue\pst@makebox{\naput@ii{NAngle 90 add}}} +\def\naput@ii#1{% +\begingroup +\use@par +\if@star\pst@starbox\fi +\def\psk@refangle{#1 }% +\let\psk@rot\psk@nrot +\uput@vii +{exch pop add a \tx@PtoC h1 add exch w1 add exch }% +{tx@Dict /NCLW known { NCLW add } if }% +\ncput@iii +\endgroup +\pst@shortput} +\def\nbput{\pst@object{nbput}} +\def\nbput@i{\pst@killglue\pst@makebox{\naput@ii{NAngle 90 sub}}} +\def\psset@tpos#1{% +\pst@checknum{#1}\psk@tpos +\ifdim\psk@tpos \p@<\z@ +\def\psk@tpos{.5}% +\@pstrickserr{Bad `tpos' value: `#1'. Must be 0\p@ +\def\psk@tpos{.5}% +\@pstrickserr{Bad `tpos' value: `#1'. Must be 0} +\def\MakeShortTab#1#2{% + \def\pst@shortput@tab{% + \def\pst@tempg{\next}% + \ifx#1\next + \def\pst@tempg{% + \@nameuse{% + t\ifodd\psk@treemode\ifpstreeflip b\else a\fi + \else\ifpstreeflip r\else l\fi\fi put}}% + \else + \ifx#2\next + \def\pst@tempg{% + \@nameuse{% + t\ifodd\psk@treemode\ifpstreeflip a\else b\fi + \else\ifpstreeflip l\else r\fi\fi put}}% + \else + \ifx\@sptoken\next + \let\pst@tempg\pst@shortput + \fi + \fi + \fi + \pst@tempg}} +\MakeShortTab{^}{_} +\def\psset@shortput#1{% +\def\pst@tempg{#1}% +\ifx\pst@tempg\@none +\let\pst@shortput\ignorespaces +\else +\@ifundefined{pst@shortput@#1}% +{\@pstrickserr{Bad short put: `#1'}\@ehpa}% +{\edef\pst@shortput{\noexpand\afterassignment\expandafter\noexpand +\csname pst@shortput@#1\endcsname\noexpand\let\noexpand\next}}% +\fi} +\psset@shortput{none} +\def\lput{\def\pst@par{}\pst@ifstar{\@ifnextchar[{\lput@i}{\lput@ii}}} +\def\lput@i[#1]{\addto@par{ref=#1}\lput@ii} +\def\lput@ii{\@ifnextchar({\lput@iv}{\lput@iii}} +\def\lput@iii#1{\addto@par{nrot=#1}\@ifnextchar({\lput@iv}{\ncput@i}} +\def\lput@iv(#1){\addto@par{npos=#1}\ncput@i} +\def\mput{\def\pst@par{}\pst@ifstar{\@ifnextchar[{\mput@i}{\ncput@i}}} +\def\mput@i[#1]{\addto@par{ref=#1}\ncput@i} +\def\Lput{\def\pst@par{}\pst@ifstar{\@ifnextchar[{\Lput@ii}{\Lput@i}}} +\def\Lput@i#1{\addto@par{labelsep=#1}\Lput@ii} +\def\Lput@ii[#1]{\addto@par{ref={#1}}\@ifnextchar({\Lput@iv}{\Lput@iii}} +\def\Lput@iii#1{\addto@par{nrot={#1}}\@ifnextchar({\Lput@iv}{\Lput@v}} +\def\Lput@iv(#1){\addto@par{npos=#1}\Lput@v} +\def\Lput@v{\pst@killglue\pst@makebox{\Lput@vi}} +\def\Lput@vi{% +\begingroup +\use@par +\if@star\pst@starbox\fi +\Rput@vi +\pst@makesmall\pst@hbox +\pst@rotate\psk@nrot\pst@hbox +\ncput@iii +\endgroup +\pst@shortput} +\def\Mput{\def\pst@par{}\pst@ifstar{\@ifnextchar[{\Mput@ii}{\Mput@i}}} +\def\Mput@i#1{\addto@par{labelsep=#1}\Mput@ii} +\def\Mput@ii[#1]{\addto@par{ref={#1}}\Lput@v} +\def\aput@#1{\def\pst@par{}\pst@ifstar{\@ifnextchar[{\aput@i#1}{\aput@ii#1}}} +\def\aput@i#1[#2]{\addto@par{labelsep=#2}\aput@ii#1} +\def\aput@ii#1{\@ifnextchar({\aput@iv#1}{\aput@iii#1}} +\def\aput@iii#1#2{\addto@par{nrot=#2}\@ifnextchar({\aput@iv#1}{#1}} +\def\aput@iv#1(#2){\addto@par{npos=#2}#1} +\def\aput{\aput@\naput@i} +\def\bput{\aput@\nbput@i} +\def\Aput{\def\pst@par{}\pst@ifstar{\@ifnextchar[{\Aput@i}{\naput@i}}} +\def\Aput@i[#1]{\addto@par{labelsep=#1}\naput@i} +\def\Bput{\def\pst@par{}\pst@ifstar{\@ifnextchar[{\Bput@i}{\nbput@i}}} +\def\Bput@i[#1]{\addto@par{labelsep=#1}\nbput@i} +\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 }} +\def\Node@coor[#1]#2;#3\@nil{% +\begingroup +\psset{#1}% +\@ifnextchar\bgroup{\Node@@@coor}{\Node@@coor}#2\@nil +\endgroup +\let\pst@coor\pst@tempg} +\def\Node@@coor#1\@nil{% +\pst@getnode{#1}\pst@tempg +\xdef\pst@tempg{% +\pst@nodedict +tx@NodeDict \pst@tempg known +{ \psk@nodesepA \psk@angleA +\pst@tempg load \psk@nodeseptypeA \tx@GetEdge +\psk@offsetA \psk@angleA \tx@AddOffset +\pst@tempg load \tx@GetCenter +3 -1 roll add 3 1 roll add exch } +{ CP } +ifelse +end }}% +\def\Node@@@coor#1{% +\pst@@getcoor{#1}% +\def\psk@angleA{% +\pst@tempg load \tx@GetCenter \pst@coor +3 -1 roll sub 3 1 roll sub neg \tx@Atan}% +\Node@@coor} +\def\nput{\pst@object{nput}} +\def\nput@i#1#2{\pst@killglue\pst@makebox{\nput@ii{#1}{#2}}} +\def\nput@ii#1#2{% +\begingroup +\use@par +\psset@refangle{#1}% +\let\psk@angleA\psk@refangle +\edef\psk@nodesepA{\pst@number\pslabelsep}% +\def\psk@nodeseptypeA{0 }% +\pslabelsep\z@ +\uput@vi +\Node@@coor#2\@nil +\let\pst@coor\pst@tempg +\leavevmode +\psput@special\pst@hbox +\endgroup +\ignorespaces} +\newcount\psrow +\newcount\pscol +\newcount\psmatrixcnt +\newskip\psrowsep +\newskip\pscolsep +\def\psset@colsep#1{\pssetlength\pscolsep{#1}} +\def\psset@rowsep#1{\pssetlength\psrowsep{#1}} +\psset@colsep{1.5cm} +\psset@rowsep{1.5cm} +\newif\ifpsmatrix +\def\psmatrix{% +\begingroup +{\ifnum0=`}\fi % Don't want to expand any &. +\@ifnextchar[{\psmatrix@i}{\ifnum0=`{\fi}{}\psmatrix@ii}} +\def\psmatrix@i[#1]{% +\ifnum0=`{\fi}{}% +\psset{#1}% +\psmatrix@ii} +\def\psmatrix@ii{% +\KillGlue +\edef\psm@beginmath{% +\ifmmode$\m@th\ifinner\textstyle\else\displaystyle\fi\fi}% +\edef\psm@endmath{\ifmmode$\fi}% +\let\\\psm@cr +\advance\psmatrixcnt 1 +\def\psm@thenode{M-\the\psmatrixcnt-\the\psrow-\the\pscol}% +\tabskip\z@ +\psrow1 +\pscol\z@ +\psset@shortput{tablr}% +\leavevmode +\vbox\bgroup\halign\bgroup&% +\begingroup +\global\advance\pscol 1 +\csname psrowhook\romannumeral\psrow\endcsname +\csname pscolhook\romannumeral\pscol\endcsname +\psm@beginnode##\psm@endnode\endgroup +\cr} +\def\endpsmatrix{% +\crcr\egroup\unskip\egroup +\endgroup} +\def\psm@cr{{\ifnum0=`}\fi\@ifnextchar[{\psm@@cr}{\psm@@@cr{}}} +\def\psm@@cr[#1]{\psm@@@cr{\vskip#1\relax}} +\def\psm@@@cr#1{% +\ifnum0=`{\fi}{}\cr +\noalign{% +\global\advance\psrow 1 +\global\pscol\z@ +\vskip\psrowsep +#1}} +\def\psm@beginnode{% +\@ifnextchar\psm@endnode +{\let\psm@endnode@i\relax\setbox\pst@hbox=\hbox{}}% +{\pst@object{psm@beginnode}}} +\def\psm@beginnode@i{% +\setbox\pst@hbox=\hbox\bgroup +\psm@beginmath +\begingroup +\ignorespaces} +\def\psm@endnode@i{% +\unskip +\endgroup +\psm@endmath +\egroup +\use@par +\@psttrue} +\def\psm@endnode{% +\@pstfalse +\psm@endnode@i +\ifnum\pscol>1 \hskip\pscolsep \fi +\psk@mnodesize +\hfil +\nodealigntrue +\if@pst +\csname mnode@\psk@mnode\endcsname +\else +\csname mnode@\psk@emnode\endcsname +\fi +\psk@mcol +\psk@@mnodesize} +\def\psspan#1{\mscount#1\relax\loop\ifnum\mscount>\@ne \sp@n\repeat} +\def\psset@name#1{\pst@getnode{#1}\psk@name} +\let\psk@name\relax +\def\psset@mcol#1{% +\ifx r#1\relax +\let\psk@mcol\relax +\else +\ifx l#1\relax +\let\psk@mcol\hfill +\else +\let\psk@mcol\hfil +\fi +\fi} +\psset@mcol{c} +\def\psset@mnodesize#1{% +\pssetlength\pst@dimg{#1}% +\ifdim\pst@dimg<\z@ +\let\psk@mnodesize\relax +\let\psk@@mnodesize\relax +\else +\edef\psk@mnodesize{\noexpand\hbox to\number\pst@dimg sp\noexpand\bgroup}% +\let\psk@@mnodesize\egroup +\fi} +\psset@mnodesize{-1pt} +\def\mnode@R{\rnode@iii\Rnode@ii{\psm@thenode}} +\def\mnode@r{\rnode@iii\rnode@iv{\psm@thenode}} +\def\mnode@oval{\ovalnode@ii{\psm@thenode}} +\def\mnode@tri{\trinode@ii{\psm@thenode}} +\def\mnode@dia{\dianode@ii{\psm@thenode}} +\def\mnode@C{{\nodealigntrue\cnode@ii(\z@,\z@){\psk@radius}{\psm@thenode}}} +\def\mnode@f{{\nodealigntrue\fnode@ii(\z@,\z@){\psm@thenode}}} +\def\mnode@circle{\circlenode@ii{\psm@thenode}} +\def\mnode@p{\pnode(\z@,\z@){\psm@thenode}} +\def\mnode@none{\box\pst@hbox} +\def\psset@mnode#1{% +\@ifundefined{mnode@#1}% +{\@pstrickserr{\string\psmatrix\space node `#1' not defined.}\@ehpa}% +{\edef\psk@mnode{#1}}} +\def\psset@emnode#1{% +\@ifundefined{mnode@#1}% +{\@pstrickserr{\string\psmatrix\space node `#1' not defined.}\@ehpa}% +{\edef\psk@emnode{#1}}} +\psset@mnode{R} +\psset@emnode{none} +%%%% FROM pst-coil.tex +\def\nccoil{\pst@object{nccoil}} +\def\nccoil@i{\check@arrow{\nccoil@ii}} +\def\nccoil@ii#1#2{\nc@object{Open}{#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\nczigzag{\pst@object{nczigzag}} +\def\nczigzag@i{\check@arrow{\nczigzag@ii}} +\def\nczigzag@ii#1#2{\nc@object{Open}{#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}} +\catcode`\@=\TheAtCode\relax +\endinput +%% +%% END: pst-node.tex diff --git a/usergrps/uktug/baskervi/6_2/spqr/pst-plot.sty b/usergrps/uktug/baskervi/6_2/spqr/pst-plot.sty new file mode 100644 index 0000000000..f4865099dc --- /dev/null +++ b/usergrps/uktug/baskervi/6_2/spqr/pst-plot.sty @@ -0,0 +1,4 @@ +%% BEGIN pst-plot.sty +\input pst-plot.tex +\endinput +%% END pst-plot.sty diff --git a/usergrps/uktug/baskervi/6_2/spqr/pst-plot.tex b/usergrps/uktug/baskervi/6_2/spqr/pst-plot.tex new file mode 100644 index 0000000000..2a807f93b7 --- /dev/null +++ b/usergrps/uktug/baskervi/6_2/spqr/pst-plot.tex @@ -0,0 +1,643 @@ +%% BEGIN pst-plot.tex +\def\fileversion{0.93a-patched (hacked SPQR)} +\def\filedate{95/12/17} +%% +%% This is for use with PSTricks v0.93a, but contains several +%% patches for bugs in the pst-plot.tex that was distributed +%% with v0.93a until March 30, 1994. +%% +%% For plots and axes with PSTricks. +%% +%% 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. + + +\message{ v\fileversion, \filedate} + +\csname PSTplotLoaded\endcsname +\let\PSTplotLoaded\endinput + +\ifx\PSTricksLoaded\endinput\else + \def\next{\input pstricks.tex } + \expandafter\next +\fi + +\ifx\MultidoLoaded\endinput\else + \def\next{\input multido.tex } + \expandafter\next +\fi + +\edef\TheAtCode{\the\catcode`\@} +\catcode`\@=11 + +% Using lists of data is optimized for \dataplot and \fileplot +% Here is the tricky part. As each line is read from file, +% we want to ignore trailing delimiters, and convert arbitrary +% strings of non-trailing delimiters to _D_. +% We end up with +% D x1 D y1 D x2 D y2 ... D xn D yn +% +\begingroup +\catcode`\{=13 +\catcode`\}=13 +\catcode`\(=13 +\catcode`\)=13 +\catcode`\,=13 +\catcode`\!=1 +\catcode`\*=2 +\catcode`\ =13 +\catcode`\_=13 +\catcode`\^^M=13 +\gdef\pst@datadelimiters!% Begin def +\catcode`\{=13% +\catcode`\}=13% +\catcode`\(=13% +\catcode`\)=13% +\catcode`\,=13% +\catcode`\ =13% +\catcode`\^^M=13% +\def,##1!% +\ifcat\noexpand,\noexpand##1% +\expandafter##1% +\else\space% +D\space##1% +\fi*% +\let(,\let),\let{,\let},\let ,\let^^M,\let_\@empty*% End def +\endgroup +\begingroup +\catcode`\,=13 +\catcode`\_=13 +\gdef\savedata@#1[#2]{% + \xdef\pst@tempg{#2_}% + \endgroup + \let#1\pst@tempg + \global\let\pst@tempg\relax + \ignorespaces} +\gdef\readdata@{% + \read1 to \pst@tempa + \expandafter\readdata@@\pst@tempa_\@nil + \ifeof1\else\expandafter\readdata@\fi} +\gdef\pst@@readfile#1#2\@nil{\addto@pscode{,#1#2}}% +\gdef\readdata@@#1#2\@nil{\xdef\pst@tempg{\pst@tempg,#1#2}}% +\endgroup + +\def\readdata#1#2{% + \openin1=#2 + \begingroup + \def\pst@tempg{}% + \ifeof1 + \@pstrickserr{Data file `#2' not found.}\@ehpa + \else + \pst@datadelimiters + \catcode`\[=1 + \catcode`\]=2 + \readdata@% + \fi + \endgroup + \let#1\pst@tempg + \global\let\pst@tempg\relax + \ignorespaces} + +\def\pst@readfile#1{{\let\readdata@@\pst@@readfile\readdata\pst@tempg{#1}}} +\def\pst@altreadfile#1{% + \openin1=#1 + \ifeof1 + \@pstrickserr{Data file `#1' not found.}\@ehpa + \else + \catcode`\{=10 + \catcode`\}=10 + \catcode`\(=10 + \catcode`\)=10 + \catcode`\,=10 + \catcode`\^^M=10 + \catcode`\[=1 + \catcode`\]=2 + \pst@@altreadfile + \fi} +\def\pst@@altreadfile{% + \read1 to \pst@tempg + \expandafter\pst@@@altreadfile\pst@tempg\@empty\@nil + \ifeof1\else\expandafter\pst@@@altreadfile\fi} +\def\pst@@@altreadfile#1#2\@nil{\addto@pscode{#1#2}}% + +\def\savedata#1{\begingroup\pst@datadelimiters\savedata@{#1}} + +\def\beginplot@line{\begin@OpenObj} +\def\endplot@line{\psline@ii} +\def\beginplot@polygon{\begin@ClosedObj} +\def\endplot@polygon{\pspolygon@ii} +\def\beginplot@curve{\begin@OpenObj} +\def\endplot@curve{\pscurve@ii} +\def\beginplot@ecurve{\begin@OpenObj} +\def\endplot@ecurve{\psecurve@ii} +\def\beginplot@ccurve{\begin@ClosedObj} +\def\endplot@ccurve{\psccurve@ii} +\def\beginplot@dots{\begin@SpecialObj} +\def\endplot@dots{\psdots@ii} +\def\beginplot@bezier{\begin@OpenObj} +\def\endplot@line{\psbezier@ii} +\def\beginplot@cbezier{\begin@ClosedObj} +\def\endplot@cbezier{\pscbezier@ii} + +\def\psset@plotstyle#1{% + \@ifundefined{beginplot@#1}% + {\@pstrickserr{Plot style `#1' not defined}\@eha}% + {\edef\psplotstyle{#1}}} +\psset@plotstyle{line} + +\def\psset@plotpoints#1{% + \pst@cntg=#1\relax + \ifnum\pst@cntg<2 + \@pstrickserr{plotpoints parameter must be at least 2}\@ehpa + \else + \advance\pst@cntg-1 + \edef\psk@plotpoints{\the\pst@cntg\space}% + \fi} +\psset@plotpoints{50} + +% For quick plots, define: +% \beginqp@ : What to do to first point (PS code only). +% \doqp@ : What to do to subsequent points (PS code only). +% \endqp@ : How to end plot. +% \testqp@ : Set \@psttrue if OK to use quick plot. + +\def\beginqp@line{\pst@oplineto} +\def\doqp@line{L } +\def\endqp@line{\end@OpenObj}% +\def\testqp@line{% + \ifdim\pslinearc>\z@\else + \ifshowpoints\else + \ifx\psk@arrowA\@empty + \ifx\psk@arrowB\@empty + \@psttrue + \fi + \fi + \fi + \fi} + +\def\beginqp@polygon{moveto } +\def\doqp@polygon{L } +\def\endqp@polygon{% + \addto@pscode{closepath}% + \end@ClosedObj} +\def\testqp@polygon{% + \ifdim\pslinearc>\z@\else + \ifshowpoints\else + \@psttrue + \fi + \fi} + +\def\beginqp@dots{% + \psk@dotsize + \@nameuse{psds@\psk@dotstyle} + Dot } +\def\doqp@dots{Dot } +\def\endqp@dots{\end@SpecialObj} +\def\testqp@dots{\@psttrue} + +\def\beginqp@bezier{/n 0 def \pst@oplineto} +\def\doqp@bezier{/n n 1 add def n 3 mod 0 eq { curveto } if } +\def\endqp@bezier{% + \addto@pscode{n 3 mod { pop pop } repeat} + \end@OpenObj}% +\def\testqp@bezier{% + \ifshowpoints\else + \ifx\psk@arrowA\@empty + \ifx\psk@arrowB\@empty + \@psttrue + \fi + \fi + \fi} + +\def\beginqp@cbezier{/n 0 def moveto } +\def\doqp@cbezier{\doqp@bezier} +\def\endqp@cbezier{% + \addto@pscode{n 3 mod { pop pop } repeat closepath} + \end@ClosedObj}% +\def\testqp@cbezier{\ifshowpoints\else\@psttrue\fi} + +\def\dataplot{\def\pst@par{}\pst@object{dataplot}} +\def\dataplot@i#1{% + \pst@killglue + \begingroup + \use@par + \@pstfalse + \@nameuse{testqp@\psplotstyle}% + \if@pst + \dataplot@ii{\addto@pscode{#1}}% + \else + \listplot@ii{\addto@pscode{#1}}% + \fi + \endgroup + \ignorespaces} +\def\dataplot@ii#1{% + \@nameuse{beginplot@\psplotstyle}% + \addto@pscode{% + /Dx { \pst@number\psxunit mul /D { Dy } def } def + /Dy { \pst@number\psyunit mul Do /D { Dx } def } def + /D { /D { Dx } def } def + /Do { + \@nameuse{beginqp@\psplotstyle}% + /Do { \@nameuse{doqp@\psplotstyle}} def + } def}% + #1% + \addto@pscode{D}% + \@nameuse{endqp@\psplotstyle}} + +\def\fileplot{\def\pst@par{}\pst@object{fileplot}} +\def\fileplot@i#1{% + \pst@killglue + \begingroup + \use@par + \@pstfalse + \@nameuse{testqp@\psplotstyle}% + \if@pst + \dataplot@ii{\pst@readfile{#1}}% + \else + \listplot@ii{\pst@altreadfile{#1}}% + \fi + \endgroup + \ignorespaces} + +\pst@def{ScalePoints}<% + /y ED /x ED + counttomark dup dup cvi eq not { exch pop } if + /m exch def /n m 2 div cvi def + n { y mul m 1 roll x mul m 1 roll /m m 2 sub def } repeat> + +\def\listplot{\def\pst@par{}\pst@object{listplot}} +\def\listplot@i#1{\listplot@ii{\addto@pscode{#1}}} +\def\listplot@ii#1{% + \@nameuse{beginplot@\psplotstyle}% + \addto@pscode{/D {} def mark}% + #1% + \addto@pscode{\pst@number\psxunit \pst@number\psyunit \tx@ScalePoints}% + \@nameuse{endplot@\psplotstyle}} + +% \psplot + +\def\psplotinit#1{\xdef\psplot@init{#1 }} +\def\psplot@init{} + +\def\psplot{\def\pst@par{}\pst@object{psplot}} +\def\psplot@i#1#2#3{% + \pst@killglue + \begingroup + \use@par + \@nameuse{beginplot@\psplotstyle}% + \addto@pscode{% + \psplot@init + /x #1 def + /x1 #2 def + /dx x1 x sub \psk@plotpoints div def + /xy { + x \pst@number\psxunit mul + #3 \pst@number\psyunit mul + } def}% + \gdef\psplot@init{}% + \@pstfalse + \@nameuse{testqp@\psplotstyle}% + \if@pst + \psplot@ii + \else + \psplot@iii + \fi + \endgroup + \ignorespaces} +\def\psplot@ii{% + \addto@pscode{% + xy \@nameuse{beginqp@\psplotstyle} + \psk@plotpoints 1 sub { + /x x dx add def + xy \@nameuse{doqp@\psplotstyle} + } repeat + /x x1 def + xy \@nameuse{doqp@\psplotstyle}}% + \@nameuse{endqp@\psplotstyle}} +\def\psplot@iii{% + \addto@pscode{% + mark + /n 2 def + \psk@plotpoints { + xy + n 2 roll + /n n 2 add def + /x x dx add def + } repeat + /x x1 def + xy + n 2 roll}% + \@nameuse{endplot@\psplotstyle}} + +\def\parametricplot{\def\pst@par{}\pst@object{parametricplot}} +\def\parametricplot@i#1#2#3{% + \pst@killglue + \begingroup + \use@par + \@nameuse{beginplot@\psplotstyle}% + \addto@pscode{% + \psplot@init + /t #1 def + /t1 #2 def + /dt t1 t sub \psk@plotpoints div def + /xy { + #3 + \pst@number\psyunit mul exch + \pst@number\psxunit mul exch + } def}% + \gdef\psplot@init{}% + \@pstfalse + \@nameuse{testqp@\psplotstyle}% + \if@pst + \parametricplot@ii + \else + \parametricplot@iii + \fi + \endgroup + \ignorespaces} +\def\parametricplot@ii{% + \addto@pscode{% + xy \@nameuse{beginqp@\psplotstyle} + \psk@plotpoints 1 sub { + /t t dt add def + xy \@nameuse{doqp@\psplotstyle} + } repeat + /t t1 def + xy \@nameuse{doqp@\psplotstyle}}% + \@nameuse{endqp@\psplotstyle}} +\def\parametricplot@iii{% + \addto@pscode{% + mark + /n 2 def + \psk@plotpoints { + xy + n 2 roll + /n n 2 add def + /t t dt add def + } repeat + /t t1 def + xy + n 2 roll}% + \@nameuse{endplot@\psplotstyle}} + +% These axes macros are complicated. Be careful. + +% \pst@ticks{angle}{dx}{n}{int} +% int=1 if ticks appear on top of axes, 0 otherwise. +\def\pst@ticks#1#2#3#4{% + \begin@SpecialObj + \addto@pscode{% + #1 rotate + /n #3 def + /dx #2 def + n 0 lt { /dx dx neg def /n n neg def } if + /y2 \psk@ticksize CLW 2 div add def + /y1 y2 neg def + \ifnum\psk@tickstyle=1 + \ifdim#4<\z@ /y2 \else /y1 \fi 0 def + \else + \ifnum\psk@tickstyle=-1 + \ifdim#4<\z@ /y1 \else /y2 \fi 0 def + \fi + \fi + /x dx def + n { x y1 moveto x y2 lineto stroke /x x dx add def } repeat}% + \end@SpecialObj} + + +\def\psset@ticksize#1{\pst@getlength{#1}\psk@ticksize} +\psset@ticksize{3pt} + +\def\psset@tickstyle#1{\pst@expandafter\psset@@tickstyle{#1}\@nil} +\def\psset@@tickstyle#1#2\@nil{% + \ifx#1f\let\psk@tickstyle\z@\else + \ifx#1t\let\psk@tickstyle\@ne\else + \ifx#1b\let\psk@tickstyle\m@ne\else + \@pstrickserr{Bad tick style: `#1#2'}\@ehpa + \fi\fi\fi} +\psset@tickstyle{full} + +\def\psset@ticks#1{\pst@expandafter\psset@@ticks{#1}\@nil\psk@ticks} +\def\psset@@ticks#1#2\@nil#3{% + \ifx#1a\let#3\z@\else + \ifx#1x\let#3\@ne\else + \ifx#1y\let#3\tw@\else + \ifx#1n\let#3\thr@@\else + \@pstrickserr{Bad argument: `#1#2'}\@ehpa + \fi\fi\fi\fi} +\psset@ticks{all} + +\def\psset@labels#1{\pst@expandafter\psset@@ticks{#1}\@nil\psk@labels} +\psset@labels{all} + +\def\psset@Ox#1{\edef\psk@Ox{#1}} +\psset@Ox{0} +\def\psset@Dx#1{\edef\psk@Dx{#1}} +\psset@Dx{1} +\def\psset@dx#1{% + \pssetxlength\pst@dimg{#1}% + \edef\psk@dx{\number\pst@dimg}} +\psset@dx{0} + +\def\psset@Oy#1{\edef\psk@Oy{#1}} +\psset@Oy{0} +\def\psset@Dy#1{\edef\psk@Dy{#1}} +\psset@Dy{1} +\def\psset@dy#1{% + \pssetylength\pst@dimg{#1}% + \edef\psk@dy{\number\pst@dimg}} +\psset@dy{0} + +\newif\ifshoworigin +\def\psset@showorigin#1{\@nameuse{showorigin#1}} +\psset@showorigin{true} + + +\def\psaxes{\def\pst@par{}\pst@object{psaxes}} +\def\psaxes@i{\pst@getarrows\psaxes@ii} +\def\psaxes@ii(#1){\@ifnextchar({\psaxes@iii(#1)}{\psaxes@iv(0,0)(0,0)(#1)}} +\def\psaxes@iii(#1)(#2){% + \@ifnextchar(% + {\psaxes@iv(#1)(#2)}% + {\psaxes@iv(#1)(#1)(#2)}} +\def\psaxes@iv(#1,#2)(#3,#4)(#5,#6){% + \setbox\pst@hbox=\hbox\bgroup + \use@par + \pssetxlength\pst@dimg{#1}% o-x + \pssetylength\pst@dimh{#2}% o-y + \pssetxlength\pst@dima{#3}% bl-x + \pssetylength\pst@dimb{#4}% bl-y + \pssetxlength\pst@dimc{#5}% ur-x + \pssetylength\pst@dimd{#6}% ur-y +% Whole thing will be translated to origin: + \advance\pst@dima-\pst@dimg % Dist. from bl-x to o-x + \advance\pst@dimb-\pst@dimh % Dist. from bl-y to o-y + \advance\pst@dimc-\pst@dimg % Dist. from ur-x to o-x + \advance\pst@dimd-\pst@dimh % Dist. from ur-y to o-y +% Make lines/arrows or frame: + \@nameuse{psxs@\psk@axesstyle}% +% "\pslabelsep" should be from the edge of the axis. + \advance\pslabelsep.5\pslinewidth +% Now the ticks and labels. Start by checking for "\multido". +% !!Need to fix this so that does nothing when there are 0 ticks.!! + \begingroup + \ifdim\pst@dimb=\z@\else\showoriginfalse\fi + \ifnum\psk@dx=\z@ + \pst@dimg=\psk@Dx\psxunit + \edef\psk@dx{\number\pst@dimg}% + \fi + \ifnum\psk@ticks<\tw@ + \ifnum\psk@tickstyle>\z@\else + \advance\pslabelsep\psk@ticksize\p@ + \fi + \fi + \pst@hlabels\pst@dimc\psk@arrowB + \pst@hlabels\pst@dima\psk@arrowA + \endgroup + \begingroup + \ifdim\pst@dima=\z@\else\showoriginfalse\fi + \ifnum\psk@dy=\z@ + \pst@dimg=\psk@Dy\psyunit + \edef\psk@dy{\number\pst@dimg}% + \fi + \ifodd\psk@ticks\else + \ifnum\psk@tickstyle>\z@\else + \advance\pslabelsep\psk@ticksize\p@ + \fi + \fi + \pst@vlabels\pst@dimd\psk@arrowB + \pst@vlabels\pst@dimb\psk@arrowA + \endgroup +% Now close "\pst@hbox" (which is 0-dimensional), and put it at the origin. + \egroup + \pssetxlength\pst@dimg{#1}% + \pssetylength\pst@dimh{#2}% + \leavevmode\psput@cartesian\pst@hbox + \ignorespaces} + +\def\psxs@axes{% + \psxs@@axes\pst@dima\pst@dimc{}% + \psxs@@axes\pst@dimb\pst@dimd{exch}} +\def\psxs@@axes#1#2#3{% + \begin@SpecialObj + \ifdim#1=\z@ + \def\psk@arrowA{C}% + \else + \ifdim#2=\z@ + \def\psk@arrowB{C}% + \fi + \fi + \let\pst@linetype\pst@arrowtype + \pst@addarrowdef + \addto@pscode{% + \pst@number#2 0 #3 + \pst@number#1 0 #3 + ArrowA + CP 4 2 roll + ArrowB + L + pop pop}% + \pst@stroke + \end@SpecialObj} + +\def\psxs@frame{% + \begin@SpecialObj + \addto@pscode{% + 0 0 moveto \pst@number\pst@dimc 0 L + 0 \pst@number\pst@dimd 2 copy rlineto L closepath}% + \pst@stroke + \psk@fillstyle + \end@SpecialObj + \let\psk@arrowA\@empty + \let\psk@arrowB\@empty} + +\def\psset@axesstyle#1{% + \@ifundefined{psxs@#1}% + {\@pstrickserr{Axes style `#1' not defined}\@eha}% + {\edef\psk@axesstyle{#1}}} +\psset@axesstyle{axes} + +\def\psxs@none{\let\psk@arrowA\@empty\let\psk@arrowB\@empty} + +% The origin is never the only label. +\def\pst@hlabels#1#2{% + \ifdim#1=\z@\else + \ifx#2\empty\else + \advance#1\ifdim#1>\z@-\fi7\pslinewidth + \fi + \pst@cnta=#1\relax % Distance (in sp) to end. + \divide\pst@cnta\psk@dx\relax % Number of ticks/labels + \ifnum\pst@cnta=\z@\else + \pst@dimb=\psk@dx sp % Space between ticks. + \ifnum\psk@ticks<\thr@@ + \pst@ticks{0}{\pst@number\pst@dimb}{\the\pst@cnta}{\pst@dimd}% + \fi + \ifnum\psk@labels<\thr@@ \pst@@hlabels\fi + \showoriginfalse + \fi + \fi} + +% Knows \pst@dimb and \pst@cnta +\def\pst@@hlabels{% + \vbox to\z@{% + \ifdim\pst@dimd>\z@\vskip\pslabelsep\else\vss\fi + \ifnum\pst@cnta<\z@ + \pst@dimb=-\pst@dimb + \fi + \hbox to\z@{% + \ifshoworigin\hbox to \z@{\hss\pshlabel{\psk@Ox}\hss}\fi + \mmultido + {\n=\psk@Ox+\psk@Dx}% + {\pst@cnta}% + {\hskip\pst@dimb\hbox to \z@{\hss\pshlabel{\n}\hss}}% + \hss}% + \ifdim\pst@dimd>\z@\vss\else\vskip\pslabelsep\fi}}% + +\def\pshlabel#1{$#1$} + +\def\pst@vlabels#1#2{% + \ifdim#1=\z@\else + \ifx#2\empty\else + \advance#1\ifdim#1>\z@-\fi7\pslinewidth + \fi + \pst@cnta=#1\relax % Distance (in sp) to end. + \divide\pst@cnta\psk@dy\relax % Number of ticks/labels + \ifnum\pst@cnta=\z@\else + \pst@dima=\psk@dy sp % Space between ticks. + \ifodd\psk@ticks\else + \pst@ticks{90}{\pst@number\pst@dima}{\the\pst@cnta}{-\pst@dimc}% + \fi + \ifodd\psk@labels\else\pst@@vlabels\fi + \showoriginfalse + \fi + \fi} + +% Knows \pst@dima and \pst@cnta +\def\pst@@vlabels{% + \vbox to\z@{% + \ifnum\pst@cnta>\z@ + \pst@dima=-\pst@dima + \fi + \offinterlineskip + \ifshoworigin + \vbox to \z@{\vss\hbox to\z@{% + \ifdim\pst@dimc>\z@\hss\else\hskip\pslabelsep\fi + \psvlabel{\psk@Oy}% + \ifdim\pst@dimc>\z@\hskip\pslabelsep\else\hss\fi}\vss}% + \fi + \mmultido + {\n=\psk@Oy+\psk@Dy}% + {\pst@cnta}% + {\vbox to\pst@dima{\vss}\vbox to \z@{\vss\hbox to\z@{% + \ifdim\pst@dimc>\z@\hss\else\hskip\pslabelsep\fi + \psvlabel{\n}% + \ifdim\pst@dimc>\z@\hskip\pslabelsep\else\hss\fi}\vss}}% + \vss}} + +\def\psvlabel#1{$#1$} + +\catcode`\@=\TheAtCode\relax +\endinput +%% pst-plot.tex diff --git a/usergrps/uktug/baskervi/6_2/spqr/pst2eps.sty b/usergrps/uktug/baskervi/6_2/spqr/pst2eps.sty new file mode 100644 index 0000000000..aeedbe6b3a --- /dev/null +++ b/usergrps/uktug/baskervi/6_2/spqr/pst2eps.sty @@ -0,0 +1,4 @@ +%% BEGIN pst2eps.sty +\input pst2eps.tex +\endinput +%% END pst2eps.sty diff --git a/usergrps/uktug/baskervi/6_2/spqr/pst2eps.tex b/usergrps/uktug/baskervi/6_2/spqr/pst2eps.tex new file mode 100644 index 0000000000..5f4985bf7f --- /dev/null +++ b/usergrps/uktug/baskervi/6_2/spqr/pst2eps.tex @@ -0,0 +1,244 @@ +%% BEGIN pst2eps.tex +%% +%% For writing EPS files with PSTricks. +%% +\def\fileversion{0.93a} +\def\filedate{93/03/12} +%% +%% COPYRIGHT 1993, by Timothy Van Zandt, tvz@Princeton.EDU +%% See pstricks.tex or pstricks.doc for copying restrictions. +%% +%% See the PSTricks User's Guide for description. +%% + +\message{ v\fileversion, \filedate} + +\csname PSTfilesLoaded\endcsname +\let\PSTfilesLoaded\endinput + +\ifx\PSTricksLoaded\endinput\else + \def\next{\input pstricks.tex} + \expandafter\next +\fi + +\edef\TheAtCode{\the\catcode`\@} +\catcode`\@=11 + +% Exporting PostScript files + +\def\TeXtoEPS{\begingroup\pst@makebox{}\bgroup\ignorespaces} +\def\endTeXtoEPS{% + \egroup +% Get contents of page, in case it contains special's: + \begingroup + \global\setbox\pst@boxg\box\voidb@x + \output{\global\setbox\pst@boxg\box\@cclv}% + \par\hbox{}\penalty-10000 + \endgroup + \dp\pst@boxg\z@ + \ht\pst@boxg\z@ + \wd\pst@boxg\z@ + \pst@dimg=3pt + \shipout\hbox{% + \box\pst@boxg + \pst@Verb{gsave CM \tx@STV CP newpath moveto + \pst@number\pst@dimg neg 0 rmoveto clip setmatrix}% + \vrule width \wd\pst@hbox height \ht\pst@hbox depth \dp\pst@hbox + \pstVerb{currentpoint grestore moveto}% + \kern -\wd\pst@hbox + \unhbox\pst@hbox}% + \endgroup + \typeout{PSTricks: Converting TeX box to EPS.}% + \typeout{\@spaces\@spaces\space\space With dvips, use -E option.}} + + +% Writing PSTricks graphics to EPS files + +\newwrite\pst@epsout +\newwrite\pst@tempout + +\def\pst@getbp#1#2#3{% + \csname psset#1length\endcsname\pst@dimg{#2}% + \advance\pst@dimg .49bp + \pst@cntg=\pst@dimg + \multiply\pst@cntg 5 + \divide\pst@cntg 328909 + \edef#3{\the\pst@cntg}} + +\def\psset@bbllx#1{\pst@getbp{x}{#1}\psk@bbllx} +\psset@bbllx{-1pt} + +\def\psset@bblly#1{\pst@getbp{y}{#1}\psk@bblly} +\psset@bblly{-1pt} + +\def\psset@bburx#1{\pst@getbp{x}{#1}\psk@bburx} +\psset@bburx{1pt} + +\def\psset@bbury#1{\pst@getbp{y}{#1}\psk@bbury} +\psset@bbury{1pt} + +\def\pst@getboolean#1#2{% + \def\pst@tempg##1##2\@nil{% + \ifx t##1\relax\def#2{1\relax}\else\def#2{\z@}\fi} + \pst@expandafter\pst@tempg{#1}\relax\@nil} + +\def\psset@headers#1{% + \def\pst@tempg##1##2\@nil{% + \ifx u##1\relax + \def\psk@headers{1\relax}% + \else + \ifx a#1\relax + \def\psk@headers{2\relax}% + \else + \def\psk@headers{\z@}% + \fi + \fi}% + \pst@expandafter\pst@tempg{#1}\relax\@nil} +\psset@headers{none} + +\def\psset@checkfile#1{\pst@getboolean{#1}\psk@checkfile} +\psset@checkfile{true} + +\def\psset@makeeps#1{% + \def\pst@tempg{#1}% + \ifx\pst@tempg\@none + \def\psk@makeeps{\z@}% + \else + \def\pst@temph{all}% + \ifx\pst@tempg\pst@temph + \def\psk@makeeps{3\relax}% + \else + \def\pst@temph{all*}% + \ifx\pst@tempg\pst@temph + \def\psk@makeeps{2\relax}% + \else + \def\psk@makeeps{1\relax}% + \fi + \fi + \fi} +\psset@makeeps{new} + +\def\psset@headerfile#1{\def\psk@headerfile{#1}} +\psset@headerfile{} + +\def\pst@checkfile#1{% + \ifcase\psk@makeeps + \@pstfalse + \or + \immediate\openin1=#1 + \ifeof1\relax\@psttrue\else\@pstfalse\fi + \immediate\closein1 + \or + \immediate\openin1=#1 + \ifeof1 + \@psttrue + \else + \typeout{^^J% + PSTricks warning:^^J% + !! File `#1' exists and will be erased if in current directory!^^J% + !! Make `#1'? (y=yes; n=no)} + \read16 to \pst@tempg + \if y\pst@tempg\relax\@psttrue\else\@pstfalse\fi + \fi + \immediate\closein1=#1 + \or + \@psttrue + \fi} + +\def\PSTtoEPS{\def\pst@par{}\pst@object{PSTtoEPS}} +\begingroup +\catcode`\%=12 +\catcode`\"=14 +\long\gdef\PSTtoEPS@i#1#2{" + \begingroup + \use@par + \newlinechar`\^^J" + \pst@checkfile{#1}" + \if@pst + \immediate\openout\pst@epsout=#1 + \def\write@eps##1{\immediate\write\pst@epsout{##1}}" + \def\addto@pscode##1{" + \begingroup + \newlinechar`\ " + \write@eps{##1}" + \endgroup} + \write@eps{" + %!PS-Adobe-3.0 EPSF-3.0^^J" + %%Creator: PSTricks^^J" + %%Title: #1^^J" + %%CreationDate: \the\year/\the\month/\the\day^^J" + %%BoundingBox: + \psk@bbllx\space\psk@bblly\space\psk@bburx\space\psk@bbury^^J" + %%EndComments}" + \ifcase\psk@headers + \def\pst@tempg{}" + \or + \let\pst@tempg\psk@headerfile + \or + \edef\pst@tempg{\pst@theheaders,\psk@headerfile}" + \fi + \ifx\pst@tempg\@empty\else + \expandafter\pst@writeheaders\pst@tempg,\@nil + \fi + \write@eps{%%BeginSetup}" + \addto@pscode\pst@dict + \write@eps{%%EndSetup}" + \ifdim\pstunit=1bp\else + \pst@dimg=\pstunit\relax + \write@eps{\number\pst@dimg\space 65781.8 div dup scale}" + \fi + \addto@pscode{" + \tx@STP + 0 setlinecap + 0 setlinejoin + 10 setmiterlimit + [] 0 setdash + newpath}" + \setbox\pst@hbox=\hbox{" + \def\init@pscode{" + \write@eps{" + gsave + \psk@origin + \psk@swapaxes + \pst@number\pslinewidth SLW + \pst@usecolor\pslinecolor}}" + \def\use@pscode{\write@eps{grestore}}" + \let\pst@rawfile\pst@filetoeps + \def\psclip#1{\pst@misplaced\psclip}" + \let\endpsclip\relax + \def\pstextpath@@@[##1](##2,##3)##4{\pst@misplaced\pstextpath}" + \def\nc@object##1##2##3##4{\pst@misplaced{node connection}}" + \def\PSTtoEPS@i##1##2{\pst@misplaced\PSTtoEPS}" + #2}" + \write@eps{" + %%Trailer^^J" + end^^J" + %%EOF}" + \immediate\closeout\pst@epsout + \fi + \endgroup + \ignorespaces} + +\gdef\pst@writeheaders#1,{" + \def\pst@tempg{#1}" + \ifx\pst@tempg\@empty\else + \write@eps{%%BeginProcSet: #1}" + \pst@filetoeps{#1}" + \write@eps{%%EndProcSet}" + \fi + \@ifnextchar\@nil{\let\pst@tempg}{\pst@writeheaders}} +\endgroup + +\def\pst@filetoeps#1{% + \begingroup + \def\do##1{\catcode`##1=12\relax}% + \dospecials + \def\addto@pscode##1{\write@eps{##1}}% + \pst@@rawfile{#1}% + \endgroup} + +\catcode`\@=\TheAtCode\relax + +\endinput + +%% END pst2eps.tex diff --git a/usergrps/uktug/baskervi/6_2/spqr/pstree.rea b/usergrps/uktug/baskervi/6_2/spqr/pstree.rea new file mode 100644 index 0000000000..c66fbb2aa0 --- /dev/null +++ b/usergrps/uktug/baskervi/6_2/spqr/pstree.rea @@ -0,0 +1,37 @@ +%% BEGIN pstree.readme +%% April 14, 1993 +%% tvz@Princeton.EDU + +This directory contains some new tree macros for PSTricks, plus a few +other new features (including a matrix macro for graphs and commutatitve +diagrams). If you ever make trees, then you really should +try these out. + +These will be incorporated into the next release of PSTricks. +Any comments and improvements in the meantime would be greatly +appreciated, including better examples. + +These macros are unstable, both in that they probably have bugs and +also in that the interface could change a little. But they are already +well documented and are very complete. + +These have been tested with PSTricks v0.93a. I think they should also +work with v0.93, but definitely not earlier versions. + +The files are: + + pst-beta.tex : Use this instead of pst-node.tex. If you are also + using pst-coil.tex or pst-plot.tex, you should + input these BEFORE pst-beta.tex. + + psn-beta.pro : This is the PostScript header file that is used by + pst-beta.tex (instead of pst-node.pro). + + pst-doc1.ps : The first part of the documentation. Includes revised + documentation for the node commands. + + pst-doc2.ps : Second part of the documentation. + + changes.tex : Changes for this beta release. + +%% END pstree.readme diff --git a/usergrps/uktug/baskervi/6_2/spqr/pstree.tex b/usergrps/uktug/baskervi/6_2/spqr/pstree.tex new file mode 100644 index 0000000000..78525b0ab4 --- /dev/null +++ b/usergrps/uktug/baskervi/6_2/spqr/pstree.tex @@ -0,0 +1,2280 @@ +%% BEGIN pstree.doc +\def\fileversion{0.93} +\def\filedate{93/03/03} +%% +%% pstree.tex: Tree macros for PSTricks. +%% +%% COPYRIGHT 1993, by Timothy Van Zandt, tvz@Princeton.EDU +%% See pstricks.doc or pstricks.tex for copying restrictions. +%% +%% See the PSTricks User's Guide and read-me file for documentation. +%% +% +% ************************************************************************** +% This is `pstree.doc'. Use as is or create a stripped input file +% with pst-make.tex. See the PSTricks read-me file for details. +% ************************************************************************** +% +% \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{pstree.doc} +% +% \section{Overview} +% +% An extensive description of these macros is contained in a separate file: ???? +% +% \section{Preliminaries} +% +% Start with the usual stuff: +% \begin{macrocode} +\message{ v\fileversion, \filedate} +\csname PSTreeLoaded\endcsname +\let\PSTreeLoaded\endinput +\ifx\PSTnodesLoaded\endinput\else\input pst-node.tex\fi\relax +\edef\TheAtCode{\the\catcode`\@} +\catcode`\@=11 +% \end{macrocode} +% +% \section{Profile/list operators} +% +% The lists are stored in command sequences, as comma separated lists of integers. This section contains various list operators. Most are optimized for singleton lists. +% +% \begin{macro}{\pstree@poptop,\pstree@gettop,\pstree@poptop} +% If is a list, then "\pstree@puttop{}" expands to the list, with the first item replaced by , and "\pstree@gettop" expands to the first item in the list. "\pstree@poptop" removes the first item from the list and assigns it to , and the adds a 0 at the end of the list (so that the list does not change size, and in particular, will never be exhausted). +% \begin{LVerbatim} +% \begin{macrocode} +\def\pstree@puttop#1{#1,\expandafter\pstree@@puttop} +\def\pstree@@puttop#1,{} +\def\pstree@gettop#1{\expandafter\pstree@@gettop#1\@nil} +\def\pstree@@gettop#1,#2\@nil{#1} +\def\pstree@poptop#1#2{\expandafter\pstree@@poptop#1\relax#1#2} +\def\pstree@@poptop#1,#2\relax#3#4{% + #4=#1\relax + \def#3{#20,}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pstree@max} +% "\pstree@max{}{}" assigns the maximum value in to . +% \begin{macrocode} +\def\pstree@max#1#2{% + \pst@cntg=\z@ + \expandafter\pstree@@max#1\relax + #2=\pst@cntg}% +\def\pstree@@max#1,#2{% + \ifnum#1>\pst@cntg \pst@cntg=#1 \fi + \ifx\relax#2\else + \expandafter\pstree@@max + \fi + #2} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pstree@add} +% "\pstree@add{}{}" adds to each element of . +% \begin{macrocode} +\def\pstree@add#1#2{% + \def\pst@tempg{}% + \pst@cnth=#1\relax + \expandafter\pstree@@add#2\relax + \let#2\pst@tempg} +\def\pstree@@add#1,#2{% + \pst@cntg=#1 + \advance\pst@cntg\pst@cnth + \xdef\pst@tempg{\pst@tempg\the\pst@cntg,}% + \ifx\relax#2\else + \expandafter\pstree@@add + \fi + #2} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pstree@tightfit,\pstree@loosefit} +% \begin{LVerbatin} +% \pstree@tightfit{}{}{} +% \pstree@loosefit{}{}{} +% \end{LVerbatim} +% finds the distance between two successors. The inner profiles are and . The result is assigned to "\pst@cnth". "\pstree@loosefit" finds the distance between the bounding boxes. "\pstree@tightfit" finds the maximum distance level-by-level. I.e., "\pstree@tightfit" finds the maximum of the vector sum of the two lists, up to the end of the shortest list. "\pstree@loosefit" always returns a higher value that "\pstree@tightfit". +% \begin{macrocode} +\def\pstree@tightfit#1#2#3{% + \pst@cnth=\z@ + \let\pstree@xtightfit\pstree@@xtightfit + \edef\next{\noexpand\pstree@@tightfit#1\relax#2\relax}% + \next + #3=\pst@cnth} +\def\pstree@@tightfit#1,#2\relax#3,#4\relax{% + \pst@cntg=#1 + \advance\pst@cntg#3 + \pstree@xtightfit + \ifnum\pst@cntg>\pst@cnth + \pst@cnth=\pst@cntg + \fi + \let\next\relax + \ifx\relax#2\relax\else + \ifx\relax#4\relax\else + \def\next{\pstree@@tightfit#2\relax#4\relax}% + \fi + \fi + \next} +\def\pstree@@xtightfit{% + \ifnum\psk@thisxtreesep=\z@ + \let\pstree@xtightfit\relax + \else + \edef\pstree@xtightfit{\advance\pst@cntg\psk@thisxtreesep\relax}% + \fi} +\def\pstree@loosefit#1#2#3{% + \pstree@max#1\pst@cnth + \pstree@max#2#3% + \advance#3\pst@cnth + \ifnum\psk@thisxtreesep=\z@\else\pstree@xloosefit#1#2#3\fi} +\def\pstree@xloosefit#1#2#3{% + \edef\next{\noexpand\pstree@@xloosefit#3\relax#1\relax#2\relax}% + \next} +\def\pstree@@xloosefit#1\relax#2,#3\relax#4,#5\relax{% + \ifx\relax#3\relax\else + \ifx\relax#5\relax\else\advance#1\psk@thisxtreesep\relax\fi + \fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pstree@zip} +% \begin{LVerbatim} +% \pstree@zip{}{}{}{} +% \end{LVerbatim} +% "\pstree@zip" subtracts from , and then sets to the item-by-item maximum of the resulting and . +% +% E.g., if is the current right profile in the row of sucessors, and is the right profile of the next successor, which is positioned "sp" units from the previous successor, then "" is set to the new outer profile of the row of successors. +% +% If is the current left profile of the row of successors, and is the left profile of the next successor, which is a total of "sp" units from the first successor, then "" is the new left profile of the row. +% \begin{macrocode} +\def\pstree@zip#1#2#3#4{% + \pst@cnth=#1\relax + \pst@cnth=-\pst@cnth + \def\pst@tempg{}% + \edef\next{\noexpand\pstree@@zip#2\relax#3\relax}% + \next + \global\let#4\pst@tempg} +\def\pstree@@zip#1,#2\relax#3,#4\relax{% + \pst@cntg=#1 + \advance\pst@cntg\pst@cnth + \edef\pst@tempg{\pst@tempg\ifnum#3>\pst@cntg#3\else\the\pst@cntg\fi,}% + \ifx\relax#2\relax + \edef\pst@tempg{\pst@tempg#4}% + \let\next\relax + \else + \ifx\relax#4\relax + \def\next{\pstree@@add#2\relax}% + \else + \def\next{\pstree@@zip#2\relax#4\relax}% + \fi + \fi + \next} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pstree@bimax} +% "\pstree@max{}{}" sets to the maximum, item by item, of and . +% \begin{macrocode} +\def\pstree@bimax#1#2{% + \def\pst@tempg{}% + \edef\next{\noexpand\pstree@@bimax#1\relax#2\relax}% + \next + \global\let#1\pst@tempg} +\def\pstree@@bimax#1,#2\relax#3,#4\relax{% + \edef\pst@tempg{\pst@tempg\ifnum#1>#3 #1\else#3\fi,}% + \ifx\relax#2\relax + \edef\pst@tempg{\pst@tempg#4}% + \let\next\relax + \else + \ifx\relax#4\relax + \edef\pst@tempg{\pst@tempg#2}% + \let\next\relax + \else + \def\next{\pstree@@bimax#2\relax#4\relax}% + \fi + \fi + \next} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pstree@set} +% "\pstree@set{}{}" sets each element of to . +% \begin{macrocode} +\def\pstree@set#1#2{% + \pst@cntg=#1\relax + \edef#2{\expandafter\pstree@@set#2\relax}} +\def\pstree@@set#1,#2{% + \the\pst@cntg,\ifx\relax#2\else\expandafter\pstree@@set\fi#2} +% \end{macrocode} +% \end{macro} +% +% +% \section{Counters and boxes} +% +% \begin{macro}{\pstree@ID,\pstree@succID,\pstree@levelID} +% "\pstree@ID" is used for identifying trees, for the purpose of syncronizing the distance between levels for all subtrees of the same tree. It is only used when the "levelsep" parameter value is preceded by "*", and the distance between levels must take into account the size of the objects. "\pstree@levelID" is the number of the level (0, 1, $\ldots$). "\pstree@succID" is the number of the successor (1, 2, $\ldots). "\pstree@nodeID" is the serial number of the node, used for node names. +% \begin{macrocode} +\newcount\pstree@ID +\newcount\pstree@levelID +\newcount\pstree@succID +\newcount\pstree@nodeID +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\psTREE@sep,\psTREE@width} +% These are used while constructing the row of successors. "\psTREE@sep" measures the distance between the previous and next successor. "\psTREE@width" measures is the distance between the center of the first and the center of the last successor. +% \begin{macrocode} +\newcount\psTREE@sep +\newcount\psTREE@width +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\psTREE@height,\psTREE@depth,\pstree@height,\pstree@depth} +% These were described on page \pageref{height}. +% \begin{macrocode} +\newcount\psTREE@height +\newcount\psTREE@depth +\newcount\pstree@cumlevelsep +\newcount\pstree@numlevels +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pstree@box} +% Nodes and trees put themselves in "\pstree@box". A tree collects the root (which includes the root node's "\pstree@box", plus perhaps some "\special"'s lying outside this box) in "\pst@hbox". Then it saves the root in "\pstree@box", while it collects the successors in "\pst@hbox". The tree joins the root and the successors in "\pstree@box". +% \begin{macrocode} +\newbox\pstree@box +% \end{macrocode} +% \end{macro} +% +% \section{The tree macros} +% +% We begin with the main tree macros, which provide an outline of the algorithm. Much of this will be explained in detail when the component macros are defined. + +% \begin{macro}{\pstree} +% We set up two ways of invoking trees. "\pstree" is ``short'', and ``\psTree'' is ``long''. +% \begin{macrocode} +\def\pstree{\pst@object{pstree}} +\def\pstree@i#1#2{\psTree@i{#1}\\{#2}\endpsTree} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\psTree,\endpsTree} +% \begin{macrocode} +\let\beginroot\relax %??? +\let\endroot\relax %??? +\def\psTree{\pst@object{psTree}} +\def\psTree@i{% + \begingroup +% \end{macrocode} +% If we are in outer mode, then we set "shortput=tab" for abbreviated put commands used in trees. Also, we have to change the tree identifier for the purpose of making nodes. Otherwise, we want to kill off extraneous space by starting with "\pst@killglue" and ending with "\ignorespaces". +% \begin{macrocode} + \ifnum\psk@predmode=\m@ne + \let\pstree@savedshortput\pst@shortput + \psset@shortput{tab}% + \else + \pst@@killglue + \fi +% \end{macrocode} +% "\psk@treeframe" is a hook that might contain commands for framing the tree. We save the value of the hook for later use, and then reset it globally. +% \begin{macrocode} + \let\pstree@thisframe\pstree@frame + \global\let\pstree@frame\relax +% \end{macrocode} +% We save some variables that might be set globally, but whose values should be kept local to the tree, and a few other parameters that need to be restored if this is a subtree. +% \begin{macrocode} + \pstree@savevalues +% \end{macrocode} +% If we are in successor mode, then we need to skip levels before setting the graphics parameters. Levels are skipped at this point in the direction of the parent tree. +% \begin{macrocode} + \ifnum\psk@predmode=\m@ne + \let\pstree@saveskiplevels\z@ + \else + \ifnum\psskiplevels>\z@\else + \expandafter\pstree@checkskiplevels\pst@par,skiplevels=\z@,\@nil + \fi + \let\pstree@saveskiplevels\psskiplevels + \ifnum\psskiplevels>\z@ \pstree@skipprofile \fi + \fi +% \end{macrocode} +% Then we start a new group and set the graphics parameters. +% \begin{macrocode} + \use@par + \let\pstree@saveadjustbbox\psk@adjustbbox + \let\pstree@savetreerep\psk@treerep +% \end{macrocode} +% Initialize some things for aligning leaves. +% \begin{macrocode} + \if@leafaligntree + \chardef\pstree@savemaxlevel\pstree@maxlevel + \pstree@initleafalign + \else + \ifnum\psk@predmode=\psk@treemode\else + \chardef\pstree@savemaxlevel\pstree@maxlevel + \fi + \fi +% \end{macrocode} +% If we are in outer mode, or if we are in tree mode and the tree has changed directions, then we need to change "\pstree@id", because for adjusting the level sep, we have to think of this as a new tree. Recall that in outer mode, "\psk@predmode" equals $-1$. +% \begin{macrocode} + \ifnum\psk@predmode=\psk@treemode + \global\advance\pstree@ID\@ne + \edef\pstree@id{\the\pstree@ID}% + \fi +% \end{macrocode} +% We process the row, saving everything in "\pst@hbox": + \def\\{\pstree@endrow\pst@object{pstreecr}}% + \setbox\pstree@box\copy\voidb@x + \let\pst@thisbox\relax + \pst@makelongbox{}% + \pstree@treemode + \ignorespaces} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pstreecr} +% \begin{macrocode} +\def\pstreecr@i{% + \expandafter\pstree@checkskiplevels\pst@par,skiplevels=\z@,\@nil + \ifnum\psskiplevels>\z@ \pstree@skiplevelseps \fi + \pstree@initnestedpar + \use@par + \pstree@setlevelpar + \edef\pspred{\pstree@gettop\pstree@basenodes}% + \let\pst@thisbox\relax + \pst@makelongbox{}% + \pstree@treemode + \ignorespaces} +\def\psPred#1{\psPred@i#10\@nil} +\def\psPred@i#1#2\@nil{% + \expandafter\ifcase\expandafter#1% + \expandafter\psPred@ii\pstree@basenodes,,,,,,,,,\@nil} +\def\psPred@ii#1,#2,#3,#4,#5,#6,#7,#8,#9,{% + \or#1\or#2\or#3\or#4\or#5\or#6\or#7\or#8\or#9\fi\psPred@iii} +\def\psPred@iii#1\@nil{} +\def\pstree@skiplevelseps{% + \pst@cntg=\psskiplevels + \loop + \pstree@setlevelpar + \advance\pstree@cumlevelsep\psk@thislevelsep\relax + \edef\pstree@levelsizes{\pstree@levelsizes,\psk@thislevelsep,0,0}% + \advance\pstree@numlevels\@ne + \ifnum\pst@cntg>\@ne + \advance\pst@cntg\m@ne + \repeat} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pstree@endrow} +% The next three commands finish the construction of the tree by joining the root ("\pstree@box") and the successors ("\pst@hbox"). The tree is saved globally in "\pstree@box". +% \begin{macrocode} +\def\pstree@endrow{% + \pst@@killglue + \pst@endlongbox + \pstree@checkrow % Check for missing objects or extra space. + \ifvoid\pstree@box + \pstree@InitTreeDim + \else + \pstree@joinrows % Join root and successors in a box. + \pstree@joinprofiles % Adjust height, depth and profiles. + \fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\endpsTree} +% \begin{macrocode} +\def\endpsTree{% + \pstree@endrow +% \end{macrocode} +% "\pstree@thisframe" may add a frame, and adjust the dimensions for the frame. +% \begin{macrocode} + \pstree@thisframe +% \end{macrocode} +% If this is not a proper subtree, and the "levelsep" is variable, then it is time to write the level sizes to a file. +% \begin{macrocode} + \ifvarlevelsep + \ifnum\psk@predmode=\psk@treemode\else + \pstree@writelevelsizes + \fi + \fi +% \end{macrocode} +% If this is a LeafAlign tree, we write "\pstree@maxlevel". Also, we restore the value of "\pstree@maxlevel", if appropriate. +% \begin{macrocode} + \if@leafaligntree + \pstree@writemaxlevel + \global\chardef\pstree@maxlevel\pstree@savemaxlevel + \else + \ifnum\psk@predmode=\psk@treemode\else + \global\chardef\pstree@maxlevel\pstree@savemaxlevel + \fi + \fi +% \end{macrocode} +% Now we make the tree canonical, restore certain values for the predecessor tree, and add the tree to the current construction. +% \begin{macrocode} + \let\psk@adjustbbox\pstree@saveadjustbbox + \let\psk@treerep\pstree@savetreerep + \let\psskiplevels\pstree@saveskiplevels + \pstree@makecanonical + \pstree@restorevalues + \pstree@build + \ifnum\psk@treerep>\@ne\pstree@rep\fi + \global\let\pssucc\pstree@savedsucc + \endgroup + \ifnum\psk@predmode>\m@ne\expandafter\ignorespaces\fi} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\pstree@savevalues,\pstree@restorevalues} +% Certain accounting values are set globally, and so we have to save and later restore their values (in case this is a nested tree). There are other values that are not set globally, but which have to be restored when adding this tree to the current row. +% \begin{macrocode} +\def\pstree@savevalues{% + \edef\pstree@restorevalues{% + \pst@ngdef\psTREE@leftprofile + \pst@ngdef\psTREE@rightprofile + \pst@ngdef\psTREE@levelsizes + \pst@ngdef\psTREE@center + \pst@ngdef\psTREE@leftbase + \pst@ngdef\psTREE@rightbase + \pst@ngdef\psTREE@centerbase + \pst@ngdef\psTREE@rootnodes + \pst@ngdef\psTREE@basenodes + \pst@ngdef\psTREE@maxtreesep + \pst@ngdef\psTREE@numlevels + \pst@ngdef\psTREE@cumlevelsep + \global\psTREE@height=\the\psTREE@height\relax + \global\psTREE@depth=\the\psTREE@depth\relax + \global\psTREE@width=\the\psTREE@width\relax + \pst@ngdef\psTREE@addtreesep + \pst@ngdef\psk@thistreesep + \pst@ngdef\psk@thisxtreesep + \pst@ngdef\psk@thistreenodesize + \pst@ngdef\psk@thistreefit + \global\pstree@succID=\the\pstree@succID\relax}} +% \end{macrocode} +% Now we use this to initialize these commands, just in case something goes wrong. +% \begin{macro}{} +{\def\pst@ngdef#1{\gdef\noexpand#1{}}\pstree@savevalues\pstree@restorevalues} +% \end{macrocode} +% \end{macro} +% +% +% \section{Tree parameters} +% +% +% \begin{macro}{\psset@treemode,\psk@treemode} +% "treemode" refers to the direction that the tree grows. It is saved as an integer, with 0=down, 1=right, 2=up and 3=left. +% \begin{macrocode} +%%%??? Add error checking +\def\psset@treemode#1{% + \chardef\psk@treemode + \ifx#1U\@empty2\else\ifx#1R\@empty1\else\ifx#1L\@empty3\else\z@\fi\fi\fi + \relax} +\psset@treemode{D} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\psset@treeflip,\ifpstreeflip} +% "treeflip" determines the direction in which successors are added. When "false", successors are added from left to right for vertical trees, and from top to bottom for horizontal trees. When "true", the direction is switched. +% \begin{macrocode} +\newif\ifpstreeflip +\def\psset@treeflip#1{\@nameuse{pstreeflip#1}} +\psset@treeflip{false} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\psset@root} +% \begin{macrocode} +\def\psset@root#1{\def\psroot{#1}} +\psset@root{\TC} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pst@dimtoint} %???? MOVE +% \begin{macrocode} +\def\pst@dimtoint#1#2{% + \pssetlength\pst@dimg{#1}% + \edef#2{\number\pst@dimg}} +\def\pst@ngdef#1{\gdef\noexpand#1{#1}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro} +% {\psset@treesep,\psk@treesep,\psset@thistreesep,\psk@thistreesep} +% "treesep" is the distance between nodes on the same level. There is a "this" version that does not affect subtrees. +% \begin{macrocode} +\def\psset@treesep#1{\pst@dimtoint{#1}\psk@treesep} +\psset@treesep{.75cm} +\def\psset@thistreesep#1{\pst@dimtoint{#1}\psk@thistreesep} +% \end{macrocode} +% \end{macro} +% +% \begin{macro} +% {\psset@xtreesep,\psk@xtreesep,\psset@thisxtreesep,\psk@thisxtreesep} +% "xtreesep" is the additional distance between nodes that do not have the same predecessor. There is a "this" version that does not affect subtrees. +% \begin{macrocode} +\def\psset@xtreesep#1{\pst@dimtoint{#1}\psk@xtreesep} +\psset@xtreesep{0pt} +\def\psset@thisxtreesep#1{\pst@dimtoint{#1}\psk@thisxtreesep} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\psset@treenodesize,\psk@treenodesize, +% \psset@thistreenodesize,\psk@thistreenodesize} +% \begin{macrocode} +\def\psset@treenodesize#1{% + \pssetlength\pst@dimg{#1}% + \divide\pst@dimg\tw@ + \edef\psk@treenodesize{\number\pst@dimg}} +\psset@treenodesize{-1pt} +\def\psset@thistreenodesize#1{% + \pssetlength\pst@dimg{#1}% + \divide\pst@dimg\tw@ + \edef\psk@thistreenodesize{\number\pst@dimg}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\psset@treefit,\psk@treefit} +% \begin{macrocode} +\def\psset@treefit#1{% + \@ifundefined{pstree@#1fit}% + {\@pstrickserr{Bad `treefit' parameter value: `#1'}\@ehpa}% + {\edef\psk@treefit{#1}}}% +\psset@treefit{tight} +\def\psset@thistreefit#1{% + \@ifundefined{pstree@#1fit}% + {\@pstrickserr{Bad `treefit' parameter value: `#1'}\@ehpa}% + {\edef\psk@thistreefit{#1}}}% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\psset@treerep,\psk@treerep} +% \begin{macrocode} +\def\psset@treerep#1{\chardef\psk@treerep#1\relax} +\psset@treerep{1} +\def\pstree@rep{% + \ifnum\psk@treerep>\@ne + \pst@cntg\psk@treerep + \advance\pst@cntg\m@ne + \chardef\psk@treerep\pst@cntg + \pstree@build + \expandafter\pstree@rep + \fi} +% \end{macro} +% +% \begin{macro}{\psk@adjustbbox} +% The bounding box adjustment parameters define "\psk@adjustbbox" so that it changes "\pst@dima", etc. This is invoked must before nodes invoke "\psnode@makecanonical", or just after a tree is made into a canonical node. "\psk@adjustbbox". The values should not affect nested objects. +% \begin{macrocode} +\def\psk@adjustbbox{} +\def\pstree@setadjustbbox#1#2{% + \pssetlength\pst@dimg{#1}% + \edef\psk@adjustbbox{\psk@adjustbbox#2\number\pst@dimg sp\relax}} +\def\psset@bbl#1{\pstree@setadjustbbox{#1}{\pst@dima=}} +\def\psset@bbr#1{\pstree@setadjustbbox{#1}{\pst@dimb=}} +\def\psset@bbh#1{\pstree@setadjustbbox{#1}{\pst@dimc=}} +\def\psset@bbd#1{\pstree@setadjustbbox{#1}{\pst@dimd=}} +\def\psset@xbbl#1{\pstree@setadjustbbox{#1}{\advance\pst@dima}} +\def\psset@xbbr#1{\pstree@setadjustbbox{#1}{\advance\pst@dimb}} +\def\psset@xbbh#1{\pstree@setadjustbbox{#1}{\advance\pst@dimc}} +\def\psset@xbbd#1{\pstree@setadjustbbox{#1}{\advance\pst@dimd}} +% \end{macrocode} +% \end{macro} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\psset@showbbox,\psk@showbbox} +% \begin{macrocode} +\newif\ifpsshowbbox +\def\psset@showbbox#1{\@nameuse{psshowbbox#1}}% +\psset@showbbox{false} +\def\pstree@showbbox{% + \setbox\pstree@box=\hbox{% + \psset{linewidth=.1pt,linecolor=black,linestyle=solid,% + dimen=middle,fillstyle=none}% + \def\pst@par{}\@starfalse + \psframe@i(-\pst@dima,-\pst@dimd)(\pst@dimb,\pst@dimc)% + \box\pstree@box}}% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\psset@levelsep,\psk@levelsep} +% \begin{macrocode} +\def\psset@levelsep#1{\pst@dimtoint{#1}\psk@levelsep} +\psset@levelsep{2cm} +\def\psset@thislevelsep#1{\pst@dimtoint{#1}\psk@thislevelsep} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\psset@varlevelsep,\ifvarlevelsep} +% \begin{macrocode} +\newif\ifvarlevelsep +\def\psset@varlevelsep#1{% + \ifnum\psk@predmode=\psk@treemode + \@pstrickserr{varlevelsep cannot be changed for proper subtrees}\@ehpa + \else + \@nameuse{varlevelsep#1}% + \fi} +\let\psk@predmode\m@ne +\let\if@predflip\iffalse +\psset@varlevelsep{false} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\psset@treeshift,\psk@treeshift} +% \begin{macrocode} +\def\psset@treeshift#1{% + \pssetlength\pst@dimg{#1}% + \pst@dimg-\pst@dimg + \edef\psk@treeshift{\number\pst@dimg}} +\psset@treeshift{0} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\psset@skiplevels,\psskiplevels} +% \begin{macrocode} +\def\psset@skiplevels#1{\chardef\psskiplevels#1\relax} +\psset@skiplevels{0} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\def\pstree@initnestedpar} +% This initialized the values of parameters that should not affect nested objects. +% \begin{macrocode} +\def\pstree@initnestedpar{% + \def\psk@adjustbbox{}% + \let\psk@treeshift\z@ + \chardef\psskiplevels\z@ + \chardef\psk@treerep\@ne + \def\psk@thislevelsep{\psk@levelsep}% + \def\psk@thistreesep{\psk@treesep}% + \def\psk@thisxtreesep{\psk@xtreesep}% + \def\psk@thistreenodesize{\psk@treenodesize}% + \def\psk@thistreefit{\psk@treefit}% + \def\psk@thisunary{\psk@unary}% + \let\if@leafaligntree\iffalse} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pstree@setlevelpar} +% \begin{macrocode} +\def\pstree@setlevelpar{% + \advance\pstree@levelID\@ne + \csname pstreehook\romannumeral\pstree@levelID\endcsname + \ifvarlevelsep + \ifnum\psk@predmode=\psk@treemode\else + \pstree@initadjustlevelsep + \fi + \pstree@adjustlevelsep + \fi + \edef\pst@tposflip{\ifnum\psk@treemode>\@ne 1 sub neg \fi}}% +% \end{macrocode} +% \end{macro} +% +% +% \section{Outer mode} +% +% \begin{macro}{\pstree@build@outer,\psnode@makecanonical@outer} +% The canonical outer object is a node. +% \begin{macrocode} +\def\pstree@build@outer{% + \leavevmode + \hbox{% + \vrule height \pst@dimc depth \pst@dimd width \z@ + \kern\pst@dima + \ifnum\psk@treerep>\@ne\copy\else\box\fi\pstree@box + \kern\pst@dimb}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pstree@makecanonical@outer} +% "\pstree@makecanonical@outer" converts trees to nodes. What the left and right profiles correspond to depends on whether the tree is horizontal or vertical, and on whether the tree is flipped. What the tree height and depth correspond to depends on the "treemode". +% +% When a tree is in mode, it may adjust its bounding box. +% \begin{macrocode} +\def\pstree@makecanonical@outer{% + \pstree@gettreebbox + \ifx\pstree@center\@empty + \pst@dimg\pstree@width sp + \divide\pst@dimg\tw@ + \else + \pst@dimg\pstree@center sp + \fi + \ifnum\pst@dimg=\z@\else + \advance\pst@dima\pst@dimg + \advance\pst@dimb-\pst@dimg + \ifodd\psk@treemode + \setbox\pstree@box\hbox{% + \ifpstreeflip\lower\else\raise\fi\pst@dimg\box\pstree@box}% + \else + \setbox\pstree@box\hbox{% + \kern\ifpstreeflip\else-\fi\pst@dimg\unhbox\pstree@box}% + \fi + \fi + \wd\pstree@box=\z@ + \dp\pstree@box=\z@ + \ht\pstree@box=\z@} +\def\pstree@gettreebbox{% + \pstree@max\pstree@leftprofile\pst@cnta + \pstree@max\pstree@rightprofile\pst@cntb + \advance\pst@cntb\pstree@width + \ifodd\psk@treemode + \ifpstreeflip + \pst@dimc\pst@cntb sp + \pst@dimd\pst@cnta sp + \else + \pst@dimc\pst@cnta sp + \pst@dimd\pst@cntb sp + \fi + \else + \ifpstreeflip + \pst@dima\pst@cntb sp + \pst@dimb\pst@cnta sp + \else + \pst@dima\pst@cnta sp + \pst@dimb\pst@cntb sp + \fi + \fi + \ifcase\psk@treemode + \pst@dimc\pstree@height sp + \pst@dimd\pstree@depth sp + \or + \pst@dima\pstree@height sp + \pst@dimb\pstree@depth sp + \or + \pst@dimc\pstree@depth sp + \pst@dimd\pstree@height sp + \or + \pst@dima\pstree@depth sp + \pst@dimb\pstree@height sp + \fi + \psk@adjustbbox + \ifpsshowbbox \pstree@showbbox \fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pstree@outermode} +% "\pstree@outermode" sets up some values that should be in effect for outer trees. A tree is "outer" is it is not nested inside any tree, or if it is inside any box other than a tree row (e.g., in a "\TR" node, or a label command). This means that "\pstree@outer" must be exected once below (for trees that are not nested inside any tree), and then "\pst@thisbox" is set to "\pstree@outer" inside a tree row. +% +% "\pst@tposflip" is a hook in the "tput" commands defined in "pst-node.tex" that flips the value of the positioning argument for trees, so that the number always refers to the distance from the predecessor node to successor node. This is initialized within trees, but in outer mode we want to disable the hook. +% +% "\pst@shortput" is also given a special meaning in trees, and we have to restore its value when entering outer mode. +% +% "\psk@bboxadust" stores the bounding box adjust parameters. We do not want these parameters to affect nested objects. +% +% Since "\pst@thisbox" may be set to "\pstree@outermode", the latter must reset "\pst@thisbox". +% +% Setting "\psk@predmode" to "\m@ne" is a useful flag for outer mode. +% \begin{macrocode} +\newif\ifpstree@outer +\def\pstree@outermode{% + \pstree@outertrue + \let\pstree@makecanonical\pstree@makecanonical@outer + \let\psnode@makecanonical\relax + \let\pstree@build\pstree@build@outer + \let\psk@predmode\m@ne + \pstree@levelID=\z@ + \chardef\pstree@maxlevel\z@ + \let\pstree@themaxlevel\relax + \def\pstree@id{outer}% + \def\pst@tposflip{}% + \let\pst@shortput\pstree@savedshortput + \pstree@initnestedpar + \let\pst@thisbox\relax} +\let\pstree@savedshortput\pst@shortput +\pstree@outermode +% \end{macrocode} +% \end{macro} +% +% \section{Constructing a row a successors} +% +% This described the process for the canonical tree row object. +% +% \begin{macro}{\pstree@succmode} +% \begin{macrocode} +\def\pstree@treemode{% + \let\pstree@makecanonical\pstree@makecanonical@succ + \let\psnode@makecanonical\psnode@makecanonical@succ + \let\pstree@build\pstree@build@succ + \pstree@initnestedpar + \global\pstree@succID=\@ne + \gdef\psTREE@addtreesep{\z@}% + \global\let\pstree@center\@empty + \global\let\psTREE@centerbase\@empty + \let\psk@predmode\psk@treemode + \let\if@predflip\ifpstreeflip + \let\pst@thisbox\pstree@outermode} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pstree@build@succ} +% First we actually skip the levels, if necessary. +% \begin{macrocode} +\def\pstree@build@succ{% + \ifnum\psskiplevels>\z@ \pstree@skiplevels \fi +% \end{macrocode} +% If "\pstree@succID=1", indicating that this is the first successor, the successor row dimensions are simply initialized. +% \begin{macrocode} + \ifnum\pstree@succID=\@ne + \ifnum\psk@treerep>\@ne\copy\else\box\fi\pstree@box + \pstree@initrowdim +% \end{macrocode} +% Otherwise, "\pstree@fit" sets "\psTREE@sep" to the distance between the centers of the previous and current successors, sets "\psTREE@width" to the total distance from the center of the first to the last successor, and updates the profiles. Then we position the current succcessor. +% \begin{macrocode} + \else + \pstree@fit + \ifodd\psk@predmode + \if@predflip\raise\else\lower\fi\psTREE@width sp + \else + \kern\if@predflip-\fi\psTREE@sep sp + \fi + \ifnum\psk@treerep>\@ne\copy\else\box\fi\pstree@box + \pstree@UpdateRowDim + \fi + \ifodd\psk@predmode\else + \pst@dimg=\pstree@width sp + \kern\if@predflip-\fi\pst@dimg + \fi +% \end{macrocode} +% Now we update the row dimensions. +% \begin{macrocode} + \global\advance\pstree@succID\@ne} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pstree@initrowdim} +% The first successor's dimensions become the row's dimensions. +% \begin{macrocode} +\def\pstree@initrowdim{% + \global\let\psTREE@leftprofile\pstree@leftprofile + \global\let\psTREE@rightprofile\pstree@rightprofile + \global\let\psTREE@levelsizes\pstree@levelsizes + \global\psTREE@height\pstree@height\relax + \global\psTREE@depth\pstree@depth\relax + \global\psTREE@width\pstree@width\relax + \global\let\psTREE@maxtreesep\pstree@maxtreesep + \global\let\psTREE@center\pstree@center + \xdef\psTREE@numlevels{\the\pstree@numlevels}% + \xdef\psTREE@cumlevelsep{\the\pstree@cumlevelsep}% + \global\let\psTREE@leftbase\pstree@leftbase + \global\let\psTREE@rightbase\pstree@rightbase + \global\let\psTREE@centerbase\pstree@centerbase + \global\let\psTREE@rootnodes\pstree@rootnodes + \global\let\psTREE@basenodes\pstree@basenodes} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pstree@fit} +% First we calculate the distance between successors: +% \begin{macrocode} +\def\pstree@fit{% + \csname pstree@\psk@thistreefit fit\endcsname + \psTREE@rightprofile\pstree@leftprofile\psTREE@sep +% \end{macrocode} +% Then we add the "treesep", the width of the new object, and any extra space inserted by "\addtreesep". +% \begin{macrocode} + \advance\psTREE@sep\psk@thistreesep\relax + \ifnum\psTREE@maxtreesep<\psTREE@sep + \xdef\psTREE@maxtreesep{\the\psTREE@sep}% + \fi + \advance\psTREE@sep\psTREE@addtreesep\relax + \gdef\psTREE@addtreesep{\z@}% + \global\advance\psTREE@width\psTREE@sep} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pstree@UpdateRowDim} +% Now we update the row's dimensions. +% \begin{macrocode} +\def\pstree@UpdateRowDim{% + \ifnum\psTREE@maxtreesep<\pstree@maxtreesep\relax + \let\psTREE@maxtreesep\pstree@maxtreesep + \fi + \advance\psTREE@sep\psTREE@width + \pstree@zip\psTREE@sep + \psTREE@rightprofile\pstree@rightprofile\psTREE@rightprofile + \pstree@zip\psTREE@width + \pstree@leftprofile\psTREE@leftprofile\psTREE@leftprofile + \global\advance\psTREE@width\pstree@width + \pstree@bimax\psTREE@levelsizes\pstree@levelsizes + \ifnum\pstree@height>\psTREE@height + \global\psTREE@height\pstree@height\relax + \fi + \ifnum\pstree@depth>\psTREE@depth + \global\psTREE@depth\pstree@depth\relax + \fi + \ifx\pstree@center\@empty\else + \pst@cntg=\psTREE@width + \advance\pst@cntg\pstree@center + \xdef\psTREE@center{\the\pst@cntg}% + \fi + \xdef\psTREE@rootnodes{\psTREE@rootnodes\pstree@rootnodes}% + \ifnum\pstree@numlevels<\psTREE@numlevels\else + \global\let\psTREE@rightbase\pstree@rightbase + \ifx\pstree@centerbase\@empty\else + \pst@cntg=\pstree@centerbase\relax + \advance\pst@cntg\psTREE@width + \xdef\psTREE@centerbase{\the\pst@cntg}% + \fi + \ifnum\pstree@numlevels>\psTREE@numlevels\relax + \global\let\psTREE@basenodes\pstree@basenodes + \xdef\psTREE@numlevels{\the\pstree@numlevels}% + \xdef\psTREE@cumlevelsep{\the\pstree@cumlevelsep}% + \pst@cntg=\pstree@leftbase\relax + \advance\pst@cntg-\psTREE@width + \xdef\psTREE@leftbase{\the\pst@cntg}% + \else + \xdef\psTREE@basenodes{\psTREE@basenodes\pstree@basenodes}% + \fi + \fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\treecenter} +% "\treecenter" just remembers the current width of the row of successors. +% \begin{macrocode} +\def\treecenter{\xdef\psTREE@center{\the\psTREE@width}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\addtreesep} +% \begin{macrocode} +\def\addtreesep#1{% + \pssetlength\pst@dimg{#1}% + \xdef\psTREE@addtreesep{\number\pst@dimg}% + \ignorespaces} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pstree@checkrow} +% "\pstree@checkrow" checks that the row has at least one successor, and that the row doesn't have extraneous space. +% \begin{macrocode} +\def\pstree@checkrow{% + \ifnum\pstree@succID=\@ne + \pst@makelongbox + \pstree@treemode + \psroot{\box\pst@hbox}% + \ifnum\pstree@succID=\@ne\Tn\fi + \pst@endlongbox + \fi + \ifnum\wd\pst@hbox=% + \ifodd\psk@treemode\z@\else\ifpstreeflip-\fi\psTREE@width\fi + \else + \@pstrickserr{Extraneous space in tree row + (Level \the\pstree@levelID)}\@ehpa + \fi + \wd\pst@hbox=\z@ + \ht\pst@hbox=\z@ + \dp\pst@hbox=\z@} +% \end{macrocode} +% \end{macro} +% +% +% \section{Making canonical successors} +% +% "\psk@treemode" and "\ifpstreeflip" are the successor tree's "treemode" and "treeflip", and "\psk@predmode" and "\if@predflip" are the successor tree's "treemode" and "treeflip". +% +% \begin{macro}{\psnode@makecanonical@succ} +% Terminal nodes are made into single-level trees. Because \TeX\ is pretty fast at processing conditionals, this should not take so long. Good thing, because terminal nodes are pretty common! +% \begin{macrocode} +\def\psnode@makecanonical@succ{% + \edef\pstree@height{% + \number + \ifcase\psk@predmode\pst@dimc\or\pst@dima\or\pst@dimd\or\pst@dimb\fi}% + \edef\pstree@depth{% + \number + \ifcase\psk@predmode\pst@dimd\or\pst@dimb\or\pst@dimc\or\pst@dima\fi}% + \edef\pstree@leftprofile{% + \number + \ifodd\psk@predmode + \if@predflip\pst@dimd\else\pst@dimc\fi + \else + \if@predflip\pst@dimb\else\pst@dima\fi + \fi,}% + \edef\pstree@rightprofile{% + \number + \ifodd\psk@predmode + \if@predflip\pst@dimc\else\pst@dimd\fi + \else + \if@predflip\pst@dima\else\pst@dimb\fi + \fi,}% + \edef\pstree@levelsizes{\pstree@height,\pstree@depth,}% + \pstree@numlevels\@ne + \pstree@cumlevelsep\z@ + \chardef\pstree@width\z@ + \let\pstree@center\@empty + \def\pstree@leftbase{\z@}% + \def\pstree@rightbase{\z@}% + \let\pstree@centerbase\@empty + \edef\pstree@rootnodes{\pssucc,}% + \let\pstree@basenodes\pstree@rootnodes + \def\pstree@maxtreesep{\z@}% + %%%% FIX ME?? + \ifnum\psskiplevels>\z@ + \let\pstree@saveskiplevels\psskiplevels + \pstree@skipprofile + \pstree@cumlevelsep\pstree@skiplevelsep\relax + \pst@cntg=\pstree@depth + \advance\pst@cntg\pstree@cumlevelsep + \edef\pstree@depth{\the\pst@cntg}% + \ifnum\pstree@height>\pstree@cumlevelsep + \pst@cntg=\pstree@height\relax + \advance\pst@cntg-\pstree@cumlevelsep + \edef\pstree@height{\the\pst@cntg}% + \else + \def\pstree@height{0}% + \fi + \let\psskiplevels\pstree@saveskiplevels + \fi + \ifleafalign\pstree@alignleaf\fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pstree@makecanonical@succ} +% \begin{macrocode} +% The canonical successor is a subtree with the same orientation as the tree within which it is nested. Flipped trees of the same type are also easy. +% \begin{macrocode} +\def\pstree@makecanonical@succ{% + \ifnum\psk@treemode=\psk@predmode + \pstree@@makecanonical@succ +% \end{macrocode} +% Subtrees of a different type are first converted to canonical outer objects (and in the process, the bounding box may be adjusted), and then they are converted to canonical successor objects as if they were nodes. This is not the most efficient, but such rotated subtrees are not so common. A direct conversion would be faster, but would still involve extensive macros. +% \begin{macrocode} + \else + \pstree@makecanonical@outer + \def\pssucc,{\pstree@rootnodes}% + \psnode@makecanonical@succ + \fi} +% \end{macrocode} +% "\psk@treemode" and "\ifpstreeflip" are for the subtree. "\psk@predmode" and "\ifps@predflip" are for the predecessor tree. +% \begin{macrocode} +\def\pstree@@makecanonical@succ{% + \ifx\psk@adjustbbox\@empty\else + \@pstrickserr{You cannot adjust a proper subtree's bounding box}\@ehpa + \let\psk@adjustbbox\relax + \fi + \ifx\ifpstreeflip\if@predflip\else + \pstree@@@makecanonical@succ + \fi + \ifpsshowbbox \pstree@gettreebbox \fi} +\def\pstree@@@makecanonical@succ{% + \let\pst@tempg\pstree@leftprofile + \let\pstree@leftprofile\pstree@rightprofile + \let\pstree@rightprofile\pst@tempg + \let\pst@tempg\pstree@leftbase + \let\pstree@leftbase\pstree@rightbase + \let\pstree@rightbase\pst@tempg + \ifnum\pstree@width=\z@\else + \pst@dimg=\pstree@width sp + \multiply\pst@dimg\m@ne + \ifodd\psk@treemode + \setbox\pstree@box=\hbox{\raise\pst@dimg\box\pstree@box}% + \else + \setbox\pstree@box=\hbox to \pst@dimg{% + \kern\pst@dimg\unhbox\pstree@box\hss}% + \fi + \fi + \ifx\pstree@center\@empty\else + \pst@cntg\pstree@width + \advance\pst@cntg-\pstree@center\relax + \edef\pstree@center{\the\pst@cntg}% + \fi} +% \end{macrocode} +% \end{macro} +% +% +% \section{Joining rows} +% +% \begin{macro}{\pstree@InitTreeDim} +% The first successor's dimensions become the row's dimensions. +% \begin{macrocode} +\def\pstree@InitTreeDim{% + \setbox\pstree@box\box\pst@hbox + \let\pstree@leftprofile\psTREE@leftprofile + \let\pstree@rightprofile\psTREE@rightprofile + \let\pstree@levelsizes\psTREE@levelsizes + \edef\pstree@height{\the\psTREE@height}% + \edef\pstree@depth{\the\psTREE@depth}% + \edef\pstree@width{\the\psTREE@width}% + \let\pstree@maxtreesep\psTREE@maxtreesep + \let\pstree@center\psTREE@center + \pstree@numlevels\psTREE@numlevels\relax + \pstree@cumlevelsep\psTREE@cumlevelsep\relax + \let\pstree@leftbase\psTREE@leftbase + \let\pstree@rightbase\psTREE@rightbase + \let\pstree@centerbase\psTREE@centerbase + \let\pstree@rootnodes\psTREE@rootnodes + \let\pstree@basenodes\psTREE@basenodes} +% \end{macrocode} +% \end{macro} +% +% After a row has been processed, the left profiles are with respect to the center of the leftmost toplevel node, the right profiles are with respect to the center of the rightmost toplevel node, and "\psTREE@width" is the distance between the centers of the two extreme toplevel nodes. The row box's current point is the center of the leftmost toplevel node. That is, it is a tree! The previous rows have also been joined into a tree. Here is how we join two trees together, one on top of the other. +% +% Fist, we calculate the distance between the current point of the previous rows and the current point of the next row. We are matching the center of the base of the top row with the center of the root of the bottom row. +% +% +% \begin{macro}{\pstree@setsucccenter} +% \begin{macrocode} +% "\pstree@setsucccenter" shifts the row's current point to the row's true center (either the midpoint between the two extreme successors or distance "\pstree@center" from the leftmost successor, adjusted by "treeshift"), and then adjust the profiles so that they are with respect to this center. +% +% First, find the distance from the left successor to the center, for the top of the bottom row. +% \begin{macrocode} +\def\pstree@joinrows{% + \ifnum\pstree@succID=\@ne + \csname pstree@unarycenter@\psk@thisunary\endcsname + \else + \ifx\psTREE@center\@empty + \pst@cnta\psTREE@width + \divide\pst@cnta\tw@ + \else + \pst@cnta\psTREE@center\relax + \fi + \fi + \advance\pst@cnta\psk@treeshift\relax +% \end{macrocode} +% Now do the same for bottom of the top row: +% \begin{macrocode} + \ifx\pstree@centerbase\@empty + \psTREE@sep\pstree@leftbase + \multiply\psTREE@sep\m@ne + \advance\psTREE@sep\pstree@rightbase + \advance\psTREE@sep\pstree@width + \divide\psTREE@sep\tw@ + \else + \psTREE@sep\pstree@centerbase\relax + \fi +% \end{macrocode} +% Now find the distance between the current points, after alignment: +% \begin{macrocode} + \advance\psTREE@sep-\pst@cnta +% \end{macrocode} +% Join the rows: +% \begin{macrocode} + \advance\pstree@cumlevelsep\psk@thislevelsep\relax + \ifodd\psk@treemode + \setbox\pstree@box=\hbox{% + \box\pstree@box + \kern\ifnum\psk@treemode=\thr@@-\fi\pstree@cumlevelsep sp + \ifpstreeflip\raise\else\lower\fi\psTREE@sep sp\box\pst@hbox}% + \else + \setbox\pstree@box=\hbox{% + \box\pstree@box + \kern\ifpstreeflip-\fi\psTREE@sep sp + \ifnum\psk@treemode=\z@\lower\else\raise\fi\pstree@cumlevelsep sp + \box\pst@hbox}% + \fi + \wd\pstree@box=\z@ + \ht\pstree@box=\z@ + \dp\pstree@box=\z@} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pstree@joinprofiles} +% Adjust the profiles. +% \begin{macrocode} +\def\pstree@joinprofiles{% + \ifnum\psskiplevels>\z@ \pstree@skiprowprofiles \fi + \pst@cnta=-\psTREE@sep + \pstree@add\pst@cnta\psTREE@leftprofile + \advance\pst@cnta\psTREE@leftbase + \edef\pstree@leftbase{\the\pst@cnta}% + \edef\pstree@leftprofile{\pstree@leftprofile\psTREE@leftprofile}% + \ifx\psTREE@centerbase\@empty\else + \pst@cnta=\psTREE@sep + \advance\pst@cnta\psTREE@centerbase + \edef\pstree@centerbase{\the\pst@cnta}% + \else + \let\pstree@centerbase\@empty + \fi + \advance\psTREE@width-\pstree@width + \advance\psTREE@width\psTREE@sep + \pstree@add\psTREE@width\psTREE@rightprofile + \edef\pstree@rightprofile{\pstree@rightprofile\psTREE@rightprofile}% + \advance\psTREE@width\psTREE@rightbase + \edef\pstree@rightbase{\the\psTREE@width}% + \edef\pstree@levelsizes{% + \pstree@levelsizes\psk@thislevelsep,\psTREE@levelsizes}% +% \end{macrocode} +% Then we calculate the resulting height and depth of the tree. +% \begin{macrocode} + \advance\psTREE@height-\pstree@cumlevelsep + \ifnum\pstree@height<\psTREE@height + \edef\pstree@height{\the\psTREE@height}% + \fi + \advance\psTREE@depth\pstree@cumlevelsep + \ifnum\pstree@depth<\psTREE@depth + \edef\pstree@depth{\the\psTREE@depth}% + \fi + \advance\pstree@numlevels\psTREE@numlevels\relax + \let\pstree@basenodes\psTREE@basenodes} +\def\pstree@skiprowprofiles{% + \pst@cntc-\psTREE@sep + \pst@cntd\pstree@leftbase\relax + \advance\pst@cntc-\pst@cntd + \pst@cnta\psTREE@width + \advance\pst@cnta\psTREE@sep + \advance\pst@cnta-\pstree@width + \pst@cntb=\pstree@rightbase + \advance\pst@cnta-\pst@cntb + \pst@cntg\psskiplevels + \advance\pst@cntg\@ne + \divide\pst@cntc\pst@cntg + \divide\pst@cnta\pst@cntg + \loop + \advance\pst@cntd\pst@cntc + \advance\pst@cntb\pst@cnta + \edef\pstree@leftprofile{\pstree@leftprofile\the\pst@cntd,}% + \edef\pstree@rightprofile{\pstree@rightprofile\the\pst@cntb,}% + \ifnum\pst@cntg>\tw@ + \advance\pst@cntg\m@ne + \repeat} +% \end{macrocode} +% \end{macro} +% +% +% \section{Binary trees} +% +% \begin{macro}{\pstree@unarycenter@left,\pstree@unarycenter@right} +% \begin{macrocode} +\def\pstree@unarycenter@middle{\pst@cnta=\z@} +\def\pstree@unarycenter@left{% + \pst@cnta\pstree@thistreesep\relax + \divide\pst@cnta\tw@ + \advance\pst@cnta + \ifnum\psk@thistreenodesize<\z@ + \pstree@gettop\psTREE@rightprofile + \else + \psk@thistreenodesize + \fi + \relax}% +\def\pstree@unarycenter@right{% + \pst@cnta\pstree@thistreesep\relax + \divide\pst@cnta\tw@ + \advance\pst@cnta + \ifnum\psk@thistreenodesize<\z@ + \pstree@gettop\psTREE@leftprofile + \else + \psk@thistreenodesize + \fi + \multiply\pst@cnta\m@ne}% +\def\pstree@unarycenter@leftternary{% + \pst@cnta=% + \ifnum\psk@thistreenodesize<\z@ + \pstree@gettop\psTREE@rightprofile + \else + \psk@thistreenodesize + \fi + \multiply\pst@cnta\tw@ + \advance\pst@cnta\pstree@thistreesep\relax}% +\def\pstree@unarycenter@rightternary{% + \pst@cnta=% + \ifnum\psk@thistreenodesize<\z@ + \pstree@gettop\psTREE@leftprofile + \else + \psk@thistreenodesize + \fi + \multiply\pst@cnta\tw@ + \advance\pst@cnta\pstree@thistreesep + \multiply\pst@cnta\m@ne}% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\psset@unary,\psk@unary} +% \begin{macrocode} +\def\psset@unary#1{% + \@ifundefined{pstree@unarycenter@#1}% + {\@pstrickserr{Bad unary parameter: `#1'}\@ehpa}% + {\def\psk@unary{#1}}} +\psset@unary{middle} +\def\psset@thisunary#1{% + \@ifundefined{pstree@unarycenter@#1}% + {\@pstrickserr{Bad unary parameter: `#1'}\@ehpa}% + {\def\psk@thisunary{#1}}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\psltree,\psrtree} +% \begin{macrocode} +\newpsobject{psltree}{pstree}{thisunary=left} +\newpsobject{psrtree}{pstree}{thisunary=right} +% \end{macrocode} +% \end{macro} +% +% \section{Skip levels} +% +% \begin{macro}{\pstree@checkskiplevels} +% \begin{macrocode} +\def\pstree@checkskiplevels#1skiplevels=#2,#3\@nil{% + \chardef\psskiplevels#2\relax} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\pstree@skipprofile} +% \begin{macrocode} +\def\pstree@skipprofile{% + \ifnum\psk@predmode=\m@ne + \@pstrickserr{You can only skip levels in the successors of a tree}\@ehpa + \else + \pst@cnta=\psskiplevels + \pst@cntb=\z@ + \def\pstree@skiplevelsizes{}% + \def\pstree@skiplevelprofiles{}% + \pstree@@skipprofile + \edef\pstree@skiplevelsep{\the\pst@cntb}% + \fi} +\def\pstree@@skipprofile{% + \advance\pstree@levelID\@ne + \csname pstreehook\romannumeral\pstree@levelID\endcsname + \ifvarlevelsep \pstree@adjustlevelsep \fi + \edef\pstree@skiplevelsizes{\pstree@skiplevelsizes\psk@thislevelsep,0,0}% + \edef\pstree@skiplevelprofiles{0,\pstree@skiplevelprofiles}% + \advance\pst@cntb\psk@thislevelsep\relax + \pstree@initnestedpar + \advance\pst@cnta\m@ne + \ifnum\pst@cnta>\z@ \expandafter\pstree@@skipprofile \fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\def\pstree@skiplevels{% + \ifx\pstree@center\@empty + \pst@cnta\pstree@width + \divide\pst@cnta\tw@ + \else + \pst@cnta\pstree@center\relax + \fi + \advance\pstree@cumlevelsep\pstree@skiplevelsep\relax + \ifodd\psk@treemode + \setbox\pstree@box=\hbox{% + \kern\ifnum\psk@treemode=\thr@@-\fi\pstree@skiplevelsep sp + \ifpstreeflip\lower\else\raise\fi\pst@cnta sp\box\pstree@box}% + \else + \setbox\pstree@box=\hbox{% + \kern\ifpstreeflip-\fi\pst@cnta sp + \ifnum\psk@treemode=\z@\lower\else\raise\fi\pstree@skiplevelsep sp + \box\pstree@box}% + \fi + \wd\pstree@box=\z@ + \ht\pstree@box=\z@ + \dp\pstree@box=\z@ +% Left profiles + \ifnum\pst@cnta=\z@\else\pstree@add\pst@cnta\pstree@leftprofile\fi + \pst@cntb\pstree@leftbase + \advance\pst@cntb\pst@cnta + \edef\pstree@leftbase{\the\pst@cntb}% + \edef\pstree@leftprofile{\pstree@skiplevelprofiles\pstree@leftprofile}% + \ifx\pstree@centerbase\@empty\else + \pst@cntb\pstree@centerbase + \advance\pst@cntb-\pst@cnta + \edef\pstree@centerbase{\the\pst@cntb}% + \fi + \pst@cntb\pstree@width + \advance\pst@cntb-\pst@cnta + \ifnum\pst@cntb=\z@\else\pstree@add\pst@cntb\pstree@rightprofile\fi + \edef\pstree@rightprofile{\pstree@skiplevelprofiles\pstree@rightprofile}% + \advance\pst@cntb\pstree@rightbase + \edef\pstree@rightbase{\the\pst@cntb}% + \edef\pstree@levelsizes{\pstree@skiplevelsizes\pstree@levelsizes}% + \ifnum\pstree@height>\pstree@skiplevelsep\relax + \pst@cntb\pstree@skiplevelsep\relax + \multiply\pst@cntb\m@ne + \advance\pst@cntb\pstree@height + \edef\pstree@height{\the\pst@cntb}% + \else + \def\pstree@height{\z@}% + \fi + \advance\pstree@numlevels\psskiplevels + \def\pstree@width{0}% + \def\pstree@center{}} +% +% \section{Variable level sep} +% +% \begin{macro}{\pstree@initauxout} +% \begin{macrocode} +\def\pstree@initauxout{% + \@ifundefined{@latexerr}{% + \immediate\openin1 \jobname.pst + \ifeof1 \else + {\catcode`\@=11 \input \jobname.pst}% + \fi + \immediate\closein1 + \global\csname newwrite\endcsname\pstree@auxout + \immediate\openout\pstree@auxout \jobname.pst }% + {\global\let\pstree@auxout\@auxout}% + \global\let\pstree@initauxout\relax} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pstree@writelevelsizes} +% \begin{macrocode} +\def\pstree@writelevelsizes{% + \ifx\if@filesw\iffalse\else + \pstree@getlevelsizes + \immediate\write\pstree@auxout{% + \string\global\string\@namedef{pstree@levelsizes@\pstree@id}% + {\pst@tempg}}% + \fi} +\def\pstree@getlevelsizes{% + \def\pst@tempg{}% + \expandafter\pstree@@getlevelsizes\psTREE@levelsizes\relax} +\def\pstree@@getlevelsizes#1,#2,#3,#4,#5,#6{% + \pst@cntg=#2\relax + \advance\pst@cntg#4\relax + \edef\pst@tempg{\pst@tempg\the\pst@cntg,}% + \ifx\relax#6\else + \def\next{\pstree@@getlevelsizes,#5,#6}% + \expandafter\next + \fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pstree@initadjustlevelsep} +% \begin{macrocode} +\def\pstree@initadjustlevelsep{% + \pstree@initauxout + \expandafter\let\expandafter\pstree@thelevelsizes + \csname pstree@levelsizes@\pstree@id\endcsname + \ifx\pstree@thelevelsizes\relax + \def\pstree@thelevelsizes{0,}% + \fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pstree@adjustlevelsep} +% \begin{macrocode} +\def\pstree@adjustlevelsep{% + \pstree@poptop\pstree@thelevelsizes\pst@cntg + \advance\pst@cntg\psk@thislevelsep\relax + \edef\psk@thislevelsep{\the\pst@cntg}} +% \end{macrocode} +% \end{macro} +% +% +% \section{Leaf alignment} +% +% \begin{macro}{\psset@leafalign,\ifleafalign} +% Call a tree whose terminal nodes should be aligned at the bottom of the tree a ``LeafAlign'' tree. +% +% In a LeafAlign tree, terminal nodes should align themselves by skipping levels, whenever "leafalign" is "true". The LeafAlign tree sets "\pstree@themaxlevel" to the number of the lowest level in the tree. When "leafalign" is "true", terminal nodes in the LeafAlign tree skip enough levels so that they end up at level "\pstree@themaxlevel". +% +% Setting "leafalign=true" has two effects. First, subsequent nodes take care of skipping levels. Second, top level tree or trees in the scope of the parameter setting become LeafAlign trees. "\psset@leafalign" sets "\if@leafaligntree" to "\iftrue", and this is reset to "\iffalse" by "\pstree@initnestedpar". +% \begin{macrocode} +\newif\ifleafalign +\def\psset@leafalign#1{% + \@nameuse{leafalign#1}% + \let\if@leafaligntree\ifleafalign} +\psset@leafalign{false} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pstree@alignleaf} +% This is invoked by "\psnode@makecanonical@succ" (i.e., by terminal nodes), when "leafalign" is true. +% +% We keep track of the number of the lowest level in a tree with "\pstree@maxlevel". This is set with "\chardef". +% +% The the terminal node skips as many levels as are needed. +% \begin{macrocode} +\def\pstree@alignleaf{% + \ifnum\pstree@maxlevel<\pstree@levelID + \global\chardef\pstree@maxlevel\pstree@levelID + \fi + \ifx\pstree@themaxlevel\relax\else + \ifnum\psskiplevels>\z@\else + \ifnum\pstree@themaxlevel>\pstree@levelID + \pst@cntg=\pstree@themaxlevel + \advance\pst@cntg-\pstree@levelID + \chardef\psskiplevels\pst@cntg + \pstree@saveskiplevels\psskiplevels + \pstree@skipprofile + \let\psskiplevels\pstree@saveskiplevels + \fi + \fi + \fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pstree@writemaxlevel} +% When a LeafAlign tree finishes processing its successors, it writes "\pstree@maxlevel" to a file. +% \begin{macrocode} +% \begin{macrocode} +\def\pstree@writemaxlevel{% + \ifx\if@filesw\iffalse\else + \immediate\write\pstree@auxout{% + \string\global\string\@namedef{pstree@maxlevel@% + \pstree@id-\the\pstree@levelID-\the\pstree@succID}% + {\the\pstree@maxlevel}}% + \fi} +% \end{macrocode} +% +% \begin{macro}{\pstree@writemaxlevel} +% \begin{macrocode} +% Before processing its successors, a LeafAlign tree looks for the value of "\pstree@maxlevel" that it might have written to the file, and assigns the value to "\pstree@themaxlevel": +\def\pstree@initleafalign{% + \pstree@initauxout + \expandafter\let\expandafter\pstree@themaxlevel + \csname + pstree@maxlevel@% + \pstree@id-\the\pstree@levelID-\the\pstree@succID + \endcsname +% \end{macrocode} +% If "\pstree@themaxlevel" is equal to "\relax", then terminal nodes know that they should not try to align themselves. +% +% Then tree A needs to initialize "\pstree@maxlevel". +% \begin{macrocode} + \global\chardef\pstree@maxlevel\pstree@levelID} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pstree@savemaxlevel} +% "\pstree@maxlevel" is set globally. A LeafAlign tree should not pay attention to levels in a subtrees that (i) change directions, (ii) are root trees, or (iii) are LeafAlign trees. Such trees save the value of "\pstree@maxlevel" as "\pstree@savemaxlevel", and then restore the value globally at the end. Here, we just initialize it: +% \begin{macrocode} +\let\pstree@savemaxlevel\z@ +% \end{macrocode} +% \end{macro} +% +% +% \section{Tree frames} +% +\let\pstree@frame\relax + +% \begin{macro}{\pstreeframe} +% \begin{macrocode} +\def\pstreeframe{\pst@object{pstreeframe}} +\def\pstreeframe@i{% + \let\pstree@theframe\pstreeframe@ii + \let\pstree@theframepar\pst@par + \let\pstree@theframestar\if@star} +\def\pstreeframe@ii{% + \pstree@getbbox + \pst@dimg\pslinewidth + \advance\pst@dimg\psframesep + \advance\pst@dima\pst@dimg + \advance\pst@dimb\pst@dimg + \advance\pst@dimc\pst@dimg + \advance\pst@dimd\pst@dimg + \setbox\pstree@box=\hbox{% + \let\pst@par\pstree@theframepar + \let\if@star\pstree@theframestar + \pst@useboxpar + \ifpsboxsep\aftergroup\pstreeframe@iii\fi + \def\psk@dimen{.5 }% + \psframe@i(-\pst@dima,-\pst@dimd)(\pst@dimb,\pst@dimc)% + \box\pstree@box}% + \aftergroup\pstree@relaxtheframe}% +\def\pstreeframe@iii{% + \ifodd\psk@treemode + \pst@cntg=\pst@dimc + \pstree@set\pstree@upprofile + \pst@cntg=\pst@dimd + \pstree@set\pstree@downprofile + \else + \pstree@add\pst@dima\pstree@leftprofile + \pstree@add\pst@dimb\pstree@rightprofile + \fi} +\def\pstree@relaxtheframe{\let\pstree@theframe\relax} +\let\pstree@theframe\relax +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\pstree@firstandlast} +% "\pstree@firstandlast{}{}{}" assigns the first and last values in to and , respectively. +% \begin{macrocode} +\def\pstree@firstandlast#1#2#3{% + \expandafter\pstree@@firstandlast\expandafter#2#1% + #3=\pst@cntg} +\def\pstree@@firstandlast#1#2,{% + \pst@cntg=#2\relax + #1=\pst@cntg + \pstree@@@firstandlast} +\def\pstree@@@firstandlast#1,{% + \ifx\relax#1\else + \pst@cntg=#1\relax + \expandafter\pstree@@@firstandlast + \fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pstreeframe} +% \begin{macrocode} +\def\pstreecurve{\pst@object{pstreecurve}} +\def\pstreecurve@i{% + \let\pstree@theframe\pstreecurve@ii + \let\pstree@theframepar\pst@par + \let\pstree@theframestar\if@star} +\def\pstreecurve@ii{% + \setbox\pstree@box=\hbox{% + \let\pst@par\pstree@theframepar + \let\if@star\pstree@theframestar + \pst@useboxpar + \ifpsboxsep\aftergroup\pstreecurve@iv\fi + \pstreecurve@iii + \box\pstree@box}% + \aftergroup\pstree@relaxtheframe}% +\def\pstreecurve@iii{% + \begin@ClosedObj + \pst@dimg\pslinewidth + \divide\pst@dimg2 + \advance\pst@dimg\psframesep + \ifodd\psk@treemode\pstreecurve@hcoor\else\pstreecurve@vcoor\fi + \addto@pscode{[ \pst@coors}% + \psccurve@ii} +\def\pstreecurve@iv{% + \pst@cnta=\pslinewidth + \advance\pst@cnta\psframesep + \ifodd\psk@treemode + \pstree@add\pst@cnta\pstree@upprofile + \pstree@add\pst@cnta\pstree@downprofile + \else + \pstree@add\pst@cnta\pstree@leftprofile + \pstree@add\pst@cnta\pstree@rightprofile + \fi} +\def\pstreecurve@hcoor{% + \advance\pst@dima\pst@dimg + \advance\pst@dimb\pst@dimg + \ifnum\psk@treemode=\@ne + \pstree@firstandlast\pstree@upprofile\pst@cnta\pst@cntb + \else + \pstree@firstandlast\pstree@upprofile\pst@cntb\pst@cnta + \fi + \pst@dimh=\pst@cnta sp + \advance\pst@dimh\pst@dimg + \edef\pst@coors{\pst@number\pst@dima neg \pst@number\pst@dimh}% + \pst@dimh=\pst@cntb sp + \advance\pst@dimh\pst@dimg + \edef\pst@coors{\pst@coors \pst@number\pst@dimb \pst@number\pst@dimh}% + \ifnum\psk@treemode=\@ne + \pstree@firstandlast\pstree@downprofile\pst@cnta\pst@cntb + \else + \pstree@firstandlast\pstree@downprofile\pst@cntb\pst@cnta + \fi + \pst@dimh=\pst@cntb sp + \advance\pst@dimh\pst@dimg + \edef\pst@coors{% + \pst@coor \pst@number\pst@dimb \pst@number\pst@dimh neg }% + \pst@dimh=\pst@cnta sp + \advance\pst@dimh\pst@dimg + \edef\pst@coors{% + \pst@coors \pst@number\pst@dima neg \pst@number\pst@dimh neg }}% +\def\pstreecurve@vcoor{% + \advance\pst@dimc\pst@dimg + \advance\pst@dimd\pst@dimg + \ifnum\psk@treemode=\z@ + \pstree@firstandlast\pstree@leftprofile\pst@cnta\pst@cntb + \else + \pstree@firstandlast\pstree@leftprofile\pst@cntb\pst@cnta + \fi + \pst@dimh=\pst@cnta sp + \advance\pst@dimh\pst@dimg + \edef\pst@coors{\pst@number\pst@dimh neg \pst@number\pst@dimc}% + \pst@dimh=\pst@cntb sp + \advance\pst@dimh\pst@dimg + \edef\pst@coors{% + \pst@coors \pst@number\pst@dimh neg \pst@number\pst@dimd neg }% + \ifnum\psk@treemode=\z@ + \pstree@firstandlast\pstree@rightprofile\pst@cnta\pst@cntb + \else + \pstree@firstandlast\pstree@rightprofile\pst@cntb\pst@cnta + \fi + \pst@dimh=\pst@cntb sp + \advance\pst@dimh\pst@dimg + \edef\pst@coors{\pst@coors \pst@number\pst@dimh \pst@number\pst@dimd neg }% + \pst@dimh=\pst@cnta sp + \advance\pst@dimh\pst@dimg + \edef\pst@coors{\pst@coors \pst@number\pst@dimh \pst@number\pst@dimc}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pstreepyramid} +% \begin{macrocode} +\def\pstreepyramid{\pst@object{pstreepyramid}} +\def\pstreepyramid@i{% + \let\pstree@theframe\pstreepyramid@ii + \let\pstree@theframepar\pst@par + \let\pstree@theframestar\if@star} +\def\pstreepyramid@ii{% + \setbox\pstree@box=\hbox{% + \let\pst@par\pstree@theframepar + \let\if@star\pstree@theframestar + \pst@useboxpar + %\ifpsboxsep\aftergroup\pstreepyramid@iv\fi + \pstreepyramid@iv + \pstreepyramid@iii + \box\pstree@box}% + \aftergroup\pstree@relaxtheframe}% +\def\pstreepyramid@iii{% + \begin@ClosedObj + \pst@dimg\pslinewidth + \advance\pst@dimg\psframesep + \ifodd\psk@treemode\pstreepyramid@hcoor\else\pstreepyramid@vcoor\fi + \addto@pscode{[ \pst@tempg \pst@temph }% + \pspolygon@ii} +\def\pstreepyramid@iv{% + \pst@cntg=\pslinewidth + \advance\pst@cntg\psframesep + \ifodd\psk@treemode + \pstree@add\pstree@upprofile + \pstree@add\pstree@downprofile + \else + \pstree@add\pstree@leftprofile + \pstree@add\pstree@rightprofile + \fi} +\def\pstreepyramid@hcoor{% + \def\pst@tempg{}% + \def\pst@temph{}% + \pst@dima=\z@ + \pst@dimg=\pst@cntg sp + \edef\next{% + \pstree@levelsizes\relax + \pstree@upprofile\relax + \pstree@downprofile\relax}% + \expandafter\pstreepyramid@@hcoor\next} +\def\pstreepyramid@@hcoor#1,#2,#3,#4\relax#5,#6\relax#7,#8\relax{% + \pst@dimc=#5sp + \pst@dimd=#7sp + \pst@dimd=-\pst@dimd + \pst@dimb=#1sp + \advance\pst@dimb\pst@dimg + \pst@dimb=-\pst@dimb + \advance\pst@dimb\pst@dima + \edef\pst@tempg{\pst@tempg \pst@number\pst@dimb \pst@number\pst@dimc}% + \edef\pst@temph{\pst@number\pst@dimb \pst@number\pst@dimd \pst@temph}% + \pst@dimb=#2sp + \advance\pst@dimb\pst@dimg + \advance\pst@dimb\pst@dima + \edef\pst@tempg{\pst@tempg \pst@number\pst@dimb \pst@number\pst@dimc}% + \edef\pst@temph{\pst@number\pst@dimb \pst@number\pst@dimd \pst@temph}% + \ifx\relax#1% + \let\next\relax + \else + \pst@dimb=#3sp + \advance\pst@dima\ifnum\psk@treemode=\@ne\else-\fi\pst@dimb + \def\next{\pstreepyramid@@hcoor#4\relax#6\relax#8\relax}% + \fi + \next} +\def\pstreecurve@vcoor{% + \advance\pst@dimc\pst@dimg + \advance\pst@dimd\pst@dimg + \ifnum\psk@treemode=\z@ + \pstree@firstandlast\pstree@leftprofile\pst@cnta\pst@cntb + \else + \pstree@firstandlast\pstree@leftprofile\pst@cntb\pst@cnta + \fi + \pst@dimh=\pst@cnta sp + \advance\pst@dimh\pst@dimg + \edef\pst@coors{\pst@number\pst@dimh neg \pst@number\pst@dimc}% + \pst@dimh=\pst@cntb sp + \advance\pst@dimh\pst@dimg + \edef\pst@coors{% + \pst@coors \pst@number\pst@dimh neg \pst@number\pst@dimd neg }% + \ifnum\psk@treemode=\z@ + \pstree@firstandlast\pstree@rightprofile\pst@cnta\pst@cntb + \else + \pstree@firstandlast\pstree@rightprofile\pst@cntb\pst@cnta + \fi + \pst@dimh=\pst@cntb sp + \advance\pst@dimh\pst@dimg + \edef\pst@coors{\pst@coors \pst@number\pst@dimh \pst@number\pst@dimd neg }% + \pst@dimh=\pst@cnta sp + \advance\pst@dimh\pst@dimg + \edef\pst@coors{\pst@coors \pst@number\pst@dimh \pst@number\pst@dimc}} +% \end{macrocode} +% \end{macro} +% +% +% \section{Edges and node names\label{edges}} +% +% The following applies to nodes that have a successor: +% +% There are two edge macros. "\psedge" is invoked following each node, except when there is a skipped level between the node and its predecessor, in which case "\skipedge" is invoked. "\psedge" and "\skipedge" can be set by the "edge" and "skipedge" parameters. Setting these parameters for a node should affect the edge drawn to that node, but other parameter changes to a node should not affect the way the edge is drawn. +% To reconcile these two goals, after setting its graphics parameters, a node lets "\pstree@edge" be "\psedge" (or If levels are skipped, it lets "\pstree@skipedge" be "\psedge" and lets "\pstree@edge" be "\skipedge"). Then the node closes the group and invokes "\pstree@edge". +% +% \begin{macro}{\psset@edge,\psedge} +% \begin{macrocode} +\def\psset@edge#1{\def\psedge{#1}} +\psset@edge{\ncline} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\psset@skipedge,\skipedge} +% \begin{macrocode} +\def\psset@skipedge#1{% + \def\skipedge{#1}% + \ifx\skipedge\@empty + \def\skipedge{\psedge}% + \else + \ifx\skipedge\@none + \def\skipedge##1##2{}% + \fi + \fi} +\psset@skipedge{} +% \end{macrocode} +% \end{macro} +% +% Each node sets "\pssucc" to "@T:\pstree@id:\the\pstree@levelID". This does not give every node a unique name, but a nodes name will never be overwritten until it is not needed. +% +% \begin{macro}{\pspred} +% Here, we only initialize "\pspred", in case it is used inadvertently. +% \begin{macrocode} +\def\pspred{@T} +% \end{macrocode} +% \end{macro} +% +% +% \section{Tree Nodes} +% +% For each of the PSTricks node commands, there should be a variant for trees that: +% \begin{enumerate} +% \item \label{bbt} +% Invokes "\pst@@killglue". +% +% \item +% Perhaps makes "\pst@hbox" and/or collect arguments. (Note: If a node is a tree's root or successor, then "\pst@thisbox" has been set to "\pstree@outermode" by the tree.) +% +% \item +% Begins a group, and use graphics parameters. +% +% \item +% Globally advance "\pstree@succID" by 1. +% +% \item \label{ebt} +% Globally set "\pssucc" to "@T:\pstree@id:\the\pstree@levelID". +% +% \item \label{dn1} +% Creates a zero-dimensional box, containing the node with name "\pssucc", and with the origin of the box located at the center of the node. (The center is the point the edges point to.) +% +% \item \label{dn2} +% Sets "\pst@dima", etc., as described on page \pageref{nodesizes}. +% +% \item \label{bet} +% Adjusts and/or shows the bounding box: +% \begin{LVerbatim} +% \psk@adjustbbox +% \ifpsshowbbox\pstree@showbbox\fi +% \end{LVerbatim} +% +% \item +% Invokes "\psnode@makecanonical" and "\pstree@build". +% +% \item Saves the edge, closes the group, and invokes the edge (see Section \ref{edges}). +% +% \item \label{eet} +% Invokes "\pst@shortput" (unless there is no predecessor, in which case it invokes "\ignorespaces"). +% \end{itemize} +% +% +% \begin{macro}{\begin@treenode,\end@treenode} +% "\begin@treenode" takes care of steps \ref{bbt}--\ref{ebt}. "\end@treenode" takes care of steps \ref{bet}--\ref{eet}. A tree node typically invokes "\begin@treenode", takes care of steps \ref{dn1} and \ref{dn2}, and then invokes "\end@treenode". If the tree makes "\pst@hbox", then it must first invoke "\pst@@killglue". +% \begin{macrocode} +\def\begin@treenode{% + \pst@@killglue + \begingroup + \use@par + \xdef\pssucc{@T:\pstree@id:\the\pstree@levelID:\the\pstree@succID}} +\def\end@@treenode{% + \psk@adjustbbox + \ifpsshowbbox\pstree@showbbox\fi + \psnode@makecanonical + \pstree@build + \ifnum\psskiplevels>\z@ + \global\let\pstree@skipedge\psedge + \global\let\pstree@edge\skipedge + \else + \global\let\pstree@edge\psedge + \fi + \endgroup + \let\pst@tempa\ignorespaces + \ifnum\pstree@levelID>\z@ + \ifx\pstree@edge\@none\else + \let\pst@tempa\pst@shortput + \expandafter\pstree@makeedge\pstree@basenodes\relax\@empty + \fi + \fi + \pst@tempa} +\def\pstree@makeedge#1,#2#3\@empty{% + {\pstree@edge{#1}{\pssucc}}% + \ifx#2\relax\else\let\pst@tempa\ignorespaces\expandafter\pstree@makeedge\fi + #2#3\@empty} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\Tn} +% "\Tn" is the exception. Because it is just a place holder, it sets "\pssucc" to "\pspred", and does not make an edge. +% \begin{macrocode} +\def\Tn{\pst@object{Tn}} +\def\Tn@i{% + \pst@@killglue + \global\let\pssucc\pspred + \begingroup + \pst@dima=\z@ + \pst@dimb=\z@ + \pst@dimc=\z@ + \pst@dimd=\z@ + \setbox\pstree@box=\hbox{}% + \psnode@makecanonical + \pstree@build + \endgroup + \ignorespaces} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\Tp} +% \begin{macrocode} +\def\Tp{\pst@object{Tp}} +\def\Tp@i{% + \begin@treenode + \pst@dima=\z@ + \pst@dimb=\z@ + \pst@dimc=\z@ + \pst@dimd=\z@ + \setbox\pstree@box=\hbox{% + \pst@newnode{\pssucc}{10}{0 0 }{\tx@InitPnode}}% + \end@treenode} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\Tc,\TC} +% \begin{macrocode} +\def\Tc{\pst@object{Tc}} +\def\Tc@i#1{% + \begin@treenode + \pssetlength\pst@dima{#1}% + \pst@dimb=\pst@dima + \pst@dimc=\pst@dima + \pst@dimd=\pst@dima + \nodealignfalse + \setbox\pstree@box=\hbox{\cnode@ii(\z@,\z@){#1}{\pssucc}}% + \end@treenode} +\def\TC{\pst@object{TC}} +\def\TC@i{\Tc@i{\psk@radius}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\Toval} +% \begin{macrocode} +\def\Toval{\pst@object{Toval}} +\def\Toval@i{\pst@@killglue\pst@makebox{\Toval@ii\ovalnode@ii}} +\def\Toval@ii#1{% + \begin@treenode + \nodealigntrue + \setbox\pstree@box=\hbox{#1\pssucc}% + \pst@dima=\wd\pstree@box + \divide\pst@dima\tw@ + \pst@dimb=\pst@dima + \pst@dimc=\ht\pstree@box + \pst@dimd=\dp\pstree@box + \setbox\pstree@box=\hbox to\z@{\hss\unhbox\pstree@box\hss}% + \dp\pstree@box=\z@ + \ht\pstree@box=\z@ + \end@treenode} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\Tcircle,\TCircle} +% \begin{macrocode} +\def\Tcircle{\pst@object{Tcircle}} +\def\Tcircle@i{\pst@@killglue\pst@makebox{\Toval@ii\circlenode@ii}} +\def\TCircle{\pst@object{TCircle}} +\def\TCircle@i{\pst@@killglue\pst@makebox{\Toval@ii\Circlenode@ii}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\Tf} +% \begin{macrocode} +\def\Tf{\pst@object{Tf}} +\def\Tf@i{\Toval@ii{\fnode@ii()}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\Tdia} +% \begin{macrocode} +\def\Tdia{\pst@object{Tdia}} +\def\Tdia@i{\pst@@killglue\pst@makebox{\Toval@ii\dianode@ii}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\Ttri} +% \begin{macrocode} +\def\Ttri{\pst@object{Ttri}} +\def\Ttri@i{\pst@@killglue\pst@makebox{\Ttri@ii}} +\def\Ttri@ii{% + \begin@treenode + \nodealigntrue + \setbox\pstree@box=\hbox{\trinode@ii\pssucc}% + \pst@dima=\pst@dimg % Set by \pst@triboxsep + \pst@dimb=\wd\pstree@box + \advance\pst@dimb-\pst@dima + \pst@dimc=\ht\pstree@box + \pst@dimd=\dp\pstree@box + \setbox\pstree@box=\hbox to\z@{\hss\unhbox\pstree@box\hss}% + \dp\pstree@box=\z@ + \ht\pstree@box=\z@ + \end@treenode} +% \end{macrocode} +% \end{macro} +% +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\Tr} +% \begin{macrocode} +\def\Tr{\pst@object{Tr}} +\def\Tr@i{\pst@@killglue\pst@makebox{\Tr@ii{\rnode@iii\rnode@iv}}} +\def\Tr@ii#1{% + \begin@treenode + \def\pstree@nodehook{% + \xdef\pstree@next{\pst@dima=\number\pst@dima sp\relax}}% + \nodealigntrue + \setbox\pstree@box\hbox{#1\pssucc}% + \pstree@next + \pst@dimb=\wd\pstree@box + \advance\pst@dimb-\pst@dima + \pst@dimc=\ht\pstree@box + \pst@dimd=\dp\pstree@box + \setbox\pstree@box\hbox to\z@{\kern-\pst@dima\unhbox\pstree@box\hss}% + \ht\pstree@box=\z@ + \dp\pstree@box=\z@ + \end@treenode} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\TR} +% \begin{macrocode} +\def\TR{\pst@object{TR}} +\def\TR@i{\pst@@killglue\pst@makebox{\Tr@ii{\rnode@iii\Rnode@ii}}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\Tdot} +% \begin{macrocode} +\def\Tdot{\pst@object{Tdot}} +\def\Tdot@i{% + \begin@treenode + \def\pstree@nodehook{\xdef\pstree@next{% + \pst@dima=\number\pst@dimg sp\relax + \pst@dimc=\number\pst@dimh sp\relax}}% + \nodealignfalse + \setbox\pstree@box=\hbox{\dotnode@ii(\z@,\z@)\pssucc}% + \pstree@next + \pst@dimb=\pst@dima + \pst@dimd=\pst@dimc + \end@treenode} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\psset@fansize,\psk@fansize} +% \begin{macrocode} +\def\psset@fansize#1{\pst@@getlength{#1}\psk@fansize} +\psset@fansize{1cm} +% \end{macrocode} +% \end{macro} +% +% DEFINITION OF Tfan IS IN psn-beta.doc. +% +% \begin{macro}{\tx@Tfan} +% \begin{macrocode} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\Tfan} +% \begin{macrocode} +\def\Tfan{\pst@object{Tfan}} +\def\Tfan@i{% + \addto@par{edge=none,skipedge=none}% + \begin@treenode + \solid@star + % For now, let \pst@dimb and \pst@dimd base and thickness of fan. + \pst@dimb=\psk@fansize + \pst@dimd=\pslinewidth + \advance\pst@dimb-\pst@dimd + \divide\pst@dimb 2 + \divide\pst@dimd 2 + % Set \pst@dima and \pst@dimc to leftsize and height of node + \ifodd\psk@treemode + \pst@dima=\pst@dimd + \pst@dimc=\pst@dimb + \else + \pst@dima=\pst@dimb + \pst@dimc=\pst@dimd + \fi + \setbox\pstree@box=\hbox{% + \pst@newnode{\pssucc}{16}{}{% + /Y 0 def + /X 0 def + /l \pst@number\pst@dima def + /r l def + /u \pst@number\pst@dimc def + /d u def + /NodePos { \tx@GetRnodePos } def}% + \def\pst@linetype{1}% + \nc@object{Closed}{\pspred}{\pssucc}{.5}{% + tx@Dict begin \psline@iii pop end + /w \pst@number\pst@dimb CLW 2 div sub def + /m \ifodd\psk@treemode false \else true \fi def + \tx@Tfan}}% + \pst@dimb=\pst@dima + \pst@dimd=\pst@dimc + \end@treenode} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\psset@tnsep,\psk@tnsep} +% \begin{macrocode} +\def\psset@tnsep#1{% + \def\pst@tempg{#1}% + \ifx\pst@tempg\@empty + \def\psk@tnsep{\number\pslabelsep sp}% + \else + \pst@@getlength{#1}\psk@tnsep + \fi} +\psset@tnsep{} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\psset@tnyref,\psk@tnyref} +% \begin{macrocode} +\def\psset@tnyref#1{\def\psk@tnyref{#1}}% +\psset@tnyref{} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\psset@tnheight,\psk@tnheight} +% \begin{macrocode} +\def\psset@tnheight#1{\edef\psk@tnheight{#1}} +\psset@tnheight{\ht\strutbox} +\def\psset@tndepth#1{\edef\psk@tndepth{#1}} +\psset@tndepth{\dp\strutbox} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\psset@tnpos,\psk@tnpos} +% \begin{macrocode} +\def\psset@tnpos#1{% + \def\pst@tempg{#1}% + \ifx\pst@tempg\@empty + \def\psk@tnpos{% + \ifcase\psk@treemode b\or r\or a\or l\fi}% + \else + \@ifundefined{pstree@tnput@#1}% + {\@pstrickserr{Bad tnpos: `#1'}\@ehpa}% + {\edef\psk@tnpos{#1}}% + \fi} +\psset@tnpos{} +% \end{macrocode} +% \end{macro} +% +\def\MakeShortTnput#1{% + \def\end@treenode{\@ifnextchar#1{\tnput@}{\end@@treenode}}} +\MakeShortTnput{~} +% \begin{macro}{\tnput@} +% \begin{macrocode} +\def\tnput@#1{\pst@object{tnput}} +\def\tnput@i{\pst@@killglue\pst@makebox{\tnput@ii}} +\def\tnput@ii{% + \begingroup + \use@par + \if@star\pst@starbox\fi + \gdef\next{}% + \csname pstree@tnput@\psk@tnpos\endcsname + \endgroup + \next + \setbox\pstree@box=\box\pst@boxg + \dp\pstree@box=\z@ + \ht\pstree@box=\z@ + \wd\pstree@box=\z@ + \end@treenode} +\@namedef{pstree@tnput@b}{% + \pstree@tnput@@v\pst@dimd\ht\dp\lower\psk@tnheight} +\@namedef{pstree@tnput@a}{% + \pstree@tnput@@v\pst@dimc\dp\ht\raise\psk@tndepth} +\def\pstree@tnput@@v#1#2#3#4#5{% + \pst@dimh=\wd\pst@hbox + \pst@dimg=\psk@href\pst@dimh + \advance\pst@dimg\pst@dimh + \divide\pst@dimg 2 + \advance\pst@dimh-\pst@dimg + \ifdim\pst@dimg>\pst@dima + \xdef\next{\next\pst@dima=\number\pst@dimg sp\relax}% + \fi + \ifdim\pst@dimh>\pst@dimb + \xdef\next{\next\pst@dimb=\number\pst@dimh sp\relax}% + \fi + \pst@dimh=\psk@tnsep\relax + \ifdim\pst@dimh<\z@ + \pst@dimh=-\pst@dimh + \else + \advance\pst@dimh#1% + \fi + \pssetlength\dimen@{#5}% + \ifdim\dimen@>#2\pst@hbox + \advance\pst@dimh\dimen@\relax + \else + \advance\pst@dimh#2\pst@hbox + \fi + \global\setbox\pst@boxg=\hbox{% + \box\pstree@box + #4\pst@dimh\hbox to\z@{\kern-\pst@dimg\unhbox\pst@hbox\hss}}% + \xdef\next{\next#1=\number#3\pst@boxg sp\relax}} +\@namedef{pstree@tnput@l}{% + \pstree@tnput@@h\pst@dima{% + \hss + \lower\pst@dimg\box\pst@hbox + \kern\pst@dimh + \box\pstree@box}} +\@namedef{pstree@tnput@r}{% + \pstree@tnput@@h\pst@dimb{% + \box\pstree@box + \kern\pst@dimh + \lower\pst@dimg\box\pst@hbox + \hss}}% +\def\pstree@tnput@@h#1#2{% + \ifx\psk@tnyref\@empty + \pssetlength\pst@dimg\psk@vref + \else + \pst@dimg=\ht\pst@hbox + \advance\pst@dimg\dp\pst@hbox + \pst@dimg=\psk@tnyref\pst@dimg + \advance\pst@dimg-\dp\pst@hbox + \fi + \pst@dimh=\psk@tnsep\relax + \ifdim\pst@dimh<\z@ + \multiply\pst@dimh\m@ne + \else + \advance\pst@dimh#1% + \fi + \xdef\next{% + \next#1=\number\pst@dimh sp\relax + \advance#1\number\wd\pst@hbox sp\relax}% + \global\setbox\pst@boxg=\hbox to\z@{#2}% + \ifdim\ht\pst@boxg>\pst@dimc + \xdef\next{\next\pst@dimc=\number\ht\pstree@box sp\relax}% + \fi + \ifdim\dp\pst@boxg>\pst@dimd + \xdef\next{\next\pst@dimd=\number\dp\pstree@box sp\relax}% + \fi} +% \end{macrocode} +% \end{macro} +% +% +\catcode`\@=\TheAtCode\relax +\endinput +%% END pstree.tex + diff --git a/usergrps/uktug/baskervi/6_2/spqr/pstricks.con b/usergrps/uktug/baskervi/6_2/spqr/pstricks.con new file mode 100644 index 0000000000..2d1281265e --- /dev/null +++ b/usergrps/uktug/baskervi/6_2/spqr/pstricks.con @@ -0,0 +1,361 @@ +%% BEGIN: pstricks.con +%% +%% Configuration file for PSTricks v0.93a, 93/03/12. +%% +%% !! SEE INSTRUCTIONS AT END !! + + +%%%%%%%%%%% !! DRIVER CONFIGURATION DEFINITIONS GO HERE: !! %%%%%%%%%%%%%% + + +%% ********************************************************************** +%% ***** Rokicki's dvips ***** Rokicki's dvips ***** Rokicki's dvips **** +%% ********************************************************************** +%% Life is bliss with Rokicki's dvips (tested with v5.396, v5.47, 5.491): +%% +\def\pstdriver{Rokicki's dvips} +{\catcode`\"=12\gdef\pstverb#1{\special{" #1}}} % Check catcode of " +\def\pstunit{1bp}% +\def\pstVerb#1{\special{ps: #1}} +\def\pstverbscale{SDict begin normalscale end} +\def\pstheader#1{\special{header=#1}} +%% +%% In the following, CP is short for currentpoint. +%% The neg is necessary because dvips scales the coordinates by 1 -1. +%% \tx@NET means neg exch neg exch translate. +\def\pstrotate{% + CP CP translate 3 -1 roll neg rotate \tx@NET} +%% +%% If using a version before 5.47, clipping may not work. You can +%% try the following definition of \pstverb: +%\def\pstverb#1{\special{ps: @beginspecial #1 @endspecial}} +%% or change "{initclip}ifelse" to "if" in the definition of @setspecial +%% in dvips' special.pro. +%% +%% ****************** END Rokicki's dvips ***************************** + + +%%%%%%%%%%%%%%%%%%% !! CUSTOMIZATION STUFF GOES HERE: !! %%%%%%%%%%%%%%%%%% +%% If you want to include your own customizations to pstricks.tex, then +%% uncomment the \pstcustomize command, and include your modifications +%% after \pstcustomize. These will be read in after pstricks.tex. +%\pstcustomize + + +%%%%%%%%%%%%%%%%%%%%%%%%% !! END OF INPUT !! %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\endinput + + +%%%%%%%%%%%%%%%%%%% !! GENERAL INSTRUCTIONS !! %%%%%%%%%%%%%%%%%%%%%%%%%%%% + +Because there are no standards for dvi-to-PS driver \special's, +some driver-dependent commands must be defined in this file. + +Possibly correct definitions for some dvi drivers are given below. +Copy the section for the driver you want to use to the indicated place +near the beginning of the file, replacing any other definitions you +might find there. + +When changing drivers, you may need to remake the header file. + +See the PSTricks read-me file for further installation instructions. + +Please report good and bad experiences with dvi-to-PS drivers, +along with the definitions of these commands that worked +for you, to tvz@Princeton.EDU. Thanks. + + +%%%%%%%%%%%%%%%% DESCRIPTION OF CONFIGURATION DEFINITIONS %%%%%%%%%%%%%%% + +Here are the commands that must be defined in this file: + + \pstverb{} - The argument is included as verbatim PostScript, + grouped by save and restore. The coordinate system + should be square, not rotated, and with the origin + at TeX's currentpoint. + + \pstVerb{} - The argument is included as verbatim PostScript, not + grouped by (g)save and (g)restore. The currentpoint + should be TeX's currentpoint. + + \pstunit - The units used by driver for graphics included with + \pstverb. Probably 1bp or 1sp. + + \pstverbscale - The PostScript code that scales the coordinate system + from that in effect with \pstVerb to that in effect + with \pstverb. Should not translate to the currentpoint. + + \pstrotate - The PostScript code that takes a number off the stack + and rotates the axes properly. I.e., + \pstVerb{angle \pstrotate} is used to begin rotations. + + \pstheader{} - The argument is a header file (e.g., .pro file). + If your driver does not support such a special, then + the command might just remind you to include the header + when printing. You can use PSTricks without a header, + in which case it does not matter how you define + \pstheader. See read-me.pst for details. + If you cannot change the default directory where your + driver looks for header files, and you cannot write to + that directory, then you include the path for your + PSTricks header files. + E.g., \def\pstheader#1{\special{header=~/tex/#1}}. + + \pstdriver - The name of the driver. + + +%%%%%%%%% !! HOW TO MAKE A TEX FORMAT WITH PSTRICKS PRELOADED !! %%%%%%%% + +See your local TeX documentation for instructions on creating a TeX format. + +Before making the format, be sure that this configuration file is correct. +It will be read only when creating the format, and not with every job. + +If you are not using header files, there are no more special instructions. + +Special instructions when using header files: + + - If you want to include supplementary PSTricks files (e.g., pst-node.tex), + add \input commands in the customization section above. + + - If your definition of \pstheader is, e.g. + + \def\pstheader#1{\special{\header=#1}} + + then change it to + + \def\pstheader#1{% + \expandafter\everyjob\expandafter{\the\everyjob + \special{header=#1}}} + + and put your original definition in the customization section, AFTER + any \input commands. E.g., the customization section might look like: + + \pstcustomize + \input pst-node.tex + \input pst-coil.tex + \def\pstheader#1{\special{header=#1}} + + - Input pstricks.tex at the appropriate time when creating the format. + E.g., when initex stops running: + *\input pstricks + *\dump + + +%%%%%%%%%% !! CONFIGURATIONS FOR SOME DRIVERS !! %%%%%%%%%%%%%%%%%%%%%%%% + + +%% ********************************************************************** +%% ***** Rokicki's dvips ***** Rokicki's dvips ***** Rokicki's dvips **** +%% ********************************************************************** +%% Life is bliss with Rokicki's dvips (tested with v5.396, v5.47, 5.491): +%% +\def\pstdriver{Rokicki's dvips} +{\catcode`\"=12\gdef\pstverb#1{\special{" #1}}} % Check catcode of " +\def\pstunit{1bp}% +\def\pstVerb#1{\special{ps: #1}} +\def\pstverbscale{SDict begin normalscale end} +\def\pstheader#1{\special{header=#1}} +%% +%% In the following, CP is short for currentpoint. +%% The neg is necessary because dvips scales the coordinates by 1 -1. +%% \tx@NET means neg exch neg exch translate. +\def\pstrotate{% + CP CP translate 3 -1 roll neg rotate \tx@NET} +%% +%% If using a version before 5.47, clipping may not work. You can +%% try the following definition of \pstverb: +%\def\pstverb#1{\special{ps: @beginspecial #1 @endspecial}} +%% or change "{initclip}ifelse" to "if" in the definition of @setspecial +%% in dvips' special.pro. +%% +%% ****************** END Rokicki's dvips ***************************** + + +%% ********************************************************************** +%% **** Arbortext's dvips *** Arbortext's dvips *** Arbortext's dvips *** +%% ********************************************************************** +%% Thanks to Wolfgang Sienel: +%% +\def\pstdriver{Arbortext's dvips} +\def\pstverb#1{% + \special{ps::[asis] 0 SPB /ChartCheckPoint save def + Xpos Ypos translate #1 ChartCheckPoint restore 0 SPE}} +\def\pstunit{1bp} +\def\pstVerb#1{\special{ps:: #1}} +\def\pstverbscale{} +\def\pstrotate{CP CP translate 3 -1 roll rotate \tx@NET} +\def\pstheader#1{% + \typeout{**********************************************************}% + \typeout{** Don't forget to include #1 when printing:}% + \typeout{** \space\space dvips -PRO #1 myfile}% + \typeout{**********************************************************}} +%% +%% Comments by Wolfgang on header files: +%% Normally the standard prolog file is downloaded once to the printer +%% with psload.ps (the initializing file for your TeX-printer) before +%% printing TeX-documents. If you don't make any changes to psload.ps +%% you have to type dvips -PRO PATH/pstricks.pro myfile (-PRO just +%% works for UNIX systems. I don't have any idea about other systems). +%% If psload.ps was not downloaded to the printer you have to append +%% pstricks.pro to the standard prolog file dvips.pro. In this case +%% invoke dvips as always. Note that after hitting the enter key you +%% have to specify the option download all prolog in both cases. If you +%% are frequently using pstricks you might want to change psload.ps. In +%% this case contact your local TeX-guru and ask him politely to do this +%% for you. Attention: If psload.ps is getting too big you may run into +%% trouble with printer memory! +%% +%% ****************** END Arbortext's dvips ***************************** + + +%% ********************************************************************** +%% **** Textures *** Textures *** Textures *** Textures *** Textures **** +%% ********************************************************************** +%% These have been tested with v1.3. It is nice to have a PostScript +%% screen previewer, such as TScript (USA: 1-617-734-9700). (The +%% Textures preview window will not show the PSTricks graphics.) +%% +\def\pstdriver{Textures} +\def\pstunit{1bp} +\def\pstverb#1{\special{postscript /TX@Save save def #1 TX@save restore}} +\def\pstVerb#1{\special{postscript grestore #1 gsave}} +\def\pstverbscale{Mag 1000 div 72.27 72 div mul dup neg scale} +\def\pstrotate{% + CP CP translate 3 -1 roll neg rotate \tx@NET} +%% +%% \pstVerb does not define the currentpoint properly. As a workaround, +%% insert the following lines in the customization section above. +%% +%% \def\pst@Verb#1{% +%% \special{postscript \pst@dict /sps { moveto /Mag ed } def +%% userdict begin}% +%% \special{postscript #1 end gsave}} +%% +%% Textures does not support header files. +%% However, it may still be worth using a header file for increased speed. +%% Also, some macros can overload Textures 1.3 when not used with a header +%% file. You can include the header file pstricks.pro by saving the +%% PostScript output to a file and inserting the pstricks.pro with an +%% editor. Probably a better solution is to append pstricks.pro to a +%% copy of the laserprep, and, by changing file names of the modified +%% laserprep and the original laserprep, use the laserprep with pstricks.pro +%% whenever you are printing pstricks documents. +\def\pstheader#1{% + \typeout{******************************************}% + \typeout{*** Include header file #1!! ***}% + \typeout{******************************************}} +%% +%% ****************** END Textures ************************************** + + +%% ********************************************************************** +%% ***** dvi2ps ***** dvi2ps ***** dvi2ps ***** dvi2ps ***** dvi2ps ***** +%% ********************************************************************** +%% I.e., dvi2ps, v2.xx. There are lot's of such things around. +%% This probably doesn't work. Considering upgrading to Rokicki's dvips. +%% +\def\pstdriver{dvi2ps v2.xx} +\def\pstunit{1pt} +\def\pstverb#1{ pstext="save currentpoint translate + Resolution 72.27 div neg scale #1 restore" \space} +\def\pstVerb#1{ pstext="#1" \space} +\def\pstverbscale{Resolution 72.27 div neg scale} +\def\pstrotate{% + CP CP translate 3 -1 roll neg rotate \tx@NET} +\def\pstheader#1{% + \typeout{******************************************************} + \typeout{Don't forget to include the header file #1!!} + \typeout{******************************************************} +%% +%% ***************************** END dvi2ps ***************************** + + +%% ********************************************************************** +%% ***** dvi3ps ***** dvi3ps ***** dvi3ps ***** dvi3ps ***** dvi3ps ***** +%% ********************************************************************** +%% I.e., dvi2ps, version 3.xx, by Kevin Coombes. +%% This has not been tested. Consider upgrading to Rokicki's dvips. +%% +\def\pstdriver{dvi2ps v3.xx} +\def\pstunit{1bp} +\def\pstverb#1{pstext="#1"} +% \def\pstVerb#1{% +% \special{pstext="@endspecial #1 @beginspecial @setspecial"}} % v3.0 +\def\pstVerb#1{\special{psraw="#1"}} % v3.3 +\def\pstverbscale{Resolution 72.27 div neg scale} +\def\pstrotate{% + CP CP translate 3 -1 roll neg rotate \tx@NET} +\def\pstheader#1{% + \typeout{******************************************************} + \typeout{Don't forget to include the header file #1!!} + \typeout{******************************************************} +%% +%% ******************* END dvi3ps *************************************** + + +%% ********************************************************************** +%% **** OzTeX **** OzTeX **** OzTeX **** OzTeX **** OzTeX **** OzTeX **** +%% ********************************************************************** +%% Only the pure graphics objects are supported for OzTeX. +%% No color, rotation, clipping, nodes and node connections, overlays, etc. +%% Also, \rput cannot be used with \SpecialCoor. +%% +%% The reason is given in the documentation for Version 1.3, September 1990: +%% +%% OzTeX generates highly efficient PostScript code but it does so at +%% the expense of some \special functionality. Many DVI-to-PostScript +%% translators allow you to do things like use one \verb|\special| to start +%% rotating TeX text and another to stop the rotation. The way OzTeX +%% interprets a DVI page makes this impossible. +%% +%% If using the header file, you should copy pstricks.pro to global.ps, in +%% the same directory as your dvi file. +%% +\def\pstdriver{OzTeX} +\def\pstverb#1{\special{null.ps #1}} +\def\pstunit{1bp} +\def\pstVerb#1{% + \typeout{PSTRICKS WARNING:}% + \typeout{\space\space You are using features not supported by OzTeX.}% + \typeout{\space\space These will be ignored.}% + \gdef\pstVerb##1{}} +\def\pstverbscale{} +\def\pstrotate{} +\def\pstheader#1{% + \typeout{******************************************************} + \typeout{Don't forget to include the header file #1!!} + \typeout{******************************************************}} +%% +%% ************************* END OzTeX ********************************** + + +%% ********************************************************************** +%% ***** DirectTeX ***** DirectTeX ***** DirectTeX ***** DirectTeX ****** +%% ********************************************************************** +%% DirectTeX is for the Macintosh. These has been tested unsuccessfully, +%% apparently due to a problem with DirectTeX. +%% +\def\pstdriver{DirectTeX} +%% +%% Check catcode of " +{\catcode`\"=12\gdef\pstverb#1{\special{" #1 /Foo{}def }}} +\def\pstunit{1bp} +\def\pstVerb#1{\special{ps: #1 }} +\def\pstverbscale{TeXDict begin normalscale end} +%% +%% In the following, CP is short for currentpoint. The neg is necessary +%% because dvips scales the coordinates by 1 -1: +\def\pstrotate{% + CP CP translate 3 -1 roll neg rotate \tx@NET} +%% +\def\pstheader#1{% + \typeout{**********************************************************}% + \typeout{** Don't forget to include #1 when printing:}% + \typeout{** \space\space DVIReader -header #1 myfile}% + \typeout{**********************************************************}} +%% +%% ****************** END DirectTeX ***************************** + + +%% END pstricks.con diff --git a/usergrps/uktug/baskervi/6_2/spqr/pstricks.pro b/usergrps/uktug/baskervi/6_2/spqr/pstricks.pro new file mode 100644 index 0000000000..359110c4ff --- /dev/null +++ b/usergrps/uktug/baskervi/6_2/spqr/pstricks.pro @@ -0,0 +1,204 @@ +%! +% PostScript prologue for pstricks.tex. +% Created 1994/6/23. Source file was pstricks.doc +% Version 0.93a, 93/03/12. +% For use with Rokicki's dvips. +/tx@Dict 200 dict def 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 +/T /translate load def +/TMatrix { } def +/RAngle { 0 } def +/Atan { /atan load stopped { pop pop 0 } if } def +/Div { dup 0 eq { pop } { div } ifelse } def +/NET { neg exch neg exch T } def +/Pyth { dup mul exch dup mul add sqrt } def +/PtoC { 2 copy cos mul 3 1 roll sin mul } def +/PathLength@ { /z z y y1 sub x x1 sub Pyth add def /y1 y def /x1 x def } +def +/PathLength { flattenpath /z 0 def { /y1 ED /x1 ED /y2 y1 def /x2 x1 def +} { /y ED /x ED PathLength@ } {} { /y y2 def /x x2 def PathLength@ } +/pathforall load stopped { pop pop pop pop } if z } def +/STP { .996264 dup scale } def +/STV { SDict begin normalscale end STP } def +/DashLine { dup 0 gt { /a .5 def PathLength exch div } { pop /a 1 def +PathLength } ifelse /b ED /x ED /y ED /z y x add def b a .5 sub 2 mul y +mul sub z Div round z mul a .5 sub 2 mul y mul add b exch Div dup y mul +/y ED x mul /x ED x 0 gt y 0 gt and { [ y x ] 1 a sub y mul } { [ 1 0 ] +0 } ifelse setdash stroke } def +/DotLine { /b PathLength def /a ED /z ED /y CLW def /z y z add def a 0 gt +{ /b b a div def } { a 0 eq { /b b y sub def } { a -3 eq { /b b y add +def } if } ifelse } ifelse [ 0 b b z Div round Div dup 0 le { pop 1 } if +] a 0 gt { 0 } { y 2 div a -2 gt { neg } if } ifelse setdash 1 +setlinecap stroke } def +/LineFill { gsave abs CLW add /a ED a 0 dtransform round exch round exch +2 copy idtransform exch Atan rotate idtransform pop /a ED .25 .25 +itransform translate pathbbox /y2 ED a Div ceiling cvi /x2 ED /y1 ED a +Div cvi /x1 ED /y2 y2 y1 sub def clip newpath 2 setlinecap systemdict +/setstrokeadjust known { true setstrokeadjust } if x2 x1 sub 1 add { x1 +a mul y1 moveto 0 y2 rlineto stroke /x1 x1 1 add def } repeat grestore } +def +/BeginArrow { ADict begin /@mtrx CM def gsave 2 copy T 2 index sub neg +exch 3 index sub exch Atan rotate newpath } def +/EndArrow { @mtrx setmatrix CP grestore end } def +/Arrow { CLW mul add dup 2 div /w ED mul dup /h ED mul /a ED { 0 h T 1 -1 +scale } if w neg h moveto 0 0 L w h L w neg a neg rlineto gsave fill +grestore } def +/Tbar { CLW mul add /z ED z -2 div CLW 2 div moveto z 0 rlineto stroke 0 +CLW moveto } def +/Bracket { CLW mul add dup CLW sub 2 div /x ED mul CLW add /y ED /z CLW 2 +div def x neg y moveto x neg CLW 2 div L x CLW 2 div L x y L stroke 0 +CLW moveto } def +/RoundBracket { CLW mul add dup 2 div /x ED mul /y ED /mtrx CM def 0 CLW +2 div T x y mul 0 ne { x y scale } if 1 1 moveto .85 .5 .35 0 0 0 +curveto -.35 0 -.85 .5 -1 1 curveto mtrx setmatrix stroke 0 CLW moveto } +def +/SD { 0 360 arc fill } def +/EndDot { { /z DS def } { /z 0 def } ifelse /b ED 0 z DS SD b { 0 z DS +CLW sub SD } if 0 DS z add CLW 4 div sub moveto } def +/Shadow { [ { /moveto load } { /lineto load } { /curveto load } { +/closepath load } /pathforall load stopped { pop pop pop pop CP /moveto +load } if ] cvx newpath 3 1 roll T exec } def +/NArray { aload length 2 div dup dup cvi eq not { exch pop } if /n exch +cvi def } def +/NArray { /f ED counttomark 2 div dup cvi /n ED n eq not { exch pop } if +f { ] aload /Points ED } { n 2 mul 1 add -1 roll pop } ifelse } def +/Line { NArray n 0 eq not { n 1 eq { 0 0 /n 2 def } if ArrowA /n n 2 sub +def n { Lineto } repeat CP 4 2 roll ArrowB L pop pop } if } def +/Arcto { /a [ 6 -2 roll ] cvx def a r /arcto load stopped { 5 } { 4 } +ifelse { pop } repeat a } def +/CheckClosed { dup n 2 mul 1 sub index eq 2 index n 2 mul 1 add index eq +and { pop pop /n n 1 sub def } if } def +/Polygon { NArray n 2 eq { 0 0 /n 3 def } if n 3 lt { n { pop pop } +repeat } { n 3 gt { CheckClosed } if n 2 mul -2 roll /y0 ED /x0 ED /y1 +ED /x1 ED x1 y1 /x1 x0 x1 add 2 div def /y1 y0 y1 add 2 div def x1 y1 +moveto /n n 2 sub def n { Lineto } repeat x1 y1 x0 y0 6 4 roll Lineto +Lineto pop pop closepath } ifelse } def +/Diamond { /mtrx CM def T rotate /h ED /w ED dup 0 eq { pop } { CLW mul +neg /d ED /a w h Atan def /h d a sin Div h add def /w d a cos Div w add +def } ifelse mark w 2 div h 2 div w 0 0 h neg w neg 0 0 h w 2 div h 2 +div /ArrowA { moveto } def /ArrowB { } def false Line closepath mtrx +setmatrix } def +/Triangle { /mtrx CM def translate rotate /h ED 2 div /w ED dup 0 eq { +pop } { CLW mul /d ED /h h d w h Atan sin Div sub def /w w d h w Atan 2 +div dup cos exch sin Div mul sub def } ifelse mark 0 d w neg d 0 h w d 0 +d /ArrowA { moveto } def /ArrowB { } def false Line closepath mtrx +setmatrix } def +/CCA { /y ED /x ED 2 copy y sub /dy1 ED x sub /dx1 ED /l1 dx1 dy1 Pyth +def } def +/CCA { /y ED /x ED 2 copy y sub /dy1 ED x sub /dx1 ED /l1 dx1 dy1 Pyth +def } def +/CC { /l0 l1 def /x1 x dx sub def /y1 y dy sub def /dx0 dx1 def /dy0 dy1 +def CCA /dx dx0 l1 c exp mul dx1 l0 c exp mul add def /dy dy0 l1 c exp +mul dy1 l0 c exp mul add def /m dx0 dy0 Atan dx1 dy1 Atan sub 2 div cos +abs b exp a mul dx dy Pyth Div 2 div def /x2 x l0 dx mul m mul sub def +/y2 y l0 dy mul m mul sub def /dx l1 dx mul m mul neg def /dy l1 dy mul +m mul neg def } def +/IC { /c c 1 add def c 0 lt { /c 0 def } { c 3 gt { /c 3 def } if } +ifelse /a a 2 mul 3 div 45 cos b exp div def CCA /dx 0 def /dy 0 def } +def +/BOC { IC CC x2 y2 x1 y1 ArrowA CP 4 2 roll x y curveto } def +/NC { CC x1 y1 x2 y2 x y curveto } def +/EOC { x dx sub y dy sub 4 2 roll ArrowB 2 copy curveto } def +/BAC { IC CC x y moveto CC x1 y1 CP ArrowA } def +/NAC { x2 y2 x y curveto CC x1 y1 } def +/EAC { x2 y2 x y ArrowB curveto pop pop } def +/OpenCurve { NArray n 3 lt { n { pop pop } repeat } { BOC /n n 3 sub def +n { NC } repeat EOC } ifelse } def +/AltCurve { { false NArray n 2 mul 2 roll [ n 2 mul 3 sub 1 roll ] aload +/Points ED n 2 mul -2 roll } { false NArray } ifelse n 4 lt { n { pop +pop } repeat } { BAC /n n 4 sub def n { NAC } repeat EAC } ifelse } def +/ClosedCurve { NArray n 3 lt { n { pop pop } repeat } { n 3 gt { +CheckClosed } if 6 copy n 2 mul 6 add 6 roll IC CC x y moveto n { NC } +repeat closepath pop pop } ifelse } def +/SQ { /r ED r r moveto r r neg L r neg r neg L r neg r L fill } def +/ST { /y ED /x ED x y moveto x neg y L 0 x L fill } def +/SP { /r ED gsave 0 r moveto 4 { 72 rotate 0 r L } repeat fill grestore } +def +/FontDot { DS 2 mul dup matrix scale matrix concatmatrix exch matrix +rotate matrix concatmatrix exch findfont exch makefont setfont } def +/Rect { x1 y1 y2 add 2 div moveto x1 y2 lineto x2 y2 lineto x2 y1 lineto +x1 y1 lineto closepath } def +/OvalFrame { x1 x2 eq y1 y2 eq or { pop pop x1 y1 moveto x2 y2 L } { y1 +y2 sub abs x1 x2 sub abs 2 copy gt { exch pop } { pop } ifelse 2 div +exch { dup 3 1 roll mul exch } if 2 copy lt { pop } { exch pop } ifelse +/b ED x1 y1 y2 add 2 div moveto x1 y2 x2 y2 b arcto x2 y2 x2 y1 b arcto +x2 y1 x1 y1 b arcto x1 y1 x1 y2 b arcto 16 { pop } repeat closepath } +ifelse } def +/Frame { CLW mul /a ED 3 -1 roll 2 copy gt { exch } if a sub /y2 ED a add +/y1 ED 2 copy gt { exch } if a sub /x2 ED a add /x1 ED 1 index 0 eq { +pop pop Rect } { OvalFrame } ifelse } def +/BezierNArray { /f ED counttomark 2 div dup cvi /n ED n eq not { exch pop +} if n 1 sub neg 3 mod 3 add 3 mod { 0 0 /n n 1 add def } repeat f { ] +aload /Points ED } { n 2 mul 1 add -1 roll pop } ifelse } def +/OpenBezier { BezierNArray n 1 eq { pop pop } { ArrowA n 4 sub 3 idiv { 6 +2 roll 4 2 roll curveto } repeat 6 2 roll 4 2 roll ArrowB curveto } +ifelse } def +/ClosedBezier { BezierNArray n 1 eq { pop pop } { moveto n 1 sub 3 idiv { +6 2 roll 4 2 roll curveto } repeat closepath } ifelse } def +/BezierShowPoints { gsave Points aload length 2 div cvi /n ED moveto n 1 +sub { lineto } repeat CLW 2 div SLW [ 4 4 ] 0 setdash stroke grestore } +def +/Parab { /y0 exch def /x0 exch def /y1 exch def /x1 exch def /dx x0 x1 +sub 3 div def /dy y0 y1 sub 3 div def x0 dx sub y0 dy add x1 y1 ArrowA +x0 dx add y0 dy add x0 2 mul x1 sub y1 ArrowB curveto /Points [ x1 y1 x0 +y0 x0 2 mul x1 sub y1 ] def } def +/Grid { newpath /a 4 string def /b ED /c ED /n ED cvi dup 1 lt { pop 1 } +if /s ED s div dup 0 eq { pop 1 } if /dy ED s div dup 0 eq { pop 1 } if +/dx ED dy div round dy mul /y0 ED dx div round dx mul /x0 ED dy div +round cvi /y2 ED dx div round cvi /x2 ED dy div round cvi /y1 ED dx div +round cvi /x1 ED /h y2 y1 sub 0 gt { 1 } { -1 } ifelse def /w x2 x1 sub +0 gt { 1 } { -1 } ifelse def b 0 gt { /z1 b 4 div CLW 2 div add def +/Helvetica findfont b scalefont setfont /b b .95 mul CLW 2 div add def } +if systemdict /setstrokeadjust known { true setstrokeadjust /t { } def } +{ /t { transform 0.25 sub round 0.25 add exch 0.25 sub round 0.25 add +exch itransform } bind def } ifelse gsave n 0 gt { 1 setlinecap [ 0 dy n +div ] dy n div 2 div setdash } { 2 setlinecap } ifelse /i x1 def /f y1 +dy mul n 0 gt { dy n div 2 div h mul sub } if def /g y2 dy mul n 0 gt { +dy n div 2 div h mul add } if def x2 x1 sub w mul 1 add dup 1000 gt { +pop 1000 } if { i dx mul dup y0 moveto b 0 gt { gsave c i a cvs dup +stringwidth pop /z2 ED w 0 gt {z1} {z1 z2 add neg} ifelse h 0 gt {b neg} +{z1} ifelse rmoveto show grestore } if dup t f moveto g t L stroke /i i +w add def } repeat grestore gsave n 0 gt { 1 setlinecap [ 0 dx n div ] +dy n div 2 div setdash } { 2 setlinecap } ifelse /i y1 def /f x1 dx mul +n 0 gt { dx n div 2 div w mul sub } if def /g x2 dx mul n 0 gt { dx n +div 2 div w mul add } if def y2 y1 sub h mul 1 add dup 1000 gt { pop +1000 } if { newpath i dy mul dup x0 exch moveto b 0 gt { gsave c i a cvs +dup stringwidth pop /z2 ED w 0 gt {z1 z2 add neg} {z1} ifelse h 0 gt +{z1} {b neg} ifelse rmoveto show grestore } if dup f exch t moveto g +exch t L stroke /i i h add def } repeat grestore } def +/ArcArrow { /d ED /b ED /a ED gsave newpath 0 -1000 moveto clip newpath 0 +1 0 0 b grestore c mul /e ED pop pop pop r a e d PtoC y add exch x add +exch r a PtoC y add exch x add exch b pop pop pop pop a e d CLW 8 div c +mul neg d } def +/Ellipse { /mtrx CM def T scale 0 0 1 5 3 roll arc mtrx setmatrix } def +/Rot { CP CP translate 3 -1 roll neg rotate NET } def +/RotBegin { tx@Dict /TMatrix known not { /TMatrix { } def /RAngle { 0 } +def } if /TMatrix [ TMatrix CM ] cvx def /a ED a Rot /RAngle [ RAngle +dup a add ] cvx def } def +/RotEnd { /TMatrix [ TMatrix setmatrix ] cvx def /RAngle [ RAngle pop ] +cvx def } def +/PutCoor { gsave CP T CM STV exch exec moveto setmatrix CP grestore } def +/PutBegin { /TMatrix [ TMatrix CM ] cvx def CP 4 2 roll T moveto } def +/PutEnd { CP /TMatrix [ TMatrix setmatrix ] cvx def moveto } def +/Uput { /a ED add 2 div /h ED 2 div /w ED /s a sin def /c a cos def /b s +abs c abs 2 copy gt dup /q ED { pop } { exch pop } ifelse def /w1 c b +div w mul def /h1 s b div h mul def q { w1 abs w sub dup c mul abs } { +h1 abs h sub dup s mul abs } ifelse } def +/UUput { /z ED abs /y ED /x ED q { x s div c mul abs y gt } { x c div s +mul abs y gt } ifelse { x x mul y y mul sub z z mul add sqrt z add } { q +{ x s div } { x c div } ifelse abs } ifelse a PtoC h1 add exch w1 add +exch } def +/BeginOL { dup (all) eq exch TheOL eq or { IfVisible not { Visible +/IfVisible true def } if } { IfVisible { Invisible /IfVisible false def +} if } ifelse } def +/InitOL { /OLUnit [ 3000 3000 matrix defaultmatrix dtransform ] cvx def +/Visible { CP OLUnit idtransform T moveto } def /Invisible { CP OLUnit +neg exch neg exch idtransform T moveto } def /BOL { BeginOL } def +/IfVisible true def } def +end diff --git a/usergrps/uktug/baskervi/6_2/spqr/pstricks.sty b/usergrps/uktug/baskervi/6_2/spqr/pstricks.sty new file mode 100644 index 0000000000..5785e1ae1b --- /dev/null +++ b/usergrps/uktug/baskervi/6_2/spqr/pstricks.sty @@ -0,0 +1,17 @@ +\ProvidesPackage{pstricks}[1994/07/12 all pstricks tools] +\input{pstricks} +\input{gradient} +\input{pst-plot} +\input{pst-coil} +\input{textpath} +\input{charpath} +\input{pst-node} +\input{pst-3d} +\input{pst2eps} +\input{boxfill} +\input{pstree} +\input{multido} +%\input{pst-beta.tex} +%\input{pst-beta.bug} +\newpsobject{usergrid}{psgrid}{subgriddiv=1,griddots=10,gridlabels=7pt} +\endinput diff --git a/usergrps/uktug/baskervi/6_2/spqr/pstricks.tex b/usergrps/uktug/baskervi/6_2/spqr/pstricks.tex new file mode 100644 index 0000000000..fcb8b77902 --- /dev/null +++ b/usergrps/uktug/baskervi/6_2/spqr/pstricks.tex @@ -0,0 +1,2554 @@ +%% BEGIN: pstricks.tex +%% Generated on <1994/6/16> from `pstricks.doc'. +%% For use with the PostScript header file `pstricks.pro'. +%% +\def\fileversion{0.93a} +\def\filedate{93/03/12} +%% +%% pstricks.tex: Main input file for the PSTricks package. +%% 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. +%% +\csname PSTricksLoaded\endcsname +\let\PSTricksLoaded\endinput +\edef\PstAtCode{\the\catcode`\@} +\catcode`\@=11\relax +\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 +\typeout{`PSTricks' v\fileversion\space\space <\filedate> (tvz)} +\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} +\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.} +\def\pst@misplaced#1{\@pstrickserr{Misplaced \string#1 command}\@ehpb} +\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 +\newtoks\pst@toks +\newif\if@star +\def\pst@ifstar#1{% +\@ifnextchar*{\@startrue\def\next*{#1}\next}{\@starfalse#1}} +\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} +\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}} +\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} +\def\pst@divide#1#2#3{% +\pst@@divide{#1}{#2}% +\pst@dimtonum\pst@dimg{#3}} +\def\pst@@divide#1#2{% +\pst@dimg=#1\relax +\pst@dimh=#2\relax +\pst@cntg=\pst@dimh +\pst@cnth=67108863 +\pst@@@divide\pst@@@divide\pst@@@divide\pst@@@divide +\divide\pst@dimg\pst@cntg} +\def\pst@@@divide{% +\ifnum +\ifnum\pst@dimg<\z@-\fi\pst@dimg<\pst@cnth +\multiply\pst@dimg\sixt@@n +\else +\divide\pst@cntg\sixt@@n +\fi} +\def\pst@configerr#1{% +\@pstrickserr{\string#1 not defined in pstricks.con}\@ehpc} +% % \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 +\newif\ifPSTricks +\PSTrickstrue +\def\PSTricksOff{% +\def\pstheader##1{}% +\def\pstverb##1{}% +\def\pstVerb##1{}% +\PSTricksfalse} +\@ifundefined{pst@def}{\def\pst@def#1<#2>{\@namedef{tx@#1}{#2 }}}{} +\@ifundefined{pst@ATH}{\def\pst@ATH<#1>{}}{} +\pstheader{pstricks.pro} +\def\pst@dict{tx@Dict begin } +\def\pst@theheaders{pstricks.pro} +\def\pst@Verb#1{\pstVerb{\pst@dict #1 end}} +\def\tx@Atan{Atan } +\def\tx@Div{Div } +\def\tx@NET{NET } +\def\tx@Pyth{Pyth } +\def\tx@PtoC{PtoC } +\def\tx@PathLength@{PathLength@ } +\def\tx@PathLength{PathLength } +\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 +\def\tx@STP{STP } +\def\tx@STV{STV } +\def\pst@number#1{\pst@@dimtonum#1\space} +\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=\tw@-\fi\the\pst@cntg.% +\expandafter\@gobble\the\pst@cnth\space}% +\fi} +\def\pst@@checknum{% +\@ifnextchar-% +{\let\pst@num\tw@\expandafter\pst@@@checknum\@gobble}% +{\let\pst@num\@ne\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} +\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} +\def\pst@getdimnum#1 #2 #3\@nil{% +\pssetlength\pst@dimg{#1}% +\pst@checknum{#2}\pst@tempg} +\def\pst@getscale#1#2{% +\pst@expandafter\pst@getnumii{#1 #1} {} {} {}\@nil +\@psttrue +\ifdim\pst@tempg\p@=\z@ +\@pstrickserr{Bad scaling argument `#1'}\@ehpa +\def\pst@tempg{1 }% +\@pstfalse +\fi +\ifdim\pst@temph\p@=\z@ +\if@pst\@pstrickserr{Bad scaling argument `#1'}\@ehpa\fi +\def\pst@temph{1 }% +\fi +\edef#2{\pst@tempg\space \pst@temph\space scale }% +\ifdim\pst@tempg\p@=\p@ \ifdim\pst@temph\p@=\p@ +\def#2{}% +\fi\fi} +\def\pst@getint#1#2{% +\pst@cntg=#1\relax +\edef#2{\the\pst@cntg\space}} +\begingroup +\catcode`\{=12 +\catcode`\}=12 +\catcode`\[=1 +\catcode`\]=2 +\gdef\pslbrace[{ ] +\gdef\psrbrace[} ] +\endgroup +\def\@newcolor#1#2{% +\expandafter\edef\csname #1\endcsname{\noexpand\pst@color{#2}}% +\expandafter\edef\csname color@#1\endcsname{#2}% +\ignorespaces} +\def\pst@color#1{% +\def\pst@currentcolor{#1}\pstVerb{#1}\aftergroup\pst@endcolor} +\def\pst@endcolor{\pstVerb{\pst@currentcolor}} +\def\pst@currentcolor{0 setgray} +\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} +\def\pst@usecolor#1{\csname color@#1\endcsname\space} +\def\newgray#1#2{% +\pst@checknum{#2}\pst@tempg +\@newcolor{#1}{\pst@tempg setgray}} +\def\newrgbcolor#1#2{% +\pst@expandafter\pst@getnumiii{#2} {} {} {} {}\@nil +\@newcolor{#1}{\pst@tempg \pst@temph \pst@tempi setrgbcolor}} +\def\newhsbcolor#1#2{% +\pst@expandafter\pst@getnumiii{#2} {} {} {} {}\@nil +\@newcolor{#1}{\pst@tempg \pst@temph \pst@tempi sethsbcolor}} +\def\newcmykcolor#1#2{% +\pst@expandafter\pst@getnumiv{#2} {} {} {} {} {}\@nil +\@newcolor{#1}{\pst@tempg \pst@temph \pst@tempi \pst@tempj setcmykcolor}} +\newgray{black}{0} +\newgray{darkgray}{.25} +\newgray{gray}{.5} +\newgray{lightgray}{.75} +\newgray{white}{1} +\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} +\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}}}% +\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}}} +\def\@none{none} +\def\pst@getcolor#1#2{% +\@ifundefined{color@#1}% +{\@pstrickserr{Color `#1' not defined}\@eha}% +{\edef#2{#1}}} +\newdimen\psunit \psunit 1cm +\newdimen\psxunit \psxunit 1cm +\newdimen\psyunit \psyunit 1cm +\let\psrunit\psunit +\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} +\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}} +\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}} +\def\pst@getcoor#1#2{\pst@@getcoor{#1}\let#2\pst@coor} +\def\pst@coor{0 0 } +\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}} +\def\pst@getangle#1#2{\pst@@getangle{#1}\let#2\pst@angle} +\def\pst@angle{0 } +\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 +\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{} +\def\SpecialCoor{% +\def\pst@@getcoor##1{% +\begingroup +\pst@activecoor +\xdef\pst@tempg{##1}% +\endgroup +\expandafter\special@coor\pst@tempg||\@nil}% +\def\pst@@getangle##1{% +\begingroup +\pst@activecoor +\xdef\pst@tempg{##1}% +\endgroup +\expandafter\special@angle\pst@tempg\@empty)\@nil}% +\def\psput@##1{\pst@@getcoor{##1}\leavevmode\psput@special}} +\begingroup +\catcode`\|=13 +\catcode`\;=13 +\catcode`\!=13 +\gdef\pst@activecoor{% +\def|{\string|}% +\def;{\string;}% +\def!{\string!}} +\endgroup +\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} +\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} +\def\polar@coor#1#2{% +\pssetlength\pst@dimg{#1}% +\pst@@getangle{#2}% +\edef\pst@coor{\pst@number\pst@dimg \pst@angle \tx@PtoC}} +\def\raw@coor#1;#2\@nil{% +\edef\pst@coor{% +#1 \pst@number\psyunit mul exch \pst@number\psxunit mul exch }} +\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} +\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} +\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}}}% +\def\psset@origin#1{% +\pst@@getcoor{#1}% +\edef\psk@origin{\pst@coor \tx@NET }} +\def\psk@origin{} +\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} +\newif\ifshowpoints +\def\psset@showpoints#1{\@nameuse{showpoints#1}} +\psset@showpoints{false} +\let\pst@setrepeatarrowsflag\relax +\def\psset@border#1{% +\pst@getlength{#1}\psk@border +\pst@setrepeatarrowsflag} +\psset@border{0pt} +\def\psset@bordercolor#1{\pst@getcolor{#1}\psbordercolor} +\psset@bordercolor{white} +\newif\ifpsdoubleline +\def\psset@doubleline#1{% +\@nameuse{psdoubleline#1}% +\pst@setrepeatarrowsflag} +\psset@doubleline{false} +\def\psset@doublesep#1{\def\psdoublesep{#1}} +\psset@doublesep{1.25\pslinewidth} +\def\psset@doublecolor#1{\pst@getcolor{#1}\psdoublecolor} +\psset@doublecolor{white} +\newif\ifpsshadow +\def\psset@shadow#1{% +\@nameuse{psshadow#1}% +\pst@setrepeatarrowsflag} +\psset@shadow{false} +\def\psset@shadowsize#1{\pst@getlength{#1}\psk@shadowsize} +\psset@shadowsize{3pt} +\def\psset@shadowangle#1{\pst@getangle{#1}\psk@shadowangle} +\psset@shadowangle{-45} +\def\psset@shadowcolor#1{\pst@getcolor{#1}\psshadowcolor} +\psset@shadowcolor{darkgray} +\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}} +\def\psls@none{} +\newdimen\pslinewidth +\def\psset@linewidth#1{\pssetlength\pslinewidth{#1}} +\psset@linewidth{.8pt} +\def\psset@linecolor#1{\pst@getcolor{#1}\pslinecolor} +\psset@linecolor{black} +\def\psls@solid{0 setlinecap stroke } +\def\pst@missing{% +\z@ +\@pstrickserr{Missing number or dimension. 0 substituted}\@ehpa} +\def\psset@dash#1{% +\pst@expandafter\psset@@dash{#1} {\pst@missing} {\pst@missing} {}\@nil +\edef\psk@dash{\pst@number\pst@dimg \pst@number\pst@dimh}} +\def\psset@@dash#1 #2 #3\@nil{% +\pssetlength\pst@dimg{#1}% +\pssetlength\pst@dimh{#2}} +\psset@dash{5pt 3pt} +\newif\ifpsdashadjust +\def\psset@dashadjust#1{\@nameuse{psdashadjust#1}} +\psset@dashadjust{true} +\def\psls@dashed{% +\ifpsdashadjust +\psk@dash \pst@linetype\space \tx@DashLine +\else +[ \psk@dash ] 0 setdash stroke +\fi} +\def\tx@DashLine{DashLine } +\def\psset@dotsep#1{\pst@getlength{#1}\psk@dotsep} +\psset@dotsep{3pt} +\def\psls@dotted{% +\ifpsdashadjust +\psk@dotsep \pst@linetype\space \tx@DotLine +\else +[ 0 \psk@dotsep CLW add ] 0 setdash 1 setlinecap stroke +\fi} +\def\tx@DotLine{DotLine } +\def\psset@linestyle#1{% +\@ifundefined{psls@#1}% +{\@pstrickserr{Line style `#1' not defined}\@eha}% +{\edef\pslinestyle{#1}}} +\psset@linestyle{solid} +\def\psfs@none{} +\def\psset@fillcolor#1{\pst@getcolor{#1}\psfillcolor} +\psset@fillcolor{white} +\def\psfs@solid{\pst@fill{\pst@usecolor\psfillcolor fill}} +\def\psset@hatchwidth#1{\pst@getlength{#1}\psk@hatchwidth} +\psset@hatchwidth{.8pt} +\def\psset@hatchsep#1{\pst@getlength{#1}\psk@hatchsep} +\psset@hatchsep{4pt} +\def\psset@hatchcolor#1{\pst@getcolor{#1}\pshatchcolor} +\psset@hatchcolor{black} +\def\psset@hatchangle#1{\pst@getangle{#1}\psk@hatchangle} +\psset@hatchangle{45} +\def\pst@linefill{% +\psk@hatchangle rotate +\psk@hatchwidth SLW +\pst@usecolor\pshatchcolor +\psk@hatchsep \tx@LineFill} +\def\psfs@vlines{\pst@fill\pst@linefill} +\@namedef{psfs@vlines*}{\psfs@solid \psfs@vlines} +\def\psfs@hlines{\pst@fill{90 rotate \pst@linefill}} +\@namedef{psfs@hlines*}{\psfs@solid \psfs@hlines} +\def\psfs@crosshatch{\psfs@vlines \psfs@hlines} +\@namedef{psfs@crosshatch*}{\psfs@solid \psfs@vlines \psfs@hlines} +\def\tx@LineFill{LineFill } +\def\psset@fillstyle#1{% +\edef\pst@tempg{#1}\def\pst@temph{none}% +\ifx\pst@tempg\pst@temph +\let\psk@fillstyle\relax +\else +\@ifundefined{psfs@#1}% +{\@pstrickserr{Undefined fill style: `#1'}\@eha}% +{\edef\psk@fillstyle{\expandafter\noexpand\csname psfs@#1\endcsname}}% +\fi} +\def\psset@addfillstyle#1{% +\@ifundefined{psfs@#1}% +{\@pstrickserr{Undefined fill style: `#1'}\@eha}% +{\edef\psk@fillstyle{% +\expandafter\noexpand\psk@fillstyle +\expandafter\noexpand\csname psfs@#1\endcsname}}} +\psset@fillstyle{none} +\def\psset@arrows#1{% +\begingroup +\pst@activearrows +\xdef\pst@tempg{#1}% +\endgroup +\expandafter\psset@@arrows\pst@tempg\@empty-\@empty\@nil +\if@pst\else +\@pstrickserr{Bad arrows specification: #1}\@ehpa +\fi} +\def\psset@@arrows#1-#2\@empty#3\@nil{% +\@psttrue +\def\next##1,#1-##2,##3\@nil{\def\pst@tempg{##2}}% +\expandafter\next\pst@arrowtable,#1-#1,\@nil +\@ifundefined{psas@\pst@tempg}% +{\@pstfalse\def\psk@arrowA{}}% +{\let\psk@arrowA\pst@tempg}% +\@ifundefined{psas@#2}% +{\@pstfalse\def\psk@arrowB{}}% +{\def\psk@arrowB{#2}}} +\def\psk@arrowA{} +\def\psk@arrowB{} +\def\pst@arrowtable{,<->,<<->>,>-<,>>-<<,(-),[-]} +\begingroup +\catcode`\<=13 +\catcode`\>=13 +\catcode`\|=13 +\gdef\pst@activearrows{\def<{\string<}\def>{\string>}\def|{\string|}} +\endgroup +\def\tx@BeginArrow{BeginArrow } +\def\tx@EndArrow{EndArrow } +\def\psset@arrowscale#1{\pst@getscale{#1}\psk@arrowscale} +\psset@arrowscale{1} +\def\psset@arrowsize#1{% +\pst@expandafter\pst@getdimnum{#1} 0 {} {}\@nil +\edef\psk@arrowsize{\pst@number\pst@dimg \pst@tempg}} +\psset@arrowsize{1.5pt 2} +\def\psset@arrowlength#1{\pst@checknum{#1}\psk@arrowlength} +\psset@arrowlength{1.4} +\def\psset@arrowinset#1{\pst@checknum{#1}\psk@arrowinset}% +\psset@arrowinset{.4} +\def\tx@Arrow{Arrow } +\@namedef{psas@>}{% +false \psk@arrowinset \psk@arrowlength \psk@arrowsize \tx@Arrow} +\@namedef{psas@>>}{% +false \psk@arrowinset \psk@arrowlength \psk@arrowsize \tx@Arrow +0 h T +gsave +newpath +false \psk@arrowinset \psk@arrowlength \psk@arrowsize \tx@Arrow +CP +grestore +CP newpath moveto +2 copy +L +stroke +moveto} +\@namedef{psas@<}{% +true \psk@arrowinset \psk@arrowlength \psk@arrowsize \tx@Arrow} +\@namedef{psas@<<}{% +true \psk@arrowinset \psk@arrowlength \psk@arrowsize \tx@Arrow +CP newpath moveto 0 a neg L stroke 0 h neg T +false \psk@arrowinset \psk@arrowlength \psk@arrowsize \tx@Arrow} +\def\psset@tbarsize#1{% +\pst@expandafter\pst@getdimnum{#1} 0 {} {}\@nil +\edef\psk@tbarsize{\pst@number\pst@dimg \pst@tempg}} +\psset@tbarsize{2pt 5} +\def\tx@Tbar{Tbar } +\@namedef{psas@|}{\psk@tbarsize \tx@Tbar} +\@namedef{psas@|*}{0 CLW -2 div T \psk@tbarsize \tx@Tbar} +\@namedef{psas@>|}{% +\psk@tbarsize \tx@Tbar +0 CLW 2 div T +newpath +false \psk@arrowinset \psk@arrowlength \psk@arrowsize \tx@Arrow} +\@namedef{psas@>|*}{% +0 CLW -2 div T +\psk@tbarsize \tx@Tbar +0 CLW 2 div T +newpath +false \psk@arrowinset \psk@arrowlength \psk@arrowsize \tx@Arrow} +\edef\pst@arrowtable{\pst@arrowtable,|<*->|*,|<->|} +\def\psset@bracketlength#1{\pst@checknum{#1}\psk@bracketlength} +\psset@bracketlength{.15} +\def\tx@Bracket{Bracket } +\@namedef{psas@]}{\psk@bracketlength \psk@tbarsize \tx@Bracket} +\def\psset@rbracketlength#1{\pst@checknum{#1}\psk@rbracketlength} +\psset@rbracketlength{.15} +\def\tx@RoundBracket{RoundBracket } +\@namedef{psas@)}{\psk@rbracketlength \psk@tbarsize \tx@RoundBracket} +\def\psas@c{1 \psas@@c} +\def\psas@cc{0 CLW 2 div T 1 \psas@@c} +\def\psas@C{2 \psas@@c} +\def\psas@@c{% +setlinecap +0 0 moveto +0 CLW 2 div L +stroke +0 0 moveto} +\def\psas@{} +\psset@arrows{-} +\def\tx@SD{SD } +\def\tx@EndDot{EndDot } +\def\psas@oo{{\pst@usecolor\psfillcolor true} true \psk@dotsize \tx@EndDot} +\def\psas@o{{\pst@usecolor\psfillcolor true} false \psk@dotsize \tx@EndDot} +\@namedef{psas@**}{{false} true \psk@dotsize \tx@EndDot} +\@namedef{psas@*}{{false} false \psk@dotsize \tx@EndDot} +\def\pst@par{} +\def\addto@par#1{% +\ifx\pst@par\@empty +\def\pst@par{#1}% +\else +\expandafter\def\expandafter\pst@par\expandafter{\pst@par,#1}% +\fi} +\def\addbefore@par#1{% +\ifx\pst@par\@empty +\def\pst@par{#1}% +\else +\toks@{#1}% +\pst@toks\expandafter{\pst@par}% +\edef\pst@par{\the\toks@,\the\pst@toks}% +\fi} +\def\use@par{% +\ifx\pst@par\@empty\else +\expandafter\@psset\pst@par,\@nil +\def\pst@par{}% +\fi} +\def\pst@object#1{% +\pst@ifstar{% +\@ifnextchar[% +{\pst@@object{#1}}% +{\def\pst@par{}\@nameuse{#1@i}}}} +\def\pst@@object#1[#2]{% +\def\pst@par{#2}% +\@ifnextchar+{\@nameuse{#1@i}}{\@nameuse{#1@i}}} +\def\newpsobject#1#2#3{% +\@ifundefined{#2@i}% +{\@pstrickserr{Graphics object `#2' not defined}\@eha}{% +\@namedef{#1}{\pst@object{#1}}% +\@namedef{#1@i}{\addbefore@par{#3}\@nameuse{#2@i}}}% +\ignorespaces} +\def\pst@getarrows#1{\@ifnextchar({#1}{\pst@@getarrows{#1}}} +\def\pst@@getarrows#1#2{\addto@par{arrows=#2}#1} +\def\begin@ClosedObj{% +\leavevmode +\pst@killglue +\begingroup +\use@par +\solid@star +\ifpsdoubleline \pst@setdoublesep \fi +\init@pscode} +\def\end@ClosedObj{% +\ifpsshadow \pst@closedshadow \fi +\ifdim\psk@border\p@>\z@ \pst@addborder \fi +\psk@fillstyle +\pst@stroke +\ifpsdoubleline \pst@doublestroke \fi +\ifshowpoints +\addto@pscode{Points aload length 2 div cvi /N ED \psdots@iii}% +\fi +\use@pscode +\endgroup +\ignorespaces} +\def\begin@OpenObj{% +\begin@ClosedObj +\let\pst@linetype\pst@arrowtype +\pst@addarrowdef} +\def\begin@AltOpenObj{% +\begin@ClosedObj +\def\pst@repeatarrowsflag{\z@}% +\def\pst@linetype{0}} +\def\end@OpenObj{% +\ifpsshadow \pst@openshadow \fi +\ifdim\psk@border\p@>\z@ \pst@addborder \fi +\psk@fillstyle +\pst@stroke +\ifpsdoubleline \pst@doublestroke \fi +\ifnum\pst@repeatarrowsflag>\z@ \pst@repeatarrows \fi +\ifshowpoints \pst@OpenShowPoints \fi +\use@pscode +\endgroup +\ignorespaces} +\def\begin@SpecialObj{% +\leavevmode +\pst@killglue +\begingroup +\use@par +\init@pscode} +\def\end@SpecialObj{% +\use@pscode +\endgroup +\ignorespaces} +\def\pst@code{}% +\def\init@pscode{% +\addto@pscode{% +\pst@number\pslinewidth SLW +\pst@usecolor\pslinecolor}} +\def\addto@pscode#1{\xdef\pst@code{\pst@code#1\space}} +\def\use@pscode{% +\pstverb{% +\pst@dict +\tx@STP +\pst@newpath +\psk@origin +\psk@swapaxes +\pst@code +end}% +\gdef\pst@code{}} +\def\pst@newpath{newpath } +\def\pst@@killglue{\unskip\ifdim\lastskip>\z@\expandafter\pst@@killglue\fi} +\def\KillGlue{\let\pst@killglue\pst@@killglue} +\def\DontKillGlue{\let\pst@killglue\relax} +\DontKillGlue +\def\solid@star{% +\if@star +\pslinewidth=\z@ +\psdoublelinefalse +\def\pslinestyle{none}% +\def\psk@fillstyle{\psfs@solid}% +\let\psfillcolor\pslinecolor +\fi} +\def\pst@setdoublesep{% +\pst@getlength\psdoublesep\psdoublesep +\pslinewidth=2\pslinewidth +\advance\pslinewidth\psdoublesep\p@ +\let\pst@setdoublesep\relax} +\def\tx@Shadow{Shadow } +\def\pst@closedshadow{% +\addto@pscode{% +gsave +\psk@shadowsize \psk@shadowangle \tx@PtoC +\tx@Shadow +\pst@usecolor\psshadowcolor +gsave fill grestore +stroke +grestore +gsave +\pst@usecolor\psfillcolor +gsave fill grestore +stroke +grestore}} +\def\pst@openshadow{% +\addto@pscode{% +gsave +\psk@shadowsize \psk@shadowangle \tx@PtoC +\tx@Shadow +\pst@usecolor\psshadowcolor +\ifx\psk@fillstyle\relax\else +gsave fill grestore +\fi +stroke}% +\pst@repeatarrows +\addto@pscode{grestore} +\ifx\psk@fillstyle\relax\else +\addto@pscode{% +gsave +\pst@usecolor\psfillcolor +gsave fill grestore +stroke +grestore} +\fi} +\def\pst@addborder{% +\addto@pscode{% +gsave +\psk@border 2 mul +CLW add SLW +\pst@usecolor\psbordercolor +stroke +grestore}} +\def\pst@stroke{% +\ifx\pslinestyle\@none\else +\addto@pscode{% +gsave +\pst@number\pslinewidth SLW +\pst@usecolor\pslinecolor +\@nameuse{psls@\pslinestyle} +grestore}% +\fi} +\def\pst@fill#1{\addto@pscode{gsave #1 grestore}}% +\def\pst@doublestroke{% +\addto@pscode{% +gsave +\psdoublesep SLW +\pst@usecolor\psdoublecolor +stroke +grestore}} +\def\pst@arrowtype{% +\ifx\psk@arrowB\@empty 0 \else -2 \fi +\ifx\psk@arrowA\@empty 0 \else -1 \fi +add} +\def\pst@addarrowdef{% +\addto@pscode{% +/ArrowA { +\ifx\psk@arrowA\@empty +\pst@oplineto +\else +\pst@arrowdef{A} +moveto +\fi +} def +/ArrowB { +\ifx\psk@arrowB\@empty \else \pst@arrowdef{B} \fi +} def}} +\def\pst@arrowdef#1{% +\ifnum\pst@repeatarrowsflag>\z@ +/Arrow#1c [ 6 2 roll ] cvx def Arrow#1c +\fi +\tx@BeginArrow +\psk@arrowscale +\@nameuse{psas@\@nameuse{psk@arrow#1}} +\tx@EndArrow} +\def\pst@repeatarrows{% +\addto@pscode{% +gsave +\ifx\psk@arrowA\@empty\else +ArrowAc ArrowA pop pop +\fi +\ifx\psk@arrowB\@empty\else +ArrowBc ArrowB pop pop pop pop +\fi +grestore}} +\def\pst@OpenShowPoints{% +\addto@pscode{% +gsave +\psk@dotsize +\@nameuse{psds@\psk@dotstyle} +newpath +Points aload length 2 div 2 sub cvi /N ED +N 0 ge +{ \ifx\psk@arrowA\@empty +Dot +\else +pop pop +\fi +N { Dot } repeat +\ifx\psk@arrowB\@empty +Dot +\else +pop pop +\fi } +{ N 2 mul { pop } repeat } +ifelse +grestore}} +\def\pscustom{\pst@object{pscustom}} +\long\def\pscustom@i#1{% +\begin@SpecialObj +\solid@star +\let\pst@ifcustom\iftrue +\let\begin@ClosedObj\begin@CustomObj +\let\end@ClosedObj\endgroup +\def\begin@OpenObj{\begin@CustomObj\pst@addarrowdef}% +\let\end@OpenObj\endgroup +\let\begin@AltOpenObj\begin@CustomObj +\def\begin@SpecialObj{% +\begingroup +\pst@misplaced{special graphics object}% +\def\addto@pscode####1{} +\let\end@SpecialObj\endgroup}% +\def\@multips(##1)(##2)##3##4{\pst@misplaced\multips}% +\def\psclip##1{\pst@misplaced\psclip}% +\def\pst@repeatarrowsflag{\z@}% +\let\pst@setrepeatarrowsflag\relax +\showpointsfalse +\let\showpointstrue\relax +\def\pst@linetype{\pslinetype}% +\let\psset@liftpen\psset@@liftpen +\psset@liftpen{\z@}% +\def\pst@cp{/currentpoint load stopped pop }% +\def\pst@oplineto{/lineto load stopped { moveto } if }% +\def\pst@optcp##1##2{% +\ifnum##1=\z@\def##2{/currentpoint load stopped { 0 0 } if }\fi}% +\let\caddto@pscode\addto@pscode +\def\cuse@par##1{{\use@par##1}}% +\the\pst@customdefs +\setbox\pst@hbox=\hbox{#1}% +\psk@fillstyle +\pst@stroke +\end@SpecialObj} +\def\begin@CustomObj{% +\begingroup +\use@par +\addto@pscode{% +\pst@number\pslinewidth SLW +\pst@usecolor\pslinecolor}} +\def\pst@oplineto{moveto } +\def\pst@cp{} +\def\pst@optcp#1#2{} +\def\psset@liftpen#1{} +\def\psset@@liftpen#1{% +\ifcase#1\relax +\def\psk@liftpen{\z@}% +\def\pst@cp{/currentpoint load stopped pop }% +\def\pst@oplineto{/lineto load stopped { moveto } if }% +\or +\def\psk@liftpen{1}% +\def\pst@cp{}% +\def\pst@oplineto{/lineto load stopped { moveto } if }% +\or +\def\psk@liftpen{2}% +\def\pst@cp{}% +\def\pst@oplineto{moveto }% +\fi} +\psset@liftpen{0} +\def\psk@liftpen{-1} +\def\psset@linetype#1{% +\pst@getint{#1}\pslinetype +\ifnum\pst@dimg<-3 +\@pstrickserr{linetype must be greater than -3}\@ehpa +\def\pslinetype{0}% +\fi} +\psset@linetype{0} +\def\caddto@pscode#1{% +\@pstrickserr{Command can only be used in \string\pscustom}\@ehpa} +\let\cuse@par\caddto@pscode +\def\tx@MSave{% +/msavemtrx +[ tx@Dict /msavemtrx known { msavemtrx aload pop } if CM ] +def } +\def\tx@MRestore{% +tx@Dict /msavemtrx known { length 0 gt } { false } ifelse +{ /msavematrx [ msavematrx aload pop setmatrix ] def } +if } +\newtoks\pst@customdefs +\pst@customdefs{% +\def\newpath{\addto@pscode{newpath}}% +\def\moveto(#1){\pst@@getcoor{#1}\addto@pscode{\pst@coor moveto}}% +\def\closepath{\addto@pscode{closepath}}% +\def\gsave{\begingroup\addto@pscode{gsave}}% +\def\grestore{\endgroup\addto@pscode{grestore}}% +\def\translate(#1){\pst@@getcoor{#1}\addto@pscode{\pst@coor moveto}}% +\def\rotate#1{\pst@@getangle{#1}\addto@pscode{\pst@angle rotate}}% +\def\scale#1{\pst@getscale{#1}\pst@tempg\addto@pscode{\pst@tempg}}% +\def\msave{\addto@pscode{\tx@MSave}}% +\def\mrestore{\addto@pscode{\tx@MRestore}}% +\def\swapaxes{\addto@pscode{-90 rotate -1 1 scale}}% +\def\stroke{\pst@object{stroke}}% +\def\fill{\pst@object{fill}}% +\def\openshadow{\pst@object{openshadow}}% +\def\closedshadow{\pst@object{closedshadow}}% +\def\movepath(#1){\pst@@getcoor{#1}\addto@pscode{\pst@coor tx@Shadow}}% +\def\lineto{\pst@onecoor{lineto}}% +\def\rlineto{\pst@onecoor{rlineto}}% +\def\curveto{\pst@threecoor{curveto}}% +\def\rcurveto{\pst@threecoor{rcurveto}}% +\def\code#1{\addto@pscode{#1}}% +\def\coor(#1){\pst@@getcoor{#1}\addto@pscode\pst@coor\@ifnextchar({\coor}{}}% +\def\rcoor{\pst@getcoors{}{}}% +\def\dim#1{\pssetlength\pst@dimg{#1}\addto@pscode{\pst@number\pst@dimg}}% +\def\setcolor#1{% +\@ifundefined{color@#1}{}{\addto@pscode{\use@color{#1}}}}% +\def\arrows#1{{\psset@arrows{#1}\pst@addarrowdef}}% +\let\file\pst@rawfile +} % END \pst@customdefs +\def\closedshadow@i{\cuse@par\pst@closedshadow} +\def\openshadow@i{\cuse@par\pst@openshadow} +\def\stroke@i{\cuse@par\pst@stroke}% +\def\fill@i{\cuse@par\psk@fillstyle}% +\def\pst@onecoor#1(#2){% +\pst@@getcoor{#2}% +\addto@pscode{\pst@coor #1}} +\def\pst@threecoor#1(#2)#3(#4)#5(#6){% +\begingroup +\pst@getcoor{#2}\pst@tempa +\pst@getcoor{#4}\pst@tempb +\pst@getcoor{#6}\pst@tembc +\addto@pscode{\pst@tempa \pst@tempb \pst@tempc #1}% +\endgroup} +\def\pst@rawfile#1{% +\begingroup +\def\do##1{\catcode`##1=12\relax}" +\dospecials +\catcode`\%=14 +\pst@@rawfile{#1}% +\endgroup} +\def\pst@@rawfile#1{% +\immediate\openin1 #1 +\ifeof1 +\@pstrickserr{File `#1' not found}\@ehpa +\else +\immediate\read1 to \pst@tempg +\loop +\ifeof1 \@pstfalse\else\@psttrue\fi +\if@pst +\addto@pscode\pst@tempg +\immediate\read1 to \pst@tempg +\repeat +\fi +\immediate\closein1\relax} +\def\tx@NArray{NArray } +\def\tx@NArray{NArray } +\def\tx@Line{Line } +\def\tx@Arcto{Arcto } +\def\tx@CheckClosed{CheckClosed } +\def\tx@Polygon{Polygon } +\def\psset@gangle#1{\pst@getangle{#1}\psk@gangle} +\psset@gangle{0} +\def\tx@Diamond{Diamond } +\def\psdiamond{\pst@object{psdiamond}} +\def\psdiamond@i(#1){% +\@ifnextchar({\psdiamond@ii(#1)}{\psdiamond@ii(0,0)(#1)}} +\def\psdiamond@ii(#1)(#2){% +\begin@ClosedObj +\pst@getcoor{#1}\pst@tempa +\pst@getcoor{#2}\pst@tempb +\addto@pscode{% +\psline@iii +pop +\psk@dimen +\pst@tempb +\psk@gangle +\pst@tempa +\tx@Diamond}% +\def\pst@linetype{4}% +\end@ClosedObj} +\def\tx@Triangle{Triangle } +\def\pstriangle{\pst@object{pstriangle}} +\def\pstriangle@i(#1){% +\@ifnextchar({\pstriangle@ii(#1)}{\pstriangle@ii(0,0)(#1)}} +\def\pstriangle@ii(#1)(#2){% +\begin@ClosedObj +\pst@getcoor{#1}\pst@tempa +\pst@getcoor{#2}\pst@tempb +\addto@pscode{% +\psline@iii +pop +\psk@dimen +\pst@tempb +\psk@gangle +\pst@tempa +\tx@Triangle}% +\def\pst@linetype{2}% +\end@ClosedObj} +\def\tx@CCA{CCA } +\def\tx@CCA{CCA } +\def\tx@CC{CC } +\def\tx@IC{IC } +\def\tx@BOC{BOC } +\def\tx@NC{NC } +\def\tx@EOC{EOC } +\def\tx@BAC{BAC } +\def\tx@NAC{NAC } +\def\tx@EAC{EAC } +\def\tx@OpenCurve{OpenCurve } +\def\tx@AltCurve{AltCurve } +\def\tx@ClosedCurve{ClosedCurve } +\def\psset@curvature#1{% +\edef\pst@tempg{#1 }% +\expandafter\psset@@curvature\pst@tempg * * * \@nil} +\def\psset@@curvature#1 #2 #3 #4\@nil{% +\pst@checknum{#1}\pst@tempg +\pst@checknum{#2}\pst@temph +\pst@checknum{#3}\pst@tempi +\edef\psk@curvature{\pst@tempg \pst@temph \pst@tempi}} +\psset@curvature{1 .1 0} +\def\pscurve{\pst@object{pscurve}} +\def\pscurve@i{% +\pst@getarrows{% +\begin@OpenObj +\pst@getcoors[\pscurve@ii}} +\def\pscurve@ii{% +\addto@pscode{% +\pst@cp +\psk@curvature\space /c ED /b ED /a ED +\ifshowpoints true \else false \fi +\tx@OpenCurve}% +\end@OpenObj} +\def\psecurve{\pst@object{psecurve}} +\def\psecurve@i{% +\pst@getarrows{% +\begin@OpenObj +\pst@getcoors[\psecurve@ii}} +\def\psecurve@ii{% +\addto@pscode{% +\psk@curvature\space /c ED /b ED /a ED +\ifshowpoints true \else false \fi +\tx@AltCurve}% +\end@OpenObj} +\def\psccurve{\pst@object{psccurve}} +\def\psccurve@i{% +\begin@ClosedObj +\pst@getcoors[\psccurve@ii} +\def\psccurve@ii{% +\addto@pscode{% +\psk@curvature\space /c ED /b ED /a ED +\ifshowpoints true \else false \fi +\tx@ClosedCurve}% +\def\pst@linetype{1}% +\end@ClosedObj} +\def\psset@dotsize#1{% +\pst@expandafter\pst@getdimnum{#1} 0 {} {}\@nil +\edef\psk@@dotsize{\pst@number\pst@dimg}% +\let\psk@@@dotsize\pst@tempg +\edef\psk@dotsize{% +/DS \psk@@dotsize \psk@@@dotsize CLW mul add 2 div def }} +\psset@dotsize{2pt 2} +\def\psset@dotscale#1{% +\pst@getscale{#1}\psk@dotscale +\ifx\psk@dotscale\@empty +\def\psk@xdotscale{1 }% +\def\psk@ydotscale{1 }% +\else +\let\psk@xdotscale\pst@tempg +\let\psk@ydotscale\pst@temph +\fi} +\psset@dotscale{1} +\def\pst@Getangle#1#2{% +\pst@getangle{#1}\pst@tempg +\def\pst@temph{0. }% +\ifx\pst@tempg\pst@temph +\def#2{}% +\else +\edef#2{\pst@tempg\space rotate }% +\fi} +\def\psset@dotangle#1{% +\pst@getangle{#1}\psk@@dotangle +\ifdim\psk@@dotangle\p@=\z@ +\let\psk@dotangle\@empty +\else +\edef\psk@dotangle{\psk@@dotangle rotate } +\fi} +\psset@dotangle{0} +\def\pst@getdotsize{% +\pst@dimg=\psk@@@dotsize\pslinewidth +\advance\pst@dimg\psk@@dotsize\p@ +\pst@dimh=\psk@ydotscale\pst@dimg +\pst@dimg=\psk@xdotscale\pst@dimg +\divide\pst@dimh 2 +\divide\pst@dimg 2\relax} +\def\psdot{\pst@object{psdot}} +\def\psdot@i{\@ifnextchar({\psdot@ii}{\psdot@ii(\z@,\z@)}} +\def\psdot@ii(#1){% +\begin@SpecialObj +\pst@@getcoor{#1}% +\addto@pscode{% +\psk@dotsize +\@nameuse{psds@\psk@dotstyle}% +\pst@coor Dot}% +\end@SpecialObj} +\def\psdots{\pst@object{psdots}} +\def\psdots@i{% +\begin@SpecialObj +\pst@getcoors[\psdots@ii} +\def\psdots@ii{% +\addto@pscode{false \tx@NArray \psdots@iii}% +\end@SpecialObj} +\def\psdots@iii{% +\psk@dotsize +\@nameuse{psds@\psk@dotstyle} +newpath +n { transform floor .5 add exch floor .5 add exch itransform Dot } repeat} +\def\tx@SQ{SQ } +\def\tx@ST{ST } +\def\tx@SP{SP } +\def\pst@gdot#1{/Dot { gsave T \psk@dotangle \psk@dotscale #1 grestore } def } +\@namedef{psds@*}{\pst@gdot{0 0 DS \tx@SD}} +\@namedef{psds@o}{% +/r2 DS CLW sub def +\pst@gdot{0 0 DS \tx@SD \pst@usecolor\psfillcolor 0 0 r2 \tx@SD}} +\@namedef{psds@square*}{% +/r1 DS .886 mul def +\pst@gdot{r1 \tx@SQ}} +\@namedef{psds@square}{% +/r1 DS .886 mul def /r2 r1 CLW sub def +\pst@gdot{r1 \tx@SQ \pst@usecolor\psfillcolor r2 \tx@SQ}} +\@namedef{psds@triangle*}{% +/y1 DS .778 mul neg def /x1 y1 1.732 mul neg def +\pst@gdot{x1 y1 \tx@ST}} +\@namedef{psds@triangle}{% +/y1 DS .778 mul neg def /x1 y1 1.732 mul neg def +/y2 y1 CLW add def /x2 y2 1.732 mul neg def +\pst@gdot{x1 y1 \tx@ST \pst@usecolor\psfillcolor x2 y2 \tx@ST}} +\@namedef{psds@pentagon*}{% +/r1 DS 1.149 mul def +\pst@gdot{r1 \tx@SP}} +\@namedef{psds@pentagon}{% +DS .93 mul dup 1.236 mul /r1 ED CLW sub 1.236 mul /r2 ED +\pst@gdot{r1 \tx@SP \pst@usecolor\psfillcolor r2 \tx@SP}} +\@namedef{psds@+}{% +/DS DS 1.253 mul def +\pst@gdot{DS 0 moveto DS neg 0 L stroke 0 DS moveto 0 DS neg L stroke}} +\@namedef{psds@|}{% +\psk@tbarsize CLW mul add 2 div /DS ED +\pst@gdot{0 DS moveto 0 DS neg L stroke}} +\def\psset@dotstyle#1{% +\@ifundefined{psds@#1}% +{\@pstrickserr{Dot style `#1' not defined}\@eha}% +{\edef\psk@dotstyle{#1}}} +\psset@dotstyle{*} +\def\tx@FontDot{FontDot } +\def\newpsfontdot#1[#2]#3#4{% +\@namedef{psds@#1}{% +/#3 \psk@@dotangle [#2] \tx@FontDot +/Dot { moveto #4 show } bind def }} +\def\newpsfontdotH#1[#2]#3#4#5{% +\@namedef{psds@#1}{% +/#3 \psk@@dotangle [#2] \tx@FontDot +/Dot { +moveto +\iftrue +gsave \pst@usecolor\psfillcolor #5 show grestore +\fi +#4 show +} bind def }} +\pstheader{pst-dots.pro} +\newpsfontdot{*}% +[1.0 0.0 0.0 1.0 0.0 0.0]{PSTricksDotFont}{(b)} +\newpsfontdotH{o}% +[1.0 0.0 0.0 1.0 0.0 0.0]{PSTricksDotFont}{(c)}{(b)} +\newpsfontdotH{Bo}% +[1.0 0.0 0.0 1.0 0.0 0.0]{PSTricksDotFont}{(C)}{(b)} +\newpsfontdotH{triangle}% +[1.0 0.0 0.0 1.0 0.0 0.0]{PSTricksDotFont}{(t)}{(u)} +\newpsfontdotH{Btriangle}% +[1.0 0.0 0.0 1.0 0.0 0.0]{PSTricksDotFont}{(T)}{(u)} +\newpsfontdot{triangle*}% +[1.0 0.0 0.0 1.0 0.0 0.0]{PSTricksDotFont}{(u)} +\newpsfontdotH{square}% +[1.0 0.0 0.0 1.0 0.0 0.0]{PSTricksDotFont}{(s)}{(r)} +\newpsfontdotH{Bsquare}% +[1.0 0.0 0.0 1.0 0.0 0.0]{PSTricksDotFont}{(S)}{(r)} +\newpsfontdot{square*}% +[1.0 0.0 0.0 1.0 0.0 0.0]{PSTricksDotFont}{(r)} +\newpsfontdotH{pentagon}% +[1.0 0.0 0.0 1.0 0.0 0.0]{PSTricksDotFont}{(p)}{(q)} +\newpsfontdotH{Bpentagon}% +[1.0 0.0 0.0 1.0 0.0 0.0]{PSTricksDotFont}{(P)}{(q)} +\newpsfontdot{pentagon*}% +[1.0 0.0 0.0 1.0 0.0 0.0]{PSTricksDotFont}{(q)} +\newpsfontdot{diamond*}% +[1.9 0.0 0.0 1.9 -0.4598 -0.70775]{Symbol}{} +\newpsfontdot{diamond}% +[2.3 0.0 0.0 2.3 -0.8533 -0.5336]{Symbol}{} +\newpsfontdot{oplus}% +[1.44928 0.0 0.0 1.44928 -0.562319 -0.478261]{Symbol}{} +\newpsfontdot{otimes}% +[1.44928 0.0 0.0 1.44928 -0.562319 -0.475362]{Symbol}{} +\newpsfontdot{x}% +[1.8 0.0 0.0 1.8 -0.495 -0.4788]{Symbol}{} +\newpsfontdot{+}% +[2.3 0.0 0.0 2.3 -0.6486 -0.5819]{Times-Roman}{<2B>} +\newpsfontdot{asterisk}% +[2.43309 0.0 0.0 2.43309 -0.609489 -1.14477]{Times-Roman}{<2A>} +\newpsfontdot{B+}% +[2.3 0.0 0.0 2.3 -0.6555 -0.5819]{Times-Bold}{<2B>} +\newpsfontdot{Basterisk}% +[2.29358 0.0 0.0 2.29358 -0.576835 -1.08486]{Times-Bold}{<2A>} +\newpsfontdot{|}% +[1.98413 0.0 0.0 1.98413 -0.258929 -0.712302]{Helvetica}{(|)} +\newpsfontdot{B|}% +[1.98413 0.0 0.0 1.98413 -0.277778 -0.712302]{Helvetica-Bold}{(|)} +\iffalse +\newpsfontdot{*}% +[2.77778 0.0 0.0 2.77778 -0.638889 -0.813889]{Symbol}{} +\newpsfontdot{o}% +[3.33333 0.0 0.0 3.33333 -0.666667 -1.78167]{Symbol}{} +\newpsfontdot{Bo}% +[4.69484 0.0 0.0 4.69484 -0.78169 -2.97418]{Times-Bold}{} +\fi +\newdimen\pslinearc +\def\psset@linearc#1{\pssetlength\pslinearc{#1}} +\psset@linearc{0pt} +\def\psline{\pst@object{psline}} +\def\psline@i{% +\pst@getarrows{% +\begin@OpenObj +\pst@getcoors[\psline@ii}} +\def\psline@ii{% +\addto@pscode{\pst@cp \psline@iii \tx@Line}% +\end@OpenObj} +\def\psline@iii{% +\ifdim\pslinearc>\z@ +/r \pst@number\pslinearc def +/Lineto { \tx@Arcto } def +\else +/Lineto /lineto load def +\fi +\ifshowpoints true \else false \fi} +\def\qline(#1)(#2){% +\def\pst@par{}% +\begin@SpecialObj +\def\pst@linetype{0}% +\pst@getcoor{#1}\pst@tempa +\pst@@getcoor{#2}% +\addto@pscode{% +\pst@tempa moveto \pst@coor L +\@nameuse{psls@\pslinestyle}}% +\end@SpecialObj} +\def\pspolygon{\pst@object{pspolygon}} +\def\pspolygon@i{% +\begin@ClosedObj +\def\pst@cp{}% +\pst@getcoors[\pspolygon@ii} +\def\pspolygon@ii{% +\addto@pscode{\psline@iii \tx@Polygon}% +\def\pst@linetype{1}% +\end@ClosedObj} +\def\psset@framearc#1{\pst@checknum{#1}\psk@framearc} +\psset@framearc{0} +\def\psset@cornersize#1{% +\pst@expandafter\psset@@cornersize{#1}\@nil} +\def\psset@@cornersize#1#2\@nil{% +\if #1a\relax +\def\psk@cornersize{\pst@number\pslinearc false }% +\else +\def\psk@cornersize{\psk@framearc true }% +\fi} +\psset@cornersize{relative} +\def\tx@Rect{Rect } +\def\tx@OvalFrame{OvalFrame } +\def\tx@Frame{Frame } +\def\psset@dimen#1{% +\pst@expandafter\psset@@dimen{#1}\@nil} +\def\psset@@dimen#1#2\@nil{% +\if #1o\relax +\def\psk@dimen{.5 }% +\else +\if #1m\relax +\def\psk@dimen{0 }% +\else +\if #1i\relax +\def\psk@dimen{-.5 }% +\fi +\fi +\fi} +\psset@dimen{outer} +\def\psframe{\pst@object{psframe}} +\def\psframe@i(#1){% +\@ifnextchar({\psframe@ii(#1)}{\psframe@ii(0,0)(#1)}} +\def\psframe@ii(#1)(#2){% +\begin@ClosedObj +\pst@getcoor{#1}\pst@tempa +\pst@@getcoor{#2}% +\addto@pscode{\psk@cornersize \pst@tempa \pst@coor \psk@dimen \tx@Frame}% +\def\pst@linetype{2}% +\showpointsfalse +\end@ClosedObj} +\def\tx@BezierNArray{BezierNArray } +\def\tx@OpenBezier{OpenBezier } +\def\tx@ClosedBezier{ClosedBezier } +\def\tx@BezierShowPoints{BezierShowPoints } +\def\psbezier{\pst@object{psbezier}} +\def\psbezier@i{% +\pst@getarrows{% +\begin@OpenObj +\pst@getcoors[\psbezier@ii}} +\def\psbezier@ii{% +\addto@pscode{% +\pst@cp +\ifshowpoints true \else false \fi +\tx@OpenBezier +\ifshowpoints \tx@BezierShowPoints \fi}% +\end@OpenObj} +\def\pscbezier{\pst@object{pscbezier}} +\def\pscbezier@i{% +\begin@ClosedObj +\pst@getcoors[\pscbezier@ii} +\def\pscbezier@ii{% +\addto@pscode{% +\ifshowpoints true \else false \fi +\tx@ClosedBezier +\ifshowpoints \tx@BezierShowPoints \fi}% +\chardef\pst@linetype=1 +\end@ClosedObj} +\def\tx@Parab{Parab } +\def\parabola{\pst@object{parabola}} +\def\parabola@i{\pst@getarrows\parabola@ii} +\def\parabola@ii#1(#2)#3(#4){% +\begin@OpenObj +\pst@getcoor{#2}\pst@tempa +\pst@@getcoor{#4}% +\addto@pscode{\pst@tempa \pst@coor \tx@Parab}% +\end@OpenObj} +\def\psset@gridwidth#1{\pst@getlength{#1}\psk@gridwidth} +\psset@gridwidth{.8pt} +\def\psset@griddots#1{% +\pst@cntg=#1\relax +\edef\psk@griddots{\the\pst@cntg}} +\psset@griddots{0} +\def\psset@gridcolor#1{\pst@getcolor{#1}\psgridcolor} +\psset@gridcolor{black} +\def\psset@subgridwidth#1{\pst@getlength{#1}\psk@subgridwidth} +\psset@subgridwidth{.4pt} +\def\psset@subgridcolor#1{\pst@getcolor{#1}\pssubgridcolor} +\psset@subgridcolor{gray} +\def\psset@subgriddots#1{% +\pst@cntg=#1\relax\edef\psk@subgriddots{\the\pst@cntg}} +\psset@subgriddots{0} +\def\psset@subgriddiv#1{% +\pst@cntg=#1\relax\edef\psk@subgriddiv{\the\pst@cntg}} +\psset@subgriddiv{5} +\def\psset@gridlabels#1{\pst@getlength{#1}\psk@gridlabels} +\psset@gridlabels{10pt} +\def\psset@gridlabelcolor#1{\pst@getcolor{#1}\psgridlabelcolor} +\psset@gridlabelcolor{black} +\def\tx@Grid{Grid } +\def\psgrid{\pst@object{psgrid}} +\def\psgrid@i{\@ifnextchar(% +{\psgrid@ii}{\expandafter\psgrid@iv\pic@coor}} +\def\psgrid@ii(#1){\@ifnextchar(% +{\psgrid@iii(#1)}{\psgrid@iv(0,0)(0,0)(#1)}} +\def\psgrid@iii(#1)(#2){\@ifnextchar(% +{\psgrid@iv(#1)(#2)}{\psgrid@iv(#1)(#1)(#2)}} +\def\psgrid@iv(#1)(#2)(#3){% +\begin@SpecialObj +\pst@getcoor{#1}\pst@tempa +\pst@getcoor{#2}\pst@tempb +\pst@@getcoor{#3}% +\ifnum\psk@subgriddiv>1 +\addto@pscode{gsave +\psk@subgridwidth SLW \pst@usecolor\pssubgridcolor +\pst@tempb \pst@coor \pst@tempa +\pst@number\psxunit \pst@number\psyunit +\psk@subgriddiv\space \psk@subgriddots\space +{} 0 \tx@Grid grestore}% +\fi +\addto@pscode{gsave +\psk@gridwidth SLW \pst@usecolor\psgridcolor +\pst@tempb \pst@coor \pst@tempa +\pst@number\psxunit \pst@number\psyunit +1 \psk@griddots\space { \pst@usecolor\psgridlabelcolor } +\psk@gridlabels \tx@Grid grestore}% +\end@SpecialObj} +\newif\ifpsmathbox +\psmathboxtrue +\def\pst@mathflag{\z@} +\newtoks\everypsbox +\let\pst@thisbox\relax +\long\def\pst@makenotverbbox#1#2{% +\edef\pst@mathflag{% +\ifpsmathbox\ifmmode\ifinner 1\else 2\fi\else \z@\fi\else \z@\fi}% +\setbox\pst@hbox=\hbox{% +\ifcase\pst@mathflag\or$\m@th\textstyle\or$\m@th\displaystyle\fi +{\pst@thisbox\the\everypsbox#2}% +\ifnum\pst@mathflag>\z@$\fi}% +#1} +\def\pst@makeverbbox#1{% +\def\pst@afterbox{#1}% +\edef\pst@mathflag{% +\ifpsmathbox\ifmmode\ifinner 1\else 2\fi\else \z@\fi\else \z@\fi}% +\afterassignment\pst@beginbox +\setbox\pst@hbox\hbox} +\def\pst@beginbox{% +\ifcase\pst@mathflag\or$\m@th\or$\m@th\displaystyle\fi +\bgroup\aftergroup\pst@endbox +\pst@thisbox +\the\everypsbox} +\def\pst@endbox{% +\ifnum\pst@mathflag>\z@$\fi +\egroup +\pst@afterbox} +\def\pst@makebox{\pst@@makebox} +\def\psverbboxtrue{\def\pst@@makebox{\pst@makeverbbox}} +\def\psverbboxfalse{\def\pst@@makebox{\pst@makenotverbbox}} +\psverbboxfalse +\def\pst@longbox{% +\def\pst@makebox{% +\gdef\pst@makebox{\pst@@makebox}% +\pst@makelongbox}} +\def\pst@makelongbox#1{% +\def\pst@afterbox{#1}% +\edef\pst@mathflag{% +\ifpsmathbox\ifmmode\ifinner 1\else 2\fi\else \z@\fi\else \z@\fi}% +\setbox\pst@hbox\hbox\bgroup +\aftergroup\pst@afterbox +\ifcase\pst@mathflag\or$\m@th\or$\m@th\displaystyle\fi +\begingroup +\pst@thisbox +\the\everypsbox} +\def\pst@endlongbox{% +\endgroup +\ifnum\pst@mathflag>\z@$\fi +\egroup} +\def\pslongbox#1#2{% +\@namedef{#1}{\pst@longbox#2}% +\@namedef{end#1}{\pst@endlongbox}} +\newdimen\psframesep +\def\psset@framesep#1{\pssetlength\psframesep{#1}} +\psset@framesep{3pt} +\newif\ifpsboxsep +\def\psset@boxsep#1{\@nameuse{psboxsep#1}} +\psset@boxsep{true} +\def\pst@useboxpar{% +\use@par +\if@star +\let\pslinecolor\psfillcolor +\solid@star +\let\solid@star\relax +\fi +\ifpsdoubleline \pst@setdoublesep \fi} +\def\psframebox{\pst@object{psframebox}} +\def\psframebox@i{\pst@makebox\psframebox@ii} +\def\psframebox@ii{% +\begingroup +\pst@useboxpar +\pst@dima=\pslinewidth +\advance\pst@dima by \psframesep +\pst@dimc=\wd\pst@hbox\advance\pst@dimc by \pst@dima +\pst@dimb=\dp\pst@hbox\advance\pst@dimb by \pst@dima +\pst@dimd=\ht\pst@hbox\advance\pst@dimd by \pst@dima +\setbox\pst@hbox=\hbox{% +\ifpsboxsep\kern\pst@dima\fi +\begin@ClosedObj +\addto@pscode{% +\psk@cornersize +\pst@number\pst@dima neg +\pst@number\pst@dimb neg +\pst@number\pst@dimc +\pst@number\pst@dimd +.5 +\tx@Frame}% +\def\pst@linetype{2}% +\showpointsfalse +\end@ClosedObj +\box\pst@hbox +\ifpsboxsep\kern\pst@dima\fi}% +\ifpsboxsep\dp\pst@hbox=\pst@dimb\ht\pst@hbox=\pst@dimd\fi +\leavevmode\box\pst@hbox +\endgroup} +\def\psdblframebox{\pst@object{psdblframebox}} +\def\psdblframebox@i{\addto@par{doubleline=true}\psframebox@i} +\def\psclip#1{% +\leavevmode +\begingroup +\begin@psclip +\begingroup +\def\use@pscode{% +\pstVerb{% +\pst@dict +/mtrxc CM def +CP CP T +\tx@STV +\psk@origin +\psk@swapaxes +newpath +\pst@code +clip +newpath +mtrxc setmatrix +moveto +0 setgray +end}% +\gdef\pst@code{}}% +\def\@multips(##1)(##2)##3##4{\pst@misplaced\multips}% +\def\nc@object##1##2##3##4{\pst@misplaced{node connection}}% +\hbox to\z@{#1}% +\endgroup +\def\endpsclip{% +\end@psclip +\endgroup}% +\ignorespaces} +\def\endpsclip{\pst@misplaced\endpsclip} +\let\begin@psclip\relax +\def\end@psclip{\pstVerb{currentpoint initclip moveto}} +\def\AltClipMode{% +\def\end@psclip{\pstVerb{\pst@grestore}}% +\def\begin@psclip{\pstVerb{gsave}}} +\def\clipbox{\@ifnextchar[{\clipbox@}{\clipbox@[\z@]}} +\def\clipbox@[#1]{\pst@makebox\clipbox@@{#1}} +\def\clipbox@@#1{% +\pssetlength\pst@dimg{#1}% +\leavevmode\hbox{% +\begin@psclip +\pst@Verb{% +CM \tx@STV CP T newpath +/a \pst@number\pst@dimg def +/w \pst@number{\wd\pst@hbox}a add def +/d \pst@number{\dp\pst@hbox}a add neg def +/h \pst@number{\ht\pst@hbox}a add def +a neg d moveto +a neg h L +w h L +w d L +closepath +clip +newpath +0 0 moveto +setmatrix}% +\unhbox\pst@hbox +\end@psclip}} +\def\psshadowbox{\pst@object{psshadowbox}} +\def\psshadowbox@i{\pst@makebox\psshadowbox@ii} +\def\psshadowbox@ii{% +\begingroup +\pst@useboxpar +\psshadowtrue +\psboxseptrue +\def\psk@shadowangle{-45 }% +\setbox\pst@hbox=\hbox{\psframebox@ii}% +\pst@dimh=\psk@shadowsize\p@ +\pst@dimh=.7071\pst@dimh +\pst@dimg=\dp\pst@hbox +\advance\pst@dimg\pst@dimh +\dp\pst@hbox=\pst@dimg +\pst@dimg=\wd\pst@hbox +\advance\pst@dimg\pst@dimh +\wd\pst@hbox=\pst@dimg +\leavevmode +\box\pst@hbox +\endgroup} +\def\pscirclebox{\pst@object{pscirclebox}} +\def\pscirclebox@i{\pst@makebox\pscirclebox@ii} +\def\pscirclebox@ii{% +\begingroup +\pst@useboxpar +\setbox\pst@hbox=\hbox{% +\pst@nodehook +\pscirclebox@iii +\box\pst@hbox}% +\ifpsboxsep \pscirclebox@sep \fi +\leavevmode +\box\pst@hbox +\endgroup} +\def\pscirclebox@iii{% +\if@star +\pslinewidth\z@ +\pstverb{\pst@dict \tx@STP \pst@usecolor\psfillcolor +newpath \pscirclebox@iv \tx@SD end}% +\else +\begin@ClosedObj +\def\pst@linetype{4}\showpointsfalse +\addto@pscode{% +\pscirclebox@iv CLW 2 div add 0 360 arc closepath}% +\end@ClosedObj +\fi} +\def\pscirclebox@iv{% +\pst@number{\wd\pst@hbox}2 div +\pst@number{\ht\pst@hbox}\pst@number{\dp\pst@hbox}add 2 div +2 copy \pst@number{\dp\pst@hbox}sub 4 2 roll +\tx@Pyth \pst@number\psframesep add } +\def\pscirclebox@sep{% +\pst@dimb=\ht\pst@hbox +\advance\pst@dimb\dp\pst@hbox +\divide\pst@dimb 2 +\pst@dima=.5\wd\pst@hbox +\pst@pyth\pst@dima\pst@dimb\pst@dimc +\advance\pst@dimc\pslinewidth +\advance\pst@dimc\psframesep +\advance\pst@dimb-\pst@dimc +\setbox\pst@hbox=\hbox to2\pst@dimc{% +\hss +\vbox{\kern-\pst@dimb\box\pst@hbox}% +\hss}% +\advance\pst@dimb-\dp\pst@hbox +\dp\pst@hbox=-\pst@dimb} +\let\pst@nodehook\relax +\def\psCirclebox{\pst@object{psCirclebox}} +\def\psCirclebox@i{\pst@makebox\psCirclebox@ii} +\def\psCirclebox@ii{% +\begingroup +\pst@useboxpar +\pst@dima=\ht\pst@hbox +\advance\pst@dima\dp\pst@hbox +\divide\pst@dima\tw@ +\pssetlength\pst@dimb\psk@radius +\setbox\pst@hbox=\hbox{% +\pst@nodehook +\pscircle(.5\wd\pst@hbox,\pst@dima){\pst@dimb}% +\box\pst@hbox}% +\ifpsboxsep \psCirclebox@sep \fi +\leavevmode +\box\pst@hbox +\endgroup} +\def\psCirclebox@sep{% +\pst@dimc=\pst@dimb +\advance\pst@dimb-\pst@dima +\advance\pst@dima\pst@dimc +\setbox\pst@hbox=\hbox to\tw@\pst@dimc{% +\hss +\vrule width \z@ depth \pst@dimb height \pst@dima +\box\pst@hbox +\hss}}% +\def\psovalbox{\pst@object{psovalbox}} +\def\psovalbox@i{\pst@makebox{\psovalbox@ii}} +\def\psovalbox@ii{% +\begingroup +\pst@useboxpar +\psovalbox@iii +\ifpsboxsep\psovalbox@sep\fi +\leavevmode +\box\pst@hbox +\endgroup} +\def\psovalbox@iii{% +\psovalbox@iv +\setbox\pst@hbox=\hbox{% +\begin@ClosedObj +\addto@pscode{% +0 360 +\pst@number\pst@dimc CLW 2 div sub +\pst@number\pst@dimd CLW 2 div sub +\pst@number\pst@dima +\pst@number\pst@dimb +\tx@Ellipse +closepath}% +\def\pst@linetype{2}% +\end@ClosedObj +\unhbox\pst@hbox}} +\def\psovalbox@iv{% +\pst@dimc=\pslinewidth\advance\pst@dimc\psframesep +\pst@dimd=\ht\pst@hbox\advance\pst@dimd\dp\pst@hbox +\pst@dima=.5\wd\pst@hbox +\pst@dimb=.5\pst@dimd\advance\pst@dimb-\dp\pst@hbox +\pst@dimd=.707\pst@dimd +\advance\pst@dimd\pst@dimc +\advance\pst@dimc.707\wd\pst@hbox} +\def\psovalbox@sep{% +\setbox\pst@hbox\hbox to 2\pst@dimc{\hss\unhbox\pst@hbox\hss}% +\pst@dimg=\pst@dimd +\advance\pst@dimg-\pst@dimb +\dp\pst@hbox=\pst@dimg +\advance\pst@dimd\pst@dimb +\ht\pst@hbox=\pst@dimd} +\def\psdiabox{\pst@object{psdiabox}} +\def\psdiabox@i{\pst@makebox{\psdiabox@ii}} +\def\psdiabox@ii{% +\begingroup +\pst@useboxpar +\psdiabox@iii +\ifpsboxsep\psdiabox@sep\fi +\leavevmode +\box\pst@hbox +\endgroup} +\def\psdiabox@iv{% +\pst@dimg=.707\pslinewidth +\advance\pst@dimg.707\psframesep +\pst@dima=\wd\pst@hbox +\divide\pst@dima 2 +\pst@dimc=\pst@dima +\advance\pst@dimc\pst@dimg +\pst@dimd=\ht\pst@hbox +\advance\pst@dimd\dp\pst@hbox +\divide\pst@dimd 2 +\pst@dimb=\pst@dimd +\advance\pst@dimb-\dp\pst@hbox +\advance\pst@dimd\pst@dimg} +\def\psdiabox@iii{% +\psdiabox@iv +\setbox\pst@hbox=\hbox{% +\begin@ClosedObj +\addto@pscode{% +\psline@iii +pop +.5 +\pst@number\pst@dimc 2 mul \pst@number\pst@dimd 2 mul +0 +\pst@number\pst@dima \pst@number\pst@dimb +\tx@Diamond}% +\def\pst@linetype{4}% +\end@ClosedObj +\box\pst@hbox}} +\def\psdiabox@sep{% +\setbox\pst@hbox\hbox to 4\pst@dimc{\hss\unhbox\pst@hbox\hss}% +\multiply\pst@dimd 2 +\advance\pst@dimd\pst@dimb +\ht\pst@hbox\pst@dimd +\advance\pst@dimd-2\pst@dimb +\dp\pst@hbox\pst@dimd} +\def\psset@trimode#1{\pst@expandafter\psset@@trimode{#1}\@empty\@empty\@nil} +\def\psset@@trimode#1#2#3\@nil{% +\let\pst@tempg#1\relax +\ifx\pst@tempg*% +\let\psk@@trimode\@empty +\let\pst@tempg#2\relax +\else +\let\psk@@trimode\relax +\fi +\edef\psk@trimode{% +\ifx R\pst@tempg 1 \else\ifx D\pst@tempg 2 +\else\ifx L\pst@tempg 3 \else 0 \fi\fi\fi}} +\psset@trimode{U} +\def\pstribox{\pst@object{pstribox}} +\def\pstribox@i{\pst@makebox{\pstribox@ii}} +\def\pstribox@ii{% +\begingroup +\pst@useboxpar +\pstribox@iii +\ifpsboxsep\pstribox@sep\fi +\leavevmode +\box\pst@hbox +\endgroup} +\def\pstribox@iii{% +\pstribox@iv +\setbox\pst@hbox=\hbox{% +\begin@ClosedObj +\addto@pscode{% +\psline@iii +pop +.5 +\pst@number\pst@dimc \pst@number\pst@dimd +\ifodd\psk@trimode exch \fi +\psk@trimode -90 mul +\pst@number\pst@dima \pst@number\pst@dimb +\tx@Triangle}% +\def\pst@linetype{2}% +\end@ClosedObj +\box\pst@hbox}} +\def\pstribox@iv{% +\pst@dimh=\pslinewidth +\advance\pst@dimh\psframesep +\pst@dimg=\ht\pst@hbox +\advance\pst@dimg-\dp\pst@hbox +\divide\pst@dimg 2 +\edef\pst@tempa{\number\pst@dimg sp}% For use by nodes. +\ifodd\psk@trimode +\pst@dimb\pst@dimg +\else +\pst@dima=\wd\pst@hbox +\divide\pst@dima 2 +\fi +\ifcase\psk@trimode +\pst@dimb=-\dp\pst@hbox +\advance\pst@dimb-\pst@dimh +\or +\pst@dima=-\pst@dimh +\or +\pst@dimb=\ht\pst@hbox +\advance\pst@dimb\pst@dimh +\or +\pst@dima=\wd\pst@hbox +\advance\pst@dima\pst@dimh +\fi +\pst@dimd=\dp\pst@hbox +\advance\pst@dimd\ht\pst@hbox +\ifx\psk@@trimode\relax +\pst@dimc=\wd\pst@hbox +\advance\pst@dimc\ifodd\psk@trimode 1.447\else 1.789\fi\pst@dimh +\multiply\pst@dimc 2 +\advance\pst@dimd\ifodd\psk@trimode 1.789\else 1.447\fi\pst@dimh +\multiply\pst@dimd 2 +\else +\ifodd\psk@trimode +\advance\pst@dimd 1.1547\wd\pst@hbox +\advance\pst@dimd 3.4641\pst@dimh +\pst@dimc=.866\pst@dimd +\else +\advance\pst@dimd .866\wd\pst@hbox %.866=(sqrt(3)/2) +\advance\pst@dimd 3\pst@dimh +\pst@dimc=1.1547\pst@dimd % 1.1547=(2/sqrt(3)) +\fi +\fi} +\def\pstribox@sep{% +\ifodd\psk@trimode +\advance\pst@dimb.5\pst@dimd +\ht\pst@hbox=\pst@dimb +\advance\pst@dimd-\pst@dimb +\dp\pst@hbox=\pst@dimd +\else +\setbox\pst@hbox\hbox to \pst@dimc{\hss\unhbox\pst@hbox\hss}% +\global\pst@dimg=.5\pst@dimc +\fi +\ifcase\psk@trimode +\dp\pst@hbox-\pst@dimb +\advance\pst@dimd\pst@dimb +\ht\pst@hbox\pst@dimd +\or +\pst@dimg=.5\wd\pst@hbox +\global\advance\pst@dimg-\pst@dima +\setbox\pst@hbox\hbox to \pst@dimc{\kern-\pst@dima\box\pst@hbox\hss}% +\or +\ht\pst@hbox\pst@dimb +\advance\pst@dimd-\pst@dimb +\dp\pst@hbox\pst@dimd +\or +\pst@dimg=\pst@dimc +\advance\pst@dimg-\pst@dima +\global\advance\pst@dimg.5\wd\pst@hbox +\setbox\pst@hbox\hbox to \pst@dimc{% +\hss\box\pst@hbox\kern\psframesep\kern\pslinewidth}% +\fi} +\def\psset@arcsepA#1{\pst@getlength{#1}\psk@arcsepA} +\def\psset@arcsepB#1{\pst@getlength{#1}\psk@arcsepB} +\def\psset@arcsep#1{% +\psset@arcsepA{#1}\let\psk@arcsepB\psk@arcsepA} +\psset@arcsep{0} +\def\tx@ArcArrow{ArcArrow } +\def\psarc{\pst@object{psarc}} +\def\psarc@i{% +\@ifnextchar({\psarc@iii}{\psarc@ii}} +\def\psarc@ii#1{\addto@par{arrows=#1}% +\@ifnextchar({\psarc@iii}{\psarc@iii(0,0)}} +\def\psarc@iii(#1)#2#3#4{% +\begin@OpenObj +\pst@getangle{#3}\pst@tempa +\pst@getangle{#4}\pst@tempb +\pst@@getcoor{#1}% +\pssetlength\pst@dima{#2}% +\addto@pscode{\psarc@iv \psarc@v}% +\gdef\psarc@type{0}% +\showpointsfalse +\end@OpenObj} +\def\psarc@iv{% +\pst@coor /y ED /x ED +/r \pst@number\pst@dima def +/c 57.2957 r \tx@Div def +/angleA +\pst@tempa +\psk@arcsepA c mul 2 div +\ifcase \psarc@type add \or sub \fi +def +/angleB +\pst@tempb +\psk@arcsepB c mul 2 div +\ifcase \psarc@type sub \or add \fi +def +\ifshowpoints\psarc@showpoints\fi +\ifx\psk@arrowA\@empty +\ifnum\psk@liftpen=2 +r angleA \tx@PtoC +y add exch x add exch +moveto +\fi +\fi} +\def\psarc@v{% +x y r +angleA +\ifx\psk@arrowA\@empty\else +{ ArrowA CP } +{ \ifcase\psarc@type add \or sub \fi } +\tx@ArcArrow +\fi +angleB +\ifx\psk@arrowB\@empty\else +{ ArrowB } +{ \ifcase\psarc@type sub \or add \fi } +\tx@ArcArrow +\fi +\ifcase\psarc@type arc \or arcn \fi} +\def\psarc@type{0} +\def\psarc@showpoints{% +gsave +newpath +x y moveto +x y r \pst@tempa \pst@tempb +\ifcase\psarc@type arc \or arcn \fi +closepath +CLW 2 div SLW +[ \psk@dash\space ] 0 setdash stroke +grestore } +\def\psarcn{\pst@object{psarcn}} +\def\psarcn@i{\def\psarc@type{1}\psarc@i} +\def\pscircle{\pst@object{pscircle}} +\def\pscircle@i{\@ifnextchar({\pscircle@do}{\pscircle@do(0,0)}} +\def\pscircle@do(#1)#2{% +\if@star +{\use@par\qdisk(#1){#2}}% +\else +\begin@ClosedObj +\pst@@getcoor{#1}% +\pssetlength\pst@dimc{#2}% +\def\pst@linetype{4}% +\addto@pscode{% +\pst@coor +\pst@number\pst@dimc +\psk@dimen CLW mul sub +0 360 arc +closepath}% +\showpointsfalse +\end@ClosedObj +\fi +\ignorespaces} +\def\qdisk(#1)#2{% +\def\pst@par{}% +\begin@SpecialObj +\pst@@getcoor{#1}% +\pssetlength\pst@dimg{#2}% +\addto@pscode{\pst@coor \pst@number\pst@dimg \tx@SD}% +\end@SpecialObj} +\def\psset@radius#1{\pst@@getlength{#1}\psk@radius} +\psset@radius{.25cm} +\def\psCircle{\pst@object{psCircle}} +\def\psCircle@i{\@ifnextchar({\psCircle@ii}{\psCircle@ii(0,0)}} +\def\psCircle@ii(#1){\pscircle@do(#1){\psk@radius}} +\def\pswedge{\pst@object{pswedge}} +\def\pswedge@i{\@ifnextchar({\pswedge@ii}{\pswedge@ii(0,0)}} +\def\pswedge@ii(#1)#2#3#4{% +\begin@ClosedObj +\pssetlength\pst@dimc{#2} +\pst@getangle{#3}\pst@tempa +\pst@getangle{#4}\pst@tempb +\pst@@getcoor{#1}% +\def\pst@linetype{1}% +\addto@pscode{% +\pst@coor +2 copy +moveto +\pst@number\pst@dimc \psk@dimen CLW mul sub % Adjusted radius +\pst@tempa \pst@tempb +arc +closepath}% +\showpointsfalse +\end@ClosedObj} +\def\tx@Ellipse{Ellipse } +\def\psellipse{\pst@object{psellipse}} +\def\psellipse@i(#1){\@ifnextchar(% +{\psellipse@ii(#1)}{\psellipse@ii(0,0)(#1)}} +\def\psellipse@ii(#1)(#2){% +\begin@ClosedObj +\pst@getcoor{#1}\pst@tempa +\pst@@getcoor{#2}% +\addto@pscode{% +0 360 +\pst@coor +\ifdim\psk@dimen\p@=\z@\else +\psk@dimen CLW mul +dup 4 -1 roll sub neg 3 1 roll sub +\fi +\pst@tempa +\tx@Ellipse +closepath}% +\def\pst@linetype{2}% +\end@ClosedObj} +\def\multips{\@ifnextchar({\def\pst@par{}\multips@ii}{\multips@i}} +\def\multips@i#1{\def\pst@par{rot=#1}\multips@ii} +\def\multips@ii(#1){\@ifnextchar({\multips@iii(#1)}{\multips@iii(\z@,\z@)(#1)}} +\long\def\multips@iii(#1)(#2)#3#4{% +\begingroup +\use@par +\pst@getcoor{#1}\pst@tempa +\pst@@getcoor{#2}% +\pst@cnta=#3\relax +\init@pscode +\addto@pscode{% +\pst@tempa T \the\pst@cnta\space \pslbrace +gsave \ifx\psk@rot\@empty\else\psk@rot rotate \fi}% +\hbox to\z@{% +\def\init@pscode{% +\addto@pscode{% +gsave +\pst@number\pslinewidth SLW +\pst@usecolor\pslinecolor}}% +\def\use@pscode{\addto@pscode{grestore}}% +\def\psclip##1{\pst@misplaced\psclip}% +\def\nc@object##1##2##3##4{\pst@misplaced{node connection}}% +#4}% +\addto@pscode{grestore \pst@coor T \psrbrace repeat}% +\leavevmode +\use@pscode +\endgroup +\ignorespaces} +\def\scalebox#1{\pst@makebox{\@scalebox{#1}}} +\def\@scalebox#1{% +\begingroup +\pst@getscale{#1}\pst@tempa +\let\pst@tempc\pst@tempg +\let\pst@tempd\pst@temph +\@@scalebox +\endgroup} +\def\@@scalebox{% +\leavevmode +\hbox{% +\ifdim\pst@tempd\p@<\z@ +\pst@dimg=\pst@tempd\ht\pst@hbox +\pst@dimh=\pst@tempd\dp\pst@hbox +\dp\pst@hbox=-\pst@dimg +\ht\pst@hbox=-\pst@dimh +\else +\ht\pst@hbox=\pst@tempd\ht\pst@hbox +\dp\pst@hbox=\pst@tempd\dp\pst@hbox +\fi +\pst@dima=\pst@tempc\wd\pst@hbox +\ifdim\pst@dima<\z@\kern-\pst@dima\fi +\pst@Verb{CP CP translate \pst@tempa \tx@NET}% +\hbox to \z@{\box\pst@hbox\hss}% +\pst@Verb{% +CP CP translate +1 \pst@tempc div 1 \pst@tempd div scale +\tx@NET}% +\ifdim\pst@dima>\z@\kern\pst@dima\fi}} +\pslongbox{Scalebox}{\scalebox} +\def\scaleboxto(#1,#2){\pst@makebox{\@scaleboxto(#1,#2)}} +\def\@scaleboxto(#1,#2){% +\begingroup +\pssetlength\pst@dima{#1}% +\pssetlength\pst@dimb{#2}% +\ifdim\pst@dima=\z@\else +\pst@divide{\pst@dima}{\wd\pst@hbox}\pst@tempc +\edef\pst@tempc{\pst@tempc\space}% +\fi +\ifdim\pst@dimb=\z@ +\ifdim\pst@dima=\z@ +\@pstrickserr{% +\string\scaleboxto\space dimensions cannot both be zero}\@ehpa +\def\pst@tempa{}% +\def\pst@tempc{1 }% +\def\pst@tempd{1 }% +\else +\let\pst@tempd\pst@tempc +\fi +\else +\pst@dimc=\ht\pst@hbox +\advance\pst@dimc\dp\pst@hbox +\pst@divide{\pst@dimb}{\pst@dimc}\pst@tempd +\edef\pst@tempd{\pst@tempd\space}% +\ifdim\pst@dima=\z@ \let\pst@tempc\pst@tempd \fi +\fi +\edef\pst@tempa{\pst@tempc \pst@tempd scale }% +\@@scalebox +\endgroup} +\pslongbox{Scaleboxto}{\scaleboxto} +\def\tx@Rot{Rot } +\def\rotateleft{\pst@makebox{\@rotateleft\pst@hbox}} +\def\@rotateleft#1{% +\leavevmode\hbox{\hskip\ht#1\hskip\dp#1\vbox{\vskip\wd#1% +\pst@Verb{90 \tx@Rot} +\vbox to \z@{\vss\hbox to \z@{\box#1\hss}\vskip\z@}% +\pst@Verb{-90 \tx@Rot}}}} +\def\rotateright{\pst@makebox{\@rotateright\pst@hbox}} +\def\@rotateright#1{% +\hbox{\hskip\ht#1\hskip\dp#1\vbox{\vskip\wd#1% +\pst@Verb{-90 \tx@Rot} +\vbox to \z@{\hbox to \z@{\hss\box#1}\vss}% +\pst@Verb{90 \tx@Rot}}}} +\def\rotatedown{\pst@makebox{\@rotatedown\pst@hbox}} +\def\@rotatedown#1{% +\hbox{\hskip\wd#1\vbox{\vskip\ht#1\vskip\dp#1% +\pst@Verb{180 \tx@Rot}% +\vbox to \z@{\hbox to \z@{\box#1\hss}\vss}% +\pst@Verb{-180 \tx@Rot}}}} +\pslongbox{Rotateleft}{\rotateleft} +\pslongbox{Rotateright}{\rotateright} +\pslongbox{Rotatedown}{\rotatedown} +\def\pst@starbox{% +\setbox\pst@hbox\hbox{\psframebox*[boxsep=false]{\unhbox\pst@hbox}}} +\def\pst@@makesmall#1{% +\setbox#1=\hbox to\z@{\hss\vbox to \z@{\vss\box#1\vss}\hss}} +\def\pst@@@makesmall#1{% +\pst@dimh=\psk@xref\wd#1% +\ifx\psk@yref\relax +\pst@dimg=\dp#1% +\else +\pst@dimg=\psk@yref\ht#1% +\advance\pst@dimg\psk@yref\dp#1% +\fi +\setbox#1=\hbox to\z@{% +\kern-\pst@dimh\vbox to\z@{\vss\box#1\kern-\pst@dimg}\hss}} +\def\psset@ref#1{\pst@expandafter\psset@@ref{#1}\@empty,,\@nil} +\def\psset@@ref#1#2,#3,#4\@nil{% +\def\psk@xref{.5}% +\def\psk@yref{.5}% +\let\pst@makesmall\pst@@@makesmall +\ifx\@empty#3\@empty +\@nameuse{getref@#1}% +\@nameuse{getref@#2}% +\else +\pst@checknum{#1#2}\psk@xref +\pst@checknum{#3}\psk@yref +\fi} +\def\getref@c{\let\pst@makesmall\pst@@makesmall} +\def\getref@t{\def\psk@yref{1}} +\def\getref@b{\def\psk@yref{0}} +\def\getref@B{\let\psk@yref\relax} +\def\getref@l{\def\psk@xref{0}} +\def\getref@r{\def\psk@xref{1}} +\psset@ref{c} +\def\psset@rot#1{% +\pst@expandafter{\@ifnextchar*{\psset@@@rot}{\psset@@rot}}{#1}\@nil} +\def\psset@@rot#1\@nil{% +\def\next##1@#1=##2@##3\@nil{% +\ifx\relax##2% +\pst@getangle{#1}\psk@rot +\else +\def\psk@rot{##2}% +\fi}% +\expandafter\next\pst@rottable @#1=\relax @\@nil} +\def\psset@@@rot#1#2\@nil{% +\psset@@rot#2\@nil +\edef\psk@rot{\pst@rotlist \ifx\psk@rot\@empty\else\psk@rot add \fi}} +\def\pst@rotlist{mark RAngle /a ED cleartomark a neg } +\def\pst@rottable{% +@0=% +@U=% +@L=90 % +@D=180 % +@R=-90 % +@N=\pst@rotlist +@W=\pst@rotlist 90 add % +@S=\pst@rotlist 180 add % +@E=\pst@rotlist 90 sub } +\psset@rot{0} +\def\tx@RotBegin{RotBegin } +\def\tx@RotEnd{RotEnd } +\def\pst@rotate#1#2{% +\ifx#1\@empty\else +\setbox#2=\hbox{\pst@Verb{#1 \tx@RotBegin}\box#2\pst@Verb{\tx@RotEnd}}% +\fi} +\def\psput@cartesian#1{% +\hbox to \z@{\kern\pst@dimg{\vbox to \z@{\vss\box#1\vskip\pst@dimh}\hss}}} +\def\psput@special#1{% +\hbox{% +\pst@Verb{{ \pst@coor } \tx@PutCoor \tx@PutBegin}% +\box#1% +\pst@Verb{\tx@PutEnd}}} +\def\tx@PutCoor{PutCoor } +\def\tx@PutBegin{PutBegin } +\def\tx@PutEnd{PutEnd } +\def\rput{\def\pst@par{}\pst@ifstar{\@ifnextchar[{\rput@i}{\rput@ii}}} +\def\rput@i[#1]{\addto@par{ref={#1}}\rput@ii} +\def\rput@ii{\@ifnextchar({\rput@iv}{\rput@iii}} +\def\rput@iii#1{\addto@par{rot={#1}}\@ifnextchar({\rput@iv}{\rput@iv(\z@,\z@)}} +\def\rput@iv(#1){\pst@killglue\pst@makebox{\rput@v{#1}}} +\def\rput@v#1{% +\begingroup +\use@par +\if@star\pst@starbox\fi +\pst@makesmall\pst@hbox +\pst@rotate\psk@rot\pst@hbox +\psput@{#1}\pst@hbox +\endgroup +\ignorespaces} +\def\multirput{% +\def\pst@par{}% +\pst@ifstar{\@ifnextchar[{\multirput@i}{\multirput@ii}}} +\def\multirput@i[#1]{\addto@par{ref={#1}}\multirput@ii} +\def\multirput@ii{\@ifnextchar({\multirput@iv}{\multirput@iii}} +\def\multirput@iii#1{\addto@par{rot={#1}}\multirput@iv} +\def\multirput@iv(#1){% +\@ifnextchar({\multirput@v(#1)}{\multirput@v(\z@,\z@)(#1)}} +\def\multirput@v(#1,#2)(#3,#4)#5{% +\pst@makebox{\multirput@vi(#1,#2)(#3,#4){#5}}} +\def\multirput@vi(#1,#2)(#3,#4)#5{% +\begingroup +\use@par +\if@star\pst@starbox\fi +\pst@makesmall\pst@hbox +\pst@rotate\psk@rot\pst@hbox +\pssetxlength\pst@dima{#1}% +\pssetylength\pst@dimb{#2}% +\pssetxlength\pst@dimc{#3}% +\pssetylength\pst@dimd{#4}% +\pst@cntg=#5\relax +\pst@cnth=\@ne +\leavevmode +\loop +\vbox to \z@{% +\vss +\hbox to \z@{\kern\pst@dima\copy\pst@hbox\hss}% +\vskip\pst@dimb}% +\ifnum\pst@cntg>\pst@cnth +\advance\pst@dima\pst@dimc +\advance\pst@dimb\pst@dimd +\advance\pst@cnth\@ne +\repeat +\endgroup +\ignorespaces} +\newif\if@fixedradius +\def\cput{\pst@object{cput}} +\def\cput@i{\@fixedradiusfalse\cput@ii} +\def\cput@ii{\pst@killglue\@ifnextchar({\cput@iv}{\cput@iii}} +\def\cput@iii#1{% +\addto@par{rot={#1}}% +\@ifnextchar({\cput@iv}{\cput@iv(\z@,\z@)}} +\def\cput@iv(#1){\pst@makebox{\cput@v{#1}}} +\def\cput@v#1{% +\begingroup +\use@par +\setbox\pst@hbox=\hbox{% +\psboxsepfalse +\if@fixedradius\psCirclebox@ii\else\pscirclebox@ii\fi}% +\pst@@makesmall\pst@hbox +\pst@rotate\psk@rot\pst@hbox +\psput@{#1}\pst@hbox +\endgroup +\ignorespaces} +\def\Cput{\pst@object{Cput}} +\def\Cput@i{\@fixedradiustrue\cput@ii} +\newdimen\pslabelsep +\def\psset@labelsep#1{\pssetlength\pslabelsep{#1}} +\psset@labelsep{5pt} +\def\psset@refangle#1{\pst@expandafter\psset@@refangle{#1}\@nil} +\def\psset@@refangle#1\@nil{% +\def\next##1@#1=##2"##3@##4\@nil{% +\ifx\relax##2% +\pst@getangle{#1}\psk@refangle +\def\psk@uputref{}% +\else +\def\psk@refangle{##2 }% +\def\psk@uputref{##3}% +\fi}% +\expandafter\next\pst@refangletable @#1=\relax"@\@nil} +\def\pst@refangletable{% +@r=0"20% +@u=90"02% +@l=180"10% +@d=-90"01% +@ur=45"22% +@ul=135"12% +@dr=-135"21% +@dl=-45"11} +\psset@refangle{0} +\def\uput{\def\pst@par{}\@ifnextchar[{\uput@ii}{\uput@i}} +\def\uput@i#1{\addto@par{labelsep=#1}\uput@ii} +\def\uput@ii[#1]{% +\addto@par{refangle={#1}}% +\@ifnextchar({\uput@iv}{\uput@iii}} +\def\uput@iii#1{% +\addto@par{rot={#1}}% +\@ifnextchar({\uput@iv}{\uput@iv(\z@,\z@)}} +\def\uput@iv(#1){\pst@killglue\pst@makebox{\uput@v{#1}}} +\def\uput@v#1{% +\begingroup +\use@par +\if@star\pst@starbox\fi +\uput@vi +\psput@{#1}\pst@hbox +\endgroup +\ignorespaces} +\def\uput@vi{% +\ifx\psk@uputref\@empty +\uput@vii\tx@UUput{}% +\else +\ifx\psk@rot\@empty +\expandafter\uput@viii\psk@uputref +\else +\uput@vii\tx@UUput{}% +\fi +\fi} +\def\uput@vii#1#2{% +\edef\pst@coor{% +\pst@number\pslabelsep +#2% +\pst@number{\wd\pst@hbox}% +\pst@number{\ht\pst@hbox}% +\pst@number{\dp\pst@hbox}% +\psk@refangle\space \ifx\psk@rot\@empty\else\psk@rot\space sub \fi +\tx@Uput #1}% +\setbox\pst@hbox=\hbox to\z@{\hss\vbox to\z@{\vss\box\pst@hbox\vss}\hss}% +\setbox\pst@hbox=\psput@special\pst@hbox +\ifx\psk@rot\@empty\else\pst@rotate\psk@rot\pst@hbox\fi} +\def\uput@viii#1#2{% +\ifnum#1>\z@\ifnum#2>\z@\pslabelsep=.707\pslabelsep\fi\fi +\setbox\pst@hbox=\vbox to\z@{% +\ifnum#2=1 \vskip\pslabelsep\else\vss\fi +\hbox to\z@{% +\ifnum#1=2 \hskip\pslabelsep\else\hss\fi +\box\pst@hbox +\ifnum#1=1 \hskip\pslabelsep\else\hss\fi}% +\ifnum#2=2 \vskip\pslabelsep\else\vss\fi}} +\def\tx@Uput{Uput } +\def\tx@UUput{UUput } +\def\Rput{\def\pst@par{}\pst@ifstar{\@ifnextchar[{\Rput@ii}{\Rput@i}}} +\def\Rput@i#1{\addto@par{labelsep=#1}\Rput@ii} +\def\Rput@ii[#1]{\addto@par{ref={#1}}\@ifnextchar({\Rput@iv}{\Rput@iii}} +\def\Rput@iii#1{\addto@par{rot={#1}}\@ifnextchar({\Rput@iv}{\Rput@iv(\z@,\z@)}} +\def\Rput@iv(#1){\pst@killglue\pst@makebox{\Rput@v{#1}}} +\def\Rput@v#1{% +\begingroup +\use@par +\if@star\pst@starbox\fi +\Rput@vi +\pst@makesmall\pst@hbox +\pst@rotate\psk@rot\pst@hbox +\psput@{#1}\pst@hbox +\endgroup +\ignorespaces} +\def\Rput@vi{% +\pst@dimg=\dp\pst@hbox +\advance\pst@dimg\pslabelsep +\dp\pst@hbox=\pst@dimg +\pst@dimg=\ht\pst@hbox +\advance\pst@dimg\pslabelsep +\ht\pst@hbox=\pst@dimg +\setbox\pst@hbox\hbox{\kern\pslabelsep\box\pst@hbox\kern\pslabelsep}}% +\def\oldpsput{% +\def\pst@par{}\pst@ifstar{\@ifnextchar[{\oldpsput@i}{\oldpsput@ii}}} +\def\oldpsput@i[#1]{\addto@par{ref={#1}}\oldpsput@ii} +\def\oldpsput@ii{\@ifnextchar<{\oldpsput@iii}{\oldpsput@iv}} +\def\oldpsput@iii<#1>{\rput@iii{#1}} +\def\OldPsput{\let\psput\oldpsput} +\def\NewPsput{\let\psput\rput} +\def\pspicture{\begingroup\pst@ifstar\pst@picture} +\def\pst@picture{% +\@ifnextchar[{\pst@@picture}{\pst@@picture[0]}} +\def\pst@@picture[#1]#2(#3,#4){% +\@ifnextchar({\pst@@@picture[#1](#3,#4)}% +{\pst@@@picture[#1](0,0)(#3,#4)}} +\def\pst@@@picture[#1](#2,#3)(#4,#5){% +\pssetxlength\pst@dima{#2}% +\pssetylength\pst@dimb{#3}% +\pssetxlength\pst@dimc{#4}% +\pssetylength\pst@dimd{#5}% +\ifdim\pst@dima>\pst@dimc +\pst@dimg=\pst@dima +\pst@dima=\pst@dimc +\pst@dimc=\pst@dimg +\fi +\ifdim\pst@dimb>\pst@dimd +\pst@dimg=\pst@dimb +\pst@dimb=\pst@dimd +\pst@dimd=\pst@dimg +\fi +\def\pst@tempa{#1}% +\setbox\pst@hbox=\hbox\bgroup +\begingroup\KillGlue +\@ifundefined{@latexerr}{}{\let\unitlength\psunit}% +\edef\pic@coor{(#2,#3)(#2,#3)(#4,#5)}\ignorespaces} +\def\pic@coor{(0,0)(0,0)(10,10)} +\def\endpspicture{% +\pst@killglue +\endgroup +\egroup +\ifdim\wd\pst@hbox=\z@\else +%\@pstrickserr{Extraneous space in the pspicture environment}% +%{Type \space \space to procede.}% +\fi +\ht\pst@hbox=\pst@dimd +\dp\pst@hbox=-\pst@dimb +\setbox\pst@hbox=\hbox{% +\kern-\pst@dima +\ifx\pst@tempa\@empty\else +\advance\pst@dimd-\pst@dimb +\pst@dimd=\pst@tempa\pst@dimd +\advance\pst@dimd\pst@dimb +\lower\pst@dimd +\fi +\box\pst@hbox +\kern\pst@dimc}% +\if@star\setbox\pst@hbox=\hbox{\clipbox@@\z@}\fi +\leavevmode\box\pst@hbox +\endgroup} +\@namedef{pspicture*}{\pspicture*} +\@namedef{endpspicture*}{\endpspicture} +\def\tx@BeginOL{BeginOL } +\def\tx@InitOL{InitOL } +\def\pst@initoverlay#1{\pst@Verb{\tx@InitOL /TheOL (#1) def}} +\def\AltOverlayMode{% +\def\pst@initoverlay##1{% +\pst@Verb{% +\tx@InitOL +/Visible { initclip } def +/Invisible { +CP newpath OLUnit itransform moveto clip newpath moveto +} def +/TheOL (##1) def}}} +\def\pst@overlay#1{% +\edef\curr@overlay{#1}% +\pst@Verb{(#1) BOL}% +\aftergroup\pst@endoverlay} +\def\pst@endoverlay{% +\pst@Verb{(\curr@overlay) BOL}} +\def\curr@overlay{all} +\newbox\theoverlaybox +\def\overlaybox{% +\global\setbox\theoverlaybox=\hbox\bgroup +\begingroup +\let\psoverlay\pst@overlay +\def\overlaybox{% +\@pstrickserr{Overlays cannot be nested}\@eha}% +\def\putoverlaybox{% +\@pstrickserr{You must end the overlay box +before using \string\putoverlaybox}}% +\psoverlay{main}% +\ignorespaces} +\def\endoverlaybox{\endgroup\egroup} +\def\putoverlaybox#1{% +\hbox{\pst@initoverlay{#1}\copy\theoverlaybox}} +\def\psoverlay{\@pstrickserr{\string\psoverlay\space +can only be used after \string\overlaybox}} +\ifx\pstcustomize\relax \input pstricks.con \fi +\catcode`\@=\PstAtCode\relax +\endinput +%% +%% END: pstricks.tex diff --git a/usergrps/uktug/baskervi/6_2/spqr/pstrix2.tex b/usergrps/uktug/baskervi/6_2/spqr/pstrix2.tex new file mode 100644 index 0000000000..c8cbfd096e --- /dev/null +++ b/usergrps/uktug/baskervi/6_2/spqr/pstrix2.tex @@ -0,0 +1,1085 @@ +\documentclass{baskerv} +\usepackage[T1]{fontenc} +\usepackage{spqr} +\begin{document} +\def\CurrentPackages{spqr,pstcol} +\newcounter{myN} +\setlongtables +\author[Sebastian Rahtz]{Sebastian Rahtz\\Elsevier Science Ltd\\ +Email: \texttt{s.rahtz@elsevier.co.uk}} +\title{An introduction to PSTricks, part 2} +\begin{Article} +\section{Preface} +In the first part of this description of \PST, we looked at +the basic concepts of the package, a series of low-level building +blocks, and the useful commands for dealing with text and the third +dimension. Now it is time to look at the higher-level packages built +in \PST, for drawing trees and graphs. There are a wide variety of +applications, as I hope the examples show. This part of the package +is, unfortunately, extremely rich, and readers should not be surprised +if they find the plethora of new commands rather confusing. + +%--------------------------- +\section{Nodes and their connections, and trees} +\PST\ offers sophisticated macros for setting up named nodes +and joining them together in complicated ways, complete with labels. + +The nodes can be created in three ways: +\begin{enumerate} +\item By placing them at arbitrary coordinates +\item By placing them on a regular grid or matrix +\item By using higher-level tree macros +\end{enumerate} +The sort of effect we will create is like this: + +\begin{GridPSExample}(0,0)(5,5) +\rput(1,1){\rnode{A}{Dog}} +\rput(2,4){\rnode{B}{Cat}} +\rput(4,2){\rnode{C}{Mouse}} +\ncline{A}{B} +\nccurve[linestyle=dotted]{A}{B} +\ncarc[linestyle=dashed]{A}{B} +\end{GridPSExample} + +Every node is given a symbolic name, which is used for +node connectors (lines, curves and so on), and for node labels. The +fact that nodes can occur \emph{anywhere} (such as in running text), +makes it possible to use them for surprising effects like linking two +words \rnode{n1}{one} to \rnode{n2}{another}\nccurve{n1}{n2}. When +considering connectors, we have to distinguish between the position of +the node they are pointing \emph{towards} (the node reference point), +and the actual extent of the connector. Most node creators have an +invisible box around them, which determines the end of connector lines. +We will first list all the commands, and then give practical examples. + +Table~\ref{PSTnode} lists all the node creation commands and node +connector commands, Table~\ref{PSTnodelab} lists the commands to label +connectors and nodes, and Table~\ref{PSTnodeparm} lists the extra +graphical parameters which apply to node connectors. + +\end{multicols} +\begin{longtable}{lH{8.5cm}} +\caption{\protect\PST\ node drawing commands\label{PSTnode}}\\ +\hline +\endfirsthead +\protect\PST\ node drawing commands \emph{cont.}\\ +\hline +\endhead +\multicolumn{2}{l}{\bfseries\itshape Node creators} +\\ +\PSTCom \rnode`[refpoint]'{name}{text} +& create a node called \emph{name}, consisting of \emph{text}; +connectors point to the \emph{refpoint} +\\ +\PSTCom \Rnode`\c~'{name}{text} +& the same as \Lcs{rnode}, but the reference point is the middle of +the box's baseline, plus \c~{} +\\ +\PSTCom \pnode`\c~'{name} +& create a node at \c, which takes up no space +\\ +\PSTComOpt \cnode`\c~'{radius}{name} +& create a node consisting of circle of \emph{radius} +\\ +\PSTComOpt \Cnode`\c~'{name} +& create a node consisting of circle, using the +radius set by the \emph{radius} graphical parameter (it is sometimes +useful to set the radius for many circles) +\\ +\PSTComOpt \cnodeput`{angle}\c~'{name}{text} +\\ +\PSTComOpt \circlenode{name}{text} +& like \Lcs{pscirclebox}, but makes a node +\\ +\PSTComOpt \ovalnode{name}{text} +& like \Lcs{psovalbox}, but makes a node +\\ +\PSTComOpt \dianode{name}{text} +& like \Lcs{diabox}, but makes a node +\\ +\PSTComOpt \dotnode`\c~'{name}{text} +& like \Lcs{psdot}, but makes a node +\\ +\PSTComOpt \fnode`\c~'{name}{text} +& like \Lcs{psframe}, but makes a node +\\ +\PSTComOpt \trinode{name}{text} +& like \Lcs{tribox}, but makes a node +\\ +[6pt] +\multicolumn{2}{l}{\bfseries\itshape Node connectors} +\\ +\PSTComOpt \ncline`{arrows}'{firstnode}{secondnode} +& straight line between nodes +\\ +\PSTComOpt \ncLine`{arrows}'{firstnode}{secondnode} +& straight line between nodes, but labels are placed as if the line +went right to the center of the nodes +\\ +\PSTComOpt \ncarc`{arrows}'{firstnode}{secondnode} +& arc between nodes; uses parameter \emph{arcangle} +\\ +\PSTComOpt \ncdiag`{arrows}'{firstnode}{secondnode} +& using the \emph{arm} and \emph{angle} parameters, `arms' start out +from each node and are then joined by a line; corner shape is +controlled by the \emph{linearc} parameter +\\ +\PSTComOpt \ncdiagg`{arrows}'{firstnode}{secondnode} +& as \Lcs{ncdiag}, but the second arm is not drawn +\\ +\PSTComOpt \ncbar`{arrows}'{firstnode}{secondnode} +& a line is drawn with arms coming off at a right angle to the nodes, +at an angle of \emph{angleA}; the arm length is adjusted if necessary +\\ +\PSTComOpt \ncangle`{arrows}'{firstnode}{secondnode} +& draws a connect line \Lcs{ncdiag}, but the angle between arm A and +the connector line is forced to a right angle +\\ +\PSTComOpt \ncangles`{arrows}'{firstnode}{secondnode} +& like \Lcs{ncangle}, but arm A is joined to arm B by two line +segments that meet at a right angle +\\ +\PSTComOpt \ncloop`{arrows}'{firstnode}{secondnode} +& like \Lcs{ncangles} but 5 line segments are used, the second and +forth being \emph{loopsize} long +\\ +\PSTComOpt \nccurve`{arrows}'{firstnode}{secondnode} +& bezier curve between nodes, using the \emph{ncurv} parameters to +determine the control point positions +\\ +\PSTComOpt \nccircle`{arrows}'{node}{radius} +& draws a circle or part circle of radius \emph{radius} +connecting the node to itself +\\[6pt] +\multicolumn{2}{l}{\bfseries\itshape Coil and zigzag node connectors} +\\ +\PSTCom \nccoil`*[settings]{arrows}'{firstnode}{secondnode} +\\ +\PSTCom \nczigzag`*[settings]{arrows}'{firstnode}{secondnode} +\end{longtable} + +\begin{longtable}{llH{.4\textwidth}} +\caption{\protect\PST\ Graphical parameters for node connectors} +\label{PSTnodeparm}\\[1mm] +\emph{Parameter} & \emph{Default} & \emph{Explanation}\\ +\hline +\endfirsthead +\protect\PST\ Graphical parameters for node connectors \emph{cont.}\\[1mm] +\emph{Parameter} & \emph{Default} & \emph{Explanation}\\ +\hline +\endhead +\mbox{}\\ +\endfoot +\Par{offset=dim} (0pt) +& the offset of the connection point to a node\\ +\Par{nodesep=dim} (0pt) +&the border around nodes at which connectors stop +\\ +\Par{nodesepA=dim} (0pt) +&the border around the first node +\\ +\Par{nodesepB=dim} (0pt) +&the border around the second node + \\ +\Par{arcangle=angle} (8) +&in \Lcs{ncarc}, the angle between the arc and a straight line drawn between the nodes + \\ +\Par{angle=angle} (0) +&the angle at which connectors hit the nodes + \\ +\Par{angleA=angle} (0) +&the angle at which a connector hits the first node + \\ +\Par{angleB=angle} (0) +&the angle at which a connector hits the second node + \\ +\Par{arm=dim} (10pt) +&the length of the line segment where the connector joins the nodes + \\ +\Par{armA=dim} (10pt) +&the length of the line segment where the connector joins the first node + \\ +\Par{armB=dim} (10pt) +&the length of the line segment where the connector joins the second node + \\ +\Par{loopsize=dim} (1cm) +& the length of line segments for \Lcs{ncloop} +\\ +\Par{ncurv=num} (0.67) +& the distance to Bezier control points in \Lcs{nccurve}; lower values +give tighter curves; the distance from the node to the first control +point is half \emph{ncurv} $\times$ the distance between the two end points\\ +\Par{ncurvA=num} (0.67) +& as \emph{ncurv} but for first node only +\\ +\Par{ncurvB=num} (0.67) +& as \emph{ncurv} but for second node only +\\ +\Par{boxsize=dim} (0.4cm) +& half the width of the enclosing box of \Lcs{ncbox} and \Lcs{ncarcbox} +\\[6pt] +\multicolumn{3}{l}{\bfseries\itshape Parameters for node labels}\\ +\Par{ref=ref} (c) +& sets the reference point for labels\\ +\Par{nrot=rot} (0) +& the rotation of label text; if the angle is preceded by :, it is +measured with respect to the connector line; the letter abbreviations +we have already seen are available, so :U is commonly used to +align text on the connector line\\ +\Par{npos=num} () +& the position along the length of the connector line where a label is +placed; each connector line has one or more segments, and the value of +\emph{npos}+1 determines the segment on which the label is set; the +default values for this parameter are given in the \protect\PST\ +manual, but can also be seen in the examples below\\ +\Par{shortput=none/nab/tablr/tab} (none) +& determines whether short codes are available for labelling +connectors; see \pageref{shortput}.\\ +\Par{tpos=num} (0.5) +& the proportion of the distance between nodes at which labels are +placed on a connector\\ +\Par{mnode=type} (R) +& (for matrices) the default node type; possibilities are +R (\Lcs{Rnode}), r (\Lcs{rnode}), C (\Lcs{Cnode}), f (\Lcs{fnode}), p +(\Lcs{pnode}), circle (\Lcs{circlenode}), oval (\Lcs{ovalnode}), dia +(\Lcs{dianode}), tri (\Lcs{trinode}), dot (\Lcs{dotnote}), and none\\ +\Par{emnode=type} (none) +& (for matrices) the type of node created for empty cells in a matrix\\ +\Par{name=name} () +& (for matrices) the name of a node; parameters like this can set in +square brackets in the cell\\ +\Par{nodealign=true/false} (false) +& (for matrices) whether baselines of nodes pass through the centre of +nodes\\ +\Par{mcol=l/r/c} (c) +& (for matrices) the alignment of a node within a matrix cell\\ +\Par{mnodesize=dim} (-1pt) +& (for matrices) is positive, nodes are forced to be this size\\ +\Par{rowsep=dim} (1.5cm) +& (for matrices) the gap between rows \\ +\Par{colsep=dim} (1.5cm) +& (for matrices) the gap between columns \\ +\end{longtable} + +\begin{longtable}{lH{10cm}} +\caption{\protect\PST\ node connection + labelling commands}\label{PSTnodelab}\\ +\hline +\endfirsthead +\protect\PST\ node connection labelling commands \emph{cont.}\\ +\hline +\endhead +\multicolumn{2}{l}{\bfseries\itshape Labelling based on connector length}\\ +\PSTComOpt \ncput {something} +& place \emph{something} on the connector line\\ +\PSTComOpt \naput {something} +& place \emph{something} above the connector line\\ +\PSTComOpt \nbput {something} +& place \emph{something} under the connector line\\[6pt] +\multicolumn{2}{l}{\bfseries\itshape Labelling based on distance +between nodes}\\ +\PSTComOpt \tvput {something} +& working on the vertical distance between nodes, place \emph{something} in the middle of the line\\ +\PSTComOpt \tlput {something} +& working on the vertical distance between nodes, place \emph{something} +to the left of the line\\ +\PSTComOpt \trput {something} +& working on the vertical distance between nodes, +place \emph{something} to the right of the line\\ +\PSTComOpt \thput{something} +& working on the horizontal distance between nodes, +place \emph{something} in the middle of the line\\ +\PSTComOpt \taput{something} +& working on the horizontal distance between nodes, +place \emph{something} above the line\\ +\PSTComOpt \tbput{something} +& working on the horizontal distance between nodes, +place \emph{something} below the line\\[6pt] +\multicolumn{2}{l}{\bfseries\itshape Labelling nodes}\\ +\PSTCom`[par]'{angle}{name}{something} +& place \emph{something} next to the node, at a distance of +\emph{nodesep}, in the direction \emph{angle} from the centre of the node +\end{longtable} +\begin{multicols}{2} +\begin{table*} +\caption{\protect\PST\ drawing commands comparable to node connectors} +\label{PSTcondraw} +\begin{tabular}{l} +\PSTComOpt \pcline`{arrows}'\c1\c2 +\\ +\PSTComOpt \pccurve`{arrows}'\c1\c2 +\\ +\PSTComOpt \pcarc`{arrows}'\c1\c2 +\\ +\PSTComOpt \pcbar`{arrows}'\c1\c2 +\\ +\PSTComOpt \pcdiag`{arrows}'\c1\c2 +\\ +\PSTComOpt \pcangle`{arrows}'\c1\c2 +\\ +\PSTComOpt \pcloop`{arrows}'\c1\c2 +\\ +\PSTCom \pczigzag`*[settings]{arrows}'\c1\c2 +\\ +\PSTCom \pccoil`*[settings]{arrows}'\c1\c2 +\end{tabular} +\end{table*} +There are several important concepts we need to bear in mind when +looking at the myriad of node and connector commands: +\begin{enumerate} +\item When joining two nodes with something like a curve, the +connectors comes in by default on the right hand side of the object +(at 0 degrees). If we have two boxes side by side, the \emph{angleB} +parameter has to be set to 180 if we want the connector to come into +the second box on its left side. This may seem cumbersome at first, +but it makes for a flexible system; +\item the connector labelling commands all place the label +some proportion of the way along the connector, but they distinguish +between the distance between nodes, and the length of the line. The +former situation applies to constructions like matrices, where we +want the label positions to be constant, regardless of the size of the +nodes. +\item The node connectors are not drawn directly in \TeX, but are done +at the PostScript level; this means that \TeX\ is not always quite +sure how much space will be taken up by the object. Particularly when +curving connectors are drawn, you might find that they protrude +outside the area allowed by \TeX --- adjust by hand. +\end{enumerate} +\label{shortput} +Because labelling node connectors is a very common thing to do, a +short cut is provided to save all the \Lcs{naput} commands etc. If the +parameter \emph{shortput} is set to \texttt{nab}, the \verb|^| is used +instead of \Lcs{naput} and \verb|_| instead of \Lcs{nbput}. If it is +set to \texttt{tablr}, the \verb|^| stands for \Lcs{taput}, +\verb|_| for \Lcs{tbput}, +\verb|<| for \Lcs{tlput} and +\verb|>| for \Lcs{trput}. + +If all this were not enough, all the node connectors can also be used as +ordinary drawing tools, by using the commands listed in +Table~\ref{PSTcondraw}, where the `pc' version corresponds to the `nc' +node connector. + +Let us first demonstrate the effects of these basic building blocks: +\end{multicols} +\begin{longtable}{l} +\begin{PSTInlineExample}(3,1) +\rput(.5,.5){\rnode{A}{Cat}} +\rput(2.5,.5){\rnode{B}{Dog}} +\ncline{A}{B} +\end{PSTInlineExample} +\\ +\begin{PSTInlineExample}(3,1) +\rput(.5,.5){\Rnode{A}{Cat}} +\rput(2.5,.5){\Rnode{B}{Dog}} +\ncline{A}{B} +\end{PSTInlineExample} +\\ +\begin{PSTInlineExample}(3,1) +\pnode(.5,.5){A} +\pnode(2.5,.5){B} +\ncline{A}{B} +\end{PSTInlineExample} +\\ +\begin{PSTInlineExample}(3,1) +\cnode(.5,.5){.2}{A} +\cnode(2.5,.5){.2}{B} +\ncline{A}{B} +\end{PSTInlineExample} +\\ +\begin{PSTInlineExample}(3,1) +\psset{radius=.3} +\Cnode(.5,.5){A} +\Cnode(2.5,.5){B} +\ncline{A}{B} +\end{PSTInlineExample} +\\ +\begin{PSTInlineExample}(3,1) +\rput(.5,.5){\circlenode{A}{Cat}} +\rput(2.5,.5){\circlenode{B}{Dog}} +\ncline{A}{B} +\end{PSTInlineExample} +\\ +\begin{PSTInlineExample}(3,1) +\rput(.5,.5){\ovalnode{A}{Cat}} +\rput(2.5,.5){\ovalnode{B}{Dog}} +\ncline{A}{B} +\end{PSTInlineExample} +\\ +\begin{PSTInlineExample}(3,1) +\rput(.5,.5){\trinode{A}{Cat}} +\rput(2.5,.5){\trinode{B}{Dog}} +\ncline{A}{B} +\end{PSTInlineExample} +\\ +\begin{PSTInlineExample}(3,1) +\dotnode(.5,.5){A} +\dotnode(2.5,.5){B} +\ncline{A}{B} +\end{PSTInlineExample} +\\ +\begin{PSTInlineExample}(3,1) +\fnode(.5,.5){A} +\fnode(2.5,.5){B} +\ncline{A}{B} +\end{PSTInlineExample} +\\ +\begin{PSTInlineExample}(3,1) +\rput(.5,.5){\dianode{A}{Cat}} +\rput(2.5,.5){\dianode{B}{Dog}} +\ncline{A}{B} +\end{PSTInlineExample} +\\ +\begin{PSTInlineExample}(3,1) +\rput(.5,.5){\rnode{A}{\psframebox{Cat}}} +\rput(2.5,.5){\rnode{B}{\psframebox{Dog}}} +\ncline{A}{B} +\end{PSTInlineExample} +\\ +\begin{PSTInlineExample}(3,2) +\rput(.5,.5){\rnode{A}{\psframebox{Cat}}} +\rput(2.5,1.5){\rnode{B}{\psframebox{Dog}}} +\nccurve[angleB=180]{A}{B} +\end{PSTInlineExample} +\\ +\begin{PSTInlineExample}(3,1) +\rput(.5,.5){\rnode{A}{\psframebox{Cat}}} +\rput(2.5,.5){\rnode{B}{\psframebox{Dog}}} +\ncarc{->}{A}{B} +\ncarc{->}{B}{A} +\end{PSTInlineExample} +\\ +\begin{PSTInlineExample}(3,2) +\rput(.5,.5){\rnode{A}{\psframebox{Cat}}} +\rput(2.5,1.5){\rnode{B}{\psframebox{Dog}}} +\ncbar{A}{B} +\end{PSTInlineExample} +\\ +\begin{PSTInlineExample}(3,2) +\rput(.5,.5){\rnode{A}{\psframebox{Cat}}} +\rput(2.5,1.5){\rnode{B}{\psframebox{Dog}}} +\ncdiag[angleB=180]{A}{B} +\end{PSTInlineExample} +\\ +\begin{PSTInlineExample}(3,2) +\rput(.5,.5){\rnode{A}{\psframebox{Cat}}} +\rput(2.5,1.5){\rnode{B}{\psframebox{Dog}}} +\ncdiagg[angleB=180]{A}{B} +\end{PSTInlineExample} +\\ +\begin{PSTInlineExample}(3,2) +\rput(.5,.5){\rnode{A}{\psframebox{Cat}}} +\rput(2.5,1.5){\rnode{B}{\psframebox{Dog}}} +\ncangle[angleB=180]{A}{B} +\end{PSTInlineExample} +\\ +\begin{PSTInlineExample}(3,2) +\rput(.5,.5){\rnode{A}{\psframebox{Cat}}} +\rput(2.5,1.5){\rnode{B}{\psframebox{Dog}}} +\ncangles[angleB=180]{A}{B} +\end{PSTInlineExample} +\\ +\begin{PSTInlineExample}(3,2) +\rput(.5,.5){\rnode{A}{\psframebox{Cat}}} +\rput(2.5,1.5){\rnode{B}{\psframebox{Dog}}} +\ncloop[loopsize=.25,angleB=180]{A}{B} +\end{PSTInlineExample} +\\ +\begin{PSTInlineExample}(3,2) +\rput(1,.5){\rnode{A}{\psframebox{Cat}}} +\nccircle{->}{A}{.5} +\end{PSTInlineExample} +\\ +\begin{PSTInlineExample}(3,1) +\rput(.5,.5){\rnode{A}{\psframebox{Cat}}} +\rput(2.5,.5){\rnode{B}{\psframebox{Dog}}} +\psset{coilarm=.01,coilwidth=.3} +\nccoil{A}{B} +\end{PSTInlineExample} +\\ +\begin{PSTInlineExample}(3,1) +\rput(.5,.5){\rnode{A}{\psframebox{Cat}}} +\rput(2.5,.5){\rnode{B}{\psframebox{Dog}}} +\psset{coilarm=.01,coilwidth=.3} +\nczigzag{A}{B} +\end{PSTInlineExample} +\\ +\end{longtable} +\begin{multicols}{2} +The effect of node connectors is demonstrated in the +following, which uses the \Lcs{multido} macro (we will look at that in +the next article) to place objects at +regular intervals around a circle, and join them up +\end{multicols} +\begin{example*} +\newcount\CtA +\newcount\CtB +\newcommand{\Wheel}[3]{{% +\psset{unit=#2} +\pspicture(-1,-1)(1,1) +\SpecialCoor +\degrees[#1] +\multido{\ia=1+1}{#1}{% + \CtA=\ia + \advance\CtA by 1 + \CtB=#1 + \advance\CtB by -\ia + \multido{\ib=\CtA+1} + {\CtB}{#3(1;\ia)(1;\ib)}} +\multido{\i=1+1}{#1}{% + \rput(1;\i){% + \pscirclebox[fillstyle=solid, + fillcolor=white]% + {\footnotesize\i}}} +\endpspicture}} + +\Wheel{3}{1.8}{\psline} +\Wheel{5}{1.8}{\psline} +\psset{arcangle=10} +\Wheel{12}{3}{\pcarc[linecolor=blue]} +\end{example*} +\begin{multicols}{2} +It should be clear that we can draw arbitrary diagrams, trees etc +simply by working out the coordinates of each node; however, in +practice, there are two higher-level environments for easier creation +of nodes --- matrices and trees. + +\subsection{Matrices --- grid-based nodes} +The existing \LaTeX\ \Lenv{tabular} or AMS \LaTeX\ \Lenv{matrix} can be +used to place nodes, but \PST\ provides its own environment, +\Lenv{psmatrix}. This is like an easy +form of table, since the number of columns does not have to be +specified --- we simply separate column items by \verb|&| and rows by +\verb|\\| as normal, and \PST\ makes each cell a node, named as +\emph{rownumber},\emph{columnumber}. Thus the first node in the first +row is named \texttt{1,1} and the third node in the fourth row is +\texttt{4,3}, and these are used by the node connectors. + +\Lcs{psmatrix} has an optional parameter in which we can set +\emph{rowsep} and \emph{colsep}, determining the gap between +nodes. The parameter \emph{shortput} is set to \emph{tab} inside +\Lcs{psmatrix} by default, so we can adopt a quite succinct notation: + +\begin{PSExample}(0,0)(2.5,5) +\begin{psmatrix}[rowsep=1.5cm] +&City&\\ +{\tiny Shack} & House & {\Large Hotel} +\psset{arrows=<<-} +\ncline{1,2}{2,1}<{a} +\ncline{1,2}{2,2}>{b} +\ncline{1,2}{2,3}>{b} +\psset{arrows=-,linestyle=dotted} +\ncline{2,1}{2,2} +\ncline{2,2}{2,3} +\end{psmatrix} +\end{PSExample} + +Notice in this example that the shorthand `>' stands for \Lcs{trput}, +which places labels according to the distance between node centres, +not the connection length, which allows for the difference in sizes +of nodes in the second row. Nodes can span multiple columns by using +the \Lcs{psspan} command at the end of the cell, with a parameter of +the number of columns to span. + +A simple example of a square matrix can be created as follows: +\begin{example*} +\begin{psmatrix} +A & B \\ +$\sqrt{\frac{x + y}{z}}$ & D +\ncline{->}{1,1}{1,2} +\ncline{->}{1,2}{2,2} +\ncline{->}{2,2}{2,1} +\ncline{->}{2,1}{1,1} +\end{psmatrix} +\end{example*} +\noindent but by changing a few initial parameter settings, we can +present a `fancier' result, with nodes encircled, arrows on +connectors, and a better spacing. The connector labels are added with +the short-hand forms, which are those which are positioned in relation +to node centres. In the second version below, we redo the labels with +the label types which relate to line length, which in this case gives +a better result. The outer looping connector is an example of a +construct whose extent \TeX\ will probably guess incorrectly. +\begin{example*} +\psset{arrows=->,labelsep=3pt, +linecolor=gray,mnode=circle} +\begin{psmatrix}[rowsep=20pt,colsep=28pt] +A & B \\ +$\sqrt{\frac{x + y}{z}}$ & D +\psset{linestyle=dotted} +\ncline{1,1}{1,2}^{\emph{firstly}} +\ncline{1,2}{2,2}>{\emph{next}} +\ncline{2,2}{2,1}_{\emph{then}} +\ncline{2,1}{1,1}<{\emph{lastly}} +\end{psmatrix} +\end{example*} + +\begin{example*} +\psset{arrows=->,labelsep=3pt, +linecolor=gray,mnode=circle} +\begin{psmatrix}[rowsep=20pt,colsep=28pt] +A & B \\ +$\sqrt{\frac{x + y}{z}}$ & D +\psset{linestyle=dotted} +\ncline{1,1}{1,2}\naput{\emph{firstly}} +\ncline{1,2}{2,2}\naput{\emph{next}} +\ncline{2,2}{2,1}\naput{\emph{then}} +\ncline{2,1}{1,1}\naput{\emph{lastly}} +\nccurve[ncurv=2,linestyle=solid,angleA=90]{1,1}{2,2} +\end{psmatrix} +\end{example*} + +Matrices can be nested, and it is possible to link nodes from two +different matrices, if the nodes are given explicit names. Each +\Lcs{psmatrix} wipes out the current set of \emph{row,column} names. + +\begin{example*} +\psset{linearc=.2} +\begin{psmatrix}[rowsep=3pt,colsep=-10pt] +[name=A]\psframebox{requirements}\\ +&[name=B]\psframebox{design}\\ +&&[name=C]\psframebox{coding}\\ +&&&[name=D]\psframebox{testing}\\ +&&&&[name=E]\psframebox{operations} +\psset{linearc=0,arrows=->,armA=0pt,angleB=90} +\ncangle{A}{B} +\ncangle{B}{C} +\ncangle{C}{D} +\ncangle{D}{E} +\psset{angleB=-90,angleA=180} +\ncangle{B}{A} +\ncangle{C}{B} +\ncangle{D}{C} +\ncangle{E}{D} +\end{psmatrix} +\end{example*} + +A normal low-level \PST\ +command, like \Lcs{framebox}, can be applied to a whole matrix. +We have to take some care in this example with alignment to make +the connecting line horizontal, so we place the single node on the +left in its own matrix. +\end{multicols} +\begin{example*} +\psset{fillcolor=white,fillstyle=solid} +\def\Show#1{\psshadowbox{#1}} +\psset{arrows=->} +\begin{psmatrix} + [mnode=r,ref=t,ref=t] + \psframebox[linestyle=none,framesep=.75]{% + \psset{ref=c} + \begin{psmatrix} + [name=A]\Show{Stakeholder} + \end{psmatrix} + } & + [mnode=r,ref=t] + \psframebox[fillstyle=solid,framesep=.75,fillcolor=gray]{% + \psset{ref=c} + \rule{1cm}{0pt} + \begin{psmatrix} + [name=B]\Show{Goal} &\Show{Criteria}\\ + \Show{Sub-goal} & \Show{Justification} + \ncline{1,1}{1,2} + \ncline{1,1}{2,2} + \ncline{1,1}{2,1}\tlput{Strategy} + \ncline{2,1}{2,2} + \end{psmatrix} + } +\ncline[angleB=-180]{A}{B}\naput[npos=.7]{Model} +\end{psmatrix} +\end{example*} +\begin{multicols}{2} +\subsection{Tree diagrams} +\PST\ has an extremely rich environment for drawing trees, which +allow for very complex structures and presentation. The available +commands are listed in Table~\ref{PSTtree} and the graphical +parameters which apply especially to these are listed in +Table~\ref{PSTtreeparms}. As one might expect, most other commands and +parameters are also available, from both the generalized drawing, and +the node connectors and labels. Each of the node types described +earlier is turned into a `tree' node, and named by prefixing it with a +`T' and removing the `node' suffix. + +\end{multicols} +\begin{small} +\begin{longtable}{llH{10cm}} +\caption{\protect\PST\ Graphical parameters for trees} +\label{PSTtreeparms}\\[1mm] +\emph{Parameter} & \emph{Default} & \emph{Explanation}\\ +\hline +\endfirsthead +\protect\PST\ Graphical parameters for trees \emph{cont.}\\[1mm] +\emph{Parameter} & \emph{Default} & \emph{Explanation}\\ +\hline +\endhead +\mbox{}\\ +\endfoot +\Par{bbd=dim} () +& set lower bounding box to \emph{dim}\\ +\Par{bbh=dim} () +& set upper bounding box to \emph{dim}\\ +\Par{bbl=dim} () +& set left bounding box to \emph{dim}\\ +\Par{bbr=dim} () +& set right bounding box to \emph{dim}\\ +\Par{edge=command} (\ncline) +& the node connector used to join tree nodes\\ +\Par{fansize=dim} (1cm) +&size of base for \Lcs{Tfan} tree node\\ +\Par{levelsep=*dim} (2cm) +& the distance between successive levels in a tree; the * makes the dimension be \emph{in addition} to the size of the nodes (levels are normally a fixed distance apart)\\ +\Par{showbbox=true/false} (false) +& draw a dotted frame showing the enclosing rectangle of trees\\ +\Par{thislevelsep=*dim} () +& like \emph{levelsep} but applies only to the current tree\\ +\Par{thistreefit=tight/loose} () +& like \emph{treefit} but applies only to the current tree\\ +\Par{thistreenodesize=dim} () +& like \emph{treenodesize} but applies only to the current tree\\ +\Par{thistreesep=dim} () +& like \emph{treesep} but applies only to the current tree\\ +\Par{tndepth=dim} () +& the minimum depth of tree node labels\\ +\Par{tnheight=dim} () +& the minimum height of tree node labels\\ +\Par{tnpos=l/r/a/b} (b) +& the position of tree node labels relative to the node (left, right, +above, below) \\ +\Par{tnsep=dim} () +& the gap between tree node labels and the node (by default the same as +\emph{labelsep} \\ +\Par{treefit=tight/loose} (tight) +& if tight, \emph{treesep} is the minimum distance between nodes on any level; if loose, \emph{treesep} is the distance between the enclosing +bounding boxes of subtrees\\ +\Par{treeflip=true/false} (false) +& does a mirror image of the free, flipping the nodes\\ +\Par{treemode=R/L/U/D} (D) +& the direction of tree growth (right, left, up and down)\\ +\Par{treenodes=dim} ($-$1pt) +& if positive, this sets a fixed size for tree nodes, regardless of content\\ +\Par{treesep=dim} (0.75cm) +& the distance between successive nodes in a tree\\ +\Par{xbbd=dim} () +& increase lower bounding box by \emph{dim}\\ +\Par{xbbh=dim} () +& increase upper bounding box by \emph{dim}\\ +\Par{xbbl=dim} () +& increase left bounding box by \emph{dim}\\ +\Par{xbbr=dim} () +& increase right bounding box by \emph{dim}\\ +\end{longtable} +\end{small} + +\begin{small} +\begin{longtable}{lH{.5\textwidth}} +\caption{\protect\PST\ tree drawing commands\label{PSTtree}}\\ +\hline +\endfirsthead +\multicolumn{2}{l}{\protect\PST\ tree drawing commands \emph{cont.}}\\ +\hline +\endhead +\PSTCom \PStree{node}{subtrees} +& draws a node and subtrees connected to it\\ +\PSTCom \PSTree{rootnode} subtrees +%\endpsTree +& an `environment' form of \Lcs{psTree}\\ +\PSTCom \Tn +& null tree node \\ +\PSTCom \tspace{dim} +& leave gap of \emph{dim} before next level\\ +\PSTComOpt \TC +& tree node like \Lcs{Cnode} node\\ +\PSTComOpt \TR{something} +& tree node like \Lcs{Rnode} node\\ +\PSTComOpt \Tcircle{something} +& tree node like \Lcs{circlenode} node\\ +\PSTComOpt \Tc{dim} +& tree node like \Lcs{cnode} node\\ +\PSTComOpt \Tdia{something} +& tree node like \Lcs{dianode} node\\ +\PSTComOpt \Tdot +& tree node like \Lcs{dotnode} node\\ +\PSTComOpt \Tf +& tree node like \Lcs{fnode} node\\ +\PSTComOpt \Tfan +& draws a triangle with a top corner of the predecessor node\\ +\PSTComOpt \Toval{something} +& tree node like \Lcs{ovalnode} node\\ +\PSTComOpt \Tp +& tree node like \Lcs{pnode} node\\ +\PSTComOpt \Tr{something} +& tree node like \Lcs{rnode} node\\ +\PSTComOpt \Ttri{something} +& tree node like \Lcs{trinode} node\\ +\PSTComOpt \skiplevel {nodes or subtrees} +& miss out entire levels in a particular subtree\\ +\PSTComOpt \skiplevels{n} {nodes or subtrees} +& skip \emph{n} levels\\ +\end{longtable} +\end{small} + +\begin{multicols}{2} +The fundamental concept in \PST\ trees is the \emph{nesting} of trees; +a simple tree consists of a root, and one or more nodes: +\begin{example*} +\pstree{\TC}{\TC\TC} +\end{example*} +\noindent but each node can itself be a tree: +\begin{example*} +\pstree{\TC}{\pstree{\TC}{\TC \TC} + \pstree{\TC}{\TC \TC}} +\end{example*} +This simple constructs allows very complicated structures to be +erected, as the examples below show. + +The following tree is a version of that shown in the \emph{\LaTeX\ Companion}, +section 10.5.2, which was drawn using the \Lpack{ecltree} package; the +ease of notation is roughly similar. As often in \LaTeX, the +readability depends a great deal on how the code is laid out. The +only change to the defaults is to lessen the vertical space between +trees, and add some extra space around nodes. +\begin{example*} +\pstree[nodesep=2pt, + levelsep=20pt]{\TR{grandfather}} +{ + \pstree{\TR{uncle}}{\TR{cousin}} + \pstree{\TR{father}} + { + \pstree{\TR{brother}}{\TR{nephew}} + \pstree{\TR{Me}} + { + \pstree{\TR{son}}{\TR{grandson}} + } + } +} +\end{example*} + +If we now consider another tree drawing package described in +the \emph{\LaTeX\ Companion}, Vanroose's \Lpack{trees}, the example in section +10.2.3 is a little harder to reproduce. The skeleton is trivial: +\begin{example*} +\pstree{\Tdot} +{ +\Tdot +\pstree{\Tdot} + { + \pstree{\Tdot} + { + \Tdot + \Tdot + \Tdot + } + \Tdot + } +} +\end{example*} + +\noindent but when we come to add in all the node and connector labels, and +change a few parameters to make the result nicer, the markup becomes a +little complex, though the quantity is roughly similar to that of Vanroose: + +\begin{example*} +\psset{labelsep=2pt,tnpos=a,radius=2pt} +\pstree[treemode=R]{\TC*~{25}} +{ +\TC*~{5}~[tnpos=r]{$L_a$} +\taput{$a$} +\pstree{\TC*~{20}\tbput{$b$}} + { + \pstree{\TC*~{15}\taput{$a$}} + { + \TC*~{7}~[tnpos=r]{$L_{baa}$}\taput{$a$} + \TC*~{5}~[tnpos=r]{$L_{bab}$}\taput{$b$} + \TC*~{3}~[tnpos=r]{$L_{bac}$}\tbput{$c$} + } + \TC*~{5}~[tnpos=r]{$L_{bb}$} + \tbput{$b$} + } +} +\end{example*} + +The node connectors in a tree are created by running +the macro \Lcs{psedge} with the two nodes; the definition of +\Lcs{psedge} can be overridden explicitly by a redefinition, or by +using the \emph{edge} parameter. Here we redefine \Lcs{psedge} to be a +curve, arrange the angles (bearing in mind that the tree is to grow +upwards), and obtain a pleasing result. Note also the explicit links +between named nodes, as well as the regular connections. +\end{multicols} +\begin{example*} +\footnotesize +\def\psedge{\nccurve} +\newcommand{\Female}[2][]{\TR[#1]{\emph{#2}}} +\newcommand{\Male}[2][]{\TR[#1]{#2}} +\psset{nodesep=2pt,angleA=90,angleB=-90,unit=.6cm} +\pstree[treemode=U]{\Female{{\bfseries Matilde}}}{ + \pstree{\Male{Sebastian}}{ + \pstree{\Male[name=P]{Philip}}{\Male{Frederick}\Female{Ethel}} + \pstree{\Female[name=W]{Mary}}{\Male{Lionel}\Female{Agnes}}} + \pstree{\Female{Leonor}}{ + \pstree{\Male[name=R]{Ra\'ul}}{\Male{Joaquim}\Female{J\'ulia}} + \pstree{\Female[name=A]{Am\'elia}}{\Male{Melo}\Female{Augusta}}} +} +\psset{doubleline=true,linestyle=dotted} +\ncline{P}{W}\nbput{1940} +\ncline{R}{A}\nbput{1950} +\end{example*} +\begin{multicols}{2} +We said earlier that \PST\ does not always work out the extent of +objects correctly, and this is illustrated by the connectors in the +following example. Turning on \emph{showbbox}, we can see that without +the use of \emph{xbbl} etc in the second incarnation, the bounding box +is not correct: +\begin{example*} +\psset{angleB=-90,arrows=->,nrot=:U} +\def\molesworth#1{% + \pstree[#1]{\Tdia{ }} + { + \Tp[arrows=->,edge={\ncbar[angleA=180]}] + \nbput{Gabbitas} + {\psset{linestyle=dashed,arrows=-} \Tp } + \Tp[arrows=->,edge={\ncbar}] + \naput{Thring} + } +} +\psset{showbbox=true} +\begin{tabular}{l} +\molesworth{}\\[10pt] +\molesworth{xbbl=1cm,xbbr=1cm} +\end{tabular} +\end{example*} + +The technique of redefining edges is also necessary if we want +right-angled joins, rather than straight lines. Again, we need to take +care of the \emph{angleA} and \emph{angleB}, and ensure that in this +left-right tree the nodes all line up on their left edges, using the +\emph{ref} parameter. If this is not done, the \Lcs{ncangle} edges +produce strange results. +\begin{example*} +\def\Item#1{\Tr[ref=l]{% + \psframebox[linestyle=none]{#1}}} +\def\psedge{\ncangle} +\psset{xbbd=1.5cm,treemode=R, + angleB=-180,angleA=0,levelsep=72pt} +\pstree{\Item{langs}}{% + \Item{german} + \pstree{\Item{greek}}{% + \Item{hamilton-kelly} + \pstree{\Item{levy}}{% + \Item{doc} + \Item{src} + } + } + \Item{italian} + \pstree{\Item{portuguese}}{ + \Item{hyphenation} + } + \pstree{\Item{turkish}}{% + \Item{doc} + \Item{hyphen} + \Item{inputs} + \Item{mf} + \Item{misc} + } +\Item{xettex} +} +\end{example*} + +This allows us to remake the small family again, but this time with +nicer connectors: +\begin{example*} +\def\XX#1{% + \Tr{\psframebox{\rule{0pt}{9pt}#1}}% +} +\def\psedge{\ncangle} +\psset{angleB=90,angleA=-90, + levelsep=36pt,armB=14pt} +\pstree{\XX{grandmother}} +{% +\pstree{\XX{aunt}}{\XX{cousin}} +\pstree{\XX{mother}} + { + \pstree{\XX{sister}}{\XX{niece}} + \pstree{\XX{Me}} + { + \pstree{\XX{daughter}} + {\XX{granddaughter}} + } + } +} +\end{example*} +The node connectors are, of course, standard \PST\ objects, so they +obey all the normal parameters; here we draw the lower part of the +tree with dashed lines, and each node content is set in math mode. +\begin{example*} +\footnotesize +\psset{nodesep=2pt} +\def\XX#1#2{% + \TR{\ensuremath{#1_{\mbox{#2}}}}% +} +\pstree[xbbr=1.5cm]{\XX{R}{AMSU}} + { + \XX{S}{RawData} + \pstree{\XX{S}{combine} + \trput{\ensuremath{\oplus}} + \tlput{\ensuremath{\oplus}}} + { + \psset{linestyle=dashed} + \XX{R}{Modes} + \XX{R}{Normal} + \XX{R}{Vertical} + \XX{R}{Latched} + \XX{R}{Tripped} + } + \XX{S}{GenerateData} + } +\end{example*} + +If we want to hang distinct-looking trees off one node, +the \emph{ncangle} connector, with some offsets, produces the right result. + \begin{example*} +\psset{framearc=.2,levelsep=4cm, + armB=1cm,angleB=-180} +\def\psedge{\ncangle} +\def\TreeBox#1{\Tr{\psframebox{#1}}} +\pstree[treemode=R]{\TreeBox{Monitor}} +{ + \psset{offsetA=4pt} + \TreeBox{Attitude Generator} + \naput[npos=2.5]{{\small init}} + \nbput[npos=2.5]{{\small stop}} + \psset{offsetA=-4pt} + \TreeBox{Normal Generator} +} +\end{example*} + +With simple connectors, we do not need to worry about the offsets or +angles; what this example shows is how nested trees can change direction: + +\begin{example*} +\psset{arrows=->,framearc=.2} +\def\Treebox#1{% + \Tr{\psframebox{#1}} +} +\pstree[treemode=R] +{\Treebox{A$\rightarrow$B}}{ +\pstree{ + \Treebox{B$\rightarrow$C} + }{ + \Treebox{A$\rightarrow$D} +\pstree[treemode=L] + {\Treebox{B$\rightarrow$E}} + {\Tn\TC[arrows=<-]} + } +} +\end{example*} + +Finally, let us not forget the simple empty node: +\begin{example*} +\pstree{\Tp}{ + \Tcircle{A} + \Tcircle{B} +} +\end{example*} +\end{Article} +\end{document} diff --git a/usergrps/uktug/baskervi/6_2/spqr/spqr.sty b/usergrps/uktug/baskervi/6_2/spqr/spqr.sty new file mode 100644 index 0000000000..3175036e1e --- /dev/null +++ b/usergrps/uktug/baskervi/6_2/spqr/spqr.sty @@ -0,0 +1,150 @@ +\RequirePackage{pstcol} +\RequirePackage{fancyvrb} +\RequirePackage{shortvrb} +\RequirePackage{array,longtable} +\definecolor{wheat}{rgb}{.96, .87, .7} +\definecolor{lightblue}{rgb}{.68, .85, .9} +\definecolor{brown}{rgb}{.65, .16, .16} +\definecolor{pink}{rgb}{1, .75, .8} +\definecolor{palegreen}{rgb}{.6, .98, .6} +\definecolor{white}{rgb}{1, 1, 1 } +\catcode`\<=13 +\def\Main#1{{\MainFont\string#1}} +\def\MainFont{\ttfamily\upshape} % For macro definitions. +\def\ArgFont{\sffamily\mdseries\upshape} % For meta arguments. +\def\OptArgFont{\sffamily\mdseries\itshape} % For optional arguments. +\def<#1>{{\normalfont\itshape#1\/}} +% parameter descriptions are always in a table +\def\Par#1{\@ifnextchar({\@Par#1}{\@@Par#1()}} +\def\@Par#1=#2(#3){% + {\normalfont #1}={\ArgFont#2}& #3} +% Short-cuts for coordinates: +\def\x#1{{\normalfont\itshape $x$#1\/}} +\def\y#1{{\normalfont\itshape $y$#1\/}} +\def\z#1{{\normalfont\itshape $z$#1\/}} +\def\c#1{(\x{#1},\kern 1pt\y{#1})} +\def\cAny{(\x{},\kern 1pt\y{})} +% In each case: +% 1. definition is delimited only by end-of-line. +% 2. {}, () and [] are literal, with contents set in \ArgFont +% 3. = and , are literal. +% 4. `foo' is for optional arguments. +% 5. is meta, as usual. +\begingroup + \catcode`\<=1 \catcode`\>=2 + \catcode`\{=13 \catcode`\}=12 + \catcode`\[=13 + \gdef\@MD<% + \catcode`\{=13 \catcode`\}=12 \catcode`\[=13 + \def{##1}<\{<\ArgFont ##1\/>\}>% + \def[##1]<\string[<\ArgFont ##1\/>]>> +\endgroup +\begingroup + \catcode`\(=13 + \catcode`\,=13 + \catcode`\==13 + \gdef\MacroDefCodes{% + \@MD + \catcode`\(13 + \catcode`\^^M12 + \catcode`\`13 + \catcode`\,13 + \catcode`\!1 + \catcode`\@2 + \def~{}% + \def={{\fontshape{n}\selectfont\string=}}% + \def,{{\fontshape{n}\selectfont\string,}}% + \def(##1){\string({\ArgFont ##1})}} +\endgroup + +\begingroup + \catcode`\`=13 \gdef`#1'{{\OptArgFont #1}} +\endgroup + +\begingroup + \catcode`\^^M=12\relax% + \gdef\GetMacroDef#1{\begingroup\MacroDefCodes\@GetMacroDef{#1}}% + \gdef\@GetMacroDef#1#2^^M{#1{#2}\endgroup}% +\endgroup + +% For listing macro definitions in a "description" environment: +\def\PSTCom{\GetMacroDef\@PSCom} +\def\@PSCom#1{\@@PSCom#1\@nil} +\def\@@PSCom#1\@nil{\MainFont\Main#1} +\def\PSTComOpt{\GetMacroDef\@PSTComOpt} +\def\@PSTComOpt#1{\@@PSComOpt#1\@nil} +\def\@@PSComOpt#1#2\@nil{\@PSCom{#1{\OptArgFont*[{\ArgFont settings}]}#2}} +\MakeShortVerb{\"} +\DeleteShortVerb{\|} +\def\PST{\textsf{PSTricks}} +\def\PS{\textsc{PostScript}} +\def\Special{{\normalfont\ttfamily\char'134special}} +\def\Lcs#1{{\normalfont\ttfamily\char'134#1}} +\def\Program#1{\emph{#1}} +\def\Lpack#1{\emph{#1}} +%----------- Zandtisms -------------------- +\def\Usage#1{{\UsageFont\string#1}} +\def\MainFont{\fontfamily{\ttdefault}\fontseries{bc}\fontshape{n}\selectfont +\large}% For macro definitions. +\def\UsageFont{\fontfamily{\ttdefault}\fontseries{bc}\fontshape{n}\selectfont} + % For in-line macro names. +\def\InlineFont{\ttfamily} % For other in-line snipets of code. +\let\main\textbf +\let\usage\emph +% ---------- for array.sty -------------- +\def\arraybackslash{\let\\=\@arraycr} +\newcolumntype{P}[1]{>{\raggedright\arraybackslash}p{#1}} +\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}} +% ----------- harvard-style citations ------------------ +\def\@cite#1#2{{#1\if@tempswa , #2\fi}} +\def\ETAL{{\em et al\/}}% + +\def\@citex[#1]#2{\if@filesw\immediate\write\@auxout{\string\citation{#2}}\fi + \def\@citea{}\@cite{\@for\@citeb:=#2\do + {\@citea\def\@citea{; }\@ifundefined + {b@\@citeb}{$\underline{\mbox{\@citeb}}$\@warning + {Citation `\@citeb' on page \thepage \space undefined}}% +{\csname b@\@citeb\endcsname}}}{#1}}% +% label for a bibliography citation not produced + \def\@biblabel#1{\hfill} + +% with page or fig no +\def\Cite#1#2{\cite[#2]{#1}}% +% year only, with page or fig no +\def\Yearcite#1#2{\yearcite[#2]{#1}}% +\let\@internalcite\cite +\def\cite{\def\citename##1{##1}\@internalcite}% +% \yearcite gives only the date +\def\yearcite{\def\citename##1{}\@internalcite}% +% +\def\endPSExample{% + \EndExample +\VerbatimInput[gobble=0,fontsize=\small, +% frame=topline, +framerule=1.5pt]{\EXdir\theeps@counter}% +\begin{center} + \ifgrid\vskip 8pt \fi + \expandafter\pspicture\PictureSize + \ifgrid\usergrid\else\relax\fi + \input{\EXdir\theeps@counter} + \endpspicture + \ifgrid\vskip 8pt \fi + \EndRuleExample +\end{center} + }% +\renewenvironment{example**}% +{\def\Write@Ex##1{}\BeginExample}% +{% +\EndExample +\VerbatimInput[gobble=0,fontsize=\small, + %frame=topline, +framerule=1.5pt]{\EXdir\theeps@counter}% +\begin{center} +\input{\EXdir\theeps@counter} + \EndRuleExample +\end{center} +} +\def\Lenv#1{\texttt{#1}} +\newcolumntype{H}[1]{>{\raggedright\hangindent=.5em\arraybackslash}p{#1}} +\def\Figword{Fig.~} +\endinput diff --git a/usergrps/uktug/baskervi/6_2/spqr/textpath.pro b/usergrps/uktug/baskervi/6_2/spqr/textpath.pro new file mode 100644 index 0000000000..84014b226d --- /dev/null +++ b/usergrps/uktug/baskervi/6_2/spqr/textpath.pro @@ -0,0 +1,99 @@ +%! +% PostScript header file textpath.pro +% For putting text along curve with textpath.tex and PSTricks +% Version: 0.93b, for use with PSTricks v0.93a. +% Date: 94/04/20 +% For copying restrictions, see pstricks.doc or pstricks.tex. + +/tx@TextPathDict 40 dict def +tx@TextPathDict begin + +% Syntax: PathPosition - +% Function: Searches for position of currentpath distance from +% beginning. Sets (X,Y)=position, and Angle=tangent. +/PathPosition +{ /targetdist exch def + /pathdist 0 def + /continue true def + /X { newx } def /Y { newy } def /Angle 0 def + gsave + flattenpath + { movetoproc } { linetoproc } { } { firstx firsty linetoproc } + /pathforall load stopped { pop pop pop pop /X 0 def /Y 0 def } if + grestore +} def + +/movetoproc { continue { @movetoproc } { pop pop } ifelse } def + +/@movetoproc +{ /newy exch def /newx exch def + /firstx newx def /firsty newy def +} def + +/linetoproc { continue { @linetoproc } { pop pop } ifelse } def + +/@linetoproc +{ + /oldx newx def /oldy newy def + /newy exch def /newx exch def + /dx newx oldx sub def + /dy newy oldy sub def + /dist dx dup mul dy dup mul add sqrt def + /pathdist pathdist dist add def + pathdist targetdist ge + { pathdist targetdist sub dist div dup + dy mul neg newy add /Y exch def + dx mul neg newx add /X exch def + /Angle dy dx atan def + /continue false def + } if +} def + +/TextPathShow +{ /String exch def + /CharCount 0 def + String length + { String CharCount 1 getinterval ShowChar + /CharCount CharCount 1 add def + } repeat +} def + +% Syntax: InitTextPath - +/InitTextPath +{ gsave + currentpoint /Y exch def /X exch def + exch X Hoffset sub sub mul + Voffset Hoffset sub add + neg X add /Hoffset exch def + /Voffset Y def + grestore +} def + +/Transform +{ PathPosition + dup + Angle cos mul Y add exch + Angle sin mul neg X add exch + translate + Angle rotate +} def + +/ShowChar +{ /Char exch def + gsave + Char end stringwidth + tx@TextPathDict begin + 2 div /Sy exch def 2 div /Sx exch def + currentpoint + Voffset sub Sy add exch + Hoffset sub Sx add + Transform + Sx neg Sy neg moveto + Char end tx@TextPathSavedShow + tx@TextPathDict begin + grestore + Sx 2 mul Sy 2 mul rmoveto +} def + +end +% End textpath.pro diff --git a/usergrps/uktug/baskervi/6_2/spqr/textpath.sty b/usergrps/uktug/baskervi/6_2/spqr/textpath.sty new file mode 100644 index 0000000000..85d8b533f9 --- /dev/null +++ b/usergrps/uktug/baskervi/6_2/spqr/textpath.sty @@ -0,0 +1,4 @@ +%% BEGIN: textpath.sty +\input textpath.tex +\endinput +%% END: textpath.sty diff --git a/usergrps/uktug/baskervi/6_2/spqr/textpath.tex b/usergrps/uktug/baskervi/6_2/spqr/textpath.tex new file mode 100644 index 0000000000..8a5bd73e47 --- /dev/null +++ b/usergrps/uktug/baskervi/6_2/spqr/textpath.tex @@ -0,0 +1,97 @@ +%% BEGIN textpath.tex/textpath.sty +%% +%% For placing text on a path with PSTricks. +%% +\def\fileversion{0.93b} % For use with PSTricks v0.93a. +\def\filedate{94/04/20} +%% +%% COPYRIGHT 1993, by Timothy Van Zandt, tvz@Princeton.EDU +%% See pstricks.tex or pstricks.doc for copying restrictions. +%% +%% See the PSTricks User's Guide for description. +%% See tp-test.tex for sample input. +%% See tp-test.ps for sample output. +%% +%% This uses the header file textpath.ps. + +\message{ v\fileversion, \filedate} + +\csname PSTextPathLoaded\endcsname +\let\PSTextPathLoaded\endinput + +\ifx\PSTricksLoaded\endinput\else + \def\next{\input pstricks.tex}\expandafter\next +\fi + +\edef\TheAtCode{\the\catcode`\@} +\catcode`\@=11 + +\pstheader{textpath.pro} + +\def\pstextpath{\@ifnextchar[{\pstextpath@}{\pstextpath@[l]}} +\def\pstextpath@[#1]{% + \@ifnextchar({\pstextpath@@[#1]}{\pstextpath@@[#1](0,\TPoffset)}} +\def\pstextpath@@[#1](#2)#3{\pst@makebox{\pstextpath@@@[#1](#2){#3}}} +\def\pstextpath@@@[#1](#2,#3)#4{% + \pst@killglue + \begingroup + \ifx c#1\relax + \def\pst@tempa{.5}% + \else + \ifx r#1\relax + \def\pst@tempa{1}% + \else + \def\pst@tempa{0}% + \fi + \fi + \def\use@pscode{% + \pst@Verb{% + /mtrxc CM def + \tx@STV + CP translate + newpath + \pst@code\space + mtrxc setmatrix + 0 setgray}% + \gdef\pst@code{}}% + \def\psclip#1{\pst@misplaced\psclip}% + \let\endpsclip\relax + \def\@multips(##1)(##2)##3##4{\pst@misplaced\multips}% + \def\nc@object##1##2##3##4{\pst@misplaced{node connection}}% + \def\PSTtoEPS@i##1##2{\pst@misplaced\PSTtoEPS}% + \pssetlength\pst@dima{#2}% + \pssetlength\pst@dimb{#3}% + \setbox\pst@hbox\hbox{% + \hbox to\z@{% + \kern -\wd\pst@hbox + % BoxWidth = CurrX - Hoffset. + \pstVerb{tx@TextPathDict begin + currentpoint pop /Hoffset exch def end}% + \kern\pst@dima + % XOffset = Voffset - Hoffset (extra horizontal skip) + \pstVerb{tx@TextPathDict begin + currentpoint pop /Voffset exch def end}% + \hss + \pstVerb{% + /tx@TextPathSavedShow /show load def + \pst@dict \tx@PathLength end + dup 0 gt + { tx@TextPathDict begin \pst@tempa\space InitTextPath end + /show { tx@TextPathDict begin TextPathShow end } def + } + { pop } + ifelse}}% + \raise\pst@dimb\box\pst@hbox + \pstVerb{% + currentpoint newpath moveto + /show /tx@TextPathSavedShow load def}}% + \wd\pst@hbox=\z@ \dp\pst@hbox=\z@ \ht\pst@hbox=\z@ + \leavevmode + \hbox{{#4}\box\pst@hbox}% + \endgroup\ignorespaces} +\def\TPoffset{-.7ex} + +\catcode`\@=\TheAtCode\relax + +\endinput +%% END textpath.tex/textpath.sty -- cgit v1.2.3