From 5f1f861670cbd86729abd098de1520dacf227333 Mon Sep 17 00:00:00 2001 From: Hanson Char Date: Fri, 31 May 2024 12:53:15 -0700 Subject: [PATCH 1/6] Fix missing inclusion of three libraries in one of the examples at https://tikz.dev/gd-trees Signed-off-by: Hanson Char --- doc/generic/pgf/CHANGELOG.md | 2 ++ tex/generic/pgf/graphdrawing/lua/pgf/gd/trees/doc.lua | 4 +--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/generic/pgf/CHANGELOG.md b/doc/generic/pgf/CHANGELOG.md index bd8a8ab28..086d6212b 100644 --- a/doc/generic/pgf/CHANGELOG.md +++ b/doc/generic/pgf/CHANGELOG.md @@ -18,6 +18,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Output bounding box adjustment in pgfsys-dvisvgm.def #1275 - Fix shadings under LuaMetaTeX - Resolve missing `gnuplot` plots in manual #1238 +- Fix missing inclusion of three libraries in one of the examples at https://tikz.dev/gd-trees ### Changed @@ -40,6 +41,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Yukai Chou (@muzimuzhi) - Alexander Grahn - Max Chernoff +- Hanson Char ## [3.1.10] - 2023-01-13 Henri Menke diff --git a/tex/generic/pgf/graphdrawing/lua/pgf/gd/trees/doc.lua b/tex/generic/pgf/graphdrawing/lua/pgf/gd/trees/doc.lua index a44fd4703..f09b3dd3f 100644 --- a/tex/generic/pgf/graphdrawing/lua/pgf/gd/trees/doc.lua +++ b/tex/generic/pgf/graphdrawing/lua/pgf/gd/trees/doc.lua @@ -293,11 +293,9 @@ example }; ]] ---[[ -% TODOsp: codeexamples: the next example needs the library `arrows.meta` ---]] example [[ +\usetikzlibrary{shapes.misc, arrows.meta, decorations.pathmorphing} \tikz \graph [binary tree layout] { Knuth -> { Beeton -> Kellermann [second] -> Carnes, From c143e2eec9030b34d795d15a2a69d6dc14f9573b Mon Sep 17 00:00:00 2001 From: Hanson Char Date: Wed, 5 Jun 2024 18:49:47 -0700 Subject: [PATCH 2/6] Additional changes in response to the feedback at https://github.com/pgf-tikz/pgf/pull/1335 Signed-off-by: Hanson Char --- doc/generic/pgf/CHANGELOG.md | 2 +- .../graphdrawing/lua/pgf/gd/control/doc.lua | 66 ++++++++++++++----- .../pgf/graphdrawing/lua/pgf/gd/doc.lua | 7 +- .../pgf/graphdrawing/lua/pgf/gd/trees/doc.lua | 8 ++- 4 files changed, 59 insertions(+), 24 deletions(-) diff --git a/doc/generic/pgf/CHANGELOG.md b/doc/generic/pgf/CHANGELOG.md index 086d6212b..573da8996 100644 --- a/doc/generic/pgf/CHANGELOG.md +++ b/doc/generic/pgf/CHANGELOG.md @@ -18,7 +18,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Output bounding box adjustment in pgfsys-dvisvgm.def #1275 - Fix shadings under LuaMetaTeX - Resolve missing `gnuplot` plots in manual #1238 -- Fix missing inclusion of three libraries in one of the examples at https://tikz.dev/gd-trees +- Fix missing inclusion of libraries in the examples at https://tikz.dev/gd-trees and https://tikz.dev/gd-usage-tikz ### Changed diff --git a/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/doc.lua b/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/doc.lua index 19bfd52fd..1bad4117f 100644 --- a/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/doc.lua +++ b/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/doc.lua @@ -98,12 +98,12 @@ sense that some nodes are ``nailed to the canvas'' while other nodes can ``move freely''. ]] ---[[ -% TODOsp: codeexamples: the following 3 examples need these libraries -% \usetikzlibrary{graphs,graphdrawing} -% \usegdlibrary{force} ---]] -example +example({options = +[[ + preamble=\usetikzlibrary{graphs,graphdrawing} + \usegdlibrary{force} +]], +code = [[ \begin{tikzpicture} \draw [help lines] (0,0) grid (3,2); @@ -114,8 +114,14 @@ example }; \end{tikzpicture} ]] +}) -example +example({options = +[[ + preamble=\usetikzlibrary{graphs,graphdrawing} + \usegdlibrary{force} +]], +code = [[ \begin{tikzpicture} \draw [help lines] (0,0) grid (3,2); @@ -126,8 +132,14 @@ example }; \end{tikzpicture} ]] +}) -example +example({options = +[[ + preamble=\usetikzlibrary{graphs,graphdrawing} + \usegdlibrary{force} +]], +code = [[ \begin{tikzpicture} \draw [help lines] (0,0) grid (3,2); @@ -138,6 +150,7 @@ example }; \end{tikzpicture} ]] +}) -------------------------------------------------------------------- @@ -167,20 +180,26 @@ Note how in the last example |c| is placed at |(1,1)| rather than |b| as would happen by default. ]] ---[[ -% TODOsp: codeexamples: the following 4 examples need these libraries -% \usetikzlibrary{graphs,graphdrawing} -% \usegdlibrary{layered} ---]] -example +example({options = +[[ + preamble=\usetikzlibrary{graphs,graphdrawing} + \usegdlibrary{layered} +]], +code = [[ \tikz \draw (0,0) -- (1,0.5) graph [edges=red, layered layout, anchor node=a] { a -> {b,c} } -- (1.5,0) graph [edges=blue, layered layout, anchor node=y, anchor at={(2,0)}] { x -> {y,z} }; ]] +}) -example +example({options = +[[ + preamble=\usetikzlibrary{graphs,graphdrawing} + \usegdlibrary{layered} +]], +code = [[ \begin{tikzpicture} \draw [help lines] (0,0) grid (3,2); @@ -189,6 +208,7 @@ example { a -- {b [x=1,y=1], c [x=1,y=1] } -- d -- a}; \end{tikzpicture} ]] +}) -------------------------------------------------------------------- @@ -203,7 +223,12 @@ The coordinate at which the graph should be anchored when no explicit anchor is given for any node. The initial value is the origin. ]] -example +example({options = +[[ + preamble=\usetikzlibrary{graphs,graphdrawing} + \usegdlibrary{layered} +]], +code = [[ \begin{tikzpicture} \draw [help lines] (0,0) grid (2,2); @@ -212,6 +237,7 @@ example { a -- {b, c [anchor here] } -- d -- a}; \end{tikzpicture} ]] +}) -------------------------------------------------------------------- @@ -233,7 +259,12 @@ In the example, |c| is placed at the origin since this is the default |anchor at| position. ]] -example +example({options = +[[ + preamble=\usetikzlibrary{graphs,graphdrawing} + \usegdlibrary{layered} +]], +code = [[ \begin{tikzpicture} \draw [help lines] (0,0) grid (2,2); @@ -242,4 +273,5 @@ example { a -- {b, c [anchor here] } -- d -- a}; \end{tikzpicture} ]] +}) -------------------------------------------------------------------- diff --git a/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc.lua b/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc.lua index 78b68bbcb..857306d5f 100644 --- a/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc.lua +++ b/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc.lua @@ -112,11 +112,10 @@ end -- Adds an example to the |examples| field of the last key selected -- through the |key| command. -- --- @param string An additional example string. - -function doc.example (string) +-- @param input either a string of example or a table with two fields - "code" and "options". +function doc.example (input) local examples = rawget(current_key, "examples") or {} - examples[#examples + 1] = string + examples[#examples + 1] = input current_key.examples = examples end diff --git a/tex/generic/pgf/graphdrawing/lua/pgf/gd/trees/doc.lua b/tex/generic/pgf/graphdrawing/lua/pgf/gd/trees/doc.lua index f09b3dd3f..edc758b3c 100644 --- a/tex/generic/pgf/graphdrawing/lua/pgf/gd/trees/doc.lua +++ b/tex/generic/pgf/graphdrawing/lua/pgf/gd/trees/doc.lua @@ -293,9 +293,12 @@ example }; ]] -example +example({options = +[[ + preamble=\usetikzlibrary{shapes.misc, arrows.meta, decorations.pathmorphing} +]], +code = [[ -\usetikzlibrary{shapes.misc, arrows.meta, decorations.pathmorphing} \tikz \graph [binary tree layout] { Knuth -> { Beeton -> Kellermann [second] -> Carnes, @@ -313,6 +316,7 @@ example } }; ]] +}) -------------------------------------------------------------------- From ec8bd3eec78d1523cedb9f3f36460eada7ee4e0c Mon Sep 17 00:00:00 2001 From: Hanson Char Date: Wed, 5 Jun 2024 19:22:12 -0700 Subject: [PATCH 3/6] Minor code formatting fix Signed-off-by: Hanson Char --- tex/generic/pgf/graphdrawing/lua/pgf/gd/doc.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc.lua b/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc.lua index 857306d5f..7571452b7 100644 --- a/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc.lua +++ b/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc.lua @@ -112,7 +112,9 @@ end -- Adds an example to the |examples| field of the last key selected -- through the |key| command. -- --- @param input either a string of example or a table with two fields - "code" and "options". +-- @param input Either a string of example or a table with two fields: +-- "code" and "options". + function doc.example (input) local examples = rawget(current_key, "examples") or {} examples[#examples + 1] = input From c6fd482c82f4a47928258e212e1afca5ccb36ba3 Mon Sep 17 00:00:00 2001 From: Hanson Char Date: Fri, 7 Jun 2024 09:55:28 -0700 Subject: [PATCH 4/6] Fix mis-spelled Kellermann to Kellerman based on the discussion at https://github.com/pgf-tikz/pgf/pull/1335 Signed-off-by: Hanson Char --- doc/generic/pgf/CHANGELOG.md | 1 + tex/generic/pgf/graphdrawing/lua/pgf/gd/trees/doc.lua | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/generic/pgf/CHANGELOG.md b/doc/generic/pgf/CHANGELOG.md index 573da8996..40cb941b9 100644 --- a/doc/generic/pgf/CHANGELOG.md +++ b/doc/generic/pgf/CHANGELOG.md @@ -19,6 +19,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Fix shadings under LuaMetaTeX - Resolve missing `gnuplot` plots in manual #1238 - Fix missing inclusion of libraries in the examples at https://tikz.dev/gd-trees and https://tikz.dev/gd-usage-tikz +- Fix mis-spelled Kellermann to Kellerman ### Changed diff --git a/tex/generic/pgf/graphdrawing/lua/pgf/gd/trees/doc.lua b/tex/generic/pgf/graphdrawing/lua/pgf/gd/trees/doc.lua index edc758b3c..f8274b4da 100644 --- a/tex/generic/pgf/graphdrawing/lua/pgf/gd/trees/doc.lua +++ b/tex/generic/pgf/graphdrawing/lua/pgf/gd/trees/doc.lua @@ -301,7 +301,7 @@ code = [[ \tikz \graph [binary tree layout] { Knuth -> { - Beeton -> Kellermann [second] -> Carnes, + Beeton -> Kellerman [second] -> Carnes, Tobin -> Plass -> { Lamport, Spivak } } };\qquad @@ -311,7 +311,7 @@ code = edges={decorate,decoration={snake, post length=5pt}}] { Knuth -> { - Beeton -> Kellermann [second] -> Carnes, + Beeton -> Kellerman [second] -> Carnes, Tobin -> Plass -> { Lamport, Spivak } } }; From abf597dc4f83a4616f5fdd74b49ee8b37d6aa215 Mon Sep 17 00:00:00 2001 From: Hanson Char Date: Sat, 8 Jun 2024 13:20:36 -0700 Subject: [PATCH 5/6] Code format changes based on review feedback Signed-off-by: Hanson Char --- doc/generic/pgf/CHANGELOG.md | 2 +- .../graphdrawing/lua/pgf/gd/control/doc.lua | 170 ++++++++---------- .../pgf/graphdrawing/lua/pgf/gd/trees/doc.lua | 43 +++-- 3 files changed, 92 insertions(+), 123 deletions(-) diff --git a/doc/generic/pgf/CHANGELOG.md b/doc/generic/pgf/CHANGELOG.md index 40cb941b9..af999ff80 100644 --- a/doc/generic/pgf/CHANGELOG.md +++ b/doc/generic/pgf/CHANGELOG.md @@ -18,7 +18,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Output bounding box adjustment in pgfsys-dvisvgm.def #1275 - Fix shadings under LuaMetaTeX - Resolve missing `gnuplot` plots in manual #1238 -- Fix missing inclusion of libraries in the examples at https://tikz.dev/gd-trees and https://tikz.dev/gd-usage-tikz +- Fix missing inclusion of libraries in `graphdrawing` examples - Fix mis-spelled Kellermann to Kellerman ### Changed diff --git a/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/doc.lua b/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/doc.lua index 1bad4117f..52f8c4a05 100644 --- a/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/doc.lua +++ b/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/doc.lua @@ -98,58 +98,46 @@ sense that some nodes are ``nailed to the canvas'' while other nodes can ``move freely''. ]] -example({options = -[[ - preamble=\usetikzlibrary{graphs,graphdrawing} - \usegdlibrary{force} -]], -code = -[[ -\begin{tikzpicture} - \draw [help lines] (0,0) grid (3,2); - \graph [spring layout] - { - a[x=1] -- { b, c, d, e -- {f,g,h} }; - { h, g } -- a; - }; -\end{tikzpicture} -]] +example({ + options = [[ preamble=\usetikzlibrary{graphs,graphdrawing} \usegdlibrary{force} ]], + code = [[ + \begin{tikzpicture} + \draw [help lines] (0,0) grid (3,2); + \graph [spring layout] + { + a[x=1] -- { b, c, d, e -- {f,g,h} }; + { h, g } -- a; + }; + \end{tikzpicture} + ]] }) -example({options = -[[ - preamble=\usetikzlibrary{graphs,graphdrawing} - \usegdlibrary{force} -]], -code = -[[ -\begin{tikzpicture} - \draw [help lines] (0,0) grid (3,2); - \graph [spring layout] - { - a -- { b, c, d[x=0], e -- {f[x=2], g, h[x=1]} }; - { h, g } -- a; - }; -\end{tikzpicture} -]] +example({ + options = [[ preamble=\usetikzlibrary{graphs,graphdrawing} \usegdlibrary{force} ]], + code = [[ + \begin{tikzpicture} + \draw [help lines] (0,0) grid (3,2); + \graph [spring layout] + { + a -- { b, c, d[x=0], e -- {f[x=2], g, h[x=1]} }; + { h, g } -- a; + }; + \end{tikzpicture} + ]] }) -example({options = -[[ - preamble=\usetikzlibrary{graphs,graphdrawing} - \usegdlibrary{force} -]], -code = -[[ -\begin{tikzpicture} - \draw [help lines] (0,0) grid (3,2); - \graph [spring layout] - { - a -- { b, c, d[x=0], e -- {f[x=2,y=1], g, h[x=1]} }; - { h, g } -- a; - }; -\end{tikzpicture} -]] +example({ + options = [[ preamble=\usetikzlibrary{graphs,graphdrawing} \usegdlibrary{force} ]], + code = [[ + \begin{tikzpicture} + \draw [help lines] (0,0) grid (3,2); + \graph [spring layout] + { + a -- { b, c, d[x=0], e -- {f[x=2,y=1], g, h[x=1]} }; + { h, g } -- a; + }; + \end{tikzpicture} + ]] }) -------------------------------------------------------------------- @@ -180,34 +168,26 @@ Note how in the last example |c| is placed at |(1,1)| rather than |b| as would happen by default. ]] -example({options = -[[ - preamble=\usetikzlibrary{graphs,graphdrawing} - \usegdlibrary{layered} -]], -code = -[[ -\tikz \draw (0,0) - -- (1,0.5) graph [edges=red, layered layout, anchor node=a] { a -> {b,c} } - -- (1.5,0) graph [edges=blue, layered layout, - anchor node=y, anchor at={(2,0)}] { x -> {y,z} }; -]] +example({ + options = [[ preamble=\usetikzlibrary{graphs,graphdrawing} \usegdlibrary{layered} ]], + code = [[ + \tikz \draw (0,0) + -- (1,0.5) graph [edges=red, layered layout, anchor node=a] { a -> {b,c} } + -- (1.5,0) graph [edges=blue, layered layout, + anchor node=y, anchor at={(2,0)}] { x -> {y,z} }; + ]] }) -example({options = -[[ - preamble=\usetikzlibrary{graphs,graphdrawing} - \usegdlibrary{layered} -]], -code = -[[ -\begin{tikzpicture} - \draw [help lines] (0,0) grid (3,2); +example({ + options = [[ preamble=\usetikzlibrary{graphs,graphdrawing} \usegdlibrary{layered} ]], + code = [[ + \begin{tikzpicture} + \draw [help lines] (0,0) grid (3,2); - \graph [layered layout, anchor node=c, edges=rounded corners] - { a -- {b [x=1,y=1], c [x=1,y=1] } -- d -- a}; -\end{tikzpicture} -]] + \graph [layered layout, anchor node=c, edges=rounded corners] + { a -- {b [x=1,y=1], c [x=1,y=1] } -- d -- a}; + \end{tikzpicture} + ]] }) -------------------------------------------------------------------- @@ -223,20 +203,16 @@ The coordinate at which the graph should be anchored when no explicit anchor is given for any node. The initial value is the origin. ]] -example({options = -[[ - preamble=\usetikzlibrary{graphs,graphdrawing} - \usegdlibrary{layered} -]], -code = -[[ -\begin{tikzpicture} - \draw [help lines] (0,0) grid (2,2); +example({ + options = [[ preamble=\usetikzlibrary{graphs,graphdrawing} \usegdlibrary{layered} ]], + code = [[ + \begin{tikzpicture} + \draw [help lines] (0,0) grid (2,2); - \graph [layered layout, edges=rounded corners, anchor at={(1,2)}] - { a -- {b, c [anchor here] } -- d -- a}; -\end{tikzpicture} -]] + \graph [layered layout, edges=rounded corners, anchor at={(1,2)}] + { a -- {b, c [anchor here] } -- d -- a}; + \end{tikzpicture} + ]] }) -------------------------------------------------------------------- @@ -259,19 +235,15 @@ In the example, |c| is placed at the origin since this is the default |anchor at| position. ]] -example({options = -[[ - preamble=\usetikzlibrary{graphs,graphdrawing} - \usegdlibrary{layered} -]], -code = -[[ -\begin{tikzpicture} - \draw [help lines] (0,0) grid (2,2); +example({ + options = [[ preamble=\usetikzlibrary{graphs,graphdrawing} \usegdlibrary{layered} ]], + code = [[ + \begin{tikzpicture} + \draw [help lines] (0,0) grid (2,2); - \graph [layered layout, edges=rounded corners] - { a -- {b, c [anchor here] } -- d -- a}; -\end{tikzpicture} -]] + \graph [layered layout, edges=rounded corners] + { a -- {b, c [anchor here] } -- d -- a}; + \end{tikzpicture} + ]] }) -------------------------------------------------------------------- diff --git a/tex/generic/pgf/graphdrawing/lua/pgf/gd/trees/doc.lua b/tex/generic/pgf/graphdrawing/lua/pgf/gd/trees/doc.lua index f8274b4da..6560caea6 100644 --- a/tex/generic/pgf/graphdrawing/lua/pgf/gd/trees/doc.lua +++ b/tex/generic/pgf/graphdrawing/lua/pgf/gd/trees/doc.lua @@ -293,29 +293,26 @@ example }; ]] -example({options = -[[ - preamble=\usetikzlibrary{shapes.misc, arrows.meta, decorations.pathmorphing} -]], -code = -[[ -\tikz \graph [binary tree layout] { - Knuth -> { - Beeton -> Kellerman [second] -> Carnes, - Tobin -> Plass -> { Lamport, Spivak } - } -};\qquad -\tikz [>={Stealth[round,sep]}] - \graph [binary tree layout, grow'=right, level sep=1.5em, - nodes={right, fill=blue!50, text=white, chamfered rectangle}, - edges={decorate,decoration={snake, post length=5pt}}] - { - Knuth -> { - Beeton -> Kellerman [second] -> Carnes, - Tobin -> Plass -> { Lamport, Spivak } - } - }; -]] +example({ + options = [[ preamble=\usetikzlibrary{shapes.misc, arrows.meta, decorations.pathmorphing} ]], + code = [[ + \tikz \graph [binary tree layout] { + Knuth -> { + Beeton -> Kellerman [second] -> Carnes, + Tobin -> Plass -> { Lamport, Spivak } + } + };\qquad + \tikz [>={Stealth[round,sep]}] + \graph [binary tree layout, grow'=right, level sep=1.5em, + nodes={right, fill=blue!50, text=white, chamfered rectangle}, + edges={decorate,decoration={snake, post length=5pt}}] + { + Knuth -> { + Beeton -> Kellerman [second] -> Carnes, + Tobin -> Plass -> { Lamport, Spivak } + } + }; + ]] }) -------------------------------------------------------------------- From 15eb48fec4da67c3bc0c948c587dcb24bb12594c Mon Sep 17 00:00:00 2001 From: Hanson Char Date: Sun, 23 Jun 2024 18:30:02 -0700 Subject: [PATCH 6/6] Fix preamble + Nicer and more consistent formatting Signed-off-by: Hanson Char --- .../graphdrawing/lua/pgf/gd/control/doc.lua | 42 +++++++++---------- .../pgf/graphdrawing/lua/pgf/gd/trees/doc.lua | 11 +++-- 2 files changed, 29 insertions(+), 24 deletions(-) diff --git a/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/doc.lua b/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/doc.lua index 52f8c4a05..9a5704406 100644 --- a/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/doc.lua +++ b/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/doc.lua @@ -98,8 +98,8 @@ sense that some nodes are ``nailed to the canvas'' while other nodes can ``move freely''. ]] -example({ - options = [[ preamble=\usetikzlibrary{graphs,graphdrawing} \usegdlibrary{force} ]], +example { + options = [[ preamble={\usetikzlibrary{graphs,graphdrawing} \usegdlibrary{force}} ]], code = [[ \begin{tikzpicture} \draw [help lines] (0,0) grid (3,2); @@ -110,10 +110,10 @@ example({ }; \end{tikzpicture} ]] -}) +} -example({ - options = [[ preamble=\usetikzlibrary{graphs,graphdrawing} \usegdlibrary{force} ]], +example { + options = [[ preamble={\usetikzlibrary{graphs,graphdrawing} \usegdlibrary{force}} ]], code = [[ \begin{tikzpicture} \draw [help lines] (0,0) grid (3,2); @@ -124,10 +124,10 @@ example({ }; \end{tikzpicture} ]] -}) +} -example({ - options = [[ preamble=\usetikzlibrary{graphs,graphdrawing} \usegdlibrary{force} ]], +example { + options = [[ preamble={\usetikzlibrary{graphs,graphdrawing} \usegdlibrary{force}} ]], code = [[ \begin{tikzpicture} \draw [help lines] (0,0) grid (3,2); @@ -138,7 +138,7 @@ example({ }; \end{tikzpicture} ]] -}) +} -------------------------------------------------------------------- @@ -168,18 +168,18 @@ Note how in the last example |c| is placed at |(1,1)| rather than |b| as would happen by default. ]] -example({ - options = [[ preamble=\usetikzlibrary{graphs,graphdrawing} \usegdlibrary{layered} ]], +example { + options = [[ preamble={\usetikzlibrary{graphs,graphdrawing} \usegdlibrary{layered}} ]], code = [[ \tikz \draw (0,0) -- (1,0.5) graph [edges=red, layered layout, anchor node=a] { a -> {b,c} } -- (1.5,0) graph [edges=blue, layered layout, anchor node=y, anchor at={(2,0)}] { x -> {y,z} }; ]] -}) +} -example({ - options = [[ preamble=\usetikzlibrary{graphs,graphdrawing} \usegdlibrary{layered} ]], +example { + options = [[ preamble={\usetikzlibrary{graphs,graphdrawing} \usegdlibrary{layered}} ]], code = [[ \begin{tikzpicture} \draw [help lines] (0,0) grid (3,2); @@ -188,7 +188,7 @@ example({ { a -- {b [x=1,y=1], c [x=1,y=1] } -- d -- a}; \end{tikzpicture} ]] -}) +} -------------------------------------------------------------------- @@ -203,8 +203,8 @@ The coordinate at which the graph should be anchored when no explicit anchor is given for any node. The initial value is the origin. ]] -example({ - options = [[ preamble=\usetikzlibrary{graphs,graphdrawing} \usegdlibrary{layered} ]], +example { + options = [[ preamble={\usetikzlibrary{graphs,graphdrawing} \usegdlibrary{layered}} ]], code = [[ \begin{tikzpicture} \draw [help lines] (0,0) grid (2,2); @@ -213,7 +213,7 @@ example({ { a -- {b, c [anchor here] } -- d -- a}; \end{tikzpicture} ]] -}) +} -------------------------------------------------------------------- @@ -235,8 +235,8 @@ In the example, |c| is placed at the origin since this is the default |anchor at| position. ]] -example({ - options = [[ preamble=\usetikzlibrary{graphs,graphdrawing} \usegdlibrary{layered} ]], +example { + options = [[ preamble={\usetikzlibrary{graphs,graphdrawing} \usegdlibrary{layered}} ]], code = [[ \begin{tikzpicture} \draw [help lines] (0,0) grid (2,2); @@ -245,5 +245,5 @@ example({ { a -- {b, c [anchor here] } -- d -- a}; \end{tikzpicture} ]] -}) +} -------------------------------------------------------------------- diff --git a/tex/generic/pgf/graphdrawing/lua/pgf/gd/trees/doc.lua b/tex/generic/pgf/graphdrawing/lua/pgf/gd/trees/doc.lua index 6560caea6..597091c3a 100644 --- a/tex/generic/pgf/graphdrawing/lua/pgf/gd/trees/doc.lua +++ b/tex/generic/pgf/graphdrawing/lua/pgf/gd/trees/doc.lua @@ -293,8 +293,13 @@ example }; ]] -example({ - options = [[ preamble=\usetikzlibrary{shapes.misc, arrows.meta, decorations.pathmorphing} ]], +example { + options = [[ + preamble = { + \usetikzlibrary{shapes.misc,arrows.meta,graphs,graphdrawing,decorations.pathmorphing} + \usegdlibrary{trees} + } + ]], code = [[ \tikz \graph [binary tree layout] { Knuth -> { @@ -313,7 +318,7 @@ example({ } }; ]] -}) +} --------------------------------------------------------------------