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
|
% \iffalse
%
%<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
%<package>\ProvidesPackage{dyntree}
%<package> [2006/08/14 v1 Dynkin Tree Typsetting]
%<package>\RequirePackage{coollist}
%<package>\RequirePackage{calc}
%<package>\RequirePackage{epic}
%<package>\RequirePackage{eepic}
%<package>\RequirePackage{amsmath}
%<package>\RequirePackage{amssymb}
%
%
%<*driver>
\documentclass{ltxdoc}
\usepackage{dyntree}
\EnableCrossrefs
\CodelineIndex
\RecordChanges
\begin{document}
\DocInput{dyntree.dtx}
\end{document}
%</driver>
% \fi
%
% \iffalse meta-comment
% remove this comment to get a checksum
% \CheckSum{0}
% \fi
%
%% \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 \~}
%
% \changes{v1.0}{2006/08/14}{Initial Release}
%
% \GetFileInfo{dyntree.sty}
%
% \DoNotIndex{\#,\$,\%,\&,\@,\\,\{,\},\^,\_,\~,\ ,\!,\(,\),\,}
% \DoNotIndex{\@ne,\expandafter}
% \DoNotIndex{\advance,\begingroup,\catcode,\closein,\errmessage}
% \DoNotIndex{\newcommand,\renewcommand,\providecommand}
% \DoNotIndex{\closeout,\day,\def,\edef,\xdef,\gdef,\let,\empty,\endgroup}
% \DoNotIndex{\newcounter,\providecounter,\addtocounter,\setcounter,\stepcounter,\value,\arabic,\the}
% \DoNotIndex{\if,\fi,\ifthenelse,\else,\setboolean,\boolean,\newboolean,\provideboolean,\equal,\AND,\OR,\NOT,\whiledo}
% \DoNotIndex{\ifcase,\ifcat,\or,\else}
% \DoNotIndex{\par,\parbox,\mbox,\hbox,\begin,\end,\nabla,\partial}
% \DoNotIndex{\overline,\bar,\small,\tiny,\mathchoice,\scriptsize,\textrm,\texttt}
% \DoNotIndex{\alpha,\beta,\gamma,\epsilon,\varepsilon,\delta,\zeta,\eta,\theta,\vartheta,\iota,\kappa,\lambda,\mu,\nu}
% \DoNotIndex{\xi,\omicron,\pi,\varpi,\rho,\varrho,\sigma,\tau,\upsilon,\phi,\varphi,\chi,\psi,\omega}
% \DoNotIndex{\Delta,\Gamma,\Theta,\Lambda,\Xi,\Pi,\Sigma,\Phi,\Psi,\Omega}
% \DoNotIndex{\digamma,\lceil,\rceil,\lfloor,\rfloor,\left,\right,\inp,\inb,\inbr,\inap,\nop}
% \DoNotIndex{\sum,\prod,\int,\log,\ln,\exp,\sin,\cos,\tan,\csc,\sec,\cot,\arcsin,\arccos,\arctan,\det}
% \DoNotIndex{\sinh,\cosh,\tanh,\csch,\sech,\coth,\arcsinh,\arccosh,\arctanh}
% \DoNotIndex{\mod,\max,\min,\gcd,\lcm,\wp,\arg,\dots,\infty,}
% \DoNotIndex{\frac,\binom,\braket,\@@atop}
% \DoNotIndex{\cdot,\ldots,\tilde,\times,\dagger,\relax}
% \DoNotIndex{\mathbb,\roman,\bf,\mathord,\cal,\DeclareMathOperator,\PackageError,\PackageWarning}
% \DoNotIndex{\csname,\endcsname,\ifx,\ifnum}
% \DoNotIndex{\makeatother,\makeatletter}
% \DoNotIndex{\copy,\setbox,\usebox,\newbox}
% \DoNotIndex{\addtolength,\setlength,\newlength,\unitlength,\settoheight,\settodepth,\settowidth,\lengthtest}
% \DoNotIndex{\drawline,\line,\put}
% \DoNotIndex{
% \DYNTREE@temparray,\DYNTREE@templen,\DYNTREE@tempboxnum,\DYNTREE@tempxCoord,
% \DYNTREE@tempinsert,\DYNTREE@temproot,\DYNTREE@tempswap,\DYNTREE@temprootX}
%
% \title{The \textsf{dyntree} package\thanks{This document
% corresponds to \textsf{dyntree}~\fileversion,
% dated~\filedate.}}
% \author{nsetzer}
%
% \maketitle
%
% \setcounter{IndexColumns}{2}
% \StopEventually{\PrintChanges\PrintIndex}
%
% The \textsf{dyntree} package is intended for users needing to typeset a dykin tree---a group theoretical construct
% consisting of cartan coefficients in boxes connected by a series of lines.
% This package makes it easy for the user to generate these objects by allowing the user to specify only the
% cartan coefficients and the root number(s) that they connect to below.
%
% This package requires the \textsf{coollist} package, which is not a standard \LaTeX package but is available at CTAN.
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\section{Basics}
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% To create a Dynkin Tree Diagram, the syntax is as follows \DescribeEnv{dyntree} \DescribeMacro{\dynbox}:
%
% |\start{dyntree}|\marg{num\_roots}
%
% |\dynbox|\marg{cartan\_coefficients}\marg{cvs\_descendant\_root\_list} |\lend|
%
% $\vdots$
%
% |\finish{dyntree}|
%
% where
%
% \meta{num\_roots} is an integer indicating the number of simple roots
%
% \meta{cartan\_coefficients} is an \emph{ampersand} (\&) delimited list of cartan coefficients
% (the number of which \emph{must} be equal to \meta{num\_roots}
%
% \meta{cvs\_descendant\_root\_list} is a comma delimited list of integers indicating which simple root can be lowered
% from this box. The simple roots are numbered from left to right starting at $1$ and ending at \meta{num\_roots}
%
%
% Thus, if the group of interest had $3$ simple roots, each |\dynbox| would have a \meta{cartan\_coefficients} with three entries; that is, it would be a list with three integers as in
%
% \begin{center}
% |1 & 0 & 0|
% \end{center}
%
% and the list \meta{cvs\_descendant\_root\_list} would have at most three entries (but it need not have exactly three entries) with the entries being between $1$ and $3$. The entry $1$ would correspond to the first (left-most) simple root being lowered, the entry $2$ the second simple root, and $3$ the third:
%
% \DeleteShortVerb{\|}
% \begin{center}
% \begin{picture}(200,70)
% \put(20,40){simple root:}
% \put(80,40){$\begin{array}{ccc} 1 & 2 & 3 \end{array}$}
% \put(80,30){$\begin{array}{|ccc|} \hline 1 & 0 & 0 \\ \hline \end{array}$}
% \end{picture}
% \end{center}
% \MakeShortVerb{\|}
%
% So, finally, an entry such as
%
% \begin{center}
% |\dynbox{-1 & 0 & 0}{1,3}|
% \end{center}
%
% would specify that the program should draw two lines below the box \DeleteShortVerb{\|} $\begin{array}{|ccc|} \hline 1 & 0 & 0 \\ \hline \end{array}$ \MakeShortVerb{\|}; one for the first simple root, and another for the third simple root. The resulting portion of the diagram would look like
%
% \begin{center}
% \start{dyntree}{3}
% \dynbox{-1 & 0 & 0}{1,3} \lend
% \finish{dyntree}
% \end{center}
%
% \makeatletter
% \vspace{\DYNTREE@levelsep}
% \makeatother
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
%\subsection{Quirks}
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% There are two quirks with this package, and they are
% \begin{itemize}
% \item{if there are multiple Dynkin Tree Diagrams required for your document, you \emph{must} enclose each tree in braces}
% \item{The lowest state (bottom-most dynbox) must have a non-empty entry in \meta{cvs\_descendant\_root\_list} even though no lines are to be drawn from it. To meet both criteria, place a zero in this spot.}
% \end{itemize}
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
%\subsection{Examples}
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \newcounter{examples}
% \setcounter{examples}{1}
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %
%\subsubsection{Example \theexamples} \stepcounter{examples}
% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \begin{verbatim}
% {
% \start{dyntree}{2}
% \dynbox{3 & 0}{1} \lend
% \dynbox{1 & 1}{1,2} \lend
% \dynbox{2 & -1}{1}
% \dynbox{-1 & 2}{1,2} \lend
% \dynbox{0 & 0}{1,2}
% \dynbox{-3 & 3}{0,2} \lend
% \dynbox{1 & -2}{1}
% \dynbox{-2 & 1}{0,2} \lend
% \dynbox{-1 & -1}{0,2} \lend
% \dynbox{0 & -3}{0} \lend
% \finish{dyntree}
% }
% \end{verbatim}
%
% {
% \start{dyntree}{2}
% \dynbox{3 & 0}{1} \lend
% \dynbox{1 & 1}{1,2} \lend
% \dynbox{2 & -1}{1}
% \dynbox{-1 & 2}{1,2} \lend
% \dynbox{0 & 0}{1,2}
% \dynbox{-3 & 3}{0,2} \lend
% \dynbox{1 & -2}{1}
% \dynbox{-2 & 1}{0,2} \lend
% \dynbox{-1 & -1}{0,2} \lend
% \dynbox{0 & -3}{0} \lend
% \finish{dyntree}
% }
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %
%\subsubsection{Example \theexamples} \stepcounter{examples}
% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \begin{verbatim}
% \begin{center}
% {
% \start{dyntree}{3}
% \dynbox{2 & 0 & 0}{1} \lend
% \dynbox{0 & 1 & 0}{1,2} \lend
% \dynbox{1 & -1 & 1}{1,3}
% \dynbox{-2 & 2 & 0}{2} \lend
% \dynbox{1 & 1 & -1}{1,2}
% \dynbox{-1 & 0 & 1}{2,3} \lend
% \dynbox{2 & -1 & 0}{1}
% \dynbox{-1 & 2 & -1}{2}
% \dynbox{0 & -2 & 2}{3} \lend
% \dynbox{0 & 0 & 0}{0} \lend
% \finish{dyntree}
% }
% \end{center}
% \end{verbatim}
%
% \begin{center}
% {
% \start{dyntree}{3}
% \dynbox{2 & 0 & 0}{1} \lend
% \dynbox{0 & 1 & 0}{1,2} \lend
% \dynbox{1 & -1 & 1}{1,3}
% \dynbox{-2 & 2 & 0}{2} \lend
% \dynbox{1 & 1 & -1}{1,2}
% \dynbox{-1 & 0 & 1}{2,3} \lend
% \dynbox{2 & -1 & 0}{1}
% \dynbox{-1 & 2 & -1}{2}
% \dynbox{0 & -2 & 2}{3} \lend
% \dynbox{0 & 0 & 0}{0} \lend
% \finish{dyntree}
% }
% \end{center}
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %
%\subsubsection{Example \theexamples} \stepcounter{examples}
% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \begin{verbatim}
% This is a $15$ of $SU(5)$
%
% \begin{center}
% {
% \start{dyntree}{4}
% \dynbox{2 & 0 & 0 & 0}{1} \lend
% \dynbox{0 & 1 & 0 & 0}{1,2} \lend
% \dynbox{1 & -1 & 1 & 0}{1,3}
% \dynbox{-2 & 2 & 0 & 0}{2} \lend
% \dynbox{1 & 0 & -1 & 0}{1,4}
% \dynbox{-1 & 0 & 1 & 0}{2,3} \lend
% \dynbox{1 & 0 & 0 &-1}{1}
% \dynbox{-1 & 1 & -1 & 1}{2,4}
% \dynbox{0 & -2 & 2 & 0}{3} \lend
% \dynbox{-1 & 1 & 0 & -1}{2}
% \dynbox{0 & -1 & 0 & 1}{3,4} \lend
% \dynbox{0 & -1 & 1 & -1}{3}
% \dynbox{0 & 0 & -2 & 2}{4} \lend
% \dynbox{0 & 0 & -1 & 0}{4} \lend
% \dynbox{0 & 0 & 0 & -2}{0} \lend
% \finish{dyntree}
% }
% \end{center}
% \end{verbatim}
%
% This is a $15$ of $SU(5)$
%
% \begin{center}
% {
% \start{dyntree}{4}
% \dynbox{2 & 0 & 0 & 0}{1} \lend
% \dynbox{0 & 1 & 0 & 0}{1,2} \lend
% \dynbox{1 & -1 & 1 & 0}{1,3}
% \dynbox{-2 & 2 & 0 & 0}{2} \lend
% \dynbox{1 & 0 & -1 & 0}{1,4}
% \dynbox{-1 & 0 & 1 & 0}{2,3} \lend
% \dynbox{1 & 0 & 0 &-1}{1}
% \dynbox{-1 & 1 & -1 & 1}{2,4}
% \dynbox{0 & -2 & 2 & 0}{3} \lend
% \dynbox{-1 & 1 & 0 & -1}{2}
% \dynbox{0 & -1 & 0 & 1}{3,4} \lend
% \dynbox{0 & -1 & 1 & -1}{3}
% \dynbox{0 & 0 & -2 & 2}{4} \lend
% \dynbox{0 & 0 & -1 & 0}{4} \lend
% \dynbox{0 & 0 & 0 & -2}{0} \lend
% \finish{dyntree}
% }
% \end{center}
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %
%\subsubsection{Example \theexamples} \stepcounter{examples}
% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \begin{verbatim}
% \begin{center}
% {
% \start{dyntree}{2}
% \dynbox{0 & 2}{2} \lend
% \dynbox{1 & 0}{1,2} \lend
% \dynbox{2 & -2}{1}
% \dynbox{-1 & 1}{2} \lend
% \dynbox{0 & -1}{1} \lend
% \dynbox{-2 & 0}{0} \lend
% \finish{dyntree}
% }
% \end{center}
% \end{verbatim}
%
% \begin{center}
% {
% \start{dyntree}{2}
% \dynbox{0 & 2}{2} \lend
% \dynbox{1 & 0}{1,2} \lend
% \dynbox{2 & -2}{1}
% \dynbox{-1 & 1}{2} \lend
% \dynbox{0 & -1}{1} \lend
% \dynbox{-2 & 0}{0} \lend
% \finish{dyntree}
% }
% \end{center}
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\section{Implementation}
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
%\subsection{Variables and Constants}
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% The \textsf{dyntree} package utilizes a picture environment to create the tree. To do this it requires several
% constant length values, as well as calculated length values and counters. These are define below.
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %
%\subsubsection{Cartan Coefficients Box Variables}
% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% The first thing to do is declare the length variables associated with a cartan coefficients box---dynbox for short.
% These variables are
%
% \begin{tabular}{lp{.5\textwidth}}
% |\DYNTREE@widechar| & the width of a $-1$ \\
% |\DYNTREE@thinchar| & the width of a $1$ \\
% |\DYNTREE@cartancoefwidth| & the width of a cartan coefficient (a combination of $-1$ and $1$) \\
% |\DYNTREE@marginwidth| & the width of the margin of the cartan coefficients box \\
% |\DYNTREE@colsepwidth| & the width between columns of the cartan coefficients box \\
% |\DYNTREE@dynboxheight| & the height (baseline to top) of the cartan coefficients box \\
% |\DYNTREE@dynboxdepth| & the depth (baseline to bottom) of the cartan coefficients box \\
% |\DYNTREE@dynboxvlen| & the full vertical height of a cartan coefficients box \\
% |\DYNTREE@dynboxwidth| & the width of a dynbox (calculated based on numroots) \\
% \end{tabular}
%
% \begin{macrocode}
\newlength{\DYNTREE@widechar}%
\newlength{\DYNTREE@thinchar}%
\newlength{\DYNTREE@cartancoefwidth}%
\newlength{\DYNTREE@marginwidth}%
\newlength{\DYNTREE@colsepwidth}%
\newlength{\DYNTREE@dynboxheight}%
\newlength{\DYNTREE@dynboxdepth}%
\newlength{\DYNTREE@dynboxvlen}%
\newlength{\DYNTREE@dynboxwidth}%
% \end{macrocode}
%
% Now that they are declared, initialize the ``exterior" ones
%
% \begin{macrocode}
\settowidth{\DYNTREE@widechar}{$-1$}%
\settowidth{\DYNTREE@thinchar}{$1$}%
\setlength{\DYNTREE@cartancoefwidth}%
{\DYNTREE@widechar*1/2 + \DYNTREE@thinchar*1/2}%
\settowidth{\DYNTREE@marginwidth}%
{$\begin{array}{|c|}\hline 1 \\ \hline \end{array}$}%
\addtolength{\DYNTREE@marginwidth}{-\DYNTREE@thinchar}%
\settowidth{\DYNTREE@colsepwidth}%
{$\begin{array}{|cc|}\hline 1 & 1 \\ \hline \end{array}$}%
\addtolength{\DYNTREE@colsepwidth}{-\DYNTREE@marginwidth - \DYNTREE@thinchar*2}%
\settoheight{\DYNTREE@dynboxheight}%
{$\begin{array}{|c|}\hline 1 \\ \hline \end{array}$}%
\settodepth{\DYNTREE@dynboxdepth}%
{$\begin{array}{|c|}\hline 1 \\ \hline \end{array}$}%
\setlength{\DYNTREE@dynboxvlen}{\DYNTREE@dynboxheight + \DYNTREE@dynboxdepth}%
% \end{macrocode}
%
% and now for convenience and error testing, print them out
%
% \makeatletter
% \begin{tabular}{rl}
% widechar: & \the\DYNTREE@widechar \\
% thinchar: & \the\DYNTREE@thinchar \\
% cartancoefwidth: & \the\DYNTREE@cartancoefwidth \\
% marginwidth: & \the\DYNTREE@marginwidth \\
% colsepwidth: & \the\DYNTREE@colsepwidth \\
% dynboxheight & \the\DYNTREE@dynboxheight \\
% dynboxdepth & \the\DYNTREE@dynboxdepth \\
% dynboxvlen & \the\DYNTREE@dynboxvlen \\
% \end{tabular}
% \makeatother
%
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %
%\subsubsection{Dynkin Tree Variables}
% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %% %
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% These variables are specific to the actual creation of the tree structure.
%
% \begin{tabular}{lp{0.55\textwidth}}
% {\bf \Large counters} \\
% |DYNTREE@numlevel| & the number of levels in the tree \\
% |DYNTREE@nextlevel| & the number of the next level \\
% |DYNTREE@numboxes| & counter for counting number of boxes in a row \\
% |DYNTREE@nextnumboxes| & counter for counting number of boxes in the next row \\
% |DYNTREE@target| & used to record the `targeted' array element when sorting \\
% |DYNTREE@listlen| & the length of the list of descendents \\
% |DYNTREE@xCoord| & the x coordinate in scaled points \\
% |DYNTREE@yCoord| & the y coordinate in scaled points \\
% |DYNTREE@xPos| & the x coordinate in scaled points \\
% |DYNTREE@yPos| & the y coordinate in scaled points \\
% |DYNTREE@xComp| & the x coordinate in scaled points \\
% |DYNTREE@yComp| & the y coordinate in scaled points \\
% |DYNTREE@leftX| & the left most x coordinate in scaled points \\
% |DYNTREE@ct| & generic counter \\
% |DYNTREE@counter| & generic counter \\
% |DYNTREE@index| & generic counter \\
% |DYNTREE@root| & the root number \\
% \end{tabular}
%
% \begin{tabular}{lp{0.55\textwidth}}
% {\bf \Large lengths} \\
% |\DYNTREE@dynboxsep| & the distance between dynkin boxes \\
% |\DYNTREE@levelsep| & the distances between each level (from dynkin box bottom to top of next layer's dynbox)
% \\
% |\DYNTREE@leftmostX| & the left most x value \\
% |\DYNTREE@rightmostX| & the right most x value \\
% |\DYNTREE@unitlen| & the unit length value before altering (to allow it to be restored) \\
% |\DYNTREE@templen| & temporary length storage \\
% |\DYNTREE@holdlen| & temporary length storage \\
% \end{tabular}
%
% \begin{tabular}{lp{0.55\textwidth}}
% {\bf \Large commands} \\
% |\DYNTREE@treestop| & indicates the point where the gobbler stops reading (to allow \LaTeX to properly
% read all the data. Its value is |\&\&\&| \\
% |\DYNTREE@treeend| & indicates the end of the tree. It is in the definition of the gobbler.
% It has a value of |\%\%\%| \\
% \end{tabular}
%
%
% \begin{macro}{\lend}
% \begin{macro}{\dynbox}
%
% And there are two external commands:
%
% \begin{tabular}{lp{0.75\textwidth}}
% |\lend| & indicates the end of one tree level. The value is never used: this token is used as
% a delimiter by the user and the code. Its value, which should never be typed,
% is |\&\%\&\%| \\
% |\dynbox| & indicates the start of a dynbox. The value is never used: this token is purely for
% delimiting the start of the dynbox by the user; it is only defined to satisfy the
% |\ifthenelse| statement \\
% \end{tabular}
% \end{macro}
% \end{macro}
%
% \begin{macrocode}
\newcounter{DYNTREE@numlevel}%
\newcounter{DYNTREE@nextlevel}%
\newcounter{DYNTREE@numboxes}%
\newcounter{DYNTREE@nextnumboxes}%
\newcounter{DYNTREE@target}%
\newcounter{DYNTREE@listlen}%
\newcounter{DYNTREE@xCoord}%
\newcounter{DYNTREE@yCoord}%
\newcounter{DYNTREE@xPos}%
\newcounter{DYNTREE@yPos}%
\newcounter{DYNTREE@xComp}%
\newcounter{DYNTREE@yComp}%
\newcounter{DYNTREE@leftX}%
\newcounter{DYNTREE@ct}%
\newcounter{DYNTREE@counter}%
\newcounter{DYNTREE@index}%
\newcounter{DYNTREE@root}%
\newlength{\DYNTREE@dynboxsep}%
\newlength{\DYNTREE@levelsep}%
\newlength{\DYNTREE@leftmostX}%
\newlength{\DYNTREE@rightmostX}%
\newlength{\DYNTREE@unitlen}%
\newlength{\DYNTREE@templen}%
\newlength{\DYNTREE@holdlen}%
\newcommand{\DYNTREE@treestop}{\&\&\&}%
\newcommand{\DYNTREE@treeend}{\%\%\%}%
\newcommand{\lend}{\&\%\&\%}%
\newcommand{\dynbox}{}%
% \end{macrocode}
%
% Now that they are declared, initialize the ``exterior" ones
%
% \begin{macrocode}
\setlength{\DYNTREE@dynboxsep}{\DYNTREE@colsepwidth}%
\setlength{\DYNTREE@levelsep}{1cm}%
% \end{macrocode}
%
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
%\subsection{The Tree Eater}
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% While the dynkin tree structure resembles that of an environment, it actually consists of a \LaTeX command that
% consumes the data, sorts it, and displays the proper items. The basis of this consumption are several
% ``gobblers"---the first of which eats the tree one level at a time
%
%
% \begin{macrocode}
\def\DYNTREE@gobbletree#1\lend#2\DYNTREE@treeend{%
% \end{macrocode}
% Before the level can be processed, several things must be adjusted. First, since a new level is beginning
% the counter must be incremented by one
% \begin{macrocode}
\addtocounter{DYNTREE@numlevel}{1}%
% \end{macrocode}
% initialize the number of boxes for this level
% \begin{macrocode}
\setcounter{DYNTREE@numboxes}{0}%
% \end{macrocode}
% initialize the number of boxes for the next level
% \begin{macrocode}
\setcounter{DYNTREE@nextnumboxes}{0}%
% \end{macrocode}
% Process the level:
% \begin{macrocode}
\DYNTREE@gobbledynboxes#1\lend%
% \end{macrocode}
% \iffalse
% \makeatletter
% \begin{tabular}{lp{.55\textwidth}}
% \multicolumn{2}{l}{{\bf ERROR CHECK}} \\
% level: & \arabic{DYNTREE@numlevel} \\
% boxes: & \arabic{DYNTREE@numboxes} \\
% \end{tabular}
% \makeatother
% \fi
% Record the number of boxes for this level
% \begin{macrocode}
\expandafter\xdef%
\csname DYNTREE@level@\roman{DYNTREE@numlevel}@numbox\endcsname%
{\arabic{DYNTREE@numboxes}}%
% \end{macrocode}
% Now check for the signal to stop processing
% \begin{macrocode}
\ifthenelse{ \equal{#2}{\DYNTREE@treestop} }%
{%
% \end{macrocode}
% The End---just do nothing
% \begin{macrocode}
}%
% Else
{%
% \end{macrocode}
% continue processing levels until the end of the tree
% \begin{macrocode}
\DYNTREE@gobbletree#2\DYNTREE@treeend%
}%
}%
% \end{macrocode}
%
%
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
%\subsection{The Box Eater}
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% The second ``gobbler" eats the boxes one by one:
%
% \begin{macrocode}
\def\DYNTREE@gobbledynboxes#1\dynbox#2#3#4{%
% \end{macrocode}
% increment the number of boxes
% \begin{macrocode}
\addtocounter{DYNTREE@numboxes}{1}%
% \end{macrocode}
% \iffalse
%! boxnum: \arabic{DYNTREE@numboxes}
% \fi
% Store the boxes for this level in registers
% \begin{macrocode}
\expandafter\newbox%
\csname DYNTREE@box@\roman{DYNTREE@numlevel}@\roman{DYNTREE@numboxes}\endcsname%
\expandafter\setbox%
\csname DYNTREE@box@\roman{DYNTREE@numlevel}@\roman{DYNTREE@numboxes}\endcsname=%
\hbox{$\begin{array}{|*{\DYNTREE@numroots}{c}|}\hline #2 \\ \hline \end{array}$}%
% \end{macrocode}
% Calculate the X value for each descendent and place in sorted list
%
% * Get the length of the list
% \begin{macrocode}
\listlenstore{DYNTREE@listlen}{#3}%
\expandafter\xdef
\csname DYNTREE@childline@\roman{DYNTREE@numlevel}@\roman{DYNTREE@numboxes}@boxnum\endcsname%
{\arabic{DYNTREE@listlen}}%
\ifthenelse{\value{DYNTREE@listlen} > \DYNTREE@numroots}%
{%
\PackageError{dyntree}%
{%
Length of descendant of \arabic{DYNTREE@numboxes}%
on level \arabic{DYNTREE@numlevel} exceeds number of roots%
(\DYNTREE@numroots)%
}%
}%
% Else
{}%
% \end{macrocode}
% * store the list in a temp variable for convenience in typing, store it more permanently for use later on.
% \begin{macrocode}
\liststore{#3}{DYNTREE@templist@}%
\liststore{#3}%
{DYNTREE@childlist@\roman{DYNTREE@numlevel}@\roman{DYNTREE@numboxes}@}%
% \end{macrocode}
% * go through the list and generate the sorted 'array' |DYNTREE@level@|\meta{level}|@|\meta{boxnum}|@X|
% \begin{macrocode}
\setcounter{DYNTREE@ct}{1}%
\whiledo{ \NOT \(\value{DYNTREE@ct} > \value{DYNTREE@listlen}\) \AND
\NOT\(\value{DYNTREE@ct} > \DYNTREE@numroots\) }%
{%
% \end{macrocode}
% need to store the `root' value in a counter to retrieve the data
% \begin{macrocode}
\setcounter{DYNTREE@counter}{\csname DYNTREE@templist@\roman{DYNTREE@ct}\endcsname}%
% \end{macrocode}
% check that the number submitted is within the allowed range
% \begin{macrocode}
\ifthenelse{ \(\value{DYNTREE@counter} > \DYNTREE@numroots\) \OR
\(\value{DYNTREE@counter} < 1\) }%
{%
\ifthenelse{\value{DYNTREE@counter} = 0}%
{%
% \end{macrocode}
% Do nothing - this is the last level
% \begin{macrocode}
}%
% Else
{%
\PackageError{dyntree}%
{%
Descendant root of \arabic{DYNTREE@numboxes} on level%
\arabic{DYNTREE@numlevel} out of bounds%
(\arabic{DYNTREE@counter} > \DYNTREE@numroots)%
}%
}%
}%
% Else
{%
% \end{macrocode}
% temporarily store the length
% \begin{macrocode}
\setlength{\DYNTREE@templen}%
{\csname DYNTREE@level@\roman{DYNTREE@numlevel}@\roman{DYNTREE@numboxes}@X\endcsname}%
\addtolength{\DYNTREE@templen}%
{\csname DYNTREE@rootX@\roman{DYNTREE@counter}\endcsname*(-1)}%
% \end{macrocode}
% adjust the left most length
% \begin{macrocode}
\ifthenelse{\DYNTREE@templen < \DYNTREE@leftmostX}%
{%
\setlength{\DYNTREE@leftmostX}{\DYNTREE@templen}%
}%
% Else
{}%
% \end{macrocode}
% adjust right most length
% \begin{macrocode}
\setlength{\DYNTREE@holdlen}{\DYNTREE@templen}%
\addtolength{\DYNTREE@holdlen}{\DYNTREE@dynboxwidth}%
\ifthenelse{ \DYNTREE@holdlen > \DYNTREE@rightmostX }%
{%
\setlength{\DYNTREE@rightmostX}{\DYNTREE@holdlen}%
}%
% Else
{}%
% \end{macrocode}
% now store the x value for the line
% \begin{macrocode}
\setlength{\DYNTREE@holdlen}%
{\expandafter\csname DYNTREE@dynboxX@\roman{DYNTREE@counter}\endcsname}%
\addtolength{\DYNTREE@holdlen}{\DYNTREE@templen}%
\setcounter{DYNTREE@xPos}{\DYNTREE@holdlen}%
% \end{macrocode}
% \iffalse
%! \begin{tabular}{cc}
%! rootX.\roman{DYNTREE@counter} & \csname DYNTREE@rootX@\roman{DYNTREE@counter}\endcsname \\
%! DYNTREE@numlevel: & \arabic{DYNTREE@numlevel} \\
%! numboxes: & \arabic{DYNTREE@numboxes} \\
%! templen: & \the\DYNTREE@templen \\
%! \end{tabular}
%!
% \fi
% |counter| has served its purpose and may be used in another context
%
% add the length to the sorted 'array'
%
% * initialize the counter to the END of the array
% \begin{macrocode}
\setcounter{DYNTREE@counter}{\value{DYNTREE@nextnumboxes}}%
% \end{macrocode}
% * get the value of the next level
% \begin{macrocode}
\setcounter{DYNTREE@nextlevel}{\value{DYNTREE@numlevel} + 1}%
% \end{macrocode}
% * Check for array elements
% \begin{macrocode}
\ifthenelse{\value{DYNTREE@counter} = 0}%
{%
% \end{macrocode}
% set the first element as the length
% \begin{macrocode}
\expandafter\xdef%
\csname DYNTREE@level@\roman{DYNTREE@nextlevel}@i@X\endcsname%
{\the\DYNTREE@templen}%
% \end{macrocode}
% increment the number of elements
% \begin{macrocode}
\addtocounter{DYNTREE@nextnumboxes}{1}%
}%
% Else
{%
% \end{macrocode}
% there is at least one element
% \begin{macrocode}
\edef\DYNTREE@temparray%
{\csname DYNTREE@level@\roman{DYNTREE@nextlevel}@\roman{DYNTREE@counter}@X\endcsname}%
\edef\DYNTREE@tempinsert{\the\DYNTREE@templen}%
% \end{macrocode}
% \iffalse
%! \begin{tabular}{cc}
%! nextnumboxes: & \arabic{DYNTREE@nextnumboxes} \\
%! nextlevel: & \arabic{DYNTREE@nextlevel} \\
%! counter: & \arabic{DYNTREE@counter} \\
%! temparray: & \DYNTREE@temparray \\
%! level\&\roman{DYNTREE@nextlevel}\&\roman{DYNTREE@counter}\&X
%! &
%! \csname DYNTREE@level@\roman{DYNTREE@nextlevel}@\roman{DYNTREE@counter}@X\endcsname
%! \\
%! tempinsert: & \DYNTREE@tempinsert \\
%! \end{tabular}
% \fi
% find where element should be inserted
% \begin{macrocode}
\whiledo{ \(\value{DYNTREE@counter} > 0\) \AND
\lengthtest{\DYNTREE@tempinsert < \DYNTREE@temparray} }%
{%
\edef\DYNTREE@temparray%
{\csname DYNTREE@level@\roman{DYNTREE@nextlevel}@\roman{DYNTREE@counter}@X\endcsname}%
\addtocounter{DYNTREE@counter}{-1}%
}%
% \end{macrocode}
% the thing needs to be inserted at \value{DYNTREE@counter} + 1
% \begin{macrocode}
\setcounter{DYNTREE@target}{\value{DYNTREE@counter} + 1}%
% \end{macrocode}
% \iffalse
%! \begin{tabular}{cc}
%! target: \arabic{DYNTREE@target} \\
%! temparray: & \DYNTREE@temparray \\
%! tempinsert: & \DYNTREE@tempinsert \\
%! \end{tabular}
%!
%!
% \fi
% if they aren't equal, move from target to nextnumboxes up to target+1 to nextnumboxes+1
% \begin{macrocode}
\ifthenelse{ \NOT \lengthtest{\DYNTREE@tempinsert = \DYNTREE@temparray} }%
{%
\setcounter{DYNTREE@counter}{\value{DYNTREE@nextnumboxes} + 1}%
\whiledo{ \value{DYNTREE@counter} > \value{DYNTREE@target} }%
{%
% \end{macrocode}
% get the value in the array spot one before
% \begin{macrocode}
\addtocounter{DYNTREE@counter}{-1}%
\edef\DYNTREE@tempswap%
{%
\csname DYNTREE@level@\roman{DYNTREE@nextlevel}@\roman{DYNTREE@counter}@X\endcsname%
}%
% \end{macrocode}
% store this value in the next array spot
% \begin{macrocode}
\addtocounter{DYNTREE@counter}{1}%
\expandafter\xdef%
\csname DYNTREE@level@\roman{DYNTREE@nextlevel}@\roman{DYNTREE@counter}@X\endcsname%
{\DYNTREE@tempswap}%
\addtocounter{DYNTREE@counter}{-1}%
}%
% \end{macrocode}
% insert the original
% \begin{macrocode}
\expandafter\xdef%
\csname DYNTREE@level@\roman{DYNTREE@nextlevel}@\roman{DYNTREE@target}@X\endcsname%
{\DYNTREE@tempinsert}%
% \end{macrocode}
% increment the number of boxes in the next level
% \begin{macrocode}
\addtocounter{DYNTREE@nextnumboxes}{1}%
}%
% Else
{%
% \end{macrocode}
% Do nothing
% \begin{macrocode}
}%
}%
}%
\addtocounter{DYNTREE@ct}{1}%
}%
\ifthenelse{\equal{#4}{\lend}}%
{%
}%
% Else
{%
% \end{macrocode}
% % Eat the boxes until there are no more
% \begin{macrocode}
\DYNTREE@gobbledynboxes#4%
}%
}%
% \end{macrocode}
%
%
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
%\subsection{The Dyntree Environment}
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Dynkin Tree Environment
%
%
% \begin{macrocode}
\def\start#1#2#3\finish#4%
{%
\ifthenelse{\equal{#1}{#4} \AND \equal{#4}{dyntree}}%
{%
\providecommand{\DYNTREE@numroots}{#2}%
% \end{macrocode}
% \iffalse
%! \DYNTREE@numroots
% \fi
% Initialize Interior Dynkin Box Variables
% \begin{macrocode}
\setlength{\DYNTREE@dynboxwidth}
{%
\DYNTREE@marginwidth +
\DYNTREE@cartancoefwidth*\DYNTREE@numroots +
\DYNTREE@colsepwidth*(\DYNTREE@numroots-1)
}%
% \end{macrocode}
% Initialize Interior Dynkin Tree Variables
% \begin{macrocode}
\setlength{\DYNTREE@leftmostX}{0pt}%
\setlength{\DYNTREE@rightmostX}{\DYNTREE@dynboxwidth}%
% \end{macrocode}
% the highest left starts at zero, so initialize this value
% \begin{macrocode}
\expandafter\gdef\csname DYNTREE@level@i@i@X\endcsname{0pt}%
% \end{macrocode}
% There are no levels, so initialize |numlevel| to zero
% \begin{macrocode}
\setcounter{DYNTREE@numlevel}{0}%
% \end{macrocode}
% Determine the root lines and dynkin box offsets
% \begin{macrocode}
\setcounter{DYNTREE@ct}{1}%
\whiledo{\NOT \(\value{DYNTREE@ct}>\DYNTREE@numroots\)}%
{%
% \end{macrocode}
% Calculate the length and store it in a temporary length
% \begin{macrocode}
\setlength{\DYNTREE@templen}%
{%
(\DYNTREE@dynboxwidth + \DYNTREE@dynboxsep)*\value{DYNTREE@ct}%
-(\DYNTREE@dynboxwidth + \DYNTREE@dynboxsep)*1/2%
-(\DYNTREE@dynboxwidth + \DYNTREE@dynboxsep)*\DYNTREE@numroots/2%
}%
% \end{macrocode}
% \iffalse
%! ct: \arabic{DYNTREE@ct}
%! templen: \the\DYNTREE@templen
% \fi
% store the actual length in a command
% \begin{macrocode}
\expandafter\xdef\csname DYNTREE@rootX@\roman{DYNTREE@ct}\endcsname%
{\the\DYNTREE@templen}%
% \end{macrocode}
% Calculate the dynkin box x offset and store it in a temporary length
% \begin{macrocode}
\setlength{\DYNTREE@templen}%
{%
\DYNTREE@dynboxwidth/2/\DYNTREE@numroots +
\DYNTREE@dynboxwidth*(\value{DYNTREE@ct}-1)/\DYNTREE@numroots
}%
% \end{macrocode}
% store the actual length in a command
% \begin{macrocode}
\expandafter\xdef\csname DYNTREE@dynboxX@\roman{DYNTREE@ct}\endcsname%
{\the\DYNTREE@templen}%
% \end{macrocode}
% \iffalse
% Print the Lengths
%! DYNTREE@rootX@\roman{DYNTREE@ct}: \expandafter\csname DYNTREE@rootX@\roman{DYNTREE@ct}\endcsname
%!
%! DYNTREE@dynboxX@\roman{DYNTREE@ct}: \expandafter\csname DYNTREE@dynboxX@\roman{DYNTREE@ct}\endcsname
% \fi
% \begin{macrocode}
\addtocounter{DYNTREE@ct}{1}%
}%
% \end{macrocode}
% \iffalse
% dynboxwidth: \the\DYNTREE@dynboxwidth
% \fi
% Eat the tree
% \begin{macrocode}
\DYNTREE@gobbletree#3\DYNTREE@treestop\DYNTREE@treeend%
% \end{macrocode}
% \iffalse
%! numlevels: \arabic{DYNTREE@numlevel}
% \fi
% Now the data has been stored, Draw The Tree:
%
% store the current unit length to restore when finished
% \begin{macrocode}
\setlength{\DYNTREE@unitlen}{\unitlength}%
\setlength{\unitlength}{1sp}%
% \end{macrocode}
% get the width of the picture
% \begin{macrocode}
\setcounter{DYNTREE@xCoord}{\DYNTREE@rightmostX - \DYNTREE@leftmostX}%
% \end{macrocode}
% store the leftmost point as a counter
% \begin{macrocode}
\setcounter{DYNTREE@leftX}{\DYNTREE@leftmostX}%
% \end{macrocode}
% get the height of the picture
% \begin{macrocode}
\setcounter{DYNTREE@yCoord}%
{%
\DYNTREE@dynboxvlen*\value{DYNTREE@numlevel} +
\DYNTREE@levelsep*(\value{DYNTREE@numlevel} - 1)
}%
\begin{picture}%
(\arabic{DYNTREE@xCoord},\arabic{DYNTREE@yCoord})%
(\value{DYNTREE@leftX},0)%
\setcounter{DYNTREE@ct}{1}%
\whiledo{\NOT \(\value{DYNTREE@ct} > \value{DYNTREE@numlevel}\)}%
{%
\setcounter{DYNTREE@counter}{1}%
% \end{macrocode}
% get the y coordinate as a length
% \begin{macrocode}
\setlength{\DYNTREE@templen}%
{%
\DYNTREE@dynboxvlen*\value{DYNTREE@numlevel}
- \DYNTREE@dynboxvlen*\value{DYNTREE@ct}
+ \DYNTREE@levelsep*\value{DYNTREE@numlevel}
- \DYNTREE@levelsep*\value{DYNTREE@ct}
+ \DYNTREE@dynboxdepth
}%
% \end{macrocode}
% convert the length to an integer in scaled points (sp)
% \begin{macrocode}
\setcounter{DYNTREE@yCoord}{\DYNTREE@templen}%
\def\DYNTREE@tempboxnum{\csname DYNTREE@level@\roman{DYNTREE@ct}@numbox\endcsname}%
\whiledo{\NOT \( \value{DYNTREE@counter} > \DYNTREE@tempboxnum \)}%
{%
% \end{macrocode}
% grab the value of the x coordinate (it's a length but not stored as one)
% \begin{macrocode}
\xdef\DYNTREE@tempxCoord%
{%
\expandafter%
\csname DYNTREE@level@\roman{DYNTREE@ct}@\roman{DYNTREE@counter}@X\endcsname%
}%
% \end{macrocode}
% convert x coordinate to a length
% \begin{macrocode}
\setlength{\DYNTREE@holdlen}{\DYNTREE@tempxCoord}%
% \end{macrocode}
% convert length to an integer in scaled points (sp)
% \begin{macrocode}
\setcounter{DYNTREE@xCoord}{\DYNTREE@holdlen}%
% \end{macrocode}
% place each dynkin box
% \begin{macrocode}
\put(\arabic{DYNTREE@xCoord},\arabic{DYNTREE@yCoord})%
{%
\expandafter%
\copy\csname DYNTREE@box@\roman{DYNTREE@ct}@\roman{DYNTREE@counter}\endcsname%
}%
% \end{macrocode}
% go through the descendants and place the lines
% \begin{macrocode}
\setcounter{DYNTREE@listlen}%
{%
\expandafter%
\csname DYNTREE@childline@\roman{DYNTREE@ct}@\roman{DYNTREE@counter}@boxnum\endcsname%
}%
\setcounter{DYNTREE@index}{1}%
\whiledo{\NOT \(\value{DYNTREE@index} > \value{DYNTREE@listlen}\)}%
{%
\xdef\DYNTREE@childroot%
{%
\expandafter%
\csname DYNTREE@childlist@\roman{DYNTREE@ct}@\roman{DYNTREE@counter}@\roman{DYNTREE@index}\endcsname%
}%
\ifthenelse{\NOT \DYNTREE@childroot = 0 }%
{%
\setcounter{DYNTREE@root}{\DYNTREE@childroot}%
\setcounter{DYNTREE@xPos}{\value{DYNTREE@xCoord}}%
\setcounter{DYNTREE@xComp}{\value{DYNTREE@xCoord}}%
\setcounter{DYNTREE@yPos}{\value{DYNTREE@yCoord}}%
\setcounter{DYNTREE@yComp}{\value{DYNTREE@yCoord}}%
\xdef\DYNTREE@temprootX%
{\expandafter\csname DYNTREE@rootX@\roman{DYNTREE@root}\endcsname}%
\setlength{\DYNTREE@templen}{\DYNTREE@temprootX}%
\addtocounter{DYNTREE@xPos}{\DYNTREE@templen*(-1)}%
\xdef\DYNTREE@dynoffset%
{\expandafter\csname DYNTREE@dynboxX@\roman{DYNTREE@root}\endcsname}%
\setlength{\DYNTREE@templen}{\DYNTREE@dynoffset}%
\addtocounter{DYNTREE@xPos}{\DYNTREE@templen}%
\addtocounter{DYNTREE@xComp}{\DYNTREE@templen}%
\setlength{\DYNTREE@templen}{1pt}% for frame thickness
\addtocounter{DYNTREE@yPos}%
{\DYNTREE@levelsep*(-1) - \DYNTREE@dynboxdepth - \DYNTREE@templen}%
\addtocounter{DYNTREE@yComp}{\DYNTREE@dynboxdepth*(-1) - \DYNTREE@templen}%
\put(0,0)%
{%
\drawline%
(\arabic{DYNTREE@xComp},\arabic{DYNTREE@yComp})%
(\arabic{DYNTREE@xPos},\arabic{DYNTREE@yPos})%
}%
}%
% Else
{%
}%
\addtocounter{DYNTREE@index}{1}%
}%
\addtocounter{DYNTREE@counter}{1}%
}%
\addtocounter{DYNTREE@ct}{1}%
}%
\end{picture}%
% \end{macrocode}
% restore the unit length to original value
% \begin{macrocode}
\setlength{\unitlength}{\DYNTREE@unitlen}%
% \end{macrocode}
% \iffalse
%!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Error Check BEGIN
%! \setcounter{DYNTREE@ct}{1}
%! \whiledo{\NOT \(\value{DYNTREE@ct} > \value{DYNTREE@numlevel}\)}%
%! {%
%! \setcounter{act}{1}%
%! \def\DYNTREE@tempboxnum{\csname DYNTREE@level@\roman{DYNTREE@ct}@numbox\endcsname}
%! \whiledo{\NOT \( \value{act} > \DYNTREE@tempboxnum \)}%
%! {%
%! level.\roman{DYNTREE@ct}.\roman{act}.x: \csname DYNTREE@level@\roman{DYNTREE@ct}@\roman{act}@X\endcsname;
%!
%! \addtocounter{act}{1}
%! }
%! \addtocounter{DYNTREE@ct}{1}%
%! }%
%!
%!
%! \setcounter{DYNTREE@ct}{1}%
%! \whiledo{\NOT \(\value{DYNTREE@ct}>\value{DYNTREE@numlevel}\)}%
%! {%
%! \setcounter{act}{1}%
%! \def\DYNTREE@tempboxnum{\csname DYNTREE@level@\roman{DYNTREE@ct}@numbox\endcsname}%
%! \whiledo{\NOT \(\value{act}>\DYNTREE@tempboxnum\)}%
%! {%
%! level: \arabic{DYNTREE@ct}, box: \arabic{act};
%! \expandafter\copy\csname DYNTREE@box@\roman{DYNTREE@ct}@\roman{act}\endcsname
%!
%! \addtocounter{act}{1}%
%! }%
%! \addtocounter{DYNTREE@ct}{1}%
%! }%
%!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Error Check END
% \fi
% \begin{macrocode}
}%
% Else
{%
\PackageError{dyntree}{Invalid start(#1)/finish(#4) call}%
}%
}%
% \end{macrocode}
%
%
% \Finale
\endinput
|