Debian Codegraph @

texmf-dist/tex/latex/tzplot/tzplot.sty

raw
1 %% file: tzplot.sty
2 %%
3 %% tzplot
4 %%
5 %% (C) Copyright 2017-2025 In-Sung Cho <ischo at ktug.org>
6 %%
7 %% This work may be distributed and/or modified
8 %% under the conditions of the LaTeX Project Public License,
9 %% either version 1.3c of this license or (at your option) any later version.
10 %% The latest version of this license is in
11 %% http://www.latex-project.org/lppl.txt.
12 %%
13 %% -------------------------------------------------
14 \ProvidesPackage{tzplot-v2.12}[2025/12/25 v2.12 Plot Graphs with TikZ Abbreviations]
15
16 % expl3,xparse: LPPL
17 % tikz: LPPL and/or GNU GPL
18 \RequirePackage{expl3,xparse}
19 \RequirePackage{tikz}
20
21 \usetikzlibrary{
22 arrows, % (deprecated in tikz)
23 backgrounds,
24 calc,
25 decorations.pathreplacing, % for tzshowcontrols, tzbrace
26 calligraphy, % for calligraphic brace (load after decorations.pathreplacing)
27 intersections,
28 patterns,
29 plotmarks, % for \tzplot[mark]
30 positioning,
31 shapes,
32 }
33
34 %%(ADDED)
35 \usetikzlibrary{
36 % for later use
37 %angles, % for \tzpicangle %% (Removed!!!)
38 arrows.meta, % (added)
39 bending, % (added with arrows.meta)
40 decorations.markings, % need for "decoration"
41 decorations.pathmorphing, % for \tzsnake
42 spy, % for \tzspy (later)
43 fpu, % for computation for \tzpicangle
44 %fit,
45 %quotes,
46 %through,
47 %shadings,
48 %shadows,
49 %scopes,
50 %graphs,
51 }
52
53
54 %% backgrounds
55 \pgfdeclarelayer{background}
56 \pgfdeclarelayer{behind}
57 \pgfdeclarelayer{above}
58 \pgfdeclarelayer{foreground}
59
60 \pgfsetlayers{background,behind,main,above,foreground}
61 %% USAGE: \begin{pgfonlayer}{foreground} ... \end{pgfonlayer}
62
63
64 %%%%% defaults
65
66 %%%%% basic defaults
67
68 %% circle dot (using radius)
69 \def\tz@default@Cdot@radius{1.2pt} % fixed
70 \def\tz@initial@Cdot@radius{\tz@default@Cdot@radius} % changeable
71 \NewDocumentCommand\settzcdotradius{m}{\renewcommand\tz@initial@Cdot@radius{#1}}
72 \newcommand\tzCdotradius{\tz@initial@Cdot@radius}
73
74 %% node dot (using minimum size: diameter)
75 \def\tz@default@dot@size{2.4pt} % fixed
76 \def\tz@initial@dot@size{\tz@default@dot@size} % changeable
77 \NewDocumentCommand\settzdotsize{m}{\renewcommand\tz@initial@dot@size{#1}}
78 \newcommand\tzdotsize{\tz@initial@dot@size}
79
80 %% mark (using mark size: radius) % tikz initial = 2pt
81 \def\tz@default@mark@size{2pt} % fixed
82 \def\tz@initial@mark@size{\tz@default@mark@size} % changeable
83 \NewDocumentCommand\settzmarksize{m}{\renewcommand\tz@initial@mark@size{#1}}
84 \newcommand\tzmarksize{\tz@initial@mark@size}
85
86 %% opacity
87 \def\tz@default@fill@opacity{0.3} % fixed
88 \def\tz@initial@fill@opacity{\tz@default@fill@opacity} % changeable
89 \NewDocumentCommand\settzfillopacity{m}{\renewcommand\tz@initial@fill@opacity{#1}}
90 \newcommand\tzfillopacity{\tz@initial@fill@opacity}
91
92 %% fillcolor
93 \def\tz@default@fill@color{black!50} % fixed
94 \def\tz@initial@fill@color{\tz@default@fill@color} % changeable
95 \NewDocumentCommand\settzfillcolor{mg}
96 {%
97 \renewcommand\tz@initial@fill@color{#1}
98 \IfValueT {#2} {\renewcommand\tz@initial@fill@opacity{#2}}
99 }
100 \newcommand\tzfillcolor{\tz@initial@fill@color}
101
102 %% link style
103 \def\tz@default@link@style{to} % fixed
104 \def\tz@initial@link@style{\tz@default@link@style} % changeable
105 \NewDocumentCommand\settzlinkstyle{m}{\renewcommand\tz@initial@link@style{#1}}
106 \newcommand\tzlinkstyle{\tz@initial@link@style}
107
108 \let\tzpathstyle\tzlinkstyle
109 \let\settzpathstyle\settzlinkstyle
110
111 %%% path style
112 %\def\tz@default@path@style{to} % fixed
113 %\def\tz@initial@path@style{\tz@default@path@style} % changeable
114 %\NewDocumentCommand\settzpathstyle{m}{\renewcommand\tz@initial@path@style{#1}}
115 %\newcommand\tzpathstyle{\tz@initial@path@style}
116
117 %% tangent epsilon
118
119 \def\tz@default@tangent@epsilonL{.01}
120 \def\tz@default@tangent@epsilonR{.01}
121 \def\tz@initial@tangent@epsilonL{\tz@default@tangent@epsilonL}
122 \def\tz@initial@tangent@epsilonR{\tz@default@tangent@epsilonL}
123 \NewDocumentCommand\settztangentepsilon{mg}
124 {%
125 \renewcommand\tz@initial@tangent@epsilonL{#1}
126 \IfNoValueTF {#2}
127 {\renewcommand\tz@initial@tangent@epsilonR{#1}}
128 {\renewcommand\tz@initial@tangent@epsilonR{#2}}
129 }
130 \newcommand\tztangentepsilonL{\tz@initial@tangent@epsilonL}
131 \newcommand\tztangentepsilonR{\tz@initial@tangent@epsilonR}
132
133 \let\tztangentatepsilonL\tztangentepsilonL
134 \let\tztangentatepsilonR\tztangentepsilonR
135
136 %%(ADDED)
137 %% slope epsilon
138
139 \def\tz@default@slope@epsilonL{.01}
140 \def\tz@default@slope@epsilonR{.01}
141 \def\tz@initial@slope@epsilonL{\tz@default@slope@epsilonL}
142 \def\tz@initial@slope@epsilonR{\tz@default@slope@epsilonL}
143 \NewDocumentCommand\settzslopeepsilon{mg}
144 {%
145 \renewcommand\tz@initial@slope@epsilonL{#1}
146 \IfNoValueTF {#2}
147 {\renewcommand\tz@initial@slope@epsilonR{#1}}
148 {\renewcommand\tz@initial@slope@epsilonR{#2}}
149 }
150 \newcommand\tzslopeepsilonL{\tz@initial@slope@epsilonL}
151 \newcommand\tzslopeepsilonR{\tz@initial@slope@epsilonR}
152
153 \let\tzslopeatepsilonL\tzslopeepsilonL
154 \let\tzslopeatepsilonR\tzslopeepsilonR
155
156
157 %% normal epsilon
158
159 \def\tz@default@normal@epsilonL{.01}
160 \def\tz@default@normal@epsilonR{.01}
161 \def\tz@initial@normal@epsilonL{\tz@default@normal@epsilonL}
162 \def\tz@initial@normal@epsilonR{\tz@default@normal@epsilonL}
163 \NewDocumentCommand\settznormalepsilon{mg}
164 {%
165 \renewcommand\tz@initial@normal@epsilonL{#1}
166 \IfNoValueTF {#2}
167 {\renewcommand\tz@initial@normal@epsilonR{#1}}
168 {\renewcommand\tz@initial@normal@epsilonR{#2}}
169 }
170 \newcommand\tznormalepsilonL{\tz@initial@normal@epsilonL}
171 \newcommand\tznormalepsilonR{\tz@initial@normal@epsilonR}
172
173 \let\tznormalatepsilonL\tznormalepsilonL
174 \let\tznormalatepsilonR\tznormalepsilonR
175
176
177 %%%%% layers: defaults
178
179 %% tzpath layer %% default: main
180 \def\tz@default@tzpath@layer{main} % fixed
181 \def\tz@initial@tzpath@layer{\tz@default@tzpath@layer} % changeable
182 \NewDocumentCommand\settzpathlayer{m}
183 {\renewcommand\tz@initial@tzpath@layer{#1}}
184 \newcommand\tzpathlayer{\tz@initial@tzpath@layer}
185 %% (there is No \tz-link-layer thing)
186
187 %% tzfnArea layer %% default: main
188 \def\tz@default@tzfnArea@layer{behind} % fixed
189 \def\tz@initial@tzfnArea@layer{\tz@default@tzfnArea@layer} % changeable
190 \NewDocumentCommand\settzfnArealayer{m}
191 {\renewcommand\tz@initial@tzfnArea@layer{#1}}
192 \newcommand\tzfnArealayer{\tz@initial@tzfnArea@layer}
193
194 %% tzfnarea layer %% default: main
195 \def\tz@default@tzfnarea@layer{behind} % fixed
196 \def\tz@initial@tzfnarea@layer{\tz@default@tzfnarea@layer} % changeable
197 \NewDocumentCommand\settzfnarealayer{m}
198 {\renewcommand\tz@initial@tzfnarea@layer{#1}}
199 \newcommand\tzfnarealayer{\tz@initial@tzfnarea@layer}
200
201 %% tangent layer
202 \def\tz@default@tangent@layer{behind} % fixed
203 \def\tz@initial@tangent@layer{\tz@default@tangent@layer} % changeable
204 \NewDocumentCommand\settztangentlayer{m}
205 {\renewcommand\tz@initial@tangent@layer{#1}}
206 \newcommand\tztangentlayer{\tz@initial@tangent@layer}
207
208 \let\tztangentatlayer\tztangentlayer
209 \let\settztangentatlayer\settztangentlayer
210
211 %% secant layer
212 \def\tz@default@secant@layer{behind} % fixed
213 \def\tz@initial@secant@layer{\tz@default@secant@layer} % changeable
214 \NewDocumentCommand\settzsecantlayer{m}
215 {\renewcommand\tz@initial@secant@layer{#1}}
216 \newcommand\tzsecantlayer{\tz@initial@secant@layer}
217
218 \let\tzsecantatlayer\tzsecantlayer
219 \let\settzsecantatlayer\settzsecantlayer
220
221 %%(ADDED)
222 %% slope layer
223 \def\tz@default@slope@layer{behind} % fixed
224 \def\tz@initial@slope@layer{\tz@default@slope@layer} % changeable
225 \NewDocumentCommand\settzslopelayer{m}
226 {\renewcommand\tz@initial@slope@layer{#1}}
227 \newcommand\tzslopelayer{\tz@initial@slope@layer}
228
229 \let\tzslopeatlayer\tzslopelayer
230 \let\settzslopeatlayer\settzslopelayer
231
232 %% normal layer
233 \def\tz@default@normal@layer{behind} % fixed
234 \def\tz@initial@normal@layer{\tz@default@normal@layer} % changeable
235 \NewDocumentCommand\settznormallayer{m}
236 {\renewcommand\tz@initial@normal@layer{#1}}
237 \newcommand\tznormallayer{\tz@initial@normal@layer}
238
239 \let\tznormalatlayer\tznormallayer
240 \let\settznormalatlayer\settznormallayer
241
242 %% angle layer
243 \def\tz@default@angle@layer{behind} % fixed
244 \def\tz@initial@angle@layer{\tz@default@angle@layer} % changeable
245 \NewDocumentCommand\settzanglelayer{m}
246 {\renewcommand\tz@initial@angle@layer{#1}}
247 \newcommand\tzanglelayer{\tz@initial@angle@layer}
248
249 \let\tzanglemarklayer\tzanglelayer
250 \let\settzanglemarklayer\settzanglelayer
251
252
253 %%%%% line style, radius, size: defaults
254
255 %% function area (fnA) line width
256 \def\tz@default@fnA@linestyle{very thin} % fixed
257 \def\tz@initial@fnA@linestyle{\tz@default@fnA@linestyle} % changeable
258 \NewDocumentCommand\settzfnarealinestyle{m}
259 {\renewcommand\tz@initial@fnA@linestyle{#1}}
260 \newcommand\tzfnALstyle{\tz@initial@fnA@linestyle}
261
262 %% angle arc (AA) line style
263 \def\tz@default@AA@linestyle{very thin} % fixed
264 \def\tz@initial@AA@linestyle{\tz@default@AA@linestyle} % changeable
265 \NewDocumentCommand\settzAAlinestyle{m}
266 {\renewcommand\tz@initial@AA@linestyle{#1}}
267 \newcommand\tzAAlinestyle{\tz@initial@AA@linestyle}
268
269 \let\tzRAlinestyle\tzAAlinestyle
270 \let\settzRAlinestyle\settzAAlinestyle
271
272 %% angle arc (AA) radius
273 \def\tz@default@AA@radius{10pt} % fixed
274 \def\tz@initial@AA@radius{\tz@default@AA@radius} % changeable
275 \NewDocumentCommand\settzAAradius{m}
276 {\renewcommand\tz@initial@AA@radius{#1}}
277 \newcommand\tzAAradius{\tz@initial@AA@radius}
278
279 %% right angle (RA) marc size
280 \def\tz@default@RA@size{5pt} % fixed
281 \xdef\tz@initial@RA@size{\tz@default@RA@size} % changeable
282 \NewDocumentCommand\settzRAsize{m}
283 {\renewcommand\tz@initial@RA@size{#1}}
284 \newcommand\tzRAsize{\tz@initial@RA@size}
285
286
287 %%%%% TikZ alias styles
288
289 \tikzset{
290 a/.style={above=#1},
291 b/.style={below=#1},
292 c/.style={centered=#1},
293 l/.style={left=#1},
294 r/.style={right=#1},
295 al/.style={above left=#1},
296 ar/.style={above right=#1},
297 bl/.style={below left=#1},
298 br/.style={below right=#1},
299 }
300
301 %%%%% tzplot styles
302
303 \tikzset{>=stealth} % to revert use {>=to}
304
305 %% tzdot (for node dot style)
306 \tikzset{
307 tzdot/.style=
308 {draw,solid,thin,circle,inner sep=0pt,minimum size=#1},
309 tzdot/.default=\tzdotsize
310 }
311
312 %% tzdot options (for node dot style)
313 \tikzset{
314 tzdot options/.style={tzdot=\tzdotsize,#1}
315 }
316
317 %%%%%%% tzshowdot
318 %%%%%\tikzset{
319 %%%%% tzshowdot/.style=
320 %%%%% {draw,fill,solid,thin,circle,inner sep=0pt,minimum size=\tzdotsize,#1},
321 %%%%%% tzshowdot/.default=circle
322 %%%%%}
323
324 %% tzmark
325 \tikzset{
326 tzmark/.style=
327 {mark options={solid,thin},mark size=#1},
328 tzmark/.default=\tzmarksize
329 }
330
331 %% tznode (NOT USED!) -- user choice
332 \tikzset{
333 tznode/.style=
334 {solid,thin,circle,inner sep=0pt,minimum size=#1},
335 tznode/.default=0pt
336 }
337
338 %% tzdotted
339 \tikzset{%
340 tzdotted/.style={%
341 dotted=none,
342 line cap=round,
343 dash pattern=on 0pt off 1cm/(#1)
344 },
345 tzdotted/.default=10
346 }
347
348 %% tzdashed
349 \tikzset{
350 tzdashed/.style={%
351 dashed=none,
352 dash pattern=on 5mm/(#1) off 5mm/(#1)
353 },
354 tzdashed/.default=10
355 }
356
357 %% tzhelplines
358 \tikzset{%
359 tzhelplines/.style={help lines,-,tzdotted}
360 }
361
362 %% tzshorten
363 \tikzset{%
364 tzshorten/.style 2 args ={shorten <=#1, shorten >=#2},
365 tzshoretn/.default={2pt}{2pt}
366 }
367
368 %% tzextend (negative tzshorten)
369 \tikzset{%
370 tzextend/.style 2 args ={shorten <=-#1, shorten >=-#2},
371 tzextend/.default={2pt}{2pt}
372 }
373
374
375 %% tzshowcontrols % (for \tzbezier: tikz manual p.645)
376 \tikzset{%
377 tzshowcontrols/.style={%
378 postaction={%
379 decoration={%
380 show path construction,
381 curveto code={%
382 \draw [dotted,#1]
383 (\tikzinputsegmentfirst)
384 -- (\tikzinputsegmentsupporta)
385 -- (\tikzinputsegmentsupportb)
386 -- (\tikzinputsegmentlast);
387 }
388 },
389 decorate
390 }
391 }
392 }
393
394
395 %=====================================================
396 %%=====================================================
397 %%=====================================================
398 \ExplSyntaxOn
399 %%=====================================================
400 %%=====================================================
401
402 %%% error messages:
403
404 %% semicolon versions
405 \msg_new:nnn { tzplot } { semicolon-error }
406 { You~may~have~forgotten~a~semicolon~here~or~above! }
407
408 %% infinite slope error: LFn related macros
409 \msg_new:nnn { tzplot } { infinite~slope~error }
410 { Perhaps~you~are~trying~an~'infinite~slope'~here~or~above! }
411
412
413 %%%% string replacement
414 %%%%%% to use string replacement for label positions
415 \cs_new:Npn \extract_posopt:w [ #1 ] #2 \q_stop % ndh
416 {
417 \tl_set:Nn \l_label_pos_str_tl { [ \exp_not:n { #1 } ] } % \exp_not needed!!!
418
419 \tl_set:Nx \l_label_pos_str_trimmed_tl { \tl_trim_spaces:n { #2 } }
420
421 \str_case_e:nnF { \l_label_pos_str_trimmed_tl }
422 {
423 {l} { \tl_put_right:Nn \l_label_pos_str_tl {left} }
424 {r} { \tl_put_right:Nn \l_label_pos_str_tl {right} }
425 {a} { \tl_put_right:Nn \l_label_pos_str_tl {above} }
426 {b} { \tl_put_right:Nn \l_label_pos_str_tl {below} }
427 {c} { \tl_put_right:Nn \l_label_pos_str_tl {center} }
428 {al} { \tl_put_right:Nn \l_label_pos_str_tl {above~left} }
429 {ar} { \tl_put_right:Nn \l_label_pos_str_tl {above~right} }
430 {bl} { \tl_put_right:Nn \l_label_pos_str_tl {below~left} }
431 {br} { \tl_put_right:Nn \l_label_pos_str_tl {below~right} }
432 }
433 {
434 \tl_put_right:Nn \l_label_pos_str_tl { #2 }
435 }
436 }
437
438
439 %%%%% help lines
440 \NewDocumentCommand\tzhelplines{ s O{} r() d() }
441 {
442 \IfBooleanTF { #1 }
443 {
444 \IfNoValueTF { #4 }
445 { \draw [ tzhelplines , use~as~bounding~box , #2 ] (0,0) grid (#3); }
446 { \draw [ tzhelplines , use~as~bounding~box , #2 ] (#3) grid (#4); }
447 }
448 {
449 \IfNoValueTF { #4 }
450 { \draw [ tzhelplines , #2 ] (0,0) grid (#3); }
451 { \draw [ tzhelplines , #2 ] (#3) grid (#4); }
452 }
453 }
454
455
456 %%%%% \tzbbox
457 \NewDocumentCommand\tzbbox{ r() d() }
458 {
459 \IfNoValueTF { #2 }
460 {
461 \useasboundingbox (0,0) rectangle (#1);
462 }
463 {
464 \useasboundingbox (#1) rectangle (#2);
465 }
466 }
467
468 %%%%% \tzgetxyval
469 \NewDocumentCommand\tzgetxyval{ r() m m }
470 {
471 \tikz@scan@one@point\pgfutil@firstofone(#1)\relax%
472 \pgfmathparse{\the\pgf@x/28.45274}% convert pt to cm
473 \edef#2{\pgfmathresult}%
474 \pgfmathparse{\the\pgf@y/28.45274}% convert pt to cm
475 \edef#3{\pgfmathresult}%
476 }
477
478 %%%%% (ADDED 2022/04/23)
479 %%%%% \tzpointlength
480 \NewDocumentCommand\tzdistance{ r() r() m g g }
481 {
482 \tikz@scan@one@point\pgfutil@firstofone($(#2)-(#1)$)\relax%
483 \pgfmathparse{veclen(\the\pgf@x,\the\pgf@y)/28.45274}% convert pt to cm
484 \edef#3{\pgfmathresult}%
485 \IfValueT { #4 } { \pgfmathparse{\the\pgf@x/28.45274}\edef#4{\pgfmathresult} }
486 \IfValueT { #5 } { \pgfmathparse{\the\pgf@y/28.45274}\edef#5{\pgfmathresult} }
487 }
488
489 %%% NOT working correctly
490 % { \pgfmathparse{round(veclen(\the\pgf@x,\the\pgf@y)/28.45274}*1000)/1000 }% rounded
491
492
493 %%% --- end of \tzgetxyval
494
495 %%%%%% \tzgetxyval (experimental)
496 %%%%%% seems not working
497 %\NewDocumentCommand\tzgetxyval{ g r() m m }
498 %{
499 % \IfNoValueTF { #1 }
500 % {
501 % \def\tzptToDim{28.45274} % cm: default
502 % }
503 % {
504 % \str_case:nnTF { #1 }
505 % {
506 % {pt} { \def\tzptToDim{1} }
507 % {mm} { \def\tzptToDim{2.845274} }
508 % {cm} { \def\tzptToDim{28.45274} }
509 % {bp} { \def\tzptToDim{1.00374} }
510 % {dd} { \def\tzptToDim{1.07} }
511 % {pc} { \def\tzptToDim{12} }
512 % {in} { \def\tzptToDim{72.26999} }
513 % }
514 % {
515 % \def\tzptToDim{1} % default unit in tikz
516 % }
517 % }
518 % \tikz@scan@one@point\pgfutil@firstofone(#2)\relax%
519 % \pgfmathparse{\the\pgf@x/\tzptToDim}% convert pt to dim
520 % \edef#3{\pgfmathresult}%
521 % \pgfmathparse{\the\pgf@y/\tzptToDim}% convert pt to dim
522 % \edef#4{\pgfmathresult}%
523 %}
524 %
525 %%%% --- end of \tzgetxyval
526
527
528
529
530
531 %%%%% Dots
532
533 %%% Node Dots %%% (basic: using minimum size)
534
535 %%% \tzdot
536 %%% *[opt]<shift>(coor){text}[pos,opt](size)
537
538 \bool_new:N \l_tzdot_shift_coor_bool
539
540 %%% \tzdot (main)
541 \NewDocumentCommand\tzdot
542 { s O{} d<> r() +G{} >{\TrimSpaces}o D(){\tz@initial@dot@size} }
543 {
544 \tl_clear:N \l_tzdot_cmd_tl
545
546 \tl_if_empty:nF { #7 }
547 { \renewcommand\tzdotsize{ #7 } }
548
549 %%%%%% to use string replacement for label positions
550 \IfValueTF { #6 }
551 {
552 \tl_if_in:nnTF { #6 } { [ }
553 { \extract_posopt:w #6 \q_stop } % ndh
554 {
555 \tl_set:Nx \l_label_pos_str_trimmed_tl { \tl_trim_spaces:n { #6 } }
556 \str_case_e:nnF { \l_label_pos_str_trimmed_tl }
557 {
558 {l} { \tl_set:Nn \l_label_pos_str_tl {left} }
559 {r} { \tl_set:Nn \l_label_pos_str_tl {right} }
560 {a} { \tl_set:Nn \l_label_pos_str_tl {above} }
561 {b} { \tl_set:Nn \l_label_pos_str_tl {below} }
562 {c} { \tl_set:Nn \l_label_pos_str_tl {center} }
563 {al} { \tl_set:Nn \l_label_pos_str_tl {above~left} }
564 {ar} { \tl_set:Nn \l_label_pos_str_tl {above~right} }
565 {bl} { \tl_set:Nn \l_label_pos_str_tl {below~left} }
566 {br} { \tl_set:Nn \l_label_pos_str_tl {below~right} }
567 }
568 {
569 \tl_set:Nn \l_label_pos_str_tl { #6 }
570 }
571 }
572 }
573 {
574 \tl_clear:N \l_label_pos_str_tl
575 }
576 %%%%%%%%%%
577
578 \IfValueTF { #3 }
579 {
580 \tl_set:Nn \l_tzdot_shift_coor_tl { #3 }
581 \bool_set_true:N \l_tzdot_shift_coor_bool
582 }
583 {
584 \tl_clear:N \l_tzdot_shift_coor_tl
585 \bool_set_false:N \l_tzdot_shift_coor_bool
586 }
587
588 \bool_if:NTF \l_tzdot_shift_coor_bool
589 {
590 \tl_put_right:Nx \l_tzdot_cmd_tl
591 {
592 ( [ shift = { (\l_tzdot_shift_coor_tl) } ] #4 )
593 }
594 }
595 { \tl_put_right:Nn \l_tzdot_cmd_tl { (#4) } }
596
597 \tl_put_right:Nn \l_tzdot_cmd_tl { node } %%
598
599 \IfBooleanTF { #1 }
600 {
601 \tl_put_right:Nn \l_tzdot_cmd_tl
602 { [ tzdot , fill , }
603 }
604 {
605 \tl_put_right:Nn \l_tzdot_cmd_tl
606 { [ tzdot , }
607 }
608 \tl_put_right:Nx \l_tzdot_cmd_tl
609 {
610 label = { \l_label_pos_str_tl \c_colon_str \exp_not:n { #5 } } , % pos_str
611 }
612 \tl_put_right:Nn \l_tzdot_cmd_tl
613 {
614 minimum~size = \tzdotsize , #2 ] {}
615 }
616 \exp_last_unbraced:Nf \path \l_tzdot_cmd_tl ;
617 }
618
619 %%% --- end of \tzdot
620
621
622
623 %%% multiple dots
624 %%% coding CAUTION! : _tzdot_ changed to _tzdots_
625
626 %%% \tzdots
627 %%% repeat pattern: (coor){label}[pos]
628
629 \tl_new:N \l_tzdots_opt_tl
630 \tl_new:N \l_tzdots_cmd_tl
631 \bool_new:N \l_tzdots_shift_coor_bool
632
633 %%% \tzdots (main)
634 \NewDocumentCommand\tzdots{ s O{} d<> }
635 {
636 \tl_clear:N \l_tzdots_cmd_tl
637
638 \IfBooleanTF { #1 }
639 { \tl_set:Nn \l_tzdots_STYLE_fill_tl { fill } }
640 { \tl_set:Nn \l_tzdots_STYLE_fill_tl { fill = none } }
641
642 \tl_if_empty:nTF { #2 }
643 { \tl_set:Nn \l_tzdots_opt_tl { tzdot } }
644 { \tl_set:Nn \l_tzdots_opt_tl { tzdot , #2 } }
645
646 \IfValueTF { #3 }
647 {
648 \tl_set:Nn \l_tzdots_shift_coor_tl { #3 }
649 \bool_set_true:N \l_tzdots_shift_coor_bool
650 }
651 {
652 \tl_clear:N \l_tzdots_shift_coor_tl
653 \bool_set_false:N \l_tzdots_shift_coor_bool
654 }
655
656 \tzdots_check_token:n
657 }
658
659 \cs_new:Npn \tzdots_check_token:n #1
660 {
661 % \token_if_eq_charcode:NNTF #1 (
662 % { \tzdots_sub_fn #1 }
663 % { \tzdots_stop_action }
664 \str_case:nnF { #1 }
665 {
666 { ( } { \tzdots_sub_fn #1 }
667 { ; } { \tzdots_late_opt_fn }
668 }
669 {
670 % \tzdots_stop_action
671 \msg_error:nn { tzplot } { semicolon-error }
672 }
673 }
674
675
676 \NewDocumentCommand\tzdots_sub_fn { r() +G{} >{\TrimSpaces}o }
677 {
678 %%%%%% to use string replacement for label positions
679 \IfValueTF { #3 }
680 {
681 \tl_if_in:nnTF { #3 } { [ }
682 { \extract_posopt:w #3 \q_stop } % ndh
683 {
684 \tl_set:Nx \l_label_pos_str_trimmed_tl { \tl_trim_spaces:n { #3 } }
685 \str_case_e:nnF { \l_label_pos_str_trimmed_tl }
686 {
687 {l} { \tl_set:Nn \l_label_pos_str_tl {left} }
688 {r} { \tl_set:Nn \l_label_pos_str_tl {right} }
689 {a} { \tl_set:Nn \l_label_pos_str_tl {above} }
690 {b} { \tl_set:Nn \l_label_pos_str_tl {below} }
691 {c} { \tl_set:Nn \l_label_pos_str_tl {center} }
692 {al} { \tl_set:Nn \l_label_pos_str_tl {above~left} }
693 {ar} { \tl_set:Nn \l_label_pos_str_tl {above~right} }
694 {bl} { \tl_set:Nn \l_label_pos_str_tl {below~left} }
695 {br} { \tl_set:Nn \l_label_pos_str_tl {below~right} }
696 }
697 {
698 \tl_set:Nn \l_label_pos_str_tl { #3 }
699 }
700 }
701 }
702 {
703 \tl_clear:N \l_label_pos_str_tl
704 }
705 %%%%%%%%%%
706
707 \bool_if:NTF \l_tzdots_shift_coor_bool
708 {
709 \tl_put_right:Nx \l_tzdots_cmd_tl
710 {% if shift
711 ( [ shift = { (\l_tzdots_shift_coor_tl) } ] #1 )
712 }
713 }
714 { \tl_put_right:Nn \l_tzdots_cmd_tl { (#1) } }
715
716 \tl_put_right:Nn \l_tzdots_cmd_tl { node } %%
717
718 \tl_put_right:Nx \l_tzdots_cmd_tl
719 {
720 [
721 \l_tzdots_STYLE_fill_tl ,
722 minimum~size = \exp_not:n { \tzdotsize } ,
723 label = { \l_label_pos_str_tl \c_colon_str \exp_not:n { #2 } } , % pos_str
724 }
725 \tl_put_right:No \l_tzdots_cmd_tl % expand `once'
726 {
727 \l_tzdots_opt_tl
728 ] {}
729 }
730 \tzdots_check_token:n
731 }
732
733 \NewDocumentCommand\tzdots_late_opt_fn { D(){\tz@initial@dot@size} }
734 {
735 \renewcommand\tzdotsize{ #1 }
736
737 \tzdots_stop_action
738 }
739
740
741 \NewDocumentCommand\tzdots_stop_action {}
742 {
743 \exp_last_unbraced:Nf \path \l_tzdots_cmd_tl ;
744 }
745
746 %%% --- end of \tzdots
747
748
749 %%%%% Circle Dots -- (code original, using radius)
750
751 \keys_define:nn { keytzCdot }
752 {
753 tzcdot .tl_set:N = \key_tzCdot_radius_tl
754 }
755
756
757 %% (keep)
758 %% \tzcdot --- circle dot (original)
759 %%% *[<opt>]<shift>(coor){label}[angle](radius)
760
761 \clist_new:N \l_tzCdot_opt_clist
762 \bool_new:N \l_tzCdot_shift_coor_bool
763
764 %%% \tzcdot (main)
765 \NewDocumentCommand\tzcdot{ s o d<> r() +G{} >{\TrimSpaces}o d() }
766 {
767 \tl_clear:N \l_tzCdot_opt_tl % (needed)
768 \tl_clear:N \l_tzCdot_cmd_tl
769
770 \renewcommand\tzCdotradius{\tz@initial@Cdot@radius}
771
772 \IfValueT { #7 }
773 { \renewcommand\tzCdotradius{ #7 } }
774
775 \IfBooleanTF { #1 }
776 { \tl_set:Nn \l_tzCdot_fill_tl { fill , solid, thin } }
777 { \tl_set:Nn \l_tzCdot_fill_tl { solid , thin } }
778
779 \IfValueTF { #3 }
780 {
781 \tl_set:Nn \l_tzCdot_shift_coor_tl { #3 }
782 \bool_set_true:N \l_tzCdot_shift_coor_bool
783 }
784 {
785 \tl_clear:N \l_tzCdot_shift_coor_tl
786 \bool_set_false:N \l_tzCdot_shift_coor_bool
787 }
788
789 \IfNoValueTF { #2 }
790 {
791 \tl_clear:N \l_tzCdot_opt_tl % arg specifier O{}
792 }
793 {
794 \clist_clear:N \l_tzCdot_opt_tested_clist
795 \clist_set:Nn \l_tzCdot_opt_input_clist { #2 }
796 \clist_map_inline:Nn \l_tzCdot_opt_input_clist
797 {
798 \str_if_in:nnTF { ##1 } { tzcdot }
799 { % (matched item)
800 \clist_pop:NN \l_tzCdot_opt_input_clist \l_label_pos_str_tl
801 \keys_set:nV { keytzCdot } \l_label_pos_str_tl % form: { tzcdot=\l_label_pos_str_tl }
802 \exp_args:NNo \renewcommand\tzCdotradius { \key_tzCdot_radius_tl }
803 \clist_map_break:
804 % non-tested list remains
805 }
806 { % (tested items -> list)
807 \clist_pop:NN \l_tzCdot_opt_input_clist \l_tmpb_tl
808 \clist_put_right:NV \l_tzCdot_opt_tested_clist \l_tmpb_tl
809 }
810 }
811 \clist_concat:NNN \l_tzCdot_opt_clist
812 \l_tzCdot_opt_tested_clist % tested list
813 \l_tzCdot_opt_input_clist % remained list
814 \clist_if_empty:NF \l_tzCdot_opt_clist
815 { % expand x needed
816 \tl_set:Nx \l_tzCdot_opt_tl { \clist_use:Nn \l_tzCdot_opt_clist {,} }
817 }
818 }
819
820 \tl_put_right:Nx \l_tzCdot_cmd_tl
821 {
822 [ \l_tzCdot_fill_tl ,
823 }
824 \tl_put_right:No \l_tzCdot_cmd_tl % expand `once'
825 {
826 \l_tzCdot_opt_tl
827 ]
828 }
829 \bool_if:NTF \l_tzCdot_shift_coor_bool
830 {% if shift
831 \tl_put_right:Nx \l_tzCdot_cmd_tl
832 {
833 ( [ shift = { (\l_tzCdot_shift_coor_tl) } ]#4 )
834 }
835 }
836 { \tl_put_right:Nn \l_tzCdot_cmd_tl { ( #4 ) } } % no shift (normal)
837
838 \tl_put_right:Nn \l_tzCdot_cmd_tl
839 {
840 circle ( \tzCdotradius )
841 }
842 %%%%%% to use string replacement for label positions
843 \IfValueTF { #6 }
844 {
845 \tl_if_in:nnTF { #6 } { [ }
846 { \extract_posopt:w #6 \q_stop } % ndh
847 {
848 \tl_set:Nx \l_label_pos_str_trimmed_tl { \tl_trim_spaces:n { #6 } }
849 \str_case_e:nnF { \l_label_pos_str_trimmed_tl }
850 {
851 {l} { \tl_set:Nn \l_label_pos_str_tl {left} }
852 {r} { \tl_set:Nn \l_label_pos_str_tl {right} }
853 {a} { \tl_set:Nn \l_label_pos_str_tl {above} }
854 {b} { \tl_set:Nn \l_label_pos_str_tl {below} }
855 {c} { \tl_set:Nn \l_label_pos_str_tl {center} }
856 {al} { \tl_set:Nn \l_label_pos_str_tl {above~left} }
857 {ar} { \tl_set:Nn \l_label_pos_str_tl {above~right} }
858 {bl} { \tl_set:Nn \l_label_pos_str_tl {below~left} }
859 {br} { \tl_set:Nn \l_label_pos_str_tl {below~right} }
860 }
861 {
862 \tl_set:Nn \l_label_pos_str_tl { #6 }
863 }
864 }
865 }
866 {
867 \tl_clear:N \l_label_pos_str_tl
868 }
869 %%%%%%%%%%
870
871 \tl_put_right:Nx \l_tzCdot_cmd_tl
872 {
873 node
874 [ inner~sep = 0pt ,
875 label = { \l_label_pos_str_tl \c_colon_str \exp_not:n { #5 } } % pos_str
876 ] {}
877 }
878 \exp_last_unbraced:No \draw \l_tzCdot_cmd_tl ;
879 }
880
881 %%% --- end of \tzcdot
882
883
884 %%% multiple dots
885 %%% coding CAUTION! : _tzCdot_ changes to _tzCdots
886
887
888 %%% \tzcdots
889 %%% *[<opt>]<shift> (){}[] (){}[] repeated (){}[] ; (radius)
890 %%% repeat pattern: (coor){label}[angle]
891
892 \clist_new:N \l_tzCdots_opt_clist
893 \bool_new:N \l_tzCdots_size_call_bool
894 \bool_new:N \l_tzCdots_shift_coor_bool
895
896 %%% \tzcdots (main)
897 \NewDocumentCommand\tzcdots{ s o d<> }
898 {
899 \renewcommand\tzCdotradius{\tz@initial@Cdot@radius}
900
901 \tl_clear:N \l_tzCdots_opt_tl % (needed)
902 \tl_clear:N \l_tzCdots_cmd_tl
903
904 \IfBooleanTF { #1 }
905 { \bool_set_true:N \l_tmpa_bool }
906 { \bool_set_false:N \l_tmpa_bool }
907
908 \IfValueTF { #3 }
909 {
910 \tl_set:Nn \l_tzCdots_shift_coor_tl { #3 }
911 \bool_set_true:N \l_tzCdots_shift_coor_bool
912 }
913 {
914 \tl_clear:N \l_tzCdots_shift_coor_tl
915 \bool_set_false:N \l_tzCdots_shift_coor_bool
916 }
917
918 \IfNoValueTF { #2 }
919 {
920 \tl_clear:N \l_tzCdots_opt_tl % arg specifier O{}
921 }
922 {
923 \clist_clear:N \l_tzCdots_opt_tested_clist
924 \clist_set:Nn \l_tzCdots_opt_input_clist { #2 }
925 \clist_map_inline:Nn \l_tzCdots_opt_input_clist
926 {
927 \str_if_in:nnTF { ##1 } { tzcdot }
928 {
929 \clist_pop:NN \l_tzCdots_opt_input_clist \l_label_pos_str_tl
930 \keys_set:nV { keytzCdot } \l_label_pos_str_tl
931 \exp_args:NNo \renewcommand\tzCdotradius { \key_tzCdot_radius_tl }
932 \bool_set_true:N \l_tzCdots_size_call_bool
933 \clist_map_break:
934 }
935 {
936 \clist_pop:NN \l_tzCdots_opt_input_clist \l_tmpb_tl
937 \clist_put_right:NV \l_tzCdots_opt_tested_clist \l_tmpb_tl
938 }
939 }
940 \clist_concat:NNN \l_tzCdots_opt_clist
941 \l_tzCdots_opt_tested_clist
942 \l_tzCdots_opt_input_clist
943 \clist_if_empty:NF \l_tzCdots_opt_clist
944 {
945 \tl_set:Nx \l_tzCdots_opt_tl { \clist_use:Nn \l_tzCdots_opt_clist {,} }
946 }
947 }
948
949 \tzCdots_check_token:n
950 }
951
952 \cs_new:Npn \tzCdots_check_token:n #1
953 {
954 % \token_if_eq_charcode:NNTF #1 (
955 % { \tzCdots_sub_fn #1 }
956 % { \tzCdots_stop_action }
957 \str_case:nnF { #1 }
958 {
959 { ( } { \tzCdots_sub_fn #1 }
960 { ; } { \tzCdots_late_opt_fn }
961 }
962 {
963 % \tzCdots_stop_action
964 \msg_error:nn { tzplot } { semicolon-error }
965 }
966 }
967
968 \NewDocumentCommand\tzCdots_sub_fn { r() +G{} >{\TrimSpaces}o }
969 {
970 %%%%%% to use string replacement for label positions
971 \IfValueTF { #3 }
972 {
973 \tl_if_in:nnTF { #3 } { [ }
974 { \extract_posopt:w #3 \q_stop } % ndh
975 {
976 \tl_set:Nx \l_label_pos_str_trimmed_tl { \tl_trim_spaces:n { #3 } }
977 \str_case_e:nnF { \l_label_pos_str_trimmed_tl }
978 {
979 {l} { \tl_set:Nn \l_label_pos_str_tl {left} }
980 {r} { \tl_set:Nn \l_label_pos_str_tl {right} }
981 {a} { \tl_set:Nn \l_label_pos_str_tl {above} }
982 {b} { \tl_set:Nn \l_label_pos_str_tl {below} }
983 {c} { \tl_set:Nn \l_label_pos_str_tl {center} }
984 {al} { \tl_set:Nn \l_label_pos_str_tl {above~left} }
985 {ar} { \tl_set:Nn \l_label_pos_str_tl {above~right} }
986 {bl} { \tl_set:Nn \l_label_pos_str_tl {below~left} }
987 {br} { \tl_set:Nn \l_label_pos_str_tl {below~right} }
988 }
989 {
990 \tl_set:Nn \l_label_pos_str_tl { #3 }
991 }
992 }
993 }
994 {
995 \tl_clear:N \l_label_pos_str_tl
996 }
997 %%%%%%%%%%
998 \bool_if:NTF \l_tzCdots_shift_coor_bool
999 {% if shift
1000 \tl_put_right:Nx \l_tzCdots_cmd_tl
1001 {
1002 ( [ shift = { (\l_tzCdots_shift_coor_tl) } ]#1 ) circle (\tzCdotradius)
1003 }
1004 }
1005 {% no shift (normal)
1006 \tl_put_right:Nn \l_tzCdots_cmd_tl { (#1) circle (\tzCdotradius) }
1007 }
1008
1009 \tl_put_right:Nx \l_tzCdots_cmd_tl
1010 {
1011 node
1012 [ inner~sep = 0pt ,
1013 label = { \l_label_pos_str_tl \c_colon_str \exp_not:n { #2 } } % pos_str
1014 ] {}
1015 }
1016 \tzCdots_check_token:n
1017 }
1018
1019 \NewDocumentCommand\tzCdots_late_opt_fn { d() }
1020 {
1021 \IfValueT { #1 }
1022 {
1023 \bool_if:NF \l_tzCdots_size_call_bool
1024 { \renewcommand\tzCdotradius { #1 } }
1025 }
1026
1027 \tzCdots_stop_action
1028 }
1029
1030 \NewDocumentCommand\tzCdots_stop_action {}
1031 {
1032 \tl_if_empty:NTF \l_tzCdots_opt_tl
1033 {
1034 \tl_put_left:Nn \l_tzCdots_cmd_tl { ] }
1035 }
1036 {
1037 \tl_put_left:No \l_tzCdots_cmd_tl { \l_tzCdots_opt_tl ] } % expand `once'
1038 }
1039
1040 \bool_if:NTF \l_tmpa_bool
1041 {
1042 \tl_put_left:Nn \l_tzCdots_cmd_tl { [ fill , solid , thin , }
1043 }
1044 {
1045 \tl_put_left:Nn \l_tzCdots_cmd_tl { [ solid , thin , }
1046 }
1047
1048 \exp_last_unbraced:Nf \draw \l_tzCdots_cmd_tl ;
1049
1050 \bool_set_false:N \l_tzCdots_size_call_bool
1051 }
1052
1053 %%% --- end of \tzcdots
1054
1055
1056 %%% \tzshoworigin (node text and dot at the origin)
1057
1058 \NewDocumentCommand\tzshoworigin
1059 { s O{} d<> D(){0,0} +g O{} D(){\tz@initial@dot@size} }
1060 {
1061 \IfValueTF { #5 }
1062 {% if shift
1063 \IfValueTF { #3 }
1064 {
1065 \path [ shift = {(#3)} ] (#4) node
1066 [ text~height = 1.25ex , text~depth=.25ex , below~left , #6 ]
1067 { #5 } ;
1068 \IfBooleanT { #1 } { \tzdot* [ #2 ] ([shift={(#3)}] #4) (#7) }
1069 }
1070 {% no shift
1071 \path (#4) node
1072 [ text~height = 1.25ex , text~depth=.25ex , below~left , #6 ]
1073 { #5 } ;
1074 \IfBooleanT { #1 } { \tzdot* [ #2 ] (#4) (#7) }
1075 }
1076 }
1077 {
1078 \IfValueTF { #3 }
1079 {% if shift
1080 \IfBooleanTF { #1 }
1081 {
1082 \tzdot* [ #2 ] ([shift={(#3)}] #4) (#7)
1083 }
1084 {
1085 \path [ shift = {(#3)} ] (#4) node
1086 [ text~height = 1.25ex , text~depth=.25ex , below~left , #6 ]
1087 { 0 } ;
1088 }
1089 }
1090 {% no shift
1091 \IfBooleanTF { #1 }
1092 {
1093 \tzdot* [ #2 ] (#4) (#7)
1094 }
1095 {
1096 \path (#4) node
1097 [ text~height = 1.25ex , text~depth=.25ex , below~left , #6 ]
1098 { 0 } ;
1099 }
1100 }
1101 }
1102 }
1103
1104 %%% --- end of \tzshoworigin
1105
1106
1107 %%%%% Coordinates
1108
1109 %%% \tzcoor()(){label}[pos]
1110 \NewDocumentCommand\tzcoor{ s O{} d<> r() r() +G{} >{\TrimSpaces}o D(){\tz@initial@dot@size} }
1111 {
1112 \tl_clear:N \l_tzcoor_cmd_tl
1113
1114 \IfBooleanTF { #1 }
1115 {
1116 \IfValueTF { #3 }
1117 {
1118 \path ([shift={(#3)}]#4) coordinate (#5) ;
1119 \tzdot*[#2]([shift={(#3)}]#4){#6}[#7](#8)
1120 }
1121 {
1122 \path (#4) coordinate (#5) ;
1123 \tzdot*[#2](#4){#6}[#7](#8)
1124 }
1125 }
1126 {
1127 \IfValueTF { #3 }
1128 {
1129 \tl_put_right:Nn \l_tzcoor_cmd_tl
1130 {
1131 ([shift={(#3)}]#4) coordinate
1132 }
1133 }
1134 { \tl_put_right:Nn \l_tzcoor_cmd_tl { (#4) coordinate } }
1135
1136 \tl_put_right:Nn \l_tzcoor_cmd_tl
1137 {
1138 [ inner~sep = 0pt ,
1139 }
1140 %%%%%% to use string replacement for label positions
1141 \IfValueTF { #7 }
1142 {
1143 \tl_if_in:nnTF { #7 } { [ }
1144 { \extract_posopt:w #7 \q_stop } % ndh
1145 {
1146 \tl_set:Nx \l_label_pos_str_trimmed_tl { \tl_trim_spaces:n { #7 } }
1147 \str_case_e:nnF { \l_label_pos_str_trimmed_tl }
1148 {
1149 {l} { \tl_set:Nn \l_label_pos_str_tl {left} }
1150 {r} { \tl_set:Nn \l_label_pos_str_tl {right} }
1151 {a} { \tl_set:Nn \l_label_pos_str_tl {above} }
1152 {b} { \tl_set:Nn \l_label_pos_str_tl {below} }
1153 {c} { \tl_set:Nn \l_label_pos_str_tl {center} }
1154 {al} { \tl_set:Nn \l_label_pos_str_tl {above~left} }
1155 {ar} { \tl_set:Nn \l_label_pos_str_tl {above~right} }
1156 {bl} { \tl_set:Nn \l_label_pos_str_tl {below~left} }
1157 {br} { \tl_set:Nn \l_label_pos_str_tl {below~right} }
1158 }
1159 {
1160 \tl_set:Nn \l_label_pos_str_tl { #7 }
1161 }
1162 }
1163 }
1164 {
1165 \tl_clear:N \l_label_pos_str_tl
1166 }
1167 %%%%%%%%%%
1168 \tl_put_right:Nx \l_tzcoor_cmd_tl
1169 {
1170 label = { \l_label_pos_str_tl \c_colon_str \exp_not:n { #6 } } % pos_str
1171 }
1172 \tl_put_right:Nn \l_tzcoor_cmd_tl
1173 {
1174 ] (#5)
1175 }
1176 \exp_last_unbraced:No \path \l_tzcoor_cmd_tl ;
1177 }
1178 }
1179
1180 %%% --- end of \tzcoor
1181
1182
1183 %%% \tzcoortangenttocircle(node)(point)(coor)
1184 \NewDocumentCommand\tzcoortangenttocircle{ s O{} r() r() r() }
1185 {
1186 \tl_clear:N \l_tzcoorTTC_cmdX_tl
1187 \tl_clear:N \l_tzcoorTTC_cmdY_tl
1188 \tl_clear:N \l_tzcoorTTC_cmdXa_tl
1189 \tl_clear:N \l_tzcoorTTC_cmdXb_tl
1190 \tl_clear:N \l_tzcoorTTC_cmdYa_tl
1191 \tl_clear:N \l_tzcoorTTC_cmdYb_tl
1192
1193 \tl_clear:N \l_tzcoorTTC_opt_tl
1194
1195 \tl_clear:N \l_tzcoorTTC_node_tl
1196 \tl_clear:N \l_tzcoorTTC_point_tl
1197 \tl_clear:N \l_tzcoorTTC_coorX_tl
1198 \tl_clear:N \l_tzcoorTTC_coorY_tl
1199
1200 \IfBooleanTF { #1 }
1201 { \bool_set_true:N \l_tmpa_bool }
1202 { \bool_set_false:N \l_tmpa_bool }
1203
1204 \tl_set:Nn \l_tzcoorTTC_opt_tl { #2 }
1205
1206 \tl_set:Nn \l_tzcoorTTC_node_tl { #3 }
1207 \tl_set:Nn \l_tzcoorTTC_point_tl { #4 }
1208 \tl_set:Nn \l_tzcoorTTC_coorX_tl { #5 }
1209
1210 \tl_set:Nx \l_tzcoorTTC_cmdX_tl
1211 {
1212 (tangent~cs \c_colon_str node = #3, point = { (#4) }, solution = 1)
1213 }
1214 \tl_set:Nx \l_tzcoorTTC_cmdY_tl
1215 {
1216 (tangent~cs \c_colon_str node = #3, point = { (#4) }, solution = 2)
1217 }
1218 \tzcoorTTC_final_actions
1219 }
1220
1221 \NewDocumentCommand\tzcoorTTC_final_actions
1222 % { +G{} >{\TrimSpaces}o D(){tzcoorTTCX} +G{} >\{TrimSpaces}o }
1223 { +G{} O{} D(){tzcoorTTCX} +G{} O{} }
1224 {
1225 % collect coordinate information: case by case
1226 \tl_set:No \l_tzcoorTTC_cmdXa_tl
1227 { \l_tzcoorTTC_cmdX_tl coordinate (\l_tzcoorTTC_coorX_tl) }
1228 \tl_set:No \l_tzcoorTTC_cmdXb_tl
1229 { \l_tzcoorTTC_cmdX_tl coordinate (\l_tzcoorTTC_coorX_tl-1) }
1230 \tl_set:No \l_tzcoorTTC_cmdYa_tl
1231 { \l_tzcoorTTC_cmdY_tl coordinate (\l_tzcoorTTC_coorX_tl-2) }
1232 \tl_set:No \l_tzcoorTTC_cmdYb_tl
1233 { \l_tzcoorTTC_cmdY_tl coordinate (#3) }
1234
1235 % solution=1
1236 \exp_last_unbraced:Nf
1237 \path \l_tzcoorTTC_cmdXa_tl ;
1238 \exp_last_unbraced:Nf
1239 \path \l_tzcoorTTC_cmdXb_tl ;
1240 % solution=2
1241 \exp_last_unbraced:Nf
1242 \path \l_tzcoorTTC_cmdYa_tl ;
1243 \exp_last_unbraced:Nf
1244 \path \l_tzcoorTTC_cmdYb_tl ;
1245
1246 \bool_if:NTF \l_tmpa_bool
1247 {
1248 \tzdot*[ \tl_use:N \l_tzcoorTTC_opt_tl ]
1249 ( \tl_use:N \l_tzcoorTTC_coorX_tl ){#1}[#2]
1250 \tzdot*[ \tl_use:N \l_tzcoorTTC_opt_tl ]
1251 ( \tl_use:N \l_tzcoorTTC_coorX_tl-2 ){#4}[#5]
1252 }
1253 {
1254 \tzdot*[ draw = none , fill = none , \tl_use:N \l_tzcoorTTC_opt_tl ]
1255 ( \tl_use:N \l_tzcoorTTC_coorX_tl ){#1}[#2]
1256 \tzdot*[ draw = none , fill = none , \tl_use:N \l_tzcoorTTC_opt_tl ]
1257 ( \tl_use:N \l_tzcoorTTC_coorX_tl-2 ){#4}[#5]
1258 }
1259 }
1260 %%% --- end of \tzcoortangenttocircle
1261
1262
1263
1264 %%%% \tzcoortangenttocircle(node)(point)(coor)
1265 %\NewDocumentCommand\tzcoortangenttocircle{ r() r() r() d() }
1266 %{
1267 % \path (tangent~cs \c_colon_str node = #1, point = { (#2) }, solution = 1)
1268 % coordinate (#3) ;
1269 % \path (tangent~cs \c_colon_str node = #1, point = { (#2) }, solution = 1)
1270 % coordinate (#3-1) ;
1271 % \path (tangent~cs \c_colon_str node = #1, point = { (#2) }, solution = 2)
1272 % coordinate (#3-2) ;
1273 % \IfValueT { #4 }
1274 % {
1275 % \path (tangent~cs \c_colon_str node = #1, point = { (#2) }, solution = 2)
1276 % coordinate (#4) ;
1277 % }
1278 %}
1279 %
1280 %%%% --- end of \tzcoortangenttocircle
1281
1282
1283
1284 %%% \tzcoors
1285
1286 \bool_new:N \l_tzcoors_shift_coor_bool
1287
1288 %%% \tzcoors*[opt]<radius> ()(){}[] ()(){}[] repeated ()(){}[];
1289 %% repeat pattern: (coor)(name){label}[pos]
1290
1291 %%% \tzcoors (main)
1292 \NewDocumentCommand\tzcoors{ s O{} d<> }
1293 {
1294 \tl_clear:N \l_tzcoors_cmd_tl
1295 \tl_clear:N \l_tzcoors_tzdot_cmd_tl
1296
1297 \IfBooleanTF { #1 }
1298 { \bool_set_true:N \l_tmpa_bool }
1299 { \bool_set_false:N \l_tmpa_bool }
1300
1301 \IfValueTF { #2 }
1302 { \tl_set:Nn \l_tzcoors_opt_tl { #2 } }
1303 { \tl_clear:N \l_tzcoors_opt_tl }
1304
1305 \IfValueTF { #3 }
1306 {
1307 \tl_set:Nn \l_tzcoors_shift_coor_tl { #3 }
1308 \bool_set_true:N \l_tzcoors_shift_coor_bool
1309 }
1310 {
1311 \tl_clear:N \l_tzcoors_shift_coor_tl
1312 \bool_set_false:N \l_tzcoors_shift_coor_bool
1313 }
1314
1315 \tzcoors_check_token:n
1316 }
1317
1318 \cs_new:Npn \tzcoors_check_token:n #1
1319 {
1320 % \str_if_eq:nnTF { #1 } { ( }
1321 % { \tzcoors_sub_fn ( }
1322 % { \tzcoors_stop_action }
1323 \str_case:nnF { #1 }
1324 {
1325 { ( } { \tzcoors_sub_fn #1 }
1326 { ; } { \tzcoors_late_opt_fn }
1327 }
1328 {
1329 % \tzcoors_stop_action
1330 \msg_error:nn { tzplot } { semicolon-error }
1331 }
1332 }
1333
1334 \NewDocumentCommand\tzcoors_sub_fn { r() r() +G{} >{\TrimSpaces}o }
1335 {
1336 %%%%%% to use string replacement for label positions
1337 \IfValueTF { #4 }
1338 {
1339 \tl_if_in:nnTF { #4 } { [ }
1340 { \extract_posopt:w #4 \q_stop } % ndh
1341 {
1342 \tl_set:Nx \l_label_pos_str_trimmed_tl { \tl_trim_spaces:n { #4 } }
1343 \str_case_e:nnF { \l_label_pos_str_trimmed_tl }
1344 {
1345 {l} { \tl_set:Nn \l_label_pos_str_tl {left} }
1346 {r} { \tl_set:Nn \l_label_pos_str_tl {right} }
1347 {a} { \tl_set:Nn \l_label_pos_str_tl {above} }
1348 {b} { \tl_set:Nn \l_label_pos_str_tl {below} }
1349 {c} { \tl_set:Nn \l_label_pos_str_tl {center} }
1350 {al} { \tl_set:Nn \l_label_pos_str_tl {above~left} }
1351 {ar} { \tl_set:Nn \l_label_pos_str_tl {above~right} }
1352 {bl} { \tl_set:Nn \l_label_pos_str_tl {below~left} }
1353 {br} { \tl_set:Nn \l_label_pos_str_tl {below~right} }
1354 }
1355 {
1356 \tl_set:Nn \l_label_pos_str_tl { #4 }
1357 }
1358 }
1359 }
1360 {
1361 \tl_clear:N \l_label_pos_str_tl
1362 }
1363 %%%%%%%%%%
1364 \bool_if:NTF \l_tmpa_bool
1365 {
1366 % collect only coor info
1367 \bool_if:NTF \l_tzcoors_shift_coor_bool
1368 {% if shift
1369 \tl_put_right:Nx \l_tzcoors_cmd_tl
1370 { ([ shift = { (\l_tzcoors_shift_coor_tl) } ]#1) }
1371 }
1372 {% no shift (normal)
1373 \tl_put_right:Nn \l_tzcoors_cmd_tl { (#1) }
1374 }
1375 \tl_put_right:Nn \l_tzcoors_cmd_tl
1376 { coordinate (#2) }
1377 % collect dot info: (coor) [ dot opt ] {}
1378 \bool_if:NTF \l_tzcoors_shift_coor_bool
1379 {% if shift
1380 \tl_put_right:Nx \l_tzcoors_tzdot_cmd_tl
1381 { ([ shift = { (\l_tzcoors_shift_coor_tl) } ]#1) }
1382 }
1383 {% no shift
1384 \tl_put_right:Nn \l_tzcoors_tzdot_cmd_tl { (#1) }
1385 }
1386 \tl_put_right:Nn \l_tzcoors_tzdot_cmd_tl
1387 {
1388 node
1389 [ fill , tzdot = \tzdotsize ,
1390 }
1391 \tl_put_right:Nx \l_tzcoors_tzdot_cmd_tl
1392 {
1393 label = { \l_label_pos_str_tl \c_colon_str \exp_not:n { #3 } } , % abb
1394 }
1395 \tl_put_right:No \l_tzcoors_tzdot_cmd_tl
1396 {
1397 \l_tzcoors_opt_tl % expand `once'
1398 ] {}
1399 }
1400 }
1401 {
1402 \bool_if:NTF \l_tzcoors_shift_coor_bool
1403 {% if shift
1404 \tl_put_right:Nx \l_tzcoors_cmd_tl
1405 { ([ shift = { (\l_tzcoors_shift_coor_tl) } ]#1) coordinate }
1406 }
1407 {% no shift (normal)
1408 \tl_put_right:Nn \l_tzcoors_cmd_tl
1409 { (#1) coordinate }
1410 }
1411 \tl_put_right:Nx \l_tzcoors_cmd_tl
1412 { [ label = { \l_label_pos_str_tl \c_colon_str \exp_not:n { #3 } } ] } % pos_str
1413 \tl_put_right:Nn \l_tzcoors_cmd_tl
1414 { (#2) }
1415 }
1416 \tzcoors_check_token:n
1417 }
1418
1419 \NewDocumentCommand\tzcoors_late_opt_fn { D(){\tz@initial@dot@size} }
1420 {
1421 \renewcommand\tzdotsize{ #1 }
1422
1423 \tzcoors_stop_action
1424 }
1425
1426 \cs_new:Npn \tzcoors_stop_action
1427 {
1428 \exp_last_unbraced:Nf \path \l_tzcoors_cmd_tl ;
1429 \bool_if:NT \l_tmpa_bool
1430 { \exp_last_unbraced:Nf \path \l_tzcoors_tzdot_cmd_tl ; }
1431 }
1432
1433 %%% --- end of \tzcoors
1434
1435
1436 %%% \tzcoorsquick --- with labels (quick view)
1437
1438 \bool_new:N \l_tzcoors_quick_shift_coor_bool
1439
1440 %%% \tzcoorsquick (main)
1441 \NewDocumentCommand\tzcoorsquick { s O{} d<> }
1442 {
1443 \tl_clear:N \l_tzcoors_quick_cmd_tl
1444 \tl_clear:N \l_tzcoors_quick_tzdot_cmd_tl
1445
1446 \IfBooleanTF { #1 }
1447 { \bool_set_true:N \l_tmpa_bool }
1448 { \bool_set_false:N \l_tmpa_bool }
1449
1450 \IfValueTF { #2 }
1451 { \tl_set:Nn \l_tzcoors_quick_opt_tl { #2 } }
1452 { \tl_clear:N \l_tzcoors_quick_opt_tl }
1453
1454 \IfValueTF { #3 }
1455 {
1456 \tl_set:Nn \l_tzcoors_quick_shift_coor_tl { #3 }
1457 \bool_set_true:N \l_tzcoors_quick_shift_coor_bool
1458 }
1459 {
1460 \tl_clear:N \l_tzcoors_quick_shift_coor_tl
1461 \bool_set_false:N \l_tzcoors_quick_shift_coor_bool
1462 }
1463
1464 \tzcoors_quick_check_token:n
1465 }
1466
1467 \cs_new:Npn \tzcoors_quick_check_token:n #1
1468 {
1469 % \str_if_eq:nnTF { #1 } { ( }
1470 % { \tzcoorsquick_sub_fn ( }
1471 % { \tzcoorsquick_stop_action }
1472 \str_case:nnF { #1 }
1473 {
1474 { ( } { \tzcoorsquick_sub_fn #1 }
1475 { ; } { \tzcoorsquick_late_opt_fn }
1476 }
1477 {
1478 % \tzcoorsquick_stop_action
1479 \msg_error:nn { tzplot } { semicolon-error }
1480 }
1481 }
1482
1483 % repetition ***
1484 \NewDocumentCommand\tzcoorsquick_sub_fn { r() r() +g >{\TrimSpaces}o }
1485 {
1486 \IfValueTF { #3 }
1487 { \tl_set:Nx \l_label_pos_tl { \exp_not:n { #3 } } }
1488 { \tl_set:Nn \l_label_pos_tl { #2 } } % automatic view
1489
1490 %%%%%% to use string replacement for label positions
1491 \IfValueTF { #4 }
1492 {
1493 \tl_if_in:nnTF { #4 } { [ }
1494 { \extract_posopt:w #4 \q_stop } % ndh
1495 {
1496 \tl_set:Nx \l_label_pos_str_trimmed_tl { \tl_trim_spaces:n { #4 } }
1497 \str_case_e:nnF { \l_label_pos_str_trimmed_tl }
1498 {
1499 {l} { \tl_set:Nn \l_label_pos_str_tl {left} }
1500 {r} { \tl_set:Nn \l_label_pos_str_tl {right} }
1501 {a} { \tl_set:Nn \l_label_pos_str_tl {above} }
1502 {b} { \tl_set:Nn \l_label_pos_str_tl {below} }
1503 {c} { \tl_set:Nn \l_label_pos_str_tl {center} }
1504 {al} { \tl_set:Nn \l_label_pos_str_tl {above~left} }
1505 {ar} { \tl_set:Nn \l_label_pos_str_tl {above~right} }
1506 {bl} { \tl_set:Nn \l_label_pos_str_tl {below~left} }
1507 {br} { \tl_set:Nn \l_label_pos_str_tl {below~right} }
1508 }
1509 {
1510 \tl_set:Nn \l_label_pos_str_tl { #4 }
1511 }
1512 }
1513 \tl_set:Nx \l_tmpb_tl { \l_label_pos_str_tl } % pos_str
1514 }
1515 {
1516 \tl_clear:N \l_label_pos_str_tl
1517 \bool_if:NTF \l_tmpa_bool
1518 { \tl_set:Nn \l_tmpb_tl { } } % texts with dots (tikz default: above)
1519 { \tl_set:Nn \l_tmpb_tl { center } } % only texts
1520 }
1521 %%%%%%%%%%
1522
1523 % \IfValueTF { #4 }
1524 % {
1525 % \tl_set:Nx \l_tmpb_tl { \l_label_pos_str_tl } % pos_str
1526 % }
1527 % {
1528 % \bool_if:NTF \l_tmpa_bool
1529 % { \tl_set:Nn \l_tmpb_tl { } } % texts with dots (tikz default: above)
1530 % { \tl_set:Nn \l_tmpb_tl { center } } % only texts
1531 % }
1532
1533 % \tl_if_empty:nTF { #4 }
1534 % {
1535 % \bool_if:NTF \l_tmpa_bool
1536 % { \tl_set:Nn \l_tmpb_tl { } } % texts with dots (tikz default: above)
1537 % { \tl_set:Nn \l_tmpb_tl { center } } % only texts
1538 % }
1539 % {
1540 % \tl_set:Nx \l_tmpb_tl { \exp_not:n { #4 } }
1541 % }
1542
1543 \bool_if:NTF \l_tmpa_bool
1544 { %% glancing labels with dots
1545 % collect only coor info
1546 % collect only coor info
1547 \bool_if:NTF \l_tzcoors_quick_shift_coor_bool
1548 {% if shift
1549 \tl_put_right:Nx \l_tzcoors_quick_cmd_tl
1550 { ([ shift = { (\l_tzcoors_quick_shift_coor_tl) } ]#1) }
1551 }
1552 {% no shift (normal)
1553 \tl_put_right:Nn \l_tzcoors_quick_cmd_tl { (#1) }
1554 }
1555 \tl_put_right:Nn \l_tzcoors_quick_cmd_tl
1556 { coordinate (#2) }
1557 % collect dot info: (coor) [ dot opt ] {}
1558 \bool_if:NTF \l_tzcoors_quick_shift_coor_bool
1559 {% if shift
1560 \tl_put_right:Nx \l_tzcoors_quick_tzdot_cmd_tl
1561 { ([ shift = { (\l_tzcoors_quick_shift_coor_tl) } ]#1) }
1562 }
1563 {% no shift
1564 \tl_put_right:Nn \l_tzcoors_quick_tzdot_cmd_tl { (#1) }
1565 }
1566 \tl_put_right:Nn \l_tzcoors_quick_tzdot_cmd_tl
1567 {
1568 node
1569 [ fill , tzdot = \tzdotsize ,
1570 }
1571 \tl_put_right:Nx \l_tzcoors_quick_tzdot_cmd_tl
1572 {
1573 label = { \l_tmpb_tl \c_colon_str { \l_label_pos_tl } } ,
1574 }
1575 \tl_put_right:No \l_tzcoors_quick_tzdot_cmd_tl
1576 {
1577 \l_tzcoors_quick_opt_tl % expand `once'
1578 ] {}
1579 }
1580 }
1581 { %% glancing just labels (right on the coors)
1582 % collect coor and node info
1583 \bool_if:NTF \l_tzcoors_quick_shift_coor_bool
1584 {% if shift
1585 \tl_put_right:Nx \l_tzcoors_quick_cmd_tl
1586 { ([ shift = { (\l_tzcoors_quick_shift_coor_tl) } ]#1) coordinate }
1587 }
1588 {% no shift (normal)
1589 \tl_put_right:Nn \l_tzcoors_quick_cmd_tl
1590 { (#1) coordinate }
1591 }
1592 \tl_put_right:Nx \l_tzcoors_quick_cmd_tl
1593 { [ label = { \l_tmpb_tl \c_colon_str { \l_label_pos_tl } } ] }
1594 \tl_put_right:Nn \l_tzcoors_quick_cmd_tl
1595 { (#2) }
1596 }
1597
1598 \tzcoors_quick_check_token:n
1599 }
1600
1601 \NewDocumentCommand\tzcoorsquick_late_opt_fn{ D(){\tz@initial@dot@size} }
1602 {
1603 \renewcommand\tzdotsize{ #1 }
1604
1605 \tzcoorsquick_stop_action
1606 }
1607
1608 \cs_new:Npn \tzcoorsquick_stop_action
1609 {
1610 \exp_last_unbraced:Nf \path \l_tzcoors_quick_cmd_tl ;
1611 \bool_if:NT \l_tmpa_bool
1612 { \exp_last_unbraced:Nf \path \l_tzcoors_quick_tzdot_cmd_tl ; }
1613 }
1614
1615 %%% --- end of \tzcoorsquick
1616
1617
1618
1619 %%%%% Lines
1620
1621 %%% \tzline
1622 %% do not use: inner sep=0pt
1623
1624 %%% \tzline
1625
1626 \bool_new:N \g_tzline_BEGIN_cmd_bool
1627 \bool_new:N \g_tzline_END_cmd_bool
1628 \bool_new:N \l_tzline_shift_coor_bool
1629
1630 %% \tzlineAtBegin
1631 \NewDocumentCommand\tzlineAtBegin{ m }
1632 {
1633 \bool_gset_true:N \g_tzline_BEGIN_cmd_bool
1634 \tl_gset:No \g_tzline_BEGIN_cmd_tl { #1 }
1635 }
1636
1637 %% \tzlineAtEnd
1638 \NewDocumentCommand\tzlineAtEnd{ m }
1639 {
1640 \bool_gset_true:N \g_tzline_END_cmd_bool
1641 \tl_gset:No \g_tzline_END_cmd_tl { #1 }
1642 }
1643
1644 %%% \tzline (main)
1645 \NewDocumentCommand\tzline{ s t+ o d<> d"" }
1646 {
1647 \tl_clear:N \l_tzline_cmd_tl
1648
1649 \IfBooleanTF { #1 } % (*) or not (NOT USED!)
1650 { \bool_set_true:N \l_tmpa_bool }
1651 { \bool_set_false:N \l_tmpa_bool }
1652
1653 \IfBooleanTF { #2 } % (+) or not
1654 { \bool_set_true:N \l_tmpb_bool }
1655 { \bool_set_false:N \l_tmpb_bool }
1656
1657 \IfValueTF { #4 }
1658 {
1659 \tl_set:Nn \l_tzline_shift_coor_tl { #4 }
1660 \bool_set_true:N \l_tzline_shift_coor_bool
1661 }
1662 {
1663 \tl_clear:N \l_tzline_shift_coor_tl
1664 \bool_set_false:N \l_tzline_shift_coor_bool
1665 }
1666
1667 \IfValueTF { #3 }
1668 { \tl_set:Nn \l_tzline_opt_tl { #3 } }
1669 { \tl_clear:N \l_tzline_opt_tl }
1670
1671 \IfValueTF { #5 }
1672 { \tl_set:Nn \l_tzline_namepath_tl { name~path = #5 } }
1673 { \tl_clear:N \l_tzline_namepath_tl }
1674
1675 \tzline_check_token:n
1676 }
1677
1678 \cs_new:Npn \tzline_check_token:n #1
1679 {
1680 \str_if_eq:nnT { #1 } { ( }
1681 { \tzline_sub_fn ( }
1682 % \tzline_stop_action
1683 }
1684
1685 %% structure: (coorA) -- node [pos] {text} (coorB) node [pos] {text}
1686 \NewDocumentCommand\tzline_sub_fn{ r() +G{} O{} d<> r() +G{} O{} D<>{} }
1687 {
1688 % determine connect line STYLE
1689 \tl_set:Nn \l_tzline_STYLE_A_tl { -- }
1690 \IfValueTF { #4 }
1691 {
1692 \tl_set:Nn \l_tzline_STYLE_C_tl { #4 }
1693 }
1694 {
1695 \bool_if:NTF \l_tmpb_bool
1696 { \tl_set:Nn \l_tzline_STYLE_C_tl { ++ } }
1697 { \tl_set:Nn \l_tzline_STYLE_C_tl { } }
1698 }
1699 % insert connect line STYLE
1700 \bool_if:NTF \l_tzline_shift_coor_bool
1701 {% if shift
1702 \tl_put_right:Nx \l_tzline_cmd_tl
1703 { ([ shift = { (\l_tzline_shift_coor_tl) } ]#1) }
1704 }
1705 {% no shift (normal)
1706 \tl_put_right:Nn \l_tzline_cmd_tl { (#1) }
1707 }
1708
1709 \tl_put_right:No \l_tzline_cmd_tl % once
1710 {
1711 \l_tzline_STYLE_A_tl %% just --
1712 }
1713 \tl_put_right:Nn \l_tzline_cmd_tl
1714 {
1715 ~ node [ above , #3 ] { #2 }
1716 }
1717 \tl_put_right:No \l_tzline_cmd_tl % once
1718 {
1719 \l_tzline_STYLE_C_tl
1720 }
1721 \bool_if:NTF \l_tmpb_bool
1722 {% if ++
1723 \tl_put_right:Nn \l_tzline_cmd_tl { (#5) }
1724 }
1725 {% no ++
1726 \bool_if:NTF \l_tzline_shift_coor_bool
1727 {% if shift
1728 \tl_put_right:Nx \l_tzline_cmd_tl
1729 { ([ shift = { (\l_tzline_shift_coor_tl) } ]#5) }
1730 }
1731 {% no shift (normal)
1732 \tl_put_right:Nn \l_tzline_cmd_tl { (#5) }
1733 }
1734 }
1735
1736 \tl_put_right:Nn \l_tzline_cmd_tl
1737 { node [ #7 ] { #6 } }
1738 % add at begin/end
1739 \bool_if:NT \g_tzline_BEGIN_cmd_bool
1740 { \tl_put_left:Nx \l_tzline_cmd_tl { \g_tzline_BEGIN_cmd_tl } }
1741 \bool_if:NT \g_tzline_END_cmd_bool
1742 { \tl_put_right:Nx \l_tzline_cmd_tl { \g_tzline_END_cmd_tl } }
1743
1744 % final action
1745 \tl_put_left:No \l_tzline_cmd_tl
1746 {
1747 \l_tzline_opt_tl ] % expand `once'
1748 }
1749
1750 \tl_put_left:Nx \l_tzline_cmd_tl
1751 { [ \l_tzline_namepath_tl , }
1752
1753 \exp_last_unbraced:Nf \draw \l_tzline_cmd_tl #8 ;
1754
1755 \bool_gset_false:N \g_tzline_BEGIN_cmd_bool
1756 \bool_gset_false:N \g_tzline_END_cmd_bool
1757 % \tl_clear:N \g_tzline_BEGIN_cmd_tl
1758 % \tl_clear:N \g_tzline_END_cmd_tl
1759 }
1760
1761 %%% --- end of \tzline
1762
1763
1764 %%% \tzlines
1765
1766 \bool_new:N \g_tzlines_BEGIN_cmd_bool
1767 \bool_new:N \g_tzlines_END_cmd_bool
1768 \bool_new:N \l_tzlines_shift_coor_bool
1769
1770 %% \tzlinesAtBegin
1771 \NewDocumentCommand\tzlinesAtBegin{ m }
1772 {
1773 \bool_gset_true:N \g_tzlines_BEGIN_cmd_bool
1774 \tl_gset:No \g_tzlines_BEGIN_cmd_tl { #1 }
1775 }
1776
1777 %% \tzlinesAtEnd
1778 \NewDocumentCommand\tzlinesAtEnd{ m }
1779 {
1780 \bool_gset_true:N \g_tzlines_END_cmd_bool
1781 \tl_gset:No \g_tzlines_END_cmd_tl { #1 }
1782 }
1783
1784 %%% \tzlines (main)
1785 %% do not use: inner sep=0pt
1786 \NewDocumentCommand\tzlines{ s t+ O{} d<> D""{} }
1787 {
1788 \tl_clear:N \l_tzlines_cmd_tl
1789 \tl_clear:N \l_tzlines_STYLE_tl
1790
1791 \IfBooleanTF { #1 } % (*) or not (NOT USED!)
1792 { \bool_set_true:N \l_tmpa_bool }
1793 { \bool_set_false:N \l_tmpa_bool }
1794
1795 \IfBooleanTF { #2 } % (+) or not
1796 { \bool_set_true:N \l_tmpb_bool }
1797 { \bool_set_false:N \l_tmpb_bool }
1798
1799 \IfValueTF { #4 }
1800 {
1801 \tl_set:Nn \l_tzlines_shift_coor_tl { #4 }
1802 \bool_set_true:N \l_tzlines_shift_coor_bool
1803 }
1804 {
1805 \tl_clear:N \l_tzlines_shift_coor_tl
1806 \bool_set_false:N \l_tzlines_shift_coor_bool
1807 }
1808
1809 \IfValueTF { #3 }
1810 { \tl_set:Nn \l_tzlines_opt_tl { #3 } }
1811 { \tl_clear:N \l_tzlines_opt_tl }
1812
1813 \IfValueTF { #5 }
1814 { \tl_set:Nn \l_tzlines_namepath_tl { name~path = #5 } }
1815 { \tl_clear:N \l_tzlines_namepath_tl }
1816
1817 \int_zero:N \l_tmpa_int
1818 \tzlines_check_token:n
1819 }
1820
1821 \cs_new:Npn \tzlines_check_token:n #1
1822 {
1823 % \token_if_eq_charcode:NNTF #1 (
1824 % { \tzlines_sub_fn #1 }
1825 % { \tzlines_stop_action }
1826 \str_case:nnF { #1 }
1827 {
1828 { ( } { \tzlines_sub_fn #1 }
1829 { ; } { \tzlines_late_opt_fn }
1830 }
1831 {
1832 % \tzlines_stop_action
1833 \msg_error:nn { tzplot } { semicolon-error }
1834 }
1835 }
1836
1837 \NewDocumentCommand\tzlines_sub_fn{ r() +G{} O{} d<> }
1838 {
1839 \int_incr:N \l_tmpa_int
1840 % (from the second round) put line STYLE before the next cmd-tl
1841 \int_compare:nT { \l_tmpa_int > 1 }
1842 {
1843 \tl_put_right:No \l_tzlines_cmd_tl { \l_tzlines_STYLE_tl }
1844 \tl_clear:N \l_tzlines_STYLE_tl
1845 }
1846
1847 % collect cmd-tl
1848 \bool_if:NTF \l_tzlines_shift_coor_bool
1849 {% shift-coor
1850 \bool_if:NTF \l_tmpb_bool
1851 {% if ++
1852 \int_compare:nTF { \l_tmpa_int > 1 }
1853 { \tl_put_right:Nn \l_tzlines_cmd_tl { (#1) } } % no shift from 2nd
1854 {
1855 \tl_put_right:Nx \l_tzlines_cmd_tl
1856 { ([ shift = { (\l_tzlines_shift_coor_tl) } ]#1) } % shift first
1857 }
1858 }
1859 {% no ++
1860 \tl_put_right:Nx \l_tzlines_cmd_tl
1861 { ([ shift = { (\l_tzlines_shift_coor_tl) } ]#1) } % shift all coors
1862 }
1863 }
1864 { \tl_put_right:Nn \l_tzlines_cmd_tl { (#1) } } % no shift (normal)
1865
1866 % (from the first round on) determine and save STYLE
1867 % determine connect line STYLE
1868 \tl_set:Nn \l_tzlines_STYLE_A_tl { -- }
1869 % save node info (for later use, at the end)
1870 \tl_set:Nn \l_tzlines_STYLE_B_tl { ~ node [ #3 ] { #2 } }
1871 \IfValueTF { #4 }
1872 {
1873 \tl_set:Nn \l_tzlines_STYLE_C_tl { #4 } % empty, + , or ++
1874 }
1875 {
1876 \bool_if:NTF \l_tmpb_bool
1877 { \tl_set:Nn \l_tzlines_STYLE_C_tl { ++ } }
1878 { \tl_set:Nn \l_tzlines_STYLE_C_tl { } }
1879 }
1880
1881 \tl_put_right:No \l_tzlines_STYLE_tl { \l_tzlines_STYLE_A_tl }
1882 \tl_put_right:No \l_tzlines_STYLE_tl { \l_tzlines_STYLE_B_tl }
1883 \tl_put_right:No \l_tzlines_STYLE_tl { \l_tzlines_STYLE_C_tl }
1884
1885 \tzlines_check_token:n
1886 }
1887
1888 \NewDocumentCommand\tzlines_late_opt_fn { D<>{} }
1889 {
1890 \tl_set:Nn \l_tzlines_code_at_end_tl { #1 }
1891 \tzlines_stop_action
1892 }
1893
1894 \NewDocumentCommand\tzlines_stop_action {}
1895 {
1896 \tl_put_right:No \l_tzlines_cmd_tl { \l_tzlines_STYLE_B_tl }
1897 \tl_clear:N \l_tzlines_STYLE_tl
1898 % add at begin/end
1899 \bool_if:NT \g_tzlines_BEGIN_cmd_bool
1900 { \tl_put_left:Nx \l_tzlines_cmd_tl { \g_tzlines_BEGIN_cmd_tl } }
1901 \bool_if:NT \g_tzlines_END_cmd_bool
1902 { \tl_put_right:Nx \l_tzlines_cmd_tl { \g_tzlines_END_cmd_tl } }
1903 % gathering options
1904 \tl_put_left:No \l_tzlines_cmd_tl
1905 {
1906 \l_tzlines_opt_tl ] % expand `once' needed
1907 }
1908 \tl_put_left:Nx \l_tzlines_cmd_tl
1909 { [ \l_tzlines_namepath_tl , }
1910 % final action
1911 \exp_last_unbraced:Nf
1912 \draw \l_tzlines_cmd_tl \l_tzlines_code_at_end_tl ;
1913
1914 \bool_gset_false:N \g_tzlines_BEGIN_cmd_bool
1915 \bool_gset_false:N \g_tzlines_END_cmd_bool
1916 % \tl_clear:N \g_tzlines_BEGIN_cmd_tl
1917 % \tl_clear:N \g_tzlines_END_cmd_tl
1918 }
1919
1920 %%% --- end of \tzlines
1921
1922
1923 %%% \tzpolygon (closed path of \tzlines)
1924
1925 \bool_new:N \l_tzpolygon_shift_coor_bool
1926
1927 %%% \tzpolygon (main)
1928 %% do not use: inner sep=0pt
1929 \NewDocumentCommand\tzpolygon{ s t+ O{} d<> D""{} }
1930 {
1931 \tl_clear:N \l_tzpolygon_cmd_tl
1932 \tl_clear:N \l_tzpolygon_STYLE_tl
1933
1934 \IfBooleanTF { #1 } % fill(*) or not
1935 { \bool_set_true:N \l_tmpa_bool }
1936 { \bool_set_false:N \l_tmpa_bool }
1937
1938 \IfBooleanTF { #2 } % (+) or not
1939 { \bool_set_true:N \l_tmpb_bool }
1940 { \bool_set_false:N \l_tmpb_bool }
1941
1942 \IfValueTF { #4 }
1943 {
1944 \tl_set:Nn \l_tzpolygon_shift_coor_tl { #4 }
1945 \bool_set_true:N \l_tzpolygon_shift_coor_bool
1946 }
1947 {
1948 \tl_clear:N \l_tzpolygon_shift_coor_tl
1949 \bool_set_false:N \l_tzpolygon_shift_coor_bool
1950 }
1951
1952 \IfValueTF { #3 }
1953 { \tl_set:Nx \l_tzpolygon_opt_tl { #3 } }
1954 { \tl_clear:N \l_tzpolygon_opt_tl }
1955
1956 \IfValueTF { #5 }
1957 { \tl_set:Nn \l_tzpolygon_namepath_tl { name~path = #5 } }
1958 { \tl_clear:N \l_tzpolygon_namepath_tl }
1959
1960 \int_zero:N \l_tmpa_int
1961 \tzpolygon_check_token:n
1962 }
1963
1964 \cs_new:Npn \tzpolygon_check_token:n #1
1965 {
1966 % \token_if_eq_charcode:NNTF #1 (
1967 % { \tzpolygon_sub_fn #1 }
1968 % { \tzpolygon_stop_action }
1969 \str_case:nnF { #1 }
1970 {
1971 { ( } { \tzpolygon_sub_fn #1 }
1972 { ; } { \tzpolygon_late_opt_fn }
1973 }
1974 {
1975 % \tzpolygon_stop_action
1976 \msg_error:nn { tzplot } { semicolon-error }
1977 }
1978 }
1979
1980 \NewDocumentCommand\tzpolygon_sub_fn{ r() +G{} O{} d<> }
1981 {
1982 \int_incr:N \l_tmpa_int
1983 % (from the second round) put line STYLE before the next cmd-tl
1984 \int_compare:nT { \l_tmpa_int > 1 }
1985 {
1986 \tl_put_right:No \l_tzpolygon_cmd_tl { \l_tzpolygon_STYLE_tl }
1987 \tl_clear:N \l_tzpolygon_STYLE_tl
1988 }
1989
1990 % collect cmd-tl
1991 \bool_if:NTF \l_tzpolygon_shift_coor_bool
1992 {% shift-coor
1993 \bool_if:NTF \l_tmpb_bool
1994 {% if ++
1995 \int_compare:nTF { \l_tmpa_int > 1 }
1996 { \tl_put_right:Nn \l_tzpolygon_cmd_tl { (#1) } } % no shift from 2nd
1997 {
1998 \tl_put_right:Nx \l_tzpolygon_cmd_tl
1999 { ([ shift = { (\l_tzpolygon_shift_coor_tl) } ]#1) } % shift first
2000 }
2001 }
2002 {% no ++
2003 \tl_put_right:Nx \l_tzpolygon_cmd_tl
2004 { ([ shift = { (\l_tzpolygon_shift_coor_tl) } ]#1) } % shift all coors
2005 }
2006 }
2007 { \tl_put_right:Nn \l_tzpolygon_cmd_tl { (#1) } } % no shift (normal)
2008
2009 % (from the first round on) determine and save STYLE
2010 % determine connect line STYLE
2011 \tl_set:Nn \l_tzpolygon_STYLE_A_tl { -- }
2012 % save node info (for later use, at the end)
2013 \tl_set:Nn \l_tzpolygon_STYLE_B_tl { ~ node [ #3 ] { #2 } }
2014 \IfValueTF { #4 }
2015 {
2016 \tl_set:Nn \l_tzpolygon_STYLE_C_tl { #4 } % empty, + , or ++
2017 }
2018 {
2019 \bool_if:NTF \l_tmpb_bool
2020 { \tl_set:Nn \l_tzpolygon_STYLE_C_tl { ++ } }
2021 { \tl_set:Nn \l_tzpolygon_STYLE_C_tl { } }
2022 }
2023
2024 \tl_put_right:No \l_tzpolygon_STYLE_tl { \l_tzpolygon_STYLE_A_tl }
2025 \tl_put_right:No \l_tzpolygon_STYLE_tl { \l_tzpolygon_STYLE_B_tl }
2026 \tl_put_right:No \l_tzpolygon_STYLE_tl { \l_tzpolygon_STYLE_C_tl }
2027
2028 \tzpolygon_check_token:n
2029 }
2030
2031 \NewDocumentCommand\tzpolygon_late_opt_fn { G{\tz@initial@fill@opacity} D<>{} }
2032 {
2033 \renewcommand\tzfillopacity{ #1 }
2034 \tl_set:Nn \l_tzpolygon_code_at_end_tl { #2 }
2035 \tzpolygon_stop_action
2036 }
2037
2038 \NewDocumentCommand\tzpolygon_stop_action {}
2039 {
2040 \tl_put_right:No \l_tzpolygon_cmd_tl { \l_tzpolygon_STYLE_B_tl }
2041 \tl_clear:N \l_tzpolygon_STYLE_tl
2042 % fill or not
2043 \tl_put_left:No \l_tzpolygon_cmd_tl
2044 {
2045 \l_tzpolygon_opt_tl ] % expand `once' needed
2046 }
2047 \bool_if:NTF \l_tmpa_bool
2048 {
2049 \tl_put_left:Nx \l_tzpolygon_cmd_tl
2050 {
2051 [ fill=\tzfillcolor , fill~opacity = \tzfillopacity ,
2052 text~opacity = 1 ,
2053 \l_tzpolygon_namepath_tl ,
2054 }
2055 }
2056 {
2057 \tl_put_left:Nx \l_tzpolygon_cmd_tl
2058 { [ \l_tzpolygon_namepath_tl , }
2059 }
2060 % final action
2061 \exp_last_unbraced:Nf
2062 \draw \l_tzpolygon_cmd_tl \l_tzpolygon_code_at_end_tl -- cycle ;
2063 }
2064
2065 %%% --- end of \tzpolygon
2066
2067 %%(ADDED)
2068 %%%%% Linking points
2069
2070 %%% \tzlink (general version of \tzline)
2071
2072 \bool_new:N \g_tzlink_BEGIN_cmd_bool
2073 \bool_new:N \g_tzlink_END_cmd_bool
2074 \bool_new:N \l_tzlink_shift_coor_bool
2075
2076 %% \tzlinkAtBegin
2077 \NewDocumentCommand\tzlinkAtBegin{ m }
2078 {
2079 \bool_gset_true:N \g_tzlink_BEGIN_cmd_bool
2080 \tl_gset:No \g_tzlink_BEGIN_cmd_tl { #1 }
2081 }
2082
2083 %% \tzlinkAtEnd
2084 \NewDocumentCommand\tzlinkAtEnd{ m }
2085 {
2086 \bool_gset_true:N \g_tzlink_END_cmd_bool
2087 \tl_gset:No \g_tzlink_END_cmd_tl { #1 }
2088 }
2089
2090 %%% \tzlink (main)
2091 \NewDocumentCommand\tzlink{ s t+ G{\tz@initial@link@style} o d<> d"" }
2092 {
2093 \tl_clear:N \l_tzlink_cmd_tl
2094
2095 \renewcommand\tzlinkstyle{ #3 }
2096
2097 \IfBooleanTF { #1 } % (*) or not (NOT USED!)
2098 { \bool_set_true:N \l_tmpa_bool }
2099 { \bool_set_false:N \l_tmpa_bool }
2100
2101 \IfBooleanTF { #2 } % (+) or not
2102 { \bool_set_true:N \l_tmpb_bool }
2103 { \bool_set_false:N \l_tmpb_bool }
2104
2105 \IfValueTF { #5 }
2106 {
2107 \tl_set:Nn \l_tzlink_shift_coor_tl { #5 }
2108 \bool_set_true:N \l_tzlink_shift_coor_bool
2109 }
2110 {
2111 \tl_clear:N \l_tzlink_shift_coor_tl
2112 \bool_set_false:N \l_tzlink_shift_coor_bool
2113 }
2114
2115 \IfValueTF { #4 }
2116 { \tl_set:Nn \l_tzlink_opt_tl { #4 } }
2117 { \tl_clear:N \l_tzlink_opt_tl }
2118
2119
2120 \IfValueTF { #6 }
2121 { \tl_set:Nn \l_tzlink_namepath_tl { name~path = #6 } }
2122 { \tl_clear:N \l_tzlink_namepath_tl }
2123
2124 \tzlink_check_token:n
2125 }
2126
2127 \cs_new:Npn \tzlink_check_token:n #1
2128 {
2129 \str_if_eq:nnT { #1 } { ( }
2130 { \tzlink_sub_fn ( }
2131 % \tzlink_stop_action
2132 }
2133
2134 \NewDocumentCommand\tzlink_sub_fn{ r() O{} +G{} O{} d<> r() +G{} O{} D<>{} }
2135 {
2136 % determine connect line STYLE
2137 \tl_if_empty:nTF { #2 }
2138 {
2139 \tl_set:Nn \l_tzlink_STYLE_A_tl { ~ \tzlinkstyle ~ }
2140 }
2141 {
2142 \tl_set:Nn \l_tzlink_STYLE_A_tl { ~ #2 ~ }
2143 }
2144 \IfValueTF { #5 }
2145 {
2146 \tl_set:Nn \l_tzlink_STYLE_C_tl { #5 } % + or ++
2147 }
2148 {
2149 \bool_if:NTF \l_tmpb_bool
2150 { \tl_set:Nn \l_tzlink_STYLE_C_tl { ++ } }
2151 { \tl_set:Nn \l_tzlink_STYLE_C_tl { } }
2152 }
2153 % insert connect line STYLE
2154 \bool_if:NTF \l_tzlink_shift_coor_bool
2155 {
2156 \tl_put_right:Nx \l_tzlink_cmd_tl
2157 { ([ shift = { (\l_tzlink_shift_coor_tl) } ]#1) }
2158 }
2159 { \tl_put_right:Nn \l_tzlink_cmd_tl { (#1) } }
2160
2161 \tl_put_right:No \l_tzlink_cmd_tl % once
2162 {
2163 \l_tzlink_STYLE_A_tl
2164 }
2165 \tl_put_right:Nn \l_tzlink_cmd_tl
2166 {
2167 ~ node [ above , #4 ] { #3 } % above
2168 }
2169 \tl_put_right:No \l_tzlink_cmd_tl % once
2170 {
2171 \l_tzlink_STYLE_C_tl
2172 }
2173 \bool_if:NTF \l_tmpb_bool
2174 {% if ++
2175 \tl_put_right:Nn \l_tzlink_cmd_tl { (#6) }
2176 }
2177 {% no ++
2178 \bool_if:NTF \l_tzlink_shift_coor_bool
2179 {% if shift
2180 \tl_put_right:Nx \l_tzlink_cmd_tl
2181 { ( [ shift = { (\l_tzlink_shift_coor_tl) } ] \exp_not:n { #6 } ) }
2182 }
2183 { \tl_put_right:Nn \l_tzlink_cmd_tl { (#6) } }
2184 }
2185
2186 \tl_put_right:Nn \l_tzlink_cmd_tl
2187 {
2188 node [ #8 ] { #7 }
2189 }
2190 % add at begin/end
2191 \bool_if:NT \g_tzlink_BEGIN_cmd_bool
2192 { \tl_put_left:Nx \l_tzlink_cmd_tl { \g_tzlink_BEGIN_cmd_tl } }
2193 \bool_if:NT \g_tzlink_END_cmd_bool
2194 { \tl_put_right:Nx \l_tzlink_cmd_tl { \g_tzlink_END_cmd_tl } }
2195
2196 % final action
2197 \tl_put_left:No \l_tzlink_cmd_tl
2198 {
2199 \l_tzlink_opt_tl ] % expand `once' needed
2200 }
2201
2202 \tl_put_left:Nx \l_tzlink_cmd_tl
2203 { [ \l_tzlink_namepath_tl , }
2204
2205 \exp_last_unbraced:Nf \draw \l_tzlink_cmd_tl #9 ;
2206
2207 \bool_gset_false:N \g_tzlink_BEGIN_cmd_bool
2208 \bool_gset_false:N \g_tzlink_END_cmd_bool
2209 % \tl_clear:N \g_tzlink_BEGIN_cmd_tl
2210 % \tl_clear:N \g_tzlink_END_cmd_tl
2211 }
2212
2213 %%% --- end of \tzlink
2214
2215
2216
2217
2218 %%%(ADDED)
2219 %%% \tzlinks -- generalized version of \tzlines
2220
2221 \bool_new:N \g_tzlinks_BEGIN_cmd_bool
2222 \bool_new:N \g_tzlinks_END_cmd_bool
2223 \bool_new:N \l_tzlinks_shift_coor_bool
2224
2225 %% \tzlinksAtBegin
2226 \NewDocumentCommand\tzlinksAtBegin{ m }
2227 {
2228 \bool_gset_true:N \g_tzlinks_BEGIN_cmd_bool
2229 \tl_gset:No \g_tzlinks_BEGIN_cmd_tl { #1 }
2230 }
2231
2232 %% \tzlinksAtEnd
2233 \NewDocumentCommand\tzlinksAtEnd{ m }
2234 {
2235 \bool_gset_true:N \g_tzlinks_END_cmd_bool
2236 \tl_gset:No \g_tzlinks_END_cmd_tl { #1 }
2237 }
2238
2239 %%% \tzlinks (main)
2240 %% do not use: inner sep=0pt
2241 \NewDocumentCommand\tzlinks{ s t+ G{\tz@initial@link@style} O{} d<> D""{} }
2242 {
2243 \tl_clear:N \l_tzlinks_cmd_tl
2244 \tl_clear:N \l_tzlinks_STYLE_tl
2245
2246 \IfValueT { #3 }
2247 { \renewcommand\tzlinkstyle{ #3 } }
2248
2249 \IfBooleanTF { #1 } % (*) or not
2250 { \bool_set_true:N \l_tmpa_bool }
2251 { \bool_set_false:N \l_tmpa_bool }
2252
2253 \IfBooleanTF { #2 } % (+) or not
2254 { \bool_set_true:N \l_tmpb_bool }
2255 { \bool_set_false:N \l_tmpb_bool }
2256
2257 \IfValueTF { #5 }
2258 {
2259 \tl_set:Nn \l_tzlinks_shift_coor_tl { #5 }
2260 \bool_set_true:N \l_tzlinks_shift_coor_bool
2261 }
2262 {
2263 \tl_clear:N \l_tzlinks_shift_coor_tl
2264 \bool_set_false:N \l_tzlinks_shift_coor_bool
2265 }
2266
2267 \IfValueTF { #4 }
2268 { \tl_set:Nx \l_tzlinks_opt_tl { #4 } }
2269 { \tl_clear:N \l_tzlinks_opt_tl }
2270
2271 \IfValueTF { #6 }
2272 { \tl_set:Nn \l_tzlinks_namepath_tl { name~path = #6 } }
2273 { \tl_clear:N \l_tzlinks_namepath_tl }
2274
2275 \int_zero:N \l_tmpa_int
2276 \tzlinks_check_token:n
2277 }
2278
2279 \cs_new:Npn \tzlinks_check_token:n #1
2280 {
2281 % \token_if_eq_charcode:NNTF #1 (
2282 % { \tzlinks_sub_fn #1 }
2283 % { \tzlinks_stop_action }
2284 \str_case:nnF { #1 }
2285 {
2286 { ( } { \tzlinks_sub_fn #1 }
2287 { ; } { \tzlinks_late_opt_fn }
2288 }
2289 {
2290 % \tzlinks_stop_action
2291 \msg_error:nn { tzplot } { semicolon-error }
2292 }
2293 }
2294
2295 \NewDocumentCommand\tzlinks_sub_fn{ r() O{} +G{} O{} d<> }
2296 {
2297 \int_incr:N \l_tmpa_int
2298 % (from the second round) put line STYLE before the next cmd-tl
2299 \int_compare:nT { \l_tmpa_int > 1 }
2300 {
2301 \tl_put_right:No \l_tzlinks_cmd_tl { \l_tzlinks_STYLE_tl }
2302 \tl_clear:N \l_tzlinks_STYLE_tl
2303 }
2304
2305 % collect cmd-tl
2306 \bool_if:NTF \l_tzlinks_shift_coor_bool
2307 {% shift-coor
2308 \bool_if:NTF \l_tmpb_bool
2309 {% if ++
2310 \int_compare:nTF { \l_tmpa_int > 1 }
2311 { \tl_put_right:Nn \l_tzlinks_cmd_tl { (#1) } } % no shift from 2nd
2312 {
2313 \tl_put_right:Nx \l_tzlinks_cmd_tl
2314 { ([ shift = { (\l_tzlinks_shift_coor_tl) } ]#1) } % shift first
2315 }
2316 }
2317 {% no ++
2318 \tl_put_right:Nx \l_tzlinks_cmd_tl
2319 { ([ shift = { (\l_tzlinks_shift_coor_tl) } ]#1) } % shift all coors
2320 }
2321 }
2322 { \tl_put_right:Nn \l_tzlinks_cmd_tl { (#1) } } % no shift (normal)
2323
2324 % (from the first round on) determine and save STYLE
2325 % determine connect line STYLE
2326 \tl_if_empty:nTF { #2 }
2327 { \tl_set:Nn \l_tzlinks_STYLE_A_tl { ~ \tzlinkstyle ~ } }
2328 { \tl_set:Nn \l_tzlinks_STYLE_A_tl { #2 } }
2329 % save node info (for later use, at the end)
2330 \tl_if_empty:nTF { #3 }
2331 {
2332 \tl_clear:N \l_tzlinks_STYLE_B_tl
2333 }
2334 {
2335 \tl_set:Nn \l_tzlinks_STYLE_B_tl
2336 { ~ node [ #4 ] { #3 } }
2337 }
2338 \IfValueTF { #5 } % <+ or ++ or none> (NOT USED!)
2339 {
2340 \tl_set:Nn \l_tzlinks_STYLE_C_tl { #5 }
2341 }
2342 {
2343 \bool_if:NTF \l_tmpb_bool
2344 { \tl_set:Nn \l_tzlinks_STYLE_C_tl { ++ } }
2345 { \tl_set:Nn \l_tzlinks_STYLE_C_tl { } }
2346 }
2347
2348 \tl_put_right:No \l_tzlinks_STYLE_tl { \l_tzlinks_STYLE_A_tl }
2349 \tl_put_right:No \l_tzlinks_STYLE_tl { \l_tzlinks_STYLE_B_tl }
2350 \tl_put_right:No \l_tzlinks_STYLE_tl { \l_tzlinks_STYLE_C_tl }
2351
2352 \tzlinks_check_token:n
2353 }
2354
2355 \NewDocumentCommand\tzlinks_late_opt_fn { G{\tz@initial@fill@opacity} D<>{} }
2356 {
2357 \renewcommand\tzfillopacity{ #1 }
2358 \tl_set:Nn \l_tzlinks_code_at_end_tl { #2 }
2359 \tzlinks_stop_action
2360 }
2361
2362 \NewDocumentCommand\tzlinks_stop_action {}
2363 {
2364 \tl_if_empty:NF \l_tzlinks_STYLE_B_tl
2365 {
2366 \tl_put_right:No \l_tzlinks_cmd_tl { \l_tzlinks_STYLE_B_tl }
2367 }
2368 \tl_clear:N \l_tzlinks_STYLE_tl
2369 %% add at begin/end
2370 \bool_if:NT \g_tzlinks_BEGIN_cmd_bool
2371 { \tl_put_left:Nx \l_tzlinks_cmd_tl { \g_tzlinks_BEGIN_cmd_tl } }
2372 \bool_if:NT \g_tzlinks_END_cmd_bool
2373 { \tl_put_right:Nx \l_tzlinks_cmd_tl { \g_tzlinks_END_cmd_tl } }
2374 %% collect options
2375 \tl_put_left:No \l_tzlinks_cmd_tl
2376 { \l_tzlinks_opt_tl ] } % expand `once' needed
2377 % * or not
2378 \bool_if:NTF \l_tmpa_bool
2379 {
2380 \tl_put_left:Nx \l_tzlinks_cmd_tl
2381 {
2382 [ fill=\tzfillcolor , fill~opacity = \tzfillopacity ,
2383 text~opacity = 1 ,
2384 \l_tzlinks_namepath_tl ,
2385 }
2386 }
2387 {
2388 \tl_put_left:Nx \l_tzlinks_cmd_tl
2389 { [ \l_tzlinks_namepath_tl , }
2390 }
2391 %% final action
2392 % \begin{pgfonlayer}{\tzlinklayer} % default tzlinklayer = main
2393 \exp_last_unbraced:Nf
2394 \draw \l_tzlinks_cmd_tl \l_tzlinks_code_at_end_tl ; %% draw (\tzlinks)
2395 % \end{pgfonlayer}
2396
2397 \bool_gset_false:N \g_tzlinks_BEGIN_cmd_bool
2398 \bool_gset_false:N \g_tzlinks_END_cmd_bool
2399 }
2400
2401 %%% --- end of \tzlinks
2402
2403
2404
2405 %%% \tzpath
2406 %% draw=none version of \tzlinks (mainly for filling area)
2407
2408 \bool_new:N \g_tzfnArea_call_bool
2409
2410 \bool_new:N \g_tzpath_BEGIN_cmd_bool
2411 \bool_new:N \g_tzpath_END_cmd_bool
2412 \bool_new:N \l_tzpath_shift_coor_bool
2413
2414
2415 %% \tzpathAtBegin
2416 \NewDocumentCommand\tzpathAtBegin{ m }
2417 {
2418 \bool_gset_true:N \g_tzpath_BEGIN_cmd_bool
2419 \tl_gset:No \g_tzpath_BEGIN_cmd_tl { #1 }
2420 }
2421
2422 %% \tzpathAtEnd
2423 \NewDocumentCommand\tzpathAtEnd{ m }
2424 {
2425 \bool_gset_true:N \g_tzpath_END_cmd_bool
2426 \tl_gset:No \g_tzpath_END_cmd_tl { #1 }
2427 }
2428
2429 %%% \tzpath (main)
2430 %% do not use: inner sep=0pt
2431 \NewDocumentCommand\tzpath{ s t+ G{\tz@initial@link@style} O{} d<> D""{} }
2432 {
2433 \tl_clear:N \l_tzpath_cmd_tl
2434 \tl_clear:N \l_tzpath_STYLE_tl
2435
2436 \IfValueT { #3 }
2437 { \renewcommand\tzpathstyle{ #3 } }
2438
2439 \IfBooleanTF { #1 } % (*) or not
2440 { \bool_set_true:N \l_tmpa_bool }
2441 { \bool_set_false:N \l_tmpa_bool }
2442
2443 \IfBooleanTF { #2 } % (+) or not
2444 { \bool_set_true:N \l_tmpb_bool }
2445 { \bool_set_false:N \l_tmpb_bool }
2446
2447 \IfValueTF { #5 }
2448 {
2449 \tl_set:Nn \l_tzpath_shift_coor_tl { #5 }
2450 \bool_set_true:N \l_tzpath_shift_coor_bool
2451 }
2452 {
2453 \tl_clear:N \l_tzpath_shift_coor_tl
2454 \bool_set_false:N \l_tzpath_shift_coor_bool
2455 }
2456
2457 \IfValueTF { #4 }
2458 { \tl_set:Nx \l_tzpath_opt_tl { #4 } }
2459 { \tl_clear:N \l_tzpath_opt_tl }
2460
2461 \IfValueTF { #6 }
2462 { \tl_set:Nn \l_tzpath_namepath_tl { name~path = #6 } }
2463 { \tl_clear:N \l_tzpath_namepath_tl }
2464
2465 \int_zero:N \l_tmpa_int
2466 \tzpath_check_token:n
2467 }
2468
2469 \cs_new:Npn \tzpath_check_token:n #1
2470 {
2471 % \token_if_eq_charcode:NNTF #1 (
2472 % { \tzpath_sub_fn #1 }
2473 % { \tzpath_stop_action }
2474 \str_case:nnF { #1 }
2475 {
2476 { ( } { \tzpath_sub_fn #1 }
2477 { ; } { \tzpath_late_opt_fn }
2478 }
2479 {
2480 % \tzpath_stop_action
2481 \msg_error:nn { tzplot } { semicolon-error }
2482 }
2483 }
2484
2485 \NewDocumentCommand\tzpath_sub_fn{ r() O{} +G{} O{} d<> }
2486 {
2487 \int_incr:N \l_tmpa_int
2488 % (from the second round) put line STYLE before the next cmd-tl
2489 \int_compare:nT { \l_tmpa_int > 1 }
2490 {
2491 \tl_put_right:No \l_tzpath_cmd_tl { \l_tzpath_STYLE_tl }
2492 \tl_clear:N \l_tzpath_STYLE_tl
2493 }
2494
2495 % collect cmd-tl
2496 \bool_if:NTF \l_tzpath_shift_coor_bool
2497 {% shift-coor
2498 \bool_if:NTF \l_tmpb_bool
2499 {% if ++
2500 \int_compare:nTF { \l_tmpa_int > 1 }
2501 { \tl_put_right:Nn \l_tzpath_cmd_tl { (#1) } } % no shift from 2nd
2502 {
2503 \tl_put_right:Nx \l_tzpath_cmd_tl
2504 { ( [ shift = { (\l_tzpath_shift_coor_tl) } ] #1 ) } % shift first
2505 }
2506 }
2507 {% no ++
2508 \tl_put_right:Nx \l_tzpath_cmd_tl
2509 { ( [ shift = { (\l_tzpath_shift_coor_tl) } ] #1 ) } % shift all coors
2510 }
2511 }
2512 { \tl_put_right:Nn \l_tzpath_cmd_tl { (#1) } } % no shift (normal)
2513
2514 % (from the first round on) determine and save STYLE
2515 % determine connect line STYLE
2516 \tl_if_empty:nTF { #2 }
2517 { \tl_set:Nn \l_tzpath_STYLE_A_tl { ~ \tzpathstyle ~ } }
2518 { \tl_set:Nn \l_tzpath_STYLE_A_tl { #2 } }
2519 % save node info (for later use, at the end)
2520 \tl_if_empty:nTF { #3 }
2521 {
2522 \tl_clear:N \l_tzpath_STYLE_B_tl
2523 }
2524 {
2525 \tl_set:Nn \l_tzpath_STYLE_B_tl
2526 { ~ node [ #4 ] { #3 } }
2527 }
2528 \IfValueTF { #5 } % <+ or ++ or none> (NOT USED!)
2529 {
2530 \tl_set:Nn \l_tzpath_STYLE_C_tl { #5 }
2531 }
2532 {
2533 \bool_if:NTF \l_tmpb_bool
2534 { \tl_set:Nn \l_tzpath_STYLE_C_tl { ++ } }
2535 { \tl_set:Nn \l_tzpath_STYLE_C_tl { } }
2536 }
2537
2538 \tl_put_right:No \l_tzpath_STYLE_tl { \l_tzpath_STYLE_A_tl }
2539 \tl_put_right:No \l_tzpath_STYLE_tl { \l_tzpath_STYLE_B_tl }
2540 \tl_put_right:No \l_tzpath_STYLE_tl { \l_tzpath_STYLE_C_tl }
2541
2542 \tzpath_check_token:n
2543 }
2544
2545 % \tzpath fill opacity : 0.3 (default) % differ from \tzlinks
2546 \NewDocumentCommand\tzpath_late_opt_fn { G{\tz@initial@fill@opacity} D<>{} }
2547 {
2548 \renewcommand\tzfillopacity{ #1 }
2549 \tl_set:Nn \l_tzpath_code_at_end_tl { #2 }
2550 \tzpath_stop_action
2551 }
2552
2553 \NewDocumentCommand\tzpath_stop_action {}
2554 {
2555 \tl_if_empty:NF \l_tzpath_STYLE_B_tl
2556 {
2557 \tl_put_right:No \l_tzpath_cmd_tl { \l_tzpath_STYLE_B_tl }
2558 }
2559 \tl_clear:N \l_tzpath_STYLE_tl
2560 %% add at begin/end
2561 \bool_if:NT \g_tzpath_BEGIN_cmd_bool
2562 { \tl_put_left:Nx \l_tzpath_cmd_tl { \g_tzpath_BEGIN_cmd_tl } }
2563 \bool_if:NT \g_tzpath_END_cmd_bool
2564 { \tl_put_right:Nx \l_tzpath_cmd_tl { \g_tzpath_END_cmd_tl } }
2565 %% collect options
2566 \tl_put_left:No \l_tzpath_cmd_tl
2567 { \l_tzpath_opt_tl ] } % expand `once' needed
2568 % * or not
2569 \bool_if:NTF \l_tmpa_bool
2570 {
2571 \tl_put_left:Nx \l_tzpath_cmd_tl
2572 {
2573 [ fill=\tzfillcolor , fill~opacity = \tzfillopacity ,
2574 text~opacity = 1 ,
2575 \l_tzpath_namepath_tl ,
2576 }
2577 }
2578 {
2579 \tl_put_left:Nx \l_tzpath_cmd_tl
2580 { [ \l_tzpath_namepath_tl , }
2581 }
2582 %% final action
2583 \bool_if:NTF \g_tzfnArea_call_bool
2584 { % (ADDED) for \tzfnArealayer
2585 \begin{pgfonlayer}{\tzfnArealayer} % default tzpathlayer = main
2586 \exp_last_unbraced:Nf
2587 \path \l_tzpath_cmd_tl \l_tzpath_code_at_end_tl ; %% path (\tzpath)
2588 \end{pgfonlayer}
2589 }
2590 { % for original \tzpath
2591 \begin{pgfonlayer}{\tzpathlayer} % default tzpathlayer = main
2592 \exp_last_unbraced:Nf
2593 \path \l_tzpath_cmd_tl \l_tzpath_code_at_end_tl ; %% path (\tzpath)
2594 \end{pgfonlayer}
2595 }
2596 \bool_gset_false:N \g_tzpath_BEGIN_cmd_bool
2597 \bool_gset_false:N \g_tzpath_END_cmd_bool
2598 }
2599
2600 %%% --- end of \tzpath
2601
2602
2603 %%% \tzto
2604
2605 \bool_new:N \g_tzto_BEGIN_cmd_bool
2606 \bool_new:N \g_tzto_END_cmd_bool
2607 \bool_new:N \l_tzto_shift_coor_bool
2608
2609 %% \tztoAtBegin
2610 \NewDocumentCommand\tztoAtBegin{ m }
2611 {
2612 \bool_gset_true:N \g_tzto_BEGIN_cmd_bool
2613 \tl_gset:No \g_tzto_BEGIN_cmd_tl { #1 }
2614 }
2615
2616 %% \tztoAtEnd
2617 \NewDocumentCommand\tztoAtEnd{ m }
2618 {
2619 \bool_gset_true:N \g_tzto_END_cmd_bool
2620 \tl_gset:No \g_tzto_END_cmd_tl { #1 }
2621 }
2622
2623 %%% \tzto (main)
2624 \NewDocumentCommand\tzto{ s t+ o d<> d"" }
2625 {
2626 \tl_clear:N \l_tzto_cmd_tl
2627
2628 \IfBooleanTF { #1 } % (*) or not (NOT USED!)
2629 { \bool_set_true:N \l_tmpa_bool }
2630 { \bool_set_false:N \l_tmpa_bool }
2631
2632 \IfBooleanTF { #2 } % (+) or not
2633 { \bool_set_true:N \l_tmpb_bool }
2634 { \bool_set_false:N \l_tmpb_bool }
2635
2636 \IfValueTF { #4 }
2637 {
2638 \tl_set:Nn \l_tzto_shift_coor_tl { #4 }
2639 \bool_set_true:N \l_tzto_shift_coor_bool
2640 }
2641 {
2642 \tl_clear:N \l_tzto_shift_coor_tl
2643 \bool_set_false:N \l_tzto_shift_coor_bool
2644 }
2645
2646 \IfValueTF { #3 }
2647 { \tl_set:Nn \l_tzto_opt_tl { #3 } }
2648 { \tl_clear:N \l_tzto_opt_tl }
2649
2650 \IfValueTF { #5 }
2651 { \tl_set:Nn \l_tzto_namepath_tl { name~path = #5 } }
2652 { \tl_clear:N \l_tzto_namepath_tl }
2653
2654 \tzto_check_token:n
2655 }
2656
2657 \cs_new:Npn \tzto_check_token:n #1
2658 {
2659 \str_if_eq:nnT { #1 } { ( }
2660 { \tzto_sub_fn ( }
2661 % \tzto_stop_action
2662 }
2663
2664 \NewDocumentCommand\tzto_sub_fn{ r() +G{} O{} r() +G{} O{} D<>{} }
2665 {
2666
2667 \bool_if:NTF \l_tzto_shift_coor_bool
2668 {% if shift
2669 \tl_put_right:Nx \l_tzto_cmd_tl
2670 { ([ shift = { (\l_tzto_shift_coor_tl) } ]#1) }
2671 }
2672 { \tl_put_right:Nn \l_tzto_cmd_tl { (#1) } }
2673
2674 \tl_put_right:Nn \l_tzto_cmd_tl
2675 { to ~node [ above , #3 ] { #2 } }
2676
2677 \bool_if:NTF \l_tmpb_bool
2678 {% if ++
2679 \tl_put_right:Nn \l_tzto_cmd_tl { ++ (#4) }
2680 }
2681 {% no ++
2682 \bool_if:NTF \l_tzto_shift_coor_bool
2683 {% if shift
2684 \tl_put_right:Nx \l_tzto_cmd_tl
2685 { ([ shift = { (\l_tzto_shift_coor_tl) } ]#4) }
2686 }
2687 { \tl_put_right:Nn \l_tzto_cmd_tl { (#4) } }
2688 }
2689
2690 \tl_put_right:Nn \l_tzto_cmd_tl
2691 { node [ #6 ] { #5 } }
2692
2693 % add at begin/end
2694 \bool_if:NT \g_tzto_BEGIN_cmd_bool
2695 { \tl_put_left:Nx \l_tzto_cmd_tl { \g_tzto_BEGIN_cmd_tl } }
2696 \bool_if:NT \g_tzto_END_cmd_bool
2697 { \tl_put_right:Nx \l_tzto_cmd_tl { \g_tzto_END_cmd_tl } }
2698
2699 % final action
2700 \tl_put_left:No \l_tzto_cmd_tl
2701 {
2702 \l_tzto_opt_tl ] % expand `once' needed
2703 }
2704
2705 \tl_put_left:Nx \l_tzto_cmd_tl
2706 { [ \l_tzto_namepath_tl , }
2707
2708 \exp_last_unbraced:Nf \draw \l_tzto_cmd_tl #7 ;
2709
2710 \bool_gset_false:N \g_tzto_BEGIN_cmd_bool
2711 \bool_gset_false:N \g_tzto_END_cmd_bool
2712 % \tl_clear:N \g_tzto_BEGIN_cmd_tl
2713 % \tl_clear:N \g_tzto_END_cmd_tl
2714 }
2715
2716 %%% --- end of \tzto
2717
2718
2719 %%% \tztos (longer version of \tzto)
2720
2721 \bool_new:N \g_tztos_BEGIN_cmd_bool
2722 \bool_new:N \g_tztos_END_cmd_bool
2723 \bool_new:N \l_tztos_shift_coor_bool
2724
2725 %% \tztosAtBegin
2726 \NewDocumentCommand\tztosAtBegin{ m }
2727 {
2728 \bool_gset_true:N \g_tztos_BEGIN_cmd_bool
2729 \tl_gset:No \g_tztos_BEGIN_cmd_tl { #1 }
2730 }
2731
2732 %% \tztosAtEnd
2733 \NewDocumentCommand\tztosAtEnd{ m }
2734 {
2735 \bool_gset_true:N \g_tztos_END_cmd_bool
2736 \tl_gset:No \g_tztos_END_cmd_tl { #1 }
2737 }
2738
2739 %%% \tztos (main)
2740 %% do not use: inner sep=0pt
2741 \NewDocumentCommand\tztos{ s t+ O{} d<> D""{} }
2742 {
2743 \tl_clear:N \l_tztos_cmd_tl
2744 \tl_clear:N \l_tztos_STYLE_tl
2745
2746 % \IfValueT { #3 }
2747 % { \renewcommand\tztostyle{ #3 } }
2748
2749 \IfBooleanTF { #1 } % (*) or not (NOT USED!)
2750 { \bool_set_true:N \l_tmpa_bool }
2751 { \bool_set_false:N \l_tmpa_bool }
2752
2753 \IfBooleanTF { #2 } % (+) or not
2754 { \bool_set_true:N \l_tmpb_bool }
2755 { \bool_set_false:N \l_tmpb_bool }
2756
2757 \IfValueTF { #4 }
2758 {
2759 \tl_set:Nn \l_tztos_shift_coor_tl { #4 }
2760 \bool_set_true:N \l_tztos_shift_coor_bool
2761 }
2762 {
2763 \tl_clear:N \l_tztos_shift_coor_tl
2764 \bool_set_false:N \l_tztos_shift_coor_bool
2765 }
2766
2767 \IfValueTF { #3 }
2768 { \tl_set:Nn \l_tztos_opt_tl { #3 } }
2769 { \tl_clear:N \l_tztos_opt_tl }
2770
2771 \IfValueTF { #5 }
2772 { \tl_set:Nn \l_tztos_namepath_tl { name~path = #5 } }
2773 { \tl_clear:N \l_tztos_namepath_tl }
2774
2775 \int_zero:N \l_tmpa_int
2776 \tztos_check_token:n
2777 }
2778
2779 \cs_new:Npn \tztos_check_token:n #1
2780 {
2781 % \token_if_eq_charcode:NNTF #1 (
2782 % { \tztos_sub_fn #1 }
2783 % { \tztos_stop_action }
2784 \str_case:nnF { #1 }
2785 {
2786 { ( } { \tztos_sub_fn #1 }
2787 { ; } { \tztos_late_opt_fn }
2788 }
2789 {
2790 % \tztos_stop_action
2791 \msg_error:nn { tzplot } { semicolon-error }
2792 }
2793 }
2794
2795 %% (coor)[to opt]{text}[node opt]
2796 \NewDocumentCommand\tztos_sub_fn{ r() O{} +G{} O{} }
2797 {
2798 \int_incr:N \l_tmpa_int
2799 % (from the second round) put line STYLE before the next cmd-tl
2800 \int_compare:nT { \l_tmpa_int > 1 }
2801 {
2802 \tl_put_right:No \l_tztos_cmd_tl { \l_tztos_STYLE_tl }
2803 \tl_clear:N \l_tztos_STYLE_tl
2804 }
2805
2806 % collect cmd-tl
2807 \bool_if:NTF \l_tztos_shift_coor_bool
2808 {% shift-coor
2809 \bool_if:NTF \l_tmpb_bool
2810 {% if ++
2811 \int_compare:nTF { \l_tmpa_int > 1 }
2812 { \tl_put_right:Nn \l_tztos_cmd_tl { (#1) } } % no shift from 2nd
2813 {
2814 \tl_put_right:Nx \l_tztos_cmd_tl
2815 { ([ shift = { (\l_tztos_shift_coor_tl) } ]#1) } % shift first
2816 }
2817 }
2818 {% no ++
2819 \tl_put_right:Nx \l_tztos_cmd_tl
2820 { ([ shift = { (\l_tztos_shift_coor_tl) } ]#1) } % shift all coors
2821 }
2822 }
2823 { \tl_put_right:Nn \l_tztos_cmd_tl { (#1) } } % no shift (normal)
2824
2825 % (from the first round on) determine and save STYLE
2826 % determine connect line STYLE
2827 \tl_set:Nn \l_tztos_STYLE_A_tl { ~ to [ #2 ] }
2828 % save node info (for later use, at the end)
2829 \tl_if_empty:nTF { #3 }
2830 {
2831 \tl_clear:N \l_tztos_STYLE_B_tl
2832 }
2833 {
2834 \tl_set:Nn \l_tztos_STYLE_B_tl
2835 { ~ node [ #4 ] { #3 } }
2836 }
2837 \bool_if:NTF \l_tmpb_bool
2838 { \tl_set:Nn \l_tztos_STYLE_C_tl { ++ } }
2839 { \tl_set:Nn \l_tztos_STYLE_C_tl { } }
2840
2841 \tl_put_right:No \l_tztos_STYLE_tl { \l_tztos_STYLE_A_tl }
2842 \tl_put_right:No \l_tztos_STYLE_tl { \l_tztos_STYLE_B_tl }
2843 \tl_put_right:No \l_tztos_STYLE_tl { \l_tztos_STYLE_C_tl }
2844
2845 \tztos_check_token:n
2846 }
2847
2848 \NewDocumentCommand\tztos_late_opt_fn { D<>{} }
2849 {
2850 \tl_set:Nn \l_tztos_code_at_end_tl { #1 }
2851 \tztos_stop_action
2852 }
2853
2854 \NewDocumentCommand\tztos_stop_action {}
2855 {
2856 \tl_if_empty:NF \l_tztos_STYLE_B_tl
2857 {
2858 \tl_put_right:No \l_tztos_cmd_tl { \l_tztos_STYLE_B_tl }
2859 }
2860 \tl_clear:N \l_tztos_STYLE_tl
2861 % add at begin/end
2862 \bool_if:NT \g_tztos_BEGIN_cmd_bool
2863 { \tl_put_left:Nx \l_tztos_cmd_tl { \g_tztos_BEGIN_cmd_tl } }
2864 \bool_if:NT \g_tztos_END_cmd_bool
2865 { \tl_put_right:Nx \l_tztos_cmd_tl { \g_tztos_END_cmd_tl } }
2866 % fill or not
2867 \tl_put_left:No \l_tztos_cmd_tl
2868 {
2869 \l_tztos_opt_tl ] % expand `once' needed for user convenience
2870 }
2871 \tl_put_left:Nx \l_tztos_cmd_tl
2872 { [ \l_tztos_namepath_tl , }
2873 % final action
2874 \exp_last_unbraced:Nf
2875 \draw \l_tztos_cmd_tl \l_tztos_code_at_end_tl ; %% draw
2876
2877 \bool_gset_false:N \g_tztos_BEGIN_cmd_bool
2878 \bool_gset_false:N \g_tztos_END_cmd_bool
2879 % \tl_clear:N \g_tztos_BEGIN_cmd_tl
2880 % \tl_clear:N \g_tztos_END_cmd_tl
2881 }
2882
2883 %%% --- end of \tztos
2884
2885
2886 %%(ADDED)
2887 %%% \tzedge
2888
2889 \bool_new:N \l_tzedge_shift_coor_bool
2890
2891 %%% \tzedge (main)
2892 \NewDocumentCommand\tzedge{ s t+ o d<> }
2893 {
2894 \tl_clear:N \l_tzedge_cmd_tl
2895
2896 \IfBooleanTF { #1 } % (*) or not (NOT USED!)
2897 { \bool_set_true:N \l_tmpa_bool }
2898 { \bool_set_false:N \l_tmpa_bool }
2899
2900 \IfBooleanTF { #2 } % (+) or not
2901 { \bool_set_true:N \l_tmpb_bool }
2902 { \bool_set_false:N \l_tmpb_bool }
2903
2904 \IfValueTF { #4 }
2905 {
2906 \tl_set:Nn \l_tzedge_shift_coor_tl { #4 }
2907 \bool_set_true:N \l_tzedge_shift_coor_bool
2908 }
2909 {
2910 \tl_clear:N \l_tzedge_shift_coor_tl
2911 \bool_set_false:N \l_tzedge_shift_coor_bool
2912 }
2913
2914 \IfValueTF { #3 }
2915 { \tl_set:Nn \l_tzedge_opt_tl { #3 } }
2916 { \tl_clear:N \l_tzedge_opt_tl }
2917
2918 \tzedge_check_token:n
2919 }
2920
2921 \cs_new:Npn \tzedge_check_token:n #1
2922 {
2923 \str_if_eq:nnT { #1 } { ( }
2924 { \tzedge_sub_fn ( }
2925 % \tzedge_stop_action
2926 }
2927
2928 \NewDocumentCommand\tzedge_sub_fn{ r() +G{} O{} r() +G{} O{} D<>{} }
2929 {
2930 \bool_if:NTF \l_tzedge_shift_coor_bool
2931 {% if shift
2932 \tl_put_right:Nx \l_tzedge_cmd_tl
2933 { ([ shift = { (\l_tzedge_shift_coor_tl) } ]#1) }
2934 }
2935 { \tl_put_right:Nn \l_tzedge_cmd_tl { (#1) } }
2936
2937 \tl_put_right:Nn \l_tzedge_cmd_tl
2938 { edge [ }
2939 \tl_put_right:No \l_tzedge_cmd_tl
2940 { \l_tzedge_opt_tl ] } % expand `once' needed
2941 \tl_put_right:Nn \l_tzedge_cmd_tl
2942 { node [ #3 ] { #2 } }
2943
2944
2945 \bool_if:NTF \l_tmpb_bool
2946 {% if ++
2947 \tl_put_right:Nn \l_tzedge_cmd_tl { ++ (#4) ++ (#4) }
2948 }
2949 {% no ++
2950 \bool_if:NTF \l_tzedge_shift_coor_bool
2951 {% if shift
2952 \tl_put_right:Nx \l_tzedge_cmd_tl
2953 {
2954 ([ shift = { (\l_tzedge_shift_coor_tl) } ]#4)
2955 ([ shift = { (\l_tzedge_shift_coor_tl) } ]#4)
2956 }
2957 }
2958 { \tl_put_right:Nn \l_tzedge_cmd_tl { (#4) (#4) } }
2959 }
2960
2961 \tl_if_empty:nF { #5 }
2962 {
2963 \tl_put_right:Nn \l_tzedge_cmd_tl
2964 { node [ #6 ] { #5 } }
2965 }
2966
2967 % final action
2968 \exp_last_unbraced:Nf \draw \l_tzedge_cmd_tl #7 ;
2969 }
2970
2971 %%% --- end of \tzedge
2972
2973
2974 %%(ADDED)
2975 %%% \tzedges -- generalized version of \tzlines
2976
2977 \bool_new:N \l_tzedges_shift_coor_bool
2978
2979 %%% \tzedges (main)
2980 %% do not use: inner sep=0pt
2981 \NewDocumentCommand\tzedges{ s t+ O{} d<> }
2982 {
2983 \tl_clear:N \l_tzedges_cmd_tl
2984 \tl_clear:N \l_tzedges_STYLE_tl
2985
2986 % \IfValueT { #3 }
2987 % { \renewcommand\tzedgestyle{ #3 } }
2988
2989 \IfBooleanTF { #1 } % (*) or not (NOT USED!)
2990 { \bool_set_true:N \l_tmpa_bool }
2991 { \bool_set_false:N \l_tmpa_bool }
2992
2993 \IfBooleanTF { #2 } % (+) or not
2994 { \bool_set_true:N \l_tmpb_bool }
2995 { \bool_set_false:N \l_tmpb_bool }
2996
2997 \IfValueTF { #4 }
2998 {
2999 \tl_set:Nn \l_tzedges_shift_coor_tl { #4 }
3000 \bool_set_true:N \l_tzedges_shift_coor_bool
3001 }
3002 {
3003 \tl_clear:N \l_tzedges_shift_coor_tl
3004 \bool_set_false:N \l_tzedges_shift_coor_bool
3005 }
3006
3007 \IfValueTF { #3 }
3008 { \tl_set:Nn \l_tzedges_opt_tl { #3 } }
3009 { \tl_clear:N \l_tzedges_opt_tl }
3010
3011 \int_zero:N \l_tmpa_int
3012 \tzedges_check_token:n
3013 }
3014
3015 \cs_new:Npn \tzedges_check_token:n #1
3016 {
3017 % \token_if_eq_charcode:NNTF #1 (
3018 % { \tzedges_sub_fn #1 }
3019 % { \tzedges_stop_action }
3020 \str_case:nnF { #1 }
3021 {
3022 { ( } { \tzedges_sub_fn #1 }
3023 % { ; } { \tzedges_late_opt_fn }
3024 { ; } { \tzedges_stop_action }
3025 }
3026 {
3027 % \tzedges_stop_action
3028 \msg_error:nn { tzplot } { semicolon-error }
3029 }
3030 }
3031
3032 \NewDocumentCommand\tzedges_sub_fn{ r() O{} +G{} O{} }
3033 {
3034 \int_incr:N \l_tmpa_int
3035 % (from the second round) put line STYLE before the next cmd-tl
3036 \int_compare:nT { \l_tmpa_int > 1 }
3037 {
3038 \tl_put_right:No \l_tzedges_cmd_tl { \l_tzedges_STYLE_tl }
3039 \tl_clear:N \l_tzedges_STYLE_tl
3040 }
3041
3042 % collect cmd-tl
3043 \bool_if:NTF \l_tzedges_shift_coor_bool
3044 {% shift-coor
3045 \bool_if:NTF \l_tmpb_bool
3046 {% if ++
3047 \int_compare:nTF { \l_tmpa_int > 1 }
3048 { \tl_put_right:Nn \l_tzedges_cmd_tl { (#1) } } % no shift from 2nd
3049 {
3050 \tl_put_right:Nx \l_tzedges_cmd_tl
3051 { ([ shift = { (\l_tzedges_shift_coor_tl) } ]#1) } % shift first
3052 }
3053 }
3054 {% no ++
3055 \tl_put_right:Nx \l_tzedges_cmd_tl
3056 { ([ shift = { (\l_tzedges_shift_coor_tl) } ]#1) } % shift all coors
3057 }
3058 }
3059 { \tl_put_right:Nn \l_tzedges_cmd_tl { (#1) } } % no shift (normal)
3060
3061 % (from the first round on) determine and save STYLE
3062 % determine connect line STYLE
3063 \tl_set:Nn \l_tzedges_STYLE_A_tl { edge [ #2 ] }
3064 % save node info (for later use, at the end)
3065 \tl_if_empty:nTF { #3 }
3066 {
3067 \tl_clear:N \l_tzedges_STYLE_B_tl
3068 }
3069 {
3070 \tl_set:Nn \l_tzedges_STYLE_B_tl
3071 { ~ node [ #4 ] { #3 } }
3072 }
3073 \bool_if:NTF \l_tmpb_bool
3074 { \tl_set:Nn \l_tzedges_STYLE_C_tl { ++ } }
3075 { \tl_set:Nn \l_tzedges_STYLE_C_tl { } }
3076
3077 \tl_put_right:No \l_tzedges_STYLE_tl { \l_tzedges_STYLE_A_tl }
3078 \tl_put_right:No \l_tzedges_STYLE_tl { \l_tzedges_STYLE_B_tl }
3079 \tl_put_right:No \l_tzedges_STYLE_tl { \l_tzedges_STYLE_C_tl }
3080
3081 \tzedges_check_token:n
3082 }
3083
3084 %\NewDocumentCommand\tzedges_late_opt_fn { D<>{} }
3085 %{
3086 % \tl_set:Nn \l_tzedges_code_at_end_tl { #1 }
3087 % \tzedges_stop_action
3088 %}
3089
3090 \NewDocumentCommand\tzedges_stop_action { D<>{} }
3091 {
3092 % #1 works with the first coordinate
3093 % because [edge] and [node] does not change the current point
3094 \tl_if_empty:NF \l_tzedges_STYLE_B_tl
3095 {
3096 \tl_put_right:No \l_tzedges_cmd_tl { \l_tzedges_STYLE_B_tl }
3097 }
3098 \tl_clear:N \l_tzedges_STYLE_tl
3099
3100 \tl_put_left:No \l_tzedges_cmd_tl
3101 { [ \l_tzedges_opt_tl ] } % expand `once' needed
3102
3103 % final action
3104 \exp_last_unbraced:Nf
3105 \draw \l_tzedges_cmd_tl #1 ; %% draw
3106 }
3107
3108 %%% --- end of \tzedges
3109
3110
3111 %%%%% Figures: circles, frames, ellipses, triangles, etc.
3112
3113 %%% \tzcircle
3114
3115 \NewDocumentCommand\tzcircle
3116 { s O{} d<> D""{} r() r() G{\tz@initial@fill@opacity} D<>{} }
3117 {
3118 \renewcommand\tzfillopacity{#7} % effective only in * version
3119 \IfBooleanTF { #1 }
3120 {
3121 \IfValueTF { #3 }
3122 {% if shift
3123 \draw [ fill = \tzfillcolor , fill~opacity = \tzfillopacity ,
3124 text~opacity = 1 ,
3125 name~path = #4 , #2 ] ([shift={(#3)}]#5) circle (#6)
3126 #8 ;
3127 }
3128 {% no shift (normal)
3129 \draw [ fill = \tzfillcolor , fill~opacity = \tzfillopacity ,
3130 text~opacity = 1 ,
3131 name~path = #4 , #2 ] (#5) circle (#6)
3132 #8 ;
3133 }
3134 }
3135 {
3136 \IfValueTF { #3 }
3137 { \draw [ name~path = #4 , #2 ] ([shift={(#3)}]#5) circle (#6) #8 ; }
3138 { \draw [ name~path = #4 , #2 ] (#5) circle (#6) #8 ; }
3139 }
3140 }
3141
3142 %%% \tzring
3143
3144 \NewDocumentCommand\tzring
3145 { s O{} d<> r() r() d() d() G{\tz@initial@fill@opacity} D<>{} }
3146 {
3147 \renewcommand\tzfillopacity{#8} % effective only in * version
3148 \IfBooleanTF { #1 }
3149 {
3150 \IfValueTF { #3 }
3151 {% if shift
3152 \draw [ fill = \tzfillcolor , fill~opacity = \tzfillopacity ,
3153 text~opacity = 1 ,
3154 even~odd~rule , #2 ]
3155 ([shift={(#3)}]#4) circle (#5)
3156 \IfValueT { #6 } { ([shift={(#3)}]#6) circle (#7) }
3157 #9 ;
3158 }
3159 {% no shift (normal)
3160 \draw [ fill = \tzfillcolor , fill~opacity = \tzfillopacity ,
3161 text~opacity = 1 ,
3162 even~odd~rule , #2 ]
3163 (#4) circle (#5)
3164 \IfValueT { #6 } { (#6) circle (#7) }
3165 #9 ;
3166 }
3167 }
3168 {
3169 \IfValueTF { #3 }
3170 {
3171 \draw [ even~odd~rule , #2 ]
3172 ([shift={(#3)}]#4) circle (#5)
3173 \IfValueT { #6 } { ([shift={(#3)}]#6) circle (#7) }
3174 #9 ;
3175 }
3176 {
3177 \draw [ even~odd~rule , #2 ]
3178 (#4) circle (#5)
3179 \IfValueT { #6 } { (#6) circle (#7) }
3180 #9 ;
3181 }
3182 }
3183 }
3184
3185 %%% --- end of \tzring
3186
3187 \let\tzcirclering\tzring
3188
3189
3190 %%% \tzellipse
3191
3192 \NewDocumentCommand\tzellipse
3193 { s O{} d<> D""{} r() r() G{\tz@initial@fill@opacity} D<>{} }
3194 {
3195 \renewcommand\tzfillopacity{#7} % effective only in * version
3196 \IfBooleanTF { #1 }
3197 {
3198 \IfValueTF { #3 }
3199 {% if shift
3200 \draw [ fill = \tzfillcolor , fill~opacity = \tzfillopacity ,
3201 text~opacity = 1 ,
3202 name~path = #4 , #2 ]
3203 ([shift={(#3)}]#5) ellipse (#6)
3204 #8 ;
3205 }
3206 {% no shift (normal)
3207 \draw [ fill = \tzfillcolor , fill~opacity = \tzfillopacity ,
3208 text~opacity = 1 ,
3209 name~path = #4 , #2 ]
3210 (#5) ellipse (#6)
3211 #8 ;
3212 }
3213 }
3214 {
3215 \IfValueTF { #3 }
3216 { \draw [ name~path = #4 , #2 ] ([shift={(#3)}]#5) ellipse (#6) #8 ; }
3217 { \draw [ name~path = #4 , #2 ] (#5) ellipse (#6) #8 ; }
3218 }
3219 }
3220
3221 %%% --- end of \tzellipse
3222
3223 \let\tzoval\tzellipse
3224
3225
3226 %%% \tzellipsering
3227
3228 \NewDocumentCommand\tzellipsering
3229 { s O{} d<> r() r() d() d() G{\tz@initial@fill@opacity} D<>{} }
3230 {
3231 \renewcommand\tzfillopacity{#8} % effective only in * version
3232 \IfBooleanTF { #1 }
3233 {
3234 \IfValueTF { #3 }
3235 {% if shift
3236 \draw [ fill = \tzfillcolor , fill~opacity = \tzfillopacity ,
3237 text~opacity = 1 ,
3238 even~odd~rule , #2 ]
3239 ([shift={(#3)}]#4) ellipse (#5)
3240 \IfValueT { #6 } { ([shift={(#3)}]#6) ellipse (#7) }
3241 #9 ;
3242 }
3243 {% no shift (normal)
3244 \draw [ fill = \tzfillcolor , fill~opacity = \tzfillopacity ,
3245 text~opacity = 1 ,
3246 even~odd~rule , #2 ]
3247 (#4) ellipse (#5)
3248 \IfValueT { #6 } { (#6) ellipse (#7) }
3249 #9 ;
3250 }
3251 }
3252 {
3253 \IfValueTF { #3 }
3254 {
3255 \draw [ even~odd~rule , #2 ]
3256 ([shift={(#3)}]#4) ellipse (#5)
3257 \IfValueT { #6 } { ([shift={(#3)}]#6) ellipse (#7) }
3258 #9 ;
3259 }
3260 {
3261 \draw [ even~odd~rule , #2 ]
3262 (#4) ellipse (#5)
3263 \IfValueT { #6 } { (#6) ellipse (#7) }
3264 #9 ;
3265 }
3266 }
3267 }
3268
3269 %%% --- end of \tzellipsering
3270
3271 \let\tzovalring\tzellipsering
3272
3273
3274 %%% \tzframe
3275
3276 \NewDocumentCommand\tzframe
3277 { s t+ O{} d<> D""{} r() r() G{\tz@initial@fill@opacity} D<>{} }
3278 {
3279 \renewcommand\tzfillopacity{#8} % effective only in * version
3280 \IfBooleanTF { #1 }
3281 {
3282 \IfBooleanTF { #2 }
3283 {
3284 \IfValueTF { #4 }
3285 {% if shift
3286 \draw [ fill = \tzfillcolor , fill~opacity = \tzfillopacity ,
3287 text~opacity = 1 ,
3288 name~path = #5 , #3 ]
3289 ([shift={(#4)}]#6) rectangle ++ (#7)
3290 #9 ;
3291 }
3292 {% no shift
3293 \draw [ fill = \tzfillcolor , fill~opacity = \tzfillopacity ,
3294 text~opacity = 1 ,
3295 name~path = #5 , #3 ]
3296 (#6) rectangle ++ (#7)
3297 #9 ;
3298 }
3299 }
3300 {
3301 \IfValueTF { #4 }
3302 {% if shift
3303 \draw [ fill = \tzfillcolor , fill~opacity = \tzfillopacity ,
3304 text~opacity = 1 ,
3305 name~path = #5 , #3 ]
3306 ([shift={(#4)}]#6) rectangle ([shift={(#4)}]#7)
3307 #9 ;
3308 }
3309 {% no shift
3310 \draw [ fill = \tzfillcolor , fill~opacity = \tzfillopacity ,
3311 text~opacity = 1 ,
3312 name~path = #5 , #3 ]
3313 (#6) rectangle (#7)
3314 #9 ;
3315 }
3316 }
3317 }
3318 {
3319 \IfBooleanTF { #2 }
3320 {
3321 \IfValueTF { #4 }
3322 {% if shift
3323 \draw [ name~path = #5 , #3 ]
3324 ([shift={(#4)}]#6) rectangle ++ (#7)
3325 #9 ;
3326 }
3327 {% no shift
3328 \draw [ name~path = #5 , #3 ] (#6) rectangle ++ (#7) #9 ;
3329 }
3330 }
3331 {
3332 \IfValueTF { #4 }
3333 {% if shift
3334 \draw [ name~path = #5 , #3 ]
3335 ([shift={(#4)}]#6) rectangle ([shift={(#4)}]#7)
3336 #9 ;
3337 }
3338 {% no shift
3339 \draw [ name~path = #5 , #3 ] (#6) rectangle (#7) #9 ;
3340 }
3341 }
3342 }
3343 }
3344 %%% --- end of \tzframe
3345
3346 \let\tzrectangle\tzframe
3347 \let\tzbox\tzframe
3348
3349
3350
3351 %%% \tzrectanglering
3352
3353 \NewDocumentCommand\tzrectanglering
3354 { s O{} d<> r() r() d() d() G{\tz@initial@fill@opacity} D<>{} }
3355 {
3356 \renewcommand\tzfillopacity{#8} % effective only in * version
3357 \IfBooleanTF { #1 }
3358 {
3359 \IfValueTF { #3 }
3360 {% if shift
3361 \draw [ fill = \tzfillcolor , fill~opacity = \tzfillopacity ,
3362 text~opacity = 1 ,
3363 even~odd~rule , #2 ]
3364 ([shift={(#3)}]#4) rectangle ([shift={(#3)}]#5)
3365 \IfValueT { #6 } { ([shift={(#3)}]#6) rectangle ([shift={(#3)}]#7) }
3366 #9 ;
3367 }
3368 {% no shift (normal)
3369 \draw [ fill = \tzfillcolor , fill~opacity = \tzfillopacity ,
3370 text~opacity = 1 ,
3371 even~odd~rule , #2 ]
3372 (#4) rectangle (#5)
3373 \IfValueT { #6 } { (#6) rectangle (#7) }
3374 #9 ;
3375 }
3376 }
3377 {
3378 \IfValueTF { #3 }
3379 {
3380 \draw [ even~odd~rule , #2 ]
3381 ([shift={(#3)}]#4) rectangle ([shift={(#3)}]#5)
3382 \IfValueT { #6 } { ([shift={(#3)}]#6) rectangle ([shift={(#3)}]#7) }
3383 #9 ;
3384 }
3385 {
3386 \draw [ even~odd~rule , #2 ]
3387 (#4) rectangle (#5)
3388 \IfValueT { #6 } { (#6) rectangle (#7) }
3389 #9 ;
3390 }
3391 }
3392 }
3393
3394 %%% --- end of \tzrectanglering
3395
3396 \let\tzframering\tzrectanglering
3397 \let\tzboxring\tzrectanglering
3398
3399
3400
3401 %%%%%%%(ADDED) -- to be removed
3402 %%%%%%%% \tzdiamond
3403 %%%%%
3404 %%%%%\NewDocumentCommand\tzdiamond
3405 %%%%% { s O{} d<> D""{} r() r() G{\tz@initial@fill@opacity} }
3406 %%%%%{
3407 %%%%% \renewcommand\tzfillopacity{#7}
3408 %%%%% \IfBooleanTF { #1 }
3409 %%%%% {
3410 %%%%% \IfValueTF { #3 }
3411 %%%%% {% if shift
3412 %%%%% \draw [ fill = \tzfillcolor , fill~opacity = \tzfillopacity ,
3413 %%%%% text~opacity = 1 , #2 ]
3414 %%%%% ([shift={(#3)}]$ (#5) + (#6|-0,0) $)
3415 %%%%% -- ([shift={(#3)}]$ (#5) + (#6-|0,0) $)
3416 %%%%% -- ([shift={(#3)}]$ (#5) - (#6|-0,0) $)
3417 %%%%% -- ([shift={(#3)}]$ (#5) - (#6-|0,0) $) -- cycle;
3418 %%%%% }
3419 %%%%% {% no shift (normal)
3420 %%%%% \draw [ fill = \tzfillcolor , fill~opacity = \tzfillopacity ,
3421 %%%%% text~opacity = 1 , #2 ]
3422 %%%%% ($ (#5) + (#6|-0,0) $)
3423 %%%%% -- ($ (#5) + (#6-|0,0) $)
3424 %%%%% -- ($ (#5) - (#6|-0,0) $)
3425 %%%%% -- ($ (#5) - (#6-|0,0) $) -- cycle;
3426 %%%%% }
3427 %%%%% }
3428 %%%%% {
3429 %%%%% \IfValueTF { #3 }
3430 %%%%% {% if shift
3431 %%%%% \draw [ #2 ]
3432 %%%%% ([shift={(#3)}]$ (#5) + (#6|-0,0) $)
3433 %%%%% -- ([shift={(#3)}]$ (#5) + (#6-|0,0) $)
3434 %%%%% -- ([shift={(#3)}]$ (#5) - (#6|-0,0) $)
3435 %%%%% -- ([shift={(#3)}]$ (#5) - (#6-|0,0) $) -- cycle;
3436 %%%%% }
3437 %%%%% {% no shift (normal)
3438 %%%%% \draw [ #2 ]
3439 %%%%% ($ (#5) + (#6|-0,0) $)
3440 %%%%% -- ($ (#5) + (#6-|0,0) $)
3441 %%%%% -- ($ (#5) - (#6|-0,0) $)
3442 %%%%% -- ($ (#5) - (#6-|0,0) $) -- cycle;
3443 %%%%% }
3444 %%%%% }
3445 %%%%%}
3446 %%%%%
3447 %%%%%
3448 %%%%%%%(ADDED) -- to be removed
3449 %%%%%%%% \tztriangle
3450 %%%%%
3451 %%%%%\NewDocumentCommand\tztriangle
3452 %%%%% { s O{} d<> D""{} r() r() G{\tz@initial@fill@opacity} }
3453 %%%%%{
3454 %%%%% \renewcommand\tzfillopacity{#7}
3455 %%%%% \IfBooleanTF { #1 }
3456 %%%%% {
3457 %%%%% \IfValueTF { #3 }
3458 %%%%% {% if shift
3459 %%%%% \draw [ fill = \tzfillcolor , fill~opacity = \tzfillopacity ,
3460 %%%%% text~opacity = 1 , name~path = #4 , #2 ]
3461 %%%%% ([shift={(#3)}]$ (#5) + .5*(#6|-0,0) $)
3462 %%%%% -- ([shift={(#3)}]$ (#5) + (0,0|-#6) $)
3463 %%%%% -- ([shift={(#3)}]$ (#5) - .5*(#6|-0,0) $) -- cycle;
3464 %%%%% }
3465 %%%%% {% no shift
3466 %%%%% \draw [ fill = \tzfillcolor , fill~opacity = \tzfillopacity ,
3467 %%%%% text~opacity = 1 , name~path = #4 , #2 ]
3468 %%%%% ($ (#5) + .5*(#6|-0,0) $)
3469 %%%%% -- ($ (#5) + (0,0|-#6) $)
3470 %%%%% -- ($ (#5) - .5*(#6|-0,0) $) -- cycle;
3471 %%%%% }
3472 %%%%% }
3473 %%%%% {
3474 %%%%% \IfValueTF { #3 }
3475 %%%%% {% if shift
3476 %%%%% \draw [ name~path = #4 , #2 ]
3477 %%%%% ([shift={(#3)}]$ (#5) + .5*(#6|-0,0) $)
3478 %%%%% -- ([shift={(#3)}]$ (#5) + (0,0|-#6) $)
3479 %%%%% -- ([shift={(#3)}]$ (#5) - .5*(#6|-0,0) $) -- cycle;
3480 %%%%% }
3481 %%%%% {% no shift
3482 %%%%% \draw [ name~path = #4 , #2 ]
3483 %%%%% ($ (#5) + .5*(#6|-0,0) $)
3484 %%%%% -- ($ (#5) + (0,0|-#6) $)
3485 %%%%% -- ($ (#5) - .5*(#6|-0,0) $) -- cycle;
3486 %%%%% }
3487 %%%%% }
3488 %%%%%}
3489
3490
3491 %%% \tzparabola
3492
3493 \bool_new:N \g_tzparabola_BEGIN_cmd_bool
3494 \bool_new:N \g_tzparabola_END_cmd_bool
3495 \bool_new:N \l_tzparabola_shift_coor_bool
3496
3497 %% \tzparabolaAtBegin
3498 \NewDocumentCommand\tzparabolaAtBegin{ m }
3499 {
3500 \bool_gset_true:N \g_tzparabola_BEGIN_cmd_bool
3501 \tl_gset:No \g_tzparabola_BEGIN_cmd_tl { #1 }
3502 }
3503
3504 %% \tzparabolaAtEnd
3505 \NewDocumentCommand\tzparabolaAtEnd{ m }
3506 {
3507 \bool_gset_true:N \g_tzparabola_END_cmd_bool
3508 \tl_gset:No \g_tzparabola_END_cmd_tl { #1 }
3509 }
3510
3511 %% \tzparabola (main)
3512 \NewDocumentCommand\tzparabola
3513 { s t+ O{} d<> D""{} }
3514 {
3515 \tl_clear:N \l_tzparabola_cmd_tl
3516
3517 \IfBooleanTF { #1 } % NOT USED!!!
3518 { \bool_set_true:N \l_tmpa_bool }
3519 { \bool_set_false:N \l_tmpa_bool }
3520
3521 \IfBooleanTF { #2 }
3522 { \bool_set_true:N \l_tmpb_bool }
3523 { \bool_set_false:N \l_tmpb_bool }
3524
3525 \IfValueTF { #5 }
3526 { \tl_set:Nn \l_tzparabola_pathname_tl { name~path = #5 } }
3527 { \tl_clear:N \l_tzparabola_pathname_tl }
3528
3529 \IfValueTF { #4 }
3530 {
3531 \tl_set:Nn \l_tzparabola_shift_coor_tl { #4 }
3532 \bool_set_true:N \l_tzparabola_shift_coor_bool
3533 }
3534 {
3535 \tl_clear:N \l_tzparabola_shift_coor_tl
3536 \bool_set_false:N \l_tzparabola_shift_coor_bool
3537 }
3538
3539 \IfValueTF { #3 }
3540 { \tl_set:Nn \l_tzparabola_opt_tl { #3 } }
3541 { \tl_clear:N \l_tzparabola_opt_tl }
3542
3543 \tzparabola_check_token:n
3544 }
3545
3546 \cs_new:Npn \tzparabola_check_token:n #1
3547 {
3548 \str_if_eq:nnT { #1 } { ( }
3549 { \tzparabola_sub_fn ( }
3550 % \tzparabola_stop_action
3551 }
3552
3553 \NewDocumentCommand\tzparabola_sub_fn
3554 { r() r() d() +G{} O{} G{\tz@initial@fill@opacity} D<>{} }
3555 {
3556 \renewcommand\tzfillopacity{#6} %% NOT USED! (to be removed)
3557
3558 \bool_if:NTF \l_tzparabola_shift_coor_bool
3559 {% if shift
3560 \tl_put_right:Nx \l_tzparabola_cmd_tl
3561 { ([shift = { (\l_tzparabola_shift_coor_tl) } ]#1) }
3562 }
3563 {% no shift (normal)
3564 \tl_put_right:Nn \l_tzparabola_cmd_tl { (#1) }
3565 }
3566
3567 \IfNoValueTF { #3 }
3568 {%% 2 coors
3569 \bool_if:NTF \l_tmpb_bool
3570 {% if + (relative coor)
3571 \bool_if:NTF \l_tzparabola_shift_coor_bool
3572 {% if shift
3573 \tl_put_right:Nx \l_tzparabola_cmd_tl
3574 { parabola ([shift = { (\l_tzparabola_shift_coor_tl) } ]$(#1)+(#2)$) }
3575 }
3576 {% no shift (normal)
3577 \tl_put_right:Nn \l_tzparabola_cmd_tl { parabola ($(#1)+(#2)$) }
3578 }
3579 }
3580 {% no + (absolute coor)
3581 \bool_if:NTF \l_tzparabola_shift_coor_bool
3582 {% if shift
3583 \tl_put_right:Nx \l_tzparabola_cmd_tl
3584 { parabola ([shift = { (\l_tzparabola_shift_coor_tl) } ]#2) }
3585 }
3586 {% no shift (normal)
3587 \tl_put_right:Nn \l_tzparabola_cmd_tl { parabola (#2) }
3588 }
3589 }
3590 }
3591 {%% 3 coors
3592 \bool_if:NTF \l_tmpb_bool
3593 {% if + (relative coor)
3594 \tl_put_right:Nn \l_tzparabola_cmd_tl
3595 { parabola~bend + (#2) }
3596 \bool_if:NTF \l_tzparabola_shift_coor_bool
3597 {% if shift
3598 \tl_put_right:Nx \l_tzparabola_cmd_tl
3599 { ([shift = { (\l_tzparabola_shift_coor_tl) } ]$(#1)+(#3)$) }
3600 }
3601 {% no shift (normal)
3602 \tl_put_right:Nn \l_tzparabola_cmd_tl { ($(#1)+(#3)$) }
3603 }
3604 }
3605 {% no + (absolute coor)
3606 \bool_if:NTF \l_tzparabola_shift_coor_bool
3607 {
3608 \tl_put_right:Nx \l_tzparabola_cmd_tl
3609 {
3610 parabola~bend
3611 ([shift = { (\l_tzparabola_shift_coor_tl) } ]#2)
3612 }
3613 }
3614 {
3615 \tl_put_right:Nn \l_tzparabola_cmd_tl
3616 { parabola~bend (#2) }
3617 }
3618 \bool_if:NTF \l_tzparabola_shift_coor_bool
3619 {% if shift
3620 \tl_put_right:Nx \l_tzparabola_cmd_tl
3621 { ([shift = { (\l_tzparabola_shift_coor_tl) } ]#3) }
3622 }
3623 {% no shift (normal)
3624 \tl_put_right:Nn \l_tzparabola_cmd_tl { (#3) }
3625 }
3626 }
3627 }
3628
3629 \tl_put_right:Nn \l_tzparabola_cmd_tl
3630 { node [ #5 ] { #4 } }
3631 % add at begin/end
3632 \bool_if:NT \g_tzparabola_BEGIN_cmd_bool
3633 { \tl_put_left:Nx \l_tzparabola_cmd_tl { \g_tzparabola_BEGIN_cmd_tl } }
3634 \bool_if:NT \g_tzparabola_END_cmd_bool
3635 { \tl_put_right:Nx \l_tzparabola_cmd_tl { \g_tzparabola_END_cmd_tl } }
3636
3637 % final action
3638 \tl_put_left:No \l_tzparabola_cmd_tl
3639 { \l_tzparabola_opt_tl ] } % expand `once'
3640 \tl_put_left:Nx \l_tzparabola_cmd_tl
3641 { [ \l_tzparabola_pathname_tl , }
3642
3643 \exp_last_unbraced:Nf
3644 \draw \l_tzparabola_cmd_tl #7 ;
3645
3646 \bool_gset_false:N \g_tzparabola_BEGIN_cmd_bool
3647 \bool_gset_false:N \g_tzparabola_END_cmd_bool
3648 % \tl_clear:N \g_tzparabola_BEGIN_cmd_tl
3649 % \tl_clear:N \g_tzparabola_END_cmd_tl
3650 }
3651
3652 %%% -- end of \tzparabola
3653
3654
3655 %%% \tzbezier
3656
3657 \bool_new:N \g_tzbezier_BEGIN_cmd_bool
3658 \bool_new:N \g_tzbezier_END_cmd_bool
3659 \bool_new:N \l_tzbezier_shift_coor_bool
3660
3661 %% \tzbezierAtBegin
3662 \NewDocumentCommand\tzbezierAtBegin{ m }
3663 {
3664 \bool_gset_true:N \g_tzbezier_BEGIN_cmd_bool
3665 \tl_gset:No \g_tzbezier_BEGIN_cmd_tl { #1 }
3666 }
3667
3668 %% \tzbezierAtEnd
3669 \NewDocumentCommand\tzbezierAtEnd{ m }
3670 {
3671 \bool_gset_true:N \g_tzbezier_END_cmd_bool
3672 \tl_gset:No \g_tzbezier_END_cmd_tl { #1 }
3673 }
3674
3675 %% \tzbezier (main)
3676 \NewDocumentCommand\tzbezier{ s t+ O{} d<> D""{tzplot~path} }
3677 {
3678 \tl_clear:N \l_tzbezier_cmd_tl
3679
3680 \IfBooleanTF { #1 } %% NOT USED!
3681 { \bool_set_true:N \l_tmpa_bool }
3682 { \bool_set_true:N \l_tmpa_bool }
3683
3684 \IfBooleanTF { #2 }
3685 { \bool_set_true:N \l_tmpb_bool }
3686 { \bool_set_false:N \l_tmpb_bool }
3687
3688 \IfValueTF { #5 }
3689 { \tl_set:Nn \l_tzbezier_pathname_tl { name~path = #5 } }
3690 { \tl_clear:N \l_tzbezier_pathname_tl }
3691
3692 \IfValueTF { #4 }
3693 {
3694 \tl_set:Nn \l_tzbezier_shift_coor_tl { #4 }
3695 \bool_set_true:N \l_tzbezier_shift_coor_bool
3696 }
3697 {
3698 \tl_clear:N \l_tzbezier_shift_coor_tl
3699 \bool_set_false:N \l_tzbezier_shift_coor_bool
3700 }
3701
3702 \IfValueTF { #3 }
3703 { \tl_set:Nn \l_tzbezier_opt_tl { #3 } }
3704 { \tl_clear:N \l_tzbezier_opt_tl }
3705
3706 \tzbezier_check_token:n
3707 }
3708
3709 \cs_new:Npn \tzbezier_check_token:n #1
3710 {
3711 \str_if_eq:nnT { #1 } { ( }
3712 { \tzbezier_sub_fn ( }
3713 % \tzbezier_stop_action
3714 }
3715
3716 \NewDocumentCommand\tzbezier_sub_fn{ r() r() r() d() +G{} O{} D<>{} }
3717 {
3718 \bool_if:NTF \l_tzbezier_shift_coor_bool
3719 {% if shift
3720 \tl_put_right:Nx \l_tzbezier_cmd_tl
3721 { ([shift = { (\l_tzbezier_shift_coor_tl) } ]#1) .. controls }
3722 }
3723 {% no shift (normal)
3724 \tl_put_right:Nn \l_tzbezier_cmd_tl { (#1) .. controls }
3725 }
3726
3727 \IfNoValueTF { #4 }
3728 {%% 3 coors
3729 \bool_if:NTF \l_tmpb_bool
3730 {% if + (relative coor)
3731 \tl_put_right:Nn \l_tzbezier_cmd_tl { + (#2) }
3732 \bool_if:NTF \l_tzbezier_shift_coor_bool
3733 {% if shift
3734 \tl_put_right:Nx \l_tzbezier_cmd_tl
3735 { .. ([shift = { (\l_tzbezier_shift_coor_tl) } ]$(#1)+(#3)$) }
3736 }
3737 {% no shift (normal)
3738 \tl_put_right:Nn \l_tzbezier_cmd_tl { .. ($(#1)+(#3)$) }
3739 }
3740 }
3741 {% no + (absolute coor)
3742 % control coor
3743 \bool_if:NTF \l_tzbezier_shift_coor_bool
3744 {% if shift
3745 \tl_put_right:Nx \l_tzbezier_cmd_tl
3746 { ([ shift = { (\l_tzbezier_shift_coor_tl) } ]#2) }
3747 }
3748 {% no shift (normal)
3749 \tl_put_right:Nn \l_tzbezier_cmd_tl { (#2) }
3750 }
3751 %% end coor
3752 \bool_if:NTF \l_tzbezier_shift_coor_bool
3753 {% if shift
3754 \tl_put_right:Nx \l_tzbezier_cmd_tl
3755 { .. ([shift = { (\l_tzbezier_shift_coor_tl) } ]#3) }
3756 }
3757 {% no shift (normal)
3758 \tl_put_right:Nn \l_tzbezier_cmd_tl { .. (#3) }
3759 }
3760 }
3761 }
3762 {%% 4 coors
3763 \bool_if:NTF \l_tmpb_bool
3764 {% if + (relative coor)
3765 \tl_put_right:Nn \l_tzbezier_cmd_tl { + (#2) and + (#3) }
3766 \bool_if:NTF \l_tzbezier_shift_coor_bool
3767 {% if shift
3768 \tl_put_right:Nx \l_tzbezier_cmd_tl
3769 { .. ([shift = { (\l_tzbezier_shift_coor_tl) } ]$(#1)+(#4)$) }
3770 }
3771 {% no shift (normal)
3772 \tl_put_right:Nn \l_tzbezier_cmd_tl { .. ($(#1)+(#4)$) }
3773 }
3774 }
3775 {% no + (absolute coor)
3776 %% control coors
3777 \bool_if:NTF \l_tzbezier_shift_coor_bool
3778 {% if shift
3779 \tl_put_right:Nx \l_tzbezier_cmd_tl
3780 {
3781 ([ shift = { (\l_tzbezier_shift_coor_tl) } ]#2)
3782 and
3783 ([ shift = { (\l_tzbezier_shift_coor_tl) } ]#3)
3784 }
3785 }
3786 {% no shift (normal)
3787 \tl_put_right:Nn \l_tzbezier_cmd_tl { (#2) and (#3) }
3788 }
3789 %% end coor
3790 \bool_if:NTF \l_tzbezier_shift_coor_bool
3791 {% if shift
3792 \tl_put_right:Nx \l_tzbezier_cmd_tl
3793 { .. ([shift = { (\l_tzbezier_shift_coor_tl) } ]#4) }
3794 }
3795 {% no shift (normal)
3796 \tl_put_right:Nn \l_tzbezier_cmd_tl { .. (#4) }
3797 }
3798 }
3799 }
3800
3801 \tl_put_right:Nn \l_tzbezier_cmd_tl
3802 { node [ #6 ] { #5 } }
3803 % add at begin/end
3804 \bool_if:NT \g_tzbezier_BEGIN_cmd_bool
3805 { \tl_put_left:Nx \l_tzbezier_cmd_tl { \g_tzbezier_BEGIN_cmd_tl } }
3806 \bool_if:NT \g_tzbezier_END_cmd_bool
3807 { \tl_put_right:Nx \l_tzbezier_cmd_tl { \g_tzbezier_END_cmd_tl } }
3808
3809 % final action
3810 \tl_put_left:No \l_tzbezier_cmd_tl { \l_tzbezier_opt_tl ] }
3811 \tl_put_left:Nx \l_tzbezier_cmd_tl
3812 { [ \l_tzbezier_pathname_tl , }
3813
3814 \exp_last_unbraced:Nf \draw \l_tzbezier_cmd_tl #7 ;
3815
3816 \bool_gset_false:N \g_tzbezier_BEGIN_cmd_bool
3817 \bool_gset_false:N \g_tzbezier_END_cmd_bool
3818 % \tl_clear:N \g_tzbezier_BEGIN_cmd_tl
3819 % \tl_clear:N \g_tzbezier_END_cmd_tl
3820 }
3821
3822 %%% -- end of \tzbezier
3823
3824
3825 %%% \tzarc (main)
3826
3827 \use:x{
3828 \NewDocumentCommand \exp_not:N \tzarc
3829 { s t' O{} d<> D""{} r()
3830 >{ \SplitArgument {2} { \tl_to_str:n {:} } } r()
3831 }
3832 }
3833 {
3834 \IfBooleanTF { #1 } {}{} % NOT USED!
3835
3836 \tl_clear:N \l_tzarc_cmd_tl
3837
3838 \tzarc_args_process #7
3839 \fp_set:Nn \l_tmpa_fp { \tzarcAngleA }
3840 \fp_set:Nn \l_tmpb_fp { \tzarcAngleB }
3841
3842 \tl_put_right:Nn \l_tzarc_cmd_tl
3843 { [ name~path = #5 , #3 ] }
3844 \IfValueTF { #4 }
3845 {% if shift
3846 \tl_put_right:Nn \l_tzarc_cmd_tl
3847 { ([shift={(#4)}]#6) ++ (\tzarcAngleA \c_colon_str \tzarcRadius) }
3848 }
3849 {% no shift (normal)
3850 \tl_put_right:Nn \l_tzarc_cmd_tl
3851 { (#6) ++ (\tzarcAngleA \c_colon_str \tzarcRadius) }
3852 }
3853
3854 \tl_put_right:Nx \l_tzarc_cmd_tl
3855 {
3856 \fp_compare:nTF { \l_tmpa_fp < \l_tmpb_fp }
3857 {
3858 arc ( \tzarcAngleA
3859 \c_colon_str
3860 \IfBooleanTF { #2 }
3861 {\tzarcAngleB - 360}
3862 {\tzarcAngleB}
3863 \c_colon_str
3864 \tzarcRadius )
3865 }
3866 {
3867 arc ( \IfBooleanTF { #2 }
3868 {\tzarcAngleA - 360}
3869 {\tzarcAngleA}
3870 \c_colon_str
3871 \tzarcAngleB
3872 \c_colon_str
3873 \tzarcRadius )
3874 }
3875 }
3876
3877 \tzarc_sub_fn:n
3878 }
3879
3880 \NewDocumentCommand\tzarc_args_process{ m m m }
3881 {
3882 \def\tzarcAngleA{#1}
3883 \def\tzarcAngleB{#2}
3884 \def\tzarcRadius{#3}
3885 }
3886
3887 \cs_new:Npn \tzarc_sub_fn:n
3888 {
3889 \tzarc_final_actions
3890 }
3891
3892 \NewDocumentCommand\tzarc_final_actions{ +G{} O{} D<>{} }
3893 {
3894 \tl_put_right:Nn \l_tzarc_cmd_tl
3895 { node [ #2 ] { #1 } #3 }
3896
3897 \exp_last_unbraced:Nf \draw \l_tzarc_cmd_tl ;
3898 }
3899
3900 %%% --- end of \tzarc
3901
3902
3903 %%% \tzarcfrom (main)
3904 %% (works like tikz original)
3905
3906 \use:x{
3907 \NewDocumentCommand \exp_not:N \tzarcfrom
3908 { s t' O{} d<> D""{} r()
3909 >{ \SplitArgument {2} { \tl_to_str:n {:} } } r()
3910 }
3911 }
3912 {
3913 \IfBooleanTF { #1 } {}{} % NOT USED!
3914
3915 \tl_clear:N \l_tzarcfrom_cmd_tl
3916
3917 \tzarcfrom_args_process #7
3918 \fp_set:Nn \l_tmpa_fp { \tzarcfromAngleA }
3919 \fp_set:Nn \l_tmpb_fp { \tzarcfromAngleB }
3920
3921 \tl_put_right:Nn \l_tzarcfrom_cmd_tl
3922 { [ name~path = #5 , #3 ] }
3923
3924 \IfValueTF { #4 }
3925 {% if shift
3926 \tl_put_right:Nn \l_tzarcfrom_cmd_tl
3927 { ([shift={(#4)}]#6) }
3928 }
3929 {% no shift (normal)
3930 \tl_put_right:Nn \l_tzarcfrom_cmd_tl
3931 { (#6) } % ++ (\tzarcfromAngleA \c_colon_str \tzarcfromRadius)
3932 }
3933
3934 \tl_put_right:No \l_tzarcfrom_cmd_tl
3935 {
3936 \fp_compare:nTF { \l_tmpa_fp < \l_tmpb_fp }
3937 {
3938 arc ( \tzarcfromAngleA
3939 \c_colon_str
3940 \IfBooleanTF {#2}
3941 {\tzarcfromAngleB - 360}
3942 {\tzarcfromAngleB}
3943 \c_colon_str
3944 \tzarcfromRadius )
3945 }
3946 {
3947 arc ( \IfBooleanTF {#2}
3948 {\tzarcfromAngleA - 360}
3949 {\tzarcfromAngleA}
3950 \c_colon_str
3951 \tzarcfromAngleB
3952 \c_colon_str
3953 \tzarcfromRadius )
3954 }
3955 }
3956
3957 \tzarcfrom_sub_fn:n
3958
3959 }
3960
3961 \NewDocumentCommand\tzarcfrom_args_process{ m m m }
3962 {
3963 \def\tzarcfromAngleA{#1}
3964 \def\tzarcfromAngleB{#2}
3965 \def\tzarcfromRadius{#3}
3966 }
3967
3968 \cs_new:Npn \tzarcfrom_sub_fn:n
3969 {
3970 \tzarcfrom_final_actions
3971 }
3972
3973 \NewDocumentCommand\tzarcfrom_final_actions{ +G{} O{} D<>{} }
3974 {
3975 \tl_put_right:Nn \l_tzarcfrom_cmd_tl
3976 { node [ #2 ] { #1 } #3 }
3977 \exp_last_unbraced:Nf \draw \l_tzarcfrom_cmd_tl ;
3978 }
3979
3980 %%% --- end of \tzarcfrom
3981
3982
3983 %%% \tzarcsfrom (main)
3984 %% (works like tikz original)
3985
3986 \tl_new:N \l_tzarcsfrom_code_at_end_tl
3987
3988 \NewDocumentCommand\tzarcsfrom { s t' O{} d<> D""{} r() }
3989 {
3990 \IfBooleanTF { #1 } {}{} % NOT USED!
3991 { \bool_set_true:N \l_tmpa_bool }
3992 { \bool_set_false:N \l_tmpa_bool }
3993
3994 \IfBooleanTF { #2 }
3995 { \bool_set_true:N \l_tmpb_bool }
3996 { \bool_set_false:N \l_tmpb_bool }
3997
3998 \tl_clear:N \l_tzarcsfrom_cmd_tl
3999 \tl_put_right:Nn \l_tzarcsfrom_cmd_tl
4000 { [ name~path = #5 , #3 ] }
4001
4002 \IfValueTF { #4 }
4003 {% if shift
4004 \tl_put_right:Nn \l_tzarcsfrom_cmd_tl
4005 { ([shift={(#4)}]#6) }
4006 }
4007 {% no shift
4008 \tl_put_right:Nn \l_tzarcsfrom_cmd_tl
4009 { (#6) } % ++ (\tzarcsfromAngleA \c_colon_str \tzarcsfromRadius)
4010 }
4011
4012 \tzarcsfrom_check_token:n
4013 }
4014
4015 \cs_new:Npn \tzarcsfrom_check_token:n #1
4016 {
4017 \str_case:nnF { #1 }
4018 {
4019 { ( } { \tzarcsfrom_sub_fn #1 }
4020 { ; } { \tzarcsfrom_late_opt_fn }
4021 }
4022 {
4023 % \tzarcsfrom_stop_action
4024 \msg_error:nn { tzplot } { semicolon-error }
4025 }
4026 }
4027
4028
4029 \use:x{
4030 \NewDocumentCommand \exp_not:N \tzarcsfrom_sub_fn
4031 { >{ \SplitArgument {2} { \tl_to_str:n {:} } } r() +G{} O{}
4032 }
4033 }
4034 {
4035 \tzarcsfrom_args_process #1
4036 \fp_set:Nn \l_tmpa_fp { \tzarcsfromAngleA }
4037 \fp_set:Nn \l_tmpb_fp { \tzarcsfromAngleB }
4038
4039 \tl_put_right:Nx \l_tzarcsfrom_cmd_tl
4040 {
4041 \fp_compare:nTF { \l_tmpa_fp < \l_tmpb_fp }
4042 {
4043 arc ( \tzarcsfromAngleA
4044 \c_colon_str
4045 \bool_if:NTF \l_tmpb_bool
4046 {\tzarcsfromAngleB - 360}
4047 {\tzarcsfromAngleB}
4048 \c_colon_str
4049 \tzarcsfromRadius )
4050 }
4051 {
4052 arc ( \bool_if:NTF \l_tmpb_bool
4053 {\tzarcsfromAngleA - 360}
4054 {\tzarcsfromAngleA}
4055 \c_colon_str
4056 \tzarcsfromAngleB
4057 \c_colon_str
4058 \tzarcsfromRadius )
4059 }
4060 }
4061 \tl_put_right:Nn \l_tzarcsfrom_cmd_tl
4062 { node [ #3 ] { #2 } }
4063
4064 \tzarcsfrom_check_token:n
4065 }
4066
4067 \NewDocumentCommand\tzarcsfrom_late_opt_fn { D<>{} }
4068 {
4069 \tl_set:Nn \l_tzarcsfrom_code_at_end_tl { #1 }
4070 \tzarcsfrom_stop_action
4071 }
4072
4073 \NewDocumentCommand\tzarcsfrom_stop_action {}
4074 {
4075 \tl_put_right:No \l_tzarcsfrom_cmd_tl
4076 { \l_tzarcsfrom_code_at_end_tl }
4077 \exp_last_unbraced:Nf \draw \l_tzarcsfrom_cmd_tl ;
4078 }
4079
4080 \NewDocumentCommand\tzarcsfrom_args_process{ m m m }
4081 {
4082 \def\tzarcsfromAngleA{#1}
4083 \def\tzarcsfromAngleB{#2}
4084 \def\tzarcsfromRadius{#3}
4085 }
4086
4087 %%% --- end of \tzarcsfrom
4088
4089
4090 %%% \tzwedge (main)
4091
4092 \use:x{
4093 \NewDocumentCommand \exp_not:N \tzwedge
4094 { s t' O{} d<> D""{} r()
4095 >{ \SplitArgument {2} { \tl_to_str:n {:} } } r()
4096 }
4097 }
4098 {
4099 \tl_clear:N \l_tzwedge_cmd_tl
4100
4101 \tzwedge_args_process #7
4102 \fp_set:Nn \l_tmpa_fp { \tzwedgeAngleA }
4103 \fp_set:Nn \l_tmpb_fp { \tzwedgeAngleB }
4104
4105 \IfBooleanTF { #1 }
4106 {
4107 \tl_put_right:Nn \l_tzwedge_cmd_tl
4108 {
4109 [ fill=\tzfillcolor ,
4110 fill~opacity = \tzfillopacity , text~opacity = 1 ,
4111 name~path = #5 , #3 ]
4112 }
4113 }
4114 {
4115 \tl_put_right:Nn \l_tzwedge_cmd_tl
4116 { [ name~path = #5 , #3 ] }
4117 }
4118
4119 \IfValueTF { #4 }
4120 {
4121 \tl_put_right:Nn \l_tzwedge_cmd_tl
4122 { ([shift={(#4)}]#6) -- ++ (\tzwedgeAngleA \c_colon_str \tzwedgeRadius) }
4123 }
4124 {
4125 \tl_put_right:Nn \l_tzwedge_cmd_tl
4126 { (#6) -- ++ (\tzwedgeAngleA \c_colon_str \tzwedgeRadius) }
4127 }
4128
4129 \tl_put_right:No \l_tzwedge_cmd_tl
4130 {
4131 \fp_compare:nTF { \l_tmpa_fp < \l_tmpb_fp }
4132 {
4133 arc ( \tzwedgeAngleA
4134 \c_colon_str
4135 \IfBooleanTF {#2}
4136 {\tzwedgeAngleB - 360}
4137 {\tzwedgeAngleB}
4138 \c_colon_str
4139 \tzwedgeRadius )
4140 }
4141 {
4142 arc ( \IfBooleanTF {#2}
4143 {\tzwedgeAngleA - 360}
4144 {\tzwedgeAngleA}
4145 \c_colon_str
4146 \tzwedgeAngleB
4147 \c_colon_str
4148 \tzwedgeRadius )
4149 }
4150 }
4151
4152 \tzwedge_sub_fn:n
4153 }
4154
4155 \cs_new:Npn \tzwedge_sub_fn:n
4156 {
4157 \tzwedge_final_actions
4158 }
4159
4160 \NewDocumentCommand\tzwedge_final_actions{ +G{} O{} G{.3} }
4161 {
4162 \tl_if_empty:nTF { #3 }
4163 { \renewcommand\tzfillopacity{\tz@initial@fill@opacity} }
4164 { \renewcommand\tzfillopacity{#3} }
4165
4166 \tl_put_right:Nn \l_tzwedge_cmd_tl
4167 {
4168 node [ midway , #2 ] { #1 }
4169 }
4170
4171 \exp_last_unbraced:Nf \draw \l_tzwedge_cmd_tl -- cycle ;
4172 }
4173
4174 \NewDocumentCommand\tzwedge_args_process{ m m m }
4175 {
4176 \def\tzwedgeAngleA{#1}
4177 \def\tzwedgeAngleB{#2}
4178 \def\tzwedgeRadius{#3}
4179 }
4180
4181 %%% --- end of \tzwedge
4182
4183
4184 %%%%% Angles
4185
4186
4187 %%% \tzp
4188
4189 \NewDocumentCommand\tzpointangle{ r() r() m }
4190 {
4191 \pgfmathanglebetweenpoints{\pgfpointanchor{#1}{center}}%
4192 {\pgfpointanchor{#2}{center}}
4193 \edef#3{\pgfmathresult}
4194 % \tl_set:cx { #3 } { \pgfmathresult }
4195 }
4196
4197
4198
4199 %%% \tzanglemark (main)
4200
4201 \NewDocumentCommand\tzanglemark{ s t' o }
4202 {
4203 \tl_clear:N \l_tzanglemark_cmd_tl
4204
4205 \IfBooleanTF { #1 }
4206 { \bool_set_true:N \l_tmpa_bool }
4207 { \bool_set_false:N \l_tmpa_bool }
4208
4209 \IfBooleanTF { #2 }
4210 { \bool_set_true:N \l_tmpb_bool }
4211 { \bool_set_false:N \l_tmpb_bool }
4212
4213 \IfValueTF { #3 }
4214 { \tl_set:Nn \l_tzanglemark_opt_tl { #3 } }
4215 { \tl_clear:N \l_tzanglemark_opt_tl }
4216
4217 \tzanglemark_check_token:n
4218 }
4219
4220 \cs_new:Npn \tzanglemark_check_token:n #1
4221 {
4222 \str_if_eq:nnT { #1 } { ( }
4223 { \tzanglemark_sub_fn ( }
4224 }
4225
4226 \NewDocumentCommand\tzanglemark_sub_fn
4227 { r() r() r() +G{} O{}
4228 D(){\tz@initial@AA@radius} G{\tz@initial@fill@opacity}
4229 }
4230
4231 {
4232 \renewcommand\tzfillopacity{#7}
4233 \renewcommand\tzAAradius{#6}
4234
4235 \path (#1) coordinate (tzAng-A)
4236 (#2) coordinate (tzAng-B)
4237 (#3) coordinate (tzAng-C);
4238 \pgfmathanglebetweenpoints{\pgfpointanchor{tzAng-B}{center}}%
4239 {\pgfpointanchor{tzAng-A}{center}}
4240 \edef\tzangleONE{\pgfmathresult}
4241 \pgfmathanglebetweenpoints{\pgfpointanchor{tzAng-B}{center}}%
4242 {\pgfpointanchor{tzAng-C}{center}}
4243 \edef\tzangleTWO{\pgfmathresult}
4244
4245 \fp_set:Nn \l_tmpa_fp { \tzangleONE }
4246 \fp_set:Nn \l_tmpb_fp { \tzangleTWO }
4247
4248 \bool_if:NTF \l_tmpb_bool
4249 {
4250 \edef\tzangleresult{\fp_eval:n { 360 - abs(\l_tmpb_fp - \l_tmpa_fp) } }
4251 }
4252 {
4253 \edef\tzangleresult{\fp_eval:n { abs(\l_tmpb_fp - \l_tmpa_fp) } }
4254 }
4255
4256 % % test
4257 % \node (0,0) [align=left,right] {\tzangleresult \\ \halfangle};
4258
4259 \bool_if:NTF \l_tmpa_bool
4260 {
4261 \tl_put_right:No \l_tzanglemark_cmd_tl
4262 {
4263 [ \tzAAlinestyle , draw = none , fill = \tzfillcolor ,
4264 fill~opacity = \tzfillopacity , text~opacity = 1 ,
4265 }
4266 }
4267 {
4268 \tl_put_right:No \l_tzanglemark_cmd_tl
4269 {
4270 [ \tzAAlinestyle ,
4271 }
4272 }
4273
4274 \tl_put_right:No \l_tzanglemark_cmd_tl
4275 { \l_tzanglemark_opt_tl ] }
4276
4277 \bool_if:NTF \l_tmpa_bool
4278 {
4279 \tl_put_right:Nx \l_tzanglemark_cmd_tl
4280 { (#2) -- ++ (\tzangleONE \c_colon_str #6) }
4281 }
4282 {
4283 \tl_put_right:Nx \l_tzanglemark_cmd_tl
4284 { (#2) ++ (\tzangleONE \c_colon_str #6) }
4285 }
4286
4287 \tl_put_right:Nx \l_tzanglemark_cmd_tl
4288 {
4289 \fp_compare:nTF { \l_tmpa_fp < \l_tmpb_fp }
4290 {
4291 arc ( \tzangleONE
4292 \c_colon_str
4293 \bool_if:NTF \l_tmpb_bool
4294 { \tzangleTWO - 360 }
4295 { \tzangleTWO }
4296 \c_colon_str
4297 \tzAAradius ) node (tzAAmid) [midway] {}
4298 }
4299 {
4300 arc ( \bool_if:NTF \l_tmpb_bool
4301 { \tzangleONE -360 }
4302 { \tzangleONE }
4303 \c_colon_str
4304 \tzangleTWO
4305 \c_colon_str
4306 \tzAAradius ) node (tzAAmid) [midway] {}
4307 }
4308 }
4309
4310 \begin{pgfonlayer}{\tzanglelayer}
4311 \bool_if:NTF \l_tmpa_bool
4312 {
4313 \exp_last_unbraced:Nf
4314 \draw \l_tzanglemark_cmd_tl -- cycle ; %% -- cycle
4315 }
4316 {
4317 \exp_last_unbraced:Nf
4318 \draw \l_tzanglemark_cmd_tl ;
4319 }
4320 \end{pgfonlayer}
4321
4322 \path (#2) -- (tzAAmid.center) node [ pos = 1.5, #5 ] { #4 } ;
4323 }
4324
4325 %%% --- end of \tzanglemark
4326
4327
4328 %%% \tzanglefill (obsolete: to be removed)
4329
4330 \NewDocumentCommand\tzanglefill{ s t' o }
4331 {
4332 \tl_clear:N \l_tzanglefill_cmd_tl
4333
4334 \IfBooleanTF { #1 }
4335 { \bool_set_true:N \l_tmpa_bool }
4336 { \bool_set_false:N \l_tmpa_bool }
4337
4338 \IfBooleanTF { #2 }
4339 { \bool_set_true:N \l_tmpb_bool }
4340 { \bool_set_false:N \l_tmpb_bool }
4341
4342 \IfValueTF { #3 }
4343 { \tl_set:Nn \l_tzanglefill_opt_tl { #3 } }
4344 { \tl_clear:N \l_tzanglefill_opt_tl }
4345
4346 \tzanglefill_check_token:n
4347 }
4348
4349 \cs_new:Npn \tzanglefill_check_token:n #1
4350 {
4351 \str_if_eq:nnT { #1 } { ( }
4352 { \tzanglefill_sub_fn ( }
4353 }
4354
4355 \NewDocumentCommand\tzanglefill_sub_fn
4356 { r() r() r() +G{} O{} D(){10pt} G{\tz@initial@fill@opacity} }
4357
4358 {
4359 \renewcommand\tzfillopacity{#7}
4360
4361 \path (#1) coordinate (tzAng-A)
4362 (#2) coordinate (tzAng-B)
4363 (#3) coordinate (tzAng-C);
4364 \pgfmathanglebetweenpoints{\pgfpointanchor{tzAng-B}{center}}%
4365 {\pgfpointanchor{tzAng-A}{center}}
4366 \edef\tzangleONE{\pgfmathresult}
4367 \pgfmathanglebetweenpoints{\pgfpointanchor{tzAng-B}{center}}%
4368 {\pgfpointanchor{tzAng-C}{center}}
4369 \edef\tzangleTWO{\pgfmathresult}
4370
4371 \fp_set:Nn \l_tmpa_fp { \tzangleONE }
4372 \fp_set:Nn \l_tmpb_fp { \tzangleTWO }
4373
4374 \bool_if:NTF \l_tmpb_bool
4375 {
4376 \edef\tzangleresult{\fp_eval:n { 360 - abs(\l_tmpb_fp - \l_tmpa_fp) } }
4377 }
4378 {
4379 \edef\tzangleresult{\fp_eval:n { abs(\l_tmpb_fp - \l_tmpa_fp) } }
4380 }
4381
4382 % % test
4383 % \node (0,0) [align=left,right] {\tzangleresult};
4384
4385 \bool_if:NTF \l_tmpa_bool %%% (* NOT USED!)
4386 {
4387 \tl_put_right:No \l_tzanglefill_cmd_tl
4388 {
4389 [ \tzAAlinestyle , fill = \tzfillcolor ,
4390 fill~opacity = \tzfillopacity , text~opacity = 1 ,
4391 }
4392 }
4393 {
4394 \tl_put_right:No \l_tzanglefill_cmd_tl
4395 {
4396 [ \tzAAlinestyle , fill = \tzfillcolor ,
4397 fill~opacity = \tzfillopacity , text~opacity = 1 ,
4398 }
4399 }
4400
4401 \tl_put_right:No \l_tzanglefill_cmd_tl
4402 { \l_tzanglefill_opt_tl ] }
4403
4404 \tl_put_right:Nx \l_tzanglefill_cmd_tl
4405 { (#2) -- ++ (\tzangleONE \c_colon_str #6) }
4406
4407 \tl_put_right:Nx \l_tzanglefill_cmd_tl
4408 {
4409 \fp_compare:nTF { \l_tmpa_fp < \l_tmpb_fp }
4410 {
4411 arc ( \tzangleONE
4412 \c_colon_str
4413 \bool_if:NTF \l_tmpb_bool
4414 { \tzangleTWO - 360 }
4415 { \tzangleTWO }
4416 \c_colon_str
4417 #6 ) node (tzAAmid) [midway] {}
4418 }
4419 {
4420 arc ( \bool_if:NTF \l_tmpb_bool
4421 { \tzangleONE -360 }
4422 { \tzangleONE }
4423 \c_colon_str
4424 \tzangleTWO
4425 \c_colon_str
4426 #6 ) node (tzAAmid) [midway] {}
4427 }
4428 }
4429
4430 \begin{pgfonlayer}{\tzanglelayer}
4431 \exp_last_unbraced:Nf
4432 \path \l_tzanglefill_cmd_tl -- cycle ; %% -- cycle
4433 \end{pgfonlayer}
4434 \path (#2) -- (tzAAmid.center) node [ pos = 1.5, #5 ] { #4 } ;
4435 }
4436
4437 %%% --- end of \tzanglefill
4438
4439
4440
4441
4442 %%%(ADDED)
4443 %%% \tzrightanglemark (main)
4444
4445 \NewDocumentCommand\tzrightanglemark{ s t' o }
4446 {
4447 \tl_clear:N \l_tzrightanglemark_cmd_tl
4448 \tl_clear:N \l_tzrightanglemark_fill_cmd_tl
4449
4450 \IfBooleanTF { #1 }
4451 { \bool_set_true:N \l_tmpa_bool }
4452 { \bool_set_false:N \l_tmpa_bool }
4453
4454 \IfBooleanTF { #2 } % NOT USED (just to avoid frequent coding error)
4455 { \bool_set_true:N \l_tmpb_bool }
4456 { \bool_set_false:N \l_tmpb_bool }
4457
4458 \IfValueTF { #3 }
4459 { \tl_set:Nn \l_tzrightanglemark_opt_tl { #3 } }
4460 { \tl_clear:N \l_tzrightanglemark_opt_tl }
4461
4462 \tzrightanglemark_check_token:n
4463 }
4464
4465 \cs_new:Npn \tzrightanglemark_check_token:n #1
4466 {
4467 \str_if_eq:nnT { #1 } { ( }
4468 { \tzrightanglemark_sub_fn ( }
4469 }
4470
4471 \NewDocumentCommand\tzrightanglemark_sub_fn
4472 { r() r() r() +G{} O{} D(){\tz@initial@RA@size} G{\tz@initial@fill@opacity} }
4473
4474 {
4475 \renewcommand\tzfillopacity{#7}
4476 \renewcommand\tzRAsize{#6}
4477
4478 \coordinate (tzRAOne) at ($(#2)!\tzRAsize!(#1)$) ;
4479 \coordinate (tzRAThree) at ($(#2)!\tzRAsize!(#3)$) ;
4480 \coordinate (tzRAvertex) at ($(tzRAThree) + (tzRAOne) - (#2)$) ;
4481
4482 \bool_if:NTF \l_tmpa_bool
4483 {
4484 \tl_put_right:No \l_tzrightanglemark_cmd_tl
4485 {
4486 [ \tzAAlinestyle , draw = none ,
4487 fill = \tzfillcolor , fill~opacity = \tzfillopacity , text~opacity = 1 ,
4488 }
4489 }
4490 {
4491 \tl_put_right:No \l_tzrightanglemark_cmd_tl
4492 {
4493 [ \tzAAlinestyle ,
4494 }
4495 }
4496
4497 \tl_put_right:No \l_tzrightanglemark_cmd_tl
4498 { \l_tzrightanglemark_opt_tl ] }
4499
4500 \begin{pgfonlayer}{\tzanglelayer}
4501 \bool_if:NTF \l_tmpa_bool
4502 {
4503 \exp_last_unbraced:Nf
4504 \draw \l_tzrightanglemark_cmd_tl
4505 (#2) -- (tzRAOne) -- (tzRAvertex) -- (tzRAThree) -- cycle ;
4506 }
4507 {
4508 \exp_last_unbraced:Nf
4509 \draw \l_tzrightanglemark_cmd_tl
4510 (tzRAOne) -- (tzRAvertex) -- (tzRAThree) ;
4511 }
4512 \end{pgfonlayer}
4513 \path (#2) -- (tzRAvertex) node [ pos = 2 , #5 ] { #4 } ;
4514 }
4515
4516 %%% --- end of \tzrightanglemark
4517
4518
4519 %%% \tzrightanglefill (obsolete: to be removed)
4520
4521 \NewDocumentCommand\tzrightanglefill{ s t' o }
4522 {
4523 \tl_clear:N \l_tzrightanglefill_cmd_tl
4524
4525 \IfBooleanTF { #1 }
4526 { \bool_set_true:N \l_tmpa_bool }
4527 { \bool_set_false:N \l_tmpa_bool }
4528
4529 \IfBooleanTF { #2 }
4530 { \bool_set_true:N \l_tmpb_bool }
4531 { \bool_set_false:N \l_tmpb_bool }
4532
4533 \IfValueTF { #3 }
4534 { \tl_set:Nn \l_tzrightanglefill_opt_tl { #3 } }
4535 { \tl_clear:N \l_tzrightanglefill_opt_tl }
4536
4537 \tzrightanglefill_check_token:n
4538 }
4539
4540 \cs_new:Npn \tzrightanglefill_check_token:n #1
4541 {
4542 \str_if_eq:nnT { #1 } { ( }
4543 { \tzrightanglefill_sub_fn ( }
4544 }
4545
4546 \NewDocumentCommand\tzrightanglefill_sub_fn
4547 { r() r() r() +G{} O{} D(){5pt} G{\tz@initial@fill@opacity} }
4548
4549 {
4550 \renewcommand\tzfillopacity{#7}
4551
4552 \coordinate (tzRAOne) at ($(#2)!#6!(#1)$) ;
4553 \coordinate (tzRAThree) at ($(#2)!#6!(#3)$) ;
4554 \coordinate (tzRAvertex) at ($(tzRAThree) + (tzRAOne) - (#2)$) ;
4555
4556 \tl_put_right:Nn \l_tzrightanglefill_cmd_tl
4557 {
4558 [ very~thin ,
4559 }
4560
4561 \tl_put_right:Nn \l_tzrightanglefill_cmd_tl
4562 {
4563 fill = \tzfillcolor , fill~opacity = \tzfillopacity , text~opacity = 1 ,
4564 }
4565
4566 \tl_put_right:No \l_tzrightanglefill_cmd_tl
4567 { \l_tzrightanglefill_opt_tl ] }
4568
4569 \begin{pgfonlayer}{\tzanglelayer}
4570 \exp_last_unbraced:Nf
4571 \fill \l_tzrightanglefill_cmd_tl
4572 (#2) -- (tzRAOne) -- (tzRAvertex) -- (tzRAThree) -- cycle ;
4573 \end{pgfonlayer}
4574 \path (#2) -- (tzRAvertex) node [ pos = 2 , #5 ] { #4 } ;
4575 }
4576
4577 %%% --- end of \tzrightanglefill
4578
4579
4580
4581 %%%(ADDED)
4582 %%% \tzpicangle (to be removed)
4583 \NewDocumentCommand\tzpicangle
4584 { t' O{} O{} r() r() r() G{} O{1.5} D(){10pt} }
4585 {
4586 \IfBooleanTF #1
4587 {
4588 \begin{pgfonlayer}{background}
4589 \path [ #3 ] (#4) coordinate (tzangleA) --
4590 (#5) coordinate (tzangleB) --
4591 (#6) coordinate (tzangleC)
4592 pic [ draw , "#7" , angle~radius=#9 , angle~eccentricity = #8 , #2 ]
4593 { angle = tzangleC -- tzangleB -- tzangleA } ;
4594 % C to A (counter clockwise)
4595 \end{pgfonlayer}
4596 }
4597 {
4598 \begin{pgfonlayer}{background}
4599 \path [ #3 ] (#4) coordinate (tzangleA) --
4600 (#5) coordinate (tzangleB) --
4601 (#6) coordinate (tzangleC)
4602 pic [ draw , "#7" , angle~radius=#9 , angle~eccentricity = #8 , #2 ]
4603 { angle = tzangleA -- tzangleB -- tzangleC } ;
4604 % A to C (clockwise)
4605 \end{pgfonlayer}
4606 }
4607 }
4608
4609 %%% --- end of \tzpicangle
4610
4611
4612
4613 %%%%% plot coordinates (of TikZ)
4614
4615
4616 %%% \tzplot
4617
4618 \bool_new:N \l_tzplot_shift_coor_bool
4619 \bool_new:N \g_tzplot_BEGIN_cmd_bool
4620 \bool_new:N \g_tzplot_END_cmd_bool
4621
4622 %% \tzplotAtBegin
4623 \NewDocumentCommand\tzplotAtBegin{ m }
4624 {
4625 \bool_gset_true:N \g_tzplot_BEGIN_cmd_bool
4626 \tl_gset:No \g_tzplot_BEGIN_cmd_tl { #1 }
4627 }
4628
4629 %% \tzplotAtEnd
4630 \NewDocumentCommand\tzplotAtEnd{ m }
4631 {
4632 \bool_gset_true:N \g_tzplot_END_cmd_bool
4633 \tl_gset:No \g_tzplot_END_cmd_tl { #1 }
4634 }
4635
4636 %%% \tzplot (main)
4637 \NewDocumentCommand\tzplot{ s O{} G{0} O{} d<> D""{} }
4638 {
4639 \tl_clear:N \l_tzplot_opt_tl % [opt]
4640 \tl_clear:N \l_tzplot_TEMP_opt_tl % for path only: [opt,mark=none]
4641 \tl_clear:N \l_tzplot_plot_coordinates_tl % plot coordinates
4642 \tl_clear:N \l_tzplot_coors_tl % {(coor-1)(coor-2)...(coor-n)}
4643 \tl_clear:N \l_tzplot_code_at_end_tl % <code.append>
4644 \tl_clear:N \l_tzplot_nodes_tl
4645
4646 \renewcommand\tzmarksize{\tz@initial@mark@size}
4647
4648 \tl_put_right:Nn \l_tzplot_opt_tl
4649 {
4650 [
4651 name~path = #6 ,
4652 tension = #3 ,
4653 smooth ,
4654 tzmark = \tzmarksize ,
4655 }
4656
4657 %% closing options
4658 % if AtBegin_true, USE mark=none (for path only)
4659 \bool_if:NT \g_tzplot_BEGIN_cmd_bool
4660 {
4661 \tl_set_eq:NN \l_tzplot_TEMP_opt_tl \l_tzplot_opt_tl
4662 \tl_put_right:Nn \l_tzplot_TEMP_opt_tl { mark = none ] }
4663 }
4664 % (normal)
4665 \IfBooleanTF { #1 }
4666 {
4667 \tl_put_right:Nn \l_tzplot_opt_tl
4668 { mark = * , draw = none , #2 ] }
4669 }
4670 {
4671 \tl_put_right:Nn \l_tzplot_opt_tl
4672 { #2 ] }
4673 }
4674 \IfValueTF { #5 }
4675 {
4676 \tl_set:Nn \l_tzplot_shift_coor_tl { #5 }
4677 \bool_set_true:N \l_tzplot_shift_coor_bool
4678 }
4679 {
4680 \tl_clear:N \l_tzplot_shift_coor_tl
4681 \bool_set_false:N \l_tzplot_shift_coor_bool
4682 }
4683
4684 \tl_put_right:Nn \l_tzplot_plot_coordinates_tl
4685 { plot [ #4 ] coordinates }
4686 \tzplot_check_token:n
4687 }
4688
4689 \cs_new:Npn \tzplot_check_token:n #1
4690 {
4691 % \token_if_eq_charcode:NNTF #1 (
4692 % { \tzplot_sub_fn #1 }
4693 % { \tzplot_stop_action }
4694 \str_case:nnF { #1 }
4695 {
4696 { ( } { \tzplot_sub_fn #1 }
4697 { ; } { \tzplot_late_opt_fn }
4698 }
4699 {
4700 % \tzplot_stop_action
4701 \msg_error:nn { tzplot } { semicolon-error }
4702 }
4703 }
4704
4705 \NewDocumentCommand\tzplot_sub_fn{ r() +G{} >{\TrimSpaces}o }
4706 {
4707 %%%%%% to use string replacement for label positions
4708 \IfValueTF { #3 }
4709 {
4710 \tl_if_in:nnTF { #3 } { [ }
4711 { \extract_posopt:w #3 \q_stop } % ndh
4712 {
4713 \tl_set:Nx \l_label_pos_str_trimmed_tl { \tl_trim_spaces:n { #3 } }
4714 \str_case_e:nnF { \l_label_pos_str_trimmed_tl }
4715 {
4716 {l} { \tl_set:Nn \l_label_pos_str_tl {left} }
4717 {r} { \tl_set:Nn \l_label_pos_str_tl {right} }
4718 {a} { \tl_set:Nn \l_label_pos_str_tl {above} }
4719 {b} { \tl_set:Nn \l_label_pos_str_tl {below} }
4720 {c} { \tl_set:Nn \l_label_pos_str_tl {center} }
4721 {al} { \tl_set:Nn \l_label_pos_str_tl {above~left} }
4722 {ar} { \tl_set:Nn \l_label_pos_str_tl {above~right} }
4723 {bl} { \tl_set:Nn \l_label_pos_str_tl {below~left} }
4724 {br} { \tl_set:Nn \l_label_pos_str_tl {below~right} }
4725 }
4726 {
4727 \tl_set:Nn \l_label_pos_str_tl { #3 }
4728 }
4729 }
4730 }
4731 {
4732 \tl_clear:N \l_label_pos_str_tl
4733 }
4734 %%%%%%%%%%
4735 % collect coordinates only
4736 \bool_if:NTF \l_tzplot_shift_coor_bool
4737 {
4738 \tl_put_right:Nx \l_tzplot_coors_tl
4739 { ( [ shift = { (\l_tzplot_shift_coor_tl) } ] \exp_not:n { #1 } ) }
4740 }
4741 {
4742 \tl_put_right:Nn \l_tzplot_coors_tl { (#1) }
4743 }
4744 % collect nodes information
4745 \bool_if:NTF \l_tzplot_shift_coor_bool
4746 {
4747 \tl_put_right:Nx \l_tzplot_nodes_tl
4748 { ( [ shift = { (\l_tzplot_shift_coor_tl) } ] \exp_not:n { #1 } ) }
4749 }
4750 {
4751 \tl_put_right:Nn \l_tzplot_nodes_tl { (#1) }
4752 }
4753 \tl_put_right:Nx \l_tzplot_nodes_tl
4754 {
4755 node
4756 [ label = { \l_label_pos_str_tl \c_colon_str \exp_not:n { #2 } } % pos_str
4757 ] {}
4758 }
4759 \tzplot_check_token:n
4760 }
4761
4762 \NewDocumentCommand\tzplot_late_opt_fn { d() D<>{} }
4763 {
4764 \IfValueTF { #1 }
4765 { \edef\tztmpMarkSize { #1 } }
4766 { \edef\tztmpMarkSize { \tz@initial@mark@size } }
4767 \tl_put_right:Nn \l_tzplot_code_at_end_tl { #2 }
4768 \tzplot_stop_action
4769 }
4770
4771 \NewDocumentCommand\tzplot_stop_action {}
4772 {
4773 \renewcommand\tzmarksize{ \tztmpMarkSize }
4774 %% final action cases:
4775 \bool_if:NTF \g_tzplot_BEGIN_cmd_bool
4776 { %% if AtBegin_true
4777 % define (tzCSPS) by path (WITH \l_tzplot_TEMP_opt_tl )
4778 \exp_last_unbraced:Nf
4779 \path
4780 \l_tzplot_TEMP_opt_tl
4781 \l_tzplot_plot_coordinates_tl
4782 { \l_tzplot_coors_tl }
4783 ;
4784 \path (current~subpath~start) coordinate (tzCSPS) ;
4785 % all together (important)
4786 \tl_clear:N \l_tmpa_tl % (2022/08/31 ndh)
4787 \tl_put_right:No \l_tmpa_tl { \g_tzplot_BEGIN_cmd_tl }
4788 \tl_put_right:Nn \l_tmpa_tl { (tzCSPS) -- }
4789 \tl_put_right:No \l_tmpa_tl { \l_tzplot_plot_coordinates_tl } % important
4790 \bool_if:NTF \g_tzplot_END_cmd_bool
4791 { %% if AtEnd_true
4792 % append AtBegin, AtEnd
4793 % plot AtBegin, (coors), and AtEnd (WITH \l_tzplot_opt_tl)
4794 \exp_last_unbraced:Nf
4795 \draw
4796 \l_tzplot_opt_tl
4797 \l_tmpa_tl % AtBegin + plot coordinates
4798 { \l_tzplot_coors_tl }
4799 \g_tzplot_END_cmd_tl % AtEnd
4800 \l_tzplot_code_at_end_tl
4801 \l_tzplot_nodes_tl
4802 ;
4803 }
4804 { %% if AtEnd_false
4805 % plot AtBegin and (coors)
4806 \exp_last_unbraced:Nf
4807 \draw
4808 \l_tzplot_opt_tl
4809 \l_tmpa_tl % AtBegin + plot coordinates
4810 { \l_tzplot_coors_tl }
4811 % \g_tzplot_END_cmd_tl % AtEnd
4812 \l_tzplot_code_at_end_tl
4813 \l_tzplot_nodes_tl
4814 ;
4815
4816 }
4817 }
4818 { %% if AtBegin_false
4819 \bool_if:NTF \g_tzplot_END_cmd_bool
4820 { %% if AtEnd_true
4821 % append AtBegin, AtEnd
4822 % plot AtBegin, (coors), and AtEnd (WITH \l_tzplot_opt_tl)
4823 \exp_last_unbraced:Nf
4824 \draw
4825 \l_tzplot_opt_tl
4826 \l_tzplot_plot_coordinates_tl
4827 { \l_tzplot_coors_tl }
4828 \g_tzplot_END_cmd_tl % AtEnd
4829 \l_tzplot_code_at_end_tl
4830 \l_tzplot_nodes_tl
4831 ;
4832 }
4833 { %% if AtEnd_false
4834 % normal
4835 \exp_last_unbraced:Nf
4836 \draw
4837 \l_tzplot_opt_tl % [opt]
4838 \l_tzplot_plot_coordinates_tl % plot coordinates
4839 { \l_tzplot_coors_tl } % { (coor-1)(coor-2)...(coor-n) }
4840 % \g_tzplot_END_cmd_tl % AtEnd
4841 \l_tzplot_code_at_end_tl % <code.append>
4842 \l_tzplot_nodes_tl % (coor-i) node [opt] {text}, all i
4843 ;
4844 }
4845 }
4846
4847 \bool_gset_false:N \g_tzplot_BEGIN_cmd_bool
4848 \bool_gset_false:N \g_tzplot_END_cmd_bool
4849 }
4850
4851 %%% --- end of \tzplot
4852
4853
4854 %%% \tzplotcurve
4855
4856 \bool_new:N \l_tzplotcurve_shift_coor_bool
4857 \bool_new:N \g_tzplotcurve_BEGIN_cmd_bool
4858 \bool_new:N \g_tzplotcurve_END_cmd_bool
4859
4860 %% \tzplotcurveAtBegin
4861 \NewDocumentCommand\tzplotcurveAtBegin{ m }
4862 {
4863 \bool_gset_true:N \g_tzplotcurve_BEGIN_cmd_bool
4864 \tl_gset:No \g_tzplotcurve_BEGIN_cmd_tl { #1 }
4865 }
4866
4867 %% \tzplotcurveAtEnd
4868 \NewDocumentCommand\tzplotcurveAtEnd{ m }
4869 {
4870 \bool_gset_true:N \g_tzplotcurve_END_cmd_bool
4871 \tl_gset:No \g_tzplotcurve_END_cmd_tl { #1 }
4872 }
4873
4874
4875 %%% \tzplotcurve (main)
4876 \NewDocumentCommand\tzplotcurve{ s O{} G{1} O{} d<> D""{} }
4877 {
4878 \tl_clear:N \l_tzplotcurve_opt_tl % [opt]
4879 \tl_clear:N \l_tzplotcurve_TEMP_opt_tl % for path only: [opt,mark=none]
4880 \tl_clear:N \l_tzplotcurve_plot_coordinates_tl % plot coordinates
4881 \tl_clear:N \l_tzplotcurve_coors_tl % {(coor-1)(coor-2)...(coor-n)}
4882 \tl_clear:N \l_tzplotcurve_code_at_end_tl % <code.append>
4883 \tl_clear:N \l_tzplotcurve_nodes_tl
4884
4885 \renewcommand\tzmarksize{\tz@initial@mark@size}
4886
4887 \tl_put_right:Nn \l_tzplotcurve_opt_tl
4888 {
4889 [ name~path = #6 ,
4890 tension = #3 ,
4891 smooth ,
4892 tzmark = \tzmarksize ,
4893 }
4894
4895 %% closing options
4896 % if AtBegin_true, USE mark=none (for path only)
4897 \bool_if:NT \g_tzplotcurve_BEGIN_cmd_bool
4898 {
4899 \tl_set_eq:NN \l_tzplotcurve_TEMP_opt_tl \l_tzplotcurve_opt_tl
4900 \tl_put_right:Nn \l_tzplotcurve_TEMP_opt_tl { mark = none ] }
4901 }
4902 % (normal)
4903 \IfBooleanTF { #1 }
4904 {
4905 \tl_put_right:Nn \l_tzplotcurve_opt_tl { mark = * , #2 ] }
4906 }
4907 {
4908 \tl_put_right:Nn \l_tzplotcurve_opt_tl { #2 ] }
4909 }
4910
4911 \IfValueTF { #5 }
4912 {
4913 \tl_set:Nn \l_tzplotcurve_shift_coor_tl { #5 }
4914 \bool_set_true:N \l_tzplotcurve_shift_coor_bool
4915 }
4916 {
4917 \tl_clear:N \l_tzplotcurve_shift_coor_tl
4918 \bool_set_false:N \l_tzplotcurve_shift_coor_bool
4919 }
4920
4921 \tl_put_right:Nn \l_tzplotcurve_plot_coordinates_tl
4922 { plot [ #4 ] coordinates }
4923 \tzplotcurve_check_token:n
4924 }
4925
4926 \cs_new:Npn \tzplotcurve_check_token:n #1
4927 {
4928 % \token_if_eq_charcode:NNTF #1 (
4929 % { \tzplotcurve_sub_fn #1 }
4930 % { \tzplotcurve_stop_action }
4931 \str_case:nnF { #1 }
4932 {
4933 { ( } { \tzplotcurve_sub_fn #1 }
4934 { ; } { \tzplotcurve_late_opt_fn }
4935 }
4936 {
4937 % \tzplotcurve_stop_action
4938 \msg_error:nn { tzplot } { semicolon-error }
4939 }
4940 }
4941
4942 \NewDocumentCommand\tzplotcurve_sub_fn{ r() +G{} >{\TrimSpaces}o }
4943 {
4944 %%%%%% to use string replacement for label positions
4945 \IfValueTF { #3 }
4946 {
4947 \tl_if_in:nnTF { #3 } { [ }
4948 { \extract_posopt:w #3 \q_stop } % ndh
4949 {
4950 \tl_set:Nx \l_label_pos_str_trimmed_tl { \tl_trim_spaces:n { #3 } }
4951 \str_case_e:nnF { \l_label_pos_str_trimmed_tl }
4952 {
4953 {l} { \tl_set:Nn \l_label_pos_str_tl {left} }
4954 {r} { \tl_set:Nn \l_label_pos_str_tl {right} }
4955 {a} { \tl_set:Nn \l_label_pos_str_tl {above} }
4956 {b} { \tl_set:Nn \l_label_pos_str_tl {below} }
4957 {c} { \tl_set:Nn \l_label_pos_str_tl {center} }
4958 {al} { \tl_set:Nn \l_label_pos_str_tl {above~left} }
4959 {ar} { \tl_set:Nn \l_label_pos_str_tl {above~right} }
4960 {bl} { \tl_set:Nn \l_label_pos_str_tl {below~left} }
4961 {br} { \tl_set:Nn \l_label_pos_str_tl {below~right} }
4962 }
4963 {
4964 \tl_set:Nn \l_label_pos_str_tl { #3 }
4965 }
4966 }
4967 }
4968 {
4969 \tl_clear:N \l_label_pos_str_tl
4970 }
4971 %%%%%%%%%%
4972 % collect coordinates only
4973 \bool_if:NTF \l_tzplotcurve_shift_coor_bool
4974 {
4975 \tl_put_right:Nx \l_tzplotcurve_coors_tl
4976 { ( [ shift = { (\l_tzplotcurve_shift_coor_tl) } ] \exp_not:n { #1 } ) }
4977 }
4978 {
4979 \tl_put_right:Nn \l_tzplotcurve_coors_tl { (#1) }
4980 }
4981 % collect nodes information
4982 \bool_if:NTF \l_tzplotcurve_shift_coor_bool
4983 {
4984 \tl_put_right:Nx \l_tzplotcurve_nodes_tl
4985 { ( [ shift = { (\l_tzplotcurve_shift_coor_tl) } ] \exp_not:n { #1 } ) }
4986 }
4987 {
4988 \tl_put_right:Nn \l_tzplotcurve_nodes_tl { (#1) }
4989 }
4990 \tl_put_right:Nx \l_tzplotcurve_nodes_tl
4991 { node
4992 [ label = { \l_label_pos_str_tl \c_colon_str \exp_not:n { #2 } } % pos_str
4993 ] {}
4994 }
4995 \tzplotcurve_check_token:n
4996 }
4997
4998 \NewDocumentCommand\tzplotcurve_late_opt_fn { d() D<>{} }
4999 {
5000 \IfValueTF { #1 }
5001 { \edef\tztmpMarkSize { #1 } }
5002 { \edef\tztmpMarkSize { \tz@initial@mark@size } }
5003 \tl_put_right:Nn \l_tzplotcurve_code_at_end_tl { #2 }
5004 \tzplotcurve_stop_action
5005 }
5006
5007 \NewDocumentCommand\tzplotcurve_stop_action {}
5008 {
5009 \renewcommand\tzmarksize{ \tztmpMarkSize }
5010 %% final action cases:
5011 \bool_if:NTF \g_tzplotcurve_BEGIN_cmd_bool
5012 { %% if AtBegin_true
5013 % define (tzCSPS) by path (WITH \l_tzplotcurve_TEMP_opt_tl )
5014 \exp_last_unbraced:Nf
5015 \path
5016 \l_tzplotcurve_TEMP_opt_tl
5017 \l_tzplotcurve_plot_coordinates_tl
5018 { \l_tzplotcurve_coors_tl }
5019 ;
5020 \path (current~subpath~start) coordinate (tzCSPS) ;
5021 % all together (important)
5022 \tl_clear:N \l_tmpa_tl % (2022/08/31 ndh)
5023 \tl_put_right:No \l_tmpa_tl { \g_tzplotcurve_BEGIN_cmd_tl }
5024 \tl_put_right:Nn \l_tmpa_tl { (tzCSPS) -- }
5025 \tl_put_right:No \l_tmpa_tl { \l_tzplotcurve_plot_coordinates_tl } % important
5026 \bool_if:NTF \g_tzplotcurve_END_cmd_bool
5027 { %% if AtEnd_true
5028 % append AtBegin, AtEnd
5029 % plot AtBegin, (coors), and AtEnd (WITH \l_tzplotcurve_opt_tl)
5030 \exp_last_unbraced:Nf
5031 \draw
5032 \l_tzplotcurve_opt_tl
5033 \l_tmpa_tl % AtBegin + plot coordinates
5034 { \l_tzplotcurve_coors_tl }
5035 \g_tzplotcurve_END_cmd_tl % AtEnd
5036 \l_tzplotcurve_code_at_end_tl
5037 \l_tzplotcurve_nodes_tl
5038 ;
5039 }
5040 { %% if AtEnd_false
5041 % plot AtBegin and (coors)
5042 \exp_last_unbraced:Nf
5043 \draw
5044 \l_tzplotcurve_opt_tl
5045 \l_tmpa_tl % AtBegin + plot coordinates
5046 { \l_tzplotcurve_coors_tl }
5047 % \g_tzplotcurve_END_cmd_tl % AtEnd
5048 \l_tzplotcurve_code_at_end_tl
5049 \l_tzplotcurve_nodes_tl
5050 ;
5051
5052 }
5053 }
5054 { %% if AtBegin_false
5055 \bool_if:NTF \g_tzplotcurve_END_cmd_bool
5056 { %% if AtEnd_true
5057 % append AtBegin, AtEnd
5058 % plot AtBegin, (coors), and AtEnd (WITH \l_tzplotcurve_opt_tl)
5059 \exp_last_unbraced:Nf
5060 \draw
5061 \l_tzplotcurve_opt_tl
5062 \l_tzplotcurve_plot_coordinates_tl
5063 { \l_tzplotcurve_coors_tl }
5064 \g_tzplotcurve_END_cmd_tl % AtEnd
5065 \l_tzplotcurve_code_at_end_tl
5066 \l_tzplotcurve_nodes_tl
5067 ;
5068 }
5069 { %% if AtEnd_false
5070 % normal
5071 \exp_last_unbraced:Nf
5072 \draw
5073 \l_tzplotcurve_opt_tl % [opt]
5074 \l_tzplotcurve_plot_coordinates_tl % plot coordinates
5075 { \l_tzplotcurve_coors_tl } % { (coor-1)(coor-2)...(coor-n) }
5076 % \g_tzplotcurve_END_cmd_tl % AtEnd
5077 \l_tzplotcurve_code_at_end_tl % <code.append>
5078 \l_tzplotcurve_nodes_tl % (coor-i) node [opt] {text}, all i
5079 ;
5080 }
5081 }
5082
5083 \bool_gset_false:N \g_tzplotcurve_BEGIN_cmd_bool
5084 \bool_gset_false:N \g_tzplotcurve_END_cmd_bool
5085 }
5086
5087 %%% --- end of \tzplotcurve
5088
5089
5090 %%(ADDED)
5091 %%% \tzplotfile
5092 \NewDocumentCommand\tzplotfile{ O{} m O{} }
5093 {
5094 \draw [ #1 ] plot [ smooth , #3 ] file { #2 } ;
5095 }
5096
5097 %%% --- end of \tzplotfile
5098
5099
5100 %%%%% Plot functions
5101
5102 %%% \tzdeffn
5103 \NewDocumentCommand\tzdeffn{ m m }
5104 {
5105 \tl_set:cn { #1 } { #2 }
5106 }
5107 %% USAGE: \tzdeffn{Fx}{2*\x+1}
5108
5109 %%% \tzdeffnofy
5110 \NewDocumentCommand\tzdeffnofy{ m m }
5111 {
5112 \tl_set:cn { #1 } { #2 }
5113 }
5114 %% just a reminder of using \y instead of \x
5115 %% USAGE: \tzdeffn'{Gy}{2*\y+1}
5116
5117
5118 %%% \tzdefLFn
5119 \NewDocumentCommand\tzdefLFn{ m r() d() G{1} }
5120 {
5121 \IfNoValueTF { #3 }
5122 {
5123 \tzgetxyval(#2){\tzdefLFnXvalS}{\tzdefLFnYvalS}
5124 \def#1{#4*(\x-\tzdefLFnXvalS)+\tzdefLFnYvalS}
5125 }
5126 {
5127 \tzgetxyval(#2){\tzdefLFnXval}{\tzdefLFnYval}
5128 \tzgetxyval(#3){\tzdefLFnXXval}{\tzdefLFnYYval}
5129 \fp_compare:nT { \tzdefLFnXXval - \tzdefLFnXval = 0 }
5130 { \msg_error:nn { tzplot } { infinite~slope~error } }
5131 \edef\tzdefLFnSlope{%
5132 (\tzdefLFnYYval-\tzdefLFnYval)/(\tzdefLFnXXval-\tzdefLFnXval)
5133 }
5134 \def#1{\tzdefLFnSlope*(\x-\tzdefLFnXval)+\tzdefLFnYval}
5135 }
5136 }
5137
5138 %%% \tzdefLFnofy
5139 \NewDocumentCommand\tzdefLFnofy{ m r() d() G{1} }
5140 { % linear function of \y
5141 \IfNoValueTF { #3 }
5142 {
5143 \tzgetxyval(#2){\tzdefLFnofyXvalS}{\tzdefLFnofyYvalS}
5144 \def#1{#4*(\y-\tzdefLFnofyYvalS)+\tzdefLFnofyXvalS}
5145 }
5146 {
5147 \tzgetxyval(#2){\tzdefLFnofyXval}{\tzdefLFnofyYval}
5148 \tzgetxyval(#3){\tzdefLFnofyXXval}{\tzdefLFnofyYYval}
5149 \fp_compare:nT { \tzdefLFnofyYYval - \tzdefLFnofyYval = 0 }
5150 { \msg_error:nn { tzplot } { infinite~slope~error } }
5151 \edef\tzdefLFnofySlope{%
5152 (\tzdefLFnofyXXval-\tzdefLFnofyXval)/(\tzdefLFnofyYYval-\tzdefLFnofyYval)
5153 }
5154 \def#1{\tzdefLFnofySlope*(\y-\tzdefLFnofyYval)+\tzdefLFnofyXval}
5155 }
5156 }
5157
5158
5159
5160 %%% \tzLFn -- plot Linear Function (LF)
5161
5162 \bool_new:N \g_tzLFn_BEGIN_cmd_bool
5163 \bool_new:N \g_tzLFn_END_cmd_bool
5164
5165 %% \tzLFnAtBegin
5166 \NewDocumentCommand\tzLFnAtBegin{ m }
5167 {
5168 \bool_gset_true:N \g_tzLFn_BEGIN_cmd_bool
5169 \tl_gset:No \g_tzLFn_BEGIN_cmd_tl { #1 }
5170 }
5171
5172 %% \tzLFnAtEnd
5173 \NewDocumentCommand\tzLFnAtEnd{ m }
5174 {
5175 \bool_gset_true:N \g_tzLFn_END_cmd_bool
5176 \tl_gset:No \g_tzLFn_END_cmd_tl { #1 }
5177 }
5178
5179 %%% \tzLFn (main)
5180 %% \tzLFn : variable = \x (default)
5181
5182 \NewDocumentCommand \tzLFn { t' o D<>{0,0} d"" }
5183 {
5184 \tl_clear:N \l_tzLFn_opt_tl
5185 \tl_clear:N \l_tzLFn_path_tl
5186 \tl_clear:N \l_tzLFn_TEMP_cmd_tl
5187 \tl_clear:N \l_tzLFn_cmd_tl
5188
5189 \IfBooleanTF { #1 }
5190 { \bool_set_true:N \l_tmpa_bool }
5191 { \bool_set_false:N \l_tmpa_bool }
5192
5193 \IfValueTF { #3 }
5194 {
5195 \tl_set:Nn \l_tzLFn_shift_tl
5196 { shift = { (#3) } }
5197 }
5198 { \tl_clear:N \l_tzLFn_shift_tl }
5199
5200 \IfValueTF { #2 }
5201 { \tl_set:Nn \l_tzLFn_user_opt_tl { #2 } }
5202 { \tl_clear:N \l_tzLFn_user_opt_tl }
5203
5204 \IfValueTF { #4 }
5205 { \tl_set:Nn \l_tzLFn_namepath_tl { name~path = #4 } }
5206 { \tl_clear:N \l_tzLFn_namepath_tl }
5207
5208 \tzLFn_check_token:n
5209 }
5210
5211 \cs_new:Npn \tzLFn_check_token:n #1
5212 {
5213 \str_if_eq:nnT { #1 } { ( }
5214 { \tzLFn_sub_fn ( }
5215 }
5216
5217 \use:x{
5218 \NewDocumentCommand \exp_not:N \tzLFn_sub_fn
5219 { r() d() G{1}
5220 >{ \SplitArgument {1} { \tl_to_str:n {:} } } r[] + G{} O{} D<>{}
5221 }
5222 }
5223 {
5224 \tzLFn_domain_process #4
5225
5226 \tl_put_right:Nx \l_tzLFn_opt_tl
5227 {
5228 [
5229 % samples = 201 ,
5230 \l_tzLFn_namepath_tl ,
5231 domain = \tzLFnFromVal \c_colon_str \tzLFnToVal , %%% [here?]
5232 % variable = \exp_not:n { \x } ,
5233 \l_tzLFn_shift_tl ,
5234 }
5235 \tl_put_right:No \l_tzLFn_opt_tl
5236 {
5237 \l_tzLFn_user_opt_tl
5238 ]
5239 }
5240
5241 % define LF: (X,Y)(XX,YY){slope num: dY/dX}
5242 \IfNoValueTF { #2 }
5243 {
5244 \tzgetxyval(#1){\tzLFnXvalS}{\tzLFnYvalS}
5245 \def\tzLFnDEF{#3*(\x-\tzLFnXvalS)+\tzLFnYvalS}
5246 }
5247 {
5248 \tzgetxyval(#1){\tzLFnXval}{\tzLFnYval}
5249 \tzgetxyval(#2){\tzLFnXXval}{\tzLFnYYval}
5250 \fp_compare:nT { \tzLFnXXval - \tzLFnXval = 0 }
5251 { \msg_error:nn { tzplot } { infinite~slope~error } }
5252 \edef\tzLFSlope{(\tzLFnYYval-\tzLFnYval)/(\tzLFnXXval-\tzLFnXval)}
5253 \def\tzLFnDEF{\tzLFSlope*(\x-\tzLFnXval)+\tzLFnYval}
5254 }
5255
5256 \bool_if:NTF \l_tmpa_bool
5257 {
5258 \tl_put_right:Nn \l_tzLFn_path_tl
5259 { plot ( { \tzLFnDEF } , \x ) } % \x should not be expanded
5260 }
5261 {
5262 \tl_put_right:Nn \l_tzLFn_path_tl
5263 { plot ( \x , { \tzLFnDEF } ) } % \x should not be expanded
5264 }
5265 % to resolve AtBegin issue with "plot" operation
5266 \bool_if:NTF \g_tzLFn_BEGIN_cmd_bool
5267 {
5268 \tl_put_right:No \l_tzLFn_TEMP_cmd_tl { \l_tzLFn_opt_tl }
5269 \tl_put_right:No \l_tzLFn_TEMP_cmd_tl { \l_tzLFn_path_tl }
5270 \exp_last_unbraced:Nf \path \l_tzLFn_TEMP_cmd_tl ;
5271 \path (current~subpath~start) coordinate (tzCSPS) ;
5272 \tl_put_right:No \l_tzLFn_cmd_tl { \l_tzLFn_opt_tl }
5273 \tl_put_right:No \l_tzLFn_cmd_tl { \g_tzLFn_BEGIN_cmd_tl } % insert
5274 \tl_put_right:Nn \l_tzLFn_cmd_tl { (tzCSPS) -- } %
5275 \tl_put_right:No \l_tzLFn_cmd_tl { \l_tzLFn_path_tl }
5276 }
5277 {
5278 \tl_put_right:No \l_tzLFn_cmd_tl { \l_tzLFn_opt_tl }
5279 \tl_put_right:No \l_tzLFn_cmd_tl { \l_tzLFn_path_tl }
5280 }
5281 \bool_if:NT \g_tzLFn_END_cmd_bool
5282 {
5283 \tl_put_right:No \l_tzLFn_cmd_tl { \g_tzLFn_END_cmd_tl } % append
5284 }
5285 \tl_put_right:Nn \l_tzLFn_cmd_tl
5286 { node [ #6 ] { #5 } }
5287 % final action
5288 \exp_last_unbraced:Nf \draw \l_tzLFn_cmd_tl #7 ;
5289
5290 \bool_gset_false:N \g_tzLFn_BEGIN_cmd_bool
5291 \bool_gset_false:N \g_tzLFn_END_cmd_bool
5292 }
5293
5294 \NewDocumentCommand\tzLFn_domain_process{ m m }
5295 {
5296 \def\tzLFnFromVal{#1}
5297 \def\tzLFnToVal{#2}
5298 }
5299
5300 %%% --- end of \tzLFn
5301
5302
5303
5304 %%% \tzLFnofy
5305 %% variable = \y
5306
5307 \bool_new:N \g_tzLFnofy_BEGIN_cmd_bool
5308 \bool_new:N \g_tzLFnofy_END_cmd_bool
5309
5310 %% \tzLFnofyAtBegin
5311 \NewDocumentCommand\tzLFnofyAtBegin{ m }
5312 {
5313 \bool_gset_true:N \g_tzLFnofy_BEGIN_cmd_bool
5314 \tl_gset:No \g_tzLFnofy_BEGIN_cmd_tl { #1 }
5315 }
5316
5317 %% \tzLFnofyAtEnd
5318 \NewDocumentCommand\tzLFnofyAtEnd{ m }
5319 {
5320 \bool_gset_true:N \g_tzLFnofy_END_cmd_bool
5321 \tl_gset:No \g_tzLFnofy_END_cmd_tl { #1 }
5322 }
5323
5324 %%% \tzLFnofy (main)
5325 %% \tzLFnofy : variable = \y
5326 \NewDocumentCommand \tzLFnofy { t' o D<>{0,0} d"" }
5327 {
5328 \tl_clear:N \l_tzLFnofy_opt_tl
5329 \tl_clear:N \l_tzLFnofy_path_tl
5330 \tl_clear:N \l_tzLFnofy_TEMP_cmd_tl
5331 \tl_clear:N \l_tzLFnofy_cmd_tl
5332
5333 \IfBooleanTF { #1 }
5334 { \bool_set_true:N \l_tmpa_bool }
5335 { \bool_set_false:N \l_tmpa_bool }
5336
5337 \IfValueTF { #3 }
5338 {
5339 \tl_set:Nn \l_tzLFnofy_shift_tl
5340 { shift = { (#3) } }
5341 }
5342 { \tl_clear:N \l_tzLFnofy_shift_tl }
5343
5344 \IfValueTF { #2 }
5345 { \tl_set:Nn \l_tzLFnofy_user_opt_tl { #2 } }
5346 { \tl_clear:N \l_tzLFnofy_user_opt_tl }
5347
5348 \IfValueTF { #4 }
5349 { \tl_set:Nn \l_tzLFnofy_namepath_tl { name~path = #4 } }
5350 { \tl_clear:N \l_tzLFnofy_namepath_tl }
5351
5352 \tzLFnofy_check_token:n
5353 }
5354
5355 \cs_new:Npn \tzLFnofy_check_token:n #1
5356 {
5357 \str_if_eq:nnT { #1 } { ( }
5358 { \tzLFnofy_sub_fn ( }
5359 }
5360
5361 \use:x{
5362 \NewDocumentCommand \exp_not:N \tzLFnofy_sub_fn
5363 { r() d() G{1}
5364 >{ \SplitArgument {1} { \tl_to_str:n {:} } } r[] + G{} O{} D<>{}
5365 }
5366 }
5367 {
5368 \tzLFnofy_domain_process #4
5369
5370 \tl_put_right:Nx \l_tzLFnofy_opt_tl
5371 {
5372 [
5373 % samples = 201 ,
5374 \l_tzLFnofy_namepath_tl ,
5375 domain = \tzLFnofyFromVal \c_colon_str \tzLFnofyToVal , %%% [here?]
5376 variable = \exp_not:n { \y } ,
5377 \l_tzLFnofy_shift_tl ,
5378 }
5379 \tl_put_right:No \l_tzLFnofy_opt_tl
5380 {
5381 \l_tzLFnofy_user_opt_tl
5382 ]
5383 }
5384
5385 % define LFofy: (X,Y)(XX,YY){slope num: dX/dY}
5386 \IfNoValueTF { #2 }
5387 {
5388 \tzgetxyval(#1){\tzLFnofyXvalS}{\tzLFnofyYvalS}
5389 \def\tzLFnofyDEF{#3*(\y-\tzLFnofyYvalS)+\tzLFnofyXvalS}
5390 }
5391 {
5392 \tzgetxyval(#1){\tzLFnofyXval}{\tzLFnofyYval}
5393 \tzgetxyval(#2){\tzLFnofyXXval}{\tzLFnofyYYval}
5394 \fp_compare:nT { \tzLFnofyYYval - \tzLFnofyYval = 0 }
5395 { \msg_error:nn { tzplot } { infinite~slope~error } }
5396 \edef\tzLFofySlope
5397 {
5398 (\tzLFnofyXXval-\tzLFnofyXval)/(\tzLFnofyYYval-\tzLFnofyYval)
5399 }
5400 \def\tzLFnofyDEF{\tzLFofySlope*(\y-\tzLFnofyYval)+\tzLFnofyXval}
5401 }
5402
5403 \bool_if:NTF \l_tmpa_bool
5404 {
5405 \tl_put_right:Nn \l_tzLFnofy_path_tl
5406 { plot ( \y , { \tzLFnofyDEF } ) } % \y should not be expanded
5407 }
5408 {
5409 \tl_put_right:Nn \l_tzLFnofy_path_tl
5410 { plot ( { \tzLFnofyDEF } , \y ) } % \y should not be expanded
5411 }
5412 % to resolve AtBegin issue with "plot" operation
5413 \bool_if:NTF \g_tzLFnofy_BEGIN_cmd_bool
5414 {
5415 \tl_put_right:No \l_tzLFnofy_TEMP_cmd_tl { \l_tzLFnofy_opt_tl }
5416 \tl_put_right:No \l_tzLFnofy_TEMP_cmd_tl { \l_tzLFnofy_path_tl }
5417 \exp_last_unbraced:Nf \path \l_tzLFnofy_TEMP_cmd_tl ;
5418 \path (current~subpath~start) coordinate (tzCSPS) ;
5419 \tl_put_right:No \l_tzLFnofy_cmd_tl { \l_tzLFnofy_opt_tl }
5420 \tl_put_right:No \l_tzLFnofy_cmd_tl { \g_tzLFnofy_BEGIN_cmd_tl } % insert
5421 \tl_put_right:Nn \l_tzLFnofy_cmd_tl { (tzCSPS) -- } %
5422 \tl_put_right:No \l_tzLFnofy_cmd_tl { \l_tzLFnofy_path_tl }
5423 }
5424 {
5425 \tl_put_right:No \l_tzLFnofy_cmd_tl { \l_tzLFnofy_opt_tl }
5426 \tl_put_right:No \l_tzLFnofy_cmd_tl { \l_tzLFnofy_path_tl }
5427 }
5428 \bool_if:NT \g_tzLFnofy_END_cmd_bool
5429 {
5430 \tl_put_right:No \l_tzLFnofy_cmd_tl { \g_tzLFnofy_END_cmd_tl } % append
5431 }
5432 \tl_put_right:Nn \l_tzLFnofy_cmd_tl
5433 { node [ #6 ] { #5 } }
5434 % final action
5435 \exp_last_unbraced:Nf \draw \l_tzLFnofy_cmd_tl #7 ;
5436
5437 \bool_gset_false:N \g_tzLFnofy_BEGIN_cmd_bool
5438 \bool_gset_false:N \g_tzLFnofy_END_cmd_bool
5439 }
5440
5441 \NewDocumentCommand\tzLFnofy_domain_process{ m m }
5442 {
5443 \def\tzLFnofyFromVal{#1}
5444 \def\tzLFnofyToVal{#2}
5445 }
5446
5447 %%% --- end of \tzLFnofy
5448
5449
5450 %%% \tzfn
5451 %%(variable=\x -- default)
5452
5453 \bool_new:N \g_tzfn_BEGIN_cmd_bool
5454 \bool_new:N \g_tzfn_END_cmd_bool
5455
5456 %% \tzfnAtBegin
5457 \NewDocumentCommand\tzfnAtBegin{ m }
5458 {
5459 \bool_gset_true:N \g_tzfn_BEGIN_cmd_bool
5460 \tl_gset:No \g_tzfn_BEGIN_cmd_tl { #1 }
5461 }
5462
5463 %% \tzfnAtEnd
5464 \NewDocumentCommand\tzfnAtEnd{ m }
5465 {
5466 \bool_gset_true:N \g_tzfn_END_cmd_bool
5467 \tl_gset:No \g_tzfn_END_cmd_tl { #1 }
5468 }
5469
5470 %%% \tzfn (main)
5471 %%(variable =\x)
5472 \use:x{
5473 \NewDocumentCommand \exp_not:N \tzfn
5474 { t' O{} D<>{0,0} D""{} m
5475 >{ \SplitArgument {1} { \tl_to_str:n {:} } } r[] +G{} O{} D<>{}
5476 }
5477 }
5478 {
5479 \tl_clear:N \l_tzfn_opt_tl
5480 \tl_clear:N \l_tzfn_path_tl
5481 \tl_clear:N \l_tzfn_TEMP_cmd_tl
5482 \tl_clear:N \l_tzfn_cmd_tl
5483
5484 \IfBooleanTF { #1 }
5485 { \bool_set_true:N \l_tmpa_bool }
5486 { \bool_set_false:N \l_tmpa_bool }
5487
5488 \tzfn_domain_process #6
5489
5490 \tl_set:No \l_label_pos_tl { \tl_to_str:n { #5 } }
5491 \tl_set:No \l_tzfn_pathname_tl { \tl_tail:N \l_label_pos_tl }
5492 \tl_put_right:Nx \l_tzfn_opt_tl
5493 {
5494 [
5495 samples = 201 ,
5496 name~path =
5497 \tl_if_empty:nTF { #4 } { \l_tzfn_pathname_tl } { #4 } ,
5498 domain = \tzfnFromVal \c_colon_str \tzfnToVal ,
5499 shift = { (#3) } ,
5500 % variable = \exp_not:n { \x } ,
5501 \exp_not:n { #2 }
5502 ]
5503 }
5504
5505 \bool_if:NTF { \l_tmpa_bool }
5506 {
5507 \tl_put_right:No \l_tzfn_path_tl
5508 { plot ( { #5 } , \exp_not:n { \x } ) } % \x should not be expanded
5509 }
5510 {
5511 \tl_put_right:No \l_tzfn_path_tl
5512 { plot ( \exp_not:n { \x } , { #5 } ) } % \x should not be expanded
5513 }
5514 % to resolve AtBegin issue with "plot" operation
5515 \bool_if:NTF \g_tzfn_BEGIN_cmd_bool
5516 {
5517 \tl_put_right:No \l_tzfn_TEMP_cmd_tl { \l_tzfn_opt_tl }
5518 \tl_put_right:No \l_tzfn_TEMP_cmd_tl { \l_tzfn_path_tl }
5519 \exp_last_unbraced:Nf \path \l_tzfn_TEMP_cmd_tl ;
5520 \path (current~subpath~start) coordinate (tzCSPS) ;
5521 \tl_put_right:No \l_tzfn_cmd_tl { \l_tzfn_opt_tl }
5522 \tl_put_right:No \l_tzfn_cmd_tl { \g_tzfn_BEGIN_cmd_tl } % insert
5523 \tl_put_right:Nn \l_tzfn_cmd_tl { (tzCSPS) -- } %
5524 \tl_put_right:No \l_tzfn_cmd_tl { \l_tzfn_path_tl }
5525 }
5526 {
5527 \tl_put_right:No \l_tzfn_cmd_tl { \l_tzfn_opt_tl }
5528 \tl_put_right:No \l_tzfn_cmd_tl { \l_tzfn_path_tl }
5529 }
5530 \bool_if:NT \g_tzfn_END_cmd_bool
5531 {
5532 \tl_put_right:No \l_tzfn_cmd_tl { \g_tzfn_END_cmd_tl } % append
5533 }
5534 \tl_put_right:Nn \l_tzfn_cmd_tl
5535 { node [ #8 ] { #7 } }
5536 % final action
5537 \exp_last_unbraced:Nf \draw \l_tzfn_cmd_tl #9 ;
5538
5539 \bool_gset_false:N \g_tzfn_BEGIN_cmd_bool
5540 \bool_gset_false:N \g_tzfn_END_cmd_bool
5541 }
5542
5543 \NewDocumentCommand\tzfn_domain_process{ m m }
5544 {
5545 \def\tzfnFromVal{#1}
5546 \def\tzfnToVal{#2}
5547 }
5548
5549 %%% --- end of \tzfn
5550
5551
5552 %%% \tzfnofy
5553 %% (variable = \y)
5554
5555 \bool_new:N \g_tzfnofy_BEGIN_cmd_bool
5556 \bool_new:N \g_tzfnofy_END_cmd_bool
5557
5558 %% \tzfnofyAtBegin
5559 \NewDocumentCommand\tzfnofyAtBegin{ m }
5560 {
5561 \bool_gset_true:N \g_tzfnofy_BEGIN_cmd_bool
5562 \tl_gset:No \g_tzfnofy_BEGIN_cmd_tl { #1 }
5563 }
5564
5565 %% \tzfnofyAtEnd
5566 \NewDocumentCommand\tzfnofyAtEnd{ m }
5567 {
5568 \bool_gset_true:N \g_tzfnofy_END_cmd_bool
5569 \tl_gset:No \g_tzfnofy_END_cmd_tl { #1 }
5570 }
5571
5572 %%% \tzfnofy (main)
5573 %% (variable=\y)
5574 \use:x{
5575 \NewDocumentCommand \exp_not:N \tzfnofy
5576 { t' O{} D<>{0,0} D""{} m
5577 >{ \SplitArgument {1} { \tl_to_str:n {:} } } r[] +G{} O{} D<>{}
5578 }
5579 }
5580 {
5581 \tl_clear:N \l_tzfnofy_opt_tl
5582 \tl_clear:N \l_tzfnofy_path_tl
5583 \tl_clear:N \l_tzfnofy_TEMP_cmd_tl
5584 \tl_clear:N \l_tzfnofy_cmd_tl
5585
5586 \IfBooleanTF { #1 }
5587 { \bool_set_true:N \l_tmpa_bool }
5588 { \bool_set_false:N \l_tmpa_bool }
5589
5590 \tzfnofy_domain_process #6
5591
5592 \tl_set:No \l_label_pos_tl { \tl_to_str:n { #5 } }
5593 \tl_set:No \l_tzfnofy_pathname_tl { \tl_tail:N \l_label_pos_tl }
5594 \tl_put_right:Nx \l_tzfnofy_opt_tl
5595 {
5596 [
5597 samples = 201 ,
5598 name~path =
5599 \tl_if_empty:nTF { #4 } { \l_tzfnofy_pathname_tl } { #4 } ,
5600 domain = \tzfnofyFromVal \c_colon_str \tzfnofyToVal ,
5601 shift = { (#3) } ,
5602 variable = \exp_not:n { \y } ,
5603 \exp_not:n { #2 }
5604 ]
5605 }
5606
5607 \bool_if:NTF \l_tmpa_bool
5608 {
5609 \tl_put_right:Nn \l_tzfnofy_path_tl
5610 { plot ( \y , { #5 } ) } % \y should not be expanded
5611 }
5612 {
5613 \tl_put_right:Nn \l_tzfnofy_path_tl
5614 { plot ( { #5 } , \y ) } % \y should not be expanded
5615 }
5616 % to resolve AtBegin issue with "plot" operation
5617 \bool_if:NTF \g_tzfnofy_BEGIN_cmd_bool
5618 {
5619 \tl_put_right:No \l_tzfnofy_TEMP_cmd_tl { \l_tzfnofy_opt_tl }
5620 \tl_put_right:No \l_tzfnofy_TEMP_cmd_tl { \l_tzfnofy_path_tl }
5621 \exp_last_unbraced:Nf \path \l_tzfnofy_TEMP_cmd_tl ;
5622 \path (current~subpath~start) coordinate (tzCSPS) ;
5623 \tl_put_right:No \l_tzfnofy_cmd_tl { \l_tzfnofy_opt_tl }
5624 \tl_put_right:No \l_tzfnofy_cmd_tl { \g_tzfnofy_BEGIN_cmd_tl } % insert
5625 \tl_put_right:Nn \l_tzfnofy_cmd_tl { (tzCSPS) -- } %
5626 \tl_put_right:No \l_tzfnofy_cmd_tl { \l_tzfnofy_path_tl }
5627 }
5628 {
5629 \tl_put_right:No \l_tzfnofy_cmd_tl { \l_tzfnofy_opt_tl }
5630 \tl_put_right:No \l_tzfnofy_cmd_tl { \l_tzfnofy_path_tl }
5631 }
5632 \bool_if:NT \g_tzfnofy_END_cmd_bool
5633 {
5634 \tl_put_right:No \l_tzfnofy_cmd_tl { \g_tzfnofy_END_cmd_tl } % append
5635 }
5636 \tl_put_right:Nn \l_tzfnofy_cmd_tl
5637 { node [ #8 ] { #7 } }
5638 % final action
5639 \exp_last_unbraced:Nf \draw \l_tzfnofy_cmd_tl #9 ;
5640
5641 \bool_gset_false:N \g_tzfnofy_BEGIN_cmd_bool
5642 \bool_gset_false:N \g_tzfnofy_END_cmd_bool
5643 }
5644
5645 \NewDocumentCommand\tzfnofy_domain_process{ m m }
5646 {
5647 \def\tzfnofyFromVal{#1}
5648 \def\tzfnofyToVal{#2}
5649 }
5650
5651 %%% --- end of \tzfnofy
5652
5653
5654 %%% \tzfnmax
5655 %% (variable=\x -- default)
5656
5657 \bool_new:N \g_tzfnmax_BEGIN_cmd_bool
5658 \bool_new:N \g_tzfnmax_END_cmd_bool
5659
5660 %% \tzfnmaxAtBegin
5661 \NewDocumentCommand\tzfnmaxAtBegin{ m }
5662 {
5663 \bool_gset_true:N \g_tzfnmax_BEGIN_cmd_bool
5664 \tl_gset:No \g_tzfnmax_BEGIN_cmd_tl { #1 }
5665 }
5666
5667 %% \tzfnmaxAtEnd
5668 \NewDocumentCommand\tzfnmaxAtEnd{ m }
5669 {
5670 \bool_gset_true:N \g_tzfnmax_END_cmd_bool
5671 \tl_gset:No \g_tzfnmax_END_cmd_tl { #1 }
5672 }
5673
5674
5675 %%% \tzfnmax (main)
5676 %% (variable=\x)
5677 \use:x{
5678 \NewDocumentCommand \exp_not:N \tzfnmax
5679 { t' O{} D<>{0,0} D""{} m
5680 >{ \SplitArgument {1} { \tl_to_str:n {:} } } r[] +G{} O{} D<>{}
5681 }
5682 }
5683 {
5684 \tl_clear:N \l_tzfnmax_opt_tl
5685 \tl_clear:N \l_tzfnmax_path_tl
5686 \tl_clear:N \l_tzfnmax_TEMP_cmd_tl
5687 \tl_clear:N \l_tzfnmax_cmd_tl
5688
5689 \IfBooleanTF { #1 }
5690 { \bool_set_true:N \l_tmpa_bool }
5691 { \bool_set_false:N \l_tmpa_bool }
5692
5693 \tzfnmax_domain_process #6
5694
5695 \tl_put_right:Nx \l_tzfnmax_opt_tl
5696 {
5697 [
5698 thick , samples = 201 ,
5699 name~path = #4 ,
5700 domain = \tzfnmaxFromVal \c_colon_str \tzfnmaxToVal ,
5701 shift = { (#3) } ,
5702 % varialbe = \exp_not:n { \x } ,
5703 \exp_not:n { #2 }
5704 ]
5705 }
5706
5707 \bool_if:NTF { \l_tmpa_bool }
5708 {
5709 \tl_put_right:Nn \l_tzfnmax_path_tl
5710 { plot ( { max(#5) } , \x ) } % \x should not be expanded
5711 }
5712 {
5713 \tl_put_right:Nn \l_tzfnmax_path_tl
5714 { plot ( \x , { max(#5) } ) } % \x should not be expanded
5715 }
5716 % to resolve AtBegin issue with "plot" operation
5717 \bool_if:NTF \g_tzfnmax_BEGIN_cmd_bool
5718 {
5719 \tl_put_right:No \l_tzfnmax_TEMP_cmd_tl { \l_tzfnmax_opt_tl }
5720 \tl_put_right:No \l_tzfnmax_TEMP_cmd_tl { \l_tzfnmax_path_tl }
5721 \exp_last_unbraced:Nf \path \l_tzfnmax_TEMP_cmd_tl ;
5722 \path (current~subpath~start) coordinate (tzCSPS) ;
5723 \tl_put_right:No \l_tzfnmax_cmd_tl { \l_tzfnmax_opt_tl }
5724 \tl_put_right:No \l_tzfnmax_cmd_tl { \g_tzfnmax_BEGIN_cmd_tl } % insert
5725 \tl_put_right:Nn \l_tzfnmax_cmd_tl { (tzCSPS) -- } %
5726 \tl_put_right:No \l_tzfnmax_cmd_tl { \l_tzfnmax_path_tl }
5727 }
5728 {
5729 \tl_put_right:No \l_tzfnmax_cmd_tl { \l_tzfnmax_opt_tl }
5730 \tl_put_right:No \l_tzfnmax_cmd_tl { \l_tzfnmax_path_tl }
5731 }
5732 \bool_if:NT \g_tzfnmax_END_cmd_bool
5733 {
5734 \tl_put_right:No \l_tzfnmax_cmd_tl { \g_tzfnmax_END_cmd_tl } % append
5735 }
5736 \tl_put_right:Nn \l_tzfnmax_cmd_tl
5737 { node [ #8 ] { #7 } }
5738 % final action
5739 \exp_last_unbraced:Nf \draw \l_tzfnmax_cmd_tl #9 ;
5740
5741 \bool_gset_false:N \g_tzfnmax_BEGIN_cmd_bool
5742 \bool_gset_false:N \g_tzfnmax_END_cmd_bool
5743 }
5744
5745 \NewDocumentCommand\tzfnmax_domain_process{ m m }
5746 {
5747 \def\tzfnmaxFromVal{#1}
5748 \def\tzfnmaxToVal{#2}
5749 }
5750
5751 %%% --- end of \tzfnmax
5752
5753
5754
5755 %%% \tzfnmin
5756 %% (variable=\x -- default)
5757
5758 \bool_new:N \g_tzfnmin_BEGIN_cmd_bool
5759 \bool_new:N \g_tzfnmin_END_cmd_bool
5760
5761 %% \tzfnminAtBegin
5762 \NewDocumentCommand\tzfnminAtBegin{ m }
5763 {
5764 \bool_gset_true:N \g_tzfnmin_BEGIN_cmd_bool
5765 \tl_gset:No \g_tzfnmin_BEGIN_cmd_tl { #1 }
5766 }
5767
5768 %% \tzfnminAtEnd
5769 \NewDocumentCommand\tzfnminAtEnd{ m }
5770 {
5771 \bool_gset_true:N \g_tzfnmin_END_cmd_bool
5772 \tl_gset:No \g_tzfnmin_END_cmd_tl { #1 }
5773 }
5774
5775
5776
5777 %%% \tzfnmin (main)
5778 %% (variable=\x)
5779 \use:x{
5780 \NewDocumentCommand \exp_not:N \tzfnmin
5781 { t' O{} D<>{0,0} D""{} m
5782 >{ \SplitArgument {1} { \tl_to_str:n {:} } } r[] +G{} O{} D<>{}
5783 }
5784 }
5785 {
5786 \tl_clear:N \l_tzfnmin_opt_tl
5787 \tl_clear:N \l_tzfnmin_path_tl
5788 \tl_clear:N \l_tzfnmin_TEMP_cmd_tl
5789 \tl_clear:N \l_tzfnmin_cmd_tl
5790
5791 \IfBooleanTF { #1 }
5792 { \bool_set_true:N \l_tmpa_bool }
5793 { \bool_set_false:N \l_tmpa_bool }
5794
5795 \tzfnmin_domain_process #6
5796
5797 % \tl_set:No \l_label_pos_tl { \tl_to_str:n { #5 } }
5798 % \tl_set:No \l_tzfnmin_pathname_tl { \tl_tail:N \l_label_pos_tl }
5799 \tl_put_right:Nx \l_tzfnmin_opt_tl
5800 {
5801 [
5802 thick , samples = 201 ,
5803 name~path = #4 ,
5804 % \tl_if_empty:nTF { #4 } { } { #4 } ,
5805 domain = \tzfnminFromVal \c_colon_str \tzfnminToVal ,
5806 shift = { (#3) } ,
5807 % variable = \exp_not:n { \x } ,
5808 \exp_not:n { #2 }
5809 ]
5810 }
5811
5812 \bool_if:NTF { \l_tmpa_bool }
5813 {
5814 \tl_put_right:Nn \l_tzfnmin_path_tl
5815 { plot ( { min(#5) } , \x ) } % \x should not be expanded
5816 }
5817 {
5818 \tl_put_right:Nn \l_tzfnmin_path_tl
5819 { plot ( \x , { min(#5) } ) } % \x should not be expanded
5820 }
5821 % to resolve AtBegin issue with "plot" operation
5822 \bool_if:NTF \g_tzfnmin_BEGIN_cmd_bool
5823 {
5824 \tl_put_right:No \l_tzfnmin_TEMP_cmd_tl { \l_tzfnmin_opt_tl }
5825 \tl_put_right:No \l_tzfnmin_TEMP_cmd_tl { \l_tzfnmin_path_tl }
5826 \exp_last_unbraced:Nf \path \l_tzfnmin_TEMP_cmd_tl ;
5827 \path (current~subpath~start) coordinate (tzCSPS) ;
5828 \tl_put_right:No \l_tzfnmin_cmd_tl { \l_tzfnmin_opt_tl }
5829 \tl_put_right:No \l_tzfnmin_cmd_tl { \g_tzfnmin_BEGIN_cmd_tl } % insert
5830 \tl_put_right:Nn \l_tzfnmin_cmd_tl { (tzCSPS) -- } %
5831 \tl_put_right:No \l_tzfnmin_cmd_tl { \l_tzfnmin_path_tl }
5832 }
5833 {
5834 \tl_put_right:No \l_tzfnmin_cmd_tl { \l_tzfnmin_opt_tl }
5835 \tl_put_right:No \l_tzfnmin_cmd_tl { \l_tzfnmin_path_tl }
5836 }
5837 \bool_if:NT \g_tzfnmin_END_cmd_bool
5838 {
5839 \tl_put_right:No \l_tzfnmin_cmd_tl { \g_tzfnmin_END_cmd_tl } % append
5840 }
5841 \tl_put_right:Nn \l_tzfnmin_cmd_tl
5842 { node [ #8 ] { #7 } }
5843 % final action
5844 \exp_last_unbraced:Nf \draw \l_tzfnmin_cmd_tl #9 ;
5845
5846 \bool_gset_false:N \g_tzfnmin_BEGIN_cmd_bool
5847 \bool_gset_false:N \g_tzfnmin_END_cmd_bool
5848 }
5849
5850 \NewDocumentCommand\tzfnmin_domain_process{ m m }
5851 {
5852 \def\tzfnminFromVal{#1}
5853 \def\tzfnminToVal{#2}
5854 }
5855
5856 %%% --- end of \tzfnmin
5857
5858
5859 %%% pdf
5860
5861 %% normal distribution
5862
5863 \NewExpandableDocumentCommand\tzpdfN{ s m m }
5864 {
5865 \IfBooleanTF { #1 }
5866 { % standard deviation
5867 1/(#3*sqrt(2*pi))*exp( -1/2*( (\exp_not:n{\x}-#2)^2 / (#3)^2 ) )
5868 }
5869 { % variance (default)
5870 1/(sqrt(#3)*sqrt(2*pi))*exp(-1/2*((\exp_not:n{\x}-#2)^2/(sqrt(#3))^2))
5871 }
5872 }
5873
5874
5875 %% standard normal distribution
5876
5877 \NewExpandableDocumentCommand\tzpdfZ{ }
5878 {
5879 % \IfBooleanTF { #1 } {}{} % NOT USED! (to avoid coding error)
5880 1/sqrt(2*pi)*exp( -1/2*( \exp_not:n{\x} )^2 )
5881 }
5882
5883
5884
5885 %%% \tzfnarea
5886 %% no shift, no name path
5887
5888 \use:x{
5889 \NewDocumentCommand \exp_not:N \tzfnarea
5890 { s O{} m >{ \SplitArgument {1} { \tl_to_str:n {:} } } r[] G{.3} D<>{} }
5891 }
5892 {
5893 \tl_clear:N \l_tzfnarea_cmd_tl
5894
5895 \tl_if_empty:nTF { #5 }
5896 { \renewcommand\tzfillopacity{\tz@initial@fill@opacity} }
5897 { \renewcommand\tzfillopacity{#5} }
5898
5899 \tzfnarea_domain_process #4
5900
5901 % collect fill options
5902 \IfBooleanTF { #1 }
5903 {
5904 \tl_put_right:Nx \l_tzfnarea_cmd_tl
5905 {
5906 [ fill=\tzfillcolor , fill~opacity = \tzfillopacity ,
5907 text~opacity = 1 , \exp_not:n { #2 } ]
5908 }
5909 }
5910 {
5911 \tl_put_right:Nn \l_tzfnarea_cmd_tl
5912 { [ #2 ] }
5913 }
5914
5915
5916 \tl_put_right:Nx \l_tzfnarea_cmd_tl
5917 {
5918 (\tzfnareaFromVal,0) -- plot
5919 [ samples = 201 ,
5920 domain = \tzfnareaFromVal \c_colon_str \tzfnareaToVal ,
5921 % variable = \exp_not:n { \x } ,
5922 ]
5923 }
5924 \tl_put_right:No \l_tzfnarea_cmd_tl
5925 {
5926 ( \exp_not:n { \x } , { #3 } ) -- (\tzfnareaToVal,0)
5927 }
5928
5929 % final action
5930 \begin{pgfonlayer}{ \tzfnarealayer } % default = behind
5931 \exp_last_unbraced:Nf
5932 \path \l_tzfnarea_cmd_tl #6 ;
5933 \end{pgfonlayer}
5934 }
5935
5936 \NewDocumentCommand\tzfnarea_domain_process{ m m }
5937 {
5938 \def\tzfnareaFromVal{#1}
5939 \def\tzfnareaToVal{#2}
5940 }
5941
5942 %%% --- end of \tzfnarea
5943
5944
5945 \NewDocumentCommand\tzfnarealine{ t' O{} m m O{} D(){0,0} g O{} D(){0,0} }
5946 {
5947 \tzvXpointat{#3}{#4}(tzfnAL)
5948
5949 \IfBooleanTF { #1 }
5950 {
5951 \begin{pgfonlayer}{\tzfnarealayer}
5952 \tzto [ \tzfnALstyle , #2 , #8 ] (tzfnAL) (tzfnAL -| #6)
5953 \end{pgfonlayer}
5954 }
5955 {
5956 \begin{pgfonlayer}{\tzfnarealayer}
5957 \tzto [ \tzfnALstyle , #2 , #8 ] (tzfnAL) (tzfnAL |- #6)
5958 \end{pgfonlayer}
5959 }
5960
5961 \IfValueT { #7 }
5962 {
5963 \tzvXpointat{#3}{#7}(tzfnAR)
5964
5965 \IfBooleanTF { #1 }
5966 {
5967 \begin{pgfonlayer}{\tzfnarealayer}
5968 \tzto [ \tzfnALstyle , #2 , #8 ] (tzfnAR) (tzfnAR -| #9)
5969 \end{pgfonlayer}
5970 }
5971 {
5972 \begin{pgfonlayer}{\tzfnarealayer}
5973 \tzto [ \tzfnALstyle , #2 , #8 ] (tzfnAR) (tzfnAR|-#9)
5974 \end{pgfonlayer}
5975 }
5976 }
5977 }
5978
5979
5980
5981
5982 %%% \tzvfnat
5983 %% -- vertical line at x
5984
5985 \bool_new:N \g_tzvfnat_BEGIN_cmd_bool
5986 \bool_new:N \g_tzvfnat_END_cmd_bool
5987
5988 %% \tzvfnatAtBegin
5989 \NewDocumentCommand\tzvfnatAtBegin{ m }
5990 {
5991 \bool_gset_true:N \g_tzvfnat_BEGIN_cmd_bool
5992 \tl_gset:No \g_tzvfnat_BEGIN_cmd_tl { #1 }
5993 }
5994
5995 %% \tzvfnatAtEnd
5996 \NewDocumentCommand\tzvfnatAtEnd{ m }
5997 {
5998 \bool_gset_true:N \g_tzvfnat_END_cmd_bool
5999 \tl_gset:No \g_tzvfnat_END_cmd_tl { #1 }
6000 }
6001
6002 %% \tzvfnat (main)
6003 \use:x{
6004 \NewDocumentCommand \exp_not:N \tzvfnat
6005 { O{} D<>{0,0} D""{} m
6006 >{ \SplitArgument {1} { \tl_to_str:n {:} } } d[] +G{} O{} D<>{}
6007 }
6008 }
6009 {
6010 \tl_clear:N \l_tzvfnat_cmd_tl
6011
6012 \IfValueT { #5 } { \tzvfnat_domain_process #5 }
6013
6014 \tl_put_right:Nx \l_tzvfnat_cmd_tl
6015 {
6016 [
6017 % samples = 201 ,
6018 name~path = #3 ,
6019 shift = { (#2) } ,
6020 \exp_not:n { #1 }
6021 ]
6022 }
6023 \bool_if:NT \g_tzvfnat_BEGIN_cmd_bool
6024 { \tl_put_right:No \l_tzvfnat_cmd_tl { \g_tzvfnat_BEGIN_cmd_tl } }
6025 \IfValueTF { #5 }
6026 {
6027 \tl_put_right:Nn \l_tzvfnat_cmd_tl
6028 { (#4,\tzvfnatFromVal) -- (#4,\tzvfnatToVal) }
6029 }
6030 {
6031 \tl_put_right:Nn \l_tzvfnat_cmd_tl
6032 {
6033 (#4,0 |- current~bounding~box.south)
6034 -- (#4,0 |- current~bounding~box.north)
6035 }
6036 }
6037 \bool_if:NT \g_tzvfnat_END_cmd_bool
6038 { \tl_put_right:No \l_tzvfnat_cmd_tl { \g_tzvfnat_END_cmd_tl } }
6039 \tl_put_right:Nn \l_tzvfnat_cmd_tl
6040 { node [ #7 ] { #6 } }
6041 % final action
6042 \exp_last_unbraced:Nf \draw \l_tzvfnat_cmd_tl #8 ;
6043
6044 \bool_gset_false:N \g_tzvfnat_BEGIN_cmd_bool
6045 \bool_gset_false:N \g_tzvfnat_END_cmd_bool
6046 }
6047
6048 \NewDocumentCommand\tzvfnat_domain_process{ m m }
6049 {
6050 \def\tzvfnatFromVal{#1}
6051 \def\tzvfnatToVal{#2}
6052 }
6053
6054 %%% --- end of \tzvfnat
6055
6056
6057 %%% \tzvfn (On)
6058 %% -- vertical line through (x,y)
6059
6060 \bool_new:N \g_tzvfn_BEGIN_cmd_bool
6061 \bool_new:N \g_tzvfn_END_cmd_bool
6062
6063 %% \tzvfnAtBegin
6064 \NewDocumentCommand\tzvfnAtBegin{ m }
6065 {
6066 \bool_gset_true:N \g_tzvfn_BEGIN_cmd_bool
6067 \tl_gset:No \g_tzvfn_BEGIN_cmd_tl { #1 }
6068 }
6069
6070 %% \tzvfnAtEnd
6071 \NewDocumentCommand\tzvfnAtEnd{ m }
6072 {
6073 \bool_gset_true:N \g_tzvfn_END_cmd_bool
6074 \tl_gset:No \g_tzvfn_END_cmd_tl { #1 }
6075 }
6076
6077 %%% \tzvfn (main)
6078 \use:x{
6079 \NewDocumentCommand \exp_not:N \tzvfn
6080 { O{} d<> D""{} r()
6081 >{ \SplitArgument {1} { \tl_to_str:n {:} } } d[] +G{} O{} D<>{}
6082 }
6083 }
6084 {
6085 \tl_clear:N \l_tzvfn_cmd_tl
6086
6087 \IfValueT { #5 } { \tzvfn_domain_process #5 }
6088
6089 \tl_put_right:Nx \l_tzvfn_cmd_tl
6090 {
6091 [
6092 name~path = #3 ,
6093 \exp_not:n { #1 }
6094 ]
6095 }
6096 \bool_if:NT \g_tzvfn_BEGIN_cmd_bool
6097 { \tl_put_right:No \l_tzvfn_cmd_tl { \g_tzvfn_BEGIN_cmd_tl } }
6098 \IfValueTF { #5 }
6099 {
6100 \IfValueTF { #2 }
6101 {
6102 \tl_put_right:Nn \l_tzvfn_cmd_tl
6103 {
6104 ([shift = { (#2) }]#4 |- 0,\tzvfnFromVal) --
6105 ([shift = { (#2) }]#4 |- 0,\tzvfnToVal) }
6106 }
6107 {
6108 \tl_put_right:Nn \l_tzvfn_cmd_tl
6109 { (#4 |- 0,\tzvfnFromVal) -- (#4 |- 0,\tzvfnToVal) }
6110 }
6111 }
6112 {
6113 \IfValueTF { #2 }
6114 {
6115 \tl_put_right:Nn \l_tzvfn_cmd_tl
6116 {
6117 ([shift = { (#2) }]#4 |- current~bounding~box.south) --
6118 ([shift = { (#2) }]#4 |- current~bounding~box.north)
6119 }
6120 }
6121 {
6122 \tl_put_right:Nn \l_tzvfn_cmd_tl
6123 {
6124 (#4 |- current~bounding~box.south) --
6125 (#4 |- current~bounding~box.north)
6126 }
6127 }
6128 }
6129 \bool_if:NT \g_tzvfn_END_cmd_bool
6130 { \tl_put_right:No \l_tzvfn_cmd_tl { \g_tzvfn_END_cmd_tl } }
6131 \tl_put_right:Nn \l_tzvfn_cmd_tl
6132 { node [ #7 ] { #6 } }
6133 % final action
6134 \exp_last_unbraced:Nf \draw \l_tzvfn_cmd_tl #8 ;
6135
6136 \bool_gset_false:N \g_tzvfn_BEGIN_cmd_bool
6137 \bool_gset_false:N \g_tzvfn_END_cmd_bool
6138 }
6139
6140 \NewDocumentCommand\tzvfn_domain_process{ m m }
6141 {
6142 \def\tzvfnFromVal{#1}
6143 \def\tzvfnToVal{#2}
6144 }
6145
6146 %%% --- end of \tzvfn
6147
6148
6149 %%% \tzhfnat
6150 %% -- horizontal line at y
6151
6152 \bool_new:N \g_tzhfnat_BEGIN_cmd_bool
6153 \bool_new:N \g_tzhfnat_END_cmd_bool
6154
6155 %% \tzhfnatAtBegin
6156 \NewDocumentCommand\tzhfnatAtBegin{ m }
6157 {
6158 \bool_gset_true:N \g_tzhfnat_BEGIN_cmd_bool
6159 \tl_gset:No \g_tzhfnat_BEGIN_cmd_tl { #1 }
6160 }
6161
6162 %% \tzhfnatAtEnd
6163 \NewDocumentCommand\tzhfnatAtEnd{ m }
6164 {
6165 \bool_gset_true:N \g_tzhfnat_END_cmd_bool
6166 \tl_gset:No \g_tzhfnat_END_cmd_tl { #1 }
6167 }
6168
6169 %% \tzhfnat (main)
6170 \use:x{
6171 \NewDocumentCommand \exp_not:N \tzhfnat
6172 { O{} D<>{0,0} D""{} m
6173 >{ \SplitArgument {1} { \tl_to_str:n {:} } } d[] +G{} O{} D<>{}
6174 }
6175 }
6176 {
6177 \tl_clear:N \l_tzhfnat_cmd_tl
6178
6179 \IfValueT { #5 } { \tzhfnat_domain_process #5 }
6180
6181 \tl_put_right:Nx \l_tzhfnat_cmd_tl
6182 {
6183 [
6184 name~path = #3 ,
6185 shift = { (#2) } ,
6186 variable = \exp_not:n { \x } ,
6187 \exp_not:n { #1 }
6188 ]
6189 }
6190 \bool_if:NT \g_tzhfnat_BEGIN_cmd_bool
6191 { \tl_put_right:No \l_tzhfnat_cmd_tl { \g_tzhfnat_BEGIN_cmd_tl } }
6192 \IfValueTF { #5 }
6193 {
6194 \tl_put_right:Nn \l_tzhfnat_cmd_tl
6195 { (\tzhfnatFromVal,#4) -- (\tzhfnatToVal,#4) }
6196 }
6197 {
6198 \tl_put_right:Nn \l_tzhfnat_cmd_tl
6199 {
6200 (0,#4 -| current~bounding~box.west)
6201 -- (0,#4 -| current~bounding~box.east)
6202 }
6203 }
6204 \bool_if:NT \g_tzhfnat_END_cmd_bool
6205 { \tl_put_right:No \l_tzhfnat_cmd_tl { \g_tzhfnat_END_cmd_tl } }
6206 \tl_put_right:Nn \l_tzhfnat_cmd_tl
6207 { node [ #7 ] { #6 } }
6208 % final action
6209 \exp_last_unbraced:Nf \draw \l_tzhfnat_cmd_tl #8 ;
6210
6211 \bool_gset_false:N \g_tzhfnat_BEGIN_cmd_bool
6212 \bool_gset_false:N \g_tzhfnat_END_cmd_bool
6213 }
6214
6215 \NewDocumentCommand\tzhfnat_domain_process{ m m }
6216 {
6217 \def\tzhfnatFromVal{#1}
6218 \def\tzhfnatToVal{#2}
6219 }
6220
6221 %%% --- end of \tzhfnat
6222
6223
6224 %%% \tzhfn (On)
6225 %% -- horizontal line through (x,y)
6226
6227 \bool_new:N \g_tzhfn_BEGIN_cmd_bool
6228 \bool_new:N \g_tzhfn_END_cmd_bool
6229
6230 %% \tzhfnAtBegin
6231 \NewDocumentCommand\tzhfnAtBegin{ m }
6232 {
6233 \bool_gset_true:N \g_tzhfn_BEGIN_cmd_bool
6234 \tl_gset:No \g_tzhfn_BEGIN_cmd_tl { #1 }
6235 }
6236
6237 %% \tzhfnAtEnd
6238 \NewDocumentCommand\tzhfnAtEnd{ m }
6239 {
6240 \bool_gset_true:N \g_tzhfn_END_cmd_bool
6241 \tl_gset:No \g_tzhfn_END_cmd_tl { #1 }
6242 }
6243
6244 %% \tzhfn (main)
6245 \use:x{
6246 \NewDocumentCommand \exp_not:N \tzhfn
6247 { O{} d<> D""{} r()
6248 >{ \SplitArgument {1} { \tl_to_str:n {:} } } d[] +G{} O{} D<>{}
6249 }
6250 }
6251 {
6252 \tl_clear:N \l_tzhfn_cmd_tl
6253
6254 \IfValueT { #5 } { \tzhfn_domain_process #5 }
6255
6256 \tl_put_right:Nx \l_tzhfn_cmd_tl
6257 {
6258 [
6259 name~path = #3 ,
6260 variable = \exp_not:n { \x } ,
6261 \exp_not:n { #1 }
6262 ]
6263 }
6264 \bool_if:NT \g_tzhfn_BEGIN_cmd_bool
6265 { \tl_put_right:No \l_tzhfn_cmd_tl { \g_tzhfn_BEGIN_cmd_tl } }
6266 \IfValueTF { #5 }
6267 {
6268 \IfValueTF { #2 }
6269 {
6270 \tl_put_right:Nn \l_tzhfn_cmd_tl
6271 {
6272 ([shift = { (#2) }]\tzhfnFromVal,0 |- #4) --
6273 ([shift = { (#2) }]\tzhfnToVal,0 |- #4)
6274 }
6275 }
6276 {
6277 \tl_put_right:Nn \l_tzhfn_cmd_tl
6278 {
6279 (\tzhfnFromVal,0 |- #4) --
6280 (\tzhfnToVal,0 |- #4)
6281 }
6282 }
6283 }
6284 {
6285 \IfValueTF { #2 }
6286 {
6287 \tl_put_right:Nn \l_tzhfn_cmd_tl
6288 {
6289 ([shift = { (#2) }]#4 -| current~bounding~box.west)
6290 -- ([shift = { (#2) }]#4 -| current~bounding~box.east)
6291 }
6292 }
6293 {
6294 \tl_put_right:Nn \l_tzhfn_cmd_tl
6295 {
6296 (#4 -| current~bounding~box.west)
6297 -- (#4 -| current~bounding~box.east)
6298 }
6299 }
6300 }
6301 \bool_if:NT \g_tzhfn_END_cmd_bool
6302 { \tl_put_right:No \l_tzhfn_cmd_tl { \g_tzhfn_END_cmd_tl } }
6303 \tl_put_right:Nn \l_tzhfn_cmd_tl
6304 { node [ #7 ] { #6 } }
6305 % final action
6306 \exp_last_unbraced:Nf \draw \l_tzhfn_cmd_tl #8 ;
6307
6308 \bool_gset_false:N \g_tzhfn_BEGIN_cmd_bool
6309 \bool_gset_false:N \g_tzhfn_END_cmd_bool
6310 }
6311
6312 \NewDocumentCommand\tzhfn_domain_process{ m m }
6313 {
6314 \def\tzhfnFromVal{#1}
6315 \def\tzhfnToVal{#2}
6316 }
6317
6318 %%% --- end of \tzhfn
6319
6320
6321 %%%%% Intersections
6322
6323 %%% \tzXpoint -- intersection point of two paths
6324 \NewDocumentCommand\tzXpoint
6325 { s O{} m m D(){intersection} O{1} +G{} >{\TrimSpaces}o D(){\tz@initial@dot@size} }
6326 {
6327 \tl_clear:N \l_tzXpoint_cmd_tl
6328 %%%%%% to use string replacement for label positions
6329 \IfValueTF { #8 }
6330 {
6331 \tl_if_in:nnTF { #8 } { [ }
6332 { \extract_posopt:w #8 \q_stop } % ndh
6333 {
6334 \tl_set:Nx \l_label_pos_str_trimmed_tl { \tl_trim_spaces:n { #8 } }
6335 \str_case_e:nnF { \l_label_pos_str_trimmed_tl }
6336 {
6337 {l} { \tl_set:Nn \l_label_pos_str_tl {left} }
6338 {r} { \tl_set:Nn \l_label_pos_str_tl {right} }
6339 {a} { \tl_set:Nn \l_label_pos_str_tl {above} }
6340 {b} { \tl_set:Nn \l_label_pos_str_tl {below} }
6341 {c} { \tl_set:Nn \l_label_pos_str_tl {center} }
6342 {al} { \tl_set:Nn \l_label_pos_str_tl {above~left} }
6343 {ar} { \tl_set:Nn \l_label_pos_str_tl {above~right} }
6344 {bl} { \tl_set:Nn \l_label_pos_str_tl {below~left} }
6345 {br} { \tl_set:Nn \l_label_pos_str_tl {below~right} }
6346 }
6347 {
6348 \tl_set:Nn \l_label_pos_str_tl { #8 }
6349 }
6350 }
6351 }
6352 {
6353 \tl_clear:N \l_label_pos_str_tl
6354 }
6355 %%%%%%%%%%
6356 \path [ name~intersections = { of = #3 ~ and ~ #4 , name = #5 } ] ;
6357 \tl_put_right:Nn \l_tzXpoint_cmd_tl
6358 {
6359 (#5-#6) coordinate (#5)
6360 \IfBooleanTF {#1}
6361 { node [ tzdot , fill , minimum~size = #9 , }
6362 { node [ tzdot , draw = none , minimum~size = 0pt , }
6363 }
6364
6365 \tl_put_right:Nx \l_tzXpoint_cmd_tl
6366 {
6367 label = { \l_label_pos_str_tl \c_colon_str \exp_not:n { #7 } } , % pos_str
6368 }
6369
6370 \tl_put_right:Nn \l_tzXpoint_cmd_tl
6371 {
6372 #2
6373 ] {}
6374 }
6375
6376 \exp_last_unbraced:Nf \path \l_tzXpoint_cmd_tl ;
6377 }
6378
6379 %%% --- end of \tzXpoint
6380
6381
6382 %%% \tzLFnXpoint : linear Xpoint
6383 \NewDocumentCommand\tzLFnXpoint
6384 { s O{} m m o D(){} +G{} >{\TrimSpaces}o D(){\tz@initial@dot@size} }
6385 {
6386 \tl_clear:N \l_tzLFnXpoint_cmd_tl
6387
6388 %%%%%% to use string replacement for label positions
6389 \IfValueTF { #8 }
6390 {
6391 \tl_if_in:nnTF { #8 } { [ }
6392 { \extract_posopt:w #8 \q_stop } % ndh
6393 {
6394 \tl_set:Nx \l_label_pos_str_trimmed_tl { \tl_trim_spaces:n { #8 } }
6395 \str_case_e:nnF { \l_label_pos_str_trimmed_tl }
6396 {
6397 {l} { \tl_set:Nn \l_label_pos_str_tl {left} }
6398 {r} { \tl_set:Nn \l_label_pos_str_tl {right} }
6399 {a} { \tl_set:Nn \l_label_pos_str_tl {above} }
6400 {b} { \tl_set:Nn \l_label_pos_str_tl {below} }
6401 {c} { \tl_set:Nn \l_label_pos_str_tl {center} }
6402 {al} { \tl_set:Nn \l_label_pos_str_tl {above~left} }
6403 {ar} { \tl_set:Nn \l_label_pos_str_tl {above~right} }
6404 {bl} { \tl_set:Nn \l_label_pos_str_tl {below~left} }
6405 {br} { \tl_set:Nn \l_label_pos_str_tl {below~right} }
6406 }
6407 {
6408 \tl_set:Nn \l_label_pos_str_tl { #8 }
6409 }
6410 }
6411 }
6412 {
6413 \tl_clear:N \l_label_pos_str_tl
6414 }
6415 %%%%%%%%%%
6416
6417 \IfValueTF { #5 }
6418 {
6419 \def\x{#5}
6420 \path (\x,{#3}) coordinate (tzLFnXA-1) (\x,{#4}) coordinate (tzLFnXB-1);
6421 \def\x{\fp_eval:n {1.01*#5+.1}}
6422 \path (\x,{#3}) coordinate (tzLFnXA-2) (\x,{#4}) coordinate (tzLFnXB-2);
6423 }
6424 {
6425 \def\x{0}
6426 \path (\x,{#3}) coordinate (tzLFnXA-1) (\x,{#4}) coordinate (tzLFnXB-1);
6427 \def\x{.1}
6428 \path (\x,{#3}) coordinate (tzLFnXA-2) (\x,{#4}) coordinate (tzLFnXB-2);
6429 }
6430
6431 \tl_put_right:Nn \l_tzLFnXpoint_cmd_tl
6432 {
6433 (intersection~of~tzLFnXA-1--tzLFnXA-2 ~and~ tzLFnXB-1--tzLFnXB-2)
6434 coordinate (#6)
6435 \IfBooleanTF {#1}
6436 { node [ tzdot , fill , minimum~size = #9 , }
6437 { node [ tzdot , draw = none , minimum~size = 0pt , }
6438 }
6439
6440 \tl_put_right:Nx \l_tzLFnXpoint_cmd_tl
6441 {
6442 label = { \l_label_pos_str_tl \c_colon_str \exp_not:n { #7 } } , % pos_str
6443 }
6444
6445 \tl_put_right:Nn \l_tzLFnXpoint_cmd_tl
6446 {
6447 #2
6448 ] {}
6449 }
6450
6451 \exp_last_unbraced:Nf \draw \l_tzLFnXpoint_cmd_tl ;
6452 }
6453
6454 %%% --- end of \tzLFnXpoint
6455
6456
6457 %%% \tzvXpointat -- vertical intersection point at x
6458 %%% *[<opt>]{<path>}(<coor>)(<coor name>)[<nth>]{<label>}[<[<opt>]angle>](<dotsize>)
6459 \NewDocumentCommand\tzvXpointat
6460 { s O{} m m D(){intersection} O{1} +G{} >{\TrimSpaces}o D(){\tz@initial@dot@size} }
6461 {
6462 \tl_clear:N \l_tzvXpointat_cmd_tl
6463
6464 \tzvfnat[draw=none]"tzvXpoint-At" {#4} % depends on (current bounding box)
6465
6466 %%%%%% to use string replacement for label positions
6467 \IfValueTF { #8 }
6468 {
6469 \tl_if_in:nnTF { #8 } { [ }
6470 { \extract_posopt:w #8 \q_stop } % ndh
6471 {
6472 \tl_set:Nx \l_label_pos_str_trimmed_tl { \tl_trim_spaces:n { #8 } }
6473 \str_case_e:nnF { \l_label_pos_str_trimmed_tl }
6474 {
6475 {l} { \tl_set:Nn \l_label_pos_str_tl {left} }
6476 {r} { \tl_set:Nn \l_label_pos_str_tl {right} }
6477 {a} { \tl_set:Nn \l_label_pos_str_tl {above} }
6478 {b} { \tl_set:Nn \l_label_pos_str_tl {below} }
6479 {c} { \tl_set:Nn \l_label_pos_str_tl {center} }
6480 {al} { \tl_set:Nn \l_label_pos_str_tl {above~left} }
6481 {ar} { \tl_set:Nn \l_label_pos_str_tl {above~right} }
6482 {bl} { \tl_set:Nn \l_label_pos_str_tl {below~left} }
6483 {br} { \tl_set:Nn \l_label_pos_str_tl {below~right} }
6484 }
6485 {
6486 \tl_set:Nn \l_label_pos_str_tl { #8 }
6487 }
6488 }
6489 }
6490 {
6491 \tl_clear:N \l_label_pos_str_tl
6492 }
6493 %%%%%%%%%%
6494
6495 \path [ name~intersections = { of = tzvXpoint-At ~and~ #3 , name = #5 } ] ;
6496
6497 \tl_put_right:Nn \l_tzvXpointat_cmd_tl
6498 {
6499 (#5-#6) coordinate (#5)
6500 \IfBooleanTF {#1}
6501 { node [ tzdot , fill , minimum~size = #9 , }
6502 { node [ tzdot , draw = none , minimum~size = 0pt , }
6503 }
6504
6505 \tl_put_right:Nx \l_tzvXpointat_cmd_tl
6506 {
6507 label = { \l_label_pos_str_tl \c_colon_str \exp_not:n { #7 } } , % pos_str
6508 }
6509
6510 \tl_put_right:Nn \l_tzvXpointat_cmd_tl
6511 {
6512 #2
6513 ] {}
6514 }
6515
6516 \exp_last_unbraced:Nf \path \l_tzvXpointat_cmd_tl ;
6517 \tl_clear:N \tzvXpointat_cmd_tl
6518 }
6519
6520 %%% --- end of \tzvXpointat
6521
6522
6523 %%% \tzvXpoint (On)
6524 %%% -- vertical intersection point at (x,y) of a path
6525 %%% *[<opt>]{<path>}(<coor>)(<coor name>)[<nth>]{<label>}[<[<opt>]angle>](<dotsize>)
6526 \NewDocumentCommand\tzvXpoint
6527 { s O{} m r() D(){intersection} O{1} +G{} >{\TrimSpaces}o D(){\tz@initial@dot@size} }
6528 {
6529 \tl_clear:N \l_tzvXpoint_cmd_tl
6530
6531 \tzvfn[draw=none]"tzvXpoint-On"(#4) % depends on (current bounding box)
6532
6533 %%%%%% to use string replacement for label positions
6534 \IfValueTF { #8 }
6535 {
6536 \tl_if_in:nnTF { #8 } { [ }
6537 { \extract_posopt:w #8 \q_stop } % ndh
6538 {
6539 \tl_set:Nx \l_label_pos_str_trimmed_tl { \tl_trim_spaces:n { #8 } }
6540 \str_case_e:nnF { \l_label_pos_str_trimmed_tl }
6541 {
6542 {l} { \tl_set:Nn \l_label_pos_str_tl {left} }
6543 {r} { \tl_set:Nn \l_label_pos_str_tl {right} }
6544 {a} { \tl_set:Nn \l_label_pos_str_tl {above} }
6545 {b} { \tl_set:Nn \l_label_pos_str_tl {below} }
6546 {c} { \tl_set:Nn \l_label_pos_str_tl {center} }
6547 {al} { \tl_set:Nn \l_label_pos_str_tl {above~left} }
6548 {ar} { \tl_set:Nn \l_label_pos_str_tl {above~right} }
6549 {bl} { \tl_set:Nn \l_label_pos_str_tl {below~left} }
6550 {br} { \tl_set:Nn \l_label_pos_str_tl {below~right} }
6551 }
6552 {
6553 \tl_set:Nn \l_label_pos_str_tl { #8 }
6554 }
6555 }
6556 }
6557 {
6558 \tl_clear:N \l_label_pos_str_tl
6559 }
6560 %%%%%%%%%%
6561
6562 \path [ name~intersections = { of = tzvXpoint-On ~and~ #3 , name = #5 } ] ;
6563 \tl_put_right:Nn \l_tzvXpoint_cmd_tl
6564 {
6565 (#5-#6) coordinate (#5)
6566 \IfBooleanTF {#1}
6567 { node [ tzdot , fill , minimum~size = #9 , }
6568 { node [ tzdot , draw = none , minimum~size = 0pt , }
6569 }
6570
6571 \tl_put_right:Nx \l_tzvXpoint_cmd_tl
6572 {
6573 label = { \l_label_pos_str_tl \c_colon_str \exp_not:n { #7 } } , % pos_str
6574 }
6575
6576 \tl_put_right:Nn \l_tzvXpoint_cmd_tl
6577 {
6578 #2
6579 ] {}
6580 }
6581
6582 \exp_last_unbraced:Nf \path \l_tzvXpoint_cmd_tl ;
6583 \tl_clear:N \l_tzvXpoint_cmd_tl
6584 }
6585
6586 %%% --- end of \tzvXpoint
6587
6588
6589
6590 %%% \tzhXpointat -- horizontal intersection point at y
6591 \NewDocumentCommand\tzhXpointat
6592 { s O{} m m D(){intersection} O{1} +G{} >{\TrimSpaces}o D(){\tz@initial@dot@size} }
6593 {
6594 \tl_clear:N \l_tzhXpointat_cmd_tl
6595
6596 \tzhfnat[draw=none]"tzhXpoint-At"{#4} % depends on (current bounding box)
6597
6598 %%%%%% to use string replacement for label positions
6599 \IfValueTF { #8 }
6600 {
6601 \tl_if_in:nnTF { #8 } { [ }
6602 { \extract_posopt:w #8 \q_stop } % ndh
6603 {
6604 \tl_set:Nx \l_label_pos_str_trimmed_tl { \tl_trim_spaces:n { #8 } }
6605 \str_case_e:nnF { \l_label_pos_str_trimmed_tl }
6606 {
6607 {l} { \tl_set:Nn \l_label_pos_str_tl {left} }
6608 {r} { \tl_set:Nn \l_label_pos_str_tl {right} }
6609 {a} { \tl_set:Nn \l_label_pos_str_tl {above} }
6610 {b} { \tl_set:Nn \l_label_pos_str_tl {below} }
6611 {c} { \tl_set:Nn \l_label_pos_str_tl {center} }
6612 {al} { \tl_set:Nn \l_label_pos_str_tl {above~left} }
6613 {ar} { \tl_set:Nn \l_label_pos_str_tl {above~right} }
6614 {bl} { \tl_set:Nn \l_label_pos_str_tl {below~left} }
6615 {br} { \tl_set:Nn \l_label_pos_str_tl {below~right} }
6616 }
6617 {
6618 \tl_set:Nn \l_label_pos_str_tl { #8 }
6619 }
6620 }
6621 }
6622 {
6623 \tl_clear:N \l_label_pos_str_tl
6624 }
6625 %%%%%%%%%%
6626
6627 \path [ name~intersections = { of = tzhXpoint-At ~and~ #3 , name = #5 } ] ;
6628 \tl_put_right:Nn \l_tzhXpointat_cmd_tl
6629 {
6630 (#5-#6) coordinate (#5)
6631 \IfBooleanTF {#1}
6632 { node [ tzdot , fill , minimum~size = #9 , }
6633 { node [ tzdot , draw = none , minimum~size = 0pt , }
6634 }
6635
6636 \tl_put_right:Nx \l_tzhXpointat_cmd_tl
6637 {
6638 label = { \l_label_pos_str_tl \c_colon_str \exp_not:n { #7 } } , % pos_str
6639 }
6640
6641 \tl_put_right:Nn \l_tzhXpointat_cmd_tl
6642 {
6643 #2
6644 ] {}
6645 }
6646
6647 \exp_last_unbraced:Nf \path \l_tzhXpointat_cmd_tl ;
6648 \tl_clear:N \l_tzhXpointat_cmd_tl
6649 }
6650
6651 %%% --- end of \tzhXpointat
6652
6653
6654 %%% \tzhXpoint (On) -- horizontal intersection point at (x,y)
6655 \NewDocumentCommand\tzhXpoint
6656 { s O{} m r() D(){intersection} O{1} +G{} >{\TrimSpaces}o D(){\tz@initial@dot@size} }
6657 {
6658 \tl_clear:N \l_tzhXpoint_cmd_tl
6659
6660 \tzhfn[draw=none]"tzhXpoint-On"(#4) % depends on (current bounding box)
6661
6662 %%%%%% to use string replacement for label positions
6663 \IfValueTF { #8 }
6664 {
6665 \tl_if_in:nnTF { #8 } { [ }
6666 { \extract_posopt:w #8 \q_stop } % ndh
6667 {
6668 \tl_set:Nx \l_label_pos_str_trimmed_tl { \tl_trim_spaces:n { #8 } }
6669 \str_case_e:nnF { \l_label_pos_str_trimmed_tl }
6670 {
6671 {l} { \tl_set:Nn \l_label_pos_str_tl {left} }
6672 {r} { \tl_set:Nn \l_label_pos_str_tl {right} }
6673 {a} { \tl_set:Nn \l_label_pos_str_tl {above} }
6674 {b} { \tl_set:Nn \l_label_pos_str_tl {below} }
6675 {c} { \tl_set:Nn \l_label_pos_str_tl {center} }
6676 {al} { \tl_set:Nn \l_label_pos_str_tl {above~left} }
6677 {ar} { \tl_set:Nn \l_label_pos_str_tl {above~right} }
6678 {bl} { \tl_set:Nn \l_label_pos_str_tl {below~left} }
6679 {br} { \tl_set:Nn \l_label_pos_str_tl {below~right} }
6680 }
6681 {
6682 \tl_set:Nn \l_label_pos_str_tl { #8 }
6683 }
6684 }
6685 }
6686 {
6687 \tl_clear:N \l_label_pos_str_tl
6688 }
6689 %%%%%%%%%%
6690
6691 \path [ name~intersections = { of = tzhXpoint-On ~and~ #3 , name = #5 } ] ;
6692
6693 \tl_put_right:Nn \l_tzhXpoint_cmd_tl
6694 {
6695 (#5-#6) coordinate (#5)
6696 \IfBooleanTF {#1}
6697 { node [ tzdot , fill , minimum~size = #9 , }
6698 { node [ tzdot , draw = none , minimum~size = 0pt , }
6699 }
6700
6701 \tl_put_right:Nx \l_tzhXpoint_cmd_tl
6702 {
6703 label = { \l_label_pos_str_tl \c_colon_str \exp_not:n { #7 } } , % pos_str
6704 }
6705
6706 \tl_put_right:Nn \l_tzhXpoint_cmd_tl
6707 {
6708 #2
6709 ] {}
6710 }
6711
6712 \exp_last_unbraced:Nf \path \l_tzhXpoint_cmd_tl ;
6713 \tl_clear:N \l_tzhXpoint_cmd_tl
6714 }
6715
6716 %%% --- end of \tzhXpoint
6717
6718
6719
6720 %%%%% Axes
6721
6722 %%% \tzaxes
6723
6724 \NewDocumentCommand\tzaxes{ s O{} D<>{0,0} D""{axes} }
6725 {
6726 \tl_clear:N \l_tzaxes_opt_tl
6727 \tl_clear:N \l_tzaxes_x_cmd_tl
6728 \tl_clear:N \l_tzaxes_y_cmd_tl
6729 \tl_clear:N \l_tzaxes_path_cmd_tl
6730 \tl_clear:N \l_tzaxes_name_path_tl
6731 \tl_clear:N \l_tzaxes_shift_coor_tl
6732
6733 \IfBooleanTF { #1 }
6734 { \bool_set_true:N \l_tmpa_bool }
6735 { \bool_set_false:N \l_tmpa_bool }
6736
6737 \tl_set:Nn \l_tzaxes_opt_tl { [ -> , #2 ] }
6738
6739 \tl_set:Nn \l_tzaxes_name_path_tl { #4 }
6740 \tl_set:Nn \l_tzaxes_shift_coor_tl { #3 }
6741
6742 \tzaxes_check_token:n
6743 }
6744
6745 \cs_new:Npn \tzaxes_check_token:n #1
6746 {
6747 \str_if_eq:nnT { #1 } { ( }
6748 { \tzaxes_final_actions ( }
6749 }
6750
6751 \NewDocumentCommand\tzaxes_final_actions{ r() d() +G{} O{} +G{} O{} }
6752 {
6753 \IfNoValueTF { #2 }
6754 {
6755 \tl_set:Nx \l_tzaxes_x_cmd_tl
6756 {
6757 ( 0,0 |- {\l_tzaxes_shift_coor_tl} ) -- ( #1 |- {\l_tzaxes_shift_coor_tl} )
6758 node [ right , \exp_not:n { #4 } ] { \exp_not:n { #3 } }
6759 }
6760 \tl_set:Nx \l_tzaxes_y_cmd_tl
6761 {
6762 ( {\l_tzaxes_shift_coor_tl} |- 0,0 ) -- ( {\l_tzaxes_shift_coor_tl} |- #1 )
6763 node [ above , \exp_not:n { #6 } ] { \exp_not:n { #5 } }
6764 }
6765 \tl_set:Nx \l_tzaxes_path_cmd_tl
6766 {
6767 ( 0,0 |- {\l_tzaxes_shift_coor_tl} ) -- ( #1 |- {\l_tzaxes_shift_coor_tl} )
6768 ( {\l_tzaxes_shift_coor_tl} |- 0,0 )
6769 -- ( {\l_tzaxes_shift_coor_tl} |- \exp_not:n { #1 } )
6770 }
6771 }
6772 {
6773 \tl_set:Nx \l_tzaxes_x_cmd_tl
6774 {
6775 ( #1 |- {\l_tzaxes_shift_coor_tl} ) -- ( #2 |- {\l_tzaxes_shift_coor_tl} )
6776 node [ right , \exp_not:n { #4 } ] { \exp_not:n { #3 } }
6777 }
6778 \tl_set:Nx \l_tzaxes_y_cmd_tl
6779 {
6780 ( {\l_tzaxes_shift_coor_tl} |- #1 ) -- ( {\l_tzaxes_shift_coor_tl} |- #2 )
6781 node [ above , \exp_not:n { #6 } ] { \exp_not:n { #5 } }
6782 }
6783 \tl_set:Nx \l_tzaxes_path_cmd_tl
6784 {
6785 ( #1 |- {\l_tzaxes_shift_coor_tl} ) -- ( #2 |- {\l_tzaxes_shift_coor_tl} )
6786 ( {\l_tzaxes_shift_coor_tl} |- #1 ) -- ( {\l_tzaxes_shift_coor_tl} |- #2 )
6787 }
6788 }
6789
6790 \tl_put_left:No \l_tzaxes_x_cmd_tl { \l_tzaxes_opt_tl }
6791 \tl_put_left:No \l_tzaxes_y_cmd_tl { \l_tzaxes_opt_tl }
6792 \tl_put_left:No \l_tzaxes_path_cmd_tl
6793 { [ name~path = \l_tzaxes_name_path_tl ] }
6794
6795 % final actions
6796 \exp_last_unbraced:Nf \draw \l_tzaxes_x_cmd_tl ;
6797 \exp_last_unbraced:Nf \draw \l_tzaxes_y_cmd_tl ;
6798 \exp_last_unbraced:Nf \path \l_tzaxes_path_cmd_tl ;
6799
6800 \bool_if:NT \l_tmpa_bool
6801 {
6802 \coordinate (bbxOpposite) at (current~bounding~box.north~east) ;
6803 \coordinate (bbxOrigin) at (current~bounding~box.south~west) ;
6804 \useasboundingbox (bbxOrigin) rectangle (bbxOpposite) ;
6805 }
6806 }
6807
6808 %%% -- end of \tzaxes
6809
6810
6811 %%% \tzaxesL -- simpler version of \tzaxes
6812
6813 \bool_new:N \l_tzaxesL_shift_coor_bool
6814
6815 \NewDocumentCommand\tzaxesL{ t' O{} d<> D""{axesL}}
6816 {
6817 \tl_clear:N \l_tzaxesL_opt_tl
6818 \tl_clear:N \l_tzaxesL_x_cmd_tl
6819 \tl_clear:N \l_tzaxesL_y_cmd_tl
6820 \tl_clear:N \l_tzaxesL_path_cmd_tl
6821 \tl_clear:N \l_tzaxesL_name_path_tl
6822 \tl_clear:N \l_tzaxesL_shift_coor_tl
6823
6824 \IfBooleanTF { #1 }
6825 { \bool_set_true:N \l_tmpa_bool }
6826 { \bool_set_false:N \l_tmpa_bool }
6827
6828 \tl_set:Nn \l_tzaxesL_opt_tl { [ #2 ] }
6829
6830 \tl_set:Nn \l_tzaxesL_name_path_tl { #4 }
6831
6832 \IfValueTF { #3 }
6833 {
6834 \tl_set:Nn \l_tzaxesL_shift_coor_tl { #3 }
6835 \bool_set_true:N \l_tzaxesL_shift_coor_bool
6836 }
6837 {
6838 \tl_clear:N \l_tzaxesL_shift_coor_tl
6839 \bool_set_false:N \l_tzaxesL_shift_coor_bool
6840 }
6841
6842 \tzaxesL_check_token:n
6843 }
6844
6845 \cs_new:Npn \tzaxesL_check_token:n #1
6846 {
6847 \str_if_eq:nnT { #1 } { ( }
6848 { \tzaxesL_final_actions ( }
6849 }
6850
6851 \NewDocumentCommand\tzaxesL_final_actions{ r() r() +G{} O{} +G{} O{} }
6852 {
6853 \bool_if:NTF \l_tmpa_bool
6854 { %% swap version
6855 % x-axis
6856 \bool_if:NTF \l_tzaxesL_shift_coor_bool
6857 {
6858 \tl_set:Nx \l_tzaxesL_x_cmd_tl
6859 {
6860 ( [ shift = { (\l_tzaxesL_shift_coor_tl) } ] #2 )
6861 -- ( [ shift = { (\l_tzaxesL_shift_coor_tl) } ] #1 |- #2 )
6862 node [ left , \exp_not:n { #4 } ] { \exp_not:n { #3 } }
6863 }
6864 }
6865 {
6866 \tl_set:Nn \l_tzaxesL_x_cmd_tl
6867 {
6868 ( #2 ) -- ( #1 |- #2 )
6869 node [ left , #4 ] { #3 }
6870 }
6871 }
6872 % y-axis
6873 \bool_if:NTF \l_tzaxesL_shift_coor_bool
6874 {
6875 \tl_set:Nx \l_tzaxesL_y_cmd_tl
6876 {
6877 ( [ shift = { (\l_tzaxesL_shift_coor_tl) } ] #2 )
6878 -- ( [ shift = { (\l_tzaxesL_shift_coor_tl) } ] #2 |- #1 )
6879 node [ below , \exp_not:n { #6 } ] { \exp_not:n { #5 } }
6880 }
6881 }
6882 {
6883 \tl_set:Nn \l_tzaxesL_y_cmd_tl
6884 {
6885 ( #2 ) -- ( #2 |- #1 )
6886 node [ below , #6] { #5 }
6887 }
6888 }
6889 % for path only
6890 \bool_if:NTF \l_tzaxesL_shift_coor_bool
6891 {
6892 \tl_set:Nx \l_tzaxesL_path_cmd_tl
6893 {
6894 ( [ shift = { (\l_tzaxesL_shift_coor_tl) } ] #2 )
6895 -- ( [ shift = { (\l_tzaxesL_shift_coor_tl) } ] #1 |- #2 )
6896 ( [ shift = { (\l_tzaxesL_shift_coor_tl) } ] #2 )
6897 -- ( [ shift = { (\l_tzaxesL_shift_coor_tl) } ] #2 |- #1 )
6898 }
6899 }
6900 {
6901 \tl_set:Nn \l_tzaxesL_path_cmd_tl
6902 {
6903 ( #2 ) -- ( #1 |- #2 )
6904 ( #2 ) -- ( #2 |- #1 )
6905 }
6906 }
6907 }
6908 { %% standard version
6909 % x-axis
6910 \bool_if:NTF \l_tzaxesL_shift_coor_bool
6911 {
6912 \tl_set:Nx \l_tzaxesL_x_cmd_tl
6913 {
6914 ( [ shift = { (\l_tzaxesL_shift_coor_tl) } ] #1 )
6915 -- ( [shift = {(\l_tzaxesL_shift_coor_tl) } ] #2 |- #1 )
6916 node [ right , \exp_not:n { #4 } ] { \exp_not:n { #3 } }
6917 }
6918 }
6919 {
6920 \tl_set:Nn \l_tzaxesL_x_cmd_tl
6921 {
6922 ( #1 ) -- ( #2 |- #1 )
6923 node [ right , #4 ] { #3 }
6924 }
6925 }
6926 % y-axis
6927 \bool_if:NTF \l_tzaxesL_shift_coor_bool
6928 {
6929 \tl_set:Nx \l_tzaxesL_y_cmd_tl
6930 {
6931 ( [ shift = { (\l_tzaxesL_shift_coor_tl) } ] #1 )
6932 -- ( [ shift = { (\l_tzaxesL_shift_coor_tl) } ] #1 |- #2 )
6933 node [ above , \exp_not:n { #6 } ] { \exp_not:n { #5 } }
6934 }
6935 }
6936 {
6937 \tl_set:Nn \l_tzaxesL_y_cmd_tl
6938 {
6939 ( #1 ) -- ( #1 |- #2 )
6940 node [ above , #6 ] { #5 }
6941 }
6942 }
6943 % path only
6944 \bool_if:NTF \l_tzaxesL_shift_coor_bool
6945 {
6946 \tl_set:Nx \l_tzaxesL_path_cmd_tl
6947 {
6948 ( [ shift = { (\l_tzaxesL_shift_coor_tl) } ] #1 )
6949 -- ( [ shift = { (\l_tzaxesL_shift_coor_tl) } ] #2 |- #1 )
6950 ( [ shift = { (\l_tzaxesL_shift_coor_tl) } ] #1 )
6951 -- ( [ shift = { (\l_tzaxesL_shift_coor_tl) } ] #1 |- #2 )
6952 }
6953 }
6954 {
6955 \tl_set:Nn \l_tzaxesL_path_cmd_tl
6956 {
6957 ( #1 ) -- ( #2 |- #1 )
6958 ( #1 ) -- ( #1 |- #2 )
6959 }
6960 }
6961 }
6962 % combining options and command tokens
6963 \tl_put_left:No \l_tzaxesL_x_cmd_tl { \l_tzaxesL_opt_tl }
6964 \tl_put_left:No \l_tzaxesL_y_cmd_tl { \l_tzaxesL_opt_tl }
6965 \tl_put_left:No \l_tzaxesL_path_cmd_tl
6966 { [ name~path = \l_tzaxesL_name_path_tl ] }
6967 % final actions
6968 \exp_last_unbraced:Nf \draw \l_tzaxesL_x_cmd_tl ;
6969 \exp_last_unbraced:Nf \draw \l_tzaxesL_y_cmd_tl ;
6970 \exp_last_unbraced:Nf \path \l_tzaxesL_path_cmd_tl ;
6971 }
6972
6973 %%% -- end of \tzaxesL
6974
6975
6976
6977 %%% \tzaxisx
6978
6979 \NewDocumentCommand\tzaxisx{ s O{} D<>{0} D""{axisx} m m G{} O{} }
6980 {
6981 \draw [ -> , name~path = #4 , #2 ]
6982 ( #5 , #3 ) -- ( #6 , #3 ) node [ right , #8 ] { #7 } ;
6983 }
6984
6985
6986 %%% \tzaxisy
6987
6988 \NewDocumentCommand\tzaxisy{ s O{} D<>{0} D""{axisy} m m G{} O{} }
6989 {
6990 \draw [ -> , name~path = #4 , #2 ]
6991 ( #3 , #5 ) -- ( #3 , #6 ) node [ above , #8 ] { #7 } ;
6992 }
6993
6994
6995 %%%%% Ticks
6996
6997 %%% \tztikcs : (combine \tzticksx and \tzticksy)
6998
6999 \use:x{
7000 \NewDocumentCommand \exp_not:N \tzticks
7001 { s O{} D<>{0,0}
7002 >{ \SplitArgument {1} { \tl_to_str:n {:} } } d() m O{}
7003 >{ \SplitArgument {1} { \tl_to_str:n {:} } } d() G{} O{}
7004 }
7005 }
7006 {
7007 \tzgetxyval(#3){\tzticksXshift}{\tzticksYshift}
7008 \IfValueT { #4 } { \tzticks_Xlength_process #4 }
7009 %% ------
7010 \IfValueT { #7 } { \tzticks_Ylength_process #7 }
7011
7012 \IfBooleanTF { #1 }
7013 {
7014 \IfNoValueT { #4 }
7015 {
7016 \def\tzticksXFromVal{0pt}
7017 \def\tzticksXToVal{3pt}
7018 }
7019 \foreach \xx / \tzXtext in { #5 }
7020 \draw [ shift = {(0,\tzticksYshift)} , #2 ]
7021 (\xx , \tzticksXFromVal)
7022 -- (\xx , \tzticksXToVal) ; % ignores \txXtext
7023 %% --------
7024 \IfNoValueT { #7 }
7025 {
7026 \def\tzticksYFromVal{0pt}
7027 \def\tzticksYToVal{3pt}
7028 }
7029 \foreach \yy/\tzYtext in { #8 }
7030 \draw [ shift = {(\tzticksXshift,0)} , #2 ]
7031 (\tzticksYFromVal , \yy)
7032 -- (\tzticksYToVal , \yy) ; % ignores \txXtext
7033 }
7034 {
7035 \IfNoValueT { #4 }
7036 {
7037 \def\tzticksXFromVal{0pt}
7038 \def\tzticksXToVal{0pt}
7039 }
7040 \foreach \xx / \tzXtext in { #5 }
7041 \draw [ shift = {(0,\tzticksYshift)} , #2 ]
7042 (\xx ,\tzticksXFromVal)
7043 -- (\xx , \tzticksXToVal)
7044 (\xx , 0 ) node
7045 [ text~height = 1.25ex ,
7046 text~depth = .25ex ,
7047 below , #6 ] {\tzXtext} ;
7048 %% --------
7049 \IfNoValueT { #7 }
7050 {
7051 \def\tzticksYFromVal{0pt}
7052 \def\tzticksYToVal{0pt}
7053 }
7054 \foreach \yy / \tzYtext in { #8 }
7055 \draw [ shift = {(\tzticksXshift,0)} , #2 ]
7056 (\tzticksYFromVal , \yy)
7057 -- (\tzticksYToVal , \yy)
7058 (0 , \yy)
7059 node [ left , #9 ] { \tzYtext } ;
7060 }
7061 }
7062
7063 \NewDocumentCommand\tzticks_Xlength_process { m m }
7064 {
7065 \def\tzticksXFromVal{#1}
7066 \def\tzticksXToVal{#2}
7067 }
7068 %% --------
7069 \NewDocumentCommand\tzticks_Ylength_process { m m }
7070 {
7071 \def\tzticksYFromVal{#1}
7072 \def\tzticksYToVal{#2}
7073 }
7074
7075 %%% --- end of \tzticks
7076
7077
7078 %%% \tztikcsx (main)
7079 %% -- ticks and labels along the x axis
7080
7081 \use:x{
7082 \NewDocumentCommand \exp_not:N \tzticksx
7083 { s O{} D<>{0}
7084 >{ \SplitArgument {1} { \tl_to_str:n {:} } } d() m O{}
7085 }
7086 }
7087 {
7088 \IfValueT { #4 } { \tzticksx_length_process #4 }
7089
7090 \IfBooleanTF { #1 }
7091 {
7092 \IfNoValueT { #4 }
7093 {
7094 \def\tzticksxFromVal{0pt}
7095 \def\tzticksxToVal{3pt}
7096 }
7097 \foreach \xx / \tzxtext in { #5 }
7098 \draw [ shift = {(0,#3)} , #2 ]
7099 (\xx , \tzticksxFromVal)
7100 -- (\xx , \tzticksxToVal) ;
7101 }
7102 {
7103 \IfNoValueT { #4 }
7104 {
7105 \def\tzticksxFromVal{0pt}
7106 \def\tzticksxToVal{0pt}
7107 }
7108 \foreach \xx / \tzxtext in { #5 }
7109 \draw [ shift = {(0,#3)} , #2 ]
7110 (\xx ,\tzticksxFromVal)
7111 -- (\xx , \tzticksxToVal)
7112 (\xx , 0 ) node
7113 [ text~height = 1.25ex ,
7114 text~depth = .25ex ,
7115 below , #6 ] {\tzxtext} ;
7116
7117 }
7118 }
7119
7120 \NewDocumentCommand\tzticksx_length_process { m m }
7121 {
7122 \def\tzticksxFromVal{#1}
7123 \def\tzticksxToVal{#2}
7124 }
7125
7126 %%% --- end of \tzticksx
7127
7128
7129 %%% \tztikcsy (main)
7130 %% -- ticks and labels along with the y axis
7131
7132 \use:x{
7133 \NewDocumentCommand \exp_not:N \tzticksy
7134 { s O{} D<>{0}
7135 >{ \SplitArgument {1} { \tl_to_str:n {:} } } d() m O{}
7136 }
7137 }
7138 {
7139
7140 \IfValueT { #4 } { \tzticksy_length_process #4 }
7141
7142 \IfBooleanTF { #1 }
7143 {
7144 \IfNoValueT { #4 }
7145 {
7146 \def\tzticksyFromVal{0pt}
7147 \def\tzticksyToVal{3pt}
7148 }
7149 \foreach \yy/\tzytext in { #5 }
7150 \draw [ shift = {(#3,0)} , #2 ]
7151 (\tzticksyFromVal , \yy)
7152 -- (\tzticksyToVal , \yy) ;
7153 }
7154 {
7155 \IfNoValueT { #4 }
7156 {
7157 \def\tzticksyFromVal{0pt}
7158 \def\tzticksyToVal{0pt}
7159 }
7160 \foreach \yy / \tzytext in { #5 }
7161 \draw [ shift = {(#3,0)} , #2 ]
7162 (\tzticksyFromVal , \yy)
7163 -- (\tzticksyToVal , \yy)
7164 (0 , \yy)
7165 node [ left , #6 ] { \tzytext } ;
7166 }
7167 }
7168
7169 \NewDocumentCommand\tzticksy_length_process { m m }
7170 {
7171 \def\tzticksyFromVal{#1}
7172 \def\tzticksyToVal{#2}
7173 }
7174
7175 %%% --- end of \tzticksy
7176
7177
7178 %%%%% Projections
7179 %% lines and tick labels of projection onto x/y axis
7180
7181 %%% \tzproj
7182
7183 \NewDocumentCommand\tzproj
7184 { s O{} d<> r() G{} O{} G{} O{} D(){\tz@initial@dot@size} }
7185 {
7186 \IfValueTF { #3 }
7187 { \coordinate (tzProj) at (#3) ; }
7188 { \coordinate (tzProj) at (0,0) ; }
7189 \draw [ dotted , #2 ]
7190 (#4 |- tzProj)
7191 node [ text~height = 1.25ex ,
7192 text~depth = .25ex ,
7193 below , #6 ] { #5 }
7194 -- (#4) -- (tzProj |- #4)
7195 node [ left , #8 ] { #7 } ;
7196 \IfBooleanT {#1} { \tzdot*(#4)(#9) }
7197 }
7198
7199 %%% \tzprojs : semicolon version
7200
7201 %\bool_new:N \l_tzprojs_shift_coor_bool
7202
7203 %%% \tzprojs (main)
7204 \NewDocumentCommand\tzprojs { s O{} d<> }
7205 {
7206 \tl_clear:N \l_tzprojs_cmd_tl
7207 % \tl_clear:N \l_tzprojs_opt_tl
7208 \tl_clear:N \l_tzprojs_coors_tl
7209
7210 \IfValueTF { #3 }
7211 { \coordinate (tzProjs) at (#3) ; }
7212 { \coordinate (tzProjs) at (0,0) ; }
7213
7214 \tl_put_right:Nn \l_tzprojs_cmd_tl { [ dotted , #2 ] }
7215
7216 \IfBooleanTF { #1 }
7217 { \bool_set_true:N \l_tmpa_bool }
7218 { \bool_set_false:N \l_tmpa_bool }
7219
7220 \tzprojs_check_token:n
7221 }
7222
7223 \cs_new:Npn \tzprojs_check_token:n #1
7224 {
7225 % \token_if_eq_charcode:NNTF #1 (
7226 % { \tzprojs_sub_fn #1 }
7227 % { \tzprojs_stop_action }
7228 \str_case:nnF { #1 }
7229 {
7230 { ( } { \tzprojs_sub_fn #1 }
7231 { ; } { \tzprojs_stop_action }
7232 }
7233 {
7234 \msg_error:nn { tzplot } { semicolon-error }
7235 }
7236 }
7237
7238 \NewDocumentCommand\tzprojs_sub_fn { r() G{} O{} G{} O{} }
7239 {
7240 % collect only coordinates (to print dots)
7241 \tl_put_right:Nn \l_tzprojs_coors_tl { (#1) }
7242 % collect cmd_tl (for all inputs)
7243 \tl_put_right:Nn \l_tzprojs_cmd_tl
7244 {
7245 (#1 |- tzProjs)
7246 node [ text~height = 1.25ex ,
7247 text~depth = .25ex ,
7248 below , #3 ] { #2 }
7249 -- (#1) -- (tzProjs |- #1)
7250 node [ left , #5 ] { #4 }
7251 }
7252
7253 \tzprojs_check_token:n
7254 }
7255
7256 \NewDocumentCommand\tzprojs_stop_action { D(){\tz@initial@dot@size} }
7257 {
7258 % final action
7259 \exp_last_unbraced:Nf \draw \l_tzprojs_cmd_tl ;
7260 \bool_if:NT \l_tmpa_bool
7261 { \exp_last_unbraced:NNf \tzdots* \l_tzprojs_coors_tl ; (#1) }
7262 }
7263 %%% --- end of \tzprojs
7264
7265
7266 %%% \tzprojx
7267
7268 \NewDocumentCommand\tzprojx
7269 { s O{} d<> r() G{} O{} D(){\tz@initial@dot@size} }
7270 {
7271 \IfValueTF { #3 }
7272 { \coordinate (tzProjx) at (#3) ; }
7273 { \coordinate (tzProjx) at (0,0) ; }
7274 \draw [ dotted , #2 ] (#4)
7275 -- (#4 |- tzProjx)
7276 node [ text~height = 1.25ex ,
7277 text~depth = .25ex ,
7278 below , #6 ] { #5 } ;
7279 \IfBooleanT { #1 } { \tzdot*(#4)(#7) }
7280 }
7281
7282 %%% \tzprojy
7283
7284 \NewDocumentCommand\tzprojy
7285 { s O{} d<> r() G{} O{} D(){\tz@initial@dot@size} }
7286 {
7287 \IfValueTF { #3 }
7288 { \coordinate (tzProjy) at (#3) ; }
7289 { \coordinate (tzProjy) at (0,0) ; }
7290 \draw [ dotted , #2 ] (#4)
7291 -- (#4 -| tzProjy)
7292 node [ left , #6 ] { #5 } ;
7293 \IfBooleanT { #1 } { \tzdot*(#4)(#7) }
7294 }
7295
7296 %%% \tzprojsx : semicolon version
7297
7298 %\bool_new:N \l_tzprojsx_shift_coor_bool
7299
7300 %%% \tzprojsx (main)
7301 \NewDocumentCommand\tzprojsx { s O{} d<> }
7302 {
7303 \tl_clear:N \l_tzprojsx_cmd_tl
7304 % \tl_clear:N \l_tzprojsx_opt_tl
7305 \tl_clear:N \l_tzprojsx_coors_tl
7306
7307 \IfValueTF { #3 }
7308 { \coordinate (tzProjsx) at (#3) ; }
7309 { \coordinate (tzProjsx) at (0,0) ; }
7310
7311 \tl_put_right:Nn \l_tzprojsx_cmd_tl { [ dotted , #2 ] }
7312
7313 \IfBooleanTF { #1 }
7314 { \bool_set_true:N \l_tmpa_bool }
7315 { \bool_set_false:N \l_tmpa_bool }
7316
7317 \tzprojsx_check_token:n
7318 }
7319
7320 \cs_new:Npn \tzprojsx_check_token:n #1
7321 {
7322 % \token_if_eq_charcode:NNTF #1 (
7323 % { \tzprojsx_sub_fn #1 }
7324 % { \tzprojsx_stop_action }
7325 \str_case:nnF { #1 }
7326 {
7327 { ( } { \tzprojsx_sub_fn #1 }
7328 { ; } { \tzprojsx_stop_action }
7329 }
7330 {
7331 \msg_error:nn { tzplot } { semicolon-error }
7332 }
7333 }
7334
7335 \NewDocumentCommand\tzprojsx_sub_fn { r() G{} O{} }
7336 {
7337 % collect only coordinates (to print dots)
7338 \tl_put_right:Nn \l_tzprojsx_coors_tl { (#1) }
7339 % collect cmd_tl (for all inputs)
7340 \tl_put_right:Nn \l_tzprojsx_cmd_tl
7341 {
7342 (#1) -- (#1 |- tzProjsx)
7343 node [ text~height = 1.25ex ,
7344 text~depth = .25ex ,
7345 below , #3 ] { #2 }
7346 }
7347
7348 \tzprojsx_check_token:n
7349 }
7350
7351 \NewDocumentCommand\tzprojsx_stop_action { D(){\tz@initial@dot@size} }
7352 {
7353 % final action
7354 \exp_last_unbraced:Nf \draw \l_tzprojsx_cmd_tl ;
7355 \bool_if:NT \l_tmpa_bool
7356 { \exp_last_unbraced:NNf \tzdots* \l_tzprojsx_coors_tl ; (#1) }
7357 }
7358 %%% --- end of \tzprojsx
7359
7360
7361 %%% \tzprojsy : semicolon version
7362
7363 %\bool_new:N \l_tzprojsy_shift_coor_bool
7364
7365 %%% \tzprojsy (main)
7366 \NewDocumentCommand\tzprojsy { s O{} d<> }
7367 {
7368 \tl_clear:N \l_tzprojsy_cmd_tl
7369 % \tl_clear:N \l_tzprojsy_opt_tl
7370 \tl_clear:N \l_tzprojsy_coors_tl
7371
7372 \IfValueTF { #3 }
7373 { \coordinate (tzProjsy) at (#3) ; }
7374 { \coordinate (tzProjsy) at (0,0) ; }
7375
7376 \tl_put_right:Nn \l_tzprojsy_cmd_tl { [ dotted , #2 ] }
7377
7378 \IfBooleanTF { #1 }
7379 { \bool_set_true:N \l_tmpa_bool }
7380 { \bool_set_false:N \l_tmpa_bool }
7381
7382 \tzprojsy_check_token:n
7383 }
7384
7385 \cs_new:Npn \tzprojsy_check_token:n #1
7386 {
7387 % \token_if_eq_charcode:NNTF #1 (
7388 % { \tzprojsy_sub_fn #1 }
7389 % { \tzprojsy_stop_action }
7390 \str_case:nnF { #1 }
7391 {
7392 { ( } { \tzprojsy_sub_fn #1 }
7393 { ; } { \tzprojsy_stop_action }
7394 }
7395 {
7396 \msg_error:nn { tzplot } { semicolon-error }
7397 }
7398 }
7399
7400 \NewDocumentCommand\tzprojsy_sub_fn { r() G{} O{} }
7401 {
7402 % collect only coordinates (to print dots)
7403 \tl_put_right:Nn \l_tzprojsy_coors_tl { (#1) }
7404 % collect cmd_tl (for all inputs)
7405 \tl_put_right:Nn \l_tzprojsy_cmd_tl
7406 {
7407 (#1) -- (#1 -| tzProjsy)
7408 node [ left , #3 ] { #2 }
7409 }
7410
7411 \tzprojsy_check_token:n
7412 }
7413
7414 \NewDocumentCommand\tzprojsy_stop_action { D(){\tz@initial@dot@size} }
7415 {
7416 % final action
7417 \exp_last_unbraced:Nf \draw \l_tzprojsy_cmd_tl ;
7418 \bool_if:NT \l_tmpa_bool
7419 { \exp_last_unbraced:NNf \tzdots* \l_tzprojsy_coors_tl ; (#1) }
7420 }
7421 %%% --- end of \tzprojsy
7422
7423
7424 %%%%% Nodes
7425
7426 %%% \tznode -- putting texts (and labels as option)
7427
7428 \NewDocumentCommand\tznode{ s O{} d<> r() D(){tzNodeName} +m O{} D<>{} }
7429 {
7430 \IfBooleanTF { #1 }
7431 {
7432 \IfValueTF { #3 }
7433 { \node #8 [ draw , #2 ] (#5) at ([shift={(#3)}]#4) [ #7 ] { #6 } ; }
7434 { \node #8 [ draw , #2 ] (#5) at (#4) [ #7 ] { #6 } ; }
7435 }
7436 {
7437 \IfValueTF { #3 }
7438 { \node #8 [ #2 ] (#5) at ([shift={(#3)}]#4) [ #7 ] { #6 } ; }
7439 { \node #8 [ #2 ] (#5) at (#4) [ #7 ] { #6 } ; }
7440 }
7441 }
7442 %%% --- end of \tznode
7443
7444
7445 %%% \tznodes
7446 %%% repeat pattern: (coor)(nodename){label}[pos]
7447
7448 %\tl_new:N \l_tznodes_opt_tl
7449 %\tl_new:N \l_tznodes_cmd_tl
7450 \bool_new:N \l_tznodes_shift_coor_bool
7451
7452 %%% \tznodes (main)
7453 \NewDocumentCommand\tznodes{ s O{} d<> }
7454 {
7455 \tl_clear:N \l_tznodes_cmd_tl
7456
7457 \IfBooleanTF { #1 }
7458 {
7459 \tl_set:Nn \l_tznodes_cmd_tl { [ every~node/.style = { draw , #2 } ] }
7460 }
7461 {
7462 \tl_set:Nn \l_tznodes_cmd_tl { [ every~node/.style = { #2 } ] }
7463 }
7464
7465 \IfValueTF { #3 }
7466 {
7467 \tl_set:Nn \l_tznodes_shift_coor_tl { #3 }
7468 \bool_set_true:N \l_tznodes_shift_coor_bool
7469 }
7470 {
7471 \tl_clear:N \l_tznodes_shift_coor_tl
7472 \bool_set_false:N \l_tznodes_shift_coor_bool
7473 }
7474
7475 \tznodes_check_token:n
7476 }
7477
7478 \cs_new:Npn \tznodes_check_token:n #1
7479 {
7480 % \token_if_eq_charcode:NNTF #1 (
7481 % { \tznodes_sub_fn #1 }
7482 % { \tznodes_stop_action }
7483 \str_case:nnF { #1 }
7484 {
7485 { ( } { \tznodes_sub_fn #1 }
7486 { ; } { \tznodes_late_opt_fn }
7487 }
7488 {
7489 % \tznodes_stop_action
7490 \msg_error:nn { tzplot } { semicolon-error }
7491 }
7492 }
7493
7494
7495 \NewDocumentCommand\tznodes_sub_fn { r() r() +G{} O{} }
7496 {
7497 \bool_if:NTF \l_tznodes_shift_coor_bool
7498 {
7499 \tl_put_right:Nx \l_tznodes_cmd_tl
7500 {% if shift
7501 ( [ shift = { (\l_tznodes_shift_coor_tl) } ] #1 )
7502 }
7503 }
7504 { \tl_put_right:Nn \l_tznodes_cmd_tl { (#1) } }
7505
7506 \tl_put_right:Nn \l_tznodes_cmd_tl { node (#2) } %% node (name)
7507 \tl_put_right:Nn \l_tznodes_cmd_tl
7508 { [ #4 ] { #3 } }
7509 \tznodes_check_token:n
7510 }
7511
7512 \NewDocumentCommand\tznodes_late_opt_fn { D<>{} }
7513 {
7514 % #1 does nothing (kept for consistency with \tznodedots)
7515 \tznodes_stop_action
7516 }
7517
7518
7519 \NewDocumentCommand\tznodes_stop_action {}
7520 {
7521 \exp_last_unbraced:Nf \path \l_tznodes_cmd_tl ;
7522 }
7523
7524 %%% --- end of \tznodes
7525
7526
7527
7528 %%% \tznodedot (main)
7529
7530 \NewDocumentCommand\tznodedot
7531 { s O{} d<> r() D(){tzNodeName} +G{} >{\TrimSpaces}o D(){\tz@initial@dot@size} }
7532 {
7533 \tl_clear:N \l_tznodedot_cmd_tl
7534
7535 \renewcommand\tzdotsize{ #8 }
7536
7537 %%%%%% to use string replacement for label positions
7538 \IfValueTF { #7 }
7539 {
7540 \tl_if_in:nnTF { #7 } { [ }
7541 { \extract_posopt:w #7 \q_stop } % ndh
7542 {
7543 \tl_set:Nx \l_label_pos_str_trimmed_tl { \tl_trim_spaces:n { #7 } }
7544 \str_case_e:nnF { \l_label_pos_str_trimmed_tl }
7545 {
7546 {l} { \tl_set:Nn \l_label_pos_str_tl {left} }
7547 {r} { \tl_set:Nn \l_label_pos_str_tl {right} }
7548 {a} { \tl_set:Nn \l_label_pos_str_tl {above} }
7549 {b} { \tl_set:Nn \l_label_pos_str_tl {below} }
7550 {c} { \tl_set:Nn \l_label_pos_str_tl {center} }
7551 {al} { \tl_set:Nn \l_label_pos_str_tl {above~left} }
7552 {ar} { \tl_set:Nn \l_label_pos_str_tl {above~right} }
7553 {bl} { \tl_set:Nn \l_label_pos_str_tl {below~left} }
7554 {br} { \tl_set:Nn \l_label_pos_str_tl {below~right} }
7555 }
7556 {
7557 \tl_set:Nn \l_label_pos_str_tl { #7 }
7558 }
7559 }
7560 }
7561 {
7562 \tl_clear:N \l_label_pos_str_tl
7563 }
7564 %%%%%%%%%%
7565
7566 \IfValueTF { #3 }
7567 {% if shift
7568 \tl_put_right:Nn \l_tznodedot_cmd_tl
7569 { ([shift={(#3)}]#4) node (#5) }
7570 }
7571 {% no shift (normal)
7572 \tl_put_right:Nn \l_tznodedot_cmd_tl
7573 { (#4) node (#5) }
7574 }
7575 \IfBooleanTF { #1 }
7576 {
7577 \tl_put_right:Nn \l_tznodedot_cmd_tl { [ tzdot , fill , }
7578 }
7579 {
7580 \tl_put_right:Nn \l_tznodedot_cmd_tl { [ tzdot , }
7581 }
7582 \tl_put_right:Nx \l_tznodedot_cmd_tl
7583 {
7584 label = { \l_label_pos_str_tl \c_colon_str \exp_not:n { #6 } } , % str_opt
7585 }
7586 \tl_put_right:Nn \l_tznodedot_cmd_tl
7587 {
7588 minimum~size = \tzdotsize , #2 ] {}
7589 }
7590 \exp_last_unbraced:Nf \path \l_tznodedot_cmd_tl ;
7591 }
7592
7593 %%% --- end of \tznodedot
7594
7595
7596 %%% \tznodedots
7597 %%% repeat pattern: (coor)(nodename){label}[pos]
7598
7599 \tl_new:N \l_tznodedots_opt_tl
7600 \tl_new:N \l_tznodedots_cmd_tl
7601 \bool_new:N \l_tznodedots_shift_coor_bool
7602
7603 %%% \tznodedots (main)
7604 \NewDocumentCommand\tznodedots{ s O{} d<> }
7605 {
7606 \tl_clear:N \l_tznodedots_cmd_tl
7607
7608 \IfBooleanTF { #1 }
7609 { \tl_set:Nn \l_tznodedots_STYLE_fill_tl { fill } }
7610 { \tl_set:Nn \l_tznodedots_STYLE_fill_tl { fill = none } }
7611
7612 \tl_if_empty:nTF { #2 }
7613 { \tl_set:Nn \l_tznodedots_opt_tl { tzdot } }
7614 { \tl_set:Nn \l_tznodedots_opt_tl { tzdot , #2 } }
7615
7616 \IfValueTF { #3 }
7617 {
7618 \tl_set:Nn \l_tznodedots_shift_coor_tl { #3 }
7619 \bool_set_true:N \l_tznodedots_shift_coor_bool
7620 }
7621 {
7622 \tl_clear:N \l_tznodedots_shift_coor_tl
7623 \bool_set_false:N \l_tznodedots_shift_coor_bool
7624 }
7625
7626 \tznodedots_check_token:n
7627 }
7628
7629 \cs_new:Npn \tznodedots_check_token:n #1
7630 {
7631 % \token_if_eq_charcode:NNTF #1 (
7632 % { \tznodedots_sub_fn #1 }
7633 % { \tznodedots_stop_action }
7634 \str_case:nnF { #1 }
7635 {
7636 { ( } { \tznodedots_sub_fn #1 }
7637 { ; } { \tznodedots_late_opt_fn }
7638 }
7639 {
7640 % \tznodedots_stop_action
7641 \msg_error:nn { tzplot } { semicolon-error }
7642 }
7643 }
7644
7645
7646 \NewDocumentCommand\tznodedots_sub_fn { r() r() +G{} >{\TrimSpaces}o }
7647 {
7648 %%%%%% to use string replacement for label positions
7649 \IfValueTF { #4 }
7650 {
7651 \tl_if_in:nnTF { #4 } { [ }
7652 { \extract_posopt:w #4 \q_stop } % ndh
7653 {
7654 \tl_set:Nx \l_label_pos_str_trimmed_tl { \tl_trim_spaces:n { #4 } }
7655 \str_case_e:nnF { \l_label_pos_str_trimmed_tl }
7656 {
7657 {l} { \tl_set:Nn \l_label_pos_str_tl {left} }
7658 {r} { \tl_set:Nn \l_label_pos_str_tl {right} }
7659 {a} { \tl_set:Nn \l_label_pos_str_tl {above} }
7660 {b} { \tl_set:Nn \l_label_pos_str_tl {below} }
7661 {c} { \tl_set:Nn \l_label_pos_str_tl {center} }
7662 {al} { \tl_set:Nn \l_label_pos_str_tl {above~left} }
7663 {ar} { \tl_set:Nn \l_label_pos_str_tl {above~right} }
7664 {bl} { \tl_set:Nn \l_label_pos_str_tl {below~left} }
7665 {br} { \tl_set:Nn \l_label_pos_str_tl {below~right} }
7666 }
7667 {
7668 \tl_set:Nn \l_label_pos_str_tl { #4 }
7669 }
7670 }
7671 }
7672 {
7673 \tl_clear:N \l_label_pos_str_tl
7674 }
7675 %%%%%%%%%%
7676
7677 \bool_if:NTF \l_tznodedots_shift_coor_bool
7678 {
7679 \tl_put_right:Nx \l_tznodedots_cmd_tl
7680 {% if shift
7681 ( [ shift = { (\l_tznodedots_shift_coor_tl) } ] #1 )
7682 }
7683 }
7684 { \tl_put_right:Nn \l_tznodedots_cmd_tl { (#1) } }
7685
7686 \tl_put_right:Nn \l_tznodedots_cmd_tl { node (#2) } %% node (name)
7687
7688 \tl_put_right:Nx \l_tznodedots_cmd_tl
7689 {
7690 [
7691 \l_tznodedots_STYLE_fill_tl ,
7692 minimum~size = \exp_not:n { \tzdotsize } ,
7693 label = { \l_label_pos_str_tl \c_colon_str \exp_not:n { #3 } } , % pos_str
7694 }
7695 \tl_put_right:No \l_tznodedots_cmd_tl % expand `once'
7696 {
7697 \l_tznodedots_opt_tl
7698 ] {}
7699 }
7700 \tznodedots_check_token:n
7701 }
7702
7703 \NewDocumentCommand\tznodedots_late_opt_fn { D(){\tz@initial@dot@size} }
7704 {
7705 \renewcommand\tzdotsize{ #1 }
7706
7707 \tznodedots_stop_action
7708 }
7709
7710
7711 \NewDocumentCommand\tznodedots_stop_action {}
7712 {
7713 \exp_last_unbraced:Nf \path \l_tznodedots_cmd_tl ;
7714 }
7715
7716 %%% --- end of \tznodedots
7717
7718
7719
7720 %%% \tznodeframe
7721
7722 \NewDocumentCommand\tznodeframe
7723 { s O{} d<> r() D(){} +G{} O{} G{\tz@initial@fill@opacity} }
7724 {
7725 \renewcommand\tzfillopacity{#8}
7726 \IfBooleanTF { #1 }
7727 {
7728 \node [
7729 draw , rectangle ,
7730 fill ,
7731 fill~opacity = \tzfillopacity , text~opacity = 1 ,
7732 #2
7733 ]
7734 (#5) at \IfValueTF { #3 } { ([shift={(#3)}]#4) } { (#4) }
7735 [ draw = black , text = black , #7 ] { #6 } ;
7736 }
7737 {
7738 \node [ draw , rectangle , #2 ]
7739 (#5) at \IfValueTF { #3 } { ([shift={(#3)}]#4) } { (#4) }
7740 [ text = black , #7 ] { #6 } ;
7741 }
7742 }
7743
7744
7745 %%% \tznodebox \tznoderectangle
7746 \let\tznodebox\tznodeframe
7747 \let\tznoderectangle\tznodeframe
7748
7749
7750
7751 %%% \tznodecircle
7752
7753 \NewDocumentCommand\tznodecircle
7754 { s O{} d<> D""{} r() D(){tzNodeName} }
7755 {
7756 \tl_clear:N \l_tznodecircle_opt_tl
7757 \tl_clear:N \l_tznodecircle_cmd_tl
7758 \tl_clear:N \l_tznodecircle_late_opt_tl
7759 \tl_clear:N \l_tznodecircle_namepath_tl
7760
7761 \tl_set:Nn \l_tmpa_tl { #2 }
7762
7763 \tl_set:Nn \l_tznodecircle_namepath_tl { #4 }
7764
7765 \IfBooleanTF { #1 }
7766 { \bool_set_true:N \l_tmpa_bool }
7767 { \bool_set_false:N \l_tmpa_bool }
7768
7769 \tl_set:Nx \l_tznodecircle_cmd_tl
7770 { (#6) at \IfValueTF { #3 } { ([shift={(#3)}]#5) } { (#5) } }
7771
7772 \tznodecircle_final_actions
7773 }
7774
7775 \NewDocumentCommand\tznodecircle_final_actions
7776 { +G{} O{} d() G{\tz@initial@fill@opacity}}
7777 {
7778 \renewcommand\tzfillopacity{#4}
7779
7780 % minimum size called or not
7781 \IfValueTF { #3 }
7782 { \bool_set_true:N \l_tmpb_bool }
7783 { \bool_set_false:N \l_tmpb_bool }
7784
7785 \bool_if:NTF \l_tmpa_bool
7786 { % starred version
7787 \bool_if:NTF \l_tmpb_bool
7788 { % if minimum size called
7789 \tl_set:Nx \l_tznodecircle_opt_tl
7790 {
7791 [
7792 draw , circle ,
7793 fill = \tzfillcolor ,
7794 name~path = \l_tznodecircle_namepath_tl ,
7795 fill~opacity = \tzfillopacity , text~opacity = 1 ,
7796 inner~sep = 0pt, outer~sep = 0pt ,
7797 minimum~size = #3 , %%
7798 }
7799 }
7800 { % not called
7801 \tl_set:Nx \l_tznodecircle_opt_tl
7802 {
7803 [
7804 draw , circle ,
7805 fill = \tzfillcolor ,
7806 name~path = \l_tznodecircle_namepath_tl ,
7807 fill~opacity = \tzfillopacity , text~opacity = 1 ,
7808 outer~sep = 0pt ,
7809 }
7810 }
7811 }
7812 { % standard version
7813 \bool_if:NTF \l_tmpb_bool
7814 { % if minimum size called
7815 \tl_set:Nx \l_tznodecircle_opt_tl
7816 {
7817 [ draw , circle ,
7818 name~path = \l_tznodecircle_namepath_tl ,
7819 inner~sep = 0pt , outer~sep = 0pt ,
7820 minimum~size = #3 , %%
7821 }
7822 }
7823 { % not called
7824 \tl_set:Nx \l_tznodecircle_opt_tl
7825 {
7826 [ draw , circle ,
7827 name~path = \l_tznodecircle_namepath_tl ,
7828 outer~sep = 0pt ,
7829 }
7830 }
7831 }
7832
7833 \bool_if:NTF \l_tmpa_bool
7834 { % starred version
7835 \tl_set:Nn \l_tznodecircle_late_opt_tl
7836 { [ draw = black , text = black , #2 ] { #1 } }
7837 }
7838 { % standard version
7839 \tl_set:Nn \l_tznodecircle_late_opt_tl
7840 { [ text = black , #2 ] { #1 } }
7841 }
7842
7843 \tl_put_right:No \l_tznodecircle_opt_tl { \l_tmpa_tl ] }
7844
7845 \tl_put_left:No \l_tznodecircle_cmd_tl { \l_tznodecircle_opt_tl }
7846 \tl_put_right:No \l_tznodecircle_cmd_tl { \l_tznodecircle_late_opt_tl }
7847
7848 \exp_last_unbraced:Nf \node \l_tznodecircle_cmd_tl ;
7849 }
7850
7851 %%% --- end of \tznodecircle
7852
7853
7854
7855 %%% \tznodeellipse
7856
7857 \NewDocumentCommand\tznodeellipse
7858 { s O{} d<> r() D(){tzNodeName} +G{} O{} G{\tz@initial@fill@opacity} }
7859 {
7860 \renewcommand\tzfillopacity{#8}
7861 \IfBooleanTF { #1 }
7862 {
7863 \node [
7864 draw , ellipse ,
7865 fill ,
7866 fill~opacity = \tzfillopacity , text~opacity = 1 ,
7867 #2
7868 ]
7869 (#5) at \IfValueTF { #3 } { ([shift={(#3)}]#4) } { (#4) }
7870 [ draw = black , text = black , #7 ] { #6 } ;
7871 }
7872 {
7873 \node [ draw , ellipse , #2 ]
7874 (#5) at \IfValueTF { #3 } { ([shift={(#3)}]#4) } { (#4) }
7875 [ text = black , #7 ] { #6 } ;
7876 }
7877 }
7878
7879 %%% \tznodeoval
7880 \let\tznodeoval\tznodeellipse
7881
7882
7883
7884 %%%%% Secant lines
7885
7886 %% secant line
7887
7888 %%% \tzsecantat (main)
7889
7890 \use:x{
7891 \NewDocumentCommand \exp_not:N \tzsecantat
7892 { s O{} d<> D""{} m m m
7893 >{ \SplitArgument { 1 } { \tl_to_str:n {:} } } o
7894 }
7895 }
7896 {
7897 \tl_clear:N \l_tzsecantat_cmd_tl
7898
7899 \IfBooleanTF { #1 } % NOT USED!
7900 { \bool_set_true:N \l_tmpa_bool }
7901 { \bool_set_false:N \l_tmpa_bool }
7902
7903 % define two points
7904 \tzvXpointat{#5}{#6}(LX-point) % vertical X point
7905 \tzvXpointat{#5}{#7}(RX-point) % vertical X point
7906
7907 % collect cmd_tl
7908
7909 \IfNoValueTF { #8 }
7910 {
7911 \IfValueTF { #3 }
7912 {% if shift
7913 \tl_put_right:Nn \l_tzsecantat_cmd_tl
7914 {
7915 [ name~path = #4 , #2 ]
7916 ([ shift = { (#3) } ]LX-point) -- ([ shift = { (#3) } ]RX-point)
7917 }
7918 }
7919 {% no shift (normal)
7920 \tl_put_right:Nn \l_tzsecantat_cmd_tl
7921 {
7922 [ name~path = #4 , #2 ]
7923 (LX-point) -- (RX-point)
7924 }
7925 }
7926 }
7927 {
7928 \tzsecantat_domain_process #8
7929 \tzgetxyval(LX-point){\tzTANLLX}{\tzTANLLY}
7930 \tzgetxyval(RX-point){\tzTANRRX}{\tzTANRRY}
7931
7932 \edef\tzTANSlope{(\tzTANRRY-\tzTANLLY)/(\tzTANRRX-\tzTANLLX)}
7933 \def\tzsecantatLFn{\tzTANSlope*(\x-\tzTANLLX)+\tzTANLLY}
7934
7935 \IfValueTF { #3 }
7936 {% shift
7937 \tl_put_right:Nn \l_tzsecantat_cmd_tl
7938 {
7939 [ name~path = #4 ,
7940 shift = { (#3) } ,
7941 }
7942 }
7943 {% no shift (normal)
7944 \tl_put_right:Nn \l_tzsecantat_cmd_tl
7945 {
7946 [ name~path = #4 ,
7947 }
7948 }
7949
7950 \tl_put_right:Nx \l_tzsecantat_cmd_tl
7951 {
7952 domain = \tzsecantatFromVal \c_colon_str \tzsecantatToVal ,
7953 }
7954 \tl_put_right:Nn \l_tzsecantat_cmd_tl
7955 {
7956 #2 ]
7957 plot ( \x , { \tzsecantatLFn } ) % \x should not be expanded
7958 }
7959 }
7960
7961 % \tzsecantat_sub_fn:n
7962 \tzsecantat_final_actions
7963 }
7964
7965 \NewDocumentCommand\tzsecantat_domain_process{ m m }
7966 {
7967 \def\tzsecantatFromVal{#1}
7968 \def\tzsecantatToVal{#2}
7969 }
7970
7971 %\cs_new:Npn \tzsecantat_sub_fn:n
7972 %{
7973 % \tzsecantat_final_actions
7974 %}
7975
7976 \NewDocumentCommand\tzsecantat_final_actions { +G{} O{} D<>{} }
7977 {
7978 \begin{pgfonlayer}{\tzsecantlayer}
7979 \exp_last_unbraced:Nf \draw \l_tzsecantat_cmd_tl node [ #2 ] { #1 } #3 ;
7980 \end{pgfonlayer}
7981 % to resolve TikZ issue: unknown path name with layer group
7982 \exp_last_unbraced:Nf \path \l_tzsecantat_cmd_tl ;
7983 }
7984
7985 %%% --- end of \tzsecantat
7986
7987
7988 %%% \tzsecant (main)
7989
7990 \use:x{
7991 \NewDocumentCommand \exp_not:N \tzsecant
7992 { s O{} d<> d"" m r() r()
7993 >{ \SplitArgument { 1 } { \tl_to_str:n {:} } } o
7994 }
7995 }
7996 {
7997 \tl_clear:N \l_tzsecant_cmd_tl
7998
7999 \IfBooleanTF { #1 } % NOT USED!
8000 { \bool_set_true:N \l_tmpa_bool }
8001 { \bool_set_false:N \l_tmpa_bool }
8002
8003 % define two points
8004 \tzvXpoint{#5}(#6)(LX-point) % vertical X point
8005 \tzvXpoint{#5}(#7)(RX-point) % vertical X point
8006
8007 % collect cmd_tl
8008 \IfNoValueTF { #8 }
8009 {
8010 \IfValueTF { #3 }
8011 {% if shift
8012 \tl_put_right:Nn \l_tzsecant_cmd_tl
8013 {
8014 [ name~path = #4 , #2 ]
8015 ([ shift = { (#3) } ]LX-point) -- ([ shift = { (#3) } ]RX-point)
8016 }
8017 }
8018 {% no shift (normal)
8019 \tl_put_right:Nn \l_tzsecant_cmd_tl
8020 {
8021 [ name~path = #4 , #2 ]
8022 (LX-point) -- (RX-point)
8023 }
8024 }
8025 }
8026 {
8027 \tzsecant_domain_process #8
8028 \tzgetxyval(LX-point){\tzTANLLX}{\tzTANLLY}
8029 \tzgetxyval(RX-point){\tzTANRRX}{\tzTANRRY}
8030
8031 \edef\tzTANSlope{(\tzTANRRY-\tzTANLLY)/(\tzTANRRX-\tzTANLLX)}
8032 \def\tzsecantLFn{\tzTANSlope*(\x-\tzTANLLX)+\tzTANLLY}
8033
8034 \IfValueTF { #3 }
8035 {% shift
8036 \tl_put_right:Nn \l_tzsecant_cmd_tl
8037 {
8038 [ name~path = #4 ,
8039 shift = { (#3) } ,
8040 }
8041 }
8042 {% no shift (normal)
8043 \tl_put_right:Nn \l_tzsecant_cmd_tl
8044 {
8045 [ name~path = #4 ,
8046 }
8047 }
8048
8049 \tl_put_right:Nx \l_tzsecant_cmd_tl
8050 {
8051 domain = \tzsecantFromVal \c_colon_str \tzsecantToVal ,
8052 }
8053 \tl_put_right:Nn \l_tzsecant_cmd_tl
8054 {
8055 #2 ]
8056 plot ( \x , { \tzsecantLFn } ) % \x should not be expanded
8057 }
8058 }
8059
8060 % \tzsecant_sub_fn:n
8061 \tzsecant_final_actions
8062 }
8063
8064 \NewDocumentCommand\tzsecant_domain_process{ m m }
8065 {
8066 \def\tzsecantFromVal{#1}
8067 \def\tzsecantToVal{#2}
8068 }
8069
8070 %\cs_new:Npn \tzsecant_sub_fn:n
8071 %{
8072 % \tzsecant_final_actions
8073 %}
8074
8075 \NewDocumentCommand\tzsecant_final_actions { +G{} O{} D<>{} }
8076 {
8077 \begin{pgfonlayer}{\tzsecantlayer}
8078 \exp_last_unbraced:Nf \draw \l_tzsecant_cmd_tl node [ #2 ] { #1 } #3 ;
8079 \end{pgfonlayer}
8080 % to resolve TikZ issue: unknown path name with layer group
8081 \exp_last_unbraced:Nf \path \l_tzsecant_cmd_tl ;
8082 }
8083
8084 %%% --- end of \tzsecant
8085
8086
8087 %%%%% Slope and Tangent
8088
8089 %%% to **resolve** the discrepancy issue due to bounding box
8090 %%% for \tzslope(at) and \tztangent(at)
8091 %%% (ndh)
8092
8093 \NewDocumentCommand \IfNodeDefined { m m m }
8094 {
8095 \@ifundefined{pgf@sh@ns@#1}
8096 {#3}
8097 {#2}
8098 }
8099
8100 \AddToHook{env/tikzpicture/before}{%
8101 \@ifundefined{pgf@sh@ns@bbxBottom}
8102 {}
8103 { \cs_undefine:N \pgf@sh@ns@bbxBottom }
8104 \def\TANCurve{} \def\TANWhere{}
8105 }
8106 %\AddToHook{env/tikzpicture/before}{%
8107 % \@ifundefined{pgf@sh@ns@bbxBottom}
8108 % {}
8109 % { \cs_undefine:N \pgf@sh@ns@bbxBottom }
8110 %}
8111
8112 %%% Do not forget to declare, before final action,
8113 %%% \gdef\TANCurve{<#m>}\gdef\TANWhere{<#n>}
8114
8115
8116 %%%%% Slope lines
8117 %% No <shift coor>
8118 %% No <shift coor>
8119 %% No <shift coor>
8120
8121 %%% \tzslopeat
8122 %% -- slope line at x
8123
8124 \bool_new:N \l_tzslopeat_bbox_bool
8125
8126 %%% \tzslopeat (main)
8127 \NewDocumentCommand\tzslopeat
8128 { t' O{} m m
8129 >{ \SplitArgument { 1 } { , } } d()
8130 m O{0} % +G{} O{} D<>{}
8131 }
8132 {
8133 % to resolve discrepancy (due to bounding box), when repeated
8134 \bool_if:nTF
8135 {
8136 \str_if_eq_p:ee { \TANCurve } { #3 } &&
8137 \str_if_eq_p:ee { \TANWhere } { #4 }
8138 }
8139 { \bool_set_true:N \l_tzslopeat_bbox_bool }
8140 { \bool_set_false:N \l_tzslopeat_bbox_bool }
8141
8142 % for local change of epsilon_1, epsilon_2
8143 \IfValueT { #5 }
8144 {
8145 \tzslopeat_epsilon_process #5
8146 \renewcommand\tzslopeepsilonL{\tzslopeatEpsilonOne}
8147 \renewcommand\tzslopeepsilonR{\tzslopeatEpsilonTwo}
8148 }
8149
8150 % getting ready
8151 \coordinate (LXcoor) at ($(#4,0)-(\tzslopeepsilonL,0)$) ;
8152 \coordinate (RXcoor) at ($(#4,0)+(\tzslopeepsilonR,0)$) ;
8153
8154 \bool_if:NTF \l_tzslopeat_bbox_bool
8155 {
8156 \IfNodeDefined{bbxBottom}{}
8157 {
8158 \coordinate (bbxTop) at (current~bounding~box.north) ;
8159 \coordinate (bbxBottom) at (current~bounding~box.south) ;
8160 }
8161 }
8162 {
8163 \coordinate (bbxTop) at (current~bounding~box.north) ;
8164 \coordinate (bbxBottom) at (current~bounding~box.south) ;
8165 }
8166
8167 % find vertical X points
8168 \path [ name~path = C-vline ] (#4,0 |- bbxBottom) -- (#4,0 |- bbxTop) ;
8169 \path [ name~intersections = { of = #3 ~ and ~ C-vline , name = TANp } ] ;
8170
8171 \path [ name~path = L-vline ] (LXcoor |- bbxBottom) -- (LXcoor |- bbxTop) ;
8172 \path [ name~intersections = { of = #3 ~ and ~ L-vline , name = LXcut } ] ;
8173
8174 \path [ name~path = R-vline ] (RXcoor |- bbxBottom) -- (RXcoor |- bbxTop) ;
8175 \path [ name~intersections = { of = #3 ~ and ~ R-vline , name = RXcut } ] ;
8176
8177 % move to tangent point
8178 \coordinate (tzXproj)
8179 at ($(LXcut-1)!(TANp-1)!(RXcut-1)$); % projection
8180 \coordinate (LLpoint)
8181 at ($(LXcut-1)+(TANp-1)-(tzXproj)$); % move
8182 \coordinate (RRpoint)
8183 at ($(RXcut-1)+(TANp-1)-(tzXproj)$); % move
8184
8185 % determine final extended points
8186 \tl_set:Nx \l_tmpa_tl
8187 {
8188 \IfBooleanTF { #1 }
8189 {
8190 (RRpoint) -- (TANp-1) --
8191 ([turn]-180 \c_colon_str #6/2 ) coordinate (final-LL)
8192 }
8193 {
8194 (RRpoint) -- (TANp-1) --
8195 ([turn]#7 \c_colon_str #6/2 ) coordinate (final-LL)
8196 }
8197 }
8198 \tl_set:Nx \l_tmpb_tl
8199 {
8200 \IfBooleanTF { #1 }
8201 {
8202 (LLpoint) -- (TANp-1) --
8203 ([turn]-180 \c_colon_str #6/2 ) coordinate (final-RR)
8204 }
8205 {
8206 (LLpoint) -- (TANp-1) --
8207 ([turn]#7 \c_colon_str #6/2 ) coordinate (final-RR)
8208 }
8209 }
8210
8211 \exp_last_unbraced:Nf \path \l_tmpa_tl ;
8212 \exp_last_unbraced:Nf \path \l_tmpb_tl ;
8213
8214 \tl_set:Nn \l_tzslopeat_cmd_tl
8215 {
8216 [ #2 ] (final-LL) -- (final-RR)
8217 }
8218
8219 \gdef\TANCurve{#3}\gdef\TANWhere{#4}
8220
8221 \tzslopeat_final_actions
8222 }
8223
8224 \NewDocumentCommand\tzslopeat_epsilon_process{ m m }
8225 {
8226 \def\tzslopeatEpsilonOne{#1}
8227 \def\tzslopeatEpsilonTwo{#2}
8228 }
8229
8230 \NewDocumentCommand\tzslopeat_final_actions{ +G{} O{} D<>{} }
8231 {
8232 % final action
8233 \begin{pgfonlayer}{\tzslopelayer}
8234 \exp_last_unbraced:Nf \draw \l_tzslopeat_cmd_tl node [ #2 ] { #1 } #3 ;
8235 \end{pgfonlayer}
8236 % to resolve TikZ issue: unknown path name with layer group
8237 \exp_last_unbraced:Nf \path \l_tzslopeat_cmd_tl ;
8238
8239 }
8240
8241 %%% --- end of \tzslopeat
8242
8243
8244 %%% \tzslope (On) -- slope line at (x,y)
8245
8246 \bool_new:N \l_tzslope_bbox_bool
8247
8248 %%% \tzslope (main)
8249 \NewDocumentCommand\tzslope
8250 { t' O{} m r()
8251 >{ \SplitArgument { 1 } { , } } d()
8252 m O{0} % +G{} O{} D<>{}
8253 }
8254 {
8255 % to resolve discrepancy (due to bounding box), when repeated
8256 \bool_if:nTF
8257 {
8258 \str_if_eq_p:ee { \TANCurve } { #3 } &&
8259 \str_if_eq_p:ee { \TANWhere } { #4 }
8260 }
8261 { \bool_set_true:N \l_tzslope_bbox_bool }
8262 { \bool_set_false:N \l_tzslope_bbox_bool }
8263
8264 % for local change of epsilon_1, epsilon_2
8265 \IfValueT { #5 }
8266 {
8267 \tzslope_epsilon_process #5
8268 \renewcommand\tzslopeepsilonL{\tzslopeEpsilonOne}
8269 \renewcommand\tzslopeepsilonR{\tzslopeEpsilonTwo}
8270 }
8271
8272 % getting ready
8273 \coordinate (LXcoor) at ($(#4)-(\tzslopeepsilonL,0)$) ;
8274 \coordinate (RXcoor) at ($(#4)+(\tzslopeepsilonR,0)$) ;
8275
8276 \bool_if:NTF \l_tzslope_bbox_bool
8277 {
8278 \IfNodeDefined{bbxBottom}{}
8279 {
8280 \coordinate (bbxTop) at (current~bounding~box.north) ;
8281 \coordinate (bbxBottom) at (current~bounding~box.south) ;
8282 }
8283 }
8284 {
8285 \coordinate (bbxTop) at (current~bounding~box.north) ;
8286 \coordinate (bbxBottom) at (current~bounding~box.south) ;
8287 }
8288
8289 % find vertical X points
8290 \path [ name~path = C-vline ] (#4 |- bbxBottom) -- (#4 |- bbxTop) ;
8291 \path [ name~intersections = { of = #3 ~ and ~ C-vline , name = TANp } ] ;
8292
8293 \path [ name~path = L-vline ] (LXcoor |- bbxBottom) -- (LXcoor |- bbxTop) ;
8294 \path [ name~intersections = { of = #3 ~ and ~ L-vline , name = LXcut } ] ;
8295
8296 \path [ name~path = R-vline ] (RXcoor |- bbxBottom) -- (RXcoor |- bbxTop) ;
8297 \path [ name~intersections = { of = #3 ~ and ~ R-vline , name = RXcut } ] ;
8298
8299 % move to tangent point
8300 \coordinate (tzXproj)
8301 at ($(LXcut-1)!(TANp-1)!(RXcut-1)$); % projection
8302 \coordinate (LLpoint)
8303 at ($(LXcut-1)+(TANp-1)-(tzXproj)$); % move
8304 \coordinate (RRpoint)
8305 at ($(RXcut-1)+(TANp-1)-(tzXproj)$); % move
8306
8307 % determine final extended points
8308 \tl_set:Nx \l_tmpa_tl
8309 {
8310 \IfBooleanTF { #1 }
8311 {
8312 (RRpoint) -- (TANp-1) --
8313 ([turn]-180 \c_colon_str #6/2 ) coordinate (final-LL)
8314 }
8315 {
8316 (RRpoint) -- (TANp-1) --
8317 ([turn]#7 \c_colon_str #6/2 ) coordinate (final-LL)
8318 }
8319 }
8320 \tl_set:Nx \l_tmpb_tl
8321 {
8322 \IfBooleanTF { #1 }
8323 {
8324 (LLpoint) -- (TANp-1) --
8325 ([turn]-180 \c_colon_str #6/2 ) coordinate (final-RR)
8326 }
8327 {
8328 (LLpoint) -- (TANp-1) --
8329 ([turn]#7 \c_colon_str #6/2 ) coordinate (final-RR)
8330 }
8331 }
8332
8333 \exp_last_unbraced:Nf \path \l_tmpa_tl ;
8334 \exp_last_unbraced:Nf \path \l_tmpb_tl ;
8335
8336 \tl_set:Nn \l_tzslope_cmd_tl
8337 {
8338 [ #2 ] (final-LL) -- (final-RR)
8339 }
8340
8341 \gdef\TANCurve{#3}\gdef\TANWhere{#4}
8342
8343 \tzslope_final_actions
8344 }
8345
8346 \NewDocumentCommand\tzslope_epsilon_process{ m m }
8347 {
8348 \def\tzslopeEpsilonOne{#1}
8349 \def\tzslopeEpsilonTwo{#2}
8350 }
8351
8352 \NewDocumentCommand\tzslope_final_actions{ +G{} O{} D<>{} }
8353 {
8354 % final action
8355 \begin{pgfonlayer}{\tzslopelayer}
8356 \exp_last_unbraced:Nf \draw \l_tzslope_cmd_tl node [ #2 ] { #1 } #3 ;
8357 \end{pgfonlayer}
8358 % to resolve TikZ issue: unknown path name with layer group
8359 \exp_last_unbraced:Nf \path \l_tzslope_cmd_tl ;
8360 }
8361
8362 %%% --- end of \tzslope
8363
8364
8365
8366 %%%%% Normal lines
8367 %% No <shift coor>
8368 %% No <shift coor>
8369 %% No <shift coor>
8370
8371 %%% \tznormalat
8372 %% -- normal line at x
8373
8374 \bool_new:N \l_tznormalat_bbox_bool
8375
8376 %%% \tznormalat (main)
8377 \NewDocumentCommand\tznormalat
8378 { s t' O{} m m
8379 >{ \SplitArgument { 1 } { , } } d()
8380 m O{90} % +G{} O{} D<>{}
8381 }
8382 {
8383 % to resolve discrepancy (due to bounding box), when repeated
8384 \bool_if:nTF
8385 {
8386 \str_if_eq_p:ee { \TANCurve } { #4 } &&
8387 \str_if_eq_p:ee { \TANWhere } { #5 }
8388 }
8389 { \bool_set_true:N \l_tznormalat_bbox_bool }
8390 { \bool_set_false:N \l_tznormalat_bbox_bool }
8391
8392 % for local change of epsilon_1, epsilon_2
8393 \IfValueT { #6 }
8394 {
8395 \tznormalat_epsilon_process #6
8396 \renewcommand\tznormalepsilonL{\tznormalatEpsilonOne}
8397 \renewcommand\tznormalepsilonR{\tznormalatEpsilonTwo}
8398 }
8399
8400 % getting ready
8401 \coordinate (LXcoor) at ($(#5,0)-(\tznormalepsilonL,0)$) ;
8402 \coordinate (RXcoor) at ($(#5,0)+(\tznormalepsilonR,0)$) ;
8403
8404 \bool_if:NTF \l_tznormalat_bbox_bool
8405 {
8406 \IfNodeDefined{bbxBottom}{}
8407 {
8408 \coordinate (bbxTop) at (current~bounding~box.north) ;
8409 \coordinate (bbxBottom) at (current~bounding~box.south) ;
8410 }
8411 }
8412 {
8413 \coordinate (bbxTop) at (current~bounding~box.north) ;
8414 \coordinate (bbxBottom) at (current~bounding~box.south) ;
8415 }
8416
8417 % find vertical X points
8418 \path [ name~path = C-vline ] (#5,0 |- bbxBottom) -- (#5,0 |- bbxTop) ;
8419 \path [ name~intersections = { of = #4 ~ and ~ C-vline , name = TANp } ] ;
8420
8421 \path [ name~path = L-vline ] (LXcoor |- bbxBottom) -- (LXcoor |- bbxTop) ;
8422 \path [ name~intersections = { of = #4 ~ and ~ L-vline , name = LXcut } ] ;
8423
8424 \path [ name~path = R-vline ] (RXcoor |- bbxBottom) -- (RXcoor |- bbxTop) ;
8425 \path [ name~intersections = { of = #4 ~ and ~ R-vline , name = RXcut } ] ;
8426
8427 % move to tangent point
8428 \coordinate (tzXproj)
8429 at ($(LXcut-1)!(TANp-1)!(RXcut-1)$); % projection
8430 \coordinate (LLpoint)
8431 at ($(LXcut-1)+(TANp-1)-(tzXproj)$); % move
8432 \coordinate (RRpoint)
8433 at ($(RXcut-1)+(TANp-1)-(tzXproj)$); % move
8434
8435 % determine final extended points
8436 % from (final-LL)
8437 \tl_set:Nx \l_tmpa_tl
8438 {
8439 \IfBooleanTF { #1 }
8440 {
8441 \IfBooleanTF { #2 }
8442 {
8443 (RRpoint) -- (TANp-1) --
8444 ([turn]-90 \c_colon_str #7/2 ) coordinate (final-LL)
8445 }
8446 {
8447 (RRpoint) -- (TANp-1) --
8448 ([turn]#8 \c_colon_str #7/2 ) coordinate (final-LL)
8449 }
8450 }
8451 {
8452 (TANp-1) coordinate (final-LL)
8453 }
8454 }
8455 % to (final-RR)
8456 \tl_set:Nx \l_tmpb_tl
8457 {
8458 \IfBooleanTF { #1 }
8459 { % starred : slope
8460 \IfBooleanTF { #2 }
8461 { % opposite direction (swap)
8462 (LLpoint) -- (TANp-1) --
8463 ([turn]-90 \c_colon_str #7/2 ) coordinate (final-RR)
8464 }
8465 {
8466 (LLpoint) -- (TANp-1) --
8467 ([turn]#8 \c_colon_str #7/2 ) coordinate (final-RR)
8468 }
8469 }
8470 { % standard : normal
8471 {
8472 \IfBooleanTF { #2 }
8473 { % opposite direction (swap)
8474 (LLpoint) -- (TANp-1) --
8475 ([turn]-90 \c_colon_str #7/2 ) coordinate (final-RR)
8476 }
8477 { % standard normal
8478 (LLpoint) -- (TANp-1) --
8479 ([turn]#8 \c_colon_str #7/2 ) coordinate (final-RR)
8480 }
8481 }
8482 }
8483 }
8484
8485 \exp_last_unbraced:Nf \path \l_tmpa_tl ;
8486 \exp_last_unbraced:Nf \path \l_tmpb_tl ;
8487
8488 \tl_set:Nn \l_tznormalat_cmd_tl
8489 {
8490 [ #3 ] (final-LL) -- (final-RR)
8491 }
8492
8493 \gdef\TANCurve{#4}\gdef\TANWhere{#5}
8494
8495 \tznormalat_final_actions
8496 }
8497
8498 \NewDocumentCommand\tznormalat_epsilon_process{ m m }
8499 {
8500 \def\tznormalatEpsilonOne{#1}
8501 \def\tznormalatEpsilonTwo{#2}
8502 }
8503
8504 \NewDocumentCommand\tznormalat_final_actions{ +G{} O{} D<>{} }
8505 {
8506 % final action
8507 \begin{pgfonlayer}{\tznormallayer}
8508 \exp_last_unbraced:Nf \draw \l_tznormalat_cmd_tl node [ #2 ] { #1 } #3 ;
8509 \end{pgfonlayer}
8510 % to resolve TikZ issue: unknown path name with layer group
8511 \exp_last_unbraced:Nf \path \l_tznormalat_cmd_tl ;
8512 }
8513
8514 %%% --- end of \tznormalat
8515
8516
8517 %%% \tznormal (On) -- normal line at (x,y)
8518
8519 \bool_new:N \l_tznormal_bbox_bool
8520
8521 %%% \tznormal (main)
8522 \NewDocumentCommand\tznormal
8523 { s t' O{} m r()
8524 >{ \SplitArgument { 1 } { , } } d()
8525 m O{90} % +G{} O{} D<>{}
8526 }
8527 {
8528 % to resolve discrepancy (due to bounding box), when repeated
8529 \bool_if:nTF
8530 {
8531 \str_if_eq_p:ee { \TANCurve } { #4 } &&
8532 \str_if_eq_p:ee { \TANWhere } { #5 }
8533 }
8534 { \bool_set_true:N \l_tznormal_bbox_bool }
8535 { \bool_set_false:N \l_tznormal_bbox_bool }
8536
8537 % for local change of epsilon_1, epsilon_2
8538 \IfValueT { #6 }
8539 {
8540 \tznormal_epsilon_process #6
8541 \renewcommand\tznormalepsilonL{\tznormalEpsilonOne}
8542 \renewcommand\tznormalepsilonR{\tznormalEpsilonTwo}
8543 }
8544
8545 % getting ready
8546 \coordinate (LXcoor) at ($(#5)-(\tznormalepsilonL,0)$) ;
8547 \coordinate (RXcoor) at ($(#5)+(\tznormalepsilonR,0)$) ;
8548
8549 \bool_if:NTF \l_tznormal_bbox_bool
8550 {
8551 \IfNodeDefined{bbxBottom}{}
8552 {
8553 \coordinate (bbxTop) at (current~bounding~box.north) ;
8554 \coordinate (bbxBottom) at (current~bounding~box.south) ;
8555 }
8556 }
8557 {
8558 \coordinate (bbxTop) at (current~bounding~box.north) ;
8559 \coordinate (bbxBottom) at (current~bounding~box.south) ;
8560 }
8561
8562 % find vertical X points
8563 \path [ name~path = C-vline ] (#5 |- bbxBottom) -- (#5 |- bbxTop) ;
8564 \path [ name~intersections = { of = #4 ~ and ~ C-vline , name = TANp } ] ;
8565
8566 \path [ name~path = L-vline ] (LXcoor |- bbxBottom) -- (LXcoor |- bbxTop) ;
8567 \path [ name~intersections = { of = #4 ~ and ~ L-vline , name = LXcut } ] ;
8568
8569 \path [ name~path = R-vline ] (RXcoor |- bbxBottom) -- (RXcoor |- bbxTop) ;
8570 \path [ name~intersections = { of = #4 ~ and ~ R-vline , name = RXcut } ] ;
8571
8572 % move to tangent point
8573 \coordinate (tzXproj)
8574 at ($(LXcut-1)!(TANp-1)!(RXcut-1)$); % projection
8575 \coordinate (LLpoint)
8576 at ($(LXcut-1)+(TANp-1)-(tzXproj)$); % move
8577 \coordinate (RRpoint)
8578 at ($(RXcut-1)+(TANp-1)-(tzXproj)$); % move
8579
8580 % determine final extended points
8581 % from (final-LL)
8582 \tl_set:Nx \l_tmpa_tl
8583 {
8584 \IfBooleanTF { #1 }
8585 {
8586 \IfBooleanTF { #2 }
8587 {
8588 (RRpoint) -- (TANp-1) --
8589 ([turn]-90 \c_colon_str #7/2 ) coordinate (final-LL)
8590 }
8591 {
8592 (RRpoint) -- (TANp-1) --
8593 ([turn]#8 \c_colon_str #7/2 ) coordinate (final-LL)
8594 }
8595 }
8596 {
8597 (TANp-1) coordinate (final-LL)
8598 }
8599 }
8600 % to (final-RR)
8601 \tl_set:Nx \l_tmpb_tl
8602 {
8603 \IfBooleanTF { #1 }
8604 { % starred : slope
8605 \IfBooleanTF { #2 }
8606 { % opposite direction (swap)
8607 (LLpoint) -- (TANp-1) --
8608 ([turn]-90 \c_colon_str #7/2 ) coordinate (final-RR)
8609 }
8610 {
8611 (LLpoint) -- (TANp-1) --
8612 ([turn]#8 \c_colon_str #7/2 ) coordinate (final-RR)
8613 }
8614 }
8615 { % standard : normal
8616 {
8617 \IfBooleanTF { #2 }
8618 { % opposite direction (swap)
8619 (LLpoint) -- (TANp-1) --
8620 ([turn]-90 \c_colon_str #7/2 ) coordinate (final-RR)
8621 }
8622 { % standard normal
8623 (LLpoint) -- (TANp-1) --
8624 ([turn]#8 \c_colon_str #7/2 ) coordinate (final-RR)
8625 }
8626 }
8627 }
8628 }
8629
8630 \exp_last_unbraced:Nf \path \l_tmpa_tl ;
8631 \exp_last_unbraced:Nf \path \l_tmpb_tl ;
8632
8633 \tl_set:Nn \l_tznormal_cmd_tl
8634 {
8635 [ #3 ] (final-LL) -- (final-RR)
8636 }
8637
8638 \gdef\TANCurve{#4}\gdef\TANWhere{#5}
8639
8640 \tznormal_final_actions
8641 }
8642
8643 \NewDocumentCommand\tznormal_epsilon_process{ m m }
8644 {
8645 \def\tznormalEpsilonOne{#1}
8646 \def\tznormalEpsilonTwo{#2}
8647 }
8648
8649 \NewDocumentCommand\tznormal_final_actions{ +G{} O{} D<>{} }
8650 {
8651 % final action
8652 \begin{pgfonlayer}{\tznormallayer}
8653 \exp_last_unbraced:Nf \draw \l_tznormal_cmd_tl node [ #2 ] { #1 } #3 ;
8654 \end{pgfonlayer}
8655 % to resolve TikZ issue: unknown path name with layer group
8656 \exp_last_unbraced:Nf \path \l_tznormal_cmd_tl ;
8657 }
8658
8659 %%% --- end of \tznormal
8660
8661
8662
8663
8664 %%%%% Tangent lines
8665
8666 %%% \tztangentat -- tangent to a path at x
8667 %%% ref. \settztangentepsilon
8668 %%% [<opt>]<shift coor>"<path name>"{<path>}{<x>}(<epsilon1>,<epsilon2>)[<from>:<to>]{<text>}[<pos,opt>]<code.append>
8669
8670 \bool_new:N \l_tztangentat_bbox_bool
8671
8672 %%% \tztangentat (main)
8673 \use:x{
8674 \NewDocumentCommand \exp_not:N \tztangentat
8675 { s O{} d<> D""{} m m
8676 >{ \SplitArgument { 1 } { , } } d()
8677 >{ \SplitArgument { 1 } { \tl_to_str:n {:} } } r[] }
8678 }
8679 {
8680 \tl_clear:N \l_tztangentat_cmd_tl
8681
8682 \IfBooleanTF { #1 } % NOT USED!
8683 { \bool_set_true:N \l_tmpa_bool }
8684 { \bool_set_false:N \l_tmpa_bool }
8685
8686 % to resolve discrepancy (due to bounding box), when repeated
8687 \bool_if:nTF
8688 {
8689 \str_if_eq_p:ee { \TANCurve } { #5 } &&
8690 \str_if_eq_p:ee { \TANWhere } { #6 }
8691 }
8692 { \bool_set_true:N \l_tztangentat_bbox_bool }
8693 { \bool_set_false:N \l_tztangentat_bbox_bool }
8694
8695 % for local change of epsilon_1 and _2
8696 \IfValueT { #7 }
8697 {
8698 \tztangentat_epsilon_process #7
8699 \renewcommand\tztangentepsilonL{\tztangentatEpsilonOne}
8700 \renewcommand\tztangentepsilonR{\tztangentatEpsilonTwo}
8701 }
8702
8703 \tztangentat_domain_process #8
8704
8705 % getting ready
8706 \coordinate (LXcoor) at ($(#6,0)-(\tztangentepsilonL,0)$) ;
8707 \coordinate (RXcoor) at ($(#6,0)+(\tztangentepsilonR,0)$) ;
8708
8709 \bool_if:NTF \l_tztangentat_bbox_bool
8710 {
8711 \IfNodeDefined{bbxBottom}{}
8712 {
8713 \coordinate (bbxTop) at (current~bounding~box.north) ;
8714 \coordinate (bbxBottom) at (current~bounding~box.south) ;
8715 }
8716 }
8717 {
8718 \coordinate (bbxTop) at (current~bounding~box.north) ;
8719 \coordinate (bbxBottom) at (current~bounding~box.south) ;
8720 }
8721
8722 % find vertical X points
8723 \path [ name~path = C-vline ] (#6,0 |- bbxBottom) -- (#6,0 |- bbxTop) ;
8724 \path [ name~intersections = { of = #5 ~ and ~ C-vline , name = TANp } ] ;
8725
8726 \path [ name~path = L-vline ] (LXcoor |- bbxBottom) -- (LXcoor |- bbxTop) ;
8727 \path [ name~intersections = { of = #5 ~ and ~ L-vline , name = LXcut } ] ;
8728
8729 \path [ name~path = R-vline ] (RXcoor |- bbxBottom) -- (RXcoor |- bbxTop) ;
8730 \path [ name~intersections = { of = #5 ~ and ~ R-vline , name = RXcut } ] ;
8731
8732 % move to tangent point
8733 \coordinate (tzXproj)
8734 at ($(LXcut-1)!(TANp-1)!(RXcut-1)$); % projection
8735 \coordinate (LLpoint)
8736 at ($(LXcut-1)+(TANp-1)-(tzXproj)$); % move
8737 \coordinate (RRpoint)
8738 at ($(RXcut-1)+(TANp-1)-(tzXproj)$); % move
8739
8740 % determine final extended points
8741 \tl_set:Nx \l_label_pos_tl
8742 {
8743 (RRpoint) -- (TANp-1) --
8744 ([turn]0 \c_colon_str ~ -\tztangentatFromVal) coordinate (final-LL)
8745 }
8746 \tl_set:Nx \l_tmpb_tl
8747 {
8748 (LLpoint) -- (TANp-1) --
8749 ([turn]0 \c_colon_str ~ \tztangentatToVal) coordinate (final-RR)
8750 }
8751
8752 \exp_last_unbraced:Nf \path \l_label_pos_tl ;
8753 \exp_last_unbraced:Nf \path \l_tmpb_tl ;
8754
8755 \tzgetxyval(LLpoint){\tzTANLLX}{\tzTANLLY}
8756 \tzgetxyval(RRpoint){\tzTANRRX}{\tzTANRRY}
8757
8758 \edef\tzTANSlope{(\tzTANRRY-\tzTANLLY)/(\tzTANRRX-\tzTANLLX)}
8759 \def\tztangentatLFn{\tzTANSlope*(\x-\tzTANLLX)+\tzTANLLY}
8760
8761 \IfValueTF { #3 }
8762 {
8763 \tl_put_right:Nn \l_tztangentat_cmd_tl
8764 {
8765 [ name~path = #4 ,
8766 shift = { (#3) } ,
8767 }
8768 }
8769 {
8770 \tl_put_right:Nn \l_tztangentat_cmd_tl
8771 {
8772 [ name~path = #4 ,
8773 }
8774 }
8775
8776 \tl_put_right:Nx \l_tztangentat_cmd_tl
8777 {
8778 domain = \tztangentatFromVal \c_colon_str \tztangentatToVal ,
8779 }
8780
8781 \tl_put_right:Nn \l_tztangentat_cmd_tl
8782 {
8783 #2 ]
8784 plot ( \x , { \tztangentatLFn } ) % \x should not be expanded
8785 }
8786
8787 \gdef\TANCurve{#5}\gdef\TANWhere{#6}
8788
8789 % \tztangentat_sub_fn:n
8790 \tztangentat_final_actions
8791 }
8792
8793 \NewDocumentCommand\tztangentat_epsilon_process{ m m }
8794 {
8795 \def\tztangentatEpsilonOne{#1}
8796 \def\tztangentatEpsilonTwo{#2}
8797 }
8798
8799 \NewDocumentCommand\tztangentat_domain_process{ m m }
8800 {
8801 \def\tztangentatFromVal{#1}
8802 \def\tztangentatToVal{#2}
8803 }
8804
8805 %\cs_new:Npn \tztangentat_sub_fn:n
8806 %{
8807 % \tztangentat_final_actions
8808 %}
8809
8810 \NewDocumentCommand\tztangentat_final_actions { +G{} O{} D<>{} }
8811 {
8812 \begin{pgfonlayer}{\tztangentlayer}
8813 \exp_last_unbraced:Nf \draw \l_tztangentat_cmd_tl
8814 node [ black , above~right , #2 ] { #1 } #3 ;
8815 \end{pgfonlayer}
8816 % to resolve TikZ issue: unknown path name with layer group
8817 \exp_last_unbraced:Nf \path \l_tztangentat_cmd_tl ;
8818 }
8819
8820 %%% --- end of \tztangentat
8821
8822
8823 %%% \tztangent (On) -- tangent to a path at (x,y)
8824 %%% [<opt>]<shift coor>"<path name>"{<path>}(<coor>)(<epsilon1>,<epsilon2>)[<from>:<to>]{<text>}[<pos,opt>]<code.append>
8825
8826 \bool_new:N \l_tztangent_bbox_bool
8827
8828 %%% \tztangent (main)
8829 \use:x{
8830 \NewDocumentCommand \exp_not:N \tztangent
8831 { s O{} d<> D""{} m r()
8832 >{ \SplitArgument { 1 } { , } } d()
8833 >{ \SplitArgument { 1 } { \tl_to_str:n {:} } } r[] }
8834 }
8835 {
8836 \tl_clear:N \l_tztangent_cmd_tl
8837
8838 \IfBooleanTF { #1 } % NOT USED!
8839 { \bool_set_true:N \l_tmpa_bool }
8840 { \bool_set_false:N \l_tmpa_bool }
8841
8842 % to resolve discrepancy (due to bounding box), when repeated
8843 \bool_if:nTF
8844 {
8845 \str_if_eq_p:ee { \TANCurve } { #5 } &&
8846 \str_if_eq_p:ee { \TANWhere } { #6 }
8847 }
8848 { \bool_set_true:N \l_tztangent_bbox_bool }
8849 { \bool_set_false:N \l_tztangent_bbox_bool }
8850
8851 % for local change of epsilon_1 and _2
8852 \IfValueT { #7 }
8853 {
8854 \tztangent_epsilon_process #7
8855 \renewcommand\tztangentepsilonL{\tztangentEpsilonOne}
8856 \renewcommand\tztangentepsilonR{\tztangentEpsilonTwo}
8857 }
8858
8859 \tztangent_domain_process #8
8860
8861 % getting ready
8862 \coordinate (LXcoor) at ($(#6)-(\tztangentepsilonL,0)$) ;
8863 \coordinate (RXcoor) at ($(#6)+(\tztangentepsilonR,0)$) ;
8864
8865 \bool_if:NTF \l_tztangent_bbox_bool
8866 {
8867 \IfNodeDefined{bbxBottom}{}
8868 {
8869 \coordinate (bbxTop) at (current~bounding~box.north) ;
8870 \coordinate (bbxBottom) at (current~bounding~box.south) ;
8871 }
8872 }
8873 {
8874 \coordinate (bbxTop) at (current~bounding~box.north) ;
8875 \coordinate (bbxBottom) at (current~bounding~box.south) ;
8876 }
8877
8878 % find vertical X points
8879 \path [ name~path = C-vline ] (#6 |- bbxBottom) -- (#6 |- bbxTop) ;
8880 \path [ name~intersections = { of = #5 ~ and ~ C-vline , name = TANp } ] ;
8881
8882 \path [ name~path = L-vline ] (LXcoor |- bbxBottom) -- (LXcoor |- bbxTop) ;
8883 \path [ name~intersections = { of = #5 ~ and ~ L-vline , name = LXcut } ] ;
8884
8885 \path [ name~path = R-vline ] (RXcoor |- bbxBottom) -- (RXcoor |- bbxTop) ;
8886 \path [ name~intersections = { of = #5 ~ and ~ R-vline , name = RXcut } ] ;
8887
8888 % move to tangent point
8889 \coordinate (tzXproj)
8890 at ($(LXcut-1)!(TANp-1)!(RXcut-1)$); % projection
8891 \coordinate (LLpoint)
8892 at ($(LXcut-1)+(TANp-1)-(tzXproj)$); % move
8893 \coordinate (RRpoint)
8894 at ($(RXcut-1)+(TANp-1)-(tzXproj)$); % move
8895
8896 % determine final extended points
8897 \tl_set:Nx \l_label_pos_tl
8898 { (RRpoint) -- (TANp-1) --
8899 ([turn]0 \c_colon_str ~ -\tztangentFromVal) coordinate (final-LL) }
8900 \tl_set:Nx \l_tmpb_tl
8901 { (LLpoint) -- (TANp-1) --
8902 ([turn]0 \c_colon_str ~ \tztangentToVal) coordinate (final-RR) }
8903
8904 \exp_last_unbraced:Nf \path \l_label_pos_tl ;
8905 \exp_last_unbraced:Nf \path \l_tmpb_tl ;
8906
8907 \tzgetxyval(LLpoint){\tzTANLLX}{\tzTANLLY}
8908 \tzgetxyval(RRpoint){\tzTANRRX}{\tzTANRRY}
8909
8910 \edef\tzTANSlope{(\tzTANRRY-\tzTANLLY)/(\tzTANRRX-\tzTANLLX)}
8911 \def\tztangentLFn{\tzTANSlope*(\x-\tzTANLLX)+\tzTANLLY}
8912
8913 \IfValueTF { #3 }
8914 {
8915 \tl_put_right:Nn \l_tztangent_cmd_tl
8916 {
8917 [ name~path = #4 ,
8918 shift = { (#3) } ,
8919 }
8920 }
8921 {
8922 \tl_put_right:Nn \l_tztangent_cmd_tl
8923 {
8924 [ name~path = #4 ,
8925 }
8926 }
8927
8928 \tl_put_right:Nx \l_tztangent_cmd_tl
8929 {
8930 domain = \tztangentFromVal \c_colon_str \tztangentToVal ,
8931 }
8932
8933 \tl_put_right:Nn \l_tztangent_cmd_tl
8934 {
8935 #2 ]
8936 plot ( \x , { \tztangentLFn } ) % \x should not be expanded
8937 }
8938
8939 \gdef\TANCurve{#5}\gdef\TANWhere{#6}
8940
8941 % \tztangent_sub_fn:n
8942 \tztangent_final_actions
8943 }
8944
8945 \NewDocumentCommand\tztangent_epsilon_process{ m m }
8946 {
8947 \def\tztangentEpsilonOne{#1}
8948 \def\tztangentEpsilonTwo{#2}
8949 }
8950
8951 \NewDocumentCommand\tztangent_domain_process{ m m }
8952 {
8953 \def\tztangentFromVal{#1}
8954 \def\tztangentToVal{#2}
8955 }
8956
8957 %\cs_new:Npn \tztangent_sub_fn:n
8958 %{
8959 % \tztangent_final_actions
8960 %}
8961
8962 \NewDocumentCommand\tztangent_final_actions { +G{} O{} D<>{} }
8963 {
8964 \begin{pgfonlayer}{\tztangentlayer}
8965 \exp_last_unbraced:Nf \draw \l_tztangent_cmd_tl
8966 node [ black , above~right , #2 ] { #1 } #3 ;
8967 \end{pgfonlayer}
8968 % to resolve TikZ issue: unknown path name with layer group
8969 \exp_last_unbraced:Nf \path \l_tztangent_cmd_tl ;
8970 }
8971
8972 %%% --- end of \tztangent
8973
8974
8975
8976
8977 %%%%% \tzbrace
8978
8979 %%% \tzbrace'[<opt>]{<raise>}[<brace opt>]
8980 %%% <shift coor>(<coor>)(<coor>){<text>}[<pos,opt>]
8981 \NewDocumentCommand\tzbrace{ t' O{} G{5pt} O{} d<> r() r() +G{} O{} }
8982 {
8983 \IfBooleanTF { #1 }
8984 {
8985 \draw [ decorate , decoration =
8986 { calligraphic~brace , mirror ,
8987 amplitude = 5pt, raise = #3 , #4 } , #2
8988 ]
8989 }
8990 {
8991 \draw [ decorate , decoration =
8992 { calligraphic~brace ,
8993 amplitude = 5pt, raise = #3 , #4 } , #2
8994 ]
8995 }
8996 \IfValueTF { #5 }
8997 {
8998 ([shift={(#5)}]#6) to node [ midway , #9 ] { #8 }
8999 ([shift={(#5)}]#7) ;
9000 }
9001 {
9002 (#6) to node [ midway , #9 ] { #8 } (#7) ;
9003 }
9004 }
9005
9006 %%% -- end of \tzbrace
9007
9008
9009 %%%(ADDED)
9010 %%% \tzsnake
9011
9012 \bool_new:N \l_tzsnake_shift_coor_bool
9013
9014 %%% \tzsnake (main)
9015 \NewDocumentCommand\tzsnake{ s t+ o G{5pt} O{} d<> }
9016 {
9017 \tl_clear:N \l_tzsnake_cmd_tl
9018
9019 \IfBooleanTF { #1 } % (*) or not (NOT USED!)
9020 { \bool_set_true:N \l_tmpa_bool }
9021 { \bool_set_false:N \l_tmpa_bool }
9022
9023 \IfBooleanTF { #2 } % (+) or not
9024 { \bool_set_true:N \l_tmpb_bool }
9025 { \bool_set_false:N \l_tmpb_bool }
9026
9027 \IfValueTF { #3 }
9028 { \tl_set:Nn \l_tzsnake_opt_tl { #3 } }
9029 { \tl_clear:N \l_tzsnake_opt_tl }
9030
9031 \tl_set:Nn \l_tzsnake_segment_length_tl { #4 }
9032
9033 \tl_set:Nn \l_tzsnake_snake_opt_tl { #5 }
9034
9035 \IfValueTF { #6 }
9036 {
9037 \tl_set:Nn \l_tzsnake_shift_coor_tl { #6 }
9038 \bool_set_true:N \l_tzsnake_shift_coor_bool
9039 }
9040 {
9041 \tl_clear:N \l_tzsnake_shift_coor_tl
9042 \bool_set_false:N \l_tzsnake_shift_coor_bool
9043 }
9044
9045 \tzsnake_check_token:n
9046 }
9047
9048 \cs_new:Npn \tzsnake_check_token:n #1
9049 {
9050 \str_if_eq:nnT { #1 } { ( }
9051 { \tzsnake_sub_fn ( }
9052 % \tzsnake_stop_action
9053 }
9054
9055 \NewDocumentCommand\tzsnake_sub_fn{ r() +G{} O{} r() +G{} O{} D<>{} }
9056 {
9057
9058 \bool_if:NTF \l_tzsnake_shift_coor_bool
9059 {% if shift
9060 \tl_put_right:Nx \l_tzsnake_cmd_tl
9061 { ([ shift = { (\l_tzsnake_shift_coor_tl) } ]#1) }
9062 }
9063 { \tl_put_right:Nn \l_tzsnake_cmd_tl { (#1) } }
9064
9065 \tl_put_right:Nn \l_tzsnake_cmd_tl
9066 { to ~node [ #3 ] { #2 } }
9067
9068 \bool_if:NTF \l_tmpb_bool
9069 {% if ++
9070 \tl_put_right:Nn \l_tzsnake_cmd_tl { ++ (#4) }
9071 }
9072 {% no ++
9073 \bool_if:NTF \l_tzsnake_shift_coor_bool
9074 {% if shift
9075 \tl_put_right:Nx \l_tzsnake_cmd_tl
9076 { ([ shift = { (\l_tzsnake_shift_coor_tl) } ]#4) }
9077 }
9078 { \tl_put_right:Nn \l_tzsnake_cmd_tl { (#4) } }
9079 }
9080
9081 \tl_put_right:Nn \l_tzsnake_cmd_tl
9082 { node [ #6 ] { #5 } }
9083
9084 % final action
9085 \tl_put_left:No \l_tzsnake_cmd_tl
9086 {
9087 \l_tzsnake_opt_tl ] % expand `once' needed
9088 }
9089
9090 \tl_put_left:Nx \l_tzsnake_cmd_tl
9091 {
9092 [ decorate ,
9093 decoration =
9094 { snake ,
9095 pre~length = 5pt , post~length = 5pt ,
9096 amplitude = 2.5pt ,
9097 segment~length = \l_tzsnake_segment_length_tl ,
9098 \l_tzsnake_snake_opt_tl
9099 } ,
9100 }
9101
9102 \exp_last_unbraced:Nf \draw \l_tzsnake_cmd_tl #7 ;
9103 }
9104
9105 %%% --- end of \tzsnake
9106
9107
9108 %%%(ADDED)
9109 %%% \tzspy
9110
9111 \NewDocumentCommand\tzspy{ s O{} G{2cm} O{5} r() r() O{} D<>{} }
9112 {
9113 \IfBooleanTF { #1 } {}{} % (NOT USED!!!)
9114 \spy [ circle , size = #3 , magnification = #4 , #2 ]
9115 on (#5) in~node at (#6) [ #7 ] #8 ;
9116 }
9117
9118 %%% --- end of \tzspy
9119
9120
9121
9122 %%%%% Arrows (copy from istgame.sty and modified)
9123
9124
9125 %%%%% middle arrows
9126
9127 %%% mid arrow styles
9128 %% \tz@default... used
9129
9130 %% defaults
9131 \def\tz@default@midarrow@pos { .5 } % istgame: .55
9132 \def\tz@midarrow@pos { \tz@default@midarrow@pos }
9133 \def\tz@default@midarrow@opt { } % istgame: black
9134 \def\tz@midarrow@opt { \tz@default@midarrow@opt }
9135 \def\tz@default@midarrow@shape { > }
9136 \def\tz@midarrow@shape { \tz@default@midarrow@shape }
9137 \newcommand*\tzmidarrowpos { \tz@midarrow@pos }
9138 \newcommand*\tzmidarrowopt { \tz@midarrow@opt }
9139 \newcommand*\tzmidarrowshape { \tz@midarrow@shape }
9140
9141
9142 %% \settzmidarrow
9143 %% to toss values to arrow tip styles
9144 \NewDocumentCommand \settzmidarrow
9145 {
9146 D<>{ \tz@default@midarrow@pos }
9147 G{ \tz@default@midarrow@shape }
9148 O{ \tz@default@midarrow@opt }
9149 }
9150 {
9151 \renewcommand*\tz@midarrow@pos { #1 }
9152 \renewcommand*\tz@midarrow@shape { #2 }
9153 \renewcommand*\tzmidarrowopt
9154 { - , thin , solid , shorten~> = 0 , shorten~< = 0 , bend~right = 0 , #3 }
9155 }
9156
9157 %% initial set for defaults
9158 \AtBeginDocument{\settzmidarrow}
9159
9160 %% -->-- : position controllable by \settzmidarrow<pos>
9161 \tikzset
9162 { -->-- /.style =
9163 {
9164 decoration =
9165 {
9166 markings ,
9167 mark = at~position~ #1 ~with~
9168 { \exp_last_unbraced:NNV \arrow [ \tzmidarrowopt ] { \tzmidarrowshape } }
9169 } ,
9170 postaction = {decorate}
9171 } ,
9172 -->-- /.default = \tz@midarrow@pos
9173 }
9174
9175
9176 \tikzset
9177 { --o-- /.style =
9178 {
9179 decoration =
9180 {
9181 markings ,
9182 mark = at~position~ #1 ~with~
9183 {
9184 % \exp_last_unbraced:NNo \arrow [ \tzmidarrowopt ] { o }
9185 \exp_last_unbraced:NNf
9186 \draw [ \tzmidarrowopt ] (0,0) circle (1.2pt) ;
9187 }
9188 } ,
9189 postaction = {decorate}
9190 } ,
9191 --o-- /.default = .5 % istgame: .55
9192 }
9193
9194 \tikzset
9195 { --x-- /.style =
9196 {
9197 decoration =
9198 {
9199 markings ,
9200 mark
9201 = at~position~ #1 ~with~
9202 { % use the option tzextend{2pt}{2pt} to change lenghts
9203 \exp_last_unbraced:NNo
9204 \draw [ \tzmidarrowopt ] (2pt,2pt) to (-2pt,-2pt) ;
9205 \exp_last_unbraced:NNo
9206 \draw [ \tzmidarrowopt ] (-2pt,2pt) to (2pt,-2pt) ;
9207 }
9208 } ,
9209 postaction = {decorate}
9210 } ,
9211 --x-- /.default = .5
9212 }
9213
9214 \tikzset
9215 { --/-- /.style =
9216 {
9217 decoration =
9218 {
9219 markings ,
9220 mark
9221 = at~position~ #1 ~with~
9222 { % use the option tzextend{2pt}{2pt} to change lenghts
9223 \exp_last_unbraced:NNo
9224 \draw [ \tzmidarrowopt ] (2pt,2pt) to (-2pt,-2pt) ;
9225 % \exp_last_unbraced:NNo
9226 % \draw [ \tzmidarrowopt ] (-2pt,2pt) to (2pt,-2pt) ;
9227 }
9228 } ,
9229 postaction = {decorate}
9230 } ,
9231 --/-- /.default = .5
9232 }
9233
9234
9235 %=====================================================
9236 %=====================================================
9237 \ExplSyntaxOff
9238 %=====================================================
9239 %=====================================================
9240
9241
9242 %%% mixed NE
9243
9244 % tzEu
9245 \NewDocumentCommand\TzEu{D(){LFname}O{}mmD<>{\tmpB}O{right}G{}}
9246 {
9247 \def\tmpEu{(#3-#4)*\x+#4}
9248 \def\tmpB{#3} %???
9249 \draw [name path=#1,#2] (0,#4) node [left] {#4} plot [domain=0:1] (\x,{\tmpEu}) node [right] {#5} node [#6] {#7};
9250 }
9251
9252 % tzEu
9253 %\NewDocumentCommand\TzEu{D(){LFname}O{}mmD<>{\tmpB}O{right}G{}}
9254 \NewDocumentCommand\TzEU { O{} D""{} m m D[.{0} D.]{1} D<>{\tmpB} O{right} G{} }
9255 {
9256 \def\tmpEU{(#3-#4)*\x+#4}
9257 \def\tmpB{#3} %???
9258 %\draw [name path=#1,#2] (0,#4) node [left] {#4} plot [domain=0:1] (\x,{\tmpEu}) node [right] {#5} node [#6] {#7};
9259 \Tzfn [#1]"#2"{\tmpEU}[{#5}..{#6}]
9260 \path (0,#4) node [left] {#4} plot [domain=0:1] (\x,{\tmpEU}) node [right] {#7} node [#8] {#9};
9261 }
9262
9263
9264 \endinput