/usr/share/texlive/texmf-dist/tex/plain/treetex/treetex.tex is in texlive-plain-extra 2014.20141024-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 | % This is file treetex.tex of TreeTeX, Version 2.1 (May 23, 1989).
% For changes search for "vs. 2.1".
%
% TreeTeX is a public domain macro package for drawing
% trees with TeX. It may be freely distributed, provided
% that the following files are kept together:
%
% classes.tex, l_pic.tex, readme, tree_doc.aux, tree_doc.bbl
% tree_doc.dvi, tree_doc.tex, treetex.tex
%
% Copyright is with Anne Brueggemann-Klein and Derick Wood.
% Print tree_doc.dvi to get more information about TreeTeX.
%
% All remarks, bug reports etc. should be directed to
%
% Dr. Anne Brueggemann-Klein
% Institut fuer Informatik
% Rheinstr. 10--12
% 7800 Freiburg, West Germany
%
% email: abk@sun1.ruf.uni-freiburg.dbp.de
%
\catcode`\@=11
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Only for testing, delete later %%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\tracingonline=2 %
% \showboxbreadth=100 % Only for testing
% \showboxdepth=100 %
\newcount\cnta\newcount\cntb\newcount\cntc
\def\showlasttree{%
\g\cnta\count\l@stdiminfo
\g\cntb\cnta
\g\advance\cntb 5
\g\advance\cntb \count\l@sttreeheight
\g\advance\cntb \count\l@sttreeheight
\ifnum\count\l@sttreeheight=-1\relax
\g\advance\cntb by 2
\immediate\write16{Tree contour for dummy node:}
\else\immediate\write16{Tree contour:}%
\fi
\for\cntc:=\cnta\to\cntb\do\immediate\write16{\the\dimen\cntc}\od}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% TeX vs. LaTeX %%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\lplain{lplain} % Set \LaTeXtrue if TreeTeX is
\newif\ifLaTeX % used together with LaTeX,
\ifx\fmtname\lplain\LaTeXtrue % otherwise set \LaTeXfalse
\else\LaTeXfalse\fi % (LaTeX defines \fmtname=={lplain}).
\immediate\write16{This is TreeTeX, Version 2.1, for use with \ifLaTeX LaTeX%
\else plain TeX\fi.}
\ifLaTeX \let\lineseg\line % latex_picture is part of latex.tex,
\else \let\@line\line % so you don't need it if you use
\input l_pic % TreeTeX together with LaTeX. LaTeX
\let\lineseg\line % has the command \line for geometric
\let\line\@line % lines, and plain TeX has the same
\fi % command for lines of text. Because
% both versions of \line play an
% important role in the respective
% macro packages, we introduce a new
% command \lineseg in TreeTeX for the
% geometric lines, and \line will have
% the LaTeX-meaning if TreeTeX is used
% with LaTeX, and the plain \TeX
% meaning otherwise.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% General programming environment %%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\catcode`\@=11
\let\g\global
\def\gxdef{\global\xdef}
% The command \newcount is redefined such that it can be used
% inside a definition (i.e. it is no longer an \outer-command).
\def\newcount{\alloc@0\count\countdef\insc@unt}
% Implementing a for-loop (first argument must be a counter).
% Usage: \for<counter>:=<start value>\to<stop value>\do<operations>\od
% Semantics: the same as a PASCAL for-loop
% Precautions: Don't change the counter-value inside the loop!
% for-loops cannot be nested (nor can the \loop-commands!).
\def\for#1:=#2\to#3\do#4\od{%
\def\f@rcount{#1}\def\upp@rlimit{#3}\def\b@dy{#4}\f@rcount=#2\relax\dof@r}
\def\dof@r{\ifnum\f@rcount>\upp@rlimit\relax\let\n@xt\relax
\else\b@dy\advance\f@rcount\@ne\let\n@xt\dof@r\fi
\n@xt}
% \ex repeats a sequence of commands a predetermined number of times.
% Usage: \ex<number>\times<operations>\xe
% Semantics: <operations> is executed as often as <number> says
% Precautions: \ex commands cannot be nested.
\newcount\@xcount
\newcount\t@mes
\def\ex#1\times#2\xe{%
\@xcount1 \t@mes#1\def\b@dy{#2}\do@x}
\def\do@x{\ifnum\@xcount>\t@mes\let\n@xt\relax
\else\b@dy\advance\@xcount\@ne\let\n@xt\do@x\fi
\n@xt}
% \rect@ngle produces a rectangle with horizontal edge length #1, vertical
% edge length #2 and line thickness #3. The reference point is in the center of
% the rectangle. The width is 0pt.
\newskip\thickn@ss
\newskip\@nner
\newskip\@uter
\def\rect@ngle#1#2#3{\hbox to 0pt{%
\thickn@ss#3%
\g\@nner#2\g\advance\@nner-\thickn@ss
\g\divide\@nner\tw@
\g\@uter#2\g\advance\@uter\thickn@ss
\g\divide\@uter\tw@
\hskip 0pt minus .5fil%
\vrule height\@uter depth\@nner width\thickn@ss
\vrule height\@uter depth-\@nner width#1%
\hskip 0pt minus 1fil%
\vrule height-\@nner depth\@uter width#1%
\vrule height\@nner depth\@uter width\thickn@ss
\hskip 0pt minus .5fil%
}% \hbox
}% \def
% \s@ries takes two arguments. The first one is a name, say XXX, and
% the second is a series of arguments, devided by two slashs (//).
% \s@ries assigns this last series of arguments one after another to the
% control sequences \XXXi, \XXXii, and so on. Furthermore, a control
% sequence \XXX is defined, which takes a number k as its argument and
% expands to \XXXk', where k' is the roman numeral equivalent to k.
\def\s@ries#1#2{%
\g\t@mpcnta1
\gdef\t@mp{#1}%
\@ssign#2/\l@st % \l@st is a sentinal element
\expandafter\gdef\csname#1\endcsname##1{%
\csname#1\romannumeral##1\endcsname}%
}
\def\@ssign#1/#2{%
\expandafter\gdef\csname\t@mp\romannumeral\t@mpcnta\endcsname{#1}%
\g\advance\t@mpcnta\@ne
\ifx#2\l@st
\g\let\n@xt\relax
\else\g\let\n@xt\@ssign
\fi
\n@xt}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Allocation of internal registers %%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newdimen\leftdist
\newdimen\rightdist
\newbox\TeXTree
\newcount\sl@pe
\newcount\l@vels
\newcount\s@ze
\newbox\circleb@x
\newbox\squareb@x
\newbox\dotb@x
\newbox\triangleb@x
\newbox\textb@x
\newbox\frameb@x
\newdimen\circlew@dth
\newdimen\squarew@dth
\newdimen\dotw@dth
\newdimen\trianglew@dth
\newdimen\textw@dth
\newdimen\framew@dth
\newdimen\vd@st
\newdimen\hd@st
\newdimen\based@st
\newdimen\dummyhalfcenterdim@n
\newcount\t@mpcnta
\newcount\t@mpcntb
\newcount\t@mpcntc
\newcount\t@mpcntd
\newdimen\t@mpdima
\newdimen\t@mpdimb
\newdimen\t@mpdimc
\newbox\t@mpboxa
\newbox\t@mpboxb
\newbox\leftb@x
\newbox\rightb@x
\newbox\centerb@x
\newbox\beneathb@x
\newtoks\typ@
\newbox\centerb@@x
\newdimen\centerdim@n
\newdimen\halfcenterdim@n
\newdimen\mins@p
\newdimen\halfmins@p
\newdimen\tots@p
\newdimen\halftots@p
\newdimen\currs@p
\newdimen\adds@p
\newcount\l@ftht
\newcount\r@ghtht
\newcount\l@ftinfo
\newcount\r@ghtinfo
\newbox\l@ftbox
\newbox\r@ghtbox
\newif\ifr@ghthigher % true iff the right subtree is higher than the left one
\newif\ifadds@p
\newcount\@larg
\newcount\@rarg
\newif\ifl@fttop
\newif\ifl@ftonly
\newif\ifr@ghtonly
\newif\if@xt
\newif\ifl@ftedge
\newif\ifr@ghtedge
\newif\ifext@nded
\newdimen\lm@ff
\newdimen\rm@ff
\newdimen\lb@ff
\newdimen\rb@ff
\newdimen\lt@p
\newdimen\rt@p
\newcount\l@sttreebox % These four counter allocations have been copied
\newcount\l@sttreeheight % to this position from the \Tree command
\newcount\l@stdiminfo % (vs. 2.1). Previously each tree allocated its own
\newcount\l@sttreetype % counters, using up counters for nothing.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Slope handling for the edges %%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% The picture environment of LaTeX gives us a choice of 24 positive
% slopes for lines (i.e. edges of trees in this context),
% including vertical ones. The slope of a line is
% given by an x- and an y-value, see L. Lamport, LaTeX, pp. 105f for
% further details. x/y can have the following values (decreasing amount
% of slope): 0/1 1/6 1/5 1/4 1/3 2/5 1/2 3/5 2/3 3/4 4/5 5/6 1/1 6/5 5/4
% 4/3 3/2 5/3 2/1 5/2 3/1 4/1 5/1 6/1.
% The x-values are allocated to \xv@li, \xv@lii,..., \xv@lxxiv, and
% they can conveniently be accessed by the command \xv@l{<number>}.
% The same holds for the y-values.
\s@ries{xv@l}{0//1//1//1//1//2//1//3//2//3//4//5//1//6//%
5//4//3//5//2//5//3//4//5//6}
\s@ries{yv@l}{1//6//5//4//3//5//2//5//3//4//5//6//1//5//%
4//3//2//3//1//2//1//1//1//1}
% \hv@ldef calculates \hv@li, \hv@lii,..., \hv@lxxiv for a given dimen
% \vd@st according to the following picture:
%
% /-|
% / |
% / |
% / |
% / |\vd@st
% / |
% / |
% / -| |
% / |\yv@l|
% / _| _|
%
% |___|
% \xv@l
% |_________|
% .5\hv@l
%
% \hv@li,..., \hv@lxxiv are initialized in \beginTree, when the
% actual value for \vd@st is known (\vd@st will depend on the point size of
% the picture). As before, these values can conveniently be accessed by the
% command \hv@l{<number>}.
\def\hv@ldef{%
\for\t@mpcnta:=1\to24%
\do\g\t@mpdima\vd@st\g\multiply\t@mpdima by\xv@l{\t@mpcnta}%
\g\divide\t@mpdima by\yv@l{\t@mpcnta}\g\multiply\t@mpdima by 2
\expandafter\gxdef\csname hv@l\romannumeral\t@mpcnta\endcsname{%
\the\t@mpdima}%
\od}
\def\hv@l#1{\csname hv@l\romannumeral#1\endcsname}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Naming trees %%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% A TeXtree is stored in TeX's internal registers in the following way:
% A TeXtree of height h has associated to itself the following internal
% TeX registers: a box, holding the graphical appearance of the tree,
% a consecutive number of 6+2h internal dimen registers, holding the
% additional information about the contour of the tree, a counter
% holding the height h of the tree, a counter holding the first
% position of the additional information registers, and a toks register
% holding the type of the node (circle, square, dot, triangle, text, or frame).
% The height and position
% of additional information are stored in consecutive order for
% consecutive trees. The same is true for the boxes and toks.
% Four key numbers, the register numbers (addresses)
% for the height, diminfo, box, and type
% of a tree, enable you to access all information which is stored about the
% tree. For the last tree on the stack, the four key numbers are stored in the
% counters \l@sttreeheight, \l@stdiminfo, \l@sttreebox, and \l@sttreetype,
% the key numbers for the next tree are \l@sttreeheight-2, \l@stdiminfo-2,
% \l@sttreebox-1, and \l@sttreetype-1, and so on.
% The macro \n@metree gives names to some registers associated with the tree.
% The tree to be named is specified by its four key numbers. \n@metree takes
% five arguments, namely the keynumbers for height, info, box and type of the
% tree, and the name to be given to the tree. If the tree gets the name XXX and
% the key numbers are h, i, b, and t, the commands on the left side of the
% following list get the meaning on the right side.
% \XXXht <--- \count h
% \XXXinfo <--- \count i
% \XXXbox <--- b
% \XXXtype <--- \toks t
% \XXXlmoff <--- \dimen f where f is the address stored
% in \count i
% \XXXrmoff <--- \dimen (f+1)
% \XXXlboff <--- \dimen (f+2)
% \XXXrboff <--- \dimen (f+3)
% \XXXltop <--- \dimen (f+4)
% \XXXrtop <--- \dimen (f+5)
% \XXXloff <--- \dimen (f+4+2g) where g is the height stored in
% \count h, i.e. \dimen (f+4+2g)
% holds loff(1) of the tree, if g>0
% \XXXroff <--- \dimen (f+5+2g)
% The macro \pr@vioustree sets \l@sttreeheight, \l@stdiminfo,
% \l@sttreebox and \l@sttreetype to the key numbers of the previous tree
% and gives the name `l@st' to this tree.
% The macro \@ddname which has two names n1 and n2 as arguments, gives
% the tree with name n1 the additional name n2.
% The macro \n@mel@st gives the name `l@st' to the tree with the
% key numbers \l@sttreeheight, \l@stdiminfo, \l@sttreebox and \l@sttreetype.
% The macro \n@xttree sets \l@sttreebox, \l@sttreeheight, \l@stdiminfo,
% \count\l@stdiminfo, and \l@sttreetype to the next free position.
% The macro \@ppenddummy pushs a dummy onto the stack and names it `l@st'.
% The dummy has height -1, its box is the empty box, its type is circle,
% and all dimensions are 0pt.
% \p@s#1#2#3 sets counter #1 to position #2 of tree #3. #1 must be a counter,
% #3 must be a name for the tree. If the tree has the name XXX, \XXXinfo
% must be a number holding the first position of the dimen-parameters of
% the tree and \XXXht must hold the height of the tree.
% #2 must be one of the following control sequences indicating the
% desired position: \lmoff, \rmoff, \lboff, \rboff, \ltop, \rtop, \loff, or
% \roff. \loff and \roff give the left resp. right offset of the *top*
% level of the tree.
\def\p@s#1#2#3{%
\g#1\csname#3info\endcsname
\gxdef\t@mp{\csname#3ht\endcsname}%
\ifnum\t@mp<0 \gxdef\t@mp{0}\fi
#2{#1}%
}
\chardef\@lmoff0 \chardef\@rmoff1 \chardef\@ltop4 \chardef\@rtop5
\chardef\@lboff2 \chardef\@rboff3 \chardef\@loff4 \chardef\@roff5
\def\lmoff#1{\g\advance#1 by\@lmoff}
\def\rmoff#1{\g\advance#1 by\@rmoff}
\def\lboff#1{\g\advance#1 by\@lboff}
\def\rboff#1{\g\advance#1 by\@rboff}
\def\ltop#1{\g\advance#1 by\@ltop}
\def\rtop#1{\g\advance#1 by\@rtop}
\def\loff#1{\g\advance#1 by\@loff\g\advance#1 by\t@mp
\g\advance#1 by\t@mp\relax}
\def\roff#1{\g\advance#1 by\@roff\g\advance#1 by\t@mp
\g\advance#1 by\t@mp\relax}
% \n@meinfo#1 defines for an argument XXX (name of a tree) \XXXlmoff,
% \XXXrmoff, ... as lmoff(XXX), rmoff(XXX),... .
% The following arguments will be used: l@ft, r@ght, l@st,
% m@n, and m@x.
\def\n@meinfo#1{%
\n@me@nfo{#1}{lmoff}\n@me@nfo{#1}{rmoff}%
\n@me@nfo{#1}{lboff}\n@me@nfo{#1}{rboff}%
\n@me@nfo{#1}{ltop}\n@me@nfo{#1}{rtop}%
\n@me@nfo{#1}{loff}\n@me@nfo{#1}{roff}%
}
\def\n@me@nfo#1#2{%
\p@s\t@mpcnta{\csname#2\endcsname}{#1}%
\expandafter\gxdef\csname#1#2\endcsname{\dimen\the\t@mpcnta}}
\def\n@metree#1#2#3#4#5{%
\expandafter\gxdef\csname#5ht\endcsname{\count\the#1}%
\expandafter\gxdef\csname#5info\endcsname{\count\the#2}%
\expandafter\gxdef\csname#5box\endcsname{\the#3}%
\expandafter\gxdef\csname#5type\endcsname{\toks\the#4}%
\n@meinfo{#5}%
}
\chardef\@cntoff3 \chardef\@boxoff1 \chardef\@dimoff2 \chardef\@typeoff1
\def\pr@vioustree{%
\g\advance\l@sttreeheight by-\@cntoff
\g\advance\l@stdiminfo by-\@cntoff
\g\advance\l@sttreetype by-\@cntoff
\g\advance\l@sttreebox by-\@boxoff
\n@mel@st
}
\def\@ddname#1#2{%
\expandafter\gxdef\csname#2ht\endcsname{\csname#1ht\endcsname}%
\expandafter\gxdef\csname#2info\endcsname{\csname#1info\endcsname}%
\expandafter\gxdef\csname#2type\endcsname{\csname#1type\endcsname}%
\expandafter\gxdef\csname#2box\endcsname{\csname#1box\endcsname}%
\n@meinfo{#2}%
}
\def\n@xttree{%
\p@s\t@mpcnta\loff{l@st}\g\advance\t@mpcnta by\@dimoff
\g\advance\l@sttreeheight by\@cntoff
\g\advance\l@stdiminfo by\@cntoff
\g\advance\l@sttreetype by\@cntoff
\g\advance\l@sttreebox by\@boxoff
\g\count\l@stdiminfo\t@mpcnta
}
\def\@ppenddummy{% pushs a dummy onto the stack and names it `l@st'
% The dummy has height -1, its box is the empty box, the type
% is circle, and all dimensions are 0pt.
\n@xttree \g\count\l@sttreeheight-\@ne\n@mel@st
\l@sttype{circle}%
\g\setbox\l@stbox\copy\voidb@x
\g\l@stlmoff=0pt\g\l@strmoff=0pt\g\l@stlboff=0pt\g\l@strboff=0pt%
\g\l@stltop=0pt\g\l@strtop=0pt\g\l@stloff=0pt\g\l@stroff=0pt%
}
\def\g@tchildren{% enables us to talk about the left and the right child
% (names l@ft resp. r@ght) and the smaller and the larger
% child (names m@n resp. m@x)
\ifl@fttop\@ddname{l@st}{l@ft}%
\pr@vioustree
\@ddname{l@st}{r@ght}%
\else\@ddname{l@st}{r@ght}%
\pr@vioustree
\@ddname{l@st}{l@ft}%
\fi
\ifnum\r@ghtht>\l@ftht\relax
\r@ghthighertrue
\@ddname{r@ght}{m@x}%
\@ddname{l@ft}{m@n}%
\else\r@ghthigherfalse
\@ddname{l@ft}{m@x}%
\@ddname{r@ght}{m@n}%
\fi
}
\def\n@mel@st{%
\n@metree\l@sttreeheight\l@stdiminfo\l@sttreebox\l@sttreetype{l@st}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Initialization of the tree environment %%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\beginTree{%
\begingroup
\unitlength 1pt%
\divide\unitlength by 65536
\l@sttreebox\count14
\l@sttreeheight\count10
\advance\l@sttreeheight by \@ne
\count\l@sttreeheight=-1
\l@stdiminfo\l@sttreeheight
\advance\l@stdiminfo by \@ne
\count\l@stdiminfo\count11
\advance\count\l@stdiminfo by -5
\l@sttreetype\l@stdiminfo
\advance\l@sttreetype by\@ne
\count\l@sttreetype\count15
\n@mel@st\ignorespaces
}
\let\Tree\beginTree
\def\endTree{%
\g\leftdist-\l@stlmoff\g\advance\leftdist by \l@stltop
\g\rightdist\l@strmoff\g\advance\rightdist by\l@strtop
\g\setbox\TeXTree\box\l@stbox\endgroup\ignorespaces}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Specification of nodes %%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% A node is defined by the command \node{<specifications>}.
% <specifications> defines the labels, graphical appearence and the order
% of the node and the thickness of the edges.
% Labels are defined by the commands \lft, \rght, \cntr,
% and \bnth. The specification of empty labels may be omitted.
% The graphical appearence is defined by the command \type{<type>}.
% <type> can have the values `circle', `square', `dot',
% `triangle', 'text', or 'frame'. The thickness of the edges is defined by
% \leftthick and \rightthick that give thick edges instead of the
% normal thin ones. Furthermore,
% the order of the node is given by the following commands:
% \external (if the node is an external node), \leftonly (if the node has a
% left successor only), \rightonly (analogous), \unary (if the node is an
% unary one), and \lefttop (the
% node which has been defined before this one, is supposed to be the left
% successor instead of the right one).
% Default: two children, no labels, type circle, thin edges,
% left child has been entered first.
\def\th@ck{\let\@linefnt\tenlnw
\@wholewidth\fontdimen8\tenlnw\@halfwidth.5\@wholewidth}
\def\leftthick{\g\let\l@ftthick\th@ck}
\def\rightthick{\g\let\r@ghtthick\th@ck}
\def\lft#1{\g\setbox\leftb@x\hbox{#1\ }}
\def\rght#1{\g\setbox\rightb@x\hbox{\ #1}}
\def\cntr#1{\g\setbox\centerb@x\hbox{#1\strut}}
\def\bnth#1{\g\setbox\beneathb@x\hbox to0pt{\hss\strut#1\hss}}
\def\type#1{%
\g\setbox\centerb@@x\copy\csname#1b@x\endcsname
\g\centerdim@n\csname#1w@dth\endcsname
\typ@{#1}%
\g\halfcenterdim@n=.5\centerdim@n}
\def\ext@nded{\g\ext@ndedfalse} % This definition must precede
% \input TreeTeX.sty (outdated now!)
\def\node#1{%
%%% Initialization (node type and labels), defaults and actual values
\g\setbox\leftb@x\copy\voidb@x
\g\setbox\rightb@x\copy\voidb@x
\g\setbox\centerb@x\copy\voidb@x
\g\setbox\beneathb@x\copy\voidb@x
\type{circle}%
\g\l@fttopfalse\g\l@ftonlyfalse\g\l@ftedgetrue
\g\r@ghtonlyfalse\g\r@ghtedgetrue\g\@xtfalse\ext@nded\n@dummy
\g\let\l@ftthick\relax\g\let\r@ghtthick\relax
#1%
\@pdcenter
\d@mmy
\n@de
\ignorespaces
}
\def\@pdcenter{\csname\the\typ@ @cntr\endcsname}
\let\circle@cntr\relax
\let\square@cntr\relax
\let\triangle@cntr\relax
\let\dot@cntr\relax
\def\text@cntr{%
\g\centerdim@n\wd\centerb@x
\g\halfcenterdim@n.5\centerdim@n}
\def\frame@cntr{%
\g\setbox\centerb@x\hbox{\ \unhcopy\centerb@x\ }
\g\centerdim@n\wd\centerb@x
% \g\advance\centerdim@n\fontdimen2\font
\g\halfcenterdim@n.5\centerdim@n
\g\setbox\centerb@@x\rect@ngle{\centerdim@n}{\squarew@dth}{.4pt}}
\def\leftonly{\g\l@ftonlytrue\g\r@ghtedgefalse\g\let\d@mmy\l@ftdummy}
\def\rightonly{\g\r@ghtonlytrue\g\l@ftedgefalse\g\let\d@mmy\r@ghtdummy}
\def\unary{\g\r@ghtedgefalse\g\let\d@mmy\@ndummy}
\def\external{\g\@xttrue\g\l@ftedgefalse\g\r@ghtedgefalse\g\let\d@mmy\@xtdummy}
\def\lefttop{\g\l@fttoptrue}
\def\@xtdummy{%
\@ppenddummy
\g\l@strtop-\halfmins@p
\@ppenddummy
\g\l@stltop-\halfmins@p
}
\def\n@dummy{\g\let\d@mmy\relax}
\def\l@ftdummy{% cf. \g@tposition
\@ppenddummy
\g\l@stltop=\dummyhalfcenterdim@n
\g\l@strtop=\dummyhalfcenterdim@n
}
\def\r@ghtdummy{% cf. \g@tposition
\lefttop
\@ppenddummy
\g\l@stltop=\dummyhalfcenterdim@n
\g\l@strtop=\dummyhalfcenterdim@n
}
\def\@ndummy{%
\g\t@mpdima\l@strtop\relax
\@ppenddummy
\g\l@stltop-\mins@p\g\advance\l@stltop by-\t@mpdima
\g\l@strtop=\t@mpdima
}
\def\n@de{%
\g@tposition % naming children and calculating \sl@pe and \tots@p
\g@tlt@p\g@trt@p % calculating \lt@p and \rt@p
\g@tlm@ff\g@trm@ff % calculating \lm@ff and \rm@ff
\g@tlb@ff\g@trb@ff % calculating \lb@ff and \rb@ff
\@pdlroff % updating loff and roff for all levels but the top one
\@pdloffl\@pdroffl % updating loff(1) and roff(1) of the parent tree
\@pddim % updating ltop, rtop, lmoff, rmoff, lboff, and rboff
\@pdinfo\@pdht % updating diminfo and treeheight
\@pdbox % updating treebox
\@pdtype % updating type
\n@mel@st % giving the name `l@st' to the new tree
\ignorespaces
}
\def\g@tposition{% naming children and calculating \sl@pe, \tots@p, and node offsets
\g@tchildren\c@lcsep\c@lcslope\c@lcoffsets
\ifext@nded\relax
\else\ifl@ftonly\g\r@ghtrtop=-\tots@p
\g\advance\r@ghtrtop by\l@ftrtop
\fi
\ifr@ghtonly\g\l@ftltop=-\tots@p
\g\advance\l@ftltop by\r@ghtltop
\fi
\fi % cf. \l@ftdummy and \r@ghtdummy
}
\def\@pdinfo{% updating diminfo
\g\l@stinfo=\m@xinfo\relax
}
\def\@pdht{% updating treeheight
\g\l@stht=\m@xht
\g\advance\l@stht by\@ne
}
\def\@pdtype{% updating type
\g\l@sttype\typ@
}
\def\g@tlt@p{% calculating \lt@p
\g\lt@p\wd\leftb@x\g\advance\lt@p by\halfcenterdim@n
}
\def\g@trt@p{% calculating \rt@p
\g\rt@p\wd\rightb@x\g\advance\rt@p by\halfcenterdim@n
}
\def\g@tlm@ff{% calculating \lm@ff
% \lm@ff:=lmoff(left tree)-ltop(left tree)
% -.5\tots@p+\lt@p
\g\lm@ff\l@ftlmoff
\g\advance\lm@ff by-\l@ftltop
\g\advance\lm@ff by-\halftots@p
\g\advance\lm@ff by\lt@p\relax
% if ht(left tree) < ht(right tree)
% \t@mpdima:=lmoff(right tree)-ltop(right tree)+.5\tots@p+\lt@p
% \lm@ff:=min(\lm@ff,\t@mpdima) fi
\ifnum\l@ftht<\r@ghtht\relax
\g\t@mpdima\r@ghtlmoff
\g\advance\t@mpdima by-\r@ghtltop
\g\advance\t@mpdima by\halftots@p
\g\advance\t@mpdima by\lt@p\relax
\ifdim\t@mpdima<\lm@ff\relax
\g\lm@ff\t@mpdima
\fi
\fi
% \lm@ff:=min(\lm@ff,0pt)
\ifdim0pt<\lm@ff\relax
\g\lm@ff=0pt%
\fi
}
\def\g@trm@ff{% calculating \rm@ff
% analog to lm@ff
% \rm@ff:=rmoff(right tree)+rtop(right tree)
% +.5\tots@p-\rt@p
\g\rm@ff\r@ghtrmoff
\g\advance\rm@ff by\r@ghtrtop
\g\advance\rm@ff by\halftots@p
\g\advance\rm@ff by-\rt@p\relax
% \t@mpdima:=rmoff(left tree)+rtop(left tree)-.5\tots@p-\rt@p
\ifnum\r@ghtht<\l@ftht\relax
\g\t@mpdima\l@ftrmoff
\g\advance\t@mpdima by\l@ftrtop
\g\advance\t@mpdima by-\halftots@p
\g\advance\t@mpdima by-\rt@p\relax
\ifdim\t@mpdima>\rm@ff\relax
\g\rm@ff\t@mpdima
\fi
\fi
% \rm@ff:=max(\rm@ff,0pt)
\ifdim0pt>\rm@ff\relax
\g\rm@ff=0pt
\fi
}
\def\g@tlb@ff{% calculating \lb@ff
% \lb@ff:=lboff(right tree)-ltop(right tree)+.5\tots@p+\lt@p
% resp.:=lboff(left tree)-ltop(left tree)
% -.5\tots@p+\lt@p
\if@xt\g\lb@ff0pt%
\else\ifnum\l@ftht<\r@ghtht\relax
\g\lb@ff\r@ghtlboff
\g\advance\lb@ff by-\r@ghtltop
\g\advance\lb@ff by\halftots@p
\g\advance\lb@ff by\lt@p\relax
\else\g\lb@ff\l@ftlboff
\g\advance\lb@ff by-\l@ftltop
\g\advance\lb@ff by-\halftots@p
\g\advance\lb@ff by\lt@p\relax
\fi
\fi
}
\def\g@trb@ff{% calculating \rb@ff
% \rb@ff:=rboff(left tree)+rtop(left tree)-.5\tots@p-\rt@p
% resp.:=rboff(right tree)+rtop(right tree)
% +.5\tots@p-\rt@p
\if@xt\g\rb@ff0pt%
\else\ifnum\r@ghtht<\l@ftht\relax
\g\rb@ff\l@ftrboff
\g\advance\rb@ff by\l@ftrtop
\advance\rb@ff by-\halftots@p
\g\advance\rb@ff by-\rt@p\relax
\else\g\rb@ff\r@ghtrboff
\g\advance\rb@ff by\r@ghtrtop
\g\advance\rb@ff by\halftots@p
\g\advance\rb@ff by-\rt@p\relax
\fi
\fi
}
\def\@pdlroff{% updating loff and roff for all levels but the top one
% if right tree higher \t@mpdima:=-ltop(right tree)
% \t@mpdimb:=lboff(left tree)-ltop(left tree)
% % \t@mpdimb holds the offset between the node
% % and the left edge of the bottom of the left tree
% else \t@mpdima:=rtop(left tree)
% \t@mpdimb:=lboff(right tree)+rtop(right tree)
% % substitute left by right
% fi
\ifr@ghthigher\g\t@mpdima-\r@ghtltop\relax
\g\t@mpdimb\l@ftlboff
\g\advance\t@mpdimb by-\l@ftltop\relax
\else\g\t@mpdima\l@ftrtop\relax
\g\t@mpdimb\r@ghtlboff
\g\advance\t@mpdimb by\r@ghtrtop\relax
\fi
\ifr@ghthigher\p@s\t@mpcnta\loff{m@n}% pointer to loff(1) of smaller tree
\p@s\t@mpcntb\loff{m@x}% pointer to loff(1) of larger tree
\else\p@s\t@mpcnta\roff{m@n}% pointer to roff(1) of smaller tree
\p@s\t@mpcntb\roff{m@x}% pointer to roff(1) of larger tree
\fi % if the right tree is the higher one you have to shift
% the left profile of the smaller tree, otherwise the
% right one
% For every level, \t@mpdima contains the offset between the node of the
% higher tree and the inner edge of the next level. Furthermore, if the
% right tree is the higher one, the left profile of the left tree becomes
% the upper part of the left profile of the parent tree, otherwise
% substitute `left' by `right.'
\ex\m@nht\times
\g\advance\t@mpdima by\dimen\t@mpcntb
\g\dimen\t@mpcntb\dimen\t@mpcnta
\g\advance\t@mpcnta by-\@dimoff
\g\advance\t@mpcntb by-\@dimoff\relax
\xe
% The link between the last outer level of the smaller tree and the next
% level of the higher one:
% \dimen\t@mpcntb:=\dimen\t@mpcntb+\t@mpdima+\tots@p-\t@mpdimb
% if left tree is smaller than right tree
% resp.\dimen\t@mpcntb+\t@mpdima-\tots@p-\t@mpdimb
% if right tree is smaller than left tree
\ifnum\m@xht=\m@nht\relax
\else\g\advance\dimen\t@mpcntb by\t@mpdima
\ifnum\l@ftht<\r@ghtht\relax
\g\advance\dimen\t@mpcntb by\tots@p
\else\g\advance\dimen\t@mpcntb by-\tots@p
\fi
\g\advance\dimen\t@mpcntb by-\t@mpdimb
\fi
}
\def\@pdloffl{% updating loff(1) of parent tree
% loff(1) of parent tree:=+\lt@p-.5\tots@p-ltop(left tree)
\p@s\t@mpcnta\loff{m@x}%
\g\advance\t@mpcnta by \@dimoff\relax % pointer to loff(0) of parent tree
\g\dimen\t@mpcnta\lt@p
\g\advance\dimen\t@mpcnta by-\halftots@p
\g\advance\dimen\t@mpcnta by-\l@ftltop\relax
}
\def\@pdroffl{% updating roff(1) of parent tree
% roff(l) of parent tree:=-\rt@p+.5\tots@p+rtop(right tree)
\p@s\t@mpcnta\roff{m@x}%
\g\advance\t@mpcnta by \@dimoff\relax % pointer to roff(0) of parent tree
\g\dimen\t@mpcnta-\rt@p
\g\advance\dimen\t@mpcnta by\halftots@p
\g\advance\dimen\t@mpcnta by\r@ghtrtop\relax
}
\def\@pddim{% updating ltop, rtop, lmoff, rmoff, lboff, and rboff
\g\m@xlmoff=\lm@ff\g\m@xrmoff=\rm@ff
\g\m@xlboff=\lb@ff\g\m@xrboff=\rb@ff
\g\m@xltop=\lt@p\g\m@xrtop=\rt@p
}
\def\@pdbox{% pushing the nodebox on the stack: updating treebox
\g\@xarg\xv@l\sl@pe\g\@yarg\yv@l\sl@pe
\ifnum\sl@pe=1 % vertical edge
\g\t@mpdima\vd@st
\g\advance\t@mpdima by-\y@ff\typ@
\g\advance\t@mpdima by-\y@ff\l@fttype
\g\@larg\t@mpdima % \@larg is a number register!
\g\t@mpdima\vd@st
\g\advance\t@mpdima by-\y@ff\typ@
\g\advance\t@mpdima by-\y@ff\r@ghttype
\g\@rarg\t@mpdima % \@rarg is a number register!
\else\g\t@mpdima\halftots@p
\g\advance\t@mpdima by-\x@ff\typ@
\g\advance\t@mpdima by-\x@ff\l@fttype
\g\@larg\t@mpdima % \@larg is a number register!
\g\t@mpdima\halftots@p
\g\advance\t@mpdima by-\x@ff\typ@
\g\advance\t@mpdima by-\x@ff\r@ghttype
\g\@rarg\t@mpdima % \@rarg is a number register!
\fi
\g\setbox\l@sttreebox\hbox{%
\ifvoid\leftb@x\relax
\else\hskip-\halfcenterdim@n\hskip-\wd\leftb@x
\unhcopy\leftb@x\hskip\halfcenterdim@n
\fi
\ifvoid\centerb@x\relax
\else\g\t@mpdima-.5\wd\centerb@x\hskip\t@mpdima
\unhbox\centerb@x\hskip\t@mpdima
\fi
\ifvoid\rightb@x\relax
\else\g\t@mpdima-\wd\rightb@x\hskip\halfcenterdim@n
\unhbox\rightb@x\hskip\t@mpdima\hskip-\halfcenterdim@n
\fi
\raise\based@st\copy\centerb@@x
\if@xt\relax
\lower\s@ze pt\hbox to0pt{\hss\unhbox\beneathb@x\hss}%
\else\hskip-\halftots@p
\lower\vd@st\box\l@ftbox
\ifl@ftedge\drawl@ftedge\else\hskip\halftots@p\fi
\ifr@ghtedge\drawr@ghtedge\else\hskip\halftots@p\fi
\lower\vd@st\box\r@ghtbox
\hskip-\halftots@p
\fi
}% of hbox
}
\def\drawl@ftedge{%
\hskip\x@ff\l@fttype
\g\t@mpdimc\y@ff\l@fttype\g\advance\t@mpdimc by\based@st
\g\advance\t@mpdimc-\vd@st
\raise\t@mpdimc
\hbox{\l@ftthick\lineseg(\@xarg,\@yarg){\@larg}}%
\hskip\x@ff\typ@
}
\def\drawr@ghtedge{%
\hskip\x@ff\typ@
\g\t@mpdimc\vd@st
\g\advance\t@mpdimc by \based@st
\g\advance\t@mpdimc by -\y@ff\typ@\relax
\g\advance\t@mpdimc by- \vd@st
\raise\t@mpdimc
\hbox{\r@ghtthick\lineseg(\@xarg,-\@yarg){\@rarg}}%
\hskip\x@ff\r@ghttype
}
\def\x@ff#1{%
\csname\the#1x@ff\endcsname\sl@pe
}
\def\y@ff#1{%
\csname\the#1y@ff\endcsname\sl@pe
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Calculating the separation of subtrees %%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \c@lcslope will calculate the required slope of the edges
% when the nodes are to be \vd@st apart vertically
% and at least \tots@p apart horizontally. This slope is returned by
% the value of the counter \sl@pe (a number between 1 and 23).
% Furthermore, \tots@p is updated in order to fit to this slope.
\def\c@lcslope{%
\g\sl@pe1
\loop
\ifdim\hv@l\sl@pe < \tots@p
\g\advance\sl@pe by1
\repeat
\g\tots@p\hv@l\sl@pe
\g\halftots@p.5\tots@p}
\def\c@lcsep{%
%%% \tots@p:=\mins@p + rtop(left tree) + ltop(right tree)
%%% \currs@p:=\mins@p
\g\tots@p\mins@p
\g\advance\tots@p by\l@ftrtop
\g\advance\tots@p by\r@ghtltop\relax
\g\currs@p\mins@p
%%% \t@mpcnta:= pointer to roff(0) of left tree
%%% \t@mpcntb:= pointer to loff(0) of right tree
\p@s\t@mpcnta\roff{l@ft}%
\p@s\t@mpcntb\loff{r@ght}%
%%% Calculate \currs@p and update \tots@p for each level of the
%%% smaller tree
%%% If at any level the subtrees are as close or closer than at
%%% the level of their roots, they will be moved apart by the additional
%%% amount of \adds@p
\g\adds@pfalse
\g\t@mpcntc\m@nht
\ex\t@mpcntc\times
\g\advance\currs@p by-\dimen\t@mpcnta
\g\advance\currs@p by \dimen\t@mpcntb
\ifdim\mins@p<\currs@p
\else\g\adds@ptrue
\fi
\ifdim\currs@p<\mins@p
\g\advance\tots@p by\mins@p
\g\advance\tots@p by -\currs@p
\g\currs@p\mins@p
\fi
\g\advance\t@mpcnta by -\@dimoff
\g\advance\t@mpcntb by -\@dimoff
\xe
\ifadds@p\g\advance\tots@p by\adds@p\fi}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Predefined trees %%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \tri@ngle produces a triangle which covers \l@vels many level of a tree.
% The slope of the edges is given by \sl@pe, the reference point of the
% triangle is in the top, the width is 0pt.
\def\tri@ngle{%
\vtop{\g\@xarg\xv@l\sl@pe \g\@yarg\yv@l\sl@pe
\g\t@mpdimc\l@vels\vd@st
\g\advance\t@mpdimc by .5\squarew@dth
\g\multiply\t@mpdimc\xv@l\sl@pe
\g\divide\t@mpdimc\yv@l\sl@pe
\g\@larg\t@mpdimc
\offinterlineskip
\vskip0pt% Force the reference point to the top
\hbox to0pt{\hss\lineseg(\@xarg,\@yarg){\@larg}%
\hskip\t@mpdimc\rlap{\lineseg(-\@xarg,\@yarg){\@larg}}%
\hss}%
\setbox\t@mpboxa
\hbox to0pt{\hss\vrule height.2pt depth.2pt width2\t@mpdimc\hss}%
\t@mpdimc-.5\squarew@dth\advance\t@mpdimc\based@st
\ht\t@mpboxa0pt\dp\t@mpboxa\t@mpdimc\copy\t@mpboxa
}%
}
\def\lvls#1{\g\l@vels#1}
\def\slnt#1{\g\sl@pe#1}
\def\treesymbol#1{%
\g\setbox\leftb@x\copy\voidb@x
\g\setbox\rightb@x\copy\voidb@x
\g\setbox\centerb@x\copy\voidb@x
\g\setbox\beneathb@x\copy\voidb@x
\lvls{1}\slnt{3}%
#1%
\g\centerdim@n\trianglew@dth
\g\halfcenterdim@n.5\trianglew@dth
\n@xttree
\g\count\l@sttreeheight\l@vels% \g\advance\count\l@sttreeheight by\tw@
\g\toks\l@sttreetype{triangle}%
\n@mel@st
\g\hd@st\hv@l\sl@pe \g\divide\hd@st by\tw@
\g\l@stltop=\halfcenterdim@n\g\advance\l@stltop by\wd\leftb@x
\g\l@strtop=\halfcenterdim@n\g\advance\l@strtop by\wd\rightb@x
\g\l@stlboff=-\hd@st \g\multiply\l@stlboff by\l@vels
\g\advance\l@stlboff by\wd\leftb@x
\g\l@strboff=\hd@st \g\multiply\l@strboff by\l@vels
\g\advance\l@strboff by-\wd\rightb@x
\g\l@stlmoff=\l@stlboff\relax
\ifdim\l@stlmoff>0pt\relax\g\l@stlmoff=0pt\fi
\g\l@strmoff=\l@strboff
\ifdim\l@strmoff<0pt\relax\g\l@strmoff=0pt\fi
\g\t@mpcnta\l@stinfo\g\advance\t@mpcnta by6% preliminary
\ex\l@vels\times
\g\dimen\t@mpcnta-\hd@st\g\advance\t@mpcnta by\@ne
\g\dimen\t@mpcnta\hd@st\g\advance\t@mpcnta by\@ne
\xe
\g\advance\t@mpcnta by-\tw@
\g\advance\dimen\t@mpcnta by\wd\leftb@x
\g\advance\t@mpcnta by\@ne
\g\advance\dimen\t@mpcnta by-\wd\rightb@x
\g\setbox\l@stbox\vtop % to\l@vels\vd@st
{\offinterlineskip
\g\setbox\t@mpboxa
\hbox{\hskip-\halfcenterdim@n\hskip-\wd\leftb@x\unhbox\leftb@x
\hskip\halfcenterdim@n
\raise\based@st\tri@ngle
\hskip\halfcenterdim@n\t@mpdima-\wd\rightb@x
\unhbox\rightb@x\hskip\t@mpdima\hskip-\halfcenterdim@n}
\g\ht\t@mpboxa=0pt\box\t@mpboxa
\setbox\centerb@x\hbox to0pt{\hss\unhbox\centerb@x\hss}%
\ht\centerb@x0pt\dp\centerb@x0pt\box\centerb@x
\vskip\s@ze pt
\ht\beneathb@x0pt\box\beneathb@x
\vskip-\dp\beneathb@x\vskip-\ht\beneathb@x}%
\ignorespaces
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Node sizes %%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% The algorithm (macros \@pdbox, \drawl@ftedge, \drawr@ghtedge) accesses the
% horizontal and vertical offset fo any node type XXX (circle, square,
% dot, triangle, text, and frame) via the macros \XXXx@ff resp. \XXXy@ff.
% These two macros take the slope of the outgoing edges
% of the current node as their argument. Though horizontal offsets can
% be calculated from the vertical offsets and vice versa, there is no
% room to do so in the \XXXx@ff or \YYYy@ff macros, because these macros
% have to expand to a dimension!
%
% Let k be a <number>. Actually k will be the slope of the outgoing
% edges of the current node.
%
% There are three methods how, e.g., \XXXx@ff can be defined , depending
% on the node type and the x- or y-orientation.
% First, \XXXx@ff can be defined to expand to \XXXx@ffk', k' beeing
% the roman numeral representation of the value of k, that in turn
% expands to the appropriate dimension (example: \circley@ff).
% In this case, \XXXx@ffi,...,\XXXx@ffiv are predefined by a \s@ries
% command.
% Second, \XXXx@ff can be defined to expand to a fixed dimension,
% independent of its argument (example: \dotx@ff).
% Third, the value of \XXXx@ff can be defined by the macro
% \c@lcoffsets, when the slope k is already known. In this case,
% the computation of \XXXx@ff makes use of the actual value
% of k and possibly other offsets that are already predefined by method I
% (examples: \circlex@ff, \squarex@ff).
\def\norm@ff{% everything set up for 10pt node size
\s@ries{circley@ff}{0.50000pt//0.49320pt//0.49029pt//0.48507pt//%
0.47434pt//0.46424pt//0.44721pt//0.42875pt//%
0.41603pt//0.40000pt//0.39043pt//0.38411pt//%
0.35355pt//0.32009pt//0.31235pt//0.30000pt//%
0.27735pt//0.25725pt//0.22361pt//0.18570pt//%
0.15811pt//0.12127pt//0.09806pt//0.08220pt}%
}
\def\dotx@ff#1{0pt}
\def\doty@ff#1{0pt}
\def\trianglex@ff#1{0pt}
\def\triangley@ff#1{0pt}
\def\c@lcoffsets{%
% \circlex@ff uses predefined \circley@ffi, \circley@ffii etc.
\ifnum\sl@pe=\@ne\relax
\xdef\circlex@ff##1{0pt}%
\else\g\t@mpcnta26 % number of slopes + 2
\g\advance\t@mpcnta-\sl@pe
\xdef\circlex@ff##1{\circley@ff\t@mpcnta}%
\fi
% \squarex@ff and \squarey@ff are computed directly from \sl@pe and \squarew@dth
\ifnum\sl@pe<13\relax % incoming edge meets upper border of a square node
% (slope 13 corresponds to 45 degrees)
\g\t@mpdima.5\squarew@dth
\xdef\squarey@ff##1{\the\t@mpdima}%
\g\multiply\t@mpdima\xv@l\sl@pe
\g\divide\t@mpdima\yv@l\sl@pe
\xdef\squarex@ff##1{\the\t@mpdima}%
\else\g\t@mpdima.5\squarew@dth
\xdef\squarex@ff##1{\the\t@mpdima}%
\g\multiply\t@mpdima\yv@l\sl@pe
\g\divide\t@mpdima\xv@l\sl@pe
\xdef\squarey@ff##1{\the\t@mpdima}%
\fi
% \texty@ff is .5\squarew@dth, \textx@ff is adjusted accordingly
\g\t@mpdima.5\squarew@dth
\xdef\texty@ff##1{\the\t@mpdima}%
\g\multiply\t@mpdima\xv@l\sl@pe
\g\divide\t@mpdima\yv@l\sl@pe
\xdef\textx@ff##1{\the\t@mpdima}%
\let\framex@ff\textx@ff
\let\framey@ff\texty@ff
}
\def\upds@ze#1{%
\for\t@mpcntc:=1\to24
\do\g\t@mpdimc=\csname#1\romannumeral\t@mpcntc\endcsname\relax
\g\multiply\t@mpdimc by\s@ze
\expandafter\gxdef\csname#1\romannumeral\t@mpcntc\endcsname
{\the\t@mpdimc}%
\od}
\def\nodes@ze{%
\begingroup
\unitlength 1pt%
\divide\unitlength by 65536
\g\based@st\s@ze pt\g\divide\based@st by 10 % \based@st is 10 % of
% circle diameter
\g\dummyhalfcenterdim@n=\s@ze pt\g\divide\dummyhalfcenterdim@n by\tw@
\g\circlew@dth=\s@ze pt%
\g\t@mpcntc\s@ze\g\multiply\t@mpcntc by 65536
\g\setbox\circleb@x\hbox to0pt{\circle{\t@mpcntc}\hss}%
\upds@ze{circley@ff}%
\g\squarew@dth.9pt\g\multiply\squarew@dth by\s@ze
\g\setbox\squareb@x\rect@ngle{\squarew@dth}{\squarew@dth}{.4pt}%
\g\dotw@dth=\s@ze pt\g\divide\dotw@dth by 5
\ifdim\dotw@dth < 1pt\relax
\g\dotw@dth1pt\relax
\fi
\g\t@mpcntc\dotw@dth
\g\setbox\dotb@x\hbox to 0pt{\circle*{\t@mpcntc}\hss}%
\g\trianglew@dth=\s@ze pt\g\multiply\trianglew@dth by \tw@
\g\divide\trianglew@dth by 3
\g\textw@dth=0pt%
\g\setbox\textb@x\copy\voidb@x
\g\framew@dth0pt%
\g\setbox\frameb@x\copy\voidb@x
\hv@ldef
\endgroup
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Changing the style %%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\treefonts#1{#1}
\def\vdist#1{\g\vd@st=#1\relax}
\def\minsep#1{\g\mins@p=#1\relax\g\halfmins@p=.5\mins@p}
\def\addsep#1{\g\adds@p=#1\relax}
\def\extended{\def\ext@nded{\g\ext@ndedtrue}}
\def\noextended{\def\ext@nded{\g\ext@ndedfalse}}
\def\nodesize#1{\g\t@mpdima=#1\relax\g\s@ze=\t@mpdima
\g\divide\s@ze by 65536\relax} % conversion from dimension to number
\def\Treestyle#1{\norm@ff#1\nodes@ze\ignorespaces}
\input classes
\Treestyle{%
\ifLaTeX\treefonts{\normalsize\rm}%
\else\treefonts{\tenrm}%
\fi
\vdist{60pt}%
\minsep{20pt}%
\addsep{0pt}%
\nodesize{20pt}%
}
%
|