1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
|
% tkz-obj-eu-axesmin.tex
% Copyright 2022 Alain Matthes
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% of this license or (at your option) any later version.
% The latest version of this license is in
% http://www.latex-project.org/lppl.txt
% and version 1.3 or later is part of all distributions of LaTeX
% version 2005/12/01 or later.
% This work has the LPPL maintenance status “maintained”.
% The Current Maintainer of this work is Alain Matthes.
\def\fileversion{4.25c}
\def\filedate{2022/09/23}
\typeout{2022/09/23 4.25c tkz-obj-eu-axesmin}
\makeatletter
\def\removedot#1.{#1}
\newcommand\tkzgetinteger[1]{\expandafter\tkz@getinteger#1.\@nil}
\def\tkz@getinteger#1.#2\@nil{%
\ifx\empty#2\empty
\tkz@integertrue
\else
\ifnum\removedot#2=0
\tkz@integertrue
\else
\tkz@integerfalse
\fi
\fi
}
%<--------------------------------------------------------------------------–>
% Setup axe
%<--------------------------------------------------------------------------–>
\pgfkeys{tkzaxis/.cd,
line width/.code = \xdef\tkz@sua@lw{#1},
color/.code = \xdef\tkz@sua@color{#1},
tickwd/.code = \xdef\tkz@sua@tickwd{#1},
ticka/.code = \xdef\tkz@sua@ticka{#1},
tickb/.code = \xdef\tkz@sua@tickb{#1},
line width = \tkz@init@lw,
color = \tkz@init@color,
tickwd = \tkz@init@tickwd,
ticka = \tkz@init@ticka,
tickb = \tkz@init@tickb
}
\def\tkzSetUpAxis{\pgfutil@ifnextchar[{\tkz@SetUpAxis}{\tkz@SetUpAxis[]}}
\def\tkz@SetUpAxis[#1]{%
\begingroup
\pgfqkeys{/tkzaxis}{#1}
\global\let\tkz@init@lw\tkz@sua@lw
\global\let\tkz@init@gradsize\tkz@sua@gradsize
\global\let\tkz@init@color\tkz@sua@color
\global\let\tkz@init@tickwd\tkz@sua@tickwd
\global\let\tkz@init@ticka\tkz@sua@ticka
\global\let\tkz@init@tickb\tkz@sua@tickb
\endgroup
}
%<--------------------------------------------------------------------------–>
% tkzDrawX todo améliorer les unités
% sans doute à revoir loop from 0 to i then calcul dans la boucle de la position
% et de l'affichage
%<--------------------------------------------------------------------------–>
\pgfkeys{%
/tkzdrawX/.cd,
color/.store in = \tkz@X@color,
label/.store in = \tkz@X@label,
right space/.store in = \tkz@axe@rxspace,
left space/.store in = \tkz@axe@lxspace,
step/.code = {\edef\tkz@posnext{\fpeval{#1}}},
color = \tkz@init@color,
label = \tkz@init@xlabel,
step = \tkz@init@xstep,
right space = \tkz@init@rightspace, %???
left space = \tkz@init@leftspace,
noticks/.is if = tkz@X@noticks,
noticks/.default = true,
noticks = true,
tickwd/.store in = \tkz@X@tickwd,
tickup/.store in = \tkz@X@tickup,
tickdn/.store in = \tkz@X@tickdn,
tickwd = \tkz@init@tickwd,
tickup = \tkz@init@ticka,
tickdn = \tkz@init@tickb,
/tkzdrawX/.search also={/tikz},
}
\def\tkzDrawX{\pgfutil@ifnextchar[{\tkz@DrawX}{\tkz@DrawX[]}}
\def\tkz@DrawX[#1]{
\begingroup%
\pgfqkeys{/tkzdrawX}{#1}
\edef\tkz@posmax{\fpeval{trunc(\tkz@xb,\tkz@init@xdec)}}
\edef\tkz@posmin{\fpeval{trunc(\tkz@xa,\tkz@init@xdec)}}
\edef\tkz@xbsup{\fpeval{\tkz@xb+\tkz@axe@rxspace}}
\edef\tkz@xainf{\fpeval{\tkz@xa-\tkz@axe@lxspace}}
\path (\tkz@xainf,0)--(\tkz@xbsup,0) node(tkz@xline){};
\draw[xaxe style,
color = \tkz@X@color,
/tkzdrawX/.cd, #1] (\tkz@xainf,0)--(\tkz@xbsup,0)
node[ xlabel style,
/tkzdrawX/.cd,
#1]{\tkz@X@label};
\iftkz@X@noticks
\else
\edef\tkz@posmax{\fpeval{trunc(\tkz@posmax,\tkz@init@xdec)}}
\edef\tkz@posnext{\fpeval{\tkz@posnext/\tkz@init@xstep+\tkz@posmin}}
\foreach \pos in {\tkz@posmin,...,\tkz@posmax}{%
\edef\tkz@pos{\fpeval{\pos*1}}% ???
\draw[ color = \tkz@X@color,
line width = \tkz@X@tickwd,
shift = {(\tkz@pos,0)}]%
(0pt,\tkz@X@tickup)--(0pt,-\tkz@X@tickdn);
}
\fi
\endgroup
}
%<--------------------------------------------------------------------------–>
% tkzDrawY todo améliorer les unités
%<--------------------------------------------------------------------------–>
\pgfkeys{%
/tkzdrawY/.cd,
color/.store in = \tkz@Y@color,
label/.store in = \tkz@Y@label,
up space/.store in = \tkz@axe@uyspace,
down space/.store in = \tkz@axe@dyspace,
step/.code = {\edef\tkz@posnext{\fpeval{#1}}},
color = \tkz@init@color,
label = \tkz@init@ylabel,
step = \tkz@init@ystep,
up space = \tkz@init@upspace,
down space = \tkz@init@downspace,
noticks/.is if = tkz@Y@noticks,
noticks/.default = true,
noticks = true,
tickwd/.store in = \tkz@Y@tickwd,
ticklt/.store in = \tkz@Y@ticklt,
tickrt/.store in = \tkz@Y@tickrt,
tickwd = \tkz@init@tickwd,
ticklt = \tkz@init@tickb,
tickrt = \tkz@init@ticka,
/tkzdrawY/.search also={/tikz},
}
\def\tkzDrawY{\pgfutil@ifnextchar[{\tkz@DrawY}{\tkz@DrawY[]}}
\def\tkz@DrawY[#1]{%
\begingroup
\pgfkeys{/tkzdrawY/.cd,step = \tkz@init@ystep}
\pgfqkeys{/tkzdrawY}{#1}
\edef\tkz@posmax{\fpeval{trunc(\tkz@yb,\tkz@init@ydec)}}
\edef\tkz@posmin{\fpeval{trunc(\tkz@ya,\tkz@init@ydec)}}
\edef\tkz@ybsup{\fpeval{\tkz@yb+\tkz@axe@uyspace}}
\edef\tkz@yainf{\fpeval{\tkz@ya-\tkz@axe@dyspace}}
\path (0,\tkz@yainf)--(0,\tkz@ybsup) node(tkz@yline){};
\draw[color = \tkz@Y@color,
yaxe style,/tkzdrawY/.cd,#1] (0,\tkz@yainf)--(0,\tkz@ybsup)
node[ylabel style,/tkzdrawY/.cd,#1]{\tkz@Y@label};
\iftkz@Y@noticks
\else
\edef\tkz@posmax{\fpeval{trunc(\tkz@posmax,\tkz@init@ydec)}}
\edef\tkz@posnext{\fpeval{\tkz@posnext/\tkz@init@ystep+\tkz@posmin}}
\foreach \tkz@pos in {\tkz@posmin,\tkz@posnext,...,\tkz@posmax}{%
\draw[color = \tkz@Y@color,
line width = \tkz@Y@tickwd,
shift = {(0,\tkz@pos)}]%
(\tkz@Y@tickrt,0pt)--(-\tkz@Y@ticklt,0pt);}
\fi
\endgroup}
\makeatother
\endinput
|