Skip to content

Commit abf597d

Browse files
committed
Code format changes based on review feedback
Signed-off-by: Hanson Char <hanson.char@gmail.com>
1 parent c6fd482 commit abf597d

File tree

3 files changed

+92
-123
lines changed

3 files changed

+92
-123
lines changed

doc/generic/pgf/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
1818
- Output bounding box adjustment in pgfsys-dvisvgm.def #1275
1919
- Fix shadings under LuaMetaTeX
2020
- Resolve missing `gnuplot` plots in manual #1238
21-
- Fix missing inclusion of libraries in the examples at https://tikz.dev/gd-trees and https://tikz.dev/gd-usage-tikz
21+
- Fix missing inclusion of libraries in `graphdrawing` examples
2222
- Fix mis-spelled Kellermann to Kellerman
2323

2424
### Changed

tex/generic/pgf/graphdrawing/lua/pgf/gd/control/doc.lua

Lines changed: 71 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -98,58 +98,46 @@ sense that some nodes are ``nailed to the canvas'' while other
9898
nodes can ``move freely''.
9999
]]
100100

101-
example({options =
102-
[[
103-
preamble=\usetikzlibrary{graphs,graphdrawing}
104-
\usegdlibrary{force}
105-
]],
106-
code =
107-
[[
108-
\begin{tikzpicture}
109-
\draw [help lines] (0,0) grid (3,2);
110-
\graph [spring layout]
111-
{
112-
a[x=1] -- { b, c, d, e -- {f,g,h} };
113-
{ h, g } -- a;
114-
};
115-
\end{tikzpicture}
116-
]]
101+
example({
102+
options = [[ preamble=\usetikzlibrary{graphs,graphdrawing} \usegdlibrary{force} ]],
103+
code = [[
104+
\begin{tikzpicture}
105+
\draw [help lines] (0,0) grid (3,2);
106+
\graph [spring layout]
107+
{
108+
a[x=1] -- { b, c, d, e -- {f,g,h} };
109+
{ h, g } -- a;
110+
};
111+
\end{tikzpicture}
112+
]]
117113
})
118114

119-
example({options =
120-
[[
121-
preamble=\usetikzlibrary{graphs,graphdrawing}
122-
\usegdlibrary{force}
123-
]],
124-
code =
125-
[[
126-
\begin{tikzpicture}
127-
\draw [help lines] (0,0) grid (3,2);
128-
\graph [spring layout]
129-
{
130-
a -- { b, c, d[x=0], e -- {f[x=2], g, h[x=1]} };
131-
{ h, g } -- a;
132-
};
133-
\end{tikzpicture}
134-
]]
115+
example({
116+
options = [[ preamble=\usetikzlibrary{graphs,graphdrawing} \usegdlibrary{force} ]],
117+
code = [[
118+
\begin{tikzpicture}
119+
\draw [help lines] (0,0) grid (3,2);
120+
\graph [spring layout]
121+
{
122+
a -- { b, c, d[x=0], e -- {f[x=2], g, h[x=1]} };
123+
{ h, g } -- a;
124+
};
125+
\end{tikzpicture}
126+
]]
135127
})
136128

137-
example({options =
138-
[[
139-
preamble=\usetikzlibrary{graphs,graphdrawing}
140-
\usegdlibrary{force}
141-
]],
142-
code =
143-
[[
144-
\begin{tikzpicture}
145-
\draw [help lines] (0,0) grid (3,2);
146-
\graph [spring layout]
147-
{
148-
a -- { b, c, d[x=0], e -- {f[x=2,y=1], g, h[x=1]} };
149-
{ h, g } -- a;
150-
};
151-
\end{tikzpicture}
152-
]]
129+
example({
130+
options = [[ preamble=\usetikzlibrary{graphs,graphdrawing} \usegdlibrary{force} ]],
131+
code = [[
132+
\begin{tikzpicture}
133+
\draw [help lines] (0,0) grid (3,2);
134+
\graph [spring layout]
135+
{
136+
a -- { b, c, d[x=0], e -- {f[x=2,y=1], g, h[x=1]} };
137+
{ h, g } -- a;
138+
};
139+
\end{tikzpicture}
140+
]]
153141
})
154142
--------------------------------------------------------------------
155143

@@ -180,34 +168,26 @@ Note how in the last example |c| is placed at |(1,1)| rather than
180168
|b| as would happen by default.
181169
]]
182170

183-
example({options =
184-
[[
185-
preamble=\usetikzlibrary{graphs,graphdrawing}
186-
\usegdlibrary{layered}
187-
]],
188-
code =
189-
[[
190-
\tikz \draw (0,0)
191-
-- (1,0.5) graph [edges=red, layered layout, anchor node=a] { a -> {b,c} }
192-
-- (1.5,0) graph [edges=blue, layered layout,
193-
anchor node=y, anchor at={(2,0)}] { x -> {y,z} };
194-
]]
171+
example({
172+
options = [[ preamble=\usetikzlibrary{graphs,graphdrawing} \usegdlibrary{layered} ]],
173+
code = [[
174+
\tikz \draw (0,0)
175+
-- (1,0.5) graph [edges=red, layered layout, anchor node=a] { a -> {b,c} }
176+
-- (1.5,0) graph [edges=blue, layered layout,
177+
anchor node=y, anchor at={(2,0)}] { x -> {y,z} };
178+
]]
195179
})
196180

197-
example({options =
198-
[[
199-
preamble=\usetikzlibrary{graphs,graphdrawing}
200-
\usegdlibrary{layered}
201-
]],
202-
code =
203-
[[
204-
\begin{tikzpicture}
205-
\draw [help lines] (0,0) grid (3,2);
181+
example({
182+
options = [[ preamble=\usetikzlibrary{graphs,graphdrawing} \usegdlibrary{layered} ]],
183+
code = [[
184+
\begin{tikzpicture}
185+
\draw [help lines] (0,0) grid (3,2);
206186
207-
\graph [layered layout, anchor node=c, edges=rounded corners]
208-
{ a -- {b [x=1,y=1], c [x=1,y=1] } -- d -- a};
209-
\end{tikzpicture}
210-
]]
187+
\graph [layered layout, anchor node=c, edges=rounded corners]
188+
{ a -- {b [x=1,y=1], c [x=1,y=1] } -- d -- a};
189+
\end{tikzpicture}
190+
]]
211191
})
212192
--------------------------------------------------------------------
213193

@@ -223,20 +203,16 @@ The coordinate at which the graph should be anchored when no
223203
explicit anchor is given for any node. The initial value is the origin.
224204
]]
225205

226-
example({options =
227-
[[
228-
preamble=\usetikzlibrary{graphs,graphdrawing}
229-
\usegdlibrary{layered}
230-
]],
231-
code =
232-
[[
233-
\begin{tikzpicture}
234-
\draw [help lines] (0,0) grid (2,2);
206+
example({
207+
options = [[ preamble=\usetikzlibrary{graphs,graphdrawing} \usegdlibrary{layered} ]],
208+
code = [[
209+
\begin{tikzpicture}
210+
\draw [help lines] (0,0) grid (2,2);
235211
236-
\graph [layered layout, edges=rounded corners, anchor at={(1,2)}]
237-
{ a -- {b, c [anchor here] } -- d -- a};
238-
\end{tikzpicture}
239-
]]
212+
\graph [layered layout, edges=rounded corners, anchor at={(1,2)}]
213+
{ a -- {b, c [anchor here] } -- d -- a};
214+
\end{tikzpicture}
215+
]]
240216
})
241217
--------------------------------------------------------------------
242218

@@ -259,19 +235,15 @@ In the example, |c| is placed at the origin since this is the
259235
default |anchor at| position.
260236
]]
261237

262-
example({options =
263-
[[
264-
preamble=\usetikzlibrary{graphs,graphdrawing}
265-
\usegdlibrary{layered}
266-
]],
267-
code =
268-
[[
269-
\begin{tikzpicture}
270-
\draw [help lines] (0,0) grid (2,2);
238+
example({
239+
options = [[ preamble=\usetikzlibrary{graphs,graphdrawing} \usegdlibrary{layered} ]],
240+
code = [[
241+
\begin{tikzpicture}
242+
\draw [help lines] (0,0) grid (2,2);
271243
272-
\graph [layered layout, edges=rounded corners]
273-
{ a -- {b, c [anchor here] } -- d -- a};
274-
\end{tikzpicture}
275-
]]
244+
\graph [layered layout, edges=rounded corners]
245+
{ a -- {b, c [anchor here] } -- d -- a};
246+
\end{tikzpicture}
247+
]]
276248
})
277249
--------------------------------------------------------------------

tex/generic/pgf/graphdrawing/lua/pgf/gd/trees/doc.lua

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -293,29 +293,26 @@ example
293293
};
294294
]]
295295

296-
example({options =
297-
[[
298-
preamble=\usetikzlibrary{shapes.misc, arrows.meta, decorations.pathmorphing}
299-
]],
300-
code =
301-
[[
302-
\tikz \graph [binary tree layout] {
303-
Knuth -> {
304-
Beeton -> Kellerman [second] -> Carnes,
305-
Tobin -> Plass -> { Lamport, Spivak }
306-
}
307-
};\qquad
308-
\tikz [>={Stealth[round,sep]}]
309-
\graph [binary tree layout, grow'=right, level sep=1.5em,
310-
nodes={right, fill=blue!50, text=white, chamfered rectangle},
311-
edges={decorate,decoration={snake, post length=5pt}}]
312-
{
313-
Knuth -> {
314-
Beeton -> Kellerman [second] -> Carnes,
315-
Tobin -> Plass -> { Lamport, Spivak }
316-
}
317-
};
318-
]]
296+
example({
297+
options = [[ preamble=\usetikzlibrary{shapes.misc, arrows.meta, decorations.pathmorphing} ]],
298+
code = [[
299+
\tikz \graph [binary tree layout] {
300+
Knuth -> {
301+
Beeton -> Kellerman [second] -> Carnes,
302+
Tobin -> Plass -> { Lamport, Spivak }
303+
}
304+
};\qquad
305+
\tikz [>={Stealth[round,sep]}]
306+
\graph [binary tree layout, grow'=right, level sep=1.5em,
307+
nodes={right, fill=blue!50, text=white, chamfered rectangle},
308+
edges={decorate,decoration={snake, post length=5pt}}]
309+
{
310+
Knuth -> {
311+
Beeton -> Kellerman [second] -> Carnes,
312+
Tobin -> Plass -> { Lamport, Spivak }
313+
}
314+
};
315+
]]
319316
})
320317
--------------------------------------------------------------------
321318

0 commit comments

Comments
 (0)