Debian Codegraph @

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

raw
1 \def\fileversion{1.4b}
2 \def\filedate{2015/01/05}
3 \def\fileauthor{Philippe DE SOUSA}
4 \NeedsTeXFormat{LaTeX2e}[1999/12/01]
5 \ProvidesPackage{tipfr}[%
6 \filedate\space v\fileversion\space
7 LaTeX package by \fileauthor]
8 \RequirePackage[dvipsnames,table]{xcolor}
9 \RequirePackage[zerostyle=d]{newtxtt}
10 \@ifpackageloaded{tikz}{}{\RequirePackage{tikz}}
11 \usetikzlibrary{calc,shapes,arrows,shadows,backgrounds,babel}
12 \@ifpackageloaded{ifthen}{}{\RequirePackage{ifthen}}
13 \@ifpackageloaded{xkeyval}{}{\RequirePackage{xkeyval}}
14 \@ifpackageloaded{mathtools}{}{\RequirePackage{mathtools}}
15 \@ifpackageloaded{amssymb}{}{\RequirePackage{amssymb}}
16 \@ifpackageloaded{multido}{}{\RequirePackage{multido}}
17
18 %% 13 décembre 2014 : v1.0 - création du package et du design des touches
19 %% 14 décembre 2014 : v1.1 - création de la commande \Touche
20 %% 19 décembre 2014 : v1.2 - création de la commande \Calculatrice, ajout de l'option entoure, ajout de l'option nom
21 %% 27 décembre 2014 : v1.2a - anglicisation des noms d'options
22 %% 27 décembre 2014 : v1.3 - ajout de la commande \Menu pour créer des menus de calculatrice
23 %% 29 décembre 2014 : v1.4 - ajout de la commande \Ecran pour afficher un écran avec courbe ou avec calculs et résultats
24 %% 02 janvier 2015 : v1.4a - changement de \ProvidesClass en \ProvidesPackage, suppression de \makeatletter, \makeatother
25 %% 05 janvier 2015 : v1.4b - suppression de \shorthandon{;} et \shorthandoff{;} grace à la librairie babel de Tikz
26 %% + possibilité de changer le nom de la touche Enter et les options Second et Alpha pour permettre le signe =
27 %% + suppression du \RequirePackage{babel}
28 %% 05 janvier 2015 : v1.5 - ajout de la commande étoilée de \Calculatrice pour dessiner une calculatrice mignature
29
30 %% Merci à Daniel Flipo et Knut Lickert pour leurs conseils et remarques
31
32
33
34 %%-----------------------------
35 %--------- TOUCHES ------------
36 %%-----------------------------
37
38 % définition de l'accent circonflexe et de la racine carrée
39 \newcommand*\Circonflexe{\tikz{\draw[scale=0.25] (0,0)--(1,1)--(2,0);}}
40 \newcommand*\Racine{$\sqrt{\phantom{xx}}$}
41
42
43 % création de booléen pour tester les styles de touche
44 \newcommand*{\Def@Bool}[1]{%
45 \newboolean{#1}
46 \setboolean{#1}{false}
47 }
48 \newcommand*{\DefBool}[1]{\Def@Bool{#1}}
49
50 \DefBool{ToucheChiffre}
51 \DefBool{ToucheOperation}
52 \DefBool{ToucheFonction}
53 \DefBool{ToucheGraphe}
54 \DefBool{ToucheAlpha}
55 \DefBool{ToucheSeconde}
56 \DefBool{ToucheOnOff}
57 \DefBool{ToucheEntrer}
58 \DefBool{ToucheFleches}
59 \DefBool{ModeAlpha}
60 \DefBool{ModeSeconde}
61 \define@boolkey{Touche}{arrowup}[false]{}
62 \define@boolkey{Touche}{arrowleft}[false]{}
63 \define@boolkey{Touche}{arrowright}[false]{}
64 \define@boolkey{Touche}{arrowdown}[false]{}
65 \define@boolkey{Touche}{arrowtot}[false]{}
66 \define@boolkey{Touche}{fixed}[true]{}
67 \define@boolkey{Touche}{circle}[false]{}
68
69
70 % Définition des keys
71 \define@key{Touche}{fontsize}{\def\Font@Size{#1}}
72
73 \define@key{Touche}{raise}{\def\Hauteur@Touche{#1}}
74
75 \define@key{Touche}{name}{\def\Le@Nom{#1}}
76
77 \define@key{Touche}{radius}{\def\Le@Rayon{#1}}
78
79 \define@key{Touche}{colour}{\def\La@Couleur{#1}}
80 \define@key{Touche}{color}{\def\La@Couleur{#1}}
81
82 \define@key{Touche}{thickness}{\def\Ep@isseur{#1}}
83
84 \define@key{Touche}{principal}{\def\Le@Principal{\fontsize{\Font@Size}{\Font@Size}\selectfont #1}}
85
86 \define@key{Touche}{position}{\def\La@Position{#1}}
87
88 \define@key{Touche}{alpha}{\ifthenelse{\equal{\string #1}{\string pasdealpha}}%
89 {\setboolean{ModeAlpha}{false}}%
90 {\def\Mode@Alpha{\fontsize{\Font@Size}{\Font@Size}\selectfont #1}\setboolean{ModeAlpha}{true}}%
91 }
92
93 \define@key{Touche}{second}{\ifthenelse{\equal{\string #1}{\string pasdeseconde}}%
94 {\setboolean{ModeSeconde}{false}}%
95 {\def\Mode@Seconde{\fontsize{\Font@Size}{\Font@Size}\selectfont #1}\setboolean{ModeSeconde}{true}}%
96 }
97
98 \define@key{Touche}{xoffset}{\def\X@Decalage{#1}}
99 \define@key{Touche}{yoffset}{\def\Y@Decalage{#1}}
100
101 \define@key{Touche}{scalearrows}{\def\Scale@Fleches{#1}}
102
103 % Définitions des styles disponibles
104 \define@choicekey{Touche}{style}%
105 {number,operation,function,graph,second,on,enter,alpha,arrows}%
106 {\ifthenelse{\equal{\string #1}{\string number}}%
107 {\setboolean{ToucheChiffre}{true}}
108 {\setboolean{ToucheChiffre}{false}}%
109 \ifthenelse{\equal{\string #1}{\string operation}}%
110 {\setboolean{ToucheOperation}{true}}
111 {\setboolean{ToucheOperation}{false}}%
112 \ifthenelse{\equal{\string #1}{\string function}}%
113 {\setboolean{ToucheFonction}{true}}
114 {\setboolean{ToucheFonction}{false}}%
115 \ifthenelse{\equal{\string #1}{\string graph}}%
116 {\setboolean{ToucheGraphe}{true}}
117 {\setboolean{ToucheGraphe}{false}}%
118 \ifthenelse{\equal{\string #1}{\string second}}%
119 {\setboolean{ToucheSeconde}{true}}
120 {\setboolean{ToucheSeconde}{false}}%
121 \ifthenelse{\equal{\string #1}{\string on}}%
122 {\setboolean{ToucheOnOff}{true}}
123 {\setboolean{ToucheOnOff}{false}}%
124 \ifthenelse{\equal{\string #1}{\string enter}}%
125 {\setboolean{ToucheEntrer}{true}}
126 {\setboolean{ToucheEntrer}{false}}%
127 \ifthenelse{\equal{\string #1}{\string alpha}}%
128 {\setboolean{ToucheAlpha}{true}}
129 {\setboolean{ToucheAlpha}{false}}%
130 \ifthenelse{\equal{\string #1}{\string arrows}}%
131 {\setboolean{ToucheFleches}{true}}
132 {\setboolean{ToucheFleches}{false}}%
133 }
134
135
136 % configurations par défaut
137 \presetkeys{Touche}{style=function,principal=sin,alpha=pasdealpha,second=pasdeseconde,
138 position=0.7,raise=0ex,fontsize=8pt,
139 xoffset=0cm,yoffset=0cm,scalearrows=1,name=NOM,
140 fixed=true,arrowup=false,arrowdown=false,arrowleft=false,arrowright=false,arrowtot=false,
141 circle=false,radius=20pt,colour=red,thickness=1pt}{}
142
143
144 %%-----------------------------
145 % commande \Touche dont la forme dépend du style choisi
146 %%-----------------------------
147
148 \newcommand*\Touche[1][]{%
149 \setkeys{Touche}{#1}
150 %%-----------------------------
151 % Touche blanche pour les chiffres
152 %%-----------------------------
153 \raisebox{\Hauteur@Touche}{
154 \ifthenelse{\boolean{ToucheChiffre}}%
155 {\unskip\begin{tikzpicture}[x=0.5cm,y=0.5cm,remember picture]
156 \draw[fill=white] (0,1)..controls+(40:0.4)and+(140:0.4).. (2,1) node[midway] (c) {} -- (2,1) arc (0:-180:1) -- cycle;
157 \path (1,0) -- (c) node[pos=\La@Position] {\bfseries \Le@Principal};
158 \coordinate (\Le@Nom) at (c);
159 \ifKV@Touche@circle\draw[\La@Couleur,line width=\Ep@isseur] (c) circle (\Le@Rayon);\fi
160 \ifthenelse{\boolean{ModeSeconde}}
161 {\ifthenelse{\boolean{ModeAlpha}}
162 {\node[above] at (c) {\makebox[1.2cm][s]{\bfseries\sffamily\textcolor{blue}%
163 {\Mode@Seconde}\hfill\textcolor{ForestGreen}{\Mode@Alpha}}};}
164 {\node[above] at (c) {\bfseries\sffamily\textcolor{blue}{\Mode@Seconde}};}}
165 {}
166 \end{tikzpicture}}%
167 {\unskip}%
168 }%
169 %%-----------------------------
170 % Touche grise pour les opérations
171 %%-----------------------------
172 \raisebox{\Hauteur@Touche}{
173 \ifthenelse{\boolean{ToucheOperation}}%
174 {\unskip\begin{tikzpicture}[x=0.5cm,y=0.5cm,remember picture]
175 \draw[fill=gray] (0,1)..controls+(20:0.4)and+(160:0.4).. (2,1) node[midway] (c)
176 {} -- (2,1)..controls+(-90:0.75)and+(0:0.5)..(1,0.2)..controls+(180:0.5)and+(-90:0.75)..(0,1) -- cycle ;
177 \path (1,0.2) -- (c) node[color=white,pos=\La@Position] {\bfseries\sffamily \Le@Principal};
178 \coordinate (\Le@Nom) at (c);
179 \ifKV@Touche@circle\draw[\La@Couleur,line width=\Ep@isseur] (c) circle (\Le@Rayon);\fi
180 \ifthenelse{\boolean{ModeSeconde}}
181 {\ifthenelse{\boolean{ModeAlpha}}
182 {\node[above] at (c) {\makebox[1.2cm][s]{\bfseries\sffamily\textcolor{blue}%
183 {\Mode@Seconde}\hfill\textcolor{ForestGreen}{\Mode@Alpha}}};}
184 {\node[above] at (c) {\bfseries\sffamily\textcolor{blue}{\Mode@Seconde}};}}
185 {}
186 \end{tikzpicture}}
187 {\unskip}%
188 }%
189 %%-----------------------------
190 % Touche noire pour les fonctions
191 %%-----------------------------
192 \raisebox{\Hauteur@Touche}{
193 \ifthenelse{\boolean{ToucheFonction}}
194 {\unskip\begin{tikzpicture}[x=0.5cm,y=0.5cm,remember picture]
195 \draw[fill=black] (0,1)..controls+(20:0.4)and+(160:0.4).. (2,1) node[midway] (c) {} --
196 (2,1)..controls+(-90:0.75)and+(0:0.5)..(1,0.2)..controls+(180:0.5)and+(-90:0.75)..(0,1) -- cycle ;
197 \path (1,0.2) -- (c) node[color=white,pos=\La@Position] {\bfseries\sffamily \Le@Principal};
198 \coordinate (\Le@Nom) at (c);
199 \ifKV@Touche@circle\draw[\La@Couleur,line width=\Ep@isseur] (c) circle (\Le@Rayon);\fi
200 \ifthenelse{\boolean{ModeSeconde}}
201 {\ifthenelse{\boolean{ModeAlpha}}
202 {\node[above] at (c) {\makebox[1.2cm][s]{\bfseries\sffamily\textcolor{blue}%
203 {\Mode@Seconde}\hfill\textcolor{ForestGreen}{\Mode@Alpha}}};}
204 {\node[above] at (c) {\bfseries\sffamily\textcolor{blue}{\Mode@Seconde}};}}
205 {}
206 \end{tikzpicture}}
207 {\unskip}%
208 }%
209 %%-----------------------------
210 % Touche grise pour les graphes
211 %%-----------------------------
212 \raisebox{\Hauteur@Touche}{
213 \ifthenelse{\boolean{ToucheGraphe}}
214 {\unskip\begin{tikzpicture}[x=0.5cm,y=0.7cm,remember picture]
215 \draw[fill=gray] (0,1)..controls+(20:0.4)and+(160:0.4).. (2,1) node[midway] (c) {} --
216 (2,1)..controls+(-90:0.3)and+(0:0.75)..(1,0.7)..controls+(180:0.75)and+(-90:0.3)..(0,1) -- cycle ;
217 \path (1,0.2) -- (c) node[color=white,pos=\La@Position] {\bfseries\sffamily \Le@Principal};
218 \coordinate (\Le@Nom) at (c);
219 \ifKV@Touche@circle\draw[\La@Couleur,line width=\Ep@isseur] (c) circle (\Le@Rayon);\fi
220 \ifthenelse{\boolean{ModeSeconde}}
221 {\ifthenelse{\boolean{ModeAlpha}}
222 {\node[above] at (c) {\makebox[1.2cm][s]{\bfseries\sffamily\textcolor{blue}%
223 {\Mode@Seconde}\hfill\textcolor{ForestGreen}{\Mode@Alpha}}};}
224 {\node[above] at (c) {\bfseries\sffamily\textcolor{blue}{\Mode@Seconde}};}}
225 {}
226 \end{tikzpicture}}
227 {\unskip}%
228 }%
229 %%-----------------------------
230 % Touche Entrer
231 %%-----------------------------
232 \raisebox{\Hauteur@Touche}{
233 \ifthenelse{\boolean{ToucheEntrer}}
234 {\unskip\begin{tikzpicture}[x=0.5cm,y=0.5cm,remember picture]
235 \draw[fill=gray] (0,1)..controls+(20:0.4)and+(160:0.4).. (2,1) node[midway] (c) {} --
236 (2,1)..controls+(-90:0.75)and+(0:0.7)..(1,-0.5)..controls+(180:0.7)and+(-90:0.75)..(0,1) -- cycle ;
237 \path (1,0.2) -- (c) node[color=white,pos=\La@Position] {\bfseries\sffamily \Le@Principal};
238 \coordinate (\Le@Nom) at (1,0.75);
239 \ifKV@Touche@circle\draw[\La@Couleur,line width=\Ep@isseur] (1,0.75) circle (\Le@Rayon);\fi
240 \ifthenelse{\boolean{ModeSeconde}}
241 {\ifthenelse{\boolean{ModeAlpha}}
242 {\node[above] at (c) {\makebox[1.2cm][s]{\bfseries\sffamily\textcolor{blue}%
243 {\Mode@Seconde}\hfill\textcolor{ForestGreen}{\Mode@Alpha}}};}
244 {\node[above] at (c) {\bfseries\sffamily\textcolor{blue}{\Mode@Seconde}};}}
245 {}
246 \end{tikzpicture}}
247 {\unskip}%
248 }%
249 %%-----------------------------
250 % Touche On/Off
251 %%-----------------------------
252 \raisebox{\Hauteur@Touche}{
253 \ifthenelse{\boolean{ToucheOnOff}}
254 {\unskip\begin{tikzpicture}[x=0.5cm,y=0.5cm,remember picture]
255 \draw[fill=black] (0,1)..controls+(20:0.4)and+(160:0.4).. (2,1) node[midway] (c) {} --
256 (2,1)..controls+(-90:0.75)and+(0:0.7)..(1,0)..controls+(180:0.7)and+(-90:0.75)..(0,1) -- cycle ;
257 \path (1,0.2) -- (c) node[color=white,pos=\La@Position] {\fontsize{\Font@Size}{\Font@Size}\selectfont\bfseries\sffamily on};
258 \coordinate (\Le@Nom) at (c);
259 \ifKV@Touche@circle\draw[\La@Couleur,line width=\Ep@isseur] (c) circle (\Le@Rayon);\fi
260 \node[above] at (c) {\fontsize{\Font@Size}{\Font@Size}\selectfont\bfseries\sffamily\textcolor{blue}{off}};
261 \end{tikzpicture}}
262 {\unskip}%
263 }%
264 %%-----------------------------
265 % Touche 2nde
266 %%-----------------------------
267 \raisebox{\Hauteur@Touche}{
268 \ifthenelse{\boolean{ToucheSeconde}}
269 {\unskip\begin{tikzpicture}[x=0.5cm,y=0.5cm,remember picture]
270 \draw[fill=blue] (0,1)..controls+(20:0.4)and+(160:0.4).. (2,1) node[midway] (c) {} --
271 (2,1)..controls+(-90:0.75)and+(0:0.5)..(1,0.2)..controls+(180:0.5)and+(-90:0.75)..(0,1) -- cycle ;
272 \coordinate (\Le@Nom) at (c);
273 \ifKV@Touche@circle\draw[\La@Couleur,line width=\Ep@isseur] (c) circle (\Le@Rayon);\fi
274 \path (1,0.2) -- (c) node[color=white,pos=\La@Position] {\fontsize{\Font@Size}{\Font@Size}\selectfont\bfseries\sffamily 2nde};
275 \end{tikzpicture}}%
276 {\unskip}%
277 }%
278 %%-----------------------------
279 % Touche Alpha
280 %%-----------------------------
281 \raisebox{\Hauteur@Touche}{
282 \ifthenelse{\boolean{ToucheAlpha}}%
283 {\unskip\begin{tikzpicture}[x=0.5cm,y=0.5cm,remember picture]
284 \draw[fill=ForestGreen] (0,1)..controls+(20:0.4)and+(160:0.4).. (2,1) node[midway] (c) {} --
285 (2,1)..controls+(-90:0.75)and+(0:0.5)..(1,0.2)..controls+(180:0.5)and+(-90:0.75)..(0,1) -- cycle ;
286 \path (1,0.2) -- (c) node[color=white,pos=\La@Position] {\fontsize{\Font@Size}{\Font@Size}\selectfont\bfseries\sffamily alpha};
287 \coordinate (\Le@Nom) at (c);
288 \ifKV@Touche@circle\draw[\La@Couleur,line width=\Ep@isseur] (c) circle (\Le@Rayon);\fi
289 \node[above] at (c) {\fontsize{\Font@Size}{\Font@Size}\selectfont\bfseries\sffamily\textcolor{blue}{verr A}};
290 \end{tikzpicture}}
291 {\unskip}%
292 }%
293 %%-----------------------------
294 % Touche des flèches
295 %%-----------------------------
296 \raisebox{\Hauteur@Touche}{
297 \ifthenelse{\boolean{ToucheFleches}}%
298 {\unskip\begin{tikzpicture}[\ifKV@Touche@fixed\else overlay\fi,xshift=\X@Decalage,yshift=\Y@Decalage,scale=\Scale@Fleches]
299 \fill[white] ({cos(110) -0.1},{sin(110)-0.2}) -- ({cos(160)+0.4},{sin(160)+0.12}) arc(30:-30:1) --
300 ({cos(-110) -0.1},{sin(-110)+0.2}) arc(-30:30:1.47) ;
301 \fill[white,xscale=-1] ({cos(110) -0.1},{sin(110)-0.2}) -- ({cos(160)+0.4},{sin(160)+0.12}) arc(30:-30:1) --
302 ({cos(-110) -0.1},{sin(-110)+0.2}) arc(-30:30:1.47) ;
303 \draw[fill=gray] ({cos(70)},{sin(70)}) arc (70:110:1) ..controls+(220:0.1)and+(90:0.1).. +(-0.1,-0.2)
304 arc(30:-30:1.47) ..controls+(-90:0.1)and+(140:0.1)..
305 ({cos(-110)},{sin(-110)}) arc (-110:-70:1)..controls+(40:0.1)and+(-90:0.1)..
306 +(0.1,0.2) arc (210:150:1.47) ..controls+(90:0.1)and+(-40:0.1).. ({cos(70)},{sin(70)});
307 \draw[fill=gray] ({cos(160)},{sin(160)}) arc(160:200:1) ..controls+(-45:0.2)and+(170:0.2).. +(0.4,-0.2)
308 arc(-30:30:1) ..controls+(180:0.2)and+(30:0.2).. ({cos(160)},{sin(160)});
309 \draw[fill=gray,xscale=-1] ({cos(160)},{sin(160)}) arc(160:200:1) ..controls+(-45:0.2)and+(170:0.2)..
310 +(0.4,-0.2) arc(-30:30:1) ..controls+(180:0.2)and+(30:0.2).. ({cos(160)},{sin(160)});
311 \fill[white] (0,0.9) -- +(-0.15,-0.15) -- +(0.15,-0.15)-- cycle;
312 \fill[white] (-0.9,0) -- +(0.15,0.15) -- +(0.15,-0.15)-- cycle;
313 \fill[white,yscale=-1] (0,0.9) -- +(-0.15,-0.15) -- +(0.15,-0.15)-- cycle;
314 \fill[white,xscale=-1] (-0.9,0) -- +(0.15,0.15) -- +(0.15,-0.15)-- cycle;
315 \coordinate (FLE) at (0,0);
316 \coordinate (FLH) at (0,0.825);
317 \coordinate (FLB) at (0,-0.825);
318 \coordinate (FLD) at (0.825,0);
319 \coordinate (FLG) at (-0.825,0);
320 \ifKV@Touche@arrowdown\draw[\La@Couleur,line width=\Ep@isseur] (FLB) circle (10pt);\fi
321 \ifKV@Touche@arrowleft\draw[\La@Couleur,line width=\Ep@isseur] (FLG) circle (10pt);\fi
322 \ifKV@Touche@arrowtot\draw[\La@Couleur,line width=\Ep@isseur] (FLE) circle (30pt);\fi
323 \ifKV@Touche@arrowup\draw[\La@Couleur,line width=\Ep@isseur] (FLH) circle (10pt);\fi
324 \ifKV@Touche@arrowright\draw[\La@Couleur,line width=\Ep@isseur] (FLD) circle (10pt);\fi
325 \end{tikzpicture}}
326 {\unskip}%
327 }%
328 }
329
330 %%-----------------------------
331 %------ CALCULATRICE ----------
332 %%-----------------------------
333
334 % options de la commande \Calculatrice*
335 \define@key{Calculatrice}{calcscale}{\def\Calc@Echelle{#1}}
336 \define@key{Calculatrice}{calcrotate}{\def\Calc@Rotation{#1}}
337 \define@key{Calculatrice}{calcraise}{\def\Calc@Position{#1}}
338
339 % configurations par défaut pour \Calculatrice*
340 \presetkeys{Calculatrice}{calcscale=0.5,calcrotate=-30,calcraise=-2ex}{}
341
342 %%-----------------------------
343 %-------- Grand format --------
344 %%-----------------------------
345 \newcommand{\Calculatrice@nostar}[1][]{
346 \begin{tikzpicture}[remember picture]
347 \renewcommand{\tabcolsep}{-3pt}
348 \node (tabcalc) at (0,0) {
349 \Touche[style=arrows,fixed=false,xoffset=5.75cm,yoffset=3.75cm]
350 \begin{tabular}{*{5}{>{\arraybackslash}c}}
351 %Touche du haut
352 \Touche[style=graph,principal=$f(x)$,second={gr.stats},alpha=f1,position=0.95,fontsize=7pt,name=FX] &
353 \Touche[style=graph,principal={fenêtre},second=déf tab,alpha=f2,position=0.95,fontsize=7pt,name=FEN] &
354 \Touche[style=graph,principal={zoom},second={format},alpha={f3},position=0.95,fontsize=7pt,name=ZOOM] &
355 \Touche[style=graph,principal={trace},second={calculs},alpha={f4},position=0.95,fontsize=7pt,name=TRC] &
356 \Touche[style=graph,principal={graphe},second={table},alpha={f5},position=0.95,fontsize=7pt,name=GRA] \\
357 %
358 \Touche[style=second,name=SCD] &
359 \Touche[principal={mode},second={quitter},position=0.8,name=MODE] &
360 \Touche[principal={suppr},second={insérer},position=0.65,name=SUP] & & \\
361 %
362 \Touche[style=alpha,name=ALPHA] &
363 \Touche[principal={$x,t,\theta,n$},second={échanger},fontsize=7pt,position=0.8,name=XTN] &
364 \Touche[principal={stats},second={listes},name=STATS] & & \\
365 %
366 \Touche[principal={math},second={tests},alpha={A},position=0.8,name=MAT] &
367 \Touche[principal={\textcolor{purple}{apps}},second={angle},alpha={B},position=0.7,name=APPS] &
368 \Touche[principal={prgm},second={dessin},alpha={C},position=0.7,name=PRGM] &
369 \Touche[principal={var},second={distrib},name=VAR] &
370 \Touche[principal={annul},name=ANN]\\
371 %
372 \Touche[principal={$x^{-1}$},second={matrice},alpha={D},fontsize=7pt,name=INV] &
373 \Touche[principal={sin},second={arcsin},alpha={E},name=SIN] &
374 \Touche[principal={cos},second={arccos},alpha={F},name=COS] &
375 \Touche[principal={tan},second={arctan},alpha={G},name=TAN] &
376 \Touche[principal={\Circonflexe},second={$\pi$},alpha={H},name=POW]\\
377 %
378 \Touche[principal={$x^2$},second={\Racine},alpha={I},name=CARRE] &
379 \Touche[principal={\large ,},second={EE},alpha={J},name=VIRG] &
380 \Touche[principal={(},second={\{},alpha={K},name=PO] &
381 \Touche[principal={)},second={\}},alpha={L},name=PF] &
382 \Touche[style=operation,principal={$\div$},second={e},alpha={M},name=DIV]\\
383 %
384 \Touche[principal={log},second={$10^x$},alpha={N},name=LOG] &
385 \Touche[style=number,principal={7},second={$u_n$},alpha={O},name=T7] &
386 \Touche[style=number,principal={8},second={$v_n$},alpha={P},name=T8] &
387 \Touche[style=number,principal={9},second={$w_n$},alpha={Q},name=T9] &
388 \Touche[style=operation,principal={$\times$},second={[},alpha={R},name=MUL]\\
389 %
390 \Touche[principal={ln},second={e$^x$},alpha={S},name=LN] &
391 \Touche[style=number,principal={4},second={L4},alpha={T},name=T4] &
392 \Touche[style=number,principal={5},second={L5},alpha={U},name=T5] &
393 \Touche[style=number,principal={6},second={L6},alpha={V},name=T6] &
394 \Touche[style=operation,principal={$-$},second={]},alpha={W},name=SUB]\\
395 %
396 \Touche[principal={sto$\to$},second={rappel},alpha={X},name=STO] &
397 \Touche[style=number,principal={1},second={L1},alpha={Y},name=T1] &
398 \Touche[style=number,principal={2},second={L2},alpha={Z},name=T2] &
399 \Touche[style=number,principal={3},second={L3},alpha={$\theta$},name=T3] &
400 \Touche[style=operation,principal={+},second={mém},alpha={"},name=ADD]\\
401 % Touches du bas
402 \Touche[style=on,name=ON] &
403 \Touche[style=number,principal={0},second={cat.},alpha={$\sqcup$},name=T0] &
404 \Touche[style=number,principal={$\centerdot$},second={$i$},alpha={:},name=DOT] &
405 \Touche[style=number,principal={(--)},second={rép},alpha={?},name=MS] &
406 \Touche[style=enter,fontsize=7pt, principal=entrer, second=préc, alpha=résol, name=ETR]
407 \end{tabular}};
408
409 \node (ecran) at ($(tabcalc.north west)+(0.35,0)$) [inner sep=0pt,draw,fill=ForestGreen!15,rectangle,
410 minimum width=6.85cm,minimum height=5cm,anchor=south west] {};
411 \begin{scope}[shift={(ecran.center)}]
412 \clip ($(tabcalc.north west)+(0.35,0)$) rectangle ($(tabcalc.north east)+(0.2,5)$);
413 \draw(ecran.south)--(ecran.north);
414 \draw(ecran.west)--(ecran.east);
415 \multido{\i=0+1}{7}{\draw ({\i/2},0)--({\i/2},0.05);}
416 \multido{\i=0+1}{7}{\draw ({-\i/2},0)--({-\i/2},0.05);}
417 \multido{\i=0+1}{5}{\draw (0,{\i/2})--(0.05,{\i/2});}
418 \multido{\i=0+1}{5}{\draw (0,{-\i/2})--(0.05,{-\i/2});}
419 %\draw[line width=1pt] plot[domain=-5:5,samples=500] (\x,{(\x+1)^2-2.25});
420 \end{scope}
421
422 \begin{scope}[on background layer]
423 \draw[fill=Orange!10]
424 ($(ecran.north west) + (-0.65,0.85)$)..controls+(-120:0.5)and+(90:1.5)..
425 ($(tabcalc.west) + (-0.4,-3.5)$) ..controls+(-90:1)and+(170:1)..
426 ($(tabcalc.south west)+ (0.8,-0.5)$) ..controls+(-10:0.5)and+(-170:1)..
427 ($(tabcalc.south east) + (-0.5,-0.5)$) ..controls+(10:1)and+(-90:1)..
428 ($(tabcalc.east) + (0.75,-3.5)$) ..controls+(90:1.5)and+(-60:0.5)..
429 ($(ecran.north east) + (0.65,0.85)$) ..controls+(170:1.5)and+(10:1.5)..
430 ($(ecran.north west) + (-0.65,0.85)$)--cycle;
431 \node at ($(ecran.north) + (0,0.5)$) {{\Large\bfseries\sffamily #1}};
432 \end{scope}
433 \end{tikzpicture}
434 }
435
436 %%-----------------------------
437 %-------- Petit format --------
438 %%-----------------------------
439 \newcommand*{\Calculatrice@star}[1][]{%
440 \setkeys{Calculatrice}{#1}%
441 \raisebox{\Calc@Position}{%
442 \begin{tikzpicture}[x=0.5cm,scale=\Calc@Echelle,rotate=\Calc@Rotation]
443 \draw[fill=black] (0,0) rectangle (2.1,2.6);
444 \draw[white,fill=white] (0.1,1.5) rectangle (2,2.5);
445 \fill[white] (0.25,1.35) ellipse (0.15 and 0.05)
446 ++(0.4,0) ellipse (0.15 and 0.05)
447 ++(0.4,0) ellipse (0.15 and 0.05)
448 ++(0.4,0) ellipse (0.15 and 0.05)
449 ++(0.4,0) ellipse (0.15 and 0.05);
450 \fill[white] (1.8,1) ellipse (0.2 and 0.15);
451 \fill[white,rounded corners=2] (0.1,0.9) rectangle ++(0.4,0.2);
452 \fill[white,rounded corners=2] (0.6,0.9) rectangle ++(0.4,0.2);
453 \fill[white,rounded corners=2] (1.1,0.9) rectangle ++(0.4,0.2);
454 %%
455 \fill[white,rounded corners=2] (0.1,0.45) rectangle ++(0.4,0.2);
456 \fill[white,rounded corners=2] (0.6,0.45) rectangle ++(0.4,0.2);
457 \fill[white,rounded corners=2] (1.1,0.45) rectangle ++(0.4,0.2);
458 \fill[white,rounded corners=2] (1.6,0.45) rectangle ++(0.4,0.2);
459 %%
460 \fill[white,rounded corners=2] (0.1,0.1) rectangle ++(0.4,0.2);
461 \fill[white,rounded corners=2] (0.6,0.1) rectangle ++(0.4,0.2);
462 \fill[white,rounded corners=2] (1.1,0.1) rectangle ++(0.4,0.2);
463 \fill[white,rounded corners=2] (1.6,0.1) rectangle ++(0.4,0.2);
464 %%
465 \end{tikzpicture}%
466 }%
467 }
468
469 %%-----------------------------
470 %\Calculatrice = Grand format-
471 %\Calculatrice* = Petit format-
472 %%-----------------------------
473 \newcommand*\Calculatrice{\@ifstar{\Calculatrice@star}{\Calculatrice@nostar}}
474
475
476 %%-----------------------------
477 %------ MENU ------------------
478 %%-----------------------------
479
480 % Définitions des options
481 \define@boolkey{Menu}{select}[false]{}
482 \define@key{Menu}{size}{\def\t@ille{#1}}
483 \define@key{Menu}{text}{\def\@texte{#1}}
484 \define@key{Menu}{colourbox}{\def\Couleur@Boite{#1}}
485 \define@key{Menu}{colorbox}{\def\Couleur@Boite{#1}}
486
487 % Valeurs par défaut
488 \presetkeys{Menu}{select=false,text=\unskip,colorbox=white}{size=15pt}
489
490 % Définition de la touche \Menu
491 \newcommand\@Menu[2][]{
492 \setlength{\fboxsep}{0pt} \setlength{\fboxrule}{0.5pt}
493 \setkeys{Menu}{#1}
494 \ifKV@Menu@select \tikz[font=\ttfamily\bfseries]{\node (texte)
495 {\fontsize{\t@ille}{0}\selectfont\colorbox{black}{\color{white}\protect\uppercase{#2}}};\draw
496 (texte) node[right=10pt] {\fontsize{\t@ille}{0}\selectfont\@texte};} \else
497 \tikz[font=\ttfamily\bfseries]{\node (texte)
498 {\fontsize{\t@ille}{0}\selectfont\colorbox{\Couleur@Boite}{\color{black}\protect\uppercase{#2}}};\draw
499 (texte) node[right=10pt] {\fontsize{\t@ille}{0}\selectfont\@texte};} \fi }
500
501 \newcommand\Menu[2][]{\@Menu[#1]{#2}}
502
503
504
505 %%-----------------------------
506 %------ ECRAN ------------------
507 %%-----------------------------
508
509
510 \newcounter{LineCommand}
511 \setcounter{LineCommand}{0}
512 \newcounter{LineResult}
513 \setcounter{LineResult}{0}
514
515 \define@boolkey{Ecran}{graphic}[false]{}
516
517 % Définition des keys
518 \define@key{Ecran}{screencolor}{\def\Couleur@Ecran{#1}}
519 \define@key{Ecran}{screencolour}{\def\Couleur@Ecran{#1}}
520 \define@key{Ecran}{screenname}{\def\Nom@Ecran{#1}}
521 \define@key{Ecran}{xgrad}{\def\X@Grad{#1}}
522 \define@key{Ecran}{ygrad}{\def\Y@Grad{#1}}
523 \define@key{Ecran}{nbgradx}{\def\@IncrementX{#1}}
524 \define@key{Ecran}{nbgrady}{\def\@IncrementY{#1}}
525 \define@key{Ecran}{width}{\def\L@ngueur{#1}}
526 \define@key{Ecran}{height}{\def\H@uteur{#1}}
527 \define@key{Ecran}{origin}{\def\@rigin{#1}}
528 \define@key{Ecran}{plotcolour}{\def\courbe@couleur{#1}}
529 \define@key{Ecran}{plotcolor}{\def\courbe@couleur{#1}}
530 \define@key{Ecran}{plotwidth}{\def\courbe@epaisseur{#1}}
531
532 % Configurations par défaut
533 \presetkeys{Ecran}{graphic=false,
534 screencolour=ForestGreen!15,
535 screenname=ecran,
536 width=8, height=5,
537 xgrad=0.5, ygrad=0.5,
538 nbgradx=8, nbgrady=5,
539 origin=(\[email protected]),
540 plotcolour=blue,
541 plotwidth=1pt
542 }{}
543
544 % Commande \Ecran
545 \newcommand*\Ecran[2][]{%
546 \setcounter{LineCommand}{0}
547 \setcounter{LineResult}{0}
548 \setkeys{Ecran}{#1}
549 \ifKV@Ecran@graphic
550 \begin{tikzpicture}[remember picture]
551 \node (\Nom@Ecran) at (0,0) [inner sep=0pt,draw, fill=\Couleur@Ecran, rectangle, minimum width=\L@ngueur cm,
552 minimum height=\H@uteur cm, anchor=south west] {};
553 \clip (0,0) rectangle (\L@ngueur,\H@uteur);
554 \draw \@rigin -- +(0,\H@uteur) -- +(0,-\H@uteur);
555 \draw \@rigin -- +(\L@ngueur,0) -- +(-\L@ngueur,0);
556 \begin{scope}[shift=\@rigin,x=\X@Grad cm,y=\Y@Grad cm]
557 \multido{\i=0+1}{\@IncrementX}{\draw (\i,0)--(\i,0.05/\Y@Grad);}
558 \multido{\i=0+1}{\@IncrementX}{\draw (-\i,0)--(-\i,0.05/\Y@Grad);}
559 \multido{\i=0+1}{\@IncrementY}{\draw (0,{\i})--(0.05/\X@Grad,{\i});}
560 \multido{\i=0+1}{\@IncrementY}{\draw (0,{-\i})--(0.05/\X@Grad,{-\i});}
561 \foreach \courbe/\domain in {#2}
562 \ifx \domain\empty \def\domain{-6:6} \fi
563 \draw[line width=\courbe@epaisseur,color=\courbe@couleur] plot[domain=\domain,samples=500] (\x,{\courbe});
564 \end{scope}
565 \end{tikzpicture}
566 \else
567 \begin{tikzpicture}[remember picture]
568 \node (\Nom@Ecran) at (0,0) [inner sep=0pt, draw, fill=\Couleur@Ecran, rectangle, minimum width=\L@ngueur cm,
569 minimum height=\H@uteur cm,anchor=south west] {};
570 \clip (0,0) rectangle (\L@ngueur,\H@uteur);
571 \foreach \command/\result in {#2}
572 {\ifx\command\empty {\addtocounter{LineResult}{-1}\addtocounter{LineCommand}{1}} \else
573 \node[anchor=north west] at ($(\[email protected] west)+(0,-\theLineCommand/2)$) {\texttt{\command}};
574 \addtocounter{LineCommand}{2}\fi
575 \ifx\result\empty {\addtocounter{LineCommand}{-1}\addtocounter{LineResult}{1}} \else
576 \node[anchor=north east] at ($(\[email protected] east)+(0,-0.5-\theLineResult/2)$) {\texttt{\result}};
577 \addtocounter{LineResult}{2}\fi}
578 \end{tikzpicture}
579 \fi
580 }