]> hackdaworld.org Git - lectures/latex.git/commitdiff
ablaufschema part1 added, added graphs stuff
authorhackbard <hackbard>
Mon, 4 Aug 2003 13:08:12 +0000 (13:08 +0000)
committerhackbard <hackbard>
Mon, 4 Aug 2003 13:08:12 +0000 (13:08 +0000)
nlsop/graphs.header [new file with mode: 0644]
nlsop/graphs.sty [new file with mode: 0644]
nlsop/graphs_config.tex [new file with mode: 0644]
nlsop/graphs_ps.tex [new file with mode: 0644]
nlsop/nlsop_fb_bericht.tex

diff --git a/nlsop/graphs.header b/nlsop/graphs.header
new file mode 100644 (file)
index 0000000..64fa43f
--- /dev/null
@@ -0,0 +1,620 @@
+% Postscript header file for version 1.53 of graphs.sty. Frank Drewes, 19.12.2000
+% Small bug in psdirbowoncircle and psdirbowonrectangle removed on 8. Dec. 97
+% (hopefully)
+
+/psloadcolour % [ r g b ] colour array
+{ aload pop setrgbcolor } def
+
+/psrectangle % width, height, interior color, linecolour, linewidth, linedash
+{/filled exch def
+0 setdash
+/lwidth exch def
+/lcolour exch def 
+/colour exch def
+/height exch def
+/width exch def
+width lwidth gt
+  {/width width lwidth sub def}
+  {/width 0 def}
+ifelse
+height lwidth gt
+  {/height height lwidth sub def}
+  {/height 0 def}
+ifelse
+newpath
+width 2 div neg height 2 div neg moveto
+width 0 rlineto
+0 height rlineto
+width neg 0 rlineto
+closepath
+filled {
+  colour psloadcolour
+  gsave
+  fill
+  grestore
+} if
+lcolour psloadcolour
+lwidth setlinewidth
+stroke} def
+
+%-----------------------------------------------------------------------------%
+
+/pscircle % diameter, interior color, line colour, line width, line dash
+{/filled exch def
+0 setdash
+/lwidth exch def
+/lcolour exch def
+/colour exch def
+/diam exch def
+diam lwidth gt
+  {/diam diam lwidth sub def}
+  {/diam 0 def}
+ifelse
+newpath
+diam 2 div 0 moveto
+0 0 diam 2 div 0 360 arc
+closepath
+filled {
+  colour psloadcolour
+  gsave
+  fill
+  grestore
+} if
+lcolour psloadcolour
+lwidth setlinewidth
+stroke} def
+
+%-----------------------------------------------------------------------------%
+
+/psline % end x, end y, line width, line colour, line dash
+{0 setdash
+psloadcolour
+setlinewidth
+/endy exch def
+/endx exch def
+newpath
+0 0 moveto
+endx endy lineto
+stroke} def
+
+%-----------------------------------------------------------------------------%
+
+/psloop % from (#1,#2) to (#3,#4), line colour, line width, line dash
+{0 setdash
+setlinewidth
+psloadcolour
+/varw exch def
+/varv exch def
+/vary exch def
+/varx exch def
+newpath 0 0 moveto
+varx vary lineto
+/varxb varx 2 mul def
+/varyb vary 2 mul def
+/varvb varv 2 mul def
+/varwb varw 2 mul def
+varxb varyb varvb varwb varv varw curveto
+closepath
+stroke} def
+
+%-----------------------------------------------------------------------------%
+
+/psloopbyangle % angle #1, axis (#2,#3), line colour, line width, line dash
+{/axisY exch def
+/axisX exch def
+/alpha exch def
+/len axisX dup mul axisY dup mul add sqrt def
+/betaA axisY axisX atan alpha 2 div sub def
+/betaB betaA alpha add def
+len betaA cos mul len betaA sin mul
+len betaB cos mul len betaB sin mul} def
+
+%-----------------------------------------------------------------------------%
+
+/pslooparrowonrectangle % (#1,#2), (#3,#4), width, height, line colour,
+                        % line width, line dash, arrow length, arrow width
+{/atype exch def
+/awid exch def
+/len exch def
+0 setdash
+setlinewidth
+psloadcolour
+/height exch def
+/width exch def
+/varw exch def
+/varv exch def
+/vary exch def
+/varx exch def
+newpath 0 0 moveto
+varx vary lineto
+/varxb varx 2 mul def
+/varyb vary 2 mul def
+/varvb varv 2 mul def
+/varwb varw 2 mul def
+varxb varyb varvb varwb varv varw curveto
+varv varw translate
+/varv varv neg def /varw varw neg def
+varv abs varw abs
+varv abs varw abs gt { exch } if
+div dup mul 1 add width height mul mul sqrt 2 div /dist exch def
+/getlen {
+       /size exch def
+       abs exch abs exch
+       div dup mul 1 add size dup mul mul sqrt 2 div
+} def
+varv 0 eq
+       {/dist height 2 div def}
+       {varw 0 eq
+               {/dist width 2 div def}
+               {
+               /fstdist varv varw height getlen def
+               /snddist varw varv width getlen def
+               fstdist snddist lt
+                       {/dist fstdist def} {/dist snddist def} ifelse
+               } ifelse
+       } ifelse
+varw varv atan rotate
+/pos varv dup mul varw dup mul add sqrt dist sub def
+pos len sub 0 lineto
+stroke
+pos len awid atype psdrawarrow
+} def
+
+%-----------------------------------------------------------------------------%
+
+/pslooparrowoncircle % (#1,#2), (#3,#4), diameter, line colour, line width,
+                     % line dash, arrow length, arrow width
+{/atype exch def
+/awid exch def
+/len exch def
+0 setdash
+setlinewidth
+psloadcolour
+/diam exch def
+/varw exch def
+/varv exch def
+/vary exch def
+/varx exch def
+newpath 0 0 moveto
+varx vary lineto
+/varxb varx 2 mul def
+/varyb vary 2 mul def
+/varvb varv 2 mul def
+/varwb varw 2 mul def
+varxb varyb varvb varwb varv varw curveto
+varv varw translate
+/varv varv neg def /varw varw neg def
+varw varv atan rotate
+/pos varv dup mul varw dup mul add sqrt diam 2 div sub def
+pos len sub 0 lineto
+stroke
+pos len awid atype psdrawarrow
+} def
+
+%-----------------------------------------------------------------------------%
+
+/psdeletebox % width, height
+{/height exch def
+/width exch def
+newpath
+width 2 div neg height 2 div neg moveto
+width 0 rlineto
+0 height rlineto
+width neg 0 rlineto
+closepath
+1 setgray
+fill} def
+
+%-----------------------------------------------------------------------------%
+
+/psarrowonrectangle % x, y, width, height, arrow length, arrow width,
+                   % line colour, line width, dash array
+{0 setdash
+setlinewidth
+psloadcolour
+/atype exch def
+/awid exch def
+/len exch def
+/height exch def
+/width exch def
+/ypos exch def
+/xpos exch def
+/getlen {
+       /size exch def
+       abs exch abs exch
+       div dup mul 1 add size dup mul mul sqrt 2 div
+} def
+xpos 0 eq
+       {/dist height 2 div def}
+       {ypos 0 eq
+               {/dist width 2 div def}
+               {
+               /fstdist xpos ypos height getlen def
+               /snddist ypos xpos width getlen def
+               fstdist snddist lt
+                       {/dist fstdist def} {/dist snddist def} ifelse
+               } ifelse
+       } ifelse
+ypos xpos atan rotate
+/pos xpos dup mul ypos dup mul add sqrt dist sub def
+pos len awid atype psdrawarrow
+0 0 moveto
+pos len sub 0 lineto
+stroke} def
+
+%-----------------------------------------------------------------------------%
+
+/psarrowoncircle
+{0 setdash
+setlinewidth
+psloadcolour
+/atype exch def
+/awid exch def
+/len exch def
+/diam exch def
+/ypos exch def
+/xpos exch def
+ypos xpos atan rotate
+/pos xpos dup mul ypos dup mul add sqrt diam 2 div sub def
+pos len awid atype psdrawarrow
+0 0 moveto
+pos len sub 0 lineto
+stroke} def
+
+%-----------------------------------------------------------------------------%
+
+/pspath
+{/fillyes exch def
+/fillcolour exch def
+0 setdash
+psloadcolour
+setlinewidth
+/curry exch def
+/currx exch def
+/sqr { dup mul } def
+/mtrx matrix currentmatrix def
+newpath currx curry moveto
+counttomark 3 idiv
+{      /displace exch def
+       displace abs 0 gt
+       {       currx curry translate
+               dup curry sub /ypos exch def /curry exch def
+               dup currx sub /xpos exch def /currx exch def
+               /len xpos sqr ypos sqr add sqrt def
+               /displace displace len mul def
+               ypos xpos atan rotate
+               /db len 2 div def
+               /rad displace db sqr displace div add 2 div def
+               /radb rad displace sub def
+               /anglea radb db atan def
+               /angleb 180 anglea sub def
+               displace 0 gt
+                       { db radb neg rad angleb anglea arcn }
+                       { db radb neg rad 360 anglea sub angleb neg arc }
+               ifelse
+               mtrx setmatrix
+       }
+       {       /curry exch def
+               /currx exch def
+               currx curry lineto
+       }
+       ifelse
+}
+repeat
+pop
+fillyes {gsave fillcolour psloadcolour fill grestore} if
+0 setlinecap
+0 setlinejoin
+stroke
+} def
+
+%-----------------------------------------------------------------------------%
+
+/pscurve
+{/fillyes exch def
+/fillcolour exch def
+0 setdash
+psloadcolour
+setlinewidth
+/currx exch def
+/curry exch def
+/angle exch def
+/factora exch def
+/factorb exch def
+newpath currx curry moveto
+counttomark 5 idiv
+{      /newx exch def
+       /newy exch def
+       /len newx currx sub dup mul newy curry sub dup mul add sqrt def
+       /firstx len factora mul angle cos mul currx add def
+       /firsty len factora mul angle sin mul curry add def
+       /currx newx def
+       /curry newy def
+       /angle exch def
+       firstx
+       firsty
+       len factorb mul angle cos mul neg currx add
+       len factorb mul angle sin mul neg curry add
+       currx
+       curry
+       curveto
+       /factora exch def
+       /factorb exch def
+}
+repeat
+pop
+fillyes {gsave fillcolour psloadcolour fill grestore} if
+0 setlinecap
+0 setlinejoin
+stroke
+} def
+
+%-----------------------------------------------------------------------------%
+
+/psbubble
+{/fillyes exch def
+/fillcolour exch def
+0 setdash
+psloadcolour
+setlinewidth
+/lenfactor exch def
+/fetch {/arg exch def dup arg exch def counttomark 1 roll} def
+/compangle {
+       /firstangle exch def
+       /scndangle exch def
+       firstangle sin scndangle sin add 2 div
+       firstangle cos scndangle cos add 2 div
+       atan
+} def
+/currax fetch
+/curray fetch
+counttomark 2 idiv
+{
+/currbx exch def
+/currby exch def
+currax currbx ne curray currby ne or
+       {currby currbx /currax fetch /curray fetch}
+if
+}
+repeat
+/lastx fetch
+/lasty fetch
+/currax fetch
+/curray fetch
+/currbx fetch
+/currby fetch
+newpath currax curray moveto
+counttomark 2 idiv
+{      /nextx fetch
+       /nexty fetch
+       /fstangle
+               curray lasty sub currax lastx sub atan
+               currby curray sub currbx currax sub atan
+               compangle
+       def
+       /sndangle
+               currby curray sub currbx currax sub atan
+               nexty currby sub nextx currbx sub atan
+               compangle
+       def
+       /len currax currbx sub dup mul curray currby sub dup mul add sqrt lenfactor mul def
+       fstangle cos len mul currax add
+       fstangle sin len mul curray add
+       currbx sndangle cos len mul sub
+       currby sndangle sin len mul sub
+       currbx currby
+       curveto
+       /lastx currax def
+       /lasty curray def
+       /currax currbx def
+       /curray currby def
+       /currbx nextx def
+       /currby nexty def
+}
+repeat
+pop
+fillyes {gsave fillcolour psloadcolour fill grestore} if
+0 setlinecap
+0 setlinejoin
+stroke
+} def
+
+%-----------------------------------------------------------------------------%
+
+/psdrawarrow
+{gsave
+/type exch def
+/wid exch def
+/len exch def
+0 translate -1 1 scale
+newpath 0 0 moveto
+type 1 eq
+{      len len wid 2 div mul lineto
+       0 len wid neg mul rlineto}
+{      /mid len 2 div def
+       0 0
+       mid 0
+       len len wid 2 div mul curveto
+       len len wid -2 div mul lineto
+       mid 0
+       0 0
+       0 0 curveto
+} ifelse
+closepath
+fill
+grestore
+} def
+
+%-----------------------------------------------------------------------------%
+
+/psdirbowoncircle
+{0 setdash
+psloadcolour
+setlinewidth
+/atype exch def
+/awid exch def
+/arrowlen exch def
+2 div /targetradius exch def
+/displace exch def
+/othery exch def
+/otherx exch def
+/curry exch def
+/currx exch def
+/sqr { dup mul } def
+
+currx curry translate
+othery curry sub /othery exch def
+otherx currx sub /otherx exch def
+/angle otherx neg othery atan def
+/distance otherx sqr othery sqr add sqrt def
+/displace displace distance mul def
+/radius displace distance 2 div sqr displace div add 2 div def
+/centerx angle cos radius displace sub mul otherx 2 div add def
+/centery angle sin radius displace sub mul othery 2 div add def
+displace 0 gt
+{ /anglea othery centery sub otherx centerx sub atan def
+  /angleb centery neg centerx neg atan def
+  angleb anglea lt
+  { /anglea anglea 360 sub def }
+  if
+}
+{ /anglea centery othery sub centerx otherx sub atan def
+  /angleb centery centerx atan def
+  angleb anglea gt
+  { /anglea anglea 360 add def }
+  if
+}
+ifelse
+
+anglea angleb targetradius pscomputeposoncircle
+/tipy exch def /tipx exch def
+anglea angleb targetradius arrowlen add pscomputeposoncircle
+/taily exch def /tailx exch def
+
+newpath 0 0 moveto
+0 setlinecap
+0 setlinejoin
+displace 0 gt
+{ centerx centery radius angleb taily centery sub tailx centerx sub atan arcn }
+{ centerx centery radius angleb centery taily sub centerx tailx sub atan arc }
+ifelse
+stroke
+
+tailx taily translate
+/tipx tipx tailx sub def
+/tipy tipy taily sub def
+tipy tipx atan rotate
+arrowlen arrowlen awid atype psdrawarrow
+} def
+
+/pscomputeposoncircle
+{/otherr exch def
+/beta exch def
+/alpha exch def
+{
+  /currangle alpha beta add 2 div def
+  /xpos currangle cos radius mul centerx add def
+  /ypos currangle sin radius mul centery add def
+    otherx xpos sub sqr othery ypos sub sqr add sqrt
+    /newdist exch def
+  newdist otherr sub abs .001 le
+  {exit}
+  if
+  newdist otherr le
+  {/alpha currangle def}
+  {/beta currangle def}
+  ifelse
+} loop
+currangle cos radius mul centerx add
+currangle sin radius mul centery add
+} def
+
+
+%-----------------------------------------------------------------------------%
+
+/psdirbowonrectangle
+{0 setdash
+psloadcolour
+setlinewidth
+/atype exch def
+/awid exch def
+/arrowlen exch def
+2 div /sizey exch def
+2 div /sizex exch def
+/displace exch def
+/othery exch def
+/otherx exch def
+/curry exch def
+/currx exch def
+/sqr { dup mul } def
+
+currx curry translate
+othery curry sub /othery exch def
+otherx currx sub /otherx exch def
+/angle otherx neg othery atan def
+/distance otherx sqr othery sqr add sqrt def
+/displace displace distance mul def
+/radius displace distance 2 div sqr displace div add 2 div def
+/centerx angle cos radius displace sub mul otherx 2 div add def
+/centery angle sin radius displace sub mul othery 2 div add def
+displace 0 gt
+{ /anglea othery centery sub otherx centerx sub atan def
+  /angleb centery neg centerx neg atan def
+  angleb anglea lt
+  { /anglea anglea 360 sub def }
+  if
+}
+{ /anglea centery othery sub centerx otherx sub atan def
+  /angleb centery centerx atan def
+  angleb anglea gt
+  { /anglea anglea 360 add def }
+  if
+}
+ifelse
+
+anglea angleb pscomputeposonrectangle /tipy exch def /tipx exch def
+/targetradius otherx tipx sub sqr othery tipy sub sqr add sqrt def
+anglea angleb targetradius arrowlen add pscomputeposoncircle
+/taily exch def /tailx exch def
+
+newpath 0 0 moveto
+0 setlinecap
+0 setlinejoin
+displace 0 gt
+{ centerx centery radius angleb taily centery sub tailx centerx sub atan arcn }
+{ centerx centery radius angleb centery taily sub centerx tailx sub atan arc }
+ifelse
+stroke
+
+tailx taily translate
+/tipx tipx tailx sub def
+/tipy tipy taily sub def
+tipy tipx atan rotate
+arrowlen arrowlen awid atype psdrawarrow
+} def
+
+/pscomputeposonrectangle
+{/beta exch def
+/alpha exch def
+/counter 0 def
+{
+  /currangle alpha beta add 2 div def
+  /xpos currangle cos radius mul centerx add def
+  /ypos currangle sin radius mul centery add def
+  /xdiff xpos otherx sub abs sizex sub def
+  /ydiff ypos othery sub abs sizey sub def
+  xdiff abs .001 le ydiff abs .001 le and
+   xdiff abs .001 le ydiff 0 le and
+   xdiff 0 le ydiff  abs .001 le and
+   or
+  {exit}
+  if
+  /counter counter 1 add def
+  xdiff 0 le ydiff 0 le and
+  {/alpha currangle def}
+  {/beta currangle def}
+  ifelse
+} loop
+currangle cos radius mul centerx add
+currangle sin radius mul centery add
+} def
diff --git a/nlsop/graphs.sty b/nlsop/graphs.sty
new file mode 100644 (file)
index 0000000..28d4c65
--- /dev/null
@@ -0,0 +1,1335 @@
+\ProvidesPackage{graphs}[2000/12/19]
+%
+%
+%_________________________________________________________________%%
+% Draw graphs only if this is set to TRUE:
+%_________________________________________________________________%%
+%
+\newif\ifdrawgraphs
+\drawgraphstrue
+
+\DeclareOption{draft}{\drawgraphsfalse}
+\ProcessOptions
+
+\typeout{}
+\typeout{LaTeX2e package `graphs', version 1.53}
+\typeout{Frank Drewes, University of Bremen, 19.12.2000}
+\typeout{}
+
+%
+% \input the low-level commands that produce PostScript \special's.
+%
+\input{graphs_ps}
+%
+% \input the local configuration.
+%
+\input{graphs_config}
+%
+%
+%_________________________________________________________________%%
+% Initial value of \unitlength:
+%
+\newdimen\g@oldunitlength
+\unitlength=1cm
+%
+%
+%_________________________________________________________________%%
+% Global settings and macros to change them (all lengths are numbers
+% interpreted as multiples of \unitlength, except for the ones in
+% \graphlinedash):
+%
+% - \graphlinewidth    define the width of lines (relevant
+%                      for nodes and edges)
+% - \graphlinedash     define the dash style of lines; the argument
+%                      is a sequence of natural numbers delimited by
+%                      blanks (relevant for nodes and edges). Is
+%                      taken as input to the postscript setdash
+%                      command.
+% - \graphnodesize     define the size (= diameter) of nodes
+% - \graphnodecolour   define the interior shading of nodes (a
+%                      number between 0 (= black) and 1 (= white))
+% - \fillednodestrue
+%   \fillednodesfalse  determine whether the interior of nodes shall be
+%                       filled or not
+% - \graphlinecolour   define the `colour' of edges; similar to
+%                      \graphnodecolour
+% - \grapharrowlength  define the length from tip to basis of a
+%                      directed edge's arrow head
+% - \grapharrowwidth   define the width of the basis of a
+%                      directed edge's arrow head (in multiples of
+%                      \grapharrowlength)
+% - \grapharrowtype    define the type of the arrow heads (argument
+%                      should be 1 or 2)
+% - \autodistance      define the factor that defines the distance
+%                      of automatically placed text boxes from the
+%                      centre of a node (1 means "placed on the
+%                      edge").
+% - \enlargeboxes      define the length that is added to
+%                      text boxes (in x and y direction) in order
+%                      to determine the size of the necessary
+%                      white area underlying it.
+% - \opaquetexttrue
+%   \opaquetextfalse   determine whether text boxes shall be considered
+%                      opaque or transparent (In the latter case
+%                      \enlargeboxes doesn't have a (visible)
+%                      effect.) Its initial value is true except
+%                      for \autonodetext, which always has it set
+%                      to false if it's not changed explicitely
+%                      through the optional parameter. 
+% - \filledareastrue
+%   \filledareasfalse  determine whether areas shall be filled or not
+%
+% - \graphfillcolour   define the fill colour of areas (if filled
+%                      at all).
+%                      
+%_________________________________________________________________%%
+%
+\def\g@defrel#1*#2{\edef#1{#1\ps@s #2 0 ge {#2 mul} if}}
+\def\g@defplus#1+#2{\edef#1{
+       #1\ps@s
+       #2 1 gt
+       {1 exch sub #2 div 1 exch sub}
+       {#2 0 ge {#2 mul} if}
+       ifelse}}
+\def\g@defcolplus#1+#2{\edef#1{
+       #1
+       3 {
+           3 1 roll
+           #2 1 gt
+           {1 exch sub #2 div 1 exch sub}
+           {#2 0 ge {#2 mul} if}
+           ifelse
+         }
+       repeat
+}}
+\def\g@defabs#1#2#3{\def#1{#3}\def#2{}}
+\def\g@defcolabs#1#2{%
+       \@ifnextchar({\g@defcolabsrgb{#1}{#2}}{\g@defcolabsbw{#1}{#2}}%
+}
+\def\g@defcolabsbw#1#2#3{\def#1{#3\ps@s #3\ps@s #3}\def#2{}}
+\def\g@defcolabsrgb#1#2(#3,#4,#5){\def#1{#3\ps@s #4\ps@s #5}\def#2{}}
+%
+\def\graphlinewidth{%
+       \@ifnextchar*{\g@defrel{\g@lwidthmod}}%
+                       {\g@defabs{\g@lwidth}{\g@lwidthmod}}}
+\graphlinewidth{.02}
+%
+\def\graphlinedash#1{\def\g@ldash{[ #1 ]}}
+\graphlinedash{}
+%
+\def\graphnodesize#1{\def\g@nsize{#1}}
+\graphnodesize{.2}
+%
+\def\graphnodecolour{%
+       \@ifnextchar+{\g@defcolplus{\g@ncolourmod}}%
+                       {\g@defcolabs{\g@ncolour}{\g@ncolourmod}}}
+\graphnodecolour{0}
+%
+\newif\iffillednodes\fillednodestrue
+%
+\def\graphlinecolour{%
+       \@ifnextchar+{\g@defcolplus{\g@lcolourmod}}%
+                       {\g@defcolabs{\g@lcolour}{\g@lcolourmod}}}
+\graphlinecolour{0}
+%
+\def\grapharrowlength{%
+       \@ifnextchar*{\g@defrel{\g@alengthmod}}%
+                       {\g@defabs{\g@alength}{\g@alengthmod}}}
+\grapharrowlength{.3}
+%
+\def\grapharrowwidth{%
+       \@ifnextchar*{\g@defrel{\g@awidthmod}}%
+                       {\g@defabs{\g@awidth}{\g@awidthmod}}}
+\grapharrowwidth{.5}
+%
+\def\grapharrowtype#1{\def\g@atype{#1}}
+\grapharrowtype{1}
+%
+\def\autodistance#1{\def\g@autodistance{#1}}
+\autodistance{1.3}
+%
+\def\enlargeboxes#1{\def\g@eboxes{#1}}
+\enlargeboxes{.1}
+%
+\newif\ifopaquetext\opaquetexttrue
+%
+\newif\iffilledareas\filledareastrue
+%
+\def\graphfillcolour{%
+       \@ifnextchar+{\g@defcolplus{\g@fcolourmod}}%
+                       {\g@defcolabs{\g@fcolour}{\g@fcolourmod}}}
+\graphfillcolour{.5}
+%
+%
+%_________________________________________________________________%%
+% Issue a warning if a command name defined in graphs.sty already has
+% a meaning.
+%_________________________________________________________________%%
+%
+\def\g@test#1{
+       \@ifundefined{#1}{}{
+         \typeout{}
+         \typeout{Warning: command name `#1' already used;
+               redefined in graphs.sty!}
+         \typeout{}
+       }
+}
+%
+%
+%_________________________________________________________________%%
+% This is the environment in which the macros above can be used.
+%
+% Arguments:
+%
+% As for the LaTeX picture environment, i.e., it starts with
+% \begin{graph}(x,y)(dx,dy) (where the second pair is optional) and
+% ends with \end{graph}.
+%
+% Remark:
+%
+% The graph enviroment is imlemented on the basis of the picture
+% environment. As a result, all commands allowed in pictures may be
+% used (in addition to the graph commands). The picture commands'
+% effects will always take place first, so subsequent AS WELL AS
+% PRECEEDING graph commands will overlay the ordinary LaTeX
+% picture. (This is one reason why a command like \freetext is NOT
+% useless: its effect takes place after nodes and edges have been
+% drawn.)
+%_________________________________________________________________%%
+%
+\g@test{graph}\g@test{framegraph}
+\def\framegraph(#1){\@ifnextchar({\g@graph f(#1)}{\g@graph f(#1)(0,0)}}
+\def\graph(#1){\@ifnextchar({\g@graph n(#1)}{\g@graph n(#1)(0,0)}}
+\def\g@graph#1(#2)(#3){%
+       \begin{picture}(#2)(#3)%
+       \if #1f%
+         \put(#3){\framebox(#2){}}%
+       \fi%
+       \ifdrawgraphs\else%
+         \put(#3){\framebox(#2){graph}}%
+       \fi%
+       \def\g@nodeinfo{}\def\g@specialeffects{}\def\g@nodes{}\def\g@texts{}%
+       \def\g@edges{}%
+}
+\def\endgraph{%
+       \ifdrawgraphs
+         \g@nodeinfo\g@specialeffects\g@edges\g@nodes\g@texts%
+       \fi%
+       \end{picture}%
+}
+\def\endframegraph{\endgraph}
+%
+%
+%_________________________________________________________________%%
+% Types of nodes
+%_________________________________________________________________%%
+%
+\def\g@circletype{0}
+\def\g@rectangletype{1}
+%
+%
+%_________________________________________________________________%%
+% Definition of square nodes:
+%
+% Arguments:
+%
+% Nodename (a character sequence like abc)
+% Position (x,y) = a pair of numbers
+%_________________________________________________________________%%
+%
+\g@test{squarenode}
+\def\squarenode#1(#2,#3){
+       \@ifnextchar[{\g@squarenode{#1}(#2,#3)}{\g@squarenode{#1}(#2,#3)[]}
+}
+%
+\def\g@squarenode#1(#2,#3)[#4]{
+       \g@extendlist\g@nodeinfo{\g@node{#1}{\g@rectangletype}(#2,#3)[#4]}
+       \g@extendlist\g@nodes{\g@drawsquarenode{#1}(#2,#3)[#4]}
+}
+%
+% The actual drawing routine:
+%
+\def\g@drawsquarenode#1(#2,#3)[#4]{%
+       \edef\g@size{\g@thenodesize{#1}}%
+       {#4%
+       \put(#2,#3){\expandafter\ps@rectangle\g@size}%
+       }%
+}
+%
+%
+%_________________________________________________________________%%
+% Definition of round nodes:
+%
+% Arguments:
+%
+% Nodename (a character sequence like abc)
+% Position (x,y) = a pair of numbers
+%_________________________________________________________________%%
+%
+\g@test{roundnode}
+\def\roundnode#1(#2,#3){
+       \@ifnextchar[{\g@roundnode{#1}(#2,#3)}{\g@roundnode{#1}(#2,#3)[]}
+}
+%
+\def\g@roundnode#1(#2,#3)[#4]{
+       \g@extendlist\g@nodeinfo{\g@node{#1}{\g@circletype}(#2,#3)[#4]}
+       \g@extendlist\g@nodes{\g@drawroundnode{#1}(#2,#3)[#4]}
+}
+%
+% The actual drawing routine:
+%
+\def\g@drawroundnode#1(#2,#3)[#4]{%
+       \edef\g@size{\g@thenodesize{#1}}%
+       {#4%%
+       \put(#2,#3){\expandafter\ps@circle\g@size}%
+       }%
+}
+%
+%
+%_________________________________________________________________%%
+% Definition of rectangular nodes:
+%
+% Arguments:
+%
+% Nodename (a character sequence like abc)
+% Size [width,height] (in multiples of \unitlength)
+% Position (x,y) = a pair of numbers
+%_________________________________________________________________%%
+%
+\g@test{rectnode}
+\def\rectnode#1[#2,#3](#4,#5){
+       \@ifnextchar[{\g@rectnode{#1}[#2,#3](#4,#5)}%
+               {\g@rectnode{#1}[#2,#3](#4,#5)[]}
+}
+%
+\def\g@rectnode#1[#2,#3](#4,#5)[#6]{
+       \g@extendlist\g@nodeinfo{\g@noderect{#1}[#2,#3](#4,#5)}
+       \g@extendlist\g@nodes{\g@drawrectnode{#1}[#6]}
+}
+%
+% The actual drawing routine:
+%
+\def\g@drawrectnode#1[#2]{%
+       \edef\g@size{\g@thenodesize{#1}}%
+       \edef\g@coords{\g@nodecoords{#1}}%
+       {#2%
+       \expandafter\put\g@coords{\expandafter\ps@rectangle\g@size}%
+       }%
+}
+%
+%
+%_________________________________________________________________%%
+% Definition of text nodes (rectangular nodes whose dimension is
+% determined by the given text):
+%
+% Arguments:
+%
+% Nodename (a character sequence like abc)
+% Position (x,y) = a pair of numbers
+% Text (=anything that may occur as a \put argument in a picture
+%      environment, i.e., even lines, vectors, and so on.)
+%_________________________________________________________________%%
+%
+\g@test{textnode}
+\def\textnode#1(#2,#3)#4{
+       \@ifnextchar[{\g@textnode{#1}(#2,#3){#4}}%
+               {\g@textnode{#1}(#2,#3){#4}[]}
+}
+%
+\def\g@textnode#1(#2,#3)#4[#5]{
+       \autonodetext{#1}{#4}[#5]
+       \g@extendlist\g@nodeinfo{\g@nodebytext{#1}(#2,#3){#4}[#5]}
+       \g@extendlist\g@nodes{\g@drawrectnode{#1}%
+                                       [\graphnodecolour{1}#5]}
+}
+%
+%
+%_________________________________________________________________%%
+% Definition of an edge:
+%
+% Arguments:
+%
+% The two incident nodes
+%_________________________________________________________________%%
+%
+\g@test{edge}
+\def\edge#1#2{
+       \@ifnextchar[{\g@edge{#1}{#2}}{\g@edge{#1}{#2}[]}
+}
+%
+\def\g@edge#1#2[#3]{
+       \g@extendlist\g@edges{\g@drawedge{#1}{#2}[#3]}
+}
+%
+% The actual drawing routine:
+%
+\def\g@drawedge#1#2[#3]{%
+       \g@testname{#1}\g@testname{#2}%
+       \g@differentpositions{#1}{#2}{\edge{#1}{#2}}%
+       \edef\g@firstcoords{\g@nodecoords{#1}}%
+       \edef\g@secondcoords{\g@nodecoords{#2}}%
+       \g@defcoorddiff{\g@diffcoords}{\g@firstcoords}{\g@secondcoords}%
+       {#3%
+       \expandafter\put\g@firstcoords{\expandafter\ps@line\g@diffcoords}%
+       }%
+}
+%
+%
+%_________________________________________________________________%%
+% Definition of a directed edge:
+%
+% Arguments (same as for \edge):
+%
+% The two incident nodes (order indicates direction of the arrow)
+%_________________________________________________________________%%
+%
+\g@test{diredge}
+\def\diredge#1#2{
+       \@ifnextchar[{\g@diredge{#1}{#2}}{\g@diredge{#1}{#2}[]}
+}
+%
+\def\g@diredge#1#2[#3]{
+       \g@extendlist\g@edges{\g@drawdiredge{#1}{#2}[#3]}
+}
+%
+% The actual drawing routine:
+%
+\def\g@drawdiredge#1#2[#3]{%
+       \g@testname{#1}\g@testname{#2}%
+       \g@differentpositions{#1}{#2}{\diredge{#1}{#2}}%
+       \edef\g@firstcoords{\g@nodecoords{#1}}%
+       \edef\g@secondcoords{\g@nodecoords{#2}}%
+       \g@defcoorddiff{\g@diffcoords}{\g@firstcoords}{\g@secondcoords}%
+       %
+       % Choose the right drawing procedure, according to the node's type:
+       %
+       \edef\g@type{\g@nodetype{#2}}%
+       \ifnum\g@circletype=\g@type%
+         \let\g@draw=\ps@arrowoncircle%
+       \else%
+         \let\g@draw=\ps@arrowonrectangle%
+         \ifnum\g@rectangletype=\g@type%
+         \else%
+           \typeout{}%
+           \typeout{Error in \string\g@drawdiredge: unrecognized node type}%
+         \fi%
+       \fi%
+       %
+       % and draw it:
+       %
+       \edef\g@diffcoordsandsize{\g@diffcoords\g@thenodesize{#2}}%
+       {#3%
+       \expandafter\put\g@firstcoords{\expandafter\g@draw\g@diffcoordsandsize}%
+       }%
+}
+%
+%
+%_________________________________________________________________%%
+% Definition of a `bow' (a curved edge):
+%
+% Arguments:
+%
+% The two incident nodes
+% The displacement factor of the midpoint relative to the distance.
+%      of both nodes. A positive number means the bow extends 
+%      to the left (if one looks in the direction of the edge).
+%_________________________________________________________________%%
+%
+\g@test{bow}
+\def\bow#1#2#3{
+       \@ifnextchar[{\g@bow{#1}{#2}{#3}}{\g@bow{#1}{#2}{#3}[]}
+}
+%
+\def\g@bow#1#2#3[#4]{
+       \g@extendlist\g@edges{\g@drawbow{#1}{#2}{#3}[#4]}
+}
+%
+% The actual drawing routine:
+%
+\def\g@drawbow#1#2#3[#4]{%
+       \g@testname{#1}\g@testname{#2}%
+       \g@differentpositions{#1}{#2}{\bow{#1}{#2}...}%
+       \edef\g@firstcoords{\g@nodecoords{#1}}%
+       \edef\g@secondcoords{\g@nodecoords{#2}}%
+       \expandafter\g@bowcombine\g@secondcoords{#3}%
+       {#4%
+       \filledareasfalse%
+       \put(0,0){\expandafter\ps@path\g@combineresult}%
+       }%
+}
+%
+% Macro used above to combine coordinates of nodes and displacement:
+\def\g@bowcombine(#1,#2)#3{
+       \edef\g@combineresult{\g@firstcoords{(#1,#2,#3)}}
+}
+%
+%
+%_________________________________________________________________%%
+% Definition of a `directed bow' (a curved arrow):
+%
+% Arguments (same as for \bow):
+%
+% The two incident nodes
+% The displacement factor of the midpoint relative to the distance.
+%      of both nodes. A positive number means the bow extends 
+%      to the left (if one looks in the direction of the edge).
+%_________________________________________________________________%%
+%
+\g@test{dirbow}
+\def\dirbow#1#2#3{
+       \@ifnextchar[{\g@dirbow{#1}{#2}{#3}}{\g@dirbow{#1}{#2}{#3}[]}
+}
+%
+\def\g@dirbow#1#2#3[#4]{
+       \g@extendlist\g@edges{\g@drawdirbow{#1}{#2}{#3}[#4]}
+}
+%
+% The actual drawing routine:
+%
+\def\g@drawdirbow#1#2#3[#4]{
+       \g@testname{#1}\g@testname{#2}%
+       \g@differentpositions{#1}{#2}{\dirbow{#1}{#2}...}%
+       \edef\g@firstcoords{\g@nodecoords{#1}}%
+       \edef\g@secondcoordsandsize{\g@nodecoords{#2}\g@thenodesize{#2}}%
+       \expandafter\g@dirbowcombine\g@secondcoordsandsize{#3}%
+       %
+       % Choose the right drawing procedure, according to the node's type:
+       %
+       \edef\g@type{\g@nodetype{#2}}%
+       \ifnum\g@circletype=\g@type%
+         \let\g@draw=\ps@dirbowoncircle%
+       \else%
+         \let\g@draw=\ps@dirbowonrectangle%
+         \ifnum\g@rectangletype=\g@type%
+         \else%
+           \typeout{}%
+           \typeout{Error in \string\g@drawdirbow: unrecognized node type}%
+         \fi%
+       \fi%
+       %
+       % and draw it:
+       %
+       {#4%
+       \filledareasfalse%
+       \put(0,0){\expandafter\g@draw\g@combineresult}%
+       }%
+}
+%
+% Macro used above to combine coordinates of nodes and displacement:
+\def\g@dirbowcombine(#1,#2)[#3]#4{
+       \edef\g@combineresult{\g@firstcoords(#1,#2,#4)[#3]}
+}
+%
+%
+%_________________________________________________________________%%
+% Definition of a loop. There're two ways to provide this macro
+% with the necessary arguments. Here's the
+% first:
+%
+% Arguments:
+%
+% Node that carries the loop
+% Two relative coordinates (x1,y1) (x2,y2) indicating the lines from
+%      the incident node to (x1,y1) and (x2,y2) that form the loop
+%      together with a curve connecting (x1,y1) and (x2,y2).
+%_________________________________________________________________%%
+%
+\g@test{loopedge}
+\def\loopedge#1{
+       \@ifnextchar({\g@loopedgeA{#1}}{\g@loopedgeB{#1}}
+}
+%
+\def\g@loopedgeA#1(#2,#3)(#4,#5){
+       \@ifnextchar[{\g@loopedgeAa{#1}(#2,#3)(#4,#5)}%
+                       {\g@loopedgeAa{#1}(#2,#3)(#4,#5)[]}
+}
+%
+\def\g@loopedgeAa#1(#2,#3)(#4,#5)[#6]{
+       \g@extendlist\g@edges{\g@drawloopedgeA{#1}(#2,#3)(#4,#5)[#6]}
+}
+%
+% The actual drawing routine:
+%
+\def\g@drawloopedgeA#1(#2,#3)(#4,#5)[#6]{%
+       \g@testname{#1}%
+       \edef\g@coords{\g@nodecoords{#1}}%
+       {#6%
+       \expandafter\put\g@coords{%%
+         \ps@loopA(#2,#3)(#4,#5)}%
+       }%
+}
+%
+%
+%_________________________________________________________________%%
+% Definition of a loop - the second form:
+%
+% Arguments:
+%
+% Node that carries the loop
+% Angle the two lines defining the loop build
+% Coordinates (x,y) that give the axis along which the loop is
+% to be drawn and its length (ie, the length of the two lines 
+% defining the loop).
+%_________________________________________________________________%%
+%
+\def\g@loopedgeB#1#2(#3,#4){
+       \@ifnextchar[{\g@loopedgeBa{#1}{#2}(#3,#4)}%
+                       {\g@loopedgeBa{#1}{#2}(#3,#4)[]}
+}
+%
+\def\g@loopedgeBa#1#2(#3,#4)[#5]{
+       \g@extendlist\g@edges{\g@drawloopedgeB{#1}{#2}(#3,#4)[#5]}
+}
+%
+% The actual drawing routine:
+%
+\def\g@drawloopedgeB#1#2(#3,#4)[#5]{%
+       \g@testname{#1}%
+       \edef\g@coords{\g@nodecoords{#1}}%
+       {#5%
+       \expandafter\put\g@coords{%%
+         \ps@loopB{#2}(#3,#4)}%
+       }%
+}
+%
+%
+%_________________________________________________________________%%
+% Definition of a directed loop. There're two ways to provide
+% this macro with the necessary arguments. Here's the first:
+%
+% Arguments:
+%
+% Node that carries the loop
+% Two relative coordinates (x1,y1) (x2,y2) indicating the lines from
+%      the incident node to (x1,y1) and (x2,y2) that form the loop
+%      together with a curve connecting (x1,y1) and (x2,y2).
+%_________________________________________________________________%%
+%
+\g@test{dirloopedge}
+\def\dirloopedge#1{
+       \@ifnextchar({\g@dirloopedgeA{#1}}{\g@dirloopedgeB{#1}}
+}
+%
+\def\g@dirloopedgeA#1(#2,#3)(#4,#5){
+       \@ifnextchar[{\g@dirloopedgeAa{#1}(#2,#3)(#4,#5)}%
+                       {\g@dirloopedgeAa{#1}(#2,#3)(#4,#5)[]}
+}
+%
+\def\g@dirloopedgeAa#1(#2,#3)(#4,#5)[#6]{
+       \g@extendlist\g@edges{\g@drawdirloopedgeA{#1}(#2,#3)(#4,#5)[#6]}
+}
+%
+% The actual drawing routine:
+%
+\def\g@drawdirloopedgeA#1(#2,#3)(#4,#5)[#6]{%
+       \g@testname{#1}%
+       \edef\g@coords{\g@nodecoords{#1}}%
+       %
+       % Choose the drawing procedure for the arrow according
+       % to the node's type:
+       %
+       \edef\g@type{\g@nodetype{#1}}%
+       \ifnum\g@circletype=\g@type%
+         \let\g@draw=\ps@looparrowoncircleA%
+       \else%
+         \let\g@draw=\ps@looparrowonrectangleA%
+         \ifnum\g@rectangletype=\g@type%
+         \else%
+           \typeout{}%
+           \typeout{Error in \string\g@drawdirloopedge: unrecognized node type}%%
+         \fi%
+       \fi%
+       \edef\g@args{(#2,#3)(#4,#5)\g@thenodesize{#1}}%
+       %
+       % and draw it:
+       %
+       {#6%
+       \expandafter\put\g@coords{\expandafter\g@draw\g@args}%
+       }%
+}
+%
+%
+%_________________________________________________________________%%
+% Definition of a directed loop - the second form:
+%
+% Arguments:
+%
+% Node that carries the loop
+% Angle the two lines defining the loop build
+% Coordinates (x,y) that give the axis along which the loop is
+% to be drawn and its length (ie, the length of the two lines 
+% defining the loop).
+%_________________________________________________________________%%
+%
+\def\g@dirloopedgeB#1#2(#3,#4){
+       \@ifnextchar[{\g@dirloopedgeBa{#1}{#2}(#3,#4)}%
+                       {\g@dirloopedgeBa{#1}{#2}(#3,#4)[]}
+}
+%
+\def\g@dirloopedgeBa#1#2(#3,#4)[#5]{
+       \g@extendlist\g@edges{\g@drawdirloopedgeB{#1}{#2}(#3,#4)[#5]}
+}
+%
+% The actual drawing routine:
+%
+\def\g@drawdirloopedgeB#1#2(#3,#4)[#5]{%
+       \g@testname{#1}%
+       \edef\g@coords{\g@nodecoords{#1}}%
+       %
+       % Choose the drawing procedure for the arrow according
+       % to the node's type:
+       %
+       \edef\g@type{\g@nodetype{#1}}%
+       \ifnum\g@circletype=\g@type%
+         \let\g@draw=\ps@looparrowoncircleB%
+       \else%
+         \let\g@draw=\ps@looparrowonrectangleB%
+         \ifnum\g@rectangletype=\g@type%
+         \else%
+           \typeout{}%
+           \typeout{Error in \string\g@drawdirloopedge: unrecognized node type}%%
+         \fi%
+       \fi%
+       \edef\g@args{{#2}(#3,#4)\g@thenodesize{#1}}%
+       %
+       % and draw it:
+       %
+       {#5%
+       \expandafter\put\g@coords{\expandafter\g@draw\g@args}%
+       }%
+}
+%
+%
+%_________________________________________________________________%%
+% Automatic positioning of a node's text
+% (This one sets \opaquetextfalse if it's not enforced by the optional
+% parameter!):
+%
+% Arguments:
+%
+% Node
+% Optional (surrounded by []): n, s, e, w, ne, nw, se, sw (for north,
+%      south, east, west, ...) indicating the position of the text
+%      with respect to the node. If omitted, the text is centered
+%      inside the node.
+% Text (=anything that may occur as a \put argument in a picture
+%      environment, i.e., even lines, vectors, and so on.)
+%_________________________________________________________________%%
+%
+\g@test{autonodetext}
+\def\autonodetext#1{
+  \@ifnextchar[{\g@autonodetext{#1}}{\g@autonodetext{#1}[]}
+}
+%
+\def\g@autonodetext#1[#2]#3{
+  \@ifnextchar[{\g@autonodetextopt{#1}{#3}[#2]}%
+       {\g@autonodetextopt{#1}{#3}[#2][]}
+}
+%
+\def\g@rootofahalf{.70710678}% square root of 0.5
+%
+\def\g@autonodetextopt#1#2[#3][#4]{
+  \def\g@doit##1##2##3;{
+    \def\g@xdisplace{0}\def\g@ydisplace{0}\def\g@torb{,0]}\def\g@lorr{[0}
+    \def\g@xdisplacec{0}\def\g@ydisplacec{0}
+    \if##2.
+      \if##1s\def\g@ydisplace{-1}\def\g@torb{,-1]}\else
+      \if##1n\def\g@ydisplace{1}\def\g@torb{,1]}\else
+      \if##1e\def\g@xdisplace{1}\def\g@lorr{[1}\else
+      \if##1w\def\g@xdisplace{-1}\def\g@lorr{[-1}\fi\fi\fi\fi
+      \edef\g@xdisplacec{\g@xdisplace}\edef\g@ydisplacec{\g@ydisplace}
+    \else
+      \if##1s\def\g@ydisplace{-1}\def\g@torb{,-1]}
+       \def\g@ydisplacec{-\g@rootofahalf}\else
+      \if##1n\def\g@ydisplace{1}\def\g@torb{,1]}
+       \def\g@ydisplacec{\g@rootofahalf}\else
+      \if##1e\def\g@xdisplace{1}\def\g@lorr{[1}
+       \def\g@xdisplacec{\g@rootofahalf}\else
+      \if##1w\def\g@xdisplace{-1}\def\g@lorr{[-1}
+       \def\g@xdisplacec{-\g@rootofahalf}\fi\fi\fi\fi
+      \if##2e\def\g@xdisplace{1}\def\g@lorr{[1}
+       \def\g@xdisplacec{\g@rootofahalf}\else
+      \if##2w\def\g@xdisplace{-1}\def\g@lorr{[-1}
+       \def\g@xdisplacec{-\g@rootofahalf}
+      \fi\fi
+    \fi
+    \edef\g@values{%
+      {(\g@xdisplacec,\g@ydisplacec)}{\g@lorr\g@torb}{%
+        (\g@xdisplace,\g@ydisplace)}%
+    }
+    \expandafter\g@extendtextsauto\g@values{#1}{#2}[#4]}
+  \g@doit#3...;}
+%
+%
+\def\g@extendtextsauto#1#2#3#4#5[#6]{
+       \g@extendlist\g@texts{\g@putautotext{#1}{#2}{#3}{#4}{#5}[#6]}
+}
+%
+% The actual drawing routine:
+%
+\def\g@putautotext#1#2#3#4#5[#6]{%
+       \g@testname{#4}%
+       \edef\g@coords{\g@nodecoords{#4}}%
+       \edef\g@type{\g@nodetype{#4}}%
+       \edef\g@size{\g@thenodesize{#4}}%
+       \ifnum\g@circletype=\g@type%
+         \def\g@draw{\g@xyput#1}%
+         \expandafter\g@getcirclexy\g@size%
+       \else%
+         \def\g@draw{\g@xyput#3}%
+         \expandafter\g@getrectanglexy\g@size%
+         \ifnum\g@rectangletype=\g@type%
+         \else%
+           \typeout{}%
+           \typeout{Error in \string\putautotext: unrecognized node type}%
+         \fi%
+       \fi%
+       \expandafter\put\g@coords{%
+         \opaquetextfalse #6%
+         \g@textsize{#5}%
+         \g@xunitlength=\g@autodistance\g@xunitlength\divide\g@xunitlength by 2%
+         \g@yunitlength=\g@autodistance\g@yunitlength\divide\g@yunitlength by 2%
+         \ifopaquetext%
+           \g@draw{\expandafter\g@makeautotext\g@thetextsize%
+               #2{\expandafter\ps@deletebox\g@thetextsize}}%
+         \fi%
+         \g@draw{\expandafter\g@makeautotext\g@thetextsize%
+               #2{\makebox(0,0){#5}}}%
+       }%
+}%
+%
+\def\g@getcirclexy[#1]{
+       \g@xunitlength=#1\unitlength\relax
+       \g@yunitlength=\g@xunitlength\relax
+}
+%
+\def\g@getrectanglexy[#1,#2]{
+       \g@xunitlength=#1\unitlength\relax
+       \g@yunitlength=#2\unitlength\relax
+}
+%
+\newcount\g@xpos
+\newcount\g@ypos
+\def\g@makeautotext(#1,#2)[#3,#4]#5{%
+       \g@oldunitlength=\unitlength%
+       \g@xpos=#1\divide\g@xpos by 2\multiply\g@xpos by #3\relax%
+       \g@ypos=#2\divide\g@ypos by 2\multiply\g@ypos by #4\relax%
+       \unitlength=1sp%
+       \edef\g@positions{(\number\g@xpos,\number\g@ypos)}%
+       \expandafter\put\g@positions{\unitlength=\g@oldunitlength{#5}}%
+}%
+%
+%
+%_________________________________________________________________%%
+% Definition of a node's text:
+%
+% Arguments:
+%
+% Node
+% Relative coordinates of the text (optional).
+%      Text is centered horizontally and vertically at this position.
+%      (Use a \makebox(0,0)[...]{Text} construction to disable the
+%      centering if necessary.)
+%      Omitting the optinal argument means the same as (0,0).
+% Text (=anything that may occur as a \put argument in a picture
+%      environment, i.e., even lines, vectors, and so on.)
+%_________________________________________________________________%%
+%
+\g@test{nodetext}
+\def\nodetext#1{
+       \@ifnextchar({\g@nodetext{#1}}{\g@nodetext{#1}(0,0)}
+}
+\def\g@nodetext#1(#2,#3)#4{
+       \@ifnextchar[{\g@nodetextb{#1}(#2,#3){#4}}%
+                       {\g@nodetextb{#1}(#2,#3){#4}[]}
+}
+%
+\def\g@nodetextb#1(#2,#3)#4[#5]{
+       \g@extendlist\g@texts{\g@putnodetext{#1}(#2,#3){#4}[#5]}
+}
+%
+% The actual drawing routine:
+%
+\def\g@putnodetext#1(#2,#3)#4[#5]{%
+       \g@testname{#1}%
+       \edef\g@coords{\g@nodecoords{#1}}%
+       \expandafter\put\g@coords{%
+         #5%
+         \ifopaquetext%
+           \g@textsize{#4}%
+           \put(#2,#3){\expandafter\ps@deletebox\g@thetextsize}%
+         \fi%
+         \put(#2,#3){\makebox(0,0){#4}}%
+       }%
+}
+%
+%
+%_________________________________________________________________%%
+% Definition of an edge's text (for straight edges only):
+%
+% Arguments:
+%
+% Both nodes incident with the edge in question
+% Text (=anything that may occur as a \put argument in a picture
+%      environment, i.e., even lines, vectors, and so on.)
+%_________________________________________________________________%%
+%
+\g@test{edgetext}
+\def\edgetext#1#2#3{
+       \@ifnextchar[{\g@edgetext{#1}{#2}{#3}}%
+                       {\g@edgetext{#1}{#2}{#3}[]}
+}
+%
+\def\g@edgetext#1#2#3[#4]{
+       \g@extendlist\g@texts{\g@putedgetext{#1}{#2}{#3}[#4]}
+}
+%
+% The actual drawing routine:
+%
+\def\g@putedgetext#1#2#3[#4]{%
+       \g@testname{#1}\g@testname{#2}%
+       \g@differentpositions{#1}{#2}{\edgetext{#1}{#2}...}%
+       \edef\g@firstcoords{\g@nodecoords{#1}}%
+       \edef\g@secondcoords{\g@nodecoords{#2}}%
+       {%
+         #4%
+         \g@textsize{#3}%
+         \g@oldunitlength=\unitlength%
+         \divide\unitlength by 2%
+         \expandafter\put\g@firstcoords{%
+           \ifopaquetext%
+             \expandafter\put\g@secondcoords{%
+               \expandafter\ps@deletebox\g@thetextsize%
+             }%
+           \fi%
+           \expandafter\put\g@secondcoords{%
+             \unitlength=\g@oldunitlength%
+             \makebox(0,0){#3}%
+           }%
+         }%
+       }%
+}
+%
+%
+%_________________________________________________________________%%
+% Definition of a bow's text:
+%
+% Arguments:
+%
+% Both nodes and displacement factor defining the bow in question
+% Text (=anything that may occur as a \put argument in a picture
+%      environment, i.e., even lines, vectors, and so on.)
+%_________________________________________________________________%%
+%
+\g@test{bowtext}
+\def\bowtext#1#2#3#4{
+       \@ifnextchar[{\g@bowtext{#1}{#2}{#3}{#4}}%
+                       {\g@bowtext{#1}{#2}{#3}{#4}[]}
+}
+%
+\def\g@bowtext#1#2#3#4[#5]{
+       \g@extendlist\g@texts{\g@putbowtext{#1}{#2}{#3}{#4}[#5]}
+}
+%
+% The actual drawing routine:
+%
+\newdimen\g@x
+\newdimen\g@y
+\newdimen\g@aux
+\def\g@putbowtext#1#2#3#4[#5]{%
+       \g@testname{#1}\g@testname{#2}%
+       \g@differentpositions{#1}{#2}{\bowtext{#1}{#2}...}%
+       \def\g@doit(##1,##2)(##3,##4){%
+         {#5%
+         \g@textsize{#4}%
+         \g@oldunitlength=\unitlength%
+         \unitlength=.5\unitlength%
+         %
+         % Compute the difference of coordinates:
+         %
+         \g@x=##3\g@oldunitlength\g@aux=##1\g@oldunitlength%
+         \advance\g@x by -\g@aux\g@x=#3\g@x%
+         \g@y=##4\g@oldunitlength\g@aux=##2\g@oldunitlength%
+         \advance\g@y by -\g@aux\g@y=#3\g@y%
+         \g@y=-\g@y%
+         \edef\g@thirdcoords{(\number\g@y,\number\g@x)}%
+         \put(##1,##2){%
+           \ifopaquetext%
+             \put(##3,##4){%
+               \unitlength=1sp%
+               \expandafter\put\g@thirdcoords{%
+                 \expandafter\ps@deletebox\g@thetextsize%
+               }%
+             }%
+           \fi%
+           \put(##3,##4){%
+             \unitlength=1sp%
+             \expandafter\put\g@thirdcoords{%
+               \unitlength=\g@oldunitlength%
+               \makebox(0,0){#4}%
+             }%
+           }%
+         }}%
+       }%
+       \edef\g@firstcoords{\g@nodecoords{#1}}%
+       \edef\g@secondcoords{\g@nodecoords{#2}}%
+       %
+       % Expand both arguments before executing \g@doit:
+       %
+       \expandafter\expandafter\expandafter%
+               \g@doit\expandafter\g@firstcoords\g@secondcoords%
+}
+%
+%
+%_________________________________________________________________%%
+% Definition of free text:
+%
+% Arguments:
+%
+% Absolute coordinates of the text. (Text is centered horizontally
+%      and vertically at this position. Use a
+%      \makebox(0,0)[...]{Text} construction to disable the
+%      centering if necessary.)
+% Text (=anything that may occur as a \put argument in a picture
+%      environment, i.e., even lines, vectors, and so on.)
+%_________________________________________________________________%%
+%
+\g@test{freetext}
+\def\freetext(#1,#2)#3{
+       \@ifnextchar[{\g@freetext(#1,#2){#3}}%
+                       {\g@freetext(#1,#2){#3}[]}
+}
+%
+\def\g@freetext(#1,#2)#3[#4]{
+       \g@extendlist\g@texts{\g@putfreetext(#1,#2){#3}[#4]}
+}
+%
+% The actual drawing routine:
+%
+\def\g@putfreetext(#1,#2)#3[#4]{%
+       {#4%
+       \ifopaquetext%
+         \g@textsize{#3}%
+         \put(#1,#2){\expandafter\ps@deletebox\g@thetextsize}%
+       \fi%
+       \put(#1,#2){\makebox(0,0){#3}}%
+       }%
+}
+%
+%
+%_________________________________________________________________%%
+% Definition of a (perhaps filled) area:
+%
+% Arguments:
+%
+% Absolute coordinates of the starting point
+% Sequence of pairs (x_i,y_i) or triples (x_i,y_i,d_i) where the
+%      (x_i,y_i) are absolute coordinates of the next segment's
+%      end point and d_i is the displacement factor of the midpoint
+%      relative to the length of the segment. A positive number
+%      means the segment extends to the left.
+%_________________________________________________________________%%
+%
+\g@test{area}
+\def\area(#1,#2)#3{
+       \@ifnextchar[{\g@area(#1,#2){#3}}%
+                       {\g@area(#1,#2){#3}[]}
+}
+%
+\def\g@area(#1,#2)#3[#4]{
+       \g@extendlist\g@specialeffects{\g@putarea(#1,#2){#3}[#4]}
+}
+%
+% The actual drawing routine:
+%
+\def\g@putarea(#1,#2)#3[#4]{%
+       {#4%
+       \put(0,0){\ps@path(#1,#2){#3}}%
+       }%
+}
+%
+% For reasons of compatibility with older versions:
+\g@test{filledarea}\def\filledarea{\area}
+%
+%
+%_________________________________________________________________%%
+% Definition of a (perhaps filled) Bezier curve:
+%
+% Arguments:
+%
+% Normal distance of control points from points of the curve,
+%      in multiples of the segment length.
+% Sequence of triples (x_i,y_i,alpha_i), and and optional
+%      [factora_i,factorb_i]) after each of the triples:
+%      (x_i,y_i) is a point on the curve, alpha_i is the angle
+%      between the x-axis and the line through (x_i,y_i) and the
+%      next control point (the previous control point lies opposite),
+%      and factora_i (factorb_i) is overwrites the first argument
+%      for the two control points between two points.
+%_________________________________________________________________%%
+%
+\g@test{curve}
+\def\curve#1#2{
+       \@ifnextchar[{\g@curve{#1}{#2}}%
+                       {\g@curve{#1}{#2}[]}
+}
+%
+\def\g@curve#1#2[#3]{
+       \g@extendlist\g@specialeffects{\g@putcurve{#1}{#2}[#3]}
+}
+%
+% The actual drawing routine:
+%
+\def\g@putcurve#1#2[#3]{%
+       {#3%
+       \put(0,0){\ps@curve{#1}{#2}}%
+       }%
+}
+%
+%
+%_________________________________________________________________%%
+% Definition of a (perhaps filled) Bezier ``bubble'':
+%
+% Arguments:
+%
+% Normal distance (in multiples of unitlength) of control points
+%      in multiples of segment length.
+% Sequence of points (x_i,y_i).
+%_________________________________________________________________%%
+%
+\g@test{bubble}
+\def\bubble#1#2{
+       \@ifnextchar[{\g@bubble{#1}{#2}}%
+                       {\g@bubble{#1}{#2}[]}
+}
+%
+\def\g@bubble#1#2[#3]{
+       \g@extendlist\g@specialeffects{\g@putbubble{#1}{#2}[#3]}
+}
+%
+% The actual drawing routine:
+%
+\def\g@putbubble#1#2[#3]{%
+       {#3%
+       \put(0,0){\ps@bubble{#1}{#2}}%
+       }%
+}
+%
+%
+%
+%
+%
+%_________________________________________________________________%%
+%_________________________________________________________________%%
+%_________________________________________________________________%%
+% The rest consists of auxiliary macros used above:
+%_________________________________________________________________%%
+%_________________________________________________________________%%
+%_________________________________________________________________%%
+%
+%
+%
+%_________________________________________________________________%%
+% Globally extend a list by another item.
+%
+% Replaces the definition of the macro #1 by the expansion of #1
+% immediately followed by #2.
+%_________________________________________________________________%%
+%
+\def\g@extendlist#1#2{
+       \expandafter\def\expandafter#1\expandafter{#1#2}
+}
+%
+%
+%_________________________________________________________________%%
+% Give the different attributes of a node.
+%_________________________________________________________________%%
+%
+\def\g@nodecoords#1{%
+       \csname g@xy@#1\endcsname%
+}
+\def\g@nodetype#1{%
+       \csname g@type@#1\endcsname%
+}
+\def\g@thenodesize#1{%
+       \csname g@size@#1\endcsname%
+}
+\def\g@testname#1{%
+       \@ifundefined{g@name@#1}{%
+               \typeout{}%
+               \typeout{! Graph package error: node #1 undefined!}%
+               \typeout{}%
+               \errmessage{}%
+       }{}%
+}
+%
+%
+%_________________________________________________________________%%
+% Give the difference between coordinate pairs the second and
+% third argument expand to and define the first as the result.
+%_________________________________________________________________%%
+%
+\def\g@defcoorddiff#1#2#3{
+       \edef#1{% Expand both arguments before expanding \g@coorddiff:
+       \expandafter\expandafter\expandafter\g@coorddiff\expandafter#2#3}
+}
+%
+\def\g@coorddiff(#1,#2)(#3,#4){(#3 #1 sub, #4 #2 sub)
+}
+%
+%
+%_________________________________________________________________%%
+% Find out the size of a box and add \g@eboxes.
+%_________________________________________________________________%%
+%
+\newdimen\g@heightplusdepth
+\newdimen\g@width
+\def\g@textsize#1{
+       \setbox0=\hbox{#1}
+       \g@heightplusdepth=\ht0
+       \advance\g@heightplusdepth by\dp0
+       \advance\g@heightplusdepth by\g@eboxes\unitlength
+       \g@width=\wd0
+       \advance\g@width by\g@eboxes\unitlength
+       \edef\g@thetextsize{%
+         (\number\g@width,\number\g@heightplusdepth)%
+       }
+}
+%
+%
+%_________________________________________________________________%%
+% Save the information about a node in appropriate macros
+% (one macro to treat round and square nodes, one for
+% rectangular nodes, and one for text nodes):
+%_________________________________________________________________%%
+%
+\def\g@node#1#2(#3,#4)[#5]{
+       \g@nodedef{g@name@#1}{}
+       {
+         #5
+         \xdef\g@auxnodesize{\g@nsize}
+       }
+       \g@nodedef{g@xy@#1}{(#3,#4)}
+       \g@nodedef{g@type@#1}{#2}
+       \ifx\g@rectangletype#2
+         \g@nodedef{g@size@#1}{[\g@auxnodesize,\g@auxnodesize]}
+       \else
+         \g@nodedef{g@size@#1}{[\g@auxnodesize]}
+       \fi
+}
+%
+\def\g@noderect#1[#2,#3](#4,#5){
+       \g@nodedef{g@name@#1}{}
+       \g@nodedef{g@xy@#1}{(#4,#5)}
+       \g@nodedef{g@type@#1}{\g@rectangletype}
+       \g@nodedef{g@size@#1}{[#2,#3]}
+}
+%
+\def\g@nodebytext#1(#2,#3)#4[#5]{
+       \g@nodedef{g@name@#1}{}
+       \g@nodedef{g@xy@#1}{(#2,#3)}
+       \g@nodedef{g@type@#1}{\g@rectangletype}
+       {#5
+         \g@textsize{#4}
+         \expandafter\g@findsize\g@thetextsize
+       }
+       \g@nodedef{g@size@#1}{\g@auxtextsize}
+}
+%
+\def\g@nodedef#1#2{\expandafter\edef\csname #1\endcsname{#2}}
+%
+%
+%
+%_________________________________________________________________%%
+% Compare the coordinates of nodes and give an error message if they
+% coincide. (Used to prevent the definition of edges of length 0.)
+%_________________________________________________________________%%
+%
+%
+\def\g@differentpositions#1#2#3{%
+       \edef\g@firstname{#1}%
+       \edef\g@secondname{#2}%
+       \ifx\g@firstname\g@secondname%
+         \typeout{}%
+         \typeout{! Graph package error: Node #1 used twice
+         in \string#3.}%
+         \typeout{}%
+         \errmessage{}
+       \else
+         \edef\g@firstposition{\g@nodecoords{#1}}%
+         \edef\g@secondposition{\g@nodecoords{#2}}%
+         \ifx\g@firstposition\g@secondposition%
+           \typeout{}%
+           \typeout{! Graph package error: Coordinates of nodes
+           #1 and #2 in}%
+           \typeout{\string#3 coincide.}%
+           \typeout{}%
+           \errmessage{}           
+         \fi%
+       \fi%
+}
+%
+%
+%
+%_________________________________________________________________%%
+% Nasty procedure to compute the necessary size of the node. We need
+% something that computes
+%            textdimension / \unitlength + 2 * \g@lwidth
+% with high precision. So we can't simply use the \divide macro of
+% TeX (yielding an integer value), but must explicitely construct a
+% number showing some (I chose three) digits after the period.
+% (I don't know whether there's a more elegant way of doing this.
+% Sorry to anybody who might be bothered.)
+%_________________________________________________________________%%
+%
+%
+\newcount\g@xsizeA
+\newcount\g@xsizeB
+\newcount\g@ysizeA
+\newcount\g@ysizeB
+\newcount\g@help
+\newdimen\g@helpB
+\def\g@findsize(#1,#2){
+       \g@xsizeA=#1\relax
+       \g@helpB=\g@lwidth\unitlength\multiply\g@helpB by 2\relax
+       \advance\g@xsizeA by \g@helpB\relax
+       \g@xsizeB=\g@xsizeA
+       \divide\g@xsizeA by\unitlength\relax
+       \g@help=\unitlength\multiply\g@help by -\g@xsizeA\relax
+       \advance\g@xsizeB by \g@help\relax
+       \g@help=\unitlength\advance\g@help by 999\divide\g@help by 1000
+                                                       \multiply\g@help by 1000
+       \advance\g@xsizeB by \g@help\relax
+       \divide\g@help by 1000
+       \divide\g@xsizeB by \g@help
+       %
+       \g@ysizeA=#2\relax
+       \advance\g@ysizeA by \g@helpB\relax
+       \g@ysizeB=\g@ysizeA
+       \divide\g@ysizeA by\unitlength\relax
+       \g@help=\unitlength\multiply\g@help by -\g@ysizeA\relax
+       \advance\g@ysizeB by \g@help\relax
+       \g@help=\unitlength\advance\g@help by 999\divide\g@help by 1000
+                                                       \multiply\g@help by 1000
+       \advance\g@ysizeB by \g@help\relax
+       \divide\g@help by 1000
+       \divide\g@ysizeB by \g@help
+       \xdef\g@auxtextsize{%
+         [\expandafter\g@mkpoint\number\g@xsizeB;{\number\g@xsizeA},%
+          \expandafter\g@mkpoint\number\g@ysizeB;{\number\g@ysizeA}]}
+}
+%
+\def\g@mkpoint#1#2;#3{
+       #3.#2
+}
+%
+%
+%_________________________________________________________________%%
+% \put with separated x- and y-\unitlengths
+% (modified definition from LaTeX):
+%_________________________________________________________________%%
+%
+\newdimen\g@xunitlength\g@xunitlength=\unitlength
+\newdimen\g@yunitlength\g@yunitlength=\unitlength
+\long\def\g@xyput(#1,#2)#3{\@killglue\raise#2\g@yunitlength\hbox to\z@{\kern
+#1\g@xunitlength #3\hss}\ignorespaces}
diff --git a/nlsop/graphs_config.tex b/nlsop/graphs_config.tex
new file mode 100644 (file)
index 0000000..ea0ada6
--- /dev/null
@@ -0,0 +1 @@
+\special{header=/home/frank-z/work/lectures/latex/nlsop/graphs.header}
diff --git a/nlsop/graphs_ps.tex b/nlsop/graphs_ps.tex
new file mode 100644 (file)
index 0000000..2dfd3f9
--- /dev/null
@@ -0,0 +1,266 @@
+% `special' commands for version 1.53 of graphs.sty. Frank Drewes, 19.12.2000
+
+\def\ps@s{ }
+\def\ps@convertnum#1{
+       #1 \number\unitlength\ps@s mul 65536 div 72.27 div 72 mul
+}
+
+%-----------------------------------------------------------------------------%
+
+
+\def\ps@rectangle[#1,#2]{% width, height
+\special{"     \ps@convertnum{#1}
+               \ps@convertnum{#2}
+               [ \g@ncolour\ps@s\g@ncolourmod ]\ps@s
+               [ \g@lcolour\ps@s\g@lcolourmod ]\ps@s
+               \ps@convertnum{\g@lwidth}\g@lwidthmod\ps@s
+               \g@ldash\ps@s
+               \iffillednodes true \else false\fi\ps@s
+               psrectangle}}
+
+%-----------------------------------------------------------------------------%
+
+\def\ps@circle[#1]{% diameter
+\special{"     \ps@convertnum{#1}
+               [ \g@ncolour\ps@s\g@ncolourmod ]\ps@s
+               [ \g@lcolour\ps@s\g@lcolourmod ]\ps@s
+               \ps@convertnum{\g@lwidth}\g@lwidthmod\ps@s
+               \g@ldash\ps@s
+               \iffillednodes true \else false\fi\ps@s
+               pscircle}}
+
+%-----------------------------------------------------------------------------%
+
+\def\ps@line(#1,#2){% end x, end y
+\special{"     \ps@convertnum{#1}
+               \ps@convertnum{#2}
+               \ps@convertnum{\g@lwidth}\g@lwidthmod\ps@s
+               [ \g@lcolour\ps@s\g@lcolourmod ]\ps@s
+               \g@ldash\ps@s
+               psline}}
+
+%-----------------------------------------------------------------------------%
+
+\def\ps@loopA(#1,#2)(#3,#4){% from (#1,#2) to (#3,#4)
+\special{"     \ps@convertnum{#1}
+               \ps@convertnum{#2}
+               \ps@convertnum{#3}
+               \ps@convertnum{#4}
+               [ \g@lcolour\ps@s\g@lcolourmod ]\ps@s
+               \ps@convertnum{\g@lwidth}\g@lwidthmod\ps@s
+               \g@ldash\ps@s
+               psloop}}
+
+%-----------------------------------------------------------------------------%
+
+\def\ps@loopB#1(#2,#3){% angle #1, axis (#2,#3)
+\special{"     #1
+               \ps@convertnum{#2}
+               \ps@convertnum{#3}
+               psloopbyangle
+               [ \g@lcolour\ps@s\g@lcolourmod ]\ps@s
+               \ps@convertnum{\g@lwidth}\g@lwidthmod\ps@s
+               \g@ldash\ps@s
+               psloop}}
+               
+%-----------------------------------------------------------------------------%
+
+\def\ps@looparrowonrectangleA(#1,#2)(#3,#4)[#5,#6]{% 
+\special{"     \ps@convertnum{#1}
+               \ps@convertnum{#2}
+               \ps@convertnum{#3}
+               \ps@convertnum{#4}
+               \ps@convertnum{#5}
+               \ps@convertnum{#6}
+               [ \g@lcolour\ps@s\g@lcolourmod ]\ps@s
+               \ps@convertnum{\g@lwidth}\g@lwidthmod\ps@s
+               \g@ldash\ps@s
+               \ps@convertnum{\g@alength}\g@alengthmod\ps@s
+               \g@awidth\ps@s\g@awidthmod\ps@s
+               \g@atype\ps@s
+               pslooparrowonrectangle}}
+
+%-----------------------------------------------------------------------------%
+
+\def\ps@looparrowoncircleA(#1,#2)(#3,#4)[#5]{% 
+\special{"     \ps@convertnum{#1}
+               \ps@convertnum{#2}
+               \ps@convertnum{#3}
+               \ps@convertnum{#4}
+               \ps@convertnum{#5}
+               [ \g@lcolour\ps@s\g@lcolourmod ]\ps@s
+               \ps@convertnum{\g@lwidth}\g@lwidthmod\ps@s
+               \g@ldash\ps@s
+               \ps@convertnum{\g@alength}\g@alengthmod\ps@s
+               \g@awidth\ps@s\g@awidthmod\ps@s
+               \g@atype\ps@s
+               pslooparrowoncircle}}
+
+%-----------------------------------------------------------------------------%
+
+\def\ps@looparrowonrectangleB#1(#2,#3)[#4,#5]{% 
+\special{"     #1
+               \ps@convertnum{#2}
+               \ps@convertnum{#3}
+               psloopbyangle
+               \ps@convertnum{#4}
+               \ps@convertnum{#5}
+               [ \g@lcolour\ps@s\g@lcolourmod ]\ps@s
+               \ps@convertnum{\g@lwidth}\g@lwidthmod\ps@s
+               \g@ldash\ps@s
+               \ps@convertnum{\g@alength}\g@alengthmod\ps@s
+               \g@awidth\ps@s\g@awidthmod\ps@s
+               \g@atype\ps@s
+               pslooparrowonrectangle}}
+
+%-----------------------------------------------------------------------------%
+
+\def\ps@looparrowoncircleB#1(#2,#3)[#4]{% 
+\special{"     #1
+               \ps@convertnum{#2}
+               \ps@convertnum{#3}
+               psloopbyangle
+               \ps@convertnum{#4}
+               [ \g@lcolour\ps@s\g@lcolourmod ]\ps@s
+               \ps@convertnum{\g@lwidth}\g@lwidthmod\ps@s
+               \g@ldash\ps@s
+               \ps@convertnum{\g@alength}\g@alengthmod\ps@s
+               \g@awidth\ps@s\g@awidthmod\ps@s
+               \g@atype\ps@s
+               pslooparrowoncircle}}
+
+%-----------------------------------------------------------------------------%
+
+\def\ps@deletebox(#1,#2){% width, height in scaled points
+\special{"     #1 65536 div
+               #2 65536 div
+               psdeletebox}}
+
+%-----------------------------------------------------------------------------%
+
+\def\ps@arrowonrectangle(#1,#2) [#3,#4]{% x, y, width, height
+\special{"     \ps@convertnum{#1}
+               \ps@convertnum{#2}
+               \ps@convertnum{#3}
+               \ps@convertnum{#4}
+               \ps@convertnum{\g@alength}\g@alengthmod\ps@s
+               \g@awidth\ps@s\g@awidthmod\ps@s
+               \g@atype\ps@s
+               [ \g@lcolour\ps@s\g@lcolourmod ]\ps@s
+               \ps@convertnum{\g@lwidth}\g@lwidthmod\ps@s
+               \g@ldash\ps@s
+               psarrowonrectangle}}
+
+%-----------------------------------------------------------------------------%
+
+\def\ps@arrowoncircle(#1,#2) [#3]{% x, y, diameter of circle
+\special{"     \ps@convertnum{#1}
+               \ps@convertnum{#2}
+               \ps@convertnum{#3}
+               \ps@convertnum{\g@alength}\g@alengthmod\ps@s
+               \g@awidth\ps@s\g@awidthmod\ps@s
+               \g@atype\ps@s
+               [ \g@lcolour\ps@s\g@lcolourmod ]\ps@s
+               \ps@convertnum{\g@lwidth}\g@lwidthmod\ps@s
+               \g@ldash\ps@s
+               psarrowoncircle}}
+
+%-----------------------------------------------------------------------------%
+
+\def\ps@path(#1,#2)#3{% start coordinates, (xi,yi[,di]) ...
+       \def\extractvalues(##1)##2;{%
+         \ifx\endmarker##1\else%
+           \extractvalues##2;\extractvals(##1,0,)%
+         \fi}%
+       \def\extractvals(##1,##2,##3,##4){%
+         \ps@convertnum{##1}%
+         \ps@convertnum{##2}%
+         ##3%
+       }%
+       \special{" mark \extractvalues#3(\endmarker);
+                       \ps@convertnum{#1}
+                       \ps@convertnum{#2}
+                       \ps@convertnum{\g@lwidth}\g@lwidthmod\ps@s
+                       [ \g@lcolour\ps@s\g@lcolourmod ]\ps@s
+                       \g@ldash\ps@s
+                       [ \g@fcolour\ps@s\g@fcolourmod ]\ps@s
+                       \iffilledareas true \else false\fi\ps@s pspath}}
+
+%-----------------------------------------------------------------------------%
+
+\def\ps@curve#1#2{% base length, (x1,y1,ang1[factor1]) ...
+       \def\extractvalues(##1(##2;##3{%
+         \ifx\endmarker##1\else%
+           \extractvalues(##2;{##3}\extractvals(##1[##3,##3];%
+         \fi}%
+       \def\extractvals(##1,##2,##3)[##4,##5]##6;{%
+         ##5\ps@s
+         ##4\ps@s
+         ##3\ps@s
+         \ps@convertnum{##2}%
+         \ps@convertnum{##1}%
+       }%
+       \special{" mark \extractvalues#2(\endmarker(;{#1}
+                       \ps@convertnum{\g@lwidth}\g@lwidthmod\ps@s
+                       [ \g@lcolour\ps@s\g@lcolourmod ]\ps@s
+                       \g@ldash\ps@s
+                       [ \g@fcolour\ps@s\g@fcolourmod ]\ps@s
+                       \iffilledareas true \else false\fi\ps@s pscurve}}
+
+%-----------------------------------------------------------------------------%
+
+\def\ps@bubble#1#2{% length factor, (x1,y1) ...
+       \def\extractvalues(##1)##2;{%
+         \ifx\endmarker##1\else%
+           \extractvalues##2;\extractvals(##1)%
+         \fi}%
+       \def\extractvals(##1,##2){%
+         \ps@convertnum{##2}%
+         \ps@convertnum{##1}%
+       }%
+       \special{" mark \extractvalues#2(\endmarker);
+                       #1\ps@s
+                       \ps@convertnum{\g@lwidth}\g@lwidthmod\ps@s
+                       [ \g@lcolour\ps@s\g@lcolourmod ]\ps@s
+                       \g@ldash\ps@s
+                       [ \g@fcolour\ps@s\g@fcolourmod ]\ps@s
+                       \iffilledareas true \else false\fi\ps@s psbubble}}
+
+%-----------------------------------------------------------------------------%
+
+\def\ps@dirbowoncircle(#1,#2)(#3,#4,#5)[#6]{% (x1,x2) (y1,y2,d), radius
+\special{"     \ps@convertnum{#1}
+               \ps@convertnum{#2}
+               \ps@convertnum{#3}
+               \ps@convertnum{#4}
+               #5\ps@s
+               \ps@convertnum{#6}
+               \ps@convertnum{\g@alength}\g@alengthmod\ps@s
+               \g@awidth\ps@s\g@awidthmod\ps@s
+               \g@atype\ps@s
+               \ps@convertnum{\g@lwidth}\g@lwidthmod\ps@s
+               [ \g@lcolour\ps@s\g@lcolourmod ]\ps@s
+               \g@ldash\ps@s
+               psdirbowoncircle}}
+
+%-----------------------------------------------------------------------------%
+
+\def\ps@dirbowonrectangle(#1,#2)(#3,#4,#5)[#6,#7]{% (x1,x2) (y1,y2,d),
+                                                  % xsize, ysize
+\special{"     \ps@convertnum{#1}
+               \ps@convertnum{#2}
+               \ps@convertnum{#3}
+               \ps@convertnum{#4}
+               #5\ps@s
+               \ps@convertnum{#6}
+               \ps@convertnum{#7}
+               \ps@convertnum{\g@alength}\g@alengthmod\ps@s
+               \g@awidth\ps@s\g@awidthmod\ps@s
+               \g@atype\ps@s
+               \ps@convertnum{\g@lwidth}\g@lwidthmod\ps@s
+               [ \g@lcolour\ps@s\g@lcolourmod ]\ps@s
+               \g@ldash\ps@s
+               psdirbowonrectangle}}
+
+%-----------------------------------------------------------------------------%
+
index 908951b53bf58148891134e955d8caf9fdc4011b..0f162ce89581c2dd178b78fa463008f0d6fbb397 100644 (file)
 \usepackage{graphicx}
 \graphicspath{{./img/}}
 
-\usepackage{graphs}
+\usepackage{./graphs}
 
 \author{Frank Zirkelbach}
 
-\title{Nanolamellare Selbstordnungsproze"se bei Kohlenstoffimplantation in Silizium}
+\title{Nanolamellare Selbstordnungsprozesse bei Kohlenstoffimplantation in $(100)$-orientiertes Silizium bei Temperaturen kleiner $400$ Grad Celsius}
 
 \begin{document}
 \frontmatter
@@ -35,12 +35,72 @@ foobar ...
 
 \section{Ablaufschema}
 \originalTeX
-\begin{graph}(4,4)
- \textnode{start}(2,4){nlsop start}
- \textnode{rand1}(2,3){zufaellige wahl der Koordinaten: \newline $p(x)dx=dx$ \newline $p(y)dy=dy$ \newline $p(z)dz=(a_el*z+b_el)dz$}
+\begin{figure}[thbp]
+\begin{center}
+\begin{graph}(8,30)
+ \graphnodecolour{1}
+ \textnode{start}(4,30){nlsop start}
+ \rectnode{rand1}[6,3](4,27.5)
+ \freetext(4,28.5){zufaellige Wahl der Koordinaten:}
+ \freetext(4,27.5){$p(x)dx=dx$}
+ \freetext(4,27){$p(y)dy=dy$}
+ \freetext(4,26.5){$p(z)dz=(a_{el}*z+b_{el})dz$}
  \diredge{start}{rand1}
+ \rectnode{p_ac_ca}[9,3](4,23.5)
+ \freetext(4,24.5){Berechnung der $p_{a \rightarrow c}$ bzw. $p_{c \rightarrow a}$:}
+ \freetext(4,23.5){$\displaystyle p_{c \rightarrow a}=\sum_{amorphe Nachbarn} \frac{a_{ap}}{\textrm{Abstand}^2} + b_{ap} + a_{cp}c_{\textrm{Kohlenstoff}}$}
+ \freetext(4,22.5){$\displaystyle p_{a \rightarrow c}=1-p_{c \rightarrow a}$}
+ \diredge{rand1}{p_ac_ca}
+ \textnode{ac}(4,21){Zelle $(x,y,z)$ amorph?}
+ \diredge{p_ac_ca}{ac}
+ \textnode{d_c}(2,19.5){Zufallszahl $< p_{a \rightarrow c}$ ?}
+ \textnode{d_a}(6,19.5){Zufallszahl $< p_{c \rightarrow a}$ ?}
+ \diredge{ac}{d_a}
+ \edgetext{ac}{d_a}{nein}
+ \diredge{ac}{d_c}
+ \edgetext{ac}{d_c}{ja}
+ \textnode{amount_c}(4,16.5){$\textrm{gesamter Kohlenstoff} < \textrm{steps} * c_{ratio}$ ?}
+ \diredge{d_c}{amount_c}
+ \diredge{d_a}{amount_c}
+ \textnode{make_c}(1,18){Zelle $(x,y,z) = \textrm{kristallin}$}
+ \textnode{make_a}(7,18){Zelle $(x,y,z) = \textrm{amorph}$}
+ \diredge{d_c}{make_c}
+ \edgetext{d_c}{make_c}{ja}
+ \diredge{d_a}{make_a}
+ \edgetext{d_a}{make_a}{ja}
+ \diredge{make_c}{amount_c}
+ \diredge{make_a}{amount_c}
+ \rectnode{rand2}[5,3](1.5,14)
+ \freetext(1.5,15){zufaellige Koordinaten:}
+ \freetext(1.5,14){$p(x)dx=dx$}
+ \freetext(1.5,13.5){$p(y)dy=dy$}
+ \freetext(1.5,13){$p(z)dz=(a_{cd}*z+b_{cd})dz$}
+ \diredge{amount_c}{rand2}
+ \freetext(3,16){ja}
+ \rectnode{inc_c}[5,1.5](1.5,11)
+ \freetext(1.5,11){Erhoehe $c_{Kohlenstoff}(x,y,z)$}
+ \freetext(1.5,10.5){Erhoehe gesamten Kohlenstoff}
+ \diredge{rand2}{inc_c}
+ \textnode{d_d}(5,9.5){Diffusion}
+ \diredge{inc_c}{d_d}
+ \diredge{amount_c}{d_d}
+ \edgetext{amount_c}{d_d}{nein}
 \end{graph}
+\end{center}
 \germanTeX
+\caption{ablaufschema}
+\end{figure}
+
+\begin{figure}[thpb]
+\begin{center}
+\begin{graph}(8,30)
+ \graphnodecolour{1}
+ \textnode{start}(4,30){Diffusion}
+\end{graph}
+\end{center}
+\germanTeX
+\caption{ablaufschema 2}
+\end{figure}