diff options
Diffstat (limited to 'Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-gd-overview.tex')
-rw-r--r-- | Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-gd-overview.tex | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-gd-overview.tex b/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-gd-overview.tex index 39ecd659a87..8fc660a937f 100644 --- a/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-gd-overview.tex +++ b/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-gd-overview.tex @@ -36,7 +36,8 @@ should be. This is something you leave to a \emph{graph drawing algorithm}. The algorithm gets your description of the graph as an input and then decides where the nodes should go on the page. % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{graphs,graphdrawing} +\usegdlibrary{trees}}] \tikz \graph [binary tree layout, level distance=5mm] { 4 -- { 3 -- 0 -- 1[second], @@ -48,9 +49,8 @@ the nodes should go on the page. }; \end{codeexample} -\begin{codeexample}[] -% \usetikzlibrary{graphs,graphdrawing,quotes} -% \usegdlibrary{force} +\begin{codeexample}[preamble={\usetikzlibrary{graphs,graphdrawing,quotes} +\usegdlibrary{force}}] \tikz \graph [spring layout, edge quotes mid, edges={nodes={font=\scriptsize, fill=white, sloped, inner sep=1pt}}] @@ -71,13 +71,13 @@ dozens of new algorithms are proposed. Unlike the rest of \pgfname\ and \tikzname, which is implemented purely in \TeX, the graph drawing algorithms are simply too complex to be implemented -directly in \TeX. Instead, the programming language Lua is used by the graph -drawing library -- a programming language that has been integrated into recent -versions of \TeX. This means that (a) as a user of the graph drawing engine you -run \TeX\ on your documents in the usual way, no external programs are called -since Lua is already integrated into \TeX, and (b) it is pretty easy to -implement new graph drawing algorithms for \tikzname\ since Lua can be used and -no \TeX\ programming knowledge is needed. +directly in \TeX. Instead, the programming language Lua is used by the +|graphdrawing| library -- a programming language that has been integrated into +recent versions of \TeX. This means that (a) as a user of the graph drawing +engine you run \TeX\ on your documents in the usual way, no external programs +are called since Lua is already integrated into \TeX, and (b) it is pretty easy +to implement new graph drawing algorithms for \tikzname\ since Lua can be used +and no \TeX\ programming knowledge is needed. \subsection{Using the Graph Drawing System} @@ -88,8 +88,9 @@ example, where the |layered layout| option tells \tikzname\ that the graph should be drawn (``should be laid out'') using a so-called ``layered graph drawing algorithm'' (what these are will be explained later): % -\begin{codeexample}[] -\tikz [>=spaced stealth'] +\begin{codeexample}[preamble={\usetikzlibrary{arrows.meta,graphs,graphdrawing} +\usegdlibrary{layered}}] +\tikz [>={Stealth[round,sep]}] \graph [layered layout, components go right top aligned, nodes=draw, edges=rounded corners] { first root -> {1 -> {2, 3, 7} -> {4, 5}, 6 }, 4 -- 5; @@ -101,7 +102,8 @@ drawing algorithm'' (what these are will be explained later): Here is another example, where a different layout method is used that is more appropriate for trees: % -\begin{codeexample}[] +\begin{codeexample}[preamble={\usetikzlibrary{graphdrawing} +\usegdlibrary{trees}}] \tikz [grow'=up, binary tree layout, nodes={circle,draw}] \node {1} child { node {2} @@ -122,7 +124,9 @@ appropriate for trees: A final example, this time using a ``spring electrical layout'' (whatever that might be\dots): % -\begin{codeexample}[] +\begin{codeexample}[ + preamble={\usetikzlibrary{decorations.pathmorphing,graphdrawing} +\usegdlibrary{force}}] \tikz [spring electrical layout, node distance=1.3cm, every edge/.style={ decoration={coil, aspect=-.5, post length=1mm, |