Nodes/Arrows

Denis Girou Denis.Girou at idris.fr
Thu May 4 12:07:33 CEST 2000


-----------------------------------------------------------------------------
This is the PSTricks mailing list, devoted to discussions about computational
graphics in (La)TeX using the PSTricks package from Timothy van Zandt.
For help using this mailing list, see instructions at the end of message.
-----------------------------------------------------------------------------

>>>>> "Bernd.Brandt" == Bernd Brandt <bernd at bio.vu.nl> writes:

    Bernd.Brandt> I would like to ask you a node connection question.
    Bernd.Brandt> The problem is the following.
    Bernd.Brandt> I have an arrow from node A to node B. I would like another arrow to
    Bernd.Brandt> merge with this arrow. Does someone know how to accomplish this?
    Bernd.Brandt> The basic idea is:

    Bernd.Brandt>    B
    
    Bernd.Brandt>    | 
    Bernd.Brandt>     \
    Bernd.Brandt> A -----------> C

    Bernd.Brandt> "The A binds B and then enters state C"

    Bernd.Brandt> I have the following code for the nodes. I do not know how to introduce
    Bernd.Brandt> merge an arrow from B with the arrow from A to C  (example above).

    Bernd.Brandt> \newlength{\MyLength}
    Bernd.Brandt> \settowidth{\MyLength}{$E_{01}$}
    Bernd.Brandt> \newcommand{\MyNode}[2]{\circlenode{#1}{\makebox[\MyLength]{#2}}}

    Bernd.Brandt> \begin{pspicture}(2,2)(10,10)
    Bernd.Brandt>   \rput(2,6){\MyNode{A}{$E_{00}$}}
    Bernd.Brandt>   \rput(6,8){\MyNode{B}{$E_{01}$}}
    Bernd.Brandt>   \rput(6,4){\MyNode{C}{$E_{10}$}}
    Bernd.Brandt>   \rput(10,6){\MyNode{D}{$E_{11}$}}
    Bernd.Brandt>   \ncline[nodesep=5pt]{->}{A}{B}
    Bernd.Brandt>   \naput{$\lambda_A$}
    Bernd.Brandt>   \ncline[nodesep=5pt]{->}{A}{C}
    Bernd.Brandt>   \naput{$\lambda_B$}
    Bernd.Brandt>   \ncline[nodesep=5pt]{->}{B}{D}
    Bernd.Brandt>   \naput{$\lambda_B$}
    Bernd.Brandt>   \ncline[nodesep=5pt]{->}{C}{D}
    Bernd.Brandt>   \naput{$\lambda_A$}
    Bernd.Brandt>   \nccurve[nodesep=5pt,ncurv=1,angleA=-90,angleB=-90]{->}{D}{A}
    Bernd.Brandt>   \naput{$\lambda_H$}
    Bernd.Brandt> \end{pspicture}

  I do not really understand how you want to apply this in your code and which 
nodes you want to connect here, but the preceding drawing and the requirement
itself are easier to understand.

  An easy way to do this is to define intermediate nodes on a connection
joining two existing nodes. For this, study the example I sent some weeks
ago (March 27): http://www.tug.org/ListsArchives/pstricks/msg00413.html

  P.S. For such diagrams where the elements are put on an implicit
two-dimensional grid, better prefer to use the "psmatrix" environment than
to position explicitely each element. It is a higher level environment which
avoid to specify coordinates and which have some specific capabilities for
such diagrams.

\documentclass[a4paper]{article}

\usepackage{pst-node}

\pagestyle{empty}

\begin{document}

\begin{psmatrix}[colsep=3]
             & [colsep=-0.5,name=B] B \\[0pt]
  [name=A] A &                        & [name=C] C
  % Node connections
  \ncline[arrowscale=2,nodesep=0.1]{->}{A}{C}
  \ncput[npos=0.3333]{\pnode{X}}
  \nccurve[ncurv=-1,nodesepA=-0.3]{B}{X}
\end{psmatrix}

\newlength{\MyLength}
\settowidth{\MyLength}{$E_{01}$}

% Original code
\newcommand{\MyNode}[2]{\circlenode{#1}{\makebox[\MyLength]{#2}}}

\begin{pspicture}(2,2)(10,10)
  \rput(2,6){\MyNode{A}{$E_{00}$}}
  \rput(6,8){\MyNode{B}{$E_{01}$}}
  \rput(6,4){\MyNode{C}{$E_{10}$}}
  \rput(10,6){\MyNode{D}{$E_{11}$}}
  \ncline[nodesep=5pt]{->}{A}{B}
  \naput{$\lambda_A$}
  \ncline[nodesep=5pt]{->}{A}{C}
  \naput{$\lambda_B$}
  \ncline[nodesep=5pt]{->}{B}{D}
  \naput{$\lambda_B$}
  \ncline[nodesep=5pt]{->}{C}{D}
  \naput{$\lambda_A$}
  \nccurve[nodesep=5pt,ncurv=1,angleA=-90,angleB=-90]{->}{D}{A}
  \naput{$\lambda_H$}
\end{pspicture}

\vspace{1cm}

% Rewritted code with the "psmatrix" environment
\newcommand{\MyBox}[1]{\makebox[\MyLength]{#1}}

\begin{psmatrix}[colsep=3,rowsep=1,mnode=circle]
                             & [name=E01]\MyBox{$E_{01}$} \\[0pt]
  [name=E00]\MyBox{$E_{00}$} &           & [name=E11]\MyBox{$E_{11}$} \\
                             & [name=E10]\MyBox{$E_{10}$}
  % Node connections
  \psset{nodesep=5pt,arrows=->}
  \ncline{E00}{E01}^{$\lambda_A$}
  \ncline{E00}{E10}^{$\lambda_B$}
  \ncline{E01}{E11}^{$\lambda_B$}
  \ncline{E10}{E11}^{$\lambda_A$}
  \nccurve[ncurv=1,angle=-90]{E11}{E00}_{$\lambda_H$}
\end{psmatrix}

\end{document}

D.G.

-----------------------------------------------------------------------------
The list interface (subscription, information, access to the archives) is on:
http://www.tug.org/cgi-bin/lwgate/pstricks
Otherway to unsubscribe, send mail to pstricks-request at mail.tug.org
with a blank subject and in body the line unsubscribe <email-address>
-----------------------------------------------------------------------------



More information about the PSTricks mailing list