[pstricks] Unbalanced trees with pstree
John Frampton
jframpto at lynx.dac.neu.edu
Tue Nov 2 18:55:53 CET 2004
Here is another solution --- avoiding pst-tree altogether.
\input multido
\psset{nodesep=.5ex,xunit=.4in,yunit=.3in,arrows=-}
\pspicture(-3.6,-2.1)(4.6,.1)
\def\Node(#1)#2#3{\rput(#1){\rnode{#3}{$#2$}}\ignorespaces}%
\Node(0,0){\rho}{A}
\multido{\n=1+1}{3}{%
\edef\m{\ifcase\n \or -3\or 0\or 3.5\fi}%
\Node(\m\psxunit,-1){\beta_{\n}}{B\n}
\ncline{A}{B\n}}
\dimen0=-3.5\psxunit
\multido{\n=1+1}{9}{%
\Node(\dimen0,-2){\alpha_{\n}}{C\n}
\edef\m{\ifcase\n \or 1\or 1\or 2\or 2\or 2\or 2\else 3\fi}%
\ncline{B\m}{C\n}
\advance\dimen0 by \psxunit }
\endpspicture
>
> 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!
-
... 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