Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- \makeatletter
- % ========= DEF DES CLES PARAM FENETRES XCAS =========
- \define@key{paramwinxcas}{color}{\def\xcas@color{#1}} %couleur des traits
- \define@key{paramwinxcas}{larg}{\def\xcas@larg{#1}} %largeur de la fenêtre
- \define@key{paramwinxcas}{esplg}{\def\xcas@esplg{#1}} %espacement entre lignes
- \define@key{paramwinxcas}{premcol}{\def\xcas@premcol{#1}} %largeur encadré numéro
- \define@key{paramwinxcas}{hpremcol}{\def\xcas@hpremcol{#1}} %hauteur encadré numéro
- % ========= CLES PAR DEFAUT =========
- \setkeys{paramwinxcas}{larg=16,esplg=2pt,premcol=0.3,hpremcol=0.4,color=darkgray}
- % ========= COMMANDES DEF PARAM WINDOW XCAS =========
- \newcommand\paramxcas[1][]{%
- \setkeys{paramwinxcas}{#1}% on paramètres les nouvelles clés
- \def\larg{\xcas@larg}
- \def\esplg{\xcas@esplg}
- \def\premcol{\xcas@premcol}
- \def\hpremcol{\xcas@hpremcol}
- }
- % ========= DEF DES CLES PARAM LIGNES XCAS =========
- \define@key{paramlgxcas}{num}{\def\xcas@num{#1}} %numéro de la commande
- \define@key{paramlgxcas}{hc}{\def\xcas@hc{#1}} %hauteur de la ligne commande
- \define@key{paramlgxcas}{hr}{\def\xcas@hr{#1}} %hauteur de la ligne résultat
- % ========= CLES PAR DEFAUT =========
- \setkeys{paramlgxcas}{num=1,hc=0.75,hr=0.75}
- \newcommand{\lignexcasinit}[3][]{%
- \setkeys{paramlgxcas}{#1}% on paramètres les nouvelles clés
- \def\L{\xcas@num}
- \def\hle{\xcas@hc}
- \def\hlr{\xcas@hr}
- \coordinate (A01) at (0,0);
- \coordinate (A11) at ($(A01) + (0,{-\hle})$);
- \coordinate (A21) at ($(A11) + (0,{-\hlr})$);
- \coordinate (A31) at ($(A11) + ({\larg},0)$);
- \coordinate (A41) at ($(A21) + ({\larg},0)$);
- \draw[\xcas@color] (A01) rectangle (A31) ;
- \draw ($(A0\L) + (0,{-0.5*\hle})$) node[red,right,font=\large\sf] {#2} ;
- \draw[\xcas@color] (A11) rectangle (A41) node[midway,blue,font=\large\sf] {#3} ;
- \draw[\xcas@color] (A01) rectangle ++ ({-\premcol},{-\hpremcol}) node[\xcas@color,midway] {\small \sf \bfseries \L} ;
- \draw[\xcas@color,fill=\xcas@color!33] (A41) rectangle ++ (-0.75,0.25) node[black,midway] {\tiny \sf \bfseries MENU} ;
- }
- \newcommand{\lignexcas}[3][]{%
- \setkeys{paramlgxcas}{#1}% on paramètres les nouvelles clés
- \def\L{\xcas@num}
- \def\hle{\xcas@hc}
- \def\hlr{\xcas@hr}
- \FPeval{LA}{\L-1}
- \ifthenelse{\equal{\L}{1}}%si c'est la première ligne
- {\coordinate (A0\L) at (0,0);}%
- {\coordinate (A0\L) at ($(A2\LA) + (0,{-\esplg})$);}
- \coordinate (A1\L) at ($(A0\L) + (0,{-\hle})$);
- \coordinate (A2\L) at ($(A1\L) + (0,{-\hlr})$);
- \coordinate (A3\L) at ($(A1\L) + ({\larg},0)$);
- \coordinate (A4\L) at ($(A2\L) + ({\larg},0)$);
- \draw[\xcas@color] (A0\L) rectangle (A3\L) ;
- \draw ($(A0\L) + (0,{-0.5*\hle})$) node[red,right,font=\large\sf] {#2} ;
- \draw[\xcas@color] (A1\L) rectangle (A4\L) node[midway,blue,font=\large\sf] {#3} ;
- \draw[\xcas@color] (A0\L) rectangle ++ ({-\premcol},{-\hpremcol}) node[\xcas@color,midway] {\small \sf \bfseries \L} ;
- \draw[\xcas@color,fill=\xcas@color!33] (A4\L) rectangle ++ (-0.75,0.25) node[black,midway] {\tiny \sf \bfseries MENU} ;
- }
- \makeatother
- \begin{center}
- \begin{tikzpicture}[x=1cm,y=1cm,line width=1pt]
- \paramxcas[larg=16,esplg=2pt,color=purple]
- \lignexcas{Dérivée[(x+5)*exp(-0.1*x)]}{$\mathsf{\rightarrow (0.5-0.1*x)*exp(-0.1*x)}$}
- \lignexcas[num=2]{Dérivée[(x+5)*exp(-0.1*x)]}{$\mathsf{\rightarrow (0.5-0.1*x)*exp(-0.1*x)}$}
- \lignexcas[num=3,hc=1,hr=1]{Dérivée[(x+5)*exp(-0.1*x)]}{$\mathsf{\rightarrow (0.5-0.1*x)*exp(-0.1*x)}$}
- \lignexcas[num=4,hc=1.25,hr=1.5]{COMMANDE4}{RÉSULTAT4}
- \end{tikzpicture}
- \end{center}
- \begin{center}
- \begin{tikzpicture}[x=1cm,y=1cm,line width=1pt]
- \paramxcas[larg=13,esplg=0pt]
- \lignexcas{Dérivée[(x+5)*exp(-0.1*x)]}{$\mathsf{\rightarrow (0.5-0.1*x)*exp(-0.1*x)}$}
- \lignexcas[num=2]{Dérivée[(x+5)*exp(-0.1*x)]}{$\mathsf{\rightarrow (0.5-0.1*x)*exp(-0.1*x)}$}
- \lignexcas[num=3]{Dérivée[(x+5)*exp(-0.1*x)]}{$\mathsf{\rightarrow (0.5-0.1*x)*exp(-0.1*x)}$}
- \lignexcas[num=4]{COMMANDE4}{RÉSULTAT4}
- \end{tikzpicture}
- \end{center}
Add Comment
Please, Sign In to add comment