[pstricks] Unbalanced trees with pstree

John Frampton jframpto at lynx.dac.neu.edu
Tue Nov 2 03:58:32 CET 2004


> Hello,
>
> I want to make a three-level tree where the nodes on the second level
> have different number of sons. The code I use is as follows
>
> \pstree[]
>           { \TR{$M_\rho$}}
>            { \pstree{ \TR{$M_{\beta_1}$}}
>                {\TR{$S_{\alpha_1}$} \TR{$S_{\alpha_2}$} }
>              \pstree{ \TR{$M_{\beta_2}$}}
>                {\TR{$S_{\alpha_3}$} \TR{$S_{\alpha_4}$}
>                  \TR{$S_{\alpha_5}$} \TR{$S_{\alpha_6}$} }
>              \pstree{ \TR{$M_{\beta_3}$}}
>                {\TR{$S_{\alpha_7}$} \TR{$S_{\alpha_8}$}
>                  \TR{$S_{\alpha_9}$} }
>           }
>
> I want the subtrees to be evenly spaced (e.g., I want the edge between
> M_\rho and M_{\beta_2} to be vertical). I have experimented with
> treenodesize, thistreenodesize and treesep without any luck. Any ideas
> are very welcome!
>
> Mårten
>

Sometimes it is easier to start from scratch.  The code is long,
but one can write it quickly.

\input pst-node % if necessary

\psset{nodesep=1ex,xunit=.4in,yunit=.3in}
\pspicture(-3.6,-2.1)(4.6,.1)
\def\Node(#1)#2#3{\rput(#1){\rnode{#3}{$#2$}}\ignorespaces}%
\Node(0,0){\rho}{A}
\Node(-3,-1){\beta_1}{B1}
\Node(0,-1){\beta_2}{B2}
\Node(3.5,-1){\beta_3}{B3}
\Node(-3.5,-2){\alpha_1}{C1}
\Node(-2.5,-2){\alpha_2}{C2}
\Node(-1.5,-2){\alpha_3}{C3}
\Node(-.5,-2){\alpha_4}{C4}
\Node(.5,-2){\alpha_5}{C5}
\Node(1.5,-2){\alpha_6}{C6}
\Node(2.5,-2){\alpha_7}{C7}
\Node(3.5,-2){\alpha_8}{C8}
\Node(4.5,-2){\alpha_9}{C9}
\ncline{A}{B1}
\ncline{A}{B2}
\ncline{A}{B3}
\ncline{B1}{C1}
\ncline{B1}{C2}
\ncline{B2}{C3}
\ncline{B2}{C4}
\ncline{B2}{C5}
\ncline{B2}{C6}
\ncline{B3}{C7}
\ncline{B3}{C8}
\ncline{B3}{C9}
\endpspicture

Does this work for you?

John Frampton

-

... people don't want to go to war... But, after all, it's the
leaders of the country who determine the policy and it's always a
simple matter to drag the people along whether it's a democracy
or a parliament or a communist dictatorship... Voice or no voice,
the people can always be brought to the bidding of the leaders.
That is easy.  All you have to do is tell them they are being
attacked and denounce the pacifists for lack of patriotism and
exposing the country to greater danger.  It works the same way
in any country.
                     Hermann Goering, at his Nuremberg trial





More information about the PSTricks mailing list