diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /graphics/pstricks/contrib/pst-node |
Initial commit
Diffstat (limited to 'graphics/pstricks/contrib/pst-node')
-rw-r--r-- | graphics/pstricks/contrib/pst-node/Changes | 68 | ||||
-rw-r--r-- | graphics/pstricks/contrib/pst-node/README | 22 | ||||
-rw-r--r-- | graphics/pstricks/contrib/pst-node/doc/psmatrix-docDE.bib | 35 | ||||
-rw-r--r-- | graphics/pstricks/contrib/pst-node/doc/psmatrix-docDE.pdf | bin | 0 -> 229201 bytes | |||
-rw-r--r-- | graphics/pstricks/contrib/pst-node/doc/psmatrix-docDE.tex | 1155 | ||||
-rw-r--r-- | graphics/pstricks/contrib/pst-node/doc/pst-node-doc.bib | 97 | ||||
-rw-r--r-- | graphics/pstricks/contrib/pst-node/doc/pst-node-doc.pdf | bin | 0 -> 670847 bytes | |||
-rw-r--r-- | graphics/pstricks/contrib/pst-node/doc/pst-node-doc.tex | 2990 | ||||
-rw-r--r-- | graphics/pstricks/contrib/pst-node/dvips/pst-node.pro | 610 | ||||
-rw-r--r-- | graphics/pstricks/contrib/pst-node/dvips/pst-node97.pro | 107 | ||||
-rw-r--r-- | graphics/pstricks/contrib/pst-node/latex/pst-node.sty | 44 | ||||
-rw-r--r-- | graphics/pstricks/contrib/pst-node/tex/pst-node.tex | 2011 | ||||
-rw-r--r-- | graphics/pstricks/contrib/pst-node/tex/pst-node97.tex | 391 |
13 files changed, 7530 insertions, 0 deletions
diff --git a/graphics/pstricks/contrib/pst-node/Changes b/graphics/pstricks/contrib/pst-node/Changes new file mode 100644 index 0000000000..eb4351ae58 --- /dev/null +++ b/graphics/pstricks/contrib/pst-node/Changes @@ -0,0 +1,68 @@ +----- pst-node.tex +1.42 2019-03-03 - bugfix for \rnode inside \psframebox* +1.41 2017-12-30 - added \psnpolygon +1.40a 2017-12-14 - modified documentation +1.40 2017-12-09 - added #1Last for \saveDataAsNodes +1.39 2017-01-20 - fix for \Circlenode with +/+\dp\hbox +1.38 2016-05-27 - revert fix for \Cnodeput. Problem was in pstricks.tex +1.37 2016-05-26 - fixed bug with \Cnodeput +1.36 2016-04-24 - moved node definitions from pstricks-add +1.35 2014-08-04 - added \saveDataAsNodes{Filename}{NodePrefix} +1.34 2014-06-17 - fix bug for showNodes +1.33 2014-03-25 - added optional argument NodeCoorPrefix for savedCoors + By default it is empty: names are N-<Name>.x|y + if it is set: names are <NodeCoorPrefix><Name>x|y +1.32 2014-02-03 - fixed bug in \pst@newnode for savedCoors +1.31 2014-01-04 - added \dotnodes, plural of \dotnode +1.30 2013-09-17 - use \expandafter with \nodexn for the first argument +1.29 2013-07-13 - fix bug with missing angle in special node + coordinates + - fix for fnpnodes (argument must be in {}) + - fix typo in the documentation +1.28 2013-07-10 - added \pnodes (plural) for multiple node definition +1.27 2013-04-12 - added macro \Cnodeput which takes radius=... + into account +1.26 2013-04-09 - added macros \psncurve and \psnccurve + for a sequence of nodes created by \curvepnodes +1.25 2012-09-21 - Global node coordinates only with + saveNodeCoors +1.24 2012-09-18 - fix introduced bug with \pst@thenode +1.23 2012-09-15 - add global defined N-<name>.x and N-<name>.y + for user nodes +1.22 2012-02-12 - fix introduced bug for \rnode with + commented out the \pst@boxpar +1.21 2011-11-21 - fix bug for xelatex and scaling +1.20 2011-08-20 - added \Pst@Debug tu supress some \typeouts +1.19 2011-08-12 - added \psnode, which combines \rput and \rnode +1.18 2011-08-01 - bugfix for \shownode (ms) +1.17 2011-07-04 - added optional argument for \pnode for relative + node setting +1.16 2011-05-05 - fixed bug with missing star version for \nput +1.15 2011-02-28 - fixed bug with nodealign +1.14 2010-10-28 - added the macros + \psGetEdgeA and \psGetEdgeB for getting the + edge coordinates of connections + - added the macro \psDefBoxNodes, which sets + 12 nodes of the given argument, see documentation +1.13 2010-06-06 - changed all *put macros for using pst@refangle +1.12 2010-04-30 - moved concatstring into the base pstricks.pro + - fixed bug with nbput (ms) +1.11 2010-04-22 - modified version of \shownode (ms) + - modified \curvepnodes (ms) +1.10 2010-01-22 - first version with pst-xkey and an own + documentation (hv) + + +----- pst-node.sty +1.01 2012-09-18 - update package versions (hv) +1.00 2011-06-05 - make ancient variant 97 available (hv) + 2008-12-12 first version (hv) + + +----- pst-node.pro +1.15 2014-01-27 - comment out empty lines +1.14 2012-09-18 - add subroutines for global dict +1.13 2011-11-21 - fix bug for xelatex and scaling +1.12 2010-04-30 - small changes to the code +1.11 2010-04-22 - added function /concatstringarray (ms) +1.10 2010-01-22 - first version diff --git a/graphics/pstricks/contrib/pst-node/README b/graphics/pstricks/contrib/pst-node/README new file mode 100644 index 0000000000..fcfaff1b84 --- /dev/null +++ b/graphics/pstricks/contrib/pst-node/README @@ -0,0 +1,22 @@ +This version of pst-node uses the xkeyval package, the extended +version of keyval. + +Save the files pst-node.sty|.tex|.pro in a directory, which is part of your +local TeX node. Then do not forget to run texhash to update this node +if these packages are new to your TeX distribution. +For more information see the documentation of your LaTeX distribution +on installing packages into your LaTeX distribution or the +TeX Frequently Asked Questions: +(http://www.tex.ac.uk/cgi-bin/texfaq2html?label=instpackages). + +pst-node needs pstricks, which should be part of your +local TeX installation, otherwise get it from a CTAN server, f.ex. +http://mirror.ctan.org/graphics/pstricks/ + +The documentation was build with a temporary file to +insert the pages from the original documentation via +the command \includepdf[pages=..]{pst-docfull}. + +%% This program can be redistributed and/or modified under the terms +%% of the LaTeX Project Public License Distributed from CTAN +%% archives in directory macros/latex/base/lppl.txt. diff --git a/graphics/pstricks/contrib/pst-node/doc/psmatrix-docDE.bib b/graphics/pstricks/contrib/pst-node/doc/psmatrix-docDE.bib new file mode 100644 index 0000000000..f2a5d82e84 --- /dev/null +++ b/graphics/pstricks/contrib/pst-node/doc/psmatrix-docDE.bib @@ -0,0 +1,35 @@ +@Manual{pstricks2007, + Title = {PSTricks - {\PS} macros for Generic TeX. Version 1.5}, + Author = {Timothy Van Zandt}, + Organization = {}, + Address = + {\url{http://www.tug.org/tex-archive/graphics/pstricks/base/doc/pst-user.pdf}}, + Note = {}, + year = 2007, +} + + +@Manual{siart, + Title = {Befehls\"ubersicht f\"ur \texttt{PSTricks} (Version + 0.93}, + Author = {Uwe Siart}, + Organization = {}, + Address = + {\url{http://www.siart.de/typografie/pstricks-referenz.pdf}}, + Note = {}, + year = 2009, +} + + + + +@Book{PSTricks2, + author = {Herbert Vo\ss}, + title = {\texttt{PSTricks} -- {G}rafik f\"ur \TeX{} und \LaTeX}, + edition = {fünfte}, + publisher = {DANTE -- Lehmanns}, + year = {2008}, + address = {Heidelberg/Hamburg} +} + + diff --git a/graphics/pstricks/contrib/pst-node/doc/psmatrix-docDE.pdf b/graphics/pstricks/contrib/pst-node/doc/psmatrix-docDE.pdf Binary files differnew file mode 100644 index 0000000000..cb72a62b43 --- /dev/null +++ b/graphics/pstricks/contrib/pst-node/doc/psmatrix-docDE.pdf diff --git a/graphics/pstricks/contrib/pst-node/doc/psmatrix-docDE.tex b/graphics/pstricks/contrib/pst-node/doc/psmatrix-docDE.tex new file mode 100644 index 0000000000..8ca96eab4e --- /dev/null +++ b/graphics/pstricks/contrib/pst-node/doc/psmatrix-docDE.tex @@ -0,0 +1,1155 @@ +%% $Id: psmatrix-docDE.tex 696 2017-12-30 19:01:07Z herbert $ +\listfiles +\documentclass[11pt,ngerman,a4paper,BCOR10mm,DIV12,bibliography=totoc,parskip,smallheadings, + headexclude,footexclude,oneside]{pst-doc} +\usepackage[utf8]{inputenc} +\usepackage{babel} + +%\setlength{\parindent}{0pt} +%\setlength{\parskip}{1ex plus 0.2ex minus 0.1ex} + +\usepackage{pst-node,pst-grad,pstricks-add,pst-blur,float} +\def\tab#1{\tabular{@{}l@{}}#1\endtabular} +\def\OptEinh{\psframebox[framesep=2pt,fillstyle=solid,fillcolor=black!20,linecolor=black!20]{\texttt{Einheit}}\kern1pt} + +\let\myFV\fileversion + +\usepackage{tabularx} +\usepackage{longtable} + +\addbibresource{\jobname.bib} + + +\lstset{explpreset={pos=l,rframe=},frame=,backgroundcolor=\color{white},literate={ä}{{\"a}}1 {ö}{{\"o}}1 {ü}{{\"u}}1 + {Ä}{{\"A}}1 {Ö}{{\"O}}1 {Ü}{{\"U}}1 + {ß}{\ss}1} + + +\usepackage{bibgerm} + +%\psset{subgriddiv=0,gridlabels=7pt,gridcolor=black!15} +%\hypersetup{pdfauthor={Christine Roemer},pdftitle={psmatrix}} +% +\def\bgImage{\hspace*{1cm}% +\begin{psmatrix}[colsep=0.8cm,rowsep=0.4cm,mcol=c,emnode=r] + & & semantische Ebene & & + \psshadowbox[framearc=0.25]{Bedeutung}\\ + & & morphologische Ebene & & \\ +[name=A]\tab{pragmatische\\Ebene} & [name=B]& & & \\ + & & syntaktische Ebene & & \\ + & & \tab{phonetisch-phonologische Ebene\\graphische Ebene} + & & \psshadowbox[framearc=0.25]{Formativ} +\end{psmatrix} +\psset{nodesep=3pt,arrowscale=1.5,arrows=->, + armA=6mm,angleB=180} +\ncline{A}{B} +\ncangles{A}{1,3} \ncangles{A}{2,3} +\ncangles{A}{4,3} \ncangles{A}{5,3} +\ncline{1,3}{1,5} \ncline{5,3}{5,5} +\ncline{<->}{1,5}{5,5}% +} + +\lstset{basicstyle=\ttfamily\footnotesize} + +\begin{document} +\author{Timothy van Zandt\\Herbert Vo\ss} +\docauthor{Christine R\"omer} +\date{\today} +\title{Schematische \"Ubersichten mit \texttt{psmatrix}} + +\maketitle% + +\tableofcontents + +\clearpage +\begin{abstract} +Mit der +\texttt{psmatrix}-Umgebung\index{psmatrix@\texttt{psmatrix}-Umgebung} k\"onnen au{\ss}erhalb +einer mathematischen +Umgebung vielfältige schematische \"Ubersichten gesetzt werden. Das Makro \texttt{psmatrix} +wird nicht extra geladen. Es ist in verschiedene Pakete des +PSTricks-Verbundes\index{PSTricks-Verbund} +(\texttt{pstricks,\\pst-node,pst-grad})\index{pstricks@\texttt{pstricks}} +\index{pst-node@\texttt{pst-node}} \index{pst-grad@\texttt{pst-grad}} integriert + und wird mit ihnen aufgerufen. + +\vfill\noindent +Danke f\"ur die Unterst\"utzung bei der Erstellung dieser Dokumentation an Herbert Vo\ss. +\end{abstract} + + +\section{Einf\"uhrung} + +Mit der +\texttt{psmatrix}-Umgebung\index{psmatrix@\texttt{psmatrix}-Umgebung} k\"onnen +au{\ss}erhalb einer mathematischen +Umgebung schematische \"Ubersichten gesetzt werden. Sie basiert auf dem +Tabellenmakro \texttt{array}\index{array@\texttt{array}} und gleicht ihm deshalb in der +Syntax. Es hat jedoch nicht dessen +Einschr\"ankungen bez\"uglich Verbindungen über die Zellen und Zeilen hinweg. Das Makro +\texttt{psmatrix} +wird nicht extra geladen. Es ist in verschiedene Pakete des +PSTricks-Verbundes\index{PSTricks-Verbund} +(\texttt{pstricks,\\pst-node,pst-grad})\index{pstricks@\texttt{pstricks}} +\index{pst-node@\texttt{pst-node}} \index{pst-grad@\texttt{pst-grad}} integriert und +wird mit ihnen aufgerufen. + +\section{Erstellen einer Matrix} +\subsection{Einordnung} + +Das Makro \bs{\texttt{psmatrix}} arbeitet sowohl in einer \TeX - als auch +\LaTeX-Umgebung: + +\begin{BDef} +\Lcs{psmatrix}\OptArgs \ldots\ \Lcs{endpsmatrix} & \% TeX-Version\\ +\LBEG{psmatrix}\OptArgs \ldots \ \LEND{psmatrix} & \% LaTeX-Version +\end{BDef} + +Da mit der \TeX-Version einige Einschr\"ankungen verbunden sind, wird nur auf +die \LaTeX-Variante eingegangen. Das Grundprinzip des Strukturaufbaus +stellt eine Knoten- und Knotenverbindungszuordnung dar. Diese kann mehrfach +geschachtelt und sowohl bei der Knotenbelegung als auch +Verbindungsdarstellung in verschiedener Weise ausgestalltet werden. Dazu +stellt der PSTricksverbund zahlreiche Makros bereit. + +\subsection{Matrixgrundstruktur}\index{Matrixgrundstruktur} + +Die Knoten werden in der Art einer Tabelle innerhalb der +\texttt{psmatrix}-Umgebung\index{psmatrix@\texttt{psmatrix}-Umgebung} angeordnet. + +\begin{LTXexample}[width=.3\linewidth] +\begin{psmatrix}[rowsep=0.2cm] +1 & 2 & 3 \\ +X & Y & Z +\end{psmatrix} +\end{LTXexample} + + +\section{Zuordnung Knoten zu Verbindungen} + +Die Matrix entsteht durch die Zuordnung von Knoten zu Verbindungen. Die +Knoten werden in die Zellen in der \texttt{psmatrix}-Umgebung eingetragen +(siehe obiges Beispiel). Nach \bs{\texttt{end}}\{\texttt{psmatrix}\} werden die gew\"unschten +Linien definiert. Grunds\"atzlich geschieht dies nach dem Schema + +\psframebox{\bs +nc\psframebox[framesep=2pt,fillstyle=solid,fillcolor=black!20,linecolor=black!20]{\texttt{Verbindung}} +[\psframebox[framesep=2pt,fillstyle=solid,fillcolor=black!20,linecolor=black!20]{\texttt{Optionen}}] +\{Koordinaten ZelleA\}\{Koordinaten ZelleB\}} + +Die Koordinaten\index{Zellen-Koordinaten} werden, wenn den Zellen keine +Namen gegeben werden (siehe +Parameter \texttt{name}), +durch abz\"ahlen gewonnen: jeweils erst die Zeile und danach durch Komma abgetrennt +die Zelle. + +\vspace{4mm} +\begin{LTXexample}[width=.3\linewidth] +\begin{psmatrix}[rowsep=0.2cm] +1 & 2 & 3 \\ +X & Y & Z +\end{psmatrix} +\ncline[linecolor=red]{1,1}{2,2} +\ncline[linecolor=green]{1,3}{2,2} +\ncline[linestyle=dotted]{<-}{1,2}{2,1} +\ncline[linestyle=dashed]{->}{1,2}{2,3} +\end{LTXexample} + + +\section{Knotenparameter} +\subsection{mnode}\index{mnode@\texttt{mnode}} + +Der Parameter \texttt{mnode=<Knotenart>} legt die Knotenart fest. Das kann lokal für +einzelne Knoten oder global für die ganze Matrix erfolgen (siehe folgende +Beispiele). Dazu muss neben +dem Paket \texttt{pstricks}\index{pstricks@\texttt{pstricks}} auch +\texttt{pst-node}\index{pst-node@\texttt{pst-node}} geladen werden. + +\begin{LTXexample}[width=.2\linewidth] +\begin{psmatrix}[mnode=circle,rowsep=0.2cm,colsep=1cm] +1 & 2 \\ +X & Y +\end{psmatrix} +\end{LTXexample} + +\begin{LTXexample}[width=.2\linewidth] +\begin{psmatrix}[mnode=circle,rowsep=0.2cm,colsep=1cm] +1 & 2 \\ +[mnode=dia] X & Y +\end{psmatrix} +\end{LTXexample} + +Folgende \textbf{Knotenarten}\index{Knotenarten} stehen zur Verf\"ugung. Ihr Aufruf erfolgt mit +\texttt{mnode=} über die in Klammern angegebenen K\"urzel. + +\begin{compactitem} + \item \texttt{Rnode} (R):\index{Rnode@\texttt{Rnode} (R)} + Es wird damit das Eingetragene zur Basislinie + positioniert. Mittels Optionen kann dies variiert werden. +\vspace{2mm} +\begin{LTXexample}[width=.2\linewidth] +\begin{psmatrix}[rowsep=0.2cm,linecolor=blue,radius=0.5] +X & [mnode=R,vref=0pt] Y +\end{psmatrix} +\ncline{1,1}{1,2} +\end{LTXexample} + +\item \texttt{Cnode} (C):\index{Cnode@\texttt{Cnode} (C)} Ungef\"ullte Kreise werden gesetzt. +Deren Radius mit dem Parameter \texttt{radius}\index{radius@\texttt{radius}} modifiziert +werden kann. Es muss irgendetwas eingetragen werden, was dann aber nicht erscheint. +\vspace{2mm} +\begin{LTXexample}[width=.3\linewidth] +\begin{psmatrix}[mnode=C,rowsep=0.2cm,linecolor=blue,radius=0.5] + X & Y +\end{psmatrix} +\end{LTXexample} +\vspace{2mm} + +\item \texttt{pnode} (p):\index{pnode@\texttt{pnode} (p)} Ein Knoten mit dem Radius Null, ein +leerer Knoten (siehe folgendes Beispiel, wo der Knoten 1 leer gesetzt wird). + +\item \texttt{Circlenode} +(Circle):\index{Circlenode@\texttt{Circlenode} (Circle)} Ein Knoten, der von einem Kreis +umschlossen +wird, dessen Umfang richtet sich nach dem Inhalt. Er kann mit der Option +\texttt{radius} modifiziert werden (siehe obiges Beispiel). + +\vspace{2mm} +\begin{LTXexample}[width=.42\linewidth] +\begin{psmatrix}[mnode=Circle,radius=1cm,rowsep=0.2cm] + X & Y \\ +[mnode=p] 1 & 2 +\end{psmatrix} +\end{LTXexample} +\vspace{2mm} + +\item \texttt{dianode} (dia):\index{dianode@\texttt{dianode} (dia)} Ein Knoten, der von +einer Raute umschlossen +wird, deren Umfang richtet sich nach dem Inhalt + +\vspace{2mm} +\begin{LTXexample}[width=.2\linewidth] +\begin{psmatrix}[mnode=dia,rowsep=0.2cm,colsep=0.7cm] + X & Y \\ + 1 & 2 +\end{psmatrix} +\end{LTXexample} +\vspace{2mm} + +\item \texttt{dotnode} (dot):\index{Rnode@\texttt{dotnode} (dot)} Es wird im unmarkierten +Fall ein gef\"ullter Kreisknoten gesetzt, der +u.\,a. \"uber den Parameter \texttt{dotscale} gesteuert +werden kann. + +\vspace{2mm} +\begin{LTXexample}[width=.2\linewidth] +\begin{psmatrix}[mnode=dot,rowsep=0.2cm] +[mnode=dot,dotscale=3] X & Y \\ +[mnode=dot,dotscale=2,dotstyle=triangle]1&2 +\end{psmatrix} +\end{LTXexample} +\vspace{2mm} + +\item \texttt{rnode} (r):\index{Rnode@\texttt{rnode} (r)} +Unterscheidet sich von \bs{rnode} (R) in der +Festlegung des Knotenzentrums, das ohne optionale Parameter das Zentrum +der umgebenden Box ist. Eingesetzter "`Text"' erscheint pur. + +\vspace{2mm} +\begin{LTXexample}[width=.2\linewidth] +\begin{psmatrix}[mnode=r,rowsep=0.2cm] + X & Y \\ + 1 & 2 +\end{psmatrix} +\end{LTXexample} +\vspace{2mm} + + + +\item \texttt{fnode} (f):\index{fnode@\texttt{fnode} (f)} Ein leerer +Rahmen, dessen Gr\"o{"s}e \"uber +\texttt{framesize=} und +Koordinatenfestlegungen beeinflusst werden kann.%\footnote{Diese Funktion +%ist bisher nur eingeschr\"ankt nutzbar, die K\"astchen einer Zeile werden nicht getrennt. +%Mit "`Text"' gef\"ullte K\"astchen k\"onnen einfach mit \bs{\texttt{fbox}\{ +%\}} oder \bs{\texttt{psframebox}\{ \}} gesetzt werden.} + +\vspace{2mm} +\begin{LTXexample}[width=.2\linewidth] +\begin{psmatrix}[mnode=f,rowsep=0.2cm] + X & Y \\ + 1 & 2 +\end{psmatrix} +\end{LTXexample} +\vspace{2mm} + + +\item \texttt{circlenode} +(circle):\index{circlenode@\texttt{circlenode} (circle)} Entspricht +weitgehend \texttt{Circlenode}. Es +kann aber nicht der Radius ge\"andert werden. + +\vspace{2mm} +\begin{LTXexample}[width=.2\linewidth] +\begin{psmatrix}[mnode=circle,rowsep=0.2cm,colsep=1cm] + X & Y \\ + 1 & 2 +\end{psmatrix} +\end{LTXexample} +\vspace{2mm} + +\item \texttt{ovalnode} (oval):\index{ovalnode@\texttt{ovalnode} (oval)} Ovaler Knoten, +dessen Gr\"o"se aus dem Inhalt resultiert. + +\vspace{2mm} +\begin{LTXexample}[width=.2\linewidth] +\begin{psmatrix}[mnode=oval,rowsep=0.2cm,colsep=0.7cm] + XX & YY \\ + 1 & 2 +\end{psmatrix} +\end{LTXexample} +\vspace{2mm} + + +\item \texttt{trinode} (tri):\index{trinode@\texttt{trinode} (tri)} +Dreieck, dessen Gr\"o"se aus dem Inhalt resultiert. + +\vspace{2mm} +\begin{LTXexample}[width=.2\linewidth] +\begin{psmatrix}[mnode=tri,rowsep=0.2cm,colsep=0.7cm] + X & Y \\ + 1 & 2 +\end{psmatrix} +\end{LTXexample} +\vspace{2mm} + +Mit der Option \texttt{trimode}\index{trimode@\texttt{trimode}} kann die Lage der Dreiecke verändert +werden. Die Sternversion verkleinert die Basis und erzeugt aus +stumpfwinkligen (Winkel zwischen 90 und 180 Grad) spitzwinkelige (kleiner +als 90 Grad) Dreiecke. +\vspace{2mm} +\begin{table}[H] +\centering +\caption{Ver\"anderung der Dreieckslage} +\begin{tabular}{@{}ll@{}} +Befehl & Lage des Dreiecks \\ \hline +\texttt{trimode=U} & Spitze oben \\ +\texttt{trimode=D} & Spitze unten \\ +\texttt{trimode=R} & Spitze rechts \\ +\texttt{trimode=L} & Spitze links +\end{tabular} +\end{table} + +\vspace{2mm} +\begin{LTXexample}[width=.25\linewidth] +\begin{pspicture}(0,-2)(3,2) +\begin{psmatrix}[mnode=tri,rowsep=0.2cm,colsep=0.7cm] + [trimode=U] Dreieck \\ + [trimode=*D]Dreieck +\end{psmatrix} +\end{pspicture} +\end{LTXexample} +\vspace{2mm} + + + \item \texttt{no node} (none):\index{no node@\texttt{no node} (none)} Ohne Knoten, was für das + Einf\"ugen von Verbindungslinien sinnvoll sein kann. + + +\end{compactitem} + + + +\subsection{emnode}\index{emnode@\texttt{emnode}} + +Mit \texttt{emnode} k\"onnen verschiedene Arten (Parameter wie bei +\texttt{mnode} von Knoten für "`leere"' Zellen gesetzt +werden. Es muss also nichts in die Zellen eingetragen werden. Wie +nachfolgendes Beispiel auch belegt, kann es dabei auf der rechten Seite zu +fehlerhaften Ausgaben kommen, weil +\bs{pst-node}\index{pst-node@\texttt{pst-node}} da noch nicht v\"ollig korrekt +arbeitet. + + +\vspace{2mm} +\begin{LTXexample}[width=.2\linewidth] +\begin{psmatrix}[emnode=circle,rowsep=0.2cm,colsep=2cm] + & \\ + & +\end{psmatrix} +\end{LTXexample} +\vspace{2mm} + +\subsection{nodealign}\index{nodealign@\texttt{nodealign}} + +Der Parameter \texttt{nodealign} kann in [\texttt{nodealign=true}] +abge\"andert werden, um das Zentrum des Knotens auf die Basisebene zu +verschieben (vgl. \cite[S.\,259]{PSTricks2}). + +\section{Parameter zu Zellen und Zeilen} + +\subsection{name}\index{name@\texttt{name}} + +Der Parameter \texttt{name} erm\"oglicht es, jeder Zelle einen +selbstgew\"ahlten Namen zu geben, der am Anfang einer Zelle eingef\"ugt werden +muss. Dies kann beim Setzen von Linien die +Arbeit erleichtern, man muss dann nicht die Positionen ausz\"ahlen. + +\vspace{2mm} +\begin{LTXexample}[width=.4\linewidth] +\begin{psmatrix}[emnode=r,colsep=0.4cm, + rowsep=0.4cm] + & [name=A] Buch & \\ +[name=B]Fachbuch & [name=C]Lehrbuch & [name=D]Roman +\end{psmatrix} +\psset{nodesep=3pt,arrows=->} +\ncline{A}{B} \ncline{A}{C} \ncline{A}{D} +\end{LTXexample} +\vspace{2mm} + + +Au"serdem ist es \"uber diese Zellenfestlegung m\"oglich, auch \Lcs{pcline} und +\Lcs{psline} in einer Matrixumgebung zu benutzen. Diese nehmen die +Koordinatenargumente (hier gleich Zellennamen) aber in runden Klammern, wie +in dem folgenden Beispiel zu sehen ist. + +\vspace{2mm} +\begin{LTXexample}[width=.45\linewidth] +\begin{psmatrix}[emnode=r,colsep=1cm, + rowsep=0.4cm] +[name=A]Buch \psspan{3} & \\[1cm] +[name=B]Fachbuch & [name=C]Lehrbuch & +[name=D]Roman +\end{psmatrix} +\psset{nodesep=3pt,arrows=->,linecolor=red} +\psline(A)(C) +\pcline(A)(B) +\nbput*[nrot=:D]{\footnotesize \texttt{pcline}} +\ncline{A}{D} +\naput*[nrot=:U]{\footnotesize \texttt{ncline}} +\end{LTXexample} + +\Lcs{pcline} geht immer vom Zentrum aus und kann nicht an einer +Umgebungsbox beginnen oder aufh\"oren. Sie kann deshalb von +\texttt{nodesep} nicht beeinflusst werden. Andere Parameter -- +beispielsweise \texttt{offset=},\index{offset@\texttt{offset}} der eine vertikale Verschiebung +erm\"oglicht, -- k\"onnen das aber schon. \Lcs{psline} +reagiert wiederum darauf nicht. + +\vspace{2mm} +\begin{LTXexample}[width=.3\linewidth] +\begin{psmatrix}[emnode=r,colsep=1cm,rowsep=0.4cm] +[name=A]Fachbuch & \\[1cm] + & [name=C]Roman +\end{psmatrix} +\psset{nodesep=3pt,arrows=<-,linecolor=red,offset=0.3cm} +\pcline(A)(C) +\pcline(C)(A) +\end{LTXexample} + +\begin{LTXexample}[width=.3\linewidth] +\begin{psmatrix}[emnode=r,colsep=1cm,rowsep=0.4cm] + [name=A] Fachbuch & \\[1cm] + & [name=C] Roman +\end{psmatrix} +\psset{nodesep=3pt,arrows=->,linecolor=red,offset=1cm} +\psline(A)(C) +\psline(C)(A) +\end{LTXexample} + + + +\subsection{mcol}\index{mcol@\texttt{mcol}} + +Mit \texttt{mcol} kann lokal und global der horizontale +Zellenabstand\index{Zellenabstand!horizontal} +mit den Optionen \texttt{l,r,c} modifiziert werden. + +\vspace{2mm} +\begin{LTXexample}[width=.4\linewidth] +\begin{psmatrix}[emnode=r,colsep=0.4cm, + rowsep=0.4cm,mcol=r] + & [name=A] Buch & \\ +[name=B]Fachbuch & [name=C]Lehrbuch & [name=D]Roman +\end{psmatrix} +\psset{nodesep=3pt,arrows=->} +\ncline{A}{B} \ncline{A}{C} \ncline{A}{D} +\end{LTXexample} +\vspace{2mm} + +\begin{LTXexample}[width=.4\linewidth] +\begin{psmatrix}[emnode=r,colsep=0.4cm, + rowsep=0.4cm,mcol=l] + & [name=A]Buch & \\ +[name=B]Fachbuch & [name=C]Lehrbuch & [name=D]Roman +\end{psmatrix} +\psset{nodesep=3pt,arrows=->} +\ncline{A}{B} \ncline{A}{C} \ncline{A}{D} +\end{LTXexample} + +\subsection{rowsep und colsep}\index{Abstand!Zellen und Zeilen} + +Mit \texttt{rowsep}\index{rowsep@\texttt{rowsep}} kann man den +vertikalen und mit \texttt{colsep}\index{colsep@\texttt{colsep}} +den horizontalen Abstand zwischen +den Zeilen bzw. Zellen regulieren; welchen hinzuf\"ugen oder mit einem +negativen Wert reduzieren (siehe Beispiele bei \texttt{name}). + +\subsection{mnodesize}\index{mnodesize@\texttt{mnodesize}} + +Im Defaultfall wird die Breite der Zellen\index{Zelle!Breite} von deren Inhalt bestimmt; +innerhalb einer Zellenspalte von der mit dem gr\"o"sten Umfang. Mit +\texttt{mnodesize=} kann allen Spalten dieselbe Breite gegeben werden. +Dabei ist zu beachten, dass kein automatischen +Zeilenumbruch\index{Zelle!Zeilenumbruch} in den Zellen +erfolgt. Man kann in eine Zelle jedoch mehrere Zeilen über eine Tabelle +einbringen. + +\begin{LTXexample}[width=.52\linewidth] +\begin{psmatrix}[emnode=r, +colsep=-0.4cm,rowsep=0.6cm, +mnodesize=3cm] +& [name=A] + \begin{tabular}{c}Grafische\\Grundelemente\end{tabular} & \\ +[name=B]Linien & [name=C]Polygone & +[name=D]Rahmen +\end{psmatrix} +\psset{nodesep=3pt,arrows=->} +\ncline{A}{B} \ncline{A}{C} +\ncline{A}{D} +\end{LTXexample} + +Wenn der von \texttt{mnodesize=} festgelegte Raum nicht ausreichend ist +erweitert sich einfach die Zelle. + +\subsection{psspan}\index{psspan@\texttt{psspan}} + +Mit \texttt{psspan\{n\}} k\"onnen Zellen analog zu +\bs{multicolumn}\index{multicolumn@\texttt{\textbackslash{multicolumn}}} mehrere +Zellen\index{Zellen!zusammenfassen} zusammengefasst werden. + +\begin{LTXexample}[width=.4\linewidth] +\begin{psmatrix}[emnode=r,colsep=0.4cm, +rowsep=0.4cm] +[name=A]Buch \psspan{3} & \\ +[name=B]Fachbuch & [name=C]Lehrbuch & [name=D]Roman +\end{psmatrix} +\psset{nodesep=3pt,arrows=->} +\ncline{A}{B} \ncline{A}{C} \ncline{A}{D} +\end{LTXexample} + + +\section{Knotenverbindungen}\index{Knotenverbindung} + +Die Knotenverbindungen beginnen in der Regel mit \texttt{nc} und haben die Syntax: + +\begin{BDef} +\bs{Knotenverbindung}\OptArgs\{Pfeile\}\{KnotenA\}\{KnotenB\} +\end{BDef} + +Sie gehen von einem Knoten zu einem anderen, wenn es nicht anders festgelegt +wurde, ist die Zielorientierung die Knotenmitte. + +Die Knotenverbindungen können über eine Reihe von Parametern geändert +werden (vgl. \cite[S.\,43\,f]{PSTricks2} und \cite{siart}). Einige, die für das Zeichnen von +Strukturen besonders relevant sind, werden in der nachfolgenden Tabelle +aufgelistet:\index{Knotenverbindung!Parameter} + +\begin{table}[H] +\centering +\caption{Parameter f\"ur Knotenverbindungen} +\begin{tabular}{@{}lll@{}} +Name & Werte & Vorgabe \\ \hline +\texttt{linewidth} & <Wert>\OptEinh\ & 0.8pt \\ +\texttt{linecolor} & <Farbe> & black \\ +\texttt{linestyle} & none|solid|dotted|dashed & solid \\ +\texttt{shadow} & <an (true)/aus (false)> & false \\ +\texttt{shadowsize} & <Wert>\OptEinh\ & 3pt \\ +\texttt{shadowangle} & <Winkel> & $-$45 \\ +\texttt{shadowcolor} & <Farbe> & darkgray \\ +\texttt{arrows} & <Pfeiltyp> & -- \\ +\texttt{doubleline} & <true/false> & false +\end{tabular} +\end{table} + +\subsection{ncline} + +Mit \Lcs{ncline} wird eine direkte Linie von einem Knoten zum anderen +gezogen\footnote{Wenn Sie das nächste Beispiel mit den +folgenden Beispielen vergleichen, können Sie auch sehen, dass eine bessere +Positionierung in einer einfachen Box über die Umgebung +\bs{\texttt{pspicture}} +m\"oglich ist. Zumal ohne diese Umgebung die Kurvenlinien \"uber die Box +hinausragen w\"urden, wie dies im ersten Beispiel zu \texttt{ncdiag} der +Fall ist.}. + +\begin{LTXexample}[width=.35\linewidth] +\begin{psmatrix}[emnode=r,colsep=2cm] + KnotenX & KnotenY +\end{psmatrix} +\ncline[linecolor=red]{1,1}{1,2} +\end{LTXexample} + + +\subsection{ncarc}\xLcs{ncarc} + +Eine Kurve verbindet die Knoten. + +\begin{LTXexample}[width=.35\linewidth] +\begin{pspicture}(0,-0.5)(4,1) +\begin{psmatrix}[emnode=r,colsep=2cm] + KnotenX & KnotenY +\end{psmatrix} +\ncarc[linecolor=red]{<->}{1,1}{1,2} +\end{pspicture} +\end{LTXexample} + +Mit der Option \texttt{arcangle=}\index{arcangle@\texttt{arcangle}} kann der +Steigungswinkel\index{Steigungswinkel} erh\"oht werden. + +\begin{LTXexample}[width=.35\linewidth] +\begin{pspicture}(0,-0.5)(4,1) +\begin{psmatrix}[emnode=r,colsep=2cm] + KnotenX & KnotenY +\end{psmatrix} +\ncarc[arcangle=60,linecolor=red]{<->}{1,1}{1,2} +\end{pspicture} +\end{LTXexample} + +In der Sternchenversion wird der von der Kurve eingeschlossenen Raum mit +der Linienfarbe ausgefüllt. + +\begin{LTXexample}[width=.4\linewidth] +\begin{pspicture}(0,-0.5)(4,1) +\begin{psmatrix}[emnode=r,colsep=2cm] + KnotenX & KnotenY +\end{psmatrix} +\ncarc*[arcangle=60,linecolor=red]{<->}{1,1}{1,2} +\end{pspicture} +\end{LTXexample} + + +\subsection{ncdiag} + +Mit \Lcs{ncdiag} wird eine Linie in drei Segmente "`zerlegt"'. Man kann +diese Zerlegung über die Winkelfestlegungen (siehe folgendes Beispiel) +steuern. + +\begin{LTXexample}[width=.4\linewidth] +\begin{psmatrix}[emnode=r,colsep=2cm] + KnotenX & KnotenY +\end{psmatrix} +\ncdiag[angleA=90,angleB=-90,linecolor=red]{<->}{1,1}{1,2} +\end{LTXexample} + +Die Angabe \texttt{arm=0}\index{arm@\texttt{arm}} erzwingt eine gerade Linie. + +\begin{LTXexample}[width=.4\linewidth] +\begin{psmatrix}[emnode=r,colsep=2cm] + KnotenX & KnotenY +\end{psmatrix} +\ncdiag[angleA=-90,angleB=90,arm=0,linecolor=red]{<->}{1,1}{1,2} +\end{LTXexample} + +\subsection{ncdiagg} + +\Lcs{ncdiagg} ist \Lcs{ncdiag} \"ahnlich. Für den Ausgangsknoten wird aber +nur eine Verbindung gezeichnet. + +\begin{LTXexample}[width=.3\linewidth] +\usepackage{pstricks-add} +\begin{pspicture}(-1,-1)(4,6) + \circlenode{A}{A}\quad\circlenode{C}{C} + \rput(0,4){\circlenode{B}{B}} + \rput(1,5){\circlenode{D}{D}} + {\psset{arrowscale=2,linearc=0.2, + linecolor=red,armA=0.5,angleA=90} + \ncdiagg[lineAngle=-160]{->}{A}{B} + \ncput*[nrot=:U]{Linie I} + \ncdiagg[lineAngle=-160]{->}{C}{D} + \ncput*[nrot=:U]{Linie II}} +\end{pspicture} +\end{LTXexample} + +\subsection{ncbar} + +\Lcs{ncbar} arbeitet ähnlich wie \Lcs{ncdiag}. Zwei Knoten werden +durch drei Linienteile verbunden. + +\begin{LTXexample}[width=.4\linewidth] +\begin{pspicture}(0,1)(4,-2) +\begin{psmatrix}[emnode=r] +\psset{arrowscale=2} +Verbinde {\rnode{A}{KnotenX}} mit +{\rnode{B}{KnotenY}}! +\end{psmatrix} +\ncbar[nodesep=3pt,angleA=-90,angleB=90,linecolor=red,arrows=<->,arrowscale=2, +arm=0.8]{A}{B} +\end{pspicture} +\end{LTXexample} + + +\subsection{ncbarr} + +\Lcs{ncbarr} verwendet f\"unf Liniensegmente und erstellt damit eine +S-f\"ormige Verbindung. + +\begin{LTXexample}[width=.3\linewidth] +\begin{psmatrix} + & \circlenode{X}{X}\\[1cm] + & \circlenode{Y}{Y} +\end{psmatrix} +\ncbarr[angleA=0,linecolor=red]{X}{Y} +\end{LTXexample} + + +\subsection{ncangle} + +\Lcs{ncangle} erm\"oglich genauer berechnete dreiteilige Linien. Es +arbeitet analog zu \Lcs{ncdiag}. + +\begin{LTXexample}[width=.37\linewidth] +\begin{pspicture}(0,1)(4,-1) +\begin{psmatrix}[emnode=r,colsep=2cm, + rowsep=0.5cm] +KnotenX & KnotenY \\ +\end{psmatrix} +\ncdiag[angleA=-90,angleB=135,armA=1cm,armB=1cm, +linearc=.5,linecolor=red]{->}{1,1}{1,2} +\end{pspicture} +\end{LTXexample} + +\subsection{ncangles} + +\Lcs{ncangles} produziert viergliedrige Linien. + +\begin{LTXexample}[width=.4\linewidth] +\begin{pspicture}(0,1)(4,-2.3) +\begin{psmatrix}[emnode=r,colsep=2cm, + rowsep=0.5cm] +\psframebox{\emph{KnotenX}} & +\psframebox{\emph{KnotenY}} +\end{psmatrix} +\ncangles[angleA=-90,angleB=135,armA=1cm, + armB=1cm, +linearc=.15,linecolor=red]{->}{1,1}{1,2} +\rput[bl](-5,-0.7){armA} +\rput[rB](-0.4,0.5){armB} +\end{pspicture} +\end{LTXexample} + +\subsection{ncloop} + +\Lcs{ncloop} setzt f\"unfgliedrige Linien. Gegenüber \Lcs{ncangles} +kommt noch die Option \texttt{loopsize}\index{loopsize@\texttt{loopsize}} hinzu, die die +H\"ohe für einen Loop (eine Schlinge) vorgibt. + + +\begin{LTXexample}[width=.45\linewidth] +\begin{pspicture}(-1.5,-1)(4,2) +\rnode[lB]{A}{\psframebox{Knoten mit Schlinge}} +\ncloop[angleB=180,loopsize=1,arm=.5, + linearc=.2,linecolor=red]{->}{A}{A} +\ncput[npos=3.5,nrot=:U]{\psline{|<->|}% + (0.5,-0.2)(-0.5,-0.2)} +\nbput[npos=3.5,nrot=:D,labelsep=.35cm]{% + {\small\texttt{loopsize}}} +\end{pspicture} +\end{LTXexample} + +\subsection{nccurve} + +\Lcs{nccurve} setzt eine B\`ezierkurve zwischen zwei Knoten, die über +die Winkel \texttt{angleA} und \texttt{angleB} sowie den +Kurvenparameter\index{Kurvenparameter} +\texttt{ncurv}\index{nccurv@\texttt{nccurv}} gesteuert werden kann. + +\begin{LTXexample}[width=.4\linewidth] +\begin{psmatrix}[emnode=r,colsep=2cm, +rowsep=0.5cm] +{\rnode{A}{\psframebox{KnotenX}}} & \\ +& {\rnode{B}{\psframebox{KnotenY}}} +\end{psmatrix} +\nccurve[angleB=180,ncurv=0.9, +linecolor=red]{A}{B} +\end{LTXexample} + +\subsection{nccircle} + +\Lcs{nccircle} erzeugt \"uber einem Knoten einen ungef\"ullten oder gef\"ullten +(Sternchenversion) Kreis. + +\vspace{2mm} +\begin{LTXexample}[width=.25\linewidth] +\begin{pspicture}(-1,-1)(3,2) +\begin{psmatrix}[emnode=r] +\rnode{A}{herum} +\end{psmatrix} +\nccircle[nodesep=3pt,linecolor=red]{->}{A}{.8cm} +\kern 5pt +\end{pspicture} +\end{LTXexample} + +\vspace{2mm} +\begin{LTXexample}[width=.25\linewidth] +\begin{pspicture}(-1,-1)(3,2) +\begin{psmatrix}[emnode=r] +\rnode{A}{dar\"uber} +\end{psmatrix} +\nccircle*[nodesep=3pt,linecolor=lightgray]{->}{A}{1cm} +\kern 5pt +\end{pspicture} +\end{LTXexample} + +\subsection{offset} + +Die Option \texttt{offset}\index{offset@\texttt{offset}} verschiebt, wie +schon bei den Erl\"auterungen zu dem Parameter \texttt{name} angesprochen, +die Verbindungslinie parallel zum eigentlich festgelegten Verlauf. Dies ist +besonders bei zwei Linien sinnvoll und effektiv. +Wenn man jede Linien einzeln modifizieren m\"ochte, kann dies mit +\texttt{offsetA}\index{offsetA@\texttt{offsetA}} und +\texttt{offsetB}\index{offsetB@\texttt{offsetB}} +geschehen. Beispielsweise, wenn von +einem Knoten zwei Verbindungen ausgehen sollen. + +\vspace{2mm} +\begin{LTXexample}[width=.2\linewidth] +\begin{psmatrix}[emnode=r,colsep=1cm,rowsep=0.4cm] +[name=A]Buch \\ +[name=B]Fachbuch \\ +[name=C]\LaTeX buch +\end{psmatrix} +\psset{nodesep=3pt,arrows=->,linecolor=red,offset=0.3cm} +\pcline[offsetA=0.3cm](A)(B) +\pcline[offsetB=-0.3cm](A)(C) +\end{LTXexample} + + +\section{Linien beschriften}\index{Linienbeschriftung} + +\subsection{Beschriftung einf\"ugen} + +\psframebox{\parbox{0.65\textwidth}{ +\bs ncput\psframebox[framesep=2pt,fillstyle=solid,fillcolor=black!20,linecolor=black!20]{*} +[\psframebox[framesep=2pt,fillstyle=solid,fillcolor=black!20,linecolor=black!20]{\texttt{Optionen}}] +\{Beschriftung auf der Linie\}\\ +\bs naput\psframebox[framesep=2pt,fillstyle=solid,fillcolor=black!20,linecolor=black!20]{*} +[\psframebox[framesep=2pt,fillstyle=solid,fillcolor=black!20,linecolor=black!20]{\texttt{Optionen}}] +\{Beschriftung \"uber der Linie\}\\ +\bs nbput\psframebox[framesep=2pt,fillstyle=solid,fillcolor=black!20,linecolor=black!20]{*} +[\psframebox[framesep=2pt,fillstyle=solid,fillcolor=black!20,linecolor=black!20]{\texttt{Optionen}}] +\{Beschriftung unter der Linie\} +}} + +\begin{LTXexample}[width=.4\linewidth] +\begin{pspicture}(0,1)(4,-2) +\begin{psmatrix}[emnode=r] +\psset{arrowscale=2} +Verbinde {\rnode{A}{KnotenX}} mit +{\rnode{B}{KnotenY}}! +\end{psmatrix} +\ncbar[nodesep=3pt,angleA=-90,angleB=90, +linecolor=red,arrows=<->,arrowscale=2,arm=0.8] +{A}{B} +\ncput*{auf} +\naput*{\"uber} +\nbput*{unter} +\end{pspicture} +\end{LTXexample} + +Die angegebene Sternchenversion ist besser geeignet, da sie die Linien +überschreibt und damit die Beschriftungen besser sichtbar sind (vgl. mit +der nachfolgenden Beispielversion ohne Sternchen). Das betrifft besonders +die \texttt{naput}-Version. + +\begin{LTXexample}[width=.4\linewidth] +\begin{pspicture}(0,1)(4,-2) +\begin{psmatrix}[emnode=r] +\psset{arrowscale=2} +Verbinde {\rnode{A}{KnotenX}} mit +{\rnode{B}{KnotenY}}! +\end{psmatrix} +\ncbar[nodesep=3pt,angleA=-90,angleB=90, +linecolor=red,arrows=<->,arrowscale=2,arm=0.8] +{A}{B} +\ncput{auf} +\naput{\"uber} +\nbput{unter} +\end{pspicture} +\end{LTXexample} + +Ohne die Angabe von Optionen wird die Beschriftung auf den sichtbaren +Linienteil geschrieben. Sie orientiert sich dabei an der Linienmitte. +Mit \texttt{npos=}\index{npos@\texttt{npos}} und +\text{nrot=}\index{nrot@\texttt{nrot}} kann diese Orientierung ge\"andert werden. + +Mit \Lcs{psset}\{labelset=\} kann der Abstand zwischen Label und Linie +reguliert werden. Wenn der Wert auf 0pt gesetzt wird (also direkt über oder +unter der Linie, sollte f\"ur \Lcs{naput} bzw. \Lcs{nbput} nicht die +Sternchenversion gew\"ahlt werden, die wahrscheinlich ohnehin nur f\"ur +\Lcs{ncput} sinnvoll scheint. Die Nullversion ist immer dann zu nehmen, +wenn es Probleme mit dem Sichtbarmachen des Labels gibt. + +\subsection{npos} + +\texttt{npos} ermöglicht die Platzierung der Beschriftung auf den +verschiedenen Segmenten des entsprechenden Linientyps. Die Zahl gibt vor +dem Punkt die Segmentnummer (0,1,2,\ldots) und nach dem Punkt den Abstand +zum Segmentanfang an. Im folgenden Beispiel bekommt die Beschriftung den +Wert 1.2 und steht damit auf dem zweiten Liniensegment 20\% vom +Segmentanfang. + +\begin{table}[H] +\centering +\caption{Zusammenstellung der Kurzformen für die Drehwinkel}\label{tab:wind} + \begin{tabular}{@{}l|*{8}{>{\ttfamily}c}@{}} + \emph{Buchstabe} & U & L & D & R & N & W & S & E \\\hline + \emph{Bedeutung} & Up& Left&Down&Right&North&West&South&East\\ + \emph{Enstprechung} &0&90&180&270&*0&*90&*180&*270 +% +% \begin{tabular}{@{}>{\ttfamily}llr@{}} +% \textrm{Buchstabe} & Bedeutung & Winkel\\\hline +% U & Up & 0\\ +% L & Left & 90\\ +% D & Down & 180\\ +% R & Right & 270\\ +% N & North & *0\\ +% W & West & *90\\ +% S & South & *180\\ +% E & East & *270 + \end{tabular} +\end{table} + +\begin{LTXexample}[width=.4\linewidth] +\begin{pspicture}(0,1)(4,-2) +\begin{psmatrix}[emnode=r] +\psset{arrowscale=2} +Verbinde {\rnode{A}{KnotenX}} mit +{\rnode{B}{KnotenY}}! +\end{psmatrix} +\ncbar[nodesep=3pt,angleA=-90,angleB=90, +linecolor=red,arrows=<->,arrowscale=2,arm=0.8] +{A}{B} +\ncput*[npos=1.2]{auf} +\end{pspicture} +\end{LTXexample} + + +\subsection{nrot} + +\texttt{nrot=:Winkel/K\"urzel} erm\"oglicht es die Beschriftung zu +drehen: + +\begin{table}[htb] +\centering\tabcolsep=3pt +\caption{Vergleich der verschiedenen Knotenverbindungen bez\"uglich ihrer +Segmentanzahl}\label{tab:segmente} +\hspace*{-1em} +\begin{tabular}{@{} lccc | lccc @{}} +\emph{Verbindung} & \emph{Segm.} & \emph{Bereich} & \emph{Vorgabe} & +\emph{Verbindung} & \emph{Segm.} & \emph{Bereich} & \emph{Vorgabe}\\\hline + \Lcs{ncline} & $1$ & $0\leq npos\leq 1$ & $0.5$ & + \Lcs{nccurve} & $1$ & $0\leq npos\leq 1$ & $0.5$\\ + \Lcs{ncarc} & $1$ & $0\leq npos\leq 1$ & $0.5$ & + \Lcs{ncbar} & $3$ & $0\leq npos\leq 3$ & $1.5$\\ + \Lcs{ncdiag} & $3$ & $0\leq npos\leq 3$ & $1.5$ & + \Lcs{ncdiagg} & $2$ & $0\leq npos\leq 2$ & $0.5$\\ + \Lcs{ncangle} & $3$ & $0\leq npos\leq 3$ & $1.5$ & + \Lcs{ncangles} & $4$ & $0\leq npos\leq 4$ & $1.5$\\ + \Lcs{ncloop} & $5$ & $0\leq npos\leq 5$ & $2.5$ & + \Lcs{nccircle} & $1$ & $0\leq npos\leq 1$ & $0.5$\\ +\end{tabular} +\end{table} + + +\begin{LTXexample}[width=.4\linewidth] +\begin{pspicture}(0,1)(4,-2) +\begin{psmatrix}[emnode=r] +\psset{arrowscale=2} +Verbinde {\rnode{A}{KnotenX}} mit +{\rnode{B}{KnotenY}}! +\end{psmatrix} +\ncbar[nodesep=3pt,angleA=-90,angleB=90, +linecolor=red,arrows=<->,arrowscale=2,arm=0.8] +{A}{B} +\ncput*[nrot=:L]{auf} +\end{pspicture} +\end{LTXexample} + +\section{Strukturbeispiele} + + + +Jetzt sollen noch einige wenige Beispiele von Struktur\"ubersichten +vorgestellt werden, die von mir in der \texttt{pstmatrix}-Umgebung gesetzt wurden. + +\begin{figure}[H]\centering +\begin{psmatrix}[colsep=0.8,rowsep=0.8] +\psframebox[fillcolor=red!40,fillstyle=solid,doubleline=true] +{$\left[\tabular{c}GF: /Pinguin/\\ WA: +N\endtabular\right]$} + & \psframebox[fillcolor=yellow!40,fillstyle=solid]{Vogel} \\ +\psframebox[fillcolor=blue!40,fillstyle=solid,doubleline=true]{\tabular{l}aufrecht\\ gehend\endtabular} + & \psshadowbox[fillcolor=red,fillstyle=solid,shadow=true,blur=true,shadowsize=5pt]{\textbf{Pinguin}} & + \psframebox[fillcolor=blue!40,fillstyle=solid,doubleline=true]{flugunfähig}\\ + & \psframebox[fillcolor=green!40,fillstyle=solid]{Felsenpinguin} +\end{psmatrix} +\ncline{1,1}{2,2} \naput{s} +\ncline{1,2}{2,2} \naput{ob} +\ncline{2,1}{2,2} \naput{a} +\ncline{2,2}{2,3} \naput{a} +\ncline{2,2}{3,2} \naput{ub} +\caption{Ein Frame} +\end{figure} + +\begin{lstlisting}[language={[LaTeX]TeX},basicstyle=\rmfamily\small,backgroundcolor={\color{yellow!20}},frame=single] +\usepackage{pst-node,pst-blur} +\begin{psmatrix}[colsep=0.8,rowsep=0.8] +\psframebox[fillcolor=red!40,fillstyle=solid,doubleline=true] +{$\left[\tabular{c}GF: /Pinguin/\\ WA: +N\endtabular\right]$} + & \psframebox[fillcolor=yellow!40,fillstyle=solid]{Vogel} \\ +\psframebox[fillcolor=blue!40,fillstyle=solid,doubleline=true]{\tabular{l}aufrecht\\ gehend\endtabular} + & \psshadowbox[fillcolor=red,fillstyle=solid,shadow=true,blur=true,shadowsize=5pt]{\textbf{Pinguin}} & + \psframebox[fillcolor=blue!40,fillstyle=solid,doubleline=true]{flugunfähig}\\ + & \psframebox[fillcolor=green!40,fillstyle=solid]{Felsenpinguin} +\end{psmatrix} +\ncline{1,1}{2,2} \naput{s} +\ncline{1,2}{2,2} \naput{ob} +\ncline{2,1}{2,2} \naput{a} +\ncline{2,2}{2,3} \naput{a} +\ncline{2,2}{3,2} \naput{ub} +\end{lstlisting} + + +\begin{figure}[H]\centering +\begin{psmatrix}[colsep=0.8,rowsep=0.8] +\psset{shortput=nab,framesep=10pt} + \psshadowbox[framearc=0.25,fillcolor=blue!20,fillstyle=solid,doubleline=true]{Lebewesen} & + \psframebox[fillcolor=yellow!40,fillstyle=solid]{allgemeine Kategorisierung}\\ + \psshadowbox[framearc=0.25,fillcolor=red!40,fillstyle=solid,doubleline=true]{\textbf{Löwe}} +& \psframebox[fillcolor=red!40,fillstyle=solid,doubleline=true]{Basisebene}\\ + \psshadowbox[framearc=0.25,fillcolor=blue!20,fillstyle=solid,doubleline=true]{Höhlenlöwe} +& \psframebox[fillcolor=green!30,fillstyle=solid]{spezielle Kategorisierung} +\end{psmatrix} +\psset{nodesep=2pt,arrows=->} +\ncline[arrowscale=2]{1,1}{2,1} +\ncline[arrowscale=2]{2,1}{3,1} +\caption{Eine konzeptuelle Kategorisierung} +\end{figure} + +\begin{lstlisting}[language={[LaTeX]TeX},basicstyle=\rmfamily\small,backgroundcolor={\color{yellow!20}},frame=single] +\begin{psmatrix}[colsep=0.8,rowsep=0.8] +\psset{shortput=nab,framesep=10pt} + \psshadowbox[framearc=0.25,fillcolor=blue!20,fillstyle=solid,doubleline=true]{Lebewesen} & + \psframebox[fillcolor=yellow!40,fillstyle=solid]{allgemeine Kategorisierung}\\ + \psshadowbox[framearc=0.25,fillcolor=red!40,fillstyle=solid,doubleline=true]{\textbf{Löwe}} +& \psframebox[fillcolor=red!40,fillstyle=solid,doubleline=true]{Basisebene}\\ + \psshadowbox[framearc=0.25,fillcolor=blue!20,fillstyle=solid,doubleline=true]{Höhlenlöwe} +& \psframebox[fillcolor=green!30,fillstyle=solid]{spezielle Kategorisierung} +\end{psmatrix} +\psset{nodesep=2pt,arrows=->} +\ncline[arrowscale=2]{1,1}{2,1} +\ncline[arrowscale=2]{2,1}{3,1} +\end{lstlisting} + +\begin{figure}[H]\centering +\psset{framearc=0.2,shadow=true,fillstyle=solid,shadowcolor=black!55} +\begin{psmatrix}[colsep=0,rowsep=0.9] + & & \psframebox[fillcolor=blue!30]{Synchronie}\\ + & \psframebox[fillcolor=red!30]{Sprache} & \\ + & & \psframebox[fillcolor=blue!30]{Diachronie} \\ +\psframebox[fillcolor=red!30]{Menschliche Rede} & & \\ + & \psframebox[fillcolor=red!30]{Sprechen} & + \end{psmatrix} + \psset{shadow=false} +\ncline[arrows=->,arrowscale=2]{2,2}{1,3} +\ncline[arrows=->,arrowscale=2]{2,2}{3,3} +\ncline[arrows=->,arrowscale=2]{4,1}{2,2} +\ncline[arrows=->,arrowscale=2]{4,1}{5,2} +\caption{F. de Saussure zu Sprache} +\end{figure} + +\begin{lstlisting}[language={[LaTeX]TeX},basicstyle=\rmfamily\small,backgroundcolor={\color{yellow!20}},frame=single] +\psset{framearc=0.2,shadow=true,fillstyle=solid,shadowcolor=black!55} +\begin{psmatrix}[colsep=0,rowsep=0.9] + & & \psframebox[fillcolor=blue!30]{Synchronie}\\ + & \psframebox[fillcolor=red!30]{Sprache} & \\ + & & \psframebox[fillcolor=blue!30]{Diachronie} \\ +\psframebox[fillcolor=red!30]{Menschliche Rede} & & \\ + & \psframebox[fillcolor=red!30]{Sprechen} & + \end{psmatrix} + \psset{shadow=false} +\ncline[arrows=->,arrowscale=2]{2,2}{1,3} +\ncline[arrows=->,arrowscale=2]{2,2}{3,3} +\ncline[arrows=->,arrowscale=2]{4,1}{2,2} +\ncline[arrows=->,arrowscale=2]{4,1}{5,2} +\end{lstlisting} + +\begin{figure}[H] \centering +\begin{psmatrix}[emnode=r,colsep=0.5cm,rowsep=0.5cm,mcol=c] + & & & & <Metall> & \\ + & & & [mnode=oval] 18 & &\\ + <WERKZEUG> & & & & & \\ + & & & &[mnode=tri] 12 &\\ + & & & & & <arbeiten> \\ + & & [mnode=C,linestyle=dashed,radius=0.5,mcol=l] & & &\\ + \fbox{12} & & & \fbox{51} & & \\ + & \fbox{36} & & & <Hammer> &\\ + <Feile> & & <Zange> & & & +\end{psmatrix} +\psset{arrowscale=2,labelsep=0pt} +\ncline{->}{1,5}{2,4} +\ncarc{->}{4,5}{2,4}\naput[npos=0.4]{OBJ} +\ncarc{->}{6,3}{4,5}\naput[npos=0.4]{INSTR} +\ncline{<->}{6,3}{3,1} +\ncarc{->}{6,3}{7,1}\naput[npos=0.4]{UB} +\ncarc{->}{6,3}{7,4}\naput[npos=0.4]{UB} +\ncarc{->}{6,3}{8,2}\naput[npos=0.4]{UB} +\ncarc{->}{9,1}{7,1} \ncarc{->}{9,3}{8,2} +\ncarc{->}{8,5}{7,4} \ncline{->}{5,6}{4,5} +\caption{Begriffliches Merkmalsnetz nach Hoffmann} +\end{figure} + +\begin{lstlisting}[language={[LaTeX]TeX},basicstyle=\rmfamily\small,backgroundcolor={\color{yellow!20}},frame=single] +\begin{psmatrix}[emnode=r,colsep=0.5cm,rowsep=0.5cm,mcol=c] + & & & & <Metall> & \\ + & & & [mnode=oval] 18 & &\\ + <WERKZEUG> & & & & & \\ + & & & &[mnode=tri] 12 &\\ + & & & & & <arbeiten> \\ + & & [mnode=C,linestyle=dashed,radius=0.5,mcol=l] & & &\\ + \fbox{12} & & & \fbox{51} & & \\ + & \fbox{36} & & & <Hammer> &\\ + <Feile> & & <Zange> & & & +\end{psmatrix} +\psset{arrowscale=2,labelsep=0pt} +\ncline{->}{1,5}{2,4} +\ncarc{->}{4,5}{2,4}\naput[npos=0.4]{OBJ} +\ncarc{->}{6,3}{4,5}\naput[npos=0.4]{INSTR} +\ncline{<->}{6,3}{3,1} +\ncarc{->}{6,3}{7,1}\naput[npos=0.4]{UB} +\ncarc{->}{6,3}{7,4}\naput[npos=0.4]{UB} +\ncarc{->}{6,3}{8,2}\naput[npos=0.4]{UB} +\ncarc{->}{9,1}{7,1} \ncarc{->}{9,3}{8,2} +\ncarc{->}{8,5}{7,4} \ncline{->}{5,6}{4,5} +\end{lstlisting} + +\newpage +\bgroup +\appendix + +%\addcontentsline{toc}{section}{Literaturverzeichnis} + +\nocite{*} +\raggedright + +\printbibliography +\egroup +\clearpage +\addcontentsline{toc}{section}{Index} +\printindex + + +\end{document} + + diff --git a/graphics/pstricks/contrib/pst-node/doc/pst-node-doc.bib b/graphics/pstricks/contrib/pst-node/doc/pst-node-doc.bib new file mode 100644 index 0000000000..24773cb3c6 --- /dev/null +++ b/graphics/pstricks/contrib/pst-node/doc/pst-node-doc.bib @@ -0,0 +1,97 @@ +%% -*-bibtex-*- +@STRING{tugboat = {TUGboat} } +@STRING{dtk = {{D}ie {\TeX}nische {K}om{\"o}die} } + +@Book{companion, + author = {Michel Goosens and Frank Mittelbach and Sebastian Rahtz and Dennis Roegel and Herbert Vo\ss}, + title = {The {\LaTeX} {G}raphics {C}ompanion}, + publisher = {{Addison-Wesley Publishing Company}}, + edition = {2}, + year = {2007}, + location = {Boston, Mass.} +} + +@Article{girou:01:, + author = {Denis Girou}, + title = {Pr\'esentation de {PST}ricks}, + journal = {Cahier {GUT}enberg}, + year = 1994, + volume = {16}, + month = apr, + pages = {21-70} +} + +@Article{girou:02:, + author = {{Timothy Van} Zandt and Denis Girou}, + title = {Inside {PST}ricks}, + journal = TUGboat, + year = 1994, + volume = {15}, + month = sep, + pages = {239-246} +} + +@Book{PostScript, + Author = {Kollock, Nikolai G.}, + Title = {Post{S}cript richtig eingesetzt: vom {K}onzept zum + praktischen {E}insatz}, + Publisher = {IWT}, + location = {Vaterstetten}, + year = 1989, +} + +@ctan{multido, + Title = {\texttt{multido.tex} - a loop macro, that supports fixed-point addition}, + Author = {{Timothy Van} Zandt}, + Organization = {CTAN}, + url = {/macros/generic/multido/}, + year = 2010, +version = {1.42}, +} + +@Book{PSTricks2, + author = {Herbert Vo\ss{}}, + title = {\texttt{PSTricks} -- {G}rafik f\"ur \TeX{} und \LaTeX}, + edition = {7}, + publisher = {DANTE and Lehmanns Media}, + year = {2016}, + location = {Heidelberg and Berlin} +} + +@Book{PSTricksE, + author = {Herbert Vo\ss{}}, + title = {\texttt{PSTricks} -- {G}raphics and {P}ost{S}cript for \LaTeX}, + edition = {1}, + publisher = {UIT}, + year = {2011}, + location = {Cambridge -- UK} +} + +@Book{LTXquick, + author = {Herbert Vo\ss{}}, + title = {{\LaTeX} quick reference}, + edition = {1}, + publisher = {UIT}, + year = {2012}, + location = {Cambridge -- UK} +} + +@Book{presentations, + author = {Herbert Vo\ss}, + title = {Presentations with \LaTeX}, + edition = {2}, + publisher = {DANTE and Lehmanns Media}, + year = {2017}, + location = {Heidelberg and Berlin} +} + + +@Book{tbt, + author = {Victor Eijkhout}, + title = {\TeX\ by Topic -- {A} \TeX{}nician Reference}, + edition = {1}, + publisher = {DANTE and Lehmanns Media}, + year = {2014}, + location = {Heidelberg and Berlin} +} + diff --git a/graphics/pstricks/contrib/pst-node/doc/pst-node-doc.pdf b/graphics/pstricks/contrib/pst-node/doc/pst-node-doc.pdf Binary files differnew file mode 100644 index 0000000000..6142db53b5 --- /dev/null +++ b/graphics/pstricks/contrib/pst-node/doc/pst-node-doc.pdf diff --git a/graphics/pstricks/contrib/pst-node/doc/pst-node-doc.tex b/graphics/pstricks/contrib/pst-node/doc/pst-node-doc.tex new file mode 100644 index 0000000000..d2280a3b39 --- /dev/null +++ b/graphics/pstricks/contrib/pst-node/doc/pst-node-doc.tex @@ -0,0 +1,2990 @@ +%% $Id: pst-node-doc.tex 696 2017-12-30 19:01:07Z herbert $ +\documentclass[fontsize=11pt,english,BCOR=10mm,DIV=12,bibliography=totoc,parskip=false,headings=small, + headinclude=false,footinclude=false,oneside]{pst-doc} +\listfiles + +\input{pst-node} +\let\pstFV\fileversion + +\usepackage[utf8]{inputenc} +\usepackage{pst-plot} +\let\belowcaptionskip\abovecaptionskip +% +\newcommand\xstrut{\vphantom{\tabular{c}Üg\\Üg\endtabular}} +\newcommand\psBox[3][white]{\rput(#2){\rnode{#2}{% + \psframebox[fillcolor=#1]{\xstrut\makebox[3.2cm]{\tabular{c}#3\endtabular}}}}} +\def\bgImage{% +\psscalebox{0.85}{% +\begin{pspicture}(-1,-1)(21,7) +\psset{framearc=0.2,shadow,fillstyle=solid,shadowcolor=black!55} +\psBox[blue!30]{7,6}{politische\\Kommunikation} +\psBox[red!30]{3,4}{interpersonale\\Kommunikation} + \psBox[red!30]{13,4}{massenmediale\\Kommunikation} +\psBox[green!30]{1,2}{starke\\Beziehung} + \psBox[green!30]{5,2}{schwache\\Beziehung} + \psBox[green!30]{9,2}{Fernsehen} + \psBox[green!30]{17,2}{Zeitungen} +\psBox[cyan!30]{7,0}{öffentlich-rechtl.\\Fernsehen} + \psBox[cyan!30]{11,0}{privates\\Fernsehen} + \psBox[cyan!30]{15,0}{Boulevard-\\Zeitungen} + \psBox[cyan!30]{19,0}{Abonnement-\\Zeitungen} +\end{pspicture} +\psset{shadow=false,angleA=-90,angleB=90,linewidth=2pt} +\ncangles{7,6}{3,4}\ncangles{7,6}{13,4} +\ncangles{3,4}{1,2}\ncangles{3,4}{5,2} +\ncangles{13,4}{9,2}\ncangles{13,4}{17,2} +\ncangles{9,2}{7,0}\ncangles{9,2}{11,0} +\ncangles{17,2}{15,0}\ncangles{17,2}{19,0}} +} +\newbox\filebox +\setbox\filebox=\hbox{% + \pspicture(-1,-.5)(1,.7) + \pspolygon[linearc=2pt,shadow,shadowangle=45,xunit=1.1]% + (-1,-.55)(-1,.5)(-.8,.5)(-.8,.65)(-.2,.65)(-.2,.5)(1,.5)(1,-.55) + \endpspicture} + +\addbibresource{\jobname.bib} + + +\lstset{explpreset={pos=l,width=-99pt,overhang=0pt,hsep=\columnsep,vsep=\bigskipamount,rframe={}}, + %mathescape,basicstyle=\small\ttfamily +} + +\begin{document} +\title{\texttt{pst-node}\\Nodes and node connections% +\\\small v.\pstFV} +%\docauthor{Michael Sharpe\\Herbert Vo\ss} +\author{Timothy Van Zandt\\Michael Sharpe\\Herbert Vo\ss} +\date{\today} + +\maketitle + +\begin{abstract} +This version of \LPack{pst-node} uses the extended keyval handling +of pst-xkey and has a lot of the macros which were recently in +the package \LPack{pstricks-add}. This documentation describes in the first part +the basic node commands and connection from the old PSTricks documentation. +The second part describes only the +new and changed stuff. . + +For some copatibility reason you can use the optional argument \Loption{97} +for the package, it loads the version from 1997, which only makes sense +when also running the main package \LPack{pstricks} with this option. + +\vfill +\noindent +Thanks to: Marco Daniel; Denis Girou; Rolf Niepraschk; Sebastian Rahtz; Andi Setiawan; +\end{abstract} + +\clearpage +\tableofcontents + +\clearpage +\part{Basic commands, connections and labels} + +\leavevmode +\marginpar{% + \leavevmode\lower 20pt\hbox{% + \hbox to0pt{\hbox to \linewidth{\hss\rnode{file}{\copy\filebox}\hss}\hss}% + \raise 10pt\hbox to \linewidth{\hss\large\bfseries\sffamily pst-node\hss}}}% + +The node and node connection macros let you connect information and place +labels, without knowing the exact position of what you are connecting or where +the lines should connect. These macros are useful for making graphs and trees, +mathematical diagrams, linguistic syntax diagrams, and connecting ideas of any +kind. They are the trickiest tricks in PSTricks! + +There are three components to the node macros: +\begin{description} + \item[Node definitions] The node definitions let you assign a name and shape + to an object. See Section \ref{S-nodes}. + \item[Node connections] The node connections connect two nodes, identified + by their names. See Section \ref{S-nc}. + \item[Node labels] The node label commands let you affix labels to the node + connections. See Section \ref{S-nodelabels}. +\end{description} + +You can use these macros just about anywhere. The best way to position them +depends on the application. For greatest flexibility, you can use the nodes in +a \Lenv{pspicture}, positioning and rotating them with \Lcs{rput}. You can also use +them in alignment environments. \LPack{pst-node} contains a special alignment +environment, \Lenv{psmatrix}, which is designed for positioning nodes in a grid, +such as in mathematical diagrams and some graphs. \Lcs{psmatrix} is described in +Section \ref{S-psmatrix}. \LPack{pst-node} also contains high-level macros for +trees. These are described in the documentation of \LPack{pst-tree}. + +But don't restrict yourself to these more obvious uses. For example: +\begin{center} + \rnode{A}{% + \parbox{12cm}{\raggedright + I made the file symbol a node. Now I can draw an + arrow so that you know what I am talking about.}} + \ncarc[nodesep=8pt]{->}{A}{file} +\end{center} + +\begin{lstlisting} + \rnode{A}{% + \parbox{4cm}{\raggedright + I made the file symbol a node. Now I can draw an + arrow so that you know what I am talking about.}} + \ncarc[nodesep=8pt]{->}{A}{file} +\end{lstlisting} + +%\psset{showNode} + +\section[Comparing nodes and coordinates]% + {Comparing nodes and coordinates\footnote{Christoph Bersch on \url{http://tex.stackexchange.com}}} + +The crucial point is understanding the difference between a node (A), which is created by \Lcs{pnode}, + and a pair of coordinates $(x,y)$: + +\begin{itemize} +\item + A coordinate pair, e.g. (1,1) specifies a relative point. + Its position depends on the current environment, whether its surrounded by \Lcs{psdot}\Largr{1,1} + text, or shifted with \Lcs{rput}(2,2)\texttt{\{\Lcs{psdot}(1,1)\}} etc. +\item + A node (A) refers to an absolute, fixed point on the page. This is independent of the environment. +\end{itemize} + +The following example resumes this. + +\begin{LTXexample}[width=3cm] +\begin{pspicture}[showgrid](2,2) +\rput(1,1){\pnode(1,1){A}} +\psdot(A) +\pnode(1,1){B} +\rput(1,1){\psdot[linecolor=red](B)} +\end{pspicture} +\end{LTXexample} + +The black dot is placed at (2,2), because \Lcs{rput} shifts the coordinate pair (1,1), +which is used to define node A. The red dots remains at (1,1) because \Lcs{rput} +has no effect on (B) after its definition: + +That's the essence of all node-stuff. + +Using \texttt{(!\Lcs{psGetNodeCenter}\{A\} A.x A.y)} is equivalent to (A). + +The parameter \Lkeyword{saveNodeCoors} saves the relative coordinates +at the time of the node definition. I.e. adding dots at \texttt{(!N-A.x N-A.y)} +and \texttt{(!N-B.x N-B.y)} in the above example places two dots at +(1,1), which are the coordinate pairs used to define both nodes A and B: + + +\begin{LTXexample}[width=3cm] +\begin{pspicture}[showgrid, saveNodeCoors](2,2) +\rput(1,1){\pnode(1,1){A}} +\psdot(A) +\pnode(1,1){B} +\rput(1,1){\psdot[linecolor=red](B)} + % +\psdot[dotstyle=+, dotscale=2](!N-A.x N-A.y) +\psdot[dotstyle=x, dotscale=2](!N-B.x N-B.y) +\end{pspicture} +\end{LTXexample} + +Resuming this: + +\begin{itemize} +\item +Coordinate pairs like (1, 1) or node expressions with \texttt{! N-A.x N-A.y} are relative and + are subject to scaling and translation like with \Lcs{rput}, \Lcs{scale}, \Lcs{translate} and such. +\item + Nodes (A) and node expressions with \Lcs{psGetNodeCenter} are fixed, »immutable« points. +\end{itemize} + + + + + +\section{Nodes}\label{S-nodes} + +Nodes have a name. a boundary and a center. +The center of a node is where node connections point to. The boundary is for +determining where to connect a node connection. The various nodes differ in +how they determine the center and boundary. They also differ in what kind of +visable object they create. + + +The\XInfoDanger[0]{} name is for refering to the node when making node connections and labels. +You specify the name as an argument to the node commands. The name must +contain only letters and numbers, and must begin with a letter. Bad node names +can cause PostScript errors. + + + + +Here are the nodes: + +\begin{BDef} +\Lcs{rnode}\OptArg{refpoint}\Largb{name}\Largb{stuff} +\end{BDef} + + \Lcs{rnode} puts \Larg{stuff} in a box. The center of the node is \Larg{refpoint}, which +you can specify the same way as for \Lcs{rput}. + +\begin{BDef} +\Lcs{Rnode}\Largb{name}\Largb{stuff} +\end{BDef} + + \Lcs{Rnode} also makes a box, but the center is set differently. If you align +\Lcs{rnode}'s by their baseline, differences in the height and depth of the nodes +can cause connecting lines to be not quite parallel, such as in the following +example: + +\begin{LTXexample}[width=0.4\linewidth] + \Large + \rnode{A}{sp} \hskip 2cm \rnode{B}{Bit} + \ncline{A}{B} +\end{LTXexample} + +With \Lcs{Rnode}, the center is determined relative to the baseline: + +\begin{LTXexample}[width=0.4\linewidth] + \Large + \Rnode{A}{sp} \hskip 2cm \Rnode{B}{Bit} + \ncline{A}{B} +\end{LTXexample} + +You can usually get by without fiddling with the center of the node, but to +modify it you set the + \LKeyword{href=num} or + \LKeyword{vref=dim} +parameters. In the horizontal direction, the center is located fraction +\Lkeyword{href} from the center to the edge. E.g, if \LKeyword{href=-1}, the center is on +the left edge of the box. In the vertical direction, the center is located +distance \Lkeyword{vref} from the baseline. The \Lkeyword{vref} parameter is evaluated each +time \Lcs{Rnode} is used, so that you can use \verb|ex| units to have the distance +adjust itself to the size of the current font (but without being sensitive to +differences in the size of letters within the current font). + +The command \Lcs{pnode} creates a zero dimensional node at \Largr{\CAny}. +It +knows an optional argument for an \CAny\ offset, which +expects the two values for $x$ and $y$ separated by a comma: + +\begin{BDef} +\Lcs{pnode}\OptArg*{\Largs{\Larga{offset}}}\Largr{\CAny}\Largb{\Larga{node name}} +\end{BDef} + + +\begin{LTXexample}[width=6cm] +\begin{pspicture}[showgrid](0,-2)(6,2) +\pnode{A}\psdot(A)\uput[90](A){A} +\pnode[0,-2]{B}\psdot(B)\uput[90](B){B} +\pnode(2,0){C}\psdot(C)\uput[90](C){C} +\pnode[1,-2](2,0){D}\psdot(D)\uput[90](D){D} +\pnode[2,2](3.5,0){E}\psdot(E)\uput[90](E){E} +\end{pspicture} +\end{LTXexample} + + +\begin{BDef} +\Lcs{pnodes}\OptArg*{\Largs{\Larga{offset}}}\Largr{coors}\Largb{name}\Largr{coors}\Largb{name}\ldots\\ +\Lcs{pnodes}\Largb{name}\Largr{coors}\Largr{coors}\ldots +\end{BDef} + +This command is identical to \Lcs{pnode} if it doesn't start with a node name. In this +case it works in another way. See page~\pageref{pnodes} for more information. Instead of +writing + +\begin{verbatim} +\pnode(3,1){A} +\pnode(2,4){B} +\end{verbatim} + +one can also define the nodes in a short way: +\begin{verbatim} +\pnodes(3,1){A}(2,4){B} +\end{verbatim} + +If an optional argument for the offset is used, then it is passes to all nodes. + + +The command \Lcs{psnode} is a combination of using \Lcs{rput} and \Lcs{rnode}. + +\begin{BDef} +\Lcs{psnode}\OptArgs\Largr{\CAny}\Largb{\Larga{node name}}\Largb{\Larga{node contents}} +\end{BDef} + +\begin{LTXexample} +\begin{pspicture}[showgrid](0,0)(4,4) +\psnode(0.5,3){A}{Foo} +\psnode(3,0){B}{Bar} +\ncdiag[arm=5mm,angleA=-90, + angleB=90]{->}{A}{B} +\end{pspicture} +\end{LTXexample} + + +\begin{BDef} +\LcsStar{cnode}\OptArgs\Largr{\CAny}\Largb{radius}\Largb{name} +\end{BDef} + + This draws a circle. Here is an example with \Lcs{pnode} and \Lcs{cnode}: + +\begin{LTXexample} +\begin{pspicture}[showgrid](3,1.25) + \cnode(0,1){.25}{A} + \pnode(3,0){B} + \ncline{<-}{A}{B} +\end{pspicture} +\end{LTXexample} + +\begin{BDef} +\LcsStar{Cnode}\OptArgs\Largr{\CAny}\Largb{name} +\end{BDef} + + This is like \Lcs{cnode}, but the radius is the value of \LKeyword{radius=dim} +This is convenient when you want many circle nodes of the same radius. + +\begin{BDef} +\LcsStar{circlenode}\OptArgs\Largb{name}\Largb{stuff} +\end{BDef} + + This is a variant of \Lcs{pscirclebox} that gives the node the shape of the +circle. + +\begin{BDef} + \LcsStar{cnodeput}\OptArgs\Largb{angle}\Largr{\CAny}\Largb{name}\Largb{stuff}\\ + \LcsStar{Cnodeput}\OptArgs\Largb{angle}\Largr{\CAny}\Largb{name}\Largb{stuff} +\end{BDef} + + This is a variant of \Lcs{cput} (or \Lcs{Cput}) that gives the node the shape of the +circle. That is, it is like +\begin{lstlisting} + \rput{<angle>}(<x>,<y>){\circlenode{<name>}{<stuff>}} + \rput[radius=...]{<angle>}(<x>,<y>){\Circlenode{<name>}{<stuff>}} +\end{lstlisting} + + +\begin{BDef} +\LcsStar{ovalnode}\OptArgs\Largb{name}\Largb{stuff} +\end{BDef} + + This is a variant of \Lcs{psovalbox} that gives the node the shape of an +ellipse. Here is an example with \Lcs{circlenode} and \Lcs{ovalnode}: + +\begin{LTXexample}[width=0.3\textwidth] +\circlenode{A}{Circle} and \ovalnode{B}{Oval} +\ncbar[angle=90]{A}{B} +\end{LTXexample} + + +\begin{BDef} +\LcsStar{dianode}\OptArgs\Largb{name}\Largb{stuff} +\end{BDef} + + This is like \Lcs{diabox}. + + +\begin{BDef} +\LcsStar{trinode}\OptArgs\Largb{name}\Largb{stuff} +\end{BDef} + + This is like \Lcs{tribox}. + +\begin{LTXexample}[width=5cm] +\begin{pspicture}(4,3) + \rput[tl](0,3){\dianode{A}{Diamond}} + \rput[br](4,0){\trinode[trimode=L]{B}{Triangle}} + \nccurve[angleA=-135,angleB=90]{A}{B} +\end{pspicture} +\end{LTXexample} + +\begin{BDef} +\LcsStar{dotnode}\OptArgs\Largr{\CAny}\Largb{name}\\ +\LcsStar{dotnodes}\OptArgs\Largr{\CAny}\Largb{name}\Largr{\CAny}\Largb{name}\ldots +\end{BDef} + +This is a variant of \Lcs{psdot}. For example: +\begin{LTXexample} +\begin{pspicture}(3,2) + \dotnode[dotstyle=triangle*,dotscale=2 1](0,0){A} + \dotnode[dotstyle=+](3,2){B} + \ncline[nodesep=3pt]{A}{B} +\end{pspicture} +\end{LTXexample} + + +\begin{BDef} +\LcsStar{fnode}\OptArgs\Largr{\CAny}\Largb{name} +\end{BDef} + + The ``f'' stands for ``frame''. This is like, but easier than, putting a +\Lcs{psframe} in an \Lcs{rnode}. + +\begin{LTXexample} +\begin{pspicture}(3,2) + \fnode{A} + \fnode*[framesize=1 5pt](2,2){B} + \ncline[nodesep=3pt]{A}{B} +\end{pspicture} +\end{LTXexample} + +There are two differences between \Lcs{fnode} and \Lcs{psframe}: +\begin{itemize} + \item There is a single (optional) coordinate argument, that gives the + \emph{center} of the frame. + \item The width and height of the frame are set by the + \LKeyword{framesize=dim1 `dim2'} parameter. If you omit <dim2>, you get a square frame. +\end{itemize} + + +%-------------------------------------------------------------------------------------- +\section{\nxLcs{psRelNode} and \nxLcs{psDefPSPNodes}} +%-------------------------------------------------------------------------------------- +With these macros it is possible to put a node relative to a given line or given +\Lenv{pspicture}-environment. In the frist case the parameters are +the angle and the length factor: + +\begin{BDef} +\Lcs{psRelNode}\Largs{P0}\Largs{P1}\Largb{length factor}\Largb{end node name}\\ +\Lcs{psDefPSPNodes} +\end{BDef} + +The length factor relates to the distance $\overline{P_0P_1}$ and +the end node name must be a valid nodename and shouldn't contain +any of the special PostScript characters. There are two valid +options: + +\begin{tabularx}{\linewidth}{@{} l|l| X @{} } +name & default & meaning\\\hline +\Lkeyword{angle} & $0$ & angle between the given line $\overline{P_0P_1}$ and the new one + $\overline{P_0P_{endNode}}$\tabularnewline +\Lkeyword{trueAngle} & \false & defines whether the angle refers to the seen line or to +the mathematical one, which respect the scaling factors +\Lkeyword{xunit} and \Lkeyword{yunit}. +\end{tabularx} + +\begin{LTXexample}[width=7cm] +\begin{pspicture}[showgrid](7,6) + \pnode(3,3){A}\pnode(4,2){B} + \psline[nodesep=-3,linewidth=0.5pt](A)(B) + \multido{\iA=0+30}{12}{% + \psRelNode[angle=\iA](A)(B){2}{C}% + \qdisk(C){2pt} + \uput[0](C){\iA}} +\end{pspicture} +\end{LTXexample} + +In the second case the new macro \Lcs{psDefPSPNodes} defines nine nodes that corresponds to +nine particular points (namely bottom left, bottom center, +bottom right, center left, center center, center right, top left, +top center, top right) of the \Lenv{pspicture} box. + +\begin{LTXexample}[width=6cm,wide=false] +\begin{pspicture}[showgrid](-1,-1)(4,4) + \psDefPSPNodes + \psdots(PSPbl)(PSPbc)(PSPbr) + (PSPcl)(PSPcc)(PSPcr)(PSPtl)(PSPtc)(PSPtr) + \uput[90](PSPbl){PSPbl} \uput[90](PSPbc){PSPbc} + \uput[90](PSPbr){PSPbr} \uput[90](PSPcl){PSPcl} + \uput[90](PSPcc){PSPcc} \uput[90](PSPcr){PSPcr} + \uput[90](PSPtl){PSPtl} \uput[90](PSPtc){PSPtc} + \uput[90](PSPtr){PSPtr} +\end{pspicture} +\end{LTXexample} + +The name of the nodes are predefined as: + +\begin{lstlisting}[style=syntax] +\psset[pst-PSPNodes]{blName=PSPbl,bcName=PSPbc,brName=PSPbr, + clName=PSPcl,ccName=PSPcc,crName=PSPcr,tlName=PSPtl,tcName=PSPtc,trName=PSPtr} +\end{lstlisting} + +and can be modified in the same way. +%I guess you modified the family to have the pstricks-add one so the +%\xkvview would have to be adapted. + + +\section{Node connections}\label{S-nc} + +All the node connection commands begin with \nxLcs{nc}, and they all have the same +syntax:\footnote{% +The node connections can be used with \Lcs{pscustom}. The beginning of the node +connection is attached to the current point by a straight line, as with +\Lcs{psarc}.}$^,$\footnote{% +See page \pageref{S-SpecialCoor} if you want to use the nodes as +coordinates in other PSTricks macros.} + +\begin{BDef} + \nxLcs{<nodeconnection>*}\OptArgs\Largb{<arrows>}\Largb{<nodeA>}\Largb{<nodeB>} +\end{BDef} + +A line of some sort is drawn from <nodeA> to <nodeB>. Some of the node +connection commands are a little confusing, but with a little experimentation +you will figure them out, and you will be amazed at the things you can do. +When we refer to the \verb|A| and \verb|B| nodes below, we are referring only to the +order in which the names are given as arguments to the node connection +macros.\footnote{% +When a node name cannot be found on the same page as the node connection +command, you get either no node connection or a nonsense node connection. +However, \TeX{} will not report any errors.} + +The node connections use many of the usual graphics parameters, plus a few +special ones. Let's start with one that applies to all the node connections: + \LKeyword{nodesep=dim} + +\Lkeyword{nodesep} is the border around the nodes that is added for the purpose of +determining where to connect the lines. + +For this and other node connection parameters, you can set different values +for the two ends of the node connection. Set the parameter \Lkeyword{nodesepA} for +the first node, and set \Lkeyword{nodesepB} for the second node. + +The first two node connections draw a line or arc directly between the two +nodes: + +\begin{BDef} +\LcsStar{ncline}\OptArgs\OptArg*{\Largb{arrows}}\Largb{nodeA}\Largb{nodeB} +\end{BDef} + +This draws a straight line between the nodes. For example: +\begin{LTXexample} +\begin{pspicture}(4,3) + \rput[bl](0,0){\rnode{A}{Idea 1}} + \rput[tr](4,3){\rnode{B}{Idea 2}} + \ncline[nodesep=3pt]{<->}{A}{B} +\end{pspicture} +\end{LTXexample} + +\begin{BDef} +\LcsStar{ncarc}\OptArgs\OptArg*{\Largb{arrows}}\Largb{nodeA}\Largb{nodeB} +\end{BDef} + +This connects the two nodes with an arc. +\begin{LTXexample} +\begin{pspicture}[shift=*](3.5,2.5) + \cnodeput(0,0){A}{X} + \cnodeput(3,2){B}{Y} + \psset{nodesep=3pt} + \ncarc{->}{A}{B} + \ncarc{->}{B}{A} +\end{pspicture} +\end{LTXexample} + +The angle between the arc and the line between the two nodes is\footnote{% +Rather than using a true arc, \Lcs{ncarc} actually draws a bezier curve. When +connecting two circular nodes using the default parameter values, the curve +will be indistinguishable from a true arc. However, \Lcs{ncarc} is more +flexible than an arc, and works right connecting nodes of different shapes and +sizes. You can set \Lkeyword{arcangleA} and \Lkeyword{arcangleB} separately, and you can +control the curvature with the \Lkeyword{ncurv} parameter, which is described on page +\pageref{p+ncurv}.} \LKeyword{arcangle=angle} + + +\Lcs{ncline} and \Lcs{ncarc} both determine the angle at which the node +connections join by the relative position of the two nodes. With the next +group of node connections, you specify one or both of the angles in absolute +terms, by setting the + \LKeyword{angle=angle} +(and \Lkeyword{angleA} and \Lkeyword{angleB}) parameter. + +You also specify the length of the line segment where the node connection +joins at one or both of the ends (the ``arms'') by setting the + \LKeyword{arm=dim} +(and \Lkeyword{armA} and \Lkeyword{armB}) parameter. + +These node connections all consist of several line segments, including the +arms. The value of \Lkeyword{linearc} is used for rounding the corners. + +Here they are, starting with the simplest one: + +\begin{BDef} +\LcsStar{ncdiag}\OptArgs\OptArg*{\Largb{arrows}}\Largb{nodeA}\Largb{nodeB} +\end{BDef} + + +An arm is drawn at each node, joining at angle \Lkeyword{angleA} or \Lkeyword{angleB}, +and with a length of \Lkeyword{armA} or \Lkeyword{armB}. Then the two arms are connected +by a straight line, so that the whole line has three line segments. +For example: + +\begin{LTXexample}[width=0.4\textwidth] +\begin{pspicture}(4,3) + \rput[tl](0,3){\rnode{A}{\psframebox{Node A}}} + \rput[br](4,0){\ovalnode{B}{Node B}} + \ncdiag[angleA=-90, angleB=90, arm=.5, linearc=.2]{A}{B} +\end{pspicture} +\end{LTXexample} + +You can also set one or both of the arms to zero length. For example, if you +set \LKeyword{arm=0}, the nodes are connected by a straight line, but you get to +determine where the line connects (whereas the connection point is determined +automatically by \Lcs{ncline}. Compare this use of \Lcs{ncdiag} with \Lcs{ncline} +in the following example: + +\begin{LTXexample}[width=0.4\textwidth] +\begin{pspicture}[shift=*](4,2.5) + \rput[r](4,1){\ovalnode{R}{Root}} + \cnodeput(1,2){A}{XX} + \cnodeput(1,0){B}{YY} + \ncdiag[angleB=180, arm=0]{<-}{A}{R} + \ncline{<-}{B}{R} +\end{pspicture} +\end{LTXexample} + +(Note that in this example, the default value \LKeyword{angleA=0} is used.) + +\begin{BDef} +\LcsStar{ncdiagg}\OptArgs\OptArg*{\Largb{arrows}}\Largb{nodeA}\Largb{nodeB} +\end{BDef} + +\Lcs{ncdiagg} is similar to \Lcs{ncdiag}, but only the arm for node A is drawn. +The end of this arm is then connected directly to node B. Compare +\Lcs{ncdiagg} with \Lcs{ncdiag} when \LKeyword{armB=0}: + +\begin{LTXexample}[width=0.4\textwidth] +\begin{pspicture}[shift=*](3.5,1) +\cnode(0,0){12pt}{a} +\rput[l](3,1){\rnode{b}{H}} +\rput[l](3,-1){\rnode{c}{T}} +\ncdiagg[angleA=180,armA=1.5,nodesepA=3pt]{b}{a} +\nbput[npos=1.2]{\texttt{\string\ncdiagg}} +\ncdiag[angleA=180,armA=1.5,armB=0, + nodesepA=3pt]{c}{a} +\naput[npos=1.2]{\texttt{\string\ncdiag}} +\end{pspicture} +\end{LTXexample} + + You can use \Lcs{ncdiagg} with \LKeyword{armA=0} if you want a straight line that +joins to node A at the angle you specify, and to node B at an angle that is +determined automatically. + +\begin{BDef} +\LcsStar{ncbar}\OptArgs\OptArg*{\Largb{arrows}}\Largb{nodeA}\Largb{nodeB} +\end{BDef} + + This node connection consists of a line with arms dropping ``down'', at +right angles, to meet two nodes at an angle \Lkeyword{angleA}. Each arm is at least +of length \Lkeyword{armA} or \Lkeyword{armB}, but one may be need to be longer. + +\begin{LTXexample}[width=0.4\textwidth] +\rnode{A}{Connect} some \rnode{B}{words}! +\ncbar[nodesep=3pt,angle=-90]{<-**}{A}{B} +\ncbar[nodesep=3pt,angle=70]{A}{B} +\end{LTXexample} + + Generally, the whole line has three straight segments. + +\begin{BDef} +\LcsStar{ncangle}\OptArgs\OptArg*{\Largb{arrows}}\Largb{nodeA}\Largb{nodeB} +\end{BDef} + + + Now we get to a more complicated node connection. \Lcs{ncangle} typically +draws three line segments, like \Lcs{ncdiag}. However, rather than fixing the +length of arm A, we adjust arm A so that the line joining the two arms meets +arm A at a right angle. For example: + +\begin{LTXexample}[width=5cm] +\begin{pspicture}(4,3) + \rput[tl](0,3){\rnode{A}{\psframebox{Node A}}} + \rput[br](4,0){\ovalnode{B}{Node B}} + \ncangle[angleA=-90,angleB=90,armB=1cm]{A}{B} +\end{pspicture} +\end{LTXexample} + +Now watch what happens when we change \Lkeyword{angleA}: + +\begin{LTXexample}[width=5cm] +\begin{pspicture}(4,3) + \rput[tl](0,3){\rnode{A}{\psframebox{Node A}}} + \nput[labelsep=0]{-70}{A}{% + \psarcn(0,0){.4cm}{0}{-70} + \uput{.4cm}[-35](0,0){\texttt{angleA}}} + \rput[br](4,0){\ovalnode{B}{Node B}} + \ncangle[angleA=-70,angleB=90,armB=1cm,linewidth=1.2pt]{A}{B} + \nput[labelsep=0]{90}{B}{% + \rput[bl](2pt,1pt){% + \valign{% + \vfil#\vfil\cr + \hbox{\psscaleboxto(.3,.95cm){\}}}\cr% + \hbox{\kern 1pt{\texttt{armB}}}\cr}}} + \ncput[nrot=:U,npos=1]{\psframe[dimen=middle](0,0)(.35,.35)} +\end{pspicture} +\end{LTXexample} + + + +\Lcs{ncangle} is also a good way to join nodes by a right angle, with just two +line segments, as in this example: + +\begin{LTXexample}[width=5cm] +\begin{pspicture}(4,2) + \rput[tl](0,2){\rnode{A}{\psframebox{Node A}}} + \rput[br](4,0){\ovalnode{B}{Node B}} + \ncangle[angleB=90, armB=0, linearc=.5]{A}{B} +\end{pspicture} +\end{LTXexample} + +\begin{BDef} +\LcsStar{ncangles}\OptArgs\OptArg*{\Largb{arrows}}\Largb{nodeA}\Largb{nodeB} +\end{BDef} + + \Lcs{ncangles} is similar to \Lcs{ncangle}, but the length of arm A is fixed by +he \Lkeyword{armA} parameter. Arm A is connected to arm B by two line segments that +eet arm A and each other at right angles. The angle at which they join arm B, +and the length of the connecting segments, depends on the positions of the two +arms. \Lcs{ncangles} generally draws a total of four line segments.\footnote{% +Hence there is one more angle than \Lcs{ncangle}, and hence the \texttt|s| in +\Lcs{ncangles}.} +For example: + +\begin{LTXexample}[width=5cm] +\begin{pspicture}(4,4) + \rput[tl](0,4){\rnode{A}{\psframebox{Node A}}} + \rput[br](4,0){\ovalnode{B}{Node B}} + \ncangles[angleA=-90, armA=1cm, armB=.5cm, linearc=.15]{A}{B} +\end{pspicture} +\end{LTXexample} + +Let's see what happens to the previous example when we change \Lkeyword{angleB}: + +\begin{LTXexample}[width=5cm] +\begin{pspicture}(4,4) + \rput[tl](0,4){\rnode{A}{\psframebox{Node A}}} + \rput[br](4,0){\ovalnode{B}{Node B}} + \ncangles[angleA=-90, angleB=135, armA=1cm, armB=.5cm, + linearc=.15]{A}{B} + \nput[labelsep=0]{-90}{A}{% + \psarcn(0,0){.4cm}{0}{-90} + \uput{.4cm}[-45](0,0){\texttt{angleA}} + \rput[tr](-2pt,0){% + \valign{% + \vfil#\vfil\cr + \hbox{\texttt{armA}\kern 1pt}\cr + \hbox{\psscaleboxto(.28,.95cm){\{}}\cr\cr}}} + \nput[labelsep=0]{135}{B}{% + \psarc(0,0){.4cm}{0}{133} + \uput{.4cm}[50.5](0,0){\texttt{angleB}}} + \ncput[nrot=:L,npos=2]{\psline(0,-.35)(-.35,-.35)(-.35,0)} + \ncput[npos=3.5]{% + \rput[r](-.8,0){\rnode{arm}{\texttt{armB}}} + \pnode{brak}}% + \ncline[nodesep=3pt]{->}{arm}{brak} +\end{pspicture} +\end{LTXexample} + +\begin{BDef} +\LcsStar{ncloop}\OptArgs\OptArg*{\Largb{arrows}}\Largb{nodeA}\Largb{nodeB} +\end{BDef} + + \Lcs{ncloop} is also in the same family as \Lcs{ncangle} and \Lcs{ncangles}, but +now typically 5 line segments are drawn. Hence, \Lcs{ncloop} can reach around +to opposite sides of the nodes. The lengths of the arms are fixed by \Lkeyword{armA} +and \Lkeyword{armB}. Starting at arm A, \Lcs{ncloop} makes a 90 degree turn to the +left, drawing a segment of length + \LKeyword{loopsize=dim} +This segment connects to arm B the way arm A connects to arm B with \Lcs{ncline}; +that is, two more segments are drawn, which join the first segment and each +other at right angles, and then join arm B. For example: + +\begin{LTXexample}[pos=t] + \vrule width 0pt height 1cm + \rnode{a}{\psframebox{\Huge A loop}} + \ncloop[angleB=180,loopsize=1,arm=.5,linearc=.2]{->}{a}{a} + \ncput[npos=3.5,nrot=:U]{\psline{|<->|}(.5,-.2)(-.5,-.2)} + \nbput[npos=3.5,nrot=:D,labelsep=.35cm]{{\ttfamily loopsize}} + \kern .5cm +\end{LTXexample} + +In this example, node A and node B are the same node! You can do this with all +the node connections (but it doesn't always make sense). +Here is an example where \Lcs{ncloop} connects two different nodes: + +\begin{LTXexample}[pos=t] + \parbox{3cm}{% + \rnode{A}{\psframebox{\large\textbf{Begin}}} + \vspace{1cm}\hspace*{\fill} + \rnode{B}{\psframebox{\large\textbf{End}}} + \ncloop[angleA=180,loopsize=.9,arm=.5,linearc=.2]{->}{A}{B}} + \ncput[npos=1.5,nrot=:U]{\psline{|<->|}(.45,-.2)(-.45,-.2)} + \nbput[npos=1.5,nrot=:D,labelsep=.35cm]{\texttt{loopsize}} + \kern .5cm +\end{LTXexample} + + +The next two node connections are a little different from the rest. + +\begin{BDef} +\LcsStar{nccurve}\OptArgs\OptArg*{\Largb{arrows}}\Largb{nodeA}\Largb{nodeB} +\end{BDef} + + \Lcs{nccurve} draws a bezier curve between the nodes. + +\begin{LTXexample}[width=5cm] +\begin{pspicture}(4,3) + \rput[bl](0,0){\rnode{A}{\psframebox{Node A}}} + \rput[tr](4,3){\ovalnode{B}{Node B}} + \nccurve[angleB=180]{A}{B} +\end{pspicture} +\end{LTXexample} + +You specify the angle at which the curve joins the nodes by setting the +\Lkeyword{angle} (and \Lkeyword{angleA} and \Lkeyword{angleB}) parameter. The distance to the +control points is set with the + \LKeyword{ncurv=num} +(and \Lkeyword{ncurvA} and \Lkeyword{ncurvB}) parameter. A lower number gives a tighter +curve. (The distance between the beginning of the arc and the first control +point is one-half \Lkeyword{ncurvA} times the distance between the two endpoints.) + +\begin{BDef} +\LcsStar{nccircle}\OptArgs\OptArg*{\Largb{arrows}}\Largb{nodeA}\Largb{nodeB} +\end{BDef} + +\Lcs{nccircle} draws a circle, or part of a circle, that, if complete, would +pass through the center of the node counterclockwise, at an angle of +\Lkeyword{angleA}. + +\begin{LTXexample} +\vrule width 0pt height 1.4cm +\rnode{A}{\textbf{back}} +\nccircle[nodesep=3pt]{->}{A}{.7cm} +\end{LTXexample} + +\Lcs{nccircle} can only connect a node to itself; it is the only node +connection with this property. \Lcs{nccircle} is also special because it has an +additional argument, for specifying the radius of the circle. + + +The last two node connections are also special. Rather than connecting the +nodes with an open curve, they enclose the nodes in a box or curved box. You +can think of them as variants of \Lcs{ncline} and \Lcs{ncarc}. In both cases, the +half the width of the box is + \LKeyword{boxsize=dim} +You have to set this yourself to the right size, so that the nodes fit inside +the box. The \Lkeyword{boxsize} parameter actually sets the \Lkeyword{boxheight} and +\Lkeyword{boxdepth} parameters. The ends of the boxes extend beyond the nodes by +\Lkeyword{nodesepA} and \Lkeyword{nodesepB}. + + +\begin{BDef} +\LcsStar{ncbox}\OptArgs\Largb{nodeA}\Largb{nodeB} +\end{BDef} + + \Lcs{ncbox} encloses the nodes in a box with straight sides. For example: + +\begin{LTXexample}[width=5cm] +\begin{pspicture}[shift=*](4,2.5) + \rput[bl](.5,0){\rnode{A}{Idea 1}} + \rput[tr](3.5,2){\rnode{B}{Idea 2}} + \ncbox[nodesep=.5cm,boxsize=.6,linearc=.2, + linestyle=dashed]{A}{B} +\end{pspicture} +\end{LTXexample} + +\begin{BDef} +\LcsStar{ncarcbox}\OptArgs\Largb{nodeA}\Largb{nodeB} +\end{BDef} + + \Lcs{ncarcbox} encloses the nodes in a curved box that is \Lkeyword{arcangleA} away +from the line connecting the two nodes. + +\begin{LTXexample}[width=5cm] +\begin{pspicture}[shift=*](4,2.5) + \rput[bl](.5,0){\rnode{A}{1}} + \rput[tr](3.5,2){\rnode{B}{2}} + \ncarcbox[nodesep=.2cm,boxsize=.4,linearc=.4, + arcangle=50]{<->}{A}{B} +\end{pspicture} +\end{LTXexample} + +The arc is drawn counterclockwise from node A to node B. + + +There is one other node connection parameter that applies to all the node +connections, except \Lcs{ncarcbox}: + \LKeyword{offset=dim} +(You can also set \Lkeyword{offsetA} and \Lkeyword{offsetB} independently.) This shifts the +point where the connection joins up by <dim> (given the convention that +connections go from left to right). + +There are two main uses for this parameter. First, it lets you make two +parallel lines with \Lcs{ncline}, as in the following example: + +\begin{LTXexample}[width=5cm] +\begin{pspicture}[shift=*](3.5,2.5) + \cnodeput(0,0){A}{X} + \cnodeput(3,2){B}{Y} + \psset{nodesep=3pt,offset=4pt,arrows=->} + \ncline{A}{B} + \ncline{B}{A} +\end{pspicture} +\end{LTXexample} + +Second, it lets you join a node connection to a rectangular node at a right +angle, without limiting yourself to positions that lie directly above, below, +or to either side of the center of the node. This is useful, for example, if +you are making several connections to the same node, as in the following +example: + +\begin{LTXexample} + \rnode{A}{Word1} and \rnode{B}{Word2} and \rnode{C}{Word3} + \ncbar[offsetB=4pt,angleA=-90,nodesep=3pt]{->}{A}{B} + \ncbar[offsetA=4pt,angleA=-90,nodesep=3pt]{->}{B}{C} +\end{LTXexample} + +Sometimes you might be aligning several nodes, such as in a tree, and you want +to ends or the arms of the node connections to line up. This won't happen +naturally if the nodes are of different size, as you can see in this example: + +\begin{LTXexample}[width=5cm] +\begin{pspicture}[shift=*](3.5,3) + \psset{unit=.9} + \Huge + \cnode(1,3){4pt}{a} + \rput[B](0,0){\Rnode{b}{H}} + \rput[B](2,0){\Rnode{c}{a}} + \psset{angleA=90,armA=1,nodesepA=3pt} + \ncdiagg{b}{a} + \ncdiagg{c}{a} +\end{pspicture} +\end{LTXexample} + +%%??? FIXME +If you set the \Lkeyword{nodesep} or \Lkeyword{arm} parameter to a negative value, PSTricks +will measure the distance to the beginning of the node connection or to the +end of the arm relative to the center of the node, rather than relative to the +boundary of the node or the beginning of the arm. Here is how we fix the +previous example: + +\begin{LTXexample}[width=5cm] +\begin{pspicture}[shift=*](3.5,3) + \psset{unit=.9} + \Huge + \cnode(1,3){4pt}{a} + \rput[B](0,0){\Rnode{b}{H}} + \rput[B](2,0){\Rnode{c}{a}} + \psset{angleA=90,armA=1,YnodesepA=12pt} + \ncdiagg{b}{a} + \ncdiagg{c}{a} +\end{pspicture} +\end{LTXexample} + +Note also the use of \Lcs{Rnode}. + + + + +One more parameter trick: By using the \Lkeyword{border} parameter, you can create +the impression that one node connection passes over another. + +The node connection commands make interesting drawing tools as well, as an +alternative to \Lcs{psline} for connecting two points. There are variants of +the node connection commands for this purpose. Each begins with \verb|pc| (for +``point connection'') rather than \verb|nc|. E.g., + \verb|\pcarc{<->}(3,4)(6,9)| +gives the same result as + +\begin{lstlisting} + \pnode(3,4){A} + \pnode(6,9){B} + \pcarc{<->}{A}{B} +\end{lstlisting} + +Only \Lcs{nccircle} does not have a \nxLcs{pc} variant: + + + + +\begin{center} +\addtolength{\tabcolsep}{8pt} +\def\c#1{\Largb{node#1}} +\begin{tabular}{ll}\bottomrule + \emph{Command} & \emph{Corresponds to:}\\\midrule + + \Lcs{pcline}\OptArg*{\Largb{arrows}}\c1\c2 & \Lcs{ncline}\\ + + \Lcs{pccurve}\OptArg*{\Largb{arrows}}\c1\c2 & \Lcs{nccurve}\\ + + \Lcs{pcarc}\OptArg*{\Largb{arrows}}\c1\c2 & \Lcs{ncarc}\\ + + \Lcs{pcbar}\OptArg*{\Largb{arrows}}\c1\c2 & \Lcs{ncbar}\\ + + \Lcs{pcdiag}\OptArg*{\Largb{arrows}}\c1\c2 & \Lcs{ncdiag}\\ + + \Lcs{pcdiagg}\OptArg*{\Largb{arrows}}\c1\c2 & \Lcs{ncdiagg}\\ + + \Lcs{pcangle}\OptArg*{\Largb{arrows}}\c1\c2 & \Lcs{ncangle}\\ + + \Lcs{pcangles}\OptArg*{\Largb{arrows}}\c1\c2 & \Lcs{ncangles}\\ + + \Lcs{pcloop}\OptArg*{\Largb{arrows}}\c1\c2 & \Lcs{ncloop}\\ + + \Lcs{pcbox}\c1\c2 & \Lcs{ncbox}\\ + + \Lcs{pcarcbox}\c1\c2 + & \Lcs{ncarcbox} +\end{tabular} +\end{center} + + + + +\section{Node connections labels: I}\label{S-nodelabels} + +Now we come to the commands for attaching labels to the node connections. The +label command must come right after the node connection to which the label is +to be attached. You can attach more than one label to a node connection, and a +label can include more nodes. + +The node label commands must end up on the same \TeX{} page as the node +connection to which the label corresponds. + +There are two groups of connection labels, which differ in how they select the +point on the node connection. In this section we describe the first group: + +\begin{BDef} + \LcsStar{ncput}\OptArgs\Largb{stuff}\\ + \LcsStar{naput}\OptArgs\Largb{stuff}\\ + \LcsStar{nbput}\OptArgs\Largb{stuff} +\end{BDef} + + +These three command differ in where the labels end up with respect to the line: + +\begin{tabular}{@{}ll} + \Lcs{ncput} & \emph{on} the line\\ + \Lcs{naput} & \emph{above} the line\\ + \Lcs{nbput} & \emph{below} the line +\end{tabular} + +(using the convention that node connections go from left to right). + +Here is an example: + +\begin{LTXexample}[width=5cm] +\begin{pspicture}(3.5,1.5) + \cnode(0,0){.5cm}{root} + \cnode*(3,1.5){4pt}{A} + \cnode*(3,0){4pt}{B} + \cnode*(3,-1.5){4pt}{C} + \psset{nodesep=3pt} + \ncline{root}{A} + \naput{above} + \ncline{root}{B} + \ncput*{on} + \ncline{root}{C} + \nbput{below} +\end{pspicture} +\end{LTXexample} + +\Lcs{naput} and \Lcs{nbput} use the same algorithm as \Lcs{uput} for displacing +the labels, and the distance beteen the line and labels is \Lkeyword{labelsep} (at +least if the lines are straight). + +\Lcs{ncput} uses the same system as \Lcs{rput} for setting the reference +point. You change the reference point by setting the + \LKeyword{ref=ref} +parameter. + +Rotation is also controlled by a graphics parameter: + \LKeyword{nrot=rot} +<rot> can be in any of the forms suitable for \Lcs{rput}, and you can also use +the form +\verb|{:<angle>}| + +The angle is then measured with respect to the node connection. E.g., if the +angle is \verb|{:U}|, then the label runs parallel to the node connection. Since +the label can include other put commands, you really have a lot of control +over the label position. + +The next example illustrates the use \verb|{:<angle>}|, the \Lkeyword{offset} parameter, +and \Lcs{pcline}: + +\begin{LTXexample}[width=5cm] +\begin{pspicture}(4,2.3) + \pspolygon(0,0)(4,2)(4,0) + \pcline[offset=12pt]{|-|}(0,0)(4,2) + \ncput*[nrot=:U]{Length} +\end{pspicture} +\end{LTXexample} + +Here is a repeat of an earlier example, now using \verb|{:<angle>}|: + +\begin{LTXexample}[width=5cm] +\begin{pspicture}(3.5,1.5) + \cnode(0,0){.5cm}{root} + \cnode*(3,1.5){4pt}{A} + \cnode*(3,0){4pt}{B} + \cnode*(3,-1.5){4pt}{C} + \psset{nodesep=3pt,nrot=:U} + \ncline{root}{A} + \naput{above} + \ncline{root}{B} + \ncput*{on} + \ncline{root}{C} + \nbput{below} +\end{pspicture} +\end{LTXexample} + +The position on the node connection is set by the + \LKeyword{npos=num} +parameter, roughly according to the following scheme: Each node connection has +potentially one or more segments, including the arms and connecting lines. +A number \Lkeyword{npos} between 0 and 1 picks a point on the first segment from node +\verb|A| to \verb|B| (fraction \Lkeyword{npos} from the beginning to the end of the segment), +a number between 1 and 2 picks a number on the second segment, and so on. + +Each node connection has its own default value of \Lkeyword{npos}. If you leave the +\Lkeyword{npos} parameter value empty (e.g., \verb|[npos=]|), then the default is +substituted. This is the default mode. + +Here are the details for each node connection: +\begin{center} +% \catcode`\@=11\setbox\@tempboxa=\hbox{1.5}% +% \edef\t#1{\noexpand\hbox to \the\wd\@tempboxa{\noexpand\tt\noexpand\hss#1}} + \begin{tabular}{lccc} + \emph{Connection} & \emph{Segments} & \emph{Range} & \emph{Default}\\[2pt] + \Lcs{ncline} & 1 & $0\leq pos\leq 1$ & 0.5\\ + \Lcs{nccurve} & 1 & $0\leq pos\leq 1$ & 0.5\\ + \Lcs{ncarc} & 1 & $0\leq pos\leq 1$ & 0.5\\ + \Lcs{ncbar} & 3 & $0\leq pos\leq 3$ & 1.5\\ + \Lcs{ncdiag} & 3 & $0\leq pos\leq 3$ & 1.5\\ + \Lcs{ncdiagg} & 2 & $0\leq pos\leq 2$ & 0.5\\ + \Lcs{ncangle} & 3 & $0\leq pos\leq 3$ & 1.5\\ + \Lcs{ncangles} & 4 & $0\leq pos\leq 4$ &1.5\\ + \Lcs{ncloop} & 5 & $0\leq pos\leq 5$ & 2.5\\ + \Lcs{nccircle} & 1 & $0\leq pos\leq 1$ & 0.5\\ + \Lcs{ncbox} & 4 & $0\leq pos\leq 4$ & 0.5\\ + \Lcs{ncarcbox} & 4 & $0\leq pos\leq 4$ & 0.5 + \end{tabular} +\end{center} + + + + +Here is an example: + +\begin{LTXexample}[width=5cm] +\begin{pspicture}(4,3) +\rput[tl](0,3){\rnode{A}{\psframebox{Node A}}} +\rput[br](3.5,0){\ovalnode{B}{Node B}} +\ncangles[angleA=-90,arm=.4cm,linearc=.15]{A}{B} +\ncput*{d} +\nbput[nrot=:D,npos=2.5]{par} +\end{pspicture} +\end{LTXexample} + +With \Lcs{ncbox} and \Lcs{ncarcbox}\, the segments run counterclockwise, starting +with the lower side of the box. Hence, with \Lcs{nbput} the label ends up +outside the box, and with \Lcs{naput} the label ends up inside the box. + +\begin{LTXexample}[width=5cm] +\begin{pspicture}[shift=*](4,2.5) + \rput[bl](.5,0){\rnode{A}{1}} + \rput[tr](3.5,2){\rnode{B}{2}} + \ncarcbox[nodesep=.2cm,boxsize=.4,linearc=.4, + arcangle=50,linestyle=dashed]{<->}{A}{B} + \nbput[nrot=:U]{set} + \nbput[npos=2]{II} +\end{pspicture} +\end{LTXexample} + +If you set the parameter + \LKeyword{shortput=none/nab/tablr/tab} +to \Lkeyval{nab}, then immediately following a node connection or another node +connection label you can use \verb|^| instead of \Lcs{naput} and \verb|_| instead of +\Lcs{nbput}. + +\begin{LTXexample}[width=5cm] +\begin{pspicture}[shift=*](3.5,1.5) + \cnode(0,0){.5cm}{root} + \cnode*(3,1.5){4pt}{A} + \cnode*(3,-1.5){4pt}{C} + \psset{nodesep=3pt,shortput=nab} + \ncline{root}{A}^{$x$} + \ncline{root}{C}_{$y$} +\end{pspicture} +\end{LTXexample} + +You can still have parameter changes with the short \verb|^| and \verb|_| forms. Another +example is given on page~\pageref{nab-example}. + +If you have set \Lkeyset{shortput=nab}, and then you want to use a true \verb|^| or \verb|_| +character right after a node connection, you must precede the \verb|^| or \verb|_| by +\verb|{}| so that PSTricks does not convert it to \Lcs{naput} or \Lcs{nbput}. + +You can change the characters that you use for the short form with the + +\begin{BDef} +\Lcs{MakeShortNab}\Largb{<char1>}\Largb{<char2>} +\end{BDef} + +command.\footnote{% +You can also use \Lcs{MakeShortNab} if you want to use \texttt{\textasciicircum} and \texttt{\_} with +non-standard category codes. Just invoke the command after you have made your +\Lcs{catcode} changes.} + +The \Lkeyset{shortput=tablr} and \Lkeyset{shortput=tab} options are described on +pages~\pageref{tablr} and \pageref{tab}, respectively. + + + +\section{Node connection labels: II} + +Now the second group of node connections: +\begin{BDef} +\LcsStar{tvput}\OptArgs\Largb{stuff}\\ +\LcsStar{tlput}\OptArgs\Largb{stuff}\\ +\LcsStar{trput}\OptArgs\Largb{stuff}\\ +\LcsStar{thput}\OptArgs\Largb{stuff}\\ +\LcsStar{taput}\OptArgs\Largb{stuff}\\ +\LcsStar{tbput}\OptArgs\Largb{stuff} +\end{BDef} + +The difference between these commands and the \verb|\n*put| commands is that these +find the position as an intermediate point between the centers of the nodes, +either in the horizontal or vertical direction. These are good for trees and +mathematical diagrams, where it can sometimes be nice to have the labels be +horizontally or vertically aligned. The \verb|t| stands for ``tree''. + +You specify the position by setting the + \LKeyword{tpos=num} +parameter. + +\Lcs{tvput}, \Lcs{tlput} and \Lcs{trput} find the position that lies fraction +<tpos> in the \emph{vertical} direction from the upper node to the lower +node. \Lcs{thput}, \Lcs{taput} and \Lcs{tbput} find the position that lies fraction +<tpos> in the \emph{horizontal} direction from the left node to the right +node. +Then the commands put the label on or next to the line, as follows: +\begin{center} +\begin{tabular}{lll}\toprule + \emph{Command} & \emph{Direction} & \emph{Placement}\\\midrule + \Lcs{tvput} & vertical & middle\\ + \Lcs{tlput} & vertical & left\\ + \Lcs{trput} & vertical & right\\ + \Lcs{thput} & horizontal & middle\\ + \Lcs{taput} & horizontal & above\\ + \Lcs{tbput} & horizontal & below\\\bottomrule +\end{tabular} +\end{center} + +Here is an example: +\begin{LTXexample}[pos=t] + \[ + \setlength{\arraycolsep}{1.1cm} + \begin{array}{cc} + \Rnode{a}{(X-A)} & \Rnode{b}{A} \\[1.5cm] + \Rnode{c}{x} & \Rnode{d}{\tilde{X}} + \end{array} + \psset{nodesep=5pt,arrows=->} \everypsbox{\scriptstyle} + \ncline{a}{c}\tlput{r} \ncline{a}{b}\taput{u} + \ncline[linestyle=dashed]{c}{d}\tbput{b} + \ncline{b}{d}\trput{s} + \everypsbox{} + \begin{array}{cc} + \rnode{a}{(X-A)} & \rnode{b}{a} \\[1.5cm] + \rnode{c}{x} & \rnode{d}{\tilde{X}} + \end{array} + \psset{nodesep=5pt,arrows=->}\everypsbox{\scriptstyle} + \ncline{a}{c}\nbput{r} \ncline{a}{b}\naput{u} + \ncline[linestyle=dashed]{c}{d}\nbput{b} + \ncline{b}{d}\naput{s} + \] +\end{LTXexample} + +On the left is the diagram with \Lcs{tlput}, \Lcs{trput}, \Lcs{tbput} and \Lcs{Rnode}, +as shown in the code. On the right is the same diagram, but with \Lcs{naput}, +\Lcs{nbput} and \Lcs{rnode}. + +These do not have a rotation argument or parameter. However, you can rotate +\Larg{<stuff>} in 90 degree increments using box rotations (e.g., \Lcs{rotateleft}). + +If you set \Lkeyset{shortput=tablr}, then you can use the following single-character +abbreviations for the \verb|t| put commands:\label{tablr} +\begin{center} + \begin{tabular}{rl}\toprule + \emph{Char.} & \emph{Short for:}\\\midrule +\rule{0pt}{4ex} + \verb|^| & \Lcs{taput} \\ + \verb|_| & \Lcs{tbput} \\ + \verb|<| & \Lcs{tlput} \\ + \verb|>| & \Lcs{trput}\\\bottomrule + \end{tabular} +\end{center} + + +You can change the character abbreviations with + +\begin{BDef} +\Lcs{MakeShortTablr}\Largb{<char1>}\Largb{<char2>}\Largb{<char3>}\Largb{<char4>} +\end{BDef} + +The \verb|t| put commands, including an example of \Lkeyset{shortput=tablr}, will be +shown further when we get to mathematical diagrams and trees. + +The\XInfoDanger{~} node macros use \Lcs{pstVerb} and \Lcs{pstverbscale}. + +\section{Attaching labels to nodes} + +The commands + +\begin{BDef} +\LcsStar{nput}\OptArgs\Largb{refangle}\Largb{name}\Largb{stuff}\\ +\LcsStar{uput}\OptArg*{\Largb{distance}}\Largs{angle}\OptArg*{\Largb{rotation}}\Largr{name}\Largb{stuff} +\end{BDef} + + +affixes \Largb{<stuff>} to node \Largb{<name>}. It is positioned distance \Lkeyword{labelsep} from +the node, in the direction \Largb{<refangle>} from the center of the node. The +algorithm is the same as for \Lcs{uput}. If you want to rotate the node, set the + \LKeyword{rot=rot} +parameter, where \Larg{<rot>} is a rotation that would be valid for \Lcs{rput}.% +\footnote{Not to be confused with the \Lkeyword{nput} parameter.} +The position of the label also takes into account the \Lkeyword{offsetA} +parameter. If \Lkeyword{labelsep} is negative, then the distance is from the center +of the node rather than from the boundary, as with \Lkeyword{nodesep}. + +Here is how I used \Lcs{nput} to mark an angle in a previous example: + +\begin{LTXexample}[width=4cm] +\begin{pspicture}(4,3) +\rput[br](4,0){\ovalnode{B}{Node B}} +\rput[tl](0,3){\rnode{A}{\psframebox{Node A}}} +\nput[labelsep=0]{-70}{A}{% + \psarcn(0,0){.4cm}{0}{-70} + \uput{.4cm}[-35](0,0){\texttt{angleA}}} +\ncangle[angleA=-70,angleB=90,armB=1cm,linewidth=1.2pt]{A}{B} +\ncput[nrot=:U,npos=1]{\psframe[dimen=middle](0,0)(.35,.35)} +\end{pspicture} +\end{LTXexample} + +\clearpage%%%%%%%%%%%%%%%%%%%%%%%%%% + +For the put macros there are several possibilities: + +\begin{LTXexample}[width=7cm] +\begin{pspicture}[showgrid](-0.25,-0.25)(6,5) +\pnodes(0,3){A}(3,1){B} +\psline[showpoints](A)(B) +\uput[-90](A){A}\uput[-90](B){B} +\psline[linestyle=dashed](A)(3,4) +\psline[linestyle=dashed](A)(3,5) +\psline[linestyle=dashed](A)(3,3) +\psline[linestyle=dashed](6,2) +\psline[linestyle=dashed](B)(6,1) +\psarc{->}(0,3){2.5}{0}{(3,1)} +\psarc{->}(3,1){2.5}{0}{(3,1)} +\uput*{1cm}[(B)](A){foo} \uput*{1cm}[(B)](>A){bar} +\end{pspicture} +\end{LTXexample} + + + + +\newcommand\object[1][solid]{\psline[linecolor=red,linewidth=1pt,linestyle=#1]{->}(0,1.5)} +\def\Theta{150} +\def\Radius{1.6} +\psset{linestyle=dashed,dash=4pt 1pt,linecolor=cyan} + +\subsection{Normal behavior without rotation} +If there are a point $B$ of type node and a point $A$ of any type then +\begin{lstlisting} +\uput{r}[(B)]{0}(A){\object} +\end{lstlisting} +will produce the same effect as +\begin{lstlisting} +\pnode([nodesep=r]{B}A){C} +\rput{0}(C){\object} +\end{lstlisting} + +\begin{LTXexample}[width=5.5cm] +\begin{pspicture}[showgrid](-1,-1)(4,6) +\pnodes(2,1){A}(0,0){O}(1,5){B} +\pnode([nodesep=\Radius]{B}A){C} +\pcline(O)(A) \pcline(O)(B) \pcline(A)(B) +\pcline(A)([nodesep=-\Radius]A)\nbput{$r$} +\uput[-135](O){$O$} \uput[-110](A){$A$} +\uput[90](B){$B$} \uput[150](C){$C$} +\pscircle(A){\Radius} +% ------------------------------- +\uput{\Radius}[(B)]{0}(A){\object} +%\rput{0}([nodesep=\Radius]{B}A){\object} +\end{pspicture} +\end{LTXexample} + + +\clearpage%%%%%%%%%%%%%%%%%%%%%%%%% + +\subsection{Normal behavior with rotation} +If there are a point $B$ of type node and a point $A$ of any type then +\begin{lstlisting} +\uput{r}[(B)]{rotangle}(A){\object} +\end{lstlisting} +will produce the same effect as +\begin{lstlisting} +\pnode([nodesep=r,angle=-rotangle]{B}A){R} +\rput{rotangle}(R){\object} +\end{lstlisting} + +\begin{LTXexample}[width=5.5cm] +\begin{pspicture}[showgrid](-1,-2)(4,6) +\pnodes(2,1){A}(0,0){O}\pnode(1,5){B} +\pnode([nodesep=\Radius]{B}A){C} +\pnode([nodesep=\Radius,angle=-150]{B}A){R} +% ------------------------------- +\pcline(O)(A) \pcline(O)(B) \pcline(A)(B) +\pcline(A)([nodesep=-\Radius]A) +\nbput{$r$} \pcline(A)(R) +\uput[-135](O){$O$} \uput[-110](A){$A$} +\uput[90](B){$B$} \uput[150](C){$C$} +\uput[-45](R){$R$} +% +\pscircle(A){\Radius} +\psarcn[origin={A}]{->}(A){.6}{(B)}{(R)} +\uput{5pt}[30](A){$\theta$} +\psarc[origin={R}]{->}(R){.7}{([offset=1]R)}% + {([offset=1,angle=\Theta]R)} +\uput*{8pt}[160](R){$\theta$} +% ------------------------------- +\rput(R){\object[dashed]} +\uput{\Radius}[(B)]{150}(A){\object} +%\rput{\Theta}([nodesep=\Radius, +% angle=-\Theta]{B}A){\object} +\end{pspicture} +\end{LTXexample} + +\clearpage%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\subsection{Special behavior without rotation} +If there are a point $B$ of type node and a point $A$ of any type then +\begin{lstlisting} +\uput{r}[(B)]{0}(>A){\object} +\end{lstlisting} +will produce the same effect as +\begin{lstlisting} +\nodexn{(A)+(B)}{D} +\pnode([nodesep=r]{D}A){C'} +\rput{0}(C'){\object} +\end{lstlisting} + +\begin{LTXexample}[width=5.5cm] +\begin{pspicture}[showgrid](-1,-1)(4,7) +\pnodes(2,1){A}(0,0){O}(1,5){B} +\pnode([nodesep=\Radius]{B}A){C} +\nodexn{(A)+(B)}{D} +\pnode([nodesep=\Radius]{D}A){C'} +% ------------------------------- +\pcline[ArrowInside=->>](O)(A) +\pcline[ArrowInside=->](O)(B) +\pcline(A)(B) +\pcline(A)([nodesep=-\Radius]A)\nbput{$r$} +\pcline[ArrowInside=->](A)(D) +\pcline[ArrowInside=->>](B)(D) +\uput[-135](O){$O$} \uput[-110](A){$A$} +\uput[90](B){$B$} \uput[150](C){$C$} +\uput[30](C'){$C'$} \uput[45](D){$D$} +% +\pscircle(A){\Radius} +% ------------------------------- +\uput{\Radius}[(B)]{0}(>A){\object} +%\rput{0}(C'){\object} +\end{pspicture} +\end{LTXexample} + + +\clearpage%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\subsection{Special behavior with rotation} +If there are a point $B$ of type node and a point $A$ of any type then +\begin{lstlisting} +\uput{r}[(B)]{rotangle}(>A){\object} +\end{lstlisting} +will produce the same effect as +\begin{lstlisting} +\nodexn{(A)+(B)}{D} +\pnode([nodesep=r]{D}A){C'} +\rput{rotangle}(C'){\object} +\end{lstlisting} + +\begin{LTXexample}[width=5.5cm] +\begin{pspicture}[showgrid](-1,-1)(4,7) +\pnodes(2,1){A}(0,0){O}(1,5){B} +\pnode([nodesep=\Radius]{B}A){C} +\nodexn{(A)+(B)}{D} +\pnode([nodesep=\Radius]{D}A){C'} +% ------------------------------- +\pcline[ArrowInside=->>](O)(A) +\pcline[ArrowInside=->](O)(B) +\pcline(A)(B) +\pcline(A)([nodesep=-\Radius]A) +\nbput{$r$} +\pcline[ArrowInside=->](A)(D) +\pcline[ArrowInside=->>](B)(D) +\uput[-135](O){$O$} \uput[-110](A){$A$} +\uput[90](B){$B$} \uput[150](C){$C$} +\uput[30](C'){$C'$} \uput[45](D){$D$} +% +\pscircle(A){\Radius} +\psarc[origin={C'}]{->}(C'){.55}{([offset=1]C')}% + {([offset=1,angle=150]C')} +\uput*{5pt}[170](C'){$\theta$} +% ------------------------------- +\rput{0}(C'){\object[dashed]} +\uput{\Radius}[(B)]{150}(>A){\object} +%\rput{150}(C'){\object} +\end{pspicture} +\end{LTXexample} + + +\psset{linestyle=solid,dash=4pt 1pt,linecolor=black} + + +\section{Mathematical diagrams and graphs}\label{S-psmatrix} + +For some applications, such as mathematical diagrams and graphs, it is useful +to arrange nodes on a grid. You can do this with alignment environments, such +as \TeX's \Lcs{halign} primitive, \LaTeX's \Lenv{tabular} environment, and \AmS-\TeX's +\Lcs{matrix}, but PSTricks contains its own alignment environment that is +especially adapted for this purpose: + +\begin{BDef} +\Lcs{psmatrix}\OptArgs \ldots \Lcs{endpsmatrix} +\end{BDef} + +Here is an example +\begin{LTXexample}[width=5cm] + $ + \psmatrix[colsep=1cm,rowsep=1cm] + & A \\ + B & E & C \\ + & D & + \endpsmatrix + $ +\end{LTXexample} + +As an alignment environment, \Lcs{psmatrix} is similar to \AmS-\TeX's +\Lcs{matrix}. There is no argument for specifying the columns. Instead, you can +just use as many columns as you need. The entries are horizontally centered. +Rows are ended by \verb|\\|. \Lcs{psmatrix} can be used in or out of math mode. + +Our first example wasn't very interesting, because we didn't make use of the +nodes. Actually, each entry is a node. The name of the node in row <row> and +column \Largb{<col>} is \verb|{<row>,<col>}|, with no spaces. Let's see some node +connections: + +\begin{LTXexample}[width=5cm] + $ + \psmatrix[colsep=1cm] + & X \\ + Y & Z + \endpsmatrix + \everypsbox{\scriptstyle}% + \psset{nodesep=3pt,arrows=->} + \ncline{1,2}{2,1} + \tlput{f} + \ncline{1,2}{2,2} + \trput{g} + \ncline[linestyle=dotted]{2,1}{2,2} + \tbput{h} + $ +\end{LTXexample} + +You can include the node connections inside the \Lcs{psmatrix}, in the last entry +and right before \Lcs{endpsmatrix}. One advantage to doing this is that +\Lkeyset{shortput=tab} is the default within a \Lcs{psmatrix}. + +\begin{LTXexample} +$ \begin{psmatrix} + U \\ + & X\times_Z Y & X \\ + & Y & Z + \psset{arrows=->,nodesep=3pt} + \everypsbox{\scriptstyle} + \ncline{1,1}{2,2}_{y} + \ncline[doubleline,linestyle=dashed]{-}{1,1}{2,3}^{x} + \ncline{2,2}{3,2}<{q} + \ncline{2,2}{2,3}_{p} + \ncline{2,3}{3,3}>{f} + \ncline{3,2}{3,3}_{g} + \end{psmatrix} $ +\end{LTXexample} + +You can change the kind of nodes that are made by setting the + \LKeyword{mnode=type} +parameter. Valid types are \Lkeyval{R}, +\Lkeyval{r}, +\Lkeyval{C}, +\Lkeyval{f}, \Lkeyval{p}, \Lkeyval{circle}, \Lkeyval{oval}, \Lkeyval{dia}, +\Lkeyval{tri}, \Lkeyval{dot} and \Lkeyval{none}, +standing for \Lcs{Rnode}, \Lcs{rnode}, \Lcs{Cnode}, \Lcs{fnode}, +\Lcs{pnode}, \Lcs{circlenode}, \Lcs{ovalnode}, \Lcs{dotnode} and no node, +respectively. Note that for circles, you use \Lkeyset{mnode=C} and set the radius +with the \Lkeyword{radius} parameter. + +For example:\label{nab-example} +\begin{LTXexample} + \psmatrix[mnode=circle,colsep=1] + & A \\ + B & E & C \\ + & D & + \endpsmatrix + \psset{shortput=nab,arrows=->,labelsep=3pt} + \small + \ncline{2,2}{2,3}^[npos=.75]{a} + \ncline{2,2}{2,1}^{b} + \ncline{3,2}{2,1}^{c} + \ncarc[arcangle=-40,border=3pt]{3,2}{1,2}% + _[npos=.3]{d}^[npos=.7]{e} + \ncarc[arcangle=12]{1,2}{2,1}^{f} + \ncarc[arcangle=12]{2,1}{1,2}^{g} +\end{LTXexample} + +Note that a node is made only for the non-empty entries. You can also specify +a node for the empty entries by setting the + \LKeyword{emnode=type} +parameter. + + + +You can change parameters for a single entry by starting this entry with the +parameter changes, enclosed in square brackets. Note that the changes affect +the way the node is made, but not contents of the entry (use \Lcs{psset} for +this purpose). For example: +\begin{LTXexample} +$ \psmatrix[colsep=1cm] + & [mnode=circle] X \\ + Y & Z + \endpsmatrix + \psset{nodesep=3pt,arrows=->} + \ncline{1,2}{2,1} + \ncline{1,2}{2,2} + \ncline[linestyle=dotted]{2,1}{2,2} $ +\end{LTXexample} + + + +If you want your entry to begin with a \verb|[| that is not meant to indicate +parameter changes, the precede it by \verb|{}|. + +You can assign your own name to a node by setting the + \LKeyword{name=<name>} +parameter at the beginning of the entry, as described above. You can still +refer to the node by \verb|{<row>,<col>}|, but here are a few reasons for giving +your own name to a node: +\begin{itemize} + \item The name may be easier to keep track of; + \item Unlike the \verb|{<row>,<col>}| names, the names you give remain valid + even when you add extra rows or columns to your matrix. + \item The names remain valid even when you start a new \Lcs{psmatrix} that + reuses the \verb|{<row>,<col>}| names. +\end{itemize} + + +Here a few more things you should know: +\begin{itemize} + \item The baselines of the nodes pass through the centers of the + nodes. \Lcs{psmatrix} achieves this by setting the + \LKeyword{nodealign=true/false} +parameter to \verb|true|. You can also set this parameter outside of \Lcs{psmatrix} +when you want this kind of alignment. + + \item You can left or right-justify the nodes by setting the + \LKeyword{mcol=l/r/c} +parameter. \verb|l|, \verb|r| and \verb|c| stand for \verb|left|, \verb|right| and \verb|center|, +respectively. + + \item The space between rows and columns is set by the + \LKeyword{rowsep=dim} and + \LKeyword{colsep=dim} +parameters. + + \item If you want all the nodes to have a fixed width, set + \LKeyword{mnodesize=dim} +to a positive value. + + \item If \Lcs{psmatrix} is used in math mode, all the entries are set in math + mode, but you can switch a single entry out of math mode by starting and + ending the entry with \verb|$|. %$ + + \item The radius of the \verb|c| \Lkeyword{mnode} (corresponding to \Lcs{cnode}) is set by +the \Lkeyword{radius} parameter. + + \item Like in \LaTeX, you can end a row with \verb|\\[<dim>]| to insert an extra + space <dim> between rows. + + \item The command \Lcs{psrowhookii} is executed, if defined, at the beginning of + every entry in row \verb|ii| (row 2), and the command \Lcs{pscolhookv} is executed at + athe beginning of every entry in column \verb|v| (etc.). You can use these hooks, + for example, to change the spacing between two columns, or to use a special + \Lkeyword{mnode} for all the entries in a particular row. + + \item An entry can itself be a node. You might do this if you want an entry + to have two shapes. + + \item If you want an entry to stretch across several (\Largb{<int>}) columns, use the + +\begin{BDef} +\Lcs{psspan}\Largb{int} +\end{BDef} + + \emph{at the end of the entry}. This is like Plain \TeX's \Lcs{multispan}, or + \LaTeX's \Lcs{multicolumn}, but the template for the current column (the first + column that is spanned) is still used. If you want wipe out the template as + well, use \Lcs{multispan}\Largb{<int>} \emph{at the beginning of the entry} instead. + If you just want to wipe out the template, use \Lcs{omit} before the entry. + + \item \Lcs{psmatrix} can be nested, but then all node connections and other + references to the nodes in the \verb|{<row>,<col>}| form for the nested matrix + \emph{must go inside} the \Lcs{psmatrix}. This is how PSTricks decides which + matrix you are referring to. It is still neatest to put all the node + connections towards the end; just be sure to put them before \Lcs{endpsmatrix}. + Be careful also not to refer to a node until it actually appears. The whole + matrix can itself go inside a node, and node connections can be made as + usual. This is not the same as connecting nodes from two different + \Lcs{psmatrix}'s. To do this, you must give the nodes names and refer to them + by these names. + +\end{itemize} + +\section{Obsolete put commands} + +This is old documentation, but these commands will continue to be supported. + +There is also an obsolete command \Lcs{Lput} for putting labels +next to node connections. The syntax is + +\begin{BDef} + \Lcs{Lput}\Largb{<labelsep>}\Largs{<refpoint>}\Largb{<rotation>}\Largr(<pos>)\Largb{<stuff>} +\end{BDef} + +It is a combination of \Lcs{Rput} and \Lcs{lput}, equivalent to + +\begin{BDef} + \Lcs{lput}\Largr{<pos>}\Largb{\Lcs{Rput}\Largb{<labelsep>}\Largs{<refpoint>}\Largb{<rotation>}\Largr{0,0}\Largb{<stuff>}} +\end{BDef} + +\Lcs{Mput} is a short version of \Lcs{Lput} with no +\verb|{<rotation>}| or \verb|(<pos>)| argument. \Lcs{Lput} and \Lcs{Mput} remain part of +PSTricks only for backwards compatibility. + +Here are the node label commands: + +\begin{BDef} +\LcsStar{lput}\OptArgs\Largs{refpoint}\Largb{rotation}\Largr{pos}\Largb{stuff} +\end{BDef} + +The \verb|l| stands for ``label''. Here is an example illustrating the use of the +optional star and \verb|:<angle>| with \Lcs{lput}, as well as the use of the +\Lkeyword{offset} parameter with \Lcs{pcline}: + +\begin{LTXexample}[width=5cm] +\begin{pspicture}(4,2.3) + \pspolygon(0,0)(4,2)(4,0) + \pcline[offset=12pt]{|-|}(0,0)(4,2) + \lput*{:U}{Length} +\end{pspicture} +\end{LTXexample} + +(Remember that with the \nxLcs{?put} commands, you can omit the coordinate if you +include the angle of rotation. You are likely to use this feature with the +node label commands.) + +With \Lcs{lput} and \Lcs{rput}, you have a lot of control over the position of the +label. E.\,g., + +\begin{LTXexample}[width=5cm] +\begin{pspicture}(4,2) + \pcline(0,0)(4,2) + \lput{:U}{\rput[r]{N}(0,.4){label}} +\end{pspicture} +\end{LTXexample} + + + +puts the label upright on the page, with right side located .4 centimeters +``above'' the position 0.5 of the node connection (above if the node +connection points to the right). However, the \Lcs{aput} and \Lcs{bput} commands +described below handle the most common cases without \Lcs{rput}.\footnote{% +There is also an obsolete command \Lcs{Lput} for putting labels +next to node connections. The syntax is + +\begin{BDef} + \LcsStar{Lput}\Largb{<labelsep>}\Largs{<refpoint>}\Largb{<rotation>}\Largr{<pos>}\Largb{<stuff>} +\end{BDef} + +It is a combination of \Lcs{Rput} and \Lcs{lput}, equivalent to + +\begin{BDef} + \LcsStar{lput}\Largr{<pos>}\Largb{\Lcs{Rput}\Largb{<labelsep>}\Largs{<refpoint>}\Largb{<rotation>}\Largr{0,0}\Largb{<stuff>}} +\end{BDef} + +\Lcs{Mput} is a short version of \Lcs{Lput} with no +\texttt{\{<rotation>\}} or \texttt{(<pos>)} argument. \Lcs{Lput} and \Lcs{Mput} remain part of +PSTricks only for backwards compatibility.} + +\begin{BDef} +\LcsStar{aput}\Largs{labelsep}\Largb{angle}\Largr{pos}\Largb{stuff} +\end{BDef} + + \Largb{<stuff>} is positioned distance \Lcs{pslabelsep} \emph{above} the node +connection, given the convention that node connections point to the right. +\Lcs{aput} is a node-connection variant of \Lcs{uput}. For example: + +\begin{LTXexample}[width=5cm] +\begin{pspicture}(4,2) + \pspolygon(0,0)(4,2)(4,0) + \pcline[linestyle=none](0,0)(4,2) + \aput{:U}{Hypotenuse} +\end{pspicture} +\end{LTXexample} + +\begin{BDef} +\LcsStar{bput}\Largs{labelsep}\Largb{angle}\Largr{pos}\Largb{stuff} +\end{BDef} + + This is like \Lcs{aput}, but \Largb{<stuff>} is positioned \emph{below} the node +connection. + + + It is fairly common to want to use the default position and rotation with +these node connections, but you have to include at least one of these +arguments. Therefore, PSTricks contains some variants: + +\begin{BDef} +\Lcs{mput}\Largs{refpoint}\Largb{stuff}\\ +\Lcs{Aput}\Largs{labelsep}\Largb{stuff}\\ +\Lcs{Bput}\Largs{labelsep}\Largb{stuff} +\end{BDef} + +of \Lcs{lput}, \Lcs{aput} and \Lcs{bput}, respectively, that have no angle or +positioning argument. For example: + +\begin{LTXexample}[width=5cm] +\begin{pspicture}(4,2) + \cnode*(0,0){3pt}{A} + \cnode*(4,2){3pt}{B} + \ncline[nodesep=3pt]{A}{B} + \mput*{1} +\end{pspicture} +\end{LTXexample} + +Here is another: + +\begin{LTXexample}[width=5cm] +\begin{pspicture}(4,2) + \pcline{<->}(0,0)(4,2) + \Aput{Label} +\end{pspicture} +\end{LTXexample} + +\clearpage +\part{New commands} + +\section{Nodes} + + +\section{Setting bounding box nodes with \nxLcs{psDefBoxNodes}} + +\begin{BDef} +\Lcs{psDefBoxNodes}\Largb{node name}\Largb{text}\\ +\end{BDef} + +Setting nodes for a bounding box of a given text. There will be 12 nodes defined, +with the name that has the suffixes +\texttt{:tl, :tC, :tr, +:Cl, :C, :Cr, +:Bl, :BC, :Br, +:bl, :bc, :br}. The prefix is always the given node name. The node name shouldn't contain spaces or special +characters, like umlauts or an active \PS\ character, like \texttt{(}. + +\lstset{style=code} +\begin{LTXexample}[pos=t,wide,vsep=10mm,preset=\centering,columns=fixed] +\psscalebox{15}{\psDefBoxNodes{Age}{\color{red!50}\sffamily \"Age}}% +\pspolygon[fillstyle=solid, + fillcolor=blue!30,opacity=0.3](Age:tl)(Age:tr)(Age:br)(Age:bl)% +\psline[linestyle=dashed](Age:Bl)(Age:Br)% +\psdots(Age:tl)(Age:tC)(Age:tr)(Age:Cl)(Age:C)(Age:Cr)% + (Age:Bl)(Age:BC)(Age:Br)(Age:bl)(Age:bC)(Age:br)% +\pcline[arrows=<->,linecolor=blue,arrowscale=1.25](Age:tC)(Age:Br) +\uput[180](Age:tl){tl}\uput[180](Age:Cl){Cl}\uput[180](Age:Bl){Bl}\uput[180](Age:bl){bl} +\uput[90](Age:tC){tC} \uput[0](Age:C){C} \uput[0](Age:BC){BC} \uput[-90](Age:bC){bC} +\uput[0](Age:tr){tr} \uput[0](Age:Cr){Cr} \uput[0](Age:Br){Br} \uput[0](Age:br){br} +\end{LTXexample} + + + + +\clearpage + +%-------------------------------------------------------------------------------------- +\section{Relative nodes with \nxLcs{psGetNodeCenter} or \texttt{N-<name>.x|y}} +%-------------------------------------------------------------------------------------- + +\begin{BDef} +\Lcs{psGetNodeCenter}\Largb{node name}\\ +%\Lcs{psGetNodeEdgeA}\Largb{node type}\Largb{node name} +\end{BDef} + +This command makes sense only at +the PostScript level. It defines the two variables \Larg{node.x} +and \Larg{node.y} which can be used to define relative nodes. The +following example defines the node \verb+MyNode+ and a second one +relative to the first one, with 4 units left and 4 units up. +\Larg{node} must be an existing node name. Nodes are saved in an own +dictionary with the current transformation matrix, which is reset when +using the macro \Lcs{psGetNodeCenter}. + +\begin{LTXexample}[width=5cm] +\begin{pspicture}[showgrid,arrowscale=2](5,5) +\pnode(4.5,0.5){MyNode} +\psdot(MyNode) +\pnode(! \psGetNodeCenter{MyNode} + MyNode.x 4 sub MyNode.y 4 add){MySecondNode} +\psdot(MySecondNode) +\ncline[linecolor=red]{<->}{MyNode}{MySecondNode} +\end{pspicture} +\end{LTXexample} + +\begin{LTXexample}[width=5cm] +\begin{pspicture}[showgrid](5,5) +\rput(1.5,0.5){\trinode{CN}{NodeA}} +\rput(3.5,2.5){\trinode{EN}{NodeB}} +\pnode(! \psGetNodeCenter{CN} + CN.x 2 add CN.y 1 add ){MyCNode} +\ncline[linecolor=red]{<->}{MyCNode}{EN} +\ncline[linecolor=blue]{<->}{CN}{EN} +\end{pspicture} +\end{LTXexample} + + +The coordinates of the nodes can also be saved with \Lkeyword{saveNodeCoors} in global defined names +\texttt{N-<name>.x} and \texttt{N-<name>.y}. With the optional argument \Lkeyword{NodeCoorPrefix}, which is +by default empty, the name setting can be changed to \texttt{<NodeCoorPrefix><name>x} and \texttt{<NodeCoorPrefix><name>y}. + +The forgoing examples can be simplified if you +do not need the resetting of the transformation matrix: + + + +\begin{LTXexample}[width=5cm] +\begin{pspicture}[showgrid,arrowscale=2, + saveNodeCoors](5,5) +\pnode(4.5,0.5){MyNode} +\psdot(MyNode) +\pnode(! N-MyNode.x 4 sub N-MyNode.y 4 add){MySecondNode} +\psdot(MySecondNode) +\ncline[linecolor=red]{<->}{MyNode}{MySecondNode} +\end{pspicture} +\end{LTXexample} + + +\bigskip +In the following example it doesn't work because the relative node setting via \Lcs{rput} +is not taken into account. + +\begin{LTXexample}[width=5cm] +\begin{pspicture}[showgrid,saveNodeCoors](5,5) +\rput(1.5,0.5){\trinode{CN}{NodeA}} +\rput(3.5,2.5){\trinode{EN}{NodeB}} +\pnode(! N-CN.x 2 add N-CN.y 1 add ){MyCNode} +\ncline[linecolor=red]{<->}{MyCNode}{EN} +\ncline[linecolor=blue]{<->}{CN}{EN} +\end{pspicture} +\end{LTXexample} + + + + +%-------------------------------------------------------------------------------------- +\section{Getting node edges with \nxLcs{psGetNodeEdgeA} and \nxLcs{psGetNodeEdgeB}} +%-------------------------------------------------------------------------------------- + +\begin{BDef} +\Lcs{psGetNodeEdgeA}\Largb{node name}\\ +\Lcs{psGetNodeEdgeB}\Largb{node name}\\ +\end{BDef} + +When two nodes are connected the line often did not use the center of the defined +nodes. Values as \Lkeyword{nodesep} or \Lkeyword{offset} are also taken into account +as a surrounding border of a node. With these new macros one can get the edge coordinates +of two given nodes. The coordinates are saved on \PS side in the values \Larg{node.x} +and \Larg{node.y}. + + +\begin{LTXexample}[pos=t] +\Huge +\hspace*{4cm}\rnode{B}{Node B} + +\vspace{2cm} +\rnode{A}{Node A} +\ncline{A}{B} +\pscircle*[linecolor=blue,opacity=0.4](!\psGetEdgeA{A}{B}){10pt} +\pscircle*[linecolor=blue,opacity=0.4](!\psGetEdgeB{A}{B}){10pt} +\end{LTXexample} + + + + +%-------------------------------------------------------------------------------------- +\section{\nxLcs{ncdiag} and \nxLcs{pcdiag}} +%-------------------------------------------------------------------------------------- +With the new option \Lkeyword{lineAngle} the lines drawn by the \Lcs{ncdiag} macro +can now have a specified gradient. Without this option one has to define the two +arms (which maybe zero) and PSTricks draws the connection between them. Now there +is only a static \Lkeyword{armA}, the second one \Lkeyword{armB} is calculated when an angle +\Lkeyword{lineAngle} is defined. This angle is the gradient of the intermediate line +between the two arms. The syntax of \Lcs{ncdiag} is + +\begin{BDef} +\Lcs{ncdiag}\OptArgs\Largb{node A}\Largb{node B}\\ +\Lcs{pcdiag}\OptArgs\Largs{node A}\Largs{node B} +\end{BDef} + + +\begin{tabularx}{\linewidth}{l|X} +name & meaning\\\hline +\Lkeyword{lineAngle} & angle of the intermediate line segment. Default is 0, which is the same +than using \Lcs{ncdiag} without the \Lkeyword{lineAngle} option.\tabularnewline +\end{tabularx} + + +\begin{LTXexample}[width=5.5cm] +\begin{pspicture}(5,6) + \circlenode{A}{A}\quad\circlenode{C}{C}% + \quad\circlenode{E}{E} + \rput(0,4){\circlenode{B}{B}} + \rput(1,5){\circlenode{D}{D}} + \rput(2,6){\circlenode{F}{F}} + \psset{arrowscale=2,linearc=0.2,% + linecolor=red,armA=0.5, angleA=90,angleB=-90} + \ncdiag[lineAngle=20]{->}{A}{B} + \ncput*[nrot=:U]{line I} + \ncdiag[lineAngle=20]{->}{C}{D} + \ncput*[nrot=:U]{line II} + \ncdiag[lineAngle=20]{->}{E}{F} + \ncput*[nrot=:U]{line III} +\end{pspicture} +\end{LTXexample} + +The \Lcs{ncdiag} macro sets the \Lkeyword{armB} dynamically to the calculated value. Any +user setting of \Lkeyword{armB} is overwritten by the macro. The \Lkeyword{armA} could be set to +a zero length: + + +\begin{LTXexample}[width=4.5cm] +\begin{pspicture}(4,3) + \rput(0.5,0.5){\circlenode{A}{A}} + \rput(3.5,3){\circlenode{B}{B}} + {\psset{linecolor=red,arrows=<-,arrowscale=2} + \ncdiag[lineAngle=60,% + armA=0,angleA=0,angleB=180]{A}{B} + \ncdiag[lineAngle=60,% + armA=0,angleA=90,angleB=180]{A}{B}} +\end{pspicture} +\end{LTXexample} + + +\begin{LTXexample}[width=4.5cm] +\begin{pspicture}(4,3) + \rput(1,0.5){\circlenode{A}{A}} + \rput(4,3){\circlenode{B}{B}} + {\psset{linecolor=red,arrows=<-,arrowscale=2} + \ncdiag[lineAngle=60, + armA=0.5,angleA=0,angleB=180]{A}{B} + \ncdiag[lineAngle=60, + armA=0,angleA=70,angleB=180]{A}{B} + \ncdiag[lineAngle=60, + armA=0.5,angleA=180,angleB=180]{A}{B}} +\end{pspicture} +\end{LTXexample} + +\begin{LTXexample}[width=4.5cm] +\begin{pspicture}(4,5.5) + \cnode*(0,0){2pt}{A} \cnode*(0.25,0){2pt}{C} + \cnode*(0.5,0){2pt}{E}\cnode*(0.75,0){2pt}{G} + \cnode*(2,4){2pt}{B} \cnode*(2.5,4.5){2pt}{D} + \cnode*(3,5){2pt}{F} \cnode*(3.5,5.5){2pt}{H} + {\psset{arrowscale=2,linearc=0.2, + linecolor=red,armA=0.5, angleA=90,angleB=-90} + \pcdiag[lineAngle=20]{->}(A)(B) + \pcdiag[lineAngle=20]{->}(C)(D) + \pcdiag[lineAngle=20]{->}(E)(F) + \pcdiag[lineAngle=20]{->}(G)(H)} +\end{pspicture} +\end{LTXexample} + + +%-------------------------------------------------------------------------------------- +\section{\nxLcs{ncdiagg} and \nxLcs{pcdiagg}} +%-------------------------------------------------------------------------------------- +This is nearly the same as \Lcs{ncdiag} except that +\Lkeyword{armB}=0 and the \Lkeyword{angleB} value is computed by the +macro, so that the line ends at the node with an angle like a +\Lcs{pcdiagg} line. The syntax of \Lcs{ncdiagg}/\Lcs{pcdiagg} +is + +\begin{BDef} +\Lcs{ncdiag}\OptArgs\Largb{node A}\Largb{node B}\\ +\Lcs{pcdiag}\OptArgs\Largs{node A}\Largs{node B} +\end{BDef} + +\begin{LTXexample}[width=5cm] +\begin{pspicture}(4,6) + \psset{linecolor=black} + \circlenode{A}{A}\quad\circlenode{C}{C}\quad% + \circlenode{E}{E} + \rput(0,4){\circlenode{B}{B}} + \rput(1,5){\circlenode{D}{D}} + \rput(2,6){\circlenode{F}{F}} + {\psset{arrowscale=2,linearc=0.2, + linecolor=red,armA=0.5, angleA=90} + \ncdiagg[lineAngle=-160]{->}{A}{B} + \ncput*[nrot=:U]{line I} + \ncdiagg[lineAngle=-160]{->}{C}{D} + \ncput*[nrot=:U]{line II} + \ncdiagg[lineAngle=-160]{->}{E}{F} + \ncput*[nrot=:U]{line III}} +\end{pspicture} +\end{LTXexample} + +\begin{LTXexample}[width=5cm] +\begin{pspicture}(4,6) + \psset{linecolor=black} + \cnode*(0,0){2pt}{A} \cnode*(0.25,0){2pt}{C} + \cnode*(0.5,0){2pt}{E}\cnode*(0.75,0){2pt}{G} + \cnode*(2,4){2pt}{B} \cnode*(2.5,4.5){2pt}{D} + \cnode*(3,5){2pt}{F} \cnode*(3.5,5.5){2pt}{H} + {\psset{arrowscale=2,linearc=0.2, + linecolor=red,armA=0.5, angleA=90} + \pcdiagg[lineAngle=20]{->}(A)(B) + \pcdiagg[lineAngle=20]{->}(C)(D) + \pcdiagg[lineAngle=20]{->}(E)(F) + \pcdiagg[lineAngle=20]{->}(G)(H)} +\end{pspicture} +\end{LTXexample} + +The only catch for \Lcs{ncdiagg} is that you need the right +value for \Lkeyword{lineAngle}. If the node connection is on the wrong +side of the second node, then choose the corresponding angle, +e.\,g.: if $20$ is wrong then take $-160$, which differs by $180$. + + +\begin{LTXexample}[width=4cm] +\begin{pspicture}(4,1.5) + \circlenode{a}{A} + \rput[l](3,1){\rnode{b}{H}} + \ncdiagg[lineAngle=60,angleA=180,armA=.5,nodesepA=3pt,linecolor=blue]{b}{a} +\end{pspicture} +\end{LTXexample} + +\begin{LTXexample}[width=4cm] +\begin{pspicture}(4,1.5) + \circlenode{a}{A} + \rput[l](3,1){\rnode{b}{H}} + \ncdiagg[lineAngle=60,armA=.5,nodesepB=3pt,linecolor=blue]{a}{b} +\end{pspicture} +\end{LTXexample} + +\begin{LTXexample}[width=4cm] +\begin{pspicture}(4,1.5) + \circlenode{a}{A} + \rput[l](3,1){\rnode{b}{H}} + \ncdiagg[lineAngle=-120,armA=.5,nodesepB=3pt,linecolor=blue]{a}{b} +\end{pspicture} +\end{LTXexample} + +%-------------------------------------------------------------------------------------- +\section{\nxLcs{ncbarr}} +%-------------------------------------------------------------------------------------- +This has the same behaviour as \Lcs{ncbar}, but has 5 segments +and all are horizontal ones. This is the reason why \Lkeyword{angleA} +must be $0$ or alternatively $180$. All other values are set to +$0$ by the macro. The intermediate horizontal line is symmetrical +to the distance of the two nodes. + +\begin{BDef} +\Lcs{ncbarr}\OptArgs\Largb{node A}\Largb{node B}\\ +\end{BDef} + +\begin{LTXexample}[width=3.5cm] +\psset{arrowscale=2}% +\circlenode{X}{X}\\[1cm] +\circlenode{Y}{Y} +\ncbarr[angleA=0,arrows=->,arrowscale=2]{X}{Y} +\end{LTXexample} + +\begin{LTXexample}[width=3.5cm] +\psset{arrowscale=2}% +\ovalnode{X}{Xxxxx}\\[1cm] +\circlenode{Y}{Yyyy} +\ncbarr[angleA=180,arrows=->,arrowscale=2,linecolor=red]{X}{Y} +\end{LTXexample} + +\begin{LTXexample}[width=3.5cm] +\psset{arrowscale=2}% +\ovalnode{X}{Xxxxx}\\[1cm] +\circlenode{Y}{Yyyy} +\ncbarr[angleA=20,arm=1cm,arrows=->,arrowscale=2]{X}{Y} +\end{LTXexample} + +%-------------------------------------------------------------------------------------- +\section{\nxLcs{psLNode} and \nxLcs{psLCNode}} +%-------------------------------------------------------------------------------------- +\Lcs{psLNode} interpolates the Line $\overline{AB}$ by the given value and sets a node at this +point. The syntax is +% +\begin{BDef} +\Lcs{psLNode}\Largs{P1}\Largs{P2}\Largb{value}\Largb{node name}\\ +\Lcs{psLCNode}\Largs{P1}\Largb{value 1}\Largs{P2}\Largb{value 2}\Largb{node name} +\end{BDef} + +\begin{LTXexample}[width=5cm] +\begin{pspicture}(5,5) +\psgrid[subgriddiv=0,griddots=10] +\psset{linecolor=red} +\psline{o-o}(1,1)(5,5) +\psLNode(1,1)(5,5){0.75}{PI} +\qdisk(PI){4pt} +\psset{linecolor=blue} +\psline{o-o}(4,3)(2,5) +\psLNode(4,3)(2,5){-0.5}{PII} +\qdisk(PII){4pt} +\end{pspicture} +\end{LTXexample} + + +\bigskip +The \Lcs{psLCNode} macro builds the linear combination of the two given +vectors and stores the end of +the new vector as a node. All vectors start at $(0,0)$, so a \Lcs{rput} maybe +appropriate. The syntax is + + +\begin{LTXexample}[width=5cm] +\begin{pspicture}[showgrid](5,3) +\psset{linecolor=black} +\psline[linestyle=dashed]{->}(3,1.5) +\psline[linestyle=dashed]{->}(0.375,1.5) +\psset{linecolor=red} +\psline{->}(2,1)\psline{->}(0.5,2) +\psLCNode(2,1){1.5}(0.5,2){0.75}{PI} +\psline[linewidth=2pt]{->}(PI) +\psset{linecolor=black} +\psline[linestyle=dashed](3,1.5)(PI) +\psline[linestyle=dashed](0.375,1.5)(PI) +\end{pspicture} +\end{LTXexample} + + + +%-------------------------------------------------------------------------------------- +\section{\nxLcs{nlput} and \nxLcs{psLDNode}} +%-------------------------------------------------------------------------------------- +\Lcs{ncput} allows you to set a label relative to the first node +of the last node connection. With \Lcs{nlput} this can be done +absolute to a given node. The syntax is different to the other +node connection macros. It uses internally the macro +\Lcs{psLDNode} which places a node absolute to two given points, +starting from the first one. + +\begin{BDef} +\Lcs{nlput}\OptArgs\Largr{A}\Largr{B}\Largb{distance}\Largb{text}\\ +\Lcs{psLDNode}\OptArgs\Largr{A}\Largr{B}\Largb{distance}\Largb{node name} +\end{BDef} + + +\begin{LTXexample}[width=5cm] +\begin{pspicture}(5,2) +\pnode(0,0){A} +\pnode(5,2){B} +\ncline{A}{B} +\psLDNode(A)(B){1.5cm}{KN}\qdisk(KN){2pt} +\nlput[nrot=:U](A)(B){1cm}{Test} +\nlput[nrot=:D](A)(B){2cm}{Test} +\nlput[nrot=:U](A)(B){3cm}{Test} +\nlput(A)(B){4cm}{Test} +\end{pspicture} +\end{LTXexample} + +\section{Extensions} + +\subsection{Node definitions} +All macros in this section are connected in one way or other with the +construction or deployment of +one or more nodes of type \Lcs{pnode}, which is to say in effect, +named points. For the remainder of this section, node always means \Lcs{pnode}. +Nodes are one of +the most powerful features of pstricks---the ``trickiest tricks'' in the words of +its originator. If used without appropriate caution, they can produce PostScript errors +that can be difficult to track down. For example, suppose you have defined a node \texttt{A} +by \verb|\pnode(1,1){A}|, and then, a little later, you want to move the node a bit to the +right, and you write \verb|\pnode([nodesep=.5cm]A){A}|. On processing the file you will +see an error message from ghostscript: \Lps{stackunderflow}\verb| in --exch--|. +The lesson is: you may not assign a node name if a node by that name is involved +explicitly in its definition. To reassign a node name safely, you have to write instead something like +\begin{verbatim} +\pnode([nodesep=.5cm]A){Atemp} +\pnode(Atemp){A} +\end{verbatim} +This problem afflicts a number of other node-forming macros based on a \Lcs{pnode} construction, as most are. + +Nodes are more complicated than they appear. Each node is stored not only with a recipe +for finding its coordinates, but also with the coordinate system in effect when it was +defined. Part of the retrieval process involves modifying the coordinates if necessary +so that they represent the same point on the page even if the coordinate system has +changed. This is important, but has some unexpected consequences. Normally, the simplest +way to translate an object is with \Lcs{rput}. +\begin{verbatim} +\pnode(1,1){P}% define P as (1,1) +\rput(2,3){\psdot{P}}% places dot at original P=(1,1) +\end{verbatim} +is different from +\begin{verbatim} +\rput(2,3){\pnode(1,1){P}\psdot{P}} +% places dot at (1,1)+(2,3) +\end{verbatim} +Effectively, \Lcs{rput} and \Lcs{uput} are not useful for translating previously +defined nodes, but they are useful for defining new nodes relative to fixed positions. + +The new macros in this section +are of several kinds: (i) utility macros, some used +internally by the package and some of general use; (ii) macros that manipulate one or +more nodes to produce other nodes; (iii) constructions intended to be used with nodes and +node sequences. By a node sequence is meant one or more nodes having a common root name +followed by an index---eg, P0 P1 P2 ... P5 is a node sequence with root name P. It is +easy to define such node sequences using the \Lcs{multido} macro, or using one of a +number of macros in this section. + + + + +\subsection{Node expressions} +A number of macros in the package (eg, \Lcs{psxline}) permit the use of node expressions, +by which is meant an expression like +\begin{verbatim} +.25(1,3)+.333(2;90)-1.2([nodesep=.5cm]Q) +\end{verbatim} +which specifies a linear combination of points (the items enclosed in parentheses) +specified in any manner acceptable to \Lcs{SpecialCoor}. +%The items themselves cannot +%themselves be node expressions, as they are not acceptable to \Lcs{SpecialCoor}. + +Node expressions are handled by \Lcs{nodexn}, which calls the macros \Lcs{hasparen} and +\Lcs{parsenodexn} to do the real work. If you write code that needs to be able to handle node expressions, you use + +\begin{BDef} +\Lcs{nodexn}\Largb{expr}\Largb{nodename} +\end{BDef} + +which returns a node \verb|<nodename>| once \verb|<expr>| has been fully parsed. It is safe to +reuse a node name, as in +\begin{verbatim} +\nodexn{(P)+.5(1,2)}{P} +\end{verbatim} + +The following macros amount to special cases of node expressions. +\begin{BDef} +\Lcs{AtoB}\Largr{A}\Largr{B}\Largb{C} +\end{BDef} + defines a node by name C essentially as B-A, as vectors. It is safe to use + \Lcs{AtoB}\verb|(Q)(P){P}| and \Lcs{AtoB}\verb|(Q)(P){Q}|. + +\begin{BDef} +\Lcs{AplusB}\Largr{A}\Largr{B}\Largb{C} +\end{BDef} + defines node by name C essentially as A+B, as vectors. It is safe to use + \Lcs{AplusB}\verb|(Q)(P){P}| and \Lcs{AplusB}\verb|(Q)(P){Q}|. + +\begin{BDef} +\Lcs{midAB}\Largr{A}\Largr{B}\Largb{C} +\end{BDef} + + defines node by name C essentially as $(A+B)/2$, as vectors. It is safe to use \Lcs{midAB}\verb|(Q)(P){P}| + and \Lcs{midAB}\verb|(Q)(P){Q}|. + +\begin{LTXexample}[width=.35\textwidth] +\begin{pspicture}[showgrid](-.5,-.5)(2.5,2.5) +\psset{arrows=->,arrowscale=1.5} +\pnode(2,1){P}\pnode(.5,1){Q} +\AtoB(Q)(P){QP} +\AplusB(Q)(P){R} +\psline(0,0)(P)\uput[-45](P){P} +\psline(0,0)(Q)\uput[135](Q){Q} +\psline(0,0)(QP)\uput[-70](QP){QP} +\psline(0,0)(R)\uput[160](R){R} +\psline[linestyle=dashed](Q)(P) +\psline[linestyle=dashed](Q)(R) +\psline[linestyle=dashed](P)(R) +\end{pspicture} +\end{LTXexample} + + +\subsection{The main macros} +\begin{BDef} +\Lcs{normalvec}\Largr{coords}\Largb{nodename} +\end{BDef} +For example, +\begin{verbatim} +\normalvec(P){P}\normalvec(2;30){Q} +\end{verbatim} +first redefines the node \texttt{P} as a node whose vector interpretation is of the same +length as the original \texttt{P}, but rotated 90 degrees. The second instance has the +same effect as \Lcs{pnode}\verb|(2;120){Q}|. +\begin{BDef} +\Lcs{curvepnode}\Largb{tval}\Largb{expression in t}\Largb{nodename} +\end{BDef} + +For example, +\begin{verbatim} +\curvepnode{1}{cos(t) | sin(t)}{P} +\end{verbatim} + sets a node named \texttt{P} at \verb|(cos(1), sin(1))| and a node named \texttt{Ptang} + which represents a unit vector in the tangent direction to the curve at \texttt{P}. + The expression in \texttt{t} in this case is algebraic, which is detected automatically by the macro. + +\begin{LTXexample}[width=.35\textwidth] +\begin{pspicture}[showgrid](-.5,-.5)(2.5,2) +\def\exn{cos(t) | sin(t)} +\psparametricplot[algebraic]{0}{2}{\exn} +\curvepnode{1}{\exn}{P} +\psdot(P)\uput[45](P){P} +\end{pspicture} +\end{LTXexample} +\vspace{2pc} + +\begin{BDef} +\Lcs{psparnode}\Largb{t}\Largb{expression in t}\Largb{<nodename>} +\end{BDef} + is called by the command \Lcs{curvename} if the expression is PostScript, not algebraic. + +\begin{BDef} +\Lcs{algparnode}\Largb{t}\Largb{expression in t}\Largb{nodename} +\end{BDef} + is called by the command \Lcs{curvename} if the expression is algebraic, not PostScript. + +\begin{BDef} +\Lcs{curvepnodes}\Largb{tmin}\Largb{tmax}\Largb{expr. in t}\Largb{nodeRoot} +\end{BDef} + + + + Uses current setting of plotpoints (default 50) to define a node sequence of points along the curve. Eg, +\begin{verbatim} +\curvepnodes[plotpoints=100]{0}{1}{t+t^2 | Ex(-t)}{P} +\end{verbatim} + sets nodes \texttt{P0 .. P99} at equally spaced \texttt{t} values along the curve, + and assigns the macro \Lcs{Pnodecount} to 99, the highest index. The expression in \texttt{t} + may be either algebraic or PostScript, and is handled automatically. The values + \verb|<tmin>, <tmax>| may be expressed using PostScript---eg, \verb|{Pi neg}{PiDiv2}|. + +\begin{LTXexample}[width=.35\textwidth] +\begin{pspicture}[showgrid](-.5,-.5)(2.5,3) +\def\exn{t+t^2 | 2*Ex(-t)} +\psset{plotpoints=100} +\psparametricplot[algebraic]{0}{1}{\exn} +\curvepnodes{0}{1}{\exn}{P} +\psdot(P50)\uput[75](P50){P50} +\psdot(P99)\uput[75](P99){P99} +\end{pspicture} +\end{LTXexample} + + +\begin{BDef} +\Lcs{fnpnode}\Largb{xval}\Largb{expression in x}\Largb{nodename} +\end{BDef} + + sets a single node on the graph. Eg, + +\begin{verbatim} +\fnpnode{.5}{x x 1 add mul 2 div}{P} +\end{verbatim} + declares the node P at the point x=0.5 on the graph. It has the same effect as + +\begin{verbatim} +\pnode(!/x 0.5 def x x x 1 add mul 2 div}){P} +\end{verbatim} + + If your expression in \texttt{t} is algebraic, you must specify the keyword \texttt{algebraic}, as in + \Lcs{fnpnode}\verb|[algebraic]{0.5}{x*(x+1)/2}{P}|. + +\begin{LTXexample}[width=.35\textwidth] +\begin{pspicture}[showgrid](-.5,-.5)(2.5,3) +\def\exn{x x 1 add mul 2 div} +\psplot{0}{2}{\exn} +\fnpnode{0.5}{\exn}{Q} +\psdot(Q)\uput[-45](Q){Q} +\end{pspicture} +\end{LTXexample} +\vspace{2pc} + + + +\begin{BDef} +\Lcs{fnpnodes}\Largb{xmin}\Largb{xmax}\Largb{expression in x}\Largb{nodeRoot} +\end{BDef} +Is similar to \Lcs{curvenodes}, but for the graph of a function. The keyword \Lkeyword{algebraic} +must be specified if your expression is indeed algebraic. + +\begin{LTXexample}[width=.35\textwidth] +\begin{pspicture}[showgrid](-.5,-.5)(2.5,3) +\def\exn{x x 1 add mul 2 div} +\psplot{0}{2}{\exn} +\fnpnodes[plotpoints=10]{0}{2}{\exn}{A} +\psdot(A4)\uput[-45](A4){A4} +\end{pspicture} +\end{LTXexample} +\vspace{2pc} + + +\begin{BDef} +\Lcs{shownode}\Largr{P} +\end{BDef} +is a debugging tool, which displays in the console window the coordinates of node P. +This will not appear until the final stage of processing the PostScript file. You will +get a PostScript error if the node you specify is undefined. + +\begin{BDef} +\Lcs{getnodelist}\Largb{node root name}\Largb{next command} +\end{BDef} + is useful in writing pstricks macros, where there is a list of parenthesized coordinates + to be read and turned into a node sequence, following which \verb|<next command>| is followed. +\label{pnodes} +\begin{BDef} +\Lcs{pnodes}\Largb{P}\Largr{1,2}\Largr{2;3}\ldots +\end{BDef} +is effectively \Lcs{getnodelist}\Largb{P}\Largb{}\verb|(1,2)(2;3)...|, just a quick way to +turn a list of coordinates into a node sequence P0 P1 ... + +\begin{BDef} +\Lcs{psnline}\OptArgs\Largb{arrows}\Largr{coors}\Largb{name} +\end{BDef} + for example, expects that there are nodes named P3..P8, and gives the same result as +\begin{verbatim} +\psline[linewidth=1pt]{->}(P3)(P4)(P5)(P6)(P7)(P8) +\end{verbatim} + + + +\begin{LTXexample}[width=.35\textwidth] +\begin{pspicture}[showgrid,algebraic](-.5,-.5)(2.5,2) +\pnodes{P}(.1,.1)(1;10)(*2 {x^2/4})(0,1.4) +%defines P0..P3--now join them +\psnline[arrowscale=2]{-D>}(0,3){P} +\end{pspicture} +\end{LTXexample} +\vspace{2pc} + + +\begin{BDef} +\Lcs{psnpolygon}\OptArgs\Largb{arrows}\Largr{coors}\Largb{name} +\end{BDef} +for example, expects that there are nodes named P3..P8, and gives the same result as +\begin{verbatim} +\pspolygon[linewidth=1pt]{->}(P3)(P4)(P5)(P6)(P7)(P8) +\end{verbatim} + +Conversion between any angle unit and degree unit + +\begin{LTXexample}[pos=t,vsep=1cm] +\begin{pspicture}[showgrid=b](-2,-2)(2,2) +\def\N{9 }% +\degrees[\N] +\curvepnodes[plotpoints=\numexpr\N+1]{0}{\N AnytoDeg}{t dup cos exch sin}{P} +\psnpolygon(0,\numexpr\Pnodecount-1){P} +\foreach \i in {0,1,...,\numexpr\Pnodecount-1}{% + \uput{6pt}[\i]{!\i\space 90 DegtoAny sub}(P\i){\psline{->}(0,12pt)}} +\end{pspicture} +\end{LTXexample} + + + +Conversion between any angle unit and radian unit + +\begin{LTXexample}[pos=t,vsep=1cm] +\begin{pspicture}[showgrid=b](-2,-2)(2,2) +\def\N{9 }% +\degrees[\N] +\curvepnodes[plotpoints=\numexpr\N+1]{0}{\N AnytoRad}{cos(t)|sin(t)}{P} +\psnpolygon(0,\numexpr\Pnodecount-1){P} +\foreach \i in {0,1,...,\numexpr\Pnodecount-1}{% + \uput{6pt}[\i]{!\i\space Pi 2 div RadtoAny sub}(P\i){\psline{->}(0,12pt)}} +\end{pspicture} +\end{LTXexample} + + + + + +\begin{BDef} +\Lcs{psncurve}\OptArgs\Largb{arrows}\Largr{coors}\Largb{name} +\end{BDef} + for example, expects that there are nodes named P3..P8, and gives the same result as +\begin{verbatim} +\pscurve[linewidth=1pt]{->}(P3)(P4)(P5)(P6)(P7)(P8) +\end{verbatim} + +\begin{LTXexample}[width=.35\textwidth] +\begin{pspicture}[showgrid,algebraic](-.5,-.5)(2.5,2) +\pnodes{P}(.1,.1)(1;10)(*2 {x^2/4})(0,1.4) +%defines P0..P3--now join them +\psncurve[arrowscale=2]{-D>}(0,3){P} +\end{pspicture} +\end{LTXexample} +\vspace{2pc} + +\begin{LTXexample}[width=.35\textwidth] +\begin{pspicture}[showgrid,algebraic](-.5,-.5)(2.5,2) +\pnodes{P}(.1,.1)(1;10)(*2 {x^2/4})(0,1.4) +%defines P0..P3--now join them +\psnccurve[arrowscale=2]{-D>}(0,3){P} +\end{pspicture} +\end{LTXexample} +\vspace{2pc} + +\begin{BDef} +\Lcs{psLCNodeVar}\Largr{node A}\Largr{node B}\Largr{factorA,factorB}\Largb{node name} +\end{BDef} + +is similar to \Lcs{psLCNode}, + and provides a means of forming a linear combination of two nodes, thought of as vectors. Where +\begin{verbatim} +\psLCNode(A){a}(B){b}{C} +\end{verbatim} + effectively makes \verb|C=aA+bB|, +\begin{verbatim} +\psLCNodeVar(A)(B)(a,b){C} +\end{verbatim} + +\begin{sloppypar} +does the same, but the third argument \verb|(a,b)| may be specified in any form acceptable +to \Lcs{SpecialCoor}. (With \Lcs{psLCNode}, each coefficient may be specified in PostScript code.) +One other difference is that \Lcs{psLCNodeVar} allows the reuse of a node name in place. For example, +it is possible to write +\end{sloppypar} + +\begin{verbatim} +\psLCNodeVar(A)(B)(2,3){A}% symbol A reassigned +\end{verbatim} +where the equivalent in \Lcs{psLCNode} will lead to a PostScript error. Since \Lcs{AtoB} and \Lcs{AplusB} +are defined using \Lcs{psLCNodeVar}, they also allow node name reuse: \Lcs{AtoB}\verb|(Q)(P){P}| is legal. + +\begin{BDef} +\Lcs{psRelNodeVar}\Largr{node A}\Largr{node B}\Largr{radius;angle}\Largb{node name} +\end{BDef} +is similar to \Lcs{psRelNode}, and provides a means of scaling and rotating a line segment AB about A. The effect of +\begin{verbatim} +\psRelNodeVar(A)(B)(2;30){C} +\end{verbatim} + is the same as + \begin{verbatim} +\psRelNode[angle=30](A)(B){2}{C} +\end{verbatim} + +\begin{sloppypar} +but the third argument (2;30) may be specified in any form acceptable to \Lcs{SpecialCoor}, +while specifying the angle argument in \Lcs{psRelNode} using PostScript is not possible. +Note that \Lcs{psRelNodeVar}\verb|(0,0)(A)(B){C}| may be interpreted as defining \texttt{C} to +be the complex product of \texttt{A} and \texttt{B}. +\end{sloppypar} + + +\begin{LTXexample}[width=5cm] +\begin{pspicture}[showgrid](-.5,-.5)(3.5,3) +\pnode(0,.5){P}\pnode(1.5,.75){Q} +\psRelNodeVar(P)(Q)(2;20){R} +\psline(Q)(P)\uput[-45](P){P} +\uput[-70](Q){Q} +\psline(P)(R)\uput[-70](R){R} +\end{pspicture} +\end{LTXexample} + + + +\begin{BDef} +\Lcs{psRelLineVar}\Largr{node A}\Largr{node B}\Largr{radius;angle}\Largb{node name} +\end{BDef} + +stands to \Lcs{psRelLine} as \Lcs{psRelNodeVar} stands relative to \Lcs{psRelNode}. + +\Lcs{psRelLine}\verb|Var(A)(B)(a;b){C}| defines the node \texttt{C}, and, in addition, draws the line segment \texttt{AC}. + +\begin{BDef} +\Lcs{rhombus}\Largb{edge length}\Largr{A}\Largb{B}\Largb{C}\Largb{D} +\end{BDef} +computes the two remaining vertices C, D given two opposing vertices A, B +of a rhombus with specified edge length. It does not draw the rhombus, which +could be handled easily by \Lcs{psline}. Internally, \Lcs{rhombus} uses +\Lcs{psRelNodeVar}. + +\begin{BDef} +\Lcs{psrline}\Largr{P}\Largr{Q}\ldots +\end{BDef} + is like \Lcs{psline}, but drawing a line starting at (P), with successive + increments (Q)... It has the same options as\Lcs{psline}. + + +\begin{LTXexample}[width=.35\textwidth] +\begin{pspicture}[showgrid](-.5,-.5)(3.5,3) +\pnode(0,.5){P}\pnode(1,1){Q} +\psrline{->}(P)(Q)(2;20) +\uput[-45](P){P} +\end{pspicture} +\end{LTXexample} + +\begin{BDef} +\Lcs{psxline}\Largr{basept}\Largb{nodexpr1}\Largb{nodexpr2} +\end{BDef} +The \texttt{x} here stands for expression. The idea is that one builds a +line from \verb|<basept>+<nodexpr1>| to \verb|<basept>+<nodexpr2>|. + +\begin{LTXexample}[width=.35\textwidth] +\begin{pspicture}[showgrid](-.5,-.5)(3.5,4) +\def\pfn{t | t^2/4} +\psparametricplot[algebraic]{0}{3.5}{\pfn} +\curvepnode{2}{\pfn}{P}% sets P, Ptang +\normalvec(Ptang){Q}\uput[-45](P){P} +\psxline[linecolor=red]{<->}(P){-(Ptang)}{1.5(Ptang)} +\psxline[linecolor=blue]{->}(P){}{.5(Q)}%can use } for {(0,0)} +\end{pspicture} +\end{LTXexample} +\vspace{2pc} + +\begin{BDef} +\Lcs{polyIntersections}\Largb{Name1}\Largb{Name2}\Largr{A}\Largr{B}\Largb{P}\ldots\\ +\Lcs{polyIntersections}\Largb{Name1}\Largb{Name2}\Largr{A}\Largr{B}\Largb{P}\Largb{n}\\ +\end{BDef} + +is the most complicated macro in the collection. It has two forms. + + + + +\begin{verbatim} +\polyIntersections{<Name1>}{<Name2>}(A)(B)(1,2)(3;30)(6,5)... +\end{verbatim} + +defines the polyline \verb|L=(1,2)(3;30)(6,5)...|, and computes the two points of +intersection closest to \texttt{A} in each direction with the directed line starting at +A heading toward B. The first intersection point in the positive direction is named +\verb|<Name1>|, and the first intersection point in the opposite direction (from A) +is named \verb|<Name2>|. If one or other of these intersections is empty, the nodes are +set to remote points on the line \texttt{AB}. The effect of the line joining the constructed +nodes depends on the location of \texttt{A} and \texttt{B} relative to \texttt{L}, with two cases worth noting. +\begin{itemize} +\item if \texttt{L} is closed and if \texttt{A, B} are interior to one of its components, the +resulting line extends across that component of \texttt{L}, and contains \texttt{AB}. +\item If \texttt{L} is simple and closed, one of \texttt{A, B} is inside and the other outside, +the resulting line segment will contain \texttt{A} but not \texttt{B}. +\end{itemize} + +\begin{verbatim} +\polyIntersections{<Name1>}{<Name2>}(A)(B){P}{n} +\end{verbatim} + +has exactly the same effect as + +\begin{verbatim} +\polyIntersections{<Name1>}{<Name2>}(A)(B)(P0)(P1)...(Pn) +\end{verbatim} + +assuming \verb|P0...Pn| to be previously defined nodes. + + +\begin{LTXexample}[width=.375\textwidth] +\begin{pspicture}[showgrid](-.5,-.5)(3.5,3) +\pnodes{P}(0,.5)(3,.5)(2.5,2)(.5,2.5)(0,.5) +\pnode(1,1.1){A}\pnode(2,1.5){B} +\polyIntersections{N1}{N2}(A)(B){P}{4} +\psnline(0,4){P} +\psdots(A)(B)\psline(N1)(N2) +\uput[-60](A){A}\uput[-60](B){B} +\uput[0](N1){N1}\uput[-180](N2){N2} +\end{pspicture} +\end{LTXexample} + +\begin{LTXexample}[width=.375\textwidth] +\begin{pspicture}[showgrid](-.5,-.5)(3.5,3) +\pnodes{P}(0,.5)(3,.5)(2.5,2)(.5,2.5)(0,.5) +\pnode(1,1.1){A}\pnode(2,3){B} +\polyIntersections{N1}{N2}(A)(B){P}{4} +\psnline(0,4){P} +\psdots(A)(B)\psline(N1)(N2) +\uput[-60](A){A}\uput[-60](B){B} +\uput[90](N1){N1}\uput[-90](N2){N2} +\end{pspicture} +\end{LTXexample} + +\begin{LTXexample}[width=.375\textwidth] +\begin{pspicture}[showgrid](-.5,-.5)(3.5,3) +\def\fn{1.5+sin(t)+.4*sin(2*t)% + | 1+cos(t)+.2*cos(2*t)+.2*sin(4*t)}% +\pnode(1,1.1){A}\pnode(2,1.2){B} +\psset{plotpoints=100} +\psparametricplot[algebraic]{0}{6.283}{\fn} +\curvepnodes{0}{6.283}{\fn}{Z} +\polyIntersections{N1}{N2}(A)(B){Z}{99} +\psdots(A)(B)\psline(N1)(N2) +\uput[-60](A){A}\uput[-60](B){B} +\uput[0](N1){N1}\uput[220](N2){N2} +\end{pspicture} +\end{LTXexample} +\vspace{1pc} + + + +\begin{LTXexample}[width=.375\textwidth] +\begin{pspicture}[showgrid](-.5,-.5)(3.5,3) +\def\fn{1.5+sin(t)+.4*sin(2*t)% + | 1+cos(t)+.2*cos(2*t)+.2*sin(4*t)}% +\pnode(.8,.6){A}\pnode(2.5,-.5){B} +\psset{plotpoints=100} +\psparametricplot[algebraic]{0}{6.283}{\fn} +\curvepnodes{0}{6.283}{\fn}{Z} +\polyIntersections{N1}{N2}(A)(B){Z}{99} +\psdots(A)(B)\psline(N1)(N2) +\uput[90](A){A}\uput[-60](B){B} +\uput[70](N1){N1}\uput[180](N2){N2} +\end{pspicture} +\end{LTXexample} +\vspace{1pc} + + +\begin{LTXexample}[width=.375\textwidth] +\begin{pspicture}[showgrid](-.5,-.5)(3.5,3) +\pnodes{P}(0,.5)(3,.5)(2.5,2)(.5,2.5)(0,.5) +\pnode(1,1.1){A}\pnode(2,1.5){B} +\polyIntersections{N1}{N2}(A)(B){P}{3} +\psnline(0,3){P} +\psdots(A)(B) +\psclip{\psframe[linestyle=none](-.5,-.5)(3.5,2.5)} +\psline(N1)(N2)\endpsclip +\uput[-60](A){A}\uput[-60](B){B} +\uput[0](N1){N1}\uput[-180](N2){N2} +\end{pspicture} +\end{LTXexample} +\vspace{1pc} + +\begin{LTXexample}[width=.375\textwidth] +\begin{pspicture}[showgrid](-.5,-.5)(3.5,3) +\def\func{x+sin(2*x)} +\psplot[algebraic]{0}{3.14}{\func} +\fnpnodes[algebraic]{0}{3.14}{\func}{P} +\pnode(.6,.8){A} \pnode(1.5,1.1){B} +\polyIntersections{N1}{N2}(A)(B){P}{49} +\psdots(A)(B) +\uput[-90](A){A}\uput[-90](B){B} +\psline(N1)(N2) +\psset{linestyle=dashed} +\psline(N1)(N1 | 0,0) +\psline(N2)(N2 | 0,0) +\uput[70](N1){N1}\uput[170](N2){N2} +\end{pspicture} +\end{LTXexample} + +\vspace{1pc} + +\begin{BDef} +\Lcs{ArrowNotch}\Largb{<NodeName>}\Largb{<nodeindex>}\Largb{<direction>}\Largb{<Notch>} +\end{BDef} + +takes as inputs the root name of the node sequence, the index at which the arrow +tip is to be drawn, and the direction (one of \verb+>,<+) of the arrow. It then +constructs the notch as a node with name \verb|<Notch>|. The arrowhead may then be +drawn with a command like \Lcs{psline}\verb|{->}(N)(P3)|, assuming the tip was to be \texttt{P3} +and the notch was \texttt{N}. Keep in mind that the macro takes its settings for linewidth, +arrowscale, etc from the current values, so it is generally preferable to include them +in a \Lcs{psset} before drawing the curve and calling \Lcs{ArrowNotch}. +(Alternatively, they may be included as optional settings in \Lcs{ArrowNotch}.) +The first example below shows a case where the native arrow direction is not +good. The second shows how to make a version using \Lcs{ArrowNotch}. Notice that the minimum and maximum +parameter values in the second example had to be modified to keep the curve +from protruding near the end arrowheads. + +\Lcs{ArrowNotch} is a computationally expensive macro (quadratic in \texttt{plotpoints}) designed to +improve the placement of arrows on curves in those cases (high curvature, large values of +linewidth, arrowscale, etc) where the native arrow direction is not optimal. The macro +depends on the construction of a node sequence, say \texttt{P0..Pn}, of samples of the curve +(eg, with \Lcs{curvepnodes}) from which it computes the position of the notch of the arrow +so that, when drawn, the arrow notch will be located on the curve in all cases. It operates +with only two particular arrow shapes---those arrows specified with either +\verb|->| or \verb|-D>|, or their reverses. + + +\begin{LTXexample}[width=.375\textwidth] +\def\fn{1.5+1.5*cos(t) | 1+sin(t)} +\psset{linewidth=2pt,arrowscale=3} +\begin{pspicture}(0,0)(3.5,3) +\psparametricplot[algebraic,arrows=<->]{PiDiv2 neg}{Pi}{\fn} +\end{pspicture} +\end{LTXexample} + +\vspace{1pc} + + + +\begin{LTXexample}[width=.375\textwidth] +\def\fn{1.5+1.5*cos(t) | 1+sin(t)} +\psset{linewidth=2pt,arrowscale=3} +\begin{pspicture}(0,0)(3.5,3) +\curvepnodes{PiDiv2 neg}{Pi}\fn{P}%create P0..P49 +\ArrowNotch{P}{0}{<}{Q} +\ArrowNotch{P}{49}{>}{R} +\ArrowNotch[arrowscale=1.5]{P}{27}{>}{S} +\psparametricplot[algebraic]{-1.47}{2.95}{\fn} +\psline{->}(Q)(P0) +\psline{->}(R)(P49) +\psline[arrowscale=1.5]{->}(S)(P27) +\end{pspicture} +\end{LTXexample} + + +\section{Reading external data and save it as nodes} + +\begin{BDef} +\Lcs{saveDataAsNodes}\Largb{<data>}\Largb{<Nodeprefix>} +\end{BDef} + +The macro \Lcs{saveDataAsNodes} allows to read $x|y$ values from an external data file +and save the coordinates in nodes named \texttt{<Nodeprefix>i>} where $i$ is the nodecounter, +starting at 0. The last loop index is saved in the counter \Lctr{psLoopIndex} and the last +node is saved as \nxLenv{<Nodeprefix>Last} + + +\begin{filecontents*}{node.data} +12 12 +12 13 +13 15 +15 15 +15 13 +13 12 +12 10 +10 8 +8 8 +8 10 +\end{filecontents*} +\begin{LTXexample}[pos=t] +\begin{pspicture}(6.5,6.5)(16.5,16.5) + \psaxes[axesstyle=frame,ticksize=0 9cm,tickcolor=black!20,Ox=7,Oy=7](7,7)(16,16) + \saveDataAsNodes{node.data}{N} + \psset{radius=2.5mm,arrows=->,arrowscale=1.5,nodesep=2.7mm,linewidth=1.3pt} + \Cnodeput[linecolor=red]{0}(N0){foo}{0} + \multido{\iA=1+1,\iB=0+1}{\the\psLoopIndex}{% + \Cnodeput{0}(N\iA){foo}{\iA}\ncline{N\iB}{N\iA}} + \ncline[linecolor=blue,linestyle=dashed]{N8}{N3} + \ncline[linecolor=red,linestyle=dashed]{N0}{NLast} +\end{pspicture} +\end{LTXexample} + + + +\clearpage +\section{List of all optional arguments for \texttt{pst-node}} + +\xkvview{family=pst-node,columns={key,type,default}} + +\nocite{*} +\RaggedRight +\printbibliography + +\printindex + + +\end{document} + +https://tex.stackexchange.com/questions/102558/how-do-we-explain-the-behavior-of-rput-psgetnodecenter-and-savenodecoors/163411#163411 diff --git a/graphics/pstricks/contrib/pst-node/dvips/pst-node.pro b/graphics/pstricks/contrib/pst-node/dvips/pst-node.pro new file mode 100644 index 0000000000..ebd6844ca1 --- /dev/null +++ b/graphics/pstricks/contrib/pst-node/dvips/pst-node.pro @@ -0,0 +1,610 @@ +% $Id: pst-node.pro 395 2017-03-21 09:24:38Z herbert $ +%% +%% PostScript prologue for pst-node.tex. +%% Version 1.15, 2014/01/27. +%% +%% This program can be redistributed and/or modified under the terms +%% of the LaTeX Project Public License Distributed from CTAN archives +%% in directory macros/latex/base/lppl.txt. +% +%%%% EMPTY lines are not alowed!!! Problem with pst-eps -> \par +% +% +tx@Dict begin % from main pstricks dict + /T /translate load def + /CP /currentpoint load def +% /startGlobal { true setglobal globaldict begin } bind def +% /endGlobal { end false setglobal } bind def +end +/tx@NodeDict 400 dict def tx@NodeDict begin +/NewNode { % on stack: { x y } boolean N@name type InitXnode + gsave + NodeScale % a bugfix for xelatex, it's empty for dvips + /next exch def % { x y } boolean N@name type + dict dup % { x y } boolean N@name dict dict + 3 1 roll def % { x y } boolean dict N@name dict def + exch { dup 3 1 roll def } if % { x y } dict boolean + begin % { x y } dict begin + tx@Dict begin + STV CP T exec % set scaling + end + /NodeMtrx CM def % save CM + next % InitXNode + 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 % second and first node + /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 + t floor dup n ge % to allow npos<= hv 2008-08-14 + { 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 { + /lineAngle ED + GetEdgeA GetEdgeB GetArmA GetArmB mark + lineAngle abs 0 gt { + /xTemp xA2 10 add def + /yTemp yA2 lineAngle dup sin exch cos div 10 mul add def + /dY1 yTemp yA2 sub def + /dX1 xTemp xA2 sub def + /dY2 yB2 yB1 sub def + /dX2 xB2 xB1 sub def + dX1 abs 0.01 lt { + /m2 dY2 dX2 div def + /xB2 xA2 def + /yB2 xA2 xB1 sub m2 mul yB1 add def + }{ + dX2 abs 0.01 lt { + /m1 dY1 dX1 div def + /xB2 xB1 def + /yB2 xB1 xA2 sub m1 mul yA2 add def + }{% + /m1 dY1 dX1 div def + /m2 dY2 dX2 div def + /xB2 m1 xA2 mul m2 xB1 mul sub yA2 sub yB1 add m1 m2 sub div def + /yB2 xB2 xA2 sub m1 mul yA2 add def + } ifelse + } ifelse + } if + 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 +% +% 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 { + /lineAngle ED + GetEdgeA GetArmA + lineAngle abs 0 gt + { lineAngle } + { yB yA2 sub xB xA2 sub Atan 180 add } ifelse + /AngleB ED + GetEdgeB mark + lineAngle abs 0 gt { + /dY2 yA2 yA1 sub def + /dX2 xA2 xA1 sub def + lineAngle abs 90 eq { + /m2 dY2 dX2 div def + /yA2 xB xA2 sub m2 mul yA2 add def + /xA2 xB def + }{ + /m1 lineAngle dup sin exch cos div def % tan alpha + dX2 abs 0.01 lt { + /yA2 xA1 xB sub m1 mul yB add def + /xA2 xA1 def + }{% + /m2 dY2 dX2 div def + /xA2 m1 xB mul m2 xA2 mul sub yA2 add yB sub m1 m2 sub div def + /yA2 xA2 xB sub m1 mul yB add def + } ifelse + } ifelse + } if + 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 +% +% 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 +% +% DG/SR modification begin - May 9, 1997 - Patch 1 +%/NCCircle { 0 0 NodesepA nodeA \tx@GetEdge pop xA sub 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 \tx@PtoC 3 -1 roll add /Y ED add /X ED /NAngle ED +% +/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 +% DG/SR modification end + } 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 +% +% END pst-node.pro
\ No newline at end of file diff --git a/graphics/pstricks/contrib/pst-node/dvips/pst-node97.pro b/graphics/pstricks/contrib/pst-node/dvips/pst-node97.pro new file mode 100644 index 0000000000..5f7170abe9 --- /dev/null +++ b/graphics/pstricks/contrib/pst-node/dvips/pst-node97.pro @@ -0,0 +1,107 @@ +%! +% $Id: pst-node97.pro 68 2014-08-07 10:16:26Z herbert $ +% PostScript prologue for pst-node.tex. +% Created 1993/3/12. Source file was pst-node.doc +% Version 0.93a, 93/03/12. +% For use with Rokicki's dvips. +/tx@NodeDict 200 dict def tx@NodeDict begin +/NewNode { gsave /next ED dict dup 3 -1 roll ED 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 { /r ED r mul neg /l ED /r r l add def /X l neg def { neg /d +ED /u ED /Y 0 def } { neg /Y ED Y sub /u ED u mul neg /d ED /u u d add +def /Y Y d sub def } ifelse /NodePos { GetRnodePos } def } def +/InitRNode { /Y ED /X ED /r ED /X r 2 div X add def /r r X sub def /l X +neg def Y add neg /d ED Y sub /u ED /NodePos { GetRnodePos } def } def +/GetOnodePos { /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 +/GetAngle { nodeA GetCenter nodeB GetCenter 3 -1 roll sub 3 1 roll sub +neg Atan } def +/GetEdge { begin /Nodesep ED dup 1 0 NodeMtrx dtransform CM idtransform +exch atan sub dup sin /Sin ED cos /Cos ED NodePos Y add exch X add exch +NodeMtrx transform CM itransform end 4 2 roll 1 index 0 eq { pop pop } { +2 copy 5 2 roll cos mul add 4 1 roll sin mul sub exch } ifelse } def +/GetPos { OffsetA AngleA NodesepA nodeA GetEdge /y1 ED /x1 ED OffsetB +AngleB NodesepB nodeB GetEdge /y2 ED /x2 ED } def +/InitNC { /nodeB ED /nodeA ED /NodesepB ED /NodesepA ED /OffsetB ED +/OffsetA ED tx@NodeDict nodeA known tx@NodeDict nodeB known and dup { +/nodeA nodeA load def /nodeB nodeB load def } if } def +/LineMP { 4 copy 1 t sub mul exch t mul add 3 1 roll 1 t sub mul exch t +mul add exch 6 2 roll sub 3 1 roll sub Atan } def +/NCCoor { GetAngle /AngleA ED /AngleB AngleA 180 add def GetPos /LPutVar +[ x2 x1 y2 y1 ] cvx def /LPutPos { LPutVar LineMP } def x1 y1 x2 y2 } +def +/NCLine { NCCoor tx@Dict begin ArrowB 4 2 roll ArrowA lineto end } 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 } def +/GetArms { /x1a armA AngleA cos mul x1 add def /y1a armA AngleA sin mul +y1 add def /x2a armB AngleB cos mul x2 add def /y2a armB AngleB sin mul +y2 add def } def +/NCCurve { GetPos x1 x2 sub y1 y2 sub Pyth 2 div dup 3 -1 roll mul /armA +ED mul /armB ED GetArms x1a y1a x1 y1 tx@Dict begin ArrowA end x2a y2a +x2 y2 tx@Dict begin ArrowB end curveto /LPutVar [ x1 y1 x1a y1a x2a y2a +x2 y2 ] cvx def /LPutPos { t LPutVar BezierMidpoint } def } def +/AnglesMP { LPutVar t 3 gt { /t t 3 sub def } { t 2 gt { /t t 2 sub def +10 -2 roll } { t 1 gt { /t t 1 sub def 10 -4 roll } { 10 4 roll } ifelse +} ifelse } ifelse 6 { pop } repeat 3 -1 roll exch LineMP } def +/NCAngles { GetPos GetArms /mtrx AngleA matrix rotate def x1a y1a mtrx +transform pop x2a y2a mtrx transform exch pop mtrx itransform /y0 ED /x0 +ED mark armB 0 ne { x2 y2 } if x2a y2a x0 y0 x1a y1a armA 0 ne { x1 y1 } +if tx@Dict begin false Line end /LPutVar [ x2 y2 x2a y2a x0 y0 x1a y1a +x1 y1 ] cvx def /LPutPos { AnglesMP } def } def +/NCAngle { GetPos /x2a armB AngleB cos mul x2 add def /y2a armB AngleB +sin mul y2 add def /mtrx AngleA matrix rotate def x2a y2a mtrx transform +pop x1 y1 mtrx transform exch pop mtrx itransform /y0 ED /x0 ED mark +armB 0 ne { x2 y2 } if x2a y2a x0 y0 x1 y1 tx@Dict begin false Line end +/LPutVar [ x2 y2 x2 y2 x2a y2a x0 y0 x1 y1 ] cvx def /LPutPos { AnglesMP +} def } def +/NCBar { GetPos GetArms /mtrx AngleA matrix rotate def x1a y1a mtrx +transform pop x2a y2a mtrx transform pop sub dup 0 mtrx itransform 3 -1 +roll 0 gt { /y2a exch y2a add def /x2a exch x2a add def } { /y1a exch +neg y1a add def /x2a exch neg x2a add def } ifelse mark x2 y2 x2a y2a +x1a y1a x1 y1 tx@Dict begin false Line end /LPutVar [ x2 y2 x2 y2 x2a +y2a x1a y1a x1 y1 ] cvx def /LPutPos { LPutVar AnglesMP } def } def +/NCDiag { GetPos GetArms mark x2 y2 x2a y2a x1a y1a x1 y1 tx@Dict begin +false Line end /LPutVar [ x2 y2 x2 y2 x2a y2a x1a y1a x1 y1 ] cvx def +/LPutPos { AnglesMP } def } def +/NCDiagg { OffsetA AngleA NodesepA nodeA GetEdge /y1 ED /x1 ED /x1a armA +AngleA cos mul x1 add def /y1a armA AngleA sin mul y1 add def nodeB +GetCenter y1a sub exch x1a sub Atan 180 add /AngleB ED OffsetB AngleB +NodesepB nodeB GetEdge /y2 ED /x2 ED mark x2 y2 x1a y1a x1 y1 tx@Dict +begin false Line end /LPutVar [ x2 y2 x2 y2 x2 y2 x1a y1a x1 y1] cvx def +/LPutPos { AnglesMP } def } def +/LoopMP { /t t abs def [ LPutVar ] length 2 div 1 sub dup t lt { /t ED } +{ pop } ifelse mark LPutVar t cvi { /t t 1 sub def pop pop } repeat +counttomark 1 add 4 roll cleartomark 3 -1 roll exch LineMP } def +/NCLoop { GetPos GetArms /mtrx AngleA matrix rotate def x1a y1a mtrx +transform loopsize add /y1b ED /x1b ED /x2b x2a y2a mtrx transform pop +def x2b y1b mtrx itransform /y2b ED /x2b ED x1b y1b mtrx itransform /y1b +ED /x1b ED mark armB 0 ne { x2 y2 } if x2a y2a x2b y2b x1b y1b x1a y1a +armA 0 ne { x1 y1 } if tx@Dict begin false Line end /LPutVar [ x2 y2 x2a +y2a x2b y2b x1b y1b x1a y1a x1 y1 ] cvx def /LPutPos { LoopMP } def } +def +/NCCircle { nodeA GetCenter 0 0 NodesepA nodeA GetEdge pop 3 1 roll /Y ED +/X ED X sub 2 div dup 2 exp r r mul sub abs sqrt atan 2 mul /a ED r +AngleA 90 add PtoC Y add exch X add exch 2 copy /LPutVar [ 4 2 roll r a +] def /LPutPos { LPutVar aload pop t 360 mul add dup 5 1 roll 90 sub +PtoC 3 -1 roll add 3 1 roll add exch 3 -1 roll } 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 +/LPutCoor { tx@NodeDict /LPutPos known { gsave LPutPos tx@Dict begin +/langle ED CM 3 1 roll STV CP 3 -1 roll sub neg 3 1 roll sub exch moveto +setmatrix CP end grestore } { 0 0 tx@Dict /langle 0 def end } ifelse } +def +end diff --git a/graphics/pstricks/contrib/pst-node/latex/pst-node.sty b/graphics/pstricks/contrib/pst-node/latex/pst-node.sty new file mode 100644 index 0000000000..25759494f0 --- /dev/null +++ b/graphics/pstricks/contrib/pst-node/latex/pst-node.sty @@ -0,0 +1,44 @@ +% $Id: pst-node.sty 688 2017-12-14 13:08:41Z herbert $ +%% +%% This is file `pst-node.sty'. +%% +%% IMPORTANT NOTICE: +%% +%% pst-node.sty Copyright (C) 2004-2017 Herbert Voss <voss@perce.de> +%% Rolf Niepraschk <Rolf.Niepraschk@ptb.de> +%% +%% This package may be distributed under the terms of the LaTeX Project +%% Public License, as described in lppl.txt in the base LaTeX distribution. +%% Either version 1.0 or, at your option, any later version. +%% +\NeedsTeXFormat{LaTeX2e} + +\ProvidesPackage{pst-node} + [2012/09/18 v1.01 LaTeX wrapper for `pst-node' (HV)] +% +\newif\ifpst@OldVersion\pst@OldVersionfalse +\DeclareOption{97}{\pst@OldVersiontrue} +\ProcessOptions\relax +% +\ifpst@OldVersion +\RequirePackage[97]{pstricks} +\ProvidesPackage{pst-node97}[1993/03/12 package wrapper for pst-node.tex] +\input{pst-node97.tex} +\ProvidesFile{pst-node97.tex} + [\filedate\space \fileversion\space `pst-node' (tvz)] +\IfFileExists{pst-node97.pro}{% + \ProvidesFile{pst-node97.pro} + [1993/03/12 v. 0.93a, PostScript prologue file (hv)] + \@addtofilelist{pst-node97.pro}}{}% +\else +\RequirePackage{pstricks} +\ProvidesPackage{pst-node}[2010/04/22 package wrapper for pst-node.tex] +\input{pst-node.tex} +\ProvidesFile{pst-node.tex} + [\filedate\space \fileversion\space `pst-node' (tvz,hv)] +\IfFileExists{pst-node.pro}{% + \ProvidesFile{pst-node.pro} + [2011/09/18 v. 1.14, PostScript prologue file (hv)] + \@addtofilelist{pst-node.pro}}{}% +\fi +\endinput diff --git a/graphics/pstricks/contrib/pst-node/tex/pst-node.tex b/graphics/pstricks/contrib/pst-node/tex/pst-node.tex new file mode 100644 index 0000000000..f936a8c4d2 --- /dev/null +++ b/graphics/pstricks/contrib/pst-node/tex/pst-node.tex @@ -0,0 +1,2011 @@ +% $Id: pst-node.tex 940 2019-03-03 12:32:03Z herbert $ +%% +%% BEGIN pst-node.tex +%% +%% Nodes with PSTricks. +%% This uses the header file `pst-node.pro'. +%% +%% COPYRIGHT 1993, 1994, 1999 by Timothy Van Zandt, tvz@nwu.edu. +%% COPYRIGHT 2009-2018 by Herbert Voss, hvoss tug.org. +%% +%% This program can be redistributed and/or modified under the terms +%% of the LaTeX Project Public License Distributed from CTAN +%% archives in directory macros/latex/base/lppl.txt. +%% +% +\csname PSTnodesLoaded\endcsname +\let\PSTnodesLoaded\endinput +\ifx\PSTricksLoaded\endinput\else\input pstricks.tex \fi\relax +\ifx\PSTXKeyLoaded\endinput\else \input pst-xkey \fi +% +\def\fileversion{1.42} +\def\filedate{2019/03/03} +\message{ v\fileversion, \filedate} +% +\edef\TheAtCode{\the\catcode`\@} +\catcode`\@=11 +% +\pstheader{pst-node.pro} +\pst@addfams{pst-node} +% +\SpecialCoor +% +%%%%%%%%%% compatibility stuff +\define@boolkey[psset]{pst-node}[Pst@]{trueAngle}[true]{} +\psset[pst-node]{trueAngle=false} +%%%%%%%%%% compatibility stuff +\define@boolkey[psset]{pst-node}[Pst@]{storeNodeInfo}[true]{} +\psset[pst-node]{storeNodeInfo=false} +% +\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} +% +% bug fix for xelatex, dvipdfmx uses the wrong scaling +\def\tx@NewNode{/NodeScale {\ifx\pstnodescale\@undefined \else\pstnodescale \fi} def NewNode } +% +\def\psopenNodeFile{% + \pst@Verb{ %globaldict begin +% tx@NodeDict begin + (\jobname.nodes) (w) file /NodeFile exch def +% end + }} + % +\def\pscloseNodeFile{\pstVerb{ tx@NodeDict begin NodeFile closefile end }} +% +\define@boolkey[psset]{pst-node}[Pst@]{showNode}[true]{\ifPst@showNode\psopenNodeFile\fi}% write coors into the logfile +\define@boolkey[psset]{pst-node}[Pst@]{markNode}[true]{}% makr the node with its name +\define@boolkey[psset]{pst-node}[Pst@]{saveNodeCoors}[true]{} +\define@key[psset]{pst-node}{NodeCoorPrefix}[]{\def\psk@NodeCoorPrefix{#1}}% if empty it is N-<Name>.x|y +\psset[pst-node]{saveNodeCoors=false,showNode=false,markNode=false,NodeCoorPrefix=}% <NodeCoorPrefix<Name>x|y> +% +\def\pst@newnode#1#2#3#4{% +\pst@killglue +\leavevmode +\pst@getnode{#1}\pst@thenode +\pst@Verb{ + \ifPst@saveNodeCoors + \ifx\relax#3\relax 0 0 \else gsave \pst@dict STV CP T end #3 \tx@UserCoor grestore \fi + \if$\psk@NodeCoorPrefix$ + /N-#1.y exch def + /N-#1.x exch def + \else + /\psk@NodeCoorPrefix#1y exch def + /\psk@NodeCoorPrefix#1x exch def + \fi + \fi + \pst@nodedict + {#3} + \ifx\psk@name\relax false \else \psk@name true \fi + \pst@thenode + #2 + {#4} + \ifPst@showNode + exch dup /NodeType ED + exch + NodeType 10 eq { % pnode type + 5 copy + cvlit aload pop + 20 string cvs (; ) 6 2 roll % InitPnode + 20 string cvs (; ) 7 2 roll % type + 20 string cvs (; ) 8 2 roll %/N@Name + 20 string cvs (; ) 9 2 roll % true/false + cvlit dup length 2 eq + { aload pop exch + 20 string cvs (; ) 11 2 roll + 20 string cvs (, ) 12 2 roll % x,y + (\string\n) % add newline + 13 array astore concatstringarray + } + { 255 string cvs (; ) 10 2 roll + (\string\n) % add newline + 11 array astore concatstringarray + } ifelse + NodeFile exch writestring + } if + NodeType 14 eq { % dotnode + 5 copy + /@@temp ED +% gsave + @@temp % to get X Y + 4 -1 roll cvlit pop + ( OvalNodePos ) (; ) 5 2 roll + 20 string cvs (; ) 6 2 roll % type + 20 string cvs (; ) 7 2 roll %/N@Name + 20 string cvs (; ) 8 2 roll % true/false + Y 20 string cvs (; ) 10 2 roll + X 20 string cvs (, ) 12 2 roll + (\string\n) % add newline + 13 array astore concatstringarray +% grestore + tx@NodeDict begin NodeFile exch writestring end + } if + \fi + \tx@NewNode + end +}% +% +\global\let\psk@name\relax% +\pstree@nodehook% +\global\let\pstree@nodehook\relax} +% +\let\pstree@nodehook\relax +\define@boolkey[psset]{pst-node}[Pst@]{nodealign}[true]{} +\psset[pst-node]{nodealign=false} + +\def\pst@nodealign{% +\pst@dimg=\ht\pst@hbox +\advance\pst@dimg by -\dp\pst@hbox +\divide\pst@dimg by \tw@ +\lower\pst@dimg} +% +\def\tx@InitPnode{InitPnode } +\def\pnode{\@ifnextchar[{\pnode@i}{\pnode@iii}} +\def\pnode@i[#1]{\@ifnextchar({\pnode@ii[#1]}{\pnode@ii[#1](0,0)}} +\def\pnode@ii[#1](#2)#3{% + \pst@getcoor{#1}\pst@tempA% + \pst@getcoor{#2}\pst@tempB% + \pst@newnode{#3}{10}{\pst@tempA \pst@tempB 3 -1 roll add 3 1 roll add exch }{\tx@InitPnode}% + \ifPst@showNode\psdot(#3)\uput[\ifx\psk@rot\@empty0\else\psk@rot\fi]{0}(#3){#3}\fi + \ignorespaces} +% +\def\pnode@iii{\@ifnextchar({\pnode@}{\pnode@(0,0)}} +\def\pnode@(#1)#2{% + \pst@@getcoor{#1}% + \pst@newnode{#2}{10}{\pst@coor}{\tx@InitPnode}% + \ifPst@showNode\psdot(#2)\uput[\ifx\psk@rot\@empty0\else\psk@rot\fi]{0}(#2){#2}\fi + \ignorespaces} +% +\def\pnodes{\@ifnextchar[{\pnodes@i}{\pnodes@i[0,0]}} +\def\pnodes@i[#1]{\@ifnextchar({\psnodes@ii[#1]}{\pnodes@ii}} +\def\psnodes@ii[#1](#2)#3{% + \pnode[#1](#2){#3}% + \@ifnextchar({\psnodes@ii[#1]}{}% +} +% +\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 + \ifPst@nodealign + \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}% + \ifPst@nodealign\kern\pst@dimc\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 + \ignorespaces +} +\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@v{#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}% + \ifPst@nodealign \psboxseptrue \fi + \ifpsboxsep \pscirclebox@sep \fi + \leavevmode + \ifPst@nodealign\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 by -\dp\pst@hbox + \divide\pst@dima by \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}% + \ifPst@nodealign \psboxseptrue \fi + \ifpsboxsep \psCirclebox@sep \fi + \leavevmode + \ifPst@nodealign\pst@nodealign\fi + \box\pst@hbox + \endgroup} +\def\tx@GetRnodePos{GetRnodePos } +\def\tx@InitRnode{InitRnode } +% +\def\psnode{\pst@object{psnode}} +\def\psnode@i{\@ifnextchar(\psnode@ii{\psnode@ii(0,0)}} +\def\psnode@ii(#1)#2#3{% #1: coordinates, #2: node name, #3 contents + \rput(#1){\rnode{#2}{#3}}} +% +\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{% +% DG modification begin - Jan. 1997 +\leavevmode +% DG modification end +\begingroup +% DG/SR modification begin - Apr. 28, 1998 - Patch 6 +\pst@useboxpar +% DG/SR modification end +#1% +%\if@star\pst@starbox\fi% commented to fix bug witzh \psframebox*{\rnode...} +\ifPst@nodealign\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} +% +\define@key[psset]{pst-node}{href}[0]{\pst@checknum{#1}\psk@href} +\psset[pst-node]{href=0} +\define@key[psset]{pst-node}{vref}[0.7ex]{\def\psk@vref{#1}} +\psset[pst-node]{vref=0.7ex} +\def\Rnode{\pst@object{Rnode}} +\def\Rnode@i#1{\pst@makebox{\rnode@iii\Rnode@ii{#1}}} +\def\Rnode@ii{% +% DG modification begin - Jan. 1997 +% - \begingroup removed as it seems to doesn't work any more +% - \Rnode doesn't process the optional parameter changes +%\begingroup +\use@par +% DG modification end +\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}% +\ifPst@nodealign\psboxseptrue\fi +\ifpsboxsep\psdiabox@sep\fi +% DG/SR modification begin - Sep. 2, 1997 - Patch 3 +\leavevmode +% DG/SR modification end +\ifPst@nodealign\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% + }% + \ifPst@nodealign\psboxseptrue\fi + \ifpsboxsep\pstribox@sep\fi +% DG/SR modification begin - Sep. 2, 1997 - Patch 3 + \leavevmode +% DG/SR modification end + \ifPst@nodealign\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}% +\ifPst@nodealign\psboxseptrue\fi +\ifpsboxsep\psovalbox@sep\fi +% DG/SR modification begin - Sep. 2, 1997 - Patch 3 +\leavevmode +% DG/SR modification end +\ifPst@nodealign\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 + \ifPst@nodealign + \pst@dima=\pst@dimg + \kern\pst@dima + \vrule width\z@ height \pst@dimh depth \pst@dimh + \fi + \pst@newnode{#2}{14}{}{ + \pst@coor + /Y exch def /X exch def + /w \pst@number\pst@dimg def + /h \pst@number\pst@dimh def + /NodePos { \tx@OvalNodePos } def}% + \psdot@ii(#1)% + \ifPst@nodealign\kern\pst@dima\fi}% + \ifPst@markNode\uput[\ifx\psk@rot\@empty0\else\psk@rot\fi]{0}(#2){#2}\fi + \ignorespaces} +% +\def\dotnodes{\pst@object{dotnodes}} +\def\dotnodes@i{\use@par\dotnodes@ii} +\def\dotnodes@ii(#1)#2{% + \dotnode(#1){#2}% + \@ifnextchar(\dotnodes@ii{\def\pst@par{}}} +% +\define@key[psset]{pst-node}{framesize}{\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[pst-node]{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% + \ifPst@nodealign + \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 exch def /X exch def + /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 exch def + y2 add /y2 exch def + x2 add /x2 exch def + \psk@cornersize + 1 index 0 eq { pop pop \tx@Rect } { \tx@OvalFrame } ifelse}% + \def\pst@linetype{2}% + \showpointsfalse% + \end@ClosedObj% + \ifPst@nodealign\kern\psk@framewidth\p@\fi}% end of \hbox + \ignorespaces} +% +% +% This fixes a bug in pst-node, where the XY-direction is wrong +% the types are changed 1<->2 between X<->Y +% +\define@key[psset]{}{XnodesepA}{\pst@getlength{#1}\psk@nodesepA\def\psk@nodeseptypeA{2 }} +\define@key[psset]{}{XnodesepB}{\pst@getlength{#1}\psk@nodesepB\def\psk@nodeseptypeB{2 }} +\define@key[psset]{}{Xnodesep}{% + \pst@getlength{#1}\psk@nodesepA + \let\psk@nodesepB\psk@nodesepA + \def\psk@nodeseptypeA{2 }% + \def\psk@nodeseptypeB{2 }} +\define@key[psset]{}{YnodesepA}{\pst@getlength{#1}\psk@nodesepA\def\psk@nodeseptypeA{1 }} +\define@key[psset]{}{YnodesepB}{\pst@getlength{#1}\psk@nodesepB\def\psk@nodeseptypeB{1 }} +\define@key[psset]{}{Ynodesep}{% + \pst@getlength{#1}\psk@nodesepA + \let\psk@nodesepB\psk@nodesepA + \def\psk@nodeseptypeA{1 }% + \def\psk@nodeseptypeB{1 }} +%%%% end bugfix %%%%% +\define@key[psset]{pst-node}{nodesepA}[0pt]{\pst@getlength{#1}\psk@nodesepA \def\psk@nodeseptypeA{0 }} +\define@key[psset]{pst-node}{nodesepB}[0pt]{\pst@getlength{#1}\psk@nodesepB \def\psk@nodeseptypeB{0 }} +\define@key[psset]{pst-node}{nodesep}[0pt]{% + \pst@getlength{#1}\psk@nodesepA + \let\psk@nodesepB\psk@nodesepA + \def\psk@nodeseptypeA{0 }% + \def\psk@nodeseptypeB{0 }} +\psset[pst-node]{nodesep=0pt} +%\define@key[psset]{pst-node}{XnodesepA}[]{\pst@getlength{#1}\psk@nodesepA \def\psk@nodeseptypeA{1 }} +%\define@key[psset]{pst-node}{XnodesepB}[]{\pst@getlength{#1}\psk@nodesepB \def\psk@nodeseptypeB{1 }} +%\define@key[psset]{pst-node}{Xnodesep}[]{% +% \pst@getlength{#1}\psk@nodesepA +% \let\psk@nodesepB\psk@nodesepA +% \def\psk@nodeseptypeA{1 }% +% \def\psk@nodeseptypeB{1 }} +%\define@key[psset]{pst-node}{YnodesepA}[]{\pst@getlength{#1}\psk@nodesepA \def\psk@nodeseptypeA{2 }} +%\define@key[psset]{pst-node}{YnodesepB}[]{\pst@getlength{#1}\psk@nodesepB \def\psk@nodeseptypeB{2 }} +%\define@key[psset]{pst-node}{Ynodesep}[]{ +% \pst@getlength{#1}\psk@nodesepA +% \let\psk@nodesepB\psk@nodesepA +% \def\psk@nodeseptypeA{2 }% +% \def\psk@nodeseptypeB{2 }} +\define@key[psset]{pst-node}{armA}[10pt]{\pst@getlength{#1}\psk@armA \def\psk@armtypeA{0 }} +\define@key[psset]{pst-node}{armB}[10pt]{\pst@getlength{#1}\psk@armB \def\psk@armtypeB{0 }} +\define@key[psset]{pst-node}{arm}[10pt]{% + \pst@getlength{#1}\psk@armA + \let\psk@armB\psk@armA + \def\psk@armtypeA{0 }% + \def\psk@armtypeB{0 }} +\psset[pst-node]{arm=10pt} +\define@key[psset]{pst-node}{XarmA}[]{\pst@getlength{#1}\psk@armA \def\psk@armtypeA{1 }} +\define@key[psset]{pst-node}{XarmB}[]{\pst@getlength{#1}\psk@armB \def\psk@armtypeB{1 }} +\define@key[psset]{pst-node}{Xarm}{% + \pst@getlength{#1}\psk@armA + \let\psk@armB\psk@armA + \def\psk@armtypeA{1 }% + \def\psk@armtypeB{1 }} +\define@key[psset]{pst-node}{YarmA}[]{\pst@getlength{#1}\psk@armA \def\psk@armtypeA{2 }} +\define@key[psset]{pst-node}{YarmB}[]{\pst@getlength{#1}\psk@armB \def\psk@armtypeB{2 }} +\define@key[psset]{pst-node}{Yarm}[]{% + \pst@getlength{#1}\psk@armA + \let\psk@armB\psk@armA + \def\psk@armtypeA{2 }% + \def\psk@armtypeB{2 }} +\define@key[psset]{pst-node}{offsetA}[0pt]{\pst@getlength{#1}\psk@offsetA} +\define@key[psset]{pst-node}{offsetB}[0pt]{\pst@getlength{#1}\psk@offsetB} +\define@key[psset]{pst-node}{offset}[0pt]{\pst@getlength{#1}\psk@offsetA\let\psk@offsetB\psk@offsetA} +\psset[pst-node]{offset=0pt} +\define@key[psset]{pst-node}{angleA}[0]{\pst@getangle{#1}\psk@angleA} +\define@key[psset]{pst-node}{angleB}[0]{\pst@getangle{#1}\psk@angleB}% +\define@key[psset]{pst-node}{angle}[0]{% + \pst@getangle{#1}\psk@angleA + \let\psk@angleB\psk@angleA} +\psset[pst-node]{angle=0} +\define@key[psset]{pst-node}{arcangleA}[8]{\pst@getangle{#1}\psk@arcangleA} +\define@key[psset]{pst-node}{arcangleB}[8]{\pst@getangle{#1}\psk@arcangleB}% +\define@key[psset]{pst-node}{arcangle}[8]{% + \pst@getangle{#1}\psk@arcangleA + \let\psk@arcangleB\psk@arcangleA} +\psset[pst-node]{arcangle=8} +\define@key[psset]{pst-node}{ncurvA}[0.67]{\pst@checknum{#1}\psk@ncurvA} +\define@key[psset]{pst-node}{ncurvB}[0.67]{\pst@checknum{#1}\psk@ncurvB}% +\define@key[psset]{pst-node}{ncurv}[0.67]{\pst@checknum{#1}\psk@ncurvA\let\psk@ncurvB\psk@ncurvA} +\psset[pst-node]{ncurv=0.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}% +% DG/SR modification begin - Apr. 14, 1999 - Patch 9 +%{\tx@NCLine /LPutPos { xB xA yB yA \tx@LPutLine } def}} +{\tx@NCLine /LPutPos { xB yB xA yA \tx@LPutLine } def}} +% DG/SR modification end +% +\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 exch def + \psk@arcangleB\space sub 180 add /AngleB exch def + \psk@ncurvB\space \psk@ncurvA\space + \tx@NCCurve}} +\def\pcarc{\pst@object{pcarc}} +\def\pcarc@i{\pc@object\ncarc@ii} +% +\def\tx@NCAngles{NCAngles } +% +%border or center as reference point (hv) +\define@boolkey[psset]{pst-node}[Pst@]{pcRef}[true]{} +\psset[pst-node]{pcRef=false} +% +\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 \ifPst@pcRef + GetEdgeA yA yA1 sub dup mul xA xA1 sub dup mul add sqrt sub \fi 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} +% +\define@key[psset]{pst-node}{lineAngle}[0]{% + \ifdim#1pt=\z@\else\psset{armB=0.5}\fi + \def\psk@lineAngle{#1}}% +\psset[pst-node]{lineAngle=0}% +% +\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 \psk@lineAngle\space \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 \psk@lineAngle\space \tx@NCDiagg}} +\def\pcdiagg{\pst@object{pcdiagg}} +% +\def\pcdiagg@i{\pc@object\ncdiagg@ii} +\def\tx@NCLoop{NCLoop } +\define@key[psset]{pst-node}{loopsize}{\pst@getlength{#1}\psk@loopsize} +\psset[pst-node]{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 } +\define@key[psset]{pst-node}{boxheight}[0.4cm]{\pst@getlength{#1}\psk@boxheight} +\define@key[psset]{pst-node}{boxdepth}[0.4cm]{\pst@getlength{#1}\psk@boxdepth} +\define@key[psset]{pst-node}{boxsize}[0.4cm]{% + \pst@getlength{#1}\psk@boxheight% + \let\psk@boxdepth\psk@boxheight} +\psset[pst-node]{boxsize=0.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 } +% Changed according pst-beta.bug December 3, 1993 +% nrot=:<angle> does not work when : is active. +\begingroup +\catcode`\:=13 +\gdef\pst@activerot{\def:{\string:}} +\endgroup +\define@key[psset]{pst-node}{nrot}[0]{% + \begingroup + \pst@activerot + \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[pst-node]{nrot=0} +% +\def\tx@LPutCoor{LPutCoor } +\def\tx@LPut{LPut } +\define@key[psset]{pst-node}{npos}[{}]{% + \def\pst@tempa{#1}% + \ifx\pst@tempa\@empty\def\psk@npos{\npos@default}\else\pst@checknum{#1}\psk@npos\fi} +\psset[pst-node]{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 +% \addto@par{labelsep=15pt}% + \use@par + \if@star\pst@starbox\fi + \def\psk@refangle{#1 }% + \let\psk@rot\psk@nrot + \pst@Verb{ + gsave STV CP T /ps@refangle {#1 } def + /ps@rot { \psk@rot } def grestore }%ADDED (MJS) + \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}}} +\define@key[psset]{pst-node}{tpos}[0.5]{% + \pst@checknum{#1}\psk@tpos + \ifdim\psk@tpos \p@<\z@ + \def\psk@tpos{.5}% +% DG/SR modification begin - Sep. 23, 1998 - Patch 7 +%\@pstrickserr{Bad `tpos' value: `#1'. Must be 0<tpos<1}\@epha + \@pstrickserr{Bad `tpos' value: `#1'. Must be 0<tpos<1}\@ehpa +% DG/SR modification end + \else + \ifdim\psk@tpos \p@>\p@ + \def\psk@tpos{.5}% +% DG/SR modification begin - Sep. 23, 1998 - Patch 7 +%\@pstrickserr{Bad `tpos' value: `#1'. Must be 0<tpos<1}\@epha + \@pstrickserr{Bad `tpos' value: `#1'. Must be 0<tpos<1}\@ehpa% +% DG/SR modification end + \fi% + \fi} +\psset[pst-node]{tpos=0.5} +% +\def\nlput{\pst@object{nlput}} +\def\nlput@i(#1)(#2)#3#4{% + \begin@SpecialObj + \psLDNode(#1)(#2){#3}{temp@lnput} + \pcline[linestyle=none](#1)(temp@lnput)% + \ncput[npos=1]{#4}% + \end@SpecialObj} +% +\def\tvput{\pst@object{tvput}} +\def\tvput@i{\pst@makebox{\psput@tput{H}{1}}} +\def\tlput{\pst@object{tlput}} +\def\tlput@i{\pst@makebox{\psput@tput{H}{true}}} +\def\trput{\pst@object{trput}} +\def\trput@i{\pst@makebox{\psput@tput{H}{false}}} +\def\thput{\pst@object{thput}} +\def\thput@i{\pst@makebox{\psput@tput{V}{1}}} +\def\taput{\pst@object{taput}} +\def\taput@i{\pst@makebox{\psput@tput{V}{true}}} +\def\tbput{\pst@object{tbput}} +\def\tbput@i{\pst@makebox{\psput@tput{V}{false}}} +\def\tx@HPutAdjust{HPutAdjust } +\def\tx@VPutAdjust{VPutAdjust } +\def\psput@tput#1#2{% + \begingroup + \use@par + \pst@tputmakesmall + \leavevmode + \hbox{% + \pst@Verb{% + \pst@nodedict + /t \psk@tpos \pst@tposflip def + tx@NodeDict /HPutPos known + { #1PutPos } + { CP /Y exch def /X exch def /NAngle 0 def /NCLW 0 def } + ifelse + /Sin NAngle sin def + /Cos NAngle cos def + /s \pst@number\pslabelsep NCLW add def + /l \pst@number\pst@dima def + /r \pst@number\pst@dimb def + /h \pst@number\pst@dimc def + /d \pst@number\pst@dimd def +% DG/SR modification begin - Sep. 26, 1997 - Patch 4 +%\ifnum1=0#2\else + \ifnum1=0#2 \else +% DG/SR modification end + /flag #2 def + \csname tx@#1PutAdjust\endcsname + \fi + \tx@LPutCoor + end + \tx@PutBegin}% + \box\pst@hbox + \pst@Verb{\tx@PutEnd}}% + \endgroup + \pst@shortput} +% +\def\pst@tposflip{} +\def\pst@tputmakesmall{% +% +\pst@dima=\wd\pst@hbox +\divide\pst@dima 2 +\pst@dimg=\psk@href\pst@dimg +\pst@dimb\pst@dima +\advance\pst@dima\pst@dimg % leftsize +\advance\pst@dimb-\pst@dimg % rightsize +\pst@dimd=\psk@vref\relax +\pst@dimc=\ht\pst@hbox +\advance\pst@dimc-\pst@dimd % height +\advance\pst@dimd\dp\pst@hbox % depth +\setbox\pst@hbox=\hbox to\z@{% +\kern-\pst@dima\vbox to\z@{\vss\box\pst@hbox\vskip-\pst@dimd}\hss}} +\def\MakeShortNab#1#2{% + \def\pst@shortput@nab{% + \def\pst@tempg{\next}% + \ifx#1\next + \let\pst@tempg\naput + \else + \ifx#2\next + \let\pst@tempg\nbput + \else + \ifx\@sptoken\next + \let\pst@tempg\pst@shortput + \fi + \fi + \fi + \pst@tempg}} +\MakeShortNab{^}{_} +\def\MakeShortTablr#1#2#3#4{% + \def\pst@shortput@tablr{% + \def\pst@tempg{\next}% + \ifx#1\next + \let\pst@tempg\taput + \else + \ifx#2\next + \let\pst@tempg\tbput + \else + \ifx#3\next + \let\pst@tempg\tlput + \else + \ifx#4\next + \let\pst@tempg\trput + \else + \ifx\@sptoken\next + \let\pst@tempg\pst@shortput + \fi + \fi + \fi + \fi + \fi + \pst@tempg}} +\MakeShortTablr{^}{_}{<}{>} +\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{^}{_} +\define@key[psset]{pst-node}{shortput}[none]{% + \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[pst-node]{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 +\ifx\psk@rot\@empty\else\pst@rotate{ps@rot }\pst@hbox\fi% (MJS) +%\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{% for normal nodes (name) + \pst@getnode{#1}\pst@tempg + \edef\pst@coor{% + \pst@nodedict + tx@NodeDict \pst@tempg known + \pslbrace \pst@tempg load \tx@GetCenter \psrbrace + \pslbrace 0 0 \psrbrace ifelse + end }} +% +\def\Node@coor[#1]#2;#3\@nil{% for special nodes ([...]{node}node) +\begingroup +\psset{angle=0,#1}% angle=0, to prevent problems if angle is set globally +\@ifnextchar\bgroup{\Node@@@coor}% we have an additional node [...]{node} + {\Node@@coor}#2\@nil% we have [...]node +\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{% [...]{#1}node +\pst@@getcoor{#1}% +\def\psk@angleA{% + \pst@tempg load \tx@GetCenter \pst@coor + 3 -1 roll sub 3 1 roll sub neg \tx@Atan \psk@angleB add + }% +\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 + \if@star\pst@starbox\fi% + \psset[pstricks]{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 +% +\define@key[psset]{pst-node}{colsep}[1.5cm]{\pssetlength\pscolsep{#1}} +\define@key[psset]{pst-node}{rowsep}[1.5cm]{\pssetlength\psrowsep{#1}} +\psset[pst-node]{colsep=1.5cm} +\psset[pst-node]{rowsep=1.5cm} +\newif\ifpsmatrix +% DG/SR modification begin - Nov. 27, 1998 - Patch 8 +%\let\mscount\@multicnt +\ifx\mscount\@undefined\let\mscount\@multicnt\fi +% DG/SR modification end +\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 by \@ne + \def\psm@thenode{M-\the\psmatrixcnt-\the\psrow-\the\pscol}% + \tabskip\z@ + \psrow=\@ne + \pscol\z@ + \psset{shortput=tablr}% + \leavevmode + \vbox\bgroup\halign\bgroup&% + \begingroup + \global\advance\pscol by \@ne + \csname psrowhook\romannumeral\psrow\endcsname + \csname pscolhook\romannumeral\pscol\endcsname + \psm@beginnode##\psm@endnode\endgroup + \cr} +% +\def\endpsmatrix{% + \crcr\egroup\unskip\egroup + \endgroup} +% +% hv 2007-10-16 fix bug with \\[name=...] +%\def\psm@cr{{\ifnum0=`}\fi\@ifnextchar[{\psm@@cr}{\psm@@@cr{}}} +\def\psm@cr{{\ifnum0=`}\fi\ps@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\relax \pshskip\pscolsep \fi + \psk@mnodesize + \hfil + \Pst@nodealigntrue + \if@pst\csname mnode@\psk@mnode\endcsname + \else\csname mnode@\psk@emnode\endcsname\fi + \psk@mcol + \psk@@mnodesize} +% DG/SR modification begin - Sep. 3, 1999 - Patch 10 - From Michael Sharpe +%\def\psspan#1{\mscount#1\relax\loop\ifnum\mscount>\@ne \sp@n\repeat} +\def\psspan#1{\global\mscount#1\relax\pstloop\ifnum\mscount>\@ne\sp@n\repeat} +\def\pstloop#1\repeat{\gdef\pstiterate{#1\relax\expandafter\pstiterate\fi}% + \pstiterate + \let\pstiterate\relax} +% DG/SR modification end +\define@key[psset]{pst-node}{name}[\relax]{\pst@getnode{#1}\psk@name} +\let\psk@name\relax +\define@key[psset]{pst-node}{mcol}[c]{% + \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[pst-node]{mcol=c} +% +\define@key[psset]{pst-node}{mnodesize}[-1pt]{% + \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[pst-node]{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{{\Pst@nodealigntrue\cnode@ii(\z@,\z@){\psk@radius}{\psm@thenode}}} +\def\mnode@f{{\Pst@nodealigntrue\fnode@ii(\z@,\z@){\psm@thenode}}} +\def\mnode@circle{\circlenode@ii{\psm@thenode}} +% hv modification begin - Aug. 16, 2007 +\def\mnode@Circle{\Circlenode@ii{\psm@thenode}} +% hv modification end - Aug. 16, 2007 +\def\mnode@p{\pnode(\z@,\z@){\psm@thenode}} +% DG/SR modification begin - Jul. 22, 1997 - Patch 1 +\def\mnode@dot{\dotnode@ii(\z@,\z@){\psm@thenode}} +% DG/SR modification end +\def\mnode@none{\box\pst@hbox} +% +\define@key[psset]{pst-node}{mnode}[R]{% + \@ifundefined{mnode@#1}% + {\@pstrickserr{\string\psmatrix\space node `#1' not defined.}\@ehpa}% + {\edef\psk@mnode{#1}}} +\define@key[psset]{pst-node}{emnode}[none]{% + \@ifundefined{mnode@#1}% + {\@pstrickserr{\string\psmatrix\space node `#1' not defined.}\@ehpa}% + {\edef\psk@emnode{#1}}} +\psset[pst-node]{mnode=R,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 + 4 2 roll + \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 + 4 2 roll + \pscoilheight + \psk@coilwidth + \psk@coilarmA + \psk@coilarmB + \pst@coildict \tx@ZigZag end + \psline@iii + \tx@Line + end}% +} +% \psGetNodeCenter defines the PS variable #1.x and #1.y, which can then +% be used by the user. #1 must be a valid node name +\def\psGetNodeCenter#1{ tx@NodeDict begin /N@#1 load GetCenter end % x y on stack in system coor + \pst@number\psyunit div /#1.y exch def % /#1.y in user coor + \pst@number\psxunit div /#1.x exch def } % /#1.x in user coor +%\def\psGetNodeEdgeA#1#2{ tx@NodeDict begin /N@#2 load #2 GetEdgeA end % x y on stack in system coor +% \pst@number\psyunit div /#1.y exch def % /#1.y in user coor +% \pst@number\psxunit div /#1.x exch def } % /#1.x in user coor +\def\psGetEdgeA#1#2{ + tx@NodeDict begin \psk@offsetA \psk@offsetB neg + \psk@nodesepA \psk@nodesepB 0 0 + /N@#1 /N@#2 InitNC { NCCoor } if pop pop \tx@UserCoor end} +\def\psGetEdgeB#1#2{ + tx@NodeDict begin \psk@offsetA \psk@offsetB neg + \psk@nodesepA \psk@nodesepB 0 0 + /N@#1 /N@#2 InitNC { NCCoor } if 4 2 roll pop pop \tx@UserCoor end} +% +%%%%%%%%%%%%%% the pst-node-tools part %%%%%%%%%%%%%%%%%%%%%%%% +% +\def\ncbarr{\pst@object{ncbarr}} +\def\ncbarr@i#1#2{% + \begingroup + \use@par% + \psLNode(#1)(#2){0.5}{barr@tempNode}% + \pst@dimc=\psk@angleA pt + \pst@dimd=180pt + % be sure, that angleA is 0 or 180. if not, we set it to 0 + \ifdim\pst@dimc=\z@\else\ifdim\pst@dimc=\pst@dimd\else\psset{angleA=0}\fi\fi + \ncbar[arrows=-]{#1}{barr@tempNode} + \ifdim\psk@angleA pt=\z@\relax + \ncbar[angleA=180,angleB=180]{barr@tempNode}{#2} + \else\ncbar[angleA=0,angleB=0]{barr@tempNode}{#2}\fi% + \endgroup% +} +% #1-------#4----------------#2 +% where #1#4= #3 * #1#2 +% +\def\psLNode(#1)(#2)#3#4{% + \pst@getcoor{#1}\pst@tempA% + \pst@getcoor{#2}\pst@tempB% + \pnode(! + \pst@tempA /YA exch \pst@number\psyunit div def + /XA exch \pst@number\psxunit div def + \pst@tempB /YB exch \pst@number\psyunit div def + /XB exch \pst@number\psxunit div def + /dx XB XA sub def + /dy YB YA sub def + XA dx #3\space mul add YA dy #3\space mul add){#4}} +% +% build the linear combination #2*#1+#4*#3=#5 +\def\psLCNode(#1)#2(#3)#4#5{% + \pst@getcoor{#1}\pst@tempA% + \pst@getcoor{#3}\pst@tempB% + \pnode(! + \pst@tempA /YA exch \pst@number\psyunit div def + /XA exch \pst@number\psxunit div def + \pst@tempB /YB exch \pst@number\psyunit div def + /XB exch \pst@number\psxunit div def + XA #2\space mul XB #4\space mul add + YA #2\space mul YB #4\space mul add){#5}} +% +\def\psLDNode(#1)(#2)#3#4{% +% #1: node A #2: node B #3: dimen measured from A #4: node name + \pst@getcoor{#1}\pst@tempA% + \pst@getcoor{#2}\pst@tempB% + \pssetlength\pst@dimb{#3}% + \pnode(!% + \pst@tempA /YA exch \pst@number\psyunit div def + /XA exch \pst@number\psxunit div def + \pst@tempB /YB exch \pst@number\psyunit div def + /XB exch \pst@number\psxunit div def + /dx XB XA sub def + /dy YB YA sub def + /angle dy dx Atan def + /linelength \pst@number\pst@dimb \pst@number\psunit div def + XA linelength angle cos mul add YA linelength angle sin mul add ){#4}% +} +\def\psRelNode{\pst@object{psRelNode}} +\def\psRelNode@i(#1)(#2)#3#4{{% A - B - factor - node name + \use@par +% \pst@killglue + \pst@getcoor{#1}\pst@tempA% + \pst@getcoor{#2}\pst@tempB% + \pnode(! + \pst@tempA /YA exch \pst@number\psyunit div def + /XA exch \pst@number\psxunit div def + \pst@tempB /YB exch \pst@number\psyunit div def + /XB exch \pst@number\psxunit div def + /AlphaStrich \psk@angleA\space def + /unit \pst@number\psyunit \pst@number\psxunit div def % yunit/xunit +% + /dx XB XA sub def + /dy YB YA sub \ifPst@trueAngle\space unit mul \fi\space def + /laenge dy dup mul dx dup mul add sqrt #3 mul def + /Alpha dy dx atan def + /beta Alpha AlphaStrich add def + laenge beta cos mul XA add + laenge beta sin mul \ifPst@trueAngle\space unit div \fi\space YA add ){#4}% +}\ignorespaces} +% +\define@cmdkeys[psset]{pstricks-add}[PSTPSPNk@]{% Christophe Jorssen 2007 + blName,bcName,brName, + clName,ccName,crName, + tlName,tcName,trName}[]{}% +\psset[pstricks-add]{% + blName=PSPbl,bcName=PSPbc,brName=PSPbr, + clName=PSPcl,ccName=PSPcc,crName=PSPcr, + tlName=PSPtl,tcName=PSPtc,trName=PSPtr} +\def\psDefPSPNodes{\def\pst@par{}\pst@object{psDefPSPNodes}} +\def\psDefPSPNodes@i{% + \pst@killglue + \begingroup + \use@par + \expandafter\psDefPSPNodes@ii\pic@coor} +% +\def\psDefPSPNodes@ii(#1)(#2)(#3){% +% \pnode(#1){PSPN@temp}\pnode([nodesep=.75,angle=45]PSPN@temp){\PSTPSPNk@blName} +% \pnode(#3){PSPN@temp}\pnode([nodesep=.75,angle=-135]PSPN@temp){\PSTPSPNk@trName} + \pnode(#1){PSPN@temp}\pnode([angle=45]PSPN@temp){\PSTPSPNk@blName} + \pnode(#3){PSPN@temp}\pnode([angle=-135]PSPN@temp){\PSTPSPNk@trName} + \pnode(\PSTPSPNk@blName|\PSTPSPNk@trName){\PSTPSPNk@tlName} + \pnode(\PSTPSPNk@trName|\PSTPSPNk@blName){\PSTPSPNk@brName} + \ncline[linestyle=none]{\PSTPSPNk@blName}{\PSTPSPNk@tlName} + \ncput[npos=.5]{\pnode{\PSTPSPNk@clName}} + \ncline[linestyle=none]{\PSTPSPNk@blName}{\PSTPSPNk@brName} + \ncput[npos=.5]{\pnode{\PSTPSPNk@bcName}} + \pnode(\PSTPSPNk@brName|\PSTPSPNk@clName){\PSTPSPNk@crName} + \pnode(\PSTPSPNk@bcName|\PSTPSPNk@trName){\PSTPSPNk@tcName} + \pnode(\PSTPSPNk@bcName|\PSTPSPNk@clName){\PSTPSPNk@ccName} + \endgroup + \ignorespaces} +% +% +\def\psDefBoxNodes#1#2{\rnode[tl]{#1:tl}{\rnode[Bl]{#1:Bl}{\rnode[tr]{#1:tr}{% +\rnode[bl]{#1:bl}{\rnode[Br]{#1:Br}{\rnode[br]{#1:br}{#2}}}}}}% +\pnode(!\psGetNodeCenter{#1:bl} + \psGetNodeCenter{#1:tl} + #1:bl.x #1:tl.x add 2 div #1:bl.y #1:tl.y add 2 div ){#1:Cl}% +\pnode(!\psGetNodeCenter{#1:tr} + \psGetNodeCenter{#1:br} + #1:tr.x #1:br.x add 2 div #1:tr.y #1:br.y add 2 div ){#1:Cr}% +\pnode(!\psGetNodeCenter{#1:Cl} + \psGetNodeCenter{#1:Cr} + #1:Cl.x #1:Cr.x add 2 div #1:Cl.y #1:Cr.y add 2 div ){#1:C}% +\pnode(!\psGetNodeCenter{#1:Br} + \psGetNodeCenter{#1:Bl} + #1:Br.x #1:Bl.x add 2 div #1:Br.y #1:Bl.y add 2 div ){#1:BC}% +\pnode(!\psGetNodeCenter{#1:tr} + \psGetNodeCenter{#1:tl} + #1:tr.x #1:tl.x add 2 div #1:tr.y #1:tl.y add 2 div ){#1:tC}% +\pnode(!\psGetNodeCenter{#1:br} + \psGetNodeCenter{#1:bl} + #1:br.x #1:bl.x add 2 div #1:br.y #1:bl.y add 2 div ){#1:bC}}% +% +% +%% Author: Michael Sharpe (msharpe at ucsd.edu) +% Macros defined in this file: +% \defaultvalue{<command>}{<value>} assigns <value> to <command> is command is not defined, or is empty. +% \testAlg---used internally to test whether an parametric expression in t is algebraic +% \trim{<command>} trims white space from ends of expansion of <command> +% \hasparen sets \parentrue if its argument contains a ( +% \hasequal sets \equaltrue if its argument starts with = +% \equalwhat returns what follows = +% \parsenodexn parses a node expression recursively. Better to use \nodexn. +% \normalvec(<vec>){<nodename>} returns vector normal to <vec> (same length) in <nodename> +% \curvepnode{<t>}{<expression in t>}{<nodename>} Eg, \curvepnode{1}{sin(t) | cos(t)}{P} sets a pnode named P at (cos(1), sin(1)) +% \psparnode{<t>}{<expression> in t>}{<nodename>} is called by \curvename if expression is PostScript, not algebraic +% \algparnode{<t>}{<expression> in t>}{<nodename>} is called by \curvename if expression is algebraic, not PostScript +% \nodexn is like \parsenodexn, slightly different syntax. \nodexn{<exn>}{<name>} evaluates <exn> as a node expression and calls the result <name>. +% \psxline(P){<nodexn1>}{<nodexn2>} draws line from P+<nodexn1> to P+<nodexn2>. The novelty is that the last two arguments can be node expressions. +% \curvepnodes{<tmin>}{<tmax>}{<expression in t>}{<node root name>} Uses current setting of plotpoints (default 50) to define a sequence of pnodes along the curve. Eg, \curvepnodes[plotpoints=100]{0}{1}{t+t^2 | Ex(-t)}{P} sets pnodes P0..P99 at equally spaced t values along the curve, and defines the macro \Pnodecount to 99, the highest index. The expression in t may be either algebraic or PostScript, and is handled automatically detected. +% \fnpnode{<xval>}{<expression in x>}{<nodename>} sets a single pnode on graph. Eg, \fnpnode{.5}{x 2 mul x 1 add mul}{P} declares the pnode P at the point x=0.5 on the graph. (Same as \pnode(!/x 0.5 def x x 2 mul x 1 add mul}){P}.) If your expression in t is algebraic, you must use the keyword algebraic, as in \fnpnode[algebraic]{0.5}{2*x*(x+1)}{P}. +% \fnpnodes{<xmin}{<xmax>}{<expression in x>}{<node root name>} Is exactly the same as \curvenodes, but for the graph of a function. The keyword algebraic must be specified if your expression is algebraic +% \AtoB(A)(B){C} defines node by name C essentially as B-A +% \AplusB(A)(B){C} defines node by name C essentially as A+B +% \midAB(A)(B){C} defines node by name C essentially as (A+B)/2 +% \psnline[linewidth=1pt,arrows=->](3,5){P}, for example, expects that there are pnodes named P3..P7 (total of 5), and effectively gives the same result as \psline[linewidth=1pt,arrows=->](P3)(P4)(P5)(P6)(P7). Note that arrow must be specified with a keyword, not as an argument. +% \shownode(P) displays in the console window the coordinates of node P. This will not appear until the final stage of processing the PostScript file. It is a debugging tool. +% \getnodelist{<node root name>}{<next command>} is useful in writing pstricks macros, where there is a list of parenthesized coordinates to be read and turned into a node sequence, following which <next command> is followed. +% \pnodes{P}(1,2)(2;3)... is effectively \getnodelist{P}{}(1,2)(2;3)..., just a quick way to turn a list of coordinates into pnodes P0 P1 ... +% \psLCNodeVar is similar to \psLCNode, and provides a means of forming a linear combination of two nodes, thought of as vectors. Where \psLCNode(A){a}(B){b}{C} effectively makes C=aA+bB, \psLCNodeVar(A)(B)(a,b){C} does the same, but the third argument (a,b) may be specified in PostScript code or any form recognized by \SpecialCoor. Unlike \psLCNode, the name C may be one of A, B. +% \psRelNodeVar is similar to \psRelNode, and provides a means of rotating and changing the length of a line segment AB about A. The effect of \psRelNodeVar(A)(B)(2;30){C} is the same as \psRelNode[angle=30](A)(B){2}{C}, but the third argument (2;30) may be specified in PostScript code, which is not possible with \psRelNode. +% \psRelLineVar stands to \psRelLine as \psRelNodeVar stands to \psRelNode. +% \rhombus{<edge length>}(A)(B){C}{D} computes the two remaining vertices C, D given two opposing vertices A, B of a rhombus with given edge length. It does not draw the rhombus--- that can be handled easily by \pspolygon(A)(C)(B)(D). +% \psrline(P)(Q)... is like \psline, drawing a line starting at (P), with successive increments (Q)... It has the same options as \psline. Eg, \psrline[linecolor=red]{->}(1,1)(1,0) +% \polyIntersection is the most complicated macro in the collection. It has two forms +% \polyIntersection{<Nodename1>}{<Nodename2>}(A)(B)(1,2)(3;30)(6,5)... +%works with the line starting at A heading toward B, and computes the first point that lies on the polyline (1,2)(3;30)(6,5)..., calling it <Nodename1>. It also computes the first point in the opposite direction (from A) lying on that polyline, naming it <Nodename2>. If one or other of these intersections is empty, the nodes are set to remote points on the line. The two nodes are then joined by a line. The effect depends on the location of A and B relative to the polyline, with two cases worth noting. +% (a) if the polyline is closed and if A, B are interior to one of its components, you get a line segment from one edge to the other, containing AB. +% (b) If the polylne is simple and closed, and one of A, B is inside and the other outside, the resulting line segment will contain A but not B. +% \polyIntersection{<Nodename1>}{<Nodename2>}(A)(B){P}{n} works exactly the same as \polyIntersection{<Nodename1>}{<Nodename2>}(A)(B)(P0)(P1)...(Pn), assuming P0...Pn are previously defined as pnodes. +% \psStepa is like \psStep (pstricks-add) but for a node sequence rather than equally spaced abscissas. \psStepa[options]{<node root>}{<maxindex>} draws a step function with jumps at the successive nodes in the node sequence. Eg, \psStepa{P}{10} has jumps at P0..P10 +% +\newcount\pst@args%used in several macros +\newcount\num@pts +\newcount\pst@argcnt% for use in parsing node expressions +\def\PST@root{} +\let\pst@next\relax +%my scratch variables +\def\my@tempA{} +\def\my@tempB{} +\def\my@tempC{} +\def\my@tempD{} +\def\my@next{} +\newif\if@paren% +\newif\if@equal% +\newif\if@colon% +\newif\ifshow +\def\plussign{+}\def\minussign{-} +% +% +\def\defaultvalue#1#2{%#1 is a command, #2 is a value, possibly a command + \ifdefined#1\ifx#1\@empty\xdef#1{#2}\fi\else\xdef#1{#2}\fi}% +% +\def\testAlg#1|#2\@nil{% +\ifx\relax#2\relax% + \let\my@next\psparnode\xdef\my@tempD{}% +\else% + \let\my@next\algparnode\xdef\my@tempD{A}% algebraic +\fi}% +% +%Jonathan Fine's trim +\def\trim #1{\expandafter\trim@\expandafter{#1 }#1}% +\def\trim@ #1{\trim@@ @#1 @ #1 @ @@}% +\def\trim@@ #1@ #2@ #3@@{\trim@@@\empty #2 @}% +\def\unbrace#1{#1}% +\unbrace{\def\trim@@@ #1 } #2@#3{\expandafter\def% + \expandafter #3\expandafter {#1}}% +% +\def\hasparen#1(#2\@nil{%check if expression contains a (--call with \hasparen#1(\@nil + \ifx\relax#2\relax \@parenfalse \else \@parentrue\fi}% +% +\def\hasequal#1=#2\@nil{%check if expression contains a =--call with \hasequal#1=\@nil + \ifx\relax#2\relax \@equalfalse \else \@equaltrue\fi + \hascolon#2:\@nil}% +% +\def\hascolon#1:#2\@nil{%check if expression contains a :--call with \hascolon#1:\@nil +\ifx\relax#2\relax \@colonfalse \else \@colontrue\fi}% +% +\def\equalwhat#1=#2:#3\@nil{{#2}{#3}}% +% +\def\parsenodexn#1(#2)#3\@nil{% + \def\coeffA{#1}\edef\nodeA{#2}% + \trim\coeffA% + \ifx\nodeA\@empty\else% + \pnode(#2){@@TMP}% + \ifx\coeffA\@empty\def\coeffA{1}\else% + \ifx\coeffA\plussign\def\coeffA{1}\else\ifx\coeffA\minussign\def\coeffA{-1}\fi\fi\fi% + \edef\cmd{\noexpand\psLCNode(@TMP\the\pst@argcnt){1}(@@TMP){\coeffA}{@TMP}}% + \cmd% + \advance\pst@argcnt by \@ne% + \pnode(@TMP){@TMP\the\pst@argcnt}% + \parsenodexn#3\@nil% + \fi}% +% +\def\normalvec(#1)#2{% +%pnode | new pnode normal to old, same length + \psRelNodeVar(0,0)(#1)(0,1){#2}}% +% +\def\curvepnode#1#2#3{% +% #1=t value, #2=x(t) y(t) in either form,#3=node name, +%must first detect which form of x(t) y(t), looking for | + \edef\my@tempA{#2}% x(t) y(t) expanded + \expandafter\testAlg\my@tempA|\@nil\my@next {#1}{#2}{#3}} +% +\def\psparnode#1#2#3{% +% #1=t value, #2=x(t) y(t) in PS form,#3=node name, + \pnode(!/t #1 def #2){#3}% + \pnode(!/t #1 .001 sub def #2 + /t #1 .001 add def + #2 3 -1 roll sub 3 1 roll sub neg + 2 copy Pyth dup 3 1 roll div 3 1 roll div ){#3tang}}%unit tangent vector at t +% +\def\algparnode#1#2#3{% +% #1=t value, #2=x(t) | y(t) in alg form,#3=node name, +%\pstVerb{tx@Dict begin /t #1 def /Func (#2) AlgParser cvx def end} +%\pnode(!Func){#3}}% + \pstVerb{tx@Dict begin /Func (#2) AlgParser cvx def end } + \pnode(!/t #1 def Func){#3} + \pnode(!/t #1 .001 sub def Func + /t #1 .001 add def + Func 3 -1 roll sub 3 1 roll sub neg + 2 copy Pyth dup 3 1 roll div 3 1 roll div ){#3tang}%unit tangent vector at t +}% +% +\def\nodex#1{% +%#1=node expression --set nodename to @TMP +\expandafter\hasparen#1(\@nil% +\if@paren%it's an expression + \pnode(0,0){@TMP0}% + \pst@argcnt=0% + \expandafter\parsenodexn#1()\@nil% +\else% + \def\my@tempC{#1}% + \ifx\my@tempC\@empty\pnode(0,0){@TMP}\else\pnode(#1){@TMP}\fi% +\fi}%\if@paren +% +\def\nodexn#1#2{% +%#1=node expression | #2=node name +\expandafter\hasparen#1(\@nil%%% hv 20130917 use \expandafter +\if@paren%it's an expression + \pnode(0,0){@TMP0}% + \pst@argcnt=0% + \parsenodexn#1()\@nil% + \pnode(@TMP){#2}% +\else% + \def\my@tempC{#1}% + \ifx\my@tempC\@empty\pnode(0,0){#2}\else\pnode(#1){#2}\fi% +\fi}%\if@paren +% +\def\psxline{\pst@object{psxline}}% +\def\psxline@i{\@ifnextchar({\psxline@iii}{\psxline@ii}}% +\def\psxline@ii#1{% +\addto@par{arrows=#1}% +\psxline@iii}% +\def\psxline@iii(#1)#2#3{{%#1=basepoint, #2,#3 node expressions +\pst@killglue% +\use@par% +\nodexn{#2}{@TMP@a}% +\AplusB(#1)(@TMP@a){@TMP@A}% +\nodexn{#3}{@TMP@a}% +\AplusB(#1)(@TMP@a){@TMP@B}% +\psline(@TMP@A)(@TMP@B)% +}% +\ignorespaces}% +% +\def\curvepnodes{\pst@object{curvepnodes}} +\def\curvepnodes@i#1#2#3#4{{%optional [plotpoints=xx] +% #1=tmin,#2=tmax,#3=function (of t),#4=node root name, + \pst@killglue + \use@par + \edef\my@tempA{#3}% x(t) y(t) expanded + \expandafter\testAlg\my@tempA|\@nil % + \pstVerb{% + tx@Dict begin % so we can use definitions from tx@Dict + /t0 #1 def + /t1 #2 def + t1 t0 sub end \psk@plotpoints div /dt exch def }% + \pst@cntc=\psk@plotpoints\relax%\psk@plotpoints=plotpoints-1 + \advance\pst@cntc by \@ne\relax %=plotpoints + \ifx\my@tempD\@empty\pstVerb{tx@Dict begin /Func (#3) cvx def end }%add tx@Dict + \else\pstVerb{tx@Dict begin /Func (#3 ) AlgParser cvx def end }% + \fi% + \multido{\i=0+1}{\pst@cntc}{% + \pnode(! /t #1 dt \i\space mul add def Func ){#4\i}}% remove t before Func + \expandafter\xdef \csname #4nodecount\endcsname {\psk@plotpoints}% + \ifnum\Pst@Debug>0 \typeout{Created nodes #40 .. #4\psk@plotpoints}\fi% +}\ignorespaces}% +% +\def\fnpnode{\pst@object{fnpnode}} +\def\fnpnode@i#1#2#3{{%optional [algebraic] +%#1=x value | #2=fn of x | #3=node name + \pst@killglue + \use@par + \ifPst@algebraic\pnode(*#1 {#2}){#3}\else\pnode(! /x #1 def x #2){#3}\fi +}\ignorespaces}% +% +\def\fnpnodes{\pst@object{fnpnodes}} +\def\fnpnodes@i#1#2#3#4{{%optional [algebraic] +%#1=xmin | #2=xmax | #3= fn of x | #4=node name +\pst@killglue +\use@par +\pst@dima=#1pt \pst@dimb=#2pt \advance\pst@dimb -\pst@dima% +\pst@cnta=\psk@plotpoints \relax %=plotpoints-1 +\def\PST@root{#4} +\divide\pst@dimb by \pst@cnta%plotpoint-1 intervals +\pst@cntc=\pst@cnta % +\advance\pst@cntc by 1 \relax %=plotpoints +\ifPst@algebraic + \multido{\i=0+1}{\pst@cntc}{\pnode(*{\pst@number\pst@dima} {#3}){#4\i}% hv 20130713 + \advance\pst@dima \pst@dimb}% +\else + \multido{\i=0+1}{\pst@cntc}{\pnode(!/x \pst@number\pst@dima\space def x #3){#4\i}% + \advance\pst@dima \pst@dimb}% +\fi% + \expandafter\xdef \csname \PST@root nodecount\endcsname {\the\pst@cnta}% + \ifnum\Pst@Debug>0 \typeout{Created nodes #40 .. #4\the\pst@cnta}\fi% +}\ignorespaces}% +% +\def\AtoB(#1)(#2)#3{\psLCNodeVar(#1)(#2)(-1,1){#3}} +\def\AplusB(#1)(#2)#3{\psLCNodeVar(#1)(#2)(1,1){#3}} +\def\midAB(#1)(#2)#3{\psLCNodeVar(#1)(#2)(.5,.5){#3}} +% +\def\psnline{\pst@object{psnline}}%line of nodes +\def\psnline@i{\pst@getarrows{\psnline@ii}} +\def\psnline@ii(#1,#2)#3{{% +\pst@killglue% +\use@par% +\pst@cnta=#2 \relax\advance\pst@cnta by 1 +\edef\@tmp{}% +\multido{\i=#1+1}{\pst@cnta}{\xdef\@tmp{\@tmp(#3\i)}}% +\expandafter\psline\@tmp}% +\ignorespaces}% +% +\def\psnpolygon{\pst@object{psnpolygon}}%polygon of nodes +\def\psnpolygon@i{\pst@getarrows{\psnpolygon@ii}} +\def\psnpolygon@ii(#1,#2)#3{{% +\pst@killglue% +\use@par% +\pst@cnta=#2 \relax\advance\pst@cnta by 1 +\edef\@tmp{}% +\multido{\i=#1+1}{\pst@cnta}{\xdef\@tmp{\@tmp(#3\i)}}% +\expandafter\pspolygon\@tmp}% +\ignorespaces}% +% +\def\psncurve{\pst@object{psncurve}}%line of nodes +\def\psncurve@i{\pst@getarrows{\psncurve@ii}} +\def\psncurve@ii(#1,#2)#3{{% +\pst@killglue% +\use@par% +\pst@cnta=#2 \relax\advance\pst@cnta by 1 +\edef\@tmp{}% +\multido{\i=#1+1}{\pst@cnta}{\xdef\@tmp{\@tmp(#3\i)}}% +\expandafter\pscurve\@tmp}% +\ignorespaces}% +% +\def\psnccurve{\pst@object{psnccurve}}%line of nodes +\def\psnccurve@i{\pst@getarrows{\psnccurve@ii}} +\def\psnccurve@ii(#1,#2)#3{{% +\pst@killglue% +\use@par% +\pst@cnta=#2 \relax\advance\pst@cnta by 1 +\xdef\@tmp{}% +\multido{\i=#1+1}{\pst@cnta}{\xdef\@tmp{\@tmp(#3\i)}}% +\expandafter\psccurve\@tmp}% +\ignorespaces}% +% +\def\shownode(#1){%display node user coords in console + \pst@killglue% + \pstVerb{% + gsave tx@Dict begin % + tx@NodeDict /N@#1 known { % known node + /tmpar [(Node #1: ) <28> () (, ) () <29>] def % + /str 12 string def + STV CP T \psGetNodeCenter{#1}\space + tmpar 2 #1.x str cvs put + /str 12 string def + tmpar 4 #1.y str cvs put + tmpar concatstringarray = }% + {% not known + (Node #1: (NOT KNOWN)) = % + } ifelse % + end grestore }% + \ignorespaces}% +% +% Use to construct a sequence of nodes +% Eg, \pnodes{P}(0,1)(2;5)(3,4) defines nodes P0, P1, P2 with respective locations +% and a macro \Pnodecount containing the highest index created +\def\pnodes@ii#1{\getnodelist{#1}{}} +% +\def\getnodelist#1#2{% +\pst@args=0 \relax% +\def\PST@root{#1}% +\def\pst@next{#2}% command to perform after reading list +\getnext@Node}% +% +\def\getnext@Node{\@ifnextchar({\getnext@Node@i}% + {\advance\pst@args by \m@ne \expandafter\xdef \csname \PST@root nodecount\endcsname {\the\pst@args} + \ifnum\Pst@Debug>0 \typeout{Created nodes \PST@root0 .. \PST@root\the\pst@args}\fi% + \pst@next}% +}% +% +\def\getnext@Node@i(#1){% +\pnode(#1){\PST@root\the\pst@args}% +\advance\pst@args by \@ne\relax% +\getnext@Node}% +% +\def\psLCNodeVar(#1)(#2)(#3)#4{% +\pst@getcoor{#1}\my@tempA% +\pst@getcoor{#2}\my@tempB% +\pnode(#3){tmpLCn@de}% +\pnode(!% + \my@tempA /YA exch \pst@number\psyunit div def + /XA exch \pst@number\psxunit div def + \my@tempB /YB exch \pst@number\psyunit div def + /XB exch \pst@number\psxunit div def %stack now empty + \psGetNodeCenter{tmpLCn@de}\space + XA tmpLCn@de.x mul XB tmpLCn@de.y mul add + YA tmpLCn@de.x mul YB tmpLCn@de.y mul add){tmpLCn@deA}% +\pnode(tmpLCn@deA){#4}% +}% +% +\def\psRelNodeVar{\pst@object{psRelNodeVar}} +\def\psRelNodeVar@i(#1)(#2)(#3)#4{{% A - B - factor;angle - node name + \use@par + \pst@getcoor{#1}\my@tempA% + \pst@getcoor{#2}\my@tempB% + \pnode(#3){tmpn@de}% +\pnode(! + /unit \pst@number\psyunit \pst@number\psxunit div def % yunit/xunit + \my@tempA /YA exch \pst@number\psyunit div def + /XA exch \pst@number\psxunit div def + \my@tempB /YB exch \pst@number\psyunit div YA sub + \ifPst@trueAngle\space unit mul \fi\space def + /XB exch \pst@number\psxunit div XA sub def + %complex multiply (XB,YB) and (P.x,P.y), then add (XA,YA) + \psGetNodeCenter{tmpn@de} + XB tmpn@de.x mul YB tmpn@de.y mul sub + YB tmpn@de.x mul XB tmpn@de.y mul add + \ifPst@trueAngle\space unit div \fi\space + YA add exch XA add exch %x, y coords on stack + ){#4}% +}} +% +\def\psRelLineVar{\pst@object{psRelLineVar}} +\def\psRelLineVar@i{\@ifnextchar({\psRelLineVar@iii}{\psRelLineVar@ii}} +\def\psRelLineVar@ii#1{% + \addto@par{arrows=#1}% + \psRelLineVar@iii} +\def\psRelLineVar@iii(#1)(#2)(#3)#4{{% + \pst@killglue + \use@par + \psRelNodeVar(#1)(#2)(#3){#4}% + \psline(#1)(#4)% +}\ignorespaces} +% +\def\rhombus#1(#2)(#3)#4#5{% \rhombus{m}(B)(D){A}{C} +\AtoB(#2)(#3){node@P}% P=BD +% compute angle between BD and BC, in Postscript +\pnode(! %compute angle and scale in PS +/tmp \psGetNodeCenter{node@P} node@P.x node@P.y +Pyth 2 div def %tmp=half-length of BD +/ang tmp #1\space div Acos def %ang=angle from BD to BC & BA +#1\space tmp 2 mul div %scale factor s=m/BD +dup ang cos mul exch ang sin mul ){node@A1}% s cos(ang), s sin(ang) +\pnode(! \psGetNodeCenter{node@A1} node@A1.x node@A1.y neg ){node@A2}%reflect in x axis +\psRelNodeVar(#2)(#3)(node@A1){#4}% +\psRelNodeVar(#2)(#3)(node@A2){#5}% +}% +% +\def\psrline{\pst@object{psrline}}% relative lines +\def\psrline@i{\@ifnextchar({\psrline@iii}{\psrline@ii}}% +\def\psrline@ii#1{% +\addto@par{arrows=#1}% +\psrline@iii}% +\def\psrline@iii{% +\getnodelist{@tmpnode}{\psrline@iv}% +}% +\def\psrline@iv{% + \ifnum\pst@args<0\else%do nothing + \pnode(@tmpnode0){@tmpnodeB0}% + \multido{\iA=1+1,\iB=0+1}{\pst@args}{% + \AplusB(@tmpnodeB\iB)(@tmpnode\iA){@tmpnodeB\iA}}% + \psrline@v% + \fi% +}% +\def\psrline@v{{%finish up + \pst@killglue% + \use@par% + \xdef\tmp{(@tmpnodeB0)}% + \multido{\i=1+1}{\pst@args}% +{\xdef\tmp{\tmp(@tmpnodeB\i)}}% +\expandafter\psline\tmp% +}\ignorespaces}% +% +\def\polyIntersections#1#2(#3)(#4){% +%nodename1 | nodename2 | A | B | % intersections with line from A, B +\def\nodenameA{#1}\def\nodenameB{#2}% +\pnode(#3){P@A}\pnode(#4){P@B}% +\@ifnextchar({\polyIntersections@next}{\polyIntersections@ii}% +}% +\def\polyIntersections@ii#1#2{% +\def\root@node{#1}\num@pts=#2 \relax% +\polyIntersections@iii}% +% +\def\polyIntersections@next{%read as many points as exist +\def\root@node{P@}\getnodelist{P@}{\num@pts=\pst@args \relax\polyIntersections@iii}% +}% +\def\polyIntersections@iii{%nodes are now XXX0....XXXn, n=num@pts +\pst@cnta=\num@pts \relax\advance\pst@cnta by 1 \relax% +\pstVerb{% + /xarray \the\pst@cnta\space array def + /yarray \the\pst@cnta\space array def tx@Dict begin }% +\multido{\i=0+1}{\the\pst@cnta}{\pstVerb{ \psGetNodeCenter{\root@node\i} xarray \i\space \root@node\i.x put yarray \i\space \root@node\i.y put }}% +\pstVerb{ /tposmin 100 def /tnegmax -100 def %/argposmin 0 def /argposmax 0 def +\psGetNodeCenter{P@B} \psGetNodeCenter{P@A} +/dx P@B.x P@A.x sub def +/dy P@B.y P@A.y sub def +/lenAB dx dy Pyth def +/oldx xarray 0 get def /oldy yarray 0 get def +1 1 \the\num@pts\space {/k exch def /newx xarray k get def /newy yarray k get def +/ddx newx oldx sub def /ddy newy oldy sub def +/det ddy dx mul ddx dy mul sub def +det abs lenAB ddx ddy Pyth mul .001 mul gt +{/ac oldx P@A.x sub def /bd oldy P@A.y sub def + /tt ac ddy mul bd ddx mul sub det div def %solve for t value at intersection + /ss ac dy mul bd dx mul sub det div def % solve for s value at intersection +ss 0 ge + {ss 1 le + {tt 0 lt {tt tnegmax gt {/tnegmax tt def} if } {tt tposmin lt {/tposmin tt def} if } ifelse } + if } % ss 1 le +if }%ss 0 ge + if %det> + /oldx newx def /oldy newy def} for end }% +\pnode(! \psGetNodeCenter{P@A} \psGetNodeCenter{P@B} P@B.x P@A.x sub tposmin mul P@A.x add P@B.y P@A.y sub tposmin mul P@A.y add ){\nodenameA}% +\pnode(! \psGetNodeCenter{P@A} \psGetNodeCenter{P@B} P@B.x P@A.x sub tnegmax mul P@A.x add P@B.y P@A.y sub tnegmax mul P@A.y add){\nodenameB}% +}% +% +\def\actualscale#1 #2 scale{% extract x-scale from, eg, {2. 2. scale} +#1} +% +\def\psGetCenter#1{ tx@NodeDict begin /N@#1 load GetCenter end }% x y on stack in system coor +% +\def\ArrowNotch{\pst@object{ArrowNotch}} +\def\ArrowNotch@i#1#2#3#4{{% +%noderootname | index | arrowdirection | notchnodename % +\pst@killglue% +\use@par% +\def\inc{-1}% +\ifx#3<\def\inc{1}\fi% -1 means notch to left of arrowhead +%get length of pointed arrow under these conditions (types ->, -D> and their reverses) +\pstVerb{ + 1 \psk@arrowinset\space sub \psk@arrowlength\space \psk@arrowsize\space + \pst@number\pslinewidth \space mul add mul mul + \expandafter\actualscale\psk@arrowscale \space mul + /hh exch def /hh1 hh .05 sub def }% PS variable hh contains dist from tip to notch of arrow, in pts +\def\root@node{#1}\num@pts=\csname\root@node nodecount\endcsname % +\pst@cntb=\num@pts \advance\pst@cntb by \@ne%actual node count +\pst@cnta=\num@pts \advance\pst@cnta by \thr@@%size of PS array +\pst@cntc=#2 \relax% index of center of circle +\ifnum\pst@cntc>\num@pts \pnode(0,0){#4}\else +%compute a (screen based) unit vector in directions P1P0 and Pn-1Pn +\pstVerb{% +/PythSq { dup mul exch dup mul add } def +/PtSub { % xA yA xB yB + 3 -1 roll % xA xB yB yA + sub neg % xA xB yA-yB + 3 1 roll % yB-yA xA xB + sub % yB-yA xA-xB + exch % xB-xA yA-yB +} def + /xarray \the\pst@cnta\space array def + /yarray \the\pst@cnta\space array def + tx@Dict begin }% end pstVerb +\multido{\i=0+1,\ib=1+1}{\the\pst@cntb}{\pnode(! \psGetCenter{\root@node\i}\space % center on stack in system coords, not user coords +yarray \ib\space 3 -1 roll put xarray \ib\space 3 -1 roll put 0 0 ){@tmp}}% end multido +%\pstVerb{ \psGetCenter{\root@node6} == == } +\pnode(! xarray 1 get dup yarray 1 get dup 3 1 roll % x1 y1 x1 y1 +xarray 2 get yarray 2 get PtSub % x1 y1 x1-x2 y1-y2 +2 copy Pyth hh div 2 div dup % x1 y1 x1-x2 y1-y2 d d ,d->d/2*hh +3 1 roll % x1 y1 x1-x2 d y1-y2 d +div 3 1 roll div %x1 y1 (y1-y2)/d (x1-x2)/d +3 1 roll %x1 (x1-x2)/d y1 (y1-y2)/d +add 3 1 roll add % y1-(y2-y1)/d x1-(x2-x1)/d + xarray 0 3 -1 roll put yarray 0 3 -1 roll put %stack empty + xarray length 2 sub /topnum exch def + xarray topnum get dup yarray topnum get dup 3 1 roll %xn yn xn yn +topnum 1 sub /topnum exch def xarray topnum get yarray topnum get % xn yn xn yn x(n-1) y(n-1) +3 -1 roll sub neg 3 1 roll sub exch % xn yn (xn-x(n-1)) (yn-y(n-1)) +2 copy Pyth hh div 2 div dup % xn yn (xn-x(n-1)) (yn-y(n-1)) d d (d->d/(2*h)) +3 1 roll div 3 1 roll div %xn yn (xn-x(n-1))/d (yn-y(n-1))/d +3 -1 roll add 3 1 roll % y(n+1) x(n+1) +topnum 2 add /topnum exch def xarray topnum 3 -1 roll put yarray topnum 3 -1 roll put % empty +% next step--find first index outside circle of radius hh + /oldcindex \the\pst@cntc\space 1 add def %position in array + xarray oldcindex get /xc exch def yarray oldcindex get /yc exch def + %hh .05 sub /hh exch def % that's close enough for a crossing +/inc \inc\space def %+1 for left facing arrow, else -1 +/cindex oldcindex def +{cindex inc add /cindex exch def xarray cindex get xc sub yarray cindex get yc sub Pyth dup hh1 gt +{ exit } if } loop % exit from loop with cindex the first index of an external point--dist on stack + hh1 .1 add lt { xarray cindex get yarray cindex get } %else within segment +{ xarray cindex inc sub get dup yarray cindex inc sub get dup 4 -1 roll exch +xarray cindex get yarray cindex get PtSub /dy1 exch def /dx1 exch def dx1 dy1 PythSq /Aterm exch def +% dx1=x(n-1)-x(n), dy1=y(n-1)-y(n) [if inc=1]: dx1=x(n+1)-x(n), dy1=y(n+1)-y(n) [if inc=-1] +% x(n-inc) y(n-inc), Aterm=dx1^2+dy1^2 + 2 copy xc yc PtSub % x(n-inc) y(n-inc) (x(n-inc)-xc) (y(n-inc)-yc) + 2 copy 2 copy 3 -1 roll mul 3 1 roll mul add hh dup mul sub % x(n-inc) y(n-inc) (y(n-inc)-yc) (x(n-inc)-xc) (x(n-inc)-xc)^2+(y(n-inc)-yc)^2-hh^2 + Aterm div /Cterm exch def % x(n-inc) y(n-inc) (y(n-inc)-yc) (x(n-inc)-xc) , Cterm=((x(n-inc)-xc)^2+(y(n-inc)-yc)^2-hh^2)/(Aterm) (<0) + dx1 dy1 % x(n-inc) y(n-inc) (y(n-inc)-yc) (x(n-inc)-xc) dx1 dy1 + 4 1 roll mul 3 1 roll mul add Aterm div /Bterm exch def % x(n-inc) y(n-inc) , Bterm=( (x(n-inc)-xc)*dx1+(y(n-inc)-yc)*dy1)/Aterm + Bterm abs neg dup dup mul Cterm sub sqrt add dup /tval exch def +% x(n-inc) y(n-inc) tvalue + dup dx1 dy1 4 1 roll mul 3 1 roll mul % x(n-inc) y(n-inc) t*dx1 t*dy1 + PtSub } ifelse % x y screen coords of arrow notch now on stack---convert to user x y + \pst@number\psyunit div exch \pst@number\psxunit div exch %use coords now on stack +){#4}\fi% +\pstVerb { end } %tx@Dict +}\ignorespaces}% +% +\def\saveDataAsNodes#1#2{% Filename NodePrefix + \psLoopIndex=0\relax + \typeout{Open file #1}% + \openin7=#1 + \loop + \read7 to \@Data + \ifeof7\else + \ifx\@Data\@empty + \else + \pnode(!\@Data){#2\the\psLoopIndex}% + \typeout{#2\the\psLoopIndex -> \@Data}% + \advance\psLoopIndex by 1 + \let\@oldData\@Data + \fi + \repeat + \closein7 + \advance\psLoopIndex by -1 + \pnode(!\@oldData){#2Last}% +} +% +\catcode`\@=\TheAtCode\relax +\endinput +%% +%% END pst-node.tex diff --git a/graphics/pstricks/contrib/pst-node/tex/pst-node97.tex b/graphics/pstricks/contrib/pst-node/tex/pst-node97.tex new file mode 100644 index 0000000000..552e8ca2b1 --- /dev/null +++ b/graphics/pstricks/contrib/pst-node/tex/pst-node97.tex @@ -0,0 +1,391 @@ +% $Id: pst-node97.tex 834 2018-11-06 18:32:42Z herbert $ +%% BEGIN: pst-node.tex +%% Generated on <1993/3/12> from `pst-node.doc'. +%% For use with the PostScript header file `pst-node.pro'. +%% +\def\fileversion{0.93a} +\def\filedate{93/03/12} +%% +%% pst-node.tex: Node macros for PSTricks. +%% See the PSTricks read-me file and the User's Guide for documentation. +%% +%% COPYRIGHT 1993, by Timothy Van Zandt, tvz@Princeton.EDU +%% +%% Copying of part or all of any file in the pstricks.tex package +%% is allowed under the following conditions only: +%% (1) You may freely distribute unchanged copies of the files. Please +%% include the documentation when you do so. +%% (2) You may modify a renamed copy of any file, but only for personal +%% use or use within an organization. +%% (3) You may copy fragments from the files, for personal use or for use +%% in a macro package for distribution, as long as credit is given +%% where credit is due. +%% +%% You are NOT ALLOWED to take money for the distribution or use of +%% these files or modified versions or fragments thereof, except for +%% a nominal charge for copying etc. +%% +\csname PSTnodesLoaded\endcsname +\let\PSTnodesLoaded\endinput +\ifx\PSTricksLoaded\endinput\else +\def\next{\input pstricks97.tex}\expandafter\next +\fi +\edef\TheAtCode{\the\catcode`\@} +\catcode`\@=11 +\pstheader{pst-node97.pro} +\def\pst@nodedict{tx@NodeDict begin } +\def\pst@getnode#1#2{% +\pst@expandafter\pst@@getnode{#1} * \@nil{#1}#2} +\def\pst@@getnode#1#2 #3\@nil#4#5{% +\ifcat#1a\relax +\def#5{/TheNode#1#2 }% +\else +\def#5{/BadNode }% +\@pstrickserr{Bad node name: `#4'}\@ehpa +\fi} +\def\tx@NewNode{NewNode } +\def\pst@newnode#1#2#3#4{% +\leavevmode +\pst@getnode{#1}\pst@thenode +\pst@Verb{% +\pst@nodedict +{ #3 } \pst@thenode #2 { #4 } \tx@NewNode +end}} +\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{\def\pst@par{}\pst@object{cnode}} +\def\cnode@i{\@ifnextchar({\cnode@ii}{\cnode@ii(0,0)}} +\def\cnode@ii(#1)#2#3{% +\begingroup +\use@par +\pscircle@do(#1){#2}% +\pst@@getcoor{#1}% +\pssetlength\pst@dimc{#2}% +\pst@newnode{#3}{11}{% +\pst@coor +\pst@number\pst@dimc +\pst@number\pslinewidth +\psk@dimen .5 sub mul sub}% +{\tx@InitCnode}% +\endgroup +\ignorespaces} +\def\cnodeput{\def\pst@par{}\pst@object{cnodeput}} +\def\cnodeput@i{% +\begingroup +\pst@killglue +\leavevmode +\pst@getrputrot +\cnodeput@ii} +\def\cnodeput@ii(#1)#2{% +\pst@makebox{\cput@iii{\cnodeput@iii{#2}}(#1)}} +\def\cnodeput@iii#1{% +\pst@newnode{#1}{11}{\pscirclebox@iv \pst@number\pslinewidth add}% +{\tx@InitCnode}} +\def\circlenode{\def\pst@par{}\pst@object{circlenode}} +\def\circlenode@i#1{\pst@makebox{\pscirclebox@ii{\cnodeput@iii{#1}}}} +\def\tx@GetRnodePos{GetRnodePos } +\def\tx@InitRnode{InitRnode } +\def\rnode{\begingroup\pst@getref\rnode@} +\def\rnode@#1{\pst@makebox{\rnode@@{#1}}} +\def\rnode@@#1{% +\ifx\refpoint@x\relax +\def\refpoint@y{.5}% +\def\refpoint@x{.5}% +\fi +\pst@newnode{#1}{16}{}{% +\ifx\refpoint@x\relax .5 \else \refpoint@y\space \fi +\pst@number{\ht\pst@hbox}% +\pst@number{\dp\pst@hbox}% +\ifx\refpoint@y\@empty true \else false \fi +\refpoint@x\space +\pst@number{\wd\pst@hbox}% +\tx@InitRnode}% +\box\pst@hbox +\endgroup} +\def\tx@InitRNode{InitRNode } +\def\Rnode{\@ifnextchar({\Rnode@}{\Rnode@(\RnodeRef)}} +\def\Rnode@(#1)#2{\pst@makebox{\Rnode@@(#1){#2}}} +\def\Rnode@@(#1)#2{% +\begingroup +\pst@@getcoor{#1}% +\pst@newnode{#2}{16}{% +\pst@number{\ht\pst@hbox}\pst@number{\dp\pst@hbox}% +\pst@number{\wd\pst@hbox}\pst@coor}{\tx@InitRNode}% +\box\pst@hbox +\endgroup} +\def\RnodeRef{0,.7ex} +\def\tx@GetOnodePos{GetOnodePos } +\def\ovalnode{\def\pst@par{}\pst@object{ovalnode}} +\def\ovalnode@i#1{\pst@makebox{\psovalbox@ii{\ovalnode@ii{#1}}}} +\def\ovalnode@ii#1{% +\pst@newnode{#1}{14}{}{% +/X \pst@number{\wd\pst@hbox}2 div def +/Y \pst@number\pst@dimg 2 div \pst@number{\dp\pst@hbox}sub def +/w \pst@number\pst@dima def +/h \pst@number\pst@dimb def +/NodePos { \tx@GetOnodePos } def}} +\def\tx@GetCenter{GetCenter } +\def\tx@GetAngle{GetAngle } +\def\tx@GetEdge{GetEdge } +\def\tx@GetPos{GetPos } +\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{% +\begin@OpenObj +\showpointsfalse +\pst@getnode{#1}\pst@tempa +\pst@getnode{#2}\pst@tempb +\gdef\lputpos@default{#3}% +\addto@pscode{% +\pst@nodedict +\psk@offsetA +\psk@offsetB neg +\psk@nodesepA +\psk@nodesepB +\pst@tempa +\pst@tempb +\tx@InitNC { #4 } if +end}% +\def\use@pscode{% +\pst@Verb{gsave \tx@STV newpath \pst@code\space grestore}% +\gdef\pst@code{}}% +\end@OpenObj} +\def\lputpos@default{.5} +\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\psset@nodesepA#1{\pst@getlength{#1}\psk@nodesepA} +\def\psset@nodesepB#1{\pst@getlength{#1}\psk@nodesepB} +\def\psset@nodesep#1{% +\psset@nodesepA{#1}\let\psk@nodesepB\psk@nodesepA} +\psset@nodesep{0} +\def\psset@offsetA#1{\pst@getlength{#1}\psk@offsetA} +\def\psset@offsetB#1{\pst@getlength{#1}\psk@offsetA} +\def\psset@offset#1{% +\psset@offsetA{#1}\let\psk@offsetB\psk@offsetA} +\psset@offset{0} +\def\psset@armA#1{\pst@getlength{#1}\psk@armA} +\def\psset@armB#1{\pst@getlength{#1}\psk@armB} +\def\psset@arm#1{\psset@armA{#1}\let\psk@armB\psk@armA} +\psset@arm{10pt} +\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@LineMP{LineMP } +\def\tx@NCCoor{NCCoor } +\def\tx@NCLine{NCLine } +\def\ncline{\def\pst@par{}\pst@object{ncline}} +\def\ncline@i{\check@arrow{\ncline@ii}} +\def\ncline@ii#1#2{\nc@object{#1}{#2}{.5}{\tx@NCLine}} +\def\pcline{\def\pst@par{}\pst@object{pcline}} +\def\pcline@i{\pc@object\ncline@ii} +\def\ncLine{\def\pst@par{}\pst@object{ncLine}} +\def\ncLine@i{\check@arrow{\ncLine@ii}} +\def\ncLine@ii#1#2{\nc@object{#1}{#2}{.5}% +{\tx@NCLine +/LPutVar [ +nodeA \tx@GetCenter +nodeB \tx@GetCenter +3 1 roll 4 1 roll +] cvx def }} +\def\tx@BezierMidpoint{BezierMidpoint } +\def\tx@GetArms{GetArms } +\def\tx@NCCurve{NCCurve } +\def\nccurve{\def\pst@par{}\pst@object{nccurve}} +\def\nccurve@i{\check@arrow{\nccurve@ii}} +\def\nccurve@ii#1#2{\nc@object{#1}{#2}{.5}{% +/AngleA \psk@angleA\space def /AngleB \psk@angleB\space def +\psk@ncurvB\space \psk@ncurvA\space +\tx@NCCurve}} +\def\pccurve{\def\pst@par{}\pst@object{pccurve}} +\def\pccurve@i{\pc@object\nccurve@ii} +\def\ncarc{\def\pst@par{}\pst@object{ncarc}} +\def\ncarc@i{\check@arrow{\ncarc@ii}} +\def\ncarc@ii#1#2{\nc@object{#1}{#2}{.5}{% +\tx@GetAngle dup +\psk@arcangleA\space add /AngleA ED +\psk@arcangleB\space sub 180 add /AngleB ED +\psk@ncurvB\space \psk@ncurvA\space +\tx@NCCurve}} +\def\pcarc{\def\pst@par{}\pst@object{pcarc}} +\def\pcarc@i{\pc@object\ncarc@ii} +\def\tx@AnglesMP{AnglesMP } +\def\tx@NCAngles{NCAngles } +\def\ncangles{\def\pst@par{}\pst@object{ncangles}} +\def\ncangles@i{\check@arrow{\ncangles@ii}} +\def\ncangles@ii#1#2{% +\nc@object{#1}{#2}{1.5}{\ncangles@iii \tx@NCAngles}} +\def\ncangles@iii{% +tx@Dict begin +\ifdim\pslinearc>\z@ +/r \pst@number\pslinearc def +/Lineto { \tx@Arcto } def +\else +/Lineto { L } def +\fi +end +/AngleA \psk@angleA\space def /AngleB \psk@angleB\space def +/armA \psk@armA\space def /armB \psk@armB\space def } +\def\pcangles{\def\pst@par{}\pst@object{pcangles}} +\def\pcangles@i{\pc@object\ncangles@ii} +\def\tx@NCAngle{NCAngle } +\def\ncangle{\def\pst@par{}\pst@object{ncangle}} +\def\ncangle@i{\check@arrow{\ncangle@ii}} +\def\ncangle@ii#1#2{% +\nc@object{#1}{#2}{1.5}{\ncangles@iii \tx@NCAngle}} +\def\pcangle{\def\pst@par{}\pst@object{pcangle}} +\def\pcangle@i{\pc@object\ncangle@ii} +\def\tx@NCBar{NCBar } +\def\ncbar{\def\pst@par{}\pst@object{ncbar}} +\def\ncbar@i{\check@arrow{\ncbar@ii}} +\def\ncbar@ii#1#2{\nc@object{#1}{#2}{1.5}{% +\ncangles@iii /AngleB \psk@angleA def \tx@NCBar}} +\def\pcbar{\def\pst@par{}\pst@object{pcbar}} +\def\pcbar@i{\pc@object\ncbar@ii} +\def\tx@NCDiag{NCDiag } +\def\ncdiag{\def\pst@par{}\pst@object{ncdiag}} +\def\ncdiag@i{\check@arrow{\ncdiag@ii}} +\def\ncdiag@ii#1#2{% +\nc@object{#1}{#2}{1.5}{\ncangles@iii \tx@NCDiag}} +\def\pcdiag{\def\pst@par{}\pst@object{pcdiag}} +\def\pcdiag@i{\pc@object\ncdiag@ii} +\def\tx@NCDiagg{NCDiagg } +\def\ncdiagg{\def\pst@par{}\pst@object{ncdiagg}} +\def\ncdiagg@i{\check@arrow{\ncdiagg@ii}} +\def\ncdiagg@ii#1#2{% +\nc@object{#1}{#2}{.5}{\ncangles@iii \tx@NCDiagg}} +\def\pcdiagg{\def\pst@par{}\pst@object{pcdiagg}} +\def\pcdiagg@i{\pc@object\ncdiagg@ii} +\def\tx@LoopMP{LoopMP } +\def\tx@NCLoop{NCLoop } +\def\psset@loopsize#1{\pst@getlength{#1}\psk@loopsize} +\psset@loopsize{1cm} +\def\ncloop{\def\pst@par{}\pst@object{ncloop}} +\def\ncloop@i{\check@arrow{\ncloop@ii}} +\def\ncloop@ii#1#2{% +\nc@object{#1}{#2}{2.5}% +{\ncangles@iii /loopsize \psk@loopsize\space def \tx@NCLoop}} +\def\pcloop{\def\pst@par{}\pst@object{pcloop}} +\def\pcloop@i{\pc@object\ncloop@ii} +\def\tx@NCCircle{NCCircle } +\def\nccircle{\def\pst@par{}\pst@object{nccircle}} +\def\nccircle@i{\check@arrow{\nccircle@ii}} +\def\nccircle@ii#1#2{% +\pssetlength\pst@dima{#2}% +\nc@object{#1}{#1}{.5}{% +/AngleA \psk@angleA def +/r \pst@number\pst@dima def +\tx@NCCircle \psarc@v end}} +\def\pst@getlputrot#1{% +\@ifnextchar(% +{\def\pst@rot{}#1}% +{\pst@@getlputrot{\@ifnextchar({#1}{#1(\lputpos@default)}}}} +\def\pst@@getlputrot#1#2{% +\pst@expandafter{\@ifnextchar:{\pst@@@getlputrot}% +{\@ifstar{\pst@@@getrot}{\pst@@getrot}}}{#2}\@nil +\ifx\pst@rotlist\@empty\else +\edef\pst@rotlist{\pst@rotlist \pst@rot add }% +\fi +#1} +\def\pst@@@getlputrot#1#2\@nil{% +\pst@@getrot#2\@nil +\edef\pst@rot{langle \ifx\pst@rot\@empty\else\pst@rot add \fi}}% +\def\tx@LPutCoor{LPutCoor } +\def\psput@lput#1#2{% +\pst@checknum{#1}\pst@tempa +\hbox{% +\pst@Verb{% +\pst@nodedict +/t \pst@tempa\space def +\tx@LPutCoor +end +\tx@PutBegin}% +\box#2% +\pst@Verb{\tx@PutEnd}}} +\def\lput{\begin@psput{\pst@getref{\pst@getlputrot{\end@psput\lput@i}}}} +\def\lput@i(#1){% +\pst@makesmall\pst@hbox +\ifx\pst@rot\@empty\else\pst@rotate\pst@hbox\fi +\psput@lput{#1}\pst@hbox} +\def\mput{% +\begin@psput{\def\pst@rot{}\pst@getref{\end@psput\lput@i(\lputpos@default)}}} +\def\aput@#1{\begin@psput{% +\def\pst@refangle{#1 }% +\@ifnextchar[{\aput@i}{\pst@getlputrot{\end@psput\aput@ii}}}} +\def\aput@i[#1]{% +\pssetlength\pslabelsep{#1}\pst@getlputrot{\end@psput\aput@ii}} +\def\aput@ii(#1){% +\uput@iv\aput@iii +\psput@lput{#1}\pst@hbox} +\def\aput@iii{exch pop add a \tx@PtoC h1 add exch w1 add exch } +\def\aput{\aput@{langle 90 add}} +\def\bput{\aput@{langle 90 sub}} +\def\Aput@#1{\begin@psput{% +\def\pst@refangle{#1 }% +\def\pst@rot{}% +\@ifnextchar[{\Aput@i}{\end@psput\aput@ii(\lputpos@default)}}} +\def\Aput@i[#1]{% +\pssetlength\pslabelsep{#1}% +\end@psput\aput@ii(\lputpos@default)} +\def\Aput{\Aput@{langle 90 add}} +\def\Bput{\Aput@{langle 90 sub}} +\def\Lput{% +\begin@psput{\pst@getlabelsep{\pst@getlputrot{\end@psput{\Rput@i\lput@i}}}}} +\def\Mput{% +\begin@psput{% +\def\pst@rot{}% +\pst@getlabelsep{\end@psput{\Rput@i\lput@i}(\lputpos@default)}}} +\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}% +\pst@getnode{#2}\pst@tempg +\xdef\pst@tempg{% +\pst@nodedict +tx@NodeDict \pst@tempg known +{ \psk@offsetA \psk@angleA \psk@nodesepA \pst@tempg load \tx@GetEdge } +{ 0 0 } +ifelse +end }% +\endgroup +\let\pst@coor\pst@tempg} +\catcode`\@=\TheAtCode\relax +\endinput +%% +%% END: pst-node.tex |