[pstricks] TREE HELP

Denis Girou Denis.Girou at idris.fr
Fri May 11 20:07:04 CEST 2001


>>>>> "Christian.Gatu" == Gatu Cristian <Cristian.Gatu at unine.ch> writes:

    Christian.Gatu> I'm drawing a tree using "pstree" which is not so difficult... Now I want to
    Christian.Gatu> put more than two nodes in a frame. For two nodes there is "ncbox". Is there
    Christian.Gatu> a possibility to group in a box more than two nodes?

  It depend of what you really want to do, that is to say of how are the nodes
that you want to frame.

  If you want to frame whole subtrees, this is easy to do using some extended
macros. See my message of September 30, 1998 for the macros and some examples:
http://tug.org/pipermail/pstricks/1998/000242.html

  But if you want to put a frame around arbitrary nodes, you are on your own.
This is not very difficult to do, but there is no generic solution and you
must do it by yourself, defining the useful internal nodes. If you do not want
a rectangle as frame but the "exact" countour path, you will have sometimes to
define several nodes for one entry, to be able to define the contour line
around it.

   I give you an example for arbitrary nodes. Specially look at the usage
of the \Rnode macro and at the definition of the "href" and "vref" parameters.

\documentclass[a4paper]{article}

\usepackage{pst-node}

\SpecialCoor

\psset{subgriddiv=0,griddots=5}

\pagestyle{empty}

\begin{document}

\begin{pspicture}(-1,-1)(4,4)\psgrid
  \rput(0,0){\Rnode[href=-1.2,vref=-0.1]{A}{AAAA}}
  \rput(3,3){\Rnode[href=1.2,vref=0.4]{B}{BBBB}}
  \rput(3,0){\Rnode[href=1.2,vref=-0.1]{C}{CCCC}}
\end{pspicture}

\pspolygon(A)(A|B)(B)(C)

\vspace{2cm}

\begin{pspicture}(-1,-1)(4,4)\psgrid
  \rput(0,0){\Rnode[href=-1.5,vref=-0.1]{A}{AAAA}}
  \rput(3,3){\Rnode[href=-0.8,vref=0.4]{B1}{%
               \Rnode[href=1.2,vref=0.4]{B2}{BBBB}}}
  \rput(3,0){\Rnode[href=1.2,vref=-0.1]{C}{CCCC}}
\end{pspicture}

\pspolygon(A)(B1)(B2)(C)

\end{document}

D.G.



More information about the PSTricks mailing list