Debian Codegraph @

texmf-dist/tex/latex/tkz-tab/tkz-tab.sty

raw
1 % Copyright 2020 Alain Matthes
2 % This work may be distributed and/or modified under the
3 % conditions of the LaTeX Project Public License, either version 1.3
4 % of this license or (at your option) any later version.
5 % The latest version of this license is in
6 % http://www.latex-project.org/lppl.txt
7 % and version 1.3 or later is part of all distributions of LaTeX version 2005/12/01 or later.
8 % This work has the LPPL maintenance status “maintained”.
9 % The Current Maintainer of this work is Alain Matthes.
10 % Objet : Création de tableaux (signes et variations)
11 %<----------------------------------------------------------------------------->
12 \NeedsTeXFormat{LaTeX2e}
13 \ProvidesPackage{tkz-tab}[2020/04/29 v2.12c variations (ctan version)]
14 %<----------------------------------------------------------------------------->
15 \RequirePackage{ifthen}
16 \RequirePackage{xkeyval}[2005/11/25]
17 \RequirePackage{tikz}
18 \usetikzlibrary{arrows,patterns}
19 %<------------------------------ Initialisation ----------------------------->
20
21 %<------------------------------ Styles ----------------------------->
22 %<------------------------------ Colors ----------------------------->
23 \def\tkzTabDefaultWritingColor{black}
24 \def\tkzTabDefaultBackgroundColor{white}
25 \def\tkzTabDefaultLineWidth{0.4pt}
26 \def\tkzTabDefaultArrowStyle{latex'}
27 \def\tkzTabDefaultSep{2pt}
28 \def\cmdTAB@backgroundcolor{white}
29 \def\cmdTAB@writecolor{black}
30 \def\cmdTAB@TTS@doubledistance{1pt}
31 \def\cmdTAB@TG@hcolor{gray}
32 \let\cmdTAB@TG@patterncolor\cmdTAB@writecolor
33 \def\cmdTAB@TG@patternstyle{north west lines}
34 \let\cmdTAB@TG@color\cmdTAB@writecolor
35 \let\cmdTAB@tbs@colorT\cmdTAB@backgroundcolor
36 \let\cmdTAB@VA@color\cmdTAB@writecolor
37 \let\cmdTAB@arrowcolor\cmdTAB@writecolor
38 %<-------------------------------------------------------------------------->
39 \tikzset{node style/.style = {inner sep = \tkzTabDefaultSep,
40 outer sep = \tkzTabDefaultSep,
41 fill = \tkzTabDefaultBackgroundColor}}
42 \tikzset{low left/.style = {above left = \tkzTabDefaultSep}}
43 \tikzset{low right/.style = {above right = \tkzTabDefaultSep}}
44 \tikzset{high right/.style = {below right = \tkzTabDefaultSep}}
45 \tikzset{high left/.style = {below left = \tkzTabDefaultSep}}
46 \tikzset{low/.style = {above = \tkzTabDefaultSep}}
47 \tikzset{high/.style = {below = \tkzTabDefaultSep}}
48 \tikzset{on double/.style = {fill = \tkzTabDefaultBackgroundColor}}
49 \tikzset{tan style/.style = {> = \tkzTabDefaultArrowStyle,
50 ->,
51 color = \tkzTabDefaultWritingColor}}
52 \tikzset{arrow style/.style = {\tkzTabDefaultWritingColor,
53 ->,
54 > = \tkzTabDefaultArrowStyle,
55 shorten > = \tkzTabDefaultSep,
56 shorten < = \tkzTabDefaultSep}}
57 \tikzset{from style/.style = {shorten > = \tkzTabDefaultSep,
58 shorten < = \tkzTabDefaultSep,
59 line width = \tkzTabDefaultLineWidth,
60 > = \tkzTabDefaultArrowStyle,
61 ->,
62 draw = \tkzTabDefaultWritingColor,
63 dotted}}
64
65 \tikzset{t style/.style = {style = dotted,
66 draw = \tkzTabDefaultWritingColor}}
67
68 \tikzset{h style/.style = {pattern = north west lines,
69 pattern color = \tkzTabDefaultWritingColor}}
70
71 \tikzset{double style/.append style = {%
72 draw = \tkzTabDefaultWritingColor,
73 double = \tkzTabDefaultBackgroundColor}}
74 %<--------------------- Colorisation du fond ------------------------------>
75 \tikzset{fondC/.style={fill = \tkzTabDefaultBackgroundColor}}
76 \tikzset{fondL/.style={fill = \tkzTabDefaultBackgroundColor}}
77 \tikzset{fondT/.style={fill = \tkzTabDefaultBackgroundColor}}
78 \tikzset{fondV/.style={fill = \tkzTabDefaultBackgroundColor}}
79 %<------------------------------ End of Styles ---------------------------->
80 \newdimen\tkz@XF
81 \newdimen\tkz@YF
82 \newcounter{tkz@cnt@line}
83 \newcounter{tkz@cnt@lg}
84 \newcounter{tkz@cnt@cl}
85 \newcounter{tkz@cnt@pred}
86 \newcounter{tkz@cnt@temp}
87 \newcounter{tkz@cnt@arrow}
88 \newcounter{tkz@cnt@zone}
89 \newcounter{tkz@cnt@lgnext}
90 \newcounter{tkz@cnt@clnext}
91 \newcounter{tkz@cnt@pair}
92 \newcounter{tkz@cnt@impair}
93 \newcounter{tkz@cnt@aw}
94 %<--------------------------------------------------------------------------->
95 \define@cmdkey [TAB] {TTC} {color}{}
96 \define@cmdkey [TAB] {TTC} {backgroundcolor}{}
97 \presetkeys [TAB] {TTC} {color = black,
98 backgroundcolor = white}{}
99 \newcommand*{\tkzTabColors}[1][]{%
100 \setkeys[TAB]{TTC}{#1}
101 \let\tkzTabDefaultWritingColor\cmdTAB@TTC@color
102 \let\tkzTabDefaultBackgroundColor\cmdTAB@TTC@backgroundcolor
103 \let\cmdTAB@backgroundcolor\cmdTAB@TTC@backgroundcolor
104 \let\cmdTAB@writecolor\cmdTAB@TTC@color
105 \let\cmdTAB@doublecolor\cmdTAB@TTC@backgroundcolor
106 \let\cmdTAB@patterncolor\cmdTAB@TTC@color
107 \let\cmdTAB@tcolor\cmdTAB@TTC@color
108 \tikzset{fondC/.style={fill = \tkzTabDefaultBackgroundColor}}
109 \tikzset{fondL/.style={fill = \tkzTabDefaultBackgroundColor}}
110 \tikzset{fondT/.style={fill = \tkzTabDefaultBackgroundColor}}
111 \tikzset{fondV/.style={fill = \tkzTabDefaultBackgroundColor}}
112 }
113 %<--------------------------------------------------------------------------->
114 %<--------------------------------------------------------------------------->
115 \define@boolkey [TAB] {TTS} {crosslines}[true]{}
116 \define@cmdkey [TAB] {TTS} {doubledistance}{}
117 \define@cmdkey [TAB] {TTS} {lw}{}
118 \define@cmdkey [TAB] {TTS} {doublecolor}{}
119 \define@cmdkey [TAB] {TTS} {color}{}
120 \define@cmdkey [TAB] {TTS} {backgroundcolor}{}
121 \define@cmdkey [TAB] {TTS} {patterncolor}{}
122 \define@cmdkey [TAB] {TTS} {patternstyle}{}
123 \define@cmdkey [TAB] {TTS} {tstyle}{}
124 \define@cmdkey [TAB] {TTS} {tcolor}{}
125 \define@cmdkey [TAB] {TTS} {tanstyle}{}
126 \define@cmdkey [TAB] {TTS} {tanarrowstyle}{}
127 \define@cmdkey [TAB] {TTS} {tancolor}{}
128 \define@cmdkey [TAB] {TTS} {tanwidth}{}
129 \define@cmdkey [TAB] {TTS} {fromstyle}{}
130 \define@cmdkey [TAB] {TTS} {fromarrowstyle}{}
131 \define@cmdkey [TAB] {TTS} {fromcolor}{}
132 \define@cmdkey [TAB] {TTS} {fromwidth}{}
133 \define@cmdkey [TAB] {TTS} {twidth}{}
134 \define@cmdkey [TAB] {TTS} {hcolor}{}
135 \define@cmdkey [TAB] {TTS} {hopacity}{}
136 \define@cmdkey [TAB] {TTS} {arrowcolor}{}
137 \define@cmdkey [TAB] {TTS} {arrowstyle}{}
138 \define@cmdkey [TAB] {TTS} {arrowlinewidth}{}
139 %<--------------------------------------------------------------------------->
140 \presetkeys [TAB] {TTS} {doubledistance = 1pt,
141 doublecolor = \tkzTabDefaultBackgroundColor,
142 lw = \tkzTabDefaultLineWidth,
143 color = \tkzTabDefaultWritingColor,
144 backgroundcolor = \tkzTabDefaultBackgroundColor,
145 patterncolor = \tkzTabDefaultWritingColor,
146 patternstyle = north west lines,
147 tstyle = dotted,
148 tcolor = \tkzTabDefaultWritingColor,
149 tanarrowstyle = \tkzTabDefaultArrowStyle,
150 tanstyle = ->,
151 tancolor = \tkzTabDefaultWritingColor,
152 tanwidth = \tkzTabDefaultLineWidth,
153 fromarrowstyle = \tkzTabDefaultArrowStyle,
154 fromstyle = ->,
155 fromcolor = \tkzTabDefaultWritingColor,
156 fromwidth = \tkzTabDefaultLineWidth,
157 twidth = \tkzTabDefaultLineWidth,
158 hcolor = \tkzTabDefaultWritingColor,
159 hopacity = 0.4,
160 crosslines = false,
161 arrowcolor = \tkzTabDefaultWritingColor,
162 arrowstyle = \tkzTabDefaultArrowStyle,
163 arrowlinewidth = \tkzTabDefaultLineWidth}{}
164 %<--------------------------------------------------------------------------->
165 \newcommand*{\tkzTabSetup}[1][]{%
166 \setkeys[TAB]{TTS}{#1}
167 \tikzset{from style/.append style = {line width = \cmdTAB@TTS@fromwidth,
168 > = \cmdTAB@TTS@fromarrowstyle,
169 \cmdTAB@TTS@fromstyle,
170 \cmdTAB@TTS@fromcolor}}
171
172 \tikzset{tan style/.style = {\cmdTAB@TTS@tanstyle,
173 > = \cmdTAB@TTS@tanarrowstyle,
174 \cmdTAB@TTS@tancolor}}
175
176 \tikzset{double style/.append style = {%
177 draw = \cmdTAB@TTS@color,
178 double = \cmdTAB@TTS@doublecolor,
179 double distance = \cmdTAB@TTS@doubledistance,
180 line width = \cmdTAB@TTS@lw}}
181 \tikzset{t style/.style = {style = \cmdTAB@TTS@tstyle,
182 draw = \cmdTAB@TTS@tcolor,
183 line width = \cmdTAB@TTS@twidth}}
184 \tikzset{arrow style/.append style = {\cmdTAB@TTS@arrowcolor,
185 > = \cmdTAB@TTS@arrowstyle,
186 line width = \cmdTAB@TTS@arrowlinewidth}}
187 \tikzset{node style/.append style = { fill = \cmdTAB@TTS@backgroundcolor}}
188 \tikzset{fondC/.style={fill = \cmdTAB@TTS@backgroundcolor}}
189 \tikzset{fondL/.style={fill = \cmdTAB@TTS@backgroundcolor}}
190 \tikzset{fondT/.style={fill = \cmdTAB@TTS@backgroundcolor}}
191 \tikzset{fondV/.style={fill = \cmdTAB@TTS@backgroundcolor}}
192 \ifTAB@TTS@crosslines%
193 \tikzset{h style/.style = {pattern = north west lines,
194 pattern color = \cmdTAB@TTS@patterncolor}}
195 \else
196 \tikzset{h style/.style = {fill = \cmdTAB@TTS@patterncolor!50,
197 opacity = \cmdTAB@TTS@hopacity}}
198 \fi
199 }
200 %<--------------------- tracé du cadre extérieur --------------------------->
201 \define@boolkey [TAB] {tbs} {help}[true]{}
202 \define@boolkey [TAB] {tbs} {color}[true]{}
203 \define@boolkey [TAB] {tbs} {nocadre}[true]{}
204 \define@cmdkey [TAB] {tbs} {lw}{}
205 \define@cmdkey [TAB] {tbs} {textw}{}
206 \define@cmdkey [TAB] {tbs} {colorC}{}
207 \define@cmdkey [TAB] {tbs} {colorL}{}
208 \define@cmdkey [TAB] {tbs} {colorT}{}
209 \define@cmdkey [TAB] {tbs} {colorV}{}
210 \define@cmdkey [TAB] {tbs} {lgt}{}
211 \define@cmdkey [TAB] {tbs} {espcl}{}
212 \define@cmdkey [TAB] {tbs} {deltacl}{}
213 \presetkeys [TAB] {tbs} {help = false,
214 espcl = 3,
215 lgt = 2,
216 textw = \cmdTAB@tbs@lgt,
217 lw = \tkzTabDefaultLineWidth,
218 colorC = \tkzTabDefaultBackgroundColor,
219 colorL = \tkzTabDefaultBackgroundColor,
220 colorT = \tkzTabDefaultBackgroundColor,
221 colorV = \tkzTabDefaultBackgroundColor,
222 color = false,
223 nocadre = false,
224 deltacl = 0.5}{}
225 %<--------------------------------------------------------------------------->
226 %<-------------- Macro principale : détermine les dim ----------------------->
227 %<--------------------------------------------------------------------------->
228 \newcommand*{\tkzTabInit}[3][]{%
229 \setkeys[TAB]{tbs}{#1}
230 \setcounter{tkz@cnt@line}{1}
231 \setcounter{tkz@cnt@lgnext}{0}
232 \setcounter{tkz@cnt@clnext}{0}
233 \setcounter{tkz@cnt@aw}{0}
234 \setcounter{tkz@cnt@lg}{0}
235 \setcounter{tkz@cnt@cl}{0}
236 \setcounter{tkz@cnt@pred}{0}
237 \setcounter{tkz@cnt@temp}{0}
238 \setcounter{tkz@cnt@arrow}{0}
239 \setcounter{tkz@cnt@zone}{0}
240 \gdef\tkz@deltaY{0}
241 %<----------------------- Première colonne ---------------------------------->
242 \foreach \ligne/\ecart in {#2}{%
243 \stepcounter{tkz@cnt@lg}%
244 }%
245 \stepcounter{tkz@cnt@lg}%
246 \foreach \colonne in {#3}{%
247 \stepcounter{tkz@cnt@cl}%
248 }%
249 \addtocounter{tkz@cnt@cl}{-1}%
250 \let\tkz@nbinterv\thetkz@cnt@cl
251 \addtocounter{tkz@cnt@lg}{-1}%
252 \xdef\maxtkz@cnt@lg{\thetkz@cnt@lg}%
253 \xdef\tkz@maxcl{\thetkz@cnt@cl}%
254 \pgfmathparse{\cmdTAB@tbs@lgt+2*\cmdTAB@tbs@deltacl+\cmdTAB@tbs@espcl*\tkz@nbinterv}%
255 \global\let\tkz@lgttab\pgfmathresult
256 \global\let\tkz@lgttab\tkz@lgttab
257 \coordinate(T00) at (0,0);
258 \coordinate(T10) at (\cmdTAB@tbs@lgt,0);
259 \coordinate(T20) at (\tkz@lgttab,0);
260 \setcounter{tkz@cnt@lg}{0}%
261 \foreach \ligne/\tkz@deltaH in {#2}{%
262 \setcounter{tkz@cnt@cl}{0}%
263 \foreach \x in {#3}{%
264 \pgfmathmultiply{\cmdTAB@tbs@espcl}{\value{tkz@cnt@cl}}%
265 \global\let\ecartcl\pgfmathresult
266 \pgfmathparse{\cmdTAB@tbs@lgt+\cmdTAB@tbs@deltacl+\ecartcl}%
267 \global\let\tkz@ddx\pgfmathresult
268 \stepcounter{tkz@cnt@cl}%
269 \coordinate(N\thetkz@cnt@cl 0) at (\tkz@ddx,-\tkz@deltaY);}}%
270 \foreach \m in {1,...,\tkz@maxcl}{%
271 \setcounter{tkz@cnt@clnext}{\m}%
272 \stepcounter{tkz@cnt@clnext}%
273 \path (N\m 0)--(N\thetkz@cnt@clnext 0) coordinate[midway](M\m 0);}%
274 \setcounter{tkz@cnt@cl}{0}%
275 \setcounter{tkz@cnt@lg}{0}%
276 \foreach \ligne/\tkz@deltaH in {#2}{%
277 \stepcounter{tkz@cnt@lg}%
278 \pgfmathadd{\tkz@deltaY}{\tkz@deltaH}%
279 \global\let\tkz@deltaY\pgfmathresult
280 \coordinate(T0\thetkz@cnt@lg) at (0,-\tkz@deltaY);
281 \coordinate(T1\thetkz@cnt@lg) at (\cmdTAB@tbs@lgt,-\tkz@deltaY);
282 \coordinate(T2\thetkz@cnt@lg) at (\tkz@lgttab,-\tkz@deltaY);
283 \setcounter{tkz@cnt@cl}{0}%
284 \foreach \x in {#3}{%
285 \pgfmathparse{\cmdTAB@tbs@lgt+\cmdTAB@tbs@deltacl+%
286 \cmdTAB@tbs@espcl*\thetkz@cnt@cl}%
287 \global\let\tkz@ddx\pgfmathresult
288 \stepcounter{tkz@cnt@cl}%
289 \coordinate(N\number\value{tkz@cnt@cl}%
290 \number\value{tkz@cnt@lg})%
291 at (\tkz@ddx,-\tkz@deltaY);
292 }%
293 \foreach \m in {1,...,\tkz@maxcl}{%
294 \setcounter{tkz@cnt@clnext}{\m}%
295 \stepcounter{tkz@cnt@clnext}%
296 \path (N\m\number\value{tkz@cnt@lg})--%
297 (N\thetkz@cnt@clnext\number\value{tkz@cnt@lg})%
298 coordinate[midway](M\m\number\value{tkz@cnt@lg});
299 \ifTAB@tbs@help%
300 \draw[fill=green!30!black] (M\m\number\value{tkz@cnt@lg}) circle(2pt)%
301 node[below right,green!30!black] {%
302 \footnotesize M\m\number\value{tkz@cnt@lg}};
303 \fi
304 }%
305 \pgfmathdivide{\cmdTAB@tbs@lgt}{2}%
306 \global\let\tkz@tab@dx\pgfmathresult
307 \pgfmathdivide{\tkz@deltaH}{2}%
308 \global\let\tkz@halfdeltaH\pgfmathresult
309 \pgfmathsubtract{\tkz@halfdeltaH}{\tkz@deltaY}%
310 \global\let\tkz@tab@dy\pgfmathresult
311 \setcounter{tkz@cnt@temp}{\thetkz@cnt@lg}%
312 \addtocounter{tkz@cnt@temp}{-1}%
313 \path (\tkz@tab@dx,\tkz@tab@dy) coordinate(F\thetkz@cnt@temp);}%
314 %
315 %<--------------------- Colorisation du fond ------------------------------>
316 \tikzset{fondC/.style={fill = \cmdTAB@tbs@colorC}}
317 \tikzset{fondL/.style={fill = \cmdTAB@tbs@colorL}}
318 \tikzset{fondT/.style={fill = \cmdTAB@tbs@colorT}}
319 \tikzset{fondV/.style={fill = \cmdTAB@tbs@colorV}}
320 \ifTAB@tbs@color
321 \draw[fondC] (T01) rectangle (T1\maxtkz@cnt@lg);
322 \draw[fondL] (T11) rectangle (T20);
323 \draw[fondT] (T11) rectangle (T2\maxtkz@cnt@lg);
324 \draw[fondV] (T00) rectangle (T11);
325 \fi
326 %<-------------------Fin Colorisation du fond ------------------------------>
327 %
328 %<--------------- Écriture des formules en colonne 1 --------------------->
329 \setcounter{tkz@cnt@lg}{-1}%
330 \pgfmathsubtract{\cmdTAB@tbs@textw}{0.4}%
331 \xdef\cmdTAB@tbs@textw{\pgfmathresult}%
332 \foreach \ligne/\tkz@deltaH in {#2}{%
333 \stepcounter{tkz@cnt@lg}%
334 \ifTAB@tbs@help%
335 \node[draw,fill=green!50,inner sep=1pt] at (F\number\value{tkz@cnt@lg}) {\footnotesize F\thetkz@cnt@lg};
336 \else
337 \node[text width = \cmdTAB@tbs@textw cm,text centered,inner sep=0pt] at (F\thetkz@cnt@lg) {\ligne};
338 \fi}%
339 %<--------------- Cadre = true on trace tout sinon condition---------------->
340 \ifTAB@tbs@nocadre%
341 \draw[line width = \cmdTAB@tbs@lw] (T10) --(T1\maxtkz@cnt@lg);
342 \setcounter{tkz@cnt@temp}{\maxtkz@cnt@lg}%
343 \addtocounter {tkz@cnt@temp}{-1}%
344 \xdef\maxtkz@cnt@lg{\thetkz@cnt@temp}%
345 \foreach \y in {1,...,\maxtkz@cnt@lg}{\draw[line width = \cmdTAB@tbs@lw] (T0\y) --(T2\y);}%
346 \else
347 \foreach \y in {1,...,\maxtkz@cnt@lg}{\draw[line width = \cmdTAB@tbs@lw] (T0\y) --(T2\y);}%
348 \draw[line width = \cmdTAB@tbs@lw] (T00) rectangle (T2\maxtkz@cnt@lg);
349 \draw[line width = \cmdTAB@tbs@lw] (T10) -- (T1\maxtkz@cnt@lg);
350 \fi
351 %<------------ Première ligne et Nodes variations -------------------------->
352 \setcounter{tkz@cnt@cl}{0}%
353 \pgfextractx{\tkz@XF}{\pgfpointanchor{F0}{center}}%
354 \pgfextracty{\tkz@YF}{\pgfpointanchor{F0}{center}}%
355 \foreach \x in {#3}{%
356 \pgfmathparse{\cmdTAB@tbs@deltacl+\cmdTAB@tbs@lgt/2+%
357 \cmdTAB@tbs@espcl*\thetkz@cnt@cl}%
358 \global\let\tkz@tab@dx\pgfmathresult
359 \stepcounter{tkz@cnt@cl}%
360 \ifTAB@tbs@help%
361 \node[draw,fill=blue!50,inner sep=1pt] (L\number\value{tkz@cnt@cl})%
362 at (\tkz@XF + \tkz@tab@dx cm,\tkz@YF) {\footnotesize L\number\value{tkz@cnt@cl}};%
363 \else
364 \node (L\thetkz@cnt@cl) at (\tkz@XF + \tkz@tab@dx cm,\tkz@YF) {\x};%
365 \fi}%
366 %<------------------------ help ----------------------------->
367 \ifTAB@tbs@help%
368 \foreach \colonne in {0,1,2}{%
369 \foreach \ligne in {0,...,\maxtkz@cnt@lg}{\draw (T\colonne\ligne)%
370 node[draw,fill=red!50,inner sep=1pt] {\textbf{\footnotesize T\colonne\ligne}};}}%
371 \setcounter{tkz@cnt@temp}{\tkz@maxcl}
372 \stepcounter{tkz@cnt@temp}
373 \xdef\tkz@maxcl{\thetkz@cnt@temp}%
374 \foreach \ligne in {0,...,\maxtkz@cnt@lg}
375 {\foreach \colonne in {1,...,\tkz@maxcl}{%
376 \draw[fill=red] (N\colonne\ligne) circle(2pt)%
377 node[above right,red,inner sep=1pt] {\footnotesize N\colonne\ligne};}}%
378 \fi
379 }% fin de tkzTabInit
380 %<--------------------------------------------------------------------------->
381 %<--------------------- Ligne de Signes ------------------------------------->
382 %<----------------------- tkzTabLine ----------------------------------->
383 \newcommand*\stripspaces[1]{%
384 \strip@spaces{#1}}
385 \newcommand\strip@spaces{\renewcommand\strip@spaces[1]}%
386 \expandafter\strip@spaces{%
387 \@firstofone{\expandafter\strip@lastspace\@firstofone #1\@nil}
388 \@nil\@@nil}
389 \@ifdefinable\strip@lastspace{%
390 \def\strip@lastspace#1 \@nil#2\@@nil{\strip@nil#1\@nil\@@nil}}
391 \@ifdefinable\strip@nil{%
392 \def\strip@nil#1\@nil#2\@@nil{#1}}
393 %<--------------------------------------------------------------------------->
394 \define@boolkey[TAB]{TL}{help}[true]{}
395 \presetkeys[TAB]{TL}{help=false}{}
396 %<--------------------------------------------------------------------------->
397 \newcommand{\tkzTabLine}[2][]{%
398 \makeatletter
399 \setkeys[TAB]{TL}{#1}%
400 \setcounter{tkz@cnt@lg}{\thetkz@cnt@line}%
401 \stepcounter{tkz@cnt@line}%
402 \setcounter{tkz@cnt@lgnext}{\thetkz@cnt@line}%
403 \setcounter{tkz@cnt@cl}{1}%
404 \setcounter{tkz@cnt@pair}{1}%
405 \setcounter{tkz@cnt@impair}{1}%
406 \ifTAB@TL@help%
407 \foreach \x in {#2}
408 {
409 \ifthenelse{\isodd{\value{tkz@cnt@cl}}}{%
410 \path (N\thetkz@cnt@impair\thetkz@cnt@lg) --%
411 node[draw,inner sep =1pt,midway,fill=yellow]%
412 {\footnotesize Z\thetkz@cnt@impair\thetkz@cnt@lg}%
413 (N\thetkz@cnt@impair\thetkz@cnt@lgnext);
414 \stepcounter{tkz@cnt@impair}}{%
415 \path (M\thetkz@cnt@pair\thetkz@cnt@lg)--%
416 node[draw,inner sep =1pt,midway,fill=yellow]%
417 {\footnotesize S\thetkz@cnt@pair\thetkz@cnt@lg}%
418 (M\thetkz@cnt@pair\thetkz@cnt@lgnext);
419 \stepcounter{tkz@cnt@pair}}%
420 \stepcounter{tkz@cnt@cl}%
421 }%
422 \else
423 \ifTAB@tbs@color%
424 \draw(T1\thetkz@cnt@lg) rectangle (T2\thetkz@cnt@line);%
425 \fi
426 \foreach \x in {#2}
427 {%
428 \ifthenelse{\isodd{\value{tkz@cnt@cl}}}{%
429 \path (N\thetkz@cnt@impair\thetkz@cnt@lg) --%
430 coordinate[midway](Z\thetkz@cnt@impair\thetkz@cnt@lg)%
431 (N\thetkz@cnt@impair\thetkz@cnt@lgnext);
432 \ifthenelse{\equal{\expandafter\stripspaces\expandafter{\x}}{z}}{%
433 \draw[line width = \cmdTAB@tbs@lw,t style]%
434 (N\thetkz@cnt@impair\thetkz@cnt@lg) -- %
435 (N\thetkz@cnt@impair\thetkz@cnt@lgnext);
436 \node at (Z\thetkz@cnt@impair\thetkz@cnt@lg){$0$};
437 }{%
438 \ifthenelse{\equal{\expandafter\stripspaces\expandafter{\x}}{}}{%
439 }{%
440 \ifthenelse{\equal{\expandafter\stripspaces\expandafter{\x}}{t}}{%
441 \draw[line width = \cmdTAB@tbs@lw,t style]
442 (N\thetkz@cnt@impair\thetkz@cnt@lg) -- %
443 (N\thetkz@cnt@impair\thetkz@cnt@lgnext);}{%
444 \ifthenelse{\equal{\expandafter\stripspaces\expandafter{\x}}{d}}{%
445 \draw[line width =\cmdTAB@tbs@lw,double style]%
446 ([yshift = -\cmdTAB@tbs@lw/2] N\thetkz@cnt@impair\thetkz@cnt@lg)--%
447 ([yshift = \cmdTAB@tbs@lw/2] N\thetkz@cnt@impair\thetkz@cnt@lgnext);
448 }{%
449 \path (N\thetkz@cnt@impair\thetkz@cnt@lg)--%
450 (N\thetkz@cnt@impair\thetkz@cnt@lgnext);
451 \node at (Z\thetkz@cnt@impair\thetkz@cnt@lg){$\x$};
452 }%
453 }}}\stepcounter{tkz@cnt@impair}%
454 }{%
455 \path (M\thetkz@cnt@pair\thetkz@cnt@lg)--%
456 coordinate[midway](S\thetkz@cnt@pair\thetkz@cnt@lg)%
457 (M\thetkz@cnt@pair\thetkz@cnt@lgnext);%
458 \ifthenelse{\equal{\expandafter\stripspaces\expandafter{\x}}{h}}{%
459 \setcounter{tkz@cnt@clnext}{\thetkz@cnt@pair}%
460 \stepcounter{tkz@cnt@clnext}%
461 \pgfmathparse{\cmdTAB@TTS@doubledistance/2+\cmdTAB@tbs@lw}
462 \global\let\tkz@deltax\pgfmathresult
463 \fill[h style]([xshift=\tkz@deltax,yshift=-\cmdTAB@tbs@lw/2]%
464 N\thetkz@cnt@pair\thetkz@cnt@lg)
465 rectangle%
466 ([xshift=-\tkz@deltax,yshift=\cmdTAB@tbs@lw/2]%
467 N\thetkz@cnt@clnext\thetkz@cnt@lgnext);
468 }{%
469 \node at (S\thetkz@cnt@pair\thetkz@cnt@lg) {$\x$};
470 }%
471 \stepcounter{tkz@cnt@pair}%
472 }%
473 \stepcounter{tkz@cnt@cl}%
474 }% end foreach
475 \fi
476 \makeatother
477 }%
478 %<--------------------------------------------------------------------------->
479 %<---------------------------- Variations ------------------------------->
480 %<--------------------------------------------------------------------------->
481 %<----------------------- Macro pour tracer une flèche ---------------------->
482 %<--------------------------------------------------------------------------->
483 \newcommand*{\tkzDrawArrow}{%
484 \makeatletter
485 \ifthenelse{\equal{\thetkz@cnt@zone}{0}}{%
486 \setcounter{tkz@cnt@pred}{\thetkz@cnt@cl}
487 \addtocounter{tkz@cnt@pred}{-1}
488 \ifthenelse{\thetkz@cnt@temp>0}{%
489 \addtocounter{tkz@cnt@pred}{-\thetkz@cnt@temp}%
490 \setcounter{tkz@cnt@temp}{0}}{}%
491 \ifTAB@VA@help%
492 \draw[fill=orange] (FR\thetkz@cnt@pred\thetkz@cnt@lg) circle(2pt)%
493 node[right,orange] {\footnotesize FR\thetkz@cnt@pred\thetkz@cnt@lg};
494 \draw[fill=orange] (FL\thetkz@cnt@cl\thetkz@cnt@lg)circle(2pt)%
495 node[left,orange] {\footnotesize FL\thetkz@cnt@cl\thetkz@cnt@lg};
496 \else
497 \draw[arrow style] (FR\thetkz@cnt@pred\thetkz@cnt@lg) to%
498 (FL\thetkz@cnt@cl\thetkz@cnt@lg);%
499 \fi
500 }{%
501 \setcounter{tkz@cnt@zone}{0}%
502 }%
503 \makeatother
504 }%
505 %<--------------------------------------------------------------------------->
506 \define@boolkey[TAB]{VA}{help}[true]{}
507 \define@cmdkey[TAB]{VA}{color}{}
508 \presetkeys[TAB]{VA}{color = \tkzTabDefaultWritingColor,
509 help = false}{}
510 %<--------------------------------------------------------------------------->
511 \newcommand*{\tkzTabVar}[2][]{%
512 \setkeys[TAB]{VA}{#1}%
513 \setcounter{tkz@cnt@lg}{\thetkz@cnt@line}%
514 \stepcounter{tkz@cnt@line}%
515 \setcounter{tkz@cnt@lgnext}{\thetkz@cnt@line}%
516 \begin{scope}
517 \tikzset{every node/.style={inner sep =3pt}}%
518 \setcounter{tkz@cnt@cl}{0}%
519 \setcounter{tkz@cnt@aw}{0}%
520 \setcounter{tkz@cnt@temp}{0}%
521 \setcounter{tkz@cnt@arrow}{0}%
522 \pgfmathparse{\cmdTAB@TTS@doubledistance/2+\cmdTAB@tbs@lw}
523 \global\let\tkz@deltax\pgfmathresult
524
525 \ifTAB@tbs@color%
526 \draw (T1\thetkz@cnt@lg) rectangle (T2\thetkz@cnt@line);%
527 \fi%
528 %<----------------- Lecture des données et création des nodes --------------->
529 \foreach \x/\tl/\tr in {#2}
530 {\stepcounter{tkz@cnt@aw}\stepcounter{tkz@cnt@cl}%
531 %<------------------------------------------------------------------- D- ---->
532 \ifthenelse{\equal{\expandafter\stripspaces\expandafter{\x}}{D-}}%
533 {\draw[double style]%
534 ([yshift = -\cmdTAB@tbs@lw/2] N\thetkz@cnt@cl\thetkz@cnt@lg) --%
535 ([yshift = \cmdTAB@tbs@lw/2] N\thetkz@cnt@cl\thetkz@cnt@lgnext);
536 \node[node style,low right] (FR\thetkz@cnt@cl\thetkz@cnt@lg) at (N\thetkz@cnt@aw\thetkz@cnt@lgnext){\ifTAB@VA@help\else\tr\fi};%
537 \ifthenelse{\equal{\thetkz@cnt@arrow}{0}}{}{\tkzDrawArrow}%
538 }%
539 %<------------------------------------------------------------------- D+ ---->
540 {\ifthenelse{\equal{\expandafter\stripspaces\expandafter{\x}}{D+}}%
541 {\draw[double style]%
542 ([yshift = -\cmdTAB@tbs@lw/2] N\thetkz@cnt@cl\thetkz@cnt@lg) --%
543 ([yshift = \cmdTAB@tbs@lw/2] N\thetkz@cnt@cl\thetkz@cnt@lgnext);
544 \node[node style,high right] (FR\thetkz@cnt@cl\thetkz@cnt@lg)%
545 at (N\thetkz@cnt@aw\thetkz@cnt@lg){\ifTAB@VA@help\else\tr\fi};%
546 \ifthenelse{\equal{\thetkz@cnt@arrow}{0}}{}{\tkzDrawArrow}%
547 }
548 %<------------------------------------------------------------------- +D ---->
549 {\ifthenelse{\equal{\expandafter\stripspaces\expandafter{\x}}{+D}}%
550 {\draw[double style]%
551 ([yshift=-\cmdTAB@tbs@lw/2] N\thetkz@cnt@cl\thetkz@cnt@lg) -- ([yshift=\cmdTAB@tbs@lw/2] N\thetkz@cnt@cl\thetkz@cnt@lgnext);
552 \node[node style,high left] (FL\thetkz@cnt@cl\thetkz@cnt@lg) at (N\thetkz@cnt@aw\thetkz@cnt@lg){\ifTAB@VA@help\else\tl\fi};%
553 \ifthenelse{\equal{\thetkz@cnt@arrow}{0}}{}{\tkzDrawArrow}%
554 }%
555 %<------------------------------------------------------------------- +C ---->
556 {\ifthenelse{\equal{\expandafter\stripspaces\expandafter{\x}}{+C}}%
557 {\draw[double style]%
558 ([yshift = -\cmdTAB@tbs@lw/2] N\thetkz@cnt@cl\thetkz@cnt@lg)--%
559 ([yshift = \cmdTAB@tbs@lw/2] N\thetkz@cnt@cl\thetkz@cnt@lgnext);%
560 \node[node style,high,on double] (FL\thetkz@cnt@cl\thetkz@cnt@lg) at (N\thetkz@cnt@aw\thetkz@cnt@lg){\ifTAB@VA@help\else\tl\fi};%
561 \node[node style,high,on double] (FR\thetkz@cnt@cl\thetkz@cnt@lg) at (N\thetkz@cnt@aw\thetkz@cnt@lg){\ifTAB@VA@help\else\tl\fi};%
562 \ifthenelse{\equal{\thetkz@cnt@arrow}{0}}{}{\tkzDrawArrow}%
563 }
564 %<------------------------------------------------------------------ -D ----->
565 {\ifthenelse{\equal{\expandafter\stripspaces\expandafter{\x}}{-D}}%
566 {\draw[double style]%
567 ([yshift = -\cmdTAB@tbs@lw/2] N\thetkz@cnt@cl\thetkz@cnt@lg) --%
568 ([yshift = \cmdTAB@tbs@lw/2] N\thetkz@cnt@cl\thetkz@cnt@lgnext);
569 \node[node style,low left] (FL\thetkz@cnt@cl\thetkz@cnt@lg) at (N\thetkz@cnt@aw\thetkz@cnt@lgnext){\ifTAB@VA@help\else\tl\fi};%
570 \ifthenelse{\equal{\thetkz@cnt@arrow}{0}}{}{\tkzDrawArrow}%
571 }%
572 %<------------------------------------------------------------------ -C ----->
573 {\ifthenelse{\equal{\expandafter\stripspaces\expandafter{\x}}{-C}}%
574 {\draw[double style]%
575 ([yshift = -\cmdTAB@tbs@lw/2] N\thetkz@cnt@cl\thetkz@cnt@lg) --%
576 ([yshift = \cmdTAB@tbs@lw/2] N\thetkz@cnt@cl\thetkz@cnt@lgnext);
577 \node[node style,low,on double] (FL\thetkz@cnt@cl\thetkz@cnt@lg) at (N\thetkz@cnt@aw\thetkz@cnt@lgnext){\ifTAB@VA@help\else\tl\fi};%
578 \node[node style,low,on double] (FR\thetkz@cnt@cl\thetkz@cnt@lg) at (N\thetkz@cnt@aw\thetkz@cnt@lgnext){\ifTAB@VA@help\else\tl\fi};%
579 \ifthenelse{\equal{\thetkz@cnt@arrow}{0}}{}{\tkzDrawArrow}%
580 }%
581 %<------------------------------------------------------------------- + ---->
582 {\ifthenelse{\equal{\expandafter\stripspaces\expandafter{\x}}{+}}%
583 {\node[node style,high] (FL\thetkz@cnt@cl\thetkz@cnt@lg) at (N\thetkz@cnt@aw\thetkz@cnt@lg){\ifTAB@VA@help\else\tl\fi};
584 \node[node style,high] (FR\thetkz@cnt@cl\thetkz@cnt@lg) at (N\thetkz@cnt@aw\thetkz@cnt@lg){\ifTAB@VA@help\else\tl\fi};
585 \ifthenelse{\equal{\thetkz@cnt@arrow}{0}}{}{\tkzDrawArrow}%
586 }
587 %<---------------------------------------------------------------- +V+ ---->
588 {\ifthenelse{\equal{\expandafter\stripspaces\expandafter{\x}}{+V+}}%
589 {\node[node style,high left] (FL\thetkz@cnt@cl\thetkz@cnt@lg) at (N\thetkz@cnt@aw\thetkz@cnt@lg){\ifTAB@VA@help\else\tl\fi};
590 \node[node style,high right] (FR\thetkz@cnt@cl\thetkz@cnt@lg) at (N\thetkz@cnt@aw\thetkz@cnt@lg){\ifTAB@VA@help\else\tr\fi};
591 \ifthenelse{\equal{\thetkz@cnt@arrow}{0}}{}{\tkzDrawArrow}%
592 }%
593 %<--------------------------------------------------------------- -V- ---->
594 {\ifthenelse{\equal{\expandafter\stripspaces\expandafter{\x}}{-V-}}%
595 {\node[node style,low left] (FL\thetkz@cnt@cl\thetkz@cnt@lg) at (N\thetkz@cnt@aw\thetkz@cnt@lgnext){\ifTAB@VA@help\else\tl\fi};
596 \node[node style,low right] (FR\thetkz@cnt@cl\thetkz@cnt@lg) at (N\thetkz@cnt@aw\thetkz@cnt@lgnext){\ifTAB@VA@help\else\tr\fi};
597 \ifthenelse{\equal{\thetkz@cnt@arrow}{0}}{}{\tkzDrawArrow}%
598 }%
599 %<-------------------------------------------------------------- -V+ ---->
600 {\ifthenelse{\equal{\expandafter\stripspaces\expandafter{\x}}{-V+}}%
601 {\node[node style,low left] (FL\thetkz@cnt@cl\thetkz@cnt@lg) at (N\thetkz@cnt@aw\thetkz@cnt@lgnext){\ifTAB@VA@help\else\tl\fi};
602 \node[node style,high right] (FR\thetkz@cnt@cl\thetkz@cnt@lg) at (N\thetkz@cnt@aw\thetkz@cnt@lg){\ifTAB@VA@help\else\tr\fi};
603 \ifthenelse{\equal{\thetkz@cnt@arrow}{0}}{}{\tkzDrawArrow}%
604 }
605 %<---------------------------------------------------------------- +V- ---->
606 {\ifthenelse{\equal{\expandafter\stripspaces\expandafter{\x}}{+V-}}%
607 {\node[node style,high left] (FL\thetkz@cnt@cl\thetkz@cnt@lg) at (N\thetkz@cnt@aw\thetkz@cnt@lg){\ifTAB@VA@help\else\tl\fi};
608 \node[node style,low right] (FR\thetkz@cnt@cl\thetkz@cnt@lg) at (N\thetkz@cnt@aw\thetkz@cnt@lgnext){\ifTAB@VA@help\else\tr\fi};
609 \ifthenelse{\equal{\thetkz@cnt@arrow}{0}}{}{\tkzDrawArrow}%
610 }
611 %<------------------------------------------------------------------- - ---->
612 {\ifthenelse{\equal{\expandafter\stripspaces\expandafter{\x}}{-}}%
613 {\node[node style,low] (FL\thetkz@cnt@cl\thetkz@cnt@lg) at (N\thetkz@cnt@aw\thetkz@cnt@lgnext){\ifTAB@VA@help\else\tl\fi};
614 \node[node style,low] (FR\thetkz@cnt@cl\thetkz@cnt@lg) at (N\thetkz@cnt@aw\thetkz@cnt@lgnext){\ifTAB@VA@help\else\tl\fi};
615 \ifthenelse{\equal{\thetkz@cnt@arrow}{0}}{}{\tkzDrawArrow}%
616 }%
617 %<------------------------------------------------------------------ -D+ ---->
618 {\ifthenelse{\equal{\expandafter\stripspaces\expandafter{\x}}{-D+}}%
619 {\draw[line width =\cmdTAB@tbs@lw,double style]%
620 ([yshift = -\cmdTAB@tbs@lw/2] N\thetkz@cnt@cl\thetkz@cnt@lg) --%
621 ([yshift = \cmdTAB@tbs@lw/2] N\thetkz@cnt@cl\thetkz@cnt@lgnext);
622 \node[node style,low left] (FL\thetkz@cnt@cl\thetkz@cnt@lg) at (N\thetkz@cnt@aw\thetkz@cnt@lgnext){\ifTAB@VA@help\else\tl\fi};
623 \node[node style,high right] (FR\thetkz@cnt@cl\thetkz@cnt@lg) at (N\thetkz@cnt@aw\thetkz@cnt@lg){\ifTAB@VA@help\else\tr\fi};
624 \ifthenelse{\equal{\thetkz@cnt@arrow}{0}}{}{\tkzDrawArrow}%
625 }
626 %<------------------------------------------------------------------ +D- ---->
627 {\ifthenelse{\equal{\expandafter\stripspaces\expandafter{\x}}{+D-}}%
628 {\draw[double style]%
629 ([yshift = -\cmdTAB@tbs@lw/2] N\thetkz@cnt@cl\thetkz@cnt@lg) --%
630 ([yshift = \cmdTAB@tbs@lw/2] N\thetkz@cnt@cl\thetkz@cnt@lgnext);
631 \node[node style,high left] (FL\thetkz@cnt@cl\thetkz@cnt@lg) at (N\thetkz@cnt@aw\thetkz@cnt@lg){\ifTAB@VA@help\else\tl\fi};%
632 \node[node style,low right] (FR\thetkz@cnt@cl\thetkz@cnt@lg) at (N\thetkz@cnt@aw\thetkz@cnt@lgnext){\ifTAB@VA@help\else\tr\fi};
633 \ifthenelse{\equal{\thetkz@cnt@arrow}{0}}{}{\tkzDrawArrow}%
634 }
635 %<----------------------------------------------------------------- -CD+ ---->
636 {\ifthenelse{\equal{\expandafter\stripspaces\expandafter{\x}}{-CD+}}%
637 {\draw[double style]%
638 ([yshift = -\cmdTAB@tbs@lw/2] N\thetkz@cnt@cl\thetkz@cnt@lg) --%
639 ([yshift = \cmdTAB@tbs@lw/2] N\thetkz@cnt@cl\thetkz@cnt@lgnext);
640 \node[node style,low,on double] (FL\thetkz@cnt@cl\thetkz@cnt@lg) at (N\thetkz@cnt@aw\thetkz@cnt@lgnext){\ifTAB@VA@help\else\tl\fi};
641 \node[node style,high right,on double] (FR\thetkz@cnt@cl\thetkz@cnt@lg) at (N\thetkz@cnt@aw\thetkz@cnt@lg){\ifTAB@VA@help\else\tr\fi};
642 \ifthenelse{\equal{\thetkz@cnt@arrow}{0}}{}{\tkzDrawArrow}%
643 }
644 %<----------------------------------------------------------------- +CD+ ---->
645 {\ifthenelse{\equal{\expandafter\stripspaces\expandafter{\x}}{+CD+}}%
646 {\draw[double style]%
647 ([yshift = -\cmdTAB@tbs@lw/2] N\thetkz@cnt@cl\thetkz@cnt@lg) --%
648 ([yshift = \cmdTAB@tbs@lw/2] N\thetkz@cnt@cl\thetkz@cnt@lgnext);
649 \node[node style,high,on double] (FL\thetkz@cnt@cl\thetkz@cnt@lg) at (N\thetkz@cnt@aw\thetkz@cnt@lg){\ifTAB@VA@help\else\tl\fi};
650 \node[node style,high right,on double] (FR\thetkz@cnt@cl\thetkz@cnt@lg) at (N\thetkz@cnt@aw\thetkz@cnt@lg){\ifTAB@VA@help\else\tr\fi};
651 \ifthenelse{\equal{\thetkz@cnt@arrow}{0}}{}{\tkzDrawArrow}%
652 }%
653 %<----------------------------------------------------------------- -CD- ---->
654 {\ifthenelse{\equal{\expandafter\stripspaces\expandafter{\x}}{-CD-}}%
655 {\draw[double style]%
656 ([yshift = -\cmdTAB@tbs@lw/2] N\thetkz@cnt@cl\thetkz@cnt@lg) --%
657 ([yshift = \cmdTAB@tbs@lw/2] N\thetkz@cnt@cl\thetkz@cnt@lgnext);
658 \node[node style,low,on double] (FL\thetkz@cnt@cl\thetkz@cnt@lg) at (N\thetkz@cnt@aw\thetkz@cnt@lgnext){\ifTAB@VA@help\else\tl\fi};
659 \node[node style,low right,on double] (FR\thetkz@cnt@cl\thetkz@cnt@lg) at (N\thetkz@cnt@aw\thetkz@cnt@lgnext){\ifTAB@VA@help\else\tr\fi};
660 \ifthenelse{\equal{\thetkz@cnt@arrow}{0}}{}{\tkzDrawArrow}%
661 }
662 %<----------------------------------------------------------------- +CD- ---->
663 {\ifthenelse{\equal{\expandafter\stripspaces\expandafter{\x}}{+CD-}}%
664 {\draw[double style]%
665 ([yshift = -\cmdTAB@tbs@lw/2] N\thetkz@cnt@cl\thetkz@cnt@lg) --%
666 ([yshift = \cmdTAB@tbs@lw/2] N\thetkz@cnt@cl\thetkz@cnt@lgnext);
667 \node[node style,high,on double] (FL\thetkz@cnt@cl\thetkz@cnt@lg) at (N\thetkz@cnt@aw\thetkz@cnt@lg){\ifTAB@VA@help\else\tl\fi};
668 \node[node style,low right,on double] (FR\thetkz@cnt@cl\thetkz@cnt@lg) at (N\thetkz@cnt@aw\thetkz@cnt@lgnext){\ifTAB@VA@help\else\tr\fi};
669 \ifthenelse{\equal{\thetkz@cnt@arrow}{0}}{}{\tkzDrawArrow}%
670 }
671 %<----------------------------------------------------------------- -DC+ ---->
672 {\ifthenelse{\equal{\expandafter\stripspaces\expandafter{\x}}{-DC+}}%
673 {\draw[double style]%
674 ([yshift = -\cmdTAB@tbs@lw/2] N\thetkz@cnt@cl\thetkz@cnt@lg) -- %
675 ([yshift = \cmdTAB@tbs@lw/2] N\thetkz@cnt@cl\thetkz@cnt@lgnext);
676 \node[node style,low left,on double] (FL\thetkz@cnt@cl\thetkz@cnt@lg) at (N\thetkz@cnt@aw\thetkz@cnt@lgnext){\ifTAB@VA@help\else\tl\fi};
677 \node[node style,high,on double] (FR\thetkz@cnt@cl\thetkz@cnt@lg) at (N\thetkz@cnt@aw\thetkz@cnt@lg){\ifTAB@VA@help\else\tr\fi};
678 \ifthenelse{\equal{\thetkz@cnt@arrow}{0}}{}{\tkzDrawArrow}%
679 }%
680 %<----------------------------------------------------------------- +DC- ---->
681 {\ifthenelse{\equal{\expandafter\stripspaces\expandafter{\x}}{+DC-}}%
682 {\draw[double style]%
683 ([yshift = -\cmdTAB@tbs@lw/2] N\thetkz@cnt@cl\thetkz@cnt@lg) -- %
684 ([yshift = \cmdTAB@tbs@lw/2] N\thetkz@cnt@cl\thetkz@cnt@lgnext);
685 \node[node style,high left,on double] (FL\thetkz@cnt@cl\thetkz@cnt@lg) at (N\thetkz@cnt@aw\thetkz@cnt@lg){\ifTAB@VA@help\else\tl\fi};
686 \node[node style,low,on double] (FR\thetkz@cnt@cl\thetkz@cnt@lg) at (N\thetkz@cnt@aw\thetkz@cnt@lgnext){\ifTAB@VA@help\else\tr\fi};
687 \ifthenelse{\equal{\thetkz@cnt@arrow}{0}}{}{\tkzDrawArrow}%
688 }%
689 %<----------------------------------------------------------------- -DC- ---->
690 {\ifthenelse{\equal{\expandafter\stripspaces\expandafter{\x}}{-DC-}}%
691 {\draw[double style]%
692 ([yshift = -\cmdTAB@tbs@lw/2] N\thetkz@cnt@cl\thetkz@cnt@lg) -- %
693 ([yshift = \cmdTAB@tbs@lw/2] N\thetkz@cnt@cl\thetkz@cnt@lgnext);
694 \node[node style,low left,on double] (FL\thetkz@cnt@cl\thetkz@cnt@lg) at (N\thetkz@cnt@aw\thetkz@cnt@lgnext){\ifTAB@VA@help\else\tl\fi};
695 \node[node style,low,on double] (FR\thetkz@cnt@cl\thetkz@cnt@lg) at (N\thetkz@cnt@aw\thetkz@cnt@lgnext){\ifTAB@VA@help\else\tr\fi};
696 \ifthenelse{\equal{\thetkz@cnt@arrow}{0}}{}{\tkzDrawArrow}%
697 }%
698 %<----------------------------------------------------------------- +DC+ ---->
699 {\ifthenelse{\equal{\expandafter\stripspaces\expandafter{\x}}{+DC+}}%
700 {\draw[double style]%
701 ([yshift = -\cmdTAB@tbs@lw/2] N\thetkz@cnt@cl\thetkz@cnt@lg) --%
702 ([yshift = \cmdTAB@tbs@lw/2] N\thetkz@cnt@cl\thetkz@cnt@lgnext);
703 \node[node style,high left,on double] (FL\thetkz@cnt@cl\thetkz@cnt@lg) at (N\thetkz@cnt@aw\thetkz@cnt@lg){\ifTAB@VA@help\else\tl\fi};
704 \node[node style,high,on double] (FR\thetkz@cnt@cl\thetkz@cnt@lg) at (N\thetkz@cnt@aw\thetkz@cnt@lg){\ifTAB@VA@help\else\tr\fi};
705 \ifthenelse{\equal{\thetkz@cnt@arrow}{0}}{}{\tkzDrawArrow}%
706 }%
707 %<------------------------------------------------------------------ +D+ ---->
708 {\ifthenelse{\equal{\expandafter\stripspaces\expandafter{\x}}{+D+}}%
709 {\draw[double style]%
710 ([yshift = -\cmdTAB@tbs@lw/2] N\thetkz@cnt@cl\thetkz@cnt@lg) -- %
711 ([yshift = \cmdTAB@tbs@lw/2] N\thetkz@cnt@cl\thetkz@cnt@lgnext);
712 \node[node style,high left,on double] (FL\thetkz@cnt@cl\thetkz@cnt@lg) at (N\thetkz@cnt@aw\thetkz@cnt@lg){\ifTAB@VA@help\else\tl\fi};
713 \node[node style,high right,on double] (FR\thetkz@cnt@cl\thetkz@cnt@lg) at (N\thetkz@cnt@aw\thetkz@cnt@lg){\ifTAB@VA@help\else\tr\fi};
714 \ifthenelse{\equal{\thetkz@cnt@arrow}{0}}{}{\tkzDrawArrow}%
715 }%
716 %<------------------------------------------------------------------ -D- ---->
717 {\ifthenelse{\equal{\expandafter\stripspaces\expandafter{\x}}{-D-}}%
718 {\draw[double style]%
719 ([yshift = -\cmdTAB@tbs@lw/2] N\thetkz@cnt@cl\thetkz@cnt@lg) -- %
720 ([yshift = \cmdTAB@tbs@lw/2] N\thetkz@cnt@cl\thetkz@cnt@lgnext);
721 \node[node style,low left] (FL\thetkz@cnt@cl\thetkz@cnt@lg) at (N\thetkz@cnt@aw\thetkz@cnt@lgnext){\ifTAB@VA@help\else\tl\fi};
722 \node[node style,low right] (FR\thetkz@cnt@cl\thetkz@cnt@lg) at (N\thetkz@cnt@aw\thetkz@cnt@lgnext){\ifTAB@VA@help\else\tr\fi};
723 \ifthenelse{\equal{\thetkz@cnt@arrow}{0}}{}{\tkzDrawArrow}%
724 }%
725 %<------------------------------------------------------------------ R ------>
726 {\ifthenelse{\equal{\expandafter\stripspaces\expandafter{\x}}{R}}%
727 {\stepcounter{tkz@cnt@temp}%
728 }%
729 %<------------------------------------------------------------------ +DH ---->
730 {\ifthenelse{\equal{\expandafter\stripspaces\expandafter{\x}}{+DH}}%
731 {\draw[double style]%
732 ([yshift = -\cmdTAB@tbs@lw/2] N\thetkz@cnt@cl\thetkz@cnt@lg) -- %
733 ([yshift = \cmdTAB@tbs@lw/2] N\thetkz@cnt@cl\thetkz@cnt@lgnext);
734 \node[node style,high left] (FL\thetkz@cnt@cl\thetkz@cnt@lg) at (N\thetkz@cnt@aw\thetkz@cnt@lg){\ifTAB@VA@help\else\tl\fi};
735 \setcounter{tkz@cnt@clnext}{\thetkz@cnt@cl}\stepcounter{tkz@cnt@clnext}
736 \fill[h style]%
737 ([xshift=\tkz@deltax] N\thetkz@cnt@cl\thetkz@cnt@lg)%
738 rectangle%
739 (N\thetkz@cnt@clnext\thetkz@cnt@lgnext);
740 \ifthenelse{\equal{\thetkz@cnt@arrow}{0}}{}{\tkzDrawArrow}\stepcounter{tkz@cnt@zone}%
741 }%
742 %<------------------------------------------------------------------ -DH ---->
743 {\ifthenelse{\equal{\expandafter\stripspaces\expandafter{\x}}{-DH}}%
744 {\draw[double style]%
745 ([yshift=-\cmdTAB@tbs@lw/2] N\thetkz@cnt@cl\thetkz@cnt@lg) --%
746 ([yshift=\cmdTAB@tbs@lw/2] N\thetkz@cnt@cl\thetkz@cnt@lgnext);
747 \node[node style,low left] (FL\thetkz@cnt@cl\thetkz@cnt@lg) at (N\thetkz@cnt@cl\thetkz@cnt@lgnext){\ifTAB@VA@help\else\tl\fi};
748 \setcounter{tkz@cnt@clnext}{\thetkz@cnt@cl}\stepcounter{tkz@cnt@clnext}%
749 \fill[h style]%
750 ([xshift=\tkz@deltax] N\thetkz@cnt@cl\thetkz@cnt@lg)%
751 rectangle%
752 (N\thetkz@cnt@clnext\thetkz@cnt@lgnext);
753 \ifthenelse{\equal{\thetkz@cnt@arrow}{0}}{}{\tkzDrawArrow}\stepcounter{tkz@cnt@zone}%
754 }%
755 %<------------------------------------------------------------------ +CH ---->
756 {\ifthenelse{\equal{\expandafter\stripspaces\expandafter{\x}}{+CH}}%
757 {\setcounter{tkz@cnt@clnext}{\thetkz@cnt@cl}\stepcounter{tkz@cnt@clnext}
758 \fill[h style]%
759 (N\thetkz@cnt@cl\thetkz@cnt@lg)%
760 rectangle%
761 (N\thetkz@cnt@clnext\thetkz@cnt@lgnext);
762 \draw[double style]%
763 ([yshift = -\cmdTAB@tbs@lw/2] N\thetkz@cnt@cl\thetkz@cnt@lg) --%
764 ([yshift = \cmdTAB@tbs@lw/2] N\thetkz@cnt@cl\thetkz@cnt@lgnext);
765 \node[node style,high,on double] (FL\thetkz@cnt@cl\thetkz@cnt@lg) at (N\thetkz@cnt@aw\thetkz@cnt@lg){\ifTAB@VA@help\else\tl\fi};
766 \ifthenelse{\equal{\thetkz@cnt@arrow}{0}}{}{\tkzDrawArrow}\stepcounter{tkz@cnt@zone}%
767 }%
768 %<------------------------------------------------------------------ -CH ---->
769 {\ifthenelse{\equal{\expandafter\stripspaces\expandafter{\x}}{-CH}}%
770 {\setcounter{tkz@cnt@clnext}{\thetkz@cnt@cl}\stepcounter{tkz@cnt@clnext}%
771 \fill[h style]%
772 ([xshift=\tkz@deltax] N\thetkz@cnt@cl\thetkz@cnt@lg)%
773 rectangle%
774 (N\thetkz@cnt@clnext\thetkz@cnt@lgnext);
775 \draw[double style]%
776 ([yshift = -\cmdTAB@tbs@lw/2] N\thetkz@cnt@cl\thetkz@cnt@lg) --%
777 ([yshift = \cmdTAB@tbs@lw/2] N\thetkz@cnt@cl\thetkz@cnt@lgnext);
778 \node[node style,low,on double](FL\thetkz@cnt@cl\thetkz@cnt@lg) at (N\thetkz@cnt@aw\thetkz@cnt@lgnext){\ifTAB@VA@help\else\tl\fi};
779 \ifthenelse{\equal{\thetkz@cnt@arrow}{0}}{}{\tkzDrawArrow}\stepcounter{tkz@cnt@zone}%
780 }%
781 %<------------------------------------------------------------------ +H ---->
782 {\ifthenelse{\equal{\expandafter\stripspaces\expandafter{\x}}{+H}}%
783 {\setcounter{tkz@cnt@clnext}{\thetkz@cnt@cl}\stepcounter{tkz@cnt@clnext}
784 \fill[h style]%
785 (N\thetkz@cnt@cl\thetkz@cnt@lg)%
786 rectangle %
787 (N\thetkz@cnt@clnext\thetkz@cnt@lgnext);
788 \draw[]%
789 (N\thetkz@cnt@cl\thetkz@cnt@lg) -- (N\thetkz@cnt@cl\thetkz@cnt@lgnext);
790 \node[node style,high,on double] (FL\thetkz@cnt@cl\thetkz@cnt@lg) at (N\thetkz@cnt@aw\thetkz@cnt@lg){\ifTAB@VA@help\else\tl\fi};%
791 \ifthenelse{\equal{\thetkz@cnt@arrow}{0}}{}{\tkzDrawArrow}\stepcounter{tkz@cnt@zone}%
792 }%
793 %<------------------------------------------------------------------ -H ---->
794 {\ifthenelse{\equal{\expandafter\stripspaces\expandafter{\x}}{-H}}%
795 {\setcounter{tkz@cnt@clnext}{\thetkz@cnt@cl}\stepcounter{tkz@cnt@clnext}
796 \fill[h style]%
797 (N\thetkz@cnt@cl\thetkz@cnt@lg)%
798 rectangle %
799 (N\thetkz@cnt@clnext\thetkz@cnt@lgnext);
800 \draw[]%
801 (N\thetkz@cnt@cl\thetkz@cnt@lg) -- (N\thetkz@cnt@cl\thetkz@cnt@lgnext);
802 \node[node style,low,on double](FL\thetkz@cnt@cl\thetkz@cnt@lg) at (N\thetkz@cnt@aw\thetkz@cnt@lgnext){\ifTAB@VA@help\else\tl\fi};
803 \ifthenelse{\equal{\thetkz@cnt@arrow}{0}}{}{\tkzDrawArrow}\stepcounter{tkz@cnt@zone}%
804 }{}% non prévu
805 }}}}}}}}}}}}}}}}}}}}}}}}}}}}}}%
806 \stepcounter{tkz@cnt@arrow}}% end de la boucle
807 %<-------------------------------------------------- Tracé des flèches ------>
808 \end{scope}%
809 }% fin de la macro variation
810 %<--------------------------------------------------------------------------->
811 %<------------------------- Valeur Intermédiaire ---------------------------->
812 %<--------------------------------------------------------------------------->
813 \define@boolkey[TAB] {VI} {draw}[true]{}
814 \define@cmdkey [TAB] {VI} {remember}{}
815 \presetkeys [TAB] {VI} {draw = false,
816 remember= lastval}{}
817 %<--------------------------------------------------------------------------->
818 \newcommand*{\tkzTabVal}[6][]{%
819 \setkeys[TAB]{VI}{#1}%
820 \setcounter{tkz@cnt@lg}{\thetkz@cnt@line}%
821 \addtocounter{tkz@cnt@lg}{-1}%
822 \pgfextractx{\tkz@XF}{\pgfpointanchor{L#2}{center}}
823 \pgfextracty{\tkz@YF}{\pgfpointanchor{L#2}{center}}
824 \pgfmathparse{\cmdTAB@tbs@espcl * (#4)*(#3-#2)}%
825 \global\let\tkz@tab@dx\pgfmathresult
826 \node[inner sep = 0pt,fondL] (ANT) at (\tkz@XF + \tkz@tab@dx cm,\tkz@YF) {#5};
827 \path coordinate (ANTa) at ([xshift=\tkz@tab@dx cm]N#21);
828 \path coordinate (ANTb) at ([xshift=\tkz@tab@dx cm]N#2\thetkz@cnt@line);
829 \path (intersection cs:%
830 first line = {(FR#2\thetkz@cnt@lg)--(FL#3\thetkz@cnt@lg)},%
831 second line = {(ANTa)--(ANTb)}) node[node style,fondT](VAL){#6};
832 \path coordinate (\cmdTAB@VI@remember) at (VAL);
833 \ifTAB@VI@draw%
834 \draw[from style] (ANTa.center) to (VAL);
835 \fi
836 }%
837 %<--------------------------------------------------------------------------->
838 %<--------------------------------------------------------------------------->
839 \define@boolkey[TAB] {IM} {draw}[true]{}
840 \define@cmdkey [TAB] {IM} {remember}{}
841 \presetkeys [TAB] {IM} {draw = false,
842 remember= lastval}{}
843 \newcommand*{\tkzTabIma}[5][]{%
844 \setkeys[TAB]{IM}{#1}%
845 \setcounter{tkz@cnt@lg}{\thetkz@cnt@line}%
846 \addtocounter{tkz@cnt@lg}{-1}%
847 \setcounter{tkz@cnt@lgnext}{\thetkz@cnt@line}%
848 \path (intersection cs:
849 first line = {(FR#2\thetkz@cnt@lg)--(FL#3\thetkz@cnt@lg)},%
850 second line = {(N#4\thetkz@cnt@lg) --(N#4\thetkz@cnt@lgnext)}) node[node style,fondT](IMA){#5};
851 \path coordinate (\cmdTAB@IM@remember) at (IMA);
852 \ifTAB@IM@draw%
853 \draw[from style] (N#41) to (IMA);
854 \fi
855 }%
856 %<--------------------------------------------------------------------------->
857 %<--------------------------------------------------------------------------->
858 \newcommand*{\tkzTabImaFrom}[5][]{%
859 \setkeys[TAB]{IM}{#1}%
860 \setcounter{tkz@cnt@lg}{\thetkz@cnt@line}%
861 \addtocounter{tkz@cnt@lg}{-1}%
862 \path (intersection cs:%
863 first line = {(FR#2\thetkz@cnt@lg)--(FL#3\thetkz@cnt@lg)},%
864 second line={(#4)--([yshift=-0.5 cm]#4)}) node[node style,fondT](IMA){#5};
865 \path coordinate (\cmdTAB@IM@remember) at (IMA);
866 \ifTAB@IM@draw
867 \draw[from style] (#4) to (IMA);
868 \fi
869 }%
870 %<--------------------------------------------------------------------------->
871 %<--------------------------------------------------------------------------->
872 %<---------------------- tangente horizontale ----------------------------->
873 % args 1--> options ;
874 % 2--> tkz@cnt@cl debut fl ;
875 % 3--> tkz@cnt@clnext fin de fl ;%
876 % 4---> n°de val ;
877 % 5----> image
878 \define@cmdkey [TAB] {TA} {pos}[below]{}
879 \define@cmdkey [TAB] {TA} {color}{}
880 \define@boolkey[TAB] {TA} {draw}[true]{}
881 \define@cmdkey [TAB] {TA} {remember}{}
882 \presetkeys [TAB] {TA} {draw = false,
883 color = \tkzTabDefaultWritingColor,
884 pos = above,
885 remember = lastval}{}
886 %<--------------------------------------------------------------------------->
887 \newcommand*{\tkzTabTan}[5][]{%
888 \setkeys[TAB]{TA}{#1}%
889 \setcounter{tkz@cnt@lg}{\thetkz@cnt@line}%
890 \addtocounter{tkz@cnt@lg}{-1}%
891 \setcounter{tkz@cnt@lgnext}{\thetkz@cnt@line}%
892 \path (intersection cs:
893 first line = {(FR#2\thetkz@cnt@lg)--(FL#3\thetkz@cnt@lg)},%
894 second line = {(N#4\thetkz@cnt@lg) --(N#4\thetkz@cnt@lgnext)}) coordinate(tgt);
895 \draw[fill,color=\cmdTAB@TA@color] (tgt) circle (1pt);
896 \node[\cmdTAB@TA@pos =1pt] at (tgt) {#5};
897 \path coordinate (\cmdTAB@TA@remember) at (tgt);
898 \draw[tan style] (tgt) -- ++(.75,0);
899 \draw[tan style] (tgt) -- ++(-.75,0);
900 \ifTAB@TA@draw \draw[from style] (N#41) to (tgt); \fi
901 }%
902 %<--------------------------------------------------------------------------->
903 %<--------------------------------------------------------------------------->
904 \newcommand*{\tkzTabTanFrom}[5][]{%
905 \setkeys[TAB]{TA}{#1}%
906 \setcounter{tkz@cnt@lg}{\thetkz@cnt@line}%
907 \addtocounter{tkz@cnt@lg}{-1}%
908 \setcounter{tkz@cnt@lgnext}{\thetkz@cnt@line}%
909 \path (intersection cs:
910 first line = {(FR#2\thetkz@cnt@lg)--(FR#3\thetkz@cnt@lg)},%
911 second line = {(#4) --([yshift=-0.5 cm]#4)}) coordinate(tgt);
912 \draw[fill,color=\cmdTAB@TA@color] (tgt) circle (1pt);
913 \node[\cmdTAB@TA@pos = 1pt] at (tgt) {#5};
914 \path coordinate (\cmdTAB@TA@remember) at (tgt);
915 \draw[arrow style] (tgt) -- ++(.75,0);
916 \draw[arrow style] (tgt) -- ++(-.75,0);
917 \ifTAB@TA@draw \draw[from style] (#4) -- (tgt); \fi
918 }%
919 %<--------------------------------------------------------------------------->
920 %<---------------------- dérivée droite gauche ------------------------------>
921 \newcommand*{\tkzTabSlope}[1]{%
922 \foreach \x/\y/\z in {#1}{%
923 \node[left = 3pt] at (Z\x 1) {\scriptsize $\y$};
924 \node[right = 3pt] at (Z\x 1) {\scriptsize $\z$};
925 }%
926 }
927 %<--------------------------------------------------------------------------->
928 %<--------------------------------------------------------------------------->
929 \newcommand*{\tkzTab}[5][]{%
930 \tkzTabInit[#1]{#2}{#3}%
931 \tkzTabLine{#4}%
932 \tkzTabVar{#5}%
933 }
934 %<-------------------------------The End ------------------------------------>
935 \endinput
936