summaryrefslogtreecommitdiff
path: root/Master/texmf-dist
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2011-02-02 01:24:47 +0000
committerKarl Berry <karl@freefriends.org>2011-02-02 01:24:47 +0000
commit09efc4be9590a02f705b9333e54b17c83fd8188b (patch)
treedec53ebb91a7cdd7af5dfb8a0152447b0f68d2fe /Master/texmf-dist
parent98dcc10c61c0573247242942889c1a2ccc393752 (diff)
pst-tvz 1.00 (1feb11)
git-svn-id: svn://tug.org/texlive/trunk@21266 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r--Master/texmf-dist/doc/generic/pst-tvz/Changes6
-rw-r--r--Master/texmf-dist/doc/generic/pst-tvz/README15
-rw-r--r--Master/texmf-dist/doc/generic/pst-tvz/pst-tvz-doc.bib69
-rw-r--r--Master/texmf-dist/doc/generic/pst-tvz/pst-tvz-doc.pdfbin0 -> 361341 bytes
-rw-r--r--Master/texmf-dist/doc/generic/pst-tvz/pst-tvz-doc.tex2033
-rw-r--r--Master/texmf-dist/source/generic/pst-tvz/Makefile71
-rw-r--r--Master/texmf-dist/tex/generic/pst-tvz/pst-tvz.tex2308
-rw-r--r--Master/texmf-dist/tex/latex/pst-tvz/pst-tvz.sty7
8 files changed, 4509 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/generic/pst-tvz/Changes b/Master/texmf-dist/doc/generic/pst-tvz/Changes
new file mode 100644
index 00000000000..a93667f053d
--- /dev/null
+++ b/Master/texmf-dist/doc/generic/pst-tvz/Changes
@@ -0,0 +1,6 @@
+----- pst-tvz.tex
+1.00 2010-10-28 - initial CTAN version (hv)
+
+----- pst-tree.sty
+ 2010-10-28 first version (hv)
+
diff --git a/Master/texmf-dist/doc/generic/pst-tvz/README b/Master/texmf-dist/doc/generic/pst-tvz/README
new file mode 100644
index 00000000000..bb6a8ecbf10
--- /dev/null
+++ b/Master/texmf-dist/doc/generic/pst-tvz/README
@@ -0,0 +1,15 @@
+This version of pst-tvz uses the xkeyval package, the extended
+version of keyval.
+
+Save the files pst-tvz.sty|.tex| in a directory, which is part of your
+local TeX tree. Then do not forget to run texhash to update this tree
+if these packages are new to your TeX distribution.
+For more information see the documentation of your LaTeX distribution
+on installing packages into your LaTeX distribution or the
+TeX Frequently Asked Questions:
+(http://www.tex.ac.uk/cgi-bin/texfaq2html?label=instpackages).
+
+pst-tvz needs pstricks and pst-node which should be part of your
+local TeX installation, otherwise get it from a CTAN server, f.ex.
+http://mirror.ctan.org/graphics/pstricks/
+
diff --git a/Master/texmf-dist/doc/generic/pst-tvz/pst-tvz-doc.bib b/Master/texmf-dist/doc/generic/pst-tvz/pst-tvz-doc.bib
new file mode 100644
index 00000000000..af373f81635
--- /dev/null
+++ b/Master/texmf-dist/doc/generic/pst-tvz/pst-tvz-doc.bib
@@ -0,0 +1,69 @@
+%% -*-bibtex-*-
+@STRING{tugboat = {TUGboat} }
+@STRING{dtk = {{D}ie {\TeX}nische {K}om{\"o}die} }
+
+@Book{companion,
+ author = {Michel Goosens and Frank Mittelbach and Sebastian Rahtz and Dennis Roegel and Herbert Vo\ss},
+ title = {The {\LaTeX} {G}raphics {C}ompanion},
+ publisher = {{Addison-Wesley Publishing Company}},
+ edition = {second},
+ year = {2007},
+ address = {Boston, Mass.}
+}
+
+@Article{reingold:,
+ author = {Reingold, Edward and Tilford, John},
+ title = {Tidier {D}rawings of {T}rees},
+ journal = {IEEE Transactions on Software Engineering},
+ volume = {SE-7},
+ number = 2,
+ year = 1981
+}
+
+@Article{girou:01:,
+ author = {Denis Girou},
+ title = {Pr\'esentation de {PST}ricks},
+ journal = {Cahier {GUT}enberg},
+ year = 1994,
+ volume = {16},
+ month = apr,
+ pages = {21-70}
+}
+
+@Article{girou:02:,
+ author = {{Timothy Van} Zandt and Denis Girou},
+ title = {Inside {PST}ricks},
+ journal = TUGboat,
+ year = 1994,
+ volume = {15},
+ month = sep,
+ pages = {239-246}
+}
+
+@Book{PostScript,
+ Author = {Kollock, Nikolai G.},
+ Title = {Post{S}cript richtig eingesetzt: vom {K}onzept zum
+ praktischen {E}insatz},
+ Publisher = {IWT},
+ Address = {Vaterstetten},
+ year = 1989,
+}
+
+@Manual{multido,
+ Title = {\texttt{multido.tex} - a loop macro, that supports fixed-point addition},
+ Author = {{Timothy Van} Zandt},
+ Organization = {},
+ Address = {\url{CTAN:/macros/generic/multido.tex}},
+ Note = {},
+ year = 1997
+}
+
+@Book{PSTricks2,
+ author = {Herbert Vo\ss{}},
+ title = {\texttt{PSTricks} -- {G}rafik f\"ur \TeX{} und \LaTeX},
+ edition = {fifth},
+ publisher = {DANTE -- lehmanns media},
+ year = {2010},
+ address = {Heidelberg/Hamburg}
+}
+
diff --git a/Master/texmf-dist/doc/generic/pst-tvz/pst-tvz-doc.pdf b/Master/texmf-dist/doc/generic/pst-tvz/pst-tvz-doc.pdf
new file mode 100644
index 00000000000..8dfd36d1d51
--- /dev/null
+++ b/Master/texmf-dist/doc/generic/pst-tvz/pst-tvz-doc.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/generic/pst-tvz/pst-tvz-doc.tex b/Master/texmf-dist/doc/generic/pst-tvz/pst-tvz-doc.tex
new file mode 100644
index 00000000000..e2ff7198ff1
--- /dev/null
+++ b/Master/texmf-dist/doc/generic/pst-tvz/pst-tvz-doc.tex
@@ -0,0 +1,2033 @@
+%% $Id: pst-tvz-doc.tex 409 2010-10-30 18:31:11Z herbert $
+\documentclass[11pt,english,BCOR10mm,DIV12,bibliography=totoc,parskip=false,smallheadings
+ headexclude,footexclude,oneside]{pst-doc}
+\usepackage[utf8]{inputenc}
+\usepackage{pst-tvz}
+\let\pstTreeFV\fileversion
+\lstset{pos=t,language=PSTricks,
+ morekeywords={psGammaDist,psChiIIDist,psTDist,psFDist,psBetaDist,psPlotImpl},basicstyle=\footnotesize\ttfamily}
+%
+\def\bgImage{%
+ \psTree[radius=2pt,nodesep=3pt]
+ \TC* \\
+ \psTree
+ \TC* \\
+ \TC* \TC* \\
+ \TC*
+ \endpsTree
+ \psTree
+ \TC* \TC* \\
+ \TC* \\
+ \TC* \TC* \TC*
+ \endpsTree
+ \endpsTree}
+%
+\begin{document}
+
+\title{A recursive alignment algorithm -- \texttt{pst-tvz}}
+\subtitle{Trees; v.\pstTreeFV}
+\author{Timothy Van Zandt\\Herbert Vo\ss}
+%\docauthor{Timothy Van Zandt\\Herbert Vo\ss}
+\date{\today}
+\maketitle
+\let\titlepafe\relax
+\tableofcontents
+
+\clearpage%
+
+\part{Using the package}
+\begin{abstract}
+The node and node connections are perfect tools for making trees, but
+positioning the nodes using \Lcs{rput} would be rather tedious,
+unless you have a computer program that generates the coordinates.
+
+The files \nxLPack{pst-tvz.tex}/\nxLPack{pst-tvz.sty} contains a high-level interface for
+making trees.
+
+It should be noted that the correct result is not guaranteed with every \Lprog{dvips} driver.
+This package was written for Rokicki's\index{Rokicki}
+\Lprog{dvips} programme, which is practically part of every \TeX{}
+distribution.
+\end{abstract}
+
+\section{Overview}
+
+
+The tree commands are
+\begin{BDef}
+\Lcs{pstree}\Largb{<root>}\Largb{<successors>}
+\end{BDef}
+
+\begin{BDef}
+\begin{tabular}{@{}l@{\kern30pt}l}
+\TeX\ version & \LaTeX\ version\\
+\Lcs{psTree}\Largb{<root>}\qquad & \LBEG{psTree}\Largb{root}\\
+\qquad<successors>\DBS & \qquad<successors> \DBS\\
+\qquad<successors>\DBS & \qquad<successors> \DBS\\
+\qquad\ldots & \qquad\ldots\\
+\Lcs{endpsTree} & \LEND{psTree}
+\end{tabular}
+\end{BDef}
+
+
+These do the same thing, but just have different syntax. \Lcs{psTree} is the ``long'' version.
+These macros make a box that encloses all the nodes, and whose baseline passes
+through the center of the root.
+Most of the nodes has a variant for use within a tree and are called tree nodes (see Section~\ref{treenodes}).
+
+Trees and tree nodes are called \emph{\Index{tree objects}}. The \Larg{root} of a tree
+should be a single tree object, and the \Larg{successors} should be one or more
+tree objects. Here is an example with only nodes:
+\begin{LTXexample}[pos=l]
+ \pstree[radius=3pt]{\Toval{root}}{\TC* \TC* \TC* \TC*}
+\end{LTXexample}
+There is no difference between a terminal node and a root node, other than
+their position in the \Lcs{pstree}\Largb{} command.
+
+Here is an example where a tree is included in the list of successors, and
+hence becomes \Index{subtree}:
+\begin{LTXexample}[pos=l]
+ \pstree[radius=3pt]{\Tp}{%
+ \TC*
+ \pstree{\TC}{\TC* \TC*}
+ \TC*}
+\end{LTXexample}
+
+
+
+
+
+\section{Tree Nodes}\label{treenodes}
+
+In each case, the name of the tree node is
+formed by omitting "`node"' from the end of the name and adding "T" at the
+beginning. For example, \Lcs{psovalnode} becomes \Lcs{Toval}. Here is the list of such
+tree nodes:
+\begin{BDef}
+\LcsStar{Tp}\OptArgs\\
+\LcsStar{Tc}\OptArgs\Largb{dim}\\
+\LcsStar{TC}\OptArgs\\
+\LcsStar{Tf}\OptArgs\\
+\LcsStar{Tdot}\OptArgs\\
+\LcsStar{Tr}\OptArgs\Largb{stuff}\\
+\LcsStar{TR}\OptArgs\Largb{stuff}\\
+\LcsStar{Tcircle}\OptArgs\Largb{stuff}\\
+\LcsStar{TCircle}\OptArgs\Largb{stuff}\\
+\LcsStar{Toval}\OptArgs\Largb{stuff}\\
+\LcsStar{Tdia}\OptArgs\Largb{stuff}\\
+\LcsStar{Ttri}\OptArgs\Largb{stuff}
+\end{BDef}
+
+The syntax of a tree node is the same as of its corresponding ``normal'' node,
+except that:
+\begin{compactitem}
+ \item There is always an optional argument for setting graphics parameters,
+ even if the original node did not have one;
+ \item There is no argument for specifying the name of the node;
+ \item There is never a coordinate argument for positioning the node; and
+ \item To set the reference point with \Lcs{Tr}, set the \Lkeyword{ref} parameter.
+\end{compactitem}
+
+Figure~\ref{allnodes} gives a reminder of what the nodes look like.
+
+
+
+\begin{figure}[!htb]
+\begin{LTXexample}
+\small\psset{armB=1cm, levelsep=3cm, treesep=-3mm,
+ angleB=-90, angleA=90, nodesepA=3pt, nodesepB=0}
+\def\psedge#1#2{\ncangle{#2}{#1}}
+
+\psTree[treenodesize=2.5cm]{\Toval{Tree nodes}} \\
+ \Tp~{\tt\string\Tp} \Tc{.5}~{\tt\string\Tc} \TC~{\tt\string\TC}
+ \psTree[levelsep=4cm,armB=2cm]{\Tp[edge=\ncline]} \\
+ \Tcircle{\tt\string\Tcircle} \Tdot~{\tt\string\Tdot}
+ \TCircle[radius=1.2]{\tt\string\TCircle} \Tn[name=Tn]\uput[0](Tn){\tt\string\Tn}
+ \Toval{\tt\string\Toval} \Ttri{\tt\string\Ttri}
+ \Tdia{\tt\string\Tdia}
+ \endpsTree%
+ \Tf~{\tt\string\Tf} \Tr{\tt\string\Tr} \TR{\tt\string\TR}
+\endpsTree
+\end{LTXexample}
+\caption{The tree nodes.}\label{allnodes}
+\end{figure}
+
+The difference between \Lcs{Tr} and \Lcs{TR} (variants of \Lcs{rnode} and \Lcs{Rnode},
+respectively) is important with trees. Usually, you want to use \Lcs{TR} with
+vertical trees because the baselines of the text in the nodes line up
+horizontally. For example:
+
+
+\begin{LTXexample}[pos=l]
+$ \pstree[nodesepB=3pt]{\Tcircle{X}}{%
+ \TR{\tilde{\tilde{X}}}
+ \TR{x}
+ \TR{y}} $
+\end{LTXexample}
+
+Compare with this example, which uses \Lcs{Tr}:
+
+\begin{LTXexample}[pos=l]
+$ \pstree[nodesepB=3pt]{\Tcircle{X}}{%
+ \Tr{\tilde{\tilde{X}}}
+ \Tr{x}
+ \Tr{y}} $
+\end{LTXexample}
+
+
+There is also a null tree node:
+\begin{BDef}
+\Lcs{Tn}
+\end{BDef}
+It is meant to be just a place holder. Look at the tree in Figure
+page~\pageref{allnodes}. The bottom row has a node missing in the middle.
+\Lcs{Tn}\Largb{} was used for this missing node.
+
+There is also a special tree node that doesn't have a ``normal'' version and
+that can't be used as the root node of a whole tree:
+\begin{BDef}
+\LcsStar{Tfan}\OptArgs
+\end{BDef}
+This draws a triangle whose base is \Lkeyword{fansize} %=\makeatletter\psk@fansize\makeatother
+and whose opposite corner is the predecessor node, adjusted by the value of
+\Lkeyword{nodesepA} and \Lkeyword{offsetA}.
+For example:
+
+\begin{LTXexample}[pos=l]
+\pstree[dotstyle=oplus,dotsize=8pt,nodesep=2pt]{\Tcircle{11}}{%
+ \Tdot
+ \pstree{\Tfan}{\Tdot}
+ \pstree{\Tdot}{\Tfan[linestyle=dashed]}}
+\end{LTXexample}
+
+
+\section{Tree orientation}
+
+Trees can grow down, up, right or left, depending on the \Lkeyword{treemode=}
+\Lkeyval{D}, \Lkeyval{U}, \Lkeyval{R}, or \Lkeyval{L} parameter.
+
+Here is what the previous example looks like when it grows to the right:
+
+\begin{LTXexample}[pos=l,width=0.4\linewidth]
+ \pstree[dotstyle=oplus,dotsize=8pt,
+ nodesep=2pt,treemode=R]
+ {\Tcircle{11}}{%
+ \Tdot
+ \pstree{\Tfan}{\Tdot}
+ \pstree{\Tdot}{\Tfan[linestyle=dashed]}}
+\end{LTXexample}
+
+
+You can change the \Lkeyword{treemode} in the middle of the tree.
+For example, here is a tree that grows up, and that has a subtree which grows
+to the left:
+
+\begin{LTXexample}[pos=l,width=0.4\linewidth]
+ \footnotesize
+ \pstree[treemode=U,dotstyle=otimes,dotsize=8pt,nodesep=2pt]
+ {\Tdot}{%
+ \pstree[treemode=L]{\Tdot}{\Tcircle{1} \Tcircle{2}}
+ \pstree{\Tdot}{\Tcircle{3} \Tcircle{4}}}
+\end{LTXexample}
+
+Since you can change a tree's orientation, it can make sense to include a tree
+(<treeB>) as a root node (of <treeA>). This makes a single logical tree, whose
+root is the root of <treeB>, and that has successors going off in different
+directions, depending on whether they appear as a successor to <treeA> or to
+<treeB>.
+
+\begin{LTXexample}[pos=l,width=0.4\linewidth]
+ \pstree{\pstree[treemode=L]{\Tcircle{root}}{\Tr{B}}}{%
+ \Tr{A1}
+ \Tr{A2}}
+\end{LTXexample}
+
+
+
+
+%%DG: to do
+
+On a semi-related theme, note that any node that creates an LR-box can contain
+a tree. However, nested trees of this kind are not related in any way to the
+rest of the tree. Here is an example:
+
+\begin{LTXexample}[pos=l,width=0.4\linewidth]
+ \psTree{\Tcircle{\pstree[treesep=0.4,levelsep=0.6,
+ nodesepB=-6pt]{\Tdot}{%
+ \TR{a} \TR{b}}}}\\
+ \TC
+ \TC
+ \endpsTree
+\end{LTXexample}
+
+When the tree grows up or down, the successors are lined up from left to right
+in the order they appear in \Lcs{pstree}. When the tree grows to the left or
+right, the successors are lined up from top to bottom. As an afterthought, you
+might want to flip the order of the nodes. The keyword \Lkeyword{treeflip}=\true/\false
+let's you do this. For example:
+
+\begin{LTXexample}[pos=l,width=0.4\linewidth]
+\footnotesize
+\pstree[treemode=U,dotstyle=otimes,dotsize=8pt,
+ nodesep=2pt,treeflip=true]{\Tdot}{%
+ \pstree[treemode=R]{\Tdot}{\Tcircle{1} \Tcircle{2}}
+ \pstree{\Tdot}{\Tcircle{3} \Tcircle{4}}}
+\end{LTXexample}
+Note that I still have to go back and change the \Lkeyword{treemode} of the subtree
+that used to grow to the left.
+
+
+\section{The distance between successors}
+
+The distance between successors is set by the key \Lkeyword{treesep}.
+The rest of this section describes ways to fine-tune the spacing between
+successors.
+You can change the method for calculating the distance between subtrees by
+setting the \Lkeyword{treefit}=\Lkeyval{tight}/\Lkeyval{loose}
+parameter. Here are the two methods:
+\begin{compactdesc}
+ \item[\Lkeyval{tight}] When \Lkeyset{treefit=tight}, which is the default, \Lkeyword{treesep} is
+ the minimum distance between each of the levels of the subtrees.
+ \item[\Lkeyval{loose}] When \Lkeyset{treefit=loose}, \Lkeyword{treesep} is the distance between the
+ subtrees' bounding boxes. Except when you have large intermediate nodes, the
+ effect is that the horizontal distance (or vertical distance, for horizontal
+ trees) between all the terminal nodes is the same (even when they are on
+ different levels).\footnote{%
+ When all the terminal nodes are on the same level, and the intermediate
+ nodes are not wider than the base of their corresponding \Index{subtree}s, then
+ there is no difference between the two methods.}
+\end{compactdesc}
+
+Compare:
+\begin{center}
+\tabcolsep=1cm
+\begin{tabular}{cc}
+ \psset{radius=2pt}
+ \pstree{\TC*}{%
+ \TC
+ \pstree{\TC*}{%
+ \pstree{\Tc{3pt}}{\TC \TC}
+ \TC*}}
+ &
+ \psset{radius=2pt}
+ \pstree[treefit=loose]{\TC*}{%
+ \TC
+ \pstree{\TC*}{%
+ \pstree{\Tc{3pt}}{\TC \TC}
+ \TC*}}
+\end{tabular}
+\end{center}
+
+With \Lkeyset{treefit=loose}, trees take up more space, but sometimes the structure
+of the tree is emphasized.
+
+
+
+%Another (orthogonal) way to highlight the structure of the tree is by setting
+%\begin{Ex}
+% \Par{xtreesep=dim}
+%\end{Ex}
+%to a positive value. The effect is that adjacent nodes with different parents
+%are farther apart than adjacent nodes with the same parent.\footnote{%
+%When \p{treefit=tight}, the minimum distance between levels other than the top
+%of the subtrees is increased by \p{xtreesep}. When \p{treefit=loose}, the
+%minimum distance between subtrees is increased by \p{xtreesep}}.
+
+%This would have no effect in the previous two examples, but compare the
+%spacing between the two subtrees in
+%\begin{LTXexample}
+% \psTree[radius=2pt,levelsep=1.5,xtreesep=.25cm] \TC* \\
+% \pstree{\TC*}{\TC* \TC*}
+% \pstree{\TC*}{\TC* \TC*}
+% \endpsTree
+%\end{LTXexample}
+%with the spacing in
+%\begin{LTXexample}
+% \psTree[radius=2pt,levelsep=1.5] \TC* \\
+% \pstree{\TC*}{\TC* \TC*}
+% \pstree{\TC*}{\TC* \TC*}
+% \endpsTree
+%\end{LTXexample}
+
+Sometimes you want the spacing between the centers of the nodes to be regular
+even though the nodes have different sizes. If you set \Lkeyword{treenodesize}
+to a non-negative value, then PSTricks sets the width (or height+depth for
+vertical trees) to \Lkeyword{treenodesize}, \emph{for the purpose of calculating the
+distance between successors}.
+
+
+For example, ternary trees look nice when they are symmetric, as in the
+following example:
+
+\begin{LTXexample}[pos=l,width=0.4\linewidth]
+ \pstree[nodesepB=-8pt,treenodesize=.85]{\Tc{3pt}}{%
+ \TR{$x=y$}
+ \TR{$x_1=y_1$}
+ \TR{$x_{11}=y_{11}$}}%$
+\end{LTXexample}
+
+Compare with this example, where the spacing varies with the size of the
+nodes:
+
+\begin{LTXexample}[pos=l,width=0.4\linewidth]
+ \pstree[nodesepB=-8pt]{\Tc{3pt}}{%
+ \TR{$x=y$}
+ \TR{$x_1=y_1$}
+ \TR{$x_{11}=y_{11}$}}%$
+\end{LTXexample}
+
+Finally, if all else fails, you can adjust the distance between two successors
+by inserting \Lcs{tspace}\Largb{length} between them:
+
+\begin{LTXexample}[pos=l,width=0.4\linewidth]
+\psTree{\Tc{3pt}}\\
+ \Tdia{foo}
+% \tspace{-0.5}
+ \Toval{and}
+ \Ttri{bar}
+\endpsTree
+\end{LTXexample}
+
+
+
+
+\section{Spacing between the root and successors}
+
+The distance between the center lines of the tree levels is \Lkeyword{levelsep}.
+If you want the spacing between levels to vary with the size of the levels,
+use the * convention. Then \Lkeyword{levelsep} is the distance between the bottom of
+one level and the top of the next level (or between the sides of the two
+levels, for horizontal trees).
+
+Note: PSTricks has to write some information to your \Lext{aux} file if using
+\LaTeX, or to \Lcs{jobname}.pst otherwise, in order to calculate the spacing.
+You have to run your input file a few times before PSTricks gets the spacing
+right.
+
+
+
+%%DG: to do
+%You are most likely to want to set \p{varlevelsep} to "true" in horizontal
+trees. Compare the following example:
+
+\begin{LTXexample}
+\def\psedge#1#2{\ncdiagg[nodesep=3pt,angleA=180,armA=0]{#2}{#1}}
+\pstree[treemode=R,varlevelsep]{\Tr{George Alexander Kopf VII}}{%
+ \pstree{\Tr{Barry Santos}}{\Tr{James Kyle} \Tr{Ann Ada}}
+ \pstree{\Tr{Terri Maloney}}{\Tr{Uwe Kopf} \Tr{Vera Kan}}}
+\end{LTXexample}
+
+with this one, were the spacing between levels is fixed:
+
+\begin{LTXexample}
+ \def\psedge#1#2{\ncdiagg[nodesep=3pt,angleA=180,armA=0]{#2}{#1}}
+ \pstree[treemode=R,levelsep=3cm]{\Tr{George Alexander Kopf VII}}{%
+ \pstree{\Tr{Barry Santos}}{\Tr{James Kyle} \Tr{Ann Ada}}
+ \pstree{\Tr{Terri Maloney}}{\Tr{Uwe Kopf} \Tr{Vera Kan}}}
+\end{LTXexample}
+
+%The center of the root node of a tree is positioned above the midpoint between
+%the centers of the two outer successors. If you want the root to be positioned
+%drectly above one of the successors, put the command
+% \Mac \treecenter
+%right \emph{after} that successor. For example:
+%\begin{LTXexample}
+% \def\myfan#1{\Tfan[fillstyle=solid,fillcolor=#1]\treecenter}%
+% \pstree{\Tcircle{$x_2$}}{%
+% \pstree{\Tcircle{$x_1$}}{%
+% \pstree{\Tcircle{$x_0$}}{\myfan{black}}
+% \myfan{gray}}
+% \myfan{white}}
+%\end{LTXexample}
+
+%Here is another interesting example:
+%\begin{example}
+% \def\psedge{\ncangle[angleA=0,angleB=90]}
+% \pstree[treesep=10pt]{\Tcircle[name=after]{$x_0$}}{%
+% \Tfan[fillstyle=solid,fillcolor=black]
+% \treecenter
+% \pstree{\Tcircle{$x_1$}}{\Tfan[fillstyle=solid,fillcolor=darkgray]}
+% \pstree{\Tcircle{$x_2$}}{\Tfan[fillstyle=solid,fillcolor=gray]}
+% \pstree{\Tcircle{$x_3$}}{\Tfan[fillstyle=solid,fillcolor=lightgray]}
+% \pstree{\Tcircle{$x_4$}}{\Tfan[fillstyle=solid,fillcolor=white]}}
+%\end{example}
+
+
+\section{Edges}
+
+Right after you use a tree node command, \Lcs{pssucc} is equal to the name of the
+node, and \Lcs{pspred} is equal to the name of the node's predecessor. Therefore,
+you can draw a line between the node and its predecessor by inserting, for
+example,
+
+\begin{lstlisting}[style=syntax]
+\ncline{\pspred}{\pssucc}
+\end{lstlisting}
+
+To save you the trouble of doing this for every node, each tree node executes
+\begin{lstlisting}[style=syntax]
+ \psedge{\pspred}{\pssucc}
+\end{lstlisting}
+The default definition of \Lcs{psedge} is \Lcs{ncline}, but you can redefine it as
+you please with \Lcs{def} or \LaTeX's \Lcs{renewcommand}.
+
+For example, here I use \Lcs{ncdiag}, with \Lkeyword{armA}=0, to get all the node
+connections to emanate from the same point in the predecessor. \LaTeX{} users can instead type:
+\begin{lstlisting}[style=syntax]
+\renewcommand{\psedge}{\ncdiag[armA=0,angleB=180,armB=1cm]}
+\end{lstlisting}
+
+
+\begin{LTXexample}[pos=l,width=0.4\linewidth]
+ \def\psedge{\ncdiag[armA=0,angleB=180,armB=1cm]}
+ \pstree[treemode=R,levelsep=3.5cm,framesep=2pt]{\Tc{6pt}}{%
+ \small \Tcircle{K} \Tcircle{L} \Tcircle{M} \Tcircle{N}}
+\end{LTXexample}
+
+Here is an example with \Lcs{ncdiagg}. Note the use of a negative \Lkeyword{armA} value
+so that the corners of the edges are vertically aligned, even though the nodes
+have different sizes:
+
+\begin{LTXexample}
+$
+\def\psedge#1#2{\ncdiagg[angleA=180,armA=1cm,nodesep=4pt]{#2}{#1}}
+% Or: \renewcommand{\psedge}[2]{ ... }
+\pstree[treemode=R, levelsep=5cm]{\Tc{3pt}}{%
+ \Tr{z_1\leq y} \Tr{z_1<y\leq z_2} \Tr{z_2<y\leq x} \Tr{x<y}
+}
+$
+\end{LTXexample}
+
+Another way to define \Lcs{psedge}\Largb{} is with the \Lkeyword{edge}
+parameter. Be sure to enclose the value in braces "{}" if it contains commas
+or other parameter delimiters. This gets messy if your command is long, and
+you can't use arguments like in the preceding example, but for simple changes
+it is useful. For example, if I want to switch between a few node connections
+frequently, I might define a command for each node connection, and then use
+the \Lkeyword{edge} parameter.
+
+\begin{LTXexample}[pos=l,width=0.4\linewidth]
+ \def\dedge{\ncline[linestyle=dashed]}
+ \pstree[treemode=U,radius=2pt]{\Tc{3pt}}{%
+ \TC*[edge=\dedge]
+ \pstree{\Tc{3pt}}{\TC*[edge=\dedge] \TC*}
+ \TC*}
+\end{LTXexample}
+
+You can also set \Lkeyset{edge=none} to suppress the node connection.
+
+If you want to draw a node connection between two nodes that are not direct
+predecessor and successor, you have to give the nodes a name that you can
+refer to, using the \Lkeyword{name} parameter. For example, here I connect two nodes
+on the same level:
+
+\begin{LTXexample}[pos=l,width=0.4\linewidth]
+ \pstree[nodesep=3pt,radius=2pt]{\Toval{nature}}{%
+ \pstree{\Tc[name=top]{3pt}}{\TC* \TC*}
+ \pstree{\Tc[name=bot]{3pt}}{\TC* \TC*}}
+ \ncline[linestyle=dashed]{top}{bot}
+\end{LTXexample}
+
+We conclude with the more examples.
+
+\begin{LTXexample}[pos=l,width=0.4\linewidth]
+ \def\psedge{\nccurve[angleB=180, nodesepB=3pt]}
+ \pstree[treemode=R, treesep=1.5, levelsep=3.5]%
+ {\Toval{root}}{\Tr{X} \Tr{Y} \Tr{Z}}
+\end{LTXexample}
+
+\begin{LTXexample}[pos=l,width=0.4\linewidth]
+ \pstree[nodesepB=3pt, arrows=->, xbbl=15pt,
+ xbbr=15pt, levelsep=2.5cm]{\Tdia{root}}{%
+ $
+ \TR[edge={\ncbar[angle=180]}]{x}
+ \TR{y}
+ \TR[edge=\ncbar]{z}
+ $}
+\end{LTXexample}
+
+\begin{LTXexample}[pos=l,width=0.4\linewidth]
+ \psset{armB=1cm, levelsep=3cm, treesep=1cm,
+ angleB=-90, angleA=90, arrows=<-, nodesepA=3pt}
+ \def\psedge#1#2{\ncangle{#2}{#1}}
+ \pstree[radius=2pt]{\Ttri{root}}{\TC* \TC* \TC* \TC*}
+\end{LTXexample}
+
+
+
+
+
+
+\section{Edge and node labels}
+
+Right after a node, an edge has typically been drawn, and you can attach
+labels using \Lcs{ncput}, \Lcs{tlput}, etc.
+With \Lcs{tlput}, \Lcs{trput}, \Lcs{taput}, and \Lcs{tbput}, you can align the labels
+vertically or horizontally, just like the nodes. This can look nice, at least
+if the slopes of the node connections are not too different.
+
+\begin{LTXexample}[pos=l,width=0.4\linewidth]
+ \pstree[radius=2pt]{\Tp}{%
+ \psset{tpos=.6}
+ \TC* \tlput{k}
+ \pstree{\Tc{3pt} \tlput[labelsep=3pt]{r}}{%
+ \TC* \tlput{j}
+ \TC* \trput{i}}
+ \TC* \trput{m}}
+\end{LTXexample}
+
+Within trees, the \Lkeyword{tpos} parameter measures this distance from the
+predecessor to the successor, whatever the orientation of the true.
+(Outside of trees it measures the distance from the top to bottom or left to
+right nodes.)
+
+PSTricks also sets \Lkeyset{shortput=tab} within trees. This is a special
+\Lkeyword{shortput} option that should not be used outside of trees. It implements
+the following abbreviations, which depend of the orientation of the true:
+
+\begin{center}
+\begin{tabular}{ccc}
+ & \multicolumn{2}{c}{Short for:}\\
+ \emph{Char.} & \emph{Vert.} & \emph{Horiz.}\\[2pt]
+ \textasciicircum & \Lcs{tlput} & \Lcs{taput} \\
+ \textunderscore & \Lcs{trput} & \Lcs{tbput}
+\end{tabular}
+\end{center}
+(The scheme is reversed if \Lkeyset{treeflip=true}.)
+
+\begin{LTXexample}[pos=l,width=0.4\linewidth]
+ \psset{tpos=.6}
+ \pstree[treemode=R, thistreesep=1cm,
+ thislevelsep=3cm,radius=2pt]{\Tc{3pt}}{%
+ \pstree[treemode=U, xbbr=20pt]{\Tc{3pt}^{above}}{%
+ \TC*^{left}
+ \TC*_{right}}
+ \TC*^{above}
+ \TC*_{below}}
+\end{LTXexample}
+
+You can change the character abbreviations with
+
+
+\begin{BDef}
+\Lcs{MakeShortTab}\Largb{<char1>}\Largb{<char2>}
+\end{BDef}
+
+The \verb+\n*put+ commands can also give good results:
+
+\begin{LTXexample}[pos=l,width=0.4\linewidth]
+ \psset{npos=.6,nrot=:U}
+ \pstree[treemode=R, thistreesep=1cm,
+ thislevelsep=3cm]{\Tc{3pt}}{%
+ \Tc{3pt}\naput{above}
+ \Tc*{2pt}\naput{above}
+ \Tc*{2pt}\nbput{below}}
+\end{LTXexample}
+
+You can put labels on the nodes using \Lcs{nput}. However, \Lcs{pstree} won't take
+these labels into account when calculating the bounding boxes.
+
+There is a special node label option for trees that does keep track of the
+bounding boxes:
+\begin{BDef}
+\Lnotation{\texttildelow}\OptArg*{*}\OptArgs\Largb{stuff}
+\end{BDef}
+Call this a ``tree node label''.
+
+Put a tree node label right after the node to which it applies, before any
+node connection labels (but node connection labels, including the short forms,
+can follow a tree node label). The label is positioned directly below the node
+in vertical trees, and similarly in other trees. For example:
+
+
+\begin{LTXexample}
+ \pstree[radius=2pt]{\Tc{3pt}\nput{45}{\pssucc}{root}}{%
+ \TC*~{$h$} \TC*~{$i$} \TC*~{$j$} \TC*~{$k$}}
+\end{LTXexample}
+
+Note that there is no ``long form'' for this tree node label. However, you can
+change the single character used to delimit the label with
+\begin{BDef}
+\Lcs{MakeShortTnput}\Largb{<char1>}
+\end{BDef}
+If you find it confusing to use a single character, you can also use a command
+sequence. E.g.,
+
+\begin{lstlisting}[style=syntax]
+\MakeShortTnput{\tnput}
+\end{lstlisting}
+
+You can have multiple labels, but each successive label is positioned relative
+to the bounding box that includes the previous labels. Thus, the order in
+which the labels are placed makes a difference, and not all combinations will
+produce satisfactory results.
+
+You will probably find that the tree node label works well for terminal nodes,
+without your intervention. However, you can control the tree node labels be
+setting several parameters.
+
+To position the label on any side of the node ("l"eft, "r"ight, "a"bove or
+"b"elow), set: \Lkeyword{tnpos}=\Lkeyval{l}/\Lkeyval{r}/\Lkeyval{a}/\Lkeyval{b}
+
+\begin{LTXexample}[pos=l,width=0.4\linewidth]
+\psframebox{%
+ \pstree{\Tc{3pt}~[tnpos=a,tndepth=0pt,radius=4pt]{root}}{%
+ \TC*~[tnpos=l]{$h$}
+ \TC*~[tnpos=r]{$i$}}}
+\end{LTXexample}
+
+When you leave the argument empty, which is the default, PSTricks chooses the
+label position is automatically.
+
+To change the distance between the node and the label, set \Lkeyword{tnsep} to a dimension
+When you leave the argument empty, which is the default, PSTricks uses the
+value of \Lkeyword{labelsep}. When the value is negative, the distance is measured
+from the center of the node.
+
+When labels are positioned below a node, the label is given a minimum height
+of \Lkeyword{tnheight}.
+Thus, if you add labels to several nodes that are horizontally aligned, and if
+either these nodes have the same depth or \Lkeyword{tnsep} is negative, and if the
+height of each of the labels is no more than \Lkeyword{tnheight}, then the labels
+will also be aligned by their baselines. The default is \nxLcs{ht}\Lcs{strutbox}, which
+in most \TeX{} formats is the height of a typical line of text in the current
+font. Note that the value of \Lkeyword{tnheight} is not evaluated until it is used.
+
+The positioning is similar for labels that go below a node. The label is given
+a minimum \emph{depth} of \Lkeyword{tndepth}.
+For labels positioned above or below, the horizontal reference point of the
+label, i.e., the point in the label directly above or below the center of the
+node, is set by the \Lkeyword{href} parameter.
+
+When labels are positioned on the left or right, the right or left edge of the
+label is positioned distance \Lkeyword{tnsep} from the node. The vertical point that
+is aligned with the center of the node is set by \Lkeyword{tnyref}.
+When you leave this empty, \Lkeyword{vref} is used instead. Recall that \Lkeyword{vref}
+gives the vertical \emph{distance} from the baseline. Otherwise, the
+\Lkeyword{tnyref} parameter works like the \Lkeyword{yref} parameter, giving the fraction of
+the distance from the bottom to the top of the label.
+
+\section{Details}
+
+PSTricks does a pretty good job of positioning the nodes and creating a box
+whose size is close to the true bounding box of the tree. However, PSTricks
+does not take into account the node connections or labels when calculating the
+bounding boxes, except the tree node labels.
+
+If, for this or other reasons, you want to fine tune the bounding box of the
+nodes, you can set the following parameters to a dimension:
+
+\begin{tabular}{@{}l l @{}}
+\emph{name} & \emph{default}\\\hline
+\Lkeyword{bbl} & 0pt\\
+\Lkeyword{bbr}& 0pt\\
+\Lkeyword{bbh}& 0pt\\
+\Lkeyword{bbd}& 0pt\\
+\Lkeyword{xbbl}& 0pt\\
+\Lkeyword{xbbr}& 0pt\\
+\Lkeyword{xbbh}& 0pt\\
+\Lkeyword{xbbd}& 0pt
+\end{tabular}
+
+The "`x"' versions increase the bounding box by <dim>, and the others set the
+bounding box to the dimension. There is one parameter for each direction from the
+center of the node, \textbf{l}eft, \textbf{r}ight, \textbf{h}eight, and
+\textbf{d}epth.
+
+These parameters affect trees and nodes, and subtrees that switch directions,
+but not subtrees that go in the same direction as their parent tree (such
+subtrees have a profile rather than a bounding box, and should be adjusted by
+changing the bounding boxes of the constituent nodes).
+
+Save any fiddling with the bounding box until you are otherwise finished with
+the tree.
+
+You can see the bounding boxes by setting the \Lkeyword{showbbox}=\true/\false
+parameter to \true. To see the bounding boxes of all the nodes in a tree, you
+have to set this parameter before the tree.
+
+In the following example, the labels stick out of the bounding box:
+
+\begin{LTXexample}[pos=l,width=0.4\linewidth]
+\psset{tpos=.6,showbbox=true}
+\pstree[treemode=U]{\Tc{5pt}}{%
+ \TR{foo}^{left}
+ \TR{bar}_{right}}
+\end{LTXexample}
+
+Here is how we fix it:
+
+\begin{LTXexample}[pos=l,width=0.4\linewidth]
+\psset{tpos=.6,showbbox=true}
+\pstree[treemode=U,xbbl=8pt,xbbr=14pt]{\Tc{5pt}}{%
+ \TR{foo}^{left}
+ \TR{bar}_{right}}
+\end{LTXexample}
+
+Now we can frame the tree:
+
+\begin{LTXexample}[pos=l,width=0.4\linewidth]
+\psframebox[fillstyle=solid,fillcolor=lightgray,framesep=14pt,
+ linearc=14pt,cornersize=absolute,linewidth=1.5pt]{%
+ \psset{tpos=.6,border=1pt,nodesepB=3pt}
+ \pstree[treemode=U,xbbl=8pt,xbbr=14pt]{%
+ \Tc[fillcolor=white,fillstyle=solid]{5pt}}{%
+ \TR*{foo}^{left}
+ \TR*{bar}_{right}}}
+\end{LTXexample}
+
+We would have gotten the same result by changing the bounding box of the two
+terminal nodes.
+
+\iffalse
+
+To skip levels, use
+
+\begin{BDef}
+\LcsStar{skiplevel}\OptArgs\Largb{nodes or subtrees}\\[4pt]
+\LcsStar{skiplevels}\OptArgs\Largb{int} \\
+\qquad<nodes or subtrees> \\
+\Lcs{endskiplevels}
+\end{BDef}
+
+
+These are kind of like subtrees, but with no root node.
+
+\begin{LTXexample}
+ \pstree[treemode=R,levelsep=1.8,radius=2pt]{\Tc{3pt}}{%
+ \skiplevel{\Tfan}
+ \pstree{\Tc{3pt}}{%
+ \TC*
+ \skiplevels{2}
+ \pstree{\Tc{3pt}}{\TC* \TC*}
+ \TC*
+ \endskiplevels
+ \pstree{\Tc{3pt}}{\TC* \TC*}}}
+\end{LTXexample}
+
+The profile at the missing levels is the same as at the first non-missing
+level. You can adjust this with the bounding box parameters. You get greatest
+control if you use nested \Lcs{skiplevel} commands instead of \Lcs{skiplevels}.
+
+\begin{LTXexample}
+\large\psset{radius=6pt, dotsize=4pt}
+\pstree[thislevelsep=0,edge=none,levelsep=2.5cm]{\Tn}{%
+ \pstree{\TR{Player 1}}{\pstree{\TR{Player 2}}{\TR{Player 3}}}
+ \psset{edge=\ncline}
+ \pstree{\pstree[treemode=R]{\TC}{\Tdot ~{(0,0,0)} ^{N}}}{%
+ \pstree{\TC[name=A] ^{L}}{%
+ \Tdot ~{(-10,10.-10)} ^{l}
+ \pstree{\TC[name=C] _{r}}{%
+ \Tdot ~{(3,8,-4)} ^{c}
+ \Tdot ~{(-8,3,4)} _{d}}}
+ \pstree{\TC[name=B] _{R}}{%
+ \Tdot ~{(10,-10.0)} ^{l}
+ \pstree{\TC[name=D]_{r}}{%
+ \Tdot ~{(4,8,-3)} ^{c}
+ \Tdot ~{(0,-5,0)} _{d}}}}}
+\ncbox[linearc=.3,boxsize=.3,linestyle=dashed,nodesep=.4]{A}{B}
+\ncarcbox[linearc=.3,boxsize=.3,linestyle=dashed,arcangle=25,nodesep=.4]{D}{C}
+\end{LTXexample}
+
+\fi
+
+\section{The scope of parameter changes}
+
+\Lkeyword{edge} is the only parameter which, when set in a tree node's parameter
+argument, affects the drawing of the node connection (e.g., if you want to
+change the \Lkeyword{nodesep}, your edge has to include the parameter change, or you
+have to set it before the node).
+
+As noted at the beginning of this section, parameter changes made with
+\Lcs{pstree} affect all subtrees. However, there are variants of some of these
+parameters for making local changes, i.e, changes that affects only the
+current level: \Lkeyword{thistreesep}, \Lkeyword{thistreenodesize},
+\Lkeyword{thistreefit}=\Lkeyval{tight}/\Lkeyval{loose}, and \Lkeyword{thislevelsep}.
+
+For example:
+\begin{LTXexample}[pos=l,width=0.4\linewidth]
+\pstree[thislevelsep=.5cm,thistreesep=2cm,
+ radius=2pt]{\Tc*{3pt}}{%
+ \pstree{\TC*}{\TC* \TC*}
+ \pstree{\TC*}{\TC* \TC*}}
+\end{LTXexample}
+
+There are some things you may want set uniformly across a level in the tree,
+such as the \Lkeyword{levelsep}. At level <n>, the command \nxLcs{pstreehook<roman(n)>}
+(e.\,g., \Lcs{pstreehookii}) is executed, if it is defined (the root node of the
+whole tree is level 0, the successor tree objects and the node connections
+from the root node to these successors is level 1, etc.). In the following
+example, the \Lkeyword{levelsep} is changed for level 2, without having to set the
+\Lkeyword{thislevelsep} parameter for each of the three subtrees that make of
+level 2:
+
+\begin{LTXexample}
+\[
+\def\pstreehookiii{\psset{thislevelsep=3cm}}
+\pstree[treemode=R,levelsep=1cm,radius=2pt]{\Tc{4pt}}{%
+ \pstree{\TC*}{%
+ \pstree{\TC*}{\Tr{X_1} \Tr{X_2}}
+ \pstree{\TC*}{\Tr{Y_1} \Tr{Y_2}}}
+ \pstree{\TC*}{%
+ \pstree{\TC*}{\Tr{K_1} \Tr{K_2}}
+ \pstree{\TC*}{\Tr{J_1} \Tr{J_2}}}}
+\]
+\end{LTXexample}
+
+
+\clearpage
+
+
+\part{Theory}
+
+
+\begin{abstract}
+This is a description of a recursive alignment algorithm that is useful for drawing trees
+and tree-like graphs. It is a generalization of the algorithm in~\cite{reingold}.
+The purpose of the algorithm is to recursively construct a description of a {\em tree}
+in a high-level graphics language with the capabilities of PostScript. Thus, the algorithm
+is a preprocessor, and the graphics interpreter is a postprocessor. This division makes the
+algorithm simpler and more modular. The postprocessing could be implemented internally,
+if a low-level graphics description is required.
+
+Thanks to: Ed Reingold
+\end{abstract}
+
+
+\section{Introduction}
+
+A tree is a collection of nodes, organized into levels, with each node's center assigned a
+coordinate position. The center of a node is where edges should point to. Trees have
+ragged left and right profiles, because the widths of the levels vary. In {\em horizontal mode},
+the algorithm joins trees side by side, aligned by their top levels and fitted together
+tightly. In {\em vertical mode}, the algorithm stacks trees so that the nodes at the bottom
+level of the each tree are centered above the nodes at the top level of the next tree.
+
+The algorithm is implemented in \LPack{pst-tvz}, which is part of the PSTricks package.
+PSTricks is a collection of PostScript extensions to \TeX. The examples in this paper
+use the PSTricks implementation. The syntax of the input file is:
+
+\begin{lstlisting}[style=syntax]
+ \psTree
+ ~tree objects~ \\
+ ~tree objects~ \\
+ ...
+ ~tree objects~
+ \endpsTree
+\end{lstlisting}
+
+Each row except for the last ends in \verb=\\=. Each row is processed in horizontal mode, and then the
+rows are stacked in vertical mode. See Example~\ref{one}.
+
+\begin{LTXexample}[width=5cm,pos=l,caption=Example 1,label=one]
+ \psTree[radius=2pt,nodesep=3pt]
+ \TC* \\
+ \psTree
+ \TC* \\
+ \TC* \TC* \\
+ \TC*
+ \endpsTree
+ \psTree
+ \TC* \TC* \\
+ \TC* \\
+ \TC* \TC* \TC*
+ \endpsTree
+ \endpsTree
+\end{LTXexample}
+
+\section{The graphics description}\label{graphics}
+
+The graphics language should have whatever features one needs to draw the nodes, edges
+and labels, plus the ability to define procedures and variables for later reference.
+Furthermore, the graphics state should keep track of a current point, which can be
+manipulated as follows:
+\begin{compactenum}
+ \item Operators \Lps{gsave} and \Lps{grestore}, respectively, push the current point onto a stack and
+ pop the top current point from that stack.
+ \item The operator $x$ $y$ \Lps{RMOVETO} shifts the current point $x$ units to the right and $y$ units down.
+\end{compactenum}
+Note the convention that the $y$-direction is {\em down}.
+
+The tree graphics description should place (the center of) the top-left node at the current
+point, and should not change the current point.
+
+
+The graphics description consists of these operators plus nodes, node labels,
+edges and edge labels. Here is what these objects do:
+\begin{compactdesc}\label{Labels}
+\item[Node]
+ Draws the node, without changing the current point, and defines a procedure, identified
+ by the node's name, that can answer queries about where to draw edges. For example, in
+ PSTricks the nodes can report the coordinate of the center of the node, and the coordinate
+ of the boundary of the node in any direction from the center.
+
+\item[Node label]
+ Draws a label at a node, by querying the node to find out where to position the label.
+
+\item[Edge]
+ Draws a line between two nodes, querying the nodes to find out where to connect the lines,
+ and then defines a procedure for finding the coordinate and slope at any point on the line.
+
+\item[Edge label]
+ Puts a label on an edge, using the procedure for finding the coordinate and slope of a
+ point on the last edge that was drawn.
+\end{compactdesc}
+
+\begin{LTXexample}[caption=Example 2,label=2]
+ \def\sm{\rm\scriptsize} \footnotesize\sf
+ \psTree[radius=8pt,treesep=2.5cm,levelsep=2.5cm]
+ \psTree
+ \TCircle{A}\nput{r}{\pssucc}{\sm $(0,0)$}
+ \TCircle{B}\nput{r}{\pssucc}{\sm $(100,0)$}
+ \\
+ \TCircle{C}\nput{r}{\pssucc}{\sm $(50,-100)$}
+ \endpsTree
+ \psTree
+ \TCircle{D}~[tnpos=r]{\sm $(200,0)$}
+ \\
+ \TCircle{E}^{$l$}\nput{r}{\pssucc}{\sm $(150,-100)$}
+ \TCircle{F}~[tnpos=r]{\sm $(250,-100)$}_{$r$}
+ \endpsTree
+ \\
+ \TCircle{G}~[tnpos=r]{\sm $(200,-200)$}
+ \endpsTree
+\end{LTXexample}
+
+
+
+Suppose we want to draw the graph in Example~\ref{2}. We start by constructing the code for the subgraph
+containing nodes A, B and C. The first row (nodes A and B) is:
+\begin{lstlisting}[style=syntax]
+ gsave
+ ~Node A~
+ 100 0 rmoveto
+ ~Node B~
+ grestore
+\end{lstlisting}
+and the second row is:
+\begin{lstlisting}[style=syntax]
+ gsave
+ ~Node C~
+ ~Line from Node A to Node C~
+ ~Line from Node B to Node C~
+ grestore
+\end{lstlisting}
+Then we calculate that the top-left node (node C) of the second row is positioned at $(50,100)$ from the
+top-left node (node A) of the top row. The subgraph is thus:
+\begin{lstlisting}[style=syntax]
+ gsave
+ gsave
+ ~Node A~
+ 100 0 rmoveto
+ ~Node B~
+ grestore
+ 50 100 rmoveto
+ gsave
+ ~Node C~
+ ~Edge from Node A to Node C~
+ ~Edge from Node B to Node C~
+ grestore
+ grestore
+\end{lstlisting}
+
+Similary, the subgraph for nodes D, E and F is:
+\begin{lstlisting}[style=syntax]
+ gsave
+ gsave
+ ~Node D~
+ grestore
+ -50 100 rmoveto
+ gsave
+ ~Node E~
+ ~Edge from Node A to Node C~
+ ~Edge label~
+ ~Node F~
+ ~Edge from Node B to Node C~
+ ~Edge label~
+ grestore
+ grestore
+\end{lstlisting}
+
+To join these two subgraphs, we calculate that the distance from the top-left node of $\{A,B,C\}$ to the top-left node of $\{D,E,F\}$ is $(200,0)$. Thus, the subgraph $\{A,B,C,D,E,F\}$ is
+\begin{lstlisting}[style=syntax]
+ gsave
+ ~Subgraph A,B,C~
+ 200 0 rmoveto
+ ~Subgraph D,E,F~
+ grestore
+\end{lstlisting}
+
+The code for the the bottom row (node G) is:
+\begin{lstlisting}[style=syntax]
+ gsave
+ ~Node G~
+ ~Edge from Node C to Node G~
+ ~Edge from Node E to Node G~
+ ~Edge from Node F to Node G~
+ grestore
+\end{lstlisting}
+
+This node is positioned distance $(150,200)$ from the top-left node of subgraph $\{A,B,C,D,E,F\}$, and so the code for the whole graph is
+\begin{lstlisting}[style=syntax]
+ gsave
+ gsave
+ ~Subgraph A,B,C~
+ rmoveto(200,0)
+ ~Subgraph D,E,F~
+ grestore
+ 150 200 rmoveto
+ gsave
+ ~Node G~
+ ~Edge from Node C to Node G~
+ ~Edge from Node E to Node G~
+ ~Edge from Node F to Node G~
+ grestore
+ grestore
+\end{lstlisting}
+
+\section{Language requirements}
+
+I assume that the preprocessing language has operators \verb=BEGINGROUP= and \verb=ENDGROUP= that keep
+changes to variables local to the group, and \verb=GLOBAL= which make the next change global.
+
+There must be enough memory to hold the entire description of the tree in memory, because
+the algorithm constructs the description recursively rather than linearly.
+
+I use the following data types:
+\begin{quote}
+\begin{tabular}{ll}
+ integer & INT\\
+ boolean & BOOL\\
+ string & STRING\\
+ dimension & DIM\\
+ list of strings & LOS\\
+ list of dimensions & LOD
+\end{tabular}
+\end{quote}
+Dimensions might be integers or reals, depending on the implementation. The algorithm only uses integer arithmetic.
+
+\section{Accounting}
+
+As seen in Section~\ref{graphics}, joining subtrees is mainly a problem of finding the
+distance between them. If we simply joined them by inserting a fixed amount of space
+between their bounding boxes (the way \TeX\ builds boxes from boxes) then we would
+only need to know each subtree's bounding box. Instead, for horizontal mode we need
+to keep track of the different sizes of the levels (the profiles). For alignment in
+vertical mode, we also need to know the positions of the extreme nodes in the top and
+bottom levels. For automatic drawing of edges, we need to keep track of the names of
+the nodes at the bottom level (which the top nodes of the next level draw edges to).
+We keep track of a few more items that are used by some of the special features
+described in Section~\ref{bells}.
+
+Here is the list of the tree data. (The distance between nodes refers to the distance between the
+centers of the nodes.) There is some redundancy, because it can be faster to keep track of
+information in the form it is needed rather than extracting it from other information.
+
+
+
+\begin{compactdesc}%{\tt rightprofile}
+ \item[\texttt{treecode}] The graphics description of the tree. (DIM)
+
+ \item[\texttt{width}] The distance from the top-left node to the top-right node. (DIM)
+
+ \item[\texttt{leftprofile}] The horizontal distance from the left edge of the bounding box of each level to the top-left node. (LOD)
+
+ \item[\texttt{rightprofile}] The horizontal distance from the top-right node to the right edge of the bounding box of each level. (LOD)
+
+ \item[\texttt{leftbase}] The horizontal distance from the bottom-left node to the top-left node. (DIM)
+
+ \item[\texttt{rightbase}] The horizontal distance from the top-right node to the bottom-right node. (DIM)
+
+ \item[\texttt{center}] The distance from the top-left node to the center of the top level
+ (for alignment in vertical mode), or \verb=NULL= if the center should be the midpoint
+ between the top-left and the top-right nodes. (DIM)
+
+ \item[\texttt{centerbase}] The distance from the top-left node to the center of the bottom level
+ (for alignment in vertical mode), or \verb=NULL= if the center should be the midpoint between the
+ bottom-left and bottom-right nodes. (DIM)
+
+ \item[\texttt{height}] The vertical distance from the top of the bounding box to the top level. (DIM)
+
+ \item[\texttt{depth}] The vertical distance from the top level to the bottom of the bounding box. (DIM)
+
+ \item[\texttt{leftsize}] The horizontal distance from the left side of the bounding box to the top-left node. (DIM)
+
+ \item[\texttt{rightsize}] The horizontal distance from the top-right node to the right side of the bounding box. (DIM)
+
+ \item[\texttt{rootnodes}] A list of the names of the top-level nodes. (LOS)
+
+ \item[\texttt{basenodes}] A list of the names of the bottom-level nodes. (LOS)
+
+ \item[\texttt{cumlevelsep}] The distance between the first and last levels. (DIM)
+
+ \item[\texttt{numlevels}] The number of levels in the tree. (INT)
+
+ \item[\texttt{levelsizes}] The list of the height and depth of the bounding box of each level, plus,
+ for every level except the last, the vertical distance to the next level.
+\end{compactdesc}
+
+See Figure~\ref{data}.
+
+\begin{figure}
+ \psset{unit=.85}
+ \unitlength\psunit
+ \pspicture(-3,-6)(10.5,1)
+ \def\N(#1,#2)(#3,#4){%
+ \rput(#3,#4){\framebox(#1,#2){\hbox{\qdisk(0,0){2pt}}}}}
+ \N(3,1.5)(0,0)
+ \N(4,2)(5.5,0)
+ \N(3,2)(-1.75,-4)
+ \N(2,1)(2.75,-4)
+ \N(3,1.5)(7.25,-4)
+ \psline[linestyle=dashed,linewidth=.4pt](0,0)(0,-6)
+ \psline[linestyle=dashed,linewidth=.4pt](5.5,0)(5.5,-6)
+ \pcline{|->}(-1.5,-1.2)(0,-1.2)
+ \ncput*{L1}
+ \pcline{|->}(-3.25,-2.6)(0,-2.6)
+ \ncput*{L2}
+ \pcline{->|}(5.5,-1.35)(7.5,-1.35)
+ \ncput*{R1}
+ \pcline{->|}(5.5,-2.8)(8.75,-2.8)
+ \ncput*{R2}
+ \pcline{|->}(-1.75,-5.3)(0,-5.3)
+ \nbput[npos=.3]{\tt leftbase}
+ \pcline{->|}(5.5,-5.2)(7.25,-5.2)
+ \nbput[npos=.7]{\tt rightbase}
+ \pcline[tbarsize=15pt]{|->|}(9.4,0)(9.4,-4)
+ \ncput*{\tt cumlevelsep}
+ \endpspicture
+
+ \vskip .4cm
+
+ \verb|leftprofile = { L1 , L2 }|\\
+ \verb|rightprofile = { R1 , R2 }|
+
+ \vskip .8cm
+
+ \pspicture(-5,-5)(10.5,1.75)
+ \def\N(#1,#2)(#3,#4){%
+ \rput(#3,#4){\framebox(#1,#2){\hbox{\qdisk(0,0){2pt}}}}}
+ \N(3,1.5)(0,0)
+ \N(4,2)(5.5,0)
+ \N(3,2)(-1.75,-4)
+ \N(2,1)(2.75,-4)
+ \N(3,1.5)(7.25,-4)
+ \psframe[linestyle=dashed,linewidth=.4pt](-3.25,-5)(8.75,1)
+ \psset{tbarsize=15pt}
+ \pcline{|->}(-3.25,1.5)(0,1.5)
+ \ncput*{\tt leftsize}
+ \pcline{|->}(0,1.5)(5.5,1.5)
+ \ncput*{\tt width}
+ \pcline{|->|}(5.5,1.5)(8.75,1.5)
+ \ncput*{\tt rightsize}
+ \pcline{|->}(9.4,1)(9.4,0)
+ \naput{\tt height}
+ \pcline{|->|}(9.4,0)(9.4,-5)
+ \naput{\tt depth}
+ \pcline{|->}(-3.75,1)(-3.75,0)
+ \nbput{\tt H1}
+ \pcline{|->|}(-3.75,0)(-3.75,-1)
+ \nbput{\tt D1}
+ \pcline{|->}(-3.75,-3)(-3.75,-4)
+ \nbput{\tt H2}
+ \pcline{|->}(-3.75,-4)(-3.75,-5)
+ \nbput{\tt D2}
+ \pcline{|->|}(-5,0)(-5,-4)
+ \ncput*{\tt levelsep1}
+ \endpspicture
+
+\vskip .4cm
+
+\verb|levelsizes = { H1 , D1 , levelsep1 , H2 , D2 }|
+
+\vskip .6cm
+
+\caption{Tree data}\label{data}
+\end{figure}
+
+\section{Horizontal mode}
+
+ In horizontal mode, the trees are aligned by their toplevels (i.\,e., a tree's baseline is the
+ center of its top level). We add trees to the row one-by-one, updating the description of the row each time.
+
+ A row, while under construction, is itself a tree, and each time we add a tree we update
+ the data for the row. As we construct the graphics description for the row, the current
+ point is left at the top-left node of the last tree. We keep track of the width of the
+ last tree (\verb=Lastwidth=). Each time we add a tree to the row, we face the canonical problem
+ of determining how much space to leave between the top-right node of the row and the
+ top-left node of the next tree.
+
+ To distinguish the tree data variables of the row from those of the next tree to be added
+ to the row, we begin the variable names for the row with capital letters. E.\,g., \verb|Leftprofile|
+ is the leftprofile of the row, and \verb|leftprofile| is the leftprofile of the next tree.
+
+ When adding the first tree object, we have to simply initialize the row's variables:
+\begin{lstlisting}[style=syntax]
+ Treecode = treecode
+ Width = width
+ Lastwidth = width
+ Leftprofile = leftprofile
+ Rightprofile = rightprofile
+ Leftbase = leftbase
+ Rightbase = rightbase
+ Center = center
+ Centerbase = centerbase
+ Height = height
+ Depth = depth
+ Leftsize = leftsize
+ Rightsize = rightsize
+ Rootnodes = rootnodes
+ Basenodes = basenodes
+ Cumlevelsep = cumlevelsep
+ Numlevels = numlevels
+ Levelsizes = levelsizes
+\end{lstlisting}
+
+ For subsequent tree object's, we first find the distance between the top-right node of the
+ current row and the top-left node of the next object, and we assign the result to \verb|sep|.
+ We want the minimum distance between the objects, level-by-level, to be \verb|treesep| (a parameter):
+\begin{lstlisting}[style=syntax]
+ sep = MAX { Rightprofile ++ leftprofile } + treesep
+\end{lstlisting}
+where \verb|++| makes a list by adding two lists item-by-item, up to the length of the shortest list.
+
+
+Now we can add the new tree's code to the row's code:
+\begin{lstlisting}[style=syntax]
+ Treecode = CONCAT
+ {
+ Treecode
+ sep + Lastwidth 0 rmoveto
+ treecode
+ }
+\end{lstlisting}
+
+Then we update the row description. First we set \verb|Width| to the distance from the top-left node of the row to
+the top-left node of the next tree (\verb=Width+sep=) and we set \verb|sep| to the distance from the top-right
+node of the previous tree to the top-right node of the next tree (\verb=sep+width=), because these quantities
+are used in the calculations of the other row variables. At the end, we set \verb|Width| to the actual
+width of the row (\verb|Width+width|).
+\begin{lstlisting}[style=syntax]
+ Width = Width + sep
+ sep = sep + width
+ Lastwidth = width
+ Leftprofile = BIMAX { Leftprofile , leftprofile - Width }
+ Rightprofile = BIMAX { Rightprofile - sep , rightprofile }
+ IF Numlevels < numlevels
+ THEN Leftbase = Leftbase - Width
+ FI
+ Rightbase = IF Numlevels > numlevels
+ THEN Rightbase - sep - width
+ ELSE rightbase
+ FI
+ Height = MAX { Height , height }
+ Depth = MAX { Depth , depth }
+ Leftsize = MAX { Leftsize , leftsize - Width }
+ Rightsize = MAX { Rightsize - sep , rightsize }
+ Rootnodes = CONCAT { Rootnodes , rootnodes }
+ IF center = NULL
+ ELSE Center = center + Width
+ FI
+ IF Numlevels < numlevels OR ( Numlevels = numlevels
+ AND NOT centerbase = NULL )
+ THEN Centerbase = centerbase + Width
+ FI
+ IF Numlevels < numlevels
+ THEN Basenodes = basenodes
+ ELSE IF Numlevels = numlevels
+ THEN Basenodes = CONCAT { Basenodes , basenodes }
+ FI
+ FI
+ Numlevels = MAX { Numlevels , numlevels }
+ Levelsizes = BIMAX { Levelsizes, levelsizes }
+ Width = Width + width
+\end{lstlisting}
+
+The updating that depends on \verb|Numlevels| and \verb|numlevels| can be summarized:
+\begin{lstlisting}[style=syntax]
+ IF Numlevels < numlevels
+ THEN Leftbase = leftbase - Width
+ Centerbase = centerbase + Width
+ Rightbase = rightbase
+ Basenodes = basenodes
+ Cumlevelsep = cumlevelsep
+ ELSE IF Numlevels = numlevels
+ THEN Basenodes = CONCAT { Basenodes , basenodes }
+ Rightbase = rightbase
+ IF centerbase = NULL
+ ELSE Centerbase = centerbase + Width
+ FI
+ ELSE Rightbase = Rightbase - sep
+ FI
+ FI
+\end{lstlisting}
+
+Nodes are treated in the same way. A node is a trivial tree. It is completely described by its nodeleftsize (distance from the center to the left side of the bounding box), noderightsize, nodeheight, nodedepth and name. Here is the value of all the tree object variables in terms of the leftsize, rightsize, height, depth and name:
+\begin{lstlisting}[style=syntax]
+ treecode = {~node~}
+ width = 0
+ leftprofile = {nodeleftsize}
+ rightprofile = {noderightsize}
+ leftbase = 0
+ rightbase = 0
+ center = NULL
+ centerbase = NULL
+ height = nodeheight
+ depth = nodedepth
+ leftsize = nodeleftsize
+ rightsize = noderightsize
+ rootnodes = {name}
+ basenodes = {name}
+ cumlevelsep = 0
+ numlevels = 1
+ levelsizes = {height,depth}
+\end{lstlisting}
+
+\section{Vertical mode}
+
+ Here is the description of vertical mode. We also add rows one at a time, updating the description
+ of the tree each time. Each row is just a tree object, and a partially completed tree is just a
+ tree object. Therefore, the problem of joining rows is just the canonical problem of stacking
+ two tree objects.
+
+ The description variables of the row begin with capital letters, and so we revert to
+ uncapitalized names for the description variables of the tree.
+
+ When adding the first row, we simply have to initialize the tree's variables,
+ setting \verb|treecode=Treecode|, etc.
+
+ To add the subsequent rows, we first have to find the horizontal displacement of the
+ top-left node of the next row from the top-left node of the tree. We chose this
+ displacement so that the \verb|centerbase" of the tree is aligned with the \verb|Center|
+ of the row, as shown in Figure~\ref{center}.
+
+\begin{figure}
+\begin{pspicture}(-2.3,-4)(7,1)
+ \psset{radius=3pt,labelsep=.7cm}
+ \def\biglbrace{$\left\{\vrule height .75cm depth .75cm width 0pt \right.$}
+ \rput[l](-1.9,0){\llap{Tree} \biglbrace}
+ \rput[l](-1.9,-3){\llap{Row} \biglbrace}
+ \Cnode*(0,0){A}
+ \uput[u](0,0){\rnode{AA}{Top-left node}}
+ \ncline[nodesep=3pt]{->}{AA}{A}
+ \Cnode*(6,0){B}
+ \uput[u](6,0){\rnode{C}{Center of base}}
+ \ncline[nodesep=3pt]{->}{C}{B}
+ \ncline{<->}{A}{B}
+ \ncput*{\tt centerbase}
+ \Cnode*(6,-3){D}
+ \uput[d](6,-3){\rnode{DD}{Center of top}}
+ \ncline[nodesep=3pt]{->}{DD}{D}
+ \Cnode*(2,-3){E}
+ \uput[d](2,-3){\rnode{EE}{Top-left node}}
+ \ncline[nodesep=3pt]{->}{EE}{E}
+ \ncline{<->}{D}{E}
+ \ncput*{\tt Center}
+ \pnode(2,-1.5){F}
+ \ncline[linestyle=dashed,dash=2pt 2pt]{E}{F}
+ \pnode(0,-1.5){G}
+ \ncline[linestyle=dashed,dash=2pt 2pt]{A}{G}
+ \ncline{|*-|*}{G}{F}
+ \ncput*{\tt sep}
+\end{pspicture}
+\caption{Aligning rows in vertical mode.}\label{center}
+\end{figure}
+
+ First, calulate \verb=centerbase= and \verb=Center= if these are \verb=NULL=:
+\begin{lstlisting}[style=syntax]
+ IF centerbase = NULL
+ THEN centerbase = ( width + rightbase - leftbase ) / 2
+ FI
+ IF Center = NULL
+ THEN Center = width / 2
+ FI
+\end{lstlisting}
+Then set \verb|sep| to the horizontal distance between the top-left nodes of the tree and row:
+\begin{lstlisting}[style=syntax]
+ sep = centerbase - Centerbase
+\end{lstlisting}
+
+Next we calculate the vertical displacement. Each time we add a row, the current point ends up
+at the top-left node of the last row. We save the \verb=Cumlevelsep= of the last row as \verb=lastcumlevelsep=.
+The distance from the bottom level of the tree and the top level of the next row is the canonical distance
+between levels, \Lkeyword{levelsep}, which is a parameter. Hence, the total displacement is
+\begin{lstlisting}[style=syntax]
+ lastcumlevelsep + levelsep
+\end{lstlisting}
+
+Thus, we add the new row's code to the tree's code with:
+\begin{lstlisting}[style=syntax]
+ treecode = CONCAT {
+ treecode
+ sep lastcumlevelsep+levelsep rmoveto
+ Treecode
+ }
+\end{lstlisting}
+
+Now we have to update the description. At first, \verb|cumlevelsep| is set to the distance from the top level of the tree
+to the top level of the next row (\verb=cumlevelsep + levelsep=) and \verb=rightsep= is set to the horizontal distance
+from the top-right node of the tree to the top-right node of the next row (\verb=sep + Width - width=),
+because these are used when updating the other variables. At the end, \verb=cumlevelsep= is set to the actual
+\verb=cumlevelsep= (\verb=cumlevelsep + Cumlevelsep=).
+
+\begin{lstlisting}[style=syntax]
+ cumlevelsep = cumlevelsep + levelsep
+ lastcumlevelsep = Cumlevelsep
+ rightsep = sep + Width - width
+ leftprofile = CONCAT { leftprofile , Leftprofile - sep }
+ rightprofile = CONCAT {
+ rightprofile ,
+ Rightprofile + rightsep )
+ }
+ leftbase = Leftbase - sep
+ rightbase = Rightbase + rightsep
+ centerbase = IF Centerbase=NULL
+ THEN NULL
+ ELSE Centerbase - sep
+ FI
+ height = MAX { height , Height - cumlevelsep }
+ depth = MAX { depth , Depth + cumlevelsep }
+ leftsize = MAX { leftsize , Leftsize - sep }
+ rightsize = MAX { rightsize , Rightsize + rightsep }
+ rootnodes = rootnodes
+ numlevels = numlevels + Numlevels
+ levelsizes = CONCAT { levelsizes , levelsep , Levelsizes }
+ cumlevelsep = cumlevelsep + Cumlevelsep
+\end{lstlisting}
+
+\section{Bells and whistles\label{bells}}
+
+e also need to keep track of the list of nodes in the tree object, and the coordinates of the nodes.
+We can measure the coordinates relative to the top-left node. Then when we join two tree objects,
+we find the top-left node of the new object, join the lists of nodes, and update the coordinates
+with respect to the top-left node. This is simplified by the fact that once a tree object has been
+formed, the relative position of the nodes within that object does not change when the object is
+nested inside another tree object.
+
+I have so far described the algorithm assuming that the objects in a row are joined from left to
+right, and then the rows are stacked from top to bottom, and I will continue to use this convention
+throughout. However, the algorithm is the same when the tree objects grow in different directions;
+all that differs in \LPack{pst-tvz} is how one joins tree objects. For example, after calculating the
+distance between the top-left nodes of two tree objects, do we position the second object below,
+to the right, above or to the left of the first object?
+
+\LPack{pst-tvz} uses a key=value system for controlling the algorithm. Keys are called {\em parameters}.
+Here are the parameters that control the direction in which the tree is constructed:
+\begin{compactdesc}%{treenodesize}
+ \item[\Lkeyword{treemode}] The \Lkeyword{treemode} is the direction in which trees grow (in which rows are stacked).
+ The value is stored as an integer:
+\begin{lstlisting}[style=syntax]
+ down -> 0
+ right -> 1
+ up -> 2
+ left -> 3
+\end{lstlisting}
+In vertical trees (\Lkeyword{treemode} is even), the rows are horizontal. In horizontal trees
+(\Lkeyword{treemode} is odd), the rows are vertical.
+ \item[\Lkeyword{treeflip}] \Lkeyword{treeflip} is a boolean that sets the direction in which rows are
+ constructed. When \false, the horizontal rows of vertical trees are constructed from left to right
+ (in the order in which objects appear in the input file), and the vertical rows of horizontal trees
+ are constructed from top to bottom. When \true, the rows of vertical trees are constructed from
+ right to left, and the rows of horizontal trees are constructed from bottom to top.
+\end{compactdesc}
+
+For example:
+\begin{LTXexample}[width=5cm,pos=l]
+ \psTree[treemode=R,treeflip=true,nodesep=3pt]
+ \Tc{3pt} \\
+ \Tr{First} \Tr{Second} \Tr{Third}
+ \endpsTree
+\end{LTXexample}
+
+There are several methods for setting this distance.
+
+ If the "treesep*" parameter has been set, then
+\begin{lstlisting}[style=syntax]
+ sep = treesep*
+\end{lstlisting}
+That is, the spacing between the centers of the nodes (and hence between edges) is fixed.
+
+Otherwise, if the \Lkeyword{treefit} parameter equals \Lkeyval{tight},
+
+If instead \Lkeyset{treefit=loose}, the distance between the tree objects' bounding boxes be \Lkeyword{treesep}. I.\,e.,
+\begin{lstlisting}[style=syntax]
+ sep = MAX { Rightprofile } + MAX { leftprofile } + treesep
+\end{lstlisting}
+
+In summary:
+\begin{lstlisting}[style=syntax]
+ sep = IF treesep* = NULL
+ THEN IF treefit = tight
+ THEN MAX { Rightprofile ++ leftprofile } + treesep'
+ ELSE MAX { Rightprofile } + MAX { leftprofile } + treesep
+ FI
+ ELSE treesep*
+ FI
+\end{lstlisting}
+
+If both objects have more than one level, then increase \verb=sep= by \Lkeyword{xtreesep}:
+\begin{lstlisting}[style=syntax]
+ IF Numlevels > 1
+ THEN IF numlevels > 1
+ THEN ADVANCE sep BY xtreesep
+ FI
+ FI
+\end{lstlisting}
+Positive values of \Lkeyword{xtreesep} can be used to highlight the structure of the trees.
+
+Finally, if the user inserts
+\begin{lstlisting}[style=syntax]
+ \addtreesep{~dim~}
+\end{lstlisting}
+before a tree object, then ~dim~ is saved in the \verb=addtreesep= variable, and we add this to \verb=sep=:
+\begin{lstlisting}[style=syntax]
+ IF addtreesep = NULL
+ ELSE ADVANCE sep BY addtreesep
+ FI
+\end{lstlisting}
+
+\begin{lstlisting}[style=syntax]
+ Treecode = CONCAT {
+ Treecode ,
+ IFODD Treemode
+ THEN IF Treeflip=TRUE
+ THEN 0 sep rmoveto
+ ELSE 0 -sep rmoveto
+ FI
+ ELSE IF Treeflip=TRUE
+ THEN -sep 0 rmoveto
+ ELSE sep 0 rmoveto
+ FI
+ FI
+ ,
+ treecode
+ }
+\end{lstlisting}
+
+A node calculates its leftsize, rightsize, height, depth and name, and then invokes
+\verb=\node@makecanonical@tree=, which does the assignment given above.
+
+The assignment actually depends on the orientation of the row, because the node calculates its
+dimensions for an upright orientation. That is, the assignment given above is correct if the row
+is part of a horizontal tree that grows down and if the row adds objects from left to right.
+
+Here is the general assignment of leftprofile, rightprofile, height and depth:
+\begin{lstlisting}[style=syntax]
+ height = IFCASE Treemode
+ nodeheight
+ OR leftsize
+ OR nodedepth
+ OR rightsize
+ FI
+ depth = IFCASE Treemode
+ nodedepth
+ OR rightsize
+ OR nodeheight
+ OR leftsize
+ FI
+ leftsize = IFODD Treemode
+ THEN IF Treeflip=TRUE
+ THEN nodedepth
+ ELSE nodeheight
+ FI
+ ELSE IF Treeflip=TRUE
+ THEN rightsize
+ ELSE leftsize
+ FI
+ FI
+ rightsize = IFODD Treemode
+ THEN IF Treeflip=TRUE
+ THEN nodeheight
+ ELSE nodedepth
+ FI
+ ELSE IF Treeflip=TRUE
+ THEN leftsize
+ ELSE rightsize
+ FI
+ FI
+ leftprofile = { leftsize, }
+ rightprofile = { rightsize, }
+\end{lstlisting}
+
+However, if the \Lkeyword{treenodesize} is set, then the profile are set using this value as half the ``width'' of the node. That is:
+\begin{lstlisting}[style=syntax]
+ IF treenodesize = NULL
+ THEN leftprofile = { leftsize, }
+ rightprofile = { rightsize, }
+ ELSE leftprofile = { treenodesize, }
+ rightprofile = leftprofile
+ FI
+\end{lstlisting}
+
+Tree objects whose orientation is different from the row are given special treatment. If the object
+has the same direction, but a different flip, then we simply swap the left and right profiles, and related items:
+\begin{lstlisting}[style=syntax]
+ IF Treemode = treemode
+ THEN IF Treeflip = treeflip
+ ELSE temp = leftprofile
+ leftprofile = rightprofile
+ rightprofile = temp
+ temp = leftbase
+ leftbase = rightbase
+ rightbase = temp
+ temp = leftsize
+ leftsize = rightsize
+ rightsize = temp
+ center = IF center = NULL
+ THEN NULL
+ ELSE width - center
+ FI
+ centerbase = IF centerbase = NULL
+ THEN NULL
+ ELSE width - centerbase
+ FI
+ FI
+ FI
+\end{lstlisting}
+
+If the tree objects has a different direction, then we treat the object like a node, centered at the center of its top level
+\begin{lstlisting}[style=syntax]
+ IF Treemode = treemode
+ ELSE tree@makecanonical@node
+ node@makecanonical@tree
+ FI
+\end{lstlisting}
+
+Here is the definition of \verb=tree@makecanonical@node=:
+
+\begin{lstlisting}[style=syntax]
+ IF center = NULL
+ THEN center = width / 2
+ FI
+ IF center = 0
+ ELSE SETBOX box =
+ IFODD treemode
+ THEN VBOX TO 0 BEGINBOX VSS
+ ELSE HBOX TO 0 BEGINBOX HSS
+ FI
+ BOX box
+ KERN IF Treeflip = TRUE THEN - FI center
+ ENDBOX
+ FI
+ IF treeflip = TRUE
+ THEN tempa = rightsize + width - center
+ tempb = leftsize + center
+ ELSE tempa = leftsize + center
+ tempb = rightsize + width - center
+ FI
+ IFODD treemode
+ THEN nodeheight = tempa
+ nodedepth = tempb
+ ELSE leftsize = tempa
+ rightsize = tempb
+ FI
+ IFCASE treemode
+ nodeheight = height
+ nodedepth = depth
+ OR leftsize = height
+ rightsize = depth
+ OR nodeheight = depth
+ nodedepth = height
+ OR leftsize = depth
+ rightsize = height
+ FI
+\end{lstlisting}
+
+We increase "sep" by \Lkeyword{treeshift}:
+\begin{lstlisting}[style=syntax]
+ ADVANCE sep BY treeshift
+\end{lstlisting}
+
+Now we insert \Lkeyword{levelsep} between the trees, move the row by \verb=sep=, and add an extra space of
+\verb=Cumlevelsep= so that the total size of the the tree is the same as \verb=cumlevelsep=. With vertical
+trees we do this in a \Lcs{vtop} and in horizontal trees we do this in an \Lcs{hbox}. I.\,e.,
+\begin{lstlisting}[style=syntax]
+ IFODD treemode
+ THEN HBOX
+ {
+ UNHBOX box
+ IF treeflip = TRUE
+ THEN KERN - levelsep
+ LOWER sep BOX hbox
+ KERN - Cumlevelsep
+ ELSE KERN levelsep
+ RAISE sep BOX hbox
+ KERN Cumlevelsep
+ FI
+ }
+ ELSE VTOP
+ {
+ UNVBOX box
+ IF treeflip = TRUE
+ THEN KERN - levelsep
+ MOVELEFT sep BOX hbox
+ KERN - Cumlevelsep
+ ELSE KERN levelsep
+ MOVERIGHT sep BOX hbox
+ KERN Cumlevelsep
+ FI
+ }
+ FI
+\end{lstlisting}
+
+
+\section{The PSTricks implementation}
+
+In \LPack{pst-tvz}, we can let \TeX\ keep track of nodes and node coordinates internally. We store each
+tree object in a \TeX\ box with zero size, such that the current point is at the center of the top
+left node. We create a new tree object in a \TeX\ box, inserting space between the component objects.
+
+With \TeX, we construct the row for both vertical and horizontal trees using an \Lcs{hbox}. In an \Lcs{hbox},
+we can insert horizontal space to separate tree objects in a horizontal row, and we can lower or raise
+objects below or above to baseline to separate tree objects in a vertical row. For horizontal rows
+(vertical trees), the current insertion point is thus at the top-left node of the last object, and
+so we also need to know the width of this object. This value is stored in \verb=wsep= after adding a tree
+object, and then \verb=wsep= is set to the total distance between the top-left node of the last object and
+the top-left node of the current object. In vertical rows (horizontal trees). the current insertion
+point is at the top-left node of the row, and so we also need to know the width of the current row,
+but this is already stored in \verb=Width=. We set \verb=wsep= to the total distance between the top-left node
+of the row and the top-left node of the new object.
+
+\begin{lstlisting}[style=syntax]
+ IFODD treemode
+ THEN wsep = Width + sep
+ ELSE wsep = wsep + sep
+ FI
+\end{lstlisting}
+
+We add the space and the tree object
+\begin{lstlisting}[style=syntax]
+ IFODD treemode
+ THEN LOWER wsep
+ ELSE KERN wsep
+ FI
+ BOX box
+\end{lstlisting}
+and update the row description:
+
+\section{Examples}
+
+Here is how this information is used to position the successors. First, all terminal nodes
+are treated as single-level trees. Thus, the canonical successor is a subtree (that has the
+same orientation as the parent tree). The successors are positioned so that their centers
+line up horizontally. How the distance between successors is calculate depends on the
+values of two parameters:
+
+\begin{compactitem}
+ \item When "treefit=tight", the subtrees are positioned so that the minimum distance
+ between levels is "treesep". This is calculated by adding the right profile of the
+ current group of successors (this profile is with respect to the center of the
+ right-most successor) to the left profile of the new successor item by item, finding
+ the maximum of the resulting list, and then adding "treesep".
+
+\item When \Lkeyset{treefit=loose}, the subtrees are positioned so that the distance between their bounding
+boxes is \Lkeyword{treesep}.
+
+\item When also \Lkeyword{treenodesize} is non-negative, the top level of each subtrees is given a width of <dim>,
+{\em for the purpose of fitting the subtrees together}.
+\end{compactitem}
+
+After the row of successors is constructed, and its profiles, height and depth are calculated, the root object is
+positioned above the row of successors so that the center of the root object is centered between the centers of
+the first and last successors (although this can be modified). The distance between the root object and the row
+of successors is \Lkeyword{levelsep}. The profiles, height and depth of the resulting tree are calculated
+from the dimensions of the root object and the dimensions of the row of successors.
+
+The \Lkeyword{treemode} parameter determines the direction in which the tree grows, and the \Lkeyword{treeflip} parameter determines
+the direction in which successors are added. The values of these parameters together are called the tree's
+orientation. The terminology used above is for trees with the default orientation: \Lkeyset{treemode=D} and \nxLkeyword{treeflip=false}
+(the tree grows down and successors are added from left to right).
+However, the logical structure of a tree does not depend on its orientation, and so we can use the
+same terminology and accounting system for all trees. Here is the correspondence between
+
+\begin{compactitem}
+\item For a vertical tree that grows up, successors are also added from left to right, and so the profiles
+are as described above (although ``top'' levels are physically at the bottom of the tree). The ``height'' and
+``depth'' of tree is the distance from the center to the physical bottom and top, respectively, of the bounding box.
+\item For a horizontal tree, successors are added from top to bottom. The ``left'' profiles are the physical
+top profiles, and the ``right'' profiles are the physical bottom profiles. The ``height'' and ``depth''
+of a horizontal tree that grows to the right are the distances from the center of the tree to the left
+and right sides, respectively, of its bounding box. The opposite holds if the tree grows to the left.
+\item If \nxLkeyword{treeflip=true}, then successors are added in the opposite direction, and so the left and
+right profiles are switched. ``Right'' always refers to the direction in which new successors are added.
+\end{compactitem}
+
+A root node can actually be a subtree, and a subtree can have a different orientation from its parent.
+Here is how we deal with these special cases:
+
+The canonical root object is a node. Trees are converted to this canonical root object by calculating
+their bounding box, and thereby determining their height, width, left and right sizes.
+
+The canonical successor is a subtree that has the same orientation as the parent tree. Nodes and trees
+that grow in other directions are converted to this canonical succcessor by treating them as single level
+trees. That is, the left profile is just the left size of the node or tree (with respect to the orientation
+of the parent tree), and the right profile is the right size of the node or tree.
+
+In addition to being a root or successor of a tree, a tree object can be unnested, or ``outer''.
+The canonical outer object is a node, and it is made into a box whose dimensions are the size of the node.
+Trees are converted to this canonical outer. Hence, when a tree is outer, we only need to remember store its
+bounding box, and can forget about its profile.
+
+A subtree that grows in the same direction (which is weaker than having the same orientation) is called a {\em proper}
+subtree. All other trees---outer, root, or subtrees that change directions---are not proper.
+
+The three places a tree object can be found---root, successor or outer---are called {\em modes}. By an unfortunate
+historical accident, the directions trees grow---down, up, right and left---are also called modes. However,
+this should not cause confusion in the code.
+
+The programming implementation of this algorithm is modular. Tree objects, which are either nodes or (sub)trees,
+save their dimensions in designated registers and commands. Then they invoke
+
+\begin{lstlisting}[style=syntax]
+ \ps<object_type>@makecanonical
+\end{lstlisting}
+<object\_type> is \verb=node= or \verb=tree=. This translates the object's dimensions into dimensions
+of a canonical object for the current mode. Then the object invokes
+
+\begin{lstlisting}[style=syntax]
+ \ptr@build
+\end{lstlisting}
+
+which positions the box (\Lcs{ptr@box}) containing the object, also depending on the current mode.
+
+Here are the registers and commands that a tree object must set before invoking \nxLcs{ps<object\_type>@makecanonical} and
+\nxLcs{ps<object\_type>@build}:
+
+\begin{compactdesc}
+\item[Nodes] These are all dimension registers, and should not be set globally.\label{nodesizes}
+\begin{center}
+\begin{tabular}{ll}
+ \Ldim{pst@dima} & left size\\
+ \Ldim{pst@dimb} & right size\\
+ \Ldim{pst@dimc} & height\\
+ \Ldim{pst@dimd} & depth
+\end{tabular}
+\end{center}
+
+\item[Trees]
+\Lcs{PTR@height} and \Lcs{PTR@depth} are count registers, measuring sp units. The others are lists. These are
+set globally, so that a tree can use these commands and registers while it is being constructed. However,
+changes are actually kept local with respect to the structure of trees because he values in effect when
+the tree is started are restored at the end of the tree.
+\begin{center}
+\begin{tabular}{ll}
+ \Ldim{PTR@height} & height\\
+ \Ldim{PTR@depth} & depth\\
+ \Lcs{PTR@leftprofile} & left profile\\
+ \Lcs{PTR@rightprofile} & right profile\\
+ \Lcs{PTR@levelsizes} & level size
+\end{tabular}{ll}
+\end{center}
+\end{compactdesc}
+
+The \nxLcs{ps<object\_type>@makecanonical} commands translate the values stored in the commands and
+registers listed above, and assign the results to the following commands and registers, for use
+by \nxLcs{ps<object\_type>@build}:
+\begin{compactdesc}
+\item[Outer mode]
+ Outer objects use \Ldim{pst@dima}, \Ldim{pst@dimb}, \Ldim{pst@dimc} and \Ldim{pst@dimd}, like nodes. These dimensions
+ refer to the physical dimensions. I.e., they do not depend on the orientation of the object.
+
+\item[Root mode]
+These are all commands.
+\begin{tabular}{ll}
+ \Ldim{psroot@leftsize} & left size\\
+ \Ldim{psroot@rightsize} & right size\\
+ \Ldim{psroot@height} & height\\
+ \Ldim{psroot@depth} & depth
+\end{tabular}
+
+\item[Successor objects]
+\Ldim{ptr@height} and \Ldim{ptr@depth} are counters, and the remaining are lists.
+\begin{center}
+\begin{tabular}{ll}
+ \Ldim{ptr@height} & height\\
+ \Ldim{ptr@depth} & depth\\
+ \Lcs{ptr@leftprofile} & left profile\\
+ \Lcs{ptr@rightprofile} & right profile\\
+ \Lcs{ptr@levelsizes} & level size
+\end{tabular}{ll}
+\end{center}
+
+\end{compactdesc}
+
+Except for \Ldim{pst@dima}, etc., used for the dimensions of nodes, root and outer objects, all values are stored
+as integers, giving the distance in sp units. Much of the accounting is done using counters and sp units,
+because this is more efficient and because counters are not quite as scarce as dimension registers.
+
+When a subtree is made canonical, we need to know the orientation of both the subtree and the parent tree.
+We use \Lcs{psk@Treemode} and \Lcs{if@Treeflip} to keep track of the orientation of the parent tree. These are set
+by the parent tree when it begins to process the row of successors. This information is not needed by root objects.
+
+When the value of the \Lkeyword{levelsep} parameter is preceded by \verb=*=, the size of the levels is taken into account
+when setting the distance between levels. This information is only known after the tree has been constructed,
+because levels extend beyond the recursive structure of the trees. That is, the distance between levels of one
+subtree will depend on the distance be levels of other (disjoint) subtrees. Therefore, we write this information
+to an auxilary file, to be read the next time the main input file is processed. Each level in a tree must have
+a unique identifier, so that a subtree can find the distance between levels by looking up the value for its
+tree and level. The count register \Lcs{ptr@ID} is used to indentify trees, and the count register \Lcs{ptr@levelID}
+is used to identify the levels in a tree.
+
+The logical compenents of a tree do not coincide with the physical components when subtree appears as a root
+tree, or as a successor to a parent with a distinct orientation. E.\,g., there is no point in trying to synchronize
+the distance between levels of two subtrees that grow in different directions. Hence, in each of these cases,
+the \Lcs{ptr@ID} is advanced so that for the purpose of determining the distance between levels, the subtree has a
+different indentifier from its parents. For a subtree that appears as a successor, the identifier should be
+changed when \Lcs{psk@treemode} does not equal \Lcs{psk@Treemode}. So that this test works in outer and root mode, the
+\Lcs{psk@treemode} is set to $-1$ in these modes (the \Lkeyword{treemode} is saved as 0, 1, 2 or 3).
+
+Because the value of \Lcs{ptr@ID} can change globally within a tree, a tree's identifier is saved as \Lcs{ptr@id}
+immediately after \Lcs{ptr@ID} is incremented. \Lcs{ptr@id} is an ordinary command.
+
+In addition to not relying on \TeX\ boxes to do all the accounting, we cannot rely on \TeX\ grouping to do
+keep values of certain commands and registers local. This is because the successors, which are in their own
+\TeX\ group, must communicate information to the parent tree as it constructs the row of successors (e.\,g.,
+by modifying the parent tree's \Lcs{PTR@height}). We get around this by saving and restoring the values of
+certain commands and paramters just before and after processing the row of sucessors.
+
+There are some special features whose implementation is incorporated into the \verb=makecanonical= and \verb=build=
+commands, for efficiency:
+\begin{compactdesc}
+\item[Adjust bounding boxes]
+ Bounding boxes are only adjusted for nodes or for a tree that is an outer or root object or that changes
+ directions. Such trees are first made into nodes, via \Lcs{ptr@makecanonical@outer}, and it is at the end of
+ this command that bounding box adjustment is invoked. The bounding box adjustment is invoked by nodes just
+ before \Lcs{psnode@makecanonical}.
+
+\item[Show bounding boxes]
+ The show bounding box commands are invoked as follows:
+ \begin{compactitem}
+ \item For nodes, just after the bounding box adjustment.
+ \item For trees that invoke \Lcs{ptr@makecanonical@outer}, just after the bounding box adjustment.
+ \item For subtrees that have the same \Lkeyword{treemode} as their parent, at the beginning
+ of the \Lcs{ptr@makecanonical@succ} command.
+ \end{compactitem}
+
+\item[Skip levels]
+ The commands for finding the amount of space to be skipped and the profiles of the skipped levels are invoked
+ at the beginning of the tree macros, or in \Lcs{psnode@makecanonical@succ}. The adjustment of the box and profiles
+ takes place in \Lcs{ptr@build@succ}.
+\end{compactdesc}
+
+
+
+\clearpage
+\section{List of all optional arguments for \texttt{pst-thick}}
+
+\xkvview{family=pst-tvz,columns={key,type,default}}
+
+\nocite{*}
+\bgroup
+\RaggedRight
+\bibliographystyle{plain}
+\bibliography{pst-tvz-doc}
+\egroup
+
+\printindex
+
+\end{document}
+
+
+
+
+
diff --git a/Master/texmf-dist/source/generic/pst-tvz/Makefile b/Master/texmf-dist/source/generic/pst-tvz/Makefile
new file mode 100644
index 00000000000..73dba2cc47e
--- /dev/null
+++ b/Master/texmf-dist/source/generic/pst-tvz/Makefile
@@ -0,0 +1,71 @@
+
+# `Makefile' for `pst-tree.pdf', hv, 2008/12/11
+
+.SUFFIXES : .tex .ltx .dvi .ps .pdf .eps
+
+PACKAGE = pst-tvz
+
+MAIN = $(PACKAGE)-doc
+
+LATEX = latex
+
+ARCHNAME = $(MAIN)-$(shell date +%y%m%d)
+
+ARCHFILES = $(PACKAGE).sty $(PACKAGE).tex $(PACKAGE).pro $(MAIN).tex README Changes Makefile
+
+TDS = ~/PSTricks/PSTricks-TDS
+
+all : doc clean tds
+# clean
+doc: $(MAIN).pdf
+
+$(MAIN).pdf : $(MAIN).ps
+ GS_OPTIONS=-dAutoRotatePages=/None ps2pdf $<
+
+$(MAIN).ps : $(MAIN).dvi
+ dvips $<
+
+$(MAIN).dvi : $(MAIN).tex
+ $(LATEX) $<
+ $(LATEX) $<
+ if ! test -f $(basename $<).glo ; then touch $(basename $<).glo; fi
+ if ! test -f $(basename $<).idx ; then touch $(basename $<).idx; fi
+ makeindex -s gglo.ist -t $(basename $<).glg -o $(basename $<).gls \
+ $(basename $<).glo
+ makeindex -s pst-doc.ist -t $(basename $<).ilg -o $(basename $<).ind \
+ $(basename $<).idx
+ bibtex $(basename $<)
+ $(LATEX) $<
+ $(LATEX) $<
+
+clean :
+ $(RM) $(addprefix $(MAIN), .log .aux .glg .glo .gls .ilg .idx .ind .tmp .toc .out )
+ $(RM) $(addprefix $(MAIN), .dvi .ps .blg .bbl)
+
+veryclean : clean
+ $(RM) $(addprefix $(MAIN), .pdf .bbl .blg)
+
+arch :
+ zip $(ARCHNAME).zip $(ARCHFILES)
+
+tds:
+ cp -u Changes $(TDS)/doc/generic/$(PACKAGE)/
+ cp -u README $(TDS)/doc/generic/$(PACKAGE)/
+ cp -u $(MAIN).pdf $(TDS)/doc/generic/$(PACKAGE)/
+#
+ cp -u Changes $(TDS)/tex/latex/$(PACKAGE)/
+ cp -u $(PACKAGE).sty $(TDS)/tex/latex/$(PACKAGE)/
+#
+ cp -u Changes $(TDS)/tex/generic/$(PACKAGE)/
+ cp -u $(PACKAGE).tex $(TDS)/tex/generic/$(PACKAGE)/
+#
+# cp -u Changes $(TDS)/dvips/$(PACKAGE)/
+# cp -u $(PACKAGE).pro $(TDS)/dvips/$(PACKAGE)/
+#
+ cp -u Changes $(TDS)/source/$(PACKAGE)/
+ cp -u $(MAIN).tex $(TDS)/source/$(PACKAGE)/
+ cp -u $(MAIN).bib $(TDS)/source/$(PACKAGE)/
+ cp -u Makefile $(TDS)/source/$(PACKAGE)/
+
+
+# EOF
diff --git a/Master/texmf-dist/tex/generic/pst-tvz/pst-tvz.tex b/Master/texmf-dist/tex/generic/pst-tvz/pst-tvz.tex
new file mode 100644
index 00000000000..3f7aca9da7d
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pst-tvz/pst-tvz.tex
@@ -0,0 +1,2308 @@
+%% $Id: pst-tvz.tex 409 2010-10-30 18:31:11Z herbert $
+%% COPYRIGHT 1993-2011 by Timothy Van Zandt <tvz@Princeton.EDU>
+%
+% This work may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either version 1.3
+% of this license or (at your option) any later version.
+% The latest version of this license is in
+% http://www.latex-project.org/lppl.txt
+% and version 1.3 or later is part of all distributions of LaTeX
+% version 2003/12/01 or later.
+%
+% This work consists of the file pstricks.tex, PostScript macros
+% for Generic TeX.
+% See the PSTricks User's Guide for description.
+%
+%
+%%
+%
+% **************************************************************************
+% This is `pstree.doc'. Use as is or create a stripped input file
+% with pst-make.tex. See the PSTricks read-me file for details.
+% **************************************************************************
+%
+% \EndDocPreamble
+%
+% \CharacterTable
+% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
+% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
+% Digits \0\1\2\3\4\5\6\7\8\9
+% Exclamation \! Double quote \" Hash (number) \#
+% Dollar \$ Percent \% Ampersand \&
+% Acute accent \' Left paren \( Right paren \)
+% Asterisk \* Plus \+ Comma \,
+% Minus \- Point \. Solidus \/
+% Colon \: Semicolon \; Less than \<
+% Equals \= Greater than \> Question mark \?
+% Commercial at \@ Left bracket \[ Backslash \\
+% Right bracket \] Circumflex \^ Underscore \_
+% Grave accent \` Left brace \{ Vertical bar \|
+% Right brace \} Tilde \~}
+%
+%
+% \part{pstree.doc}
+%
+% \section{Overview}
+%
+% An extensive description of these macros is contained in a separate file: ????
+%
+% \section{Preliminaries}
+%
+% Start with the usual stuff:
+% \begin{macrocode}
+\csname PStvzLoaded\endcsname
+\let\PStvzLoaded\endinput
+\ifx\PSTnodesLoaded\endinput\else\input pst-node.tex\fi
+\ifx\PSTXKeyLoaded\endinput \else\input pst-xkey \fi
+%
+\def\fileversion{1.00}
+\def\filedate{2010/10/28}
+\message{ v\fileversion, \filedate (tvz,dg,hv)}
+\message{ v\fileversion, \filedate}
+\edef\TheAtCode{\the\catcode`\@}
+\catcode`\@=11
+%
+\pst@addfams{pst-tvz}
+% \end{macrocode}
+%
+% \section{Profile/list operators}
+%
+% The lists are stored in command sequences, as comma separated lists of integers. This section contains various list operators. Most are optimized for singleton lists.
+%
+% \begin{macro}{\pstree@poptop,\pstree@gettop,\pstree@poptop}
+% If <cmd> is a list, then "\pstree@puttop{<int>}<cmd>" expands to the list, with the first item replaced by <int>, and "\pstree@gettop<cmd>" expands to the first item in the list. "\pstree@poptop<cmd><cnt>" removes the first item from the list and assigns it to <cnt>, and the adds a 0 at the end of the list (so that the list does not change size, and in particular, will never be exhausted).
+% \begin{LVerbatim}
+% \begin{macrocode}
+\def\pstree@puttop#1{#1,\expandafter\pstree@@puttop}
+\def\pstree@@puttop#1,{}
+\def\pstree@gettop#1{\expandafter\pstree@@gettop#1\@nil}
+\def\pstree@@gettop#1,#2\@nil{#1}
+\def\pstree@poptop#1#2{\expandafter\pstree@@poptop#1\relax#1#2}
+\def\pstree@@poptop#1,#2\relax#3#4{%
+ #4=#1\relax
+ \def#3{#20,}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\pstree@max}
+% "\pstree@max{<profile>}{<cnt>}" assigns the maximum value in <profile> to <cnt>.
+% \begin{macrocode}
+\def\pstree@max#1#2{%
+ \pst@cntg=\z@
+ \expandafter\pstree@@max#1\relax
+ #2=\pst@cntg}%
+\def\pstree@@max#1,#2{%
+ \ifnum#1>\pst@cntg \pst@cntg=#1 \fi
+ \ifx\relax#2\else
+ \expandafter\pstree@@max
+ \fi
+ #2}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\pstree@add}
+% "\pstree@add{<int>}{<profile>}" adds <int> to each element of <profile>.
+% \begin{macrocode}
+\def\pstree@add#1#2{%
+ \def\pst@tempg{}%
+ \pst@cnth=#1\relax
+ \expandafter\pstree@@add#2\relax
+ \let#2\pst@tempg}
+\def\pstree@@add#1,#2{%
+ \pst@cntg=#1
+ \advance\pst@cntg\pst@cnth
+ \xdef\pst@tempg{\pst@tempg\the\pst@cntg,}%
+ \ifx\relax#2\else
+ \expandafter\pstree@@add
+ \fi
+ #2}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\pstree@tightfit,\pstree@loosefit}
+% \begin{LVerbatin}
+% \pstree@tightfit{<profile1>}{<profile2>}{<cnt>}
+% \pstree@loosefit{<profile1>}{<profile2>}{<cnt>}
+% \end{LVerbatim}
+% finds the distance between two successors. The inner profiles are <profile1> and <profile2>. The result is assigned to "\pst@cnth". "\pstree@loosefit" finds the distance between the bounding boxes. "\pstree@tightfit" finds the maximum distance level-by-level. I.e., "\pstree@tightfit" finds the maximum of the vector sum of the two lists, up to the end of the shortest list. "\pstree@loosefit" always returns a higher value that "\pstree@tightfit".
+% \begin{macrocode}
+\def\pstree@tightfit#1#2#3{%
+ \pst@cnth=\z@
+ \let\pstree@xtightfit\pstree@@xtightfit
+ \edef\next{\noexpand\pstree@@tightfit#1\relax#2\relax}%
+ \next
+ #3=\pst@cnth}
+
+\def\pstree@@tightfit#1,#2\relax#3,#4\relax{%
+ \pst@cntg=#1
+ \advance\pst@cntg#3
+ \pstree@xtightfit
+ \ifnum\pst@cntg>\pst@cnth
+ \pst@cnth=\pst@cntg
+ \fi
+ \let\next\relax
+ \ifx\relax#2\relax\else
+ \ifx\relax#4\relax\else
+ \def\next{\pstree@@tightfit#2\relax#4\relax}%
+ \fi
+ \fi
+ \next}
+\def\pstree@@xtightfit{%
+ \ifnum\psk@thisxtreesep=\z@
+ \let\pstree@xtightfit\relax
+ \else
+ \edef\pstree@xtightfit{\advance\pst@cntg\psk@thisxtreesep\relax}%
+ \fi}
+\def\pstree@loosefit#1#2#3{%
+ \pstree@max#1\pst@cnth
+ \pstree@max#2#3%
+ \advance#3\pst@cnth
+ \ifnum\psk@thisxtreesep=\z@\else\pstree@xloosefit#1#2#3\fi}
+\def\pstree@xloosefit#1#2#3{%
+ \let\next\relax%%%%%%%%%%%%%% hv 20101029
+ \edef\next{\noexpand\pstree@@xloosefit#3\relax#1\relax#2\relax}%
+ \next}
+\def\pstree@@xloosefit#1\relax#2,#3\relax#4,#5\relax{%
+ \ifx\relax#3\relax\else
+ \ifx\relax#5\relax\else\advance#1\psk@thisxtreesep\relax\fi
+ \fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\pstree@zip}
+% \begin{LVerbatim}
+% \pstree@zip{<int>}{<profile1>}{<profile2>}{<profile3>}
+% \end{LVerbatim}
+% "\pstree@zip" subtracts <int> from <profile1>, and then sets <profile3> to the item-by-item maximum of the resulting <profile1> and <profile2>.
+%
+% E.g., if <profile1> is the current right profile in the row of sucessors, and <profile2> is the right profile of the next successor, which is positioned <int> "sp" units from the previous successor, then "<profile3>" is set to the new outer profile of the row of successors.
+%
+% If <profile1> is the current left profile of the row of successors, and <profile2> is the left profile of the next successor, which is a total of <int> "sp" units from the first successor, then "<profile3>" is the new left profile of the row.
+% \begin{macrocode}
+\def\pstree@zip#1#2#3#4{%
+ \pst@cnth=#1\relax
+ \pst@cnth=-\pst@cnth
+ \def\pst@tempg{}%
+ \edef\next{\noexpand\pstree@@zip#2\relax#3\relax}%
+ \next
+ \global\let#4\pst@tempg}
+\def\pstree@@zip#1,#2\relax#3,#4\relax{%
+ \pst@cntg=#1
+ \advance\pst@cntg\pst@cnth
+ \edef\pst@tempg{\pst@tempg\ifnum#3>\pst@cntg#3\else\the\pst@cntg\fi,}%
+ \let\next\relax %%%%%%%%%%%%%%%%%%%%%%%% hv
+ \ifx\relax#2\relax
+ \edef\pst@tempg{\pst@tempg#4}%
+ \else
+ \ifx\relax#4\relax
+ \def\next{\pstree@@add#2\relax}%
+ \else
+ \def\next{\pstree@@zip#2\relax#4\relax}%
+ \fi
+ \fi
+ \next}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\pstree@bimax}
+% "\pstree@max{<profile1>}{<profile2>}" sets <profile1> to the maximum, item by item, of <profile1> and <profile2>.
+% \begin{macrocode}
+\def\pstree@bimax#1#2{%
+ \def\pst@tempg{}%
+ \edef\next{\noexpand\pstree@@bimax#1\relax#2\relax}%
+ \next
+ \global\let#1\pst@tempg}
+\def\pstree@@bimax#1,#2\relax#3,#4\relax{%
+ \edef\pst@tempg{\pst@tempg\ifnum#1>#3 #1\else#3\fi,}%
+ \let\next\relax%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% hv
+ \ifx\relax#2\relax
+ \edef\pst@tempg{\pst@tempg#4}%
+ \else
+ \ifx\relax#4\relax
+ \edef\pst@tempg{\pst@tempg#2}%
+ \let\next\relax
+ \else
+ \def\next{\pstree@@bimax#2\relax#4\relax}%
+ \fi
+ \fi
+ \next}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\pstree@set}
+% "\pstree@set{<int>}{<profile>}" sets each element of <profile> to <int>.
+% \begin{macrocode}
+\def\pstree@set#1#2{%
+ \pst@cntg=#1\relax
+ \edef#2{\expandafter\pstree@@set#2\relax}}
+\def\pstree@@set#1,#2{%
+ \the\pst@cntg,\ifx\relax#2\else\expandafter\pstree@@set\fi#2}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \section{Counters and boxes}
+%
+% \begin{macro}{\pstree@ID,\pstree@succID,\pstree@levelID}
+% "\pstree@ID" is used for identifying trees, for the purpose of syncronizing the distance between levels for all subtrees of the same tree. It is only used when the "levelsep" parameter value is preceded by "*", and the distance between levels must take into account the size of the objects. "\pstree@levelID" is the number of the level (0, 1, $\ldots$). "\pstree@succID" is the number of the successor (1, 2, $\ldots). "\pstree@nodeID" is the serial number of the node, used for node names.
+% \begin{macrocode}
+\newcount\pstree@ID
+\newcount\pstree@levelID
+\newcount\pstree@succID
+\newcount\pstree@nodeID
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\psTREE@sep,\psTREE@width}
+% These are used while constructing the row of successors. "\psTREE@sep" measures the distance between the previous and next successor. "\psTREE@width" measures is the distance between the center of the first and the center of the last successor.
+% \begin{macrocode}
+\newcount\psTREE@sep
+\newcount\psTREE@width
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\psTREE@height,\psTREE@depth,\pstree@height,\pstree@depth}
+% These were described on page \pageref{height}.
+% \begin{macrocode}
+\newcount\psTREE@height
+\newcount\psTREE@depth
+\newcount\pstree@cumlevelsep
+\newcount\pstree@numlevels
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\pstree@box}
+% Nodes and trees put themselves in "\pstree@box". A tree collects the root (which includes the root node's "\pstree@box", plus perhaps some "\special"'s lying outside this box) in "\pst@hbox". Then it saves the root in "\pstree@box", while it collects the successors in "\pst@hbox". The tree joins the root and the successors in "\pstree@box".
+% \begin{macrocode}
+\newbox\pstree@box
+% \end{macrocode}
+% \end{macro}
+%
+% \section{The tree macros}
+%
+% We begin with the main tree macros, which provide an outline of the algorithm. Much of this will be explained in detail when the component macros are defined.
+
+% \begin{macro}{\pstree}
+% We set up two ways of invoking trees. "\pstree" is ``short'', and ``\psTree'' is ``long''.
+% \begin{macrocode}
+\def\pstree{\pst@object{pstree}}
+\def\pstree@i#1#2{\psTree@i{#1}\\{#2}\endpsTree}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\psTree,\endpsTree}
+% \begin{macrocode}
+\def\psTree{\pst@object{psTree}}
+\def\psTree@i{%
+ \begingroup
+% \end{macrocode}
+% If we are in outer mode, then we set "shortput=tab" for abbreviated put commands used in trees.
+% Also, we have to change the tree identifier for the purpose of making nodes. Otherwise, we want to
+% kill off extraneous space by starting with "\pst@killglue" and ending with "\ignorespaces".
+% \begin{macrocode}
+ \ifnum\psk@predmode=\m@ne
+ \let\pstree@savedshortput\pst@shortput
+ \psset{shortput=tab}%
+ \else
+ \pst@@killglue
+ \fi
+% \end{macrocode}
+% "\psk@treeframe" is a hook that might contain commands for framing the tree. We save the value of the hook for later use, and then reset it globally.
+% \begin{macrocode}
+ \let\pstree@thisframe\pstree@frame
+ \global\let\pstree@frame\relax
+% \end{macrocode}
+% We save some variables that might be set globally, but whose values should be kept local to the tree, and a few other parameters that need to be restored if this is a subtree.
+% \begin{macrocode}
+ \pstree@savevalues
+% \end{macrocode}
+% If we are in successor mode, then we need to skip levels before setting the graphics parameters. Levels are skipped at this point in the direction of the parent tree.
+% \begin{macrocode}
+ \ifnum\psk@predmode=\m@ne
+ \let\pstree@saveskiplevels\z@
+ \else
+ \ifnum\psskiplevels>\z@\else
+ \expandafter\pstree@checkskiplevels\pst@par,skiplevels=\z@,\@nil
+ \fi
+ \let\pstree@saveskiplevels\psskiplevels
+ \ifnum\psskiplevels>\z@ \pstree@skipprofile \fi
+ \fi
+% \end{macrocode}
+% Then we start a new group and set the graphics parameters.
+% \begin{macrocode}
+ \use@par
+ \let\pstree@saveadjustbbox\psk@adjustbbox
+ \let\pstree@savetreerep\psk@treerep
+% \end{macrocode}
+% Initialize some things for aligning leaves.
+% \begin{macrocode}
+ \if@leafaligntree
+ \chardef\pstree@savemaxlevel\pstree@maxlevel
+ \pstree@initleafalign
+ \else
+ \ifnum\psk@predmode=\psk@treemode\else
+ \chardef\pstree@savemaxlevel\pstree@maxlevel
+ \fi
+ \fi
+% \end{macrocode}
+% If we are in outer mode, or if we are in tree mode and the tree has changed directions, then we need to change "\pstree@id", because for adjusting the level sep, we have to think of this as a new tree. Recall that in outer mode, "\psk@predmode" equals $-1$.
+% \begin{macrocode}
+ \ifnum\psk@predmode=\psk@treemode
+ \global\advance\pstree@ID\@ne
+ \edef\pstree@id{\the\pstree@ID}%
+ \fi
+% \end{macrocode}
+% We process the row, saving everything in "\pst@hbox":
+ \def\\{\pstree@endrow\pst@object{pstreecr}}%
+ \setbox\pstree@box\copy\voidb@x
+ \let\pst@thisbox\relax
+ \pst@makelongbox{}%
+ \pstree@treemode
+ \ignorespaces}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\pstreecr}
+% \begin{macrocode}
+\def\pstreecr@i{%
+ \expandafter\pstree@checkskiplevels\pst@par,skiplevels=\z@,\@nil
+ \ifnum\psskiplevels>\z@ \pstree@skiplevelseps \fi
+ \pstree@initnestedpar
+ \use@par
+ \pstree@setlevelpar
+ \edef\pspred{\pstree@gettop\pstree@basenodes}%
+ \let\pst@thisbox\relax
+ \pst@makelongbox{}%
+ \pstree@treemode
+ \ignorespaces}
+%
+\def\psPred#1{\psPred@i#10\@nil}
+\def\psPred@i#1#2\@nil{%
+ \expandafter\ifcase\expandafter#1%
+ \expandafter\psPred@ii\pstree@basenodes,,,,,,,,,\@nil}
+\def\psPred@ii#1,#2,#3,#4,#5,#6,#7,#8,#9,{%
+ \or#1\or#2\or#3\or#4\or#5\or#6\or#7\or#8\or#9\fi\psPred@iii}
+\def\psPred@iii#1\@nil{}
+%
+\def\pstree@skiplevelseps{%
+ \pst@cntg=\psskiplevels
+ \loop
+ \pstree@setlevelpar
+ \advance\pstree@cumlevelsep\psk@thislevelsep\relax
+ \edef\pstree@levelsizes{\pstree@levelsizes,\psk@thislevelsep,0,0}%
+ \advance\pstree@numlevels\@ne
+ \ifnum\pst@cntg>\@ne
+ \advance\pst@cntg\m@ne
+ \repeat}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\pstree@endrow}
+% The next three commands finish the construction of the tree by joining the root ("\pstree@box") and the successors ("\pst@hbox"). The tree is saved globally in "\pstree@box".
+% \begin{macrocode}
+\def\pstree@endrow{%
+ \pst@@killglue
+ \pst@endlongbox
+ \pstree@checkrow % Check for missing objects or extra space.
+ \ifvoid\pstree@box
+ \pstree@InitTreeDim
+ \else
+ \pstree@joinrows % Join root and successors in a box.
+ \pstree@joinprofiles % Adjust height, depth and profiles.
+ \fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\endpsTree}
+% \begin{macrocode}
+\def\endpsTree{%
+ \pstree@endrow
+% \end{macrocode}
+% "\pstree@thisframe" may add a frame, and adjust the dimensions for the frame.
+% \begin{macrocode}
+ \pstree@thisframe
+% \end{macrocode}
+% If this is not a proper subtree, and the "levelsep" is variable, then it is time to write the level sizes to a file.
+% \begin{macrocode}
+ \ifPst@varlevelsep
+ \ifnum\psk@predmode=\psk@treemode\else
+ \pstree@writelevelsizes
+ \fi
+ \fi
+% \end{macrocode}
+% If this is a LeafAlign tree, we write "\pstree@maxlevel". Also, we restore the value of "\pstree@maxlevel", if appropriate.
+% \begin{macrocode}
+ \if@leafaligntree
+ \pstree@writemaxlevel
+ \global\chardef\pstree@maxlevel\pstree@savemaxlevel
+ \else
+ \ifnum\psk@predmode=\psk@treemode\else
+ \global\chardef\pstree@maxlevel\pstree@savemaxlevel
+ \fi
+ \fi
+% \end{macrocode}
+% Now we make the tree canonical, restore certain values for the predecessor tree, and add the tree to the current construction.
+% \begin{macrocode}
+ \let\psk@adjustbbox\pstree@saveadjustbbox
+ \let\psk@treerep\pstree@savetreerep
+ \let\psskiplevels\pstree@saveskiplevels
+ \pstree@makecanonical
+ \pstree@restorevalues
+ \pstree@build
+ \ifnum\psk@treerep>\@ne\pstree@rep\fi
+ \global\let\pssucc\pstree@savedsucc
+ \endgroup
+ \ifnum\psk@predmode>\m@ne\expandafter\ignorespaces\fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\pstree@savevalues,\pstree@restorevalues}
+% Certain accounting values are set globally, and so we have to save and later restore their values (in case this is a nested tree). There are other values that are not set globally, but which have to be restored when adding this tree to the current row.
+% \begin{macrocode}
+\def\pstree@savevalues{%
+ \edef\pstree@restorevalues{%
+ \pst@ngdef\psTREE@leftprofile
+ \pst@ngdef\psTREE@rightprofile
+ \pst@ngdef\psTREE@levelsizes
+ \pst@ngdef\psTREE@center
+ \pst@ngdef\psTREE@leftbase
+ \pst@ngdef\psTREE@rightbase
+ \pst@ngdef\psTREE@centerbase
+ \pst@ngdef\psTREE@rootnodes
+ \pst@ngdef\psTREE@basenodes
+ \pst@ngdef\psTREE@maxtreesep
+ \pst@ngdef\psTREE@numlevels
+ \pst@ngdef\psTREE@cumlevelsep
+ \global\psTREE@height=\the\psTREE@height\relax
+ \global\psTREE@depth=\the\psTREE@depth\relax
+ \global\psTREE@width=\the\psTREE@width\relax
+ \pst@ngdef\psTREE@addtreesep
+ \pst@ngdef\psk@thistreesep
+ \pst@ngdef\psk@thisxtreesep
+ \pst@ngdef\psk@thistreenodesize
+ \pst@ngdef\psk@thistreefit
+ \global\pstree@succID=\the\pstree@succID\relax}}
+% \end{macrocode}
+% Now we use this to initialize these commands, just in case something goes wrong.
+% \begin{macro}{}
+{\def\pst@ngdef#1{\gdef\noexpand#1{}}\pstree@savevalues\pstree@restorevalues}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \section{Tree parameters}
+%
+%
+% \begin{macro}{\psset@treemode,\psk@treemode}
+% "treemode" refers to the direction that the tree grows. It is saved as an integer, with 0=down, 1=right, 2=up and 3=left.
+% \begin{macrocode}
+%%%??? Add error checking
+\define@key[psset]{pst-tvz}{treemode}[D]{%
+ \chardef\psk@treemode
+ \ifx#1U\@empty2\else\ifx#1R\@empty1\else\ifx#1L\@empty3\else\z@\fi\fi\fi
+ \relax}
+\psset[pst-tvz]{treemode=D}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\psset@treeflip,\ifpstreeflip}
+% "treeflip" determines the direction in which successors are added. When "false", successors are added from left to right for vertical trees, and from top to bottom for horizontal trees. When "true", the direction is switched.
+% \begin{macrocode}
+\define@boolkey[psset]{pst-tvz}[ps]{treeflip}[true]{}
+\psset[pst-tvz]{treeflip=false}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\psset@root}
+% \begin{macrocode}
+\define@key[psset]{pst-tvz}{root}[\TC]{\def\psroot{#1}}
+\psset[pst-tvz]{root=\TC}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\pst@dimtoint} %???? MOVE
+% \begin{macrocode}
+\def\pst@dimtoint#1#2{% should go into pstricks.tex
+ \pssetlength\pst@dimg{#1}%
+ \edef#2{\number\pst@dimg}}
+\def\pst@ngdef#1{\gdef\noexpand#1{#1}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}
+% {\psset@treesep,\psk@treesep,\psset@thistreesep,\psk@thistreesep}
+% "treesep" is the distance between nodes on the same level. There is a "this" version that does not affect subtrees.
+% \begin{macrocode}
+\define@key[psset]{pst-tvz}{treesep}[0.75cm]{\pst@dimtoint{#1}\psk@treesep}
+\psset[pst-tvz]{treesep=.75cm}
+%
+\define@key[psset]{pst-tvz}{thistreesep}{\pst@dimtoint{#1}\psk@thistreesep}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}
+% {\psset@xtreesep,\psk@xtreesep,\psset@thisxtreesep,\psk@thisxtreesep}
+% "xtreesep" is the additional distance between nodes that do not have the same predecessor. There is a "this" version that does not affect subtrees.
+% \begin{macrocode}
+\define@key[psset]{pst-tvz}{xtreesep}[0.75cm]{\pst@dimtoint{#1}\psk@xtreesep}
+\psset[pst-tvz]{xtreesep=0pt}
+%
+\define@key[psset]{pst-tvz}{thisxtreesep}{\pst@dimtoint{#1}\psk@thisxtreesep}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\psset@treenodesize,\psk@treenodesize,
+% \psset@thistreenodesize,\psk@thistreenodesize}
+% \begin{macrocode}
+\define@key[psset]{pst-tvz}{treenodesize}[-1pt]{%
+ \pssetlength\pst@dimg{#1}%
+ \divide\pst@dimg\tw@
+ \edef\psk@treenodesize{\number\pst@dimg}}
+\psset[pst-tvz]{treenodesize=-1pt}
+\define@key[psset]{pst-tvz}{thistreenodesize}[-1pt]{%
+ \pssetlength\pst@dimg{#1}%
+ \divide\pst@dimg\tw@
+ \edef\psk@thistreenodesize{\number\pst@dimg}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\psset@treefit,\psk@treefit}
+% \begin{macrocode}
+\define@key[psset]{pst-tvz}{treefit}[tight]{%
+ \@ifundefined{pstree@#1fit}%
+ {\@pstrickserr{Bad `treefit' parameter value: `#1'}\@ehpa}%
+ {\def\psk@treefit{#1}}}%
+\psset[pst-tvz]{treefit=tight}
+%
+\define@key[psset]{pst-tvz}{thistreefit}[tight]{%
+ \@ifundefined{pstree@#1fit}%
+ {\@pstrickserr{Bad `treefit' parameter value: `#1'}\@ehpa}%
+ {\def\psk@thistreefit{#1}}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\psset@treerep,\psk@treerep}
+% \begin{macrocode}
+\define@key[psset]{pst-tvz}{treerep}[1]{\chardef\psk@treerep#1\relax}
+\psset[pst-tvz]{treerep=1}
+\def\pstree@rep{%
+ \ifnum\psk@treerep>\@ne
+ \pst@cntg\psk@treerep
+ \advance\pst@cntg\m@ne
+ \chardef\psk@treerep\pst@cntg
+ \pstree@build
+ \expandafter\pstree@rep
+ \fi}
+% \end{macro}
+%
+% \begin{macro}{\psk@adjustbbox}
+% The bounding box adjustment parameters define "\psk@adjustbbox" so that it changes "\pst@dima", etc. This is invoked must before nodes invoke "\psnode@makecanonical", or just after a tree is made into a canonical node. "\psk@adjustbbox". The values should not affect nested objects.
+% \begin{macrocode}
+\def\psk@adjustbbox{}
+\def\pstree@setadjustbbox#1#2{%
+ \pssetlength\pst@dimg{#1}%
+ \edef\psk@adjustbbox{\psk@adjustbbox#2\number\pst@dimg sp\relax}}
+\define@key[psset]{pst-tvz}{bbl}{\pstree@setadjustbbox{#1}{\pst@dima=}}
+\define@key[psset]{pst-tvz}{bbr}{\pstree@setadjustbbox{#1}{\pst@dimb=}}
+\define@key[psset]{pst-tvz}{bbh}{\pstree@setadjustbbox{#1}{\pst@dimc=}}
+\define@key[psset]{pst-tvz}{bbd}{\pstree@setadjustbbox{#1}{\pst@dimd=}}
+\define@key[psset]{pst-tvz}{xbbl}{\pstree@setadjustbbox{#1}{\advance\pst@dima}}
+\define@key[psset]{pst-tvz}{xbbr}{\pstree@setadjustbbox{#1}{\advance\pst@dimb}}
+\define@key[psset]{pst-tvz}{xbbh}{\pstree@setadjustbbox{#1}{\advance\pst@dimc}}
+\define@key[psset]{pst-tvz}{xbbd}{\pstree@setadjustbbox{#1}{\advance\pst@dimd}}
+% \end{macrocode}
+% \end{macro}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\psset@showbbox,\psk@showbbox}
+% \begin{macrocode}
+\define@boolkey[psset]{pst-tvz}[Pst@]{showbbox}[true]{}
+\psset[pst-tvz]{showbbox=false}
+\def\pstree@showbbox{%
+ \setbox\pstree@box=\hbox{%
+ \psset{linewidth=.1pt,linecolor=black,linestyle=solid,%
+ dimen=middle,fillstyle=none}%
+ \def\pst@par{}\@starfalse
+ \psframe@i(-\pst@dima,-\pst@dimd)(\pst@dimb,\pst@dimc)%
+ \box\pstree@box}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\psset@levelsep,\psk@levelsep}
+% \begin{macrocode}
+\define@key[psset]{pst-tvz}{levelsep}[2cm]{\pst@dimtoint{#1}\psk@levelsep}
+\psset[pst-tvz]{levelsep=2cm}
+\define@key[psset]{pst-tvz}{thislevelsep}{\pst@dimtoint{#1}\psk@thislevelsep}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\psset@varlevelsep,\ifPst@varlevelsep}
+% \begin{macrocode}
+\define@boolkey[psset]{pst-tvz}[Pst@]{varlevelsep}[true]{%
+ \ifnum\psk@predmode=\psk@treemode
+ \@pstrickserr{varlevelsep cannot be changed for proper subtrees}\@ehpa
+ \fi}
+\let\psk@predmode\m@ne
+\let\if@predflip\iffalse %\fi
+\psset[pst-tvz]{varlevelsep=false}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\psset@treeshift,\psk@treeshift}
+% \begin{macrocode}
+\define@key[psset]{pst-tvz}{treeshift}[0]{%
+ \pssetlength\pst@dimg{#1}%
+ \pst@dimg-\pst@dimg
+ \edef\psk@treeshift{\number\pst@dimg}}
+\psset[pst-tvz]{treeshift=0}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\psset@skiplevels,\psskiplevels}
+% \begin{macrocode}
+\define@key[psset]{pst-tvz}{skiplevels}[0]{\chardef\psskiplevels#1\relax}
+\psset[pst-tvz]{skiplevels=0}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\def\pstree@initnestedpar}
+% This initialized the values of parameters that should not affect nested objects.
+% \begin{macrocode}
+\def\pstree@initnestedpar{%
+ \def\psk@adjustbbox{}%
+ \let\psk@treeshift\z@
+ \chardef\psskiplevels\z@
+ \chardef\psk@treerep\@ne
+ \def\psk@thislevelsep{\psk@levelsep}%
+ \def\psk@thistreesep{\psk@treesep}%
+ \def\psk@thisxtreesep{\psk@xtreesep}%
+ \def\psk@thistreenodesize{\psk@treenodesize}%
+ \def\psk@thistreefit{\psk@treefit}%
+ \def\psk@thisunary{\psk@unary}%
+ \let\if@leafaligntree\iffalse}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\pstree@setlevelpar}
+% \begin{macrocode}
+\def\pstree@setlevelpar{%
+ \advance\pstree@levelID\@ne
+ \csname pstreehook\romannumeral\pstree@levelID\endcsname
+ \ifPst@varlevelsep
+ \ifnum\psk@predmode=\psk@treemode\else
+ \pstree@initadjustlevelsep
+ \fi
+ \pstree@adjustlevelsep
+ \fi
+ \edef\pst@tposflip{\ifnum\psk@treemode>\@ne 1 sub neg \fi}}%
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \section{Outer mode}
+%
+% \begin{macro}{\pstree@build@outer,\psnode@makecanonical@outer}
+% The canonical outer object is a node.
+% \begin{macrocode}
+\def\pstree@build@outer{%
+ \leavevmode
+ \hbox{%
+ \vrule height \pst@dimc depth \pst@dimd width \z@
+ \kern\pst@dima
+ \ifnum\psk@treerep>\@ne\copy\else\box\fi\pstree@box
+ \kern\pst@dimb}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\pstree@makecanonical@outer}
+% "\pstree@makecanonical@outer" converts trees to nodes. What the left and right profiles correspond to depends on whether the tree is horizontal or vertical, and on whether the tree is flipped. What the tree height and depth correspond to depends on the "treemode".
+%
+% When a tree is in <outer> mode, it may adjust its bounding box.
+% \begin{macrocode}
+\def\pstree@makecanonical@outer{%
+ \pstree@gettreebbox
+ \ifx\pstree@center\@empty
+ \pst@dimg\pstree@width sp
+ \divide\pst@dimg\tw@
+ \else
+ \pst@dimg\pstree@center sp
+ \fi
+ \ifnum\pst@dimg=\z@\else
+ \advance\pst@dima\pst@dimg
+ \advance\pst@dimb-\pst@dimg
+ \ifodd\psk@treemode
+ \setbox\pstree@box\hbox{%
+ \ifpstreeflip\lower\else\raise\fi\pst@dimg\box\pstree@box}%
+ \else
+ \setbox\pstree@box\hbox{%
+ \kern\ifpstreeflip\else-\fi\pst@dimg\unhbox\pstree@box}%
+ \fi
+ \fi
+ \wd\pstree@box=\z@
+ \dp\pstree@box=\z@
+ \ht\pstree@box=\z@}
+\def\pstree@gettreebbox{%
+ \pstree@max\pstree@leftprofile\pst@cnta
+ \pstree@max\pstree@rightprofile\pst@cntb
+ \advance\pst@cntb\pstree@width
+ \ifodd\psk@treemode
+ \ifpstreeflip
+ \pst@dimc\pst@cntb sp
+ \pst@dimd\pst@cnta sp
+ \else
+ \pst@dimc\pst@cnta sp
+ \pst@dimd\pst@cntb sp
+ \fi
+ \else
+ \ifpstreeflip
+ \pst@dima\pst@cntb sp
+ \pst@dimb\pst@cnta sp
+ \else
+ \pst@dima\pst@cnta sp
+ \pst@dimb\pst@cntb sp
+ \fi
+ \fi
+ \ifcase\psk@treemode
+ \pst@dimc\pstree@height sp
+ \pst@dimd\pstree@depth sp
+ \or
+ \pst@dima\pstree@height sp
+ \pst@dimb\pstree@depth sp
+ \or
+ \pst@dimc\pstree@depth sp
+ \pst@dimd\pstree@height sp
+ \or
+ \pst@dima\pstree@depth sp
+ \pst@dimb\pstree@height sp
+ \fi
+ \psk@adjustbbox
+ \ifPst@showbbox \pstree@showbbox \fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\pstree@outermode}
+% "\pstree@outermode" sets up some values that should be in effect for outer trees. A tree is "outer" is it is not nested inside any tree, or if it is inside any box other than a tree row (e.g., in a "\TR" node, or a label command). This means that "\pstree@outer" must be exected once below (for trees that are not nested inside any tree), and then "\pst@thisbox" is set to "\pstree@outer" inside a tree row.
+%
+% "\pst@tposflip" is a hook in the "tput" commands defined in "pst-node.tex" that flips the value of the positioning argument for trees, so that the number always refers to the distance from the predecessor node to successor node. This is initialized within trees, but in outer mode we want to disable the hook.
+%
+% "\pst@shortput" is also given a special meaning in trees, and we have to restore its value when entering outer mode.
+%
+% "\psk@bboxadust" stores the bounding box adjust parameters. We do not want these parameters to affect nested objects.
+%
+% Since "\pst@thisbox" may be set to "\pstree@outermode", the latter must reset "\pst@thisbox".
+%
+% Setting "\psk@predmode" to "\m@ne" is a useful flag for outer mode.
+% \begin{macrocode}
+\newif\ifpstree@outer
+\def\pstree@outermode{%
+ \pstree@outertrue
+ \let\pstree@makecanonical\pstree@makecanonical@outer
+ \let\psnode@makecanonical\relax
+ \let\pstree@build\pstree@build@outer
+ \let\psk@predmode\m@ne
+ \pstree@levelID=\z@
+ \chardef\pstree@maxlevel\z@
+ \let\pstree@themaxlevel\relax
+ \def\pstree@id{outer}%
+ \def\pst@tposflip{}%
+ \let\pst@shortput\pstree@savedshortput
+ \pstree@initnestedpar
+ \let\pst@thisbox\relax}
+\let\pstree@savedshortput\pst@shortput
+\pstree@outermode
+% \end{macrocode}
+% \end{macro}
+%
+% \section{Constructing a row a successors}
+%
+% This described the process for the canonical tree row object.
+%
+% \begin{macro}{\pstree@succmode}
+% \begin{macrocode}
+\def\pstree@treemode{%
+ \let\pstree@makecanonical\pstree@makecanonical@succ
+ \let\psnode@makecanonical\psnode@makecanonical@succ
+ \let\pstree@build\pstree@build@succ
+ \pstree@initnestedpar
+ \global\pstree@succID=\@ne
+ \gdef\psTREE@addtreesep{\z@}%
+ \global\let\pstree@center\@empty
+ \global\let\psTREE@centerbase\@empty
+ \let\psk@predmode\psk@treemode
+ \let\if@predflip\ifpstreeflip
+ \let\pst@thisbox\pstree@outermode}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\pstree@build@succ}
+% First we actually skip the levels, if necessary.
+% \begin{macrocode}
+\def\pstree@build@succ{%
+ \ifnum\psskiplevels>\z@ \pstree@skiplevels \fi
+% \end{macrocode}
+% If "\pstree@succID=1", indicating that this is the first successor, the successor row dimensions are simply initialized.
+% \begin{macrocode}
+ \ifnum\pstree@succID=\@ne
+ \ifnum\psk@treerep>\@ne\copy\else\box\fi\pstree@box
+ \pstree@initrowdim
+% \end{macrocode}
+% Otherwise, "\pstree@fit" sets "\psTREE@sep" to the distance between the centers of the previous and current successors, sets "\psTREE@width" to the total distance from the center of the first to the last successor, and updates the profiles. Then we position the current succcessor.
+% \begin{macrocode}
+ \else
+ \pstree@fit
+ \ifodd\psk@predmode
+ \if@predflip\raise\else\lower\fi\psTREE@width sp
+ \else
+ \kern\if@predflip-\fi\psTREE@sep sp
+ \fi
+ \ifnum\psk@treerep>\@ne\copy\else\box\fi\pstree@box
+ \pstree@UpdateRowDim
+ \fi
+ \ifodd\psk@predmode\else
+ \pst@dimg=\pstree@width sp
+ \kern\if@predflip-\fi\pst@dimg
+ \fi
+% \end{macrocode}
+% Now we update the row dimensions.
+% \begin{macrocode}
+ \global\advance\pstree@succID\@ne}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\pstree@initrowdim}
+% The first successor's dimensions become the row's dimensions.
+% \begin{macrocode}
+\def\pstree@initrowdim{%
+ \global\let\psTREE@leftprofile\pstree@leftprofile
+ \global\let\psTREE@rightprofile\pstree@rightprofile
+ \global\let\psTREE@levelsizes\pstree@levelsizes
+ \global\psTREE@height\pstree@height\relax
+ \global\psTREE@depth\pstree@depth\relax
+ \global\psTREE@width\pstree@width\relax
+ \global\let\psTREE@maxtreesep\pstree@maxtreesep
+ \global\let\psTREE@center\pstree@center
+ \xdef\psTREE@numlevels{\the\pstree@numlevels}%
+ \xdef\psTREE@cumlevelsep{\the\pstree@cumlevelsep}%
+ \global\let\psTREE@leftbase\pstree@leftbase
+ \global\let\psTREE@rightbase\pstree@rightbase
+ \global\let\psTREE@centerbase\pstree@centerbase
+ \global\let\psTREE@rootnodes\pstree@rootnodes
+ \global\let\psTREE@basenodes\pstree@basenodes}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\pstree@fit}
+% First we calculate the distance between successors:
+% \begin{macrocode}
+\def\pstree@fit{%
+%% I seem to have deleted the following lines for some reason at one point:
+ \ifnum\psk@thistreenodesize<\z@
+ \let\pst@tempa\psTREE@rightprofile
+ \let\pst@tempb\pstree@leftprofile
+ \else
+ \edef\pst@tempa{\pstree@puttop\psk@thistreenodesize\psTREE@rightprofile}%
+ \edef\pst@tempb{\pstree@puttop\psk@thistreenodesize\pstree@leftprofile}%
+ \fi
+ \csname pstree@\psk@thistreefit fit\endcsname\pst@tempa\pst@tempb\psTREE@sep
+%% \csname pstree@\psk@thistreefit fit\endcsname
+%% \psTREE@rightprofile\pstree@leftprofile\psTREE@sep
+% \end{macrocode}
+% Then we add the "treesep", the width of the new object, and any extra space inserted by "\addtreesep".
+% \begin{macrocode}
+ \advance\psTREE@sep\psk@thistreesep\relax
+ \ifnum\psTREE@maxtreesep<\psTREE@sep
+ \xdef\psTREE@maxtreesep{\the\psTREE@sep}%
+ \fi
+ \advance\psTREE@sep\psTREE@addtreesep\relax
+ \gdef\psTREE@addtreesep{\z@}%
+ \global\advance\psTREE@width\psTREE@sep}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\pstree@UpdateRowDim}
+% Now we update the row's dimensions.
+% \begin{macrocode}
+\def\pstree@UpdateRowDim{%
+ \ifnum\psTREE@maxtreesep<\pstree@maxtreesep\relax
+ \let\psTREE@maxtreesep\pstree@maxtreesep
+ \fi
+ %\advance\psTREE@sep\psTREE@width %% TVZ Deleted 96-Oct-18.
+ \pstree@zip\psTREE@sep
+ \psTREE@rightprofile\pstree@rightprofile\psTREE@rightprofile
+ \pstree@zip\psTREE@width
+ \pstree@leftprofile\psTREE@leftprofile\psTREE@leftprofile
+ \global\advance\psTREE@width\pstree@width
+ \pstree@bimax\psTREE@levelsizes\pstree@levelsizes
+ \ifnum\pstree@height>\psTREE@height
+ \global\psTREE@height\pstree@height\relax
+ \fi
+ \ifnum\pstree@depth>\psTREE@depth
+ \global\psTREE@depth\pstree@depth\relax
+ \fi
+ \ifx\pstree@center\@empty\else
+ \pst@cntg=\psTREE@width
+ \advance\pst@cntg\pstree@center
+ \xdef\psTREE@center{\the\pst@cntg}%
+ \fi
+ \xdef\psTREE@rootnodes{\psTREE@rootnodes\pstree@rootnodes}%
+ \ifnum\pstree@numlevels<\psTREE@numlevels\else
+ \global\let\psTREE@rightbase\pstree@rightbase
+ \ifx\pstree@centerbase\@empty\else
+ \pst@cntg=\pstree@centerbase\relax
+ \advance\pst@cntg\psTREE@width
+ \xdef\psTREE@centerbase{\the\pst@cntg}%
+ \fi
+ \ifnum\pstree@numlevels>\psTREE@numlevels\relax
+ \global\let\psTREE@basenodes\pstree@basenodes
+ \xdef\psTREE@numlevels{\the\pstree@numlevels}%
+ \xdef\psTREE@cumlevelsep{\the\pstree@cumlevelsep}%
+ \pst@cntg=\pstree@leftbase\relax
+ \advance\pst@cntg-\psTREE@width
+ \xdef\psTREE@leftbase{\the\pst@cntg}%
+ \else
+ \xdef\psTREE@basenodes{\psTREE@basenodes\pstree@basenodes}%
+ \fi
+ \fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\treecenter}
+% "\treecenter" just remembers the current width of the row of successors.
+% \begin{macrocode}
+\def\treecenter{\xdef\psTREE@center{\the\psTREE@width}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\addtreesep}
+% \begin{macrocode}
+\def\addtreesep#1{%
+ \pssetlength\pst@dimg{#1}%
+ \xdef\psTREE@addtreesep{\number\pst@dimg}%
+ \ignorespaces}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\pstree@checkrow}
+% "\pstree@checkrow" checks that the row has at least one successor, and that the row doesn't have extraneous space.
+% \begin{macrocode}
+\def\pstree@checkrow{%
+ \ifnum\pstree@succID=\@ne
+ \pst@makelongbox
+ \pstree@treemode
+ \psroot{\box\pst@hbox}%
+ \ifnum\pstree@succID=\@ne\Tn\fi
+ \pst@endlongbox
+ \fi
+ \ifnum\wd\pst@hbox=%
+ \ifodd\psk@treemode\z@\else\ifpstreeflip-\fi\psTREE@width\fi
+ \else
+ \@pstrickserr{Extraneous space in tree row
+ (Level \the\pstree@levelID)}\@ehpa
+ \fi
+ \wd\pst@hbox=\z@
+ \ht\pst@hbox=\z@
+ \dp\pst@hbox=\z@}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \section{Making canonical successors}
+%
+% "\psk@treemode" and "\ifpstreeflip" are the successor tree's "treemode" and "treeflip", and "\psk@predmode" and "\if@predflip" are the successor tree's "treemode" and "treeflip".
+%
+% \begin{macro}{\psnode@makecanonical@succ}
+% Terminal nodes are made into single-level trees. Because \TeX\ is pretty fast at processing conditionals, this should not take so long. Good thing, because terminal nodes are pretty common!
+% \begin{macrocode}
+\def\psnode@makecanonical@succ{%
+ \edef\pstree@height{%
+ \number
+ \ifcase\psk@predmode\pst@dimc\or\pst@dima\or\pst@dimd\or\pst@dimb\fi}%
+ \edef\pstree@depth{%
+ \number
+ \ifcase\psk@predmode\pst@dimd\or\pst@dimb\or\pst@dimc\or\pst@dima\fi}%
+ \edef\pstree@leftprofile{%
+ \number
+ \ifodd\psk@predmode
+ \if@predflip\pst@dimd\else\pst@dimc\fi
+ \else
+ \if@predflip\pst@dimb\else\pst@dima\fi
+ \fi,}%
+ \edef\pstree@rightprofile{%
+ \number
+ \ifodd\psk@predmode
+ \if@predflip\pst@dimc\else\pst@dimd\fi
+ \else
+ \if@predflip\pst@dima\else\pst@dimb\fi
+ \fi,}%
+ %\edef\pstree@levelsizes{\pstree@height,\pstree@depth,}% Moved below.
+ \pstree@numlevels\@ne
+ \pstree@cumlevelsep\z@
+ \chardef\pstree@width\z@
+ \let\pstree@center\@empty
+ \def\pstree@leftbase{\z@}%
+ \def\pstree@rightbase{\z@}%
+ \let\pstree@centerbase\@empty
+ \edef\pstree@rootnodes{\pssucc,}%
+ \let\pstree@basenodes\pstree@rootnodes
+ \def\pstree@maxtreesep{\z@}%
+ %%%% FIX ME?? (also, xtreesep inserted between multiple skiplevel-nodes.)
+ \ifnum\psskiplevels>\z@
+ \let\pstree@saveskiplevels\psskiplevels
+ \pstree@skipprofile
+ %\pstree@cumlevelsep\pstree@skiplevelsep\relax %%% Caused extra skipping.
+ \pst@cntg=\pstree@depth
+ \advance\pst@cntg\pstree@skiplevelsep\relax
+ \edef\pstree@depth{\the\pst@cntg}%
+ \ifnum\pstree@height>\pstree@cumlevelsep
+ \pst@cntg=\pstree@height\relax
+ \advance\pst@cntg-\pstree@cumlevelsep
+ \edef\pstree@height{\the\pst@cntg}%
+ \else
+ \def\pstree@height{0}%
+ \fi
+ \let\psskiplevels\pstree@saveskiplevels
+ \fi
+ \edef\pstree@levelsizes{\pstree@height,\pstree@depth,}% Used to be above
+ \ifPst@leafalign\pstree@alignleaf\fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\pstree@makecanonical@succ}
+% \begin{macrocode}
+% The canonical successor is a subtree with the same orientation as the tree within which it is nested. Flipped trees of the same type are also easy.
+% \begin{macrocode}
+\def\pstree@makecanonical@succ{%
+ \ifnum\psk@treemode=\psk@predmode
+ \pstree@@makecanonical@succ
+% \end{macrocode}
+% Subtrees of a different type are first converted to canonical outer objects (and in the process, the bounding box may be adjusted), and then they are converted to canonical successor objects as if they were nodes. This is not the most efficient, but such rotated subtrees are not so common. A direct conversion would be faster, but would still involve extensive macros.
+% \begin{macrocode}
+ \else
+ \pstree@makecanonical@outer
+ \def\pssucc,{\pstree@rootnodes}%
+ \psnode@makecanonical@succ
+ \fi}
+% \end{macrocode}
+% "\psk@treemode" and "\ifpstreeflip" are for the subtree. "\psk@predmode" and "\ifps@predflip" are for the predecessor tree.
+% \begin{macrocode}
+\def\pstree@@makecanonical@succ{%
+ \ifx\psk@adjustbbox\@empty\else
+ \@pstrickserr{You cannot adjust a proper subtree's bounding box}\@ehpa
+ \let\psk@adjustbbox\relax
+ \fi
+ \ifx\ifpstreeflip\if@predflip\else
+ \pstree@@@makecanonical@succ
+ \fi
+ \ifPst@showbbox \pstree@gettreebbox \fi}
+\def\pstree@@@makecanonical@succ{%
+ \let\pst@tempg\pstree@leftprofile
+ \let\pstree@leftprofile\pstree@rightprofile
+ \let\pstree@rightprofile\pst@tempg
+ \let\pst@tempg\pstree@leftbase
+ \let\pstree@leftbase\pstree@rightbase
+ \let\pstree@rightbase\pst@tempg
+ \ifnum\pstree@width=\z@\else
+ \pst@dimg=\pstree@width sp
+ \multiply\pst@dimg\m@ne
+ \ifodd\psk@treemode
+ \setbox\pstree@box=\hbox{\raise\pst@dimg\box\pstree@box}%
+ \else
+ \setbox\pstree@box=\hbox to \pst@dimg{%
+ \kern\pst@dimg\unhbox\pstree@box\hss}%
+ \fi
+ \fi
+ \ifx\pstree@center\@empty\else
+ \pst@cntg\pstree@width
+ \advance\pst@cntg-\pstree@center\relax
+ \edef\pstree@center{\the\pst@cntg}%
+ \fi}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \section{Joining rows}
+%
+% \begin{macro}{\pstree@InitTreeDim}
+% The first successor's dimensions become the row's dimensions.
+% \begin{macrocode}
+\def\pstree@InitTreeDim{%
+ \setbox\pstree@box\box\pst@hbox
+ \let\pstree@leftprofile\psTREE@leftprofile
+ \let\pstree@rightprofile\psTREE@rightprofile
+ \let\pstree@levelsizes\psTREE@levelsizes
+ \edef\pstree@height{\the\psTREE@height}%
+ \edef\pstree@depth{\the\psTREE@depth}%
+ \edef\pstree@width{\the\psTREE@width}%
+ \let\pstree@maxtreesep\psTREE@maxtreesep
+ \let\pstree@center\psTREE@center
+ \pstree@numlevels\psTREE@numlevels\relax
+ \pstree@cumlevelsep\psTREE@cumlevelsep\relax
+ \let\pstree@leftbase\psTREE@leftbase
+ \let\pstree@rightbase\psTREE@rightbase
+ \let\pstree@centerbase\psTREE@centerbase
+ \let\pstree@rootnodes\psTREE@rootnodes
+ \let\pstree@basenodes\psTREE@basenodes}
+% \end{macrocode}
+% \end{macro}
+%
+% After a row has been processed, the left profiles are with respect to the center of the leftmost toplevel node, the right profiles are with respect to the center of the rightmost toplevel node, and "\psTREE@width" is the distance between the centers of the two extreme toplevel nodes. The row box's current point is the center of the leftmost toplevel node. That is, it is a tree! The previous rows have also been joined into a tree. Here is how we join two trees together, one on top of the other.
+%
+% Fist, we calculate the distance between the current point of the previous rows and the current point of the next row. We are matching the center of the base of the top row with the center of the root of the bottom row.
+%
+%
+% \begin{macro}{\pstree@setsucccenter}
+% \begin{macrocode}
+% "\pstree@setsucccenter" shifts the row's current point to the row's true center (either the midpoint between the two extreme successors or distance "\pstree@center" from the leftmost successor, adjusted by "treeshift"), and then adjust the profiles so that they are with respect to this center.
+%
+% First, find the distance from the left successor to the center, for the top of the bottom row.
+% \begin{macrocode}
+\def\pstree@joinrows{%
+ \ifnum\pstree@succID=\tw@
+ \csname pstree@unarycenter@\psk@thisunary\endcsname
+ \else
+ \ifx\psTREE@center\@empty
+ \pst@cnta\psTREE@width
+ \divide\pst@cnta\tw@
+ \else
+ \pst@cnta\psTREE@center\relax
+ \fi
+ \fi
+ \advance\pst@cnta\psk@treeshift\relax
+% \end{macrocode}
+% Now do the same for bottom of the top row:
+% \begin{macrocode}
+ \ifx\pstree@centerbase\@empty
+ \psTREE@sep\pstree@leftbase
+ \multiply\psTREE@sep\m@ne
+ \advance\psTREE@sep\pstree@rightbase
+ \advance\psTREE@sep\pstree@width
+ \divide\psTREE@sep\tw@
+ \else
+ \psTREE@sep\pstree@centerbase\relax
+ \fi
+% \end{macrocode}
+% Now find the distance between the current points, after alignment:
+% \begin{macrocode}
+ \advance\psTREE@sep-\pst@cnta
+% \end{macrocode}
+% Join the rows:
+% \begin{macrocode}
+ \advance\pstree@cumlevelsep\psk@thislevelsep\relax
+ \ifodd\psk@treemode
+ \setbox\pstree@box=\hbox{%
+ \box\pstree@box
+ \kern\ifnum\psk@treemode=\thr@@-\fi\pstree@cumlevelsep sp
+ \ifpstreeflip\raise\else\lower\fi\psTREE@sep sp\box\pst@hbox}%
+ \else
+ \setbox\pstree@box=\hbox{%
+ \box\pstree@box
+ \kern\ifpstreeflip-\fi\psTREE@sep sp
+ \ifnum\psk@treemode=\z@\lower\else\raise\fi\pstree@cumlevelsep sp
+ \box\pst@hbox}%
+ \fi
+ \wd\pstree@box=\z@
+ \ht\pstree@box=\z@
+ \dp\pstree@box=\z@}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\pstree@joinprofiles}
+% Adjust the profiles.
+% \begin{macrocode}
+\def\pstree@joinprofiles{%
+ \ifnum\psskiplevels>\z@ \pstree@skiprowprofiles \fi
+ \pst@cnta=-\psTREE@sep
+ \pstree@add\pst@cnta\psTREE@leftprofile
+ \advance\pst@cnta\psTREE@leftbase
+ \edef\pstree@leftbase{\the\pst@cnta}%
+ \edef\pstree@leftprofile{\pstree@leftprofile\psTREE@leftprofile}%
+ \ifx\psTREE@centerbase\@empty\else
+ \pst@cnta=\psTREE@sep
+ \advance\pst@cnta\psTREE@centerbase
+ \edef\pstree@centerbase{\the\pst@cnta}%
+ \else
+ \let\pstree@centerbase\@empty
+ \fi
+ \advance\psTREE@width-\pstree@width
+ \advance\psTREE@width\psTREE@sep
+ \pstree@add\psTREE@width\psTREE@rightprofile
+ \edef\pstree@rightprofile{\pstree@rightprofile\psTREE@rightprofile}%
+ \advance\psTREE@width\psTREE@rightbase
+ \edef\pstree@rightbase{\the\psTREE@width}%
+ \edef\pstree@levelsizes{%
+ \pstree@levelsizes\psk@thislevelsep,\psTREE@levelsizes}%
+% \end{macrocode}
+% Then we calculate the resulting height and depth of the tree.
+% \begin{macrocode}
+ \advance\psTREE@height-\pstree@cumlevelsep
+ \ifnum\pstree@height<\psTREE@height
+ \edef\pstree@height{\the\psTREE@height}%
+ \fi
+ \advance\psTREE@depth\pstree@cumlevelsep
+ \ifnum\pstree@depth<\psTREE@depth
+ \edef\pstree@depth{\the\psTREE@depth}%
+ \fi
+ \advance\pstree@numlevels\psTREE@numlevels\relax
+ \let\pstree@basenodes\psTREE@basenodes}
+\def\pstree@skiprowprofiles{%
+ \pst@cntc-\psTREE@sep
+ \pst@cntd\pstree@leftbase\relax
+ \advance\pst@cntc-\pst@cntd
+ \pst@cnta\psTREE@width
+ \advance\pst@cnta\psTREE@sep
+ \advance\pst@cnta-\pstree@width
+ \pst@cntb=\pstree@rightbase
+ \advance\pst@cnta-\pst@cntb
+ \pst@cntg\psskiplevels
+ \advance\pst@cntg\@ne
+ \divide\pst@cntc\pst@cntg
+ \divide\pst@cnta\pst@cntg
+ \loop
+ \advance\pst@cntd\pst@cntc
+ \advance\pst@cntb\pst@cnta
+ \edef\pstree@leftprofile{\pstree@leftprofile\the\pst@cntd,}%
+ \edef\pstree@rightprofile{\pstree@rightprofile\the\pst@cntb,}%
+ \ifnum\pst@cntg>\tw@
+ \advance\pst@cntg\m@ne
+ \repeat}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \section{Binary trees}
+%
+% \begin{macro}{\pstree@unarycenter@left,\pstree@unarycenter@right}
+% \begin{macrocode}
+\def\pstree@unarycenter@middle{\pst@cnta=\z@}
+\def\pstree@unarycenter@left{%
+ \pst@cnta\psk@thistreesep\relax
+ \divide\pst@cnta\tw@
+ \advance\pst@cnta
+ \ifnum\psk@thistreenodesize<\z@
+ \pstree@gettop\psTREE@rightprofile
+ \else
+ \psk@thistreenodesize
+ \fi
+ \relax}%
+\def\pstree@unarycenter@right{%
+ \pst@cnta\psk@thistreesep\relax
+ \divide\pst@cnta\tw@
+ \advance\pst@cnta
+ \ifnum\psk@thistreenodesize<\z@
+ \pstree@gettop\psTREE@leftprofile
+ \else
+ \psk@thistreenodesize
+ \fi
+ \multiply\pst@cnta\m@ne}%
+\def\pstree@unarycenter@leftternary{%
+ \pst@cnta=%
+ \ifnum\psk@thistreenodesize<\z@
+ \pstree@gettop\psTREE@rightprofile
+ \else
+ \psk@thistreenodesize
+ \fi
+ \multiply\pst@cnta\tw@
+ \advance\pst@cnta\psk@thistreesep\relax}%
+\def\pstree@unarycenter@rightternary{%
+ \pst@cnta=%
+ \ifnum\psk@thistreenodesize<\z@
+ \pstree@gettop\psTREE@leftprofile
+ \else
+ \psk@thistreenodesize
+ \fi
+ \multiply\pst@cnta\tw@
+ \advance\pst@cnta\psk@thistreesep
+ \multiply\pst@cnta\m@ne}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\psset@unary,\psk@unary}
+% \begin{macrocode}
+\define@key[psset]{pst-tvz}{unary}[middle]{%
+ \@ifundefined{pstree@unarycenter@#1}%
+ {\@pstrickserr{Bad unary parameter: `#1'}\@ehpa}%
+ {\def\psk@unary{#1}}}
+\psset[pst-tvz]{unary=middle}
+\define@key[psset]{pst-tvz}{thisunary}[middle]{%
+ \@ifundefined{pstree@unarycenter@#1}%
+ {\@pstrickserr{Bad unary parameter: `#1'}\@ehpa}%
+ {\def\psk@thisunary{#1}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\psltree,\psrtree}
+% \begin{macrocode}
+\newpsobject{psltree}{pstree}{thisunary=left}
+\newpsobject{psrtree}{pstree}{thisunary=right}
+% \end{macrocode}
+% \end{macro}
+%
+% \section{Skip levels}
+%
+% \begin{macro}{\pstree@checkskiplevels}
+% \begin{macrocode}
+\def\pstree@checkskiplevels#1skiplevels=#2,#3\@nil{%
+ \chardef\psskiplevels#2\relax}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\pstree@skipprofile}
+% \begin{macrocode}
+\def\pstree@skipprofile{%
+ \ifnum\psk@predmode=\m@ne
+ \@pstrickserr{You can only skip levels in the successors of a tree}\@ehpa
+ \else
+ \pst@cnta=\psskiplevels
+ \pst@cntb=\z@
+ \def\pstree@skiplevelsizes{}%
+ \def\pstree@skiplevelprofiles{}%
+ \pstree@@skipprofile
+ \edef\pstree@skiplevelsep{\the\pst@cntb}%
+ \fi}
+\def\pstree@@skipprofile{%
+ \advance\pstree@levelID\@ne
+ \csname pstreehook\romannumeral\pstree@levelID\endcsname
+ \ifPst@varlevelsep \pstree@adjustlevelsep \fi
+ \edef\pstree@skiplevelsizes{\pstree@skiplevelsizes\psk@thislevelsep,0,0}%
+ \edef\pstree@skiplevelprofiles{0,\pstree@skiplevelprofiles}%
+ \advance\pst@cntb\psk@thislevelsep\relax
+ \pstree@initnestedpar
+ \advance\pst@cnta\m@ne
+ \ifnum\pst@cnta>\z@ \expandafter\pstree@@skipprofile \fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\def\pstree@skiplevels{%
+ \ifx\pstree@center\@empty
+ \pst@cnta\pstree@width
+ \divide\pst@cnta\tw@
+ \else
+ \pst@cnta\pstree@center\relax
+ \fi
+ \advance\pstree@cumlevelsep\pstree@skiplevelsep\relax
+ \ifodd\psk@treemode
+ \setbox\pstree@box=\hbox{%
+ \kern\ifnum\psk@treemode=\thr@@-\fi\pstree@skiplevelsep sp
+ \ifpstreeflip\lower\else\raise\fi\pst@cnta sp\box\pstree@box}%
+ \else
+ \setbox\pstree@box=\hbox{%
+ \kern\ifpstreeflip-\fi\pst@cnta sp
+ \ifnum\psk@treemode=\z@\lower\else\raise\fi\pstree@skiplevelsep sp
+ \box\pstree@box}%
+ \fi
+ \wd\pstree@box=\z@
+ \ht\pstree@box=\z@
+ \dp\pstree@box=\z@
+% Left profiles
+ \ifnum\pst@cnta=\z@\else\pstree@add\pst@cnta\pstree@leftprofile\fi
+ \pst@cntb\pstree@leftbase
+ \advance\pst@cntb\pst@cnta
+ \edef\pstree@leftbase{\the\pst@cntb}%
+ \edef\pstree@leftprofile{\pstree@skiplevelprofiles\pstree@leftprofile}%
+ \ifx\pstree@centerbase\@empty\else
+ \pst@cntb\pstree@centerbase
+ \advance\pst@cntb-\pst@cnta
+ \edef\pstree@centerbase{\the\pst@cntb}%
+ \fi
+ \pst@cntb\pstree@width
+ \advance\pst@cntb-\pst@cnta
+ \ifnum\pst@cntb=\z@\else\pstree@add\pst@cntb\pstree@rightprofile\fi
+ \edef\pstree@rightprofile{\pstree@skiplevelprofiles\pstree@rightprofile}%
+ \advance\pst@cntb\pstree@rightbase
+ \edef\pstree@rightbase{\the\pst@cntb}%
+ \edef\pstree@levelsizes{\pstree@skiplevelsizes\pstree@levelsizes}%
+ \ifnum\pstree@height>\pstree@skiplevelsep\relax
+ \pst@cntb\pstree@skiplevelsep\relax
+ \multiply\pst@cntb\m@ne
+ \advance\pst@cntb\pstree@height
+ \edef\pstree@height{\the\pst@cntb}%
+ \else
+ \def\pstree@height{\z@}%
+ \fi
+ \advance\pstree@numlevels\psskiplevels
+ \def\pstree@width{0}%
+ \def\pstree@center{}}
+%
+% \section{Variable level sep}
+%
+% \begin{macro}{\pstree@initauxout}
+% \begin{macrocode}
+\def\pstree@initauxout{%
+ \@ifundefined{@latexerr}{%
+ \immediate\openin1 \jobname.pst
+ \ifeof1 \else
+ {\catcode`\@=11 \input \jobname.pst}%
+ \fi
+ \immediate\closein1
+ \global\csname newwrite\endcsname\pstree@auxout
+ \immediate\openout\pstree@auxout \jobname.pst }%
+ {\global\let\pstree@auxout\@auxout}%
+ \global\let\pstree@initauxout\relax}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\pstree@writelevelsizes}
+% \begin{macrocode}
+\def\pstree@writelevelsizes{%
+ \ifx\if@filesw\iffalse\else
+ \pstree@getlevelsizes
+ \immediate\write\pstree@auxout{%
+ \string\global\string\@namedef{pstree@levelsizes@\pstree@id}%
+ {\pst@tempg}}%
+ \fi}
+\def\pstree@getlevelsizes{%
+ \def\pst@tempg{}%
+ \expandafter\pstree@@getlevelsizes\psTREE@levelsizes\relax}
+\def\pstree@@getlevelsizes#1,#2,#3,#4,#5,#6{%
+ \pst@cntg=#2\relax
+ \advance\pst@cntg#4\relax
+ \edef\pst@tempg{\pst@tempg\the\pst@cntg,}%
+ \ifx\relax#6\else
+ \def\next{\pstree@@getlevelsizes,#5,#6}%
+ \expandafter\next
+ \fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\pstree@initadjustlevelsep}
+% \begin{macrocode}
+\def\pstree@initadjustlevelsep{%
+ \pstree@initauxout
+ \expandafter\let\expandafter\pstree@thelevelsizes
+ \csname pstree@levelsizes@\pstree@id\endcsname
+ \ifx\pstree@thelevelsizes\relax
+ \def\pstree@thelevelsizes{0,}%
+ \fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\pstree@adjustlevelsep}
+% \begin{macrocode}
+\def\pstree@adjustlevelsep{%
+ \pstree@poptop\pstree@thelevelsizes\pst@cntg
+ \advance\pst@cntg\psk@thislevelsep\relax
+ \edef\psk@thislevelsep{\the\pst@cntg}}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \section{Leaf alignment}
+%
+% \begin{macro}{\psset@leafalign,\ifPst@leafalign}
+% Call a tree whose terminal nodes should be aligned at the bottom of the tree a ``LeafAlign'' tree.
+%
+% In a LeafAlign tree, terminal nodes should align themselves by skipping levels, whenever "leafalign" is "true". The LeafAlign tree sets "\pstree@themaxlevel" to the number of the lowest level in the tree. When "leafalign" is "true", terminal nodes in the LeafAlign tree skip enough levels so that they end up at level "\pstree@themaxlevel".
+%
+% Setting "leafalign=true" has two effects. First, subsequent nodes take care of skipping levels. Second, top level tree or trees in the scope of the parameter setting become LeafAlign trees. "\psset@leafalign" sets "\if@leafaligntree" to "\iftrue", and this is reset to "\iffalse" by "\pstree@initnestedpar".
+% \begin{macrocode}
+\newif\ifPst@leafalign
+\define@key[psset]{pst-tvz}{leafalign}[true]{%
+ \@nameuse{leafalign#1}%
+ \let\if@leafaligntree\ifPst@leafalign}%
+\psset[pst-tvz]{leafalign=false}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\pstree@alignleaf}
+% This is invoked by "\psnode@makecanonical@succ" (i.e., by terminal nodes), when "leafalign" is true.
+%
+% We keep track of the number of the lowest level in a tree with "\pstree@maxlevel". This is set with "\chardef".
+%
+% The the terminal node skips as many levels as are needed.
+% \begin{macrocode}
+\def\pstree@alignleaf{%
+ \ifnum\pstree@maxlevel<\pstree@levelID
+ \global\chardef\pstree@maxlevel\pstree@levelID
+ \fi
+ \ifx\pstree@themaxlevel\relax\else
+ \ifnum\psskiplevels>\z@\else
+ \ifnum\pstree@themaxlevel>\pstree@levelID
+ \pst@cntg=\pstree@themaxlevel
+ \advance\pst@cntg-\pstree@levelID
+ \chardef\psskiplevels\pst@cntg
+ \pstree@saveskiplevels\psskiplevels
+ \pstree@skipprofile
+ \let\psskiplevels\pstree@saveskiplevels
+ \fi
+ \fi
+ \fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\pstree@writemaxlevel}
+% When a LeafAlign tree finishes processing its successors, it writes "\pstree@maxlevel" to a file.
+% \begin{macrocode}
+% \begin{macrocode}
+\def\pstree@writemaxlevel{%
+ \ifx\if@filesw\iffalse\else
+ \immediate\write\pstree@auxout{%
+ \string\global\string\@namedef{pstree@maxlevel@%
+ \pstree@id-\the\pstree@levelID-\the\pstree@succID}%
+ {\the\pstree@maxlevel}}%
+ \fi}
+% \end{macrocode}
+%
+% \begin{macro}{\pstree@writemaxlevel}
+% \begin{macrocode}
+% Before processing its successors, a LeafAlign tree looks for the value of "\pstree@maxlevel" that it might have written to the file, and assigns the value to "\pstree@themaxlevel":
+\def\pstree@initleafalign{%
+ \pstree@initauxout
+ \expandafter\let\expandafter\pstree@themaxlevel
+ \csname
+ pstree@maxlevel@%
+ \pstree@id-\the\pstree@levelID-\the\pstree@succID
+ \endcsname
+% \end{macrocode}
+% If "\pstree@themaxlevel" is equal to "\relax", then terminal nodes know that they should not try to align themselves.
+%
+% Then tree A needs to initialize "\pstree@maxlevel".
+% \begin{macrocode}
+ \global\chardef\pstree@maxlevel\pstree@levelID}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\pstree@savemaxlevel}
+% "\pstree@maxlevel" is set globally. A LeafAlign tree should not pay attention to levels in a subtrees that (i) change directions, (ii) are root trees, or (iii) are LeafAlign trees. Such trees save the value of "\pstree@maxlevel" as "\pstree@savemaxlevel", and then restore the value globally at the end. Here, we just initialize it:
+% \begin{macrocode}
+\let\pstree@savemaxlevel\z@
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \section{Tree frames}
+%
+\let\pstree@frame\relax
+
+% \begin{macro}{\pstreeframe}
+% This one is not working. For one thing, "\pstree@getbbox" is not defined.
+% \begin{macrocode}
+\def\pstreeframe{\pst@object{pstreeframe}}
+\def\pstreeframe@i{%
+ \let\pstree@theframe\pstreeframe@ii
+ \let\pstree@theframepar\pst@par
+ \let\pstree@theframestar\if@star}
+\def\pstreeframe@ii{%
+ \pstree@getbbox
+ \pst@dimg\pslinewidth
+ \advance\pst@dimg\psframesep
+ \advance\pst@dima\pst@dimg
+ \advance\pst@dimb\pst@dimg
+ \advance\pst@dimc\pst@dimg
+ \advance\pst@dimd\pst@dimg
+ \setbox\pstree@box=\hbox{%
+ \let\pst@par\pstree@theframepar
+ \let\if@star\pstree@theframestar
+ \pst@useboxpar
+ \ifpsboxsep\aftergroup\pstreeframe@iii\fi
+ \def\psk@dimen{.5 }%
+ \psframe@i(-\pst@dima,-\pst@dimd)(\pst@dimb,\pst@dimc)%
+ \box\pstree@box}%
+ \aftergroup\pstree@relaxtheframe}%
+\def\pstreeframe@iii{%
+ \ifodd\psk@treemode
+ \pst@cntg=\pst@dimc
+ \pstree@set\pstree@upprofile
+ \pst@cntg=\pst@dimd
+ \pstree@set\pstree@downprofile
+ \else
+ \pstree@add\pst@dima\pstree@leftprofile
+ \pstree@add\pst@dimb\pstree@rightprofile
+ \fi}
+\def\pstree@relaxtheframe{\let\pstree@theframe\relax}
+\let\pstree@theframe\relax
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\pstree@firstandlast}
+% "\pstree@firstandlast{<profile>}{<cnt1>}{<cnt2>}" assigns the first and last values in <profile> to <cnt1> and <cnt2>, respectively.
+% \begin{macrocode}
+\def\pstree@firstandlast#1#2#3{%
+ \expandafter\pstree@@firstandlast\expandafter#2#1\relax,%
+ #3=\pst@cntg}
+\def\pstree@@firstandlast#1#2,{%
+ \pst@cntg=#2\relax
+ #1=\pst@cntg
+ \pstree@@@firstandlast}
+\def\pstree@@@firstandlast#1,{%
+ \ifx\relax#1\else
+ \pst@cntg=#1\relax
+ \expandafter\pstree@@@firstandlast
+ \fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\pstreecurve}
+% This so far does nothing useful.
+% \begin{macrocode}
+\def\pstreecurve{\pst@object{pstreecurve}}
+\def\pstreecurve@i{%
+ \let\pstree@frame\pstreecurve@ii
+ \let\pstree@theframepar\pst@par
+ \let\pstree@theframestar\if@star}
+\def\pstreecurve@ii{%
+ \setbox\pstree@box=\hbox{%
+ \let\pst@par\pstree@theframepar
+ \let\if@star\pstree@theframestar
+ \pst@useboxpar
+ \ifpsboxsep\aftergroup\pstreecurve@iv\fi
+ \pstreecurve@iii
+ \box\pstree@box}%
+ \aftergroup\pstree@relaxtheframe}%
+\def\pstreecurve@iii{%
+ \begin@ClosedObj
+ \pst@dimg\pslinewidth
+ \divide\pst@dimg2
+ \advance\pst@dimg\psframesep
+ \ifodd\psk@treemode\pstreecurve@hcoor\else\pstreecurve@vcoor\fi
+ \addto@pscode{[ \pst@coors}%
+ \psccurve@ii}
+\def\pstreecurve@iv{%
+ \pst@cnta=\pslinewidth
+ \advance\pst@cnta\psframesep
+ \ifodd\psk@treemode
+ \pstree@add\pst@cnta\pstree@upprofile
+ \pstree@add\pst@cnta\pstree@downprofile
+ \else
+ \pstree@add\pst@cnta\pstree@leftprofile
+ \pstree@add\pst@cnta\pstree@rightprofile
+ \fi}
+\def\pstreecurve@hcoor{%
+ \advance\pst@dima\pst@dimg
+ \advance\pst@dimb\pst@dimg
+ \ifnum\psk@treemode=\@ne
+ \pstree@firstandlast\pstree@upprofile\pst@cnta\pst@cntb
+ \else
+ \pstree@firstandlast\pstree@upprofile\pst@cntb\pst@cnta
+ \fi
+ \pst@dimh=\pst@cnta sp
+ \advance\pst@dimh\pst@dimg
+ \edef\pst@coors{\pst@number\pst@dima neg \pst@number\pst@dimh}%
+ \pst@dimh=\pst@cntb sp
+ \advance\pst@dimh\pst@dimg
+ \edef\pst@coors{\pst@coors \pst@number\pst@dimb \pst@number\pst@dimh}%
+ \ifnum\psk@treemode=\@ne
+ \pstree@firstandlast\pstree@downprofile\pst@cnta\pst@cntb
+ \else
+ \pstree@firstandlast\pstree@downprofile\pst@cntb\pst@cnta
+ \fi
+ \pst@dimh=\pst@cntb sp
+ \advance\pst@dimh\pst@dimg
+ \edef\pst@coors{%
+ \pst@coor \pst@number\pst@dimb \pst@number\pst@dimh neg }%
+ \pst@dimh=\pst@cnta sp
+ \advance\pst@dimh\pst@dimg
+ \edef\pst@coors{%
+ \pst@coors \pst@number\pst@dima neg \pst@number\pst@dimh neg }}%
+\def\pstreecurve@vcoor{%
+ \advance\pst@dimc\pst@dimg
+ \advance\pst@dimd\pst@dimg
+ \ifnum\psk@treemode=\z@
+ \pstree@firstandlast\pstree@leftprofile\pst@cnta\pst@cntb
+ \else
+ \pstree@firstandlast\pstree@leftprofile\pst@cntb\pst@cnta
+ \fi
+ \pst@dimh=\pst@cnta sp
+ \advance\pst@dimh\pst@dimg
+ \edef\pst@coors{\pst@number\pst@dimh neg \pst@number\pst@dimc}%
+ \pst@dimh=\pst@cntb sp
+ \advance\pst@dimh\pst@dimg
+ \edef\pst@coors{%
+ \pst@coors \pst@number\pst@dimh neg \pst@number\pst@dimd neg }%
+ \ifnum\psk@treemode=\z@
+ \pstree@firstandlast\pstree@rightprofile\pst@cnta\pst@cntb
+ \else
+ \pstree@firstandlast\pstree@rightprofile\pst@cntb\pst@cnta
+ \fi
+ \pst@dimh=\pst@cntb sp
+ \advance\pst@dimh\pst@dimg
+ \edef\pst@coors{\pst@coors \pst@number\pst@dimh \pst@number\pst@dimd neg }%
+ \pst@dimh=\pst@cnta sp
+ \advance\pst@dimh\pst@dimg
+ \edef\pst@coors{\pst@coors \pst@number\pst@dimh \pst@number\pst@dimc}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\pstreepyramid}
+% This seems to do nothing.
+% \begin{macrocode}
+\def\pstreepyramid{\pst@object{pstreepyramid}}
+\def\pstreepyramid@i{%
+ \let\pstree@frame\pstreepyramid@ii
+ \let\pstree@theframepar\pst@par
+ \let\pstree@theframestar\if@star}
+\def\pstreepyramid@ii{%
+ \setbox\pstree@box=\hbox{%
+ \let\pst@par\pstree@theframepar
+ \let\if@star\pstree@theframestar
+ \pst@useboxpar
+ %\ifpsboxsep\aftergroup\pstreepyramid@iv\fi
+ \pstreepyramid@iv
+ \pstreepyramid@iii
+ \box\pstree@box}%
+ \aftergroup\pstree@relaxtheframe}%
+\def\pstreepyramid@iii{%
+ \begin@ClosedObj
+ \pst@dimg\pslinewidth
+ \advance\pst@dimg\psframesep
+ \ifodd\psk@treemode\pstreepyramid@hcoor\else\pstreepyramid@vcoor\fi
+ \addto@pscode{[ \pst@tempg \pst@temph }%
+ \pspolygon@ii}
+\def\pstreepyramid@iv{%
+ \pst@cnta=\pslinewidth
+ \advance\pst@cnta\psframesep
+ \ifodd\psk@treemode
+ \pstree@add\pst@cnta\pstree@upprofile
+ \pstree@add\pst@cnta\pstree@downprofile
+ \else
+ \pstree@add\pst@cnta\pstree@leftprofile
+ \pstree@add\pst@cnta\pstree@rightprofile
+ \fi}
+\def\pstreepyramid@hcoor{%
+ \def\pst@tempg{}%
+ \def\pst@temph{}%
+ \pst@dima=\z@
+ \pst@dimg=\pst@cntg sp
+ \edef\next{%
+ \pstree@levelsizes\relax
+ \pstree@upprofile\relax
+ \pstree@downprofile\relax}%
+ \expandafter\pstreepyramid@@hcoor\next}
+\def\pstreepyramid@@hcoor#1,#2,#3,#4\relax#5,#6\relax#7,#8\relax{%
+ \pst@dimc=#5sp
+ \pst@dimd=#7sp
+ \pst@dimd=-\pst@dimd
+ \pst@dimb=#1sp
+ \advance\pst@dimb\pst@dimg
+ \pst@dimb=-\pst@dimb
+ \advance\pst@dimb\pst@dima
+ \edef\pst@tempg{\pst@tempg \pst@number\pst@dimb \pst@number\pst@dimc}%
+ \edef\pst@temph{\pst@number\pst@dimb \pst@number\pst@dimd \pst@temph}%
+ \pst@dimb=#2sp
+ \advance\pst@dimb\pst@dimg
+ \advance\pst@dimb\pst@dima
+ \edef\pst@tempg{\pst@tempg \pst@number\pst@dimb \pst@number\pst@dimc}%
+ \edef\pst@temph{\pst@number\pst@dimb \pst@number\pst@dimd \pst@temph}%
+ \ifx\relax#1%
+ \let\next\relax
+ \else
+ \pst@dimb=#3sp
+ \advance\pst@dima\ifnum\psk@treemode=\@ne\else-\fi\pst@dimb
+ \def\next{\pstreepyramid@@hcoor#4\relax#6\relax#8\relax}%
+ \fi
+ \next}
+\def\pstreepyramid@vcoor{%
+ \advance\pst@dimc\pst@dimg
+ \advance\pst@dimd\pst@dimg
+ \ifnum\psk@treemode=\z@
+ \pstree@firstandlast\pstree@leftprofile\pst@cnta\pst@cntb
+ \else
+ \pstree@firstandlast\pstree@leftprofile\pst@cntb\pst@cnta
+ \fi
+ \pst@dimh=\pst@cnta sp
+ \advance\pst@dimh\pst@dimg
+ \edef\pst@coors{\pst@number\pst@dimh neg \pst@number\pst@dimc}%
+ \pst@dimh=\pst@cntb sp
+ \advance\pst@dimh\pst@dimg
+ \edef\pst@coors{%
+ \pst@coors \pst@number\pst@dimh neg \pst@number\pst@dimd neg }%
+ \ifnum\psk@treemode=\z@
+ \pstree@firstandlast\pstree@rightprofile\pst@cnta\pst@cntb
+ \else
+ \pstree@firstandlast\pstree@rightprofile\pst@cntb\pst@cnta
+ \fi
+ \pst@dimh=\pst@cntb sp
+ \advance\pst@dimh\pst@dimg
+ \edef\pst@coors{\pst@coors \pst@number\pst@dimh \pst@number\pst@dimd neg }%
+ \pst@dimh=\pst@cnta sp
+ \advance\pst@dimh\pst@dimg
+ \edef\pst@coors{\pst@coors \pst@number\pst@dimh \pst@number\pst@dimc}}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \section{Edges and node names\label{edges}}
+%
+% The following applies to nodes that have a successor:
+%
+% There are two edge macros. "\psedge" is invoked following each node, except when there is a skipped level between the node and its predecessor, in which case "\skipedge" is invoked. "\psedge" and "\skipedge" can be set by the "edge" and "skipedge" parameters. Setting these parameters for a node should affect the edge drawn to that node, but other parameter changes to a node should not affect the way the edge is drawn.
+% To reconcile these two goals, after setting its graphics parameters, a node lets "\pstree@edge" be "\psedge" (or If levels are skipped, it lets "\pstree@skipedge" be "\psedge" and lets "\pstree@edge" be "\skipedge"). Then the node closes the group and invokes "\pstree@edge".
+%
+% \begin{macro}{\psset@edge,\psedge}
+% \begin{macrocode}
+\define@key[psset]{pst-tvz}{edge}[\ncline]{\def\psedge{#1}}%
+\psset[pst-tvz]{edge=\ncline}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\psset@skipedge,\skipedge}
+% \begin{macrocode}
+\define@key[psset]{pst-tvz}{skipedge}[{}]{%
+ \def\skipedge{#1}%
+ \ifx\skipedge\@empty
+ \def\skipedge{\psedge}%
+ \else
+ \ifx\skipedge\@none
+ \def\skipedge##1##2{}%
+ \fi
+ \fi}
+\psset[pst-tvz]{skipedge={}}
+% \end{macrocode}
+% \end{macro}
+%
+% Each node sets "\pssucc" to "@T:\pstree@id:\the\pstree@levelID". This does not give every node a unique name, but a nodes name will never be overwritten until it is not needed.
+%
+% \begin{macro}{\pspred}
+% Here, we only initialize "\pspred", in case it is used inadvertently.
+% \begin{macrocode}
+\def\pspred{@T}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \section{Tree Nodes}
+%
+% For each of the PSTricks node commands, there should be a variant for trees that:
+% \begin{enumerate}
+% \item \label{bbt}
+% Invokes "\pst@@killglue".
+%
+% \item
+% Perhaps makes "\pst@hbox" and/or collect arguments. (Note: If a node is a tree's root or successor, then "\pst@thisbox" has been set to "\pstree@outermode" by the tree.)
+%
+% \item
+% Begins a group, and use graphics parameters.
+%
+% \item
+% Globally advance "\pstree@succID" by 1.
+%
+% \item \label{ebt}
+% Globally set "\pssucc" to "@T:\pstree@id:\the\pstree@levelID".
+%
+% \item \label{dn1}
+% Creates a zero-dimensional box, containing the node with name "\pssucc", and with the origin of the box located at the center of the node. (The center is the point the edges point to.)
+%
+% \item \label{dn2}
+% Sets "\pst@dima", etc., as described on page \pageref{nodesizes}.
+%
+% \item \label{bet}
+% Adjusts and/or shows the bounding box:
+% \begin{LVerbatim}
+% \psk@adjustbbox
+% \ifPst@showbbox\pstree@showbbox\fi
+% \end{LVerbatim}
+%
+% \item
+% Invokes "\psnode@makecanonical" and "\pstree@build".
+%
+% \item Saves the edge, closes the group, and invokes the edge (see Section \ref{edges}).
+%
+% \item \label{eet}
+% Invokes "\pst@shortput" (unless there is no predecessor, in which case it invokes "\ignorespaces").
+% \end{itemize}
+%
+%
+% \begin{macro}{\begin@treenode,\end@treenode}
+% "\begin@treenode" takes care of steps \ref{bbt}--\ref{ebt}. "\end@treenode" takes care of steps \ref{bet}--\ref{eet}. A tree node typically invokes "\begin@treenode", takes care of steps \ref{dn1} and \ref{dn2}, and then invokes "\end@treenode". If the tree makes "\pst@hbox", then it must first invoke "\pst@@killglue".
+% \begin{macrocode}
+\def\begin@treenode{%
+ \pst@@killglue
+ \begingroup
+ \use@par
+ \xdef\pssucc{@T:\pstree@id:\the\pstree@levelID:\the\pstree@succID}}
+%
+\def\end@@treenode{%
+ \psk@adjustbbox
+ \ifPst@showbbox\pstree@showbbox\fi
+ \psnode@makecanonical
+ \pstree@build
+ \ifnum\psskiplevels>\z@
+ \global\let\pstree@skipedge\psedge
+ \global\let\pstree@edge\skipedge
+ \else
+ \global\let\pstree@edge\psedge
+ \fi
+ \endgroup
+ \let\pst@tempa\ignorespaces
+ \ifnum\pstree@levelID>\z@
+ \ifx\pstree@edge\@none\else
+ \let\pst@tempa\pst@shortput
+ \expandafter\pstree@makeedge\pstree@basenodes\relax\@empty
+ \fi
+ \fi
+ \pst@tempa}
+%
+\def\pstree@makeedge#1,#2#3\@empty{%
+ {\pstree@edge{#1}{\pssucc}}%
+ \ifx#2\relax\else\let\pst@tempa\ignorespaces\expandafter\pstree@makeedge\fi
+ #2#3\@empty}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\Tn}
+% "\Tn" is the exception. Because it is just a place holder, it sets "\pssucc" to "\pspred", and does not make an edge.
+% \begin{macrocode}
+\def\Tn{\pst@object{Tn}}
+\def\Tn@i{%
+ \pst@@killglue
+ \global\let\pssucc\pspred
+ \begingroup
+ \pst@dima=\z@
+ \pst@dimb=\z@
+ \pst@dimc=\z@
+ \pst@dimd=\z@
+ \setbox\pstree@box=\hbox{}%
+ \psnode@makecanonical
+ \pstree@build
+ \endgroup
+ \ignorespaces}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\Tp}
+% \begin{macrocode}
+\def\Tp{\pst@object{Tp}}
+\def\Tp@i{%
+ \begin@treenode
+ \pst@dima=\z@
+ \pst@dimb=\z@
+ \pst@dimc=\z@
+ \pst@dimd=\z@
+ \setbox\pstree@box=\hbox{%
+ \pst@newnode{\pssucc}{10}{0 0 }{\tx@InitPnode}}%
+ \end@treenode}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\Tc,\TC}
+% \begin{macrocode}
+\def\Tc{\pst@object{Tc}}
+\def\Tc@i#1{%
+ \begin@treenode
+ \pssetlength\pst@dima{#1}%
+ \pst@dimb=\pst@dima
+ \pst@dimc=\pst@dima
+ \pst@dimd=\pst@dima
+ \nodealignfalse
+ \setbox\pstree@box=\hbox{\cnode@ii(\z@,\z@){#1}{\pssucc}}%
+ \end@treenode}
+\def\TC{\pst@object{TC}}
+\def\TC@i{\Tc@i{\psk@radius}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\Toval}
+% \begin{macrocode}
+\def\Toval{\pst@object{Toval}}
+\def\Toval@i{\pst@@killglue\pst@makebox{\Toval@ii\ovalnode@ii}}
+\def\Toval@ii#1{%
+ \begin@treenode
+ \nodealigntrue
+ \setbox\pstree@box=\hbox{#1\pssucc}%
+ \pst@dima=\wd\pstree@box
+ \divide\pst@dima\tw@
+ \pst@dimb=\pst@dima
+ \pst@dimc=\ht\pstree@box
+ \pst@dimd=\dp\pstree@box
+ \setbox\pstree@box=\hbox to\z@{\hss\unhbox\pstree@box\hss}%
+ \dp\pstree@box=\z@
+ \ht\pstree@box=\z@
+ \end@treenode}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\Tcircle,\TCircle}
+% \begin{macrocode}
+\def\Tcircle{\pst@object{Tcircle}}
+\def\Tcircle@i{\pst@@killglue\pst@makebox{\Toval@ii\circlenode@ii}}
+\def\TCircle{\pst@object{TCircle}}
+\def\TCircle@i{\pst@@killglue\pst@makebox{\Toval@ii\Circlenode@ii}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\Tf}
+% \begin{macrocode}
+\def\Tf{\pst@object{Tf}}
+\def\Tf@i{\Toval@ii{\fnode@ii()}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\Tdia}
+% \begin{macrocode}
+\def\Tdia{\pst@object{Tdia}}
+\def\Tdia@i{\pst@@killglue\pst@makebox{\Toval@ii\dianode@ii}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\Ttri}
+% \begin{macrocode}
+\def\Ttri{\pst@object{Ttri}}
+\def\Ttri@i{\pst@@killglue\pst@makebox{\Ttri@ii}}
+\def\Ttri@ii{%
+ \begin@treenode
+ \nodealigntrue
+ \setbox\pstree@box=\hbox{\trinode@ii\pssucc}%
+ \pst@dima=\pst@dimg % Set by \pst@triboxsep
+ \pst@dimb=\wd\pstree@box
+ \advance\pst@dimb-\pst@dima
+ \pst@dimc=\ht\pstree@box
+ \pst@dimd=\dp\pstree@box
+ \setbox\pstree@box=\hbox to\z@{\hss\unhbox\pstree@box\hss}%
+ \dp\pstree@box=\z@
+ \ht\pstree@box=\z@
+ \end@treenode}
+% \end{macrocode}
+% \end{macro}
+%
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\Tr}
+% \begin{macrocode}
+\def\Tr{\pst@object{Tr}}
+\def\Tr@i{\pst@@killglue\pst@makebox{\Tr@ii{\rnode@iii\rnode@iv}}}
+\def\Tr@ii#1{%
+ \begin@treenode
+ \def\pstree@nodehook{%
+ \xdef\pstree@next{\pst@dima=\number\pst@dima sp\relax}}%
+ \nodealigntrue
+ \setbox\pstree@box\hbox{#1\pssucc}%
+ \pstree@next
+ \pst@dimb=\wd\pstree@box
+ \advance\pst@dimb-\pst@dima
+ \pst@dimc=\ht\pstree@box
+ \pst@dimd=\dp\pstree@box
+ \setbox\pstree@box\hbox to\z@{\kern-\pst@dima\unhbox\pstree@box\hss}%
+ \ht\pstree@box=\z@
+ \dp\pstree@box=\z@
+ \end@treenode}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\TR}
+% \begin{macrocode}
+\def\TR{\pst@object{TR}}
+\def\TR@i{\pst@@killglue\pst@makebox{\Tr@ii{\rnode@iii\Rnode@ii}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\Tdot}
+% \begin{macrocode}
+\def\Tdot{\pst@object{Tdot}}
+\def\Tdot@i{%
+ \begin@treenode
+ \def\pstree@nodehook{\xdef\pstree@next{%
+ \pst@dima=\number\pst@dimg sp\relax
+ \pst@dimc=\number\pst@dimh sp\relax}}%
+ \nodealignfalse
+ \setbox\pstree@box=\hbox{\dotnode@ii(\z@,\z@)\pssucc}%
+ \pstree@next
+ \pst@dimb=\pst@dima
+ \pst@dimd=\pst@dimc
+ \end@treenode}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\psset@fansize,\psk@fansize}
+% \begin{macrocode}
+\define@key[psset]{pst-tvz}{fansize}[1cm]{\pst@@getlength{#1}\psk@fansize}
+\psset[pst-tvz]{fansize=1cm}
+% \end{macrocode}
+% \end{macro}
+%
+% DEFINITION OF Tfan IS IN psn-beta.doc.
+%
+% \begin{macro}{\tx@Tfan}
+% \begin{macrocode}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\Tfan}
+% \begin{macrocode}
+\def\Tfan{\pst@object{Tfan}}
+\def\Tfan@i{%
+ \addto@par{edge=none,skipedge=none}%
+ \begin@treenode
+ \solid@star
+ % For now, let \pst@dimb and \pst@dimd base and thickness of fan.
+ \pst@dimb=\psk@fansize
+ \pst@dimd=\pslinewidth
+ \advance\pst@dimb-\pst@dimd
+ \divide\pst@dimb 2
+ \divide\pst@dimd 2
+ % Set \pst@dima and \pst@dimc to leftsize and height of node
+ \ifodd\psk@treemode
+ \pst@dima=\pst@dimd
+ \pst@dimc=\pst@dimb
+ \else
+ \pst@dima=\pst@dimb
+ \pst@dimc=\pst@dimd
+ \fi
+ \setbox\pstree@box=\hbox{%
+ \pst@newnode{\pssucc}{16}{}{%
+ /Y 0 def
+ /X 0 def
+ /l \pst@number\pst@dima def
+ /r l def
+ /u \pst@number\pst@dimc def
+ /d u def
+ /NodePos { \tx@GetRnodePos } def}%
+ \def\pst@linetype{1}%
+ \nc@object{Closed}{\pspred}{\pssucc}{.5}{%
+ tx@Dict begin \psline@iii pop end
+ /w \pst@number\pst@dimb CLW 2 div sub def
+ /m \ifodd\psk@treemode false \else true \fi def
+ \tx@Tfan}}%
+ \pst@dimb=\pst@dima
+ \pst@dimd=\pst@dimc
+ \end@treenode}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\psset@tnsep,\psk@tnsep}
+% \begin{macrocode}
+\define@key[psset]{pst-tvz}{tnsep}[{}]{%
+ \def\pst@tempg{#1}%
+ \ifx\pst@tempg\@empty
+ \def\psk@tnsep{\number\pslabelsep sp}%
+ \else
+ \pst@@getlength{#1}\psk@tnsep
+\fi}
+\psset[pst-tvz]{tnsep={}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\psset@tnyref,\psk@tnyref}
+% \begin{macrocode}
+\define@key[psset]{pst-tvz}{tnyref}[{}]{\def\psk@tnyref{#1}}%
+\psset[pst-tvz]{tnyref={}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\psset@tnheight,\psk@tnheight}
+% \begin{macrocode}
+\define@key[psset]{pst-tvz}{tnheight}[\ht\strutbox]{\def\psk@tnheight{#1}}
+\psset[pst-tvz]{tnheight=\ht\strutbox}
+\define@key[psset]{pst-tvz}{tndepth}[\dp\strutbox]{\def\psk@tndepth{#1}}
+\psset[pst-tvz]{tndepth=\dp\strutbox}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\psset@tnpos,\psk@tnpos}
+% \begin{macrocode}
+\define@key[psset]{pst-tvz}{tnpos}[{}]{%
+ \def\pst@tempg{#1}%
+ \ifx\pst@tempg\@empty
+ \def\psk@tnpos{%
+ \ifcase\psk@treemode b\or r\or a\or l\fi}%
+ \else
+ \@ifundefined{pstree@tnput@#1}%
+ {\@pstrickserr{Bad tnpos: `#1'}\@ehpa}%
+ {\def\psk@tnpos{#1}}%
+ \fi}
+\psset[pst-tvz]{tnpos={}}
+% \end{macrocode}
+% \end{macro}
+%
+\def\MakeShortTnput#1{%
+ \def\end@treenode{\@ifnextchar#1{\tnput@}{\end@@treenode}}}
+\MakeShortTnput{~}
+% \begin{macro}{\tnput@}
+% \begin{macrocode}
+\def\tnput@#1{\pst@object{tnput}}
+\def\tnput@i{\pst@@killglue\pst@makebox{\tnput@ii}}
+\def\tnput@ii{%
+ \begingroup
+ \use@par
+ \if@star\pst@starbox\fi
+ \gdef\next{}%
+ \csname pstree@tnput@\psk@tnpos\endcsname
+ \endgroup
+ \next
+ \setbox\pstree@box=\box\pst@boxg
+ \dp\pstree@box=\z@
+ \ht\pstree@box=\z@
+ \wd\pstree@box=\z@
+ \end@treenode}
+\@namedef{pstree@tnput@b}{%
+ \pstree@tnput@@v\pst@dimd\ht\dp\lower\psk@tnheight}
+\@namedef{pstree@tnput@a}{%
+ \pstree@tnput@@v\pst@dimc\dp\ht\raise\psk@tndepth}
+\def\pstree@tnput@@v#1#2#3#4#5{%
+ \pst@dimh=\wd\pst@hbox
+ \pst@dimg=\psk@href\pst@dimh
+ \advance\pst@dimg\pst@dimh
+ \divide\pst@dimg 2
+ \advance\pst@dimh-\pst@dimg
+ \ifdim\pst@dimg>\pst@dima
+ \xdef\next{\next\pst@dima=\number\pst@dimg sp\relax}%
+ \fi
+ \ifdim\pst@dimh>\pst@dimb
+ \xdef\next{\next\pst@dimb=\number\pst@dimh sp\relax}%
+ \fi
+ \pst@dimh=\psk@tnsep\relax
+ \ifdim\pst@dimh<\z@
+ \pst@dimh=-\pst@dimh
+ \else
+ \advance\pst@dimh#1%
+ \fi
+ \pssetlength\dimen@{#5}%
+ \ifdim\dimen@>#2\pst@hbox
+ \advance\pst@dimh\dimen@\relax
+ \else
+ \advance\pst@dimh#2\pst@hbox
+ \fi
+ \global\setbox\pst@boxg=\hbox{%
+ \box\pstree@box
+ #4\pst@dimh\hbox to\z@{\kern-\pst@dimg\unhbox\pst@hbox\hss}}%
+ \xdef\next{\next#1=\number#3\pst@boxg sp\relax}}
+\@namedef{pstree@tnput@l}{%
+ \pstree@tnput@@h\pst@dima{%
+ \hss
+ \lower\pst@dimg\box\pst@hbox
+ \kern\pst@dimh
+ \box\pstree@box}}
+\@namedef{pstree@tnput@r}{%
+ \pstree@tnput@@h\pst@dimb{%
+ \box\pstree@box
+ \kern\pst@dimh
+ \lower\pst@dimg\box\pst@hbox
+ \hss}}%
+\def\pstree@tnput@@h#1#2{%
+ \ifx\psk@tnyref\@empty
+ \pssetlength\pst@dimg\psk@vref
+ \else
+ \pst@dimg=\ht\pst@hbox
+ \advance\pst@dimg\dp\pst@hbox
+ \pst@dimg=\psk@tnyref\pst@dimg
+ \advance\pst@dimg-\dp\pst@hbox
+ \fi
+ \pst@dimh=\psk@tnsep\relax
+ \ifdim\pst@dimh<\z@
+ \multiply\pst@dimh\m@ne
+ \else
+ \advance\pst@dimh#1%
+ \fi
+ \xdef\next{%
+ \next#1=\number\pst@dimh sp\relax
+ \advance#1\number\wd\pst@hbox sp\relax}%
+ \global\setbox\pst@boxg=\hbox to\z@{#2}%
+ \ifdim\ht\pst@boxg>\pst@dimc
+ \xdef\next{\next\pst@dimc=\number\ht\pstree@box sp\relax}%
+ \fi
+ \ifdim\dp\pst@boxg>\pst@dimd
+ \xdef\next{\next\pst@dimd=\number\dp\pstree@box sp\relax}%
+ \fi}
+% \end{macrocode}
+% \end{macro}
+%
+%
+\catcode`\@=\TheAtCode\relax
+\endinput
+%% END pstree.tex
+
diff --git a/Master/texmf-dist/tex/latex/pst-tvz/pst-tvz.sty b/Master/texmf-dist/tex/latex/pst-tvz/pst-tvz.sty
new file mode 100644
index 00000000000..2d9019ba98c
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/pst-tvz/pst-tvz.sty
@@ -0,0 +1,7 @@
+%% $Id: pst-tvz.sty 64 2008-12-08 22:14:27Z herbert $
+\RequirePackage{pstricks}
+\ProvidesPackage{pst-tvz}[2010/08/28 package wrapper for pst-tvz.tex]
+\input{pst-tvz.tex}
+\ProvidesFile{pst-tvz.tex}
+ [\filedate\space \fileversion\space `pst-tvz' (tvz,hv)]
+\endinput