@@ -98,12 +98,12 @@ sense that some nodes are ``nailed to the canvas'' while other
9898nodes can ``move freely''.
9999]]
100100
101- --[[
102- % TODOsp: codeexamples: the following 3 examples need these libraries
103- % \usetikzlibrary{graphs,graphdrawing}
104- % \usegdlibrary{force}
105- --]]
106- example
101+ example ({ options =
102+ [[
103+ preamble= \usetikzlibrary{graphs,graphdrawing}
104+ \usegdlibrary{force}
105+ ]] ,
106+ code =
107107[[
108108\begin{tikzpicture}
109109 \draw [help lines] (0,0) grid (3,2);
@@ -114,8 +114,14 @@ example
114114 };
115115\end{tikzpicture}
116116]]
117+ })
117118
118- example
119+ example ({options =
120+ [[
121+ preamble=\usetikzlibrary{graphs,graphdrawing}
122+ \usegdlibrary{force}
123+ ]] ,
124+ code =
119125[[
120126\begin{tikzpicture}
121127 \draw [help lines] (0,0) grid (3,2);
@@ -126,8 +132,14 @@ example
126132 };
127133\end{tikzpicture}
128134]]
135+ })
129136
130- example
137+ example ({options =
138+ [[
139+ preamble=\usetikzlibrary{graphs,graphdrawing}
140+ \usegdlibrary{force}
141+ ]] ,
142+ code =
131143[[
132144\begin{tikzpicture}
133145 \draw [help lines] (0,0) grid (3,2);
@@ -138,6 +150,7 @@ example
138150 };
139151\end{tikzpicture}
140152]]
153+ })
141154---- ----------------------------------------------------------------
142155
143156
@@ -167,20 +180,26 @@ Note how in the last example |c| is placed at |(1,1)| rather than
167180|b| as would happen by default.
168181]]
169182
170- --[[
171- % TODOsp: codeexamples: the following 4 examples need these libraries
172- % \usetikzlibrary{graphs,graphdrawing}
173- % \usegdlibrary{layered}
174- --]]
175- example
183+ example ({ options =
184+ [[
185+ preamble= \usetikzlibrary{graphs,graphdrawing}
186+ \usegdlibrary{layered}
187+ ]] ,
188+ code =
176189[[
177190\tikz \draw (0,0)
178191 -- (1,0.5) graph [edges=red, layered layout, anchor node=a] { a -> {b,c} }
179192 -- (1.5,0) graph [edges=blue, layered layout,
180193 anchor node=y, anchor at={(2,0)}] { x -> {y,z} };
181194]]
195+ })
182196
183- example
197+ example ({options =
198+ [[
199+ preamble=\usetikzlibrary{graphs,graphdrawing}
200+ \usegdlibrary{layered}
201+ ]] ,
202+ code =
184203[[
185204\begin{tikzpicture}
186205 \draw [help lines] (0,0) grid (3,2);
@@ -189,6 +208,7 @@ example
189208 { a -- {b [x=1,y=1], c [x=1,y=1] } -- d -- a};
190209\end{tikzpicture}
191210]]
211+ })
192212---- ----------------------------------------------------------------
193213
194214
@@ -203,7 +223,12 @@ The coordinate at which the graph should be anchored when no
203223explicit anchor is given for any node. The initial value is the origin.
204224]]
205225
206- example
226+ example ({options =
227+ [[
228+ preamble=\usetikzlibrary{graphs,graphdrawing}
229+ \usegdlibrary{layered}
230+ ]] ,
231+ code =
207232[[
208233\begin{tikzpicture}
209234 \draw [help lines] (0,0) grid (2,2);
@@ -212,6 +237,7 @@ example
212237 { a -- {b, c [anchor here] } -- d -- a};
213238\end{tikzpicture}
214239]]
240+ })
215241---- ----------------------------------------------------------------
216242
217243
@@ -233,7 +259,12 @@ In the example, |c| is placed at the origin since this is the
233259default |anchor at| position.
234260]]
235261
236- example
262+ example ({options =
263+ [[
264+ preamble=\usetikzlibrary{graphs,graphdrawing}
265+ \usegdlibrary{layered}
266+ ]] ,
267+ code =
237268[[
238269\begin{tikzpicture}
239270 \draw [help lines] (0,0) grid (2,2);
@@ -242,4 +273,5 @@ example
242273 { a -- {b, c [anchor here] } -- d -- a};
243274\end{tikzpicture}
244275]]
276+ })
245277---- ----------------------------------------------------------------
0 commit comments