Skip to content

Commit

Permalink
add needed libraries to Lua examples (pgf-tikz#640 pgf-tikz#839)
Browse files Browse the repository at this point in the history
So far this is done as @hmenke suggested, i.e. the libraries are only shown for the first example if multiple examples are given.
  • Loading branch information
Mo-Gul committed Jun 21, 2020
1 parent 55b316d commit 71f4784
Show file tree
Hide file tree
Showing 24 changed files with 1,104 additions and 576 deletions.
99 changes: 71 additions & 28 deletions tex/generic/pgf/graphdrawing/lua/pgf/gd/control/ComponentAlign.lua
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,18 @@ declare {
than one node of a component, the node encountered first in the
component is used.
"]],
examples = [["
\tikz \graph [binary tree layout, nodes={draw}]
{ a, b -- c[align here], d -- e[second, align here] -- f };
"]]
examples = {{
options = [["
preamble={
\usetikzlibrary{graphs,graphdrawing}
\usegdlibrary{trees}
},
"]],
code = [["
\tikz \graph [binary tree layout, nodes={draw}]
{ a, b -- c[align here], d -- e[second, align here] -- f };
"]],
}}
}

---
Expand Down Expand Up @@ -200,11 +208,19 @@ declare {
suggest, the components will be placed left-to-right and they are
aligned such that their top nodes are in a line.
"]],
examples = [["
\tikz \graph [tree layout, nodes={draw, align=center},
components go right top aligned]
{ a, "high\\node" -- b};
"]]
examples = {{
options = [["
preamble={
\usetikzlibrary{graphs,graphdrawing}
\usegdlibrary{trees}
},
"]],
code = [["
\tikz \graph [tree layout, nodes={draw, align=center},
components go right top aligned]
{ a, "high\\node" -- b};
"]]
}}
}

---
Expand All @@ -222,11 +238,19 @@ declare {
This means that the components will be aligned with their bounding
boxed being top-aligned.
"]],
examples = [["
\tikz \graph [tree layout, nodes={draw, align=center},
components go right absolute top aligned]
{ a, "high\\node" -- b};
"]]
examples = {{
options = [["
preamble={
\usetikzlibrary{graphs,graphdrawing}
\usegdlibrary{trees}
},
"]],
code = [["
\tikz \graph [tree layout, nodes={draw, align=center},
components go right absolute top aligned]
{ a, "high\\node" -- b};
"]]
}}
}

---
Expand Down Expand Up @@ -295,11 +319,19 @@ declare {

summary = "See the other |components go ...| keys.",

examples = [["
\tikz \graph [tree layout, nodes={draw, align=center},
components go left top aligned]
{ a, "high\\node" -- b};
"]]
examples = {{
options = [["
preamble={
\usetikzlibrary{graphs,graphdrawing}
\usegdlibrary{trees}
},
"]],
code = [["
\tikz \graph [tree layout, nodes={draw, align=center},
components go left top aligned]
{ a, "high\\node" -- b};
"]]
}}
}

---
Expand Down Expand Up @@ -381,15 +413,26 @@ declare {
},
summary = "See the other |components go ...| keys.",

examples = {[["
\tikz \graph [tree layout, nodes={draw, align=center},
components go down left aligned]
{ a, hello -- {world,s} };
"]],[["
\tikz \graph [tree layout, nodes={draw, align=center},
components go up absolute left aligned]
{ a, hello -- {world,s}};
"]]
examples = {
{
options = [["
preamble={
\usetikzlibrary{graphs,graphdrawing}
\usegdlibrary{trees}
},
"]],
code = [["
\tikz \graph [tree layout, nodes={draw, align=center},
components go down left aligned]
{ a, hello -- {world,s} };
"]]
},{
code = [["
\tikz \graph [tree layout, nodes={draw, align=center},
components go up absolute left aligned]
{ a, hello -- {world,s}};
"]]
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,32 @@ declare {
by this option in any way. You can use the |grow| option or |orient|
options to orient individual components.
"]],
examples = {[["
\tikz \graph [tree layout, nodes={inner sep=1pt,draw,circle},
component direction=left]
{ a, b, c -- d -- e, f -- g };
"]],[["
\tikz \graph [tree layout, nodes={inner sep=1pt,draw,circle},
component direction=10]
{ a, b, c -- d -- e, f -- g };
"]],[["
\tikz \graph [tree layout, nodes={inner sep=1pt,draw,circle},
component direction=up]
{ a, b, c [grow=right] -- d -- e, f[grow=45] -- g };
"]]
examples = {
{
options = [["
preamble={
\usetikzlibrary{graphs,graphdrawing}
\usegdlibrary{trees}
},
"]],
code = [["
\tikz \graph [tree layout, nodes={inner sep=1pt,draw,circle},
component direction=left]
{ a, b, c -- d -- e, f -- g };
"]]
},{
code = [["
\tikz \graph [tree layout, nodes={inner sep=1pt,draw,circle},
component direction=10]
{ a, b, c -- d -- e, f -- g };
"]]
},{
code = [["
\tikz \graph [tree layout, nodes={inner sep=1pt,draw,circle},
component direction=up]
{ a, b, c [grow=right] -- d -- e, f[grow=45] -- g };
"]]
}
}
}

Expand Down
47 changes: 33 additions & 14 deletions tex/generic/pgf/graphdrawing/lua/pgf/gd/control/ComponentOrder.lua
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,26 @@ declare {
As above, but in decreasing order.
\end{itemize}
"]],
examples = {[["
\tikz \graph [tree layout, nodes={inner sep=1pt,draw,circle},
component order=by first specified node]
{ a, b, c, f -- g, c -- d -- e };
"]],[["
\tikz \graph [tree layout, nodes={inner sep=1pt,draw,circle},
component order=increasing node number]
{ a, b, c -- d -- e, f -- g };
"]]
examples = {
{
options = [["
preamble={
\usetikzlibrary{graphs,graphdrawing}
\usegdlibrary{trees}
},
"]],
code = [["
\tikz \graph [tree layout, nodes={inner sep=1pt,draw,circle},
component order=by first specified node]
{ a, b, c, f -- g, c -- d -- e };
"]]
},{
code = [["
\tikz \graph [tree layout, nodes={inner sep=1pt,draw,circle},
component order=increasing node number]
{ a, b, c -- d -- e, f -- g };
"]]
}
}
}

Expand Down Expand Up @@ -94,11 +105,19 @@ declare {
summary = [["
A shorthand for |component order=decreasing node number|.
"]],
examples = [["
\tikz \graph [tree layout, nodes={inner sep=1pt,draw,circle},
large components first]
{ a, b, c -- d -- e, f -- g };
"]]
examples = {{
options = [["
preamble={
\usetikzlibrary{graphs,graphdrawing}
\usegdlibrary{trees}
},
"]],
code = [["
\tikz \graph [tree layout, nodes={inner sep=1pt,draw,circle},
large components first]
{ a, b, c -- d -- e, f -- g };
"]]
}}
}


Expand Down
37 changes: 24 additions & 13 deletions tex/generic/pgf/graphdrawing/lua/pgf/gd/control/Components.lua
Original file line number Diff line number Diff line change
Expand Up @@ -107,19 +107,30 @@ declare {
support laying out unconnected graphs, this option has no effect;
rather it works as if this option were always set.
"]],
examples = {[["
\tikz \graph [simple necklace layout]
{
a -- b -- c -- d -- a,
1 -- 2 -- 3 -- 1
};
"]],[[",
\tikz \graph [simple necklace layout, componentwise]
{
a -- b -- c -- d -- a,
1 -- 2 -- 3 -- 1
};
"]]
examples = {
{
options = [["
preamble={
\usetikzlibrary{graphs,graphdrawing}
\usegdlibrary{circular}
},
"]],
code = [["
\tikz \graph [simple necklace layout]
{
a -- b -- c -- d -- a,
1 -- 2 -- 3 -- 1
};
"]]
},{
code = [[",
\tikz \graph [simple necklace layout, componentwise]
{
a -- b -- c -- d -- a,
1 -- 2 -- 3 -- 1
};
"]]
}
}
}

Expand Down
Loading

0 comments on commit 71f4784

Please sign in to comment.