%---------------
%   Licence
%---------------
%This program can be redistributed and/or modified under the terms
%of the LaTeX Project Public License Distributed from CTAN archives
%in directory macros/latex/base/lppl.txt.


\def\fileversion{1.0}
\def\filedate{2015/02/15}
\def\fileauthor{Philippe DE SOUSA}
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{ticollege}[%
  \filedate\space v\fileversion\space
  LaTeX package by \fileauthor]
\RequirePackage[dvipsnames,table]{xcolor}
\RequirePackage[zerostyle=d]{newtxtt}
\@ifpackageloaded{tikz}{}{\RequirePackage{tikz}}
\usetikzlibrary{calc,shapes,arrows,shadows,backgrounds,babel}
\@ifpackageloaded{ifthen}{}{\RequirePackage{ifthen}}
\@ifpackageloaded{xkeyval}{}{\RequirePackage{xkeyval}}
\@ifpackageloaded{mathtools}{}{\RequirePackage{mathtools}}
\@ifpackageloaded{amssymb}{}{\RequirePackage{amssymb}}
\@ifpackageloaded{multido}{}{\RequirePackage{multido}}
\@ifpackageloaded{multirow}{}{\RequirePackage{multirow}}

%% 15 février 2015 : v1.0


%%-----------------------------
%--		Couleurs
%%-----------------------------
\definecolor{TIRouge}{RGB}{215,64,45}
\definecolor{TIOrange}{RGB}{239,148,69}
\definecolor{TIJaune}{RGB}{254,212,75}

%%-----------------------------
%--		Symboles particuliers
%%-----------------------------

% définition de la racine carrée
\newcommand*\TiRacine[1][]{$\sqrt[#1]{\phantom{x}}$}
% définition des dessins de contrast
\newcommand*{\ContrastUp}{
	\tikz{
		\draw[orange] (0,0) circle[radius = 0.2];
		\fill[orange] (0,0.2) arc[radius=0.2, start angle=90, end angle=-90] -- cycle;
		\fill[orange] (0.45,0) -- ++(150:0.2) -- ++(0,-0.2) -- cycle;
	}
}
\newcommand*{\ContrastDown}{
	\tikz{
		\draw[orange] (0,0) circle[radius = 0.2];
		\fill[orange] (0,0.2) arc[radius=0.2, start angle=90, end angle=-90] -- cycle;
		\fill[orange] (-0.45,0) -- ++(30:0.2) -- ++(0,-0.2) -- cycle;
	}
}
% définition du symbole aff
\newcommand*{\Aff}{
	\tikz[scale=0.7]{
		\draw (0,0) node[scale=0.7] {\scriptsize\textsf{aff}};
		\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];
		\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];
	}
}

% définition du symbole de la division posée
\newcommand*{\Div}{\tikz{\draw[thick] (0,0) -- (0,0.5) (0,0.35)--(0.2,0.35);}}


%%-----------------------------
%---	 Définitions auxiliaires + xkeyval
%%-----------------------------

% création de booléen pour tester les styles de touche
\newcommand*{\TiCDef@Bool}[1]{%
\newboolean{#1}
\setboolean{#1}{false}
}
\newcommand*{\TiCDefBool}[1]{\TiCDef@Bool{#1}}

\TiCDefBool{TiCChiffre}
\TiCDefBool{TiCGeneral}
\TiCDefBool{TiCFleches}
\TiCDefBool{TiCModeSeconde}
\TiCDefBool{ArrondiToucheGauche}
\TiCDefBool{ArrondiToucheDroit}
% pour entourer une touche :
\define@boolkey{PresetTiC}{circle}[false]{}
% pour entourer la touche de flèche
\define@boolkey{PresetTiC}{circleup}[false]{}
\define@boolkey{PresetTiC}{circleleft}[false]{}
\define@boolkey{PresetTiC}{circleright}[false]{}
\define@boolkey{PresetTiC}{circledown}[false]{}

% Définitions des styles disponibles
\define@choicekey{PresetTiC}{style}%
    {general, number, arrows}%
    {\ifthenelse{\equal{\string #1}{\string number}}%
                     {\setboolean{TiCChiffre}{true}}
                     {\setboolean{TiCChiffre}{false}}%
    \ifthenelse{\equal{\string #1}{\string general}}%
                     {\setboolean{TiCGeneral}{true}}
                     {\setboolean{TiCGeneral}{false}}%
    \ifthenelse{\equal{\string #1}{\string arrows}}%
                     {\setboolean{TiCFleches}{true}}
                     {\setboolean{TiCFleches}{false}}%
    }

% Définitions des touches arrondis
\define@choicekey{PresetTiC}{rounded}%
    {left, right, none}%
    {\ifthenelse{\equal{\string #1}{\string left}}%
        {\setboolean{ArrondiToucheGauche}{true}}
        {\setboolean{ArrondiToucheGauche}{false}}%
    \ifthenelse{\equal{\string #1}{\string right}}%
        {\setboolean{ArrondiToucheDroit}{true}}
        {\setboolean{ArrondiToucheDroit}{false}}%
    \ifthenelse{\equal{\string #1}{\string none}}%
        {\setboolean{ArrondiToucheDroit}{false}\setboolean{ArrondiToucheGauche}{false}}
        {\relax}%
    }

% Définitions des keys
% les couleurs
\define@key{PresetTiC}{color key}{\def\Couleur@Touche{#1}}
\define@key{PresetTiC}{colour key}{\def\Couleur@Touche{#1}}
\define@key{PresetTiC}{color text}{\def\Couleur@Texte{#1}}
\define@key{PresetTiC}{colour text}{\def\Couleur@Texte{#1}}
\define@key{PresetTiC}{color second}{\def\Couleur@Seconde{#1}}
\define@key{PresetTiC}{colour second}{\def\Couleur@Seconde{#1}}
\define@key{PresetTiC}{colour circle}{\def\Couleur@Cercle{#1}}
\define@key{PresetTiC}{color circle}{\def\Couleur@Cercle{#1}}
% taille du texte
\define@key{PresetTiC}{fontsize}{\def\Font@Size{#1}}
% hauteur de la touche
\define@key{PresetTiC}{raise}{\def\Hauteur@Touche{#1}}
% texte principal de la touche
\define@key{PresetTiC}{principal}{\def\Le@Principal{\fontsize{\Font@Size}{\Font@Size}\selectfont\color{\Couleur@Texte} #1}}
% position du texte principal à l'interieur de la touche
\define@key{PresetTiC}{position}{\def\La@Position{#1}}
% nom de la touche pour des utilisations dans tikzpicture
\define@key{PresetTiC}{name}{\def\Le@Nom{#1}}
% pour entourer une touche
\define@key{PresetTiC}{radius}{\def\Le@Rayon{#1}}
\define@key{PresetTiC}{thickness}{\def\Ep@isseur{#1}}
% texte secondaire
\define@key{PresetTiC}{second}{\ifthenelse{\equal{\string #1}{\string pasdeseconde}}%
                                        {\setboolean{TiCModeSeconde}{false}}%
                                        {\def\Mode@Seconde{\fontsize{\Font@Size}{\Font@Size}\selectfont\color{\Couleur@Seconde} #1}
                                            \setboolean{TiCModeSeconde}{true}}%
                            }

% configurations par défaut
\presetkeys{PresetTiC}{style=general, principal=sin, second=pasdeseconde,
                    position=0.9, raise=0ex, fontsize=6pt, name=NOM,
                    rounded=none, colour second=TIOrange, colour key=TIRouge, colour text=white,
                    circle=false, radius=20pt, colour circle=red, thickness=1pt,
                    circleup=false, circleleft=false, circledown=false, circleright=false}{}




%%-----------------------------
% commande \TiC dont la forme dépend du style choisi
%%-----------------------------

\newcommand*\TiC[1][]{%
\setkeys{PresetTiC}{#1}%
%%-----------------------------
% Touche colorée pour les fonctions
%%-----------------------------
\raisebox{\Hauteur@Touche}{
\ifthenelse{\boolean{TiCGeneral}}%
	{\unskip
	\begin{tikzpicture}[x=0.5cm,y=0.5cm,remember picture]
		\draw[fill=\Couleur@Touche] (0.35,1) -- ++(1,0) arc[start angle = 90, end angle = -90, x radius = 0.35, y radius = 0.5]
            -- ++(-1,0) arc[start angle=270, end angle=90, x radius = 0.35, y radius = 0.5] -- cycle;
		\path (0.85,1) -- (0.85,0.5) node[pos=\La@Position] (c) {\bfseries \Le@Principal};
            \coordinate (\Le@Nom) at (c);
        \ifKV@PresetTiC@circle\draw[\Couleur@Cercle,line width=\Ep@isseur] (c) circle[radius=\Le@Rayon];\fi
		\ifthenelse{\boolean{TiCModeSeconde}} %
			{\node[above] at (0.85,1) {\bfseries\sffamily\Mode@Seconde};} %
			{}
	\end{tikzpicture}
	}%
    {\unskip}%
}%
%%-----------------------------
% Touche colorée pour les chiffres
%%-----------------------------
\raisebox{\Hauteur@Touche}{
\ifthenelse{\boolean{TiCChiffre}}%
    {\ifthenelse{\boolean{ArrondiToucheGauche}}%
        {\unskip%
        \begin{tikzpicture}[x=0.5cm,y=0.5cm,remember picture]
        	\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);
        	\draw[fill=\Couleur@Touche,  rounded corners=1.5pt] (0.8,0) -| (1.7,0.5) |- ++(-0.3,0.5) -- (0.8,1);
        	\node (c) at (0.85,0.5) {\bfseries \Le@Principal};
                \coordinate (\Le@Nom) at (c);
            \ifKV@PresetTiC@circle\draw[\Couleur@Cercle,line width=\Ep@isseur] (c) circle[radius=\Le@Rayon];\fi
            \ifthenelse{\boolean{TiCModeSeconde}} %
    			{\node[above] at (0.85,1) {\bfseries\sffamily\Mode@Seconde};} %
    			{}
        \end{tikzpicture}}%
    {\ifthenelse{\boolean{ArrondiToucheDroit}}%
        {\unskip%
        \begin{tikzpicture}[x=0.5cm,y=0.5cm,remember picture]
        	\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);
        	\draw[fill=\Couleur@Touche,  rounded corners=1.5pt] (0.85,0) -| (0,0.5) |- ++(0.3,0.5) -- (0.85,1);
        	\node (c) at (0.85,0.5) {\bfseries \Le@Principal};
                \coordinate (\Le@Nom) at (c);
            \ifKV@PresetTiC@circle\draw[\Couleur@Cercle,line width=\Ep@isseur] (c) circle[radius=\Le@Rayon];\fi
            \ifthenelse{\boolean{TiCModeSeconde}} %
    			{\node[above] at (0.85,1) {\bfseries\sffamily\Mode@Seconde};} %
    			{}
        \end{tikzpicture}}%
        {\unskip%
            \begin{tikzpicture}[x=0.5cm,y=0.5cm,remember picture]
                \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;
                \node (c) at (0.85,0.5) {\bfseries \Le@Principal};
                    \coordinate (\Le@Nom) at (c);
                \ifKV@PresetTiC@circle\draw[\Couleur@Cercle,line width=\Ep@isseur] (c) circle[radius=\Le@Rayon];\fi
                \ifthenelse{\boolean{TiCModeSeconde}} %
    			{\node[above] at (0.85,1) {\bfseries\sffamily\Mode@Seconde};} %
    			{}
            \end{tikzpicture}}}}%
    {\unskip}
}%
%%-----------------------------
% Touche colorée pour les flèches
%%-----------------------------
\raisebox{\Hauteur@Touche}{
\ifthenelse{\boolean{TiCFleches}}%
	{\unskip
        \begin{tikzpicture}[x=0.5cm,y=0.5cm,remember picture]
        	\draw[fill=\Couleur@Touche] (0,1) -- ++(1,0) arc[start angle = 90, end angle = -90, radius = 1]
                -- ++(-1,0) arc[start angle=270, end angle=90, radius = 1] -- cycle;
        	\draw[fill=\Couleur@Touche, scale=0.25] (0.5,1) -- ++(3,0) arc[start angle = 90, end angle = -90, radius = 1]
                -- ++(-3,0) arc[start angle=270, end angle=90, radius = 1] -- cycle;
        	\fill[white] (0.5,0.75) -- ++(-60:0.3) -- ++(-0.3,0) -- cycle; %up
        	\fill[yscale=-1,white] (0.5,0.75) -- ++(-60:0.3) -- ++(-0.3,0) -- cycle; % down
        	\fill[white] (-0.75,0) -- ++(-30:0.3) -- ++(0,0.3) -- cycle; % left
        	\fill[white] (1.75,0) -- ++(150:0.3) -- ++(0,-0.3) -- cycle; % right
                \coordinate (FLE) at (0.5,0);
                \ifKV@PresetTiC@circle\draw[\Couleur@Cercle,line width=\Ep@isseur] (FLE) circle[radius=\Le@Rayon];\fi
                \coordinate (FLH) at (0.5,0.6);
                \coordinate (FLB) at (0.5,-0.6);
                \coordinate (FLD) at (1.6,0);
                \coordinate (FLG) at (-0.6,0);
                \ifKV@PresetTiC@circledown\draw[\Couleur@Cercle,line width=\Ep@isseur] (FLB) circle (5pt);\fi
                \ifKV@PresetTiC@circleleft\draw[\Couleur@Cercle,line width=\Ep@isseur] (FLG) circle (5pt);\fi
                \ifKV@PresetTiC@circleup\draw[\Couleur@Cercle,line width=\Ep@isseur] (FLH) circle (5pt);\fi
                \ifKV@PresetTiC@circleright\draw[\Couleur@Cercle,line width=\Ep@isseur] (FLD) circle (5pt);\fi
        \end{tikzpicture}
	}%
    {\unskip}%
}%
}

%%-----------------------------
%------ CALCULATRICE ----------
%%-----------------------------

% options de la commande \Calculator*
\define@key{TiCalc}{calcscale}{\def\Calc@Echelle{#1}}
\define@key{TiCalc}{calcrotate}{\def\Calc@Rotation{#1}}
\define@key{TiCalc}{calcraise}{\def\Calc@Position{#1}}
% options de la commande \Calculator
\define@key{TiCalc}{colour calc}{\def\Couleur@Calc{#1}}
\define@key{TiCalc}{color calc}{\def\Couleur@Calc{#1}}
\define@key{TiCalc}{title}{\def\Titre@Calc{#1}}

% configurations par défaut pour \Calculatrice*
\presetkeys{TiCalc}{calcscale=0.5,calcrotate=-30,calcraise=-2ex, colour calc=TIOrange!50, title=TI-Collège}{}
%
%%-----------------------------
%-------- Grand format --------
%%-----------------------------
\newcommand{\Calculator@nostar}[1][]{
\setkeys{TiCalc}{#1}%
\begin{tikzpicture}[remember picture]
    \renewcommand{\tabcolsep}{-3pt}
    \node (tabcalc) at (0,0) {
        \begin{tabular}{*{5}{c}}
            \TiC[principal=2nde, colour key=TIJaune, colour text=black, name=scd] &
            \TiC[principal=mode, second=quitter, name=mode] &
            \TiC[principal=suppr, second=insérer, name=supp, position=1.1] &
            \multicolumn{2}{c}{\multirow{3}{*}{\TiC[style=arrows, colour key=TIOrange, name=arrows]}} \\
        %
            \TiC[principal={$\boldsymbol{\frac{n}{d}}$}, second={$\boldsymbol{f \triangleleft\triangleright d}$}, fontsize=7pt, name=nd] &
            \TiC[principal=stats, second=stats calc, name=stats] &
            \TiC[principal={$\boldsymbol{f(x)}$}, second=expr, name=fx] & & \\
        %
            \TiC[principal={$\triangleright$ simp}, second={$\triangleright$ décomp}, name=simp, fontsize=5pt] &
            \TiC[principal={$\times 10^n$}, second={$\frac1x$}, name=pdix] &
            \TiC[principal=op, second=déf op, name=op, position=1.1] &
            \TiC[principal=maths, second=système, name=math] &
            \TiC[principal=annul, name=annul] \\
        %
            \TiC[principal={\large$\pi$}, second=angle, name=pi] &
            \TiC[principal={\itshape sin}, second={\itshape arcsin}, name=sin] &
            \TiC[principal={\itshape cos}, second={\itshape arccos}, name=cos] &
            \TiC[principal={\itshape tan}, second={\itshape arctan}, name=tan] &
            \TiC[principal=$\div$, second=\Div, colour key=TIOrange, name=div] \\
        %
            \TiC[principal={$x^n$}, second={\TiRacine[n]}, name=pow] &
            \TiC[principal=\%, second={$\triangleright$ \%}, name=pcent] &
            \TiC[principal={(}, second={$\triangleright a\, \cdot 10^n$}, name=PO] &
            \TiC[principal={)}, second={$\triangleright$ norm}, name=PF] &
            \TiC[principal=$\times$, colour key=TIOrange, name=times] \\
        %
            \TiC[principal={$x^2$}, second={\TiRacine}, name=sqr] &
            \TiC[style=number, principal=7, rounded=left, colour key=white, colour text=black, name=T7] &
            \TiC[style=number, principal=8, colour key=white, colour text=black, name=T8] &
            \TiC[style=number, principal=9, rounded=right, colour key=white, colour text=black, name=T9] &
            \TiC[principal=$-$, second=\ContrastDown, colour key=TIOrange, name=sub] \\
        %
            \TiC[principal={$x^{yzt}_{abc}$}, second={eff var}, name=var] &
            \TiC[style=number, principal=4, rounded=left, colour key=white, colour text=black, name=T4] &
            \TiC[style=number, principal=5, colour key=white, colour text=black, name=T5] &
            \TiC[style=number, principal=6, rounded=right, colour key=white, colour text=black, name=T6] &
            \TiC[principal=$+$, second=\ContrastUp, colour key=TIOrange, name=plus] \\
        %
            \TiC[principal={sto $\triangleright$}, second={rap var}, name=sto] &
            \TiC[style=number, principal=1, rounded=left, colour key=white, colour text=black, name=T1] &
            \TiC[style=number, principal=2, colour key=white, colour text=black, name=T2] &
            \TiC[style=number, principal=3, rounded=right, colour key=white, colour text=black, name=T3] &
            \TiC[principal=\Aff, colour key=TIOrange, name=aff] \\
        %
            \TiC[principal={on}, second={off}, name=on] &
            \TiC[style=number, principal=0, second=réinit, rounded=left, colour key=white, colour text=black, name=T0] &
            \TiC[style=number, principal={,}, fontsize=9pt, position=1.2, second={;}, colour key=white, colour text=black, name=virgule] &
            \TiC[style=number, principal=(--), second=rép, rounded=right, colour key=white, colour text=black, name=minus] &
            \TiC[principal=entrer, colour key=TIOrange, fontsize=5pt, name=entrer] \\
        \end{tabular}%
    };
    % Ecran
    \node (ecran) at ($(tabcalc.north west)+(0.2,0)$) [inner sep=0pt,rectangle,
        minimum width=5.5cm,minimum height=2cm,anchor=south west] {};
    \draw[fill=ForestGreen!15] ($(tabcalc.north west)+(0.2,0)$) rectangle ($(tabcalc.north east)+(-0.2,2)$);
    % Corps de la calculatrice
    \begin{scope}[on background layer]
        \draw[fill=\Couleur@Calc, rounded corners=25pt]
        ($(ecran.north) + (0.5,1.25)$) -|
            ($(tabcalc.east) + (0.25,0)$) |-
            ($(tabcalc.south) + (0,-0.25)$) -|
            ($(tabcalc.west) + (-0.25,0)$) |-
             ($(ecran.north) + (-0.5,1.25)$) -- cycle;
        \node at ($(ecran.north) + (0,0.5)$) {{\Large\bfseries\sffamily \Titre@Calc}};
    \end{scope}
\end{tikzpicture}
}

%%-----------------------------
%-------- Petit format --------
%%-----------------------------
\newcommand*{\Calculator@star}[1][]{%
\setkeys{TiCalc}{#1}%
\raisebox{\Calc@Position}{%
\begin{tikzpicture}[x=0.5cm,scale=\Calc@Echelle,rotate=\Calc@Rotation]
    \draw[fill=black, rounded corners=3pt] (0,0) rectangle (2.1,1.5);
    \draw[white,fill=white] (0.1,1.15) rectangle (2,1.4);
    \fill[white] (1.55,0.9) ellipse[x radius=0.4, y radius=0.1];
    \fill[white,rounded corners=2] (0.1,0.8) rectangle ++(0.4,0.2);
    \fill[white,rounded corners=2] (0.6,0.8) rectangle ++(0.4,0.2);
%%
    \fill[white,rounded corners=2] (0.1,0.45) rectangle ++(0.4,0.2);
    \fill[white,rounded corners=2] (0.6,0.45) rectangle ++(0.4,0.2);
    \fill[white,rounded corners=2] (1.1,0.45) rectangle ++(0.4,0.2);
    \fill[white,rounded corners=2] (1.6,0.45) rectangle ++(0.4,0.2);
%%
    \fill[white,rounded corners=2] (0.1,0.1) rectangle ++(0.4,0.2);
    \fill[white,rounded corners=2] (0.6,0.1) rectangle ++(0.4,0.2);
    \fill[white,rounded corners=2] (1.1,0.1) rectangle ++(0.4,0.2);
    \fill[white,rounded corners=2] (1.6,0.1) rectangle ++(0.4,0.2);
%%
\end{tikzpicture}%
}
}

%%-----------------------------
%\TiCCalc  = Grand format-
%\TiCCalc* = Petit format-
%%-----------------------------
\newcommand*\TiCCalc{\@ifstar{\Calculator@star}{\Calculator@nostar}}

%%-----------------------------
%------ ECRAN ------------------
%%-----------------------------


\newcounter{TiCLineCommand}
\setcounter{TiCLineCommand}{0}
\newcounter{TiCLineResult}
\setcounter{TiCLineResult}{0}

% Définition des keys
\define@key{TiCScreen}{color screen}{\def\Couleur@Ecran{#1}}
\define@key{TiCScreen}{colour screen}{\def\Couleur@Ecran{#1}}
\define@key{TiCScreen}{screenname}{\def\Nom@Ecran{#1}}
\define@key{TiCScreen}{width}{\def\L@ngueur{#1}}
\define@key{TiCScreen}{height}{\def\H@uteur{#1}}

% Configurations par défaut
\presetkeys{TiCScreen}{colour screen=ForestGreen!15,
                        screenname=ecran,
                        width=4, height=1}{}

% Commande \Ecran
\newcommand*\TiCScreen[2][]{%
\setcounter{TiCLineCommand}{0}
\setcounter{TiCLineResult}{0}
\setkeys{TiCScreen}{#1}
\begin{tikzpicture}[remember picture]
    \node (\Nom@Ecran) at (0,0) [inner sep=0pt, draw, fill=\Couleur@Ecran, rectangle, minimum width=\L@ngueur cm,
    minimum height=\H@uteur cm,anchor=south west] {};
    \clip (0,0) rectangle (\L@ngueur,\H@uteur);
    \foreach \command/\result in {#2}
    {\ifx\command\empty {\addtocounter{TiCLineResult}{-1}\addtocounter{TiCLineCommand}{1}} \else
    \node[anchor=north west] at ($(\Nom@Ecran.north west)+(0,-\theTiCLineCommand/2)$) {\texttt{\command}};
    \addtocounter{TiCLineCommand}{2}\fi
    \ifx\result\empty {\addtocounter{TiCLineCommand}{-1}\addtocounter{TiCLineResult}{1}} \else
    \node[anchor=north east] at ($(\Nom@Ecran.north east)+(0,-0.5-\theTiCLineResult/2)$) {\texttt{\result}};
    \addtocounter{TiCLineResult}{2}\fi}
\end{tikzpicture}
}

%%-----------------------------
%------ MENU ------------------
%%-----------------------------

% Définitions des options
\define@boolkey{TiCMenu}{select}[false]{}
\define@key{TiCMenu}{size}{\def\t@ille{#1}}
\define@key{TiCMenu}{text}{\def\@texte{#1}}
\define@key{TiCMenu}{colour box}{\def\Couleur@Boite{#1}}
\define@key{TiCMenu}{color box}{\def\Couleur@Boite{#1}}

% Valeurs par défaut
\presetkeys{TiCMenu}{select=false,text=\unskip,colour box=white}{size=15pt}

% Définition de la touche \Menu
\newcommand\TiC@Menu[2][]{
\setlength{\fboxsep}{0pt} \setlength{\fboxrule}{0.5pt}
\setkeys{TiCMenu}{#1}
\ifKV@TiCMenu@select \tikz[font=\ttfamily\bfseries]{\node (texte)
{\fontsize{\t@ille}{0}\selectfont\colorbox{black}{\color{white}\protect\uppercase{#2}}};\draw
(texte) node[right=10pt] {\fontsize{\t@ille}{0}\selectfont\@texte};} \else
\tikz[font=\ttfamily\bfseries]{\node (texte)
{\fontsize{\t@ille}{0}\selectfont\colorbox{\Couleur@Boite}{\color{black}\protect\uppercase{#2}}};\draw
(texte) node[right=10pt] {\fontsize{\t@ille}{0}\selectfont\@texte};} \fi }

\newcommand\TiCMenu[2][]{\TiC@Menu[#1]{#2}}
