texlive[58351] Master/texmf-dist: profcollege (14mar21)

commits+karl at tug.org commits+karl at tug.org
Sun Mar 14 23:52:07 CET 2021


Revision: 58351
          http://tug.org/svn/texlive?view=revision&revision=58351
Author:   karl
Date:     2021-03-14 23:52:07 +0100 (Sun, 14 Mar 2021)
Log Message:
-----------
profcollege (14mar21)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/profcollege/ProfCollege-doc.pdf
    trunk/Master/texmf-dist/doc/latex/profcollege/ProfCollege-doc.zip
    trunk/Master/texmf-dist/metapost/profcollege/PfC-Calculatrice.mp
    trunk/Master/texmf-dist/metapost/profcollege/PfC-Constantes.mp
    trunk/Master/texmf-dist/metapost/profcollege/PfC-LaTeX.mp
    trunk/Master/texmf-dist/metapost/profcollege/PfC-Svgnames.mp
    trunk/Master/texmf-dist/tex/latex/profcollege/ProfCollege.sty

Added Paths:
-----------
    trunk/Master/texmf-dist/metapost/profcollege/PfC-Afficheur.mp
    trunk/Master/texmf-dist/tex/latex/profcollege/PfC-EquationComposition2.tex
    trunk/Master/texmf-dist/tex/latex/profcollege/PfC-EquationSoustraction2.tex

Removed Paths:
-------------
    trunk/Master/texmf-dist/tex/latex/profcollege/PfC-EquationComposition1.tex
    trunk/Master/texmf-dist/tex/latex/profcollege/PfC-EquationSoustraction1.tex

Modified: trunk/Master/texmf-dist/doc/latex/profcollege/ProfCollege-doc.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/profcollege/ProfCollege-doc.zip
===================================================================
(Binary files differ)

Added: trunk/Master/texmf-dist/metapost/profcollege/PfC-Afficheur.mp
===================================================================
--- trunk/Master/texmf-dist/metapost/profcollege/PfC-Afficheur.mp	                        (rev 0)
+++ trunk/Master/texmf-dist/metapost/profcollege/PfC-Afficheur.mp	2021-03-14 22:52:07 UTC (rev 58351)
@@ -0,0 +1,182 @@
+u:=1cm;
+
+vardef Afficheur(expr nb,creux)=
+  pair Aa[];
+  Aa1=u*(-0.5,-1);
+  Aa2-Aa1=u*(1,0);
+  Aa4-Aa2=u*(0,2);
+  Aa3=1/2[Aa2,Aa4];
+  Aa5-Aa4=Aa1-Aa2;
+  Aa6-Aa3=Aa1-Aa2;
+  pair Bb[];
+  Bb1=Aa1 xscaled0.7 yscaled 0.85;
+  Bb2=Aa2 xscaled0.7 yscaled 0.85;
+  Bb4=Aa4 xscaled0.7 yscaled 0.85;
+  Bb5=Aa5 xscaled0.7 yscaled 0.85;
+  Bb3=1/2[Bb2,Bb4];
+  Bb6=1/2[Bb1,Bb5];
+  Bb7=1/2[Bb6,Bb3]+(0,4);
+  Bb8=1/2[Bb6,Bb3]-(0,6);
+  pair Cc[];
+  Cc1=u*(0.4,-0.85)+(0,-1);
+  ecarth:=1.5;
+  ecartv:=0.05;
+  path ASegment[];
+  ASegment[1]=1/10[Bb1,Bb2]--9/10[Bb1,Bb2];
+  ASegment[2]=1/10[Bb2,Bb3]--9/10[Bb2,Bb3];
+  ASegment[3]=1/10[Bb3,Bb4]--9/10[Bb3,Bb4];
+  ASegment[4]=1/10[Bb4,Bb5]--9/10[Bb4,Bb5];
+  ASegment[5]=1/10[Bb5,Bb6]--9/10[Bb5,Bb6];
+  ASegment[6]=1/10[Bb6,Bb1]--9/10[Bb6,Bb1];
+  ASegment[7]=1/10[Bb6,Bb3]--9/10[Bb6,Bb3];
+  color fondsegment;
+  fondsegment=0.2[LightSteelBlue,white];
+  save $;
+  picture $;
+  $=image(
+      fill Aa1--Aa2--Aa4--Aa5--cycle withcolor LightSteelBlue;
+    draw Aa1--Aa2--Aa4--Aa5--cycle withcolor LightSteelBlue;
+    if creux=0:
+      fill (unitsquare scaled 2) shifted Cc1 withcolor fondsegment;
+    else:
+      fill (unitsquare scaled 2) shifted Cc1 withcolor Crimson;
+    fi;
+    if nb=1:
+      drawoptions(withpen pensquare scaled2 withcolor Crimson);
+      draw ASegment[2];
+      draw ASegment[3];
+      drawoptions(withpen pensquare scaled2 withcolor fondsegment);
+      draw ASegment[1];
+      draw ASegment[4];
+      draw ASegment[5];
+      draw ASegment[6];
+      draw ASegment[7];
+      drawoptions();
+    fi;
+    if nb=2:
+      drawoptions(withpen pensquare scaled2 withcolor Crimson);
+      draw ASegment[1];
+      draw ASegment[3];
+      draw ASegment[4];
+      draw ASegment[6];
+      draw ASegment[7];
+      drawoptions(withpen pensquare scaled2 withcolor fondsegment);
+      draw ASegment[2];
+      draw ASegment[5];
+      drawoptions();
+    fi;
+    if nb=3:
+      drawoptions(withpen pensquare scaled2 withcolor Crimson);
+      draw ASegment[1];
+      draw ASegment[2];
+      draw ASegment[3];
+      draw ASegment[4];
+      draw ASegment[7];
+      drawoptions(withpen pensquare scaled2 withcolor fondsegment);
+      draw ASegment[5];
+      draw ASegment[6];
+      drawoptions();
+    fi;
+    if nb=4:
+      drawoptions(withpen pensquare scaled2 withcolor Crimson);
+      draw ASegment[2];
+      draw ASegment[3];
+      draw ASegment[5];
+      draw ASegment[7];
+      drawoptions(withpen pensquare scaled2 withcolor fondsegment);
+      draw ASegment[1];
+      draw ASegment[4];
+      draw ASegment[6];
+      drawoptions();
+    fi;
+    if nb=5:
+      drawoptions(withpen pensquare scaled2 withcolor Crimson);
+      draw ASegment[1];
+      draw ASegment[2];
+      draw ASegment[4];
+      draw ASegment[5];
+      draw ASegment[7];
+      drawoptions(withpen pensquare scaled2 withcolor fondsegment);
+      draw ASegment[3];
+      draw ASegment[6];
+      drawoptions();
+    fi;
+    if nb=6:
+      drawoptions(withpen pensquare scaled2 withcolor Crimson);
+      draw ASegment[1];
+      draw ASegment[2];
+      draw ASegment[4];
+      draw ASegment[5];
+      draw ASegment[6];
+      draw ASegment[7];
+      drawoptions(withpen pensquare scaled2 withcolor fondsegment);
+      draw ASegment[3];
+      drawoptions();
+    fi;
+    if nb=7:
+      drawoptions(withpen pensquare scaled2 withcolor Crimson);
+      draw ASegment[2];
+      draw ASegment[3];
+      draw ASegment[4];
+      drawoptions(withpen pensquare scaled2 withcolor fondsegment);
+      draw ASegment[1];
+      draw ASegment[5];
+      draw ASegment[6];
+      draw ASegment[7];
+      drawoptions();
+    fi;
+    if nb=8:
+      drawoptions(withpen pensquare scaled2 withcolor Crimson);
+      draw ASegment[1];
+      draw ASegment[2];
+      draw ASegment[3];
+      draw ASegment[4];
+      draw ASegment[5];
+      draw ASegment[6];
+      draw ASegment[7];
+      drawoptions();
+    fi;
+    if nb=9:
+      drawoptions(withpen pensquare scaled2 withcolor Crimson);
+      draw ASegment[1];
+      draw ASegment[2];
+      draw ASegment[3];
+      draw ASegment[4];
+      draw ASegment[5];
+      draw ASegment[7];
+      drawoptions(withpen pensquare scaled2 withcolor fondsegment);
+      draw ASegment[6];
+      drawoptions();
+    fi;
+    if nb=0:
+      drawoptions(withpen pensquare scaled2 withcolor Crimson);
+      draw ASegment[1];
+      draw ASegment[2];
+      draw ASegment[3];
+      draw ASegment[4];
+      draw ASegment[5];
+      draw ASegment[6];
+      drawoptions(withpen pensquare scaled2 withcolor fondsegment);
+      draw ASegment[7];
+      drawoptions();
+    fi;
+    if nb=10:
+      drawoptions(withpen pensquare scaled2 withcolor Crimson);
+      fill (unitsquare scaled 2) shifted Bb7 withcolor Crimson;
+      fill (unitsquare scaled 2) shifted Bb8 withcolor Crimson;
+      drawoptions(withpen pensquare scaled2 withcolor fondsegment);
+      draw ASegment[1];
+      draw ASegment[2];
+      draw ASegment[3];
+      draw ASegment[4];
+      draw ASegment[5];
+      draw ASegment[6];
+      draw ASegment[7];
+      drawoptions();
+    fi;
+    );
+  $
+enddef;
+
+endinput;
+  


Property changes on: trunk/Master/texmf-dist/metapost/profcollege/PfC-Afficheur.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/texmf-dist/metapost/profcollege/PfC-Calculatrice.mp
===================================================================
--- trunk/Master/texmf-dist/metapost/profcollege/PfC-Calculatrice.mp	2021-03-14 22:51:48 UTC (rev 58350)
+++ trunk/Master/texmf-dist/metapost/profcollege/PfC-Calculatrice.mp	2021-03-14 22:52:07 UTC (rev 58351)
@@ -1,6 +1,3 @@
-%Author : Christophe Poulain
-%Licence    : Released under the LaTeX Project Public License v1.3c
-% or later, see http://www.latex-project.org/lppl.txtf
 prologues:=3;
 
 path carre[];
@@ -174,7 +171,7 @@
     fi;
 enddef;
 
-vardef LCD(text nt)(text rep)=
+vardef LCD(text nt)(text rep)(expr NB)=
   decahoriz:=0;
   nblignes:=nblignes+1;
   path Ecran;
@@ -185,6 +182,12 @@
     BlocAffichage;
     Test(k,nt);
   endfor;
+  for k=1 upto NB:
+    nblignes:=nblignes+1;
+    Ecran:=(u*(0,-1)--u*(120,-1)--u*(120,7)--u*(0,7)--cycle) shifted(u*(0,-8*(nblignes-1)));
+    fill Ecran withcolor if print=true:0.8white else:CouleurEcran fi;
+    draw Ecran withcolor if print=true:0.8white else:CouleurEcran fi;
+  endfor;
   nblignes:=nblignes+1;
   Ecran:=(u*(0,-1)--u*(120,-1)--u*(120,7)--u*(0,7)--cycle) shifted(u*(0,-8*(nblignes-1)));
   fill Ecran withcolor if print=true:0.8white else:CouleurEcran fi;

Modified: trunk/Master/texmf-dist/metapost/profcollege/PfC-Constantes.mp
===================================================================
--- trunk/Master/texmf-dist/metapost/profcollege/PfC-Constantes.mp	2021-03-14 22:51:48 UTC (rev 58350)
+++ trunk/Master/texmf-dist/metapost/profcollege/PfC-Constantes.mp	2021-03-14 22:52:07 UTC (rev 58351)
@@ -1,6 +1,3 @@
-%Author : Christophe Poulain
-%Licence    : Released under the LaTeX Project Public License v1.3c
-% or later, see http://www.latex-project.org/lppl.txtf
 %Constantes
 u:=1cm;
 v:=(sqrt3)/2;

Modified: trunk/Master/texmf-dist/metapost/profcollege/PfC-LaTeX.mp
===================================================================
--- trunk/Master/texmf-dist/metapost/profcollege/PfC-LaTeX.mp	2021-03-14 22:51:48 UTC (rev 58350)
+++ trunk/Master/texmf-dist/metapost/profcollege/PfC-LaTeX.mp	2021-03-14 22:52:07 UTC (rev 58351)
@@ -1,16 +1,11 @@
-%Author : Christophe Poulain
-%Licence    : Released under the LaTeX Project Public License v1.3c
-% or later, see http://www.latex-project.org/lppl.txtf
 vardef LATEX primary s =
   write "verbatimtex" to "mptextmp.mp";
   write "%&latex" to "mptextmp.mp";
   write "\documentclass[]{article}" to "mptextmp.mp";
+  write "\usepackage{ProfCollege}" to "mptextmp.mp";
   write "\usepackage[utf8]{inputenc}" to "mptextmp.mp";
   write "\usepackage[T1]{fontenc}" to "mptextmp.mp";
   write "\usepackage{fourier}" to "mptextmp.mp";
-  write "\usepackage{mathtools,amssymb}" to "mptextmp.mp";
-  write "\usepackage{siunitx}" to "mptextmp.mp";
-  write "\sisetup{locale=FR,detect-all,output-decimal-marker={,},group-four-digits}" to "mptextmp.mp";
   write "\usepackage[french]{babel}" to "mptextmp.mp";
   write "\begin{document}" to "mptextmp.mp";
   write "etex" to "mptextmp.mp";

Modified: trunk/Master/texmf-dist/metapost/profcollege/PfC-Svgnames.mp
===================================================================
--- trunk/Master/texmf-dist/metapost/profcollege/PfC-Svgnames.mp	2021-03-14 22:51:48 UTC (rev 58350)
+++ trunk/Master/texmf-dist/metapost/profcollege/PfC-Svgnames.mp	2021-03-14 22:52:07 UTC (rev 58351)
@@ -1,6 +1,3 @@
-%Author : Christophe Poulain
-%Licence    : Released under the LaTeX Project Public License v1.3c
-% or later, see http://www.latex-project.org/lppl.txtf
 %D'après /usr/local/texlive/2020/texmf-dist/tex/latex/xcolor/svgnam.def
 color AliceBlue; AliceBlue = (.94,.972,1);
 color AntiqueWhite; AntiqueWhite = (.98,.92,.844);

Deleted: trunk/Master/texmf-dist/tex/latex/profcollege/PfC-EquationComposition1.tex
===================================================================
--- trunk/Master/texmf-dist/tex/latex/profcollege/PfC-EquationComposition1.tex	2021-03-14 22:51:48 UTC (rev 58350)
+++ trunk/Master/texmf-dist/tex/latex/profcollege/PfC-EquationComposition1.tex	2021-03-14 22:52:07 UTC (rev 58351)
@@ -1,277 +0,0 @@
-% Licence    : Released under the LaTeX Project Public License v1.3c
-% or later, see http://www.latex-project.org/lppl.txtf
-\newcommand{\EquaDeuxComposition}[5][]{%type ax+b=d ou b=cx+d$
-  \useKVdefault[ClesEquation]%
-  \setKV[ClesEquation]{#1}%
-  \ifx\bla#2\bla%On échange en faisant attention à ne pas boucler : c doit être non vide
-    \EquaDeuxComposition[#1]{#4}{#5}{#2}{#3}
-  \else%cas ax+b=d
-    \xintifboolexpr{#2=0}{%
-      \xintifboolexpr{#3=#5}{%b=d
-        L'équation $\num{#3}=\num{#5}$ a une infinité de solution.}%
-      {%b<>d
-        L'équation $\num{#3}=\num{#5}$ n'a aucune solution.%
-      }%
-    }{%ELSE
-      \xintifboolexpr{#3=0}{%ax+b=d
-        \EquaBase[#1]{#2}{}{}{#5}%
-      }{%ax+b=d$ Ici
-        \ifboolKV[ClesEquation]{Decomposition}{\colorlet{Ccompo}{\useKV[ClesEquation]{CouleurCompo}}}{}
-        \begin{align*}
-          \tikzmark{A-\theNbequa}\xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}&=\mathcolor{Ccompo}{\num{#5}}\tikzmark{E-\theNbequa}\\
-          \xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}&=\mathcolor{Ccompo}{\num{\fpeval{#5-#3}}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}}\\
-          \tikzmark{C-\theNbequa}\xdef\Coeffa{#2}\xdef\Coeffb{\fpeval{#5-#3}}\xintifboolexpr{\Coeffa=1}{}{\num{\Coeffa}}\useKV[ClesEquation]{Lettre}&=\num{\Coeffb}\tikzmark{G-\theNbequa}%\\
-          \xintifboolexpr{\Coeffa=1}{}{\\}
-          \ifboolKV[ClesEquation]{Fleches}{%
-          \leftcomment{A-\theNbequa}{C-\theNbequa}{A-\theNbequa}{$\xintifboolexpr{#3>0}{-\num{#3}}{+\num{\fpeval{0-#3}}}$}%
-          \rightcomment{E-\theNbequa}{G-\theNbequa}{E-\theNbequa}{$\xintifboolexpr{#3>0}{-\num{#3}}{+\num{\fpeval{0-#3}}}$}%
-          }{}
-          \xintifboolexpr{\Coeffa=1}{% 
-          }{%\ifnum\cmtd>1
-          \tikzmark{D-\theNbequa}\useKV[ClesEquation]{Lettre}&=\frac{\num{\Coeffb}}{\num{\Coeffa}}\tikzmark{H-\theNbequa}%\\
-          \ifboolKV[ClesEquation]{Fleches}{%
-          \leftcomment{C-\theNbequa}{D-\theNbequa}{A-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%
-          \rightcomment{G-\theNbequa}{H-\theNbequa}{E-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%
-          }{%ICI ?
-          \ifboolKV[ClesEquation]{FlecheDiv}{%
-          \leftcomment{C-\theNbequa}{D-\theNbequa}{A-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%
-          \rightcomment{G-\theNbequa}{H-\theNbequa}{E-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%
-          }{}
-          }
-          }
-          \ifboolKV[ClesEquation]{Entier}{%
-          \SSimpliTest{\Coeffb}{\Coeffa}%
-          \ifboolKV[ClesEquation]{Simplification}{%
-          \ifthenelse{\boolean{Simplification}}{\\\useKV[ClesEquation]{Lettre}&=\SSimplifie{\Coeffb}{\Coeffa}}{}%\\
-          }{}
-          }{}
-          \ifboolKV[ClesEquation]{Fleches}{\stepcounter{Nbequa}}{\ifboolKV[ClesEquation]{FlecheDiv}{\stepcounter{Nbequa}}{}}
-        \end{align*}
-        \ifboolKV[ClesEquation]{Solution}{L'équation $\xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}=\num{#5}$ a une unique solution : \opdiv*{\Coeffb}{\Coeffa}{solution}{resteequa}\opcmp{resteequa}{0}$\useKV[ClesEquation]{Lettre}=\displaystyle\ifopeq\opexport{solution}{\solution}\num{\solution}\else\ifboolKV[ClesEquation]{Entier}{\SSimplifie{\Coeffb}{\Coeffa}}{\frac{\num{\Coeffb}}{\num{\Coeffa}}}\fi$.
-        }{}
-      }
-    }
-  \fi
-}
-
-\newcommand{\EquaTroisComposition}[5][]{%ax+b=cx ou ax=cx+d
-  \useKVdefault[ClesEquation]%
-  \setKV[ClesEquation]{#1}%
-  \ifx\bla#3\bla%on inverse en faisant attention à la boucle #3<->#5
-    \ifx\bla#5\bla%
-      %% paramètre oublié
-    \else
-      \EquaTroisComposition[#1]{#4}{#5}{#2}{}%
-    \fi
-  \else
-  \xintifboolexpr{#2=0}{%b=cx
-    \EquaBase[#1]{#4}{}{}{#3}
-  }{%
-    \xintifboolexpr{#4=0}{%ax+b=0
-      \EquaDeuxComposition[#1]{#2}{#3}{}{0}
-      }{%ax+b=cx
-        \xintifboolexpr{#2=#4}{%
-          \xintifboolexpr{#3=0}{%ax=ax
-            L'équation $\xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}=\xintifboolexpr{#4=1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}$ a une infinité de solution.}%
-          {%ax+b=ax
-            L'équation $\xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}=\xintifboolexpr{#4=1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}$ n'a aucune solution.%
-          }%
-        }{%% Cas délicat
-          \xintifboolexpr{#2>#4}{%ax+b=cx avec a>c
-            \ifboolKV[ClesEquation]{Decomposition}{\colorlet{Ccompo}{\useKV[ClesEquation]{CouleurCompo}}}{}
-            \begin{align*}
-              \tikzmark{A-\theNbequa}\mathcolor{Ccompo}{\xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}&=\xintifboolexpr{#4=1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}\tikzmark{E-\theNbequa}\\
-               \mathcolor{Ccompo}{\num{\fpeval{#2-#4}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#4>0}{+\num{#4}\useKV[ClesEquation]{Lettre}}{-\num{\fpeval{0-#4}}\useKV[ClesEquation]{Lettre}}}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}&=\xintifboolexpr{#4=1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}\\
-                \tikzmark{B-\theNbequa}\xdef\Coeffa{\fpeval{#2-#4}}\xintifboolexpr{\Coeffa=1}{}{\num{\Coeffa}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}&=\mathcolor{Ccompo}{0}\tikzmark{F-\theNbequa}\\
-              \xintifboolexpr{\Coeffa=1}{}{\num{\Coeffa}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}&=\mathcolor{Ccompo}{\num{\fpeval{0-#3}}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}}\tikzmark{F-\theNbequa}\\
-              \tikzmark{C-\theNbequa}\xdef\Coeffb{\fpeval{0-#3}}\xintifboolexpr{\Coeffa=1}{}{\num{\Coeffa}}\useKV[ClesEquation]{Lettre}&=\num{\Coeffb}\tikzmark{G-\theNbequa}%\\
-                \xintifboolexpr{\Coeffa=1}{}{\\}
-                \ifboolKV[ClesEquation]{Fleches}{%
-                \leftcomment{A-\theNbequa}{B-\theNbequa}{A-\theNbequa}{$\xintifboolexpr{#4>0}{-\num{#4}}{+\num{\fpeval{0-#4}}}\useKV[ClesEquation]{Lettre}$}
-                \rightcomment{E-\theNbequa}{F-\theNbequa}{E-\theNbequa}{$\xintifboolexpr{#4>0}{-\num{#4}}{+\num{\fpeval{0-#4}}}\useKV[ClesEquation]{Lettre}$}
-                \leftcomment{B-\theNbequa}{C-\theNbequa}{A-\theNbequa}{$\xintifboolexpr{#3>0}{-\num{#3}}{+\num{\fpeval{0-#3}}}$}%
-                \rightcomment{F-\theNbequa}{G-\theNbequa}{E-\theNbequa}{$\xintifboolexpr{#3>0}{-\num{#3}}{+\num{\fpeval{0-#3}}}$}%
-                }{}
-                \xintifboolexpr{\Coeffa=1}{}{%\ifnum\cmtd>1
-                \tikzmark{D-\theNbequa}\useKV[ClesEquation]{Lettre}&=\frac{\num{\Coeffb}}{\num{\Coeffa}}\tikzmark{H-\theNbequa}%\\
-                \ifboolKV[ClesEquation]{Fleches}{%
-                \leftcomment{C-\theNbequa}{D-\theNbequa}{A-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%
-                \rightcomment{G-\theNbequa}{H-\theNbequa}{E-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%            
-                }{
-                \ifboolKV[ClesEquation]{FlecheDiv}{%
-                \leftcomment{C-\theNbequa}{D-\theNbequa}{A-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%
-                \rightcomment{G-\theNbequa}{H-\theNbequa}{E-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%                 
-                }{}
-                }
-                \ifboolKV[ClesEquation]{Entier}{%
-                \SSimpliTest{\Coeffb}{\Coeffa}%
-                \ifboolKV[ClesEquation]{Simplification}{%
-                \ifthenelse{\boolean{Simplification}}{\\\useKV[ClesEquation]{Lettre}&=\SSimplifie{\Coeffb}{\Coeffa}}{}%\\
-                }{}
-                }{}
-                }
-                \ifboolKV[ClesEquation]{Fleches}{\stepcounter{Nbequa}}{\ifboolKV[ClesEquation]{FlecheDiv}{\stepcounter{Nbequa}}{}}
-              \end{align*}
-              \ifboolKV[ClesEquation]{Solution}{L'équation $\xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}=\xintifboolexpr{#4=1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}$ a une unique solution : \opdiv*{\Coeffb}{\Coeffa}{solution}{resteequa}\opcmp{resteequa}{0}$\useKV[ClesEquation]{Lettre}=\displaystyle\ifopeq\opexport{solution}{\solution}\num{\solution}\else\ifboolKV[ClesEquation]{Entier}{\SSimplifie{\Coeffb}{\Coeffa}}{\frac{\num{\Coeffb}}{\num{\Coeffa}}}\fi$.}{}
-            }{%ax+b=cx+d avec a<c              % Autre cas délicat
-              \ifboolKV[ClesEquation]{Decomposition}{\colorlet{Ccompo}{\useKV[ClesEquation]{CouleurCompo}}}{}
-              \begin{align*}%
-                \tikzmark{A-\theNbequa}\xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}&=\mathcolor{Ccompo}{\xintifboolexpr{#4=1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}}\tikzmark{E-\theNbequa}\\
-                \xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}&=\mathcolor{Ccompo}{\num{\fpeval{#4-#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#2>0}{+\num{#2}\useKV[ClesEquation]{Lettre}}{-\num{\fpeval{0-#2}}\useKV[ClesEquation]{Lettre}}}\\
-                \tikzmark{B-\theNbequa}\xdef\Coeffb{#3}\xdef\Coeffa{\fpeval{#4-#2}}\xintifboolexpr{#3>0}{\num{#3}}{-\num{\fpeval{0-#3}}}&=\xintifboolexpr{\Coeffa=1}{}{\num{\Coeffa}}\useKV[ClesEquation]{Lettre}\tikzmark{F-\theNbequa}
-                \xintifboolexpr{\Coeffa=1}{}{\\}
-                \ifboolKV[ClesEquation]{Fleches}{%
-                \leftcomment{A-\theNbequa}{B-\theNbequa}{A-\theNbequa}{$\xintifboolexpr{#2>0}{-\num{#2}}{+\num{\fpeval{0-#2}}}\useKV[ClesEquation]{Lettre}$}
-                \rightcomment{E-\theNbequa}{F-\theNbequa}{E-\theNbequa}{$\xintifboolexpr{#2>0}{-\num{#2}}{+\num{\fpeval{0-#2}}}\useKV[ClesEquation]{Lettre}$}
-                }{}
-                \xintifboolexpr{\Coeffa=1}{}{%\ifnum\cmtd>1
-                \tikzmark{D-\theNbequa}\frac{\num{\Coeffb}}{\num{\Coeffa}}&=\useKV[ClesEquation]{Lettre}\tikzmark{H-\theNbequa}%\\
-                \ifboolKV[ClesEquation]{Fleches}{%
-                \leftcomment{B-\theNbequa}{D-\theNbequa}{A-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%
-                \rightcomment{F-\theNbequa}{H-\theNbequa}{E-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%            
-                }{
-                \ifboolKV[ClesEquation]{FlecheDiv}{%
-                \leftcomment{B-\theNbequa}{D-\theNbequa}{A-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%
-                \rightcomment{F-\theNbequa}{H-\theNbequa}{E-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%                 
-                }{}
-                }
-                \ifboolKV[ClesEquation]{Entier}{%
-                \SSimpliTest{\Coeffb}{\Coeffa}%
-                \ifboolKV[ClesEquation]{Simplification}{%
-                \ifthenelse{\boolean{Simplification}}{\\\SSimplifie{\Coeffb}{\Coeffa}&=\useKV[ClesEquation]{Lettre}}{}%\\
-                }{}
-                }{}
-                }
-                \ifboolKV[ClesEquation]{Fleches}{\stepcounter{Nbequa}}{\ifboolKV[ClesEquation]{FlecheDiv}{\stepcounter{Nbequa}}{}}
-              \end{align*}
-              \ifboolKV[ClesEquation]{Solution}{L'équation $\xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}=\xintifboolexpr{#4=1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}$ a une unique solution : \opdiv*{\Coeffb}{\Coeffa}{solution}{resteequa}\opcmp{resteequa}{0}$\useKV[ClesEquation]{Lettre}=\displaystyle\ifopeq\opexport{solution}{\solution}\num{\solution}\else\ifboolKV[ClesEquation]{Entier}{\SSimplifie{\Coeffb}{\Coeffa}}{\frac{\num{\Coeffb}}{\num{\Coeffa}}}\fi$.}{}%
-            }%
-          }%
-        }%
-      }%
-    \fi
-  }%
-
-
-\newcommand{\ResolEquationComposition}[5][]{%
-  \useKVdefault[ClesEquation]%
-  \setKV[ClesEquation]{#1}%
-  \xintifboolexpr{#2=0}{%
-    \xintifboolexpr{#4=0}{%
-      \xintifboolexpr{#3=#5}{%b=d
-        L'équation $\num{#3}=\num{#5}$ a une infinité de solution.}%
-      {%b<>d
-        L'équation $\num{#3}=\num{#5}$ n'a aucune solution.%
-      }%
-    }%
-    {%0x+b=cx+d$
-      \EquaDeuxComposition[#1]{#4}{#5}{#2}{#3}%
-    }%
-  }{%
-    \xintifboolexpr{#4=0}{%ax+b=0x+d
-      \EquaDeuxComposition[#1]{#2}{#3}{}{#5}%
-    }
-    {%ax+b=cx+d$
-      \xintifboolexpr{#3=0}{%
-        \xintifboolexpr{#5=0}{%ax=cx
-          \EquaTroisComposition[#1]{#2}{0}{#4}{}%
-        }%
-        {%ax=cx+d
-          \EquaTroisComposition[#1]{#4}{#5}{#2}{}%
-        }%
-      }%
-      {\xintifboolexpr{#5=0}{%ax+b=cx
-          \EquaTroisComposition[#1]{#2}{#3}{#4}{}%
-        }%
-        {%ax+b=cx+d -- ici
-          \xintifboolexpr{#2=#4}{%
-            \xintifboolexpr{#3=#5}{%b=d
-              L'équation $\xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}=\xintifboolexpr{#4=1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#5>0}{+\num{#5}}{-\num{\fpeval{0-#5}}}$ a une infinité de solution.}%
-            {%b<>d
-              L'équation $\xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}=\xintifboolexpr{#4=1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#5>0}{+\num{#5}}{-\num{\fpeval{0-#5}}}$ n'a aucune solution.%
-            }%
-          }{
-            %% Cas délicat
-            \xintifboolexpr{#2>#4}{%ax+b=cx+d avec a>c
-              \ifboolKV[ClesEquation]{Decomposition}{\colorlet{Ccompo}{\useKV[ClesEquation]{CouleurCompo}}}{}
-              \begin{align*}
-                \tikzmark{A-\theNbequa}\mathcolor{Ccompo}{\xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}&=\xintifboolexpr{#4=1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#5>0}{+\num{#5}}{-\num{\fpeval{0-#5}}}\tikzmark{E-\theNbequa}\\
-                \mathcolor{Ccompo}{\num{\fpeval{#2-#4}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#4>0}{+\num{#4}\useKV[ClesEquation]{Lettre}}{-\num{\fpeval{0-#4}}\useKV[ClesEquation]{Lettre}}}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}&=\xintifboolexpr{#4=1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#5>0}{+\num{#5}}{-\num{\fpeval{0-#5}}}\\
-                \tikzmark{B-\theNbequa}\xdef\Coeffa{\fpeval{#2-#4}}\xintifboolexpr{\Coeffa=1}{}{\num{\Coeffa}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}&=\mathcolor{Ccompo}{\num{#5}}\tikzmark{F-\theNbequa}\\
-                \xintifboolexpr{\Coeffa=1}{}{\num{\Coeffa}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}&=\mathcolor{Ccompo}{\num{\fpeval{#5-#3}}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}}\\
-                \tikzmark{C-\theNbequa}\xdef\Coeffb{\fpeval{#5-#3}}\xintifboolexpr{\Coeffa=1}{}{\num{\Coeffa}}\useKV[ClesEquation]{Lettre}&=\num{\Coeffb}\tikzmark{G-\theNbequa}%\\
-                \xintifboolexpr{\Coeffa=1}{}{\\}
-                \ifboolKV[ClesEquation]{Fleches}{%
-                \leftcomment{A-\theNbequa}{B-\theNbequa}{A-\theNbequa}{$\xintifboolexpr{#4>0}{-\num{#4}}{+\num{\fpeval{0-#4}}}\useKV[ClesEquation]{Lettre}$}
-                \rightcomment{E-\theNbequa}{F-\theNbequa}{E-\theNbequa}{$\xintifboolexpr{#4>0}{-\num{#4}}{+\num{\fpeval{0-#4}}}\useKV[ClesEquation]{Lettre}$}
-                \leftcomment{B-\theNbequa}{C-\theNbequa}{A-\theNbequa}{$\xintifboolexpr{#3>0}{-\num{#3}}{+\num{\fpeval{0-#3}}}$}%
-                \rightcomment{F-\theNbequa}{G-\theNbequa}{E-\theNbequa}{$\xintifboolexpr{#3>0}{-\num{#3}}{+\num{\fpeval{0-#3}}}$}%
-                }{}
-                \xintifboolexpr{\Coeffa=1}{}{%\ifnum\cmtd>1
-                \tikzmark{D-\theNbequa}\useKV[ClesEquation]{Lettre}&=\frac{\num{\Coeffb}}{\num{\Coeffa}}\tikzmark{H-\theNbequa}%\\
-                \ifboolKV[ClesEquation]{Fleches}{%
-                \leftcomment{C-\theNbequa}{D-\theNbequa}{A-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%
-                \rightcomment{G-\theNbequa}{H-\theNbequa}{E-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%            
-                }{
-                \ifboolKV[ClesEquation]{FlecheDiv}{%
-                \leftcomment{C-\theNbequa}{D-\theNbequa}{A-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%
-                \rightcomment{G-\theNbequa}{H-\theNbequa}{E-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%                 
-                }{}
-                }
-                \ifboolKV[ClesEquation]{Entier}{%
-                \SSimpliTest{\Coeffb}{\Coeffa}%
-                \ifboolKV[ClesEquation]{Simplification}{%
-                \ifthenelse{\boolean{Simplification}}{\\\useKV[ClesEquation]{Lettre}&=\SSimplifie{\Coeffb}{\Coeffa}}{}%\\
-                }{}
-                }{}
-                }
-                \ifboolKV[ClesEquation]{Fleches}{\stepcounter{Nbequa}}{\ifboolKV[ClesEquation]{FlecheDiv}{\stepcounter{Nbequa}}{}}
-              \end{align*}
-              \ifboolKV[ClesEquation]{Solution}{L'équation $\xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}=\xintifboolexpr{#4=1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#5>0}{+\num{#5}}{-\num{\fpeval{0-#5}}}$ a une unique solution : \opdiv*{\Coeffb}{\Coeffa}{solution}{resteequa}\opcmp{resteequa}{0}$\useKV[ClesEquation]{Lettre}=\displaystyle\ifopeq\opexport{solution}{\solution}\num{\solution}\else\ifboolKV[ClesEquation]{Entier}{\SSimplifie{\Coeffb}{\Coeffa}}{\frac{\num{\Coeffb}}{\num{\Coeffa}}}\fi$.%
-              }{}
-            }{%ax+b=cx+d avec a<c              % Autre cas délicat
-              \ifboolKV[ClesEquation]{Decomposition}{\colorlet{Ccompo}{\useKV[ClesEquation]{CouleurCompo}}}{}%
-              \begin{align*}%
-                \tikzmark{A-\theNbequa}\xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}&=\mathcolor{Ccompo}{\xintifboolexpr{#4=1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}}\xintifboolexpr{#5>0}{+\num{#5}}{-\num{\fpeval{0-#5}}}\tikzmark{E-\theNbequa}\\
-                \xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}&=\mathcolor{Ccompo}{\num{\fpeval{#4-#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#2>0}{+\num{#2}\useKV[ClesEquation]{Lettre}}{-\num{\fpeval{0-#2}}\useKV[ClesEquation]{Lettre}}}\xintifboolexpr{#5>0}{+\num{#5}}{-\num{\fpeval{0-#5}}}\\
-                \tikzmark{B-\theNbequa}\xdef\Coeffa{\fpeval{#4-#2}}\xintifboolexpr{#3>0}{\num{#3}}{-\num{\fpeval{0-#3}}}&=\xintifboolexpr{\Coeffa=1}{}{\num{\Coeffa}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#5>0}{+\num{#5}}{-\num{\fpeval{0-#5}}}\tikzmark{F-\theNbequa}\\
-                \mathcolor{Ccompo}{\num{\fpeval{#3-#5}}\xintifboolexpr{#5>0}{+\num{#5}}{-\num{\fpeval{0-#5}}}}&=\xintifboolexpr{\Coeffa=1}{}{\num{\Coeffa}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#5>0}{+\num{#5}}{-\num{\fpeval{0-#5}}}\\
-                \tikzmark{C-\theNbequa}\xdef\Coeffb{\fpeval{#3-#5}}\num{\Coeffb}&=\xintifboolexpr{\Coeffa=1}{}{\num{\Coeffa}}\useKV[ClesEquation]{Lettre}\tikzmark{G-\theNbequa}%\\
-                \xintifboolexpr{\Coeffa=1}{}{\\}
-                \ifboolKV[ClesEquation]{Fleches}{%
-                \leftcomment{A-\theNbequa}{B-\theNbequa}{A-\theNbequa}{$\xintifboolexpr{#2>0}{-\num{#2}}{+\num{\fpeval{0-#2}}}\useKV[ClesEquation]{Lettre}$}
-                \rightcomment{E-\theNbequa}{F-\theNbequa}{E-\theNbequa}{$\xintifboolexpr{#2>0}{-\num{#2}}{+\num{\fpeval{0-#2}}}\useKV[ClesEquation]{Lettre}$}
-                \leftcomment{B-\theNbequa}{C-\theNbequa}{A-\theNbequa}{$\xintifboolexpr{#5>0}{-\num{#5}}{+\num{\fpeval{0-#5}}}$}%
-                \rightcomment{F-\theNbequa}{G-\theNbequa}{E-\theNbequa}{$\xintifboolexpr{#5>0}{-\num{#5}}{+\num{\fpeval{0-#5}}}$}%
-                }{}
-                \xintifboolexpr{\Coeffa=1}{}{%\ifnum\cmtd>1
-                \tikzmark{D-\theNbequa}\frac{\num{\Coeffb}}{\num{\Coeffa}}&=\useKV[ClesEquation]{Lettre}\tikzmark{H-\theNbequa}%\\
-                \ifboolKV[ClesEquation]{Fleches}{%
-                \leftcomment{C-\theNbequa}{D-\theNbequa}{A-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%
-                \rightcomment{G-\theNbequa}{H-\theNbequa}{E-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%            
-                }{
-                \ifboolKV[ClesEquation]{FlecheDiv}{%
-                \leftcomment{C-\theNbequa}{D-\theNbequa}{A-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%
-                \rightcomment{G-\theNbequa}{H-\theNbequa}{E-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%                 
-                }{}
-                }
-                \ifboolKV[ClesEquation]{Entier}{%
-                \SSimpliTest{\Coeffb}{\Coeffa}%
-                \ifboolKV[ClesEquation]{Simplification}{%
-                \ifthenelse{\boolean{Simplification}}{\\\SSimplifie{\Coeffb}{\Coeffa}&=\useKV[ClesEquation]{Lettre}}{}%\\
-                }{}
-                }{}
-                }
-                \ifboolKV[ClesEquation]{Fleches}{\stepcounter{Nbequa}}{\ifboolKV[ClesEquation]{FlecheDiv}{\stepcounter{Nbequa}}{}}
-              \end{align*}
-              \ifboolKV[ClesEquation]{Solution}{L'équation $\xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}=\xintifboolexpr{#4=1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#5>0}{+\num{#5}}{-\num{\fpeval{0-#5}}}$ a une unique solution : \opdiv*{\Coeffb}{\Coeffa}{solution}{resteequa}\opcmp{resteequa}{0}$\useKV[ClesEquation]{Lettre}=\displaystyle\ifopeq\opexport{solution}{\solution}\num{\solution}\else\ifboolKV[ClesEquation]{Entier}{\SSimplifie{\Coeffb}{\Coeffa}}{\frac{\num{\Coeffb}}{\num{\Coeffa}}}\fi$.%
-              }{}%
-            }%
-          }%
-        }%
-      }%
-    }%
-  }%
-}%
-
-

Added: trunk/Master/texmf-dist/tex/latex/profcollege/PfC-EquationComposition2.tex
===================================================================
--- trunk/Master/texmf-dist/tex/latex/profcollege/PfC-EquationComposition2.tex	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/profcollege/PfC-EquationComposition2.tex	2021-03-14 22:52:07 UTC (rev 58351)
@@ -0,0 +1,275 @@
+% Licence    : Released under the LaTeX Project Public License v1.3c
+% or later, see http://www.latex-project.org/lppl.txtf
+\newcommand{\EquaDeuxComposition}[5][]{%type ax+b=d ou b=cx+d$
+  \useKVdefault[ClesEquation]%
+  \setKV[ClesEquation]{#1}%
+  \ifx\bla#2\bla%On échange en faisant attention à ne pas boucler : c doit être non vide
+    \EquaDeuxComposition[#1]{#4}{#5}{#2}{#3}
+  \else%cas ax+b=d
+    \xintifboolexpr{#2=0}{%
+      \xintifboolexpr{#3=#5}{%b=d
+        L'équation $\num{#3}=\num{#5}$ a une infinité de solutions.}%
+      {%b<>d
+        L'équation $\num{#3}=\num{#5}$ n'a aucune solution.%
+      }%
+    }{%ELSE
+      \xintifboolexpr{#3=0}{%ax+b=d
+        \EquaBase[#1]{#2}{}{}{#5}%
+      }{%ax+b=d$ Ici
+        \ifboolKV[ClesEquation]{Decomposition}{\colorlet{Ccompo}{\useKV[ClesEquation]{CouleurCompo}}}{}
+        \begin{align*}
+          \tikzmark{A-\theNbequa}\xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}&=\mathcolor{Ccompo}{\num{#5}}\tikzmark{E-\theNbequa}\\
+          \xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}&=\mathcolor{Ccompo}{\num{\fpeval{#5-#3}}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}}\\
+          \tikzmark{C-\theNbequa}\xdef\Coeffa{#2}\xdef\Coeffb{\fpeval{#5-#3}}\xintifboolexpr{\Coeffa=1}{}{\num{\Coeffa}}\useKV[ClesEquation]{Lettre}&=\num{\Coeffb}\tikzmark{G-\theNbequa}%\\
+          \xintifboolexpr{\Coeffa=1}{}{\\}
+          \ifboolKV[ClesEquation]{Fleches}{%
+          \leftcomment{A-\theNbequa}{C-\theNbequa}{A-\theNbequa}{$\xintifboolexpr{#3>0}{-\num{#3}}{+\num{\fpeval{0-#3}}}$}%
+          \rightcomment{E-\theNbequa}{G-\theNbequa}{E-\theNbequa}{$\xintifboolexpr{#3>0}{-\num{#3}}{+\num{\fpeval{0-#3}}}$}%
+          }{}
+          \xintifboolexpr{\Coeffa=1}{% 
+          }{%\ifnum\cmtd>1
+          \tikzmark{D-\theNbequa}\useKV[ClesEquation]{Lettre}&=\frac{\num{\Coeffb}}{\num{\Coeffa}}\tikzmark{H-\theNbequa}%\\
+          \ifboolKV[ClesEquation]{Fleches}{%
+          \leftcomment{C-\theNbequa}{D-\theNbequa}{A-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%
+          \rightcomment{G-\theNbequa}{H-\theNbequa}{E-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%
+          }{%ICI ?
+          \ifboolKV[ClesEquation]{FlecheDiv}{%
+          \leftcomment{C-\theNbequa}{D-\theNbequa}{A-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%
+          \rightcomment{G-\theNbequa}{H-\theNbequa}{E-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%
+          }{}
+          }
+          }
+          \ifboolKV[ClesEquation]{Entier}{%
+          \SSimpliTest{\Coeffb}{\Coeffa}%
+          \ifboolKV[ClesEquation]{Simplification}{%
+          \ifthenelse{\boolean{Simplification}}{\\\useKV[ClesEquation]{Lettre}&=\SSimplifie{\Coeffb}{\Coeffa}}{}%\\
+          }{}
+          }{}
+          \ifboolKV[ClesEquation]{Fleches}{\stepcounter{Nbequa}}{\ifboolKV[ClesEquation]{FlecheDiv}{\stepcounter{Nbequa}}{}}
+        \end{align*}
+        \ifboolKV[ClesEquation]{Solution}{L'équation $\xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}=\num{#5}$ a une unique solution : \opdiv*{\Coeffb}{\Coeffa}{solution}{resteequa}\opcmp{resteequa}{0}$\ifboolKV[ClesEquation]{LettreSol}{\useKV[ClesEquation]{Lettre}=}{}\displaystyle\ifopeq\opexport{solution}{\solution}\num{\solution}\else\ifboolKV[ClesEquation]{Entier}{\SSimplifie{\Coeffb}{\Coeffa}}{\frac{\num{\Coeffb}}{\num{\Coeffa}}}\fi$.
+        }{}
+      }
+    }
+  \fi
+}
+
+\newcommand{\EquaTroisComposition}[5][]{%ax+b=cx ou ax=cx+d
+  \useKVdefault[ClesEquation]%
+  \setKV[ClesEquation]{#1}%
+  \ifx\bla#3\bla%on inverse en faisant attention à la boucle #3<->#5
+  \ifx\bla#5\bla%
+  %% paramètre oublié
+  \else
+  \EquaTroisComposition[#1]{#4}{#5}{#2}{}%
+  \fi
+  \else
+  \xintifboolexpr{#2=0}{%b=cx
+    \EquaBase[#1]{#4}{}{}{#3}
+  }{%
+    \xintifboolexpr{#4=0}{%ax+b=0
+      \EquaDeuxComposition[#1]{#2}{#3}{}{0}
+    }{%ax+b=cx
+      \xintifboolexpr{#2=#4}{%
+        \xintifboolexpr{#3=0}{%ax=ax
+          L'équation $\xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}=\xintifboolexpr{#4=1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}$ a une infinité de solutions.}%
+        {%ax+b=ax
+          L'équation $\xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}=\xintifboolexpr{#4=1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}$ n'a aucune solution.%
+        }%
+      }{%% Cas délicat
+        \xintifboolexpr{#2>#4}{%ax+b=cx avec a>c
+          \ifboolKV[ClesEquation]{Decomposition}{\colorlet{Ccompo}{\useKV[ClesEquation]{CouleurCompo}}}{}
+          \begin{align*}
+            \tikzmark{A-\theNbequa}\mathcolor{Ccompo}{\xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}&=\xintifboolexpr{#4=1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}\tikzmark{E-\theNbequa}\\
+            \mathcolor{Ccompo}{\num{\fpeval{#2-#4}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#4>0}{+\num{#4}\useKV[ClesEquation]{Lettre}}{-\num{\fpeval{0-#4}}\useKV[ClesEquation]{Lettre}}}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}&=\xintifboolexpr{#4=1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}\\
+            \tikzmark{B-\theNbequa}\xdef\Coeffa{\fpeval{#2-#4}}\xintifboolexpr{\Coeffa=1}{}{\num{\Coeffa}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}&=\mathcolor{Ccompo}{0}\tikzmark{F-\theNbequa}\\
+            \xintifboolexpr{\Coeffa=1}{}{\num{\Coeffa}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}&=\mathcolor{Ccompo}{\num{\fpeval{0-#3}}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}}\tikzmark{F-\theNbequa}\\
+            \tikzmark{C-\theNbequa}\xdef\Coeffb{\fpeval{0-#3}}\xintifboolexpr{\Coeffa=1}{}{\num{\Coeffa}}\useKV[ClesEquation]{Lettre}&=\num{\Coeffb}\tikzmark{G-\theNbequa}%\\
+            \xintifboolexpr{\Coeffa=1}{}{\\}
+            \ifboolKV[ClesEquation]{Fleches}{%
+            \leftcomment{A-\theNbequa}{B-\theNbequa}{A-\theNbequa}{$\xintifboolexpr{#4>0}{-\num{#4}}{+\num{\fpeval{0-#4}}}\useKV[ClesEquation]{Lettre}$}
+            \rightcomment{E-\theNbequa}{F-\theNbequa}{E-\theNbequa}{$\xintifboolexpr{#4>0}{-\num{#4}}{+\num{\fpeval{0-#4}}}\useKV[ClesEquation]{Lettre}$}
+            \leftcomment{B-\theNbequa}{C-\theNbequa}{A-\theNbequa}{$\xintifboolexpr{#3>0}{-\num{#3}}{+\num{\fpeval{0-#3}}}$}%
+            \rightcomment{F-\theNbequa}{G-\theNbequa}{E-\theNbequa}{$\xintifboolexpr{#3>0}{-\num{#3}}{+\num{\fpeval{0-#3}}}$}%
+            }{}
+            \xintifboolexpr{\Coeffa=1}{}{%\ifnum\cmtd>1
+            \tikzmark{D-\theNbequa}\useKV[ClesEquation]{Lettre}&=\frac{\num{\Coeffb}}{\num{\Coeffa}}\tikzmark{H-\theNbequa}%\\
+            \ifboolKV[ClesEquation]{Fleches}{%
+            \leftcomment{C-\theNbequa}{D-\theNbequa}{A-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%
+            \rightcomment{G-\theNbequa}{H-\theNbequa}{E-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%            
+            }{
+            \ifboolKV[ClesEquation]{FlecheDiv}{%
+            \leftcomment{C-\theNbequa}{D-\theNbequa}{A-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%
+            \rightcomment{G-\theNbequa}{H-\theNbequa}{E-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%                 
+            }{}
+            }
+            \ifboolKV[ClesEquation]{Entier}{%
+            \SSimpliTest{\Coeffb}{\Coeffa}%
+            \ifboolKV[ClesEquation]{Simplification}{%
+            \ifthenelse{\boolean{Simplification}}{\\\useKV[ClesEquation]{Lettre}&=\SSimplifie{\Coeffb}{\Coeffa}}{}%\\
+            }{}
+            }{}
+            }
+            \ifboolKV[ClesEquation]{Fleches}{\stepcounter{Nbequa}}{\ifboolKV[ClesEquation]{FlecheDiv}{\stepcounter{Nbequa}}{}}
+          \end{align*}
+          \ifboolKV[ClesEquation]{Solution}{L'équation $\xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}=\xintifboolexpr{#4=1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}$ a une unique solution : \opdiv*{\Coeffb}{\Coeffa}{solution}{resteequa}\opcmp{resteequa}{0}$\ifboolKV[ClesEquation]{LettreSol}{\useKV[ClesEquation]{Lettre}=}{}\displaystyle\ifopeq\opexport{solution}{\solution}\num{\solution}\else\ifboolKV[ClesEquation]{Entier}{\SSimplifie{\Coeffb}{\Coeffa}}{\frac{\num{\Coeffb}}{\num{\Coeffa}}}\fi$.}{}
+        }{%ax+b=cx+d avec a<c              % Autre cas délicat
+          \ifboolKV[ClesEquation]{Decomposition}{\colorlet{Ccompo}{\useKV[ClesEquation]{CouleurCompo}}}{}
+          \begin{align*}%
+            \tikzmark{A-\theNbequa}\xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}&=\mathcolor{Ccompo}{\xintifboolexpr{#4=1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}}\tikzmark{E-\theNbequa}\\
+            \xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}&=\mathcolor{Ccompo}{\num{\fpeval{#4-#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#2>0}{+\num{#2}\useKV[ClesEquation]{Lettre}}{-\num{\fpeval{0-#2}}\useKV[ClesEquation]{Lettre}}}\\
+            \tikzmark{B-\theNbequa}\xdef\Coeffb{#3}\xdef\Coeffa{\fpeval{#4-#2}}\xintifboolexpr{#3>0}{\num{#3}}{-\num{\fpeval{0-#3}}}&=\xintifboolexpr{\Coeffa=1}{}{\num{\Coeffa}}\useKV[ClesEquation]{Lettre}\tikzmark{F-\theNbequa}
+                                                                                                                                      \xintifboolexpr{\Coeffa=1}{}{\\}
+            \ifboolKV[ClesEquation]{Fleches}{%
+            \leftcomment{A-\theNbequa}{B-\theNbequa}{A-\theNbequa}{$\xintifboolexpr{#2>0}{-\num{#2}}{+\num{\fpeval{0-#2}}}\useKV[ClesEquation]{Lettre}$}
+            \rightcomment{E-\theNbequa}{F-\theNbequa}{E-\theNbequa}{$\xintifboolexpr{#2>0}{-\num{#2}}{+\num{\fpeval{0-#2}}}\useKV[ClesEquation]{Lettre}$}
+            }{}
+            \xintifboolexpr{\Coeffa=1}{}{%\ifnum\cmtd>1
+            \tikzmark{D-\theNbequa}\frac{\num{\Coeffb}}{\num{\Coeffa}}&=\useKV[ClesEquation]{Lettre}\tikzmark{H-\theNbequa}%\\
+            \ifboolKV[ClesEquation]{Fleches}{%
+            \leftcomment{B-\theNbequa}{D-\theNbequa}{A-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%
+            \rightcomment{F-\theNbequa}{H-\theNbequa}{E-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%            
+            }{
+            \ifboolKV[ClesEquation]{FlecheDiv}{%
+            \leftcomment{B-\theNbequa}{D-\theNbequa}{A-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%
+            \rightcomment{F-\theNbequa}{H-\theNbequa}{E-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%                 
+            }{}
+            }
+            \ifboolKV[ClesEquation]{Entier}{%
+            \SSimpliTest{\Coeffb}{\Coeffa}%
+            \ifboolKV[ClesEquation]{Simplification}{%
+            \ifthenelse{\boolean{Simplification}}{\\\SSimplifie{\Coeffb}{\Coeffa}&=\useKV[ClesEquation]{Lettre}}{}%\\
+            }{}
+            }{}
+            }
+            \ifboolKV[ClesEquation]{Fleches}{\stepcounter{Nbequa}}{\ifboolKV[ClesEquation]{FlecheDiv}{\stepcounter{Nbequa}}{}}
+          \end{align*}
+          \ifboolKV[ClesEquation]{Solution}{L'équation $\xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}=\xintifboolexpr{#4=1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}$ a une unique solution : \opdiv*{\Coeffb}{\Coeffa}{solution}{resteequa}\opcmp{resteequa}{0}$\ifboolKV[ClesEquation]{LettreSol}{\useKV[ClesEquation]{Lettre}=}{}\displaystyle\ifopeq\opexport{solution}{\solution}\num{\solution}\else\ifboolKV[ClesEquation]{Entier}{\SSimplifie{\Coeffb}{\Coeffa}}{\frac{\num{\Coeffb}}{\num{\Coeffa}}}\fi$.}{}%
+        }%
+      }%
+    }%
+  }%
+  \fi
+}%
+
+
+\newcommand{\ResolEquationComposition}[5][]{%
+  \useKVdefault[ClesEquation]%
+  \setKV[ClesEquation]{#1}%
+  \xintifboolexpr{#2=0}{%
+    \xintifboolexpr{#4=0}{%
+      \xintifboolexpr{#3=#5}{%b=d
+        L'équation $\num{#3}=\num{#5}$ a une infinité de solutions.}%
+      {%b<>d
+        L'équation $\num{#3}=\num{#5}$ n'a aucune solution.%
+      }%
+    }%
+    {%0x+b=cx+d$
+      \EquaDeuxComposition[#1]{#4}{#5}{#2}{#3}%
+    }%
+  }{%
+    \xintifboolexpr{#4=0}{%ax+b=0x+d
+      \EquaDeuxComposition[#1]{#2}{#3}{}{#5}%
+    }
+    {%ax+b=cx+d$
+      \xintifboolexpr{#3=0}{%
+        \xintifboolexpr{#5=0}{%ax=cx
+          \EquaTroisComposition[#1]{#2}{0}{#4}{}%
+        }%
+        {%ax=cx+d
+          \EquaTroisComposition[#1]{#4}{#5}{#2}{}%
+        }%
+      }%
+      {\xintifboolexpr{#5=0}{%ax+b=cx
+          \EquaTroisComposition[#1]{#2}{#3}{#4}{}%
+        }%
+        {%ax+b=cx+d -- ici
+          \xintifboolexpr{#2=#4}{%
+            \xintifboolexpr{#3=#5}{%b=d
+              L'équation $\xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}=\xintifboolexpr{#4=1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#5>0}{+\num{#5}}{-\num{\fpeval{0-#5}}}$ a une infinité de solutions.}%
+            {%b<>d
+              L'équation $\xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}=\xintifboolexpr{#4=1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#5>0}{+\num{#5}}{-\num{\fpeval{0-#5}}}$ n'a aucune solution.%
+            }%
+          }{
+            %% Cas délicat
+            \xintifboolexpr{#2>#4}{%ax+b=cx+d avec a>c
+              \ifboolKV[ClesEquation]{Decomposition}{\colorlet{Ccompo}{\useKV[ClesEquation]{CouleurCompo}}}{}
+              \begin{align*}
+                \tikzmark{A-\theNbequa}\mathcolor{Ccompo}{\xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}&=\xintifboolexpr{#4=1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#5>0}{+\num{#5}}{-\num{\fpeval{0-#5}}}\tikzmark{E-\theNbequa}\\
+                \mathcolor{Ccompo}{\num{\fpeval{#2-#4}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#4>0}{+\num{#4}\useKV[ClesEquation]{Lettre}}{-\num{\fpeval{0-#4}}\useKV[ClesEquation]{Lettre}}}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}&=\xintifboolexpr{#4=1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#5>0}{+\num{#5}}{-\num{\fpeval{0-#5}}}\\
+                \tikzmark{B-\theNbequa}\xdef\Coeffa{\fpeval{#2-#4}}\xintifboolexpr{\Coeffa=1}{}{\num{\Coeffa}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}&=\mathcolor{Ccompo}{\num{#5}}\tikzmark{F-\theNbequa}\\
+                \xintifboolexpr{\Coeffa=1}{}{\num{\Coeffa}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}&=\mathcolor{Ccompo}{\num{\fpeval{#5-#3}}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}}\\
+                \tikzmark{C-\theNbequa}\xdef\Coeffb{\fpeval{#5-#3}}\xintifboolexpr{\Coeffa=1}{}{\num{\Coeffa}}\useKV[ClesEquation]{Lettre}&=\num{\Coeffb}\tikzmark{G-\theNbequa}%\\
+                \xintifboolexpr{\Coeffa=1}{}{\\}
+                \ifboolKV[ClesEquation]{Fleches}{%
+                \leftcomment{A-\theNbequa}{B-\theNbequa}{A-\theNbequa}{$\xintifboolexpr{#4>0}{-\num{#4}}{+\num{\fpeval{0-#4}}}\useKV[ClesEquation]{Lettre}$}
+                \rightcomment{E-\theNbequa}{F-\theNbequa}{E-\theNbequa}{$\xintifboolexpr{#4>0}{-\num{#4}}{+\num{\fpeval{0-#4}}}\useKV[ClesEquation]{Lettre}$}
+                \leftcomment{B-\theNbequa}{C-\theNbequa}{A-\theNbequa}{$\xintifboolexpr{#3>0}{-\num{#3}}{+\num{\fpeval{0-#3}}}$}%
+                \rightcomment{F-\theNbequa}{G-\theNbequa}{E-\theNbequa}{$\xintifboolexpr{#3>0}{-\num{#3}}{+\num{\fpeval{0-#3}}}$}%
+                }{}
+                \xintifboolexpr{\Coeffa=1}{}{%\ifnum\cmtd>1
+                \tikzmark{D-\theNbequa}\useKV[ClesEquation]{Lettre}&=\frac{\num{\Coeffb}}{\num{\Coeffa}}\tikzmark{H-\theNbequa}%\\
+                \ifboolKV[ClesEquation]{Fleches}{%
+                \leftcomment{C-\theNbequa}{D-\theNbequa}{A-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%
+                \rightcomment{G-\theNbequa}{H-\theNbequa}{E-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%            
+                }{
+                \ifboolKV[ClesEquation]{FlecheDiv}{%
+                \leftcomment{C-\theNbequa}{D-\theNbequa}{A-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%
+                \rightcomment{G-\theNbequa}{H-\theNbequa}{E-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%                 
+                }{}
+                }
+                \ifboolKV[ClesEquation]{Entier}{%
+                \SSimpliTest{\Coeffb}{\Coeffa}%
+                \ifboolKV[ClesEquation]{Simplification}{%
+                \ifthenelse{\boolean{Simplification}}{\\\useKV[ClesEquation]{Lettre}&=\SSimplifie{\Coeffb}{\Coeffa}}{}%\\
+                }{}
+                }{}
+                }
+                \ifboolKV[ClesEquation]{Fleches}{\stepcounter{Nbequa}}{\ifboolKV[ClesEquation]{FlecheDiv}{\stepcounter{Nbequa}}{}}
+              \end{align*}
+              \ifboolKV[ClesEquation]{Solution}{L'équation $\xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}=\xintifboolexpr{#4=1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#5>0}{+\num{#5}}{-\num{\fpeval{0-#5}}}$ a une unique solution : \opdiv*{\Coeffb}{\Coeffa}{solution}{resteequa}\opcmp{resteequa}{0}$\ifboolKV[ClesEquation]{LettreSol}{\useKV[ClesEquation]{Lettre}=}{}\displaystyle\ifopeq\opexport{solution}{\solution}\num{\solution}\else\ifboolKV[ClesEquation]{Entier}{\SSimplifie{\Coeffb}{\Coeffa}}{\frac{\num{\Coeffb}}{\num{\Coeffa}}}\fi$.%
+              }{}
+            }{%ax+b=cx+d avec a<c              % Autre cas délicat
+              \ifboolKV[ClesEquation]{Decomposition}{\colorlet{Ccompo}{\useKV[ClesEquation]{CouleurCompo}}}{}%
+              \begin{align*}%
+                \tikzmark{A-\theNbequa}\xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}&=\mathcolor{Ccompo}{\xintifboolexpr{#4=1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}}\xintifboolexpr{#5>0}{+\num{#5}}{-\num{\fpeval{0-#5}}}\tikzmark{E-\theNbequa}\\
+                \xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}&=\mathcolor{Ccompo}{\num{\fpeval{#4-#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#2>0}{+\num{#2}\useKV[ClesEquation]{Lettre}}{-\num{\fpeval{0-#2}}\useKV[ClesEquation]{Lettre}}}\xintifboolexpr{#5>0}{+\num{#5}}{-\num{\fpeval{0-#5}}}\\
+                \tikzmark{B-\theNbequa}\xdef\Coeffa{\fpeval{#4-#2}}\xintifboolexpr{#3>0}{\num{#3}}{-\num{\fpeval{0-#3}}}&=\xintifboolexpr{\Coeffa=1}{}{\num{\Coeffa}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#5>0}{+\num{#5}}{-\num{\fpeval{0-#5}}}\tikzmark{F-\theNbequa}\\
+                \mathcolor{Ccompo}{\num{\fpeval{#3-#5}}\xintifboolexpr{#5>0}{+\num{#5}}{-\num{\fpeval{0-#5}}}}&=\xintifboolexpr{\Coeffa=1}{}{\num{\Coeffa}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#5>0}{+\num{#5}}{-\num{\fpeval{0-#5}}}\\
+                \tikzmark{C-\theNbequa}\xdef\Coeffb{\fpeval{#3-#5}}\num{\Coeffb}&=\xintifboolexpr{\Coeffa=1}{}{\num{\Coeffa}}\useKV[ClesEquation]{Lettre}\tikzmark{G-\theNbequa}%\\
+                \xintifboolexpr{\Coeffa=1}{}{\\}
+                \ifboolKV[ClesEquation]{Fleches}{%
+                \leftcomment{A-\theNbequa}{B-\theNbequa}{A-\theNbequa}{$\xintifboolexpr{#2>0}{-\num{#2}}{+\num{\fpeval{0-#2}}}\useKV[ClesEquation]{Lettre}$}
+                \rightcomment{E-\theNbequa}{F-\theNbequa}{E-\theNbequa}{$\xintifboolexpr{#2>0}{-\num{#2}}{+\num{\fpeval{0-#2}}}\useKV[ClesEquation]{Lettre}$}
+                \leftcomment{B-\theNbequa}{C-\theNbequa}{A-\theNbequa}{$\xintifboolexpr{#5>0}{-\num{#5}}{+\num{\fpeval{0-#5}}}$}%
+                \rightcomment{F-\theNbequa}{G-\theNbequa}{E-\theNbequa}{$\xintifboolexpr{#5>0}{-\num{#5}}{+\num{\fpeval{0-#5}}}$}%
+                }{}
+                \xintifboolexpr{\Coeffa=1}{}{%\ifnum\cmtd>1
+                \tikzmark{D-\theNbequa}\frac{\num{\Coeffb}}{\num{\Coeffa}}&=\useKV[ClesEquation]{Lettre}\tikzmark{H-\theNbequa}%\\
+                \ifboolKV[ClesEquation]{Fleches}{%
+                \leftcomment{C-\theNbequa}{D-\theNbequa}{A-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%
+                \rightcomment{G-\theNbequa}{H-\theNbequa}{E-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%            
+                }{
+                \ifboolKV[ClesEquation]{FlecheDiv}{%
+                \leftcomment{C-\theNbequa}{D-\theNbequa}{A-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%
+                \rightcomment{G-\theNbequa}{H-\theNbequa}{E-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%                 
+                }{}
+                }
+                \ifboolKV[ClesEquation]{Entier}{%
+                \SSimpliTest{\Coeffb}{\Coeffa}%
+                \ifboolKV[ClesEquation]{Simplification}{%
+                \ifthenelse{\boolean{Simplification}}{\\\SSimplifie{\Coeffb}{\Coeffa}&=\useKV[ClesEquation]{Lettre}}{}%\\
+                }{}
+                }{}
+                }
+                \ifboolKV[ClesEquation]{Fleches}{\stepcounter{Nbequa}}{\ifboolKV[ClesEquation]{FlecheDiv}{\stepcounter{Nbequa}}{}}
+              \end{align*}
+              \ifboolKV[ClesEquation]{Solution}{L'équation $\xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}=\xintifboolexpr{#4=1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#5>0}{+\num{#5}}{-\num{\fpeval{0-#5}}}$ a une unique solution : \opdiv*{\Coeffb}{\Coeffa}{solution}{resteequa}\opcmp{resteequa}{0}$\ifboolKV[ClesEquation]{LettreSol}{\useKV[ClesEquation]{Lettre}=}{}\displaystyle\ifopeq\opexport{solution}{\solution}\num{\solution}\else\ifboolKV[ClesEquation]{Entier}{\SSimplifie{\Coeffb}{\Coeffa}}{\frac{\num{\Coeffb}}{\num{\Coeffa}}}\fi$.%
+              }{}%
+            }%
+          }%
+        }%
+      }%
+    }%
+  }%
+}%
\ No newline at end of file


Property changes on: trunk/Master/texmf-dist/tex/latex/profcollege/PfC-EquationComposition2.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Deleted: trunk/Master/texmf-dist/tex/latex/profcollege/PfC-EquationSoustraction1.tex
===================================================================
--- trunk/Master/texmf-dist/tex/latex/profcollege/PfC-EquationSoustraction1.tex	2021-03-14 22:51:48 UTC (rev 58350)
+++ trunk/Master/texmf-dist/tex/latex/profcollege/PfC-EquationSoustraction1.tex	2021-03-14 22:52:07 UTC (rev 58351)
@@ -1,332 +0,0 @@
-% Licence    : Released under the LaTeX Project Public License v1.3c
-% or later, see http://www.latex-project.org/lppl.txtf
-\newcommand{\EquaBase}[5][]{%type ax=d ou b=cx
-  \useKVdefault[ClesEquation]%
-  \setKV[ClesEquation]{#1}%
-  \ifx\bla#2\bla%on teste si le paramètre #2 est vide:
-  % si oui, on est dans le cas b=cx. Eh bien on échange :)
-  % Mais attention si les deux paramètres a et c sont vides...
-  \EquaBase[#1]{#4}{}{}{#3}
-  \else
-  % si non, on est dans le cas ax=d
-  \xintifboolexpr{#2=0}{%
-    \xintifboolexpr{#5=0}{%
-      L'équation $0\useKV[ClesEquation]{ELettre}=0$ a une infinité de solution.}{L'équation $0\useKV[ClesEquation]{Lettre}=\num{#5}$ n'a aucune solution.}%
-  }{%\else
-    \xintifboolexpr{#5=0}{L'équation $\num{#2}\useKV[ClesEquation]{Lettre}=0$ a une unique solution : $\useKV[ClesEquation]{Lettre}=0$.}{%\else
-      \begin{align*}%
-        \tikzmark{A-\theNbequa}\xintifboolexpr{#2=1}{\useKV[ClesEquation]{Lettre}}{\num{#2}\useKV[ClesEquation]{Lettre}}&=\num{#5}\tikzmark{C-\theNbequa}\\
-        \tikzmark{B-\theNbequa}\useKV[ClesEquation]{Lettre}&=\frac{\num{#5}}{\num{#2}}\tikzmark{D-\theNbequa}%\\
-        \ifboolKV[ClesEquation]{Fleches}{%
-          \leftcomment{A-\theNbequa}{B-\theNbequa}{A-\theNbequa}{$\div\xintifboolexpr{#2<0}{(\num{#2})}{\num{#2}}$}%
-          \rightcomment{C-\theNbequa}{D-\theNbequa}{D-\theNbequa}{$\div\xintifboolexpr{#2<0}{(\num{#2})}{\num{#2}}$}%
-        }{%
-        \ifboolKV[ClesEquation]{FlecheDiv}{%
-        \Leftcomment{A-\theNbequa}{B-\theNbequa}{A-\theNbequa}{$\div\xintifboolexpr{#2<0}{(\num{#2})}{\num{#2}}$}%
-        \Rightcomment{C-\theNbequa}{D-\theNbequa}{D-\theNbequa}{$\div\xintifboolexpr{#2<0}{(\num{#2})}{\num{#2}}$}%
-        }{}%
-        }%%
-        \ifboolKV[ClesEquation]{Entier}{%
-                \SSimpliTest{#5}{#2}%
-                \ifboolKV[ClesEquation]{Simplification}{%
-                \ifthenelse{\boolean{Simplification}}{\\\useKV[ClesEquation]{Lettre}&=\SSimplifie{#5}{#2}}{}%\\
-                }{}
-                }{}
-        \ifboolKV[ClesEquation]{Fleches}{%
-        \stepcounter{Nbequa}}%
-        {\ifboolKV[ClesEquation]{FlecheDiv}{\stepcounter{Nbequa}}{}
-        }
-      \end{align*}
-      \ifboolKV[ClesEquation]{Solution}{L'équation $\xintifboolexpr{#2=1}{\useKV[ClesEquation]{Lettre}=\num{#5}}{\num{#2}\useKV[ClesEquation]{Lettre}=\num{#5}}$ a une unique solution : $\displaystyle\useKV[ClesEquation]{Lettre}=\opdiv*{#5}{#2}{numequa}{resteequa}\opcmp{resteequa}{0}\ifopeq\opexport{numequa}{\numequa}\num{\numequa}\else\ifboolKV[ClesEquation]{Simplification}{\SSimplifie{#5}{#2}}{\frac{\num{#5}}{\num{#2}}}\fi$.%
-      }{}
-    }
-  }
-  \fi
-}
-
-\newcommand{\EquaDeuxSoustraction}[5][]{%type ax+b=d ou b=cx+d$
-  \useKVdefault[ClesEquation]%
-  \setKV[ClesEquation]{#1}%
-  \ifx\bla#2\bla%On échange en faisant attention à ne pas boucler : c doit être non vide
-    \EquaDeuxSoustraction[#1]{#4}{#5}{#2}{#3}
-  \else%cas ax+b=d
-    \xintifboolexpr{#2=0}{%
-      \xintifboolexpr{#3=#5}{%b=d
-        L'équation $\num{#3}=\num{#5}$ a une infinité de solution.}%
-      {%b<>d
-        L'équation $\num{#3}=\num{#5}$ n'a aucune solution.%
-      }%
-    }{%ELSE
-      \xintifboolexpr{#3=0}{%ax+b=d
-        \EquaBase[#1]{#2}{}{}{#5}%
-      }{%ax+b=d$ Ici
-        \begin{align*}
-          \tikzmark{A-\theNbequa}\xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}&=\num{#5}\tikzmark{E-\theNbequa}\\
-          \ifboolKV[ClesEquation]{Decomposition}{%
-          \xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}\mathcolor{Cdecomp}{\xintifboolexpr{#3>0}{-\num{#3}}{+\num{\fpeval{0-#3}}}}&=\num{#5}\mathcolor{Cdecomp}{\xintifboolexpr{#3>0}{-\num{#3}}{+\num{\fpeval{0-#3}}}}\\
-          }{}%
-          \tikzmark{C-\theNbequa}\xdef\Coeffa{#2}\xdef\Coeffb{\fpeval{#5-#3}}\xintifboolexpr{\Coeffa=1}{}{\num{\Coeffa}}\useKV[ClesEquation]{Lettre}&=\num{\Coeffb}\tikzmark{G-\theNbequa}%\\
-          \xintifboolexpr{\Coeffa=1}{}{\\}
-          \ifboolKV[ClesEquation]{Fleches}{%
-          \leftcomment{A-\theNbequa}{C-\theNbequa}{A-\theNbequa}{$\xintifboolexpr{#3>0}{-\num{#3}}{+\num{\fpeval{0-#3}}}$}%
-          \rightcomment{E-\theNbequa}{G-\theNbequa}{E-\theNbequa}{$\xintifboolexpr{#3>0}{-\num{#3}}{+\num{\fpeval{0-#3}}}$}%
-          }{}
-          \xintifboolexpr{\Coeffa=1}{% 
-          }{%\ifnum\cmtd>1
-          \tikzmark{D-\theNbequa}\useKV[ClesEquation]{Lettre}&=\frac{\num{\Coeffb}}{\num{\Coeffa}}\tikzmark{H-\theNbequa}%\\
-          \ifboolKV[ClesEquation]{Fleches}{%
-          \leftcomment{C-\theNbequa}{D-\theNbequa}{A-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%
-          \rightcomment{G-\theNbequa}{H-\theNbequa}{E-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%
-          }{%ICI ?
-          \ifboolKV[ClesEquation]{FlecheDiv}{%
-          \leftcomment{C-\theNbequa}{D-\theNbequa}{A-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%
-          \rightcomment{G-\theNbequa}{H-\theNbequa}{E-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%
-          }{}
-          }
-          }
-          \ifboolKV[ClesEquation]{Entier}{%
-          \SSimpliTest{\Coeffb}{\Coeffa}%
-          \ifboolKV[ClesEquation]{Simplification}{%
-          \ifthenelse{\boolean{Simplification}}{\\\useKV[ClesEquation]{Lettre}&=\SSimplifie{\Coeffb}{\Coeffa}}{}%\\
-          }{}
-          }{}
-          \ifboolKV[ClesEquation]{Fleches}{\stepcounter{Nbequa}}{\ifboolKV[ClesEquation]{FlecheDiv}{\stepcounter{Nbequa}}{}}
-        \end{align*}
-        \ifboolKV[ClesEquation]{Solution}{L'équation $\xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}=\num{#5}$ a une unique solution : \opdiv*{\Coeffb}{\Coeffa}{solution}{resteequa}\opcmp{resteequa}{0}$\useKV[ClesEquation]{Lettre}=\displaystyle\ifopeq\opexport{solution}{\solution}\num{\solution}\else\ifboolKV[ClesEquation]{Entier}{\SSimplifie{\Coeffb}{\Coeffa}}{\frac{\num{\Coeffb}}{\num{\Coeffa}}}\fi$.
-        }{}
-      }
-    }
-  \fi
-}
-
-\newcommand{\EquaTroisSoustraction}[5][]{%ax+b=cx ou ax=cx+d
-  \useKVdefault[ClesEquation]%
-  \setKV[ClesEquation]{#1}%
-  \ifx\bla#3\bla%on inverse en faisant attention à la boucle #3<->#5
-    \ifx\bla#5\bla%
-      %% paramètre oublié
-    \else
-      \EquaTroisSoustraction[#1]{#4}{#5}{#2}{}%
-    \fi
-  \else
-  \xintifboolexpr{#2=0}{%b=cx
-    \EquaBase[#1]{#4}{}{}{#3}
-  }{%
-    \xintifboolexpr{#4=0}{%ax+b=0
-      \EquaDeuxSoustraction[#1]{#2}{#3}{}{0}
-      }{%ax+b=cx
-        \xintifboolexpr{#2=#4}{%
-          \xintifboolexpr{#3=0}{%ax=ax
-            L'équation $\xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}=\xintifboolexpr{#4=1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}$ a une infinité de solution.}%
-          {%ax+b=ax
-            L'équation $\xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}=\xintifboolexpr{#4=1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}$ n'a aucune solution.%
-          }%
-        }{%% Cas délicat
-          \xintifboolexpr{#2>#4}{%ax+b=cx avec a>c
-            \begin{align*}
-              \tikzmark{A-\theNbequa}\xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}&=\xintifboolexpr{#4=1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}\tikzmark{E-\theNbequa}\\
-                \ifboolKV[ClesEquation]{Decomposition}{%
-                \xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\mathcolor{Cdecomp}{\xintifboolexpr{#4>0}{-\num{#4}\useKV[ClesEquation]{Lettre}}{+\num{\fpeval{0-#4}}\useKV[ClesEquation]{Lettre}}}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}&=\xintifboolexpr{#4=1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}\mathcolor{Cdecomp}{\xintifboolexpr{#4>0}{-\num{#4}\useKV[ClesEquation]{Lettre}}{+\num{\fpeval{0-#4}}\useKV[ClesEquation]{Lettre}}}\\
-                }{}
-                \tikzmark{B-\theNbequa}\xdef\Coeffa{\fpeval{#2-#4}}\xintifboolexpr{\Coeffa=1}{}{\num{\Coeffa}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}&=0\tikzmark{F-\theNbequa}\\
-                \ifboolKV[ClesEquation]{Decomposition}{%
-                \xintifboolexpr{\Coeffa=1}{}{\num{\Coeffa}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}\mathcolor{Cdecomp}{\xintifboolexpr{#3>0}{-\num{#3}}{+\num{\fpeval{0-#3}}}}&=0\mathcolor{Cdecomp}{\xintifboolexpr{#3>0}{-\num{#3}}{+\num{\fpeval{0-#3}}}}\tikzmark{F-\theNbequa}\\
-                }{}%
-                \tikzmark{C-\theNbequa}\xdef\Coeffb{\fpeval{0-#3}}\xintifboolexpr{\Coeffa=1}{}{\num{\Coeffa}}\useKV[ClesEquation]{Lettre}&=\num{\Coeffb}\tikzmark{G-\theNbequa}%\\
-                \xintifboolexpr{\Coeffa=1}{}{\\}
-                \ifboolKV[ClesEquation]{Fleches}{%
-                \leftcomment{A-\theNbequa}{B-\theNbequa}{A-\theNbequa}{$\xintifboolexpr{#4>0}{-\num{#4}}{+\num{\fpeval{0-#4}}}\useKV[ClesEquation]{Lettre}$}
-                \rightcomment{E-\theNbequa}{F-\theNbequa}{E-\theNbequa}{$\xintifboolexpr{#4>0}{-\num{#4}}{+\num{\fpeval{0-#4}}}\useKV[ClesEquation]{Lettre}$}
-                \leftcomment{B-\theNbequa}{C-\theNbequa}{A-\theNbequa}{$\xintifboolexpr{#3>0}{-\num{#3}}{+\num{\fpeval{0-#3}}}$}%
-                \rightcomment{F-\theNbequa}{G-\theNbequa}{E-\theNbequa}{$\xintifboolexpr{#3>0}{-\num{#3}}{+\num{\fpeval{0-#3}}}$}%
-                }{}
-                \xintifboolexpr{\Coeffa=1}{}{%\ifnum\cmtd>1
-                \tikzmark{D-\theNbequa}\useKV[ClesEquation]{Lettre}&=\frac{\num{\Coeffb}}{\num{\Coeffa}}\tikzmark{H-\theNbequa}%\\
-                \ifboolKV[ClesEquation]{Fleches}{%
-                \leftcomment{C-\theNbequa}{D-\theNbequa}{A-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%
-                \rightcomment{G-\theNbequa}{H-\theNbequa}{E-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%            
-                }{
-                \ifboolKV[ClesEquation]{FlecheDiv}{%
-                \leftcomment{C-\theNbequa}{D-\theNbequa}{A-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%
-                \rightcomment{G-\theNbequa}{H-\theNbequa}{E-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%                 
-                }{}
-                }
-                \ifboolKV[ClesEquation]{Entier}{%
-                \SSimpliTest{\Coeffb}{\Coeffa}%
-                \ifboolKV[ClesEquation]{Simplification}{%
-                \ifthenelse{\boolean{Simplification}}{\\\useKV[ClesEquation]{Lettre}&=\SSimplifie{\Coeffb}{\Coeffa}}{}%\\
-                }{}
-                }{}
-                }
-                \ifboolKV[ClesEquation]{Fleches}{\stepcounter{Nbequa}}{\ifboolKV[ClesEquation]{FlecheDiv}{\stepcounter{Nbequa}}{}}
-              \end{align*}
-              \ifboolKV[ClesEquation]{Solution}{L'équation $\xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}=\xintifboolexpr{#4=1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}$ a une unique solution : \opdiv*{\Coeffb}{\Coeffa}{solution}{resteequa}\opcmp{resteequa}{0}$\useKV[ClesEquation]{Lettre}=\displaystyle\ifopeq\opexport{solution}{\solution}\num{\solution}\else\ifboolKV[ClesEquation]{Entier}{\SSimplifie{\Coeffb}{\Coeffa}}{\frac{\num{\Coeffb}}{\num{\Coeffa}}}\fi$.}{}
-            }{%ax+b=cx+d avec a<c              % Autre cas délicat
-              \begin{align*}%
-                \tikzmark{A-\theNbequa}\xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}&=\xintifboolexpr{#4=1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}\tikzmark{E-\theNbequa}\\
-                \ifboolKV[ClesEquation]{Decomposition}{%
-                \xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\mathcolor{Cdecomp}{\xintifboolexpr{#2>0}{-\num{#2}\useKV[ClesEquation]{Lettre}}{+\num{\fpeval{0-#2}}\useKV[ClesEquation]{Lettre}}}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}&=\xintifboolexpr{#4=1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}\mathcolor{Cdecomp}{\xintifboolexpr{#2>0}{-\num{#2}\useKV[ClesEquation]{Lettre}}{+\num{\fpeval{0-#2}}\useKV[ClesEquation]{Lettre}}}\\
-                }{}
-                \tikzmark{B-\theNbequa}\xdef\Coeffb{#3}\xdef\Coeffa{\fpeval{#4-#2}}\xintifboolexpr{#3>0}{\num{#3}}{-\num{\fpeval{0-#3}}}&=\xintifboolexpr{\Coeffa=1}{}{\num{\Coeffa}}\useKV[ClesEquation]{Lettre}\tikzmark{F-\theNbequa}
-                \xintifboolexpr{\Coeffa=1}{}{\\}
-                \ifboolKV[ClesEquation]{Fleches}{%
-                \leftcomment{A-\theNbequa}{B-\theNbequa}{A-\theNbequa}{$\xintifboolexpr{#2>0}{-\num{#2}}{+\num{\fpeval{0-#2}}}\useKV[ClesEquation]{Lettre}$}
-                \rightcomment{E-\theNbequa}{F-\theNbequa}{E-\theNbequa}{$\xintifboolexpr{#2>0}{-\num{#2}}{+\num{\fpeval{0-#2}}}\useKV[ClesEquation]{Lettre}$}
-                }{}
-                \xintifboolexpr{\Coeffa=1}{}{%\ifnum\cmtd>1
-                \tikzmark{D-\theNbequa}\frac{\num{\Coeffb}}{\num{\Coeffa}}&=\useKV[ClesEquation]{Lettre}\tikzmark{H-\theNbequa}%\\
-                \ifboolKV[ClesEquation]{Fleches}{%
-                \leftcomment{B-\theNbequa}{D-\theNbequa}{A-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%
-                \rightcomment{F-\theNbequa}{H-\theNbequa}{E-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%            
-                }{
-                \ifboolKV[ClesEquation]{FlecheDiv}{%
-                \leftcomment{B-\theNbequa}{D-\theNbequa}{A-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%
-                \rightcomment{F-\theNbequa}{H-\theNbequa}{E-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%                 
-                }{}
-                }
-                \ifboolKV[ClesEquation]{Entier}{%
-                \SSimpliTest{\Coeffb}{\Coeffa}%
-                \ifboolKV[ClesEquation]{Simplification}{%
-                \ifthenelse{\boolean{Simplification}}{\\\SSimplifie{\Coeffb}{\Coeffa}&=\useKV[ClesEquation]{Lettre}}{}%\\
-                }{}
-                }{}
-                }
-                \ifboolKV[ClesEquation]{Fleches}{\stepcounter{Nbequa}}{\ifboolKV[ClesEquation]{FlecheDiv}{\stepcounter{Nbequa}}{}}
-              \end{align*}
-              \ifboolKV[ClesEquation]{Solution}{L'équation $\xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}=\xintifboolexpr{#4=1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}$ a une unique solution : \opdiv*{\Coeffb}{\Coeffa}{solution}{resteequa}\opcmp{resteequa}{0}$\useKV[ClesEquation]{Lettre}=\displaystyle\ifopeq\opexport{solution}{\solution}\num{\solution}\else\ifboolKV[ClesEquation]{Entier}{\SSimplifie{\Coeffb}{\Coeffa}}{\frac{\num{\Coeffb}}{\num{\Coeffa}}}\fi$.}{}%
-            }%
-          }%
-        }%
-      }%
-    \fi
-  }%
-
-
-\newcommand{\ResolEquationSoustraction}[5][]{%
-  \useKVdefault[ClesEquation]%
-  \setKV[ClesEquation]{#1}%
-  \xintifboolexpr{#2=0}{%
-    \xintifboolexpr{#4=0}{%
-      \xintifboolexpr{#3=#5}{%b=d
-        L'équation $\num{#3}=\num{#5}$ a une infinité de solution.}%
-      {%b<>d
-        L'équation $\num{#3}=\num{#5}$ n'a aucune solution.%
-      }%
-    }%
-    {%0x+b=cx+d$
-      \EquaDeuxSoustraction[#1]{#4}{#5}{}{#3}%
-    }%
-  }{%
-    \xintifboolexpr{#4=0}{%ax+b=0x+d
-      \EquaDeuxSoustraction[#1]{#2}{#3}{}{#5}%
-    }
-    {%ax+b=cx+d$
-      \xintifboolexpr{#3=0}{%
-        \xintifboolexpr{#5=0}{%ax=cx
-          \EquaTroisSoustraction[#1]{#2}{0}{#4}{}%
-        }%
-        {%ax=cx+d
-          \EquaTroisSoustraction[#1]{#4}{#5}{#2}{}%
-        }%
-      }%
-      {\xintifboolexpr{#5=0}{%ax+b=cx
-          \EquaTroisSoustraction[#1]{#2}{#3}{#4}{}%
-        }%
-        {%ax+b=cx+d -- ici
-          \xintifboolexpr{#2=#4}{%
-            \xintifboolexpr{#3=#5}{%b=d
-              L'équation $\xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}=\xintifboolexpr{#4=1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#5>0}{+\num{#5}}{-\num{\fpeval{0-#5}}}$ a une infinité de solution.}%
-            {%b<>d
-              L'équation $\xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}=\xintifboolexpr{#4=1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#5>0}{+\num{#5}}{-\num{\fpeval{0-#5}}}$ n'a aucune solution.%
-            }%
-          }{
-            %% Cas délicat
-            \xintifboolexpr{#2>#4}{%ax+b=cx+d avec a>c
-              \begin{align*}
-                \tikzmark{A-\theNbequa}\xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}&=\xintifboolexpr{#4=1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#5>0}{+\num{#5}}{-\num{\fpeval{0-#5}}}\tikzmark{E-\theNbequa}\\
-                \ifboolKV[ClesEquation]{Decomposition}{%
-                \xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\mathcolor{Cdecomp}{\xintifboolexpr{#4>0}{-\num{#4}\useKV[ClesEquation]{Lettre}}{+\num{\fpeval{0-#4}}\useKV[ClesEquation]{Lettre}}}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}&=\xintifboolexpr{#4=1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}\mathcolor{Cdecomp}{\xintifboolexpr{#4>0}{-\num{#4}\useKV[ClesEquation]{Lettre}}{+\num{\fpeval{0-#4}}\useKV[ClesEquation]{Lettre}}}\xintifboolexpr{#5>0}{+\num{#5}}{-\num{\fpeval{0-#5}}}\\
-                }{}
-                \tikzmark{B-\theNbequa}\xdef\Coeffa{\fpeval{#2-#4}}\xintifboolexpr{\Coeffa=1}{}{\num{\Coeffa}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}&=\num{#5}\tikzmark{F-\theNbequa}\\
-                \ifboolKV[ClesEquation]{Decomposition}{%
-                \xintifboolexpr{\Coeffa=1}{}{\num{\Coeffa}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}\mathcolor{Cdecomp}{\xintifboolexpr{#3>0}{-\num{#3}}{+\num{\fpeval{0-#3}}}}&=\num{#5}\mathcolor{Cdecomp}{\xintifboolexpr{#3>0}{-\num{#3}}{+\num{\fpeval{0-#3}}}}\\
-                }{}%
-                \tikzmark{C-\theNbequa}\xdef\Coeffb{\fpeval{#5-#3}}\xintifboolexpr{\Coeffa=1}{}{\num{\Coeffa}}\useKV[ClesEquation]{Lettre}&=\num{\Coeffb}\tikzmark{G-\theNbequa}%\\
-                \xintifboolexpr{\Coeffa=1}{}{\\}
-                \ifboolKV[ClesEquation]{Fleches}{%
-                \leftcomment{A-\theNbequa}{B-\theNbequa}{A-\theNbequa}{$\xintifboolexpr{#4>0}{-\num{#4}}{+\num{\fpeval{0-#4}}}\useKV[ClesEquation]{Lettre}$}
-                \rightcomment{E-\theNbequa}{F-\theNbequa}{E-\theNbequa}{$\xintifboolexpr{#4>0}{-\num{#4}}{+\num{\fpeval{0-#4}}}\useKV[ClesEquation]{Lettre}$}
-                \leftcomment{B-\theNbequa}{C-\theNbequa}{A-\theNbequa}{$\xintifboolexpr{#3>0}{-\num{#3}}{+\num{\fpeval{0-#3}}}$}%
-                \rightcomment{F-\theNbequa}{G-\theNbequa}{E-\theNbequa}{$\xintifboolexpr{#3>0}{-\num{#3}}{+\num{\fpeval{0-#3}}}$}%
-                }{}
-                \xintifboolexpr{\Coeffa=1}{}{%\ifnum\cmtd>1
-                \tikzmark{D-\theNbequa}\useKV[ClesEquation]{Lettre}&=\frac{\num{\Coeffb}}{\num{\Coeffa}}\tikzmark{H-\theNbequa}%\\
-                \ifboolKV[ClesEquation]{Fleches}{%
-                \leftcomment{C-\theNbequa}{D-\theNbequa}{A-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%
-                \rightcomment{G-\theNbequa}{H-\theNbequa}{E-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%            
-                }{
-                \ifboolKV[ClesEquation]{FlecheDiv}{%
-                \leftcomment{C-\theNbequa}{D-\theNbequa}{A-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%
-                \rightcomment{G-\theNbequa}{H-\theNbequa}{E-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%                 
-                }{}
-                }
-                \ifboolKV[ClesEquation]{Entier}{%
-                \SSimpliTest{\Coeffb}{\Coeffa}%
-                \ifboolKV[ClesEquation]{Simplification}{%
-                \ifthenelse{\boolean{Simplification}}{\\\useKV[ClesEquation]{Lettre}&=\SSimplifie{\Coeffb}{\Coeffa}}{}%\\
-                }{}
-                }{}
-                }
-                \ifboolKV[ClesEquation]{Fleches}{\stepcounter{Nbequa}}{\ifboolKV[ClesEquation]{FlecheDiv}{\stepcounter{Nbequa}}{}}
-              \end{align*}
-              \ifboolKV[ClesEquation]{Solution}{L'équation $\xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}=\xintifboolexpr{#4=1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#5>0}{+\num{#5}}{-\num{\fpeval{0-#5}}}$ a une unique solution : \opdiv*{\Coeffb}{\Coeffa}{solution}{resteequa}\opcmp{resteequa}{0}$\useKV[ClesEquation]{Lettre}=\displaystyle\ifopeq\opexport{solution}{\solution}\num{\solution}\else\ifboolKV[ClesEquation]{Entier}{\SSimplifie{\Coeffb}{\Coeffa}}{\frac{\num{\Coeffb}}{\num{\Coeffa}}}\fi$.%
-              }{}
-            }{%ax+b=cx+d avec a<c              % Autre cas délicat
-              \begin{align*}%
-                \tikzmark{A-\theNbequa}\xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}&=\xintifboolexpr{#4=1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#5>0}{+\num{#5}}{-\num{\fpeval{0-#5}}}\tikzmark{E-\theNbequa}\\
-                \ifboolKV[ClesEquation]{Decomposition}{%
-                \xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\mathcolor{Cdecomp}{\xintifboolexpr{#2>0}{-\num{#2}\useKV[ClesEquation]{Lettre}}{+\num{\fpeval{0-#2}}\useKV[ClesEquation]{Lettre}}}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}&=\xintifboolexpr{#4=1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}\mathcolor{Cdecomp}{\xintifboolexpr{#2>0}{-\num{#2}\useKV[ClesEquation]{Lettre}}{+\num{\fpeval{0-#2}}\useKV[ClesEquation]{Lettre}}}\xintifboolexpr{#5>0}{+\num{#5}}{-\num{\fpeval{0-#5}}}\\
-                }{}
-                \tikzmark{B-\theNbequa}\xdef\Coeffa{\fpeval{#4-#2}}\xintifboolexpr{#3>0}{\num{#3}}{-\num{\fpeval{0-#3}}}&=\xintifboolexpr{\Coeffa=1}{}{\num{\Coeffa}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#5>0}{+\num{#5}}{-\num{\fpeval{0-#5}}}\tikzmark{F-\theNbequa}\\
-                \ifboolKV[ClesEquation]{Decomposition}{%
-                \num{#3}\mathcolor{Cdecomp}{\xintifboolexpr{#5>0}{-\num{#5}}{+\num{\fpeval{0-#5}}}}&=\xintifboolexpr{\Coeffa=1}{}{\num{\Coeffa}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#5>0}{+\num{#5}}{-\num{\fpeval{0-#5}}}\mathcolor{Cdecomp}{\xintifboolexpr{#5>0}{-\num{#5}}{+\num{\fpeval{0-#5}}}}\\
-                }{}%
-                \tikzmark{C-\theNbequa}\xdef\Coeffb{\fpeval{#3-#5}}\num{\Coeffb}&=\xintifboolexpr{\Coeffa=1}{}{\num{\Coeffa}}\useKV[ClesEquation]{Lettre}\tikzmark{G-\theNbequa}%\\
-                \xintifboolexpr{\Coeffa=1}{}{\\}
-                \ifboolKV[ClesEquation]{Fleches}{%
-                \leftcomment{A-\theNbequa}{B-\theNbequa}{A-\theNbequa}{$\xintifboolexpr{#2>0}{-\num{#2}}{+\num{\fpeval{0-#2}}}\useKV[ClesEquation]{Lettre}$}
-                \rightcomment{E-\theNbequa}{F-\theNbequa}{E-\theNbequa}{$\xintifboolexpr{#2>0}{-\num{#2}}{+\num{\fpeval{0-#2}}}\useKV[ClesEquation]{Lettre}$}
-                \leftcomment{B-\theNbequa}{C-\theNbequa}{A-\theNbequa}{$\xintifboolexpr{#5>0}{-\num{#5}}{+\num{\fpeval{0-#5}}}$}%
-                \rightcomment{F-\theNbequa}{G-\theNbequa}{E-\theNbequa}{$\xintifboolexpr{#5>0}{-\num{#5}}{+\num{\fpeval{0-#5}}}$}%
-                }{}
-                \xintifboolexpr{\Coeffa=1}{}{%\ifnum\cmtd>1
-                \tikzmark{D-\theNbequa}\frac{\num{\Coeffb}}{\num{\Coeffa}}&=\useKV[ClesEquation]{Lettre}\tikzmark{H-\theNbequa}%\\
-                \ifboolKV[ClesEquation]{Fleches}{%
-                \leftcomment{C-\theNbequa}{D-\theNbequa}{A-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%
-                \rightcomment{G-\theNbequa}{H-\theNbequa}{E-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%            
-                }{
-                \ifboolKV[ClesEquation]{FlecheDiv}{%
-                \leftcomment{C-\theNbequa}{D-\theNbequa}{A-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%
-                \rightcomment{G-\theNbequa}{H-\theNbequa}{E-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%                 
-                }{}
-                }
-                \ifboolKV[ClesEquation]{Entier}{%
-                \SSimpliTest{\Coeffb}{\Coeffa}%
-                \ifboolKV[ClesEquation]{Simplification}{%
-                \ifthenelse{\boolean{Simplification}}{\\\SSimplifie{\Coeffb}{\Coeffa}&=\useKV[ClesEquation]{Lettre}}{}%\\
-                }{}
-                }{}
-                }
-                \ifboolKV[ClesEquation]{Fleches}{\stepcounter{Nbequa}}{\ifboolKV[ClesEquation]{FlecheDiv}{\stepcounter{Nbequa}}{}}
-              \end{align*}
-              \ifboolKV[ClesEquation]{Solution}{L'équation $\xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}=\xintifboolexpr{#4=1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#5>0}{+\num{#5}}{-\num{\fpeval{0-#5}}}$ a une unique solution : \opdiv*{\Coeffb}{\Coeffa}{solution}{resteequa}\opcmp{resteequa}{0}$\useKV[ClesEquation]{Lettre}=\displaystyle\ifopeq\opexport{solution}{\solution}\num{\solution}\else\ifboolKV[ClesEquation]{Entier}{\SSimplifie{\Coeffb}{\Coeffa}}{\frac{\num{\Coeffb}}{\num{\Coeffa}}}\fi$.%
-              }{}%
-            }%
-          }%
-        }%
-      }%
-    }%
-  }%
-}%
-
-

Added: trunk/Master/texmf-dist/tex/latex/profcollege/PfC-EquationSoustraction2.tex
===================================================================
--- trunk/Master/texmf-dist/tex/latex/profcollege/PfC-EquationSoustraction2.tex	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/profcollege/PfC-EquationSoustraction2.tex	2021-03-14 22:52:07 UTC (rev 58351)
@@ -0,0 +1,345 @@
+% Licence    : Released under the LaTeX Project Public License v1.3c
+% or later, see http://www.latex-project.org/lppl.txtf
+\newcommand{\EquaBase}[5][]{%type ax=d ou b=cx
+  \useKVdefault[ClesEquation]%
+  \setKV[ClesEquation]{#1}%
+  \ifx\bla#2\bla%on teste si le paramètre #2 est vide:
+  % si oui, on est dans le cas b=cx. Eh bien on échange :)
+  % Mais attention si les deux paramètres a et c sont vides...
+  \EquaBase[#1]{#4}{}{}{#3}
+  \else
+  % si non, on est dans le cas ax=d
+  \xintifboolexpr{#2=0}{%
+    \xintifboolexpr{#5=0}{%
+      L'équation $0\useKV[ClesEquation]{ELettre}=0$ a une infinité de solutions.}{L'équation $0\useKV[ClesEquation]{Lettre}=\num{#5}$ n'a aucune solution.}%
+  }{%\else
+    \xintifboolexpr{#5=0}{L'équation $\num{#2}\useKV[ClesEquation]{Lettre}=0$ a une unique solution : $\useKV[ClesEquation]{Lettre}=0$.}{%\else
+      \begin{align*}%
+        \tikzmark{A-\theNbequa}\xintifboolexpr{#2=1}{\useKV[ClesEquation]{Lettre}}{\num{#2}\useKV[ClesEquation]{Lettre}}&=\num{#5}\tikzmark{C-\theNbequa}\\
+        \tikzmark{B-\theNbequa}\useKV[ClesEquation]{Lettre}&=\frac{\num{#5}}{\num{#2}}\tikzmark{D-\theNbequa}%\\
+        \ifboolKV[ClesEquation]{Fleches}{%
+        \leftcomment{A-\theNbequa}{B-\theNbequa}{A-\theNbequa}{$\div\xintifboolexpr{#2<0}{(\num{#2})}{\num{#2}}$}%
+        \rightcomment{C-\theNbequa}{D-\theNbequa}{D-\theNbequa}{$\div\xintifboolexpr{#2<0}{(\num{#2})}{\num{#2}}$}%
+        }{%
+        \ifboolKV[ClesEquation]{FlecheDiv}{%
+        \Leftcomment{A-\theNbequa}{B-\theNbequa}{A-\theNbequa}{$\div\xintifboolexpr{#2<0}{(\num{#2})}{\num{#2}}$}%
+        \Rightcomment{C-\theNbequa}{D-\theNbequa}{D-\theNbequa}{$\div\xintifboolexpr{#2<0}{(\num{#2})}{\num{#2}}$}%
+        }{}%
+        }%%
+        \ifboolKV[ClesEquation]{Entier}{%
+        \SSimpliTest{#5}{#2}%
+        \ifboolKV[ClesEquation]{Simplification}{%
+        \ifthenelse{\boolean{Simplification}}{\\\useKV[ClesEquation]{Lettre}&=\SSimplifie{#5}{#2}}{}%\\
+        }{}
+        }{}
+        \ifboolKV[ClesEquation]{Fleches}{%
+        \stepcounter{Nbequa}}%
+        {\ifboolKV[ClesEquation]{FlecheDiv}{\stepcounter{Nbequa}}{}
+        }
+      \end{align*}
+      \ifboolKV[ClesEquation]{Solution}{L'équation $\xintifboolexpr{#2=1}{\useKV[ClesEquation]{Lettre}=\num{#5}}{\num{#2}\useKV[ClesEquation]{Lettre}=\num{#5}}$ a une unique solution : $\displaystyle\ifboolKV[ClesEquation]{LettreSol}{\useKV[ClesEquation]{Lettre}=}{}\opdiv*{#5}{#2}{numequa}{resteequa}\opcmp{resteequa}{0}\ifopeq\opexport{numequa}{\numequa}\num{\numequa}\else\ifboolKV[ClesEquation]{Simplification}{\SSimplifie{#5}{#2}}{\frac{\num{#5}}{\num{#2}}}\fi$.%
+      }{}
+    }
+  }
+  \fi
+}
+
+\newcommand{\EquaDeuxSoustraction}[5][]{%type ax+b=d ou b=cx+d$
+  \useKVdefault[ClesEquation]%
+  \setKV[ClesEquation]{#1}%
+  \ifx\bla#2\bla%On échange en faisant attention à ne pas boucler : c doit être non vide
+    \EquaDeuxSoustraction[#1]{#4}{#5}{#2}{#3}
+  \else%cas ax+b=d
+    \xintifboolexpr{#2=0}{%
+      \xintifboolexpr{#3=#5}{%b=d
+        L'équation $\num{#3}=\num{#5}$ a une infinité de solutions.}%
+      {%b<>d
+        L'équation $\num{#3}=\num{#5}$ n'a aucune solution.%
+      }%
+    }{%ELSE
+      \xintifboolexpr{#3=0}{%ax+b=d
+        \EquaBase[#1]{#2}{}{}{#5}%
+      }{%ax+b=d$ Ici
+        \begin{align*}
+          \tikzmark{A-\theNbequa}\xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}&=\num{#5}\tikzmark{E-\theNbequa}\\
+          \ifboolKV[ClesEquation]{Decomposition}{%
+          \xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}\mathcolor{Cdecomp}{\xintifboolexpr{#3>0}{-\num{#3}}{+\num{\fpeval{0-#3}}}}&=\num{#5}\mathcolor{Cdecomp}{\xintifboolexpr{#3>0}{-\num{#3}}{+\num{\fpeval{0-#3}}}}\\
+          }{}%
+          \tikzmark{C-\theNbequa}\xdef\Coeffa{#2}\xdef\Coeffb{\fpeval{#5-#3}}\xintifboolexpr{\Coeffa=1}{}{\num{\Coeffa}}\useKV[ClesEquation]{Lettre}&=\num{\Coeffb}\tikzmark{G-\theNbequa}
+          \ifboolKV[ClesEquation]{Decomposition}{\\\xintifboolexpr{\Coeffa=1}{}{\frac{\num{\Coeffa}}{\mathcolor{Cdecomp}{\num{\Coeffa}}}\useKV[ClesEquation]{Lettre}&=\frac{\num{\Coeffb}}{\mathcolor{Cdecomp}{\num{\Coeffa}}}}}{}
+          \xintifboolexpr{\Coeffa=1}{}{\\}
+          \ifboolKV[ClesEquation]{Fleches}{%
+          \leftcomment{A-\theNbequa}{C-\theNbequa}{A-\theNbequa}{$\xintifboolexpr{#3>0}{-\num{#3}}{+\num{\fpeval{0-#3}}}$}%
+          \rightcomment{E-\theNbequa}{G-\theNbequa}{E-\theNbequa}{$\xintifboolexpr{#3>0}{-\num{#3}}{+\num{\fpeval{0-#3}}}$}%
+          }{}
+          \xintifboolexpr{\Coeffa=1}{% 
+          }{%\ifnum\cmtd>1
+          \tikzmark{D-\theNbequa}\useKV[ClesEquation]{Lettre}&=\frac{\num{\Coeffb}}{\num{\Coeffa}}\tikzmark{H-\theNbequa}%\\
+          \ifboolKV[ClesEquation]{Fleches}{%
+          \leftcomment{C-\theNbequa}{D-\theNbequa}{A-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%
+          \rightcomment{G-\theNbequa}{H-\theNbequa}{E-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%
+          }{%ICI ?
+          \ifboolKV[ClesEquation]{FlecheDiv}{%
+          \leftcomment{C-\theNbequa}{D-\theNbequa}{A-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%
+          \rightcomment{G-\theNbequa}{H-\theNbequa}{E-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%
+          }{}
+          }
+          }
+          \ifboolKV[ClesEquation]{Entier}{%
+          \SSimpliTest{\Coeffb}{\Coeffa}%
+          \ifboolKV[ClesEquation]{Simplification}{%
+          \ifthenelse{\boolean{Simplification}}{\\\useKV[ClesEquation]{Lettre}&=\SSimplifie{\Coeffb}{\Coeffa}}{}%\\
+          }{}
+          }{}
+          \ifboolKV[ClesEquation]{Fleches}{\stepcounter{Nbequa}}{\ifboolKV[ClesEquation]{FlecheDiv}{\stepcounter{Nbequa}}{}}
+        \end{align*}
+        \ifboolKV[ClesEquation]{Solution}{L'équation $\xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}=\num{#5}$ a une unique solution : \opdiv*{\Coeffb}{\Coeffa}{solution}{resteequa}\opcmp{resteequa}{0}$\ifboolKV[ClesEquation]{LettreSol}{\useKV[ClesEquation]{Lettre}=}{}\displaystyle\ifopeq\opexport{solution}{\solution}\num{\solution}\else\ifboolKV[ClesEquation]{Entier}{\SSimplifie{\Coeffb}{\Coeffa}}{\frac{\num{\Coeffb}}{\num{\Coeffa}}}\fi$.
+        }{}
+      }
+    }
+  \fi
+}
+
+\newcommand{\EquaTroisSoustraction}[5][]{%ax+b=cx ou ax=cx+d
+  \useKVdefault[ClesEquation]%
+  \setKV[ClesEquation]{#1}%
+  \ifx\bla#3\bla%on inverse en faisant attention à la boucle #3<->#5
+    \ifx\bla#5\bla%
+      %% paramètre oublié
+    \else
+      \EquaTroisSoustraction[#1]{#4}{#5}{#2}{}%
+    \fi
+  \else
+  \xintifboolexpr{#2=0}{%b=cx
+    \EquaBase[#1]{#4}{}{}{#3}
+  }{%
+    \xintifboolexpr{#4=0}{%ax+b=0
+      \EquaDeuxSoustraction[#1]{#2}{#3}{}{0}
+      }{%ax+b=cx
+        \xintifboolexpr{#2=#4}{%
+          \xintifboolexpr{#3=0}{%ax=ax
+            L'équation $\xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}=\xintifboolexpr{#4=1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}$ a une infinité de solutions.}%
+          {%ax+b=ax
+            L'équation $\xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}=\xintifboolexpr{#4=1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}$ n'a aucune solution.%
+          }%
+        }{%% Cas délicat
+          \xintifboolexpr{#2>#4}{%ax+b=cx avec a>c
+            \begin{align*}
+              \tikzmark{A-\theNbequa}\xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}&=\xintifboolexpr{#4=1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}\tikzmark{E-\theNbequa}\\
+                \ifboolKV[ClesEquation]{Decomposition}{%
+                \xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\mathcolor{Cdecomp}{\xintifboolexpr{#4>0}{-\num{#4}\useKV[ClesEquation]{Lettre}}{+\num{\fpeval{0-#4}}\useKV[ClesEquation]{Lettre}}}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}&=\xintifboolexpr{#4=1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}\mathcolor{Cdecomp}{\xintifboolexpr{#4>0}{-\num{#4}\useKV[ClesEquation]{Lettre}}{+\num{\fpeval{0-#4}}\useKV[ClesEquation]{Lettre}}}\\
+                }{}
+                \tikzmark{B-\theNbequa}\xdef\Coeffa{\fpeval{#2-#4}}\xintifboolexpr{\Coeffa=1}{}{\num{\Coeffa}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}&=0\tikzmark{F-\theNbequa}\\
+                \ifboolKV[ClesEquation]{Decomposition}{%
+                \xintifboolexpr{\Coeffa=1}{}{\num{\Coeffa}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}\mathcolor{Cdecomp}{\xintifboolexpr{#3>0}{-\num{#3}}{+\num{\fpeval{0-#3}}}}&=0\mathcolor{Cdecomp}{\xintifboolexpr{#3>0}{-\num{#3}}{+\num{\fpeval{0-#3}}}}\tikzmark{F-\theNbequa}\\
+                }{}%
+              \tikzmark{C-\theNbequa}\xdef\Coeffb{\fpeval{0-#3}}\xintifboolexpr{\Coeffa=1}{}{\num{\Coeffa}}\useKV[ClesEquation]{Lettre}&=\num{\Coeffb}\tikzmark{G-\theNbequa}%\\
+              %eric
+              \ifboolKV[ClesEquation]{Decomposition}{\\\xintifboolexpr{\Coeffa=1}{}{\frac{\num{\Coeffa}}{\mathcolor{Cdecomp}{\num{\Coeffa}}}\useKV[ClesEquation]{Lettre}&=\frac{\num{\Coeffb}}{\mathcolor{Cdecomp}{\num{\Coeffa}}}}}{}
+              % eric
+                \xintifboolexpr{\Coeffa=1}{}{\\}
+                \ifboolKV[ClesEquation]{Fleches}{%
+                \leftcomment{A-\theNbequa}{B-\theNbequa}{A-\theNbequa}{$\xintifboolexpr{#4>0}{-\num{#4}}{+\num{\fpeval{0-#4}}}\useKV[ClesEquation]{Lettre}$}
+                \rightcomment{E-\theNbequa}{F-\theNbequa}{E-\theNbequa}{$\xintifboolexpr{#4>0}{-\num{#4}}{+\num{\fpeval{0-#4}}}\useKV[ClesEquation]{Lettre}$}
+                \leftcomment{B-\theNbequa}{C-\theNbequa}{A-\theNbequa}{$\xintifboolexpr{#3>0}{-\num{#3}}{+\num{\fpeval{0-#3}}}$}%
+                \rightcomment{F-\theNbequa}{G-\theNbequa}{E-\theNbequa}{$\xintifboolexpr{#3>0}{-\num{#3}}{+\num{\fpeval{0-#3}}}$}%
+                }{}
+                \xintifboolexpr{\Coeffa=1}{}{%\ifnum\cmtd>1
+                \tikzmark{D-\theNbequa}\useKV[ClesEquation]{Lettre}&=\frac{\num{\Coeffb}}{\num{\Coeffa}}\tikzmark{H-\theNbequa}%\\
+                \ifboolKV[ClesEquation]{Fleches}{%
+                \leftcomment{C-\theNbequa}{D-\theNbequa}{A-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%
+                \rightcomment{G-\theNbequa}{H-\theNbequa}{E-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%            
+                }{
+                \ifboolKV[ClesEquation]{FlecheDiv}{%
+                \leftcomment{C-\theNbequa}{D-\theNbequa}{A-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%
+                \rightcomment{G-\theNbequa}{H-\theNbequa}{E-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%                 
+                }{}
+                }
+                \ifboolKV[ClesEquation]{Entier}{%
+                \SSimpliTest{\Coeffb}{\Coeffa}%
+                \ifboolKV[ClesEquation]{Simplification}{%
+                \ifthenelse{\boolean{Simplification}}{\\\useKV[ClesEquation]{Lettre}&=\SSimplifie{\Coeffb}{\Coeffa}}{}%\\
+                }{}
+                }{}
+                }
+                \ifboolKV[ClesEquation]{Fleches}{\stepcounter{Nbequa}}{\ifboolKV[ClesEquation]{FlecheDiv}{\stepcounter{Nbequa}}{}}
+              \end{align*}
+              \ifboolKV[ClesEquation]{Solution}{L'équation $\xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}=\xintifboolexpr{#4=1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}$ a une unique solution : \opdiv*{\Coeffb}{\Coeffa}{solution}{resteequa}\opcmp{resteequa}{0}$\ifboolKV[ClesEquation]{LettreSol}{\useKV[ClesEquation]{Lettre}=}{}\displaystyle\ifopeq\opexport{solution}{\solution}\num{\solution}\else\ifboolKV[ClesEquation]{Entier}{\SSimplifie{\Coeffb}{\Coeffa}}{\frac{\num{\Coeffb}}{\num{\Coeffa}}}\fi$.}{}
+            }{%ax+b=cx+d avec a<c              % Autre cas délicat
+              \begin{align*}%
+                \tikzmark{A-\theNbequa}\xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}&=\xintifboolexpr{#4=1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}\tikzmark{E-\theNbequa}\\
+                \ifboolKV[ClesEquation]{Decomposition}{%
+                \xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\mathcolor{Cdecomp}{\xintifboolexpr{#2>0}{-\num{#2}\useKV[ClesEquation]{Lettre}}{+\num{\fpeval{0-#2}}\useKV[ClesEquation]{Lettre}}}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}&=\xintifboolexpr{#4=1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}\mathcolor{Cdecomp}{\xintifboolexpr{#2>0}{-\num{#2}\useKV[ClesEquation]{Lettre}}{+\num{\fpeval{0-#2}}\useKV[ClesEquation]{Lettre}}}\\
+                }{}
+                \tikzmark{B-\theNbequa}\xdef\Coeffb{#3}\xdef\Coeffa{\fpeval{#4-#2}}\xintifboolexpr{#3>0}{\num{#3}}{-\num{\fpeval{0-#3}}}&=\xintifboolexpr{\Coeffa=1}{}{\num{\Coeffa}}\useKV[ClesEquation]{Lettre}\tikzmark{F-\theNbequa}
+                \xintifboolexpr{\Coeffa=1}{}{\\}
+                \ifboolKV[ClesEquation]{Fleches}{%
+                \leftcomment{A-\theNbequa}{B-\theNbequa}{A-\theNbequa}{$\xintifboolexpr{#2>0}{-\num{#2}}{+\num{\fpeval{0-#2}}}\useKV[ClesEquation]{Lettre}$}
+                \rightcomment{E-\theNbequa}{F-\theNbequa}{E-\theNbequa}{$\xintifboolexpr{#2>0}{-\num{#2}}{+\num{\fpeval{0-#2}}}\useKV[ClesEquation]{Lettre}$}
+                }{}
+                % eric
+                \ifboolKV[ClesEquation]{Decomposition}{\\\xintifboolexpr{\Coeffa=1}{}{\frac{\num{\Coeffb}}{\mathcolor{Cdecomp}{\num{\Coeffa}}}&=\frac{\num{\Coeffa}}{\mathcolor{Cdecomp}{\num{\Coeffa}}}\useKV[ClesEquation]{Lettre}}}{}
+                % eric
+                \xintifboolexpr{\Coeffa=1}{}{%\ifnum\cmtd>1
+                \tikzmark{D-\theNbequa}\frac{\num{\Coeffb}}{\num{\Coeffa}}&=\useKV[ClesEquation]{Lettre}\tikzmark{H-\theNbequa}%\\
+                \ifboolKV[ClesEquation]{Fleches}{%
+                \leftcomment{B-\theNbequa}{D-\theNbequa}{A-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%
+                \rightcomment{F-\theNbequa}{H-\theNbequa}{E-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%            
+                }{
+                \ifboolKV[ClesEquation]{FlecheDiv}{%
+                \leftcomment{B-\theNbequa}{D-\theNbequa}{A-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%
+                \rightcomment{F-\theNbequa}{H-\theNbequa}{E-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%                 
+                }{}
+                }
+                \ifboolKV[ClesEquation]{Entier}{%
+                \SSimpliTest{\Coeffb}{\Coeffa}%
+                \ifboolKV[ClesEquation]{Simplification}{%
+                \ifthenelse{\boolean{Simplification}}{\\\SSimplifie{\Coeffb}{\Coeffa}&=\useKV[ClesEquation]{Lettre}}{}%\\
+                }{}
+                }{}
+                }
+                \ifboolKV[ClesEquation]{Fleches}{\stepcounter{Nbequa}}{\ifboolKV[ClesEquation]{FlecheDiv}{\stepcounter{Nbequa}}{}}
+              \end{align*}
+              \ifboolKV[ClesEquation]{Solution}{L'équation $\xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}=\xintifboolexpr{#4=1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}$ a une unique solution : \opdiv*{\Coeffb}{\Coeffa}{solution}{resteequa}\opcmp{resteequa}{0}$\ifboolKV[ClesEquation]{LettreSol}{\useKV[ClesEquation]{Lettre}=}{}\displaystyle\ifopeq\opexport{solution}{\solution}\num{\solution}\else\ifboolKV[ClesEquation]{Entier}{\SSimplifie{\Coeffb}{\Coeffa}}{\frac{\num{\Coeffb}}{\num{\Coeffa}}}\fi$.}{}%
+            }%
+          }%
+        }%
+      }%
+    \fi
+  }%
+
+
+\newcommand{\ResolEquationSoustraction}[5][]{%
+  \useKVdefault[ClesEquation]%
+  \setKV[ClesEquation]{#1}%
+  \xintifboolexpr{#2=0}{%
+    \xintifboolexpr{#4=0}{%
+      \xintifboolexpr{#3=#5}{%b=d
+        L'équation $\num{#3}=\num{#5}$ a une infinité de solutions.}%
+      {%b<>d
+        L'équation $\num{#3}=\num{#5}$ n'a aucune solution.%
+      }%
+    }%
+    {%0x+b=cx+d$
+      \EquaDeuxSoustraction[#1]{#4}{#5}{}{#3}%
+    }%
+  }{%
+    \xintifboolexpr{#4=0}{%ax+b=0x+d
+      \EquaDeuxSoustraction[#1]{#2}{#3}{}{#5}%
+    }
+    {%ax+b=cx+d$
+      \xintifboolexpr{#3=0}{%
+        \xintifboolexpr{#5=0}{%ax=cx
+          \EquaTroisSoustraction[#1]{#2}{0}{#4}{}%
+        }%
+        {%ax=cx+d
+          \EquaTroisSoustraction[#1]{#4}{#5}{#2}{}%
+        }%
+      }%
+      {\xintifboolexpr{#5=0}{%ax+b=cx
+          \EquaTroisSoustraction[#1]{#2}{#3}{#4}{}%
+        }%
+        {%ax+b=cx+d -- ici
+          \xintifboolexpr{#2=#4}{%
+            \xintifboolexpr{#3=#5}{%b=d
+              L'équation $\xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}=\xintifboolexpr{#4=1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#5>0}{+\num{#5}}{-\num{\fpeval{0-#5}}}$ a une infinité de solutions.}%
+            {%b<>d
+              L'équation $\xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}=\xintifboolexpr{#4=1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#5>0}{+\num{#5}}{-\num{\fpeval{0-#5}}}$ n'a aucune solution.%
+            }%
+          }{
+            %% Cas délicat
+            \xintifboolexpr{#2>#4}{%ax+b=cx+d avec a>c
+              \begin{align*}
+                \tikzmark{A-\theNbequa}\xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}&=\xintifboolexpr{#4=1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#5>0}{+\num{#5}}{-\num{\fpeval{0-#5}}}\tikzmark{E-\theNbequa}\\
+                \ifboolKV[ClesEquation]{Decomposition}{%
+                \xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\mathcolor{Cdecomp}{\xintifboolexpr{#4>0}{-\num{#4}\useKV[ClesEquation]{Lettre}}{+\num{\fpeval{0-#4}}\useKV[ClesEquation]{Lettre}}}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}&=\xintifboolexpr{#4=1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}\mathcolor{Cdecomp}{\xintifboolexpr{#4>0}{-\num{#4}\useKV[ClesEquation]{Lettre}}{+\num{\fpeval{0-#4}}\useKV[ClesEquation]{Lettre}}}\xintifboolexpr{#5>0}{+\num{#5}}{-\num{\fpeval{0-#5}}}\\
+                }{}
+                \tikzmark{B-\theNbequa}\xdef\Coeffa{\fpeval{#2-#4}}\xintifboolexpr{\Coeffa=1}{}{\num{\Coeffa}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}&=\num{#5}\tikzmark{F-\theNbequa}\\
+                \ifboolKV[ClesEquation]{Decomposition}{%
+                \xintifboolexpr{\Coeffa=1}{}{\num{\Coeffa}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}\mathcolor{Cdecomp}{\xintifboolexpr{#3>0}{-\num{#3}}{+\num{\fpeval{0-#3}}}}&=\num{#5}\mathcolor{Cdecomp}{\xintifboolexpr{#3>0}{-\num{#3}}{+\num{\fpeval{0-#3}}}}\\
+                }{}%
+                \tikzmark{C-\theNbequa}\xdef\Coeffb{\fpeval{#5-#3}}\xintifboolexpr{\Coeffa=1}{}{\num{\Coeffa}}\useKV[ClesEquation]{Lettre}&=\num{\Coeffb}\tikzmark{G-\theNbequa}%\\
+                % eric
+                \ifboolKV[ClesEquation]{Decomposition}{\\\xintifboolexpr{\Coeffa=1}{}{\frac{\num{\Coeffa}}{\mathcolor{Cdecomp}{\num{\Coeffa}}}\useKV[ClesEquation]{Lettre}&=\frac{\num{\Coeffb}}{\mathcolor{Cdecomp}{\num{\Coeffa}}}}}{}
+                % eric
+                \xintifboolexpr{\Coeffa=1}{}{\\}
+                \ifboolKV[ClesEquation]{Fleches}{%
+                \leftcomment{A-\theNbequa}{B-\theNbequa}{A-\theNbequa}{$\xintifboolexpr{#4>0}{-\num{#4}}{+\num{\fpeval{0-#4}}}\useKV[ClesEquation]{Lettre}$}
+                \rightcomment{E-\theNbequa}{F-\theNbequa}{E-\theNbequa}{$\xintifboolexpr{#4>0}{-\num{#4}}{+\num{\fpeval{0-#4}}}\useKV[ClesEquation]{Lettre}$}
+                \leftcomment{B-\theNbequa}{C-\theNbequa}{A-\theNbequa}{$\xintifboolexpr{#3>0}{-\num{#3}}{+\num{\fpeval{0-#3}}}$}%
+                \rightcomment{F-\theNbequa}{G-\theNbequa}{E-\theNbequa}{$\xintifboolexpr{#3>0}{-\num{#3}}{+\num{\fpeval{0-#3}}}$}%
+                }{}
+                \xintifboolexpr{\Coeffa=1}{}{%\ifnum\cmtd>1
+                \tikzmark{D-\theNbequa}\useKV[ClesEquation]{Lettre}&=\frac{\num{\Coeffb}}{\num{\Coeffa}}\tikzmark{H-\theNbequa}%\\
+                \ifboolKV[ClesEquation]{Fleches}{%
+                \leftcomment{C-\theNbequa}{D-\theNbequa}{A-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%
+                \rightcomment{G-\theNbequa}{H-\theNbequa}{E-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%            
+                }{
+                \ifboolKV[ClesEquation]{FlecheDiv}{%
+                \leftcomment{C-\theNbequa}{D-\theNbequa}{A-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%
+                \rightcomment{G-\theNbequa}{H-\theNbequa}{E-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%                 
+                }{}
+                }
+                \ifboolKV[ClesEquation]{Entier}{%
+                \SSimpliTest{\Coeffb}{\Coeffa}%
+                \ifboolKV[ClesEquation]{Simplification}{%
+                \ifthenelse{\boolean{Simplification}}{\\\useKV[ClesEquation]{Lettre}&=\SSimplifie{\Coeffb}{\Coeffa}}{}%\\
+                }{}
+                }{}
+                }
+                \ifboolKV[ClesEquation]{Fleches}{\stepcounter{Nbequa}}{\ifboolKV[ClesEquation]{FlecheDiv}{\stepcounter{Nbequa}}{}}
+              \end{align*}
+              \ifboolKV[ClesEquation]{Solution}{L'équation $\xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}=\xintifboolexpr{#4=1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#5>0}{+\num{#5}}{-\num{\fpeval{0-#5}}}$ a une unique solution : \opdiv*{\Coeffb}{\Coeffa}{solution}{resteequa}\opcmp{resteequa}{0}$\ifboolKV[ClesEquation]{LettreSol}{\useKV[ClesEquation]{Lettre}=}{}\displaystyle\ifopeq\opexport{solution}{\solution}\num{\solution}\else\ifboolKV[ClesEquation]{Entier}{\SSimplifie{\Coeffb}{\Coeffa}}{\frac{\num{\Coeffb}}{\num{\Coeffa}}}\fi$.%
+              }{}
+            }{%ax+b=cx+d avec a<c              % Autre cas délicat
+              \begin{align*}%
+                \tikzmark{A-\theNbequa}\xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}&=\xintifboolexpr{#4=1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#5>0}{+\num{#5}}{-\num{\fpeval{0-#5}}}\tikzmark{E-\theNbequa}\\
+                \ifboolKV[ClesEquation]{Decomposition}{%
+                \xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\mathcolor{Cdecomp}{\xintifboolexpr{#2>0}{-\num{#2}\useKV[ClesEquation]{Lettre}}{+\num{\fpeval{0-#2}}\useKV[ClesEquation]{Lettre}}}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}&=\xintifboolexpr{#4=1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}\mathcolor{Cdecomp}{\xintifboolexpr{#2>0}{-\num{#2}\useKV[ClesEquation]{Lettre}}{+\num{\fpeval{0-#2}}\useKV[ClesEquation]{Lettre}}}\xintifboolexpr{#5>0}{+\num{#5}}{-\num{\fpeval{0-#5}}}\\
+                }{}
+                \tikzmark{B-\theNbequa}\xdef\Coeffa{\fpeval{#4-#2}}\xintifboolexpr{#3>0}{\num{#3}}{-\num{\fpeval{0-#3}}}&=\xintifboolexpr{\Coeffa=1}{}{\num{\Coeffa}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#5>0}{+\num{#5}}{-\num{\fpeval{0-#5}}}\tikzmark{F-\theNbequa}\\
+                \ifboolKV[ClesEquation]{Decomposition}{%
+                \num{#3}\mathcolor{Cdecomp}{\xintifboolexpr{#5>0}{-\num{#5}}{+\num{\fpeval{0-#5}}}}&=\xintifboolexpr{\Coeffa=1}{}{\num{\Coeffa}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#5>0}{+\num{#5}}{-\num{\fpeval{0-#5}}}\mathcolor{Cdecomp}{\xintifboolexpr{#5>0}{-\num{#5}}{+\num{\fpeval{0-#5}}}}\\
+                }{}%
+                \tikzmark{C-\theNbequa}\xdef\Coeffb{\fpeval{#3-#5}}\num{\Coeffb}&=\xintifboolexpr{\Coeffa=1}{}{\num{\Coeffa}}\useKV[ClesEquation]{Lettre}\tikzmark{G-\theNbequa}%\\
+                % eric
+                \ifboolKV[ClesEquation]{Decomposition}{\\\xintifboolexpr{\Coeffa=1}{}{\frac{\num{\Coeffb}}{\mathcolor{Cdecomp}{\num{\Coeffa}}}&=\frac{\num{\Coeffa}}{\mathcolor{Cdecomp}{\num{\Coeffa}}}\useKV[ClesEquation]{Lettre}}}{}
+                % eric
+                \xintifboolexpr{\Coeffa=1}{}{\\}
+                \ifboolKV[ClesEquation]{Fleches}{%
+                \leftcomment{A-\theNbequa}{B-\theNbequa}{A-\theNbequa}{$\xintifboolexpr{#2>0}{-\num{#2}}{+\num{\fpeval{0-#2}}}\useKV[ClesEquation]{Lettre}$}
+                \rightcomment{E-\theNbequa}{F-\theNbequa}{E-\theNbequa}{$\xintifboolexpr{#2>0}{-\num{#2}}{+\num{\fpeval{0-#2}}}\useKV[ClesEquation]{Lettre}$}
+                \leftcomment{B-\theNbequa}{C-\theNbequa}{A-\theNbequa}{$\xintifboolexpr{#5>0}{-\num{#5}}{+\num{\fpeval{0-#5}}}$}%
+                \rightcomment{F-\theNbequa}{G-\theNbequa}{E-\theNbequa}{$\xintifboolexpr{#5>0}{-\num{#5}}{+\num{\fpeval{0-#5}}}$}%
+                }{}
+                \xintifboolexpr{\Coeffa=1}{}{%\ifnum\cmtd>1
+                \tikzmark{D-\theNbequa}\frac{\num{\Coeffb}}{\num{\Coeffa}}&=\useKV[ClesEquation]{Lettre}\tikzmark{H-\theNbequa}%\\
+                \ifboolKV[ClesEquation]{Fleches}{%
+                \leftcomment{C-\theNbequa}{D-\theNbequa}{A-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%
+                \rightcomment{G-\theNbequa}{H-\theNbequa}{E-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%            
+                }{
+                \ifboolKV[ClesEquation]{FlecheDiv}{%
+                \leftcomment{C-\theNbequa}{D-\theNbequa}{A-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%
+                \rightcomment{G-\theNbequa}{H-\theNbequa}{E-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%                 
+                }{}
+                }
+                \ifboolKV[ClesEquation]{Entier}{%
+                \SSimpliTest{\Coeffb}{\Coeffa}%
+                \ifboolKV[ClesEquation]{Simplification}{%
+                \ifthenelse{\boolean{Simplification}}{\\\SSimplifie{\Coeffb}{\Coeffa}&=\useKV[ClesEquation]{Lettre}}{}%\\
+                }{}
+                }{}
+                }
+                \ifboolKV[ClesEquation]{Fleches}{\stepcounter{Nbequa}}{\ifboolKV[ClesEquation]{FlecheDiv}{\stepcounter{Nbequa}}{}}
+              \end{align*}
+              \ifboolKV[ClesEquation]{Solution}{L'équation $\xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}=\xintifboolexpr{#4=1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#5>0}{+\num{#5}}{-\num{\fpeval{0-#5}}}$ a une unique solution : \opdiv*{\Coeffb}{\Coeffa}{solution}{resteequa}\opcmp{resteequa}{0}$\ifboolKV[ClesEquation]{LettreSol}{\useKV[ClesEquation]{Lettre}=}{}\displaystyle\ifopeq\opexport{solution}{\solution}\num{\solution}\else\ifboolKV[ClesEquation]{Entier}{\SSimplifie{\Coeffb}{\Coeffa}}{\frac{\num{\Coeffb}}{\num{\Coeffa}}}\fi$.%
+              }{}%
+            }%
+          }%
+        }%
+      }%
+    }%
+  }%
+}%
+
+


Property changes on: trunk/Master/texmf-dist/tex/latex/profcollege/PfC-EquationSoustraction2.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/texmf-dist/tex/latex/profcollege/ProfCollege.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/profcollege/ProfCollege.sty	2021-03-14 22:51:48 UTC (rev 58350)
+++ trunk/Master/texmf-dist/tex/latex/profcollege/ProfCollege.sty	2021-03-14 22:52:07 UTC (rev 58351)
@@ -1,66 +1,12 @@
 % Author     : Christophe Poulain
 % Licence    : Released under the LaTeX Project Public License v1.3c
 % or later, see http://www.latex-project.org/lppl.txtf
-%%%%%%%
-% 90 : Reprise d'une partie de la doc. Quelques ajouts.
-% 87-88 : amélioration \Thales. \Labyrinthe.
-% 85 : passage à lua.
-% 75 : plein de choses que j'ai oubliées :(
-% 71 : Possibilité de choisir les fontes pour les figures MP
-% 70 : Ajout de la commande \calculatrice. Coupure des calculs longs
-% pour la moyenne et médiane. Egalités remarquables pour le
-% développement. Tableau vide pour les stats.
-% 67 : préparation au dépôt sur ctan.org
-% 66 : Ajout de la commande \Ratio.
-% 62 : Refonte des commandes !\Result! - Ajout d'une commande \Result
-% dans SommeAngles. Rectification espace dans \Distri avec Reduction active.
-% 61 : Simplication d'une fraction en version longue :) - Ajout
-% d'options à la commande \lstinline!\Stat!. Ajout d'options à la
-% commande \lstinline!\Thales!.
-% 60 : Nouvelle présentation de la résolution d'une équation. Reprise
-% et ajout d'une clé à la commande \SommeAngles.
-% 59 : amélioration de la macro \Pythagore pour pouvoir enchaîner les
-% calculs. Amélioration de la macro \Reperage pour améliorer
-% la gestion de l'affichage sur les droites graduées.
-% 58 : ajout d'un affichage des angles dans les diagrammes circulaires.
-% 57 : ajout de la commande \Fraction. Ajout d'un VF dans la macro \QCM
-% 56 : ajout de commandes "utiles" :) / Modification de \SommeAngles
-% pour éviter les conflits.
-% 55 : ajout d'une clé \Cle{Longue} dans la commande \Décomposition
-% 54 : adaptations mineures :) à gmp
-% 53 : ajout de la commande \QFlash
-% 52 : ajout de la macro \QCM
-% 51 : ajout de la macro \Relie
-% 50 : Changement des clés.
-% 37 : Reprise de la macro \Distri pour qu'elle accepte des valeurs
-%décimales.
-% 36 : Ajout d'un développement numérique. Reprise de la décomposition
-% des nombres premiers (pour éviter conflit entre \newcount\c et la
-% commande \c... Suppression de "spurious blank"
-% 35 : Ajout d'une quatrième  version de présentation de la résolution
-% d'une  équation -  Nouvelle macro :  Puissances. Ajout  d'une option
-% \EFacteurs pour les  équations produit nul. Amélioration (rédaction)
-% de \FonctionAffine - Ajout de la couleur de fond paramétrable dans
-% les fleches PH et BH de \Propor
-% 34 : Ajout de la commande \ResultatTrigo, \ResultatThalesx... Suppression de spurious blank. Corrections typographiques. Reprise de l'affichage de la moyenne dans la commande \Stat
-% 33 : MAJ Distri : Problème d'espace en utilisant les nombres négatifs (1ere étape).
-% 32 : MAJ Pythagore : Ajout de la clé PUnite - Possibilité de récupérer la valeur numérique obtenue par la macro Pythagore - Justification des textes dans les bulles. Ajout d'un FlecheCoefDebut dans \Propor.
-% 31 : MAJ Pourcentage. Correction quelques bugs. Correction de \og spurious blank\fg. Oubli du RequirePackage{multido} :(
-% 29 : MAJ Trigo (figure reprise pour utiliser \num de siunitx)
-% 28 : Mise à jour de \Propor : flèches inversées \FlechesPH et \FlechesPB, homogénéité des flèches. Pourcentage.
-% 27 : ajout du repérage
-% 26 : ajout des schémas de proba + MAJ avec geometriesyr16 + MAJ Nombre premier.
-% 25 : ajout des formules
-% 24 : ajout d'une option pour les équations $X^2=a$
-% 23 : ajout d'une option pour les équations produit.
-% 22 : ajout d'une option TColonnes dans la macro Tableaux
-% 21 : Ajout d'une vérification dans la macro \ResolEquation - Correction de quelques bugs dans la résolution d'équation.
-% 20: ajout d'une macro simpliste (car pas beaucoup d'utilité) sur les fonctions.
-% 19 : Modification AAntécédent dans Affine + Amélioration Pythagore (Cas des triangles rectangles isocèles, dans le calcul de la longueur d'un côté)
 
 \NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{ProfCollege}[2021/01/30 v0.90 Aide pour l'utilisation de LaTeX au collège]
+\ProvidesPackage{ProfCollege}[2021/03/10 v0.95 Aide pour l'utilisation de LaTeX au collège]
 
+\RequirePackage{verbatim}
+
 \RequirePackage{mathtools}%Amélioration des rendus
 \RequirePackage{amssymb}
 
@@ -77,6 +23,14 @@
 \newcommand\speed[1]{\SI{#1}{\kmh}}
 \newcommand\Speed[1]{\SI[per-mode=symbol]{#1}{\kmh}}
 
+\DeclareSIUnit{\are}{a}
+\DeclareSIUnit{\annee}{an}
+\DeclareSIUnit{\mois}{mois}
+\DeclareSIUnit{\jour}{j}
+\DeclareSIUnit{\quintal}{q}
+\DeclareSIUnit{\octet}{o}
+\DeclareSIUnit{\fahrenheit}{\degree F}
+
 \RequirePackage[table,svgnames]{xcolor}%Gestion des couleurs
 \RequirePackage{xstring}%Gestion de chaines de caractères
 \RequirePackage{simplekv}%Gestion de paramètres sous forme de clés
@@ -90,24 +44,24 @@
 
 \if at shellescape
 \RequirePackage[shellescape,latex]{gmp}%inclusion de figures metapost "à la volée"%
-\gmpoptions{everymp={prologues:=3; input PfC-LaTeX; input PfC-Svgnames; input PfC-Constantes; input PfC-Geometrie;}}
+\gmpoptions{everymp={prologues:=3; input PfC-LaTeX; input PfC-Svgnames; input PfC-Constantes; input PfC-Geometrie; input PfC-Afficheur;}}
 \usempxclass{article}
+\usempxpackage{ProfCollege}
 \usempxpackage[utf8]{inputenc}
 \usempxpackage[T1]{fontenc}
 \usempxpackage{fourier}
 \usempxpackage[french]{babel}
 \usempxpackage{pifont}
-\usempxpackage[locale=FR]{siunitx}
 \else
 \RequirePackage[latex]{gmp}%inclusion de figures metapost "à la volée"%
-\gmpoptions{everymp={prologues:=3; input PfC-LaTeX; input PfC-Svgnames; input PfC-Constantes; input PfC-Geometrie;}}
+\gmpoptions{everymp={prologues:=3; input PfC-LaTeX; input PfC-Svgnames; input PfC-Constantes; input PfC-Geometrie; input PfC-Afficheur;}}
 \usempxclass{article}
+\usempxpackage{ProfCollege}
 \usempxpackage[utf8]{inputenc}
 \usempxpackage[T1]{fontenc}
 \usempxpackage{fourier}
 \usempxpackage[french]{babel}
 \usempxpackage{pifont}
-\usempxpackage[locale=FR]{siunitx}
 \fi
 
 \RequirePackage{xintexpr}
@@ -138,17 +92,15 @@
 \RequirePackage{stackengine}
 \RequirePackage[thicklines]{cancel}
 
-%\ifpdftex
-%\RequirePackage[babel=true,kerning=true]{microtype}%Pour gérer le souci du ; dans tikz avec pdftex...
-%\fi
+\RequirePackage{nicematrix}%pour le tableur
 
 % https://stackoverflow.com/questions/3391103/how-to-make-the-grayed-round-box-using-tiks
 \RequirePackage{environ}
+%
 
-%%% 80
 \ifluatex
 \RequirePackage{luamplib}
-\everymplib{input PfC-Svgnames; input PfC-Constantes; input PfC-Geometrie; beginfig(1);}
+\everymplib{input PfC-Svgnames; input PfC-Constantes; input PfC-Geometrie; input PfC-Afficheur; beginfig(1);}
 \everyendmplib{endfig;}
 \fi
 
@@ -180,9 +132,9 @@
       \hfil\crcr #1\crcr}}\,}
 \catcode`\@=12
 
-%%%%%%%%%%%%%%%%%%%%%
+%%%
 %% Commandes "utiles"
-%%%%%%%%%%%%%%%%%%%%%
+%%%
 %encadrer avec des "sommets arrondis"
 \newsavebox{\logobox}
 
@@ -217,9 +169,28 @@
   }
 }
 
-%%%%%%%%%%%%%%%%%
+\newcommand\MultiCol[2]{%
+  \setsepchar[*]{/}%
+  \readlist*\ListeNombreCol{#1}%
+  \setsepchar[*]{§}%
+  \readlist*\ListeContenuCol{#2}%
+  \xintFor* ##1 in {\xintSeq {1}{\ListeNombreCollen}}\do{%
+    \begin{minipage}{\ListeNombreCol[##1]\linewidth}
+      \ListeContenuCol[##1]
+    \end{minipage}%
+    \xintifboolexpr{##1<\ListeNombreCollen}{\hfill}{}%
+  }%
+}%
+
+\newcommand\Demain{%
+  \advance\day by 1%
+  \today%
+  \advance\day by -1%
+}
+
+%%%
 % Tables Addition-Multiplication
-%%%%%%%%%%%%%%%%%
+%%%
 \setKVdefault[Tables]{Addition=false,Multiplication=true,Seul=false,Debut=0,Fin=10,Couleur=white}
 
 % pour mémoire
@@ -303,7 +274,6 @@
   }%
 }%
 
-
 \newcommand\Tables[2][]{%
   \useKVdefault[Tables]%
   \setKV[Tables]{#1}%
@@ -322,15 +292,82 @@
   }%
 }%
 
-%%%%%%%%%%%%%%
+%%%
+% Rangement des nombres
+%%%
+\setKVdefault[ClesRgt]{Croissant,Decroissant=false,Strict,Fraction=false,Details=false}
+
+\DTLgnewdb{mtnumedb}%
+\DTLgnewdb{mtnumeretourdb}%
+
+\newcommand\Rangement[2][]{%
+  \useKVdefault[ClesRgt]%
+  \setKV[ClesRgt]{#1}%
+  \ifboolKV[ClesRgt]{Fraction}{%
+    \setsepchar[*]{,*/}%\ignoreemptyitems%
+    \readlist*\ListeRgt{#2}%
+    % on cherche le dénominateur commun
+    \ppcm=1\relax
+    \foreachitem\x\in\ListeRgt{%
+      \PPCM{\fpeval{\ListeRgt[\xcnt,2]}}{\fpeval{\the\ppcm}}%
+    }%
+    % On crée la liste des rangements.
+    \DTLcleardb{mtnumedb}%
+    % on les trie pour les ranger par ordre croissant
+    \foreachitem\x\in\ListeRgt{%
+      \DTLnewrow{mtnumedb}%
+      \itemtomacro\ListeRgt[\xcnt,1]\y%
+      \DTLnewdbentry{mtnumedb}{Numeric}{\fpeval{\y*\the\ppcm/\ListeRgt[\xcnt,2]}}%
+    }%
+    % On trie
+    \ifboolKV[ClesRgt]{Decroissant}{%
+      % On trie la liste
+      \dtlsort{Numeric=descending}{mtnumedb}{\dtlicompare}%
+      \ifboolKV[ClesRgt]{Details}{\ensuremath{\DTLforeach{mtnumedb}{\numeroDonnee=Numeric}{\frac{\num{\numeroDonnee}}{\num{\the\ppcm}}\DTLiflastrow{}{\ifboolKV[ClesRgt]{Strict}{>}{\geqslant}}}}}{%
+        \ensuremath{\DTLforeach{mtnumedb}{\numeroDonnee=Numeric}{\Simplification{\numeroDonnee}{\ppcm}\DTLiflastrow{}{\ifboolKV[ClesRgt]{Strict}{>}{\geqslant}}}}%
+      }
+    }{%
+      % On trie la liste
+      \dtlsort{Numeric}{mtnumedb}{\dtlicompare}%
+      \ifboolKV[ClesRgt]{Details}{%
+        \ensuremath{\DTLforeach{mtnumedb}{\numeroDonnee=Numeric}{\frac{\num{\numeroDonnee}}{\num{\the\ppcm}}\DTLiflastrow{}{\ifboolKV[ClesRgt]{Strict}{<}{\leqslant}}}}%
+      }{%
+        \ensuremath{\DTLforeach{mtnumedb}{\numeroDonnee=Numeric}{\Simplification{\numeroDonnee}{\ppcm}\DTLiflastrow{}{\ifboolKV[ClesRgt]{Strict}{<}{\leqslant}}}}%
+      }
+    }%
+  }{%
+    \setsepchar{,}\ignoreemptyitems%
+    \readlist*\ListeRgt{#2}%
+    % on crée la base de données des valeurs
+    \DTLcleardb{mtdb}%
+    % on les trie pour les ranger par ordre croissant
+    \foreachitem\x\in\ListeRgt{%
+      \DTLnewrow{mtdb}%
+      \itemtomacro\ListeRgt[\xcnt]\y%
+      \DTLnewdbentry{mtdb}{Numeric}{\y}%
+    }%
+    % 
+    \ifboolKV[ClesRgt]{Decroissant}{%
+      % On trie la liste
+      \dtlsort{Numeric=descending}{mtdb}{\dtlicompare}%
+      \ensuremath{\DTLforeach{mtdb}{\numeroDonnee=Numeric}{\num{\numeroDonnee}\DTLiflastrow{}{\ifboolKV[ClesRgt]{Strict}{>}{\geqslant}}}}%
+    }{%
+      % On trie la liste
+      \dtlsort{Numeric}{mtdb}{\dtlicompare}%
+      \ensuremath{\DTLforeach{mtdb}{\numeroDonnee=Numeric}{\num{\numeroDonnee}\DTLiflastrow{}{\ifboolKV[ClesRgt]{Strict}{<}{\leqslant}}}}%
+    }%
+  }
+}%
+
+%%%
 % Labyrinthe
-%%%%%%%%%%%%%%
+%%%
 \setKVdefault[Labyrinthe]{Lignes=6,Colonnes=3,Longueur=4,Hauteur=2,Passages=false,EcartH=1,EcartV=1,CouleurF=gray!50,Texte=\color{black}}
 
 \newcommand\Labyrinthe[3][]{%
   \useKVdefault[Labyrinthe]%
   \setKV[Labyrinthe]{#1}%
-  \setsepchar[*]{,*/}%\ignoreemptyitems%
+  \setsepchar[*]{,*/}%
   \readlist*\ListeLaby{#2}%
   \ifboolKV[Labyrinthe]{Passages}{%
     \readlist*\ListeLabySol{#3}%
@@ -393,21 +430,21 @@
       définitions de {\ttfamily Colonnes} et {\ttfamily Lignes} !}}%
 }
 
-%%%%%%%%%%%%%%%
+%%%
 % Calculatrice
-%%%%%%%%%%%%%%%
+%%%
 %https://tex.stackexchange.com/questions/290321/mimicking-a-calculator-inputs-and-screen
-\definecolor{lightorange}{rgb}{0.9,0.4,0}
-\definecolor{lightestorange}{rgb}{1,0.8,0.5}
-\definecolor{darkorange}{rgb}{0.2,0.1,0}
+\definecolor{lightorange}{rgb}{0.9,0.4,0}%
+\definecolor{lightestorange}{rgb}{1,0.8,0.5}%
+\definecolor{darkorange}{rgb}{0.2,0.1,0}%
 
-\colorlet{blackened}{black!90!white}
-\colorlet{blackish}{black!70!white}
-\colorlet{greyish}{black!60!white}
-\colorlet{whiteish}{white}
-\colorlet{orangeish}{yellow!90!red}
-\colorlet{greenish}{green!16!gray}
-\colorlet{redish}{red!80!black}
+\colorlet{blackened}{black!90!white}%
+\colorlet{blackish}{black!70!white}%
+\colorlet{greyish}{black!60!white}%
+\colorlet{whiteish}{white}%
+\colorlet{orangeish}{yellow!90!red}%
+\colorlet{greenish}{green!16!gray}%
+\colorlet{redish}{red!80!black}%
 
 \tcbset{calbackground/.style={
     enhanced,
@@ -427,7 +464,7 @@
     colbacklower=greenish,
     colframe=white,
     autoparskip,
-  }}
+  }}%
 
 \newtcbox{\KY}[1][]{
   enhanced,
@@ -444,7 +481,7 @@
   fontupper=\footnotesize\sffamily,
   coltext=orangeish,
   before upper=\vrule width 0pt height 2ex depth 1ex\relax,
-}
+}%
 
 \newtcbox{\KYm}[1][]{
   enhanced,
@@ -462,7 +499,7 @@
   coltext=orangeish,
   before upper=\vrule width 0pt height 2ex depth 1ex\relax$,
   after upper=$,
-}
+}%
 
 \newtcbox{\KN}{
   enhanced,
@@ -479,10 +516,8 @@
   fontupper=\footnotesize\sffamily,
   coltext=whiteish,
   before upper=\vrule width 0pt height 2ex depth 1ex\relax,
-}
+}%
 
-\parindent0pt
-
 \newtcolorbox{calc}[1][]{%
   enhanced,bicolor,
   boxsep=0pt,
@@ -504,13 +539,13 @@
     at (frame.north east) {#1};}
 }
 
-\def\MPCalculatrice#1#2{
+\def\MPCalculatrice#1#2#3{
   % #1 Calcul %2 réponse
   \ifluatex
    \mplibforcehmode
   \begin{mplibcode}
     input PfC-Calculatrice;
-    LCD(#1)(#2);
+    LCD(#1)(#2)(#3);
   \end{mplibcode}
   \else
   \begin{mpost}[mpsettings={input PfC-Calculatrice;}]
@@ -519,7 +554,7 @@
   \fi
 }
 
-\setKVdefault[ClesCalculatrice]{Ecran=false}
+\setKVdefault[ClesCalculatrice]{Ecran=false,NbLignes=0}
 
 \newcommand\Calculatrice[2][]{%
   \setstackgap{L}{0.775\baselineskip}%
@@ -528,7 +563,7 @@
   \ifboolKV[ClesCalculatrice]{Ecran}{%
     \setsepchar[*]{,*/}%
     \readlist\ListeCalc{#2}%
-    \MPCalculatrice{\ListeCalc[1,1]}{\ListeCalc[1,2]}%
+    \MPCalculatrice{\ListeCalc[1,1]}{\ListeCalc[1,2]}{\useKV[ClesCalculatrice]{NbLignes}}%
   }{%
     \setsepchar[*]{,*/}%
     \readlist\ListeCalc{#2}%
@@ -538,34 +573,49 @@
   \setstackgap{L}{\baselineskip}%
 }%
 
-
-%%%%%%%%%%%%%%%%
-%%% Questions Flash
-%%%%%%%%%%%%%%%%
+%%%
+% Questions Flash
+%%%
 \tcbset{Expression/.style={colback=white,valign=center,left=0mm,right=0mm,top=1mm,bottom=1mm,colframe=white}}%
 \tcbset{ExpressionSerie1/.style={colback=\useKV[ClesFlash]{Couleur1},left=0mm,right=0mm,top=1mm,bottom=1mm}}%
 \tcbset{ExpressionSerie2/.style={colback=\useKV[ClesFlash]{Couleur2},left=0mm,right=0mm,top=1mm,bottom=1mm}}%
 \tcbset{ExpressionSerie3/.style={colback=\useKV[ClesFlash]{Couleur3},left=0mm,right=0mm,top=1mm,bottom=1mm}}
 \tcbset{ExpressionSerie4/.style={colback=\useKV[ClesFlash]{Couleur4},left=0mm,right=0mm,top=1mm,bottom=1mm}}
-\tcbset{BoiteExpression/.style={enhanced,nobeforeafter,tcbox raise
-        base,colback=white,right=3.5mm,left=3.5mm,halign=center,colframe=black}}
+\tcbset{BoiteExpression/.style={enhanced,nobeforeafter,tcbox raise base,colback=white,right=3.5mm,left=3.5mm,halign=center,colframe=black}}
 \newtcolorbox{CadreNombre}[1][]{%
   Expression,#1}
 
-\setKVdefault[ClesFlash]{Hauteur=0.2\textheight,Simple=false,Intrus=false,Kahout=false,Daily=false,Expression=false,Mental=false,Mesure=false,Heure=false,Decimal=false,Operation=Multiplie,Numeration=false,Evaluation=false,Pause=false,Couleur1=blue!10,Couleur2=orange!10,Couleur3=green!10,Couleur4=yellow!10}
+\setKVdefault[ClesFlash]{Hauteur=0.2\textheight,Simple=false,Intrus=false,Kahout=false,Daily=false,Expression=false,Mental=false,Mesure=false,Heure=false,Decimal=false,Operation=Multiplie,Numeration=false,Evaluation=false,Pause=false,Couleur1=blue!10,Couleur2=orange!10,Couleur3=green!10,Couleur4=yellow!10,Numerique=false,Seul=false}
 
 \newlength{\HauteurFlash}
 
-\tikzset{
-  arrow/.style={
-    draw,
-    minimum height=1.25cm,
-    inner sep=0.25em,
-    shape=signal,
-    signal from=west,
-    signal to=east,
-    signal pointer angle=150,
-  }
+\def\MPAfficheur#1#2#3{%
+  \ifluatex
+  \mplibforcehmode
+  \begin{mplibcode}
+    u:=0.5u;
+    draw Afficheur(#1 div10,0);
+    draw Afficheur(#1 mod10,0) shifted(u*(1,0));
+    draw Afficheur(10,0) shifted(u*(2,0));
+    draw Afficheur(#2 div10,0) shifted(u*(3,0));
+    draw Afficheur(#2 mod10,0) shifted(u*(4,0));
+    draw Afficheur(10,0) shifted(u*(5,0));
+    draw Afficheur(#3 div10,0) shifted(u*(6,0));
+    draw Afficheur(#3 mod10,0) shifted(u*(7,0));
+  \end{mplibcode}
+  \else
+  \begin{mpost}
+    u:=0.5u;
+    draw Afficheur(#1 div10,0);
+    draw Afficheur(#1 mod10,0) shifted(u*(1,0));
+    draw Afficheur(10,0) shifted(u*(2,0));
+    draw Afficheur(#2 div10,0) shifted(u*(3,0));
+    draw Afficheur(#2 mod10,0) shifted(u*(4,0));
+    draw Afficheur(10,0) shifted(u*(5,0));
+    draw Afficheur(#3 div10,0) shifted(u*(6,0));
+    draw Afficheur(#3 mod10,0) shifted(u*(7,0));
+  \end{mpost}
+  \fi
 }
 
 \def\MPHorloge#1#2#3{
@@ -683,7 +733,7 @@
 
 \newcommand\QFHeure{%
   \begin{CadreNombre}
-    {\Large L'HEURE DU JOUR est : }\raisebox{-0.9cm}{\MPHorloge{\NbHeures}{\NbMinutes}{\NbSecondes}}
+    {\Large L'HEURE DU JOUR est : }\ifboolKV[ClesFlash]{Numerique}{\raisebox{-0.3cm}{\MPAfficheur{\NbHeures}{\NbMinutes}{\NbSecondes}}}{\raisebox{-0.9cm}{{\MPHorloge{\NbHeures}{\NbMinutes}{\NbSecondes}}}}
     \ifboolKV[ClesFlash]{Pause}{\pause}{}
     \begin{tcolorbox}[ExpressionSerie1]
       $\square$ \textbf{\ListeFlash[1,2] :}
@@ -734,26 +784,37 @@
   \end{CadreNombre}
 }
 
+\tikzset{
+  arrow/.style={
+    draw,
+    minimum height=1.25cm,
+    inner sep=0.25em,
+    shape=signal,
+    signal from=west,
+    signal to=east,
+    signal pointer angle=150,
+  }
+}
+
 \newcommand\QFDaily{%
-    \begin{tikzpicture}
-      \begin{scope}[start chain=transition going right,node
-        distance=-\pgflinewidth]
-        \foreach \s in {1,...,\ListeFlashlen}{%
-          \xintifboolexpr{\s = 1}{%
-            \node[arrow,on chain] {\Huge\bfseries\ListeFlash[\s]};
-            \ifboolKV[ClesFlash]{Pause}{\pause}{}
+  \begin{tikzpicture}%
+    \begin{scope}[start chain=transition going right,node distance=-\pgflinewidth]%
+      \foreach \s in {1,...,\ListeFlashlen}{%
+        \xintifboolexpr{\s = 1}{%
+          \node[arrow,on chain] {\Huge\bfseries\ListeFlash[\s]};%
+          \ifboolKV[ClesFlash]{Pause}{\pause}{}%
+        }{%
+          \xintifboolexpr{\s = \ListeFlashlen}{%
+            \node[arrow,on chain] {\Huge\bfseries?};%
           }{%
-            \xintifboolexpr{\s = \ListeFlashlen}{%
-              \node[arrow,on chain] {\Huge\bfseries?};
-            }{%
-              \node[arrow,on chain] {\ListeFlash[\s]};
-              \ifboolKV[ClesFlash]{Pause}{\pause}{}
-            }
-          }
-        }
-      \end{scope}
-    \end{tikzpicture}
-}
+            \node[arrow,on chain] {\ListeFlash[\s]};%
+            \ifboolKV[ClesFlash]{Pause}{\pause}{}%
+          }%
+        }%
+      }%
+    \end{scope}%
+  \end{tikzpicture}%
+}%
 
 \newcommand\QFDecimal{%
   \begin{CadreNombre}
@@ -761,7 +822,7 @@
     \tcbox[BoiteExpression]{\num{\ListeFlash[1,1]}}
     \ifboolKV[ClesFlash]{Pause}{\pause}{}
     \begin{tcolorbox}[ExpressionSerie1]
-      $\square$ \textbf{\'Ecriture en fraction décimale :}
+      $\square$ \textbf{\'Ecris-le en fraction décimale :}
       \tcbox[BoiteExpression]{$\dfrac{\phantom{1000000}}{\phantom{1000000}}$}
     \end{tcolorbox}
     \ifboolKV[ClesFlash]{Pause}{\pause}{}
@@ -845,264 +906,296 @@
   \end{CadreNombre}
 }
 
+\newcommand\BoiteFlash[1]{%
+  \ifx\bla#1\bla%
+  \tcbox[BoiteExpression]{\phantom{10000000}}%
+  \else
+  \tcbox[BoiteExpression]{#1}%
+  \fi
+}
+
+\newcommand\QFVide{%
+  \begin{CadreNombre}
+    {\ListeFlash[1]}
+    \xintFor* ##1 in {\xintSeq {1}{\ListeFlashlen-1}}\do{%
+      \ifboolKV[ClesFlash]{Pause}{\pause}{}
+      \begin{tcolorbox}[ExpressionSerie##1]
+        \ListeFlash[1+##1]
+      \end{tcolorbox}
+    }
+  \end{CadreNombre}
+}
+
 \newcommand\QFlash[2][]{%
-  \useKVdefault[ClesFlash]
-  \setKV[ClesFlash]{#1}
-  \setlength{\HauteurFlash}{\useKV[ClesFlash]{Hauteur}}
-  \colorlet{CouleurUn}{\useKV[ClesFlash]{Couleur1}}
-  \colorlet{CouleurDeux}{\useKV[ClesFlash]{Couleur2}}
-  \colorlet{CouleurTrois}{\useKV[ClesFlash]{Couleur3}}
-  \colorlet{CouleurQuatre}{\useKV[ClesFlash]{Couleur4}}
+  \useKVdefault[ClesFlash]%
+  \setKV[ClesFlash]{#1}%
+  \setlength{\HauteurFlash}{\useKV[ClesFlash]{Hauteur}}%
+  \colorlet{CouleurUn}{\useKV[ClesFlash]{Couleur1}}%
+  \colorlet{CouleurDeux}{\useKV[ClesFlash]{Couleur2}}%
+  \colorlet{CouleurTrois}{\useKV[ClesFlash]{Couleur3}}%
+  \colorlet{CouleurQuatre}{\useKV[ClesFlash]{Couleur4}}%
   \ifboolKV[ClesFlash]{Evaluation}{%
-    \ifboolKV[ClesFlash]{Numeration}{%
-      \setsepchar[*]{,*/}%
+    \ifboolKV[ClesFlash]{Seul}{%
+      \setsepchar[*]{/}%
       \readlist*\ListeFlash{#2}%
-      \QFNumeration%
+      \QFVide%
     }{%
-      \ifboolKV[ClesFlash]{Heure}{%
+      \ifboolKV[ClesFlash]{Numeration}{%
         \setsepchar[*]{,*/}%
         \readlist*\ListeFlash{#2}%
-        \StrMid{\ListeFlash[1,1]}{1}{2}[\NbHeures]%
-        \StrMid{\ListeFlash[1,1]}{3}{4}[\NbMinutes]%
-        \StrMid{\ListeFlash[1,1]}{5}{6}[\NbSecondes]%
-        \QFHeure%
+        \QFNumeration%
       }{%
-        \ifboolKV[ClesFlash]{Mesure}{%
+        \ifboolKV[ClesFlash]{Heure}{%
           \setsepchar[*]{,*/}%
           \readlist*\ListeFlash{#2}%
-          \QFMesure%
+          \StrMid{\ListeFlash[1,1]}{1}{2}[\NbHeures]%
+          \StrMid{\ListeFlash[1,1]}{3}{4}[\NbMinutes]%
+          \StrMid{\ListeFlash[1,1]}{5}{6}[\NbSecondes]%
+          \QFHeure%
         }{%
-          \ifboolKV[ClesFlash]{Daily}{%
-            \setsepchar[*]{/}%
+          \ifboolKV[ClesFlash]{Mesure}{%
+            \setsepchar[*]{,*/}%
             \readlist*\ListeFlash{#2}%
-            \QFDaily%
+            \QFMesure%
           }{%
-            \ifboolKV[ClesFlash]{Decimal}{%
-              \setsepchar[*]{,*/}%
+            \ifboolKV[ClesFlash]{Daily}{%
+              \setsepchar[*]{/}%
               \readlist*\ListeFlash{#2}%
-              \begin{frame}
-                \QFDecimal%
-              \end{frame}
+              \QFDaily%
             }{%
-              \ifboolKV[ClesFlash]{Mental}{%
+              \ifboolKV[ClesFlash]{Decimal}{%
                 \setsepchar[*]{,*/}%
                 \readlist*\ListeFlash{#2}%
-                \QFMental%
+                \QFDecimal%
               }{%
-                \ifboolKV[ClesFlash]{Expression}{%
+                \ifboolKV[ClesFlash]{Mental}{%
                   \setsepchar[*]{,*/}%
                   \readlist*\ListeFlash{#2}%
-                  \QFExpression%
+                  \QFMental%
                 }{%
-                  \setsepchar[*]{/}%
-                  \readlist*\ListeFlash{#2}%
-                  \ifboolKV[ClesFlash]{Simple}{%
-                    \ListeFlash[1]
-                    \begin{tcolorbox}[valign=center]
-                      \ListeFlash[2]
-                    \end{tcolorbox}
+                  \ifboolKV[ClesFlash]{Expression}{%
+                    \setsepchar[*]{,*/}%
+                    \readlist*\ListeFlash{#2}%
+                    \QFExpression%
                   }{%
-                    \setsepchar[*]{*/}%
+                    \setsepchar[*]{/}%
                     \readlist*\ListeFlash{#2}%
-                    \ifboolKV[ClesFlash]{Kahout}{%
-                      \setsepchar[*]{*/}%
-                      \readlist*\ListeFlash{#2}%
-                      \begin{tcolorbox}[halign=center,valign=center]
-                        \ListeFlash[1,1]
+                    \ifboolKV[ClesFlash]{Simple}{%
+                      \ListeFlash[1]
+                      \begin{tcolorbox}[valign=center]
+                        \ListeFlash[2]
                       \end{tcolorbox}
-                      % \par
-                      \begin{multicols}{4}
-                        \begin{tcolorbox}[height=\HauteurFlash,colframe=CouleurUn!150,colback=CouleurUn,halign=center,valign=center]
-                          \ListeFlash[1,2]
-                        \end{tcolorbox}
-                        % \hfill%
-                        \begin{tcolorbox}[height=\HauteurFlash,colframe=CouleurDeux!150,colback=CouleurDeux,halign=center,valign=center]
-                          \ListeFlash[1,3]
-                        \end{tcolorbox}
-                        % \hfill%
-                        \begin{tcolorbox}[height=\HauteurFlash,colframe=CouleurTrois!150,colback=CouleurTrois,halign=center,valign=center]
-                          \ListeFlash[1,4]
-                        \end{tcolorbox}
-                        % \hfill%
-                        \begin{tcolorbox}[height=\HauteurFlash,colframe=CouleurQuatre!150,colback=CouleurQuatre,halign=center,valign=center]
-                          \ListeFlash[1,5]
-                        \end{tcolorbox}
-                      \end{multicols}
                     }{%
                       \setsepchar[*]{*/}%
                       \readlist*\ListeFlash{#2}%
-                      \begin{tcolorbox}[halign=center,valign=center]
-                        \ListeFlash[1,1]
-                      \end{tcolorbox}
-                      \begin{multicols}{4}
-                        \begin{tcolorbox}[height=\HauteurFlash,colframe=CouleurUn!150,colback=white,boxrule=1mm,halign=center,valign=center]
-                          \ListeFlash[1,2]
+                      \ifboolKV[ClesFlash]{Kahout}{%
+                        \setsepchar[*]{*/}%
+                        \readlist*\ListeFlash{#2}%
+                        \begin{tcolorbox}[halign=center,valign=center]
+                          \ListeFlash[1,1]
                         \end{tcolorbox}
-                        \begin{tcolorbox}[height=\HauteurFlash,colframe=CouleurDeux!150,colback=white,boxrule=1mm,halign=center,valign=center]
-                          \ListeFlash[1,3]
+                        % \par
+                        \begin{multicols}{4}
+                          \begin{tcolorbox}[height=\HauteurFlash,colframe=CouleurUn!150,colback=CouleurUn,halign=center,valign=center]
+                            \ListeFlash[1,2]
+                          \end{tcolorbox}
+                          % \hfill%
+                          \begin{tcolorbox}[height=\HauteurFlash,colframe=CouleurDeux!150,colback=CouleurDeux,halign=center,valign=center]
+                            \ListeFlash[1,3]
+                          \end{tcolorbox}
+                          % \hfill%
+                          \begin{tcolorbox}[height=\HauteurFlash,colframe=CouleurTrois!150,colback=CouleurTrois,halign=center,valign=center]
+                            \ListeFlash[1,4]
+                          \end{tcolorbox}
+                          % \hfill%
+                          \begin{tcolorbox}[height=\HauteurFlash,colframe=CouleurQuatre!150,colback=CouleurQuatre,halign=center,valign=center]
+                            \ListeFlash[1,5]
+                          \end{tcolorbox}
+                        \end{multicols}
+                      }{%
+                        \setsepchar[*]{*/}%
+                        \readlist*\ListeFlash{#2}%
+                        \begin{tcolorbox}[halign=center,valign=center]
+                          \ListeFlash[1,1]
                         \end{tcolorbox}
-                        \begin{tcolorbox}[height=\HauteurFlash,colframe=CouleurTrois!150,boxrule=1mm,colback=white,halign=center,valign=center]
-                          \ListeFlash[1,4]
-                        \end{tcolorbox}
-                        \begin{tcolorbox}[height=\HauteurFlash,colframe=CouleurQuatre!150,colback=white,boxrule=1mm,halign=center,valign=center]
-                          \ListeFlash[1,5]
-                        \end{tcolorbox}
-                      \end{multicols}
+                        \begin{multicols}{4}
+                          \begin{tcolorbox}[height=\HauteurFlash,colframe=CouleurUn!150,colback=white,boxrule=1mm,halign=center,valign=center]
+                            \ListeFlash[1,2]
+                          \end{tcolorbox}
+                          \begin{tcolorbox}[height=\HauteurFlash,colframe=CouleurDeux!150,colback=white,boxrule=1mm,halign=center,valign=center]
+                            \ListeFlash[1,3]
+                          \end{tcolorbox}
+                          \begin{tcolorbox}[height=\HauteurFlash,colframe=CouleurTrois!150,boxrule=1mm,colback=white,halign=center,valign=center]
+                            \ListeFlash[1,4]
+                          \end{tcolorbox}
+                          \begin{tcolorbox}[height=\HauteurFlash,colframe=CouleurQuatre!150,colback=white,boxrule=1mm,halign=center,valign=center]
+                            \ListeFlash[1,5]
+                          \end{tcolorbox}
+                        \end{multicols}
+                      }%
                     }%
                   }%
                 }%
               }%
-            }
+            }%
           }%
         }%
       }%
     }%
   }{%
-    \ifboolKV[ClesFlash]{Numeration}{%
-      \setsepchar[*]{,*/}%
+    \ifboolKV[ClesFlash]{Seul}{%
+      \setsepchar[*]{/}%
       \readlist*\ListeFlash{#2}%
       \begin{frame}
-        \QFNumeration%
+        \QFVide%
       \end{frame}
     }{%
-      \ifboolKV[ClesFlash]{Heure}{%
+      \ifboolKV[ClesFlash]{Numeration}{%
         \setsepchar[*]{,*/}%
         \readlist*\ListeFlash{#2}%
-        \StrMid{\ListeFlash[1,1]}{1}{2}[\NbHeures]%
-        \StrMid{\ListeFlash[1,1]}{3}{4}[\NbMinutes]%
-        \StrMid{\ListeFlash[1,1]}{5}{6}[\NbSecondes]%
         \begin{frame}
-          \QFHeure%
+          \QFNumeration%
         \end{frame}
       }{%
-        \ifboolKV[ClesFlash]{Mesure}{%
+        \ifboolKV[ClesFlash]{Heure}{%
           \setsepchar[*]{,*/}%
           \readlist*\ListeFlash{#2}%
+          \StrMid{\ListeFlash[1,1]}{1}{2}[\NbHeures]%
+          \StrMid{\ListeFlash[1,1]}{3}{4}[\NbMinutes]%
+          \StrMid{\ListeFlash[1,1]}{5}{6}[\NbSecondes]%
           \begin{frame}
-            \QFMesure%
+            \QFHeure%
           \end{frame}
         }{%
-          \ifboolKV[ClesFlash]{Daily}{%
-            \setsepchar[*]{/}%
+          \ifboolKV[ClesFlash]{Mesure}{%
+            \setsepchar[*]{,*/}%
             \readlist*\ListeFlash{#2}%
             \begin{frame}
-              \QFDaily
+              \QFMesure%
             \end{frame}
           }{%
-            \ifboolKV[ClesFlash]{Decimal}{%
-              \setsepchar[*]{,*/}%
+            \ifboolKV[ClesFlash]{Daily}{%
+              \setsepchar[*]{/}%
               \readlist*\ListeFlash{#2}%
               \begin{frame}
-                \QFDecimal%
+                \QFDaily%
               \end{frame}
             }{%
-              \ifboolKV[ClesFlash]{Mental}{%
+              \ifboolKV[ClesFlash]{Decimal}{%
                 \setsepchar[*]{,*/}%
                 \readlist*\ListeFlash{#2}%
                 \begin{frame}
-                  \QFMental%
+                  \QFDecimal%
                 \end{frame}
-              }{
-                \ifboolKV[ClesFlash]{Expression}{%
+              }{%
+                \ifboolKV[ClesFlash]{Mental}{%
                   \setsepchar[*]{,*/}%
                   \readlist*\ListeFlash{#2}%
                   \begin{frame}
-                    \QFExpression%
+                    \QFMental%
                   \end{frame}
                 }{%
-                  \setsepchar[*]{/}%
-                  \readlist*\ListeFlash{#2}%
-                  \ifboolKV[ClesFlash]{Simple}{%
+                  \ifboolKV[ClesFlash]{Expression}{%
+                    \setsepchar[*]{,*/}%
+                    \readlist*\ListeFlash{#2}%
                     \begin{frame}
-                      \ListeFlash[1]
-                      \begin{tcolorbox}[valign=center]
-                        \ListeFlash[2]
-                      \end{tcolorbox}
+                      \QFExpression%
                     \end{frame}
                   }{%
-                    \setsepchar[*]{,*/}%
+                    \setsepchar[*]{/}%
                     \readlist*\ListeFlash{#2}%
-                    \ifboolKV[ClesFlash]{Kahout}{%
-                      \setsepchar[*]{*/}%
-                      \readlist*\ListeFlash{#2}%
+                    \ifboolKV[ClesFlash]{Simple}{%
                       \begin{frame}
+                        \ListeFlash[1]
                         \begin{tcolorbox}[valign=center]
-                          \ListeFlash[1,1]
+                          \ListeFlash[2]
                         \end{tcolorbox}
-                        \vfill
-                        \ifboolKV[ClesFlash]{Pause}{\pause}{}
-                        \begin{columns}[T]
-                          \begin{column}{0.45\linewidth}
-                            \begin{tcolorbox}[height=\HauteurFlash,colframe=CouleurUn!150,colback=CouleurUn,halign=center,valign=center]
-                              \ListeFlash[1,2]
-                            \end{tcolorbox}
-                          \end{column}
-                          \ifboolKV[ClesFlash]{Pause}{\pause}{}
-                          \begin{column}{0.45\linewidth}
-                            \begin{tcolorbox}[height=\HauteurFlash,colframe=CouleurDeux!150,colback=CouleurDeux,halign=center,valign=center]
-                              \ListeFlash[1,3]
-                            \end{tcolorbox}
-                          \end{column}
-                        \end{columns}
-                        \bigskip
-                        \ifboolKV[ClesFlash]{Pause}{\pause}{}
-                        \begin{columns}[T]
-                          \begin{column}{0.45\linewidth}
-                            \begin{tcolorbox}[height=\HauteurFlash,colframe=CouleurTrois!150,colback=CouleurTrois,halign=center,valign=center]
-                              \ListeFlash[1,4]
-                            \end{tcolorbox}
-                          \end{column}
-                          \ifboolKV[ClesFlash]{Pause}{\pause}{}
-                          \begin{column}{0.45\linewidth}
-                            \begin{tcolorbox}[height=\HauteurFlash,colframe=CouleurQuatre!150,colback=CouleurQuatre,halign=center,valign=center]
-                              \ListeFlash[1,5]
-                            \end{tcolorbox}
-                          \end{column}
-                        \end{columns}
                       \end{frame}
                     }{%
-                      \setsepchar[*]{*/}%
+                      \setsepchar[*]{,*/}%
                       \readlist*\ListeFlash{#2}%
-                      \begin{frame}
-                        \begin{tcolorbox}[valign=center]
-                          \ListeFlash[1,1]
-                        \end{tcolorbox}
-                        \vfill
-                        \ifboolKV[ClesFlash]{Pause}{\pause}{}
-                        \begin{columns}[T]
-                          \begin{column}{0.45\linewidth}
-                            \begin{tcolorbox}[height=\HauteurFlash,colframe=CouleurUn!150,colback=white,boxrule=1mm,halign=center,valign=center]
-                              \ListeFlash[1,2]
-                            \end{tcolorbox}
-                          \end{column}
+                      \ifboolKV[ClesFlash]{Kahout}{%
+                        \setsepchar[*]{*/}%
+                        \readlist*\ListeFlash{#2}%
+                        \begin{frame}
+                          \begin{tcolorbox}[valign=center]
+                            \ListeFlash[1,1]
+                          \end{tcolorbox}
+                          \vfill
                           \ifboolKV[ClesFlash]{Pause}{\pause}{}
-                          \begin{column}{0.45\linewidth}
-                            \begin{tcolorbox}[height=\HauteurFlash,colframe=CouleurDeux!150,colback=white,boxrule=1mm,halign=center,valign=center]
-                              \ListeFlash[1,3]
-                            \end{tcolorbox}
-                          \end{column}
-                        \end{columns}
-                        \bigskip
-                        \ifboolKV[ClesFlash]{Pause}{\pause}{}
-                        \begin{columns}[T]
-                          \begin{column}{0.45\linewidth}
-                            \begin{tcolorbox}[height=\HauteurFlash,colframe=CouleurTrois!150,boxrule=1mm,colback=white,halign=center,valign=center]
-                              \ListeFlash[1,4]
-                            \end{tcolorbox}
-                          \end{column}
+                          \begin{columns}[T]
+                            \begin{column}{0.45\linewidth}
+                              \begin{tcolorbox}[height=\HauteurFlash,colframe=CouleurUn!150,colback=CouleurUn,halign=center,valign=center]
+                                \ListeFlash[1,2]
+                              \end{tcolorbox}
+                            \end{column}
+                            \ifboolKV[ClesFlash]{Pause}{\pause}{}
+                            \begin{column}{0.45\linewidth}
+                              \begin{tcolorbox}[height=\HauteurFlash,colframe=CouleurDeux!150,colback=CouleurDeux,halign=center,valign=center]
+                                \ListeFlash[1,3]
+                              \end{tcolorbox}
+                            \end{column}
+                          \end{columns}
+                          \bigskip
                           \ifboolKV[ClesFlash]{Pause}{\pause}{}
-                          \begin{column}{0.45\linewidth}
-                            \begin{tcolorbox}[height=\HauteurFlash,colframe=CouleurQuatre!150,colback=white,boxrule=1mm,halign=center,valign=center]
-                              \ListeFlash[1,5]
-                            \end{tcolorbox}
-                          \end{column}
-                        \end{columns}
-                      \end{frame}
+                          \begin{columns}[T]
+                            \begin{column}{0.45\linewidth}
+                              \begin{tcolorbox}[height=\HauteurFlash,colframe=CouleurTrois!150,colback=CouleurTrois,halign=center,valign=center]
+                                \ListeFlash[1,4]
+                              \end{tcolorbox}
+                            \end{column}
+                            \ifboolKV[ClesFlash]{Pause}{\pause}{}
+                            \begin{column}{0.45\linewidth}
+                              \begin{tcolorbox}[height=\HauteurFlash,colframe=CouleurQuatre!150,colback=CouleurQuatre,halign=center,valign=center]
+                                \ListeFlash[1,5]
+                              \end{tcolorbox}
+                            \end{column}
+                          \end{columns}
+                        \end{frame}
+                      }{%
+                        \setsepchar[*]{*/}%
+                        \readlist*\ListeFlash{#2}%
+                        \begin{frame}
+                          \begin{tcolorbox}[valign=center]
+                            \ListeFlash[1,1]
+                          \end{tcolorbox}
+                          \vfill
+                          \ifboolKV[ClesFlash]{Pause}{\pause}{}
+                          \begin{columns}[T]
+                            \begin{column}{0.45\linewidth}
+                              \begin{tcolorbox}[height=\HauteurFlash,colframe=CouleurUn!150,colback=white,boxrule=1mm,halign=center,valign=center]
+                                \ListeFlash[1,2]
+                              \end{tcolorbox}
+                            \end{column}
+                            \ifboolKV[ClesFlash]{Pause}{\pause}{}
+                            \begin{column}{0.45\linewidth}
+                              \begin{tcolorbox}[height=\HauteurFlash,colframe=CouleurDeux!150,colback=white,boxrule=1mm,halign=center,valign=center]
+                                \ListeFlash[1,3]
+                              \end{tcolorbox}
+                            \end{column}
+                          \end{columns}
+                          \bigskip
+                          \ifboolKV[ClesFlash]{Pause}{\pause}{}
+                          \begin{columns}[T]
+                            \begin{column}{0.45\linewidth}
+                              \begin{tcolorbox}[height=\HauteurFlash,colframe=CouleurTrois!150,boxrule=1mm,colback=white,halign=center,valign=center]
+                                \ListeFlash[1,4]
+                              \end{tcolorbox}
+                            \end{column}
+                            \ifboolKV[ClesFlash]{Pause}{\pause}{}
+                            \begin{column}{0.45\linewidth}
+                              \begin{tcolorbox}[height=\HauteurFlash,colframe=CouleurQuatre!150,colback=white,boxrule=1mm,halign=center,valign=center]
+                                \ListeFlash[1,5]
+                              \end{tcolorbox}
+                            \end{column}
+                          \end{columns}
+                        \end{frame}
+                      }%
                     }%
                   }%
                 }%
               }%
-            }
+            }%
           }%
         }%
       }%
@@ -1110,12 +1203,209 @@
   }%
 }%
 
-%%%%%%%%%%%%%
-%%% Fractions
-%%%%%%%%%%%%%
-\setKVdefault[ClesFraction]{Rayon=2cm,Disque,Regulier=false,Segment=false,Rectangle=false,Longueur=5cm,Largeur=2cm,Cotes=5,Couleur=green,Reponse=false,Multiple=1,Hachures=false,Epaisseur=1}
+%%%
+% Fractions
+%%%
+\setKVdefault[ClesFraction]{Rayon=2cm,Disque,Regulier=false,Segment=false,Rectangle=false,Longueur=5cm,Largeur=2cm,Cotes=5,Triangle=false,Parts=3,Couleur=green,Reponse=false,Multiple=1,Hachures=false,Epaisseur=1}
 
-\def\MPFractionRegulier#1#2#3#4#5{
+\def\MPFractionTriangle#1#2#3#4#5{
+  % #1 longueur du côté
+  % #2 partage sur le côté
+  % #3 num
+  % #4 déno (attention : = #2^2)
+  % #5 couleur
+  \ifluatex
+   \mplibforcehmode
+   \begin{mplibcode}
+     nbtriangle=0;
+
+     vardef Ligne(expr longueur)=
+     for k=0 upto 2*(longueur-1):
+     nbtriangle:=nbtriangle+1;
+     if (k mod 2)=0:
+     M[nbtriangle]=(Tria shifted(0.5*k*(1/nbparts)*(B-A)))  shifted((nbparts-longueur)*(1/nbparts)*(C-A));
+     else:
+     M[nbtriangle]=(Trir shifted(0.5*(k-1)*(1/nbparts)*(B-A)))  shifted((nbparts-longueur)*(1/nbparts)*(C-A));
+     fi;
+     endfor;
+     enddef;
+
+     pair A,B,C;
+     A=u*(0.5,0.5);
+     B-A=(#1,0);
+     C=rotation(B,A,60);
+
+     nbparts:=#2;
+
+     path M[];
+
+     path Tria,Trir;
+     Tria=polygone(A,(1/nbparts)[A,B],(1/nbparts)[A,C]);
+     Trir=symetrie(Tria,(1/nbparts)[A,B],(1/nbparts)[A,C]);
+
+     for k=nbparts downto 1:
+     Ligne(k);
+     endfor;
+
+     for k=1 upto #3:
+     fill M[k] withcolor #5;
+     endfor;
+     
+     for k=1 upto nbparts:
+     trace segment((k/nbparts)[A,B],(k/nbparts)[A,C]);
+     trace segment((k/nbparts)[B,A],(k/nbparts)[B,C]);
+     trace segment((k/nbparts)[C,A],(k/nbparts)[C,B]);
+     endfor;
+   \end{mplibcode}
+     \else
+     \begin{mpost}
+       nbtriangle=0;
+
+     vardef Ligne(expr longueur)=
+     for k=0 upto 2*(longueur-1):
+     nbtriangle:=nbtriangle+1;
+     if (k mod 2)=0:
+     M[nbtriangle]=(Tria shifted(0.5*k*(1/nbparts)*(B-A)))  shifted((nbparts-longueur)*(1/nbparts)*(C-A));
+     else:
+     M[nbtriangle]=(Trir shifted(0.5*(k-1)*(1/nbparts)*(B-A)))  shifted((nbparts-longueur)*(1/nbparts)*(C-A));
+     fi;
+     endfor;
+     enddef;
+
+     pair A,B,C;
+     A=u*(0.5,0.5);
+     B-A=(#1,0);
+     C=rotation(B,A,60);
+
+     nbparts:=#2;
+
+     path M[];
+
+     path Tria,Trir;
+     Tria=polygone(A,(1/nbparts)[A,B],(1/nbparts)[A,C]);
+     Trir=symetrie(Tria,(1/nbparts)[A,B],(1/nbparts)[A,C]);
+
+     for k=nbparts downto 1:
+     Ligne(k);
+     endfor;
+
+     for k=1 upto #3:
+     fill M[k] withcolor #5;
+     endfor;
+     
+     for k=1 upto nbparts:
+     trace segment((k/nbparts)[A,B],(k/nbparts)[A,C]);
+     trace segment((k/nbparts)[B,A],(k/nbparts)[B,C]);
+     trace segment((k/nbparts)[C,A],(k/nbparts)[C,B]);
+     endfor;
+     \end{mpost}
+   \fi
+ }
+
+ \def\MPFractionTriangleH#1#2#3#4#5#6{
+  % #1 longueur du côté
+  % #2 partage sur le côté
+  % #3 num
+  % #4 déno (attention : = #2^2)
+  % #5 couleur
+  % #6 épaisseur
+  \ifluatex
+   \mplibforcehmode
+   \begin{mplibcode}
+     nbtriangle=0;
+
+     vardef Ligne(expr longueur)=
+     for k=0 upto 2*(longueur-1):
+     nbtriangle:=nbtriangle+1;
+     if (k mod 2)=0:
+     M[nbtriangle]=(Tria shifted(0.5*k*(1/nbparts)*(B-A)))  shifted((nbparts-longueur)*(1/nbparts)*(C-A));
+     else:
+     M[nbtriangle]=(Trir shifted(0.5*(k-1)*(1/nbparts)*(B-A)))  shifted((nbparts-longueur)*(1/nbparts)*(C-A));
+     fi;
+     endfor;
+     enddef;
+
+     pair A,B,C;
+     A=u*(0.5,0.5);
+     B-A=(#1,0);
+     C=rotation(B,A,60);
+
+     nbparts:=#2;
+
+     path M[];
+
+     path Tria,Trir;
+     Tria=polygone(A,(1/nbparts)[A,B],(1/nbparts)[A,C]);
+     Trir=symetrie(Tria,(1/nbparts)[A,B],(1/nbparts)[A,C]);
+
+     for k=nbparts downto 1:
+     Ligne(k);
+     endfor;
+
+     diversite=floor(uniformdeviate(#2**2-#3-1));
+     
+     for k=(1+diversite) upto (#3+diversite):
+     drawoptions(withpen pencircle scaled #6);
+     trace hachurage(M[k],90,0.2,0) withcolor #5;
+     endfor;
+     drawoptions(withpen pencircle scaled #6);
+     for k=1 upto nbparts:
+     trace segment((k/nbparts)[A,B],(k/nbparts)[A,C]);
+     trace segment((k/nbparts)[B,A],(k/nbparts)[B,C]);
+     trace segment((k/nbparts)[C,A],(k/nbparts)[C,B]);
+     endfor;
+   \end{mplibcode}
+     \else
+     \begin{mpost}
+       nbtriangle=0;
+
+     vardef Ligne(expr longueur)=
+     for k=0 upto 2*(longueur-1):
+     nbtriangle:=nbtriangle+1;
+     if (k mod 2)=0:
+     M[nbtriangle]=(Tria shifted(0.5*k*(1/nbparts)*(B-A)))  shifted((nbparts-longueur)*(1/nbparts)*(C-A));
+     else:
+     M[nbtriangle]=(Trir shifted(0.5*(k-1)*(1/nbparts)*(B-A)))  shifted((nbparts-longueur)*(1/nbparts)*(C-A));
+     fi;
+     endfor;
+     enddef;
+
+     pair A,B,C;
+     A=u*(0.5,0.5);
+     B-A=(#1,0);
+     C=rotation(B,A,60);
+
+     nbparts:=#2;
+
+     path M[];
+
+     path Tria,Trir;
+     Tria=polygone(A,(1/nbparts)[A,B],(1/nbparts)[A,C]);
+     Trir=symetrie(Tria,(1/nbparts)[A,B],(1/nbparts)[A,C]);
+
+     for k=nbparts downto 1:
+     Ligne(k);
+     endfor;
+
+     diversite=floor(uniformdeviate(#2**2-#3-1));
+     
+     for k=(1+diversite) upto (#3+diversite):
+     drawoptions(withpen pencircle scaled #6);
+     trace hachurage(M[k],90,0.2,0) withcolor #5;
+     endfor;
+     drawoptions(withpen pencircle scaled #6);
+     
+     for k=1 upto nbparts:
+     trace segment((k/nbparts)[A,B],(k/nbparts)[A,C]);
+     trace segment((k/nbparts)[B,A],(k/nbparts)[B,C]);
+     trace segment((k/nbparts)[C,A],(k/nbparts)[C,B]);
+     endfor;
+     \end{mpost}
+   \fi
+ }
+ 
+
+\def\MPFractionRegulier#1#2#3#4#5{%
   % #1 rayon, #2 nb côtés, #3 num, #4 deno, #5 couleur
   \ifluatex
    \mplibforcehmode
@@ -1506,38 +1796,90 @@
   \fi
 }
 
+\def\MPFractionSegmentH#1#2#3#4#5{
+  \ifluatex
+   \mplibforcehmode
+  \begin{mplibcode}
+    pair A,C,B[];
+    A=(0,0);
+    C-A=(#1,0);
+    for k=0 upto #3:
+    B[k]=(k/#3)[A,C];
+    endfor;
+    drawoptions(withpen pencircle scaled#5);
+    draw hachurage(polygone(B[0]+u*(0,-0.15),B[#2]+u*(0,-0.15),B[#2]+u*(0,0.15),B[0]+u*(0,0.15)),120,0.2,0)
+    withcolor #4;
+    drawoptions(withpen pencircle scaled#5);
+    draw segment(A,C);
+    marque_p:="tiretv";
+    for k=0 upto #3:
+    pointe(B[k]);
+    endfor;
+  \end{mplibcode}
+  \else
+  \begin{mpost}
+    pair A,C,B[];
+    A=(0,0);
+    C-A=(#1,0);
+    for k=0 upto #3:
+    B[k]=(k/#3)[A,C];
+    endfor;
+    drawoptions(withpen pencircle scaled#5);
+    draw hachurage(polygone(B[0]+u*(0,-0.15),B[#2]+u*(0,-0.15),B[#2]+u*(0,0.15),B[0]+u*(0,0.15)),120,0.2,0)
+    withcolor #4;
+    drawoptions(withpen pencircle scaled#5);
+    draw segment(A,C);
+    marque_p:="tiretv";
+    for k=0 upto #3:
+    pointe(B[k]);
+    endfor;
+  \end{mpost}
+  \fi
+}
+
 \newcommand\Fraction[2][]{%
   \useKVdefault[ClesFraction]%
   \setKV[ClesFraction]{#1}%
   \setsepchar[*]{/}%
   \readlist*\ListeFraction{#2}%
-  %\ListeFractionlen -- Le numérateur est \ListeFraction[1] et le
-  %dénominateur est \ListeFraction[2].
-  \ifboolKV[ClesFraction]{Regulier}{%
+  \ifboolKV[ClesFraction]{Triangle}{%
     \ifboolKV[ClesFraction]{Reponse}{}{\setKV[ClesFraction]{Couleur=white}}%
-    \ifboolKV[ClesFraction]{Hachures}{%
-      \MPFractionRegulierH{\useKV[ClesFraction]{Rayon}}{\useKV[ClesFraction]{Cotes}}{\ListeFraction[1]}{\ListeFraction[2]}{\useKV[ClesFraction]{Couleur}}{\useKV[ClesFraction]{Epaisseur}}%
+      \ifboolKV[ClesFraction]{Hachures}{%
+        \MPFractionTriangleH{\useKV[ClesFraction]{Longueur}}{\useKV[ClesFraction]{Parts}}{\ListeFraction[1]}{\ListeFraction[2]}{\useKV[ClesFraction]{Couleur}}{\useKV[ClesFraction]{Epaisseur}}%
       }{%
-        \MPFractionRegulier{\useKV[ClesFraction]{Rayon}}{\useKV[ClesFraction]{Cotes}}{\ListeFraction[1]}{\ListeFraction[2]}{\useKV[ClesFraction]{Couleur}}%
+        \MPFractionTriangle{\useKV[ClesFraction]{Longueur}}{\useKV[ClesFraction]{Parts}}{\ListeFraction[1]}{\ListeFraction[2]}{\useKV[ClesFraction]{Couleur}}%
       }
   }{%
-    \ifboolKV[ClesFraction]{Segment}{%
+    \ifboolKV[ClesFraction]{Regulier}{%
       \ifboolKV[ClesFraction]{Reponse}{}{\setKV[ClesFraction]{Couleur=white}}%
-      \MPFractionSegment{\useKV[ClesFraction]{Longueur}}{\ListeFraction[1]}{\ListeFraction[2]}{\useKV[ClesFraction]{Couleur}}%
-    }{
-      \ifboolKV[ClesFraction]{Rectangle}{%rectangle
+      \ifboolKV[ClesFraction]{Hachures}{%
+        \MPFractionRegulierH{\useKV[ClesFraction]{Rayon}}{\useKV[ClesFraction]{Cotes}}{\ListeFraction[1]}{\ListeFraction[2]}{\useKV[ClesFraction]{Couleur}}{\useKV[ClesFraction]{Epaisseur}}%
+      }{%
+        \MPFractionRegulier{\useKV[ClesFraction]{Rayon}}{\useKV[ClesFraction]{Cotes}}{\ListeFraction[1]}{\ListeFraction[2]}{\useKV[ClesFraction]{Couleur}}%
+      }
+    }{%
+      \ifboolKV[ClesFraction]{Segment}{%
         \ifboolKV[ClesFraction]{Reponse}{}{\setKV[ClesFraction]{Couleur=white}}%
         \ifboolKV[ClesFraction]{Hachures}{%
-          \MPFractionRectangleH{\useKV[ClesFraction]{Longueur}}{\useKV[ClesFraction]{Largeur}}{\ListeFraction[1]}{\ListeFraction[2]}{\useKV[ClesFraction]{Couleur}}{\useKV[ClesFraction]{Multiple}}{\useKV[ClesFraction]{Epaisseur}}%
+          \MPFractionSegmentH{\useKV[ClesFraction]{Longueur}}{\ListeFraction[1]}{\ListeFraction[2]}{\useKV[ClesFraction]{Couleur}}{\useKV[ClesFraction]{Epaisseur}}%
         }{%
-          \MPFractionRectangle{\useKV[ClesFraction]{Longueur}}{\useKV[ClesFraction]{Largeur}}{\ListeFraction[1]}{\ListeFraction[2]}{\useKV[ClesFraction]{Couleur}}{\useKV[ClesFraction]{Multiple}}%
+          \MPFractionSegment{\useKV[ClesFraction]{Longueur}}{\ListeFraction[1]}{\ListeFraction[2]}{\useKV[ClesFraction]{Couleur}}%
         }
-      }{%disque
-        \ifboolKV[ClesFraction]{Reponse}{}{\setKV[ClesFraction]{Couleur=white}}%
-        \ifboolKV[ClesFraction]{Hachures}{%
-         \MPFractionDisqueH{\useKV[ClesFraction]{Rayon}}{\ListeFraction[1]}{\ListeFraction[2]}{\useKV[ClesFraction]{Couleur}}{\useKV[ClesFraction]{Epaisseur}}% 
-        }{%
-          \MPFractionDisque{\useKV[ClesFraction]{Rayon}}{\ListeFraction[1]}{\ListeFraction[2]}{\useKV[ClesFraction]{Couleur}}%
+      }{
+        \ifboolKV[ClesFraction]{Rectangle}{%rectangle
+          \ifboolKV[ClesFraction]{Reponse}{}{\setKV[ClesFraction]{Couleur=white}}%
+          \ifboolKV[ClesFraction]{Hachures}{%
+            \MPFractionRectangleH{\useKV[ClesFraction]{Longueur}}{\useKV[ClesFraction]{Largeur}}{\ListeFraction[1]}{\ListeFraction[2]}{\useKV[ClesFraction]{Couleur}}{\useKV[ClesFraction]{Multiple}}{\useKV[ClesFraction]{Epaisseur}}%
+          }{%
+            \MPFractionRectangle{\useKV[ClesFraction]{Longueur}}{\useKV[ClesFraction]{Largeur}}{\ListeFraction[1]}{\ListeFraction[2]}{\useKV[ClesFraction]{Couleur}}{\useKV[ClesFraction]{Multiple}}%
+          }
+        }{%disque
+          \ifboolKV[ClesFraction]{Reponse}{}{\setKV[ClesFraction]{Couleur=white}}%
+          \ifboolKV[ClesFraction]{Hachures}{%
+            \MPFractionDisqueH{\useKV[ClesFraction]{Rayon}}{\ListeFraction[1]}{\ListeFraction[2]}{\useKV[ClesFraction]{Couleur}}{\useKV[ClesFraction]{Epaisseur}}% 
+          }{%
+            \MPFractionDisque{\useKV[ClesFraction]{Rayon}}{\ListeFraction[1]}{\ListeFraction[2]}{\useKV[ClesFraction]{Couleur}}%
+          }%
         }%
       }%
     }%
@@ -1544,9 +1886,9 @@
   }%
 }%
 
-%%%%%%%%%%%%%%%%
-%%% Réponses à relier
-%%%%%%%%%%%%%%%%
+%%%
+% Réponses à relier
+%%%
 \setKVdefault[ClesRelie]{Solution=false,LargeurG=5cm,LargeurD=2cm,Stretch=1.5,Ecart=2cm}
 
 \newcommand\Relie[2][]{%
@@ -1603,63 +1945,86 @@
   \setcounter{NbRelie}{0}%
 }%
 
-%%%%%%%%%%%%%%%%%%
-%% QCM
-%%%%%%%%%%%%%%%%%%
-\setKVdefault[ClesQCM]{Reponses=3,Solution=false,Stretch=1,Largeur=2cm,Couleur=gray!15,Titre=false,Nom=Réponse,Alph=false,VF=false,Depart=1,Alterne=false}
+%%%
+% QCM
+%%%
+\setKVdefault[ClesQCM]{Reponses=3,Solution=false,Stretch=1,Largeur=2cm,Couleur=gray!15,Titre=false,Nom=Réponse,NomV=Vrai,NomF=Faux,Alph=false,AlphT=false,VF=false,Depart=1,Alterne=false,Noms={A/B/C},Multiple=false}
 \newlength{\LargeurQCM}
 \newcounter{QuestionQCM}
+\newcounter{TitreQCM}
 \newcommand\QCM[2][]{%
   \useKVdefault[ClesQCM]%
   \setKV[ClesQCM]{#1}%
   \setcounter{QuestionQCM}{\fpeval{\useKV[ClesQCM]{Depart}-1}}%
+  \setcounter{TitreQCM}{0}
   \setsepchar[*]{,*&}\ignoreemptyitems%
   \readlist*\ListeQCM{#2}%
-  \ifboolKV[ClesQCM]{VF}{%
-    \setKV[ClesQCM]{Reponses=2}
+  \ifboolKV[ClesQCM]{Multiple}{%
     \renewcommand{\arraystretch}{\useKV[ClesQCM]{Stretch}}%
     \setlength{\LargeurQCM}{\fpeval{(\linewidth-\useKV[ClesQCM]{Reponses}*(3*\tabcolsep+\useKV[ClesQCM]{Largeur}))}pt}%
     \xdef\NBcases{\fpeval{\useKV[ClesQCM]{Reponses}+1}}%
+    \xdef\ListeNom{\useKV[ClesQCM]{Noms}}%
+    \setsepchar[*]{/}%
+    \readlist*\ListeNomsMul{\ListeNom}%
     \begin{tabular}{|p{\LargeurQCM}|*{\useKV[ClesQCM]{Reponses}}{>{\centering\arraybackslash}p{\useKV[ClesQCM]{Largeur}}|}}%
       \cline{2-\NBcases}%
-      \multicolumn{1}{c|}{}&Vrai&Faux\\
-      \hline%
-      \xintFor* ##1 in {\xintSeq {1}{\ListeQCMlen}}\do{%
-      \stepcounter{QuestionQCM}\ifboolKV[ClesQCM]{Alph}{\textbf{\Alph{QuestionQCM}}/}{\ifboolKV[ClesQCM]{Alterne}{\modulo{\theQuestionQCM}{2}\ifnum\remainder=0\cellcolor{gray!15}\fi}{}\textbf{\theQuestionQCM/}}~\ListeQCM[##1,1]\xintFor* ##2 in {\xintSeq {1}{\useKV[ClesQCM]{Reponses}}}\do{%
-                           &\ifboolKV[ClesQCM]{Alterne}{\modulo{\theQuestionQCM}{2}\ifnum\remainder=0\cellcolor{gray!15}\fi}{}\ifboolKV[ClesQCM]{Solution}{\xintifboolexpr{##2=\ListeQCM[##1,2]}{$\boxtimes$}{$\square$}}{$\square$}%
-        }\\
-      }%
-      \hline%
-      \end{tabular}
-  }{%
-    \renewcommand{\arraystretch}{\useKV[ClesQCM]{Stretch}}%
-    \setlength{\LargeurQCM}{\fpeval{(\linewidth-\useKV[ClesQCM]{Reponses}*(3*\tabcolsep+\useKV[ClesQCM]{Largeur}))}pt}%
-    \xdef\NBcases{\fpeval{\useKV[ClesQCM]{Reponses}+1}}%
-    \begin{tabular}{|p{\LargeurQCM}|*{\useKV[ClesQCM]{Reponses}}{>{\centering\arraybackslash}p{\useKV[ClesQCM]{Largeur}}|}}%
-      \ifboolKV[ClesQCM]{Titre}{\cline{2-\NBcases}%
       \multicolumn{1}{c|}{}\xintFor* ##2 in {\xintSeq {1}{\useKV[ClesQCM]{Reponses}}}\do{%
-      &\useKV[ClesQCM]{Nom} ##2}%
+      &\ListeNomsMul[##2]}%
       \\
-      }{}
       \hline%
       \xintFor* ##1 in {\xintSeq {1}{\ListeQCMlen}}\do{%
-      \stepcounter{QuestionQCM}\ifboolKV[ClesQCM]{Alph}{\textbf{\Alph{QuestionQCM}}/}{\textbf{\theQuestionQCM/}}~\ListeQCM[##1,1]\xintFor* ##2 in {\xintSeq {1}{\useKV[ClesQCM]{Reponses}}}\do{%
-      &\ifboolKV[ClesQCM]{Solution}{\xdef\NumeroReponse{\fpeval{\useKV[ClesQCM]{Reponses}+2}}\xintifboolexpr{##2=\ListeQCM[##1,\NumeroReponse]}{\cellcolor{\useKV[ClesQCM]{Couleur}}}{}}{}\ListeQCM[##1,##2+1]%
+      \stepcounter{QuestionQCM}\ifboolKV[ClesQCM]{Alterne}{\modulo{\theQuestionQCM}{2}\ifnum\remainder=0\cellcolor{gray!15}\fi}{}\ifboolKV[ClesQCM]{Alph}{\textbf{\Alph{QuestionQCM}}/}{\textbf{\theQuestionQCM/}}~\ListeQCM[##1,1]\xintFor* ##2 in {\xintSeq {1}{\useKV[ClesQCM]{Reponses}}}\do{%
+      &\ifboolKV[ClesQCM]{Alterne}{\modulo{\theQuestionQCM}{2}\ifnum\remainder=0\cellcolor{gray!15}\fi}{}\ifboolKV[ClesQCM]{Solution}{\xintifboolexpr{\ListeQCM[##1,\fpeval{##2+1}]=1}{$\boxtimes$}{$\square$}}{$\square$}%
         }\\
       }%
       \hline%
     \end{tabular}%
+  }{%
+    \ifboolKV[ClesQCM]{VF}{%
+      \setKV[ClesQCM]{Reponses=2}
+      \renewcommand{\arraystretch}{\useKV[ClesQCM]{Stretch}}%
+      \setlength{\LargeurQCM}{\fpeval{(\linewidth-\useKV[ClesQCM]{Reponses}*(3*\tabcolsep+\useKV[ClesQCM]{Largeur}))}pt}%
+      \xdef\NBcases{\fpeval{\useKV[ClesQCM]{Reponses}+1}}%
+      \begin{tabular}{|p{\LargeurQCM}|*{\useKV[ClesQCM]{Reponses}}{>{\centering\arraybackslash}p{\useKV[ClesQCM]{Largeur}}|}}%
+        \cline{2-\NBcases}%
+        \multicolumn{1}{c|}{}&\useKV[ClesQCM]{NomV}&\useKV[ClesQCM]{NomF}\\
+        \hline%
+        \xintFor* ##1 in {\xintSeq {1}{\ListeQCMlen}}\do{%
+        \stepcounter{QuestionQCM}\ifboolKV[ClesQCM]{Alterne}{\modulo{\theQuestionQCM}{2}\ifnum\remainder=0\cellcolor{gray!15}\fi}{}\ifboolKV[ClesQCM]{Alph}{\textbf{\Alph{QuestionQCM}}/}{\textbf{\theQuestionQCM/}}~\ListeQCM[##1,1]\xintFor* ##2 in {\xintSeq {1}{\useKV[ClesQCM]{Reponses}}}\do{%
+                             &\ifboolKV[ClesQCM]{Alterne}{\modulo{\theQuestionQCM}{2}\ifnum\remainder=0\cellcolor{gray!15}\fi}{}\ifboolKV[ClesQCM]{Solution}{\xintifboolexpr{##2=\ListeQCM[##1,2]}{$\boxtimes$}{$\square$}}{$\square$}%
+                               }\\
+        }%
+        \hline%
+      \end{tabular}
+    }{%
+      \renewcommand{\arraystretch}{\useKV[ClesQCM]{Stretch}}%
+      \setlength{\LargeurQCM}{\fpeval{(\linewidth-\useKV[ClesQCM]{Reponses}*(3*\tabcolsep+\useKV[ClesQCM]{Largeur}))}pt}%
+      \xdef\NBcases{\fpeval{\useKV[ClesQCM]{Reponses}+1}}%
+      \begin{tabular}{|p{\LargeurQCM}|*{\useKV[ClesQCM]{Reponses}}{>{\centering\arraybackslash}p{\useKV[ClesQCM]{Largeur}}|}}%
+        \ifboolKV[ClesQCM]{Titre}{\cline{2-\NBcases}%
+        \multicolumn{1}{c|}{}\xintFor* ##2 in {\xintSeq {1}{\useKV[ClesQCM]{Reponses}}}\do{%
+        &\stepcounter{TitreQCM}\useKV[ClesQCM]{Nom} \ifboolKV[ClesQCM]{AlphT}{\Alph{TitreQCM}}{##2}}%
+        \\
+        }{}
+        \hline%
+        \xintFor* ##1 in {\xintSeq {1}{\ListeQCMlen}}\do{%
+        \stepcounter{QuestionQCM}\ifboolKV[ClesQCM]{Alterne}{\modulo{\theQuestionQCM}{2}\ifnum\remainder=0\cellcolor{gray!15}\fi}{}\ifboolKV[ClesQCM]{Alph}{\textbf{\Alph{QuestionQCM}}/}{\textbf{\theQuestionQCM/}}~\ListeQCM[##1,1]\xintFor* ##2 in {\xintSeq {1}{\useKV[ClesQCM]{Reponses}}}\do{%
+        &\ifboolKV[ClesQCM]{Alterne}{\modulo{\theQuestionQCM}{2}\ifnum\remainder=0\cellcolor{gray!15}\fi}{}\ifboolKV[ClesQCM]{Solution}{\xdef\NumeroReponse{\fpeval{\useKV[ClesQCM]{Reponses}+2}}\xintifboolexpr{##2=\ListeQCM[##1,\NumeroReponse]}{\cellcolor{\useKV[ClesQCM]{Couleur}}}{}}{}\ListeQCM[##1,##2+1]%
+          }\\
+        }%
+        \hline%
+      \end{tabular}%
+    }%
   }%
 }
 
-%%%%%%%%%%%%%%%%%%%%%
-%%%% Somme des angles
-%%%%%%%%%%%%%%%%%%%%%
+%%%
+% Somme des angles
+%%%
 
-\setKVdefault[ClesSommeAngle]{Detail=true,Figure=false,Isocele=false}%
+\setKVdefault[ClesSommeAngle]{Detail=true,Isocele=false,Figure=false,FigureSeule=false,Angle=0}%
 
-% On définit la figure à utiliser
-\def\MPFigureSommeAngle#1#2#3#4#5#6{
+\def\MPFigureSommeAngle#1#2#3#4#5#6#7{
     % #1 Premier sommet
     % #2 Deuxième sommet
     % #3 Troisième sommet
@@ -1679,11 +2044,9 @@
     O - .5[A,B] = whatever * (B-A) rotated 90;
     O - .5[B,C] = whatever * (C-B) rotated 90;
     % On tourne pour éventuellement moins de lassitude :)
-    numeric Angle;
-    Angle=uniformdeviate(180);%Caractère aléatoire
-    A:=A rotatedabout(O,Angle);
-    B:=B rotatedabout(O,Angle);
-    C:=C rotatedabout(O,Angle);
+    A:=A rotatedabout(O,#7);
+    B:=B rotatedabout(O,#7);
+    C:=C rotatedabout(O,#7);
     % On définit le centre du cercle inscrit
     (I-C) rotated ((angle(A-C)-angle(B-C))/2) shifted C=whatever[A,C];
     (I-B) rotated ((angle(C-B)-angle(A-B))/2) shifted B=whatever[B,C];
@@ -1715,16 +2078,13 @@
     draw Codelongueur(A,B,A,C,2);
     marque_s:=marque_s*2;
     label(btex $\ang{#4}$ etex,B+0.95u*unitvector(I-B));
-    % label(btex $\ang{#5}$ etex,C+0.95u*unitvector(I-C));
     label(btex ? etex,A+0.95u*unitvector(I-A));
     else:
-%    if (#4=180-#5-#4) or (#5=180-#5-#4):
     marque_s:=marque_s/2;
     draw Codelongueur(A,B,A,C,2);
     marque_s:=marque_s*2;
     label(btex $\ang{#4}$ etex,A+0.95u*unitvector(I-A));
     label(btex ? etex,B+0.95u*unitvector(I-B));
-    % label(btex $\ang{#5}$ etex,C+0.95u*unitvector(I-C));
     fi;
     else:
     label(btex $\ang{#4}$ etex,B+0.95u*unitvector(I-B));
@@ -1747,11 +2107,9 @@
     O - .5[A,B] = whatever * (B-A) rotated 90;
     O - .5[B,C] = whatever * (C-B) rotated 90;
     % On tourne pour éventuellement moins de lassitude :)
-    numeric Angle;
-    Angle=uniformdeviate(180);%Caractère aléatoire
-    A:=A rotatedabout(O,Angle);
-    B:=B rotatedabout(O,Angle);
-    C:=C rotatedabout(O,Angle);
+    A:=A rotatedabout(O,#7);
+    B:=B rotatedabout(O,#7);
+    C:=C rotatedabout(O,#7);
     % On définit le centre du cercle inscrit
     (I-C) rotated ((angle(A-C)-angle(B-C))/2) shifted C=whatever[A,C];
     (I-B) rotated ((angle(C-B)-angle(A-B))/2) shifted B=whatever[B,C];
@@ -1783,16 +2141,13 @@
     draw Codelongueur(A,B,A,C,2);
     marque_s:=marque_s*2;
     label(btex $\ang{#4}$ etex,B+0.95u*unitvector(I-B));
-    % label(btex $\ang{#5}$ etex,C+0.95u*unitvector(I-C));
     label(btex ? etex,A+0.95u*unitvector(I-A));
     else:
-    %if (#4=180-#5-#4) or (#5=180-#5-#4):
     marque_s:=marque_s/2;
     draw Codelongueur(A,B,A,C,2);
     marque_s:=marque_s*2;
     label(btex $\ang{#4}$ etex,A+0.95u*unitvector(I-A));
     label(btex ? etex,B+0.95u*unitvector(I-B));
-    % label(btex $\ang{#5}$ etex,C+0.95u*unitvector(I-C));
     fi;
     else:
     label(btex $\ang{#4}$ etex,B+0.95u*unitvector(I-B));
@@ -1863,33 +2218,45 @@
   \StrMid{#2}{2}{2}[\NomB]%
   \StrMid{#2}{3}{3}[\NomC]%
   % Figure ou pas ?
-  \ifboolKV[ClesSommeAngle]{Figure}{%
-    \begin{multicols}{2}%
-      {\em La figure est donnée à titre indicatif.}%
-      \ifx#3\bla\bla%
-      \xdef\Intermed{\fpeval{0.5*(180-#4)}}%
-      \[\MPFigureSommeAngle{\NomA}{\NomB}{\NomC}{#4}{\Intermed}{0}\]%
-      \else%
-      \ifx#4\bla\bla%
-      \[\MPFigureSommeAngle{\NomA}{\NomB}{\NomC}{#3}{#3}{0}\]%
-      \else%
-      \[\MPFigureSommeAngle{\NomA}{\NomB}{\NomC}{#3}{#4}{1}\]%
-      \fi%
-      \fi%
-      \par\columnbreak\par%
-      % on rédige
+  \ifboolKV[ClesSommeAngle]{FigureSeule}{%
+    \ifx#3\bla\bla%
+    \xdef\Intermed{\fpeval{0.5*(180-#4)}}%
+    \MPFigureSommeAngle{\NomA}{\NomB}{\NomC}{#4}{\Intermed}{0}{\useKV[ClesSommeAngle]{Angle}}%
+    \else%
+    \ifx#4\bla\bla%
+    \MPFigureSommeAngle{\NomA}{\NomB}{\NomC}{#3}{#3}{0}{\useKV[ClesSommeAngle]{Angle}}%
+    \else%
+    \MPFigureSommeAngle{\NomA}{\NomB}{\NomC}{#3}{#4}{1}{\useKV[ClesSommeAngle]{Angle}}%
+    \fi%
+    \fi%
+  }{%
+    \ifboolKV[ClesSommeAngle]{Figure}{%
+      \begin{multicols}{2}%
+        {\em La figure est donnée à titre indicatif.}%
+        \ifx#3\bla\bla%
+        \xdef\Intermed{\fpeval{0.5*(180-#4)}}%
+        \[\MPFigureSommeAngle{\NomA}{\NomB}{\NomC}{#4}{\Intermed}{0}{\useKV[ClesSommeAngle]{Angle}}\]%
+        \else%
+        \ifx#4\bla\bla%
+        \[\MPFigureSommeAngle{\NomA}{\NomB}{\NomC}{#3}{#3}{0}{\useKV[ClesSommeAngle]{Angle}}\]%
+        \else%
+        \[\MPFigureSommeAngle{\NomA}{\NomB}{\NomC}{#3}{#4}{1}{\useKV[ClesSommeAngle]{Angle}}\]%
+        \fi%
+        \fi%
+        \par\columnbreak\par%
+        % on rédige
+        \RedactionSomme[#1]{#2}{#3}{#4}%
+      \end{multicols}%
+    }{% on rédige
       \RedactionSomme[#1]{#2}{#3}{#4}%
-    \end{multicols}%
-  }{% on rédige
-    \RedactionSomme[#1]{#2}{#3}{#4}%
+    }%
   }%
 }%
 
-%%%%%%%%%%%%%%%% 
-%% Le théorème de Pythagore
-%%%%%%%%%%%%%%%% 
-% On définit le trousseau de clés optionnelles
-\setKVdefault[ClesPythagore]{Exact=false,AvantRacine=false,Racine=false,Entier=false,Egalite=false,Precision=2,Soustraction=false,Figure=false,Angle=0,Reciproque=false,ReciColonnes=false,Faible=false,Unite=cm,EnchaineA=false,EnchaineB=false,EnchaineC=false,ValeurA=0,ValeurB=0,ValeurC=0}
+%%%
+% Le théorème de Pythagore
+%%%
+\setKVdefault[ClesPythagore]{Exact=false,AvantRacine=false,Racine=false,Entier=false,Egalite=false,Precision=2,Soustraction=false,Figure=false,FigureSeule=false,Angle=0,Reciproque=false,ReciColonnes=false,Faible=false,Unite=cm,EnchaineA=false,EnchaineB=false,EnchaineC=false,ValeurA=0,ValeurB=0,ValeurC=0}
 
 % On définit les figures à utiliser
 \def\MPFigurePytha#1#2#3#4#5#6{%
@@ -1926,19 +2293,20 @@
     decalage=3mm;
     if #4<#5 :
     if ypart(B)>ypart(O) :
-        label(btex \num{#4} etex rotated angle(C-B),1/2[C,B]-decalage*(unitvector(A-B)));
-        label(btex \num{#5} etex rotated(angle(B-A)),1/2[A,B]-decalage*(unitvector(C-B)));
-      else:
-        label(btex \num{#4} etex rotated angle(B-C),1/2[C,B]-decalage*(unitvector(A-B)));
-        label(btex \num{#5} etex rotated(angle(A-B)),1/2[A,B]-decalage*(unitvector(C-B)));
-      fi
+        label(btex \num{#4} etex,1/2[C,B]-decalage*(unitvector(A-B)));
+        label(btex \num{#5} etex,1/2[A,B]-decalage*(unitvector(C-B)));
+     else:
+        label(btex \num{#4} etex,1/2[C,B]-decalage*(unitvector(A-B)));
+        label(btex \num{#5} etex,1/2[A,B]-decalage*(unitvector(C-B)));
+     fi
     else:
       if ypart(B)>ypart(O) :
-        label(btex \num{#4} etex rotated angle(C-A),1/2[C,A]-decalage*(unitvector(C-A) rotated 90));
-        label(btex \num{#5} etex rotated(angle(C-B)),1/2[C,B]-decalage*(unitvector(C-B)));
-      else:
-        label(btex \num{#4} etex rotated angle(A-C),1/2[A,C]+decalage*(unitvector(A-C) rotated 90));
-        label(btex \num{#5} etex rotated(angle(A-B)),1/2[A,B]-decalage*(unitvector(C-B)));
+      label(btex \num{#4} etex,1/2[C,A]-decalage*(unitvector(C-A) rotated 90));
+        label(btex \num{#5} etex,1/2[C,B]+decalage*(unitvector(B-A)));
+        else:
+        label(btex \num{#4} etex,1/2[A,C]+decalage*(unitvector(A-C)
+        rotated 90));
+        label(btex \num{#5} etex,1/2[A,B]-decalage*(unitvector(C-B)));
       fi;
     fi;
     label(btex #3 etex,1.2[O,A]);
@@ -1971,20 +2339,20 @@
     decalage=3mm;
     if #4<#5 :
     if ypart(B)>ypart(O) :
-        label(LATEX("\num{"&decimal(#4)&"}") rotated
-        angle(C-B),1/2[C,B]-decalage*(unitvector(A-B)));
-        label(LATEX("\num{"&decimal(#5)&"}") rotated(angle(B-A)),1/2[A,B]-decalage*(unitvector(C-B)));
-      else:
-        label(LATEX("\num{"&decimal(#4)&"}") rotated angle(B-C),1/2[C,B]-decalage*(unitvector(A-B)));
-        label(LATEX("\num{"&decimal(#5)&"}") rotated(angle(A-B)),1/2[A,B]-decalage*(unitvector(C-B)));
-      fi
+        label(btex \num{#4} etex,1/2[C,B]-decalage*(unitvector(A-B)));
+        label(btex \num{#5} etex,1/2[A,B]-decalage*(unitvector(C-B)));
+     else:
+        label(btex \num{#4} etex,1/2[C,B]-decalage*(unitvector(A-B)));
+        label(btex \num{#5} etex,1/2[A,B]-decalage*(unitvector(C-B)));
+     fi
     else:
       if ypart(B)>ypart(O) :
-        label(LATEX("\num{"&decimal(#4)&"}") rotated angle(C-A),1/2[C,A]-decalage*(unitvector(C-A) rotated 90));
-        label(LATEX("\num{"&decimal(#5)&"}") rotated(angle(C-B)),1/2[C,B]-decalage*(unitvector(C-B)));
-      else:
-        label(LATEX("\num{"&decimal(#4)&"}") rotated angle(A-C),1/2[A,C]+decalage*(unitvector(A-C) rotated 90));
-        label(LATEX("\num{"&decimal(#5)&"}") rotated(angle(A-B)),1/2[A,B]-decalage*(unitvector(C-B)));
+      label(btex \num{#4} etex,1/2[C,A]-decalage*(unitvector(C-A) rotated 90));
+        label(btex \num{#5} etex,1/2[C,B]+decalage*(unitvector(B-A)));
+        else:
+        label(btex \num{#4} etex,1/2[A,C]+decalage*(unitvector(A-C)
+        rotated 90));
+        label(btex \num{#5} etex,1/2[A,B]-decalage*(unitvector(C-B)));
       fi;
     fi;
     label(btex #3 etex,1.2[O,A]);
@@ -2018,23 +2386,18 @@
     A:=A rotatedabout(O,#7);
     B:=B rotatedabout(O,#7);
     C:=C rotatedabout(O,#7);
-    % On définit l'angle droit
-    % D-B=7*unitvector(C-B);
-    % F-B=7*unitvector(A-B);
-    % E-D=F-B;
     draw A{dir(angle(B-A)+5)}..B{dir(angle(B-A)+5)};
     draw B{dir(angle(C-B)+5)}..C{dir(angle(C-B)+5)};
     draw C{dir(angle(A-C)+5)}..A{dir(angle(A-C)+5)};    
-    % draw D--E--F;
     decalage=3mm;
     if ypart(B)>ypart(O) :
-    label(btex \num{#4} etex rotated angle(C-A),1/2[C,A]-decalage*(unitvector(C-A) rotated 90));
-    label(btex \num{#5} etex rotated(angle(C-B)),1/2[C,B]-decalage*(unitvector(C-B)));
-    label(btex \num{#6} etex rotated(angle(B-A)),1/2[A,B]-decalage*(unitvector(C-B)));
+    label(btex \num{#4} etex,1/2[C,A]-decalage*(unitvector(C-A) rotated 90));
+    label(btex \num{#5} etex,1/2[C,B]-decalage*(unitvector(C-B)));
+    label(btex \num{#6} etex,1/2[A,B]-decalage*(unitvector(C-B)));
     else:
-    label(btex \num{#4} etex rotated angle(A-C),1/2[A,C]+decalage*(unitvector(A-C) rotated 90));
-    label(btex \num{#5} etex rotated(angle(A-B)),1/2[A,B]-decalage*(unitvector(C-B)));
-    label(btex \num{#6} etex rotated angle(C-B),1/2[C,B]-decalage*(unitvector(A-B)));
+    label(btex \num{#4} etex,1/2[A,C]+decalage*(unitvector(A-C) rotated 90));
+    label(btex \num{#5} etex,1/2[A,B]-decalage*(unitvector(C-B)));
+    label(btex \num{#6} etex,1/2[C,B]-decalage*(unitvector(A-B)));
     fi;
     label(btex #1 etex,1.2[O,A]);
     label(btex #2 etex,1.2[O,B]);
@@ -2055,14 +2418,9 @@
     A:=A rotatedabout(O,#7);
     B:=B rotatedabout(O,#7);
     C:=C rotatedabout(O,#7);
-    % On définit l'angle droit
-    % D-B=7*unitvector(C-B);
-    % F-B=7*unitvector(A-B);
-    % E-D=F-B;
     draw A{dir(angle(B-A)+5)}..B{dir(angle(B-A)+5)};
     draw B{dir(angle(C-B)+5)}..C{dir(angle(C-B)+5)};
     draw C{dir(angle(A-C)+5)}..A{dir(angle(A-C)+5)};    
-    % draw D--E--F;
     decalage=3mm;
     if ypart(B)>ypart(O) :
     label(LATEX("\num{"&decimal(#4)&"}") rotated angle(C-A),1/2[C,A]-decalage*(unitvector(C-A) rotated 90));
@@ -2098,20 +2456,54 @@
     \opcopy{#4}{A2}%
     \opcopy{#5}{A3}%
     % On trace une figure ou pas ?
-    \ifboolKV[ClesPythagore]{Figure}{%Utilisation obligatoire de l'option --shell-escape de la compilation
-      \begin{multicols}{2}
-        {\em La figure est donnée à titre indicatif.}%
-        \[\MPFigureReciPytha{\NomA}{\NomB}{\NomC}{#3}{#4}{#5}{\useKV[ClesPythagore]{Angle}}\]%
-        \par\columnbreak\par%
-        % on rédige
+    \ifboolKV[ClesPythagore]{FigureSeule}{%
+      \MPFigureReciPytha{\NomA}{\NomB}{\NomC}{#3}{#4}{#5}{\useKV[ClesPythagore]{Angle}}%
+    }{%
+      \ifboolKV[ClesPythagore]{Figure}{%Utilisation obligatoire de l'option --shell-escape de la compilation
+        \begin{multicols}{2}
+          {\em La figure est donnée à titre indicatif.}%
+          \[\MPFigureReciPytha{\NomA}{\NomB}{\NomC}{#3}{#4}{#5}{\useKV[ClesPythagore]{Angle}}\]%
+          \par\columnbreak\par%
+          % on rédige
+          Dans le triangle $#2$, $[\NomA\NomC]$ est le plus grand côté.%
+          \ifboolKV[ClesPythagore]{ReciColonnes}{%
+            \[
+              \begin{array}{cccc|cccc}
+                &&\NomA\NomC^2&&&\NomA\NomB^2&+&\NomB\NomC^2\\
+                &&\opexport{A1}{\Aun}\num{\Aun}^2&&&\opexport{A2}{\Adeux}\num{\Adeux}^2&+&\opexport{A3}{\Atrois}\num{\Atrois}^2\\
+                &&\opmul*{A1}{A1}{a1}&&&\opmul*{A2}{A2}{a2}\opexport{a2}{\Adeux}\num{\Adeux}&+&\opmul*{A3}{A3}{a3}\opexport{a3}{\Atrois}\num{\Atrois}\\
+                &&\opexport{a1}{\Aun}\num{\Aun}&&&\multicolumn{3}{c}{\opadd*{a2}{a3}{a4}\opexport{a4}{\Aquatre}\num{\Aquatre}}\\
+              \end{array}
+            \]
+          }{%
+            \[\left.
+                \begin{array}{l}
+                  \NomA\NomC^2=\opexport{A1}{\Aun}\num{\Aun}^2=\opmul*{A1}{A1}{a1}\opexport{a1}{\Aun}\num{\Aun}\\
+                  \\
+                  \NomA\NomB^2+\NomB\NomC^2=\opexport{A2}{\Adeux}\num{\Adeux}^2+\opexport{A3}{\Atrois}\num{\Atrois}^2=\opmul*{A2}{A2}{a2}\opexport{a2}{\Adeux}\num{\Adeux}+\opmul*{A3}{A3}{a3}\opexport{a3}{\Atrois}\num{\Atrois}=\opadd*{a2}{a3}{a4}\opexport{a4}{\Aquatre}\num{\Aquatre}\\
+                \end{array}
+              \right\}\opcmp{a1}{a4}\ifopeq\NomA\NomC^2=\NomA\NomB^2+\NomB\NomC^2\fi\opcmp{a1}{a4}\ifopneq\NomA\NomC^2\not=\NomA\NomB^2+\NomB\NomC^2\fi
+            \]
+          }
+          \ifboolKV[ClesPythagore]{Egalite}{%
+            \opcmp{a1}{a4}\ifopeq Comme $\NomA\NomC^2=\NomA\NomB^2+\NomB\NomC^2$, alors l'égalité de Pythagore est vérifiée. Donc le triangle $#2$ est rectangle en $\NomB$.\fi%
+            \opcmp{a1}{a4}\ifopneq Comme $\NomA\NomC^2\not=\NomA\NomB^2+\NomB\NomC^2$, alors l'égalité de Pythagore n'est pas vérifiée. Donc le triangle $#2$ n'est pas rectangle.\fi%
+          }{%
+            \opcmp{a1}{a4}\ifopeq Comme $\NomA\NomC^2=\NomA\NomB^2+\NomB\NomC^2$, alors le triangle $#2$ est rectangle
+            en $\NomB$ d'après la réciproque du théorème de Pythagore.\fi%
+            \opcmp{a1}{a4}\ifopneq Comme $\NomA\NomC^2\not=\NomA\NomB^2+\NomB\NomC^2$, alors le
+            triangle $#2$ n'est pas rectangle\ifboolKV[ClesPythagore]{Faible}{.}{ d'après la contraposée du théorème de Pythagore.}\fi%
+          }
+        \end{multicols}
+      }{%
         Dans le triangle $#2$, $[\NomA\NomC]$ est le plus grand côté.%
         \ifboolKV[ClesPythagore]{ReciColonnes}{%
           \[
             \begin{array}{cccc|cccc}
-              \NomA\NomC^2&&&&&\NomA\NomB^2&+&\NomB\NomC^2\\
-              \opexport{A1}{\Aun}\num{\Aun}^2&&&&&\opexport{A2}{\Adeux}\num{\Adeux}^2&+&\opexport{A3}{\Atrois}\num{\Atrois}^2\\
-              \opmul*{A1}{A1}{a1}&&&&&\opmul*{A2}{A2}{a2}\opexport{a2}{\Adeux}\num{\Adeux}&+&\opmul*{A3}{A3}{a3}\opexport{a3}{\Atrois}\num{\Atrois}\\
-              \opexport{a1}{\Aun}\num{\Aun}&&&&&\multicolumn{3}{c}{\opadd*{a2}{a3}{a4}\opexport{a4}{\Aquatre}\num{\Aquatre}}\\
+              &&\NomA\NomC^2&&&\NomA\NomB^2&+&\NomB\NomC^2\\
+              &&\opexport{A1}{\Aun}\num{\Aun}^2&&&\opexport{A2}{\Adeux}\num{\Adeux}^2&+&\opexport{A3}{\Atrois}\num{\Atrois}^2\\
+              &&\opmul*{A1}{A1}{a1}&&&\opmul*{A2}{A2}{a2}\opexport{a2}{\Adeux}\num{\Adeux}&+&\opmul*{A3}{A3}{a3}\opexport{a3}{\Atrois}\num{\Atrois}\\
+              &&\opexport{a1}{\Aun}\num{\Aun}&&&\multicolumn{3}{c}{\opadd*{a2}{a3}{a4}\opexport{a4}{\Aquatre}\num{\Aquatre}}\\
             \end{array}
           \]
         }{%
@@ -2123,7 +2515,7 @@
               \end{array}
             \right\}\opcmp{a1}{a4}\ifopeq\NomA\NomC^2=\NomA\NomB^2+\NomB\NomC^2\fi\opcmp{a1}{a4}\ifopneq\NomA\NomC^2\not=\NomA\NomB^2+\NomB\NomC^2\fi
           \]
-        }
+        }%
         \ifboolKV[ClesPythagore]{Egalite}{%
           \opcmp{a1}{a4}\ifopeq Comme $\NomA\NomC^2=\NomA\NomB^2+\NomB\NomC^2$, alors l'égalité de Pythagore est vérifiée. Donc le triangle $#2$ est rectangle en $\NomB$.\fi%
           \opcmp{a1}{a4}\ifopneq Comme $\NomA\NomC^2\not=\NomA\NomB^2+\NomB\NomC^2$, alors l'égalité de Pythagore n'est pas vérifiée. Donc le triangle $#2$ n'est pas rectangle.\fi%
@@ -2132,39 +2524,9 @@
           en $\NomB$ d'après la réciproque du théorème de Pythagore.\fi%
           \opcmp{a1}{a4}\ifopneq Comme $\NomA\NomC^2\not=\NomA\NomB^2+\NomB\NomC^2$, alors le
           triangle $#2$ n'est pas rectangle\ifboolKV[ClesPythagore]{Faible}{.}{ d'après la contraposée du théorème de Pythagore.}\fi%
-        }
-      \end{multicols}
-    }{%
-      Dans le triangle $#2$, $[\NomA\NomC]$ est le plus grand côté.%
-      \ifboolKV[ClesPythagore]{ReciColonnes}{%
-        \[
-          \begin{array}{cccc|cccc}
-            \NomA\NomC^2&&&&&\NomA\NomB^2&+&\NomB\NomC^2\\
-            \opexport{A1}{\Aun}\num{\Aun}^2&&&&&\opexport{A2}{\Adeux}\num{\Adeux}^2&+&\opexport{A3}{\Atrois}\num{\Atrois}^2\\
-            \opmul*{A1}{A1}{a1}&&&&&\opmul*{A2}{A2}{a2}\opexport{a2}{\Adeux}\num{\Adeux}&+&\opmul*{A3}{A3}{a3}\opexport{a3}{\Atrois}\num{\Atrois}\\
-            \opexport{a1}{\Aun}\num{\Aun}&&&&&\multicolumn{3}{c}{\opadd*{a2}{a3}{a4}\opexport{a4}{\Aquatre}\num{\Aquatre}}\\
-          \end{array}
-        \]
-      }{%
-        \[\left.
-            \begin{array}{l}
-              \NomA\NomC^2=\opexport{A1}{\Aun}\num{\Aun}^2=\opmul*{A1}{A1}{a1}\opexport{a1}{\Aun}\num{\Aun}\\
-              \\
-              \NomA\NomB^2+\NomB\NomC^2=\opexport{A2}{\Adeux}\num{\Adeux}^2+\opexport{A3}{\Atrois}\num{\Atrois}^2=\opmul*{A2}{A2}{a2}\opexport{a2}{\Adeux}\num{\Adeux}+\opmul*{A3}{A3}{a3}\opexport{a3}{\Atrois}\num{\Atrois}=\opadd*{a2}{a3}{a4}\opexport{a4}{\Aquatre}\num{\Aquatre}\\
-            \end{array}
-          \right\}\opcmp{a1}{a4}\ifopeq\NomA\NomC^2=\NomA\NomB^2+\NomB\NomC^2\fi\opcmp{a1}{a4}\ifopneq\NomA\NomC^2\not=\NomA\NomB^2+\NomB\NomC^2\fi
-        \]
-      }
-      \ifboolKV[ClesPythagore]{Egalite}{%
-        \opcmp{a1}{a4}\ifopeq Comme $\NomA\NomC^2=\NomA\NomB^2+\NomB\NomC^2$, alors l'égalité de Pythagore est vérifiée. Donc le triangle $#2$ est rectangle en $\NomB$.\fi%
-        \opcmp{a1}{a4}\ifopneq Comme $\NomA\NomC^2\not=\NomA\NomB^2+\NomB\NomC^2$, alors l'égalité de Pythagore n'est pas vérifiée. Donc le triangle $#2$ n'est pas rectangle.\fi%
-      }{%
-        \opcmp{a1}{a4}\ifopeq Comme $\NomA\NomC^2=\NomA\NomB^2+\NomB\NomC^2$, alors le triangle $#2$ est rectangle
-        en $\NomB$ d'après la réciproque du théorème de Pythagore.\fi%
-        \opcmp{a1}{a4}\ifopneq Comme $\NomA\NomC^2\not=\NomA\NomB^2+\NomB\NomC^2$, alors le
-        triangle $#2$ n'est pas rectangle\ifboolKV[ClesPythagore]{Faible}{.}{ d'après la contraposée du théorème de Pythagore.}\fi%
-      }
-    }
+        }%
+      }%
+    }%
   }{%
     % [xlop] paramètres de calcul
     \opcopy{#3}{A1}%
@@ -2175,74 +2537,73 @@
     \StrMid{#2}{2}{2}[\NomB]%
     \StrMid{#2}{3}{3}[\NomC]%
     % On trace une figure ou pas ?
-    \ifboolKV[ClesPythagore]{Figure}{%Utilisation obligatoire de l'option --shell-escape de la compilation
-      \begin{multicols}{2}%
-        {\em La figure est donnée à titre indicatif.}%
-        \[\MPFigurePytha{\NomA}{\NomB}{\NomC}{#3}{#4}{\useKV[ClesPythagore]{Angle}}\]
-        \par\columnbreak\par%
+    \ifboolKV[ClesPythagore]{FigureSeule}{%
+      \MPFigurePytha{\NomA}{\NomB}{\NomC}{#3}{#4}{\useKV[ClesPythagore]{Angle}}
+    }{%
+      \ifboolKV[ClesPythagore]{Figure}{%Utilisation obligatoire de l'option --shell-escape de la compilation
+        \begin{multicols}{2}%
+          {\em La figure est donnée à titre indicatif.}%
+          \[\MPFigurePytha{\NomA}{\NomB}{\NomC}{#3}{#4}{\useKV[ClesPythagore]{Angle}}\]
+          \par\columnbreak\par%
+          % On démarre la résolution
+          \ifboolKV[ClesPythagore]{Egalite}{Comme le triangle $#2$ est rectangle en $\NomB$, alors l'égalité de Pythagore est vérifiée :}{Dans le triangle $#2$ rectangle en $\NomB$, le th\'eor\`eme de Pythagore permet d'\'ecrire :%
+          }%
+          \xintifboolexpr{#3<#4 || #3=#4}{%\ifnum#3<#4%
+            \xdef\ResultatPytha{\fpeval{round(sqrt(#3^2+#4^2),\useKV[ClesPythagore]{Precision})}}%
+            \xdef\ResultatPytha{\fpeval{round(sqrt(#3^2+#4^2),\useKV[ClesPythagore]{Precision})}}%
+            \begin{align*}
+              \NomA\NomC^2&=\NomA\NomB^2+\NomB\NomC^2\\
+              \NomA\NomC^2&=\ifboolKV[ClesPythagore]{EnchaineA}{\opcopy{\useKV[ClesPythagore]{ValeurA}}{a1}\opexport{a1}{\Aun}\num{\Aun}}{\opexport{A1}{\Aun}\num{\Aun}^2}+\ifboolKV[ClesPythagore]{EnchaineB}{\opcopy{\useKV[ClesPythagore]{ValeurB}}{a2}\opexport{a2}{\Adeux}\num{\Adeux}}{\opexport{A2}{\Adeux}\num{\Adeux}^2}\\
+              \NomA\NomC^2&=\ifboolKV[ClesPythagore]{EnchaineA}{\opexport{a1}{\Aun}\num{\Aun}}{\opmul*{A1}{A1}{a1}\opexport{a1}{\Aun}\num{\Aun}}+\ifboolKV[ClesPythagore]{EnchaineB}{\opexport{a2}{\Adeux}\num{\Adeux}}{\opmul*{A2}{A2}{a2}\opexport{a2}{\Adeux}\num{\Adeux}}\\
+              \NomA\NomC^2&=\opadd*{a1}{a2}{a3}\opexport{a3}{\Atrois}\num{\Atrois}%\\
+              \ifboolKV[ClesPythagore]{AvantRacine}{}{%
+              \ifboolKV[ClesPythagore]{Entier}{}{\\\NomA\NomC&=\sqrt{\opexport{a3}{\Atrois}\num{\Atrois}}}
+            \ifboolKV[ClesPythagore]{Racine}{}{\\\ifboolKV[ClesPythagore]{Exact}{\NomA\NomC&=\opsqrt[maxdivstep=3]{a3}{a4}\opunzero{a4}\opexport{a4}{\Aquatre}\num{\Aquatre}~\text{\useKV[ClesPythagore]{Unite}}}{\NomA\NomC&\approx\opsqrt[maxdivstep=5]{a3}{a4}\opround{a4}{pres}{a4}\opunzero{a4}\opexport{a4}{\Aquatre}\num{\Aquatre}~\text{\useKV[ClesPythagore]{Unite}}}}%\\
+              }%
+            \end{align*}
+          }{%\else%
+            \xdef\ResultatPytha{\fpeval{round(sqrt(#3^2-#4^2),\useKV[ClesPythagore]{Precision})}}%
+            \begin{align*}
+              \NomA\NomC^2&=\NomA\NomB^2+\NomB\NomC^2\\
+              \ifboolKV[ClesPythagore]{EnchaineC}{\opcopy{\useKV[ClesPythagore]{ValeurC}}{a1}\opexport{a1}{\Aun}\num{\Aun}}{\opexport{A1}{\Aun}\num{\Aun}^2}&=\NomA\NomB^2+\ifboolKV[ClesPythagore]{EnchaineB}{\opcopy{\useKV[ClesPythagore]{ValeurB}}{a2}\opexport{a2}{\Adeux}\num{\Adeux}}{\opexport{A2}{\Adeux}\num{\Adeux}^2}\\
+              \ifboolKV[ClesPythagore]{EnchaineC}{\opcopy{\useKV[ClesPythagore]{ValeurC}}{a1}\opexport{a1}{\Aun}\num{\Aun}}{\opmul*{A1}{A1}{a1}\opexport{a1}{\Aun}\num{\Aun}}&=\NomA\NomB^2+\ifboolKV[ClesPythagore]{EnchaineB}{\opexport{a2}{\Adeux}\num{\Adeux}}{\opmul*{A2}{A2}{a2}\opexport{a2}{\Adeux}\num{\Adeux}}\\
+              \NomA\NomB^2&=\ifboolKV[ClesPythagore]{EnchaineC}{\opcopy{\useKV[ClesPythagore]{ValeurC}}{a1}\opexport{a1}{\Aun}\num{\Aun}}{\opmul*{A1}{A1}{a1}\opexport{a1}{\Aun}\num{\Aun}}-\ifboolKV[ClesPythagore]{EnchaineB}{\opexport{a2}{\Adeux}\num{\Adeux}}{\opmul*{A2}{A2}{a2}\opexport{a2}{\Adeux}\num{\Adeux}}\\
+              \NomA\NomB^2&=\opsub*{a1}{a2}{a3}\opexport{a3}{\Atrois}\num{\Atrois}%\\
+              \ifboolKV[ClesPythagore]{AvantRacine}{}{%
+              \ifboolKV[ClesPythagore]{Entier}{}{\\\NomA\NomB&=\sqrt{\opexport{a3}{\Atrois}\num{\Atrois}}}
+            \ifboolKV[ClesPythagore]{Racine}{}{\\\ifboolKV[ClesPythagore]{Exact}{\NomA\NomB&=\opsqrt[maxdivstep=3]{a3}{a4}\opunzero{a4}\opexport{a4}{\Aquatre}\num{\Aquatre}~\text{\useKV[ClesPythagore]{Unite}}}{\NomA\NomB&\approx\opsqrt[maxdivstep=5]{a3}{a4}\opround{a4}{pres}{a4}\opunzero{a4}\opexport{a4}{\Aquatre}\num{\Aquatre}~\text{\useKV[ClesPythagore]{Unite}}}}%\\
+              }%
+            \end{align*}
+          }%\fi%
+        \end{multicols}
+      }{%
         % On démarre la résolution
         \ifboolKV[ClesPythagore]{Egalite}{Comme le triangle $#2$ est rectangle en $\NomB$, alors l'égalité de Pythagore est vérifiée :}{Dans le triangle $#2$ rectangle en $\NomB$, le th\'eor\`eme de Pythagore permet d'\'ecrire :%
         }%
         \xintifboolexpr{#3<#4 || #3=#4}{%\ifnum#3<#4%
           \xdef\ResultatPytha{\fpeval{round(sqrt(#3^2+#4^2),\useKV[ClesPythagore]{Precision})}}%
-          \xdef\ResultatPytha{\fpeval{round(sqrt(#3^2+#4^2),\useKV[ClesPythagore]{Precision})}}%
           \begin{align*}
             \NomA\NomC^2&=\NomA\NomB^2+\NomB\NomC^2\\
             \NomA\NomC^2&=\ifboolKV[ClesPythagore]{EnchaineA}{\opcopy{\useKV[ClesPythagore]{ValeurA}}{a1}\opexport{a1}{\Aun}\num{\Aun}}{\opexport{A1}{\Aun}\num{\Aun}^2}+\ifboolKV[ClesPythagore]{EnchaineB}{\opcopy{\useKV[ClesPythagore]{ValeurB}}{a2}\opexport{a2}{\Adeux}\num{\Adeux}}{\opexport{A2}{\Adeux}\num{\Adeux}^2}\\
             \NomA\NomC^2&=\ifboolKV[ClesPythagore]{EnchaineA}{\opexport{a1}{\Aun}\num{\Aun}}{\opmul*{A1}{A1}{a1}\opexport{a1}{\Aun}\num{\Aun}}+\ifboolKV[ClesPythagore]{EnchaineB}{\opexport{a2}{\Adeux}\num{\Adeux}}{\opmul*{A2}{A2}{a2}\opexport{a2}{\Adeux}\num{\Adeux}}\\
             \NomA\NomC^2&=\opadd*{a1}{a2}{a3}\opexport{a3}{\Atrois}\num{\Atrois}%\\
-            \ifboolKV[ClesPythagore]{AvantRacine}{}{%
-            \\
-            \ifboolKV[ClesPythagore]{Entier}{}{\NomA\NomC&=\sqrt{\opexport{a3}{\Atrois}\num{\Atrois}}\\}
-            \ifboolKV[ClesPythagore]{Racine}{}{\ifboolKV[ClesPythagore]{Exact}{\NomA\NomC&=\opsqrt[maxdivstep=3]{a3}{a4}\opunzero{a4}\opexport{a4}{\Aquatre}\num{\Aquatre}~\text{\useKV[ClesPythagore]{Unite}}}{\NomA\NomC&\approx\opsqrt[maxdivstep=5]{a3}{a4}\opround{a4}{pres}{a4}\opunzero{a4}\opexport{a4}{\Aquatre}\num{\Aquatre}~\text{\useKV[ClesPythagore]{Unite}}}}%\\
+          \ifboolKV[ClesPythagore]{AvantRacine}{}{%
+            \ifboolKV[ClesPythagore]{Entier}{}{\\\NomA\NomC&=\sqrt{\opexport{a3}{\Atrois}\num{\Atrois}}}
+          \ifboolKV[ClesPythagore]{Racine}{}{\\\ifboolKV[ClesPythagore]{Exact}{\NomA\NomC&=\opsqrt[maxdivstep=3]{a3}{a4}\opunzero{a4}\opexport{a4}{\Aquatre}\num{\Aquatre}~\text{\useKV[ClesPythagore]{Unite}}}{\NomA\NomC&\approx\opsqrt[maxdivstep=5]{a3}{a4}\opround{a4}{pres}{a4}\opunzero{a4}\opexport{a4}{\Aquatre}\num{\Aquatre}~\text{\useKV[ClesPythagore]{Unite}}}}%\\
             }
           \end{align*}
-        }{%\else%
+        }{%\else
           \xdef\ResultatPytha{\fpeval{round(sqrt(#3^2-#4^2),\useKV[ClesPythagore]{Precision})}}%
-          \begin{align*}
-            \NomA\NomC^2&=\NomA\NomB^2+\NomB\NomC^2\\
-            \ifboolKV[ClesPythagore]{EnchaineC}{\opcopy{\useKV[ClesPythagore]{ValeurC}}{a1}\opexport{a1}{\Aun}\num{\Aun}}{\opexport{A1}{\Aun}\num{\Aun}^2}&=\NomA\NomB^2+\ifboolKV[ClesPythagore]{EnchaineB}{\opcopy{\useKV[ClesPythagore]{ValeurB}}{a2}\opexport{a2}{\Adeux}\num{\Adeux}}{\opexport{A2}{\Adeux}\num{\Adeux}^2}\\
-            \ifboolKV[ClesPythagore]{EnchaineC}{\opcopy{\useKV[ClesPythagore]{ValeurC}}{a1}\opexport{a1}{\Aun}\num{\Aun}}{\opmul*{A1}{A1}{a1}\opexport{a1}{\Aun}\num{\Aun}}&=\NomA\NomB^2+\ifboolKV[ClesPythagore]{EnchaineB}{\opexport{a2}{\Adeux}\num{\Adeux}}{\opmul*{A2}{A2}{a2}\opexport{a2}{\Adeux}\num{\Adeux}}\\
-            \NomA\NomB^2&=\ifboolKV[ClesPythagore]{EnchaineC}{\opcopy{\useKV[ClesPythagore]{ValeurC}}{a1}\opexport{a1}{\Aun}\num{\Aun}}{\opmul*{A1}{A1}{a1}\opexport{a1}{\Aun}\num{\Aun}}-\ifboolKV[ClesPythagore]{EnchaineB}{\opexport{a2}{\Adeux}\num{\Adeux}}{\opmul*{A2}{A2}{a2}\opexport{a2}{\Adeux}\num{\Adeux}}\\
-            \NomA\NomB^2&=\opsub*{a1}{a2}{a3}\opexport{a3}{\Atrois}\num{\Atrois}%\\
-            \ifboolKV[ClesPythagore]{AvantRacine}{}{%
-            \\
-            \ifboolKV[ClesPythagore]{Entier}{}{\NomA\NomB&=\sqrt{\opexport{a3}{\Atrois}\num{\Atrois}}\\}
-            \ifboolKV[ClesPythagore]{Racine}{}{\ifboolKV[ClesPythagore]{Exact}{\NomA\NomB&=\opsqrt[maxdivstep=3]{a3}{a4}\opunzero{a4}\opexport{a4}{\Aquatre}\num{\Aquatre}~\text{\useKV[ClesPythagore]{Unite}}}{\NomA\NomB&\approx\opsqrt[maxdivstep=5]{a3}{a4}\opround{a4}{pres}{a4}\opunzero{a4}\opexport{a4}{\Aquatre}\num{\Aquatre}~\text{\useKV[ClesPythagore]{Unite}}}}%\\
-            }
-          \end{align*}
-        }%\fi%
-      \end{multicols}
-    }{%
-      % On démarre la résolution
-      \ifboolKV[ClesPythagore]{Egalite}{Comme le triangle $#2$ est rectangle en $\NomB$, alors l'égalité de Pythagore est vérifiée :}{Dans le triangle $#2$ rectangle en $\NomB$, le th\'eor\`eme de Pythagore permet d'\'ecrire :%
-      }%
-      \xintifboolexpr{#3<#4 || #3=#4}{%\ifnum#3<#4%
-        \xdef\ResultatPytha{\fpeval{round(sqrt(#3^2+#4^2),\useKV[ClesPythagore]{Precision})}}%
-        \begin{align*}
-          \NomA\NomC^2&=\NomA\NomB^2+\NomB\NomC^2\\
-          \NomA\NomC^2&=\ifboolKV[ClesPythagore]{EnchaineA}{\opcopy{\useKV[ClesPythagore]{ValeurA}}{a1}\opexport{a1}{\Aun}\num{\Aun}}{\opexport{A1}{\Aun}\num{\Aun}^2}+\ifboolKV[ClesPythagore]{EnchaineB}{\opcopy{\useKV[ClesPythagore]{ValeurB}}{a2}\opexport{a2}{\Adeux}\num{\Adeux}}{\opexport{A2}{\Adeux}\num{\Adeux}^2}\\
-          \NomA\NomC^2&=\ifboolKV[ClesPythagore]{EnchaineA}{\opexport{a1}{\Aun}\num{\Aun}}{\opmul*{A1}{A1}{a1}\opexport{a1}{\Aun}\num{\Aun}}+\ifboolKV[ClesPythagore]{EnchaineB}{\opexport{a2}{\Adeux}\num{\Adeux}}{\opmul*{A2}{A2}{a2}\opexport{a2}{\Adeux}\num{\Adeux}}\\
-          \NomA\NomC^2&=\opadd*{a1}{a2}{a3}\opexport{a3}{\Atrois}\num{\Atrois}%\\
-          \ifboolKV[ClesPythagore]{AvantRacine}{}{%
-          \\
-          \ifboolKV[ClesPythagore]{Entier}{}{\NomA\NomC&=\sqrt{\opexport{a3}{\Atrois}\num{\Atrois}}\\}
-          \ifboolKV[ClesPythagore]{Racine}{}{\ifboolKV[ClesPythagore]{Exact}{\NomA\NomC&=\opsqrt[maxdivstep=3]{a3}{a4}\opunzero{a4}\opexport{a4}{\Aquatre}\num{\Aquatre}~\text{\useKV[ClesPythagore]{Unite}}}{\NomA\NomC&\approx\opsqrt[maxdivstep=5]{a3}{a4}\opround{a4}{pres}{a4}\opunzero{a4}\opexport{a4}{\Aquatre}\num{\Aquatre}~\text{\useKV[ClesPythagore]{Unite}}}}%\\
-          }
-        \end{align*}
-      }{%\else
-        \xdef\ResultatPytha{\fpeval{round(sqrt(#3^2-#4^2),\useKV[ClesPythagore]{Precision})}}%
-        \ifboolKV[ClesPythagore]{Soustraction}{%
-          \begin{align*}
+          \ifboolKV[ClesPythagore]{Soustraction}{%
+            \begin{align*}
               \NomA\NomB^2&=\NomA\NomC^2-\NomB\NomC^2\\
               \NomA\NomB^2&=\ifboolKV[ClesPythagore]{EnchaineC}{\opcopy{\useKV[ClesPythagore]{ValeurC}}{a1}\opexport{a1}{\Aun}\num{\Aun}}{\opexport{A1}{\Aun}\num{\Aun}^2}-\ifboolKV[ClesPythagore]{EnchaineB}{\opcopy{\useKV[ClesPythagore]{ValeurB}}{a2}\opexport{a2}{\Adeux}\num{\Adeux}}{\opexport{A2}{\Adeux}\num{\Adeux}^2}\\
               \NomA\NomB^2&=\ifboolKV[ClesPythagore]{EnchaineC}{\opcopy{\useKV[ClesPythagore]{ValeurC}}{a1}\opexport{a1}{\Aun}\num{\Aun}}{\opmul*{A1}{A1}{a1}\opexport{a1}{\Aun}\num{\Aun}}-\ifboolKV[ClesPythagore]{EnchaineB}{\opexport{a2}{\Adeux}\num{\Adeux}}{\opmul*{A2}{A2}{a2}\opexport{a2}{\Adeux}\num{\Adeux}}\\
-            \NomA\NomB^2&=\opsub*{a1}{a2}{a3}\opexport{a3}{\Atrois}\num{\Atrois}%\\
-            \ifboolKV[ClesPythagore]{AvantRacine}{}{%
-            \\
-            \ifboolKV[ClesPythagore]{Entier}{}{\NomA\NomB&=\sqrt{\opexport{a3}{\Atrois}\num{\Atrois}}\\}
-            \ifboolKV[ClesPythagore]{Racine}{}{\ifboolKV[ClesPythagore]{Exact}{\NomA\NomB&=\opsqrt[maxdivstep=3]{a3}{a4}\opunzero{a4}\opexport{a4}{\Aquatre}\num{\Aquatre}~\text{\useKV[ClesPythagore]{Unite}}}{\NomA\NomB&\approx\opsqrt[maxdivstep=5]{a3}{a4}\opround{a4}{pres}{a4}\opunzero{a4}\opexport{a4}{\Aquatre}\num{\Aquatre}~\text{\useKV[ClesPythagore]{Unite}}}}%\\
-            }
+              \NomA\NomB^2&=\opsub*{a1}{a2}{a3}\opexport{a3}{\Atrois}\num{\Atrois}%\\
+              \ifboolKV[ClesPythagore]{AvantRacine}{}{%
+              \ifboolKV[ClesPythagore]{Entier}{}{\\\NomA\NomB&=\sqrt{\opexport{a3}{\Atrois}\num{\Atrois}}}
+                                                               \ifboolKV[ClesPythagore]{Racine}{}{\\\ifboolKV[ClesPythagore]{Exact}{\NomA\NomB&=\opsqrt[maxdivstep=3]{a3}{a4}\opunzero{a4}\opexport{a4}{\Aquatre}\num{\Aquatre}~\text{\useKV[ClesPythagore]{Unite}}}{\NomA\NomB&\approx\opsqrt[maxdivstep=5]{a3}{a4}\opround{a4}{pres}{a4}\opunzero{a4}\opexport{a4}{\Aquatre}\num{\Aquatre}~\text{\useKV[ClesPythagore]{Unite}}}}%\\
+              }
             \end{align*}
           }{%
             \begin{align*}
@@ -2252,20 +2613,20 @@
               \NomA\NomB^2&=\ifboolKV[ClesPythagore]{EnchaineC}{\opcopy{\useKV[ClesPythagore]{ValeurC}}{a1}\opexport{a1}{\Aun}\num{\Aun}}{\opmul*{A1}{A1}{a1}\opexport{a1}{\Aun}\num{\Aun}}-\ifboolKV[ClesPythagore]{EnchaineB}{\opexport{a2}{\Adeux}\num{\Adeux}}{\opmul*{A2}{A2}{a2}\opexport{a2}{\Adeux}\num{\Adeux}}\\
               \NomA\NomB^2&=\opsub*{a1}{a2}{a3}\opexport{a3}{\Atrois}\num{\Atrois}%\\
               \ifboolKV[ClesPythagore]{AvantRacine}{}{%
-              \\
-              \ifboolKV[ClesPythagore]{Entier}{}{\NomA\NomB&=\sqrt{\opexport{a3}{\Atrois}\num{\Atrois}}\\}
-              \ifboolKV[ClesPythagore]{Racine}{}{\ifboolKV[ClesPythagore]{Exact}{\NomA\NomB&=\opsqrt[maxdivstep=3]{a3}{a4}\opunzero{a4}\opexport{a4}{\Aquatre}\num{\Aquatre}~\text{\useKV[ClesPythagore]{Unite}}}{\NomA\NomB&\approx\opsqrt[maxdivstep=5]{a3}{a4}\opround{a4}{pres}{a4}\opunzero{a4}\opexport{a4}{\Aquatre}\num{\Aquatre}~\text{\useKV[ClesPythagore]{Unite}}}}%\\
+              \ifboolKV[ClesPythagore]{Entier}{}{\\\NomA\NomB&=\sqrt{\opexport{a3}{\Atrois}\num{\Atrois}}}%
+                                                               \ifboolKV[ClesPythagore]{Racine}{}{\\\ifboolKV[ClesPythagore]{Exact}{\NomA\NomB&=\opsqrt[maxdivstep=3]{a3}{a4}\opunzero{a4}\opexport{a4}{\Aquatre}\num{\Aquatre}~\text{\useKV[ClesPythagore]{Unite}}}{\NomA\NomB&\approx\opsqrt[maxdivstep=5]{a3}{a4}\opround{a4}{pres}{a4}\opunzero{a4}\opexport{a4}{\Aquatre}\num{\Aquatre}~\text{\useKV[ClesPythagore]{Unite}}}}%\\
               }
             \end{align*}
           }%
-      }%\fi%
+        }%\fi%
+      }%
     }%
   }%
 }%
 
-%%%%%%%%%%%%%%%%%
-%% Distributivité
-%%%%%%%%%%%%%%%%%
+%%%
+% Distributivité
+%%%
 % https://tex.stackexchange.com/questions/168972/draw-arrows-to-show-multiplication-pattern-distributive-property/169278?noredirect=1 
 \newcommand{\Tikzmark}[1]{%
   \tikz[remember picture,baseline,inner sep=0pt]{%
@@ -2303,8 +2664,7 @@
 % y a dans un "seul calcul".
 \setcounter{NbCalculDistri}{0}
 
-\setKVdefault[ClesDistributivite]{Etape=1,Lettre=x,Fleches=false,AideMul=false,Reduction=false,AideAdda=false,AideAddb=false,CouleurAide=red,CouleurReduction=black,CouleurFH=blue,CouleurFB=red,Somme=false,Difference=false,RAZ=false,Oppose=false,All=false,NomExpression=A,Fin=4,Numerique=false,Remarquable=false,Echange=0}%,AideAdd=false
-                                %inutile ?
+\setKVdefault[ClesDistributivite]{Etape=1,Lettre=x,Fleches=false,AideMul=false,Reduction=false,AideAdda=false,AideAddb=false,CouleurAide=red,CouleurReduction=black,CouleurFH=blue,CouleurFB=red,Somme=false,Difference=false,RAZ=false,Oppose=false,All=false,NomExpression=A,Fin=4,Numerique=false,Remarquable=false,Echange=0}%,AideAdd=false:inutile ?
 
 \newcommand\Affichage[4][]{%
   \setKV[ClesDistributivite]{#1}%On lit les arguments optionnels
@@ -2332,9 +2692,7 @@
     \useKVdefault[ClesDistributivite]%obligatoire car la macro n'est pas dans un groupe.
     \setKV[ClesDistributivite]{#1}%On lit les arguments optionnels
     \ifboolKV[ClesDistributivite]{RAZ}{\xdef\SommeA{0}\xdef\SommeB{0}\xdef\SommeC{0}%
-      % 80
       \setcounter{NbCalculDistri}{0}%
-      % fin 80
     }{}%
     \colorlet{DCAide}{\useKV[ClesDistributivite]{CouleurAide}}%
     \colorlet{DCReduction}{\useKV[ClesDistributivite]{CouleurReduction}}%
@@ -2343,193 +2701,183 @@
     \xintifboolexpr{\useKV[ClesDistributivite]{Echange}>0}{%
       \DistriEchange[#1]{#2}{#3}{#4}{#5}%
     }{%
-    \ifboolKV[ClesDistributivite]{Remarquable}{%
-      \xintifboolexpr{\useKV[ClesDistributivite]{Etape}=1}{%
-        \ifx\bla#4\bla(\Affichage{0}{#2}{#3})^2\else(\Affichage{0}{#2}{#3})(\Affichage{0}{#4}{#5})\fi%
-      }{}
-      \xintifboolexpr{\useKV[ClesDistributivite]{Etape}=2}{\ifx\bla#4\bla\xintifboolexpr{#3>0}{\xintifboolexpr{#2=1}{}{(\num{#2}}\useKV[ClesDistributivite]{Lettre}\xintifboolexpr{#2=1}{}{)}^2+2\times\xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesDistributivite]{Lettre}\times\num{#3}+\num{#3}^2}{\xintifboolexpr{#2=1}{}{(\num{#2}}\useKV[ClesDistributivite]{Lettre}\xintifboolexpr{#2=1}{}{)}^2-2\times\xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesDistributivite]{Lettre}\times\num{\fpeval{0-#3}}+\num{\fpeval{0-#3}}^2}\else\xintifboolexpr{#2=1}{}{(\num{#2}}\useKV[ClesDistributivite]{Lettre}\xintifboolexpr{#2=1}{}{)}^2-\num{#3}^2\fi}{}
-      \xintifboolexpr{\useKV[ClesDistributivite]{Etape}=3}{%
-        %80
-        \xintifboolexpr{\theNbCalculDistri>1}{\setcounter{NbCalculDistri}{0}}{}%
-        \stepcounter{NbCalculDistri}%
-        % fin 80
-        \ifx\bla#4\bla%
-        \xdef\Multi{\fpeval{#2*#2}}%
-        \xdef\Multij{\fpeval{#2*#3}}%
-        \xdef\Multik{\fpeval{#3*#2}}%
-        \xdef\Multil{\fpeval{#3*#3}}%
-        %% ils sont redéfinis pour pouvoir envisager la somme de deux
-        %% expressions à développer
-        \xdef\Multim{\fpeval{#2*#3+#3*#2}}%
-        \ifboolKV[ClesDistributivite]{Oppose}{%
-          \xdef\Multi{\fpeval{-\Multi}}%
-          \xdef\Multim{\fpeval{-\Multim}}%
-          \xdef\Multil{\fpeval{-\Multil}}%
-          \xintifboolexpr{\Multi=0}{}{\xintifboolexpr{\Multi<0}{(}{}\Affichage{\Multi}{0}{0}\xintifboolexpr{\Multi<0}{)}{}}%
-          \xintifboolexpr{\Multim=0}{}{\xintifboolexpr{\Multim>0}{+}{+(}\Affichage{0}{\Multim}{0}\xintifboolexpr{\Multim<0}{)}{}}%
-          \xintifboolexpr{\Multil=0}{}{\xintifboolexpr{\Multil>0}{+}{+(}\Affichage{0}{0}{\Multil}\xintifboolexpr{\Multil<0}{)}{}}%
-        }{%
-          \Affichage{\Multi}{\Multim}{\Multil}%
-        }
-        \ifboolKV[ClesDistributivite]{Somme}{\xdef\SommeA{\fpeval{\SommeA+#2*#2}}\xdef\SommeB{\fpeval{\SommeB+#2*#3+#3*#2}}\xdef\SommeC{\fpeval{\SommeC+#3*#3}}}{}%
-        \ifboolKV[ClesDistributivite]{Difference}{\xdef\SommeA{\fpeval{\SommeA-#2*#2}}\xdef\SommeB{\fpeval{\SommeB-#2*#3-#3*#2}}\xdef\SommeC{\fpeval{\SommeC-#3*#3}}}{}%
-        \else%
-        \xdef\Multi{\fpeval{#2*#4}}%
-        \xdef\Multij{\fpeval{#2*#5}}%
-        \xdef\Multik{\fpeval{#3*#4}}%
-        \xdef\Multil{\fpeval{#3*#5}}%
-        %% ils sont redéfinis pour pouvoir envisager la somme de deux
-        %% expressions à développer
-        \xdef\Multim{\fpeval{#2*#5+#3*#4}}%
-        \ifboolKV[ClesDistributivite]{Oppose}{%
-          \xdef\Multi{\fpeval{-\Multi}}%
-          \xdef\Multim{\fpeval{-\Multim}}%
-          \xdef\Multil{\fpeval{-\Multil}}%
-          \xintifboolexpr{\Multi=0}{}{\xintifboolexpr{\Multi<0}{(}{}\Affichage{\Multi}{0}{0}\xintifboolexpr{\Multi<0}{)}{}}%
-          \xintifboolexpr{\Multim=0}{}{\xintifboolexpr{\Multim>0}{+}{+(}\Affichage{0}{\Multim}{0}\xintifboolexpr{\Multim<0}{)}{}}%
-          \xintifboolexpr{\Multil=0}{}{\xintifboolexpr{\Multil>0}{+}{+(}\Affichage{0}{0}{\Multil}\xintifboolexpr{\Multil<0}{)}{}}%
-        }{%
-          \Affichage{\Multi}{\Multim}{\Multil}%
-        }
-        \ifboolKV[ClesDistributivite]{Somme}{\xdef\SommeA{\fpeval{\SommeA+#2*#4}}\xdef\SommeB{\fpeval{\SommeB+#2*#5+#3*#4}}\xdef\SommeC{\fpeval{\SommeC+#3*#5}}}{}%
-        \ifboolKV[ClesDistributivite]{Difference}{\xdef\SommeA{\fpeval{\SommeA-#2*#4}}\xdef\SommeB{\fpeval{\SommeB-#2*#5-#3*#4}}\xdef\SommeC{\fpeval{\SommeC-#3*#5}}}{}%
-        \fi%
-      }{}%
-    }{%
-      \ifboolKV[ClesDistributivite]{Numerique}{%
-        \xintifboolexpr{\useKV[ClesDistributivite]{Etape}=0}{%
-          \num{\fpeval{#2+#3}}\times\num{\fpeval{#4+#5}}\multido{\i=2+1}{4}{=\Distri[Numerique,Etape=\i]{#2}{#3}{#4}{#5}}%
-        }{%
-          \xintifboolexpr{\useKV[ClesDistributivite]{Etape}=-1}{%
-            \Distri[Numerique,Etape=3]{#2}{#3}{#4}{#5}\multido{\i=2+-1}{2}{=\Distri[Numerique,Etape=\i]{#2}{#3}{#4}{#5}}=\num{\fpeval{(#2+#3)*(#4+#5)}}%
+      \ifboolKV[ClesDistributivite]{Remarquable}{%
+        \xintifboolexpr{\useKV[ClesDistributivite]{Etape}=1}{%
+          \ifx\bla#4\bla(\Affichage{0}{#2}{#3})^2\else(\Affichage{0}{#2}{#3})(\Affichage{0}{#4}{#5})\fi%
+        }{}
+        \xintifboolexpr{\useKV[ClesDistributivite]{Etape}=2}{\ifx\bla#4\bla\xintifboolexpr{#3>0}{\xintifboolexpr{#2=1}{}{(\num{#2}}\useKV[ClesDistributivite]{Lettre}\xintifboolexpr{#2=1}{}{)}^2+2\times\xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesDistributivite]{Lettre}\times\num{#3}+\num{#3}^2}{\xintifboolexpr{#2=1}{}{(\num{#2}}\useKV[ClesDistributivite]{Lettre}\xintifboolexpr{#2=1}{}{)}^2-2\times\xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesDistributivite]{Lettre}\times\num{\fpeval{0-#3}}+\num{\fpeval{0-#3}}^2}\else\xintifboolexpr{#2=1}{}{(\num{#2}}\useKV[ClesDistributivite]{Lettre}\xintifboolexpr{#2=1}{}{)}^2-\num{#3}^2\fi}{}
+        \xintifboolexpr{\useKV[ClesDistributivite]{Etape}=3}{%
+          \xintifboolexpr{\theNbCalculDistri>1}{\setcounter{NbCalculDistri}{0}}{}%
+          \stepcounter{NbCalculDistri}%
+          \ifx\bla#4\bla%
+          \xdef\Multi{\fpeval{#2*#2}}%
+          \xdef\Multij{\fpeval{#2*#3}}%
+          \xdef\Multik{\fpeval{#3*#2}}%
+          \xdef\Multil{\fpeval{#3*#3}}%
+          %% ils sont redéfinis pour pouvoir envisager la somme de deux
+          %% expressions à développer
+          \xdef\Multim{\fpeval{#2*#3+#3*#2}}%
+          \ifboolKV[ClesDistributivite]{Oppose}{%
+            \xdef\Multi{\fpeval{-\Multi}}%
+            \xdef\Multim{\fpeval{-\Multim}}%
+            \xdef\Multil{\fpeval{-\Multil}}%
+            \xintifboolexpr{\Multi=0}{}{\xintifboolexpr{\Multi<0}{(}{}\Affichage{\Multi}{0}{0}\xintifboolexpr{\Multi<0}{)}{}}%
+            \xintifboolexpr{\Multim=0}{}{\xintifboolexpr{\Multim>0}{+}{+(}\Affichage{0}{\Multim}{0}\xintifboolexpr{\Multim<0}{)}{}}%
+            \xintifboolexpr{\Multil=0}{}{\xintifboolexpr{\Multil>0}{+}{+(}\Affichage{0}{0}{\Multil}\xintifboolexpr{\Multil<0}{)}{}}%
           }{%
-            \xintifboolexpr{\useKV[ClesDistributivite]{Etape}=1}{\num{\fpeval{#2+#3}}\times\num{\fpeval{#4+#5}}}{}%
-            \xintifboolexpr{\useKV[ClesDistributivite]{Etape}=2}{\num{\fpeval{#2+#3}}\times(\num{#4}\xintifboolexpr{#5>0}{+}{-}\num{\fpeval{abs(#5)}})}{}%
-            \xintifboolexpr{\useKV[ClesDistributivite]{Etape}=3}{\num{#3}\times\num{#4}\xintifboolexpr{#5>0}{+}{-}\num{#3}\times\num{\fpeval{abs(#5)}}}{}%
-            \xintifboolexpr{\useKV[ClesDistributivite]{Etape}=4}{\num{\fpeval{#3*#4}}\xintifboolexpr{#5>0}{+}{-}\num{\fpeval{abs(#3*#5)}}}{}%
-            \xintifboolexpr{\useKV[ClesDistributivite]{Etape}=5}{\num{\fpeval{#3*#4+#3*#5}}}{}%
+            \Affichage{\Multi}{\Multim}{\Multil}%
+          }
+          \ifboolKV[ClesDistributivite]{Somme}{\xdef\SommeA{\fpeval{\SommeA+#2*#2}}\xdef\SommeB{\fpeval{\SommeB+#2*#3+#3*#2}}\xdef\SommeC{\fpeval{\SommeC+#3*#3}}}{}%
+          \ifboolKV[ClesDistributivite]{Difference}{\xdef\SommeA{\fpeval{\SommeA-#2*#2}}\xdef\SommeB{\fpeval{\SommeB-#2*#3-#3*#2}}\xdef\SommeC{\fpeval{\SommeC-#3*#3}}}{}%
+          \else%
+          \xdef\Multi{\fpeval{#2*#4}}%
+          \xdef\Multij{\fpeval{#2*#5}}%
+          \xdef\Multik{\fpeval{#3*#4}}%
+          \xdef\Multil{\fpeval{#3*#5}}%
+          %% ils sont redéfinis pour pouvoir envisager la somme de deux
+          %% expressions à développer
+          \xdef\Multim{\fpeval{#2*#5+#3*#4}}%
+          \ifboolKV[ClesDistributivite]{Oppose}{%
+            \xdef\Multi{\fpeval{-\Multi}}%
+            \xdef\Multim{\fpeval{-\Multim}}%
+            \xdef\Multil{\fpeval{-\Multil}}%
+            \xintifboolexpr{\Multi=0}{}{\xintifboolexpr{\Multi<0}{(}{}\Affichage{\Multi}{0}{0}\xintifboolexpr{\Multi<0}{)}{}}%
+            \xintifboolexpr{\Multim=0}{}{\xintifboolexpr{\Multim>0}{+}{+(}\Affichage{0}{\Multim}{0}\xintifboolexpr{\Multim<0}{)}{}}%
+            \xintifboolexpr{\Multil=0}{}{\xintifboolexpr{\Multil>0}{+}{+(}\Affichage{0}{0}{\Multil}\xintifboolexpr{\Multil<0}{)}{}}%
+          }{%
+            \Affichage{\Multi}{\Multim}{\Multil}%
+          }
+          \ifboolKV[ClesDistributivite]{Somme}{\xdef\SommeA{\fpeval{\SommeA+#2*#4}}\xdef\SommeB{\fpeval{\SommeB+#2*#5+#3*#4}}\xdef\SommeC{\fpeval{\SommeC+#3*#5}}}{}%
+          \ifboolKV[ClesDistributivite]{Difference}{\xdef\SommeA{\fpeval{\SommeA-#2*#4}}\xdef\SommeB{\fpeval{\SommeB-#2*#5-#3*#4}}\xdef\SommeC{\fpeval{\SommeC-#3*#5}}}{}%
+          \fi%
+        }{}%
+      }{%
+        \ifboolKV[ClesDistributivite]{Numerique}{%
+          \xintifboolexpr{\useKV[ClesDistributivite]{Etape}=0}{%
+            \num{\fpeval{#2+#3}}\times\num{\fpeval{#4+#5}}\multido{\i=2+1}{4}{=\Distri[Numerique,Etape=\i]{#2}{#3}{#4}{#5}}%
+          }{%
+            \xintifboolexpr{\useKV[ClesDistributivite]{Etape}=-1}{%
+              \Distri[Numerique,Etape=3]{#2}{#3}{#4}{#5}\multido{\i=2+-1}{2}{=\Distri[Numerique,Etape=\i]{#2}{#3}{#4}{#5}}=\num{\fpeval{(#2+#3)*(#4+#5)}}%
+            }{%
+              \xintifboolexpr{\useKV[ClesDistributivite]{Etape}=1}{\num{\fpeval{#2+#3}}\times\num{\fpeval{#4+#5}}}{}%
+              \xintifboolexpr{\useKV[ClesDistributivite]{Etape}=2}{\num{\fpeval{#2+#3}}\times(\num{#4}\xintifboolexpr{#5>0}{+}{-}\num{\fpeval{abs(#5)}})}{}%
+              \xintifboolexpr{\useKV[ClesDistributivite]{Etape}=3}{\num{#3}\times\num{#4}\xintifboolexpr{#5>0}{+}{-}\num{#3}\times\num{\fpeval{abs(#5)}}}{}%
+              \xintifboolexpr{\useKV[ClesDistributivite]{Etape}=4}{\num{\fpeval{#3*#4}}\xintifboolexpr{#5>0}{+}{-}\num{\fpeval{abs(#3*#5)}}}{}%
+              \xintifboolexpr{\useKV[ClesDistributivite]{Etape}=5}{\num{\fpeval{#3*#4+#3*#5}}}{}%
+            }%
           }%
-        }%
-      }{%
-        \ifboolKV[ClesDistributivite]{All}{%
-          \xdef\NomLettre{\useKV[ClesDistributivite]{NomExpression}}%
-          \xdef\NomFin{\useKV[ClesDistributivite]{Fin}}%
-          \xintFor* ##1 in {\xintSeq {1}{\useKV[ClesDistributivite]{Fin}-1}}\do
-          {\NomLettre&=\Distri[Etape=##1]{#2}{#3}{#4}{#5}\\}%
-          \NomLettre&=\Distri[Etape=\NomFin]{#2}{#3}{#4}{#5}%
         }{%
-          % Etape 1
-          \xintifboolexpr{\useKV[ClesDistributivite]{Etape}=1}{%
-            \xintifboolexpr{#2=0}{%
-            }{\xintifboolexpr{#3=0}{}{(}}\Tikzmark{\Affichage[#1]{0}{#2}{0}}%
-            \ifboolKV[ClesDistributivite]{AideAdda}{\mathcolor{DCAide}{+(}}{}%
-            \xintifboolexpr{#3>0}{\xintifboolexpr{#2=0}{}{+}}{\xintifboolexpr{#3<0}{-}{}}\Tikzmark{\Affichage[#1]{0}{0}{\fpeval{abs(#3)}}}%
-            \ifboolKV[ClesDistributivite]{AideAdda}{\mathcolor{DCAide}{)}}{}%
-            \xintifboolexpr{#2=0}{}{\xintifboolexpr{#3=0}{}{)}}%
-            % 
-            \ifboolKV[ClesDistributivite]{AideMul}{\times}{}%on aide dans le cas double
-            \xdef\Multi{\fpeval{#4*#5}}%affichage auto si (a+b)xk
-            % 
-            \xintifboolexpr{\Multi=0}{\times%
-              \xintifboolexpr{#4<0}{(}{\xintifboolexpr{#5<0}{(}{}}}{(}%
-            \Tikzmark{\Affichage[#1]{0}{#4}{0}}%
-            \ifboolKV[ClesDistributivite]{AideAddb}{\mathcolor{DCAide}{+(}}{}%
-            \xintifboolexpr{#5>0}{\xintifboolexpr{#4=0}{}{+}}{\xintifboolexpr{#5<0}{\xintifboolexpr{#4=0}{{-}}{-}}{}}\Tikzmark{\Affichage[#1]{0}{0}{\fpeval{abs(#5)}}}%
-            \ifboolKV[ClesDistributivite]{AideAddb}{\mathcolor{DCAide}{)}}{}%
-            \xintifboolexpr{\Multi=0}{%
-              \xintifboolexpr{#4<0}{)}{\xintifboolexpr{#5<0}{)}{}}}{)}%
-            \ifboolKV[ClesDistributivite]{Fleches}{%
-              \xdef\Multi{\fpeval{#2*#3*#4*#5}}%
+          \ifboolKV[ClesDistributivite]{All}{%
+            \xdef\NomLettre{\useKV[ClesDistributivite]{NomExpression}}%
+            \xdef\NomFin{\useKV[ClesDistributivite]{Fin}}%
+            \xintFor* ##1 in {\xintSeq {1}{\useKV[ClesDistributivite]{Fin}-1}}\do
+            {\NomLettre&=\Distri[Etape=##1]{#2}{#3}{#4}{#5}\\}%
+            \NomLettre&=\Distri[Etape=\NomFin]{#2}{#3}{#4}{#5}%
+          }{%
+            % Etape 1
+            \xintifboolexpr{\useKV[ClesDistributivite]{Etape}=1}{%
+              \xintifboolexpr{#2=0}{%
+              }{\xintifboolexpr{#3=0}{}{(}}\Tikzmark{\Affichage[#1]{0}{#2}{0}}%
+              \ifboolKV[ClesDistributivite]{AideAdda}{\mathcolor{DCAide}{+(}}{}%
+              \xintifboolexpr{#3>0}{\xintifboolexpr{#2=0}{}{+}}{\xintifboolexpr{#3<0}{-}{}}\Tikzmark{\Affichage[#1]{0}{0}{\fpeval{abs(#3)}}}%
+              \ifboolKV[ClesDistributivite]{AideAdda}{\mathcolor{DCAide}{)}}{}%
+              \xintifboolexpr{#2=0}{}{\xintifboolexpr{#3=0}{}{)}}%
+              % 
+              \ifboolKV[ClesDistributivite]{AideMul}{\times}{}%on aide dans le cas double
+              \xdef\Multi{\fpeval{#4*#5}}%affichage auto si (a+b)xk
+              % 
+              \xintifboolexpr{\Multi=0}{\times%
+                \xintifboolexpr{#4<0}{(}{\xintifboolexpr{#5<0}{(}{}}}{(}%
+              \Tikzmark{\Affichage[#1]{0}{#4}{0}}%
+              \ifboolKV[ClesDistributivite]{AideAddb}{\mathcolor{DCAide}{+(}}{}%
+              \xintifboolexpr{#5>0}{\xintifboolexpr{#4=0}{}{+}}{\xintifboolexpr{#5<0}{\xintifboolexpr{#4=0}{{-}}{-}}{}}\Tikzmark{\Affichage[#1]{0}{0}{\fpeval{abs(#5)}}}%
+              \ifboolKV[ClesDistributivite]{AideAddb}{\mathcolor{DCAide}{)}}{}%
               \xintifboolexpr{\Multi=0}{%
-                \xdef\Multij{\fpeval{#2*#3}}%\relax
-                \xintifboolexpr{\Multij=0}{\xintifboolexpr{#2=0}{\DrawArrowSimple{1}}{\DrawArrowSimple{0}}}{\xintifboolexpr{#4=0}{\DrawArrowSimpleRenverse{3}}{\DrawArrowSimpleRenverse{2}}}%
-              }{%
-                \DrawArrow%
+                \xintifboolexpr{#4<0}{)}{\xintifboolexpr{#5<0}{)}{}}}{)}%
+              \ifboolKV[ClesDistributivite]{Fleches}{%
+                \xdef\Multi{\fpeval{#2*#3*#4*#5}}%
+                \xintifboolexpr{\Multi=0}{%
+                  \xdef\Multij{\fpeval{#2*#3}}%\relax
+                  \xintifboolexpr{\Multij=0}{\xintifboolexpr{#2=0}{\DrawArrowSimple{1}}{\DrawArrowSimple{0}}}{\xintifboolexpr{#4=0}{\DrawArrowSimpleRenverse{3}}{\DrawArrowSimpleRenverse{2}}}%
+                }{%
+                  \DrawArrow%
+                }%
+              }{}\setcounter{NbDistri}{0}%
+            }{}
+            % Etape 2
+            \xintifboolexpr{\useKV[ClesDistributivite]{Etape}=2}{%
+              \xdef\Multi{\fpeval{#2*#4}}%
+              \xintifboolexpr{\Multi=0}{}{%
+                \xintifboolexpr{#2<0}{(}{}\Affichage[#1]{0}{#2}{0}\xintifboolexpr{#2<0}{)}{}\times\xintifboolexpr{#4<0}{(}{}\Affichage[#1]{0}{#4}{0}\xintifboolexpr{#4<0}{)}{}%
+              }
+              \xdef\Multij{\fpeval{#2*#5}}%
+              \xintifboolexpr{\Multij=0}{}{%
+                \xintifboolexpr{\Multi=0}{}{+}%
+                \xintifboolexpr{#2<0}{(}{}\Affichage[#1]{0}{#2}{0}\xintifboolexpr{#2<0}{)}{}\times\xintifboolexpr{#5<0}{(}{}\Affichage[#1]{0}{0}{#5}\xintifboolexpr{#5<0}{)}{}%
               }%
-            }{}\setcounter{NbDistri}{0}%
-          }{}
-          % Etape 2
-          \xintifboolexpr{\useKV[ClesDistributivite]{Etape}=2}{%
-            \xdef\Multi{\fpeval{#2*#4}}%
-            \xintifboolexpr{\Multi=0}{}{%
-              \xintifboolexpr{#2<0}{(}{}\Affichage[#1]{0}{#2}{0}\xintifboolexpr{#2<0}{)}{}\times\xintifboolexpr{#4<0}{(}{}\Affichage[#1]{0}{#4}{0}\xintifboolexpr{#4<0}{)}{}%
-            }
-            \xdef\Multij{\fpeval{#2*#5}}%
-            \xintifboolexpr{\Multij=0}{}{%
-              \xintifboolexpr{\Multi=0}{}{+}%
-              \xintifboolexpr{#2<0}{(}{}\Affichage[#1]{0}{#2}{0}\xintifboolexpr{#2<0}{)}{}\times\xintifboolexpr{#5<0}{(}{}\Affichage[#1]{0}{0}{#5}\xintifboolexpr{#5<0}{)}{}%
-            }%
-            \xdef\Multik{\fpeval{#3*#4}}%
-            \xintifboolexpr{\Multik=0}{}{%
-              \xintifboolexpr{\Multi=0}{}{+}%
-              \xintifboolexpr{#3<0}{(}{}\Affichage[#1]{0}{0}{#3}\xintifboolexpr{#3<0}{)}{}\times\xintifboolexpr{#4<0}{(}{}\Affichage[#1]{0}{#4}{0}\xintifboolexpr{#4<0}{)}{}%
-            }%
-            \xdef\Multil{\fpeval{#3*#5}}%
-            \xintifboolexpr{\Multil=0}{}{+%
-              \xintifboolexpr{#3<0}{(}{}\Affichage[#1]{0}{0}{#3}\xintifboolexpr{#3<0}{)}{}\times\xintifboolexpr{#5<0}{(}{}\Affichage[#1]{0}{0}{#5}\xintifboolexpr{#5<0}{)}{}%
-            }%
-          }{}%
-          % Etape 3
-          \xintifboolexpr{\useKV[ClesDistributivite]{Etape}=3}{%
-            %80
-            \stepcounter{NbCalculDistri}%
-            % fin 80
-            \xdef\Multi{\fpeval{#2*#4}}%
-            \xdef\Multij{\fpeval{#2*#5}}%
-            \xdef\Multik{\fpeval{#3*#4}}%
-            \xdef\Multil{\fpeval{#3*#5}}%
-            %% ils sont redéfinis pour pouvoir envisager la somme de deux
-            %% expressions à développer
-            %80
-            \xintifboolexpr{\theNbCalculDistri>1}{\xintifboolexpr{\Multi<0}{(\Affichage{\Multi}{0}{0})}{\Affichage{\Multi}{0}{0}}}{\Affichage{\Multi}{0}{0}}%
-            %fin 80
-            \ifboolKV[ClesDistributivite]{Reduction}{\mathunderline{DCReduction}{%
-                \xintifboolexpr{\Multij=0}{}{\xintifboolexpr{\Multi=0}{}{{}+}\xintifboolexpr{\Multij<0}{(}{}\Affichage{0}{\Multij}{0}\xintifboolexpr{\Multij<0}{)}{}}%
-                \xintifboolexpr{\Multik=0}{}{\xintifboolexpr{\Multil=0}{\xintifboolexpr{#2=0}{}{+}}{+}\xintifboolexpr{\Multik<0}{(}{}\Affichage{0}{\Multik}{0}\xintifboolexpr{\Multik<0}{)}{}}%
+              \xdef\Multik{\fpeval{#3*#4}}%
+              \xintifboolexpr{\Multik=0}{}{%
+                \xintifboolexpr{\Multi=0}{}{+}%
+                \xintifboolexpr{#3<0}{(}{}\Affichage[#1]{0}{0}{#3}\xintifboolexpr{#3<0}{)}{}\times\xintifboolexpr{#4<0}{(}{}\Affichage[#1]{0}{#4}{0}\xintifboolexpr{#4<0}{)}{}%
               }%
-            }{%
-              \xintifboolexpr{\Multij=0}{}{\xintifboolexpr{\Multi=0}{}{+}\xintifboolexpr{\Multij<0}{(}{}\Affichage{0}{\Multij}{0}\xintifboolexpr{\Multij<0}{)}{}}%
-              \xintifboolexpr{\Multik=0}{}{\xintifboolexpr{\Multil=0}{\xintifboolexpr{#2=0}{}{+}}{+}\xintifboolexpr{\Multik<0}{(}{}\Affichage{0}{\Multik}{0}\xintifboolexpr{\Multik<0}{)}{}}%
-            }%
-            \xintifboolexpr{\Multil=0}{}{+}\xintifboolexpr{\Multil<0}{(}{}\Affichage{0}{0}{\Multil}\xintifboolexpr{\Multil<0}{)}{}%
-          }{}%
-          % Etape 4
-          \xintifboolexpr{\useKV[ClesDistributivite]{Etape}=4}{%
-            \xdef\Multi{\fpeval{#2*#4}}%
-            \xdef\Multij{\fpeval{#2*#5}}%
-            \xdef\Multik{\fpeval{#3*#4}}%
-            \xdef\Multil{\fpeval{#3*#5}}%
-            %% ils sont redéfinis pour pouvoir envisager la somme de deux
-            %% expressions à développer
-            \xdef\Multim{\fpeval{#2*#5+#3*#4}}%
-            %80
-            \xintifboolexpr{\theNbCalculDistri>1}{\setcounter{NbCalculDistri}{0}}{}%
-            \stepcounter{NbCalculDistri}%
-            %fin 80
-            \ifboolKV[ClesDistributivite]{Oppose}{%
-              \xdef\Multi{\fpeval{-\Multi}}%
-              \xdef\Multim{\fpeval{-\Multim}}%
-              \xdef\Multil{\fpeval{-\Multil}}%
-              \xintifboolexpr{\Multi=0}{}{\xintifboolexpr{\Multi<0}{(}{}\Affichage{\Multi}{0}{0}\xintifboolexpr{\Multi<0}{)}{}}%
-              \xintifboolexpr{\Multim=0}{}{\xintifboolexpr{\Multim>0}{+}{+(}\Affichage{0}{\Multim}{0}\xintifboolexpr{\Multim<0}{)}{}}%
-              \xintifboolexpr{\Multil=0}{}{\xintifboolexpr{\Multil>0}{+}{+(}\Affichage{0}{0}{\Multil}\xintifboolexpr{\Multil<0}{)}{}}%
-            }{%
-              %80
+              \xdef\Multil{\fpeval{#3*#5}}%
+              \xintifboolexpr{\Multil=0}{}{+%
+                \xintifboolexpr{#3<0}{(}{}\Affichage[#1]{0}{0}{#3}\xintifboolexpr{#3<0}{)}{}\times\xintifboolexpr{#5<0}{(}{}\Affichage[#1]{0}{0}{#5}\xintifboolexpr{#5<0}{)}{}%
+              }%
+            }{}%
+            % Etape 3
+            \xintifboolexpr{\useKV[ClesDistributivite]{Etape}=3}{%
+              \stepcounter{NbCalculDistri}%
+              \xdef\Multi{\fpeval{#2*#4}}%
+              \xdef\Multij{\fpeval{#2*#5}}%
+              \xdef\Multik{\fpeval{#3*#4}}%
+              \xdef\Multil{\fpeval{#3*#5}}%
+              %% ils sont redéfinis pour pouvoir envisager la somme de deux
+              %% expressions à développer
               \xintifboolexpr{\theNbCalculDistri>1}{\xintifboolexpr{\Multi<0}{(\Affichage{\Multi}{0}{0})}{\Affichage{\Multi}{0}{0}}}{\Affichage{\Multi}{0}{0}}%
-              \xintifboolexpr{\Multim=0}{}{%
-                \xintifboolexpr{\Multim>0}{+\Affichage{0}{\Multim}{0}}{-\Affichage{0}{\fpeval{-\Multim}}{0}}%
+              \ifboolKV[ClesDistributivite]{Reduction}{\mathunderline{DCReduction}{%
+                  \xintifboolexpr{\Multij=0}{}{\xintifboolexpr{\Multi=0}{}{{}+}\xintifboolexpr{\Multij<0}{(}{}\Affichage{0}{\Multij}{0}\xintifboolexpr{\Multij<0}{)}{}}%
+                  \xintifboolexpr{\Multik=0}{}{\xintifboolexpr{\Multil=0}{\xintifboolexpr{#2=0}{}{+}}{+}\xintifboolexpr{\Multik<0}{(}{}\Affichage{0}{\Multik}{0}\xintifboolexpr{\Multik<0}{)}{}}%
+                }%
+              }{%
+                \xintifboolexpr{\Multij=0}{}{\xintifboolexpr{\Multi=0}{}{+}\xintifboolexpr{\Multij<0}{(}{}\Affichage{0}{\Multij}{0}\xintifboolexpr{\Multij<0}{)}{}}%
+                \xintifboolexpr{\Multik=0}{}{\xintifboolexpr{\Multil=0}{\xintifboolexpr{#2=0}{}{+}}{\xintifboolexpr{#2=0}{}{+}}\xintifboolexpr{\Multik<0}{(}{}\Affichage{0}{\Multik}{0}\xintifboolexpr{\Multik<0}{)}{}}%
               }%
-              \xintifboolexpr{\Multil=0}{}{\xintifboolexpr{\Multil<0}{-\Affichage{0}{0}{\fpeval{-\Multil}}}{+\Affichage{0}{0}{\Multil}}}%\Affichage{\Multi}{\Multim}{\Multil}%
-              % fin 80
-            }
-            \ifboolKV[ClesDistributivite]{Somme}{\xdef\SommeA{\fpeval{\SommeA+#2*#4}}\xdef\SommeB{\fpeval{\SommeB+#2*#5+#3*#4}}\xdef\SommeC{\fpeval{\SommeC+#3*#5}}}{}%
-            \ifboolKV[ClesDistributivite]{Difference}{\xdef\SommeA{\fpeval{\SommeA-#2*#4}}\xdef\SommeB{\fpeval{\SommeB-#2*#5-#3*#4}}\xdef\SommeC{\fpeval{\SommeC-#3*#5}}}{}%
-          }{}%
+              \xintifboolexpr{\Multil=0}{}{+}\xintifboolexpr{\Multil<0}{(}{}\Affichage{0}{0}{\Multil}\xintifboolexpr{\Multil<0}{)}{}%
+            }{}%
+            % Etape 4
+            \xintifboolexpr{\useKV[ClesDistributivite]{Etape}=4}{%
+              \xdef\Multi{\fpeval{#2*#4}}%
+              \xdef\Multij{\fpeval{#2*#5}}%
+              \xdef\Multik{\fpeval{#3*#4}}%
+              \xdef\Multil{\fpeval{#3*#5}}%
+              %% ils sont redéfinis pour pouvoir envisager la somme de deux
+              %% expressions à développer
+              \xdef\Multim{\fpeval{#2*#5+#3*#4}}%
+              \xintifboolexpr{\theNbCalculDistri>1}{\setcounter{NbCalculDistri}{0}}{}%
+              \stepcounter{NbCalculDistri}%
+              \ifboolKV[ClesDistributivite]{Oppose}{%
+                \xdef\Multi{\fpeval{-\Multi}}%
+                \xdef\Multim{\fpeval{-\Multim}}%
+                \xdef\Multil{\fpeval{-\Multil}}%
+                \xintifboolexpr{\Multi=0}{}{\xintifboolexpr{\Multi<0}{(}{}\Affichage{\Multi}{0}{0}\xintifboolexpr{\Multi<0}{)}{}}%
+                \xintifboolexpr{\Multim=0}{}{\xintifboolexpr{\Multim>0}{+}{+(}\Affichage{0}{\Multim}{0}\xintifboolexpr{\Multim<0}{)}{}}%
+                \xintifboolexpr{\Multil=0}{}{\xintifboolexpr{\Multil>0}{+}{+(}\Affichage{0}{0}{\Multil}\xintifboolexpr{\Multil<0}{)}{}}%
+              }{%
+                \xintifboolexpr{\theNbCalculDistri>1}{\xintifboolexpr{\Multi<0}{(\Affichage{\Multi}{0}{0})}{\Affichage{\Multi}{0}{0}}}{\Affichage{\Multi}{0}{0}}%
+                \xintifboolexpr{\Multim=0}{}{%
+                  \xintifboolexpr{\Multim>0}{+\Affichage{0}{\Multim}{0}}{-\Affichage{0}{\fpeval{-\Multim}}{0}}%
+                }%
+                \xintifboolexpr{\Multil=0}{}{\xintifboolexpr{\Multil<0}{-\Affichage{0}{0}{\fpeval{-\Multil}}}{+\Affichage{0}{0}{\Multil}}}%
+              }
+              \ifboolKV[ClesDistributivite]{Somme}{\xdef\SommeA{\fpeval{\SommeA+#2*#4}}\xdef\SommeB{\fpeval{\SommeB+#2*#5+#3*#4}}\xdef\SommeC{\fpeval{\SommeC+#3*#5}}}{}%
+              \ifboolKV[ClesDistributivite]{Difference}{\xdef\SommeA{\fpeval{\SommeA-#2*#4}}\xdef\SommeB{\fpeval{\SommeB-#2*#5-#3*#4}}\xdef\SommeC{\fpeval{\SommeC-#3*#5}}}{}%
+            }{}%
+          }%
         }%
       }%
     }%
   }%
-  }%
 }%
 
 \newcommand{\Resultat}[1][]{%
@@ -2560,9 +2908,7 @@
     \useKVdefault[ClesDistributivite]%obligatoire car la macro n'est pas dans un groupe.
     \setKV[ClesDistributivite]{#1}%On lit les arguments optionnels
     \ifboolKV[ClesDistributivite]{RAZ}{\xdef\SommeA{0}\xdef\SommeB{0}\xdef\SommeC{0}%
-      % 80
       \setcounter{NbCalculDistri}{0}%
-      % fin 80
     }{}%
     \colorlet{DCAide}{\useKV[ClesDistributivite]{CouleurAide}}%
     \colorlet{DCReduction}{\useKV[ClesDistributivite]{CouleurReduction}}%
@@ -2583,10 +2929,8 @@
         \fi%
       }{}
       \xintifboolexpr{\useKV[ClesDistributivite]{Etape}=3}{%
-        % 80
         \xintifboolexpr{\theNbCalculDistri>1}{\setcounter{NbCalculDistri}{0}}{}%
         \stepcounter{NbCalculDistri}%
-        % fin 80
         \ifx\bla#4\bla%
         \xdef\Multi{\fpeval{#2*#2}}%
         \xdef\Multij{\fpeval{#2*#3}}%
@@ -2776,9 +3120,7 @@
           }{}          
           % Etape 3
           \xintifboolexpr{\useKV[ClesDistributivite]{Etape}=3}{%
-            % 80
             \stepcounter{NbCalculDistri}%
-            % fin 80
             \xdef\Multi{\fpeval{#2*#4}}%
             \xdef\Multij{\fpeval{#2*#5}}%
             \xdef\Multik{\fpeval{#3*#4}}%
@@ -2786,9 +3128,7 @@
             %% ils sont redéfinis pour pouvoir envisager la somme de deux
             %% expressions à développer
             \xintifboolexpr{\useKV[ClesDistributivite]{Echange}=1}{%
-              % 80
             \xintifboolexpr{\theNbCalculDistri>1}{\xintifboolexpr{\Multi<0}{(\AffichageEchange{0}{\Multi}{0})}{\AffichageEchange{0}{\Multi}{0}}}{\AffichageEchange{0}{\Multi}{0}}%
-            %fin 80\AffichageEchange{0}{\Multi}{0}%pas de soulignement de réduction ici
               \xintifboolexpr{\Multij=0}{}{\xintifboolexpr{\Multi=0}{}{+}\xintifboolexpr{\Multij<0}{(}{}\AffichageEchange{\Multij}{0}{0}\xintifboolexpr{\Multij<0}{)}{}}%
               \xintifboolexpr{\Multik=0}{}{\xintifboolexpr{\Multil=0}{\xintifboolexpr{#2=0}{}{+}}{+}\xintifboolexpr{\Multik<0}{(}{}\AffichageEchange{0}{0}{\Multik}\xintifboolexpr{\Multik<0}{)}{}}%
               \xintifboolexpr{\Multil=0}{}{+}\xintifboolexpr{\Multil<0}{(}{}\AffichageEchange{0}{\Multil}{0}\xintifboolexpr{\Multil<0}{)}{}%
@@ -2797,9 +3137,7 @@
               \ifboolKV[ClesDistributivite]{Difference}{\xdef\SommeA{\fpeval{\SommeA-\Multik}}\xdef\SommeB{\fpeval{\SommeB-\Multim}}\xdef\SommeC{\fpeval{\SommeC-\Multij}}}{}%              
             }{}%
             \xintifboolexpr{\useKV[ClesDistributivite]{Echange}=2}{%
-              % 80
             \xintifboolexpr{\theNbCalculDistri>1}{\xintifboolexpr{\Multi<0}{(\AffichageEchange{0}{\Multi}{0})}{\AffichageEchange{0}{\Multi}{0}}}{\AffichageEchange{0}{\Multi}{0}}%
-            %fin 80\AffichageEchange{0}{\Multi}{0}%pas de soulignement de réduction ici
               \xintifboolexpr{\Multij=0}{}{\xintifboolexpr{\Multi=0}{}{+}\xintifboolexpr{\Multij<0}{(}{}\AffichageEchange{0}{0}{\Multij}\xintifboolexpr{\Multij<0}{)}{}}%
               \xintifboolexpr{\Multik=0}{}{\xintifboolexpr{\Multil=0}{\xintifboolexpr{#2=0}{}{+}}{+}\xintifboolexpr{\Multik<0}{(}{}\AffichageEchange{\Multik}{0}{0}\xintifboolexpr{\Multik<0}{)}{}}%
               \xintifboolexpr{\Multil=0}{}{+}\xintifboolexpr{\Multil<0}{(}{}\AffichageEchange{0}{\Multil}{0}\xintifboolexpr{\Multil<0}{)}{}%
@@ -2808,9 +3146,7 @@
               \ifboolKV[ClesDistributivite]{Difference}{\xdef\SommeA{\fpeval{\SommeA-\Multij}}\xdef\SommeB{\fpeval{\SommeB-\Multim}}\xdef\SommeC{\fpeval{\SommeC-\Multik}}}{}%
             }{}%
             \xintifboolexpr{\useKV[ClesDistributivite]{Echange}=3}{%
-              % 80
             \xintifboolexpr{\theNbCalculDistri>1}{\xintifboolexpr{\Multi<0}{(\AffichageEchange{\Multi}{0}{0})}{\AffichageEchange{\Multi}{0}{0}}}{\AffichageEchange{\Multi}{0}{0}}%
-            %fin 80\AffichageEchange{\Multi}{0}{0}%pas de soulignement de réduction ici
               \xintifboolexpr{\Multij=0}{}{\xintifboolexpr{\Multi=0}{}{+}\xintifboolexpr{\Multij<0}{(}{}\AffichageEchange{0}{\Multij}{0}\xintifboolexpr{\Multij<0}{)}{}}%
               \xintifboolexpr{\Multik=0}{}{\xintifboolexpr{\Multil=0}{\xintifboolexpr{#2=0}{}{+}}{+}\xintifboolexpr{\Multik<0}{(}{}\AffichageEchange{0}{\Multik}{0}\xintifboolexpr{\Multik<0}{)}{}}%
               \xintifboolexpr{\Multil=0}{}{+}\xintifboolexpr{\Multil<0}{(}{}\AffichageEchange{0}{0}{\Multil}\xintifboolexpr{\Multil<0}{)}{}%
@@ -2827,10 +3163,8 @@
             \xdef\Multil{\fpeval{#3*#5}}%
             %% ils sont redéfinis pour pouvoir envisager la somme de deux
             %% expressions à développer
-            % 80
             \xintifboolexpr{\theNbCalculDistri>1}{\setcounter{NbCalculDistri}{0}}{}%
             \stepcounter{NbCalculDistri}%
-            %fin 80
             \xintifboolexpr{\useKV[ClesDistributivite]{Echange}=1}{%
               \xdef\Multim{\fpeval{#2*#4+#3*#5}}%
               \ifboolKV[ClesDistributivite]{Oppose}{%
@@ -2841,13 +3175,11 @@
                  \xintifboolexpr{\Multimo=0}{}{\xintifboolexpr{\Multimo>0}{+}{+(}\Affichage{0}{\Multimo}{0}\xintifboolexpr{\Multimo<0}{)}{}}%
                  \xintifboolexpr{\Multijo=0}{}{\xintifboolexpr{\Multijo>0}{+}{+(}\Affichage{0}{0}{\Multijo}\xintifboolexpr{\Multijo<0}{)}{}}%
               }{%
-                % 80
                 \xintifboolexpr{\theNbCalculDistri>1}{\xintifboolexpr{\Multik<0}{(\Affichage{\Multik}{0}{0})}{\Affichage{\Multik}{0}{0}}}{\Affichage{\Multik}{0}{0}}%
               \xintifboolexpr{\Multim=0}{}{%
                 \xintifboolexpr{\Multim>0}{+\Affichage{0}{\Multim}{0}}{-\Affichage{0}{\fpeval{-\Multim}}{0}}%
               }%
               \xintifboolexpr{\Multij=0}{}{\xintifboolexpr{\Multij<0}{-\Affichage{0}{0}{\fpeval{-\Multij}}}{+\Affichage{0}{0}{\Multij}}}%
-              % fin 80
               }%
                \ifboolKV[ClesDistributivite]{Somme}{\xdef\SommeA{\fpeval{\SommeA+\Multik}}\xdef\SommeB{\fpeval{\SommeB+\Multim}}\xdef\SommeC{\fpeval{\SommeC+\Multij}}}{}%
                \ifboolKV[ClesDistributivite]{Difference}{\xdef\SommeA{\fpeval{\SommeA-\Multik}}\xdef\SommeB{\fpeval{\SommeB-\Multim}}\xdef\SommeC{\fpeval{\SommeC-\Multij}}}{}%
@@ -2862,13 +3194,11 @@
                  \xintifboolexpr{\Multimo=0}{}{\xintifboolexpr{\Multimo>0}{+}{+(}\Affichage{0}{\Multimo}{0}\xintifboolexpr{\Multimo<0}{)}{}}%
                  \xintifboolexpr{\Multiko=0}{}{\xintifboolexpr{\Multiko>0}{+}{+(}\Affichage{0}{0}{\Multiko}\xintifboolexpr{\Multiko<0}{)}{}}%
               }{%
-                % 80
                 \xintifboolexpr{\theNbCalculDistri>1}{\xintifboolexpr{\Multij<0}{(\Affichage{\Multij}{0}{0})}{\Affichage{\Multij}{0}{0}}}{\Affichage{\Multij}{0}{0}}%
               \xintifboolexpr{\Multim=0}{}{%
                 \xintifboolexpr{\Multim>0}{+\Affichage{0}{\Multim}{0}}{-\Affichage{0}{\fpeval{-\Multim}}{0}}%
               }%
               \xintifboolexpr{\Multik=0}{}{\xintifboolexpr{\Multik<0}{-\Affichage{0}{0}{\fpeval{-\Multik}}}{+\Affichage{0}{0}{\Multik}}}%
-              % fin 80\Affichage{\Multij}{\Multim}{\Multik}%
               }%
                \ifboolKV[ClesDistributivite]{Somme}{\xdef\SommeA{\fpeval{\SommeA+\Multij}}\xdef\SommeB{\fpeval{\SommeB+\Multim}}\xdef\SommeC{\fpeval{\SommeC+\Multik}}}{}%
                \ifboolKV[ClesDistributivite]{Difference}{\xdef\SommeA{\fpeval{\SommeA-\Multij}}\xdef\SommeB{\fpeval{\SommeB-\Multim}}\xdef\SommeC{\fpeval{\SommeC-\Multik}}}{}%
@@ -2883,13 +3213,11 @@
                  \xintifboolexpr{\Multimo=0}{}{\xintifboolexpr{\Multimo>0}{+}{+(}\Affichage{0}{\Multimo}{0}\xintifboolexpr{\Multimo<0}{)}{}}%
                  \xintifboolexpr{\Multio=0}{}{\xintifboolexpr{\Multio>0}{+}{+(}\Affichage{0}{0}{\Multio}\xintifboolexpr{\Multio<0}{)}{}}%
                }{%
-                 % 80
                 \xintifboolexpr{\theNbCalculDistri>1}{\xintifboolexpr{\Multil<0}{(\Affichage{\Multil}{0}{0})}{\Affichage{\Multil}{0}{0}}}{\Affichage{\Multil}{0}{0}}%
               \xintifboolexpr{\Multim=0}{}{%
                 \xintifboolexpr{\Multim>0}{+\Affichage{0}{\Multim}{0}}{-\Affichage{0}{\fpeval{-\Multim}}{0}}%
               }%
               \xintifboolexpr{\Multi=0}{}{\xintifboolexpr{\Multi<0}{-\Affichage{0}{0}{\fpeval{-\Multi}}}{+\Affichage{0}{0}{\Multi}}}%
-              % fin 80\Affichage{\Multil}{\Multim}{\Multi}%
               }
                \ifboolKV[ClesDistributivite]{Somme}{\xdef\SommeA{\fpeval{\SommeA+\Multil}}\xdef\SommeB{\fpeval{\SommeB+\Multim}}\xdef\SommeC{\fpeval{\SommeC+\Multi}}}{}%
                \ifboolKV[ClesDistributivite]{Difference}{\xdef\SommeA{\fpeval{\SommeA-\Multil}}\xdef\SommeB{\fpeval{\SommeB-\Multim}}\xdef\SommeC{\fpeval{\SommeC-\Multi}}}{}%
@@ -2901,9 +3229,9 @@
   }%
 }%
 
-%%%%%%%%%%%%%%%
-%Nombre Premier
-%%%%%%%%%%%%%%%
+%%%
+% Nombre Premier
+%%%
 \setKVdefault[ClesNombrePremier]{Tableau=false,TableauVertical=false,TableauVerticalVide=false,Exposant=false,Longue=false,All=false,Arbre=false,ArbreVide=false,ArbreComplet=false,Diviseurs=false,DiviseursT=false,Dot=\dotfill}
 
 \newcommand\Decomposition[2][]{%
@@ -2930,7 +3258,7 @@
     pair Ancre[];
     numeric decalage;
     decalage=10mm;
-    
+
     vardef PremierSimple(expr NB)=
     b:=2;
     depart:=NB;
@@ -3393,7 +3721,6 @@
           \dnpvv=\numexpr\dnpvv+1\relax
           \cnpvv=\numexpr\anpvv/\bnpvv\relax
           \anpvv=\cnpvv\relax
-          %\num{\the\bnpvv}%
         \else%
           \bnpvv=\numexpr\bnpvv+1\relax%
         \fi%
@@ -3419,7 +3746,6 @@
           \dnpmv=\numexpr\dnpmv+1\relax
           \cnpmv=\numexpr\anpmv/\bnpmv\relax
           \anpmv=\cnpmv\relax
-          %\num{\the\bnpmv}
         \else%
           \bnpmv=\numexpr\bnpmv+1\relax%
         \fi%
@@ -3469,7 +3795,7 @@
   \anp=#1\relax%
   \bnp=2\relax%
   \premier=-1\relax%
- % Pour déterminer le nombre d'étapes
+  % Pour déterminer le nombre d'étapes
   \whiledo{\anp > 1}{%
     \modulo{\the\anp}{\the\bnp}
     \ifnum\remainder=0\relax%
@@ -3479,7 +3805,7 @@
     \else%
       \bnp=\numexpr\bnp+1\relax%
       \fi%
-  }
+  }%
   \ifnum\premier=0%
     Le nombre \num{#1} est un nombre premier.%
   \else%
@@ -3536,22 +3862,21 @@
     \else%
       \ifnum\exposant>0\relax
         \num{\the\pileb}\ifnum\exposant>1 ^{\num{\the\exposant}}\fi\times%
-        %\pilea=\anp\relax
       \fi
       \bnp=\numexpr\bnp+1\relax%
       \pileb=\bnp\relax%
-      \exposant=0\relax
+      \exposant=0\relax%
     \fi%
-  }
+  }%
   \num{\the\pileb}\ifnum\exposant>1^{\num{\the\exposant}}\fi%
-  }
-}
+  }%
+}%
 
 \newcommand{\PremierLong}[1]{%
   %#1 : le nombre entier à tester
   \ensuremath{%
   \newcount\anpl\newcount\bnpl\newcount\cnpl%
-  \newcount\pilebl
+  \newcount\pilebl%
   \anpl=#1\relax%
   \bnpl=2\relax%
   \pilebl=2\relax%
@@ -3564,7 +3889,7 @@
     \else%
       \bnpl=\numexpr\bnpl+1\relax%
       \pilebl=\bnpl\relax%
-      \fi%
+    \fi%
     }
   }
 }
@@ -3635,9 +3960,9 @@
   }%
 }
 
-%%%%%%%%%%%%%%%%%%%
+%%%
 % Simplification
-%%%%%%%%%%%%%%%%%%%
+%%%
 \makeatletter%by christian Tellechea
 % Calcul du PGCD de #1 et #2
 \newcount\cnt at a\newcount\cnt at b\newcount\pgcd
@@ -3675,6 +4000,11 @@
         \numerateur=\valabsnum
         \denominateur=\valabsdeno
       \fi
+    \else
+      \ifnum\the\denominateur<0\relax
+        \numerateur=-\valabsnum
+        \denominateur=\valabsdeno
+      \fi
     \fi
     \ifnum\number#2=0\relax
       \text{\bfseries(???)}
@@ -3718,6 +4048,17 @@
   \else
   \valabsdeno=\number#2
   \fi
+  \ifnum\the\numerateur<0\relax
+    \ifnum\the\denominateur<0\relax
+      \numerateur=\valabsnum
+      \denominateur=\valabsdeno
+    \fi
+  \else
+    \ifnum\the\denominateur<0\relax
+      \numerateur=-\valabsnum
+      \denominateur=\valabsdeno
+    \fi
+  \fi
   \ifnum\number#2=0\relax
     \ensuremath{\text{\bfseries(???)}}
   \else
@@ -3743,49 +4084,50 @@
     \fi
 }
 
+\newcount\anpdc\newcount\bnpdc\newcount\cnpdc\newcount\dnpdc%
+\newcount\DivCom
 \newcommand\DiviseurCommun[2]{%
   % #1 : le premier nombre entier
-  % #2 : le deuxième nombre entier 
-  \newcount\anpdc\newcount\bnpdc\newcount\cnpdc%
+  % #2 : le deuxième nombre entier
+ % nombre 1 vaut #1 - Nombre 2 vaut #2
   \anpdc=#1%
   \cnpdc=#2%
   \bnpdc=2\relax%
-  \whiledo{\bnpdc<\anpdc}{%
-    \modulo{\the\anpdc}{\the\bnpdc}{}%
+  \dnpdc=\numexpr#1+1\relax%
+  \DivCom=1\relax%
+  \whiledo{\bnpdc<\dnpdc}{%
+    \modulo{\the\anpdc}{\the\bnpdc}\relax
     \ifnum\remainder=0%
-    \modulo{\the\cnpdc}{\the\bnpdc}{}
+    \modulo{\the\cnpdc}{\the\bnpdc}
     \ifnum\remainder=0%
-    \xdef\DivCom{\the\bnpdc}%
+    \DivCom=\bnpdc%
     \bnpdc=\anpdc%
     \else%
-    \xdef\DivCom{1}%
-    \bnpdc=\numexpr\bnpdc+1%
-    \fi%
+    \DivCom=1%
+    \fi
     \else%
-    \xdef\DivCom{1}%
-    \bnpdc=\numexpr\bnpdc+1%
+    \DivCom=1%
     \fi
+    \bnpdc=\numexpr\bnpdc+1\relax%
   }%
 }
 
 \newcommand\LongueSimplification[2]{%
-  \DiviseurCommun{#1}{#2}%
   \xdef\NumerateurDiv{#1}%
   \xdef\DenominateurDiv{#2}%
+  \DiviseurCommun{#1}{#2}%
   \ensuremath{%
-    \whiledo{\DivCom > 1}{%
-      \xdef\DivComa{\DivCom}\xdef\MulComa{\fpeval{\NumerateurDiv/\DivComa}}
-      \xdef\DivComb{\DivCom}\xdef\MulComb{\fpeval{\DenominateurDiv/\DivComb}}
-      \frac{\num{\DivComa}\times\num{\MulComa}}{\num{\DivComb}\times\num{\MulComb}}=\frac{\num{\MulComa}}{\num{\MulComb}}%
-      \xdef\NumerateurDiv{\MulComa}%
-      \xdef\DenominateurDiv{\MulComb}%
+    \whiledo{\DivCom>1}{%
+      \frac{\num{\fpeval{\NumerateurDiv/\the\DivCom}}\times\num{\the\DivCom}}{\num{\fpeval{\DenominateurDiv/\the\DivCom}}\times\num{\the\DivCom}}=\frac{\num{\fpeval{\NumerateurDiv/\DivCom}}}{\num{\fpeval{\DenominateurDiv/\DivCom}}}%
+      \xdef\NumerateurDiv{\fpeval{\NumerateurDiv/\DivCom}}%
+      \xdef\DenominateurDiv{\fpeval{\DenominateurDiv/\DivCom}}%
       \DiviseurCommun{\NumerateurDiv}{\DenominateurDiv}%
       \xintifboolexpr{\DivCom>1}{=}{}%
-    }
-  }
-}
+    }%
+  }%
+}%
 
-\setKVdefault[ClesSimplification]{Details=false,All=false,Longue=false,Fleches=false}
+\setKVdefault[ClesSimplification]{Details=false,All=false,Longue=false,Fleches=false,Contraire=0}
 
 \newcounter{NbFrac}%
 \setcounter{NbFrac}{0}%
@@ -3814,17 +4156,23 @@
       \draw[out=-45,in=-135,-stealth,transform canvas={yshift=-0.25em}] (pic cs:B-\theNbFrac) to node[midway,below]{\Listeb[1,2]}(pic cs:D-\theNbFrac);%
     \end{tikzpicture}%
   }{%
-    \ifboolKV[ClesSimplification]{Longue}{%
-      \LongueSimplification{#2}{#3}%
+    \xintifboolexpr{\useKV[ClesSimplification]{Contraire}>1}{%
+      \ensuremath{%
+        \frac{\num{#2}}{\num{#3}}=\frac{\num{#2}\times\num{\useKV[ClesSimplification]{Contraire}}}{\num{#3}\times\num{\useKV[ClesSimplification]{Contraire}}}=\frac{\num{\fpeval{\useKV[ClesSimplification]{Contraire}*#2}}}{\num{\fpeval{\useKV[ClesSimplification]{Contraire}*#3}}}%
+      }%
     }{%
-      \ifboolKV[ClesSimplification]{Details}{\SSimpli{#2}{#3}}{\ifboolKV[ClesSimplification]{All}{\ensuremath{\SSimpli{#2}{#3}=\SSimplifie{#2}{#3}}}{\SSimplifie{#2}{#3}}}%
+      \ifboolKV[ClesSimplification]{Longue}{%
+        \LongueSimplification{#2}{#3}%
+      }{%
+        \ifboolKV[ClesSimplification]{Details}{\SSimpli{#2}{#3}}{\ifboolKV[ClesSimplification]{All}{\ensuremath{\SSimpli{#2}{#3}=\SSimplifie{#2}{#3}}}{\SSimplifie{#2}{#3}}}%
+      }%
     }%
   }%
 }%
 
-%%%%%%%%%%%%%%%%%%%%%
-%%% Thales
-%%%%%%%%%%%%%%%%%%%%%
+%%%
+% Thales
+%%%
 \newcount\ppcm
 
 \newcommand\PPCM[2]{%
@@ -3832,10 +4180,10 @@
   \ppcm=\numexpr#1*#2/\pgcd\relax
 }
 
-\setKVdefault[ClesThales]{Calcul=true,Droites=false,Propor=false,Segment=false,Figure=false,Figurecroisee=false,Precision=2,Entier=false,Unite=cm,Reciproque=false,Produit=false,ChoixCalcul=0,Simplification,Redaction=false,Remediation=false}
+\setKVdefault[ClesThales]{Calcul=true,Droites=false,Propor=false,Segment=false,Figure=false,FigureSeule=false,Figurecroisee=false,FigurecroiseeSeule=false,Angle=0,Precision=2,Entier=false,Unite=cm,Reciproque=false,Produit=false,ChoixCalcul=0,Simplification,Redaction=false,Remediation=false}
 
 %On définit la figure à utiliser
-\def\MPFigThales#1#2#3#4#5{
+\def\MPFigThales#1#2#3#4#5#6{
     % #1 Premier sommet
     % #2 Deuxième sommet
     % #3 Troisième sommet
@@ -3855,15 +4203,10 @@
     O - .5[A,B] = whatever * (B-A) rotated 90;
     O - .5[B,C] = whatever * (C-B) rotated 90;
     % On tourne pour éventuellement moins de lassitude :)
-    numeric Angle;
-    Angle=uniformdeviate(180);%Caractère aléatoire
-    A:=A rotatedabout(O,Angle);
-    B:=B rotatedabout(O,Angle);
-    C:=C rotatedabout(O,Angle);
-    % On définit le centre du cercle inscrit
-    %(I-C) rotated ((angle(A-C)-angle(B-C))/2) shifted C=whatever[A,C];
-    %(I-B) rotated ((angle(C-B)-angle(A-B))/2) shifted B=whatever[B,C];
-    %on dessine à main levée :)
+    A:=A rotatedabout(O,#6);
+    B:=B rotatedabout(O,#6);
+    C:=C rotatedabout(O,#6);
+    % on dessine à main levée :)
     path cotes[];
     cotes1=A{dir(angle(B-A)+5)}..B{dir(angle(B-A)+5)};
     cotes2=B{dir(angle(C-B)+5)}..C{dir(angle(C-B)+5)};
@@ -3909,14 +4252,10 @@
     O - .5[A,B] = whatever * (B-A) rotated 90;
     O - .5[B,C] = whatever * (C-B) rotated 90;
     % On tourne pour éventuellement moins de lassitude :)
-    Angle=uniformdeviate(180);%Caractère aléatoire
-    A:=A rotatedabout(O,Angle);
-    B:=B rotatedabout(O,Angle);
-    C:=C rotatedabout(O,Angle);
-    % On définit le centre du cercle inscrit
-    %(I-C) rotated ((angle(A-C)-angle(B-C))/2) shifted C=whatever[A,C];
-    %(I-B) rotated ((angle(C-B)-angle(A-B))/2) shifted B=whatever[B,C];
-    %on dessine à main levée :)
+    A:=A rotatedabout(O,#6);
+    B:=B rotatedabout(O,#6);
+    C:=C rotatedabout(O,#6);
+    % on dessine à main levée :)
     path cotes[];
     cotes1=A{dir(angle(B-A)+5)}..B{dir(angle(B-A)+5)};
     cotes2=B{dir(angle(C-B)+5)}..C{dir(angle(C-B)+5)};
@@ -3953,7 +4292,7 @@
 }
 
 %On définit la figure à utiliser
-\def\MPFigReciThales#1#2#3#4#5{
+\def\MPFigReciThales#1#2#3#4#5#6{
     % #1 Premier sommet
     % #2 Deuxième sommet
     % #3 Troisième sommet
@@ -3973,15 +4312,10 @@
     O - .5[A,B] = whatever * (B-A) rotated 90;
     O - .5[B,C] = whatever * (C-B) rotated 90;
     % On tourne pour éventuellement moins de lassitude :)
-    numeric Angle;
-    Angle=uniformdeviate(180);%Caractère aléatoire
-    A:=A rotatedabout(O,Angle);
-    B:=B rotatedabout(O,Angle);
-    C:=C rotatedabout(O,Angle);
-    % On définit le centre du cercle inscrit
-    %(I-C) rotated ((angle(A-C)-angle(B-C))/2) shifted C=whatever[A,C];
-    %(I-B) rotated ((angle(C-B)-angle(A-B))/2) shifted B=whatever[B,C];
-    %on dessine à main levée :)
+    A:=A rotatedabout(O,#6);
+    B:=B rotatedabout(O,#6);
+    C:=C rotatedabout(O,#6);
+    % on dessine à main levée :)
     path cotes[];
     cotes1=A{dir(angle(B-A)+5)}..B{dir(angle(B-A)+5)};
     cotes2=B{dir(angle(C-B)+5)}..C{dir(angle(C-B)+5)};
@@ -4015,14 +4349,10 @@
     O - .5[A,B] = whatever * (B-A) rotated 90;
     O - .5[B,C] = whatever * (C-B) rotated 90;
     % On tourne pour éventuellement moins de lassitude :)
-    Angle=uniformdeviate(180);%Caractère aléatoire
-    A:=A rotatedabout(O,Angle);
-    B:=B rotatedabout(O,Angle);
-    C:=C rotatedabout(O,Angle);
-    % On définit le centre du cercle inscrit
-    %(I-C) rotated ((angle(A-C)-angle(B-C))/2) shifted C=whatever[A,C];
-    %(I-B) rotated ((angle(C-B)-angle(A-B))/2) shifted B=whatever[B,C];
-    %on dessine à main levée :)
+    A:=A rotatedabout(O,#6);
+    B:=B rotatedabout(O,#6);
+    C:=C rotatedabout(O,#6);
+    % on dessine à main levée :)
     path cotes[];
     cotes1=A{dir(angle(B-A)+5)}..B{dir(angle(B-A)+5)};
     cotes2=B{dir(angle(C-B)+5)}..C{dir(angle(C-B)+5)};
@@ -4042,24 +4372,12 @@
     label(btex #5 etex,1.1[B,N]);
     fill (fullcircle scaled 0.75mm) shifted (cotes1 intersectionpoint cotes4);
     fill (fullcircle scaled 0.75mm) shifted (cotes3 intersectionpoint cotes4);
-%    pair I,J,K;
-%    I=1/2[M,N];
-%    J=1/2[B,C];
-%    K=1/2[I,J];
-%    path cd;
-%    cd=(fullcircle scaled 6mm) shifted K;
-%    drawoptions(withcolor 0.75*white);
-%    drawarrow reverse((I{dir(210+angle(I-J))}..{dir(150+angle(I-J))}K) cutafter cd);
-%    drawarrow reverse((J{dir(210+angle(J-I))}..{dir(150+angle(J-I))}K) cutafter cd);
-%    draw cd;
-%    label(btex $//$ etex ,K);
-%    drawoptions();
   \end{mpost}
   \fi
 }
 
 %On définit la deuxième figure à utiliser
-\def\MPFigThalesCroisee#1#2#3#4#5{%
+\def\MPFigThalesCroisee#1#2#3#4#5#6{%
     % #1 Premier sommet
     % #2 Deuxième sommet
     % #3 Troisième sommet
@@ -4079,11 +4397,9 @@
     B=A rotatedabout(O,130);
     C=(A--2[A,B rotatedabout(A,45)]) intersectionpoint (B--2[B,A rotatedabout(B,-60)]);
     % On tourne pour éventuellement moins de lassitude :)
-    numeric Angle;
-    Angle=uniformdeviate(180);%Caractère aléatoire
-    A:=A rotatedabout(O,Angle);
-    B:=B rotatedabout(O,Angle);
-    C:=C rotatedabout(O,Angle);
+    A:=A rotatedabout(O,#6);
+    B:=B rotatedabout(O,#6);
+    C:=C rotatedabout(O,#6);
     % on dessine à main levée :)
     M=1.4[B,A];
     N=1.4[C,A];
@@ -4102,7 +4418,6 @@
     (I-C) rotated ((angle(A-C)-angle(M-C))/2) shifted C=whatever[A,C];
     (I-M) rotated ((angle(C-M)-angle(A-M))/2) shifted M=whatever[M,C];
     %on labelise
-    %label(btex #1 etex,1.15[1/2[B,C],A]);
     label(btex #1 etex,I);
     label(btex #2 etex,1.2[M,B]);
     label(btex #3 etex,1.2[N,C]);
@@ -4136,10 +4451,9 @@
     B=A rotatedabout(O,130);
     C=(A--2[A,B rotatedabout(A,45)]) intersectionpoint (B--2[B,A rotatedabout(B,-60)]);
     % On tourne pour éventuellement moins de lassitude :)
-    Angle=uniformdeviate(180);%Caractère aléatoire
-    A:=A rotatedabout(O,Angle);
-    B:=B rotatedabout(O,Angle);
-    C:=C rotatedabout(O,Angle);
+    A:=A rotatedabout(O,#6);
+    B:=B rotatedabout(O,#6);
+    C:=C rotatedabout(O,#6);
     % on dessine à main levée :)
     M=1.4[B,A];
     N=1.4[C,A];
@@ -4158,7 +4472,6 @@
     (I-C) rotated ((angle(A-C)-angle(M-C))/2) shifted C=whatever[A,C];
     (I-M) rotated ((angle(C-M)-angle(A-M))/2) shifted M=whatever[M,C];
     %on labelise
-    %label(btex #1 etex,1.15[1/2[B,C],A]);
     label(btex #1 etex,I);
     label(btex #2 etex,1.2[M,B]);
     label(btex #3 etex,1.2[N,C]);
@@ -4183,7 +4496,7 @@
 }
 
 %On définit la deuxième figure à utiliser
-\def\MPFigReciThalesCroisee#1#2#3#4#5{%
+\def\MPFigReciThalesCroisee#1#2#3#4#5#6{%
   % #1 Premier sommet
     % #2 Deuxième sommet
     % #3 Troisième sommet
@@ -4203,11 +4516,9 @@
     B=A rotatedabout(O,130);
     C=(A--2[A,B rotatedabout(A,45)]) intersectionpoint (B--2[B,A rotatedabout(B,-60)]);
     % On tourne pour éventuellement moins de lassitude :)
-    numeric Angle;
-    Angle=uniformdeviate(180);%Caractère aléatoire
-    A:=A rotatedabout(O,Angle);
-    B:=B rotatedabout(O,Angle);
-    C:=C rotatedabout(O,Angle);
+    A:=A rotatedabout(O,#6);
+    B:=B rotatedabout(O,#6);
+    C:=C rotatedabout(O,#6);
     % on dessine à main levée :)
     M=1.4[B,A];
     N=1.4[C,A];
@@ -4226,7 +4537,6 @@
     (I-C) rotated ((angle(A-C)-angle(M-C))/2) shifted C=whatever[A,C];
     (I-M) rotated ((angle(C-M)-angle(A-M))/2) shifted M=whatever[M,C];
     %on labelise
-    %label(btex #1 etex,1.15[1/2[B,C],A]);
     label(btex #1 etex,I);
     label(btex #2 etex,1.2[M,B]);
     label(btex #3 etex,1.2[N,C]);
@@ -4250,10 +4560,9 @@
     B=A rotatedabout(O,130);
     C=(A--2[A,B rotatedabout(A,45)]) intersectionpoint (B--2[B,A rotatedabout(B,-60)]);
     % On tourne pour éventuellement moins de lassitude :)
-    Angle=uniformdeviate(180);%Caractère aléatoire
-    A:=A rotatedabout(O,Angle);
-    B:=B rotatedabout(O,Angle);
-    C:=C rotatedabout(O,Angle);
+    A:=A rotatedabout(O,#6);
+    B:=B rotatedabout(O,#6);
+    C:=C rotatedabout(O,#6);
     % on dessine à main levée :)
     M=1.4[B,A];
     N=1.4[C,A];
@@ -4272,7 +4581,6 @@
     (I-C) rotated ((angle(A-C)-angle(M-C))/2) shifted C=whatever[A,C];
     (I-M) rotated ((angle(C-M)-angle(A-M))/2) shifted M=whatever[M,C];
     %on labelise
-    %label(btex #1 etex,1.15[1/2[B,C],A]);
     label(btex #1 etex,I);
     label(btex #2 etex,1.2[M,B]);
     label(btex #3 etex,1.2[N,C]);
@@ -4291,7 +4599,7 @@
   \useKVdefault[ClesThales]%
   \setKV[ClesThales]{#1}%
   \ifboolKV[ClesThales]{Droites}{%
-    Les droites $(#3#5)$ et $(#4#6)$ sont sécantes en $#2$.%
+    Les droites \ifboolKV[ClesThales]{Remediation}{\pointilles[2cm]}{$(#3#5)$} et \ifboolKV[ClesThales]{Remediation}{\pointilles[2cm]}{$(#4#6)$} sont sécantes en \ifboolKV[ClesThales]{Remediation}{\pointilles[2cm]}{$#2$}.%
   }{%
     Dans le triangle \ifboolKV[ClesThales]{Remediation}{\pointilles[2cm]}{$#2#3#4$}, \ifboolKV[ClesThales]{Remediation}{\pointilles[1cm]}{$#5$} est un point \ifboolKV[ClesThales]{Segment}{du segment}{de la
       droite}
@@ -4869,23 +5177,31 @@
 
 \newcommand{\TThales}[8][]{%
   \setKV[ClesThales]{#1}%
-  \ifboolKV[ClesThales]{Figure}{%
-    \StrMid{#2}{1}{1}[\NomA]\StrMid{#2}{2}{2}[\NomB]\StrMid{#2}{3}{3}[\NomC]\StrMid{#2}{4}{4}[\NomM]\StrMid{#2}{5}{5}[\NomN]%
-    \begin{multicols}{2}%
-      {\em La figure est donnée à titre indicatif.}%
-      \[\MPFigThales\NomA\NomB\NomC\NomM\NomN\]%
-      \par\columnbreak\par%
-      \ifboolKV[ClesThales]{Entier}{\TThalesCalculsE[#1]{#2}{#3}{#4}{#5}{#6}{#7}{#8}}{\TThalesCalculsD[#1]{#2}{#3}{#4}{#5}{#6}{#7}{#8}}%
-    \end{multicols}%
-  }{\ifboolKV[ClesThales]{Figurecroisee}{%
-      \StrMid{#2}{1}{1}[\NomA]\StrMid{#2}{2}{2}[\NomB]\StrMid{#2}{3}{3}[\NomC]\StrMid{#2}{4}{4}[\NomM]\StrMid{#2}{5}{5}[\NomN]%
-      \begin{multicols}{2}%
-        {\em La figure est donnée à titre indicatif.}%
-        \[\MPFigThalesCroisee\NomA\NomB\NomC\NomM\NomN\]%
-        \par\columnbreak\par%
-        \ifboolKV[ClesThales]{Entier}{\TThalesCalculsE[#1]{#2}{#3}{#4}{#5}{#6}{#7}{#8}}{\TThalesCalculsD[#1]{#2}{#3}{#4}{#5}{#6}{#7}{#8}}%
-      \end{multicols}%
-    }{\ifboolKV[ClesThales]{Entier}{\TThalesCalculsE[#1]{#2}{#3}{#4}{#5}{#6}{#7}{#8}}{\TThalesCalculsD[#1]{#2}{#3}{#4}{#5}{#6}{#7}{#8}}}%
+  \StrMid{#2}{1}{1}[\NomA]\StrMid{#2}{2}{2}[\NomB]\StrMid{#2}{3}{3}[\NomC]\StrMid{#2}{4}{4}[\NomM]\StrMid{#2}{5}{5}[\NomN]%
+  \ifboolKV[ClesThales]{FigureSeule}{%
+    \MPFigThales{\NomA}{\NomB}{\NomC}{\NomM}{\NomN}{\useKV[ClesThales]{Angle}}%
+  }{\ifboolKV[ClesThales]{FigurecroiseeSeule}{%
+      \MPFigThalesCroisee{\NomA}{\NomB}{\NomC}{\NomM}{\NomN}{\useKV[ClesThales]{Angle}}%
+    }{%
+      \ifboolKV[ClesThales]{Figure}{%
+        \StrMid{#2}{1}{1}[\NomA]\StrMid{#2}{2}{2}[\NomB]\StrMid{#2}{3}{3}[\NomC]\StrMid{#2}{4}{4}[\NomM]\StrMid{#2}{5}{5}[\NomN]%
+        \begin{multicols}{2}%
+          {\em La figure est donnée à titre indicatif.}%
+          \[\MPFigThales{\NomA}{\NomB}{\NomC}{\NomM}{\NomN}{\useKV[ClesThales]{Angle}}\]%
+          \par\columnbreak\par%
+          \ifboolKV[ClesThales]{Entier}{\TThalesCalculsE[#1]{#2}{#3}{#4}{#5}{#6}{#7}{#8}}{\TThalesCalculsD[#1]{#2}{#3}{#4}{#5}{#6}{#7}{#8}}%
+        \end{multicols}%
+      }{\ifboolKV[ClesThales]{Figurecroisee}{%
+          \StrMid{#2}{1}{1}[\NomA]\StrMid{#2}{2}{2}[\NomB]\StrMid{#2}{3}{3}[\NomC]\StrMid{#2}{4}{4}[\NomM]\StrMid{#2}{5}{5}[\NomN]%
+          \begin{multicols}{2}%
+            {\em La figure est donnée à titre indicatif.}%
+            \[\MPFigThalesCroisee{\NomA}{\NomB}{\NomC}{\NomM}{\NomN}{\useKV[ClesThales]{Angle}}\]%
+            \par\columnbreak\par%
+            \ifboolKV[ClesThales]{Entier}{\TThalesCalculsE[#1]{#2}{#3}{#4}{#5}{#6}{#7}{#8}}{\TThalesCalculsD[#1]{#2}{#3}{#4}{#5}{#6}{#7}{#8}}%
+          \end{multicols}%
+        }{\ifboolKV[ClesThales]{Entier}{\TThalesCalculsE[#1]{#2}{#3}{#4}{#5}{#6}{#7}{#8}}{\TThalesCalculsD[#1]{#2}{#3}{#4}{#5}{#6}{#7}{#8}}}%
+      }%
+    }%
   }%
 }%
 %%%%
@@ -4984,31 +5300,40 @@
   % #4 longueur AB
   % #5 longueur AF
   % #6 longueur AC
-  \ifboolKV[ClesThales]{Figure}{%
+  \ifboolKV[ClesThales]{FigureSeule}{%
     \StrMid{#2}{1}{1}[\NomA]\StrMid{#2}{2}{2}[\NomB]\StrMid{#2}{3}{3}[\NomC]\StrMid{#2}{4}{4}[\NomM]\StrMid{#2}{5}{5}[\NomN]%
-    \begin{multicols}{2}
-      {\em La figure est donnée à titre indicatif.}
-      \[\MPFigReciThales{\NomA}{\NomB}{\NomC}{\NomM}{\NomN}\]
-      \par\columnbreak\par        
-      \ReciThales[#1]{\StrMid{#2}{1}{1}}{\StrMid{#2}{2}{2}}{\StrMid{#2}{3}{3}}{\StrMid{#2}{4}{4}}{\StrMid{#2}{5}{5}}\par
-      \ReciThalesCalculs[#1]{#2}{#3}{#4}{#5}{#6}{#7}{#8}
-    \end{multicols}
-  }{\ifboolKV[ClesThales]{Figurecroisee}{%
-      \StrMid{#2}{1}{1}[\NomA]\StrMid{#2}{2}{2}[\NomB]\StrMid{#2}{3}{3}[\NomC]\StrMid{#2}{4}{4}[\NomM]\StrMid{#2}{5}{5}[\NomN]
-      \begin{minipage}{0.4\linewidth}
-        {\em La figure est donnée à titre indicatif.}
-        \[\MPFigReciThalesCroisee{\NomA}{\NomB}{\NomC}{\NomM}{\NomN}\]
-      \end{minipage}
-      \hfill
-      \begin{minipage}{0.55\linewidth}
-        \ReciThales[#1]{\StrMid{#2}{1}{1}}{\StrMid{#2}{2}{2}}{\StrMid{#2}{3}{3}}{\StrMid{#2}{4}{4}}{\StrMid{#2}{5}{5}}\par
-        \ReciThalesCalculs[#1]{#2}{#3}{#4}{#5}{#6}{#7}{#8}
-    \end{minipage}\\%
-    }{\ReciThales[#1]{\StrMid{#2}{1}{1}}{\StrMid{#2}{2}{2}}{\StrMid{#2}{3}{3}}{\StrMid{#2}{4}{4}}{\StrMid{#2}{5}{5}}\par
-      \ReciThalesCalculs[#1]{#2}{#3}{#4}{#5}{#6}{#7}{#8}
-    }
-  }
-}
+    \MPFigReciThales{\NomA}{\NomB}{\NomC}{\NomM}{\NomN}{\useKV[ClesThales]{Angle}}%
+  }{\ifboolKV[ClesThales]{FigurecroiseeSeule}{%
+      \StrMid{#2}{1}{1}[\NomA]\StrMid{#2}{2}{2}[\NomB]\StrMid{#2}{3}{3}[\NomC]\StrMid{#2}{4}{4}[\NomM]\StrMid{#2}{5}{5}[\NomN]%
+      \MPFigReciThalesCroisee{\NomA}{\NomB}{\NomC}{\NomM}{\NomN}{\useKV[ClesThales]{Angle}}%
+    }{%
+      \ifboolKV[ClesThales]{Figure}{%
+        \StrMid{#2}{1}{1}[\NomA]\StrMid{#2}{2}{2}[\NomB]\StrMid{#2}{3}{3}[\NomC]\StrMid{#2}{4}{4}[\NomM]\StrMid{#2}{5}{5}[\NomN]%
+        \begin{multicols}{2}
+          {\em La figure est donnée à titre indicatif.}
+          \[\MPFigReciThales{\NomA}{\NomB}{\NomC}{\NomM}{\NomN}{\useKV[ClesThales]{Angle}}\]
+          \par\columnbreak\par        
+          \ReciThales[#1]{\StrMid{#2}{1}{1}}{\StrMid{#2}{2}{2}}{\StrMid{#2}{3}{3}}{\StrMid{#2}{4}{4}}{\StrMid{#2}{5}{5}}\par
+          \ReciThalesCalculs[#1]{#2}{#3}{#4}{#5}{#6}{#7}{#8}
+        \end{multicols}
+      }{\ifboolKV[ClesThales]{Figurecroisee}{%
+          \StrMid{#2}{1}{1}[\NomA]\StrMid{#2}{2}{2}[\NomB]\StrMid{#2}{3}{3}[\NomC]\StrMid{#2}{4}{4}[\NomM]\StrMid{#2}{5}{5}[\NomN]
+          \begin{minipage}{0.4\linewidth}
+            {\em La figure est donnée à titre indicatif.}
+            \[\MPFigReciThalesCroisee{\NomA}{\NomB}{\NomC}{\NomM}{\NomN}{\useKV[ClesThales]{Angle}}\]
+          \end{minipage}
+          \hfill
+          \begin{minipage}{0.55\linewidth}
+            \ReciThales[#1]{\StrMid{#2}{1}{1}}{\StrMid{#2}{2}{2}}{\StrMid{#2}{3}{3}}{\StrMid{#2}{4}{4}}{\StrMid{#2}{5}{5}}\par
+            \ReciThalesCalculs[#1]{#2}{#3}{#4}{#5}{#6}{#7}{#8}%
+          \end{minipage}\\%
+        }{\ReciThales[#1]{\StrMid{#2}{1}{1}}{\StrMid{#2}{2}{2}}{\StrMid{#2}{3}{3}}{\StrMid{#2}{4}{4}}{\StrMid{#2}{5}{5}}\par
+          \ReciThalesCalculs[#1]{#2}{#3}{#4}{#5}{#6}{#7}{#8}%
+        }%
+      }%
+    }%
+  }%
+}%
 
 \newcommand{\Thales}[8][]{%
   \useKVdefault[ClesThales]%
@@ -5016,18 +5341,48 @@
   \ifboolKV[ClesThales]{Reciproque}{%
     \ReciproqueThales[#1]{#2}{#3}{#4}{#5}{#6}{#7}{#8}%
   }{%
-    \ifboolKV[ClesThales]{Redaction}{%
-      \TTThales[#1]{\StrMid{#2}{1}{1}}{\StrMid{#2}{2}{2}}{\StrMid{#2}{3}{3}}{\StrMid{#2}{4}{4}}{\StrMid{#2}{5}{5}}%
+    \ifboolKV[ClesThales]{FigureSeule}{%
+      \StrMid{#2}{1}{1}[\NomA]\StrMid{#2}{2}{2}[\NomB]\StrMid{#2}{3}{3}[\NomC]\StrMid{#2}{4}{4}[\NomM]\StrMid{#2}{5}{5}[\NomN]%
+      \MPFigThales{\NomA}{\NomB}{\NomC}{\NomM}{\NomN}{\useKV[ClesThales]{Angle}}%
     }{%
-      \TThales[#1]{#2}{#3}{#4}{#5}{#6}{#7}{#8}%
-    }
+      \ifboolKV[ClesThales]{FigurecroiseeSeule}{%
+        \StrMid{#2}{1}{1}[\NomA]\StrMid{#2}{2}{2}[\NomB]\StrMid{#2}{3}{3}[\NomC]\StrMid{#2}{4}{4}[\NomM]\StrMid{#2}{5}{5}[\NomN]%
+        \MPFigThalesCroisee{\NomA}{\NomB}{\NomC}{\NomM}{\NomN}{\useKV[ClesThales]{Angle}}%
+      }{%
+        \ifboolKV[ClesThales]{Redaction}{%
+          \ifboolKV[ClesThales]{Figure}{%
+            \StrMid{#2}{1}{1}[\NomA]\StrMid{#2}{2}{2}[\NomB]\StrMid{#2}{3}{3}[\NomC]\StrMid{#2}{4}{4}[\NomM]\StrMid{#2}{5}{5}[\NomN]%
+            \begin{multicols}{2}
+              {\em La figure est donnée à titre indicatif.}%
+              \[\MPFigThales{\NomA}{\NomB}{\NomC}{\NomM}{\NomN}{\useKV[ClesThales]{Angle}}\]%
+              \par\columnbreak\par%
+              \TTThales[#1]{\StrMid{#2}{1}{1}}{\StrMid{#2}{2}{2}}{\StrMid{#2}{3}{3}}{\StrMid{#2}{4}{4}}{\StrMid{#2}{5}{5}}%
+            \end{multicols}%
+          }{%
+            \ifboolKV[ClesThales]{Figurecroisee}{%
+              \StrMid{#2}{1}{1}[\NomA]\StrMid{#2}{2}{2}[\NomB]\StrMid{#2}{3}{3}[\NomC]\StrMid{#2}{4}{4}[\NomM]\StrMid{#2}{5}{5}[\NomN]%
+              \begin{multicols}{2}
+                {\em La figure est donnée à titre indicatif.}%
+                \[\MPFigThalesCroisee{\NomA}{\NomB}{\NomC}{\NomM}{\NomN}{\useKV[ClesThales]{Angle}}\]%
+                \par\columnbreak\par%
+                \TTThales[#1]{\StrMid{#2}{1}{1}}{\StrMid{#2}{2}{2}}{\StrMid{#2}{3}{3}}{\StrMid{#2}{4}{4}}{\StrMid{#2}{5}{5}}%
+              \end{multicols}
+            }{%
+              \TTThales[#1]{\StrMid{#2}{1}{1}}{\StrMid{#2}{2}{2}}{\StrMid{#2}{3}{3}}{\StrMid{#2}{4}{4}}{\StrMid{#2}{5}{5}}%
+            }
+          }    
+        }{%
+          \TThales[#1]{#2}{#3}{#4}{#5}{#6}{#7}{#8}%
+        }%
+      }%
+    }%
   }%
 }%
 
-%%%%%%%%%%%%%%%%
-%% Trigonométrie
-%%%%%%%%%%%%%%%%
-\def\MPFigTrigo#1#2#3#4#5#6#7{%
+%%%
+% Trigonométrie
+%%%
+\def\MPFigTrigo#1#2#3#4#5#6#7#8{%
   \ifluatex
     \mplibcodeinherit{enable}
    \mplibforcehmode
@@ -5042,11 +5397,9 @@
     O - .5[A,B] = whatever * (B-A) rotated 90;
     O - .5[B,C] = whatever * (C-B) rotated 90;
     % On tourne pour éventuellement moins de lassitude :)
-    numeric Angle;
-    Angle=uniformdeviate(180);%Caractère aléatoire
-    A:=A rotatedabout(O,Angle);
-    B:=B rotatedabout(O,Angle);
-    C:=C rotatedabout(O,Angle);
+    A:=A rotatedabout(O,#8);
+    B:=B rotatedabout(O,#8);
+    C:=C rotatedabout(O,#8);
     % On définit le centre du cercle inscrit
     (I-C) rotated ((angle(A-C)-angle(B-C))/2) shifted C=whatever[A,C];
     (I-B) rotated ((angle(C-B)-angle(A-B))/2) shifted B=whatever[B,C];
@@ -5065,8 +5418,6 @@
     picture MAngle;
     MAngle=image(
     draw (cc shifted A);
-    % draw (cc shifted B);
-    % draw (cc shifted C);
     );
     draw MAngle;
     clip currentpicture to triangle;
@@ -5084,15 +5435,15 @@
     else:
     if angle(1/2[A,C]-B)>0:
       if #6=0:
-        label(btex ? etex rotated angle(C-A),1.1[B,1/2[A,C]]);
+        label(btex ? etex,1.1[B,1/2[A,C]]);
       else:
-        label(btex \num{#6} etex rotated angle(C-A),1.1[B,1/2[A,C]]);
+        label(btex \num{#6} etex,1.1[B,1/2[A,C]]);
       fi;
     else:
       if #6=0:
-        label(btex ? etex rotated angle(A-C),1.1[B,1/2[A,C]]);
+        label(btex ? etex,1.1[B,1/2[A,C]]);
       else:
-        label(btex \num{#6} etex rotated angle(A-C),1.1[B,1/2[A,C]]);
+        label(btex \num{#6} etex,1.1[B,1/2[A,C]]);
       fi;
     fi;
   fi;   
@@ -5100,15 +5451,15 @@
   else:
     if angle(1/2[B,C]-A)>0:
       if #4=0:
-        label(btex ? etex rotated(angle(B-C)),1/2[B,C]-decalage*(unitvector(A-B)));
+        label(btex ? etex,1/2[B,C]-decalage*(unitvector(A-B)));
       else:
-        label(btex \num{#4} etex rotated(angle(B-C)),1/2[B,C]-decalage*(unitvector(A-B)));
+        label(btex \num{#4} etex,1/2[B,C]-decalage*(unitvector(A-B)));
       fi;
     else:
       if #4=0:
-        label(btex ? etex rotated(angle(C-B)),1/2[B,C]-decalage*(unitvector(A-B)));
+        label(btex ? etex,1/2[B,C]-decalage*(unitvector(A-B)));
       else:
-        label(btex \num{#4} etex rotated(angle(C-B)),1/2[B,C]-decalage*(unitvector(A-B)));
+        label(btex \num{#4} etex,1/2[B,C]-decalage*(unitvector(A-B)));
       fi;
     fi;
   fi;
@@ -5116,15 +5467,15 @@
   else:
     if angle(1/2[A,B]-C)>0:
       if #5=0:
-        label(btex ? etex rotated angle(A-B),1/2[A,B]-decalage*(unitvector(C-B)));
+        label(btex ? etex,1/2[A,B]-decalage*(unitvector(C-B)));
       else:
-        label(btex \num{#5} etex rotated angle(A-B),1/2[A,B]-decalage*(unitvector(C-B)));
+        label(btex \num{#5} etex,1/2[A,B]-decalage*(unitvector(C-B)));
       fi;
     else:
       if #5=0:
-        label(btex ? etex rotated angle(B-A),1/2[A,B]-decalage*(unitvector(C-B)));
+        label(btex ? etex,1/2[A,B]-decalage*(unitvector(C-B)));
       else:
-        label(btex \num{#5} etex rotated angle(B-A),1/2[A,B]-decalage*(unitvector(C-B)));
+        label(btex \num{#5} etex,1/2[A,B]-decalage*(unitvector(C-B)));
       fi;
     fi;
     fi;
@@ -5142,10 +5493,9 @@
     O - .5[A,B] = whatever * (B-A) rotated 90;
     O - .5[B,C] = whatever * (C-B) rotated 90;
     % On tourne pour éventuellement moins de lassitude :)
-    Angle=uniformdeviate(180);%Caractère aléatoire
-    A:=A rotatedabout(O,Angle);
-    B:=B rotatedabout(O,Angle);
-    C:=C rotatedabout(O,Angle);
+    A:=A rotatedabout(O,#8);
+    B:=B rotatedabout(O,#8);
+    C:=C rotatedabout(O,#8);
     % On définit le centre du cercle inscrit
     (I-C) rotated ((angle(A-C)-angle(B-C))/2) shifted C=whatever[A,C];
     (I-B) rotated ((angle(C-B)-angle(A-B))/2) shifted B=whatever[B,C];
@@ -5231,7 +5581,7 @@
 \fi
 }
 
-\def\MPFigTrigoAngle#1#2#3#4#5#6{%
+\def\MPFigTrigoAngle#1#2#3#4#5#6#7{%
   % #1 A
   % #2 B
   % #3 C
@@ -5252,12 +5602,10 @@
   O - .5[A,B] = whatever * (B-A) rotated 90;
   O - .5[B,C] = whatever * (C-B) rotated 90;
   % On tourne pour éventuellement moins de lassitude :)
-  numeric Anglelua;
-  Anglelua=uniformdeviate(180);%Caractère aléatoire
-  A:=A rotatedabout(O,Anglelua);
-  B:=B rotatedabout(O,Anglelua);
-  C:=C rotatedabout(O,Anglelua);
-    % On définit le centre du cercle inscrit
+  A:=A rotatedabout(O,#7);
+  B:=B rotatedabout(O,#7);
+  C:=C rotatedabout(O,#7);
+  % On définit le centre du cercle inscrit
   (I-C) rotated ((angle(A-C)-angle(B-C))/2) shifted C=whatever[A,C];
   (I-B) rotated ((angle(C-B)-angle(A-B))/2) shifted B=whatever[B,C];
     %on dessine à main levée :)
@@ -5275,8 +5623,6 @@
   picture MAngle;
   MAngle=image(
   draw (cc shifted A);
-%    draw (cc shifted B);
-%    draw (cc shifted C);
   );
   draw MAngle;
   clip currentpicture to triangle;
@@ -5283,7 +5629,7 @@
   draw A{dir(angle(B-A)+5)}..B{dir(angle(B-A)+5)};
   draw B{dir(angle(C-B)+5)}..C{dir(angle(C-B)+5)};
   draw C{dir(angle(A-C)+5)}..A{dir(angle(A-C)+5)};
-    %on labelise
+  % on labelise
   label(btex #1 etex,1.15[O,A]);
   label(btex #2 etex,1.15[O,B]);
   label(btex #3 etex,1.15[O,C]);
@@ -5290,19 +5636,19 @@
   label(btex ? etex,A+0.95u*unitvector(I-A));
   decalage:=3mm;
   if angle(1/2[A,C]-B)>0:
-    label(btex \num{#6} etex rotated angle(C-A),1.1[B,1/2[A,C]]);
+    label(btex \num{#6} etex,1.1[B,1/2[A,C]]);
   else:
-  label(btex \num{#6} etex rotated angle(A-C),1.1[B,1/2[A,C]]);
+  label(btex \num{#6} etex,1.1[B,1/2[A,C]]);
   fi;
   if angle(1/2[B,C]-A)>0:
-   label(btex \num{#4} etex rotated(angle(B-C)),1/2[B,C]-decalage*(unitvector(A-B)));
+   label(btex \num{#4} etex,1/2[B,C]-decalage*(unitvector(A-B)));
   else:
-    label(btex \num{#4} etex rotated(angle(C-B)),1/2[B,C]-decalage*(unitvector(A-B)));
+    label(btex \num{#4} etex,1/2[B,C]-decalage*(unitvector(A-B)));
   fi;
   if angle(1/2[A,B]-C)>0:
-    label(btex \num{#5} etex rotated angle(A-B),1/2[A,B]-decalage*(unitvector(C-B)));
+    label(btex \num{#5} etex,1/2[A,B]-decalage*(unitvector(C-B)));
   else:
-  label(btex \num{#5} etex rotated angle(B-A),1/2[A,B]-decalage*(unitvector(C-B)));
+  label(btex \num{#5} etex,1/2[A,B]-decalage*(unitvector(C-B)));
   fi;
 \end{mplibcode}
 \mplibcodeinherit{disable}
@@ -5318,10 +5664,9 @@
   O - .5[A,B] = whatever * (B-A) rotated 90;
   O - .5[B,C] = whatever * (C-B) rotated 90;
     % On tourne pour éventuellement moins de lassitude :)
-  Angle=uniformdeviate(180);%Caractère aléatoire
-  A:=A rotatedabout(O,Angle);
-  B:=B rotatedabout(O,Angle);
-  C:=C rotatedabout(O,Angle);
+  A:=A rotatedabout(O,#7);
+  B:=B rotatedabout(O,#7);
+  C:=C rotatedabout(O,#7);
     % On définit le centre du cercle inscrit
   (I-C) rotated ((angle(A-C)-angle(B-C))/2) shifted C=whatever[A,C];
   (I-B) rotated ((angle(C-B)-angle(A-B))/2) shifted B=whatever[B,C];
@@ -5340,8 +5685,6 @@
   picture MAngle;
   MAngle=image(
       draw (cc shifted A);
-%    draw (cc shifted B);
-%    draw (cc shifted C);
     );
   draw MAngle;
   clip currentpicture to triangle;
@@ -5355,25 +5698,25 @@
   label(btex ? etex,A+0.95u*unitvector(I-A));
   decalage:=3mm;
   if angle(1/2[A,C]-B)>0:
-    label(btex \num{#6} etex rotated angle(C-A),1.1[B,1/2[A,C]]);
+    label(btex \num{#6} etex,1.1[B,1/2[A,C]]);
   else:
-  label(btex \num{#6} etex rotated angle(A-C),1.1[B,1/2[A,C]]);
+  label(btex \num{#6} etex,1.1[B,1/2[A,C]]);
   fi;
   if angle(1/2[B,C]-A)>0:
-   label(btex \num{#4} etex rotated(angle(B-C)),1/2[B,C]-decalage*(unitvector(A-B)));
+   label(btex \num{#4} etex,1/2[B,C]-decalage*(unitvector(A-B)));
   else:
-    label(btex \num{#4} etex rotated(angle(C-B)),1/2[B,C]-decalage*(unitvector(A-B)));
+    label(btex \num{#4} etex,1/2[B,C]-decalage*(unitvector(A-B)));
   fi;
   if angle(1/2[A,B]-C)>0:
-    label(btex \num{#5} etex rotated angle(A-B),1/2[A,B]-decalage*(unitvector(C-B)));
+    label(btex \num{#5} etex,1/2[A,B]-decalage*(unitvector(C-B)));
   else:
-  label(btex \num{#5} etex rotated angle(B-A),1/2[A,B]-decalage*(unitvector(C-B)));
+  label(btex \num{#5} etex,1/2[A,B]-decalage*(unitvector(C-B)));
   fi;
 \end{mpost}
 \fi
 }
 
-\setKVdefault[ClesTrigo]{Angle=false,Propor=false,Figure=false,Precision=2,Unite=cm,Sinus=false,Cosinus=false,Tangente=false}%
+\setKVdefault[ClesTrigo]{Angle=0,Propor=false,Figure=false,FigureSeule=false,Precision=2,Unite=cm,Sinus=false,Cosinus=false,Tangente=false}%
 
 \newcommand\TrigoCalculs[5][]{%
   \setKV[ClesTrigo]{#1}%
@@ -5381,18 +5724,19 @@
   % #2 Nom du triangle ABC, rectangle en B, angle connu ou pas : BAC
   % #3 Longueur
   % #4 Longueur
-   %#5 angle
+  % #5 angle
   % On définit les points
   \StrMid{#2}{1}{1}[\NomA]%
   \StrMid{#2}{2}{2}[\NomB]%
   \StrMid{#2}{3}{3}[\NomC]%
-  Dans le triangle $\NomA\NomB\NomC$, rectangle en $\NomB$, on a :
+  Dans le triangle $\NomA\NomB\NomC$, rectangle en $\NomB$, on a :%
   \ifboolKV[ClesTrigo]{Cosinus}{%
     \ifx\bla#3\bla%on calcule le côté adjacent
-    \ifboolKV[ClesTrigo]{Propor}{%
-      \begin{align*}
-        \NomA\NomC\times\cos(\widehat{\NomB\NomA\NomC})&=\NomA\NomB\\
-        \num{#4}\times\cos(\ang{#5})&=\NomA\NomB\\
+    \xdef\ResultatTrigo{\fpeval{round(\fpeval{#4*cosd(#5)},\useKV[ClesTrigo]{Precision})}}%
+   \ifboolKV[ClesTrigo]{Propor}{%
+     \begin{align*}
+       \NomA\NomC\times\cos(\widehat{\NomB\NomA\NomC})&=\NomA\NomB\\
+       \num{#4}\times\cos(\ang{#5})&=\NomA\NomB\\
         \num{\fpeval{round(\fpeval{#4*cosd(#5)},\useKV[ClesTrigo]{Precision})}}~\text{\useKV[ClesTrigo]{Unite}}&\IfInteger{\fpeval{round(\fpeval{#4*cosd(#5)},2)}}{=}{\approx}\NomA\NomB%
       \end{align*}%
     }{%
@@ -5400,12 +5744,12 @@
         \cos(\widehat{\NomB\NomA\NomC})&=\frac{\NomA\NomB}{\NomA\NomC}\\
         \cos(\ang{#5})&=\frac{\NomA\NomB}{\num{#4}}\\
         \num{#4}\times\cos(\ang{#5})&=\NomA\NomB\\
-        \num{\fpeval{round(\fpeval{#4*cosd(#5)},\useKV[ClesTrigo]{Precision})}}~\text{\useKV[ClesTrigo]{Unite}}&\IfInteger{\fpeval{round(\fpeval{#4*cosd(#5)},2)}}{=}{\approx}\NomA\NomB%
-      \end{align*}%
+        \num{\fpeval{round(\fpeval{#4*cosd(#5)},\useKV[ClesTrigo]{Precision})}}~\text{\useKV[ClesTrigo]{Unite}}&\IfInteger{\fpeval{round(\fpeval{#4*cosd(#5)},2)}}{=}{\approx}\NomA\NomB
+      \end{align*}
     }%
-    \xdef\ResultatTrigo{\fpeval{round(\fpeval{#4*cosd(#5)},\useKV[ClesTrigo]{Precision})}}%
-    \else
+    \else%
     \ifx\bla#4\bla%on calcule l'hypothénuse
+    \xdef\ResultatTrigo{\fpeval{round(\fpeval{#3/cosd(#5)},\useKV[ClesTrigo]{Precision})}}%
     \ifboolKV[ClesTrigo]{Propor}{%
       \begin{align*}
         \NomA\NomC\times\cos(\widehat{\NomB\NomA\NomC})&=\NomA\NomB\\
@@ -5421,8 +5765,8 @@
         \NomA\NomC&\IfInteger{\fpeval{round(\fpeval{#3/cosd(#5)},2)}}{=}{\approx}\num{\fpeval{round(\fpeval{#3/cosd(#5)},\useKV[ClesTrigo]{Precision})}}~\text{\useKV[ClesTrigo]{Unite}}%
       \end{align*}%
     }%
-    \xdef\ResultatTrigo{\fpeval{round(\fpeval{#3/cosd(#5)},\useKV[ClesTrigo]{Precision})}}%
     \else%on calcule l'angle
+    \xdef\ResultatTrigo{\fpeval{round(\fpeval{acosd(#3/#4)})}}%
     \ifboolKV[ClesTrigo]{Propor}{%
       \begin{align*}
         \NomA\NomC\times\cos(\widehat{\NomB\NomA\NomC})&=\NomA\NomB\\
@@ -5437,12 +5781,12 @@
         \widehat{\NomB\NomA\NomC}&\IfInteger{\fpeval{round(\fpeval{acosd(#3/#4)},2)}}{=}{\approx}\ang{\fpeval{round(\fpeval{acosd(#3/#4)})}}%
       \end{align*}%
     }%
-    \xdef\ResultatTrigo{\fpeval{round(\fpeval{acosd(#3/#4)})}}%
-    \fi
-    \fi
-  }{}
+    \fi%
+    \fi%
+  }{}%
   \ifboolKV[ClesTrigo]{Sinus}{%
     \ifx\bla#3\bla%on calcule le côté opposé
+    \xdef\ResultatTrigo{\fpeval{round(\fpeval{#4*sind(#5)},\useKV[ClesTrigo]{Precision})}}%
     \ifboolKV[ClesTrigo]{Propor}{%
       \begin{align*}
         \NomA\NomC\times\sin(\widehat{\NomB\NomA\NomC})&=\NomB\NomC\\
@@ -5457,26 +5801,26 @@
         \num{\fpeval{round(\fpeval{#4*sind(#5)},\useKV[ClesTrigo]{Precision})}}~\text{\useKV[ClesTrigo]{Unite}}&\IfInteger{\fpeval{round(\fpeval{#4*sind(#5)},2)}}{=}{\approx}\NomB\NomC%
       \end{align*}%
     }%
-    \xdef\ResultatTrigo{\fpeval{round(\fpeval{#4*sind(#5)},\useKV[ClesTrigo]{Precision})}}%
     \else
     \ifx\bla#4\bla%on calcule l'hypothénuse
+    \xdef\ResultatTrigo{\fpeval{round(\fpeval{#3/sind(#5)},\useKV[ClesTrigo]{Precision})}}%
     \ifboolKV[ClesTrigo]{Propor}{%
-    \begin{align*}
-      \NomA\NomC\times\sin(\widehat{\NomB\NomA\NomC})&=\NomB\NomC\\
-      \NomA\NomC\times\sin(\ang{#5})&=\num{#3}\\
-      \NomA\NomC&=\frac{\num{#3}}{\sin(\ang{#5})}\\
-      \NomA\NomC&\IfInteger{\fpeval{round(\fpeval{#3/sind(#5)},2)}}{=}{\approx}\num{\fpeval{round(\fpeval{#3/sind(#5)},\useKV[ClesTrigo]{Precision})}}~\text{\useKV[ClesTrigo]{Unite}}%
-    \end{align*}%
-  }{
-    \begin{align*}
-      \sin(\widehat{\NomB\NomA\NomC})&=\frac{\NomB\NomC}{\NomA\NomC}\\
-      \sin(\ang{#5})&=\frac{\num{#3}}{\NomA\NomC}\\
-      \NomA\NomC&=\frac{\num{#3}}{\sin(\ang{#5})}\\
-      \NomA\NomC&\IfInteger{\fpeval{round(\fpeval{#3/sind(#5)},2)}}{=}{\approx}\num{\fpeval{round(\fpeval{#3/sind(#5)},\useKV[ClesTrigo]{Precision})}}~\text{\useKV[ClesTrigo]{Unite}}%
-    \end{align*}%
-  }%
-  \xdef\ResultatTrigo{\fpeval{round(\fpeval{#3/sind(#5)},\useKV[ClesTrigo]{Precision})}}%
-  \else%on calcule l'angle
+      \begin{align*}
+        \NomA\NomC\times\sin(\widehat{\NomB\NomA\NomC})&=\NomB\NomC\\
+        \NomA\NomC\times\sin(\ang{#5})&=\num{#3}\\
+        \NomA\NomC&=\frac{\num{#3}}{\sin(\ang{#5})}\\
+        \NomA\NomC&\IfInteger{\fpeval{round(\fpeval{#3/sind(#5)},2)}}{=}{\approx}\num{\fpeval{round(\fpeval{#3/sind(#5)},\useKV[ClesTrigo]{Precision})}}~\text{\useKV[ClesTrigo]{Unite}}%
+      \end{align*}%
+    }{%
+      \begin{align*}
+        \sin(\widehat{\NomB\NomA\NomC})&=\frac{\NomB\NomC}{\NomA\NomC}\\
+        \sin(\ang{#5})&=\frac{\num{#3}}{\NomA\NomC}\\
+        \NomA\NomC&=\frac{\num{#3}}{\sin(\ang{#5})}\\
+        \NomA\NomC&\IfInteger{\fpeval{round(\fpeval{#3/sind(#5)},2)}}{=}{\approx}\num{\fpeval{round(\fpeval{#3/sind(#5)},\useKV[ClesTrigo]{Precision})}}~\text{\useKV[ClesTrigo]{Unite}}%
+      \end{align*}%
+    }%
+    \else%on calcule l'angle
+    \xdef\ResultatTrigo{\fpeval{round(\fpeval{asind(#3/#4)})}}%
     \ifboolKV[ClesTrigo]{Propor}{%
       \begin{align*}
         \NomA\NomC\times\sin(\widehat{\NomB\NomA\NomC})&=\NomB\NomC\\
@@ -5491,12 +5835,12 @@
         \widehat{\NomB\NomA\NomC}&\IfInteger{\fpeval{round(\fpeval{asind(#3/#4)},2)}}{=}{\approx}\ang{\fpeval{round(\fpeval{asind(#3/#4)})}}%
       \end{align*}%
     }%
-    \xdef\ResultatTrigo{\fpeval{round(\fpeval{asind(#3/#4)})}}%
-    \fi
-    \fi
-  }{}
+    \fi%
+    \fi%
+  }{}%
   \ifboolKV[ClesTrigo]{Tangente}{%
     \ifx\bla#3\bla%on calcule le côté opposé
+    \xdef\ResultatTrigo{\fpeval{round(\fpeval{#4*tand(#5)},\useKV[ClesTrigo]{Precision})}}%
     \ifboolKV[ClesTrigo]{Propor}{%
       \begin{align*}
         \NomA\NomB\times\tan(\widehat{\NomB\NomA\NomC})&=\NomB\NomC\\%
@@ -5511,26 +5855,26 @@
         \num{\fpeval{round(\fpeval{#4*tand(#5)},\useKV[ClesTrigo]{Precision})}}~\text{\useKV[ClesTrigo]{Unite}}&\IfInteger{\fpeval{round(\fpeval{#4*tand(#5)},2)}}{=}{\approx}\NomB\NomC%
       \end{align*}%
     }%
-    \xdef\ResultatTrigo{\fpeval{round(\fpeval{#4*tand(#5)},\useKV[ClesTrigo]{Precision})}}%
     \else
     \ifx\bla#4\bla%on calcule l'adjacent
+    \xdef\ResultatTrigo{\fpeval{round(\fpeval{#3/tand(#5)},\useKV[ClesTrigo]{Precision})}}%
     \ifboolKV[ClesTrigo]{Propor}{%
-    \begin{align*}
-      \NomA\NomB\times\tan(\widehat{\NomB\NomA\NomC})&=\NomB\NomC\\
-      \NomA\NomB\times\tan(\ang{#5})&=\num{#3}\\
-      \NomA\NomB&=\frac{\num{#3}}{\tan(\ang{#5})}\\
-      \NomA\NomB&\IfInteger{\fpeval{round(\fpeval{#3/tand(#5)},2)}}{=}{\approx}\num{\fpeval{round(\fpeval{#3/tand(#5)},\useKV[ClesTrigo]{Precision})}}~\text{\useKV[ClesTrigo]{Unite}}%
-    \end{align*}%
-  }{
-    \begin{align*}
-      \tan(\widehat{\NomB\NomA\NomC})&=\frac{\NomB\NomC}{\NomA\NomB}\\
-      \tan(\ang{#5})&=\frac{\num{#3}}{\NomA\NomB}\\
-      \NomA\NomB&=\frac{\num{#3}}{\tan(\ang{#5})}\\
-      \NomA\NomB&\IfInteger{\fpeval{round(\fpeval{#3/tand(#5)},2)}}{=}{\approx}\num{\fpeval{round(\fpeval{#3/tand(#5)},\useKV[ClesTrigo]{Precision})}}~\text{\useKV[ClesTrigo]{Unite}}%
-    \end{align*}%
-  }%
-  \xdef\ResultatTrigo{\fpeval{round(\fpeval{#3/tand(#5)},\useKV[ClesTrigo]{Precision})}}%
+      \begin{align*}
+        \NomA\NomB\times\tan(\widehat{\NomB\NomA\NomC})&=\NomB\NomC\\
+        \NomA\NomB\times\tan(\ang{#5})&=\num{#3}\\
+        \NomA\NomB&=\frac{\num{#3}}{\tan(\ang{#5})}\\
+        \NomA\NomB&\IfInteger{\fpeval{round(\fpeval{#3/tand(#5)},2)}}{=}{\approx}\num{\fpeval{round(\fpeval{#3/tand(#5)},\useKV[ClesTrigo]{Precision})}}~\text{\useKV[ClesTrigo]{Unite}}%
+      \end{align*}%
+    }{%
+      \begin{align*}
+        \tan(\widehat{\NomB\NomA\NomC})&=\frac{\NomB\NomC}{\NomA\NomB}\\
+        \tan(\ang{#5})&=\frac{\num{#3}}{\NomA\NomB}\\
+        \NomA\NomB&=\frac{\num{#3}}{\tan(\ang{#5})}\\
+        \NomA\NomB&\IfInteger{\fpeval{round(\fpeval{#3/tand(#5)},2)}}{=}{\approx}\num{\fpeval{round(\fpeval{#3/tand(#5)},\useKV[ClesTrigo]{Precision})}}~\text{\useKV[ClesTrigo]{Unite}}%
+      \end{align*}%
+    }%
     \else%on calcule l'angle
+    \xdef\ResultatTrigo{\fpeval{round(\fpeval{atand(#3/#4)})}}%
     \ifboolKV[ClesTrigo]{Propor}{%
       \begin{align*}
         \NomA\NomB\times\tan(\widehat{\NomB\NomA\NomC})&=\NomB\NomC\\
@@ -5538,7 +5882,7 @@
         \tan(\widehat{\NomB\NomA\NomC})&=\frac{\num{#3}}{\num{#4}}\\
         \widehat{\NomB\NomA\NomC}&\IfInteger{\fpeval{round(\fpeval{atand(#3/#4)},2)}}{=}{\approx}\ang{\fpeval{round(\fpeval{atand(#3/#4)})}}%
       \end{align*}%
-    }{
+    }{%
       \begin{align*}
         \tan(\widehat{\NomB\NomA\NomC})&=\frac{\NomB\NomC}{\NomA\NomB}\\
         \tan(\widehat{\NomB\NomA\NomC})&=\frac{\num{#3}}{\num{#4}}\\
@@ -5545,11 +5889,10 @@
         \widehat{\NomB\NomA\NomC}&\IfInteger{\fpeval{round(\fpeval{atand(#3/#4)},2)}}{=}{\approx}\ang{\fpeval{round(\fpeval{atand(#3/#4)})}}%
       \end{align*}%
     }%
-    \xdef\ResultatTrigo{\fpeval{round(\fpeval{atand(#3/#4)})}}%
-    \fi
-    \fi
-  }{}
-}
+    \fi%
+    \fi%
+  }{}%
+}%
 
 \newcommand\Trigo[5][]{%
   \useKVdefault[ClesTrigo]%
@@ -5557,40 +5900,76 @@
   % #1 Clés
   % #2 Nom du triangle ABC, rectangle en B, angle connu ou pas : BAC
   % #3 Longueur
-  % #4 Longueur ou angle en fonction du calcul à faire. Si longueur, #3<#4
+  % #4 Longueur
+  % #5 angle
   % On définit les points
   \StrMid{#2}{1}{1}[\NomA]%
   \StrMid{#2}{2}{2}[\NomB]%
   \StrMid{#2}{3}{3}[\NomC]%
   % On rédige
-  \ifboolKV[ClesTrigo]{Figure}{%
-    \begin{multicols}{2}%
-      {\em La figure est donnée à titre indicatif.}%
-      \ifboolKV[ClesTrigo]{Angle}{%figure pour calculer un angle
+  \ifboolKV[ClesTrigo]{FigureSeule}{%
+    \ifx#5\bla\bla%
+    \ifboolKV[ClesTrigo]{Cosinus}{%
+      \MPFigTrigoAngle{\NomA}{\NomB}{\NomC}{}{#3}{#4}{\useKV[ClesTrigo]{Angle}}
+    }{}%
+    \ifboolKV[ClesTrigo]{Sinus}{%
+      \MPFigTrigoAngle{\NomA}{\NomB}{\NomC}{#3}{}{#4}{\useKV[ClesTrigo]{Angle}}
+    }{}%
+    \ifboolKV[ClesTrigo]{Tangente}{%
+      \MPFigTrigoAngle{\NomA}{\NomB}{\NomC}{#3}{#4}{}{\useKV[ClesTrigo]{Angle}}
+    }{}%
+    \else%}{%figure pour calculer une longueur
+    \ifboolKV[ClesTrigo]{Cosinus}{%
+      \ifx#3\bla\bla%adjacent inconnu
+      \MPFigTrigo{\NomA}{\NomB}{\NomC}{-1}{0}{#4}{#5}{\useKV[ClesTrigo]{Angle}}
+      \else
+      \MPFigTrigo{\NomA}{\NomB}{\NomC}{-1}{#3}{0}{#5}{\useKV[ClesTrigo]{Angle}}
+      \fi
+    }{}%
+    \ifboolKV[ClesTrigo]{Sinus}{%
+      \ifx#3\bla\bla%adjacent inconnu
+      \MPFigTrigo{\NomA}{\NomB}{\NomC}{0}{-1}{#4}{#5}{\useKV[ClesTrigo]{Angle}}
+      \else
+      \MPFigTrigo{\NomA}{\NomB}{\NomC}{#3}{-1}{0}{#5}{\useKV[ClesTrigo]{Angle}}
+      \fi
+    }{}%
+    \ifboolKV[ClesTrigo]{Tangente}{%
+      \ifx#3\bla\bla%adjacent inconnu
+      \MPFigTrigo{\NomA}{\NomB}{\NomC}{0}{#4}{-1}{#5}{\useKV[ClesTrigo]{Angle}}
+      \else%
+      \MPFigTrigo{\NomA}{\NomB}{\NomC}{#3}{0}{-1}{#5}{\useKV[ClesTrigo]{Angle}}
+      \fi%
+    }{}%
+    \fi%
+  }{%
+    \ifboolKV[ClesTrigo]{Figure}{%
+      \begin{multicols}{2}%
+        {\em La figure est donnée à titre indicatif.}%
+        \ifx#5\bla\bla%
         \ifboolKV[ClesTrigo]{Cosinus}{%
           \begin{center}
-            \MPFigTrigoAngle{\NomA}{\NomB}{\NomC}{}{#3}{#4}
+            \MPFigTrigoAngle{\NomA}{\NomB}{\NomC}{}{#3}{#4}{\useKV[ClesTrigo]{Angle}}
           \end{center}
         }{}%
         \ifboolKV[ClesTrigo]{Sinus}{%
           \begin{center}
-            \MPFigTrigoAngle{\NomA}{\NomB}{\NomC}{#3}{}{#4}
+            \MPFigTrigoAngle{\NomA}{\NomB}{\NomC}{#3}{}{#4}{\useKV[ClesTrigo]{Angle}}
           \end{center}
         }{}%
         \ifboolKV[ClesTrigo]{Tangente}{%
           \begin{center}
-            \MPFigTrigoAngle{\NomA}{\NomB}{\NomC}{#3}{#4}{}
+            \MPFigTrigoAngle{\NomA}{\NomB}{\NomC}{#3}{#4}{}{\useKV[ClesTrigo]{Angle}}
           \end{center}
         }{}%
-      }{%figure pour calculer une longueur
+        \else%}{%figure pour calculer une longueur
         \ifboolKV[ClesTrigo]{Cosinus}{%
           \ifx#3\bla\bla%adjacent inconnu
           \begin{center}
-            \MPFigTrigo{\NomA}{\NomB}{\NomC}{-1}{0}{#4}{#5}
+            \MPFigTrigo{\NomA}{\NomB}{\NomC}{-1}{0}{#4}{#5}{\useKV[ClesTrigo]{Angle}}
           \end{center}
           \else
           \begin{center}
-            \MPFigTrigo{\NomA}{\NomB}{\NomC}{-1}{#3}{0}{#5}
+            \MPFigTrigo{\NomA}{\NomB}{\NomC}{-1}{#3}{0}{#5}{\useKV[ClesTrigo]{Angle}}
           \end{center}
           \fi
         }{}%
@@ -5597,11 +5976,11 @@
         \ifboolKV[ClesTrigo]{Sinus}{%
           \ifx#3\bla\bla%adjacent inconnu
           \begin{center}
-            \MPFigTrigo{\NomA}{\NomB}{\NomC}{0}{-1}{#4}{#5}
+            \MPFigTrigo{\NomA}{\NomB}{\NomC}{0}{-1}{#4}{#5}{\useKV[ClesTrigo]{Angle}}
           \end{center}
           \else
           \begin{center}
-            \MPFigTrigo{\NomA}{\NomB}{\NomC}{#3}{-1}{0}{#5}
+            \MPFigTrigo{\NomA}{\NomB}{\NomC}{#3}{-1}{0}{#5}{\useKV[ClesTrigo]{Angle}}
           \end{center}
           \fi
         }{}%
@@ -5608,26 +5987,27 @@
         \ifboolKV[ClesTrigo]{Tangente}{%
           \ifx#3\bla\bla%adjacent inconnu
           \begin{center}
-            \MPFigTrigo{\NomA}{\NomB}{\NomC}{0}{#4}{-1}{#5}
+            \MPFigTrigo{\NomA}{\NomB}{\NomC}{0}{#4}{-1}{#5}{\useKV[ClesTrigo]{Angle}}
           \end{center}
           \else%
           \begin{center}
-            \MPFigTrigo{\NomA}{\NomB}{\NomC}{#3}{0}{-1}{#5}
+            \MPFigTrigo{\NomA}{\NomB}{\NomC}{#3}{0}{-1}{#5}{\useKV[ClesTrigo]{Angle}}
           \end{center}
           \fi%
         }{}%
-      }%
-      \par\columnbreak\par
-      \TrigoCalculs{#2}{#3}{#4}{#5}%
-    \end{multicols}
-  }{%
-    \TrigoCalculs{#2}{#3}{#4}{#5}%
+        \fi%
+        \par\columnbreak\par
+        \TrigoCalculs[#1]{#2}{#3}{#4}{#5}%
+      \end{multicols}
+    }{%
+      \TrigoCalculs[#1]{#2}{#3}{#4}{#5}%
+    }%
   }%
 }%
 
-%%%%%%%%%%%%%%%
-%% Statistiques
-%%%%%%%%%%%%%%%
+%%%
+% Statistiques
+%%%
 \newcommand\NbDonnees{}
 \newcommand\SommeDonnees{}%
 \newcommand\EffectifTotal{}%
@@ -5638,104 +6018,183 @@
 \newcommand\DonneeMin{}%
 \newcommand\EffectifMax{}%
 
-\setKVdefault[ClesStat]{Tableau=false,Frequence=false,EffectifTotal=false,Etendue=false,Moyenne=false,SET=false,Mediane=false,Total=false,Concret=false,Unite={},Largeur=1cm,Precision=2,Donnee=Valeurs,Effectif=Effectif(s),Origine=0,Angle=false,SemiAngle=false,Qualitatif=false,TableauVide=false,Graphique=false,Batons=true,Unitex=0.5,Unitey=0.5,Rayon=3cm,AffichageAngle=false,Liste=false,ECC=false,Coupure=10,ColorTab=gray!15}
+\setKVdefault[ClesStat]{ColVide=0,EffVide=false,%
+FreqVide=false,AngVide=false,ECCVide=false,TotalVide=false,Sondage=false,%
+Tableau=false,Stretch=1,Frequence=false,EffectifTotal=false,%
+Etendue=false,Moyenne=false,SET=false,Mediane=false,Total=false,Concret=false,%
+Unite={},Largeur=1cm,Precision=2,Donnee=Valeurs,Effectif=Effectif,Origine=0,Angle=false,SemiAngle=false,Qualitatif=false,TableauVide=false,Graphique=false,Batons=true,Unitex=0.5,Unitey=0.5,Rayon=3cm,AffichageAngle=false,Liste=false,ECC=false,Coupure=10,CouleurTab=gray!15,ListeCouleurs={white},Hachures=false,Inverse=false,AbscisseRotation=false}
 
 % La construction du tableau
 \def\addtotok#1#2{#1\expandafter{\the#1#2}}
 \newtoks\tabtoksa\newtoks\tabtoksb\newtoks\tabtoksc
-\def\updatetoks#1/#2\nil{\addtotok\tabtoksa{&\num{#1}}\addtotok\tabtoksb{&\num{#2}}}
-\def\buildtab{%
+\def\updatetoks#1/#2\nil{\addtotok\tabtoksa{\ifboolKV[ClesStat]{Qualitatif}{&#1}{&\num{#1}}}\addtotok\tabtoksb{&\num{#2}}}
+\def\buildtab{% %%Tableau sans total
   \tabtoksa{\useKV[ClesStat]{Donnee}}\tabtoksb{\useKV[ClesStat]{Effectif}}%
   \foreachitem\compteur\in\ListeComplete{\expandafter\updatetoks\compteur\nil}%
   \[%
-    \begin{tabular}{|>{\columncolor{\useKV[ClesStat]{ColorTab}}}c|*{\number\numexpr\ListeCompletelen}{>{\centering\arraybackslash}p{\useKV[ClesStat]{Largeur}}|}}%
+  %\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{\ListeComplete[##1,2]}%
+    \renewcommand{\arraystretch}{\useKV[ClesStat]{Stretch}}%
+    \begin{tabular}{|>{\columncolor{\useKV[ClesStat]{CouleurTab}}}c|*{\number\numexpr\ListeCompletelen}{>{\centering\arraybackslash}p{\useKV[ClesStat]{Largeur}}|}}%
     \hline%
-    \rowcolor{\useKV[ClesStat]{ColorTab}}\the\tabtoksa\\\hline%
-    \the\tabtoksb\\\hline%
-      \ifboolKV[ClesStat]{Frequence}{Fréquence (\%)\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\CalculFrequence{##1}}}\\\hline}{}%
-      \ifboolKV[ClesStat]{Angle}{Angle (\si{\degree})\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\CalculAngle{##1}}}\\\hline}{}%
-      \ifboolKV[ClesStat]{SemiAngle}{Angle (\si{\degree})\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\CalculSemiAngle{##1}}\\\hline}{}%
-      \ifboolKV[ClesStat]{ECC}{E.C.C.\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\CalculECC{##1}}}\\\hline}{}%
-    \end{tabular}
+    \rowcolor{\useKV[ClesStat]{CouleurTab}}\the\tabtoksa\\\hline%
+	\ifnum\number\numexpr\useKV[ClesStat]{ColVide}<1%
+    \ifboolKV[ClesStat]{EffVide}{\useKV[ClesStat]{Effectif}\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&}}{\the\tabtoksb}\\\hline% 
+	\ifboolKV[ClesStat]{Frequence}{Fréquence (\%)\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{\CalculFrequence{##1}}}}\\\hline}{}%
+	\ifboolKV[ClesStat]{Angle}{Angle (\si{\degree})\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculAngle{##1}}}}\\\hline}{}%
+	\ifboolKV[ClesStat]{SemiAngle}{Angle (\si{\degree})\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculSemiAngle{##1}}}}\\\hline}{}%
+     \ifboolKV[ClesStat]{ECC}{E.C.C.\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{ECCVide}{}{\CalculECC{##1}}}}\\\hline}{}%
+	\end{tabular}
+	\else%
+	\ifnum\number\numexpr\useKV[ClesStat]{ColVide}>\ListeCompletelen%
+    \ifboolKV[ClesStat]{EffVide}{\useKV[ClesStat]{Effectif}\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&}}{\the\tabtoksb}\\\hline%  
+	\ifboolKV[ClesStat]{Frequence}{Fréquence (\%)\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{\CalculFrequence{##1}}}}\\\hline}{}%
+	\ifboolKV[ClesStat]{Angle}{Angle (\si{\degree})\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculAngle{##1}}}}\\\hline}{}%
+	\ifboolKV[ClesStat]{SemiAngle}{Angle (\si{\degree})\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculSemiAngle{##1}}}}\\\hline}{}%
+     \ifboolKV[ClesStat]{ECC}{E.C.C.\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{ECCVide}{}{\CalculECC{##1}}}}\\\hline}{}%
+	\end{tabular}
+	\else%
+	\ifnum\number\numexpr\useKV[ClesStat]{ColVide}=1%
+    \ifboolKV[ClesStat]{EffVide}{\useKV[ClesStat]{Effectif}\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&}}{\useKV[ClesStat]{Effectif}&\xintFor* ##1 in {\xintSeq {2}{\ListeCompletelen}}\do{&\ListeComplete[##1,2]}}\\\hline%  
+	\ifboolKV[ClesStat]{Frequence}{Fréquence (\%)&\xintFor* ##1 in {\xintSeq {2}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{\CalculFrequence{##1}}}}\\\hline}{}%
+	\ifboolKV[ClesStat]{Angle}{Angle (\si{\degree})&\xintFor* ##1 in {\xintSeq {2}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculAngle{##1}}}}\\\hline}{}%
+	\ifboolKV[ClesStat]{SemiAngle}{Angle (\si{\degree})&\xintFor* ##1 in {\xintSeq {2}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculSemiAngle{##1}}}}\\\hline}{}%
+     \ifboolKV[ClesStat]{ECC}{E.C.C.&\xintFor* ##1 in {\xintSeq {2}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{ECCVide}{}{\CalculECC{##1}}}}\\\hline}{}%
+	\end{tabular}
+    \else%
+	\ifnum\number\numexpr\useKV[ClesStat]{ColVide}=\ListeCompletelen%
+    \ifboolKV[ClesStat]{EffVide}{\useKV[ClesStat]{Effectif}\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&}}{\useKV[ClesStat]{Effectif}\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen-1}}\do{&\ListeComplete[##1,2]}}&\\\hline%  
+	\ifboolKV[ClesStat]{Frequence}{Fréquence (\%)\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen-1}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{\CalculFrequence{##1}}}}&\\\hline}{}%
+	\ifboolKV[ClesStat]{Angle}{Angle (\si{\degree})\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen-1}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculAngle{##1}}}}&\\\hline}{}%
+	\ifboolKV[ClesStat]{SemiAngle}{Angle (\si{\degree})\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen-1}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculSemiAngle{##1}}}}&\\\hline}{}%
+     \ifboolKV[ClesStat]{ECC}{E.C.C.\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen-1}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{ECCVide}{}{\CalculECC{##1}}}}&\\\hline}{}%
+	\end{tabular}
+	\else%
+    \ifboolKV[ClesStat]{EffVide}{\useKV[ClesStat]{Effectif}\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&}}{\useKV[ClesStat]{Effectif}\xintFor* ##1 in {\xintSeq {1}{\number\numexpr\useKV[ClesStat]{ColVide}-1}}\do{&\ListeComplete[##1,2]}&\xintFor* ##1 in {\xintSeq {\number\numexpr\useKV[ClesStat]{ColVide}+1}{\ListeCompletelen}}\do{&\ListeComplete[##1,2]}}\\\hline%  
+	\ifboolKV[ClesStat]{Frequence}{Fréquence (\%)\xintFor* ##1 in {\xintSeq {1}{\number\numexpr\useKV[ClesStat]{ColVide}-1}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{\CalculFrequence{##1}}}}&\xintFor* ##1 in {\xintSeq {\number\numexpr\useKV[ClesStat]{ColVide}+1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{\CalculFrequence{##1}}}}\\\hline}{}%
+	\ifboolKV[ClesStat]{Angle}{Angle (\si{\degree})\xintFor* ##1 in {\xintSeq {1}{\number\numexpr\useKV[ClesStat]{ColVide}-1}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculAngle{##1}}}}&\xintFor* ##1 in {\xintSeq {\number\numexpr\useKV[ClesStat]{ColVide}+1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{\CalculAngle{##1}}}}\\\hline}{}%
+	\ifboolKV[ClesStat]{SemiAngle}{Angle (\si{\degree})\xintFor* ##1 in {\xintSeq {1}{\number\numexpr\useKV[ClesStat]{ColVide}-1}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculSemiAngle{##1}}}}&\xintFor* ##1 in {\xintSeq {\number\numexpr\useKV[ClesStat]{ColVide}+1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{\CalculSemiAngle{##1}}}}\\\hline}{}%
+	\ifboolKV[ClesStat]{ECC}{E.C.C.\xintFor* ##1 in {\xintSeq {1}{\number\numexpr\useKV[ClesStat]{ColVide}-1}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{ECCVide}{}{\CalculECC{##1}}}}&\xintFor* ##1 in {\xintSeq {\number\numexpr\useKV[ClesStat]{ColVide}+1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{ECCVide}{}{\CalculECC{##1}}}}\\\hline}{}%
+	\end{tabular}
+    \fi%
+	\fi%
+	\fi%
+	\fi%  
+    \renewcommand{\arraystretch}{1}%
   \]
 }
 
-\def\buildtabt{%
+\def\buildtabt{% %%Tableau avec total
   \tabtoksa{\useKV[ClesStat]{Donnee}}\tabtoksb{\useKV[ClesStat]{Effectif}}%
   \foreachitem\compteur\in\ListeComplete{\expandafter\updatetoks\compteur\nil}%
-  \[%
-    \begin{tabular}{|>{\columncolor{\useKV[ClesStat]{ColorTab}}}c|*{\number\numexpr\ListeCompletelen+1}{>{\centering\arraybackslash}p{\useKV[ClesStat]{Largeur}}|}}%
+  \[%	
+    \renewcommand{\arraystretch}{\useKV[ClesStat]{Stretch}}%
+    \begin{tabular}{|>{\columncolor{\useKV[ClesStat]{CouleurTab}}}c|*{\number\numexpr\ListeCompletelen+1}{>{\centering\arraybackslash}p{\useKV[ClesStat]{Largeur}}|}}%
     \hline%
-    \rowcolor{\useKV[ClesStat]{ColorTab}}\the\tabtoksa&Total\\\hline%
-      \the\tabtoksb&\ifboolKV[ClesStat]{TableauVide}{}{\num{\EffectifTotal}}%
-      \\\hline%
-      \ifboolKV[ClesStat]{Frequence}{Fréquence (\%)\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\CalculFrequence{##1}}}&\ifboolKV[ClesStat]{TableauVide}{}{100}\\\hline}{}%
-      \ifboolKV[ClesStat]{Angle}{Angle (\si{\degree})\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\CalculAngle{##1}}}&\ifboolKV[ClesStat]{TableauVide}{}{360}\\\hline}{}%
-      \ifboolKV[ClesStat]{SemiAngle}{Angle (\si{\degree})\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\CalculSemiAngle{##1}}}&\ifboolKV[ClesStat]{TableauVide}{}{180}\\\hline}{}%
-      \ifboolKV[ClesStat]{ECC}{E.C.C.\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\CalculECC{##1}}}&\ifboolKV[ClesStat]{TableauVide}{}{\num{\EffectifTotal}}\\\hline}{}%
+    \rowcolor{\useKV[ClesStat]{CouleurTab}}\the\tabtoksa&Total\\\hline%
+	\ifnum\number\numexpr\useKV[ClesStat]{ColVide}<1%
+     \ifboolKV[ClesStat]{EffVide}{\useKV[ClesStat]{Effectif}\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen+1}}\do{&}}{\the\tabtoksb&\ifboolKV[ClesStat]{TotalVide}{}{\num{\EffectifTotal}}}\\\hline%
+	\ifboolKV[ClesStat]{Frequence}{Fréquence (\%)\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{\CalculFrequence{##1}}}}&\ifboolKV[ClesStat]{TotalVide}{}{\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{100}}}\\\hline}{}%
+	\ifboolKV[ClesStat]{Angle}{Angle (\si{\degree})\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculAngle{##1}}}}&\ifboolKV[ClesStat]{TotalVide}{}{\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{360}}}\\\hline}{}%
+      \ifboolKV[ClesStat]{SemiAngle}{Angle (\si{\degree})\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculSemiAngle{##1}}}}&\ifboolKV[ClesStat]{TotalVide}{}{\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{180}}}\\\hline}{}%
+      \ifboolKV[ClesStat]{ECC}{E.C.C.\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{ECCVide}{}{\CalculECC{##1}}}}&\ifboolKV[ClesStat]{TotalVide}{}{\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{ECCVide}{}{\num{\EffectifTotal}}}}\\\hline}{}%
     \end{tabular}
-  \]
-}
-
-\def\updatetoksq#1/#2\nil{\addtotok\tabtoksa{&#1}\addtotok\tabtoksb{&\num{#2}}}
-\def\buildtabq{%
-  \tabtoksa{\useKV[ClesStat]{Donnee}}\tabtoksb{\useKV[ClesStat]{Effectif}}%
-  \foreachitem\compteur\in\ListeComplete{\expandafter\updatetoksq\compteur\nil}%
-  \[%
-    \begin{tabular}{|>{\columncolor{\useKV[ClesStat]{ColorTab}}}c|*{\number\numexpr\ListeCompletelen}{>{\centering\arraybackslash}p{\useKV[ClesStat]{Largeur}}|}}%
-    \hline%
-    \rowcolor{\useKV[ClesStat]{ColorTab}}\the\tabtoksa\\\hline%
-    \the\tabtoksb\\\hline%
-      \ifboolKV[ClesStat]{Frequence}{Fréquence (\%)\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\CalculFrequence{##1}}}\\\hline}{}%
-      \ifboolKV[ClesStat]{Angle}{Angle (\si{\degree})\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\CalculAngle{##1}}}\\\hline}{}%
-      \ifboolKV[ClesStat]{SemiAngle}{Angle (\si{\degree})\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\CalculSemiAngle{##1}}}\\\hline}{}%
-      \ifboolKV[ClesStat]{ECC}{E.C.C.\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\CalculECC{##1}}}\\\hline}{}%
+	\else%
+	\ifnum\number\numexpr\useKV[ClesStat]{ColVide}>\ListeCompletelen%
+     \ifboolKV[ClesStat]{EffVide}{\useKV[ClesStat]{Effectif}\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen+1}}\do{&}}{\the\tabtoksb&\ifboolKV[ClesStat]{TotalVide}{}{\num{\EffectifTotal}}}\\\hline%
+	\ifboolKV[ClesStat]{Frequence}{Fréquence (\%)\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{\CalculFrequence{##1}}}}&\ifboolKV[ClesStat]{TotalVide}{}{\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{100}}}\\\hline}{}%
+	\ifboolKV[ClesStat]{Angle}{Angle (\si{\degree})\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculAngle{##1}}}}&\ifboolKV[ClesStat]{TotalVide}{}{\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{360}}}\\\hline}{}%
+      \ifboolKV[ClesStat]{SemiAngle}{Angle (\si{\degree})\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculSemiAngle{##1}}}}&\ifboolKV[ClesStat]{TotalVide}{}{\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{180}}}\\\hline}{}%
+      \ifboolKV[ClesStat]{ECC}{E.C.C.\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{ECCVide}{}{\CalculECC{##1}}}}&\ifboolKV[ClesStat]{TotalVide}{}{\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{ECCVide}{}{\num{\EffectifTotal}}}}\\\hline}{}%
     \end{tabular}
-  \]
-}
-
-\def\buildtabqt{%
-  \tabtoksa{\useKV[ClesStat]{Donnee}}\tabtoksb{\useKV[ClesStat]{Effectif}}%
-  \foreachitem\compteur\in\ListeComplete{\expandafter\updatetoksq\compteur\nil}%
-  \[%
-    \begin{tabular}{|>{\columncolor{\useKV[ClesStat]{ColorTab}}}c|*{\number\numexpr\ListeCompletelen+1}{>{\centering\arraybackslash}p{\useKV[ClesStat]{Largeur}}|}}%
-    \hline%
-    \rowcolor{\useKV[ClesStat]{ColorTab}}\the\tabtoksa&Total\\\hline%
-    \the\tabtoksb&\num{\EffectifTotal}\\\hline%
-      \ifboolKV[ClesStat]{Frequence}{Fréquence (\%)\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\CalculFrequence{##1}}}&\ifboolKV[ClesStat]{TableauVide}{}{100}\\\hline}{}%
-      \ifboolKV[ClesStat]{Angle}{Angle (\si{\degree})\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\CalculAngle{##1}}}&\ifboolKV[ClesStat]{TableauVide}{}{360}\\\hline}{}%
-      \ifboolKV[ClesStat]{SemiAngle}{Angle (\si{\degree})\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\CalculSemiAngle{##1}}}&\ifboolKV[ClesStat]{TableauVide}{}{180}\\\hline}{}%
-      \ifboolKV[ClesStat]{ECC}{E.C.C.\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\CalculECC{##1}}}&\ifboolKV[ClesStat]{TableauVide}{}{\num{\EffectifTotal}}\\\hline}{}%
+	\else%
+	\ifnum\number\numexpr\useKV[ClesStat]{ColVide}=1%
+    \ifboolKV[ClesStat]{EffVide}{\useKV[ClesStat]{Effectif}\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen+1}}\do{&}}{\useKV[ClesStat]{Effectif}&\xintFor* ##1 in {\xintSeq {2}{\ListeCompletelen}}\do{&\ListeComplete[##1,2]}&\ifboolKV[ClesStat]{TotalVide}{}{\num{\EffectifTotal}}}\\\hline%  
+	\ifboolKV[ClesStat]{Frequence}{Fréquence (\%)&\xintFor* ##1 in {\xintSeq {2}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{\CalculFrequence{##1}}}}&\ifboolKV[ClesStat]{TotalVide}{}{\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{100}}}\\\hline}{}%
+	\ifboolKV[ClesStat]{Angle}{Angle (\si{\degree})&\xintFor* ##1 in {\xintSeq {2}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculAngle{##1}}}}&\ifboolKV[ClesStat]{TotalVide}{}{\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{360}}}\\\hline}{}%
+      \ifboolKV[ClesStat]{SemiAngle}{Angle (\si{\degree})&\xintFor* ##1 in {\xintSeq {2}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculSemiAngle{##1}}}}&\ifboolKV[ClesStat]{TotalVide}{}{\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{180}}}\\\hline}{}%
+      \ifboolKV[ClesStat]{ECC}{E.C.C.&\xintFor* ##1 in {\xintSeq {2}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{ECCVide}{}{\CalculECC{##1}}}}&\ifboolKV[ClesStat]{TotalVide}{}{\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{ECCVide}{}{\num{\EffectifTotal}}}}\\\hline}{}%
     \end{tabular}
+    \else%
+	\ifnum\number\numexpr\useKV[ClesStat]{ColVide}=\ListeCompletelen%
+    \ifboolKV[ClesStat]{EffVide}{\useKV[ClesStat]{Effectif}\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen+1}}\do{&}}{\useKV[ClesStat]{Effectif}\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen-1}}\do{&\ListeComplete[##1,2]}&&\ifboolKV[ClesStat]{TotalVide}{}{\num{\EffectifTotal}}}\\\hline%  
+	\ifboolKV[ClesStat]{Frequence}{Fréquence (\%)\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen-1}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{\CalculFrequence{##1}}}}&&\ifboolKV[ClesStat]{TotalVide}{}{\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{100}}}\\\hline}{}%
+	\ifboolKV[ClesStat]{Angle}{Angle (\si{\degree})\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen-1}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculAngle{##1}}}}&&\ifboolKV[ClesStat]{TotalVide}{}{\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{360}}}\\\hline}{}%
+      \ifboolKV[ClesStat]{SemiAngle}{Angle (\si{\degree})\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen-1}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculSemiAngle{##1}}}}&&\ifboolKV[ClesStat]{TotalVide}{}{\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{180}}}\\\hline}{}%
+      \ifboolKV[ClesStat]{ECC}{E.C.C.\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen-1}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{ECCVide}{}{\CalculECC{##1}}}}&&\ifboolKV[ClesStat]{TotalVide}{}{\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{ECCVide}{}{\num{\EffectifTotal}}}}\\\hline}{}%
+    \end{tabular}
+	\else%
+    \ifboolKV[ClesStat]{EffVide}{\useKV[ClesStat]{Effectif}\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen+1}}\do{&}}{\useKV[ClesStat]{Effectif}\xintFor* ##1 in {\xintSeq {1}{\number\numexpr\useKV[ClesStat]{ColVide}-1}}\do{&\ListeComplete[##1,2]}&\xintFor* ##1 in {\xintSeq {\number\numexpr\useKV[ClesStat]{ColVide}+1}{\ListeCompletelen}}\do{&\ListeComplete[##1,2]}&\ifboolKV[ClesStat]{TotalVide}{}{\num{\EffectifTotal}}}\\\hline% 
+	\ifboolKV[ClesStat]{Frequence}{Fréquence (\%)\xintFor* ##1 in {\xintSeq {1}{\number\numexpr\useKV[ClesStat]{ColVide}-1}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{\CalculFrequence{##1}}}}&\xintFor* ##1 in {\xintSeq {\number\numexpr\useKV[ClesStat]{ColVide}+1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{\CalculFrequence{##1}}}}&\ifboolKV[ClesStat]{TotalVide}{}{\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{100}}}\\\hline}{}%
+	\ifboolKV[ClesStat]{Angle}{Angle (\si{\degree})\xintFor* ##1 in {\xintSeq {1}{\number\numexpr\useKV[ClesStat]{ColVide}-1}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculAngle{##1}}}}&\xintFor* ##1 in {\xintSeq {\number\numexpr\useKV[ClesStat]{ColVide}+1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculAngle{##1}}}}&\ifboolKV[ClesStat]{TotalVide}{}{\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{360}}}\\\hline}{}%
+      \ifboolKV[ClesStat]{SemiAngle}{Angle (\si{\degree})\xintFor* ##1 in {\xintSeq {1}{\number\numexpr\useKV[ClesStat]{ColVide}-1}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculSemiAngle{##1}}}}&\xintFor* ##1 in {\xintSeq {\number\numexpr\useKV[ClesStat]{ColVide}+1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculSemiAngle{##1}}}}&\ifboolKV[ClesStat]{TotalVide}{}{\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{180}}}\\\hline}{}%
+      \ifboolKV[ClesStat]{ECC}{E.C.C.\xintFor* ##1 in {\xintSeq {1}{\number\numexpr\useKV[ClesStat]{ColVide}-1}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{ECCVide}{}{\CalculECC{##1}}}}&\xintFor* ##1 in {\xintSeq {\number\numexpr\useKV[ClesStat]{ColVide}+1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{ECCVide}{}{\CalculECC{##1}}}}&\ifboolKV[ClesStat]{TotalVide}{}{\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{ECCVide}{}{\num{\EffectifTotal}}}}\\\hline}{}%
+    \end{tabular}
+    \fi%
+	\fi%
+	\fi%
+	\fi%  
+    \renewcommand{\arraystretch}{1}%
   \]
 }
 
 % Pour construire le diagramme en bâtons
 \def\Updatetoks#1/#2\nil{\addtotok\toklistepoint{(#1,#2),}}
-\def\buildgraph{%
-  \newtoks\toklistepoint
+\newcommand\buildgraph[1][]{%
+  \newtoks\toklistepoint 
   \foreachitem\compteur\in\ListeComplete{\expandafter\Updatetoks\compteur\nil}%
-  \[\MPStat{\useKV[ClesStat]{Unitex}}{\useKV[ClesStat]{Unitey}}{\the\toklistepoint}{\useKV[ClesStat]{Donnee}}{\useKV[ClesStat]{Effectif}}{\useKV[ClesStat]{Origine}}\]%
+   \[\MPStat[#1]{\useKV[ClesStat]{Unitex}}{\useKV[ClesStat]{Unitey}}{\the\toklistepoint}{\useKV[ClesStat]{Donnee}}{\useKV[ClesStat]{Effectif}}{\useKV[ClesStat]{Origine}}{\useKV[ClesStat]{AbscisseRotation}}\]%
 }%
 
 % Pour construire le diagramme en bâtons qualitatif
 \def\Updatetoksq#1/#2\nil{\addtotok\toklistepointq{"#1",#2,}}
-\def\buildgraphq{%
+\newcommand\buildgraphq[1][]{%
   \newtoks\toklistepointq
-  \toklistepointq{}
   \foreachitem\compteur\in\ListeComplete{\expandafter\Updatetoksq\compteur\nil}  
-  \[\MPStatQ{2*\useKV[ClesStat]{Unitex}}{0.5*\useKV[ClesStat]{Unitey}}{\the\toklistepointq}{\useKV[ClesStat]{Donnee}}{\useKV[ClesStat]{Effectif}}{\useKV[ClesStat]{Origine}}\]
+  \[\MPStatQ[#1]{2*\useKV[ClesStat]{Unitex}}{0.5*\useKV[ClesStat]{Unitey}}{\the\toklistepointq}{\useKV[ClesStat]{Donnee}}{\useKV[ClesStat]{Effectif}}{\useKV[ClesStat]{Origine}}{\useKV[ClesStat]{AbscisseRotation}}\]
 }
 
+
+\def\UpdateCoul#1\nil{\addtotok\toklistecouleur{#1,}}%
+
 % Pour construire le diagramme circulaire qualitatif
 \def\buildgraphcq#1{%
   \newtoks\toklistepointq%
   \toklistepointq{}%
+  \newtoks\toklistecouleur%
+  \toklistecouleur{}%
+  %
   \foreachitem\compteur\in\ListeComplete{\expandafter\Updatetoksq\compteur\nil}%
+  \xdef\ListeAvantCouleurs{\useKV[ClesStat]{ListeCouleurs}}%
+  \readlist*\ListeCouleur{\ListeAvantCouleurs}%
+  \foreachitem\couleur\in\ListeCouleur{\expandafter\UpdateCoul\couleur\nil}%
   \ifboolKV[ClesStat]{AffichageAngle}{%
-    \[\MPStatCirculaireQ{\useKV[ClesStat]{Rayon}}{\the\toklistepointq}{#1}{1}\]%
+    \ifboolKV[ClesStat]{Hachures}{%
+      \ifboolKV[ClesStat]{Inverse}{%
+        \[\MPStatCirculaireQ{\useKV[ClesStat]{Rayon}}{\the\toklistepointq}{#1}{1}{\the\toklistecouleur}{1}{1}\]%
   }{%
-    \[\MPStatCirculaireQ{\useKV[ClesStat]{Rayon}}{\the\toklistepointq}{#1}{0}\]%
+        \[\MPStatCirculaireQ{\useKV[ClesStat]{Rayon}}{\the\toklistepointq}{#1}{1}{\the\toklistecouleur}{1}{0}\]%
+      }%
+    }{%
+      \ifboolKV[ClesStat]{Inverse}{%
+        \[\MPStatCirculaireQ{\useKV[ClesStat]{Rayon}}{\the\toklistepointq}{#1}{1}{\the\toklistecouleur}{0}{1}\]%
+      }{%
+        \[\MPStatCirculaireQ{\useKV[ClesStat]{Rayon}}{\the\toklistepointq}{#1}{1}{\the\toklistecouleur}{0}{0}\]%
+      }%
+    }%
+  }{%
+    \ifboolKV[ClesStat]{Hachures}{%
+      \ifboolKV[ClesStat]{Inverse}{%
+        \[\MPStatCirculaireQ{\useKV[ClesStat]{Rayon}}{\the\toklistepointq}{#1}{0}{\the\toklistecouleur}{1}{1}\]%
+      }{%
+        \[\MPStatCirculaireQ{\useKV[ClesStat]{Rayon}}{\the\toklistepointq}{#1}{0}{\the\toklistecouleur}{1}{0}\]%
+      }%
+    }{%
+      \ifboolKV[ClesStat]{Inverse}{%
+        \[\MPStatCirculaireQ{\useKV[ClesStat]{Rayon}}{\the\toklistepointq}{#1}{0}{\the\toklistecouleur}{0}{1}\]%
+      }{%
+        \[\MPStatCirculaireQ{\useKV[ClesStat]{Rayon}}{\the\toklistepointq}{#1}{0}{\the\toklistecouleur}{0}{0}\]%
+      }%
+    }%
   }%
 }%
 
@@ -5767,15 +6226,15 @@
   \num{\TotalECC}%
 }
 
-% la construction du graphique
-\def\MPStat#1#2#3#4#5#6{%
+% la construction du graphique en bâtons pour quantitatif
+\newcommand\MPStat[8][]{%
   \ifluatex
    \mplibforcehmode
   \begin{mplibcode}
     maxx:=0;
     maxy:=0;
-    unitex:=#1*cm;
-    unitey:=#2*cm;
+    unitex:=#2*cm;
+    unitey:=#3*cm;
     pair A[],B[],P[];
     n:=0;
     vardef toto(text t)=
@@ -5782,21 +6241,25 @@
     for p_=t:
     if pair p_:
     n:=n+1;
-    P[n]=((xpart(p_)-(#6))*unitex,ypart(p_)*unitey);
+    P[n]=((xpart(p_)-(#7))*unitex,ypart(p_)*unitey);
     if xpart(p_)>maxx:
-    maxx:=xpart(p_)-(#6);
+    maxx:=xpart(p_)-(#7);
     fi;
     if ypart(p_)>maxy:
     maxy:=ypart(p_);
     fi;
-    A[n]=unitex*(xpart(p_)-(#6),0);
+    A[n]=unitex*(xpart(p_)-(#7),0);
     B[n]=unitey*(0,ypart(p_));
+    if (#8):
+    label.bot(TEX("\num{"&decimal(xpart(p_))&"}") rotated 90,A[n]);
+    else :
     label.bot(TEX("\num{"&decimal(xpart(p_))&"}"),A[n]);
+    fi;
     label.lft(TEX("\num{"&decimal(ypart(p_))&"}"),B[n]);
     fi;
     endfor;
     enddef;
-    toto(#3);
+    toto(#4);
     for k=1 upto n:
     draw A[k]--P[k] withpen pencircle scaled 2bp;
     draw B[k]--P[k] dashed evenly;
@@ -5803,15 +6266,18 @@
     endfor;
     drawarrow (0,0)--unitex*(maxx+1,0);
     drawarrow (0,0)--unitey*(0,maxy+1);
-    label.lrt(btex #4 etex,unitex*(maxx+1,0));
-    label.urt(btex #5 etex,unitey*(0,maxy+1));
+    label.lrt(btex #5 etex,unitex*(maxx+1,0));
+    label.urt(btex #6 etex,unitey*(0,maxy+1));
   \end{mplibcode}
   \else
+  \mpxcommands{%
+    \setKV[ClesStat]{#1}%
+  }
   \begin{mpost}
     maxx:=0;
     maxy:=0;
-    unitex:=#1*cm;
-    unitey:=#2*cm;
+    unitex:=#2*cm;
+    unitey:=#3*cm;
     pair A[],B[],P[];
     n:=0;
     vardef toto(text t)=
@@ -5818,21 +6284,25 @@
     for p_=t:
     if pair p_:
     n:=n+1;
-    P[n]=((xpart(p_)-(#6))*unitex,ypart(p_)*unitey);
+    P[n]=((xpart(p_)-(#7))*unitex,ypart(p_)*unitey);
     if xpart(p_)>maxx:
-    maxx:=xpart(p_)-(#6);
+    maxx:=xpart(p_)-(#7);
     fi;
     if ypart(p_)>maxy:
     maxy:=ypart(p_);
     fi;
-    A[n]=unitex*(xpart(p_)-(#6),0);
+    A[n]=unitex*(xpart(p_)-(#7),0);
     B[n]=unitey*(0,ypart(p_));
+    if (#8):
+    label.bot(LATEX("\num{"&decimal(xpart(p_))&"}") rotated 90,A[n]);
+    else :
     label.bot(LATEX("\num{"&decimal(xpart(p_))&"}"),A[n]);
+    fi;
     label.lft(LATEX("\num{"&decimal(ypart(p_))&"}"),B[n]);
     fi;
     endfor;
     enddef;
-    toto(#3);
+    toto(#4);
     for k=1 upto n:
     draw A[k]--P[k] withpen pencircle scaled 2bp;
     draw B[k]--P[k] dashed evenly;
@@ -5839,20 +6309,20 @@
     endfor;
     drawarrow (0,0)--unitex*(maxx+1,0);
     drawarrow (0,0)--unitey*(0,maxy+1);
-    label.lrt(btex #4 etex,unitex*(maxx+1,0));
-    label.urt(btex #5 etex,unitey*(0,maxy+1));
+    label.lrt(\btex \useKV[ClesStat]{Donnee} etex,unitex*(maxx+1,0));
+    label.urt(\btex \useKV[ClesStat]{Effectif} etex,unitey*(0,maxy+1));
   \end{mpost}
   \fi
 }
 
-% la construction du graphique qualitatif
-\def\MPStatQ#1#2#3#4#5#6{%
+% la construction du graphique en bâtons pour qualitatif
+\newcommand\MPStatQ[8][]{%
   \ifluatex
    \mplibforcehmode
   \begin{mplibcode}
     maxy:=0;
-    unitex:=#1*cm;
-    unitey:=#2*cm;
+    unitex:=#2*cm;
+    unitey:=#3*cm;
     pair A[],B[],P[];
     n:=0;
     vardef toto(text t)=
@@ -5867,11 +6337,15 @@
     n:=n+1;
     else:
     A[n]=unitex*(n+1,0);
+    if (#8):
     label.bot(TEX(p_) rotated 90,A[n]);
+    else :
+    label.bot(TEX(p_),A[n]);
     fi;
+    fi;
     endfor;
     enddef;
-    toto(#3);
+    toto(#4);
     for k=0 upto n-1:
     draw A[k]--P[k] withpen pencircle scaled 2bp;
     draw B[k]--P[k] dashed evenly;
@@ -5878,14 +6352,17 @@
     endfor;
     drawarrow (0,0)--unitex*(n+1,0);
     drawarrow (0,0)--unitey*(0,maxy+1);
-    label.lrt(btex #4 etex,unitex*(n+1,0));
-    label.urt(btex #5 etex,unitey*(0,maxy+1));
+    label.lrt(btex #5 etex,unitex*(n+1,0));
+    label.urt(btex #6 etex,unitey*(0,maxy+1));
     \end{mplibcode}
   \else
+    \mpxcommands{%
+      \setKV[ClesStat]{#1}%
+    }    
   \begin{mpost}
     maxy:=0;
-    unitex:=#1*cm;
-    unitey:=#2*cm;
+    unitex:=#2*cm;
+    unitey:=#3*cm;
     pair A[],B[],P[];
     n:=0;
     vardef toto(text t)=
@@ -5900,11 +6377,15 @@
     n:=n+1;
     else:
     A[n]=unitex*(n+1,0);
+    if (#8):
     label.bot(LATEX(p_) rotated 90,A[n]);
+    else :
+    label.bot(LATEX(p_),A[n]);
     fi;
+    fi;
     endfor;
     enddef;
-    toto(#3);
+    toto(#4);
     for k=0 upto n-1:
     draw A[k]--P[k] withpen pencircle scaled 2bp;
     draw B[k]--P[k] dashed evenly;
@@ -5911,14 +6392,14 @@
     endfor;
     drawarrow (0,0)--unitex*(n+1,0);
     drawarrow (0,0)--unitey*(0,maxy+1);
-    label.lrt(btex #4 etex,unitex*(n+1,0));
-    label.urt(btex #5 etex,unitey*(0,maxy+1));
+    label.lrt(\btex \useKV[ClesStat]{Donnee} etex,unitex*(n+1,0));
+    label.urt(\btex \useKV[ClesStat]{Effectif} etex,unitey*(0,maxy+1));
   \end{mpost}
   \fi
 }
 
 % la construction du graphique qualitatif
-\def\MPStatCirculaireQ#1#2#3#4{%
+\def\MPStatCirculaireQ#1#2#3#4#5#6#7{%
   \ifluatex
    \mplibforcehmode
   \begin{mplibcode}
@@ -5930,13 +6411,20 @@
     ang[0]:=0;
     path cc;
     cc=(fullcircle scaled (2*#1));
-    if #3=360:
-    draw cc;
+    % on récupère les couleurs
+    color Col[];
+    n:=0;
+    for p_=#5:
+    n:=n+1;
+    Col[n]=p_;
+    endfor;
+    if #7=0:
+    A[0]=point(0) of cc;
     else:
-    draw (subpath(0,length cc/2) of cc)--cycle;
+    A[0]=point(180) of cc;
     fi;
-    A[0]=point(0) of cc;
     vardef toto(text t)=
+    n:=0;
     for p_=t:
     if numeric p_:
     n:=n+1;
@@ -5951,28 +6439,65 @@
     for p_=t:
     if numeric p_:
     n:=n+1;
+    if #7=0:
     A[n]=A[n-1] rotatedabout(O,p_*(#3/total[N]));
-    draw A[n-1]--O--A[n];
+    else:
+    A[n]=A[n-1] rotatedabout(O,-p_*(#3/total[N]));
+    fi;
+    %hachure ou pas ?
+    if #6=0:
+    fill (O--if #7=0:arccercle(A[n-1],A[n],O) else:
+    arccercle(A[n],A[n-1],O) fi--cycle) withcolor if unknown Col[n]: white else:Col[n] fi;
+    else:
+    draw
+    hachurage((O--if #7=0:arccercle(A[n-1],A[n],O)
+    else:arccercle(A[n],A[n-1],O) fi--cycle),p_*(#3/total[N]) if
+    (n mod 2)=0: +90 else: -90 fi,0.25,if (n mod 2)=0 : 0 else: 1 fi)
+    if #4=1: withcolor 0.5white fi;
+    fi;
+    draw A[n-1]--O--A[n] if #6=1: withpen pencircle scaled2 fi;
     % Affichage des angles associés
     if #4=1:
     if round(p_*(#3/total[N]))>15:
     if (n mod 2)=0:
-    marque_a:=0.9*20
+    marque_a:=3.1*20
     else:
-    marque_a:=1.1*20/0.9
+    marque_a:=3.1*20/0.9
     fi;
-    draw Codeangle(A[n-1],O,A[n],0,(((TEX("\ang{"&decimal(round(p_*(#3/total[N])))&"}")) scaled 0.5)));
+    if #6=1:
+    if #7=0:
+    undraw
+    Codeangle(A[n-1],O,A[n],0,(((TEX("\ang{"&decimal(round(p_*(#3/total[N])))&"}")))));
+    else:
+    undraw
+    Codeangle(A[n],O,A[n-1],0,(((TEX("\ang{"&decimal(round(p_*(#3/total[N])))&"}")))));
     fi;
+    fill cercles(w shifted(marque_ang*unitvector(w-O)),3mm) withcolor
+    blanc;
     fi;
+    if #7=0:
+    draw
+    Codeangle(A[n-1],O,A[n],0,(((TEX("\ang{"&decimal(round(p_*(#3/total[N])))&"}")))));
+    else:
+    draw
+    Codeangle(A[n],O,A[n-1],0,(((TEX("\ang{"&decimal(round(p_*(#3/total[N])))&"}")))));
+    fi;
+    fi;
+    fi;
     %
     fi;
     endfor;
+    if #3=360:
+    draw cc if #6=1: withpen pencircle scaled2 fi;
+    else:
+    draw (subpath(0,length cc/2) of cc)--cycle if #6=1: withpen pencircle scaled2 fi;;
+    fi;
     n:=0;
     path cd[];
     for p_=t:
     if string p_:
     n:=n+1;
-    C[n]=A[n-1] rotatedabout(O,(ang[n]-ang[n-1])/2);
+    C[n]=A[n-1] rotatedabout(O,if #7=1:-1* fi(ang[n]-ang[n-1])/2);
     draw 0.95[O,C[n]]--1.05[O,C[n]];
     C[n]:=1.05[O,C[n]];
     if (xpart(C[n])>xpart(O)) and (ypart(C[n])>ypart(O)):
@@ -6002,7 +6527,7 @@
     toto(#2);
   \end{mplibcode}
   \else
-  \begin{mpost}[mpsettings={input PfC-Geometrie;}]
+  \begin{mpost}%[mpsettings={input PfC-Geometrie;}]
     pair A[],O,B[],C[],D[];
     O=(0,0);
     n:=0;
@@ -6011,13 +6536,20 @@
     ang[0]:=0;
     path cc;
     cc=(fullcircle scaled (2*#1));
-    if #3=360:
-    draw cc;
+    % on récupère les couleurs
+    color Col[];
+    n:=0;
+    for p_=#5:
+    n:=n+1;
+    Col[n]=p_;
+    endfor;
+    if #7=0:
+    A[0]=point(0) of cc;
     else:
-    draw (subpath(0,length cc/2) of cc)--cycle;
+    A[0]=point(180) of cc;
     fi;
-    A[0]=point(0) of cc;
     vardef toto(text t)=
+    n:=0;
     for p_=t:
     if numeric p_:
     n:=n+1;
@@ -6032,28 +6564,65 @@
     for p_=t:
     if numeric p_:
     n:=n+1;
+    if #7=0:
     A[n]=A[n-1] rotatedabout(O,p_*(#3/total[N]));
-    draw A[n-1]--O--A[n];
+    else:
+    A[n]=A[n-1] rotatedabout(O,-p_*(#3/total[N]));
+    fi;
+    %hachure ou pas ?
+    if #6=0:
+    fill (O--if #7=0:arccercle(A[n-1],A[n],O) else:
+    arccercle(A[n],A[n-1],O) fi--cycle) withcolor if unknown Col[n]: white else:Col[n] fi;
+    else:
+    draw
+    hachurage((O--if #7=0:arccercle(A[n-1],A[n],O)
+    else:arccercle(A[n],A[n-1],O) fi--cycle),p_*(#3/total[N]) if
+    (n mod 2)=0: +90 else: -90 fi,0.25,if (n mod 2)=0 : 0 else: 1 fi)
+    if #4=1: withcolor 0.5white fi;
+    fi;
+    draw A[n-1]--O--A[n] if #6=1: withpen pencircle scaled2 fi;
     % Affichage des angles associés
     if #4=1:
     if round(p_*(#3/total[N]))>15:
     if (n mod 2)=0:
-    marque_a:=0.9*20
+    marque_a:=3.1*20
     else:
-    marque_a:=1.1*20/0.9
+    marque_a:=3.1*20/0.9
     fi;
-    draw Codeangle(A[n-1],O,A[n],0,(((LATEX("\ang{"&decimal(round(p_*(#3/total[N])))&"}")) scaled 0.5)));
+    if #6=1:
+    if #7=0:
+    undraw
+    Codeangle(A[n-1],O,A[n],0,(((LATEX("\ang{"&decimal(round(p_*(#3/total[N])))&"}")))));
+    else:
+    undraw
+    Codeangle(A[n],O,A[n-1],0,(((LATEX("\ang{"&decimal(round(p_*(#3/total[N])))&"}")))));
     fi;
+    fill cercles(w shifted(marque_ang*unitvector(w-O)),3mm) withcolor
+    blanc;
     fi;
+    if #7=0:
+    draw
+    Codeangle(A[n-1],O,A[n],0,(((LATEX("\ang{"&decimal(round(p_*(#3/total[N])))&"}")))));
+    else:
+    draw
+    Codeangle(A[n],O,A[n-1],0,(((LATEX("\ang{"&decimal(round(p_*(#3/total[N])))&"}")))));
+    fi;
+    fi;
+    fi;
     %
     fi;
     endfor;
+    if #3=360:
+    draw cc if #6=1: withpen pencircle scaled2 fi;
+    else:
+    draw (subpath(0,length cc/2) of cc)--cycle if #6=1: withpen pencircle scaled2 fi;;
+    fi;
     n:=0;
     path cd[];
     for p_=t:
     if string p_:
     n:=n+1;
-    C[n]=A[n-1] rotatedabout(O,(ang[n]-ang[n-1])/2);
+    C[n]=A[n-1] rotatedabout(O,if #7=1:-1* fi(ang[n]-ang[n-1])/2);
     draw 0.95[O,C[n]]--1.05[O,C[n]];
     C[n]:=1.05[O,C[n]];
     if (xpart(C[n])>xpart(O)) and (ypart(C[n])>ypart(O)):
@@ -6089,8 +6658,16 @@
 \DTLgnewdb{mtdb}%
 \dtlexpandnewvalue%
 \newcount\nbdonnees%
+% 
+\def\AjoutListEEaa#1\nil{\addtotok\tabtoksEEa{#1,}}%
+\def\AjoutListEEab#1\nil{\addtotok\tabtoksEEa{#1/}}%
+\def\AjoutListEEb#1\nil{\addtotok\tabtoksEEb{#1,}}%
+\def\AjoutListEEx#1\nil{\addtotok\tabtoksEE{#1,}}%
+\def\AjoutListEEy#1\nil{\addtotok\tabtoksEE{#1/}}%
 
-
+\DTLgnewdb{mtdbEE}%
+\DTLgnewdb{mtdbEEqual}%
+%
 \newcommand\Stat[2][]{%
   \useKVdefault[ClesStat]%
   \setKV[ClesStat]{#1}%
@@ -6104,11 +6681,89 @@
     }%
     \readlist*\ListeComplete{\foo}%
     \setKV[ClesStat]{Qualitatif}%
+  }{
+  \ifboolKV[ClesStat]{Sondage}{%
+    \setsepchar{,}\ignoreemptyitems%
+    \readlist*\Liste{#2}%
+    % "liste vide"
+	\newtoks\tabtoksEEa%
+	\tabtoksEEa{}%
+	%
+	% "liste vide"
+	\newtoks\tabtoksEEb%
+	\tabtoksEEb{}%
+    %
+	\readlist*\ListeSansDoublonsEE{999}%   %% Pour ne pas avoir une liste vide
+	%
+	\newcount\cmptEE%
+	\newcount\PasNumEE%    %% Permettra de savoir si ce sondage est qualitatif ou quantitatif
+	\PasNumEE=0\relax%
+	\DTLcleardb{mtdbEE}%
+  % on range les resultats du sondage par ordre croissant.
+  \foreachitem\x\in\Liste{%
+    \DTLnewrow{mtdbEE}%
+    \DTLnewdbentry{mtdbEE}{Numeric}{\x}%
+  }%
+  \dtlsort{Numeric}{mtdbEE}{\dtlicompare}%
+	\DTLforeach{mtdbEE}{\nba=Numeric}{%
+		\IfDecimal{\nba}{}{\PasNumEE=\numexpr\PasNumEE+1\relax}%
+		\cmptEE=0\relax%
+		\foreachitem\nbb\in\ListeSansDoublonsEE{%
+			\ifthenelse{\equal{\nba}{\nbb}}{\cmptEE=\numexpr\cmptEE+1\relax}{}%
+		}%
+		\ifthenelse{\equal{\the\cmptEE}{0}}{%
+			\expandafter\AjoutListEEb\nba\nil%
+			\xdef\listEEa{\the\tabtoksEEb}%
+			\ignoreemptyitems%
+			\setsepchar{,}%
+			\readlist*\ListeSansDoublonsEE\listEEa%    	%%% Enlève tous les élements
+														%%% identiques de Liste
+		}{}%  
+	}%	
+	\foreachitem\nba\in\ListeSansDoublonsEE{%
+		\cmptEE=0\relax%
+		\DTLforeach{mtdbEE}{\nbb=Numeric}{%
+			\ifthenelse{\equal{\nba}{\nbb}}{\cmptEE=\numexpr\cmptEE+1\relax}{}%
+		}%
+		\expandafter\AjoutListEEab\nba\nil%
+		\expandafter\AjoutListEEaa\the\cmptEE\nil% 	%%% Compte tous les élements
+													%%% identiques de Liste
+	}%
+	\xdef\listEEb{\the\tabtoksEEa}
+	\ignoreemptyitems%
+	\setsepchar[*]{,*/}
+	\readlist*\ListeComplete\listEEb%
+    %
+    \ifthenelse{\equal{\the\PasNumEE}{0}}{\setKV[ClesStat]{Quantitatif}}{\setKV[ClesStat]{Qualitatif}}%
   }{%
+  \ifboolKV[ClesStat]{Qualitatif}{%
     %  % on lit la liste écrite sous la forme valeur/effectif
     \setsepchar[*]{,*/}\ignoreemptyitems%
     \readlist*\ListeComplete{#2}%
-  }
+    }{% Dans le qualitatif, on trie d'abord les valeurs.
+    \setsepchar[*]{,*/}\ignoreemptyitems%
+    \readlist*\ListeInitiale{#2}%
+% "liste vide"
+	\newtoks\tabtoksEE%
+	\tabtoksEE{}%
+	\DTLcleardb{mtdbEEqual}%
+  	\foreachitem\x\in\ListeInitiale{%
+    	\DTLnewrow{mtdbEEqual}%
+    	\itemtomacro\ListeInitiale[\xcnt,1]\x%
+    	\DTLnewdbentry{mtdbEEqual}{Val}{\x}%
+    	\itemtomacro\ListeInitiale[\xcnt,2]\y%
+    	\DTLnewdbentry{mtdbEEqual}{Eff}{\y}%
+  	}%
+  	\dtlsort{Val}{mtdbEEqual}{\dtlicompare}%
+	\DTLforeach{mtdbEEqual}{\Val=Val,\Eff=Eff}{%  
+		\expandafter\AjoutListEEy\Val\nil%
+		\expandafter\AjoutListEEx\Eff\nil%
+	}
+	\xdef\listEE{\the\tabtoksEE}
+	\ignoreemptyitems%
+	\setsepchar[*]{,*/}
+	\readlist*\ListeComplete\listEE%
+  }}}
   % on crée la base de données des valeurs dans le cas qualitatif
   \DTLcleardb{mtdb}%
   % on les trie pour la médiane dans le cas qualitatif % Touhami / Texnique.fr
@@ -6134,14 +6789,20 @@
     %  %% celui de la somme des données
     \foreachitem\don\in\ListeComplete{\xdef\SommeDonnees{\fpeval{\SommeDonnees+\ListeComplete[\doncnt,2]}}}%
     %  %% celui de l'effectif total
+    \ifboolKV[ClesStat]{EffectifTotal}{%
+      \ifboolKV[ClesStat]{Liste}{L'effectif total de la série est
+        \num{\ListeCompletelen}.\par}{
+        \foreachitem\don\in\ListeComplete{\xdef\EffectifTotal{\fpeval{\EffectifTotal+\ListeComplete[\doncnt,2]}}}%
+        L'effectif total de la série est : \[\ListeComplete[1,2]\xintFor* ##1 in
+          {\xintSeq {2}{\ListeCompletelen}}\do{%
+            +\ListeComplete[##1,2]}=\num{\EffectifTotal}\]}
+    }{}%
     \xdef\EffectifTotal{\SommeDonnees}%
-    \ifboolKV[ClesStat]{EffectifTotal}{%
-      L'effectif total est \num{\ListeCompletelen}.\par
-    }{}
     %  %% celui de la moyenne
-    \xdef\Moyenne{\fpeval{\SommeDonnees/\ListeCompletelen}}%
+    \xdef\Moyenne{\fpeval{\SommeDonnees/\ListeCompletelen}}%	
     \ifboolKV[ClesStat]{Moyenne}{%
-      La somme des données est :%
+    \ifboolKV[ClesStat]{Liste}{%    
+      La somme des données de la série est :%
       \xintifboolexpr{\ListeCompletelen<\useKV[ClesStat]{Coupure}}{%
         \[
           \num{\ListeComplete[1,2]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}\xintFor* ##1 in {\xintSeq {2}{\ListeCompletelen}}\do{%
@@ -6155,8 +6816,8 @@
         }=\num{\SommeDonnees}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}%
       \]%
     }%
-      \ifboolKV[ClesStat]{SET}{}{L'effectif total est \num{\ListeCompletelen}.\\}%
-      Donc la moyenne est égale à :%
+      \ifboolKV[ClesStat]{SET}{}{Le nombre de données de la série est \num{\ListeCompletelen}.\\}%
+      Donc la moyenne de la série est égale à :%
       \[\frac{\num{\SommeDonnees}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}}{\num{\ListeCompletelen}}%\IfInteger{\fpeval{round(\fpeval{\SommeDonnees/\ListeCompletelen},\useKV[ClesStat]{Precision})}}{=}{\approx}
         \opdiv*{\SommeDonnees}{\ListeCompletelen}{resultatmoy}{restemoy}%
         \opround{resultatmoy}{\useKV[ClesStat]{Precision}}{resultatmoy1}%
@@ -6163,7 +6824,7 @@
               \opcmp{resultatmoy}{resultatmoy1}\ifopeq=\else\approx\fi%
         \num{\fpeval{round(\fpeval{\SommeDonnees/\ListeCompletelen},\useKV[ClesStat]{Precision})}}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}.}{.}%
       \]%
-    }{}%
+    }{Pas de moyenne possible pour une série de données à caractère qualitatif.}}{}%
     %    %  %% celui de l'étendue
     \xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{%
       \xintifboolexpr{\ListeComplete[##1,2]>\DonneeMax}{%
@@ -6175,11 +6836,12 @@
     }%
     \xdef\EffectifMax{\DonneeMax}%
     \xdef\Etendue{\fpeval{\DonneeMax-\DonneeMin}}%
-    \ifboolKV[ClesStat]{Etendue}{L'étendue est égale à $\num{\DonneeMax}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}-\num{\DonneeMin}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}=\num{\Etendue}$\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}%
-    }{}%
+    \ifboolKV[ClesStat]{Etendue}{%
+    \ifboolKV[ClesStat]{Liste}{%
+    L'étendue de la série est égale à $\num{\DonneeMax}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}-\num{\DonneeMin}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}=\num{\Etendue}$\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}%
+    }{Pas d'étendue possible pour une série de données à caractère qualitatif.}}{}%
     \ifboolKV[ClesStat]{Mediane}{%
-      %%%%%%%%%%%%%%%%%%%%%%%%
-      
+    \ifboolKV[ClesStat]{Liste}{%    
       On range les données par ordre croissant :%
       \nbdonnees=0%
       \xintifboolexpr{\ListeCompletelen<\useKV[ClesStat]{Coupure}}{%
@@ -6198,11 +6860,11 @@
       \newcount\meda%
       \ifodd\number\ListeCompletelen%odd impair
       \med=\fpeval{(\ListeCompletelen+1)/2}\relax%
-      L'effectif total est \num{\ListeCompletelen}. Or, $\num{\ListeCompletelen}=\num{\fpeval{\med-1}}+1+\num{\fpeval{\med-1}}$.\\
+      L'effectif total de la série est \num{\ListeCompletelen}. Or, $\num{\ListeCompletelen}=\num{\fpeval{\med-1}}+1+\num{\fpeval{\med-1}}$.\\
       \else% pair
       \med=\fpeval{\ListeCompletelen/2}\relax
       \meda=\numexpr\med+1\relax
-      L'effectif total est \num{\ListeCompletelen}. Or, $\num{\ListeCompletelen}=\num{\the\med}+\num{\the\med}$.\\
+      L'effectif total de la série est \num{\ListeCompletelen}. Or, $\num{\ListeCompletelen}=\num{\the\med}+\num{\the\med}$.\\
       \fi%
       \newcount\k%
       \k=0%
@@ -6209,24 +6871,27 @@
       \DTLforeach{mtdb}{\numeroDonnee=Numeric}{\k=\numexpr\k+1\relax%
         \ifnum\k=\med %La médiane vaut \numeroDonnee\fi
         \ifodd\number\ListeCompletelen%
-        La médiane est la \the\med\ieme{} donnée.\\Donc la médiane est \num{\numeroDonnee}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}%
+        La médiane de la série est la \the\med\ieme{} donnée.\\Donc la médiane de la série est \num{\numeroDonnee}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}%
         \else%
         La \the\med\ieme{} donnée est \num{\numeroDonnee}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}\xdef\Mediane{\numeroDonnee} %
         \fi
         \fi
         \ifnum\k=\meda
-        La \the\meda\ieme{} donnée est \num{\numeroDonnee}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.} Donc la médiane est \xdef\Mediane{\fpeval{(\Mediane+\numeroDonnee)/2}}\num{\Mediane}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}
+        La \the\meda\ieme{} donnée est \num{\numeroDonnee}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.} Donc la médiane de la série est \xdef\Mediane{\fpeval{(\Mediane+\numeroDonnee)/2}}\num{\Mediane}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}
         \fi
       }
       %%%%%%%%%%%%%%%%%%%%%%%% 
-    }{}
-    % construction du tableau
-    \ifboolKV[ClesStat]{Tableau}{\ifboolKV[ClesStat]{Total}{\buildtabqt}{\buildtabq}}{}
-    % Construction du graphique ??
+    }{Pas de médiane possible pour une série de données à caractère qualitatif.}}{}
+    % Construction du tableau
+    \ifboolKV[ClesStat]{Tableau}{%
+    \ifboolKV[ClesStat]{Liste}{Pas de tableau possible avec la clé Liste.\\Utilisez plutôt la clé Sondage si vous voulez un tableau avec cette liste.}{%
+    \ifboolKV[ClesStat]{Total}{\buildtabt}{\buildtab}}}%
+    {}%
+    % Construction du graphique
     \ifboolKV[ClesStat]{Graphique}{%
-      \ifboolKV[ClesStat]{Angle}{\buildgraphcq{360}}{\ifboolKV[ClesStat]{SemiAngle}{\buildgraphcq{180}}{}}
-      \ifboolKV[ClesStat]{Batons}{\buildgraphq}{}
-    }{}
+    \ifboolKV[ClesStat]{Liste}{Pas de graphique possible avec la clé Liste.\\Utilisez plutôt la clé Sondage si vous voulez un graphique avec cette liste.}{%
+      \ifboolKV[ClesStat]{Angle}{\buildgraphcq{360}}{\ifboolKV[ClesStat]{SemiAngle}{\buildgraphcq{180}}{\buildgraphq[#1]}}%
+    }}{}
   }{%%%%%%%%%%%%%%%%%%%%%Début quantitatif
    %  % on effectue les calculs
    %  %% celui de la somme des données
@@ -6247,12 +6912,12 @@
     %  %% celui de la moyenne
     \xdef\Moyenne{\fpeval{\SommeDonnees/\EffectifTotal}}%
     \ifboolKV[ClesStat]{EffectifTotal}{%
-      L'effectif total est : \[\ListeComplete[1,2]\xintFor* ##1 in
+      L'effectif total de la série est : \[\ListeComplete[1,2]\xintFor* ##1 in
       {\xintSeq {2}{\ListeCompletelen}}\do{%
         +\ListeComplete[##1,2]}=\num{\EffectifTotal}\]
     }{}%
     \ifboolKV[ClesStat]{Moyenne}{%
-      La somme des données est :%
+      La somme des données de la série est :%
       \xintifboolexpr{\ListeCompletelen<\useKV[ClesStat]{Coupure}}{%
         \[
           \ifnum\ListeComplete[1,2]=1\else\num{\ListeComplete[1,2]}\times\fi\num{\ListeComplete[1,1]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}\xintFor* ##1 in {\xintSeq {2}{\ListeCompletelen}}\do{%
@@ -6268,7 +6933,7 @@
           }=\num{\SommeDonnees}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}
         \]
       }
-      \ifboolKV[ClesStat]{SET}{}{L'effectif total est :%
+      \ifboolKV[ClesStat]{SET}{}{L'effectif total de la série est :%
         \ifboolKV[ClesStat]{Liste}{ \num{\EffectifTotal}\\}{%
           \[\num{\ListeComplete[1,2]}\xintFor* ##1 in {\xintSeq {2}{\ListeCompletelen}}\do{%
               +\num{\ListeComplete[##1,2]}
@@ -6276,7 +6941,7 @@
           \]%
         }%
       }
-      Donc la moyenne est égale à :%
+      Donc la moyenne de la série est égale à :%
       \[\frac{\num{\SommeDonnees}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}}{\num{\EffectifTotal}}%
         \opdiv*{\SommeDonnees}{\EffectifTotal}{resultatmoy}{restemoy}%
         \opround{resultatmoy}{\useKV[ClesStat]{Precision}}{resultatmoy1}%
@@ -6287,7 +6952,7 @@
     }{}%
     %  % Affichage des réponses.
     %  %% pour l'étendue
-    \ifboolKV[ClesStat]{Etendue}{L'étendue est égale à $\num{\ListeComplete[\ListeCompletelen,1]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}-\num{\ListeComplete[1,1]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}=\num{\Etendue}$\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}}{}%
+    \ifboolKV[ClesStat]{Etendue}{L'étendue de la série est égale à $\num{\ListeComplete[\ListeCompletelen,1]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}-\num{\ListeComplete[1,1]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}=\num{\Etendue}$\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}}{}%
     %  %% pour la médiane
     \ifboolKV[ClesStat]{Mediane}{%
       
@@ -6295,11 +6960,11 @@
       \newcount\meda%
       \ifodd\number\EffectifTotal%odd impair
       \med=\fpeval{(\EffectifTotal+1)/2}\relax%
-      L'effectif total est \num{\EffectifTotal}. Or, $\num{\EffectifTotal}=\num{\fpeval{\med-1}}+1+\num{\fpeval{\med-1}}$. %
+      L'effectif total de la série est \num{\EffectifTotal}. Or, $\num{\EffectifTotal}=\num{\fpeval{\med-1}}+1+\num{\fpeval{\med-1}}$. %
       \else% pair
       \med=\fpeval{\EffectifTotal/2}\relax%
       \meda=\numexpr\med+1\relax%
-      L'effectif total est \num{\EffectifTotal}. Or, $\num{\EffectifTotal}=\num{\fpeval{\med}}+\num{\fpeval{\med}}$. %
+      L'effectif total de la série est \num{\EffectifTotal}. Or, $\num{\EffectifTotal}=\num{\fpeval{\med}}+\num{\fpeval{\med}}$. %
       \fi%
       \newcount\k%
       \k=0%
@@ -6308,13 +6973,13 @@
           \k=\numexpr\k+1\relax%
           \ifnum\k=\med%
           \ifodd\number\EffectifTotal%
-          La médiane est la \the\med\ieme{} donnée. Donc la médiane est \num{\ListeComplete[##1,1]}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}%
+          La médiane de la série est la \the\med\ieme{} donnée. Donc la médiane de la série est \num{\ListeComplete[##1,1]}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}%
           \else%
           La \the\med\ieme{} donnée est \num{\ListeComplete[##1,1]}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}. }{. }\xdef\Mediane{\ListeComplete[##1,1]}%
           \fi%
           \fi%
           \ifnum\k=\meda%
-          La \the\meda\ieme{} valeur est \num{\ListeComplete[##1,1]}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}\\Donc la médiane est \xdef\Mediane{\fpeval{(\Mediane+\ListeComplete[##1,1])/2}}\num{\Mediane}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}%
+          La \the\meda\ieme{} valeur est \num{\ListeComplete[##1,1]}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}\\Donc la médiane de la série est \xdef\Mediane{\fpeval{(\Mediane+\ListeComplete[##1,1])/2}}\num{\Mediane}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}%
           \fi%
         }%
       }%
@@ -6322,13 +6987,15 @@
     % Construction de tableau
     \ifboolKV[ClesStat]{Tableau}{\ifboolKV[ClesStat]{Total}{\buildtabt}{\buildtab}}{}%
     % Construction du graphique ??
-    \ifboolKV[ClesStat]{Graphique}{\buildgraph}{}%
+    \ifboolKV[ClesStat]{Graphique}{%
+      \ifboolKV[ClesStat]{Angle}{\buildgraphcq{360}}{\ifboolKV[ClesStat]{SemiAngle}{\buildgraphcq{180}}{\buildgraph[#1]}}
+    }{}%
   }%
 }%
 
-%%%%%%%%%%%%%
-%%% Radar
-%%%%%%%%%%%%%
+%%%
+% Radar
+%%%
 \setKVdefault[ClesRadar]{Rayon=3cm,Reference=20,MoyenneClasse=false,Disciplines=false,Pas=5}
 
 \newtoks\toklisteradara%pour la moyenne de l'élève
@@ -6359,13 +7026,18 @@
     p:=0;
     for p_=#2:
     p:=p+1;
-    if N[p]>180:
-    label(TEX(p_)
-    rotated(90+N[p]),1.15[O,pointarc(cc,N[p])]);
-    else:
-    label(TEX(p_)
-    rotated(-90+N[p]),1.15[O,pointarc(cc,N[p])]);
+    if (N[p]<90) or (N[p]=90):
+    label.urt(TEX(p_),1.025[O,pointarc(cc,N[p])]);
     fi;
+    if ((N[p]>90) and (N[p]<180)) or (N[p]=180):
+    label.ulft(TEX(p_),1.025[O,pointarc(cc,N[p])]);
+    fi;
+    if (N[p]>180) and (N[p]<270):
+    label.llft(TEX(p_),1.025[O,pointarc(cc,N[p])]);
+    fi;
+    if (N[p]>270) or (N[p]=270):
+    label.lrt(TEX(p_),1.025[O,pointarc(cc,N[p])]);
+    fi;
     endfor;
     % tracé des pas:
     pas=#4/#3;
@@ -6376,7 +7048,7 @@
     trace pointarc(cc,N[1]) for l=2 upto n: --pointarc(cc,N[l]) endfor
     --cycle;
     % etiquettage des pas
-    dotlabel.top(btex \tiny #4 etex rotated -90,pointarc(cc,0));
+    dotlabel.urt(btex \tiny #4 etex,pointarc(cc,0));
     dotlabel.urt(btex \tiny #3 etex,(1/pas)[O,pointarc(cc,0)]);
     % tracé des résultats élèves
     pair El[];
@@ -6414,13 +7086,18 @@
     p:=0;
     for p_=#2:
     p:=p+1;
-    if N[p]>180:
-    label(LATEX(p_)
-    rotated(90+N[p]),1.15[O,pointarc(cc,N[p])]);
-    else:
-    label(LATEX(p_)
-    rotated(-90+N[p]),1.15[O,pointarc(cc,N[p])]);
+    if (N[p]<90) or (N[p]=90):
+    label.urt(TEX(p_),1.025[O,pointarc(cc,N[p])]);
     fi;
+    if ((N[p]>90) and (N[p]<180)) or (N[p]=180):
+    label.ulft(TEX(p_),1.025[O,pointarc(cc,N[p])]);
+    fi;
+    if (N[p]>180) and (N[p]<270):
+    label.llft(TEX(p_),1.025[O,pointarc(cc,N[p])]);
+    fi;
+    if (N[p]>270) or (N[p]=270):
+    label.lrt(TEX(p_),1.025[O,pointarc(cc,N[p])]);
+    fi;
     endfor;
     % tracé des pas:
     pas=#4/#3;
@@ -6460,6 +7137,7 @@
   \useKVdefault[ClesRadar]%
   \setKV[ClesRadar]{#1}%
   \ignoreemptyitems%
+  \setsepchar[*]{,}%  
   \readlist*\ListeRadar{#2}%
   \toklisteradara{}%
   \foreachitem\compteur\in\ListeRadar{\expandafter\UpdateRadara\compteur\nil}%
@@ -6474,9 +7152,9 @@
   \MPRadar{\useKV[ClesRadar]{Rayon}}{\the\toklisteradarb}{\useKV[ClesRadar]{Pas}}{\useKV[ClesRadar]{Reference}}{\the\toklisteradara}{\the\toklisteradarc}%
 }
 
-%%%%%%%%%%%%
+%%%
 % Barres de niveaux
-%%%%%%%%%%%%
+%%%
 \setKVdefault[ClesBarre]{Niveau=false,LimiteI=25,LimiteF=50,LimiteS=75,TexteOrigine=0,TexteReference=100,CouleurGraduation=white,CouleurFond=gray!50,CouleurBarre=black,Graduation=false,Nom=Défaut,Pas=10,CouleurI=red,CouleurF=orange,CouleurS=yellow,CouleurM=green}
 
 \newlength{\barrewidth}
@@ -6537,10 +7215,10 @@
   }
 }
 
-%%%%%%%%%%%%%%%
-%%% Equations
-%%%%%%%%%%%%%%%
-\setKVdefault[ClesEquation]{Ecart=0.5,Fleches=false,FlecheDiv=false,Laurent=false,Decomposition=false,Terme=false,Composition=false,Symbole=false,Entier=false,Lettre=x,Solution=false,Bloc=false,Simplification=false,CouleurTerme=black,CouleurCompo=black,CouleurSous=red,CouleurSymbole=orange,Verification=false,Nombre=0,Egalite=false,Produit=false,Facteurs=false,Carre=false,Pose=false,Equivalence=false}
+%%%
+% Equations
+%%%
+\setKVdefault[ClesEquation]{Ecart=0.5,Fleches=false,FlecheDiv=false,Laurent=false,Decomposition=false,Terme=false,Composition=false,Symbole=false,Entier=false,Lettre=x,Solution=false,LettreSol=true,Bloc=false,Simplification=false,CouleurTerme=black,CouleurCompo=black,CouleurSous=red,CouleurSymbole=orange,Verification=false,Nombre=0,Egalite=false,Produit=false,Facteurs=false,Carre=false,Exact=false,Pose=false,Equivalence=false}
 
 \newcommand\rightcomment[4]%
   {\begin{tikzpicture}[remember picture,overlay]
@@ -6552,7 +7230,6 @@
    \end{tikzpicture}%
  }
 
-
  \newcommand\leftcomment[4]%
   {\begin{tikzpicture}[remember picture,overlay]
    \draw[Cfleches,-stealth]
@@ -6659,9 +7336,9 @@
 
 \definecolor{Cfleches}{RGB}{100,100,100}%
 
-\input{PfC-EquationSoustraction1}%
+\input{PfC-EquationSoustraction2}%
 \input{PfC-EquationTerme1}%
-\input{PfC-EquationComposition1}%
+\input{PfC-EquationComposition2}%
 \input{PfC-EquationPose1}%
 \input{PfC-EquationSymbole1}%
 \input{PfC-EquationLaurent1}
@@ -6716,12 +7393,12 @@
       Comme \num{#2} est positif, alors l'équation $\useKV[ClesEquation]{Lettre}^2=\num{#2}$ a deux solutions :%
       \begin{align*}
         \useKV[ClesEquation]{Lettre}&=\sqrt{\num{#2}}&&\text{et}&\useKV[ClesEquation]{Lettre}&=-\sqrt{\num{#2}}%\\
-        \ifboolKV[ClesEquation]{Entier}{\\%
+        \ifboolKV[ClesEquation]{Exact}{\\%
         \useKV[ClesEquation]{Lettre}&=\num{\fpeval{sqrt(#2)}}&&\text{et}&\useKV[ClesEquation]{Lettre}&=-\num{\fpeval{sqrt(#2)}}}{}%
       \end{align*}
-    }
-  }
-}
+    }%
+  }%
+}%
 
 \newcommand\ResolEquationProduit[5][]{%
   \setKV[ClesEquation]{#1}%
@@ -6782,9 +7459,8 @@
       }
     \end{align*}
   }%
-      
-    \ifboolKV[ClesEquation]{Solution}{L'équation $\xintifboolexpr{#3=0}{\xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}}{(\xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}})}\xintifboolexpr{#5=0}{\times\xintifboolexpr{#4=1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}}{(\xintifboolexpr{#4=1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#5>0}{+\num{#5}}{-\num{\fpeval{0-#5}}})}=0$ a deux solutions : \opdiv*{\Coeffb}{\Coeffa}{solution}{resteequa}\opcmp{resteequa}{0}$\useKV[ClesEquation]{Lettre}=\displaystyle\ifopeq\opexport{solution}{\solution}\num{\solution}\else\ifboolKV[ClesEquation]{Entier}{\SSimplifie{\Coeffb}{\Coeffa}}{\frac{\num{\Coeffb}}{\num{\Coeffa}}}\fi$ et \opdiv*{\Coeffd}{\Coeffc}{solution}{resteequa}\opcmp{resteequa}{0}$\useKV[ClesEquation]{Lettre}=\displaystyle\ifopeq\opexport{solution}{\solution}\num{\solution}\else\ifboolKV[ClesEquation]{Entier}{\SSimplifie{\Coeffd}{\Coeffc}}{\frac{\num{\Coeffd}}{\num{\Coeffc}}}\fi$.
-    }{}
+  \ifboolKV[ClesEquation]{Solution}{L'équation $\xintifboolexpr{#3=0}{\xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}}{(\xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}})}\xintifboolexpr{#5=0}{\times\xintifboolexpr{#4=1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}}{(\xintifboolexpr{#4=1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#5>0}{+\num{#5}}{-\num{\fpeval{0-#5}}})}=0$ a deux solutions : \opdiv*{\Coeffb}{\Coeffa}{solution}{resteequa}\opcmp{resteequa}{0}$\ifboolKV[ClesEquation]{LettreSol}{\useKV[ClesEquation]{Lettre}=}{}\displaystyle\ifopeq\opexport{solution}{\solution}\num{\solution}\else\ifboolKV[ClesEquation]{Entier}{\SSimplifie{\Coeffb}{\Coeffa}}{\frac{\num{\Coeffb}}{\num{\Coeffa}}}\fi$ et \opdiv*{\Coeffd}{\Coeffc}{solution}{resteequa}\opcmp{resteequa}{0}$\ifboolKV[ClesEquation]{LettreSol}{\useKV[ClesEquation]{Lettre}=}{}\displaystyle\ifopeq\opexport{solution}{\solution}\num{\solution}\else\ifboolKV[ClesEquation]{Entier}{\SSimplifie{\Coeffd}{\Coeffc}}{\frac{\num{\Coeffd}}{\num{\Coeffc}}}\fi$.
+  }{}%
 }
 
 \newcommand\Verification[5][]{%
@@ -6802,10 +7478,10 @@
   }{\xintifboolexpr{\Testa=\Testb}{Comme $\num{\Testa}=\num{\Testb}$, alors $\useKV[ClesEquation]{Lettre}=\num{\useKV[ClesEquation]{Nombre}}$ est bien }{Comme $\num{\Testa}\not=\num{\Testb}$, alors $\useKV[ClesEquation]{Lettre}=\num{\useKV[ClesEquation]{Nombre}}$ n'est pas }une solution de l'équation $\xintifboolexpr{#2=0}{\num{#3}}{\xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3=0}{}{\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}}}=\xintifboolexpr{#4=0}{\num{#5}}{\xintifboolexpr{#4=1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#5=0}{}{\xintifboolexpr{#5>0}{+\num{#5}}{-\num{\fpeval{0-#5}}}}}$.}
 }
 
-%%%%%%%%%%%%%%%%%%%% 
-%%% Proportionnalité
-%%%%%%%%%%%%%%%%%%%%
-\setKVdefault[ClesPropor]{GrandeurA=Grandeur A,GrandeurB=Grandeur B,Largeur=1cm,Math=false,Stretch=1,ColorFill=white,ColorTab=gray!15}%Tableau=false :
+%%%
+% Proportionnalité
+%%%
+\setKVdefault[ClesPropor]{GrandeurA=Grandeur A,GrandeurB=Grandeur B,Largeur=1cm,Math=false,Stretch=1,ColorFill=white,CouleurTab=gray!15}%Tableau=false :
                                 %inutile ?
 
 \def\Updatetoksmath#1/#2\nil{\addtotok\tabtoksa{&#1}\addtotok\tabtoksb{&#2}}%
@@ -6819,7 +7495,7 @@
   }%
   \xdef\LongListe{\ListeValeurlen}%
   \renewcommand{\arraystretch}{\useKV[ClesPropor]{Stretch}}%
-  \begin{tabular}{|>{\columncolor{\useKV[ClesPropor]{ColorTab}}}c|*{\number\numexpr\ListeValeurlen}{>{\centering\arraybackslash}p{\useKV[ClesPropor]{Largeur}}|}}%
+  \begin{tabular}{|>{\columncolor{\useKV[ClesPropor]{CouleurTab}}}c|*{\number\numexpr\ListeValeurlen}{>{\centering\arraybackslash}p{\useKV[ClesPropor]{Largeur}}|}}%
     \multicolumn{1}{c}{\TikzPHD\setcounter{NbPropor}{1}}\xintFor* ##1 in {\xintSeq {1}{\ListeValeurlen}}\do{&\multicolumn{1}{c}{\TikzPH}}\\%
     \hhline{*{\number\numexpr\ListeValeurlen+1}{-}}%
     \the\tabtoksa\\%
@@ -6839,9 +7515,15 @@
  }%
 
  \newcommand{\TikzPHD}{%
-   \setbox1=\hbox{\useKV[ClesPropor]{GrandeurA}}
-   \tikz[remember picture,overlay]{%
-   \coordinate[name=ProporHD,xshift=-0.5*\the\wd1,yshift=-\the\dp\strutbox*\arraystretch];}%
+   \setbox1=\hbox{\useKV[ClesPropor]{GrandeurA}}%
+   \setbox2=\hbox{\useKV[ClesPropor]{GrandeurB}}%
+   \xintifboolexpr{\wd1>\wd2}{%
+     \tikz[remember picture,overlay]{%
+       \coordinate[name=ProporHD,xshift=-0.5\wd1,yshift=-\the\dp\strutbox*\arraystretch];}%
+   }{%
+     \tikz[remember picture,overlay]{%
+       \coordinate[name=ProporHD,xshift=-0.5\wd2,yshift=-\the\dp\strutbox*\arraystretch];}%
+   }
  }%
 
  \newcommand{\TikzPB}{%
@@ -6851,9 +7533,15 @@
  }%
 
  \newcommand{\TikzPBD}{%
-   \setbox1=\hbox{\useKV[ClesPropor]{GrandeurA}}
-   \tikz[remember picture, overlay]{%
-     \coordinate[name=ProporBD,xshift=-0.5*\the\wd1,yshift=\the\ht\strutbox*\arraystretch];}%
+   \setbox1=\hbox{\useKV[ClesPropor]{GrandeurA}}%
+   \setbox2=\hbox{\useKV[ClesPropor]{GrandeurB}}%
+   \xintifboolexpr{\wd1>\wd2}{%
+     \tikz[remember picture, overlay]{%
+       \coordinate[name=ProporBD,xshift=-0.5*\the\wd1,yshift=\the\ht\strutbox*\arraystretch];}%
+   }{%
+     \tikz[remember picture, overlay]{%
+       \coordinate[name=ProporBD,xshift=-0.5*\the\wd2,yshift=\the\ht\strutbox*\arraystretch];}%
+   }
    \stepcounter{NbPropor}%
  }%
  
@@ -6860,11 +7548,11 @@
  \newcommand\FlechesPH[3]{%
    \ifnum#1<#2\relax%
   \begin{tikzpicture}[remember picture,overlay]%
-    \draw[-stealth,out=50,in=130] (ProporH-#1) to node[inner sep=0pt, inner xsep=1pt,fill=\colorfill, pos=0.65, sloped]{#3}(ProporH-#2);%
+    \draw[-stealth,out=50,in=130] (ProporH-#1) to node[inner sep=0pt, inner xsep=1pt,fill=\colorfill, pos=0.5, sloped]{#3}(ProporH-#2);%
   \end{tikzpicture}%
   \else%
 \begin{tikzpicture}[remember picture,overlay]%
-    \draw[-stealth,out=130,in=50] (ProporH-#1) to node[inner sep=0pt, inner xsep=1pt,fill=\colorfill, pos=0.65, sloped]{#3}(ProporH-#2);%
+    \draw[-stealth,out=130,in=50] (ProporH-#1) to node[inner sep=0pt, inner xsep=1pt,fill=\colorfill, pos=0.5, sloped]{#3}(ProporH-#2);%
   \end{tikzpicture}%
   \fi%
 }%
@@ -6872,11 +7560,11 @@
 \newcommand\FlechesPB[3]{%
   \ifnum\number#1<\number#2\relax%
   \begin{tikzpicture}[remember picture,overlay]%
-    \draw[-stealth,out=-50,in=-130] (ProporB-#1) to node[inner sep=0pt, inner xsep=1pt,fill=\colorfill, pos=0.65, sloped]{#3}(ProporB-#2);%
+    \draw[-stealth,out=-50,in=-130] (ProporB-#1) to node[inner sep=0pt, inner xsep=1pt,fill=\colorfill, pos=0.5, sloped]{#3}(ProporB-#2);%
   \end{tikzpicture}%
   \else%
   \begin{tikzpicture}[remember picture,overlay]%
-    \draw[-stealth,out=-130,in=-50] (ProporB-#1) to node[inner sep=0pt, inner xsep=1pt,fill=\colorfill, pos=0.65, sloped]{#3}(ProporB-#2);%
+    \draw[-stealth,out=-130,in=-50] (ProporB-#1) to node[inner sep=0pt, inner xsep=1pt,fill=\colorfill, pos=0.5, sloped]{#3}(ProporB-#2);%
   \end{tikzpicture}%
   \fi%
 }
@@ -6902,7 +7590,7 @@
 \end{tikzpicture}%
 }%
 
-\newcommand\FlecheCoefDebut[2][1.25\tabcolsep]{%
+\newcommand\FlecheCoefDebut[2][\tabcolsep+\arrayrulewidth]{%
   \begin{tikzpicture}[remember picture, overlay]%
     \node[] (Noeud1) at ($(ProporHD)!0.1!(ProporBD)$) {};%
     \node[] (Noeud2) at ($(ProporHD)!0.9!(ProporBD)$) {};%
@@ -6909,7 +7597,6 @@
     \coordinate[left of=Noeud1,node distance=#1] (noeud1);%
     \coordinate[left of=Noeud2,node distance=#1] (noeud2);%
     \draw[-stealth,out=160,in=-160] (noeud2) to node[midway,left,inner sep=1pt]{#2}(noeud1);%
-    %\draw[red](ProporHD) to (ProporBD);
 \end{tikzpicture}%
 }%
 
@@ -6945,10 +7632,10 @@
 \end{tikzpicture}
 }
 
-%%%%%%%%%%%
-%% Application : pourcentage
-%%%%%%%%%%%
-\setKVdefault[ClesPourcentage]{Appliquer,Calculer=false,Augmenter=false,Reduire=false,Fractionnaire=false,Decimal,Formule=false,Unite=g,Concret=false,GrandeurA=Grandeur A,GrandeurB=Total,MotReduction=diminution,AideTableau=false,ColorFill=white,ColorTab=gray!15}
+%%%
+% Application : pourcentage
+%%%
+\setKVdefault[ClesPourcentage]{Appliquer,Calculer=false,Augmenter=false,Reduire=false,Fractionnaire=false,Decimal,Formule=false,Unite=g,Concret=false,GrandeurA=Grandeur A,GrandeurB=Total,MotReduction=diminution,AideTableau=false,ColorFill=white,CouleurTab=gray!15}
   
 \newcommand\Pourcentage[3][]{%
   \useKVdefault[ClesPourcentage]%
@@ -6955,7 +7642,7 @@
   \setKV[ClesPourcentage]{#1}%
   \ifboolKV[ClesPourcentage]{Reduire}{%
     \ifboolKV[ClesPourcentage]{Formule}{%
-        Réduire une quantité de \num{#2}~\%, cela revient à multiplier cette quantitié par $1-\dfrac{\num{#2}}{100}$. Par conséquent, si on réduit \num{#3}\ifboolKV[ClesPourcentage]{Concret}{~\useKV[ClesPourcentage]{Unite}}{} de \num{#2}~\%, cela donne :
+        Réduire une quantité de \num{#2}~\%, cela revient à multiplier cette quantité par $1-\dfrac{\num{#2}}{100}$. Par conséquent, si on réduit \num{#3}\ifboolKV[ClesPourcentage]{Concret}{~\useKV[ClesPourcentage]{Unite}}{} de \num{#2}~\%, cela donne :
         \[\num{#3}\ifboolKV[ClesPourcentage]{Concret}{~\text{\useKV[ClesPourcentage]{Unite}}}{}\times\left(1-\frac{\num{#2}}{100}\right)=\num{#3}\ifboolKV[ClesPourcentage]{Concret}{~\text{\useKV[ClesPourcentage]{Unite}}}{}\times(1-\num{\fpeval{#2/100}})=\num{#3}\ifboolKV[ClesPourcentage]{Concret}{~\text{\useKV[ClesPourcentage]{Unite}}}{}\times\num{\fpeval{(1-#2/100)}}=\num{\fpeval{#3*(1-#2/100)}}\ifboolKV[ClesPourcentage]{Concret}{~\text{\useKV[ClesPourcentage]{Unite}}}{}\]
       }{%
         Calculons ce que représente la \useKV[ClesPourcentage]{MotReduction} de \num{#2}~\%.
@@ -6962,9 +7649,9 @@
         \ifboolKV[ClesPourcentage]{AideTableau}{%
           \xdef\NomA{\useKV[ClesPourcentage]{GrandeurA}}%
           \xdef\NomB{\useKV[ClesPourcentage]{GrandeurB}}%
-          \xdef\NomColorTab{\useKV[ClesPourcentage]{ColorTab}}%
+          \xdef\NomCouleurTab{\useKV[ClesPourcentage]{CouleurTab}}%
           \begin{center}
-            \Propor[GrandeurA=\NomA,GrandeurB=\NomB,ColorTab=\NomColorTab]{/#3,#2/100}
+            \Propor[GrandeurA=\NomA,GrandeurB=\NomB,CouleurTab=\NomCouleurTab]{/#3,#2/100}
           \end{center}
           \FlecheCoefInv{\tiny$\times\num{\fpeval{#2/100}}$}%
           On obtient une \useKV[ClesPourcentage]{MotReduction} de $\num{\fpeval{#2/100}}\times\num{#3}\ifboolKV[ClesPourcentage]{Concret}{~\text{\useKV[ClesPourcentage]{Unite}}}{}=\num{\fpeval{#3*#2/100}}$\ifboolKV[ClesPourcentage]{Concret}{~\useKV[ClesPourcentage]{Unite}}{}. Donc un total de $\num{#3}\ifboolKV[ClesPourcentage]{Concret}{~\text{\useKV[ClesPourcentage]{Unite}}}{}-\num{\fpeval{#3*#2/100}}\ifboolKV[ClesPourcentage]{Concret}{~\text{\useKV[ClesPourcentage]{Unite}}}{}=\num{\fpeval{#3*(1-#2/100)}}$\ifboolKV[ClesPourcentage]{Concret}{~\useKV[ClesPourcentage]{Unite}}{}.%
@@ -6975,7 +7662,7 @@
   }{%
     \ifboolKV[ClesPourcentage]{Augmenter}{%
       \ifboolKV[ClesPourcentage]{Formule}{%
-        Augmenter de \num{#2}~\% une quantité, cela revient à multiplier cette quantitié par $1+\dfrac{\num{#2}}{100}$. Par conséquent, si on augmente \num{#3}\ifboolKV[ClesPourcentage]{Concret}{~\useKV[ClesPourcentage]{Unite}}{} de \num{#2}~\%, cela donne :
+        Augmenter de \num{#2}~\% une quantité, cela revient à multiplier cette quantité par $1+\dfrac{\num{#2}}{100}$. Par conséquent, si on augmente \num{#3}\ifboolKV[ClesPourcentage]{Concret}{~\useKV[ClesPourcentage]{Unite}}{} de \num{#2}~\%, cela donne :
         \[\num{#3}\ifboolKV[ClesPourcentage]{Concret}{~\text{\useKV[ClesPourcentage]{Unite}}}{}\times\left(1+\frac{\num{#2}}{100}\right)=\num{#3}\ifboolKV[ClesPourcentage]{Concret}{~\text{\useKV[ClesPourcentage]{Unite}}}{}\times(1+\num{\fpeval{#2/100}})=\num{#3}\ifboolKV[ClesPourcentage]{Concret}{~\text{\useKV[ClesPourcentage]{Unite}}}{}\times\num{\fpeval{(1+#2/100)}}=\num{\fpeval{#3*(1+#2/100)}}\ifboolKV[ClesPourcentage]{Concret}{~\text{\useKV[ClesPourcentage]{Unite}}}{}\]
       }{%
         Calculons ce que représente l'augmentation de \num{#2}~\%. %
@@ -6982,9 +7669,9 @@
         \ifboolKV[ClesPourcentage]{AideTableau}{%
           \xdef\NomA{\useKV[ClesPourcentage]{GrandeurA}}%
           \xdef\NomB{\useKV[ClesPourcentage]{GrandeurB}}%
-          \xdef\NomColorTab{\useKV[ClesPourcentage]{ColorTab}}%
+          \xdef\NomCouleurTab{\useKV[ClesPourcentage]{CouleurTab}}%
           \begin{center}%
-            \Propor[GrandeurA=\NomA,GrandeurB=\NomB,ColorTab=\NomColorTab]{/#3,#2/100}%
+            \Propor[GrandeurA=\NomA,GrandeurB=\NomB,CouleurTab=\NomCouleurTab]{/#3,#2/100}%
           \end{center}%
           \FlecheCoefInv{\tiny$\times\num{\fpeval{#2/100}}$}%
           On obtient une augmentation de $\num{\fpeval{#2/100}}\times\num{#3}\ifboolKV[ClesPourcentage]{Concret}{~\text{\useKV[ClesPourcentage]{Unite}}}{}=\num{\fpeval{#3*#2/100}}$\ifboolKV[ClesPourcentage]{Concret}{~\useKV[ClesPourcentage]{Unite}}{}.\\Donc un total de $\num{#3}\ifboolKV[ClesPourcentage]{Concret}{~\text{\useKV[ClesPourcentage]{Unite}}}{}+\num{\fpeval{#3*#2/100}}\ifboolKV[ClesPourcentage]{Concret}{~\text{\useKV[ClesPourcentage]{Unite}}}{}=\num{\fpeval{#3*(1+#2/100)}}$\ifboolKV[ClesPourcentage]{Concret}{~\useKV[ClesPourcentage]{Unite}}{}.%
@@ -6996,8 +7683,8 @@
       \ifboolKV[ClesPourcentage]{Calculer}{%
         \xdef\NomA{\useKV[ClesPourcentage]{GrandeurA}}%
         \xdef\NomB{\useKV[ClesPourcentage]{GrandeurB}}%
-        \xdef\NomColorTab{\useKV[ClesPourcentage]{ColorTab}}%
-        \Propor[GrandeurA=\NomA,GrandeurB=\NomB,ColorTab=\NomColorTab]{#2/#3,/100}%
+        \xdef\NomCouleurTab{\useKV[ClesPourcentage]{CouleurTab}}%
+        \Propor[GrandeurA=\NomA,GrandeurB=\NomB,CouleurTab=\NomCouleurTab]{#2/#3,/100}%
         \xdef\colorfill{\useKV[ClesPourcentage]{ColorFill}}%
         \FlechesPB{2}{1}{\scriptsize$\times\num{\fpeval{#3/100}}$}%
         \FlechesPH{1}{2}{\scriptsize$\div\num{\fpeval{#3/100}}$}%
@@ -7010,10 +7697,10 @@
   }%
 }%
 
-%%%%%%%%%%%%%
-%Lien : ratio
-%%%%%%%%%%%%%
-\setKVdefault[ClesRatio]{Figure=false,Longueur=5cm,TexteTotal=quantité,TextePart=part,Tableau=false,GrandeurA=Grandeur A,GrandeurB=Part(s),Largeur=1cm,Stretch=1,Nom=false,CouleurUn=gris,CouleurDeux=0.5gris+0.5blanc,CouleurTrois=white,ColorTab=gray!15}
+%%%
+% Lien : ratio
+%%%
+\setKVdefault[ClesRatio]{Figure=false,Longueur=5cm,TexteTotal=quantité,TextePart=part,Tableau=false,GrandeurA=Grandeur A,GrandeurB=Part(s),Largeur=1cm,Stretch=1,Nom=false,CouleurUn=gris,CouleurDeux=0.5gris+0.5blanc,CouleurTrois=white,CouleurTab=gray!15}
 
 \newcommand\MPTest[9][]{%
   % #2 : Longueur de la barre unité
@@ -7098,12 +7785,11 @@
     fi;
   \end{mplibcode}
   \else
-  \usempxpackage{simplekv}
   \mpxcommands{%
     \setKVdefault[ClesRatio]{TexteTotal=quantité,TextePart=part}
     \setKV[ClesRatio]{#1}
   }
-  \begin{mpost}[mpsettings={input PfC-Geometrie;}]
+  \begin{mpost}
     vardef RatioTrois(expr long)(text t)=%longueur de la barre / quantité à partager / textepart :) / t le ratio
     pair A,B,C,D;
     A=u*(1,1);
@@ -7189,7 +7875,7 @@
   \foreachitem\compteur\in\ListeRatio{\expandafter\updateratiotoks\compteur\nil}%
   \xdef\LongListe{\ListeRatiolen}%
   \renewcommand{\arraystretch}{\useKV[ClesRatio]{Stretch}}%
-  \begin{tabular}{|>{\columncolor{\useKV[ClesRatio]{ColorTab}}}c|*{\number\numexpr\ListeRatiolen}{>{\centering\arraybackslash}p{\useKV[ClesRatio]{Largeur}}|}l}
+  \begin{tabular}{|>{\columncolor{\useKV[ClesRatio]{CouleurTab}}}c|*{\number\numexpr\ListeRatiolen}{>{\centering\arraybackslash}p{\useKV[ClesRatio]{Largeur}}|}l}
     \ifboolKV[ClesRatio]{Nom}{%
     \hhline{~*{\number\numexpr\ListeRatiolen}{-}}
     \multicolumn{1}{c|}{}\the\tabtoksc\\
@@ -7245,7 +7931,7 @@
     \foreachitem\compteur\in\ListeRatio{\expandafter\UpdateRatio\compteur\nil}%
     \itemtomacro\ListeRatio[1]\NbUn
     \itemtomacro\ListeRatio[2]\NbDeux
-    \xintifboolexpr{\ListeRatiolen>2}{\itemtomacro\ListeRatio[3]\NbTrois}{\newcommand\NbTrois{}}
+    \xintifboolexpr{\ListeRatiolen>2}{\itemtomacro\ListeRatio[3]\NbTrois}{\xdef\NbTrois{}}
     \MPTest[#1]{\useKV[ClesRatio]{Longueur}}{\NbUn}{\NbDeux}{\NbTrois}{\the\toklisteratio}{\useKV[ClesRatio]{CouleurUn}}{\useKV[ClesRatio]{CouleurDeux}}{\useKV[ClesRatio]{CouleurTrois}}%
   }{%
     \ifboolKV[ClesRatio]{Tableau}{%
@@ -7256,9 +7942,9 @@
   }%
 }%
 
-%%%%%%%%%%%%%%%
-%% Cartes Mentales
-%%%%%%%%%%%%%%%
+%%%
+% Cartes Mentales
+%%%
 \setKVdefault[ClesMentales]{Nom={Bulle}, Largeur=5cm, Ancre={0,0},Pointilles=false,CTrace=black,CFond=white,Epaisseur=1pt,Rayon=1}%
 \newenvironment{Mind}{\begin{tikzpicture}}{\end{tikzpicture}}%
 
@@ -7282,9 +7968,9 @@
   }
 }
 
-%%%%%%%%%%%%
+%%%
 % Pptés des droites (6eme)
-%%%%%%%%%%%
+%%%
 \setKVdefault[ClesDroites]{Brouillon=false,CitePropriete=false,Num=1,Figure=false,Remediation=false}
 
 \newcommand\Redaction[4][]{%
@@ -7320,7 +8006,7 @@
           Comme les droites $(\hbox to2em{\dotfill})$ et $(\hbox to2em{\dotfill})$ sont parallèles, alors la droite $(\hbox to2em{\dotfill})$ qui est perpendiculaire à $(\hbox to2em{\dotfill})$ est également perpendiculaire à la droite $(\hbox to2em{\dotfill})$.
         }
       }
-    }%%%%%%%%%%%%%%%%%%%%%
+    }%
   }{%
     \xintifboolexpr{\useKV[ClesDroites]{Num}=1}{%
       \ifboolKV[ClesDroites]{CitePropriete}{%
@@ -7351,11 +8037,11 @@
           Donc les droites $(#2)$ et $(#3)$ sont perpendiculaires.
         }{%
           Comme les droites $(#2)$ et $(#4)$ sont parallèles, alors la droite $(#3)$ qui est perpendiculaire à $(#4)$ est également perpendiculaire à la droite $(#2)$.
-        }
-      }
-    }
-  }
-}
+        }%
+      }%
+    }%
+  }%
+}%
 
 \newcommand\Brouillon[4][]{%
   \setlength{\abovedisplayskip}{0pt}
@@ -7417,10 +8103,10 @@
             \end{array}
           \right\}(#2)\perp(#3)
         \]
-      }
-    }
-  }
-}
+      }%
+    }%
+  }%
+}%
 
 \def\MPFigureDroite#1#2{%
   \ifluatex
@@ -7626,11 +8312,10 @@
   }%
 }%
 
-%%%%%%%%%%%%%%%%%%%%
-%%% Fonction Affine
-%%%%%%%%%%%%%%%%%%%%
-\setKVdefault[ClesAffine]{Nom=f,Variable=x,Ligne=false,Image=false,Antecedent=false,Graphique=false,Retrouve=false,ProgCalcul=false,Unitex=1,Unitey=1,VoirCoef=false,ACoef=0,Redaction=false,Ecriture=false,Definition=false}%ACoefficient=false
-                                %: inutile ?
+%%%
+% Fonction Affine
+%%%
+\setKVdefault[ClesAffine]{Nom=f,Variable=x,Ligne=false,Image=false,Antecedent=false,Graphique=false,Retrouve=false,ProgCalcul=false,Unitex=1,Unitey=1,VoirCoef=false,ACoef=0,Redaction=false,Ecriture=false,Definition=false}%ACoefficient=false%: inutile ?
 
 \newcommand\FonctionAffine[5][]{%
   % #1 nombre ou abscisse premier point
@@ -7641,7 +8326,7 @@
   \setKV[ClesAffine]{#1}%
   \ifboolKV[ClesAffine]{Image}{%
     \ifboolKV[ClesAffine]{Ligne}{%
-      \ensuremath{\useKV[ClesAffine]{Nom}(\num{#2})=\num{#3}\times\xintifboolexpr{#2<0}{(\num{#2})}{\num{#2}}\xintifboolexpr{#4=0}{}{\xintifboolexpr{#4>0}{+\num{#4}}{\num{#4}}}=\num{\fpeval{#2*#3}}\xintifboolexpr{#4=0}{}{\xintifboolexpr{#4>0}{+\num{#4}}{\num{#4}}}\xintifboolexpr{#4=0}{}{=\num{\fpeval{#2*#3+#4}}}}%
+      \ensuremath{\useKV[ClesAffine]{Nom}(\num{#2})=\num{#3}\times\xintifboolexpr{#2<0}{(\num{#2})}{\num{#2}}\xintifboolexpr{#4=0}{}{\xintifboolexpr{#4>0}{+\num{#4}}{-\num{\fpeval{0-#4}}}}=\num{\fpeval{#2*#3}}\xintifboolexpr{#4=0}{}{\xintifboolexpr{#4>0}{+\num{#4}}{-\num{\fpeval{0-#4}}}}\xintifboolexpr{#4=0}{}{=\num{\fpeval{#2*#3+#4}}}}%
     }{%
       \ifboolKV[ClesAffine]{ProgCalcul}{%
         \begin{align*}
@@ -7650,8 +8335,8 @@
         \end{align*}    
       }{%
         \begin{align*}
-          \useKV[ClesAffine]{Nom}(\num{#2})&=\num{#3}\times\xintifboolexpr{#2<0}{(\num{#2})}{\num{#2}}\xintifboolexpr{#4=0}{}{\xintifboolexpr{#4>0}{+\num{#4}}{\num{#4}}}\\
-          \useKV[ClesAffine]{Nom}(\num{#2})&=\num{\fpeval{#3*#2}}\xintifboolexpr{#4=0}{}{\xintifboolexpr{#4>0}{+\num{#4}}{\num{#4}}}%\\
+          \useKV[ClesAffine]{Nom}(\num{#2})&=\num{#3}\times\xintifboolexpr{#2<0}{(\num{#2})}{\num{#2}}\xintifboolexpr{#4=0}{}{\xintifboolexpr{#4>0}{+\num{#4}}{-\num{\fpeval{0-#4}}}}\\
+          \useKV[ClesAffine]{Nom}(\num{#2})&=\num{\fpeval{#3*#2}}\xintifboolexpr{#4=0}{}{\xintifboolexpr{#4>0}{+\num{#4}}{-\num{\fpeval{0-#4}}}}%\\
           \xintifboolexpr{#4=0}{}{\\
           \useKV[ClesAffine]{Nom}(\num{#2})&=\num{\fpeval{#3*#2+#4}}%\\
           }
@@ -7669,17 +8354,20 @@
           \useKV[ClesAffine]{Nom}&:\frac{\num{\fpeval{#2-#4}}}{\num{#3}}\stackrel{\div\xintifboolexpr{#3<0}{(\num{#3})}{\num{#3}}}{\longleftarrow}\num{\fpeval{#2-#4}}\xintifboolexpr{#4=0}{}{\xintifboolexpr{#4>0}{\stackrel{-\num{#4}}{\longleftarrow}}{\stackrel{+\num{\fpeval{0-#4}}}{\longleftarrow}}\num{#2}}
         \end{align*}    
       }{%
-        On cherche l'antécédent de $\num{#2}$ par la fonction $\useKV[ClesAffine]{Nom}$, c'est-à-dire le nombre $\useKV[ClesAffine]{Variable}$ tel que $\useKV[ClesAffine]{Nom}(\useKV[ClesAffine]{Variable})=\num{#2}$. Or, la fonction $\useKV[ClesAffine]{Nom}$ est définie par :
-        \begin{align*}
-          \useKV[ClesAffine]{Nom}&:\useKV[ClesAffine]{Variable}\stackrel{\times\xintifboolexpr{#3<0}{(\num{#3})}{\num{#3}}}{\longrightarrow}\num{#3}\useKV[ClesAffine]{Variable}\xintifboolexpr{#4=0}{}{\xintifboolexpr{#4>0}{\stackrel{+\num{#4}}{\longrightarrow}}{\stackrel{\num{#4}}{\longrightarrow}}\num{#3}\useKV[ClesAffine]{Variable}\xintifboolexpr{#4=0}{}{\xintifboolexpr{#4>0}{+\num{#4}}{\num{#4}}}}
-        \end{align*}
+        On cherche l'antécédent de $\num{#2}$ par la fonction
+        $\useKV[ClesAffine]{Nom}$, c'est-à-dire le nombre
+        $\useKV[ClesAffine]{Variable}$ tel que
+        $\useKV[ClesAffine]{Nom}(\useKV[ClesAffine]{Variable})=\num{#2}$. Or,
+        la fonction $\useKV[ClesAffine]{Nom}$ est définie par : \[%
+          \useKV[ClesAffine]{Nom}(\useKV[ClesAffine]{Variable})=\xintifboolexpr{#3=0}{}{\num{#3}\useKV[ClesAffine]{Variable}}\xintifboolexpr{#3=0}{\num{#4}}{\xintifboolexpr{#4=0}{}{\xintifboolexpr{#4>0}{+\num{#4}}{-\num{\fpeval{0-#4}}}}}
+        \]
         Par conséquent, on a :
         \begin{align*}
-            \num{#3}\useKV[ClesAffine]{Variable}\xintifboolexpr{#4=0}{}{\xintifboolexpr{#4>0}{+\num{#4}}{\num{#4}}}&=\num{#2}\\
-            \xintifboolexpr{#4=0}{\useKV[ClesAffine]{Variable}\uppercase{&}=\frac{\num{#2}}{\num{#3}}
-            }{\num{#3}\useKV[ClesAffine]{Variable}&=\num{\fpeval{#2-#4}}\\
-               \useKV[ClesAffine]{Variable}&=\frac{\num{\fpeval{#2-#4}}}{\num{#3}}
-            }
+            \num{#3}\useKV[ClesAffine]{Variable}\xintifboolexpr{#4=0}{}{\xintifboolexpr{#4>0}{+\num{#4}}{-\num{\fpeval{0-#4}}}}&=\num{#2}\\
+          \xintifboolexpr{#4=0}{\useKV[ClesAffine]{Variable}\uppercase{&}=\frac{\num{#2}}{\num{#3}}%\\
+          }{\num{#3}\useKV[ClesAffine]{Variable}&=\num{\fpeval{#2-#4}}\\
+          \useKV[ClesAffine]{Variable}&=\frac{\num{\fpeval{#2-#4}}}{\num{#3}}%\\
+          }
         \end{align*}
       }%
     }{%
@@ -7716,16 +8404,15 @@
   \ifboolKV[ClesAffine]{Redaction}{%
     \xintifboolexpr{#2=0}{Comme la fonction $\useKV[ClesAffine]{Nom}$
       est une fonction constante, alors sa représentation graphique est une droite parallèle à l'axe des abscisses passant par le point de coordonnées $(0;\num{#3})$.}%
-    {\xintifboolexpr{#3=0}{Comme              la              fonction
-        $\useKV[ClesAffine]{Nom}$ est une fonction linéaire, alors sa représentation graphique est une droite passant par l'origine du repère.\\Je choisis $\useKV[ClesAffine]{Variable}=\num{#4}$. Son image est \xdef\NomFonctionA{\useKV[ClesAffine]{Nom}}\FonctionAffine[Nom=\NomFonctionA,Image,Ligne]{#4}{#2}{#3}{#5}. On place le point de coordonnées $(\num{#4};\num{\fpeval{#2*#4+#3}})$.
+    {\xintifboolexpr{#3=0}{Comme la fonction $\useKV[ClesAffine]{Nom}$ est une fonction linéaire, alors sa représentation graphique est une droite passant par l'origine du repère.\\Je choisis $\useKV[ClesAffine]{Variable}=\num{#4}$. Son image est \xdef\NomFonctionA{\useKV[ClesAffine]{Nom}}\FonctionAffine[Nom=\NomFonctionA,Image,Ligne]{#4}{#2}{#3}{#5}. On place le point de coordonnées $(\num{#4};\num{\fpeval{#2*#4+#3}})$.
       }{%
-        Comme $\useKV[ClesAffine]{Nom}$ est une fonction affine, alors sa représentation graphique est une droite.\\Je choisis $\useKV[ClesAffine]{Variable}=\num{#4}$. Son image est \xdef\NomFonction{\useKV[ClesAffine]{Nom}}\FonctionAffine[Nom=\NomFonction,Image,Ligne]{#4}{#2}{#3}{#5}. On place le point de coordonnées $(\num{#4};\num{\fpeval{#2*#4+#3}})$.\\Je choisis $\useKV[ClesAffine]{Variable}=\num{#5}$. Son image est \FonctionAffine[Nom=\NomFonction,Image,Ligne]{#5}{#2}{#3}{#4}. On place le point de coordonnées $(\num{#5};\num{\fpeval{#2*#5+#3}})$.%        
+        Comme $\useKV[ClesAffine]{Nom}$ est une fonction affine, alors sa représentation graphique est une droite.\\Je choisis $\useKV[ClesAffine]{Variable}=\num{#4}$. Son image est \xdef\NomVariable{\useKV[ClesAffine]{Variable}}\xdef\NomFonction{\useKV[ClesAffine]{Nom}}\FonctionAffine[Nom=\NomFonction,Image,Ligne]{#4}{#2}{#3}{#5}. On place le point de coordonnées $(\num{#4};\num{\fpeval{#2*#4+#3}})$.\\Je choisis \setKV[ClesAffine]{Variable=\NomVariable}$\useKV[ClesAffine]{Variable}=\num{#5}$. Son image est \FonctionAffine[Nom=\NomFonction,Image,Ligne]{#5}{#2}{#3}{#4}. On place le point de coordonnées $(\num{#5};\num{\fpeval{#2*#5+#3}})$.%        
       }%
     }%
   }%
   {}%
-  \ifboolKV[ClesAffine]{Ecriture}{\ensuremath{\useKV[ClesAffine]{Nom}(\useKV[ClesAffine]{Variable})=\xintifboolexpr{#2=0}{}{\num{#2}\useKV[ClesAffine]{Variable}}\xintifboolexpr{#2=0}{\num{#3}}{\xintifboolexpr{#3=0}{}{\xintifboolexpr{#3>0}{+\num{#3}}{\num{#3}}}}}}{}%
-  \ifboolKV[ClesAffine]{Definition}{\ensuremath{\useKV[ClesAffine]{Nom}:\useKV[ClesAffine]{Variable}\mapsto\xintifboolexpr{#2=0}{}{\num{#2}\useKV[ClesAffine]{Variable}}\xintifboolexpr{#2=0}{\num{#3}}{\xintifboolexpr{#3=0}{}{\xintifboolexpr{#3>0}{+\num{#3}}{\num{#3}}}}}}{}%
+  \ifboolKV[ClesAffine]{Ecriture}{\ensuremath{\useKV[ClesAffine]{Nom}(\useKV[ClesAffine]{Variable})=\xintifboolexpr{#2=0}{}{\num{#2}\useKV[ClesAffine]{Variable}}\xintifboolexpr{#2=0}{\num{#3}}{\xintifboolexpr{#3=0}{}{\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}}}}}{}%
+  \ifboolKV[ClesAffine]{Definition}{\ensuremath{\useKV[ClesAffine]{Nom}:\useKV[ClesAffine]{Variable}\mapsto\xintifboolexpr{#2=0}{}{\num{#2}\useKV[ClesAffine]{Variable}}\xintifboolexpr{#2=0}{\num{#3}}{\xintifboolexpr{#3=0}{}{\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}}}}}{}%
 }%
 
 \def\MPFonctionAffine#1#2#3#4#5#6#7{%
@@ -7987,30 +8674,228 @@
 }
 
 
-%%%%%%%%%%%%%%%
+%%%
 % Fonction
-%%%%%%%%%%%%%%%
-\setKVdefault[ClesFonction]{Nom=f,Variable=x,Calcul=x,Tableau=false,Largeur=5mm,Ecriture=false,Definition=false}
+%%%
+\setKVdefault[ClesFonction]{Nom=f,Variable=x,Calcul=x,Tableau=false,Largeur=5mm,Ecriture=false,Definition=false,Points=false,Tangentes=false,PasX=1,PasY=1,UniteX=1,UniteY=1,Prolonge=false}
 
+\newtoks\toklistePtsFn%pour la discipline
+
+\def\UpdatePtsFn#1/#2/#3/#4\nil{\addtotok\toklistePtsFn{#1,(#2,#3),#4,}}%
+\def\UpdatePtsFN#1/#2/#3/#4\nil{\addtotok\toklistePtsFn{(#2,#3),}}%
+
+\def\MPCourbePoints#1#2#3#4#5#6{%
+  % #1 la liste des points
+  % #2: pas en x
+  % #3: pas en y
+  % #4: unité en x
+  % #5: unité en y
+  % #6 : prolongement avant et après les premier et dernier points ?
+  \ifluatex
+  \mplibforcehmode
+  \begin{mplibcode}
+    x.u:=#2;
+    y.u:=#3;
+    X.u:=#4;
+    Y.u:=#5;
+    numeric dirav[],dirap[];
+    pair Fn[],Gn[];
+    n=0;
+    for p_=#1:
+    Gn[n]=p_;
+    Fn[n]=cm*(X.u*xpart(p_),Y.u*ypart(p_));
+    n:=n+1;
+    endfor;
+    N:=(n-1);
+    MinX=999;
+    MaxX=-999;
+    MinY=999;
+    MaxY=-999;
+    for k=0 upto N:
+    if xpart(Gn[k])<MinX:
+    MinX:=xpart(Gn[k]);
+    fi;
+    if xpart(Gn[k])>MaxX:
+    MaxX:=xpart(Gn[k]);
+    fi;
+    if ypart(Gn[k])<MinY:
+    MinY:=ypart(Gn[k]);
+    fi;
+    if ypart(Gn[k])>MaxY:
+    MaxY:=ypart(Gn[k]);
+    fi;
+    endfor;
+    if #6=0:
+    for k=MinY-1 step y.u until MaxY+1:
+    draw cm*((MinX-1)*X.u,k*Y.u)--cm*((MaxX+1)*X.u,k*Y.u) withcolor 0.75white;
+    endfor;
+    for k=MinX-1 step x.u until MaxX+1:
+    draw cm*(k*X.u,(MinY-1)*Y.u)--cm*(k*X.u,(MaxY+1)*Y.u) withcolor 0.75white;
+    endfor;
+    else:
+    for k=MinY-1 step y.u until MaxY+1:
+    draw cm*((MinX)*X.u,k*Y.u)--cm*((MaxX)*X.u,k*Y.u) withcolor 0.75white;
+    endfor;
+    for k=MinX step x.u until MaxX:
+    draw cm*(k*X.u,(MinY-1)*Y.u)--cm*(k*X.u,(MaxY+1)*Y.u) withcolor 0.75white;
+    endfor;
+    fi;
+    if #6=0:
+    for k=0 upto N:
+    fill cercles(Fn[k],0.5mm);
+    endfor;
+    else:
+    for k=1 upto N-1:
+    fill cercles(Fn[k],0.5mm);
+    endfor;
+    fi;
+    if #6=0:
+    drawarrow (0,(MinY-1)*Y.u*cm)--(0,(MaxY+1)*Y.u*cm);
+    drawarrow ((MinX-1)*X.u*cm,0)--((MaxX+1)*X.u*cm,0);
+    else:
+    drawarrow (0,(MinY-1)*Y.u*cm)--(0,(MaxY+1)*Y.u*cm);
+    drawarrow ((MinX)*X.u*cm,0)--((MaxX)*X.u*cm,0);
+    fi;
+    label.llft(btex O etex,(0,0));
+    dotlabel.bot(btex 1 etex,cm*X.u*(1,0));
+    dotlabel.lft(btex 1 etex,cm*Y.u*(0,1));
+    draw Fn[0]
+    for k=1 upto N:
+    ..Fn[k]
+    endfor;
+  \end{mplibcode}
+  \fi
+}
+
+\def\MPCourbe#1#2#3#4#5#6{%
+  \ifluatex
+  \mplibforcehmode
+  \begin{mplibcode}
+    x.u:=#2;
+    y.u:=#3;
+    X.u:=#4;
+    Y.u:=#5;
+    numeric dirav[],dirap[];
+    pair Fn[],Gn[];
+    n=0;
+    for p_=#1:
+    if (n mod 3)=0:
+    dirav[n div 3]=p_;
+    fi;
+    if (n mod 3)=1:
+    Gn[n div 3]=p_;
+    Fn[n div 3]=cm*(X.u*xpart(p_),Y.u*ypart(p_));
+    fi;
+    if (n mod 3)=2:
+    dirap[n div 3]=p_;
+    fi;
+    n:=n+1;
+    endfor;
+    N:=(n-1) div 3;
+    MinX=999;
+    MaxX=-999;
+    MinY=999;
+    MaxY=-999;
+    for k=0 upto N:
+    if xpart(Gn[k])<MinX:
+    MinX:=xpart(Gn[k]);
+    fi;
+    if xpart(Gn[k])>MaxX:
+    MaxX:=xpart(Gn[k]);
+    fi;
+    if ypart(Gn[k])<MinY:
+    MinY:=ypart(Gn[k]);
+    fi;
+    if ypart(Gn[k])>MaxY:
+    MaxY:=ypart(Gn[k]);
+    fi;
+    endfor;
+        if #6=0:
+    for k=MinY-1 step y.u until MaxY+1:
+    draw cm*((MinX-1)*X.u,k*Y.u)--cm*((MaxX+1)*X.u,k*Y.u) withcolor 0.75white;
+    endfor;
+    for k=MinX-1 step x.u until MaxX+1:
+    draw cm*(k*X.u,(MinY-1)*Y.u)--cm*(k*X.u,(MaxY+1)*Y.u) withcolor 0.75white;
+    endfor;
+    else:
+    for k=MinY-1 step y.u until MaxY+1:
+    draw cm*((MinX)*X.u,k*Y.u)--cm*((MaxX)*X.u,k*Y.u) withcolor 0.75white;
+    endfor;
+    for k=MinX step x.u until MaxX:
+    draw cm*(k*X.u,(MinY-1)*Y.u)--cm*(k*X.u,(MaxY+1)*Y.u) withcolor 0.75white;
+    endfor;
+    fi;
+    if #6=0:
+    for k=0 upto N:
+    fill cercles(Fn[k],0.5mm);
+    endfor;
+    else:
+    for k=1 upto N-1:
+    fill cercles(Fn[k],0.5mm);
+    endfor;
+    fi;
+    if #6=0:
+    drawarrow (0,(MinY-1)*Y.u*cm)--(0,(MaxY+1)*Y.u*cm);
+    drawarrow ((MinX-1)*X.u*cm,0)--((MaxX+1)*X.u*cm,0);
+    else:
+    drawarrow (0,(MinY-1)*Y.u*cm)--(0,(MaxY+1)*Y.u*cm);
+    drawarrow ((MinX)*X.u*cm,0)--((MaxX)*X.u*cm,0);
+    fi;
+    label.llft(btex O etex,(0,0));
+    dotlabel.bot(btex 1 etex,cm*X.u*(1,0));
+    dotlabel.lft(btex 1 etex,cm*Y.u*(0,1));
+    draw Fn[0]{dir dirap[0]}
+    for k=1 upto (N-1):
+    ..{dir dirav[k]}Fn[k]{dir dirap[k]}
+    endfor
+    ..{dir dirav[N]}Fn[N];
+  \end{mplibcode}
+  \fi
+}
+
 \newcommand{\Fonction}[2][]{%
   \useKVdefault[ClesFonction]
   \setKV[ClesFonction]{#1}
-  \ignoreemptyitems%
-  \readlist*\ListeFonction{#2}
-  \StrSubstitute{\useKV[ClesFonction]{Calcul}}{\useKV[ClesFonction]{Variable}}{\i}[\temp]%
-  
-  \StrSubstitute{\useKV[ClesFonction]{Calcul}}{**}{^}[\tempa]%
-  \StrSubstitute{\tempa}{*}{}[\tempab]%
-  \ifboolKV[ClesFonction]{Ecriture}{%
-    \ensuremath{\useKV[ClesFonction]{Nom}(\useKV[ClesFonction]{Variable})=\tempab}
-  }{}%
-  \ifboolKV[ClesFonction]{Definition}{%
-    \ensuremath{\useKV[ClesFonction]{Nom}:\useKV[ClesFonction]{Variable}\mapsto\tempab}
-  }{}%
-  \ifboolKV[ClesFonction]{Tableau}{%
-    \buildtabfonction%
-    }{}
-}
+  \ifboolKV[ClesFonction]{Points}{%
+    \toklistePtsFn{}%
+    \setsepchar[*]{,*/}%\ignoreemptyitems%
+    \readlist*\ListePoints{#2}%
+    \ifboolKV[ClesFonction]{Tangentes}{%
+      \foreachitem\compteur\in\ListePoints{%
+        \expandafter\UpdatePtsFn\compteur\nil%
+      }%
+      \ifboolKV[ClesFonction]{Prolonge}{%
+        \MPCourbe{\the\toklistePtsFn}{\useKV[ClesFonction]{PasX}}{\useKV[ClesFonction]{PasY}}{\useKV[ClesFonction]{UniteX}}{\useKV[ClesFonction]{UniteY}}{1}%
+      }{%
+        \MPCourbe{\the\toklistePtsFn}{\useKV[ClesFonction]{PasX}}{\useKV[ClesFonction]{PasY}}{\useKV[ClesFonction]{UniteX}}{\useKV[ClesFonction]{UniteY}}{0}%
+      }%
+    }{%
+      \foreachitem\compteur\in\ListePoints{%
+        \expandafter\UpdatePtsFN\compteur\nil%
+      }%
+      \ifboolKV[ClesFonction]{Prolonge}{%
+        \MPCourbePoints{\the\toklistePtsFn}{\useKV[ClesFonction]{PasX}}{\useKV[ClesFonction]{PasY}}{\useKV[ClesFonction]{UniteX}}{\useKV[ClesFonction]{UniteY}}{1}%
+      }{%
+        \MPCourbePoints{\the\toklistePtsFn}{\useKV[ClesFonction]{PasX}}{\useKV[ClesFonction]{PasY}}{\useKV[ClesFonction]{UniteX}}{\useKV[ClesFonction]{UniteY}}{0}%
+      }%
+    }%
+  }{%
+    \ignoreemptyitems%
+    \readlist*\ListeFonction{#2}
+    \StrSubstitute{\useKV[ClesFonction]{Calcul}}{\useKV[ClesFonction]{Variable}}{\i}[\temp]%
+    \StrSubstitute{\useKV[ClesFonction]{Calcul}}{**}{^}[\tempa]%
+    \StrSubstitute{\tempa}{*}{}[\tempab]%
+    \ifboolKV[ClesFonction]{Ecriture}{%
+      \ensuremath{\useKV[ClesFonction]{Nom}(\useKV[ClesFonction]{Variable})=\tempab}
+    }{}%
+    \ifboolKV[ClesFonction]{Definition}{%
+      \ensuremath{\useKV[ClesFonction]{Nom}:\useKV[ClesFonction]{Variable}\mapsto\tempab}
+    }{}%
+    \ifboolKV[ClesFonction]{Tableau}{%
+      \buildtabfonction%
+    }{}%
+  }%
+}%
 
 \def\buildtabfonction{%\\
   \[%
@@ -8018,16 +8903,16 @@
       \hline
       \useKV[ClesFonction]{Variable}\xintFor* ##1 in {\xintSeq {1}{\ListeFonctionlen}}\do{&\num{\ListeFonction[##1]}}\\
       \hline
-      \useKV[ClesFonction]{Nom}(\useKV[ClesFonction]{Variable})\xintFor* ##1 in {\xintSeq {1}{\ListeFonctionlen}}\do{&  \StrSubstitute{\useKV[ClesFonction]{Calcul}}{\useKV[ClesFonction]{Variable}}{\ListeFonction[##1]}[\tempab]\num{\fpeval{\tempab}}}
+      \useKV[ClesFonction]{Nom}(\useKV[ClesFonction]{Variable})\xintFor* ##1 in {\xintSeq {1}{\ListeFonctionlen}}\do{&  \StrSubstitute{\useKV[ClesFonction]{Calcul}}{\useKV[ClesFonction]{Variable}}{(\ListeFonction[##1])}[\tempab]\num{\fpeval{\tempab}}}
       \\\hline
     \end{array}
   \]
 }
 
-%%%%%%%
-%% Formules
-%%%%%%
-\setKVdefault[ClesFormule]{Perimetre=false,Aire=false,Volume=false,Surface=carré,Solide=pavé droit,Figure=false,Angle=0,Ancre={(0,0)},Largeur=5cm}
+%%%
+% Formules
+%%%
+\setKVdefault[ClesFormule]{Perimetre=false,Aire=false,Volume=false,Surface=carré,Solide=pavé,Angle=0,Ancre={(0,0)},Largeur=5cm,Couleur=white}
 
 \def\MPFigureCarre{%
   \ifluatex
@@ -8496,7 +9381,6 @@
   \mplibforcehmode
   \begin{mplibcode}
     drawoptions( dashed dashpattern(on1cm));
-    %    Figure(-10u,-10u,10u,10u);
     u:=0.5cm;
     z0=(-0.5,0)*u;
     z1=(2.5,0.5)*u;
@@ -8788,7 +9672,6 @@
   \mplibforcehmode
   \begin{mplibcode}
     drawoptions( dashed dashpattern(on1cm));
-    % Figure(-5u,-5u,5u,5u);
     pair A,B,C,H,I,J;
     A=u*(0.5,1);
     B-A=u*(1.4,0);
@@ -8866,12 +9749,13 @@
 }
 
 \newcommand\Formule[1][]{%
-  \useKVdefault[ClesFormule]
-  \setKV[ClesFormule]{#1}
-  \setlength{\RoundedBoxWidth}{\useKV[ClesFormule]{Largeur}}
+  \useKVdefault[ClesFormule]%
+  \setKV[ClesFormule]{#1}%
+  \setlength{\RoundedBoxWidth}{\useKV[ClesFormule]{Largeur}}%
+  \xdef\ColorFill{\useKV[ClesFormule]{Couleur}}%
   \ifboolKV[ClesFormule]{Perimetre}{%
     \begin{tikzpicture}[remember picture, overlay]
-      \node[draw,dashed,rounded corners,rotate={\useKV[ClesFormule]{Angle}}] (test) at \useKV[ClesFormule]{Ancre} {\begin{minipage}{\RoundedBoxWidth}%
+      \node[draw,fill=\ColorFill,dashed,rounded corners,rotate={\useKV[ClesFormule]{Angle}}] (test) at \useKV[ClesFormule]{Ancre} {\begin{minipage}{\RoundedBoxWidth}%
           \IfStrEqCase{\useKV[ClesFormule]{Surface}}{%
             {carré}{\begin{center}
                 \MPFigureCarre\par
@@ -8883,7 +9767,7 @@
                 Périmètre d'un polygone : \par$\text{Somme des côtés}$
               \end{center}
             }%
-            {rectangle}{
+            {rectangle}{%
               \begin{center}
                 \MPFigureRectangle\par
                 Périmètre d'un rectangle : \par$2\times(L+\ell)$
@@ -8907,7 +9791,7 @@
                 Périmètre d'un cercle : \par$\pi\times\text{diamètre}$
               \end{center}
             }%
-            {parallélogramme}{
+            {parallélogramme}{%
               \begin{center}
                 \MPFigureParallelogramme\par
                 Périmètre d'un parallélogramme : \par Somme des côtés
@@ -8917,7 +9801,7 @@
     \end{tikzpicture}
   }{\ifboolKV[ClesFormule]{Aire}{%
       \begin{tikzpicture}[remember picture, overlay]
-        \node[draw,dashed,rounded corners=2,rotate={\useKV[ClesFormule]{Angle}}] (test) at \useKV[ClesFormule]{Ancre} {\begin{minipage}{\RoundedBoxWidth}%
+        \node[draw,fill=\ColorFill,dashed,rounded corners=2,rotate={\useKV[ClesFormule]{Angle}}] (test) at \useKV[ClesFormule]{Ancre} {\begin{minipage}{\RoundedBoxWidth}%
             \IfStrEqCase{\useKV[ClesFormule]{Surface}}{%
               {carré}{\begin{center}
                   \MPFigureCarre\par
@@ -8963,7 +9847,7 @@
     \end{tikzpicture}
     }{%Volume
       \begin{tikzpicture}[remember picture, overlay]
-        \node[draw,dashed,rounded corners=2,rotate={\useKV[ClesFormule]{Angle}}] (test) at \useKV[ClesFormule]{Ancre} {\begin{minipage}{\RoundedBoxWidth}%
+        \node[draw,fill=\ColorFill,dashed,rounded corners=2,rotate={\useKV[ClesFormule]{Angle}}] (test) at \useKV[ClesFormule]{Ancre} {\begin{minipage}{\RoundedBoxWidth}%
             \IfStrEqCase{\useKV[ClesFormule]{Solide}}{%
               {boule}{\begin{center}
                 \MPFigureSphere\par
@@ -9012,10 +9896,10 @@
   }
 }
 
-%%%%%%%%%%
-%%% Proba
-%%%%%%%%%%
-\setKVdefault[ClesProba]{Echelle=false,Arbre=false,Branche=2,Angle=60,Rayon=0.25,LongueurEchelle=5,Affichage=0,Grille=0}
+%%%
+% Proba
+%%%
+\setKVdefault[ClesProba]{Echelle=false,Arbre=false,Branche=2,Angle=60,Rayon=0.25,LongueurEchelle=5,Affichage=0,Grille=1}
 
 \def\Updatetoksproba#1/#2\nil{\addtotok\toklistepointproba{"#1","\footnotesize #2",}}
 \def\Updatetoksprobaechelle#1/#2/#3\nil{\addtotok\toklistepointproba{#1,#2,"#3",}}
@@ -9091,7 +9975,7 @@
             dotlabel.top("",C[k]);
           fi;
           if (#3>2):
-            label.bot(TEX("$\frac{"&decimal(num)&"}{"&decimal(deno)&"}$"),C[k]-u*(0,0.5));%Le \noexpand est nécessaire pour éviter un problème à la compilation, dû à l'expansion du \frac par gmp.
+            label.bot(TEX("$\frac{"&decimal(num)&"}{"&decimal(deno)&"}$"),C[k]-u*(0,0.5));
           fi;
           k:=k+1;
         fi;
@@ -9271,10 +10155,10 @@
   }
 }
 
-%%%%%%%%%%%%%%
-%%%Reperage
-%%%%%%%%%%%%%%
-\setKVdefault[ClesReperage]{Unitex=1,Pasx=1,Unitey=1,Pasy=1,Unitez=1,Pasz=1,DemiDroite=false,Droite=false,Plan=false,Trace=false,ListeSegment={},Espace=false,Sphere=false,AffichageNom=false,AffichageCoord=false,ValeurUnitex=1,ValeurUnitey=1,ValeurOrigine=0,EchelleEspace=50,CouleurCoord=black}
+%%%
+% Reperage
+%%%
+\setKVdefault[ClesReperage]{Unitex=1,Pasx=1,Unitey=1,Pasy=1,Unitez=1,Pasz=1,DemiDroite=false,Droite=false,Plan=false,Trace=false,ListeSegment={},Espace=false,Sphere=false,AffichageNom=false,AffichageGrad=false,AffichageAbs=0,AffichageCoord=false,LectureCoord=false,ValeurUnitex=1,ValeurUnitey=1,ValeurOrigine=0,NomOrigine=O,EchelleEspace=50,CouleurCoord=black}
 % ValeurOrigine permet de faire des morceaux de demi-droite graduée en passant par droite :)
 
 \def\Updatetoksdroite#1/#2\nil{\addtotok\toklistepointdroite{#1,"#2",}}
@@ -9565,46 +10449,44 @@
 }%
 
 % Pour construire le repère du plan
-\def\buildrepere{%
+\def\buildreperenew{%
   \toklistepointrepere{}%
   \foreachitem\compteur\in\ListePointRepere{\expandafter\Updatetoksrepere\compteur\nil}%
   \ifboolKV[ClesReperage]{Trace}{%
     \[\MPPlanTrace{\useKV[ClesReperage]{Unitex}}{\useKV[ClesReperage]{Pasx}}{\useKV[ClesReperage]{Unitey}}{\useKV[ClesReperage]{Pasy}}{\the\toklistepointrepere}{2}{\useKV[ClesReperage]{ValeurUnitex}}{\useKV[ClesReperage]{ValeurUnitey}}{\useKV[ClesReperage]{ListeSegment}}\]%
   }{%
-    \ifboolKV[ClesReperage]{AffichageNom}{%
-      \ifboolKV[ClesReperage]{AffichageCoord}{%
-        \[\MPPlan{\useKV[ClesReperage]{Unitex}}{\useKV[ClesReperage]{Pasx}}{\useKV[ClesReperage]{Unitey}}{\useKV[ClesReperage]{Pasy}}{\the\toklistepointrepere}{3}{\useKV[ClesReperage]{ValeurUnitex}}{\useKV[ClesReperage]{ValeurUnitey}}\]%
-      }{%
-        \[\MPPlan{\useKV[ClesReperage]{Unitex}}{\useKV[ClesReperage]{Pasx}}{\useKV[ClesReperage]{Unitey}}{\useKV[ClesReperage]{Pasy}}{\the\toklistepointrepere}{2}{\useKV[ClesReperage]{ValeurUnitex}}{\useKV[ClesReperage]{ValeurUnitey}}\]%
-      }
-    }{%
-      \ifboolKV[ClesReperage]{AffichageCoord}{%
-        \[\MPPlan{\useKV[ClesReperage]{Unitex}}{\useKV[ClesReperage]{Pasx}}{\useKV[ClesReperage]{Unitey}}{\useKV[ClesReperage]{Pasy}}{\the\toklistepointrepere}{1}{\useKV[ClesReperage]{ValeurUnitex}}{\useKV[ClesReperage]{ValeurUnitey}}\]%
-      }{%
-        \[\MPPlan{\useKV[ClesReperage]{Unitex}}{\useKV[ClesReperage]{Pasx}}{\useKV[ClesReperage]{Unitey}}{\useKV[ClesReperage]{Pasy}}{\the\toklistepointrepere}{0}{\useKV[ClesReperage]{ValeurUnitex}}{\useKV[ClesReperage]{ValeurUnitey}}\]%
-      }
-    }%
+    \xdef\AfficheNom{0}\ifboolKV[ClesReperage]{AffichageNom}{\ifboolKV[ClesReperage]{LectureCoord}{\xdef\AfficheNom{3}}{\xdef\AfficheNom{2}}}{\ifboolKV[ClesReperage]{LectureCoord}{\xdef\AfficheNom{1}}{}}%
+    \xdef\AfficheGrad{0}\ifboolKV[ClesReperage]{AffichageGrad}{\xdef\AfficheGrad{1}}{}%
+    \xdef\AfficheCoord{\useKV[ClesReperage]{AffichageAbs}}%
+    \MPPlannew{(\useKV[ClesReperage]{Unitex},\useKV[ClesReperage]{Pasx})}{(\useKV[ClesReperage]{Unitey},\useKV[ClesReperage]{Pasy})}{\the\toklistepointrepere}{\AfficheNom}{\AfficheCoord}{\AfficheGrad}{(\useKV[ClesReperage]{ValeurUnitex},\useKV[ClesReperage]{ValeurUnitey})}%
   }%
 }
 
-\def\MPPlan#1#2#3#4#5#6#7#8{%
+\def\MPPlannew#1#2#3#4#5#6#7{%
+  %#1 : Unitex, pasx
+  %#2 : unitey, pasy
+  %#3 : liste de points
+  %#4 : Affichage nom + lecture graphique
+  %#5 : Affichage des (abscisses/ordonnées)
+  %#6 : Graduation complète ?
+  %#7 : (unitex,unitey)
   \ifluatex
   \begin{mplibcode}
     maxx:=-4000;
-  minx=4000;
-  unitex:=#1*cm;
-  pasx=#2;
-  unitpx:=unitex/pasx;
-  maxy:=-4000;
-  miny:=4000;
-  unitey:=#3*cm;
-  pasy:=#4;
-  unitpy:=unitey/pasy;
-  n:=1;
-  vardef toto(text t)=
+    minx=4000;
+    unitex:=(xpart(#1))*cm;
+    pasx=ypart(#1);
+    unitpx:=unitex/pasx;
+    maxy:=-4000;
+    miny:=4000;
+    unitey:=(xpart(#2))*cm;
+    pasy:=ypart(#2);
+    unitpy:=unitey/pasy;
+    n:=1;
+    vardef toto(text t)=
     for p_=t:
     if (n mod 3)=1:
-      if p_>maxx:
+    if p_>maxx:
         maxx:=p_;
       fi;
       if p_<minx:
@@ -9623,22 +10505,22 @@
     endfor;
     maxx:=maxx+1;
     minx:=minx-1;
-    if maxx<(#2+1):
-    maxx:=#2+1;
+    if maxx<(ypart(#1)+1):
+    maxx:=ypart(#1)+1;
     fi;
-    if minx>(-#2-1):
-    minx:=-#2-1;
+    if minx>(-ypart(#1)-1):
+    minx:=-ypart(#1)-1;
     fi;
     maxy:=maxy+1;
     miny:=miny-1;
-    if maxy<(#4+1):
-    maxy:=#2+1;
+    if maxy<(ypart(#2)+1):
+    maxy:=ypart(#2)+1;
     fi;
-    if miny>(-#4-1):
-    miny:=-#4-1;
+    if miny>(-ypart(#2)-1):
+    miny:=-ypart(#2)-1;
     fi;
     enddef;
-    toto(#5);
+    toto(#3);
     Figure((minx-1)*unitpx,(miny-1)*unitpy,(maxx+1)*unitpx,(maxy+1)*unitpy);
     pair A,B,C,D,E;
     A=(0,0);
@@ -9654,14 +10536,32 @@
     endfor;
     drawarrow (B+(-0.75*unitpx,0))--(C+(0.75*unitpx,0));
     drawarrow (D+(0,-0.75*unitpy))--(E+(0,0.75*unitpy));
-    dotlabel.bot(TEX("\footnotesize\num{"&decimal(#7)&"}"),(unitex,0));
-    dotlabel.lft(TEX("\footnotesize\num{"&decimal(#8)&"}"),(0,unitey));
-    label.llft(btex 0 etex,A);
+    % graduation complète ou pas ?
+    label.llft(btex \footnotesize 0 etex,A);
+    if #6>0:
+    for k=minx upto maxx:
+    if (xpart((k*unitex,0))>xpart(B+(-0.75*unitpx,0))) and (xpart((k*unitex,0))<xpart(C+(0.75*unitpx,0))):
+    if k<>0:
+    dotlabel.lrt(TEX("\footnotesize\num{"&decimal(k)&"}"),(k*unitex,0));
+    fi;
+    fi;
+    endfor;
+    for k=miny upto maxy:
+    if (ypart((0,k*unitey))>ypart(D+(0,-0.75*unitpy))) and (ypart((0,k*unitey))<ypart(E+(0,0.75*unitpy))):
+    if k<>0:
+    dotlabel.ulft(TEX("\footnotesize\num{"&decimal(k)&"}"),(0,k*unitey));
+    fi;
+    fi;
+    endfor;
+    else:
+    dotlabel.lrt(TEX("\footnotesize\num{"&decimal(xpart(#7))&"}"),(unitex,0));
+    dotlabel.ulft(TEX("\footnotesize\num{"&decimal(ypart(#7))&"}"),(0,unitey));
+    fi;
     % apparition du nom des points ou pas
     m_c:=m_c*3;
     marque_p:="croix";
     vardef tata(text t)=%on place les points
-    if #6>0:
+    if #4>0:
     n:=1;
     k:=0;%pour retenir la coordonnée en x
     l:=0;%pour retenir la coordonnée en y
@@ -9677,15 +10577,14 @@
     fi;
     fi;
     if (n mod 3)=0:
-    if #6>1:
-    message("p = "&p_);
-  %  if p_<>"":
+    if #4>1:
+    if p_<>"":
     if (k>0) and (l>0):
     label.urt(TEX(p_),(k*unitpx,l*unitpy));
     fi;
-   if (k=0) and (l>0):
-   label.urt(TEX(p_),(k*unitpx,l*unitpy));
-   fi;
+    if (k=0) and (l>0):
+    label.urt(TEX(p_),(k*unitpx,l*unitpy));
+    fi;
     if (k>0) and (l=0):
     label.urt(TEX(p_),(k*unitpx,l*unitpy));
     fi;
@@ -9705,9 +10604,9 @@
     label.lrt(TEX(p_),(k*unitpx,l*unitpy));
     fi;
     pointe((k*unitpx,l*unitpy));
- %   fi;
     fi;
-    if (#6=1) or (#6=3):
+    fi;
+    if (#4=1) or (#4=3):
     draw (0,l*unitpy)--(k*unitpx,l*unitpy)--(k*unitpx,0) dashed evenly;
     fi;
     fi;
@@ -9714,26 +10613,83 @@
     n:=n+1;
     endfor;
     fi;
+    if #5=2:
+    n:=1;
+    k:=0;%pour retenir la coordonnée en x
+    l:=0;%pour retenir la coordonnée en y
+    for p_=t:
+        if (n mod 3)=1:
+    if numeric p_:
+    k:=p_;
+    fi;
+    fi;
+    if (n mod 3)=2:
+    if numeric p_:
+    l:=p_;
+    fi;
+    fi;
+    if (n mod 3)=0:
+    if p_<>"":
+        if (k mod pasx)<>0:
+        label.lrt(TEX("\footnotesize$\frac{\num{"&decimal(k)&"}}{\num{"&decimal(pasx)&"}}$"),(k*unitpx,0));
+        else:
+        label.lrt(TEX("\footnotesize\num{\fpeval{"&decimal(k)&"/"&decimal(pasx)&"}}"),(k*unitpx,0));
+        fi;
+        if (l mod pasy)<>0:
+        label.ulft(TEX("\footnotesize$\frac{\num{"&decimal(l)&"}}{\num{"&decimal(pasy)&"}}$"),(0,l*unitpy));
+        else:
+        label.ulft(TEX("\footnotesize\num{\fpeval{"&decimal(l)&"/"&decimal(pasy)&"}}"),(0,l*unitpy));
+        fi;
+      pointe((k*unitpx,0),(0,l*unitpy));
+      fi;
+    fi;
+    n:=n+1;
+    endfor;
+    elseif #5=1:
+    n:=1;
+    k:=0;%pour retenir la coordonnée en x
+    l:=0;%pour retenir la coordonnée en y
+    for p_=t:
+        if (n mod 3)=1:
+    if numeric p_:
+    k:=p_;
+    fi;
+    fi;
+    if (n mod 3)=2:
+    if numeric p_:
+    l:=p_;
+    fi;
+    fi;
+    if (n mod 3)=0:
+    if p_<>"":
+    label.lrt(TEX("\footnotesize\num{\fpeval{"&decimal(k)&"/"&decimal(pasx)&"}}"),(k*unitpx,0));
+    label.ulft(TEX("\footnotesize\num{\fpeval{"&decimal(l)&"/"&decimal(pasy)&"}}"),(0,l*unitpy));
+    pointe((k*unitpx,0),(0,l*unitpy));
+    fi;
+    fi;
+    n:=n+1;
+    endfor;
+    fi;
     enddef;
-    tata(#5);
+    tata(#3);
   \end{mplibcode}
   \else
-  \begin{mpost}[mpsettings={input PfC-Geometrie;}]
-  maxx:=-4000;
-  minx=4000;
-  unitex:=#1*cm;
-  pasx=#2;
-  unitpx:=unitex/pasx;
-  maxy:=-4000;
-  miny:=4000;
-  unitey:=#3*cm;
-  pasy:=#4;
-  unitpy:=unitey/pasy;
-  n:=1;
-  vardef toto(text t)=
+  \begin{mpost}
+    maxx:=-4000;
+    minx=4000;
+    unitex:=(xpart(#1))*cm;
+    pasx=ypart(#1);
+    unitpx:=unitex/pasx;
+    maxy:=-4000;
+    miny:=4000;
+    unitey:=(xpart(#2))*cm;
+    pasy:=ypart(#2);
+    unitpy:=unitey/pasy;
+    n:=1;
+    vardef toto(text t)=
     for p_=t:
     if (n mod 3)=1:
-      if p_>maxx:
+    if p_>maxx:
         maxx:=p_;
       fi;
       if p_<minx:
@@ -9752,22 +10708,22 @@
     endfor;
     maxx:=maxx+1;
     minx:=minx-1;
-    if maxx<(#2+1):
-    maxx:=#2+1;
+    if maxx<(ypart(#1)+1):
+    maxx:=ypart(#1)+1;
     fi;
-    if minx>(-#2-1):
-    minx:=-#2-1;
+    if minx>(-ypart(#1)-1):
+    minx:=-ypart(#1)-1;
     fi;
     maxy:=maxy+1;
     miny:=miny-1;
-    if maxy<(#4+1):
-    maxy:=#2+1;
+    if maxy<(ypart(#2)+1):
+    maxy:=ypart(#2)+1;
     fi;
-    if miny>(-#4-1):
-    miny:=-#4-1;
+    if miny>(-ypart(#2)-1):
+    miny:=-ypart(#2)-1;
     fi;
     enddef;
-    toto(#5);
+    toto(#3);
     Figure((minx-1)*unitpx,(miny-1)*unitpy,(maxx+1)*unitpx,(maxy+1)*unitpy);
     pair A,B,C,D,E;
     A=(0,0);
@@ -9783,14 +10739,32 @@
     endfor;
     drawarrow (B+(-0.75*unitpx,0))--(C+(0.75*unitpx,0));
     drawarrow (D+(0,-0.75*unitpy))--(E+(0,0.75*unitpy));
-    dotlabel.bot(LATEX("\noexpand\footnotesize\num{"&decimal(#7)&"}"),(unitex,0));
-    dotlabel.lft(LATEX("\noexpand\footnotesize\num{"&decimal(#8)&"}"),(0,unitey));
-    label.llft(btex 0 etex,A);
+    % graduation complète ou pas ?
+    label.llft(btex \noexpand\footnotesize 0 etex,A);
+    if #6>0:
+    for k=minx upto maxx:
+    if (xpart((k*unitex,0))>xpart(B+(-0.75*unitpx,0))) and (xpart((k*unitex,0))<xpart(C+(0.75*unitpx,0))):
+    if k<>0:
+    dotlabel.lrt(LATEX("\noexpand\footnotesize\noexpand\num{"&decimal(k)&"}"),(k*unitex,0));
+    fi;
+    fi;
+    endfor;
+    for k=miny upto maxy:
+    if (ypart((0,k*unitey))>ypart(D+(0,-0.75*unitpy))) and (ypart((0,k*unitey))<ypart(E+(0,0.75*unitpy))):
+    if k<>0:
+    dotlabel.ulft(LATEX("\noexpand\footnotesize\noexpand\num{"&decimal(k)&"}"),(0,k*unitey));
+    fi;
+    fi;
+    endfor;
+    else:
+    dotlabel.lrt(LATEX("\noexpand\footnotesize\noexpand\num{"&decimal(xpart(#7))&"}"),(unitex,0));
+    dotlabel.ulft(LATEX("\noexpand\footnotesize\noexpand\num{"&decimal(ypart(#7))&"}"),(0,unitey));
+    fi;
     % apparition du nom des points ou pas
     m_c:=m_c*3;
     marque_p:="croix";
     vardef tata(text t)=%on place les points
-    if #6>0:
+    if #4>0:
     n:=1;
     k:=0;%pour retenir la coordonnée en x
     l:=0;%pour retenir la coordonnée en y
@@ -9806,7 +10780,8 @@
     fi;
     fi;
     if (n mod 3)=0:
-    if #6>1:
+    if #4>1:
+    if p_<>"":
     if (k>0) and (l>0):
     label.urt(LATEX(p_),(k*unitpx,l*unitpy));
     fi;
@@ -9833,7 +10808,8 @@
     fi;
     pointe((k*unitpx,l*unitpy));
     fi;
-    if (#6=1) or (#6=3):
+    fi;
+    if (#4=1) or (#4=3):
     draw (0,l*unitpy)--(k*unitpx,l*unitpy)--(k*unitpx,0) dashed evenly;
     fi;
     fi;
@@ -9840,8 +10816,65 @@
     n:=n+1;
     endfor;
     fi;
+    if #5=2:
+    n:=1;
+    k:=0;%pour retenir la coordonnée en x
+    l:=0;%pour retenir la coordonnée en y
+    for p_=t:
+        if (n mod 3)=1:
+    if numeric p_:
+    k:=p_;
+    fi;
+    fi;
+    if (n mod 3)=2:
+    if numeric p_:
+    l:=p_;
+    fi;
+    fi;
+    if (n mod 3)=0:
+    if p_<>"":
+        if (k mod pasx)<>0:
+        label.lrt(LATEX("\noexpand\footnotesize$\noexpand\frac{\noexpand\num{"&decimal(k)&"}}{\noexpand\num{"&decimal(pasx)&"}}$"),(k*unitpx,0));
+        else:
+        label.lrt(LATEX("\noexpand\footnotesize\noexpand\num{\noexpand\fpeval{"&decimal(k)&"/"&decimal(pasx)&"}}"),(k*unitpx,0));
+        fi;
+        if (l mod pasy)<>0:
+        label.ulft(LATEX("\noexpand\footnotesize$\noexpand\frac{\noexpand\num{"&decimal(l)&"}}{\noexpand\num{"&decimal(pasy)&"}}$"),(0,l*unitpy));
+        else:
+        label.ulft(LATEX("\noexpand\footnotesize\noexpand\num{\noexpand\fpeval{"&decimal(l)&"/"&decimal(pasy)&"}}"),(0,l*unitpy));
+        fi;
+      pointe((k*unitpx,0),(0,l*unitpy));
+      fi;
+    fi;
+    n:=n+1;
+    endfor;
+    elseif #5=1:
+    n:=1;
+    k:=0;%pour retenir la coordonnée en x
+    l:=0;%pour retenir la coordonnée en y
+    for p_=t:
+        if (n mod 3)=1:
+    if numeric p_:
+    k:=p_;
+    fi;
+    fi;
+    if (n mod 3)=2:
+    if numeric p_:
+    l:=p_;
+    fi;
+    fi;
+    if (n mod 3)=0:
+    if p_<>"":
+    label.lrt(LATEX("\noexpand\footnotesize\noexpand\num{\noexpand\fpeval{"&decimal(k)&"/"&decimal(pasx)&"}}"),(k*unitpx,0));
+    label.ulft(LATEX("\noexpand\footnotesize\noexpand\num{\noexpand\fpeval{"&decimal(l)&"/"&decimal(pasy)&"}}"),(0,l*unitpy));
+    pointe((k*unitpx,0),(0,l*unitpy));
+    fi;
+    fi;
+    n:=n+1;
+    endfor;
+    fi;
     enddef;
-    tata(#5);
+    tata(#3);
   \end{mpost}
   \fi
 }
@@ -10146,27 +11179,8 @@
   \fi
 }
 
-% Pour construire la demi-droite graduée
-\def\builddemidroite{%
-  \toklistepointdroite{}%
-  \foreachitem\compteur\in\ListePointDroite{\expandafter\Updatetoksdroite\compteur\nil}%
-  \ifboolKV[ClesReperage]{DemiDroite}{%
-    \ifboolKV[ClesReperage]{AffichageNom}{%
-      \[\MPDemiGraduee{\useKV[ClesReperage]{Unitex}}{\useKV[ClesReperage]{Pasx}}{\the\toklistepointdroite}{1}{\useKV[ClesReperage]{ValeurUnitex}}{\useKV[ClesReperage]{ValeurOrigine}}\]%
-    }{%
-      \[\MPDemiGraduee{\useKV[ClesReperage]{Unitex}}{\useKV[ClesReperage]{Pasx}}{\the\toklistepointdroite}{0}{\useKV[ClesReperage]{ValeurUnitex}}{\useKV[ClesReperage]{ValeurOrigine}}\]%
-    }
-  }{%
-    \ifboolKV[ClesReperage]{AffichageNom}{%
-      \[\MPDroiteGraduee{\useKV[ClesReperage]{Unitex}}{\useKV[ClesReperage]{Pasx}}{\the\toklistepointdroite}{1}{\useKV[ClesReperage]{ValeurUnitex}}{\useKV[ClesReperage]{ValeurOrigine}}\]%
-    }{%
-      \[\MPDroiteGraduee{\useKV[ClesReperage]{Unitex}}{\useKV[ClesReperage]{Pasx}}{\the\toklistepointdroite}{0}{\useKV[ClesReperage]{ValeurUnitex}}{\useKV[ClesReperage]{ValeurOrigine}}\]%
-    }%
-  }%
-}%
-
-\def\MPDemiGraduee#1#2#3#4#5#6{%
-    % #1 : unite
+\def\MPDEMIGraduee#1#2#3#4#5#6#7#8{%
+  % #1 : unite
   % #2 : pas
   % #3 : liste des points à placer en pas. pour gérer le cas des repérages fractionnaires
   % #4 : on affiche le nom des points ou pas
@@ -10173,136 +11187,224 @@
   % #5 : quelle est la valeur de la longueur unité ?
   % #6 : la valeur de l'unité (ne sert à rien ici, mais en prévision
   % de Droite)
+  % #7 : on affiche les abscisses ou pas : 0 non, 1 oui, 2 fraction
+  % #8 : on affiche tous les multiples de la graduation "principale"
   \ifluatex
+  \mplibforcehmode
   \begin{mplibcode}
     maxx:=0;
-  unitex:=#1*cm;
-  pasx:=#2;
-  unitp:=unitex/pasx;%unité de déplacement
-  vardef toto(text t)=%On détermine le nombre "d'unités" à placer
-  for p_=t:
-  if numeric p_:
-  if p_>maxx:
-  maxx:=p_;
-  fi;
-  fi;
-  endfor;
-  maxx:=maxx+1;
-  if maxx<(#2+1):
-  maxx:=#2+1;
-  fi;
-  enddef;
-  toto(#3);
-  Figure(-u,-u,(maxx+0.75)*unitp,u);
-  pair A,B;
-  A=(0,0);
-  B=unitp*(maxx,0);
-  drawarrow A--(B+(0.75*unitp,0));
-  %marquage secondaire
-  marque_s:=marque_s/3;
-  for k=0 step 2 until (maxx):
-  draw marquesegment((k/maxx)[A,B],((k+1)/maxx)[A,B]);
-  endfor;
-  drawoptions();
-  % marquage primaire
-  marque_s:=marque_s*3;
-  for k=0 step pasx until (maxx-1):
-  draw marquesegment((k/maxx)[A,B],((k+pasx)/maxx)[A,B]);
-  endfor;
-  % marquage des points
-  m_c:=m_c*3;
-  marque_p:="croix";
-  labeloffset:=labeloffset*2;
-  dotlabel.bot(TEX("\footnotesize\num{"&decimal(#5)&"}"),unitex*(1,0));
-  label.bot(TEX("\footnotesize\num{"&decimal(#6)&"}"),A);
-  vardef tata(text t)=%on place les points
-  if #4>0:
-  for p_=t:
-  if numeric p_:
-  label("",unitp*(p_,0));
-  k:=p_;
-  fi;
-  if string p_:
-  if p_<>"":
-  label.top(TEX(p_),unitp*(k,0));
-  pointe(unitp*(k,0));
-  fi;
-  fi;
-  endfor;
-  fi;
-  enddef;
-  tata(#3);
+    unitex:=#1*cm;
+    pasx:=#2;
+    unitp:=unitex/pasx;%unité de déplacement
+    vardef toto(text t)=%On détermine le nombre "d'unités" à placer
+    for p_=t:
+    if numeric p_:
+    if p_>maxx:
+    maxx:=p_;
+    fi;
+    fi;
+    endfor;
+    maxx:=maxx+1;
+    if maxx<(#2+1):
+    maxx:=#2+1;
+    fi;
+    enddef;
+    toto(#3);
+    Figure(-u,-u,(maxx+0.75)*unitp,u);
+    pair A,B;
+    A=(0,0);
+    B=unitp*(maxx,0);
+    drawarrow A--(B+(0.75*unitp,0));
+    % marquage secondaire
+    marque_s:=marque_s/3;
+    for k=0 step 2 until (maxx):
+    draw marquesegment((k/maxx)[A,B],((k+1)/maxx)[A,B]);
+    endfor;
+    drawoptions();
+    % marquage primaire
+    marque_s:=marque_s*3;
+    for k=0 step pasx until (maxx-1):
+    draw marquesegment((k/maxx)[A,B],((k+pasx)/maxx)[A,B]);
+    endfor;
+    % marquage des points
+    m_c:=m_c*3;
+    marque_p:="croix";
+    labeloffset:=labeloffset*2;
+    dotlabel.bot(TEX("\footnotesize\num{"&decimal(#5)&"}"),unitex*(1,0));
+    label.bot(TEX("\footnotesize\num{"&decimal(#6)&"}"),A);
+    if #8>0:
+    for k=2 upto maxx:
+    dotlabel.bot(TEX("\footnotesize\num{\fpeval{"&decimal(#5)&"*"&decimal(k)&"}}"),unitex*(k,0));
+    endfor;
+    fi;
+    vardef tata(text t)=%on place les points
+    if #4>0:
+    for p_=t:
+    if numeric p_:
+    k:=p_;
+    fi;
+    if string p_:
+    if p_<>"":
+    label.top(TEX(p_),unitp*(k,0));
+    pointe(unitp*(k,0));
+    fi;
+    fi;
+    endfor;
+    fi;
+    if #7=2:
+    for p_=t:
+    if numeric p_:
+    k:=p_;
+    fi;
+    if string p_:
+    if p_<>"":
+    if ((#5*k) mod pasx)<>0:
+    label.bot(TEX("\footnotesize$\frac{\num{\fpeval{"&decimal(#5)&"*"&decimal(k)&"}}}{\num{"&decimal(pasx)&"}}$"),unitp*(k,0));
+    else:
+    label.bot(TEX("\footnotesize\num{\fpeval{"&decimal(#5)&"*"&decimal(k)&"/"&decimal(pasx)&"}}"),unitp*(k,0));
+    fi;
+    pointe(unitp*(k,0));
+    fi;
+    fi;
+    endfor;
+    elseif #7=1:
+    for p_=t:
+    if numeric p_:
+    k:=p_;
+    fi;
+    if string p_:
+    if p_<>"":
+    label.bot(TEX("\footnotesize\num{\fpeval{"&decimal(#5)&"*"&decimal(k)&"/"&decimal(pasx)&"}}"),unitp*(k,0));
+    pointe(unitp*(k,0));
+    fi;
+    fi;
+    endfor;
+    fi;
+    enddef;
+    tata(#3);
   \end{mplibcode}
   \else
-  \begin{mpost}[mpsettings={input PfC-Geometrie;}]
-  maxx:=0;
-  unitex:=#1*cm;
-  pasx:=#2;
-  unitp:=unitex/pasx;%unité de déplacement
-  vardef toto(text t)=%On détermine le nombre "d'unités" à placer
-  for p_=t:
-  if numeric p_:
-  if p_>maxx:
-  maxx:=p_;
-  fi;
-  fi;
-  endfor;
-  maxx:=maxx+1;
-  if maxx<(#2+1):
-  maxx:=#2+1;
-  fi;
-  enddef;
-  toto(#3);
-  Figure(-u,-u,(maxx+0.75)*unitp,u);
-  pair A,B;
-  A=(0,0);
-  B=unitp*(maxx,0);
-  drawarrow A--(B+(0.75*unitp,0));
-  %marquage secondaire
-  marque_s:=marque_s/3;
-  for k=0 step 2 until (maxx):
-  draw marquesegment((k/maxx)[A,B],((k+1)/maxx)[A,B]);
-  endfor;
-  drawoptions();
-  % marquage primaire
-  marque_s:=marque_s*3;
-  for k=0 step pasx until (maxx-1):
-  draw marquesegment((k/maxx)[A,B],((k+pasx)/maxx)[A,B]);
-  endfor;
-  % marquage des points
-  m_c:=m_c*3;
-  marque_p:="croix";
-  labeloffset:=labeloffset*2;
-  dotlabel.bot(LATEX("\noexpand\footnotesize\num{"&decimal(#5)&"}"),unitex*(1,0));
-  label.bot(LATEX("\noexpand\footnotesize\num{"&decimal(#6)&"}"),A);
-  vardef tata(text t)=%on place les points
-  if #4>0:
-  for p_=t:
-  if numeric p_:
-  label("",unitp*(p_,0));
-  k:=p_;
-  fi;
-  if string p_:
-  label.top(LATEX(p_),unitp*(k,0));
-  if p_<>"":
-  pointe(unitp*(k,0));
-  fi;
-  fi;
-  endfor;
-  fi;
-  enddef;
-  tata(#3);
-\end{mpost}
-\fi
+  \begin{mpost}
+    maxx:=0;
+    unitex:=#1*cm;
+    pasx:=#2;
+    unitp:=unitex/pasx;%unité de déplacement
+    vardef toto(text t)=%On détermine le nombre "d'unités" à placer
+    for p_=t:
+    if numeric p_:
+    if p_>maxx:
+    maxx:=p_;
+    fi;
+    fi;
+    endfor;
+    maxx:=maxx+1;
+    if maxx<(#2+1):
+    maxx:=#2+1;
+    fi;
+    enddef;
+    toto(#3);
+    Figure(-u,-u,(maxx+0.75)*unitp,u);
+    pair A,B;
+    A=(0,0);
+    B=unitp*(maxx,0);
+    drawarrow A--(B+(0.75*unitp,0));
+    % marquage secondaire
+    marque_s:=marque_s/3;
+    for k=0 step 2 until (maxx):
+    draw marquesegment((k/maxx)[A,B],((k+1)/maxx)[A,B]);
+    endfor;
+    drawoptions();
+    % marquage primaire
+    marque_s:=marque_s*3;
+    for k=0 step pasx until (maxx-1):
+    draw marquesegment((k/maxx)[A,B],((k+pasx)/maxx)[A,B]);
+    endfor;
+    % marquage des points
+    m_c:=m_c*3;
+    marque_p:="croix";
+    labeloffset:=labeloffset*2;
+    dotlabel.bot(LATEX("\noexpand\footnotesize\num{"&decimal(#5)&"}"),unitex*(1,0));
+    label.bot(LATEX("\noexpand\footnotesize\num{"&decimal(#6)&"}"),A);
+    if #8>0:
+    for k=2 upto maxx:
+    dotlabel.bot(LATEX("\noexpand\footnotesize\noexpand\num{\noexpand\fpeval{"&decimal(#5)&"*"&decimal(k)&"}}"),unitex*(k,0));
+    endfor;
+    fi;
+    vardef tata(text t)=%on place les points
+    if #4>0:
+    for p_=t:
+    if numeric p_:
+    k:=p_;
+    fi;
+    if string p_:
+    if p_<>"":
+    label.top(LATEX(p_),unitp*(k,0));
+    pointe(unitp*(k,0));
+    fi;
+    fi;
+    endfor;
+    fi;
+    if #7=2:
+    for p_=t:
+    if numeric p_:
+    k:=p_;
+    fi;
+    if string p_:
+    if p_<>"":
+    if ((#5*k) mod pasx)<>0:
+    label.bot(LATEX("\noexpand\footnotesize$\noexpand\frac{\noexpand\num{\noexpand\fpeval{"&decimal(#5)&"*"&decimal(k)&"}}}{\noexpand\num{"&decimal(pasx)&"}}$"),unitp*(k,0));
+    else:
+    label.bot(LATEX("\noexpand\footnotesize\noexpand\num{\noexpand\fpeval{"&decimal(#5)&"*"&decimal(k)&"/"&decimal(pasx)&"}}"),unitp*(k,0));
+    fi;
+    pointe(unitp*(k,0));
+    fi;
+    fi;
+    endfor;
+    elseif #7=1:
+    for p_=t:
+    if numeric p_:
+    k:=p_;
+    fi;
+    if string p_:
+    if p_<>"":
+    label.bot(LATEX("\noexpand\footnotesize\noexpand\num{\noexpand\fpeval{"&decimal(#5)&"*"&decimal(k)&"/"&decimal(pasx)&"}}"),unitp*(k,0));
+    pointe(unitp*(k,0));
+    fi;
+    fi;
+    endfor;
+    fi;
+    enddef;
+    tata(#3);
+  \end{mpost}
+  \fi
 }
 
-\def\MPDroiteGraduee#1#2#3#4#5#6{%
-      % #1 : unite
-    % #2 : pas
-    % #3 : liste des points à placer en pas. pour gérer le cas des repérages fractionnaires
-    % #4 : on affiche le nom des points ou pas
-    % #5 : quelle est la valeur de la longueur unité ?
+% Pour construire les droite/demi-droite graduée
+\def\builddemidroitenew{%
+  \toklistepointdroite{}%
+  \foreachitem\compteur\in\ListePointDroite{\expandafter\Updatetoksdroite\compteur\nil}%
+  \xdef\AffichageNom{0}\ifboolKV[ClesReperage]{AffichageNom}{\xdef\AffichageNom{1}}{}
+  \xdef\AffichageCoord{\useKV[ClesReperage]{AffichageAbs}}
+  \xdef\AffichageGrad{0}\ifboolKV[ClesReperage]{AffichageGrad}{\xdef\AffichageGrad{1}}{}
+  \ifboolKV[ClesReperage]{DemiDroite}{%
+    \[\MPDEMIGraduee{\useKV[ClesReperage]{Unitex}}{\useKV[ClesReperage]{Pasx}}{\the\toklistepointdroite}{\AffichageNom}{\useKV[ClesReperage]{ValeurUnitex}}{\useKV[ClesReperage]{ValeurOrigine}}{\AffichageCoord}{\AffichageGrad}\]%
+  }{%
+    \[\MPDROITEGraduee{\useKV[ClesReperage]{Unitex}}{\useKV[ClesReperage]{Pasx}}{\the\toklistepointdroite}{\AffichageNom}{\useKV[ClesReperage]{ValeurUnitex}}{\useKV[ClesReperage]{ValeurOrigine}}{\AffichageCoord}{\AffichageGrad}\]%
+  }%
+}%
+
+
+\def\MPDROITEGraduee#1#2#3#4#5#6#7#8{%
+  % #1 : unite
+  % #2 : pas
+  % #3 : liste des points à placer en pas. pour gérer le cas des repérages fractionnaires
+  % #4 : on affiche le nom des points ou pas
+  % #5 : quelle est la valeur de la longueur unité ?
+  % #6 : la valeur de l'unité
+  % #7 : on affiche les abscisses ou pas : 0 non, 1 oui, 2 fraction
+  % #8 : on affiche tous les multiples de la graduation "principale"
   \ifluatex
+  \mplibforcehmode
   \begin{mplibcode}
     maxx:=0;
     minx:=4000;
@@ -10310,67 +11412,71 @@
     pasx:=#2;
     unitp:=unitex/pasx;%unité de déplacement
     vardef toto(text t)=%On détermine le nombre "d'unités" à placer
-      for p_=t:
-        if numeric p_:
-          if p_>maxx:
-            maxx:=p_;
-          fi;
-          if p_<minx:
-            minx:=p_;
-          fi;
-        fi;
-      endfor;
-      maxx:=maxx+1;
-      minx:=minx-1;
-      if maxx<(#2+1):
-      maxx:=#2+1;
-      fi;
-      if minx>(-#2-1):
-      minx:=-#2-1;
-      fi;
+    for p_=t:
+    if numeric p_:
+    if p_>maxx:
+    maxx:=p_;
+    fi;
+    if p_<minx:
+    minx:=p_;
+    fi;
+    fi;
+    endfor;
+    maxx:=maxx+(pasx div 2);
+    minx:=minx-(pasx div 2);
+    if maxx<(#2+1):
+    maxx:=#2+(pasx-1);
+    fi;
+    if minx>(-#2-1):
+    minx:=-#2-(pasx-1);
+    fi;
     enddef;
     toto(#3);
-    Figure((minx-1)*u,-u,(maxx+1)*unitp,u);
+    Figure((minx-1)*unitp,-u,(maxx+1)*unitp,u);
     pair A,B,C;
     A=(0,0);
     B=unitp*(maxx,0);
     C=unitp*(minx,0);
     drawarrow (C+unitp*(-0.75,0))--(B+unitp*(0.75,0));
+    % marquage secondaire
     marque_s:=marque_s/3;
     labeloffset:=labeloffset*2;
     if ((maxx-minx) mod 2)=0:
-%    show maxx; show minx;
       for k=(minx+1) step 2 until (maxx-1):
       draw marquedemidroite(C,B);
       draw marquesegment((k/maxx)[A,B],((k+1)/maxx)[A,B]);
       endfor;
       else:
- %         show maxx; show minx;
       for k=(minx) step 2 until (maxx-1):
         draw marquesegment((k/maxx)[A,B],((k+1)/maxx)[A,B]);
      endfor;
      fi;
-       % marquage primaire%%%%%%%%%%%%%%%%%%%%%%%%
-     marque_s:=marque_s*3;
-     for k=0 step pasx until (maxx-pasx):
-     draw marquesegment((k/maxx)[A,B],((k+pasx)/maxx)[A,B]);
-     endfor;
-     for k=0 step -pasx until (minx+pasx):
-     draw marquesegment((k/maxx)[A,B],((k-pasx)/maxx)[A,B]);
-     endfor;
+    % marquage primaire
+    marque_s:=marque_s*3;
+    for k=0 step pasx until (maxx-pasx):
+    draw marquesegment((k/maxx)[A,B],((k+pasx)/maxx)[A,B]);
+    endfor;
+    for k=0 step -pasx until (minx+pasx):
+    draw marquesegment((k/maxx)[A,B],((k-pasx)/maxx)[A,B]);
+    endfor;
+    % marquage des points
     m_c:=m_c*3;
     marque_p:="croix";
-    dotlabel.bot(TEX("\footnotesize\num{"&decimal(#5)&"}"),unitex*(1,0));
+    labeloffset:=labeloffset*2;
+    label.bot(TEX("\footnotesize\num{"&decimal(#5)&"}"),unitex*(1,0));
     label.bot(TEX("\footnotesize\num{"&decimal(#6)&"}"),A);
-    if #5=1:
-    label.top(TEX("I"),unitex*(1,0));
+    if #8>0:
+    for k=2 upto maxx:
+    label.bot(TEX("\footnotesize\num{\fpeval{"&decimal(#6)&"+"&decimal(#5-(#6))&"*"&decimal(k)&"}}"),unitex*(k,0));%%%
+    endfor;
+    for k=minx upto -1:
+    label.bot(TEX("\footnotesize\num{\fpeval{"&decimal(#6)&"+"&decimal(#5-(#6))&"*"&decimal(k)&"}}"),unitex*(k,0));%%%
+    endfor;
     fi;
-    label.top(TEX("O"),A);
     vardef tata(text t)=%on place les points
     if #4>0:
     for p_=t:
     if numeric p_:
-    label("",unitp*(p_,0));
     k:=p_;
     fi;
     if string p_:
@@ -10381,11 +11487,40 @@
     fi;
     endfor;
     fi;
+    if #7=2:
+    for p_=t:
+    if numeric p_:
+    k:=p_;
+    fi;
+    if string p_:
+    if p_<>"":
+    if ((#5*k) mod pasx)<>0:
+    label.bot(TEX("\footnotesize$\frac{\num{\fpeval{"&decimal(#5)&"*"&decimal(k)&"}}}{\num{"&decimal(pasx)&"}}$"),unitp*(k,0));
+    else:
+    label.bot(TEX("\footnotesize\num{\fpeval{"&decimal(#5)&"*"&decimal(k)&"/"&decimal(pasx)&"}}"),unitp*(k,0));
+    fi;
+    pointe(unitp*(k-#6,0));
+    fi;
+    fi;
+    endfor;
+    elseif #7=1:
+    for p_=t:
+    if numeric p_:
+    k:=p_;
+    fi;
+    if string p_:
+    if p_<>"":
+    label.bot(TEX("\footnotesize\num{\fpeval{"&decimal(#6)&"+"&decimal(#5-(#6))&"*"&decimal(k)&"/"&decimal(pasx)&"}}"),unitp*(k,0));
+    pointe(unitp*(k,0));
+    fi;
+    fi;
+    endfor;
+    fi;
     enddef;
     tata(#3);
   \end{mplibcode}
   \else
-  \begin{mpost}[mpsettings={input PfC-Geometrie;}]
+  \begin{mpost}
     maxx:=0;
     minx:=4000;
     unitex:=#1*cm;
@@ -10392,72 +11527,105 @@
     pasx:=#2;
     unitp:=unitex/pasx;%unité de déplacement
     vardef toto(text t)=%On détermine le nombre "d'unités" à placer
-      for p_=t:
-        if numeric p_:
-          if p_>maxx:
-            maxx:=p_;
-          fi;
-          if p_<minx:
-            minx:=p_;
-          fi;
-        fi;
-      endfor;
-      maxx:=maxx+1;
-      minx:=minx-1;
-      if maxx<(#2+1):
-      maxx:=#2+1;
-      fi;
-      if minx>(-#2-1):
-      minx:=-#2-1;
-      fi;
+    for p_=t:
+    if numeric p_:
+    if p_>maxx:
+    maxx:=p_;
+    fi;
+    if p_<minx:
+    minx:=p_;
+    fi;
+    fi;
+    endfor;
+    maxx:=maxx+(pasx div 2);
+    minx:=minx-(pasx div 2);
+    if maxx<(#2+1):
+    maxx:=#2+(pasx-1);
+    fi;
+    if minx>(-#2-1):
+    minx:=-#2-(pasx-1);
+    fi;
     enddef;
     toto(#3);
-    Figure((minx-1)*u,-u,(maxx+1)*unitp,u);
+    Figure((minx-1)*unitp,-u,(maxx+1)*unitp,u);
     pair A,B,C;
     A=(0,0);
     B=unitp*(maxx,0);
     C=unitp*(minx,0);
     drawarrow (C+unitp*(-0.75,0))--(B+unitp*(0.75,0));
+    % marquage secondaire
     marque_s:=marque_s/3;
     labeloffset:=labeloffset*2;
     if ((maxx-minx) mod 2)=0:
-%    show maxx; show minx;
       for k=(minx+1) step 2 until (maxx-1):
       draw marquedemidroite(C,B);
       draw marquesegment((k/maxx)[A,B],((k+1)/maxx)[A,B]);
       endfor;
       else:
- %         show maxx; show minx;
       for k=(minx) step 2 until (maxx-1):
         draw marquesegment((k/maxx)[A,B],((k+1)/maxx)[A,B]);
      endfor;
      fi;
-       % marquage primaire%%%%%%%%%%%%%%%%%%%%%%%%
-     marque_s:=marque_s*3;
-     for k=0 step pasx until (maxx-pasx):
-     draw marquesegment((k/maxx)[A,B],((k+pasx)/maxx)[A,B]);
-     endfor;
-     for k=0 step -pasx until (minx+pasx):
-     draw marquesegment((k/maxx)[A,B],((k-pasx)/maxx)[A,B]);
-     endfor;
+    % marquage primaire
+    marque_s:=marque_s*3;
+    for k=0 step pasx until (maxx-pasx):
+    draw marquesegment((k/maxx)[A,B],((k+pasx)/maxx)[A,B]);
+    endfor;
+    for k=0 step -pasx until (minx+pasx):
+    draw marquesegment((k/maxx)[A,B],((k-pasx)/maxx)[A,B]);
+    endfor;
+    % marquage des points
     m_c:=m_c*3;
     marque_p:="croix";
-    dotlabel.bot(LATEX("\noexpand\footnotesize\num{"&decimal(#5)&"}"),unitex*(1,0));
-    label.bot(LATEX("\noexpand\footnotesize\num{"&decimal(#6)&"}"),A);
-    if #5=1:
-    label.top(LATEX("I"),unitex*(1,0));
+    labeloffset:=labeloffset*2;
+    label.bot(LATEX("\noexpand\footnotesize\noexpand\num{"&decimal(#5)&"}"),unitex*(1,0));
+    label.bot(LATEX("\noexpand\footnotesize\noexpand\num{"&decimal(#6)&"}"),A);
+    if #8>0:
+    for k=2 upto maxx:
+    label.bot(LATEX("\noexpand\footnotesize\noexpand\num{\noexpand\fpeval{"&decimal(#6)&"+"&decimal(#5-(#6))&"*"&decimal(k)&"}}"),unitex*(k,0));%%%
+    endfor;
+    for k=minx upto -1:
+    label.bot(LATEX("\noexpand\footnotesize\noexpand\num{\noexpand\fpeval{"&decimal(#6)&"+"&decimal(#5-(#6))&"*"&decimal(k)&"}}"),unitex*(k,0));%%%
+    endfor;
     fi;
-    label.top(LATEX("O"),A);
     vardef tata(text t)=%on place les points
     if #4>0:
     for p_=t:
     if numeric p_:
-    label("",unitp*(p_,0));
     k:=p_;
     fi;
     if string p_:
+    if p_<>"":
     label.top(LATEX(p_),unitp*(k,0));
+    pointe(unitp*(k,0));
+    fi;
+    fi;
+    endfor;
+    fi;
+    if #7=2:
+    for p_=t:
+    if numeric p_:
+    k:=p_;
+    fi;
+    if string p_:
     if p_<>"":
+    if ((#5*k) mod pasx)<>0:
+    label.bot(LATEX("\noexpand\footnotesize$\noexpand\frac{\noexpand\num{\noexpand\fpeval{"&decimal(#5)&"*"&decimal(k)&"}}}{\noexpand\num{"&decimal(pasx)&"}}$"),unitp*(k,0));
+    else:
+    label.bot(LATEX("\noexpand\footnotesize\noexpand\num{\noexpand\fpeval{"&decimal(#5)&"*"&decimal(k)&"/"&decimal(pasx)&"}}"),unitp*(k,0));
+    fi;
+    pointe(unitp*(k-#6,0));
+    fi;
+    fi;
+    endfor;
+    elseif #7=1:
+    for p_=t:
+    if numeric p_:
+    k:=p_;
+    fi;
+    if string p_:
+    if p_<>"":
+    label.bot(LATEX("\noexpand\footnotesize\noexpand\num{\noexpand\fpeval{"&decimal(#6)&"+"&decimal(#5-(#6))&"*"&decimal(k)&"/"&decimal(pasx)&"}}"),unitp*(k,0));
     pointe(unitp*(k,0));
     fi;
     fi;
@@ -10468,7 +11636,7 @@
   \end{mpost}
   \fi
 }
-  
+
 \newcommand\Reperage[2][]{%
   \useKVdefault[ClesReperage]%
   \setKV[ClesReperage]{#1}%
@@ -10481,51 +11649,146 @@
   }{\ifboolKV[ClesReperage]{Plan}{%
       \setsepchar[*]{,*/}\ignoreemptyitems%
       \readlist*\ListePointRepere{#2}%
-      \buildrepere%
-    }{\ifboolKV[ClesReperage]{Droite}{%
-        \setsepchar[*]{,*/}\ignoreemptyitems%
-        \readlist*\ListePointDroite{#2}%
-        \builddemidroite%
-      }{%
-        \setsepchar[*]{,*/}\ignoreemptyitems%
-        \readlist*\ListePointDroite{#2}%
-        \builddemidroite%
-      }%
+      \buildreperenew%
+    }{%
+      \setsepchar[*]{,*/}\ignoreemptyitems%
+      \readlist*\ListePointDroite{#2}%
+      \builddemidroitenew%
     }%
   }%
 }%
 
-
-%%%%%%%%
-%% Puissances
-%%%%%%
+%%%
+% Puissances
+%%%
 \newcommand\Puissances[2]{%
-  \ensuremath{
+  \ensuremath{%
     \xintifboolexpr{#2=0}{1}{\xintifboolexpr{#2>0}{\xdef\total{\fpeval{#2-1}}#1\multido{\i=1+1}{\total}{\times#1}}{\xdef\total{\fpeval{-#2-1}}\frac{1}{#1\multido{\i=1+1}{\total}{\times#1}}}}%
-  }
+  }%
 }
 
-%%%%%%%%%
+%%%
 % Ecritures d'unités
-%%%%%%%%%%
-\setKVdefault[Unites]{m=false,km=false,hm=false,dam=false,dm=false,cm=true,mm=false,g=true,kg=false,hg=false,dag=false,dg=false,cg=false,mg=false,kmh=true,ms=false,kgm=false,gcm=true,L=true,kL=false,hL=false,daL=false,dL=false,cL=false,mL=false,l=true,kl=false,hl=false,dal=false,dl=false,cl=false,ml=false}
+%%%
+\setKVdefault[Unites]{m=false,km=false,hm=false,ha=false,dam=false,a=false,dm=false,cm=true,mm=false,um=false,nm=false,g=true,t=false,q=false,kg=false,hg=false,dag=false,dg=false,cg=false,mg=false,ug=false,ng=false,kmh=true,kms=false,ms=false,kgm=false,gcm=true,L=true,kL=false,hL=false,daL=false,dL=false,cL=false,mL=false,l=true,kl=false,hl=false,dal=false,dl=false,cl=false,ml=false,Go=true,Mo=false,ko=false,To=false,o=false,kWh=true,C=true,K=false,F=false}
 
+%D'apres https://tex.stackexchange.com/questions/38905/time-of-the-day-or-time-period-using-the-package-siunitx
+\ExplSyntaxOn
+\NewDocumentCommand \Temps { o > { \SplitArgument { 5 } { ; } } m }
+{
+  \group_begin:
+  \IfNoValueF {#1}
+  { \keys_set:nn { siunitx } {#1} }
+  \siunitx_hms_output:nnn #2
+  \group_end:
+}
+\cs_new_protected:Npn \siunitx_hms_output:nnn #1#2#3#4#5#6
+{
+  \IfNoValueF {#1}
+  {
+    \tl_if_blank:nF {#1}
+    {
+      \SI {#1} { \annee\xintifboolexpr{#1>1}{s}{} }
+      \IfNoValueF {#2} { ~ }
+    }
+  }
+  \IfNoValueF {#2}
+  {
+    \tl_if_blank:nF {#2}
+    {
+      \SI {#2} { \mois }
+      \IfNoValueF {#3} { ~ }
+    }
+  }
+  \IfNoValueF {#3}
+  {
+    \tl_if_blank:nF {#3}
+    {
+      \SI {#3} { \jour }
+      \IfNoValueF {#4} { ~ }
+    }
+  }
+  \IfNoValueF {#4}
+  {
+    \tl_if_blank:nF {#4}
+    {
+      \SI {#4} { \hour }
+      \IfNoValueF {#5} { ~ }
+    }
+  }
+  \IfNoValueF {#5}
+  {
+    \tl_if_blank:nF {#5}
+    {
+      \SI {#5} { \minute }
+      \IfNoValueF {#6} { ~ }
+    }
+  }
+  \IfNoValueF {#6}
+  { \tl_if_blank:nF {#6} { \SI {#6} { \second } } }
+}
+\ExplSyntaxOff
+
+\newcommand\Temp[2][]{%
+  \useKVdefault[Unites]%
+  \setKV[Unites]{#1}%
+  \ifboolKV[Unites]{F}{%
+    \SI{#2}{\fahrenheit}%
+  }{%
+    \ifboolKV[Unites]{K}{%
+      \SI{#2}{\kelvin}%
+    }{%
+      \SI{#2}{\celsius}%
+    }%
+  }%
+}%
+
+\newcommand\Conso[2][]{%
+  \SI{#2}{\kWh}%
+}
+
+\newcommand\Octet[2][]{%
+  \useKVdefault[Unites]%
+  \setKV[Unites]{#1}%
+  \ifboolKV[Unites]{o}{%
+    \SI{#2}{\octet}%
+  }{%
+    \ifboolKV[Unites]{ko}{%
+      \SI{#2}{\kilo\octet}%
+    }{\ifboolKV[Unites]{Mo}{%
+        \SI{#2}{\mega\octet}%
+      }{\ifboolKV[Unites]{To}{%
+          \SI{#2}{\tera\octet}%
+        }{%
+          \SI{#2}{\giga\octet}%
+        }%
+      }%
+    }%
+  }%
+}%
+
 \newcommand\Lg[2][]{%
   \useKVdefault[Unites]%
   \setKV[Unites]{#1}%
-  \ifboolKV[Unites]{km}{%
-    \SI{#2}{\km}%
-  }{\ifboolKV[Unites]{hm}{%
-      \SI{#2}{\hecto\metre}%
-    }{\ifboolKV[Unites]{dam}{%
-        \SI{#2}{\deca\metre}%
-      }{\ifboolKV[Unites]{dm}{%
-          \SI{#2}{\dm}%
-        }{\ifboolKV[Unites]{m}{%
-            \SI{#2}{\m}%
-          }{\ifboolKV[Unites]{mm}{%
-              \SI{#2}{\mm}%
-            }{\SI{#2}{\cm}%
+  \ifboolKV[Unites]{nm}{%
+    \SI{#2}{\nm}%
+  }{\ifboolKV[Unites]{um}{%
+      \SI{#2}{\um}%
+    }{\ifboolKV[Unites]{km}{%
+        \SI{#2}{\km}%
+      }{\ifboolKV[Unites]{hm}{%
+          \SI{#2}{\hecto\metre}%
+        }{\ifboolKV[Unites]{dam}{%
+            \SI{#2}{\deca\metre}%
+          }{\ifboolKV[Unites]{dm}{%
+              \SI{#2}{\dm}%
+            }{\ifboolKV[Unites]{m}{%
+                \SI{#2}{\m}%
+              }{\ifboolKV[Unites]{mm}{%
+                  \SI{#2}{\mm}%
+                }{\SI{#2}{\cm}%
+                }%
+              }%
             }%
           }%
         }%
@@ -10537,19 +11800,32 @@
 \newcommand\Masse[2][]{%
   \useKVdefault[Unites]%
   \setKV[Unites]{#1}%
-  \ifboolKV[Unites]{kg}{%
-    \SI{#2}{\kg}%
-  }{\ifboolKV[Unites]{hg}{%
-      \SI{#2}{\hecto\gram}%
-    }{\ifboolKV[Unites]{dag}{%
-        \SI{#2}{\deca\gram}%
-      }{\ifboolKV[Unites]{dg}{%
-          \SI{#2}{\deci\gram}%
-        }{\ifboolKV[Unites]{cg}{%
-            \SI{#2}{\centi\gram}%
-          }{\ifboolKV[Unites]{mg}{%
-              \SI{#2}{\milli\gram}%
-            }{\SI{#2}{\gram}%
+  \ifboolKV[Unites]{ng}{%
+    \SI{#2}{\ng}%
+  }{\ifboolKV[Unites]{ug}{%
+      \SI{#2}{\ug}%
+    }{\ifboolKV[Unites]{t}{%
+        \SI{#2}{\tonne}%
+      }{\ifboolKV[Unites]{q}{%
+          \SI{#2}{\quintal}%
+        }{%
+          \ifboolKV[Unites]{kg}{%
+            \SI{#2}{\kg}%
+          }{\ifboolKV[Unites]{hg}{%
+              \SI{#2}{\hecto\gram}%
+            }{\ifboolKV[Unites]{dag}{%
+                \SI{#2}{\deca\gram}%
+              }{\ifboolKV[Unites]{dg}{%
+                  \SI{#2}{\deci\gram}%
+                }{\ifboolKV[Unites]{cg}{%
+                    \SI{#2}{\centi\gram}%
+                  }{\ifboolKV[Unites]{mg}{%
+                      \SI{#2}{\milli\gram}%
+                    }{\SI{#2}{\gram}%
+                    }%
+                  }%
+                }%
+              }%
             }%
           }%
         }%
@@ -10589,15 +11865,21 @@
     \SI{#2}{\square\km}%
   }{\ifboolKV[Unites]{hm}{%
       \SI{#2}{\square\hecto\metre}%
-    }{\ifboolKV[Unites]{dam}{%
-        \SI{#2}{\square\deca\metre}%
-      }{\ifboolKV[Unites]{dm}{%
-          \SI{#2}{\square\dm}%
-        }{\ifboolKV[Unites]{m}{%
-            \SI{#2}{\square\metre}%
-          }{\ifboolKV[Unites]{mm}{%
-              \SI{#2}{\square\mm}%
-            }{\SI{#2}{\square\cm}%
+    }{\ifboolKV[Unites]{ha}{%
+        \SI{#2}{\hectare}%
+      }{\ifboolKV[Unites]{dam}{%
+          \SI{#2}{\square\deca\metre}%
+        }{\ifboolKV[Unites]{a}{%
+            \SI{#2}{\are}%
+          }{\ifboolKV[Unites]{dm}{%
+              \SI{#2}{\square\dm}%
+            }{\ifboolKV[Unites]{m}{%
+                \SI{#2}{\square\metre}%
+              }{\ifboolKV[Unites]{mm}{%
+                  \SI{#2}{\square\mm}%
+                }{\SI{#2}{\square\cm}%
+                }%
+              }%
             }%
           }%
         }%
@@ -10636,7 +11918,11 @@
   \ifboolKV[Unites]{ms}{%
     \SI[per-mode=symbol]{#2}{\meter\per\second}%
   }{%
-    \SI[per-mode=symbol]{#2}{\kilo\meter\per\hour}%
+    \ifboolKV[Unites]{kms}{%
+      \SI[per-mode=symbol]{#2}{\kilo\meter\per\second}%
+    }{%
+      \SI[per-mode=symbol]{#2}{\kilo\meter\per\hour}%
+    }%
   }%
 }%
 
@@ -10650,35 +11936,77 @@
   }%
 }%
 
-%%%%%%%%% 
-%% Tableaux d'unités
-%%%%%%%%%
-\setKVdefault[ClesTableaux]{Entiers=false,Decimaux=false,Milliards=false,Millions=false,Milliers=true,Partie=false,CouleurG=gray!15,CouleurM=gray!15,Couleurm=gray!15,Couleuru=gray!15,Classes=false,Nombres=false,Metre=false,Carre=false,Cube=false,Litre=false,Gramme=false,Fleches=false,Colonnes=false,Prefixes=false}
+%%%
+% Tableaux d'unités
+%%%
+\setKVdefault[ClesTableaux]{Virgule=true,Entiers=false,Decimaux=false,Milliards=false,Millions=false,Micro=false,Nano=false,Partie=false,CouleurG=gray!15,CouleurM=gray!15,Couleurm=gray!15,Couleuru=gray!15,Classes=false,Nombres=false,Puissances=false,NbLignes=2,Metre=false,Are=false,Capacite=false,Carre=false,Cube=false,Litre=false,Gramme=false,Fleches=false,FlechesB=false,FlechesH=false,Colonnes=false,Prefixes=false}
 
 \newcommand\Tableau[1][]{%
   \useKVdefault[ClesTableaux]%
   \setKV[ClesTableaux]{#1}%
+  % 
+  %%% Clé Prefixes
+  % 
   \ifboolKV[ClesTableaux]{Prefixes}{%
-    \setlength{\tabcolsep}{0.01\tabcolsep}
-    \begin{center}
-      \begin{tabular}{|*{12}{>{\centering\arraybackslash}m{3.25em}|}>{\columncolor{gray!15},}{c}|*{12}{>{\centering\arraybackslash}m{3.25em}|}}
+    \setlength{\tabcolsep}{0.01\tabcolsep}%
+    \begin{center}%
+      % 
+      %%% Definition du tableau
+      % 
+      \begin{tabular}{|*{\ifboolKV[ClesTableaux]{Milliards}{12}{%
+      \ifboolKV[ClesTableaux]{Millions}{9}{6}%
+      }}{>{\centering\arraybackslash}m{3.25em}|}>{\columncolor{gray!15}}{c}|*{%	
+      \ifboolKV[ClesTableaux]{Micro}{6}{%
+      \ifboolKV[ClesTableaux]{Nano}{9}{3}%
+      }}%
+      {>{\centering\arraybackslash}m{3.25em}|}}%
+        %
+      	%%% Prise en compte de la clé Partie
+      	%
         \ifboolKV[ClesTableaux]{Partie}{%
-        \multicolumn{12}{c}{\bfseries Partie entière}
-        &\multicolumn{1}{c}{\cellcolor{gray!15},}%
-        &\multicolumn{12}{c}{\bfseries Partie décimale}\\}{}
+        \multicolumn{%
+        \ifboolKV[ClesTableaux]{Milliards}{12}{%
+      \ifboolKV[ClesTableaux]{Millions}{9}{6}%
+      }}{c}{\bfseries Partie entière}
+        &\multicolumn{1}{c}{\cellcolor{gray!15}\ifboolKV[ClesTableaux]{Virgule}{,}{}}%
+        &\multicolumn{%	
+      \ifboolKV[ClesTableaux]{Micro}{6}{%
+      \ifboolKV[ClesTableaux]{Nano}{9}{3}%
+      }}%
+      {c}{\bfseries Partie décimale}\\}{}%
+        %
+      	%%% Prise en compte de la clé Classes
+      	%
         \ifboolKV[ClesTableaux]{Classes}{%
-        \hline%
-        \multicolumn{3}{|c|}{\cellcolor{\useKV[ClesTableaux]{CouleurG}}Classe
-        des milliards}%
-        &\multicolumn{3}{c|}{\cellcolor{\useKV[ClesTableaux]{CouleurM}}Classe
+        \hline
+        \ifboolKV[ClesTableaux]{Milliards}{%
+        \cline{1-12}\multicolumn{3}{|c|}{\cellcolor{\useKV[ClesTableaux]{CouleurG}}Classe des milliards}%
+        &\multicolumn{3}{c|}{\cellcolor{\useKV[ClesTableaux]{CouleurM}}Classe des millions}%
+          &}{%
+        \ifboolKV[ClesTableaux]{Millions}{%
+        \cline{1-9}\multicolumn{3}{|c|}{\cellcolor{\useKV[ClesTableaux]{CouleurM}}Classe
           des millions}%
-        &\multicolumn{3}{c|}{\cellcolor{\useKV[ClesTableaux]{Couleurm}}Classe
+          &}{%
+        \cline{1-6}}}%
+        \ifboolKV[ClesTableaux]{Milliards}{%
+        \multicolumn{3}{c|}}{%
+        \ifboolKV[ClesTableaux]{Millions}{%
+        \multicolumn{3}{c|}}{\multicolumn{3}{|c|}}}%
+        {\cellcolor{\useKV[ClesTableaux]{Couleurm}}Classe
           des milliers}%
         &\multicolumn{3}{c|}{\cellcolor{\useKV[ClesTableaux]{Couleuru}}Classe
           des unités}%
-        &&&&&&&&&&&&&\\}{}
-        \hline
-        % 
+        &\ifboolKV[ClesTableaux]{Virgule}{,}{}%
+        &\multicolumn{%	
+      \ifboolKV[ClesTableaux]{Micro}{6}{%
+      \ifboolKV[ClesTableaux]{Nano}{9}{3}%
+      }}%
+      {c|}{}\\}{}%
+      	%
+      	%%% Valeurs par défaut
+      	%
+        \hline%
+        \ifboolKV[ClesTableaux]{Milliards}{%
         &%
         &\fontsize{8.5}{8.5}\selectfont giga%
         &%
@@ -10685,69 +12013,158 @@
         &%
         &\fontsize{8.5}{8.5}\selectfont méga%
         &%
+        }{%
+        \ifboolKV[ClesTableaux]{Millions}{%
         &%
+        &\fontsize{8.5}{8.5}\selectfont méga%
+        &%
+        }{%
+        }}%
+        &%
         &\fontsize{8.5}{8.5}\selectfont kilo%
         &\fontsize{8.5}{8.5}\selectfont hecto%
         &\fontsize{8.5}{8.5}\selectfont déca%
         &\fontsize{8.5}{8.5}\selectfont unités%
-        &%
+        &\ifboolKV[ClesTableaux]{Virgule}{,}{}%
         &\fontsize{8.5}{8.5}\selectfont deci%
         &\fontsize{8.5}{8.5}\selectfont centi%
-        &\fontsize{8.5}{8.5}\selectfont milli%
+        &\fontsize{8.5}{8.5}\selectfont milli%	
+      	\ifboolKV[ClesTableaux]{Micro}{&%
         &%
+        &\fontsize{8.5}{8.5}\selectfont micro\\}{%
+      	\ifboolKV[ClesTableaux]{Nano}{&%
         &%
         &\fontsize{8.5}{8.5}\selectfont micro%
         &%
         &%
-        &\fontsize{8.5}{8.5}\selectfont nano%
+        &\fontsize{8.5}{8.5}\selectfont nano\\}{\\}%
+      	}%     
+        %
+      	%%% Prise en compte de la clé Nombres
+      	%
+        \ifboolKV[ClesTableaux]{Nombres}{%
+        \ifboolKV[ClesTableaux]{Milliards}{%
+        \fontsize{4.5}{4.5}\selectfont\num{100000000000}%
+        &\fontsize{4.5}{4.5}\selectfont\num{10000000000}%
+        &\fontsize{4.5}{4.5}\selectfont\num{1000000000}%
+        &\fontsize{4.5}{4.5}\selectfont \num{100000000}%
+        &\fontsize{4.5}{4.5}\selectfont \num{10000000}%
+        &\fontsize{4.5}{4.5}\selectfont \num{1000000}%
         &%
+        }{}
+        \ifboolKV[ClesTableaux]{Millions}{%
+        \fontsize{4.5}{4.5}\selectfont \num{100000000}%
+        &\fontsize{4.5}{4.5}\selectfont \num{10000000}%
+        &\fontsize{4.5}{4.5}\selectfont \num{1000000}%
         &%
-        &\\      
-        \ifboolKV[ClesTableaux]{Nombres}{%
+        }{}
+        \fontsize{4.5}{4.5}\selectfont \num{100000}%
+        &\fontsize{4.5}{4.5}\selectfont \num{10000}%
+        &\fontsize{4.5}{4.5}\selectfont \num{1000}%
+        &\fontsize{4.5}{4.5}\selectfont \num{100}%
+        &\fontsize{4.5}{4.5}\selectfont \num{10}%
+        &\fontsize{4.5}{4.5}\selectfont \num{1}%
+        &\ifboolKV[ClesTableaux]{Virgule}{,}{}%
+        &\fontsize{4.5}{4.5}\selectfont \num{0,1} ou $\dfrac{\strut1}{\strut10}$%
+        &\fontsize{4.5}{4.5}\selectfont \num{0,01} ou $\dfrac{\strut1}{\strut100}$%
+        &\fontsize{4.5}{4.5}\selectfont \num{0,001} ou $\dfrac{\strut1}{\strut\num{1000}}$%
+        \ifboolKV[ClesTableaux]{Micro}{%
+        &\fontsize{4.5}{4.5}\selectfont \num{0,0001} ou $\dfrac{\strut1}{\strut\num{10000}}$%
+        &\fontsize{4.5}{4.5}\selectfont \num{0,00001} ou $\dfrac{\strut1}{\strut\num{100000}}$%
+        &\fontsize{4.5}{4.5}\selectfont \num{0,000001} ou $\dfrac{\strut1}{\strut\num{1000000}}$%
+        }{%
+        \ifboolKV[ClesTableaux]{Nano}{%
+        &\fontsize{4.5}{4.5}\selectfont \num{0,0001} ou $\dfrac{\strut1}{\strut\num{10000}}$%
+        &\fontsize{4.5}{4.5}\selectfont \num{0,00001} ou $\dfrac{\strut1}{\strut\num{100000}}$%
+        &\fontsize{4.5}{4.5}\selectfont \num{0,000001} ou $\dfrac{\strut1}{\strut\num{1000000}}$%
+        &\fontsize{4.5}{4.5}\selectfont \num{0,0000001} ou $\dfrac{\strut1}{\strut\num{10000000}}$%
+        &\fontsize{4.5}{4.5}\selectfont \num{0,00000001} ou $\dfrac{\strut1}{\strut\num{100000000}}$%
+        &\fontsize{4.5}{4.5}\selectfont \num{0,000000001} ou $\dfrac{\strut1}{\strut\num{1000000000}}$%
+        }{}%
+        }{}\\}{}%
+        %
+      	%%% Prise en compte de la clé Puissances
+      	%
+        \ifboolKV[ClesTableaux]{Puissances}{%
+        \ifboolKV[ClesTableaux]{Milliards}{%
         &%
         &\fontsize{4.5}{4.5}\selectfont $\times10^{9}$%
         &%
         &%
         &\fontsize{4.5}{4.5}\selectfont $\times10^{6}$%
+        &
+        }{%
+        \ifboolKV[ClesTableaux]{Millions}{%
         &%
+        &\fontsize{4.5}{4.5}\selectfont $\times10^{6}$%
+        &
+        }{%
+        }}%
         &%
         &\fontsize{4.5}{4.5}\selectfont $\times10^3$%
         &\fontsize{4.5}{4.5}\selectfont $\times\num{10}^2$%
         &\fontsize{4.5}{4.5}\selectfont $\times\num{10}^1$%
         &\fontsize{4.5}{4.5}\selectfont $\times\num{1}$%
+        &\ifboolKV[ClesTableaux]{Virgule}{,}{}%
+        &\fontsize{4.5}{4.5}\selectfont $\times\num{10}^{-1}$%
+        &\fontsize{4.5}{4.5}\selectfont $\times\num{10}^{-2}$%
+        &\fontsize{4.5}{4.5}\selectfont $\times\num{10}^{-3}$%
+        \ifboolKV[ClesTableaux]{Micro}{&%
         &%
-        &\fontsize{4.5}{4.5}\selectfont$\times\num{10}^{-1}$%
-        &\fontsize{4.5}{4.5}\selectfont$\times\num{10}^{-2}$%
-        &\fontsize{4.5}{4.5}\selectfont$\times\num{10}^{-3}$%
+        &\fontsize{4.5}{4.5}\selectfont $\times\num{10}^{-6}$}{%
+      	\ifboolKV[ClesTableaux]{Nano}{&%
         &%
-        &%
         &\fontsize{4.5}{4.5}\selectfont $\times\num{10}^{-6}$%
         &%
         &%
-        &\fontsize{4.5}{4.5}\selectfont $\times\num{10}^{-9}$%  
-        &
-        &
-        &\\
-        }{}
-        \hline
-        &&&&&&&&&&&&&&&&&&&&&&&&\\
-        &&&&&&&&&&&&&&&&&&&&&&&&\\
-      \end{tabular}
-    \end{center}
-    \setlength{\tabcolsep}{100\tabcolsep}
+        &\fontsize{4.5}{4.5}\selectfont $\times\num{10}^{-9}$}{}%
+      	}%
+        \\%
+        }{}%
+        %
+      	%%% Lignes vierges
+      	%
+        \hline%
+        \xintFor* ##1 in {\xintSeq{1}{\useKV[ClesTableaux]{NbLignes}}}\do{%
+        \ifboolKV[ClesTableaux]{Milliards}{%
+        &&&&&&%
+        }{%
+        \ifboolKV[ClesTableaux]{Millions}{%
+        &&&%
+        }{%
+        }}%
+        &&&&&&,&&&%
+		\ifboolKV[ClesTableaux]{Micro}{&&&}{%
+      	\ifboolKV[ClesTableaux]{Nano}{&&&&&&}{}%
+      	}	        
+        \\}%
+      \end{tabular}%
+    \end{center}%
+    \setlength{\tabcolsep}{100\tabcolsep}%
   }{}%
+  % 
+  %%% Clé Entiers
+  % 
   \ifboolKV[ClesTableaux]{Entiers}{%
-    \setlength{\tabcolsep}{0.01\tabcolsep}
-    \begin{center}
-      \begin{tabular}{|*{12}{>{\centering\arraybackslash}m{4.75em}|}}
-        \ifboolKV[ClesTableaux]{Classes}{\hline\multicolumn{3}{|c|}{\cellcolor{\useKV[ClesTableaux]{CouleurG}}Classe
-        des milliards}%
-        &\multicolumn{3}{c|}{\cellcolor{\useKV[ClesTableaux]{CouleurM}}Classe
-          des millions}%
-        &\multicolumn{3}{c|}{\cellcolor{\useKV[ClesTableaux]{Couleurm}}Classe
+    \setlength{\tabcolsep}{0.01\tabcolsep}%
+    \begin{center}%
+      %  
+      %%% Definition du tableau
+      %
+    \begin{tabular}{|*{%
+			\ifboolKV[ClesTableaux]{Milliards}{12}{%
+      \ifboolKV[ClesTableaux]{Millions}{9}{6}%
+      }%
+      }{>{\centering\arraybackslash}m{4.75em}|}}%
+        \ifboolKV[ClesTableaux]{Classes}{%
+        \hline
+        \ifboolKV[ClesTableaux]{Milliards}{\multicolumn{3}{|c}{\cellcolor{\useKV[ClesTableaux]{CouleurG}}Classe des milliards}&\multicolumn{3}{|c}{\cellcolor{\useKV[ClesTableaux]{CouleurM}}Classe des millions}&}{}
+        \ifboolKV[ClesTableaux]{Millions}{\multicolumn{3}{|c}{\cellcolor{\useKV[ClesTableaux]{CouleurM}}Classe des millions}&}{}
+        \multicolumn{3}{|c|}{\cellcolor{\useKV[ClesTableaux]{Couleurm}}Classe
           des milliers}%
         &\multicolumn{3}{c|}{\cellcolor{\useKV[ClesTableaux]{Couleuru}}Classe des unités}\\}{}
         \hline
+        \ifboolKV[ClesTableaux]{Milliards}{%
         \fontsize{4.5}{4.5}\selectfont centaines de milliards%
         &\fontsize{4.5}{4.5}\selectfont dizaines de milliards%
         &\fontsize{4.5}{4.5}\selectfont unités de milliards%
@@ -10754,7 +12171,15 @@
         &\fontsize{4.5}{4.5}\selectfont centaines de millions%
         &\fontsize{4.5}{4.5}\selectfont dizaines de millions%
         &\fontsize{4.5}{4.5}\selectfont unités de millions%
-        &\fontsize{4.5}{4.5}\selectfont centaines de milliers%
+        &
+        }{}
+        \ifboolKV[ClesTableaux]{Millions}{%
+        \fontsize{4.5}{4.5}\selectfont centaines de millions%
+        &\fontsize{4.5}{4.5}\selectfont dizaines de millions%
+        &\fontsize{4.5}{4.5}\selectfont unités de millions%
+        &
+        }{}
+        \fontsize{4.5}{4.5}\selectfont centaines de milliers%
         &\fontsize{4.5}{4.5}\selectfont dizaines de milliers%
         &\fontsize{4.5}{4.5}\selectfont unités de milliers%
         &\fontsize{4.5}{4.5}\selectfont centaines%
@@ -10761,13 +12186,22 @@
         &\fontsize{4.5}{4.5}\selectfont dizaines%
         &\fontsize{4.5}{4.5}\selectfont unités\\%
         \ifboolKV[ClesTableaux]{Nombres}{%
-        \fontsize{4.5}{4.5}\selectfont \num{100000000000}%
-        &\fontsize{4.5}{4.5}\selectfont \num{10000000000}%
-        &\fontsize{4.5}{4.5}\selectfont \num{1000000000}%
+        \ifboolKV[ClesTableaux]{Milliards}{%
+        \fontsize{4.5}{4.5}\selectfont\num{100000000000}%
+        &\fontsize{4.5}{4.5}\selectfont\num{10000000000}%
+        &\fontsize{4.5}{4.5}\selectfont\num{1000000000}%
         &\fontsize{4.5}{4.5}\selectfont \num{100000000}%
         &\fontsize{4.5}{4.5}\selectfont \num{10000000}%
         &\fontsize{4.5}{4.5}\selectfont \num{1000000}%
-        &\fontsize{4.5}{4.5}\selectfont \num{100000}%
+        &%
+        }{}
+        \ifboolKV[ClesTableaux]{Millions}{%
+        \fontsize{4.5}{4.5}\selectfont \num{100000000}%
+        &\fontsize{4.5}{4.5}\selectfont \num{10000000}%
+        &\fontsize{4.5}{4.5}\selectfont \num{1000000}%
+        &%
+        }{}
+        \fontsize{4.5}{4.5}\selectfont \num{100000}%
         &\fontsize{4.5}{4.5}\selectfont \num{10000}%
         &\fontsize{4.5}{4.5}\selectfont \num{1000}%
         &\fontsize{4.5}{4.5}\selectfont \num{100}%
@@ -10774,53 +12208,106 @@
         &\fontsize{4.5}{4.5}\selectfont \num{10}%
         &\fontsize{4.5}{4.5}\selectfont \num{1}%
         \\
-        }{}
-        \hline
-        &&&&&&&&&&&\\
-        &&&&&&&&&&&\\
-      \end{tabular}
-    \end{center}
-    \setlength{\tabcolsep}{100\tabcolsep}
+        }{} 
+        %
+      	%%% Prise en compte de la clé Puissances
+      	%
+        \ifboolKV[ClesTableaux]{Puissances}{%
+        \ifboolKV[ClesTableaux]{Milliards}{%
+        &%
+        &\fontsize{4.5}{4.5}\selectfont $\times10^{9}$%
+        &%
+        &%
+        &\fontsize{4.5}{4.5}\selectfont $\times10^{6}$%
+        &
+        }{%
+        \ifboolKV[ClesTableaux]{Millions}{%
+        &%
+        &\fontsize{4.5}{4.5}\selectfont $\times10^{6}$%
+        &
+        }{%
+        }}%
+        &%
+        &\fontsize{4.5}{4.5}\selectfont $\times10^3$%
+        &\fontsize{4.5}{4.5}\selectfont $\times\num{10}^2$%
+        &\fontsize{4.5}{4.5}\selectfont $\times\num{10}^1$%
+        &\fontsize{4.5}{4.5}\selectfont $\times\num{1}$%
+        \\%
+        }{}%
+        %
+      	%%% Lignes vierges
+      	%
+        \hline%        
+        \xintFor* ##1 in {\xintSeq{1}{\useKV[ClesTableaux]{NbLignes}}}\do{%
+        \ifboolKV[ClesTableaux]{Milliards}{%
+        &&&&&&}{}%                         
+        \ifboolKV[ClesTableaux]{Millions}{%
+        &&&}{}
+        &&&&&\\}%
+      \end{tabular}%
+    \end{center}%
+    \setlength{\tabcolsep}{100\tabcolsep}%
   }{}%
+  %
+  %%% Clé Decimaux
+  %
   \ifboolKV[ClesTableaux]{Decimaux}{%
-    \setlength{\tabcolsep}{0.01\tabcolsep}
-    \ifboolKV[ClesTableaux]{Milliards}{%
-      \newcolumntype{X}{|*{12}{>{\centering\arraybackslash}m{4.75em}|}>{\columncolor{gray!15},}{c}|*{3}{>{\centering\arraybackslash}m{4.75em}|}}%
-    }{\ifboolKV[ClesTableaux]{Millions}{%
-        \newcolumntype{X}{|*{9}{>{\centering\arraybackslash}m{4.75em}|}>{\columncolor{gray!15},}{c}|*{3}{>{\centering\arraybackslash}m{4.75em}|}}%
-      }{\newcolumntype{X}{|*{6}{>{\centering\arraybackslash}m{4.75em}|}>{\columncolor{gray!15},}{c}|*{3}{>{\centering\arraybackslash}m{4.75em}|}}%
-      }
-    }
-    \begin{center}
-      \begin{tabular}{X}
+    \setlength{\tabcolsep}{0.01\tabcolsep}%
+    \begin{center}%
+      % 
+      %%% Definition du tableau
+      % 
+      \begin{tabular}{|*{\ifboolKV[ClesTableaux]{Milliards}{12}{%
+      \ifboolKV[ClesTableaux]{Millions}{9}{6}%
+      }}{>{\centering\arraybackslash}m{4.75em}|}>{\columncolor{gray!15}}{c}|*{3}%
+      {>{\centering\arraybackslash}m{4.75em}|}}%
+      	%
+      	%%% Prise en compte de la clé Partie
+      	%
         \ifboolKV[ClesTableaux]{Partie}{%
-        \ifboolKV[ClesTableaux]{Milliards}{\multicolumn{12}{c}{\bfseries Partie entière}}{\ifboolKV[ClesTableaux]{Millions}{\multicolumn{9}{c}{\bfseries Partie entière}}{\multicolumn{6}{c}{\bfseries Partie entière}}}
-        &\multicolumn{1}{c}{\cellcolor{gray!15},}%
+        \ifboolKV[ClesTableaux]{Milliards}{%
+        \multicolumn{12}{c}{\bfseries Partie entière}}{%
+        \ifboolKV[ClesTableaux]{Millions}{%
+        \multicolumn{9}{c}{\bfseries Partie entière}}{%
+        \multicolumn{6}{c}{\bfseries Partie entière}}}%
+        &\multicolumn{1}{c}{\cellcolor{gray!15}\ifboolKV[ClesTableaux]{Virgule}{,}{}}%
         &\multicolumn{3}{c}{\bfseries Partie décimale}\\}{}
+        %
+      	%%% Prise en compte de la clé Classes
+      	%
         \ifboolKV[ClesTableaux]{Classes}{%
         \hline%
-        \ifboolKV[ClesTableaux]{Milliards}{\multicolumn{3}{|c}{\cellcolor{\useKV[ClesTableaux]{CouleurG}}Classe des milliards}\uppercase{&}\multicolumn{3}{|c}{\cellcolor{\useKV[ClesTableaux]{CouleurM}}Classe des millions}\uppercase{&}}{}
-        \ifboolKV[ClesTableaux]{Millions}{\multicolumn{3}{|c}{\cellcolor{\useKV[ClesTableaux]{CouleurM}}Classe des millions}\uppercase{&}}{}
-        \multicolumn{3}{|c|}{\cellcolor{\useKV[ClesTableaux]{Couleurm}}Classe
+        \ifboolKV[ClesTableaux]{Milliards}{%
+        \multicolumn{3}{|c|}{\cellcolor{\useKV[ClesTableaux]{CouleurG}}Classe des milliards}&\multicolumn{3}{c|}{\cellcolor{\useKV[ClesTableaux]{CouleurM}}Classe des millions}&}{}%
+        \ifboolKV[ClesTableaux]{Millions}{%
+        \multicolumn{3}{|c|}{\cellcolor{\useKV[ClesTableaux]{CouleurM}}Classe des millions}&}{}%
+        \ifboolKV[ClesTableaux]{Milliards}{%
+        \multicolumn{3}{c|}}{%
+        \ifboolKV[ClesTableaux]{Millions}{%
+        \multicolumn{3}{c|}}{\multicolumn{3}{|c|}}}%
+        {\cellcolor{\useKV[ClesTableaux]{Couleurm}}Classe
           des milliers}%
         &\multicolumn{3}{c|}{\cellcolor{\useKV[ClesTableaux]{Couleuru}}Classe
           des unités}%
-        &&&&\\}{}
+        &\ifboolKV[ClesTableaux]{Virgule}{,}{}&\multicolumn{3}{c|}{}\\}{}
+        %
+        %%% Valeurs ci-dessous par défaut
+        %
         \hline
         \ifboolKV[ClesTableaux]{Milliards}{%
         \fontsize{4.5}{4.5}\selectfont centaines de milliards%
-        \uppercase{&}\fontsize{4.5}{4.5}\selectfont dizaines de milliards%
-        \uppercase{&}\fontsize{4.5}{4.5}\selectfont unités de milliards%
-        \uppercase{&}\fontsize{4.5}{4.5}\selectfont centaines de millions%
-        \uppercase{&}\fontsize{4.5}{4.5}\selectfont dizaines de millions%
-        \uppercase{&}\fontsize{4.5}{4.5}\selectfont unités de millions%
-        \uppercase{&}
+        &\fontsize{4.5}{4.5}\selectfont dizaines de milliards%
+        &\fontsize{4.5}{4.5}\selectfont unités de milliards%
+        &\fontsize{4.5}{4.5}\selectfont centaines de millions%
+        &\fontsize{4.5}{4.5}\selectfont dizaines de millions%
+        &\fontsize{4.5}{4.5}\selectfont unités de millions%
+        &
         }{}
         \ifboolKV[ClesTableaux]{Millions}{%
         \fontsize{4.5}{4.5}\selectfont centaines de millions%
-        \uppercase{&}\fontsize{4.5}{4.5}\selectfont dizaines de millions%
-        \uppercase{&}\fontsize{4.5}{4.5}\selectfont unités de millions%
-        \uppercase{&}
+        &\fontsize{4.5}{4.5}\selectfont dizaines de millions%
+        &\fontsize{4.5}{4.5}\selectfont unités de millions%
+        &
         }{}
         \fontsize{4.5}{4.5}\selectfont centaines de milliers%
         &\fontsize{4.5}{4.5}\selectfont dizaines de milliers%
@@ -10828,7 +12315,7 @@
         &\fontsize{4.5}{4.5}\selectfont centaines%
         &\fontsize{4.5}{4.5}\selectfont dizaines%
         &\fontsize{4.5}{4.5}\selectfont unités%
-        &%
+        &\ifboolKV[ClesTableaux]{Virgule}{,}{}%
         &\fontsize{4.5}{4.5}\selectfont dixièmes%
           &\fontsize{4.5}{4.5}\selectfont centièmes%
         &\fontsize{4.5}{4.5}\selectfont millièmes\\
@@ -10835,19 +12322,19 @@
         \ifboolKV[ClesTableaux]{Nombres}{%
         \ifboolKV[ClesTableaux]{Milliards}{%
         \fontsize{4.5}{4.5}\selectfont\num{100000000000}%
-        \uppercase{&}\fontsize{4.5}{4.5}\selectfont\num{10000000000}%
-        \uppercase{&}\fontsize{4.5}{4.5}\selectfont\num{1000000000}%
-        \uppercase{&}\fontsize{4.5}{4.5}\selectfont \num{100000000}%
-        \uppercase{&}\fontsize{4.5}{4.5}\selectfont \num{10000000}%
-        \uppercase{&}\fontsize{4.5}{4.5}\selectfont \num{1000000}%
-        \uppercase{&}%
+        &\fontsize{4.5}{4.5}\selectfont\num{10000000000}%
+        &\fontsize{4.5}{4.5}\selectfont\num{1000000000}%
+        &\fontsize{4.5}{4.5}\selectfont \num{100000000}%
+        &\fontsize{4.5}{4.5}\selectfont \num{10000000}%
+        &\fontsize{4.5}{4.5}\selectfont \num{1000000}%
+        &%
         }{}
         \ifboolKV[ClesTableaux]{Millions}{%
         \fontsize{4.5}{4.5}\selectfont \num{100000000}%
-        \uppercase{&}\fontsize{4.5}{4.5}\selectfont \num{10000000}%
-        \uppercase{&}\fontsize{4.5}{4.5}\selectfont \num{1000000}%
-        \uppercase{&}%
-        }{}          
+        &\fontsize{4.5}{4.5}\selectfont \num{10000000}%
+        &\fontsize{4.5}{4.5}\selectfont \num{1000000}%
+        &%
+        }{}
         \fontsize{4.5}{4.5}\selectfont \num{100000}%
         &\fontsize{4.5}{4.5}\selectfont \num{10000}%
         &\fontsize{4.5}{4.5}\selectfont \num{1000}%
@@ -10854,27 +12341,58 @@
         &\fontsize{4.5}{4.5}\selectfont \num{100}%
         &\fontsize{4.5}{4.5}\selectfont \num{10}%
         &\fontsize{4.5}{4.5}\selectfont \num{1}%
-        &%
+        &\ifboolKV[ClesTableaux]{Virgule}{,}{}%
         &\fontsize{4.5}{4.5}\selectfont \num{0,1} ou $\dfrac{\strut1}{\strut10}$%
         &\fontsize{4.5}{4.5}\selectfont \num{0,01} ou $\dfrac{\strut1}{\strut100}$%
         &\fontsize{4.5}{4.5}\selectfont \num{0,001} ou $\dfrac{\strut1}{\strut\num{1000}}$%
         \\
+        }{}%
+        % 
+        %%% Prise en compte de la clé Puissances
+        % 
+        \ifboolKV[ClesTableaux]{Puissances}{%
+        \ifboolKV[ClesTableaux]{Milliards}{%
+        &%
+        &\fontsize{4.5}{4.5}\selectfont $\times10^{9}$%
+        &%
+        &%
+        &\fontsize{4.5}{4.5}\selectfont $\times10^{6}$%
+        &
+        }{%
+        \ifboolKV[ClesTableaux]{Millions}{%
+        &%
+        &\fontsize{4.5}{4.5}\selectfont $\times10^{6}$%
+        &
+        }{%
+        }}%
+        &%
+        &\fontsize{4.5}{4.5}\selectfont $\times10^3$%
+        &\fontsize{4.5}{4.5}\selectfont $\times\num{10}^2$%
+        &\fontsize{4.5}{4.5}\selectfont $\times\num{10}^1$%
+        &\fontsize{4.5}{4.5}\selectfont $\times\num{1}$%
+        &\ifboolKV[ClesTableaux]{Virgule}{,}{}%
+        &\fontsize{4.5}{4.5}\selectfont $\times\num{10}^{-1}$%
+        &\fontsize{4.5}{4.5}\selectfont $\times\num{10}^{-2}$%
+        &\fontsize{4.5}{4.5}\selectfont $\times\num{10}^{-3}$%
+        \\%
         }{}
-        \hline
-       \ifboolKV[ClesTableaux]{Milliards}{%
-        \uppercase{&}\uppercase{&}\uppercase{&}\uppercase{&}\uppercase{&}\uppercase{&}}{}                %                                                                            
+        \hline%
+        %
+        %%% Lignes vierges       
+        % 
+        \xintFor* ##1 in {\xintSeq{1}{\useKV[ClesTableaux]{NbLignes}}}\do{%
+        \ifboolKV[ClesTableaux]{Milliards}{%
+        &&&&&&}{}%                         
        \ifboolKV[ClesTableaux]{Millions}{%
-       \uppercase{&}\uppercase{&}\uppercase{&}}{}
-                   &&&&&&&&&\\
-       \ifboolKV[ClesTableaux]{Milliards}{%
-        \uppercase{&}\uppercase{&}\uppercase{&}\uppercase{&}\uppercase{&}\uppercase{&}}{}                %                                                                            
-       \ifboolKV[ClesTableaux]{Millions}{%
-       \uppercase{&}\uppercase{&}\uppercase{&}}{}
-                   &&&&&&&&&\\
+       &&&}{}
+       &&&&&&,&&&\\}
       \end{tabular}
-    \end{center}
-    \setlength{\tabcolsep}{100\tabcolsep}
-  }{}
+    \end{center}%
+    \setlength{\tabcolsep}{100\tabcolsep}%
+  }{}%
+  % 
+  %%% Prise en compte de la clé Metre
+  % 
   \ifboolKV[ClesTableaux]{Metre}{%
     \[\renewcommand{\arraystretch}{1.15}%
       \begin{tabular}{|*{7}{p{7.5mm}|}}%
@@ -10888,7 +12406,8 @@
         \hline
         \multicolumn{1}{|c|}{km}&\multicolumn{1}{c|}{hm}&\multicolumn{1}{c|}{dam}&\multicolumn{1}{c|}{m}&\multicolumn{1}{c|}{dm}&\multicolumn{1}{c|}{cm}&\multicolumn{1}{c|}{mm}\\
         \hline
-        &&&&&&\\
+        \xintFor* ##1 in {\xintSeq{1}{\useKV[ClesTableaux]{NbLignes}}}\do{%
+        &&&&&&\\}
         \multicolumn{1}{c}{\tikz[remember picture,overlay]{\coordinate[yshift=1em] (G1);}}%
         &\multicolumn{1}{c}{\tikz[remember picture,overlay]{\coordinate[yshift=1em] (F1);}}%
         &\multicolumn{1}{c}{\tikz[remember picture,overlay]{\coordinate[yshift=1em] (E1);}}%
@@ -10896,33 +12415,25 @@
         &\multicolumn{1}{c}{\tikz[remember picture,overlay]{\coordinate[yshift=1em] (C1);}}%
         &\multicolumn{1}{c}{\tikz[remember picture,overlay]{\coordinate[yshift=1em] (B1);}}%
         &\multicolumn{1}{c}{\tikz[remember picture,overlay]{\coordinate[yshift=1em] (A1);}}\\%
-      \end{tabular}
-    \]
-    \ifboolKV[ClesTableaux]{Fleches}{%
-      \tikz[remember picture, overlay]{\draw[gray,->,>=latex,out=30,in=150] (A) to node[above, midway]{\small$\times\mbox{10}$}(B);}
-      \tikz[remember picture, overlay]{\draw[gray,->,>=latex,out=30,in=150] (B) to node[above, midway]{\small$\times\mbox{10}$}(C);}
-      \tikz[remember picture, overlay]{\draw[gray,->,>=latex,out=30,in=150] (C) to node[above, midway]{\small$\times\mbox{10}$}(D);}
-      \tikz[remember picture, overlay]{\draw[gray,->,>=latex,out=30,in=150] (D) to node[above, midway]{\small$\times\mbox{10}$}(E);}
-      \tikz[remember picture, overlay]{\draw[gray,->,>=latex,out=30,in=150] (E) to node[above, midway]{\small$\times\mbox{10}$}(F);}
-      \tikz[remember picture, overlay]{\draw[gray,->,>=latex,out=30,in=150] (F) to node[above, midway]{\small$\times\mbox{10}$}(G);}
-      % bas
-      \tikz[remember picture, overlay]{\draw[gray,->,>=latex,out=-150,in=-30] (A1) to node[below, midway]{\small$\div\mbox{10}$}(B1);}
-      \tikz[remember picture, overlay]{\draw[gray,->,>=latex,out=-150,in=-30] (B1) to node[below, midway]{\small$\div\mbox{10}$}(C1);}
-      \tikz[remember picture, overlay]{\draw[gray,->,>=latex,out=-150,in=-30] (C1) to node[below, midway]{\small$\div\mbox{10}$}(D1);}
-      \tikz[remember picture, overlay]{\draw[gray,->,>=latex,out=-150,in=-30] (D1) to node[below, midway]{\small$\div\mbox{10}$}(E1);}
-      \tikz[remember picture, overlay]{\draw[gray,->,>=latex,out=-150,in=-30] (E1) to node[below, midway]{\small$\div\mbox{10}$}(F1);}
-      \tikz[remember picture, overlay]{\draw[gray,->,>=latex,out=-150,in=-30] (F1) to node[below, midway]{\small$\div\mbox{10}$}(G1);}
-    }{}
-  }
-  {}
+      \end{tabular}%
+    \]%
+    \Conversion{10}%
+  }%
+  {}%
+  % 
+  %%% Prise en compte de la clé Carre
+  % 
   \ifboolKV[ClesTableaux]{Carre}{%
     \[\renewcommand{\arraystretch}{1.15}%
       \ifboolKV[ClesTableaux]{Colonnes}{%
-        \newcolumntype{X}{|*{7}{p{2.5mm}!{\color{gray!50}\vrule}p{2.5mm}|}}%
+      \newcolumntype{X}{|*{7}{>{\centering\arraybackslash}p{3.5mm}!{\color{gray!50}\vrule}>{\centering\arraybackslash}p{3.5mm}|}}%
       }{%
-        \newcolumntype{X}{|*{7}{p{2.5mm}p{2.5mm}|}}
-      }
-      \begin{tabular}{X}
+      \ifboolKV[ClesTableaux]{Are}{%
+      \newcolumntype{X}{|*{7}{>{\centering\arraybackslash}p{3.5mm}!{\color{gray!50}\vrule}>{\centering\arraybackslash}p{3.5mm}|}}%
+      }{
+        \newcolumntype{X}{|*{7}{p{3.5mm}p{3.5mm}|}}%
+    }}%
+      \begin{tabular}{X}%
         \multicolumn{2}{c}{\tikz[remember picture,overlay]{\coordinate (A);}}%
         &\multicolumn{2}{c}{\tikz[remember picture,overlay]{\coordinate (B);}}%
         &\multicolumn{2}{c}{\tikz[remember picture,overlay]{\coordinate (C);}}%
@@ -10931,9 +12442,14 @@
         &\multicolumn{2}{c}{\tikz[remember picture,overlay]{\coordinate (F);}}%
         &\multicolumn{2}{c}{\tikz[remember picture,overlay]{\coordinate (G);}}\\%
         \hline
-        \multicolumn{2}{|c|}{km$^2$}&\multicolumn{2}{c|}{hm$^2$}&\multicolumn{2}{c|}{dam$^2$}&\multicolumn{2}{c|}{m$^2$}&\multicolumn{2}{c|}{dm$^2$}&\multicolumn{2}{c|}{cm$^2$}&\multicolumn{2}{c|}{mm$^2$}\\
-        \hline
-        &&&&&&&&&&&&&\\
+        \multicolumn{2}{|c|}{km$^2$}&\multicolumn{2}{c|}{hm$^2$}&\multicolumn{2}{c|}{dam$^2$}&\multicolumn{2}{c|}{m$^2$}&\multicolumn{2}{c|}{dm$^2$}&\multicolumn{2}{c|}{cm$^2$}&\multicolumn{2}{c|}{mm$^2$}\\%
+        \ifboolKV[ClesTableaux]{Are}{%
+        \cline{3-6}
+        \multicolumn{2}{|c|}{}&&{\scriptsize ha}&&{\scriptsize a}&\multicolumn{2}{c|}{}&\multicolumn{2}{c|}{}&\multicolumn{2}{c|}{}&\multicolumn{2}{c|}{}\\
+        }{}        
+        \hline        
+        \xintFor* ##1 in {\xintSeq{1}{\useKV[ClesTableaux]{NbLignes}}}\do{%
+        &&&&&&&&&&&&&\\}
         \multicolumn{2}{c}{\tikz[remember picture,overlay]{\coordinate[yshift=0.6em] (G1);}}%
         &\multicolumn{2}{c}{\tikz[remember picture,overlay]{\coordinate[yshift=0.6em] (F1);}}%
         &\multicolumn{2}{c}{\tikz[remember picture,overlay]{\coordinate[yshift=0.6em] (E1);}}%
@@ -10942,32 +12458,23 @@
         &\multicolumn{2}{c}{\tikz[remember picture,overlay]{\coordinate[yshift=0.6em] (B1);}}%
         &\multicolumn{2}{c}{\tikz[remember picture,overlay]{\coordinate[yshift=0.6em] (A1);}}\\%
       \end{tabular}
-    \]
-    \ifboolKV[ClesTableaux]{Fleches}{%
-      \tikz[remember picture, overlay]{\draw[gray,->,>=latex,out=30,in=150] (A) to node[above, midway]{\small$\times\mbox{100}$}(B);}
-      \tikz[remember picture, overlay]{\draw[gray,->,>=latex,out=30,in=150] (B) to node[above, midway]{\small$\times\mbox{100}$}(C);}
-      \tikz[remember picture, overlay]{\draw[gray,->,>=latex,out=30,in=150] (C) to node[above, midway]{\small$\times\mbox{100}$}(D);}
-      \tikz[remember picture, overlay]{\draw[gray,->,>=latex,out=30,in=150] (D) to node[above, midway]{\small$\times\mbox{100}$}(E);}
-      \tikz[remember picture, overlay]{\draw[gray,->,>=latex,out=30,in=150] (E) to node[above, midway]{\small$\times\mbox{100}$}(F);}
-      \tikz[remember picture, overlay]{\draw[gray,->,>=latex,out=30,in=150] (F) to node[above, midway]{\small$\times\mbox{100}$}(G);}
-      % bas
-      \tikz[remember picture, overlay]{\draw[gray,->,>=latex,out=-150,in=-30] (A1) to node[below, midway]{\small$\div\mbox{100}$}(B1);}
-      \tikz[remember picture, overlay]{\draw[gray,->,>=latex,out=-150,in=-30] (B1) to node[below, midway]{\small$\div\mbox{100}$}(C1);}
-      \tikz[remember picture, overlay]{\draw[gray,->,>=latex,out=-150,in=-30] (C1) to node[below, midway]{\small$\div\mbox{100}$}(D1);}
-      \tikz[remember picture, overlay]{\draw[gray,->,>=latex,out=-150,in=-30] (D1) to node[below, midway]{\small$\div\mbox{100}$}(E1);}
-      \tikz[remember picture, overlay]{\draw[gray,->,>=latex,out=-150,in=-30] (E1) to node[below, midway]{\small$\div\mbox{100}$}(F1);}
-      \tikz[remember picture, overlay]{\draw[gray,->,>=latex,out=-150,in=-30] (F1) to node[below, midway]{\small$\div\mbox{100}$}(G1);}
-    }{}%
-  }%
-  {}%
+    \]%
+    \Conversion{100}%
+  }{}%
+  % 
+  %%% Prise en compte de la clé Cube
+  % 
   \ifboolKV[ClesTableaux]{Cube}{%
     \setlength{\tabcolsep}{0.625\tabcolsep}%
-    \ifboolKV[ClesTableaux]{Colonnes}{%
-      \newcolumntype{X}{|*{7}{p{2.5mm}!{\color{gray!50}\vrule}p{2.5mm}!{\color{gray!50}\vrule}p{2.5mm}|}}%
+	\ifboolKV[ClesTableaux]{Colonnes}{%
+      \newcolumntype{X}{|*{7}{>{\centering\arraybackslash}p{3.5mm}!{\color{gray!50}\vrule}>{\centering\arraybackslash}p{3.5mm}!{\color{gray!50}\vrule}>{\centering\arraybackslash}p{3.5mm}|}}%
     }{%
-      \newcolumntype{X}{|*{7}{p{2.5mm}p{2.5mm}p{2.5mm}|}}%
-    }
-    \[\renewcommand{\arraystretch}{1.15}
+    \ifboolKV[ClesTableaux]{Capacite}{%
+      \newcolumntype{X}{|*{7}{>{\centering\arraybackslash}p{3.5mm}!{\color{gray!50}\vrule}>{\centering\arraybackslash}p{3.5mm}!{\color{gray!50}\vrule}>{\centering\arraybackslash}p{3.5mm}|}}%
+    }{%
+      \newcolumntype{X}{|*{7}{p{3.5mm}p{3.5mm}p{3.5mm}|}}%
+    }}% 
+    \[\renewcommand{\arraystretch}{1.15}%
       \begin{tabular}{X}
         \multicolumn{3}{c}{\tikz[remember picture,overlay]{\coordinate (A);}}%
         &\multicolumn{3}{c}{\tikz[remember picture,overlay]{\coordinate (B);}}%
@@ -10978,8 +12485,14 @@
         &\multicolumn{3}{c}{\tikz[remember picture,overlay]{\coordinate (G);}}\\%
         \hline
         \multicolumn{3}{|c|}{km$^3$}&\multicolumn{3}{c|}{hm$^3$}&\multicolumn{3}{c|}{dam$^3$}&\multicolumn{3}{c|}{m$^3$}&\multicolumn{3}{c|}{dm$^3$}&\multicolumn{3}{c|}{cm$^3$}&\multicolumn{3}{c|}{mm$^3$}\\
+        \ifboolKV[ClesTableaux]{Capacite}{%
+        \cline{10-15}
+        \multicolumn{3}{|c|}{}&\multicolumn{3}{c|}{}&\multicolumn{3}{c|}{}&{\scriptsize hL}&{\scriptsize daL}&{\scriptsize L}&{\scriptsize dL}&{\scriptsize cL}&{\scriptsize mL}&\multicolumn{3}{c|}{}&\multicolumn{3}{c|}{}\\
+        }{}%
         \hline
+        \xintFor* ##1 in {\xintSeq{1}{\useKV[ClesTableaux]{NbLignes}}}\do{%
         &&&&&&&&&&&&&&&&&&&&\\
+        }%
         \multicolumn{3}{c}{\tikz[remember picture,overlay,yshift=\ht\strutbox]{\coordinate (G1);}}%
         &\multicolumn{3}{c}{\tikz[remember picture,overlay,yshift=\ht\strutbox]{\coordinate (F1);}}%
         &\multicolumn{3}{c}{\tikz[remember picture,overlay,yshift=\ht\strutbox]{\coordinate (E1);}}%
@@ -10988,52 +12501,29 @@
         &\multicolumn{3}{c}{\tikz[remember picture,overlay,yshift=\ht\strutbox]{\coordinate (B1);}}%
         &\multicolumn{3}{c}{\tikz[remember picture,overlay,yshift=\ht\strutbox]{\coordinate (A1);}}\\%
       \end{tabular}
-    \]
-    \setlength{\tabcolsep}{1.6\tabcolsep}
-    \ifboolKV[ClesTableaux]{Fleches}{%
-      \tikz[remember picture, overlay]{\draw[gray,->,>=latex,out=30,in=150]
-        (A) to node[above, midway]{$\times\mbox{\num{1000}}$}(B);}
-      \tikz[remember picture, overlay]{\draw[gray,->,>=latex,out=30,in=150] (B) to
-        node[above, midway]{$\times\mbox{\num{1000}}$}(C);}
-      \tikz[remember picture, overlay]{\draw[gray,->,>=latex,out=30,in=150] (C) to
-        node[above, midway]{$\times\mbox{\num{1000}}$}(D);}
-      \tikz[remember picture, overlay]{\draw[gray,->,>=latex,out=30,in=150] (D) to
-        node[above, midway]{$\times\mbox{\num{1000}}$}(E);}
-      \tikz[remember picture, overlay]{\draw[gray,->,>=latex,out=30,in=150] (E) to
-        node[above, midway]{$\times\mbox{\num{1000}}$}(F);}
-      \tikz[remember picture, overlay]{\draw[gray,->,>=latex,out=30,in=150] (F) to
-        node[above, midway]{$\times\mbox{\num{1000}}$}(G);}
-      \tikz[remember picture, overlay]{\draw[gray,->,>=latex,out=-150,in=-30] (A1) to
-        node[below, midway]{$\div\mbox{\num{1000}}$}(B1);}
-      \tikz[remember picture, overlay]{\draw[gray,->,>=latex,out=-150,in=-30] (B1) to
-        node[below, midway]{$\div\mbox{\num{1000}}$}(C1);}
-      \tikz[remember picture, overlay]{\draw[gray,->,>=latex,out=-150,in=-30] (C1) to
-        node[below, midway]{$\div\mbox{\num{1000}}$}(D1);}
-      \tikz[remember picture, overlay]{\draw[gray,->,>=latex,out=-150,in=-30] (D1) to
-        node[below, midway]{$\div\mbox{\num{1000}}$}(E1);}
-      \tikz[remember picture, overlay]{\draw[gray,->,>=latex,out=-150,in=-30] (E1) to
-        node[below, midway]{$\div\mbox{\num{1000}}$}(F1);}
-      \tikz[remember picture, overlay]{\draw[gray,->,>=latex,out=-150,in=-30] (F1) to
-        node[below, midway]{$\div\mbox{\num{1000}}$}(G1);}
-    }{}
-  }
-  {}
+    \]%
+    \setlength{\tabcolsep}{1.6\tabcolsep}%
+    \Conversion{1000}%
+  }{}%
+  % 
+  %%% Prise en compte de la clé Litre
+  % 
   \ifboolKV[ClesTableaux]{Litre}{%
     \[\renewcommand{\arraystretch}{1.15}%
-      \begin{tabular}{|*{7}{p{7.5mm}|}}
+      \begin{tabular}{|*{6}{p{7.5mm}|}}
         \multicolumn{1}{c}{\tikz[remember picture,overlay]{\coordinate (A);}}%
         &\multicolumn{1}{c}{\tikz[remember picture,overlay]{\coordinate (B);}}%
         &\multicolumn{1}{c}{\tikz[remember picture,overlay]{\coordinate (C);}}%
         &\multicolumn{1}{c}{\tikz[remember picture,overlay]{\coordinate (D);}}%
         &\multicolumn{1}{c}{\tikz[remember picture,overlay]{\coordinate (E);}}%
-        &\multicolumn{1}{c}{\tikz[remember picture,overlay]{\coordinate (F);}}%
-        &\multicolumn{1}{c}{\tikz[remember picture,overlay]{\coordinate (G);}}\\%
+        &\multicolumn{1}{c}{\tikz[remember picture,overlay]{\coordinate (F);}}\\%
         \hline
-        \multicolumn{1}{|c|}{kL}&\multicolumn{1}{c|}{hL}&\multicolumn{1}{c|}{daL}&\multicolumn{1}{c|}{L}&\multicolumn{1}{c|}{dL}&\multicolumn{1}{c|}{cL}&\multicolumn{1}{c|}{mL}\\
-        \hline
-        &&&&&&\\
-        \multicolumn{1}{c}{\tikz[remember picture,overlay]{\coordinate[yshift=1em] (G1);}}%
-        &\multicolumn{1}{c}{\tikz[remember picture,overlay]{\coordinate[yshift=1em] (F1);}}
+        \multicolumn{1}{|c|}{hL}&\multicolumn{1}{c|}{daL}&\multicolumn{1}{c|}{L}&\multicolumn{1}{c|}{dL}&\multicolumn{1}{c|}{cL}&\multicolumn{1}{c|}{mL}\\
+        \hline        
+        \xintFor* ##1 in {\xintSeq{1}{\useKV[ClesTableaux]{NbLignes}-1}}\do{%
+        &&&&&\\}%
+        &&&&&\\%
+        \multicolumn{1}{c}{\tikz[remember picture,overlay]{\coordinate[yshift=1em] (F1);}}%
         &\multicolumn{1}{c}{\tikz[remember picture,overlay]{\coordinate[yshift=1em] (E1);}}%
         &\multicolumn{1}{c}{\tikz[remember picture,overlay]{\coordinate[yshift=1em] (D1);}}%
         &\multicolumn{1}{c}{\tikz[remember picture,overlay]{\coordinate[yshift=1em] (C1);}}%
@@ -11040,23 +12530,12 @@
         &\multicolumn{1}{c}{\tikz[remember picture,overlay]{\coordinate[yshift=1em] (B1);}}%
         &\multicolumn{1}{c}{\tikz[remember picture,overlay]{\coordinate[yshift=1em] (A1);}}\\%
       \end{tabular}
-    \]
-    \ifboolKV[ClesTableaux]{Fleches}{%
-      \tikz[remember picture, overlay]{\draw[gray,->,>=latex,out=30,in=150] (A) to node[above, midway]{\small$\times\mbox{10}$}(B);}
-      \tikz[remember picture, overlay]{\draw[gray,->,>=latex,out=30,in=150] (B) to node[above, midway]{\small$\times\mbox{10}$}(C);}
-      \tikz[remember picture, overlay]{\draw[gray,->,>=latex,out=30,in=150] (C) to node[above, midway]{\small$\times\mbox{10}$}(D);}
-      \tikz[remember picture, overlay]{\draw[gray,->,>=latex,out=30,in=150] (D) to node[above, midway]{\small$\times\mbox{10}$}(E);}
-      \tikz[remember picture, overlay]{\draw[gray,->,>=latex,out=30,in=150] (E) to node[above, midway]{\small$\times\mbox{10}$}(F);}
-      \tikz[remember picture, overlay]{\draw[gray,->,>=latex,out=30,in=150] (F) to node[above, midway]{\small$\times\mbox{10}$}(G);}
-      % bas
-      \tikz[remember picture, overlay]{\draw[gray,->,>=latex,out=-150,in=-30] (A1) to node[below, midway]{\small$\div\mbox{10}$}(B1);}
-      \tikz[remember picture, overlay]{\draw[gray,->,>=latex,out=-150,in=-30] (B1) to node[below, midway]{\small$\div\mbox{10}$}(C1);}
-      \tikz[remember picture, overlay]{\draw[gray,->,>=latex,out=-150,in=-30] (C1) to node[below, midway]{\small$\div\mbox{10}$}(D1);}
-      \tikz[remember picture, overlay]{\draw[gray,->,>=latex,out=-150,in=-30] (D1) to node[below, midway]{\small$\div\mbox{10}$}(E1);}
-      \tikz[remember picture, overlay]{\draw[gray,->,>=latex,out=-150,in=-30] (E1) to node[below, midway]{\small$\div\mbox{10}$}(F1);}
-      \tikz[remember picture, overlay]{\draw[gray,->,>=latex,out=-150,in=-30] (F1) to node[below, midway]{\small$\div\mbox{10}$}(G1);}
-    }{}%
+    \]%
+    \Conversion{10}%
   }{}%
+  % 
+  %%% Prise en compte de la clé Gramme
+  % 
   \ifboolKV[ClesTableaux]{Gramme}{%
     \[\renewcommand{\arraystretch}{1.15}%
       \begin{tabular}{|*{7}{p{7.5mm}|}}
@@ -11066,11 +12545,12 @@
         &\multicolumn{1}{c}{\tikz[remember picture,overlay]{\coordinate (D);}}%
         &\multicolumn{1}{c}{\tikz[remember picture,overlay]{\coordinate (E);}}%
         &\multicolumn{1}{c}{\tikz[remember picture,overlay]{\coordinate (F);}}%
-        &\multicolumn{1}{c}{\tikz[remember picture,overlay]{\coordinate (G);}}
-        \\%
+        &\multicolumn{1}{c}{\tikz[remember picture,overlay]{\coordinate (G);}}\\%
         \hline
         \multicolumn{1}{|c|}{kg}&\multicolumn{1}{c|}{hg}&\multicolumn{1}{c|}{dag}&\multicolumn{1}{c|}{g}&\multicolumn{1}{c|}{dg}&\multicolumn{1}{c|}{cg}&\multicolumn{1}{c|}{mg}\\
         \hline
+        \xintFor* ##1 in {\xintSeq{1}{\useKV[ClesTableaux]{NbLignes}-1}}\do{%
+        &&&&&&\\}%
         &&&&&&\\
         \multicolumn{1}{c}{\tikz[remember picture,overlay]{\coordinate[yshift=1em] (G1);}}%
         &\multicolumn{1}{c}{\tikz[remember picture,overlay]{\coordinate[yshift=1em] (F1);}}%
@@ -11080,21 +12560,483 @@
         &\multicolumn{1}{c}{\tikz[remember picture,overlay]{\coordinate[yshift=1em] (B1);}}%
         &\multicolumn{1}{c}{\tikz[remember picture,overlay]{\coordinate[yshift=1em] (A1);}}\\%
       \end{tabular}
-    \]
-    \ifboolKV[ClesTableaux]{Fleches}{%
-      \tikz[remember picture, overlay]{\draw[gray,->,>=latex,out=30,in=150] (A) to node[above, midway]{\small$\times\mbox{10}$}(B);}
-      \tikz[remember picture, overlay]{\draw[gray,->,>=latex,out=30,in=150] (B) to node[above, midway]{\small$\times\mbox{10}$}(C);}
-      \tikz[remember picture, overlay]{\draw[gray,->,>=latex,out=30,in=150] (C) to node[above, midway]{\small$\times\mbox{10}$}(D);}
-      \tikz[remember picture, overlay]{\draw[gray,->,>=latex,out=30,in=150] (D) to node[above, midway]{\small$\times\mbox{10}$}(E);}
-      \tikz[remember picture, overlay]{\draw[gray,->,>=latex,out=30,in=150] (E) to node[above, midway]{\small$\times\mbox{10}$}(F);}
-      \tikz[remember picture, overlay]{\draw[gray,->,>=latex,out=30,in=150] (F) to node[above, midway]{\small$\times\mbox{10}$}(G);}
-%      % bas
-      \tikz[remember picture, overlay]{\draw[gray,->,>=latex,out=-150,in=-30] (A1) to node[below, midway]{\small$\div\mbox{10}$}(B1);}
-      \tikz[remember picture, overlay]{\draw[gray,->,>=latex,out=-150,in=-30] (B1) to node[below, midway]{\small$\div\mbox{10}$}(C1);}
-      \tikz[remember picture, overlay]{\draw[gray,->,>=latex,out=-150,in=-30] (C1) to node[below, midway]{\small$\div\mbox{10}$}(D1);}
-      \tikz[remember picture, overlay]{\draw[gray,->,>=latex,out=-150,in=-30] (D1) to node[below, midway]{\small$\div\mbox{10}$}(E1);}
-      \tikz[remember picture, overlay]{\draw[gray,->,>=latex,out=-150,in=-30] (E1) to node[below, midway]{\small$\div\mbox{10}$}(F1);}
-      \tikz[remember picture, overlay]{\draw[gray,->,>=latex,out=-150,in=-30] (F1) to node[below, midway]{\small$\div\mbox{10}$}(G1);}
+    \]%
+    \Conversion{10}%
+  }{}%
+}%
+
+\newcommand\Conversion[1]{%
+  \ifboolKV[ClesTableaux]{Fleches}{\setKV[ClesTableaux]{FlechesH,FlechesB}}{}%
+  \ifboolKV[ClesTableaux]{FlechesH}{%
+    \tikz[remember picture, overlay]{\draw[gray,->,>=latex,out=30,in=150] (A) to node[above, midway]{\small$\times\num{#1}$}(B);}%
+    \tikz[remember picture, overlay]{\draw[gray,->,>=latex,out=30,in=150] (B) to node[above, midway]{\small$\times\num{#1}$}(C);}%
+    \tikz[remember picture, overlay]{\draw[gray,->,>=latex,out=30,in=150] (C) to node[above, midway]{\small$\times\num{#1}$}(D);}%
+    \tikz[remember picture, overlay]{\draw[gray,->,>=latex,out=30,in=150] (D) to node[above, midway]{\small$\times\num{#1}$}(E);}%
+    \tikz[remember picture, overlay]{\draw[gray,->,>=latex,out=30,in=150] (E) to node[above, midway]{\small$\times\num{#1}$}(F);}%
+    \ifboolKV[ClesTableaux]{Litre}{}{\tikz[remember picture, overlay]{\draw[gray,->,>=latex,out=30,in=150] (F) to node[above, midway]{\small$\times\num{#1}$}(G);}%
+    }%
+  }{}%
+  \ifboolKV[ClesTableaux]{FlechesB}{%
+    \tikz[remember picture, overlay]{\draw[gray,->,>=latex,out=-150,in=-30] (A1) to node[below, midway]{\small$\div\num{#1}$}(B1);}%
+    \tikz[remember picture, overlay]{\draw[gray,->,>=latex,out=-150,in=-30] (B1) to node[below, midway]{\small$\div\num{#1}$}(C1);}%
+    \tikz[remember picture, overlay]{\draw[gray,->,>=latex,out=-150,in=-30] (C1) to node[below, midway]{\small$\div\num{#1}$}(D1);}%
+    \tikz[remember picture, overlay]{\draw[gray,->,>=latex,out=-150,in=-30] (D1) to node[below, midway]{\small$\div\num{#1}$}(E1);}%
+    \tikz[remember picture, overlay]{\draw[gray,->,>=latex,out=-150,in=-30] (E1) to node[below, midway]{\small$\div\num{#1}$}(F1);}%
+    \ifboolKV[ClesTableaux]{Litre}{}{\tikz[remember picture, overlay]{\draw[gray,->,>=latex,out=-150,in=-30] (F1) to node[below, midway]{\small$\div\num{#1}$}(G1);}}%
+  }{}%
+}%
+
+%%%
+% Cards
+%%%
+\newtcolorbox{Mybox}[3]{%
+  enhanced,
+  nobeforeafter,
+  left=0pt,right=0pt,top=0pt,
+  text fill,
+  width=\largeurcarte,
+  height=\hauteurcarte,
+  arc=5pt,
+  overlay unbroken and first={%
+    \coordinate[yshift=-0.5\hauteurtitre] (A1) at (frame.north west);
+    \coordinate[yshift=-0.5\hauteurtitre] (B1) at (frame.north east);    
+    \coordinate[yshift=-\hauteurtitre] (A) at (frame.north west);
+    \coordinate[yshift=-\hauteurtitre] (B) at (frame.north east);
+    \coordinate[xshift=1.5pt,yshift=8mm] (S1) at (frame.south west);
+    \coordinate[xshift=-1.5pt,yshift=8mm] (S2) at (frame.south east);
+    \coordinate[xshift=3mm+(\largeurtitre/2)] (A2) at (A1);
+    \coordinate[xshift=-3mm-(\largeurtitre/2)] (B2) at (B1);
+    \node[rounded corners, draw=black, rectangle,minimum height=1cm,text width=\largeurtitre,fill=TrameCouleur] (T1) at (A2){};
+    \node[TexteCouleur] (T1a) at (T1){\Large #1};
+    \node[yshift=-0.65cm] (T1b) at (T1){\tiny réponse précédente};
+    \node[inner sep=0pt,rounded corners, rectangle, draw=black,minimum height=1cm,text width=\largeurtitre,fill=TrameCouleur] (T2) at (B2){};
+    \node[inner sep=0pt,TexteCouleur] (T2a) at (T2){
+      \begin{minipage}{\largeurtitre}
+        \begin{center}
+          #2
+        \end{center}
+      \end{minipage}
+    };
+    \node[yshift=-0.65cm] (T2b) at (T2){};
+    \ifboolKV[Cards]{Titre}{\node[] at (T2b) {\tiny\useKV[Cards]{NomTitre}};}{},
+    \node[rectangle,xshift=5mm,yshift=4.25mm,minimum width=2em,rounded corners,fill=TrameCouleur,draw=black] (R) at (frame.south west) {\color{black}\Large\bfseries #3};
+    \draw[dashed] (S1) -- (S2);
+  },
+  colback=white,
+  colbacktitle=TrameCouleur,
+}
+
+\usetikzlibrary{backgrounds}
+
+\makeatletter
+%https://tex.stackexchange.com/questions/347434/clip-background-image-inside-tcolorbox
+\newtcolorbox{MyboxSimpleAv}[1]{%
+  enhanced,
+  nobeforeafter,
+  left=0pt,right=0pt,top=\hauteurtitre,bottom=0pt,
+  text fill,
+  width=\largeurcarte,
+  height=\hauteurcarte,
+  arc=5pt,
+  colback=white,
+  underlay={%
+    \ifboolKV[Cards]{BackgroundAv}{%
+    \begin{tcbclipinterior}
+      \node[anchor=center,opacity=1]
+      at (interior.center) {%
+        \includegraphics[%
+        height=\tcb at height,
+        width=\tcb at width,
+        ]{\useKV[Cards]{ImageAv}}};
+    \end{tcbclipinterior},
+  }{}
+  },
+  overlay unbroken and first={%
+    \coordinate[yshift=-0.5\hauteurtitre] (A) at (frame.north);
+    \node[rounded corners, draw=black, rectangle,minimum height=1cm,text width=\largeurcarte-6mm,fill=TrameCouleur] (T1) at
+    (A){\begin{minipage}{\largeurcarte-6mm}
+        \begin{center}
+          #1
+        \end{center}
+      \end{minipage}};
+    \node[yshift=-0.5em-0.5\hauteurtitre] (B) at (A){};
+    \ifboolKV[Cards]{Titre}{\node[fill=white] at (B) {\useKV[Cards]{NomTitre}};}{},
+  }
+}
+
+\newtcolorbox{MyboxSimpleAr}[1]{%
+  enhanced,
+  nobeforeafter,
+  left=0pt,right=0pt,top=\hauteurtitre,bottom=0pt,
+  text fill,
+  width=\largeurcarte,
+  height=\hauteurcarte,
+  arc=5pt,
+  colback=white,
+  underlay={%
+    \ifboolKV[Cards]{BackgroundAr}{%
+    \begin{tcbclipinterior}
+      \node[anchor=center,opacity=1]
+      at (interior.center) {%
+        \includegraphics[%
+        height=\tcb at height,
+        width=\tcb at width,
+        ]{\useKV[Cards]{ImageAr}}};
+    \end{tcbclipinterior},
+  }{}
+  },
+  overlay unbroken and first={%
+    \coordinate[yshift=-0.5\hauteurtitre] (A) at (frame.north);
+    \node[rounded corners, draw=black, rectangle,minimum height=1cm,text width=\largeurcarte-6mm,fill=TrameCouleur] (T1) at
+    (A){\begin{minipage}{\largeurcarte-6mm}
+        \begin{center}
+          #1
+        \end{center}
+      \end{minipage}};
+    %\node[yshift=-1em] (B) at (A){};
+    %\ifboolKV[Cards]{Titre}{\node[fill=white] at (B) {\useKV[Cards]{NomTitre}};}{},
+  }
+}
+\makeatother
+
+\newlength{\largeurcards}
+\newlength{\hauteurcards}
+\newlength{\largeurcarte}
+\newlength{\hauteurcarte}
+\newlength{\hauteurtitre}
+\newlength{\largeurtitre}
+
+\newlength{\margeh}
+\newlength{\margev}
+
+\NewEnviron{Trame}{%
+  \begin{tikzpicture}[remember picture,overlay]
+    % quadrillages horizontal et vertical
+    \coordinate[yshift=-\margev] (A) at (current page.north west);
+    \coordinate[yshift=-\margev] (B) at (current page.north east);
+    \coordinate[yshift=-\hauteurcards] (A1) at (A);
+    \coordinate[yshift=-\hauteurcards] (B1) at (B);
+    \coordinate[yshift=-\hauteurcards] (A2) at (A1);
+    \coordinate[yshift=-\hauteurcards] (B2) at (B1);
+    \coordinate[yshift=-\hauteurcards] (A3) at (A2);
+    \coordinate[yshift=-\hauteurcards] (B3) at (B2);
+    \coordinate[yshift=-\hauteurcards] (A4) at (A3);
+    \coordinate[yshift=-\hauteurcards] (B4) at (B3);
+    \coordinate[xshift=\margeh] (C) at (current page.north west);
+    \coordinate[xshift=\margeh] (D) at (current page.south west);
+    \coordinate[xshift=\largeurcards] (C1) at (C);
+    \coordinate[xshift=\largeurcards] (D1) at (D);
+    \coordinate[xshift=\largeurcards] (C2) at (C1);
+    \coordinate[xshift=\largeurcards] (D2) at (D1);
+    \coordinate[xshift=\largeurcards] (C3) at (C2);
+    \coordinate[xshift=\largeurcards] (D3) at (D2);
+    \draw (A) -- (B);
+    \draw (A1) -- (B1);
+    \draw (A2) -- (B2);
+    \draw (A3) -- (B3);
+    \draw (A4) -- (B4);
+    \draw (C)--(D);
+    \draw (C1)--(D1);
+    \draw (C2)--(D2);
+    \draw (C3)--(D3);
+    % point pour placer les cartes
+    \coordinate[xshift=\margeh+0.5\largeurcards,yshift=-0.5\hauteurcards] (Carte1) at (A);
+    \coordinate[xshift=\largeurcards,yshift=0mm] (Carte2) at (Carte1);
+    \coordinate[xshift=2\largeurcards,yshift=0mm] (Carte3) at (Carte1);
+    \coordinate[xshift=0mm,yshift=-\hauteurcards] (Carte4) at (Carte1);
+    \coordinate[xshift=0mm,yshift=-\hauteurcards] (Carte5) at (Carte2);
+    \coordinate[xshift=0mm,yshift=-\hauteurcards] (Carte6) at (Carte3);
+    \coordinate[xshift=0mm,yshift=-\hauteurcards] (Carte7) at (Carte4);
+    \coordinate[xshift=0mm,yshift=-\hauteurcards] (Carte8) at (Carte5);
+    \coordinate[xshift=0mm,yshift=-\hauteurcards] (Carte9) at (Carte6);
+    \BODY
+  \end{tikzpicture}
+}
+
+\setKVdefault[Cards]{Largeur=59,Hauteur=89,HauteurTheme=15,Marge=4,Landscape=false,Couleur=Cornsilk,Theme=Théorème\\de
+  Pythagore,ThemeSol=Solution,Trame=false,Titre=false,NomTitre=Jeu 1,Loop,BackgroundAv=false,BackgroundAr=false,ImageAv=4813762.jpg,ImageAr=4813762.jpg}
+
+\newcommand\Cartes[2][]{%
+  \useKVdefault[Cards]%
+  \setKV[Cards]{#1}%
+  \setsepchar[*]{§*/}%
+  \readlist*\ListeCards{#2}%
+  \ifboolKV[Cards]{Landscape}{%
+    \setlength{\hauteurcarte}{\fpeval{\useKV[Cards]{Largeur}-\useKV[Cards]{Marge}}mm}%
+    \setlength{\largeurcarte}{\fpeval{\useKV[Cards]{Hauteur}-\useKV[Cards]{Marge}}mm}%
+    \setlength{\largeurcards}{95mm}%
+    \setlength{\hauteurcards}{65mm}%
+    \setlength{\margeh}{(297mm-3\largeurcards)/2}%
+    \setlength{\margev}{(210mm-3\hauteurcards)/2}%
+  }{
+    \setlength{\hauteurcarte}{\fpeval{\useKV[Cards]{Hauteur}-\useKV[Cards]{Marge}}mm}%
+    \setlength{\largeurcarte}{\fpeval{\useKV[Cards]{Largeur}-\useKV[Cards]{Marge}}mm}%
+    \setlength{\largeurcards}{65mm}
+    \setlength{\hauteurcards}{95mm}
+    \setlength{\margeh}{(210mm-3\largeurcards)/2}
+    \setlength{\margev}{(297mm-3\hauteurcards)/2}
+  }
+  \setlength{\hauteurtitre}{\fpeval{\useKV[Cards]{HauteurTheme}}mm}%
+  \setlength{\largeurtitre}{\fpeval{(\useKV[Cards]{Largeur}-\useKV[Cards]{Marge}-9)/2}mm}%
+  \colorlet{TexteCouleur}{black}
+  \colorlet{TrameCouleur}{\useKV[Cards]{Couleur}}
+  \ifboolKV[Cards]{Loop}{%
+    \ifboolKV[Cards]{Trame}{%
+      \clearpage%
+      \thispagestyle{empty}%
+      \begin{Trame}
+        \multido{\i=1+1}{9}{%
+          \node at (Carte\i) {%
+            \begin{Mybox}{\ListeCards[\i,1]}{\useKV[Cards]{Theme}}{\ListeCards[\i,2]}%
+              \ListeCards[\i,3]%
+            \end{Mybox}%
+          };%
+        }%
+      \end{Trame}%
+      \clearpage%
+    }{%
+      \begin{Mybox}{\ListeCards[1,1]}{\useKV[Cards]{Theme}}{\ListeCards[1,2]}%
+        \ListeCards[1,3]%
+      \end{Mybox}%
+    }%
+  }{%
+    \ifboolKV[Cards]{Trame}{%
+      \clearpage%
+      \thispagestyle{empty}%
+      \begin{Trame}
+        \multido{\i=1+1}{9}{%
+          \node[] at (Carte\i) {%
+            \begin{MyboxSimpleAv}{\useKV[Cards]{Theme}}%
+              \ListeCards[\i,1]%
+            \end{MyboxSimpleAv}%
+          };%
+        }%
+      \end{Trame}%
+      \clearpage%
+      \thispagestyle{empty}%
+      \begin{Trame}
+        \multido{\i=1+1}{3}{%
+          \node at (Carte\i) {%
+            \begin{MyboxSimpleAr}{\useKV[Cards]{ThemeSol}}%
+              \ListeCards[\fpeval{4-\i},2]%
+            \end{MyboxSimpleAr}%
+          };%
+        }%
+        \multido{\i=4+1}{3}{%
+          \node at (Carte\i) {%
+            \begin{MyboxSimpleAr}{\useKV[Cards]{ThemeSol}}%
+              \ListeCards[\fpeval{10-\i},2]%
+            \end{MyboxSimpleAr}%
+          };%
+        }%
+        \multido{\i=7+1}{3}{%
+          \node at (Carte\i) {%
+            \begin{MyboxSimpleAr}{\useKV[Cards]{ThemeSol}}%
+              \ListeCards[\fpeval{16-\i},2]%
+            \end{MyboxSimpleAr}%
+          };%
+        }%
+      \end{Trame}%
+      \clearpage%
+    }{%
+      \begin{MyboxSimpleAv}{\useKV[Cards]{Theme}}%
+        \ListeCards[1,1]%
+      \end{MyboxSimpleAv}
+      \begin{MyboxSimpleAr}{\useKV[Cards]{ThemeSol}}%
+        \ListeCards[1,2]%
+      \end{MyboxSimpleAr}
+    }%
+  }%
+}
+
+\newcommand\SolutionCarte[2]{%
+  \begin{center}
+    \bfseries#1
+  \end{center}
+  
+  #2
+}
+
+%%%
+% Tableur
+%%%
+\setKVdefault[Tableur]{Colonnes=4,Largeur=3,Formule={},Cellule=A1,Ligne=0,Colonne=0,PasL=1,PasC=1}
+
+%Basé sur un code de Christian Télléchéa.
+\makeatletter
+\newcount\cntlin
+\newcount\cntcol
+
+\newtoks\t at b
+\long\def\ifremain at lines#1\\#2\@nil{%
+	\csname @\ifx\@empty#2\@empty second\else first\fi oftwo\endcsname}
+\long\def\subst at eol#1\\#2\@nil{\addtot at b{#1\\\hline}%
+  	\ifremain at lines#2\\\@nil{\addtot at b&\subst at eol#2\@nil}{\addtot at b{#2\CodeAfter\xintifboolexpr{\useKV[Tableur]{Ligne}=0 || \useKV[Tableur]{Colonne}=0}{}{\tikz\draw[line width=2pt](row-\fpeval{\useKV[Tableur]{Ligne}+1}-|col-\fpeval{\useKV[Tableur]{Colonne}+1}) rectangle (row-\fpeval{\useKV[Tableur]{Ligne}+1+\useKV[Tableur]{PasL}}-|col-\fpeval{\useKV[Tableur]{Colonne}+1+\useKV[Tableur]{PasC}});}\end{NiceTabular}}}}
+\long\def\collectcp at body#1\end{\subst at eol#1\@nil\end}
+
+\newcommand\addtot at b[1]{\t at b\expandafter{\the\t at b#1}}
+\newcommand\edftot at b[1]{\edef\temp@{#1}\expandafter\addtot at b\expandafter{\temp@}}
+
+\newlength\LongInter
+\newlength\TotalInter
+
+\newenvironment{Tableur}[1][]{%
+  \useKVdefault[Tableur]%
+  \setKV[Tableur]{#1}%
+  \ttfamily%
+  \setlength{\LongInter}{\fpeval{(\useKV[Tableur]{Colonnes}-1)*\useKV[Tableur]{Largeur}-4}em+\fpeval{\useKV[Tableur]{Colonnes}*2-6}\tabcolsep+\fpeval{\useKV[Tableur]{Colonnes}-3}\arrayrulewidth}
+  \newcolumntype X{>{\centering\arraybackslash}p{\useKV[Tableur]{Largeur}em}}%
+  \begin{tabular}{|p{\useKV[Tableur]{Largeur}em}|p{1em}|p{5em}|p{\LongInter}|}
+    \cline{1-2}\cline{4-4}%
+    \useKV[Tableur]{Cellule}&\centering\arraybackslash\scriptsize$\blacktriangledown$&$f_x$\hfill$\sum$~\scriptsize$\blacktriangledown$\hfill$=$&\useKV[Tableur]{Formule}\hfill\scriptsize$\blacktriangledown$\\
+    \cline{1-2}\cline{4-4}%
+  \end{tabular}
+  
+  \cntlin\z@
+  \t at b{%
+    \begin{NiceTabular}{%
+        |>{%
+          \columncolor{gray!15}
+      \global\cntcol\z@\global\advance\cntlin\@ne
+      \centering\arraybackslash
+      \ifnum\cntlin>\@ne\number\numexpr\cntlin-1\relax\fi}
+      p{2em}|*{\useKV[Tableur]{Colonnes}}{X|}}%
+      \hline
+      \rowcolor{gray!15}}%
+     \loop
+     \ifnum\cntcol<\useKV[Tableur]{Colonnes}
+     \advance\cntcol\@ne
+     \addtot at b{&}%
+     \edftot at b{{\noexpand\@Alph\the\cntcol}}%
+     \repeat
+     \addtot at b{\\\hline&}%
+    \collectcp at body}{\the\t at b}
+\makeatother
+
+%%%
+% Domino
+%%%
+\newtcolorbox{MyDominoMini}[1][]{%
+  enhanced,
+  nobeforeafter,
+  left skip=0pt,
+  right skip=0pt,
+  left=0pt,right=0pt,top=0pt,bottom=0pt,
+  width=\textwidth/\ColonneDomino,
+  height=\textheight/\LigneDomino,
+  segmentation style={solid, line width=1.5pt},
+  colback=\CouleurDomino,
+  center upper,
+  valign upper=center,
+  center lower,
+  valign lower=center,
+  arc=2pt,
+  #1
+}
+
+\newtcolorbox{MyDominoLogo}[1][]{%
+  enhanced,
+  nobeforeafter,
+  left skip=0pt,
+  right skip=0pt,
+  left=0pt,right=0pt,top=0pt,bottom=0pt,
+  width=\textwidth/\ColonneDomino,
+  height=\textheight/\LigneDomino,
+  valign=center,
+  halign=center,
+  arc=2pt,
+  colback=white,
+  #1
+}
+
+\NewEnviron{TrameDomino}{%
+  \setlength{\margev}{1cm}
+  \setlength{\margeh}{1cm}
+  \begin{tikzpicture}[remember picture,overlay]
+    % quadrillages horizontal et vertical
+    \coordinate[yshift=-\margev] (A0) at (current page.north west);
+    \coordinate[yshift=-\margev] (B0) at (current page.north east);
+    \foreach \i in {1,...,\useKV[Domino]{Lignes}}{%
+      \coordinate[yshift=-\i*\textheight/\LigneDomino] (A\i) at (A0);
+      \coordinate[yshift=-\i*\textheight/\LigneDomino] (B\i) at (B0);
+    }
+    \coordinate[xshift=\margeh] (C0) at (current page.north west);
+    \coordinate[xshift=\margeh] (D0) at (current page.south west);
+    \foreach \i in {1,...,\useKV[Domino]{Colonnes}}{
+      \coordinate[xshift=\i*\textwidth/\ColonneDomino] (C\i) at (C0);
+      \coordinate[xshift=\i*\textwidth/\ColonneDomino] (D\i) at (D0);
+    }
+    \foreach \i in {0,...,\LigneDomino}{%
+      \draw (A\i) -- (B\i);
+    }
+    \foreach \i in {0,...,\ColonneDomino}{%
+      \draw (C\i) -- (D\i);
+    }
+    \draw[blue, line width=3pt] (A0)--(B0);
+    \draw[blue, line width=3pt] (A\LigneDomino)--(B\LigneDomino);
+    \draw[blue, line width=3pt] (C0)--(D0);
+    \draw[blue, line width=3pt] (C\ColonneDomino)--(D\ColonneDomino);
+    % point pour placer les cartes
+    \foreach \i in {0,...,\fpeval{\ColonneDomino-1}}{%
+      \foreach \j in {0,...,\fpeval{\LigneDomino-1}}{%
+        \coordinate[xshift=\margeh+(0.5\textwidth/\ColonneDomino)+\i*\textwidth/\ColonneDomino,yshift=-0.5\textheight/\LigneDomino-\j*\textheight/\LigneDomino]
+        (Domino\fpeval{\i+\ColonneDomino*\j+1}) at (A0);
+      }
+    }
+    \BODY
+  \end{tikzpicture}
+}
+
+\setKVdefault[Domino]{Couleur=white,Trame,Ratio=0.5,Lignes=7,Colonnes=5,Superieur=false,Logo=false,Image=tiger.pdf}
+
+\newcommand\Dominos[2][]{%
+  \useKVdefault[Domino]%
+  \setKV[Domino]{#1}%
+  \setsepchar[*]{§*/}%
+  \readlist*\ListeDominos{#2}%
+  \xdef\CouleurDomino{\useKV[Domino]{Couleur}}%
+  \xdef\ratiodomino{\useKV[Domino]{Ratio}}%
+  \xdef\LigneDomino{\useKV[Domino]{Lignes}}%
+  \xdef\ColonneDomino{\useKV[Domino]{Colonnes}}%
+  \ifboolKV[Domino]{Trame}{%
+    \clearpage
+    \begin{TrameDomino}
+      \foreach\i in {1,...,\fpeval{\LigneDomino*\ColonneDomino}}{%
+        \node[] at (Domino\i){%
+          \ifboolKV[Domino]{Superieur}{%
+            \begin{MyDominoMini}[space=\ratiodomino]%
+              \ListeDominos[\i,1]\tcblower\ListeDominos[\i,2]%
+            \end{MyDominoMini}%
+          }{%
+            \begin{MyDominoMini}[sidebyside,sidebyside gap=4mm,righthand ratio=\ratiodomino]%
+              \ListeDominos[\i,1]\tcblower\ListeDominos[\i,2]%          
+            \end{MyDominoMini}%
+          }%
+        };
+      }%
+    \end{TrameDomino}%
+    \ifboolKV[Domino]{Logo}{%
+      \clearpage
+      \begin{TrameDomino}
+        \foreach\i in {1,...,\fpeval{\LigneDomino*\ColonneDomino}}{%
+          \node at (Domino\i){%
+            \begin{MyDominoLogo}%
+              \includegraphics[height=\tcbtextheight]{\useKV[Domino]{Image}}
+            \end{MyDominoLogo}%
+          };
+        }%
+      \end{TrameDomino}%
     }{}%
-  }{}%
+  }{%
+    \ifboolKV[Domino]{Superieur}{%
+      \begin{MyDominoMini}[space=\ratiodomino]%
+        \ListeDominos[1,1]\tcblower\ListeDominos[1,2]%
+      \end{MyDominoMini}%
+    }{%
+      \begin{MyDominoMini}[sidebyside,sidebyside gap=4mm,righthand ratio=\ratiodomino]%
+        \ListeDominos[1,1]\tcblower%
+        \ListeDominos[1,2]%          
+      \end{MyDominoMini}%
+    }%
+  }%
 }%
\ No newline at end of file



More information about the tex-live-commits mailing list.