Debian Codegraph @

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

raw
1 %---------------
2 % Licence
3 %---------------
4 %This program can be redistributed and/or modified under the terms
5 %of the LaTeX Project Public License Distributed from CTAN archives
6 %in directory macros/latex/base/lppl.txt.
7
8
9 \def\fileversion{1.0}
10 \def\filedate{2015/02/15}
11 \def\fileauthor{Philippe DE SOUSA}
12 \NeedsTeXFormat{LaTeX2e}[1999/12/01]
13 \ProvidesPackage{ticollege}[%
14 \filedate\space v\fileversion\space
15 LaTeX package by \fileauthor]
16 \RequirePackage[dvipsnames,table]{xcolor}
17 \RequirePackage[zerostyle=d]{newtxtt}
18 \@ifpackageloaded{tikz}{}{\RequirePackage{tikz}}
19 \usetikzlibrary{calc,shapes,arrows,shadows,backgrounds,babel}
20 \@ifpackageloaded{ifthen}{}{\RequirePackage{ifthen}}
21 \@ifpackageloaded{xkeyval}{}{\RequirePackage{xkeyval}}
22 \@ifpackageloaded{mathtools}{}{\RequirePackage{mathtools}}
23 \@ifpackageloaded{amssymb}{}{\RequirePackage{amssymb}}
24 \@ifpackageloaded{multido}{}{\RequirePackage{multido}}
25 \@ifpackageloaded{multirow}{}{\RequirePackage{multirow}}
26
27 %% 15 février 2015 : v1.0
28
29
30 %%-----------------------------
31 %-- Couleurs
32 %%-----------------------------
33 \definecolor{TIRouge}{RGB}{215,64,45}
34 \definecolor{TIOrange}{RGB}{239,148,69}
35 \definecolor{TIJaune}{RGB}{254,212,75}
36
37 %%-----------------------------
38 %-- Symboles particuliers
39 %%-----------------------------
40
41 % définition de la racine carrée
42 \newcommand*\TiRacine[1][]{$\sqrt[#1]{\phantom{x}}$}
43 % définition des dessins de contrast
44 \newcommand*{\ContrastUp}{
45 \tikz{
46 \draw[orange] (0,0) circle[radius = 0.2];
47 \fill[orange] (0,0.2) arc[radius=0.2, start angle=90, end angle=-90] -- cycle;
48 \fill[orange] (0.45,0) -- ++(150:0.2) -- ++(0,-0.2) -- cycle;
49 }
50 }
51 \newcommand*{\ContrastDown}{
52 \tikz{
53 \draw[orange] (0,0) circle[radius = 0.2];
54 \fill[orange] (0,0.2) arc[radius=0.2, start angle=90, end angle=-90] -- cycle;
55 \fill[orange] (-0.45,0) -- ++(30:0.2) -- ++(0,-0.2) -- cycle;
56 }
57 }
58 % définition du symbole aff
59 \newcommand*{\Aff}{
60 \tikz[scale=0.7]{
61 \draw (0,0) node[scale=0.7] {\scriptsize\textsf{aff}};
62 \draw[->, >=latex'] ({0.5*cos(40)},{0.4*sin(140)}) arc[x radius=0.5, y radius=0.4, start angle=40, end angle=140];
63 \draw[->, >=latex'] ({0.5*cos(220)},{0.4*sin(320)}) arc[x radius=0.5, y radius=0.4, start angle=220, end angle=320];
64 }
65 }
66
67 % définition du symbole de la division posée
68 \newcommand*{\Div}{\tikz{\draw[thick] (0,0) -- (0,0.5) (0,0.35)--(0.2,0.35);}}
69
70
71 %%-----------------------------
72 %--- Définitions auxiliaires + xkeyval
73 %%-----------------------------
74
75 % création de booléen pour tester les styles de touche
76 \newcommand*{\TiCDef@Bool}[1]{%
77 \newboolean{#1}
78 \setboolean{#1}{false}
79 }
80 \newcommand*{\TiCDefBool}[1]{\TiCDef@Bool{#1}}
81
82 \TiCDefBool{TiCChiffre}
83 \TiCDefBool{TiCGeneral}
84 \TiCDefBool{TiCFleches}
85 \TiCDefBool{TiCModeSeconde}
86 \TiCDefBool{ArrondiToucheGauche}
87 \TiCDefBool{ArrondiToucheDroit}
88 % pour entourer une touche :
89 \define@boolkey{PresetTiC}{circle}[false]{}
90 % pour entourer la touche de flèche
91 \define@boolkey{PresetTiC}{circleup}[false]{}
92 \define@boolkey{PresetTiC}{circleleft}[false]{}
93 \define@boolkey{PresetTiC}{circleright}[false]{}
94 \define@boolkey{PresetTiC}{circledown}[false]{}
95
96 % Définitions des styles disponibles
97 \define@choicekey{PresetTiC}{style}%
98 {general, number, arrows}%
99 {\ifthenelse{\equal{\string #1}{\string number}}%
100 {\setboolean{TiCChiffre}{true}}
101 {\setboolean{TiCChiffre}{false}}%
102 \ifthenelse{\equal{\string #1}{\string general}}%
103 {\setboolean{TiCGeneral}{true}}
104 {\setboolean{TiCGeneral}{false}}%
105 \ifthenelse{\equal{\string #1}{\string arrows}}%
106 {\setboolean{TiCFleches}{true}}
107 {\setboolean{TiCFleches}{false}}%
108 }
109
110 % Définitions des touches arrondis
111 \define@choicekey{PresetTiC}{rounded}%
112 {left, right, none}%
113 {\ifthenelse{\equal{\string #1}{\string left}}%
114 {\setboolean{ArrondiToucheGauche}{true}}
115 {\setboolean{ArrondiToucheGauche}{false}}%
116 \ifthenelse{\equal{\string #1}{\string right}}%
117 {\setboolean{ArrondiToucheDroit}{true}}
118 {\setboolean{ArrondiToucheDroit}{false}}%
119 \ifthenelse{\equal{\string #1}{\string none}}%
120 {\setboolean{ArrondiToucheDroit}{false}\setboolean{ArrondiToucheGauche}{false}}
121 {\relax}%
122 }
123
124 % Définitions des keys
125 % les couleurs
126 \define@key{PresetTiC}{color key}{\def\Couleur@Touche{#1}}
127 \define@key{PresetTiC}{colour key}{\def\Couleur@Touche{#1}}
128 \define@key{PresetTiC}{color text}{\def\Couleur@Texte{#1}}
129 \define@key{PresetTiC}{colour text}{\def\Couleur@Texte{#1}}
130 \define@key{PresetTiC}{color second}{\def\Couleur@Seconde{#1}}
131 \define@key{PresetTiC}{colour second}{\def\Couleur@Seconde{#1}}
132 \define@key{PresetTiC}{colour circle}{\def\Couleur@Cercle{#1}}
133 \define@key{PresetTiC}{color circle}{\def\Couleur@Cercle{#1}}
134 % taille du texte
135 \define@key{PresetTiC}{fontsize}{\def\Font@Size{#1}}
136 % hauteur de la touche
137 \define@key{PresetTiC}{raise}{\def\Hauteur@Touche{#1}}
138 % texte principal de la touche
139 \define@key{PresetTiC}{principal}{\def\Le@Principal{\fontsize{\Font@Size}{\Font@Size}\selectfont\color{\Couleur@Texte} #1}}
140 % position du texte principal à l'interieur de la touche
141 \define@key{PresetTiC}{position}{\def\La@Position{#1}}
142 % nom de la touche pour des utilisations dans tikzpicture
143 \define@key{PresetTiC}{name}{\def\Le@Nom{#1}}
144 % pour entourer une touche
145 \define@key{PresetTiC}{radius}{\def\Le@Rayon{#1}}
146 \define@key{PresetTiC}{thickness}{\def\Ep@isseur{#1}}
147 % texte secondaire
148 \define@key{PresetTiC}{second}{\ifthenelse{\equal{\string #1}{\string pasdeseconde}}%
149 {\setboolean{TiCModeSeconde}{false}}%
150 {\def\Mode@Seconde{\fontsize{\Font@Size}{\Font@Size}\selectfont\color{\Couleur@Seconde} #1}
151 \setboolean{TiCModeSeconde}{true}}%
152 }
153
154 % configurations par défaut
155 \presetkeys{PresetTiC}{style=general, principal=sin, second=pasdeseconde,
156 position=0.9, raise=0ex, fontsize=6pt, name=NOM,
157 rounded=none, colour second=TIOrange, colour key=TIRouge, colour text=white,
158 circle=false, radius=20pt, colour circle=red, thickness=1pt,
159 circleup=false, circleleft=false, circledown=false, circleright=false}{}
160
161
162
163
164 %%-----------------------------
165 % commande \TiC dont la forme dépend du style choisi
166 %%-----------------------------
167
168 \newcommand*\TiC[1][]{%
169 \setkeys{PresetTiC}{#1}%
170 %%-----------------------------
171 % Touche colorée pour les fonctions
172 %%-----------------------------
173 \raisebox{\Hauteur@Touche}{
174 \ifthenelse{\boolean{TiCGeneral}}%
175 {\unskip
176 \begin{tikzpicture}[x=0.5cm,y=0.5cm,remember picture]
177 \draw[fill=\Couleur@Touche] (0.35,1) -- ++(1,0) arc[start angle = 90, end angle = -90, x radius = 0.35, y radius = 0.5]
178 -- ++(-1,0) arc[start angle=270, end angle=90, x radius = 0.35, y radius = 0.5] -- cycle;
179 \path (0.85,1) -- (0.85,0.5) node[pos=\La@Position] (c) {\bfseries \Le@Principal};
180 \coordinate (\Le@Nom) at (c);
181 \ifKV@PresetTiC@circle\draw[\Couleur@Cercle,line width=\Ep@isseur] (c) circle[radius=\Le@Rayon];\fi
182 \ifthenelse{\boolean{TiCModeSeconde}} %
183 {\node[above] at (0.85,1) {\bfseries\sffamily\Mode@Seconde};} %
184 {}
185 \end{tikzpicture}
186 }%
187 {\unskip}%
188 }%
189 %%-----------------------------
190 % Touche colorée pour les chiffres
191 %%-----------------------------
192 \raisebox{\Hauteur@Touche}{
193 \ifthenelse{\boolean{TiCChiffre}}%
194 {\ifthenelse{\boolean{ArrondiToucheGauche}}%
195 {\unskip%
196 \begin{tikzpicture}[x=0.5cm,y=0.5cm,remember picture]
197 \draw[fill=\Couleur@Touche] (0.85,1) -| ++(-0.5,0) arc[start angle = 90, end angle = 270, x radius = 0.35, y radius = 0.5] -| ++(0.5,0);
198 \draw[fill=\Couleur@Touche, rounded corners=1.5pt] (0.8,0) -| (1.7,0.5) |- ++(-0.3,0.5) -- (0.8,1);
199 \node (c) at (0.85,0.5) {\bfseries \Le@Principal};
200 \coordinate (\Le@Nom) at (c);
201 \ifKV@PresetTiC@circle\draw[\Couleur@Cercle,line width=\Ep@isseur] (c) circle[radius=\Le@Rayon];\fi
202 \ifthenelse{\boolean{TiCModeSeconde}} %
203 {\node[above] at (0.85,1) {\bfseries\sffamily\Mode@Seconde};} %
204 {}
205 \end{tikzpicture}}%
206 {\ifthenelse{\boolean{ArrondiToucheDroit}}%
207 {\unskip%
208 \begin{tikzpicture}[x=0.5cm,y=0.5cm,remember picture]
209 \draw[fill=\Couleur@Touche] (0.85,1) -| ++(0.5,0) arc[start angle = 90, end angle = -90, x radius = 0.35, y radius = 0.5] -| ++(-0.85,0);
210 \draw[fill=\Couleur@Touche, rounded corners=1.5pt] (0.85,0) -| (0,0.5) |- ++(0.3,0.5) -- (0.85,1);
211 \node (c) at (0.85,0.5) {\bfseries \Le@Principal};
212 \coordinate (\Le@Nom) at (c);
213 \ifKV@PresetTiC@circle\draw[\Couleur@Cercle,line width=\Ep@isseur] (c) circle[radius=\Le@Rayon];\fi
214 \ifthenelse{\boolean{TiCModeSeconde}} %
215 {\node[above] at (0.85,1) {\bfseries\sffamily\Mode@Seconde};} %
216 {}
217 \end{tikzpicture}}%
218 {\unskip%
219 \begin{tikzpicture}[x=0.5cm,y=0.5cm,remember picture]
220 \draw[fill=\Couleur@Touche, rounded corners=1.5pt] (0.85,1) -| ++(0.85,-0.5) |- ++(-0.85,-0.5) -| ++(-0.85,0.5) |- ++(0.3,0.5) -- cycle;
221 \node (c) at (0.85,0.5) {\bfseries \Le@Principal};
222 \coordinate (\Le@Nom) at (c);
223 \ifKV@PresetTiC@circle\draw[\Couleur@Cercle,line width=\Ep@isseur] (c) circle[radius=\Le@Rayon];\fi
224 \ifthenelse{\boolean{TiCModeSeconde}} %
225 {\node[above] at (0.85,1) {\bfseries\sffamily\Mode@Seconde};} %
226 {}
227 \end{tikzpicture}}}}%
228 {\unskip}
229 }%
230 %%-----------------------------
231 % Touche colorée pour les flèches
232 %%-----------------------------
233 \raisebox{\Hauteur@Touche}{
234 \ifthenelse{\boolean{TiCFleches}}%
235 {\unskip
236 \begin{tikzpicture}[x=0.5cm,y=0.5cm,remember picture]
237 \draw[fill=\Couleur@Touche] (0,1) -- ++(1,0) arc[start angle = 90, end angle = -90, radius = 1]
238 -- ++(-1,0) arc[start angle=270, end angle=90, radius = 1] -- cycle;
239 \draw[fill=\Couleur@Touche, scale=0.25] (0.5,1) -- ++(3,0) arc[start angle = 90, end angle = -90, radius = 1]
240 -- ++(-3,0) arc[start angle=270, end angle=90, radius = 1] -- cycle;
241 \fill[white] (0.5,0.75) -- ++(-60:0.3) -- ++(-0.3,0) -- cycle; %up
242 \fill[yscale=-1,white] (0.5,0.75) -- ++(-60:0.3) -- ++(-0.3,0) -- cycle; % down
243 \fill[white] (-0.75,0) -- ++(-30:0.3) -- ++(0,0.3) -- cycle; % left
244 \fill[white] (1.75,0) -- ++(150:0.3) -- ++(0,-0.3) -- cycle; % right
245 \coordinate (FLE) at (0.5,0);
246 \ifKV@PresetTiC@circle\draw[\Couleur@Cercle,line width=\Ep@isseur] (FLE) circle[radius=\Le@Rayon];\fi
247 \coordinate (FLH) at (0.5,0.6);
248 \coordinate (FLB) at (0.5,-0.6);
249 \coordinate (FLD) at (1.6,0);
250 \coordinate (FLG) at (-0.6,0);
251 \ifKV@PresetTiC@circledown\draw[\Couleur@Cercle,line width=\Ep@isseur] (FLB) circle (5pt);\fi
252 \ifKV@PresetTiC@circleleft\draw[\Couleur@Cercle,line width=\Ep@isseur] (FLG) circle (5pt);\fi
253 \ifKV@PresetTiC@circleup\draw[\Couleur@Cercle,line width=\Ep@isseur] (FLH) circle (5pt);\fi
254 \ifKV@PresetTiC@circleright\draw[\Couleur@Cercle,line width=\Ep@isseur] (FLD) circle (5pt);\fi
255 \end{tikzpicture}
256 }%
257 {\unskip}%
258 }%
259 }
260
261 %%-----------------------------
262 %------ CALCULATRICE ----------
263 %%-----------------------------
264
265 % options de la commande \Calculator*
266 \define@key{TiCalc}{calcscale}{\def\Calc@Echelle{#1}}
267 \define@key{TiCalc}{calcrotate}{\def\Calc@Rotation{#1}}
268 \define@key{TiCalc}{calcraise}{\def\Calc@Position{#1}}
269 % options de la commande \Calculator
270 \define@key{TiCalc}{colour calc}{\def\Couleur@Calc{#1}}
271 \define@key{TiCalc}{color calc}{\def\Couleur@Calc{#1}}
272 \define@key{TiCalc}{title}{\def\Titre@Calc{#1}}
273
274 % configurations par défaut pour \Calculatrice*
275 \presetkeys{TiCalc}{calcscale=0.5,calcrotate=-30,calcraise=-2ex, colour calc=TIOrange!50, title=TI-Collège}{}
276 %
277 %%-----------------------------
278 %-------- Grand format --------
279 %%-----------------------------
280 \newcommand{\Calculator@nostar}[1][]{
281 \setkeys{TiCalc}{#1}%
282 \begin{tikzpicture}[remember picture]
283 \renewcommand{\tabcolsep}{-3pt}
284 \node (tabcalc) at (0,0) {
285 \begin{tabular}{*{5}{c}}
286 \TiC[principal=2nde, colour key=TIJaune, colour text=black, name=scd] &
287 \TiC[principal=mode, second=quitter, name=mode] &
288 \TiC[principal=suppr, second=insérer, name=supp, position=1.1] &
289 \multicolumn{2}{c}{\multirow{3}{*}{\TiC[style=arrows, colour key=TIOrange, name=arrows]}} \\
290 %
291 \TiC[principal={$\boldsymbol{\frac{n}{d}}$}, second={$\boldsymbol{f \triangleleft\triangleright d}$}, fontsize=7pt, name=nd] &
292 \TiC[principal=stats, second=stats calc, name=stats] &
293 \TiC[principal={$\boldsymbol{f(x)}$}, second=expr, name=fx] & & \\
294 %
295 \TiC[principal={$\triangleright$ simp}, second={$\triangleright$ décomp}, name=simp, fontsize=5pt] &
296 \TiC[principal={$\times 10^n$}, second={$\frac1x$}, name=pdix] &
297 \TiC[principal=op, second=déf op, name=op, position=1.1] &
298 \TiC[principal=maths, second=système, name=math] &
299 \TiC[principal=annul, name=annul] \\
300 %
301 \TiC[principal={\large$\pi$}, second=angle, name=pi] &
302 \TiC[principal={\itshape sin}, second={\itshape arcsin}, name=sin] &
303 \TiC[principal={\itshape cos}, second={\itshape arccos}, name=cos] &
304 \TiC[principal={\itshape tan}, second={\itshape arctan}, name=tan] &
305 \TiC[principal=$\div$, second=\Div, colour key=TIOrange, name=div] \\
306 %
307 \TiC[principal={$x^n$}, second={\TiRacine[n]}, name=pow] &
308 \TiC[principal=\%, second={$\triangleright$ \%}, name=pcent] &
309 \TiC[principal={(}, second={$\triangleright a\, \cdot 10^n$}, name=PO] &
310 \TiC[principal={)}, second={$\triangleright$ norm}, name=PF] &
311 \TiC[principal=$\times$, colour key=TIOrange, name=times] \\
312 %
313 \TiC[principal={$x^2$}, second={\TiRacine}, name=sqr] &
314 \TiC[style=number, principal=7, rounded=left, colour key=white, colour text=black, name=T7] &
315 \TiC[style=number, principal=8, colour key=white, colour text=black, name=T8] &
316 \TiC[style=number, principal=9, rounded=right, colour key=white, colour text=black, name=T9] &
317 \TiC[principal=$-$, second=\ContrastDown, colour key=TIOrange, name=sub] \\
318 %
319 \TiC[principal={$x^{yzt}_{abc}$}, second={eff var}, name=var] &
320 \TiC[style=number, principal=4, rounded=left, colour key=white, colour text=black, name=T4] &
321 \TiC[style=number, principal=5, colour key=white, colour text=black, name=T5] &
322 \TiC[style=number, principal=6, rounded=right, colour key=white, colour text=black, name=T6] &
323 \TiC[principal=$+$, second=\ContrastUp, colour key=TIOrange, name=plus] \\
324 %
325 \TiC[principal={sto $\triangleright$}, second={rap var}, name=sto] &
326 \TiC[style=number, principal=1, rounded=left, colour key=white, colour text=black, name=T1] &
327 \TiC[style=number, principal=2, colour key=white, colour text=black, name=T2] &
328 \TiC[style=number, principal=3, rounded=right, colour key=white, colour text=black, name=T3] &
329 \TiC[principal=\Aff, colour key=TIOrange, name=aff] \\
330 %
331 \TiC[principal={on}, second={off}, name=on] &
332 \TiC[style=number, principal=0, second=réinit, rounded=left, colour key=white, colour text=black, name=T0] &
333 \TiC[style=number, principal={,}, fontsize=9pt, position=1.2, second={;}, colour key=white, colour text=black, name=virgule] &
334 \TiC[style=number, principal=(--), second=rép, rounded=right, colour key=white, colour text=black, name=minus] &
335 \TiC[principal=entrer, colour key=TIOrange, fontsize=5pt, name=entrer] \\
336 \end{tabular}%
337 };
338 % Ecran
339 \node (ecran) at ($(tabcalc.north west)+(0.2,0)$) [inner sep=0pt,rectangle,
340 minimum width=5.5cm,minimum height=2cm,anchor=south west] {};
341 \draw[fill=ForestGreen!15] ($(tabcalc.north west)+(0.2,0)$) rectangle ($(tabcalc.north east)+(-0.2,2)$);
342 % Corps de la calculatrice
343 \begin{scope}[on background layer]
344 \draw[fill=\Couleur@Calc, rounded corners=25pt]
345 ($(ecran.north) + (0.5,1.25)$) -|
346 ($(tabcalc.east) + (0.25,0)$) |-
347 ($(tabcalc.south) + (0,-0.25)$) -|
348 ($(tabcalc.west) + (-0.25,0)$) |-
349 ($(ecran.north) + (-0.5,1.25)$) -- cycle;
350 \node at ($(ecran.north) + (0,0.5)$) {{\Large\bfseries\sffamily \Titre@Calc}};
351 \end{scope}
352 \end{tikzpicture}
353 }
354
355 %%-----------------------------
356 %-------- Petit format --------
357 %%-----------------------------
358 \newcommand*{\Calculator@star}[1][]{%
359 \setkeys{TiCalc}{#1}%
360 \raisebox{\Calc@Position}{%
361 \begin{tikzpicture}[x=0.5cm,scale=\Calc@Echelle,rotate=\Calc@Rotation]
362 \draw[fill=black, rounded corners=3pt] (0,0) rectangle (2.1,1.5);
363 \draw[white,fill=white] (0.1,1.15) rectangle (2,1.4);
364 \fill[white] (1.55,0.9) ellipse[x radius=0.4, y radius=0.1];
365 \fill[white,rounded corners=2] (0.1,0.8) rectangle ++(0.4,0.2);
366 \fill[white,rounded corners=2] (0.6,0.8) rectangle ++(0.4,0.2);
367 %%
368 \fill[white,rounded corners=2] (0.1,0.45) rectangle ++(0.4,0.2);
369 \fill[white,rounded corners=2] (0.6,0.45) rectangle ++(0.4,0.2);
370 \fill[white,rounded corners=2] (1.1,0.45) rectangle ++(0.4,0.2);
371 \fill[white,rounded corners=2] (1.6,0.45) rectangle ++(0.4,0.2);
372 %%
373 \fill[white,rounded corners=2] (0.1,0.1) rectangle ++(0.4,0.2);
374 \fill[white,rounded corners=2] (0.6,0.1) rectangle ++(0.4,0.2);
375 \fill[white,rounded corners=2] (1.1,0.1) rectangle ++(0.4,0.2);
376 \fill[white,rounded corners=2] (1.6,0.1) rectangle ++(0.4,0.2);
377 %%
378 \end{tikzpicture}%
379 }
380 }
381
382 %%-----------------------------
383 %\TiCCalc = Grand format-
384 %\TiCCalc* = Petit format-
385 %%-----------------------------
386 \newcommand*\TiCCalc{\@ifstar{\Calculator@star}{\Calculator@nostar}}
387
388 %%-----------------------------
389 %------ ECRAN ------------------
390 %%-----------------------------
391
392
393 \newcounter{TiCLineCommand}
394 \setcounter{TiCLineCommand}{0}
395 \newcounter{TiCLineResult}
396 \setcounter{TiCLineResult}{0}
397
398 % Définition des keys
399 \define@key{TiCScreen}{color screen}{\def\Couleur@Ecran{#1}}
400 \define@key{TiCScreen}{colour screen}{\def\Couleur@Ecran{#1}}
401 \define@key{TiCScreen}{screenname}{\def\Nom@Ecran{#1}}
402 \define@key{TiCScreen}{width}{\def\L@ngueur{#1}}
403 \define@key{TiCScreen}{height}{\def\H@uteur{#1}}
404
405 % Configurations par défaut
406 \presetkeys{TiCScreen}{colour screen=ForestGreen!15,
407 screenname=ecran,
408 width=4, height=1}{}
409
410 % Commande \Ecran
411 \newcommand*\TiCScreen[2][]{%
412 \setcounter{TiCLineCommand}{0}
413 \setcounter{TiCLineResult}{0}
414 \setkeys{TiCScreen}{#1}
415 \begin{tikzpicture}[remember picture]
416 \node (\Nom@Ecran) at (0,0) [inner sep=0pt, draw, fill=\Couleur@Ecran, rectangle, minimum width=\L@ngueur cm,
417 minimum height=\H@uteur cm,anchor=south west] {};
418 \clip (0,0) rectangle (\L@ngueur,\H@uteur);
419 \foreach \command/\result in {#2}
420 {\ifx\command\empty {\addtocounter{TiCLineResult}{-1}\addtocounter{TiCLineCommand}{1}} \else
421 \node[anchor=north west] at ($(\[email protected] west)+(0,-\theTiCLineCommand/2)$) {\texttt{\command}};
422 \addtocounter{TiCLineCommand}{2}\fi
423 \ifx\result\empty {\addtocounter{TiCLineCommand}{-1}\addtocounter{TiCLineResult}{1}} \else
424 \node[anchor=north east] at ($(\[email protected] east)+(0,-0.5-\theTiCLineResult/2)$) {\texttt{\result}};
425 \addtocounter{TiCLineResult}{2}\fi}
426 \end{tikzpicture}
427 }
428
429 %%-----------------------------
430 %------ MENU ------------------
431 %%-----------------------------
432
433 % Définitions des options
434 \define@boolkey{TiCMenu}{select}[false]{}
435 \define@key{TiCMenu}{size}{\def\t@ille{#1}}
436 \define@key{TiCMenu}{text}{\def\@texte{#1}}
437 \define@key{TiCMenu}{colour box}{\def\Couleur@Boite{#1}}
438 \define@key{TiCMenu}{color box}{\def\Couleur@Boite{#1}}
439
440 % Valeurs par défaut
441 \presetkeys{TiCMenu}{select=false,text=\unskip,colour box=white}{size=15pt}
442
443 % Définition de la touche \Menu
444 \newcommand\TiC@Menu[2][]{
445 \setlength{\fboxsep}{0pt} \setlength{\fboxrule}{0.5pt}
446 \setkeys{TiCMenu}{#1}
447 \ifKV@TiCMenu@select \tikz[font=\ttfamily\bfseries]{\node (texte)
448 {\fontsize{\t@ille}{0}\selectfont\colorbox{black}{\color{white}\protect\uppercase{#2}}};\draw
449 (texte) node[right=10pt] {\fontsize{\t@ille}{0}\selectfont\@texte};} \else
450 \tikz[font=\ttfamily\bfseries]{\node (texte)
451 {\fontsize{\t@ille}{0}\selectfont\colorbox{\Couleur@Boite}{\color{black}\protect\uppercase{#2}}};\draw
452 (texte) node[right=10pt] {\fontsize{\t@ille}{0}\selectfont\@texte};} \fi }
453
454 \newcommand\TiCMenu[2][]{\TiC@Menu[#1]{#2}}