[pstricks] Drawing "webbed" trees with pstricks

Karl Trygve Kalleberg karltk at ii.uib.no
Fri Jul 29 08:32:47 CEST 2005


Hi list.

I am not entirely certain I've come to the right place, but I hope I have:)

I have a conceptually pretty simple problem. I want to draw trees with
binding arcs between one or multiple lines going out of a node down to
its children.

I have looked around at a dozen different tree packages for LaTeX, but
AFAICT, none of them are able to do this.

The code below gives a graphical depiction of the issue:

documentclass{article}
\usepackage{pst-tree}
\pagestyle{empty}
\begin{document}

One variant

\psset{radius=3pt,arrows=-**}
\pstree{\TR{%
  \psclip{\pspolygon[linestyle=none](0,-.3)(10,-.3)(10,-10)(0,-10)}%
  \pswedge(2.17,0){.6}{-122}{-58}%
  \endpsclip
  \psframebox{My Root Term of my Tree}}}%
  {\TR{\psframebox{Child1}} \TR{\psframebox{Child2}}}

Another variant

\psset{radius=3pt,arrows=-oo}
\pstree{\TR{%
  \psclip{\pspolygon[linestyle=none](0,-.2)(10,-.2)(10,-10)(0,-10)}%
  \pswedge*(2.17,0){.6}{-122}{-58}%
  \endpsclip
  \psframebox{My Root Term of my Tree}}}%
  {\TR{\psframebox{Child1}} \TR{\psframebox{Child2}}}

\end{document}


The arc between the nodes is either filled or unfilled. In both cases,
is should start at the line for leftmost child and end at the line of
the righmost child. In the case where the arc is filled, only the area
outside the parent node's box should be filled (i.e. a truncated arc).

Of course, this can be done manually, but I'd preferrably like the
calculation of the clipping box, and arc angle to be hidden behind a
macro. I've not found found a way to fetch out the metrics (i.e.
coordinates and/or angles) of the components (lines, nodes) of a tree,
and from cursory inspection of the pst-tree.tex file, I'm pretty sure I
won't.


So here comes my question: Is this something I should be using pstricks
for in the first place, and if so, does anybody have useful pointers for
how to start attacking the implementation of such a macro?


-- Karl T




More information about the PSTricks mailing list