diff options
Diffstat (limited to 'doc/user/dia_tree')
-rw-r--r-- | doc/user/dia_tree | 269 |
1 files changed, 156 insertions, 113 deletions
diff --git a/doc/user/dia_tree b/doc/user/dia_tree index d16f2bc..3b1b6d1 100644 --- a/doc/user/dia_tree +++ b/doc/user/dia_tree @@ -4,29 +4,37 @@ @Begin @PP @@Diag offers some symbols for producing tree diagrams, using the -tree. @Index { @Code "@Tree" symbol in @@Diag } +diagrams. @RawIndex { diagrams } +diagrams.tree @SubIndex { @Code "@Tree" symbol } +tree.diagrams @Index { @Code "@Tree" symbol (diagrams) } @Code "@Tree" symbol, which may appear anywhere within the nodes part: -@ID @OneRow @Code { -"@Diag {" -" ..." -" @Tree { ... }" -" ..." -"}" +@ID @OneRow @Code @Verbatim { +@Diag { + ... + @Tree { ... } + ... +} } Within this symbol, new symbols {@Code "@LeftSub"}, {@Code "@RightSub"}, +diagrams. @RawIndex { diagrams } +diagrams.leftsub @SubIndex { @Code "@LeftSub" symbol } +leftsub.diagrams @Index { @Code "@LeftSub" symbol (diagrams) } +diagrams. @RawIndex { diagrams } +diagrams.rightsub @SubIndex { @Code "@RightSub" symbol } +rightsub.diagrams @Index { @Code "@RightSub" symbol (diagrams) } {@Code "@FirstSub"}, {@Code "@NextSub"}, and {@Code "@StubSub"} become available. The first two are used to get a (non-empty) binary tree: @ID @OneRow { -@Code { -"@Tree {" -" @Circle A" -" @LeftSub {" -" @Circle B" -" @LeftSub @Square C" -" @RightSub @Square D" -" }" -" @RightSub @Circle E" -"}" +@Code @Verbatim { +@Tree { + @Circle A + @LeftSub { + @Circle B + @LeftSub @Square C + @RightSub @Square D + } + @RightSub @Circle E +} } ||7ct @Diag { @@ -52,19 +60,25 @@ left or right subtree, leave out the corresponding @Code "@LeftSub" or @Code "@RightSub" symbol. @PP A similar system using @Code "@FirstSub" and @Code "@NextSub" produces +diagrams. @RawIndex { diagrams } +diagrams.firstsub @SubIndex { @Code "@FirstSub" symbol } +firstsub.diagrams @Index { @Code "@FirstSub" symbol (diagrams) } +diagrams. @RawIndex { diagrams } +diagrams.nextsub @SubIndex { @Code "@NextSub" symbol } +nextsub.diagrams @Index { @Code "@NextSub" symbol (diagrams) } trees in which each node may have arbitrarily many children: @ID @OneRow { -@Code { -"@Tree {" -" @Circle A" -" @FirstSub {" -" @Circle B" -" @FirstSub @Square C" -" @NextSub @Square D" -" }" -" @NextSub @Circle E" -" @NextSub @Circle F" -"}" +@Code @Verbatim { +@Tree { + @Circle A + @FirstSub { + @Circle B + @FirstSub @Square C + @NextSub @Square D + } + @NextSub @Circle E + @NextSub @Circle F +} } ||7ct @Diag { @@ -90,16 +104,16 @@ intruding into the space beneath it. Although each subtree must contain a node for its root, it is not hard to get around this: @ID @OneRow { -@Code { -"@Tree" -"{" -"@Circle" -"@FirstSub @Circle" -"@NextSub pathstyle { noline }" -" @Circle outlinestyle { noline }" -" ..." -"@NextSub @Circle" -"}" +@Code @Verbatim { +@Tree +{ +@Circle +@FirstSub @Circle +@NextSub pathstyle { noline } + @Circle outlinestyle { noline } + ... +@NextSub @Circle +} } ||7ct @Diag { @@ -119,12 +133,15 @@ in a way consistent with the surrounding nodes, and offers margins and so forth which help with fine-tuning its position. @PP The fifth subtree symbol, {@Code "@StubSub"}, produces a stub subtree: +diagrams. @RawIndex { diagrams } +diagrams.stubsub @SubIndex { @Code "@StubSub" symbol } +stubsub.diagrams @Index { @Code "@StubSub" symbol (diagrams) } @ID @OneRow { -@Code { -"@Tree {" -"@Circle @Eq { a }" -"@StubSub @Eq { T tsub a }" -"}" +@Code @Verbatim { +@Tree { +@Circle @Eq { a } +@StubSub @Eq { T tsub a } +} } ||7ct @Diag { @@ -152,18 +169,18 @@ The subtree symbols have all of the options of {@Code "@Link"}, and these apply to the link drawn from the parent of the root of the subtree to the root of the subtree (or anticlockwise around the stub object): @ID @OneRow { -@Code { -"@Tree {" -" @Circle A" -" @LeftSub" -" arrow { yes }" -" xlabel { 1 }" -" @Circle B" -" @RightSub" -" arrow { yes }" -" xlabel { 2 }" -" @Circle C" -"}" +@Code @Verbatim { +@Tree { + @Circle A + @LeftSub + arrow { yes } + xlabel { 1 } + @Circle B + @RightSub + arrow { yes } + xlabel { 2 } + @Circle C +} } ||7ct @Diag { @@ -185,16 +202,22 @@ To get reverse arrows use @Code "arrow { back }" as usual. The subtree symbols do not need @Code from and @Code to options, because they already know which nodes they are linking together. However, you may use @Code from or @Code to to give a tag specifying a particular +diagrams. @RawIndex { diagrams } +diagrams.from @SubIndex { @Code "from" option } +from.diagrams @Index { @Code "from" option (diagrams) } +diagrams. @RawIndex { diagrams } +diagrams.to @SubIndex { @Code "to" option } +to.diagrams @Index { @Code "to" option (diagrams) } point within the node: @ID @OneRow { -@Code { -"@Tree {" -"@Circle" -"@LeftSub from { S } to { N }" -" @Isosceles vsize { 2f }" -"@RightSub from { S } to { N }" -" @Isosceles vsize { 2f }" -"}" +@Code @Verbatim { +@Tree { +@Circle +@LeftSub from { S } to { N } + @Isosceles vsize { 2f } +@RightSub from { S } to { N } + @Isosceles vsize { 2f } +} } ||7ct @Diag @@ -213,15 +236,15 @@ In this example both links go from the @Code S tag of the parent node to the options also work for {@Code "@StubSub"}, where they refer to the start and end of the stub path: @ID @OneRow { -@Code { -"@Tree {" -"@Circle @Eq { a }" -"@StubSub" -" from { SW }" -" to { SE }" -"@Box outlinestyle { noline }" -" @Eq { T tsub a }" -"}" +@Code @Verbatim { +@Tree { +@Circle @Eq { a } +@StubSub + from { SW } + to { SE } +@Box outlinestyle { noline } + @Eq { T tsub a } +} } ||7ct @Diag { @@ -239,25 +262,31 @@ and so the tags both refer to points in the parent node in this case. @PP The @Code "@LeftSub" and @Code "@RightSub" symbols have variants called @Code "@ZeroWidthLeftSub" and @Code "@ZeroWidthRightSub" which are the +diagrams. @RawIndex { diagrams } +diagrams.zerowidthleftsub @SubIndex { @Code "@ZeroWidthLeftSub" symbol } +zerowidthleftsub.diagrams @Index { @Code "@ZeroWidthLeftSub" (diagrams) } +diagrams. @RawIndex { diagrams } +diagrams.zerowidthrightsub @SubIndex { @Code "@ZeroWidthRightSub" symbol } +zerowidthrightsub.diagrams @Index { @Code "@ZeroWidthRightSub" (diagrams) } same except that the resulting subtrees consume no width: @ID @OneRow { -@Code { -"@Tree {" -"@Circle" -"@LeftSub {" -" @Circle" -" @LeftSub @Square" -" @RightSub @Square" -"}" -"@RightSub {" -" @Circle" -" @LeftSub {" -" @Circle" -" @ZeroWidthLeftSub @Square" -" @ZeroWidthRightSub @Square" -" }" -" @RightSub @Square" -"} }" +@Code @Verbatim { +@Tree { +@Circle +@LeftSub { + @Circle + @LeftSub @Square + @RightSub @Square +} +@RightSub { + @Circle + @LeftSub { + @Circle + @ZeroWidthLeftSub @Square + @ZeroWidthRightSub @Square + } + @RightSub @Square +} } } ||7ct @Diag { @@ -285,23 +314,29 @@ There is nothing analogous for the other subtree symbols. @PP The @Code "@Diag" symbol has a few options for adjusting the appearance of the tree. The @Code "treehsep" option determines the horizontal space left +diagrams. @RawIndex { diagrams } +diagrams.treehsep @SubIndex { @Code "treehsep" option } +treehsep.diagrams @Index { @Code "treehsep" option (diagrams) } between a root and its left subtree, between a root and its right subtree, and between one subtree and the next when @Code "@NextSub" is used. The @Code "treevsep" option determines the vertical space left between a root +diagrams. @RawIndex { diagrams } +diagrams.treevsep @SubIndex { @Code "treevsep" option } +treevsep.diagrams @Index { @Code "treevsep" option (diagrams) } and its subtrees: @ID @OneRow { -@Code { -"@Diag" -" treehsep { 0c }" -" treevsep { 0c }" -"{" -"@Tree" -"{" -" @Circle A" -" @LeftSub @Square B" -" @RightSub @Square C" -"}" -"}" +@Code @Verbatim { +@Diag + treehsep { 0c } + treevsep { 0c } +{ +@Tree +{ + @Circle A + @LeftSub @Square B + @RightSub @Square C +} +} } ||7ct @Diag @@ -322,6 +357,9 @@ These options may also be given to individual subtree symbols, although all children of their parent. @PP The @Code "treehindent" option determines where the root of a non-binary +diagrams. @RawIndex { diagrams } +diagrams.treehindent @SubIndex { @Code "treehindent" option } +treehindent.diagrams @Index { @Code "treehindent" option (diagrams) } tree is positioned over its subtrees; the value may be @Code "left" for at left, @Code "ctr" for centred over them (the default), @Code "right" for at the right, or any length, meaning that far from @@ -340,7 +378,9 @@ the end. The root always has tag {@Code "T"}. The tree as a whole may be retagged in the usual way. @PP There is an @Code "@HTree" symbol which is the same as -htree. @Index { @Code "@HTree" symbol in @@Diag } +diagrams. @RawIndex { diagrams } +diagrams.htree @SubIndex { @Code "@HTree" symbol } +htree.diagrams @Index { @Code "@HTree" symbol (diagrams) } @Code "@Tree" except that the tree grows horizontally (from left to right) instead of vertically. The same symbols are available within @Code "@HTree" as within {@Code "@Tree"}; @Code "@LeftSub" and @@ -348,20 +388,23 @@ right) instead of vertically. The same symbols are available within @Code "@RightSub" and @Code "@NextSub" produce lower trees. @Code "@HTree" has no @Code "treehindent" option; instead, it has an exactly analogous @Code "treevindent" option. +diagrams. @RawIndex { diagrams } +diagrams.treevindent @SubIndex { @Code "treevindent" option } +treevindent.diagrams @Index { @Code "treevindent" option (diagrams) } @PP @Code "@HTree" may be used to get horizontal lists: @ID @OneRow { -@Code { -"@I @Diag" -" arrow { yes } treehsep { 1c } {" -"@HTree {" -" @Node A" -" @FirstSub {" -" @Node B" -" @FirstSub @Node C" -" }" -"}" -"}" +@Code @Verbatim { +@I @Diag + arrow { yes } treehsep { 1c } { +@HTree { + @Node A + @FirstSub { + @Node B + @FirstSub @Node C + } +} +} } ||7ct @I @Diag arrow { yes } treehsep { 1c } { |