Debian Codegraph @

texmf-dist/doc/latex/treesvr/treedoc.latex209

raw
1 \documentstyle[trees,a4]{article}
2
3 \title{{\tt trees.sty}: A Macro for Drawing Binary \\
4 or Ternary Trees}
5
6 \author{Peter Vanroose \\
7 [email protected]}
8
9 \date{18 april 1990}
10
11 \begin{document}
12
13 \maketitle
14
15 The following macros let you draw a (binary or ternary) tree of any size.
16 For each "internal node", you only have to specify which are the descending
17 nodes, with a \verb|\branch| command (\verb|\tbranch| for ternary node.).
18 To this end, nodes are given a label (only used internally!). These macros
19 will give you some ideas on designing similar things for, e.g.,
20 digital circuits.
21
22 Trees are constructed with labels on the branches (default 0 and 1), and
23 with text (e.g., its name or value) on the nodes. The first parameter to
24 \verb|\branch| (0, 1, 2 or 3) determines the steepness of the branches.
25
26 Example:
27 \small
28 \begin{verbatim}
29 \begin{picture}(100,100)(-50,10)
30 \unitlength=2mm
31 \branchlabels ABC % 012 is the default
32 \root(2,10) 0. % root at absolute coordinate (2,10)
33 % its (internally used) label is 0
34 % the space before the 0 is obligatory
35 \branch2{16} 0:1,2. % node 0 (i.e., the root) has children 1 and 2
36 % the text "1.00" is written above it
37 % space is optional, :,. are obligatory
38 \leaf{4}{$u_1$} 1. % node 1 is a leaf
39 % "0.45" written above, "$u_1$" to the right
40 \branch2{12} 2:3,7. % branch to node 3 goes up, and has label A
41 \tbranch2{9} 3:4,5,6.
42 \leaf{4}{$u_3$}4. % the symbols 0--7 can be replaced by anything
43 \leaf{3}{$u_4$}5.
44 \leaf{2}{$u_5$}6.
45 \leaf{3}{$u_2$} 7.
46 \end{picture}
47 \end{verbatim}
48 \normalsize
49 will typeset something like:
50 \begin{flushleft}
51 \begin{picture}(100,100)(-50,10)
52 \unitlength=2mm
53 \branchlabels ABC
54 \root(2,10) 0.
55 \branch2{16} 0:1,2.
56 \leaf{4}{$u_1$} 1.
57 \branch2{12} 2:3,7.
58 \tbranch2{9} 3:4,5,6.
59 \leaf{4}{$u_3$}4.
60 \leaf{3}{$u_4$}5.
61 \leaf{2}{$u_5$}6.
62 \leaf{3}{$u_2$} 7.
63 \end{picture}
64 \end{flushleft}
65 \end{document}