summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/generic/pstricks/psd-tree.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/generic/pstricks/psd-tree.tex')
-rw-r--r--Master/texmf-dist/source/generic/pstricks/psd-tree.tex816
1 files changed, 816 insertions, 0 deletions
diff --git a/Master/texmf-dist/source/generic/pstricks/psd-tree.tex b/Master/texmf-dist/source/generic/pstricks/psd-tree.tex
new file mode 100644
index 00000000000..c7a7d78320e
--- /dev/null
+++ b/Master/texmf-dist/source/generic/pstricks/psd-tree.tex
@@ -0,0 +1,816 @@
+%% BEGIN psd-tree.tex
+
+\part{Trees\label{P-trees}}
+
+\Section{Overview}
+
+\File{pst-tree}
+The node and node connections are perfect tools for making trees, but
+positioning the nodes using "\rput" would be rather tedious.\footnote{%
+Unless you have a computer program that generates the coordinates.}
+The file "pstree.tex" / "pstree.sty" contains a high-level interface for
+making trees.
+
+The tree commands are
+\begin{Ex}
+ \object \pstree{<root>}{<successors>}
+ \object \psTree{<root>} <successors> \Main\endpsTree
+\end{Ex}
+These do the same thing, but just have different syntax. "\psTree" is the
+``long'' version.\footnote{%
+\LaTeX{} purists can write "\begin{psTree}" and "\end{psTree}" instead.}
+These macros make a box that encloses all the nodes, and whose baseline passes
+through the center of the root.
+
+Most of the nodes described in Section \ref{S-nodes} has a variant for use
+within a tree. These variants are called tree nodes, and are described in
+Section \ref{S-treenodes}.
+
+Trees and tree nodes are called \emph{tree objects}. The <root> of a tree
+should be a single tree object, and the <successors> should be one or more
+tree objects. Here is an example with only nodes:
+\begin{example**}
+ \pstree[radius=3pt]{\Toval{root}}{\TC* \TC* \TC* \TC*}
+\end{example**}
+There is no difference between a terminal node and a root node, other than
+their position in the \n\pstree{} command.
+
+Here is an example where a tree is included in the list of successors, and
+hence becomes subtree:
+\begin{example**}
+ \pstree[radius=3pt]{\Tp}{%
+ \TC*
+ \pstree{\TC}{\TC* \TC*}
+ \TC*}
+\end{example**}
+
+
+\Section{Tree Nodes}
+
+For most nodes described in Section \ref{S-nodes}, there is a variant for use
+in trees, called a tree node. 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, "\ovalnode" becomes "\Toval". Here is the list of such
+tree nodes:
+\begin{Ex}
+ \object \Tp`*[par]'
+ \object \Tc`*[par]'{dim}
+ \object \TC`*[par]'
+ \object \Tf`*[par]'
+ \object \Tdot`*[par]'
+ \object \Tr`*[par]'{stuff}
+ \object \TR`*[par]'{stuff}
+ \object \Tcircle`*[par]'{stuff}
+ \object \TCircle`*[par]'{stuff}
+ \object \Toval`*[par]'{stuff}
+ \object \Tdia`*[par]'{stuff}
+ \object \Ttri`*[par]'{stuff}
+\end{Ex}
+
+The syntax of a tree node is the same as of its corresponding ``normal'' node,
+except that:
+\begin{itemize}
+ \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 \n\Tr, set the \p{ref} parameter.
+\end{itemize}
+
+Figure \ref{allnodes} gives a reminder of what the nodes look like.
+
+\begin{figure}
+\begin{example*}
+ \small
+ \psset{armB=1cm, levelsep=3cm, treesep=-3mm,
+ angleB=-90, angleA=90, nodesepA=3pt}
+ \def\s#1{#1~{\tt\string#1}}
+ \def\b#1{#1{\tt\string#1}}
+ \def\psedge#1#2{\ncangle{#2}{#1}}
+ \psTree[treenodesize=1cm]{\Toval{Tree nodes}}
+ \s\Tp
+ \Tc{.5}~{\tt\string\Tc}
+ \s\TC
+ \psTree[levelsep=4cm,armB=2cm]{\Tp[edge=\ncline]}
+ \b\Tcircle
+ \s\Tdot
+ \TCircle[radius=1.2]{\tt\string\TCircle}
+ \Tn
+ \b\Toval
+ \b\Ttri
+ \b\Tdia
+ \endpsTree
+ \s\Tf
+ \b\Tr
+ \b\TR
+ \endpsTree
+\end{example*}
+\caption{The tree nodes.\label{allnodes}}
+\end{figure}
+
+The difference between "\Tr" and "\TR" (variants of "\rnode" and "\Rnode",
+respectively) is important with trees. Usually, you want to use "\TR" with
+vertical trees because the baselines of the text in the nodes line up
+horizontally. For example:
+\begin{example**}
+ $
+ \pstree[nodesepB=3pt]{\Tcircle{X}}{%
+ \TR{\tilde{\tilde{X}}}
+ \TR{x}
+ \TR{y}}
+ $
+\end{example**}
+Compare with this example, which uses \n\Tr:
+\begin{example**}
+ $
+ \pstree[nodesepB=3pt]{\Tcircle{X}}{%
+ \Tr{\tilde{\tilde{X}}}
+ \Tr{x}
+ \Tr{y}}
+ $
+\end{example**}
+
+There is also a null tree node:
+ \Mac \Tn
+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.
+\n\Tn{} 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:
+ \Mac \Tfan`*[par]'
+This draws a triangle whose base is
+\begin{Ex}
+ \Par{fansize=dim}
+\end{Ex}
+and whose opposite corner is the predecessor node, adjusted by the value of
+\p{nodesepA} and \p{offsetA}.
+For example:
+\begin{example**}
+ \pstree[dotstyle=oplus,dotsize=8pt,nodesep=2pt]{\Tcircle{11}}{%
+ \Tdot
+ \pstree{\Tfan}{\Tdot}
+ \pstree{\Tdot}{\Tfan[linestyle=dashed]}}
+\end{example**}
+
+
+\Section{Tree orientation}
+
+Trees can grow down, up, right or left, depending on the
+\begin{Ex}
+ \Par{treemode=D/U/R/L}
+\end{Ex}
+parameter.
+
+Here is what the previous example looks like when it grows to the right:
+\begin{example**}
+ \pstree[dotstyle=oplus,dotsize=8pt,nodesep=2pt,treemode=R]
+ {\Tcircle{11}}{%
+ \Tdot
+ \pstree{\Tfan}{\Tdot}
+ \pstree{\Tdot}{\Tfan[linestyle=dashed]}}
+\end{example**}
+
+You can change the \p{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{example**}
+ \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{example**}
+
+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{example**}
+ \pstree{\pstree[treemode=L]{\Tcircle{root}}{\Tr{B}}}{%
+ \Tr{A1}
+ \Tr{A2}}
+\end{example**}
+
+%%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{example**}
+ \psTree{\Tcircle{%
+ \pstree[treesep=0.4,levelsep=0.6,
+ nodesepB=-6pt]{\Tdot}{%
+ \TR{a} \TR{b}}}}
+ \TC
+ \TC
+ \endpsTree
+\end{example**}
+
+When the tree grows up or down, the successors are lined up from left to right
+in the order they appear in \n\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
+\begin{Ex}
+ \Par{treeflip=true/false}
+\end{Ex}
+let's you do this. For example:
+\begin{example**}
+ \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{example**}
+Note that I still have to go back and change the \p{treemode} of the subtree
+that used to grow to the left.
+
+
+\Section{The distance between successors}
+
+The distance between successors is
+\begin{Ex}
+ \Par{treesep=dim}
+\end{Ex}
+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
+\begin{Ex}
+ \Par{treefit=tight/loose}
+\end{Ex}
+parameter. Here are the two methods:
+\begin{description}
+ \item[tight] When \p{treefit=tight}, which is the default, \p{treesep} is
+ the minimum distance between each of the levels of the subtrees.
+ \item[loose] When \p{treefit=loose}, \p{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 subtrees, then
+ there is no difference between the two methods.}
+\end{description}
+
+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 \p{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{example**}
+% \psTree[radius=2pt,levelsep=1.5,xtreesep=.25cm] \TC* \\
+% \pstree{\TC*}{\TC* \TC*}
+% \pstree{\TC*}{\TC* \TC*}
+% \endpsTree
+%\end{example**}
+%with the spacing in
+%\begin{example**}
+% \psTree[radius=2pt,levelsep=1.5] \TC* \\
+% \pstree{\TC*}{\TC* \TC*}
+% \pstree{\TC*}{\TC* \TC*}
+% \endpsTree
+%\end{example**}
+
+Sometimes you want the spacing between the centers of the nodes to be regular
+even though the nodes have different sizes. If you set
+\begin{Ex}
+ \Par{treenodesize=dim}
+\end{Ex}
+to a non-negative value, then PSTricks sets the width (or height+depth for
+vertical trees) to \p{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{example**}
+ \pstree[nodesepB=-8pt,treenodesize=.85]{\Tc{3pt}}{%
+ \TR{$x=y$}
+ \TR{$x_1=y_1$}
+ \TR{$x_{11}=y_{11}$}}%$
+\end{example**}
+Compare with this example, where the spacing varies with the size of the
+nodes:
+\begin{example**}
+ \pstree[nodesepB=-8pt]{\Tc{3pt}}{%
+ \TR{$x=y$}
+ \TR{$x_1=y_1$}
+ \TR{$x_{11}=y_{11}$}}%$
+\end{example**}
+
+Finally, if all else fails, you can adjust the distance between two successors
+by inserting
+ \Mac \tspace{dim}
+between them:
+\begin{example**}
+ \pstree{\Tc{3pt}}{%
+ \Tdia{foo}
+ \tspace{-0.5}
+ \Toval{and}
+ \Ttri{bar}}
+\end{example**}
+
+\Section{Spacing between the root and successors}
+
+The distance between the center lines of the tree levels is:
+\begin{Ex}
+ \Par{levelsep=*dim}
+\end{Ex}
+
+If you want the spacing between levels to vary with the size of the levels,
+use the * convention. Then \p{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 ".aux" file if using
+\LaTeX, or to "\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{example}
+ \def\psedge#1#2{\ncdiagg[nodesep=3pt,angleA=180,armA=0]{#2}{#1}}
+ \pstree[treemode=R,levelsep=*1cm]
+ {\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{example}
+with this one, were the spacing between levels is fixed:
+\begin{example}
+ \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{example}
+
+%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{example**}
+% \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{example**}
+
+%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, "\pssucc" is equal to the name of the
+node, and "\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{LVerbatim}
+ \ncline{\pspred}{\pssucc}
+\end{LVerbatim}
+
+To save you the trouble of doing this for every node, each tree node executes
+\begin{LVerbatim}
+ \psedge{\pspred}{\pssucc}
+\end{LVerbatim}
+The default definition of "\psedge" is "\ncline", but you can redefine it as
+you please with "\def" or \LaTeX's "\renewcommand".
+
+For example, here I use \n\ncdiag, with \p{armA=0}, to get all the node
+connections to emanate from the same point in the predecessor:\footnote{%
+\LaTeX{} users can instead type:
+\begin{LVerbatim}
+ \renewcommand{\psedge}{\ncdiag[armA=0,angleB=180,armB=1cm]}
+\end{LVerbatim}
+}
+\begin{example}
+ \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{example}
+
+Here is an example with \n\ncdiagg. Note the use of a negative \p{armA} value
+so that the corners of the edges are vertically aligned, even though the nodes
+have different sizes:
+\begin{example}
+ $
+ \def\psedge#1#2{%
+ \ncdiagg[angleA=180, armA=-3cm,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{example}
+
+Another way to define \n\psedge{} is with the
+\begin{Ex}
+ \Par{edge=command}
+\end{Ex}
+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 \p{edge} parameter.
+\begin{example**}
+ \def\dedge{\ncline[linestyle=dashed]}
+ \pstree[treemode=U,radius=2pt]{\Tc{3pt}}{%
+ \TC*[edge=\dedge]
+ \pstree{\Tc{3pt}}{\TC*[edge=\dedge] \TC*}
+ \TC*}
+\end{example**}
+
+You can also set \n{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 \p{name} parameter. For example, here I connect two nodes
+on the same level:
+\begin{example**}
+ \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{example**}
+
+We conclude with the more examples.
+
+\begin{example**}
+ \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{example**}
+
+\begin{example**}
+ \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{example**}
+
+\begin{example**}
+ \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{example**}
+
+
+\Section{Edge and node labels}
+
+Right after a node, an edge has typically been drawn, and you can attach
+labels using \n\ncput\, \n\tlput, etc.
+
+With \n\tlput, \n\trput, \n\taput{} and \n\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{example**}
+ \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{example**}
+Within trees, the \p{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 \p{shortput=tab} within trees. This is a special
+\p{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]
+ "^" & \n\tlput & \n\taput \\
+ "_" & \n\trput & \n\tbput
+\end{tabular}
+\end{center}
+(The scheme is reversed if \p{treeflip=true}.)
+\begin{example**}
+ \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{example**}
+
+You can change the character abbreviations with
+ \Mac \MakeShortTab{<char1>}{<char2>}
+
+The "\n*put" commands can also give good results:
+\begin{example**}
+ \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{example**}
+
+You can put labels on the nodes using \n\nput. However, \n\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:
+ \Mac ~`*[par]'{stuff}
+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{example**}
+ \pstree[radius=2pt]{\Tc{3pt}\nput{45}{\pssucc}{root}}{%
+ \TC*~{$h$} \TC*~{$i$} \TC*~{$j$} \TC*~{$k$}}
+\end{example**}
+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
+ \Mac \MakeShortTnput{<char1>}
+If you find it confusing to use a single character, you can also use a command
+sequence. E.g.,
+\begin{LVerb}
+ \MakeShortTnput{\tnput}
+\end{LVerb}
+
+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:
+\begin{Ex}
+ \Par{tnpos=l/r/a/b}
+\end{Ex}
+\begin{example**}
+ \psframebox{%
+ \pstree{\Tc{3pt}~[tnpos=a,tndepth=0pt,radius=4pt]{root}}{%
+ \TC*~[tnpos=l]{$h$}
+ \TC*~[tnpos=r]{$i$}}}
+\end{example**}
+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
+\begin{Ex}
+ \Par{tnsep=<dim>}
+\end{Ex}
+When you leave the argument empty, which is the default, PSTricks uses the
+value of \p{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
+\begin{Ex}
+ \Par{tnheight=<dim>}(\string\ht\string\strutbox)
+\end{Ex}
+Thus, if you add labels to several nodes that are horizontally aligned, and if
+either these nodes have the same depth or \p{tnsep} is negative, and if the
+height of each of the labels is no more than \p{tnheight}, then the labels
+will also be aligned by their baselines. The default is "\ht\strutbox", which
+in most \TeX{} formats is the height of a typical line of text in the current
+font. Note that the value of \p{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
+\begin{Ex}
+ \Par{tndepth=<dim>}(\string\dp\string\strutbox)
+\end{Ex}
+
+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 \p{href} parameter.
+
+When labels are positioned on the left or right, the right or left edge of the
+label is positioned distance \p{tnsep} from the node. The vertical point that
+is aligned with the center of the node is set by
+\begin{Ex}
+ \Par{tnyref=<num>}
+\end{Ex}
+When you leave this empty, \p{vref} is used instead. Recall that \p{vref}
+gives the vertical \emph{distance} from the baseline. Otherwise, the
+\p{tnyref} parameter works like the \p{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:
+\begin{Ex}
+ \Par{bbl=dim}
+ \Par{bbr=dim}
+ \Par{bbh=dim}
+ \Par{bbd=dim}
+ \Par{xbbl=dim}
+ \Par{xbbr=dim}
+ \Par{xbbh=dim}
+ \Par{xbbd=dim}
+\end{Ex}
+The "x" versions increase the bounding box by <dim>, and the others set the
+bounding box to <dim>. 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
+\begin{Ex}
+ \Par{showbbox=true/false}
+\end{Ex}
+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{example**}
+ \psset{tpos=.6,showbbox=true}
+ \pstree[treemode=U]{\Tc{5pt}}{%
+ \TR{foo}^{left}
+ \TR{bar}_{right}}
+\end{example**}
+Here is how we fix it:
+\begin{example**}
+ \psset{tpos=.6,showbbox=true}
+ \pstree[treemode=U,xbbl=8pt,xbbr=14pt]{\Tc{5pt}}{%
+ \TR{foo}^{left}
+ \TR{bar}_{right}}
+\end{example**}
+Now we can frame the tree:
+\begin{example**}
+ \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{example**}
+We would have gotten the same result by changing the bounding box of the two
+terminal nodes.
+
+To skip levels, use
+\begin{Ex}
+ \object \skiplevel`*[par]'{nodes or subtrees}
+ \object \skiplevels`*[par]'{int} <nodes or subtrees> \string\endskiplevels
+\end{Ex}
+These are kind of like subtrees, but with no root node.
+\begin{example}
+ \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{example}
+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 \n\skiplevel{} commands instead of \n\skiplevels.
+
+\begin{example}
+ \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{example}
+
+\Section{The scope of parameter changes}
+
+\p{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 \p{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
+\n\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:
+\begin{Ex}
+ \Par{thistreesep=dim}
+ \Par{thistreenodesize=dim}
+ \Par{thistreefit=tight/loose}
+ \Par{thislevelsep=dim}
+\end{Ex}
+For example:
+\begin{example**}
+ \pstree[thislevelsep=.5cm,thistreesep=2cm,radius=2pt]{\Tc*{3pt}}{%
+ \pstree{\TC*}{\TC* \TC*}
+ \pstree{\TC*}{\TC* \TC*}}
+\end{example**}
+
+There are some things you may want set uniformly across a level in the tree,
+such as the \p{levelsep}. At level <n>, the command "\pstreehook<roman(n)>"
+(e.g., "\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 \p{levelsep} is changed for level 2, without having to set the
+\p{thislevelsep} parameter for each of the three subtrees that make of level
+2:
+\begin{example*}
+ \[
+ \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{example*}
+
+\endinput
+
+%% END psd-tree.tex