Debian Codegraph @

texmf-dist/doc/latex/tzplot/tzplot-doc-E-v2.2.tex

raw
1 %!TEX root = tzplot-doc.tex
2 %\begin{document}
3
4 %%%%%===== PART: NOT YET!!! ==============
5 %%%%%%%%==================================
6 %%%%%\part{Miscellaneous Macros and Examples}
7 %%%%%%%%==================================
8 %%%%%\label{p:miscandexamples}
9 %%%%%
10 %%==================================
11
12 %%==================================
13 \chapter{Miscellany}
14 \label{c:misc}
15
16 %%------------------------------------------------------------
17 \section{Middle arrows}
18 \label{s:midarrows}
19
20 Four styles for middle arrow tips are predefined: |-->--|, |--o--|, |--x--| and |--/--|.
21
22 \subsection{Controllable middle arrow tips: \texttt{-->--} and \protect\cmd{\settzmidarrow}}
23
24 The middle arrow tip style \ixxw{-->--} prints a middle arrow tip of |stealth| by default.
25 It accepts one argument that changes the position (|0.5| by default) of a \iisw{middle arrow tip}, like |-->--=.75|.
26
27
28 \begin{tzcode}{.3}
29 \begin{tikzpicture}
30 % middle arrow tip: -->--
31 \tzhelplines(4,3)
32 \tzline[-->--](0,3)(4,3)
33 \tzline[-->--=.75,blue,thick](0,2.5)(4,2.5)
34 \tzto[-->--,->,out=45](0,0)(4,1)
35 \end{tikzpicture}
36 \end{tzcode}
37
38
39 \paragraph{How to control middle arrow tips}
40 The default options for middle arrow tips are |-|, |thin|, |solid|, and |shorten >=0|, and |bend right=0|. The defaults can be changed by |\settzmidarrow|.
41
42 The macro \icmd{\settzmidarrow} controls the position, style, and other options of middle arrow tips. The effect is valid until the end of the |tikzpicture| environment, unless changed again.
43
44 \begin{tzdef}
45 % syntax:
46 \settzmidarrow<position>{<arrow tip style>}[<opt>]
47 % all arguments are optional
48 % defaults:
49 <0.5>{stealth}[-,thin,solid,shorten <=0,shorten >=0,bend right=0]
50 \end{tzdef}
51
52
53 \begin{tzcode}{.3}
54 % \settzmidarrow
55 \begin{tikzpicture}
56 \tzhelplines(4,3)
57 \settzmidarrow<.25>{Stealth[reversed]}[red,scale=2] %
58 \tzline[-->--](0,3)(4,3)
59 \tzline[-->--=.75,blue,thick](0,2.5)(4,2.5)
60 \tzto[-->--,->,out=45](0,0)(4,1)
61 \end{tikzpicture}
62 \end{tzcode}
63
64
65 \begin{tzcode}{.3}
66 % various arrow tip styles: arrows.meta
67 \begin{tikzpicture}
68 \tzhelplines(4,3)
69 \settzmidarrow{Circle[open]}[blue,scale=2]
70 \tzline[-->--](0,3)(4,3)
71 \tikzset{>=to} %%
72 \settzmidarrow{>>>}[blue,scale=2]
73 \tzline[-->--](0,2.5)(4,2.5)
74 \settzmidarrow<.25>{Rays}[blue,scale=2]
75 \tzline[-->--=.75,blue,thick](0,2)(4,2)
76 \tzto[-->--,->,red,out=45](0,0)(4,1)
77 \end{tikzpicture}
78 \end{tzcode}
79
80 You can use various styles of arrow tips. (See \Tikz\ manual on |arrows.meta| library, for more details.)
81
82
83
84 \subsection{Fixed middle arrow tip styles: \texttt{--o--}, \texttt{--x--}, \texttt{--/--}}
85
86 Three styles for middle arrow tips are predefined: \xem{circle} |--o--| , \xem{cross} |--x--| , and \xem{diagonal} |--/--| middle arrow tips.
87 These middle arrow tip styles are fixed and cannot be changed.
88 |\settzmidarrow| can only be used with |[<opt>]| to control these middle arrow tips.
89 The other options |<position>| and |{<arrow tip style>}| options are ignored for these styles.
90
91 \paragraph{Circle middle arrow tips:}
92
93 The circle middle arrow tip style \ixxw{--o--} takes one argument to change the position (|0.5| by default).
94
95 The circle is drawn like this:
96
97 \begin{verbatim}
98 \draw [<opt>] (0,0) circle (1.2pt) ;
99 \end{verbatim}
100
101 |\settzmidarrow| controls the circle arrow tip with |<opt>|.
102
103 \begin{tzcode}{.3}
104 \begin{tikzpicture}
105 % circle middle arrow tip: --o--
106 \tzhelplines(4,3)
107 \tzline[--o--](0,3)(4,3)
108 \tzline[--o--=.75,blue,thick](0,2.5)(4,2.5)
109 \tzto[--o--,->,out=45](0,0)(4,1)
110 \end{tikzpicture}
111 \end{tzcode}
112
113 \begin{tzcode}{.3}
114 \begin{tikzpicture}
115 % \settzmidarrow: difference
116 \tzhelplines(4,3)
117 \settzmidarrow<.25>{Circle[open,fill=green]}[scale=2] %
118 \tzline[--o--,thick](0,3)(4,3)
119 \tzline[-->--=.5,blue,thick](0,2.5)(4,2.5)
120 \tzline[-->--,blue,thick](0,2)(4,2)
121 \settzmidarrow[scale=2,thick,fill=green]
122 \tzto[--o--=.25,->,out=45](0,0)(4,1)
123 \end{tikzpicture}
124 \end{tzcode}
125
126
127 \paragraph{Cross middle arrow tips:}
128
129 The cross middle arrow tip style \ixxw{--x--} takes one argument to change the position (|0.5| by default).
130
131 The cross mark is drawn like this:
132
133 \begin{verbatim}
134 \draw [<opt>] (2pt,2pt) to (-2pt,-2pt) ;
135 \draw [<opt>] (-2pt,2pt) to (2pt,-2pt) ;
136 \end{verbatim}
137
138 |\settzmidarrow| controls the cross arrow tip with |<opt>|.
139
140 \begin{tzcode}{.3}
141 \begin{tikzpicture}
142 % cross middle arrow tip: --x--
143 \tzhelplines(4,3)
144 \tzline[--x--](0,3)(4,3)
145 \tzline[--x--=.75,blue,thick](0,2.5)(4,2.5)
146 \tzto[--x--,->,out=45](0,0)(4,1)
147 \end{tikzpicture}
148 \end{tzcode}
149
150 \begin{tzcode}{.3}
151 \begin{tikzpicture}
152 % \settzmidarrow: scale, tzextend
153 \tzhelplines(4,3)
154 \settzmidarrow<.25>{Rays[red]}[scale=2] %
155 \tzline[--x--,thick](0,3)(4,3)
156 \tzline[-->--=.5,blue,thick](0,2.5)(4,2.5)
157 \tzline[-->--,blue,thick](0,2)(4,2)
158 \settzmidarrow[thick,blue,tzextend={8pt}{8pt}]
159 \tzto[--x--=.25,->,out=45](0,0)(4,1)
160 \end{tikzpicture}
161 \end{tzcode}
162
163
164 \paragraph{Diagonal middle arrow tips}
165
166 The diagonal middle arrow tip style \ixxw{--/--} takes one argument to change the position (|0.5| by default).
167
168 The diagonal line is drawn like this:
169
170 \begin{verbatim}
171 \draw [<opt>] (2pt,2pt) to (-2pt,-2pt) ;
172 \end{verbatim}
173
174 |\settzmidarrow| controls the diagonal arrow tip line with |[<opt>]|.
175
176 \begin{tzcode}{.3}
177 \begin{tikzpicture}
178 % diagonal middle arrow tip: --/--
179 \tzhelplines(4,3)
180 \tzline[--/--](0,3)(4,3)
181 \tzline[--/--=.75,blue,thick](0,2.5)(4,2.5)
182 \tzto[--/--,->,out=45](0,0)(4,1)
183 \end{tikzpicture}
184 \end{tzcode}
185
186 \begin{tzcode}{.3}
187 \begin{tikzpicture}
188 % \settzmidarrow: rotate, tzextend
189 \tzhelplines(4,3)
190 \tzline[--/--,thick](0,3)(4,3)
191 \tzline[--/--=.25,blue,thick](0,2.5)(4,2.5)
192 \settzmidarrow[rotate=90,red,tzextend={3pt}{3pt}]
193 \tzline[--/--,blue,thick](0,2)(4,2)
194 \tzto[--/--=.75,->,out=45](0,0)(4,1)
195 \end{tikzpicture}
196 \end{tzcode}
197
198 \begin{tzcode}{.3}
199 \begin{tikzpicture}
200 % \settzmidarrow: bend left
201 \tzhelplines(4,3)
202 \settzmidarrow[scale=2,rotate=45,bend left=60]
203 \tzline[--/--,thick](0,3)(4,3)
204 \tzline[--/--=.25,blue,thick](0,2.5)(4,2.5)
205 \settzmidarrow[rotate=90,red,tzextend={3pt}{3pt}]
206 \tzline[--/--,blue,thick](0,2)(4,2)
207 \tzto[--/--=.75,->,out=45](0,0)(4,1)
208 \end{tikzpicture}
209 \end{tzcode}
210
211
212
213 %%------------------------------------------------------------
214 \section{\protect\cmd{\tzbrace(')}}
215 \label{s:tzbrace}
216
217 \icmd{\tzbrace} takes two coordinates as mandatory arguments to draw a \xem{calligraphic brace} connecting them.
218
219 \begin{tzdef}
220 % syntax: minimum
221 \tzbrace(<coor>)(<coor>)
222 % syntax: medium
223 \tzbrace(<coor>)(<coor>){<text>}[<node opt>]
224 % syntax: full
225 \tzbrace[<draw opt>]{<raise>}[<decoration opt>]<shift coor>
226 (<coor>)(<coor>){<text>}[<node opt>]
227 % defaults
228 []{5pt}[amplitude=5pt]<>(<m>)(<m>){}[]
229 \end{tzdef}
230
231 The |raise| value of a brace is |5pt| by default and the value can be changed by the first curly brace optional argument |{<raise>}|.
232
233 The |amplitude| of a brace is |5pt| by default. You can control the amplitude by writing the option |amplitude=<dim>| in the second bracket option |[<decoration opt>]|.
234
235 \begin{tztikz}
236 \tzbrace[thick](0,0)(3,1) % works like:
237 \draw [thick,decorate,decoration={calligraphic brace, amplitude=5pt, raise=5pt}]
238 (0,0) to (3,1);
239 \end{tztikz}
240
241 The \iisw{swap version} \icmd{\tzbrace'} swaps the coordinates.
242 So it prints a mirror image of |\tzbrace|.
243 For example, |\tzbrace'(0,0)(3,1)| is equivalent to |\tzbrace(3,1)(0,0)|.
244
245 \begin{tzcode}{.3}
246 % \tzbrace(')
247 \begin{tikzpicture}[sloped]
248 \tzhelplines(4,2)
249 \tzline(0,0)(3,1)
250 \tzbrace(0,0)(3,1){AAA}[above=10pt,blue]
251 \tzbrace'[red](0,0)(3,1){BBB}[below=10pt]
252 \end{tikzpicture}
253 \end{tzcode}
254
255 You can change the style of the decorating brace by the second bracket optional argument |[<decoration opt>]|.
256
257 The color of the calligraphic brace can be changed by the option |pen colour| in the list of |[<draw option>]|.
258
259 \begin{tzcode}{.3}
260 % \tzbrace('): decoration options
261 \begin{tikzpicture}[sloped]
262 \tzhelplines(4,3)
263 \tzline(0,0)(3,1)
264 \tzbrace [very thick,pen colour=blue]
265 [amplitude=10pt]
266 (0,0)(3,1){AAA}[a=15pt]
267 \tzbrace'[red,very thick]{10pt}
268 [brace,amplitude=10pt]
269 (0,0)(3,1){BBB}[b=20pt]
270 \end{tikzpicture}
271 \end{tzcode}
272
273 You can also move a brace by specifying the option |<shift coor>| immediately before the the first mandatory coordinate.
274 The empty shift option |<>| is not allowed.
275
276 \begin{tzcode}{.3}
277 % \tzbrace('): shift
278 \begin{tikzpicture}[sloped]
279 \tzhelplines(4,3)
280 \tzline(0,0)(3,1)
281 \tzbrace [very thick,pen colour=blue][amplitude=10pt]
282 <.5,.5>(0,0)(3,1){AAA}[a=15pt]
283 \tzbrace'[red,very thick]{10pt}[brace,amplitude=10pt]
284 (0,0)(3,1){BBB}[b=20pt]
285 \end{tikzpicture}
286 \end{tzcode}
287
288
289
290
291 %%------------------------------------------------------------
292 \section{\protect\cmd{\tzsnake(+)}: Snake lines (Experimental)}
293 \label{s:tzsnake}
294
295 \icmd{\tzsnake} connects two points with a snaked line, with many default values, using \Tikz's |to| operation.
296
297 \begin{tztikz}
298 \tzsnake(0,1)(3,2) % works like
299 \draw [ decorate , decoration={ %% many defaults
300 snake,
301 segment length=5pt, % controlled by \tzsnake
302 amplitude=2.5pt,
303 pre length=5pt,
304 post length=5pt
305 }
306 ] (0,1) to (3,2) ;
307 \end{tztikz}
308
309 \begin{tzcode}{.3}
310 \begin{tikzpicture}
311 \tzhelplines(4,3)
312 \tzsnake(0,1)(3,2)
313 \tzsnake[->,blue,bend right](1,0)(4,3)
314 \end{tikzpicture}
315 \end{tzcode}
316
317 \begin{tzdef}
318 % syntax: minimum
319 \tzsnake(<coor>)(<coor>)
320 % syntax: full
321 \tzsnake[<opt>]{<segment length>}[<decoration opt>]<shift coor>
322 (<coor>){<text>}[<node opt>]
323 (<coor>){<text>}[<node opt>]<code.append>
324 % defaults
325 []{5pt}[many defaults above]<>(<m>){}[](<m>){}[]<>
326 \end{tzdef}
327
328 The key |segment length| is controlled by the first curly brace option and you should write down all the other keys in the second bracket option |[<decoration opt>]| to change the values. Not specifying the option |{<segment length>}|, when the first bracket option is empty, you need empty brackets |[]|, like |\tzsnake[][<decoration opt>]...|.
329
330 \begin{tzcode}{.3}
331 % \tzsnake: {segment length} option
332 \begin{tikzpicture}
333 \tzhelplines(4,3)
334 \tzsnake[blue]{3pt}[coil](0,1){spring}[a,sloped](3,2)
335 \tzsnake[->,bend right]{3pt}
336 [coil,amplitude=5pt,post length=20pt]
337 (1,0){coil line}[b,sloped](4,3){Up!}[draw,r]
338 \end{tikzpicture}
339 \end{tzcode}
340
341 The plus version \icmd{\tzsnake+} uses the second mandatory coordinate as a relative coordinate to the first. Everything else is the same as in |\tzsnake|.
342
343
344 \begin{tzcode}{.3}
345 % \tzsnake(+): shift
346 \begin{tikzpicture}
347 \tzhelplines(4,3)
348 \tzsnake[->][post length=20pt](0,0)(3,0)
349 \tzsnake[->,red][post length=20pt]<1,1>(0,0)(3,0) %%
350 \tzsnake+[->,bend left,blue]{10pt}[post length=10pt]
351 (0,1){snake line}[a,sloped](4,2){what?}[r]
352 \end{tikzpicture}
353 \end{tzcode}
354
355
356 %%%%%%%% (under construction)
357 %%%%%
358 %%%%%
359 %%%%%%%------------------------------------------------------------
360 %%%%%\section{\protect\cmd{\tzspy} (Experimental)}
361 %%%%%\label{s:tzspy}
362 %%%%%
363 %%%%%
364 %%%%%\begin{tzdef}
365 %%%%%% syntax: minimum
366 %%%%%\tzspy(<coor>)(<coor>)
367 %%%%%% syntax: full
368 %%%%%\tzbrace[<opt>]{<size>}[<maginificaltion>]
369 %%%%% (<on-coor>)(<in-coor>)[<node opt>]<code.append>
370 %%%%%% defaults
371 %%%%% [circle]{2cm}{5}(<m>)(<m>)[]<>
372 %%%%%\end{tzdef}
373 %%%%%
374 %%%%%To use |\tzspy| you need to tell \Tikz\ that a picture will be magnified, by specifying some special keys in the |tikzpicture| environment option, such as |spy using outlines|, |spy using overlays|, etc., as follows:
375 %%%%%\begin{verbatim}
376 %%%%% \begin{tikzpicture}[spy using outlines]
377 %%%%% <tzplot code>
378 %%%%% <tikz code>
379 %%%%% \tzspy...
380 %%%%% \end{tikzpicture}
381 %%%%%\end{verbatim}
382 %%%%%
383 %%%%%\begin{tzcode}[text above listing]
384 %%%%%\begin{tikzpicture}[scale=.1,font=\scriptsize,spy using outlines]
385 %%%%%\settzdotsize{1.2pt}
386 %%%%%\tzaxes(-15,0)(60,60){$Q$}{$P$}
387 %%%%%
388 %%%%%\def\Dem{50-\x}
389 %%%%%\def\Sup{.5*\x+5}
390 %%%%%\def\Supa{.5*\x+6.5}
391 %%%%%
392 %%%%%\tzfn{\Dem}[0:50]{$D$}
393 %%%%%\tzfn{\Sup}[-10:50]{$S$}[r]
394 %%%%%\tzfn{\Supa}[-10:50]{$S'$}
395 %%%%%
396 %%%%%\tzXpoint*{Dem}{Sup}(eqm)
397 %%%%%\tzXpoint*{Dem}{Supa}(eqma)
398 %%%%%\tzvXpointat*{Sup}{29}(eqmb)
399 %%%%%
400 %%%%%\tzproj[densely dotted](eqm){\rlap{300}}{200}
401 %%%%%\tzproj[densely dotted](eqma){\llap{290}}{\raisebox{1em}{210}}
402 %%%%%\tzprojy[densely dotted](eqmb){\raisebox{-2em}{195}}
403 %%%%%
404 %%%%%\tzticks{-10/-100,50/500}{5/50,50/500}
405 %%%%%
406 %%%%%\tzpath*[blue](eqm)(eqma)(eqmb);
407 %%%%%
408 %%%%%\tzspy($(eqma)!.5!(eqmb)$)(100,30)
409 %%%%%
410 %%%%%%\spy [blue,draw,circle,size=5cm, magnification = 5,connect spies]
411 %%%%%%on ($(eqma)!.5!(eqmb)$) in node at (100,30);
412 %%%%%\end{tikzpicture}
413 %%%%%\end{tzcode}
414 %%%%%
415 %%%%%
416 %%%%%\begin{tzcode}[text above listing]
417 %%%%%\begin{tikzpicture}[scale=.1,font=\scriptsize,spy using overlays]
418 %%%%%\settzdotsize{1.2pt}
419 %%%%%\tzaxes(-15,0)(60,60){$Q$}{$P$}
420 %%%%%
421 %%%%%\def\Dem{50-\x}
422 %%%%%\def\Sup{.5*\x+5}
423 %%%%%\def\Supa{.5*\x+6.5}
424 %%%%%
425 %%%%%\tzfn{\Dem}[0:50]{$D$}
426 %%%%%\tzfn{\Sup}[-10:50]{$S$}[r]
427 %%%%%\tzfn{\Supa}[-10:50]{$S'$}
428 %%%%%
429 %%%%%\tzXpoint*{Dem}{Sup}(eqm)
430 %%%%%\tzXpoint*{Dem}{Supa}(eqma)
431 %%%%%\tzvXpointat*{Sup}{29}(eqmb)
432 %%%%%
433 %%%%%\tzproj[densely dotted](eqm){\rlap{300}}{200}
434 %%%%%\tzproj[densely dotted](eqma){\llap{290}}{\raisebox{1em}{210}}
435 %%%%%\tzprojy[densely dotted](eqmb){\raisebox{-2em}{195}}
436 %%%%%
437 %%%%%\tzticks{-10/-100,50/500}{5/50,50/500}
438 %%%%%
439 %%%%%\tzpath*[blue](eqm)(eqma)(eqmb);
440 %%%%%
441 %%%%%\tzspy[connect spies]{5cm}[6]($(eqma)!.5!(eqmb)$)(100,30)[draw,fill=red,thick]
442 %%%%%\end{tikzpicture}
443 %%%%%\end{tzcode}
444 %%%%%
445
446
447
448 %%%%%%%% (under construction)
449 %%%%%\section{\protect\cmd{\tzplotfile}: plotting data}
450 %%%%%\label{s:tzplotfile}
451 %%%%%
452 %%%%%\icmd{\tzplotfile} plots data.
453 %%%%%
454 %%%%%\begin{tcblisting}{listing only}
455 %%%%%% syntax
456 %%%%%\tzplotfile[<opt>]{<file name>}[<plot opt>]
457 %%%%%\end{tcblisting}
458 %%%%%
459 %%%%%
460 %%%%%\begin{tcblisting}{listing above text}
461 %%%%%\begin{tikzpicture}
462 %%%%%\tzplotfile{sine.data}
463 %%%%%\end{tikzpicture}
464 %%%%%\end{tcblisting}
465 %%%%%
466 %%%%%\begin{tcblisting}{listing above text}
467 %%%%%\begin{tikzpicture}
468 %%%%%\tzplotfile[blue]{sine.data}[mark=x]
469 %%%%%\end{tikzpicture}
470 %%%%%\end{tcblisting}
471
472
473
474
475