texlive[67545] Master/texmf-dist: profcollege (4jul23)

commits+karl at tug.org commits+karl at tug.org
Tue Jul 4 21:53:24 CEST 2023


Revision: 67545
          http://tug.org/svn/texlive?view=revision&revision=67545
Author:   karl
Date:     2023-07-04 21:53:24 +0200 (Tue, 04 Jul 2023)
Log Message:
-----------
profcollege (4jul23)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/profcollege/ProfCollege-doc.pdf
    trunk/Master/texmf-dist/doc/latex/profcollege/ProfCollege-doc.zip
    trunk/Master/texmf-dist/metapost/profcollege/PfCObjets.mp
    trunk/Master/texmf-dist/metapost/profcollege/PfCScratch.mp
    trunk/Master/texmf-dist/metapost/profcollege/PfCSolid.mp
    trunk/Master/texmf-dist/tex/latex/profcollege/PfCCartographie.tex
    trunk/Master/texmf-dist/tex/latex/profcollege/PfCDobble.tex
    trunk/Master/texmf-dist/tex/latex/profcollege/PfCEcrireunQCM.tex
    trunk/Master/texmf-dist/tex/latex/profcollege/PfCEcritureUnites.tex
    trunk/Master/texmf-dist/tex/latex/profcollege/PfCFonctionAffine.tex
    trunk/Master/texmf-dist/tex/latex/profcollege/PfCJeuRangement.tex
    trunk/Master/texmf-dist/tex/latex/profcollege/PfCMentalo.tex
    trunk/Master/texmf-dist/tex/latex/profcollege/PfCNonogramme.tex
    trunk/Master/texmf-dist/tex/latex/profcollege/PfCNotionFonction.tex
    trunk/Master/texmf-dist/tex/latex/profcollege/PfCPavage.tex
    trunk/Master/texmf-dist/tex/latex/profcollege/PfCPropor.tex
    trunk/Master/texmf-dist/tex/latex/profcollege/PfCPyramideCalculs.tex
    trunk/Master/texmf-dist/tex/latex/profcollege/PfCPythagore.tex
    trunk/Master/texmf-dist/tex/latex/profcollege/PfCRangementNombres.tex
    trunk/Master/texmf-dist/tex/latex/profcollege/PfCReperage.tex
    trunk/Master/texmf-dist/tex/latex/profcollege/PfCSolides.tex
    trunk/Master/texmf-dist/tex/latex/profcollege/PfCStatistiques.tex
    trunk/Master/texmf-dist/tex/latex/profcollege/PfCTableauxUnites.tex
    trunk/Master/texmf-dist/tex/latex/profcollege/PfCTablesOperations.tex
    trunk/Master/texmf-dist/tex/latex/profcollege/ProfCollege.sty

Added Paths:
-----------
    trunk/Master/texmf-dist/metapost/profcollege/PfCMonde.mp
    trunk/Master/texmf-dist/tex/latex/profcollege/PfCAutomatismes.tex
    trunk/Master/texmf-dist/tex/latex/profcollege/PfCEcrireQCMold.tex
    trunk/Master/texmf-dist/tex/latex/profcollege/PfCNumberHive.tex
    trunk/Master/texmf-dist/tex/latex/profcollege/PfCStatistiquesold.tex
    trunk/Master/texmf-dist/tex/latex/profcollege/PfCStatistiquesoldold.tex

Removed Paths:
-------------
    trunk/Master/texmf-dist/metapost/profcollege/PfCMonde-futurenew.mp

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

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

Deleted: trunk/Master/texmf-dist/metapost/profcollege/PfCMonde-futurenew.mp
===================================================================
--- trunk/Master/texmf-dist/metapost/profcollege/PfCMonde-futurenew.mp	2023-07-04 19:52:56 UTC (rev 67544)
+++ trunk/Master/texmf-dist/metapost/profcollege/PfCMonde-futurenew.mp	2023-07-04 19:53:24 UTC (rev 67545)
@@ -1,1617 +0,0 @@
-%Package mp-geographie
-%Auteur:Christophe Poulain
-%Version 0.62
-%16/02/2010
-
-input marith;
-input sarith;
-%input LATEX;
-
-pi:=3.141592654;
-c:=57.29578; % conversion d'un radian en degr\xE9s
-
-color _T[],rouge,vert,bleu,jaune,noir,blanc,orange,rose,violet,ciel,cielfonce,orangevif,gris,tan,payscolor;
-
-rouge=(1,0,0);
-bleu=(0,0,1);
-noir=(0,0,0);
-blanc=(1,1,1);
-orange=(1,0.5,0);
-violet=(1,0,1);
-rose=(1,0.7,0.7);
-cielfonce=(0.25,0.75,1);
-ciel=(0,1,1);
-orangevif=(1,0.25,0.1);
-vert=(0,1,0);
-jaune=(1,1,0);
-gris=0.8*white;
-
-tan=(0.824,0.705,0.55);
-payscolor=tan;
-
-vardef flamme=reverse(2mm*(0.5,1){dir90}..2mm*(0.75,1.5)..{dir90}2mm*(1,2))--2mm*(0.5,1){dir=-90}..2mm*(1,0.5)..{dir=90}2mm*(1.5,1)--((2mm*(0.5,1){dir90}..2mm*(0.75,1.5)..{dir90}2mm*(1,2)) reflectedabout (2mm*(1,0),2mm*(1,0)+2mm*(0,1)))--cycle
-enddef;
-
-%Les marques
-
-string marque_p;
-marque_p := "non";
-marque_r := 20;
-
-def MarquePoint(expr p)=
-  if marque_p = "creux":
-    if color p:
-      fill fullcircle scaled (marque_r/5) shifted (Projgeo(p)) withcolor white;
-      draw fullcircle scaled (marque_r/5) shifted (Projgeo(p));
-    else:
-      fill fullcircle scaled (marque_r/5) shifted (p) withcolor white;
-      draw fullcircle scaled (marque_r/5) shifted (p);
-    fi;
-  elseif marque_p = "croix":
-    drawoptions(withpen pencircle scaled 1.25);
-    if color p:
-      draw (Projgeo(p) shifted (-marque_r/20,marque_r/20))--(Projgeo(p) shifted (marque_r/20,-marque_r/20));
-      draw (Projgeo(p) shifted (-marque_r/20,-marque_r/20))--(Projgeo(p) shifted (marque_r/20,marque_r/20));
-    else:
-      draw ((p) shifted (-marque_r/20,marque_r/20))--((p) shifted (marque_r/20,-marque_r/20));
-      draw ((p) shifted (-marque_r/20,-marque_r/20))--((p) shifted (marque_r/20,marque_r/20));
-    fi;
-    drawoptions();
-  fi;
-enddef;
-
-vardef pointe(text t) =
-  for p_ = t: if (pair p_) or (color p_): MarquePoint(p_); fi endfor;
-enddef;
-
-%D\xE9finition pour la feuille
-
-path feuillet;
-numeric _tfig,_nfig;
-_nfig:=0;
-u:=1cm;
-
-def feuille(expr xa,ya,xb,yb) =
-  numeric Xa,Ya;
-  Xa=xa;
-  Ya=ya;
-  feuillet := (xa,ya)--(xa,yb)--(xb,yb)--(xb,ya)--cycle;
-  extra_endfig := "clip currentpicture to feuillet;" & extra_endfig;
-enddef;
-
-def figureespace(expr xa,ya,xb,yb) =
-  _nfig:=_nfig+1;
-  beginfig(_nfig);
-    feuille(xa,ya,xb,yb);
-enddef;  
-
-def finespace=
-endfig;
-enddef;
-
-def figure(expr xa,ya,xb,yb)=figureespace(xa,ya,xb,yb)
-enddef;
-
-def fin=finespace
-enddef;
-
-%definitions math\xE9matiques
-vardef cercles(text t)=
-  save Cer;
-  save n;
-  n:=0;
-  for p_=t:
-    if color p_:
-      n:=n+1;
-      _T[n]:=p_;
-    fi;
-  endfor;
-  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=Projgeo(ptcer0)
-  for k=0 step 5 until 360 :
-    ..Projgeo(ptcer[k div 5])
-  endfor
-  ..cycle;
-  Cer
-enddef;
-
-vardef arcsind(expr x)=%en degr\xE9 ici :)
-  angle((sqrt(1-x**2),x))
-enddef;
-
-vardef arccosd(expr x)=%en degr\xE9 ici :)
-  angle((x,sqrt(1-x**2)))
-enddef;
-
-vardef tand(expr x)=sind(x)/cosd(x)%
-enddef;
-
-vardef cotand(expr x)=cosd(x)/sind(x)%
-enddef;
-
-vardef sinc(expr x)=if abs(x)<0.001:1 else:sind(x)*c/x fi enddef;
-
-vardef ln(expr t)=mlog(t)/256%
-enddef;
-
-%repr\xE9sentation param\xE9trique de la sph\xE8re terrestre.
-vardef FX(expr t,v)=rayon*cosd(c*t)*cosd(c*v)
-enddef;
-
-vardef FY(expr t,v)=rayon*cosd(c*t)*sind(c*v)
-enddef;
-
-vardef FZ(expr t,v)=rayon*sind(c*t)
-enddef;
-
-%Param\xE8tres et macros de repr\xE9sentation
-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;
-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 MaillageS=
-  path Maillage[];
-  color CentMaillage[];
-  %numeric Vmin,Vmax;
-  %total:=0;
-  for k=Udebut step 0.5*pasU until (Ufin):
-    for l=Vdebut step pasV until (Vfin):
-      Maillage[100*k+l]=Projgeo((FX(k,l),FY(k,l),FZ(k,l)))--Projgeo((FX(k,l+pasV),FY(k,l+pasV),FZ(k,l+pasV)))--Projgeo((FX(k+pasU,l+pasV),FY(k+pasU,l+pasV),FZ(k+pasU,l+pasV)))--Projgeo((FX(k+pasU,l),FY(k+pasU,l),FZ(k+pasU,l)))--cycle;
-      if ProduitScalaire(1/2[(FX(k,l),FY(k,l),FZ(k,l)),(FX(k+pasU,l+pasV),FY(k+pasU,l+pasV),FZ(k+pasU,l+pasV))]-pte3,Oeil-pte3)>0:
-	draw Maillage[100*k+l];
-      fi;
-    endfor;
-  endfor;
-enddef;
-
-vardef InitialiseMaillage(expr ud,uf,up,vd,vf,vp)=
-  Udebut:=ud;
-  Ufin:=uf;
-  pasU:=up;
-  Vdebut:=vd;
-  Vfin:=vf;
-  pasV:=vp;
-enddef;
-
-vardef MaillageSphere=
-  InitialiseMaillage(((phim div 10)+1)*pi/18,((phip div 10)-1)*pi/18,pi/18,-pi,pi,pi/36);
-  MaillageS;
-enddef;
-
-boolean maille;
-maille=false;
-
-vardef ParaMeri(expr lonn,latt)=%longitude et latitude en degr\xE9s%Parall\xE8le et m\xE9ridien particulier pour une repr\xE9sentation 3d.
-  maille:=true;
-  latpar:=latt;
-  lonpar:=lonn;
-enddef;
-
-vardef Maille=
-  InitialiseMaillage(((phim div 10)+1)*pi/18,((phip div 10)-1)*pi/18,pi/36,-pi,pi,pi/72);
-  path SMaillage[];picture Smaille;
-  drawoptions(withpen pencircle scaled 2bp withcolor orangevif);
-  for l=Vdebut step pasV until (Vfin+pasV):
-    SMaillage[100*latpar+l]=Projgeo((FX(latpar/c,l),FY(latpar/c,l),FZ(latpar/c,l)))--Projgeo((FX(latpar/c,l+pasV),FY(latpar/c,l+pasV),FZ(latpar/c,l+pasV)));
-    if ProduitScalaire(1/2[(FX(latpar/c,l),FY(latpar/c,l),FZ(latpar/c,l)),(FX(latpar/c,l+pasV),FY(latpar/c,l+pasV),FZ(latpar/c,l+pasV))]-pte3,Oeil-pte3)>0:
-      draw SMaillage[100*latpar+l];
-    fi;
-  endfor;
-  for k=Udebut step pasU until (Ufin+pasU):
-    SMaillage[k+100*lonpar]:=Projgeo((FX(k,lonpar/c),FY(k,lonpar/c),FZ(k,lonpar/c)))--Projgeo((FX(k+pasU,lonpar/c),FY(k+pasU,lonpar/c),FZ(k+pasU,lonpar/c)));
-    if ProduitScalaire(1/2[(FX(k,lonpar/c),FY(k,lonpar/c),FZ(k,lonpar/c)),(FX(k+pasU,lonpar/c),FY(k+pasU,lonpar/c),FZ(k+pasU,lonpar/c))]-pte3,Oeil-pte3)>0:
-      draw SMaillage[k+100*lonpar];
-    fi;
-  endfor;
-  drawoptions();
-    %);
-enddef;
-
-vardef Projgeo(expr X)=
-  pair $;
-  numeric Xobs,Yobs,Zobs,XProj,YProj;
-  Xobs = -redpart(X)*Aux1 + greenpart(X)*Aux3;
-  Yobs = -redpart(X)*Aux5 - greenpart(X)*Aux6 + bluepart(X)*Aux4;
-  Zobs = -redpart(X)*Aux7 - greenpart(X)*Aux8 - bluepart(X)*Aux2 + Rho;
-  XProj = DE*Xobs/Zobs;
-  YProj = DE*Yobs/Zobs;
-  $=(XProj,YProj);
-  $
-enddef;
-
-%D\xE9but du package
-numeric nbpts,nblec,nbcapitales;
-
-vardef lecture(expr nomfichier,fond)=
-  color Coord[],Pays[];
-  numeric ll;
-  ll:=0;
-  nbpts:=scantokens readfrom nomfichier;
-  for k=1 upto (nbpts div 3):
-    pair latlon;
-    latlon=((scantokens readfrom nomfichier)+(scantokens readfrom nomfichier)+(scantokens readfrom nomfichier))/3;
-    Coord[k]=rayon*(cosd(xpart(latlon/60))*cosd(ypart(latlon/60)),cosd(xpart(latlon/60))*sind(ypart(latlon/60)),sind(xpart(latlon/60)));
-    if ((xpart(latlon/60)>phim) and (xpart(latlon/60)<phip)):
-      if ProduitScalaire(Coord[k]-pte3,Oeil-pte3)>0:
-	ll:=ll+1;
-	Pays[k]=Coord[k];
-      else:
-	Pays[k]=2*Coord[k];
-      fi;
-    else:
-      Pays[k]=2*Coord[k];
-    fi;
-  endfor;
-  closefrom nomfichier;
-  path pays;
-  if ll>0:
-    pays=Projgeo(Pays[1])
-    for l=2 upto (nbpts div 3):
-      --Projgeo(Pays[l])
-    endfor;
-    if noncolore=true:
-      fill pays--cycle withcolor payscolor;
-    else:
-      fill pays--cycle withcolor fond;
-    fi;
-    draw pays;
-    clip currentpicture to cercles(pte3,pte1,pte3,pte1,pte4);
-  fi;
-enddef;
-
-string nomfichiermul,NomFichier;
-
-vardef Lectureiles=
-  nomfichiermul:=arborescence&"PfCiles.dat";
-  nblec:=scantokens readfrom nomfichiermul;
-  for p=1 upto nblec:
-    color Coord[],fond,Pays[];
-    numeric ll;
-    ll:=0;
-    nbpts:=scantokens readfrom nomfichiermul;
-    fond=scantokens readfrom nomfichiermul;
-    for k=1 upto nbpts:
-      pair latlon;
-      latlon=scantokens readfrom nomfichiermul;
-      Coord[k]=rayon*(cosd(xpart(latlon/60))*cosd(ypart(latlon/60)),cosd(xpart(latlon/60))*sind(ypart(latlon/60)),sind(xpart(latlon/60)));
-      if ((xpart(latlon/60)>phim) and (xpart(latlon/60)<phip)):
-	if ProduitScalaire(Coord[k]-pte3,Oeil-pte3)>0:
-	  ll:=ll+1;
-	  Pays[k]=Coord[k];
-	else:
-	  Pays[k]=2*Coord[k];
-	fi;
-      else:
-	Pays[k]=2*Coord[k];
-      fi;
-    endfor;
-    path pays;
-     if ll>0:
-      pays=Projgeo(Pays[1])
-      for l=2 upto nbpts:
-	--Projgeo(Pays[l])
-      endfor;
-      if noncolore=true:
-	fill pays--cycle withcolor payscolor;
-      else:
-	fill pays--cycle withcolor fond;
-      fi;
-      draw pays;
-      clip currentpicture to cercles(pte3,pte1,pte3,pte1,pte4);
-    fi;
-  endfor;
-  closefrom nomfichiermul;
-enddef;
-
-vardef Lecturelacs=
-  nomfichiermul:=arborescence&"PfClacs.dat";
-  nblec:=scantokens readfrom nomfichiermul;
-  for p=1 upto nblec:
-    color Coord[],Pays[];
-    numeric ll;
-    ll:=0;
-    nbpts:=scantokens readfrom nomfichiermul;
-    for k=1 upto nbpts:
-      pair latlon;
-      latlon=scantokens readfrom nomfichiermul;
-      Coord[k]=rayon*(cosd(xpart(latlon/60))*cosd(ypart(latlon/60)),cosd(xpart(latlon/60))*sind(ypart(latlon/60)),sind(xpart(latlon/60)));
-      if ((xpart(latlon/60)>phim) and (xpart(latlon/60)<phip)):
-	if ProduitScalaire(Coord[k]-pte3,Oeil-pte3)>0:
-	  ll:=ll+1;
-	  Pays[k]=Coord[k];
-	else:
-	  Pays[k]=2*Coord[k];
-	fi;
-      else:
-	Pays[k]=2*Coord[k];
-      fi;
-    endfor;
-    path pays;
-    if ll>0:
-      pays=Projgeo(Pays[1])
-      for l=2 upto nbpts:
-	--Projgeo(Pays[l])
-      endfor;
-      fill pays--cycle withcolor couleurfleuve;
-      draw pays;
-      clip currentpicture to cercles(pte3,pte1,pte3,pte1,pte4);
-    fi;
-  endfor;
-  closefrom nomfichiermul;
-enddef;
-
-vardef Lecturelacssup=
-  nomfichiermul:=arborescence&"PfClacssup.dat";
-  nblec:=scantokens readfrom nomfichiermul;
-  for p=1 upto nblec:
-    color Coord[],Pays[];
-    numeric ll;
-    ll:=0;
-    nbpts:=scantokens readfrom nomfichiermul;
-    for k=1 upto nbpts:
-      pair latlon;
-      latlon=scantokens readfrom nomfichiermul;
-      Coord[k]=rayon*(cosd(xpart(latlon))*cosd(ypart(latlon)),cosd(xpart(latlon))*sind(ypart(latlon)),sind(xpart(latlon)));
-      if ((xpart(latlon)>phim) and (xpart(latlon)<phip)):
-	if ProduitScalaire(Coord[k]-pte3,Oeil-pte3)>0:
-	  ll:=ll+1;
-	  Pays[k]=Coord[k];
-	else:
-	  Pays[k]=2*Coord[k];
-	fi;
-      else:
-	Pays[k]=2*Coord[k];
-      fi;
-    endfor;
-    path pays;
-    if ll>0:
-      pays=Projgeo(Pays[1])
-      for l=2 upto nbpts:
-	--Projgeo(Pays[l])
-      endfor;
-      fill pays--cycle withcolor couleurfleuve;
-      draw pays;
-      clip currentpicture to cercles(pte3,pte1,pte3,pte1,pte4);
-    fi;
-  endfor;
-  closefrom nomfichiermul;
-enddef;
-
-vardef Lecturevolcans=
-  drawoptions(withcolor orange);
-  nomfichiermul:=arborescence&"PfCvolcans.dat";
-  nblec:=scantokens readfrom nomfichiermul;
-  show nblec;
-  for p=1 upto nblec:
-    color Coord[],Pays[];
-    pair latlon;
-    latlon=scantokens readfrom nomfichiermul;
-    Coord[p]=rayon*(cosd(xpart(latlon/60))*cosd(ypart(latlon/60)),cosd(xpart(latlon/60))*sind(ypart(latlon/60)),sind(xpart(latlon/60)));
-    if ((xpart(latlon/60)>phim) and (xpart(latlon/60)<phip)):
-      if ProduitScalaire(Coord[p]-pte3,Oeil-pte3)>0:
-	Pays[p]=Coord[p];
-	fill flamme shifted Projgeo(Pays[p]) withcolor 1/2[orange,jaune];
-      %else:
-%	Pays[k]=2*Coord[k];
-      fi;
-%    else:
-%      Pays[k]=2*Coord[k];
-    fi;
-  endfor;
-closefrom nomfichiermul;
-drawoptions();
-enddef;
-
-vardef Lecturerivieres=
-  nomfichiermul:=arborescence&"PfCrivieres.dat";
-  nblec:=scantokens readfrom nomfichiermul;
-  for p=1 upto nblec:
-    color Coord[],fond,Pays[];
-    numeric ll;
-    ll:=0;
-    nbpts:=scantokens readfrom nomfichiermul;
-    for k=1 upto nbpts:
-      pair latlon;
-      latlon=scantokens readfrom nomfichiermul;
-      Coord[k]=rayon*(cosd(xpart(latlon/60))*cosd(ypart(latlon/60)),cosd(xpart(latlon/60))*sind(ypart(latlon/60)),sind(xpart(latlon/60)));
-      if ((xpart(latlon/60)>phim) and (xpart(latlon/60)<phip)):
-	if ProduitScalaire(Coord[k]-pte3,Oeil-pte3)>0:
-	  ll:=ll+1;
-	  Pays[k]=Coord[k];
-	else:
-	  Pays[k]=2*Coord[k];
-	fi;
-      else:
-	Pays[k]=2*Coord[k];
-      fi;
-    endfor;
-    path pays;
-    if ll>0:
-      pays=Projgeo(Pays[1])
-      for l=2 upto nbpts:
-	--Projgeo(Pays[l])
-      endfor;
-      draw pays withcolor couleurfleuve;
-      clip currentpicture to cercles(pte3,pte1,pte3,pte1,pte4);
-    fi;
-  endfor;
-  closefrom nomfichiermul;
-enddef;
-
-vardef Lecturerivieressup=
-  nomfichiermul:=arborescence&"PfCfleuveseurope.dat";
-  nblec:=scantokens readfrom nomfichiermul;
-  for p=1 upto nblec:
-    color Coord[],fond,Pays[];
-    numeric ll;
-    ll:=0;
-    nbpts:=scantokens readfrom nomfichiermul;
-    for k=1 upto nbpts:
-      pair latlon;
-      latlon=scantokens readfrom nomfichiermul;
-      Coord[k]=rayon*(cosd(xpart(latlon))*cosd(ypart(latlon)),cosd(xpart(latlon))*sind(ypart(latlon)),sind(xpart(latlon)));
-      if ((xpart(latlon)>phim) and (xpart(latlon)<phip)):
-	if ProduitScalaire(Coord[k]-pte3,Oeil-pte3)>0:
-	  ll:=ll+1;
-	  Pays[k]=Coord[k];
-	else:
-	  Pays[k]=2*Coord[k];
-	fi;
-      else:
-	Pays[k]=2*Coord[k];
-      fi;
-    endfor;
-    path pays;
-    if ll>0:
-      pays=Projgeo(Pays[1])
-      for l=2 upto nbpts:
-	--Projgeo(Pays[l])
-      endfor;
-      draw pays withcolor couleurfleuve;
-      clip currentpicture to cercles(pte3,pte1,pte3,pte1,pte4);
-    fi;
-  endfor;
-  closefrom nomfichiermul;
-enddef;
-
-vardef Lecturecapitales=
-  marque_p:="creux";
-  nomfichiermul:=arborescence&"PfCcapitales.dat";
-  nbcapitales:=scantokens readfrom nomfichiermul;
-  for p=1 upto nbcapitales:
-    color Coord[];
-    pair latlon;
-    picture Nom;
-    string p_;
-    p_=scantokens readfrom nomfichiermul;
-    latlon=scantokens readfrom nomfichiermul;
-    Coord[p]=rayon*(cosd(xpart(latlon/60))*cosd(ypart(latlon/60)),cosd(xpart(latlon/60))*sind(ypart(latlon/60)),sind(xpart(latlon/60)));
-    Nom=image(
-      label.top(TEX(""&p_&""),Projgeo(Coord[p]));
-      );
-    if ((xpart(latlon/60)>phim) and (xpart(latlon/60)<phip)):
-      if ProduitScalaire(Coord[p]-pte3,Oeil-pte3)>0:
-	pointe(Coord[p]);
-	%draw Nom;
-      fi;
-    fi;
-  endfor;
-  closefrom nomfichiermul;
-  marque_p:="non";
-enddef;
-
-vardef Lecture(expr Nomfichier)=
-  NomFichier:=arborescence&Nomfichier;
-  nblec:=scantokens readfrom NomFichier;
-  for w=1 upto nblec:
-    if projection="non":
-      lecture(scantokens readfrom NomFichier);
-    else:
-      lecturep(scantokens readfrom NomFichier);
-    fi;
-  endfor;
-  closefrom NomFichier;
-enddef;
-
-%Pour les projections
-string projection;
-projection:="non";
-
-vardef zoom(expr nbzoom)=
-  if projection="mercator":
-    xunit:=nbzoom;
-    yunit:=nbzoom*2*cm;
-  elseif projection="cylindrique":
-    xunit:=2.5*nbzoom;
-    yunit:=nbzoom*10*cm;
-  elseif projection="winkel":
-    xunit:=nbzoom*0.5*mm;
-    yunit:=nbzoom;
-  elseif projection="simple":
-    xunit:=nbzoom*0.5*mm;
-    yunit:=nbzoom*0.5*mm;
-  elseif projection="bonne":
-    xunit:=nbzoom*4*cm;
-    yunit:=xunit;
-  fi;
-enddef;
-
-vardef mercatorc(expr aa,bb)=
-  (xunit*(bb-theta),yunit*(ln(abs(tand(45+(aa/2))))-ln(abs(tand(45+(phi/2))))))
-enddef;
-
-vardef coniquec(expr aa,bb,pc)=
-  abscon:=5*cm*(cosd(aa)*sind(bb*sind(pc)))/(sind(pc)*cosd(aa-pc));
-  ordcon:=5*cm*(cosd(aa)*cosd(bb*sind(pc)))/(sind(pc)*cosd(aa-pc));
-  (abscon,ordcon)
-enddef;
-
-vardef cylindriquec(expr aa,bb)=
-  (xunit*(bb-theta),yunit*(sind(aa)-sind(phi)))
-enddef;
-
-vardef simplec(expr aa,bb)=
-  (xunit*(bb-theta),yunit*(aa-phi))
-enddef;
-
-vardef bonnec(expr aaa,bbb)=
-  save tt;
-  pair tt;
-  rho:=cotand(phi)+(phi-aaa)/c;
-  E:=(((bbb-theta)/c)/rho)*cosd(aaa);
-  tt=xunit*(rho*sind(E*c),cotand(phi)-rho*cosd(E*c));
-  tt
-enddef;
-
-vardef winkelc(expr aaa,bbb)=
-  save ttw;
-  pair ttw;
-  alphawinkel:=arccosd(cosd(aaa)*cosd(0.5*bbb));
-  if alphawinkel=0:
-    xwinkel:=0;
-    ywinkel:=0;
-  else:
-    xwinkel:=xunit*0.5*(bbb*cosd(arccosd(2/pi))+(2*cosd(aaa)*sind(0.5*bbb)/sinc(alphawinkel)));
-    ywinkel:=yunit*0.5*(aaa+sind(aaa)/sinc(alphawinkel));
-  fi;
-  ttw=(xwinkel,ywinkel);
-  ttw
-enddef;
-
-vardef lecturep(expr nomfichier,fond)=
-  pair Coord[];
-  nbpts:=scantokens readfrom nomfichier;
-  numeric ll;
-  ll=0;
-  for k=1 upto nbpts:
-    pair latlon;
-    latlon=scantokens readfrom nomfichier;
-    if projection="mercator":
-      Coord[k]=mercatorc(xpart(latlon/60),ypart(latlon/60))
-    elseif projection="winkel":
-      Coord[k]=winkelc(xpart(latlon/60),ypart(latlon/60))
-    elseif projection="cylindrique":
-      Coord[k]=cylindriquec(xpart(latlon/60),ypart(latlon/60));
-    elseif projection="simple":
-      Coord[k]=simplec(xpart(latlon/60),ypart(latlon/60));
-    elseif projection="bonne":
-      Coord[k]=bonnec(xpart(latlon/60),ypart(latlon/60));
-    elseif projection="coniqueh":
-      if (xpart(latlon)>0) or (xpart(latlon)=0):
-	ll:=ll+1;
-	Coord[ll]=coniquec(xpart(latlon/60),ypart(latlon/60),45);
-      fi;
-    elseif projection="coniqueb":
-      if (xpart(latlon)<0):
-	ll:=ll+1;
-	Coord[ll]=coniquec(xpart(latlon/60),ypart(latlon/60),-45);
-      fi;
-    fi;
-  endfor;
-  closefrom nomfichier;
-  path pays;
-  if (projection="mercator") or (projection="winkel") or(projection="cylindrique") or (projection="simple") or (projection="bonne"):
-    ll:=nbpts
-  fi;
-  if ll>0:
-    pays=Coord[1]
-    for l=4 step 3 until ll:%upto ll:
-      --Coord[l]
-    endfor;
-    if noncolore=true:
-      fill pays--cycle withcolor payscolor;
-    else:
-      fill pays--cycle withcolor fond;
-    fi;
-    draw pays;
-  fi;
-enddef;
-
-vardef Lectureilesp=
-  if (projection="mercator") or (projection="winkel") or (projection="cylindrique") or (projection="simple") or (projection="bonne"):
-    nomfichiermul:=arborescence&"PfCIle.dat";
-  else:
-    nomfichiermul:=arborescence&"PfCiles.dat";
-  fi;
-  nblec:=scantokens readfrom nomfichiermul;
-  if projection="bonne":
-    nblec:=nblec-1
-  fi;
-  for p=1 upto nblec:
-    pair Coord[];color fond;
-    nbpts:=scantokens readfrom nomfichiermul;
-    fond=scantokens readfrom nomfichiermul;
-    numeric ll;
-    ll=0;
-    for k=1 upto nbpts:
-      pair latlon;
-      latlon=scantokens readfrom nomfichiermul;
-      if projection="mercator":
-	Coord[k]=mercatorc(xpart(latlon/60),ypart(latlon/60));
-      elseif projection="winkel":
-	Coord[k]=winkelc(xpart(latlon/60),ypart(latlon/60));
-      elseif projection="simple":
-	Coord[k]=simplec(xpart(latlon/60),ypart(latlon/60));
-      elseif projection="cylindrique":
-	Coord[k]=cylindriquec(xpart(latlon/60),ypart(latlon/60));
-      elseif projection="bonne":
-	Coord[k]=bonnec(xpart(latlon/60),ypart(latlon/60));
-      elseif projection="coniqueh":
-	if (xpart(latlon)>0) or (xpart(latlon)=0):
-	  ll:=ll+1;
-	  Coord[ll]=coniquec(xpart(latlon/60),ypart(latlon/60),45)
-	fi;
-      elseif projection="coniqueb":
-	if (xpart(latlon)<0):
-	  ll:=ll+1;
-	  Coord[ll]=coniquec(xpart(latlon/60),ypart(latlon/60),-45);
-	fi;
-      fi;
-    endfor;
-    path pays;
-    if (projection="mercator") or (projection="winkel") or (projection="cylindrique") or (projection="simple") or (projection="bonne"):
-      ll:=nbpts
-    fi;
-    if ll>0:
-      pays=Coord[1]
-      for l=2 upto ll:
-	--Coord[l]
-      endfor;
-      if noncolore=true:
-	fill pays--cycle withcolor payscolor;
-      else:
-	fill pays--cycle withcolor fond;
-      fi;
-      draw pays;
-    fi;
-  endfor;
-  closefrom nomfichiermul;
-  if (projection="mercator") or (projection="winkel") or (projection="cylindrique") or (projection="simple"):
-    clip currentpicture to feuillet;
-  fi;
-  if projection="bonne":
-    lecturep(arborescence&"PfCpolesud.dat",blanc);
-    clip currentpicture to (bonnec(-90,-180) for k=-89 upto 90:..bonnec(k,-180) endfor)..reverse(bonnec(-90,180) for k=-89 upto 90:..bonnec(k,180) endfor)..cycle;
-  fi;
-enddef;
-
-%14/05/2017
-boolean ecriturevilles;
-ecriturevilles:=true;
-%14/05/2017
-
-vardef Lecturevillesp(expr nompays)=
-  nomfichiermul:=arborescence&"PfCvilles"&nompays&".dat";
-  nblec:=scantokens readfrom nomfichiermul;
-  drawoptions(withcolor (0.15,0.15,0.15)); 
-  for p=1 upto nblec:
-    pair Coord[],latlon;string p_;
-    latlon=scantokens readfrom nomfichiermul;
-    p_=scantokens readfrom nomfichiermul;
-    if projection="mercator":
-      Coord[p]=mercatorc(ypart(latlon),xpart(latlon));
-    elseif projection="winkel":
-      Coord[p]=winkelcc(ypart(latlon),xpart(latlon));
-    elseif projection="simple":
-      Coord[p]=simplec(ypart(latlon),xpart(latlon));
-    elseif projection="cylindrique":
-      Coord[p]=cylindriquec(ypart(latlon),xpart(latlon));
-    elseif projection="bonne":
-	Coord[p]=bonnec(ypart(latlon),xpart(latlon));
-    fi;
-    if (projection="mercator") or (projection="winkel") or (projection="cylindrique") or (projection="simple") or (projection="bonne"):
-      if ecriturevilles=true:
-	dotlabel.scantokens readfrom nomfichiermul(TEX(""&p_&""),Coord[p]);
-      else:
-	dotlabel.scantokens readfrom nomfichiermul("",Coord[p]);
-      fi;
-    fi;
-  endfor;
-  drawoptions();
-  closefrom nomfichiermul;
-enddef;
-
-%16/02/2010
-
-vardef Lecturevilles(expr nomfich)=
-marque_p:="creux";
-  nomfichiermul:=nomfich&".dat";
-  nbcapitales:=scantokens readfrom nomfichiermul;
-  for p=1 upto nbcapitales:
-    color Coord[];
-    pair latlon;
-    picture Nom;
-    string p_;
-    p_=scantokens readfrom nomfichiermul;
-    latlon=scantokens readfrom nomfichiermul;
-    Coord[p]=rayon*(cosd(xpart(latlon/60))*cosd(ypart(latlon/60)),cosd(xpart(latlon/60))*sind(ypart(latlon/60)),sind(xpart(latlon/60)));
-    Nom=image(
-      label.scantokens readfrom nomfichiermul(TEX(""&p_&""),Projgeo(Coord[p]));
-      );
-    if ((xpart(latlon/60)>phim) and (xpart(latlon/60)<phip)):
-      if ProduitScalaire(Coord[p]-pte3,Oeil-pte3)>0:
-	pointe(Coord[p]);
-	draw Nom;
-      fi;
-    fi;
-  endfor;
-  closefrom nomfichiermul;
-  marque_p:="non";
-enddef;
-%
-
-
-vardef Lecturelacsp=
-  nomfichiermul:=arborescence&"PfClacs.dat";
-  nblec:=scantokens readfrom nomfichiermul;
-  for p=1 upto nblec:
-    pair Coord[];
-    nbpts:=scantokens readfrom nomfichiermul;
-    numeric ll;
-    ll=0;
-    for k=1 upto nbpts:
-      pair latlon;
-      latlon=scantokens readfrom nomfichiermul;
-      if projection="mercator":
-	Coord[k]=mercatorc(xpart(latlon/60),ypart(latlon/60));
-      elseif projection="winkel":
-	Coord[k]=winkelc(xpart(latlon/60),ypart(latlon/60));
-      elseif projection="simple":
-	Coord[k]=simplec(xpart(latlon/60),ypart(latlon/60));
-      elseif projection="cylindrique":
-	Coord[k]=cylindriquec(xpart(latlon/60),ypart(latlon/60));
-      elseif projection="bonne":
-	Coord[k]=bonnec(xpart(latlon/60),ypart(latlon/60));
-      elseif projection="coniqueh":
-	if (xpart(latlon)>0) or (xpart(latlon)=0):
-	  ll:=ll+1;
-	  Coord[ll]=coniquec(xpart(latlon/60),ypart(latlon/60),45);
-	fi;
-      elseif projection="coniqueb":
-	if (xpart(latlon)<0):
-	  ll:=ll+1;
-	  Coord[ll]=coniquec(xpart(latlon/60),ypart(latlon/60),-45);
-	fi;
-      fi;
-    endfor;
-    path lac;
-    if (projection="mercator") or (projection="winkelc") or (projection="cylindrique") or (projection="simple") or (projection="bonne"):
-      ll:=nbpts
-    fi;
-    if ll>0:
-      lac=Coord[1]
-      for l=2 upto ll:
-	--Coord[l]
-      endfor;
-      fill lac--cycle withcolor couleurfleuve;
-      draw lac;
-    fi;
-  endfor;
-  closefrom nomfichiermul;
-enddef;
-
-vardef Lecturelacspsup=
-  nomfichiermul:=arborescence&"PfClacssup.dat";
-  nblec:=scantokens readfrom nomfichiermul;
-  for p=1 upto nblec:
-    pair Coord[];
-    nbpts:=scantokens readfrom nomfichiermul;
-    numeric ll;
-    ll=0;
-    for k=1 upto nbpts:
-      pair latlon;
-      latlon=scantokens readfrom nomfichiermul;
-      if projection="mercator":
-	Coord[k]=mercatorc(xpart(latlon),ypart(latlon));
-      elseif projection="winkel":
-	Coord[k]=winkelc(xpart(latlon),ypart(latlon));
-      elseif projection="simple":
-	Coord[k]=simplec(xpart(latlon),ypart(latlon));
-      elseif projection="cylindrique":
-	Coord[k]=cylindriquec(xpart(latlon),ypart(latlon));
-      elseif projection="bonne":
-	Coord[k]=bonnec(xpart(latlon),ypart(latlon));
-      elseif projection="coniqueh":
-	if (xpart(latlon)>0) or (xpart(latlon)=0):
-	  ll:=ll+1;
-	  Coord[ll]=coniquec(xpart(latlon),ypart(latlon),45);
-	fi;
-      elseif projection="coniqueb":
-	if (xpart(latlon)<0):
-	  ll:=ll+1;
-	  Coord[ll]=coniquec(xpart(latlon),ypart(latlon),-45);
-	fi;
-      fi;
-    endfor;
-    path lac;
-    if (projection="mercator") or (projection="winkel") or (projection="cylindrique") or (projection="simple") or (projection="bonne"):
-      ll:=nbpts
-    fi;
-    if ll>0:
-      lac=Coord[1]
-      for l=2 upto ll:
-	--Coord[l]
-      endfor;
-      fill lac--cycle withcolor couleurfleuve;
-      draw lac;
-    fi;
-  endfor;
-  closefrom nomfichiermul;
-enddef;
-
-vardef Lecturerivieresp=
-  nomfichiermul:=arborescence&"PfCrivieres.dat";
-  nblec:=scantokens readfrom nomfichiermul;
-  for p=1 upto nblec:
-    pair Coord[];
-    nbpts:=scantokens readfrom nomfichiermul;
-    numeric ll;
-    ll:=0;
-    for k=1 upto nbpts:
-      pair latlon;
-      latlon=scantokens readfrom nomfichiermul;
-      if projection="mercator":
-	Coord[k]=mercatorc(xpart(latlon/60),ypart(latlon/60));
-      elseif projection="winkel":
-	Coord[k]=winkelc(xpart(latlon/60),ypart(latlon/60));
-      elseif projection="simple":
-	Coord[k]=simplec(xpart(latlon/60),ypart(latlon/60));
-      elseif projection="cylindrique":
-	Coord[k]=cylindriquec(xpart(latlon/60),ypart(latlon/60));
-      elseif projection="bonne":
-	Coord[k]=bonnec(xpart(latlon/60),ypart(latlon/60));
-      elseif projection="coniqueh":
-	if (xpart(latlon)>0) or (xpart(latlon)=0):
-	  ll:=ll+1;
-	  Coord[ll]=coniquec(xpart(latlon/60),ypart(latlon/60),45);
-	fi;
-      elseif projection="coniqueb":
-	if (xpart(latlon)<0):
-	  ll:=ll+1;
-	  Coord[ll]=coniquec(xpart(latlon/60),ypart(latlon/60),-45);
-	fi;
-      fi;
-    endfor;
-    path riv;
-    if (projection="mercator") or (projection="winkel") or (projection="cylindrique") or (projection="simple") or (projection="bonne"):
-      ll:=nbpts;
-    fi;
-    if ll>0:
-      riv=Coord[1]
-      for l=2 upto ll:
-	--Coord[l]
-      endfor;
-      draw riv withcolor couleurfleuve;
-    fi;
-  endfor;
-  closefrom nomfichiermul;
-enddef;
-
-vardef Lecturerivierespsup=
-  nomfichiermul:=arborescence&"PfCfleuveseurope.dat";
-  nblec:=scantokens readfrom nomfichiermul;
-  for p=1 upto nblec:
-    pair Coord[];
-    nbpts:=scantokens readfrom nomfichiermul;
-    numeric ll;
-    ll:=0;
-    for k=1 upto nbpts:
-      pair latlon;
-      latlon=scantokens readfrom nomfichiermul;
-      if projection="mercator":
-	Coord[k]=mercatorc(xpart(latlon),ypart(latlon));
-      elseif projection="winkel":
-	Coord[k]=winkelc(xpart(latlon),ypart(latlon));
-      elseif projection="simple":
-	Coord[k]=simplec(xpart(latlon),ypart(latlon));
-      elseif projection="cylindrique":
-	Coord[k]=cylindriquec(xpart(latlon),ypart(latlon));
-      elseif projection="bonne":
-	Coord[k]=bonnec(xpart(latlon),ypart(latlon));
-      elseif projection="coniqueh":
-	if (xpart(latlon)>0) or (xpart(latlon)=0):
-	  ll:=ll+1;
-	  Coord[ll]=coniquec(xpart(latlon),ypart(latlon),45);
-	fi;
-      elseif projection="coniqueb":
-	if (xpart(latlon)<0):
-	  ll:=ll+1;
-	  Coord[ll]=coniquec(xpart(latlon),ypart(latlon),-45);
-	fi;
-      fi;
-    endfor;
-    path riv;
-    if (projection="mercator") or (projection="winkel") or (projection="cylindrique") or (projection="simple") or (projection="bonne"):
-      ll:=nbpts;
-    fi;
-    if ll>0:
-      riv=Coord[1]
-      for l=2 upto ll:
-	--Coord[l]
-      endfor;
-      draw riv withcolor couleurfleuve;
-    fi;
-  endfor;
-  closefrom nomfichiermul;
-enddef;
-
-vardef Lecturecapitalesp=
-  marque_p:="creux";
-  nomfichiermul:=arborescence&"PfCcapitales.dat";
-  nbcapitales:=scantokens readfrom nomfichiermul;
-  for p=1 upto nbcapitales:
-    pair Coord[],latlon;
-    string p_;
-    p_=scantokens readfrom nomfichiermul;
-    latlon=scantokens readfrom nomfichiermul;
-    ll:=0;
-    if projection="mercator":
-      Coord[p]=mercatorc(xpart(latlon/60),ypart(latlon/60));
-      ll:=1;
-    elseif projection="winkel":
-      Coord[p]=winkelc(xpart(latlon/60),ypart(latlon/60));
-      ll:=1;
-    elseif projection="simple":
-      Coord[p]=simplec(xpart(latlon/60),ypart(latlon/60));
-      ll:=1;
-    elseif projection="cylindrique":
-      Coord[p]=cylindriquec(xpart(latlon/60),ypart(latlon/60));
-      ll:=1;
-    elseif projection="bonne":
-      Coord[p]=bonnec(xpart(latlon/60),ypart(latlon/60));
-      ll:=1;
-    elseif projection="coniqueh":
-      if (xpart(latlon)>0) or (xpart(latlon)=0):
-	ll:=1;
-	Coord[p]=coniquec(xpart(latlon/60),ypart(latlon/60),45);
-      fi;
-    elseif projection="coniqueb":
-      if (xpart(latlon)<0):
-	ll:=1;
-	Coord[p]=coniquec(xpart(latlon/60),ypart(latlon/60),-45);
-      fi;
-    fi;
-    if ll>0:
-      drawoptions(withcolor rouge);
-      pointe(Coord[p]);
-      drawoptions();
-      if (projection="mercator") or (projection="winkel") or (projection="cylindrique") or (projection="simple") or (projection="bonne"):
-	label.top(TEX(""&p_&""),Coord[p]);
-      fi;
-    fi;
-  endfor;
-  closefrom nomfichiermul;
-  marque_p:="non";
-enddef;
-
-vardef MeridienParallele=
-  if (projection="mercator") or (projection="winkel") or (projection="cylindrique") or (projection="simple"):
-    pair Coord[];
-    for k=-85 step 5 until 85:
-  for j=-180 step 10 until 180:
-	if projection="mercator":
-	  Coord[100*k+j]=mercatorc(k,j);
-	elseif projection="winkel":
-	Coord[100*k+j] = winkelc(k,j);
-	elseif projection="simple":
-	  Coord[100*k+j]=simplec(k,j);
-	elseif projection="cylindrique":
-	  Coord[100*k+j]=cylindriquec(k,j);
-	fi;
-      endfor;
-    endfor;
-    for k=-85 step 5 until 85:
-      draw Coord[100*k-180]
-	for j=-170 step 10 until 180:
-	--Coord[100*k+j]
-     endfor;
-    endfor;
-    pair Coord[];
-    for k=-180 step 10 until 180:
-      for j=-85 step 5 until 85:
-	if projection="mercator":
-	  Coord[0.001*k+10*j]=mercatorc(j,k);
-	elseif projection="winkel":
-	  Coord[0.001*k+10*j]=winkelc(j,k);
-	elseif projection="simple":
-	  Coord[0.001*k+10*j]=simplec(j,k);
-	elseif projection="cylindrique":
-	  Coord[0.001*k+10*j]=cylindriquec(j,k);
-	fi;
-      endfor;
-    endfor;
-    for k=-180 step 10 until 180:
-      draw Coord[0.001*k-10*85]
-	for j=-80 step 5 until 85:
-	--Coord[0.001*k+10*j]
-      endfor;
-    endfor;
-  elseif projection="bonne":
-    pair Coord[][];
-    for k=-90 step 10 until 90:
-      for j=-180 step 10 until 180:
-	Coord[k][j]=bonnec(k,j);
-      endfor;
-    endfor;
-    for k=-90 step 10 until 90:
-      draw Coord[k][-180]
-      for j=-170 step 10 until 180:
-	--Coord[k][j]
-      endfor;
-    endfor;
-    pair Coord[][];
-    for k=-170 step 10 until 170:
-      for j=-90 step 10 until 90:
-	Coord[k][j]=bonnec(j,k);
-      endfor;
-    endfor;
-    for k=-170 step 10 until 170:
-      draw Coord[k][-90]
-      for j=-80 step 10 until 90:
-	..Coord[k][j]
-      endfor;
-    endfor;
-  elseif projection="coniqueh":
-    pair Coord[];
-    for k=-180 step 10 until 180:
-      for j=0 step 10 until 90:
-	Coord[100*k+j]=coniquec(j,k,45);
-      endfor;
-    endfor;
-    for k=-180 step 10 until 180:
-      draw Coord[100*k]
-      for j=10 step 10 until 90:
-	--Coord[100*k+j]
-      endfor;
-    endfor;
-    pair Coord[];
-    for k=0 step 10 until 90:
-      for j=-180 step 10 until 180:
-	Coord[0.001*k+10*j]=coniquec(k,j,45);
-      endfor;
-    endfor;
-    for k=0 step 10 until 90:
-      draw Coord[0.001*k-10*180]
-      for j=-170 step 10 until 180:
-	--Coord[0.001*k+10*j]
-      endfor;
-    endfor;
-    clip currentpicture to coniquec(90,0,45)--(Coord[-10*180]
-      for j=-170 step 10 until 180:
-	--Coord[10*j]
-      endfor)--cycle;
-  elseif projection="coniqueb":
-    pair Coord[];
-    for k=-180 step 10 until 180:
-      for j=-90 step 10 until 0:
-	Coord[100*k+j]=coniquec(j,k,-45);
-      endfor;
-    endfor;
-    for k=-180 step 10 until 180:
-      draw Coord[100*k-90]
-      for j=-80 step 10 until 0:
-	--Coord[100*k+j]
-      endfor;
-    endfor;
-    pair Coord[];
-    for k=-90 step 10 until 0:
-      for j=-180 step 10 until 180:
-	Coord[0.001*k+10*j]=coniquec(k,j,-45);
-      endfor;
-    endfor;
-    for k=-90 step 10 until 0:
-      draw Coord[0.001*k-10*180]
-      for j=-170 step 10 until 180:
-	--Coord[0.001*k+10*j]
-      endfor;
-    endfor;
-    clip currentpicture to coniquec(-90,0,-45)--(Coord[-10*180]
-      for j=-170 step 10 until 180:
-	--Coord[10*j]
-      endfor)--cycle;
-  fi;
-enddef;
-
-boolean Echelle;
-Echelle=false;
-
-vardef echelle(expr Th,Ph,long)=%long en km.
-  %Echelle:=true;
-  theta:=Th;
-  phi:=Ph;
-  Long:=long;
-  zoom(1);
-  numeric $;
-  if projection="bonne":
-    $=(cm*pi*cosd(Ph)/36)/(long*abs(bonnec(Ph,Th)-bonnec(Ph,Th+5)))*6340;
-  elseif projection="mercator":
-    $=(cm*pi*cosd(Ph)*6340/36)/(long*abs(mercatorc(Ph,Th)-mercatorc(Ph,Th+5)));
-    elseif projection="winkel":
-    $=(cm*pi*cosd(Ph)*6340/36)/(long*abs(winkelc(Ph,Th)-winkelc(Ph,Th+5)));
-  elseif projection="simple":
-    $=(cm*pi*cosd(Ph)*6340/36)/(long*abs(simplec(Ph,Th)-simplec(Ph,Th+5)));
-  elseif projection="cylindrique":
-    $=(cm*pi*cosd(Ph)*6340/36)/(long*abs(cylindriquec(Ph,Th)-cylindriquec(Ph,Th+5)));
-  fi;
-  $
-enddef;
-
-boolean Amsud,Amnord,Amcentrale,Caraibes,Asie,Europe,Afrique,All;
-
-Amsud:=false;
-Amnord:=false;
-Amcentrale:=false;
-Caraibes:=false;
-Asie:=false;
-Europe:=false;
-Afrique:=false;
-All:=true;
-
-vardef Projection(expr TH,PH,Zoom)=
-  theta:=TH;
-  phi:=PH;
-  zoom(Zoom);
-  if projection="bonne":
-    fill (bonnec(-90,-180) for k=-85 step 5 until 90:..bonnec(k,-180) endfor)..reverse(bonnec(-90,180) for k=-85 step 5 until 90:..bonnec(k,180) endfor)..cycle withcolor couleurfond;
-  fi;
-  if All=true:
-    Lecture("PfCCameriquesud.dat");
-    Lecture("PfCCcaraibes.dat");
-    Lecture("PfCCameriquecentrale.dat");
-    Lecture("PfCCameriquenord.dat");
-    Lecture("PfCCasia.dat");
-    Lecture("PfCCeurope.dat");
-    Lecture("PfCCafrique.dat");
-  else:
-    if Amsud=true:
-      Lecture("PfCCameriquesud.dat");
-    fi;
-    if Amnord=true:
-      Lecture("PfCCameriquenord.dat");
-    fi;
-    if Amcentrale=true:
-      Lecture("PfCCameriquecentrale.dat");
-    fi;
-    if Caraibes=true:
-      Lecture("PfCCcaraibes.dat");
-    fi;
-    if Asie=true:
-      if projection="bonne":
-	Lecture("PfCCasie.dat");
-      else:
-	Lecture("PfCCasia.dat");
-      fi;
-    fi;
-    if Europe=true:
-      Lecture("PfCCeurope.dat");
-    fi;
-    if Afrique=true:
-      Lecture("PfCCafrique.dat");
-    fi;
-  fi;
-  if lacs=true:
-    Lecturelacsp;
-    Lecturelacspsup;
-  fi;
-  Lectureilesp;
-  if capitales=true:
-    Lecturecapitalesp;
-  fi;
-  if fleuves=true:
-    Lecturerivieresp;
-    Lecturerivierespsup;
-  fi;
-  if maillage=true:
-    drawoptions(withcolor gris);
-    MeridienParallele;
-    drawoptions();
-  fi;
-  if Echelle=true:
-    draw ((Xa,Ya)+u*(1,1))--((Xa,Ya)+u*(2,1));
-    labeloffset:=labeloffset*1.5;
-    label.top(btex 0 etex,(Xa,Ya)+u*(1,1));
-    label.top(TEX(""&decimal(Long)&"~km"),(Xa,Ya)+u*(2,1));
-    labeloffset:=labeloffset/1.5;
-    draw ((Xa,Ya)+u*(1,1.1))--((Xa,Ya)+u*(1,0.9));
-    draw (((Xa,Ya)+u*(1,1.1))--((Xa,Ya)+u*(1,0.9))) shifted(u*(1,0));
-  fi;
-enddef;
-
-vardef Simple(expr TH,PH,Zoom)=
-  projection:="simple";
-  theta:=TH;
-  phi:=PH;
-  zoom(Zoom);
-  Lecture("PfCCameriquesud.dat");
-  Lecture("PfCCcaraibes.dat");
-  Lecture("PfCCameriquecentrale.dat");
-  Lecture("PfCCameriquenord.dat");
-  Lecture("PfCCasia.dat");
-  Lecture("PfCCeurope.dat");
-  Lecture("PfCCafrique.dat");
-  if lacs=true:
-    Lecturelacsp;
-    Lecturelacspsup;
-  fi;
-  Lectureilesp;
-  if capitales=true:
-    Lecturecapitalesp;
-  fi;
-  if fleuves=true:
-    Lecturerivieresp;
-   fi;
-  if maillage=true:
-    MeridienParallele
-  fi;
-enddef;
-
-vardef Mercator(expr TH,PH,Zoom)=
-  projection:="mercator";
-  theta:=TH;
-  phi:=PH;
-  zoom(Zoom);
-  Lecture("PfCCameriquesud.dat");
-  Lecture("PfCCcaraibes.dat");
-  Lecture("PfCCameriquecentrale.dat");
-  Lecture("PfCCameriquenord.dat");
-  Lecture("PfCCasia.dat");
-  Lecture("PfCCeurope.dat");
-  Lecture("PfCCafrique.dat");
-  if lacs=true:
-    Lecturelacsp;
-    Lecturelacspsup;
-  fi;
-  Lectureilesp;
-  if capitales=true:
-    Lecturecapitalesp;
-  fi;
-  if fleuves=true:
-    Lecturerivieresp;
-  fi;
-  if maillage=true:
-    MeridienParallele
-  fi;
-enddef;
-
-vardef Winkel(expr TH,PH,Zoom)=
-  projection:="winkel";
-  theta:=TH;
-  phi:=PH;
-  zoom(Zoom);
-  Lecture("PfCCameriquesud.dat");
-  Lecture("PfCCcaraibes.dat");
-  Lecture("PfCCameriquecentrale.dat");
-  Lecture("PfCCameriquenord.dat");
-  Lecture("PfCCasia.dat");
-  Lecture("PfCCeurope.dat");
-  Lecture("PfCCafrique.dat");
-  if lacs=true:
-    Lecturelacsp;
-    Lecturelacspsup;
-  fi;
-  Lectureilesp;
-  if capitales=true:
-    Lecturecapitalesp;
-  fi;
-  if fleuves=true:
-    Lecturerivieresp;
-  fi;
-  if maillage=true:
-    MeridienParallele;
-  fi;
-enddef;
-
-vardef Cylindrique(expr TH,PH,Zoom)=
-  projection:="cylindrique";
-  theta:=TH;
-  phi:=PH;
-  zoom(Zoom);
-  Lecture("PfCCameriquesud.dat");
-  Lecture("PfCCcaraibes.dat");
-  Lecture("PfCCameriquecentrale.dat");
-  Lecture("PfCCameriquenord.dat");
-  Lecture("PfCCasia.dat");
-  Lecture("PfCCeurope.dat");
-  Lecture("PfCCafrique.dat");
-  if lacs=true:
-    Lecturelacsp;
-    Lecturelacspsup;
-  fi;
-  Lectureilesp;
-  if capitales=true:
-    Lecturecapitalesp;
-  fi;
-  if fleuves=true:
-    Lecturerivieresp;
-  fi;
-  if maillage=true:
-    MeridienParallele
-  fi;
-enddef;
-
-vardef Bonne(expr TH,PH,Zoom)=
-  projection:="bonne";
-  theta:=TH;
-  phi:=PH;
-  zoom(Zoom);
-  fill (bonnec(-90,-180) for k=-85 step 5 until 90:..bonnec(k,-180) endfor)..reverse(bonnec(-90,180) for k=-85 step 5 until 90:..bonnec(k,180) endfor)..cycle withcolor couleurfond;
-  Lecture("PfCCameriquesud.dat");
-  Lecture("PfCCcaraibes.dat");
-  Lecture("PfCCameriquecentrale.dat");
-  Lecture("PfCCameriquenord.dat");
-  Lecture("PfCCasie.dat");
-  Lecture("PfCCeurope.dat");
-  Lecture("PfCCafrique.dat");
-  if lacs=true:
-    Lecturelacsp;
-    Lecturelacspsup;
-  fi;
-  Lectureilesp;
-  if capitales=true:
-    Lecturecapitalesp;
-  fi;
-  if fleuves=true:
-    Lecturerivieresp;
-  fi;
-  if maillage=true:
-    drawoptions(withcolor gris);
-    MeridienParallele;
-    drawoptions();
-  fi;
-  draw (bonnec(-90,-180) for k=-85 step 5 until 90:..bonnec(k,-180) endfor)..reverse(bonnec(-90,180) for k=-85 step 5 until 90:..bonnec(k,180) endfor)..cycle;
-enddef;
-
-vardef ConiqueH=
-  projection:="coniqueh";
-  Lecture("PfCCameriquesud.dat");
-  Lecture("PfCCcaraibes.dat");
-  Lecture("PfCCameriquecentrale.dat");
-  Lecture("PfCCameriquenord.dat");
-  Lecture("PfCCasie.dat");
-  Lecture("PfCCeurope.dat");
-  Lecture("PfCCafrique.dat");
-  if lacs=true:
-    Lecturelacsp;
-    Lecturelacspsup;
-  fi;
-  Lectureilesp;
-  if capitales=true:
-    Lecturecapitalesp;
-  fi;
-  if fleuves=true:
-    Lecturerivieresp;
-    Lecturerivierespsup;
-  fi;
-  drawoptions(withcolor gris);
-  MeridienParallele;
-  drawoptions();
-enddef;
-
-vardef ConiqueB=
-  projection:="coniqueb";
-  Lecture("PfCCameriquesud.dat");
-  Lecture("PfCCcaraibes.dat");
-  Lecture("PfCCameriquecentrale.dat");
-  Lecture("PfCCameriquenord.dat");
-  Lecture("PfCCasie.dat");
-  Lecture("PfCCeurope.dat");
-  Lecture("PfCCafrique.dat");
-  if lacs=true:
-    Lecturelacsp;
-    Lecturelacspsup;
-  fi;
-  Lectureilesp;
-  if capitales=true:
-    Lecturecapitalesp;
-  fi;
-  if fleuves=true:
-    Lecturerivieresp;
-    Lecturerivierespsup;
-  fi;
-  drawoptions(withcolor gris);
-  MeridienParallele;
-  drawoptions();
-enddef;
-
-%%%%%%%
-
-rayon:=2;
-
-boolean fleuves,lacs,capitales,noncolore,maillage,volcans;
-fleuves=true;
-lacs=true;
-capitales=true;
-noncolore=false;
-maillage=false;
-volcans=false;
-
-color couleurfond,couleurmaillage,couleurfleuve;
-couleurfond:=ciel;
-couleurmaillage:=gris;
-couleurfleuve:=cielfonce;
-
-vardef Mappemonde(expr longobs,latobs)=
-  projection:="non";
-  %figureespace(-100u,-100u,100u,100u);
-  Initialisation(5,longobs,latobs,distanceecran);
-  numeric phim,phip,phii;%phi moins -- phi plus - phi interm\xE9diaire
-  phim=Phi+arcsind(rayon/Rho)-90;
-  phip=Phi+90-arcsind(rayon/Rho);
-  color pte[];
-  pte1=rayon*(cosd(phim)*cosd(Theta),cosd(phim)*sind(Theta),sind(phim));
-  pte2=rayon*(cosd(phip)*cosd(Theta),cosd(phip)*sind(Theta),sind(phip));
-  pte3=1/2[pte1,pte2];
-  pte4-pte3=Normal((0,0,0),pte1,pte2);
-  if (Phi>90):
-    phip:=180-phip;
-    phii:=180-phim;
-    phim:=phip;
-    phip:=phii;
-  fi;
-  if (Phi<-90):
-    phip:=-180-phip;
-    phii:=-180-phim;
-    phim:=phip;
-    phip:=phii;
-  fi;
-  fill cercles(pte3,pte1,pte3,pte1,pte4) withcolor couleurfond;
-  Lecture("PfCCameriquesud.dat");
-  Lecture("PfCCcaraibes.dat");
-  Lecture("PfCCameriquecentrale.dat");
-  Lecture("PfCCameriquenord.dat");
-  Lecture("PfCCasie.dat");
-  Lecture("PfCCeurope.dat");
-  Lecture("PfCCafrique.dat");
-  if volcans=true:
-    Lecturevolcans;
-  fi;
-  if lacs=true:
-    Lecturelacs;
-    Lecturelacssup;
-  fi;
-  Lectureiles;
-  if capitales=true:
-    Lecturecapitales;
-  fi;
-  if fleuves=true:
-    Lecturerivieres;
-    %Lecturerivieressup;
-  fi;
-  if maillage=true:
-    drawoptions(withcolor couleurmaillage);
-    MaillageSphere;
-    drawoptions();
-  fi;
-  if maille=true:
-    Maille;
-  fi;
-  draw cercles(pte3,pte1,pte3,pte1,pte4);
-  %finespace;
-enddef;
-
-vardef mappemonde(expr longobs,latobs)=
-  projection:="non";
-  %figureespace(-100u,-100u,100u,100u);
-  Initialisation(5,longobs,latobs,distanceecran);
-  numeric phim,phip,phii;%phi moins -- phi plus - phi interm\xE9diaire
-  phim=Phi+arcsind(rayon/Rho)-90;
-  phip=Phi+90-arcsind(rayon/Rho);
-  color pte[];
-  pte1=rayon*(cosd(phim)*cosd(Theta),cosd(phim)*sind(Theta),sind(phim));
-  pte2=rayon*(cosd(phip)*cosd(Theta),cosd(phip)*sind(Theta),sind(phip));
-  pte3=1/2[pte1,pte2];
-  pte4-pte3=Normal((0,0,0),pte1,pte2);
-  if (Phi>90):
-    phip:=180-phip;
-    phii:=180-phim;
-    phim:=phip;
-    phip:=phii;
-  fi;
-  if (Phi<-90):
-    phip:=-180-phip;
-    phii:=-180-phim;
-    phim:=phip;
-    phip:=phii;
-  fi;
-  fill cercles(pte3,pte1,pte3,pte1,pte4) withcolor couleurfond;
-  Lecture("PfCCameriquesud.dat");
-  Lecture("PfCCcaraibes.dat");
-  Lecture("PfCCameriquecentrale.dat");
-  Lecture("PfCCameriquenord.dat");
-  Lecture("PfCCasie.dat");
-  Lecture("PfCCeurope.dat");
-  Lecture("PfCCafrique.dat");
-  if volcans=true:
-    Lecturevolcans;
-  fi;
-  if lacs=true:
-    Lecturelacs;
-    Lecturelacssup;
-  fi;
-  Lectureiles;
-  if capitales=true:
-    Lecturecapitales;
-  fi;
-  if fleuves=true:
-    Lecturerivieres;
-    %Lecturerivieressup;
-  fi;
-  if maillage=true:
-    drawoptions(withcolor couleurmaillage);
-    MaillageSphere;
-    drawoptions();
-  fi;
-  if maille=true:
-    Maille;
-  fi;
-  draw cercles(pte3,pte1,pte3,pte1,pte4);
-%  finespace;
-enddef;
-
-endinput;

Added: trunk/Master/texmf-dist/metapost/profcollege/PfCMonde.mp
===================================================================
--- trunk/Master/texmf-dist/metapost/profcollege/PfCMonde.mp	                        (rev 0)
+++ trunk/Master/texmf-dist/metapost/profcollege/PfCMonde.mp	2023-07-04 19:53:24 UTC (rev 67545)
@@ -0,0 +1,1617 @@
+%Package mp-geographie
+%Auteur:Christophe Poulain
+%Version 0.62
+%16/02/2010
+
+input marith;
+input sarith;
+%input LATEX;
+
+pi:=3.141592654;
+c:=57.29578; % conversion d'un radian en degr\xE9s
+
+color _T[],rouge,vert,bleu,jaune,noir,blanc,orange,rose,violet,ciel,cielfonce,orangevif,gris,tan,payscolor;
+
+rouge=(1,0,0);
+bleu=(0,0,1);
+noir=(0,0,0);
+blanc=(1,1,1);
+orange=(1,0.5,0);
+violet=(1,0,1);
+rose=(1,0.7,0.7);
+cielfonce=(0.25,0.75,1);
+ciel=(0,1,1);
+orangevif=(1,0.25,0.1);
+vert=(0,1,0);
+jaune=(1,1,0);
+gris=0.8*white;
+
+tan=(0.824,0.705,0.55);
+payscolor=tan;
+
+vardef flamme=reverse(2mm*(0.5,1){dir90}..2mm*(0.75,1.5)..{dir90}2mm*(1,2))--2mm*(0.5,1){dir=-90}..2mm*(1,0.5)..{dir=90}2mm*(1.5,1)--((2mm*(0.5,1){dir90}..2mm*(0.75,1.5)..{dir90}2mm*(1,2)) reflectedabout (2mm*(1,0),2mm*(1,0)+2mm*(0,1)))--cycle
+enddef;
+
+%Les marques
+
+string marque_p;
+marque_p := "non";
+marque_r := 20;
+
+def MarquePoint(expr p)=
+  if marque_p = "creux":
+    if color p:
+      fill fullcircle scaled (marque_r/5) shifted (Projgeo(p)) withcolor white;
+      draw fullcircle scaled (marque_r/5) shifted (Projgeo(p));
+    else:
+      fill fullcircle scaled (marque_r/5) shifted (p) withcolor white;
+      draw fullcircle scaled (marque_r/5) shifted (p);
+    fi;
+  elseif marque_p = "croix":
+    drawoptions(withpen pencircle scaled 1.25);
+    if color p:
+      draw (Projgeo(p) shifted (-marque_r/20,marque_r/20))--(Projgeo(p) shifted (marque_r/20,-marque_r/20));
+      draw (Projgeo(p) shifted (-marque_r/20,-marque_r/20))--(Projgeo(p) shifted (marque_r/20,marque_r/20));
+    else:
+      draw ((p) shifted (-marque_r/20,marque_r/20))--((p) shifted (marque_r/20,-marque_r/20));
+      draw ((p) shifted (-marque_r/20,-marque_r/20))--((p) shifted (marque_r/20,marque_r/20));
+    fi;
+    drawoptions();
+  fi;
+enddef;
+
+vardef pointe(text t) =
+  for p_ = t: if (pair p_) or (color p_): MarquePoint(p_); fi endfor;
+enddef;
+
+%D\xE9finition pour la feuille
+
+path feuillet;
+numeric _tfig,_nfig;
+_nfig:=0;
+u:=1cm;
+
+def feuille(expr xa,ya,xb,yb) =
+  numeric Xa,Ya;
+  Xa=xa;
+  Ya=ya;
+  feuillet := (xa,ya)--(xa,yb)--(xb,yb)--(xb,ya)--cycle;
+  extra_endfig := "clip currentpicture to feuillet;" & extra_endfig;
+enddef;
+
+def figureespace(expr xa,ya,xb,yb) =
+  _nfig:=_nfig+1;
+  beginfig(_nfig);
+    feuille(xa,ya,xb,yb);
+enddef;  
+
+def finespace=
+endfig;
+enddef;
+
+def figure(expr xa,ya,xb,yb)=figureespace(xa,ya,xb,yb)
+enddef;
+
+def fin=finespace
+enddef;
+
+%definitions math\xE9matiques
+vardef cercles(text t)=
+  save Cer;
+  save n;
+  n:=0;
+  for p_=t:
+    if color p_:
+      n:=n+1;
+      _T[n]:=p_;
+    fi;
+  endfor;
+  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=Projgeo(ptcer0)
+  for k=0 step 5 until 360 :
+    ..Projgeo(ptcer[k div 5])
+  endfor
+  ..cycle;
+  Cer
+enddef;
+
+vardef arcsind(expr x)=%en degr\xE9 ici :)
+  angle((sqrt(1-x**2),x))
+enddef;
+
+vardef arccosd(expr x)=%en degr\xE9 ici :)
+  angle((x,sqrt(1-x**2)))
+enddef;
+
+vardef tand(expr x)=sind(x)/cosd(x)%
+enddef;
+
+vardef cotand(expr x)=cosd(x)/sind(x)%
+enddef;
+
+vardef sinc(expr x)=if abs(x)<0.001:1 else:sind(x)*c/x fi enddef;
+
+vardef ln(expr t)=mlog(t)/256%
+enddef;
+
+%repr\xE9sentation param\xE9trique de la sph\xE8re terrestre.
+vardef FX(expr t,v)=rayon*cosd(c*t)*cosd(c*v)
+enddef;
+
+vardef FY(expr t,v)=rayon*cosd(c*t)*sind(c*v)
+enddef;
+
+vardef FZ(expr t,v)=rayon*sind(c*t)
+enddef;
+
+%Param\xE8tres et macros de repr\xE9sentation
+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;
+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 MaillageS=
+  path Maillage[];
+  color CentMaillage[];
+  %numeric Vmin,Vmax;
+  %total:=0;
+  for k=Udebut step 0.5*pasU until (Ufin):
+    for l=Vdebut step pasV until (Vfin):
+      Maillage[100*k+l]=Projgeo((FX(k,l),FY(k,l),FZ(k,l)))--Projgeo((FX(k,l+pasV),FY(k,l+pasV),FZ(k,l+pasV)))--Projgeo((FX(k+pasU,l+pasV),FY(k+pasU,l+pasV),FZ(k+pasU,l+pasV)))--Projgeo((FX(k+pasU,l),FY(k+pasU,l),FZ(k+pasU,l)))--cycle;
+      if ProduitScalaire(1/2[(FX(k,l),FY(k,l),FZ(k,l)),(FX(k+pasU,l+pasV),FY(k+pasU,l+pasV),FZ(k+pasU,l+pasV))]-pte3,Oeil-pte3)>0:
+	draw Maillage[100*k+l];
+      fi;
+    endfor;
+  endfor;
+enddef;
+
+vardef InitialiseMaillage(expr ud,uf,up,vd,vf,vp)=
+  Udebut:=ud;
+  Ufin:=uf;
+  pasU:=up;
+  Vdebut:=vd;
+  Vfin:=vf;
+  pasV:=vp;
+enddef;
+
+vardef MaillageSphere=
+  InitialiseMaillage(((phim div 10)+1)*pi/18,((phip div 10)-1)*pi/18,pi/18,-pi,pi,pi/36);
+  MaillageS;
+enddef;
+
+boolean maille;
+maille=false;
+
+vardef ParaMeri(expr lonn,latt)=%longitude et latitude en degr\xE9s%Parall\xE8le et m\xE9ridien particulier pour une repr\xE9sentation 3d.
+  maille:=true;
+  latpar:=latt;
+  lonpar:=lonn;
+enddef;
+
+vardef Maille=
+  InitialiseMaillage(((phim div 10)+1)*pi/18,((phip div 10)-1)*pi/18,pi/36,-pi,pi,pi/72);
+  path SMaillage[];picture Smaille;
+  drawoptions(withpen pencircle scaled 2bp withcolor orangevif);
+  for l=Vdebut step pasV until (Vfin+pasV):
+    SMaillage[100*latpar+l]=Projgeo((FX(latpar/c,l),FY(latpar/c,l),FZ(latpar/c,l)))--Projgeo((FX(latpar/c,l+pasV),FY(latpar/c,l+pasV),FZ(latpar/c,l+pasV)));
+    if ProduitScalaire(1/2[(FX(latpar/c,l),FY(latpar/c,l),FZ(latpar/c,l)),(FX(latpar/c,l+pasV),FY(latpar/c,l+pasV),FZ(latpar/c,l+pasV))]-pte3,Oeil-pte3)>0:
+      draw SMaillage[100*latpar+l];
+    fi;
+  endfor;
+  for k=Udebut step pasU until (Ufin+pasU):
+    SMaillage[k+100*lonpar]:=Projgeo((FX(k,lonpar/c),FY(k,lonpar/c),FZ(k,lonpar/c)))--Projgeo((FX(k+pasU,lonpar/c),FY(k+pasU,lonpar/c),FZ(k+pasU,lonpar/c)));
+    if ProduitScalaire(1/2[(FX(k,lonpar/c),FY(k,lonpar/c),FZ(k,lonpar/c)),(FX(k+pasU,lonpar/c),FY(k+pasU,lonpar/c),FZ(k+pasU,lonpar/c))]-pte3,Oeil-pte3)>0:
+      draw SMaillage[k+100*lonpar];
+    fi;
+  endfor;
+  drawoptions();
+    %);
+enddef;
+
+vardef Projgeo(expr X)=
+  pair $;
+  numeric Xobs,Yobs,Zobs,XProj,YProj;
+  Xobs = -redpart(X)*Aux1 + greenpart(X)*Aux3;
+  Yobs = -redpart(X)*Aux5 - greenpart(X)*Aux6 + bluepart(X)*Aux4;
+  Zobs = -redpart(X)*Aux7 - greenpart(X)*Aux8 - bluepart(X)*Aux2 + Rho;
+  XProj = DE*Xobs/Zobs;
+  YProj = DE*Yobs/Zobs;
+  $=(XProj,YProj);
+  $
+enddef;
+
+%D\xE9but du package
+numeric nbpts,nblec,nbcapitales;
+
+vardef lecture(expr nomfichier,fond)=
+  color Coord[],Pays[];
+  numeric ll;
+  ll:=0;
+  nbpts:=scantokens readfrom nomfichier;
+  for k=1 upto (nbpts div 3):
+    pair latlon;
+    latlon=((scantokens readfrom nomfichier)+(scantokens readfrom nomfichier)+(scantokens readfrom nomfichier))/3;
+    Coord[k]=rayon*(cosd(xpart(latlon/60))*cosd(ypart(latlon/60)),cosd(xpart(latlon/60))*sind(ypart(latlon/60)),sind(xpart(latlon/60)));
+    if ((xpart(latlon/60)>phim) and (xpart(latlon/60)<phip)):
+      if ProduitScalaire(Coord[k]-pte3,Oeil-pte3)>0:
+	ll:=ll+1;
+	Pays[k]=Coord[k];
+      else:
+	Pays[k]=2*Coord[k];
+      fi;
+    else:
+      Pays[k]=2*Coord[k];
+    fi;
+  endfor;
+  closefrom nomfichier;
+  path pays;
+  if ll>0:
+    pays=Projgeo(Pays[1])
+    for l=2 upto (nbpts div 3):
+      --Projgeo(Pays[l])
+    endfor;
+    if noncolore=true:
+      fill pays--cycle withcolor payscolor;
+    else:
+      fill pays--cycle withcolor fond;
+    fi;
+    draw pays;
+    clip currentpicture to cercles(pte3,pte1,pte3,pte1,pte4);
+  fi;
+enddef;
+
+string nomfichiermul,NomFichier;
+
+vardef Lectureiles=
+  nomfichiermul:=arborescence&"PfCiles.dat";
+  nblec:=scantokens readfrom nomfichiermul;
+  for p=1 upto nblec:
+    color Coord[],fond,Pays[];
+    numeric ll;
+    ll:=0;
+    nbpts:=scantokens readfrom nomfichiermul;
+    fond=scantokens readfrom nomfichiermul;
+    for k=1 upto nbpts:
+      pair latlon;
+      latlon=scantokens readfrom nomfichiermul;
+      Coord[k]=rayon*(cosd(xpart(latlon/60))*cosd(ypart(latlon/60)),cosd(xpart(latlon/60))*sind(ypart(latlon/60)),sind(xpart(latlon/60)));
+      if ((xpart(latlon/60)>phim) and (xpart(latlon/60)<phip)):
+	if ProduitScalaire(Coord[k]-pte3,Oeil-pte3)>0:
+	  ll:=ll+1;
+	  Pays[k]=Coord[k];
+	else:
+	  Pays[k]=2*Coord[k];
+	fi;
+      else:
+	Pays[k]=2*Coord[k];
+      fi;
+    endfor;
+    path pays;
+     if ll>0:
+      pays=Projgeo(Pays[1])
+      for l=2 upto nbpts:
+	--Projgeo(Pays[l])
+      endfor;
+      if noncolore=true:
+	fill pays--cycle withcolor payscolor;
+      else:
+	fill pays--cycle withcolor fond;
+      fi;
+      draw pays;
+      clip currentpicture to cercles(pte3,pte1,pte3,pte1,pte4);
+    fi;
+  endfor;
+  closefrom nomfichiermul;
+enddef;
+
+vardef Lecturelacs=
+  nomfichiermul:=arborescence&"PfClacs.dat";
+  nblec:=scantokens readfrom nomfichiermul;
+  for p=1 upto nblec:
+    color Coord[],Pays[];
+    numeric ll;
+    ll:=0;
+    nbpts:=scantokens readfrom nomfichiermul;
+    for k=1 upto nbpts:
+      pair latlon;
+      latlon=scantokens readfrom nomfichiermul;
+      Coord[k]=rayon*(cosd(xpart(latlon/60))*cosd(ypart(latlon/60)),cosd(xpart(latlon/60))*sind(ypart(latlon/60)),sind(xpart(latlon/60)));
+      if ((xpart(latlon/60)>phim) and (xpart(latlon/60)<phip)):
+	if ProduitScalaire(Coord[k]-pte3,Oeil-pte3)>0:
+	  ll:=ll+1;
+	  Pays[k]=Coord[k];
+	else:
+	  Pays[k]=2*Coord[k];
+	fi;
+      else:
+	Pays[k]=2*Coord[k];
+      fi;
+    endfor;
+    path pays;
+    if ll>0:
+      pays=Projgeo(Pays[1])
+      for l=2 upto nbpts:
+	--Projgeo(Pays[l])
+      endfor;
+      fill pays--cycle withcolor couleurfleuve;
+      draw pays;
+      clip currentpicture to cercles(pte3,pte1,pte3,pte1,pte4);
+    fi;
+  endfor;
+  closefrom nomfichiermul;
+enddef;
+
+vardef Lecturelacssup=
+  nomfichiermul:=arborescence&"PfClacssup.dat";
+  nblec:=scantokens readfrom nomfichiermul;
+  for p=1 upto nblec:
+    color Coord[],Pays[];
+    numeric ll;
+    ll:=0;
+    nbpts:=scantokens readfrom nomfichiermul;
+    for k=1 upto nbpts:
+      pair latlon;
+      latlon=scantokens readfrom nomfichiermul;
+      Coord[k]=rayon*(cosd(xpart(latlon))*cosd(ypart(latlon)),cosd(xpart(latlon))*sind(ypart(latlon)),sind(xpart(latlon)));
+      if ((xpart(latlon)>phim) and (xpart(latlon)<phip)):
+	if ProduitScalaire(Coord[k]-pte3,Oeil-pte3)>0:
+	  ll:=ll+1;
+	  Pays[k]=Coord[k];
+	else:
+	  Pays[k]=2*Coord[k];
+	fi;
+      else:
+	Pays[k]=2*Coord[k];
+      fi;
+    endfor;
+    path pays;
+    if ll>0:
+      pays=Projgeo(Pays[1])
+      for l=2 upto nbpts:
+	--Projgeo(Pays[l])
+      endfor;
+      fill pays--cycle withcolor couleurfleuve;
+      draw pays;
+      clip currentpicture to cercles(pte3,pte1,pte3,pte1,pte4);
+    fi;
+  endfor;
+  closefrom nomfichiermul;
+enddef;
+
+vardef Lecturevolcans=
+  drawoptions(withcolor orange);
+  nomfichiermul:=arborescence&"PfCvolcans.dat";
+  nblec:=scantokens readfrom nomfichiermul;
+  show nblec;
+  for p=1 upto nblec:
+    color Coord[],Pays[];
+    pair latlon;
+    latlon=scantokens readfrom nomfichiermul;
+    Coord[p]=rayon*(cosd(xpart(latlon/60))*cosd(ypart(latlon/60)),cosd(xpart(latlon/60))*sind(ypart(latlon/60)),sind(xpart(latlon/60)));
+    if ((xpart(latlon/60)>phim) and (xpart(latlon/60)<phip)):
+      if ProduitScalaire(Coord[p]-pte3,Oeil-pte3)>0:
+	Pays[p]=Coord[p];
+	fill flamme shifted Projgeo(Pays[p]) withcolor 1/2[orange,jaune];
+      %else:
+%	Pays[k]=2*Coord[k];
+      fi;
+%    else:
+%      Pays[k]=2*Coord[k];
+    fi;
+  endfor;
+closefrom nomfichiermul;
+drawoptions();
+enddef;
+
+vardef Lecturerivieres=
+  nomfichiermul:=arborescence&"PfCrivieres.dat";
+  nblec:=scantokens readfrom nomfichiermul;
+  for p=1 upto nblec:
+    color Coord[],fond,Pays[];
+    numeric ll;
+    ll:=0;
+    nbpts:=scantokens readfrom nomfichiermul;
+    for k=1 upto nbpts:
+      pair latlon;
+      latlon=scantokens readfrom nomfichiermul;
+      Coord[k]=rayon*(cosd(xpart(latlon/60))*cosd(ypart(latlon/60)),cosd(xpart(latlon/60))*sind(ypart(latlon/60)),sind(xpart(latlon/60)));
+      if ((xpart(latlon/60)>phim) and (xpart(latlon/60)<phip)):
+	if ProduitScalaire(Coord[k]-pte3,Oeil-pte3)>0:
+	  ll:=ll+1;
+	  Pays[k]=Coord[k];
+	else:
+	  Pays[k]=2*Coord[k];
+	fi;
+      else:
+	Pays[k]=2*Coord[k];
+      fi;
+    endfor;
+    path pays;
+    if ll>0:
+      pays=Projgeo(Pays[1])
+      for l=2 upto nbpts:
+	--Projgeo(Pays[l])
+      endfor;
+      draw pays withcolor couleurfleuve;
+      clip currentpicture to cercles(pte3,pte1,pte3,pte1,pte4);
+    fi;
+  endfor;
+  closefrom nomfichiermul;
+enddef;
+
+vardef Lecturerivieressup=
+  nomfichiermul:=arborescence&"PfCfleuveseurope.dat";
+  nblec:=scantokens readfrom nomfichiermul;
+  for p=1 upto nblec:
+    color Coord[],fond,Pays[];
+    numeric ll;
+    ll:=0;
+    nbpts:=scantokens readfrom nomfichiermul;
+    for k=1 upto nbpts:
+      pair latlon;
+      latlon=scantokens readfrom nomfichiermul;
+      Coord[k]=rayon*(cosd(xpart(latlon))*cosd(ypart(latlon)),cosd(xpart(latlon))*sind(ypart(latlon)),sind(xpart(latlon)));
+      if ((xpart(latlon)>phim) and (xpart(latlon)<phip)):
+	if ProduitScalaire(Coord[k]-pte3,Oeil-pte3)>0:
+	  ll:=ll+1;
+	  Pays[k]=Coord[k];
+	else:
+	  Pays[k]=2*Coord[k];
+	fi;
+      else:
+	Pays[k]=2*Coord[k];
+      fi;
+    endfor;
+    path pays;
+    if ll>0:
+      pays=Projgeo(Pays[1])
+      for l=2 upto nbpts:
+	--Projgeo(Pays[l])
+      endfor;
+      draw pays withcolor couleurfleuve;
+      clip currentpicture to cercles(pte3,pte1,pte3,pte1,pte4);
+    fi;
+  endfor;
+  closefrom nomfichiermul;
+enddef;
+
+vardef Lecturecapitales=
+  marque_p:="creux";
+  nomfichiermul:=arborescence&"PfCcapitales.dat";
+  nbcapitales:=scantokens readfrom nomfichiermul;
+  for p=1 upto nbcapitales:
+    color Coord[];
+    pair latlon;
+    picture Nom;
+    string p_;
+    p_=scantokens readfrom nomfichiermul;
+    latlon=scantokens readfrom nomfichiermul;
+    Coord[p]=rayon*(cosd(xpart(latlon/60))*cosd(ypart(latlon/60)),cosd(xpart(latlon/60))*sind(ypart(latlon/60)),sind(xpart(latlon/60)));
+    Nom=image(
+      label.top(TEX(""&p_&""),Projgeo(Coord[p]));
+      );
+    if ((xpart(latlon/60)>phim) and (xpart(latlon/60)<phip)):
+      if ProduitScalaire(Coord[p]-pte3,Oeil-pte3)>0:
+	pointe(Coord[p]);
+	%draw Nom;
+      fi;
+    fi;
+  endfor;
+  closefrom nomfichiermul;
+  marque_p:="non";
+enddef;
+
+vardef Lecture(expr Nomfichier)=
+  NomFichier:=arborescence&"PfC"&Nomfichier;
+  nblec:=scantokens readfrom NomFichier;
+  for w=1 upto nblec:
+    if projection="non":
+      lecture(scantokens readfrom NomFichier);
+    else:
+      lecturep(scantokens readfrom NomFichier);
+    fi;
+  endfor;
+  closefrom NomFichier;
+enddef;
+
+%Pour les projections
+string projection;
+projection:="non";
+
+vardef zoom(expr nbzoom)=
+  if projection="mercator":
+    xunit:=nbzoom;
+    yunit:=nbzoom*2*cm;
+  elseif projection="cylindrique":
+    xunit:=2.5*nbzoom;
+    yunit:=nbzoom*10*cm;
+  elseif projection="winkel":
+    xunit:=nbzoom*0.5*mm;
+    yunit:=nbzoom;
+  elseif projection="simple":
+    xunit:=nbzoom*0.5*mm;
+    yunit:=nbzoom*0.5*mm;
+  elseif projection="bonne":
+    xunit:=nbzoom*4*cm;
+    yunit:=xunit;
+  fi;
+enddef;
+
+vardef mercatorc(expr aa,bb)=
+  (xunit*(bb-theta),yunit*(ln(abs(tand(45+(aa/2))))-ln(abs(tand(45+(phi/2))))))
+enddef;
+
+vardef coniquec(expr aa,bb,pc)=
+  abscon:=5*cm*(cosd(aa)*sind(bb*sind(pc)))/(sind(pc)*cosd(aa-pc));
+  ordcon:=5*cm*(cosd(aa)*cosd(bb*sind(pc)))/(sind(pc)*cosd(aa-pc));
+  (abscon,ordcon)
+enddef;
+
+vardef cylindriquec(expr aa,bb)=
+  (xunit*(bb-theta),yunit*(sind(aa)-sind(phi)))
+enddef;
+
+vardef simplec(expr aa,bb)=
+  (xunit*(bb-theta),yunit*(aa-phi))
+enddef;
+
+vardef bonnec(expr aaa,bbb)=
+  save tt;
+  pair tt;
+  rho:=cotand(phi)+(phi-aaa)/c;
+  E:=(((bbb-theta)/c)/rho)*cosd(aaa);
+  tt=xunit*(rho*sind(E*c),cotand(phi)-rho*cosd(E*c));
+  tt
+enddef;
+
+vardef winkelc(expr aaa,bbb)=
+  save ttw;
+  pair ttw;
+  alphawinkel:=arccosd(cosd(aaa)*cosd(0.5*bbb));
+  if alphawinkel=0:
+    xwinkel:=0;
+    ywinkel:=0;
+  else:
+    xwinkel:=xunit*0.5*(bbb*cosd(arccosd(2/pi))+(2*cosd(aaa)*sind(0.5*bbb)/sinc(alphawinkel)));
+    ywinkel:=yunit*0.5*(aaa+sind(aaa)/sinc(alphawinkel));
+  fi;
+  ttw=(xwinkel,ywinkel);
+  ttw
+enddef;
+
+vardef lecturep(expr nomfichier,fond)=
+  pair Coord[];
+  nbpts:=scantokens readfrom nomfichier;
+  numeric ll;
+  ll=0;
+  for k=1 upto nbpts:
+    pair latlon;
+    latlon=scantokens readfrom nomfichier;
+    if projection="mercator":
+      Coord[k]=mercatorc(xpart(latlon/60),ypart(latlon/60))
+    elseif projection="winkel":
+      Coord[k]=winkelc(xpart(latlon/60),ypart(latlon/60))
+    elseif projection="cylindrique":
+      Coord[k]=cylindriquec(xpart(latlon/60),ypart(latlon/60));
+    elseif projection="simple":
+      Coord[k]=simplec(xpart(latlon/60),ypart(latlon/60));
+    elseif projection="bonne":
+      Coord[k]=bonnec(xpart(latlon/60),ypart(latlon/60));
+    elseif projection="coniqueh":
+      if (xpart(latlon)>0) or (xpart(latlon)=0):
+	ll:=ll+1;
+	Coord[ll]=coniquec(xpart(latlon/60),ypart(latlon/60),45);
+      fi;
+    elseif projection="coniqueb":
+      if (xpart(latlon)<0):
+	ll:=ll+1;
+	Coord[ll]=coniquec(xpart(latlon/60),ypart(latlon/60),-45);
+      fi;
+    fi;
+  endfor;
+  closefrom nomfichier;
+  path pays;
+  if (projection="mercator") or (projection="winkel") or(projection="cylindrique") or (projection="simple") or (projection="bonne"):
+    ll:=nbpts
+  fi;
+  if ll>0:
+    pays=Coord[1]
+    for l=4 step 3 until ll:%upto ll:
+      --Coord[l]
+    endfor;
+    if noncolore=true:
+      fill pays--cycle withcolor payscolor;
+    else:
+      fill pays--cycle withcolor fond;
+    fi;
+    draw pays;
+  fi;
+enddef;
+
+vardef Lectureilesp=
+  if (projection="mercator") or (projection="winkel") or (projection="cylindrique") or (projection="simple") or (projection="bonne"):
+    nomfichiermul:=arborescence&"PfCIle.dat";
+  else:
+    nomfichiermul:=arborescence&"PfCiles.dat";
+  fi;
+  nblec:=scantokens readfrom nomfichiermul;
+  if projection="bonne":
+    nblec:=nblec-1
+  fi;
+  for p=1 upto nblec:
+    pair Coord[];color fond;
+    nbpts:=scantokens readfrom nomfichiermul;
+    fond=scantokens readfrom nomfichiermul;
+    numeric ll;
+    ll=0;
+    for k=1 upto nbpts:
+      pair latlon;
+      latlon=scantokens readfrom nomfichiermul;
+      if projection="mercator":
+	Coord[k]=mercatorc(xpart(latlon/60),ypart(latlon/60));
+      elseif projection="winkel":
+	Coord[k]=winkelc(xpart(latlon/60),ypart(latlon/60));
+      elseif projection="simple":
+	Coord[k]=simplec(xpart(latlon/60),ypart(latlon/60));
+      elseif projection="cylindrique":
+	Coord[k]=cylindriquec(xpart(latlon/60),ypart(latlon/60));
+      elseif projection="bonne":
+	Coord[k]=bonnec(xpart(latlon/60),ypart(latlon/60));
+      elseif projection="coniqueh":
+	if (xpart(latlon)>0) or (xpart(latlon)=0):
+	  ll:=ll+1;
+	  Coord[ll]=coniquec(xpart(latlon/60),ypart(latlon/60),45)
+	fi;
+      elseif projection="coniqueb":
+	if (xpart(latlon)<0):
+	  ll:=ll+1;
+	  Coord[ll]=coniquec(xpart(latlon/60),ypart(latlon/60),-45);
+	fi;
+      fi;
+    endfor;
+    path pays;
+    if (projection="mercator") or (projection="winkel") or (projection="cylindrique") or (projection="simple") or (projection="bonne"):
+      ll:=nbpts
+    fi;
+    if ll>0:
+      pays=Coord[1]
+      for l=2 upto ll:
+	--Coord[l]
+      endfor;
+      if noncolore=true:
+	fill pays--cycle withcolor payscolor;
+      else:
+	fill pays--cycle withcolor fond;
+      fi;
+      draw pays;
+    fi;
+  endfor;
+  closefrom nomfichiermul;
+  if (projection="mercator") or (projection="winkel") or (projection="cylindrique") or (projection="simple"):
+    clip currentpicture to feuillet;
+  fi;
+  if projection="bonne":
+    lecturep(arborescence&"PfCpolesud.dat",blanc);
+    clip currentpicture to (bonnec(-90,-180) for k=-89 upto 90:..bonnec(k,-180) endfor)..reverse(bonnec(-90,180) for k=-89 upto 90:..bonnec(k,180) endfor)..cycle;
+  fi;
+enddef;
+
+%14/05/2017
+boolean ecriturevilles;
+ecriturevilles:=true;
+%14/05/2017
+
+vardef Lecturevillesp(expr nompays)=
+  nomfichiermul:=arborescence&"PfCvilles"&nompays&".dat";
+  nblec:=scantokens readfrom nomfichiermul;
+  drawoptions(withcolor (0.15,0.15,0.15)); 
+  for p=1 upto nblec:
+    pair Coord[],latlon;string p_;
+    latlon=scantokens readfrom nomfichiermul;
+    p_=scantokens readfrom nomfichiermul;
+    if projection="mercator":
+      Coord[p]=mercatorc(ypart(latlon),xpart(latlon));
+    elseif projection="winkel":
+      Coord[p]=winkelcc(ypart(latlon),xpart(latlon));
+    elseif projection="simple":
+      Coord[p]=simplec(ypart(latlon),xpart(latlon));
+    elseif projection="cylindrique":
+      Coord[p]=cylindriquec(ypart(latlon),xpart(latlon));
+    elseif projection="bonne":
+	Coord[p]=bonnec(ypart(latlon),xpart(latlon));
+    fi;
+    if (projection="mercator") or (projection="winkel") or (projection="cylindrique") or (projection="simple") or (projection="bonne"):
+      if ecriturevilles=true:
+	dotlabel.scantokens readfrom nomfichiermul(TEX(""&p_&""),Coord[p]);
+      else:
+	dotlabel.scantokens readfrom nomfichiermul("",Coord[p]);
+      fi;
+    fi;
+  endfor;
+  drawoptions();
+  closefrom nomfichiermul;
+enddef;
+
+%16/02/2010
+
+vardef Lecturevilles(expr nomfich)=
+marque_p:="creux";
+  nomfichiermul:=nomfich&".dat";
+  nbcapitales:=scantokens readfrom nomfichiermul;
+  for p=1 upto nbcapitales:
+    color Coord[];
+    pair latlon;
+    picture Nom;
+    string p_;
+    p_=scantokens readfrom nomfichiermul;
+    latlon=scantokens readfrom nomfichiermul;
+    Coord[p]=rayon*(cosd(xpart(latlon/60))*cosd(ypart(latlon/60)),cosd(xpart(latlon/60))*sind(ypart(latlon/60)),sind(xpart(latlon/60)));
+    Nom=image(
+      label.scantokens readfrom nomfichiermul(TEX(""&p_&""),Projgeo(Coord[p]));
+      );
+    if ((xpart(latlon/60)>phim) and (xpart(latlon/60)<phip)):
+      if ProduitScalaire(Coord[p]-pte3,Oeil-pte3)>0:
+	pointe(Coord[p]);
+	draw Nom;
+      fi;
+    fi;
+  endfor;
+  closefrom nomfichiermul;
+  marque_p:="non";
+enddef;
+%
+
+
+vardef Lecturelacsp=
+  nomfichiermul:=arborescence&"PfClacs.dat";
+  nblec:=scantokens readfrom nomfichiermul;
+  for p=1 upto nblec:
+    pair Coord[];
+    nbpts:=scantokens readfrom nomfichiermul;
+    numeric ll;
+    ll=0;
+    for k=1 upto nbpts:
+      pair latlon;
+      latlon=scantokens readfrom nomfichiermul;
+      if projection="mercator":
+	Coord[k]=mercatorc(xpart(latlon/60),ypart(latlon/60));
+      elseif projection="winkel":
+	Coord[k]=winkelc(xpart(latlon/60),ypart(latlon/60));
+      elseif projection="simple":
+	Coord[k]=simplec(xpart(latlon/60),ypart(latlon/60));
+      elseif projection="cylindrique":
+	Coord[k]=cylindriquec(xpart(latlon/60),ypart(latlon/60));
+      elseif projection="bonne":
+	Coord[k]=bonnec(xpart(latlon/60),ypart(latlon/60));
+      elseif projection="coniqueh":
+	if (xpart(latlon)>0) or (xpart(latlon)=0):
+	  ll:=ll+1;
+	  Coord[ll]=coniquec(xpart(latlon/60),ypart(latlon/60),45);
+	fi;
+      elseif projection="coniqueb":
+	if (xpart(latlon)<0):
+	  ll:=ll+1;
+	  Coord[ll]=coniquec(xpart(latlon/60),ypart(latlon/60),-45);
+	fi;
+      fi;
+    endfor;
+    path lac;
+    if (projection="mercator") or (projection="winkelc") or (projection="cylindrique") or (projection="simple") or (projection="bonne"):
+      ll:=nbpts
+    fi;
+    if ll>0:
+      lac=Coord[1]
+      for l=2 upto ll:
+	--Coord[l]
+      endfor;
+      fill lac--cycle withcolor couleurfleuve;
+      draw lac;
+    fi;
+  endfor;
+  closefrom nomfichiermul;
+enddef;
+
+vardef Lecturelacspsup=
+  nomfichiermul:=arborescence&"PfClacssup.dat";
+  nblec:=scantokens readfrom nomfichiermul;
+  for p=1 upto nblec:
+    pair Coord[];
+    nbpts:=scantokens readfrom nomfichiermul;
+    numeric ll;
+    ll=0;
+    for k=1 upto nbpts:
+      pair latlon;
+      latlon=scantokens readfrom nomfichiermul;
+      if projection="mercator":
+	Coord[k]=mercatorc(xpart(latlon),ypart(latlon));
+      elseif projection="winkel":
+	Coord[k]=winkelc(xpart(latlon),ypart(latlon));
+      elseif projection="simple":
+	Coord[k]=simplec(xpart(latlon),ypart(latlon));
+      elseif projection="cylindrique":
+	Coord[k]=cylindriquec(xpart(latlon),ypart(latlon));
+      elseif projection="bonne":
+	Coord[k]=bonnec(xpart(latlon),ypart(latlon));
+      elseif projection="coniqueh":
+	if (xpart(latlon)>0) or (xpart(latlon)=0):
+	  ll:=ll+1;
+	  Coord[ll]=coniquec(xpart(latlon),ypart(latlon),45);
+	fi;
+      elseif projection="coniqueb":
+	if (xpart(latlon)<0):
+	  ll:=ll+1;
+	  Coord[ll]=coniquec(xpart(latlon),ypart(latlon),-45);
+	fi;
+      fi;
+    endfor;
+    path lac;
+    if (projection="mercator") or (projection="winkel") or (projection="cylindrique") or (projection="simple") or (projection="bonne"):
+      ll:=nbpts
+    fi;
+    if ll>0:
+      lac=Coord[1]
+      for l=2 upto ll:
+	--Coord[l]
+      endfor;
+      fill lac--cycle withcolor couleurfleuve;
+      draw lac;
+    fi;
+  endfor;
+  closefrom nomfichiermul;
+enddef;
+
+vardef Lecturerivieresp=
+  nomfichiermul:=arborescence&"PfCrivieres.dat";
+  nblec:=scantokens readfrom nomfichiermul;
+  for p=1 upto nblec:
+    pair Coord[];
+    nbpts:=scantokens readfrom nomfichiermul;
+    numeric ll;
+    ll:=0;
+    for k=1 upto nbpts:
+      pair latlon;
+      latlon=scantokens readfrom nomfichiermul;
+      if projection="mercator":
+	Coord[k]=mercatorc(xpart(latlon/60),ypart(latlon/60));
+      elseif projection="winkel":
+	Coord[k]=winkelc(xpart(latlon/60),ypart(latlon/60));
+      elseif projection="simple":
+	Coord[k]=simplec(xpart(latlon/60),ypart(latlon/60));
+      elseif projection="cylindrique":
+	Coord[k]=cylindriquec(xpart(latlon/60),ypart(latlon/60));
+      elseif projection="bonne":
+	Coord[k]=bonnec(xpart(latlon/60),ypart(latlon/60));
+      elseif projection="coniqueh":
+	if (xpart(latlon)>0) or (xpart(latlon)=0):
+	  ll:=ll+1;
+	  Coord[ll]=coniquec(xpart(latlon/60),ypart(latlon/60),45);
+	fi;
+      elseif projection="coniqueb":
+	if (xpart(latlon)<0):
+	  ll:=ll+1;
+	  Coord[ll]=coniquec(xpart(latlon/60),ypart(latlon/60),-45);
+	fi;
+      fi;
+    endfor;
+    path riv;
+    if (projection="mercator") or (projection="winkel") or (projection="cylindrique") or (projection="simple") or (projection="bonne"):
+      ll:=nbpts;
+    fi;
+    if ll>0:
+      riv=Coord[1]
+      for l=2 upto ll:
+	--Coord[l]
+      endfor;
+      draw riv withcolor couleurfleuve;
+    fi;
+  endfor;
+  closefrom nomfichiermul;
+enddef;
+
+vardef Lecturerivierespsup=
+  nomfichiermul:=arborescence&"PfCfleuveseurope.dat";
+  nblec:=scantokens readfrom nomfichiermul;
+  for p=1 upto nblec:
+    pair Coord[];
+    nbpts:=scantokens readfrom nomfichiermul;
+    numeric ll;
+    ll:=0;
+    for k=1 upto nbpts:
+      pair latlon;
+      latlon=scantokens readfrom nomfichiermul;
+      if projection="mercator":
+	Coord[k]=mercatorc(xpart(latlon),ypart(latlon));
+      elseif projection="winkel":
+	Coord[k]=winkelc(xpart(latlon),ypart(latlon));
+      elseif projection="simple":
+	Coord[k]=simplec(xpart(latlon),ypart(latlon));
+      elseif projection="cylindrique":
+	Coord[k]=cylindriquec(xpart(latlon),ypart(latlon));
+      elseif projection="bonne":
+	Coord[k]=bonnec(xpart(latlon),ypart(latlon));
+      elseif projection="coniqueh":
+	if (xpart(latlon)>0) or (xpart(latlon)=0):
+	  ll:=ll+1;
+	  Coord[ll]=coniquec(xpart(latlon),ypart(latlon),45);
+	fi;
+      elseif projection="coniqueb":
+	if (xpart(latlon)<0):
+	  ll:=ll+1;
+	  Coord[ll]=coniquec(xpart(latlon),ypart(latlon),-45);
+	fi;
+      fi;
+    endfor;
+    path riv;
+    if (projection="mercator") or (projection="winkel") or (projection="cylindrique") or (projection="simple") or (projection="bonne"):
+      ll:=nbpts;
+    fi;
+    if ll>0:
+      riv=Coord[1]
+      for l=2 upto ll:
+	--Coord[l]
+      endfor;
+      draw riv withcolor couleurfleuve;
+    fi;
+  endfor;
+  closefrom nomfichiermul;
+enddef;
+
+vardef Lecturecapitalesp=
+  marque_p:="creux";
+  nomfichiermul:=arborescence&"PfCcapitales.dat";
+  nbcapitales:=scantokens readfrom nomfichiermul;
+  for p=1 upto nbcapitales:
+    pair Coord[],latlon;
+    string p_;
+    p_=scantokens readfrom nomfichiermul;
+    latlon=scantokens readfrom nomfichiermul;
+    ll:=0;
+    if projection="mercator":
+      Coord[p]=mercatorc(xpart(latlon/60),ypart(latlon/60));
+      ll:=1;
+    elseif projection="winkel":
+      Coord[p]=winkelc(xpart(latlon/60),ypart(latlon/60));
+      ll:=1;
+    elseif projection="simple":
+      Coord[p]=simplec(xpart(latlon/60),ypart(latlon/60));
+      ll:=1;
+    elseif projection="cylindrique":
+      Coord[p]=cylindriquec(xpart(latlon/60),ypart(latlon/60));
+      ll:=1;
+    elseif projection="bonne":
+      Coord[p]=bonnec(xpart(latlon/60),ypart(latlon/60));
+      ll:=1;
+    elseif projection="coniqueh":
+      if (xpart(latlon)>0) or (xpart(latlon)=0):
+	ll:=1;
+	Coord[p]=coniquec(xpart(latlon/60),ypart(latlon/60),45);
+      fi;
+    elseif projection="coniqueb":
+      if (xpart(latlon)<0):
+	ll:=1;
+	Coord[p]=coniquec(xpart(latlon/60),ypart(latlon/60),-45);
+      fi;
+    fi;
+    if ll>0:
+      drawoptions(withcolor rouge);
+      pointe(Coord[p]);
+      drawoptions();
+      if (projection="mercator") or (projection="winkel") or (projection="cylindrique") or (projection="simple") or (projection="bonne"):
+	label.top(TEX(""&p_&""),Coord[p]);
+      fi;
+    fi;
+  endfor;
+  closefrom nomfichiermul;
+  marque_p:="non";
+enddef;
+
+vardef MeridienParallele=
+  if (projection="mercator") or (projection="winkel") or (projection="cylindrique") or (projection="simple"):
+    pair Coord[];
+    for k=-85 step 5 until 85:
+  for j=-180 step 10 until 180:
+	if projection="mercator":
+	  Coord[100*k+j]=mercatorc(k,j);
+	elseif projection="winkel":
+	Coord[100*k+j] = winkelc(k,j);
+	elseif projection="simple":
+	  Coord[100*k+j]=simplec(k,j);
+	elseif projection="cylindrique":
+	  Coord[100*k+j]=cylindriquec(k,j);
+	fi;
+      endfor;
+    endfor;
+    for k=-85 step 5 until 85:
+      draw Coord[100*k-180]
+	for j=-170 step 10 until 180:
+	--Coord[100*k+j]
+     endfor;
+    endfor;
+    pair Coord[];
+    for k=-180 step 10 until 180:
+      for j=-85 step 5 until 85:
+	if projection="mercator":
+	  Coord[0.001*k+10*j]=mercatorc(j,k);
+	elseif projection="winkel":
+	  Coord[0.001*k+10*j]=winkelc(j,k);
+	elseif projection="simple":
+	  Coord[0.001*k+10*j]=simplec(j,k);
+	elseif projection="cylindrique":
+	  Coord[0.001*k+10*j]=cylindriquec(j,k);
+	fi;
+      endfor;
+    endfor;
+    for k=-180 step 10 until 180:
+      draw Coord[0.001*k-10*85]
+	for j=-80 step 5 until 85:
+	--Coord[0.001*k+10*j]
+      endfor;
+    endfor;
+  elseif projection="bonne":
+    pair Coord[][];
+    for k=-90 step 10 until 90:
+      for j=-180 step 10 until 180:
+	Coord[k][j]=bonnec(k,j);
+      endfor;
+    endfor;
+    for k=-90 step 10 until 90:
+      draw Coord[k][-180]
+      for j=-170 step 10 until 180:
+	--Coord[k][j]
+      endfor;
+    endfor;
+    pair Coord[][];
+    for k=-170 step 10 until 170:
+      for j=-90 step 10 until 90:
+	Coord[k][j]=bonnec(j,k);
+      endfor;
+    endfor;
+    for k=-170 step 10 until 170:
+      draw Coord[k][-90]
+      for j=-80 step 10 until 90:
+	..Coord[k][j]
+      endfor;
+    endfor;
+  elseif projection="coniqueh":
+    pair Coord[];
+    for k=-180 step 10 until 180:
+      for j=0 step 10 until 90:
+	Coord[100*k+j]=coniquec(j,k,45);
+      endfor;
+    endfor;
+    for k=-180 step 10 until 180:
+      draw Coord[100*k]
+      for j=10 step 10 until 90:
+	--Coord[100*k+j]
+      endfor;
+    endfor;
+    pair Coord[];
+    for k=0 step 10 until 90:
+      for j=-180 step 10 until 180:
+	Coord[0.001*k+10*j]=coniquec(k,j,45);
+      endfor;
+    endfor;
+    for k=0 step 10 until 90:
+      draw Coord[0.001*k-10*180]
+      for j=-170 step 10 until 180:
+	--Coord[0.001*k+10*j]
+      endfor;
+    endfor;
+    clip currentpicture to coniquec(90,0,45)--(Coord[-10*180]
+      for j=-170 step 10 until 180:
+	--Coord[10*j]
+      endfor)--cycle;
+  elseif projection="coniqueb":
+    pair Coord[];
+    for k=-180 step 10 until 180:
+      for j=-90 step 10 until 0:
+	Coord[100*k+j]=coniquec(j,k,-45);
+      endfor;
+    endfor;
+    for k=-180 step 10 until 180:
+      draw Coord[100*k-90]
+      for j=-80 step 10 until 0:
+	--Coord[100*k+j]
+      endfor;
+    endfor;
+    pair Coord[];
+    for k=-90 step 10 until 0:
+      for j=-180 step 10 until 180:
+	Coord[0.001*k+10*j]=coniquec(k,j,-45);
+      endfor;
+    endfor;
+    for k=-90 step 10 until 0:
+      draw Coord[0.001*k-10*180]
+      for j=-170 step 10 until 180:
+	--Coord[0.001*k+10*j]
+      endfor;
+    endfor;
+    clip currentpicture to coniquec(-90,0,-45)--(Coord[-10*180]
+      for j=-170 step 10 until 180:
+	--Coord[10*j]
+      endfor)--cycle;
+  fi;
+enddef;
+
+boolean Echelle;
+Echelle=false;
+
+vardef echelle(expr Th,Ph,long)=%long en km.
+  %Echelle:=true;
+  theta:=Th;
+  phi:=Ph;
+  Long:=long;
+  zoom(1);
+  numeric $;
+  if projection="bonne":
+    $=(cm*pi*cosd(Ph)/36)/(long*abs(bonnec(Ph,Th)-bonnec(Ph,Th+5)))*6340;
+  elseif projection="mercator":
+    $=(cm*pi*cosd(Ph)*6340/36)/(long*abs(mercatorc(Ph,Th)-mercatorc(Ph,Th+5)));
+    elseif projection="winkel":
+    $=(cm*pi*cosd(Ph)*6340/36)/(long*abs(winkelc(Ph,Th)-winkelc(Ph,Th+5)));
+  elseif projection="simple":
+    $=(cm*pi*cosd(Ph)*6340/36)/(long*abs(simplec(Ph,Th)-simplec(Ph,Th+5)));
+  elseif projection="cylindrique":
+    $=(cm*pi*cosd(Ph)*6340/36)/(long*abs(cylindriquec(Ph,Th)-cylindriquec(Ph,Th+5)));
+  fi;
+  $
+enddef;
+
+boolean Amsud,Amnord,Amcentrale,Caraibes,Asie,Europe,Afrique,All;
+
+Amsud:=false;
+Amnord:=false;
+Amcentrale:=false;
+Caraibes:=false;
+Asie:=false;
+Europe:=false;
+Afrique:=false;
+All:=true;
+
+vardef Projection(expr TH,PH,Zoom)=
+  theta:=TH;
+  phi:=PH;
+  zoom(Zoom);
+  if projection="bonne":
+    fill (bonnec(-90,-180) for k=-85 step 5 until 90:..bonnec(k,-180) endfor)..reverse(bonnec(-90,180) for k=-85 step 5 until 90:..bonnec(k,180) endfor)..cycle withcolor couleurfond;
+  fi;
+  if All=true:
+    Lecture("Cameriquesud.dat");
+    Lecture("Ccaraibes.dat");
+    Lecture("Cameriquecentrale.dat");
+    Lecture("Cameriquenord.dat");
+    Lecture("Casia.dat");
+    Lecture("Ceurope.dat");
+    Lecture("Cafrique.dat");
+  else:
+    if Amsud=true:
+      Lecture("Cameriquesud.dat");
+    fi;
+    if Amnord=true:
+      Lecture("Cameriquenord.dat");
+    fi;
+    if Amcentrale=true:
+      Lecture("Cameriquecentrale.dat");
+    fi;
+    if Caraibes=true:
+      Lecture("Ccaraibes.dat");
+    fi;
+    if Asie=true:
+      if projection="bonne":
+	Lecture("Casie.dat");
+      else:
+	Lecture("Casia.dat");
+      fi;
+    fi;
+    if Europe=true:
+      Lecture("Ceurope.dat");
+    fi;
+    if Afrique=true:
+      Lecture("Cafrique.dat");
+    fi;
+  fi;
+  if lacs=true:
+    Lecturelacsp;
+    Lecturelacspsup;
+  fi;
+  Lectureilesp;
+  if capitales=true:
+    Lecturecapitalesp;
+  fi;
+  if fleuves=true:
+    Lecturerivieresp;
+    Lecturerivierespsup;
+  fi;
+  if maillage=true:
+    drawoptions(withcolor gris);
+    MeridienParallele;
+    drawoptions();
+  fi;
+  if Echelle=true:
+    draw ((Xa,Ya)+u*(1,1))--((Xa,Ya)+u*(2,1));
+    labeloffset:=labeloffset*1.5;
+    label.top(btex 0 etex,(Xa,Ya)+u*(1,1));
+    label.top(TEX(""&decimal(Long)&"~km"),(Xa,Ya)+u*(2,1));
+    labeloffset:=labeloffset/1.5;
+    draw ((Xa,Ya)+u*(1,1.1))--((Xa,Ya)+u*(1,0.9));
+    draw (((Xa,Ya)+u*(1,1.1))--((Xa,Ya)+u*(1,0.9))) shifted(u*(1,0));
+  fi;
+enddef;
+
+vardef Simple(expr TH,PH,Zoom)=
+  projection:="simple";
+  theta:=TH;
+  phi:=PH;
+  zoom(Zoom);
+  Lecture("Cameriquesud.dat");
+  Lecture("Ccaraibes.dat");
+  Lecture("Cameriquecentrale.dat");
+  Lecture("Cameriquenord.dat");
+  Lecture("Casia.dat");
+  Lecture("Ceurope.dat");
+  Lecture("Cafrique.dat");
+  if lacs=true:
+    Lecturelacsp;
+    Lecturelacspsup;
+  fi;
+  Lectureilesp;
+  if capitales=true:
+    Lecturecapitalesp;
+  fi;
+  if fleuves=true:
+    Lecturerivieresp;
+   fi;
+  if maillage=true:
+    MeridienParallele
+  fi;
+enddef;
+
+vardef Mercator(expr TH,PH,Zoom)=
+  projection:="mercator";
+  theta:=TH;
+  phi:=PH;
+  zoom(Zoom);
+  Lecture("Cameriquesud.dat");
+  Lecture("Ccaraibes.dat");
+  Lecture("Cameriquecentrale.dat");
+  Lecture("Cameriquenord.dat");
+  Lecture("Casia.dat");
+  Lecture("Ceurope.dat");
+  Lecture("Cafrique.dat");
+  if lacs=true:
+    Lecturelacsp;
+    Lecturelacspsup;
+  fi;
+  Lectureilesp;
+  if capitales=true:
+    Lecturecapitalesp;
+  fi;
+  if fleuves=true:
+    Lecturerivieresp;
+  fi;
+  if maillage=true:
+    MeridienParallele
+  fi;
+enddef;
+
+vardef Winkel(expr TH,PH,Zoom)=
+  projection:="winkel";
+  theta:=TH;
+  phi:=PH;
+  zoom(Zoom);
+  Lecture("Cameriquesud.dat");
+  Lecture("Ccaraibes.dat");
+  Lecture("Cameriquecentrale.dat");
+  Lecture("Cameriquenord.dat");
+  Lecture("Casia.dat");
+  Lecture("Ceurope.dat");
+  Lecture("Cafrique.dat");
+  if lacs=true:
+    Lecturelacsp;
+    Lecturelacspsup;
+  fi;
+  Lectureilesp;
+  if capitales=true:
+    Lecturecapitalesp;
+  fi;
+  if fleuves=true:
+    Lecturerivieresp;
+  fi;
+  if maillage=true:
+    MeridienParallele;
+  fi;
+enddef;
+
+vardef Cylindrique(expr TH,PH,Zoom)=
+  projection:="cylindrique";
+  theta:=TH;
+  phi:=PH;
+  zoom(Zoom);
+  Lecture("Cameriquesud.dat");
+  Lecture("Ccaraibes.dat");
+  Lecture("Cameriquecentrale.dat");
+  Lecture("Cameriquenord.dat");
+  Lecture("Casia.dat");
+  Lecture("Ceurope.dat");
+  Lecture("Cafrique.dat");
+  if lacs=true:
+    Lecturelacsp;
+    Lecturelacspsup;
+  fi;
+  Lectureilesp;
+  if capitales=true:
+    Lecturecapitalesp;
+  fi;
+  if fleuves=true:
+    Lecturerivieresp;
+  fi;
+  if maillage=true:
+    MeridienParallele
+  fi;
+enddef;
+
+vardef Bonne(expr TH,PH,Zoom)=
+  projection:="bonne";
+  theta:=TH;
+  phi:=PH;
+  zoom(Zoom);
+  fill (bonnec(-90,-180) for k=-85 step 5 until 90:..bonnec(k,-180) endfor)..reverse(bonnec(-90,180) for k=-85 step 5 until 90:..bonnec(k,180) endfor)..cycle withcolor couleurfond;
+  Lecture("Cameriquesud.dat");
+  Lecture("Ccaraibes.dat");
+  Lecture("Cameriquecentrale.dat");
+  Lecture("Cameriquenord.dat");
+  Lecture("Casie.dat");
+  Lecture("Ceurope.dat");
+  Lecture("Cafrique.dat");
+  if lacs=true:
+    Lecturelacsp;
+    Lecturelacspsup;
+  fi;
+  Lectureilesp;
+  if capitales=true:
+    Lecturecapitalesp;
+  fi;
+  if fleuves=true:
+    Lecturerivieresp;
+  fi;
+  if maillage=true:
+    drawoptions(withcolor gris);
+    MeridienParallele;
+    drawoptions();
+  fi;
+  draw (bonnec(-90,-180) for k=-85 step 5 until 90:..bonnec(k,-180) endfor)..reverse(bonnec(-90,180) for k=-85 step 5 until 90:..bonnec(k,180) endfor)..cycle;
+enddef;
+
+vardef ConiqueH=
+  projection:="coniqueh";
+  Lecture("Cameriquesud.dat");
+  Lecture("Ccaraibes.dat");
+  Lecture("Cameriquecentrale.dat");
+  Lecture("Cameriquenord.dat");
+  Lecture("Casie.dat");
+  Lecture("Ceurope.dat");
+  Lecture("Cafrique.dat");
+  if lacs=true:
+    Lecturelacsp;
+    Lecturelacspsup;
+  fi;
+  Lectureilesp;
+  if capitales=true:
+    Lecturecapitalesp;
+  fi;
+  if fleuves=true:
+    Lecturerivieresp;
+    Lecturerivierespsup;
+  fi;
+  drawoptions(withcolor gris);
+  MeridienParallele;
+  drawoptions();
+enddef;
+
+vardef ConiqueB=
+  projection:="coniqueb";
+  Lecture("Cameriquesud.dat");
+  Lecture("Ccaraibes.dat");
+  Lecture("Cameriquecentrale.dat");
+  Lecture("Cameriquenord.dat");
+  Lecture("Casie.dat");
+  Lecture("Ceurope.dat");
+  Lecture("Cafrique.dat");
+  if lacs=true:
+    Lecturelacsp;
+    Lecturelacspsup;
+  fi;
+  Lectureilesp;
+  if capitales=true:
+    Lecturecapitalesp;
+  fi;
+  if fleuves=true:
+    Lecturerivieresp;
+    Lecturerivierespsup;
+  fi;
+  drawoptions(withcolor gris);
+  MeridienParallele;
+  drawoptions();
+enddef;
+
+%%%%%%%
+
+rayon:=2;
+
+boolean fleuves,lacs,capitales,noncolore,maillage,volcans;
+fleuves=true;
+lacs=true;
+capitales=true;
+noncolore=false;
+maillage=false;
+volcans=false;
+
+color couleurfond,couleurmaillage,couleurfleuve;
+couleurfond:=ciel;
+couleurmaillage:=gris;
+couleurfleuve:=cielfonce;
+
+vardef Mappemonde(expr longobs,latobs)=
+  projection:="non";
+  %figureespace(-100u,-100u,100u,100u);
+  Initialisation(5,longobs,latobs,distanceecran);
+  numeric phim,phip,phii;%phi moins -- phi plus - phi interm\xE9diaire
+  phim=Phi+arcsind(rayon/Rho)-90;
+  phip=Phi+90-arcsind(rayon/Rho);
+  color pte[];
+  pte1=rayon*(cosd(phim)*cosd(Theta),cosd(phim)*sind(Theta),sind(phim));
+  pte2=rayon*(cosd(phip)*cosd(Theta),cosd(phip)*sind(Theta),sind(phip));
+  pte3=1/2[pte1,pte2];
+  pte4-pte3=Normal((0,0,0),pte1,pte2);
+  if (Phi>90):
+    phip:=180-phip;
+    phii:=180-phim;
+    phim:=phip;
+    phip:=phii;
+  fi;
+  if (Phi<-90):
+    phip:=-180-phip;
+    phii:=-180-phim;
+    phim:=phip;
+    phip:=phii;
+  fi;
+  fill cercles(pte3,pte1,pte3,pte1,pte4) withcolor couleurfond;
+%  Lecture("Cameriquesud.dat");
+%  Lecture("Ccaraibes.dat");
+%  Lecture("Cameriquecentrale.dat");
+%  Lecture("Cameriquenord.dat");
+%  Lecture("Casie.dat");
+%  Lecture("Ceurope.dat");
+%  Lecture("Cafrique.dat");
+  if volcans=true:
+%    Lecturevolcans;
+  fi;
+  if lacs=true:
+%    Lecturelacs;
+%    Lecturelacssup;
+  fi;
+%  Lectureiles;
+  if capitales=true:
+%    Lecturecapitales;
+  fi;
+  if fleuves=true:
+%    Lecturerivieres;
+%    %Lecturerivieressup;
+  fi;
+  if maillage=true:
+    drawoptions(withcolor couleurmaillage);
+    MaillageSphere;
+    drawoptions();
+  fi;
+  if maille=true:
+    Maille;
+  fi;
+  draw cercles(pte3,pte1,pte3,pte1,pte4);
+  %finespace;
+enddef;
+
+vardef mappemonde(expr longobs,latobs)=
+  projection:="non";
+  %figureespace(-100u,-100u,100u,100u);
+  Initialisation(5,longobs,latobs,distanceecran);
+  numeric phim,phip,phii;%phi moins -- phi plus - phi interm\xE9diaire
+  phim=Phi+arcsind(rayon/Rho)-90;
+  phip=Phi+90-arcsind(rayon/Rho);
+  color pte[];
+  pte1=rayon*(cosd(phim)*cosd(Theta),cosd(phim)*sind(Theta),sind(phim));
+  pte2=rayon*(cosd(phip)*cosd(Theta),cosd(phip)*sind(Theta),sind(phip));
+  pte3=1/2[pte1,pte2];
+  pte4-pte3=Normal((0,0,0),pte1,pte2);
+  if (Phi>90):
+    phip:=180-phip;
+    phii:=180-phim;
+    phim:=phip;
+    phip:=phii;
+  fi;
+  if (Phi<-90):
+    phip:=-180-phip;
+    phii:=-180-phim;
+    phim:=phip;
+    phip:=phii;
+  fi;
+  fill cercles(pte3,pte1,pte3,pte1,pte4) withcolor couleurfond;
+  Lecture("Cameriquesud.dat");
+  Lecture("Ccaraibes.dat");
+  Lecture("Cameriquecentrale.dat");
+  Lecture("Cameriquenord.dat");
+  Lecture("Casie.dat");
+  Lecture("Ceurope.dat");
+  Lecture("Cafrique.dat");
+  if volcans=true:
+    Lecturevolcans;
+  fi;
+  if lacs=true:
+    Lecturelacs;
+    Lecturelacssup;
+  fi;
+  Lectureiles;
+  if capitales=true:
+    Lecturecapitales;
+  fi;
+  if fleuves=true:
+    Lecturerivieres;
+    %Lecturerivieressup;
+  fi;
+  if maillage=true:
+    drawoptions(withcolor couleurmaillage);
+    MaillageSphere;
+    drawoptions();
+  fi;
+  if maille=true:
+    Maille;
+  fi;
+  draw cercles(pte3,pte1,pte3,pte1,pte4);
+%  finespace;
+enddef;
+
+endinput;


Property changes on: trunk/Master/texmf-dist/metapost/profcollege/PfCMonde.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/texmf-dist/metapost/profcollege/PfCObjets.mp
===================================================================
--- trunk/Master/texmf-dist/metapost/profcollege/PfCObjets.mp	2023-07-04 19:52:56 UTC (rev 67544)
+++ trunk/Master/texmf-dist/metapost/profcollege/PfCObjets.mp	2023-07-04 19:53:24 UTC (rev 67545)
@@ -834,10 +834,10 @@
     for l=0 upto (subh-1):
       tcpt.@[apj]:=apj;
       OTFc.@[apj].nb:=4;
-      OTFc.@[apj][1]:=(Famille(umin+(k+1)*upas,vmin+l*vpas));%1
-      OTFc.@[apj][2]:=(Famille(umin+k*upas,vmin+l*vpas));%2
-      OTFc.@[apj][3]:=(Famille(umin+k*upas,vmin+(l+1)*vpas));%3
-      OTFc.@[apj][4]:=(Famille(umin+(k+1)*upas,vmin+(l+1)*vpas));%4
+      OTFc.@[apj][1]:=Famille(umin+(k+1)*upas,vmin+l*vpas);%1
+      OTFc.@[apj][2]:=Famille(umin+k*upas,vmin+l*vpas);%2
+      OTFc.@[apj][3]:=Famille(umin+k*upas,vmin+(l+1)*vpas);%3
+      OTFc.@[apj][4]:=Famille(umin+(k+1)*upas,vmin+(l+1)*vpas);%4
       OTFc.@[apj].iso:=(OTFc.@[apj][1]+OTFc.@[apj][2]+OTFc.@[apj][3]+OTFc.@[apj][4])/4;
       ALT.@[apj]:=-Zpart(GCoord(OTFc.@[apj].iso));
       PfCPS:=ProduitScalaire(Oeil-OTFc.@[apj][1],Normal(OTFc.@[apj][1],OTFc.@[apj][2],OTFc.@[apj][3]))/1000;

Modified: trunk/Master/texmf-dist/metapost/profcollege/PfCScratch.mp
===================================================================
--- trunk/Master/texmf-dist/metapost/profcollege/PfCScratch.mp	2023-07-04 19:52:56 UTC (rev 67544)
+++ trunk/Master/texmf-dist/metapost/profcollege/PfCScratch.mp	2023-07-04 19:53:24 UTC (rev 67545)
@@ -15,7 +15,6 @@
 pair DebutListe; DebutListe=(0,0);
 boolean NumeroteLignes; NumeroteLignes=false;
 boolean NumeroteFinBloc; NumeroteFinBloc=false;
-
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% couleurs
 color CoulLignes; CoulLignes:=black;
 color ColBloc; % alias des couleurs de bloc
@@ -57,7 +56,7 @@
 enddef;
 
 def Placer expr o =
-  if path o: draw o else: draw o fi
+  if path o: draw o else: draw o fi;
 enddef;
 
 %impression
@@ -819,8 +818,8 @@
 
 vardef Tournerg(expr nbpas)=
   LONG:=0;
-  save $;
-  picture $, texto;
+  save Tourner;
+  picture Tourner, texto;
   if string nbpas:
     if symbole=true:
       texto=ColleBoxNew("tourner",Arcgauche,"de",OvalNb(nbpas),"degré(s)");
@@ -835,8 +834,8 @@
     fi;
   fi;
   ColBloc:=BleuMouvTrois;
-  $=Affichage(texto);
-  $
+  Tourner=Affichage(texto);
+  Tourner
 enddef;
 
 vardef Orienter(expr nbpas)=
@@ -1398,8 +1397,8 @@
   save $;
   picture $;
   $=image(
-      linecap := butt;
-    linejoin := mitered;
+%      linecap := butt;
+%    linejoin := mitered;
     fill (80.695297,716.262024)..controls (80.574203,716.257996) and (80.476601,716.171997)..(80.480499,716.062988)
       --(80.687500,704.125000)..controls (79.941399,704.570007) and (78.644501,704.637024)..(77.312500,704.223022)
       ..controls (75.503899,703.659973) and (74.339798,702.429993)..(74.710899,701.473022)
@@ -1548,8 +1547,8 @@
   picture cray;
   cray=image(%
       drawoptions (if print=false:withcolor (0.298050,0.556850,0.917650) fi);
-    linecap := butt;
-    linejoin := mitered;
+%    linecap := butt;
+%    linejoin := mitered;
     fill (0.960938,1.390630)--(1.644530,2.996090)..controls (1.730470,3.199220) and (1.917970,3.500000)..(2.062500,3.664060)..controls (2.324220,3.968750) and (3.539060,2.753910)..(3.234380,2.488280)..controls (3.070310,2.343750) and (2.769530,2.160160)..(2.566410,2.074220)--cycle;
     drawoptions (withcolor (0.349030,0.368640,0.450970));
     pickup pencircle scaled 0.498140bp;
@@ -2197,8 +2196,8 @@
 vardef DrapeauImage=
   save $; picture $;
   $=image(
-      linecap := butt;
-    linejoin := rounded;
+%      linecap := butt;
+%    linejoin := rounded;
     if print = false: drawoptions(withcolor(76/255,191/255,86/255)) fi;
     fill (72.000000,713.254028)--(72.000000,718.918030)--(72.507797,718.979980)
       --(72.984398,719.026978)--(73.437500,719.054993)--(73.867203,719.070007)
@@ -2350,7 +2349,7 @@
   picture $,texto,TEXT;
   if string commande :
     texto=image(
-	label.lrt(TEX("\barre \hbox to"&commande&"cm{}"),if unknown _coinprec: (0,0) else:_coinprec fi);
+	label.lrt(TEX("\sffamily\bfseries\longbarre \hbox to"&commande&"cm{}"),if unknown _coinprec: (0,0) else:_coinprec fi);
     );
 else:
   texto=commande;
@@ -2365,18 +2364,12 @@
   save $;
   picture $,texto,TEXT;
   texto=image(
-      label.lrt(TEX("\barre \hbox to2cm{}"),if unknown _coinprec: (0,0) else:_coinprec fi);
+      label.lrt(TEX("\sffamily\bfseries\longbarre \hbox to4cm{}"),if unknown _coinprec: (0,0) else:_coinprec fi);
   );
 TEXT=image(
     path cadre;
   cadre=CADRE(texto);
   unfill cadre;
-  %draw (urcorner texto+(0,eb))--
-  %  (ulcorner texto+(0.625cm,0)+(eb,eb)){dir180}..
-  %  {dir180}(ulcorner texto+(0.625cm,0))--
-  %  (ulcorner texto+(0.375cm,0)){dir180}..
-  %  {dir180}(ulcorner texto+(0.375cm,0)+(-eb,eb))--
-  %  (ulcorner texto+(0,eb)) withpen pencircle scaled 0;
   );
 $=TEXT shifted (if unknown _coinprec:(0,0) else :_coinprec fi - ulcorner TEXT);
 _coinprec:=llcorner $;
@@ -2390,6 +2383,7 @@
 $
 enddef;
 
+
 vardef LigneVideVar(expr commande)=
   LONG:=0;
   save $;
@@ -2415,6 +2409,7 @@
     (ulcorner texto+(0.375cm,0)+(-eb,eb))--
     (ulcorner texto+(0,eb))--(ulcorner texto+(-eb,0))--cycle;
   fill cadre withcolor white;
+  draw cadre;
 %  draw (urcorner texto+(0,eb))--
 %    (ulcorner texto+(0.625cm,0)+(eb,eb))--
 %    (ulcorner texto+(0.625cm,0))--
@@ -2434,6 +2429,22 @@
 $
 enddef;
 
+vardef LigneVideVarUn(expr commande)=
+  LONG:=0;
+  save $;
+  picture $,texto,TEXT;
+  if string texto:
+    texto=image(
+	label.lrt(TEX("\barre \hbox to2cm{}"),if unknown _coinprec: (0,0) else:_coinprec fi);
+    );
+else:
+  texto=commande;
+fi;
+ColBloc:=white;
+$=Affichage(texto);
+$
+enddef;
+
 vardef LignePointilles=
   LONG:=0;
   save $;

Modified: trunk/Master/texmf-dist/metapost/profcollege/PfCSolid.mp
===================================================================
--- trunk/Master/texmf-dist/metapost/profcollege/PfCSolid.mp	2023-07-04 19:52:56 UTC (rev 67544)
+++ trunk/Master/texmf-dist/metapost/profcollege/PfCSolid.mp	2023-07-04 19:53:24 UTC (rev 67545)
@@ -107,6 +107,10 @@
   (-Xpart(N)*Aux1+Ypart(N)*Aux3,-Xpart(N)*Aux5-Ypart(N)*Aux6+Zpart(N)*Aux4,-Xpart(N)*Aux7-Ypart(N)*Aux8-Zpart(N)*Aux2+Rho)
 enddef;
 
+vardef GCoordcabinet(expr N)=
+  (-(Xpart(N)*sind(30)*0.5)*Aux1+Ypart(N)*cosd(30)*Aux3,-(Xpart(N)*cosd(30)*0.5)*Aux5-Ypart(N)*Aux6+Zpart(N)*Aux4,-Xpart(N)*Aux7-Ypart(N)*Aux8-Zpart(N)*Aux2+Rho)
+enddef;
+
 unit:=1;%pour les mises \xE0 l'\xE9chelle :) Merci pst-solides3d
 
 vardef Projette(expr M)=
@@ -116,8 +120,13 @@
     (Xpart(GCoord(M)),Ypart(GCoord(M)))*unit*DE
   elseif typerepre="cabinet":
 %    (0.5*cosd(30)*Xpart(GCoord(M)),0.75*sind(30)*Ypart(GCoord(M)))*unit*DE
-    (Xpart(GCoord(M))+0.5*cosd(30)*Zpart(GCoord(M)),Ypart(GCoord(M))+0.5*sind(30)*Zpart(GCoord(M)))*20
-%    (0.5*cosd(45)*Xpart(GCoord(M)),0.5*sind(45)*Ypart(GCoord(M)))*unit*DE
+%    (Xpart(M)+0.5*cosd(30)*Zpart(M),Ypart(M)+0.5*sind(30)*Zpart(M))*20
+    %(Xpart(M)+0.5*cosd(30)*Ypart(M),Zpart(M)+0.5*sind(30)*Ypart(M))*20
+    %(Ypart(M)+0.5*cosd(30)*Xpart(M),Zpart(M)+0.5*sind(30)*Xpart(M))*20%Good avec Theta=-20/Phi=-10
+    %(Ypart(GCoord(M))+0.5*cosd(-30)*Xpart(GCoord(M)),Zpart(GCoord(M))+0.5*sind(-30)*Xpart(GCoord(M)))*20%Good avec Theta=-20/Phi=-10
+    (Xpart(GCoord(M))*cosd(90-30),Ypart(GCoord(M))*sind(90-30)*0.5)*DE%\xE0 garder peut-\xEAtre
+%    (Zpart(GCoord(M))+0.5*cosd(-30)*Ypart(GCoord(M)),Xpart(GCoord(M))+0.5*sind(-30)*Ypart(GCoord(M)))*20
+      %    (0.5*cosd(45)*Xpart(GCoord(M)),0.5*sind(45)*Ypart(GCoord(M)))*unit*DE
 %    (Xpart(GCoord(M)),Ypart(GCoord(M)))*unit*DE
     %(Xpart(GCoord(M)),Ypart(GCoord(M)))*10
   fi
@@ -1036,7 +1045,7 @@
   nbauto:=0;
   for p_=t:
     nbauto:=nbauto+1;
-    if unknown p_:p_=Sommet[nbauto]; else: p_:=Sommet[nbauto] fi;
+    if unknown p_: p_=Sommet[nbauto]; else: p_:=Sommet[nbauto]; fi;
   endfor;
 enddef;
 
@@ -1045,7 +1054,7 @@
   nbauto:=0;
   for p_=t:
     nbauto:=nbauto+1;
-    if unknown p_:p_=MSection[nbauto]; else: p_:=MSection[nbauto] fi;
+    if unknown p_: p_=MSection[nbauto]; else: p_:=MSection[nbauto]; fi;
   endfor;
 enddef;
 

Added: trunk/Master/texmf-dist/tex/latex/profcollege/PfCAutomatismes.tex
===================================================================
--- trunk/Master/texmf-dist/tex/latex/profcollege/PfCAutomatismes.tex	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/profcollege/PfCAutomatismes.tex	2023-07-04 19:53:24 UTC (rev 67545)
@@ -0,0 +1,227 @@
+%%% 
+% Automatismes
+%%%
+\NewDocumentCommand\ChoixAleaMixold{mmmm}{%
+  \ChoixAlea{1}{2}{\Autograine}%
+  \ifnum\Autograine=1\relax%
+    \ifnum#3=\useKV[Automatismes]{ValeurMin}\relax%
+      \xdef#4{\fpeval{randint(#3+1,#2)}}%
+    \else%
+      \xdef#4{\fpeval{randint(#1,#3-1)}}%
+    \fi%
+  \else%
+    \ifnum#3=\useKV[Automatismes]{ValeurMax}\relax%
+      \xdef#4{\fpeval{randint(#1,#3-1)}}%
+    \else%
+      \xdef#4{\fpeval{randint(#3+1,#2)}}%
+    \fi%
+  \fi%
+}%
+
+\NewDocumentCommand\ChoixAleaMix{mmmm}{%
+  \xintifboolexpr{#1==0 || #1==#3}{%
+    \xdef\PfCListeNombreMix{\fpeval{#1+1}}%
+    \xdef\PfCAutoDebutCompte{2}%
+  }{%
+    \xdef\PfCListeNombreMix{#1}%
+    \xdef\PfCAutoDebutCompte{1}%
+  }%
+  \xintFor* ##1 in{\xintSeq{\PfCAutoDebutCompte}{\fpeval{#2-#1}}}\do{%
+    \xintifboolexpr{\fpeval{#1+##1}==0 || \fpeval{#1+##1}==#3}{}{%
+      \xdef\PfCListeNombreMix{\PfCListeNombreUn,\fpeval{\useKV[Automatismes]{ValeurMin}+##1}}%
+    }%
+  }%
+  \MelangeListe{\PfCListeNombreMix}{1}%
+  \xdef#4{\faa}%
+}%
+
+\newcounter{PfCAutoNbcpt}%
+
+\NewDocumentCommand\ChoixNombreUn{om}{%
+  \setKV[Automatismes]{#1}%
+  \ifboolKV[Automatismes]{Fractions}{%
+    \xdef\PfCAutoNumUn{\PfCListeNombreMelangeUn[\thePfCAutoNbcpt]}%
+    \ChoixAleaMix{\useKV[Automatismes]{ValeurMin}}{\useKV[Automatismes]{ValeurMax}}{\PfCAutoNumUn}{\PfCAutomatismesPremierTerme}%
+  }{%
+    \xdef\PfCAutoNombreUn{\PfCListeNombreMelangeUn[\thePfCAutoNbcpt]}%
+  }%
+}%
+
+\NewDocumentCommand\ChoixNombreDeux{om}{%
+  \setKV[Automatismes]{#1}%
+  \ifboolKV[Automatismes]{Fractions}{%
+    \IfStrEq{\PfCAutomatismesListeOperations[#2]}{+}{%
+      \ChoixAleaMix{\useKV[Automatismes]{ValeurMin}}{\useKV[Automatismes]{ValeurMax}}{\PfCAutomatismesPremierTerme}{\PfCAutoNumDeux}%
+      \xdef\PfCAutomatismesDeuxiemeTerme{\PfCAutomatismesPremierTerme}%
+    }{%
+      \IfStrEq{\PfCAutomatismesListeOperations[#2]}{-}{%
+        \ChoixAleaMix{\useKV[Automatismes]{ValeurMin}}{\useKV[Automatismes]{ValeurMax}}{\PfCAutomatismesPremierTerme}{\PfCAutoNumDeux}%
+        \xdef\PfCAutomatismesDeuxiemeTerme{\PfCAutomatismesPremierTerme}%
+      }{%
+        \xdef\PfCAutoNumDeux{\PfCListeNombreMelangeDeux[\thePfCAutoNbcpt]}%
+        \ChoixAleaMix{\useKV[Automatismes]{ValeurMin}}{\useKV[Automatismes]{ValeurMax}}{0}{\PfCAutomatismesDeuxiemeTerme}%
+      }%
+    }%
+  }{%
+    \ifboolKV[Automatismes]{Relatifs}{%
+      \IfStrEq{\PfCAutomatismesListeOperations[#2]}{/}{%
+        \xdef\PfCAutoNombreDeux{\PfCListeNombreMelangeDeux[\thePfCAutoNbcpt]}%
+        \VariableAlea{\PfCAutoNombreUn}{\PfCAutoNombreUn*\PfCAutoNombreDeux}%
+      }{%
+        \xdef\PfCAutoNombreDeux{\PfCListeNombreMelangeDeux[\thePfCAutoNbcpt]}%
+      }%
+    }{%
+      % Entiers
+      \IfStrEq{\PfCAutomatismesListeOperations[#2]}{-}{%
+        \xdef\PfCAutoRetiensDif{\fpeval{\PfCListeNombreMelangeUn[\thePfCAutoNbcpt]-\PfCListeNombreMelangeDeux[\thePfCAutoNbcpt]}}%
+        \ifnum\PfCAutoRetiensDif<0\relax%
+          \xdef\PfCAutoNombreUn{\PfCListeNombreMelangeDeux[\thePfCAutoNbcpt]}%
+          \xdef\PfCAutoNombreDeux{\fpeval{\PfCAutoNombreUn+\PfCAutoRetiensDif}}%
+        \else%
+          \xdef\PfCAutoNombreUn{\PfCListeNombreMelangeUn[\thePfCAutoNbcpt]}%
+          \xdef\PfCAutoNombreDeux{\PfCListeNombreMelangeDeux[\thePfCAutoNbcpt]}%
+        \fi
+      }{%
+        \IfStrEq{\PfCAutomatismesListeOperations[#2]}{/}{%
+          \xdef\PfCAutoNombreDeux{\PfCListeNombreMelangeDeux[\thePfCAutoNbcpt]}%
+          \VariableAlea{\PfCAutoNombreUn}{\PfCAutoNombreUn*\PfCAutoNombreDeux}%
+        }{%
+          \xdef\PfCAutoNombreDeux{\PfCListeNombreMelangeDeux[\thePfCAutoNbcpt]}%
+        }%
+      }%
+    }%
+  }%
+}%
+
+\NewDocumentCommand\SoustractionPositive{omm}{%
+  \setKV[Automatismes]{#1}%
+  \ifboolKV[Automatismes]{Relatifs}{%
+    \PfCNum{#2}-\PfCNum{#3}%
+  }{%
+    \ifnum#2>#3\relax%
+      \num{#2}-\num{#3}%
+    \else%
+      \num{#3}-\num{#2}%
+    \fi%
+  }%
+}%
+
+\setKVdefault[Automatismes]{Questions=10,ValeurMin=1,ValeurMax=15,Entiers,Relatifs=false,Fractions=false,Stretch=1.5,Graines=false,Priorites=false}%
+\defKV[Automatismes]{Graine=\setKV[Automatismes]{Graines}}%
+
+\newcommand\PfCTabstrut{\rule{0pt}{2.4ex}}% Top strut
+
+\NewDocumentCommand\Automatismes{o m}{%
+  \setcounter{PfCAutoNbcpt}{0}%
+  \useKVdefault[Automatismes]%
+  \setKV[Automatismes]{#1}%
+  \ifboolKV[Automatismes]{Graines}{\PfCGraineAlea{\useKV[Automatismes]{Graine}}}{}%
+  \xdef\PfCAutomatismesEtages{\fpeval{\useKV[Automatismes]{Questions}}}%
+  % On définit deux listes de nombres
+  \xdef\PfCListeNombreUn{\useKV[Automatismes]{ValeurMin}}%
+  \xintFor* ##1 in{\xintSeq{1}{\fpeval{\useKV[Automatismes]{ValeurMax}-\useKV[Automatismes]{ValeurMin}}}}\do{%
+    \xintifboolexpr{\fpeval{\useKV[Automatismes]{ValeurMin}+##1}==0}{}{%
+      \xdef\PfCListeNombreUn{\PfCListeNombreUn,\fpeval{\useKV[Automatismes]{ValeurMin}+##1}}%
+    }%
+  }%
+  \MelangeListe{\PfCListeNombreUn}{\fpeval{\useKV[Automatismes]{ValeurMax}-\useKV[Automatismes]{ValeurMin}+1}}%
+  \readlist*\PfCListeNombreMelangeUn{\faa}%
+  %%% la deuxième
+  \xdef\PfCListeNombreDeux{\useKV[Automatismes]{ValeurMin}}%
+  \xintFor* ##1 in{\xintSeq{1}{\fpeval{\useKV[Automatismes]{ValeurMax}-\useKV[Automatismes]{ValeurMin}}}}\do{%
+    \xintifboolexpr{\fpeval{\useKV[Automatismes]{ValeurMin}+##1}==0}{}{%
+      \xdef\PfCListeNombreDeux{\PfCListeNombreDeux,\fpeval{\useKV[Automatismes]{ValeurMin}+##1}}%
+    }%
+  }%
+  \MelangeListe{\PfCListeNombreDeux}{\fpeval{\useKV[Automatismes]{ValeurMax}-\useKV[Automatismes]{ValeurMin}+1}}%
+  \readlist*\PfCListeNombreMelangeDeux{\faa}%
+  \setcounter{PfCAutoNbcpt}{0}%
+  \renewcommand{\arraystretch}{\useKV[Automatismes]{Stretch}}%
+  \ifboolKV[Automatismes]{Priorites}{%
+      %On définit une troisième liste 
+      \xdef\PfCListeNombreTrois{\useKV[Automatismes]{ValeurMin}}%
+      \xintFor* ##1 in{\xintSeq{1}{\fpeval{\useKV[Automatismes]{ValeurMax}-\useKV[Automatismes]{ValeurMin}}}}\do{%
+        \xintifboolexpr{\fpeval{\useKV[Automatismes]{ValeurMin}+##1}==0}{}{%
+          \xdef\PfCListeNombreTrois{\PfCListeNombreTrois,\fpeval{\useKV[Automatismes]{ValeurMin}+##1}}%
+        }%
+      }%
+      \MelangeListe{\PfCListeNombreTrois}{\fpeval{\useKV[Automatismes]{ValeurMax}-\useKV[Automatismes]{ValeurMin}+1}}%
+      \readlist*\PfCListeNombreMelangeTrois{\faa}%
+%      La liste un est \showitems\PfCListeNombreMelangeUn\\
+%      La liste deux est \showitems\PfCListeNombreMelangeDeux\\
+%      La liste trois est \showitems\PfCListeNombreMelangeTrois\\
+      \begin{NiceTabular}{|ccc|}[hlines]%
+        \xintFor* ##1 in{\xintSeq{1}{\PfCAutomatismesEtages}}\do{%
+          % On mélange les opérations
+          \MelangeListe{+,-}{1}%
+          \xdef\PfCAutoFoo{\faa ,*}%
+          \MelangeListe{\PfCAutoFoo}{2}%
+          \ignoreemptyitems%
+          \readlist*\PfCAutomatismesListeOperations{\faa}%
+          \reademptyitems%
+          % Il faut positiver les soustractions pour les 6eme
+          \ChoixAlea{1}{2}{\PfCChoixParen}%
+          \ensuremath{%
+            \IfStrEq{\PfCAutomatismesListeOperations[1]}{*}{%
+              \xintifboolexpr{\PfCChoixParen==1}{%
+                 \num{\PfCListeNombreMelangeUn[##1]}\times\left(%
+                   \IfStrEq{\PfCAutomatismesListeOperations[2]}{-}{\SoustractionPositive[#1]{\PfCListeNombreMelangeDeux[##1]}{\PfCListeNombreMelangeTrois[##1]}}{\PfCNum{\PfCListeNombreMelangeDeux[##1]}+\PfCNum{\PfCListeNombreMelangeTrois[##1]}}%
+                 \right)%
+              }{%
+                 \IfStrEq{\PfCAutomatismesListeOperations[2]}{-}{%
+                   \ifboolKV[Automatismes]{Relatifs}{%
+                     \num{\PfCListeNombreMelangeUn[##1]}\times\PfCNum{\PfCListeNombreMelangeDeux[##1]}\PfCAutomatismesListeOperations[2]\PfCNum{\PfCListeNombreMelangeTrois[##1]}%
+                     }{\xintifboolexpr{\fpeval{\PfCListeNombreMelangeUn[##1]*\PfCListeNombreMelangeDeux[##1]\PfCAutomatismesListeOperations[2]\PfCListeNombreMelangeTrois[##1]}>0}{%
+                     \num{\PfCListeNombreMelangeUn[##1]}\times\PfCNum{\PfCListeNombreMelangeDeux[##1]}\PfCAutomatismesListeOperations[2]\PfCNum{\PfCListeNombreMelangeTrois[##1]}%
+                   }{\num{\PfCListeNombreMelangeTrois[##1]}\PfCAutomatismesListeOperations[2]\PfCNum{\PfCListeNombreMelangeUn[##1]}\times\PfCNum{\PfCListeNombreMelangeDeux[##1]}%
+                   }%
+                   }
+                 }{%
+                   \num{\PfCListeNombreMelangeTrois[##1]}\PfCAutomatismesListeOperations[2]\PfCNum{\PfCListeNombreMelangeUn[##1]}\times\PfCNum{\PfCListeNombreMelangeDeux[##1]}%
+                % }%
+                 }%
+              }%
+            }%
+            {%
+              \xintifboolexpr{\PfCChoixParen==1}{%
+                \left(\IfStrEq{\PfCAutomatismesListeOperations[2]}{-}{\SoustractionPositive[#1]{\PfCListeNombreMelangeUn[##1]}{\PfCListeNombreMelangeDeux[##1]}}{\PfCNum{\PfCListeNombreMelangeUn[##1]}+\PfCNum{\PfCListeNombreMelangeDeux[##1]}}\right)\times\PfCNum{\PfCListeNombreMelangeTrois[##1]}%
+              }{%
+                \ifboolKV[Automatismes]{Relatifs}{%
+                    \num{\PfCListeNombreMelangeDeux[##1]}\times\PfCNum{\PfCListeNombreMelangeTrois[##1]}\PfCAutomatismesListeOperations[1]\PfCNum{\PfCListeNombreMelangeUn[##1]}%
+                  }{%
+                \xintifboolexpr{\fpeval{\PfCListeNombreMelangeUn[##1]\PfCAutomatismesListeOperations[1]\PfCListeNombreMelangeDeux[##1]*\PfCListeNombreMelangeTrois[##1]}>0}{%
+                  \num{\PfCListeNombreMelangeUn[##1]}\PfCAutomatismesListeOperations[1]\PfCNum{\PfCListeNombreMelangeDeux[##1]}\times\PfCNum{\PfCListeNombreMelangeTrois[##1]}}{%
+                  \num{\PfCListeNombreMelangeDeux[##1]}\times\PfCNum{\PfCListeNombreMelangeTrois[##1]}\PfCAutomatismesListeOperations[1]\PfCNum{\PfCListeNombreMelangeUn[##1]}}%
+                }%
+              }%
+            }%
+          }%
+          &=&\pointilles[1cm]\\
+        }%
+      \end{NiceTabular}%
+    }{%
+      \setsepchar{,}\ignoreemptyitems%
+      \readlist*\PfCAutomatismesListeOperations{#2}%
+      \reademptyitems%
+      \begin{NiceTabular}{|ccccc|}[hlines]
+        \xintFor* ##1 in{\xintSeq{1}{\PfCAutomatismesEtages}}\do{%
+          \stepcounter{PfCAutoNbcpt}%
+          \xintifboolexpr{\PfCAutomatismesListeOperationslen==1}{%
+            \ChoixNombreUn[#1]{1}\ChoixNombreDeux[#1]{1}%
+          }{%
+        \ChoixNombreUn[#1]{##1}\ChoixNombreDeux[#1]{##1}%
+      }%
+      \Block{}{\ifboolKV[Automatismes]{Fractions}{$\dfrac{\PfCTabstrut\num{\PfCAutoNumUn}}{\PfCBstrut\num{\PfCAutomatismesPremierTerme}}$}{\num{\PfCAutoNombreUn}}}%
+      &\xintifboolexpr{\PfCAutomatismesListeOperationslen==1}{%
+        \StrSubstitute{\PfCAutomatismesListeOperations[1]}{*}{\times}[\PfCCBAffiche]%
+      }{%
+        \StrSubstitute{\PfCAutomatismesListeOperations[##1]}{*}{\times}[\PfCCBAffiche]%
+      }%
+      \StrSubstitute{\PfCCBAffiche}{/}{\div}[\PfCCBAffiche]%
+      $\PfCCBAffiche$%
+      &\Block{}{\ifboolKV[Automatismes]{Fractions}{$\dfrac{\PfCTabstrut\num{\PfCAutoNumDeux}}{\PfCBstrut\num{\PfCAutomatismesDeuxiemeTerme}}$}{\PfCNum{\PfCAutoNombreDeux}}}%
+      &=&\pointilles[1cm]\\
+    }%
+  \end{NiceTabular}%
+  }%
+}%
\ No newline at end of file


Property changes on: trunk/Master/texmf-dist/tex/latex/profcollege/PfCAutomatismes.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/texmf-dist/tex/latex/profcollege/PfCCartographie.tex
===================================================================
--- trunk/Master/texmf-dist/tex/latex/profcollege/PfCCartographie.tex	2023-07-04 19:52:56 UTC (rev 67544)
+++ trunk/Master/texmf-dist/tex/latex/profcollege/PfCCartographie.tex	2023-07-04 19:53:24 UTC (rev 67545)
@@ -1,17 +1,17 @@
 %%%
 % Cartographie
 %%%
-\setKVdefault[Cartographie]{Echelle=1,Carte=false,All=false,Europe=false,Asie=false,Amsud=false,Amnord=false,Amcentre=false,Caraibes=false,Afrique=false,AfficheEchelle=false,PaysSeul=false,VillesSup=false,Capitales=false,Impression=false,Fleuves=false,CouleurFond=ciel,Largeur=12,Hauteur=12,Arborescence="/usr/local/texlive/2022/texmf-dist/metapost/profcollege/datastest/",Projection=false,TypeProjection="mercator",CouleurPays=Cornsilk,Pasl=2,PasL=2}
+\setKVdefault[Cartographie]{Echelle=1,Carte=false,All=false,Europe=false,Asie=false,Amsud=false,Amnord=false,Amcentre=false,Caraibes=false,Afrique=false,AfficheEchelle=false,PaysSeul=false,VillesSup=false,Capitales=false,Impression=false,Fleuves=false,CouleurFond=ciel,Largeur=12,Hauteur=12,Arborescence="/usr/local/texlive/2023/texmf-dist/metapost/profcollege/",Projection=false,TypeProjection="mercator",CouleurPays=Cornsilk,Pasl=2,PasL=2}
 \defKV[Cartographie]{EchelleCarte=\setKV[Cartographie]{Carte}}
 \defKV[Cartographie]{Pays=\setKV[Cartographie]{PaysSeul}}
 \defKV[Cartographie]{Villes=\setKV[Cartographie]{VillesSup}}
 
 \newcommand\Cartographie[3][]{%
-  \ifluatex
-  \useKVdefault[Cartographie]
-  \setKV[Cartographie]{#1}
+  \ifluatex%
+  \useKVdefault[Cartographie]%
+  \setKV[Cartographie]{#1}%
+  \mplibforcehmode%
   \ifboolKV[Cartographie]{Projection}{%
-    \mplibforcehmode
     \begin{mplibcode}
       input PfCMonde;
       string arborescence;
@@ -131,7 +131,7 @@
       fi;
     \end{mplibcode}
   }{%    
-    \mplibforcehmode
+%    \mplibforcehmode
     \begin{mplibcode}
       input PfCMonde;
       string arborescence;
@@ -169,7 +169,7 @@
       phi:=#3;
       zoom(echelle(#2,#3,\useKV[Cartographie]{EchelleCarte}));
       fill (bonnec(-90,-180) for k=-85 step 5 until 90:..bonnec(k,-180) endfor)..reverse(bonnec(-90,180) for k=-85 step 5 until 90:..bonnec(k,180) endfor)..cycle withcolor couleurfond;
-      lecturep(arborescence&\useKV[Cartographie]{Pays}&".dat",couleurfond);%
+      lecturep(arborescence&"PfC"&\useKV[Cartographie]{Pays}&".dat",couleurfond);%
       trace feuillet withpen pencircle scaled 2;
       if Echelle=true:
       draw ((Xa,Ya)+u*(1,1))--((Xa,Ya)+u*(2,1));
@@ -201,6 +201,7 @@
       closefrom nomfichiermul;
       fi;
       else:
+      draw(0,0)--(50,50);
       mappemonde(#2,#3);
       fi;
     \end{mplibcode}

Modified: trunk/Master/texmf-dist/tex/latex/profcollege/PfCDobble.tex
===================================================================
--- trunk/Master/texmf-dist/tex/latex/profcollege/PfCDobble.tex	2023-07-04 19:52:56 UTC (rev 67544)
+++ trunk/Master/texmf-dist/tex/latex/profcollege/PfCDobble.tex	2023-07-04 19:53:24 UTC (rev 67545)
@@ -23,5 +23,5 @@
   \xintifboolexpr{\PfCListeSymboleDobblelen==\PfCDobbleTotalSymboles}{%
     \dobble{\PfCDobbleNiveau}%
   }{%
-    Pour un dooble basé sur le nombre premier \useKV[ClesDobble]{Niveau}, le nombre de symboles doit être égal à \num{\PfCDobbleTotalSymboles}.}%
+    Pour un dobble basé sur le nombre premier \useKV[ClesDobble]{Niveau}, le nombre de symboles doit être égal à \num{\PfCDobbleTotalSymboles}.}%
 }%
\ No newline at end of file

Added: trunk/Master/texmf-dist/tex/latex/profcollege/PfCEcrireQCMold.tex
===================================================================
--- trunk/Master/texmf-dist/tex/latex/profcollege/PfCEcrireQCMold.tex	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/profcollege/PfCEcrireQCMold.tex	2023-07-04 19:53:24 UTC (rev 67545)
@@ -0,0 +1,148 @@
+%%%
+% QCM
+%%%
+\setKVdefault[ClesQCM]{Reponses=3,Solution=false,Stretch=1,Largeur=2cm,Couleur=gray!15,Titre=false,Nom=R\'eponse,NomV=Vrai,NomF=Faux,Alph=false,AlphT=false,VF=false,Depart=1,Alterne=false,Noms={A/B/C},Multiple=false,Parties={Yeux,Nez,Bouche}}%
+\newlength{\LargeurQCM}%
+\newlength{\PfCLargeurQCM}%
+\newcounter{QuestionQCM}%
+\newcounter{TitreQCM}%
+\ifdef{\QCM}{%
+  \PackageWarning{ProfCollege}{La commande \noexpand\QCM étant définie par la classe du document, ProfCollege modifie sa commande \noexpand\QCM en \noexpand\QCMPfC.}%
+  \newcommand\QCMPfC[2][]{%
+    \useKVdefault[ClesQCM]%
+    \setKV[ClesQCM]{#1}%
+    \setcounter{QuestionQCM}{\fpeval{\useKV[ClesQCM]{Depart}-1}}%
+    \setcounter{TitreQCM}{0}
+    \setsepchar[*]{§*&}\ignoreemptyitems%
+    \readlist*\ListeQCM{#2}%
+    \ifboolKV[ClesQCM]{Multiple}{%
+      \renewcommand{\arraystretch}{\useKV[ClesQCM]{Stretch}}%
+      \setlength{\LargeurQCM}{\fpeval{(\linewidth-\useKV[ClesQCM]{Reponses}*(3*\tabcolsep+\useKV[ClesQCM]{Largeur}))}pt}%
+      \xdef\NBcases{\fpeval{\useKV[ClesQCM]{Reponses}+1}}%
+      \xdef\ListeNom{\useKV[ClesQCM]{Noms}}%
+      \setsepchar[*]{/}%
+      \readlist*\ListeNomsMul{\ListeNom}%
+      \begin{tabular}{|p{\LargeurQCM}|*{\useKV[ClesQCM]{Reponses}}{>{\centering\arraybackslash}p{\useKV[ClesQCM]{Largeur}}|}}%
+        \cline{2-\NBcases}%
+        \multicolumn{1}{c|}{}\xintFor* ##2 in {\xintSeq {1}{\useKV[ClesQCM]{Reponses}}}\do{%
+        &\ListeNomsMul[##2]}%
+        \\
+        \hline%
+        \xintFor* ##1 in {\xintSeq {1}{\ListeQCMlen}}\do{%
+        \stepcounter{QuestionQCM}\ifboolKV[ClesQCM]{Alterne}{\modulo{\theQuestionQCM}{2}\ifnum\remainder=0\cellcolor{gray!15}\fi}{}\ifboolKV[ClesQCM]{Alph}{\textbf{\Alph{QuestionQCM}}/}{\textbf{\theQuestionQCM/}}~\ListeQCM[##1,1]\xintFor* ##2 in {\xintSeq {1}{\useKV[ClesQCM]{Reponses}}}\do{%
+        &\ifboolKV[ClesQCM]{Alterne}{\modulo{\theQuestionQCM}{2}\ifnum\remainder=0\cellcolor{gray!15}\fi}{}\ifboolKV[ClesQCM]{Solution}{\xintifboolexpr{\ListeQCM[##1,\fpeval{##2+1}]==1}{$\boxtimes$}{$\square$}}{$\square$}%
+          }\\
+        }%
+        \hline%
+      \end{tabular}%
+    }{%
+      \ifboolKV[ClesQCM]{VF}{%
+        \setKV[ClesQCM]{Reponses=2}%
+        \setlength{\PfCLargeurQCM}{\useKV[ClesQCM]{Largeur}}%
+        \setlength{\LargeurQCM}{\linewidth-6\tabcolsep-2\PfCLargeurQCM-4\arrayrulewidth}%
+        \renewcommand{\arraystretch}{\useKV[ClesQCM]{Stretch}}%
+        \setlength{\LargeurQCM}{\fpeval{(\linewidth-\useKV[ClesQCM]{Reponses}*(3*\tabcolsep+\useKV[ClesQCM]{Largeur}))}pt}%
+        \xdef\NBcases{\fpeval{\useKV[ClesQCM]{Reponses}+1}}%
+        \begin{tabular}{|p{\LargeurQCM}|*{\useKV[ClesQCM]{Reponses}}{>{\centering\arraybackslash}p{\useKV[ClesQCM]{Largeur}}|}}%
+          \cline{2-\NBcases}%
+          \multicolumn{1}{c|}{}&\useKV[ClesQCM]{NomV}&\useKV[ClesQCM]{NomF}\\
+          \hline%
+          \xintFor* ##1 in {\xintSeq {1}{\ListeQCMlen}}\do{%
+          \stepcounter{QuestionQCM}\ifboolKV[ClesQCM]{Alterne}{\modulo{\theQuestionQCM}{2}\ifnum\remainder=0\cellcolor{gray!15}\fi}{}\ifboolKV[ClesQCM]{Alph}{\textbf{\Alph{QuestionQCM}}/}{\textbf{\theQuestionQCM/}}~\ListeQCM[##1,1]\xintFor* ##2 in {\xintSeq {1}{\useKV[ClesQCM]{Reponses}}}\do{%
+                               &\ifboolKV[ClesQCM]{Alterne}{\modulo{\theQuestionQCM}{2}\ifnum\remainder=0\cellcolor{gray!15}\fi}{}\ifboolKV[ClesQCM]{Solution}{\xintifboolexpr{##2==\ListeQCM[##1,2]}{$\boxtimes$}{$\square$}}{$\square$}%
+                                 }\\
+          }%
+          \hline%
+        \end{tabular}
+      }{%
+        \renewcommand{\arraystretch}{\useKV[ClesQCM]{Stretch}}%
+        \setlength{\LargeurQCM}{\fpeval{(\linewidth-\useKV[ClesQCM]{Reponses}*(3*\tabcolsep+\useKV[ClesQCM]{Largeur}))}pt}%
+        \xdef\NBcases{\fpeval{\useKV[ClesQCM]{Reponses}+1}}%
+        \begin{tabular}{|p{\LargeurQCM}|*{\useKV[ClesQCM]{Reponses}}{>{\centering\arraybackslash}p{\useKV[ClesQCM]{Largeur}}|}}%
+          \ifboolKV[ClesQCM]{Titre}{\cline{2-\NBcases}%
+          \multicolumn{1}{c|}{}\xintFor* ##2 in {\xintSeq {1}{\useKV[ClesQCM]{Reponses}}}\do{%
+          &\stepcounter{TitreQCM}\useKV[ClesQCM]{Nom} \ifboolKV[ClesQCM]{AlphT}{\Alph{TitreQCM}}{##2}}%
+          \\
+          }{}
+          \hline%
+          \xintFor* ##1 in {\xintSeq {1}{\ListeQCMlen}}\do{%
+          \stepcounter{QuestionQCM}\ifboolKV[ClesQCM]{Alterne}{\modulo{\theQuestionQCM}{2}\ifnum\remainder=0\cellcolor{gray!15}\fi}{}\ifboolKV[ClesQCM]{Alph}{\textbf{\Alph{QuestionQCM}}/}{\textbf{\theQuestionQCM/}}~\ListeQCM[##1,1]\xintFor* ##2 in {\xintSeq {1}{\useKV[ClesQCM]{Reponses}}}\do{%
+          &\ifboolKV[ClesQCM]{Alterne}{\modulo{\theQuestionQCM}{2}\ifnum\remainder=0\cellcolor{gray!15}\fi}{}\ifboolKV[ClesQCM]{Solution}{\xdef\NumeroReponse{\fpeval{\useKV[ClesQCM]{Reponses}+2}}\xintifboolexpr{##2==\ListeQCM[##1,\NumeroReponse]}{\cellcolor{\useKV[ClesQCM]{Couleur}}}{}}{}\ListeQCM[##1,##2+1]%
+            }\\
+          }%
+          \hline%
+        \end{tabular}%
+      }%
+    }%
+    \renewcommand{\arraystretch}{1}%
+  }%
+}{%
+  \NewDocumentCommand\QCM{om}{%
+    \useKVdefault[ClesQCM]%
+    \setKV[ClesQCM]{#1}%
+    \setcounter{QuestionQCM}{\fpeval{\useKV[ClesQCM]{Depart}-1}}%
+    \setcounter{TitreQCM}{0}
+    \setsepchar[*]{,*&}\ignoreemptyitems%
+    \readlist*\ListeQCM{#2}%
+    \ifboolKV[ClesQCM]{Multiple}{%
+      \renewcommand{\arraystretch}{\useKV[ClesQCM]{Stretch}}%
+      \setlength{\LargeurQCM}{\fpeval{(\linewidth-\useKV[ClesQCM]{Reponses}*(3*\tabcolsep+\useKV[ClesQCM]{Largeur}))}pt}%
+      \xdef\NBcases{\fpeval{\useKV[ClesQCM]{Reponses}+1}}%
+      \xdef\ListeNom{\useKV[ClesQCM]{Noms}}%
+      \setsepchar[*]{/}%
+      \readlist*\ListeNomsMul{\ListeNom}%
+      \begin{tabular}{|p{\LargeurQCM}|*{\useKV[ClesQCM]{Reponses}}{>{\centering\arraybackslash}p{\useKV[ClesQCM]{Largeur}}|}}%
+        \cline{2-\NBcases}%
+        \multicolumn{1}{c|}{}\xintFor* ##2 in {\xintSeq {1}{\useKV[ClesQCM]{Reponses}}}\do{%
+        &\ListeNomsMul[##2]}%
+        \\
+        \hline%
+        \xintFor* ##1 in {\xintSeq {1}{\ListeQCMlen}}\do{%
+        \stepcounter{QuestionQCM}\ifboolKV[ClesQCM]{Alterne}{\modulo{\theQuestionQCM}{2}\ifnum\remainder=0\cellcolor{gray!15}\fi}{}\ifboolKV[ClesQCM]{Alph}{\textbf{\Alph{QuestionQCM}}/}{\textbf{\theQuestionQCM/}}~\ListeQCM[##1,1]\xintFor* ##2 in {\xintSeq {1}{\useKV[ClesQCM]{Reponses}}}\do{%
+        &\ifboolKV[ClesQCM]{Alterne}{\modulo{\theQuestionQCM}{2}\ifnum\remainder=0\cellcolor{gray!15}\fi}{}\ifboolKV[ClesQCM]{Solution}{\xintifboolexpr{\ListeQCM[##1,\fpeval{##2+1}]==1}{$\boxtimes$}{$\square$}}{$\square$}%
+          }\\
+        }%
+        \hline%
+      \end{tabular}%
+      \renewcommand{\arraystretch}{1}%
+    }{%
+      \ifboolKV[ClesQCM]{VF}{%
+        \setKV[ClesQCM]{Reponses=2}%
+        \renewcommand{\arraystretch}{\useKV[ClesQCM]{Stretch}}%
+        \setlength{\PfCLargeurQCM}{\useKV[ClesQCM]{Largeur}}%
+        \setlength{\LargeurQCM}{\linewidth-6\tabcolsep-2\PfCLargeurQCM-4\arrayrulewidth}%
+        \xdef\NBcases{\fpeval{\useKV[ClesQCM]{Reponses}+1}}%
+        \begin{tabular}{|p{\LargeurQCM}|*{\useKV[ClesQCM]{Reponses}}{>{\centering\arraybackslash}p{\useKV[ClesQCM]{Largeur}}|}}%
+          \cline{2-\NBcases}%
+          \multicolumn{1}{c|}{}&\useKV[ClesQCM]{NomV}&\useKV[ClesQCM]{NomF}\\
+          \hline%
+          \xintFor* ##1 in {\xintSeq {1}{\ListeQCMlen}}\do{%
+          \stepcounter{QuestionQCM}\ifboolKV[ClesQCM]{Alterne}{\modulo{\theQuestionQCM}{2}\ifnum\remainder=0\cellcolor{gray!15}\fi}{}\ifboolKV[ClesQCM]{Alph}{\textbf{\Alph{QuestionQCM}}/}{\textbf{\theQuestionQCM/}}~\ListeQCM[##1,1]\xintFor* ##2 in {\xintSeq {1}{\useKV[ClesQCM]{Reponses}}}\do{%
+                               &\ifboolKV[ClesQCM]{Alterne}{\modulo{\theQuestionQCM}{2}\ifnum\remainder=0\cellcolor{gray!15}\fi}{}\ifboolKV[ClesQCM]{Solution}{\xintifboolexpr{##2==\ListeQCM[##1,2]}{$\boxtimes$}{$\square$}}{$\square$}%
+                                 }\\
+          }%
+          \hline%
+        \end{tabular}
+      }{%
+        \renewcommand{\arraystretch}{\useKV[ClesQCM]{Stretch}}%
+        \setlength{\LargeurQCM}{\fpeval{(\linewidth-\useKV[ClesQCM]{Reponses}*(3*\tabcolsep+\useKV[ClesQCM]{Largeur}))}pt}%
+        \xdef\NBcases{\fpeval{\useKV[ClesQCM]{Reponses}+1}}%
+        \begin{tabular}{|p{\LargeurQCM}|*{\useKV[ClesQCM]{Reponses}}{>{\centering\arraybackslash}p{\useKV[ClesQCM]{Largeur}}|}}%
+          \ifboolKV[ClesQCM]{Titre}{\cline{2-\NBcases}%
+          \multicolumn{1}{c|}{}\xintFor* ##2 in {\xintSeq {1}{\useKV[ClesQCM]{Reponses}}}\do{%
+          &\stepcounter{TitreQCM}\useKV[ClesQCM]{Nom} \ifboolKV[ClesQCM]{AlphT}{\Alph{TitreQCM}}{##2}}%
+          \\
+          }{}
+          \hline%
+          \xintFor* ##1 in {\xintSeq {1}{\ListeQCMlen}}\do{%
+          \stepcounter{QuestionQCM}\ifboolKV[ClesQCM]{Alterne}{\modulo{\theQuestionQCM}{2}\ifnum\remainder=0\cellcolor{gray!15}\fi}{}\ifboolKV[ClesQCM]{Alph}{\textbf{\Alph{QuestionQCM}}/}{\textbf{\theQuestionQCM/}}~\ListeQCM[##1,1]\xintFor* ##2 in {\xintSeq {1}{\useKV[ClesQCM]{Reponses}}}\do{%
+          &\ifboolKV[ClesQCM]{Alterne}{\modulo{\theQuestionQCM}{2}\ifnum\remainder=0\cellcolor{gray!15}\fi}{}\ifboolKV[ClesQCM]{Solution}{\xdef\NumeroReponse{\fpeval{\useKV[ClesQCM]{Reponses}+2}}\xintifboolexpr{##2==\ListeQCM[##1,\NumeroReponse]}{\cellcolor{\useKV[ClesQCM]{Couleur}}}{}}{}\ListeQCM[##1,##2+1]%
+            }\\
+          }%
+          \hline%
+        \end{tabular}%
+      }%
+    }%
+    \renewcommand{\arraystretch}{1}%
+  }%
+}%
\ No newline at end of file


Property changes on: trunk/Master/texmf-dist/tex/latex/profcollege/PfCEcrireQCMold.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/texmf-dist/tex/latex/profcollege/PfCEcrireunQCM.tex
===================================================================
--- trunk/Master/texmf-dist/tex/latex/profcollege/PfCEcrireunQCM.tex	2023-07-04 19:52:56 UTC (rev 67544)
+++ trunk/Master/texmf-dist/tex/latex/profcollege/PfCEcrireunQCM.tex	2023-07-04 19:53:24 UTC (rev 67545)
@@ -6,6 +6,7 @@
 \newlength{\PfCLargeurQCM}%
 \newcounter{QuestionQCM}%
 \newcounter{TitreQCM}%
+%
 \ifdef{\QCM}{%
   \PackageWarning{ProfCollege}{La commande \noexpand\QCM étant définie par la classe du document, ProfCollege modifie sa commande \noexpand\QCM en \noexpand\QCMPfC.}%
   \newcommand\QCMPfC[2][]{%
@@ -13,12 +14,12 @@
     \setKV[ClesQCM]{#1}%
     \setcounter{QuestionQCM}{\fpeval{\useKV[ClesQCM]{Depart}-1}}%
     \setcounter{TitreQCM}{0}
-    \setsepchar[*]{§*&}\ignoreemptyitems%
+    \setsepchar[*]{,*&}\ignoreemptyitems%
     \readlist*\ListeQCM{#2}%
+    \renewcommand{\arraystretch}{\useKV[ClesQCM]{Stretch}}%
+    \xdef\NBcases{\fpeval{\useKV[ClesQCM]{Reponses}+1}}%
     \ifboolKV[ClesQCM]{Multiple}{%
-      \renewcommand{\arraystretch}{\useKV[ClesQCM]{Stretch}}%
       \setlength{\LargeurQCM}{\fpeval{(\linewidth-\useKV[ClesQCM]{Reponses}*(3*\tabcolsep+\useKV[ClesQCM]{Largeur}))}pt}%
-      \xdef\NBcases{\fpeval{\useKV[ClesQCM]{Reponses}+1}}%
       \xdef\ListeNom{\useKV[ClesQCM]{Noms}}%
       \setsepchar[*]{/}%
       \readlist*\ListeNomsMul{\ListeNom}%
@@ -35,13 +36,13 @@
         }%
         \hline%
       \end{tabular}%
+      \renewcommand{\arraystretch}{1}%
     }{%
       \ifboolKV[ClesQCM]{VF}{%
         \setKV[ClesQCM]{Reponses=2}%
+%        \renewcommand{\arraystretch}{\useKV[ClesQCM]{Stretch}}%
         \setlength{\PfCLargeurQCM}{\useKV[ClesQCM]{Largeur}}%
         \setlength{\LargeurQCM}{\linewidth-6\tabcolsep-2\PfCLargeurQCM-4\arrayrulewidth}%
-        \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}%
@@ -55,9 +56,9 @@
           \hline%
         \end{tabular}
       }{%
-        \renewcommand{\arraystretch}{\useKV[ClesQCM]{Stretch}}%
+        %\renewcommand{\arraystretch}{\useKV[ClesQCM]{Stretch}}%
         \setlength{\LargeurQCM}{\fpeval{(\linewidth-\useKV[ClesQCM]{Reponses}*(3*\tabcolsep+\useKV[ClesQCM]{Largeur}))}pt}%
-        \xdef\NBcases{\fpeval{\useKV[ClesQCM]{Reponses}+1}}%
+        %\xdef\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{%
@@ -75,7 +76,7 @@
       }%
     }%
     \renewcommand{\arraystretch}{1}%
-  }%
+  }
 }{%
   \newcommand\QCM[2][]{%
     \useKVdefault[ClesQCM]%
@@ -84,10 +85,10 @@
     \setcounter{TitreQCM}{0}
     \setsepchar[*]{,*&}\ignoreemptyitems%
     \readlist*\ListeQCM{#2}%
+    \renewcommand{\arraystretch}{\useKV[ClesQCM]{Stretch}}%
+    \xdef\NBcases{\fpeval{\useKV[ClesQCM]{Reponses}+1}}%
     \ifboolKV[ClesQCM]{Multiple}{%
-      \renewcommand{\arraystretch}{\useKV[ClesQCM]{Stretch}}%
       \setlength{\LargeurQCM}{\fpeval{(\linewidth-\useKV[ClesQCM]{Reponses}*(3*\tabcolsep+\useKV[ClesQCM]{Largeur}))}pt}%
-      \xdef\NBcases{\fpeval{\useKV[ClesQCM]{Reponses}+1}}%
       \xdef\ListeNom{\useKV[ClesQCM]{Noms}}%
       \setsepchar[*]{/}%
       \readlist*\ListeNomsMul{\ListeNom}%
@@ -108,7 +109,7 @@
     }{%
       \ifboolKV[ClesQCM]{VF}{%
         \setKV[ClesQCM]{Reponses=2}%
-        \renewcommand{\arraystretch}{\useKV[ClesQCM]{Stretch}}%
+%        \renewcommand{\arraystretch}{\useKV[ClesQCM]{Stretch}}%
         \setlength{\PfCLargeurQCM}{\useKV[ClesQCM]{Largeur}}%
         \setlength{\LargeurQCM}{\linewidth-6\tabcolsep-2\PfCLargeurQCM-4\arrayrulewidth}%
         \xdef\NBcases{\fpeval{\useKV[ClesQCM]{Reponses}+1}}%
@@ -124,9 +125,9 @@
           \hline%
         \end{tabular}
       }{%
-        \renewcommand{\arraystretch}{\useKV[ClesQCM]{Stretch}}%
+        %\renewcommand{\arraystretch}{\useKV[ClesQCM]{Stretch}}%
         \setlength{\LargeurQCM}{\fpeval{(\linewidth-\useKV[ClesQCM]{Reponses}*(3*\tabcolsep+\useKV[ClesQCM]{Largeur}))}pt}%
-        \xdef\NBcases{\fpeval{\useKV[ClesQCM]{Reponses}+1}}%
+        %\xdef\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{%

Modified: trunk/Master/texmf-dist/tex/latex/profcollege/PfCEcritureUnites.tex
===================================================================
--- trunk/Master/texmf-dist/tex/latex/profcollege/PfCEcritureUnites.tex	2023-07-04 19:52:56 UTC (rev 67544)
+++ trunk/Master/texmf-dist/tex/latex/profcollege/PfCEcritureUnites.tex	2023-07-04 19:53:24 UTC (rev 67545)
@@ -191,9 +191,9 @@
   }%
 }%
 
-\NewDocumentCommand\Lg{o m}{%
+\NewDocumentCommand\Lg{s o m}{%
   \useKVdefault[Unites]%
-  \setKV[Unites]{#1}%
+  \setKV[Unites]{#2}%
   \ifboolKV[Unites]{nm}{%
     \DeclareSIUnit{\Tempo}{\nano\meter}%
   }{%
@@ -226,18 +226,27 @@
         }%
       }%
     }%
-  }% 
-  \ifboolKV[Unites]{Nombre}{%
-    \SI{#2}{\Tempo}%
+  }%
+  \IfBooleanTF{#1}{%
+    \ifboolKV[Unites]{Nombre}{%
+      \SI[parse-numbers=false]{#3}{\Tempo}%
+    }{%
+      \setlength{\PfCLgUnites}{\useKV[Unites]{Dots}}%
+      \pointilles[\PfCLgUnites]\,\si{\Tempo}%
+    }%
   }{%
-    \setlength{\PfCLgUnites}{\useKV[Unites]{Dots}}%
-    \pointilles[\PfCLgUnites]\,\si{\Tempo}%
+    \ifboolKV[Unites]{Nombre}{%
+      \SI{#3}{\Tempo}%
+    }{%
+      \setlength{\PfCLgUnites}{\useKV[Unites]{Dots}}%
+      \pointilles[\PfCLgUnites]\,\si{\Tempo}%
+    }%
   }%
 }%
 
-\NewDocumentCommand\Masse{o m}{%
+\NewDocumentCommand\Masse{s o m}{%
   \useKVdefault[Unites]%
-  \setKV[Unites]{#1}%
+  \setKV[Unites]{#2}%
   \ifboolKV[Unites]{ng}{%
     \DeclareSIUnit{\Tempo}{\nano\gram}%
   }{\ifboolKV[Unites]{ug}{%
@@ -271,17 +280,26 @@
       }%
     }%
   }%
-  \ifboolKV[Unites]{Nombre}{%
-    \SI{#2}{\Tempo}%
+  \IfBooleanTF{#1}{%
+    \ifboolKV[Unites]{Nombre}{%
+    \SI[parse-numbers=false]{#3}{\Tempo}%
   }{%
     \setlength{\PfCLgUnites}{\useKV[Unites]{Dots}}%
     \pointilles[\PfCLgUnites]\,\si{\Tempo}%
   }%
+  }{%
+    \ifboolKV[Unites]{Nombre}{%
+    \SI{#3}{\Tempo}%
+  }{%
+    \setlength{\PfCLgUnites}{\useKV[Unites]{Dots}}%
+    \pointilles[\PfCLgUnites]\,\si{\Tempo}%
+  }%
+  }
 }%
 
-\NewDocumentCommand\Capa{o m}{%
+\NewDocumentCommand\Capa{s o m}{%
   \useKVdefault[Unites]%
-  \setKV[Unites]{#1}%
+  \setKV[Unites]{#2}%
   \ifboolKV[Unites]{kL}{%
     \DeclareSIUnit{\Tempo}{\kilo\liter}%
   }{\ifboolKV[Unites]{hL}{%
@@ -302,17 +320,26 @@
       }%
     }%
   }%
+  \IfBooleanTF{#1}{%
+    \ifboolKV[Unites]{Nombre}{%
+      \SI[parse-numbers=false]{#3}{\Tempo}%
+    }{%
+      \setlength{\PfCLgUnites}{\useKV[Unites]{Dots}}%
+      \pointilles[\PfCLgUnites]\,\si{\Tempo}%
+    }%
+  }{%
   \ifboolKV[Unites]{Nombre}{%
-    \SI{#2}{\Tempo}%
+    \SI{#3}{\Tempo}%
   }{%
     \setlength{\PfCLgUnites}{\useKV[Unites]{Dots}}%
     \pointilles[\PfCLgUnites]\,\si{\Tempo}%
   }%
+  }%
 }%
 
-\NewDocumentCommand\Aire{o m}{%
+\NewDocumentCommand\Aire{s o m}{%
   \useKVdefault[Unites]%
-  \setKV[Unites]{#1}%
+  \setKV[Unites]{#2}%
   \ifboolKV[Unites]{ha}{%
     \DeclareSIUnit{\Tempo}{\hectare}%
   }{%
@@ -354,17 +381,26 @@
       }%
     }%
   }%
-  \ifboolKV[Unites]{Nombre}{%
-    \SI{#2}{\Tempo}%
+  \IfBooleanTF{#1}{%
+    \ifboolKV[Unites]{Nombre}{%
+      \SI[parse-numbers=false]{#3}{\Tempo}%
+    }{%
+      \setlength{\PfCLgUnites}{\useKV[Unites]{Dots}}%
+      \pointilles[\PfCLgUnites]\,\si{\Tempo}%
+    }%
   }{%
-    \setlength{\PfCLgUnites}{\useKV[Unites]{Dots}}%
-    \pointilles[\PfCLgUnites]\,\si{\Tempo}%
+    \ifboolKV[Unites]{Nombre}{%
+      \SI{#3}{\Tempo}%
+    }{%
+      \setlength{\PfCLgUnites}{\useKV[Unites]{Dots}}%
+      \pointilles[\PfCLgUnites]\,\si{\Tempo}%
+    }%
   }%
 }%
 
-\NewDocumentCommand\Vol{o m}{%
+\NewDocumentCommand\Vol{s o m}{%
   \useKVdefault[Unites]%
-  \setKV[Unites]{#1}%
+  \setKV[Unites]{#2}%
   \ifboolKV[Unites]{nm}{%
     \DeclareSIUnit{\Tempo}{\nano\meter}%
   }{%
@@ -397,12 +433,21 @@
         }%
       }%
     }%
-  }% 
-  \ifboolKV[Unites]{Nombre}{%
-    \SI{#2}{\cubic\Tempo}%
+  }%
+  \IfBooleanTF{#1}{%
+    \ifboolKV[Unites]{Nombre}{%
+      \SI[parse-numbers=false]{#3}{\cubic\Tempo}%
+    }{%
+      \setlength{\PfCLgUnites}{\useKV[Unites]{Dots}}%
+      \pointilles[\PfCLgUnites]\,\si{\cubic\Tempo}%
+    }%
   }{%
-    \setlength{\PfCLgUnites}{\useKV[Unites]{Dots}}%
-    \pointilles[\PfCLgUnites]\,\si{\cubic\Tempo}%
+    \ifboolKV[Unites]{Nombre}{%
+      \SI{#3}{\cubic\Tempo}%
+    }{%
+      \setlength{\PfCLgUnites}{\useKV[Unites]{Dots}}%
+      \pointilles[\PfCLgUnites]\,\si{\cubic\Tempo}%
+    }%
   }%
 }%
 

Modified: trunk/Master/texmf-dist/tex/latex/profcollege/PfCFonctionAffine.tex
===================================================================
--- trunk/Master/texmf-dist/tex/latex/profcollege/PfCFonctionAffine.tex	2023-07-04 19:52:56 UTC (rev 67544)
+++ trunk/Master/texmf-dist/tex/latex/profcollege/PfCFonctionAffine.tex	2023-07-04 19:53:24 UTC (rev 67545)
@@ -1,7 +1,7 @@
 %%%
 % 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 ?
+\setKVdefault[ClesAffine]{Nom=f,Variable=x,CoefDir=a,OrdoOrig=b,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
@@ -58,20 +58,20 @@
       }%
     }{%
       \ifboolKV[ClesAffine]{Retrouve}{%
-        On sait que $\useKV[ClesAffine]{Nom}$ est une fonction affine. Donc elle s'\'ecrit sous la forme : \[\useKV[ClesAffine]{Nom}(\useKV[ClesAffine]{Variable})=a\useKV[ClesAffine]{Variable}+b\]
+        On sait que $\useKV[ClesAffine]{Nom}$ est une fonction affine. Donc elle s'\'ecrit sous la forme : \[\useKV[ClesAffine]{Nom}(\useKV[ClesAffine]{Variable})=\useKV[ClesAffine]{CoefDir}\useKV[ClesAffine]{Variable}+\useKV[ClesAffine]{OrdoOrig}\]
         Or, $\useKV[ClesAffine]{Nom}(\num{#2})=\num{#3}$ et $\useKV[ClesAffine]{Nom}(\num{#4})=\num{#5}$. Par cons\'equent, d'apr\`es la propri\'et\'e 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}}}{}%
+          \useKV[ClesAffine]{CoefDir}&=\frac{\useKV[ClesAffine]{Nom}(\num{#2})-\useKV[ClesAffine]{Nom}(\num{#4})}{\num{#2}-\xintifboolexpr{#4<0}{(\num{#4})}{\num{#4}}}\\
+          \useKV[ClesAffine]{CoefDir}&=\frac{\num{#3}-\xintifboolexpr{#5<0}{(\num{#5})}{\num{#5}}}{\num{\fpeval{#2-#4}}}\\
+          \useKV[ClesAffine]{CoefDir}&=\frac{\num{\fpeval{#3-#5}}}{\num{\fpeval{#2-#4}}}%\\
+          \SSimpliTest{\fpeval{#3-#5}}{\fpeval{#2-#4}}\ifthenelse{\boolean{Simplification}}{\\\useKV[ClesAffine]{CoefDir}&=\SSimplifie{\fpeval{#3-#5}}{\fpeval{#2-#4}}}{}%
         \end{align*}
-        La fonction $\useKV[ClesAffine]{Nom}$ s'\'ecrit alors sous la forme $\displaystyle\useKV[ClesAffine]{Nom}(\useKV[ClesAffine]{Variable})=\SSimplifie{\fpeval{#3-#5}}{\fpeval{#2-#4}}\useKV[ClesAffine]{Variable}+b$.
+        La fonction $\useKV[ClesAffine]{Nom}$ s'\'ecrit alors sous la forme $\displaystyle\useKV[ClesAffine]{Nom}(\useKV[ClesAffine]{Variable})=\SSimplifie{\fpeval{#3-#5}}{\fpeval{#2-#4}}\useKV[ClesAffine]{Variable}+\useKV[ClesAffine]{OrdoOrig}$.
         \\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)}}
+          \SSimplifie{\fpeval{#3-#5}}{\fpeval{#2-#4}}\times\xintifboolexpr{#2<0}{(\num{#2})}{\num{#2}}+\useKV[ClesAffine]{OrdoOrig}&=\num{#3}\\
+          \SSimplifie{\fpeval{(#3-#5)*#2}}{\fpeval{#2-#4}}+\useKV[ClesAffine]{OrdoOrig}&=\num{#3}\\
+          \useKV[ClesAffine]{OrdoOrig}&=\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\'ee est :

Modified: trunk/Master/texmf-dist/tex/latex/profcollege/PfCJeuRangement.tex
===================================================================
--- trunk/Master/texmf-dist/tex/latex/profcollege/PfCJeuRangement.tex	2023-07-04 19:52:56 UTC (rev 67544)
+++ trunk/Master/texmf-dist/tex/latex/profcollege/PfCJeuRangement.tex	2023-07-04 19:53:24 UTC (rev 67545)
@@ -39,7 +39,8 @@
     \Rangement[Seul]{\faa}% \PfCListeRgtRecup
     \setsepchar{,}%
     % Liste des nombres
-    \readlist*\ListeDesNombres{\PfCListeRgtRecup}
+    % \readlist*\ListeDesNombres{\PfCListeRgtRecup}
+    \readlist*\ListeDesNombres{\PfCRetiensRangement}
   }{%
     \setsepchar{,}%
     % Liste des nombres

Modified: trunk/Master/texmf-dist/tex/latex/profcollege/PfCMentalo.tex
===================================================================
--- trunk/Master/texmf-dist/tex/latex/profcollege/PfCMentalo.tex	2023-07-04 19:52:56 UTC (rev 67544)
+++ trunk/Master/texmf-dist/tex/latex/profcollege/PfCMentalo.tex	2023-07-04 19:53:24 UTC (rev 67545)
@@ -1,10 +1,18 @@
 %%%
 % Mentalo
 %%%
-\NewDocumentCommand\PfCNum{m}{%
+\NewDocumentCommand\PfCNumold{m}{%
   \xintifboolexpr{#1<0}{(\num{#1})}{\num{#1}}%
 }%
 
+\NewDocumentCommand\PfCNum{m}{%
+  \ifnum#1<0\relax%
+    (\num{#1})%
+  \else%
+    \num{#1}%
+  \fi%
+}%
+
 \setKVdefault[Mentalo]{Questions=10,ValeurMin=1,ValeurMax=15}
 
 \NewDocumentCommand\Mentalo{o m}{%

Modified: trunk/Master/texmf-dist/tex/latex/profcollege/PfCNonogramme.tex
===================================================================
--- trunk/Master/texmf-dist/tex/latex/profcollege/PfCNonogramme.tex	2023-07-04 19:52:56 UTC (rev 67544)
+++ trunk/Master/texmf-dist/tex/latex/profcollege/PfCNonogramme.tex	2023-07-04 19:53:24 UTC (rev 67545)
@@ -104,7 +104,7 @@
     if unknown Sequence[cptnblignes][k]:
     else:
     nbpas:=nbpas+1;
-    label.lft(TEX(Sequence[cptnblignes][k]),(0,0) shifted (-(nbpas-1)*5mm-2.5mm,u*(-cptnblignes+0.5)));
+    label.lft(TEX(Sequence[cptnblignes][k]),(0,0) shifted (-(nbpas-1)*0.5*u-0.25*u,u*(-cptnblignes+0.5)));
     fi;
     endfor;
     endfor;
@@ -130,7 +130,7 @@
     if unknown SequenceCol[cptnbcolonnes][k]:
     else:
     nbpas:=nbpas+1;
-    label.top(TEX(SequenceCol[cptnbcolonnes][k]),(0,0) shifted (u*(cptnbcolonnes-0.5),(nbpas-1)*5mm+2.5mm));
+    label.top(TEX(SequenceCol[cptnbcolonnes][k]),(0,0) shifted (u*(cptnbcolonnes-0.5),(nbpas-1)*0.5*u+0.25*u));
     fi;
     endfor;
     endfor;

Modified: trunk/Master/texmf-dist/tex/latex/profcollege/PfCNotionFonction.tex
===================================================================
--- trunk/Master/texmf-dist/tex/latex/profcollege/PfCNotionFonction.tex	2023-07-04 19:52:56 UTC (rev 67544)
+++ trunk/Master/texmf-dist/tex/latex/profcollege/PfCNotionFonction.tex	2023-07-04 19:53:24 UTC (rev 67545)
@@ -1,7 +1,7 @@
 %%%
 % Fonction
 %%%
-\setKVdefault[ClesFonction]{Nom=f,Variable=x,Calcul=x,Tableau=false,Largeur=5mm,Ecriture=false,Definition=false,Points=false,Tangentes=false,PasX=1,PasY=1,UniteX=1,UniteY=1,Prolonge=false,Trace=false,Catmull=false,Epaisseur=1,Couleur=black,CouleurTrace=black,PointsCourbe=true,Codes=false,Origine={(0,0)},Vide=false}
+\setKVdefault[ClesFonction]{Nom=f,Variable=x,Calcul=x,Tableau=false,Largeur=5mm,Ecriture=false,Definition=false,Points=false,Tangentes=false,PasX=1,PasY=1,UniteX=1,UniteY=1,Prolonge=false,Trace=false,Catmull=false,Splines=false,Epaisseur=1,Couleur=black,CouleurTrace=black,PointsCourbe=true,Codes=false,Origine={(0,0)},Vide=false}
 \defKV[ClesFonction]{Traces=\setKV[ClesFonction]{Codes}}%
 
 \newtoks\toklistePtsFn%pour la discipline
@@ -38,6 +38,80 @@
       \toklistePtsFn{}%
       \setsepchar[*]{§*/}%\ignoreemptyitems%
       \readlist*\ListePoints{#2}%
+      \ifboolKV[ClesFonction]{Splines}{%
+        \xdef\PfCFooListePoints{}%
+          \foreachitem\compteur\in\ListePoints{%
+            \xdef\PfCFooListePoints{\PfCFooListePoints (\ListePoints[\compteurcnt,2],\ListePoints[\compteurcnt,3]),(\ListePoints[\compteurcnt,1],\ListePoints[\compteurcnt,4]),}%
+          }%
+          \MPSpline{\PfCFooListePoints}{\useKV[ClesFonction]{PasX}}{\useKV[ClesFonction]{PasY}}{\useKV[ClesFonction]{UniteX}}{\useKV[ClesFonction]{UniteY}}%
+      }{%
+        \ifboolKV[ClesFonction]{Catmull}{%
+          \xdef\PfCFooListePoints{(\ListePoints[1,2],\ListePoints[1,3]),}%
+          \foreachitem\compteur\in\ListePoints{%
+            \xdef\PfCFooListePoints{\PfCFooListePoints (\ListePoints[\compteurcnt,2],\ListePoints[\compteurcnt,3]),}%
+          }%
+          \xdef\PfCFooListePoints{\PfCFooListePoints (\ListePoints[\ListePointslen,2],\ListePoints[\ListePointslen,3]),}%
+          \MPCatmull{\PfCFooListePoints}{\useKV[ClesFonction]{PasX}}{\useKV[ClesFonction]{PasY}}{\useKV[ClesFonction]{UniteX}}{\useKV[ClesFonction]{UniteY}}%
+        }{%
+          \xdef\PfCFooListePoints{}
+          \ifboolKV[ClesFonction]{Tangentes}{%
+            \foreachitem\compteur\in\ListePoints{%
+              \xdef\PfCFooListePoints{\PfCFooListePoints \ListePoints[\compteurcnt,1],(\ListePoints[\compteurcnt,2],\ListePoints[\compteurcnt,3]),\ListePoints[\compteurcnt,4],}%
+            }%
+          }{%
+            \foreachitem\compteur\in\ListePoints{%
+              \xdef\PfCFooListePoints{\PfCFooListePoints (\ListePoints[\compteurcnt,2],\ListePoints[\compteurcnt,3]),}%
+            }%
+          }%
+          \MPCourbeNew{\PfCFooListePoints}%
+        }%
+      }%
+    }{%
+      \setsepchar{,}\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%
+      }{}%
+      \reademptyitems%
+    }%
+  }%
+}%
+
+\NewDocumentCommand\Fonctionold{o m}{%
+  \useKVdefault[ClesFonction]%
+  \setKV[ClesFonction]{#1}%
+  \ifboolKV[ClesFonction]{Trace}{%
+    \useKVdefault[TraceG]%
+    \setKV[TraceG]{#1}%
+    \tokPfCListeDesFonctions{}%
+    \tokPfCListeDesNomsFonctions{}%
+    \xdef\PfCFooFn{\useKV[ClesFonction]{Calcul}}
+    \xdef\PfCFooNomFn{\useKV[TraceG]{NomCourbe}}
+    \ifx\bla\PfCFooFn\bla%
+    \else
+    \readlist*\ListeDesFonctions{\PfCFooFn}
+    \foreachitem\compteur\in\ListeDesFonctions{\expandafter\UpdatePfCListeDesFonctions\compteur\nil}%
+    \fi
+    \ifx\bla\PfCFooNomFn\bla
+    \else
+    \readlist*\ListeDesNomsFonctions{\PfCFooNomFn}
+    \foreachitem\compteur\in\ListeDesNomsFonctions{\expandafter\UpdatePfCListeDesNomsFonctions\compteur\nil}%
+    \fi
+    \TraceMultiGraphique{\the\tokPfCListeDesFonctions}{\the\tokPfCListeDesNomsFonctions}%
+  }{%
+    \ifboolKV[ClesFonction]{Points}{%
+      \toklistePtsFn{}%
+      \setsepchar[*]{§*/}%\ignoreemptyitems%
+      \readlist*\ListePoints{#2}%
       \ifboolKV[ClesFonction]{Catmull}{%
         \xdef\PfCFooListePoints{(\ListePoints[1,2],\ListePoints[1,3]),}%
         \foreachitem\compteur\in\ListePoints{%
@@ -60,7 +134,7 @@
       }%
     }{%
       \setsepchar{,}\ignoreemptyitems%
-      \readlist*\ListeFonction{#2}%
+      \roeadlist*\ListeFonction{#2}%
       \StrSubstitute{\useKV[ClesFonction]{Calcul}}{\useKV[ClesFonction]{Variable}}{\i}[\temp]%
       \StrSubstitute{\useKV[ClesFonction]{Calcul}}{**}{^}[\tempa]%
       \StrSubstitute{\tempa}{*}{}[\tempab]%
@@ -78,6 +152,274 @@
   }%
 }%
 
+\def\MPSplineCode{%
+  boolean PointsCourbe,Code,Prolonge;
+  PointsCourbe=\useKV[ClesFonction]{PointsCourbe};
+  Code=\useKV[ClesFonction]{Codes};
+  Prolonge:=\useKV[ClesFonction]{Prolonge};
+  color CoulTrace;
+  CoulTrace:=\useKV[ClesFonction]{CouleurTrace};
+  Epaisseur:=\useKV[ClesFonction]{Epaisseur};
+  %
+  vardef EffectuerTraces=
+  \useKV[ClesFonction]{Traces};
+  enddef;
+%
+  def enplace=
+  xscaled X.u yscaled Y.u
+  enddef;
+  %
+  vardef placepoint(expr q,r)=
+  (q,r)*cm enplace
+  enddef;
+  %
+  nbspline=0;
+  %
+  nbpoints=50;
+  %  
+  vardef SplineCubique(expr xzero,yzero,xuno,yuno,dzero,duno)=
+  nbspline:=nbspline+1;
+  a[nbspline]*(xzero**3)+b[nbspline]*(xzero**2)+c[nbspline]*xzero+d[nbspline]=yzero;
+  a[nbspline]*(xuno**3)+b[nbspline]*(xuno**2)+c[nbspline]*xuno+d[nbspline]=yuno;
+  a[nbspline]*(3*(xzero**2))+b[nbspline]*(2*xzero)+c[nbspline]=dzero;
+  a[nbspline]*(3*(xuno**2))+b[nbspline]*(2*xuno)+c[nbspline]=duno;
+  % 
+  numeric xx[],yy[];
+  for k=1 upto nbpoints-1:
+  xx[k]=xzero+(k/nbpoints)*(xuno-xzero);
+  yy[k]=a[nbspline]*(xx[k]**3)+b[nbspline]*(xx[k]**2)+c[nbspline]*xx[k]+d[nbspline];
+  endfor;
+  save $;
+  picture $;
+  $=image(
+  draw placepoint(xzero,yzero) for k=1 upto nbpoints-1:
+  --placepoint(xx[k],yy[k])
+  endfor --placepoint(xuno,yuno);
+  );
+  $
+  enddef;
+}
+
+\def\MPSpline#1#2#3#4#5{%
+  % #1 la liste des points
+  % #2: pas en x
+  % #3: pas en y
+  % #4: unit\'e en x
+  % #5: unit\'e en y
+  \ifluatex
+  \mplibforcehmode
+  \begin{mplibcode}
+    \MPSplineCode;
+    
+    x.u:=#2;
+    y.u:=#3;
+    X.u:=#4;
+    Y.u:=#5;
+
+    pair Xn[],Fn[],Dn[];%Xn abscisse,ordonnée D : dérivé g,dérivée d
+    n=0;
+    for p_=#1:
+    n:=n+1;
+    if (n mod 2)=1:
+    Xn[(n div 2)+1]=p_;
+    Fn[(n div 2)+1]=cm*(X.u*xpart(p_),Y.u*ypart(p_));
+    else:
+    Dn[(n div 2)]=p_
+    fi;
+    endfor;
+    N:=n div 2;
+    MinX=999;
+    MaxX=-999;
+    MinY=999;
+    MaxY=-999;
+    if Prolonge:
+    debutbalai=2;
+    finbalai=N-1;
+    else:
+    debutbalai=1;
+    finbalai=N;
+    fi;
+    for k=debutbalai upto finbalai:
+    if xpart(Xn[k])<MinX:
+    MinX:=xpart(Xn[k]);
+    fi;
+    if xpart(Xn[k])>MaxX:
+    MaxX:=xpart(Xn[k]);
+    fi;
+    if ypart(Xn[k])<MinY:
+    MinY:=ypart(Xn[k]);
+    fi;
+    if ypart(Xn[k])>MaxY:
+    MaxY:=ypart(Xn[k]);
+    fi;
+    endfor;
+    if MaxY<1:
+    MaxY:=2;
+    fi;
+    if MinY>-1:
+    MinY:=-2;
+    fi;
+    if MinY<0:
+    if MinY<>ceiling(MinY):
+    MinY:=ceiling(MinY)-1;
+    fi;
+    fi;
+    if MinX<0:
+    if MinX<>ceiling(MinX):
+    MinX:=ceiling(MinX)-1;
+    fi;
+    fi;
+    if MaxY<>ceiling(MaxY):
+    MaxY:=ceiling(MaxY);
+    fi;
+    if MaxX<>ceiling(MaxX):
+    MaxX:=ceiling(MaxX);
+    fi;
+    if MaxX<1:
+    MaxX:=1;
+    fi;
+    if MaxY<1:
+    MaxY:=1;
+    fi;
+    %
+    path cadreexterieur;
+    cadreexterieur=(((MinX-1)*X.u*cm,(MinY-1)*Y.u*cm)--((MaxX+1)*X.u*cm,(MinY-1)*Y.u*cm)--((MaxX+1)*X.u*cm,(MaxY+1)*Y.u*cm)--((MinX-1)*X.u*cm,(MaxY+1)*Y.u*cm)--cycle);
+    for l=1 upto N-1:
+    draw SplineCubique(xpart(Xn[l]),ypart(Xn[l]),xpart(Xn[l+1]),ypart(Xn[l+1]),ypart(Dn[l]),xpart(Dn[l+1])) withpen pencircle scaled Epaisseur withcolor CoulTrace;
+    endfor;
+    clip currentpicture to cadreexterieur;
+    picture RetiensCourbe;
+    RetiensCourbe=currentpicture;
+    currentpicture:=nullpicture;
+    for k=MinY-1 step y.u until MaxY+1:
+    draw cm*((MinX-1)*X.u,k*Y.u)--cm*((MaxX+1)*X.u,k*Y.u) withcolor 0.75white;
+    endfor;
+    for k=MinX-1 step x.u until MaxX+1:
+    draw cm*(k*X.u,(MinY-1)*Y.u)--cm*(k*X.u,(MaxY+1)*Y.u) withcolor 0.75white;
+    endfor;
+    if PointsCourbe:
+    for k=debutbalai upto finbalai:
+    fill cercles(Fn[k],0.5mm);
+    endfor;
+    fi;
+    drawarrow (0,(MinY-1)*Y.u*cm)--(0,(MaxY+1)*Y.u*cm);
+    drawarrow ((MinX-1)*X.u*cm,0)--((MaxX+1)*X.u*cm,0);
+    %
+    draw RetiensCourbe;
+    label.llft(btex O etex,(0,0));
+    dotlabel.bot(btex 1 etex,cm*X.u*(1,0));
+    dotlabel.lft(btex 1 etex,cm*Y.u*(0,1));
+    if Code:
+    EffectuerTraces;
+    fi;
+  \end{mplibcode}
+  \else
+  \begin{mpost}[mpsettings={\MPSplineCode;}]    
+    x.u:=#2;
+    y.u:=#3;
+    X.u:=#4;
+    Y.u:=#5;
+
+    pair Xn[],Fn[],Dn[];%Xn abscisse,ordonnée D : dérivé g,dérivée d
+    n=0;
+    for p_=#1:
+    n:=n+1;
+    if (n mod 2)=1:
+    Xn[(n div 2)+1]=p_;
+    Fn[(n div 2)+1]=cm*(X.u*xpart(p_),Y.u*ypart(p_));
+    else:
+    Dn[(n div 2)]=p_
+    fi;
+    endfor;
+    N:=n div 2;
+    MinX=999;
+    MaxX=-999;
+    MinY=999;
+    MaxY=-999;
+    if Prolonge:
+    debutbalai=2;
+    finbalai=N-1;
+    else:
+    debutbalai=1;
+    finbalai=N;
+    fi;
+    for k=debutbalai upto finbalai:
+    if xpart(Xn[k])<MinX:
+    MinX:=xpart(Xn[k]);
+    fi;
+    if xpart(Xn[k])>MaxX:
+    MaxX:=xpart(Xn[k]);
+    fi;
+    if ypart(Xn[k])<MinY:
+    MinY:=ypart(Xn[k]);
+    fi;
+    if ypart(Xn[k])>MaxY:
+    MaxY:=ypart(Xn[k]);
+    fi;
+    endfor;
+    if MaxY<1:
+    MaxY:=2;
+    fi;
+    if MinY>-1:
+    MinY:=-2;
+    fi;
+    if MinY<0:
+    if MinY<>ceiling(MinY):
+    MinY:=ceiling(MinY)-1;
+    fi;
+    fi;
+    if MinX<0:
+    if MinX<>ceiling(MinX):
+    MinX:=ceiling(MinX)-1;
+    fi;
+    fi;
+    if MaxY<>ceiling(MaxY):
+    MaxY:=ceiling(MaxY);
+    fi;
+    if MaxX<>ceiling(MaxX):
+    MaxX:=ceiling(MaxX);
+    fi;
+    if MaxX<1:
+    MaxX:=1;
+    fi;
+    if MaxY<1:
+    MaxY:=1;
+    fi;
+    %
+    path cadreexterieur;
+    cadreexterieur=(((MinX-1)*X.u*cm,(MinY-1)*Y.u*cm)--((MaxX+1)*X.u*cm,(MinY-1)*Y.u*cm)--((MaxX+1)*X.u*cm,(MaxY+1)*Y.u*cm)--((MinX-1)*X.u*cm,(MaxY+1)*Y.u*cm)--cycle);
+    for l=1 upto N-1:
+    draw SplineCubique(xpart(Xn[l]),ypart(Xn[l]),xpart(Xn[l+1]),ypart(Xn[l+1]),ypart(Dn[l]),xpart(Dn[l+1])) withpen pencircle scaled Epaisseur withcolor CoulTrace;
+    endfor;
+    clip currentpicture to cadreexterieur;
+    picture RetiensCourbe;
+    RetiensCourbe=currentpicture;
+    currentpicture:=nullpicture;
+    for k=MinY-1 step y.u until MaxY+1:
+    draw cm*((MinX-1)*X.u,k*Y.u)--cm*((MaxX+1)*X.u,k*Y.u) withcolor 0.75white;
+    endfor;
+    for k=MinX-1 step x.u until MaxX+1:
+    draw cm*(k*X.u,(MinY-1)*Y.u)--cm*(k*X.u,(MaxY+1)*Y.u) withcolor 0.75white;
+    endfor;
+    if PointsCourbe:
+    for k=debutbalai upto finbalai:
+    fill cercles(Fn[k],0.5mm);
+    endfor;
+    fi;
+    drawarrow (0,(MinY-1)*Y.u*cm)--(0,(MaxY+1)*Y.u*cm);
+    drawarrow ((MinX-1)*X.u*cm,0)--((MaxX+1)*X.u*cm,0);
+    %
+    draw RetiensCourbe;
+    label.llft(btex O etex,(0,0));
+    dotlabel.bot(btex 1 etex,cm*X.u*(1,0));
+    dotlabel.lft(btex 1 etex,cm*Y.u*(0,1));
+    if Code:
+    EffectuerTraces;
+    fi;    
+  \end{mpost}
+  \fi
+}
+
 \def\PfCTraceMGCode{%
   nbcourbe=\ListeDesFonctionslen;
   % 

Added: trunk/Master/texmf-dist/tex/latex/profcollege/PfCNumberHive.tex
===================================================================
--- trunk/Master/texmf-dist/tex/latex/profcollege/PfCNumberHive.tex	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/profcollege/PfCNumberHive.tex	2023-07-04 19:53:24 UTC (rev 67545)
@@ -0,0 +1,399 @@
+%%%
+% Number Hive
+%%%
+\setKVdefault[NumberHive]{Negatif=false,Produit=false,Niveau=8,Double=false,ListeCouleurs={Cornsilk,LightSteelBlue},CouleurCase=false,Jeton=false,Graines=false,Aide=false,UniteHexa=6mm}%
+\defKV[NumberHive]{Cases=\setKV[NumberHive]{CouleurCase}}%
+\defKV[NumberHive]{Jetons=\setKV[NumberHive]{Jeton}}%
+\defKV[NumberHive]{Graine=\setKV[NumberHive]{Graines}}%
+
+\newtoks\toklistenumberhive%
+\newtoks\toklistecasescoloreesNH%
+
+\def\UpdatetoksNHive#1\nil{\addtotok\toklistenumberhive{"#1",}}%
+\def\UpdatetoksCCNHive#1\nil{\addtotok\toklistecasescoloreesNH{#1,}}%
+
+\NewDocumentCommand\NumberHive{o}{%
+  \useKVdefault[NumberHive]%
+  \setKV[NumberHive]{#1}%
+  \toklistenumberhive{}%
+  \toklistecasescoloreesNH{}%
+  \ifboolKV[NumberHive]{CouleurCase}{%
+    \xdef\PfCFooNH{\useKV[NumberHive]{Cases}}%
+    \setsepchar{,}\ignoreemptyitems%
+    \readlist*\ListeCasesColoreesNH{\PfCFooNH}%
+    \reademptyitems%
+    \foreachitem\compteur\in\ListeCasesColoreesNH{\expandafter\UpdatetoksCCNHive\compteur\nil}%
+  }{}%
+  \xdef\ListeAvantCouleurs{\useKV[NumberHive]{ListeCouleurs}}%
+  \ifboolKV[NumberHive]{Graines}{\PfCGraineAlea{\useKV[NumberHive]{Graine}}}{}%
+  \ifboolKV[NumberHive]{Produit}{%
+    \xdef\PfCNHListe{1,2,3,4,5,6,7,8,9,10,11,12,14,16,18,20,22,24,15,21,27,30,33,36,28,32,40,44,48,25,35,45,50,55,60,42,54,66,72,56,63,70,77,84,64,72,80,88,96,81,90,99,108,100,110,120,121,132,144}%
+    \ifboolKV[NumberHive]{Double}{%
+      \MelangeListe{\PfCNHListe}{59}%
+    }{%
+      \xdef\PfCNHListe{\PfCNHListe,\PfCNHListe}%
+      \MelangeListe{\PfCNHListe}{46}%
+    }%
+  }{%
+    \ifboolKV[NumberHive]{Negatif}{%
+      \xdef\PfCNHListe{-12,-11,-10,-9,-8,-7,-5,-4,-3,-2,-1,0,1,2,3,4,5,7,8,9,10,11,12}%
+    }{%
+      \xdef\PfCNHListe{2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24}%
+    }%
+    \xdef\PfCNHListe{\PfCNHListe,\PfCNHListe}%
+    \MelangeListe{\PfCNHListe}{46}%
+  }%
+  \setsepchar{,}%
+  \readlist*\ListeCompoNH{\faa}%
+  \foreachitem\compteur\in\ListeCompoNH{\expandafter\UpdatetoksNHive\compteur\nil}%
+  \begin{tikzpicture}
+    \node[xshift=1cm,yshift=-1cm,rotate=45] at (0,0) {\includegraphics[scale=0.1]{LogoNumberHive.png}};
+    \node[anchor=north west] at (0,0) {\BuildNumberHiveAdditif{\the\toklistenumberhive}{\useKV[NumberHive]{Niveau}}{\useKV[NumberHive]{Jetons}}{\ListeAvantCouleurs}{\the\toklistecasescoloreesNH}};
+    \end{tikzpicture}    
+}% 
+
+\NewDocumentCommand\BuildNumberHiveAdditif{mmmmm}{%
+  \ifluatex
+  \mplibforcehmode
+  \begin{mplibcode}
+    boolean Produit,Negatif,CouleurCase,Double,Jeton,Aide;
+    Double=\useKV[NumberHive]{Double};
+    Produit=\useKV[NumberHive]{Produit};
+    Negatif=\useKV[NumberHive]{Negatif};
+    CouleurCase=\useKV[NumberHive]{CouleurCase};
+    Jeton=\useKV[NumberHive]{Jeton};
+    Aide=\useKV[NumberHive]{Aide};
+    UniteHexa=\useKV[NumberHive]{UniteHexa};
+    
+    numeric JetonNegatif[];
+    JetonNegatif[1]=-6;
+    JetonNegatif[2]=-5;
+    JetonNegatif[3]=-4;
+    JetonNegatif[4]=-3;
+    JetonNegatif[5]=-2;
+    JetonNegatif[6]=-1;
+    JetonNegatif[7]=1;
+    JetonNegatif[8]=2;
+    JetonNegatif[9]=3;
+    JetonNegatif[10]=4;
+    JetonNegatif[11]=5;
+    JetonNegatif[12]=6;
+
+    color C[];
+    nb=0;
+    
+    vardef RecupCouleurs(text t)=
+    for p_=t:
+    nb:=nb+1;
+    C[nb]=p_;
+    endfor;
+    enddef;
+
+    RecupCouleurs(#4);
+    
+    pair bu,bv;
+    bu=(1,0);
+    bv=(0,1);
+    vardef unithexa=
+    (cosd(30)*bu+sind(30)*bv)--(cosd(90)*bu+sind(90)*bv)--(cosd(150)*bu+sind(150)*bv)--(cosd(210)*bu+sind(210)*bv)--(cosd(270)*bu+sind(270)*bv)--(cosd(330)*bu+sind(330)*bv)--cycle
+    enddef;
+    
+    pair A[];
+    numeric numcase;
+    
+    vardef PlacerAncres=
+    numcase:=0;
+    if Double:
+    for n=5 upto #2:
+    for k=1 upto n:
+    numcase:=numcase+1;
+    A[numcase]:=(0,0)  shifted((3-n)*(UniteHexa*cosd(30),3*UniteHexa*sind(30))+k*(2*UniteHexa*cosd(30),0));
+    endfor;
+    endfor;
+    % ligne n-1
+    for k=1 upto #2-1:
+    numcase:=numcase+1;
+    A[numcase]:=(0,0) shifted(((3-(#2-1))*UniteHexa*cosd(30),3*UniteHexa*sind(30))+(k*2*UniteHexa*cosd(30),-(3*(#2-1))*UniteHexa*sind(30)));
+    endfor;
+    %dernières lignes
+    for n=#2+2 upto #2+5:
+    for k=(n-#2) upto #2+1:
+    numcase:=numcase+1;
+    A[numcase]:=(0,0) shifted((3-n)*(UniteHexa*cosd(30),3*UniteHexa*sind(30))+k*(2*UniteHexa*cosd(30),0));
+    endfor;
+    endfor;
+    %%
+    else:
+    for n=3 upto #2:
+    for k=1 upto n:
+    numcase:=numcase+1;
+    A[numcase]:=(0,0)  shifted((3-n)*(UniteHexa*cosd(30),3*UniteHexa*sind(30))+k*(2*UniteHexa*cosd(30),0));
+    endfor;
+    endfor;
+    % ligne n-1
+    for k=1 upto #2-1:
+    numcase:=numcase+1;
+    A[numcase]:=(0,0) shifted(((3-(#2-1))*UniteHexa*cosd(30),3*UniteHexa*sind(30))+(k*2*UniteHexa*cosd(30),-(3*(#2-1))*UniteHexa*sind(30)));
+    endfor;
+    %ligne n
+    for k=1 upto #2-2:
+    numcase:=numcase+1;
+    A[numcase]:=(0,0) shifted(((3-(#2-2))*UniteHexa*cosd(30),3*UniteHexa*sind(30))+(k*2*UniteHexa*cosd(30),-(3*#2)*UniteHexa*sind(30)));
+    endfor;
+    fi;
+    NbTotalCases=numcase;
+    enddef;
+
+    vardef PlacerCasesColorees(text t)=
+    rang:=0;
+    for p_=t:
+    rang:=rang+1;
+    fill ((unithexa scaled UniteHexa) shifted A[p_]) withcolor if (rang mod 2)=1:C[1] else: C[2] fi;
+    endfor;
+    enddef;
+
+    vardef TracerHexagones=
+    for k=1 upto NbTotalCases:
+    trace (unithexa scaled UniteHexa) shifted A[k];
+    if Aide:
+    label.top(TEX("\tiny"&decimal(k)),A[k]+(0,-UniteHexa));
+    fi;
+    endfor;
+    enddef;
+    
+    vardef PlacerNombres(text t)=
+    nbcase:=0;
+    for p_=t:
+    if nbcase<numcase:
+    nbcase:=nbcase+1;
+    label(TEX("\num{"&p_&"}"),A[nbcase]);
+    fi;
+    endfor;
+    enddef;
+
+    vardef PlaceJeton(expr ja,jb)=
+    drawoptions(withpen pencircle scaled 1.15);
+    trace cercles(BPlateau[ja],0.75*UniteHexa);
+    trace cercles(BPlateau[jb] shifted(5*2*UniteHexa*cosd(30)+3*3mm,0),0.75*UniteHexa);
+    drawoptions();
+    enddef;
+
+    pair BPlateau[];
+    pair Decal;
+    
+    vardef Plateau=
+    picture PGauche;
+    PGauche=image(
+      NomCase:=0;
+      if Double:
+      Decalage:=10;
+      else:
+      Decalage:=5;
+      fi;
+      for l=0 upto 2:
+      for k=3 downto 0:%
+      NomCase:=NomCase+1;
+      Decal:=(-((k-1)*2*UniteHexa*cosd(30)+k*3mm*cosd(0),(#2+Decalage)*2*UniteHexa*sind(30)+l*(2*UniteHexa*sind(30)+UniteHexa)));
+      BPlateau[NomCase]=(0,0) shifted Decal;
+      fill ((unithexa scaled UniteHexa) shifted Decal)  withcolor 0.75white;
+      trace ((unithexa scaled UniteHexa)) shifted Decal;
+      if Negatif:
+      label(TEX("$"&decimal(JetonNegatif[NomCase])&"$"),(0,0) shifted Decal);
+      else:
+      label(TEX(decimal(NomCase)),(0,0) shifted Decal);
+      fi;
+      endfor;
+      endfor;
+    );
+    draw PGauche;
+    draw PGauche shifted(5*2*UniteHexa*cosd(30)+3*3mm,0);
+    if Jeton:
+    PlaceJeton(#3);
+    fi;
+    if Produit:
+    label(TEX("\Huge$\times$"),(0,0) shifted(-(-4*UniteHexa*cosd(30),(#2+Decalage)*2*UniteHexa*sind(30)+1*(2*UniteHexa*sind(30)+UniteHexa))));
+    else:
+    label(TEX("\Huge$+$"),(0,0) shifted(-(-4*UniteHexa*cosd(30),(#2+Decalage)*2*UniteHexa*sind(30)+1*(2*UniteHexa*sind(30)+UniteHexa))));
+    fi;
+    enddef;    
+
+    PlacerAncres;
+    if CouleurCase:
+    PlacerCasesColorees(#5);
+    fi;
+    TracerHexagones;
+    PlacerNombres(#1);
+    Plateau;
+  \end{mplibcode}
+  \else%
+  \begin{mpost}[mpsettings={boolean Produit,Negatif,CouleurCase,Double,Jeton,Aide;
+    Double=\useKV[NumberHive]{Double};
+    Produit=\useKV[NumberHive]{Produit};
+    Negatif=\useKV[NumberHive]{Negatif};
+    CouleurCase=\useKV[NumberHive]{CouleurCase};
+    Jeton=\useKV[NumberHive]{Jeton};
+    Aide=\useKV[NumberHive]{Aide};
+    UniteHexa=\useKV[NumberHive]{UniteHexa};
+    }]
+    numeric JetonNegatif[];
+    JetonNegatif[1]=-6;
+    JetonNegatif[2]=-5;
+    JetonNegatif[3]=-4;
+    JetonNegatif[4]=-3;
+    JetonNegatif[5]=-2;
+    JetonNegatif[6]=-1;
+    JetonNegatif[7]=1;
+    JetonNegatif[8]=2;
+    JetonNegatif[9]=3;
+    JetonNegatif[10]=4;
+    JetonNegatif[11]=5;
+    JetonNegatif[12]=6;
+    
+    color C[];
+    nb=0;
+    
+    vardef RecupCouleurs(text t)=
+    for p_=t:
+    nb:=nb+1;
+    C[nb]=p_;
+    endfor;
+    enddef;
+
+    RecupCouleurs(#4);
+    
+    pair bu,bv;
+    bu=(1,0);
+    bv=(0,1);
+    vardef unithexa=
+    (cosd(30)*bu+sind(30)*bv)--(cosd(90)*bu+sind(90)*bv)--(cosd(150)*bu+sind(150)*bv)--(cosd(210)*bu+sind(210)*bv)--(cosd(270)*bu+sind(270)*bv)--(cosd(330)*bu+sind(330)*bv)--cycle
+    enddef;
+    
+    pair A[];
+    numeric numcase;
+    
+    vardef PlacerAncres=
+    numcase:=0;
+    if Double:
+    for n=5 upto #2:
+    for k=1 upto n:
+    numcase:=numcase+1;
+    A[numcase]:=(0,0)  shifted((3-n)*(UniteHexa*cosd(30),3*UniteHexa*sind(30))+k*(2*UniteHexa*cosd(30),0));
+    endfor;
+    endfor;
+    % ligne n-1
+    for k=1 upto #2-1:
+    numcase:=numcase+1;
+    A[numcase]:=(0,0) shifted(((3-(#2-1))*UniteHexa*cosd(30),3*UniteHexa*sind(30))+(k*2*UniteHexa*cosd(30),-(3*(#2-1))*UniteHexa*sind(30)));
+    endfor;
+    %dernières lignes
+    for n=#2+2 upto #2+5:
+    for k=(n-#2) upto #2+1:
+    numcase:=numcase+1;
+    A[numcase]:=(0,0) shifted((3-n)*(UniteHexa*cosd(30),3*UniteHexa*sind(30))+k*(2*UniteHexa*cosd(30),0));
+    endfor;
+    endfor;
+    %%
+    else:
+    for n=3 upto #2:
+    for k=1 upto n:
+    numcase:=numcase+1;
+    A[numcase]:=(0,0)  shifted((3-n)*(UniteHexa*cosd(30),3*UniteHexa*sind(30))+k*(2*UniteHexa*cosd(30),0));
+    endfor;
+    endfor;
+    % ligne n-1
+    for k=1 upto #2-1:
+    numcase:=numcase+1;
+    A[numcase]:=(0,0) shifted(((3-(#2-1))*UniteHexa*cosd(30),3*UniteHexa*sind(30))+(k*2*UniteHexa*cosd(30),-(3*(#2-1))*UniteHexa*sind(30)));
+    endfor;
+    %ligne n
+    for k=1 upto #2-2:
+    numcase:=numcase+1;
+    A[numcase]:=(0,0) shifted(((3-(#2-2))*UniteHexa*cosd(30),3*UniteHexa*sind(30))+(k*2*UniteHexa*cosd(30),-(3*#2)*UniteHexa*sind(30)));
+    endfor;
+    fi;
+    NbTotalCases=numcase;
+    enddef;
+
+    vardef PlacerCasesColorees(text t)=
+    rang:=0;
+    for p_=t:
+    rang:=rang+1;
+    fill ((unithexa scaled UniteHexa) shifted A[p_]) withcolor if (rang mod 2)=1:C[1] else: C[2] fi;
+    endfor;
+    enddef;
+
+    vardef TracerHexagones=
+    for k=1 upto NbTotalCases:
+    trace (unithexa scaled UniteHexa) shifted A[k];
+    if Aide:
+    label.top(LATEX("\tiny"&decimal(k)),A[k]+(0,-UniteHexa));
+    fi;
+    endfor;
+    enddef;
+    
+    vardef PlacerNombres(text t)=
+    nbcase:=0;
+    for p_=t:
+    if nbcase<numcase:
+    nbcase:=nbcase+1;
+    label(LATEX("\num{"&p_&"}"),A[nbcase]);
+    fi;
+    endfor;
+    enddef;
+
+    vardef PlaceJeton(expr ja,jb)=
+    drawoptions(withpen pencircle scaled 1.15);
+    trace cercles(BPlateau[ja],0.75*UniteHexa);
+    trace cercles(BPlateau[jb] shifted(5*2*UniteHexa*cosd(30)+3*3mm,0),0.75*UniteHexa);
+    drawoptions();
+    enddef;
+
+    pair BPlateau[];
+    pair Decal;
+    
+    vardef Plateau=
+    picture PGauche;
+    PGauche=image(
+      NomCase:=0;
+      if Double:
+      Decalage:=10;
+      else:
+      Decalage:=5;
+      fi;
+      for l=0 upto 2:
+      for k=3 downto 0:%
+      NomCase:=NomCase+1;
+      Decal:=(-((k-1)*2*UniteHexa*cosd(30)+k*3mm*cosd(0),(#2+Decalage)*2*UniteHexa*sind(30)+l*(2*UniteHexa*sind(30)+4*3mm)));
+      BPlateau[NomCase]=(0,0) shifted Decal;
+      fill ((unithexa scaled UniteHexa) shifted Decal)  withcolor 0.75white;
+      trace ((unithexa scaled UniteHexa)) shifted Decal;
+      if Negatif:
+      label(LATEX("$"&decimal(JetonNegatif[NomCase])&"$"),(0,0) shifted Decal);
+      else:
+      label(LATEX(decimal(NomCase)),(0,0) shifted Decal);
+      fi;
+      endfor;
+      endfor;
+    );
+    draw PGauche;
+    draw PGauche shifted(5*2*UniteHexa*cosd(30)+3*3mm,0);
+    if Jeton:
+    PlaceJeton(#3);
+    fi;
+    if Produit:
+    label(LATEX("\Huge$\times$"),(0,0) shifted(-(-4*UniteHexa*cosd(30),(#2+Decalage)*2*UniteHexa*sind(30)+1*(2*UniteHexa*sind(30)+4*3mm))));
+    else:
+    label(LATEX("\Huge$+$"),(0,0) shifted(-(-4*UniteHexa*cosd(30),(#2+Decalage)*2*UniteHexa*sind(30)+1*(2*UniteHexa*sind(30)+4*3mm))));
+    fi;
+    enddef;    
+
+    PlacerAncres;
+    if CouleurCase:
+    PlacerCasesColorees(#5);
+    fi;
+    TracerHexagones;
+    PlacerNombres(#1);
+    Plateau;
+  \end{mpost}
+  \fi
+}
\ No newline at end of file


Property changes on: trunk/Master/texmf-dist/tex/latex/profcollege/PfCNumberHive.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/texmf-dist/tex/latex/profcollege/PfCPavage.tex
===================================================================
--- trunk/Master/texmf-dist/tex/latex/profcollege/PfCPavage.tex	2023-07-04 19:52:56 UTC (rev 67544)
+++ trunk/Master/texmf-dist/tex/latex/profcollege/PfCPavage.tex	2023-07-04 19:53:24 UTC (rev 67545)
@@ -21,6 +21,8 @@
   Basej={u*(0,0.5)},
   Quadrilatere=false,
   Escher=false,
+  Einstein=false,
+  Vampire=false,
   Rayon=1,
   Epaisseur=1,
   Position=0.5,
@@ -1189,9 +1191,137 @@
   \fi%
 }%
 
+\def\MPEinsteinHatCode{
+  boolean After;
+  After:=\useKV[Pavage]{After};
+  %
+  def TraceFill(expr o,coul)=
+  fill o withcolor coul;
+  trace o;% withpen pencircle scaled 2;
+  enddef;
+  %
+  def TraceHache(expr o,coul,ang)=
+  trace hachurage(o,ang,0.2,0) withcolor coul;
+  trace o;% withpen pencircle scaled 2;
+  enddef;
+  % 
+  vardef EffectuerTraces=
+  \useKV[Pavage]{Traces}
+  enddef;
+  %
+  path Hat;
+  pair O[],A[],B[],C[],D[],E[],F[];
+  Rayon=\useKV[Pavage]{Rayon}*u;
+  O1=u*(3,3);
+  O3=pointarc(cercles(O1,Rayon),300);
+  O2=rotation(O3,O1,-60);
+  O4=CentreCercleC(O1,O2,O3);
+  O5=symetrie(O1,iso(O2,O3));
+  Rayonbis=abs(O1-CentreCercleC(O1,O2,O3));
+  draw polygone(O1,O2,O3) withcolor 0.7white;
+  path cc[];
+  cc1=cercles(O1,Rayonbis);
+  cc2=cercles(O2,Rayonbis);
+  cc3=cercles(O3,Rayonbis);
+  drawoptions(dashed evenly withcolor 0.7white);
+  trace cc1;trace cc2;trace cc3;
+  drawoptions();
+  for k=1 upto 3:
+  A[k]=pointarc(cc[k],30+0);
+  B[k]=pointarc(cc[k],30+60);
+  C[k]=pointarc(cc[k],30+2*60);
+  D[k]=pointarc(cc[k],30+3*60);
+  E[k]=pointarc(cc[k],30+4*60);
+  F[k]=pointarc(cc[k],30+5*60);
+  endfor;
+  drawoptions(dashed evenly);
+  trace polygone(A1,B1,C1,D1,E1,F1);
+  trace polygone(A2,B2,C2,D2,E2,F2);
+  trace polygone(A3,B3,C3,D3,E3,F3);
+  drawoptions();
+  Hat=polygone(O1,iso(C1,D1),D1,iso(D1,E1),O2,iso(E2,F2),F2,iso(D3,E3),O3,iso(F3,A3),A3,B3,iso(B3,C3));
+  color Coul[];
+  Coul1=Cyan;%;
+  Coul2=0.5[Blue,white];
+  Coul3=Cornsilk;
+  Coul4=0.5[Crimson,white];
+  Coul5=0.5[Purple,white];
+  Coul6=LightGreen;
+  %
+  vardef TileGen(expr aHat,bHat,ech)=
+  pair H[];
+  H0=iso(F2,E2);
+  H1-H0=Rayonbis*(aHat/ech)*unitvector(E2-F2);
+  H2-H1=Rayonbis*(aHat/ech)*unitvector(D2-E2);
+  H3-H2=Rayonbis*(bHat/ech)*unitvector(O2-iso(E2,D2));
+  H4-H3=Rayonbis*(bHat/ech)*unitvector(iso(B2,C2)-O2);
+  H5-H4=Rayonbis*(aHat/ech)*unitvector(B2-C2);
+  H6-H5=Rayonbis*(aHat/ech)*unitvector(C1-D1);
+  H7-H6=Rayonbis*(bHat/ech)*unitvector(O1-iso(C1,D1));
+  H8-H7=Rayonbis*(bHat/ech)*unitvector(iso(E1,F1)-O1);
+  H9-H8=Rayonbis*(aHat/ech)*unitvector(F2-E2);
+  H10-H9=Rayonbis*(aHat/ech)*unitvector(A3-B3);
+  H11-H10=Rayonbis*(bHat/ech)*unitvector(O3-iso(A3,B3));
+  H12-H11=Rayonbis*(bHat/ech)*unitvector(iso(C3,D3)-O3);
+  H13-H12=Rayonbis*(aHat/ech)*unitvector(F2-A2);
+  H14=iso(H0,H1,H2,H3,H4,H5,H6,H7,H8,H9,H10,H11,H12,H13);
+  save $;
+  path $;
+  $=polygone(H0,H1,H2,H3,H4,H5,H6,H7,H8,H9,H10,H11,H12,H13);
+  $
+  enddef;
+%
+  vardef VampireGen(expr ech)=
+  pair Vp[];
+  Vp0=iso(F2,E2);
+  Vp1-Vp0=Rayonbis*(1/ech)*unitvector(E2-F2);
+  Vp2-Vp1=Rayonbis*(1/ech)*unitvector(D2-E2);
+  Vp3-Vp2=Rayonbis*(1/ech)*unitvector(O2-iso(E2,D2));
+  Vp4-Vp3=Rayonbis*(1/ech)*unitvector(iso(B2,C2)-O2);
+  Vp5-Vp4=Rayonbis*(1/ech)*unitvector(B2-C2);
+  Vp6-Vp5=Rayonbis*(1/ech)*unitvector(C1-D1);
+  Vp7-Vp6=Rayonbis*(1/ech)*unitvector(O1-iso(C1,D1));
+  Vp8-Vp7=Rayonbis*(1/ech)*unitvector(iso(E1,F1)-O1);
+  Vp9-Vp8=Rayonbis*(1/ech)*unitvector(F2-E2);
+  Vp10-Vp9=Rayonbis*(1/ech)*unitvector(A3-B3);
+  Vp11-Vp10=Rayonbis*(1/ech)*unitvector(O3-iso(A3,B3));
+  Vp12-Vp11=Rayonbis*(1/ech)*unitvector(iso(C3,D3)-O3);
+  Vp13-Vp12=Rayonbis*(1/ech)*unitvector(F2-A2);
+  Vp14=Vp0;
+  Vp15=iso(Vp0,Vp1,Vp2,Vp3,Vp4,Vp5,Vp6,Vp7,Vp8,Vp9,Vp10,Vp11,Vp12,Vp13);
+  save $;
+  path $;
+  $=polygone(Vp0,Vp1,Vp2,Vp3,Vp4,Vp5,Vp6,Vp7,Vp8,Vp9,Vp10,Vp11,Vp12,Vp13);
+  $
+  enddef;
+}
+
+\def\MPEinstein{%Pentoma : https://www.pentoma.de/the_hat/
+  \ifluatex
+    \mplibforcehmode
+    \begin{mplibcode}
+      \MPEinsteinHatCode
+      if After:
+      EffectuerTraces;
+      fi;
+    \end{mplibcode}
+  \else
+    \begin{mpost}[mpsettings={\MPEinsteinHatCode}
+      if After:
+      EffectuerTraces;
+      fi;
+    \end{mpost}
+  \fi
+}%
+
 \NewDocumentCommand\Pavage{o}{%
   \useKVdefault[Pavage]%
   \setKV[Pavage]{#1}%
+  \ifboolKV[Pavage]{Einstein}{%
+  \ifboolKV[Pavage]{Vampire}{}{%
+    \MPEinstein%
+    }%
+  }{%
   \ifboolKV[Pavage]{Regulier}{%
     \MPRegulier%
   }{%
@@ -1213,4 +1343,5 @@
       }%
     }%
   }%
+  }%
 }%
\ No newline at end of file

Modified: trunk/Master/texmf-dist/tex/latex/profcollege/PfCPropor.tex
===================================================================
--- trunk/Master/texmf-dist/tex/latex/profcollege/PfCPropor.tex	2023-07-04 19:52:56 UTC (rev 67544)
+++ trunk/Master/texmf-dist/tex/latex/profcollege/PfCPropor.tex	2023-07-04 19:53:24 UTC (rev 67545)
@@ -3,6 +3,8 @@
 %%%
 \setKVdefault[ClesPropor]{GrandeurA=Grandeur A,GrandeurB=Grandeur B,Largeur=1cm,Math=false,Stretch=1,ColorFill=white,CouleurTab=gray!15,Vertical=false,Simple=false}%
 
+\tikzstyle{FlechePropor}=[-stealth]
+
 \def\Updatetoksmath#1/#2\nil{\addtotok\tabtoksa{&#1}\addtotok\tabtoksb{&#2}}%
 \def\updatetokspropor#1/#2\nil{\addtotok\tabtoksa{&\num{#1}}\addtotok\tabtoksb{&\num{#2}}}
 \def\Buildtabpropor{%
@@ -108,9 +110,9 @@
 \newcommand\FlechesPH[3]{%
   \begin{tikzpicture}[remember picture,overlay]%
     \ifnum#1<#2\relax%
-    \draw[-stealth,out=50,in=130] (ProporH-#1) to node[inner sep=0pt, inner xsep=1pt,fill=\colorfill, pos=0.5, sloped]{#3}(ProporH-#2);%
+    \draw[FlechePropor,out=50,in=130] (ProporH-#1) to node[inner sep=0pt, inner xsep=1pt,fill=\colorfill, pos=0.5, sloped]{#3}(ProporH-#2);%
   \else%
-    \draw[-stealth,out=130,in=50] (ProporH-#1) to node[inner sep=0pt, inner xsep=1pt,fill=\colorfill, pos=0.5, sloped]{#3}(ProporH-#2);%
+    \draw[FlechePropor,out=130,in=50] (ProporH-#1) to node[inner sep=0pt, inner xsep=1pt,fill=\colorfill, pos=0.5, sloped]{#3}(ProporH-#2);%
     \fi%
   \end{tikzpicture}%
 }%
@@ -118,11 +120,11 @@
 \newcommand\FlechesPB[3]{%
   \ifnum\number#1<\number#2\relax%
   \begin{tikzpicture}[remember picture,overlay]%
-    \draw[-stealth,out=-50,in=-130] (ProporB-#1) to node[inner sep=0pt, inner xsep=1pt,fill=\colorfill, pos=0.5, sloped]{#3}(ProporB-#2);%
+    \draw[FlechePropor,out=-50,in=-130] (ProporB-#1) to node[inner sep=0pt, inner xsep=1pt,fill=\colorfill, pos=0.5, sloped]{#3}(ProporB-#2);%
   \end{tikzpicture}%
   \else%
   \begin{tikzpicture}[remember picture,overlay]%
-    \draw[-stealth,out=-130,in=-50] (ProporB-#1) to node[inner sep=0pt, inner xsep=1pt,fill=\colorfill, pos=0.5, sloped]{#3}(ProporB-#2);%
+    \draw[FlechePropor,out=-130,in=-50] (ProporB-#1) to node[inner sep=0pt, inner xsep=1pt,fill=\colorfill, pos=0.5, sloped]{#3}(ProporB-#2);%
   \end{tikzpicture}%
   \fi%
 }%
@@ -130,9 +132,9 @@
 \newcommand\FlechesPG[3]{%
   \begin{tikzpicture}[remember picture,overlay]%
     \ifnum#1<#2\relax%
-    \draw[-stealth,out=-150,in=150] (ProporG-#1) to node[transform canvas={xshift=-1pt},inner sep=0pt, inner xsep=1pt,fill=\colorfill, pos=0.5,left]{#3}(ProporG-#2);%
+    \draw[FlechePropor,out=-150,in=150] (ProporG-#1) to node[transform canvas={xshift=-1pt},inner sep=0pt, inner xsep=1pt,fill=\colorfill, pos=0.5,left]{#3}(ProporG-#2);%
     \else%
-    \draw[-stealth,out=150,in=-150] (ProporG-#1) to node[transform canvas={xshift=-1pt},inner sep=0pt, inner xsep=1pt,fill=\colorfill, pos=0.5, left]{#3}(ProporG-#2);%
+    \draw[FlechePropor,out=150,in=-150] (ProporG-#1) to node[transform canvas={xshift=-1pt},inner sep=0pt, inner xsep=1pt,fill=\colorfill, pos=0.5, left]{#3}(ProporG-#2);%
     \fi%
   \end{tikzpicture}%
 }%
@@ -140,9 +142,9 @@
 \newcommand\FlechesPD[3]{%
   \begin{tikzpicture}[remember picture,overlay]%
     \ifnum#1<#2\relax%
-    \draw[-stealth,out=-30,in=30] (ProporD-#1) to node[transform canvas={xshift=1pt},inner sep=0pt, inner xsep=1pt,fill=\colorfill, pos=0.5,right]{#3}(ProporD-#2);%
+    \draw[FlechePropor,out=-30,in=30] (ProporD-#1) to node[transform canvas={xshift=1pt},inner sep=0pt, inner xsep=1pt,fill=\colorfill, pos=0.5,right]{#3}(ProporD-#2);%
     \else%
-    \draw[-stealth,out=30,in=-30] (ProporD-#1) to node[transform canvas={xshift=1pt},inner sep=0pt, inner xsep=1pt,fill=\colorfill, pos=0.5,right]{#3}(ProporD-#2);%
+    \draw[FlechePropor,out=30,in=-30] (ProporD-#1) to node[transform canvas={xshift=1pt},inner sep=0pt, inner xsep=1pt,fill=\colorfill, pos=0.5,right]{#3}(ProporD-#2);%
     \fi%
   \end{tikzpicture}%
 }%
@@ -167,7 +169,7 @@
       \draw[out=-30,in=-150,gray] (aux3) to (aux4);
     }%
     \draw[gray] (aux2) -- (aux3);
-    \draw[-stealth,gray] (aux4) -- (aux1);
+    \draw[FlechePropor,gray] (aux4) -- (aux1);
   \end{tikzpicture}%
 }%
 
@@ -191,7 +193,7 @@
       \draw[out=30,in=150,gray] (aux1) to (aux2);
     }%
     \draw[gray] (aux4) -- (aux1);
-    \draw[-stealth,gray] (aux2) -- (aux3);
+    \draw[FlechePropor,gray] (aux2) -- (aux3);
   \end{tikzpicture}%
 }%
 
@@ -215,7 +217,7 @@
       \draw[out=-30,in=30,gray] (aux3) to (aux4);
     }%
     \draw[gray] (aux2) -- (aux3);
-    \draw[-stealth,gray] (aux4) -- (aux1);
+    \draw[FlechePropor,gray] (aux4) -- (aux1);
   \end{tikzpicture}%
 }%
 
@@ -239,7 +241,7 @@
       \draw[out=-150,in=150,gray] (aux1) to (aux2);
     }%
     \draw[gray] (aux4) -- (aux1);
-    \draw[-stealth,gray] (aux2) -- (aux3);
+    \draw[FlechePropor,gray] (aux2) -- (aux3);
   \end{tikzpicture}%
 }%
 
@@ -248,9 +250,9 @@
     \node[inner sep=0pt] (MilieuH) at ($(ProporG-#1)!0.5!(ProporG-#2)$) {};%
     \node[circle,draw,inner sep=0pt] [left of=MilieuH] (aux) {#4} ;%
     \coordinate[left of=aux] (aux1);%
-    \draw[-stealth] (ProporG-#1) -| (aux);%
-    \draw[-stealth] (ProporG-#2) -| (aux);%
-    \draw[-stealth] (aux) -- (aux1) |- (ProporG-#3);%
+    \draw[FlechePropor] (ProporG-#1) -| (aux);%
+    \draw[FlechePropor] (ProporG-#2) -| (aux);%
+    \draw[FlechePropor] (aux) -- (aux1) |- (ProporG-#3);%
   \end{tikzpicture}%
 }%
 
@@ -259,9 +261,9 @@
     \node[inner sep=0pt] (MilieuH) at ($(ProporD-#1)!0.5!(ProporD-#2)$) {};%
     \node[circle,draw,inner sep=0pt] [right of=MilieuH] (aux) {#4} ;%
     \coordinate[right of=aux] (aux1);%
-    \draw[-stealth] (ProporD-#1) -| (aux);%
-    \draw[-stealth] (ProporD-#2) -| (aux);%
-    \draw[-stealth] (aux) -- (aux1) |- (ProporD-#3);%
+    \draw[FlechePropor] (ProporD-#1) -| (aux);%
+    \draw[FlechePropor] (ProporD-#2) -| (aux);%
+    \draw[FlechePropor] (aux) -- (aux1) |- (ProporD-#3);%
   \end{tikzpicture}%
 }%
 
@@ -285,7 +287,7 @@
     \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);%
+    \draw[FlechePropor,out=-20,in=20] (point1) to node[midway,right,inner sep=1pt]{#2}(point2);%
   \end{tikzpicture}%
 }%
 
@@ -295,7 +297,7 @@
     \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[FlechePropor,out=160,in=-160] (noeud2) to node[midway,left,inner sep=1pt]{#2}(noeud1);%
   \end{tikzpicture}%
 }%
 
@@ -305,7 +307,7 @@
     \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);%
+    \draw[FlechePropor,out=20,in=-20] (point2) to node[midway,right,inner sep=1pt]{#2}(point1);%
   \end{tikzpicture}%
 }%
 
@@ -314,9 +316,9 @@
     \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);%
+    \draw[FlechePropor] (ProporH-#1) |- (aux);%
+    \draw[FlechePropor] (ProporH-#2) |- (aux);%
+    \draw[FlechePropor] (aux) -- (aux1) -| (ProporH-#3);%
   \end{tikzpicture}%
 }%
 
@@ -325,8 +327,8 @@
     \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);%
+    \draw[FlechePropor] (ProporB-#1) |- (aux);%
+    \draw[FlechePropor] (ProporB-#2) |- (aux);%
+    \draw[FlechePropor] (aux) -- (aux1) -| (ProporB-#3);%
   \end{tikzpicture}%
 }%
\ No newline at end of file

Modified: trunk/Master/texmf-dist/tex/latex/profcollege/PfCPyramideCalculs.tex
===================================================================
--- trunk/Master/texmf-dist/tex/latex/profcollege/PfCPyramideCalculs.tex	2023-07-04 19:52:56 UTC (rev 67544)
+++ trunk/Master/texmf-dist/tex/latex/profcollege/PfCPyramideCalculs.tex	2023-07-04 19:53:24 UTC (rev 67545)
@@ -1,5 +1,3 @@
-
-
 %%%
 % Pyramide de calculs
 %%%
@@ -179,9 +177,10 @@
     label(TEX(p_),B[Nbeb]);
     fi;
     endfor;
+    fi;
   \end{mplibcode}
   \else
-  \begin{mpost}[mpsettings={nbetages:=\useKV[ClesPyramide]{Etages};largeur:=\useKV[ClesPyramide]{Largeur};hauteur:=\useKV[ClesPyramide]{Hauteur};boolean Vide;Vide=\useKV[ClesPyramide]{Vide};boolean Inverse;Inverse=\useKV[ClesPyramide]{Inverse};color CaseCouleur; CaseCouleur:=\useKV[ClesPyramide]{Couleur};boolean Double;Double=\useKV[ClesPyramide]{Double}; color CouleurNombre;CouleurNombre=\useKV[ClesPyramide]{CouleurNombre};}]
+  \begin{mpost}[mpsettings={nbetages:=\useKV[ClesPyramide]{Etages};largeur:=\useKV[ClesPyramide]{Largeur};hauteur:=\useKV[ClesPyramide]{Hauteur};boolean Vide,Inverse,Double;Vide=\useKV[ClesPyramide]{Vide};Inverse=\useKV[ClesPyramide]{Inverse};Double=\useKV[ClesPyramide]{Double};color CaseCouleur;CouleurNombre; CaseCouleur:=\useKV[ClesPyramide]{Couleur};CouleurNombre=\useKV[ClesPyramide]{CouleurNombre};}]
     pair A[][],B[];
     path Case[];
     Nbeb:=0;
@@ -205,7 +204,7 @@
     endfor;
     endfor;
     else:
-    if \useKV[ClesPyramide]{Inverse}:
+    if Inverse:
     change:=-1;
     else:
     change=1;
@@ -220,7 +219,7 @@
     endfor;
     endfor;
     fi;
-    if \useKV[ClesPyramide]{Vide}:
+    if Vide:
     else:
     Nbeb:=0;
     for p_=#1:
@@ -237,6 +236,7 @@
     label(LATEX(p_),B[Nbeb]);
     fi;
     endfor;
+    fi;
   \end{mpost}
   \fi
 }%

Modified: trunk/Master/texmf-dist/tex/latex/profcollege/PfCPythagore.tex
===================================================================
--- trunk/Master/texmf-dist/tex/latex/profcollege/PfCPythagore.tex	2023-07-04 19:52:56 UTC (rev 67544)
+++ trunk/Master/texmf-dist/tex/latex/profcollege/PfCPythagore.tex	2023-07-04 19:53:24 UTC (rev 67545)
@@ -281,8 +281,8 @@
       \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}\SI{\Aquatre}{\PfCPythaUnit}}{\NomA\NomC&\approx\opsqrt[maxdivstep=5]{a3}{a4}\opround{a4}{pres}{a4}\opunzero{a4}\opexport{a4}{\Aquatre}\SI{\Aquatre}{\PfCPythaUnit}}}%\\
+         \ifboolKV[ClesPythagore]{Entier}{}{\\\NomA\NomC&=\sqrt{\opexport{a3}{\Atrois}\num{\Atrois}}}
+         \ifboolKV[ClesPythagore]{Racine}{}{\\\NomA\NomC&\IfInteger{\fpeval{round(sqrt(#3^2+#4^2),\useKV[ClesPythagore]{Precision})^2-#3^2-#4^2}}{=}{\approx}\opsqrt[maxdivstep=5]{a3}{a4}\opround{a4}{pres}{a4}\opunzero{a4}\opexport{a4}{\Aquatre}\SI{\Aquatre}{\PfCPythaUnit}}%\\
       }
     \end{align*}
   }{%\else
@@ -295,7 +295,7 @@
         \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}\SI{\Aquatre}{\PfCPythaUnit}}{\NomA\NomB&\approx\opsqrt[maxdivstep=5]{a3}{a4}\opround{a4}{pres}{a4}\opunzero{a4}\opexport{a4}{\Aquatre}\SI{\Aquatre}{\PfCPythaUnit}}}%\\
+        \ifboolKV[ClesPythagore]{Racine}{}{\\\NomA\NomB&\IfInteger{\fpeval{round(sqrt(#3^2-#4^2),\useKV[ClesPythagore]{Precision})^2-#3^2+#4^2}}{=}{\approx}\opsqrt[maxdivstep=5]{a3}{a4}\opround{a4}{pres}{a4}\opunzero{a4}\opexport{a4}{\Aquatre}\SI{\Aquatre}{\PfCPythaUnit}}%\\
         }
       \end{align*}
     }{%
@@ -307,7 +307,7 @@
         \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}\SI{\Aquatre}{\PfCPythaUnit}}{\NomA\NomB&\approx\opsqrt[maxdivstep=5]{a3}{a4}\opround{a4}{pres}{a4}\opunzero{a4}\opexport{a4}{\Aquatre}\SI{\Aquatre}{\PfCPythaUnit}}}%\\
+        \ifboolKV[ClesPythagore]{Racine}{}{\\\NomA\NomB&\IfInteger{\fpeval{round(sqrt(#3^2-#4^2),\useKV[ClesPythagore]{Precision})^2-#3^2+#4^2}}{=}{\approx}\opsqrt[maxdivstep=5]{a3}{a4}\opround{a4}{pres}{a4}\opunzero{a4}\opexport{a4}{\Aquatre}\SI{\Aquatre}{\PfCPythaUnit}}%\\
         }
       \end{align*}
     }%

Modified: trunk/Master/texmf-dist/tex/latex/profcollege/PfCRangementNombres.tex
===================================================================
--- trunk/Master/texmf-dist/tex/latex/profcollege/PfCRangementNombres.tex	2023-07-04 19:52:56 UTC (rev 67544)
+++ trunk/Master/texmf-dist/tex/latex/profcollege/PfCRangementNombres.tex	2023-07-04 19:53:24 UTC (rev 67545)
@@ -1,15 +1,60 @@
 %%%
 % Rangement des nombres
 %%%
-\setKVdefault[ClesRgt]{Croissant,Decroissant=false,Strict,Fraction=false,Details=false,Seul=false}
+\setKVdefault[ClesRgt]{Croissant,Decroissant=false,Strict,Fraction=false,Details=false,Seul=false}%
 
 \dtlexpandnewvalue%
 \DTLgnewdb{mtnumedb}%
 \DTLgnewdb{mtRGTdb}% Pb de doublon avec mtdb de Mediane
 
-\newcommand\Rangement[2][]{%
+%\begin{document}
+
+\NewDocumentCommand\RangementListe{m}{%
+  \readlist*\ListeRgt{#1}%
+  \xdef\Foo{\ListeRgt[1]}
+  \xintFor* ##1 in{\xintSeq{2}{\ListeRgtlen}}\do{%
+    \xdef\Foo{\Foo,\ListeRgt[##1]}
+  }%
+  \xdef\Fooa{\Foo}%
+  \xdef\PfCRetiensRangement{}%
+  \xintFor* ##1 in{\xintSeq{1}{\fpeval{\ListeRgtlen-1}}}\do{%
+    \xdef\Element{\fpeval{min(\Fooa)}}%
+    \xintifboolexpr{##1>1}{%
+      \xdef\PfCRetiensRangement{\PfCRetiensRangement,\Element}%
+    }{%
+      \xdef\PfCRetiensRangement{\Element}%
+    }%
+    \readlist*\RetiensListe{\Fooa}%
+    % La liste des rangements vaut \RetiensRangement.\par
+    % La retiensliste vaut \showitems\RetiensListe[]\par
+    \xdef\Fooi{}%
+    \foreachitem\rgt\in\RetiensListe{%
+      % \rgtcnt~\RetiensListe[\rgtcnt] et \Element%
+      \xintifboolexpr{\RetiensListe[\rgtcnt]==\Element}{}{%
+        \xdef\Fooi{\Fooi,\RetiensListe[\rgtcnt]}
+      }%
+      % La liste Fooi est \Fooi\par
+    }%
+    \readlist*\ListeTempo{\Fooi}%
+    \xintifboolexpr{\ListeTempolen>1}{%
+      \xdef\Fooa{\ListeTempo[1]}%
+      \xintFor* ##2 in{\xintSeq{2}{\ListeTempolen}}\do{%
+        \xdef\Fooa{\Fooa,\ListeTempo[##2]}%
+      }%
+    }{%
+      % \xdef\Fooa{\ListeTempo[1]}%
+      \xdef\PfCRetiensRangement{\PfCRetiensRangement,\ListeTempo[1]}
+    }%
+    % La liste Fooa vaut \Fooa\par
+  }%
+}%
+
+\NewDocumentCommand\Rangement{om}{%
   \useKVdefault[ClesRgt]%
   \setKV[ClesRgt]{#1}%
+  \ignoreemptyitems%
+  \readlist*\ListeRgt{#2}%
+  % \showitems\ListeRgt[]\par%
   \ifboolKV[ClesRgt]{Fraction}{%
     \setsepchar[*]{,*/}\ignoreemptyitems%
     \readlist*\ListeRgt{#2}%
@@ -18,23 +63,95 @@
     \foreachitem\x\in\ListeRgt{%
       \PPCM{\fpeval{\ListeRgt[\xcnt,2]}}{\fpeval{\the\ppcm}}%
     }%
+    % 
+    \xdef\FooFraction{\fpeval{\ListeRgt[1,1]*\the\ppcm/\ListeRgt[1,2]}}%
+    \xintFor* ##1 in{\xintSeq{2}{\ListeRgtlen}}\do{%
+      \xdef\FooFraction{\FooFraction,\fpeval{\ListeRgt[##1,1]*\the\ppcm/\ListeRgt[##1,2]}}%
+    }%
+    \RangementListe{\FooFraction}%
+    \readlist*\PfCListeFinaleRgt{\PfCRetiensRangement}%
+    %%%%%%%%% 
+    \ifboolKV[ClesRgt]{Decroissant}{%
+      \ifboolKV[ClesRgt]{Details}{%
+        \ensuremath{%
+          \xintFor* ##1 in{\xintSeq{0}{\fpeval{\PfCListeFinaleRgtlen-1}}}\do{%
+            \xintifForFirst{}{\ifboolKV[ClesRgt]{Strict}{>}{\geqslant}}\frac{\num{\PfCListeFinaleRgt[\fpeval{\PfCListeFinaleRgtlen-##1}]}}{\num{\the\ppcm}}
+          }%
+        }%
+      }{%
+        \ensuremath{
+          \xintFor* ##1 in{\xintSeq{0}{\fpeval{\PfCListeFinaleRgtlen-1}}}\do{%
+            \xintifForFirst{}{\ifboolKV[ClesRgt]{Strict}{>}{\qeqslant}}\Simplification{\PfCListeFinaleRgt[\fpeval{\PfCListeFinaleRgtlen-##1}]}{\the\ppcm}}%
+        }%
+      }%
+    }{%
+      \ifboolKV[ClesRgt]{Details}{%
+        \ensuremath{%
+           \xintFor* ##1 in{\xintSeq{1}{\PfCListeFinaleRgtlen}}\do{%
+             \xintifForFirst{}{\ifboolKV[ClesRgt]{Strict}{<}{\leqslant}}\frac{\num{\PfCListeFinaleRgt[##1]}}{\num{\the\ppcm}}%
+           }%
+        }%
+      }{%
+        \ensuremath{%
+          \xintFor* ##1 in{\xintSeq{1}{\PfCListeFinaleRgtlen}}\do{%
+            \xintifForFirst{}{\ifboolKV[ClesRgt]{Strict}{<}{\leqslant}}\Simplification{\PfCListeFinaleRgt[##1]}{\the\ppcm}%
+          }%
+        }%
+      }%
+    }%  %%%%%%%%%%%%% 
+  }{%
+    \RangementListe{#2}%
+    % 
+    % \PfCRetiensRangement%
+      \ifboolKV[ClesRgt]{Seul}{}{%
+        \readlist*\PfCListeFinaleRgt{\PfCRetiensRangement}
+        % \par \showitems\PfCListeFinaleRgt[] -- La longueur de la liste est \PfCListeFinaleRgtlen
+        \ifboolKV[ClesRgt]{Decroissant}{%
+          \ensuremath{%
+            \xintFor* ##1 in{\xintSeq{0}{\fpeval{\PfCListeFinaleRgtlen-1}}}\do{%
+              \xintifForFirst{}{\ifboolKV[ClesRgt]{Strict}{>}{\geqslant}}\num{\PfCListeFinaleRgt[\fpeval{\PfCListeFinaleRgtlen-##1}]}%
+            }%
+          }%
+        }{%
+          \ensuremath{%
+            \xintFor* ##1 in{\xintSeq{1}{\fpeval{\PfCListeFinaleRgtlen}}}\do{%
+              \xintifForFirst{}{\ifboolKV[ClesRgt]{Strict}{<}{\leqslant}}\num{\PfCListeFinaleRgt[##1]}%
+            }%
+          }%
+        }%
+      }%
+    }%
+    \reademptyitems
+  }
+
+\NewDocumentCommand\Rangementold{om}{%
+  \useKVdefault[ClesRgt]%
+  \setKV[ClesRgt]{#1}%
+  \ifboolKV[ClesRgt]{Fraction}{%
+    \setsepchar[*]{,*/}\ignoreemptyitems%
+    \readlist*\ListeRgt{#2}%
+    % on cherche le d\'enominateur commun
+    \ppcm=1\relax
+    \foreachitem\x\in\ListeRgt{%
+      \PPCM{\fpeval{\ListeRgt[\xcnt,2]}}{\fpeval{\the\ppcm}}%
+    }%
     % On cr\'ee la liste des rangements.
     \DTLcleardb{mtnumedb}%
-%    % on les trie pour les ranger par ordre croissant
+    %    % on les trie pour les ranger par ordre croissant
     \foreachitem\x\in\ListeRgt{%
       \DTLnewrow{mtnumedb}%
       \xdef\toto{\fpeval{\ListeRgt[\xcnt,1]*\the\ppcm/\ListeRgt[\xcnt,2]}}%
       \DTLnewdbentry{mtnumedb}{numeric}{\toto}%
     }%
-%    % On trie
+    %    % On trie
     \ifboolKV[ClesRgt]{Decroissant}{%
-%      % On trie la liste
+      %      % On trie la liste
       \dtlsort{numeric=descending}{mtnumedb}{\dtlicompare}%
       \ifboolKV[ClesRgt]{Details}{\ensuremath{\DTLforeach{mtnumedb}{\numeroDonnee=numeric}{\frac{\num{\numeroDonnee}}{\num{\the\ppcm}}\DTLiflastrow{}{\ifboolKV[ClesRgt]{Strict}{>}{\geqslant}}}}}{%
         \ensuremath{\DTLforeach{mtnumedb}{\numeroDonnee=numeric}{\Simplification{\numeroDonnee}{\ppcm}\DTLiflastrow{}{\ifboolKV[ClesRgt]{Strict}{>}{\geqslant}}}}%
-      }
+      }%
     }{%
-%      % On trie la liste
+      %      % On trie la liste
       \dtlsort{numeric}{mtnumedb}{\dtlicompare}%
       \ifboolKV[ClesRgt]{Details}{%
         \ensuremath{\DTLforeach{mtnumedb}{\numeroDonnee=numeric}{\frac{\num{\numeroDonnee}}{\num{\the\ppcm}}\DTLiflastrow{}{\ifboolKV[ClesRgt]{Strict}{<}{\leqslant}}}}%
@@ -47,27 +164,29 @@
     \readlist*\ListeRgt{#2}%
     % on cr\'ee la base de donn\'ees des valeurs
     \DTLcleardb{mtRGTdb}%
-%    % on les trie pour les ranger par ordre croissant
-    \foreachitem\x\in\ListeRgt{%
+    %    % on les trie pour les ranger par ordre croissant
+    \foreachitem\xcompteur\in\ListeRgt{%
+      % Les nombres sont \showitems\ListeRgt[]
       \DTLnewrow{mtRGTdb}%
-      \itemtomacro\ListeRgt[\xcnt]\y%
-      \DTLnewdbentry{mtRGTdb}{numeric}{\y}%
+      \itemtomacro\ListeRgt[\xcompteurcnt]\ycompteur%
+      \DTLnewdbentry{mtRGTdb}{numeric}{\ycompteur}%
     }%
-%    %
+    \DTLdisplaydb[]{mtRGTdb}%
+    %    % 
     \ifboolKV[ClesRgt]{Seul}{%
-    \xdef\PfCListeRgtRecup{}%
+      \xdef\PfCListeRgtRecup{}%
       \dtlsort{numeric}{mtRGTdb}{\dtlicompare}%
       \DTLforeach{mtRGTdb}{\numeroDonnee=numeric}{\xdef\PfCListeRgtRecup{\PfCListeRgtRecup \numeroDonnee\DTLiflastrow{}{,}}}%
     }{%
-    \ifboolKV[ClesRgt]{Decroissant}{%
-      % On trie la liste
-      \dtlsort{numeric=descending}{mtRGTdb}{\dtlicompare}%
-      \ensuremath{\DTLforeach{mtRGTdb}{\numeroDonnee=numeric}{\num{\numeroDonnee}\DTLiflastrow{}{\ifboolKV[ClesRgt]{Strict}{>}{\geqslant}}}}%
-    }{%
-%      % On trie la liste
-      \dtlsort{numeric}{mtRGTdb}{\dtlicompare}%
-      \ensuremath{\DTLforeach{mtRGTdb}{\numeroDonnee=numeric}{\num{\numeroDonnee}\DTLiflastrow{}{\ifboolKV[ClesRgt]{Strict}{<}{\leqslant}}}}%
+      \ifboolKV[ClesRgt]{Decroissant}{%
+        % On trie la liste
+        \dtlsort{numeric=descending}{mtRGTdb}{\dtlicompare}%
+        \ensuremath{\DTLforeach{mtRGTdb}{\numeroDonnee=numeric}{\num{\numeroDonnee}\DTLiflastrow{}{\ifboolKV[ClesRgt]{Strict}{>}{\geqslant}}}}%
+      }{%
+        %      % On trie la liste
+        \dtlsort{numeric}{mtRGTdb}{\dtlicompare}%
+        \ensuremath{\DTLforeach{mtRGTdb}{\numeroDonnee=numeric}{\num{\numeroDonnee}\DTLiflastrow{}{\ifboolKV[ClesRgt]{Strict}{<}{\leqslant}}}}%
+      }%
     }%
   }%
-}%
 }%
\ No newline at end of file

Modified: trunk/Master/texmf-dist/tex/latex/profcollege/PfCReperage.tex
===================================================================
--- trunk/Master/texmf-dist/tex/latex/profcollege/PfCReperage.tex	2023-07-04 19:52:56 UTC (rev 67544)
+++ trunk/Master/texmf-dist/tex/latex/profcollege/PfCReperage.tex	2023-07-04 19:53:24 UTC (rev 67545)
@@ -86,9 +86,10 @@
     ObjetEquateur3("R=5");
     ObjetGreenwich4("R=5");
     fi;
-     AffichagePfC2;
+    AffichagePfC2;
 %    AffichageObjet2;
     if \useKV[ClesReperage]{Axes}:
+    TraceAxes;
     drawoptions(withpen pencircle scaled 1.05 withcolor CouleurE);
     AffichageEquateur3;
     drawoptions(withpen pencircle scaled 1 withcolor CouleurG);
@@ -1533,7 +1534,7 @@
     pointe(unitp*(valeur[n]-ValeurOrigine,0));
     elseif ACoord=2:
     if ((ValeurUnitex*valeur[n]) mod pasx)<>0:
-    label.bot(TEX("\footnotesize$\frac{\num{\fpeval{"&decimal(ValeurUnitex)&"*"&decimal(valeur[n])&"}}}{\num{"&decimal(pasx)&"}}$"),unitp*(valeur[n],0));
+    label.bot(TEX("\footnotesize$\frac{\num{\fpeval{"&decimal(ValeurOrigine*pasx)&"+"&decimal(ValeurUnitex-ValeurOrigine)&"*"&decimal(valeur[n])&"}}}{\num{"&decimal(pasx)&"}}$"),unitp*(valeur[n],0));
     else:
     label.bot(TEX("\footnotesize\num{\fpeval{"&decimal(ValeurUnitex)&"*"&decimal(valeur[n])&"/"&decimal(pasx)&"}}"),unitp*(valeur[n],0));
     fi;
@@ -1552,9 +1553,9 @@
     elseif AffichageCoord=2:
     if p_<>"":
     if ((ValeurUnitex*valeur[n]) mod pasx)<>0:
-    label.bot(TEX("\footnotesize$\frac{\num{\fpeval{"&decimal(ValeurUnitex)&"*"&decimal(valeur[n])&"}}}{\num{"&decimal(pasx)&"}}$"),unitp*(valeur[n],0));
+    label.bot(TEX("\footnotesize$\frac{\num{\fpeval{"&decimal(ValeurOrigine*pasx)&"+"&decimal(ValeurUnitex-ValeurOrigine)&"*"&decimal(valeur[n])&"}}}{\num{"&decimal(pasx)&"}}$"),unitp*(valeur[n],0));
     else:
-    label.bot(TEX("\footnotesize\num{\fpeval{"&decimal(ValeurUnitex)&"*"&decimal(valeur[n])&"/"&decimal(pasx)&"}}"),unitp*(valeur[n],0));
+    label.bot(TEX("\footnotesize\num{\fpeval{"&decimal(ValeurOrigine)&"+"&decimal(ValeurUnitex-ValeurOrigine)&"*"&decimal(valeur[n])&"/"&decimal(pasx)&"}}"),unitp*(valeur[n],0));
     fi;
     pointe(unitp*(valeur[n],0));
     fi;

Modified: trunk/Master/texmf-dist/tex/latex/profcollege/PfCSolides.tex
===================================================================
--- trunk/Master/texmf-dist/tex/latex/profcollege/PfCSolides.tex	2023-07-04 19:52:56 UTC (rev 67544)
+++ trunk/Master/texmf-dist/tex/latex/profcollege/PfCSolides.tex	2023-07-04 19:53:24 UTC (rev 67545)
@@ -239,7 +239,7 @@
     nombresommets=\useKV[ClesSolides]{SommetsPyramide};
     color PfCOutColor,DecalageSommet;
     PfCOutColor=\useKV[ClesSolides]{Couleur};
-    DecalageSommet=if Reguliere:(0,0,0) else: #3 fi;
+    DecalageSommet=#3;%if Reguliere:(0,0,0) else: #3 fi;
     
     Figure(-10u,-10u,10u,10u);
     Initialisation(PfCRho,PfCPhi,PfCTheta,PfCDistance);
@@ -567,6 +567,8 @@
     color A,B,C,D,E,F,G,H;
     color Sommet[];
     trace Pave(A,B,C,D,E,F,G,H)(#3);
+    picture Depart;
+    Depart=currentpicture;
     currentpicture:=nullpicture;
     Sommet1=A;
     Sommet2=B;
@@ -613,6 +615,7 @@
 %    trace polygone(MSection1,MSection2,MSection3,MSection4);
     color dcer,ccer;
     % 1er cote -> ok
+    DotLabel("",RetiensDefSection[4]);
     dcer:=Oeil-RetiensDefSection[4];
     ccer:=Normal(RetiensDefSection[4],RetiensDefSection[2],RetiensDefSection[1]);
     draw chemin(MSection1,MSection2) if (ProduitScalaire(dcer,ccer)<0):dashed evenly fi;
@@ -673,7 +676,8 @@
     %trace polygone(MSection1,MSection2,MSection3,MSection4);
     fi;
 
-    trace Pave(A,B,C,D,E,F,G,H)(#3);
+    % trace Pave(A,B,C,D,E,F,G,H)(#3);
+    trace Depart;
     
     DefinirSommetsSection(#4);
     

Modified: trunk/Master/texmf-dist/tex/latex/profcollege/PfCStatistiques.tex
===================================================================
--- trunk/Master/texmf-dist/tex/latex/profcollege/PfCStatistiques.tex	2023-07-04 19:52:56 UTC (rev 67544)
+++ trunk/Master/texmf-dist/tex/latex/profcollege/PfCStatistiques.tex	2023-07-04 19:53:24 UTC (rev 67545)
@@ -10,26 +10,33 @@
 \newcommand\DonneeMax{}%
 \newcommand\DonneeMin{}%
 \newcommand\EffectifMax{}%
+\newcommand\PfCArticleMediane{la}%
 
 \setKVdefault[ClesStat]{ColVide=0,CaseVide=false,EffVide=false,%
 FreqVide=false,AngVide=false,ECCVide=false,TotalVide=false,Sondage=false,Liste=false,%
 Tableau=false,Stretch=1,Frequence=false,EffectifTotal=false,%
-Etendue=false,Moyenne=false,SET=false,ValeurExacte=false,Mediane=false,QuartileUn=false,QuartileTrois=false,Total=false,Concret=false,%
-Unite={},Largeur=1cm,Precision=2,PrecisionF=0,Donnee=Valeurs,Effectif=Effectif,Grille=false,Origine=0,Angle=false,SemiAngle=false,Qualitatif=false,TableauVide=false,ECC=false,Coupure=10,CouleurTab=gray!15,Graphique=false,Batons=true,%
+Etendue=false,Moyenne=false,SET=false,ValeurExacte=false,MoyenneA,Somme,Mediane=false,DetailsMediane=false,UneMediane=false,QuartileUn=false,QuartileTrois=false,Total=false,Concret=false,%
+Largeur=1cm,Precision=2,PrecisionF=0,Donnee=Valeurs,Effectif=Effectif,Grille=false,Origine=0,Angle=false,SemiAngle=false,Qualitatif=false,Classes=false,TableauVide=false,ECC=false,Coupure=10,CouleurTab=gray!15,Graphique=false,Batons=true,%
 % Pour les diags batons
-EpaisseurBatons=1,ListeCouleursB={a},Lecture=false,LectureFine=false,AideLecture=false,Reponses=false,DonneesSup=false,AbscisseRotation=false,Tiret=false,AngleRotationAbscisse=0,Pasx=1,Pasy=1,Unitex=0.5,Unitey=0.5,Depart=0,CouleurDefaut=black,%
+EpaisseurBatons=1,ListeCouleursB={a},Lecture=false,LectureFine=false,AideLecture=false,Reponses=false,DonneesSup=false,AbscisseRotation=false,Tiret=false,AngleRotationAbscisse=0,Pasx=1,Pasy=1,Unitex=0.5,Unitey=0.5,Depart=0,CouleurDefaut=black,Date=false,GrandNombrey=false,GrandNombrex=false,%
 % Pour les diags circulaires
-Rayon=3cm,AffichageAngle=false,AffichageDonnee=false,ListeCouleurs={white},Hachures=false,LectureInverse=false,EcartHachures=0.25,EpaisseurHachures=1,Legende,LegendeVide=false,ACompleter=false,%
+Rayon=3cm,AffichageAngle=false,AffichageDonnee=false,ListeCouleurs={white},Hachures=false,ListeHachures={60},LectureInverse=false,EcartHachures=0.25,EpaisseurHachures=1,Legende,LegendeVide=false,ACompleter=false,DebutAngle=0,%
 %Pour les représentations
 Representation=false,%
 %Pour les barres horizontales
-Barre=false,Longueur=10cm,Hauteur=5mm,Bicolore=false,EcartBarre=0%Grille est dispo
+Barre=false,Longueur=10cm,Hauteur=5mm,Bicolore=false,EcartBarre=0,%Grille est dispo
+% Pour les histogrammes
+Histogramme=false,UniteAire=1,MemeAmpli,DepartHisto=1%
 }%
-%compl\'ements
+% compl\'ements
+%\defKV[ClesStat]{ListeHachures=\setKV[ClesStat]{Hachures}}%
+\defKV[ClesStat]{Unite=\setKV[ClesStat]{Concret}}%
 \defKV[ClesStat]{AngleRotationAbscisse=\setKV[ClesStat]{AbscisseRotation}}%
 \defKV[ClesStat]{AffichageDonnees=\setKV[ClesStat]{AffichageAngle=false}\setKV[ClesStat]{AffichageDonnee}}%
 \defKV[ClesStat]{CasesVides=\setKV[ClesStat]{CaseVide}}%
 \defKV[ClesStat]{LegendesVides=\setKV[ClesStat]{LegendeVide}}%
+\defKV[ClesStat]{GrandNombreO=\setKV[ClesStat]{GrandNombrey}}%
+\defKV[ClesStat]{GrandNombreA=\setKV[ClesStat]{GrandNombrex}}%
 % La construction du tableau
 \def\addtotok#1#2{#1\expandafter{\the#1#2}}%
 \newtoks\tabtoksa\newtoks\tabtoksb\newtoks\tabtoksc%
@@ -37,12 +44,12 @@
 %
 \newcounter{PfCCompteLignes}%
 %
-\def\BuildtabStat{% %%Tableau sans total
+\def\BuildtabStat{% %%Tableau sans/avec total
   \setcounter{PfCCompteLignes}{0}%
   \tabtoksa{\useKV[ClesStat]{Donnee}}\tabtoksb{\useKV[ClesStat]{Effectif}}%
   \foreachitem\compteur\in\ListeComplete{\expandafter\updatetoks\compteur\nil}%
+  \renewcommand{\arraystretch}{\useKV[ClesStat]{Stretch}}%
   \ifboolKV[ClesStat]{Total}{%
-    \renewcommand{\arraystretch}{\useKV[ClesStat]{Stretch}}%
     \begin{NiceTabular}{c*{\fpeval{\ListeCompletelen+1}}{>{\centering\arraybackslash}p{\useKV[ClesStat]{Largeur}}}}%
       \CodeBefore%
       \rowcolor{\useKV[ClesStat]{CouleurTab}}{1}%
@@ -84,7 +91,6 @@
       }%
     \end{NiceTabular}%
   }{%
-    \renewcommand{\arraystretch}{\useKV[ClesStat]{Stretch}}%
     \begin{NiceTabular}{c*{\fpeval{\ListeCompletelen}}{>{\centering\arraybackslash}p{\useKV[ClesStat]{Largeur}}}}%
       \CodeBefore%
       \rowcolor{\useKV[ClesStat]{CouleurTab}}{1}%
@@ -194,6 +200,7 @@
 }%
 
 \def\UpdateCoul#1\nil{\addtotok\toklistecouleur{#1,}}%
+\def\UpdateHach#1\nil{\addtotok\toklisteanglehachure{#1,}}%
 \def\UpdateLegende#1\nil{\addtotok\toklistelegende{#1,}}%
 
 % Pour construire le diagramme circulaire qualitatif
@@ -200,6 +207,7 @@
 \def\buildgraphcq#1{%
   \newtoks\toklistepointq\toklistepointq{}%
   \newtoks\toklistecouleur\toklistecouleur{}%
+  \newtoks\toklisteanglehachure\toklisteanglehachure{}%
   \newtoks\toklistelegende\toklistelegende{}%
   \ifboolKV[ClesStat]{LegendeVide}{%
     \xdef\foo{\useKV[ClesStat]{LegendesVides}}%
@@ -212,7 +220,10 @@
   \xdef\ListeAvantCouleurs{\useKV[ClesStat]{ListeCouleurs}}%
   \readlist*\ListeCouleur{\ListeAvantCouleurs}%
   \foreachitem\couleur\in\ListeCouleur{\expandafter\UpdateCoul\couleur\nil}%
-  \NewMPStatCirculaireQ{\the\toklistepointq}{#1}{\the\toklistecouleur}{\the\toklistelegende}%
+  \xdef\ListeAvantHachures{\useKV[ClesStat]{ListeHachures}}%
+  \readlist*\ListeHachure{\ListeAvantHachures}%
+  \foreachitem\valeurangle\in\ListeHachure{\expandafter\UpdateHach\valeurangle\nil}%
+  \NewMPStatCirculaireQ{\the\toklistepointq}{#1}{\the\toklistecouleur}{\the\toklistelegende}{\the\toklisteanglehachure}%
 }%
 
 %% calcul des fr\'equences
@@ -231,6 +242,8 @@
 %% calcul des ECC
 \newcount\CompteurECC%
 \newcount\CompteurECCTotal%
+\newcount\CompteurECCC%
+\newcount\CompteurECCCTotal%
 
 \newcommand\CalculECC[1]{%
   \xdef\TotalECC{0}%
@@ -451,7 +464,16 @@
   unitey:=\useKV[ClesStat]{Unitey}*cm;
   xpartorigine:=\useKV[ClesStat]{Origine};
   AngleRotation=\useKV[ClesStat]{AngleRotationAbscisse};
-  boolean Rotation,Lecture,LectureFine,AideLecture,DonneesSup,Reponses,Qualitatif,Tiret,LegendeVide,Retour;
+  boolean Rotation,Lecture,LectureFine,AideLecture,DonneesSup,Reponses,Qualitatif,Tiret,LegendeVide,Retour,GrandNombrex,GrandNombrey,Date;
+  GrandNombrex=\useKV[ClesStat]{GrandNombrex};
+  GrandNombrey=\useKV[ClesStat]{GrandNombrey};
+  if GrandNombrex:
+  GrandNombreA=\useKV[ClesStat]{GrandNombreA};
+  fi;
+  if GrandNombrey:
+  GrandNombreO=\useKV[ClesStat]{GrandNombreO};
+  fi;
+  Date:=\useKV[ClesStat]{Date};
   Rotation=\useKV[ClesStat]{AbscisseRotation};
   Lecture:=\useKV[ClesStat]{Lecture};
   LectureFine:=\useKV[ClesStat]{LectureFine};
@@ -541,16 +563,28 @@
     if pair p_:
     l:=l+1;
     if Rotation:
+    if Date:
+    label.bot(TEX(decimal(xpart(p_))) rotated AngleRotation,A[l]);
+    else:
     label.bot(TEX("\num{"&decimal(xpart(p_))&"}") rotated AngleRotation,A[l]);
+    fi;
     else :
+    if Date:
+    label.bot(TEX(decimal(xpart(p_))),A[l]);
+    else:
     label.bot(TEX("\num{"&decimal(xpart(p_))&"}"),A[l]);
     fi;
+    fi;
     if Reponses:
     if DonneesSup:
     Test(l);
     if Retour=false:
+    if GrandNombrey:
     label.top(TEX("\num{"&decimal(ypart(p_))&"}"),P[l]);
+    else:
+    label.top(TEX("\num{"&decimal(ypart(p_))&"}"),P[l]);
     fi;
+    fi;
     else:
     if Tiret:
     trace (B[l]+(-1pt,0))--(B[l]+(1pt,0));
@@ -627,10 +661,18 @@
     for k=0 step Pasy until ((maxy+1*Pasy)):
     if Tiret:
     trace (1pt,k*unitey)--(-1pt,k*unitey);
+    if GrandNombrey:
+    label.lft(TEX("\num{\fpeval{\useKV[ClesStat]{GrandNombreO}*"&decimal(k+Depart)&"}}"),(0,k*unitey));
+    else:
     label.lft(TEX("\num{"&decimal(k+Depart)&"}"),(0,k*unitey));
+    fi;
     else:
+    if GrandNombrey:
+    dotlabel.lft(TEX("\num{\fpeval{\useKV[ClesStat]{GrandNombreO}*"&decimal(k+Depart)&"}}"),(0,k*unitey));
+    else:
     dotlabel.lft(TEX("\num{"&decimal(k+Depart)&"}"),(0,k*unitey));
     fi;
+    fi;
     endfor;
     fi;
     if Lecture:
@@ -637,10 +679,18 @@
     for k=0 step Pasy until Pasy:
     if Tiret:
     trace (1pt,k*unitey)--(-1pt,k*unitey);
+    if GrandNombrey:
+    label.lft(TEX("\num{\fpeval{\useKV[ClesStat]{GrandNombreO}*"&decimal(k)&"}}"),(0,k*unitey));
+    else:
     label.lft(TEX("\num{"&decimal(k)&"}"),(0,k*unitey));
+    fi;
     else:
+    if GrandNombrey:
+    dotlabel.lft(TEX("\num{\fpeval{\useKV[ClesStat]{GrandNombreO}*"&decimal(k)&"}}"),(0,k*unitey));
+    else:
     dotlabel.lft(TEX("\num{"&decimal(k)&"}"),(0,k*unitey));
     fi;
+    fi;
     endfor;
     fi;
     drawarrow (0,0)--unitex*(maxx+1,0);
@@ -796,6 +846,7 @@
   ang[0]:=0;
   path cc;
   cc=(fullcircle scaled (2*Rayon));
+  %
   vardef AfficheLegende(text t)=
   picture ResultatLegende;
   ResultatLegende=image(
@@ -806,12 +857,12 @@
   draw 0.95[O,C[n]]--1.05[O,C[n]];
   C[n]:=1.05[O,C[n]];
   Test(n);
-  if (xpart(C[n])>xpart(O)) and (ypart(C[n])>ypart(O)):
+  if ((xpart(C[n])>xpart(O)) or (xpart(C[n])=xpart(O))) and ((ypart(C[n])>ypart(O)) or (ypart(C[n])=ypart(O))):
   D[n]=C[n]+(0.5cm,0);
   draw C[n]--D[n];
   if Retour=false:label.urt(TEX(p_),D[n]);fi;
   fi;
-  if (xpart(C[n])<xpart(O)) and (ypart(C[n])>ypart(O)):
+  if (xpart(C[n])<xpart(O)) and ((ypart(C[n])>ypart(O)) or (ypart(C[n])=ypart(O))):
   D[n]=C[n]-(0.5cm,0);
   draw C[n]--D[n];
   if Retour=false:label.ulft(TEX(p_),D[n]);fi;
@@ -821,7 +872,7 @@
   draw C[n]--D[n];
   if Retour=false:label.llft(TEX(p_),D[n]);fi;
   fi;
-  if (xpart(C[n])>xpart(O)) and (ypart(C[n])<ypart(O)):
+  if ((xpart(C[n])>xpart(O)) or (xpart(C[n])=xpart(O))) and (ypart(C[n])<ypart(O)):
   D[n]=C[n]+(0.5cm,0);
   draw C[n]--D[n];
   if Retour=false:label.lrt(TEX(p_),D[n]);fi;
@@ -842,12 +893,12 @@
   draw 0.95[O,C[n]]--1.05[O,C[n]];
   C[n]:=1.05[O,C[n]];
   Test(n);
-  if (xpart(C[n])>xpart(O)) and (ypart(C[n])>ypart(O)):
+  if (xpart(C[n])>xpart(O)) and ((ypart(C[n])>ypart(O)) or (ypart(C[n])=ypart(O))):
   D[n]=C[n]+(0.5cm,0);
   draw C[n]--D[n];
   if Retour=false:label.urt(LATEX(p_),D[n]);fi;
   fi;
-  if (xpart(C[n])<xpart(O)) and (ypart(C[n])>ypart(O)):
+  if (xpart(C[n])<xpart(O)) and ((ypart(C[n])>ypart(O)) or (ypart(C[n])=ypart(O))):
   D[n]=C[n]-(0.5cm,0);
   draw C[n]--D[n];
   if Retour=false:label.ulft(LATEX(p_),D[n]);fi;
@@ -871,19 +922,22 @@
 }
 
 % la construction du graphique qualitatif
-\def\NewMPStatCirculaireQ#1#2#3#4{%
+% la construction du graphique qualitatif
+\def\NewMPStatCirculaireQ#1#2#3#4#5{%
   %#1 : la liste des données
   %#2 : 360 ou 180
   %#3 : liste des couleurs
   %#4 : liste des légendes à effacer.
+  %#5 : liste des angles des hachures
   \ifluatex
   \mplibforcehmode
   \begin{mplibcode}
     \NewMPStatCirculaireCodeQ
+    DebutAngle=\useKV[ClesStat]{DebutAngle};
     if Inverse=false:
-    A[0]=point(0) of cc;
+    A[0]=point(0+DebutAngle) of cc;
     else:
-    A[0]=point(180) of cc;
+    A[0]=point(180+DebutAngle) of cc;
     fi;
     % on r\'ecup\`ere les couleurs
     color Col[];
@@ -892,6 +946,13 @@
     n:=n+1;
     Col[n]=p_;
     endfor;
+    % on r\'ecup\`ere les angles d'hachures
+    numeric anglehach[];
+    n:=0;
+    for p_=#5:
+    n:=n+1;
+    anglehach[n]=p_;
+    endfor;
     vardef toto(text t)=
     n:=0;
     for p_=t:
@@ -920,8 +981,8 @@
     else:
     draw
     Hachurage((O--if Inverse=false:arccercle(A[n-1],A[n],O)
-    else:arccercle(A[n],A[n-1],O) fi--cycle),p_*(#2/total[N]) if
-    (n mod 2)=0: +90 else: -90 fi,ecarthachures,if (n mod 2)=0 : 0 else: 1 fi)
+    else:arccercle(A[n],A[n-1],O) fi--cycle),if unknown anglehach[n]:p_*(#2/total[N]) if
+    (n mod 2)=0: +90 else: -90 fi else: anglehach[n] fi,ecarthachures,if (n mod 2)=0 : 0 else: 1 fi)
     withpen pencircle scaled epaisseurhachures if AffichageAngle: withcolor 0.5white fi;
     fi;
     if ACompleter=false:
@@ -1027,6 +1088,13 @@
     n:=n+1;
     Col[n]=p_;
     endfor;
+    % on r\'ecup\`ere les angles d'hachures
+    numeric anglehach[];
+    n:=0;
+    for p_=#5:
+    n:=n+1;
+    anglehach[n]=p_;
+    endfor;
     if Inverse=false:
     A[0]=point(0) of cc;
     else:
@@ -1060,8 +1128,8 @@
     else:
     draw
     Hachurage((O--if Inverse=false:arccercle(A[n-1],A[n],O)
-    else:arccercle(A[n],A[n-1],O) fi--cycle),p_*(#2/total[N]) if
-    (n mod 2)=0: +90 else: -90 fi,ecarthachures,if (n mod 2)=0 : 0 else: 1 fi)
+    else:arccercle(A[n],A[n-1],O) fi--cycle),if unknown anglehach[n]:p_*(#2/total[N]) if
+    (n mod 2)=0: +90 else: -90 fi else: anglehach[n] fi,ecarthachures,if (n mod 2)=0 : 0 else: 1 fi)
     withpen pencircle scaled epaisseurhachures if AffichageAngle: withcolor 0.5white fi;
     fi;
     if ACompleter=false:
@@ -1166,477 +1234,905 @@
 \DTLgnewdb{mtdbEE}%
 \DTLgnewdb{mtdbEEqual}%
 %
+
+% Pour les classes
+% Pour construire l'histogramme
+\def\UpdatetoksHisto#1/#2/#3\nil{\addtotok\toklisteelmtsclasse{#1,#2,}\addtotok\toklistedonhisto{#3,}}
+\def\UpdatetoksECC#1\nil{\addtotok\toklistedonhisto{#1,}}
+
+\NewDocumentCommand\buildgraphhisto{}{%
+  \newtoks\toklisteelmtsclasse%
+  \newtoks\toklistedonhisto%
+  \newtoks\toklistecouleur%
+  \newtoks\toklistelegende%
+  \ifboolKV[ClesStat]{LegendeVide}{%
+    \xdef\foo{\useKV[ClesStat]{LegendesVides}}%
+    \readlist*\ListeLegendesAEffacer{\foo}%
+  }{\xdef\foo{-1}\readlist*\ListeLegendesAEffacer{\foo}%
+  }%
+  \foreachitem\compteur\in\ListeLegendesAEffacer{\expandafter\UpdateLegende\compteur\nil}%
+  \foreachitem\compteur\in\ListeDepart{\expandafter\UpdatetoksHisto\compteur\nil}%
+  \ifboolKV[ClesStat]{ECC}{%
+    \toklistedonhisto{}%
+    \xdef\PfCFooECC{\ListeDepart[1,3]}%
+    \xintFor* ##1 in{\xintSeq{2}{\ListeDepartlen}}\do{%
+      \xdef\PfCFooRetiens{0}%
+      \xintFor* ##2 in{\xintSeq{1}{##1}}\do{%
+        \xdef\PfCFooRetiens{\fpeval{\PfCFooRetiens+\ListeDepart[##2,3]}}%
+      }%
+      \xdef\PfCFooECC{\PfCFooECC,\PfCFooRetiens}%
+    }%
+    \readlist*\PfCListeECC{\PfCFooECC}%
+    \foreachitem\compteur\in\PfCListeECC{\expandafter\UpdatetoksECC\compteur\nil}%
+  }{}%
+  \xdef\PfCEcartClasse{\fpeval{\ListeDepart[1,2]-\ListeDepart[1,1]}}%
+  \foreachitem\compteur\in\ListeDepart{%
+    \xdef\PfCEcartClasse{\PfCEcartClasse,\fpeval{\ListeDepart[\compteurcnt,2]-\ListeDepart[\compteurcnt,1]}}
+  }%
+  \xintifboolexpr{\fpeval{min(\PfCEcartClasse)}==\fpeval{max(\PfCEcartClasse)}}{}{\setKV[ClesStat]{MemeAmpli=false}}
+  % Pour les couleurs
+  \xdef\ListeAvantCouleurs{\useKV[ClesStat]{ListeCouleurs}}%
+  \readlist*\ListeCouleur{\ListeAvantCouleurs}%
+  \foreachitem\couleur\in\ListeCouleur{\expandafter\UpdateCoul\couleur\nil}%
+  %
+  \MPBuildHisto{\the\toklisteelmtsclasse}{\the\toklistedonhisto}{\the\toklistecouleur}{\the\toklistelegende}%
+}
+
+%% calcul des fr\'equences
+\newcommand\CalculFrequenceClasses[1]{%
+  \fpeval{round(\ListeDepart[#1,3]*100/\EffectifTotal,\useKV[ClesStat]{PrecisionF})}
+}
+
+\newcommand\CalculECCClasses[1]{%
+  \xdef\TotalECCC{0}%
+  \CompteurECCC=1%
+  \CompteurECCCTotal=\numexpr#1+1%
+  \whiledo{\CompteurECCC < \CompteurECCCTotal}{%
+    \xdef\TotalECCC{\fpeval{\TotalECCC+\ListeDepart[\the\CompteurECCC,3]}}%
+    \CompteurECCC=\numexpr\CompteurECCC+1%
+  }%
+  \num{\TotalECCC}%
+}
+
+\NewDocumentCommand\buildtabclasses{}{%
+  \setcounter{PfCCompteLignes}{0}%
+  \renewcommand{\arraystretch}{\useKV[ClesStat]{Stretch}}%
+  \begin{NiceTabular}{l*{\ListeDepartlen}{c}}%[hvlines]
+    \CodeBefore%
+    \rowcolor{\useKV[ClesStat]{CouleurTab}}{1}%
+    \columncolor{\useKV[ClesStat]{CouleurTab}}{1}%
+    \Body
+    \useKV[ClesStat]{Donnee}\xintFor* ##1 in{\xintSeq{1}{\ListeDepartlen}}\do{%
+      &$\num{\ListeDepart[##1,1]}\leqslant\dots<\num{\ListeDepart[##1,2]}$
+    }\\
+    \useKV[ClesStat]{Effectif}\xintFor* ##1 in{\xintSeq{1}{\ListeDepartlen}}\do{%
+      &\ifboolKV[ClesStat]{EffVide}{}{\num{\ListeDepart[##1,3]}}%
+    }\\
+    \ifboolKV[ClesStat]{Frequence}{\stepcounter{PfCCompteLignes}Fr\'equence (\%)\xintFor* ##1 in {\xintSeq {1}{\ListeDepartlen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{\num{\CalculFrequenceClasses{##1}}}}}\\
+    }{}%
+    \ifboolKV[ClesStat]{ECC}{\stepcounter{PfCCompteLignes}E.C.C.\xintFor* ##1 in {\xintSeq {1}{\ListeDepartlen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{ECCVide}{}{\CalculECCClasses{##1}}}}\\}{}%
+    \CodeAfter%
+    % On crée la liste des colonnes à vider
+    \xintifboolexpr{\useKV[ClesStat]{ColVide}>0}{%
+      \xdef\FooStat{\useKV[ClesStat]{ColVide}}%
+      \setsepchar{,}%
+      \readlist*\ListeColonnesAVider{\FooStat}%
+      \foreachitem\compteur\in\ListeColonnesAVider{%
+        \tikz\fill[white] (row-2-|col-\fpeval{\compteur+1}) rectangle (last-|col-\fpeval{\compteur+2});%
+      }%
+    }{}%
+%    % On crée la liste des cases à vider
+    \ifboolKV[ClesStat]{CaseVide}{%
+      \xdef\FooStatCases{\useKV[ClesStat]{CasesVides}}%
+      \setsepchar[*]{,*/}%
+      \readlist*\ListeCasesAVider{\FooStatCases}%
+      \foreachitem\compteur\in\ListeCasesAVider{%
+        \tikz\fill[white] (row-\fpeval{\ListeCasesAVider[\compteurcnt,1]+1}-|col-\fpeval{\ListeCasesAVider[\compteurcnt,2]+1}) rectangle (row-\fpeval{\ListeCasesAVider[\compteurcnt,1]+2}-|col-\fpeval{\ListeCasesAVider[\compteurcnt,2]+2});%
+      }%
+    }{}%
+%    % On retrace le tableau
+%    % Les colonnes
+    \xintFor* ##1 in {\xintSeq{1}{\fpeval{\ListeDepartlen+2}}}\do{%
+      \tikz\draw (row-1-|col-##1) -- (last-|col-##1);%
+    }%
+%    % Les lignes
+    \xintFor* ##1 in {\xintSeq{1}{\fpeval{\thePfCCompteLignes+3}}}\do{%
+      \tikz\draw (row-##1-|col-1) -- (row-##1-|last);%
+    }%
+  \end{NiceTabular}
+}%
+
+\NewDocumentCommand\MPBuildHisto{mmmm}{%
+  \ifluatex
+  \mplibforcehmode
+  \begin{mplibcode}
+    maxx:=-infinity;
+    minx:=infinity;
+    maxy:=-infinity;
+    miny:=0;
+    unitex:=\useKV[ClesStat]{Unitex}*cm;
+    unitey:=\useKV[ClesStat]{Unitey}*cm;
+    Pasx:=\useKV[ClesStat]{Pasx};
+    Pasy:=\useKV[ClesStat]{Pasy};
+    UniteAire=\useKV[ClesStat]{UniteAire};
+    Ecarthachures=\useKV[ClesStat]{EcartHachures};
+    Epaisseurhachures=\useKV[ClesStat]{EpaisseurHachures};
+    boolean MemeAmpli,Hachures,Lecture,LectureFine,AideLecture,DonneesSup,Tiret,LegendeVide,Retour,Mediane,ECC;
+    ECC=\useKV[ClesStat]{ECC};
+    Mediane=\useKV[ClesStat]{Mediane};
+    MemeAmpli=\useKV[ClesStat]{MemeAmpli};
+    Hachures:=\useKV[ClesStat]{Hachures};
+    %
+    Lecture:=\useKV[ClesStat]{Lecture};
+    LectureFine:=\useKV[ClesStat]{LectureFine};
+    Tiret=\useKV[ClesStat]{Tiret};
+    AideLecture:=\useKV[ClesStat]{AideLecture};
+    DonneesSup:=\useKV[ClesStat]{DonneesSup};
+    LegendeVide=\useKV[ClesStat]{LegendeVide};
+    Retour=false;
+    % Test affichage
+    vardef Test(expr nb)=
+    Retour:=false;
+    op:=0;
+    for l_=#4:
+    if l_=nb:
+    op:=op+1;
+    fi;
+    endfor;
+    if op>0:
+    Retour:=true;
+    fi;
+    enddef;
+    %Affichage ou pas des légendes
+    vardef AfficheLegende(text t)=
+    l=0;
+    for p_=t:
+    l:=l+1;
+    if DonneesSup:
+    Test(l);
+    if Retour=false:
+    label.top(TEX("\num{"&decimal(Y[l])&"}"),(unitex*(Depart+(0.5*(X[2*l]+X[2*l-2])-X[1])/Pasx),unitey*Z[l]));
+    fi;
+    fi;
+    endfor;
+    enddef;
+    % on r\'ecup\`ere les couleurs
+    Depart=\useKV[ClesStat]{DepartHisto};
+    color Col[],CoulDefaut;
+    CoulDefaut=white;
+    n:=0;
+    for p_=#3:
+    n:=n+1;
+    Col[n]=p_;
+    endfor;
+    %
+    numeric X[];
+    numeric ecartabs[];
+    vardef RecupValeursAbscisses(text t)=
+    p:=0;
+    for p_=t:
+    p:=p+1;
+    X[p]:=p_;
+    if X[p]<minx:
+    minx:=X[p];
+    fi;
+    if X[p]>maxx:
+    maxx:=X[p];
+    fi;
+    endfor;
+    X[0]=X[1];
+    TotalAbscisses=p;
+    enddef;
+    numeric Y[],Z[];
+    numeric EffectifTotal[];
+    numeric EffectifTotalA[];
+    vardef RecupValeursDonnees(text t)=
+    p:=0;
+    EffectifTotal[0]:=0;
+    EffectifTotalA[0]:=0; 
+    for p_=t:
+    p:=p+1;
+    EffectifTotal[p]:=p_;
+    EffectifTotalA[p]:=EffectifTotalA[p-1]+p_;
+    Y[p]:=p_;
+    Z[p]=(Y[p]/(UniteAire*(X[2*p]-X[2*p-1])/Pasx));
+    R[p]=ceiling(Z[p]);
+    if R[p]>maxy:
+    maxy:=R[p];
+    fi;
+    endfor;
+    NbDonnees:=p;
+    enddef;
+    %On affiche la médiane dans le cas des ECC
+    vardef AfficheMedianeECC(text t)=
+    YMed:=Z[NbDonnees]/2;
+    DemiDonnees:=EffectifTotal[NbDonnees]/2;
+    p:=0;
+    forever:
+    p:=p+1;
+    exitif EffectifTotal[p]>DemiDonnees;
+    endfor;
+    path MedHor,MedLineaire,MedVer;
+    MedLineaire=(unitex*(Depart+(X[2*p-2]-X[1]/Pasx)),unitey*Z[p-1])--(unitex*(Depart+(X[2*p]-X[1])/Pasx),unitey*Z[p]);
+    MedHor=((0,unitey*YMed)--(unitex*((maxx-minx)/Pasx+2),unitey*YMed));
+    MedVer=(xpart(MedLineaire intersectionpoint MedHor),0)--(MedLineaire intersectionpoint MedHor);
+    draw MedLineaire;
+    draw MedHor;
+    draw MedVer;
+    enddef;
+    % On affiche la médiane dans le cas non ECC
+    vardef AfficheMediane(text t)=
+    DemiDonnees:=EffectifTotalA[NbDonnees]/2;
+    p:=0;
+    forever:
+    p:=p+1;
+    exitif EffectifTotalA[p]>DemiDonnees;
+    endfor;
+    path MedVer;
+    numeric CoefLineaire,pMed;
+    pMed=p;
+    CoefLineaire=(DemiDonnees-EffectifTotalA[p-1])/Y[p];
+    MedVer=(unitex*(Depart+(X[2*p-2]-X[1])/Pasx+CoefLineaire*(X[2*p]-X[2*p-2])/Pasx),0)--(unitex*(Depart+(X[2*p-2]-X[1])/Pasx+CoefLineaire*(X[2*p]-X[2*p-2])/Pasx),unitey*Z[p]);
+    draw MedVer dashed evenly;
+    enddef;
+    % On commence le tracé : on récupère les informations
+    RecupValeursAbscisses(#1);
+    RecupValeursDonnees(#2);
+    % on définit une grille
+    vardef Grille=
+    if MemeAmpli:
+    Ajout:=1;
+    else:
+    Ajout:=3;
+    fi;
+    drawoptions(withcolor 0.7white);
+    for k=0 upto ((maxx-minx)/Pasx+2):
+    trace (unitex*k,0)--(unitex*k,(maxy+Ajout)*unitey);%withcolor red;
+    endfor;
+    for k=0 upto (maxy+Ajout):
+    trace (0,k*unitey)--(unitex*((maxx-minx)/Pasx+2),k*unitey);% withcolor blue;
+    endfor;
+    drawoptions();
+    enddef;
+    % Fin Grille
+    % On trace les rectangles
+    vardef AfficheRectangles=
+    if Hachures:
+    Grille;
+    for k=2 step 2 until TotalAbscisses:
+    draw hachurage(polygone(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0)),60,0.2,0);
+    draw chemin(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0));
+    endfor;
+    else:
+    for k=2 step 2 until TotalAbscisses:
+    fill polygone(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0)) withcolor if unknown Col[k/2]: CoulDefaut else: Col[k/2] fi;
+    endfor;
+    Grille;
+    for k=2 step 2 until TotalAbscisses:
+    draw chemin(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0));
+    endfor;
+    fi;
+    enddef;
+    % Affichage final
+    if ECC:
+      AfficheRectangles;
+      if Mediane:
+        AfficheMedianeECC(#2);
+      fi;
+    else:
+      if Mediane:
+        AfficheMediane(#2);
+        if Hachures:
+        Grille;
+        %Partie gauche
+          for k=2 step 2 until (2*pMed-2):
+            draw hachurage(polygone(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0)),60,0.2,0);
+            draw chemin(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0));
+          endfor;
+          draw hachurage(polygone(unitex*(Depart+(X[2*pMed-2]-X[1])/Pasx,0),point(0) of MedVer,point(1) of MedVer,(unitex*(Depart+(X[2*pMed-2]-X[1])/Pasx),unitey*Z[pMed])),60,0.2,0);
+          draw polygone(unitex*(Depart+(X[2*pMed-2]-X[1])/Pasx,0),point(0) of MedVer,point(1) of MedVer,(unitex*(Depart+(X[2*pMed-2]-X[1])/Pasx),unitey*Z[pMed]));
+          % Partie droite
+          for k=2*pMed+2 step 2 until TotalAbscisses:
+            draw hachurage(polygone(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0)),120,0.2,1);
+            draw chemin(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0));
+          endfor;
+          draw hachurage(polygone(unitex*(Depart+(X[2*pMed]-X[1])/Pasx,0),point(0) of MedVer,point(1) of MedVer,(unitex*(Depart+(X[2*pMed]-X[1])/Pasx),unitey*Z[pMed])),120,0.2,1);
+          draw polygone(unitex*(Depart+(X[2*pMed]-X[1])/Pasx,0),point(0) of MedVer,point(1) of MedVer,(unitex*(Depart+(X[2*pMed]-X[1])/Pasx),unitey*Z[pMed]));
+          else:
+          %Partie gauche
+    for k=2 step 2 until (2*pMed-2):
+    fill polygone(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0)) withcolor if unknown Col[1]: CoulDefaut else: Col[1] fi;
+    endfor;
+    fill polygone(unitex*(Depart+(X[2*pMed-2]-X[1])/Pasx,0),point(0) of MedVer,point(1) of MedVer,(unitex*(Depart+(X[2*pMed-2]-X[1])/Pasx),unitey*Z[pMed])) withcolor if unknown Col[1]: CoulDefaut else: Col[1] fi ;
+    % Partie droite
+    for k=2*pMed+2 step 2 until TotalAbscisses:
+    fill polygone(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0)) withcolor if unknown Col[2]: CoulDefaut else: Col[2] fi;
+    endfor;
+    fill polygone(unitex*(Depart+(X[2*pMed]-X[1])/Pasx,0),point(0) of MedVer,point(1) of MedVer,(unitex*(Depart+(X[2*pMed]-X[1])/Pasx),unitey*Z[pMed]))  withcolor if unknown Col[2]: CoulDefaut else: Col[2] fi;
+    Grille;
+    %Partie Gauche
+    for k=2 step 2 until (2*pMed-2):
+    trace polygone(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0));
+    endfor;
+    trace polygone(unitex*(Depart+(X[2*pMed-2]-X[1])/Pasx,0),point(0) of MedVer,point(1) of MedVer,(unitex*(Depart+(X[2*pMed-2]-X[1])/Pasx),unitey*Z[pMed]));%(Y[pMed]/(UniteAire*(X[2*pMed-2]-X[2*pMed-3])/Pasx))));
+    for k=2*pMed+2 step 2 until TotalAbscisses:
+    draw chemin(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0));
+    endfor;
+    draw polygone(unitex*(Depart+(X[2*pMed]-X[1])/Pasx,0),point(0) of MedVer,point(1) of MedVer,(unitex*(Depart+(X[2*pMed]-X[1])/Pasx),unitey*Z[pMed]));
+    fi;
+    draw MedVer withpen pencircle scaled 2;
+      else:
+        AfficheRectangles;
+      fi;
+    fi;
+    %Affichage ou pas des axes, de la médiane
+    if MemeAmpli:
+      drawarrow (0,0)--unitey*(0,maxy+1);
+      EcartAmpli:=(X[2]-X[1])/Pasx;
+      if AideLecture:
+      for k=2 step 2 until TotalAbscisses:
+        trace ((unitex*(Depart+(X[k]-X[1])/Pasx),unitey*Z[k/2]))--(unitey*(0,Z[k/2])) dashed evenly;
+        endfor;
+      fi;
+      if LectureFine:
+        for k=0 upto ((maxy+1)):
+          if Tiret:
+            trace (1pt,k*unitey)--(-1pt,k*unitey);
+            label.lft(TEX("\num{"&decimal(k*UniteAire*EcartAmpli)&"}"),(0,k*unitey));
+          else:
+            dotlabel.lft(TEX("\num{"&decimal(k*UniteAire*EcartAmpli)&"}"),(0,k*unitey));
+          fi;
+        endfor;
+      fi;
+      if Lecture:
+        for k=0 upto 1:
+        if Tiret:
+          trace (1pt,k*unitey)--(-1pt,k*unitey);
+          label.lft(TEX("\num{"&decimal(k*UniteAire*EcartAmpli)&"}"),(0,k*unitey));
+    else:
+    dotlabel.lft(TEX("\num{"&decimal(k*UniteAire*EcartAmpli)&"}"),(0,k*unitey));
+    fi;
+    endfor;
+    fi; 
+    else:%Pas même ampli : on n'affiche pas l'axe vertical
+    trace hachurage(polygone((unitex,unitey*(maxy+2)),(unitex*2,unitey*(maxy+2)),(unitex*2,unitey*(maxy+1)),(unitex,unitey*(maxy+1))),60,0.2,0);
+    trace polygone((unitex,unitey*(maxy+2)),(unitex*2,unitey*(maxy+2)),(unitex*2,unitey*(maxy+1)),(unitex,unitey*(maxy+1)));
+    label.rt(TEX(decimal(UniteAire)&"~\useKV[ClesStat]{Effectif}"),(unitex*2,unitey*(maxy+1.5)));
+%    if Mediane:
+%    AfficheMediane(#2);
+%    fi;
+    fi;
+    % On trace l'axe des abscisses
+    drawarrow (0,0)--unitex*((maxx-minx)/Pasx+2,0);
+    %On labelise l'axe des abscisses
+    dotlabel.bot(TEX("\num{"&decimal(X[1])&"}"),unitex*(Depart,0));
+    for k=2 step 2 until TotalAbscisses:
+    dotlabel.bot(TEX("\num{"&decimal(X[k])&"}"),unitex*(Depart+(X[k]-X[1])/Pasx,0));
+    endfor;
+    label.rt(TEX("\useKV[ClesStat]{Donnee}"),(unitex*((maxx-minx)/Pasx+2),0));
+    %On affiche les données sup ou pas.
+    AfficheLegende(#2);
+  \end{mplibcode}
+  \fi
+}
+%
+
 \newcommand\Stat[2][]{%
   \useKVdefault[ClesStat]%
   \setKV[ClesStat]{#1}%
-  \ifboolKV[ClesStat]{Representation}{%
-    \setKV[TraceG]{Xmin=0,Ymin=0}%
-    \setKV[TraceG]{#1}%
-    \readlist*\ListePointsPlaces{#2}%
-    \newtoks\toklistepoint%
-    \foreachitem\compteur\in\ListePointsPlaces{\expandafter\Updatetoks\compteur\nil}%
-    \MPPlacePoint[#1]{\the\toklistepoint}%
+  \ifboolKV[ClesStat]{UneMediane}{\renewcommand{\PfCArticleMediane}{une}}{\renewcommand{\PfCArticleMediane}{la}}%
+  \setsepchar[*]{,*/}%
+  \readlist*\ListeAvantUtilisation{#2}%
+  \xintifboolexpr{\listlen\ListeAvantUtilisation[1]==3}{\setKV[ClesStat]{Classes}}{}%
+  \ifboolKV[ClesStat]{Classes}{%
+    \setsepchar[*]{,*/}%
+    \readlist*\ListeDepart{#2}%
+    \xdef\EffectifTotal{0}%
+    \xintFor* ##1 in{\xintSeq{1}{\ListeDepartlen}}\do{%
+      \xdef\EffectifTotal{\fpeval{\EffectifTotal+\ListeDepart[##1,3]}}%
+    }%
+    \ifboolKV[ClesStat]{Histogramme}{%
+      \buildgraphhisto%
+    }{%
+      \ifboolKV[ClesStat]{Tableau}{%
+        \buildtabclasses%
+      }{}%
+    }%
   }{%
-    \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}%
+    \setsepchar{,}%
+    \ifboolKV[ClesStat]{Representation}{%
+      \setKV[TraceG]{Xmin=0,Ymin=0}%
+      \setKV[TraceG]{#1}%
+      \readlist*\ListePointsPlaces{#2}%
+      \newtoks\toklistepoint%
+      \foreachitem\compteur\in\ListePointsPlaces{\expandafter\Updatetoks\compteur\nil}%
+      \MPPlacePoint[#1]{\the\toklistepoint}%
     }{%
-      \ifboolKV[ClesStat]{Sondage}{%
+      \ifboolKV[ClesStat]{Liste}{%
         \setsepchar{,}\ignoreemptyitems%
         \readlist*\Liste{#2}%
-        % "liste vide"
-        \newtoks\tabtoksEEa%
-        \tabtoksEEa{}%
-        % 
-        % "liste vide"
-        \newtoks\tabtoksEEb%
-        \tabtoksEEb{}%
-        % 
-        \readlist*\ListeSansDoublonsEE{999}%   %% Pour ne pas avoir une liste vide
-        % 
-        \newcount\cmptEE%
-        \newcount\PasNumEE%    %% Permettra de savoir si ce sondage est qualitatif ou quantitatif
-        \PasNumEE=0\relax%
-        \DTLcleardb{mtdbEE}%
-        % on range les resultats du sondage par ordre croissant.
-        \foreachitem\x\in\Liste{%
-          \DTLnewrow{mtdbEE}%
-          \DTLnewdbentry{mtdbEE}{Numeric}{\x}%
+        \xdef\foo{}%
+        \setsepchar[*]{,*/}\ignoreemptyitems%
+        \xintFor* ##1 in {\xintSeq {1}{\Listelen}}\do{%
+          \xdef\foo{\foo 1/\Liste[##1],}%
         }%
-        \dtlsort{Numeric}{mtdbEE}{\dtlicompare}%
-        \DTLforeach{mtdbEE}{\nba=Numeric}{%
-          \IfDecimal{\nba}{}{\PasNumEE=\numexpr\PasNumEE+1\relax}%
-          \cmptEE=0\relax%
-          \foreachitem\nbb\in\ListeSansDoublonsEE{%
-            \ifthenelse{\equal{\nba}{\nbb}}{\cmptEE=\numexpr\cmptEE+1\relax}{}%
-          }%
-          \ifthenelse{\equal{\the\cmptEE}{0}}{%
-            \expandafter\AjoutListEEb\nba\nil%
-            \xdef\listEEa{\the\tabtoksEEb}%
-            \ignoreemptyitems%
-            \setsepchar{,}%
-            \readlist*\ListeSansDoublonsEE\listEEa%    	%%% Enl\`eve tous les \'elements
-            %%% identiques de Liste
-          }{}%  
-        }%	
-        \foreachitem\nba\in\ListeSansDoublonsEE{%
-          \cmptEE=0\relax%
-          \DTLforeach{mtdbEE}{\nbb=Numeric}{%
-            \ifthenelse{\equal{\nba}{\nbb}}{\cmptEE=\numexpr\cmptEE+1\relax}{}%
-          }%
-          \expandafter\AjoutListEEab\nba\nil%
-          \expandafter\AjoutListEEaa\the\cmptEE\nil% 	%%% Compte tous les \'elements
-          %%% identiques de Liste
-        }%
-        \xdef\listEEb{\the\tabtoksEEa}
-        \ignoreemptyitems%
-        \setsepchar[*]{,*/}%
-        \readlist*\ListeComplete\listEEb%
-        % 
-        \ifthenelse{\equal{\the\PasNumEE}{0}}{\setKV[ClesStat]{Quantitatif}}{\setKV[ClesStat]{Qualitatif}}%
+        \readlist*\ListeComplete{\foo}%
+        \setKV[ClesStat]{Qualitatif}%
       }{%
-        \ifboolKV[ClesStat]{Qualitatif}{%
-          %  % on lit la liste \'ecrite sous la forme valeur/effectif
-          \setsepchar[*]{,*/}\ignoreemptyitems%
-          \readlist*\ListeInitiale{#2}%
+        \ifboolKV[ClesStat]{Sondage}{%
+          \setsepchar{,}\ignoreemptyitems%
+          \readlist*\Liste{#2}%
           % "liste vide"
-          \newtoks\tabtoksEE%
-          \tabtoksEE{}%
-          \DTLcleardb{mtdbEEqual}%
-          \foreachitem\x\in\ListeInitiale{%
-            \DTLnewrow{mtdbEEqual}%
-            \itemtomacro\ListeInitiale[\xcnt,1]\x%
-            \DTLnewdbentry{mtdbEEqual}{Val}{\x}%
-            \itemtomacro\ListeInitiale[\xcnt,2]\y%
-            \DTLnewdbentry{mtdbEEqual}{Eff}{\y}%
+          \newtoks\tabtoksEEa%
+          \tabtoksEEa{}%
+          % 
+          % "liste vide"
+          \newtoks\tabtoksEEb%
+          \tabtoksEEb{}%
+          % 
+          \readlist*\ListeSansDoublonsEE{999}%   %% Pour ne pas avoir une liste vide
+          % 
+          \newcount\cmptEE%
+          \newcount\PasNumEE%    %% Permettra de savoir si ce sondage est qualitatif ou quantitatif
+          \PasNumEE=0\relax%
+          \DTLcleardb{mtdbEE}%
+          % on range les resultats du sondage par ordre croissant.
+          \foreachitem\x\in\Liste{%
+            \DTLnewrow{mtdbEE}%
+            \DTLnewdbentry{mtdbEE}{Numeric}{\x}%
           }%
-          \DTLforeach{mtdbEEqual}{\Val=Val,\Eff=Eff}{%  
-            \expandafter\AjoutListEEy\Val\nil%
-            \expandafter\AjoutListEEx\Eff\nil%
+          \dtlsort{Numeric}{mtdbEE}{\dtlicompare}%
+          \DTLforeach{mtdbEE}{\nba=Numeric}{%
+            \IfDecimal{\nba}{}{\PasNumEE=\numexpr\PasNumEE+1\relax}%
+            \cmptEE=0\relax%
+            \foreachitem\nbb\in\ListeSansDoublonsEE{%
+              \ifthenelse{\equal{\nba}{\nbb}}{\cmptEE=\numexpr\cmptEE+1\relax}{}%
+            }%
+            \ifthenelse{\equal{\the\cmptEE}{0}}{%
+              \expandafter\AjoutListEEb\nba\nil%
+              \xdef\listEEa{\the\tabtoksEEb}%
+              \ignoreemptyitems%
+              \setsepchar{,}%
+              \readlist*\ListeSansDoublonsEE\listEEa%    	%%% Enl\`eve tous les \'elements
+              %%% identiques de Liste
+            }{}%
           }%
-          \xdef\listEE{\the\tabtoksEE}
+          \foreachitem\nba\in\ListeSansDoublonsEE{%
+            \cmptEE=0\relax%
+            \DTLforeach{mtdbEE}{\nbb=Numeric}{%
+              \ifthenelse{\equal{\nba}{\nbb}}{\cmptEE=\numexpr\cmptEE+1\relax}{}%
+            }%
+            \expandafter\AjoutListEEab\nba\nil%
+            \expandafter\AjoutListEEaa\the\cmptEE\nil% 	%%% Compte tous les \'elements
+            %%% identiques de Liste
+          }%
+          \xdef\listEEb{\the\tabtoksEEa}
           \ignoreemptyitems%
           \setsepchar[*]{,*/}%
-          \readlist*\ListeComplete\listEE%
-        }{% Dans le qualitatif, on trie d'abord les valeurs.
-          \setsepchar[*]{,*/}\ignoreemptyitems%
-          \readlist*\ListeInitiale{#2}%
-          % "liste vide"
-          \newtoks\tabtoksEE%
-          \tabtoksEE{}%
-          \DTLcleardb{mtdbEEqual}%
-          \foreachitem\x\in\ListeInitiale{%
-            \DTLnewrow{mtdbEEqual}%
-            \itemtomacro\ListeInitiale[\xcnt,1]\x%
-            \DTLnewdbentry{mtdbEEqual}{Val}{\x}%
-            \itemtomacro\ListeInitiale[\xcnt,2]\y%
-            \DTLnewdbentry{mtdbEEqual}{Eff}{\y}%
+          \readlist*\ListeComplete\listEEb%
+          % 
+          \ifthenelse{\equal{\the\PasNumEE}{0}}{\setKV[ClesStat]{Quantitatif}}{\setKV[ClesStat]{Qualitatif}}%
+        }{%
+          \ifboolKV[ClesStat]{Qualitatif}{%
+            %  % on lit la liste \'ecrite sous la forme valeur/effectif
+            \setsepchar[*]{,*/}\ignoreemptyitems%
+            \readlist*\ListeInitiale{#2}%
+            % "liste vide"
+            \newtoks\tabtoksEE%
+            \tabtoksEE{}%
+            \DTLcleardb{mtdbEEqual}%
+            \foreachitem\x\in\ListeInitiale{%
+              \DTLnewrow{mtdbEEqual}%
+              \itemtomacro\ListeInitiale[\xcnt,1]\x%
+              \DTLnewdbentry{mtdbEEqual}{Val}{\x}%
+              \itemtomacro\ListeInitiale[\xcnt,2]\y%
+              \DTLnewdbentry{mtdbEEqual}{Eff}{\y}%
+            }%
+            \DTLforeach{mtdbEEqual}{\Val=Val,\Eff=Eff}{%  
+              \expandafter\AjoutListEEy\Val\nil%
+              \expandafter\AjoutListEEx\Eff\nil%
+            }%
+            \xdef\listEE{\the\tabtoksEE}
+            \ignoreemptyitems%
+            \setsepchar[*]{,*/}%
+            \readlist*\ListeComplete\listEE%
+          }{% Dans le qualitatif, on trie d'abord les valeurs.
+            \setsepchar[*]{,*/}\ignoreemptyitems%
+            \readlist*\ListeInitiale{#2}%
+            % "liste vide"
+            \newtoks\tabtoksEE%
+            \tabtoksEE{}%
+            \DTLcleardb{mtdbEEqual}%
+            \foreachitem\x\in\ListeInitiale{%
+              \DTLnewrow{mtdbEEqual}%
+              \itemtomacro\ListeInitiale[\xcnt,1]\x%
+              \DTLnewdbentry{mtdbEEqual}{Val}{\x}%
+              \itemtomacro\ListeInitiale[\xcnt,2]\y%
+              \DTLnewdbentry{mtdbEEqual}{Eff}{\y}%
+            }%
+            \dtlsort{Val}{mtdbEEqual}{\dtlicompare}%
+            \DTLforeach{mtdbEEqual}{\Val=Val,\Eff=Eff}{%  
+              \expandafter\AjoutListEEy\Val\nil%
+              \expandafter\AjoutListEEx\Eff\nil%
+            }%
+            \xdef\listEE{\the\tabtoksEE}
+            \ignoreemptyitems%
+            \setsepchar[*]{,*/}%
+            \readlist*\ListeComplete\listEE%
+          }}}%
+      % on cr\'ee la base de donn\'ees des valeurs dans le cas qualitatif
+      \DTLcleardb{mtdb}%
+      % on les trie pour la m\'ediane 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\'einitialise les valeurs des crit\`eres 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\'ebut qualitatif
+        % Calculs
+        %  %% celui de la somme des donn\'ees
+        \foreachitem\don\in\ListeComplete{\xdef\SommeDonnees{\fpeval{\SommeDonnees+\ListeComplete[\doncnt,2]}}}%
+        %  %% celui de l'effectif total
+        \ifboolKV[ClesStat]{EffectifTotal}{%
+          \ifboolKV[ClesStat]{Liste}{L'effectif total de la s\'erie est
+            \num{\ListeCompletelen}.\par}{%
+            \foreachitem\don\in\ListeComplete{\xdef\EffectifTotal{\fpeval{\EffectifTotal+\ListeComplete[\doncnt,2]}}}%
+            L'effectif total de la s\'erie est : \[\ListeComplete[1,2]\xintFor* ##1 in
+              {\xintSeq {2}{\ListeCompletelen}}\do{%
+                +\ListeComplete[##1,2]}=\num{\EffectifTotal}\]}
+        }{}%
+        \ifboolKV[ClesStat]{Liste}{\xdef\EffectifTotal{\ListeCompletelen}}{\xdef\EffectifTotal{\SommeDonnees}}%
+        %  %% celui de la moyenne
+        \xdef\Moyenne{\fpeval{\SommeDonnees/\ListeCompletelen}}%	
+        \ifboolKV[ClesStat]{Moyenne}{%
+          \ifboolKV[ClesStat]{Liste}{%
+              \ifboolKV[ClesStat]{Somme}{La somme des donn\'ees de la s\'erie 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]{MoyenneA}{%
+              \ifboolKV[ClesStat]{SET}{}{Le nombre de donn\'ees de la s\'erie est \num{\ListeCompletelen}.\\}%
+                Donc la moyenne de la s\'erie est \'egale \`a :%
+                \[\frac{\num{\SommeDonnees}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}}{\num{\ListeCompletelen}}%\IfInteger{\fpeval{round(\fpeval{\SommeDonnees/\ListeCompletelen},\useKV[ClesStat]{Precision})}}{=}{\approx}
+                  \ifboolKV[ClesStat]{ValeurExacte}{}{%
+                    \opdiv*{\SommeDonnees}{\ListeCompletelen}{resultatmoy}{restemoy}%
+                    \opround{resultatmoy}{\useKV[ClesStat]{Precision}}{resultatmoy1}%
+                    \opcmp{resultatmoy}{resultatmoy1}\ifopeq=\else\approx\fi%
+                    \num{\fpeval{round(\SommeDonnees/\ListeCompletelen,\useKV[ClesStat]{Precision})}}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}%
+                  }%
+                \]%
+              }{}%
+            }{Pas de moyenne possible pour une s\'erie de donn\'ees \`a caract\`ere qualitatif.}}{}%
+        %    %  %% celui de l'\'etendue
+        \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}{%
+          \ifboolKV[ClesStat]{Liste}{%
+            L'\'etendue de la s\'erie est \'egale \`a $\num{\DonneeMax}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}-\num{\DonneeMin}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}=\num{\Etendue}$\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}%
+          }{Pas d'\'etendue possible pour une s\'erie de donn\'ees \`a caract\`ere qualitatif.}}{}%
+        % celui de la mediane
+        %%% Recuperation de la mediane %%%%%%%%%%%%%%%%%%%%% 
+        \newcount\Recapmed%
+        \newcount\Recapmeda%
+        \ifodd\number\ListeCompletelen%odd impair
+        \Recapmed=\fpeval{(\ListeCompletelen+1)/2}\relax%
+        \else%
+        \Recapmed=\fpeval{\ListeCompletelen/2}\relax%
+        \Recapmeda=\numexpr\Recapmed+1\relax%
+        \fi%
+        \newcount\Recapk%
+        \Recapk=0%
+        \DTLforeach{mtdb}{\numeroDonnee=Numeric}{\Recapk=\numexpr\Recapk+1\relax%
+          \ifnum\Recapk=\Recapmed%
+          \ifodd\number\ListeCompletelen%
+          \xdef\Mediane{\numeroDonnee}%
+          \else%
+          \xdef\Mediane{\numeroDonnee}%
+          \fi%
+          \fi%
+          \ifnum\Recapk=\Recapmeda%
+          \xdef\Mediane{\fpeval{(\Mediane+\numeroDonnee)/2}}%
+          \fi%
+        }%
+        %%% 
+        \ifboolKV[ClesStat]{Mediane}{%
+          \ifboolKV[ClesStat]{Liste}{%    
+            On range les donn\'ees 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 de la s\'erie 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 de la s\'erie 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\'ediane vaut \numeroDonnee\fi
+              \ifodd\number\ListeCompletelen%
+              La m\'ediane de la s\'erie est la \the\med\ieme{} donn\'ee.\\Donc la m\'ediane de la s\'erie est \num{\numeroDonnee}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}%
+              \xdef\Mediane{\numeroDonnee}%
+              \else%
+              La \the\med\ieme{} donn\'ee est \num{\numeroDonnee}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}. }{. }\xdef\Mediane{\numeroDonnee}%
+              \fi%
+              \fi%
+              \ifnum\k=\meda
+              La \the\meda\ieme{} donn\'ee est \num{\numeroDonnee}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}\\Donc \PfCArticleMediane{} m\'ediane de la s\'erie est \xdef\Mediane{\fpeval{(\Mediane+\numeroDonnee)/2}}$\ifboolKV[ClesStat]{DetailsMediane}{\dfrac{\num{\Mediane}+\num{\numeroDonnee}}{2}=}{}\num{\Mediane}$\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}%
+              \fi%
+            }%
+            %%%%%%% 
+          }{Pas de m\'ediane possible pour une s\'erie de donn\'ees \`a caract\`ere qualitatif.}}{}
+        %%% Quartile un
+        \newcount\PfCQuartileUn%
+        \modulo{\ListeCompletelen}{4}\relax%
+        \ifnum\remainder=0%
+        \PfCQuartileUn=\fpeval{\ListeCompletelen/4}%
+        \else%
+        \PfCQuartileUn=\fpeval{ceil(\ListeCompletelen/4)}%
+        \fi%
+        \newcount\PfCQunk%
+        \PfCQunk=0%
+        \DTLforeach{mtdb}{\numeroDonnee=Numeric}{\PfCQunk=\numexpr\PfCQunk+1\relax%
+          \ifnum\PfCQunk=\PfCQuartileUn%
+          \xdef\QuartileUn{\numeroDonnee}%
+          \fi%
+        }%
+        %%% Quartile trois
+        \newcount\PfCQuartileTrois%
+        \modulo{\ListeCompletelen}{4}\relax%
+        \ifnum\remainder=0%
+        \PfCQuartileTrois=\fpeval{3*\ListeCompletelen/4}%
+        \else%
+        \PfCQuartileTrois=\fpeval{ceil(3*\ListeCompletelen/4)}%
+        \fi%
+        \newcount\PfCQtroisk%
+        \PfCQtroisk=0%
+        \DTLforeach{mtdb}{\numeroDonnee=Numeric}{\PfCQtroisk=\numexpr\PfCQtroisk+1\relax%
+          \ifnum\PfCQtroisk=\PfCQuartileTrois%La m\'ediane vaut \numeroDonnee\fi
+          \xdef\QuartileTrois{\numeroDonnee}%
+          \fi%
+        }%
+        % Construction du tableau
+        \ifboolKV[ClesStat]{Tableau}{%
+          \ifboolKV[ClesStat]{Liste}{Pas de tableau possible avec la cl\'e Liste.\\Utilisez plut\^ot la cl\'e Sondage si vous voulez un tableau avec cette liste.}{\BuildtabStat}}{}%
+        % Construction du graphique
+        \ifboolKV[ClesStat]{Graphique}{%
+          \ifboolKV[ClesStat]{Liste}{Pas de graphique possible avec la cl\'e Liste.\\Utilisez plut\^ot la cl\'e Sondage si vous voulez un graphique avec cette liste.}{%
+            \ifboolKV[ClesStat]{Barre}{%
+              \buildgraphbarhor%
+            }{%
+              \ifboolKV[ClesStat]{Angle}{%
+                \buildgraphcq{360}%
+              }{%
+                \ifboolKV[ClesStat]{SemiAngle}{%
+                  \buildgraphcq{180}%
+                }{%
+                  \buildgraphq[#1]%
+                }%
+              }%
+            }%
           }%
-          \dtlsort{Val}{mtdbEEqual}{\dtlicompare}%
-          \DTLforeach{mtdbEEqual}{\Val=Val,\Eff=Eff}{%  
-            \expandafter\AjoutListEEy\Val\nil%
-            \expandafter\AjoutListEEx\Eff\nil%
-          }%
-          \xdef\listEE{\the\tabtoksEE}
-          \ignoreemptyitems%
-          \setsepchar[*]{,*/}%
-          \readlist*\ListeComplete\listEE%
-        }}}%
-    % on cr\'ee la base de donn\'ees des valeurs dans le cas qualitatif
-    \DTLcleardb{mtdb}%
-    % on les trie pour la m\'ediane 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\'einitialise les valeurs des crit\`eres 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\'ebut qualitatif
-      % Calculs
-      %  %% celui de la somme des donn\'ees
-      \foreachitem\don\in\ListeComplete{\xdef\SommeDonnees{\fpeval{\SommeDonnees+\ListeComplete[\doncnt,2]}}}%
-      %  %% celui de l'effectif total
-      \ifboolKV[ClesStat]{EffectifTotal}{%
-        \ifboolKV[ClesStat]{Liste}{L'effectif total de la s\'erie est
-          \num{\ListeCompletelen}.\par}{%
-          \foreachitem\don\in\ListeComplete{\xdef\EffectifTotal{\fpeval{\EffectifTotal+\ListeComplete[\doncnt,2]}}}%
+        }{}%
+      }{%%%%%%%%%%%%%%%%%%%%%D\'ebut quantitatif
+        %  % on effectue les calculs
+        %  %% celui de la somme des donn\'ees
+        \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'\'etendue
+        \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 de la s\'erie est : \[\ListeComplete[1,2]\xintFor* ##1 in
             {\xintSeq {2}{\ListeCompletelen}}\do{%
-              +\ListeComplete[##1,2]}=\num{\EffectifTotal}\]}
-      }{}%
-      \ifboolKV[ClesStat]{Liste}{\xdef\EffectifTotal{\ListeCompletelen}}{\xdef\EffectifTotal{\SommeDonnees}}%
-      %  %% celui de la moyenne
-      \xdef\Moyenne{\fpeval{\SommeDonnees/\ListeCompletelen}}%	
-      \ifboolKV[ClesStat]{Moyenne}{%
-        \ifboolKV[ClesStat]{Liste}{%
-          La somme des donn\'ees de la s\'erie est :%
+              +\ListeComplete[##1,2]}=\num{\EffectifTotal}\]
+        }{}%
+        \ifboolKV[ClesStat]{Moyenne}{%
+            \ifboolKV[ClesStat]{Somme}{La somme des donn\'ees de la s\'erie 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}}}{}%
-            \]}{%
+              \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}}}{}
+            \]
+          }{%
             \[
-              \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}}}{}%
-            \]%
+              \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}{}{Le nombre de donn\'ees de la s\'erie est \num{\ListeCompletelen}.\\}%
+          }{}%
+          \ifboolKV[ClesStat]{MoyenneA}{\ifboolKV[ClesStat]{SET}{}{L'effectif total de la s\'erie 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 de la s\'erie est \'egale \`a :%
-          \[\frac{\num{\SommeDonnees}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}}{\num{\ListeCompletelen}}%\IfInteger{\fpeval{round(\fpeval{\SommeDonnees/\ListeCompletelen},\useKV[ClesStat]{Precision})}}{=}{\approx}
+          \[\frac{\num{\SommeDonnees}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}}{\num{\EffectifTotal}}%
             \ifboolKV[ClesStat]{ValeurExacte}{}{%
-              \opdiv*{\SommeDonnees}{\ListeCompletelen}{resultatmoy}{restemoy}%
+              \opdiv*{\SommeDonnees}{\EffectifTotal}{resultatmoy}{restemoy}%
               \opround{resultatmoy}{\useKV[ClesStat]{Precision}}{resultatmoy1}%
               \opcmp{resultatmoy}{resultatmoy1}\ifopeq=\else\approx\fi%
-              \num{\fpeval{round(\SommeDonnees/\ListeCompletelen,\useKV[ClesStat]{Precision})}}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}%
+              \num{\fpeval{round(\SommeDonnees/\EffectifTotal,\useKV[ClesStat]{Precision})}}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}%
             }%
           \]%
-        }{Pas de moyenne possible pour une s\'erie de donn\'ees \`a caract\`ere qualitatif.}}{}%
-      %    %  %% celui de l'\'etendue
-      \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}{%
-        \ifboolKV[ClesStat]{Liste}{%
-          L'\'etendue de la s\'erie est \'egale \`a $\num{\DonneeMax}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}-\num{\DonneeMin}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}=\num{\Etendue}$\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}%
-        }{Pas d'\'etendue possible pour une s\'erie de donn\'ees \`a caract\`ere qualitatif.}}{}%
-      % celui de la mediane
-      %%% Recuperation de la mediane %%%%%%%%%%%%%%%%%%%%% 
-      \newcount\Recapmed%
-      \newcount\Recapmeda%
-      \ifodd\number\ListeCompletelen%odd impair
-      \Recapmed=\fpeval{(\ListeCompletelen+1)/2}\relax%
-      \else%
-      \Recapmed=\fpeval{\ListeCompletelen/2}\relax%
-      \Recapmeda=\numexpr\Recapmed+1\relax%
-      \fi%
-      \newcount\Recapk%
-      \Recapk=0%
-      \DTLforeach{mtdb}{\numeroDonnee=Numeric}{\Recapk=\numexpr\Recapk+1\relax%
-        \ifnum\Recapk=\Recapmed%
-        \ifodd\number\ListeCompletelen%
-        \xdef\Mediane{\numeroDonnee}%
-        \else%
-        \xdef\Mediane{\numeroDonnee}%
+        %  % Affichage des r\'eponses.
+        %  %% pour l'\'etendue
+        \ifboolKV[ClesStat]{Etendue}{L'\'etendue de la s\'erie est \'egale \`a $\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\'ediane
+        %%% Recuperation Mediane
+        \newcount\Recupmed%
+        \newcount\Recupmeda%
+        \ifodd\number\EffectifTotal%odd impair
+        \Recupmed=\fpeval{(\EffectifTotal+1)/2}\relax%
+        \else% pair
+        \Recupmed=\fpeval{\EffectifTotal/2}\relax%
+        \Recupmeda=\numexpr\Recupmed+1\relax%
         \fi%
-        \fi%
-        \ifnum\Recapk=\Recapmeda%
-        \xdef\Mediane{\fpeval{(\Mediane+\numeroDonnee)/2}}%
-        \fi%
-      }%
-      %%% 
-      \ifboolKV[ClesStat]{Mediane}{%
-        \ifboolKV[ClesStat]{Liste}{%    
-          On range les donn\'ees 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\Recupk%
+        \Recupk=0%
+        \xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{%
+          \xintFor* ##2 in {\xintSeq {1}{\ListeComplete[##1,2]}}\do{%
+            \Recupk=\numexpr\Recupk+1\relax%
+            \ifnum\Recupk=\Recupmed%
+            \ifodd\number\EffectifTotal%
+            \xdef\Mediane{\ListeComplete[##1,1]}%
+            \else%
+            \xdef\Mediane{\ListeComplete[##1,1]}%
+            \fi%
+            \fi%
+            \ifnum\Recupk=\Recupmeda%
+            \xdef\Mediane{\fpeval{(\Mediane+\ListeComplete[##1,1])/2}}%
+            \fi%
           }%
+        }%
+        %%% 
+        \ifboolKV[ClesStat]{Mediane}{%
+          
           \newcount\med%
           \newcount\meda%
-          \ifodd\number\ListeCompletelen%odd impair
-          \med=\fpeval{(\ListeCompletelen+1)/2}\relax%
-          L'effectif total de la s\'erie est \num{\ListeCompletelen}. Or, $\num{\ListeCompletelen}=\num{\fpeval{\med-1}}+1+\num{\fpeval{\med-1}}$.\\
+          \ifodd\number\EffectifTotal%odd impair
+          \med=\fpeval{(\EffectifTotal+1)/2}\relax%
+          L'effectif total de la s\'erie est \num{\EffectifTotal}. Or, $\num{\EffectifTotal}=\num{\fpeval{\med-1}}+1+\num{\fpeval{\med-1}}$. %
           \else% pair
-          \med=\fpeval{\ListeCompletelen/2}\relax%
+          \med=\fpeval{\EffectifTotal/2}\relax%
           \meda=\numexpr\med+1\relax%
-          L'effectif total de la s\'erie est \num{\ListeCompletelen}. Or, $\num{\ListeCompletelen}=\num{\the\med}+\num{\the\med}$.\\
+          L'effectif total de la s\'erie est \num{\EffectifTotal}. Or, $\num{\EffectifTotal}=\num{\fpeval{\med}}+\num{\fpeval{\med}}$. %
           \fi%
           \newcount\k%
           \k=0%
-          \DTLforeach{mtdb}{\numeroDonnee=Numeric}{\k=\numexpr\k+1\relax%
-            \ifnum\k=\med %La m\'ediane vaut \numeroDonnee\fi
-            \ifodd\number\ListeCompletelen%
-            La m\'ediane de la s\'erie est la \the\med\ieme{} donn\'ee.\\Donc la m\'ediane de la s\'erie est \num{\numeroDonnee}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}%
-            \xdef\Mediane{\numeroDonnee}%
-            \else%
-            La \the\med\ieme{} donn\'ee est \num{\numeroDonnee}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}. }{. }\xdef\Mediane{\numeroDonnee}%
-            \fi%
-            \fi%
-            \ifnum\k=\meda
-            La \the\meda\ieme{} donn\'ee est \num{\numeroDonnee}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.} Donc la m\'ediane de la s\'erie est \xdef\Mediane{\fpeval{(\Mediane+\numeroDonnee)/2}}\num{\Mediane}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}%
-            \fi%
+          \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\'ediane de la s\'erie est la \the\med\ieme{} donn\'ee. Donc la m\'ediane de la s\'erie est \num{\ListeComplete[##1,1]}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}%
+              \else%
+              La \the\med\ieme{} donn\'ee 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{} donn\'ee est \num{\ListeComplete[##1,1]}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}\\Donc \PfCArticleMediane{} m\'ediane de la s\'erie est $\ifboolKV[ClesStat]{DetailsMediane}{\dfrac{\num{\Mediane}+\num{\ListeComplete[##1,1]}}2=}{}\xdef\Mediane{\fpeval{(\Mediane+\ListeComplete[##1,1])/2}}\num{\Mediane}$\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}%
+              \fi%
+            }%
           }%
-          %%%%%%% 
-        }{Pas de m\'ediane possible pour une s\'erie de donn\'ees \`a caract\`ere qualitatif.}}{}
-      %%% Quartile un
-      \newcount\PfCQuartileUn%
-      \modulo{\ListeCompletelen}{4}\relax%
-      \ifnum\remainder=0%
-      \PfCQuartileUn=\fpeval{\ListeCompletelen/4}%
-      \else%
-      \PfCQuartileUn=\fpeval{ceil(\ListeCompletelen/4)}%
-      \fi%
-      \newcount\PfCQunk%
-      \PfCQunk=0%
-      \DTLforeach{mtdb}{\numeroDonnee=Numeric}{\PfCQunk=\numexpr\PfCQunk+1\relax%
-        \ifnum\PfCQunk=\PfCQuartileUn%
-        \xdef\QuartileUn{\numeroDonnee}%
+        }{}%
+        %%% Quartile un
+        \newcount\PfCQuartileUn%
+        \modulo{\EffectifTotal}{4}\relax%
+        \ifnum\remainder=0%
+        \PfCQuartileUn=\fpeval{\EffectifTotal/4}%
+        \else%
+        \PfCQuartileUn=\fpeval{ceil(\EffectifTotal/4)}%
         \fi%
-      }%
-      %%% Quartile trois
-      \newcount\PfCQuartileTrois%
-      \modulo{\ListeCompletelen}{4}\relax%
-      \ifnum\remainder=0%
-      \PfCQuartileTrois=\fpeval{3*\ListeCompletelen/4}%
-      \else%
-      \PfCQuartileTrois=\fpeval{ceil(3*\ListeCompletelen/4)}%
-      \fi%
-      \newcount\PfCQtroisk%
-      \PfCQtroisk=0%
-      \DTLforeach{mtdb}{\numeroDonnee=Numeric}{\PfCQtroisk=\numexpr\PfCQtroisk+1\relax%
-        \ifnum\PfCQtroisk=\PfCQuartileTrois%La m\'ediane vaut \numeroDonnee\fi
-        \xdef\QuartileTrois{\numeroDonnee}%
-        \fi%
-      }%
-      % Construction du tableau
-      \ifboolKV[ClesStat]{Tableau}{%
-        \ifboolKV[ClesStat]{Liste}{Pas de tableau possible avec la cl\'e Liste.\\Utilisez plut\^ot la cl\'e Sondage si vous voulez un tableau avec cette liste.}{\BuildtabStat}}{}%
-      % Construction du graphique
-      \ifboolKV[ClesStat]{Graphique}{%
-        \ifboolKV[ClesStat]{Liste}{Pas de graphique possible avec la cl\'e Liste.\\Utilisez plut\^ot la cl\'e Sondage si vous voulez un graphique avec cette liste.}{%
-          \ifboolKV[ClesStat]{Barre}{%
-            \buildgraphbarhor%
-          }{\ifboolKV[ClesStat]{Angle}{\buildgraphcq{360}}{\ifboolKV[ClesStat]{SemiAngle}{\buildgraphcq{180}}{\buildgraphq[#1]}}}%
-        }}{}%
-    }{%%%%%%%%%%%%%%%%%%%%%D\'ebut quantitatif
-      %  % on effectue les calculs
-      %  %% celui de la somme des donn\'ees
-      \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'\'etendue
-      \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 de la s\'erie est : \[\ListeComplete[1,2]\xintFor* ##1 in
-          {\xintSeq {2}{\ListeCompletelen}}\do{%
-            +\ListeComplete[##1,2]}=\num{\EffectifTotal}\]
-      }{}%
-      \ifboolKV[ClesStat]{Moyenne}{%
-        La somme des donn\'ees de la s\'erie 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 de la s\'erie est :%
-          \ifboolKV[ClesStat]{Liste}{ \num{\EffectifTotal}\\}{%
-            \[\num{\ListeComplete[1,2]}\xintFor* ##1 in {\xintSeq {2}{\ListeCompletelen}}\do{%
-                +\num{\ListeComplete[##1,2]}
-              }=\num{\EffectifTotal}
-            \]%
+        \newcount\PfCQunk%
+        \PfCQunk=0%
+        \xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{%
+          \xintFor* ##2 in {\xintSeq {1}{\ListeComplete[##1,2]}}\do{%
+            \PfCQunk=\numexpr\PfCQunk+1\relax%
+            \ifnum\PfCQunk=\PfCQuartileUn%
+            \xdef\QuartileUn{\ListeComplete[##1,1]}%
+            \fi%
           }%
         }%
-        Donc la moyenne de la s\'erie est \'egale \`a :%
-        \[\frac{\num{\SommeDonnees}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}}{\num{\EffectifTotal}}%
-          \ifboolKV[ClesStat]{ValeurExacte}{}{%
-            \opdiv*{\SommeDonnees}{\EffectifTotal}{resultatmoy}{restemoy}%
-            \opround{resultatmoy}{\useKV[ClesStat]{Precision}}{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\'eponses.
-      %  %% pour l'\'etendue
-      \ifboolKV[ClesStat]{Etendue}{L'\'etendue de la s\'erie est \'egale \`a $\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\'ediane
-      %%% Recuperation Mediane
-      \newcount\Recupmed%
-      \newcount\Recupmeda%
-      \ifodd\number\EffectifTotal%odd impair
-      \Recupmed=\fpeval{(\EffectifTotal+1)/2}\relax%
-      \else% pair
-      \Recupmed=\fpeval{\EffectifTotal/2}\relax%
-      \Recupmeda=\numexpr\Recupmed+1\relax%
-      \fi%
-      \newcount\Recupk%
-      \Recupk=0%
-      \xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{%
-        \xintFor* ##2 in {\xintSeq {1}{\ListeComplete[##1,2]}}\do{%
-          \Recupk=\numexpr\Recupk+1\relax%
-          \ifnum\Recupk=\Recupmed%
-          \ifodd\number\EffectifTotal%
-          \xdef\Mediane{\ListeComplete[##1,1]}%
-          \else%
-          \xdef\Mediane{\ListeComplete[##1,1]}%
-          \fi%
-          \fi%
-          \ifnum\Recupk=\Recupmeda%
-          \xdef\Mediane{\fpeval{(\Mediane+\ListeComplete[##1,1])/2}}%
-          \fi%
-        }%
-      }%
-      %%% 
-      \ifboolKV[ClesStat]{Mediane}{%
-        
-        \newcount\med%
-        \newcount\meda%
-        \ifodd\number\EffectifTotal%odd impair
-        \med=\fpeval{(\EffectifTotal+1)/2}\relax%
-        L'effectif total de la s\'erie 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 de la s\'erie est \num{\EffectifTotal}. Or, $\num{\EffectifTotal}=\num{\fpeval{\med}}+\num{\fpeval{\med}}$. %
+        %%% Quartile trois
+        \newcount\PfCQuartileTrois%
+        \modulo{\EffectifTotal}{4}\relax%
+        \ifnum\remainder=0%
+        \PfCQuartileTrois=\fpeval{3*\EffectifTotal/4}%
+        \else%
+        \PfCQuartileTrois=\fpeval{ceil(3*\EffectifTotal/4)}%
         \fi%
-        \newcount\k%
-        \k=0%
+        \newcount\PfCQtroisk%
+        \PfCQtroisk=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\'ediane de la s\'erie est la \the\med\ieme{} donn\'ee. Donc la m\'ediane de la s\'erie est \num{\ListeComplete[##1,1]}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}%
-            \else%
-            La \the\med\ieme{} donn\'ee est \num{\ListeComplete[##1,1]}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}. }{. }\xdef\Mediane{\ListeComplete[##1,1]}%
+            \PfCQtroisk=\numexpr\PfCQtroisk+1\relax%
+            \ifnum\PfCQtroisk=\PfCQuartileTrois%
+            \xdef\QuartileTrois{\ListeComplete[##1,1]}%
             \fi%
-            \fi%
-            \ifnum\k=\meda%
-            La \the\meda\ieme{} donn\'ee est \num{\ListeComplete[##1,1]}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}\\Donc la m\'ediane de la s\'erie est \xdef\Mediane{\fpeval{(\Mediane+\ListeComplete[##1,1])/2}}\num{\Mediane}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}%
-            \fi%
           }%
         }%
-      }{}%
-      %%% Quartile un
-      \newcount\PfCQuartileUn%
-      \modulo{\EffectifTotal}{4}\relax%
-      \ifnum\remainder=0%
-      \PfCQuartileUn=\fpeval{\EffectifTotal/4}%
-      \else%
-      \PfCQuartileUn=\fpeval{ceil(\EffectifTotal/4)}%
-      \fi%
-      \newcount\PfCQunk%
-      \PfCQunk=0%
-      \xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{%
-        \xintFor* ##2 in {\xintSeq {1}{\ListeComplete[##1,2]}}\do{%
-          \PfCQunk=\numexpr\PfCQunk+1\relax%
-          \ifnum\PfCQunk=\PfCQuartileUn%
-          \xdef\QuartileUn{\ListeComplete[##1,1]}%
-          \fi%
-        }%
+        % Construction de tableau
+        \ifboolKV[ClesStat]{Tableau}{\BuildtabStat}{}%
+        % Construction du graphique ??
+        \ifboolKV[ClesStat]{Graphique}{%
+          \ifboolKV[ClesStat]{Angle}{%
+            \buildgraphcq{360}%
+          }{%
+            \ifboolKV[ClesStat]{SemiAngle}{%
+              \buildgraphcq{180}%
+            }{%
+              \buildgraph[#1]%
+            }%
+          }%
+        }{}%
       }%
-      %%% Quartile trois
-      \newcount\PfCQuartileTrois%
-      \modulo{\EffectifTotal}{4}\relax%
-      \ifnum\remainder=0%
-      \PfCQuartileTrois=\fpeval{3*\EffectifTotal/4}%
-      \else%
-      \PfCQuartileTrois=\fpeval{ceil(3*\EffectifTotal/4)}%
-      \fi%
-      \newcount\PfCQtroisk%
-      \PfCQtroisk=0%
-      \xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{%
-        \xintFor* ##2 in {\xintSeq {1}{\ListeComplete[##1,2]}}\do{%
-          \PfCQtroisk=\numexpr\PfCQtroisk+1\relax%
-          \ifnum\PfCQtroisk=\PfCQuartileTrois%
-          \xdef\QuartileTrois{\ListeComplete[##1,1]}%
-          \fi%
-        }%
-      }%
-      % Construction de tableau
-      \ifboolKV[ClesStat]{Tableau}{\BuildtabStat}{}%
-      % Construction du graphique ??
-      \ifboolKV[ClesStat]{Graphique}{%
-        \ifboolKV[ClesStat]{Angle}{\buildgraphcq{360}}{\ifboolKV[ClesStat]{SemiAngle}{\buildgraphcq{180}}{\buildgraph[#1]}}
-      }{}%
     }%
   }%
 }%
\ No newline at end of file

Added: trunk/Master/texmf-dist/tex/latex/profcollege/PfCStatistiquesold.tex
===================================================================
--- trunk/Master/texmf-dist/tex/latex/profcollege/PfCStatistiquesold.tex	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/profcollege/PfCStatistiquesold.tex	2023-07-04 19:53:24 UTC (rev 67545)
@@ -0,0 +1,2106 @@
+%%%
+% Statistiques
+%%%
+\newcommand\NbDonnees{}%
+\newcommand\SommeDonnees{}%
+\newcommand\EffectifTotal{}%
+\newcommand\Moyenne{}%
+\newcommand\Etendue{}%
+\newcommand\Mediane{}%
+\newcommand\DonneeMax{}%
+\newcommand\DonneeMin{}%
+\newcommand\EffectifMax{}%
+
+\setKVdefault[ClesStat]{ColVide=0,CaseVide=false,EffVide=false,%
+FreqVide=false,AngVide=false,ECCVide=false,TotalVide=false,Sondage=false,Liste=false,%
+Tableau=false,Stretch=1,Frequence=false,EffectifTotal=false,%
+Etendue=false,Moyenne=false,SET=false,ValeurExacte=false,Mediane=false,QuartileUn=false,QuartileTrois=false,Total=false,Concret=false,%
+Unite={},Largeur=1cm,Precision=2,PrecisionF=0,Donnee=Valeurs,Effectif=Effectif,Grille=false,Origine=0,Angle=false,SemiAngle=false,Qualitatif=false,Classes=false,TableauVide=false,ECC=false,Coupure=10,CouleurTab=gray!15,Graphique=false,Batons=true,%
+% Pour les diags batons
+EpaisseurBatons=1,ListeCouleursB={a},Lecture=false,LectureFine=false,AideLecture=false,Reponses=false,DonneesSup=false,AbscisseRotation=false,Tiret=false,AngleRotationAbscisse=0,Pasx=1,Pasy=1,Unitex=0.5,Unitey=0.5,Depart=0,CouleurDefaut=black,Date=false,GrandNombrey=false,GrandNombrex=false,%
+% Pour les diags circulaires
+Rayon=3cm,AffichageAngle=false,AffichageDonnee=false,ListeCouleurs={white},Hachures=false,LectureInverse=false,EcartHachures=0.25,EpaisseurHachures=1,Legende,LegendeVide=false,ACompleter=false,%
+%Pour les représentations
+Representation=false,%
+%Pour les barres horizontales
+Barre=false,Longueur=10cm,Hauteur=5mm,Bicolore=false,EcartBarre=0,%Grille est dispo
+% Pour les histogrammes
+Histogramme=false,UniteAire=1,MemeAmpli,DepartHisto=1%
+}%
+%compl\'ements
+\defKV[ClesStat]{AngleRotationAbscisse=\setKV[ClesStat]{AbscisseRotation}}%
+\defKV[ClesStat]{AffichageDonnees=\setKV[ClesStat]{AffichageAngle=false}\setKV[ClesStat]{AffichageDonnee}}%
+\defKV[ClesStat]{CasesVides=\setKV[ClesStat]{CaseVide}}%
+\defKV[ClesStat]{LegendesVides=\setKV[ClesStat]{LegendeVide}}%
+\defKV[ClesStat]{GrandNombreO=\setKV[ClesStat]{GrandNombrey}}%
+\defKV[ClesStat]{GrandNombreA=\setKV[ClesStat]{GrandNombrex}}%
+% 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{\ifboolKV[ClesStat]{Qualitatif}{&#1}{&\num{#1}}}\addtotok\tabtoksb{&\num{#2}}}%
+%
+\newcounter{PfCCompteLignes}%
+%
+\def\BuildtabStat{% %%Tableau sans/avec total
+  \setcounter{PfCCompteLignes}{0}%
+  \tabtoksa{\useKV[ClesStat]{Donnee}}\tabtoksb{\useKV[ClesStat]{Effectif}}%
+  \foreachitem\compteur\in\ListeComplete{\expandafter\updatetoks\compteur\nil}%
+  \renewcommand{\arraystretch}{\useKV[ClesStat]{Stretch}}%
+  \ifboolKV[ClesStat]{Total}{%
+    \begin{NiceTabular}{c*{\fpeval{\ListeCompletelen+1}}{>{\centering\arraybackslash}p{\useKV[ClesStat]{Largeur}}}}%
+      \CodeBefore%
+      \rowcolor{\useKV[ClesStat]{CouleurTab}}{1}%
+      \columncolor{\useKV[ClesStat]{CouleurTab}}{1}%
+      \Body%
+      \the\tabtoksa&Total\\%
+      \ifboolKV[ClesStat]{EffVide}{\useKV[ClesStat]{Effectif}\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&}}{\the\tabtoksb&\num{\EffectifTotal}}\\%
+      \ifboolKV[ClesStat]{Frequence}{\stepcounter{PfCCompteLignes}Fr\'equence (\%)\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{\num{\CalculFrequence{##1}}}}}&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{100}}\\}{}%
+      \ifboolKV[ClesStat]{Angle}{\stepcounter{PfCCompteLignes}Angle (\si{\degree})\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculAngle{##1}}}}&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{360}}\\}{}%
+      \ifboolKV[ClesStat]{SemiAngle}{\stepcounter{PfCCompteLignes}Angle (\si{\degree})\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculSemiAngle{##1}}}}&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{180}}\\}{}%
+      \ifboolKV[ClesStat]{ECC}{\stepcounter{PfCCompteLignes}E.C.C.\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{ECCVide}{}{\CalculECC{##1}}}}&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{ECCVide}{}{\num{\EffectifTotal}}}\\}{}%
+      \CodeAfter%
+      % On crée la liste des colonnes à vider
+      \xintifboolexpr{\useKV[ClesStat]{ColVide}>0}{%
+        \xdef\FooStat{\useKV[ClesStat]{ColVide}}%
+        \setsepchar{,}%
+        \readlist*\ListeColonnesAVider{\FooStat}%
+        \foreachitem\compteur\in\ListeColonnesAVider{%
+          \tikz\fill[white] (row-2-|col-\fpeval{\compteur+1}) rectangle (last-|col-\fpeval{\compteur+2});%
+        }%
+      }{}%
+      % On crée la liste des cases à vider
+      \ifboolKV[ClesStat]{CaseVide}{%
+        \xdef\FooStatCases{\useKV[ClesStat]{CasesVides}}%
+        \setsepchar[*]{,*/}%
+        \readlist*\ListeCasesAVider{\FooStatCases}%
+        \foreachitem\compteur\in\ListeCasesAVider{%
+          \tikz\fill[white] (row-\fpeval{\ListeCasesAVider[\compteurcnt,1]+1}-|col-\fpeval{\ListeCasesAVider[\compteurcnt,2]+1}) rectangle (row-\fpeval{\ListeCasesAVider[\compteurcnt,1]+2}-|col-\fpeval{\ListeCasesAVider[\compteurcnt,2]+2});%
+        }%
+      }{}%
+      % On retrace le tableau
+      %Les colonnes
+      \xintFor* ##1 in {\xintSeq{1}{\fpeval{\ListeCompletelen+3}}}\do{%
+        \tikz\draw (row-1-|col-##1) -- (last-|col-##1);%
+      }%
+      % Les lignes
+      \xintFor* ##1 in {\xintSeq{1}{\fpeval{\thePfCCompteLignes+3}}}\do{%
+        \tikz\draw (row-##1-|col-1) -- (row-##1-|last);%
+      }%
+    \end{NiceTabular}%
+  }{%
+    \begin{NiceTabular}{c*{\fpeval{\ListeCompletelen}}{>{\centering\arraybackslash}p{\useKV[ClesStat]{Largeur}}}}%
+      \CodeBefore%
+      \rowcolor{\useKV[ClesStat]{CouleurTab}}{1}%
+      \columncolor{\useKV[ClesStat]{CouleurTab}}{1}%
+      \Body%
+      \the\tabtoksa\\%
+      \ifboolKV[ClesStat]{EffVide}{\useKV[ClesStat]{Effectif}\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&}}{\the\tabtoksb}\\%
+      \ifboolKV[ClesStat]{Frequence}{\stepcounter{PfCCompteLignes}Fr\'equence (\%)\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{\num{\CalculFrequence{##1}}}}}\\}{}%
+      \ifboolKV[ClesStat]{Angle}{\stepcounter{PfCCompteLignes}Angle (\si{\degree})\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculAngle{##1}}}}\\}{}%
+      \ifboolKV[ClesStat]{SemiAngle}{\stepcounter{PfCCompteLignes}Angle (\si{\degree})\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculSemiAngle{##1}}}}\\}{}%
+      \ifboolKV[ClesStat]{ECC}{\stepcounter{PfCCompteLignes}E.C.C.\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{ECCVide}{}{\CalculECC{##1}}}}\\}{}%
+      \CodeAfter%
+      % On crée la liste des colonnes à vider
+      \xintifboolexpr{\useKV[ClesStat]{ColVide}>0}{%
+        \xdef\FooStat{\useKV[ClesStat]{ColVide}}%
+        \setsepchar{,}%
+        \readlist*\ListeColonnesAVider{\FooStat}%
+        \foreachitem\compteur\in\ListeColonnesAVider{%
+          \tikz\fill[white] (row-2-|col-\fpeval{\compteur+1}) rectangle (last-|col-\fpeval{\compteur+2});%
+        }%
+      }{}%
+      % On crée la liste des cases à vider
+      \ifboolKV[ClesStat]{CaseVide}{%
+        \xdef\FooStatCases{\useKV[ClesStat]{CasesVides}}%
+        \setsepchar[*]{,*/}%
+        \readlist*\ListeCasesAVider{\FooStatCases}%
+        \foreachitem\compteur\in\ListeCasesAVider{%
+          \tikz\fill[white] (row-\fpeval{\ListeCasesAVider[\compteurcnt,1]+1}-|col-\fpeval{\ListeCasesAVider[\compteurcnt,2]+1}) rectangle (row-\fpeval{\ListeCasesAVider[\compteurcnt,1]+2}-|col-\fpeval{\ListeCasesAVider[\compteurcnt,2]+2});%
+        }%
+      }{}%
+      % On retrace le tableau
+      %Les colonnes
+      \xintFor* ##1 in {\xintSeq{1}{\fpeval{\ListeCompletelen+2}}}\do{%
+        \tikz\draw (row-1-|col-##1) -- (last-|col-##1);%
+      }%
+      % Les lignes
+      \xintFor* ##1 in {\xintSeq{1}{\fpeval{\thePfCCompteLignes+3}}}\do{%
+        \tikz\draw (row-##1-|col-1) -- (row-##1-|last);%
+      }%
+    \end{NiceTabular}%
+  }%
+}%
+
+% Pour construire le diagramme en barres horizontales
+\def\UpdatetoksHor#1/#2/#3\nil{\addtotok\toklistenomhor{"#1",}\addtotok\toklistedonhor{#3,}\addtotok\toklisteaffhor{"#2",}}%
+
+\newcommand\buildgraphbarhor{%
+  \newtoks\toklistenomhor%
+  \newtoks\toklistedonhor%
+  \newtoks\toklisteaffhor%
+  \newtoks\toklistecouleur%
+  \xdef\PfCfooStat{}%
+  \xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{%
+    \xdef\PfCfooStat{\PfCfooStat \ListeComplete[##1,2],}%
+  }%
+  \xdef\DivMax{\fpeval{max(\PfCfooStat)}}%
+  \xdef\ExposantDivMax{\fpeval{round(ln(\DivMax)/ln(10))}}%
+  \xdef\DivMax{\fpeval{10**\ExposantDivMax}}%
+  \xdef\PfCfooStat{}%
+  \xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{%
+    \xdef\PfCfooStat{\PfCfooStat \ListeComplete[##1,1]/\ListeComplete[##1,2]/\fpeval{\ListeComplete[##1,2]/\DivMax},}%
+  }%
+  \readlist*\ListeCompleteDiagHor{\PfCfooStat}%
+  \foreachitem\compteur\in\ListeCompleteDiagHor{\expandafter\UpdatetoksHor\compteur\nil}%
+  \xdef\ListeAvantCouleurs{\useKV[ClesStat]{ListeCouleurs}}%
+  \readlist*\ListeCouleur{\ListeAvantCouleurs}%
+  \foreachitem\couleur\in\ListeCouleur{\expandafter\UpdateCoul\couleur\nil}%
+  \NewMPDiagBarreHor{\the\toklistenomhor}{\the\toklistedonhor}{\the\toklisteaffhor}{\the\toklistecouleur}%
+}%
+
+% Pour construire le diagramme en bâtons
+\def\Updatetoks#1/#2\nil{\addtotok\toklistepoint{(#1,#2),}}%
+\newcommand\buildgraph[1][]{%
+  \newtoks\toklistepoint\toklistepoint{}%
+  \newtoks\toklistecouleur\toklistecouleur{}%
+  \newtoks\toklistelegende\toklistelegende{}%
+  \ifboolKV[ClesStat]{LegendeVide}{%
+    \xdef\foo{\useKV[ClesStat]{LegendesVides}}%
+    \readlist*\ListeLegendesAEffacer{\foo}%
+  }{\xdef\foo{-1}\readlist*\ListeLegendesAEffacer{\foo}%
+  }%
+  \foreachitem\compteur\in\ListeLegendesAEffacer{\expandafter\UpdateLegende\compteur\nil}%
+  \foreachitem\compteur\in\ListeComplete{\expandafter\Updatetoks\compteur\nil}%
+  \xdef\ListeAvantCouleurs{\useKV[ClesStat]{ListeCouleursB}}%
+  \readlist*\ListeCouleur{\ListeAvantCouleurs}%
+  \foreachitem\couleur\in\ListeCouleur{\expandafter\UpdateCoul\couleur\nil}%
+  \MPStatNew{\the\toklistepoint}{\the\toklistecouleur}{\the\toklistelegende}
+}%
+
+% Pour construire le diagramme en bâtons qualitatif
+\def\Updatetoksq#1/#2\nil{\addtotok\toklistepointq{"#1",#2,}}%
+\newcommand\buildgraphq[1][]{%
+  \newtoks\toklistepointq\toklistepointq{}%
+  \newtoks\toklistecouleur\toklistecouleur{}%
+  \newtoks\toklistelegende\toklistelegende{}%
+  \ifboolKV[ClesStat]{LegendeVide}{%
+    \xdef\foo{\useKV[ClesStat]{LegendesVides}}%
+    \readlist*\ListeLegendesAEffacer{\foo}%
+  }{\xdef\foo{-1}\readlist*\ListeLegendesAEffacer{\foo}%
+  }%
+  \foreachitem\compteur\in\ListeLegendesAEffacer{\expandafter\UpdateLegende\compteur\nil}%
+  \foreachitem\compteur\in\ListeComplete{\expandafter\Updatetoksq\compteur\nil}%
+  \xdef\ListeAvantCouleurs{\useKV[ClesStat]{ListeCouleursB}}%
+  \readlist*\ListeCouleur{\ListeAvantCouleurs}%
+  \foreachitem\couleur\in\ListeCouleur{\expandafter\UpdateCoul\couleur\nil}%
+  \MPStatNew{\the\toklistepointq}{\the\toklistecouleur}{\the\toklistelegende}%
+}%
+
+\def\UpdateCoul#1\nil{\addtotok\toklistecouleur{#1,}}%
+\def\UpdateLegende#1\nil{\addtotok\toklistelegende{#1,}}%
+
+% Pour construire le diagramme circulaire qualitatif
+\def\buildgraphcq#1{%
+  \newtoks\toklistepointq\toklistepointq{}%
+  \newtoks\toklistecouleur\toklistecouleur{}%
+  \newtoks\toklistelegende\toklistelegende{}%
+  \ifboolKV[ClesStat]{LegendeVide}{%
+    \xdef\foo{\useKV[ClesStat]{LegendesVides}}%
+    \readlist*\ListeLegendesAEffacer{\foo}%
+  }{\xdef\foo{0}\readlist*\ListeLegendesAEffacer{\foo}%
+  }%
+  \foreachitem\compteur\in\ListeLegendesAEffacer{\expandafter\UpdateLegende\compteur\nil}%
+  %
+  \foreachitem\compteur\in\ListeComplete{\expandafter\Updatetoksq\compteur\nil}%
+  \xdef\ListeAvantCouleurs{\useKV[ClesStat]{ListeCouleurs}}%
+  \readlist*\ListeCouleur{\ListeAvantCouleurs}%
+  \foreachitem\couleur\in\ListeCouleur{\expandafter\UpdateCoul\couleur\nil}%
+  \NewMPStatCirculaireQ{\the\toklistepointq}{#1}{\the\toklistecouleur}{\the\toklistelegende}%
+}%
+
+%% calcul des fr\'equences
+\newcommand\CalculFrequence[1]{%
+  \fpeval{round(\ListeComplete[#1,2]*100/\EffectifTotal,\useKV[ClesStat]{PrecisionF})}
+}
+
+%% 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%
+\newcount\CompteurECCC%
+\newcount\CompteurECCCTotal%
+
+\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}%
+}
+
+\def\NewMPDiagBarreHorCode{%
+  Longueur:=\useKV[ClesStat]{Longueur};
+  Hauteur:=\useKV[ClesStat]{Hauteur};
+  Ecart:=\useKV[ClesStat]{EcartBarre};
+  ExposantDivMax:=\ExposantDivMax;
+  ecarthachures=\useKV[ClesStat]{EcartHachures};
+  epaisseurhachures=\useKV[ClesStat]{EpaisseurHachures};
+  boolean Hachures,Bicolore,Grille,AffichageDonnee,LegendeVide;
+  Hachures=\useKV[ClesStat]{Hachures};
+  Bicolore=\useKV[ClesStat]{Bicolore};
+  Grille=\useKV[ClesStat]{Grille};
+  AffichageDonnee=\useKV[ClesStat]{AffichageDonnee};
+  LegendeVide=\useKV[ClesStat]{LegendeVide};
+  vardef CalculNombreDonneesEtDonneeMax(text t)=
+  nbdon:=0;%nombre de données
+  DonneeMax:=0;%donnée DonneeMaximale
+  for p_=t:
+  nbdon:=nbdon+1;
+  if p_>DonneeMax:
+  DonneeMax:=p_;
+  fi;
+  endfor;
+  enddef;
+  vardef ListeDonnees(text t)=
+  n:=0;
+  for p_=t:
+  n:=n+1;
+  Donnees[n]:=p_;
+  endfor;
+  enddef;
+  vardef RecuperationCouleurs(text t)=
+  color Col[];
+  n:=0;
+  for p_=t:
+  n:=n+1;
+  Col[n]=p_;
+  endfor;
+  enddef;
+}
+
+% Construction d'un diagramme en barres horizontal
+\newcommand\NewMPDiagBarreHor[4]{%
+  % #1 Liste des noms
+  % #2 Liste des valeurs associées
+  % #3 Liste des valeurs à afficher (si pb calcul MP)
+  % #4 Liste des couleurs
+  \ifluatex%
+  \mplibforcehmode%
+  \begin{mplibcode}%
+    \NewMPDiagBarreHorCode%
+    vardef TraceDiag=
+    if Grille:
+    pair Zz[];%Pour déterminer "le dernier point"
+    Zz0=(0,-(nbdon-1)*(Hauteur+Ecart)-Ecart);
+    Zz2=(0,(Hauteur+Ecart));
+    Zz1=((1/DonneeMax)*Longueur,-(nbdon-1)*(Hauteur+Ecart)-Ecart);
+    Zz3=if ExposantDivMax=0 : (DonneeMax+1)[Zz0,Zz1] else: ((floor(DonneeMax*10+2))/10)[Zz0,Zz1];fi;
+    if ExposantDivMax=0:
+    for k=1 upto DonneeMax+1:
+    trace (Zz0--Zz2) shifted (k*(Zz1-Zz0)) dashed evenly withcolor 0.5white;
+    endfor;
+    else:
+    for k=1 upto (floor(DonneeMax*10+2)):
+    trace (Zz0--Zz2) shifted ((k/10)*(Zz1-Zz0)) dashed evenly withcolor 0.5white;
+    endfor;
+    fi;
+    if ExposantDivMax=0:
+    for k=1 upto (DonneeMax+1):
+    label.bot(TEX("\num{"&decimal(k)&"}"),Zz0+k*(Zz1-Zz0));
+    endfor;
+    else:
+    if ExposantDivMax<5:
+    for k=1 upto (floor(DonneeMax*10+2)):
+    label.bot(TEX("\num{\fpeval{"&decimal(k)&"*(10**"&decimal(ExposantDivMax-1)&")}}"),Zz0+(k/10)*(Zz1-Zz0));
+    endfor;
+    else:
+    dotlabel.bot(TEX("\num{\fpeval{10**"&decimal(ExposantDivMax)&"}}"),Zz1);
+    fi;
+    fi;
+    fi;
+    for k=0 upto nbdon-1:
+    path RectangleDonnee;
+    RectangleDonnee=(unitsquare xscaled ((Donnees[k+1]/DonneeMax)*Longueur) yscaled Hauteur) shifted(0,-k*(Hauteur+Ecart));
+    if Hachures:
+    fill RectangleDonnee withcolor white;
+    trace Hachurage(RectangleDonnee,60 if
+    (k mod 2)=0: +90 fi,ecarthachures,if (k mod 2)=0 : 0 else: 1 fi)
+    withpen pencircle scaled epaisseurhachures;
+    else:
+    remplis RectangleDonnee withcolor if unknown Col[k+1]: if Bicolore:Col[(k mod 2)+1] else: white fi; else:if Bicolore:Col[(k mod 2)+1] else: Col[k+1] fi; fi;
+    fi;
+    trace RectangleDonnee;
+    endfor;
+    if Grille:
+    drawarrow (0,-(nbdon-1)*(Hauteur+Ecart)-Ecart)--(0,(Hauteur+Ecart)) withpen pencircle scaled 1.5;
+    drawarrow (0,-(nbdon-1)*(Hauteur+Ecart)-Ecart)--(Zz3+u*(0.25,0)) withpen pencircle scaled 1.5;
+    fi;
+    enddef;
+    vardef AffichageNom(text t)=
+    k:=0;
+    for p_=t:
+    label.lft(TEX(p_),0.5[(0,0),(0,Hauteur)] shifted (0,-k*(Hauteur+Ecart)));
+    k:=k+1;
+    endfor;
+    enddef;
+    vardef AffichageDonnees(text t)=
+    k:=0;
+    for p_=t:
+    label.rt(TEX("\num{"&p_&"}"),0.5[(0,0),(0,Hauteur)] shifted (((Donnees[k+1]/DonneeMax)*Longueur),-k*(Hauteur+Ecart)));
+    k:=k+1;
+    endfor;
+    enddef;
+    CalculNombreDonneesEtDonneeMax(#2);
+    ListeDonnees(#2);
+    RecuperationCouleurs(#4);
+    TraceDiag;
+    if LegendeVide=false:
+    AffichageNom(#1);
+    fi;
+    if AffichageDonnee:
+    AffichageDonnees(#3);
+    fi;
+  \end{mplibcode}
+  \else%
+  \begin{mpost}[mpsettings={\NewMPDiagBarreHorCode}]
+    vardef TraceDiag=
+    if Grille:
+    pair Zz[];%Pour déterminer "le dernier point"
+    Zz0=(0,-(nbdon-1)*(Hauteur+Ecart)-Ecart);
+    Zz2=(0,(Hauteur+Ecart));
+    Zz1=((1/DonneeMax)*Longueur,-(nbdon-1)*(Hauteur+Ecart)-Ecart);
+    Zz3=if ExposantDivMax=0 : (DonneeMax+1)[Zz0,Zz1] else: ((floor(DonneeMax*10+2))/10)[Zz0,Zz1];fi;
+    if ExposantDivMax=0:
+    for k=1 upto DonneeMax+1:
+    trace (Zz0--Zz2) shifted (k*(Zz1-Zz0)) dashed evenly withcolor 0.5white;
+    endfor;
+    else:
+    for k=1 upto (floor(DonneeMax*10+2)):
+    trace (Zz0--Zz2) shifted ((k/10)*(Zz1-Zz0)) dashed evenly withcolor 0.5white;
+    endfor;
+    fi;
+    if ExposantDivMax=0:
+    for k=1 upto (DonneeMax+1):
+    label.bot(LATEX("\num{"&decimal(k)&"}"),Zz0+k*(Zz1-Zz0));
+    endfor;
+    else:
+    if ExposantDivMax<5:
+    for k=1 upto (floor(DonneeMax*10+2)):
+    label.bot(LATEX("\num{\noexpand\fpeval{"&decimal(k)&"*(10**"&decimal(ExposantDivMax-1)&")}}"),Zz0+(k/10)*(Zz1-Zz0));
+    endfor;
+    else:
+    dotlabel.bot(LATEX("\num{\noexpand\fpeval{10**"&decimal(ExposantDivMax)&"}}"),Zz1);
+    fi;
+    fi;
+    fi;
+    for k=0 upto nbdon-1:
+    path RectangleDonnee;
+    RectangleDonnee=(unitsquare xscaled ((Donnees[k+1]/DonneeMax)*Longueur) yscaled Hauteur) shifted(0,-k*(Hauteur+Ecart));
+    if Hachures:
+    fill RectangleDonnee withcolor white;
+    trace Hachurage(RectangleDonnee,60 if
+    (k mod 2)=0: +90 fi,ecarthachures,if (k mod 2)=0 : 0 else: 1 fi)
+    withpen pencircle scaled epaisseurhachures;
+    else:
+    remplis RectangleDonnee withcolor if unknown Col[k+1]: if Bicolore:Col[(k mod 2)+1] else: white fi; else:if Bicolore:Col[(k mod 2)+1] else: Col[k+1] fi; fi;
+    fi;
+    trace RectangleDonnee;
+    endfor;
+    if Grille:
+    drawarrow (0,-(nbdon-1)*(Hauteur+Ecart)-Ecart)--(0,(Hauteur+Ecart)) withpen pencircle scaled 1.5;
+    drawarrow (0,-(nbdon-1)*(Hauteur+Ecart)-Ecart)--(Zz3+u*(0.25,0)) withpen pencircle scaled 1.5;
+    fi;
+    enddef;
+    vardef AffichageNom(text t)=
+    k:=0;
+    for p_=t:
+    label.lft(LATEX(p_),0.5[(0,0),(0,Hauteur)] shifted (0,-k*(Hauteur+Ecart)));
+    k:=k+1;
+    endfor;
+    enddef;
+    vardef AffichageDonnees(text t)=
+    k:=0;
+    for p_=t:
+    label.rt(LATEX("\num{"&p_&"}"),0.5[(0,0),(0,Hauteur)] shifted (((Donnees[k+1]/DonneeMax)*Longueur),-k*(Hauteur+Ecart)));
+    k:=k+1;
+    endfor;
+    enddef;
+    CalculNombreDonneesEtDonneeMax(#2);
+    ListeDonnees(#2);
+    RecuperationCouleurs(#4);
+    TraceDiag;
+    if LegendeVide=false:
+    AffichageNom(#1);
+    fi;
+    if AffichageDonnee:
+    AffichageDonnees(#3);
+    fi;
+  \end{mpost}
+  \fi%
+}%
+
+\def\MPStatNewCode{%
+  maxx:=0;
+  maxy:=0;
+  unitex:=\useKV[ClesStat]{Unitex}*cm;
+  unitey:=\useKV[ClesStat]{Unitey}*cm;
+  xpartorigine:=\useKV[ClesStat]{Origine};
+  AngleRotation=\useKV[ClesStat]{AngleRotationAbscisse};
+  boolean Rotation,Lecture,LectureFine,AideLecture,DonneesSup,Reponses,Qualitatif,Tiret,LegendeVide,Retour,GrandNombrex,GrandNombrey,Date;
+  GrandNombrex=\useKV[ClesStat]{GrandNombrex};
+  GrandNombrey=\useKV[ClesStat]{GrandNombrey};
+  if GrandNombrex:
+  GrandNombreA=\useKV[ClesStat]{GrandNombreA};
+  fi;
+  if GrandNombrey:
+  GrandNombreO=\useKV[ClesStat]{GrandNombreO};
+  fi;
+  Date:=\useKV[ClesStat]{Date};
+  Rotation=\useKV[ClesStat]{AbscisseRotation};
+  Lecture:=\useKV[ClesStat]{Lecture};
+  LectureFine:=\useKV[ClesStat]{LectureFine};
+  AideLecture:=\useKV[ClesStat]{AideLecture};
+  DonneesSup:=\useKV[ClesStat]{DonneesSup};
+  Reponses:=\useKV[ClesStat]{Reponses};
+  LegendeVide=\useKV[ClesStat]{LegendeVide};
+  epaisseurbatons=\useKV[ClesStat]{EpaisseurBatons};
+  Qualitatif=\useKV[ClesStat]{Qualitatif};
+  Tiret=\useKV[ClesStat]{Tiret};
+  Retour=false;
+  color CoulDefaut;
+  CoulDefaut=\useKV[ClesStat]{CouleurDefaut};
+  Depart=\useKV[ClesStat]{Depart};
+  %
+  pair A[],B[],P[];
+  vardef toto(text t)=%points quantitatif
+  n:=0;
+  for p_=t:
+  if pair p_:
+  n:=n+1;
+  P[n]=((xpart(p_)-(xpartorigine))*unitex,ypart(p_)*unitey);
+  if xpart(p_)>maxx:
+  maxx:=xpart(p_)-(xpartorigine);
+  fi;
+  if ypart(p_)>maxy:
+  maxy:=ypart(p_);
+  fi;
+  A[n]=unitex*(xpart(p_)-(xpartorigine),0);
+  B[n]=unitey*(0,ypart(p_));
+  fi;
+  endfor;
+  enddef;
+  vardef tutu(text t)=%points qualitatif
+  n:=0;
+  for p_=t:
+  if numeric p_:
+  P[n]=((n)*unitex,unitey*(p_-Depart));
+  B[n]=(0,unitey*(p_-Depart));
+  if p_>maxy:
+  maxy:=p_;
+  fi;
+  else:
+  n:=n+1;
+  A[n]=unitex*(n,0);
+  fi;
+  endfor;
+  maxy:=maxy-Depart;
+  maxx:=n;
+  enddef;
+}
+
+% Construction du graphique en bâtons
+\newcommand\MPStatNew[3]{%
+  \ifluatex
+  \mplibforcehmode
+  \begin{mplibcode}
+    \MPStatNewCode
+      %
+    vardef Test(expr nb)=
+    Retour:=false;
+    op:=0;
+    for l_=#3:
+    if l_=nb:
+    op:=op+1;
+    fi;
+    endfor;
+    if op>0:
+    Retour:=true;
+    fi;
+    enddef;    
+    % 
+    % on r\'ecup\`ere les couleurs
+    color Col[];
+    n:=0;
+    for p_=#2:
+    n:=n+1;
+    if color p_:
+    Col[n]=p_;
+    else:
+    Col[n]=CoulDefaut;
+    fi;
+    endfor;
+    vardef tata(text t)=%affichage quantitatif
+    l=0;
+    for p_=t:
+    if pair p_:
+    l:=l+1;
+    if Rotation:
+    if Date:
+    label.bot(TEX(decimal(xpart(p_))) rotated AngleRotation,A[l]);
+    else:
+    label.bot(TEX("\num{"&decimal(xpart(p_))&"}") rotated AngleRotation,A[l]);
+    fi;
+    else :
+    if Date:
+    label.bot(TEX(decimal(xpart(p_))),A[l]);
+    else:
+    label.bot(TEX("\num{"&decimal(xpart(p_))&"}"),A[l]);
+    fi;
+    fi;
+    if Reponses:
+    if DonneesSup:
+    Test(l);
+    if Retour=false:
+    if GrandNombrey:
+    label.top(TEX("\num{"&decimal(ypart(p_))&"}"),P[l]);
+    else:
+    label.top(TEX("\num{"&decimal(ypart(p_))&"}"),P[l]);
+    fi;
+    fi;
+    else:
+    if Tiret:
+    trace (B[l]+(-1pt,0))--(B[l]+(1pt,0));
+    label.lft(TEX("\num{"&decimal(p_)&"}"),B[l]);
+    else:
+    dotlabel.lft(TEX("\num{"&decimal(ypart(p_))&"}"),B[l]);
+    fi;
+    fi;
+    fi;
+    fi;
+    endfor;
+    enddef;
+    vardef titi(text t)=%affichage qualitatif
+    l:=0;
+    for p_=t:
+    if numeric p_:
+    if Reponses:
+    if DonneesSup:
+    Test(l);
+    if Retour=false:
+    label.top(TEX("\num{"&decimal(p_)&"}"),P[l]);
+    fi;
+    else:
+    if Tiret:
+    trace (B[l]+(-1pt,0))--(B[l]+(1pt,0));
+    label.lft(TEX("\num{"&decimal(p_)&"}"),B[l]);
+    else:
+    dotlabel.lft(TEX("\num{"&decimal(p_)&"}"),B[l]);
+    fi;
+    fi;
+    fi;
+    else:
+    l:=l+1;
+    if Rotation:
+    if AngleRotation<>0:
+    picture TEXTELABEL;
+    TEXTELABEL=image(
+    labeloffset:=labeloffset*2;
+    label.lft(TEX(p_),A[l]);
+    labeloffset:=labeloffset/2;
+    );
+    trace rotation(TEXTELABEL,A[l],AngleRotation);
+    else :
+    label.bot(TEX(p_),A[l]);
+    fi;
+    fi;
+    fi;
+    endfor;
+    enddef;
+    if Qualitatif: tutu(#1); else: toto(#1); fi;
+    boolean Grille;
+    Grille:=\useKV[ClesStat]{Grille};
+    Pasx:=\useKV[ClesStat]{Pasx};
+    Pasy:=\useKV[ClesStat]{Pasy};
+    if Grille:
+    drawoptions(withcolor 0.75white);
+    for k=0 step Pasx until ((maxx+1)):
+    trace (k*unitex,0)--(k*unitex,unitey*(maxy+2*Pasy));
+    endfor;
+    for k=0 step Pasy until ((maxy+2*Pasy)):
+    trace (0,k*unitey)--(unitex*(maxx+1),k*unitey);
+    endfor;
+    drawoptions();
+    fi;
+    if epaisseurbatons<>0:
+    for k=1 upto n:
+    fill polygone(A[k]-(epaisseurbatons*1pt,0),A[k]+(epaisseurbatons*1pt,0),P[k]+(epaisseurbatons*1pt,0),P[k]-(epaisseurbatons*1pt,0)) withcolor if unknown Col[k]: CoulDefaut else:Col[k] fi;
+    if AideLecture:
+    draw B[k]--P[k] dashed evenly;
+    fi;
+    endfor;
+    fi;
+    if LectureFine:
+    for k=0 step Pasy until ((maxy+1*Pasy)):
+    if Tiret:
+    trace (1pt,k*unitey)--(-1pt,k*unitey);
+    if GrandNombrey:
+    label.lft(TEX("\num{\fpeval{\useKV[ClesStat]{GrandNombreO}*"&decimal(k+Depart)&"}}"),(0,k*unitey));
+    else:
+    label.lft(TEX("\num{"&decimal(k+Depart)&"}"),(0,k*unitey));
+    fi;
+    else:
+    if GrandNombrey:
+    dotlabel.lft(TEX("\num{\fpeval{\useKV[ClesStat]{GrandNombreO}*"&decimal(k+Depart)&"}}"),(0,k*unitey));
+    else:
+    dotlabel.lft(TEX("\num{"&decimal(k+Depart)&"}"),(0,k*unitey));
+    fi;
+    fi;
+    endfor;
+    fi;
+    if Lecture:
+    for k=0 step Pasy until Pasy:
+    if Tiret:
+    trace (1pt,k*unitey)--(-1pt,k*unitey);
+    if GrandNombrey:
+    label.lft(TEX("\num{\fpeval{\useKV[ClesStat]{GrandNombreO}*"&decimal(k)&"}}"),(0,k*unitey));
+    else:
+    label.lft(TEX("\num{"&decimal(k)&"}"),(0,k*unitey));
+    fi;
+    else:
+    if GrandNombrey:
+    dotlabel.lft(TEX("\num{\fpeval{\useKV[ClesStat]{GrandNombreO}*"&decimal(k)&"}}"),(0,k*unitey));
+    else:
+    dotlabel.lft(TEX("\num{"&decimal(k)&"}"),(0,k*unitey));
+    fi;
+    fi;
+    endfor;
+    fi;
+    drawarrow (0,0)--unitex*(maxx+1,0);
+    drawarrow (0,0)--unitey*(0,maxy+2*Pasy);
+    label.lrt(btex \useKV[ClesStat]{Donnee} etex,unitex*(maxx+1,0));
+    label.urt(btex \useKV[ClesStat]{Effectif} etex,unitey*(0,maxy+2*Pasy));
+    if Qualitatif: titi(#1); else:tata(#1); fi;
+  \end{mplibcode}
+  \else
+  \begin{mpost}[mpsettings={\MPStatNewCode}]
+    % on r\'ecup\`ere les couleurs
+    color Col[];
+    n:=0;
+    for p_=#2:
+    n:=n+1;
+    if color p_:
+    Col[n]=p_;
+    else:
+    Col[n]=CoulDefaut;
+    fi;
+    endfor;
+    % 
+    vardef tata(text t)=%affichage quantitatif
+    l=0;
+    for p_=t:
+    if pair p_:
+    l:=l+1;
+    if Rotation:
+    label.bot(LATEX("\num{"&decimal(xpart(p_))&"}") rotated AngleRotation,A[l]);
+    else :
+    label.bot(LATEX("\num{"&decimal(xpart(p_))&"}"),A[l]);
+    fi;
+    if Reponses:
+    if DonneesSup:
+    label.top(LATEX("\num{"&decimal(ypart(p_))&"}"),P[l]);
+    else:
+    if Tiret:
+    trace (B[l]+(-1pt,0))--(B[l]+(1pt,0));
+    label.lft(LATEX("\num{"&decimal(p_)&"}"),B[l]);
+    else:
+    dotlabel.lft(LATEX("\num{"&decimal(ypart(p_))&"}"),B[l]);
+    fi;
+    fi;
+    fi;
+    fi;
+    endfor;
+    enddef;
+    vardef titi(text t)=%affichage qualitatif
+    l:=0;
+    for p_=t:
+    if numeric p_:
+    if Reponses:
+    if DonneesSup:
+    label.top(LATEX("\num{"&decimal(p_)&"}"),P[l]);
+    else:
+    if Tiret:
+    trace (B[l]+(-1pt,0))--(B[l]+(1pt,0));
+    label.lft(LATEX("\num{"&decimal(p_)&"}"),B[l]);
+    else:
+    dotlabel.lft(LATEX("\num{"&decimal(p_)&"}"),B[l]);
+    fi;
+    fi;
+    fi;
+    else:
+    l:=l+1;
+    if Rotation:
+    if AngleRotation<>0:
+    picture TEXTELABEL;
+    TEXTELABEL=image(
+    labeloffset:=labeloffset*2;
+    label.lft(LATEX(p_),A[l]);
+    labeloffset:=labeloffset/2;
+    );
+    trace rotation(TEXTELABEL,A[l],AngleRotation);
+    else :
+    label.bot(LATEX(p_),A[l]);
+    fi;
+    fi;
+    fi;
+    endfor;
+    enddef;
+    if Qualitatif: tutu(#1); else: toto(#1); fi;
+    boolean Grille;
+    Grille:=\useKV[ClesStat]{Grille};
+    Pasx:=\useKV[ClesStat]{Pasx};
+    Pasy:=\useKV[ClesStat]{Pasy};    
+    if Grille:
+    drawoptions(withcolor 0.75white);
+    for k=0 step Pasx until ((maxx+1)):
+    trace (k*unitex,0)--(k*unitex,unitey*(maxy+2*Pasy));
+    endfor;
+    for k=0 step Pasy until ((maxy+2*Pasy)):
+    trace (0,k*unitey)--(unitex*(maxx+1),k*unitey);
+    endfor;
+    drawoptions();
+    fi;
+    if epaisseurbatons<>0:
+    for k=1 upto n:
+    fill polygone(A[k]-(epaisseurbatons*1pt,0),A[k]+(epaisseurbatons*1pt,0),P[k]+(epaisseurbatons*1pt,0),P[k]-(epaisseurbatons*1pt,0)) withcolor if unknown Col[k]: CoulDefaut else:Col[k] fi;
+    if AideLecture:
+    draw B[k]--P[k] dashed evenly;
+    fi;
+    endfor;
+    fi;
+    if LectureFine:
+    for k=0 step Pasy until ((maxy+1*Pasy)):
+    if Tiret:
+    trace (1pt,k*unitey)--(-1pt,k*unitey);
+    label.lft(LATEX("\num{"&decimal(k)&"}"),(0,k*unitey));
+    else:
+    dotlabel.lft(LATEX("\num{"&decimal(k)&"}"),(0,k*unitey));
+    fi;
+    endfor;
+    fi;
+    if Lecture:
+    for k=0 step Pasy until Pasy:
+    if Tiret:
+    trace (1pt,k*unitey)--(-1pt,k*unitey);
+    label.lft(LATEX("\num{"&decimal(k)&"}"),(0,k*unitey));
+    else:
+    dotlabel.lft(LATEX("\num{"&decimal(k)&"}"),(0,k*unitey));
+    fi;
+    endfor;
+    fi;
+    drawarrow (0,0)--unitex*(maxx+1,0);
+    drawarrow (0,0)--unitey*(0,maxy+2*Pasy);
+    label.lrt(btex \useKV[ClesStat]{Donnee} etex,unitex*(maxx+1,0));
+    label.urt(btex \useKV[ClesStat]{Effectif} etex,unitey*(0,maxy+2*Pasy));
+    if Qualitatif: titi(#1); else:tata(#1); fi;
+  \end{mpost}
+  \fi
+}
+
+\def\NewMPStatCirculaireCodeQ{%
+  Rayon:=\useKV[ClesStat]{Rayon};
+  ecarthachures=\useKV[ClesStat]{EcartHachures};
+  epaisseurhachures=\useKV[ClesStat]{EpaisseurHachures};
+  boolean AffichageAngle,AffichageDonnee,Hachures,Inverse,Legende,LegendeVide,Retour,ACompleter;
+  AffichageAngle=\useKV[ClesStat]{AffichageAngle};
+  AffichageDonnee=\useKV[ClesStat]{AffichageDonnee};
+  Hachures=\useKV[ClesStat]{Hachures};
+  Inverse=\useKV[ClesStat]{LectureInverse};
+  Legende=\useKV[ClesStat]{Legende};
+  LegendeVide=\useKV[ClesStat]{LegendeVide};
+  Retour=false;
+  ACompleter=\useKV[ClesStat]{ACompleter};
+  % 
+  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*Rayon));
+  vardef AfficheLegende(text t)=
+  picture ResultatLegende;
+  ResultatLegende=image(
+  for p_=t:
+  if string p_:
+  n:=n+1;
+  C[n]=A[n-1] rotatedabout(O,if Inverse:-1* fi(ang[n]-ang[n-1])/2);
+  draw 0.95[O,C[n]]--1.05[O,C[n]];
+  C[n]:=1.05[O,C[n]];
+  Test(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];
+  if Retour=false:label.urt(TEX(p_),D[n]);fi;
+  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];
+  if Retour=false:label.ulft(TEX(p_),D[n]);fi;
+  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];
+  if Retour=false:label.llft(TEX(p_),D[n]);fi;
+  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];
+  if Retour=false:label.lrt(TEX(p_),D[n]);fi;
+  fi;
+  fi;
+  endfor;
+  );
+  ResultatLegende
+  % fi;
+  enddef;
+  vardef AfficheLegendePDF(text t)=
+  picture ResultatLegende;
+  ResultatLegende=image(
+  for p_=t:
+  if string p_:
+  n:=n+1;
+  C[n]=A[n-1] rotatedabout(O,if Inverse:-1* fi(ang[n]-ang[n-1])/2);
+  draw 0.95[O,C[n]]--1.05[O,C[n]];
+  C[n]:=1.05[O,C[n]];
+  Test(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];
+  if Retour=false:label.urt(LATEX(p_),D[n]);fi;
+  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];
+  if Retour=false:label.ulft(LATEX(p_),D[n]);fi;
+  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];
+  if Retour=false:label.llft(LATEX(p_),D[n]);fi;
+  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];
+  if Retour=false:label.lrt(LATEX(p_),D[n]);fi;
+  fi;
+  fi;
+  endfor;
+  );
+  ResultatLegende
+  % fi;
+  enddef;
+}
+
+% la construction du graphique qualitatif
+\def\NewMPStatCirculaireQ#1#2#3#4{%
+  %#1 : la liste des données
+  %#2 : 360 ou 180
+  %#3 : liste des couleurs
+  %#4 : liste des légendes à effacer.
+  \ifluatex
+  \mplibforcehmode
+  \begin{mplibcode}
+    \NewMPStatCirculaireCodeQ
+    if Inverse=false:
+    A[0]=point(0) of cc;
+    else:
+    A[0]=point(180) of cc;
+    fi;
+    % on r\'ecup\`ere les couleurs
+    color Col[];
+    n:=0;
+    for p_=#3:
+    n:=n+1;
+    Col[n]=p_;
+    endfor;
+    vardef toto(text t)=
+    n:=0;
+    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]=(#2/total[N])*total[k];
+    endfor;
+    n:=0;
+    for p_=t:
+    if numeric p_:
+    n:=n+1;
+    if Inverse=false:
+    A[n]=A[n-1] rotatedabout(O,p_*(#2/total[N]));
+    else:
+    A[n]=A[n-1] rotatedabout(O,-p_*(#2/total[N]));
+    fi;
+    %hachure ou pas ?
+    if Hachures=false:
+    fill (O--if Inverse=false:arccercle(A[n-1],A[n],O) else:
+    arccercle(A[n],A[n-1],O) fi--cycle) withcolor if unknown Col[n]: white else:Col[n] fi;
+    else:
+    draw
+    Hachurage((O--if Inverse=false:arccercle(A[n-1],A[n],O)
+    else:arccercle(A[n],A[n-1],O) fi--cycle),p_*(#2/total[N]) if
+    (n mod 2)=0: +90 else: -90 fi,ecarthachures,if (n mod 2)=0 : 0 else: 1 fi)
+    withpen pencircle scaled epaisseurhachures if AffichageAngle: withcolor 0.5white fi;
+    fi;
+    if ACompleter=false:
+    draw A[n-1]--O--A[n] if Hachures: withpen pencircle scaled2 fi;
+    fi;
+    % Affichage des angles associ\'es
+    if AffichageAngle:
+    if round(p_*(#2/total[N]))>15:
+    if (n mod 2)=0:
+    marque_a:=20*0.75*Rayon/cm;
+    else:
+    marque_a:=20*0.5*Rayon/cm;
+    fi;
+    if Hachures:
+    if Inverse=false:
+    undraw
+    Codeangle(A[n-1],O,A[n],0,(((TEX("\ang{"&decimal(round(p_*(#2/total[N])))&"}")))));
+    else:
+    undraw
+    Codeangle(A[n],O,A[n-1],0,(((TEX("\ang{"&decimal(round(p_*(#2/total[N])))&"}")))));
+    fi;
+    fill cercles(w shifted(marque_ang*unitvector(w-O)),3mm) withcolor
+    blanc;
+    fi;
+    if Inverse=false:
+    draw
+    Codeangle(A[n-1],O,A[n],0,(((TEX("\ang{"&decimal(round(p_*(#2/total[N])))&"}")))));
+    else:
+    draw
+    Codeangle(A[n],O,A[n-1],0,(((TEX("\ang{"&decimal(round(p_*(#2/total[N])))&"}")))));
+    fi;
+    fi;
+    elseif AffichageDonnee:
+    if round(p_*(#2/total[N]))>15:
+    if (n mod 2)=0:
+    marque_a:=20*0.75*Rayon/cm;
+    else:
+    marque_a:=20*0.5*Rayon/cm;
+    fi;
+    if Hachures:
+    if Inverse=false:
+    undraw
+    Codeangle(A[n-1],O,A[n],0,TEX(""&decimal(p_)&""));
+    else:
+    undraw
+    Codeangle(A[n],O,A[n-1],0,(((TEX(""&decimal(p_)&"")))));
+    fi;
+    fill cercles(w shifted(marque_ang*unitvector(w-O)),3mm) withcolor
+    blanc;
+    fi;
+    if Inverse=false:
+    draw
+    Codeangle(A[n-1],O,A[n],0,(((TEX(""&decimal(p_)&"")))));
+    else:
+    draw
+    Codeangle(A[n],O,A[n-1],0,(((TEX(""&decimal(p_)&"")))));
+    fi;
+    fi;
+    fi;
+    %
+    fi;
+    endfor;
+    if #2=360:
+    draw cc if Hachures: withpen pencircle scaled2 fi;
+    else:
+    draw (subpath(0,length cc/2) of cc)--cycle if Hachures: withpen pencircle scaled2 fi;;
+    fi;
+    n:=0;
+    enddef;
+    vardef Test(expr nb)=
+    Retour:=false;
+    op:=0;
+    for l_=#4:
+    if l_=nb:
+    op:=op+1;
+    fi;
+    endfor;
+    if op>0:
+    Retour:=true;
+    fi;
+    enddef;
+    Figure(-10u,-10u,10u,10u);
+    toto(#1);
+    if Legende:
+    n:=0;
+    draw AfficheLegende(#1);
+    fi;
+  \end{mplibcode}
+  \else
+  \begin{mpost}[mpsettings={\NewMPStatCirculaireCodeQ}]
+    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*Rayon));
+    % on r\'ecup\`ere les couleurs
+    color Col[];
+    n:=0;
+    for p_=#3:
+    n:=n+1;
+    Col[n]=p_;
+    endfor;
+    if Inverse=false:
+    A[0]=point(0) of cc;
+    else:
+    A[0]=point(180) of cc;
+    fi;
+    vardef toto(text t)=
+    n:=0;
+    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]=(#2/total[N])*total[k];
+    endfor;
+    n:=0;
+    for p_=t:
+    if numeric p_:
+    n:=n+1;
+    if Inverse=false:
+    A[n]=A[n-1] rotatedabout(O,p_*(#2/total[N]));
+    else:
+    A[n]=A[n-1] rotatedabout(O,-p_*(#2/total[N]));
+    fi;
+    %hachure ou pas ?
+    if Hachures=false:
+    fill (O--if Inverse=false:arccercle(A[n-1],A[n],O) else:
+    arccercle(A[n],A[n-1],O) fi--cycle) withcolor if unknown Col[n]: white else:Col[n] fi;
+    else:
+    draw
+    Hachurage((O--if Inverse=false:arccercle(A[n-1],A[n],O)
+    else:arccercle(A[n],A[n-1],O) fi--cycle),p_*(#2/total[N]) if
+    (n mod 2)=0: +90 else: -90 fi,ecarthachures,if (n mod 2)=0 : 0 else: 1 fi)
+    withpen pencircle scaled epaisseurhachures if AffichageAngle: withcolor 0.5white fi;
+    fi;
+    if ACompleter=false:
+    draw A[n-1]--O--A[n] if Hachures: withpen pencircle scaled2 fi;
+    fi;
+    % Affichage des angles associ\'es
+    if AffichageAngle:
+    if round(p_*(#2/total[N]))>15:
+    if (n mod 2)=0:
+    marque_a:=20*0.75*Rayon/cm;
+    else:
+    marque_a:=20*0.5*Rayon/cm;
+    fi;
+    if Hachures:
+    if Inverse=false:
+    undraw
+    Codeangle(A[n-1],O,A[n],0,(((LATEX("\ang{"&decimal(round(p_*(#2/total[N])))&"}")))));
+    else:
+    undraw
+    Codeangle(A[n],O,A[n-1],0,(((LATEX("\ang{"&decimal(round(p_*(#2/total[N])))&"}")))));
+    fi;
+    fill cercles(w shifted(marque_ang*unitvector(w-O)),3mm) withcolor
+    blanc;
+    fi;
+    if Inverse=false:
+    draw
+    Codeangle(A[n-1],O,A[n],0,(((LATEX("\ang{"&decimal(round(p_*(#2/total[N])))&"}")))));
+    else:
+    draw
+    Codeangle(A[n],O,A[n-1],0,(((LATEX("\ang{"&decimal(round(p_*(#2/total[N])))&"}")))));
+    fi;
+    fi;
+    elseif AffichageDonnee:
+    if round(p_*(#2/total[N]))>15:
+    if (n mod 2)=0:
+    marque_a:=20*0.75*Rayon/cm;
+    else:
+    marque_a:=20*0.5*Rayon/cm;
+    fi;
+    if Hachures:
+    if Inverse=false:
+    undraw
+    Codeangle(A[n-1],O,A[n],0,LATEX(""&decimal(p_)&""));
+    else:
+    undraw
+    Codeangle(A[n],O,A[n-1],0,(((LATEX(""&decimal(p_)&"")))));
+    fi;
+    fill cercles(w shifted(marque_ang*unitvector(w-O)),3mm) withcolor
+    blanc;
+    fi;
+    if Inverse=false:
+    draw
+    Codeangle(A[n-1],O,A[n],0,(((LATEX(""&decimal(p_)&"")))));
+    else:
+    draw
+    Codeangle(A[n],O,A[n-1],0,(((LATEX(""&decimal(p_)&"")))));
+    fi;
+    fi;
+    fi;
+    %
+    fi;
+    endfor;
+    if #2=360:
+    draw cc if Hachures: withpen pencircle scaled2 fi;
+    else:
+    draw (subpath(0,length cc/2) of cc)--cycle if Hachures: withpen pencircle scaled2 fi;;
+    fi;
+    enddef;
+    vardef Test(expr nb)=
+    Retour:=false;
+    op:=0;
+    for l_=#4:
+    if l_=nb:
+    op:=op+1;
+    fi;
+    endfor;
+    if op>0:
+    Retour:=true;
+    fi;
+    enddef;    
+    Figure(-10u,-10u,10u,10u);
+    toto(#1);
+    if Legende:
+    n:=0;
+    draw AfficheLegendePDF(#1);
+    fi;
+  \end{mpost}
+  \fi
+}%
+
+%Pour la m\'ediane.
+\DTLgnewdb{mtdb}%
+\dtlexpandnewvalue%
+\newcount\nbdonnees%
+% 
+\def\AjoutListEEaa#1\nil{\addtotok\tabtoksEEa{#1,}}%
+\def\AjoutListEEab#1\nil{\addtotok\tabtoksEEa{#1/}}%
+\def\AjoutListEEb#1\nil{\addtotok\tabtoksEEb{#1,}}%
+\def\AjoutListEEx#1\nil{\addtotok\tabtoksEE{#1,}}%
+\def\AjoutListEEy#1\nil{\addtotok\tabtoksEE{#1/}}%
+
+\DTLgnewdb{mtdbEE}%
+\DTLgnewdb{mtdbEEqual}%
+%
+
+% Pour les classes
+% Pour construire l'histogramme
+\def\UpdatetoksHisto#1/#2/#3\nil{\addtotok\toklisteelmtsclasse{#1,#2,}\addtotok\toklistedonhisto{#3,}}
+\def\UpdatetoksECC#1\nil{\addtotok\toklistedonhisto{#1,}}
+
+\NewDocumentCommand\buildgraphhisto{}{%
+  \newtoks\toklisteelmtsclasse%
+  \newtoks\toklistedonhisto%
+  \newtoks\toklistecouleur%
+  \newtoks\toklistelegende%
+  \ifboolKV[ClesStat]{LegendeVide}{%
+    \xdef\foo{\useKV[ClesStat]{LegendesVides}}%
+    \readlist*\ListeLegendesAEffacer{\foo}%
+  }{\xdef\foo{-1}\readlist*\ListeLegendesAEffacer{\foo}%
+  }%
+  \foreachitem\compteur\in\ListeLegendesAEffacer{\expandafter\UpdateLegende\compteur\nil}%
+  \foreachitem\compteur\in\ListeDepart{\expandafter\UpdatetoksHisto\compteur\nil}%
+  \ifboolKV[ClesStat]{ECC}{%
+    \toklistedonhisto{}%
+    \xdef\PfCFooECC{\ListeDepart[1,3]}%
+    \xintFor* ##1 in{\xintSeq{2}{\ListeDepartlen}}\do{%
+      \xdef\PfCFooRetiens{0}%
+      \xintFor* ##2 in{\xintSeq{1}{##1}}\do{%
+        \xdef\PfCFooRetiens{\fpeval{\PfCFooRetiens+\ListeDepart[##2,3]}}%
+      }%
+      \xdef\PfCFooECC{\PfCFooECC,\PfCFooRetiens}%
+    }%
+    \readlist*\PfCListeECC{\PfCFooECC}%
+    \foreachitem\compteur\in\PfCListeECC{\expandafter\UpdatetoksECC\compteur\nil}%
+  }{}%
+  \xdef\PfCEcartClasse{\fpeval{\ListeDepart[1,2]-\ListeDepart[1,1]}}%
+  \foreachitem\compteur\in\ListeDepart{%
+    \xdef\PfCEcartClasse{\PfCEcartClasse,\fpeval{\ListeDepart[\compteurcnt,2]-\ListeDepart[\compteurcnt,1]}}
+  }%
+  \xintifboolexpr{\fpeval{min(\PfCEcartClasse)}==\fpeval{max(\PfCEcartClasse)}}{}{\setKV[ClesStat]{MemeAmpli=false}}
+  % Pour les couleurs
+  \xdef\ListeAvantCouleurs{\useKV[ClesStat]{ListeCouleurs}}%
+  \readlist*\ListeCouleur{\ListeAvantCouleurs}%
+  \foreachitem\couleur\in\ListeCouleur{\expandafter\UpdateCoul\couleur\nil}%
+  %
+  \MPBuildHisto{\the\toklisteelmtsclasse}{\the\toklistedonhisto}{\the\toklistecouleur}{\the\toklistelegende}%
+}
+
+%% calcul des fr\'equences
+\newcommand\CalculFrequenceClasses[1]{%
+  \fpeval{round(\ListeDepart[#1,3]*100/\EffectifTotal,\useKV[ClesStat]{PrecisionF})}
+}
+
+\newcommand\CalculECCClasses[1]{%
+  \xdef\TotalECCC{0}%
+  \CompteurECCC=1%
+  \CompteurECCCTotal=\numexpr#1+1%
+  \whiledo{\CompteurECCC < \CompteurECCCTotal}{%
+    \xdef\TotalECCC{\fpeval{\TotalECCC+\ListeDepart[\the\CompteurECCC,3]}}%
+    \CompteurECCC=\numexpr\CompteurECCC+1%
+  }%
+  \num{\TotalECCC}%
+}
+
+\NewDocumentCommand\buildtabclasses{}{%
+  \setcounter{PfCCompteLignes}{0}%
+  \renewcommand{\arraystretch}{\useKV[ClesStat]{Stretch}}%
+  \begin{NiceTabular}{l*{\ListeDepartlen}{c}}%[hvlines]
+    \CodeBefore%
+    \rowcolor{\useKV[ClesStat]{CouleurTab}}{1}%
+    \columncolor{\useKV[ClesStat]{CouleurTab}}{1}%
+    \Body
+    \useKV[ClesStat]{Donnee}\xintFor* ##1 in{\xintSeq{1}{\ListeDepartlen}}\do{%
+      &$\num{\ListeDepart[##1,1]}\leqslant\dots<\num{\ListeDepart[##1,2]}$
+    }\\
+    \useKV[ClesStat]{Effectif}\xintFor* ##1 in{\xintSeq{1}{\ListeDepartlen}}\do{%
+      &\ifboolKV[ClesStat]{EffVide}{}{\num{\ListeDepart[##1,3]}}%
+    }\\
+    \ifboolKV[ClesStat]{Frequence}{\stepcounter{PfCCompteLignes}Fr\'equence (\%)\xintFor* ##1 in {\xintSeq {1}{\ListeDepartlen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{\num{\CalculFrequenceClasses{##1}}}}}\\
+    }{}%
+    \ifboolKV[ClesStat]{ECC}{\stepcounter{PfCCompteLignes}E.C.C.\xintFor* ##1 in {\xintSeq {1}{\ListeDepartlen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{ECCVide}{}{\CalculECCClasses{##1}}}}\\}{}%
+    \CodeAfter%
+    % On crée la liste des colonnes à vider
+    \xintifboolexpr{\useKV[ClesStat]{ColVide}>0}{%
+      \xdef\FooStat{\useKV[ClesStat]{ColVide}}%
+      \setsepchar{,}%
+      \readlist*\ListeColonnesAVider{\FooStat}%
+      \foreachitem\compteur\in\ListeColonnesAVider{%
+        \tikz\fill[white] (row-2-|col-\fpeval{\compteur+1}) rectangle (last-|col-\fpeval{\compteur+2});%
+      }%
+    }{}%
+%    % On crée la liste des cases à vider
+    \ifboolKV[ClesStat]{CaseVide}{%
+      \xdef\FooStatCases{\useKV[ClesStat]{CasesVides}}%
+      \setsepchar[*]{,*/}%
+      \readlist*\ListeCasesAVider{\FooStatCases}%
+      \foreachitem\compteur\in\ListeCasesAVider{%
+        \tikz\fill[white] (row-\fpeval{\ListeCasesAVider[\compteurcnt,1]+1}-|col-\fpeval{\ListeCasesAVider[\compteurcnt,2]+1}) rectangle (row-\fpeval{\ListeCasesAVider[\compteurcnt,1]+2}-|col-\fpeval{\ListeCasesAVider[\compteurcnt,2]+2});%
+      }%
+    }{}%
+%    % On retrace le tableau
+%    % Les colonnes
+    \xintFor* ##1 in {\xintSeq{1}{\fpeval{\ListeDepartlen+2}}}\do{%
+      \tikz\draw (row-1-|col-##1) -- (last-|col-##1);%
+    }%
+%    % Les lignes
+    \xintFor* ##1 in {\xintSeq{1}{\fpeval{\thePfCCompteLignes+3}}}\do{%
+      \tikz\draw (row-##1-|col-1) -- (row-##1-|last);%
+    }%
+  \end{NiceTabular}
+}%
+
+\NewDocumentCommand\MPBuildHisto{mmmm}{%
+  \ifluatex
+  \mplibforcehmode
+  \begin{mplibcode}
+    maxx:=-infinity;
+    minx:=infinity;
+    maxy:=-infinity;
+    miny:=0;
+    unitex:=\useKV[ClesStat]{Unitex}*cm;
+    unitey:=\useKV[ClesStat]{Unitey}*cm;
+    Pasx:=\useKV[ClesStat]{Pasx};
+    Pasy:=\useKV[ClesStat]{Pasy};
+    UniteAire=\useKV[ClesStat]{UniteAire};
+    Ecarthachures=\useKV[ClesStat]{EcartHachures};
+    Epaisseurhachures=\useKV[ClesStat]{EpaisseurHachures};
+    boolean MemeAmpli,Hachures,Lecture,LectureFine,AideLecture,DonneesSup,Tiret,LegendeVide,Retour,Mediane,ECC;
+    ECC=\useKV[ClesStat]{ECC};
+    Mediane=\useKV[ClesStat]{Mediane};
+    MemeAmpli=\useKV[ClesStat]{MemeAmpli};
+    Hachures:=\useKV[ClesStat]{Hachures};
+    %
+    Lecture:=\useKV[ClesStat]{Lecture};
+    LectureFine:=\useKV[ClesStat]{LectureFine};
+    Tiret=\useKV[ClesStat]{Tiret};
+    AideLecture:=\useKV[ClesStat]{AideLecture};
+    DonneesSup:=\useKV[ClesStat]{DonneesSup};
+    LegendeVide=\useKV[ClesStat]{LegendeVide};
+    Retour=false;
+    % Test affichage
+    vardef Test(expr nb)=
+    Retour:=false;
+    op:=0;
+    for l_=#4:
+    if l_=nb:
+    op:=op+1;
+    fi;
+    endfor;
+    if op>0:
+    Retour:=true;
+    fi;
+    enddef;
+    %Affichage ou pas des légendes
+    vardef AfficheLegende(text t)=
+    l=0;
+    for p_=t:
+    l:=l+1;
+    if DonneesSup:
+    Test(l);
+    if Retour=false:
+    label.top(TEX("\num{"&decimal(Y[l])&"}"),(unitex*(Depart+(0.5*(X[2*l]+X[2*l-2])-X[1])/Pasx),unitey*Z[l]));
+    fi;
+    fi;
+    endfor;
+    enddef;
+    % on r\'ecup\`ere les couleurs
+    Depart=\useKV[ClesStat]{DepartHisto};
+    color Col[],CoulDefaut;
+    CoulDefaut=white;
+    n:=0;
+    for p_=#3:
+    n:=n+1;
+    Col[n]=p_;
+    endfor;
+    %
+    numeric X[];
+    numeric ecartabs[];
+    vardef RecupValeursAbscisses(text t)=
+    p:=0;
+    for p_=t:
+    p:=p+1;
+    X[p]:=p_;
+    if X[p]<minx:
+    minx:=X[p];
+    fi;
+    if X[p]>maxx:
+    maxx:=X[p];
+    fi;
+    endfor;
+    X[0]=X[1];
+    TotalAbscisses=p;
+    enddef;
+    numeric Y[],Z[];
+    numeric EffectifTotal[];
+    numeric EffectifTotalA[];
+    vardef RecupValeursDonnees(text t)=
+    p:=0;
+    EffectifTotal[0]:=0;
+    EffectifTotalA[0]:=0; 
+    for p_=t:
+    p:=p+1;
+    EffectifTotal[p]:=p_;
+    EffectifTotalA[p]:=EffectifTotalA[p-1]+p_;
+    Y[p]:=p_;
+    Z[p]=(Y[p]/(UniteAire*(X[2*p]-X[2*p-1])/Pasx));
+    R[p]=ceiling(Z[p]);
+    if R[p]>maxy:
+    maxy:=R[p];
+    fi;
+    endfor;
+    NbDonnees:=p;
+    enddef;
+    %On affiche la médiane dans le cas des ECC
+    vardef AfficheMedianeECC(text t)=
+    YMed:=Z[NbDonnees]/2;
+    DemiDonnees:=EffectifTotal[NbDonnees]/2;
+    p:=0;
+    forever:
+    p:=p+1;
+    exitif EffectifTotal[p]>DemiDonnees;
+    endfor;
+    path MedHor,MedLineaire,MedVer;
+    MedLineaire=(unitex*(Depart+(X[2*p-2]-X[1]/Pasx)),unitey*Z[p-1])--(unitex*(Depart+(X[2*p]-X[1])/Pasx),unitey*Z[p]);
+    MedHor=((0,unitey*YMed)--(unitex*((maxx-minx)/Pasx+2),unitey*YMed));
+    MedVer=(xpart(MedLineaire intersectionpoint MedHor),0)--(MedLineaire intersectionpoint MedHor);
+    draw MedLineaire;
+    draw MedHor;
+    draw MedVer;
+    enddef;
+    % On affiche la médiane dans le cas non ECC
+    vardef AfficheMediane(text t)=
+    DemiDonnees:=EffectifTotalA[NbDonnees]/2;
+    p:=0;
+    forever:
+    p:=p+1;
+    exitif EffectifTotalA[p]>DemiDonnees;
+    endfor;
+    path MedVer;
+    numeric CoefLineaire,pMed;
+    pMed=p;
+    CoefLineaire=(DemiDonnees-EffectifTotalA[p-1])/Y[p];
+    MedVer=(unitex*(Depart+(X[2*p-2]-X[1])/Pasx+CoefLineaire*(X[2*p]-X[2*p-2])/Pasx),0)--(unitex*(Depart+(X[2*p-2]-X[1])/Pasx+CoefLineaire*(X[2*p]-X[2*p-2])/Pasx),unitey*Z[p]);
+    draw MedVer dashed evenly;
+    enddef;
+    % On commence le tracé : on récupère les informations
+    RecupValeursAbscisses(#1);
+    RecupValeursDonnees(#2);
+    % on définit une grille
+    vardef Grille=
+    if MemeAmpli:
+    Ajout:=1;
+    else:
+    Ajout:=3;
+    fi;
+    drawoptions(withcolor 0.7white);
+    for k=0 upto ((maxx-minx)/Pasx+2):
+    trace (unitex*k,0)--(unitex*k,(maxy+Ajout)*unitey);%withcolor red;
+    endfor;
+    for k=0 upto (maxy+Ajout):
+    trace (0,k*unitey)--(unitex*((maxx-minx)/Pasx+2),k*unitey);% withcolor blue;
+    endfor;
+    drawoptions();
+    enddef;
+    % Fin Grille
+    % On trace les rectangles
+    vardef AfficheRectangles=
+    if Hachures:
+    Grille;
+    for k=2 step 2 until TotalAbscisses:
+    draw hachurage(polygone(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0)),60,0.2,0);
+    draw chemin(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0));
+    endfor;
+    else:
+    for k=2 step 2 until TotalAbscisses:
+    fill polygone(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0)) withcolor if unknown Col[k/2]: CoulDefaut else: Col[k/2] fi;
+    endfor;
+    Grille;
+    for k=2 step 2 until TotalAbscisses:
+    draw chemin(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0));
+    endfor;
+    fi;
+    enddef;
+    % Affichage final
+    if ECC:
+      AfficheRectangles;
+      if Mediane:
+        AfficheMedianeECC(#2);
+      fi;
+    else:
+      if Mediane:
+        AfficheMediane(#2);
+        if Hachures:
+        Grille;
+        %Partie gauche
+          for k=2 step 2 until (2*pMed-2):
+            draw hachurage(polygone(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0)),60,0.2,0);
+            draw chemin(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0));
+          endfor;
+          draw hachurage(polygone(unitex*(Depart+(X[2*pMed-2]-X[1])/Pasx,0),point(0) of MedVer,point(1) of MedVer,(unitex*(Depart+(X[2*pMed-2]-X[1])/Pasx),unitey*Z[pMed])),60,0.2,0);
+          draw polygone(unitex*(Depart+(X[2*pMed-2]-X[1])/Pasx,0),point(0) of MedVer,point(1) of MedVer,(unitex*(Depart+(X[2*pMed-2]-X[1])/Pasx),unitey*Z[pMed]));
+          % Partie droite
+          for k=2*pMed+2 step 2 until TotalAbscisses:
+            draw hachurage(polygone(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0)),120,0.2,1);
+            draw chemin(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0));
+          endfor;
+          draw hachurage(polygone(unitex*(Depart+(X[2*pMed]-X[1])/Pasx,0),point(0) of MedVer,point(1) of MedVer,(unitex*(Depart+(X[2*pMed]-X[1])/Pasx),unitey*Z[pMed])),120,0.2,1);
+          draw polygone(unitex*(Depart+(X[2*pMed]-X[1])/Pasx,0),point(0) of MedVer,point(1) of MedVer,(unitex*(Depart+(X[2*pMed]-X[1])/Pasx),unitey*Z[pMed]));
+          else:
+          %Partie gauche
+    for k=2 step 2 until (2*pMed-2):
+    fill polygone(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0)) withcolor if unknown Col[1]: CoulDefaut else: Col[1] fi;
+    endfor;
+    fill polygone(unitex*(Depart+(X[2*pMed-2]-X[1])/Pasx,0),point(0) of MedVer,point(1) of MedVer,(unitex*(Depart+(X[2*pMed-2]-X[1])/Pasx),unitey*Z[pMed])) withcolor if unknown Col[1]: CoulDefaut else: Col[1] fi ;
+    % Partie droite
+    for k=2*pMed+2 step 2 until TotalAbscisses:
+    fill polygone(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0)) withcolor if unknown Col[2]: CoulDefaut else: Col[2] fi;
+    endfor;
+    fill polygone(unitex*(Depart+(X[2*pMed]-X[1])/Pasx,0),point(0) of MedVer,point(1) of MedVer,(unitex*(Depart+(X[2*pMed]-X[1])/Pasx),unitey*Z[pMed]))  withcolor if unknown Col[2]: CoulDefaut else: Col[2] fi;
+    Grille;
+    %Partie Gauche
+    for k=2 step 2 until (2*pMed-2):
+    trace polygone(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0));
+    endfor;
+    trace polygone(unitex*(Depart+(X[2*pMed-2]-X[1])/Pasx,0),point(0) of MedVer,point(1) of MedVer,(unitex*(Depart+(X[2*pMed-2]-X[1])/Pasx),unitey*Z[pMed]));%(Y[pMed]/(UniteAire*(X[2*pMed-2]-X[2*pMed-3])/Pasx))));
+    for k=2*pMed+2 step 2 until TotalAbscisses:
+    draw chemin(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0));
+    endfor;
+    draw polygone(unitex*(Depart+(X[2*pMed]-X[1])/Pasx,0),point(0) of MedVer,point(1) of MedVer,(unitex*(Depart+(X[2*pMed]-X[1])/Pasx),unitey*Z[pMed]));
+    fi;
+    draw MedVer withpen pencircle scaled 2;
+      else:
+        AfficheRectangles;
+      fi;
+    fi;
+    %Affichage ou pas des axes, de la médiane
+    if MemeAmpli:
+      drawarrow (0,0)--unitey*(0,maxy+1);
+      EcartAmpli:=(X[2]-X[1])/Pasx;
+      if AideLecture:
+      for k=2 step 2 until TotalAbscisses:
+        trace ((unitex*(Depart+(X[k]-X[1])/Pasx),unitey*Z[k/2]))--(unitey*(0,Z[k/2])) dashed evenly;
+        endfor;
+      fi;
+      if LectureFine:
+        for k=0 upto ((maxy+1)):
+          if Tiret:
+            trace (1pt,k*unitey)--(-1pt,k*unitey);
+            label.lft(TEX("\num{"&decimal(k*UniteAire*EcartAmpli)&"}"),(0,k*unitey));
+          else:
+            dotlabel.lft(TEX("\num{"&decimal(k*UniteAire*EcartAmpli)&"}"),(0,k*unitey));
+          fi;
+        endfor;
+      fi;
+      if Lecture:
+        for k=0 upto 1:
+        if Tiret:
+          trace (1pt,k*unitey)--(-1pt,k*unitey);
+          label.lft(TEX("\num{"&decimal(k*UniteAire*EcartAmpli)&"}"),(0,k*unitey));
+    else:
+    dotlabel.lft(TEX("\num{"&decimal(k*UniteAire*EcartAmpli)&"}"),(0,k*unitey));
+    fi;
+    endfor;
+    fi; 
+    else:%Pas même ampli : on n'affiche pas l'axe vertical
+    trace hachurage(polygone((unitex,unitey*(maxy+2)),(unitex*2,unitey*(maxy+2)),(unitex*2,unitey*(maxy+1)),(unitex,unitey*(maxy+1))),60,0.2,0);
+    trace polygone((unitex,unitey*(maxy+2)),(unitex*2,unitey*(maxy+2)),(unitex*2,unitey*(maxy+1)),(unitex,unitey*(maxy+1)));
+    label.rt(TEX(decimal(UniteAire)&"~\useKV[ClesStat]{Effectif}"),(unitex*2,unitey*(maxy+1.5)));
+%    if Mediane:
+%    AfficheMediane(#2);
+%    fi;
+    fi;
+    % On trace l'axe des abscisses
+    drawarrow (0,0)--unitex*((maxx-minx)/Pasx+2,0);
+    %On labelise l'axe des abscisses
+    dotlabel.bot(TEX("\num{"&decimal(X[1])&"}"),unitex*(Depart,0));
+    for k=2 step 2 until TotalAbscisses:
+    dotlabel.bot(TEX("\num{"&decimal(X[k])&"}"),unitex*(Depart+(X[k]-X[1])/Pasx,0));
+    endfor;
+    label.rt(TEX("\useKV[ClesStat]{Donnee}"),(unitex*((maxx-minx)/Pasx+2),0));
+    %On affiche les données sup ou pas.
+    AfficheLegende(#2);
+  \end{mplibcode}
+  \fi
+}
+%
+
+\newcommand\Stat[2][]{%
+  \useKVdefault[ClesStat]%
+  \setKV[ClesStat]{#1}%
+  \setsepchar[*]{,*/}%
+  \readlist*\ListeAvantUtilisation{#2}%
+  \xintifboolexpr{\listlen\ListeAvantUtilisation[1]==3}{\setKV[ClesStat]{Classes}}{}%
+  \ifboolKV[ClesStat]{Classes}{%
+    \setsepchar[*]{,*/}%
+    \readlist*\ListeDepart{#2}%
+    \xdef\EffectifTotal{0}%
+    \xintFor* ##1 in{\xintSeq{1}{\ListeDepartlen}}\do{%
+      \xdef\EffectifTotal{\fpeval{\EffectifTotal+\ListeDepart[##1,3]}}%
+    }%
+    \ifboolKV[ClesStat]{Histogramme}{%
+      \buildgraphhisto%
+    }{%
+      \ifboolKV[ClesStat]{Tableau}{%
+        \buildtabclasses%
+      }{}%
+    }%
+  }{%
+    \setsepchar{,}%
+    \ifboolKV[ClesStat]{Representation}{%
+      \setKV[TraceG]{Xmin=0,Ymin=0}%
+      \setKV[TraceG]{#1}%
+      \readlist*\ListePointsPlaces{#2}%
+      \newtoks\toklistepoint%
+      \foreachitem\compteur\in\ListePointsPlaces{\expandafter\Updatetoks\compteur\nil}%
+      \MPPlacePoint[#1]{\the\toklistepoint}%
+    }{%
+      \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}%
+      }{%
+        \ifboolKV[ClesStat]{Sondage}{%
+          \setsepchar{,}\ignoreemptyitems%
+          \readlist*\Liste{#2}%
+          % "liste vide"
+          \newtoks\tabtoksEEa%
+          \tabtoksEEa{}%
+          % 
+          % "liste vide"
+          \newtoks\tabtoksEEb%
+          \tabtoksEEb{}%
+          % 
+          \readlist*\ListeSansDoublonsEE{999}%   %% Pour ne pas avoir une liste vide
+          % 
+          \newcount\cmptEE%
+          \newcount\PasNumEE%    %% Permettra de savoir si ce sondage est qualitatif ou quantitatif
+          \PasNumEE=0\relax%
+          \DTLcleardb{mtdbEE}%
+          % on range les resultats du sondage par ordre croissant.
+          \foreachitem\x\in\Liste{%
+            \DTLnewrow{mtdbEE}%
+            \DTLnewdbentry{mtdbEE}{Numeric}{\x}%
+          }%
+          \dtlsort{Numeric}{mtdbEE}{\dtlicompare}%
+          \DTLforeach{mtdbEE}{\nba=Numeric}{%
+            \IfDecimal{\nba}{}{\PasNumEE=\numexpr\PasNumEE+1\relax}%
+            \cmptEE=0\relax%
+            \foreachitem\nbb\in\ListeSansDoublonsEE{%
+              \ifthenelse{\equal{\nba}{\nbb}}{\cmptEE=\numexpr\cmptEE+1\relax}{}%
+            }%
+            \ifthenelse{\equal{\the\cmptEE}{0}}{%
+              \expandafter\AjoutListEEb\nba\nil%
+              \xdef\listEEa{\the\tabtoksEEb}%
+              \ignoreemptyitems%
+              \setsepchar{,}%
+              \readlist*\ListeSansDoublonsEE\listEEa%    	%%% Enl\`eve tous les \'elements
+              %%% identiques de Liste
+            }{}%
+          }%
+          \foreachitem\nba\in\ListeSansDoublonsEE{%
+            \cmptEE=0\relax%
+            \DTLforeach{mtdbEE}{\nbb=Numeric}{%
+              \ifthenelse{\equal{\nba}{\nbb}}{\cmptEE=\numexpr\cmptEE+1\relax}{}%
+            }%
+            \expandafter\AjoutListEEab\nba\nil%
+            \expandafter\AjoutListEEaa\the\cmptEE\nil% 	%%% Compte tous les \'elements
+            %%% identiques de Liste
+          }%
+          \xdef\listEEb{\the\tabtoksEEa}
+          \ignoreemptyitems%
+          \setsepchar[*]{,*/}%
+          \readlist*\ListeComplete\listEEb%
+          % 
+          \ifthenelse{\equal{\the\PasNumEE}{0}}{\setKV[ClesStat]{Quantitatif}}{\setKV[ClesStat]{Qualitatif}}%
+        }{%
+          \ifboolKV[ClesStat]{Qualitatif}{%
+            %  % on lit la liste \'ecrite sous la forme valeur/effectif
+            \setsepchar[*]{,*/}\ignoreemptyitems%
+            \readlist*\ListeInitiale{#2}%
+            % "liste vide"
+            \newtoks\tabtoksEE%
+            \tabtoksEE{}%
+            \DTLcleardb{mtdbEEqual}%
+            \foreachitem\x\in\ListeInitiale{%
+              \DTLnewrow{mtdbEEqual}%
+              \itemtomacro\ListeInitiale[\xcnt,1]\x%
+              \DTLnewdbentry{mtdbEEqual}{Val}{\x}%
+              \itemtomacro\ListeInitiale[\xcnt,2]\y%
+              \DTLnewdbentry{mtdbEEqual}{Eff}{\y}%
+            }%
+            \DTLforeach{mtdbEEqual}{\Val=Val,\Eff=Eff}{%  
+              \expandafter\AjoutListEEy\Val\nil%
+              \expandafter\AjoutListEEx\Eff\nil%
+            }%
+            \xdef\listEE{\the\tabtoksEE}
+            \ignoreemptyitems%
+            \setsepchar[*]{,*/}%
+            \readlist*\ListeComplete\listEE%
+          }{% Dans le qualitatif, on trie d'abord les valeurs.
+            \setsepchar[*]{,*/}\ignoreemptyitems%
+            \readlist*\ListeInitiale{#2}%
+            % "liste vide"
+            \newtoks\tabtoksEE%
+            \tabtoksEE{}%
+            \DTLcleardb{mtdbEEqual}%
+            \foreachitem\x\in\ListeInitiale{%
+              \DTLnewrow{mtdbEEqual}%
+              \itemtomacro\ListeInitiale[\xcnt,1]\x%
+              \DTLnewdbentry{mtdbEEqual}{Val}{\x}%
+              \itemtomacro\ListeInitiale[\xcnt,2]\y%
+              \DTLnewdbentry{mtdbEEqual}{Eff}{\y}%
+            }%
+            \dtlsort{Val}{mtdbEEqual}{\dtlicompare}%
+            \DTLforeach{mtdbEEqual}{\Val=Val,\Eff=Eff}{%  
+              \expandafter\AjoutListEEy\Val\nil%
+              \expandafter\AjoutListEEx\Eff\nil%
+            }%
+            \xdef\listEE{\the\tabtoksEE}
+            \ignoreemptyitems%
+            \setsepchar[*]{,*/}%
+            \readlist*\ListeComplete\listEE%
+          }}}%
+      % on cr\'ee la base de donn\'ees des valeurs dans le cas qualitatif
+      \DTLcleardb{mtdb}%
+      % on les trie pour la m\'ediane 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\'einitialise les valeurs des crit\`eres 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\'ebut qualitatif
+        % Calculs
+        %  %% celui de la somme des donn\'ees
+        \foreachitem\don\in\ListeComplete{\xdef\SommeDonnees{\fpeval{\SommeDonnees+\ListeComplete[\doncnt,2]}}}%
+        %  %% celui de l'effectif total
+        \ifboolKV[ClesStat]{EffectifTotal}{%
+          \ifboolKV[ClesStat]{Liste}{L'effectif total de la s\'erie est
+            \num{\ListeCompletelen}.\par}{%
+            \foreachitem\don\in\ListeComplete{\xdef\EffectifTotal{\fpeval{\EffectifTotal+\ListeComplete[\doncnt,2]}}}%
+            L'effectif total de la s\'erie est : \[\ListeComplete[1,2]\xintFor* ##1 in
+              {\xintSeq {2}{\ListeCompletelen}}\do{%
+                +\ListeComplete[##1,2]}=\num{\EffectifTotal}\]}
+        }{}%
+        \ifboolKV[ClesStat]{Liste}{\xdef\EffectifTotal{\ListeCompletelen}}{\xdef\EffectifTotal{\SommeDonnees}}%
+        %  %% celui de la moyenne
+        \xdef\Moyenne{\fpeval{\SommeDonnees/\ListeCompletelen}}%	
+        \ifboolKV[ClesStat]{Moyenne}{%
+          \ifboolKV[ClesStat]{Liste}{%
+            La somme des donn\'ees de la s\'erie 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}{}{Le nombre de donn\'ees de la s\'erie est \num{\ListeCompletelen}.\\}%
+            Donc la moyenne de la s\'erie est \'egale \`a :%
+            \[\frac{\num{\SommeDonnees}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}}{\num{\ListeCompletelen}}%\IfInteger{\fpeval{round(\fpeval{\SommeDonnees/\ListeCompletelen},\useKV[ClesStat]{Precision})}}{=}{\approx}
+              \ifboolKV[ClesStat]{ValeurExacte}{}{%
+                \opdiv*{\SommeDonnees}{\ListeCompletelen}{resultatmoy}{restemoy}%
+                \opround{resultatmoy}{\useKV[ClesStat]{Precision}}{resultatmoy1}%
+                \opcmp{resultatmoy}{resultatmoy1}\ifopeq=\else\approx\fi%
+                \num{\fpeval{round(\SommeDonnees/\ListeCompletelen,\useKV[ClesStat]{Precision})}}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}%
+              }%
+            \]%
+          }{Pas de moyenne possible pour une s\'erie de donn\'ees \`a caract\`ere qualitatif.}}{}%
+        %    %  %% celui de l'\'etendue
+        \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}{%
+          \ifboolKV[ClesStat]{Liste}{%
+            L'\'etendue de la s\'erie est \'egale \`a $\num{\DonneeMax}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}-\num{\DonneeMin}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}=\num{\Etendue}$\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}%
+          }{Pas d'\'etendue possible pour une s\'erie de donn\'ees \`a caract\`ere qualitatif.}}{}%
+        % celui de la mediane
+        %%% Recuperation de la mediane %%%%%%%%%%%%%%%%%%%%% 
+        \newcount\Recapmed%
+        \newcount\Recapmeda%
+        \ifodd\number\ListeCompletelen%odd impair
+        \Recapmed=\fpeval{(\ListeCompletelen+1)/2}\relax%
+        \else%
+        \Recapmed=\fpeval{\ListeCompletelen/2}\relax%
+        \Recapmeda=\numexpr\Recapmed+1\relax%
+        \fi%
+        \newcount\Recapk%
+        \Recapk=0%
+        \DTLforeach{mtdb}{\numeroDonnee=Numeric}{\Recapk=\numexpr\Recapk+1\relax%
+          \ifnum\Recapk=\Recapmed%
+          \ifodd\number\ListeCompletelen%
+          \xdef\Mediane{\numeroDonnee}%
+          \else%
+          \xdef\Mediane{\numeroDonnee}%
+          \fi%
+          \fi%
+          \ifnum\Recapk=\Recapmeda%
+          \xdef\Mediane{\fpeval{(\Mediane+\numeroDonnee)/2}}%
+          \fi%
+        }%
+        %%% 
+        \ifboolKV[ClesStat]{Mediane}{%
+          \ifboolKV[ClesStat]{Liste}{%    
+            On range les donn\'ees 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 de la s\'erie 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 de la s\'erie 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\'ediane vaut \numeroDonnee\fi
+              \ifodd\number\ListeCompletelen%
+              La m\'ediane de la s\'erie est la \the\med\ieme{} donn\'ee.\\Donc la m\'ediane de la s\'erie est \num{\numeroDonnee}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}%
+              \xdef\Mediane{\numeroDonnee}%
+              \else%
+              La \the\med\ieme{} donn\'ee est \num{\numeroDonnee}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}. }{. }\xdef\Mediane{\numeroDonnee}%
+              \fi%
+              \fi%
+              \ifnum\k=\meda
+              La \the\meda\ieme{} donn\'ee est \num{\numeroDonnee}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.} Donc la m\'ediane de la s\'erie est \xdef\Mediane{\fpeval{(\Mediane+\numeroDonnee)/2}}\num{\Mediane}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}%
+              \fi%
+            }%
+            %%%%%%% 
+          }{Pas de m\'ediane possible pour une s\'erie de donn\'ees \`a caract\`ere qualitatif.}}{}
+        %%% Quartile un
+        \newcount\PfCQuartileUn%
+        \modulo{\ListeCompletelen}{4}\relax%
+        \ifnum\remainder=0%
+        \PfCQuartileUn=\fpeval{\ListeCompletelen/4}%
+        \else%
+        \PfCQuartileUn=\fpeval{ceil(\ListeCompletelen/4)}%
+        \fi%
+        \newcount\PfCQunk%
+        \PfCQunk=0%
+        \DTLforeach{mtdb}{\numeroDonnee=Numeric}{\PfCQunk=\numexpr\PfCQunk+1\relax%
+          \ifnum\PfCQunk=\PfCQuartileUn%
+          \xdef\QuartileUn{\numeroDonnee}%
+          \fi%
+        }%
+        %%% Quartile trois
+        \newcount\PfCQuartileTrois%
+        \modulo{\ListeCompletelen}{4}\relax%
+        \ifnum\remainder=0%
+        \PfCQuartileTrois=\fpeval{3*\ListeCompletelen/4}%
+        \else%
+        \PfCQuartileTrois=\fpeval{ceil(3*\ListeCompletelen/4)}%
+        \fi%
+        \newcount\PfCQtroisk%
+        \PfCQtroisk=0%
+        \DTLforeach{mtdb}{\numeroDonnee=Numeric}{\PfCQtroisk=\numexpr\PfCQtroisk+1\relax%
+          \ifnum\PfCQtroisk=\PfCQuartileTrois%La m\'ediane vaut \numeroDonnee\fi
+          \xdef\QuartileTrois{\numeroDonnee}%
+          \fi%
+        }%
+        % Construction du tableau
+        \ifboolKV[ClesStat]{Tableau}{%
+          \ifboolKV[ClesStat]{Liste}{Pas de tableau possible avec la cl\'e Liste.\\Utilisez plut\^ot la cl\'e Sondage si vous voulez un tableau avec cette liste.}{\BuildtabStat}}{}%
+        % Construction du graphique
+        \ifboolKV[ClesStat]{Graphique}{%
+          \ifboolKV[ClesStat]{Liste}{Pas de graphique possible avec la cl\'e Liste.\\Utilisez plut\^ot la cl\'e Sondage si vous voulez un graphique avec cette liste.}{%
+            \ifboolKV[ClesStat]{Barre}{%
+              \buildgraphbarhor%
+            }{%
+              \ifboolKV[ClesStat]{Angle}{%
+                \buildgraphcq{360}%
+              }{%
+                \ifboolKV[ClesStat]{SemiAngle}{%
+                  \buildgraphcq{180}%
+                }{%
+                  \buildgraphq[#1]%
+                }%
+              }%
+            }%
+          }%
+        }{}%
+      }{%%%%%%%%%%%%%%%%%%%%%D\'ebut quantitatif
+        %  % on effectue les calculs
+        %  %% celui de la somme des donn\'ees
+        \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'\'etendue
+        \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 de la s\'erie est : \[\ListeComplete[1,2]\xintFor* ##1 in
+            {\xintSeq {2}{\ListeCompletelen}}\do{%
+              +\ListeComplete[##1,2]}=\num{\EffectifTotal}\]
+        }{}%
+        \ifboolKV[ClesStat]{Moyenne}{%
+          La somme des donn\'ees de la s\'erie 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 de la s\'erie 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 de la s\'erie est \'egale \`a :%
+          \[\frac{\num{\SommeDonnees}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}}{\num{\EffectifTotal}}%
+            \ifboolKV[ClesStat]{ValeurExacte}{}{%
+              \opdiv*{\SommeDonnees}{\EffectifTotal}{resultatmoy}{restemoy}%
+              \opround{resultatmoy}{\useKV[ClesStat]{Precision}}{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\'eponses.
+        %  %% pour l'\'etendue
+        \ifboolKV[ClesStat]{Etendue}{L'\'etendue de la s\'erie est \'egale \`a $\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\'ediane
+        %%% Recuperation Mediane
+        \newcount\Recupmed%
+        \newcount\Recupmeda%
+        \ifodd\number\EffectifTotal%odd impair
+        \Recupmed=\fpeval{(\EffectifTotal+1)/2}\relax%
+        \else% pair
+        \Recupmed=\fpeval{\EffectifTotal/2}\relax%
+        \Recupmeda=\numexpr\Recupmed+1\relax%
+        \fi%
+        \newcount\Recupk%
+        \Recupk=0%
+        \xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{%
+          \xintFor* ##2 in {\xintSeq {1}{\ListeComplete[##1,2]}}\do{%
+            \Recupk=\numexpr\Recupk+1\relax%
+            \ifnum\Recupk=\Recupmed%
+            \ifodd\number\EffectifTotal%
+            \xdef\Mediane{\ListeComplete[##1,1]}%
+            \else%
+            \xdef\Mediane{\ListeComplete[##1,1]}%
+            \fi%
+            \fi%
+            \ifnum\Recupk=\Recupmeda%
+            \xdef\Mediane{\fpeval{(\Mediane+\ListeComplete[##1,1])/2}}%
+            \fi%
+          }%
+        }%
+        %%% 
+        \ifboolKV[ClesStat]{Mediane}{%
+          
+          \newcount\med%
+          \newcount\meda%
+          \ifodd\number\EffectifTotal%odd impair
+          \med=\fpeval{(\EffectifTotal+1)/2}\relax%
+          L'effectif total de la s\'erie 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 de la s\'erie 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\'ediane de la s\'erie est la \the\med\ieme{} donn\'ee. Donc la m\'ediane de la s\'erie est \num{\ListeComplete[##1,1]}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}%
+              \else%
+              La \the\med\ieme{} donn\'ee 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{} donn\'ee est \num{\ListeComplete[##1,1]}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}\\Donc la m\'ediane de la s\'erie est \xdef\Mediane{\fpeval{(\Mediane+\ListeComplete[##1,1])/2}}\num{\Mediane}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}%
+              \fi%
+            }%
+          }%
+        }{}%
+        %%% Quartile un
+        \newcount\PfCQuartileUn%
+        \modulo{\EffectifTotal}{4}\relax%
+        \ifnum\remainder=0%
+        \PfCQuartileUn=\fpeval{\EffectifTotal/4}%
+        \else%
+        \PfCQuartileUn=\fpeval{ceil(\EffectifTotal/4)}%
+        \fi%
+        \newcount\PfCQunk%
+        \PfCQunk=0%
+        \xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{%
+          \xintFor* ##2 in {\xintSeq {1}{\ListeComplete[##1,2]}}\do{%
+            \PfCQunk=\numexpr\PfCQunk+1\relax%
+            \ifnum\PfCQunk=\PfCQuartileUn%
+            \xdef\QuartileUn{\ListeComplete[##1,1]}%
+            \fi%
+          }%
+        }%
+        %%% Quartile trois
+        \newcount\PfCQuartileTrois%
+        \modulo{\EffectifTotal}{4}\relax%
+        \ifnum\remainder=0%
+        \PfCQuartileTrois=\fpeval{3*\EffectifTotal/4}%
+        \else%
+        \PfCQuartileTrois=\fpeval{ceil(3*\EffectifTotal/4)}%
+        \fi%
+        \newcount\PfCQtroisk%
+        \PfCQtroisk=0%
+        \xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{%
+          \xintFor* ##2 in {\xintSeq {1}{\ListeComplete[##1,2]}}\do{%
+            \PfCQtroisk=\numexpr\PfCQtroisk+1\relax%
+            \ifnum\PfCQtroisk=\PfCQuartileTrois%
+            \xdef\QuartileTrois{\ListeComplete[##1,1]}%
+            \fi%
+          }%
+        }%
+        % Construction de tableau
+        \ifboolKV[ClesStat]{Tableau}{\BuildtabStat}{}%
+        % Construction du graphique ??
+        \ifboolKV[ClesStat]{Graphique}{%
+          \ifboolKV[ClesStat]{Angle}{%
+            \buildgraphcq{360}%
+          }{%
+            \ifboolKV[ClesStat]{SemiAngle}{%
+              \buildgraphcq{180}%
+            }{%
+              \buildgraph[#1]%
+            }%
+          }%
+        }{}%
+      }%
+    }%
+  }%
+}%
\ No newline at end of file


Property changes on: trunk/Master/texmf-dist/tex/latex/profcollege/PfCStatistiquesold.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/tex/latex/profcollege/PfCStatistiquesoldold.tex
===================================================================
--- trunk/Master/texmf-dist/tex/latex/profcollege/PfCStatistiquesoldold.tex	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/profcollege/PfCStatistiquesoldold.tex	2023-07-04 19:53:24 UTC (rev 67545)
@@ -0,0 +1,2109 @@
+%%%
+% Statistiques
+%%%
+\newcommand\NbDonnees{}%
+\newcommand\SommeDonnees{}%
+\newcommand\EffectifTotal{}%
+\newcommand\Moyenne{}%
+\newcommand\Etendue{}%
+\newcommand\Mediane{}%
+\newcommand\DonneeMax{}%
+\newcommand\DonneeMin{}%
+\newcommand\EffectifMax{}%
+\newcommand\PfCArticleMediane{la}%
+
+\setKVdefault[ClesStat]{ColVide=0,CaseVide=false,EffVide=false,%
+FreqVide=false,AngVide=false,ECCVide=false,TotalVide=false,Sondage=false,Liste=false,%
+Tableau=false,Stretch=1,Frequence=false,EffectifTotal=false,%
+Etendue=false,Moyenne=false,SET=false,ValeurExacte=false,Mediane=false,DetailsMediane=false,UneMediane=false,QuartileUn=false,QuartileTrois=false,Total=false,Concret=false,%
+Unite={},Largeur=1cm,Precision=2,PrecisionF=0,Donnee=Valeurs,Effectif=Effectif,Grille=false,Origine=0,Angle=false,SemiAngle=false,Qualitatif=false,Classes=false,TableauVide=false,ECC=false,Coupure=10,CouleurTab=gray!15,Graphique=false,Batons=true,%
+% Pour les diags batons
+EpaisseurBatons=1,ListeCouleursB={a},Lecture=false,LectureFine=false,AideLecture=false,Reponses=false,DonneesSup=false,AbscisseRotation=false,Tiret=false,AngleRotationAbscisse=0,Pasx=1,Pasy=1,Unitex=0.5,Unitey=0.5,Depart=0,CouleurDefaut=black,Date=false,GrandNombrey=false,GrandNombrex=false,%
+% Pour les diags circulaires
+Rayon=3cm,AffichageAngle=false,AffichageDonnee=false,ListeCouleurs={white},Hachures=false,LectureInverse=false,EcartHachures=0.25,EpaisseurHachures=1,Legende,LegendeVide=false,ACompleter=false,%
+%Pour les représentations
+Representation=false,%
+%Pour les barres horizontales
+Barre=false,Longueur=10cm,Hauteur=5mm,Bicolore=false,EcartBarre=0,%Grille est dispo
+% Pour les histogrammes
+Histogramme=false,UniteAire=1,MemeAmpli,DepartHisto=1%
+}%
+%compl\'ements
+\defKV[ClesStat]{AngleRotationAbscisse=\setKV[ClesStat]{AbscisseRotation}}%
+\defKV[ClesStat]{AffichageDonnees=\setKV[ClesStat]{AffichageAngle=false}\setKV[ClesStat]{AffichageDonnee}}%
+\defKV[ClesStat]{CasesVides=\setKV[ClesStat]{CaseVide}}%
+\defKV[ClesStat]{LegendesVides=\setKV[ClesStat]{LegendeVide}}%
+\defKV[ClesStat]{GrandNombreO=\setKV[ClesStat]{GrandNombrey}}%
+\defKV[ClesStat]{GrandNombreA=\setKV[ClesStat]{GrandNombrex}}%
+% 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{\ifboolKV[ClesStat]{Qualitatif}{&#1}{&\num{#1}}}\addtotok\tabtoksb{&\num{#2}}}%
+%
+\newcounter{PfCCompteLignes}%
+%
+\def\BuildtabStat{% %%Tableau sans/avec total
+  \setcounter{PfCCompteLignes}{0}%
+  \tabtoksa{\useKV[ClesStat]{Donnee}}\tabtoksb{\useKV[ClesStat]{Effectif}}%
+  \foreachitem\compteur\in\ListeComplete{\expandafter\updatetoks\compteur\nil}%
+  \renewcommand{\arraystretch}{\useKV[ClesStat]{Stretch}}%
+  \ifboolKV[ClesStat]{Total}{%
+    \begin{NiceTabular}{c*{\fpeval{\ListeCompletelen+1}}{>{\centering\arraybackslash}p{\useKV[ClesStat]{Largeur}}}}%
+      \CodeBefore%
+      \rowcolor{\useKV[ClesStat]{CouleurTab}}{1}%
+      \columncolor{\useKV[ClesStat]{CouleurTab}}{1}%
+      \Body%
+      \the\tabtoksa&Total\\%
+      \ifboolKV[ClesStat]{EffVide}{\useKV[ClesStat]{Effectif}\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&}}{\the\tabtoksb&\num{\EffectifTotal}}\\%
+      \ifboolKV[ClesStat]{Frequence}{\stepcounter{PfCCompteLignes}Fr\'equence (\%)\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{\num{\CalculFrequence{##1}}}}}&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{100}}\\}{}%
+      \ifboolKV[ClesStat]{Angle}{\stepcounter{PfCCompteLignes}Angle (\si{\degree})\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculAngle{##1}}}}&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{360}}\\}{}%
+      \ifboolKV[ClesStat]{SemiAngle}{\stepcounter{PfCCompteLignes}Angle (\si{\degree})\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculSemiAngle{##1}}}}&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{180}}\\}{}%
+      \ifboolKV[ClesStat]{ECC}{\stepcounter{PfCCompteLignes}E.C.C.\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{ECCVide}{}{\CalculECC{##1}}}}&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{ECCVide}{}{\num{\EffectifTotal}}}\\}{}%
+      \CodeAfter%
+      % On crée la liste des colonnes à vider
+      \xintifboolexpr{\useKV[ClesStat]{ColVide}>0}{%
+        \xdef\FooStat{\useKV[ClesStat]{ColVide}}%
+        \setsepchar{,}%
+        \readlist*\ListeColonnesAVider{\FooStat}%
+        \foreachitem\compteur\in\ListeColonnesAVider{%
+          \tikz\fill[white] (row-2-|col-\fpeval{\compteur+1}) rectangle (last-|col-\fpeval{\compteur+2});%
+        }%
+      }{}%
+      % On crée la liste des cases à vider
+      \ifboolKV[ClesStat]{CaseVide}{%
+        \xdef\FooStatCases{\useKV[ClesStat]{CasesVides}}%
+        \setsepchar[*]{,*/}%
+        \readlist*\ListeCasesAVider{\FooStatCases}%
+        \foreachitem\compteur\in\ListeCasesAVider{%
+          \tikz\fill[white] (row-\fpeval{\ListeCasesAVider[\compteurcnt,1]+1}-|col-\fpeval{\ListeCasesAVider[\compteurcnt,2]+1}) rectangle (row-\fpeval{\ListeCasesAVider[\compteurcnt,1]+2}-|col-\fpeval{\ListeCasesAVider[\compteurcnt,2]+2});%
+        }%
+      }{}%
+      % On retrace le tableau
+      %Les colonnes
+      \xintFor* ##1 in {\xintSeq{1}{\fpeval{\ListeCompletelen+3}}}\do{%
+        \tikz\draw (row-1-|col-##1) -- (last-|col-##1);%
+      }%
+      % Les lignes
+      \xintFor* ##1 in {\xintSeq{1}{\fpeval{\thePfCCompteLignes+3}}}\do{%
+        \tikz\draw (row-##1-|col-1) -- (row-##1-|last);%
+      }%
+    \end{NiceTabular}%
+  }{%
+    \begin{NiceTabular}{c*{\fpeval{\ListeCompletelen}}{>{\centering\arraybackslash}p{\useKV[ClesStat]{Largeur}}}}%
+      \CodeBefore%
+      \rowcolor{\useKV[ClesStat]{CouleurTab}}{1}%
+      \columncolor{\useKV[ClesStat]{CouleurTab}}{1}%
+      \Body%
+      \the\tabtoksa\\%
+      \ifboolKV[ClesStat]{EffVide}{\useKV[ClesStat]{Effectif}\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&}}{\the\tabtoksb}\\%
+      \ifboolKV[ClesStat]{Frequence}{\stepcounter{PfCCompteLignes}Fr\'equence (\%)\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{\num{\CalculFrequence{##1}}}}}\\}{}%
+      \ifboolKV[ClesStat]{Angle}{\stepcounter{PfCCompteLignes}Angle (\si{\degree})\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculAngle{##1}}}}\\}{}%
+      \ifboolKV[ClesStat]{SemiAngle}{\stepcounter{PfCCompteLignes}Angle (\si{\degree})\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculSemiAngle{##1}}}}\\}{}%
+      \ifboolKV[ClesStat]{ECC}{\stepcounter{PfCCompteLignes}E.C.C.\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{ECCVide}{}{\CalculECC{##1}}}}\\}{}%
+      \CodeAfter%
+      % On crée la liste des colonnes à vider
+      \xintifboolexpr{\useKV[ClesStat]{ColVide}>0}{%
+        \xdef\FooStat{\useKV[ClesStat]{ColVide}}%
+        \setsepchar{,}%
+        \readlist*\ListeColonnesAVider{\FooStat}%
+        \foreachitem\compteur\in\ListeColonnesAVider{%
+          \tikz\fill[white] (row-2-|col-\fpeval{\compteur+1}) rectangle (last-|col-\fpeval{\compteur+2});%
+        }%
+      }{}%
+      % On crée la liste des cases à vider
+      \ifboolKV[ClesStat]{CaseVide}{%
+        \xdef\FooStatCases{\useKV[ClesStat]{CasesVides}}%
+        \setsepchar[*]{,*/}%
+        \readlist*\ListeCasesAVider{\FooStatCases}%
+        \foreachitem\compteur\in\ListeCasesAVider{%
+          \tikz\fill[white] (row-\fpeval{\ListeCasesAVider[\compteurcnt,1]+1}-|col-\fpeval{\ListeCasesAVider[\compteurcnt,2]+1}) rectangle (row-\fpeval{\ListeCasesAVider[\compteurcnt,1]+2}-|col-\fpeval{\ListeCasesAVider[\compteurcnt,2]+2});%
+        }%
+      }{}%
+      % On retrace le tableau
+      %Les colonnes
+      \xintFor* ##1 in {\xintSeq{1}{\fpeval{\ListeCompletelen+2}}}\do{%
+        \tikz\draw (row-1-|col-##1) -- (last-|col-##1);%
+      }%
+      % Les lignes
+      \xintFor* ##1 in {\xintSeq{1}{\fpeval{\thePfCCompteLignes+3}}}\do{%
+        \tikz\draw (row-##1-|col-1) -- (row-##1-|last);%
+      }%
+    \end{NiceTabular}%
+  }%
+}%
+
+% Pour construire le diagramme en barres horizontales
+\def\UpdatetoksHor#1/#2/#3\nil{\addtotok\toklistenomhor{"#1",}\addtotok\toklistedonhor{#3,}\addtotok\toklisteaffhor{"#2",}}%
+
+\newcommand\buildgraphbarhor{%
+  \newtoks\toklistenomhor%
+  \newtoks\toklistedonhor%
+  \newtoks\toklisteaffhor%
+  \newtoks\toklistecouleur%
+  \xdef\PfCfooStat{}%
+  \xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{%
+    \xdef\PfCfooStat{\PfCfooStat \ListeComplete[##1,2],}%
+  }%
+  \xdef\DivMax{\fpeval{max(\PfCfooStat)}}%
+  \xdef\ExposantDivMax{\fpeval{round(ln(\DivMax)/ln(10))}}%
+  \xdef\DivMax{\fpeval{10**\ExposantDivMax}}%
+  \xdef\PfCfooStat{}%
+  \xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{%
+    \xdef\PfCfooStat{\PfCfooStat \ListeComplete[##1,1]/\ListeComplete[##1,2]/\fpeval{\ListeComplete[##1,2]/\DivMax},}%
+  }%
+  \readlist*\ListeCompleteDiagHor{\PfCfooStat}%
+  \foreachitem\compteur\in\ListeCompleteDiagHor{\expandafter\UpdatetoksHor\compteur\nil}%
+  \xdef\ListeAvantCouleurs{\useKV[ClesStat]{ListeCouleurs}}%
+  \readlist*\ListeCouleur{\ListeAvantCouleurs}%
+  \foreachitem\couleur\in\ListeCouleur{\expandafter\UpdateCoul\couleur\nil}%
+  \NewMPDiagBarreHor{\the\toklistenomhor}{\the\toklistedonhor}{\the\toklisteaffhor}{\the\toklistecouleur}%
+}%
+
+% Pour construire le diagramme en bâtons
+\def\Updatetoks#1/#2\nil{\addtotok\toklistepoint{(#1,#2),}}%
+\newcommand\buildgraph[1][]{%
+  \newtoks\toklistepoint\toklistepoint{}%
+  \newtoks\toklistecouleur\toklistecouleur{}%
+  \newtoks\toklistelegende\toklistelegende{}%
+  \ifboolKV[ClesStat]{LegendeVide}{%
+    \xdef\foo{\useKV[ClesStat]{LegendesVides}}%
+    \readlist*\ListeLegendesAEffacer{\foo}%
+  }{\xdef\foo{-1}\readlist*\ListeLegendesAEffacer{\foo}%
+  }%
+  \foreachitem\compteur\in\ListeLegendesAEffacer{\expandafter\UpdateLegende\compteur\nil}%
+  \foreachitem\compteur\in\ListeComplete{\expandafter\Updatetoks\compteur\nil}%
+  \xdef\ListeAvantCouleurs{\useKV[ClesStat]{ListeCouleursB}}%
+  \readlist*\ListeCouleur{\ListeAvantCouleurs}%
+  \foreachitem\couleur\in\ListeCouleur{\expandafter\UpdateCoul\couleur\nil}%
+  \MPStatNew{\the\toklistepoint}{\the\toklistecouleur}{\the\toklistelegende}
+}%
+
+% Pour construire le diagramme en bâtons qualitatif
+\def\Updatetoksq#1/#2\nil{\addtotok\toklistepointq{"#1",#2,}}%
+\newcommand\buildgraphq[1][]{%
+  \newtoks\toklistepointq\toklistepointq{}%
+  \newtoks\toklistecouleur\toklistecouleur{}%
+  \newtoks\toklistelegende\toklistelegende{}%
+  \ifboolKV[ClesStat]{LegendeVide}{%
+    \xdef\foo{\useKV[ClesStat]{LegendesVides}}%
+    \readlist*\ListeLegendesAEffacer{\foo}%
+  }{\xdef\foo{-1}\readlist*\ListeLegendesAEffacer{\foo}%
+  }%
+  \foreachitem\compteur\in\ListeLegendesAEffacer{\expandafter\UpdateLegende\compteur\nil}%
+  \foreachitem\compteur\in\ListeComplete{\expandafter\Updatetoksq\compteur\nil}%
+  \xdef\ListeAvantCouleurs{\useKV[ClesStat]{ListeCouleursB}}%
+  \readlist*\ListeCouleur{\ListeAvantCouleurs}%
+  \foreachitem\couleur\in\ListeCouleur{\expandafter\UpdateCoul\couleur\nil}%
+  \MPStatNew{\the\toklistepointq}{\the\toklistecouleur}{\the\toklistelegende}%
+}%
+
+\def\UpdateCoul#1\nil{\addtotok\toklistecouleur{#1,}}%
+\def\UpdateLegende#1\nil{\addtotok\toklistelegende{#1,}}%
+
+% Pour construire le diagramme circulaire qualitatif
+\def\buildgraphcq#1{%
+  \newtoks\toklistepointq\toklistepointq{}%
+  \newtoks\toklistecouleur\toklistecouleur{}%
+  \newtoks\toklistelegende\toklistelegende{}%
+  \ifboolKV[ClesStat]{LegendeVide}{%
+    \xdef\foo{\useKV[ClesStat]{LegendesVides}}%
+    \readlist*\ListeLegendesAEffacer{\foo}%
+  }{\xdef\foo{0}\readlist*\ListeLegendesAEffacer{\foo}%
+  }%
+  \foreachitem\compteur\in\ListeLegendesAEffacer{\expandafter\UpdateLegende\compteur\nil}%
+  %
+  \foreachitem\compteur\in\ListeComplete{\expandafter\Updatetoksq\compteur\nil}%
+  \xdef\ListeAvantCouleurs{\useKV[ClesStat]{ListeCouleurs}}%
+  \readlist*\ListeCouleur{\ListeAvantCouleurs}%
+  \foreachitem\couleur\in\ListeCouleur{\expandafter\UpdateCoul\couleur\nil}%
+  \NewMPStatCirculaireQ{\the\toklistepointq}{#1}{\the\toklistecouleur}{\the\toklistelegende}%
+}%
+
+%% calcul des fr\'equences
+\newcommand\CalculFrequence[1]{%
+  \fpeval{round(\ListeComplete[#1,2]*100/\EffectifTotal,\useKV[ClesStat]{PrecisionF})}
+}
+
+%% 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%
+\newcount\CompteurECCC%
+\newcount\CompteurECCCTotal%
+
+\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}%
+}
+
+\def\NewMPDiagBarreHorCode{%
+  Longueur:=\useKV[ClesStat]{Longueur};
+  Hauteur:=\useKV[ClesStat]{Hauteur};
+  Ecart:=\useKV[ClesStat]{EcartBarre};
+  ExposantDivMax:=\ExposantDivMax;
+  ecarthachures=\useKV[ClesStat]{EcartHachures};
+  epaisseurhachures=\useKV[ClesStat]{EpaisseurHachures};
+  boolean Hachures,Bicolore,Grille,AffichageDonnee,LegendeVide;
+  Hachures=\useKV[ClesStat]{Hachures};
+  Bicolore=\useKV[ClesStat]{Bicolore};
+  Grille=\useKV[ClesStat]{Grille};
+  AffichageDonnee=\useKV[ClesStat]{AffichageDonnee};
+  LegendeVide=\useKV[ClesStat]{LegendeVide};
+  vardef CalculNombreDonneesEtDonneeMax(text t)=
+  nbdon:=0;%nombre de données
+  DonneeMax:=0;%donnée DonneeMaximale
+  for p_=t:
+  nbdon:=nbdon+1;
+  if p_>DonneeMax:
+  DonneeMax:=p_;
+  fi;
+  endfor;
+  enddef;
+  vardef ListeDonnees(text t)=
+  n:=0;
+  for p_=t:
+  n:=n+1;
+  Donnees[n]:=p_;
+  endfor;
+  enddef;
+  vardef RecuperationCouleurs(text t)=
+  color Col[];
+  n:=0;
+  for p_=t:
+  n:=n+1;
+  Col[n]=p_;
+  endfor;
+  enddef;
+}
+
+% Construction d'un diagramme en barres horizontal
+\newcommand\NewMPDiagBarreHor[4]{%
+  % #1 Liste des noms
+  % #2 Liste des valeurs associées
+  % #3 Liste des valeurs à afficher (si pb calcul MP)
+  % #4 Liste des couleurs
+  \ifluatex%
+  \mplibforcehmode%
+  \begin{mplibcode}%
+    \NewMPDiagBarreHorCode%
+    vardef TraceDiag=
+    if Grille:
+    pair Zz[];%Pour déterminer "le dernier point"
+    Zz0=(0,-(nbdon-1)*(Hauteur+Ecart)-Ecart);
+    Zz2=(0,(Hauteur+Ecart));
+    Zz1=((1/DonneeMax)*Longueur,-(nbdon-1)*(Hauteur+Ecart)-Ecart);
+    Zz3=if ExposantDivMax=0 : (DonneeMax+1)[Zz0,Zz1] else: ((floor(DonneeMax*10+2))/10)[Zz0,Zz1];fi;
+    if ExposantDivMax=0:
+    for k=1 upto DonneeMax+1:
+    trace (Zz0--Zz2) shifted (k*(Zz1-Zz0)) dashed evenly withcolor 0.5white;
+    endfor;
+    else:
+    for k=1 upto (floor(DonneeMax*10+2)):
+    trace (Zz0--Zz2) shifted ((k/10)*(Zz1-Zz0)) dashed evenly withcolor 0.5white;
+    endfor;
+    fi;
+    if ExposantDivMax=0:
+    for k=1 upto (DonneeMax+1):
+    label.bot(TEX("\num{"&decimal(k)&"}"),Zz0+k*(Zz1-Zz0));
+    endfor;
+    else:
+    if ExposantDivMax<5:
+    for k=1 upto (floor(DonneeMax*10+2)):
+    label.bot(TEX("\num{\fpeval{"&decimal(k)&"*(10**"&decimal(ExposantDivMax-1)&")}}"),Zz0+(k/10)*(Zz1-Zz0));
+    endfor;
+    else:
+    dotlabel.bot(TEX("\num{\fpeval{10**"&decimal(ExposantDivMax)&"}}"),Zz1);
+    fi;
+    fi;
+    fi;
+    for k=0 upto nbdon-1:
+    path RectangleDonnee;
+    RectangleDonnee=(unitsquare xscaled ((Donnees[k+1]/DonneeMax)*Longueur) yscaled Hauteur) shifted(0,-k*(Hauteur+Ecart));
+    if Hachures:
+    fill RectangleDonnee withcolor white;
+    trace Hachurage(RectangleDonnee,60 if
+    (k mod 2)=0: +90 fi,ecarthachures,if (k mod 2)=0 : 0 else: 1 fi)
+    withpen pencircle scaled epaisseurhachures;
+    else:
+    remplis RectangleDonnee withcolor if unknown Col[k+1]: if Bicolore:Col[(k mod 2)+1] else: white fi; else:if Bicolore:Col[(k mod 2)+1] else: Col[k+1] fi; fi;
+    fi;
+    trace RectangleDonnee;
+    endfor;
+    if Grille:
+    drawarrow (0,-(nbdon-1)*(Hauteur+Ecart)-Ecart)--(0,(Hauteur+Ecart)) withpen pencircle scaled 1.5;
+    drawarrow (0,-(nbdon-1)*(Hauteur+Ecart)-Ecart)--(Zz3+u*(0.25,0)) withpen pencircle scaled 1.5;
+    fi;
+    enddef;
+    vardef AffichageNom(text t)=
+    k:=0;
+    for p_=t:
+    label.lft(TEX(p_),0.5[(0,0),(0,Hauteur)] shifted (0,-k*(Hauteur+Ecart)));
+    k:=k+1;
+    endfor;
+    enddef;
+    vardef AffichageDonnees(text t)=
+    k:=0;
+    for p_=t:
+    label.rt(TEX("\num{"&p_&"}"),0.5[(0,0),(0,Hauteur)] shifted (((Donnees[k+1]/DonneeMax)*Longueur),-k*(Hauteur+Ecart)));
+    k:=k+1;
+    endfor;
+    enddef;
+    CalculNombreDonneesEtDonneeMax(#2);
+    ListeDonnees(#2);
+    RecuperationCouleurs(#4);
+    TraceDiag;
+    if LegendeVide=false:
+    AffichageNom(#1);
+    fi;
+    if AffichageDonnee:
+    AffichageDonnees(#3);
+    fi;
+  \end{mplibcode}
+  \else%
+  \begin{mpost}[mpsettings={\NewMPDiagBarreHorCode}]
+    vardef TraceDiag=
+    if Grille:
+    pair Zz[];%Pour déterminer "le dernier point"
+    Zz0=(0,-(nbdon-1)*(Hauteur+Ecart)-Ecart);
+    Zz2=(0,(Hauteur+Ecart));
+    Zz1=((1/DonneeMax)*Longueur,-(nbdon-1)*(Hauteur+Ecart)-Ecart);
+    Zz3=if ExposantDivMax=0 : (DonneeMax+1)[Zz0,Zz1] else: ((floor(DonneeMax*10+2))/10)[Zz0,Zz1];fi;
+    if ExposantDivMax=0:
+    for k=1 upto DonneeMax+1:
+    trace (Zz0--Zz2) shifted (k*(Zz1-Zz0)) dashed evenly withcolor 0.5white;
+    endfor;
+    else:
+    for k=1 upto (floor(DonneeMax*10+2)):
+    trace (Zz0--Zz2) shifted ((k/10)*(Zz1-Zz0)) dashed evenly withcolor 0.5white;
+    endfor;
+    fi;
+    if ExposantDivMax=0:
+    for k=1 upto (DonneeMax+1):
+    label.bot(LATEX("\num{"&decimal(k)&"}"),Zz0+k*(Zz1-Zz0));
+    endfor;
+    else:
+    if ExposantDivMax<5:
+    for k=1 upto (floor(DonneeMax*10+2)):
+    label.bot(LATEX("\num{\noexpand\fpeval{"&decimal(k)&"*(10**"&decimal(ExposantDivMax-1)&")}}"),Zz0+(k/10)*(Zz1-Zz0));
+    endfor;
+    else:
+    dotlabel.bot(LATEX("\num{\noexpand\fpeval{10**"&decimal(ExposantDivMax)&"}}"),Zz1);
+    fi;
+    fi;
+    fi;
+    for k=0 upto nbdon-1:
+    path RectangleDonnee;
+    RectangleDonnee=(unitsquare xscaled ((Donnees[k+1]/DonneeMax)*Longueur) yscaled Hauteur) shifted(0,-k*(Hauteur+Ecart));
+    if Hachures:
+    fill RectangleDonnee withcolor white;
+    trace Hachurage(RectangleDonnee,60 if
+    (k mod 2)=0: +90 fi,ecarthachures,if (k mod 2)=0 : 0 else: 1 fi)
+    withpen pencircle scaled epaisseurhachures;
+    else:
+    remplis RectangleDonnee withcolor if unknown Col[k+1]: if Bicolore:Col[(k mod 2)+1] else: white fi; else:if Bicolore:Col[(k mod 2)+1] else: Col[k+1] fi; fi;
+    fi;
+    trace RectangleDonnee;
+    endfor;
+    if Grille:
+    drawarrow (0,-(nbdon-1)*(Hauteur+Ecart)-Ecart)--(0,(Hauteur+Ecart)) withpen pencircle scaled 1.5;
+    drawarrow (0,-(nbdon-1)*(Hauteur+Ecart)-Ecart)--(Zz3+u*(0.25,0)) withpen pencircle scaled 1.5;
+    fi;
+    enddef;
+    vardef AffichageNom(text t)=
+    k:=0;
+    for p_=t:
+    label.lft(LATEX(p_),0.5[(0,0),(0,Hauteur)] shifted (0,-k*(Hauteur+Ecart)));
+    k:=k+1;
+    endfor;
+    enddef;
+    vardef AffichageDonnees(text t)=
+    k:=0;
+    for p_=t:
+    label.rt(LATEX("\num{"&p_&"}"),0.5[(0,0),(0,Hauteur)] shifted (((Donnees[k+1]/DonneeMax)*Longueur),-k*(Hauteur+Ecart)));
+    k:=k+1;
+    endfor;
+    enddef;
+    CalculNombreDonneesEtDonneeMax(#2);
+    ListeDonnees(#2);
+    RecuperationCouleurs(#4);
+    TraceDiag;
+    if LegendeVide=false:
+    AffichageNom(#1);
+    fi;
+    if AffichageDonnee:
+    AffichageDonnees(#3);
+    fi;
+  \end{mpost}
+  \fi%
+}%
+
+\def\MPStatNewCode{%
+  maxx:=0;
+  maxy:=0;
+  unitex:=\useKV[ClesStat]{Unitex}*cm;
+  unitey:=\useKV[ClesStat]{Unitey}*cm;
+  xpartorigine:=\useKV[ClesStat]{Origine};
+  AngleRotation=\useKV[ClesStat]{AngleRotationAbscisse};
+  boolean Rotation,Lecture,LectureFine,AideLecture,DonneesSup,Reponses,Qualitatif,Tiret,LegendeVide,Retour,GrandNombrex,GrandNombrey,Date;
+  GrandNombrex=\useKV[ClesStat]{GrandNombrex};
+  GrandNombrey=\useKV[ClesStat]{GrandNombrey};
+  if GrandNombrex:
+  GrandNombreA=\useKV[ClesStat]{GrandNombreA};
+  fi;
+  if GrandNombrey:
+  GrandNombreO=\useKV[ClesStat]{GrandNombreO};
+  fi;
+  Date:=\useKV[ClesStat]{Date};
+  Rotation=\useKV[ClesStat]{AbscisseRotation};
+  Lecture:=\useKV[ClesStat]{Lecture};
+  LectureFine:=\useKV[ClesStat]{LectureFine};
+  AideLecture:=\useKV[ClesStat]{AideLecture};
+  DonneesSup:=\useKV[ClesStat]{DonneesSup};
+  Reponses:=\useKV[ClesStat]{Reponses};
+  LegendeVide=\useKV[ClesStat]{LegendeVide};
+  epaisseurbatons=\useKV[ClesStat]{EpaisseurBatons};
+  Qualitatif=\useKV[ClesStat]{Qualitatif};
+  Tiret=\useKV[ClesStat]{Tiret};
+  Retour=false;
+  color CoulDefaut;
+  CoulDefaut=\useKV[ClesStat]{CouleurDefaut};
+  Depart=\useKV[ClesStat]{Depart};
+  %
+  pair A[],B[],P[];
+  vardef toto(text t)=%points quantitatif
+  n:=0;
+  for p_=t:
+  if pair p_:
+  n:=n+1;
+  P[n]=((xpart(p_)-(xpartorigine))*unitex,ypart(p_)*unitey);
+  if xpart(p_)>maxx:
+  maxx:=xpart(p_)-(xpartorigine);
+  fi;
+  if ypart(p_)>maxy:
+  maxy:=ypart(p_);
+  fi;
+  A[n]=unitex*(xpart(p_)-(xpartorigine),0);
+  B[n]=unitey*(0,ypart(p_));
+  fi;
+  endfor;
+  enddef;
+  vardef tutu(text t)=%points qualitatif
+  n:=0;
+  for p_=t:
+  if numeric p_:
+  P[n]=((n)*unitex,unitey*(p_-Depart));
+  B[n]=(0,unitey*(p_-Depart));
+  if p_>maxy:
+  maxy:=p_;
+  fi;
+  else:
+  n:=n+1;
+  A[n]=unitex*(n,0);
+  fi;
+  endfor;
+  maxy:=maxy-Depart;
+  maxx:=n;
+  enddef;
+}
+
+% Construction du graphique en bâtons
+\newcommand\MPStatNew[3]{%
+  \ifluatex
+  \mplibforcehmode
+  \begin{mplibcode}
+    \MPStatNewCode
+      %
+    vardef Test(expr nb)=
+    Retour:=false;
+    op:=0;
+    for l_=#3:
+    if l_=nb:
+    op:=op+1;
+    fi;
+    endfor;
+    if op>0:
+    Retour:=true;
+    fi;
+    enddef;    
+    % 
+    % on r\'ecup\`ere les couleurs
+    color Col[];
+    n:=0;
+    for p_=#2:
+    n:=n+1;
+    if color p_:
+    Col[n]=p_;
+    else:
+    Col[n]=CoulDefaut;
+    fi;
+    endfor;
+    vardef tata(text t)=%affichage quantitatif
+    l=0;
+    for p_=t:
+    if pair p_:
+    l:=l+1;
+    if Rotation:
+    if Date:
+    label.bot(TEX(decimal(xpart(p_))) rotated AngleRotation,A[l]);
+    else:
+    label.bot(TEX("\num{"&decimal(xpart(p_))&"}") rotated AngleRotation,A[l]);
+    fi;
+    else :
+    if Date:
+    label.bot(TEX(decimal(xpart(p_))),A[l]);
+    else:
+    label.bot(TEX("\num{"&decimal(xpart(p_))&"}"),A[l]);
+    fi;
+    fi;
+    if Reponses:
+    if DonneesSup:
+    Test(l);
+    if Retour=false:
+    if GrandNombrey:
+    label.top(TEX("\num{"&decimal(ypart(p_))&"}"),P[l]);
+    else:
+    label.top(TEX("\num{"&decimal(ypart(p_))&"}"),P[l]);
+    fi;
+    fi;
+    else:
+    if Tiret:
+    trace (B[l]+(-1pt,0))--(B[l]+(1pt,0));
+    label.lft(TEX("\num{"&decimal(p_)&"}"),B[l]);
+    else:
+    dotlabel.lft(TEX("\num{"&decimal(ypart(p_))&"}"),B[l]);
+    fi;
+    fi;
+    fi;
+    fi;
+    endfor;
+    enddef;
+    vardef titi(text t)=%affichage qualitatif
+    l:=0;
+    for p_=t:
+    if numeric p_:
+    if Reponses:
+    if DonneesSup:
+    Test(l);
+    if Retour=false:
+    label.top(TEX("\num{"&decimal(p_)&"}"),P[l]);
+    fi;
+    else:
+    if Tiret:
+    trace (B[l]+(-1pt,0))--(B[l]+(1pt,0));
+    label.lft(TEX("\num{"&decimal(p_)&"}"),B[l]);
+    else:
+    dotlabel.lft(TEX("\num{"&decimal(p_)&"}"),B[l]);
+    fi;
+    fi;
+    fi;
+    else:
+    l:=l+1;
+    if Rotation:
+    if AngleRotation<>0:
+    picture TEXTELABEL;
+    TEXTELABEL=image(
+    labeloffset:=labeloffset*2;
+    label.lft(TEX(p_),A[l]);
+    labeloffset:=labeloffset/2;
+    );
+    trace rotation(TEXTELABEL,A[l],AngleRotation);
+    else :
+    label.bot(TEX(p_),A[l]);
+    fi;
+    fi;
+    fi;
+    endfor;
+    enddef;
+    if Qualitatif: tutu(#1); else: toto(#1); fi;
+    boolean Grille;
+    Grille:=\useKV[ClesStat]{Grille};
+    Pasx:=\useKV[ClesStat]{Pasx};
+    Pasy:=\useKV[ClesStat]{Pasy};
+    if Grille:
+    drawoptions(withcolor 0.75white);
+    for k=0 step Pasx until ((maxx+1)):
+    trace (k*unitex,0)--(k*unitex,unitey*(maxy+2*Pasy));
+    endfor;
+    for k=0 step Pasy until ((maxy+2*Pasy)):
+    trace (0,k*unitey)--(unitex*(maxx+1),k*unitey);
+    endfor;
+    drawoptions();
+    fi;
+    if epaisseurbatons<>0:
+    for k=1 upto n:
+    fill polygone(A[k]-(epaisseurbatons*1pt,0),A[k]+(epaisseurbatons*1pt,0),P[k]+(epaisseurbatons*1pt,0),P[k]-(epaisseurbatons*1pt,0)) withcolor if unknown Col[k]: CoulDefaut else:Col[k] fi;
+    if AideLecture:
+    draw B[k]--P[k] dashed evenly;
+    fi;
+    endfor;
+    fi;
+    if LectureFine:
+    for k=0 step Pasy until ((maxy+1*Pasy)):
+    if Tiret:
+    trace (1pt,k*unitey)--(-1pt,k*unitey);
+    if GrandNombrey:
+    label.lft(TEX("\num{\fpeval{\useKV[ClesStat]{GrandNombreO}*"&decimal(k+Depart)&"}}"),(0,k*unitey));
+    else:
+    label.lft(TEX("\num{"&decimal(k+Depart)&"}"),(0,k*unitey));
+    fi;
+    else:
+    if GrandNombrey:
+    dotlabel.lft(TEX("\num{\fpeval{\useKV[ClesStat]{GrandNombreO}*"&decimal(k+Depart)&"}}"),(0,k*unitey));
+    else:
+    dotlabel.lft(TEX("\num{"&decimal(k+Depart)&"}"),(0,k*unitey));
+    fi;
+    fi;
+    endfor;
+    fi;
+    if Lecture:
+    for k=0 step Pasy until Pasy:
+    if Tiret:
+    trace (1pt,k*unitey)--(-1pt,k*unitey);
+    if GrandNombrey:
+    label.lft(TEX("\num{\fpeval{\useKV[ClesStat]{GrandNombreO}*"&decimal(k)&"}}"),(0,k*unitey));
+    else:
+    label.lft(TEX("\num{"&decimal(k)&"}"),(0,k*unitey));
+    fi;
+    else:
+    if GrandNombrey:
+    dotlabel.lft(TEX("\num{\fpeval{\useKV[ClesStat]{GrandNombreO}*"&decimal(k)&"}}"),(0,k*unitey));
+    else:
+    dotlabel.lft(TEX("\num{"&decimal(k)&"}"),(0,k*unitey));
+    fi;
+    fi;
+    endfor;
+    fi;
+    drawarrow (0,0)--unitex*(maxx+1,0);
+    drawarrow (0,0)--unitey*(0,maxy+2*Pasy);
+    label.lrt(btex \useKV[ClesStat]{Donnee} etex,unitex*(maxx+1,0));
+    label.urt(btex \useKV[ClesStat]{Effectif} etex,unitey*(0,maxy+2*Pasy));
+    if Qualitatif: titi(#1); else:tata(#1); fi;
+  \end{mplibcode}
+  \else
+  \begin{mpost}[mpsettings={\MPStatNewCode}]
+    % on r\'ecup\`ere les couleurs
+    color Col[];
+    n:=0;
+    for p_=#2:
+    n:=n+1;
+    if color p_:
+    Col[n]=p_;
+    else:
+    Col[n]=CoulDefaut;
+    fi;
+    endfor;
+    % 
+    vardef tata(text t)=%affichage quantitatif
+    l=0;
+    for p_=t:
+    if pair p_:
+    l:=l+1;
+    if Rotation:
+    label.bot(LATEX("\num{"&decimal(xpart(p_))&"}") rotated AngleRotation,A[l]);
+    else :
+    label.bot(LATEX("\num{"&decimal(xpart(p_))&"}"),A[l]);
+    fi;
+    if Reponses:
+    if DonneesSup:
+    label.top(LATEX("\num{"&decimal(ypart(p_))&"}"),P[l]);
+    else:
+    if Tiret:
+    trace (B[l]+(-1pt,0))--(B[l]+(1pt,0));
+    label.lft(LATEX("\num{"&decimal(p_)&"}"),B[l]);
+    else:
+    dotlabel.lft(LATEX("\num{"&decimal(ypart(p_))&"}"),B[l]);
+    fi;
+    fi;
+    fi;
+    fi;
+    endfor;
+    enddef;
+    vardef titi(text t)=%affichage qualitatif
+    l:=0;
+    for p_=t:
+    if numeric p_:
+    if Reponses:
+    if DonneesSup:
+    label.top(LATEX("\num{"&decimal(p_)&"}"),P[l]);
+    else:
+    if Tiret:
+    trace (B[l]+(-1pt,0))--(B[l]+(1pt,0));
+    label.lft(LATEX("\num{"&decimal(p_)&"}"),B[l]);
+    else:
+    dotlabel.lft(LATEX("\num{"&decimal(p_)&"}"),B[l]);
+    fi;
+    fi;
+    fi;
+    else:
+    l:=l+1;
+    if Rotation:
+    if AngleRotation<>0:
+    picture TEXTELABEL;
+    TEXTELABEL=image(
+    labeloffset:=labeloffset*2;
+    label.lft(LATEX(p_),A[l]);
+    labeloffset:=labeloffset/2;
+    );
+    trace rotation(TEXTELABEL,A[l],AngleRotation);
+    else :
+    label.bot(LATEX(p_),A[l]);
+    fi;
+    fi;
+    fi;
+    endfor;
+    enddef;
+    if Qualitatif: tutu(#1); else: toto(#1); fi;
+    boolean Grille;
+    Grille:=\useKV[ClesStat]{Grille};
+    Pasx:=\useKV[ClesStat]{Pasx};
+    Pasy:=\useKV[ClesStat]{Pasy};    
+    if Grille:
+    drawoptions(withcolor 0.75white);
+    for k=0 step Pasx until ((maxx+1)):
+    trace (k*unitex,0)--(k*unitex,unitey*(maxy+2*Pasy));
+    endfor;
+    for k=0 step Pasy until ((maxy+2*Pasy)):
+    trace (0,k*unitey)--(unitex*(maxx+1),k*unitey);
+    endfor;
+    drawoptions();
+    fi;
+    if epaisseurbatons<>0:
+    for k=1 upto n:
+    fill polygone(A[k]-(epaisseurbatons*1pt,0),A[k]+(epaisseurbatons*1pt,0),P[k]+(epaisseurbatons*1pt,0),P[k]-(epaisseurbatons*1pt,0)) withcolor if unknown Col[k]: CoulDefaut else:Col[k] fi;
+    if AideLecture:
+    draw B[k]--P[k] dashed evenly;
+    fi;
+    endfor;
+    fi;
+    if LectureFine:
+    for k=0 step Pasy until ((maxy+1*Pasy)):
+    if Tiret:
+    trace (1pt,k*unitey)--(-1pt,k*unitey);
+    label.lft(LATEX("\num{"&decimal(k)&"}"),(0,k*unitey));
+    else:
+    dotlabel.lft(LATEX("\num{"&decimal(k)&"}"),(0,k*unitey));
+    fi;
+    endfor;
+    fi;
+    if Lecture:
+    for k=0 step Pasy until Pasy:
+    if Tiret:
+    trace (1pt,k*unitey)--(-1pt,k*unitey);
+    label.lft(LATEX("\num{"&decimal(k)&"}"),(0,k*unitey));
+    else:
+    dotlabel.lft(LATEX("\num{"&decimal(k)&"}"),(0,k*unitey));
+    fi;
+    endfor;
+    fi;
+    drawarrow (0,0)--unitex*(maxx+1,0);
+    drawarrow (0,0)--unitey*(0,maxy+2*Pasy);
+    label.lrt(btex \useKV[ClesStat]{Donnee} etex,unitex*(maxx+1,0));
+    label.urt(btex \useKV[ClesStat]{Effectif} etex,unitey*(0,maxy+2*Pasy));
+    if Qualitatif: titi(#1); else:tata(#1); fi;
+  \end{mpost}
+  \fi
+}
+
+\def\NewMPStatCirculaireCodeQ{%
+  Rayon:=\useKV[ClesStat]{Rayon};
+  ecarthachures=\useKV[ClesStat]{EcartHachures};
+  epaisseurhachures=\useKV[ClesStat]{EpaisseurHachures};
+  boolean AffichageAngle,AffichageDonnee,Hachures,Inverse,Legende,LegendeVide,Retour,ACompleter;
+  AffichageAngle=\useKV[ClesStat]{AffichageAngle};
+  AffichageDonnee=\useKV[ClesStat]{AffichageDonnee};
+  Hachures=\useKV[ClesStat]{Hachures};
+  Inverse=\useKV[ClesStat]{LectureInverse};
+  Legende=\useKV[ClesStat]{Legende};
+  LegendeVide=\useKV[ClesStat]{LegendeVide};
+  Retour=false;
+  ACompleter=\useKV[ClesStat]{ACompleter};
+  % 
+  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*Rayon));
+  %
+  vardef AfficheLegende(text t)=
+  picture ResultatLegende;
+  ResultatLegende=image(
+  for p_=t:
+  if string p_:
+  n:=n+1;
+  C[n]=A[n-1] rotatedabout(O,if Inverse:-1* fi(ang[n]-ang[n-1])/2);
+  draw 0.95[O,C[n]]--1.05[O,C[n]];
+  C[n]:=1.05[O,C[n]];
+  Test(n);
+  if ((xpart(C[n])>xpart(O)) or (xpart(C[n])=xpart(O))) and ((ypart(C[n])>ypart(O)) or (ypart(C[n])=ypart(O))):
+  D[n]=C[n]+(0.5cm,0);
+  draw C[n]--D[n];
+  if Retour=false:label.urt(TEX(p_),D[n]);fi;
+  fi;
+  if (xpart(C[n])<xpart(O)) and ((ypart(C[n])>ypart(O)) or (ypart(C[n])=ypart(O))):
+  D[n]=C[n]-(0.5cm,0);
+  draw C[n]--D[n];
+  if Retour=false:label.ulft(TEX(p_),D[n]);fi;
+  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];
+  if Retour=false:label.llft(TEX(p_),D[n]);fi;
+  fi;
+  if ((xpart(C[n])>xpart(O)) or (xpart(C[n])=xpart(O))) and (ypart(C[n])<ypart(O)):
+  D[n]=C[n]+(0.5cm,0);
+  draw C[n]--D[n];
+  if Retour=false:label.lrt(TEX(p_),D[n]);fi;
+  fi;
+  fi;
+  endfor;
+  );
+  ResultatLegende
+  % fi;
+  enddef;
+  vardef AfficheLegendePDF(text t)=
+  picture ResultatLegende;
+  ResultatLegende=image(
+  for p_=t:
+  if string p_:
+  n:=n+1;
+  C[n]=A[n-1] rotatedabout(O,if Inverse:-1* fi(ang[n]-ang[n-1])/2);
+  draw 0.95[O,C[n]]--1.05[O,C[n]];
+  C[n]:=1.05[O,C[n]];
+  Test(n);
+  if (xpart(C[n])>xpart(O)) and ((ypart(C[n])>ypart(O)) or (ypart(C[n])=ypart(O))):
+  D[n]=C[n]+(0.5cm,0);
+  draw C[n]--D[n];
+  if Retour=false:label.urt(LATEX(p_),D[n]);fi;
+  fi;
+  if (xpart(C[n])<xpart(O)) and ((ypart(C[n])>ypart(O)) or (ypart(C[n])=ypart(O))):
+  D[n]=C[n]-(0.5cm,0);
+  draw C[n]--D[n];
+  if Retour=false:label.ulft(LATEX(p_),D[n]);fi;
+  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];
+  if Retour=false:label.llft(LATEX(p_),D[n]);fi;
+  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];
+  if Retour=false:label.lrt(LATEX(p_),D[n]);fi;
+  fi;
+  fi;
+  endfor;
+  );
+  ResultatLegende
+  % fi;
+  enddef;
+}
+
+% la construction du graphique qualitatif
+\def\NewMPStatCirculaireQ#1#2#3#4{%
+  %#1 : la liste des données
+  %#2 : 360 ou 180
+  %#3 : liste des couleurs
+  %#4 : liste des légendes à effacer.
+  \ifluatex
+  \mplibforcehmode
+  \begin{mplibcode}
+    \NewMPStatCirculaireCodeQ
+    if Inverse=false:
+    A[0]=point(0) of cc;
+    else:
+    A[0]=point(180) of cc;
+    fi;
+    % on r\'ecup\`ere les couleurs
+    color Col[];
+    n:=0;
+    for p_=#3:
+    n:=n+1;
+    Col[n]=p_;
+    endfor;
+    vardef toto(text t)=
+    n:=0;
+    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]=(#2/total[N])*total[k];
+    endfor;
+    n:=0;
+    for p_=t:
+    if numeric p_:
+    n:=n+1;
+    if Inverse=false:
+    A[n]=A[n-1] rotatedabout(O,p_*(#2/total[N]));
+    else:
+    A[n]=A[n-1] rotatedabout(O,-p_*(#2/total[N]));
+    fi;
+    %hachure ou pas ?
+    if Hachures=false:
+    fill (O--if Inverse=false:arccercle(A[n-1],A[n],O) else:
+    arccercle(A[n],A[n-1],O) fi--cycle) withcolor if unknown Col[n]: white else:Col[n] fi;
+    else:
+    draw
+    Hachurage((O--if Inverse=false:arccercle(A[n-1],A[n],O)
+    else:arccercle(A[n],A[n-1],O) fi--cycle),p_*(#2/total[N]) if
+    (n mod 2)=0: +90 else: -90 fi,ecarthachures,if (n mod 2)=0 : 0 else: 1 fi)
+    withpen pencircle scaled epaisseurhachures if AffichageAngle: withcolor 0.5white fi;
+    fi;
+    if ACompleter=false:
+    draw A[n-1]--O--A[n] if Hachures: withpen pencircle scaled2 fi;
+    fi;
+    % Affichage des angles associ\'es
+    if AffichageAngle:
+    if round(p_*(#2/total[N]))>15:
+    if (n mod 2)=0:
+    marque_a:=20*0.75*Rayon/cm;
+    else:
+    marque_a:=20*0.5*Rayon/cm;
+    fi;
+    if Hachures:
+    if Inverse=false:
+    undraw
+    Codeangle(A[n-1],O,A[n],0,(((TEX("\ang{"&decimal(round(p_*(#2/total[N])))&"}")))));
+    else:
+    undraw
+    Codeangle(A[n],O,A[n-1],0,(((TEX("\ang{"&decimal(round(p_*(#2/total[N])))&"}")))));
+    fi;
+    fill cercles(w shifted(marque_ang*unitvector(w-O)),3mm) withcolor
+    blanc;
+    fi;
+    if Inverse=false:
+    draw
+    Codeangle(A[n-1],O,A[n],0,(((TEX("\ang{"&decimal(round(p_*(#2/total[N])))&"}")))));
+    else:
+    draw
+    Codeangle(A[n],O,A[n-1],0,(((TEX("\ang{"&decimal(round(p_*(#2/total[N])))&"}")))));
+    fi;
+    fi;
+    elseif AffichageDonnee:
+    if round(p_*(#2/total[N]))>15:
+    if (n mod 2)=0:
+    marque_a:=20*0.75*Rayon/cm;
+    else:
+    marque_a:=20*0.5*Rayon/cm;
+    fi;
+    if Hachures:
+    if Inverse=false:
+    undraw
+    Codeangle(A[n-1],O,A[n],0,TEX(""&decimal(p_)&""));
+    else:
+    undraw
+    Codeangle(A[n],O,A[n-1],0,(((TEX(""&decimal(p_)&"")))));
+    fi;
+    fill cercles(w shifted(marque_ang*unitvector(w-O)),3mm) withcolor
+    blanc;
+    fi;
+    if Inverse=false:
+    draw
+    Codeangle(A[n-1],O,A[n],0,(((TEX(""&decimal(p_)&"")))));
+    else:
+    draw
+    Codeangle(A[n],O,A[n-1],0,(((TEX(""&decimal(p_)&"")))));
+    fi;
+    fi;
+    fi;
+    %
+    fi;
+    endfor;
+    if #2=360:
+    draw cc if Hachures: withpen pencircle scaled2 fi;
+    else:
+    draw (subpath(0,length cc/2) of cc)--cycle if Hachures: withpen pencircle scaled2 fi;;
+    fi;
+    n:=0;
+    enddef;
+    vardef Test(expr nb)=
+    Retour:=false;
+    op:=0;
+    for l_=#4:
+    if l_=nb:
+    op:=op+1;
+    fi;
+    endfor;
+    if op>0:
+    Retour:=true;
+    fi;
+    enddef;
+    Figure(-10u,-10u,10u,10u);
+    toto(#1);
+    if Legende:
+    n:=0;
+    draw AfficheLegende(#1);
+    fi;
+  \end{mplibcode}
+  \else
+  \begin{mpost}[mpsettings={\NewMPStatCirculaireCodeQ}]
+    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*Rayon));
+    % on r\'ecup\`ere les couleurs
+    color Col[];
+    n:=0;
+    for p_=#3:
+    n:=n+1;
+    Col[n]=p_;
+    endfor;
+    if Inverse=false:
+    A[0]=point(0) of cc;
+    else:
+    A[0]=point(180) of cc;
+    fi;
+    vardef toto(text t)=
+    n:=0;
+    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]=(#2/total[N])*total[k];
+    endfor;
+    n:=0;
+    for p_=t:
+    if numeric p_:
+    n:=n+1;
+    if Inverse=false:
+    A[n]=A[n-1] rotatedabout(O,p_*(#2/total[N]));
+    else:
+    A[n]=A[n-1] rotatedabout(O,-p_*(#2/total[N]));
+    fi;
+    %hachure ou pas ?
+    if Hachures=false:
+    fill (O--if Inverse=false:arccercle(A[n-1],A[n],O) else:
+    arccercle(A[n],A[n-1],O) fi--cycle) withcolor if unknown Col[n]: white else:Col[n] fi;
+    else:
+    draw
+    Hachurage((O--if Inverse=false:arccercle(A[n-1],A[n],O)
+    else:arccercle(A[n],A[n-1],O) fi--cycle),p_*(#2/total[N]) if
+    (n mod 2)=0: +90 else: -90 fi,ecarthachures,if (n mod 2)=0 : 0 else: 1 fi)
+    withpen pencircle scaled epaisseurhachures if AffichageAngle: withcolor 0.5white fi;
+    fi;
+    if ACompleter=false:
+    draw A[n-1]--O--A[n] if Hachures: withpen pencircle scaled2 fi;
+    fi;
+    % Affichage des angles associ\'es
+    if AffichageAngle:
+    if round(p_*(#2/total[N]))>15:
+    if (n mod 2)=0:
+    marque_a:=20*0.75*Rayon/cm;
+    else:
+    marque_a:=20*0.5*Rayon/cm;
+    fi;
+    if Hachures:
+    if Inverse=false:
+    undraw
+    Codeangle(A[n-1],O,A[n],0,(((LATEX("\ang{"&decimal(round(p_*(#2/total[N])))&"}")))));
+    else:
+    undraw
+    Codeangle(A[n],O,A[n-1],0,(((LATEX("\ang{"&decimal(round(p_*(#2/total[N])))&"}")))));
+    fi;
+    fill cercles(w shifted(marque_ang*unitvector(w-O)),3mm) withcolor
+    blanc;
+    fi;
+    if Inverse=false:
+    draw
+    Codeangle(A[n-1],O,A[n],0,(((LATEX("\ang{"&decimal(round(p_*(#2/total[N])))&"}")))));
+    else:
+    draw
+    Codeangle(A[n],O,A[n-1],0,(((LATEX("\ang{"&decimal(round(p_*(#2/total[N])))&"}")))));
+    fi;
+    fi;
+    elseif AffichageDonnee:
+    if round(p_*(#2/total[N]))>15:
+    if (n mod 2)=0:
+    marque_a:=20*0.75*Rayon/cm;
+    else:
+    marque_a:=20*0.5*Rayon/cm;
+    fi;
+    if Hachures:
+    if Inverse=false:
+    undraw
+    Codeangle(A[n-1],O,A[n],0,LATEX(""&decimal(p_)&""));
+    else:
+    undraw
+    Codeangle(A[n],O,A[n-1],0,(((LATEX(""&decimal(p_)&"")))));
+    fi;
+    fill cercles(w shifted(marque_ang*unitvector(w-O)),3mm) withcolor
+    blanc;
+    fi;
+    if Inverse=false:
+    draw
+    Codeangle(A[n-1],O,A[n],0,(((LATEX(""&decimal(p_)&"")))));
+    else:
+    draw
+    Codeangle(A[n],O,A[n-1],0,(((LATEX(""&decimal(p_)&"")))));
+    fi;
+    fi;
+    fi;
+    %
+    fi;
+    endfor;
+    if #2=360:
+    draw cc if Hachures: withpen pencircle scaled2 fi;
+    else:
+    draw (subpath(0,length cc/2) of cc)--cycle if Hachures: withpen pencircle scaled2 fi;;
+    fi;
+    enddef;
+    vardef Test(expr nb)=
+    Retour:=false;
+    op:=0;
+    for l_=#4:
+    if l_=nb:
+    op:=op+1;
+    fi;
+    endfor;
+    if op>0:
+    Retour:=true;
+    fi;
+    enddef;    
+    Figure(-10u,-10u,10u,10u);
+    toto(#1);
+    if Legende:
+    n:=0;
+    draw AfficheLegendePDF(#1);
+    fi;
+  \end{mpost}
+  \fi
+}%
+
+%Pour la m\'ediane.
+\DTLgnewdb{mtdb}%
+\dtlexpandnewvalue%
+\newcount\nbdonnees%
+% 
+\def\AjoutListEEaa#1\nil{\addtotok\tabtoksEEa{#1,}}%
+\def\AjoutListEEab#1\nil{\addtotok\tabtoksEEa{#1/}}%
+\def\AjoutListEEb#1\nil{\addtotok\tabtoksEEb{#1,}}%
+\def\AjoutListEEx#1\nil{\addtotok\tabtoksEE{#1,}}%
+\def\AjoutListEEy#1\nil{\addtotok\tabtoksEE{#1/}}%
+
+\DTLgnewdb{mtdbEE}%
+\DTLgnewdb{mtdbEEqual}%
+%
+
+% Pour les classes
+% Pour construire l'histogramme
+\def\UpdatetoksHisto#1/#2/#3\nil{\addtotok\toklisteelmtsclasse{#1,#2,}\addtotok\toklistedonhisto{#3,}}
+\def\UpdatetoksECC#1\nil{\addtotok\toklistedonhisto{#1,}}
+
+\NewDocumentCommand\buildgraphhisto{}{%
+  \newtoks\toklisteelmtsclasse%
+  \newtoks\toklistedonhisto%
+  \newtoks\toklistecouleur%
+  \newtoks\toklistelegende%
+  \ifboolKV[ClesStat]{LegendeVide}{%
+    \xdef\foo{\useKV[ClesStat]{LegendesVides}}%
+    \readlist*\ListeLegendesAEffacer{\foo}%
+  }{\xdef\foo{-1}\readlist*\ListeLegendesAEffacer{\foo}%
+  }%
+  \foreachitem\compteur\in\ListeLegendesAEffacer{\expandafter\UpdateLegende\compteur\nil}%
+  \foreachitem\compteur\in\ListeDepart{\expandafter\UpdatetoksHisto\compteur\nil}%
+  \ifboolKV[ClesStat]{ECC}{%
+    \toklistedonhisto{}%
+    \xdef\PfCFooECC{\ListeDepart[1,3]}%
+    \xintFor* ##1 in{\xintSeq{2}{\ListeDepartlen}}\do{%
+      \xdef\PfCFooRetiens{0}%
+      \xintFor* ##2 in{\xintSeq{1}{##1}}\do{%
+        \xdef\PfCFooRetiens{\fpeval{\PfCFooRetiens+\ListeDepart[##2,3]}}%
+      }%
+      \xdef\PfCFooECC{\PfCFooECC,\PfCFooRetiens}%
+    }%
+    \readlist*\PfCListeECC{\PfCFooECC}%
+    \foreachitem\compteur\in\PfCListeECC{\expandafter\UpdatetoksECC\compteur\nil}%
+  }{}%
+  \xdef\PfCEcartClasse{\fpeval{\ListeDepart[1,2]-\ListeDepart[1,1]}}%
+  \foreachitem\compteur\in\ListeDepart{%
+    \xdef\PfCEcartClasse{\PfCEcartClasse,\fpeval{\ListeDepart[\compteurcnt,2]-\ListeDepart[\compteurcnt,1]}}
+  }%
+  \xintifboolexpr{\fpeval{min(\PfCEcartClasse)}==\fpeval{max(\PfCEcartClasse)}}{}{\setKV[ClesStat]{MemeAmpli=false}}
+  % Pour les couleurs
+  \xdef\ListeAvantCouleurs{\useKV[ClesStat]{ListeCouleurs}}%
+  \readlist*\ListeCouleur{\ListeAvantCouleurs}%
+  \foreachitem\couleur\in\ListeCouleur{\expandafter\UpdateCoul\couleur\nil}%
+  %
+  \MPBuildHisto{\the\toklisteelmtsclasse}{\the\toklistedonhisto}{\the\toklistecouleur}{\the\toklistelegende}%
+}
+
+%% calcul des fr\'equences
+\newcommand\CalculFrequenceClasses[1]{%
+  \fpeval{round(\ListeDepart[#1,3]*100/\EffectifTotal,\useKV[ClesStat]{PrecisionF})}
+}
+
+\newcommand\CalculECCClasses[1]{%
+  \xdef\TotalECCC{0}%
+  \CompteurECCC=1%
+  \CompteurECCCTotal=\numexpr#1+1%
+  \whiledo{\CompteurECCC < \CompteurECCCTotal}{%
+    \xdef\TotalECCC{\fpeval{\TotalECCC+\ListeDepart[\the\CompteurECCC,3]}}%
+    \CompteurECCC=\numexpr\CompteurECCC+1%
+  }%
+  \num{\TotalECCC}%
+}
+
+\NewDocumentCommand\buildtabclasses{}{%
+  \setcounter{PfCCompteLignes}{0}%
+  \renewcommand{\arraystretch}{\useKV[ClesStat]{Stretch}}%
+  \begin{NiceTabular}{l*{\ListeDepartlen}{c}}%[hvlines]
+    \CodeBefore%
+    \rowcolor{\useKV[ClesStat]{CouleurTab}}{1}%
+    \columncolor{\useKV[ClesStat]{CouleurTab}}{1}%
+    \Body
+    \useKV[ClesStat]{Donnee}\xintFor* ##1 in{\xintSeq{1}{\ListeDepartlen}}\do{%
+      &$\num{\ListeDepart[##1,1]}\leqslant\dots<\num{\ListeDepart[##1,2]}$
+    }\\
+    \useKV[ClesStat]{Effectif}\xintFor* ##1 in{\xintSeq{1}{\ListeDepartlen}}\do{%
+      &\ifboolKV[ClesStat]{EffVide}{}{\num{\ListeDepart[##1,3]}}%
+    }\\
+    \ifboolKV[ClesStat]{Frequence}{\stepcounter{PfCCompteLignes}Fr\'equence (\%)\xintFor* ##1 in {\xintSeq {1}{\ListeDepartlen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{\num{\CalculFrequenceClasses{##1}}}}}\\
+    }{}%
+    \ifboolKV[ClesStat]{ECC}{\stepcounter{PfCCompteLignes}E.C.C.\xintFor* ##1 in {\xintSeq {1}{\ListeDepartlen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{ECCVide}{}{\CalculECCClasses{##1}}}}\\}{}%
+    \CodeAfter%
+    % On crée la liste des colonnes à vider
+    \xintifboolexpr{\useKV[ClesStat]{ColVide}>0}{%
+      \xdef\FooStat{\useKV[ClesStat]{ColVide}}%
+      \setsepchar{,}%
+      \readlist*\ListeColonnesAVider{\FooStat}%
+      \foreachitem\compteur\in\ListeColonnesAVider{%
+        \tikz\fill[white] (row-2-|col-\fpeval{\compteur+1}) rectangle (last-|col-\fpeval{\compteur+2});%
+      }%
+    }{}%
+%    % On crée la liste des cases à vider
+    \ifboolKV[ClesStat]{CaseVide}{%
+      \xdef\FooStatCases{\useKV[ClesStat]{CasesVides}}%
+      \setsepchar[*]{,*/}%
+      \readlist*\ListeCasesAVider{\FooStatCases}%
+      \foreachitem\compteur\in\ListeCasesAVider{%
+        \tikz\fill[white] (row-\fpeval{\ListeCasesAVider[\compteurcnt,1]+1}-|col-\fpeval{\ListeCasesAVider[\compteurcnt,2]+1}) rectangle (row-\fpeval{\ListeCasesAVider[\compteurcnt,1]+2}-|col-\fpeval{\ListeCasesAVider[\compteurcnt,2]+2});%
+      }%
+    }{}%
+%    % On retrace le tableau
+%    % Les colonnes
+    \xintFor* ##1 in {\xintSeq{1}{\fpeval{\ListeDepartlen+2}}}\do{%
+      \tikz\draw (row-1-|col-##1) -- (last-|col-##1);%
+    }%
+%    % Les lignes
+    \xintFor* ##1 in {\xintSeq{1}{\fpeval{\thePfCCompteLignes+3}}}\do{%
+      \tikz\draw (row-##1-|col-1) -- (row-##1-|last);%
+    }%
+  \end{NiceTabular}
+}%
+
+\NewDocumentCommand\MPBuildHisto{mmmm}{%
+  \ifluatex
+  \mplibforcehmode
+  \begin{mplibcode}
+    maxx:=-infinity;
+    minx:=infinity;
+    maxy:=-infinity;
+    miny:=0;
+    unitex:=\useKV[ClesStat]{Unitex}*cm;
+    unitey:=\useKV[ClesStat]{Unitey}*cm;
+    Pasx:=\useKV[ClesStat]{Pasx};
+    Pasy:=\useKV[ClesStat]{Pasy};
+    UniteAire=\useKV[ClesStat]{UniteAire};
+    Ecarthachures=\useKV[ClesStat]{EcartHachures};
+    Epaisseurhachures=\useKV[ClesStat]{EpaisseurHachures};
+    boolean MemeAmpli,Hachures,Lecture,LectureFine,AideLecture,DonneesSup,Tiret,LegendeVide,Retour,Mediane,ECC;
+    ECC=\useKV[ClesStat]{ECC};
+    Mediane=\useKV[ClesStat]{Mediane};
+    MemeAmpli=\useKV[ClesStat]{MemeAmpli};
+    Hachures:=\useKV[ClesStat]{Hachures};
+    %
+    Lecture:=\useKV[ClesStat]{Lecture};
+    LectureFine:=\useKV[ClesStat]{LectureFine};
+    Tiret=\useKV[ClesStat]{Tiret};
+    AideLecture:=\useKV[ClesStat]{AideLecture};
+    DonneesSup:=\useKV[ClesStat]{DonneesSup};
+    LegendeVide=\useKV[ClesStat]{LegendeVide};
+    Retour=false;
+    % Test affichage
+    vardef Test(expr nb)=
+    Retour:=false;
+    op:=0;
+    for l_=#4:
+    if l_=nb:
+    op:=op+1;
+    fi;
+    endfor;
+    if op>0:
+    Retour:=true;
+    fi;
+    enddef;
+    %Affichage ou pas des légendes
+    vardef AfficheLegende(text t)=
+    l=0;
+    for p_=t:
+    l:=l+1;
+    if DonneesSup:
+    Test(l);
+    if Retour=false:
+    label.top(TEX("\num{"&decimal(Y[l])&"}"),(unitex*(Depart+(0.5*(X[2*l]+X[2*l-2])-X[1])/Pasx),unitey*Z[l]));
+    fi;
+    fi;
+    endfor;
+    enddef;
+    % on r\'ecup\`ere les couleurs
+    Depart=\useKV[ClesStat]{DepartHisto};
+    color Col[],CoulDefaut;
+    CoulDefaut=white;
+    n:=0;
+    for p_=#3:
+    n:=n+1;
+    Col[n]=p_;
+    endfor;
+    %
+    numeric X[];
+    numeric ecartabs[];
+    vardef RecupValeursAbscisses(text t)=
+    p:=0;
+    for p_=t:
+    p:=p+1;
+    X[p]:=p_;
+    if X[p]<minx:
+    minx:=X[p];
+    fi;
+    if X[p]>maxx:
+    maxx:=X[p];
+    fi;
+    endfor;
+    X[0]=X[1];
+    TotalAbscisses=p;
+    enddef;
+    numeric Y[],Z[];
+    numeric EffectifTotal[];
+    numeric EffectifTotalA[];
+    vardef RecupValeursDonnees(text t)=
+    p:=0;
+    EffectifTotal[0]:=0;
+    EffectifTotalA[0]:=0; 
+    for p_=t:
+    p:=p+1;
+    EffectifTotal[p]:=p_;
+    EffectifTotalA[p]:=EffectifTotalA[p-1]+p_;
+    Y[p]:=p_;
+    Z[p]=(Y[p]/(UniteAire*(X[2*p]-X[2*p-1])/Pasx));
+    R[p]=ceiling(Z[p]);
+    if R[p]>maxy:
+    maxy:=R[p];
+    fi;
+    endfor;
+    NbDonnees:=p;
+    enddef;
+    %On affiche la médiane dans le cas des ECC
+    vardef AfficheMedianeECC(text t)=
+    YMed:=Z[NbDonnees]/2;
+    DemiDonnees:=EffectifTotal[NbDonnees]/2;
+    p:=0;
+    forever:
+    p:=p+1;
+    exitif EffectifTotal[p]>DemiDonnees;
+    endfor;
+    path MedHor,MedLineaire,MedVer;
+    MedLineaire=(unitex*(Depart+(X[2*p-2]-X[1]/Pasx)),unitey*Z[p-1])--(unitex*(Depart+(X[2*p]-X[1])/Pasx),unitey*Z[p]);
+    MedHor=((0,unitey*YMed)--(unitex*((maxx-minx)/Pasx+2),unitey*YMed));
+    MedVer=(xpart(MedLineaire intersectionpoint MedHor),0)--(MedLineaire intersectionpoint MedHor);
+    draw MedLineaire;
+    draw MedHor;
+    draw MedVer;
+    enddef;
+    % On affiche la médiane dans le cas non ECC
+    vardef AfficheMediane(text t)=
+    DemiDonnees:=EffectifTotalA[NbDonnees]/2;
+    p:=0;
+    forever:
+    p:=p+1;
+    exitif EffectifTotalA[p]>DemiDonnees;
+    endfor;
+    path MedVer;
+    numeric CoefLineaire,pMed;
+    pMed=p;
+    CoefLineaire=(DemiDonnees-EffectifTotalA[p-1])/Y[p];
+    MedVer=(unitex*(Depart+(X[2*p-2]-X[1])/Pasx+CoefLineaire*(X[2*p]-X[2*p-2])/Pasx),0)--(unitex*(Depart+(X[2*p-2]-X[1])/Pasx+CoefLineaire*(X[2*p]-X[2*p-2])/Pasx),unitey*Z[p]);
+    draw MedVer dashed evenly;
+    enddef;
+    % On commence le tracé : on récupère les informations
+    RecupValeursAbscisses(#1);
+    RecupValeursDonnees(#2);
+    % on définit une grille
+    vardef Grille=
+    if MemeAmpli:
+    Ajout:=1;
+    else:
+    Ajout:=3;
+    fi;
+    drawoptions(withcolor 0.7white);
+    for k=0 upto ((maxx-minx)/Pasx+2):
+    trace (unitex*k,0)--(unitex*k,(maxy+Ajout)*unitey);%withcolor red;
+    endfor;
+    for k=0 upto (maxy+Ajout):
+    trace (0,k*unitey)--(unitex*((maxx-minx)/Pasx+2),k*unitey);% withcolor blue;
+    endfor;
+    drawoptions();
+    enddef;
+    % Fin Grille
+    % On trace les rectangles
+    vardef AfficheRectangles=
+    if Hachures:
+    Grille;
+    for k=2 step 2 until TotalAbscisses:
+    draw hachurage(polygone(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0)),60,0.2,0);
+    draw chemin(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0));
+    endfor;
+    else:
+    for k=2 step 2 until TotalAbscisses:
+    fill polygone(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0)) withcolor if unknown Col[k/2]: CoulDefaut else: Col[k/2] fi;
+    endfor;
+    Grille;
+    for k=2 step 2 until TotalAbscisses:
+    draw chemin(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0));
+    endfor;
+    fi;
+    enddef;
+    % Affichage final
+    if ECC:
+      AfficheRectangles;
+      if Mediane:
+        AfficheMedianeECC(#2);
+      fi;
+    else:
+      if Mediane:
+        AfficheMediane(#2);
+        if Hachures:
+        Grille;
+        %Partie gauche
+          for k=2 step 2 until (2*pMed-2):
+            draw hachurage(polygone(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0)),60,0.2,0);
+            draw chemin(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0));
+          endfor;
+          draw hachurage(polygone(unitex*(Depart+(X[2*pMed-2]-X[1])/Pasx,0),point(0) of MedVer,point(1) of MedVer,(unitex*(Depart+(X[2*pMed-2]-X[1])/Pasx),unitey*Z[pMed])),60,0.2,0);
+          draw polygone(unitex*(Depart+(X[2*pMed-2]-X[1])/Pasx,0),point(0) of MedVer,point(1) of MedVer,(unitex*(Depart+(X[2*pMed-2]-X[1])/Pasx),unitey*Z[pMed]));
+          % Partie droite
+          for k=2*pMed+2 step 2 until TotalAbscisses:
+            draw hachurage(polygone(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0)),120,0.2,1);
+            draw chemin(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0));
+          endfor;
+          draw hachurage(polygone(unitex*(Depart+(X[2*pMed]-X[1])/Pasx,0),point(0) of MedVer,point(1) of MedVer,(unitex*(Depart+(X[2*pMed]-X[1])/Pasx),unitey*Z[pMed])),120,0.2,1);
+          draw polygone(unitex*(Depart+(X[2*pMed]-X[1])/Pasx,0),point(0) of MedVer,point(1) of MedVer,(unitex*(Depart+(X[2*pMed]-X[1])/Pasx),unitey*Z[pMed]));
+          else:
+          %Partie gauche
+    for k=2 step 2 until (2*pMed-2):
+    fill polygone(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0)) withcolor if unknown Col[1]: CoulDefaut else: Col[1] fi;
+    endfor;
+    fill polygone(unitex*(Depart+(X[2*pMed-2]-X[1])/Pasx,0),point(0) of MedVer,point(1) of MedVer,(unitex*(Depart+(X[2*pMed-2]-X[1])/Pasx),unitey*Z[pMed])) withcolor if unknown Col[1]: CoulDefaut else: Col[1] fi ;
+    % Partie droite
+    for k=2*pMed+2 step 2 until TotalAbscisses:
+    fill polygone(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0)) withcolor if unknown Col[2]: CoulDefaut else: Col[2] fi;
+    endfor;
+    fill polygone(unitex*(Depart+(X[2*pMed]-X[1])/Pasx,0),point(0) of MedVer,point(1) of MedVer,(unitex*(Depart+(X[2*pMed]-X[1])/Pasx),unitey*Z[pMed]))  withcolor if unknown Col[2]: CoulDefaut else: Col[2] fi;
+    Grille;
+    %Partie Gauche
+    for k=2 step 2 until (2*pMed-2):
+    trace polygone(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0));
+    endfor;
+    trace polygone(unitex*(Depart+(X[2*pMed-2]-X[1])/Pasx,0),point(0) of MedVer,point(1) of MedVer,(unitex*(Depart+(X[2*pMed-2]-X[1])/Pasx),unitey*Z[pMed]));%(Y[pMed]/(UniteAire*(X[2*pMed-2]-X[2*pMed-3])/Pasx))));
+    for k=2*pMed+2 step 2 until TotalAbscisses:
+    draw chemin(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0));
+    endfor;
+    draw polygone(unitex*(Depart+(X[2*pMed]-X[1])/Pasx,0),point(0) of MedVer,point(1) of MedVer,(unitex*(Depart+(X[2*pMed]-X[1])/Pasx),unitey*Z[pMed]));
+    fi;
+    draw MedVer withpen pencircle scaled 2;
+      else:
+        AfficheRectangles;
+      fi;
+    fi;
+    %Affichage ou pas des axes, de la médiane
+    if MemeAmpli:
+      drawarrow (0,0)--unitey*(0,maxy+1);
+      EcartAmpli:=(X[2]-X[1])/Pasx;
+      if AideLecture:
+      for k=2 step 2 until TotalAbscisses:
+        trace ((unitex*(Depart+(X[k]-X[1])/Pasx),unitey*Z[k/2]))--(unitey*(0,Z[k/2])) dashed evenly;
+        endfor;
+      fi;
+      if LectureFine:
+        for k=0 upto ((maxy+1)):
+          if Tiret:
+            trace (1pt,k*unitey)--(-1pt,k*unitey);
+            label.lft(TEX("\num{"&decimal(k*UniteAire*EcartAmpli)&"}"),(0,k*unitey));
+          else:
+            dotlabel.lft(TEX("\num{"&decimal(k*UniteAire*EcartAmpli)&"}"),(0,k*unitey));
+          fi;
+        endfor;
+      fi;
+      if Lecture:
+        for k=0 upto 1:
+        if Tiret:
+          trace (1pt,k*unitey)--(-1pt,k*unitey);
+          label.lft(TEX("\num{"&decimal(k*UniteAire*EcartAmpli)&"}"),(0,k*unitey));
+    else:
+    dotlabel.lft(TEX("\num{"&decimal(k*UniteAire*EcartAmpli)&"}"),(0,k*unitey));
+    fi;
+    endfor;
+    fi; 
+    else:%Pas même ampli : on n'affiche pas l'axe vertical
+    trace hachurage(polygone((unitex,unitey*(maxy+2)),(unitex*2,unitey*(maxy+2)),(unitex*2,unitey*(maxy+1)),(unitex,unitey*(maxy+1))),60,0.2,0);
+    trace polygone((unitex,unitey*(maxy+2)),(unitex*2,unitey*(maxy+2)),(unitex*2,unitey*(maxy+1)),(unitex,unitey*(maxy+1)));
+    label.rt(TEX(decimal(UniteAire)&"~\useKV[ClesStat]{Effectif}"),(unitex*2,unitey*(maxy+1.5)));
+%    if Mediane:
+%    AfficheMediane(#2);
+%    fi;
+    fi;
+    % On trace l'axe des abscisses
+    drawarrow (0,0)--unitex*((maxx-minx)/Pasx+2,0);
+    %On labelise l'axe des abscisses
+    dotlabel.bot(TEX("\num{"&decimal(X[1])&"}"),unitex*(Depart,0));
+    for k=2 step 2 until TotalAbscisses:
+    dotlabel.bot(TEX("\num{"&decimal(X[k])&"}"),unitex*(Depart+(X[k]-X[1])/Pasx,0));
+    endfor;
+    label.rt(TEX("\useKV[ClesStat]{Donnee}"),(unitex*((maxx-minx)/Pasx+2),0));
+    %On affiche les données sup ou pas.
+    AfficheLegende(#2);
+  \end{mplibcode}
+  \fi
+}
+%
+
+\newcommand\Stat[2][]{%
+  \useKVdefault[ClesStat]%
+  \setKV[ClesStat]{#1}%
+  \ifboolKV[ClesStat]{UneMediane}{\renewcommand{\PfCArticleMediane}{une}}{\renewcommand{\PfCArticleMediane}{la}}%
+  \setsepchar[*]{,*/}%
+  \readlist*\ListeAvantUtilisation{#2}%
+  \xintifboolexpr{\listlen\ListeAvantUtilisation[1]==3}{\setKV[ClesStat]{Classes}}{}%
+  \ifboolKV[ClesStat]{Classes}{%
+    \setsepchar[*]{,*/}%
+    \readlist*\ListeDepart{#2}%
+    \xdef\EffectifTotal{0}%
+    \xintFor* ##1 in{\xintSeq{1}{\ListeDepartlen}}\do{%
+      \xdef\EffectifTotal{\fpeval{\EffectifTotal+\ListeDepart[##1,3]}}%
+    }%
+    \ifboolKV[ClesStat]{Histogramme}{%
+      \buildgraphhisto%
+    }{%
+      \ifboolKV[ClesStat]{Tableau}{%
+        \buildtabclasses%
+      }{}%
+    }%
+  }{%
+    \setsepchar{,}%
+    \ifboolKV[ClesStat]{Representation}{%
+      \setKV[TraceG]{Xmin=0,Ymin=0}%
+      \setKV[TraceG]{#1}%
+      \readlist*\ListePointsPlaces{#2}%
+      \newtoks\toklistepoint%
+      \foreachitem\compteur\in\ListePointsPlaces{\expandafter\Updatetoks\compteur\nil}%
+      \MPPlacePoint[#1]{\the\toklistepoint}%
+    }{%
+      \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}%
+      }{%
+        \ifboolKV[ClesStat]{Sondage}{%
+          \setsepchar{,}\ignoreemptyitems%
+          \readlist*\Liste{#2}%
+          % "liste vide"
+          \newtoks\tabtoksEEa%
+          \tabtoksEEa{}%
+          % 
+          % "liste vide"
+          \newtoks\tabtoksEEb%
+          \tabtoksEEb{}%
+          % 
+          \readlist*\ListeSansDoublonsEE{999}%   %% Pour ne pas avoir une liste vide
+          % 
+          \newcount\cmptEE%
+          \newcount\PasNumEE%    %% Permettra de savoir si ce sondage est qualitatif ou quantitatif
+          \PasNumEE=0\relax%
+          \DTLcleardb{mtdbEE}%
+          % on range les resultats du sondage par ordre croissant.
+          \foreachitem\x\in\Liste{%
+            \DTLnewrow{mtdbEE}%
+            \DTLnewdbentry{mtdbEE}{Numeric}{\x}%
+          }%
+          \dtlsort{Numeric}{mtdbEE}{\dtlicompare}%
+          \DTLforeach{mtdbEE}{\nba=Numeric}{%
+            \IfDecimal{\nba}{}{\PasNumEE=\numexpr\PasNumEE+1\relax}%
+            \cmptEE=0\relax%
+            \foreachitem\nbb\in\ListeSansDoublonsEE{%
+              \ifthenelse{\equal{\nba}{\nbb}}{\cmptEE=\numexpr\cmptEE+1\relax}{}%
+            }%
+            \ifthenelse{\equal{\the\cmptEE}{0}}{%
+              \expandafter\AjoutListEEb\nba\nil%
+              \xdef\listEEa{\the\tabtoksEEb}%
+              \ignoreemptyitems%
+              \setsepchar{,}%
+              \readlist*\ListeSansDoublonsEE\listEEa%    	%%% Enl\`eve tous les \'elements
+              %%% identiques de Liste
+            }{}%
+          }%
+          \foreachitem\nba\in\ListeSansDoublonsEE{%
+            \cmptEE=0\relax%
+            \DTLforeach{mtdbEE}{\nbb=Numeric}{%
+              \ifthenelse{\equal{\nba}{\nbb}}{\cmptEE=\numexpr\cmptEE+1\relax}{}%
+            }%
+            \expandafter\AjoutListEEab\nba\nil%
+            \expandafter\AjoutListEEaa\the\cmptEE\nil% 	%%% Compte tous les \'elements
+            %%% identiques de Liste
+          }%
+          \xdef\listEEb{\the\tabtoksEEa}
+          \ignoreemptyitems%
+          \setsepchar[*]{,*/}%
+          \readlist*\ListeComplete\listEEb%
+          % 
+          \ifthenelse{\equal{\the\PasNumEE}{0}}{\setKV[ClesStat]{Quantitatif}}{\setKV[ClesStat]{Qualitatif}}%
+        }{%
+          \ifboolKV[ClesStat]{Qualitatif}{%
+            %  % on lit la liste \'ecrite sous la forme valeur/effectif
+            \setsepchar[*]{,*/}\ignoreemptyitems%
+            \readlist*\ListeInitiale{#2}%
+            % "liste vide"
+            \newtoks\tabtoksEE%
+            \tabtoksEE{}%
+            \DTLcleardb{mtdbEEqual}%
+            \foreachitem\x\in\ListeInitiale{%
+              \DTLnewrow{mtdbEEqual}%
+              \itemtomacro\ListeInitiale[\xcnt,1]\x%
+              \DTLnewdbentry{mtdbEEqual}{Val}{\x}%
+              \itemtomacro\ListeInitiale[\xcnt,2]\y%
+              \DTLnewdbentry{mtdbEEqual}{Eff}{\y}%
+            }%
+            \DTLforeach{mtdbEEqual}{\Val=Val,\Eff=Eff}{%  
+              \expandafter\AjoutListEEy\Val\nil%
+              \expandafter\AjoutListEEx\Eff\nil%
+            }%
+            \xdef\listEE{\the\tabtoksEE}
+            \ignoreemptyitems%
+            \setsepchar[*]{,*/}%
+            \readlist*\ListeComplete\listEE%
+          }{% Dans le qualitatif, on trie d'abord les valeurs.
+            \setsepchar[*]{,*/}\ignoreemptyitems%
+            \readlist*\ListeInitiale{#2}%
+            % "liste vide"
+            \newtoks\tabtoksEE%
+            \tabtoksEE{}%
+            \DTLcleardb{mtdbEEqual}%
+            \foreachitem\x\in\ListeInitiale{%
+              \DTLnewrow{mtdbEEqual}%
+              \itemtomacro\ListeInitiale[\xcnt,1]\x%
+              \DTLnewdbentry{mtdbEEqual}{Val}{\x}%
+              \itemtomacro\ListeInitiale[\xcnt,2]\y%
+              \DTLnewdbentry{mtdbEEqual}{Eff}{\y}%
+            }%
+            \dtlsort{Val}{mtdbEEqual}{\dtlicompare}%
+            \DTLforeach{mtdbEEqual}{\Val=Val,\Eff=Eff}{%  
+              \expandafter\AjoutListEEy\Val\nil%
+              \expandafter\AjoutListEEx\Eff\nil%
+            }%
+            \xdef\listEE{\the\tabtoksEE}
+            \ignoreemptyitems%
+            \setsepchar[*]{,*/}%
+            \readlist*\ListeComplete\listEE%
+          }}}%
+      % on cr\'ee la base de donn\'ees des valeurs dans le cas qualitatif
+      \DTLcleardb{mtdb}%
+      % on les trie pour la m\'ediane 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\'einitialise les valeurs des crit\`eres 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\'ebut qualitatif
+        % Calculs
+        %  %% celui de la somme des donn\'ees
+        \foreachitem\don\in\ListeComplete{\xdef\SommeDonnees{\fpeval{\SommeDonnees+\ListeComplete[\doncnt,2]}}}%
+        %  %% celui de l'effectif total
+        \ifboolKV[ClesStat]{EffectifTotal}{%
+          \ifboolKV[ClesStat]{Liste}{L'effectif total de la s\'erie est
+            \num{\ListeCompletelen}.\par}{%
+            \foreachitem\don\in\ListeComplete{\xdef\EffectifTotal{\fpeval{\EffectifTotal+\ListeComplete[\doncnt,2]}}}%
+            L'effectif total de la s\'erie est : \[\ListeComplete[1,2]\xintFor* ##1 in
+              {\xintSeq {2}{\ListeCompletelen}}\do{%
+                +\ListeComplete[##1,2]}=\num{\EffectifTotal}\]}
+        }{}%
+        \ifboolKV[ClesStat]{Liste}{\xdef\EffectifTotal{\ListeCompletelen}}{\xdef\EffectifTotal{\SommeDonnees}}%
+        %  %% celui de la moyenne
+        \xdef\Moyenne{\fpeval{\SommeDonnees/\ListeCompletelen}}%	
+        \ifboolKV[ClesStat]{Moyenne}{%
+          \ifboolKV[ClesStat]{Liste}{%
+            La somme des donn\'ees de la s\'erie 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}{}{Le nombre de donn\'ees de la s\'erie est \num{\ListeCompletelen}.\\}%
+            Donc la moyenne de la s\'erie est \'egale \`a :%
+            \[\frac{\num{\SommeDonnees}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}}{\num{\ListeCompletelen}}%\IfInteger{\fpeval{round(\fpeval{\SommeDonnees/\ListeCompletelen},\useKV[ClesStat]{Precision})}}{=}{\approx}
+              \ifboolKV[ClesStat]{ValeurExacte}{}{%
+                \opdiv*{\SommeDonnees}{\ListeCompletelen}{resultatmoy}{restemoy}%
+                \opround{resultatmoy}{\useKV[ClesStat]{Precision}}{resultatmoy1}%
+                \opcmp{resultatmoy}{resultatmoy1}\ifopeq=\else\approx\fi%
+                \num{\fpeval{round(\SommeDonnees/\ListeCompletelen,\useKV[ClesStat]{Precision})}}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}%
+              }%
+            \]%
+          }{Pas de moyenne possible pour une s\'erie de donn\'ees \`a caract\`ere qualitatif.}}{}%
+        %    %  %% celui de l'\'etendue
+        \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}{%
+          \ifboolKV[ClesStat]{Liste}{%
+            L'\'etendue de la s\'erie est \'egale \`a $\num{\DonneeMax}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}-\num{\DonneeMin}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}=\num{\Etendue}$\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}%
+          }{Pas d'\'etendue possible pour une s\'erie de donn\'ees \`a caract\`ere qualitatif.}}{}%
+        % celui de la mediane
+        %%% Recuperation de la mediane %%%%%%%%%%%%%%%%%%%%% 
+        \newcount\Recapmed%
+        \newcount\Recapmeda%
+        \ifodd\number\ListeCompletelen%odd impair
+        \Recapmed=\fpeval{(\ListeCompletelen+1)/2}\relax%
+        \else%
+        \Recapmed=\fpeval{\ListeCompletelen/2}\relax%
+        \Recapmeda=\numexpr\Recapmed+1\relax%
+        \fi%
+        \newcount\Recapk%
+        \Recapk=0%
+        \DTLforeach{mtdb}{\numeroDonnee=Numeric}{\Recapk=\numexpr\Recapk+1\relax%
+          \ifnum\Recapk=\Recapmed%
+          \ifodd\number\ListeCompletelen%
+          \xdef\Mediane{\numeroDonnee}%
+          \else%
+          \xdef\Mediane{\numeroDonnee}%
+          \fi%
+          \fi%
+          \ifnum\Recapk=\Recapmeda%
+          \xdef\Mediane{\fpeval{(\Mediane+\numeroDonnee)/2}}%
+          \fi%
+        }%
+        %%% 
+        \ifboolKV[ClesStat]{Mediane}{%
+          \ifboolKV[ClesStat]{Liste}{%    
+            On range les donn\'ees 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 de la s\'erie 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 de la s\'erie 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\'ediane vaut \numeroDonnee\fi
+              \ifodd\number\ListeCompletelen%
+              La m\'ediane de la s\'erie est la \the\med\ieme{} donn\'ee.\\Donc la m\'ediane de la s\'erie est \num{\numeroDonnee}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}%
+              \xdef\Mediane{\numeroDonnee}%
+              \else%
+              La \the\med\ieme{} donn\'ee est \num{\numeroDonnee}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}. }{. }\xdef\Mediane{\numeroDonnee}%
+              \fi%
+              \fi%
+              \ifnum\k=\meda
+              La \the\meda\ieme{} donn\'ee est \num{\numeroDonnee}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}\\Donc \PfCArticleMediane{} m\'ediane de la s\'erie est \xdef\Mediane{\fpeval{(\Mediane+\numeroDonnee)/2}}$\ifboolKV[ClesStat]{DetailsMediane}{\dfrac{\num{\Mediane}+\num{\numeroDonnee}}{2}=}{}\num{\Mediane}$\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}%
+              \fi%
+            }%
+            %%%%%%% 
+          }{Pas de m\'ediane possible pour une s\'erie de donn\'ees \`a caract\`ere qualitatif.}}{}
+        %%% Quartile un
+        \newcount\PfCQuartileUn%
+        \modulo{\ListeCompletelen}{4}\relax%
+        \ifnum\remainder=0%
+        \PfCQuartileUn=\fpeval{\ListeCompletelen/4}%
+        \else%
+        \PfCQuartileUn=\fpeval{ceil(\ListeCompletelen/4)}%
+        \fi%
+        \newcount\PfCQunk%
+        \PfCQunk=0%
+        \DTLforeach{mtdb}{\numeroDonnee=Numeric}{\PfCQunk=\numexpr\PfCQunk+1\relax%
+          \ifnum\PfCQunk=\PfCQuartileUn%
+          \xdef\QuartileUn{\numeroDonnee}%
+          \fi%
+        }%
+        %%% Quartile trois
+        \newcount\PfCQuartileTrois%
+        \modulo{\ListeCompletelen}{4}\relax%
+        \ifnum\remainder=0%
+        \PfCQuartileTrois=\fpeval{3*\ListeCompletelen/4}%
+        \else%
+        \PfCQuartileTrois=\fpeval{ceil(3*\ListeCompletelen/4)}%
+        \fi%
+        \newcount\PfCQtroisk%
+        \PfCQtroisk=0%
+        \DTLforeach{mtdb}{\numeroDonnee=Numeric}{\PfCQtroisk=\numexpr\PfCQtroisk+1\relax%
+          \ifnum\PfCQtroisk=\PfCQuartileTrois%La m\'ediane vaut \numeroDonnee\fi
+          \xdef\QuartileTrois{\numeroDonnee}%
+          \fi%
+        }%
+        % Construction du tableau
+        \ifboolKV[ClesStat]{Tableau}{%
+          \ifboolKV[ClesStat]{Liste}{Pas de tableau possible avec la cl\'e Liste.\\Utilisez plut\^ot la cl\'e Sondage si vous voulez un tableau avec cette liste.}{\BuildtabStat}}{}%
+        % Construction du graphique
+        \ifboolKV[ClesStat]{Graphique}{%
+          \ifboolKV[ClesStat]{Liste}{Pas de graphique possible avec la cl\'e Liste.\\Utilisez plut\^ot la cl\'e Sondage si vous voulez un graphique avec cette liste.}{%
+            \ifboolKV[ClesStat]{Barre}{%
+              \buildgraphbarhor%
+            }{%
+              \ifboolKV[ClesStat]{Angle}{%
+                \buildgraphcq{360}%
+              }{%
+                \ifboolKV[ClesStat]{SemiAngle}{%
+                  \buildgraphcq{180}%
+                }{%
+                  \buildgraphq[#1]%
+                }%
+              }%
+            }%
+          }%
+        }{}%
+      }{%%%%%%%%%%%%%%%%%%%%%D\'ebut quantitatif
+        %  % on effectue les calculs
+        %  %% celui de la somme des donn\'ees
+        \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'\'etendue
+        \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 de la s\'erie est : \[\ListeComplete[1,2]\xintFor* ##1 in
+            {\xintSeq {2}{\ListeCompletelen}}\do{%
+              +\ListeComplete[##1,2]}=\num{\EffectifTotal}\]
+        }{}%
+        \ifboolKV[ClesStat]{Moyenne}{%
+          La somme des donn\'ees de la s\'erie 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 de la s\'erie 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 de la s\'erie est \'egale \`a :%
+          \[\frac{\num{\SommeDonnees}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}}{\num{\EffectifTotal}}%
+            \ifboolKV[ClesStat]{ValeurExacte}{}{%
+              \opdiv*{\SommeDonnees}{\EffectifTotal}{resultatmoy}{restemoy}%
+              \opround{resultatmoy}{\useKV[ClesStat]{Precision}}{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\'eponses.
+        %  %% pour l'\'etendue
+        \ifboolKV[ClesStat]{Etendue}{L'\'etendue de la s\'erie est \'egale \`a $\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\'ediane
+        %%% Recuperation Mediane
+        \newcount\Recupmed%
+        \newcount\Recupmeda%
+        \ifodd\number\EffectifTotal%odd impair
+        \Recupmed=\fpeval{(\EffectifTotal+1)/2}\relax%
+        \else% pair
+        \Recupmed=\fpeval{\EffectifTotal/2}\relax%
+        \Recupmeda=\numexpr\Recupmed+1\relax%
+        \fi%
+        \newcount\Recupk%
+        \Recupk=0%
+        \xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{%
+          \xintFor* ##2 in {\xintSeq {1}{\ListeComplete[##1,2]}}\do{%
+            \Recupk=\numexpr\Recupk+1\relax%
+            \ifnum\Recupk=\Recupmed%
+            \ifodd\number\EffectifTotal%
+            \xdef\Mediane{\ListeComplete[##1,1]}%
+            \else%
+            \xdef\Mediane{\ListeComplete[##1,1]}%
+            \fi%
+            \fi%
+            \ifnum\Recupk=\Recupmeda%
+            \xdef\Mediane{\fpeval{(\Mediane+\ListeComplete[##1,1])/2}}%
+            \fi%
+          }%
+        }%
+        %%% 
+        \ifboolKV[ClesStat]{Mediane}{%
+          
+          \newcount\med%
+          \newcount\meda%
+          \ifodd\number\EffectifTotal%odd impair
+          \med=\fpeval{(\EffectifTotal+1)/2}\relax%
+          L'effectif total de la s\'erie 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 de la s\'erie 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\'ediane de la s\'erie est la \the\med\ieme{} donn\'ee. Donc la m\'ediane de la s\'erie est \num{\ListeComplete[##1,1]}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}%
+              \else%
+              La \the\med\ieme{} donn\'ee 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{} donn\'ee est \num{\ListeComplete[##1,1]}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}\\Donc \PfCArticleMediane{} m\'ediane de la s\'erie est $\ifboolKV[ClesStat]{DetailsMediane}{\dfrac{\num{\Mediane}+\num{\ListeComplete[##1,1]}}2=}{}\xdef\Mediane{\fpeval{(\Mediane+\ListeComplete[##1,1])/2}}\num{\Mediane}$\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}%
+              \fi%
+            }%
+          }%
+        }{}%
+        %%% Quartile un
+        \newcount\PfCQuartileUn%
+        \modulo{\EffectifTotal}{4}\relax%
+        \ifnum\remainder=0%
+        \PfCQuartileUn=\fpeval{\EffectifTotal/4}%
+        \else%
+        \PfCQuartileUn=\fpeval{ceil(\EffectifTotal/4)}%
+        \fi%
+        \newcount\PfCQunk%
+        \PfCQunk=0%
+        \xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{%
+          \xintFor* ##2 in {\xintSeq {1}{\ListeComplete[##1,2]}}\do{%
+            \PfCQunk=\numexpr\PfCQunk+1\relax%
+            \ifnum\PfCQunk=\PfCQuartileUn%
+            \xdef\QuartileUn{\ListeComplete[##1,1]}%
+            \fi%
+          }%
+        }%
+        %%% Quartile trois
+        \newcount\PfCQuartileTrois%
+        \modulo{\EffectifTotal}{4}\relax%
+        \ifnum\remainder=0%
+        \PfCQuartileTrois=\fpeval{3*\EffectifTotal/4}%
+        \else%
+        \PfCQuartileTrois=\fpeval{ceil(3*\EffectifTotal/4)}%
+        \fi%
+        \newcount\PfCQtroisk%
+        \PfCQtroisk=0%
+        \xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{%
+          \xintFor* ##2 in {\xintSeq {1}{\ListeComplete[##1,2]}}\do{%
+            \PfCQtroisk=\numexpr\PfCQtroisk+1\relax%
+            \ifnum\PfCQtroisk=\PfCQuartileTrois%
+            \xdef\QuartileTrois{\ListeComplete[##1,1]}%
+            \fi%
+          }%
+        }%
+        % Construction de tableau
+        \ifboolKV[ClesStat]{Tableau}{\BuildtabStat}{}%
+        % Construction du graphique ??
+        \ifboolKV[ClesStat]{Graphique}{%
+          \ifboolKV[ClesStat]{Angle}{%
+            \buildgraphcq{360}%
+          }{%
+            \ifboolKV[ClesStat]{SemiAngle}{%
+              \buildgraphcq{180}%
+            }{%
+              \buildgraph[#1]%
+            }%
+          }%
+        }{}%
+      }%
+    }%
+  }%
+}%
\ No newline at end of file


Property changes on: trunk/Master/texmf-dist/tex/latex/profcollege/PfCStatistiquesoldold.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/texmf-dist/tex/latex/profcollege/PfCTableauxUnites.tex
===================================================================
--- trunk/Master/texmf-dist/tex/latex/profcollege/PfCTableauxUnites.tex	2023-07-04 19:52:56 UTC (rev 67544)
+++ trunk/Master/texmf-dist/tex/latex/profcollege/PfCTableauxUnites.tex	2023-07-04 19:53:24 UTC (rev 67545)
@@ -969,9 +969,9 @@
           }%
           \StrLen{\ListeNombreAPlacer[##2,2]}[\TabLongueurNombre]%
           \xintifboolexpr{\ListeNombreAPlacer[##2,2]==0}{}{%
-            %On place la virgule
-            \tikz\node[xshift=1em] at (\fpeval{\DecalageLigne+##2+4.5}-|\fpeval{\PfCDerniereColonneEntiere-0.5-\TabLongueurNombre+1}) {\PfCTBstrut,};%
-            %on écrit la partie décimale
+            % On place la virgule
+            \tikz\node[xshift=1em] at (\fpeval{\DecalageLigne+##2+4.5}-|\fpeval{\PfCPremiereColonneDecimale-1-0.5}) {\PfCTBstrut,};%
+            % on écrit la partie décimale
             \xintFor* ##1 in{\xintSeq {1}{\TabLongueurNombre}}\do{%
               \tikz\node at (\fpeval{\DecalageLigne+##2+4.5}-|\fpeval{\PfCPremiereColonneDecimale-1.5+##1}) {\PfCTBstrut\StrMid{\ListeNombreAPlacer[##2,2]}{##1}{##1}};%
             }%

Modified: trunk/Master/texmf-dist/tex/latex/profcollege/PfCTablesOperations.tex
===================================================================
--- trunk/Master/texmf-dist/tex/latex/profcollege/PfCTablesOperations.tex	2023-07-04 19:52:56 UTC (rev 67544)
+++ trunk/Master/texmf-dist/tex/latex/profcollege/PfCTablesOperations.tex	2023-07-04 19:53:24 UTC (rev 67545)
@@ -1,7 +1,7 @@
 %%%
 % Tables Addition-Multiplication
 %%%
-\setKVdefault[Tables]{Addition=false,Multiplication=true,Seul=false,Debut=0,Fin=10,Couleur=white}
+\setKVdefault[Tables]{Addition=false,Soustraction=false,Multiplication,Seul=false,Debut=0,Fin=10,Couleur=white}
 
 % pour m\'emoire
 \newcommand\TableMultiplicationComplete{%
@@ -84,20 +84,39 @@
   }%
 }%
 
+\newcommand\TableSoustractionSeule[1]{%
+  \ensuremath{%
+    \begin{array}{ccccc}
+      \xintFor* ##1 in {\xintSeq
+      {\fpeval{#1+\useKV[Tables]{Debut}}}{\fpeval{#1+\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}%
+    \ifboolKV[Tables]{Soustraction}{%
+      \TableSoustractionSeule{#2}%
     }{%
-      \TableMultiplicationSeule{#2}%
+      \ifboolKV[Tables]{Addition}{%
+        \TableAdditionSeule{#2}%
+      }{%
+        \TableMultiplicationSeule{#2}%
+      }%
     }%
   }{%
-    \ifboolKV[Tables]{Addition}{%
-      \TableAdditionComplete%
+    \ifboolKV[Tables]{Soustraction}{%
+      La clé Soustraction n'est pas disponible ici.%
     }{%
-      \TableMultiplicationCompleteColore%
+      \ifboolKV[Tables]{Addition}{%
+        \TableAdditionComplete%
+      }{%
+        \TableMultiplicationCompleteColore%
+      }%
     }%
   }%
 }%
\ No newline at end of file

Modified: trunk/Master/texmf-dist/tex/latex/profcollege/ProfCollege.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/profcollege/ProfCollege.sty	2023-07-04 19:52:56 UTC (rev 67544)
+++ trunk/Master/texmf-dist/tex/latex/profcollege/ProfCollege.sty	2023-07-04 19:53:24 UTC (rev 67545)
@@ -2,9 +2,9 @@
 % licence    : Released under the LaTeX Project Public License v1.3c
 % or later, see http://www.latex-project.org/lppl.txtf
 \NeedsTeXFormat{LaTeX2e}%
-\def\filedate{2023/05/19}%
+\def\filedate{2023/07/05}%
 \let\PfCfiledate\filedate%
-\def\fileversion{0.99-z-m}%
+\def\fileversion{0.99-z-o}%
 \let\PfCfileversion\fileversion%
 \ProvidesPackage{ProfCollege}[\filedate\space v\fileversion\space Aide pour utiliser LaTeX au college]%
 
@@ -217,14 +217,15 @@
 \ooalign{$\genfrac{}{}{0pt}{0}{#1}{#2}$\cr\PfCdotover\cr}%
 }%
 
-\NewDocumentCommand\MultiCol{O{}m+m}{%
+\NewDocumentCommand\MultiCol{O{}+m+m}{%
   \setsepchar[*]{/}%
   \readlist*\ListeNombreCol{#2}%
   \setsepchar[*]{§}%
   \readlist*\ListeContenuCol{#3}%
   \xintFor* ##1 in {\xintSeq{1}{\ListeNombreCollen}}\do{%
+    \itemtomacro\ListeContenuCol[##1]\PfMTexte
     \begin{minipage}[#1]{\ListeNombreCol[##1]\linewidth}%
-      \ListeContenuCol[##1]%
+      \PfMTexte
     \end{minipage}%
     \xintifboolexpr{##1<\ListeNombreCollen}{\hfill\vrule width \columnseprule\hfill}{}%
   }%
@@ -571,6 +572,8 @@
 }%\emoticon
 }%\raisebox
 }
+\input{PfCAutomatismes}
+\input{PfCNumberHive}
 \input{PfCPatronPaves}
 \input{PfCErathostene}
 \input{PfCDobble}



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