Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: correct/add subgraph preamble comments (fixes #1194) #1198

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions doc/generic/pgf/pgfmanual-en-tikz-graphs.tex
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ \subsection{Overview}
};
\end{codeexample}

\begin{codeexample}[preamble={\usetikzlibrary{graphs}}]
\begin{codeexample}[preamble={\usetikzlibrary{graphs.standard}}]
\tikz
\graph [nodes={draw, circle}, clockwise, radius=.5cm, empty nodes, n=5] {
subgraph I_n [name=inner] --[complete bipartite]
Expand All @@ -49,7 +49,7 @@ \subsection{Overview}
\end{codeexample}

\begin{codeexample}[
preamble={\usetikzlibrary{graphs}},
preamble={\usetikzlibrary{graphs.standard}},
pre={\definecolor{graphicbackground}{rgb}{0.96,0.96,0.8}},
]
\tikz
Expand Down Expand Up @@ -410,7 +410,7 @@ \subsubsection{Concept: Graph Expressions and Color Classes}
all red and all green nodes. More advanced connectors, like the |butterfly|
connector, allow you to add edges between color classes in a fancy manner.
%
\begin{codeexample}[preamble={\usetikzlibrary{graphs}}]
\begin{codeexample}[preamble={\usetikzlibrary{graphs.standard}}]
\tikz [x=8mm, y=6mm, circle]
\graph [nodes={fill=blue!70}, empty nodes, n=8] {
subgraph I_n [name=A] --[butterfly={level=4}]
Expand Down Expand Up @@ -3471,7 +3471,7 @@ \subsubsection{Graph Macros}
% The names of the two shores |V| and |W| can be changed as described in
% the documentation of the keys |/tikz/graphs/name shore V| and
% |/tikz/graphs/name shore W|.
% \begin{codeexample}[preamble={\usetikzlibrary{graphs}}]
% \begin{codeexample}[preamble={\usetikzlibrary{graphs.standard}}]
%\tikz \graph [grid placement] { subgraph Grid_nm [V={1,2,3}, W={4, 5, 6}] };
% \end{codeexample}
%\end{graph}
Expand Down
31 changes: 20 additions & 11 deletions tex/generic/pgf/graphdrawing/lua/pgf/gd/control/library.lua
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,16 @@ declare {
This behavior can be changed using this option. When the key is
invoked, nodes are placed \emph{behind} the edges.
"]],
examples = [["
\tikz \graph [simple necklace layout, nodes={draw,fill=white},
nodes behind edges]
{ subgraph K_n [n=7], 1 [regardless at={(0,-1)}] };
"]]
examples = {
{
options = [["preamble={\usetikzlibrary{graphs.standard,graphdrawing} \usegdlibrary{circular}}"]],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure whether I merged the support for this new syntax yet. I have to check that before merging.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you had. At least it seems to work in the currently available first example of

examples = {
{
options = [["preamble={\usetikzlibrary{graphs,graphdrawing} \usegdlibrary{force}}"]],
code = [["
\tikz \graph [spring electrical layout, horizontal=0 to 1]
{ 0 [electric charge=1] -- subgraph C_n [n=10] };
"]]
},{
code = [["
\tikz \graph [spring electrical layout, horizontal=0 to 1]
{ 0 [electric charge=5] -- subgraph C_n [n=10] };
"]]
},{
code = [["
\tikz \graph [spring electrical layout, horizontal=0 to 1]
{ [clique] 1 [electric charge=5], 2, 3, 4 };
"]]
}
}

which shows as

https://pgf-tikz.github.io/pgf/pgfmanual.pdf#page=477

code = [["
\tikz \graph [simple necklace layout, nodes={draw,fill=white},
nodes behind edges]
{ subgraph K_n [n=7], 1 [regardless at={(0,-1)}] };
"]]
}
}
}


Expand All @@ -72,11 +77,16 @@ declare {
summary = [["
This is the default placement of edges: Behind the nodes.
"]],
examples = [["
\tikz \graph [simple necklace layout, nodes={draw,fill=white},
edges behind nodes]
{ subgraph K_n [n=7], 1 [regardless at={(0,-1)}] };
"]]
examples = {
{
options = [["preamble={\usetikzlibrary{graphs.standard,graphdrawing} \usegdlibrary{circular}}"]],
code = [["
\tikz \graph [simple necklace layout, nodes={draw,fill=white},
edges behind nodes]
{ subgraph K_n [n=7], 1 [regardless at={(0,-1)}] };
"]]
}
}
}

---
Expand Down Expand Up @@ -193,4 +203,3 @@ declare {
key = InterfaceCore.subgraph_node_kind,
layer = 0
}

24 changes: 14 additions & 10 deletions tex/generic/pgf/graphdrawing/lua/pgf/gd/force/ControlCoarsening.lua
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,20 @@ declare {
in the two graphs, the nodes are placed at exactly two and four
coordinates in the final drawing.
"]],
examples = [["
\tikz \graph [spring layout, iterations=0,
minimum coarsening size=2]
{ subgraph C_n [n=8] };

\tikz \graph [spring layout, iterations=0,
minimum coarsening size=4]
{ subgraph C_n [n=8] };
"]]
examples = {
{
options = [["preamble={\usetikzlibrary{graphs.standard,graphdrawing} \usegdlibrary{force}}"]],
code = [["
\tikz \graph [spring layout, iterations=0,
minimum coarsening size=2]
{ subgraph C_n [n=8] };

\tikz \graph [spring layout, iterations=0,
minimum coarsening size=4]
{ subgraph C_n [n=8] };
"]]
}
}
}

---
Expand Down Expand Up @@ -145,4 +150,3 @@ declare {
{ { [clique] 1, 2 } -- 3 -- 4 -- { 5, 6, 7 } };
"]]
}

Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,19 @@ declare {
"]],
examples = {
{
options = [["preamble={\usetikzlibrary{graphs,graphdrawing} \usegdlibrary{force}}"]],
options = [["preamble={\usetikzlibrary{graphs.standard,graphdrawing} \usegdlibrary{force}}"]],
code = [["
\tikz \graph [spring electrical layout, horizontal=0 to 1]
{ 0 [electric charge=1] -- subgraph C_n [n=10] };
"]]
},{
options = [["preamble={\usetikzlibrary{graphs.standard,graphdrawing} \usegdlibrary{force}}"]],
code = [["
\tikz \graph [spring electrical layout, horizontal=0 to 1]
{ 0 [electric charge=5] -- subgraph C_n [n=10] };
"]]
},{
options = [["preamble={\usetikzlibrary{graphs.standard,graphdrawing} \usegdlibrary{force}}"]],
code = [["
\tikz \graph [spring electrical layout, horizontal=0 to 1]
{ [clique] 1 [electric charge=5], 2, 3, 4 };
Expand Down Expand Up @@ -102,4 +104,3 @@ declare {
least the results are somewhat strange when this key is used.
"]]
}

40 changes: 24 additions & 16 deletions tex/generic/pgf/graphdrawing/lua/pgf/gd/force/ControlIteration.lua
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,30 @@ declare {
The examples shows two drawings generated using two
different |iteration| limits.
"]],
examples = {[["
\tikz \graph [spring layout, iterations=10] { subgraph K_n [n=4] };
"]],[["
\tikz \graph [spring layout, iterations=500] { subgraph K_n [n=4] };
"]],[["
\tikz \graph [spring electrical layout, iterations=10]
{ subgraph K_n [n=4] };
"]],[["
\tikz \graph [spring electrical layout, iterations=500]
{ subgraph K_n [n=4] };
"]]
examples = {
{
options = [["preamble={\usetikzlibrary{graphs.standard,graphdrawing} \usegdlibrary{force}}"]],
code = [["
\tikz \graph [spring layout, iterations=10] { subgraph K_n [n=4] };
"]]
},{
options = [["preamble={\usetikzlibrary{graphs.standard,graphdrawing} \usegdlibrary{force}}"]],
code = [["
\tikz \graph [spring layout, iterations=500] { subgraph K_n [n=4] };
"]]
},{
options = [["preamble={\usetikzlibrary{graphs.standard,graphdrawing} \usegdlibrary{force}}"]],
code = [["
\tikz \graph [spring electrical layout, iterations=10]
{ subgraph K_n [n=4] };
"]]
},{
options = [["preamble={\usetikzlibrary{graphs.standard,graphdrawing} \usegdlibrary{force}}"]],
code = [["
\tikz \graph [spring electrical layout, iterations=500]
{ subgraph K_n [n=4] };
"]]
}
}
}

Expand Down Expand Up @@ -129,8 +142,3 @@ declare {
"]]
}
}





Loading