diff options
Diffstat (limited to 'Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-tikz-trees.tex')
-rw-r--r-- | Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-tikz-trees.tex | 75 |
1 files changed, 38 insertions, 37 deletions
diff --git a/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-tikz-trees.tex b/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-tikz-trees.tex index f3f2a514f33..ac0a00bda5f 100644 --- a/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-tikz-trees.tex +++ b/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-tikz-trees.tex @@ -33,7 +33,7 @@ mathematician or a computer scientist by looking at the direction their trees grow. A computer scientist's trees will grow downward while a mathematician's tree will grow upward. Naturally, the \emph{correct} way is the mathematician's way, which can be specify as -follows: +follows: \begin{codeexample}[] \begin{tikzpicture} \node {root} [grow'=up] @@ -49,7 +49,7 @@ In \tikzname, trees are specified by adding \emph{children} to a node on a path using the |child| operation: \begin{pathoperation}{child}{\opt{\oarg{options}}% - \opt{|foreach|\meta{variables}|in|\marg{values}}\opt{\marg{child path}}} + \opt{|foreach|\meta{variables}|in|\marg{values}}\opt{\marg{child path}}} This operation should directly follow a completed |node| operation or another |child| operation, although it is permissible that the first |child| operation is preceded by options (we will come to @@ -61,7 +61,7 @@ node on a path using the |child| operation: |child| and its arguments until it reaches a path operation that is not a |child|. Note that this will fix the character codes of all text inside the child arguments, which means, in essence, that you - cannot use verbatim text inside the nodes inside a |child|. Sorry. + cannot use verbatim text inside the nodes inside a |child|. Sorry. Once the children have been collected and counted, \tikzname\ starts generating the child nodes. For each child of a parent node @@ -80,7 +80,7 @@ node on a path using the |child| operation: each value in this list, a new |child| is added to the node. The syntax for \meta{variables} and for \meta{values} is the same as for the |\foreach| statement, see Section~\ref{section-foreach}. For - example, when you say + example, when you say \begin{codeexample}[code only] node {root} child [red] foreach \name in {1,2} {node {\name}} \end{codeexample} @@ -88,7 +88,7 @@ node {root} child [red] foreach \name in {1,2} {node {\name}} \begin{codeexample}[code only] node {root} child[red] {node {1}} child[ref] {node {2}} \end{codeexample} - When you write + When you write \begin{codeexample}[code only] node {root} child[\pos] foreach \name/\pos in {1/left,2/right} {node[\pos] {\name}} \end{codeexample} @@ -103,7 +103,7 @@ node {root} child[left] {node[left] {1}} child[right] {node[right] {2}} [level distance=4mm,level/.style={sibling distance=8mm/#1}] \coordinate child foreach \x in {0,1} - {child foreach \y in {0,1} + {child foreach \y in {0,1} {child foreach \z in {0,1}}}; \end{tikzpicture} \end{codeexample} @@ -130,7 +130,7 @@ first child, the \meta{child path} has the child node |node {y}|. For the second child, no child node is specified and, thus, it is just |coordinate|. -As for any normal node, you can give the child node a name, shift it +As for any normal node, you can give the child node a name, shift it around, or use options to influence how it is rendered. \begin{codeexample}[] \begin{tikzpicture} @@ -147,14 +147,14 @@ node. However, the node specification may be followed by arbitrary other material that will be added to the picture, transformed to the child's coordinate system. For your convenience, a move-to |(0,0)| operation is inserted automatically at the beginning of the path. Here -is an example: +is an example: \begin{codeexample}[] \begin{tikzpicture} \node {root} child {[fill] circle (2pt)} child {[fill] circle (2pt)}; -\end{tikzpicture} +\end{tikzpicture} \end{codeexample} @@ -210,7 +210,7 @@ Here is an example: \begin{codeexample}[] \begin{tikzpicture} \node (root) {root} - child + child child { child {coordinate (special)} child @@ -223,6 +223,7 @@ Here is an example: \end{codeexample} \subsection{Specifying Options for Trees and Children} +\label{section-tree-options} Each |child| may have its own \meta{options}, which apply to ``the whole child,'' including all of its grandchildren. Here is an @@ -240,7 +241,7 @@ example: The options of the root node have no effect on the children since the options of a node are always ``local'' to that node. Because of this, the edges in the following tree are black, not red. - + \begin{codeexample}[] \begin{tikzpicture}[thick] \node [red] {root} @@ -328,7 +329,7 @@ There are additional styles that influence how children are rendered: \begin{stylekey}{/tikz/level \meta{number} (initially \normalfont empty)} This style is used in addition to the |level| style. So, when you say |\node {x} child child;|, then the following key list is - executed: |level=1,level 1|. + executed: |level=1,level 1|. \begin{codeexample}[] \begin{tikzpicture} @@ -352,7 +353,7 @@ There are additional styles that influence how children are rendered: Perhaps the most difficult part in drawing a tree is the correct layout of the children. Typically, the children have different sizes and it is not easy to arrange them in such a manner that not too much -space is wasted, the children do not overlap, and they are either +space is wasted, the children do not overlap, and they are either evenly spaced or their centers are evenly distributed. Calculating good positions is especially difficult since a good position for the first child may depend on the size of the last child. @@ -375,14 +376,14 @@ distance between children (appropriately called the distances may change from level to level. The direction in which the tree grows can be changed globally and for parts of the tree. You can even specify your own ``growth function'' to arrange children on a -circle or along special lines or curves. +circle or along special lines or curves. \subsubsection{Default Growth Function} The default growth function works as follows: Assume that we are given a node and five children. These children will be placed on a line with their centers (or, more generally, with their anchors) spaced apart by -the current |sibling distance|. The line is +the current |sibling distance|. The line is orthogonal to the current \emph{direction of growth}, which is set with the |grow| and |grow'| option (the latter option reverses the ordering of the children). The distance from the line to the parent node @@ -402,7 +403,7 @@ is given by the |level distance|. \draw[|<->|,thick] (root-1.center) -- node[above,sloped] {sibling distance} (root-2.center); - \draw[|<->|,thick] (root.center) + \draw[|<->|,thick] (root.center) -- node[above,sloped] {level distance} +(-10:\tikzleveldistance); \end{tikzpicture} \end{codeexample} @@ -410,10 +411,10 @@ is given by the |level distance|. \begin{key}{/tikz/level distance=\meta{distance} (initially 15mm)} This key determines the distance between different levels of the - tree, more precisely, between the parent and the line + tree, more precisely, between the parent and the line on which its children are arranged. When given to a single child, this will set the distance for this child only. - + \begin{codeexample}[] \begin{tikzpicture} \node {root} @@ -425,14 +426,14 @@ is given by the |level distance|. child child } - child[level distance=10mm]; + child[level distance=10mm]; \end{tikzpicture} \end{codeexample} - + \begin{codeexample}[] \begin{tikzpicture} - [level 1/.style={level distance=10mm}, - level 2/.style={level distance=5mm}] + [level 1/.style={level distance=10mm}, + level 2/.style={level distance=5mm}] \node {root} child child { @@ -447,7 +448,7 @@ is given by the |level distance|. \begin{key}{/tikz/sibling distance=\meta{distance} (initially 15mm)} This key specifies the distance between the anchors of the - children of a parent node. + children of a parent node. \begin{codeexample}[] \begin{tikzpicture} @@ -494,7 +495,7 @@ is given by the |level distance|. }; \end{tikzpicture} \end{codeexample} -\end{key} +\end{key} \begin{key}{/tikz/grow=\meta{direction}} @@ -543,7 +544,7 @@ is given by the |level distance|. child child[grow=right] { child child child - }; + }; \end{tikzpicture} \end{codeexample} @@ -561,7 +562,7 @@ is given by the |level distance|. coordinate (wrong) }; \draw[<-,red] ([yshift=-2mm]wrong) -- +(0,-1) - node[below]{This is wrong!}; + node[below]{This is wrong!}; \end{tikzpicture} \end{codeexample} @@ -616,10 +617,10 @@ will not be rendered. to be used for computing the children's position. For example, when there is only one child and the |level distance| is |2cm|, then the child node will be placed two centimeters below the \meta{anchor} of - the parent node. ``Beinng placed'' means that the child node's + the parent node. ``Being placed'' means that the child node's anchor (which is the anchor specified using the |anchor=| option in the |node| command of the child) is two centimeters below the parent - node's \meta{anchor}. + node's \meta{anchor}. In the following example, the two red lines both have length |1cm|. \begin{codeexample}[] @@ -640,7 +641,7 @@ will not be rendered. \begin{codeexample}[] \begin{tikzpicture} [level distance=2cm,growth parent anchor=north, - every node/.style={anchor=north,rectangle,draw} + every node/.style={anchor=north,rectangle,draw} every child node/.style={anchor=south}] \node at (0,0) {root} child {node {small}}; @@ -673,7 +674,7 @@ will not be rendered. transform the coordinate system further. For example, it could be rotated or scaled. - Additional growth functions are defined in the library, see + Additional growth functions are defined in the library, see Section~\ref{section-tree-library}. \end{key} @@ -703,7 +704,7 @@ edge called the |edge from parent|. This edge is added to the This options allows you to set the edge from parent path to a new path. Initially, this path is the following: \begin{codeexample}[code only] -(\tikzparentnode\tikzparentanchor) -- (\tikzchildnode\tikzchildanchor) +(\tikzparentnode\tikzparentanchor) -- (\tikzchildnode\tikzchildanchor) \end{codeexample} The |\tikzparentnode| is a macro that will expand to the name of the parent node. This works even when you have not assigned a name @@ -740,7 +741,7 @@ edge called the |edge from parent|. This edge is added to the Specifies the anchor where the edge from parent meets the child node by setting the macro |\tikzchildanchor| to |.|\meta{anchor}. - + If you specify |border| as the \meta{anchor}, then the macro |\tikzchildanchor| is set to the empty string. The effect of this is that the edge from the parent will meet the child on the @@ -769,10 +770,10 @@ edge called the |edge from parent|. This edge is added to the also installed prior to inserting the path: \begin{stylekey}{/tikz/edge from parent (initially draw)} This style is inserted right before the edge from parent path and - before the \meta{options} are inserted. + before the \meta{options} are inserted. \begin{codeexample}[] \begin{tikzpicture} - [edge from parent/.style={draw,red,thick}] + [edge from parent/.style={draw,red,thick}] \node {root} child {node {left} edge from parent[dashed]} child {node {right} @@ -796,7 +797,7 @@ edge called the |edge from parent|. This edge is added to the As an example, consider the following code: \begin{codeexample}[code only] -\node (root) {} child {node (child) {} edge to parent node {label}}; +\node (root) {} child {node (child) {} edge to parent node {label}}; \end{codeexample} The |edge to parent| operation and the following |node| operation will, together, have the same effect as if we had said: @@ -832,7 +833,7 @@ edge called the |edge from parent|. This edge is added to the -%%% Local Variables: +%%% Local Variables: %%% mode: latex %%% TeX-master: "pgfmanual-pdftex-version" -%%% End: +%%% End: |