summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Master/texmf-dist/doc/latex/profcollege/ProfCollege-doc.pdfbin0 -> 1643198 bytes
-rw-r--r--Master/texmf-dist/doc/latex/profcollege/ProfCollege-doc.zipbin0 -> 1055913 bytes
-rw-r--r--Master/texmf-dist/doc/latex/profcollege/README13
-rw-r--r--Master/texmf-dist/metapost/profcollege/PfC-Calculatrice.mp198
-rw-r--r--Master/texmf-dist/metapost/profcollege/PfC-Constantes.mp23
-rw-r--r--Master/texmf-dist/metapost/profcollege/PfC-Geometrie.mp1206
-rw-r--r--Master/texmf-dist/metapost/profcollege/PfC-LaTeX.mp20
-rw-r--r--Master/texmf-dist/metapost/profcollege/PfC-Svgnames.mp156
-rw-r--r--Master/texmf-dist/tex/latex/profcollege/PfC-EquationComposition1.tex277
-rw-r--r--Master/texmf-dist/tex/latex/profcollege/PfC-EquationLaurent1.tex226
-rw-r--r--Master/texmf-dist/tex/latex/profcollege/PfC-EquationPose1.tex246
-rw-r--r--Master/texmf-dist/tex/latex/profcollege/PfC-EquationSoustraction1.tex332
-rw-r--r--Master/texmf-dist/tex/latex/profcollege/PfC-EquationSymbole1.tex225
-rw-r--r--Master/texmf-dist/tex/latex/profcollege/PfC-EquationTerme1.tex276
-rw-r--r--Master/texmf-dist/tex/latex/profcollege/ProfCollege.sty10542
-rwxr-xr-xMaster/tlpkg/bin/tlpkg-ctan-check2
-rwxr-xr-xMaster/tlpkg/libexec/ctan2tds2
-rw-r--r--Master/tlpkg/tlpsrc/collection-langfrench.tlpsrc1
-rw-r--r--Master/tlpkg/tlpsrc/profcollege.tlpsrc0
19 files changed, 13744 insertions, 1 deletions
diff --git a/Master/texmf-dist/doc/latex/profcollege/ProfCollege-doc.pdf b/Master/texmf-dist/doc/latex/profcollege/ProfCollege-doc.pdf
new file mode 100644
index 00000000000..7bdee3edec6
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/profcollege/ProfCollege-doc.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/profcollege/ProfCollege-doc.zip b/Master/texmf-dist/doc/latex/profcollege/ProfCollege-doc.zip
new file mode 100644
index 00000000000..ffd4e8dd82a
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/profcollege/ProfCollege-doc.zip
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/profcollege/README b/Master/texmf-dist/doc/latex/profcollege/README
new file mode 100644
index 00000000000..1c43726c9dc
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/profcollege/README
@@ -0,0 +1,13 @@
+Vous êtes un enseignant de mathématiques en collège ?
+profcollege est un package qui vous aidera à utiliser LaTeX au quotidien.
+
+----------------
+
+You are a french mathematics teacher ?
+profcollege is a useful package to daily use of LaTeX.
+
+---------------
+
+Author : Christophe Poulain
+email : chrpoulain@gmail.com
+Licence : Released under the LaTeX Project Public License v1.3c or later, see http://www.latex-project.org/lppl.txtf
diff --git a/Master/texmf-dist/metapost/profcollege/PfC-Calculatrice.mp b/Master/texmf-dist/metapost/profcollege/PfC-Calculatrice.mp
new file mode 100644
index 00000000000..a6326e19258
--- /dev/null
+++ b/Master/texmf-dist/metapost/profcollege/PfC-Calculatrice.mp
@@ -0,0 +1,198 @@
+%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[];
+
+u:=0.5mm;
+
+vardef BlocAffichage=
+ for k=0 upto 34:
+ carre[k]:=(unitsquare scaled u) shifted(u*(k mod 5,5-(k div 5)));
+ endfor;
+enddef;
+
+vardef Affichage(expr decomp)=
+ save $;
+ picture $;
+ drawoptions(withpen pensquare scaled0.1);
+ $=image(%
+ for k=0 upto 34:
+ if (substring(k,k+1) of decomp)="1":
+ fill carre[k];
+ fi;
+ endfor;
+ );
+ drawoptions();
+ $
+enddef;
+
+nblignes:=0;
+
+boolean print;
+print:=false;
+
+color CouleurEcran;
+CouleurEcran=(107/255,148/255,107/255);
+
+boolean Math;
+Math=true;
+
+decahoriz:=0;
+
+vardef Test(expr cptk,cptnt)=
+ pair decalage;
+ if nblignes mod 2=0:
+ decalage:=u*((20-length(cptnt)+cptk)*6,-8*(nblignes-1));
+ else:
+ decalage:=u*(decahoriz,-8*(nblignes-1));
+ decahoriz:=decahoriz+6;
+ fi;
+ if substring(cptk,cptk+1) of cptnt="A":draw Affichage("01110100011000110001111111000110001") shifted(decalage);
+ elseif substring(cptk,cptk+1) of cptnt="B":draw Affichage("11110100011000111110100011000111110") shifted(decalage);
+ elseif substring(cptk,cptk+1) of cptnt="C":draw Affichage("01110100011000010000100001000101110") shifted(decalage);
+ elseif substring(cptk,cptk+1) of cptnt="D":draw Affichage("11100100101000110001100011001011100") shifted(decalage);
+ elseif substring(cptk,cptk+1) of cptnt="E":draw Affichage("11111100001000011111100001000011111") shifted(decalage);
+ elseif substring(cptk,cptk+1) of cptnt="F":draw Affichage("11111100001000011111100001000010000") shifted(decalage);
+ elseif substring(cptk,cptk+1) of cptnt="G":draw Affichage("01110100011000010111100011000101110") shifted(decalage);
+ elseif substring(cptk,cptk+1) of cptnt="H":draw Affichage("10001100011000111111100011000110001") shifted(decalage);
+ elseif substring(cptk,cptk+1) of cptnt="I":draw Affichage("01110001000010000100001000010001110") shifted(decalage);
+ elseif substring(cptk,cptk+1) of cptnt="J":draw Affichage("00111000100001000010000101001001100") shifted(decalage);
+ elseif substring(cptk,cptk+1) of cptnt="K":draw Affichage("10001100101010011000101001001010001") shifted(decalage);
+ elseif substring(cptk,cptk+1) of cptnt="L":draw Affichage("10000100001000010000100001000011111") shifted(decalage);
+ elseif substring(cptk,cptk+1) of cptnt="M":draw Affichage("10001110111010110101100011000110001") shifted(decalage);
+ elseif substring(cptk,cptk+1) of cptnt="N":draw Affichage("10001100011100110101100111000110001") shifted(decalage);
+ elseif substring(cptk,cptk+1) of cptnt="O":draw Affichage("01110100011000110001100011000101110") shifted(decalage);
+ elseif substring(cptk,cptk+1) of cptnt="P":draw Affichage("11110100011000111110100001000010000") shifted(decalage);
+ elseif substring(cptk,cptk+1) of cptnt="Q":draw Affichage("01110100011000110001101011001001101") shifted(decalage);
+ elseif substring(cptk,cptk+1) of cptnt="R":draw Affichage("11110100011000111110101001001010001") shifted(decalage);
+ elseif substring(cptk,cptk+1) of cptnt="S":draw Affichage("01111100001000001110000010000111110") shifted(decalage);
+ elseif substring(cptk,cptk+1) of cptnt="T":draw Affichage("11111001000010000100001000010000100") shifted(decalage);
+ elseif substring(cptk,cptk+1) of cptnt="U":draw Affichage("10001100011000110001100011000101110") shifted(decalage);
+ elseif substring(cptk,cptk+1) of cptnt="V":draw Affichage("10001100011000110001100010101000100") shifted(decalage);
+ elseif substring(cptk,cptk+1) of cptnt="W":draw Affichage("10101101011010110101101011010101010") shifted(decalage);
+ elseif substring(cptk,cptk+1) of cptnt="X":draw Affichage("10001100010101000100010101000110001") shifted(decalage);
+ elseif substring(cptk,cptk+1) of cptnt="Y":draw Affichage("10001100011000101010001000010000100") shifted(decalage);
+ elseif substring(cptk,cptk+1) of cptnt="Z":draw Affichage("11111000010001000100010001000011111") shifted(decalage);
+ elseif substring(cptk,cptk+1) of cptnt="a":draw Affichage("00000000000111100001011111000101111") shifted(decalage);
+ elseif substring(cptk,cptk+1) of cptnt="b":draw Affichage("10000100001011011001100011000111110") shifted(decalage);
+ elseif substring(cptk,cptk+1) of cptnt="c":draw Affichage("00000000000111010000100001000101110") shifted(decalage);
+ elseif substring(cptk,cptk+1) of cptnt="d":draw Affichage("00001000010110110011100011000101111") shifted(decalage);
+ elseif substring(cptk,cptk+1) of cptnt="e":if Math:
+ draw Affichage("00000000000000000001101000100010100") shifted(decalage);
+ decalage:=u*(decahoriz-1,-8*(nblignes-1));
+ draw Affichage("00000000001001010101101011010110010") shifted(decalage);
+ decahoriz:=decahoriz+6;
+ else:
+ draw Affichage("00000000000111010001111111000001110") shifted(decalage);
+ fi;
+ elseif substring(cptk,cptk+1) of cptnt="@":draw Affichage("00010001000111010001111111000001110") shifted(decalage);
+ elseif substring(cptk,cptk+1) of cptnt="f":draw Affichage("00110010010100011100010000100001000") shifted(decalage);
+ elseif substring(cptk,cptk+1) of cptnt="g":draw Affichage("00000011111000110001011110000101110") shifted(decalage);
+ elseif substring(cptk,cptk+1) of cptnt="h":draw Affichage("10000100001011011001100011000110001") shifted(decalage);
+ elseif substring(cptk,cptk+1) of cptnt="i":draw Affichage("00100000000110000100001000010001110") shifted(decalage);
+ elseif substring(cptk,cptk+1) of cptnt="j":if Math=true:
+ draw Affichage("00011000011110100001000000000000000") shifted(decalage);
+ else:
+ draw Affichage("00010000000011000010000101001001100") shifted(decalage);
+ fi;
+ elseif substring(cptk,cptk+1) of cptnt="k":if Math=true:
+ draw Affichage("11100001000100011100000000000000000") shifted(decalage);
+ else:
+ draw Affichage("10000100001001010100110001010010010") shifted(decalage);
+ fi;
+ elseif substring(cptk,cptk+1) of cptnt="l":if Math=true:
+ draw Affichage("11100010000010011100000000000000000") shifted(decalage);
+ else:
+ draw Affichage("01100001000010000100001000010001110") shifted(decalage);
+ fi;
+ elseif substring(cptk,cptk+1) of cptnt="m":draw Affichage("00000000001101010101101011000110001") shifted(decalage);
+ elseif substring(cptk,cptk+1) of cptnt="n":draw Affichage("00000000001011011001100011000110001") shifted(decalage);
+ elseif substring(cptk,cptk+1) of cptnt="o":draw Affichage("00000000000111010001100011000101110") shifted(decalage);
+ elseif substring(cptk,cptk+1) of cptnt="p":draw Affichage("00000000001111010001111101000010000") shifted(decalage);
+ elseif substring(cptk,cptk+1) of cptnt="q":if Math=true:
+ draw Affichage("00000000001111101010010100101010001") shifted(decalage);
+ else:
+ draw Affichage("00000000000110110011011110000100001") shifted(decalage);
+ fi;
+ elseif substring(cptk,cptk+1) of cptnt="r":draw Affichage("00000000001011011001100001000010000") shifted(decalage);
+ elseif substring(cptk,cptk+1) of cptnt="s":draw Affichage("00000000000111010000011100000111110") shifted(decalage);
+ elseif substring(cptk,cptk+1) of cptnt="t":draw Affichage("01000010001110001000010000100100110") shifted(decalage);
+ elseif substring(cptk,cptk+1) of cptnt="u":draw Affichage("00000000001000110001100011001101101") shifted(decalage);
+ elseif substring(cptk,cptk+1) of cptnt="v":if Math=true:
+ draw Affichage("00111001000010000100101000110000100") shifted(decalage);
+ else:
+ draw Affichage("00000000001000110001100010111000100") shifted(decalage);
+ fi;
+ elseif substring(cptk,cptk+1) of cptnt="w":draw Affichage("00000000001010110101101011010101110") shifted(decalage);
+ elseif substring(cptk,cptk+1) of cptnt="x":draw Affichage("00000000001000101010001000101010001") shifted(decalage);
+ elseif substring(cptk,cptk+1) of cptnt="y":draw Affichage("00000000001000110001011110000101110") shifted(decalage);
+ elseif substring(cptk,cptk+1) of cptnt="z":draw Affichage("00000000001111100010001000100011111") shifted(decalage);
+ elseif substring(cptk,cptk+1) of cptnt="0":draw Affichage("01110100011001110101110011000101110") shifted(decalage);
+ elseif substring(cptk,cptk+1) of cptnt="1":draw Affichage("00100011000010000100001000010001110") shifted(decalage);
+ elseif substring(cptk,cptk+1) of cptnt="2":draw Affichage("01110100010000100010001000100011111") shifted(decalage);
+ elseif substring(cptk,cptk+1) of cptnt="3":draw Affichage("11111000100010000010000011000101110") shifted(decalage);
+ elseif substring(cptk,cptk+1) of cptnt="4":draw Affichage("00010001100101010010111110001000010") shifted(decalage);
+ elseif substring(cptk,cptk+1) of cptnt="5":draw Affichage("11111100001111000001000011000101110") shifted(decalage);
+ elseif substring(cptk,cptk+1) of cptnt="6":draw Affichage("00110010001000011110100011000101110") shifted(decalage);
+ elseif substring(cptk,cptk+1) of cptnt="7":draw Affichage("11111000010001000100010000100001000") shifted(decalage);
+ elseif substring(cptk,cptk+1) of cptnt="8":draw Affichage("01110100011000101110100011000101110") shifted(decalage);
+ elseif substring(cptk,cptk+1) of cptnt="9":draw Affichage("01110100011000101111000010001001100") shifted(decalage);
+ elseif substring(cptk,cptk+1) of cptnt="!":draw Affichage("00100001000010000100000000000000100") shifted(decalage);
+ elseif substring(cptk,cptk+1) of cptnt="'":draw Affichage("01100001000100000000000000000000000") shifted(decalage);
+ elseif substring(cptk,cptk+1) of cptnt="(":draw Affichage("00010001000100001000010000010000010") shifted(decalage);
+ elseif substring(cptk,cptk+1) of cptnt=")":draw Affichage("01000001000001000010000100010001000") shifted(decalage);
+ elseif substring(cptk,cptk+1) of cptnt="*":draw Affichage("00000001001010101110101010010000000") shifted(decalage);
+ elseif substring(cptk,cptk+1) of cptnt="+":draw Affichage("00000001000010011111001000010000000") shifted(decalage);
+ elseif substring(cptk,cptk+1) of cptnt=",":draw Affichage("00000000000000000000011000010001000") shifted(decalage);
+ elseif substring(cptk,cptk+1) of cptnt="-":draw Affichage("00000000000000011111000000000000000") shifted(decalage);
+ elseif substring(cptk,cptk+1) of cptnt=".":draw Affichage("00000000000000000000000000110001100") shifted(decalage);
+ elseif substring(cptk,cptk+1) of cptnt="/":draw Affichage("00000000010001000100010001000000000") shifted(decalage);
+ elseif substring(cptk,cptk+1) of cptnt=":":if Math=true:
+ draw Affichage("00000000000000000000000000000000000") shifted(decalage);
+ else:
+ draw Affichage("00000011000110000000011000110000000") shifted(decalage);
+ fi;
+ elseif substring(cptk,cptk+1) of cptnt=";":if Math=true:
+ draw Affichage("00000001000000011111000000010000000") shifted(decalage);
+ else:
+ draw Affichage("00000011000110000000011000010001000") shifted(decalage);
+ fi;
+ elseif substring(cptk,cptk+1) of cptnt="<":draw Affichage("00010001000100010000010000010000010") shifted(decalage);
+ elseif substring(cptk,cptk+1) of cptnt="=":draw Affichage("00000000001111100000111110000000000") shifted(decalage);
+ elseif substring(cptk,cptk+1) of cptnt=">":draw Affichage("10000010000010000010001000100010000") shifted(decalage);
+ elseif substring(cptk,cptk+1) of cptnt="?":draw Affichage("01110100010000100010001000000000100") shifted(decalage);
+ elseif substring(cptk,cptk+1) of cptnt="[":draw Affichage("01110010000100001000010000100001110") shifted(decalage);
+ elseif substring(cptk,cptk+1) of cptnt="]":draw Affichage("01110000100001000010000100001001110") shifted(decalage);
+ elseif substring(cptk,cptk+1) of cptnt="`":draw Affichage("01000001000001000000000000000000000") shifted(decalage);
+ elseif substring(cptk,cptk+1) of cptnt="|":draw Affichage("00100001000010000100001000010000100") shifted(decalage);
+ elseif substring(cptk,cptk+1) of cptnt=" ":draw Affichage("00000100010101000100010101000100000") shifted(decalage);
+ elseif substring(cptk,cptk+1) of cptnt="&":draw Affichage("00000100001100011100110001000000000") shifted(decalage);
+ elseif substring(cptk,cptk+1) of cptnt="$":draw Affichage("00000000000000100001000010000111111") shifted(decalage);
+ elseif substring(cptk,cptk+1) of cptnt="^":draw Affichage("00100010101000100000000000000000000") shifted(decalage);
+ fi;
+enddef;
+
+vardef LCD(text nt)(text rep)=
+ decahoriz:=0;
+ nblignes:=nblignes+1;
+ path Ecran;
+ 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;
+ for k=0 upto length(nt)-1:
+ BlocAffichage;
+ Test(k,nt);
+ 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;
+ draw Ecran withcolor if print=true:0.8white else:CouleurEcran fi;
+ for k=0 upto length(rep)-1:
+ BlocAffichage;
+ Test(k,rep);
+ endfor;
+enddef;
+
+endinput;
diff --git a/Master/texmf-dist/metapost/profcollege/PfC-Constantes.mp b/Master/texmf-dist/metapost/profcollege/PfC-Constantes.mp
new file mode 100644
index 00000000000..b97bd8a4c0a
--- /dev/null
+++ b/Master/texmf-dist/metapost/profcollege/PfC-Constantes.mp
@@ -0,0 +1,23 @@
+%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;
+pi:=3.141592654;
+e:=2.718281828;
+c:=57.29578; % conversion d'un radian en degres
+color rouge,vert,bleu,jaune,noir,blanc,orange,rose,violet,ciel,cielfonce,orangevif,gris;
+rouge=(1,0,0);
+bleu=(0,0,1);
+noir=(0,0,0);
+blanc=(1,1,1);
+orange=(1,0.5,0);
+violet=blanc-vert;
+rose=(1,0.7,0.7);
+cielfonce=0.9*(0.25,1,1);
+ciel=bleu+vert;
+orangevif=(1,0.25,0.1);
+vert=(0,1,0);
+jaune=rouge+vert;
+gris=0.8*white;
diff --git a/Master/texmf-dist/metapost/profcollege/PfC-Geometrie.mp b/Master/texmf-dist/metapost/profcollege/PfC-Geometrie.mp
new file mode 100644
index 00000000000..222df574193
--- /dev/null
+++ b/Master/texmf-dist/metapost/profcollege/PfC-Geometrie.mp
@@ -0,0 +1,1206 @@
+%===============================================
+%% PfC-Geometrie
+%% christophe.poulain@melusine.eu.org
+%%===============================================
+%------------------------------------------------
+% Appel fichier
+%------------------------------------------------
+%input PfC-Constantes;
+%------------------------------------------------
+% La figure (debut et fin) JMS/CP
+%------------------------------------------------
+path feuillet;
+numeric _tfig,_nfig;
+_tfig:=5cm;
+_nfig:=0;
+pair coinbg,coinbd,coinhd,coinhg;
+
+string typetrace;
+typetrace="normal";
+
+def feuille(expr xa,ya,xb,yb) =
+ feuillet := (xa,ya)--(xa,yb)--(xb,yb)--(xb,ya)--cycle;
+ coinbg := (xa,ya);
+ coinbd := (xb,ya);
+ coinhd := (xb,yb);
+ coinhg := (xa,yb);
+ %modifie le 29.09.04
+ z.so=(xpart(coinbg/1cm),ypart(coinbg/1cm));
+ z.ne=(xpart(coinhd/1cm),ypart(coinhd/1cm));
+ %fin modification
+ extra_endfig := "clip currentpicture to feuillet;" & extra_endfig;
+enddef;
+
+def Figure(expr xa,ya,xb,yb) =
+ feuille(xa,ya,xb,yb);
+ _tfig:= if (xb-xa)>(yb-ya): xb-xa else: yb-ya fi;
+ _tfig:=2*_tfig;
+enddef;
+
+%%-----------------------------------------------
+%% Les marques (JMS)
+%%-----------------------------------------------
+string marque_p;
+marque_p := "non";
+marque_r := 20;
+marque_a := 20;
+marque_s := 5;
+marque_ang := 10;
+m_c := 10 ;%Pour la croix du marquage des points
+
+%------------------------------------------------
+% Les tables
+%------------------------------------------------
+numeric _tn;
+_tn:=0;
+pair _t[];
+color _T[];
+
+%%-----------------------------------------------
+%% Procedures d'affichage
+%%-----------------------------------------------
+def MarquePoint(expr p)=
+ if typetrace="3D":
+ %JMS
+ if marque_p = "plein":
+ fill fullcircle scaled (marque_r/5) shifted Projette(p);
+ elseif marque_p = "creux":
+ fill fullcircle scaled (marque_r/5) shifted (Projette(p)) withcolor white;
+ draw fullcircle scaled (marque_r/5) shifted (Projette(p));
+ %fin JMS
+ elseif marque_p = "croix":
+ draw (Projette(p) shifted (-u/10,u/10))--(Projette(p) shifted (u/10,-u/10));
+ draw (Projette(p) shifted (-u/10,-u/10))--(Projette(p) shifted (u/10,u/10));
+ elseif marque_p = "tiretv":
+ draw (Projette(p) shifted (0,u/10))--(Projette(p) shifted(0,-u/10));
+ elseif marque_p = "tireth":
+ draw (Projette(p) shifted (u/10,0))--(Projette(p) shifted(-u/10,0));
+ fi;
+ else:
+ if marque_p = "plein":
+ fill fullcircle scaled (marque_r/5) shifted p;
+ elseif marque_p = "creux":
+ fill fullcircle scaled (marque_r/5) shifted p withcolor white;
+ draw fullcircle scaled (marque_r/5) shifted p;
+ elseif marque_p = "croix":
+ draw (p shifted (-u/m_c,u/m_c))--(p shifted (u/m_c,-u/m_c));
+ draw (p shifted (-u/m_c,-u/m_c))--(p shifted (u/m_c,u/m_c));
+ elseif marque_p = "tiretv":
+ draw (p shifted (0,u/10))--(p shifted(0,-u/10));
+ elseif marque_p = "tireth":
+ draw (p shifted (u/10,0))--(p shifted(-u/10,0));
+ fi;
+ fi;
+enddef;
+
+vardef pointe(text t) =
+ for p_ = t: if (pair p_) or (color p_): MarquePoint(p_); fi endfor;
+enddef;
+
+%------------------------------------------------
+% Points
+%------------------------------------------------
+%JMS
+vardef iso(text t) =
+ save s,n; numeric n;
+ if typetrace="3D":
+ color s; s := (0,0,0) ; n := 0;
+ for p_ = t: s := s + p_; n := n + 1 ; endfor;
+ else:
+ pair s; s := (0,0) ; n := 0;
+ for p_ = t: s := s + p_; n := n + 1 ; endfor;
+ fi;
+ if n>0: (1/n)*s fi
+enddef;
+
+vardef milieu(expr AA,BB)=
+ save $;
+ pair $;
+ if typetrace="mainlevee":
+ $=point((length segment(AA,BB))*(1/2+(-1+uniformdeviate(2))/10)) of segment(AA,BB)
+ else:
+ $=iso(AA,BB)
+ fi;
+ $
+enddef;
+
+vardef CentreCercleI(expr aa,bb,cc)=
+ save $,a,c;
+ pair $;
+ numeric a,c;
+ a=(angle(aa-cc)-angle(bb-cc))/2;
+ c=(angle(cc-bb)-angle(aa-bb))/2;
+ ($-cc) rotated a shifted cc=whatever[aa,cc];
+ ($-bb) rotated c shifted bb=whatever[bb,cc];
+ $
+enddef;
+
+%------------------------------------------------
+% Cercles
+%------------------------------------------------
+%Cercle connaissant le centre A et le rayon q
+vardef cercle(expr aa, q)=fullcircle scaled (2*q) shifted aa
+enddef;
+%Cercle de centre A et passant par B
+vardef cerclepoint(expr aa,bb)=fullcircle scaled (2*abs(aa-bb)) shifted aa
+enddef;
+%Cercle connaissant le diametre [AB]
+vardef cercledia(expr aa,bb)=cercles(iso(aa,bb),bb)
+ %fullcircle scaled (2*abs(1/2[aa,bb]-bb)) shifted (1/2[aa,bb])
+enddef;
+%Cercles complets
+vardef cercles(text t)=
+ save Cer;
+ save n;
+ n:=0;
+ for p_=t:
+ if pair p_:
+ n:=n+1;
+ _t[n]:=p_;
+ fi
+ if numeric p_:
+ rayon:=p_;
+ fi;
+ if color p_:
+ n:=n+1;
+ _T[n]:=p_;
+ fi;
+ endfor;
+ if typetrace="3D":%centre aa passant par bb dans le plan (ccddee) généralement aa=cc
+ path Cer;
+ color ptcer[];
+ for k=0 step 5 until 360 :
+ ptcer[k div 5]-_T[1]=Distance(_T[1],_T[2])*((_T[4]-_T[3])*cosd(k)/Distance(_T[3],_T[4])+(_T[5]-_T[3])*sind(k)/Distance(_T[3],_T[5]));
+ endfor;
+ Cer=Projette(ptcer0)
+ for k=0 step 5 until 360 :
+ ..Projette(ptcer[k div 5])
+ endfor
+ ..cycle;
+ else:
+ path Cer;
+ if n=1 : Cer=fullcircle scaled (2*rayon) shifted _t[1];
+ elseif n=2 : Cer=fullcircle scaled (2*abs(_t[1]-_t[2])) shifted _t[1];
+ elseif n=3 : Cer=cercles(CentreCercleC(_t[1],_t[2],_t[3]),_t[1]);
+ fi
+ fi
+ Cer
+enddef;
+
+%Point particulier sur le cercle
+vardef pointarc(expr cercla,angle)=
+ point(arctime((angle/360)*arclength cercla) of cercla) of cercla
+enddef;
+
+%Arc de cercle AB de centre 0(dans le sens direct) : les points A et B doivent etre sur le cercle.
+vardef arccercle(expr aa,bb,oo)=
+ path tempo;
+ path arc;
+ tempo=fullcircle scaled (2*abs(aa-oo)) shifted oo;
+ if (angle(aa-oo)=0) or (angle(aa-oo)>0) :
+ if (angle(bb-oo)=0) or (angle(bb-oo)>0):
+ if (angle(aa-oo)<angle(bb-oo)):
+ arc=subpath(angle(aa-oo)*(length tempo)/360,angle(bb-oo)*(length tempo)/360) of tempo;
+ else:
+ arc=subpath(angle(aa-oo)*(length tempo)/360,(length tempo)+angle(bb-oo)*(length tempo)/360) of tempo;
+ fi;
+ elseif (angle(bb-oo)<0):
+ arc=subpath(angle(aa-oo)*(length tempo)/360,(length tempo)+angle(bb-oo)*(length tempo)/360) of tempo;
+ fi;
+ elseif (angle(aa-oo)<0):
+ if (angle(bb-oo)=0) or (angle(bb-oo)>0):
+ arc=subpath(length tempo+angle(aa-oo)*(length tempo)/360,length tempo+angle(bb-oo)*(length tempo)/360) of tempo;
+ elseif (angle(bb-oo)<0):
+ if (angle(aa-oo)=angle(bb-oo)) or (angle(aa-oo)<angle(bb-oo)):
+ arc=subpath((length tempo)+angle(aa-oo)*(length tempo)/360,(length tempo)+angle(bb-oo)*(length tempo)/360) of tempo;
+ else:
+ arc=subpath((length tempo)+angle(aa-oo)*(length tempo)/360,2*(length tempo)+angle(bb-oo)*(length tempo)/360) of tempo;
+ fi;
+ fi;
+ fi;
+ arc
+enddef;
+
+vardef coupdecompas(expr ab,ac,ad)=arccercle(pointarc(cercles(ab,ac),angle(ac-ab)-ad),pointarc(cercles(ab,ac),angle(ac-ab)+ad),ab)
+enddef;
+
+%------------------------------------------------
+% Procedures de codage
+%------------------------------------------------
+%Codage de l'angle droit de sommet B
+vardef codeperp(expr aa,bb,cc,m)=%normalement m=5
+ save codep;
+ path codep;
+ if typetrace="3D":
+ codep=(Projette(bb)+m*unitvector(Projette(aa)-Projette(bb)))--(Projette(bb)+m*unitvector(Projette(aa)-Projette(bb))+m*unitvector(Projette(cc)-Projette(bb)))--(Projette(bb)+m*unitvector(Projette(cc)-Projette(bb)));
+ else:
+ codep=(bb+m*unitvector(aa-bb))--(bb+m*unitvector(aa-bb)+m*unitvector(cc-bb))--(bb+m*unitvector(cc-bb));
+ fi;
+ codep
+enddef;
+
+%Codage d'un milieu
+vardef codemil(expr AA,BB, n) =%extremites-angle de codage
+ save $,a,b,c,d;
+ path $;
+ pair a,b,c,d;
+ a=1/2[AA,BB];
+ b=(a+marque_s*unitvector(BB-AA))-(a-marque_s*unitvector(BB-AA));
+ c=b rotated n shifted a;
+ d=2[c,a];
+ $=c--d;
+ $
+enddef;
+%Codage de deux segments egaux
+vardef codesegments(expr aa,bb,cc,dd,n)=%extremites des segments(4)-type de codage
+ save $,v,w;
+ picture $;
+ pair AA,BB,CC,DD;
+ $=image(
+ if typetrace="3D":
+ AA=Projette(aa); BB=Projette(bb); CC=Projette(cc); DD=Projette(dd);
+ else:
+ AA=aa;BB=bb;CC=cc;DD=dd;
+ fi;
+ if n=5 :
+ draw fullcircle scaled 0.1cm shifted (1/2[AA,BB]);
+ draw fullcircle scaled 0.1cm shifted (1/2[CC,DD]);
+ elseif n=4 :
+ pair v,w;
+ v=1/2[AA,BB];
+ w=1/2[CC,DD];
+ draw codemil(AA,BB,60);
+ draw codemil(AA,BB,120);
+ draw codemil(CC,DD,60);
+ draw codemil(CC,DD,120);
+ elseif n=3 :
+ draw codemil(AA,BB,60);
+ draw codemil(AA,BB,60) shifted (2*unitvector(AA-BB));
+ draw codemil(AA,BB,60) shifted (2*unitvector(BB-AA));
+ draw codemil(CC,DD,60);
+ draw codemil(CC,DD,60) shifted (2*unitvector(CC-DD));
+ draw codemil(CC,DD,60) shifted (2*unitvector(DD-CC));
+ elseif n=2 :
+ draw codemil(AA,BB,60) shifted unitvector(AA-BB);
+ draw codemil(AA,BB,60) shifted unitvector(BB-AA);
+ draw codemil(CC,DD,60) shifted unitvector(CC-DD);
+ draw codemil(CC,DD,60) shifted unitvector(DD-CC);
+ elseif n=1 :
+ draw codemil(AA,BB,60);
+ draw codemil(CC,DD,60);
+ fi;
+ );
+ $
+ enddef;
+
+%Codage de plusieurs segments de meme longueur
+ vardef Codelongueur(text t)=
+ save result;
+ picture result;
+ pair tt[];
+ k:=0;
+ for p_=t:
+ if pair p_:
+ k:=k+1;
+ tt[k]=p_;
+ elseif color p_:
+ k:=k+1;
+ tt[k]=Projette(p_);
+ elseif numeric p_:
+ co:=p_;
+ fi;
+ endfor;
+ result=image(
+ if co=5:
+ for j=1 upto (k div 2):
+ draw fullcircle scaled 0.1cm shifted (1/2[tt[2*j-1],tt[2*j]]);
+ endfor;
+ elseif co=4:
+ for j=1 upto (k div 2):
+ draw codemil(tt[2*j-1],tt[2*j],60);
+ draw codemil(tt[2*j-1],tt[2*j],120);
+ endfor;
+ elseif co=3:
+ for j=1 upto (k div 2):
+ draw codemil(tt[2*j-1],tt[2*j],60);
+ draw codemil(tt[2*j-1],tt[2*j],60) shifted (2*unitvector(tt[2*j-1]-tt[2*j]));
+ draw codemil(tt[2*j-1],tt[2*j],60) shifted (2*unitvector(tt[2*j]-tt[2*j-1]));
+ endfor;
+ elseif co=2:
+ for j=1 upto (k div 2):
+ draw codemil(tt[2*j-1],tt[2*j],60) shifted unitvector(tt[2*j-1]-tt[2*j]);
+ draw codemil(tt[2*j-1],tt[2*j],60) shifted unitvector(tt[2*j]-tt[2*j-1]);
+ endfor;
+ elseif co=1:
+ for j=1 upto (k div 2):
+ draw codemil(tt[2*j-1],tt[2*j],60);
+ endfor;
+ fi;
+ );
+ result
+enddef;
+
+%Codage de l'angle abc non oriente (mais donne dans le sens direct) n fois avec des mesures differentes
+vardef codeangle@#(expr aa,bb,cc,nb,nom)=
+ save s,p,$;
+ path p;
+ picture $;
+ $=image(
+ trace marqueangle(aa,bb,cc,nb);
+ label.@#(nom,w);
+ );
+ $
+enddef;
+
+vardef Marqueangle(expr aa,bb,mark)=%codage d'un angle forme par les demi-droites aa et bb dans le sens direct avec la marque mark
+ save $;
+ picture $;
+ path conf,rr;
+ pair w,tangent;
+ numeric t,tt;
+ conf=fullcircle scaled (2*marque_a) shifted (aa intersectionpoint bb);
+ numeric te;
+ te=angle((conf intersectionpoint aa)-(aa intersectionpoint bb));
+ rr=(conf intersectionpoint aa){dir(90+angle((conf intersectionpoint aa)-(aa intersectionpoint bb)))}..(conf intersectionpoint bb);
+ t=length rr/2;
+ w=point(t) of rr;
+ tangent=unitvector(direction t of rr);
+ $=image(
+ trace rr;
+ if mark=1:
+ trace rotation((w shifted(5*tangent))--(w shifted(-5*tangent)),w,90);
+ elseif mark=2:
+ trace rotation((w shifted(5*tangent))--(w shifted(-5*tangent)),w,90) shifted tangent;
+ trace rotation((w shifted(5*tangent))--(w shifted(-5*tangent)),w,90) shifted(-tangent);
+ elseif mark=3:
+ trace rotation((w shifted(5*tangent))--(w shifted(-5*tangent)),w,90);
+ trace rotation((w shifted(5*tangent))--(w shifted(-5*tangent)),w,90) shifted(1.5*tangent);
+ trace rotation((w shifted(5*tangent))--(w shifted(-5*tangent)),w,90) shifted(-1.5*tangent);
+ elseif mark=4:
+ trace rotation((w shifted(5*tangent))--(w shifted(-5*tangent)),w,45);
+ trace rotation((w shifted(5*tangent))--(w shifted(-5*tangent)),w,-45);
+ fi;
+ );
+ $
+enddef;
+
+vardef marqueangle(expr aa,bb,cc,mark)=%codage d'un angle de sommet bb dans le sens direct par la marque mark.
+ save $;
+ picture $;
+ path conf,rr;
+ pair w,tangent;
+ numeric t;
+ if typetrace="mainlevee":
+ conf=fullcircle scaled (2*marque_a) shifted bb;
+ rr=(conf intersectionpoint demidroite(bb,aa)){dir(90+angle(aa-bb))}..(conf intersectionpoint demidroite(bb,cc));
+ w=rr intersectionpoint droite(bb,CentreCercleI(aa,bb,cc));
+ t=length rr/2;
+ tangent=unitvector(direction t of rr);
+ $=image(
+ trace rr;
+ if mark=1:
+ trace rotation((w shifted(marque_s*tangent))--(w shifted(-marque_s*tangent)),w,90);
+ elseif mark=2:
+ trace rotation((w shifted(marque_s*tangent))--(w shifted(-marque_s*tangent)),w,90) shifted tangent;
+ trace rotation((w shifted(marque_s*tangent))--(w shifted(-marque_s*tangent)),w,90) shifted(-tangent);
+ elseif mark=3:
+ trace rotation((w shifted(marque_s*tangent))--(w shifted(-marque_s*tangent)),w,90);
+ trace rotation((w shifted(marque_s*tangent))--(w shifted(-marque_s*tangent)),w,90) shifted(1.marque_s*tangent);
+ trace rotation((w shifted(marque_s*tangent))--(w shifted(-marque_s*tangent)),w,90) shifted(-1.marque_s*tangent);
+ elseif mark=4:
+ trace rotation((w shifted(marque_s*tangent))--(w shifted(-marque_s*tangent)),w,45);
+ trace rotation((w shifted(marque_s*tangent))--(w shifted(-marque_s*tangent)),w,-45);
+ fi;
+ );
+ else:
+ rr=arccercle(bb+marque_a*unitvector(aa-bb),bb+marque_a*unitvector(cc-bb),bb);
+ w=rr intersectionpoint droite(bb,CentreCercleI(aa,bb,cc));
+ t=length rr/2;
+ tangent=unitvector(direction t of rr);
+ $=image(
+ if mark=5:
+ drawarrow rr;
+ else:
+ trace rr;
+ fi;
+ if mark=1:
+ trace rotation((w shifted(marque_s*tangent))--(w shifted(-marque_s*tangent)),w,90);
+ elseif mark=2:
+ trace rotation((w shifted(marque_s*tangent))--(w shifted(-marque_s*tangent)),w,90) shifted tangent;
+ trace rotation((w shifted(marque_s*tangent))--(w shifted(-marque_s*tangent)),w,90) shifted(-tangent);
+ elseif mark=3:
+ trace rotation((w shifted(marque_s*tangent))--(w shifted(-marque_s*tangent)),w,90);
+ trace rotation((w shifted(marque_s*tangent))--(w shifted(-marque_s*tangent)),w,90) shifted(1.marque_s*tangent);
+ trace rotation((w shifted(marque_s*tangent))--(w shifted(-marque_s*tangent)),w,90) shifted(-1.marque_s*tangent);
+ elseif mark=4:
+ trace rotation((w shifted(marque_s*tangent))--(w shifted(-marque_s*tangent)),w,45);
+ trace rotation((w shifted(marque_s*tangent))--(w shifted(-marque_s*tangent)),w,-45);
+ fi;
+ );
+ fi;
+ $
+enddef;
+
+vardef coloreangle(expr aa,bb,cc)=arccercle(bb+marque_a*unitvector(aa-bb),bb+marque_a*unitvector(cc-bb),bb)--bb--cycle
+enddef;
+
+vardef Codeangle(expr aa,bb,cc,nb,nom)=
+ save s,p,$;
+ path p;
+ picture $;
+ $=image(
+ trace marqueangle(aa,bb,cc,nb);
+ label(nom,w shifted(marque_ang*unitvector(w-bb)));
+ );
+ $
+enddef;
+
+vardef marquesegment(expr aa,bb)=
+ save tr;
+ picture tr;
+ if typetrace="3D":
+ tr=image(%
+ typetrace:="normal";
+ trace rotation(segment(Projette(aa)-marque_s*unitvector(Projette(bb)-Projette(aa)),Projette(aa)+marque_s*unitvector(Projette(bb)-Projette(aa))),Projette(aa),90);
+ trace rotation(segment(Projette(bb)-marque_s*unitvector(Projette(bb)-Projette(aa)),Projette(bb)+marque_s*unitvector(Projette(bb)-Projette(aa))),Projette(bb),90);
+ typetrace:="3D";
+ );
+ else:
+ tr=image(%
+ trace rotation(segment(aa-marque_s*unitvector(bb-aa),aa+marque_s*unitvector(bb-aa)),aa,90);
+ trace rotation(segment(bb-marque_s*unitvector(bb-aa),bb+marque_s*unitvector(bb-aa)),bb,90);
+ );
+ fi;
+ tr
+enddef;
+
+vardef marquedemidroite(expr aa,bb)=
+ save tr;
+ picture tr;
+ tr=image(
+ trace rotation(segment(aa-marque_s*unitvector(bb-aa),aa+marque_s*unitvector(bb-aa)),aa,90);
+ );
+ tr
+enddef;
+
+%------------------------------------------------
+% Transformations
+%------------------------------------------------
+vardef projection(expr m,a,b) =
+ save h; pair h;
+ h - m = whatever * (b-a) rotated 90;
+ h = whatever [a,b];
+ if typetrace="mainlevee":
+ h:=h shifted((-2+uniformdeviate(4))*unitvector(a-b))
+ fi;
+ h
+enddef;
+
+vardef homothetie(expr objet,CTR,rapport)=
+ ((objet shifted (-CTR)) scaled rapport) shifted CTR
+enddef;
+
+vardef rotation(expr p,c,a)=
+ p rotatedaround(c,a)
+enddef;
+
+vardef symetrie(expr x)(text t)=
+ save n;
+ n:=0;
+ for p_=t: if pair p_:
+ n:=n+1;
+ _t[n]:=p_;
+ elseif color p_:
+ n:=n+1;
+ _T[n]:=p_;
+ fi;
+ endfor;
+ if n=1:
+ if typetrace="3D":
+ 2[x,_T[1]]
+ else:
+ rotation(x,_t[1],180)
+ fi
+ elseif n=2:
+ x reflectedabout(_t[1],_t[2])
+ elseif n=3:%Par rapport a un plan
+ 2[x,ProjectionsurPlan(x,_T[1],_T[2],_T[3])]
+ fi
+enddef;
+
+%------------------------------------------------
+% Droites
+%------------------------------------------------
+vardef segment(expr aa,bb)=
+ save Seg;
+ path Seg;
+ if typetrace="mainlevee":
+ Seg=aa{dir(angle(bb-aa)+5)}..bb{dir(angle(bb-aa)+5)}
+ elseif typetrace="3D":
+ Seg=Projette(aa)--Projette(bb)
+ else:
+ Seg=aa--bb
+ fi;
+ Seg
+enddef;
+
+vardef droite(expr AA,BB)=
+ save Dro;
+ path Dro;
+ if typetrace="mainlevee":
+ Dro=(_tfig/abs(AA-BB))[BB,AA]{dir(angle(BB-AA)+10)}..segment(AA,BB)..(_tfig/abs(AA-BB))[AA,BB]{dir(angle(BB-AA)+10)}
+ elseif typetrace="3D":
+ Dro=(_tfig/abs(Projette(AA)-Projette(BB)))[Projette(BB),Projette(AA)]--(_tfig/abs(Projette(AA)-Projette(BB)))[Projette(AA),Projette(BB)]
+ else:
+ Dro=(_tfig/abs(AA-BB))[BB,AA]--(_tfig/abs(AA-BB))[AA,BB]
+ fi;
+ Dro
+enddef;
+vardef demidroite(expr AA,BB)=
+ save Dem;
+ path Dem;
+ if typetrace="mainlevee":
+ Dem=segment(AA,BB)..(_tfig/abs(AA-BB))[AA,BB]{dir(angle(BB-AA)+10)}
+ elseif typetrace="3D":
+ Dem=Projette(AA)--(_tfig/abs(Projette(AA)-Projette(BB)))[Projette(AA),Projette(BB)]
+ else:
+ Dem=AA--(_tfig/abs(AA-BB))[AA,BB]
+ fi;
+ Dem
+enddef;
+
+vardef bissectrice(expr AA,BB,CC)=
+ save $;
+ path $;
+ if typetrace="mainlevee":
+ $=rotation(demidroite(BB,CentreCercleI(AA,BB,CC)),BB,-5+uniformdeviate(10))
+ else:
+ $=demidroite(BB,CentreCercleI(AA,BB,CC))
+ fi;
+ $
+enddef;
+
+vardef mediatrice(expr AA,BB)=droite(iso(AA,BB),rotation(BB,iso(AA,BB),90))
+enddef;
+%main levee : passer par la perpendiculaire passant par le milieu.
+
+vardef perpendiculaire(expr AA,BB,II)=droite(iso(AA,BB),rotation(BB,iso(AA,BB),90)) shifted (II-iso(AA,BB))
+enddef;
+
+vardef parallele(expr AA,BB,II)=droite(AA,BB) shifted (II-(projection(II,AA,BB)))
+enddef;
+
+%%%%%%%%%%
+%Polygone/Ligne brisée
+%%%%%%%%%
+vardef polygone(text t)=
+ pair aaa[];
+ j:=0;
+ for p_=t: if pair p_:
+ j:=j+1;
+ aaa[j]=p_;
+ elseif color p_:
+ j:=j+1;
+ aaa[j]=Projette(p_);
+ fi;
+ endfor;
+ aaa[j+1]:=aaa[1];
+ save $;
+ path $;
+ $=aaa1--
+ for k=2 upto j:
+ aaa[k]--
+ endfor
+ cycle;
+ $
+enddef;
+
+vardef chemin(text t)=
+ pair aaa[];
+ j:=0;
+ for p_=t: if pair p_:
+ j:=j+1;
+ aaa[j]=p_;
+ elseif color p_:
+ j:=j+1;
+ aaa[j]=Projette(p_);
+ fi;
+ endfor;
+ if typetrace="mainlevee":
+ save $;
+ picture $;
+ $=image(
+ for k=1 upto (j-1):
+ trace segment(aaa[k],aaa[k+1]);
+ endfor;
+ );
+ else:
+ save $;
+ path $;
+ $=aaa1
+ for k=2 upto j:
+ --aaa[k]
+ endfor;
+ fi;
+ $
+enddef;
+
+%------------------------------------------------
+%Sucres
+%------------------------------------------------
+vardef hachurage(expr chemin, angle, ecart, trace)=
+ save $;
+ picture $;
+ path support;
+ support=((u*(-37,0))--(u*(37,0))) rotated angle;
+ if trace=1:
+ drawoptions(dashed evenly);
+ elseif trace=2:
+ drawoptions(dashed dashpattern(on12bp off6bp on3bp off6bp));
+ elseif trace=3:
+ drawoptions(dashed withdots);
+ fi;
+ $ = image(
+ for j=-200 upto 200:
+ if ((support shifted (ecart*j*(u,0))) intersectiontimes chemin)<>(-1,-1):
+ draw support shifted (ecart*j*(u,0));
+ fi
+ endfor;
+ );
+ clip $ to chemin;
+ drawoptions();
+ $
+enddef;
+%fleche pour coter un segment [AB] (Jacques Marot)
+vardef cotation(expr aa,bb,ecart,decalage,cote)=
+ pair m[] ;
+ save $;
+ picture $;
+ m3=unitvector(bb-aa) rotated 90;
+ m1=aa+ecart*m3;
+ m2=bb+ecart*m3;
+ $=image(
+ pickup pencircle scaled 0.2bp;
+ drawdblarrow m1--m2 ;
+ draw aa--m1 dashed evenly;
+ draw bb--m2 dashed evenly;
+ label(cote rotated angle(m2-m1),(m1+m2)/2+decalage*m3);
+ );
+ $
+enddef;
+
+vardef appelation(expr aa,bb,decalage,cote)=
+ save $;
+ pair m[],AA,BB;
+ if color aa:
+ AA=Projette(aa);
+ else:
+ AA=aa;
+ fi;
+ if color bb:
+ BB=Projette(bb);
+ else:
+ BB=bb;
+ fi;
+ m3=unitvector(BB-AA) rotated 90;
+ picture $;
+ $=image(
+ label(cote rotated angle(BB-AA),(BB+AA)/2+decalage*m3);
+ );
+ $
+enddef;
+
+vardef cotationmil(expr aa,bb,ecart,decalage,cote)= %Christophe
+ pair m[],AA,BB;
+ save $;
+ picture cot;
+ if color aa:
+ AA=Projette(aa)
+ else:
+ AA=aa
+ fi;
+ if color bb:
+ BB=Projette(bb)
+ else:
+ BB=bb
+ fi;
+ m3=unitvector(BB-AA) rotated 90;
+ m1=AA+ecart*m3;
+ m2=BB+ecart*m3;
+ cot=image(
+ pickup pencircle scaled 0.2bp;
+ drawarrow (1/2[m1,m2]+decalage*unitvector(m1-m2))--m1;
+ drawarrow (1/2[m1,m2]-decalage*unitvector(m1-m2))--m2;
+ draw AA--m1 dashed evenly;
+ draw BB--m2 dashed evenly;
+ label(cote rotated angle(m2-m1),(m1+m2)/2);
+ );
+ cot
+enddef;
+
+%%%%%%%%%%
+%francisation
+%%%%%%%%%
+def trace expr o =
+ if path o: draw o else: draw o fi
+enddef;
+def remplis expr o =
+ if path o: fill o else: fill o fi
+enddef;
+
+%3D - basé sur donymodule
+color Sommet[];
+
+color Co[];
+Co0=jaune;
+Co1=violet;
+Co2=orange;
+Co3=ciel;
+Co4=vert;
+Co5=bleu;
+Co6=rouge;
+
+string pointilles;
+
+string typerepre;
+typerepre:="proj";
+
+%generalite
+vardef Projette(expr X)=
+ pair $;
+ Xobs := -redpart(X)*Aux1 + greenpart(X)*Aux3;
+ Yobs := -redpart(X)*Aux5 - greenpart(X)*Aux6 + bluepart(X)*Aux4;
+ if typerepre="proj":
+ Zobs := -redpart(X)*Aux7 - greenpart(X)*Aux8 - bluepart(X)*Aux2 + Rho;
+ XProj := DE*Xobs/Zobs;
+ YProj := DE*Yobs/Zobs;
+ elseif typerepre="persp":
+ XProj := DE*Xobs;
+ YProj := DE*Yobs;
+ fi;
+ $=(XProj,YProj);
+ $
+enddef;
+
+vardef Initialisation(expr r,t,p,d)=
+ Rho:=r;
+ Theta:=t;
+ Phi:=p;
+ DE:=d;
+ Aux1:=sind(Theta);
+ Aux2:=sind(Phi);
+ Aux3:=cosd(Theta);
+ Aux4:=cosd(Phi);
+ Aux5:=Aux3*Aux2;
+ Aux6:=Aux1*Aux2;
+ Aux7:=Aux3*Aux4;
+ Aux8:=Aux1*Aux4;
+ pointilles:="oui";
+enddef;
+
+%vues cachees
+
+vardef Face(text t)=
+ j:=0;
+ for p_=t :
+ if numeric p_:
+ a[j]:=p_;
+ j:=j+1;
+ fi;
+ endfor;
+ for k=1 upto (j-1):
+ Fc[a0*100+(k-1)]:=a[k];
+ endfor;
+enddef;
+
+vardef Oeil=(Rho*Aux7,Rho*Aux8,Rho*Aux2)
+enddef;
+
+vardef Vision(expr num)=
+ save bb;
+ color bb;
+ bb=(redpart(Oeil-Sommet[num]),greenpart(Oeil-Sommet[num]),bluepart(Oeil-Sommet[num]));
+ bb
+enddef;
+
+vardef Normal(expr vecun,vecde,vectr)=
+ save aa;
+ color aa;
+ P1:=redpart(vecde-vecun);
+ P2:=greenpart(vecde-vecun);
+ P3:=bluepart(vecde-vecun);
+ Q1:=redpart(vectr-vecun);
+ Q2:=greenpart(vectr-vecun);
+ Q3:=bluepart(vectr-vecun);
+ aa=(P2*Q3-Q2*P3,P3*Q1-Q3*P1,P1*Q2-Q1*P2);
+ aa
+enddef;
+
+vardef ProduitScalaire(expr wec,mor)=
+ redpart(wec)*redpart(mor)+greenpart(wec)*greenpart(mor)+bluepart(wec)*bluepart(mor)
+enddef;
+
+vardef Distance(expr aa,bb)=%Entre deux points
+ sqrt((redpart(bb)-redpart(aa))*(redpart(bb)-redpart(aa))+(greenpart(bb)-greenpart(aa))*(greenpart(bb)-greenpart(aa))+(bluepart(bb)-bluepart(aa))*(bluepart(bb)-bluepart(aa)))
+enddef;
+
+vardef Module(expr aa)=%module d'un vecteur
+sqrt((redpart(aa))**2+(greenpart(aa))**2+(bluepart(aa)**2))
+enddef;
+
+color CoulTrace;
+CoulTrace=black;
+
+vardef DessineObjet=
+ for l=1 upto NF:
+ color cc,dd;
+ dd=Vision(Fc[l*100+1]);
+ cc=Normal(Sommet[Fc[l*100+1]],Sommet[Fc[l*100+2]],Sommet[Fc[l*100+3]]);
+ if (ProduitScalaire(dd,cc)<0):
+ if pointilles="oui":
+ drawoptions(dashed dashpattern(on3pt off6pt) withcolor CoulTrace);
+ trace for k=1 upto Fc[100*l]:
+ Projette(Sommet[Fc[100*l+k]])--
+ endfor
+ cycle;
+ fi;
+ else:
+ trace for k=1 upto Fc[100*l]:
+ Projette(Sommet[Fc[100*l+k]])--
+ endfor
+ cycle withcolor CoulTrace;
+ fi;
+ drawoptions();
+ endfor;
+enddef;
+
+%%Transformations
+
+%Translations
+
+vardef TranslateSommets(expr v)=
+ for k=1 upto NbS:
+ Sommet[k]:=Sommet[k]+v;
+ endfor;
+enddef;
+
+vardef SymetriePlanZ(expr vv)=
+ for k=1 upto NbS:
+ w:=vv-bluepart(Sommet[k]);
+ Sommet[k]:=(redpart(Sommet[k]),greenpart(Sommet[k]),w);
+ endfor;
+enddef;
+
+vardef IntersectionDroite(expr aa,bb,cc,dd)=
+ save tt;
+ color tt;
+ tt=whatever[aa,bb];
+ tt=whatever[cc,dd];
+ tt
+enddef;
+
+%%denis Roegel----------
+vardef Intersectionplandroite(expr aa,bb,cc,dd,ee)=
+ save int;
+ boolean int;
+ color gg,caaa[];
+ caaa3=Normal(aa,bb,cc)/Module(Normal(aa,bb,cc));
+ caaa1=aa-dd;
+ caaa2=ee-dd;
+ if ProduitScalaire(caaa2,caaa3)<>0:
+ caaa4=caaa2*(ProduitScalaire(caaa1,caaa3)/ProduitScalaire(caaa2,caaa3));
+ int:=true;
+ else: % the line is parallel to the plane
+ int:=false;
+ fi;
+ int
+enddef;
+
+vardef IntersectionPlanDroite(expr aa,bb,cc,dd,ee)=%plan (aa,bb,cc) droite(dd,ee)
+ if Intersectionplandroite(aa,bb,cc,dd,ee):
+ gg=dd+caaa4;
+ fi;
+ gg
+enddef;
+
+vardef ProjectionsurPlan(expr aa,bb,cc,dd)=%Projection du point aa sur le plan (bbccdd)
+ save di,vc;
+ color va,vb,vc;
+ va=Normal(bb,cc,dd)/Module(Normal(bb,cc,dd));
+ vb=aa-bb;
+ di=-ProduitScalaire(vb,va);
+ va:=di*va;
+ vb:=vb+va;
+ vc=bb+vb;
+ vc
+enddef;
+
+vardef Intersectionplanplan(expr AA,BB,CC,DD,EE,FF)=%besoin pour la suite
+ color trial[];
+ path INTer;
+ if Intersectionplandroite(DD,EE,FF,AA,BB):
+ trial1=IntersectionPlanDroite(DD,EE,FF,AA,BB);
+ else:% there is no intersection or the intersection is the line
+ trial1=IntersectionPlanDroite(DD,EE,FF,AA,1/2[BB,CC]);
+ fi;
+ if Intersectionplandroite(DD,EE,FF,AA,CC):
+ trial2=IntersectionPlanDroite(DD,EE,FF,AA,CC);
+ else:% there is no intersection or the intersection is the line
+ trial2=IntersectionPlanDroite(DD,EE,FF,CC,1/2[BB,AA]);%modif de cp
+ fi;
+ %INTer=segment(10[trial1,trial2],10[trial2,trial1]);
+ INTer=droite(trial1,trial2);
+ INTer
+enddef;
+
+vardef IntersectionPlanPlan(expr aa,bb,cc,dd,ee,ff)=
+ %a verifier
+ save da,db,dc,int,INTER;
+ boolean int;
+ path INTER;
+ da=Module(aa-ProjectionsurPlan(aa,dd,ee,ff));
+ %show da;
+ db=Module(bb-ProjectionsurPlan(bb,dd,ee,ff));
+ %show db;
+ dc=Module(cc-ProjectionsurPlan(cc,dd,ee,ff));
+ %show dc;
+ if (da=db) and (db=dc): % the two planes are parallel
+ int:=false;
+ else:
+ int:=true;
+ if (da=db):
+ INTER=droite(aa,bb);
+ elseif (db=dc):
+ INTER=droite(bb,cc);
+ elseif (dc=da):
+ INTER=droite(cc,aa);
+ elseif (da>=db) and (da>=dc):
+ INTER=Intersectionplanplan(aa,bb,cc,dd,ee,ff);
+ elseif (db>=da) and (db>=dc):
+ INTER=Intersectionplanplan(bb,cc,aa,dd,ee,ff);
+ elseif (dc>=da) and (dc>=db):
+ INTER=Intersectionplanplan(cc,aa,bb,dd,ee,ff);
+ fi;
+ fi;
+ INTER
+enddef;
+%%---------------------
+
+%Cube
+numeric arete;
+arete=1;
+
+vardef Cube(text t)=
+ picture cub;
+ cub=image(
+ NbS:=8;
+ Sommet1:=(arete,0,0);
+ Sommet2:=(arete,arete,0);
+ Sommet3:=(0,arete,0);
+ Sommet4:=(0,0,0);
+ Sommet5:=(0,0,arete);
+ Sommet6:=(arete,0,arete);
+ Sommet7:=(arete,arete,arete);
+ Sommet8:=(0,arete,arete);
+%%Faces
+ NF:=6;
+ Fc[100]:=4;Fc[101]:=1;Fc[102]:=4;Fc[103]:=3;Fc[104]:=2;
+ Fc[200]:=4;Fc[201]:=4;Fc[202]:=5;Fc[203]:=8;Fc[204]:=3;
+ Fc[300]:=4;Fc[301]:=1;Fc[302]:=6;Fc[303]:=5;Fc[304]:=4;
+ Fc[400]:=4;Fc[401]:=5;Fc[402]:=6;Fc[403]:=7;Fc[404]:=8;
+ Fc[500]:=4;Fc[501]:=2;Fc[502]:=3;Fc[503]:=8;Fc[504]:=7;
+ Fc[600]:=4;Fc[601]:=1;Fc[602]:=2;Fc[603]:=7;Fc[604]:=6;
+ DessineObjet;
+ k:=1;
+ for p_=t:
+ if color p_:
+ p_=Sommet[k];
+ k:=k+1;
+ fi
+ endfor;
+ );
+cub
+enddef;
+
+vardef cube=
+ typetrace:="3D";
+ typerepre:="persp";
+ Initialisation(1500,30,20,100);
+ picture cub;
+ cub=image(
+ NbS:=8;
+ Sommet1:=(arete,0,0);
+ Sommet2:=(arete,arete,0);
+ Sommet3:=(0,arete,0);
+ Sommet4:=(0,0,0);
+ Sommet5:=(0,0,arete);
+ Sommet6:=(arete,0,arete);
+ Sommet7:=(arete,arete,arete);
+ Sommet8:=(0,arete,arete);
+%%Faces
+ NF:=6;
+ Fc[100]:=4;Fc[101]:=1;Fc[102]:=4;Fc[103]:=3;Fc[104]:=2;
+ Fc[200]:=4;Fc[201]:=4;Fc[202]:=5;Fc[203]:=8;Fc[204]:=3;
+ Fc[300]:=4;Fc[301]:=1;Fc[302]:=6;Fc[303]:=5;Fc[304]:=4;
+ Fc[400]:=4;Fc[401]:=5;Fc[402]:=6;Fc[403]:=7;Fc[404]:=8;
+ Fc[500]:=4;Fc[501]:=2;Fc[502]:=3;Fc[503]:=8;Fc[504]:=7;
+ Fc[600]:=4;Fc[601]:=1;Fc[602]:=2;Fc[603]:=7;Fc[604]:=6;
+ DessineObjet;
+ );
+ cub
+enddef;
+
+%Cube
+vardef Paveh(text t)=
+ picture paveh;
+ paveh=image(
+ NbS:=8;
+ Sommet1:=(0.75,0,0);
+ Sommet2:=(0.75,1.5,0);
+ Sommet3:=(0,1.5,0);
+ Sommet4:=(0,0,0);
+ Sommet5:=(0,0,1);
+ Sommet6:=(0.75,0,1);
+ Sommet7:=(0.75,1.5,1);
+ Sommet8:=(0,1.5,1);
+%%Faces
+ NF:=6;
+ Fc[100]:=4;Fc[101]:=1;Fc[102]:=4;Fc[103]:=3;Fc[104]:=2;
+ Fc[200]:=4;Fc[201]:=4;Fc[202]:=5;Fc[203]:=8;Fc[204]:=3;
+ Fc[300]:=4;Fc[301]:=1;Fc[302]:=6;Fc[303]:=5;Fc[304]:=4;
+ Fc[400]:=4;Fc[401]:=5;Fc[402]:=6;Fc[403]:=7;Fc[404]:=8;
+ Fc[500]:=4;Fc[501]:=2;Fc[502]:=3;Fc[503]:=8;Fc[504]:=7;
+ Fc[600]:=4;Fc[601]:=1;Fc[602]:=2;Fc[603]:=7;Fc[604]:=6;
+ DessineObjet;
+ k:=1;
+ for p_=t:
+ if color p_:
+ p_=Sommet[k];
+ k:=k+1;
+ fi
+ endfor;
+ );
+paveh
+enddef;
+
+%Cube
+vardef Pavev(text t)=
+ picture pavev;
+ pavev=image(
+ NbS:=8;
+ Sommet1:=(1,0,0);
+ Sommet2:=(1,0.75,0);
+ Sommet3:=(0,0.75,0);
+ Sommet4:=(0,0,0);
+ Sommet5:=(0,0,1.5);
+ Sommet6:=(1,0,1.5);
+ Sommet7:=(1,0.75,1.5);
+ Sommet8:=(0,0.75,1.5);
+%%Faces
+ NF:=6;
+ Fc[100]:=4;Fc[101]:=1;Fc[102]:=4;Fc[103]:=3;Fc[104]:=2;
+ Fc[200]:=4;Fc[201]:=4;Fc[202]:=5;Fc[203]:=8;Fc[204]:=3;
+ Fc[300]:=4;Fc[301]:=1;Fc[302]:=6;Fc[303]:=5;Fc[304]:=4;
+ Fc[400]:=4;Fc[401]:=5;Fc[402]:=6;Fc[403]:=7;Fc[404]:=8;
+ Fc[500]:=4;Fc[501]:=2;Fc[502]:=3;Fc[503]:=8;Fc[504]:=7;
+ Fc[600]:=4;Fc[601]:=1;Fc[602]:=2;Fc[603]:=7;Fc[604]:=6;
+ DessineObjet;
+ k:=1;
+ for p_=t:
+ if color p_:
+ p_=Sommet[k];
+ k:=k+1;
+ fi
+ endfor;
+ );
+pavev
+enddef;
+
+vardef Pave(text t)(expr aa,bb,cc)=
+ picture pave;
+ pave=image(
+ NbS:=8;
+ Sommet1:=(aa,0,0);
+ Sommet2:=(aa,bb,0);
+ Sommet3:=(0,bb,0);
+ Sommet4:=(0,0,0);
+ Sommet5:=(0,0,cc);
+ Sommet6:=(aa,0,cc);
+ Sommet7:=(aa,bb,cc);
+ Sommet8:=(0,bb,cc);
+%%Faces
+ NF:=6;
+ Fc[100]:=4;Fc[101]:=4;Fc[102]:=3;Fc[103]:=2;Fc[104]:=1;
+ Fc[200]:=4;Fc[201]:=4;Fc[202]:=5;Fc[203]:=8;Fc[204]:=3;
+ Fc[300]:=4;Fc[301]:=4;Fc[302]:=1;Fc[303]:=6;Fc[304]:=5;
+ Fc[400]:=4;Fc[401]:=5;Fc[402]:=6;Fc[403]:=7;Fc[404]:=8;
+ Fc[500]:=4;Fc[501]:=2;Fc[502]:=3;Fc[503]:=8;Fc[504]:=7;
+ Fc[600]:=4;Fc[601]:=1;Fc[602]:=2;Fc[603]:=7;Fc[604]:=6;
+ DessineObjet;
+ k:=1;
+ for p_=t:
+ if color p_:
+ p_=Sommet[k];
+ k:=k+1;
+ fi
+ endfor;
+ );
+pave
+enddef;
+
+vardef pave(expr aa,bb,cc)=
+ typetrace:="3D";
+ typerepre:="persp";
+ Initialisation(1500,30,20,100);
+ picture PAVE;
+ PAVE=image(
+ NbS:=8;
+ Sommet1:=(aa,0,0);
+ Sommet2:=(aa,bb,0);
+ Sommet3:=(0,bb,0);
+ Sommet4:=(0,0,0);
+ Sommet5:=(0,0,cc);
+ Sommet6:=(aa,0,cc);
+ Sommet7:=(aa,bb,cc);
+ Sommet8:=(0,bb,cc);
+%%Faces
+ NF:=6;
+ Fc[100]:=4;Fc[101]:=4;Fc[102]:=3;Fc[103]:=2;Fc[104]:=1;
+ Fc[200]:=4;Fc[201]:=4;Fc[202]:=5;Fc[203]:=8;Fc[204]:=3;
+ Fc[300]:=4;Fc[301]:=4;Fc[302]:=1;Fc[303]:=6;Fc[304]:=5;
+ Fc[400]:=4;Fc[401]:=5;Fc[402]:=6;Fc[403]:=7;Fc[404]:=8;
+ Fc[500]:=4;Fc[501]:=2;Fc[502]:=3;Fc[503]:=8;Fc[504]:=7;
+ Fc[600]:=4;Fc[601]:=1;Fc[602]:=2;Fc[603]:=7;Fc[604]:=6;
+ DessineObjet;
+ );
+ PAVE
+enddef;
+
+vardef Tetraedrer(text t)=
+ picture tetrar;
+ tetrar=image(
+ %Sommets
+ NbS:=4;
+ Sommet1:=(0,0,1);
+ Sommet2:=(-0.4714045,-0.8164965,-1/3);
+ Sommet3:=(0.942809,0,-1/3);
+ Sommet4:=(-0.4714045,0.8164965,-1/3);
+ %Faces
+ NF:=4;
+ Fc[100]:=3;Fc[101]:=1;Fc[102]:=2;Fc[103]:=3;
+ Fc[200]:=3;Fc[201]:=1;Fc[202]:=3;Fc[203]:=4;
+ Fc[300]:=3;Fc[301]:=1;Fc[302]:=4;Fc[303]:=2;
+ Fc[400]:=3;Fc[401]:=2;Fc[402]:=4;Fc[403]:=3;
+ DessineObjet;
+ k:=1;
+ for p_=t:
+ if color p_:
+ p_=Sommet[k];
+ k:=k+1;
+ fi
+ endfor;
+ );
+ tetrar
+enddef;
+
+endinput;
diff --git a/Master/texmf-dist/metapost/profcollege/PfC-LaTeX.mp b/Master/texmf-dist/metapost/profcollege/PfC-LaTeX.mp
new file mode 100644
index 00000000000..daa206a603d
--- /dev/null
+++ b/Master/texmf-dist/metapost/profcollege/PfC-LaTeX.mp
@@ -0,0 +1,20 @@
+%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[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";
+ write "btex "&s&" etex" to "mptextmp.mp";
+ write EOF to "mptextmp.mp";
+ scantokens "input mptextmp"
+enddef;
diff --git a/Master/texmf-dist/metapost/profcollege/PfC-Svgnames.mp b/Master/texmf-dist/metapost/profcollege/PfC-Svgnames.mp
new file mode 100644
index 00000000000..3af1336dc33
--- /dev/null
+++ b/Master/texmf-dist/metapost/profcollege/PfC-Svgnames.mp
@@ -0,0 +1,156 @@
+%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);
+color Aqua; Aqua = (0,1,1);
+color Aquamarine; Aquamarine = (.498,1,.83);
+color Azure; Azure = (.94,1,1);
+color Beige; Beige = (.96,.96,.864);
+color Bisque; Bisque = (1,.894,.77);
+color Black; Black = (0,0,0);
+color BlanchedAlmond; BlanchedAlmond = (1,.92,.804);
+color Blue; Blue = (0,0,1);
+color BlueViolet; BlueViolet = (.54,.17,.888);
+color Brown; Brown = (.648,.165,.165);
+color BurlyWood; BurlyWood = (.87,.72,.53);
+color CadetBlue; CadetBlue = (.372,.62,.628);
+color Chartreuse; Chartreuse = (.498,1,0);
+color Chocolate; Chocolate = (.824,.41,.116);
+color Coral; Coral = (1,.498,.312);
+color CornflowerBlue; CornflowerBlue = (.392,.585,.93);
+color Cornsilk; Cornsilk = (1,.972,.864);
+color Crimson; Crimson = (.864,.08,.235);
+color Cyan; Cyan = (0,1,1);
+color DarkBlue; DarkBlue = (0,0,.545);
+color DarkCyan; DarkCyan = (0,.545,.545);
+color DarkGoldenrod; DarkGoldenrod = (.72,.525,.044);
+color DarkGray; DarkGray = (.664,.664,.664);
+color DarkGreen; DarkGreen = (0,.392,0);
+color DarkGrey; DarkGrey = (.664,.664,.664);
+color DarkKhaki; DarkKhaki = (.74,.716,.42);
+color DarkMagenta; DarkMagenta = (.545,0,.545);
+color DarkOliveGreen; DarkOliveGreen = (.332,.42,.185);
+color DarkOrange; DarkOrange = (1,.55,0);
+color DarkOrchid; DarkOrchid = (.6,.196,.8);
+color DarkRed; DarkRed = (.545,0,0);
+color DarkSalmon; DarkSalmon = (.912,.59,.48);
+color DarkSeaGreen; DarkSeaGreen = (.56,.736,.56);
+color DarkSlateBlue; DarkSlateBlue = (.284,.24,.545);
+color DarkSlateGray; DarkSlateGray = (.185,.31,.31);
+color DarkSlateGrey; DarkSlateGrey = (.185,.31,.31);
+color DarkTurquoise; DarkTurquoise = (0,.808,.82);
+color DarkViolet; DarkViolet = (.58,0,.828);
+color DeepPink; DeepPink = (1,.08,.576);
+color DeepSkyBlue; DeepSkyBlue = (0,.75,1);
+color DimGray; DimGray = (.41,.41,.41);
+color DimGrey; DimGrey = (.41,.41,.41);
+color DodgerBlue; DodgerBlue = (.116,.565,1);
+color FireBrick; FireBrick = (.698,.132,.132);
+color FloralWhite; FloralWhite = (1,.98,.94);
+color ForestGreen; ForestGreen = (.132,.545,.132);
+color Fuchsia; Fuchsia = (1,0,1);
+color Gainsboro; Gainsboro = (.864,.864,.864);
+color GhostWhite; GhostWhite = (.972,.972,1);
+color Gold; Gold = (1,.844,0);
+color Goldenrod; Goldenrod = (.855,.648,.125);
+color Gray; Gray = (.5,.5,.5);
+color Green; Green = (0,.5,0);
+color GreenYellow; GreenYellow = (.68,1,.185);
+color Grey; Grey = (.5,.5,.5);
+color Honeydew; Honeydew = (.94,1,.94);
+color HotPink; HotPink = (1,.41,.705);
+color IndianRed; IndianRed = (.804,.36,.36);
+color Indigo; Indigo = (.294,0,.51);
+color Ivory; Ivory = (1,1,.94);
+color Khaki; Khaki = (.94,.9,.55);
+color Lavender; Lavender = (.9,.9,.98);
+color LavenderBlush; LavenderBlush = (1,.94,.96);
+color LawnGreen; LawnGreen = (.488,.99,0);
+color LemonChiffon; LemonChiffon = (1,.98,.804);
+color LightBlue; LightBlue = (.68,.848,.9);
+color LightCoral; LightCoral = (.94,.5,.5);
+color LightCyan; LightCyan = (.88,1,1);
+color LightGoldenrod; LightGoldenrod = (.933,.867,.51);
+color LightGoldenrodYellow; LightGoldenrodYellow = (.98,.98,.824);
+color LightGray; LightGray = (.828,.828,.828);
+color LightGreen; LightGreen = (.565,.932,.565);
+color LightGrey; LightGrey = (.828,.828,.828);
+color LightPink; LightPink = (1,.712,.756);
+color LightSalmon; LightSalmon = (1,.628,.48);
+color LightSeaGreen; LightSeaGreen = (.125,.698,.668);
+color LightSkyBlue; LightSkyBlue = (.53,.808,.98);
+color LightSlateBlue; LightSlateBlue = (.518,.44,1);
+color LightSlateGray; LightSlateGray = (.468,.532,.6);
+color LightSlateGrey; LightSlateGrey = (.468,.532,.6);
+color LightSteelBlue; LightSteelBlue = (.69,.77,.87);
+color LightYellow; LightYellow = (1,1,.88);
+color Lime; Lime = (0,1,0);
+color LimeGreen; LimeGreen = (.196,.804,.196);
+color Linen; Linen = (.98,.94,.9);
+color Magenta; Magenta = (1,0,1);
+color Maroon; Maroon = (.5,0,0);
+color MediumAquamarine; MediumAquamarine = (.4,.804,.668);
+color MediumBlue; MediumBlue = (0,0,.804);
+color MediumOrchid; MediumOrchid = (.73,.332,.828);
+color MediumPurple; MediumPurple = (.576,.44,.86);
+color MediumSeaGreen; MediumSeaGreen = (.235,.7,.444);
+color MediumSlateBlue; MediumSlateBlue = (.484,.408,.932);
+color MediumSpringGreen; MediumSpringGreen = (0,.98,.604);
+color MediumTurquoise; MediumTurquoise = (.284,.82,.8);
+color MediumVioletRed; MediumVioletRed = (.78,.084,.52);
+color MidnightBlue; MidnightBlue = (.098,.098,.44);
+color MintCream; MintCream = (.96,1,.98);
+color MistyRose; MistyRose = (1,.894,.884);
+color Moccasin; Moccasin = (1,.894,.71);
+color NavajoWhite; NavajoWhite = (1,.87,.68);
+color Navy; Navy = (0,0,.5);
+color NavyBlue; NavyBlue = (0,0,.5);
+color OldLace; OldLace = (.992,.96,.9);
+color Olive; Olive = (.5,.5,0);
+color OliveDrab; OliveDrab = (.42,.556,.136);
+color Orange; Orange = (1,.648,0);
+color OrangeRed; OrangeRed = (1,.27,0);
+color Orchid; Orchid = (.855,.44,.84);
+color PaleGoldenrod; PaleGoldenrod = (.932,.91,.668);
+color PaleGreen; PaleGreen = (.596,.985,.596);
+color PaleTurquoise; PaleTurquoise = (.688,.932,.932);
+color PaleVioletRed; PaleVioletRed = (.86,.44,.576);
+color PapayaWhip; PapayaWhip = (1,.936,.835);
+color PeachPuff; PeachPuff = (1,.855,.725);
+color Peru; Peru = (.804,.52,.248);
+color Pink; Pink = (1,.752,.796);
+color Plum; Plum = (.868,.628,.868);
+color PowderBlue; PowderBlue = (.69,.88,.9);
+color Purple; Purple = (.5,0,.5);
+color Red; Red = (1,0,0);
+color RosyBrown; RosyBrown = (.736,.56,.56);
+color RoyalBlue; RoyalBlue = (.255,.41,.884);
+color SaddleBrown; SaddleBrown = (.545,.27,.075);
+color Salmon; Salmon = (.98,.5,.448);
+color SandyBrown; SandyBrown = (.956,.644,.376);
+color SeaGreen; SeaGreen = (.18,.545,.34);
+color Seashell; Seashell = (1,.96,.932);
+color Sienna; Sienna = (.628,.32,.176);
+color Silver; Silver = (.752,.752,.752);
+color SkyBlue; SkyBlue = (.53,.808,.92);
+color SlateBlue; SlateBlue = (.415,.352,.804);
+color SlateGray; SlateGray = (.44,.5,.565);
+color SlateGrey; SlateGrey = (.44,.5,.565);
+color Snow; Snow = (1,.98,.98);
+color SpringGreen; SpringGreen = (0,1,.498);
+color SteelBlue; SteelBlue = (.275,.51,.705);
+color Tan; Tan = (.824,.705,.55);
+color Teal; Teal = (0,.5,.5);
+color Thistle; Thistle = (.848,.75,.848);
+color Tomato; Tomato = (1,.39,.28);
+color Turquoise; Turquoise = (.25,.88,.815);
+color Violet; Violet = (.932,.51,.932);
+color VioletRed; VioletRed = (.816,.125,.565);
+color Wheat; Wheat = (.96,.87,.7);
+color White; White = (1,1,1);
+color WhiteSmoke; WhiteSmoke = (.96,.96,.96);
+color Yellow; Yellow = (1,1,0);
+color YellowGreen; YellowGreen = (.604,.804,.196);
+endinput
diff --git a/Master/texmf-dist/tex/latex/profcollege/PfC-EquationComposition1.tex b/Master/texmf-dist/tex/latex/profcollege/PfC-EquationComposition1.tex
new file mode 100644
index 00000000000..b513a6b1163
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/profcollege/PfC-EquationComposition1.tex
@@ -0,0 +1,277 @@
+% 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$.%
+ }{}%
+ }%
+ }%
+ }%
+ }%
+ }%
+ }%
+}%
+
+
diff --git a/Master/texmf-dist/tex/latex/profcollege/PfC-EquationLaurent1.tex b/Master/texmf-dist/tex/latex/profcollege/PfC-EquationLaurent1.tex
new file mode 100644
index 00000000000..347afc0e8d9
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/profcollege/PfC-EquationLaurent1.tex
@@ -0,0 +1,226 @@
+% Licence : Released under the LaTeX Project Public License v1.3c
+% or later, see http://www.latex-project.org/lppl.txtf
+\newcommand{\EquaBaseLaurent}[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*}%
+ \xintifboolexpr{#2=1}{\useKV[ClesEquation]{Lettre}}{\color{Cdecomp}\frac{\cancel{\color{black}\num{#2}}\color{black}\useKV[ClesEquation]{Lettre}}{\cancel{\num{#2}}}}&=\xintifboolexpr{#2=1}{\num{#5}}{\color{Cdecomp}\frac{\color{black}\num{#5}}{\num{#2}}}
+ \xintifboolexpr{#2=1}{}{\\\useKV[ClesEquation]{Lettre}&=\frac{\num{#5}}{\num{#2}}}%\\
+ \ifboolKV[ClesEquation]{Entier}{%
+ \SSimpliTest{#5}{#2}%
+ \ifboolKV[ClesEquation]{Simplification}{%
+ \ifthenelse{\boolean{Simplification}}{\\\useKV[ClesEquation]{Lettre}&=\SSimplifie{#5}{#2}}{}%\\
+ }{}
+ }{}
+ \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{\EquaDeuxLaurent}[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
+ \EquaDeuxLaurent[#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
+ \EquaBaseLaurent[#1]{#2}{}{}{#5}%
+ }{%ax+b=d$ Ici
+ \begin{align*}
+ \xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}\stackMath\Longstack{\tiny\color{Cdecomp}-\num{#3} {}}\stackText}{-\num{\fpeval{0-#3}}\stackMath\Longstack{\tiny\color{Cdecomp}+\num{\fpeval{0-#3}}}\stackText}&=\num{#5}\xintifboolexpr{#3>0}{\stackMath\Longstack{\tiny\color{Cdecomp}-\num{#3} {}}\stackText}{\stackMath\Longstack{\tiny\color{Cdecomp}+\num{\fpeval{0-#3}}}\stackText}\\
+ \xdef\Coeffa{#2}\xdef\Coeffb{\fpeval{#5-#3}}%\\
+ \xintifboolexpr{\Coeffa=1}{\useKV[ClesEquation]{Lettre}}{\color{Cdecomp}\frac{\cancel{\color{black}\num{\Coeffa}}\color{black}\useKV[ClesEquation]{Lettre}}{\cancel{\num{\Coeffa}}}}&=\xintifboolexpr{\Coeffa=1}{\num{\Coeffb}}{\color{Cdecomp}\frac{\color{black}\num{\Coeffb}}{\num{\Coeffa}}}%\\
+ \xintifboolexpr{\Coeffa=1}{}{\\}
+ \xintifboolexpr{\Coeffa=1}{%
+ }{%\ifnum\cmtd>1
+ \useKV[ClesEquation]{Lettre}&=\frac{\num{\Coeffb}}{\num{\Coeffa}}%\\
+ \ifboolKV[ClesEquation]{Entier}{%
+ \SSimpliTest{\Coeffb}{\Coeffa}%
+ \ifboolKV[ClesEquation]{Simplification}{%
+ \ifthenelse{\boolean{Simplification}}{\\\useKV[ClesEquation]{Lettre}&=\SSimplifie{\Coeffb}{\Coeffa}}{}%\\
+ }{}
+ }{}
+ }
+ \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$.
+ }{}
+ }
+ }
+}
+
+\newcommand{\EquaTroisLaurent}[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
+ \EquaTroisLaurent[#1]{#4}{#5}{#2}{}%
+ \fi
+ \else
+ \xintifboolexpr{#2=0}{%b=cx
+ \EquaBaseLaurent[#1]{#4}{}{}{#3}
+ }{%
+ \xintifboolexpr{#4=0}{%ax+b=0
+ \EquaDeuxLaurent[#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*}
+ \xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}\stackMath\Longstack{\tiny\color{Cdecomp}-\num{#3} {}}\stackText}{-\num{\fpeval{0-#3}}\stackMath\Longstack{\tiny\color{Cdecomp}+\num{\fpeval{0-#3}}}\stackText}&=\xintifboolexpr{#4=1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{\stackMath\Longstack{\tiny\color{Cdecomp}-\num{#3} {}}\stackText}{\stackMath\Longstack{\tiny\color{Cdecomp}+\num{\fpeval{0-#3}}}\stackText}\\
+ \xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#4>0}{\stackMath\Longstack{\tiny\color{Cdecomp}-\num{#4}\useKV[ClesEquation]{Lettre} {}}\stackText}{\stackMath\Longstack{\tiny\color{Cdecomp}+\num{\fpeval{0-#4}}\useKV[ClesEquation]{Lettre} {}}\stackText}&=\xintifboolexpr{#4=1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#4>0}{\stackMath\Longstack{\tiny\color{Cdecomp}-\num{#4}\useKV[ClesEquation]{Lettre} {}}\stackText}{\stackMath\Longstack{\tiny\color{Cdecomp}+\num{\fpeval{0-#4}}\useKV[ClesEquation]{Lettre} {}}\stackText}\xintifboolexpr{#3>0}{-\num{#3}}{+\num{\fpeval{0-#3}}}\\
+ \xdef\Coeffa{\fpeval{#2-#4}}\xdef\Coeffb{\fpeval{0-#3}}%\\
+ \xintifboolexpr{\Coeffa=1}{\useKV[ClesEquation]{Lettre}}{\color{Cdecomp}\frac{\cancel{\color{black}\num{\Coeffa}}\color{black}\useKV[ClesEquation]{Lettre}}{\cancel{\num{\Coeffa}}}}&=\xintifboolexpr{\Coeffa=1}{\num{\Coeffb}}{\color{Cdecomp}\frac{\color{black}\num{\Coeffb}}{\num{\Coeffa}}}%\\
+ \xintifboolexpr{\Coeffa=1}{}{\\}
+ \xintifboolexpr{\Coeffa=1}{%
+ }{%\ifnum\cmtd>1
+ \useKV[ClesEquation]{Lettre}&=\frac{\num{\Coeffb}}{\num{\Coeffa}}%\\
+ \ifboolKV[ClesEquation]{Entier}{%
+ \SSimpliTest{\Coeffb}{\Coeffa}%
+ \ifboolKV[ClesEquation]{Simplification}{%
+ \ifthenelse{\boolean{Simplification}}{\\\useKV[ClesEquation]{Lettre}&=\SSimplifie{\Coeffb}{\Coeffa}}{}%\\
+ }{}
+ }{}
+ }
+ \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 avec a<c % Autre cas délicat
+ \begin{align*}%
+ \xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#4>0}{\stackMath\Longstack{\tiny\color{Cdecomp}-\num{#4}\useKV[ClesEquation]{Lettre} {}}\stackText}{\stackMath\Longstack{\tiny\color{Cdecomp}+\num{\fpeval{0-#4}}\useKV[ClesEquation]{Lettre} {}}\stackText}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}&=\xintifboolexpr{#4=1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#4>0}{\stackMath\Longstack{\tiny\color{Cdecomp}-\num{#4}\useKV[ClesEquation]{Lettre} {}}\stackText}{\stackMath\Longstack{\tiny\color{Cdecomp}+\num{\fpeval{0-#4}}\useKV[ClesEquation]{Lettre} {}}\stackText}\\
+ \xdef\Coeffa{\fpeval{#2-#4}}\xdef\Coeffb{\fpeval{0-#3}}%\\
+ \xintifboolexpr{\Coeffa=1}{}{\num{\Coeffa}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}\stackMath\Longstack{\tiny\color{Cdecomp}-\num{#3} {}}\stackText}{-\num{\fpeval{0-#3}}\stackMath\Longstack{\tiny\color{Cdecomp}+\num{\fpeval{0-#3}}}\stackText}&=0\xintifboolexpr{#3>0}{\stackMath\Longstack{\tiny\color{Cdecomp}-\num{#3} {}}\stackText}{\stackMath\Longstack{\tiny\color{Cdecomp}+\num{\fpeval{0-#3}}}\stackText}\\
+ \xintifboolexpr{\Coeffa=1}{\useKV[ClesEquation]{Lettre}}{\color{Cdecomp}\frac{\cancel{\color{black}\num{\Coeffa}}\color{black}\useKV[ClesEquation]{Lettre}}{\cancel{\num{\Coeffa}}}}&=\xintifboolexpr{\Coeffa=1}{\num{\Coeffb}}{\color{Cdecomp}\frac{\color{black}\num{\Coeffb}}{\num{\Coeffa}}}%\\
+ \xintifboolexpr{\Coeffa=1}{}{\\}
+ \xintifboolexpr{\Coeffa=1}{%
+ }{%\ifnum\cmtd>1
+ \useKV[ClesEquation]{Lettre}&=\frac{\num{\Coeffb}}{\num{\Coeffa}}%\\
+ \ifboolKV[ClesEquation]{Entier}{%
+ \SSimpliTest{\Coeffb}{\Coeffa}%
+ \ifboolKV[ClesEquation]{Simplification}{%
+ \ifthenelse{\boolean{Simplification}}{\\\useKV[ClesEquation]{Lettre}&=\SSimplifie{\Coeffb}{\Coeffa}}{}%\\
+ }{}
+ }{}
+ }
+ \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{\ResolEquationLaurent}[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
+ \EquaDeuxLaurent[#1]{#4}{#5}{}{#3}%
+ }%
+ }{%
+ \xintifboolexpr{#4=0}{%ax+b=0x+d
+ \EquaDeuxLaurent[#1]{#2}{#3}{}{#5}%
+ }
+ {%ax+b=cx+d
+ \xintifboolexpr{#3=0}{%
+ \xintifboolexpr{#5=0}{%ax=cx
+ \EquaTroisLaurent[#1]{#2}{0}{#4}{}%
+ }%
+ {%ax=cx+d
+ \EquaTroisLaurent[#1]{#4}{#5}{#2}{}%
+ }%
+ }%
+ {\xintifboolexpr{#5=0}{%ax+b=cx
+ \EquaTroisLaurent[#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*}
+ \xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}\stackMath\Longstack{\tiny\color{Cdecomp}-\num{#3} {}}\stackText}{-\num{\fpeval{0-#3}}\stackMath\Longstack{\tiny\color{Cdecomp}+\num{\fpeval{0-#3}}}\stackText}&=\xintifboolexpr{#4=1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#5>0}{+\num{#5}}{-\num{\fpeval{0-#5}}}\xintifboolexpr{#3>0}{\stackMath\Longstack{\tiny\color{Cdecomp}-\num{#3} {}}\stackText}{\stackMath\Longstack{\tiny\color{Cdecomp}+\num{\fpeval{0-#3}}}\stackText}\\
+ \xdef\Coeffa{\fpeval{#2-#4}}\xdef\Coeffb{\fpeval{#5-#3}}%\\
+ \xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#4>0}{\stackMath\Longstack{\tiny\color{Cdecomp}-\num{#4}\useKV[ClesEquation]{Lettre} {}}\stackText}{\stackMath\Longstack{\tiny\color{Cdecomp}+\num{\fpeval{0-#4}}\useKV[ClesEquation]{Lettre} {}}\stackText}&=\xintifboolexpr{#4=1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#4>0}{\stackMath\Longstack{\tiny\color{Cdecomp}-\num{#4}\useKV[ClesEquation]{Lettre} {}}\stackText}{\stackMath\Longstack{\tiny\color{Cdecomp}+\num{\fpeval{0-#4}}\useKV[ClesEquation]{Lettre} {}}\stackText}\xintifboolexpr{\Coeffb>0}{+\num{\Coeffb}}{-\num{\fpeval{0-\Coeffb}}}\\
+ \xintifboolexpr{\Coeffa=1}{\useKV[ClesEquation]{Lettre}}{\color{Cdecomp}\frac{\cancel{\color{black}\num{\Coeffa}}\color{black}\useKV[ClesEquation]{Lettre}}{\cancel{\num{\Coeffa}}}}&=\xintifboolexpr{\Coeffa=1}{\num{\Coeffb}}{\color{Cdecomp}\frac{\color{black}\num{\Coeffb}}{\num{\Coeffa}}}%\\
+ \xintifboolexpr{\Coeffa=1}{}{\\}
+ \xintifboolexpr{\Coeffa=1}{%
+ }{%\ifnum\cmtd>1
+ \useKV[ClesEquation]{Lettre}&=\frac{\num{\Coeffb}}{\num{\Coeffa}}%\\
+ \ifboolKV[ClesEquation]{Entier}{%
+ \SSimpliTest{\Coeffb}{\Coeffa}%
+ \ifboolKV[ClesEquation]{Simplification}{%
+ \ifthenelse{\boolean{Simplification}}{\\\useKV[ClesEquation]{Lettre}&=\SSimplifie{\Coeffb}{\Coeffa}}{}%\\
+ }{}
+ }{}
+ }
+ \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*}%
+ \xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}\xintifboolexpr{#3>0}{\stackMath\Longstack{\tiny\color{Cdecomp}-\num{#3} {}}\stackText}{\stackMath\Longstack{\tiny\color{Cdecomp}+\num{\fpeval{0-#3}} {}}\stackText}%
+ &=\xintifboolexpr{#4=1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#5>0}{+\num{#5}}{-\num{\fpeval{0-#5}}}\xintifboolexpr{#3>0}{\stackMath\Longstack{\tiny\color{Cdecomp}-\num{#3} {}}\stackText}{\stackMath\Longstack{\tiny\color{Cdecomp}+\num{\fpeval{0-#3}} {}}\stackText}
+ \\
+ \xdef\Coeffa{\fpeval{#2-#4}}\xdef\Coeffb{\fpeval{#5-#3}}%\\
+ \xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#4>0}{\stackMath\Longstack{\tiny\color{Cdecomp}-\num{#4}\useKV[ClesEquation]{Lettre} {}}\stackText}{\stackMath\Longstack{\tiny\color{Cdecomp}+\num{\fpeval{0-#4}}\useKV[ClesEquation]{Lettre} {}}\stackText}&=\xintifboolexpr{#4=1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#4>0}{\stackMath\Longstack{\tiny\color{Cdecomp}-\num{#4}\useKV[ClesEquation]{Lettre} {}}\stackText}{\stackMath\Longstack{\tiny\color{Cdecomp}+\num{\fpeval{0-#4}}\useKV[ClesEquation]{Lettre} {}}\stackText}\xintifboolexpr{\Coeffb>0}{+\num{\Coeffb}}{-\num{\fpeval{0-\Coeffb}}}\\
+ \xintifboolexpr{\Coeffa=1}{\useKV[ClesEquation]{Lettre}}{\color{Cdecomp}\frac{\cancel{\color{black}\num{\Coeffa}}\color{black}\useKV[ClesEquation]{Lettre}}{\cancel{\num{\Coeffa}}}}&=\xintifboolexpr{\Coeffa=1}{\num{\Coeffb}}{\color{Cdecomp}\frac{\color{black}\num{\Coeffb}}{\num{\Coeffa}}}%\\
+ \xintifboolexpr{\Coeffa=1}{}{\\}
+ \xintifboolexpr{\Coeffa=1}{%
+ }{%\ifnum\cmtd>1
+ \useKV[ClesEquation]{Lettre}&=\frac{\num{\Coeffb}}{\num{\Coeffa}}%\\
+ \ifboolKV[ClesEquation]{Entier}{%
+ \SSimpliTest{\Coeffb}{\Coeffa}%
+ \ifboolKV[ClesEquation]{Simplification}{%
+ \ifthenelse{\boolean{Simplification}}{\\\useKV[ClesEquation]{Lettre}&=\SSimplifie{\Coeffb}{\Coeffa}}{}%\\
+ }{}
+ }{}
+ }
+ \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$.%
+ }{}%
+ }%
+ }%
+ }%
+ }%
+ }%
+ }%
+}% \ No newline at end of file
diff --git a/Master/texmf-dist/tex/latex/profcollege/PfC-EquationPose1.tex b/Master/texmf-dist/tex/latex/profcollege/PfC-EquationPose1.tex
new file mode 100644
index 00000000000..e34d382a588
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/profcollege/PfC-EquationPose1.tex
@@ -0,0 +1,246 @@
+% Licence : Released under the LaTeX Project Public License v1.3c
+% or later, see http://www.latex-project.org/lppl.txtf
+\newcommand{\EquaBaseL}[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...
+ \EquaBaseL[#1]{#4}{}{}{#3}
+ \else
+ % si non, on est dans le cas ax=d
+ \xintifboolexpr{#2=0}{%
+ \xintifboolexpr{#5=0}{%
+ L'équation $0\useKV[ClesEquation]{Lettre}=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*}%
+ \xintifboolexpr{#2=1}{\useKV[ClesEquation]{Lettre}}{\num{#2}\useKV[ClesEquation]{Lettre}}&=\num{#5}\\
+ \xintifboolexpr{#2=1}{}{%
+ \mathcolor{Cdecomp}{\mathrel{\div}\xintifboolexpr{#2<0}{(\num{#2})}{\num{#2}}}\phantom{\useKV[ClesEquation]{Lettre}}&\phantom{=}\mathcolor{Cdecomp}{\mathrel{\div}\xintifboolexpr{#2<0}{(\num{#2})}{\num{#2}}}\\}
+ \useKV[ClesEquation]{Lettre}&=\frac{\num{#5}}{\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{\EquaDeuxL}[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
+ \EquaDeuxL[#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
+ \EquaBaseL[#1]{#2}{}{}{#5}%
+ }{%ax+b=d$ Ici
+ \begin{align*}
+ \xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}&=\num{#5}\\
+ \phantom{\xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}}\mathcolor{Cdecomp}{\xintifboolexpr{#3>0}{-\num{#3}}{+\num{\fpeval{0-#3}}}}&\phantom{\mathrel{=}}\mathcolor{Cdecomp}{\xintifboolexpr{#3>0}{-\num{#3}}{+\num{\fpeval{0-#3}}}}\\
+ \xdef\Coeffa{#2}\xdef\Coeffb{\fpeval{#5-#3}}\xintifboolexpr{\Coeffa=1}{}{\num{\Coeffa}}\useKV[ClesEquation]{Lettre}\phantom{\xintifboolexpr{#3>0}{{}+{}\num{#3}}{{}-{}\num{\fpeval{0-#3}}}}&=\num{\Coeffb}%\\
+ \xintifboolexpr{\Coeffa=1}{}{\\}
+ \xintifboolexpr{\Coeffa=1}{%
+ }{%\ifnum\cmtd>1
+ \mathcolor{Cdecomp}{\mathrel{\div}\xintifboolexpr{#2<0}{(\num{#2})}{\num{#2}}}\phantom{\useKV[ClesEquation]{Lettre}}\phantom{\xintifboolexpr{#3>0}{{}+{}\num{#3}}{{}-{}\num{\fpeval{0-#3}}}}&\phantom{=}\mathcolor{Cdecomp}{\mathrel{\div}\xintifboolexpr{#2<0}{(\num{#2})}{\num{#2}}}\\
+ \useKV[ClesEquation]{Lettre}\phantom{\xintifboolexpr{#3>0}{{}+{}\num{#3}}{{}-{}\num{\fpeval{0-#3}}}}&=\frac{\num{\Coeffb}}{\num{\Coeffa}}%\\
+ }
+ \ifboolKV[ClesEquation]{Entier}{%
+ \SSimpliTest{\Coeffb}{\Coeffa}%
+ \ifboolKV[ClesEquation]{Simplification}{%
+ \ifthenelse{\boolean{Simplification}}{%
+ \\\useKV[ClesEquation]{Lettre}\phantom{\xintifboolexpr{#3>0}{{}+{}\num{#3}}{{}-{}\num{\fpeval{0-#3}}}}&=\SSimplifie{\Coeffb}{\Coeffa}%
+ }{}%\\
+ }{}
+ }{}
+ \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{\EquaTroisL}[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
+ \EquaTroisL[#1]{#4}{#5}{#2}{}%
+ \fi
+ \else
+ \xintifboolexpr{#2=0}{%b=cx
+ \EquaBaseL[#1]{#4}{}{}{#3}
+ }{%
+ \xintifboolexpr{#4=0}{%ax+b=0
+ \EquaDeuxL[#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*}
+ \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}\\
+ \mathcolor{Cdecomp}{\xintifboolexpr{#4>0}{{}-{}\num{#4}\useKV[ClesEquation]{Lettre}}{{}+{}\num{\fpeval{0-#4}}\useKV[ClesEquation]{Lettre}}}\phantom{\xintifboolexpr{#3>0}{{}+{}\num{#3}}{{}-{}\num{\fpeval{0-#3}}}}&\phantom{{}={}}\mathcolor{Cdecomp}{\xintifboolexpr{#4>0}{-\num{#4}\useKV[ClesEquation]{Lettre}}{+\num{\fpeval{0-#4}}\useKV[ClesEquation]{Lettre}}}\\
+ \xdef\Coeffa{\fpeval{#2-#4}}\xintifboolexpr{\Coeffa=1}{}{\num{\Coeffa}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}&=0\\
+ \phantom{\xintifboolexpr{\Coeffa=1}{}{\num{\Coeffa}}\useKV[ClesEquation]{Lettre}}\mathcolor{Cdecomp}{\xintifboolexpr{#3>0}{{}-{}\num{#3}}{{}+{}\num{\fpeval{0-#3}}}}&\phantom{\mathrel{=}}\mathcolor{Cdecomp}{\xintifboolexpr{#3>0}{{}-{}\num{#3}}{{}+{}\num{\fpeval{0-#3}}}}\\
+ \xdef\Coeffb{\fpeval{0-#3}}\xintifboolexpr{\Coeffa=1}{}{\num{\Coeffa}}\useKV[ClesEquation]{Lettre}\phantom{\xintifboolexpr{#3>0}{{}+{}\num{#3}}{{}-{}\num{\fpeval{0-#3}}}}&=\num{\Coeffb}%\\
+ \xintifboolexpr{\Coeffa=1}{}{\\}
+ \xintifboolexpr{\Coeffa=1}{%
+ }{%\ifnum\cmtd>1
+ \mathcolor{Cdecomp}{\mathrel{\div}\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}}\phantom{\useKV[ClesEquation]{Lettre}}\phantom{\xintifboolexpr{#3>0}{{}+{}\num{#3}}{{}-{}\num{\fpeval{0-#3}}}}&\phantom{=}\mathcolor{Cdecomp}{\mathrel{\div}\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}}\\
+ \useKV[ClesEquation]{Lettre}\phantom{\xintifboolexpr{#3>0}{{}+{}\num{#3}}{{}-{}\num{\fpeval{0-#3}}}}&=\frac{\num{\Coeffb}}{\num{\Coeffa}}%\\
+ }
+ \ifboolKV[ClesEquation]{Entier}{%
+ \SSimpliTest{\Coeffb}{\Coeffa}%
+ \ifboolKV[ClesEquation]{Simplification}{%
+ \ifthenelse{\boolean{Simplification}}{\\%
+ \useKV[ClesEquation]{Lettre}\phantom{\xintifboolexpr{#3>0}{{}+{}\num{#3}}{{}-{}\num{\fpeval{0-#3}}}}&=\SSimplifie{\Coeffb}{\Coeffa}%\\
+ }{}
+ }{}
+ }{}
+ \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*}%
+ \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}\\
+ \mathcolor{Cdecomp}{\xintifboolexpr{#2>0}{{}-{}\num{#2}\useKV[ClesEquation]{Lettre}}{{}+{}\num{\fpeval{0-#2}}\useKV[ClesEquation]{Lettre}}}\phantom{\xintifboolexpr{#3>0}{{}+{}\num{#3}}{{}-{}\num{\fpeval{0-#3}}}}&\phantom{{}={}}\mathcolor{Cdecomp}{\xintifboolexpr{#2>0}{{}-{}\num{#2}\useKV[ClesEquation]{Lettre}}{{}+{}\num{\fpeval{0-#2}}\useKV[ClesEquation]{Lettre}}}\\
+ \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}%\\
+ \xintifboolexpr{\Coeffa=1}{}{\\}
+ \xintifboolexpr{\Coeffa=1}{%
+ }{%\ifnum\cmtd>1
+ \mathcolor{Cdecomp}{\mathrel{\div}\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}}&\phantom{=}\mathcolor{Cdecomp}{\mathrel{\div}\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}}\\
+ \frac{\num{\Coeffb}}{\num{\Coeffa}}&=\phantom{\num{\Coeffa}}\useKV[ClesEquation]{Lettre}%\\
+ }
+ \ifboolKV[ClesEquation]{Entier}{%
+ \SSimpliTest{\Coeffb}{\Coeffa}%
+ \ifboolKV[ClesEquation]{Simplification}{%
+ \ifthenelse{\boolean{Simplification}}{\\%
+ \SSimplifie{\Coeffb}{\Coeffa}&=\phantom{\num{\Coeffa}}\useKV[ClesEquation]{Lettre}%\\
+ }{}
+ }{}
+ }{}
+ \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{\ResolEquationL}[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$
+ \EquaDeuxL[#1]{#4}{#5}{}{#3}%
+ }%
+ }{%
+ \xintifboolexpr{#4=0}{%ax+b=0x+d
+ \EquaDeuxL[#1]{#2}{#3}{}{#5}%
+ }
+ {%ax+b=cx+d$
+ \xintifboolexpr{#3=0}{%
+ \xintifboolexpr{#5=0}{%ax=cx
+ \EquaTroisL[#1]{#2}{0}{#4}{}%
+ }%
+ {%ax=cx+d
+ \EquaTroisL[#1]{#4}{#5}{#2}{}%
+ }%
+ }%
+ {\xintifboolexpr{#5=0}{%ax+b=cx
+ \EquaTroisL[#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*}
+ \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}}}\\
+ \mathcolor{Cdecomp}{\xintifboolexpr{#4>0}{{}-{}\num{#4}\useKV[ClesEquation]{Lettre}}{{}+{}\num{\fpeval{0-#4}}\useKV[ClesEquation]{Lettre}}}\phantom{\xintifboolexpr{#3>0}{{}+{}\num{#3}}{{}-{}\num{\fpeval{0-#3}}}}&\mathcolor{Cdecomp}{\xintifboolexpr{#4>0}{{}-{}\num{#4}\useKV[ClesEquation]{Lettre}}{\phantom{{}={}}+{}\num{\fpeval{0-#4}}\useKV[ClesEquation]{Lettre}}}\\
+ \xdef\Coeffa{\fpeval{#2-#4}}\xintifboolexpr{\Coeffa=1}{}{\num{\Coeffa}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}&=\phantom{\xintifboolexpr{#4=1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}}\xintifboolexpr{#5>0}{\phantom{{}+{}}\num{#5}}{-\num{\fpeval{0-#5}}}\\
+ \mathcolor{Cdecomp}{\xintifboolexpr{#3>0}{{}-{}\num{#3}}{{}+{}\num{\fpeval{0-#3}}}}&\phantom{{}={}\xintifboolexpr{#4=1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}}\mathcolor{Cdecomp}{\xintifboolexpr{#3>0}{{}-{}\num{#3}}{{}+{}\num{\fpeval{0-#3}}}}\\
+ \xdef\Coeffb{\fpeval{#5-#3}}\xintifboolexpr{\Coeffa=1}{}{\num{\Coeffa}}\useKV[ClesEquation]{Lettre}\phantom{\xintifboolexpr{#3>0}{{}+{}\num{#3}}{{}-{}\num{\fpeval{0-#3}}}}&=\phantom{\xintifboolexpr{#4=1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}}\xintifboolexpr{\Coeffb>0}{\phantom{{}+{}}\num{\Coeffb}}{{}-{}\num{\fpeval{0-\Coeffb}}}%\\
+ \xintifboolexpr{\Coeffa=1}{}{\\}
+ \xintifboolexpr{\Coeffa=1}{}{%\ifnum\cmtd>1
+ \mathcolor{Cdecomp}{\mathrel{\div}\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}}\phantom{\useKV[ClesEquation]{Lettre}}\phantom{\xintifboolexpr{#3>0}{{}+{}\num{#3}}{{}-{}\num{\fpeval{0-#3}}}}&\phantom{{}={}}\phantom{\xintifboolexpr{#4=1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}}\mathcolor{Cdecomp}{\mathrel{\div}\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}}\\
+ \phantom{\xintifboolexpr{\Coeffa=1}{}{\num{\Coeffa}}}\useKV[ClesEquation]{Lettre}\phantom{\xintifboolexpr{#3>0}{{}+{}\num{#3}}{{}-{}\num{\fpeval{0-#3}}}}&=\phantom{\xintifboolexpr{#4=1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{\Coeffb>0}{{}+{}}{}}\frac{\num{\Coeffb}}{\num{\Coeffa}}%\\
+ }
+ \ifboolKV[ClesEquation]{Entier}{%
+ \SSimpliTest{\Coeffb}{\Coeffa}%
+ \ifboolKV[ClesEquation]{Simplification}{%
+ \ifthenelse{\boolean{Simplification}}{\\%
+ \useKV[ClesEquation]{Lettre}\phantom{\xintifboolexpr{#3>0}{{}+{}\num{#3}}{{}-{}\num{\fpeval{0-#3}}}}&=\phantom{\xintifboolexpr{#4=1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{\Coeffb>0}{{}+{}}{}}\SSimplifie{\Coeffb}{\Coeffa}%\\
+ }{}
+ }{}
+ }{}
+ \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*}%
+ \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}}}\\
+ \mathcolor{Cdecomp}{\xintifboolexpr{#2>0}{{}-{}\num{#2}\useKV[ClesEquation]{Lettre}}{{}+{}\num{\fpeval{0-#2}}\useKV[ClesEquation]{Lettre}}}\phantom{\xintifboolexpr{#3>0}{{}+{}\num{#3}}{{}-{}\num{\fpeval{0-#3}}}}&\xintifboolexpr{#4<0}{\phantom{={}}}{}\mathcolor{Cdecomp}{\xintifboolexpr{#2>0}{{}-{}\num{#2}\useKV[ClesEquation]{Lettre}}{{}+{}\num{\fpeval{0-#2}}\useKV[ClesEquation]{Lettre}}}\\
+ \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}}}\\
+ \mathcolor{Cdecomp}{\xintifboolexpr{#5>0}{{}-{}\num{#5}}{{}+{}\num{\fpeval{0-#5}}}}&\phantom{{}={}\xintifboolexpr{\Coeffa=1}{}{\num{\Coeffa}}\useKV[ClesEquation]{Lettre}}\mathcolor{Cdecomp}{\xintifboolexpr{#5>0}{-\num{#5}}{+\num{\fpeval{0-#5}}}}\\
+ \xdef\Coeffb{\fpeval{#3-#5}}\num{\Coeffb}&=\xintifboolexpr{\Coeffa=1}{}{\num{\Coeffa}}\useKV[ClesEquation]{Lettre}%\\
+ \xintifboolexpr{\Coeffa=1}{}{\\}
+ \xintifboolexpr{\Coeffa=1}{}{%\ifnum\cmtd>1
+ \mathcolor{Cdecomp}{\mathrel{\div}\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}}&\xintifboolexpr{\Coeffa<0}{\phantom{{}={}}}{\phantom{=}}\mathcolor{Cdecomp}{\mathrel{\div}\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}}\\
+ \frac{\num{\Coeffb}}{\num{\Coeffa}}&=\useKV[ClesEquation]{Lettre}%\\
+ }
+ \ifboolKV[ClesEquation]{Entier}{%
+ \SSimpliTest{\Coeffb}{\Coeffa}%
+ \ifboolKV[ClesEquation]{Simplification}{%
+ \ifthenelse{\boolean{Simplification}}{\\\SSimplifie{\Coeffb}{\Coeffa}&=\useKV[ClesEquation]{Lettre}}{}%\\
+ }{}
+ }{}
+ \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$.%
+ }{}%
+ }%
+ }%
+ }%
+ }%
+ }%
+ }%
+}%
diff --git a/Master/texmf-dist/tex/latex/profcollege/PfC-EquationSoustraction1.tex b/Master/texmf-dist/tex/latex/profcollege/PfC-EquationSoustraction1.tex
new file mode 100644
index 00000000000..034aa7e2ed4
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/profcollege/PfC-EquationSoustraction1.tex
@@ -0,0 +1,332 @@
+% 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$.%
+ }{}%
+ }%
+ }%
+ }%
+ }%
+ }%
+ }%
+}%
+
+
diff --git a/Master/texmf-dist/tex/latex/profcollege/PfC-EquationSymbole1.tex b/Master/texmf-dist/tex/latex/profcollege/PfC-EquationSymbole1.tex
new file mode 100644
index 00000000000..4faec4767ae
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/profcollege/PfC-EquationSymbole1.tex
@@ -0,0 +1,225 @@
+% Licence : Released under the LaTeX Project Public License v1.3c
+% or later, see http://www.latex-project.org/lppl.txtf
+\newcommand{\EquaBaseSymbole}[5][]{%type ax=d ou b=cx
+ \useKVdefault[ClesEquation]%
+ \setKV[ClesEquation]{#1}%
+ \setKV[ClesEquation]{Fleches=false,FlecheDiv=false,Terme=false,Decomposition=false}
+ \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...
+ \ifx\bla#4\bla
+ %% il manque un paramètre
+ \else
+ \EquaBaseSymbole[#1]{#4}{}{}{#3}
+ \fi
+ \else
+ % si non, on est dans le cas ax=d
+ \xintifboolexpr{#2=0}{%
+ \xintifboolexpr{#5=0}{%
+ L'équation $0\times\useKV[ClesEquation]{Lettre}=0$ a une infinité de solution.}{L'équation $0\times\useKV[ClesEquation]{Lettre}=\num{#5}$ n'a aucune solution.}%
+ }{%\else
+ \xintifboolexpr{#5=0}{L'équation $\num{#2}\times\useKV[ClesEquation]{Lettre}=0$ a une unique solution : $\useKV[ClesEquation]{Lettre}=0$.}{%\else
+ \begin{align*}%
+ \xintifboolexpr{#2=1}{\useKV[ClesEquation]{Lettre}}{\multido{\i=1+1}{\fpeval{#2-1}}{\useKV[ClesEquation]{Lettre}+}\useKV[ClesEquation]{Lettre}}&=\num{#5}\\
+ \useKV[ClesEquation]{Lettre}&=\frac{\num{#5}}{\num{#2}}%\\
+ \ifboolKV[ClesEquation]{Entier}{%
+ \SSimpliTest{#5}{#2}%
+ \ifboolKV[ClesEquation]{Simplification}{%
+ \ifthenelse{\boolean{Simplification}}{\\\useKV[ClesEquation]{Lettre}&=\SSimplifie{#5}{#2}}{}%\\
+ }{}
+ }{}
+ \end{align*}
+ }
+ }
+ \fi
+}
+
+\newcommand{\EquaDeuxSymbole}[5][]{%type ax+b=d ou b=cx+d$
+ \useKVdefault[ClesEquation]%
+ \setKV[ClesEquation]{#1}%
+ \setKV[ClesEquation]{Fleches=false,FlecheDiv=false,Terme=false,Decomposition=false}
+ \ifx\bla#2\bla%On échange en faisant attention à ne pas boucler : c doit être non vide
+ \EquaDeuxSymbole[#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
+ \EquaBaseSymbole[#1]{#2}{}{}{#5}%
+ }{%ax+b=d$ Ici
+ \begin{align*}
+ \xintifboolexpr{#2=1}{\useKV[ClesEquation]{Lettre}}{\multido{\i=1+1}{\fpeval{#2-1}}{\useKV[ClesEquation]{Lettre}+}\useKV[ClesEquation]{Lettre}}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}&=\num{#5}\\
+ \ifboolKV[ClesEquation]{Bloc}{\Fdash{$\xintifboolexpr{#2=1}{\useKV[ClesEquation]{Lettre}}{\multido{\i=1+1}{\fpeval{#2-1}}{\useKV[ClesEquation]{Lettre}+}\useKV[ClesEquation]{Lettre}}$}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}&=\num{#5}\\}{}%
+ \xdef\Coeffa{#2}\xdef\Coeffb{\fpeval{#5-#3}}\xintifboolexpr{\Coeffa=1}{\useKV[ClesEquation]{Lettre}}{\multido{\i=1+1}{\fpeval{#2-1}}{\useKV[ClesEquation]{Lettre}+}\useKV[ClesEquation]{Lettre}}&=\num{\Coeffb}%\\
+ \xintifboolexpr{\Coeffa=1}{%
+ }{%\ifnum\cmtd>1
+ \\
+ \useKV[ClesEquation]{Lettre}&=\frac{\num{\Coeffb}}{\num{\Coeffa}}%\\
+ \ifboolKV[ClesEquation]{Entier}{%
+ \SSimpliTest{\Coeffb}{\Coeffa}%
+ \ifboolKV[ClesEquation]{Simplification}{%
+ \ifthenelse{\boolean{Simplification}}{\\\useKV[ClesEquation]{Lettre}&=\SSimplifie{\Coeffb}{\Coeffa}}{}%\\
+ }{}
+ }{}
+ }
+ \end{align*}
+ }
+ }
+ \fi
+}
+
+\newcommand{\EquaTroisSymbole}[5][]{%ax+b=cx ou ax=cx+d
+ \useKVdefault[ClesEquation]%
+ \setKV[ClesEquation]{#1}%
+ \setKV[ClesEquation]{Fleches=false,FlecheDiv=false,Terme=false,Decomposition=false}
+ \ifx\bla#3\bla%on inverse en faisant attention à la boucle #3<->#5
+ \ifx\bla#5\bla%
+ %% paramètre oublié
+ \else
+ \EquaTroisSymbole[#1]{#4}{#5}{#2}{}%
+ \fi
+ \else
+ \xintifboolexpr{#2=0}{%b=cx
+ \EquaBaseSymbole[#1]{#4}{}{}{#3}
+ }{%
+ \xintifboolexpr{#4=0}{%ax+b=0
+ \EquaDeuxSymbole[#1]{#2}{#3}{}{0}
+ }{%ax+b=cx
+ \xintifboolexpr{#2=#4}{%
+ \xintifboolexpr{#3=0}{%ax=ax
+ L'équation $\multido{\i=1+1}{\fpeval{#2-1}}{\useKV[ClesEquation]{Lettre}+}\useKV[ClesEquation]{Lettre}=\multido{\i=1+1}{\fpeval{#2-1}}{\useKV[ClesEquation]{Lettre}+}\useKV[ClesEquation]{Lettre}$ a une infinité de solution.}%
+ {%ax+b=ax
+ L'équation $\multido{\i=1+1}{\fpeval{#2-1}}{\useKV[ClesEquation]{Lettre}+}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}=\multido{\i=1+1}{\fpeval{#2-1}}{\useKV[ClesEquation]{Lettre}+}\useKV[ClesEquation]{Lettre}$ n'a aucune solution.%
+ }%
+ }{%% Cas délicat
+ \xintifboolexpr{#2>#4}{%ax+b=cx avec a>c
+ \begin{align*}
+ \multido{\i=1+1}{\fpeval{#2-1}}{\useKV[ClesEquation]{Lettre}+}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}&=\multido{\i=1+1}{\fpeval{#4-1}}{\useKV[ClesEquation]{Lettre}+}\useKV[ClesEquation]{Lettre}\\
+ \mathcolor{Csymbole}{\useKV[ClesEquation]{Lettre}\multido{\i=1+1}{\fpeval{#4-1}}{+\useKV[ClesEquation]{Lettre}}}\multido{\i=1+1}{\fpeval{#2-#4}}{+\useKV[ClesEquation]{Lettre}}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}&=\mathcolor{Csymbole}{\multido{\i=1+1}{\fpeval{#4-1}}{\useKV[ClesEquation]{Lettre}+}\useKV[ClesEquation]{Lettre}}\\
+ \xdef\Coeffa{\fpeval{#2-#4}}\multido{\i=1+1}{\fpeval{\Coeffa-1}}{\useKV[ClesEquation]{Lettre}+}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}&=0\\
+ \ifboolKV[ClesEquation]{Bloc}{\Fdash{\mathcolor{Csymbole!30}{$\multido{\i=1+1}{\fpeval{\Coeffa-1}}{\useKV[ClesEquation]{Lettre}+}\useKV[ClesEquation]{Lettre}$}}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}&=0\\}{}
+ \xdef\Coeffb{\fpeval{0-#3}}\multido{\i=1+1}{\fpeval{\Coeffa-1}}{\useKV[ClesEquation]{Lettre}+}\useKV[ClesEquation]{Lettre}&=\num{\Coeffb}%\\
+ \xintifboolexpr{\Coeffa=1}{}{%\ifnum\cmtd>1
+ \\\useKV[ClesEquation]{Lettre}&=\frac{\num{\Coeffb}}{\num{\Coeffa}}%\\
+ \ifboolKV[ClesEquation]{Entier}{%
+ \SSimpliTest{\Coeffb}{\Coeffa}%
+ \ifboolKV[ClesEquation]{Simplification}{%
+ \ifthenelse{\boolean{Simplification}}{\\\useKV[ClesEquation]{Lettre}&=\SSimplifie{\Coeffb}{\Coeffa}}{}%\\
+ }{}
+ }{}
+ }
+ \end{align*}
+ }{%ax+b=cx+d avec a<c % Autre cas délicat
+ \begin{align*}%
+ \multido{\i=1+1}{\fpeval{#2-1}}{\useKV[ClesEquation]{Lettre}+}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}&=\multido{\i=1+1}{\fpeval{#4-1}}{\useKV[ClesEquation]{Lettre}+}\useKV[ClesEquation]{Lettre}\\
+ \mathcolor{Csymbole}{\useKV[ClesEquation]{Lettre}\multido{\i=1+1}{\fpeval{#2-1}}{+\useKV[ClesEquation]{Lettre}}}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}&=\mathcolor{Csymbole}{\useKV[ClesEquation]{Lettre}\multido{\i=1+1}{\fpeval{#2-1}}{+\useKV[ClesEquation]{Lettre}}}\multido{\i=1+1}{\fpeval{#4-#2}}{+\useKV[ClesEquation]{Lettre}}\\
+ \xdef\Coeffb{#3}\xdef\Coeffa{\fpeval{#4-#2}}\xintifboolexpr{#3>0}{\num{#3}}{-\num{\fpeval{0-#3}}}&=\multido{\i=1+1}{\fpeval{\Coeffa-1}}{\useKV[ClesEquation]{Lettre}+}\useKV[ClesEquation]{Lettre}% \\
+ \xintifboolexpr{\Coeffa=1}{}{%\ifnum\cmtd>1
+ \\\frac{\num{\Coeffb}}{\num{\Coeffa}}&=\useKV[ClesEquation]{Lettre}%\\
+ \ifboolKV[ClesEquation]{Entier}{%
+ \SSimpliTest{\Coeffb}{\Coeffa}%
+ \ifboolKV[ClesEquation]{Simplification}{%
+ \ifthenelse{\boolean{Simplification}}{\\\SSimplifie{\Coeffb}{\Coeffa}&=\useKV[ClesEquation]{Lettre}}{}%\\
+ }{}
+ }{}
+ }
+ \end{align*}
+ }%
+ }%
+ }%
+ }%
+ \fi
+ }%
+
+
+\newcommand{\ResolEquationSymbole}[5][]{%
+ \useKVdefault[ClesEquation]%
+ \setKV[ClesEquation]{#1}%
+ \setKV[ClesEquation]{Fleches=false,FlecheDiv=false,Terme=false,Decomposition=false}
+ \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$
+ \EquaDeuxSymbole[#1]{#4}{#5}{#2}{#3}%
+ }%
+ }{%
+ \xintifboolexpr{#4=0}{%ax+b=0x+d
+ \EquaDeuxSymbole[#1]{#2}{#3}{}{#5}%
+ }
+ {%ax+b=cx+d$
+ \xintifboolexpr{#3=0}{%
+ \xintifboolexpr{#5=0}{%ax=cx
+ \EquaTroisSymbole[#1]{#2}{0}{#4}{}%
+ }%
+ {%ax=cx+d
+ \EquaTroisSymbole[#1]{#4}{#5}{#2}{}%
+ }%
+ }%
+ {\xintifboolexpr{#5=0}{%ax+b=cx
+ \EquaTroisSymbole[#1]{#2}{#3}{#4}{}%
+ }%
+ {%ax+b=cx+d -- ici
+ \xintifboolexpr{#2=#4}{%
+ \xintifboolexpr{#3=#5}{%b=d
+ L'équation $\multido{\i=1+1}{\fpeval{#2-1}}{\useKV[ClesEquation]{Lettre}+}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}=\multido{\i=1+1}{\fpeval{#4-1}}{\useKV[ClesEquation]{Lettre}+}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#5>0}{+\num{#5}}{-\num{\fpeval{0-#5}}}$ a une infinité de solution.}%
+ {%b<>d
+ L'équation $\multido{\i=1+1}{\fpeval{#2-1}}{\useKV[ClesEquation]{Lettre}+}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}=\multido{\i=1+1}{\fpeval{#4-1}}{\useKV[ClesEquation]{Lettre}+}\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*}
+ \multido{\i=1+1}{\fpeval{#2-1}}{\useKV[ClesEquation]{Lettre}+}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}&=\multido{\i=1+1}{\fpeval{#4-1}}{\useKV[ClesEquation]{Lettre}+}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#5>0}{+\num{#5}}{-\num{\fpeval{0-#5}}}\\
+ \mathcolor{Csymbole}{\useKV[ClesEquation]{Lettre}\multido{\i=1+1}{\fpeval{#4-1}}{+\useKV[ClesEquation]{Lettre}}}\multido{\i=1+1}{\fpeval{#2-#4}}{+\useKV[ClesEquation]{Lettre}}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}&=\mathcolor{Csymbole}{\multido{\i=1+1}{\fpeval{#4-1}}{\useKV[ClesEquation]{Lettre}+}\useKV[ClesEquation]{Lettre}}\xintifboolexpr{#5>0}{+\num{#5}}{-\num{\fpeval{0-#5}}}\\
+ \xdef\Coeffa{\fpeval{#2-#4}}\useKV[ClesEquation]{Lettre}\multido{\i=1+1}{\fpeval{\Coeffa-1}}{+\useKV[ClesEquation]{Lettre}}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}&=\num{#5}\\
+ \ifboolKV[ClesEquation]{Bloc}{%
+ \Fdash{$\mathcolor{Csymbole!30}{\useKV[ClesEquation]{Lettre}\multido{\i=1+1}{\fpeval{\Coeffa-1}}{+\useKV[ClesEquation]{Lettre}}}$}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}&=\num{#5}\\
+ }{}%
+ \xdef\Coeffb{\fpeval{#5-#3}}\useKV[ClesEquation]{Lettre}\multido{\i=1+1}{\fpeval{\Coeffa-1}}{+\useKV[ClesEquation]{Lettre}}&=\num{\Coeffb}%\\
+ \xintifboolexpr{\Coeffa=1}{}{%\ifnum\cmtd>1
+ \\\useKV[ClesEquation]{Lettre}&=\frac{\num{\Coeffb}}{\num{\Coeffa}}\tikzmark{H-\theNbequa}%\\
+ \ifboolKV[ClesEquation]{Entier}{%
+ \SSimpliTest{\Coeffb}{\Coeffa}%
+ \ifboolKV[ClesEquation]{Simplification}{%
+ \ifthenelse{\boolean{Simplification}}{\\\useKV[ClesEquation]{Lettre}&=\SSimplifie{\Coeffb}{\Coeffa}}{}%\\
+ }{}
+ }{}
+ }
+ \end{align*}
+ }{%ax+b=cx+d avec a<c % Autre cas délicat
+ \begin{align*}%
+ \multido{\i=1+1}{\fpeval{#2-1}}{\useKV[ClesEquation]{Lettre}+}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}&=\multido{\i=1+1}{\fpeval{#4-1}}{\useKV[ClesEquation]{Lettre}+}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#5>0}{+\num{#5}}{-\num{\fpeval{0-#5}}}\\
+ \mathcolor{Csymbole}{\multido{\i=1+1}{\fpeval{#2-1}}{\useKV[ClesEquation]{Lettre}+}\useKV[ClesEquation]{Lettre}}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}&=\mathcolor{Csymbole}{\useKV[ClesEquation]{Lettre}\multido{\i=1+1}{\fpeval{#2-1}}{+\useKV[ClesEquation]{Lettre}}}\multido{\i=1+1}{\fpeval{#4-#2}}{+\useKV[ClesEquation]{Lettre}}\xintifboolexpr{#5>0}{+\num{#5}}{-\num{\fpeval{0-#5}}}\\
+ \xdef\Coeffa{\fpeval{#4-#2}}\num{#3}&=\useKV[ClesEquation]{Lettre}\multido{\i=1+1}{\fpeval{\Coeffa-1}}{+\useKV[ClesEquation]{Lettre}}\xintifboolexpr{#5>0}{+\num{#5}}{-\num{\fpeval{0-#5}}}\\
+ \ifboolKV[ClesEquation]{Bloc}{%
+ \num{#3}&=\Fdash{$\mathcolor{Csymbole!30}{\useKV[ClesEquation]{Lettre}\multido{\i=1+1}{\fpeval{\Coeffa-1}}{+\useKV[ClesEquation]{Lettre}}}$}\xintifboolexpr{#5>0}{+\num{#5}}{-\num{\fpeval{0-#5}}}\\
+ }{}%
+ \xdef\Coeffb{\fpeval{#3-#5}}\num{\Coeffb}&=\useKV[ClesEquation]{Lettre}\multido{\i=1+1}{\fpeval{\Coeffa-1}}{+\useKV[ClesEquation]{Lettre}}%\\
+ \xintifboolexpr{\Coeffa=1}{}{%\ifnum\cmtd>1
+ \\\frac{\num{\Coeffb}}{\num{\Coeffa}}&=\useKV[ClesEquation]{Lettre}%\\
+ \ifboolKV[ClesEquation]{Entier}{%
+ \SSimpliTest{\Coeffb}{\Coeffa}%
+ \ifboolKV[ClesEquation]{Simplification}{%
+ \ifthenelse{\boolean{Simplification}}{\\\SSimplifie{\Coeffb}{\Coeffa}&=\useKV[ClesEquation]{Lettre}}{}%\\
+ }{}
+ }{}
+ }
+ \end{align*}
+ }%
+ }%
+ }%
+ }%
+ }%
+ }%
+}%
+
+
diff --git a/Master/texmf-dist/tex/latex/profcollege/PfC-EquationTerme1.tex b/Master/texmf-dist/tex/latex/profcollege/PfC-EquationTerme1.tex
new file mode 100644
index 00000000000..f3930d0408b
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/profcollege/PfC-EquationTerme1.tex
@@ -0,0 +1,276 @@
+% Licence : Released under the LaTeX Project Public License v1.3c
+% or later, see http://www.latex-project.org/lppl.txtf
+\newcommand{\EquaDeuxTerme}[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
+ \EquaDeuxTerme[#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{Cterme}{\useKV[ClesEquation]{CouleurTerme}}}{}
+ \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}\\
+ \xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}&=\num{#5}\mathcolor{Cterme}{\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{\EquaTroisTerme}[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
+ \EquaTroisTerme[#1]{#4}{#5}{#2}{}%
+ \fi
+ \else
+ \xintifboolexpr{#2=0}{%b=cx
+ \EquaBase[#1]{#4}{}{}{#3}
+ }{%
+ \xintifboolexpr{#4=0}{%ax+b=0
+ \EquaDeuxTerme[#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{Cterme}{\useKV[ClesEquation]{CouleurTerme}}}{}
+ \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}\\
+ \xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\mathcolor{Cterme}{\xintifboolexpr{#4>0}{-\num{#4}\useKV[ClesEquation]{Lettre}}{+\num{\fpeval{0-#4}}\useKV[ClesEquation]{Lettre}}}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}&=0\\
+ \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}\\
+ \xintifboolexpr{\Coeffa=1}{}{\num{\Coeffa}}\useKV[ClesEquation]{Lettre}&=0\mathcolor{Cterme}{\xintifboolexpr{#3>0}{-\num{#3}}{+\num{\fpeval{0-#3}}}}\\
+ \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{Cterme}{\useKV[ClesEquation]{CouleurTerme}}}{}
+ \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}\\
+ \xintifboolexpr{#3>0}{\num{#3}}{-\num{\fpeval{0-#3}}}&=\xintifboolexpr{#4=1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}\mathcolor{Cterme}{\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{\ResolEquationTerme}[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$
+ \EquaDeuxTerme[#1]{#4}{#5}{#2}{#3}%
+ }%
+ }{%
+ \xintifboolexpr{#4=0}{%ax+b=0x+d
+ \EquaDeuxTerme[#1]{#2}{#3}{}{#5}%
+ }
+ {%ax+b=cx+d$
+ \xintifboolexpr{#3=0}{%
+ \xintifboolexpr{#5=0}{%ax=cx
+ \EquaTroisTerme[#1]{#2}{0}{#4}{}%
+ }%
+ {%ax=cx+d
+ \EquaTroisTerme[#1]{#4}{#5}{#2}{}%
+ }%
+ }%
+ {\xintifboolexpr{#5=0}{%ax+b=cx
+ \EquaTroisTerme[#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{Cterme}{\useKV[ClesEquation]{CouleurTerme}}}{}
+ \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}\\
+ \xintifboolexpr{#2=1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\mathcolor{Cterme}{\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{#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}\tikzmark{F-\theNbequa}\\
+ \xintifboolexpr{\Coeffa=1}{}{\num{\Coeffa}}\useKV[ClesEquation]{Lettre}&=\num{#5}\mathcolor{Cterme}{\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{Cterme}{\useKV[ClesEquation]{CouleurTerme}}}{}
+ \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}\\
+ \xintifboolexpr{#3>0}{\num{#3}}{-\num{\fpeval{0-#3}}}&=\xintifboolexpr{#4=1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}\mathcolor{Cterme}{\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}\\
+ \num{#3}\mathcolor{Cterme}{\xintifboolexpr{#5>0}{-\num{#5}}{+\num{\fpeval{0-#5}}}}&=\xintifboolexpr{\Coeffa=1}{}{\num{\Coeffa}}\useKV[ClesEquation]{Lettre}\\
+ \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$.%
+ }{}%
+ }%
+ }%
+ }%
+ }%
+ }%
+ }%
+}%
+
+
diff --git a/Master/texmf-dist/tex/latex/profcollege/ProfCollege.sty b/Master/texmf-dist/tex/latex/profcollege/ProfCollege.sty
new file mode 100644
index 00000000000..30aa5d3e9d2
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/profcollege/ProfCollege.sty
@@ -0,0 +1,10542 @@
+% Author : Christophe Poulain
+% Licence : Released under the LaTeX Project Public License v1.3c
+% or later, see http://www.latex-project.org/lppl.txtf
+%%%%%%%
+% 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/18 v0.89 Aide pour l'utilisation de LaTeX au collège]
+
+\RequirePackage{mathtools}%Amélioration des rendus
+\RequirePackage{amssymb}
+
+% mathématiques
+\RequirePackage{siunitx}%unités SI
+\sisetup{%
+ locale=FR,
+ detect-all,%
+ output-decimal-marker={,},%
+ group-four-digits%
+}
+
+\DeclareSIUnit{\kmh}{\km\per\hour}
+\newcommand\speed[1]{\SI{#1}{\kmh}}
+\newcommand\Speed[1]{\SI[per-mode=symbol]{#1}{\kmh}}
+
+\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
+\RequirePackage{ifthen}
+\RequirePackage{modulus}%Pour certains calculs arithmétiques.
+\RequirePackage{xinttools}%Pour la création dynamique d'un tableau
+
+\newif\if@shellescape \@shellescapetrue
+\DeclareOption{nonshellescape}{\@shellescapefalse}
+\ProcessOptions\relax
+
+\if@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;}}
+\usempxclass{article}
+\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;}}
+\usempxclass{article}
+\usempxpackage[utf8]{inputenc}
+\usempxpackage[T1]{fontenc}
+\usempxpackage{fourier}
+\usempxpackage[french]{babel}
+\usempxpackage{pifont}
+\usempxpackage[locale=FR]{siunitx}
+\fi
+
+\RequirePackage{xintexpr}
+\RequirePackage{listofitems}%pour définir simplement la liste des données.
+\RequirePackage{datatool}
+\RequirePackage{multido}
+
+\RequirePackage{xlop}%Pour effectuer les calculs nécessaires.
+\opset{decimalsepsymbol={,}}%
+
+\RequirePackage{xfp}%Pour les calculs trigonométriques
+
+\RequirePackage[most]{tcolorbox}
+
+\RequirePackage{tikz}
+% https://tex.stackexchange.com/questions/349259/curved-arrow-describing-a-step-in-a-equation-derivation
+%https://tex.stackexchange.com/questions/58656/best-way-to-draw-a-chevron-diagram-using-tikz
+\usetikzlibrary{calc,arrows,tikzmark,chains,positioning,shapes.symbols}
+
+\RequirePackage{suffix}%pour la commande étoilée
+
+\RequirePackage{multicol}
+
+\RequirePackage{hhline}% Pour la cohabitation de cline avec les couleurs
+
+\RequirePackage{iftex}
+
+\RequirePackage{stackengine}
+\RequirePackage[thicklines]{cancel}
+
+\ifpdftex
+\RequirePackage[babel=true,kerning=true]{microtype}%Pour gérer le souci du ; dans tikz avec pdftex...
+\fi
+
+% 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);}
+\everyendmplib{endfig;}
+\fi
+
+%%%%% Quelques besoins particuliers
+
+\def\bla{}%JCC :) Pour les tests sur arguments vides
+
+%% Colorer en mode mathématique. \color ne gère pas les espaces propres au mode mathématique. Donc besoin de changer
+% https://tex.stackexchange.com/questions/21598/how-to-color-math-symbols
+\makeatletter
+\def\mathcolor#1#{\@mathcolor{#1}}
+\def\@mathcolor#1#2#3{%
+ \protect\leavevmode
+ \begingroup
+ \color#1{#2}#3%
+ \endgroup
+}
+\makeatother
+
+% Colorer uniquement la barre de soulignement
+% https://tex.stackexchange.com/questions/9466/color-underline-a-formula/153884
+\def\mathunderline#1#2{\color{#1}\underline{{\color{black}#2}}\color{black}}
+
+% Ecrire des lignes d'équations
+\catcode`\@=11
+\def\Eqalign#1{\null\,\vcenter{\openup\jot\m@th\ialign{
+ \strut\hfil$\displaystyle{##}$&$\displaystyle{{}##}$\hfil
+ &&\quad\strut\hfil$\displaystyle{##}$&$\displaystyle{{}##}$
+ \hfil\crcr #1\crcr}}\,}
+\catcode`\@=12
+
+%%%%%%%%%%%%%%%%%%%%%
+%% Commandes "utiles"
+%%%%%%%%%%%%%%%%%%%%%
+%encadrer avec des "sommets arrondis"
+\newsavebox{\logobox}
+
+\newcommand{\Logo}[2]{%
+\setbox1=\hbox{\includegraphics[scale=#2]{#1}}
+\begin{tikzpicture}%
+\clip[rounded corners=5mm] (0,0) rectangle (\wd1,\ht1);
+\node[xshift=0.5\wd1, yshift=0.5\ht1, inner xsep=0pt, inner ysep=0pt] (box) {%
+\includegraphics[scale=#2]{#1}%
+};%
+\end{tikzpicture}%
+}
+
+\makeatletter
+\def\Dotfill{%
+\leavevmode
+\cleaders \hb@xt@ .44em{\hss\xleaders\hrule width0.33em\hss}\hfill
+\kern\z@}
+\makeatother
+
+\newcommand\pointilles[1][]{%
+ \ifx\bla#1\bla%
+ \Dotfill%
+ \else%
+ \hbox to#1{\Dotfill}%
+ \fi
+}
+
+\newcommand\Lignespointilles[1]{%
+ \xintFor* ##1 in {\xintSeq {1}{#1}}\do{
+ \pointilles\par%
+ }
+}
+
+%%%%%%%%%%%%%%%%%
+% Tables Addition-Multiplication
+%%%%%%%%%%%%%%%%%
+\setKVdefault[Tables]{Addition=false,Multiplication=true,Seul=false,Debut=0,Fin=10,Couleur=white}
+
+% pour mémoire
+\newcommand\TableMultiplicationComplete{%
+ \xdef\NbColTabMul{\fpeval{\useKV[Tables]{Fin}+1-\useKV[Tables]{Debut}}}%
+ \begin{tabular}{|>{\columncolor{gray!15}\centering\arraybackslash}p{1.5em}|*{\NbColTabMul}{>{\centering\arraybackslash}p{1.5em}|}}%
+ \hline
+ $\times$\xintFor* ##1 in {\xintSeq {\useKV[Tables]{Debut}}{\useKV[Tables]{Fin}}}\do{%
+ &\cellcolor{gray!15}\fpeval{##1}
+ }
+ \\
+ \hline
+ \xintFor* ##1 in {\xintSeq {0}{10}}\do{%
+ ##1\xintFor* ##2 in {\xintSeq {\useKV[Tables]{Debut}}{\useKV[Tables]{Fin}}}\do{%
+ &\fpeval{##2*##1}
+ }
+ \\
+ \hline
+ }
+ \end{tabular}%
+}
+%%%%
+
+\newcommand\TableMultiplicationCompleteColore{%
+ \xdef\NbColTabMul{\fpeval{\useKV[Tables]{Fin}+1-\useKV[Tables]{Debut}}}%
+ \begin{tabular}{|>{\columncolor{gray!15}\centering\arraybackslash}p{1.5em}|*{\NbColTabMul}{>{\centering\arraybackslash}p{1.5em}|}}%
+ \hline
+ $\times$\xintFor* ##1 in {\xintSeq {\useKV[Tables]{Debut}}{\useKV[Tables]{Fin}}}\do{%
+ &\cellcolor{gray!15}\fpeval{##1}
+ }
+ \\
+ \hline
+ \xintFor* ##1 in {\xintSeq {0}{10}}\do{%
+ ##1\xintFor* ##2 in {\xintSeq {\useKV[Tables]{Debut}}{\useKV[Tables]{Fin}}}\do{%
+ &\xintifboolexpr{##2<##1}{\cellcolor{\useKV[Tables]{Couleur}!\fpeval{##1*10}}}{\xintifboolexpr{##2>##1}{\cellcolor{\useKV[Tables]{Couleur}!\fpeval{##2*10}}}{}}\fpeval{##2*##1}
+ }
+ \\
+ \hline
+ }
+ \end{tabular}%
+}
+
+\newcommand\TableAdditionComplete{%
+ \xdef\NbColTabMul{\fpeval{\useKV[Tables]{Fin}+1-\useKV[Tables]{Debut}}}%
+ \begin{tabular}{|>{\columncolor{gray!15}\centering\arraybackslash}p{1.5em}|*{\NbColTabMul}{>{\centering\arraybackslash}p{1.5em}|}}%
+ \hline
+ $+$\xintFor* ##1 in {\xintSeq {\useKV[Tables]{Debut}}{\useKV[Tables]{Fin}}}\do{%
+ &\cellcolor{gray!15}\fpeval{##1}
+ }
+ \\
+ \hline
+ \xintFor* ##1 in {\xintSeq {0}{10}}\do{%
+ ##1\xintFor* ##2 in {\xintSeq {\useKV[Tables]{Debut}}{\useKV[Tables]{Fin}}}\do{%
+ &\fpeval{##2+##1}
+ }
+ \\
+ \hline
+ }
+ \end{tabular}%
+}
+
+\newcommand\TableMultiplicationSeule[1]{%
+ \ensuremath{%
+ \begin{array}{ccccc}%
+ \xintFor* ##1 in {\xintSeq
+ {\useKV[Tables]{Debut}}{\useKV[Tables]{Fin}}}\do{
+ ##1&\times&#1&=&\fpeval{##1*#1}\\
+ }
+ \end{array}
+ }%
+}%
+
+\newcommand\TableAdditionSeule[1]{%
+ \ensuremath{%
+ \begin{array}{ccccc}
+ \xintFor* ##1 in {\xintSeq
+ {\useKV[Tables]{Debut}}{\useKV[Tables]{Fin}}}\do{
+ ##1&+&#1&=&\fpeval{##1+#1}\\
+ }
+ \end{array}
+ }%
+}%
+
+
+\newcommand\Tables[2][]{%
+ \useKVdefault[Tables]%
+ \setKV[Tables]{#1}%
+ \ifboolKV[Tables]{Seul}{%
+ \ifboolKV[Tables]{Addition}{%
+ \TableAdditionSeule{#2}%
+ }{%
+ \TableMultiplicationSeule{#2}%
+ }%
+ }{
+ \ifboolKV[Tables]{Addition}{%
+ \TableAdditionComplete%
+ }{%
+ \TableMultiplicationCompleteColore%
+ }%
+ }%
+}%
+
+%%%%%%%%%%%%%%
+% 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%
+ \readlist*\ListeLaby{#2}%
+ \ifboolKV[Labyrinthe]{Passages}{%
+ \readlist*\ListeLabySol{#3}%
+ }{}%
+ \xdef\LabyLong{\useKV[Labyrinthe]{Longueur}}%
+ \xdef\LabyHaut{\useKV[Labyrinthe]{Hauteur}}%
+ \xdef\TotalLaby{\fpeval{3*\useKV[Labyrinthe]{Colonnes}-2}}%
+ \xdef\CouleurF{\useKV[Labyrinthe]{CouleurF}}%
+ \xdef\MotifTexte{\useKV[Labyrinthe]{Texte}}%
+ \xintifboolexpr{\ListeLabylen=\fpeval{\useKV[Labyrinthe]{Lignes}*\useKV[Labyrinthe]{Colonnes}}}{%
+ \begin{tikzpicture}[remember picture]
+ % on dessine les cadres
+ \foreach \compteurv in {1,...,\useKV[Labyrinthe]{Lignes}}{%
+ \foreach \compteurh in {1,...,\useKV[Labyrinthe]{Colonnes}}{%
+ \xdef\ColorFill{\ListeLaby[\fpeval{\useKV[Labyrinthe]{Colonnes}*(\compteurv-1)+\compteurh},2]}%
+ \node[fill=\ColorFill,draw,minimum height=\LabyHaut*1cm,minimum width=\LabyLong*1cm,name=A-\compteurh-\compteurv] at
+ (\fpeval{\LabyLong+\useKV[Labyrinthe]{EcartH}}*\compteurh,-\fpeval{\LabyHaut+\useKV[Labyrinthe]{EcartV}}*\compteurv) {\ListeLaby[\fpeval{\useKV[Labyrinthe]{Colonnes}*(\compteurv-1)+\compteurh},1]};%
+ }%
+ }%
+ % on dessine les flèches
+ \foreach \compteurv in {1,...,\fpeval{\useKV[Labyrinthe]{Lignes}-1}}{%
+ \foreach \compteurh in {1,...,\useKV[Labyrinthe]{Colonnes}}{%
+ \ifboolKV[Labyrinthe]{Passages}{%
+ \xdef\NomNode{\ListeLabySol[1,\fpeval{\TotalLaby*(\compteurv-1)+\useKV[Labyrinthe]{Colonnes}+2*(\compteurh-1)}]}%
+ \draw[\CouleurF,line width=1pt,stealth-stealth] (A-\compteurh-\compteurv) -- node[fill=white,midway]{\MotifTexte\NomNode}(A-\compteurh-\fpeval{\compteurv+1});%
+ }{%
+ \draw[\CouleurF,line width=1pt,stealth-stealth] (A-\compteurh-\compteurv) -- (A-\compteurh-\fpeval{\compteurv+1});%
+ }%
+ }
+ }
+ \foreach \compteurv in {1,...,\useKV[Labyrinthe]{Lignes}}{%
+ \foreach \compteurh in {1,...,\fpeval{\useKV[Labyrinthe]{Colonnes}-1}}{%
+ \ifboolKV[Labyrinthe]{Passages}{%
+ \xdef\NomNode{\ListeLabySol[1,\fpeval{\TotalLaby*(\compteurv-1)+\compteurh}]}%
+ \draw[\CouleurF,line width=1pt,stealth-stealth]
+ (A-\compteurh-\compteurv) -- node[fill=white,midway]{\MotifTexte\NomNode}(A-\fpeval{\compteurh+1}-\compteurv);
+ }{%
+ \draw[\CouleurF,line width=1pt,stealth-stealth]
+ (A-\compteurh-\compteurv) -- (A-\fpeval{\compteurh+1}-\compteurv);
+ }%
+ }
+ }
+ \foreach \compteurv in {2,...,\fpeval{\useKV[Labyrinthe]{Lignes}}}{%
+ \foreach \compteurh in {1,...,\fpeval{\useKV[Labyrinthe]{Colonnes}-1}}{%
+ \draw[\CouleurF,line width=1pt,stealth-stealth] (A-\compteurh-\compteurv) -- (A-\fpeval{\compteurh+1}-\fpeval{\compteurv-1});
+ }
+ }
+ \foreach \compteurv in {1,...,\fpeval{\useKV[Labyrinthe]{Lignes}-1}}{%
+ \foreach \compteurh in {1,...,\fpeval{\useKV[Labyrinthe]{Colonnes}-1}}{%
+ \ifboolKV[Labyrinthe]{Passages}{%
+ \xdef\NomNode{\ListeLabySol[1,\fpeval{\TotalLaby*(\compteurv-1)+\useKV[Labyrinthe]{Colonnes}+2*(\compteurh-1)+1}]}%
+ \draw[\CouleurF,line width=1pt,stealth-stealth] (A-\compteurh-\compteurv) -- node[fill=white,midway]{\MotifTexte\NomNode}(A-\fpeval{\compteurh+1}-\fpeval{\compteurv+1});
+ }{%
+ \draw[\CouleurF,line width=1pt,stealth-stealth] (A-\compteurh-\compteurv) -- (A-\fpeval{\compteurh+1}-\fpeval{\compteurv+1});
+ }%
+ }%
+ }%
+ \end{tikzpicture}
+ }{\textbf{! Le nombre d'informations n'est pas compatible avec les
+ 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}
+
+\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,
+ leftright skip=0.25cm,beforeafter skip=0pt,
+ toptitle=0mm,bottomtitle=0mm,
+ right=2mm,left=2mm,
+ top=1pt,
+ bottom=0.25cm,
+ boxsep=0pt,
+ boxrule=0mm,
+ sharp corners,
+ sidebyside,
+ sidebyside gap=2mm,
+ lefthand ratio=0.6,
+ bicolor,
+ colback=black!10!white,
+ colbacklower=greenish,
+ colframe=white,
+ autoparskip,
+ }}
+
+\newtcbox{\KY}[1][]{
+ enhanced,
+ on line,
+ arc=2pt,outer arc=2pt,
+ boxrule=0pt,bottomrule=0.25mm,rightrule=0.2mm,
+ boxsep=0pt,left=0pt,right=0pt,top=1pt,bottom=1pt,
+ interior style={top color=blackish,bottom color=blackened},
+ colframe=greyish,
+ width=2.5em,
+ tcbox width=forced center,
+ equal height group=K,
+ valign=center,
+ fontupper=\footnotesize\sffamily,
+ coltext=orangeish,
+ before upper=\vrule width 0pt height 2ex depth 1ex\relax,
+}
+
+\newtcbox{\KYm}[1][]{
+ enhanced,
+ on line,
+ arc=2pt,outer arc=2pt,
+ boxrule=0pt,bottomrule=0.25mm,rightrule=0.2mm,
+ boxsep=0pt,left=0pt,right=0pt,top=1pt,bottom=1pt,
+ interior style={top color=blackish,bottom color=blackened},
+ colframe=greyish,
+ width=2.5em,
+ tcbox width=forced center,
+ equal height group=K,
+ valign=center,
+ fontupper=\footnotesize\sffamily,
+ coltext=orangeish,
+ before upper=\vrule width 0pt height 2ex depth 1ex\relax$,
+ after upper=$,
+}
+
+\newtcbox{\KN}{
+ enhanced,
+ on line,
+ arc=2pt,outer arc=2pt,
+ boxrule=0pt,bottomrule=0.25mm,rightrule=0.2mm,
+ boxsep=0pt,left=0pt,right=0pt,top=1pt,bottom=1pt,
+ interior style={top color=blackish,bottom color=blackened},
+ colframe=greyish,
+ width=1.5em,
+ tcbox width=forced center,
+ equal height group=K,
+ valign=center,
+ fontupper=\footnotesize\sffamily,
+ coltext=whiteish,
+ before upper=\vrule width 0pt height 2ex depth 1ex\relax,
+}
+
+\parindent0pt
+
+\newtcolorbox{calc}[1][]{%
+ enhanced,bicolor,
+ boxsep=0pt,
+ boxrule=0pt,
+ top=6pt,bottom=0pt,left=6pt,right=0pt,
+ sharp corners,
+ frame empty,
+ colback=black!10,
+ colbacklower=greenish,
+ sidebyside,
+ sidebyside align=top seam,
+ sidebyside gap=0pt,
+ righthand width=50.7mm,
+ before lower=\begin{tabular}{@{}l@{}},
+ after lower=\end{tabular},
+ overlay={\node[inner sep=0pt, outer sep=0pt, text height=5pt, text
+ depth=1pt, text width=50.7mm, fill=greenish, anchor=north
+ east, font=\sffamily\tiny\bfseries, align=flush right]
+ at (frame.north east) {#1};}
+}
+
+\def\MPCalculatrice#1#2{
+ % #1 Calcul %2 réponse
+ \ifluatex
+ \mplibforcehmode
+ \begin{mplibcode}
+ input PfC-Calculatrice;
+ LCD(#1)(#2);
+ \end{mplibcode}
+ \else
+ \begin{mpost}[mpsettings={input PfC-Calculatrice;}]
+ LCD(#1)(#2);
+ \end{mpost}
+ \fi
+}
+
+\setKVdefault[ClesCalculatrice]{Ecran=false}
+
+\newcommand\Calculatrice[2][]{%
+ \setstackgap{L}{0.775\baselineskip}%
+ \useKVdefault[ClesCalculatrice]%
+ \setKV[ClesCalculatrice]{#1}%
+ \ifboolKV[ClesCalculatrice]{Ecran}{%
+ \setsepchar[*]{,*/}%
+ \readlist\ListeCalc{#2}%
+ \MPCalculatrice{\ListeCalc[1,1]}{\ListeCalc[1,2]}%
+ }{%
+ \setsepchar[*]{,*/}%
+ \readlist\ListeCalc{#2}%
+ \foreachitem\compteur\in\ListeCalc{\xintifboolexpr{\listlen\ListeCalc[\compteurcnt]=2}{\Longstack{{\tiny\ListeCalc[\compteurcnt,1]} \KN{\ListeCalc[\compteurcnt,2]}}}{\Longstack{{\tiny\ListeCalc[\compteurcnt,2]} \KY{\ListeCalc[\compteurcnt,3]}}}%
+ }%
+ }%
+ \setstackgap{L}{\baselineskip}%
+}%
+
+
+%%%%%%%%%%%%%%%%
+%%% 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}}
+\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}
+
+\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\MPHorloge#1#2#3{
+ \ifluatex
+ \mplibforcehmode
+ \begin{mplibcode}
+ marque_horloge=1;
+ save Hor;
+ picture Hor;
+ path gdeaig,pteaig,trot;
+ pair centrehorloge;
+ centrehorloge=(0,0);
+ path tourhorloge;
+ tourhorloge=cercles(centrehorloge,marque_horloge*cm);
+ Hor=image(
+ %% dessin de l'horloge
+ draw tourhorloge;
+ for i=0 upto 59:
+ if (i mod 5)=0:
+ if (i mod 15)=0:
+ draw pointarc(tourhorloge,6*i)--(pointarc(tourhorloge,6*i) shifted (7*unitvector(centrehorloge-pointarc(tourhorloge,6*i)))) withpen pencircle scaled 2bp;
+ else:
+ draw pointarc(tourhorloge,6*i)--(pointarc(tourhorloge,6*i) shifted (5*unitvector(centrehorloge-pointarc(tourhorloge,6*i)))) withpen pencircle scaled 1.5bp;
+ fi;
+ else:
+ draw pointarc(tourhorloge,6*i)--(pointarc(tourhorloge,6*i) shifted (3*unitvector(centrehorloge-pointarc(tourhorloge,6*i))));
+ fi;
+ endfor;
+ path graduhorloge;
+ graduhorloge=cercles(centrehorloge,marque_horloge*cm+5*abs(unitvector(centrehorloge-pointarc(tourhorloge,0))));
+ %
+ marque_p:="plein";
+ pointe(centrehorloge);
+ marque_p:="rien";
+ %% placement des aiguilles
+ gdeaig=centrehorloge--(pointarc(tourhorloge,0) shifted (7*unitvector(centrehorloge-pointarc(tourhorloge,0))));
+ pteaig=centrehorloge--(pointarc(tourhorloge,0) shifted (18*unitvector(centrehorloge-pointarc(tourhorloge,0))));
+ trot=centrehorloge--(pointarc(tourhorloge,0) shifted (10*unitvector(centrehorloge-pointarc(tourhorloge,0))));
+ draw rotation(trot,centrehorloge,90-6*#3) withpen pencircle scaled0.4;
+ draw rotation(gdeaig,centrehorloge,90-6*#2) withpen pencircle scaled1.25;
+ draw rotation(pteaig,centrehorloge,90-30*(#1+#2/60)) withpen pencircle scaled 2bp;
+ );
+ draw Hor;
+ \end{mplibcode}
+\else
+ \begin{mpost}[mpsettings={input PfC-Geometrie;}]
+ marque_horloge=1;
+ save Hor;
+ picture Hor;
+ path gdeaig,pteaig,trot;
+ pair centrehorloge;
+ centrehorloge=(0,0);
+ path tourhorloge;
+ tourhorloge=cercles(centrehorloge,marque_horloge*cm);
+ Hor=image(
+ %% dessin de l'horloge
+ draw tourhorloge;
+ for i=0 upto 59:
+ if (i mod 5)=0:
+ if (i mod 15)=0:
+ draw pointarc(tourhorloge,6*i)--(pointarc(tourhorloge,6*i) shifted (7*unitvector(centrehorloge-pointarc(tourhorloge,6*i)))) withpen pencircle scaled 2bp;
+ else:
+ draw pointarc(tourhorloge,6*i)--(pointarc(tourhorloge,6*i) shifted (5*unitvector(centrehorloge-pointarc(tourhorloge,6*i)))) withpen pencircle scaled 1.5bp;
+ fi;
+ else:
+ draw pointarc(tourhorloge,6*i)--(pointarc(tourhorloge,6*i) shifted (3*unitvector(centrehorloge-pointarc(tourhorloge,6*i))));
+ fi;
+ endfor;
+ path graduhorloge;
+ graduhorloge=cercles(centrehorloge,marque_horloge*cm+5*abs(unitvector(centrehorloge-pointarc(tourhorloge,0))));
+ %
+ marque_p:="plein";
+ pointe(centrehorloge);
+ marque_p:="rien";
+ %% placement des aiguilles
+ gdeaig=centrehorloge--(pointarc(tourhorloge,0) shifted (7*unitvector(centrehorloge-pointarc(tourhorloge,0))));
+ pteaig=centrehorloge--(pointarc(tourhorloge,0) shifted (18*unitvector(centrehorloge-pointarc(tourhorloge,0))));
+ trot=centrehorloge--(pointarc(tourhorloge,0) shifted (10*unitvector(centrehorloge-pointarc(tourhorloge,0))));
+ draw rotation(trot,centrehorloge,90-6*#3) withpen pencircle scaled0.4;
+ draw rotation(gdeaig,centrehorloge,90-6*#2) withpen pencircle scaled1.25;
+ draw rotation(pteaig,centrehorloge,90-30*(#1+#2/60)) withpen pencircle scaled 2bp;
+ );
+ draw Hor;
+ \end{mpost}
+ \fi
+}
+
+\newcommand\QFNumeration{%
+ \begin{CadreNombre}
+ {\Large LE NOMBRE DU JOUR est : }
+ \tcbox[BoiteExpression]{\num{\ListeFlash[1,1]}}
+ \ifboolKV[ClesFlash]{Pause}{\pause}{}
+ \begin{tcolorbox}[ExpressionSerie1]
+ $\square$ \textbf{Le chiffre des \ListeFlash[1,2] est :}
+ \tcbox[BoiteExpression]{\phantom{1500000}}
+ \end{tcolorbox}
+ \ifboolKV[ClesFlash]{Pause}{\pause}{}
+ \begin{tcolorbox}[ExpressionSerie2]
+ $\square$ \textbf{Le chiffre \ListeFlash[1,3] représente le
+ chiffre des :}
+ \tcbox[BoiteExpression]{\phantom{1500000}}
+ \end{tcolorbox}
+ \ifboolKV[ClesFlash]{Pause}{\pause}{}
+ \begin{tcolorbox}[ExpressionSerie3]
+ $\square$ \textbf{Le nombre de \ListeFlash[1,4] est :}
+ \tcbox[BoiteExpression]{\phantom{1500000}}
+ \end{tcolorbox}
+ \ifboolKV[ClesFlash]{Pause}{\pause}{}
+ \begin{tcolorbox}[ExpressionSerie4]
+ $\square$ \textbf{Le nombre de \ListeFlash[1,5] est :}
+ \tcbox[BoiteExpression]{\phantom{1500000}}
+ \end{tcolorbox}
+ \end{CadreNombre}
+}
+
+\newcommand\QFHeure{%
+ \begin{CadreNombre}
+ {\Large L'HEURE DU JOUR est : }\raisebox{-0.9cm}{\MPHorloge{\NbHeures}{\NbMinutes}{\NbSecondes}}
+ \ifboolKV[ClesFlash]{Pause}{\pause}{}
+ \begin{tcolorbox}[ExpressionSerie1]
+ $\square$ \textbf{\ListeFlash[1,2] :}
+ \tcbox[BoiteExpression]{\phantom{1500000000}}
+ \end{tcolorbox}
+ \ifboolKV[ClesFlash]{Pause}{\pause}{}
+ \begin{tcolorbox}[ExpressionSerie2]
+ $\square$ \textbf{\ListeFlash[1,3] :}
+ \tcbox[BoiteExpression]{\phantom{1500000000}}
+ \end{tcolorbox}
+ \ifboolKV[ClesFlash]{Pause}{\pause}{}
+ \begin{tcolorbox}[ExpressionSerie3]
+ $\square$ \textbf{\ListeFlash[1,4] :}
+ \tcbox[BoiteExpression]{\phantom{\hbox to4.5em{15}}}
+ \end{tcolorbox}
+ \ifboolKV[ClesFlash]{Pause}{\pause}{}
+ \begin{tcolorbox}[ExpressionSerie4]
+ $\square$ \textbf{\ListeFlash[1,5] :}
+ \tcbox[BoiteExpression]{\phantom{\hbox to4.5em{1500000}}}
+ \end{tcolorbox}
+ \end{CadreNombre}
+}
+
+\newcommand\QFMesure{%
+ \begin{CadreNombre}
+ {\Large LA MESURE DU JOUR est : }
+ \tcbox[BoiteExpression]{\ListeFlash[1,1]}
+ \ifboolKV[ClesFlash]{Pause}{\pause}{}
+ \begin{tcolorbox}[ExpressionSerie1]
+ $\square$ \textbf{Convertis la en \ListeFlash[1,2] :}
+ \tcbox[BoiteExpression]{\phantom{1500000000}}
+ \end{tcolorbox}
+ \ifboolKV[ClesFlash]{Pause}{\pause}{}
+ \begin{tcolorbox}[ExpressionSerie2]
+ $\square$ \textbf{Convertis la en \ListeFlash[1,3] :}
+ \tcbox[BoiteExpression]{\phantom{1500000000}}
+ \end{tcolorbox}
+ \ifboolKV[ClesFlash]{Pause}{\pause}{}
+ \begin{tcolorbox}[ExpressionSerie3]
+ $\square$ \textbf{Ajoute lui \ListeFlash[1,4] :}
+ \tcbox[BoiteExpression]{\phantom{\hbox to5em{1500000}}}
+ \end{tcolorbox}
+ \ifboolKV[ClesFlash]{Pause}{\pause}{}
+ \begin{tcolorbox}[ExpressionSerie4]
+ $\square$ \textbf{Enlève lui \ListeFlash[1,5] :}
+ \tcbox[BoiteExpression]{\phantom{\hbox to5em{1500000}}}
+ \end{tcolorbox}
+ \end{CadreNombre}
+}
+
+\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}{}
+ }{%
+ \xintifboolexpr{\s = \ListeFlashlen}{%
+ \node[arrow,on chain] {\Huge\bfseries?};
+ }{%
+ \node[arrow,on chain] {\ListeFlash[\s]};
+ \ifboolKV[ClesFlash]{Pause}{\pause}{}
+ }
+ }
+ }
+ \end{scope}
+ \end{tikzpicture}
+}
+
+\newcommand\QFDecimal{%
+ \begin{CadreNombre}
+ {\Large LE NOMBRE DU JOUR est : }
+ \tcbox[BoiteExpression]{\num{\ListeFlash[1,1]}}
+ \ifboolKV[ClesFlash]{Pause}{\pause}{}
+ \begin{tcolorbox}[ExpressionSerie1]
+ \textbf{\'Ecriture en fraction décimale :}
+ \tcbox[BoiteExpression]{$\dfrac{\phantom{1000000}}{\phantom{1000000}}$}
+ \end{tcolorbox}
+ \ifboolKV[ClesFlash]{Pause}{\pause}{}
+ \begin{tcolorbox}[ExpressionSerie2]
+ \begin{tabular}{c}
+ \textbf{Partie}\\
+ \textbf{entière}
+ \end{tabular} \textbf{: }
+ \tcbox[BoiteExpression]{\phantom{100000}}\hfill%
+ \begin{tabular}{c}
+ \textbf{Partie}\\
+ \textbf{décimale}
+ \end{tabular} \textbf{: }
+ \tcbox[BoiteExpression]{\phantom{100000}}
+ \end{tcolorbox}
+ \ifboolKV[ClesFlash]{Pause}{\pause}{}
+ \begin{tcolorbox}[ExpressionSerie3]
+ \textbf{\useKV[ClesFlash]{Operation} le par
+ \ListeFlash[1,2] :} \tcbox[BoiteExpression]{\phantom{1000000000}}
+ \end{tcolorbox}
+ \ifboolKV[ClesFlash]{Pause}{\pause}{}
+ \begin{tcolorbox}[ExpressionSerie4]
+ \textbf{Trouve le nombre entier le plus proche :} \tcbox[BoiteExpression]{\phantom{10000000}}
+ \end{tcolorbox}
+ \end{CadreNombre}
+}
+
+\newcommand\QFMental{%
+ \begin{CadreNombre}
+ {\Large LE NOMBRE DU JOUR est : }
+ \tcbox[BoiteExpression]{\ListeFlash[1,1]}
+ \ifboolKV[ClesFlash]{Pause}{\pause}{}
+ \begin{tcolorbox}[ExpressionSerie1]
+ $\square$ \textbf{Ajoute lui}
+ \tcbox[BoiteExpression]{\ListeFlash[1,2]}\hfill$\square$
+ \textbf{Soustrais lui} \tcbox[BoiteExpression]{\ListeFlash[1,3]}
+ \end{tcolorbox}
+ \ifboolKV[ClesFlash]{Pause}{\pause}{}
+ \begin{tcolorbox}[ExpressionSerie2]
+ $\square$ \textbf{Multiplie le par }
+ \tcbox[BoiteExpression]{\ListeFlash[1,4]}\hfill$\square$
+ \textbf{Divise le par } \tcbox[BoiteExpression]{\ListeFlash[1,5]}
+ \end{tcolorbox}
+ \ifboolKV[ClesFlash]{Pause}{\pause}{}
+ \begin{tcolorbox}[ExpressionSerie3]
+ $\square$ \textbf{Trouve}
+ \tcbox[BoiteExpression]{\ListeFlash[1,6]}
+ \textbf{\% de ce nombre.}
+ \end{tcolorbox}
+ \ifboolKV[ClesFlash]{Pause}{\pause}{}
+ \begin{tcolorbox}[ExpressionSerie4]
+ $\square$ \textbf{Trouve } \tcbox[BoiteExpression]{\ListeFlash[1,7]}
+ \textbf{de ce nombre.}
+ \end{tcolorbox}
+ \end{CadreNombre}
+}
+
+\newcommand\QFExpression{%
+ \begin{CadreNombre}
+ {\Large L'EXPRESSION DU JOUR est : }
+ \tcbox[BoiteExpression]{\ListeFlash[1,1]}
+ \ifboolKV[ClesFlash]{Pause}{\pause}{}
+ \begin{tcolorbox}[ExpressionSerie1]
+ $\square$ \textbf{Ajoute lui}
+ \tcbox[BoiteExpression]{\ListeFlash[1,2]}
+ \end{tcolorbox}
+ \ifboolKV[ClesFlash]{Pause}{\pause}{}
+ \begin{tcolorbox}[ExpressionSerie2]
+ $\square$ \textbf{Soustrais lui}
+ \tcbox[BoiteExpression]{\ListeFlash[1,3]}
+ \end{tcolorbox}
+ \ifboolKV[ClesFlash]{Pause}{\pause}{}
+ \begin{tcolorbox}[ExpressionSerie3]
+ $\square$ \textbf{Multiplie la par}
+ \tcbox[BoiteExpression]{\ListeFlash[1,4]}
+ \end{tcolorbox}
+ \ifboolKV[ClesFlash]{Pause}{\pause}{}
+ \begin{tcolorbox}[ExpressionSerie4]
+ $\square$ \textbf{\'Evalue la lorsque} \tcbox[BoiteExpression]{\ListeFlash[1,5]}
+ \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}}
+ \ifboolKV[ClesFlash]{Evaluation}{%
+ \ifboolKV[ClesFlash]{Numeration}{%
+ \setsepchar[*]{,*/}%
+ \readlist*\ListeFlash{#2}%
+ \QFNumeration%
+ }{%
+ \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]%
+ \QFHeure%
+ }{%
+ \ifboolKV[ClesFlash]{Mesure}{%
+ \setsepchar[*]{,*/}%
+ \readlist*\ListeFlash{#2}%
+ \QFMesure%
+ }{%
+ \ifboolKV[ClesFlash]{Daily}{%
+ \setsepchar[*]{/}%
+ \readlist*\ListeFlash{#2}%
+ \QFDaily%
+ }{%
+ \ifboolKV[ClesFlash]{Decimal}{%
+ \setsepchar[*]{,*/}%
+ \readlist*\ListeFlash{#2}%
+ \begin{frame}
+ \QFDecimal%
+ \end{frame}
+ }{%
+ \ifboolKV[ClesFlash]{Mental}{%
+ \setsepchar[*]{,*/}%
+ \readlist*\ListeFlash{#2}%
+ \QFMental%
+ }{%
+ \ifboolKV[ClesFlash]{Expression}{%
+ \setsepchar[*]{,*/}%
+ \readlist*\ListeFlash{#2}%
+ \QFExpression%
+ }{%
+ \setsepchar[*]{/}%
+ \readlist*\ListeFlash{#2}%
+ \ifboolKV[ClesFlash]{Simple}{%
+ \ListeFlash[1]
+ \begin{tcolorbox}[valign=center]
+ \ListeFlash[2]
+ \end{tcolorbox}
+ }{%
+ \setsepchar[*]{*/}%
+ \readlist*\ListeFlash{#2}%
+ \ifboolKV[ClesFlash]{Kahout}{%
+ \setsepchar[*]{*/}%
+ \readlist*\ListeFlash{#2}%
+ \begin{tcolorbox}[halign=center,valign=center]
+ \ListeFlash[1,1]
+ \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]
+ \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[*]{,*/}%
+ \readlist*\ListeFlash{#2}%
+ \begin{frame}
+ \QFNumeration%
+ \end{frame}
+ }{%
+ \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}
+ \QFHeure%
+ \end{frame}
+ }{%
+ \ifboolKV[ClesFlash]{Mesure}{%
+ \setsepchar[*]{,*/}%
+ \readlist*\ListeFlash{#2}%
+ \begin{frame}
+ \QFMesure%
+ \end{frame}
+ }{%
+ \ifboolKV[ClesFlash]{Daily}{%
+ \setsepchar[*]{/}%
+ \readlist*\ListeFlash{#2}%
+ \begin{frame}
+ \QFDaily
+ \end{frame}
+ }{%
+ \ifboolKV[ClesFlash]{Decimal}{%
+ \setsepchar[*]{,*/}%
+ \readlist*\ListeFlash{#2}%
+ \begin{frame}
+ \QFDecimal%
+ \end{frame}
+ }{%
+ \ifboolKV[ClesFlash]{Mental}{%
+ \setsepchar[*]{,*/}%
+ \readlist*\ListeFlash{#2}%
+ \begin{frame}
+ \QFMental%
+ \end{frame}
+ }{
+ \ifboolKV[ClesFlash]{Expression}{%
+ \setsepchar[*]{,*/}%
+ \readlist*\ListeFlash{#2}%
+ \begin{frame}
+ \QFExpression%
+ \end{frame}
+ }{%
+ \setsepchar[*]{/}%
+ \readlist*\ListeFlash{#2}%
+ \ifboolKV[ClesFlash]{Simple}{%
+ \begin{frame}
+ \ListeFlash[1]
+ \begin{tcolorbox}[valign=center]
+ \ListeFlash[2]
+ \end{tcolorbox}
+ \end{frame}
+ }{%
+ \setsepchar[*]{,*/}%
+ \readlist*\ListeFlash{#2}%
+ \ifboolKV[ClesFlash]{Kahout}{%
+ \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=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[*]{*/}%
+ \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}
+ }%
+ }%
+ }%
+ }%
+ }
+ }%
+ }%
+ }%
+ }%
+ }%
+}%
+
+%%%%%%%%%%%%%
+%%% Fractions
+%%%%%%%%%%%%%
+\setKVdefault[ClesFraction]{Rayon=2cm,Disque,Regulier=false,Segment=false,Rectangle=false,Longueur=5cm,Largeur=2cm,Cotes=5,Couleur=green,Reponse=false,Multiple=1}
+
+\def\MPFractionRegulier#1#2#3#4#5{
+ % #1 rayon, #2 nb côtés, #3 num, #4 deno, #5 couleur
+ \ifluatex
+ \mplibforcehmode
+ \begin{mplibcode}
+ pair O,A[],B[];
+ O=u*(0,0);
+ path cc,cd;
+ cc=cercles(O,#1);
+ for k=0 upto #2:
+ A[k]=pointarc(cc,k*(360/#2));
+ endfor;
+ cd=polygone(A0 for k=1 upto #2-1:,A[k] endfor);
+ for k=0 upto #4-1:
+ B[k]=point(k*(#2/#4)) of cd;
+ endfor;
+ remplis O--arccercle(B[0],B[#3],O)--cycle withcolor #5;
+ %fi;
+ clip currentpicture to cd;
+ draw polygone(A0 for k=1 upto #2:,A[k] endfor);
+ if #4>1:
+ for k=0 upto #4-1:
+ draw segment(O,B[k]) cutafter cd;
+ endfor;
+ fi;
+ \end{mplibcode}
+ \else
+\begin{mpost}[mpsettings={input PfC-Geometrie;}]
+ pair O,A[],B[];
+ O=u*(0,0);
+ path cc,cd;
+ cc=cercles(O,#1);
+ for k=0 upto #2:
+ A[k]=pointarc(cc,k*(360/#2));
+ endfor;
+ cd=polygone(A0 for k=1 upto #2-1:,A[k] endfor);
+ for k=0 upto #4-1:
+ B[k]=point(k*(#2/#4)) of cd;
+ endfor;
+ remplis O--arccercle(B[0],B[#3],O)--cycle withcolor #5;
+ %fi;
+ clip currentpicture to cd;
+ draw polygone(A0 for k=1 upto #2:,A[k] endfor);
+ if #4>1:
+ for k=0 upto #4-1:
+ draw segment(O,B[k]) cutafter cd;
+ endfor;
+ fi;
+ \end{mpost}
+ \fi
+}
+
+\def\MPFractionRectangle#1#2#3#4#5#6{%
+ % #1 longueur, #2 largeur, #3 num, #4 deno, #5 couleur, #6 multiple
+ \ifluatex
+ \mplibforcehmode
+ \begin{mplibcode}
+ pair A,B,C,D,M[],N[],R[],S[];
+ A=(1,1);
+ B-A=(#1,0);
+ C-B=(0,#2);
+ D-C=A-B;
+ numeric parts;
+ parts=(#4 div #6);
+ for k=0 upto parts:
+ M[k]=(k/parts)[A,B];
+ N[k]=(k/parts)[D,C];
+ endfor;
+ if #6>1:
+ for k=0 upto #6:
+ R[k]=(k/#6)[A,D];
+ S[k]=(k/#6)[B,C];
+ endfor;
+ fi;
+ if #6=1:
+ remplis polygone(A,M[#3],N[#3],D) withcolor #5;
+ else:
+ DDiv=#3 div parts;
+ MMod=#3 mod parts;
+ remplis polygone(A,B,S[DDiv],R[DDiv]) withcolor #5;
+ remplis
+ polygone(R[DDiv],(xpart(M[MMod]),ypart(R[DDiv])),(xpart(M[MMod]),ypart(R[DDiv+1])),R[DDiv+1]) withcolor #5;
+ fi;
+ draw polygone(A,B,C,D);
+ for k=1 upto (parts-1):
+ draw segment(M[k],N[k]);
+ endfor;
+ if #6>1:
+ for k=1 upto (#6-1):
+ draw segment(R[k],S[k]);
+ endfor;
+ fi;
+ \end{mplibcode}
+ \else
+\begin{mpost}[mpsettings={input PfC-Geometrie;}]
+ pair A,B,C,D,M[],N[],R[],S[];
+ A=(1,1);
+ B-A=(#1,0);
+ C-B=(0,#2);
+ D-C=A-B;
+ numeric parts;
+ parts=(#4 div #6);
+ for k=0 upto parts:
+ M[k]=(k/parts)[A,B];
+ N[k]=(k/parts)[D,C];
+ endfor;
+ if #6>1:
+ for k=0 upto #6:
+ R[k]=(k/#6)[A,D];
+ S[k]=(k/#6)[B,C];
+ endfor;
+ fi;
+ if #6=1:
+ remplis polygone(A,M[#3],N[#3],D) withcolor #5;
+ else:
+ DDiv=#3 div parts;
+ MMod=#3 mod parts;
+ remplis polygone(A,B,S[DDiv],R[DDiv]) withcolor #5;
+ remplis
+ polygone(R[DDiv],(xpart(M[MMod]),ypart(R[DDiv])),(xpart(M[MMod]),ypart(R[DDiv+1])),R[DDiv+1]) withcolor #5;
+ fi;
+ draw polygone(A,B,C,D);
+ for k=1 upto (parts-1):
+ draw segment(M[k],N[k]);
+ endfor;
+ if #6>1:
+ for k=1 upto (#6-1):
+ draw segment(R[k],S[k]);
+ endfor;
+ fi;
+ \end{mpost}
+ \fi
+}
+
+\def\MPFractionDisque#1#2#3#4{%
+ \ifluatex
+ \mplibforcehmode
+ \begin{mplibcode}
+ pair A,B[];
+ A=(0,0);
+ path cc;
+ cc=cercles(A,#1);
+ for k=0 upto (#3-1):
+ B[k]=pointarc(cc,(360/#3)*k);
+ endfor;
+ fill (A--B0--arccercle(B[0],B[#2],A)--cycle) withcolor #4;
+ draw cc;
+ for k=0 upto (#3-1):
+ draw segment(A,B[k]);
+ endfor;
+ \end{mplibcode}
+ \else
+ \begin{mpost}[mpsettings={input PfC-Geometrie;}]
+ pair A,B[];
+ A=(0,0);
+ path cc;
+ cc=cercles(A,#1);
+ for k=0 upto (#3-1):
+ B[k]=pointarc(cc,(360/#3)*k);
+ endfor;
+ fill (A--B0--arccercle(B[0],B[#2],A)--cycle) withcolor #4;
+ draw cc;
+ for k=0 upto (#3-1):
+ draw segment(A,B[k]);
+ endfor;
+ \end{mpost}
+ \fi
+}
+
+\def\MPFractionSegment#1#2#3#4{
+ \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;
+ draw segment(B[0],B[#2]) withpen pencircle scaled 2 withcolor #4;
+ draw segment(A,C);
+ marque_p:="tiretv";
+ for k=0 upto #3:
+ pointe(B[k]);
+ endfor;
+ \end{mplibcode}
+ \else
+ \begin{mpost}[mpsettings={input PfC-Geometrie;}]
+ pair A,C,B[];
+ A=(0,0);
+ C-A=(#1,0);
+ for k=0 upto #3:
+ B[k]=(k/#3)[A,C];
+ endfor;
+ draw segment(B[0],B[#2]) withpen pencircle scaled 2 withcolor #4;
+ 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]{Reponse}{}{\setKV[ClesFraction]{Couleur=white}}%
+ \MPFractionRegulier{\useKV[ClesFraction]{Rayon}}{\useKV[ClesFraction]{Cotes}}{\ListeFraction[1]}{\ListeFraction[2]}{\useKV[ClesFraction]{Couleur}}%
+ }{%
+ \ifboolKV[ClesFraction]{Segment}{%
+ \ifboolKV[ClesFraction]{Reponse}{}{\setKV[ClesFraction]{Couleur=white}}%
+ \MPFractionSegment{\useKV[ClesFraction]{Longueur}}{\ListeFraction[1]}{\ListeFraction[2]}{\useKV[ClesFraction]{Couleur}}%
+ }{
+ \ifboolKV[ClesFraction]{Rectangle}{%rectangle
+ \ifboolKV[ClesFraction]{Reponse}{}{\setKV[ClesFraction]{Couleur=white}}%
+ \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}}%
+ \MPFractionDisque{\useKV[ClesFraction]{Rayon}}{\ListeFraction[1]}{\ListeFraction[2]}{\useKV[ClesFraction]{Couleur}}%
+ }%
+ }%
+ }%
+}%
+
+%%%%%%%%%%%%%%%%
+%%% Réponses à relier
+%%%%%%%%%%%%%%%%
+\setKVdefault[ClesRelie]{Solution=false,LargeurG=5cm,LargeurD=2cm,Stretch=1.5,Ecart=2cm}
+
+\newcommand\Relie[2][]{%
+ \useKVdefault[ClesRelie]%
+ \setKV[ClesRelie]{#1}%
+ \setsepchar[*]{,*/}%
+ \readlist*\ListeRelie{#2}%
+ \buildtabrelie%
+ \ifboolKV[ClesRelie]{Solution}{%
+ \xintFor* ##1 in {\xintSeq {1}{\ListeRelielen}}\do{%
+ \itemtomacro\ListeRelie[##1,1]\untest
+ \ifx\bla\untest\bla%
+ \else
+ \tikz[remember picture,overlay]{\draw (RelieG-##1) -- (RelieD-\ListeRelie[##1,3]);}%
+ \fi
+ }%
+ }{%
+ }%
+}
+
+\newcounter{NbRelie}
+
+\def\buildtabrelie{%
+ \setcounter{NbRelie}{0}%
+ \renewcommand{\arraystretch}{\useKV[ClesRelie]{Stretch}}%
+ \begin{tabular}{p{\useKV[ClesRelie]{LargeurG}}cp{\useKV[ClesRelie]{Ecart}}>{\tikz[remember
+ picture]{\node[name=RelieD-\theNbRelie,inner
+ sep=0pt]{};\fill[] (RelieD-\theNbRelie) circle[radius=1.5pt]}}cp{\useKV[ClesRelie]{LargeurD}}}%
+ \xintFor* ##1 in {\xintSeq {1}{\ListeRelielen}}\do{\ListeRelie[##1,1]\itemtomacro\ListeRelie[##1,1]\untest%
+\ifx\bla\untest\bla%
+ \uppercase{&}\stepcounter{NbRelie}%
+ \else
+ \uppercase{&}\stepcounter{NbRelie}\tikz[remember
+ picture,overlay]{\node[name=RelieG-\theNbRelie,inner
+ sep=0pt]{};\fill[]
+ (RelieG-\theNbRelie) circle[radius=1.5pt];}
+\fi&&&\ListeRelie[##1,2]\\}%
+ \end{tabular}%
+ \setcounter{NbRelie}{0}%
+}%
+
+\def\buildtabrelieold{%
+ \setcounter{NbRelie}{0}%
+ \renewcommand{\arraystretch}{\useKV[ClesRelie]{Stretch}}%
+ \begin{tabular}{p{\useKV[ClesRelie]{LargeurG}}cp{\useKV[ClesRelie]{Ecart}}>{\tikz[remember
+ picture,baseline]{\node[name=RelieD-\theNbRelie]{\Large\textbullet};}}cp{\useKV[ClesRelie]{LargeurD}}}%
+ \xintFor* ##1 in {\xintSeq {1}{\ListeRelielen}}\do{\ListeRelie[##1,1]\itemtomacro\ListeRelie[##1,1]\untest%
+\ifx\bla\untest\bla%
+ \uppercase{&}\stepcounter{NbRelie}%
+ \else
+ \uppercase{&}\stepcounter{NbRelie}\tikz[remember picture,baseline]{\node[name=RelieG-\theNbRelie]{\Large\textbullet};}
+\fi&&&\ListeRelie[##1,2]\\}%
+ \end{tabular}%
+ \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}
+\newlength{\LargeurQCM}
+\newcounter{QuestionQCM}
+\newcommand\QCM[2][]{%
+ \setcounter{QuestionQCM}{0}
+ \useKVdefault[ClesQCM]%
+ \setKV[ClesQCM]{#1}%
+ \setsepchar[*]{,*&}\ignoreemptyitems%
+ \readlist*\ListeQCM{#2}%
+ \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|}{}&Vrai&Faux\\
+ \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}{\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}%
+ \\
+ }{}
+ \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]%
+ }\\
+ }%
+ \hline%
+ \end{tabular}%
+ }%
+}
+
+
+
+%%%%%%%%%%%%%%%%%%%%%
+%%%% Somme des angles
+%%%%%%%%%%%%%%%%%%%%%
+
+\setKVdefault[ClesSommeAngle]{Detail=true,Figure=false,Isocele=false}%
+
+% On définit la figure à utiliser
+\def\MPFigureSommeAngle#1#2#3#4#5#6{
+ % #1 Premier sommet
+ % #2 Deuxième sommet
+ % #3 Troisième sommet
+ % #4 1er angle
+ % #5 2eme angle
+ % #6 0 isocèle / 1 pas isocèle
+ \ifluatex
+ \mplibcodeinherit{enable}
+ \mplibforcehmode
+ \begin{mplibcode}
+ pair A,B,C,O,I;%
+ % On place les points A,B,C sur le cercle de manière à faciliter la rotation de la figure
+ A=u*(1,1);
+ B-A=u*(4,0);
+ C=(A--2[A,B rotatedabout(A,45)]) intersectionpoint (B--2[B,A rotatedabout(B,-60)]);
+ % On définit le centre du cercle circonscrit
+ 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 :)
+ path triangle;
+ triangle=A{dir(angle(B-A)+5)}..B{dir(angle(B-A)+5)}--B{dir(angle(C-B)+5)}..C{dir(angle(C-B)+5)}--C{dir(angle(A-C)+5)}..A{dir(angle(A-C)+5)}--cycle;
+ % pour marquer les angles
+ path cc;
+ cc=fullcircle scaled 1u;
+ % on marque les angles
+ picture MAngle;
+ MAngle=image(
+ draw (cc shifted A);
+ draw (cc shifted B);
+ draw (cc shifted C);
+ );
+ draw MAngle;
+ clip currentpicture to triangle;
+ 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
+ label(btex #1 etex,1.2[O,A]);
+ label(btex #2 etex,1.2[O,B]);
+ label(btex #3 etex,1.2[O,C]);
+ if #6=0:
+ if #4=#5:
+ marque_s:=marque_s/2;
+ 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));
+ label(btex $\ang{#5}$ etex,C+0.95u*unitvector(I-C));
+ label(btex ? etex,A+0.95u*unitvector(I-A));
+ fi;
+ %fi;
+ \end{mplibcode}
+ \mplibcodeinherit{disable}
+ \else
+ \begin{mpost}
+ input PfC-Geometrie;
+ u:=1cm;
+ pair A,B,C,O,I;%
+ % On place les points A,B,C sur le cercle de manière à faciliter la rotation de la figure
+ A=u*(1,1);
+ B-A=u*(4,0);
+ C=(A--2[A,B rotatedabout(A,45)]) intersectionpoint (B--2[B,A rotatedabout(B,-60)]);
+ % On définit le centre du cercle circonscrit
+ 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 :)
+ path triangle;
+ triangle=A{dir(angle(B-A)+5)}..B{dir(angle(B-A)+5)}--B{dir(angle(C-B)+5)}..C{dir(angle(C-B)+5)}--C{dir(angle(A-C)+5)}..A{dir(angle(A-C)+5)}--cycle;
+ % pour marquer les angles
+ path cc;
+ cc=fullcircle scaled 1u;
+ % on marque les angles
+ picture MAngle;
+ MAngle=image(
+ draw (cc shifted A);
+ draw (cc shifted B);
+ draw (cc shifted C);
+ );
+ draw MAngle;
+ clip currentpicture to triangle;
+ 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
+ label(btex #1 etex,1.2[O,A]);
+ label(btex #2 etex,1.2[O,B]);
+ label(btex #3 etex,1.2[O,C]);
+ if #6=0:
+ if #4=#5:
+ marque_s:=marque_s/2;
+ 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));
+ label(btex $\ang{#5}$ etex,C+0.95u*unitvector(I-C));
+ label(btex ? etex,A+0.95u*unitvector(I-A));
+ fi;
+ %fi;
+ \end{mpost}
+ \fi
+}
+
+\newcommand\RedactionSomme[4][]{%
+ % #1 : nom du triangle pA pB pC
+ % #2 : mesure de l'angle pApBpC
+ % #3 : mesure de l'angle pBpCpA
+ % la macro calculant la mesure de l'angle pCpApB
+ \useKVdefault[ClesSommeAngle]%obligatoire car la macro n'est pas dans un groupe.
+ \setKV[ClesSommeAngle]{#1}%On lit les arguments optionnels
+ % On récupère les noms des sommets.
+ \StrMid{#2}{1}{1}[\NomA]%
+ \StrMid{#2}{2}{2}[\NomB]%
+ \StrMid{#2}{3}{3}[\NomC]%
+ % On rédige
+ Dans le triangle $\NomA\NomB\NomC$,\ifboolKV[ClesSommeAngle]{Isocele}{ isocèle en \NomA,}{} on a :%
+ \ifboolKV[ClesSommeAngle]{Isocele}{%
+ \ifx#4\bla\bla%
+ \begin{align*}%
+ \widehat{\NomA\NomB\NomC}+\widehat{\NomB\NomC\NomA}+\widehat{\NomC\NomA\NomB}&=\ang{180}\\%
+ 2\times\ang{#3}+\widehat{\NomC\NomA\NomB}&=\ang{180}\\%
+ \xdef\sommeangle{\fpeval{2*#3}}\xdef\totalangle{\fpeval{180-\sommeangle}}\ang{\sommeangle}+\widehat{\NomC\NomA\NomB}&=\ang{180}\\%
+ \ifboolKV[ClesSommeAngle]{Detail}{\widehat{\NomC\NomA\NomB}&=\ang{180}-\ang{\sommeangle}\\}{\widehat{\NomC\NomA\NomB}&=\ang{\totalangle}}%
+ \ifboolKV[ClesSommeAngle]{Detail}{\widehat{\NomC\NomA\NomB}&=\ang{\totalangle}}{}%
+ \end{align*}%
+ \xdef\ResultatAngle{\totalangle}%
+ \else%
+ \begin{align*}%
+ \widehat{\NomA\NomB\NomC}+\widehat{\NomB\NomC\NomA}+\widehat{\NomC\NomA\NomB}&=\ang{180}\\%
+ 2\times\widehat{\NomA\NomB\NomC}+\ang{#4}&=\ang{180}\\%
+ \xdef\totalangle{\fpeval{180-#4}}%
+ \ifboolKV[ClesSommeAngle]{Detail}{2\times\widehat{\NomA\NomB\NomC}&=\ang{180}-\ang{#4}\\}{2\times\widehat{\NomA\NomB\NomC}&=\ang{\totalangle}\\}%
+ \ifboolKV[ClesSommeAngle]{Detail}{2\times\widehat{\NomA\NomB\NomC}&=\ang{\totalangle}\\}{\widehat{\NomA\NomB\NomC}&=\frac{\ang{\totalangle}}{2}\\}%
+ \ifboolKV[ClesSommeAngle]{Detail}{\widehat{\NomA\NomB\NomC}&=\frac{\ang{\totalangle}}{2}\\}{\widehat{\NomA\NomB\NomC}&=\ang{\fpeval{0.5*(180-#4)}}}%\\
+ \ifboolKV[ClesSommeAngle]{Detail}{\widehat{\NomA\NomB\NomC}&=\ang{\fpeval{0.5*(180-#4)}}\\}{}%
+ \end{align*}%
+ \xdef\ResultatAngle{\fpeval{0.5*(180-#4)}}%
+ \fi%
+ }{%
+ \begin{align*}%
+ \widehat{\NomA\NomB\NomC}+\widehat{\NomB\NomC\NomA}+\widehat{\NomC\NomA\NomB}&=\ang{180}\\%
+ \ang{#3}+\ang{#4}+\widehat{\NomC\NomA\NomB}&=\ang{180}\\%
+ \xdef\sommeangle{\fpeval{#3+#4}}\xdef\totalangle{\fpeval{180-\sommeangle}}\ang{\sommeangle}+\widehat{\NomC\NomA\NomB}&=\ang{180}\\%
+ \ifboolKV[ClesSommeAngle]{Detail}{\widehat{\NomC\NomA\NomB}&=\ang{180}-\ang{\sommeangle}\\}{\widehat{\NomC\NomA\NomB}&=\ang{\totalangle}}%\\
+ \ifboolKV[ClesSommeAngle]{Detail}{\widehat{\NomC\NomA\NomB}&=\ang{\totalangle}}{}%
+ \end{align*}%
+ \xdef\ResultatAngle{\totalangle}%
+ }%
+}%
+
+\newcommand\SommeAngles[4][]{%
+ % #1 : nom du triangle pA pB pC
+ % #2 : mesure de l'angle pApBpC
+ % #3 : mesure de l'angle pBpCpA
+ % la macro calculant la mesure de l'angle pCpApB
+ \useKVdefault[ClesSommeAngle]%obligatoire car la macro n'est pas dans un groupe.
+ \setKV[ClesSommeAngle]{#1}%On lit les arguments optionnels
+ % On récupère les noms des sommets.
+ \StrMid{#2}{1}{1}[\NomA]%
+ \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
+ \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}
+
+% On définit les figures à utiliser
+\def\MPFigurePytha#1#2#3#4#5#6{%
+ % #1 Premier sommet
+ % #2 Sommet de l'angle droit
+ % #3 troisième sommet
+ % #4 1ere longueur
+ % #5 2eme longueur
+ % #6 angle de rotation de la figure
+ \ifluatex
+ \mplibforcehmode
+ \begin{mplibcode}
+ u:=1cm;
+ pair A,B,C,O,D,E,F;%B est le sommet de l'angle droit
+ O=u*(2.5,2.5);
+ path cc;
+ cc=(fullcircle scaled 4u) shifted O;
+ % On place les points A,B,C sur le cercle de manière à faciliter la rotation de la figure
+ A=point(0.9*length cc) of cc;
+ B=A rotatedabout(O,-120);
+ C=2[A,O];
+ % On tourne pour éventuellement moins de lassitude :)
+ A:=A rotatedabout(O,#6);
+ B:=B rotatedabout(O,#6);
+ C:=C rotatedabout(O,#6);
+ % 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 #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
+ 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)));
+ fi;
+ fi;
+ label(btex #3 etex,1.2[O,A]);
+ label(btex #2 etex,1.2[O,B]);
+ label(btex #1 etex,1.2[O,C]);
+ \end{mplibcode}
+ \else
+ \begin{mpost}
+ u:=1cm;
+ pair A,B,C,O,D,E,F;%B est le sommet de l'angle droit
+ O=u*(2.5,2.5);
+ path cc;
+ cc=(fullcircle scaled 4u) shifted O;
+ % On place les points A,B,C sur le cercle de manière à faciliter la rotation de la figure
+ A=point(0.9*length cc) of cc;
+ B=A rotatedabout(O,-120);
+ C=2[A,O];
+ % On tourne pour éventuellement moins de lassitude :)
+ A:=A rotatedabout(O,#6);
+ B:=B rotatedabout(O,#6);
+ C:=C rotatedabout(O,#6);
+ % 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 #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
+ 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)));
+ fi;
+ fi;
+ label(btex #3 etex,1.2[O,A]);
+ label(btex #2 etex,1.2[O,B]);
+ label(btex #1 etex,1.2[O,C]);
+ \end{mpost}
+ \fi
+}
+
+\def\MPFigureReciPytha#1#2#3#4#5#6#7{%
+ % #1 Premier sommet
+ % #2 Sommet de l'angle droit
+ % #3 troisième sommet
+ % #4 1ere longueur
+ % #5 2eme longueur
+ % #6 3eme longueur
+ % #7 angle de rotation de la figure
+ \ifluatex
+ \mplibforcehmode
+ \begin{mplibcode}
+ u:=1cm;
+ pair A,B,C,O,D,E,F;%B est le sommet de l'angle droit
+ O=u*(2.5,2.5);
+ path cc;
+ cc=(fullcircle scaled 4u) shifted O;
+ % On place les points A,B,C sur le cercle de manière à faciliter la rotation de la figure
+ A=point(0.8*length cc) of cc;
+ B=A rotatedabout(O,-100);
+ C=2[A,O];
+ % On tourne pour éventuellement moins de lassitude :)
+ 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)));
+ 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)));
+ fi;
+ label(btex #1 etex,1.2[O,A]);
+ label(btex #2 etex,1.2[O,B]);
+ label(btex #3 etex,1.2[O,C]);
+ \end{mplibcode}
+ \else
+ \begin{mpost}
+ u:=1cm;
+ pair A,B,C,O,D,E,F;%B est le sommet de l'angle droit
+ O=u*(2.5,2.5);
+ path cc;
+ cc=(fullcircle scaled 4u) shifted O;
+ % On place les points A,B,C sur le cercle de manière à faciliter la rotation de la figure
+ A=point(0.8*length cc) of cc;
+ B=A rotatedabout(O,-100);
+ C=2[A,O];
+ % On tourne pour éventuellement moins de lassitude :)
+ 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));
+ label(LATEX("\num{"&decimal(#5)&"}") rotated(angle(C-B)),1/2[C,B]-decalage*(unitvector(C-B)));
+ label(LATEX("\num{"&decimal(#6)&"}") rotated(angle(B-A)),1/2[A,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(LATEX("\num{"&decimal(#6)&"}") rotated angle(C-B),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]);
+ label(btex #3 etex,1.2[O,C]);
+ \end{mpost}
+ \fi
+}
+
+\newcommand{\Pythagore}[5][]{%
+ % #1 Paramètres sous forme de clés
+ % #2 Nom "complet" du triangle : ABC par exemple
+ % #3 Première longueur
+ % #4 Deuxième longueur
+ % #5 Troisième longueur (éventuellement vide)
+ \useKVdefault[ClesPythagore]%obligatoire car la macro n'est pas dans un groupe.
+ \setKV[ClesPythagore]{#1}%On lit les arguments optionnels
+ \ifboolKV[ClesPythagore]{Reciproque}{%
+ % On retient les noms des sommets
+ \StrMid{#2}{1}{1}[\NomA]%
+ \StrMid{#2}{2}{2}[\NomB]%
+ \StrMid{#2}{3}{3}[\NomC]%
+ % on stocke les valeurs données
+ \opcopy{#3}{A1}%
+ \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
+ 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}}\\
+ \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}%
+ \opcopy{#4}{A2}%
+ \opcopy{\useKV[ClesPythagore]{Precision}}{pres}%
+ % On retient les noms des sommets
+ \StrMid{#2}{1}{1}[\NomA]%
+ \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%
+ % 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})}}%
+ \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*}
+ \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}}}}%\\
+ }
+ \end{align*}
+ }{%
+ \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%
+ }%
+ }%
+}%
+
+%%%%%%%%%%%%%%%%%
+%% 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]{%
+ \node[name=Distri-\theNbDistri,anchor=base] {${#1}$};}%
+ \stepcounter{NbDistri}%
+}%
+
+\newcommand{\DrawArrow}{%
+ \begin{tikzpicture}[overlay,remember picture]
+ \draw[-stealth,out=50,in=140,DCFlechesh,transform canvas={yshift=2pt}] (Distri-0.north) to (Distri-2.north);
+ \draw[-stealth,out=50,in=140,DCFlechesh!50,transform canvas={yshift=2pt}] (Distri-0.north) to (Distri-3.north);
+ \draw[-stealth,out=-50,in=-140,DCFlechesb,transform canvas={yshift=-2pt}] (Distri-1.south) to (Distri-2.south);
+ \draw[-stealth,out=-50,in=-140,DCFlechesb!50,transform canvas={yshift=-2pt}] (Distri-1.south) to (Distri-3.south);
+ \end{tikzpicture}
+}
+
+\newcommand{\DrawArrowSimple}[1]{%
+ \begin{tikzpicture}[overlay,remember picture]
+ \draw[-stealth,out=50,in=140,DCFlechesh,transform canvas={yshift=2pt}] (Distri-#1.north) to (Distri-2.north);
+ \draw[-stealth,out=50,in=140,DCFlechesh!50,transform canvas={yshift=2pt}] (Distri-#1.north) to (Distri-3.north);
+ \end{tikzpicture}
+}
+
+\newcommand{\DrawArrowSimpleRenverse}[1]{%
+ \begin{tikzpicture}[overlay,remember picture]
+ \draw[-stealth,out=140,in=50,DCFlechesh,transform canvas={yshift=2pt}] (Distri-#1.north) to (Distri-0.north);
+ \draw[-stealth,out=140,in=50,DCFlechesh!50,transform canvas={yshift=2pt}] (Distri-#1.north) to (Distri-1.north);
+ \end{tikzpicture}
+}
+
+\newcounter{NbDistri}%
+\setcounter{NbDistri}{0}%
+
+\newcounter{NbCalculDistri}%Pour compter combien de distributivité il
+% 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 ?
+
+\newcommand\Affichage[4][]{%
+ \setKV[ClesDistributivite]{#1}%On lit les arguments optionnels
+ \def\LETTRE{\useKV[ClesDistributivite]{Lettre}}%
+ \ensuremath{%
+ % partie du x^2
+ \xintifboolexpr{#2=0}{}{\xintifboolexpr{#2=1}{}{\xintifboolexpr{#2=-1}{-}{\num{#2}}}\LETTRE^2}%
+ % partie du x
+ \xintifboolexpr{#3=0}{}{\xintifboolexpr{#3>0}{\xintifboolexpr{#2=0}{}{+}\xintifboolexpr{#3=1}{}{\num{#3}}}{%
+ \xintifboolexpr{#2=0}{\xintifboolexpr{#3=-1}{-}{\num{#3}}}{\xintifboolexpr{#3=-1}{-}{-\num{\fpeval{abs(#3)}}}}%
+ }\LETTRE}%
+ % partie du nombre
+ \xintifboolexpr{#4=0}{}{\xintifboolexpr{#4>0}{\xintifboolexpr{#2=0}{\xintifboolexpr{#3=0}{}{+}}{+}\num{#4}}{%
+ \xintifboolexpr{#2=0}{\xintifboolexpr{#3=0}{\num{#4}}{-\num{\fpeval{abs(#4)}}}}{-\num{\fpeval{abs(#4)}}}}}%
+ %
+ }%
+}%
+
+\xdef\SommeA{0}%
+\xdef\SommeB{0}%
+\xdef\SommeC{0}%
+
+\newcommand{\Distri}[5][]{%
+ \ensuremath{%
+ \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}}%
+ \colorlet{DCFlechesh}{\useKV[ClesDistributivite]{CouleurFH}}%
+ \colorlet{DCFlechesb}{\useKV[ClesDistributivite]{CouleurFB}}%
+ \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)}}%
+ }{%
+ \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}}%
+ \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}{)}{}%
+ }%
+ \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}{)}{}}%
+ }%
+ }{%
+ \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
+ \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}}}%\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}}}{}%
+ }{}%
+ }%
+ }%
+ }%
+ }%
+ }%
+}%
+
+\newcommand{\Resultat}[1][]{%
+ \setKV[ClesDistributivite]{#1}%On lit les arguments optionnels
+ \ensuremath{%
+ \Affichage{\SommeA}{\SommeB}{\SommeC}
+ }
+}
+
+\newcommand\AffichageEchange[4][]{%
+ \setKV[ClesDistributivite]{#1}%On lit les arguments optionnels
+ \def\LETTRE{\useKV[ClesDistributivite]{Lettre}}%
+ \ensuremath{%
+ % partie du nombre
+ \xintifboolexpr{#2=0}{}{\num{#2}}%
+ % partie du x
+ \xintifboolexpr{#3=0}{}{\xintifboolexpr{#3>0}{\xintifboolexpr{#2=0}{}{+}\xintifboolexpr{#3=1}{}{\num{#3}}}{%
+ \xintifboolexpr{#2=0}{\xintifboolexpr{#3=-1}{-}{\num{#3}}}{\xintifboolexpr{#3=-1}{-}{-\num{\fpeval{abs(#3)}}}}
+ }\LETTRE}%
+ % partie du x^2
+ \xintifboolexpr{#4=0}{}{\xintifboolexpr{#4>0}{\xintifboolexpr{#2=0}{\xintifboolexpr{#3=0}{}{+}}{+}\xintifboolexpr{#4=1}{}{\num{#4}}}{%
+ \xintifboolexpr{#2=0}{\xintifboolexpr{#3=0}{\num{#4}}{-\num{\fpeval{abs(#4)}}}}{-\num{\fpeval{abs(#4)}}}}\LETTRE^2}%
+ }%
+}%
+
+\newcommand{\DistriEchange}[5][]{%
+ \ensuremath{%
+ \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}}%
+ \colorlet{DCFlechesh}{\useKV[ClesDistributivite]{CouleurFH}}%
+ \colorlet{DCFlechesb}{\useKV[ClesDistributivite]{CouleurFB}}%
+ \ifboolKV[ClesDistributivite]{Remarquable}{%
+ \xintifboolexpr{\useKV[ClesDistributivite]{Etape}=1}{\ifx\bla#4\bla(\AffichageEchange{#2}{#3}{0})^2\else(\AffichageEchange{#2}{#3}{0})(\AffichageEchange{#4}{#5}{0})\fi
+ }{}
+ \xintifboolexpr{\useKV[ClesDistributivite]{Etape}=2}{%
+ \ifx\bla#4\bla\xintifboolexpr{#3>0}{%
+ \num{#2}^2+2\times\num{#2}\times\xintifboolexpr{#3=1}{}{\num{#3}}\useKV[ClesDistributivite]{Lettre}+
+ \xintifboolexpr{#3=1}{}{(\num{#3}}\useKV[ClesDistributivite]{Lettre}\xintifboolexpr{#3=1}{}{)}^2%
+ }{%
+ \num{#2}^2-2\times\num{#2}\times\xintifboolexpr{#3=-1}{}{\num{\fpeval{0-#3}}}\useKV[ClesDistributivite]{Lettre}+
+ \xintifboolexpr{#3=-1}{}{(\num{\fpeval{0-#3}}}\useKV[ClesDistributivite]{Lettre}\xintifboolexpr{#3=-1}{}{)}^2%
+ }%
+ \else\num{#2}^2-\xintifboolexpr{#3=1}{}{(\num{#3}}\useKV[ClesDistributivite]{Lettre}\xintifboolexpr{#3=1}{}{)}^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}{(}{}\AffichageEchange{\Multi}{0}{0}\xintifboolexpr{\Multi<0}{)}{}}%
+ \xintifboolexpr{\Multim=0}{}{\xintifboolexpr{\Multim>0}{+}{+(}\AffichageEchange{0}{\Multim}{0}\xintifboolexpr{\Multim<0}{)}{}}%
+ \xintifboolexpr{\Multil=0}{}{\xintifboolexpr{\Multil>0}{+}{+(}\AffichageEchange{0}{0}{\Multil}\xintifboolexpr{\Multil<0}{)}{}}%
+ }{%
+ \AffichageEchange{\Multi}{\Multim}{\Multil}%
+ }
+ \ifboolKV[ClesDistributivite]{Somme}{\xdef\SommeA{\fpeval{\SommeA+#3*#3}}\xdef\SommeB{\fpeval{\SommeB+#2*#3+#3*#2}}\xdef\SommeC{\fpeval{\SommeC+#2*#2}}}{}%
+ \ifboolKV[ClesDistributivite]{Difference}{\xdef\SommeA{\fpeval{\SommeA-#3*#3}}\xdef\SommeB{\fpeval{\SommeB-#2*#3-#3*#2}}\xdef\SommeC{\fpeval{\SommeC-#2*#2}}}{}%
+ \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}{(}{}\AffichageEchange{\Multi}{0}{0}\xintifboolexpr{\Multi<0}{)}{}}%
+ \xintifboolexpr{\Multim=0}{}{\xintifboolexpr{\Multim>0}{+}{+(}\AffichageEchange{0}{\Multim}{0}\xintifboolexpr{\Multim<0}{)}{}}%
+ \xintifboolexpr{\Multil=0}{}{\xintifboolexpr{\Multil>0}{+}{+(}\AffichageEchange{0}{0}{\Multil}\xintifboolexpr{\Multil<0}{)}{}}%
+ }{%
+ \AffichageEchange{\Multi}{\Multim}{\Multil}%
+ }
+ % à faire
+ \ifboolKV[ClesDistributivite]{Somme}{\xdef\SommeA{\fpeval{\SommeA+#3*#5}}\xdef\SommeB{\fpeval{\SommeB+#2*#5+#3*#4}}\xdef\SommeC{\fpeval{\SommeC+#2*#4}}}{}%
+ \ifboolKV[ClesDistributivite]{Difference}{\xdef\SommeA{\fpeval{\SommeA-#3*#5}}\xdef\SommeB{\fpeval{\SommeB-#2*#5-#3*#4}}\xdef\SommeC{\fpeval{\SommeC-#2*#4}}}{}%
+ %
+ \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}}%
+ \xdef\ValeurEchange{\useKV[ClesDistributivite]{Echange}}
+ \xintFor* ##1 in {\xintSeq {1}{\useKV[ClesDistributivite]{Fin}-1}}\do
+ {\NomLettre&=\DistriEchange[Echange=\ValeurEchange,Etape=##1]{#2}{#3}{#4}{#5}\\}%
+ \NomLettre&=\DistriEchange[Echange=\ValeurEchange,Etape=\NomFin]{#2}{#3}{#4}{#5}%
+ }{%
+ % Etape 1
+ \xintifboolexpr{\useKV[ClesDistributivite]{Etape}=1}{%
+ \xintifboolexpr{\useKV[ClesDistributivite]{Echange}=1||\useKV[ClesDistributivite]{Echange}=3}{%
+ \xintifboolexpr{#2=0}{%
+ }{\xintifboolexpr{#3=0}{%
+ }{(}}\Tikzmark{\Affichage[#1]{0}{0}{#2}}%
+ \ifboolKV[ClesDistributivite]{AideAdda}{\mathcolor{DCAide}{+(}}{}%
+ \xintifboolexpr{#3>0}{\xintifboolexpr{#2=0}{}{+}}{\xintifboolexpr{#3<0}{-}{}}\Tikzmark{\Affichage[#1]{0}{\fpeval{abs(#3)}}{0}}%
+ \ifboolKV[ClesDistributivite]{AideAdda}{\mathcolor{DCAide}{)}}{}%
+ \xintifboolexpr{#2=0}{%
+ }{\xintifboolexpr{#3=0}{%
+ }{)}}%
+ }{
+ \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{\useKV[ClesDistributivite]{Echange}=2||\useKV[ClesDistributivite]{Echange}=3}{%
+ \xintifboolexpr{\Multi=0}{\times%
+ \xintifboolexpr{#4<0}{(}{\xintifboolexpr{#5<0}{(}{}}}{(}%
+ \Tikzmark{\AffichageEchange[#1]{#4}{0}{0}}%
+ \ifboolKV[ClesDistributivite]{AideAddb}{\mathcolor{DCAide}{+(}}{}%
+ \xintifboolexpr{#5>0}{\xintifboolexpr{#4=0}{}{+}}{\xintifboolexpr{#5<0}{-}{}}\Tikzmark{\AffichageEchange[#1]{0}{\fpeval{abs(#5)}}{0}}%
+ \ifboolKV[ClesDistributivite]{AideAddb}{\mathcolor{DCAide}{)}}{}%
+ \xintifboolexpr{\Multi=0}{%
+ \xintifboolexpr{#4<0}{)}{\xintifboolexpr{#5<0}{)}{}}}{)}%
+ }{%
+ \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}}%
+ \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}{%
+ \xintifboolexpr{\useKV[ClesDistributivite]{Echange}=1}{%
+ \xdef\Multi{\fpeval{#2*#4}}%
+ \xintifboolexpr{\Multi=0}{}{%
+ \xintifboolexpr{#2<0}{(}{}\AffichageEchange[#1]{#2}{0}{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}{(}{}\AffichageEchange[#1]{#2}{0}{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}{(}{}\AffichageEchange[#1]{0}{#3}{0}\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}{(}{}\AffichageEchange[#1]{0}{#3}{0}\xintifboolexpr{#3<0}{)}{}\times\xintifboolexpr{#5<0}{(}{}\Affichage[#1]{0}{0}{#5}\xintifboolexpr{#5<0}{)}{}%
+ }%
+ }{}%
+ \xintifboolexpr{\useKV[ClesDistributivite]{Echange}=2}{%
+ \xdef\Multi{\fpeval{#2*#4}}%
+ \xintifboolexpr{\Multi=0}{}{%
+ \xintifboolexpr{#2<0}{(}{}\Affichage[#1]{0}{#2}{0}\xintifboolexpr{#2<0}{)}{}\times\xintifboolexpr{#4<0}{(}{}\AffichageEchange[#1]{#4}{0}{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}{(}{}\AffichageEchange[#1]{0}{#5}{0}\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}{(}{}\AffichageEchange[#1]{#4}{0}{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}{(}{}\AffichageEchange[#1]{0}{#5}{0}\xintifboolexpr{#5<0}{)}{}%
+ }%
+ }{}%
+ \xintifboolexpr{\useKV[ClesDistributivite]{Echange}=3}{%
+ \xdef\Multi{\fpeval{#2*#4}}%
+ \xintifboolexpr{\Multi=0}{}{%
+ \xintifboolexpr{#2<0}{(}{}\AffichageEchange[#1]{#2}{0}{0}\xintifboolexpr{#2<0}{)}{}\times\xintifboolexpr{#4<0}{(}{}\AffichageEchange[#1]{#4}{0}{0}\xintifboolexpr{#4<0}{)}{}%
+ }%
+ \xdef\Multij{\fpeval{#2*#5}}%
+ \xintifboolexpr{\Multij=0}{}{%
+ \xintifboolexpr{\Multi=0}{}{+}%
+ \xintifboolexpr{#2<0}{(}{}\AffichageEchange[#1]{#2}{0}{0}\xintifboolexpr{#2<0}{)}{}\times\xintifboolexpr{#5<0}{(}{}\AffichageEchange[#1]{0}{#5}{0}\xintifboolexpr{#5<0}{)}{}%
+ }%
+ \xdef\Multik{\fpeval{#3*#4}}%
+ \xintifboolexpr{\Multik=0}{}{%
+ \xintifboolexpr{\Multi=0}{}{+}%
+ \xintifboolexpr{#3<0}{(}{}\AffichageEchange[#1]{0}{#3}{0}\xintifboolexpr{#3<0}{)}{}\times\xintifboolexpr{#4<0}{(}{}\AffichageEchange[#1]{#4}{0}{0}\xintifboolexpr{#4<0}{)}{}%
+ }%
+ \xdef\Multil{\fpeval{#3*#5}}%
+ \xintifboolexpr{\Multil=0}{}{+%
+ \xintifboolexpr{#3<0}{(}{}\AffichageEchange[#1]{0}{#3}{0}\xintifboolexpr{#3<0}{)}{}\times\xintifboolexpr{#5<0}{(}{}\AffichageEchange[#1]{0}{#5}{0}\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
+ \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}{)}{}%
+ \xdef\Multim{\fpeval{#2*#4+#3*#5}}%
+ \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}}}{}%
+ }{}%
+ \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}{)}{}%
+ \xdef\Multim{\fpeval{#2*#4+#3*#5}}%
+ \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}}}{}%
+ }{}%
+ \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}{)}{}%
+ \xdef\Multim{\fpeval{#2*#5+#3*#4}}%
+ \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}}}{}%
+ }{}%
+ }{}%fin etape3
+ % 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
+ % 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}{%
+ \xdef\Multiko{\fpeval{-\Multik}}%
+ \xdef\Multimo{\fpeval{-\Multim}}%
+ \xdef\Multijo{\fpeval{-\Multij}}%
+ \xintifboolexpr{\Multiko=0}{}{\xintifboolexpr{\Multiko<0}{(}{}\Affichage{\Multiko}{0}{0}\xintifboolexpr{\Multiko<0}{)}{}}%
+ \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}}}{}%
+ }{}%
+ \xintifboolexpr{\useKV[ClesDistributivite]{Echange}=2}{%
+ \xdef\Multim{\fpeval{#2*#4+#3*#5}}%
+ \ifboolKV[ClesDistributivite]{Oppose}{%
+ \xdef\Multijo{\fpeval{-\Multij}}%
+ \xdef\Multimo{\fpeval{-\Multim}}%
+ \xdef\Multiko{\fpeval{-\Multik}}%
+ \xintifboolexpr{\Multijo=0}{}{\xintifboolexpr{\Multijo<0}{(}{}\Affichage{\Multijo}{0}{0}\xintifboolexpr{\Multijo<0}{)}{}}%
+ \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}}}{}%
+ }{}%
+ \xintifboolexpr{\useKV[ClesDistributivite]{Echange}=3}{%
+ \xdef\Multim{\fpeval{#2*#5+#3*#4}}%
+ \ifboolKV[ClesDistributivite]{Oppose}{%
+ \xdef\Multilo{\fpeval{-\Multil}}%
+ \xdef\Multimo{\fpeval{-\Multim}}%
+ \xdef\Multio{\fpeval{-\Multi}}%
+ \xintifboolexpr{\Multilo=0}{}{\xintifboolexpr{\Multilo<0}{(}{}\Affichage{\Multilo}{0}{0}\xintifboolexpr{\Multilo<0}{)}{}}%
+ \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}}}{}%
+ }{}%
+ }{}%
+ }%
+ }%
+ }%
+ }%
+}%
+
+%%%%%%%%%%%%%%%
+%Nombre Premier
+%%%%%%%%%%%%%%%
+\setKVdefault[ClesNombrePremier]{Tableau=false,TableauVertical=false,TableauVerticalVide=false,Exposant=false,Longue=false,All=false,Arbre=false,ArbreVide=false,ArbreComplet=false,Diviseurs=false}
+
+\newcommand\Decomposition[2][]{%
+ \useKVdefault[ClesNombrePremier]%
+ \setKV[ClesNombrePremier]{#1}%
+ \ifboolKV[ClesNombrePremier]{Tableau}{\NombrePremier{#2}}{}%
+ \ifboolKV[ClesNombrePremier]{TableauVertical}{\NombrePremierVertical{#2}}{}%
+ \ifboolKV[ClesNombrePremier]{TableauVerticalVide}{\NombrePremierVerticalVide{#2}}{}%
+ \ifboolKV[ClesNombrePremier]{Exposant}{\PremierExposant{#2}}{}%
+ \ifboolKV[ClesNombrePremier]{Longue}{\PremierLong{#2}}{}%
+ \ifboolKV[ClesNombrePremier]{All}{\NombrePremierExposant{#2}}{}%
+ \ifboolKV[ClesNombrePremier]{Arbre}{\MPArbre{#2}}{}%
+ \ifboolKV[ClesNombrePremier]{ArbreComplet}{\MPArbreComplet{#2}}{}%
+ \ifboolKV[ClesNombrePremier]{Diviseurs}{\ListeDiviseur{#2}}{}%
+ \ifboolKV[ClesNombrePremier]{ArbreVide}{\MPArbreVide{#2}}{}%
+}
+
+\def\MPArbre#1{%
+ \ifluatex
+ \mplibforcehmode
+ \begin{mplibcode}
+ numeric depart;
+ pair Ancre[];
+ numeric decalage;
+ decalage=10mm;
+
+ vardef PremierSimple(expr NB)=
+ b:=2;
+ depart:=NB;
+ if Estcepremier(depart)=false:
+ forever:
+ if (depart mod b)=0:
+ Ancre[k+1]-Ancre[k]=(-decalage*0.5,-decalage);
+ Ancre[k+2]-Ancre[k+1]=(decalage,0);
+ depart:=depart div b;
+ label(TEX("\num{"&decimal(b)&"}"),Ancre[k+1]);
+ label(TEX("\num{"&decimal(depart)&"}"),Ancre[k+2]);
+ draw 1/5[Ancre[k],Ancre[k+1]]--4/5[Ancre[k],Ancre[k+1]];
+ draw 1/5[Ancre[k],Ancre[k+2]]--4/5[Ancre[k],Ancre[k+2]];
+ k:=k+2;
+ racine:=depart;
+ depart:=1;
+ else:
+ b:=b+1;
+ fi;
+ exitif depart=1;
+ endfor;
+ else:
+ racine:=1;
+ fi;
+enddef;
+
+vardef Estcepremier(expr NBa)=
+ boolean $;
+ c:=2;
+ departa:=NBa;
+ test:=1;
+ $=true;
+ if departa=1:
+ $:=false;
+ else:
+ forever:
+ if (departa mod c)=0:
+ departa:=departa div c;
+ test:=test+1;
+ else:
+ c:=c+1;
+ fi;
+ exitif departa=1;
+ endfor;
+ fi;
+ if test=2:
+ $:=true
+ else:
+ $:=false;
+ fi;
+ $
+ enddef;
+ k:=0;
+ Ancre0:=(0,0);
+ racine:=#1;
+
+ label(btex \num{#1} etex,(0,0));
+ forever:
+ PremierSimple(racine);
+ exitif racine=1;
+ endfor;
+ \end{mplibcode}
+ \else
+ \begin{mpost}
+ numeric depart;
+ pair Ancre[];
+ numeric decalage;
+ decalage=10mm;
+
+ vardef PremierSimple(expr NB)=
+ b:=2;
+ depart:=NB;
+ if Estcepremier(depart)=false:
+ forever:
+ if (depart mod b)=0:
+ Ancre[k+1]-Ancre[k]=(-decalage*0.5,-decalage);
+ Ancre[k+2]-Ancre[k+1]=(decalage,0);
+ depart:=depart div b;
+ label(LATEX("\num{"&decimal(b)&"}"),Ancre[k+1]);
+ label(LATEX("\num{"&decimal(depart)&"}"),Ancre[k+2]);
+ draw 1/5[Ancre[k],Ancre[k+1]]--4/5[Ancre[k],Ancre[k+1]];
+ draw 1/5[Ancre[k],Ancre[k+2]]--4/5[Ancre[k],Ancre[k+2]];
+ k:=k+2;
+ racine:=depart;
+ depart:=1;
+ else:
+ b:=b+1;
+ fi;
+ exitif depart=1;
+ endfor;
+ else:
+ racine:=1;
+ fi;
+enddef;
+
+vardef Estcepremier(expr NBa)=
+ boolean $;
+ c:=2;
+ departa:=NBa;
+ test:=1;
+ $=true;
+ if departa=1:
+ $:=false;
+ else:
+ forever:
+ if (departa mod c)=0:
+ departa:=departa div c;
+ test:=test+1;
+ else:
+ c:=c+1;
+ fi;
+ exitif departa=1;
+ endfor;
+ fi;
+ if test=2:
+ $:=true
+ else:
+ $:=false;
+ fi;
+ $
+ enddef;
+
+ k:=0;
+ Ancre0:=(0,0);
+ racine:=#1;
+ label(LATEX("\num{"&decimal(racine)&"}"),(0,0));
+ forever:
+ PremierSimple(racine);
+ exitif racine=1;
+ endfor;
+\end{mpost}
+\fi
+}
+
+\def\MPArbreComplet#1{%
+ \ifluatex
+ \mplibforcehmode
+ \begin{mplibcode}
+ beginfig(1);
+ numeric depart;
+ pair Ancre[];
+ numeric decalage;
+ decalage=7.5mm;
+
+vardef NbEtape(expr nb)=
+ b:=2;
+ depart:=nb;
+ etape:=0;
+ Stock[0][0]=depart;
+ forever:
+ if (depart mod b)=0:
+ etape:=etape+1;
+ if etape=1:
+ Stock[etape][0]=b;
+ Stock[etape][etape]:=depart div b;
+ else:
+ for k=0 upto etape-2:
+ Stock[etape][k]:=Stock[etape-1][k];
+ endfor;
+ Stock[etape][etape-1]:=b;
+ Stock[etape][etape]:=depart div b;
+ fi;
+ depart:=depart div b;
+ else:
+ b:=b+1;
+ fi;
+ exitif depart=1;
+ endfor;
+ etape
+enddef;
+
+dx:=1cm;
+dy:=1cm;
+
+pair N[][];
+
+vardef Positions(expr Step)=
+ for k=0 upto (Step-1):
+ for l=0 upto k:
+ N[k][l]=(-k*dx+(l+k*.5)*dx,-k*dy);
+ label(TEX("\num{"&decimal(Stock[k][l])&"}"),N[k][l]);
+ endfor;
+ for l=0 upto k-1:
+ label(btex $\times$ etex,1/2[N[k][l],N[k][l+1]]);
+ endfor;
+ endfor;
+ for k=0 upto (Step-1):
+ for l=0 upto (k-1):
+ draw 1/5[N[k][l],N[k-1][l]]--4/5[N[k][l],N[k-1][l]];
+ endfor;
+ if k>0:
+ draw 1/5[N[k][k],N[k-1][k-1]]--4/5[N[k][k],N[k-1][k-1]];
+ fi;
+ endfor;
+ enddef;
+
+ Positions(NbEtape(#1));
+ \end{mplibcode}
+ \else
+ \begin{mpost}
+ numeric depart;
+pair Ancre[];
+numeric decalage;
+decalage=7.5mm;
+
+vardef NbEtape(expr nb)=
+ b:=2;
+ depart:=nb;
+ etape:=0;
+ Stock[0][0]=depart;
+ forever:
+ if (depart mod b)=0:
+ etape:=etape+1;
+ if etape=1:
+ Stock[etape][0]=b;
+ Stock[etape][etape]:=depart div b;
+ else:
+ for k=0 upto etape-2:
+ Stock[etape][k]:=Stock[etape-1][k];
+ endfor;
+ Stock[etape][etape-1]:=b;
+ Stock[etape][etape]:=depart div b;
+ fi;
+ depart:=depart div b;
+ else:
+ b:=b+1;
+ fi;
+ exitif depart=1;
+ endfor;
+ etape
+enddef;
+
+dx:=1cm;
+dy:=1cm;
+
+pair N[][];
+
+vardef Positions(expr Step)=
+ for k=0 upto (Step-1):
+ for l=0 upto k:
+ N[k][l]=(-k*dx+(l+k*.5)*dx,-k*dy);
+ label(LATEX("\num{"&decimal(Stock[k][l])&"}"),N[k][l]);
+ endfor;
+ for l=0 upto k-1:
+ label(btex $\times$ etex,1/2[N[k][l],N[k][l+1]]);
+ endfor;
+ endfor;
+ for k=0 upto (Step-1):
+ for l=0 upto (k-1):
+ draw 1/5[N[k][l],N[k-1][l]]--4/5[N[k][l],N[k-1][l]];
+ endfor;
+ if k>0:
+ draw 1/5[N[k][k],N[k-1][k-1]]--4/5[N[k][k],N[k-1][k-1]];
+ fi;
+ endfor;
+ enddef;
+
+ Positions(NbEtape(#1));
+ \end{mpost}
+ \fi
+}
+
+\def\MPArbreVide#1{%
+ \ifluatex
+ \mplibforcehmode
+ \begin{mplibcode}
+ numeric depart;
+ pair Ancre[];
+ numeric decalage;
+ decalage=7.5mm;
+
+vardef NbEtape(expr nb)=
+ b:=2;
+ depart:=nb;
+ etape:=0;
+ Stock[0][0]=depart;
+ forever:
+ if (depart mod b)=0:
+ etape:=etape+1;
+ if etape=1:
+ Stock[etape][0]=b;
+ Stock[etape][etape]:=depart div b;
+ else:
+ for k=0 upto etape-2:
+ Stock[etape][k]:=Stock[etape-1][k];
+ endfor;
+ Stock[etape][etape-1]:=b;
+ Stock[etape][etape]:=depart div b;
+ fi;
+ depart:=depart div b;
+ else:
+ b:=b+1;
+ fi;
+ exitif depart=1;
+ endfor;
+ etape
+enddef;
+
+dx:=1cm;
+dy:=1cm;
+
+pair N[][];
+
+vardef Positions(expr Step)=
+
+ for k=0 upto (Step-1):
+ for l=0 upto k:
+ N[k][l]=(-k*dx+(l+k*.5)*dx,-k*dy);
+ endfor;
+ for l=0 upto k-1:
+ label(btex $\times$ etex,1/2[N[k][l],N[k][l+1]]);
+ endfor;
+ endfor;
+ for k=0 upto (Step-1):
+ for l=0 upto (k-1):
+ draw 1/5[N[k][l],N[k-1][l]]--4/5[N[k][l],N[k-1][l]];
+ endfor;
+ if k>0:
+ draw 1/5[N[k][k],N[k-1][k-1]]--4/5[N[k][k],N[k-1][k-1]];
+ fi;
+ endfor;
+ label(TEX("\num{"&decimal(Stock[0][0])&"}"),N[0][0]);
+ enddef;
+
+ Positions(NbEtape(#1));
+ \end{mplibcode}
+ \else
+ \begin{mpost}
+ numeric depart;
+ pair Ancre[];
+numeric decalage;
+decalage=7.5mm;
+
+vardef NbEtape(expr nb)=
+ b:=2;
+ depart:=nb;
+ etape:=0;
+ Stock[0][0]=depart;
+ forever:
+ if (depart mod b)=0:
+ etape:=etape+1;
+ if etape=1:
+ Stock[etape][0]=b;
+ Stock[etape][etape]:=depart div b;
+ else:
+ for k=0 upto etape-2:
+ Stock[etape][k]:=Stock[etape-1][k];
+ endfor;
+ Stock[etape][etape-1]:=b;
+ Stock[etape][etape]:=depart div b;
+ fi;
+ depart:=depart div b;
+ else:
+ b:=b+1;
+ fi;
+ exitif depart=1;
+ endfor;
+ etape
+enddef;
+
+dx:=1cm;
+dy:=1cm;
+
+pair N[][];
+
+vardef Positions(expr Step)=
+
+ for k=0 upto (Step-1):
+ for l=0 upto k:
+ N[k][l]=(-k*dx+(l+k*.5)*dx,-k*dy);
+ endfor;
+ for l=0 upto k-1:
+ label(btex $\times$ etex,1/2[N[k][l],N[k][l+1]]);
+ endfor;
+ endfor;
+ for k=0 upto (Step-1):
+ for l=0 upto (k-1):
+ draw 1/5[N[k][l],N[k-1][l]]--4/5[N[k][l],N[k-1][l]];
+ endfor;
+ if k>0:
+ draw 1/5[N[k][k],N[k-1][k-1]]--4/5[N[k][k],N[k-1][k-1]];
+ fi;
+ endfor;
+ label(LATEX("\num{"&decimal(Stock[0][0])&"}"),N[0][0]);
+ enddef;
+
+ Positions(NbEtape(#1));
+ \end{mpost}
+ \fi
+}
+
+\newcount\premier
+
+\newcommand{\NombrePremier}[1]{%écrire la décomposition complète
+ % #1 le nombre premier à tester
+ \newcount\anp\newcount\bnp\newcount\cnp%\newcount\e\newcount\f%
+ \anp=#1\relax
+ \bnp=2\relax
+ \premier=-1\relax
+ % Pour déterminer le nombre d'étapes
+ \whiledo{\anp > 1}{%
+ \modulo{\the\anp}{\the\bnp}
+ \ifnum\remainder=0\relax
+ \global\premier=\numexpr\premier+1\relax
+ \cnp=\numexpr\anp/\bnp\relax
+ \anp=\cnp\relax
+ \else%
+ \bnp=\numexpr\bnp+1\relax%
+ \fi%
+ }
+ \ifnum\premier=0
+ Le nombre \num{#1} est un nombre premier.
+ \else
+ \begin{align*}
+ \xintFor* ##1 in {\xintSeq {1}{\premier}}\do {\num{#1}&=\PremierEtape{#1}{##1}\xintifboolexpr{##1<\premier}{\\}{}}%
+ \end{align*}
+ \fi
+}
+
+\newcommand{\NombrePremierVertical}[1]{%écrire la décomposition complète
+ % #1 le nombre premier à tester
+ \newcount\anpv\newcount\bnpv\newcount\cnpv%\newcount\e\newcount\f%
+ \anpv=#1\relax
+ \bnpv=2\relax
+ \premier=-1\relax
+ % Pour déterminer le nombre d'étapes
+ \whiledo{\anpv > 1}{%
+ \modulo{\the\anpv}{\the\bnpv}
+ \ifnum\remainder=0\relax
+ \global\premier=\numexpr\premier+1\relax
+ \cnpv=\numexpr\anpv/\bnpv\relax
+ \anpv=\cnpv\relax
+ \else%
+ \bnpv=\numexpr\bnpv+1\relax%
+ \fi%
+ }
+ \ifnum\premier=0
+ Le nombre \num{#1} est un nombre premier.
+ \else
+ \begin{tabular}{c|c}
+ \xintFor* ##1 in {\xintSeq {0}{\premier}}\do
+ {\PremierMultipleVide{#1}{##1}&\xdef\Etape{\fpeval{##1+1}}\PremierDiviseurVide{#1}{\Etape}
+ \xintifboolexpr{##1<\premier}{\\}{\\1\\}}%
+ \end{tabular}
+ \fi
+}
+
+\newcommand{\PremierDiviseurVide}[2]{%
+ %#1 : le nombre entier à tester
+ %#2 : le nombre d'étapes à effectuer
+ \newcount\anpvv\newcount\bnpvv\newcount\cnpvv\newcount\dnpvv%
+ \ensuremath{%
+ \anpvv=#1\relax
+ \bnpvv=2\relax
+ \dnpvv=0\relax%
+ \whiledo{\anpvv > 1}{%
+ \whiledo{\dnpvv < \number#2}{%
+ \modulo{\the\anpvv}{\the\bnpvv}
+ \ifnum\remainder=0\relax
+ \dnpvv=\numexpr\dnpvv+1\relax
+ \cnpvv=\numexpr\anpvv/\bnpvv\relax
+ \anpvv=\cnpvv\relax
+ %\num{\the\bnpvv}%
+ \else%
+ \bnpvv=\numexpr\bnpvv+1\relax%
+ \fi%
+ }
+ \num{\the\bnpvv}%
+ \anpvv=1%
+ }
+ }
+}
+
+\newcommand{\PremierMultipleVide}[2]{%
+ %#1 : le nombre entier à tester
+ %#2 : le nombre d'étapes à effectuer
+ \newcount\anpmv\newcount\bnpmv\newcount\cnpmv\newcount\dnpmv%
+ \ensuremath{%
+ \anpmv=#1\relax
+ \bnpmv=2\relax
+ \dnpmv=0\relax%
+ \whiledo{\anpmv > 1}{%
+ \whiledo{\dnpmv < \number#2}{%
+ \modulo{\the\anpmv}{\the\bnpmv}
+ \ifnum\remainder=0\relax
+ \dnpmv=\numexpr\dnpmv+1\relax
+ \cnpmv=\numexpr\anpmv/\bnpmv\relax
+ \anpmv=\cnpmv\relax
+ %\num{\the\bnpmv}
+ \else%
+ \bnpmv=\numexpr\bnpmv+1\relax%
+ \fi%
+ }
+ \num{\the\anpmv}%
+ \anpmv=1%
+ }
+ }
+}
+
+\newcommand{\NombrePremierVerticalVide}[1]{%écrire la décomposition complète
+ % #1 le nombre premier à tester
+ \newcount\anpv\newcount\bnpv\newcount\cnpv%\newcount\e\newcount\f%
+ \anpv=#1\relax
+ \bnpv=2\relax
+ \premier=-1\relax
+ % Pour déterminer le nombre d'étapes
+ \whiledo{\anpv > 1}{%
+ \modulo{\the\anpv}{\the\bnpv}
+ \ifnum\remainder=0\relax
+ \global\premier=\numexpr\premier+1\relax
+ \cnpv=\numexpr\anpv/\bnpv\relax
+ \anpv=\cnpv\relax
+ \else%
+ \bnpv=\numexpr\bnpv+1\relax%
+ \fi%
+ }
+ \ifnum\premier=0
+ Le nombre \num{#1} est un nombre premier.
+ \else
+ \renewcommand{\arraystretch}{1.5}
+ \begin{tabular}{c|c}
+ \PremierMultipleVide{#1}{0}&\hbox to1cm{\dotfill}\\
+ \xintFor* ##1 in {\xintSeq {1}{\premier}}\do
+ {\hbox to1cm{\dotfill}&\hbox
+ to1cm{\dotfill}\xintifboolexpr{##1<\premier}{\\}{\\\hbox
+ to1cm{\dotfill}\\}}%
+ \end{tabular}
+ \renewcommand{\arraystretch}{1}
+ \fi
+}
+
+\newcommand{\NombrePremierExposant}[1]{%écrire la décomposition
+ % complète
+ \newcount\anp\newcount\bnp\newcount\cnp%\newcount\e\newcount\f%
+ % #1 le nombre premier à tester
+ \anp=#1\relax%
+ \bnp=2\relax%
+ \premier=-1\relax%
+ % Pour déterminer le nombre d'étapes
+ \whiledo{\anp > 1}{%
+ \modulo{\the\anp}{\the\bnp}
+ \ifnum\remainder=0\relax%
+ \global\premier=\numexpr\premier+1\relax%
+ \cnp=\numexpr\anp/\bnp\relax%
+ \anp=\cnp\relax%
+ \else%
+ \bnp=\numexpr\bnp+1\relax%
+ \fi%
+ }
+ \ifnum\premier=0%
+ Le nombre \num{#1} est un nombre premier.%
+ \else%
+ \begin{align*}
+ \xintFor* ##1 in {\xintSeq {1}{\premier}}\do {\num{#1}&=\PremierEtape{#1}{##1}\\}%
+ \num{#1}&=\PremierExposant{#1}%
+ \end{align*}%
+ \fi%
+}%
+
+\newcommand{\PremierEtape}[2]{%
+ %#1 : le nombre entier à tester
+ %#2 : le nombre d'étapes à effectuer
+ \newcount\anp\newcount\bnp\newcount\cnp\newcount\dnp%
+ \ensuremath{%
+ \anp=#1\relax
+ \bnp=2\relax
+ \dnp=0\relax%
+ \whiledo{\anp > 1}{%
+ \whiledo{\dnp < \number#2}{%
+ \modulo{\the\anp}{\the\bnp}
+ \ifnum\remainder=0\relax
+ \dnp=\numexpr\dnp+1\relax
+ \cnp=\numexpr\anp/\bnp\relax
+ \anp=\cnp\relax
+ \num{\the\bnp}\times%
+ \else%
+ \bnp=\numexpr\bnp+1\relax%
+ \fi%
+ }
+ \num{\the\anp}%
+ \anp=1%
+ }
+ }
+}
+
+\newcommand{\PremierExposant}[1]{%
+ %#1 : le nombre entier à tester
+ \ensuremath{%
+ \newcount\anp\newcount\bnp\newcount\cnp%
+ \newcount\pileb\newcount\exposant%
+ \exposant=0\relax%
+ \anp=#1\relax%
+ \bnp=2\relax%
+ \pileb=2\relax%
+ \whiledo{\the\anp > 1}{%
+ \modulo{\the\anp}{\the\bnp}
+ \ifnum\remainder=0\relax
+ \cnp=\numexpr\anp/\bnp\relax
+ \ifnum\pileb=\bnp
+ \exposant=\numexpr\exposant+1\relax
+ \fi
+ \anp=\cnp\relax
+ \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
+ \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
+ \anpl=#1\relax%
+ \bnpl=2\relax%
+ \pilebl=2\relax%
+ \whiledo{\the\anpl > 1}{%
+ \modulo{\the\anpl}{\the\bnpl}
+ \ifnum\remainder=0\relax
+ \cnpl=\numexpr\anpl/\bnpl\relax
+ \num{\the\bnpl}\ifnum\anpl>\bnpl\times\fi%
+ \anpl=\cnpl\relax
+ \else%
+ \bnpl=\numexpr\bnpl+1\relax%
+ \pilebl=\bnpl\relax%
+ \fi%
+ }
+ }
+}
+
+\newcommand{\ListeDiviseur}[1]{%#1 : le nombre entier à tester
+ \newcount\anp\newcount\bnp%
+ \anp=#1%
+ \bnp=2\relax%
+ 1 %
+ \whiledo{\bnp<\anp}{%
+ \modulo{\the\anp}{\the\bnp}{}%
+ \ifnum\remainder=0%
+ ; $\num{\the\bnp}$ %
+ \fi%
+ \bnp=\numexpr\bnp+1%
+ }%
+ et \num{\the\anp}%
+}
+
+
+%%%%%%%%%%%%%%%%%%%
+% Simplification
+%%%%%%%%%%%%%%%%%%%
+\makeatletter%by christian Tellechea
+% Calcul du PGCD de #1 et #2
+\newcount\cnt@a\newcount\cnt@b\newcount\pgcd
+\def\PGCD#1#2{%
+ \ifnum#1>#2\cnt@a#1\cnt@b#2\else\cnt@a#2\cnt@b#1\relax\fi
+ \PGCD@i
+}
+\def\PGCD@i{\edef\PGCD@ii##1{##1{\number\cnt@a}{\number\cnt@b}}\PGCD@ii\PGCD@iii}
+\def\PGCD@iii#1#2{%
+ \cnt@b#1\relax\global\divide\cnt@b#2%
+ \global\cnt@b\numexpr#1-#2*\cnt@b%
+ \global\cnt@a#2\global\pgcd\cnt@a%
+ \ifnum\cnt@b>\z@\expandafter\PGCD@i%
+ \fi}%
+\makeatother
+
+\def\SSimplifie#1#2{%
+ % Simplification d'une écriture #1/#2
+ \ensuremath{
+ \newcount\numerateur\newcount\denominateur\newcount\valabsnum\newcount\valabsdeno
+ \numerateur=\number#1
+ \denominateur=\number#2
+ \ifnum\number#1<0\relax
+ \valabsnum=\numexpr0-\number#1
+ \else
+ \valabsnum=\number#1
+ \fi
+ \ifnum\number#2<0\relax
+ \valabsdeno=\numexpr0-\number#2
+ \else
+ \valabsdeno=\number#2
+ \fi
+ \ifnum\the\numerateur<0\relax
+ \ifnum\the\denominateur<0\relax
+ \numerateur=\valabsnum
+ \denominateur=\valabsdeno
+ \fi
+ \fi
+ \ifnum\number#2=0\relax
+ \text{\bfseries(???)}
+ \else
+ \ifnum\number#1=0\relax
+ 0
+ \else
+ \PGCD{\the\valabsnum}{\the\valabsdeno}%
+ \ifnum\pgcd>1\relax
+ \ifthenelse{\pgcd=\number#2 \OR \pgcd=\the\valabsdeno}{%
+ \divide\numerateur by \denominateur\num{\the\numerateur}
+ }{\divide\numerateur by\pgcd%
+ \divide\denominateur by\pgcd%
+ \frac{\num{\the\numerateur}}{\num{\the\denominateur}}
+ }
+ \else%%%comme on est avec les négatifs, on doit regarder si la valeur absolue est égale à 1
+ \ifnum\valabsdeno=1\relax
+ \divide\numerateur by \denominateur\num{\the\numerateur}
+ \else
+ \frac{\num{\the\numerateur}}{\num{\the\denominateur}}
+ \fi
+ \fi%
+ \fi%
+ \fi%
+ }%
+}
+
+
+\newcommand{\SSimpli}[2]{%
+ % Décomposition d'une simplification de #1/#2
+ \newcount\numerateur\newcount\denominateur\newcount\valabsnum\newcount\valabsdeno%
+ \numerateur=\number#1
+ \denominateur=\number#2
+ \ifnum\number#1<0
+ \valabsnum=\numexpr0-\number#1
+ \else
+ \valabsnum=\number#1
+ \fi
+ \ifnum\number#2<0
+ \valabsdeno=\numexpr0-\number#2
+ \else
+ \valabsdeno=\number#2
+ \fi
+ \ifnum\number#2=0\relax
+ \ensuremath{\text{\bfseries(???)}}
+ \else
+ \ifnum\number#1=0\relax
+ 0
+ \else
+ \PGCD{\the\valabsnum}{\the\valabsdeno}%
+ \ifnum\pgcd>1\relax
+ \ifthenelse{\pgcd=\number#2 \OR \pgcd=\the\valabsdeno}{%
+ \divide\numerateur by \denominateur\num{\the\numerateur}
+ }{%\divide\numerateur by\pgcd%
+ %\divide\denominateur by\pgcd%
+ \ensuremath{\frac{\num{\the\numerateur}_{\mbox{\tiny$\div\num{\number\pgcd}$}}}{\num{\the\denominateur}_{\mbox{\tiny$\div\num{\number\pgcd}$}}}}
+ }
+ \else
+ \ifnum\denominateur=1\relax
+ \ensuremath{\frac{\num{\the\numerateur}_{\mbox{\tiny$\div\num{\number\pgcd}$}}}{\num{\the\denominateur}_{\mbox{\tiny$\div\num{\number\pgcd}$}}}}
+ \else
+ \ensuremath{\frac{\num{\the\numerateur}}{\num{\the\denominateur}}}
+ \fi
+ \fi
+ \fi
+ \fi
+}
+
+\newcommand\DiviseurCommun[2]{%
+ % #1 : le premier nombre entier
+ % #2 : le deuxième nombre entier
+ \newcount\anpdc\newcount\bnpdc\newcount\cnpdc%
+ \anpdc=#1%
+ \cnpdc=#2%
+ \bnpdc=2\relax%
+ \whiledo{\bnpdc<\anpdc}{%
+ \modulo{\the\anpdc}{\the\bnpdc}{}%
+ \ifnum\remainder=0%
+ \modulo{\the\cnpdc}{\the\bnpdc}{}
+ \ifnum\remainder=0%
+ \xdef\DivCom{\the\bnpdc}%
+ \bnpdc=\anpdc%
+ \else%
+ \xdef\DivCom{1}%
+ \bnpdc=\numexpr\bnpdc+1%
+ \fi%
+ \else%
+ \xdef\DivCom{1}%
+ \bnpdc=\numexpr\bnpdc+1%
+ \fi
+ }%
+}
+
+\newcommand\LongueSimplification[2]{%
+ \DiviseurCommun{#1}{#2}%
+ \xdef\NumerateurDiv{#1}%
+ \xdef\DenominateurDiv{#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}%
+ \DiviseurCommun{\NumerateurDiv}{\DenominateurDiv}%
+ \xintifboolexpr{\DivCom>1}{=}{}%
+ }
+ }
+}
+
+\setKVdefault[ClesSimplification]{Details=false,All=false,Longue=false,Fleches=false}
+
+\newcounter{NbFrac}%
+\setcounter{NbFrac}{0}%
+
+\newcommand\Simplification[3][]{%
+ \stepcounter{NbFrac}%
+ \useKVdefault[ClesSimplification]%
+ \setKV[ClesSimplification]{#1}%
+ \ifboolKV[ClesSimplification]{Fleches}{%
+ \setsepchar[*]{,*/}%\ignoreemptyitems
+ \readlist*\Listea{#2}%
+ \readlist*\Listeb{#3}%
+ \setbox1=\hbox{\Listea[1,1]{}}%
+ \setbox2=\hbox{\Listeb[1,1]}%
+ \setbox3=\hbox{\Listea[1,3]}%
+ \setbox4=\hbox{\Listeb[1,3]}%
+ \ensuremath{%
+ \frac{\tikzmarknode[anchor=north]{A-\theNbFrac}{\Listea[1,1]}{}}{\tikzmarknode[anchor=south]{B-\theNbFrac}{\Listeb[1,1]}{}}=\frac{\tikzmarknode[anchor=north]{C-\theNbFrac}{\Listea[1,3]}{}}{\tikzmarknode[anchor=south]{D-\theNbFrac}{\Listeb[1,3]}{}}%
+ }%
+ \begin{tikzpicture}[remember picture,overlay]%
+ \draw[out=45,in=135,-stealth,transform canvas={yshift=0.25em}]
+ let
+ \p1=(pic cs:A-\theNbFrac),
+ \p2=(pic cs:C-\theNbFrac)
+ in (pic cs:A-\theNbFrac) to node[midway,above]{\Listea[1,2]}(\x2,\y1);
+ \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}%
+ }{%
+ \ifboolKV[ClesSimplification]{Details}{\SSimpli{#2}{#3}}{\ifboolKV[ClesSimplification]{All}{\ensuremath{\SSimpli{#2}{#3}=\SSimplifie{#2}{#3}}}{\SSimplifie{#2}{#3}}}%
+ }%
+ }%
+}%
+
+%%%%%%%%%%%%%%%%%%%%%
+%%% Thales
+%%%%%%%%%%%%%%%%%%%%%
+\newcount\ppcm
+
+\newcommand\PPCM[2]{%
+ \PGCD{#1}{#2}
+ \ppcm=\numexpr#1*#2/\pgcd\relax
+}
+
+\setKVdefault[ClesThales]{Calcul=true,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}
+
+%On définit la figure à utiliser
+\def\MPFigThales#1#2#3#4#5{
+ % #1 Premier sommet
+ % #2 Deuxième sommet
+ % #3 Troisième sommet
+ % #4 point sur le segment #1#2
+ % #5 point sur le segment #1#3
+ \ifluatex
+ \mplibcodeinherit{enable}
+ \mplibforcehmode
+ \begin{mplibcode}
+ u:=1cm;
+ pair A,B,C,M,N,O;%
+ %On place les points A,B,C sur le cercle de manière à faciliter la rotation de la figure
+ A=u*(1,1);
+ B-A=u*(4,0);
+ C=(A--2[A,B rotatedabout(A,45)]) intersectionpoint (B--2[B,A rotatedabout(B,-60)]);
+ % On définit le centre du cercle circonscrit
+ 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 :)
+ 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)};
+ cotes3=C{dir(angle(A-C)+5)}..A{dir(angle(A-C)+5)};
+ M=point(0.4*length cotes1) of cotes1;
+ N=point(0.6*length cotes3) of cotes3;
+ cotes4=1.5[N,M]{dir(angle(N-M)+5)}..1.5[M,N]{dir(angle(N-M)+5)};
+ path triangle;
+ triangle=cotes1--cotes2--cotes3--cycle;
+ draw triangle;
+ draw cotes4;
+ %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]);
+ label(btex #4 etex,1.1[C,M]);
+ 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{mplibcode}
+ \mplibcodeinherit{disable}
+ \else
+ \begin{mpost}
+ u:=1cm;
+ pair A,B,C,M,N,O;%
+ %On place les points A,B,C sur le cercle de manière à faciliter la rotation de la figure
+ A=u*(1,1);
+ B-A=u*(4,0);
+ C=(A--2[A,B rotatedabout(A,45)]) intersectionpoint (B--2[B,A rotatedabout(B,-60)]);
+ % On définit le centre du cercle circonscrit
+ 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 :)
+ 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)};
+ cotes3=C{dir(angle(A-C)+5)}..A{dir(angle(A-C)+5)};
+ M=point(0.4*length cotes1) of cotes1;
+ N=point(0.6*length cotes3) of cotes3;
+ cotes4=1.5[N,M]{dir(angle(N-M)+5)}..1.5[M,N]{dir(angle(N-M)+5)};
+ path triangle;
+ triangle=cotes1--cotes2--cotes3--cycle;
+ draw triangle;
+ draw cotes4;
+ %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]);
+ label(btex #4 etex,1.1[C,M]);
+ 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 figure à utiliser
+\def\MPFigReciThales#1#2#3#4#5{
+ % #1 Premier sommet
+ % #2 Deuxième sommet
+ % #3 Troisième sommet
+ % #4 point sur le segment #1#2
+ % #5 point sur le segment #1#3
+ \ifluatex
+ \mplibcodeinherit{enable}
+ \mplibforcehmode
+ \begin{mplibcode}
+ u:=1cm;
+ pair A,B,C,M,N,O;%
+ %On place les points A,B,C sur le cercle de manière à faciliter la rotation de la figure
+ A=u*(1,1);
+ B-A=u*(4,0);
+ C=(A--2[A,B rotatedabout(A,45)]) intersectionpoint (B--2[B,A rotatedabout(B,-60)]);
+ % On définit le centre du cercle circonscrit
+ 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 :)
+ 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)};
+ cotes3=C{dir(angle(A-C)+5)}..A{dir(angle(A-C)+5)};
+ M=point(0.4*length cotes1) of cotes1;
+ N=point(0.6*length cotes3) of cotes3;
+ cotes4=1.5[N,M]{dir(angle(N-M)+5)}..1.5[M,N]{dir(angle(N-M)+5)};
+ path triangle;
+ triangle=cotes1--cotes2--cotes3--cycle;
+ draw triangle;
+ draw cotes4;
+ %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]);
+ label(btex #4 etex,1.1[C,M]);
+ 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);
+ \end{mplibcode}
+ \mplibcodeinherit{disable}
+ \else
+ \begin{mpost}
+ u:=1cm;
+ pair A,B,C,M,N,O;%
+ %On place les points A,B,C sur le cercle de manière à faciliter la rotation de la figure
+ A=u*(1,1);
+ B-A=u*(4,0);
+ C=(A--2[A,B rotatedabout(A,45)]) intersectionpoint (B--2[B,A rotatedabout(B,-60)]);
+ % On définit le centre du cercle circonscrit
+ 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 :)
+ 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)};
+ cotes3=C{dir(angle(A-C)+5)}..A{dir(angle(A-C)+5)};
+ M=point(0.4*length cotes1) of cotes1;
+ N=point(0.6*length cotes3) of cotes3;
+ cotes4=1.5[N,M]{dir(angle(N-M)+5)}..1.5[M,N]{dir(angle(N-M)+5)};
+ path triangle;
+ triangle=cotes1--cotes2--cotes3--cycle;
+ draw triangle;
+ draw cotes4;
+ %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]);
+ label(btex #4 etex,1.1[C,M]);
+ 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{%
+ % #1 Premier sommet
+ % #2 Deuxième sommet
+ % #3 Troisième sommet
+ % #4 point sur la droite #1#2
+ % #5 point sur la droite #1#3
+ \ifluatex
+ \mplibforcehmode
+ \mplibcodeinherit{enable}
+ \begin{mplibcode}
+ u:=1cm;
+ pair A,B,C,M,N,O;%
+ O=(2.5u,2.5u);
+ path cc;
+ cc=(fullcircle scaled 3u) shifted O;
+ %On place les points A,B,C sur le cercle de manière à faciliter la rotation de la figure
+ A=point(0.1*length cc) of cc;
+ 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);
+ % on dessine à main levée :)
+ M=1.4[B,A];
+ N=1.4[C,A];
+ path cotes[];
+ cotes1=A{dir(angle(B-A)+5)}..1.15[A,B]{dir(angle(B-A)+5)};
+ cotes2=1.15[C,B]{dir(angle(C-B)+5)}..1.15[B,C]{dir(angle(C-B)+5)};
+ cotes3=1.15[A,C]{dir(angle(A-C)+5)}..A{dir(angle(A-C)+5)};
+ cotes4=1.5[N,M]{dir(angle(N-M)+5)}..1.5[M,N]{dir(angle(N-M)+5)};
+ cotes5=A{dir(angle(M-A)+5)}..1.15[A,M]{dir(angle(M-A)+5)};
+ cotes6=A{dir(angle(N-A)+5)}..1.15[A,N]{dir(angle(N-A)+5)};
+ for k=1 upto 6:
+ draw cotes[k];
+ endfor;
+ pair I;
+ % On définit le centre du cercle inscrit à AMC
+ (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]);
+ label(btex #4 etex,1.1[B,M]);
+ label(btex #5 etex,1.1[C,N]);
+ fill (fullcircle scaled 0.75mm) shifted (cotes5 intersectionpoint cotes4);
+ fill (fullcircle scaled 0.75mm) shifted (cotes6 intersectionpoint cotes4);
+ pair I,J,K;
+ I=1.1[N,M];
+ J=1.1[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{mplibcode}
+ \mplibcodeinherit{disable}
+ \else
+ \begin{mpost}
+ u:=1cm;
+ pair A,B,C,M,N,O;%
+ O=(2.5u,2.5u);
+ path cc;
+ cc=(fullcircle scaled 3u) shifted O;
+ %On place les points A,B,C sur le cercle de manière à faciliter la rotation de la figure
+ A=point(0.1*length cc) of cc;
+ 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);
+ % on dessine à main levée :)
+ M=1.4[B,A];
+ N=1.4[C,A];
+ path cotes[];
+ cotes1=A{dir(angle(B-A)+5)}..1.15[A,B]{dir(angle(B-A)+5)};
+ cotes2=1.15[C,B]{dir(angle(C-B)+5)}..1.15[B,C]{dir(angle(C-B)+5)};
+ cotes3=1.15[A,C]{dir(angle(A-C)+5)}..A{dir(angle(A-C)+5)};
+ cotes4=1.5[N,M]{dir(angle(N-M)+5)}..1.5[M,N]{dir(angle(N-M)+5)};
+ cotes5=A{dir(angle(M-A)+5)}..1.15[A,M]{dir(angle(M-A)+5)};
+ cotes6=A{dir(angle(N-A)+5)}..1.15[A,N]{dir(angle(N-A)+5)};
+ for k=1 upto 6:
+ draw cotes[k];
+ endfor;
+ pair I;
+ % On définit le centre du cercle inscrit à AMC
+ (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]);
+ label(btex #4 etex,1.1[B,M]);
+ label(btex #5 etex,1.1[C,N]);
+ fill (fullcircle scaled 0.75mm) shifted (cotes5 intersectionpoint cotes4);
+ fill (fullcircle scaled 0.75mm) shifted (cotes6 intersectionpoint cotes4);
+ pair I,J,K;
+ I=1.1[N,M];
+ J=1.1[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\MPFigReciThalesCroisee#1#2#3#4#5{%
+ % #1 Premier sommet
+ % #2 Deuxième sommet
+ % #3 Troisième sommet
+ % #4 point sur la droite #1#2
+ % #5 point sur la droite #1#3
+ \ifluatex
+ \mplibforcehmode
+ \mplibcodeinherit{enable}
+ \begin{mplibcode}
+ u:=1cm;
+ pair A,B,C,M,N,O;%
+ O=(2.5u,2.5u);
+ path cc;
+ cc=(fullcircle scaled 3u) shifted O;
+ %On place les points A,B,C sur le cercle de manière à faciliter la rotation de la figure
+ A=point(0.1*length cc) of cc;
+ 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);
+ % on dessine à main levée :)
+ M=1.4[B,A];
+ N=1.4[C,A];
+ path cotes[];
+ cotes1=A{dir(angle(B-A)+5)}..1.15[A,B]{dir(angle(B-A)+5)};
+ cotes2=1.15[C,B]{dir(angle(C-B)+5)}..1.15[B,C]{dir(angle(C-B)+5)};
+ cotes3=1.15[A,C]{dir(angle(A-C)+5)}..A{dir(angle(A-C)+5)};
+ cotes4=1.5[N,M]{dir(angle(N-M)+5)}..1.5[M,N]{dir(angle(N-M)+5)};
+ cotes5=A{dir(angle(M-A)+5)}..1.15[A,M]{dir(angle(M-A)+5)};
+ cotes6=A{dir(angle(N-A)+5)}..1.15[A,N]{dir(angle(N-A)+5)};
+ for k=1 upto 6:
+ draw cotes[k];
+ endfor;
+ pair I;
+ % On définit le centre du cercle inscrit à AMC
+ (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]);
+ label(btex #4 etex,1.1[B,M]);
+ label(btex #5 etex,1.1[C,N]);
+ fill (fullcircle scaled 0.75mm) shifted (cotes5 intersectionpoint cotes4);
+ fill (fullcircle scaled 0.75mm) shifted (cotes6 intersectionpoint cotes4);
+ fill (fullcircle scaled 0.75mm) shifted (cotes1 intersectionpoint cotes2);
+ fill (fullcircle scaled 0.75mm) shifted (cotes3 intersectionpoint cotes2);
+ \end{mplibcode}
+ \mplibcodeinherit{disable}
+ \else
+ \begin{mpost}
+ u:=1cm;
+ pair A,B,C,M,N,O;%
+ O=(2.5u,2.5u);
+ path cc;
+ cc=(fullcircle scaled 3u) shifted O;
+ %On place les points A,B,C sur le cercle de manière à faciliter la rotation de la figure
+ A=point(0.1*length cc) of cc;
+ 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);
+ % on dessine à main levée :)
+ M=1.4[B,A];
+ N=1.4[C,A];
+ path cotes[];
+ cotes1=A{dir(angle(B-A)+5)}..1.15[A,B]{dir(angle(B-A)+5)};
+ cotes2=1.15[C,B]{dir(angle(C-B)+5)}..1.15[B,C]{dir(angle(C-B)+5)};
+ cotes3=1.15[A,C]{dir(angle(A-C)+5)}..A{dir(angle(A-C)+5)};
+ cotes4=1.5[N,M]{dir(angle(N-M)+5)}..1.5[M,N]{dir(angle(N-M)+5)};
+ cotes5=A{dir(angle(M-A)+5)}..1.15[A,M]{dir(angle(M-A)+5)};
+ cotes6=A{dir(angle(N-A)+5)}..1.15[A,N]{dir(angle(N-A)+5)};
+ for k=1 upto 6:
+ draw cotes[k];
+ endfor;
+ pair I;
+ % On définit le centre du cercle inscrit à AMC
+ (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]);
+ label(btex #4 etex,1.1[B,M]);
+ label(btex #5 etex,1.1[C,N]);
+ fill (fullcircle scaled 0.75mm) shifted (cotes5 intersectionpoint cotes4);
+ fill (fullcircle scaled 0.75mm) shifted (cotes6 intersectionpoint cotes4);
+ fill (fullcircle scaled 0.75mm) shifted (cotes1 intersectionpoint cotes2);
+ fill (fullcircle scaled 0.75mm) shifted (cotes3 intersectionpoint cotes2);
+ \end{mpost}
+ \fi
+}
+
+%%%
+\newcommand{\TTThales}[6][]{%
+ \useKVdefault[ClesThales]%
+ \setKV[ClesThales]{#1}%
+ 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} \ifboolKV[ClesThales]{Remediation}{\pointilles[2cm]}{$(#2#3)$}, \ifboolKV[ClesThales]{Remediation}{\pointilles[1cm]}{$#6$} est un point \ifboolKV[ClesThales]{Segment}{du segment}{de la droite} \ifboolKV[ClesThales]{Remediation}{\pointilles[2cm]}{$(#2#4)$}.%
+ \\Comme les droites \ifboolKV[ClesThales]{Remediation}{\pointilles[2cm]}{$(#5#6)$} et \ifboolKV[ClesThales]{Remediation}{\pointilles[2cm]}{$(#3#4)$} sont parallèles, alors \ifboolKV[ClesThales]{Propor}{le tableau%
+ \[\begin{array}{c|c|c}
+ \ifboolKV[ClesThales]{Remediation}{\pointilles[1cm]}{#2#5}&\ifboolKV[ClesThales]{Remediation}{\pointilles[1cm]}{#2#6}&\ifboolKV[ClesThales]{Remediation}{\pointilles[1cm]}{#5#6}\\
+ \hline
+ \ifboolKV[ClesThales]{Remediation}{\pointilles[1cm]}{#2#3}&\ifboolKV[ClesThales]{Remediation}{\pointilles[1cm]}{#2#4}&\ifboolKV[ClesThales]{Remediation}{\pointilles[1cm]}{#3#4}\\
+ \end{array}
+ \]
+ est un tableau de proportionnalité d'après le théorème de Thalès.%
+ }{%
+ le théorème de Thalès permet d'écrire :%
+ \[\frac{\ifboolKV[ClesThales]{Remediation}{\pointilles[1cm]}{#2#5}}{\ifboolKV[ClesThales]{Remediation}{\pointilles[1cm]}{#2#3}}=\frac{\ifboolKV[ClesThales]{Remediation}{\pointilles[1cm]}{#2#6}}{\ifboolKV[ClesThales]{Remediation}{\pointilles[1cm]}{#2#4}}=\frac{\ifboolKV[ClesThales]{Remediation}{\pointilles[1cm]}{#5#6}}{\ifboolKV[ClesThales]{Remediation}{\pointilles[1cm]}{#3#4}}\]%
+ }
+}
+
+\newcommand{\TThalesCalculsD}[8][]{%
+ \setKV[ClesThales]{#1}%
+ \newcount\zzz\newcount\yyy\newcount\xxx%Pour se rappeller des calculs à faire et combien en faire%
+ \def\Nomx{}%
+ \def\Nomy{}%
+ \def\Nomz{}%
+ \zzz=0\yyy=0\xxx=0%
+ \TTThales[#1]{\StrMid{#2}{1}{1}}{\StrMid{#2}{2}{2}}{\StrMid{#2}{3}{3}}{\StrMid{#2}{4}{4}}{\StrMid{#2}{5}{5}}\par
+\IfDecimal{#3}{%
+ \IfDecimal{#6}{}{%
+ \IfDecimal{#4}{%
+ \IfDecimal{#7}{%
+ \xxx=5263%#6&=\frac{#3\times#7}{#4}\\
+ \edef\Nomx{#6}\opcopy{#3}{valx}\opcopy{#7}{Valx}\opcopy{#4}{denox}%
+ \xdef\ResultatThalesx{\fpeval{round(#3*#7/#4,\useKV[ClesThales]{Precision})}}%
+ }{%
+ \IfDecimal{#8}{\IfDecimal{#5}{\xxx=5274%\[#6=\frac{#3\times#8}{#5}\]
+ \edef\Nomx{#6}\opcopy{#3}{valx}\opcopy{#8}{Valx}\opcopy{#5}{denox}%
+ \xdef\ResultatThalesx{\fpeval{round(#3*#8/#5,\useKV[ClesThales]{Precision})}}%
+ }{}}{}
+ }
+ }{\IfDecimal{#8}{\IfDecimal{#5}{\xxx=5274%\[#6=\frac{#3\times#8}{#5}\]
+ \edef\Nomx{#6}\opcopy{#3}{valx}\opcopy{#8}{Valx}\opcopy{#5}{denox}%
+ \xdef\ResultatThalesx{\fpeval{round(#3*#8/#5,\useKV[ClesThales]{Precision})}}%
+ }{}}{}
+ }
+ }
+ }{%
+ \IfDecimal{#6}{%
+ \IfDecimal{#4}{%
+ \IfDecimal{#7}{%
+ \xxx=2536%\[#3=\frac{#6\times#4}{#7}\]%
+ \edef\Nomx{#3}\opcopy{#6}{valx}\opcopy{#4}{Valx}\opcopy{#7}{denox}%
+ \xdef\ResultatThalesx{\fpeval{round(#6*#4/#7,\useKV[ClesThales]{Precision})}}%
+ }{%
+ \IfDecimal{#5}{\IfDecimal{#8}{\xxx=2547
+ \edef\Nomx{#3}\opcopy{#6}{valx}\opcopy{#5}{Valx}\opcopy{#8}{denox}%\[#3=\frac{#6\times#5}{#8}\]
+ \xdef\ResultatThalesx{\fpeval{round(#6*#5/#8,\useKV[ClesThales]{Precision})}}%
+ }{}}{}
+ }
+ }{\IfDecimal{#5}{\IfDecimal{#8}{\xxx=2547
+ \edef\Nomx{#3}\opcopy{#6}{valx}\opcopy{#5}{Valx}\opcopy{#8}{denox}%\[#3=\frac{#6\times#5}{#8}\]
+ \xdef\ResultatThalesx{\fpeval{round(#6*#5/#8,\useKV[ClesThales]{Precision})}}%
+ }{}}{}
+ }
+ }{}
+ }%
+ %
+ \IfDecimal{#4}{%
+ \IfDecimal{#7}{}{%
+ \IfDecimal{#5}{%
+ \IfDecimal{#8}{%
+ \yyy=6374%\[#7=\frac{#4\times#8}{#5}\]%
+ \edef\Nomy{#7}\opcopy{#4}{valy}\opcopy{#8}{Valy}\opcopy{#5}{denoy}%
+ \xdef\ResultatThalesy{\fpeval{round(#4*#8/#5,\useKV[ClesThales]{Precision})}}%
+ }{%
+ \IfDecimal{#6}{\IfDecimal{#3}{\yyy=6352%\[#7=\frac{#4\times#6}{#3}\]
+ \edef\Nomy{#7}\opcopy{#4}{valy}\opcopy{#6}{Valy}\opcopy{#3}{denoy}%
+ \xdef\ResultatThalesy{\fpeval{round(#4*#6/#3,\useKV[ClesThales]{Precision})}}%
+ }{}}{}
+ }
+ }{\IfDecimal{#6}{\IfDecimal{#3}{\yyy=6352%\[#7=\frac{#4\times#6}{#3}\]
+ \edef\Nomy{#7}\opcopy{#4}{valy}\opcopy{#6}{Valy}\opcopy{#3}{denoy}%
+ \xdef\ResultatThalesy{\fpeval{round(#4*#6/#3,\useKV[ClesThales]{Precision})}}%
+ }{}}{}
+ }
+ }
+ }{%
+ \IfDecimal{#7}{%
+ \IfDecimal{#5}{%
+ \IfDecimal{#8}{%
+ \yyy=3647%\[#4=\frac{#7\times#5}{#8}\]%
+ \edef\Nomy{#4}\opcopy{#7}{valy}\opcopy{#5}{Valy}\opcopy{#8}{denoy}%
+ \xdef\ResultatThalesy{\fpeval{round(#7*#5/#8,\useKV[ClesThales]{Precision})}}%
+ }{%
+ \IfDecimal{#3}{\IfDecimal{#6}{\yyy=3625%\[#4=\frac{#7\times#3}{#6}\]
+ \edef\Nomy{#4}\opcopy{#7}{valy}\opcopy{#3}{Valy}\opcopy{#6}{denoy}%
+ \xdef\ResultatThalesy{\fpeval{round(#7*#3/#6,\useKV[ClesThales]{Precision})}}%
+ }{}}{}
+ }
+ }{\IfDecimal{#3}{\IfDecimal{#6}{\yyy=3625%\[#4=\frac{#7\times#3}{#6}\]
+ \edef\Nomy{#4}\opcopy{#7}{valy}\opcopy{#3}{Valy}\opcopy{#6}{denoy}%
+ \xdef\ResultatThalesy{\fpeval{round(#7*#3/#6,\useKV[ClesThales]{Precision})}}%
+ }{}}{}
+ }}{}}%
+ %
+ \IfDecimal{#5}{%
+ \IfDecimal{#8}{}{%
+ \IfDecimal{#4}{
+ \IfDecimal{#7}{
+ \zzz=7463%\[#8=\frac{#5\times#7}{#4}\]%
+ \edef\Nomz{#8}\opcopy{#5}{valz}\opcopy{#7}{Valz}\opcopy{#4}{denoz}%
+ \xdef\ResultatThalesz{\fpeval{round(#5*#7/#4,\useKV[ClesThales]{Precision})}}%
+ }{%
+ \IfDecimal{#3}{\IfDecimal{#6}{\zzz=7452%\[#8=\frac{#5\times#6}{#3}\]
+ \edef\Nomz{#8}\opcopy{#5}{valz}\opcopy{#6}{Valz}\opcopy{#3}{denoz}%
+ \xdef\ResultatThalesz{\fpeval{round(#5*#6/#3,\useKV[ClesThales]{Precision})}}%
+ }{}}{}
+ }
+ }{\IfDecimal{#3}{\IfDecimal{#6}{\zzz=7452%\[#8=\frac{#5\times#6}{#3}\]
+ \edef\Nomz{#8}\opcopy{#5}{valz}\opcopy{#6}{Valz}\opcopy{#3}{denoz}%
+ \xdef\ResultatThalesz{\fpeval{round(#5*#6/#3,\useKV[ClesThales]{Precision})}}%
+ }{}}{}
+ }
+ }
+ }{%
+ \IfDecimal{#8}{%
+ \IfDecimal{#4}{%
+ \IfDecimal{#7}{%
+ \zzz=4736% \[#5=\frac{#8\times#4}{#7}\]%
+ \edef\Nomz{#5}\opcopy{#8}{valz}\opcopy{#4}{Valz}\opcopy{#7}{denoz}%
+ \xdef\ResultatThalesz{\fpeval{round(#8*#4/#7,\useKV[ClesThales]{Precision})}}%
+ }{%
+ \IfDecimal{#3}{\IfDecimal{#6}{\zzz=4725%\[#5=\frac{#8\times#3}{#6}\]
+ \edef\Nomz{#5}\opcopy{#8}{valz}\opcopy{#3}{Valz}\opcopy{#6}{denoz}%
+ \xdef\ResultatThalesz{\fpeval{round(#8*#3/#6,\useKV[ClesThales]{Precision})}}%
+ }{}}{}
+ }
+ }{\IfDecimal{#3}{\IfDecimal{#6}{\zzz=4725%\[#5=\frac{#8\times#3}{#6}\]
+ \edef\Nomz{#5}\opcopy{#8}{valz}\opcopy{#3}{Valz}\opcopy{#6}{denoz}%
+ \xdef\ResultatThalesz{\fpeval{round(#8*#3/#6,\useKV[ClesThales]{Precision})}}%
+ }{}}{}
+ }}{}
+ }%
+ %%
+\StrMid{\the\zzz}{1}{1}[\cmza]%
+\StrMid{\the\yyy}{1}{1}[\cmya]%
+\StrMid{\the\xxx}{1}{1}[\cmxa]%
+\ifboolKV[ClesThales]{Calcul}{%
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%
+ On remplace par les longueurs connues :%
+ \ifboolKV[ClesThales]{Propor}{%
+ \[\begin{array}{c|c|c}
+ \IfDecimal{#3}{\num{#3}}{#3}&\IfDecimal{#4}{\num{#4}}{#4}&\IfDecimal{#5}{\num{#5}}{#5}\\
+ \hline
+ \IfDecimal{#6}{\num{#6}}{#6}&\IfDecimal{#7}{\num{#7}}{#7}&\IfDecimal{#8}{\num{#8}}{#8}
+ \end{array}
+ \]
+ }{%
+ \[\frac{\IfDecimal{#3}{\num{#3}}{#3}}{\IfDecimal{#6}{\num{#6}}{#6}}=\frac{\IfDecimal{#4}{\num{#4}}{#4}}{\IfDecimal{#7}{\num{#7}}{#7}}=\frac{\IfDecimal{#5}{\num{#5}}{#5}}{\IfDecimal{#8}{\num{#8}}{#8}}\]
+ }%
+ % On choisit éventuellement le calcul à faire s'il y en a plusieurs.
+ \xdef\CompteurCalcul{\useKV[ClesThales]{ChoixCalcul}}%
+ \xintifboolexpr{\CompteurCalcul>0}{\xintifboolexpr{\CompteurCalcul=1}{\xdef\cmya{0}\xdef\cmza{0}}{\xintifboolexpr{\CompteurCalcul=2}{\xdef\cmxa{0}\xdef\cmza{0}}{\xdef\cmxa{0}\xdef\cmya{0}}}}{}%
+ %%on fait les calculs
+\begin{align*}
+ %Premier compteur \xxx
+ \ifnum\cmxa>0
+ \Nomx\uppercase{&}=\frac{\opexport{valx}{\valx}\num{\valx}\times\opexport{Valx}{\Valx}\num{\Valx}}{\opexport{denox}{\denox}\num{\denox}}\relax%\global\numx=\numexpr\opprint{valx}*\opprint{Valx}\relax
+ \fi
+ % % Deuxième compteur \yyy
+ \ifnum\cmya>0
+ \ifnum\cmxa=0
+ \else
+ \uppercase{&}
+ \fi%
+ \Nomy\uppercase{&}=\frac{\opexport{valy}{\valy}\num{\valy}\times\opexport{Valy}{\Valy}\num{\Valy}}{\opexport{denoy}{\denoy}\num{\denoy}}\relax%\global\numy=\numexpr\opprint{valy}*\opprint{Valy}\relax
+ \fi
+ % Troisième compteur \zzz
+ \ifnum\cmza>0
+ \ifnum\cmxa=0
+ \ifnum\cmya=0
+ %
+ \else
+ \uppercase{&}
+ \fi
+ \Nomz\uppercase{&}=\frac{\opexport{valz}{\valz}\num{\valz}\times\opexport{Valz}{\Valz}\num{\Valz}}{\opexport{denoz}{\denoz}\num{\denoz}}\relax%\global\numz=\numexpr\opprint{valz}*\opprint{Valz}\relax
+ \else
+ \uppercase{&}\Nomz\uppercase{&}=\frac{\opexport{valz}{\valz}\num{\valz}\times\opexport{Valz}{\Valz}\num{\Valz}}{\opexport{denoz}{\denoz}\num{\denoz}}\relax%\global\numz=\numexpr\opprint{valz}*\opprint{Valz}\relax
+ \fi
+ \fi
+ \\
+% % 2eme ligne du tableau : calcul des numérateurs
+% %Premier compteur \xxx
+ \ifnum\cmxa>0
+ \Nomx\uppercase{&}=\frac{\opmul*{valx}{Valx}{numx}\opexport{numx}{\numx}\num{\numx}}{\opprint{denox}}
+ \fi
+ % % Deuxième compteur \yyy
+ \ifnum\cmya>0
+ \ifnum\cmxa=0
+ %
+ \else
+ \uppercase{&}
+ \fi
+ \Nomy\uppercase{&}=\frac{\opmul*{valy}{Valy}{numy}\opexport{numy}{\numy}\num{\numy}}{\opprint{denoy}}%
+ \fi
+% %Troisième compteur \zzz
+ \ifnum\cmza>0
+ \ifnum\cmxa=0
+ \ifnum\cmya=0
+ %
+ \else
+ \uppercase{&}
+ \fi
+ \Nomz\uppercase{&}=\frac{\opmul*{valz}{Valz}{numz}\opexport{numz}{\numz}\num{\numz}}{\opprint{denoz}}
+ \else
+ \uppercase{&}\Nomz\uppercase{&}=\frac{\opmul*{valz}{Valz}{numz}\opexport{numz}{\numz}\num{\numz}}{\opprint{denoz}}
+ \fi
+ \fi
+ \\
+% % 3eme ligne : Calculs
+ \ifnum\cmxa>0
+ \Nomx\uppercase{&}\opdiv*{numx}{denox}{resultatx}{restex}\opcmp{restex}{0}\ifopeq=\opprint{resultatx}~\text{\useKV[ClesThales]{Unite}}\else\approx\opround{resultatx}{\useKV[ClesThales]{Precision}}{resultatx}\opprint{resultatx}~\text{\useKV[ClesThales]{Unite}}\fi\opexport{resultatx}{\resultatx}%\xdef\ResultatThalesx{\num{\resultatx}}%
+ \fi
+ % % Deuxième compteur \yyy
+ \ifnum\cmya>0
+ \ifnum\cmxa=0
+ %
+ \else
+ \uppercase{&}
+ \fi
+ \Nomy\uppercase{&}\opdiv*{numy}{denoy}{resultaty}{restey}\opcmp{restey}{0}\ifopeq=\opprint{resultaty}~\text{\useKV[ClesThales]{Unite}}\else\approx\opround{resultaty}{\useKV[ClesThales]{Precision}}{resultaty}\opprint{resultaty}~\text{\useKV[ClesThales]{Unite}}\fi\opexport{resultaty}{\resultaty}%\xdef\ResultatThalesy{\num{\resultaty}}
+ \fi
+% %Troisième compteur \zzz
+ \ifnum\cmza>0
+ \ifnum\cmxa=0
+ \ifnum\cmya=0
+ %
+ \else
+ \uppercase{&}
+ \fi
+ \Nomz\uppercase{&}\opdiv*{numz}{denoz}{resultatz}{restez}\opcmp{restez}{0}\ifopeq=\opprint{resultatz}~\text{\useKV[ClesThales]{Unite}}\else\approx\opround{resultatz}{\useKV[ClesThales]{Precision}}{resultatz}\opprint{resultatz}~\text{\useKV[ClesThales]{Unite}}\fi\opexport{resultatz}{\resultatz}%\xdef\ResultatThalesz{\num{\resultatz}}
+ \else
+ \uppercase{&}\Nomz\uppercase{&}\opdiv*{numz}{denoz}{resultatz}{restez}\opcmp{restez}{0}\ifopeq=\opprint{resultatz}~\text{\useKV[ClesThales]{Unite}}\else\approx\opround{resultatz}{\useKV[ClesThales]{Precision}}{resultatz}\opprint{resultatz}~\text{\useKV[ClesThales]{Unite}}\fi\opexport{resultatz}{\resultatz}%\xdef\ResultatThalesz{\num{\resultatz}}
+ \fi
+ \fi
+\end{align*}
+}{}
+}
+
+\newcommand{\TThalesCalculsE}[8][]{%
+ \setKV[ClesThales]{#1}%
+ \newcount\zzz\newcount\yyy\newcount\xxx%Pour se rappeller des calculs à faire et combien en faire%
+ \newcount\valx\newcount\Valx%
+ \newcount\valy\newcount\Valy%
+ \newcount\valz\newcount\Valz%
+ \newcount\numx\newcount\numy\newcount\numz%
+ \newcount\denox\newcount\denoy\newcount\denoz%
+ \def\Nomx{}%
+ \def\Nomy{}%
+ \def\Nomz{}%
+ \zzz=0\yyy=0\xxx=0%
+ \TTThales[#1]{\StrMid{#2}{1}{1}}{\StrMid{#2}{2}{2}}{\StrMid{#2}{3}{3}}{\StrMid{#2}{4}{4}}{\StrMid{#2}{5}{5}}\par%
+\IfDecimal{#3}{%
+ \IfDecimal{#6}{}{%
+ \IfDecimal{#4}{%
+ \IfDecimal{#7}{%
+ \xxx=5263%#6&=\frac{#3\times#7}{#4}\\
+ \edef\Nomx{#6}\valx=#3\Valx=#7\denox=#4%
+ }{%
+ \IfDecimal{#8}{\IfDecimal{#5}{\xxx=5274%\[#6=\frac{#3\times#8}{#5}\]
+ \edef\Nomx{#6}\valx=#3\Valx=#8\denox=#5%
+ }{}}{}
+ }
+ }{\IfDecimal{#8}{\IfDecimal{#5}{\xxx=5274%\[#6=\frac{#3\times#8}{#5}\]
+ \edef\Nomx{#6}\valx=#3\Valx=#8\denox=#5%
+ }{}}{}
+ }
+ }
+ }{%
+ \IfDecimal{#6}{%
+ \IfDecimal{#4}{%
+ \IfDecimal{#7}{%
+ \xxx=2536%\[#3=\frac{#6\times#4}{#7}\]%
+ \edef\Nomx{#3}\valx=#6\Valx=#4\denox=#7%
+ }{%
+ \IfDecimal{#5}{\IfDecimal{#8}{\xxx=2547
+ \edef\Nomx{#3}\valx=#6\Valx=#5\denox=#8%\[#3=\frac{#6\times#5}{#8}\]
+ }{}}{}
+ }
+ }{\IfDecimal{#5}{\IfDecimal{#8}{\xxx=2547
+ \edef\Nomx{#3}\valx=#6\Valx=#5\denox=#8%\[#3=\frac{#6\times#5}{#8}\]
+ }{}}{}
+ }
+ }{}
+ }%
+ %
+ \IfDecimal{#4}{%
+ \IfDecimal{#7}{}{%
+ \IfDecimal{#5}{%
+ \IfDecimal{#8}{%
+ \yyy=6374%\[#7=\frac{#4\times#8}{#5}\]%
+ \edef\Nomy{#7}\valy=#4\Valy=#8\denoy=#5%
+ }{%
+ \IfDecimal{#6}{\IfDecimal{#3}{\yyy=6352%\[#7=\frac{#4\times#6}{#3}\]
+ \edef\Nomy{#7}\valy=#4\Valy=#6\denoy=#3%
+ }{}}{}
+ }
+ }{\IfDecimal{#6}{\IfDecimal{#3}{\yyy=6352%\[#7=\frac{#4\times#6}{#3}\]
+ \edef\Nomy{#7}\valy=#4\Valy=#6\denoy=#3%
+ }{}}{}
+ }
+ }
+ }{%
+ \IfDecimal{#7}{%
+ \IfDecimal{#5}{%
+ \IfDecimal{#8}{%
+ \yyy=3647%\[#4=\frac{#7\times#5}{#8}\]%
+ \edef\Nomy{#4}\valy=#7\Valy=#5\denoy=#8%
+ }{%
+ \IfDecimal{#3}{\IfDecimal{#6}{\yyy=3625%\[#4=\frac{#7\times#3}{#6}\]
+ \edef\Nomy{#4}\valy=#7\Valy=#3\denoy=#6%
+ }{}}{}
+ }
+ }{\IfDecimal{#3}{\IfDecimal{#6}{\yyy=3625%\[#4=\frac{#7\times#3}{#6}\]
+ \edef\Nomy{#4}\valy=#7\Valy=#3\denoy=#6%
+ }{}}{}
+ }}{}}%
+ %
+ \IfDecimal{#5}{%
+ \IfDecimal{#8}{}{%
+ \IfDecimal{#4}{
+ \IfDecimal{#7}{
+ \zzz=7463%\[#8=\frac{#5\times#7}{#4}\]%
+ \edef\Nomz{#8}\valz=#5\Valz=#7\denoz=#4%
+ }{%
+ \IfDecimal{#3}{\IfDecimal{#6}{\zzz=7452%\[#8=\frac{#5\times#6}{#3}\]
+ \edef\Nomz{#8}\valz=#5\Valz=#6\denoz=#3%
+ }{}}{}
+ }
+ }{\IfDecimal{#3}{\IfDecimal{#6}{\zzz=7452%\[#8=\frac{#5\times#6}{#3}\]
+ \edef\Nomz{#8}\valz=#5\Valz=#6\denoz=#3%
+ }{}}{}
+ }
+ }
+ }{%
+ \IfDecimal{#8}{%
+ \IfDecimal{#4}{%
+ \IfDecimal{#7}{%
+ \zzz=4736% \[#5=\frac{#8\times#4}{#7}\]%
+ \edef\Nomz{#5}\valz=#8\Valz=#4\denoz=#7%
+ }{%
+ \IfDecimal{#3}{\IfDecimal{#6}{\zzz=4725%\[#5=\frac{#8\times#3}{#6}\]
+ \edef\Nomz{#5}\valz=#8\Valz=#3\denoz=#6%
+ }{}}{}
+ }
+ }{\IfDecimal{#3}{\IfDecimal{#6}{\zzz=4725%\[#5=\frac{#8\times#3}{#6}\]
+ \edef\Nomz{#5}\valz=#8\Valz=#3\denoz=#6%
+ }{}}{}
+ }}{}
+ }%
+ %%
+\StrMid{\the\zzz}{1}{1}[\cmza]%
+\StrMid{\the\yyy}{1}{1}[\cmya]%
+\StrMid{\the\xxx}{1}{1}[\cmxa]%
+\ifboolKV[ClesThales]{Calcul}{%
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%
+ On remplace par les longueurs connues :
+ \ifboolKV[ClesThales]{Propor}{%
+ \[\begin{array}{c|c|c}
+ \IfDecimal{#3}{\num{#3}}{#3}&\IfDecimal{#4}{\num{#4}}{#4}&\IfDecimal{#5}{\num{#5}}{#5}\\
+ \hline
+ \IfDecimal{#6}{\num{#6}}{#6}&\IfDecimal{#7}{\num{#7}}{#7}&\IfDecimal{#8}{\num{#8}}{#8}\\
+ \end{array}
+ \]
+ }{%
+ \[\frac{\IfDecimal{#3}{\num{#3}}{#3}}{\IfDecimal{#6}{\num{#6}}{#6}}=\frac{\IfDecimal{#4}{\num{#4}}{#4}}{\IfDecimal{#7}{\num{#7}}{#7}}=\frac{\IfDecimal{#5}{\num{#5}}{#5}}{\IfDecimal{#8}{\num{#8}}{#8}}\]
+ }%
+ % On choisit éventuellement le calcul à faire s'il y en a plusieurs.
+ \xdef\CompteurCalcul{\useKV[ClesThales]{ChoixCalcul}}%
+ \xintifboolexpr{\CompteurCalcul>0}{\xintifboolexpr{\CompteurCalcul=1}{\xdef\cmya{0}\xdef\cmza{0}}{\xintifboolexpr{\CompteurCalcul=2}{\xdef\cmxa{0}\xdef\cmza{0}}{\xdef\cmxa{0}\xdef\cmya{0}}}}%
+ %%on fait les calculs
+\begin{align*}
+ %Premier compteur \xxx
+ \ifnum\cmxa>0
+ \Nomx\uppercase{&}=\frac{\the\valx\times\the\Valx}{\the\denox}\global\numx=\numexpr\the\valx*\the\Valx\relax
+ \fi
+ % % Deuxième compteur \yyy
+ \ifnum\cmya>0
+ \ifnum\cmxa=0
+ \else
+ \uppercase{&}
+ \fi%
+ \Nomy\uppercase{&}=\frac{\the\valy\times\the\Valy}{\the\denoy}\global\numy=\numexpr\the\valy*\the\Valy\relax
+ % \else
+ % \uppercase{&}\Nomy\uppercase{&}=\frac{\the\valy\times\the\Valy}{\the\denoy}\global\numy=\numexpr\the\valy*\the\Valy\relax
+ % \fi
+ \fi
+ % Troisième compteur \zzz
+ \ifnum\cmza>0
+ \ifnum\cmxa=0
+ \ifnum\cmya=0
+ %\Nomz\uppercase{&}=\frac{\the\valz\times\the\Valz}{\the\denoz}\global\numz=\numexpr\the\valz*\the\Valz\relax
+ \else
+ \uppercase{&}%\Nomz\uppercase{&}=\frac{\the\valz\times\the\Valz}{\the\denoz}\global\numz=\numexpr\the\valz*\the\Valz\relax
+ \fi
+ \Nomz\uppercase{&}=\frac{\the\valz\times\the\Valz}{\the\denoz}\global\numz=\numexpr\the\valz*\the\Valz\relax
+ \else
+ \uppercase{&}\Nomz\uppercase{&}=\frac{\the\valz\times\the\Valz}{\the\denoz}\global\numz=\numexpr\the\valz*\the\Valz\relax
+ \fi
+ \fi
+ \\
+ % 2eme ligne du tableau : calcul des numérateurs
+ %Premier compteur \xxx
+ \ifnum\cmxa>0
+ \Nomx\uppercase{&}=\frac{\num{\the\numx}}{\num{\the\denox}}
+ \fi
+ % % Deuxième compteur \yyy
+ \ifnum\cmya>0
+ \ifnum\cmxa=0
+ %\Nomy\uppercase{&}=\frac{\num{\the\numy}}{\num{\the\denoy}}
+ \else
+ \uppercase{&}%\Nomy\uppercase{&}=\frac{\num{\the\numy}}{\num{\the\denoy}}
+ \fi
+ \Nomy\uppercase{&}=\frac{\num{\the\numy}}{\num{\the\denoy}}%
+ \fi
+ %Troisième compteur \zzz
+ \ifnum\cmza>0
+ \ifnum\cmxa=0
+ \ifnum\cmya=0
+ %\Nomz\uppercase{&}=\frac{\num{\the\numz}}{\num{\the\denoz}}
+ \else
+ \uppercase{&}%\Nomz\uppercase{&}=\frac{\num{\the\numz}}{\num{\the\denoz}}
+ \fi
+ \Nomz\uppercase{&}=\frac{\num{\the\numz}}{\num{\the\denoz}}
+ \else
+ \uppercase{&}\Nomz\uppercase{&}=\frac{\num{\the\numz}}{\num{\the\denoz}}
+ \fi
+ \fi
+ \\
+ % 3eme ligne : faire les simplifications ou pas ?
+ %Premier compteur \xxx
+ \ifnum\cmxa>0
+ \PGCD{\the\numx}{\the\denox}
+ \ifnum\pgcd>1
+ \Nomx\uppercase{&}=\SSimpli{\the\numx}{\the\denox}
+ \else
+ \uppercase{&}
+ \fi
+ \fi
+ % % Deuxième compteur \yyy
+ \ifnum\cmya>0
+ \PGCD{\the\numy}{\the\denoy}
+ \ifnum\cmxa=0
+ \ifnum\pgcd>1
+ \Nomy\uppercase{&}=\SSimpli{\the\numy}{\the\denoy}
+ \else
+ \uppercase{&}
+ \fi
+ \else
+ \ifnum\pgcd>1
+ \uppercase{&}\Nomy\uppercase{&}=\SSimpli{\the\numy}{\the\denoy}
+ \else
+ \uppercase{&&}
+ \fi
+ \fi
+ \fi
+ %Troisième compteur \zzz
+ \ifnum\cmza>0
+ \PGCD{\the\numz}{\the\denoz}
+ \ifnum\cmxa=0
+ \ifnum\cmya=0
+ \ifnum\pgcd>1
+ \Nomz\uppercase{&}=\SSimpli{\the\numz}{\the\denoz}
+ \else
+ \uppercase{&}
+ \fi
+ \else
+ \ifnum\pgcd>1
+ \uppercase{&}\Nomz\uppercase{&}=\SSimpli{\the\numz}{\the\denoz}
+ \else
+ \uppercase{&&}
+ \fi
+ \fi
+ \else
+ \ifnum\pgcd>1
+ \uppercase{&}\Nomz\uppercase{&}=\SSimpli{\the\numz}{\the\denoz}
+ \else
+ \uppercase{&&}
+ \fi
+ \fi
+ \fi
+ \\
+ % 4eme ligne : Terminer les simplifications ?
+ %Premier compteur \xxx
+ \ifnum\cmxa>0
+ \PGCD{\the\numx}{\the\denox}
+ \ifnum\pgcd>1
+ \ifnum\pgcd<\the\denox
+ \Nomx\uppercase{&}=\SSimplifie{\the\numx}{\the\denox}
+ \else
+ \uppercase{&}
+ \fi
+ \else
+ \uppercase{&}
+ \fi
+ \fi
+ % % Deuxième compteur \yyy
+ \ifnum\cmya>0
+ \PGCD{\the\numy}{\the\denoy}
+ \ifnum\cmxa=0
+ \ifnum\pgcd>1
+ \ifnum\pgcd<\the\denoy
+ \Nomy\uppercase{&}=\SSimplifie{\the\numy}{\the\denoy}
+ \else
+ \uppercase{&}
+ \fi
+ \else
+ \uppercase{&}
+ \fi
+ \else
+ \ifnum\pgcd>1
+ \ifnum\pgcd<\the\denoy
+ \uppercase{&}\Nomy\uppercase{&}=\SSimplifie{\the\numy}{\the\denoy}
+ \else
+ \uppercase{&&}
+ \fi
+ \else
+ \uppercase{&&}
+ \fi
+ \fi
+ \fi
+ %Troisième compteur \zzz
+ \ifnum\cmza>0
+ \PGCD{\the\numz}{\the\denoz}
+ \ifnum\cmxa=0
+ \ifnum\cmya=0
+ \ifnum\pgcd>1
+ \ifnum\pgcd<\the\denoz
+ \Nomz\uppercase{&}=\SSimplifie{\the\numz}{\the\denoz}
+ \else
+ \uppercase{&}
+ \fi
+ \else
+ \uppercase{&}
+ \fi
+ \else
+ \ifnum\pgcd>1
+ \ifnum\pgcd<\the\denoz
+ \uppercase{&}\Nomz\uppercase{&}=\SSimplifie{\the\numz}{\the\denoz}
+ \else
+ \uppercase{&&}
+ \fi
+ \else
+ \uppercase{&&}
+ \fi
+ \fi
+ \else
+ \ifnum\pgcd>1
+ \ifnum\pgcd<\the\denoz
+ \uppercase{&}\Nomz\uppercase{&}=\SSimplifie{\the\numz}{\the\denoz}
+ \else
+ \uppercase{&&}
+ \fi
+ \else
+ \uppercase{&&}
+ \fi
+ \fi
+ \fi%\\
+\end{align*}
+}{}%
+}
+
+\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}}}%
+ }%
+}%
+%%%%
+
+\newcommand{\ReciThales}[6][]{%
+ Dans le triangle $#2#3#4$, $#5$ est un point \ifboolKV[ClesThales]{Segment}{du segment $[#2#3]$}{de la
+ droite $(#2#3)$}, $#6$ est un point \ifboolKV[ClesThales]{Segment}{du segment $[#2#4]$}{de la droite $(#2#4)$}.
+ \ifboolKV[ClesThales]{Propor}{Le tableau $\begin{array}{c|c}
+ #2#5&#2#6\\
+ \hline
+ #2#3&#2#4\\
+ \end{array}
+ $ est-il un tableau de proportionnalité ?
+ }{%
+ }
+}
+
+\newcommand{\ReciThalesCalculs}[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]{Produit}{%
+ \begin{align*}
+ \dfrac{\NomA\NomM}{\NomA\NomB}=\dfrac{\num{#3}}{\num{#4}}&&\dfrac{\NomA\NomN}{\NomA\NomC}=\dfrac{\num{#5}}{\num{#6}}
+ \end{align*}
+ Effectuons les produits en croix :\xdef\NumA{\fpeval{#3*#6}}\xdef\NumB{\fpeval{#4*#5}}
+ \begin{align*}
+ \num{#3}\times\num{#6}&=\num{\fpeval{#3*#6}}&&&\num{#4}\times\num{#5}&=\num{\fpeval{#4*#5}}
+ \end{align*}
+ \xintifboolexpr{\NumA = \NumB}{Comme les produits en croix sont
+ égaux alors
+ $\dfrac{\NomA\NomM}{\NomA\NomB}=\dfrac{\NomA\NomN}{\NomA\NomC}$.\\[0.5em]%
+ }{%
+ Comme les produits en croix sont différents alors
+ $\dfrac{\NomA\NomM}{\NomA\NomB}\not=\dfrac{\NomA\NomN}{\NomA\NomC}$.\\%
+ }%
+ }{%
+ \[\left.
+ \begin{array}{l}
+ \dfrac{\NomA\NomM}{\NomA\NomB}=\dfrac{\num{#3}}{\num{#4}}\ifx\bla#7\bla\ifboolKV[ClesThales]{Simplification}{\PGCD{#3}{#4}\xintifboolexpr{\pgcd=1}{%il faut regarder si on doit continuer avec le PPCM...
+ \PGCD{#5}{#6}\xintifboolexpr{\pgcd>1}{\xdef\DenomSimpaa{\fpeval{#6/\pgcd}}\PPCM{#4}{\DenomSimpaa}\xintifboolexpr{\ppcm=#4}{}{=\dfrac{#3\times\num{\fpeval{\ppcm/#4}}}{#4\times\num{\fpeval{\ppcm/#4}}}=\dfrac{\num{\fpeval{#3*\ppcm/#4}}}{\num{\fpeval{\ppcm}}}}}{}%
+ }{=\displaystyle\Simplification[All]{#3}{#4}\PGCD{#3}{#4}\xdef\NumSimp{\fpeval{#3/\pgcd}}\xdef\DenomSimp{\fpeval{#4/\pgcd}}\PGCD{#5}{#6}\xdef\NumSimpa{\fpeval{#5/\pgcd}}\xdef\DenomSimpa{\fpeval{#6/\pgcd}}\PPCM{\DenomSimp}{\DenomSimpa}\xintifboolexpr{\fpeval{\the\ppcm/\DenomSimp}=1}{}{=\dfrac{\num{\NumSimp}\times\num{\fpeval{\the\ppcm/\DenomSimp}}}{\num{\DenomSimp}\times\PPCM{\DenomSimp}{\DenomSimpa}\num{\fpeval{\the\ppcm/\DenomSimp}}}=\dfrac{\PPCM{\DenomSimp}{\DenomSimpa}\num{\fpeval{\NumSimp*\the\ppcm/\DenomSimp}}}{\PPCM{\DenomSimp}{\DenomSimpa}\num{\the\ppcm}}}}}{\PPCM{#4}{#6}\xintifboolexpr{\fpeval{\the\ppcm/#4}=1}{}{=\dfrac{\num{#3}\times\num{\fpeval{\the\ppcm/#4}}}{\num{#4}\times\PPCM{#4}{#6}\num{\fpeval{\the\ppcm/#4}}}=\dfrac{\PPCM{#4}{#6}\num{\fpeval{#3*\the\ppcm/#4}}}{\PPCM{#4}{#6}\num{\the\ppcm}}}}\xdef\NumA{\fpeval{#3*#6}}\else%
+ \xintifboolexpr{#7=1}{}{=\dfrac{\num{#3}\times\num{#7}}{\num{#4}\times\num{#7}}=\dfrac{\num{\fpeval{#3*#7}}}{\num{\fpeval{#4*#7}}}}\xdef\NumC{\fpeval{#4*#7}}\xdef\NumD{\fpeval{#6*#8}}\PPCM{\NumC}{\NumD}\xintifboolexpr{\the\ppcm=\fpeval{#4*#7}}{}{=\dfrac{\num{\fpeval{#3*#7}}\times\num{\fpeval{\the\ppcm/(#4*#7)}}}{\num{\fpeval{#4*#7}}\times\xdef\NumC{\fpeval{#4*#7}}\xdef\NumD{\fpeval{#6*#8}}\PPCM{\NumC}{\NumD}\num{\fpeval{\the\ppcm/(#4*#7)}}}=\dfrac{\xdef\NumC{\fpeval{#4*#7}}\xdef\NumD{\fpeval{#6*#8}}\PPCM{\NumC}{\NumD}\num{\fpeval{#3*\the\ppcm/#4}}}{\xdef\NumC{\fpeval{#4*#7}}\xdef\NumD{\fpeval{#6*#8}}\PPCM{\NumC}{\NumD}\num{\fpeval{\the\ppcm}}}}\xdef\NumA{\fpeval{#3*#7*#6*#8}}
+ \fi
+ \\
+ \\
+ \dfrac{\NomA\NomN}{\NomA\NomC}=\dfrac{\num{#5}}{\num{#6}}%
+ \ifx\bla#8\bla%
+ \ifboolKV[ClesThales]{Simplification}{\PGCD{#5}{#6}\xintifboolexpr{\pgcd=1}{%il faut regarder si on doit continuer avec le PPCM...
+ \PGCD{#3}{#4}\xintifboolexpr{\pgcd>1}{\xdef\DenomSimpaa{\fpeval{#4/\pgcd}}\PPCM{#6}{\DenomSimpaa}\xintifboolexpr{\ppcm=#6}{}{=\dfrac{#5\times\num{\fpeval{\ppcm/#6}}}{#6\times\num{\fpeval{\ppcm/#6}}}=\dfrac{\num{\fpeval{#5*\ppcm/#6}}}{\num{\fpeval{\ppcm}}}}}{}%
+ }{=\displaystyle\Simplification[All]{#5}{#6}\PGCD{#5}{#6}\xdef\NumSimp{\fpeval{#5/\pgcd}}\xdef\DenomSimp{\fpeval{#6/\pgcd}}\PGCD{#3}{#4}\xdef\NumSimpa{\fpeval{#3/\pgcd}}\xdef\DenomSimpa{\fpeval{#4/\pgcd}}\PPCM{\DenomSimp}{\DenomSimpa}\xintifboolexpr{\fpeval{\the\ppcm/\DenomSimp}=1}{}{=\dfrac{\num{\NumSimp}\times\num{\fpeval{\the\ppcm/\DenomSimp}}}{\num{\DenomSimp}\times\PPCM{\DenomSimp}{\DenomSimpa}\num{\fpeval{\the\ppcm/\DenomSimp}}}=\dfrac{\PPCM{\DenomSimp}{\DenomSimpa}\num{\fpeval{\NumSimp*\the\ppcm/\DenomSimp}}}{\PPCM{\DenomSimp}{\DenomSimpa}\num{\the\ppcm}}}}}{\PPCM{#4}{#6}\xintifboolexpr{\fpeval{\the\ppcm/#6}=1}{}{=\dfrac{\num{#5}\times\num{\fpeval{\the\ppcm/#6}}}{\num{#6}\times\PPCM{#4}{#6}\num{\fpeval{\the\ppcm/#6}}}=\dfrac{\PPCM{#4}{#6}\num{\fpeval{#5*\the\ppcm/#6}}}{\PPCM{#4}{#6}\num{\the\ppcm}}}}\xdef\NumB{\fpeval{#5*#4}}%
+ \else%
+ \xintifboolexpr{#8=1}{}{=\dfrac{\num{#5}\times\num{#8}}{\num{#6}\times\num{#8}}=\dfrac{\num{\fpeval{#5*#8}}}{\num{\fpeval{#6*#8}}}}\xdef\NumC{\fpeval{#4*#7}}\xdef\NumD{\fpeval{#6*#8}}\PPCM{\NumC}{\NumD}\xintifboolexpr{\the\ppcm=\fpeval{#6*#8}}{}{=\dfrac{\num{\fpeval{#5*#8}}\times\num{\fpeval{\the\ppcm/(#6*#8)}}}{\num{\fpeval{#6*#8}}\times\xdef\NumC{\fpeval{#4*#7}}\xdef\NumD{\fpeval{#6*#8}}\PPCM{\NumC}{\NumD}\num{\fpeval{\the\ppcm/(#6*#8)}}}=\dfrac{\xdef\NumC{\fpeval{#4*#7}}\xdef\NumD{\fpeval{#6*#8}}\PPCM{\NumC}{\NumD}\num{\fpeval{#5*\the\ppcm/#6}}}{\xdef\NumC{\fpeval{#4*#7}}\xdef\NumD{\fpeval{#6*#8}}\PPCM{\NumC}{\NumD}\num{\fpeval{\the\ppcm}}}
+ }\xdef\NumB{\fpeval{#5*#8*#4*#7}}
+ \fi\\
+ \end{array}
+ \right\}\ifnum\NumA=\NumB \dfrac{\NomA\NomM}{\NomA\NomB}=\dfrac{\NomA\NomN}{\NomA\NomC}\else\dfrac{\NomA\NomM}{\NomA\NomB}\not=\dfrac{\NomA\NomN}{\NomA\NomC}\fi
+ \]
+ }
+ \ifboolKV[ClesThales]{Propor}{%
+ \ifnum\NumA=\NumB Donc le tableau $\begin{array}{c|c}
+ \NomA\NomM&\NomA\NomN\\
+ \hline
+ \NomA\NomB&\NomA\NomC\\
+ \end{array}
+ $ est bien un tableau de proportionnalité.\\De plus, les points
+ $\NomA$, $\NomM$, $\NomB$ sont alignés dans le même ordre que les
+ points $\NomA$, $\NomN$, $\NomC$. Donc les droites $(\NomM\NomN)$
+ et $(\NomB\NomC)$ sont parallèles d'après la réciproque du
+ théorème de Thalès.\else%
+ Donc les droites $(\NomM\NomN)$ et $(\NomB\NomC)$ ne sont pas parallèles.\fi
+ }{%
+ \xintifboolexpr{\NumA=\NumB}{%
+ De plus, les points $\NomA$, $\NomM$, $\NomB$ sont alignés dans
+ le même ordre que les points $\NomA$, $\NomN$, $\NomC$. Donc les
+ droites $(\NomM\NomN)$ et $(\NomB\NomC)$ sont parallèles d'après
+ la réciproque du théorème de Thalès.}{%
+ Donc les droites $(\NomM\NomN)$ et $(\NomB\NomC)$ ne sont pas
+ parallèles.}
+ }
+}
+
+\newcommand\ReciproqueThales[8][]{%
+ % #1 Clés
+ % #2 NomTriangle + Points ABCEF pour droite (BC)//(EF)
+ % #3 longueur AE
+ % #4 longueur AB
+ % #5 longueur AF
+ % #6 longueur AC
+ \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}\]
+ \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}
+ }
+ }
+}
+
+\newcommand{\Thales}[8][]{%
+ \useKVdefault[ClesThales]%
+ \setKV[ClesThales]{#1}%
+ \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}}%
+ }{%
+ \TThales[#1]{#2}{#3}{#4}{#5}{#6}{#7}{#8}%
+ }
+ }%
+}%
+
+%%%%%%%%%%%%%%%%
+%% Trigonométrie
+%%%%%%%%%%%%%%%%
+\def\MPFigTrigo#1#2#3#4#5#6#7{%
+ \ifluatex
+ \mplibcodeinherit{enable}
+ \mplibforcehmode
+ \begin{mplibcode}
+ u:=1cm;
+ pair A,B,C,O,I,D,E,F;%
+ % On place les points A,B,C sur le cercle de manière à faciliter la rotation de la figure
+ A=u*(1,1);
+ B-A=u*(3,0);
+ C=(A--2[A,B rotatedabout(A,50)]) intersectionpoint (B--2[B,A rotatedabout(B,-90)]);
+ % On définit le centre du cercle circonscrit
+ 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 :)
+ path triangle;
+ triangle=A{dir(angle(B-A)+5)}..B{dir(angle(B-A)+5)}--B{dir(angle(C-B)+5)}..C{dir(angle(C-B)+5)}--C{dir(angle(A-C)+5)}..A{dir(angle(A-C)+5)}--cycle;
+ % on définit l'angle droit
+ D-B=7*unitvector(C-B);
+ F-B=7*unitvector(A-B);
+ E-D=F-B;
+ draw D{dir(angle(E-D)+5)}..E{dir(angle(E-D)+5)}--E{dir(angle(F-E)+5)}..F{dir(angle(F-E)+5)};
+ % L'angle :)
+ path cc;
+ cc=fullcircle scaled 1u;
+ % on marque les angles
+ picture MAngle;
+ MAngle=image(
+ draw (cc shifted A);
+ % draw (cc shifted B);
+ % draw (cc shifted C);
+ );
+ draw MAngle;
+ clip currentpicture to triangle;
+ 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
+ picture z;
+ label(btex #1 etex,1.15[O,A]);
+ label(btex #2 etex,1.15[O,B]);
+ label(btex #3 etex,1.15[O,C]);
+ label(btex \ang{#7} etex,A+0.95u*unitvector(I-A));
+ decalage:=3mm;
+ if #6<0:
+ 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]]);
+ else:
+ label(btex \num{#6} etex rotated angle(C-A),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]]);
+ else:
+ label(btex \num{#6} etex rotated angle(A-C),1.1[B,1/2[A,C]]);
+ fi;
+ fi;
+ fi;
+ if #4<0:
+ 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)));
+ else:
+ label(btex \num{#4} etex rotated(angle(B-C)),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)));
+ else:
+ label(btex \num{#4} etex rotated(angle(C-B)),1/2[B,C]-decalage*(unitvector(A-B)));
+ fi;
+ fi;
+ fi;
+ if #5<0:
+ 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)));
+ else:
+ label(btex \num{#5} etex rotated angle(A-B),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)));
+ else:
+ label(btex \num{#5} etex rotated angle(B-A),1/2[A,B]-decalage*(unitvector(C-B)));
+ fi;
+ fi;
+ fi;
+ \end{mplibcode}
+ \mplibcodeinherit{disable}
+ \else
+ \begin{mpost}
+ u:=1cm;
+ pair A,B,C,O,I,D,E,F;%
+ % On place les points A,B,C sur le cercle de manière à faciliter la rotation de la figure
+ A=u*(1,1);
+ B-A=u*(3,0);
+ C=(A--2[A,B rotatedabout(A,50)]) intersectionpoint (B--2[B,A rotatedabout(B,-90)]);
+ % On définit le centre du cercle circonscrit
+ 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 :)
+ path triangle;
+ triangle=A{dir(angle(B-A)+5)}..B{dir(angle(B-A)+5)}--B{dir(angle(C-B)+5)}..C{dir(angle(C-B)+5)}--C{dir(angle(A-C)+5)}..A{dir(angle(A-C)+5)}--cycle;
+ % on définit l'angle droit
+ D-B=7*unitvector(C-B);
+ F-B=7*unitvector(A-B);
+ E-D=F-B;
+ draw D{dir(angle(E-D)+5)}..E{dir(angle(E-D)+5)}--E{dir(angle(F-E)+5)}..F{dir(angle(F-E)+5)};
+ % L'angle :)
+ path cc;
+ cc=fullcircle scaled 1u;
+ % on marque les angles
+ picture MAngle;
+ MAngle=image(
+ draw (cc shifted A);
+ % draw (cc shifted B);
+ % draw (cc shifted C);
+ );
+ draw MAngle;
+ clip currentpicture to triangle;
+ 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
+ picture z;
+ label(btex #1 etex,1.15[O,A]);
+ label(btex #2 etex,1.15[O,B]);
+ label(btex #3 etex,1.15[O,C]);
+ label(btex \ang{#7} etex,A+0.95u*unitvector(I-A));
+ decalage:=3mm;
+ if #6<0:
+ 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]]);
+ else:
+ label(btex \num{#6} etex rotated angle(C-A),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]]);
+ else:
+ label(btex \num{#6} etex rotated angle(A-C),1.1[B,1/2[A,C]]);
+ fi;
+ fi;
+ fi;
+ if #4<0:
+ 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)));
+ else:
+ label(btex \num{#4} etex rotated(angle(B-C)),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)));
+ else:
+ label(btex \num{#4} etex rotated(angle(C-B)),1/2[B,C]-decalage*(unitvector(A-B)));
+ fi;
+ fi;
+ fi;
+ if #5<0:
+ 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)));
+ else:
+ label(btex \num{#5} etex rotated angle(A-B),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)));
+ else:
+ label(btex \num{#5} etex rotated angle(B-A),1/2[A,B]-decalage*(unitvector(C-B)));
+ fi;
+ fi;
+ fi;
+\end{mpost}
+\fi
+}
+
+\def\MPFigTrigoAngle#1#2#3#4#5#6{%
+ % #1 A
+ % #2 B
+ % #3 C
+ % #4 opp
+ % #5 adj
+ % #6 hyp
+ \ifluatex
+ \mplibcodeinherit{enable}
+ \mplibforcehmode
+ \begin{mplibcode}
+ u:=1cm;
+ pair A,B,C,O,I,D,E,F;%
+ % On place les points A,B,C sur le cercle de manière à faciliter la rotation de la figure
+ A=u*(1,1);
+ B-A=u*(3,0);
+ C=(A--2[A,B rotatedabout(A,50)]) intersectionpoint (B--2[B,A rotatedabout(B,-90)]);
+ % On définit le centre du cercle circonscrit
+ 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
+ (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 :)
+ path triangle;
+ triangle=A{dir(angle(B-A)+5)}..B{dir(angle(B-A)+5)}--B{dir(angle(C-B)+5)}..C{dir(angle(C-B)+5)}--C{dir(angle(A-C)+5)}..A{dir(angle(A-C)+5)}--cycle;
+ %on définit l'angle droit
+ D-B=7*unitvector(C-B);
+ F-B=7*unitvector(A-B);
+ E-D=F-B;
+ draw D{dir(angle(E-D)+5)}..E{dir(angle(E-D)+5)}--E{dir(angle(F-E)+5)}..F{dir(angle(F-E)+5)};
+ %L'angle :)
+ path cc;
+ cc=fullcircle scaled 1u;
+ % on marque les angles
+ picture MAngle;
+ MAngle=image(
+ draw (cc shifted A);
+% draw (cc shifted B);
+% draw (cc shifted C);
+ );
+ draw MAngle;
+ clip currentpicture to triangle;
+ 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
+ label(btex #1 etex,1.15[O,A]);
+ label(btex #2 etex,1.15[O,B]);
+ label(btex #3 etex,1.15[O,C]);
+ 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]]);
+ else:
+ label(btex \num{#6} etex rotated angle(A-C),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)));
+ else:
+ label(btex \num{#4} etex rotated(angle(C-B)),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)));
+ else:
+ label(btex \num{#5} etex rotated angle(B-A),1/2[A,B]-decalage*(unitvector(C-B)));
+ fi;
+\end{mplibcode}
+\mplibcodeinherit{disable}
+ \else
+ \begin{mpost}
+ u:=1cm;
+ pair A,B,C,O,I,D,E,F;%
+ %On place les points A,B,C sur le cercle de manière à faciliter la rotation de la figure
+ A=u*(1,1);
+ B-A=u*(3,0);
+ C=(A--2[A,B rotatedabout(A,50)]) intersectionpoint (B--2[B,A rotatedabout(B,-90)]);
+ % On définit le centre du cercle circonscrit
+ 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 :)
+ path triangle;
+ triangle=A{dir(angle(B-A)+5)}..B{dir(angle(B-A)+5)}--B{dir(angle(C-B)+5)}..C{dir(angle(C-B)+5)}--C{dir(angle(A-C)+5)}..A{dir(angle(A-C)+5)}--cycle;
+ %on définit l'angle droit
+ D-B=7*unitvector(C-B);
+ F-B=7*unitvector(A-B);
+ E-D=F-B;
+ draw D{dir(angle(E-D)+5)}..E{dir(angle(E-D)+5)}--E{dir(angle(F-E)+5)}..F{dir(angle(F-E)+5)};
+ %L'angle :)
+ path cc;
+ cc=fullcircle scaled 1u;
+ % on marque les angles
+ picture MAngle;
+ MAngle=image(
+ draw (cc shifted A);
+% draw (cc shifted B);
+% draw (cc shifted C);
+ );
+ draw MAngle;
+ clip currentpicture to triangle;
+ 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
+ label(btex #1 etex,1.15[O,A]);
+ label(btex #2 etex,1.15[O,B]);
+ label(btex #3 etex,1.15[O,C]);
+ 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]]);
+ else:
+ label(btex \num{#6} etex rotated angle(A-C),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)));
+ else:
+ label(btex \num{#4} etex rotated(angle(C-B)),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)));
+ else:
+ label(btex \num{#5} etex rotated angle(B-A),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}%
+
+\newcommand\TrigoCalculs[5][]{%
+ \setKV[ClesTrigo]{#1}%
+ % #1 Clés
+ % #2 Nom du triangle ABC, rectangle en B, angle connu ou pas : BAC
+ % #3 Longueur
+ % #4 Longueur
+ %#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 :
+ \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\\
+ \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*}%
+ }{%
+ \begin{align*}
+ \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*}%
+ }%
+ \xdef\ResultatTrigo{\fpeval{round(\fpeval{#4*cosd(#5)},\useKV[ClesTrigo]{Precision})}}%
+ \else
+ \ifx\bla#4\bla%on calcule l'hypothénuse
+ \ifboolKV[ClesTrigo]{Propor}{%
+ \begin{align*}
+ \NomA\NomC\times\cos(\widehat{\NomB\NomA\NomC})&=\NomA\NomB\\
+ \NomA\NomC\times\cos(\ang{#5})&=\num{#3}\\
+ \NomA\NomC&=\frac{\num{#3}}{\cos(\ang{#5})}\\
+ \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*}
+ }{%
+ \begin{align*}
+ \cos(\widehat{\NomB\NomA\NomC})&=\frac{\NomA\NomB}{\NomA\NomC}\\
+ \cos(\ang{#5})&=\frac{\num{#3}}{\NomA\NomC}\\
+ \NomA\NomC&=\frac{\num{#3}}{\cos(\ang{#5})}\\
+ \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
+ \ifboolKV[ClesTrigo]{Propor}{%
+ \begin{align*}
+ \NomA\NomC\times\cos(\widehat{\NomB\NomA\NomC})&=\NomA\NomB\\
+ \num{#4}\times\cos(\widehat{\NomB\NomA\NomC})&=\num{#3}\\
+ \cos(\widehat{\NomB\NomA\NomC})&=\frac{\num{#3}}{\num{#4}}\\
+ \widehat{\NomB\NomA\NomC}&\IfInteger{\fpeval{round(\fpeval{acosd(#3/#4)},2)}}{=}{\approx}\ang{\fpeval{round(\fpeval{acosd(#3/#4)})}}%
+ \end{align*}%
+ }{%
+ \begin{align*}
+ \cos(\widehat{\NomB\NomA\NomC})&=\frac{\NomA\NomB}{\NomA\NomC}\\
+ \cos(\widehat{\NomB\NomA\NomC})&=\frac{\num{#3}}{\num{#4}}\\
+ \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
+ }{}
+ \ifboolKV[ClesTrigo]{Sinus}{%
+ \ifx\bla#3\bla%on calcule le côté opposé
+ \ifboolKV[ClesTrigo]{Propor}{%
+ \begin{align*}
+ \NomA\NomC\times\sin(\widehat{\NomB\NomA\NomC})&=\NomB\NomC\\
+ \num{#4}\times\sin(\ang{#5})&=\NomB\NomC\\
+ \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*}%
+ }{%
+ \begin{align*}
+ \sin(\widehat{\NomB\NomA\NomC})&=\frac{\NomB\NomC}{\NomA\NomC}\\
+ \sin(\ang{#5})&=\frac{\NomB\NomC}{\num{#4}}\\
+ \num{#4}\times\sin(\ang{#5})&=\NomB\NomC\\
+ \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
+ \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
+ \ifboolKV[ClesTrigo]{Propor}{%
+ \begin{align*}
+ \NomA\NomC\times\sin(\widehat{\NomB\NomA\NomC})&=\NomB\NomC\\
+ \num{#4}\times\sin(\widehat{\NomB\NomA\NomC})&=\num{#3}\\
+ \sin(\widehat{\NomB\NomA\NomC})&=\frac{\num{#3}}{\num{#4}}\\
+ \widehat{\NomB\NomA\NomC}&\IfInteger{\fpeval{round(\fpeval{asind(#3/#4)},2)}}{=}{\approx}\ang{\fpeval{round(\fpeval{asind(#3/#4)})}}%
+ \end{align*}%
+ }{
+ \begin{align*}
+ \sin(\widehat{\NomB\NomA\NomC})&=\frac{\NomB\NomC}{\NomA\NomC}\\
+ \sin(\widehat{\NomB\NomA\NomC})&=\frac{\num{#3}}{\num{#4}}\\
+ \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
+ }{}
+ \ifboolKV[ClesTrigo]{Tangente}{%
+ \ifx\bla#3\bla%on calcule le côté opposé
+ \ifboolKV[ClesTrigo]{Propor}{%
+ \begin{align*}
+ \NomA\NomB\times\tan(\widehat{\NomB\NomA\NomC})&=\NomB\NomC\\%
+ \num{#4}\times\tan(\ang{#5})&=\NomB\NomC\\%
+ \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*}%
+ }{%
+ \begin{align*}
+ \tan(\widehat{\NomB\NomA\NomC})&=\frac{\NomB\NomC}{\NomA\NomB}\\
+ \tan(\ang{#5})&=\frac{\NomB\NomC}{\num{#4}}\\
+ \num{#4}\times\tan(\ang{#5})&=\NomB\NomC\\
+ \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
+ \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})}}%
+ \else%on calcule l'angle
+ \ifboolKV[ClesTrigo]{Propor}{%
+ \begin{align*}
+ \NomA\NomB\times\tan(\widehat{\NomB\NomA\NomC})&=\NomB\NomC\\
+ \num{#4}\times\tan(\widehat{\NomB\NomA\NomC})&=\num{#3}\\
+ \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}}\\
+ \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
+ }{}
+}
+
+\newcommand\Trigo[5][]{%
+ \useKVdefault[ClesTrigo]%
+ \setKV[ClesTrigo]{#1}%
+ % #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
+ % 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]{Cosinus}{%
+ \begin{center}
+ \MPFigTrigoAngle{\NomA}{\NomB}{\NomC}{}{#3}{#4}
+ \end{center}
+ }{}%
+ \ifboolKV[ClesTrigo]{Sinus}{%
+ \begin{center}
+ \MPFigTrigoAngle{\NomA}{\NomB}{\NomC}{#3}{}{#4}
+ \end{center}
+ }{}%
+ \ifboolKV[ClesTrigo]{Tangente}{%
+ \begin{center}
+ \MPFigTrigoAngle{\NomA}{\NomB}{\NomC}{#3}{#4}{}
+ \end{center}
+ }{}%
+ }{%figure pour calculer une longueur
+ \ifboolKV[ClesTrigo]{Cosinus}{%
+ \ifx#3\bla\bla%adjacent inconnu
+ \begin{center}
+ \MPFigTrigo{\NomA}{\NomB}{\NomC}{-1}{0}{#4}{#5}
+ \end{center}
+ \else
+ \begin{center}
+ \MPFigTrigo{\NomA}{\NomB}{\NomC}{-1}{#3}{0}{#5}
+ \end{center}
+ \fi
+ }{}%
+ \ifboolKV[ClesTrigo]{Sinus}{%
+ \ifx#3\bla\bla%adjacent inconnu
+ \begin{center}
+ \MPFigTrigo{\NomA}{\NomB}{\NomC}{0}{-1}{#4}{#5}
+ \end{center}
+ \else
+ \begin{center}
+ \MPFigTrigo{\NomA}{\NomB}{\NomC}{#3}{-1}{0}{#5}
+ \end{center}
+ \fi
+ }{}%
+ \ifboolKV[ClesTrigo]{Tangente}{%
+ \ifx#3\bla\bla%adjacent inconnu
+ \begin{center}
+ \MPFigTrigo{\NomA}{\NomB}{\NomC}{0}{#4}{-1}{#5}
+ \end{center}
+ \else%
+ \begin{center}
+ \MPFigTrigo{\NomA}{\NomB}{\NomC}{#3}{0}{-1}{#5}
+ \end{center}
+ \fi%
+ }{}%
+ }%
+ \par\columnbreak\par
+ \TrigoCalculs{#2}{#3}{#4}{#5}%
+ \end{multicols}
+ }{%
+ \TrigoCalculs{#2}{#3}{#4}{#5}%
+ }%
+}%
+
+%%%%%%%%%%%%%%%
+%% Statistiques
+%%%%%%%%%%%%%%%
+\newcommand\NbDonnees{}
+\newcommand\SommeDonnees{}%
+\newcommand\EffectifTotal{}%
+\newcommand\Moyenne{}%
+\newcommand\Etendue{}%
+\newcommand\Mediane{}%
+\newcommand\DonneeMax{}%
+\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}
+
+% 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{%
+ \tabtoksa{\useKV[ClesStat]{Donnee}}\tabtoksb{\useKV[ClesStat]{Effectif}}%
+ \foreachitem\compteur\in\ListeComplete{\expandafter\updatetoks\compteur\nil}%
+ \[%
+ \begin{tabular}{|>{\columncolor{gray!15}}c|*{\number\numexpr\ListeCompletelen}{>{\centering\arraybackslash}p{\useKV[ClesStat]{Largeur}}|}}%
+ \hline%
+ \rowcolor{gray!15}\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}
+ \]
+}
+
+\def\buildtabt{%
+ \tabtoksa{\useKV[ClesStat]{Donnee}}\tabtoksb{\useKV[ClesStat]{Effectif}}%
+ \foreachitem\compteur\in\ListeComplete{\expandafter\updatetoks\compteur\nil}%
+ \[%
+ \begin{tabular}{|>{\columncolor{gray!15}}c|*{\number\numexpr\ListeCompletelen+1}{>{\centering\arraybackslash}p{\useKV[ClesStat]{Largeur}}|}}%
+ \hline%
+ \rowcolor{gray!15}\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}{}%
+ \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{gray!15}}c|*{\number\numexpr\ListeCompletelen}{>{\centering\arraybackslash}p{\useKV[ClesStat]{Largeur}}|}}%
+ \hline%
+ \rowcolor{gray!15}\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}{}%
+ \end{tabular}
+ \]
+}
+
+\def\buildtabqt{%
+ \tabtoksa{\useKV[ClesStat]{Donnee}}\tabtoksb{\useKV[ClesStat]{Effectif}}%
+ \foreachitem\compteur\in\ListeComplete{\expandafter\updatetoksq\compteur\nil}%
+ \[%
+ \begin{tabular}{|>{\columncolor{gray!15}}c|*{\number\numexpr\ListeCompletelen+1}{>{\centering\arraybackslash}p{\useKV[ClesStat]{Largeur}}|}}%
+ \hline%
+ \rowcolor{gray!15}\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}{}%
+ \end{tabular}
+ \]
+}
+
+% Pour construire le diagramme en bâtons
+\def\Updatetoks#1/#2\nil{\addtotok\toklistepoint{(#1,#2),}}
+\def\buildgraph{%
+ \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}}\]%
+}%
+
+% Pour construire le diagramme en bâtons qualitatif
+\def\Updatetoksq#1/#2\nil{\addtotok\toklistepointq{"#1",#2,}}
+\def\buildgraphq{%
+ \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}}\]
+}
+
+% Pour construire le diagramme circulaire qualitatif
+\def\buildgraphcq#1{%
+ \newtoks\toklistepointq%
+ \toklistepointq{}%
+ \foreachitem\compteur\in\ListeComplete{\expandafter\Updatetoksq\compteur\nil}%
+ \ifboolKV[ClesStat]{AffichageAngle}{%
+ \[\MPStatCirculaireQ{\useKV[ClesStat]{Rayon}}{\the\toklistepointq}{#1}{1}\]%
+ }{%
+ \[\MPStatCirculaireQ{\useKV[ClesStat]{Rayon}}{\the\toklistepointq}{#1}{0}\]%
+ }%
+}%
+
+%% calcul des fréquences
+\newcommand\CalculFrequence[1]{%
+ \fpeval{round(\ListeComplete[#1,2]*100/\EffectifTotal,0)}
+}
+
+%% calcul des angles
+\newcommand\CalculAngle[1]{%
+ \fpeval{round(\ListeComplete[#1,2]*360/\EffectifTotal,0)}
+}
+\newcommand\CalculSemiAngle[1]{%
+ \fpeval{round(\ListeComplete[#1,2]*180/\EffectifTotal,0)}
+}
+
+%% calcul des ECC
+\newcount\CompteurECC%
+\newcount\CompteurECCTotal%
+
+\newcommand\CalculECC[1]{%
+ \xdef\TotalECC{0}%
+ \CompteurECC=1%
+ \CompteurECCTotal=\numexpr#1+1%
+ \whiledo{\CompteurECC < \CompteurECCTotal}{
+ \xdef\TotalECC{\fpeval{\TotalECC+\ListeComplete[\the\CompteurECC,2]}}%
+ \CompteurECC=\numexpr\CompteurECC+1%
+ }%
+ \num{\TotalECC}%
+}
+
+% la construction du graphique
+\def\MPStat#1#2#3#4#5#6{%
+ \ifluatex
+ \mplibforcehmode
+ \begin{mplibcode}
+ maxx:=0;
+ maxy:=0;
+ unitex:=#1*cm;
+ unitey:=#2*cm;
+ pair A[],B[],P[];
+ n:=0;
+ vardef toto(text t)=
+ for p_=t:
+ if pair p_:
+ n:=n+1;
+ P[n]=((xpart(p_)-(#6))*unitex,ypart(p_)*unitey);
+ if xpart(p_)>maxx:
+ maxx:=xpart(p_)-(#6);
+ fi;
+ if ypart(p_)>maxy:
+ maxy:=ypart(p_);
+ fi;
+ A[n]=unitex*(xpart(p_)-(#6),0);
+ B[n]=unitey*(0,ypart(p_));
+ label.bot(TEX("\num{"&decimal(xpart(p_))&"}"),A[n]);
+ label.lft(TEX("\num{"&decimal(ypart(p_))&"}"),B[n]);
+ fi;
+ endfor;
+ enddef;
+ toto(#3);
+ for k=1 upto n:
+ draw A[k]--P[k] withpen pencircle scaled 2bp;
+ draw B[k]--P[k] dashed evenly;
+ 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));
+ \end{mplibcode}
+ \else
+ \begin{mpost}
+ maxx:=0;
+ maxy:=0;
+ unitex:=#1*cm;
+ unitey:=#2*cm;
+ pair A[],B[],P[];
+ n:=0;
+ vardef toto(text t)=
+ for p_=t:
+ if pair p_:
+ n:=n+1;
+ P[n]=((xpart(p_)-(#6))*unitex,ypart(p_)*unitey);
+ if xpart(p_)>maxx:
+ maxx:=xpart(p_)-(#6);
+ fi;
+ if ypart(p_)>maxy:
+ maxy:=ypart(p_);
+ fi;
+ A[n]=unitex*(xpart(p_)-(#6),0);
+ B[n]=unitey*(0,ypart(p_));
+ label.bot(LATEX("\num{"&decimal(xpart(p_))&"}"),A[n]);
+ label.lft(LATEX("\num{"&decimal(ypart(p_))&"}"),B[n]);
+ fi;
+ endfor;
+ enddef;
+ toto(#3);
+ for k=1 upto n:
+ draw A[k]--P[k] withpen pencircle scaled 2bp;
+ draw B[k]--P[k] dashed evenly;
+ 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));
+ \end{mpost}
+ \fi
+}
+
+% la construction du graphique qualitatif
+\def\MPStatQ#1#2#3#4#5#6{%
+ \ifluatex
+ \mplibforcehmode
+ \begin{mplibcode}
+ maxy:=0;
+ unitex:=#1*cm;
+ unitey:=#2*cm;
+ pair A[],B[],P[];
+ n:=0;
+ vardef toto(text t)=
+ for p_=t:
+ if numeric p_:
+ P[n]=((n+1)*unitex,unitey*p_);
+ B[n]=(0,unitey*p_);
+ label.lft(TEX("\num{"&decimal(p_)&"}"),B[n]);
+ if p_>maxy:
+ maxy:=p_;
+ fi;
+ n:=n+1;
+ else:
+ A[n]=unitex*(n+1,0);
+ label.bot(TEX(p_) rotated 90,A[n]);
+ fi;
+ endfor;
+ enddef;
+ toto(#3);
+ for k=0 upto n-1:
+ draw A[k]--P[k] withpen pencircle scaled 2bp;
+ draw B[k]--P[k] dashed evenly;
+ 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));
+ \end{mplibcode}
+ \else
+ \begin{mpost}
+ maxy:=0;
+ unitex:=#1*cm;
+ unitey:=#2*cm;
+ pair A[],B[],P[];
+ n:=0;
+ vardef toto(text t)=
+ for p_=t:
+ if numeric p_:
+ P[n]=((n+1)*unitex,unitey*p_);
+ B[n]=(0,unitey*p_);
+ label.lft(LATEX("\num{"&decimal(p_)&"}"),B[n]);
+ if p_>maxy:
+ maxy:=p_;
+ fi;
+ n:=n+1;
+ else:
+ A[n]=unitex*(n+1,0);
+ label.bot(LATEX(p_) rotated 90,A[n]);
+ fi;
+ endfor;
+ enddef;
+ toto(#3);
+ for k=0 upto n-1:
+ draw A[k]--P[k] withpen pencircle scaled 2bp;
+ draw B[k]--P[k] dashed evenly;
+ 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));
+ \end{mpost}
+ \fi
+}
+
+% la construction du graphique qualitatif
+\def\MPStatCirculaireQ#1#2#3#4{%
+ \ifluatex
+ \mplibforcehmode
+ \begin{mplibcode}
+ pair A[],O,B[],C[],D[];
+ O=(0,0);
+ n:=0;
+ numeric total[],ang[];
+ total[0]=0;
+ ang[0]:=0;
+ path cc;
+ cc=(fullcircle scaled (2*#1));
+ if #3=360:
+ draw cc;
+ else:
+ draw (subpath(0,length cc/2) of cc)--cycle;
+ fi;
+ A[0]=point(0) of cc;
+ vardef toto(text t)=
+ for p_=t:
+ if numeric p_:
+ n:=n+1;
+ total[n]:=total[n-1]+p_;
+ fi;
+ endfor;
+ N=n;
+ for k=1 upto N:
+ ang[k]=(#3/total[N])*total[k];
+ endfor;
+ n:=0;
+ for p_=t:
+ if numeric p_:
+ n:=n+1;
+ A[n]=A[n-1] rotatedabout(O,p_*(#3/total[N]));
+ draw A[n-1]--O--A[n];
+ % 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
+ else:
+ marque_a:=1.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)));
+ fi;
+ fi;
+ %
+ fi;
+ endfor;
+ 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);
+ 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)):
+ D[n]=C[n]+(0.5cm,0);
+ draw C[n]--D[n];
+ label.urt(TEX(p_),D[n]);
+ fi;
+ if (xpart(C[n])<xpart(O)) and (ypart(C[n])>ypart(O)):
+ D[n]=C[n]-(0.5cm,0);
+ draw C[n]--D[n];
+ label.ulft(TEX(p_),D[n]);
+ fi;
+ if (xpart(C[n])<xpart(O)) and (ypart(C[n])<ypart(O)):
+ D[n]=C[n]-(0.5cm,0);
+ draw C[n]--D[n];
+ label.llft(TEX(p_),D[n]);
+ fi;
+ if (xpart(C[n])>xpart(O)) and (ypart(C[n])<ypart(O)):
+ D[n]=C[n]+(0.5cm,0);
+ draw C[n]--D[n];
+ label.lrt(TEX(p_),D[n]);
+ fi;
+ fi;
+ endfor;
+ enddef;
+ Figure(-10u,-10u,10u,10u);
+ toto(#2);
+ \end{mplibcode}
+ \else
+ \begin{mpost}[mpsettings={input PfC-Geometrie;}]
+ pair A[],O,B[],C[],D[];
+ O=(0,0);
+ n:=0;
+ numeric total[],ang[];
+ total[0]=0;
+ ang[0]:=0;
+ path cc;
+ cc=(fullcircle scaled (2*#1));
+ if #3=360:
+ draw cc;
+ else:
+ draw (subpath(0,length cc/2) of cc)--cycle;
+ fi;
+ A[0]=point(0) of cc;
+ vardef toto(text t)=
+ for p_=t:
+ if numeric p_:
+ n:=n+1;
+ total[n]:=total[n-1]+p_;
+ fi;
+ endfor;
+ N=n;
+ for k=1 upto N:
+ ang[k]=(#3/total[N])*total[k];
+ endfor;
+ n:=0;
+ for p_=t:
+ if numeric p_:
+ n:=n+1;
+ A[n]=A[n-1] rotatedabout(O,p_*(#3/total[N]));
+ draw A[n-1]--O--A[n];
+ % 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
+ else:
+ marque_a:=1.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)));
+ fi;
+ fi;
+ %
+ fi;
+ endfor;
+ 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);
+ 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)):
+ D[n]=C[n]+(0.5cm,0);
+ draw C[n]--D[n];
+ label.urt(LATEX(p_),D[n]);
+ fi;
+ if (xpart(C[n])<xpart(O)) and (ypart(C[n])>ypart(O)):
+ D[n]=C[n]-(0.5cm,0);
+ draw C[n]--D[n];
+ label.ulft(LATEX(p_),D[n]);
+ fi;
+ if (xpart(C[n])<xpart(O)) and (ypart(C[n])<ypart(O)):
+ D[n]=C[n]-(0.5cm,0);
+ draw C[n]--D[n];
+ label.llft(LATEX(p_),D[n]);
+ fi;
+ if (xpart(C[n])>xpart(O)) and (ypart(C[n])<ypart(O)):
+ D[n]=C[n]+(0.5cm,0);
+ draw C[n]--D[n];
+ label.lrt(LATEX(p_),D[n]);
+ fi;
+ fi;
+ endfor;
+ enddef;
+ Figure(-10u,-10u,10u,10u);
+ toto(#2);
+ \end{mpost}
+ \fi
+}
+
+%Pour la médiane.
+\DTLgnewdb{mtdb}%
+\dtlexpandnewvalue%
+\newcount\nbdonnees%
+
+
+\newcommand\Stat[2][]{%
+ \useKVdefault[ClesStat]%
+ \setKV[ClesStat]{#1}%
+ \ifboolKV[ClesStat]{Liste}{%
+ \setsepchar{,}\ignoreemptyitems%
+ \readlist*\Liste{#2}%
+ \xdef\foo{}%
+ \setsepchar[*]{,*/}\ignoreemptyitems%
+ \xintFor* ##1 in {\xintSeq {1}{\Listelen}}\do{%
+ \xdef\foo{\foo 1/\Liste[##1],}%
+ }%
+ \readlist*\ListeComplete{\foo}%
+ \setKV[ClesStat]{Qualitatif}%
+ }{%
+ % % on lit la liste écrite sous la forme valeur/effectif
+ \setsepchar[*]{,*/}\ignoreemptyitems%
+ \readlist*\ListeComplete{#2}%
+ }
+ % 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
+ \foreachitem\x\in\ListeComplete{%
+ \DTLnewrow{mtdb}%
+ \itemtomacro\ListeComplete[\xcnt,2]\y%
+ \DTLnewdbentry{mtdb}{Numeric}{\y}%
+ }%
+ \dtlsort{Numeric}{mtdb}{\dtlicompare}%
+ % % on réinitialise les valeurs des critères de position et de
+ % dispersion
+ \renewcommand\NbDonnees{}
+ \renewcommand\SommeDonnees{}%
+ \renewcommand\EffectifTotal{}%
+ \renewcommand\Moyenne{}%
+ \renewcommand\Etendue{}%
+ \renewcommand\Mediane{}%
+ \renewcommand\DonneeMax{0}%
+ \renewcommand\EffectifMax{0}%
+ \renewcommand\DonneeMin{999999999}%
+ \ifboolKV[ClesStat]{Qualitatif}{%Début qualitatif
+ % Calculs
+ % %% celui de la somme des données
+ \foreachitem\don\in\ListeComplete{\xdef\SommeDonnees{\fpeval{\SommeDonnees+\ListeComplete[\doncnt,2]}}}%
+ % %% celui de l'effectif total
+ \xdef\EffectifTotal{\SommeDonnees}%
+ \ifboolKV[ClesStat]{EffectifTotal}{%
+ L'effectif total est \num{\ListeCompletelen}.\par
+ }{}
+ % %% celui de la moyenne
+ \xdef\Moyenne{\fpeval{\SommeDonnees/\ListeCompletelen}}%
+ \ifboolKV[ClesStat]{Moyenne}{%
+ La somme des données est :%
+ \xintifboolexpr{\ListeCompletelen<\useKV[ClesStat]{Coupure}}{%
+ \[
+ \num{\ListeComplete[1,2]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}\xintFor* ##1 in {\xintSeq {2}{\ListeCompletelen}}\do{%
+ +\num{\ListeComplete[##1,2]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}
+ }=\num{\SommeDonnees}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}%
+ \]}{%
+ \[
+ \num{\ListeComplete[1,2]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}\xintFor* ##1 in {\xintSeq {2}{3}}\do{%
+ +\num{\ListeComplete[##1,2]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}}+\dots\xintFor* ##1 in {\xintSeq {\ListeCompletelen-1}{\ListeCompletelen}}\do{%
+ +\num{\ListeComplete[##1,2]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}
+ }=\num{\SommeDonnees}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}%
+ \]%
+ }%
+ \ifboolKV[ClesStat]{SET}{}{L'effectif total est \num{\ListeCompletelen}.\\}%
+ Donc la moyenne 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}%
+ \opcmp{resultatmoy}{resultatmoy1}\ifopeq=\else\approx\fi%
+ \num{\fpeval{round(\fpeval{\SommeDonnees/\ListeCompletelen},\useKV[ClesStat]{Precision})}}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}.}{.}%
+ \]%
+ }{}%
+ % % %% celui de l'étendue
+ \xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{%
+ \xintifboolexpr{\ListeComplete[##1,2]>\DonneeMax}{%
+ \xdef\DonneeMax{\ListeComplete[##1,2]}%
+ }{}%
+ \xintifboolexpr{\ListeComplete[##1,2]<\DonneeMin}{%
+ \xdef\DonneeMin{\ListeComplete[##1,2]}%
+ }{}%
+ }%
+ \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]{Mediane}{%
+ %%%%%%%%%%%%%%%%%%%%%%%%
+
+ On range les données par ordre croissant :%
+ \nbdonnees=0%
+ \xintifboolexpr{\ListeCompletelen<\useKV[ClesStat]{Coupure}}{%
+ \[\DTLforeach{mtdb}{\numeroDonnee=Numeric}{\num{\numeroDonnee}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}\DTLiflastrow{.}{;}}\]%
+ }{%
+ \medskip%
+ \begin{center}
+ \begin{minipage}{0.9\linewidth}
+ \DTLforeach*{mtdb}{\numeroDonnee=Numeric}{\num{\numeroDonnee}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}\DTLiflastrow{.}{;
+ }\nbdonnees=\fpeval{\nbdonnees+1}\modulo{\nbdonnees}{\useKV[ClesStat]{Coupure}}\xintifboolexpr{\remainder=0}{\\}{}}
+ \end{minipage}
+ \end{center}%
+ \medskip%
+ }%
+ \newcount\med%
+ \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}}$.\\
+ \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}$.\\
+ \fi%
+ \newcount\k%
+ \k=0%
+ \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}.}{.}%
+ \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}.}{.}
+ \fi
+ }
+ %%%%%%%%%%%%%%%%%%%%%%%%
+ }{}
+ % construction du tableau
+ \ifboolKV[ClesStat]{Tableau}{\ifboolKV[ClesStat]{Total}{\buildtabqt}{\buildtabq}}{}
+ % Construction du graphique ??
+ \ifboolKV[ClesStat]{Graphique}{%
+ \ifboolKV[ClesStat]{Angle}{\buildgraphcq{360}}{\ifboolKV[ClesStat]{SemiAngle}{\buildgraphcq{180}}{}}
+ \ifboolKV[ClesStat]{Batons}{\buildgraphq}{}
+ }{}
+ }{%%%%%%%%%%%%%%%%%%%%%Début quantitatif
+ % % on effectue les calculs
+ % %% celui de la somme des données
+ \foreachitem\don\in\ListeComplete{\xdef\SommeDonnees{\fpeval{\SommeDonnees+\ListeComplete[\doncnt,1]*\ListeComplete[\doncnt,2]}}}%
+ % %% celui de l'effectif total
+ \foreachitem\don\in\ListeComplete{\xdef\EffectifTotal{\fpeval{\EffectifTotal+\ListeComplete[\doncnt,2]}}}%
+ % %% celui de l'étendue
+ \xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{%
+ \xintifboolexpr{\ListeComplete[##1,1]>\DonneeMax}{%
+ \xdef\DonneeMax{\ListeComplete[##1,1]}%
+ }{}%
+ \xintifboolexpr{\ListeComplete[##1,1]<\DonneeMin}{%
+ \xdef\DonneeMin{\ListeComplete[##1,1]}%
+ }{}%
+ }%
+% \xdef\EffectifMax{\DonneeMax}%
+ \xdef\Etendue{\fpeval{\DonneeMax-\DonneeMin}}%%
+ % %% celui de la moyenne
+ \xdef\Moyenne{\fpeval{\SommeDonnees/\EffectifTotal}}%
+ \ifboolKV[ClesStat]{EffectifTotal}{%
+ L'effectif total 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 :%
+ \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{%
+ +\ifnum\ListeComplete[##1,2]=1\else\num{\ListeComplete[##1,2]}\times\fi\num{\ListeComplete[##1,1]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}
+ }=\num{\SommeDonnees}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}
+ \]
+ }{%
+ \[
+ \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}{2}}\do{%
+ +\ifnum\ListeComplete[##1,2]=1\else\num{\ListeComplete[##1,2]}\times\fi\num{\ListeComplete[##1,1]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}
+ }+\dots\xintFor* ##1 in {\xintSeq {\ListeCompletelen-1}{\ListeCompletelen}}\do{%
+ +\ifnum\ListeComplete[##1,2]=1\else\num{\ListeComplete[##1,2]}\times\fi\num{\ListeComplete[##1,1]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}
+ }=\num{\SommeDonnees}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}
+ \]
+ }
+ \ifboolKV[ClesStat]{SET}{}{L'effectif total est :%
+ \ifboolKV[ClesStat]{Liste}{ \num{\EffectifTotal}\\}{%
+ \[\num{\ListeComplete[1,2]}\xintFor* ##1 in {\xintSeq {2}{\ListeCompletelen}}\do{%
+ +\num{\ListeComplete[##1,2]}
+ }=\num{\EffectifTotal}
+ \]%
+ }%
+ }
+ Donc la moyenne 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}%
+ % Moy=\opprint{resultatmoy}--Moy1=\opprint{resultatmoy1}
+ \opcmp{resultatmoy}{resultatmoy1}\ifopeq=\else\approx\fi%
+ \num{\fpeval{round(\SommeDonnees/\EffectifTotal,\useKV[ClesStat]{Precision})}}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}.}{.}
+ \]%
+ }{}%
+ % % 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}.}{.}}{}%
+ % %% pour la médiane
+ \ifboolKV[ClesStat]{Mediane}{%
+
+ \newcount\med%
+ \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}}$. %
+ \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}}$. %
+ \fi%
+ \newcount\k%
+ \k=0%
+ \xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{%
+ \xintFor* ##2 in {\xintSeq {1}{\ListeComplete[##1,2]}}\do{%
+ \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}.}{.}%
+ \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}.}{.}%
+ \fi%
+ }%
+ }%
+ }{}%
+ % Construction de tableau
+ \ifboolKV[ClesStat]{Tableau}{\ifboolKV[ClesStat]{Total}{\buildtabt}{\buildtab}}{}%
+ % Construction du graphique ??
+ \ifboolKV[ClesStat]{Graphique}{\buildgraph}{}%
+ }%
+}%
+
+%%%%%%%%%%%%%
+%%% Radar
+%%%%%%%%%%%%%
+\setKVdefault[ClesRadar]{Rayon=3cm,Reference=20,MoyenneClasse=false,Disciplines=false,Pas=5}
+
+\newtoks\toklisteradara%pour la moyenne de l'élève
+\newtoks\toklisteradarb%pour la discipline
+\newtoks\toklisteradarc%pour la moyenne de classe
+
+\def\UpdateRadara#1/#2/#3\nil{\addtotok\toklisteradara{#1,}}
+\def\UpdateRadarb#1/#2/#3\nil{\addtotok\toklisteradarb{"#2",}}
+\def\UpdateRadarc#1/#2/#3\nil{\addtotok\toklisteradarc{#3,}}
+
+\newcommand\MPRadar[6]{%
+ \ifluatex
+ \mplibforcehmode
+ \begin{mplibcode}
+ pair O;
+ O=(0,0);
+ path cc;
+ cc=cercles(O,#1);
+ %%etiquettage des disciplines
+ n:=0;%compter le nombre de disciplines
+ for p_=#2:
+ n:=n+1;
+ endfor;
+ for k=1 upto n:
+ N[k]=k*(360/n);
+ trace segment(O,pointarc(cc,N[k]));% dashed evenly;
+ endfor;
+ 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])]);
+ fi;
+ endfor;
+ % tracé des pas:
+ pas=#4/#3;
+ for k=1 upto pas-1:
+ trace (k/pas)[O,pointarc(cc,N[1])] for l=2 upto n: --(k/pas)[O,pointarc(cc,N[l])] endfor
+ --cycle dashed evenly withcolor 0.5white;
+ endfor;
+ 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 #3 etex,(1/pas)[O,pointarc(cc,0)]);
+ % tracé des résultats élèves
+ pair El[];
+ el=0;
+ for p_=#5:
+ el:=el+1;
+ El[el]=(p_/#4)[O,pointarc(cc,N[el])];
+ endfor;
+ trace El[1] for p=2 upto n:--El[p] endfor --cycle withpen
+ pencircle scaled 1.5 withcolor blue;
+ % tracé des résultats classe
+ pair Cl[];
+ cl=0;
+ for p_=#6:
+ cl:=cl+1;
+ Cl[cl]=(p_/#4)[O,pointarc(cc,N[cl])];
+ endfor;
+ trace Cl[1] for p=2 upto n:--Cl[p] endfor --cycle withcolor rouge;
+ \end{mplibcode}
+ \else
+ \begin{mpost}
+ pair O;
+ O=(0,0);
+ path cc;
+ cc=cercles(O,#1);
+ %%etiquettage des disciplines
+ n:=0;%compter le nombre de disciplines
+ for p_=#2:
+ n:=n+1;
+ endfor;
+ for k=1 upto n:
+ N[k]=k*(360/n);
+ trace segment(O,pointarc(cc,N[k]));% dashed evenly;
+ endfor;
+ 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])]);
+ fi;
+ endfor;
+ % tracé des pas:
+ pas=#4/#3;
+ for k=1 upto pas-1:
+ trace (k/pas)[O,pointarc(cc,N[1])] for l=2 upto n: --(k/pas)[O,pointarc(cc,N[l])] endfor
+ --cycle dashed evenly withcolor 0.5white;
+ endfor;
+ trace pointarc(cc,N[1]) for l=2 upto n: --pointarc(cc,N[l]) endfor
+ --cycle;
+ % etiquettage des pas
+ dotlabel.top(LATEX("\noexpand\tiny"&decimal(#4)&"") rotated -90,pointarc(cc,0));
+ dotlabel.urt(LATEX("\noexpand\tiny"&decimal(#3)&""),(1/pas)[O,pointarc(cc,0)]);
+ % tracé des résultats élèves
+ pair El[];
+ el=0;
+ for p_=#5:
+ el:=el+1;
+ El[el]=(p_/#4)[O,pointarc(cc,N[el])];
+ endfor;
+ trace El[1] for p=2 upto n:--El[p] endfor --cycle withpen
+ pencircle scaled 1.5 withcolor blue;
+ % tracé des résultats classe
+ pair Cl[];
+ cl=0;
+ for p_=#6:
+ cl:=cl+1;
+ Cl[cl]=(p_/#4)[O,pointarc(cc,N[cl])];
+ endfor;
+ trace Cl[1] for p=2 upto n:--Cl[p] endfor --cycle withcolor rouge;
+ \end{mpost}
+ \fi
+}
+
+\newcommand\Radar[2][]{%
+ % 1 les paramètres
+ % 2 la répartition des notes
+ \useKVdefault[ClesRadar]%
+ \setKV[ClesRadar]{#1}%
+ \ignoreemptyitems%
+ \readlist*\ListeRadar{#2}%
+ \toklisteradara{}%
+ \foreachitem\compteur\in\ListeRadar{\expandafter\UpdateRadara\compteur\nil}%
+ \ifboolKV[ClesRadar]{Disciplines}{}{%
+ \toklisteradarb{}%
+ \foreachitem\compteur\in\ListeRadar{\expandafter\UpdateRadarb\compteur\nil}%
+ }
+ \ifboolKV[ClesRadar]{MoyenneClasse}{}{%
+ \toklisteradarc{}%
+ \foreachitem\compteur\in\ListeRadar{\expandafter\UpdateRadarc\compteur\nil}%
+ }
+ \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}
+
+\newcommand\Jauge[2][]{%
+ \setlength{\barrewidth}{\linewidth-2\fboxsep}%
+ \useKVdefault[ClesBarre]%
+ \setKV[ClesBarre]{#1}%
+ \xdef\NomComp{\useKV[ClesBarre]{Nom}}%
+ \xdef\TexteOrigine{\useKV[ClesBarre]{Origine}}
+ \xdef\TexteReference{\useKV[ClesBarre]{Reference}}
+ \xdef\CouleurFond{\useKV[ClesBarre]{CouleurFond}}%
+ \xdef\CouleurGrad{\useKV[ClesBarre]{CouleurGraduation}}%
+ \xdef\CouleurBarre{\useKV[ClesBarre]{CouleurBarre}}%
+ \xdef\CouleurI{\useKV[ClesBarre]{CouleurI}}%
+ \xdef\CouleurF{\useKV[ClesBarre]{CouleurF}}%
+ \xdef\CouleurS{\useKV[ClesBarre]{CouleurS}}%
+ \xdef\CouleurM{\useKV[ClesBarre]{CouleurM}}%
+ \ifboolKV[ClesBarre]{Niveau}{%
+ \begin{tikzpicture}[rounded corners=2pt,very thin]
+ \fill [gray!50] (0,0) rectangle (\barrewidth, 0.15);
+ \xintifboolexpr{#2<\useKV[ClesBarre]{LimiteI}}{%
+ \fill [\CouleurI] (0,0) rectangle (#2/100*\barrewidth, 0.15);
+ }{\xintifboolexpr{#2<\useKV[ClesBarre]{LimiteF}}{%
+ \fill [\CouleurF] (0,0) rectangle (#2/100*\barrewidth, 0.15);
+ }{\xintifboolexpr{#2<\useKV[ClesBarre]{LimiteS}}{%
+ \fill [\CouleurS] (0,0) rectangle (#2/100*\barrewidth, 0.15);
+ }{\fill [\CouleurM] (0,0) rectangle (#2/100*\barrewidth, 0.15);}
+ }
+ }
+ \node[anchor=south west] at (0,0.5em) {\NomComp};%
+ \node[anchor=north] at (0,-0.25em) {\TexteOrigine};
+ \node[anchor=north] at (\barrewidth,-0.25em) {\TexteReference};
+ \ifboolKV[ClesBarre]{Graduation}{%
+ \foreach \s in {1,...,\fpeval{\useKV[ClesBarre]{Pas}-1}}%
+ {
+ \draw[\CouleurGrad] (\s/\useKV[ClesBarre]{Pas}*\barrewidth,0)--(\s/\useKV[ClesBarre]{Pas}*\barrewidth,0.15);
+ }
+ }{}
+ \foreach \s in {\useKV[ClesBarre]{LimiteI},\useKV[ClesBarre]{LimiteF},\useKV[ClesBarre]{LimiteS}}%
+ {
+ \draw[black] (\s/100*\barrewidth,-0.1)--(\s/100*\barrewidth,0.2);%
+ }
+ \end{tikzpicture}%
+ }{%
+ \begin{tikzpicture}[rounded corners=2pt,very thin]
+ \fill [\CouleurFond] (0,0) rectangle (\barrewidth, 0.15);%
+ \fill [\CouleurBarre] (0,0) rectangle (#2/100*\barrewidth, 0.15);%
+ \node[anchor=south west] at (0,0.5em) {\NomComp};%
+ \node[anchor=north] at (0,-0.25em) {\useKV[ClesBarre]{TexteOrigine}};%
+ \node[anchor=north] at (\barrewidth,-0.25em) {\useKV[ClesBarre]{TexteReference}};%
+ \ifboolKV[ClesBarre]{Graduation}{%
+ \foreach \s in {1,...,\fpeval{\useKV[ClesBarre]{Pas}-1}}%
+ {
+ \draw[\CouleurGrad] (\s/\useKV[ClesBarre]{Pas}*\barrewidth,0)--(\s/\useKV[ClesBarre]{Pas}*\barrewidth,0.15);
+ }}{}%
+ \end{tikzpicture}%
+ }
+}
+
+%%%%%%%%%%%%%%%
+%%% 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}
+
+
+\newcommand\rightcomment[4]%
+ {\begin{tikzpicture}[remember picture,overlay]
+ \draw[Cfleches,-stealth]
+ ($({pic cs:#3}|-{pic cs:#1})+(\useKV[ClesEquation]{Ecart},0)$)
+ .. controls +(0.2,-0.05) and +(0.2,0.1) ..
+ node[right,align=left]{#4}
+ ($({pic cs:#3}|-{pic cs:#2})+(\useKV[ClesEquation]{Ecart},0.1)$);
+ \end{tikzpicture}%
+ }
+
+
+ \newcommand\leftcomment[4]%
+ {\begin{tikzpicture}[remember picture,overlay]
+ \draw[Cfleches,-stealth]
+ ($({pic cs:#3}|-{pic cs:#1})-(\useKV[ClesEquation]{Ecart},0)$)
+ .. controls +(-0.2,-0.05) and +(-0.2,0.1) ..
+ node[left,align=right]{#4}
+ ($({pic cs:#3}|-{pic cs:#2})-(\useKV[ClesEquation]{Ecart},-0.1)$);
+ \end{tikzpicture}%
+ }
+
+ \newcommand\Rightcomment[4]%
+ {\begin{tikzpicture}[remember picture,overlay]
+ \draw[Cfleches,-stealth]
+ ($({pic cs:#3}|-{pic cs:#1})+(\useKV[ClesEquation]{Ecart},0)$)
+ .. controls +(0.2,-0.05) and +(0.2,0.1) ..
+ node[right,align=left]{#4}
+ ($({pic cs:#3}|-{pic cs:#2})+(\useKV[ClesEquation]{Ecart},0.1)$);
+ \end{tikzpicture}%
+ }
+ \newcommand\Leftcomment[4]%
+ {\begin{tikzpicture}[remember picture,overlay]
+ \draw[Cfleches,-stealth]
+ ($({pic cs:#3}|-{pic cs:#1})-(\useKV[ClesEquation]{Ecart},0)$)
+ .. controls +(-0.2,-0.05) and +(-0.2,0.1) ..
+ node[left,align=right]{#4}
+ ($({pic cs:#3}|-{pic cs:#2})-(\useKV[ClesEquation]{Ecart},-0.1)$);
+ \end{tikzpicture}%
+ }
+
+ % Pour "oublier" les tikzmarks. En cas de plusieurs utilisations de la macro \ResolEquation
+\newcounter{Nbequa}
+\setcounter{Nbequa}{0}
+
+%CT
+\newdimen\fdashwidth \fdashwidth = 0.8pt % épaisseur traits
+\newdimen\fdashlength \fdashlength = 0.5mm % longueur des pointillés et séparation entre pointillés
+\newdimen\fdashsep \fdashsep = 3pt % séparateur entre contenu et traits
+
+\def\fdash#1{%
+ \leavevmode\begingroup%
+ \setbox0\hbox{#1}%
+ \def\hdash{\vrule height\fdashwidth width\fdashlength\relax}%
+ \def\vdash{\hrule height\fdashlength width\fdashwidth\relax}%
+ \def\dashblank{\kern\fdashlength}%
+ \ifdim\fdashsep>0pt
+ \setbox0\hbox{\vrule width0pt height\dimexpr\ht0+\fdashsep depth\dimexpr\dp0+\fdashsep\kern\fdashsep\unhbox0 \kern\fdashsep}%
+ \fi
+ \edef\hdash{\hbox to\the\wd0{\noexpand\color{Csymbole}\hdash\kern.5\fdashlength\xleaders\hbox{\hdash\dashblank}\hfil\hdash}}%
+ \edef\vdash{\vbox to\the\dimexpr\ht0+\dp0+2\fdashwidth{\noexpand\color{Csymbole}\vdash\kern.5\fdashlength\xleaders\vbox{\vdash\dashblank}\vfil\vdash}}%
+ \hbox{%
+ \vdash
+ \vtop{\vbox{\offinterlineskip\hdash\hbox{\unhbox0 }\hdash}}%
+ \vdash}%
+ \endgroup
+}
+% fin CT
+\def\Fdash#1{\raisebox{-2\fdashsep+\fdashwidth}{\fdash{#1}}}
+
+%Une simplification de a/b est possible ou non ?
+\newboolean{Simplification}
+
+\newcommand{\SSimpliTest}[2]{%
+ % Test d'une simplification possible ou pas de #1/#2
+ \newcount\numerateur\newcount\denominateur\newcount\valabsnum\newcount\valabsdeno%
+ \numerateur=\number#1
+ \denominateur=\number#2
+ \ifnum\number#1<0
+ \valabsnum=\numexpr0-\number#1
+ \else
+ \valabsnum=\number#1
+ \fi
+ \ifnum\number#2<0
+ \valabsdeno=\numexpr0-\number#2
+ \else
+ \valabsdeno=\number#2
+ \fi
+ \ifnum\the\valabsnum=0
+ \setboolean{Simplification}{true}
+ \else
+ \PGCD{\the\valabsnum}{\the\valabsdeno}
+ \ifnum\pgcd>1
+ \setboolean{Simplification}{true}
+ \else
+ \ifnum\the\numerateur<0
+ \ifnum\the\denominateur<0
+ \setboolean{Simplification}{true}
+ \else
+ \ifnum\valabsdeno=1\relax
+ \setboolean{Simplification}{true}
+ \else
+ \setboolean{Simplification}{false}
+ \fi
+ \fi
+ \else
+ \ifnum\valabsdeno=1\relax
+ \setboolean{Simplification}{true}
+ \else
+ \setboolean{Simplification}{false}
+ \fi
+ \fi
+ \fi
+ \fi
+}
+
+\definecolor{Cfleches}{RGB}{100,100,100}%
+
+\input{PfC-EquationSoustraction1}%
+\input{PfC-EquationTerme1}%
+\input{PfC-EquationComposition1}%
+\input{PfC-EquationPose1}%
+\input{PfC-EquationSymbole1}%
+\input{PfC-EquationLaurent1}
+
+\newcommand{\ResolEquation}[5][]{%
+ \useKVdefault[ClesEquation]%
+ \setKV[ClesEquation]{#1}%
+ \colorlet{Cterme}{\useKV[ClesEquation]{CouleurTerme}}%
+ \colorlet{Ccompo}{\useKV[ClesEquation]{CouleurCompo}}%
+ \colorlet{Csymbole}{\useKV[ClesEquation]{CouleurSymbole}}%
+ \colorlet{Cdecomp}{\useKV[ClesEquation]{CouleurSous}}%
+ \ifboolKV[ClesEquation]{Carre}{%
+ \ResolEquationCarre[#1]{#2}%
+ }{%
+ \ifboolKV[ClesEquation]{Produit}{%
+ \ResolEquationProduit[#1]{#2}{#3}{#4}{#5}%
+ }{%
+ \ifboolKV[ClesEquation]{Verification}{%
+ \Verification[#1]{#2}{#3}{#4}{#5}%
+ }{%
+ \ifboolKV[ClesEquation]{Symbole}{%
+ \ResolEquationSymbole[#1]{#2}{#3}{#4}{#5}%
+ }{%
+ \ifboolKV[ClesEquation]{Laurent}{%
+ \ResolEquationLaurent[#1]{#2}{#3}{#4}{#5}%
+ }{%
+ \ifboolKV[ClesEquation]{Terme}{%
+ \ResolEquationTerme[#1]{#2}{#3}{#4}{#5}%
+ }{\ifboolKV[ClesEquation]{Composition}{%
+ \ResolEquationComposition[#1]{#2}{#3}{#4}{#5}%
+ }{\ifboolKV[ClesEquation]{Pose}{%
+ \ResolEquationL[#1]{#2}{#3}{#4}{#5}%
+ }{%
+ \ResolEquationSoustraction[#1]{#2}{#3}{#4}{#5}%
+ }%
+ }%
+ }%
+ }%
+ }%
+ }%
+ }%
+ }%
+}%
+
+\newcommand\ResolEquationCarre[2][]{%
+ \setKV[ClesEquation]{#1}%
+ \xintifboolexpr{#2<0}{%
+ Comme $\num{#2}$ est négatif, alors l'équation $\useKV[ClesEquation]{Lettre}^2=\num{#2}$ n'a aucune solution.%
+ }{\xintifboolexpr{#2=0}{%
+ L'équation $\useKV[ClesEquation]{Lettre}^2=0$ a une unique solution : $\useKV[ClesEquation]{Lettre}=0$.%
+ }{%
+ 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}{\\%
+ \useKV[ClesEquation]{Lettre}&=\num{\fpeval{sqrt(#2)}}&&\text{et}&\useKV[ClesEquation]{Lettre}&=-\num{\fpeval{sqrt(#2)}}}{}%
+ \end{align*}
+ }
+ }
+}
+
+\newcommand\ResolEquationProduit[5][]{%
+ \setKV[ClesEquation]{#1}%
+ \ifboolKV[ClesEquation]{Equivalence}{}{C'est un produit nul donc \ifboolKV[ClesEquation]{Facteurs}{l'un au
+ moins des facteurs est nul}{} :}%
+ \ifboolKV[ClesEquation]{Equivalence}{%
+ \[\Distri{#2}{#3}{#4}{#5}=0\]
+ \begin{align*}%
+ &\makebox[0pt]{$\Longleftrightarrow$}&\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}}}}&=0&\quad&\makebox[0pt]{ou}\quad&\xintifboolexpr{#5=0}{\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\\
+ &\makebox[0pt]{$\Longleftrightarrow$}&\xintifboolexpr{#3=0}{\xdef\Coeffa{1}\xdef\Coeffb{\fpeval{0-#3}}\xintifboolexpr{#2=1}{&}{\useKV[ClesEquation]{Lettre}&=0}}{\xdef\Coeffa{#2}\xdef\Coeffb{\fpeval{0-#3}}\xintifboolexpr{\Coeffa=1}{}{\num{\Coeffa}}\useKV[ClesEquation]{Lettre}&=\num{\Coeffb}}&&&\xintifboolexpr{#5=0}{\xdef\Coeffc{1}\xdef\Coeffd{\fpeval{0-#5}}\xintifboolexpr{#4=1}{&}{\useKV[ClesEquation]{Lettre}&=0}}{\xdef\Coeffc{#4}\xdef\Coeffd{\fpeval{0-#5}}\xintifboolexpr{\Coeffc=1}{}{\num{\Coeffc}}\useKV[ClesEquation]{Lettre}&=\num{\Coeffd}}%\\
+ \xintifboolexpr{\Coeffa=1 'and' \Coeffc=1}{}{\\%\ifnum\cmtd>1
+ &\makebox[0pt]{$\Longleftrightarrow$}&\xintifboolexpr{\Coeffa=1}{&}{\useKV[ClesEquation]{Lettre}&=\frac{\num{\Coeffb}}{\num{\Coeffa}}}\xintifboolexpr{\Coeffc=1}{}{&&&\useKV[ClesEquation]{Lettre}&=\frac{\num{\Coeffd}}{\num{\Coeffc}}}
+ % accolade%\\
+ %%%%
+ \ifboolKV[ClesEquation]{Entier}{%
+ \xdef\TSimp{}%
+ \SSimpliTest{\Coeffb}{\Coeffa}\ifthenelse{\boolean{Simplification}}{\xintifboolexpr{#3=0}{\xdef\TSimp{0}}{\xdef\TSimp{1}}}{\xdef\TSimp{0}}
+ \SSimpliTest{\Coeffd}{\Coeffc}\ifthenelse{\boolean{Simplification}}{\xintifboolexpr{#5=0}{}{\xdef\TSimp{\fpeval{\TSimp+1}}}}{}
+ \xintifboolexpr{\TSimp=0}{}{\\
+ \ifboolKV[ClesEquation]{Simplification}{%
+ &\makebox[0pt]{$\Longleftrightarrow$}&\SSimpliTest{\Coeffb}{\Coeffa}\xintifboolexpr{\Coeffa=1}{&}{\ifthenelse{\boolean{Simplification}}{\useKV[ClesEquation]{Lettre}&=\SSimplifie{\Coeffb}{\Coeffa}}{&}%\\
+ }
+ }{}
+ &&&\ifboolKV[ClesEquation]{Simplification}{%
+ \SSimpliTest{\Coeffd}{\Coeffc}%
+ \xintifboolexpr{\Coeffc=1}{}{\ifthenelse{\boolean{Simplification}}{\useKV[ClesEquation]{Lettre}&=\SSimplifie{\Coeffd}{\Coeffc}}{}%\\
+ }
+ }{}
+ }
+ }{}
+ }
+ \end{align*}
+ }{%
+ \begin{align*}
+ \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}}}}&=0&&\text{ou}&\xintifboolexpr{#5=0}{\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\\
+ \xintifboolexpr{#3=0}{\xdef\Coeffa{1}\xdef\Coeffb{\fpeval{0-#3}}\xintifboolexpr{#2=1}{&}{\useKV[ClesEquation]{Lettre}&=0}}{\xdef\Coeffa{#2}\xdef\Coeffb{\fpeval{0-#3}}\xintifboolexpr{\Coeffa=1}{}{\num{\Coeffa}}\useKV[ClesEquation]{Lettre}&=\num{\Coeffb}}&&&\xintifboolexpr{#5=0}{\xdef\Coeffc{1}\xdef\Coeffd{\fpeval{0-#5}}\xintifboolexpr{#4=1}{&}{\useKV[ClesEquation]{Lettre}&=0}}{\xdef\Coeffc{#4}\xdef\Coeffd{\fpeval{0-#5}}\xintifboolexpr{\Coeffc=1}{}{\num{\Coeffc}}\useKV[ClesEquation]{Lettre}&=\num{\Coeffd}}%\\
+ \xintifboolexpr{\Coeffa=1 'and' \Coeffc=1}{}{\\%\ifnum\cmtd>1
+ \xintifboolexpr{\Coeffa=1}{&}{\useKV[ClesEquation]{Lettre}&=\frac{\num{\Coeffb}}{\num{\Coeffa}}}\xintifboolexpr{\Coeffc=1}{}{&&&\useKV[ClesEquation]{Lettre}&=\frac{\num{\Coeffd}}{\num{\Coeffc}}}
+ %accolade%\\
+ %%%%
+ \ifboolKV[ClesEquation]{Entier}{%
+ \xdef\TSimp{}
+ \SSimpliTest{\Coeffb}{\Coeffa}\ifthenelse{\boolean{Simplification}}{\xintifboolexpr{#3=0}{\xdef\TSimp{0}}{\xdef\TSimp{1}}}{\xdef\TSimp{0}}
+ \SSimpliTest{\Coeffd}{\Coeffc}\ifthenelse{\boolean{Simplification}}{\xintifboolexpr{#5=0}{}{\xdef\TSimp{\fpeval{\TSimp+1}}}}{}
+ \xintifboolexpr{\TSimp=0}{}{\\
+ \ifboolKV[ClesEquation]{Simplification}{%
+ \SSimpliTest{\Coeffb}{\Coeffa}
+ \xintifboolexpr{\Coeffa=1}{&}{\ifthenelse{\boolean{Simplification}}{\useKV[ClesEquation]{Lettre}&=\SSimplifie{\Coeffb}{\Coeffa}}{&}%\\
+ }
+ }{}
+ &&&\ifboolKV[ClesEquation]{Simplification}{%
+ \SSimpliTest{\Coeffd}{\Coeffc}%
+ \xintifboolexpr{\Coeffc=1}{}{\ifthenelse{\boolean{Simplification}}{\useKV[ClesEquation]{Lettre}&=\SSimplifie{\Coeffd}{\Coeffc}}{}%\\
+ }
+ }{}
+ }
+ }{}
+ }
+ \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$.
+ }{}
+}
+
+\newcommand\Verification[5][]{%
+ \setKV[ClesEquation]{#1}
+ \xdef\ValeurTest{\useKV[ClesEquation]{Nombre}}
+ Testons la valeur $\useKV[ClesEquation]{Lettre}=\num{\ValeurTest}$ :
+ \begin{align*}
+ \xintifboolexpr{#2=0}{\num{#3}}{\num{#2}\times\xintifboolexpr{\ValeurTest<0}{(\num{\ValeurTest})}{\num{\ValeurTest}}\xintifboolexpr{#3=0}{}{\xintifboolexpr{#3>0}{+\num{#3}}{\num{#3}}}}&&\xintifboolexpr{#4=0}{\num{#5}}{\num{#4}\times\xintifboolexpr{\ValeurTest<0}{(\num{\ValeurTest})}{\num{\ValeurTest}}\xintifboolexpr{#5=0}{}{\xintifboolexpr{#5>0}{+\num{#5}}{\num{#5}}}}\\
+ \xintifboolexpr{#2=0}{}{\num{\fpeval{#2*\useKV[ClesEquation]{Nombre}}}\xintifboolexpr{#3=0}{}{\xintifboolexpr{#3>0}{+\num{#3}}{\num{#3}}}}&&\xintifboolexpr{#4=0}{}{\num{\fpeval{#4*\useKV[ClesEquation]{Nombre}}}\xintifboolexpr{#5=0}{}{\xintifboolexpr{#5>0}{+\num{#5}}{\num{#5}}}}\\
+ \xintifboolexpr{#2=0}{}{\num{\fpeval{#2*\useKV[ClesEquation]{Nombre}+#3}}}&&\xintifboolexpr{#4=0}{}{\num{\fpeval{#4*\useKV[ClesEquation]{Nombre}+#5}}}
+ \end{align*}
+ \xdef\Testa{\fpeval{#2*\useKV[ClesEquation]{Nombre}+#3}}\xdef\Testb{\fpeval{#4*\useKV[ClesEquation]{Nombre}+#5}}
+ \ifboolKV[ClesEquation]{Egalite}{%
+ Comme \xintifboolexpr{\Testa=\Testb}{$\num{\Testa}=\num{\Testb}$}{$\num{\Testa}\not=\num{\Testb}$}, alors l'égalité $\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}}}}}$ \xintifboolexpr{\Testa=\Testb}{ est vérifiée }{ n'est pas vérifiée } pour $\useKV[ClesEquation]{Lettre}=\num{\useKV[ClesEquation]{Nombre}}$.%
+ }{\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}%Tableau=false :
+ %inutile ?
+
+\def\Updatetoksmath#1/#2\nil{\addtotok\tabtoksa{&#1}\addtotok\tabtoksb{&#2}}%
+
+\def\buildtabpropor{%
+ \tabtoksa{}\tabtoksb{}%
+ \tabtoksa{\useKV[ClesPropor]{GrandeurA}}\tabtoksb{\useKV[ClesPropor]{GrandeurB}}%
+ \ifboolKV[ClesPropor]{Math}{%
+ \foreachitem\compteur\in\ListeValeur{\expandafter\Updatetoksmath\compteur\nil}%
+ }{\foreachitem\compteur\in\ListeValeur{\expandafter\updatetoks\compteur\nil}%
+ }%
+ \xdef\LongListe{\ListeValeurlen}%
+ \renewcommand{\arraystretch}{\useKV[ClesPropor]{Stretch}}%
+ \begin{tabular}{|>{\columncolor{gray!15}}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\\%
+ \hhline{*{\number\numexpr\ListeValeurlen+1}{-}}%
+ \the\tabtoksb\\%
+ \hhline{*{\number\numexpr\ListeValeurlen+1}{-}}%
+ \multicolumn{1}{c}{\TikzPBD\setcounter{NbPropor}{1}}\xintFor* ##1 in {\xintSeq {1}{\ListeValeurlen}}\do{&\multicolumn{1}{c}{\TikzPB}}\\%
+ \end{tabular}%
+}%
+
+\newcounter{NbPropor}
+
+\newcommand{\TikzPH}{%
+ \tikz[remember picture,overlay]{%
+ \coordinate[name=ProporH-\theNbPropor,yshift=-\the\dp\strutbox*\arraystretch];}%
+ \stepcounter{NbPropor}%
+ }%
+
+ \newcommand{\TikzPHD}{%
+ \setbox1=\hbox{\useKV[ClesPropor]{GrandeurA}}
+ \tikz[remember picture,overlay]{%
+ \coordinate[name=ProporHD,xshift=-0.5*\the\wd1,yshift=-\the\dp\strutbox*\arraystretch];}%
+ }%
+
+ \newcommand{\TikzPB}{%
+ \tikz[remember picture, overlay]{%
+ \coordinate[name=ProporB-\theNbPropor,yshift=\the\ht\strutbox*\arraystretch];}%
+ \stepcounter{NbPropor}%
+ }%
+
+ \newcommand{\TikzPBD}{%
+ \setbox1=\hbox{\useKV[ClesPropor]{GrandeurA}}
+ \tikz[remember picture, overlay]{%
+ \coordinate[name=ProporBD,xshift=-0.5*\the\wd1,yshift=\the\ht\strutbox*\arraystretch];}%
+ \stepcounter{NbPropor}%
+ }%
+
+ \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);%
+ \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);%
+ \end{tikzpicture}%
+ \fi%
+}%
+
+\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);%
+ \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);%
+ \end{tikzpicture}%
+ \fi%
+}
+
+\newcommand\Propor[2][]{%
+ \useKVdefault[ClesPropor]%
+ \setKV[ClesPropor]{#1}%
+ \xdef\colorfill{\useKV[ClesPropor]{ColorFill}}%
+ \xdef\EcartLargeur{\useKV[ClesPropor]{Largeur}}
+% %on lit la liste écrite sous la forme valeur/effectif
+ \setsepchar[*]{,*/}\ignoreemptyitems%
+ \readlist*\ListeValeur{#2}%
+ \buildtabpropor%
+}
+
+\newcommand\FlecheCoef[2][\EcartLargeur]{%
+ \begin{tikzpicture}[remember picture, overlay]%
+ \node[] (Point1) at ($(ProporH-\LongListe)!0.1!(ProporB-\LongListe)$) {};%
+ \node[] (Point2) at ($(ProporH-\LongListe)!0.9!(ProporB-\LongListe)$) {};%
+ \coordinate[right of=Point1,node distance=0.5*#1+\tabcolsep] (point1);%
+ \coordinate[right of=Point2,node distance=0.5*#1+\tabcolsep] (point2);%
+ \draw[-stealth,out=-20,in=20] (point1) to node[midway,right,inner sep=1pt]{#2}(point2);%
+\end{tikzpicture}%
+}%
+
+\newcommand\FlecheCoefDebut[2][1.25\tabcolsep]{%
+ \begin{tikzpicture}[remember picture, overlay]%
+ \node[] (Noeud1) at ($(ProporHD)!0.1!(ProporBD)$) {};%
+ \node[] (Noeud2) at ($(ProporHD)!0.9!(ProporBD)$) {};%
+ \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}%
+}%
+
+\newcommand\FlecheCoefInv[2][1cm]{%
+ \begin{tikzpicture}[remember picture, overlay]%
+ \node[] (Point1) at ($(ProporH-\LongListe)!0.1!(ProporB-\LongListe)$) {};%
+ \node[] (Point2) at ($(ProporH-\LongListe)!0.9!(ProporB-\LongListe)$) {};%
+ \coordinate[right of=Point1,node distance=0.5*#1+\tabcolsep] (point1);%
+ \coordinate[right of=Point2,node distance=0.5*#1+\tabcolsep] (point2);%
+ \draw[-stealth,out=20,in=-20] (point2) to node[midway,right,inner sep=1pt]{#2}(point1);%
+\end{tikzpicture}%
+}%
+
+\newcommand\FlecheLineaireH[4]{%
+ \begin{tikzpicture}[remember picture,overlay,node distance=\ht\strutbox]
+ \node[inner sep=0pt] (MilieuH) at ($(ProporH-#1)!0.5!(ProporH-#2)$) {};
+ \node[circle,draw,inner sep=0pt] [above of=MilieuH] (aux) {#4} ;
+ \coordinate[above of=aux] (aux1);
+ \draw[-stealth] (ProporH-#1) |- (aux);
+ \draw[-stealth] (ProporH-#2) |- (aux);
+ \draw[-stealth] (aux) -- (aux1) -| (ProporH-#3);
+\end{tikzpicture}
+}
+
+\newcommand\FlecheLineaireB[4]{%
+ \begin{tikzpicture}[remember picture,overlay,node distance=3mm]
+ \node[inner sep=0pt] (MilieuB) at ($(ProporB-#1)!0.5!(ProporB-#2)$) {};
+ \node[circle,draw,inner sep=0pt] [below of=MilieuB] (aux) {#4} ;
+ \coordinate[below of=aux,node distance=3mm] (aux1);
+ \draw[-stealth] (ProporB-#1) |- (aux);
+ \draw[-stealth] (ProporB-#2) |- (aux);
+ \draw[-stealth] (aux) -- (aux1) -| (ProporB-#3);
+\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}
+
+\newcommand\Pourcentage[3][]{%
+ \useKVdefault[ClesPourcentage]%
+ \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 :
+ \[\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}~\%.
+ \ifboolKV[ClesPourcentage]{AideTableau}{%
+ \xdef\NomA{\useKV[ClesPourcentage]{GrandeurA}}
+ \xdef\NomB{\useKV[ClesPourcentage]{GrandeurB}}
+ \begin{center}
+ \Propor[GrandeurA=\NomA,GrandeurB=\NomB]{/#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}}{}.%
+ }{Pour calculer \num{#2}~\% de \num{#3}\ifboolKV[ClesPourcentage]{Concret}{~\useKV[ClesPourcentage]{Unite}}{}, on effectue le calcul :
+ \[\ifboolKV[ClesPourcentage]{Fractionnaire}{\frac{\num{#2}}{100}}{\num{\fpeval{#2/100}}}\times\num{#3}\ifboolKV[ClesPourcentage]{Concret}{~\text{\useKV[ClesPourcentage]{Unite}}}{}=\ifboolKV[ClesPourcentage]{Fractionnaire}{\frac{\num{\fpeval{#2*#3}}}{100}}{\num{\fpeval{#2*#3/100}}}\ifboolKV[ClesPourcentage]{Concret}{~\text{\useKV[ClesPourcentage]{Unite}}}{}\ifboolKV[ClesPourcentage]{Fractionnaire}{=\num{\fpeval{#2*#3/100}}\ifboolKV[ClesPourcentage]{Concret}{~\text{\useKV[ClesPourcentage]{Unite}}}{}}{}\]%
+ On obtient une \useKV[ClesPourcentage]{MotReduction} de $\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}}{}.}
+ }
+ }{%
+ \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 :
+ \[\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}~\%. %
+ \ifboolKV[ClesPourcentage]{AideTableau}{%
+ \xdef\NomA{\useKV[ClesPourcentage]{GrandeurA}}%
+ \xdef\NomB{\useKV[ClesPourcentage]{GrandeurB}}%
+ \begin{center}%
+ \Propor[GrandeurA=\NomA,GrandeurB=\NomB]{/#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}}{}.%
+ }{Pour calculer \num{#2}~\% de \num{#3}\ifboolKV[ClesPourcentage]{Concret}{~\useKV[ClesPourcentage]{Unite}}{}, on effectue le calcul :
+ \[\ifboolKV[ClesPourcentage]{Fractionnaire}{\frac{\num{#2}}{100}}{\num{\fpeval{#2/100}}}\times\num{#3}\ifboolKV[ClesPourcentage]{Concret}{~\text{\useKV[ClesPourcentage]{Unite}}}{}=\ifboolKV[ClesPourcentage]{Fractionnaire}{\frac{\num{\fpeval{#2*#3}}}{100}}{\num{\fpeval{#2*#3/100}}}\ifboolKV[ClesPourcentage]{Concret}{~\text{\useKV[ClesPourcentage]{Unite}}}{}\ifboolKV[ClesPourcentage]{Fractionnaire}{=\num{\fpeval{#2*#3/100}}\ifboolKV[ClesPourcentage]{Concret}{~\text{\useKV[ClesPourcentage]{Unite}}}{}}{}\]%
+ On obtient une augmentation de $\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}}{}.}
+ }
+ }{%
+ \ifboolKV[ClesPourcentage]{Calculer}{%
+ \xdef\NomA{\useKV[ClesPourcentage]{GrandeurA}}
+ \xdef\NomB{\useKV[ClesPourcentage]{GrandeurB}}
+ \Propor[GrandeurA=\NomA,GrandeurB=\NomB]{#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}}$}%
+ \xdef\ResultatPourcentage{\fpeval{#2*100/#3}}%
+ }{%
+ Pour calculer \num{#2}~\% de \num{#3}\ifboolKV[ClesPourcentage]{Concret}{~\useKV[ClesPourcentage]{Unite}}{}, on effectue le calcul :%
+ \[\ifboolKV[ClesPourcentage]{Fractionnaire}{\frac{\num{#2}}{100}}{\num{\fpeval{#2/100}}}\times\num{#3}\ifboolKV[ClesPourcentage]{Concret}{~\text{\useKV[ClesPourcentage]{Unite}}}{}=\ifboolKV[ClesPourcentage]{Fractionnaire}{\frac{\num{\fpeval{#2*#3}}}{100}}{\num{\fpeval{#2*#3/100}}}\ifboolKV[ClesPourcentage]{Concret}{~\text{\useKV[ClesPourcentage]{Unite}}}{}\ifboolKV[ClesPourcentage]{Fractionnaire}{=\num{\fpeval{#2*#3/100}}\ifboolKV[ClesPourcentage]{Concret}{~\text{\useKV[ClesPourcentage]{Unite}}}{}}{}\]%
+ }%
+ }%
+ }%
+}%
+
+%%%%%%%%%%%%%
+%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,NombreUn}
+
+\newcommand\MPTest[9][]{%
+ % #2 : Longueur de la barre unité
+ % #3 : premier nombre
+ % #4 : deuxième nombre
+ % #5 : troisième nombre
+ % #6 : Valeurs du ratio
+ % #7 à #9: Couleurs de remplissage
+ \ifluatex
+ \mplibforcehmode
+ \begin{mplibcode}
+ 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);
+ B-A=(long,0);
+ C-B=u*(0,0.5);
+ D-C=A-B;
+ n:=0;%n pour savoir si le ratio est a:b ou a:b:c
+ numeric N[];%Pour sauvegarder les éléments du ratio
+ for p_=t:
+ n:=n+1;
+ N[n]=p_;
+ endfor;
+ % on fait la somme totale "du ratio"
+ somme=0;
+ somme:=somme for k=1 upto n:+N[k] endfor;
+ Figure(0,0,long+2u,3u);
+ remplis polygone(A,(N[1]/somme)[A,B],(N[1]/somme)[D,C],D)
+ withcolor #7;
+ remplis polygone(B,(N[1]/somme)[A,B],(N[1]/somme)[D,C],C)
+ withcolor #8;
+ if n>2:
+ remplis
+ polygone((N[1]/somme)[A,B],((N[1]+N[2])/somme)[A,B],((N[1]+N[2])/somme)[D,C],(N[1]/somme)[D,C])
+ withcolor #8;
+ remplis
+ polygone(B,((N[1]+N[2])/somme)[A,B],((N[1]+N[2])/somme)[D,C],C)
+ withcolor #9;
+ fi;
+ drawoptions(withpen pencircle scaled1.5bp);
+ draw polygone(A,B,C,D);
+ for k=1 upto somme-1:
+ draw segment((k/somme)[A,B],(k/somme)[D,C]);
+ endfor;
+ drawoptions();
+ % accolades
+ labeloffset:=labeloffset/2;
+ label.top(TEX("\footnotesize$\overbrace{\hbox
+ to"&decimal(abs(A-B))&"pt{}}$"),iso(D,C));
+ labeloffset:=labeloffset*2;
+ label.bot(TEX("\footnotesize$\underbrace{\hbox
+ to"&decimal(abs((N[1]/somme)[A,B]-A))&"pt{}}$"),iso(A,(N[1]/somme)[A,B]));
+ label.bot(TEX("\footnotesize$\underbrace{\hbox
+ to"&decimal(abs((N[1]/somme)[A,B]-((N[1]+N[2])/somme)[A,B]))&"pt{}}$"),iso(((N[1]+N[2])/somme)[A,B],(N[1]/somme)[A,B]));
+ if n>2:
+ label.bot(TEX("\footnotesize$\underbrace{\hbox
+ to"&decimal(abs(((N[1]+N[2])/somme)[A,B]-B))&"pt{}}$"),iso(B,((N[1]+N[2])/somme)[A,B]));
+ fi;
+ enddef;
+ RatioTrois(#2)(#6);
+ %etiquettage
+ labeloffset:=labeloffset*3;
+ label.top(btex \useKV[ClesRatio]{TexteTotal} etex,iso(D,C));
+ if #3>1:
+ label.bot(btex #3~\useKV[ClesRatio]{TextePart}s
+ etex,iso(A,(N[1]/somme)[A,B]));
+ else:
+ label.bot(btex #3~\useKV[ClesRatio]{TextePart} etex,iso(A,(N[1]/somme)[A,B]));
+ fi;
+ if #4>1:
+ label.bot(btex #4~\useKV[ClesRatio]{TextePart}s etex,iso(((N[1]+N[2])/somme)[A,B],(N[1]/somme)[A,B]));
+ else:
+ label.bot(btex #4~\useKV[ClesRatio]{TextePart}
+ etex,iso(((N[1]+N[2])/somme)[A,B],(N[1]/somme)[A,B]));
+ fi;
+ if n>2:
+ if #5>1:
+ label.bot(btex #5~\useKV[ClesRatio]{TextePart}s etex,iso(B,((N[1]+N[2])/somme)[A,B]));
+ else:
+ label.bot(btex #5~\useKV[ClesRatio]{TextePart} etex,iso(B,((N[1]+N[2])/somme)[A,B]));
+ fi;
+ fi;
+ \end{mplibcode}
+ \else
+ \usempxpackage{simplekv}
+ \mpxcommands{%
+ \setKVdefault[ClesRatio]{TexteTotal=quantité,TextePart=part}
+ \setKV[ClesRatio]{#1}
+ }
+ \begin{mpost}[mpsettings={input PfC-Geometrie;}]
+ 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);
+ B-A=(long,0);
+ C-B=u*(0,0.5);
+ D-C=A-B;
+ n:=0;%n pour savoir si le ratio est a:b ou a:b:c
+ numeric N[];%Pour sauvegarder les éléments du ratio
+ for p_=t:
+ n:=n+1;
+ N[n]=p_;
+ endfor;
+ % on fait la somme totale "du ratio"
+ somme=0;
+ somme:=somme for k=1 upto n:+N[k] endfor;
+ Figure(0,0,long+2u,3u);
+ remplis polygone(A,(N[1]/somme)[A,B],(N[1]/somme)[D,C],D)
+ withcolor #7;
+ remplis polygone(B,(N[1]/somme)[A,B],(N[1]/somme)[D,C],C)
+ withcolor #8;
+ if n>2:
+ remplis
+ polygone((N[1]/somme)[A,B],((N[1]+N[2])/somme)[A,B],((N[1]+N[2])/somme)[D,C],(N[1]/somme)[D,C])
+ withcolor #8;
+ remplis
+ polygone(B,((N[1]+N[2])/somme)[A,B],((N[1]+N[2])/somme)[D,C],C)
+ withcolor #9;
+ fi;
+ drawoptions(withpen pencircle scaled1.5bp);
+ draw polygone(A,B,C,D);
+ for k=1 upto somme-1:
+ draw segment((k/somme)[A,B],(k/somme)[D,C]);
+ endfor;
+ drawoptions();
+ %accolades
+ label.top(LATEX("\noexpand\footnotesize$\noexpand\overbrace{\noexpand\hbox
+ to"&decimal(abs(A-B))&"pt{}}$"),iso(D,C));
+ label.bot(LATEX("\noexpand\footnotesize$\noexpand\underbrace{\noexpand\hbox
+ to"&decimal(abs((N[1]/somme)[A,B]-A))&"pt{}}$"),iso(A,(N[1]/somme)[A,B]));
+ label.bot(LATEX("\noexpand\footnotesize$\noexpand\underbrace{\noexpand\hbox
+ to"&decimal(abs((N[1]/somme)[A,B]-((N[1]+N[2])/somme)[A,B]))&"pt{}}$"),iso(((N[1]+N[2])/somme)[A,B],(N[1]/somme)[A,B]));
+ if n>2:
+ label.bot(LATEX("\noexpand\footnotesize$\noexpand\underbrace{\noexpand\hbox
+ to"&decimal(abs(((N[1]+N[2])/somme)[A,B]-B))&"pt{}}$"),iso(B,((N[1]+N[2])/somme)[A,B]));
+ fi;
+ enddef;
+ RatioTrois(#2)(#6);
+ %etiquettage
+ labeloffset:=labeloffset*3;
+ label.top(\btex \useKV[ClesRatio]{TexteTotal} etex,iso(D,C));
+ if #3>1:
+ label.bot(btex #3\unexpanded{~\useKV[ClesRatio]{TextePart}}s
+ etex,iso(A,(N[1]/somme)[A,B]));
+ else:
+ label.bot(btex #3\unexpanded{~\useKV[ClesRatio]{TextePart}} etex,iso(A,(N[1]/somme)[A,B]));
+ fi;
+ if #4>1:
+ label.bot(btex #4\unexpanded{~\useKV[ClesRatio]{TextePart}}s etex,iso(((N[1]+N[2])/somme)[A,B],(N[1]/somme)[A,B]));
+ else:
+ label.bot(btex #4\unexpanded{~\useKV[ClesRatio]{TextePart}}
+ etex,iso(((N[1]+N[2])/somme)[A,B],(N[1]/somme)[A,B]));
+ fi;
+ if n>2:
+ if #5>1:
+ label.bot(btex #5\unexpanded{~\useKV[ClesRatio]{TextePart}}s etex,iso(B,((N[1]+N[2])/somme)[A,B]));
+ else:
+ label.bot(btex #5\unexpanded{~\useKV[ClesRatio]{TextePart}} etex,iso(B,((N[1]+N[2])/somme)[A,B]));
+ fi;
+ fi;
+ \end{mpost}
+ \fi
+}
+
+\newtoks\toklisteratio
+\def\UpdateRatio#1\nil{\addtotok\toklisteratio{#1,}}
+
+\def\updateratiotoks#1/#2/#3\nil{\addtotok\tabtoksa{&\num{#2}}\addtotok\tabtoksb{&\num{#3}}\addtotok\tabtoksc{&#1}}
+
+
+\def\buildtabratio{%
+ \tabtoksa{}\tabtoksb{}\tabtoksc{}%
+ \tabtoksa{\useKV[ClesRatio]{GrandeurA}}\tabtoksb{\useKV[ClesRatio]{GrandeurB}}
+ \foreachitem\compteur\in\ListeRatio{\expandafter\updateratiotoks\compteur\nil}%
+ \xdef\LongListe{\ListeRatiolen}%
+ \renewcommand{\arraystretch}{\useKV[ClesRatio]{Stretch}}%
+ \begin{tabular}{|>{\columncolor{gray!15}}c|*{\number\numexpr\ListeRatiolen}{>{\centering\arraybackslash}p{\useKV[ClesRatio]{Largeur}}|}l}
+ \ifboolKV[ClesRatio]{Nom}{%
+ \hhline{~*{\number\numexpr\ListeRatiolen}{-}}
+ \multicolumn{1}{c|}{}\the\tabtoksc\\
+ }{}
+ \hhline{*{\number\numexpr\ListeRatiolen+1}{-}}%
+ \the\tabtoksa&\setcounter{NbPropor}{1}\TikzRH\\%
+ \hhline{*{\number\numexpr\ListeRatiolen+1}{-}}%
+ \the\tabtoksb&\setcounter{NbPropor}{1}\TikzRB\\%
+ \hhline{*{\number\numexpr\ListeRatiolen+1}{-}}%
+ \end{tabular}%
+}%
+
+\newcommand{\TikzRH}{%
+ \tikz[remember picture,overlay]{%
+ \coordinate[name=ProporH-\theNbPropor,yshift=\the\ht\strutbox*\arraystretch];}%
+ \stepcounter{NbPropor}%
+ }%
+
+ \newcommand{\TikzRB}{%
+ \tikz[remember picture, overlay]{%
+ \coordinate[name=ProporB-\theNbPropor,yshift=-\the\dp\strutbox*\arraystretch];}%
+ \stepcounter{NbPropor}%
+ }%
+
+\newcommand\FlecheRatio[2][\EcartLargeur]{%
+ \begin{tikzpicture}[remember picture, overlay]%
+ \node[] (Point1) at ($(ProporH-1)!0.1!(ProporB-1)$) {};%
+ \node[] (Point2) at ($(ProporH-1)!0.9!(ProporB-1)$) {};%
+ \coordinate[right of=Point1,node distance=0*#1-\tabcolsep] (point1);%
+ \coordinate[right of=Point2,node distance=0*#1-\tabcolsep] (point2);%
+ \draw[-stealth,out=-20,in=20] (point1) to node[midway,right,inner sep=1pt]{#2}(point2);%
+\end{tikzpicture}%
+}%
+
+\newcommand\FlecheInvRatio[2][\EcartLargeur]{%
+ \begin{tikzpicture}[remember picture, overlay]%
+ \node[] (Point1) at ($(ProporH-1)!0.1!(ProporB-1)$) {};%
+ \node[] (Point2) at ($(ProporH-1)!0.9!(ProporB-1)$) {};%
+ \coordinate[right of=Point1,node distance=0*#1-\tabcolsep] (point1);%
+ \coordinate[right of=Point2,node distance=0*#1-\tabcolsep] (point2);%
+ \draw[-stealth,out=20,in=-20] (point2) to node[midway,right,inner sep=1pt]{#2}(point1);%
+\end{tikzpicture}%
+}%
+
+\newcommand\Ratio[2][]{%
+ \useKVdefault[ClesRatio]%
+ \setKV[ClesRatio]{#1}%
+ \xdef\EcartLargeur{\useKV[ClesRatio]{Largeur}}%
+ \ifboolKV[ClesRatio]{Figure}{%
+ \ignoreemptyitems%
+ \readlist*\ListeRatio{#2}%
+ \toklisteratio{}%
+ \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{}}
+ \MPTest[#1]{\useKV[ClesRatio]{Longueur}}{\NbUn}{\NbDeux}{\NbTrois}{\the\toklisteratio}{\useKV[ClesRatio]{CouleurUn}}{\useKV[ClesRatio]{CouleurDeux}}{\useKV[ClesRatio]{CouleurTrois}}%
+ }{}%
+ \ifboolKV[ClesRatio]{Tableau}{%
+ \setsepchar[*]{,*/}\ignoreemptyitems%
+ \readlist*\ListeRatio{#2}%
+ \buildtabratio%
+ }{}%
+}%
+
+%%%%%%%%%%%%%%%
+%% 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}}%
+
+\newlength{\RoundedBoxWidth}%
+
+\NewEnviron{Bulle}[1][]{%
+ \setKV[ClesMentales]{#1}%
+ \setlength{\RoundedBoxWidth}{\useKV[ClesMentales]{Largeur}}%
+ \xdef\Pointilles{\ifboolKV[ClesMentales]{Pointilles}{dashed}{}}%
+ \xdef\CouleurTrace{\useKV[ClesMentales]{CTrace}}%
+ \xdef\CouleurFond{\useKV[ClesMentales]{CFond}}%
+ \xdef\EpaisseurLigne{\useKV[ClesMentales]{Epaisseur}}%
+ \xdef\RayonCoin{\useKV[ClesMentales]{Rayon}}%
+ \node(\useKV[ClesMentales]{Nom}) [align=justify,draw=\CouleurTrace,line width=\EpaisseurLigne,\Pointilles,fill=\CouleurFond,rounded corners=\RayonCoin,text width=\RoundedBoxWidth] at (\useKV[ClesMentales]{Ancre}) {\begin{minipage}{\RoundedBoxWidth}\BODY\end{minipage}};%
+ \multido{\i=1+1}{9}{%
+ \xdef\x{\fpeval{\i/10}}
+ \coordinate (\useKV[ClesMentales]{Nom}-H-\i) at ($(\useKV[ClesMentales]{Nom}.north west)!\x!(\useKV[ClesMentales]{Nom}.north east)$);
+ \coordinate (\useKV[ClesMentales]{Nom}-D-\i) at ($(\useKV[ClesMentales]{Nom}.north east)!\x!(\useKV[ClesMentales]{Nom}.south east)$);
+ \coordinate (\useKV[ClesMentales]{Nom}-B-\i) at ($(\useKV[ClesMentales]{Nom}.south east)!\x!(\useKV[ClesMentales]{Nom}.south west)$);
+ \coordinate (\useKV[ClesMentales]{Nom}-G-\i) at ($(\useKV[ClesMentales]{Nom}.south west)!\x!(\useKV[ClesMentales]{Nom}.north west)$);
+ }
+}
+
+%%%%%%%%%%%%
+% Pptés des droites (6eme)
+%%%%%%%%%%%
+\setKVdefault[ClesDroites]{Brouillon=false,CitePropriete=false,Num=1,Figure=false,Remediation=false}
+
+\newcommand\Redaction[4][]{%
+ \ifboolKV[ClesDroites]{Remediation}{%
+ \xintifboolexpr{\useKV[ClesDroites]{Num}=1}{%
+ \ifboolKV[ClesDroites]{CitePropriete}{%
+ Les droites $(\hbox to2em{\dotfill})$ et $(\hbox to2em{\dotfill})$ sont parallèles. Les droites $(\hbox to2em{\dotfill})$ et $(\hbox to2em{\dotfill})$ sont parallèles.%
+
+ Or, si deux droites sont parallèles, alors toute droite parallèle à l'une est parallèle à l'autre.%
+
+ Donc les droites $(\hbox to2em{\dotfill})$ et $(\hbox to2em{\dotfill})$ sont parallèles.%
+ }{%
+ Comme les droites $(\hbox to2em{\dotfill})$ et $(\hbox to2em{\dotfill})$ sont toutes les deux parallèles à la même droite $(\hbox to2em{\dotfill})$, alors les droites $(\hbox to2em{\dotfill})$ et $(\hbox to2em{\dotfill})$ sont parallèles.%
+ }
+ }{\xintifboolexpr{\useKV[ClesDroites]{Num}=2}{%
+ \ifboolKV[ClesDroites]{CitePropriete}{%
+ Les droites $(\hbox to2em{\dotfill})$ et $(\hbox to2em{\dotfill})$ sont perpendiculaires. Les droites $(\hbox to2em{\dotfill})$ et $(\hbox to2em{\dotfill})$ sont perpendiculaires.%
+
+ Or, si deux droites sont perpendiculaires à une même droite, alors elles sont parallèles.%
+
+ Donc les droites $(\hbox to2em{\dotfill})$ et $(\hbox to2em{\dotfill})$ sont perpendiculaires.
+ }{%
+ Comme les droites $(\hbox to2em{\dotfill})$ et $(\hbox to2em{\dotfill})$ sont toutes les deux perpendiculaires à la même droite $(\hbox to2em{\dotfill})$, alors les droites $(\hbox to2em{\dotfill})$ et $(\hbox to2em{\dotfill})$ sont parallèles.
+ }
+ }{%
+ \ifboolKV[ClesDroites]{CitePropriete}{%
+ Les droites $(\hbox to2em{\dotfill})$ et $(\hbox to2em{\dotfill})$ sont parallèles. Les droites $(\hbox to2em{\dotfill})$ et $(\hbox to2em{\dotfill})$ sont perpendiculaires.%
+
+ Or, si deux droites sont parallèles, alors toute droite droite perpendiculaire à l'une est perpendiculaire à l'autre.%
+
+ Donc les droites $(\hbox to2em{\dotfill})$ et $(\hbox to2em{\dotfill})$ sont perpendiculaires.
+ }{%
+ 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}{%
+ Les droites $(#2)$ et $(#4)$ sont parallèles. Les droites $(#3)$ et $(#4)$ sont parallèles.%
+
+ Or, si deux droites sont parallèles, alors toute droite parallèle à l'une est parallèle à l'autre.%
+
+ Donc les droites $(#2)$ et $(#3)$ sont parallèles.
+ }{%
+ Comme les droites $(#2)$ et $(#3)$ sont toutes les deux parallèles à la même droite $(#4)$, alors les droites $(#2)$ et $(#3)$ sont parallèles.
+ }
+ }{\xintifboolexpr{\useKV[ClesDroites]{Num}=2}{%
+ \ifboolKV[ClesDroites]{CitePropriete}{%
+ Les droites $(#2)$ et $(#4)$ sont perpendiculaires. Les droites $(#3)$ et $(#4)$ sont perpendiculaires.%
+
+ Or, si deux droites sont perpendiculaires à une même droite, alors elles sont parallèles.%
+
+ Donc les droites $(#2)$ et $(#3)$ sont perpendiculaires.
+ }{%
+ Comme les droites $(#2)$ et $(#3)$ sont toutes les deux perpendiculaires à la même droite $(#4)$, alors les droites $(#2)$ et $(#3)$ sont parallèles.
+ }
+ }{%
+ \ifboolKV[ClesDroites]{CitePropriete}{%
+ Les droites $(#2)$ et $(#4)$ sont parallèles. Les droites $(#3)$ et $(#4)$ sont perpendiculaires.%
+
+ Or, si deux droites sont parallèles, alors toute droite droite perpendiculaire à l'une est perpendiculaire à l'autre.%
+
+ 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}
+ \ifboolKV[ClesDroites]{Remediation}{%
+ \xintifboolexpr{\useKV[ClesDroites]{Num}=1}{%
+ \[\left.
+ \begin{array}{l}
+ (\hbox to2em{\dotfill})//(\hbox to2em{\dotfill})\\
+ \\
+ (\hbox to2em{\dotfill})//(\hbox to2em{\dotfill})
+ \end{array}
+ \right\}(\hbox to2em{\dotfill})//(\hbox to2em{\dotfill})
+ \]
+ }{\xintifboolexpr{\useKV[ClesDroites]{Num}=2}{%
+ \[\left.
+ \begin{array}{l}
+ (\hbox to2em{\dotfill})\perp(\hbox to2em{\dotfill})\\
+ \\
+ (\hbox to2em{\dotfill})\perp(\hbox to2em{\dotfill})\\
+ \end{array}
+ \right\}(\hbox to2em{\dotfill})//(\hbox to2em{\dotfill})
+ \]
+ }{%
+ \[\left.
+ \begin{array}{l}
+ (\hbox to2em{\dotfill})//(\hbox to2em{\dotfill})\\
+ \\
+ (\hbox to2em{\dotfill})\perp(\hbox to2em{\dotfill})\\
+ \end{array}
+ \right\}(\hbox to2em{\dotfill})\perp(\hbox to2em{\dotfill})
+ \]
+ }
+ }
+ }{
+ \xintifboolexpr{\useKV[ClesDroites]{Num}=1}{%
+ \[\left.
+ \begin{array}{l}
+ (#2)//(#4)\\
+ \\
+ (#3)//(#4)
+ \end{array}
+ \right\}(#2)//(#3)
+ \]
+ }{\xintifboolexpr{\useKV[ClesDroites]{Num}=2}{%
+ \[\left.
+ \begin{array}{l}
+ (#2)\perp(#4)\\
+ \\
+ (#3)\perp(#4)\\
+ \end{array}
+ \right\}(#2)//(#3)
+ \]
+ }{%
+ \[\left.
+ \begin{array}{l}
+ (#2)//(#4)\\
+ \\
+ (#3)\perp(#4)\\
+ \end{array}
+ \right\}(#2)\perp(#3)
+ \]
+ }
+ }
+ }
+}
+
+\def\MPFigureDroite#1#2{%
+ \ifluatex
+ \mplibcodeinherit{enable}
+ \mplibforcehmode
+ \begin{mplibcode}
+ pair A,B,C,D,E,F,G,H,I,J,K;
+ u:=7.5mm;
+ A=u*(1,3);
+ B-A=u*(3,2);
+ C-A=u*(2,-1);
+ E-C=u*(1,-1.5);
+ G-E=u*(1.5,0);
+ I-A=whatever*(B-A);
+ I-G=whatever*((B-A) rotated 90);
+ D-B=C-A;
+ F-D=E-C;
+ H=1.1[G,I];
+ J=(C--D) intersectionpoint (G--H);
+ K=(E--F) intersectionpoint (G--H);
+ path Codeperp[];
+ pair M[];
+ M1-I=7*unitvector(B-I);
+ M3-I=7*unitvector(J-I);
+ M2-M3=M1-I;
+ Codeperp1=M1--M2--M3;
+ Codeperp2=Codeperp1 shifted(J-I);
+ picture Codepara[];
+ pair R,S,T;
+ path cd;
+ Codepara1=image(
+ R=1/3[A,B];
+ T=1/3[E,F];
+ S=1/3[R,T];
+ cd=(fullcircle scaled 6mm) shifted S;
+ drawoptions(withcolor 0.75*white);
+ drawarrow reverse((R{dir(210+angle(R-T))}..{dir(150+angle(R-T))}S) cutafter cd);
+ drawarrow reverse((T{dir(210+angle(T-R))}..{dir(150+angle(T-R))}S) cutafter cd);
+ draw cd;
+ label(btex $//$ etex ,S);
+ drawoptions();
+ );
+ Codepara2=image(
+ R:=1/2[C,D];
+ T:=1/2[E,F];
+ S:=1/2[R,T];
+ cd:=(fullcircle scaled 6mm) shifted S;
+ drawoptions(withcolor 0.75*white);
+ drawarrow reverse((R{dir(210+angle(R-T))}..{dir(150+angle(R-T))}S) cutafter cd);
+ drawarrow reverse((T{dir(210+angle(T-R))}..{dir(150+angle(T-R))}S) cutafter cd);
+ draw cd;
+ label(btex $//$ etex ,S);
+ drawoptions();
+ );
+ path d[];
+ d1=A--B;
+ d2=C--D;
+ d3=E--F;
+ d4=G--H;
+ picture reste;
+ reste=image(
+ %tracés des droites
+ draw d1;
+ if #1=2:
+ draw d2;
+ elseif #1=3:
+ draw d3;
+ fi;
+ if #2=3:
+ draw d3;
+ elseif #2=4:
+ draw d4;
+ fi;
+ % tracés des codes
+ if (#1=2) and (#2=3):
+ draw Codepara1; draw Codepara2;
+ fi;
+ if (#1=2) and (#2=4):
+ draw Codeperp1; draw Codeperp2;
+ fi;
+ if (#1=3) and (#2=4):
+ draw Codepara1; draw Codeperp1;
+ fi;
+ );
+ reste:=reste rotatedabout(u*(3,3),-90+uniformdeviate(180));
+ draw reste;
+ \end{mplibcode}
+ \mplibcodeinherit{disable}
+ \else
+ \begin{mpost}
+ pair A,B,C,D,E,F,G,H,I,J,K;
+ u:=7.5mm;
+ A=u*(1,3);
+ B-A=u*(3,2);
+ C-A=u*(2,-1);
+ E-C=u*(1,-1.5);
+ G-E=u*(1.5,0);
+ I-A=whatever*(B-A);
+ I-G=whatever*((B-A) rotated 90);
+ D-B=C-A;
+ F-D=E-C;
+ H=1.1[G,I];
+ J=(C--D) intersectionpoint (G--H);
+ K=(E--F) intersectionpoint (G--H);
+ path Codeperp[];
+ pair M[];
+ M1-I=7*unitvector(B-I);
+ M3-I=7*unitvector(J-I);
+ M2-M3=M1-I;
+ Codeperp1=M1--M2--M3;
+ Codeperp2=Codeperp1 shifted(J-I);
+ picture Codepara[];
+ pair R,S,T;
+ path cd;
+ Codepara1=image(
+ R=1/3[A,B];
+ T=1/3[E,F];
+ S=1/3[R,T];
+ cd=(fullcircle scaled 6mm) shifted S;
+ drawoptions(withcolor 0.75*white);
+ drawarrow reverse((R{dir(210+angle(R-T))}..{dir(150+angle(R-T))}S) cutafter cd);
+ drawarrow reverse((T{dir(210+angle(T-R))}..{dir(150+angle(T-R))}S) cutafter cd);
+ draw cd;
+ label(btex $//$ etex ,S);
+ drawoptions();
+ );
+ Codepara2=image(
+ R:=1/2[C,D];
+ T:=1/2[E,F];
+ S:=1/2[R,T];
+ cd:=(fullcircle scaled 6mm) shifted S;
+ drawoptions(withcolor 0.75*white);
+ drawarrow reverse((R{dir(210+angle(R-T))}..{dir(150+angle(R-T))}S) cutafter cd);
+ drawarrow reverse((T{dir(210+angle(T-R))}..{dir(150+angle(T-R))}S) cutafter cd);
+ draw cd;
+ label(btex $//$ etex ,S);
+ drawoptions();
+ );
+ path d[];
+ d1=A--B;
+ d2=C--D;
+ d3=E--F;
+ d4=G--H;
+ picture reste;
+ reste=image(
+ %tracés des droites
+ draw d1;
+ if #1=2:
+ draw d2;
+ elseif #1=3:
+ draw d3;
+ fi;
+ if #2=3:
+ draw d3;
+ elseif #2=4:
+ draw d4;
+ fi;
+ % tracés des codes
+ if (#1=2) and (#2=3):
+ draw Codepara1; draw Codepara2;
+ fi;
+ if (#1=2) and (#2=4):
+ draw Codeperp1; draw Codeperp2;
+ fi;
+ if (#1=3) and (#2=4):
+ draw Codepara1; draw Codeperp1;
+ fi;
+ );
+ reste:=reste rotatedabout(u*(3,3),-90+uniformdeviate(180));
+ draw reste;
+ \end{mpost}
+ \fi
+}
+
+\newcommand\FaireFigure[4][]{%
+ \setlength{\abovedisplayskip}{0pt}
+ \xintifboolexpr{\useKV[ClesDroites]{Num}=1}{%
+ \MPFigureDroite{2}{3}%
+ }{\xintifboolexpr{\useKV[ClesDroites]{Num}=2}{%
+ \MPFigureDroite{2}{4}%
+ }{%
+ \MPFigureDroite{3}{4}%
+ }%
+ }%
+}%
+
+\newcommand\ProprieteDroites[4][]{%
+ \useKVdefault[ClesDroites]%
+ \setKV[ClesDroites]{#1}%
+ \ifboolKV[ClesDroites]{Figure}{%
+ \begin{multicols}{2}%
+ \begin{center}%
+ \FaireFigure[#1]{#2}{#3}{#4}%
+ \end{center}%
+ \columnbreak
+ \ifboolKV[ClesDroites]{Brouillon}{\Brouillon[#1]{#2}{#3}{#4}}{}%
+ \Redaction[#1]{#2}{#3}{#4}%
+ \par%
+ \end{multicols}
+ }{%
+ \ifboolKV[ClesDroites]{Brouillon}{\Brouillon[#1]{#2}{#3}{#4}}{}%
+ \Redaction[#1]{#2}{#3}{#4}%
+ }%
+}%
+
+%%%%%%%%%%%%%%%%%%%%
+%%% 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
+ % #2 a ou ordonnée premier point
+ % #3 b ou abscisse deuxième point
+ % #4 {} ou ordonnée deuxième point
+ \useKVdefault[ClesAffine]%A supprimer car appel récursif avec Redaction
+ \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}}}}%
+ }{%
+ \ifboolKV[ClesAffine]{ProgCalcul}{%
+ \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}}}}\\
+ \useKV[ClesAffine]{Nom}&:\num{#2}\stackrel{\times\xintifboolexpr{#3<0}{(\num{#3})}{\num{#3}}}{\longrightarrow}\num{\fpeval{#3*#2}}\xintifboolexpr{#4=0}{}{\xintifboolexpr{#4>0}{\stackrel{+\num{#4}}{\longrightarrow}}{\stackrel{\num{#4}}{\longrightarrow}}\num{\fpeval{#3*#2+#4}}}
+ \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}}}%\\
+ \xintifboolexpr{#4=0}{}{\\
+ \useKV[ClesAffine]{Nom}(\num{#2})&=\num{\fpeval{#3*#2+#4}}%\\
+ }
+ \end{align*}
+ }%
+ }%
+ }{\ifboolKV[ClesAffine]{Antecedent}{%
+ \ifboolKV[ClesAffine]{ProgCalcul}{%
+ La fonction affine $\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*}
+ Nous cherchons le nombre $\useKV[ClesAffine]{Variable}$ tel que son image par la fonction $\useKV[ClesAffine]{Nom}$ soit $\num{#2}$. Donc on obtient :
+ \begin{align*}
+ \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*}
+ 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}}
+ }
+ \end{align*}
+ }%
+ }{%
+ \ifboolKV[ClesAffine]{Retrouve}{%
+ On sait que $\useKV[ClesAffine]{Nom}$ est une fonction affine. Donc elle s'écrit sous la forme : \[\useKV[ClesAffine]{Nom}(\useKV[ClesAffine]{Variable})=a\useKV[ClesAffine]{Variable}+b\]
+ Or, $\useKV[ClesAffine]{Nom}(\num{#2})=\num{#3}$ et $\useKV[ClesAffine]{Nom}(\num{#4})=\num{#5}$. Par conséquent, d'après la propriété des accroissements :
+ \begin{align*}
+ a&=\frac{\useKV[ClesAffine]{Nom}(\num{#2})-\useKV[ClesAffine]{Nom}(\num{#4})}{\num{#2}-\xintifboolexpr{#4<0}{(\num{#4})}{\num{#4}}}\\
+ a&=\frac{\num{#3}-\xintifboolexpr{#5<0}{(\num{#5})}{\num{#5}}}{\num{\fpeval{#2-#4}}}\\
+ a&=\frac{\num{\fpeval{#3-#5}}}{\num{\fpeval{#2-#4}}}%\\
+ \SSimpliTest{\fpeval{#3-#5}}{\fpeval{#2-#4}}\ifthenelse{\boolean{Simplification}}{\\a&=\SSimplifie{\fpeval{#3-#5}}{\fpeval{#2-#4}}}{}%
+ \end{align*}
+ La fonction $\useKV[ClesAffine]{Nom}$ s'écrit alors sous la forme $\displaystyle\useKV[ClesAffine]{Nom}(\useKV[ClesAffine]{Variable})=\SSimplifie{\fpeval{#3-#5}}{\fpeval{#2-#4}}\useKV[ClesAffine]{Variable}+b$.
+ \\De plus, comme $\useKV[ClesAffine]{Nom}(\num{#2})=\num{#3}$, alors :
+ \begin{align*}
+ \SSimplifie{\fpeval{#3-#5}}{\fpeval{#2-#4}}\times\xintifboolexpr{#2<0}{(\num{#2})}{\num{#2}}+b&=\num{#3}\\
+ \SSimplifie{\fpeval{(#3-#5)*#2}}{\fpeval{#2-#4}}+b&=\num{#3}\\
+ b&=\num{\fpeval{#3-(#3-#5)*#2/(#2-#4)}}
+ \end{align*}
+ \xdef\OrdOrigine{\fpeval{#3-(#3-#5)*#2/(#2-#4)}}
+ La fonction affine $\useKV[ClesAffine]{Nom}$ cherchée est :
+ \[\useKV[ClesAffine]{Nom}:\useKV[ClesAffine]{Variable}\mapsto\SSimplifie{\fpeval{#3-#5}}{\fpeval{#2-#4}}\useKV[ClesAffine]{Variable}\xintifboolexpr{\OrdOrigine=0}{}{\xintifboolexpr{\OrdOrigine>0}{+\num{\OrdOrigine}}{-\num{\fpeval{0-\OrdOrigine}}}}\]
+ }{%
+ %
+ }%
+ }%
+ }%
+ \ifboolKV[ClesAffine]{Graphique}{%
+ \ifboolKV[ClesAffine]{VoirCoef}{%
+ \MPFonctionAffine{\useKV[ClesAffine]{Unitex}}{\useKV[ClesAffine]{Unitey}}{#2}{#3}{#4}{#5}{\useKV[ClesAffine]{ACoef}}%
+ }{%
+ \MPFonctionAffine{\useKV[ClesAffine]{Unitex}}{\useKV[ClesAffine]{Unitey}}{#2}{#3}{#4}{#5}{""}}{}%
+ }{}%
+ \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}})$.
+ }{%
+ 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}})$.%
+ }%
+ }%
+ }%
+ {}%
+ \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}}}}}}{}%
+}%
+
+\def\MPFonctionAffine#1#2#3#4#5#6#7{%
+ % #1 Unitex #2 Unitey
+ % #2 a pour f1 - #4 b pour f1
+ % #5 abscisse du premier point
+ % #6 abscisse du deuxième point
+ \ifluatex
+ \mplibforcehmode
+ \begin{mplibcode}
+ XMin=-2;
+ XMax=2;
+ if #5<XMin:
+ XMin:=#5;
+ fi;
+ if #6<XMin:
+ XMin:=#6;
+ fi;
+ if #5>XMax:
+ XMax:=#5;
+ fi;
+ if #6>XMax:
+ XMax:=#6;
+ fi;
+ YMax=2;
+ YMin=-2;
+ if (#5*#3+(#4))>YMax:
+ YMax:=(#5*#3+(#4));
+ fi;
+ if (#6*#3+(#4))>YMax:
+ YMax:=(#6*#3+(#4));
+ fi;
+ if (#5*#3+(#4))<YMin:
+ YMin:=(#5*#3+(#4));
+ fi;
+ if (#6*#3+(#4))<YMin:
+ YMin:=(#6*#3+(#4));
+ fi;
+ unitex:=#1*cm;
+ unitey:=#2*cm;
+ XMax:=XMax+2;
+ XMin:=XMin-2;
+ YMax:=YMax+2;
+ YMin:=YMin-2;
+ %On trace la grille
+ drawoptions(withcolor 0.95white);
+ for k=0 upto (XMax-XMin):
+ draw ((XMin+k)*unitex,YMin*unitey)--((XMin+k)*unitex,YMax*unitey);
+ endfor;
+ for k=0 upto (YMax-YMin):
+ draw (XMin*unitex,(YMin+k)*unitey)--(XMax*unitex,(YMin+k)*unitey);
+ endfor;
+ drawoptions();
+ %On trace les axes
+ drawarrow (XMin*unitex,0)--(XMax*unitex,0);
+ drawarrow (0,YMin*unitey)--(0,YMax*unitey);
+ label.llft(btex O etex,(0,0));
+ dotlabel.bot(btex 1 etex,(unitex,0));
+ dotlabel.lft(btex 1 etex,(0,unitey));
+ % On trace la droite
+ pair A[];
+ A1=(#5*unitex,(#5*#3+(#4))*unitey);
+ A2=(#6*unitex,(#6*#3+(#4))*unitey);
+ draw 2[A1,A2]--2[A2,A1];
+ clip currentpicture to ((XMin*unitex,YMin*unitey)--(XMax*unitex,YMin*unitey)--(XMax*unitex,YMax*unitey)--(XMin*unitex,YMax*unitey)--cycle);
+ %On labellise les points
+ fill (fullcircle scaled 1mm) shifted A1;
+ fill (fullcircle scaled 1mm) shifted A2;
+ draw (xpart(A1),0)--A1--(0,ypart(A1)) dashed evenly;
+ draw (xpart(A2),0)--A2--(0,ypart(A2)) dashed evenly;
+ if (#5*#3+(#4))=0:
+ else:
+ if (#5*#3+(#4))<0:
+ label.top(TEX("\num{"&decimal(#5)&"}"),(xpart(A1),0));
+ else:
+ label.bot(TEX("\num{"&decimal(#5)&"}"),(xpart(A1),0));
+ fi;
+ fi;
+ if (#6*#3+(#4))=0:
+ else:
+ if (#6*#3+(#4))<0:
+ label.top(TEX("\num{"&decimal(#6)&"}"),(xpart(A2),0));
+ else:
+ label.bot(TEX("\num{"&decimal(#6)&"}"),(xpart(A2),0));
+ fi;
+ fi;
+ if #3=0:
+ label.urt(TEX("\num{"&decimal(#5*#3+(#4))&"}"),(0,ypart(A1)));
+ else:
+ if #3>0:
+ if (#5*#3+(#4))=0:
+ else:
+ if (#5*#3+(#4))<0:
+ label.rt(TEX("\num{"&decimal(#5*#3+(#4))&"}"),(0,ypart(A1)));
+ else:
+ label.lft(TEX("\num{"&decimal(#5*#3+(#4))&"}"),(0,ypart(A1)));
+ fi;
+ fi;
+ if (#6*#3+(#4))=0:
+ else:
+ if (#6*#3+(#4))<0:
+ label.rt(TEX("\num{"&decimal(#6*#3+(#4))&"}"),(0,ypart(A2)));
+ else:
+ label.lft(TEX("\num{"&decimal(#6*#3+(#4))&"}"),(0,ypart(A2)));
+ fi;
+ fi;
+ else:
+ if (#5*#3+(#4))=0:
+ else:
+ if (#5*#3+(#4))<0:
+ label.lft(TEX("\num{"&decimal(#5*#3+(#4))&"}"),(0,ypart(A1)));
+ else:
+ label.rt(TEX("\num{"&decimal(#5*#3+(#4))&"}"),(0,ypart(A1)));
+ fi;
+ fi;
+ if (#6*#3+(#4))=0:
+ else:
+ if (#6*#3+(#4))<0:
+ label.lft(TEX("\num{"&decimal(#6*#3+(#4))&"}"),(0,ypart(A2)));
+ else:
+ label.rt(TEX("\num{"&decimal(#6*#3+(#4))&"}"),(0,ypart(A2)));
+ fi;
+ fi;
+ fi;
+ fi;
+ % On affiche ou pas "la marche" du coef directeur
+ for p_=#7:
+ if numeric p_:
+ draw ((#7*unitex,(#7*#3+(#4))*unitey)--((#7+1)*unitex,(#7*#3+(#4))*unitey)--((#7+1)*unitex,((#7+1)*#3+(#4))*unitey)) withcolor red;
+ fi;
+ endfor;
+ \end{mplibcode}
+ \else
+ \begin{mpost}
+ % On définit les constantes
+ XMin=-2;
+ XMax=2;
+ if #5<XMin:
+ XMin:=#5;
+ fi;
+ if #6<XMin:
+ XMin:=#6;
+ fi;
+ if #5>XMax:
+ XMax:=#5;
+ fi;
+ if #6>XMax:
+ XMax:=#6;
+ fi;
+ YMax=2;
+ YMin=-2;
+ if (#5*#3+(#4))>YMax:
+ YMax:=(#5*#3+(#4));
+ fi;
+ if (#6*#3+(#4))>YMax:
+ YMax:=(#6*#3+(#4));
+ fi;
+ if (#5*#3+(#4))<YMin:
+ YMin:=(#5*#3+(#4));
+ fi;
+ if (#6*#3+(#4))<YMin:
+ YMin:=(#6*#3+(#4));
+ fi;
+ unitex:=#1*cm;
+ unitey:=#2*cm;
+ XMax:=XMax+2;
+ XMin:=XMin-2;
+ YMax:=YMax+2;
+ YMin:=YMin-2;
+ %On trace la grille
+ drawoptions(withcolor 0.95white);
+ for k=0 upto (XMax-XMin):
+ draw ((XMin+k)*unitex,YMin*unitey)--((XMin+k)*unitex,YMax*unitey);
+ endfor;
+ for k=0 upto (YMax-YMin):
+ draw (XMin*unitex,(YMin+k)*unitey)--(XMax*unitex,(YMin+k)*unitey);
+ endfor;
+ drawoptions();
+ %On trace les axes
+ drawarrow (XMin*unitex,0)--(XMax*unitex,0);
+ drawarrow (0,YMin*unitey)--(0,YMax*unitey);
+ label.llft(btex O etex,(0,0));
+ dotlabel.bot(btex 1 etex,(unitex,0));
+ dotlabel.lft(btex 1 etex,(0,unitey));
+ % On trace la droite
+ pair A[];
+ A1=(#5*unitex,(#5*#3+(#4))*unitey);
+ A2=(#6*unitex,(#6*#3+(#4))*unitey);
+ draw 2[A1,A2]--2[A2,A1];
+ clip currentpicture to ((XMin*unitex,YMin*unitey)--(XMax*unitex,YMin*unitey)--(XMax*unitex,YMax*unitey)--(XMin*unitex,YMax*unitey)--cycle);
+ %On labellise les points
+ fill (fullcircle scaled 1mm) shifted A1;
+ fill (fullcircle scaled 1mm) shifted A2;
+ draw (xpart(A1),0)--A1--(0,ypart(A1)) dashed evenly;
+ draw (xpart(A2),0)--A2--(0,ypart(A2)) dashed evenly;
+ if (#5*#3+(#4))=0:
+ else:
+ if (#5*#3+(#4))<0:
+ label.top(LATEX("\num{"&decimal(#5)&"}"),(xpart(A1),0));
+ else:
+ label.bot(LATEX("\num{"&decimal(#5)&"}"),(xpart(A1),0));
+ fi;
+ fi;
+ if (#6*#3+(#4))=0:
+ else:
+ if (#6*#3+(#4))<0:
+ label.top(LATEX("\num{"&decimal(#6)&"}"),(xpart(A2),0));
+ else:
+ label.bot(LATEX("\num{"&decimal(#6)&"}"),(xpart(A2),0));
+ fi;
+ fi;
+ if #3=0:
+ label.urt(LATEX("\num{"&decimal(#5*#3+(#4))&"}"),(0,ypart(A1)));
+ else:
+ if #3>0:
+ if (#5*#3+(#4))=0:
+ else:
+ if (#5*#3+(#4))<0:
+ label.rt(LATEX("\num{"&decimal(#5*#3+(#4))&"}"),(0,ypart(A1)));
+ else:
+ label.lft(LATEX("\num{"&decimal(#5*#3+(#4))&"}"),(0,ypart(A1)));
+ fi;
+ fi;
+ if (#6*#3+(#4))=0:
+ else:
+ if (#6*#3+(#4))<0:
+ label.rt(LATEX("\num{"&decimal(#6*#3+(#4))&"}"),(0,ypart(A2)));
+ else:
+ label.lft(LATEX("\num{"&decimal(#6*#3+(#4))&"}"),(0,ypart(A2)));
+ fi;
+ fi;
+ else:
+ if (#5*#3+(#4))=0:
+ else:
+ if (#5*#3+(#4))<0:
+ label.lft(LATEX("\num{"&decimal(#5*#3+(#4))&"}"),(0,ypart(A1)));
+ else:
+ label.rt(LATEX("\num{"&decimal(#5*#3+(#4))&"}"),(0,ypart(A1)));
+ fi;
+ fi;
+ if (#6*#3+(#4))=0:
+ else:
+ if (#6*#3+(#4))<0:
+ label.lft(LATEX("\num{"&decimal(#6*#3+(#4))&"}"),(0,ypart(A2)));
+ else:
+ label.rt(LATEX("\num{"&decimal(#6*#3+(#4))&"}"),(0,ypart(A2)));
+ fi;
+ fi;
+ fi;
+ fi;
+ % On affiche ou pas "la marche" du coef directeur
+ for p_=#7:
+ if numeric p_:
+ draw ((#7*unitex,(#7*#3+(#4))*unitey)--((#7+1)*unitex,(#7*#3+(#4))*unitey)--((#7+1)*unitex,((#7+1)*#3+(#4))*unitey)) withcolor red;
+ fi;
+ endfor;
+ \end{mpost}
+ \fi
+}
+
+
+%%%%%%%%%%%%%%%
+% Fonction
+%%%%%%%%%%%%%%%
+\setKVdefault[ClesFonction]{Nom=f,Variable=x,Calcul=x,Tableau=false,Largeur=5mm,Ecriture=false,Definition=false}
+
+\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%
+ }{}
+}
+
+\def\buildtabfonction{%\\
+ \[%
+ \begin{array}{|>{\columncolor{gray!15}}c|*{\number\numexpr\ListeFonctionlen}{>{\centering\arraybackslash}p{\useKV[ClesFonction]{Largeur}}|}}%
+ \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}}}
+ \\\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}
+
+\def\MPFigureCarre{%
+ \ifluatex
+ \mplibforcehmode
+ \begin{mplibcode}
+ drawoptions( dashed dashpattern(on1cm));
+ pair A,B,C,D;
+ A=u*(1,1);
+ B-A=u*(2,0);
+ C=rotation(A,B,-90);
+ D-C=A-B;
+ draw polygone(A,B,C,D);
+ draw codeperp(A,B,C,5);
+ draw codeperp(B,C,D,5);
+ draw codeperp(C,D,A,5);
+ draw codeperp(D,A,B,5);
+ marque_s:=marque_s/3;
+ draw Codelongueur(A,B,B,C,C,D,D,A,2);
+ marque_s:=marque_s*3;
+ draw appelation(A,B,-3mm,btex $c$ etex);
+ \end{mplibcode}
+ \else
+ \begin{mpost}[mpsettings={input PfC-Geometrie;}]
+ pair A,B,C,D;
+ A=u*(1,1);
+ B-A=u*(2,0);
+ C=rotation(A,B,-90);
+ D-C=A-B;
+ draw polygone(A,B,C,D);
+ draw codeperp(A,B,C,5);
+ draw codeperp(B,C,D,5);
+ draw codeperp(C,D,A,5);
+ draw codeperp(D,A,B,5);
+ marque_s:=marque_s/3;
+ draw Codelongueur(A,B,B,C,C,D,D,A,2);
+ marque_s:=marque_s*3;
+ draw appelation(A,B,-3mm,btex $c$ etex);
+ \end{mpost}
+ \fi
+}
+
+\def\MPFigurePolygone{%
+ \ifluatex
+ \mplibforcehmode
+ \begin{mplibcode}
+ drawoptions( dashed dashpattern(on1cm));
+ pair A,B,C,D,E,F;
+ A=u*(1,1);
+ B-A=u*(2,0);
+ C=3/5[B,rotation(A,B,-120)];
+ D-C=u*(0,1);
+ E-D=u*(-1.25,-1);
+ F-E=u*(-1,1);
+ draw polygone(A,B,C,D,E,F);
+ \end{mplibcode}
+ \else
+ \begin{mpost}[mpsettings={input PfC-Geometrie;}]
+ pair A,B,C,D,E,F;
+ A=u*(1,1);
+ B-A=u*(2,0);
+ C=3/5[B,rotation(A,B,-120)];
+ D-C=u*(0,1);
+ E-D=u*(-1.25,-1);
+ F-E=u*(-1,1);
+ draw polygone(A,B,C,D,E,F);
+ \end{mpost}
+ \fi
+}
+
+\def\MPFigureParallelogramme{%
+ \ifluatex
+ \mplibforcehmode
+ \begin{mplibcode}
+ drawoptions( dashed dashpattern(on1cm));
+ Figure(-5u,-5u,5u,5u);
+ pair A,B,C,D;
+ A=u*(1,1);
+ B-A=u*(2.25,0.25);
+ D=4/5[A,rotation(B,A,40)];
+ C-D=B-A;
+ draw polygone(A,B,C,D);
+ drawoptions(withcolor gris);
+ draw marque_para(droite(A,B),droite(C,D),0.455);
+ draw marque_para(droite(B,C),droite(A,D),0.43);
+ draw segment(B,2.5[C,B]) dashed evenly;
+ draw segment(A,1.5[D,A]) dashed evenly;
+ draw segment(A,1.55[B,A]) dashed evenly;
+ draw segment(D,2[C,D]) dashed evenly;
+ drawoptions();
+ \end{mplibcode}
+ \else
+ \begin{mpost}[mpsettings={input PfC-Geometrie;}]
+ Figure(-5u,-5u,5u,5u);
+ pair A,B,C,D;
+ A=u*(1,1);
+ B-A=u*(2.25,0.25);
+ D=4/5[A,rotation(B,A,40)];
+ C-D=B-A;
+ draw polygone(A,B,C,D);
+ drawoptions(withcolor gris);
+ draw marque_para(droite(A,B),droite(C,D),0.455);
+ draw marque_para(droite(B,C),droite(A,D),0.43);
+ draw segment(B,2.5[C,B]) dashed evenly;
+ draw segment(A,1.5[D,A]) dashed evenly;
+ draw segment(A,1.55[B,A]) dashed evenly;
+ draw segment(D,2[C,D]) dashed evenly;
+ drawoptions();
+ \end{mpost}
+ \fi
+}
+
+\def\MPFigureParallelogrammeAire{%
+ \ifluatex
+ \mplibforcehmode
+ \begin{mplibcode}
+ drawoptions( dashed dashpattern(on1cm));
+ Figure(-5u,-5u,10u,5u);
+ pair A,B,C,D,I,J;
+ A=u*(1,1);
+ B-A=u*(2,0.5);
+ D=3/5[A,rotation(B,A,40)];
+ C-D=B-A;
+ I=projection(D,A,B);
+ draw polygone(A,B,C,D) withcolor gris;
+ draw segment(A,B);
+ draw segment(D,I);
+ draw codeperp(D,I,B,5);
+ A:=A+3*u*(1,0);
+ B:=A+u*(2,0.5);
+ D:=3/5[A,rotation(B,A,40)];
+ C:=D+B-A;
+ J=projection(B,A,D);
+ draw polygone(A,B,C,D) withcolor gris;
+ draw segment(D,1.5[A,D]) dashed evenly withcolor gris;
+ draw segment(A,D);
+ draw segment(B,J);
+ draw codeperp(B,J,A,5);
+ \end{mplibcode}
+ \else
+ \begin{mpost}[mpsettings={input PfC-Geometrie;}]
+ Figure(-5u,-5u,10u,5u);
+ pair A,B,C,D,I,J;
+ A=u*(1,1);
+ B-A=u*(2,0.5);
+ D=3/5[A,rotation(B,A,40)];
+ C-D=B-A;
+ I=projection(D,A,B);
+ draw polygone(A,B,C,D) withcolor gris;
+ draw segment(A,B);
+ draw segment(D,I);
+ draw codeperp(D,I,B,5);
+ A:=A+3*u*(1,0);
+ B:=A+u*(2,0.5);
+ D:=3/5[A,rotation(B,A,40)];
+ C:=D+B-A;
+ J=projection(B,A,D);
+ draw polygone(A,B,C,D) withcolor gris;
+ draw segment(D,1.5[A,D]) dashed evenly withcolor gris;
+ draw segment(A,D);
+ draw segment(B,J);
+ draw codeperp(B,J,A,5);
+ \end{mpost}
+ \fi
+}
+
+\def\MPFigureSphere{%
+ \ifluatex
+ \mplibforcehmode
+ \begin{mplibcode}
+ drawoptions( dashed dashpattern(on1cm));
+ typetrace:="3D";
+ Figure(-10u,-10u,10u,10u);
+ Initialisation(5,0,10,500);
+ color O,A,B,C;
+ O=(0,0,0);
+ A-O=(0,1/2,0);
+ C-O=(-1/2,0,0);
+ B-O=(0,0,1/2);
+ path cc,cd;
+ cc=cercles(O,A,O,A,C);
+ cd=cercles(O,A,O,A,B);
+ draw cd;
+ draw (subpath(0,length cc/2) of cc) dashed evenly;
+ draw subpath(length cc/2,length cc) of cc;
+ draw cotationmil(O,A,0,18,btex rayon $r$ etex);
+ marque_p:="plein";
+ pointe(O);
+ marque_p:="non";
+ \end{mplibcode}
+ \else
+ \begin{mpost}[mpsettings={input PfC-Geometrie;}]
+ typetrace:="3D";
+ Figure(-10u,-10u,10u,10u);
+ Initialisation(5,0,10,500);
+ color O,A,B,C;
+ O=(0,0,0);
+ A-O=(0,1/2,0);
+ C-O=(-1/2,0,0);
+ B-O=(0,0,1/2);
+ path cc,cd;
+ cc=cercles(O,A,O,A,C);
+ cd=cercles(O,A,O,A,B);
+ draw cd;
+ draw (subpath(0,length cc/2) of cc) dashed evenly;
+ draw subpath(length cc/2,length cc) of cc;
+ draw cotationmil(O,A,0,18,btex rayon $r$ etex);
+ marque_p:="plein";
+ pointe(O);
+ marque_p:="non";
+ \end{mpost}
+ \fi
+}
+
+\def\MPFigurePave{%
+ \ifluatex
+ \mplibforcehmode
+ \begin{mplibcode}
+ drawoptions( dashed dashpattern(on1cm));
+ typetrace:="3D";
+ typerepre:="persp";
+ Figure(-10u,-10u,10u,10u);
+ Initialisation(5,30,20,115);
+ color A,B,C,D,E,F,G,H;
+ draw Pave(A,B,C,D,E,F,G,H)(0.5,1,1/3) withcolor gris;
+ draw segment(A,B);
+ draw segment(E,F);
+ draw segment(A,F);
+ draw appelation(A,B,-2mm,\btex $\ell$ etex);
+ draw appelation(F,E,2mm,\btex $p$ etex);
+ draw appelation(A,F,2mm,\btex $h$ etex);
+ \end{mplibcode}
+ \else
+ \begin{mpost}[mpsettings={input PfC-Geometrie;}]
+ typetrace:="3D";
+ typerepre:="persp";
+ Figure(-10u,-10u,10u,10u);
+ Initialisation(5,30,20,115);
+ color A,B,C,D,E,F,G,H;
+ draw Pave(A,B,C,D,E,F,G,H)(0.5,1,1/3) withcolor gris;
+ draw segment(A,B);
+ draw segment(E,F);
+ draw segment(A,F);
+ draw appelation(A,B,-2mm,\btex $\ell$ etex);
+ draw appelation(F,E,2mm,\btex $p$ etex);
+ draw appelation(A,F,2mm,\btex $h$ etex);
+ \end{mpost}
+ \fi
+}
+
+\def\MPFigurePrisme{%
+ \ifluatex
+ \mplibforcehmode
+ \begin{mplibcode}
+ drawoptions( dashed dashpattern(on1cm));
+ typetrace:="3D";
+ typerepre:="persp";
+ Figure(-10u,-10u,10u,10u);
+ Initialisation(5,30,20,115);
+ color A,B,C,D,E,F,G,H;
+ D=(0.75,0,0);
+ G=(0,1,0);
+ H=(0,0,0);
+ A-D=(0,0,0.5);
+ C-D=G-H;
+ E-H=A-D;
+ F-E=(0,0.6,0);
+ B-A=F-E;
+ NbS:=8;
+ Sommet1:=A;
+ Sommet2:=B;
+ Sommet3:=C;
+ Sommet4:=D;
+ Sommet5:=E;
+ Sommet6:=F;
+ Sommet7:=G;
+ Sommet8:=H;
+ NF:=6;
+ Fc[100]:=4;Fc[101]:=1;Fc[102]:=4;Fc[103]:=3;Fc[104]:=2;
+ Fc[200]:=4;Fc[201]:=4;Fc[202]:=1;Fc[203]:=5;Fc[204]:=8;
+ Fc[300]:=4;Fc[301]:=4;Fc[302]:=8;Fc[303]:=7;Fc[304]:=3;
+ Fc[400]:=4;Fc[401]:=8;Fc[402]:=5;Fc[403]:=6;Fc[404]:=7;
+ Fc[500]:=4;Fc[501]:=1;Fc[502]:=2;Fc[503]:=6;Fc[504]:=5;
+ Fc[600]:=4;Fc[601]:=2;Fc[602]:=3;Fc[603]:=7;Fc[604]:=6;
+ CoulTrace:=gris;
+ DessineObjet;
+ drawoptions(withcolor gris);
+ draw codeperp(B,A,E,5);
+ draw codeperp(A,B,F,5);
+ draw codeperp(H,D,C,5);
+ draw codeperp(D,C,G,5);
+ drawoptions();
+ draw polygone(A,B,C,D);
+ draw hachurage(polygone(A,B,C,D),60,0.3,0);
+ draw segment(A,E);
+ draw appelation(A,E,3mm,btex hauteur etex);
+ \end{mplibcode}
+ \else
+ \begin{mpost}[mpsettings={input PfC-Geometrie;}]
+ typetrace:="3D";
+ typerepre:="persp";
+ Figure(-10u,-10u,10u,10u);
+ Initialisation(5,30,20,115);
+ color A,B,C,D,E,F,G,H;
+ D=(0.75,0,0);
+ G=(0,1,0);
+ H=(0,0,0);
+ A-D=(0,0,0.5);
+ C-D=G-H;
+ E-H=A-D;
+ F-E=(0,0.6,0);
+ B-A=F-E;
+ NbS:=8;
+ Sommet1:=A;
+ Sommet2:=B;
+ Sommet3:=C;
+ Sommet4:=D;
+ Sommet5:=E;
+ Sommet6:=F;
+ Sommet7:=G;
+ Sommet8:=H;
+ NF:=6;
+ Fc[100]:=4;Fc[101]:=1;Fc[102]:=4;Fc[103]:=3;Fc[104]:=2;
+ Fc[200]:=4;Fc[201]:=4;Fc[202]:=1;Fc[203]:=5;Fc[204]:=8;
+ Fc[300]:=4;Fc[301]:=4;Fc[302]:=8;Fc[303]:=7;Fc[304]:=3;
+ Fc[400]:=4;Fc[401]:=8;Fc[402]:=5;Fc[403]:=6;Fc[404]:=7;
+ Fc[500]:=4;Fc[501]:=1;Fc[502]:=2;Fc[503]:=6;Fc[504]:=5;
+ Fc[600]:=4;Fc[601]:=2;Fc[602]:=3;Fc[603]:=7;Fc[604]:=6;
+ CoulTrace:=gris;
+ DessineObjet;
+ drawoptions(withcolor gris);
+ draw codeperp(B,A,E,5);
+ draw codeperp(A,B,F,5);
+ draw codeperp(H,D,C,5);
+ draw codeperp(D,C,G,5);
+ drawoptions();
+ draw polygone(A,B,C,D);
+ draw hachurage(polygone(A,B,C,D),60,0.3,0);
+ draw segment(A,E);
+ draw appelation(A,E,3mm,btex hauteur etex);
+ \end{mpost}
+ \fi
+}
+
+\def\MPFigureCylindre{%
+ \ifluatex
+ \mplibforcehmode
+ \begin{mplibcode}
+ drawoptions( dashed dashpattern(on1cm));
+ typetrace:="3D";
+ typerepre:="persp";
+ Figure(-10u,-10u,10u,10u);
+ Initialisation(5,0,20,70);
+ color O,O',A,A',B,B',C,C';
+ O=(0,0,0);
+ O'-O=(0,0,1);
+ A-O=(0,1,0);
+ A'-A=O'-O;
+ C=symetrie(A,O);
+ C'-C=O'-O;
+ B-O=(-1/2,0,0);
+ B'-B=O'-O;
+ path cc,cd;
+ cc=cercles(O,A,O,A,B);
+ cd=cercles(O',A',O',A',B');
+ draw cd;
+ draw segment(C,C');
+ draw segment(A,A');
+ draw (subpath(0,length cc/2) of cc) dashed evenly;
+ draw subpath(length cc/2,length cc) of cc;
+ draw segment(O,A);
+ draw cotationmil(C,C',3mm,25,btex hauteur $h$ etex);
+ draw appelation(O,A,2mm,btex rayon $r$ etex);
+ marque_p:="croix";
+ pointe(O);
+ marque_p:="non";
+ \end{mplibcode}
+ \else
+ \begin{mpost}[mpsettings={input PfC-Geometrie;}]
+ typetrace:="3D";
+ typerepre:="persp";
+ Figure(-10u,-10u,10u,10u);
+ Initialisation(5,0,20,70);
+ color O,O',A,A',B,B',C,C';
+ O=(0,0,0);
+ O'-O=(0,0,1);
+ A-O=(0,1,0);
+ A'-A=O'-O;
+ C=symetrie(A,O);
+ C'-C=O'-O;
+ B-O=(-1/2,0,0);
+ B'-B=O'-O;
+ path cc,cd;
+ cc=cercles(O,A,O,A,B);
+ cd=cercles(O',A',O',A',B');
+ draw cd;
+ draw segment(C,C');
+ draw segment(A,A');
+ draw (subpath(0,length cc/2) of cc) dashed evenly;
+ draw subpath(length cc/2,length cc) of cc;
+ draw segment(O,A);
+ draw cotationmil(C,C',3mm,25,btex hauteur $h$ etex);
+ draw appelation(O,A,2mm,btex rayon $r$ etex);
+ marque_p:="croix";
+ pointe(O);
+ marque_p:="non";
+ \end{mpost}
+ \fi
+}
+
+\def\MPFigureCone{%
+ \ifluatex
+ \mplibforcehmode
+ \begin{mplibcode}
+ drawoptions( dashed dashpattern(on1cm));
+ typetrace:="3D";
+ typerepre:="persp";
+ Figure(-10u,-10u,10u,10u);
+ Initialisation(5,0,10,70);
+ color O,O',A,B,C;
+ O=(0,0,0);
+ O'-O=(0,0,1.5);
+ A-O=(0,1,0);
+ C=symetrie(A,O);
+ B-O=(-1/2,0,0);
+ path cc;
+ cc=cercles(O,A,O,A,B);
+ draw chemin(C,O',A);
+ draw (subpath(0,length cc/2) of cc) dashed evenly;
+ draw subpath(length cc/2,length cc) of cc;
+ draw chemin(O',O,A);
+ draw appelation(O,O',2mm,btex hauteur etex);
+ draw appelation(O,A,1mm,btex rayon $r$ etex);
+ marque_p:="croix";
+ pointe(O);
+ marque_p:="non";
+ \end{mplibcode}
+ \else
+ \begin{mpost}[mpsettings={input PfC-Geometrie;}]
+ typetrace:="3D";
+ typerepre:="persp";
+ Figure(-10u,-10u,10u,10u);
+ Initialisation(5,0,10,70);
+ color O,O',A,B,C;
+ O=(0,0,0);
+ O'-O=(0,0,1.5);
+ A-O=(0,1,0);
+ C=symetrie(A,O);
+ B-O=(-1/2,0,0);
+ path cc;
+ cc=cercles(O,A,O,A,B);
+ draw chemin(C,O',A);
+ draw (subpath(0,length cc/2) of cc) dashed evenly;
+ draw subpath(length cc/2,length cc) of cc;
+ draw chemin(O',O,A);
+ draw appelation(O,O',2mm,btex hauteur etex);
+ draw appelation(O,A,1mm,btex rayon $r$ etex);
+ marque_p:="croix";
+ pointe(O);
+ marque_p:="non";
+ \end{mpost}
+ \fi
+}
+
+\def\MPFigurePyramide{%
+ \ifluatex
+ \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;
+ z2=(4,2)*u;
+ z3=(-0.5,2.75)*u;
+ z4=(-3,1.5)*u;
+ z5=(0.5,6)*u;
+ z6=(0.5,1.5)*u;
+ z7=z6 shifted (5u,0);
+ draw z5--z0 withcolor gris;
+ draw z5--z1 withcolor gris;
+ draw z5--z2 withcolor gris;
+ draw z5--z4 withcolor gris;
+ draw z5--z3 dashed evenly withcolor gris;
+ draw hachurage(polygone(z4,z0,z1,z2,z3,z4),60,0.4,0);
+ remplis codeperp(z7,z6,z5,8)--z6--cycle withcolor white;
+ draw z4--z0--z1--z2;
+ draw z2--z3--z4 dashed evenly;
+ draw z5--z6 dashed evenly;
+ draw codeperp(z7,z6,z5,8);
+ \end{mplibcode}
+ \else
+ \begin{mpost}[mpsettings={input PfC-Geometrie;}]
+ Figure(-10u,-10u,10u,10u);
+ u:=0.5cm;
+ z0=(-0.5,0)*u;
+ z1=(2.5,0.5)*u;
+ z2=(4,2)*u;
+ z3=(-0.5,2.75)*u;
+ z4=(-3,1.5)*u;
+ z5=(0.5,6)*u;
+ z6=(0.5,1.5)*u;
+ z7=z6 shifted (5u,0);
+ draw z5--z0 withcolor gris;
+ draw z5--z1 withcolor gris;
+ draw z5--z2 withcolor gris;
+ draw z5--z4 withcolor gris;
+ draw z5--z3 dashed evenly withcolor gris;
+ draw hachurage(polygone(z4,z0,z1,z2,z3,z4),60,0.4,0);
+ remplis codeperp(z7,z6,z5,8)--z6--cycle withcolor white;
+ draw z4--z0--z1--z2;
+ draw z2--z3--z4 dashed evenly;
+ draw z5--z6 dashed evenly;
+ draw codeperp(z7,z6,z5,8);
+ \end{mpost}
+ \fi
+}
+
+\def\MPFigureCube{%
+ \ifluatex
+ \mplibforcehmode
+ \begin{mplibcode}
+ drawoptions( dashed dashpattern(on1cm));
+ typetrace:="3D";
+ typerepre:="persp";
+ Figure(-10u,-10u,10u,10u);
+ Initialisation(5,30,20,80);
+ color A,B,C,D,E,F,G,H;
+ draw Cube(A,B,C,D,E,F,G,H) withcolor gris;
+ draw segment(E,H);
+ draw appelation(E,H,2mm,btex $a$ etex);
+ \end{mplibcode}
+ \else
+ \begin{mpost}[mpsettings={input PfC-Geometrie;}]
+ typetrace:="3D";
+ typerepre:="persp";
+ Figure(-10u,-10u,10u,10u);
+ Initialisation(5,30,20,80);
+ color A,B,C,D,E,F,G,H;
+ draw Cube(A,B,C,D,E,F,G,H) withcolor gris;
+ draw segment(E,H);
+ draw appelation(E,H,2mm,btex $a$ etex);
+ \end{mpost}
+ \fi
+}
+
+\def\MPFigureLosange{%
+ \ifluatex
+ \mplibforcehmode
+ \begin{mplibcode}
+ drawoptions( dashed dashpattern(on1cm));
+ Figure(-5u,-5u,5u,5u);
+ pair A,B,C,D;
+ A=u*(1,1);
+ B-A=u*(2,0.5);
+ D=rotation(B,A,40);
+ C-D=B-A;
+ draw polygone(A,B,C,D);
+ marque_s:=marque_s/3;
+ draw Codelongueur(A,B,B,C,C,D,D,A,2);
+ marque_s:=marque_s*3;
+ draw appelation(A,B,-3mm,btex $c$ etex);
+ \end{mplibcode}
+ \else
+ \begin{mpost}[mpsettings={input PfC-Geometrie;}]
+ Figure(-5u,-5u,5u,5u);
+ pair A,B,C,D;
+ A=u*(1,1);
+ B-A=u*(2,0.5);
+ D=rotation(B,A,40);
+ C-D=B-A;
+ draw polygone(A,B,C,D);
+ marque_s:=marque_s/3;
+ draw Codelongueur(A,B,B,C,C,D,D,A,2);
+ marque_s:=marque_s*3;
+ draw appelation(A,B,-3mm,btex $c$ etex);
+ \end{mpost}
+ \fi
+}
+
+\def\MPFigureLosangeAire{%
+ \ifluatex
+ \mplibforcehmode
+ \begin{mplibcode}
+ drawoptions( dashed dashpattern(on1cm));
+ Figure(-5u,-5u,5u,5u);
+ pair A,B,C,D;
+ A=u*(1,1);
+ B-A=u*(2,0.5);
+ D=rotation(B,A,40);
+ C-D=B-A;
+ draw polygone(A,B,C,D) withcolor gris;
+ draw segment(A,C);
+ draw segment(B,D);
+ marque_s:=marque_s/3;
+ draw Codelongueur(A,B,B,C,C,D,D,A,2);
+ marque_s:=marque_s*3;
+ \end{mplibcode}
+ \else
+ \begin{mpost}[mpsettings={input PfC-Geometrie;}]
+ Figure(-5u,-5u,5u,5u);
+ pair A,B,C,D;
+ A=u*(1,1);
+ B-A=u*(2,0.5);
+ D=rotation(B,A,40);
+ C-D=B-A;
+ draw polygone(A,B,C,D) withcolor gris;
+ draw segment(A,C);
+ draw segment(B,D);
+ marque_s:=marque_s/3;
+ draw Codelongueur(A,B,B,C,C,D,D,A,2);
+ marque_s:=marque_s*3;
+ \end{mpost}
+ \fi
+}
+
+\def\MPFigureRectangle{%
+ \ifluatex
+ \mplibforcehmode
+ \begin{mplibcode}
+ drawoptions( dashed dashpattern(on1cm));
+ pair A,B,C,D;
+ A=u*(1,1);
+ B-A=u*(3,0);
+ C=2/3[B,rotation(A,B,-90)];
+ D-C=A-B;
+ draw polygone(A,B,C,D);
+ draw codeperp(A,B,C,5);
+ draw codeperp(B,C,D,5);
+ draw codeperp(C,D,A,5);
+ draw codeperp(D,A,B,5);
+ marque_s:=marque_s/3;
+ draw Codelongueur(A,B,C,D,2);
+ draw Codelongueur(A,D,C,B,5);
+ marque_s:=marque_s*3;
+ draw appelation(A,B,-3mm,btex $L$ etex);
+ label.lft(btex $\ell$ etex,iso(A,D));
+ \end{mplibcode}
+ \else
+ \begin{mpost}[mpsettings={input PfC-Geometrie;}]
+ pair A,B,C,D;
+ A=u*(1,1);
+ B-A=u*(3,0);
+ C=2/3[B,rotation(A,B,-90)];
+ D-C=A-B;
+ draw polygone(A,B,C,D);
+ draw codeperp(A,B,C,5);
+ draw codeperp(B,C,D,5);
+ draw codeperp(C,D,A,5);
+ draw codeperp(D,A,B,5);
+ marque_s:=marque_s/3;
+ draw Codelongueur(A,B,C,D,2);
+ draw Codelongueur(A,D,C,B,5);
+ marque_s:=marque_s*3;
+ draw appelation(A,B,-3mm,btex $L$ etex);
+ label.lft(btex $\ell$ etex,iso(A,D));
+ \end{mpost}
+ \fi
+}
+
+\def\MPFigureTriangle{%
+ \ifluatex
+ \mplibforcehmode
+ \begin{mplibcode}
+ drawoptions( dashed dashpattern(on1cm));
+ Figure(-5u,-5u,5u,5u);
+ pair A,B,C;
+ A=u*(1,1);
+ B-A=u*(3,0);
+ C=demidroite(A,rotation(B,A,60)) intersectionpoint demidroite(B,rotation(A,B,-45));
+ draw polygone(A,B,C);
+ \end{mplibcode}
+ \else
+ \begin{mpost}[mpsettings={input PfC-Geometrie;}]
+ Figure(-5u,-5u,5u,5u);
+ pair A,B,C;
+ A=u*(1,1);
+ B-A=u*(3,0);
+ C=demidroite(A,rotation(B,A,60)) intersectionpoint demidroite(B,rotation(A,B,-45));
+ draw polygone(A,B,C);
+ \end{mpost}
+ \fi
+}
+
+\def\MPFigureCercle{%
+ \ifluatex
+ \mplibforcehmode
+ \begin{mplibcode}
+ drawoptions( dashed dashpattern(on1cm));
+ Figure(-5u,-5u,5u,5u);
+ pair A,B,C;
+ A=u*(2.5,2.5);
+ path cc;
+ cc=cercles(A,1.25u);
+ B=pointarc(cc,195);
+ C=symetrie(B,A);
+ draw cc withcolor gris;
+ draw segment(B,C);
+ marque_p:="croix";
+ pointe(A);
+ draw appelation(B,C,3mm,\btex diamètre etex);
+ \end{mplibcode}
+ \else
+ \begin{mpost}[mpsettings={input PfC-Geometrie;}]
+ Figure(-5u,-5u,5u,5u);
+ pair A,B,C;
+ A=u*(2.5,2.5);
+ path cc;
+ cc=cercles(A,1.25u);
+ B=pointarc(cc,195);
+ C=symetrie(B,A);
+ draw cc withcolor gris;
+ draw segment(B,C);
+ marque_p:="croix";
+ pointe(A);
+ draw appelation(B,C,3mm,\btex diamètre etex);
+ \end{mpost}
+ \fi
+}
+
+\def\MPFigureDisque{%
+ \ifluatex
+ \mplibforcehmode
+ \begin{mplibcode}
+ drawoptions( dashed dashpattern(on1cm));
+ Figure(-5u,-5u,5u,5u);
+ pair A,B,C;
+ A=u*(2.5,2.5);
+ path cc;
+ cc=cercles(A,1.25u);
+ B=pointarc(cc,195);
+ C=symetrie(B,A);
+ draw cc withcolor gris;
+ draw segment(A,C);
+ marque_p:="croix";
+ pointe(A);
+ draw appelation(A,C,3mm,\btex rayon $r$ etex);
+ \end{mplibcode}
+ \else
+ \begin{mpost}[mpsettings={input PfC-Geometrie;}]
+ Figure(-5u,-5u,5u,5u);
+ pair A,B,C;
+ A=u*(2.5,2.5);
+ path cc;
+ cc=cercles(A,1.25u);
+ B=pointarc(cc,195);
+ C=symetrie(B,A);
+ draw cc withcolor gris;
+ draw segment(A,C);
+ marque_p:="croix";
+ pointe(A);
+ draw appelation(A,C,3mm,\btex rayon $r$ etex);
+ \end{mpost}
+ \fi
+}
+
+\def\MPFigureTriangleAire{%
+ \ifluatex
+ \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);
+ C=demidroite(A,rotation(B,A,60)) intersectionpoint demidroite(B,rotation(A,B,-45));
+ H=projection(C,A,B);
+ I=projection(A,B,C);
+ J=projection(B,C,A);
+ draw polygone(A,B,C) withcolor gris;
+ drawoptions();
+ draw segment(C,H);
+ draw segment(A,B);
+ draw codeperp(C,H,B,5);
+ drawoptions();
+ A:=A+u*(2.5,0);
+ B:=A+u*(1.4,0);
+ C:=demidroite(A,rotation(B,A,60)) intersectionpoint demidroite(B,rotation(A,B,-45));
+ I:=projection(A,B,C);
+ J:=projection(B,C,A);
+ draw polygone(A,B,C) withcolor gris;
+ drawoptions();
+ draw segment(A,I);
+ draw segment(C,B);
+ draw codeperp(A,I,B,5);
+ drawoptions();
+ A:=A-u*(1.25,1);
+ B:=A+u*(1.4,0);
+ C:=demidroite(A,rotation(B,A,60)) intersectionpoint demidroite(B,rotation(A,B,-45));
+ J:=projection(B,C,A);
+ draw polygone(A,B,C) withcolor gris;
+ drawoptions();
+ draw segment(B,J);
+ draw segment(C,A);
+ draw codeperp(B,J,C,5);
+ drawoptions();
+ \end{mplibcode}
+ \else
+ \begin{mpost}[mpsettings={input PfC-Geometrie;}]
+ Figure(-5u,-5u,5u,5u);
+ pair A,B,C,H,I,J;
+ A=u*(0.5,1);
+ B-A=u*(1.4,0);
+ C=demidroite(A,rotation(B,A,60)) intersectionpoint demidroite(B,rotation(A,B,-45));
+ H=projection(C,A,B);
+ I=projection(A,B,C);
+ J=projection(B,C,A);
+ draw polygone(A,B,C) withcolor gris;
+ drawoptions();
+ draw segment(C,H);
+ draw segment(A,B);
+ draw codeperp(C,H,B,5);
+ drawoptions();
+ A:=A+u*(2.5,0);
+ B:=A+u*(1.4,0);
+ C:=demidroite(A,rotation(B,A,60)) intersectionpoint demidroite(B,rotation(A,B,-45));
+ I:=projection(A,B,C);
+ J:=projection(B,C,A);
+ draw polygone(A,B,C) withcolor gris;
+ drawoptions();
+ draw segment(A,I);
+ draw segment(C,B);
+ draw codeperp(A,I,B,5);
+ drawoptions();
+ A:=A-u*(1.25,1);
+ B:=A+u*(1.4,0);
+ C:=demidroite(A,rotation(B,A,60)) intersectionpoint demidroite(B,rotation(A,B,-45));
+ J:=projection(B,C,A);
+ draw polygone(A,B,C) withcolor gris;
+ drawoptions();
+ draw segment(B,J);
+ draw segment(C,A);
+ draw codeperp(B,J,C,5);
+ drawoptions();
+ \end{mpost}
+ \fi
+}
+
+\newcommand\Formule[1][]{%
+ \useKVdefault[ClesFormule]
+ \setKV[ClesFormule]{#1}
+ \setlength{\RoundedBoxWidth}{\useKV[ClesFormule]{Largeur}}
+ \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}%
+ \IfStrEqCase{\useKV[ClesFormule]{Surface}}{%
+ {carré}{\begin{center}
+ \MPFigureCarre\par
+ Périmètre d'un carré :\par$4\times c$
+ \end{center}}%
+ {polygone}{%
+ \begin{center}
+ \MPFigurePolygone\par
+ Périmètre d'un polygone : \par$\text{Somme des côtés}$
+ \end{center}
+ }%
+ {rectangle}{
+ \begin{center}
+ \MPFigureRectangle\par
+ Périmètre d'un rectangle : \par$2\times(L+\ell)$
+ \end{center}
+ }%
+ {losange}{%
+ \begin{center}
+ \MPFigureLosange\par
+ Périmètre d'un losange : \par$4\times c$
+ \end{center}
+ }%
+ {triangle}{%
+ \begin{center}
+ \MPFigureTriangle\par
+ Périmètre d'un triangle : \par Somme des côtés
+ \end{center}
+ }%
+ {cercle}{%
+ \begin{center}
+ \MPFigureCercle\par
+ Périmètre d'un cercle : \par$\pi\times\text{diamètre}$
+ \end{center}
+ }%
+ {parallélogramme}{
+ \begin{center}
+ \MPFigureParallelogramme\par
+ Périmètre d'un parallélogramme : \par Somme des côtés
+ \end{center}
+ }}
+ \end{minipage}};
+ \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}%
+ \IfStrEqCase{\useKV[ClesFormule]{Surface}}{%
+ {carré}{\begin{center}
+ \MPFigureCarre\par
+ Aire d'un carré :\par$c\times c$
+ \end{center}}%
+ {rectangle}{%
+ \begin{center}
+ \MPFigureRectangle\par
+ Aire d'un rectangle :\par$L\times\ell$
+ \end{center}
+ }%
+ {losange}{%
+ \begin{center}
+ \MPFigureLosangeAire\par
+ Aire d'un losange :\par$\dfrac{\text{grande diagonale}\times\text{petite diagonale}}{2}$
+ \end{center}
+ }%
+ {triangle}{%
+ \begin{center}
+ \MPFigureTriangleAire\par\vspace{1em}\par
+ Aire d'un triangle : $\displaystyle\frac{\text{côté}\times\text{hauteur relative à ce côté}}{2}$
+ \end{center}
+ }%
+ {disque}{%
+ \begin{center}
+ \MPFigureDisque\par
+ Aire d'un disque :\par$\pi\times r\times r$
+ \end{center}
+ }%
+ {parallélogramme}{%
+ \begin{center}
+ \MPFigureParallelogrammeAire\par
+ Aire d'un parallélogramme : $\text{côté}\times\text{hauteur relative à ce côté}$
+ \end{center}
+ }
+ {sphère}{%
+ \begin{center}
+ \MPFigureSphere\par
+ Aire d'une sphère : $4\times\pi\times r^2$
+ \end{center}
+ }}
+ \end{minipage}};
+ \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}%
+ \IfStrEqCase{\useKV[ClesFormule]{Solide}}{%
+ {boule}{\begin{center}
+ \MPFigureSphere\par
+ Volume d'une boule : $\dfrac{4\times\pi\times r^3}{3}$
+ \end{center}}%
+ {cube}{%
+ \begin{center}
+ \MPFigureCube\par
+ Volume d'une cube : $a^3\quad(a\times a\times a)$
+ \end{center}
+ }%
+ {pavé}{%
+ \begin{center}
+ \MPFigurePave\par
+ Volume d'un pavé droit : $\ell\times h\times p$
+ \end{center}
+ }
+ {prisme}{%
+ \begin{center}
+ \MPFigurePrisme\par
+ Volume d'un prisme droit : $\text{Aire de la base}\times\mbox{hauteur}$
+ \end{center}
+ }
+ {cylindre}{%
+ \begin{center}
+ \MPFigureCylindre\par
+ Volume d'un cylindre de révolution : $\pi\times r^2\times h$
+ \end{center}
+ }
+ {pyramide}{%
+ \begin{center}
+ \MPFigurePyramide\par
+ Volume d'une pyramide : $\dfrac{\text{Aire de la base}\times\text{hauteur}}{3}$
+ \end{center}
+ }
+ {cône}{%
+ \begin{center}
+ \MPFigureCone\par
+ Volume d'un cône de révolution : $\displaystyle\dfrac{\pi\times r^2\times h}{3}$
+ \end{center}
+ }
+ }
+ \end{minipage}};
+ \end{tikzpicture}
+ }
+ }
+}
+
+%%%%%%%%%%
+%%% Proba
+%%%%%%%%%%
+\setKVdefault[ClesProba]{Echelle=false,Arbre=false,Branche=2,Angle=60,Rayon=0.25,LongueurEchelle=5,Affichage=0,Grille=0}
+
+\def\Updatetoksproba#1/#2\nil{\addtotok\toklistepointproba{"#1","\footnotesize #2",}}
+\def\Updatetoksprobaechelle#1/#2/#3\nil{\addtotok\toklistepointproba{#1,#2,"#3",}}
+
+\newtoks\toklistepointproba
+
+% Pour construire l'arbre de probabilité
+\def\buildarbreproba{%
+ \toklistepointproba{}%
+ \foreachitem\compteur\in\ListeProba{\expandafter\Updatetoksproba\compteur\nil}%
+ \MPArbreProba{\useKV[ClesProba]{Branche}}{\useKV[ClesProba]{Angle}}{\the\toklistepointproba}{\useKV[ClesProba]{Rayon}}%
+}
+
+% Pour construire l'échelle de probabilité
+\def\buildechelleproba{%
+ \toklistepointproba{}%
+ \foreachitem\compteur\in\ListeProba{\expandafter\Updatetoksprobaechelle\compteur\nil}%
+ \MPEchelleProbaUn{\useKV[ClesProba]{LongueurEchelle}}{\the\toklistepointproba}{\useKV[ClesProba]{Affichage}}{\useKV[ClesProba]{Grille}}%
+}
+
+\def\MPEchelleProbaUn#1#2#3#4{%
+ % #1:longueur du segment représentant l'échelle
+ % #2:Liste des évènements/proba
+ % #3: pour l'affichage des labels (0 : rien, 1: fleches, 2 : fleches+evènements, 3: fleches+proba, 4 : tout)
+ % #4 : dimension de "la grille" associée
+ \ifluatex
+ \begin{mplibcode}
+ pair A,B,C[],D[];%les noeuds de l'arbre
+ Figure(-10u,-10u,10u,10u);
+ A=u*(1,1);
+ B-A=u*(#1,0);
+ draw segment(A,B);
+ draw marquesegment(A,B);
+ marque_s:=marque_s/2;
+ if #4>1:
+ for k=0 upto (#4-1):
+ D[k]=(k/#4)[A,B];
+ endfor;
+ if (#4 mod 2)=0:
+ for k=0 step 2 until (#4-1):
+ draw marquesegment(D[k],D[k+1]);
+ endfor;
+ else:
+ for k=1 step 2 until (#4-1):
+ draw marquesegment(D[k],D[k+1]);
+ endfor;
+ fi;
+ fi;
+ marque_s:=marque_s*2;
+ labeloffset:=labeloffset*3;
+ label.bot(btex 0 etex,A);
+ label.bot(btex 1 etex,B);
+ labeloffset:=labeloffset/3;
+ n:=1;%compter les informations
+ k:=1;% compter les informations noeud pour les placer
+ vardef toto(text t)=
+ for p_=t:
+ if (n mod 3)=1:
+ num:=p_;
+ fi;
+ if (n mod 3)=2:
+ deno:=p_;
+ fi;
+ if (n mod 3=0):
+ C[k]=(num/deno)[A,B];
+ if (#3>0):
+ drawarrow (C[k]-u*(0,0.5))--(C[k]-u*(0,0.15));
+ fi;
+ if (#3=2) or (#3=4):
+ dotlabel.top(TEX(p_),C[k]);
+ fi;
+ if (#3=1) or (#3=3):
+ 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.
+ fi;
+ k:=k+1;
+ fi;
+ n:=n+1;
+ endfor;
+ enddef;
+ toto(#2);
+ \end{mplibcode}
+ \else
+ \begin{mpost}[mpsettings={input PfC-Geometrie;}]
+ pair A,B,C[],D[];%les noeuds de l'arbre
+ Figure(-10u,-10u,10u,10u);
+ A=u*(1,1);
+ B-A=u*(#1,0);
+ draw segment(A,B);
+ draw marquesegment(A,B);
+ marque_s:=marque_s/2;
+ if #4>1:
+ for k=0 upto (#4-1):
+ D[k]=(k/#4)[A,B];
+ endfor;
+ if (#4 mod 2)=0:
+ for k=0 step 2 until (#4-1):
+ draw marquesegment(D[k],D[k+1]);
+ endfor;
+ else:
+ for k=1 step 2 until (#4-1):
+ draw marquesegment(D[k],D[k+1]);
+ endfor;
+ fi;
+ fi;
+ marque_s:=marque_s*2;
+ labeloffset:=labeloffset*3;
+ label.bot(btex 0 etex,A);
+ label.bot(btex 1 etex,B);
+ labeloffset:=labeloffset/3;
+ n:=1;%compter les informations
+ k:=1;% compter les informations noeud pour les placer
+ vardef toto(text t)=
+ for p_=t:
+ if (n mod 3)=1:
+ num:=p_;
+ fi;
+ if (n mod 3)=2:
+ deno:=p_;
+ fi;
+ if (n mod 3=0):
+ C[k]=(num/deno)[A,B];
+ if (#3>0):
+ drawarrow (C[k]-u*(0,0.5))--(C[k]-u*(0,0.15));
+ fi;
+ if (#3=2) or (#3=4):
+ dotlabel.top(LATEX(p_),C[k]);
+ fi;
+ if (#3=1) or (#3=3):
+ dotlabel.top("",C[k]);
+ fi;
+ if (#3>2):
+ label.bot(LATEX("$\noexpand\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.
+ fi;
+ k:=k+1;
+ fi;
+ n:=n+1;
+ endfor;
+ enddef;
+ toto(#2);
+ \end{mpost}
+ \fi
+}
+
+\def\MPArbreProba#1#2#3#4{%
+ % #1:longueur d'une branche
+ % #2:angle entre deux branches de même origine
+ % #3:Liste des évènements/proba
+ \ifluatex
+ \begin{mplibcode}
+ pair A[],B[];%les noeuds de l'arbre
+ Figure(-10u,-10u,10u,10u);
+ A0=u*(1,1);
+ B0-A0=u*(#1,0);
+ A1=rotation(B0,A0,#2/2);
+ A2=rotation(B0,A0,-#2/2);
+ B1-A1=B0-A0;
+ A3=rotation(B1,A1,#2/3);
+ A4=rotation(B1,A1,-#2/3);
+ B2-A2=B0-A0;
+ A5=rotation(B2,A2,#2/3);
+ A6=rotation(B2,A2,-#2/3);
+ draw segment(A4,A1);
+ draw segment(A5,A2);
+ draw chemin(A3,A1,A0,A2,A6);
+ for k=1 upto 6:
+ fill cercles(A[k],#4*cm) withcolor white;
+ endfor;
+ n:=1;%compter les informations
+ k:=1;% compter les informations noeud pour les placer
+ l:=1;% compter les informations "numériques"
+ vardef toto(text t)=
+ for p_=t:
+ if (n mod 2)=1:
+ if p_<>"":
+ label(TEX(p_),A[k]);
+ fi;
+ k:=k+1;
+ else:
+ if (l mod 2)=1:
+ if p_<>"":
+ draw appelation(A[(l-1) div 2],A[l],4mm,TEX(p_));
+ fi;
+ else:
+ if p_<>"":
+ draw appelation(A[(l-1) div 2],A[l],-4mm,TEX(p_));
+ fi;
+ fi;
+ l:=l+1;
+ fi;
+ n:=n+1;
+ endfor;
+ enddef;
+ toto(#3);
+ \end{mplibcode}
+ \else
+ \begin{mpost}[mpsettings={input PfC-Geometrie;}]
+ pair A[],B[];%les noeuds de l'arbre
+ Figure(-10u,-10u,10u,10u);
+ A0=u*(1,1);
+ B0-A0=u*(#1,0);
+ A1=rotation(B0,A0,#2/2);
+ A2=rotation(B0,A0,-#2/2);
+ B1-A1=B0-A0;
+ A3=rotation(B1,A1,#2/3);
+ A4=rotation(B1,A1,-#2/3);
+ B2-A2=B0-A0;
+ A5=rotation(B2,A2,#2/3);
+ A6=rotation(B2,A2,-#2/3);
+ draw segment(A4,A1);
+ draw segment(A5,A2);
+ draw chemin(A3,A1,A0,A2,A6);
+ for k=1 upto 6:
+ fill cercles(A[k],#4*cm) withcolor white;
+ endfor;
+ n:=1;%compter les informations
+ k:=1;% compter les informations noeud pour les placer
+ l:=1;% compter les informations "numériques"
+ vardef toto(text t)=
+ for p_=t:
+ if (n mod 2)=1:
+ label(LATEX(p_),A[k]);
+ k:=k+1;
+ else:
+ if (l mod 2)=1:
+ draw appelation(A[(l-1) div 2],A[l],4mm,LATEX(p_));
+ else:
+ draw appelation(A[(l-1) div 2],A[l],-4mm,LATEX(p_));
+ fi;
+ l:=l+1;
+ fi;
+ n:=n+1;
+ endfor;
+ enddef;
+ toto(#3);
+ \end{mpost}
+ \fi
+}
+
+\newcommand\Proba[2][]{%
+ \useKVdefault[ClesProba]%
+ \setKV[ClesProba]{#1}%
+ % On liste les différents éléments sous la forme Evènement/proba
+ \setsepchar[*]{,*/}\ignoreemptyitems%
+ \readlist*\ListeProba{#2}
+ \ifboolKV[ClesProba]{Echelle}{%
+ \buildechelleproba%
+ }{\ifboolKV[ClesProba]{Arbre}{%
+ \buildarbreproba%
+ }{}
+ }
+}
+
+%%%%%%%%%%%%%%
+%%%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}
+% ValeurOrigine permet de faire des morceaux de demi-droite graduée en passant par droite :)
+
+\def\Updatetoksdroite#1/#2\nil{\addtotok\toklistepointdroite{#1,"#2",}}
+\def\Updatetoksrepere#1/#2/#3\nil{\addtotok\toklistepointrepere{#1,#2,"#3",}}
+\def\Updatetoksespace#1/#2/#3/#4\nil{\addtotok\toklistepointespace{#1,#2,#3,"#4",}}
+
+\newtoks\toklistepointrepere
+\newtoks\toklistepointdroite
+\newtoks\toklistepointespace
+
+% Pour construire le repère de l'espace
+\def\buildespace{%
+ \toklistepointespace{}%
+ \ifboolKV[ClesReperage]{Sphere}{%
+ \foreachitem\compteur\in\ListePointEspace{\expandafter\Updatetoksrepere\compteur\nil}%
+ }{%
+ \foreachitem\compteur\in\ListePointEspace{\expandafter\Updatetoksespace\compteur\nil}%
+ }
+ \ifboolKV[ClesReperage]{AffichageNom}{%
+ \ifboolKV[ClesReperage]{AffichageCoord}{%
+ \[\MPEspacePave{\useKV[ClesReperage]{Unitex}}{\useKV[ClesReperage]{Pasx}}{\useKV[ClesReperage]{Unitey}}{\useKV[ClesReperage]{Pasy}}{\useKV[ClesReperage]{Unitez}}{\useKV[ClesReperage]{Pasz}}{\the\toklistepointespace}{3}{\useKV[ClesReperage]{EchelleEspace}}\]%
+ }{%
+ \[\MPEspacePave{\useKV[ClesReperage]{Unitex}}{\useKV[ClesReperage]{Pasx}}{\useKV[ClesReperage]{Unitey}}{\useKV[ClesReperage]{Pasy}}{\useKV[ClesReperage]{Unitez}}{\useKV[ClesReperage]{Pasz}}{\the\toklistepointespace}{2}{\useKV[ClesReperage]{EchelleEspace}}\]%
+ }
+ }{%
+ \ifboolKV[ClesReperage]{AffichageCoord}{%
+ \[\MPEspacePave{\useKV[ClesReperage]{Unitex}}{\useKV[ClesReperage]{Pasx}}{\useKV[ClesReperage]{Unitey}}{\useKV[ClesReperage]{Pasy}}{\useKV[ClesReperage]{Unitez}}{\useKV[ClesReperage]{Pasz}}{\the\toklistepointespace}{1}{\useKV[ClesReperage]{EchelleEspace}}\]%
+ }{%
+ \[\MPEspacePave{\useKV[ClesReperage]{Unitex}}{\useKV[ClesReperage]{Pasx}}{\useKV[ClesReperage]{Unitey}}{\useKV[ClesReperage]{Pasy}}{\useKV[ClesReperage]{Unitez}}{\useKV[ClesReperage]{Pasz}}{\the\toklistepointespace}{0}{\useKV[ClesReperage]{EchelleEspace}}\]%
+ }
+ }%
+}%
+
+\def\MPEspacePave#1#2#3#4#5#6#7#8#9{%
+ \ifluatex
+ \begin{mplibcode}
+ typetrace:="3D";
+ typerepre:="persp";
+ Figure(-20u,-20u,20u,20u);
+ Initialisation(1500,30,20,abs(#9));
+ %marque_r:=marque_r/2;
+ marque_p:="plein";
+ color A,B,C,D,E,F,G,H,M[],N[];
+ draw Pave(A,B,C,D,E,F,G,H)(#1,#3,#5);
+ if #9>0:
+ drawarrow Projette(A)--Projette(1.5[D,A]);
+ drawarrow Projette(C)--Projette(1.5[D,C]);
+ drawarrow Projette(E)--Projette(1.5[D,E]);
+ label.ulft(btex 1 etex,Projette((1/#2)[D,A]));
+ label.bot(btex 1 etex,Projette((1/#4)[D,C]));
+ label.lft(btex 1 etex,Projette((1/#6)[D,E]));
+ for k=1 upto (#2):
+ pointe((k/#2)[D,A]);
+ endfor;
+ for k=1 upto (#4):
+ pointe((k/#4)[D,C]);
+ endfor;
+ for k=1 upto (#6):
+ pointe((k/#6)[D,E]);
+ endfor;
+ else:
+ drawarrow Projette(D)--Projette(1.5[A,D]) dashed evenly;
+ drawarrow Projette(B)--Projette(1.5[A,B]);
+ drawarrow Projette(F)--Projette(1.5[A,F]);
+ label.ulft(btex 1 etex,Projette((1/#2)[A,D]));
+ label.bot(btex 1 etex,Projette((1/#4)[A,B]));
+ label.lft(btex 1 etex,Projette((1/#6)[A,F]));
+ for k=1 upto (#2):
+ pointe((k/#2)[A,D]);
+ endfor;
+ for k=1 upto (#4):
+ pointe((k/#4)[A,B]);
+ endfor;
+ for k=1 upto (#6):
+ pointe((k/#6)[A,F]);
+ endfor;
+ fi;
+ vardef tata(text t)=
+ n:=1;%pour compter combien de points
+ k:=0;%pour garder l'abscisse
+ l:=0;%pour garder l'ordonnée
+ m:=0;%pour garder l'altitude
+ if #8>0:
+ for p_=t:
+ if (n mod 4)=1:
+ k:=p_;
+ fi;
+ if (n mod 4)=2:
+ l:=p_;
+ fi;
+ if (n mod 4)=3:
+ m:=p_;
+ fi;
+ if (n mod 4)=0:
+ M[n]=(k/#2)[D,A]+(l/#4)*(C-D)+(m/#6)*(E-D);
+ N[n]=(k/#2)[D,A]+(l/#4)*(C-D);
+ if (#8>1):
+ label.top(TEX(p_),Projette(M[n]));
+ pointe(M[n]);
+ fi;
+ if (#8=1) or (#8=3) :
+ drawoptions(dashed evenly withcolor gris);
+ draw segment(M[n],(0,0,bluepart(M[n])));
+ draw segment(M[n],N[n]);
+ draw segment(N[n],(redpart(M[n]),0,0));
+ draw segment(N[n],(0,greenpart(M[n]),0));
+ drawoptions();
+ fi;
+ fi;
+ n:=n+1;
+ endfor;
+ fi;
+ enddef;
+ vardef toto(text t)=
+ n:=1;%pour compter combien de points
+ k:=0;%pour garder l'abscisse
+ l:=0;%pour garder l'ordonnée
+ m:=0;%pour garder l'altitude
+ if #8>0:
+ for p_=t:
+ if (n mod 4)=1:
+ k:=p_;
+ fi;
+ if (n mod 4)=2:
+ l:=p_;
+ fi;
+ if (n mod 4)=3:
+ m:=p_;
+ fi;
+ if (n mod 4)=0:
+ % message("je suis ici : "&p_);
+ M[n]=(k/#2)[A,D]+(l/#4)*(B-A)+(m/#6)*(F-A);
+ N[n]=(k/#2)[A,D]+(l/#4)*(B-A);
+ if (#8>1):
+ label.top(TEX(p_),Projette(M[n]));
+ pointe(M[n]);
+ fi;
+ if (#8=1) or (#8=3) :
+ drawoptions(dashed evenly withcolor gris);
+ draw segment(M[n],A+(0,0,bluepart(M[n])));
+ draw segment(M[n],N[n]);
+ draw segment(N[n],A+(l/#4)*(B-A));
+ draw segment(N[n],A+(k/#2)*(D-A));
+ drawoptions();
+ fi;
+ fi;
+ n:=n+1;
+ endfor;
+ fi;
+ enddef;
+ if #9>0:
+ tata(#7);
+ else:
+ toto(#7);
+ fi;
+ draw Pave(A,B,C,D,E,F,G,H)(#1,#3,#5);
+ \end{mplibcode}
+ \else
+ \begin{mpost}[mpsettings={input PfC-Geometrie;}]
+ typetrace:="3D";
+ typerepre:="persp";
+ Figure(-20u,-20u,20u,20u);
+ Initialisation(1500,30,20,abs(#9));
+ %marque_r:=marque_r/2;
+ marque_p:="plein";
+ color A,B,C,D,E,F,G,H,M[],N[];
+ draw Pave(A,B,C,D,E,F,G,H)(#1,#3,#5);
+ if #9>0:
+ drawarrow Projette(A)--Projette(1.5[D,A]);
+ drawarrow Projette(C)--Projette(1.5[D,C]);
+ drawarrow Projette(E)--Projette(1.5[D,E]);
+ label.ulft(btex 1 etex,Projette((1/#2)[D,A]));
+ label.bot(btex 1 etex,Projette((1/#4)[D,C]));
+ label.lft(btex 1 etex,Projette((1/#6)[D,E]));
+ for k=1 upto (#2):
+ pointe((k/#2)[D,A]);
+ endfor;
+ for k=1 upto (#4):
+ pointe((k/#4)[D,C]);
+ endfor;
+ for k=1 upto (#6):
+ pointe((k/#6)[D,E]);
+ endfor;
+ else:
+ drawarrow Projette(D)--Projette(1.5[A,D]) dashed evenly;
+ drawarrow Projette(B)--Projette(1.5[A,B]);
+ drawarrow Projette(F)--Projette(1.5[A,F]);
+ label.ulft(btex 1 etex,Projette((1/#2)[A,D]));
+ label.bot(btex 1 etex,Projette((1/#4)[A,B]));
+ label.lft(btex 1 etex,Projette((1/#6)[A,F]));
+ for k=1 upto (#2):
+ pointe((k/#2)[A,D]);
+ endfor;
+ for k=1 upto (#4):
+ pointe((k/#4)[A,B]);
+ endfor;
+ for k=1 upto (#6):
+ pointe((k/#6)[A,F]);
+ endfor;
+ fi;
+ vardef tata(text t)=
+ n:=1;%pour compter combien de points
+ k:=0;%pour garder l'abscisse
+ l:=0;%pour garder l'ordonnée
+ m:=0;%pour garder l'altitude
+ if #8>0:
+ for p_=t:
+ if (n mod 4)=1:
+ k:=p_;
+ fi;
+ if (n mod 4)=2:
+ l:=p_;
+ fi;
+ if (n mod 4)=3:
+ m:=p_;
+ fi;
+ if (n mod 4)=0:
+ M[n]=(k/#2)[D,A]+(l/#4)*(C-D)+(m/#6)*(E-D);
+ N[n]=(k/#2)[D,A]+(l/#4)*(C-D);
+ if (#8>1):
+ label.top(LATEX(p_),Projette(M[n]));
+ pointe(M[n]);
+ fi;
+ if (#8=1) or (#8=3) :
+ drawoptions(dashed evenly withcolor gris);
+ draw segment(M[n],(0,0,bluepart(M[n])));
+ draw segment(M[n],N[n]);
+ draw segment(N[n],(redpart(M[n]),0,0));
+ draw segment(N[n],(0,greenpart(M[n]),0));
+ drawoptions();
+ fi;
+ fi;
+ n:=n+1;
+ endfor;
+ fi;
+ enddef;
+ vardef toto(text t)=
+ n:=1;%pour compter combien de points
+ k:=0;%pour garder l'abscisse
+ l:=0;%pour garder l'ordonnée
+ m:=0;%pour garder l'altitude
+ if #8>0:
+ for p_=t:
+ if (n mod 4)=1:
+ k:=p_;
+ fi;
+ if (n mod 4)=2:
+ l:=p_;
+ fi;
+ if (n mod 4)=3:
+ m:=p_;
+ fi;
+ if (n mod 4)=0:
+ % message("je suis ici : "&p_);
+ M[n]=(k/#2)[A,D]+(l/#4)*(B-A)+(m/#6)*(F-A);
+ N[n]=(k/#2)[A,D]+(l/#4)*(B-A);
+ if (#8>1):
+ label.top(LATEX(p_),Projette(M[n]));
+ pointe(M[n]);
+ fi;
+ if (#8=1) or (#8=3) :
+ drawoptions(dashed evenly withcolor gris);
+ draw segment(M[n],A+(0,0,bluepart(M[n])));
+ draw segment(M[n],N[n]);
+ draw segment(N[n],A+(l/#4)*(B-A));
+ draw segment(N[n],A+(k/#2)*(D-A));
+ drawoptions();
+ fi;
+ fi;
+ n:=n+1;
+ endfor;
+ fi;
+ enddef;
+ if #9>0:
+ tata(#7);
+ else:
+ toto(#7);
+ fi;
+ draw Pave(A,B,C,D,E,F,G,H)(#1,#3,#5);
+ \end{mpost}
+ \fi
+}%
+
+% Pour construire le repère du plan
+\def\buildrepere{%
+ \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}}\]%
+ }
+ }%
+ }%
+}
+
+\def\MPPlan#1#2#3#4#5#6#7#8{%
+ \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)=
+ for p_=t:
+ if (n mod 3)=1:
+ if p_>maxx:
+ maxx:=p_;
+ fi;
+ if p_<minx:
+ minx:=p_;
+ fi;
+ fi;
+ if (n mod 3)=2:
+ if p_>maxy:
+ maxy:=p_;
+ fi;
+ if p_<miny:
+ miny:=p_;
+ fi;
+ fi;
+ n:=n+1;
+ endfor;
+ maxx:=maxx+1;
+ minx:=minx-1;
+ if maxx<(#2+1):
+ maxx:=#2+1;
+ fi;
+ if minx>(-#2-1):
+ minx:=-#2-1;
+ fi;
+ maxy:=maxy+1;
+ miny:=miny-1;
+ if maxy<(#4+1):
+ maxy:=#2+1;
+ fi;
+ if miny>(-#4-1):
+ miny:=-#4-1;
+ fi;
+ enddef;
+ toto(#5);
+ Figure((minx-1)*unitpx,(miny-1)*unitpy,(maxx+1)*unitpx,(maxy+1)*unitpy);
+ pair A,B,C,D,E;
+ A=(0,0);
+ B=(minx*unitpx,0);
+ C=(maxx*unitpx,0);
+ D=(0,miny*unitpy);
+ E=(0,maxy*unitpy);
+ for k=0 upto (maxx-minx):
+ draw ((xpart(B),ypart(D)-0.75*unitpy)--(xpart(B),ypart(E)+0.75*unitpy)) shifted (k*unitpx,0) withcolor gris;
+ endfor;
+ for k=0 upto (maxy-miny):
+ draw ((xpart(B)-0.75*unitpx,ypart(D))--(xpart(C)+0.75*unitpx,ypart(D))) shifted (0,k*unitpy) withcolor gris;
+ 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);
+ % 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:
+ 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 #6>1:
+ message("p = "&p_);
+ % 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.ulft(TEX(p_),(k*unitpx,l*unitpy));
+ fi;
+ if (k=0) and (l<0):
+ label.llft(TEX(p_),(k*unitpx,l*unitpy));
+ fi;
+ if (k<0) and (l<0):
+ label.llft(TEX(p_),(k*unitpx,l*unitpy));
+ fi;
+ if (k<0) and (l=0):
+ label.llft(TEX(p_),(k*unitpx,l*unitpy));
+ fi;
+ if (k>0) and (l<0):
+ label.lrt(TEX(p_),(k*unitpx,l*unitpy));
+ fi;
+ pointe((k*unitpx,l*unitpy));
+ % fi;
+ fi;
+ if (#6=1) or (#6=3):
+ draw (0,l*unitpy)--(k*unitpx,l*unitpy)--(k*unitpx,0) dashed evenly;
+ fi;
+ fi;
+ n:=n+1;
+ endfor;
+ fi;
+ enddef;
+ tata(#5);
+ \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)=
+ for p_=t:
+ if (n mod 3)=1:
+ if p_>maxx:
+ maxx:=p_;
+ fi;
+ if p_<minx:
+ minx:=p_;
+ fi;
+ fi;
+ if (n mod 3)=2:
+ if p_>maxy:
+ maxy:=p_;
+ fi;
+ if p_<miny:
+ miny:=p_;
+ fi;
+ fi;
+ n:=n+1;
+ endfor;
+ maxx:=maxx+1;
+ minx:=minx-1;
+ if maxx<(#2+1):
+ maxx:=#2+1;
+ fi;
+ if minx>(-#2-1):
+ minx:=-#2-1;
+ fi;
+ maxy:=maxy+1;
+ miny:=miny-1;
+ if maxy<(#4+1):
+ maxy:=#2+1;
+ fi;
+ if miny>(-#4-1):
+ miny:=-#4-1;
+ fi;
+ enddef;
+ toto(#5);
+ Figure((minx-1)*unitpx,(miny-1)*unitpy,(maxx+1)*unitpx,(maxy+1)*unitpy);
+ pair A,B,C,D,E;
+ A=(0,0);
+ B=(minx*unitpx,0);
+ C=(maxx*unitpx,0);
+ D=(0,miny*unitpy);
+ E=(0,maxy*unitpy);
+ for k=0 upto (maxx-minx):
+ draw ((xpart(B),ypart(D)-0.75*unitpy)--(xpart(B),ypart(E)+0.75*unitpy)) shifted (k*unitpx,0) withcolor gris;
+ endfor;
+ for k=0 upto (maxy-miny):
+ draw ((xpart(B)-0.75*unitpx,ypart(D))--(xpart(C)+0.75*unitpx,ypart(D))) shifted (0,k*unitpy) withcolor gris;
+ 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);
+ % 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:
+ 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 #6>1:
+ if (k>0) and (l>0):
+ label.urt(LATEX(p_),(k*unitpx,l*unitpy));
+ fi;
+ if (k=0) and (l>0):
+ label.urt(LATEX(p_),(k*unitpx,l*unitpy));
+ fi;
+ if (k>0) and (l=0):
+ label.urt(LATEX(p_),(k*unitpx,l*unitpy));
+ fi;
+ if (k<0) and (l>0):
+ label.ulft(LATEX(p_),(k*unitpx,l*unitpy));
+ fi;
+ if (k=0) and (l<0):
+ label.llft(LATEX(p_),(k*unitpx,l*unitpy));
+ fi;
+ if (k<0) and (l<0):
+ label.llft(LATEX(p_),(k*unitpx,l*unitpy));
+ fi;
+ if (k<0) and (l=0):
+ label.llft(LATEX(p_),(k*unitpx,l*unitpy));
+ fi;
+ if (k>0) and (l<0):
+ label.lrt(LATEX(p_),(k*unitpx,l*unitpy));
+ fi;
+ pointe((k*unitpx,l*unitpy));
+ fi;
+ if (#6=1) or (#6=3):
+ draw (0,l*unitpy)--(k*unitpx,l*unitpy)--(k*unitpx,0) dashed evenly;
+ fi;
+ fi;
+ n:=n+1;
+ endfor;
+ fi;
+ enddef;
+ tata(#5);
+ \end{mpost}
+ \fi
+}
+
+\def\MPPlanTrace#1#2#3#4#5#6#7#8#9{%
+ \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)=
+ for p_=t:
+ if (n mod 3)=1:
+ if p_>maxx:
+ maxx:=p_;
+ fi;
+ if p_<minx:
+ minx:=p_;
+ fi;
+ fi;
+ if (n mod 3)=2:
+ if p_>maxy:
+ maxy:=p_;
+ fi;
+ if p_<miny:
+ miny:=p_;
+ fi;
+ fi;
+ n:=n+1;
+ endfor;
+ maxx:=maxx+1;
+ minx:=minx-1;
+ if maxx<(#2+1):
+ maxx:=#2+1;
+ fi;
+ if minx>(-#2-1):
+ minx:=-#2-1;
+ fi;
+ maxy:=maxy+1;
+ miny:=miny-1;
+ if maxy<(#4+1):
+ maxy:=#2+1;
+ fi;
+ if miny>(-#4-1):
+ miny:=-#4-1;
+ fi;
+ enddef;
+ toto(#5);
+ Figure((minx-1)*unitpx,(miny-1)*unitpy,(maxx+1)*unitpx,(maxy+1)*unitpy);
+ pair A,B,C,D,E;
+ A=(0,0);
+ B=(minx*unitpx,0);
+ C=(maxx*unitpx,0);
+ D=(0,miny*unitpy);
+ E=(0,maxy*unitpy);
+ for k=0 upto (maxx-minx):
+ draw ((xpart(B),ypart(D)-0.75*unitpy)--(xpart(B),ypart(E)+0.75*unitpy)) shifted (k*unitpx,0) withcolor gris;
+ endfor;
+ for k=0 upto (maxy-miny):
+ draw ((xpart(B)-0.75*unitpx,ypart(D))--(xpart(C)+0.75*unitpx,ypart(D))) shifted (0,k*unitpy) withcolor gris;
+ 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);
+ % 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:
+ 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 #6>1:
+ 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.ulft(TEX(p_),(k*unitpx,l*unitpy));
+ fi;
+ if (k=0) and (l<0):
+ label.llft(TEX(p_),(k*unitpx,l*unitpy));
+ fi;
+ if (k<0) and (l<0):
+ label.llft(TEX(p_),(k*unitpx,l*unitpy));
+ fi;
+ if (k<0) and (l=0):
+ label.llft(TEX(p_),(k*unitpx,l*unitpy));
+ fi;
+ if (k>0) and (l<0):
+ label.lrt(TEX(p_),(k*unitpx,l*unitpy));
+ fi;
+ pointe((k*unitpx,l*unitpy));
+ fi;
+ if (#6=1) or (#6=3):
+ draw (0,l*unitpy)--(k*unitpx,l*unitpy)--(k*unitpx,0) dashed evenly;
+ fi;
+ fi;
+ n:=n+1;
+ endfor;
+ fi;
+ enddef;
+ vardef Tracage(text t)(text ls)=%on trace les segments
+ pair A[];
+ n:=0;%pour parcourir la liste
+ m:=0;%pour lister les points par leur nombre
+ for p_=t:
+ n:=n+1;
+ if (n mod 3)=1:
+ k:=p_;
+ fi;
+ if (n mod 3)=2:
+ l:=p_;
+ fi;
+ if (n mod 3)=0:
+ m:=m+1;
+ A[m]=(k*unitpx,l*unitpy);
+ fi;
+ endfor;
+ for p_=ls:
+ draw segment(A[p_ div 10],A[p_ mod 10]);
+ endfor;
+ enddef;
+ tata(#5);
+ Tracage(#5)(#9);
+ \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)=
+ for p_=t:
+ if (n mod 3)=1:
+ if p_>maxx:
+ maxx:=p_;
+ fi;
+ if p_<minx:
+ minx:=p_;
+ fi;
+ fi;
+ if (n mod 3)=2:
+ if p_>maxy:
+ maxy:=p_;
+ fi;
+ if p_<miny:
+ miny:=p_;
+ fi;
+ fi;
+ n:=n+1;
+ endfor;
+ maxx:=maxx+1;
+ minx:=minx-1;
+ if maxx<(#2+1):
+ maxx:=#2+1;
+ fi;
+ if minx>(-#2-1):
+ minx:=-#2-1;
+ fi;
+ maxy:=maxy+1;
+ miny:=miny-1;
+ if maxy<(#4+1):
+ maxy:=#2+1;
+ fi;
+ if miny>(-#4-1):
+ miny:=-#4-1;
+ fi;
+ enddef;
+ toto(#5);
+ Figure((minx-1)*unitpx,(miny-1)*unitpy,(maxx+1)*unitpx,(maxy+1)*unitpy);
+ pair A,B,C,D,E;
+ A=(0,0);
+ B=(minx*unitpx,0);
+ C=(maxx*unitpx,0);
+ D=(0,miny*unitpy);
+ E=(0,maxy*unitpy);
+ for k=0 upto (maxx-minx):
+ draw ((xpart(B),ypart(D)-0.75*unitpy)--(xpart(B),ypart(E)+0.75*unitpy)) shifted (k*unitpx,0) withcolor gris;
+ endfor;
+ for k=0 upto (maxy-miny):
+ draw ((xpart(B)-0.75*unitpx,ypart(D))--(xpart(C)+0.75*unitpx,ypart(D))) shifted (0,k*unitpy) withcolor gris;
+ 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);
+ % 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:
+ 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 #6>1:
+ if (k>0) and (l>0):
+ label.urt(LATEX(p_),(k*unitpx,l*unitpy));
+ fi;
+ if (k=0) and (l>0):
+ label.urt(LATEX(p_),(k*unitpx,l*unitpy));
+ fi;
+ if (k>0) and (l=0):
+ label.urt(LATEX(p_),(k*unitpx,l*unitpy));
+ fi;
+ if (k<0) and (l>0):
+ label.ulft(LATEX(p_),(k*unitpx,l*unitpy));
+ fi;
+ if (k=0) and (l<0):
+ label.llft(LATEX(p_),(k*unitpx,l*unitpy));
+ fi;
+ if (k<0) and (l<0):
+ label.llft(LATEX(p_),(k*unitpx,l*unitpy));
+ fi;
+ if (k<0) and (l=0):
+ label.llft(LATEX(p_),(k*unitpx,l*unitpy));
+ fi;
+ if (k>0) and (l<0):
+ label.lrt(LATEX(p_),(k*unitpx,l*unitpy));
+ fi;
+ pointe((k*unitpx,l*unitpy));
+ fi;
+ if (#6=1) or (#6=3):
+ draw (0,l*unitpy)--(k*unitpx,l*unitpy)--(k*unitpx,0) dashed evenly;
+ fi;
+ fi;
+ n:=n+1;
+ endfor;
+ fi;
+ enddef;
+ vardef Tracage(text t)(text ls)=%on trace les segments
+ pair A[];
+ n:=0;%pour parcourir la liste
+ m:=0;%pour lister les points par leur nombre
+ for p_=t:
+ n:=n+1;
+ if (n mod 3)=1:
+ k:=p_;
+ fi;
+ if (n mod 3)=2:
+ l:=p_;
+ fi;
+ if (n mod 3)=0:
+ m:=m+1;
+ A[m]=(k*unitpx,l*unitpy);
+ fi;
+ endfor;
+ for p_=ls:
+ draw segment(A[p_ div 10],A[p_ mod 10]);
+ endfor;
+ enddef;
+ tata(#5);
+ Tracage(#5)(#9);
+ \end{mpost}
+ \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
+ % #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é (ne sert à rien ici, mais en prévision
+ % de Droite)
+ \ifluatex
+ \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);
+ \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
+}
+
+\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é ?
+ \ifluatex
+ \begin{mplibcode}
+ maxx:=0;
+ minx:=4000;
+ 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;
+ 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;
+ enddef;
+ toto(#3);
+ Figure((minx-1)*u,-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));
+ 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;
+ m_c:=m_c*3;
+ marque_p:="croix";
+ dotlabel.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));
+ 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_:
+ if p_<>"":
+ label.top(TEX(p_),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;
+ minx:=4000;
+ 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;
+ 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;
+ enddef;
+ toto(#3);
+ Figure((minx-1)*u,-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));
+ 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;
+ 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));
+ 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_:
+ label.top(LATEX(p_),unitp*(k,0));
+ if p_<>"":
+ pointe(unitp*(k,0));
+ fi;
+ fi;
+ endfor;
+ fi;
+ enddef;
+ tata(#3);
+ \end{mpost}
+ \fi
+}
+
+\newcommand\Reperage[2][]{%
+ \useKVdefault[ClesReperage]%
+ \setKV[ClesReperage]{#1}%
+ \ifboolKV[ClesReperage]{Espace}{%
+ \setKV[ClesReperage]{Unitex=2,Unitey=2.5,Unitez=1.5}%
+ \setKV[ClesReperage]{#1}%
+ \setsepchar[*]{,*/}\ignoreemptyitems%
+ \readlist*\ListePointEspace{#2}%
+ \buildespace%
+ }{\ifboolKV[ClesReperage]{Plan}{%
+ \setsepchar[*]{,*/}\ignoreemptyitems%
+ \readlist*\ListePointRepere{#2}%
+ \buildrepere%
+ }{\ifboolKV[ClesReperage]{Droite}{%
+ \setsepchar[*]{,*/}\ignoreemptyitems%
+ \readlist*\ListePointDroite{#2}%
+ \builddemidroite%
+ }{%
+ \setsepchar[*]{,*/}\ignoreemptyitems%
+ \readlist*\ListePointDroite{#2}%
+ \builddemidroite%
+ }%
+ }%
+ }%
+}%
+
+
+%%%%%%%%
+%% Puissances
+%%%%%%
+\newcommand\Puissances[2]{%
+ \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}}}}%
+ }
+}
+
+%%%%%%%%%
+%% Tableaux d'unités
+%%%%%%%%%
+\setKVdefault[ClesTableaux]{Decimaux=false,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}
+
+\newcommand\Tableau[1][]{%
+ \useKVdefault[ClesTableaux]
+ \setKV[ClesTableaux]{#1}
+ \ifboolKV[ClesTableaux]{Decimaux}{%
+ \setlength{\tabcolsep}{0.01\tabcolsep}
+ \begin{center}
+ \begin{tabular}{|*{12}{>{\centering\arraybackslash}m{4.75em}|}>{\columncolor{gray!15},}{c}|*{3}{>{\centering\arraybackslash}m{4.75em}|}}
+ \ifboolKV[ClesTableaux]{Partie}{\multicolumn{12}{c}{\bfseries Partie Entière}&\multicolumn{1}{c}{\cellcolor{gray!15},}&\multicolumn{3}{c}{\bfseries Partie décimale}\\}{}
+ \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 des milliers}&\multicolumn{3}{c|}{\cellcolor{\useKV[ClesTableaux]{Couleuru}}Classe des unités}&&&&\\}{}
+ \hline
+ \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%
+ &\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%
+ &\fontsize{4.5}{4.5}\selectfont dizaines%
+ &\fontsize{4.5}{4.5}\selectfont unités%
+ &%
+ &\fontsize{4.5}{4.5}\selectfont dixièmes%
+ &\fontsize{4.5}{4.5}\selectfont centièmes%
+ &\fontsize{4.5}{4.5}\selectfont millièmes\\
+ \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}%
+ &\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}%
+ &\fontsize{4.5}{4.5}\selectfont \num{10}%
+ &\fontsize{4.5}{4.5}\selectfont \num{1}%
+ &%
+ &\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}}$%
+ \\
+ }{}
+ \hline
+ &&&&&&&&&&&&&&&\\
+ &&&&&&&&&&&&&&&\\
+ \end{tabular}
+ \end{center}
+ \setlength{\tabcolsep}{100\tabcolsep}
+ }{}
+ \ifboolKV[ClesTableaux]{Metre}{%
+ \[\renewcommand{\arraystretch}{1.15}%
+ \begin{tabular}{|*{7}{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);}}\\%
+ \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
+ &&&&&&\\
+ \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);}}%
+ &\multicolumn{1}{c}{\tikz[remember picture,overlay]{\coordinate[yshift=1em] (D1);}}%
+ &\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);}
+ }{}
+ }
+ {}
+ \ifboolKV[ClesTableaux]{Carre}{%
+ \[\renewcommand{\arraystretch}{1.15}\ifboolKV[ClesTableaux]{Colonnes}{\begin{tabular}{|*{7}{p{2.5mm}!{\color{gray!50}\vrule}p{2.5mm}|}}}{\begin{tabular}{|*{7}{p{2.5mm}p{2.5mm}|}}}
+\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);}}&%
+\multicolumn{2}{c}{\tikz[remember picture,overlay]{\coordinate
+ (D);}}&%
+\multicolumn{2}{c}{\tikz[remember picture,overlay]{\coordinate
+ (E);}}&%
+\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}{\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);}}&%
+\multicolumn{2}{c}{\tikz[remember picture,overlay]{\coordinate[yshift=0.6em]
+ (D1);}}&%
+\multicolumn{2}{c}{\tikz[remember picture,overlay]{\coordinate[yshift=0.6em]
+ (C1);}}&%
+\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);}
+}{}
+ }
+ {}
+ \ifboolKV[ClesTableaux]{Cube}{%
+ {\setlength{\tabcolsep}{0.625\tabcolsep}
+\[\renewcommand{\arraystretch}{1.15}\ifboolKV[ClesTableaux]{Colonnes}{\begin{tabular}{|*{7}{p{2.5mm}!{\color{gray!50}\vrule}p{2.5mm}!{\color{gray!50}\vrule}p{2.5mm}|}}}{\begin{tabular}{|*{7}{p{2.5mm}p{2.5mm}p{2.5mm}|}}}
+\multicolumn{3}{c}{\tikz[remember picture,overlay]{\coordinate (A);}}&%
+\multicolumn{3}{c}{\tikz[remember picture,overlay]{\coordinate
+ (B);}}&%
+\multicolumn{3}{c}{\tikz[remember picture,overlay]{\coordinate
+ (C);}}&%
+\multicolumn{3}{c}{\tikz[remember picture,overlay]{\coordinate
+ (D);}}&%
+\multicolumn{3}{c}{\tikz[remember picture,overlay]{\coordinate
+ (E);}}&%
+\multicolumn{3}{c}{\tikz[remember picture,overlay]{\coordinate
+ (F);}}&%
+\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$}\\
+\hline
+&&&&&&&&&&&&&&&&&&&&\\
+\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);}}&%
+\multicolumn{3}{c}{\tikz[remember picture,overlay,yshift=\ht\strutbox]{\coordinate
+ (D1);}}&%
+\multicolumn{3}{c}{\tikz[remember picture,overlay,yshift=\ht\strutbox]{\coordinate
+ (C1);}}&%
+\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);}
+}{}
+ }
+ {}
+ \ifboolKV[ClesTableaux]{Litre}{%
+ \[\renewcommand{\arraystretch}{1.15}\begin{tabular}{|*{7}{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);}}\\%
+\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}{\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);}}&%
+\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);}
+}{}
+ }
+ {}
+ \ifboolKV[ClesTableaux]{Gramme}{%
+ \[\renewcommand{\arraystretch}{1.15}\begin{tabular}{|*{7}{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);}}\\%
+\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
+&&&&&&\\
+\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);}}&%
+\multicolumn{1}{c}{\tikz[remember picture,overlay]{\coordinate[yshift=1em]
+ (D1);}}&%
+\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);}
+}{}%
+ }%
+ {}%
+}% \ No newline at end of file
diff --git a/Master/tlpkg/bin/tlpkg-ctan-check b/Master/tlpkg/bin/tlpkg-ctan-check
index fbb626c771b..96a72a4cf30 100755
--- a/Master/tlpkg/bin/tlpkg-ctan-check
+++ b/Master/tlpkg/bin/tlpkg-ctan-check
@@ -600,7 +600,7 @@ my @TLP_working = qw(
prelim2e preprint prerex present
pressrelease prettyref preview prftree
principia printlen proba probsoln procIAGssymp
- prodint productbox program
+ prodint productbox profcollege program
progress progressbar
proof-at-the-end proofread prooftrees proposal properties
prosper protex protocol prtec przechlewski-book
diff --git a/Master/tlpkg/libexec/ctan2tds b/Master/tlpkg/libexec/ctan2tds
index 30a16d0a4a1..a8ea6838022 100755
--- a/Master/tlpkg/libexec/ctan2tds
+++ b/Master/tlpkg/libexec/ctan2tds
@@ -1024,6 +1024,7 @@ chomp (my $ctan_root = `tlpkginfo --ctan-root`);
'presentations', "die 'skipping, author request'",
'presentations-en', "die 'skipping, author request'",
'preview-latex', "die 'skipping, use preview'",
+ 'profcollege', "&MAKEflatten",
'progkeys', "die 'skipping, noinfo license, author unfindable'",
'proofs', "die 'skipping, nosell license'",
'ps2eps', "die 'skipping, must go into sources'",
@@ -2092,6 +2093,7 @@ $standardtex
'pdfx', '\.(def|dfu|icc|xmp)$|(glyph|Profiles).*tex|pdfx\.sty|ICC_LIC',
'pdfxup', '(template\.tex|\.xup)$',
'petri-nets', 'pnets\.tex|pntext\.tex|\.sty|pndraw\.tex|pnversion\.tex|\.sty|pndraw\.tex',
+ 'profcollege', 'PfC-.*\.tex|' . $standardtex,
'pgf-blur', 'tikzlibraryshadows.blur.code.tex',
'pgf-spectra', 'spectra.data.tex|' . $standardtex,
'pgfmolbio', 'pgfmolbio\..*\.|' . $standardtex, # .lua+.tex submodules
diff --git a/Master/tlpkg/tlpsrc/collection-langfrench.tlpsrc b/Master/tlpkg/tlpsrc/collection-langfrench.tlpsrc
index 3ee50eaea95..93f83cf78d2 100644
--- a/Master/tlpkg/tlpsrc/collection-langfrench.tlpsrc
+++ b/Master/tlpkg/tlpsrc/collection-langfrench.tlpsrc
@@ -32,6 +32,7 @@ depend l2tabu-french
depend latex2e-help-texinfo-fr
depend lshort-french
depend mafr
+depend profcollege
depend tabvar
depend tdsfrmath
depend texlive-fr
diff --git a/Master/tlpkg/tlpsrc/profcollege.tlpsrc b/Master/tlpkg/tlpsrc/profcollege.tlpsrc
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/Master/tlpkg/tlpsrc/profcollege.tlpsrc