diff options
Diffstat (limited to 'Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-gd-usage-tikz.tex')
-rw-r--r-- | Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-gd-usage-tikz.tex | 45 |
1 files changed, 32 insertions, 13 deletions
diff --git a/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-gd-usage-tikz.tex b/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-gd-usage-tikz.tex index bbedfc01db9..32cf24e59bb 100644 --- a/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-gd-usage-tikz.tex +++ b/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-gd-usage-tikz.tex @@ -89,7 +89,8 @@ engine should apply a layout algorithm to the nodes in the scope. Typically, you just add an option ending with |... layout| to the |graph| path operation and then let the graph drawing do its magic: % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{graphs,graphdrawing} +\usegdlibrary{layered}}] \tikz [rounded corners] \graph [layered layout, sibling distance=8mm, level distance=8mm] { @@ -170,7 +171,8 @@ very specific to a single algorithm, a number of graph parameters will be important for many algorithms and they are documented in the course of the present section. Here is an example of an option the ``always works'': % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{graphs,graphdrawing} +\usegdlibrary{force}}] \tikz \graph [spring layout, vertical=1 to 2] { 1--2--3--1 }; \end{codeexample} @@ -219,7 +221,8 @@ for sublayouts. Let us start with the ``plain'' syntax for opening sublayouts: You pass a key for creating layouts to a |scope|: % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{graphdrawing} +\usegdlibrary{force,trees}}] \tikz [spring layout] { \begin{scope}[tree layout] \node (a) {a}; @@ -258,7 +261,8 @@ brackets. However, you \emph{must} provide a sublayout in braces. The contents of \meta{sublayout} will be parsed using the usual |graph| syntax, but will form a sublayout. % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{graphs,graphdrawing} +\usegdlibrary{force,trees}}] \tikz \graph [spring layout] { // [tree layout] { a -- {b, c} }; // [tree layout] { 1 -- 2 }; @@ -270,7 +274,8 @@ In the above example, there is no node before the double slash, which means that the two sublayouts will be part of the main graph, but will not be indicated otherwise. % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{graphs,graphdrawing} +\usegdlibrary{circular,trees}}] \tikz \graph [simple necklace layout] { // [simple necklace layout] { a -> b -> c -> d -> e -> f -> a }; @@ -294,7 +299,8 @@ layout does nothing here. Compare the above to the following code: % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{graphs,graphdrawing} +\usegdlibrary{circular,trees}}] \tikz \graph [simple necklace layout] { // [tree layout] { % first ``giant node'' a -> {1, 2}; @@ -336,7 +342,11 @@ follows: The idea ist that a subgraph node is declared like a normal node specification, but is followed by a double slash and a subgraph: % -\begin{codeexample}[width=5cm] +\begin{codeexample}[ + width=5cm, + preamble={\usetikzlibrary{graphs,graphdrawing} +\usegdlibrary{circular,trees}}, +] \tikz \graph [simple necklace layout] { tree 1[draw, circle] // [tree layout] { a -> {1, 2}; } -> b @@ -355,7 +365,8 @@ layout: If you do \emph{not} provide a layout name after the double slash, the subgraph node will simply surround all nodes that were placed by the main layout wherever they were placed: % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{graphs,graphdrawing} +\usegdlibrary{trees}}] \tikz [subgraph text bottom=text centered, subgraph nodes={font=\itshape}] \graph [tree layout] { @@ -377,7 +388,8 @@ Every time a subgraph node is created, the following style is execute: \begin{key}{/tikz/subgraph nodes=\meta{style}} Sets the |every subgraph node| style to \meta{style}. % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{graphs,graphdrawing} +\usegdlibrary{trees}}] \tikz [subgraph text bottom=text centered, subgraph nodes=red] \graph [tree layout] { @@ -398,7 +410,8 @@ Every time a subgraph node is created, the following style is execute: option is useful in situations when subgraph nodes generally should not have any text inside them. % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{graphs,graphdrawing} +\usegdlibrary{trees}}] \tikz [subgraph text none] \graph [tree layout] { a -> { b -> {c, d}, e -> {f, g -> h} }; @@ -417,7 +430,8 @@ Every time a subgraph node is created, the following style is execute: the subgraph node: Still inside the node, but above all nodes inside the subgraph node. % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{graphs,graphdrawing} +\usegdlibrary{trees}}] \tikz [subgraph text top=text ragged left] \graph [tree layout] { a -> { b -> {c, d}, e -> {f, g -> h} }; @@ -432,7 +446,11 @@ Every time a subgraph node is created, the following style is execute: You can pass any of the \meta{text alignment options} understood by \tikzname, such as |text centered|: % -\begin{codeexample}[width=5cm] +\begin{codeexample}[ + width=5cm, + preamble={\usetikzlibrary{graphs,graphdrawing} +\usegdlibrary{trees}}, +] \tikz [subgraph text top=text centered] \graph [tree layout] { a -> { b -> {c, d}, e -> {f, g -> h} }; @@ -444,7 +462,8 @@ Every time a subgraph node is created, the following style is execute: To place a label \emph{outside} the subgraph node, use a label, typically defined using the |quotes| library: % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{graphs,graphdrawing,quotes} +\usegdlibrary{trees}}] \tikz \graph [tree layout] { a -> { b -> {c, d}, e -> {f, g -> h} }; |