Skip to content

Commit

Permalink
Code format changes based on review feedback
Browse files Browse the repository at this point in the history
Signed-off-by: Hanson Char <[email protected]>
  • Loading branch information
hansonchar committed Jun 8, 2024
1 parent c6fd482 commit 6ea5033
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 123 deletions.
2 changes: 1 addition & 1 deletion doc/generic/pgf/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 the `graphdrawing` examples
- Fix mis-spelled Kellermann to Kellerman

### Changed
Expand Down
170 changes: 71 additions & 99 deletions tex/generic/pgf/graphdrawing/lua/pgf/gd/control/doc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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}
]]
})
--------------------------------------------------------------------

Expand Down Expand Up @@ -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}
]]
})
--------------------------------------------------------------------

Expand All @@ -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}
]]
})
--------------------------------------------------------------------

Expand All @@ -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}
]]
})
--------------------------------------------------------------------
43 changes: 20 additions & 23 deletions tex/generic/pgf/graphdrawing/lua/pgf/gd/trees/doc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
}
};
]]
})
--------------------------------------------------------------------

Expand Down

0 comments on commit 6ea5033

Please sign in to comment.