From 0ef3dfaccca426fb0f3b06fc106ef9b5b0423dad Mon Sep 17 00:00:00 2001
From: Norbert Preining <norbert@preining.info>
Date: Mon, 23 Aug 2021 03:00:54 +0000
Subject: CTAN sync 202108230300

---
 .../contrib/profcollege/latex/ProfCollege.sty      | 3097 +++++++++++++++++---
 1 file changed, 2651 insertions(+), 446 deletions(-)

(limited to 'macros/latex/contrib/profcollege/latex/ProfCollege.sty')

diff --git a/macros/latex/contrib/profcollege/latex/ProfCollege.sty b/macros/latex/contrib/profcollege/latex/ProfCollege.sty
index e32797a1cf..ab00d8a9b9 100644
--- a/macros/latex/contrib/profcollege/latex/ProfCollege.sty
+++ b/macros/latex/contrib/profcollege/latex/ProfCollege.sty
@@ -3,7 +3,7 @@
 % or later, see http://www.latex-project.org/lppl.txtf
 
 \NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{ProfCollege}[2021/06/04 v0.99-d Aide pour l'utilisation de LaTeX au collège]
+\ProvidesPackage{ProfCollege}[2021/08/22 v0.99-f Aide pour l'utilisation de LaTeX au collège]
 
 \RequirePackage{verbatim}
 
@@ -88,7 +88,7 @@
 \RequirePackage{tikz}
 % https://tex.stackexchange.com/questions/349259/curved-arrow-describing-a-step-in-a-equation-derivation
 %https://tex.stackexchange.com/questions/58656/best-way-to-draw-a-chevron-diagram-using-tikz
-\usetikzlibrary{calc,arrows,tikzmark,chains,positioning,shapes.symbols,babel}
+\usetikzlibrary{calc,shapes,arrows,tikzmark,chains,positioning,shapes.symbols,babel}
 
 \RequirePackage{suffix}%pour la commande étoilée
 
@@ -101,6 +101,12 @@
 
 \RequirePackage{nicematrix}%pour le tableur
 
+\let\myoldmulticolumn\multicolumn
+\AtBeginEnvironment{tabular}{\let\multicolumn\myoldmulticolumn}
+
+\RequirePackage{fmtcount}
+\FCloadlang{french}
+
 % https://stackoverflow.com/questions/3391103/how-to-make-the-grayed-round-box-using-tiks
 \RequirePackage{environ}
 %
@@ -311,6 +317,507 @@
   \day=\the\rappeljour\relax%
 }
 
+%%%
+% Smiley
+%%%
+%%https://tex.stackexchange.com/questions/3695/smileys-in-latex/227226
+\tikzset{face/.style={shape=circle,minimum size=4ex,shading=radial,outer sep=0pt, inner color=white!50!yellow,outer color= yellow!70!orange}}
+
+\newcommand{\emoticon}[2][]{%
+\scalebox{.5}{\begin{tikzpicture}
+\node[face,#1,draw,thick] (emoticon) {};
+%% The eyes are fixed.
+\draw[fill=white] (-1ex,0ex) ..controls (-0.5ex,0.2ex)and(0.5ex,0.2ex)..(1ex,0.0ex) ..controls ( 1.5ex,1.5ex)and( 0.2ex,1.7ex)..(0ex,0.4ex) ..controls (-0.2ex,1.7ex)and(-1.5ex,1.5ex)..(-1ex,0ex)--cycle;
+#2%
+\end{tikzpicture}}%
+}
+
+\newcommand{\pupils}{
+%% standard pupils
+\fill[shift={(0.5ex,0.5ex)},rotate=80] (0,0) ellipse (0.3ex and 0.15ex);
+\fill[shift={(-0.5ex,0.5ex)},rotate=100] (0,0) ellipse (0.3ex and 0.15ex);}
+
+\def\RKsmallsmile{%
+\emoticon{%
+\pupils
+%% mouth
+\draw[thick] (-0.5ex,-1ex)..controls (-0.25ex,-1.25ex)and(0.25ex,-1.25ex)..(0.5ex,-1ex);
+}%\emoticon
+}
+
+\def\RKsmile{%
+\emoticon{%
+\pupils
+\draw[thick] (-1ex,-1ex)..controls (-0.5ex,-1.5ex)and(0.5ex,-1.5ex)..(1ex,-1ex);
+}%\emoticon
+}
+
+\def\RKbigsmile{%
+\emoticon{%
+\pupils
+%% mouth
+\draw[thick] (-1.5ex,-0.5ex)..controls (-0.7ex,-1.7ex)and(0.7ex,-1.7ex)..(1.5ex,-0.5ex);
+}%\emoticon
+}
+
+\def\RKsad{%
+\emoticon{%
+%% pupils
+\fill[shift={( 0.5ex,0.5ex)},rotate=90] (0,0) ellipse (0.3ex and 0.15ex);
+\fill[shift={(-0.5ex,0.5ex)},rotate=90] (0,0) ellipse (0.3ex and 0.15ex);
+%% mouth
+\draw[thick] (-1ex,-1ex)..controls(-0.5ex,-0.5ex)and(0.5ex,-0.5ex)..(1ex,-1ex);
+}%\emoticon
+}
+
+\def\RKneutral{%
+\emoticon{%
+%% pupils
+\fill[shift={( 0.5ex,0.5ex)},rotate=90] (0,0) ellipse (0.3ex and 0.15ex);
+\fill[shift={(-0.5ex,0.5ex)},rotate=90] (0,0) ellipse (0.3ex and 0.15ex);
+%% mouth
+\draw[thick] (-0.5ex,-1ex)--(0.5ex,-1ex);
+}%\emoticon
+}
+
+\def\RKconfused{%
+\emoticon{%
+\pupils
+%% mouth
+\draw[thick] (-1ex,-0.75ex)--(1ex,-1.25ex);
+}%\emoticon
+}
+
+\def\RKsexy{%
+\emoticon{%
+\pupils
+%% mouth
+\draw[very thick,red,line cap=round] (-1ex,-1ex)..controls (-0.5ex,-1.5ex)and(0.5ex,-1.5ex)..(1ex,-1ex);
+%% eyelashes
+\draw (0.60ex,1.20ex)--(0.60ex,1.60ex)
+  (0.85ex,1.25ex)--(0.95ex,1.45ex)
+  (1.00ex,1.00ex)--(1.20ex,1.10ex)
+  (0.35ex,1.15ex)--(0.25ex,1.35ex)
+  (-0.60ex,1.20ex)--(-0.60ex,1.60ex)
+  (-0.85ex,1.25ex)--(-0.95ex,1.45ex)
+  (-1.00ex,1.00ex)--(-1.20ex,1.10ex)
+  (-0.35ex,1.15ex)--(-0.25ex,1.35ex);
+}%\emoticon
+}
+
+\def\RKangry{%
+\emoticon{%
+%% pupils
+\fill[shift={( 0.5ex,0.5ex)},rotate=90] (0,0) ellipse (0.3ex and 0.15ex);
+\fill[shift={(-0.5ex,0.5ex)},rotate=90] (0,0) ellipse (0.3ex and 0.15ex);
+%% mouth
+\draw[thick] (-1ex,-1ex)..controls(-0.5ex,-0.5ex)and(0.5ex,-0.5ex)..(1ex,-1ex);
+%% eyebrows
+\draw[thick] (0.2ex,1.15ex)--(0.5ex,1.6ex)(-0.2ex,1.15ex)--(-0.5ex,1.6ex);
+}%\emoticon
+}
+
+\def\RKlookup{%
+\emoticon{%
+%% pupils
+\fill[shift={( 0.5ex,1.05ex)},rotate= 80] (0,0) ellipse (0.2ex and 0.2ex);
+\fill[shift={(-0.5ex,1.05ex)},rotate=100] (0,0) ellipse (0.2ex and 0.2ex);
+%% mouth
+\draw[thick] (-1ex,-1ex)..controls(-0.5ex,-1.5ex)and(0.5ex,-1.5ex)..(1ex,-1ex);
+}%\emoticon
+}
+
+\def\RKlookdown{%
+\emoticon{%
+%% pupils
+\fill[shift={( 0.5ex,0.3ex)},rotate= 80] (0,0) ellipse (0.2ex and 0.2ex);
+\fill[shift={(-0.5ex,0.3ex)},rotate=100] (0,0) ellipse (0.2ex and 0.2ex);
+%% mouth
+\draw[thick] (-1ex,-1ex)..controls(-0.5ex,-1.5ex)and(0.5ex,-1.5ex)..(1ex,-1ex);
+}%\emoticon
+}
+
+\def\RKlookleft{%
+\emoticon{%
+%% pupils
+\fill[shift={( 0.25ex,0.5ex)},rotate=100] (0,0) ellipse (0.3ex and 0.15ex);
+\fill[shift={(-0.95ex,0.5ex)},rotate=100] (0,0) ellipse (0.3ex and 0.15ex);
+%% mouth
+\draw[thick] (-1ex,-1ex)..controls(-0.5ex,-1.5ex)and(0.5ex,-1.5ex)..(1ex,-1ex);
+}%\emoticon
+}
+
+\def\RKlookright{%
+\emoticon{%
+%% pupils
+\fill[shift={( 0.95ex,0.5ex)},rotate=80] (0,0) ellipse (0.3ex and 0.15ex);
+\fill[shift={(-0.25ex,0.5ex)},rotate=80] (0,0) ellipse (0.3ex and 0.15ex);
+%% mouth
+\draw[thick] (-1.0ex,-1ex)..controls(-0.5ex,-1.5ex)and(0.5ex,-1.5ex)..(1ex,-1ex);
+}%\emoticon
+}
+
+\def\RKblush{%
+\emoticon{%
+\pupils
+%% mouth
+\draw[thick] (-0.5ex,-1ex)..controls (-0.25ex,-1.25ex)and(0.25ex,-1.25ex)..(0.5ex,-1ex);
+%% blush
+\shade[shading=radial,inner color=white!50!red,outer color= yellow!80!orange] ( 1ex,-0.5ex) circle (0.4ex);
+\shade[shading=radial,inner color=white!50!red,outer color= yellow!80!orange] (-1ex,-0.5ex) circle (0.4ex);
+}%\emoticon
+}
+
+\def\RKalmostcrying{%
+\emoticon{%
+%% pupils
+\fill[shift={( 0.5ex,0.5ex)},rotate=105] (0,0) ellipse (0.3ex and 0.15ex);
+\fill[shift={(-0.5ex,0.5ex)},rotate= 75] (0,0) ellipse (0.3ex and 0.15ex);
+%% mouth
+\draw[thick] (-1ex,-1ex)..controls
+(-0.5ex,-0.8ex)and(0.5ex,-0.8ex)..(1ex,-1ex);
+}%\emoticon
+}
+
+\def\RKmartian{%
+\emoticon[inner color=white!50!green,outer color=green!70!red]{%
+\pupils
+%% mouth
+\draw[thick] (-1ex,-1ex)..controls
+(-0.5ex,-1.5ex)and(0.5ex,-1.5ex)..(1ex,-1ex);
+}%\emoticon
+}
+
+\def\RKdevilish{%
+\raisebox{-0.6ex}[0ex][0ex]{%
+\emoticon[inner color=white!50!red,outer color= red!70!red!90!black]{%
+\pupils
+%% mouth
+\draw[thick,line cap=round] (-1ex,-1ex)..controls (-0.5ex,-1.5ex)and(0.5ex,-1.5ex)..(1ex,-1ex);
+%% tail
+\draw[line width=0.45ex,-stealth,black] (emoticon.330)--++(330:0.01ex)..controls (3ex,-3ex)and(3.5ex,1ex)..(4.25ex,-3ex);
+\draw[line width=0.27ex,-stealth,red!90!black] (emoticon.330)--++(330:0.01ex)..controls (3ex,-3ex)and(3.5ex,1ex)..(4.22ex,-2.8ex);
+%% horns
+\draw[fill] (emoticon.80)..controls ( 0.6ex,2.4ex)..( 1ex,2.5ex)..controls ( 0.8ex,2.3ex)..(emoticon.70);
+\draw[fill] (emoticon.100)..controls (-0.6ex,2.4ex)..(-1ex,2.5ex)..controls (-0.8ex,2.3ex)..(emoticon.110); 
+\draw[thick] (0,0) circle (2ex);
+}%\emoticon
+}%\raisebox
+}
+
+%%%
+% Bon de sortie
+%%%
+\newtcolorbox{Sortie}{%
+  %Titre
+  colbacktitle=white,
+  fonttitle=\color{black}\Large\bfseries,
+  toptitle=2mm,
+  bottomtitle=2mm,
+  title={Nom : \hfill Date : \hspace*{3cm}},
+  %%Cadre principal
+  enhanced,
+  nobeforeafter,
+  width=13.15cm,
+  height=8.8cm,
+  colback=white,
+  valign=top,
+  %Cadre bas
+  sidebyside,
+  righthand width=0.05\linewidth,
+}
+
+\setKVdefault[ClesSortie]{MemeEnonce=false}%
+
+\newcommand\BonSortieSmiley{%
+  \Huge
+  \begin{center}
+    \RKangry
+
+    \vspace{1em}
+    
+    \RKsad
+
+  \vspace{1em}
+
+    \RKsmallsmile
+
+  \vspace{1em}
+
+    \RKbigsmile
+  \end{center}
+}
+
+\newcommand\BonSortie[5][]{%
+  \clearpage%
+  \useKVdefault[ClesSortie]%
+  \setKV[ClesSortie]{#1}%
+  \begin{tikzpicture}[remember picture, overlay]
+    \draw[dashed] (current page.north) to (current page.south);
+    \draw[dashed] (current page.west) to (current page.east);
+    \coordinate[xshift=7.425cm,yshift=-5.25cm] (A) at (current page.north west);
+    \coordinate[xshift=-7.425cm,yshift=-5.25cm] (B) at (current page.north east);
+    \coordinate[xshift=7.425cm,yshift=5.25cm] (C) at (current page.south west);
+    \coordinate[xshift=-7.425cm,yshift=5.25cm] (D) at (current page.south east);
+    \ifboolKV[ClesSortie]{MemeEnonce}{%
+      \foreach\i\in in {A,B,C,D}{%
+        \node (\i1) at (\i) {\begin{Sortie}
+            #2
+            \tcblower
+            \BonSortieSmiley
+          \end{Sortie}
+        };
+      }
+    }{%
+      \node (A1) at (A) {\begin{Sortie}
+          #2
+          \tcblower
+          \BonSortieSmiley
+        \end{Sortie}
+      };
+      \node (B1) at (B) {\begin{Sortie}
+          #3
+          \tcblower
+          \BonSortieSmiley
+        \end{Sortie}
+      };
+      \node (C1) at (C) {\begin{Sortie}
+          #4
+          \tcblower
+          \BonSortieSmiley
+        \end{Sortie}
+      };
+      \node (D1) at (D) {\begin{Sortie}
+          #5
+          \tcblower
+          \BonSortieSmiley
+        \end{Sortie}
+      };
+    }
+  \end{tikzpicture}
+}
+
+%%%
+% Ecriture des nombres en lettres
+%%%
+\setKVdefault[ClesEcriture]{Math=false,Majuscule=false,E=false,Tradition=false,Zero=false}
+
+\newcommand\EcriturePluriel[1]{%
+  \xintifboolexpr{#1 > 1}{s}{}%
+}
+
+\newcommand\EcritureDecimale{%
+  \StrLen{\ListeEcriture[2]}[\LongueurDecimale]%
+  \xintifboolexpr{\LongueurDecimale == 6}{%
+    ~millionième\EcriturePluriel{\ListeEcriture[2]}%
+  }{\xintifboolexpr{\LongueurDecimale == 5}{%
+     ~cent-millième\EcriturePluriel{\ListeEcriture[2]}
+    }{\xintifboolexpr{\LongueurDecimale == 4}{%
+        ~dix-millième\EcriturePluriel{\ListeEcriture[2]}
+      }{\xintifboolexpr{\LongueurDecimale == 3}{%
+          ~millième\EcriturePluriel{\ListeEcriture[2]}
+        }{\xintifboolexpr{\LongueurDecimale == 2}{%
+            ~centième\EcriturePluriel{\ListeEcriture[2]}
+          }{\xintifboolexpr{\LongueurDecimale == 1}{%
+              ~dixième\EcriturePluriel{\ListeEcriture[2]}
+            }{}%
+          }%
+        }%
+      }%
+    }%
+  }%
+}%
+
+\newcommand\Ecriture[2][]{%
+  \useKVdefault[ClesEcriture]%
+  \setKV[ClesEcriture]{#1}%
+  \ifboolKV[ClesEcriture]{Tradition}{%
+    \fmtcountsetoptions{french={dash or space=traditional}}%
+  }{%
+    \fmtcountsetoptions{french={dash or space=always}}%
+  }%
+  \setsepchar{.}%
+  \readlist*\ListeEcriture{#2}%
+  \xintifboolexpr{\ListeEcriturelen == 2}{%
+    \ifboolKV[ClesEcriture]{Majuscule}{%
+      \ifboolKV[ClesEcriture]{Zero}{}{\Numberstringnum{\ListeEcriture[1]}}\ifboolKV[ClesEcriture]{Math}{\ifboolKV[ClesEcriture]{Zero}{}{\ifboolKV[ClesEcriture]{E}{e}{}~unité\EcriturePluriel{\ListeEcriture[1]} et }}{\ifboolKV[ClesEcriture]{Tradition}{ virgule }{-virgule-}}\numberstringnum{\ListeEcriture[2]}\ifboolKV[ClesEcriture]{Math}{\EcritureDecimale}{}%
+    }{%
+      \ifboolKV[ClesEcriture]{Zero}{}{\numberstringnum{\ListeEcriture[1]}}\ifboolKV[ClesEcriture]{Math}{\ifboolKV[ClesEcriture]{Zero}{}{\ifboolKV[ClesEcriture]{E}{e}{}~unité\EcriturePluriel{\ListeEcriture[1]} et }}{\ifboolKV[ClesEcriture]{Tradition}{ virgule }{-virgule-}}\numberstringnum{\ListeEcriture[2]}\ifboolKV[ClesEcriture]{Math}{\EcritureDecimale}{}%
+    }}{%
+    \ifboolKV[ClesEcriture]{Majuscule}{%
+      \Numberstringnum{\ListeEcriture[1]}\ifboolKV[ClesEcriture]{Math}{\ifboolKV[ClesEcriture]{E}{e}{}~unité\EcriturePluriel{\ListeEcriture[1]}}{}%
+    }{%
+      \numberstringnum{\ListeEcriture[1]}\ifboolKV[ClesEcriture]{Math}{\ifboolKV[ClesEcriture]{E}{e}{}~unité\EcriturePluriel{\ListeEcriture[1]}}{}%
+    } 
+  }%
+}%
+
+%%%
+% D\'ecomposition de fractions d\'ecimales
+%%%
+\setKVdefault[ClesFracDeci]{Complete=false,SansZero=false,Remediation=false}
+
+\newcommand\FractionDecimale[2][]{%
+  \useKVdefault[ClesFracDeci]%
+  \setKV[ClesFracDeci]{#1}%
+  \setsepchar[*]{/}%
+  \readlist*\ListeFractionDecimale{#2}%
+  \xdef\FractionDeciNum{\ListeFractionDecimale[1]}%
+  \xdef\FractionDeciDeno{\ListeFractionDecimale[2]}%
+  \xdef\PartieEntiereFractionDeci{\fpeval{floor(\FractionDeciNum/\FractionDeciDeno)}}%
+  \xdef\PartieDecimaleFractionDeci{\fpeval{\FractionDeciNum-floor(\FractionDeciNum/\FractionDeciDeno)*\FractionDeciDeno}}%
+  \StrLen{\PartieDecimaleFractionDeci}[\LongueurPartieDecimale]%
+  \StrLen{\fpeval{\FractionDeciDeno}}[\LongueurFracDeciDeno]%
+  \StrLen{\fpeval{\FractionDeciNum}}[\LongueurFracDeciNum]%
+  \xintifboolexpr{\PartieEntiereFractionDeci == 0}{\xdef\LongueurPartieEntiere{0}}{\StrLen{\PartieEntiereFractionDeci}[\LongueurPartieEntiere]}%
+  \xintifboolexpr{\PartieEntiereFractionDeci == \fpeval{\FractionDeciNum/\FractionDeciDeno}}{%
+    \ensuremath{\ifboolKV[ClesFracDeci]{Remediation}{\dots}{\num{\PartieEntiereFractionDeci}}}%
+  }{%
+    \ifboolKV[ClesFracDeci]{SansZero}{%
+      \ensuremath{%
+        \xintifboolexpr{\PartieEntiereFractionDeci == 0}{}{\ifboolKV[ClesFracDeci]{Remediation}{\dots}{\num{\PartieEntiereFractionDeci}}+}%
+        \xintFor* ##1 in {\xintSeq{1}{\LongueurPartieDecimale}}\do{%
+          \StrMid{\PartieDecimaleFractionDeci}{##1}{##1}[\ChiffrePartieDecimale]%
+          \xintifForFirst{}{\xintifboolexpr{\ChiffrePartieDecimale == 0}{}{+}}\xintifboolexpr{\ChiffrePartieDecimale == 0}{}{\frac{\ifboolKV[ClesFracDeci]{Remediation}{\dots}{\num{\ChiffrePartieDecimale}}}{\num{\fpeval{10**(\LongueurFracDeciDeno-1-\LongueurPartieDecimale+##1)}}}}%
+        }%
+      }%
+    }{%
+      \ifboolKV[ClesFracDeci]{Complete}{%
+        \xintifboolexpr{\FractionDeciNum>\FractionDeciDeno}{%
+          \ensuremath{%
+            % on affiche la partie entière.
+            \xintifboolexpr{\PartieEntiereFractionDeci == 0}{}{\ifboolKV[ClesFracDeci]{Remediation}{\dots}{\num{\PartieEntiereFractionDeci}}+}%
+            \StrGobbleLeft{\FractionDeciNum}{\fpeval{\LongueurPartieEntiere}}[\DecompositionFracDeciComplete]%
+            % on affiche la partie décimale.
+            \xintFor* ##1 in {\xintSeq{1}{\fpeval{\LongueurFracDeciNum-\LongueurPartieEntiere}}}\do{%
+              \xintifForFirst{}{+}\StrMid{\DecompositionFracDeciComplete}{##1}{##1}[\ChiffrePartieDecimale]\frac{\ifboolKV[ClesFracDeci]{Remediation}{\dots}{\num{\ChiffrePartieDecimale}}}{\num{\fpeval{10**##1}}}%
+            }%
+          }%
+        }{%
+          \ensuremath{%
+            \xintFor* ##1 in {\xintSeq{1}{\LongueurPartieDecimale}}\do{%
+              \StrMid{\PartieDecimaleFractionDeci}{##1}{##1}[\ChiffrePartieDecimale]%
+              \xintifForFirst{}{+}\frac{\ifboolKV[ClesFracDeci]{Remediation}{\dots}{\num{\ChiffrePartieDecimale}}}{\num{\fpeval{10**(\LongueurFracDeciDeno-1-\LongueurPartieDecimale+##1)}}}%
+            }%
+          }%
+        }%
+      }{%
+        \ensuremath{%
+          \xintifboolexpr{\PartieEntiereFractionDeci == 0}{}{\ifboolKV[ClesFracDeci]{Remediation}{\dots}{\num{\PartieEntiereFractionDeci}}+}\frac{\ifboolKV[ClesFracDeci]{Remediation}{\dots}{\num{\PartieDecimaleFractionDeci}}}{\num{\FractionDeciDeno}}%
+        }%
+      }%
+    }%
+  }%
+}%
+
+%%%
+% Pyramide de calculs
+%%%
+\newcommand\DessinePyramideNombre[1]{%
+  \ifluatex
+  \mplibforcehmode
+  \begin{mplibcode}
+    pair A[][],B[];
+    nbetages:=\useKV[ClesPyramide]{Etages};
+    largeur:=\useKV[ClesPyramide]{Largeur};
+    hauteur:=\useKV[ClesPyramide]{Hauteur};
+    Nbeb:=0;%Pour associer les textes avec les points. Plus facile :)
+    if \useKV[ClesPyramide]{Double}:
+    for k=nbetages downto 1:
+    for l=0 upto (k-1):
+    Nbeb:=Nbeb+1;
+    A[k][l]=(0,0)+(nbetages-k)*(largeur/2,0)+(l*largeur,(nbetages-k)*hauteur);
+    B[Nbeb]=A[k][l];
+    trace ((unitsquare xscaled largeur) yscaled hauteur) shifted (A[k][l]-0.5*(largeur,hauteur));
+    endfor;
+    endfor;
+    for k=nbetages-1 downto 1:
+    for l=0 upto (k-1):
+    Nbeb:=Nbeb+1;
+    A[-k][l]=(0,0)+(nbetages-k)*(largeur/2,0)+(l*largeur,-(nbetages-k)*hauteur);
+    B[Nbeb]=A[-k][l];
+    trace ((unitsquare xscaled largeur) yscaled hauteur) shifted (A[-k][l]-0.5*(largeur,hauteur));
+    endfor;
+    endfor;
+    else:
+    if \useKV[ClesPyramide]{Inverse}:
+    change:=-1;
+    else:
+    change=1;
+    fi;
+    for k=nbetages downto 1:
+    for l=0 upto (k-1):
+    Nbeb:=Nbeb+1;
+    A[k][l]=(0,0)+(nbetages-k)*(largeur/2,0)+(l*largeur,change*(nbetages-k)*hauteur);
+    B[Nbeb]=A[k][l];
+    trace ((unitsquare xscaled largeur) yscaled hauteur) shifted (A[k][l]-0.5*(largeur,hauteur));
+    endfor;
+    endfor;
+    fi;
+    if \useKV[ClesPyramide]{Vide}:
+    else:
+    Nbeb:=0;
+    for p_=#1:
+    Nbeb:=Nbeb+1;
+    label(TEX(""&p_&""),B[Nbeb]);
+    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};}]
+    pair A[][],B[];
+    Nbeb:=0;
+    if Inverse:
+    change:=-1;
+    else:
+    change=1;
+    fi;
+    for k=nbetages downto 1:
+    for l=0 upto (k-1):
+    Nbeb:=Nbeb+1;
+    A[k][l]=(0,0)+(nbetages-k)*(largeur/2,0)+(l*largeur,change*(nbetages-k)*hauteur);
+    B[Nbeb]=A[k][l];
+    trace ((unitsquare xscaled largeur) yscaled hauteur) shifted (A[k][l]-0.5(largeur,hauteur));
+    endfor;
+    endfor;
+    Nbeb:=0;
+    if Vide:
+    else:
+    for p_=#1:
+    Nbeb:=Nbeb+1;
+    label(LATEX(""&p_&""),B[Nbeb]);
+    endfor;
+    fi;
+  \end{mpost}
+  \fi
+}
+
+\setKVdefault[ClesPyramide]{Etages=5,Largeur=2cm,Hauteur=1cm,Vide=false,Inverse=false,Double=false}%
+
+\newtoks\toklistecaseP%
+\def\UpdatetoksPyramide#1\nil{\addtotok\toklistecaseP{"#1",}}%
+
+\newcommand\PyramideNombre[2][]{%
+  \useKVdefault[ClesPyramide]%
+  \setKV[ClesPyramide]{#1}%
+  \ifx\bla#2\bla%
+  \setKV[ClesPyramide]{Vide=true}%
+  \DessinePyramideNombre{\the\toklistecaseP}%
+  \else%
+  \setsepchar{,}%
+  \readlist*\ListePyramide{#2}%
+  \ifboolKV[ClesPyramide]{Double}{%
+    \def\CalculNombreComposants{\fpeval{\useKV[ClesPyramide]{Etages}*\useKV[ClesPyramide]{Etages}}}%
+  }{%
+    \def\CalculNombreComposants{\fpeval{\useKV[ClesPyramide]{Etages}*(\useKV[ClesPyramide]{Etages}+1)/2}}%
+  }%
+  \xintifboolexpr{\ListePyramidelen==\CalculNombreComposants}{%
+    \toklistecaseP{}%
+    \foreachitem\compteur\in\ListePyramide{\expandafter\UpdatetoksPyramide\compteur\nil}%
+    \DessinePyramideNombre{\the\toklistecaseP}%
+  }{Le nombre d'éléments dans la liste des propositions n'est pas compatible avec le nombre d'étages choisi.}%
+  \fi%
+}%
 
 %%%
 % Tables Addition-Multiplication
@@ -421,42 +928,42 @@
 %%%
 \setKVdefault[ClesRgt]{Croissant,Decroissant=false,Strict,Fraction=false,Details=false}
 
+\dtlexpandnewvalue%
 \DTLgnewdb{mtnumedb}%
-\DTLgnewdb{mtnumeretourdb}%
 
 \newcommand\Rangement[2][]{%
   \useKVdefault[ClesRgt]%
   \setKV[ClesRgt]{#1}%
   \ifboolKV[ClesRgt]{Fraction}{%
-    \setsepchar[*]{,*/}%\ignoreemptyitems%
+    \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}}%
-    }%
+    }%ok
     % On cr\'ee la liste des rangements.
     \DTLcleardb{mtnumedb}%
     % on les trie pour les ranger par ordre croissant
     \foreachitem\x\in\ListeRgt{%
       \DTLnewrow{mtnumedb}%
-      \itemtomacro\ListeRgt[\xcnt,1]\y%
-      \DTLnewdbentry{mtnumedb}{Numeric}{\fpeval{\y*\the\ppcm/\ListeRgt[\xcnt,2]}}%
+      \xdef\toto{\fpeval{\ListeRgt[\xcnt,1]*\the\ppcm/\ListeRgt[\xcnt,2]}}%
+      \DTLnewdbentry{mtnumedb}{numeric}{\toto}%
     }%
     % On trie
     \ifboolKV[ClesRgt]{Decroissant}{%
       % On trie la liste
-      \dtlsort{Numeric=descending}{mtnumedb}{\dtlicompare}%
-      \ifboolKV[ClesRgt]{Details}{\ensuremath{\DTLforeach{mtnumedb}{\numeroDonnee=Numeric}{\frac{\num{\numeroDonnee}}{\num{\the\ppcm}}\DTLiflastrow{}{\ifboolKV[ClesRgt]{Strict}{>}{\geqslant}}}}}{%
-        \ensuremath{\DTLforeach{mtnumedb}{\numeroDonnee=Numeric}{\Simplification{\numeroDonnee}{\ppcm}\DTLiflastrow{}{\ifboolKV[ClesRgt]{Strict}{>}{\geqslant}}}}%
+      \dtlsort{numeric=descending}{mtnumedb}{\dtlicompare}%
+      \ifboolKV[ClesRgt]{Details}{\ensuremath{\DTLforeach{mtnumedb}{\numeroDonnee=numeric}{\frac{\num{\numeroDonnee}}{\num{\the\ppcm}}\DTLiflastrow{}{\ifboolKV[ClesRgt]{Strict}{>}{\geqslant}}}}}{%
+        \ensuremath{\DTLforeach{mtnumedb}{\numeroDonnee=numeric}{\Simplification{\numeroDonnee}{\ppcm}\DTLiflastrow{}{\ifboolKV[ClesRgt]{Strict}{>}{\geqslant}}}}%
       }
     }{%
       % On trie la liste
-      \dtlsort{Numeric}{mtnumedb}{\dtlicompare}%
+      \dtlsort{numeric}{mtnumedb}{\dtlicompare}%
       \ifboolKV[ClesRgt]{Details}{%
-        \ensuremath{\DTLforeach{mtnumedb}{\numeroDonnee=Numeric}{\frac{\num{\numeroDonnee}}{\num{\the\ppcm}}\DTLiflastrow{}{\ifboolKV[ClesRgt]{Strict}{<}{\leqslant}}}}%
+        \ensuremath{\DTLforeach{mtnumedb}{\numeroDonnee=numeric}{\frac{\num{\numeroDonnee}}{\num{\the\ppcm}}\DTLiflastrow{}{\ifboolKV[ClesRgt]{Strict}{<}{\leqslant}}}}%
       }{%
-        \ensuremath{\DTLforeach{mtnumedb}{\numeroDonnee=Numeric}{\Simplification{\numeroDonnee}{\ppcm}\DTLiflastrow{}{\ifboolKV[ClesRgt]{Strict}{<}{\leqslant}}}}%
+        \ensuremath{\DTLforeach{mtnumedb}{\numeroDonnee=numeric}{\Simplification{\numeroDonnee}{\ppcm}\DTLiflastrow{}{\ifboolKV[ClesRgt]{Strict}{<}{\leqslant}}}}%
       }
     }%
   }{%
@@ -468,25 +975,85 @@
     \foreachitem\x\in\ListeRgt{%
       \DTLnewrow{mtdb}%
       \itemtomacro\ListeRgt[\xcnt]\y%
-      \DTLnewdbentry{mtdb}{Numeric}{\y}%
+      \DTLnewdbentry{mtdb}{numeric}{\y}%
     }%
     % 
     \ifboolKV[ClesRgt]{Decroissant}{%
       % On trie la liste
-      \dtlsort{Numeric=descending}{mtdb}{\dtlicompare}%
-      \ensuremath{\DTLforeach{mtdb}{\numeroDonnee=Numeric}{\num{\numeroDonnee}\DTLiflastrow{}{\ifboolKV[ClesRgt]{Strict}{>}{\geqslant}}}}%
+      \dtlsort{numeric=descending}{mtdb}{\dtlicompare}%
+      \ensuremath{\DTLforeach{mtdb}{\numeroDonnee=numeric}{\num{\numeroDonnee}\DTLiflastrow{}{\ifboolKV[ClesRgt]{Strict}{>}{\geqslant}}}}%
     }{%
       % On trie la liste
-      \dtlsort{Numeric}{mtdb}{\dtlicompare}%
-      \ensuremath{\DTLforeach{mtdb}{\numeroDonnee=Numeric}{\num{\numeroDonnee}\DTLiflastrow{}{\ifboolKV[ClesRgt]{Strict}{<}{\leqslant}}}}%
+      \dtlsort{numeric}{mtdb}{\dtlicompare}%
+      \ensuremath{\DTLforeach{mtdb}{\numeroDonnee=numeric}{\num{\numeroDonnee}\DTLiflastrow{}{\ifboolKV[ClesRgt]{Strict}{<}{\leqslant}}}}%
     }%
-  }
+  }%
+}%
+
+%%%
+% Mots Cod\'es
+%%%
+\setKVdefault[MotsCodes]{LargeurT=1cm,Colonnes=5,Largeur=3cm,Solution=false,Math=false}%
+
+\newcommand\MotsCodes[2][]{%
+  \useKVdefault[MotsCodes]%
+  \setKV[MotsCodes]{#1}%
+  \setsepchar[*]{§*/}%
+  \readlist*\ListeMotsCodes{#2}%
+  \xdef\ListeMotsCodesPas{\fpeval{\ListeMotsCodeslen/\useKV[MotsCodes]{Colonnes}}}
+  \begin{NiceTabular}{*{\fpeval{\useKV[MotsCodes]{Colonnes}}}{>{\centering\arraybackslash}m{\useKV[MotsCodes]{Largeur}}}}
+    \xintFor* ##1 in {\xintSeq {1}{\ListeMotsCodesPas}}\do{%
+      \xintFor* ##2 in {\xintSeq {1}{\fpeval{\useKV[MotsCodes]{Colonnes}}}}\do{%
+        \xintifForFirst{}{&}\Block[draw=black]{4-1}{}%
+      }\\
+      \xintFor* ##2 in {\xintSeq {1}{\fpeval{\useKV[MotsCodes]{Colonnes}}}}\do{%
+        \xintifForFirst{}{&}\ListeMotsCodes[\fpeval{(##1-1)*\useKV[MotsCodes]{Colonnes}+##2},1]
+      }\\
+      \xintFor* ##2 in {\xintSeq {1}{\fpeval{\useKV[MotsCodes]{Colonnes}}}}\do{%
+        \xintifForFirst{}{&}%
+      }\\
+      \xintFor* ##2 in {\xintSeq {1}{\fpeval{\useKV[MotsCodes]{Colonnes}}}}\do{%
+        \xintifForFirst{}{&}\textbf{\Large\ListeMotsCodes[\fpeval{(##1-1)*\useKV[MotsCodes]{Colonnes}+##2},2]}
+      }\\
+    }%
+  \end{NiceTabular}%
+}%
+
+\newcommand\MotsCodesTableau[3][]{%
+  \useKVdefault[MotsCodes]%
+  \setKV[MotsCodes]{#1}%
+  \setsepchar[*]{,*/}
+  \readlist*\ListeMotsCodesTableau{#2}%
+  \xdef\ListeMotsCodesMax{0}%
+  \setsepchar{,}%
+  \readlist*\ListeMotsCodesPhrase{#3}%
+  \foreachitem\compteur\in\ListeMotsCodesTableau{%
+    \xintifboolexpr{\ListeMotsCodesMax<\listlen\ListeMotsCodesTableau[\compteurcnt]}{\xdef\ListeMotsCodesMax{\fpeval{\listlen\ListeMotsCodesTableau[\compteurcnt]}}}{}%
+  }%
+  \begin{NiceTabular}{*{\fpeval{\ListeMotsCodesMax}}{>{\centering\arraybackslash}m{\useKV[MotsCodes]{LargeurT}}}}
+    \xintFor* ##1 in {\xintSeq {1}{\fpeval{\ListeMotsCodesTableaulen}}}\do{%
+      \xintFor* ##2 in {\xintSeq {1}{\listlen\ListeMotsCodesTableau[##1]}}\do{%
+        \xintifForFirst{}{&}\ifboolKV[MotsCodes]{Solution}{%
+          \StrMid{\ListeMotsCodesPhrase[##1]}{##2}{##2}[\MotsCodesMaLettre]%
+          \IfStrEq{\MotsCodesMaLettre}{*}{\Block[draw=black,fill=black]{3-1}{}}{\Block[draw=black]{3-1}{\StrMid{\ListeMotsCodesPhrase[##1]}{##2}{##2}}}%
+        }{%
+          \IfStrEq{\ListeMotsCodesTableau[##1,##2]}{*}{\Block[draw=black,fill=black]{3-1}{}}{\Block[draw=black]{3-1}{}}%
+        }%%
+      }\\
+      \xintFor* ##2 in {\xintSeq {1}{\listlen\ListeMotsCodesTableau[##1]}}\do{%
+        \xintifForFirst{}{&}
+      }\\
+      \xintFor* ##2 in {\xintSeq {1}{\listlen\ListeMotsCodesTableau[##1]}}\do{%
+        \xintifForFirst{}{&}\IfStrEq{\ListeMotsCodesTableau[##1,##2]}{*}{}{\footnotesize\ifboolKV[MotsCodes]{Math}{\ListeMotsCodesTableau[##1,##2]}{\num{\ListeMotsCodesTableau[##1,##2]}}}%
+      }\\
+    }%
+  \end{NiceTabular}%
 }%
 
 %%%
 % Labyrinthe
 %%%
-\setKVdefault[Labyrinthe]{Lignes=6,Colonnes=3,Longueur=4,Hauteur=2,Passages=false,EcartH=1,EcartV=1,CouleurF=gray!50,Texte=\color{yellow},SensImpose=false,Slop}
+\setKVdefault[Labyrinthe]{Lignes=6,Colonnes=3,Longueur=4,Hauteur=2,Passages=false,EcartH=1,EcartV=1,CouleurF=gray!50,Texte=\color{black},SensImpose=false,Slop}
 
 \tikzset{FDirect/.style={-stealth}}
 \tikzset{FIndirect/.style={stealth-}}
@@ -621,6 +1188,1086 @@
     d\'efinitions de {\ttfamily Colonnes} et {\ttfamily Lignes} !}}%
 }
 
+%%%
+% Labyrinthe Nombre
+%%%
+
+\setKVdefault[ClesLabyNombre]{Multiple=5,XDepart=0,YDepart=0,Longueur=7,Largeur=4,XArrivee=6,YArrivee=3,Solution=false,Echelle=1,Angle=0,Couleur=red,Murs=false}
+
+\newcommand\LabyNombre[1][]{%
+  \useKVdefault[ClesLabyNombre]%
+  \setKV[ClesLabyNombre]{#1}%
+  \ifboolKV[ClesLabyNombre]{Solution}{%
+    \TraceSolution{\useKV[ClesLabyNombre]{Multiple}}{\useKV[ClesLabyNombre]{Longueur}}{\useKV[ClesLabyNombre]{Largeur}}{(\useKV[ClesLabyNombre]{YDepart},\useKV[ClesLabyNombre]{XDepart})}{(\useKV[ClesLabyNombre]{YArrivee},\useKV[ClesLabyNombre]{XArrivee})}{\useKV[ClesLabyNombre]{Solution}}
+  }{%
+    \TraceLabyNombre{\useKV[ClesLabyNombre]{Multiple}}{\useKV[ClesLabyNombre]{Longueur}}{\useKV[ClesLabyNombre]{Largeur}}{(\useKV[ClesLabyNombre]{YDepart},\useKV[ClesLabyNombre]{XDepart})}{(\useKV[ClesLabyNombre]{YArrivee},\useKV[ClesLabyNombre]{XArrivee})}{\useKV[ClesLabyNombre]{Solution}}
+  }%
+}
+
+\newcommand\TraceLabyNombre[6]{%
+  \mplibforcehmode%
+  \mplibcodeinherit{enable}%\xintifboolexpr{#6==false}{\mplibcodeinherit{enable}}{}
+  \begin{mplibcode}
+    input PfCLabyNombre;
+
+    boolean Murs;
+    Murs=\useKV[ClesLabyNombre]{Murs};
+    
+    numeric Multiple;
+    Multiple=#1;
+    % Initialisation du labyrinthe
+    InitialisationLabyrinthe(#2,#3);
+    % On initialise les paramètres du parcours
+    numeric choixligneD,choixligneA,choixcolonneD,choixcolonneA;
+    choixligneD=xpart(#4);
+    choixcolonneD=ypart(#4);
+    choixligneA=xpart(#5);
+    choixcolonneA=ypart(#5);%
+    pair Depart;
+    Depart=N[choixligneD][choixcolonneD];
+    pair Arrivee;
+    Arrivee=N[choixligneA][choixcolonneA];
+    pair Mobile;
+    Mobile=Depart;
+    RAZPileChemin;
+    % Exploration du labyrinthe
+    PushChemin((choixligneD,choixcolonneD));
+    CaseExploree[choixligneD][choixcolonneD]:=true;
+    VoisinDispo(choixligneD,choixcolonneD);
+    forever: exitif Mobile=Arrivee;%nb=0;
+    nb:=ceiling(uniformdeviate(nbvoisin));
+    if nb>0:
+      for k=1 upto nbvoisin:
+        CaseExploree[xpart(PileVoisin[k])][ypart(PileVoisin[k])]:=true;
+      endfor;
+      PushChemin((xpart(PileVoisin[nb]),ypart(PileVoisin[nb])));
+      Mobile:=N[xpart(PileChemin[indiceChemin])][ypart(PileChemin[indiceChemin])];
+      VoisinDispo(xpart(PileChemin[indiceChemin]),ypart(PileChemin[indiceChemin]));
+    else:
+      PopChemin;
+    fi;
+    endfor;
+    % Affichagefinal
+    % on sauvegarde les nombres aléatoires
+    numeric NbAffiche[];
+    numeric NbSol[];
+    % on écrit des nombres au hasard, mais sans être multiple du nombre choisi
+    numeric nbaffiche;
+    nbaffiche=0;
+    for k=0 upto LargeurLaby-1:
+      for l=0 upto LongueurLaby-1:
+        nbaffiche:=nbaffiche+1;
+        NbAffiche[nbaffiche]:=(50+ceiling(uniformdeviate(100)))*Multiple+ceiling(uniformdeviate(Multiple-1));
+      endfor;
+    endfor;
+    % On crée des multiples du nombre choisi
+    for k=2 upto indiceChemin-1:
+      NbSol[k]=(50+ceiling(uniformdeviate(100)))*Multiple;
+    endfor;
+    % On affiche
+    picture Corps;
+    Corps=image(
+      nbaffiche:=0;
+      for k=0 upto LargeurLaby-1:
+        for l=0 upto LongueurLaby-1:
+	  nbaffiche:=nbaffiche+1;
+          label(TEX("\num{"&decimal(NbAffiche[nbaffiche])&"}"),M[k][l]);
+        endfor;
+      endfor;
+      remplis ((unitsquare scaled 10mm) shifted N[choixligneD][choixcolonneD]) withcolor \useKV[ClesLabyNombre]{Couleur};
+      remplis ((unitsquare scaled 10mm) shifted Arrivee) withcolor \useKV[ClesLabyNombre]{Couleur};
+      for k=2 upto indiceChemin-1:
+        remplis ((unitsquare scaled 10mm) shifted N[xpart(PileChemin[k])][ypart(PileChemin[k])]) withcolor white;
+        label(TEX("\num{"&decimal(NbSol[k])&"}"),M[xpart(PileChemin[k])][ypart(PileChemin[k])]);
+      endfor;
+      trace TraceLabyrinthe;
+    );
+    Corps:=(Corps scaled \useKV[ClesLabyNombre]{Echelle}) rotated \useKV[ClesLabyNombre]{Angle};
+    trace Corps;
+  \end{mplibcode}
+}
+
+\newcommand\TraceSolution[6]{%
+  \mplibforcehmode%
+  \begin{mplibcode}
+    picture CorpsSolution;
+    CorpsSolution=image(
+      nbaffiche:=0;
+      for k=0 upto #3-1:
+        for l=0 upto #2-1:
+          nbaffiche:=nbaffiche+1;
+          label(TEX("\num{"&decimal(NbAffiche[nbaffiche])&"}"),M[k][l]);
+        endfor;
+      endfor;
+      remplis ((unitsquare scaled 10mm) shifted N[choixligneD][choixcolonneD]) withcolor \useKV[ClesLabyNombre]{Couleur};
+      remplis ((unitsquare scaled 10mm) shifted Arrivee) withcolor \useKV[ClesLabyNombre]{Couleur};
+      for k=2 upto indiceChemin-1:
+        remplis ((unitsquare scaled 10mm) shifted N[xpart(PileChemin[k])][ypart(PileChemin[k])]) withcolor 0.5white;
+        label(TEX("\num{"&decimal(NbSol[k])&"}"),M[xpart(PileChemin[k])][ypart(PileChemin[k])]);
+      endfor;
+      trace TraceLabyrinthe;
+      );
+      CorpsSolution:=(CorpsSolution scaled \useKV[ClesLabyNombre]{Echelle}) rotated \useKV[ClesLabyNombre]{Angle};
+      trace CorpsSolution;
+  \end{mplibcode}
+  \mplibcodeinherit{disable}
+}%
+
+%%%
+% Mots empilés
+%%%
+\setKVdefault[ClesMotEmpile]{Colonne=4,Solution=false,Couleur=black}
+
+\newcounter{CompteurMotEmpile}
+
+\newcommand\MotsEmpiles[2][]{%
+  \useKVdefault[ClesMotEmpile]%
+  \setKV[ClesMotEmpile]{#1}%
+  \setcounter{CompteurMotEmpile}{0}%
+  \setsepchar[*]{,*/}%
+  \readlist*\ListeMotsEmpiles{#2}
+  \xdef\ListeMotsEmpilesMax{0}%
+  \colorlet{MotEmpileCouleur}{\useKV[ClesMotEmpile]{Couleur}}%
+  \foreachitem\compteur\in\ListeMotsEmpiles{%
+    \StrLen{\ListeMotsEmpiles[\compteurcnt,2]}[\LongueurMot]%
+    \xintifboolexpr{\ListeMotsEmpilesMax<\fpeval{\ListeMotsEmpiles[\compteurcnt,1]+\LongueurMot}}{\xdef\ListeMotsEmpilesMax{\fpeval{\ListeMotsEmpiles[\compteurcnt,1]+\LongueurMot}}}{}%
+  }%
+  \begin{NiceTabular}{c|*{\fpeval{\ListeMotsEmpilesMax}}{m{0.5em}}}
+    \Block{1-\fpeval{\useKV[ClesMotEmpile]{Colonne}+2}}{}\xintFor* ##1 in {\xintSeq {1}{\fpeval{\useKV[ClesMotEmpile]{Colonne}}}}\do{&}&$\downarrow$\xintFor* ##1 in {\xintSeq {1}{\fpeval{\ListeMotsEmpilesMax-\useKV[ClesMotEmpile]{Colonne}-1}}}\do{&}\\
+    \xintFor* ##1 in {\xintSeq {1}{\fpeval{\ListeMotsEmpileslen}}}\do{%
+      \rule[-1.2ex]{0pt}{3.8ex}\stepcounter{CompteurMotEmpile}\Alph{CompteurMotEmpile}&\Block{1-\fpeval{\ListeMotsEmpiles[##1,1]}}{}\xintFor* ##2 in {\xintSeq {1}{\fpeval{\ListeMotsEmpiles[##1,1]}}}\do{%
+        &
+      }%
+      \StrLen{\ListeMotsEmpiles[##1,2]}[\LongueurMot]%
+      \xintFor* ##3 in {\xintSeq {1}{\fpeval{\LongueurMot}}}\do{%
+        \xintifForFirst{}{&}\Block[draw=black]{1-1}{\ifboolKV[ClesMotEmpile]{Solution}{\centering\arraybackslash\StrMid{\ListeMotsEmpiles[##1,2]}{##3}{##3}}{}}%%
+      }
+      \\
+    }%
+    \CodeAfter\tikz\draw[line width=1.5pt,MotEmpileCouleur](row-2-|col-\fpeval{\useKV[ClesMotEmpile]{Colonne}+2}) rectangle (row-\fpeval{\ListeMotsEmpileslen+2}-|col-\fpeval{\useKV[ClesMotEmpile]{Colonne}+3});
+  \end{NiceTabular}
+}%
+
+%%%
+% Colorilude
+%%%
+\setKVdefault[Colorilude]{Largeur=10,Lignes=10,Legende=false,Coef=0.6,Solution=false}
+
+\newcommand{\dispogpfc}[3][]{%
+  \setbox1=\hbox{#2}%
+  \setbox2=\hbox{#3}%
+  \begin{minipage}{\wd2}%
+    #3%
+  \end{minipage}%
+  \quad%
+  \begin{minipage}{\wd1}%
+    #2%
+  \end{minipage}%
+}%
+
+\newcommand\TraceEchiquierColorilude{%
+  \ifluatex
+  \begin{mplibcode}
+    pair A,B,C,D;%pour la grille
+    A=(0,0);
+    B-A=u*\useKV[Colorilude]{Coef}*(\useKV[Colorilude]{Largeur},0);
+    C-B=u*\useKV[Colorilude]{Coef}*(0,-\useKV[Colorilude]{Lignes});
+    D-C=A-B;
+    nblargeur=\useKV[Colorilude]{Largeur};
+    nblignes=\useKV[Colorilude]{Lignes};
+    for k=1 upto nblargeur-1:
+    draw (k/nblargeur)[A,B]--(k/nblargeur)[D,C];
+    endfor;
+    for k=1 upto nblignes-1:
+    draw (k/nblignes)[A,D]--(k/nblignes)[B,C];
+    endfor;
+    draw polygone(A,B,C,D) withpen pensquare scaled 1.5;
+    if \useKV[Colorilude]{Legende}:
+    label.lrt(btex \tiny d'après APMEP etex rotated 90,B);
+    fi;
+  \end{mplibcode}
+  \else
+  \begin{mpost}[mpsettings={boolean Legende;
+      Legende=\useKV[Colorilude]{Legende};
+      nblargeur:=\useKV[Colorilude]{Largeur};
+      nblignes:=\useKV[Colorilude]{Lignes};
+      coef:=\useKV[Colorilude]{Coef};}]
+    pair A,B,C,D;%pour la grille
+    A=(0,0);
+    B-A=u*coef*(nblargeur,0);
+    C-B=u*coef*(0,-nblignes);
+    D-C=A-B;
+    for k=1 upto nblargeur-1:
+    draw (k/nblargeur)[A,B]--(k/nblargeur)[D,C];
+    endfor;
+    for k=1 upto nblignes-1:
+    draw (k/nblignes)[A,D]--(k/nblignes)[B,C];
+    endfor;
+    draw polygone(A,B,C,D) withpen pensquare scaled 1.5;
+    if Legende:
+    label.lrt(\btex \tiny d'après APMEP etex rotated 90,B);
+    fi;
+  \end{mpost}
+  \fi
+}%
+
+\newcommand\TraceEchiquierColoreColorilude{%
+  \ifluatex%
+  \mplibforcehmode%
+  \begin{mplibcode}
+    pair A,B,C,D;%pour la grille
+    A=(0,0);
+    B-A=u*\useKV[Colorilude]{Coef}*(\useKV[Colorilude]{Largeur},0);
+    C-B=u*\useKV[Colorilude]{Coef}*(0,-\useKV[Colorilude]{Lignes});
+    D-C=A-B;
+    numeric nblargeur,nblignes;
+    nblargeur:=\useKV[Colorilude]{Largeur};
+    nblignes:=\useKV[Colorilude]{Lignes};
+    % on récupère les données de coloriage
+    numeric n;
+    n:=0;
+    numeric nbCases[];
+    color ColorSucc[];
+    for p_=\the\toklisteremplissage:
+    n:=n+1;
+    if (n mod 2)=0:
+    nbCases[n div 2]:=p_;
+    else:
+    ColorSucc[n div 2]:=p_;
+    fi;
+    endfor;
+    % on colorie :)
+    numeric NBCASES;
+    NBCASES:=0;
+    for l=1 upto (n div 2):
+    fill ((unitsquare xscaled (\useKV[Colorilude]{Coef}*u*nbCases[l]) yscaled (\useKV[Colorilude]{Coef}*u)) shifted(\useKV[Colorilude]{Coef}*u*(NBCASES mod nblargeur,-1-(NBCASES div nblargeur)))) withcolor ColorSucc[l-1];
+    NBCASES:=NBCASES+nbCases[l];
+    endfor;
+    % on trace le quadrillage
+    for k=1 upto nblargeur-1:
+    draw (k/nblargeur)[A,B]--(k/nblargeur)[D,C];
+    endfor;
+    for k=1 upto nblignes-1:
+    draw (k/nblignes)[A,D]--(k/nblignes)[B,C];
+    endfor;
+    draw polygone(A,B,C,D) withpen pensquare scaled 1.5;
+    if \useKV[Colorilude]{Legende}:
+    label.lrt(btex \tiny d'après APMEP etex rotated 90,B);
+    fi;
+  \end{mplibcode}
+  \else
+  \begin{mpost}[mpsettings={boolean Legende;
+      Legende=\useKV[Colorilude]{Legende};
+      nblargeur:=\useKV[Colorilude]{Largeur};
+      nblignes:=\useKV[Colorilude]{Lignes};
+      coef:=\useKV[Colorilude]{Coef};
+      numeric n;
+      n:=0;
+      numeric nbCases[];
+      color ColorSucc[];
+      for p_=\the\toklisteremplissage:
+      n:=n+1;
+      if (n mod 2)=0:
+      nbCases[n div 2]:=p_;
+      else:
+      ColorSucc[n div 2]:=p_;
+      fi;
+      endfor;
+    }]
+    pair A,B,C,D;%pour la grille
+    A=(0,0);
+    B-A=u*coef*(nblargeur,0);
+    C-B=u*coef*(0,-nblignes);
+    D-C=A-B;
+    % on colorie :)
+    numeric NBCASES;
+    NBCASES:=0;
+    for l=1 upto (n div 2):
+    fill ((unitsquare xscaled (coef*u*nbCases[l]) yscaled (coef*u)) shifted(coef*u*(NBCASES mod nblargeur,-1-(NBCASES div nblargeur)))) withcolor ColorSucc[l-1];
+    NBCASES:=NBCASES+nbCases[l];
+    endfor;
+    % on trace le quadrillage
+    for k=1 upto nblargeur-1:
+    draw (k/nblargeur)[A,B]--(k/nblargeur)[D,C];
+    endfor;
+    for k=1 upto nblignes-1:
+    draw (k/nblignes)[A,D]--(k/nblignes)[B,C];
+    endfor;
+    draw polygone(A,B,C,D) withpen pensquare scaled 1.5;
+    if Legende:
+    label.lrt(\btex \tiny d'après APMEP etex rotated 90,B);
+    fi;
+  \end{mpost}
+  \fi
+}%
+
+\newtoks\toklisteremplissage%
+\toklisteremplissage{}%
+\def\UpdateRemplissage#1\nil{\addtotok\toklisteremplissage{#1,}}%
+
+\newcommand\ColoriludeEnonce{%
+Pour chaque ligne de la grille, colorie de gauche à droite, de la
+couleur indiquée, le nombre de cases donné par le résultat du calcul.
+}%
+
+\newcommand\ColoriludeListeCouleur[1]{%
+  \setsepchar{ }%
+  \readlist\ListeColoriludeCouleurs{#1}%
+  \foreachitem\compteur\in\ListeColoriludeCouleurs{%
+     \ifodd\compteurcnt\fbox{\begin{minipage}{1em}\centering\text{\ttfamily\bfseries\compteur}\end{minipage}}~\else\compteur\quad\fi%
+  }%
+}%
+
+\newcommand\Colorilude[2][]{%
+  \useKVdefault[Colorilude]%
+  \setKV[Colorilude]{#1}%
+  \setsepchar{\\/ }%
+  \readlist\ListeColorilude{#2}%
+  \ifboolKV[Colorilude]{Solution}{%
+    \toklisteremplissage{}%
+    \foreachitem\compteur\in\ListeColorilude{%
+      \foreachitem\couleur\in\ListeColorilude[\compteurcnt]{%
+        \expandafter\UpdateRemplissage\couleur\nil}%
+    }%
+    \TraceEchiquierColoreColorilude%
+  }{%
+    \dispogpfc{%
+      \TraceEchiquierColorilude%
+    }{%
+      % On cherche le nombre max de colonnes
+      \xdef\ListeColoriludeMax{0}%
+      \xintFor* ##1 in {\xintSeq {1}{\ListeColoriludelen}}\do{%
+        \xintifboolexpr{\listlen\ListeColorilude[##1]>\ListeColoriludeMax}{%
+          \xdef\ListeColoriludeMax{\listlen\ListeColorilude[##1]}%
+        }{}%
+      }%
+      % 
+      % On affiche le tableau
+      \setlength{\tabcolsep}{0.2\tabcolsep}%
+      \begin{NiceTabular}{*{\fpeval{\ListeColoriludeMax/2}}{rl}}%
+        \xintFor* ##1 in {\xintSeq {1}{\ListeColoriludelen}}\do{%
+          \xintifboolexpr{\listlen\ListeColorilude[##1]==\ListeColoriludeMax}{%
+            \xintFor* ##2 in {\xintSeq {1}{\listlen\ListeColorilude[##1]}}\do{%
+              \xintifForFirst{}{&~}\ifodd##2\fbox{\begin{minipage}{1em}\centering\text{\ttfamily\bfseries\ListeColorilude[##1,##2]}\end{minipage}}~\else$\ListeColorilude[##1,##2]$\fi%
+            }%
+          }{%
+            \xintFor* ##2 in {\xintSeq {1}{\listlen\ListeColorilude[##1]}}\do{%
+              \xintifForFirst{}{&~}\ifodd##2\fbox{\begin{minipage}{1em}\centering\text{\ttfamily\bfseries\ListeColorilude[##1,##2]}\end{minipage}}~\else$\ListeColorilude[##1,##2]$\fi%
+            }%
+            &\hbox to1em{~}&\Cdots%
+          }%
+          \\[0.5em]%
+        }%
+      \end{NiceTabular}%
+    }%
+  }%
+}%
+
+%%%
+% Mosaique
+%%%
+\setKVdefault[ClesMosaique]{Largeur=2,Hauteur=2,Solution=false,Type=1,Label,Echelle=1cm}
+
+\newcommand\DessineMosaique[2][]{%
+  \useKVdefault[ClesMosaique]%
+  \setKV[ClesMosaique]{#1}%
+  \ifluatex%
+  \mplibforcehmode%
+  \begin{mplibcode}
+    u:=\useKV[ClesMosaique]{Echelle};
+    Type:=\useKV[ClesMosaique]{Type};
+    input PfCMosaique;
+    trace if Type=1:MosaiqueUn[#2] elseif Type=2: MosaiqueDeux[#2] fi;
+  \end{mplibcode}%
+  \else%
+  \begin{mpost}[mpsettings={u:=\useKV[ClesMosaique]{Echelle};Type:=\useKV[ClesMosaique]{Type};}]%
+    input PfCMosaique;
+    trace if Type=1:MosaiqueUn[#2] elseif Type=2: MosaiqueDeux[#2] fi;
+  \end{mpost}%
+  \fi%
+}%
+
+\newcommand\DessineMosaiqueComplet[1]{%
+  \ifluatex
+  \mplibforcehmode
+  \begin{mplibcode}
+    input PfCMosaique;
+    Largeur=\useKV[ClesMosaique]{Largeur};
+    Hauteur=\useKV[ClesMosaique]{Hauteur};
+    Type=\useKV[ClesMosaique]{Type};
+    boolean Solution,Label;
+    Solution=\useKV[ClesMosaique]{Solution};
+    Label=\useKV[ClesMosaique]{Label};
+    pair A,B,C,D;
+    A=u*(0,1);
+    B-A=u*(Largeur,0);
+    C-B=u*(0,-Hauteur);
+    D-C=A-B;
+    picture mosaique;
+    path case;
+    case=unitsquare scaled 1cm;
+    if Type=1:
+    mosaique=image(
+    trace case withcolor 0.5white;
+    trace (point(0) of case)--(point(2) of case) withcolor 0.75white;
+    trace (point(1) of case)--(point(3) of case) withcolor 0.75white;
+    trace (point(0.5) of case)--(point(2.5) of case) withcolor 0.75white;
+    trace (point(1.5) of case)--(point(3.5) of case) withcolor 0.75white;
+    );
+    else:
+    mosaique=image(
+    trace case withcolor 0.5white;
+    trace (point(0.5) of case)--(point(2.5) of case) withcolor 0.75white;
+    trace (point(1.5) of case)--(point(3.5) of case) withcolor 0.75white;
+    trace (point(0.5) of case)--(point(1.5) of case)--(point(2.5) of case)--(point(3.5) of case)--cycle withcolor 0.75white;
+    );
+    fi;
+    if Solution:
+    nbmos:=0;
+    for p_=#1:
+    trace if Type=1:MosaiqueUn[xpart(p_)] else: MosaiqueDeux[xpart(p_)] fi shifted(u*(nbmos mod Largeur,-(nbmos div Largeur)));
+    nbmos:=nbmos+1;
+    endfor;
+    else:
+    nbmos:=0;
+    for p_=#1:
+    trace mosaique shifted(u*(nbmos mod Largeur,-(nbmos div Largeur)));
+    if Label:
+    label(TEX("\num{"&decimal(ypart(p_))&"}"),center (mosaique  shifted(u*(nbmos mod Largeur,-(nbmos div Largeur)))));
+    fi;
+    nbmos:=nbmos+1;
+    endfor;
+    fi;
+    trace polygone(A,B,C,D);
+  \end{mplibcode}
+  \else
+  \begin{mpost}[mpsettings={Largeur=\useKV[ClesMosaique]{Largeur};Hauteur=\useKV[ClesMosaique]{Hauteur};Type=\useKV[ClesMosaique]{Type};boolean Solution,Label;Solution=\useKV[ClesMosaique]{Solution};}]
+    Label=\useKV[ClesMosaique]{Label};
+    input PfCMosaique;
+    pair A,B,C,D;
+    A=u*(0,1);
+    B-A=u*(Largeur,0);
+    C-B=u*(0,-Hauteur);
+    D-C=A-B;
+    picture mosaique;
+    path case;
+    case=unitsquare scaled 1cm;
+    if Type=1:
+    mosaique=image(
+    trace case withcolor 0.5white;
+    trace (point(0) of case)--(point(2) of case) withcolor 0.75white;
+    trace (point(1) of case)--(point(3) of case) withcolor 0.75white;
+    trace (point(0.5) of case)--(point(2.5) of case) withcolor 0.75white;
+    trace (point(1.5) of case)--(point(3.5) of case) withcolor 0.75white;
+    );
+    else:
+    mosaique=image(
+    trace case withcolor 0.5white;
+    trace (point(0.5) of case)--(point(2.5) of case) withcolor 0.75white;
+    trace (point(1.5) of case)--(point(3.5) of case) withcolor 0.75white;
+    trace (point(0.5) of case)--(point(1.5) of case)--(point(2.5) of case)--(point(3.5) of case)--cycle withcolor 0.75white;
+    );
+    fi;
+    if Solution:
+    nbmos:=0;
+    for p_=#1:
+    trace if Type=1:MosaiqueUn[xpart(p_)] else: MosaiqueDeux[xpart(p_)] fi shifted(u*(nbmos mod Largeur,-(nbmos div Largeur)));
+    nbmos:=nbmos+1;
+    endfor;
+    else:
+    nbmos:=0;
+    for p_=#1:
+    trace mosaique shifted(u*(nbmos mod Largeur,-(nbmos div Largeur)));
+    if Label:
+    label(LATEX("\num{"&decimal(ypart(p_))&"}"),center (mosaique  shifted(u*(nbmos mod Largeur,-(nbmos div Largeur)))));
+    fi;
+    nbmos:=nbmos+1;
+    endfor;
+    fi;
+    trace polygone(A,B,C,D);
+  \end{mpost}
+  \fi
+}%
+    
+\newtoks\toklistecaseM%
+\def\UpdatetoksMosaique#1/#2\nil{\addtotok\toklistecaseM{(#1,#2),}}%
+
+\newcommand\Mosaique[2][]{%
+  \useKVdefault[ClesMosaique]%
+  \setKV[ClesMosaique]{#1}%
+  \setsepchar[*]{,*/}%
+  \readlist*\ListeMosaique{#2}%
+  \toklistecaseM{}%
+  \foreachitem\compteur\in\ListeMosaique{\expandafter\UpdatetoksMosaique\compteur\nil}%
+  \DessineMosaiqueComplet{\the\toklistecaseM}%
+}%
+
+%%%
+% Qui suis-je
+%%%
+\setKVdefault[Quisuisje]{Solution=false,Largeur=5mm,Colonnes=5,CodePerso=false}%
+
+\newcommand\QuisuisjeEnonce{%
+  Chaque lettre du mot à découvrir porte un numéro qui correspond à un
+  calcul à effectuer. Pour trouver les lettres de ce mot, tu dois donc
+  effectuer les calculs proposés. Les résultats que tu auras trouvés
+  te donneront, à l'aide du tableau de correspondance ci-dessous, les
+  lettres du mot.
+}%
+
+\newcommand\QuisuisjeTableau[2][]{%
+  \setKV[Quisuisje]{#1}%
+  \setsepchar[*]{§*/}\ignoreemptyitems%
+  \readlist*\ListeQuisuisje{#2}%
+  \begin{NiceTabular}{|l|*{\ListeQuisuisjelen}{m{\useKV[Quisuisje]{Largeur}}|}}%
+    \hline
+    Lettre\xintFor* ##1 in {\xintSeq {1}{\ListeQuisuisjelen}}\do{%
+      &\centering\arraybackslash\ListeQuisuisje[##1,1]
+    }\\
+    \hline
+    R\'esultat du calcul\xintFor* ##1 in {\xintSeq {1}{\ListeQuisuisjelen}}\do{%
+      &\centering\arraybackslash\ListeQuisuisje[##1,2]
+    }\\
+    \hline
+  \end{NiceTabular}%
+}%
+
+\newcommand\QuisuisjeCodePerso[3][]{%
+  \setKV[Quisuisje]{#1}%
+  \setsepchar{ }%
+  \readlist*\ListeQuisuisjeCode{#2}%
+  \readlist*\ListeQuisuisjeLettres{#3}%
+  \par\hfill%
+  \begin{NiceTabular}{|*{\ListeQuisuisjeLettreslen}{m{7mm}|}}
+    \hline
+    \xintFor* ##1 in {\xintSeq {1}{\ListeQuisuisjeLettreslen}}\do{%
+      \xintifForFirst{}{&}\ifboolKV[Quisuisje]{Solution}{\hfill\ListeQuisuisjeLettres[##1]}{\phantom{1}}
+    }\\
+    \xintFor* ##1 in {\xintSeq {1}{\ListeQuisuisjeLettreslen}}\do{%
+      \xintifForFirst{}{&}\tiny\ListeQuisuisjeCode[##1]%
+    }\\
+    \hline
+  \end{NiceTabular}%
+}%
+
+\newcommand\Quisuisje[3][]{%
+  \useKVdefault[Quisuisje]%
+  \setKV[Quisuisje]{#1}%
+  \ifboolKV[Quisuisje]{CodePerso}{}{%
+    \setsepchar{ }%
+    \readlist\ListeLettres{#3}%
+  }%
+  \setsepchar{§}%
+  \readlist\ListeCalculs{#2}%
+  \ifboolKV[Quisuisje]{CodePerso}{}{%
+    \par\hfill%
+    \begin{NiceTabular}{|*{\ListeLettreslen}{m{7mm}|}}
+      \hline
+      \xintFor* ##1 in {\xintSeq {1}{\ListeLettreslen}}\do{%
+        \xintifForFirst{}{&} \ifboolKV[Quisuisje]{Solution}{\hfill\ListeLettres[##1]}{\phantom{1}}
+      }\\
+      \xintFor* ##1 in {\xintSeq {1}{\ListeLettreslen}}\do{%
+        \xintifForFirst{}{&}\tiny\num{##1}%
+      }\\
+      \hline
+    \end{NiceTabular}%
+  }%
+  \par\bigskip\par
+  \ifboolKV[Quisuisje]{Solution}{}{%
+    \begin{multicols}{\useKV[Quisuisje]{Colonnes}}%
+      \begin{enumerate}
+        \xintFor* ##1 in {\xintSeq {1}{\ListeCalculslen}}\do{%
+        \item\ListeCalculs[##1]
+        }
+      \end{enumerate}%
+    \end{multicols}%
+  }%
+}%
+
+%%%
+% Dessin Gradue
+%%%
+\setKVdefault[DessinGradue]{Lignes=10,Debut=-5,Fin=5,Pas=10,Solution=false,EcartVertical=1.5,LignesIdentiques,Longueur=10,Echelle=1}
+
+\def\TraceDessinGradue#1#2#3#4{%
+  \ifluatex
+  \mplibforcehmode
+  \begin{mplibcode}
+    pair La,Lb,Lab[];
+    La=(0,0);
+    Lb-La=u*(\useKV[DessinGradue]{Longueur},0);
+    for k=0 upto #4:
+    Lab[k]=(k/#4)[La,Lb];
+    endfor;
+    picture EnsembleLignes,Lignes;
+    Lignes=image(
+    trace segment(La,Lb);
+    for k=0 upto #4:
+    trace (Lab[k]+u*(0,-0.1))--(Lab[k]+u*(0,0.1));
+    endfor;
+    labeloffset:=labeloffset*1.5;
+    label.top(TEX("\num{"&decimal(#2)&"}"),La);
+    label.top(TEX("\num{"&decimal(#3)&"}"),Lb);
+    labeloffset:=labeloffset/1.5;
+    );
+    EnsembleLignes=image(
+    for k=0 upto #1-1:
+    trace Lignes shifted(k*u*(0,-\useKV[DessinGradue]{EcartVertical}));
+    label(TEX("(\num{"&decimal(k+1)&"})"),La+u*(-1.5,-k*\useKV[DessinGradue]{EcartVertical}));
+    endfor;
+    );
+    trace EnsembleLignes scaled \useKV[DessinGradue]{Echelle};
+  \end{mplibcode}
+  \else
+  \begin{mpost}[mpsettings={numeric LongueurLigne; LongueurLigne=\useKV[DessinGradue]{Longueur};numeric EcartVertical; EcartVertical=\useKV[DessinGradue]{EcartVertical}; numeric Echelle; Echelle=\useKV[DessinGradue]{Echelle};}]
+    pair La,Lb,Lab[];
+    La=(0,0);
+    Lb-La=u*(LongueurLigne,0);
+    for k=0 upto #4:
+    Lab[k]=(k/#4)[La,Lb];
+    endfor;
+    picture EnsembleLignes,Lignes;
+    Lignes=image(
+    trace segment(La,Lb);
+    for k=0 upto #4:
+    trace (Lab[k]+u*(0,-0.1))--(Lab[k]+u*(0,0.1));
+    endfor;
+    labeloffset:=labeloffset*1.5;
+    label.top(LATEX("\num{"&decimal(#2)&"}"),La);
+    label.top(LATEX("\num{"&decimal(#3)&"}"),Lb);
+    labeloffset:=labeloffset/1.5;
+    );
+    EnsembleLignes=image(
+    for k=0 upto #1-1:
+    trace Lignes shifted(k*u*(0,-EcartVertical));
+    label(LATEX("(\num{"&decimal(k+1)&"})"),La+u*(-1.5,-k*EcartVertical));
+    endfor;
+    );
+    trace EnsembleLignes scaled Echelle;
+  \end{mpost}
+  \fi
+}
+
+\def\TraceDessinGradueSolution#1#2#3#4#5#6{%
+  \ifluatex
+  \mplibforcehmode
+  \begin{mplibcode}
+    pair La,Lb,Lab[];
+    pair A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,A',B',C',D',E',F',G',H',I',J',K',L',M',N',O',P',Q',R',S',T',U',V',W',X',Y',Z',A'',B'',C'',D'',E'',F'',G'',H'',I'',J'',K'',L'',M'',N'',O'',P'',Q'',R'',S'',T'',U'',V'',W'',X'',Y'',Z'';
+    La=(0,0);
+    Lb-La=u*(\useKV[DessinGradue]{Longueur},0);
+    for k=0 upto #4:
+    Lab[k]=(k/#4)[La,Lb];
+    endfor;
+    picture EnsembleLignes,Lignes;
+    Lignes=image(
+    trace segment(La,Lb);
+    for k=0 upto #4:
+    trace (Lab[k]+u*(0,-0.1))--(Lab[k]+u*(0,0.1));
+    endfor;
+    labeloffset:=labeloffset*1.5;
+    label.top(TEX("\num{"&decimal(#2)&"}"),La);
+    label.top(TEX("\num{"&decimal(#3)&"}"),Lb);
+    labeloffset:=labeloffset/1.5;
+    );
+    EnsembleLignes=image(%
+    drawoptions(withcolor 0.5white);
+    for k=0 upto #1-1:
+    trace Lignes shifted(k*u*(0,-\useKV[DessinGradue]{EcartVertical}));
+    label(TEX("(\num{"&decimal(k+1)&"})"),La+u*(-1.5,k*(-\useKV[DessinGradue]{EcartVertical})));
+    endfor;
+    drawoptions();
+    n:=0;
+    numeric nblignes,nbpas;
+    for p_=#5:
+    n:=n+1;
+    if (n mod 3)=1:
+    nblignes:=p_;
+    elseif (n mod 3)=2:
+    nbpas:=p_;
+    elseif (n mod 3)=0:
+    p_=(nbpas/#4)[La,Lb] shifted(u*(0,(nblignes-1)*(-\useKV[DessinGradue]{EcartVertical})));
+    fi;
+    endfor;
+    for p_=#6:
+    trace p_ withpen pencircle scaled 1.5;
+    endfor;
+    );
+    trace EnsembleLignes scaled \useKV[DessinGradue]{Echelle};
+  \end{mplibcode}
+  \else
+  \begin{mpost}[mpsettings={numeric LongueurLigne; LongueurLigne=\useKV[DessinGradue]{Longueur};numeric EcartVertical; EcartVertical=\useKV[DessinGradue]{EcartVertical}; numeric Echelle; Echelle=\useKV[DessinGradue]{Echelle};}]
+    pair La,Lb,Lab[];
+    pair A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,A',B',C',D',E',F',G',H',I',J',K',L',M',N',O',P',Q',R',S',T',U',V',W',X',Y',Z',A'',B'',C'',D'',E'',F'',G'',H'',I'',J'',K'',L'',M'',N'',O'',P'',Q'',R'',S'',T'',U'',V'',W'',X'',Y'',Z'';
+    La=(0,0);
+    Lb-La=u*(LongueurLigne,0);
+    for k=0 upto #4:
+    Lab[k]=(k/#4)[La,Lb];
+    endfor;
+    picture EnsembleLignes,Lignes;
+    Lignes=image(
+    trace segment(La,Lb);
+    for k=0 upto #4:
+    trace (Lab[k]+u*(0,-0.1))--(Lab[k]+u*(0,0.1));
+    endfor;
+    labeloffset:=labeloffset*1.5;
+    label.top(LATEX("\num{"&decimal(#2)&"}"),La);
+    label.top(LATEX("\num{"&decimal(#3)&"}"),Lb);
+    labeloffset:=labeloffset/1.5;
+    );
+    EnsembleLignes=image(
+    drawoptions(withcolor 0.5white);
+    for k=0 upto #1-1:
+    trace Lignes shifted(k*u*(0,-EcartVertical));
+    label(LATEX("(\num{"&decimal(k+1)&"})"),La+u*(-1.5,k*(-EcartVertical)));
+    endfor;
+    drawoptions();
+    n:=0;
+    numeric nblignes,nbpas;
+    for p_=#5:
+    n:=n+1;
+    if (n mod 3)=1:
+    nblignes:=p_;
+    elseif (n mod 3)=2:
+    nbpas:=p_;
+    elseif (n mod 3)=0:
+    p_=(nbpas/#4)[La,Lb] shifted(u*(0,(nblignes-1)*(-EcartVertical)));
+    fi;
+    endfor;
+    for p_=#6:
+    trace p_ withpen pencircle scaled 1.5;
+    endfor;
+    );
+    trace EnsembleLignes scaled Echelle;
+  \end{mpost}
+  \fi
+}
+
+\def\TraceDessinGradueMul#1{%
+  \ifluatex
+  \mplibforcehmode
+  \begin{mplibcode}
+    pair La,Lb,Lab[];
+    La=(0,0);
+    Lb-La=u*(\useKV[DessinGradue]{Longueur},0);
+    picture EnsembleLignes,Lignes;
+    EnsembleLignes=image(
+    n:=0;
+    m:=0;
+    for p_=#1:
+    n:=n+1;
+    trace segment(La,Lb) shifted((n-1)*u*(0,-\useKV[DessinGradue]{EcartVertical}));
+    label(TEX("(\num{"&decimal(n)&"})"),La+u*(-1.5,-(n-1)*\useKV[DessinGradue]{EcartVertical}));
+    for k=0 upto bluepart(p_):
+    m:=bluepart(p_);
+    Lab[k]:=(k/m)[La,Lb];
+    trace ((Lab[k]+u*(0,-0.1))--(Lab[k]+u*(0,0.1))) shifted((n-1)*u*(0,-\useKV[DessinGradue]{EcartVertical}));
+    endfor;
+    labeloffset:=labeloffset*1.5;
+    label.top(TEX("\num{"&decimal(redpart(p_))&"}"),La shifted((n-1)*u*(0,-\useKV[DessinGradue]{EcartVertical})));
+    label.top(TEX("\num{"&decimal(greenpart(p_))&"}"),Lb shifted((n-1)*u*(0,-\useKV[DessinGradue]{EcartVertical})));
+    labeloffset:=labeloffset/1.5;
+    endfor;
+    );
+    trace EnsembleLignes scaled \useKV[DessinGradue]{Echelle};
+  \end{mplibcode}
+  \else
+  \begin{mpost}[mpsettings={numeric LongueurLigne; LongueurLigne=\useKV[DessinGradue]{Longueur};numeric EcartVertical; EcartVertical=\useKV[DessinGradue]{EcartVertical}; numeric Echelle; Echelle=\useKV[DessinGradue]{Echelle};}]
+    pair La,Lb,Lab[];
+    La=(0,0);
+    Lb-La=u*(LongueurLigne,0);
+    picture EnsembleLignes,Lignes;
+    EnsembleLignes=image(
+    n:=0;
+    m:=0;
+    for p_=#1:
+    n:=n+1;
+    trace segment(La,Lb) shifted((n-1)*u*(0,-EcartVertical));
+    for k=0 upto bluepart(p_):
+    m:=bluepart(p_);
+    Lab[k]:=(k/m)[La,Lb];
+    trace ((Lab[k]+u*(0,-0.1))--(Lab[k]+u*(0,0.1))) shifted((n-1)*u*(0,-EcartVertical));
+    label(LATEX("(\num{"&decimal(n)&"})"),La+u*(-1.5,-(n-1)*\useKV[DessinGradue]{EcartVertical}));
+    endfor;
+    labeloffset:=labeloffset*1.5;
+    label.top(LATEX("\num{"&decimal(redpart(p_))&"}"),La shifted((n-1)*u*(0,-EcartVertical)));
+    label.top(LATEX("\num{"&decimal(greenpart(p_))&"}"),Lb shifted((n-1)*u*(0,-EcartVertical)));
+    labeloffset:=labeloffset/1.5;
+    endfor;
+    );
+    trace EnsembleLignes scaled Echelle;
+  \end{mpost}
+  \fi
+}
+
+\def\TraceDessinGradueMulSolution#1#2#3{%
+  \ifluatex
+  \mplibforcehmode
+  \begin{mplibcode}
+    pair La,Lb,Lab[];
+    pair A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,A',B',C',D',E',F',G',H',I',J',K',L',M',N',O',P',Q',R',S',T',U',V',W',X',Y',Z',A'',B'',C'',D'',E'',F'',G'',H'',I'',J'',K'',L'',M'',N'',O'',P'',Q'',R'',S'',T'',U'',V'',W'',X'',Y'',Z'';
+    La=(0,0);
+    Lb-La=u*(\useKV[DessinGradue]{Longueur},0);
+    picture EnsembleLignes,Lignes;
+    EnsembleLignes=image(%
+    drawoptions(withcolor 0.5white);
+    n:=0;
+    m:=0;
+    numeric retienspas[];
+    for p_=#1:
+    n:=n+1;
+    trace segment(La,Lb) shifted((n-1)*u*(0,-\useKV[DessinGradue]{EcartVertical}));
+    label(TEX("(\num{"&decimal(n)&"})"),La+u*(-1.5,-(n-1)*\useKV[DessinGradue]{EcartVertical}));
+    for k=0 upto bluepart(p_):
+    m:=bluepart(p_);
+    retienspas[n]:=bluepart(p_);
+    Lab[k]:=(k/m)[La,Lb];
+    trace ((Lab[k]+u*(0,-0.1))--(Lab[k]+u*(0,0.1))) shifted((n-1)*u*(0,-\useKV[DessinGradue]{EcartVertical}));
+    endfor;
+    labeloffset:=labeloffset*1.5;
+    label.top(TEX("\num{"&decimal(redpart(p_))&"}"),La shifted((n-1)*u*(0,-\useKV[DessinGradue]{EcartVertical})));
+    label.top(TEX("\num{"&decimal(greenpart(p_))&"}"),Lb shifted((n-1)*u*(0,-\useKV[DessinGradue]{EcartVertical})));
+    labeloffset:=labeloffset/1.5;
+    endfor;
+    drawoptions();
+    n:=0;
+    numeric nblignes,nbpas;
+    for p_=#2:
+    n:=n+1;
+    if (n mod 3)=1:
+    nblignes:=p_;
+    elseif (n mod 3)=2:
+    nbpas:=p_;
+    elseif (n mod 3)=0:
+    p_=(nbpas/retienspas[nblignes])[La,Lb] shifted(u*(0,(nblignes-1)*(-\useKV[DessinGradue]{EcartVertical})));
+    fi;
+    endfor;
+    %Differents traces
+    for p_=#3:
+    trace p_ withpen pencircle scaled 1.5;
+    endfor;
+    );
+    trace EnsembleLignes scaled \useKV[DessinGradue]{Echelle};
+  \end{mplibcode}
+  \else
+  \begin{mpost}[mpsettings={numeric LongueurLigne; LongueurLigne=\useKV[DessinGradue]{Longueur};numeric EcartVertical; EcartVertical=\useKV[DessinGradue]{EcartVertical}; numeric Echelle; Echelle=\useKV[DessinGradue]{Echelle};}]
+    pair La,Lb,Lab[];
+    pair A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,A',B',C',D',E',F',G',H',I',J',K',L',M',N',O',P',Q',R',S',T',U',V',W',X',Y',Z',A'',B'',C'',D'',E'',F'',G'',H'',I'',J'',K'',L'',M'',N'',O'',P'',Q'',R'',S'',T'',U'',V'',W'',X'',Y'',Z'';
+    La=(0,0);
+    Lb-La=u*(LongueurLigne,0);
+    picture EnsembleLignes,Lignes;
+    EnsembleLignes=image(
+    n:=0;
+    m:=0;
+    numeric retienspas[];
+    drawoptions(withcolor 0.5white);
+    for p_=#1:
+    n:=n+1;
+    trace segment(La,Lb) shifted((n-1)*u*(0,-EcartVertical));
+    label(LATEX("(\num{"&decimal(n)&"})"),La+u*(-1.5,-(n-1)*\useKV[DessinGradue]{EcartVertical}));
+    for k=0 upto bluepart(p_):
+    m:=bluepart(p_);
+    retienspas[n]:=bluepart(p_);
+    Lab[k]:=(k/m)[La,Lb];
+    trace ((Lab[k]+u*(0,-0.1))--(Lab[k]+u*(0,0.1))) shifted((n-1)*u*(0,-EcartVertical));
+    endfor;
+    labeloffset:=labeloffset*1.5;
+    label.top(TEX("\num{"&decimal(redpart(p_))&"}"),La shifted((n-1)*u*(0,-EcartVertical)));
+    label.top(TEX("\num{"&decimal(greenpart(p_))&"}"),Lb shifted((n-1)*u*(0,-EcartVertical)));
+    labeloffset:=labeloffset/1.5;
+    endfor;
+    drawoptions();
+    n:=0;
+    numeric nblignes,nbpas;
+    for p_=#2:
+    n:=n+1;
+    if (n mod 3)=1:
+    nblignes:=p_;
+    elseif (n mod 3)=2:
+    nbpas:=p_;
+    elseif (n mod 3)=0:
+    p_=(nbpas/retienspas[nblignes])[La,Lb] shifted(u*(0,(nblignes-1)*(-EcartVertical)));
+    fi;
+    endfor;
+    %Differents traces
+    for p_=#3:
+    trace p_ withpen pencircle scaled 1.5;
+    endfor;
+    );
+    trace EnsembleLignes scaled Echelle;
+  \end{mpost}
+  \fi
+}
+
+\def\UpdateLignes#1/#2/#3\nil{\addtotok\toklisteptsgrad{#1,#3,#2,}}
+\def\UpdateTraces#1\nil{\addtotok\toklistetracesgrad{#1,}}
+\def\UpdateDefLignes#1/#2/#3\nil{\addtotok\toklistedefligne{(#1,#2,#3),}}
+
+\newcommand\DessinGradue[4][]{%
+  \useKVdefault[DessinGradue]%
+  \setKV[DessinGradue]{#1}%
+  \ifboolKV[DessinGradue]{LignesIdentiques}{%
+    \ifboolKV[DessinGradue]{Solution}{%
+      \setsepchar[*]{,*/}%
+      \readlist\ListePG{#3}%
+      \setsepchar[*]{§*/}%
+      \readlist\ListeTraces{#4}%
+      \newtoks\toklisteptsgrad%
+      \foreachitem\compteur\in\ListePG{\expandafter\UpdateLignes\compteur\nil}%
+      \newtoks\toklistetracesgrad%
+      \foreachitem\compteur\in\ListeTraces{\expandafter\UpdateTraces\compteur\nil}%
+      \TraceDessinGradueSolution{\useKV[DessinGradue]{Lignes}}{\useKV[DessinGradue]{Debut}}{\useKV[DessinGradue]{Fin}}{\useKV[DessinGradue]{Pas}}{\the\toklisteptsgrad}{\the\toklistetracesgrad}%
+    }{%
+      \TraceDessinGradue{\useKV[DessinGradue]{Lignes}}{\useKV[DessinGradue]{Debut}}{\useKV[DessinGradue]{Fin}}{\useKV[DessinGradue]{Pas}}%
+    }
+  }{%
+    \setsepchar[*]{,*/}%
+    \readlist\ListeDefLigne{#2}%
+    \newtoks\toklistedefligne%
+    \foreachitem\compteur\in\ListeDefLigne{\expandafter\UpdateDefLignes\compteur\nil}%
+    \ifboolKV[DessinGradue]{Solution}{%
+      %
+      \setsepchar[*]{,*/}%
+      \readlist\ListePG{#3}%
+      \setsepchar[*]{§*/}%
+      \readlist\ListeTraces{#4}%
+      \newtoks\toklisteptsgrad%
+      \foreachitem\compteur\in\ListePG{\expandafter\UpdateLignes\compteur\nil}%
+      \newtoks\toklistetracesgrad%
+      \foreachitem\compteur\in\ListeTraces{\expandafter\UpdateTraces\compteur\nil}%
+      \TraceDessinGradueMulSolution{\the\toklistedefligne}{\the\toklisteptsgrad}{\the\toklistetracesgrad}%
+    }{%
+      \TraceDessinGradueMul{\the\toklistedefligne}%
+    }%
+  }%
+}%
+
+%%%
+% Autonomie
+%%%
+\setKVdefault[Autonomie]{AfficheMarge=false,TitreEnigme=Enigme,TitreAtoi=\`A toi,Enigme=false,TexteCorrection=\bfseries Correction}%
+
+\newcommand\Autonomie[3][]{%
+  \useKVdefault[Autonomie]%
+  \setKV[Autonomie]{#1}%
+  \setsepchar[*]{§*/}
+  \readlist*\ListeAutoQ{#2}%
+  % \setsepchar{§}
+  % \readlist*\ListeAutoR{#3}%
+  \setsepchar[*]{§*/}
+  \readlist*\ListeAutoEn{#3}%
+  \clearpage
+  \begin{tikzpicture}[remember picture,overlay]%
+    \ifboolKV[Autonomie]{AfficheMarge}{%
+      \node[xshift=5mm,yshift=-5mm,circle] (A) at (current page.north west) {};
+      \node[xshift=-5mm,yshift=5mm] (B) at (current page.south east) {};
+      \draw[blue,dashed] (A) rectangle (B);
+    }{}%
+    \foreach \i in {1,...,3}{
+      \coordinate[xshift=\i*0.25*\paperwidth] (A\i) at (current page.north west);%
+      \coordinate[xshift=\i*0.25*\paperwidth] (B\i) at (current page.south west);%
+    }
+    \foreach \i in{1,...,4}{%
+      \coordinate[yshift=-\i*0.25*\paperheight] (C\i) at (current page.north west);%
+      \coordinate[yshift=-\i*0.25*\paperheight] (F\i) at (current page.north east);%
+      \coordinate[yshift=-\i*0.25*\paperheight] (D\i) at (A1);%
+      \coordinate[yshift=-\i*0.25*\paperheight] (E\i) at (A3);%
+      \draw (C\i) to (D\i);
+      \draw (E\i) to (F\i);
+    }
+    \coordinate (Q1) at ($(F1)!0.5!(A3)$);
+    \coordinate (Q2) at ($(F2)!0.5!(E1)$);
+    \coordinate (Q3) at ($(F3)!0.5!(E2)$);
+    \coordinate (Q4) at ($(F4)!0.5!(E3)$);
+    \coordinate (Q5) at ($(C1)!0.5!(A1)$);
+    \coordinate (Q6) at ($(C2)!0.5!(D1)$);
+    \coordinate (Q7) at ($(C3)!0.5!(D2)$);
+    \coordinate (Q8) at ($(C4)!0.5!(D3)$);
+    \draw[dashed] (A1) to (B1);%
+    \draw[dashed] (A3) to (B3);%
+    \foreach \i in {1,...,4}{%
+      \node[xshift=-5mm,align=justify,anchor=center,text width=0.8*0.25\textwidth] (Test\i) at (Q\i) {\ding{\fpeval{171+\i}}~\ListeAutoQ[\i,1]};
+    }
+    \foreach \i in {5,...,8}{%
+      \node[align=justify,anchor=center,text width=0.8*0.25\textwidth] (Test\i) at (Q\i) {\ding{\fpeval{171+\i}}~\ListeAutoQ[\i,1]};
+    }
+  \end{tikzpicture}
+  \clearpage
+  \begin{tikzpicture}[remember picture,overlay]%
+    \ifboolKV[Autonomie]{AfficheMarge}{%
+      \node[xshift=5mm,yshift=-5mm,circle] (A) at (current page.north west) {};
+      \node[xshift=-5mm,yshift=5mm] (B) at (current page.south east) {};
+      \draw[blue,dashed] (A) rectangle (B);
+    }{}%
+    \foreach \i in {1,...,3}{%
+      \coordinate[xshift=\i*0.25*\paperwidth] (A\i) at (current page.north west);%
+      \coordinate[xshift=\i*0.25*\paperwidth] (B\i) at (current page.south west);%
+    }
+    \foreach \i in{1,...,4}{%
+      \coordinate[yshift=-\i*0.25*\paperheight] (C\i) at (current page.north west);%
+      \coordinate[yshift=-\i*0.25*\paperheight] (F\i) at (current page.north east);%
+      \coordinate[yshift=-\i*0.25*\paperheight] (D\i) at (A1);%
+      \coordinate[yshift=-\i*0.25*\paperheight] (G\i) at (A2);%
+      \coordinate[yshift=-\i*0.25*\paperheight] (E\i) at (A3);%
+      \draw (C\i) to (F\i);
+    }
+    \coordinate (T1) at ($(current page.north west)!0.5!(A1)$);
+    \coordinate (T2) at ($(C1)!0.5!(D1)$);
+    \coordinate (T3) at ($(C2)!0.5!(D2)$);
+    \coordinate (T4) at ($(C3)!0.5!(D3)$);
+    \coordinate (T5) at ($(current page.north east)!0.5!(A3)$);
+    \coordinate (T6) at ($(E1)!0.5!(F1)$);
+    \coordinate (T7) at ($(E2)!0.5!(F2)$);
+    \coordinate (T8) at ($(E3)!0.5!(F3)$);
+    \coordinate (U1) at ($(C1)!0.5!(D1)$);
+    \coordinate (U2) at ($(C2)!0.5!(D2)$);
+    \coordinate (U3) at ($(C3)!0.5!(D3)$);
+    \coordinate (U4) at ($(current page.south west)!0.5!(B1)$);
+    \coordinate (U5) at ($(E1)!0.5!(F1)$);
+    \coordinate (U6) at ($(E2)!0.5!(F2)$);
+    \coordinate (U7) at ($(E3)!0.5!(F3)$);
+    \coordinate (U8) at ($(B3)!0.5!(current page.south east)$);
+    \coordinate (R1) at ($(D1)!0.5!(A2)$);
+    \coordinate (R2) at ($(D2)!0.5!(G1)$);
+    \coordinate (R3) at ($(D3)!0.5!(G2)$);
+    \coordinate (R4) at ($(D4)!0.5!(G3)$);
+    \coordinate (R5) at ($(E1)!0.5!(A2)$);
+    \coordinate (R6) at ($(E2)!0.5!(G1)$);
+    \coordinate (R7) at ($(E3)!0.5!(G2)$);
+    \coordinate (R8) at ($(E4)!0.5!(G3)$);
+    \coordinate (S1) at ($(A1)!0.5!(D1)$);
+    \coordinate (S2) at ($(D1)!0.5!(D2)$);
+    \coordinate (S3) at ($(D2)!0.5!(D3)$);
+    \coordinate (S4) at ($(D3)!0.5!(B1)$);
+    \coordinate (S5) at ($(R1)!0.5!(R5)$);
+    \coordinate (S6) at ($(R2)!0.5!(R6)$);
+    \coordinate (S7) at ($(R3)!0.5!(R7)$);
+    \coordinate (S8) at ($(R4)!0.5!(R8)$);
+    \draw[dashed] (A1) to (B1);%
+    \draw[dashed] (A2) to (B2);
+    \draw[dashed] (A3) to (B3);%
+    \foreach \i in {1,...,8}{%
+      \node[rotate=90,anchor=north] (Cor\i) at (S\i) {\useKV[Autonomie]{TexteCorrection}};
+      \node[anchor=west,xshift=2em,text width=0.8*0.25\paperwidth] (Test\i)
+      at (S\i) {\ListeAutoQ[\i,2]};
+      \node[anchor=north,yshift=-1em,text width=0.85*0.25\paperwidth] (TestEn\i)
+      at (T\i) {\textbf{\useKV[Autonomie]{TitreAtoi} :} \ListeAutoEn[\i,1]};
+      \ifboolKV[Autonomie]{Enigme}{%
+        \node[anchor=south,yshift=1em,text width=0.85*0.25\paperwidth] (TestREn\i)
+        at (U\i) {%
+          \ListeAutoEn[\i,2] : \pointilles\\
+          Lettre \ding{\fpeval{171+\i}} : \pointilles
+        };%
+      }{%
+        \node[anchor=south,yshift=1em,text width=0.85*0.25\paperwidth] (TestREn\i)
+        at (U\i) {%
+          \ListeAutoEn[\i,2]%
+        };%
+      }%
+    }
+  \end{tikzpicture}
+}
+
 %%%
 % Calculatrice
 %%%
@@ -2562,12 +4209,13 @@
       \end{tabular}%
     }%
   }%
+  \renewcommand{\arraystretch}{1}%
 }
 
 %%%
 % Somme des angles
 %%%
-\setKVdefault[ClesSommeAngle]{Detail=true,Isocele=false,Figure=false,FigureSeule=false,Angle=0,Perso=false}%
+\setKVdefault[ClesSommeAngle]{Detail=true,Isocele=false,Figure=false,FigureSeule=false,Angle=0,Perso=false,Echelle=1cm}%
 
 \def\MPFigureSommeAngle#1#2#3#4#5#6#7{
     % #1 Premier sommet
@@ -2581,6 +4229,7 @@
   \mplibforcehmode
   \begin{mplibcode}
     pair A,B,C,O,I;%
+    u:=\useKV[ClesSommeAngle]{Echelle};
     % On place les points A,B,C sur le cercle de mani\`ere \`a faciliter la rotation de la figure
     A=u*(1,1);
     B-A=u*(4,0);
@@ -2640,9 +4289,7 @@
   \end{mplibcode}
   \mplibcodeinherit{disable}
   \else
-  \begin{mpost}
-    input PfCGeometrie;
-    u:=1cm;
+  \begin{mpost}[mpsettings={u:=\useKV[ClesSommeAngle]{Echelle};}]
     pair A,B,C,O,I;%
     % On place les points A,B,C sur le cercle de mani\`ere \`a faciliter la rotation de la figure
     A=u*(1,1);
@@ -2807,7 +4454,7 @@
 %%%
 % Le th\'eor\`eme de Pythagore
 %%%
-\setKVdefault[ClesPythagore]{Exact=false,AvantRacine=false,Racine=false,Entier=false,Egalite=false,Precision=2,Soustraction=false,Figure=false,FigureSeule=false,Angle=0,Reciproque=false,ReciColonnes=false,Faible=false,Unite=cm,EnchaineA=false,EnchaineB=false,EnchaineC=false,ValeurA=0,ValeurB=0,ValeurC=0,Perso=false}
+\setKVdefault[ClesPythagore]{Exact=false,AvantRacine=false,Racine=false,Entier=false,Egalite=false,Precision=2,Soustraction=false,Figure=false,FigureSeule=false,Angle=0,Echelle=1cm,Reciproque=false,ReciColonnes=false,Faible=false,Unite=cm,EnchaineA=false,EnchaineB=false,EnchaineC=false,ValeurA=0,ValeurB=0,ValeurC=0,Perso=false}
 
 % On d\'efinit les figures \`a utiliser
 \def\MPFigurePytha#1#2#3#4#5#6{%
@@ -2820,7 +4467,7 @@
   \ifluatex
    \mplibforcehmode
   \begin{mplibcode}
-    u:=1cm;
+    u:=\useKV[ClesPythagore]{Echelle};
     pair A,B,C,O,D,E,F;%B est le sommet de l'angle droit
     O=u*(2.5,2.5);
     path cc;
@@ -2841,6 +4488,7 @@
     draw B{dir(angle(C-B)+5)}..C{dir(angle(C-B)+5)};
     draw C{dir(angle(A-C)+5)}..A{dir(angle(A-C)+5)};    
     draw D--E--F;
+    numeric decalage;
     decalage=3mm;
     if #4<#5 :
     if ypart(B)>ypart(O) :
@@ -2865,8 +4513,7 @@
     label(btex #1 etex,1.2[O,C]);
   \end{mplibcode}
   \else
-  \begin{mpost}
-    u:=1cm;
+  \begin{mpost}[mpsettings={u:=\useKV[ClesPythagore]{Echelle};}]
     pair A,B,C,O,D,E,F;%B est le sommet de l'angle droit
     O=u*(2.5,2.5);
     path cc;
@@ -2924,7 +4571,7 @@
   \ifluatex
    \mplibforcehmode
   \begin{mplibcode}
-    u:=1cm;
+    u:=\useKV[ClesPythagore]{Echelle};
     pair A,B,C,O,D,E,F;%B est le sommet de l'angle droit
     O=u*(2.5,2.5);
     path cc;
@@ -2955,8 +4602,7 @@
     label(btex #3 etex,1.2[O,C]);
   \end{mplibcode}
   \else
-  \begin{mpost}
-    u:=1cm;
+  \begin{mpost}[mpsettings={u:=\useKV[ClesPythagore]{Echelle};}]
     pair A,B,C,O,D,E,F;%B est le sommet de l'angle droit
     O=u*(2.5,2.5);
     path cc;
@@ -3095,6 +4741,11 @@
     \xdef\NomSommetC{\NomC}%
     % On trace une figure ou pas ?
     \ifboolKV[ClesPythagore]{FigureSeule}{%
+      \xintifboolexpr{#3<#4 || #3==#4}{%\ifnum#3<#4%
+        \xdef\ResultatPytha{\fpeval{round(sqrt(#3^2+#4^2),\useKV[ClesPythagore]{Precision})}}%
+      }{%
+        \xdef\ResultatPytha{\fpeval{round(sqrt(#3^2-#4^2),\useKV[ClesPythagore]{Precision})}}%
+      }%
       \MPFigurePytha{\NomA}{\NomB}{\NomC}{#3}{#4}{\useKV[ClesPythagore]{Angle}}
     }{%
       \ifboolKV[ClesPythagore]{Figure}{%Utilisation obligatoire de l'option --shell-escape de la compilation
@@ -3108,7 +4759,7 @@
           }%
           \xintifboolexpr{#3<#4 || #3==#4}{%\ifnum#3<#4%
             \xdef\ResultatPytha{\fpeval{round(sqrt(#3^2+#4^2),\useKV[ClesPythagore]{Precision})}}%
-            \xdef\ResultatPytha{\fpeval{round(sqrt(#3^2+#4^2),\useKV[ClesPythagore]{Precision})}}%
+            %\xdef\ResultatPytha{\fpeval{round(sqrt(#3^2+#4^2),\useKV[ClesPythagore]{Precision})}}%
             \begin{align*}
               \NomA\NomC^2&=\NomA\NomB^2+\NomB\NomC^2\\
               \NomA\NomC^2&=\ifboolKV[ClesPythagore]{EnchaineA}{\opcopy{\useKV[ClesPythagore]{ValeurA}}{a1}\opexport{a1}{\Aun}\num{\Aun}}{\opexport{A1}{\Aun}\num{\Aun}^2}+\ifboolKV[ClesPythagore]{EnchaineB}{\opcopy{\useKV[ClesPythagore]{ValeurB}}{a2}\opexport{a2}{\Adeux}\num{\Adeux}}{\opexport{A2}{\Adeux}\num{\Adeux}^2}\\
@@ -3222,14 +4873,15 @@
 % y a dans un "seul calcul".
 \setcounter{NbCalculDistri}{0}
 
-\setKVdefault[ClesDistributivite]{Etape=1,Lettre=x,Fleches=false,AideMul=false,Reduction=false,AideAdda=false,AideAddb=false,CouleurAide=red,CouleurReduction=black,CouleurFH=blue,CouleurFB=red,Somme=false,Difference=false,RAZ=false,Oppose=false,All=false,NomExpression=A,Fin=4,Numerique=false,Remarquable=false,Echange=0,Tuile=false,Vide=false}%,AideAdd=false:inutile ?
+\setKVdefault[ClesDistributivite]{Etape=1,Lettre=x,Fleches=false,AideMul=false,Reduction=false,AideAdda=false,AideAddb=false,CouleurAide=red,CouleurReduction=black,CouleurFH=blue,CouleurFB=red,Somme=false,Difference=false,RAZ=false,Oppose=false,All=false,NomExpression=A,Fin=4,Numerique=false,Remarquable=false,Echange=0,Tuile=false,Vide=false,Impression=false}%,AideAdd=false:inutile ?
 
 \newcommand\Tuile[4]{%
   \ifluatex
   \mplibforcehmode
   \begin{mplibcode}
-    boolean Vide;
+    boolean Vide,Print;
     Vide=\useKV[ClesDistributivite]{Vide};
+    Print=\useKV[ClesDistributivite]{Impression};
     pair _CoinTuilev;
     _CoinTuilev=(0,0);
     numeric largeur,longueur,ecart;
@@ -3244,7 +4896,9 @@
     TT=image(
     path cc;
     cc=polygone((0,0),u*(LL,0),u*(LL,-ll),u*(0,-ll));
+    if Print=false:
     fill cc withcolor col;
+    fi;
     trace cc;
     label(TEX(t),iso((0,0),u*(LL,0),u*(LL,-ll),u*(0,-ll)));
     );
@@ -3262,7 +4916,9 @@
     TT=image(
     path cc;
     cc=polygone((0,0),u*(LL,0),u*(LL,ll),u*(0,ll));
+    if Print=false:
     fill cc withcolor col;
+    fi;
     trace cc;
     label(TEX(t),iso((0,0),u*(LL,0),u*(LL,ll),u*(0,ll)));
     );
@@ -3324,7 +4980,9 @@
     for l=0 upto (abs(#1)-1):
     path titi;
     titi=polygone((0,0),u*(longueur,0),u*(longueur,-longueur),u*(0,-longueur)) shifted (u*(largeur+ecart,0)+(u*(k*longueur,-l*longueur)));
+    if Print=false:
     fill titi withcolor if #1*#3>0:ColorCarrePos else: ColorCarreNeg fi;
+    fi;
     trace titi;
     if #1*#3>0:
     label(TEX("$x^2$"),iso((0,0),u*(longueur,0),u*(longueur,-longueur),u*(0,-longueur)) shifted (u*(largeur+ecart,0)+(u*(k*longueur,-l*longueur))));
@@ -3340,7 +4998,9 @@
     for l=0 upto (abs(#1)-1):
     path titi;
     titi=polygone((0,0),u*(largeur,0),u*(largeur,-longueur),u*(0,-longueur)) shifted (u*(largeur+ecart+abs(#3)*longueur,0)+(u*(k*largeur,-l*longueur)));
+    if Print=false:
     fill titi withcolor if #1*#4>0:ColorLetterPos else: ColorLetterNeg fi;
+    fi;
     trace titi;
     if #1*#4>0:
     label(TEX("$x$"),iso((0,0),u*(largeur,0),u*(largeur,-longueur),u*(0,-longueur)) shifted (u*(largeur+ecart+abs(#3)*longueur,0)+(u*(k*largeur,-l*longueur))));
@@ -3356,7 +5016,9 @@
     for l=0 upto (abs(#2)-1):
     path titi;
     titi=polygone((0,0),u*(longueur,0),u*(longueur,-largeur),u*(0,-largeur)) shifted (u*(largeur+ecart,-abs(#1)*longueur)+(u*(k*longueur,-l*largeur)));
+    if Print=false:
     fill titi withcolor if #2*#3>0:ColorLetterPos else: ColorLetterNeg fi;
+    fi;
     trace titi;
     if #2*#3>0:
     label(TEX("$x$"),iso((0,0),u*(longueur,0),u*(longueur,-largeur),u*(0,-largeur)) shifted (u*(largeur+ecart,-abs(#1)*longueur)+(u*(k*longueur,-l*largeur))));
@@ -3372,7 +5034,9 @@
     for l=0 upto (abs(#2)-1):
     path titi;
     titi=polygone((0,0),u*(largeur,0),u*(largeur,-largeur),u*(0,-largeur)) shifted (u*(largeur+ecart+abs(#3)*longueur,-abs(#1)*longueur)+(u*(k*largeur,-l*largeur)));
+    if Print=false:
     fill titi withcolor if #2*#4>0:ColorNumPos else: ColorNumNeg fi;
+    fi;
     trace titi;
     if #2*#4>0:
     label(TEX("$1$"),iso((0,0),u*(largeur,0),u*(largeur,-largeur),u*(0,-largeur)) shifted (u*(largeur+ecart+abs(#3)*longueur,-abs(#1)*longueur)+(u*(k*largeur,-l*largeur))));
@@ -3385,7 +5049,7 @@
     fi;
   \end{mplibcode}
   \else
-  \begin{mpost}[mpsettings={boolean Vide; Vide=\useKV[ClesDistributivite]{Vide};}]
+  \begin{mpost}[mpsettings={boolean Vide,Print; Vide=\useKV[ClesDistributivite]{Vide}; Print=\useKV[ClesDistributivite]{Impression};}]
     pair _CoinTuilev;
     _CoinTuilev=(0,0);
     numeric largeur,longueur,ecart;
@@ -3400,7 +5064,9 @@
     TT=image(
     path cc;
     cc=polygone((0,0),u*(LL,0),u*(LL,-ll),u*(0,-ll));
+    if Print=false:
     fill cc withcolor col;
+    fi;
     trace cc;
     label(LATEX(t),iso((0,0),u*(LL,0),u*(LL,-ll),u*(0,-ll)));
     );
@@ -3418,7 +5084,9 @@
     TT=image(
     path cc;
     cc=polygone((0,0),u*(LL,0),u*(LL,ll),u*(0,ll));
+    if Print=false:
     fill cc withcolor col;
+    fi;
     trace cc;
     label(LATEX(t),iso((0,0),u*(LL,0),u*(LL,ll),u*(0,ll)));
     );
@@ -3480,7 +5148,9 @@
     for l=0 upto (abs(#1)-1):
     path titi;
     titi=polygone((0,0),u*(longueur,0),u*(longueur,-longueur),u*(0,-longueur)) shifted (u*(largeur+ecart,0)+(u*(k*longueur,-l*longueur)));
+    if Print=false:
     fill titi withcolor if #1*#3>0:ColorCarrePos else: ColorCarreNeg fi;
+    fi;
     trace titi;
     if #1*#3>0:
     label(LATEX("$x^2$"),iso((0,0),u*(longueur,0),u*(longueur,-longueur),u*(0,-longueur)) shifted (u*(largeur+ecart,0)+(u*(k*longueur,-l*longueur))));
@@ -3496,7 +5166,9 @@
     for l=0 upto (abs(#1)-1):
     path titi;
     titi=polygone((0,0),u*(largeur,0),u*(largeur,-longueur),u*(0,-longueur)) shifted (u*(largeur+ecart+abs(#3)*longueur,0)+(u*(k*largeur,-l*longueur)));
+    if Print=false:
     fill titi withcolor if #1*#4>0:ColorLetterPos else: ColorLetterNeg fi;
+    fi;
     trace titi;
     if #1*#4>0:
     label(LATEX("$x$"),iso((0,0),u*(largeur,0),u*(largeur,-longueur),u*(0,-longueur)) shifted (u*(largeur+ecart+abs(#3)*longueur,0)+(u*(k*largeur,-l*longueur))));
@@ -3512,7 +5184,9 @@
     for l=0 upto (abs(#2)-1):
     path titi;
     titi=polygone((0,0),u*(longueur,0),u*(longueur,-largeur),u*(0,-largeur)) shifted (u*(largeur+ecart,-abs(#1)*longueur)+(u*(k*longueur,-l*largeur)));
+    if Print=false:
     fill titi withcolor if #2*#3>0:ColorLetterPos else: ColorLetterNeg fi;
+    fi;
     trace titi;
     if #2*#3>0:
     label(LATEX("$x$"),iso((0,0),u*(longueur,0),u*(longueur,-largeur),u*(0,-largeur)) shifted (u*(largeur+ecart,-abs(#1)*longueur)+(u*(k*longueur,-l*largeur))));
@@ -3528,7 +5202,9 @@
     for l=0 upto (abs(#2)-1):
     path titi;
     titi=polygone((0,0),u*(largeur,0),u*(largeur,-largeur),u*(0,-largeur)) shifted (u*(largeur+ecart+abs(#3)*longueur,-abs(#1)*longueur)+(u*(k*largeur,-l*largeur)));
+    if Print=false:
     fill titi withcolor if #2*#4>0:ColorNumPos else: ColorNumNeg fi;
+    fi;
     trace titi;
     if #2*#4>0:
     label(LATEX("$1$"),iso((0,0),u*(largeur,0),u*(largeur,-largeur),u*(0,-largeur)) shifted (u*(largeur+ecart+abs(#3)*longueur,-abs(#1)*longueur)+(u*(k*largeur,-l*largeur))));
@@ -4100,11 +5776,15 @@
 %%%
 % Nombre Premier
 %%%
-\setKVdefault[ClesNombrePremier]{Tableau=false,TableauVertical=false,TableauVerticalVide=false,Exposant=false,Longue=false,All=false,Arbre=false,ArbreVide=false,ArbreComplet=false,Diviseurs=false,DiviseursT=false,Dot=\dotfill}
+\setKVdefault[ClesNombrePremier]{Tableau=false,TableauVertical=false,TableauVerticalVide=false,Exposant=false,Longue=false,All=false,Arbre=false,ArbreVide=false,ArbreComplet=false,Diviseurs=false,DiviseursT=false,Dot=\dotfill,Impose=false,ImposeAll=false}
+\defKV[ClesNombrePremier]{Nombre=\setKV[ClesNombrePremier]{Impose}}
+\defKV[ClesNombrePremier]{AllNombre=\setKV[ClesNombrePremier]{ImposeAll}}
 
 \newcommand\Decomposition[2][]{%
   \useKVdefault[ClesNombrePremier]%
   \setKV[ClesNombrePremier]{#1}%
+  \ifboolKV[ClesNombrePremier]{Impose}{\NombrePremierImpose{#2}{\useKV[ClesNombrePremier]{Nombre}}{\fpeval{#2/\useKV[ClesNombrePremier]{Nombre}}}}{}%
+  \ifboolKV[ClesNombrePremier]{ImposeAll}{\NombrePremierImposeAll{#2}{\useKV[ClesNombrePremier]{AllNombre}}{\fpeval{#2/\useKV[ClesNombrePremier]{AllNombre}}}}{}%
   \ifboolKV[ClesNombrePremier]{Tableau}{\NombrePremier{#2}}{}%
   \ifboolKV[ClesNombrePremier]{TableauVertical}{\NombrePremierVertical{#2}}{}%
   \ifboolKV[ClesNombrePremier]{TableauVerticalVide}{\NombrePremierVerticalVide{#2}}{}%
@@ -4116,7 +5796,7 @@
   \ifboolKV[ClesNombrePremier]{Diviseurs}{\ListeDiviseur{#2}}{}%
   \ifboolKV[ClesNombrePremier]{DiviseursT}{\ListeDiviseurT{#2}}{}%
   \ifboolKV[ClesNombrePremier]{ArbreVide}{\MPArbreVide{#2}}{}%
-}
+}%
 
 \def\MPArbre#1{%
   \ifluatex
@@ -4546,6 +6226,131 @@ vardef Positions(expr Step)=
   \fi
 }
 
+\newcount\premierun
+\newcount\premierdeux
+
+\newcommand\NombrePremierImpose[3]{%\'ecrire la d\'ecomposition compl\`ete
+  % #1 le nombre premier \`a tester
+  % #2 est le premier facteur imposé
+  % #3 est le deuxième facteur imposé
+  \newcount\anp\newcount\bnp\newcount\cnp%\newcount\e\newcount\f%
+  % Pour d\'eterminer le nombre d'\'etapes pour #1
+  \anp=#1\relax
+  \bnp=2\relax
+  \premier=-1\relax
+  \whiledo{\anp > 1}{%
+    \modulo{\the\anp}{\the\bnp}
+    \ifnum\remainder=0\relax
+      \global\premier=\numexpr\premier+1\relax
+      \cnp=\numexpr\anp/\bnp\relax
+      \anp=\cnp\relax
+    \else%
+      \bnp=\numexpr\bnp+1\relax%
+    \fi%
+  }%
+  % Pour d\'eterminer le nombre d'\'etapes pour #2
+  \anp=#2\relax
+  \bnp=2\relax
+  \premierun=-1\relax
+  \whiledo{\anp > 1}{%
+    \modulo{\the\anp}{\the\bnp}
+    \ifnum\remainder=0\relax
+      \global\premierun=\numexpr\premierun+1\relax
+      \cnp=\numexpr\anp/\bnp\relax
+      \anp=\cnp\relax
+    \else%
+      \bnp=\numexpr\bnp+1\relax%
+    \fi%
+  }%
+  % Pour d\'eterminer le nombre d'\'etapes pour #3
+  \anp=#3\relax
+  \bnp=2\relax
+  \premierdeux=-1\relax
+  \whiledo{\anp > 1}{%
+    \modulo{\the\anp}{\the\bnp}
+    \ifnum\remainder=0\relax
+      \global\premierdeux=\numexpr\premierdeux+1\relax
+      \cnp=\numexpr\anp/\bnp\relax
+      \anp=\cnp\relax
+    \else%
+      \bnp=\numexpr\bnp+1\relax%
+    \fi%
+  }%
+  \ifnum\premier=0
+  Le nombre \num{#1} est un nombre premier.
+  \else
+  \xintifboolexpr{\premierun>\premierdeux}{\premier=\premierun}{\premier=\premierdeux}
+  \begin{align*}
+    \num{#1}&=\num{#2}\times\num{#3}%\\
+    \xintifboolexpr{\premier>0}{\\%
+    \xintFor* ##1 in {\xintSeq {1}{\premier}}\do {\num{#1}&=\xintifboolexpr{##1<\premierun}{\PremierEtape{#2}{##1}}{\Decomposition[Longue]{#2}}\mathrel{\times}\xintifboolexpr{##1<\premierdeux}{\PremierEtape{#3}{##1}}{\Decomposition[Longue]{#3}}\xintifboolexpr{##1<\premier}{\\}{}}%
+    }{}%
+  \end{align*}
+  \fi
+}%
+
+\newcommand\NombrePremierImposeAll[3]{%\'ecrire la d\'ecomposition compl\`ete
+  % #1 le nombre premier \`a tester
+  % #2 est le premier facteur imposé
+  % #3 est le deuxième facteur imposé
+  \newcount\anp\newcount\bnp\newcount\cnp%\newcount\e\newcount\f%
+  % Pour d\'eterminer le nombre d'\'etapes pour #1
+  \anp=#1\relax
+  \bnp=2\relax
+  \premier=-1\relax
+  \whiledo{\anp > 1}{%
+    \modulo{\the\anp}{\the\bnp}
+    \ifnum\remainder=0\relax
+      \global\premier=\numexpr\premier+1\relax
+      \cnp=\numexpr\anp/\bnp\relax
+      \anp=\cnp\relax
+    \else%
+      \bnp=\numexpr\bnp+1\relax%
+    \fi%
+  }
+  % Pour d\'eterminer le nombre d'\'etapes pour #2
+  \anp=#2\relax
+  \bnp=2\relax
+  \premierun=-1\relax
+  \whiledo{\anp > 1}{%
+    \modulo{\the\anp}{\the\bnp}
+    \ifnum\remainder=0\relax
+      \global\premierun=\numexpr\premierun+1\relax
+      \cnp=\numexpr\anp/\bnp\relax
+      \anp=\cnp\relax
+    \else%
+      \bnp=\numexpr\bnp+1\relax%
+    \fi%
+  }
+  % Pour d\'eterminer le nombre d'\'etapes pour #3
+  \anp=#3\relax
+  \bnp=2\relax
+  \premierdeux=-1\relax
+  \whiledo{\anp > 1}{%
+    \modulo{\the\anp}{\the\bnp}
+    \ifnum\remainder=0\relax
+      \global\premierdeux=\numexpr\premierdeux+1\relax
+      \cnp=\numexpr\anp/\bnp\relax
+      \anp=\cnp\relax
+    \else%
+      \bnp=\numexpr\bnp+1\relax%
+    \fi%
+  }%
+  \ifnum\premier=0
+  Le nombre \num{#1} est un nombre premier.
+  \else%
+  \xintifboolexpr{\premierun>\premierdeux}{\premier=\premierun}{\premier=\premierdeux}%
+  \begin{align*}
+    \num{#1}&=\num{#2}\times\num{#3}%\\
+    \xintifboolexpr{\premier>0}{\\%
+    \xintFor* ##1 in {\xintSeq {1}{\premier}}\do {\num{#1}&=\xintifboolexpr{##1<\premierun}{\PremierEtape{#2}{##1}}{\Decomposition[Longue]{#2}}\mathrel{\times}\xintifboolexpr{##1<\premierdeux}{\PremierEtape{#3}{##1}}{\Decomposition[Longue]{#3}}\\
+    }%
+    \num{#1}&=\PremierExposant{#1}%
+              }{}
+  \end{align*}
+  \fi%
+}%
+
 \newcommand{\NombrePremierVertical}[1]{%\'ecrire la d\'ecomposition compl\`ete
   % #1 le nombre premier \`a tester
   \newcount\anpv\newcount\bnpv\newcount\cnpv%\newcount\e\newcount\f%
@@ -5048,7 +6853,7 @@ vardef Positions(expr Step)=
   \ppcm=\numexpr#1*#2/\pgcd\relax
 }
 
-\setKVdefault[ClesThales]{Calcul=true,Droites=false,Propor=false,Segment=false,Figure=false,FigureSeule=false,Figurecroisee=false,FigurecroiseeSeule=false,Angle=0,Precision=2,Entier=false,Unite=cm,Reciproque=false,Produit=false,ChoixCalcul=0,Simplification,Redaction=false,Remediation=false}
+\setKVdefault[ClesThales]{Calcul=true,Droites=false,Propor=false,Segment=false,Figure=false,FigureSeule=false,Figurecroisee=false,FigurecroiseeSeule=false,Angle=0,Precision=2,Entier=false,Unite=cm,Reciproque=false,Produit=false,ChoixCalcul=0,Simplification,Redaction=false,Remediation=false,Echelle=1cm}
 
 %On d\'efinit la figure \`a utiliser
 \def\MPFigThales#1#2#3#4#5#6{
@@ -5061,7 +6866,7 @@ vardef Positions(expr Step)=
   \mplibcodeinherit{enable}
   \mplibforcehmode
   \begin{mplibcode}
-    u:=1cm;
+    u:=\useKV[ClesThales]{Echelle};
     pair A,B,C,M,N,O;%
     %On place les points A,B,C sur le cercle de mani\`ere \`a faciliter la rotation de la figure
     A=u*(1,1);
@@ -5109,8 +6914,7 @@ vardef Positions(expr Step)=
   \end{mplibcode}
   \mplibcodeinherit{disable}
   \else
-  \begin{mpost}
-    u:=1cm;
+  \begin{mpost}[mpsettings={u:=\useKV[ClesThales]{Echelle};}]
     pair A,B,C,M,N,O;%
     %On place les points A,B,C sur le cercle de mani\`ere \`a faciliter la rotation de la figure
     A=u*(1,1);
@@ -5170,7 +6974,7 @@ vardef Positions(expr Step)=
   \mplibcodeinherit{enable}
   \mplibforcehmode
   \begin{mplibcode}
-    u:=1cm;
+    u:=\useKV[ClesThales]{Echelle};
     pair A,B,C,M,N,O;%
     %On place les points A,B,C sur le cercle de mani\`ere \`a faciliter la rotation de la figure
     A=u*(1,1);
@@ -5206,8 +7010,7 @@ vardef Positions(expr Step)=
   \end{mplibcode}
   \mplibcodeinherit{disable}
   \else
-  \begin{mpost}
-      u:=1cm;
+  \begin{mpost}[mpsettings={u:=\useKV[ClesThales]{Echelle};}]
     pair A,B,C,M,N,O;%
     %On place les points A,B,C sur le cercle de mani\`ere \`a faciliter la rotation de la figure
     A=u*(1,1);
@@ -5255,7 +7058,7 @@ vardef Positions(expr Step)=
   \mplibforcehmode
   \mplibcodeinherit{enable}
   \begin{mplibcode}
-    u:=1cm;
+    u:=\useKV[ClesThales]{Echelle};
     pair A,B,C,M,N,O;%
     O=(2.5u,2.5u);
     path cc;
@@ -5308,8 +7111,7 @@ vardef Positions(expr Step)=
   \end{mplibcode}
   \mplibcodeinherit{disable}
   \else
-  \begin{mpost}
-    u:=1cm;
+  \begin{mpost}[mpsettings={u:=\useKV[ClesThales]{Echelle};}]
     pair A,B,C,M,N,O;%
     O=(2.5u,2.5u);
     path cc;
@@ -5374,7 +7176,7 @@ vardef Positions(expr Step)=
   \mplibforcehmode
   \mplibcodeinherit{enable}
   \begin{mplibcode}
-    u:=1cm;
+    u:=\useKV[ClesThales]{Echelle};
     pair A,B,C,M,N,O;%
     O=(2.5u,2.5u);
     path cc;
@@ -5417,8 +7219,7 @@ vardef Positions(expr Step)=
   \end{mplibcode}
   \mplibcodeinherit{disable}
   \else
-  \begin{mpost}
-    u:=1cm;
+  \begin{mpost}[mpsettings={u:=\useKV[ClesThales]{Echelle};}]
     pair A,B,C,M,N,O;%
     O=(2.5u,2.5u);
     path cc;
@@ -6350,8 +8151,7 @@ vardef Positions(expr Step)=
   \end{mplibcode}
   \mplibcodeinherit{disable}
   \else
-  \begin{mpost}
-    u:=1cm;
+  \begin{mpost}[mpsettings={u:=\useKV[ClesTrigo]{Echelle};}]
     pair A,B,C,O,I,D,E,F;%
     % On place les points A,B,C sur le cercle de mani\`ere \`a faciliter la rotation de la figure
     A=u*(1,1);
@@ -6528,7 +8328,7 @@ vardef Positions(expr Step)=
 \end{mplibcode}
 \mplibcodeinherit{disable}
   \else
-  \begin{mpost}
+  \begin{mpost}[mpsettings={u:=\useKV[ClesTrigo]{Echelle};}]
       u:=1cm;
   pair A,B,C,O,I,D,E,F;%
     %On place les points A,B,C sur le cercle de mani\`ere \`a faciliter la rotation de la figure
@@ -6925,115 +8725,90 @@ Unite={},Largeur=1cm,Precision=2,Donnee=Valeurs,Effectif=Effectif,Grille=false,O
 % 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}}}
+\def\updatetoks#1/#2\nil{\addtotok\tabtoksa{\ifboolKV[ClesStat]{Qualitatif}{&\cellcolor{\useKV[ClesStat]{CouleurTab}}#1}{&\cellcolor{\useKV[ClesStat]{CouleurTab}}\num{#1}}}\addtotok\tabtoksb{&\num{#2}}}
 \def\buildtab{% %%Tableau sans total
   \tabtoksa{\useKV[ClesStat]{Donnee}}\tabtoksb{\useKV[ClesStat]{Effectif}}%
   \foreachitem\compteur\in\ListeComplete{\expandafter\updatetoks\compteur\nil}%
   \[%
-  %\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{\ListeComplete[##1,2]}%
     \renewcommand{\arraystretch}{\useKV[ClesStat]{Stretch}}%
-    \begin{tabular}{|>{\columncolor{\useKV[ClesStat]{CouleurTab}}}c|*{\number\numexpr\ListeCompletelen}{>{\centering\arraybackslash}p{\useKV[ClesStat]{Largeur}}|}}%
-    \hline%
-    \rowcolor{\useKV[ClesStat]{CouleurTab}}\the\tabtoksa\\\hline%
-	\ifnum\number\numexpr\useKV[ClesStat]{ColVide}<1%
-    \ifboolKV[ClesStat]{EffVide}{\useKV[ClesStat]{Effectif}\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&}}{\the\tabtoksb}\\\hline% 
-	\ifboolKV[ClesStat]{Frequence}{Fr\'equence (\%)\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{\CalculFrequence{##1}}}}\\\hline}{}%
-	\ifboolKV[ClesStat]{Angle}{Angle (\si{\degree})\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculAngle{##1}}}}\\\hline}{}%
-	\ifboolKV[ClesStat]{SemiAngle}{Angle (\si{\degree})\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculSemiAngle{##1}}}}\\\hline}{}%
-     \ifboolKV[ClesStat]{ECC}{E.C.C.\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{ECCVide}{}{\CalculECC{##1}}}}\\\hline}{}%
-	\end{tabular}
-	\else%
-	\ifnum\number\numexpr\useKV[ClesStat]{ColVide}>\ListeCompletelen%
-    \ifboolKV[ClesStat]{EffVide}{\useKV[ClesStat]{Effectif}\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&}}{\the\tabtoksb}\\\hline%  
-	\ifboolKV[ClesStat]{Frequence}{Fr\'equence (\%)\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{\CalculFrequence{##1}}}}\\\hline}{}%
-	\ifboolKV[ClesStat]{Angle}{Angle (\si{\degree})\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculAngle{##1}}}}\\\hline}{}%
-	\ifboolKV[ClesStat]{SemiAngle}{Angle (\si{\degree})\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculSemiAngle{##1}}}}\\\hline}{}%
-     \ifboolKV[ClesStat]{ECC}{E.C.C.\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{ECCVide}{}{\CalculECC{##1}}}}\\\hline}{}%
-	\end{tabular}
-	\else%
-	\ifnum\number\numexpr\useKV[ClesStat]{ColVide}=1%
-    \ifboolKV[ClesStat]{EffVide}{\useKV[ClesStat]{Effectif}\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&}}{\useKV[ClesStat]{Effectif}&\xintFor* ##1 in {\xintSeq {2}{\ListeCompletelen}}\do{&\ListeComplete[##1,2]}}\\\hline%  
-	\ifboolKV[ClesStat]{Frequence}{Fr\'equence (\%)&\xintFor* ##1 in {\xintSeq {2}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{\CalculFrequence{##1}}}}\\\hline}{}%
-	\ifboolKV[ClesStat]{Angle}{Angle (\si{\degree})&\xintFor* ##1 in {\xintSeq {2}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculAngle{##1}}}}\\\hline}{}%
-	\ifboolKV[ClesStat]{SemiAngle}{Angle (\si{\degree})&\xintFor* ##1 in {\xintSeq {2}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculSemiAngle{##1}}}}\\\hline}{}%
-     \ifboolKV[ClesStat]{ECC}{E.C.C.&\xintFor* ##1 in {\xintSeq {2}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{ECCVide}{}{\CalculECC{##1}}}}\\\hline}{}%
-	\end{tabular}
-    \else%
-	\ifnum\number\numexpr\useKV[ClesStat]{ColVide}=\ListeCompletelen%
-    \ifboolKV[ClesStat]{EffVide}{\useKV[ClesStat]{Effectif}\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&}}{\useKV[ClesStat]{Effectif}\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen-1}}\do{&\ListeComplete[##1,2]}}&\\\hline%  
-	\ifboolKV[ClesStat]{Frequence}{Fr\'equence (\%)\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen-1}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{\CalculFrequence{##1}}}}&\\\hline}{}%
-	\ifboolKV[ClesStat]{Angle}{Angle (\si{\degree})\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen-1}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculAngle{##1}}}}&\\\hline}{}%
-	\ifboolKV[ClesStat]{SemiAngle}{Angle (\si{\degree})\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen-1}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculSemiAngle{##1}}}}&\\\hline}{}%
-     \ifboolKV[ClesStat]{ECC}{E.C.C.\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen-1}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{ECCVide}{}{\CalculECC{##1}}}}&\\\hline}{}%
-	\end{tabular}
-	\else%
-    \ifboolKV[ClesStat]{EffVide}{\useKV[ClesStat]{Effectif}\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&}}{\useKV[ClesStat]{Effectif}\xintFor* ##1 in {\xintSeq {1}{\number\numexpr\useKV[ClesStat]{ColVide}-1}}\do{&\ListeComplete[##1,2]}&\xintFor* ##1 in {\xintSeq {\number\numexpr\useKV[ClesStat]{ColVide}+1}{\ListeCompletelen}}\do{&\ListeComplete[##1,2]}}\\\hline%  
-	\ifboolKV[ClesStat]{Frequence}{Fr\'equence (\%)\xintFor* ##1 in {\xintSeq {1}{\number\numexpr\useKV[ClesStat]{ColVide}-1}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{\CalculFrequence{##1}}}}&\xintFor* ##1 in {\xintSeq {\number\numexpr\useKV[ClesStat]{ColVide}+1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{\CalculFrequence{##1}}}}\\\hline}{}%
-	\ifboolKV[ClesStat]{Angle}{Angle (\si{\degree})\xintFor* ##1 in {\xintSeq {1}{\number\numexpr\useKV[ClesStat]{ColVide}-1}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculAngle{##1}}}}&\xintFor* ##1 in {\xintSeq {\number\numexpr\useKV[ClesStat]{ColVide}+1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{\CalculAngle{##1}}}}\\\hline}{}%
-	\ifboolKV[ClesStat]{SemiAngle}{Angle (\si{\degree})\xintFor* ##1 in {\xintSeq {1}{\number\numexpr\useKV[ClesStat]{ColVide}-1}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculSemiAngle{##1}}}}&\xintFor* ##1 in {\xintSeq {\number\numexpr\useKV[ClesStat]{ColVide}+1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{\CalculSemiAngle{##1}}}}\\\hline}{}%
-	\ifboolKV[ClesStat]{ECC}{E.C.C.\xintFor* ##1 in {\xintSeq {1}{\number\numexpr\useKV[ClesStat]{ColVide}-1}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{ECCVide}{}{\CalculECC{##1}}}}&\xintFor* ##1 in {\xintSeq {\number\numexpr\useKV[ClesStat]{ColVide}+1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{ECCVide}{}{\CalculECC{##1}}}}\\\hline}{}%
-	\end{tabular}
-    \fi%
-	\fi%
-	\fi%
-	\fi%  
+    \begin{tabular}{|>{\columncolor{\useKV[ClesStat]{CouleurTab}}}c|*{\fpeval{\ListeCompletelen}}{>{\centering\arraybackslash}p{\useKV[ClesStat]{Largeur}}|}}%
+      \hline%
+      \the\tabtoksa\\\hline%
+      \xintifboolexpr{\useKV[ClesStat]{ColVide}<1 || \useKV[ClesStat]{ColVide}>\ListeCompletelen}{%
+      \ifboolKV[ClesStat]{EffVide}{\useKV[ClesStat]{Effectif}\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&}}{\the\tabtoksb}\\\hline%
+      \ifboolKV[ClesStat]{Frequence}{Fr\'equence (\%)\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{\CalculFrequence{##1}}}}\\\hline}{}%
+      \ifboolKV[ClesStat]{Angle}{Angle (\si{\degree})\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculAngle{##1}}}}\\\hline}{}%
+      \ifboolKV[ClesStat]{SemiAngle}{Angle (\si{\degree})\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculSemiAngle{##1}}}}\\\hline}{}%
+      \ifboolKV[ClesStat]{ECC}{E.C.C.\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{ECCVide}{}{\CalculECC{##1}}}}\\\hline}{}%
+      }{%
+      \xintifboolexpr{\useKV[ClesStat]{ColVide}==1}{%
+      \ifboolKV[ClesStat]{EffVide}{\useKV[ClesStat]{Effectif}\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&}}{\useKV[ClesStat]{Effectif}&\xintFor* ##1 in {\xintSeq {2}{\ListeCompletelen}}\do{&\ListeComplete[##1,2]}}\\\hline%  
+      \ifboolKV[ClesStat]{Frequence}{Fr\'equence (\%)&\xintFor* ##1 in {\xintSeq {2}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{\CalculFrequence{##1}}}}\\\hline}{}%
+      \ifboolKV[ClesStat]{Angle}{Angle (\si{\degree})&\xintFor* ##1 in {\xintSeq {2}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculAngle{##1}}}}\\\hline}{}%
+      \ifboolKV[ClesStat]{SemiAngle}{Angle (\si{\degree})&\xintFor* ##1 in {\xintSeq {2}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculSemiAngle{##1}}}}\\\hline}{}%
+      \ifboolKV[ClesStat]{ECC}{E.C.C.&\xintFor* ##1 in {\xintSeq {2}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{ECCVide}{}{\CalculECC{##1}}}}\\\hline}{}%
+      }{%
+      \xintifboolexpr{\useKV[ClesStat]{ColVide}==\ListeCompletelen}{%
+      \ifboolKV[ClesStat]{EffVide}{\useKV[ClesStat]{Effectif}\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&}}{\useKV[ClesStat]{Effectif}\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen-1}}\do{&\ListeComplete[##1,2]}}&\\\hline%  
+      \ifboolKV[ClesStat]{Frequence}{Fr\'equence (\%)\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen-1}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{\CalculFrequence{##1}}}}&\\\hline}{}%
+      \ifboolKV[ClesStat]{Angle}{Angle (\si{\degree})\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen-1}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculAngle{##1}}}}&\\\hline}{}%
+      \ifboolKV[ClesStat]{SemiAngle}{Angle (\si{\degree})\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen-1}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculSemiAngle{##1}}}}&\\\hline}{}%
+      \ifboolKV[ClesStat]{ECC}{E.C.C.\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen-1}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{ECCVide}{}{\CalculECC{##1}}}}&\\\hline}{}%
+      }{%
+      \ifboolKV[ClesStat]{EffVide}{\useKV[ClesStat]{Effectif}\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&}}{\useKV[ClesStat]{Effectif}\xintFor* ##1 in {\xintSeq {1}{\fpeval{\useKV[ClesStat]{ColVide}-1}}}\do{&\ListeComplete[##1,2]}&\xintFor* ##1 in {\xintSeq {\fpeval{\useKV[ClesStat]{ColVide}+1}}{\ListeCompletelen}}\do{&\ListeComplete[##1,2]}}\\\hline%  
+      \ifboolKV[ClesStat]{Frequence}{Fr\'equence (\%)\xintFor* ##1 in {\xintSeq {1}{\fpeval{\useKV[ClesStat]{ColVide}-1}}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{\CalculFrequence{##1}}}}&\xintFor* ##1 in {\xintSeq {\fpeval{\useKV[ClesStat]{ColVide}+1}}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{\CalculFrequence{##1}}}}\\\hline}{}%
+      \ifboolKV[ClesStat]{Angle}{Angle (\si{\degree})\xintFor* ##1 in {\xintSeq {1}{\fpeval{\useKV[ClesStat]{ColVide}-1}}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculAngle{##1}}}}&\xintFor* ##1 in {\xintSeq {\fpeval{\useKV[ClesStat]{ColVide}+1}}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{\CalculAngle{##1}}}}\\\hline}{}%
+      \ifboolKV[ClesStat]{SemiAngle}{Angle (\si{\degree})\xintFor* ##1 in {\xintSeq {1}{\fpeval{\useKV[ClesStat]{ColVide}-1}}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculSemiAngle{##1}}}}&\xintFor* ##1 in {\xintSeq {\fpeval{\useKV[ClesStat]{ColVide}+1}}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{\CalculSemiAngle{##1}}}}\\\hline}{}%
+      \ifboolKV[ClesStat]{ECC}{E.C.C.\xintFor* ##1 in {\xintSeq {1}{\fpeval{\useKV[ClesStat]{ColVide}-1}}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{ECCVide}{}{\CalculECC{##1}}}}&\xintFor* ##1 in {\xintSeq {\fpeval{\useKV[ClesStat]{ColVide}+1}}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{ECCVide}{}{\CalculECC{##1}}}}\\\hline}{}%
+      }%
+      }%
+      }%
+    \end{tabular}
     \renewcommand{\arraystretch}{1}%
-  \]
-}
+  \]%
+}%
 
 \def\buildtabt{% %%Tableau avec total
   \tabtoksa{\useKV[ClesStat]{Donnee}}\tabtoksb{\useKV[ClesStat]{Effectif}}%
   \foreachitem\compteur\in\ListeComplete{\expandafter\updatetoks\compteur\nil}%
-  \[%	
+  \[%
     \renewcommand{\arraystretch}{\useKV[ClesStat]{Stretch}}%
-    \begin{tabular}{|>{\columncolor{\useKV[ClesStat]{CouleurTab}}}c|*{\number\numexpr\ListeCompletelen+1}{>{\centering\arraybackslash}p{\useKV[ClesStat]{Largeur}}|}}%
-    \hline%
-    \rowcolor{\useKV[ClesStat]{CouleurTab}}\the\tabtoksa&Total\\\hline%
-	\ifnum\number\numexpr\useKV[ClesStat]{ColVide}<1%
-     \ifboolKV[ClesStat]{EffVide}{\useKV[ClesStat]{Effectif}\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen+1}}\do{&}}{\the\tabtoksb&\ifboolKV[ClesStat]{TotalVide}{}{\num{\EffectifTotal}}}\\\hline%
-	\ifboolKV[ClesStat]{Frequence}{Fr\'equence (\%)\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{\CalculFrequence{##1}}}}&\ifboolKV[ClesStat]{TotalVide}{}{\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{100}}}\\\hline}{}%
-	\ifboolKV[ClesStat]{Angle}{Angle (\si{\degree})\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculAngle{##1}}}}&\ifboolKV[ClesStat]{TotalVide}{}{\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{360}}}\\\hline}{}%
-      \ifboolKV[ClesStat]{SemiAngle}{Angle (\si{\degree})\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculSemiAngle{##1}}}}&\ifboolKV[ClesStat]{TotalVide}{}{\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{180}}}\\\hline}{}%
-      \ifboolKV[ClesStat]{ECC}{E.C.C.\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{ECCVide}{}{\CalculECC{##1}}}}&\ifboolKV[ClesStat]{TotalVide}{}{\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{ECCVide}{}{\num{\EffectifTotal}}}}\\\hline}{}%
-    \end{tabular}
-	\else%
-	\ifnum\number\numexpr\useKV[ClesStat]{ColVide}>\ListeCompletelen%
-     \ifboolKV[ClesStat]{EffVide}{\useKV[ClesStat]{Effectif}\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen+1}}\do{&}}{\the\tabtoksb&\ifboolKV[ClesStat]{TotalVide}{}{\num{\EffectifTotal}}}\\\hline%
-	\ifboolKV[ClesStat]{Frequence}{Fr\'equence (\%)\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{\CalculFrequence{##1}}}}&\ifboolKV[ClesStat]{TotalVide}{}{\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{100}}}\\\hline}{}%
-	\ifboolKV[ClesStat]{Angle}{Angle (\si{\degree})\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculAngle{##1}}}}&\ifboolKV[ClesStat]{TotalVide}{}{\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{360}}}\\\hline}{}%
+    \begin{tabular}{|>{\columncolor{\useKV[ClesStat]{CouleurTab}}}c|*{\fpeval{\ListeCompletelen+1}}{>{\centering\arraybackslash}p{\useKV[ClesStat]{Largeur}}|}}%
+      \hline%
+      \the\tabtoksa&\cellcolor{\useKV[ClesStat]{CouleurTab}}Total\\\hline%
+      \xintifboolexpr{\useKV[ClesStat]{ColVide}<1 || \useKV[ClesStat]{ColVide}>\ListeCompletelen}{%
+      \ifboolKV[ClesStat]{EffVide}{\useKV[ClesStat]{Effectif}\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&}}{\the\tabtoksb&\ifboolKV[ClesStat]{TotalVide}{}{\num{\EffectifTotal}}}\\\hline%
+      \ifboolKV[ClesStat]{Frequence}{Fr\'equence (\%)\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{\CalculFrequence{##1}}}}&\ifboolKV[ClesStat]{TotalVide}{}{\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{100}}}\\\hline}{}%
+      \ifboolKV[ClesStat]{Angle}{Angle (\si{\degree})\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculAngle{##1}}}}&\ifboolKV[ClesStat]{TotalVide}{}{\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{360}}}\\\hline}{}%
       \ifboolKV[ClesStat]{SemiAngle}{Angle (\si{\degree})\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculSemiAngle{##1}}}}&\ifboolKV[ClesStat]{TotalVide}{}{\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{180}}}\\\hline}{}%
-      \ifboolKV[ClesStat]{ECC}{E.C.C.\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{ECCVide}{}{\CalculECC{##1}}}}&\ifboolKV[ClesStat]{TotalVide}{}{\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{ECCVide}{}{\num{\EffectifTotal}}}}\\\hline}{}%
-    \end{tabular}
-	\else%
-	\ifnum\number\numexpr\useKV[ClesStat]{ColVide}=1%
-    \ifboolKV[ClesStat]{EffVide}{\useKV[ClesStat]{Effectif}\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen+1}}\do{&}}{\useKV[ClesStat]{Effectif}&\xintFor* ##1 in {\xintSeq {2}{\ListeCompletelen}}\do{&\ListeComplete[##1,2]}&\ifboolKV[ClesStat]{TotalVide}{}{\num{\EffectifTotal}}}\\\hline%  
-	\ifboolKV[ClesStat]{Frequence}{Fr\'equence (\%)&\xintFor* ##1 in {\xintSeq {2}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{\CalculFrequence{##1}}}}&\ifboolKV[ClesStat]{TotalVide}{}{\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{100}}}\\\hline}{}%
-	\ifboolKV[ClesStat]{Angle}{Angle (\si{\degree})&\xintFor* ##1 in {\xintSeq {2}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculAngle{##1}}}}&\ifboolKV[ClesStat]{TotalVide}{}{\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{360}}}\\\hline}{}%
+      \ifboolKV[ClesStat]{ECC}{E.C.C.\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{ECCVide}{}{\CalculECC{##1}}}}\ifboolKV[ClesStat]{TotalVide}{}{\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{ECCVide}{}{\num{\EffectifTotal}}}}\\\hline}{}%
+      }{%
+      \xintifboolexpr{\useKV[ClesStat]{ColVide}==1}{%
+      \ifboolKV[ClesStat]{EffVide}{\useKV[ClesStat]{Effectif}\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&}}{\useKV[ClesStat]{Effectif}&\xintFor* ##1 in {\xintSeq {2}{\ListeCompletelen}}\do{&\ListeComplete[##1,2]}&\ifboolKV[ClesStat]{TotalVide}{}{\num{\EffectifTotal}}}\\\hline%  
+      \ifboolKV[ClesStat]{Frequence}{Fr\'equence (\%)&\xintFor* ##1 in {\xintSeq {2}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{\CalculFrequence{##1}}}}&\ifboolKV[ClesStat]{TotalVide}{}{\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{100}}}\\\hline}{}%
+      \ifboolKV[ClesStat]{Angle}{Angle (\si{\degree})&\xintFor* ##1 in {\xintSeq {2}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculAngle{##1}}}}&\ifboolKV[ClesStat]{TotalVide}{}{\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{360}}}\\\hline}{}%
       \ifboolKV[ClesStat]{SemiAngle}{Angle (\si{\degree})&\xintFor* ##1 in {\xintSeq {2}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculSemiAngle{##1}}}}&\ifboolKV[ClesStat]{TotalVide}{}{\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{180}}}\\\hline}{}%
       \ifboolKV[ClesStat]{ECC}{E.C.C.&\xintFor* ##1 in {\xintSeq {2}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{ECCVide}{}{\CalculECC{##1}}}}&\ifboolKV[ClesStat]{TotalVide}{}{\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{ECCVide}{}{\num{\EffectifTotal}}}}\\\hline}{}%
-    \end{tabular}
-    \else%
-	\ifnum\number\numexpr\useKV[ClesStat]{ColVide}=\ListeCompletelen%
-    \ifboolKV[ClesStat]{EffVide}{\useKV[ClesStat]{Effectif}\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen+1}}\do{&}}{\useKV[ClesStat]{Effectif}\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen-1}}\do{&\ListeComplete[##1,2]}&&\ifboolKV[ClesStat]{TotalVide}{}{\num{\EffectifTotal}}}\\\hline%  
-	\ifboolKV[ClesStat]{Frequence}{Fr\'equence (\%)\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen-1}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{\CalculFrequence{##1}}}}&&\ifboolKV[ClesStat]{TotalVide}{}{\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{100}}}\\\hline}{}%
-	\ifboolKV[ClesStat]{Angle}{Angle (\si{\degree})\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen-1}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculAngle{##1}}}}&&\ifboolKV[ClesStat]{TotalVide}{}{\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{360}}}\\\hline}{}%
+      }{%
+      \xintifboolexpr{\useKV[ClesStat]{ColVide}==\ListeCompletelen}{%
+      \ifboolKV[ClesStat]{EffVide}{\useKV[ClesStat]{Effectif}\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&}}{\useKV[ClesStat]{Effectif}\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen-1}}\do{&\ListeComplete[##1,2]}&&\ifboolKV[ClesStat]{TotalVide}{}{\num{\EffectifTotal}}}\\\hline%  
+      \ifboolKV[ClesStat]{Frequence}{Fr\'equence (\%)\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen-1}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{\CalculFrequence{##1}}}}&&\ifboolKV[ClesStat]{TotalVide}{}{\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{100}}}\\\hline}{}%
+      \ifboolKV[ClesStat]{Angle}{Angle (\si{\degree})\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen-1}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculAngle{##1}}}}&&\ifboolKV[ClesStat]{TotalVide}{}{\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{360}}}\\\hline}{}%
       \ifboolKV[ClesStat]{SemiAngle}{Angle (\si{\degree})\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen-1}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculSemiAngle{##1}}}}&&\ifboolKV[ClesStat]{TotalVide}{}{\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{180}}}\\\hline}{}%
       \ifboolKV[ClesStat]{ECC}{E.C.C.\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen-1}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{ECCVide}{}{\CalculECC{##1}}}}&&\ifboolKV[ClesStat]{TotalVide}{}{\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{ECCVide}{}{\num{\EffectifTotal}}}}\\\hline}{}%
+      }{%
+      \ifboolKV[ClesStat]{EffVide}{\useKV[ClesStat]{Effectif}\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&}}{\useKV[ClesStat]{Effectif}\xintFor* ##1 in {\xintSeq {1}{\fpeval{\useKV[ClesStat]{ColVide}-1}}}\do{&\ListeComplete[##1,2]}&\xintFor* ##1 in {\xintSeq {\fpeval{\useKV[ClesStat]{ColVide}+1}}{\ListeCompletelen}}\do{&\ListeComplete[##1,2]}&\ifboolKV[ClesStat]{TotalVide}{}{\num{\EffectifTotal}}}\\\hline%  
+      \ifboolKV[ClesStat]{Frequence}{Fr\'equence (\%)\xintFor* ##1 in {\xintSeq {1}{\fpeval{\useKV[ClesStat]{ColVide}-1}}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{\CalculFrequence{##1}}}}&\xintFor* ##1 in {\xintSeq {\fpeval{\useKV[ClesStat]{ColVide}+1}}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{\CalculFrequence{##1}}}}&\ifboolKV[ClesStat]{TotalVide}{}{\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{100}}}\\\hline}{}%
+      \ifboolKV[ClesStat]{Angle}{Angle (\si{\degree})\xintFor* ##1 in {\xintSeq {1}{\fpeval{\useKV[ClesStat]{ColVide}-1}}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculAngle{##1}}}}&\xintFor* ##1 in {\xintSeq {\fpeval{\useKV[ClesStat]{ColVide}+1}}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{\CalculAngle{##1}}}}&\ifboolKV[ClesStat]{TotalVide}{}{\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{360}}}\\\hline}{}%
+      \ifboolKV[ClesStat]{SemiAngle}{Angle (\si{\degree})\xintFor* ##1 in {\xintSeq {1}{\fpeval{\useKV[ClesStat]{ColVide}-1}}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculSemiAngle{##1}}}}&\xintFor* ##1 in {\xintSeq {\fpeval{\useKV[ClesStat]{ColVide}+1}}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{\CalculSemiAngle{##1}}}}&\ifboolKV[ClesStat]{TotalVide}{}{\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{180}}}\\\hline}{}%
+      \ifboolKV[ClesStat]{ECC}{E.C.C.\xintFor* ##1 in {\xintSeq {1}{\fpeval{\useKV[ClesStat]{ColVide}-1}}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{ECCVide}{}{\CalculECC{##1}}}}&\xintFor* ##1 in {\xintSeq {\fpeval{\useKV[ClesStat]{ColVide}+1}}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{ECCVide}{}{\CalculECC{##1}}}}&\ifboolKV[ClesStat]{TotalVide}{}{\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{ECCVide}{}{\num{\EffectifTotal}}}}\\\hline}{}%
+      }%
+      }%
+      }%
     \end{tabular}
-	\else%
-    \ifboolKV[ClesStat]{EffVide}{\useKV[ClesStat]{Effectif}\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen+1}}\do{&}}{\useKV[ClesStat]{Effectif}\xintFor* ##1 in {\xintSeq {1}{\number\numexpr\useKV[ClesStat]{ColVide}-1}}\do{&\ListeComplete[##1,2]}&\xintFor* ##1 in {\xintSeq {\number\numexpr\useKV[ClesStat]{ColVide}+1}{\ListeCompletelen}}\do{&\ListeComplete[##1,2]}&\ifboolKV[ClesStat]{TotalVide}{}{\num{\EffectifTotal}}}\\\hline% 
-	\ifboolKV[ClesStat]{Frequence}{Fr\'equence (\%)\xintFor* ##1 in {\xintSeq {1}{\number\numexpr\useKV[ClesStat]{ColVide}-1}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{\CalculFrequence{##1}}}}&\xintFor* ##1 in {\xintSeq {\number\numexpr\useKV[ClesStat]{ColVide}+1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{\CalculFrequence{##1}}}}&\ifboolKV[ClesStat]{TotalVide}{}{\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{100}}}\\\hline}{}%
-	\ifboolKV[ClesStat]{Angle}{Angle (\si{\degree})\xintFor* ##1 in {\xintSeq {1}{\number\numexpr\useKV[ClesStat]{ColVide}-1}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculAngle{##1}}}}&\xintFor* ##1 in {\xintSeq {\number\numexpr\useKV[ClesStat]{ColVide}+1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculAngle{##1}}}}&\ifboolKV[ClesStat]{TotalVide}{}{\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{360}}}\\\hline}{}%
-      \ifboolKV[ClesStat]{SemiAngle}{Angle (\si{\degree})\xintFor* ##1 in {\xintSeq {1}{\number\numexpr\useKV[ClesStat]{ColVide}-1}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculSemiAngle{##1}}}}&\xintFor* ##1 in {\xintSeq {\number\numexpr\useKV[ClesStat]{ColVide}+1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculSemiAngle{##1}}}}&\ifboolKV[ClesStat]{TotalVide}{}{\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{180}}}\\\hline}{}%
-      \ifboolKV[ClesStat]{ECC}{E.C.C.\xintFor* ##1 in {\xintSeq {1}{\number\numexpr\useKV[ClesStat]{ColVide}-1}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{ECCVide}{}{\CalculECC{##1}}}}&\xintFor* ##1 in {\xintSeq {\number\numexpr\useKV[ClesStat]{ColVide}+1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{ECCVide}{}{\CalculECC{##1}}}}&\ifboolKV[ClesStat]{TotalVide}{}{\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{ECCVide}{}{\num{\EffectifTotal}}}}\\\hline}{}%
-    \end{tabular}
-    \fi%
-	\fi%
-	\fi%
-	\fi%  
     \renewcommand{\arraystretch}{1}%
-  \]
-}
+  \]%
+}%
 
 % Pour construire le diagramme en bâtons
 \def\Updatetoks#1/#2\nil{\addtotok\toklistepoint{(#1,#2),}}
@@ -7117,7 +8892,7 @@ Unite={},Largeur=1cm,Precision=2,Donnee=Valeurs,Effectif=Effectif,Grille=false,O
   \xdef\TotalECC{0}%
   \CompteurECC=1%
   \CompteurECCTotal=\numexpr#1+1%
-  \whiledo{\CompteurECC < \CompteurECCTotal}{
+  \whiledo{\CompteurECC < \CompteurECCTotal}{%
     \xdef\TotalECC{\fpeval{\TotalECC+\ListeComplete[\the\CompteurECC,2]}}%
     \CompteurECC=\numexpr\CompteurECC+1%
   }%
@@ -7406,9 +9181,9 @@ Unite={},Largeur=1cm,Precision=2,Donnee=Valeurs,Effectif=Effectif,Grille=false,O
     if #4=1:
     if round(p_*(#3/total[N]))>15:
     if (n mod 2)=0:
-    marque_a:=3.1*20
+    marque_a:=20*0.75*#1/cm;
     else:
-    marque_a:=3.1*20/0.9
+    marque_a:=20*0.5*#1/cm;
     fi;
     if #6=1:
     if #7=0:
@@ -7531,9 +9306,9 @@ Unite={},Largeur=1cm,Precision=2,Donnee=Valeurs,Effectif=Effectif,Grille=false,O
     if #4=1:
     if round(p_*(#3/total[N]))>15:
     if (n mod 2)=0:
-    marque_a:=3.1*20
+    marque_a:=20*0.75*#1/cm;
     else:
-    marque_a:=3.1*20/0.9
+    marque_a:=20*0.5*#1/cm;
     fi;
     if #6=1:
     if #7=0:
@@ -7938,14 +9713,17 @@ Unite={},Largeur=1cm,Precision=2,Donnee=Valeurs,Effectif=Effectif,Grille=false,O
     }%
   }{}%
   % Construction de tableau
-  \ifboolKV[ClesStat]{Tableau}{\ifboolKV[ClesStat]{Total}{\buildtabt}{\buildtab}}{}%
+  \ifboolKV[ClesStat]{Tableau}{\ifboolKV[ClesStat]{Total}{\buildtabt}{%
+      \buildtab%
+    }
+  }{}%
   % Construction du graphique ??
   \ifboolKV[ClesStat]{Graphique}{%
     \ifboolKV[ClesStat]{Angle}{\buildgraphcq{360}}{\ifboolKV[ClesStat]{SemiAngle}{\buildgraphcq{180}}{\buildgraph[#1]}}
   }{}%
 }%
 }%
-}
+}%
 
 %%%
 % Radar
@@ -8290,6 +10068,30 @@ Unite={},Largeur=1cm,Precision=2,Donnee=Valeurs,Effectif=Effectif,Grille=false,O
 
 \definecolor{Cfleches}{RGB}{100,100,100}%
 
+\newcommand\AffichageEqua[4]{%
+  \def\LETTRE{\useKV[ClesEquation]{Lettre}}%
+  \ensuremath{%
+    % partie du x
+    \xintifboolexpr{#1==0}{}{\xintifboolexpr{#1==1}{}{\xintifboolexpr{#1==-1}{-}{\num{#1}}}\LETTRE}%
+    % partie du nombre
+    \xintifboolexpr{#2==0}{\xintifboolexpr{#1==0}{0}{}}{\xintifboolexpr{#2>0}{\xintifboolexpr{#1==0}{}{+}\num{#2}}{\num{#2}}}%
+    % egal
+    =
+    % partie du x
+    \xintifboolexpr{#3==0}{}{\xintifboolexpr{#3==1}{}{\xintifboolexpr{#3==-1}{-}{\num{#3}}}\LETTRE}%
+    % partie du nombre
+    \xintifboolexpr{#4==0}{%
+      \xintifboolexpr{#3==0}{0}{}
+    }{%
+      \xintifboolexpr{#4>0}{\xintifboolexpr{#3==0}{}{+}\num{#4}}{\num{#4}}%
+    }
+  }%
+}%
+
+\newcommand\EcrireSolutionEquation[4]{%
+  L'équation \AffichageEqua{#1}{#2}{#3}{#4} a une unique solution : \opdiv*{\Coeffb}{\Coeffa}{solution}{resteequa}\opcmp{resteequa}{0}$\ifboolKV[ClesEquation]{LettreSol}{\useKV[ClesEquation]{Lettre}=}{}\displaystyle\ifopeq\opexport{solution}{\solution}\num{\solution}\else\ifboolKV[ClesEquation]{Entier}{\SSimplifie{\Coeffb}{\Coeffa}}{\frac{\num{\Coeffb}}{\num{\Coeffa}}}\fi$.
+}%
+
 \input{PfCEquationSoustraction2}%
 \input{PfCEquationTerme1}%
 \input{PfCEquationComposition2}%
@@ -8297,7 +10099,7 @@ Unite={},Largeur=1cm,Precision=2,Donnee=Valeurs,Effectif=Effectif,Grille=false,O
 \input{PfCEquationSymbole1}%
 \input{PfCEquationLaurent1}
 
-\newcommand{\ResolEquation}[5][]{%
+\newcommand\ResolEquation[5][]{%
   \useKVdefault[ClesEquation]%
   \setKV[ClesEquation]{#1}%
   \colorlet{Cterme}{\useKV[ClesEquation]{CouleurTerme}}%
@@ -8457,6 +10259,7 @@ Unite={},Largeur=1cm,Precision=2,Donnee=Valeurs,Effectif=Effectif,Grille=false,O
     \hhline{*{\number\numexpr\ListeValeurlen+1}{-}}%
     \multicolumn{1}{c}{\TikzPBD\setcounter{NbPropor}{1}}\xintFor* ##1 in {\xintSeq {1}{\ListeValeurlen}}\do{&\multicolumn{1}{c}{\TikzPB}}\\%
   \end{tabular}%
+  \renewcommand{\arraystretch}{1}%
 }%
 
 \newcounter{NbPropor}
@@ -8526,7 +10329,7 @@ Unite={},Largeur=1cm,Precision=2,Donnee=Valeurs,Effectif=Effectif,Grille=false,O
   \useKVdefault[ClesPropor]%
   \setKV[ClesPropor]{#1}%
   \xdef\colorfill{\useKV[ClesPropor]{ColorFill}}%
-  \xdef\EcartLargeur{\useKV[ClesPropor]{Largeur}}
+  \xdef\EcartLargeur{\useKV[ClesPropor]{Largeur}}%
 %  %on lit la liste \'ecrite sous la forme valeur/effectif
   \setsepchar[*]{,*/}\ignoreemptyitems%
   \readlist*\ListeValeur{#2}%
@@ -11809,76 +13612,266 @@ Unite={},Largeur=1cm,Precision=2,Donnee=Valeurs,Effectif=Effectif,Grille=false,O
     l:=1;% compter les informations "num\'eriques"
     vardef toto(text t)=
     for p_=t:
-    if (n mod 2)=1:
-    label(LATEX(p_),A[k]);
-    k:=k+1;
+    if (n mod 2)=1:
+    label(LATEX(p_),A[k]);
+    k:=k+1;
+    else:
+    if (l mod 2)=1:
+    draw appelation(A[(l-1) div 2],A[l],4mm,LATEX(p_));
+    else:
+    draw appelation(A[(l-1) div 2],A[l],-4mm,LATEX(p_));
+    fi;
+    l:=l+1;
+    fi;
+    n:=n+1;
+    endfor;
+    enddef;
+    toto(#3);
+  \end{mpost}
+  \fi
+}
+
+\newcommand\Proba[2][]{%
+  \useKVdefault[ClesProba]%
+  \setKV[ClesProba]{#1}%
+  % On liste les diff\'erents \'el\'ements sous la forme Ev\`enement/proba
+  \setsepchar[*]{,*/}\ignoreemptyitems%
+  \readlist*\ListeProba{#2}
+  \ifboolKV[ClesProba]{Echelle}{%
+    \buildechelleproba%
+  }{\ifboolKV[ClesProba]{Arbre}{%
+      \buildarbreproba%
+    }{}
+  }
+}
+
+%%%
+% Reperage
+%%%
+\setKVdefault[ClesReperage]{Unitex=1,Pasx=1,Unitey=1,Pasy=1,Unitez=1,Pasz=1,DemiDroite=false,Droite=false,Plan=false,Trace=false,ListeSegment={},Espace=false,Sphere=false,AnglePhi=30,CouleurLa=white,CouleurLon=Tomato,AffichageNom=false,AffichageGrad=false,AffichageAbs=0,AffichageCoord=false,LectureCoord=false,ValeurUnitex=1,ValeurUnitey=1,ValeurOrigine=0,NomOrigine=O,EchelleEspace=50,CouleurCoord=black}
+% ValeurOrigine permet de faire des morceaux de demi-droite gradu\'ee en passant par droite :)
+
+\def\Updatetoksdroite#1/#2\nil{\addtotok\toklistepointdroite{#1,"#2",}}
+\def\Updatetoksrepere#1/#2/#3\nil{\addtotok\toklistepointrepere{#1,#2,"#3",}}
+\def\Updatetoksespace#1/#2/#3/#4\nil{\addtotok\toklistepointespace{#1,#2,#3,"#4",}}
+
+\newtoks\toklistepointrepere%
+\newtoks\toklistepointdroite%
+\newtoks\toklistepointespace%
+
+% Pour construire le rep\`ere de l'espace
+\def\buildespace{%
+  \toklistepointespace{}%
+  \ifboolKV[ClesReperage]{Sphere}{%
+    \foreachitem\compteur\in\ListePointEspace{\expandafter\Updatetoksrepere\compteur\nil}%
+    \[\MPEspaceSphere{\the\toklistepointrepere}{\useKV[ClesReperage]{EchelleEspace}}\]
+  }{%
+    \foreachitem\compteur\in\ListePointEspace{\expandafter\Updatetoksespace\compteur\nil}%
+    \ifboolKV[ClesReperage]{AffichageNom}{%
+      \ifboolKV[ClesReperage]{AffichageCoord}{%
+        \[\MPEspacePave{\useKV[ClesReperage]{Unitex}}{\useKV[ClesReperage]{Pasx}}{\useKV[ClesReperage]{Unitey}}{\useKV[ClesReperage]{Pasy}}{\useKV[ClesReperage]{Unitez}}{\useKV[ClesReperage]{Pasz}}{\the\toklistepointespace}{3}{\useKV[ClesReperage]{EchelleEspace}}\]%
+      }{%
+        \[\MPEspacePave{\useKV[ClesReperage]{Unitex}}{\useKV[ClesReperage]{Pasx}}{\useKV[ClesReperage]{Unitey}}{\useKV[ClesReperage]{Pasy}}{\useKV[ClesReperage]{Unitez}}{\useKV[ClesReperage]{Pasz}}{\the\toklistepointespace}{2}{\useKV[ClesReperage]{EchelleEspace}}\]%
+      }%
+    }{%
+      \ifboolKV[ClesReperage]{AffichageCoord}{%
+        \[\MPEspacePave{\useKV[ClesReperage]{Unitex}}{\useKV[ClesReperage]{Pasx}}{\useKV[ClesReperage]{Unitey}}{\useKV[ClesReperage]{Pasy}}{\useKV[ClesReperage]{Unitez}}{\useKV[ClesReperage]{Pasz}}{\the\toklistepointespace}{1}{\useKV[ClesReperage]{EchelleEspace}}\]%
+      }{%
+        \[\MPEspacePave{\useKV[ClesReperage]{Unitex}}{\useKV[ClesReperage]{Pasx}}{\useKV[ClesReperage]{Unitey}}{\useKV[ClesReperage]{Pasy}}{\useKV[ClesReperage]{Unitez}}{\useKV[ClesReperage]{Pasz}}{\the\toklistepointespace}{0}{\useKV[ClesReperage]{EchelleEspace}}\]%
+      }%
+    }%
+  }%
+}%
+
+\def\MPEspaceSphere#1#2{%
+  \ifluatex
+  \begin{mplibcode}
+    typetrace:="3D";
+    typerepre:="persp";
+    anglephi:=\useKV[ClesReperage]{AnglePhi};
+    Initialisation(1500,anglephi,10,#2);
+    color O,A,B,C,D,Z,M[];
+    O=(0,0,0);
+    A=(cosd(anglephi+90),sind(anglephi+90),0);
+    B=(cosd(anglephi+180),sind(anglephi+180),0);
+    C=(1,0,0);
+    D=(0,1,0);
+    Z=(0,0,1);
+    trace cercles(O,A,O,A,Z) withcolor 0.7white;
+    path Equateur;
+    Equateur=cercles(O,C,O,C,D);
+    trace (subpath((0.25+anglephi/360)*length Equateur,(0.75+anglephi/360)*length Equateur) of Equateur) dashed evenly withcolor 0.7white;
+    trace (subpath((0.75+anglephi/360)*length Equateur,(1.25+anglephi/360)*length Equateur) of Equateur) withcolor 0.7white;
+    path greenwich;
+    greenwich=cercles(O,C,O,C,Z);
+    trace subpath(3*length greenwich/4,5*length greenwich/4) of greenwich  withcolor 0.7white;
+    clip currentpicture to cercles(O,A,O,A,Z);
+    trace chemin(C,O,Z) dashed evenly withcolor 0.85white;
+    trace chemin(O,2[Z,O])  dashed evenly withcolor 0.85white;
+
+    vardef toto(text t)=
+    n:=1;
+    for p_=t:
+    if (n mod 3)=1:
+    k:=p_;
+    fi;
+    if (n mod 3)=2:
+    l:=p_;
+    fi;
+    if (n mod 3)=0:
+      M[n]=(cosd(k)*cosd(l),sind(k)*cosd(l),sind(l));
+      path Codageun,Codagedeux;
+      if k>0:
+        Codageun=cercles(O,1[O,C],O,1[O,C],D) cutafter chemin(O,(cosd(k),sind(k),0));
+      else:
+        Codageun=cercles(O,1[O,C],O,1[O,C],D) cutbefore chemin(O,(cosd(k),sind(k),0));
+      fi;
+      if l>0:
+        Codagedeux=cercles(O,(cosd(k),sind(k),0),O,(cosd(k),sind(k),0),Z) cutafter chemin(O,M[n]);
+      else:
+        Codagedeux=cercles(O,(cosd(k),sind(k),0),O,(cosd(k),sind(k),0),Z) cutbefore chemin(O,M[n]);
+      fi;
+    %%%% if l>0:
+    %%%fill Projette(O)--Projette((cosd(k),sind(k),0))--Codagedeux--cycle withcolor \useKV[ClesReperage]{CouleurLa};
+    %%%fill Projette(O)--Projette(C)--Codageun--cycle withcolor \useKV[ClesReperage]{CouleurLon};
+    %%%else:
+    %%%fill Projette(O)--Codagedeux--Projette((cosd(k),sind(k),0))--cycle withcolor \useKV[ClesReperage]{CouleurLa};
+    %%%fill Projette(O)--Codageun--Projette(C)--cycle withcolor \useKV[ClesReperage]{CouleurLon};
+    %%%fi;
+      trace Codageun;
+      trace Codagedeux;
+      if \useKV[ClesReperage]{AffichageCoord}:
+        picture CodageUn,CodageDeux;
+        CodageUn=image(
+          if k>0:
+            label.bot(TEX("\scriptsize\ang{"&decimal(k)&"} E"),(0,0));
+          else:
+            label.bot(TEX("\scriptsize\ang{"&decimal(abs(k))&"} O"),(0,0));
+          fi;
+        );
+        CodageDeux=image(
+        if k>0:
+          label.rt(TEX("\scriptsize\ang{"&decimal(l)&"} N"),(0,0));
+        else:
+          label.lft(TEX("\scriptsize\ang{"&decimal(abs(l))&"} S"),(0,0));
+        fi;
+        );
+        fill (polygone(llcorner CodageUn,lrcorner CodageUn,urcorner CodageUn,ulcorner CodageUn) shifted(point(0.5*length Codageun) of Codageun)) withcolor blanc;
+        trace CodageUn shifted (point(0.5*length Codageun) of Codageun);
+        fill (polygone(llcorner CodageDeux,lrcorner CodageDeux,urcorner CodageDeux,ulcorner CodageDeux) shifted(point(0.5*length Codagedeux) of Codagedeux)) withcolor blanc;
+        trace CodageDeux shifted (point(0.5*length Codagedeux) of Codagedeux);
+      fi;
+    trace chemin(O,(cosd(k),sind(k),0)) dashed withdots scaled 0.5;
+    trace chemin(O,M[n]) dashed withdots scaled 0.5;
+    trace chemin(O,C) dashed withdots scaled 0.5;
+    if \useKV[ClesReperage]{AffichageNom}:
+    if l>0:dotlabel.top(p_,Projette(M[n]));
+    else:
+    dotlabel.bot(p_,Projette(M[n]));
+    fi;
+    fi;
+    fi;
+    n:=n+1;
+    endfor;
+    enddef;
+    toto(#1);
+    label.llft(btex \tiny \ang{0} etex,Projette(C));
+  \end{mplibcode}
+  \else
+  \begin{mpost}[mpsettings={boolean AffichageCoord; AffichageCoord=\useKV[ClesReperage]{AffichageCoord}; boolean AffichageNom; AffichageNom=\useKV[ClesReperage]{AffichageNom};anglephi:=\useKV[ClesReperage]{AnglePhi};}]
+    typetrace:="3D";
+    typerepre:="persp";
+    Initialisation(1500,anglephi,10,#2);
+    color O,A,B,C,D,Z,M[];
+    O=(0,0,0);
+    A=(cosd(anglephi+90),sind(anglephi+90),0);
+    B=(cosd(anglephi+180),sind(anglephi+180),0);
+    C=(1,0,0);
+    D=(0,1,0);
+    Z=(0,0,1);
+    trace cercles(O,A,O,A,Z) withcolor 0.7white;
+    path Equateur;
+    Equateur=cercles(O,C,O,C,D);
+    trace (subpath((0.25+anglephi/360)*length Equateur,(0.75+anglephi/360)*length Equateur) of Equateur) dashed evenly withcolor 0.7white;
+    trace (subpath((0.75+anglephi/360)*length Equateur,(1.25+anglephi/360)*length Equateur) of Equateur) withcolor 0.7white;
+    path greenwich;
+    greenwich=cercles(O,C,O,C,Z);
+    trace subpath(3*length greenwich/4,5*length greenwich/4) of greenwich  withcolor 0.7white;
+    clip currentpicture to cercles(O,A,O,A,Z);
+    trace chemin(C,O,Z) dashed evenly withcolor 0.85white;
+    trace chemin(O,2[Z,O])  dashed evenly withcolor 0.85white;
+
+    vardef toto(text t)=
+    n:=1;
+    for p_=t:
+     if (n mod 3)=1:
+     k:=p_;
+    fi;
+    if (n mod 3)=2:
+    l:=p_;
+    fi;
+    if (n mod 3)=0:
+    M[n]=(cosd(k)*cosd(l),sind(k)*cosd(l),sind(l));
+    path Codageun,Codagedeux;
+    if k>0:
+    Codageun=cercles(O,1[O,C],O,1[O,C],D) cutafter chemin(O,(cosd(k),sind(k),0));
     else:
-    if (l mod 2)=1:
-    draw appelation(A[(l-1) div 2],A[l],4mm,LATEX(p_));
+    Codageun=cercles(O,1[O,C],O,1[O,C],D) cutbefore chemin(O,(cosd(k),sind(k),0));
+    fi;
+    if l>0:
+    Codagedeux=cercles(O,(cosd(k),sind(k),0),O,(cosd(k),sind(k),0),Z) cutafter chemin(O,M[n]);
     else:
-    draw appelation(A[(l-1) div 2],A[l],-4mm,LATEX(p_));
+    Codagedeux=cercles(O,(cosd(k),sind(k),0),O,(cosd(k),sind(k),0),Z) cutbefore chemin(O,M[n]);
+    fi;
+    %if l>0:
+    %fill Projette(O)--Projette((cosd(k),sind(k),0))--Codagedeux--cycle withcolor \useKV[ClesReperage]{CouleurLa};
+    %fill Projette(O)--Projette(C)--Codageun--cycle withcolor \useKV[ClesReperage]{CouleurLon};
+    %else:
+    %fill Projette(O)--Codagedeux--Projette((cosd(k),sind(k),0))--cycle withcolor \useKV[ClesReperage]{CouleurLa};
+    %fill Projette(O)--Codageun--Projette(C)--cycle withcolor \useKV[ClesReperage]{CouleurLon};
+    %fi;
+    trace Codageun;
+    trace Codagedeux;
+    if AffichageCoord:
+    picture CodageUn,CodageDeux;
+    CodageUn=image(
+    if k>0:
+    label.bot(LATEX("\noexpand\scriptsize\ang{"&decimal(k)&"} E"),(0,0));
+    else:
+    label.bot(LATEX("\noexpand\scriptsize\ang{"&decimal(abs(k))&"} O"),(0,0));
+    fi;
+    );
+    CodageDeux=image(
+    if k>0:
+    label.rt(LATEX("\noexpand\scriptsize\ang{"&decimal(l)&"} N"),(0,0));
+    else:
+    label.lft(LATEX("\noexpand\scriptsize\ang{"&decimal(abs(l))&"} S"),(0,0));
+    fi;
+    );
+    fill (polygone(llcorner CodageUn,lrcorner CodageUn,urcorner CodageUn,ulcorner CodageUn) shifted(point(0.5*length Codageun) of Codageun)) withcolor blanc;
+    trace CodageUn shifted (point(0.5*length Codageun) of Codageun);
+    fill (polygone(llcorner CodageDeux,lrcorner CodageDeux,urcorner CodageDeux,ulcorner CodageDeux) shifted(point(0.5*length Codagedeux) of Codagedeux)) withcolor blanc;
+    trace CodageDeux shifted (point(0.5*length Codagedeux) of Codagedeux);
+    fi;
+    trace chemin(O,(cosd(k),sind(k),0)) dashed withdots scaled 0.5;
+    trace chemin(O,M[n]) dashed withdots scaled 0.5;
+    trace chemin(O,C) dashed withdots scaled 0.5;
+    if AffichageNom:
+    if l>0:dotlabel.top(p_,Projette(M[n]));
+    else:
+    dotlabel.bot(p_,Projette(M[n]));
+    fi;
     fi;
-    l:=l+1;
     fi;
     n:=n+1;
     endfor;
     enddef;
-    toto(#3);
+    toto(#1);
+    label.llft(btex \noexpand\tiny \ang{0} etex,Projette(C));
   \end{mpost}
   \fi
 }
 
-\newcommand\Proba[2][]{%
-  \useKVdefault[ClesProba]%
-  \setKV[ClesProba]{#1}%
-  % On liste les diff\'erents \'el\'ements sous la forme Ev\`enement/proba
-  \setsepchar[*]{,*/}\ignoreemptyitems%
-  \readlist*\ListeProba{#2}
-  \ifboolKV[ClesProba]{Echelle}{%
-    \buildechelleproba%
-  }{\ifboolKV[ClesProba]{Arbre}{%
-      \buildarbreproba%
-    }{}
-  }
-}
-
-%%%
-% Reperage
-%%%
-\setKVdefault[ClesReperage]{Unitex=1,Pasx=1,Unitey=1,Pasy=1,Unitez=1,Pasz=1,DemiDroite=false,Droite=false,Plan=false,Trace=false,ListeSegment={},Espace=false,Sphere=false,AffichageNom=false,AffichageGrad=false,AffichageAbs=0,AffichageCoord=false,LectureCoord=false,ValeurUnitex=1,ValeurUnitey=1,ValeurOrigine=0,NomOrigine=O,EchelleEspace=50,CouleurCoord=black}
-% ValeurOrigine permet de faire des morceaux de demi-droite gradu\'ee en passant par droite :)
-
-\def\Updatetoksdroite#1/#2\nil{\addtotok\toklistepointdroite{#1,"#2",}}
-\def\Updatetoksrepere#1/#2/#3\nil{\addtotok\toklistepointrepere{#1,#2,"#3",}}
-\def\Updatetoksespace#1/#2/#3/#4\nil{\addtotok\toklistepointespace{#1,#2,#3,"#4",}}
-
-\newtoks\toklistepointrepere%
-\newtoks\toklistepointdroite%
-\newtoks\toklistepointespace%
-
-% Pour construire le rep\`ere de l'espace
-\def\buildespace{%
-  \toklistepointespace{}%
-  \ifboolKV[ClesReperage]{Sphere}{%
-    \foreachitem\compteur\in\ListePointEspace{\expandafter\Updatetoksrepere\compteur\nil}%
-  }{%
-    \foreachitem\compteur\in\ListePointEspace{\expandafter\Updatetoksespace\compteur\nil}%
-  }
-  \ifboolKV[ClesReperage]{AffichageNom}{%
-    \ifboolKV[ClesReperage]{AffichageCoord}{%
-      \[\MPEspacePave{\useKV[ClesReperage]{Unitex}}{\useKV[ClesReperage]{Pasx}}{\useKV[ClesReperage]{Unitey}}{\useKV[ClesReperage]{Pasy}}{\useKV[ClesReperage]{Unitez}}{\useKV[ClesReperage]{Pasz}}{\the\toklistepointespace}{3}{\useKV[ClesReperage]{EchelleEspace}}\]%
-    }{%
-      \[\MPEspacePave{\useKV[ClesReperage]{Unitex}}{\useKV[ClesReperage]{Pasx}}{\useKV[ClesReperage]{Unitey}}{\useKV[ClesReperage]{Pasy}}{\useKV[ClesReperage]{Unitez}}{\useKV[ClesReperage]{Pasz}}{\the\toklistepointespace}{2}{\useKV[ClesReperage]{EchelleEspace}}\]%
-    }
-  }{%
-    \ifboolKV[ClesReperage]{AffichageCoord}{%
-      \[\MPEspacePave{\useKV[ClesReperage]{Unitex}}{\useKV[ClesReperage]{Pasx}}{\useKV[ClesReperage]{Unitey}}{\useKV[ClesReperage]{Pasy}}{\useKV[ClesReperage]{Unitez}}{\useKV[ClesReperage]{Pasz}}{\the\toklistepointespace}{1}{\useKV[ClesReperage]{EchelleEspace}}\]%
-    }{%
-      \[\MPEspacePave{\useKV[ClesReperage]{Unitex}}{\useKV[ClesReperage]{Pasx}}{\useKV[ClesReperage]{Unitey}}{\useKV[ClesReperage]{Pasy}}{\useKV[ClesReperage]{Unitez}}{\useKV[ClesReperage]{Pasz}}{\the\toklistepointespace}{0}{\useKV[ClesReperage]{EchelleEspace}}\]%
-    }
-  }%
-}%
-
 \def\MPEspacePave#1#2#3#4#5#6#7#8#9{%
   \ifluatex
   \begin{mplibcode}
@@ -12938,7 +14931,20 @@ Unite={},Largeur=1cm,Precision=2,Donnee=Valeurs,Effectif=Effectif,Grille=false,O
     fi;
     endfor;
     fi;
-    if #7=2:
+    if #7=3:
+    for p_=t:
+    if numeric p_:
+    k:=p_;
+    fi;
+    if string p_:
+    if p_<>"":
+    drawarrow (unitp*(k,-1))--(unitp*(k,-0.3));
+    label.bot(btex \hbox to2em{\dotfill} etex,(unitp*(k,-1)));
+    pointe(unitp*(k-#6,0));
+    fi;
+    fi;
+    endfor;
+    elseif #7=2:
     for p_=t:
     if numeric p_:
     k:=p_;
@@ -13031,7 +15037,20 @@ Unite={},Largeur=1cm,Precision=2,Donnee=Valeurs,Effectif=Effectif,Grille=false,O
     fi;
     endfor;
     fi;
-    if #7=2:
+    if #7=3:
+    for p_=t:
+    if numeric p_:
+    k:=p_;
+    fi;
+    if string p_:
+    if p_<>"":
+    drawarrow (unitp*(k,-1))--(unitp*(k,-0.3));
+    label.bot(btex \hbox to2em{\dotfill} etex,(unitp*(k,-1)));
+    pointe(unitp*(k-#6,0));
+    fi;
+    fi;
+    endfor;
+    elseif #7=2:
     for p_=t:
     if numeric p_:
     k:=p_;
@@ -13355,6 +15374,7 @@ Unite={},Largeur=1cm,Precision=2,Donnee=Valeurs,Effectif=Effectif,Grille=false,O
   \setKV[ClesReperage]{#1}%
   \ifboolKV[ClesReperage]{Espace}{%
     \setKV[ClesReperage]{Unitex=2,Unitey=2.5,Unitez=1.5}%
+    \ifboolKV[ClesReperage]{Sphere}{\setKV[ClesReperage]{EchelleEspace=75}}{}%
     \setKV[ClesReperage]{#1}%
     \setsepchar[*]{,*/}\ignoreemptyitems%
     \readlist*\ListePointEspace{#2}%
@@ -13460,8 +15480,8 @@ Unite={},Largeur=1cm,Precision=2,Donnee=Valeurs,Effectif=Effectif,Grille=false,O
   \SI{#2}{\kWh}%
 }
 
-\newcommand\Prix[2][]{%
-  \SI[round-mode=places,round-precision=2]{#2}{\EuRo}%
+\newcommand\Prix[2][2]{%
+  \SI[round-mode=places,round-precision=#1]{#2}{\EuRo}%
 }
 
 \newcommand\Octet[2][]{%
@@ -14347,53 +16367,83 @@ Unite={},Largeur=1cm,Precision=2,Donnee=Valeurs,Effectif=Effectif,Grille=false,O
   colbacktitle=TrameCouleur,
 }
 
-\usetikzlibrary{backgrounds}
-
-\makeatletter
-%https://tex.stackexchange.com/questions/347434/clip-background-image-inside-tcolorbox
-\newtcolorbox{MyboxSimpleAv}[1]{%
+\newtcolorbox{MyboxJQ}[2]{%
   enhanced,
   nobeforeafter,
-  left=0pt,right=0pt,top=\hauteurtitre,bottom=0pt,
+  left=0pt,right=0pt,top=0pt,
   text fill,
   width=\largeurcarte,
   height=\hauteurcarte,
   arc=5pt,
+  overlay unbroken and first={%
+    \coordinate[yshift=-0.5\hauteurtitre] (A1) at (frame.north west);
+    \coordinate[yshift=0\hauteurtitre] (S3) at (frame.center);
+    \coordinate[yshift=3mm] (C3) at (frame.south);
+    \coordinate[xshift=\largeurcarte/2] (A3) at (A1);
+    \node[rounded corners, draw=black, rectangle,minimum height=1cm,text width=\largeurcarte-6mm,fill=TrameCouleur] (T1) at (A3){};
+    \node[TexteCouleur] (T1a) at (T1){\Large J'ai};
+    \node[rounded corners, draw=black, rectangle,minimum height=1cm,text width=\largeurcarte-6mm,fill=TrameCouleur] (T2) at (S3){};
+    \node[TexteCouleur] (T2a) at (T2){\Large Qui a ?};
+    \node[minimum height=1cm,text width=\largeurcarte-6mm] (PointTexte1) at ($(A3)!0.5!(S3)$) {\begin{minipage}{\largeurcarte-6mm}%
+        \begin{center}%
+          #1%
+        \end{center}%
+      \end{minipage}};
+    \node[minimum height=1cm,text width=\largeurcarte-6mm] (PointTexte2) at ($(C3)!0.5!(S3)$) {\begin{minipage}{\largeurcarte-6mm}%
+        \begin{center}%
+          #2%
+        \end{center}%
+      \end{minipage}};
+  },
   colback=white,
+}
+
+\usetikzlibrary{backgrounds}
+
+\makeatletter
+%https://tex.stackexchange.com/questions/347434/clip-background-image-inside-tcolorbox
+\newtcolorbox{MyboxSimpleAv}[1]{%
+  enhanced,%
+  nobeforeafter,%
+  left=0pt,right=0pt,top=\hauteurtitre,bottom=0pt,%
+  text fill,%
+  width=\largeurcarte,%
+  height=\hauteurcarte,%
+  arc=5pt,%
+  colback=white,%
   underlay={%
     \ifboolKV[Cards]{BackgroundAv}{%
-    \begin{tcbclipinterior}
-      \node[anchor=center,opacity=1]
-      at (interior.center) {%
-        \includegraphics[%
-        height=\tcb@height,
-        width=\tcb@width,
-        ]{\useKV[Cards]{ImageAv}}};
-    \end{tcbclipinterior},
-  }{}
-  },
+      \begin{tcbclipinterior}
+        \node[anchor=center,opacity=1]
+        at (interior.center) {%
+          \includegraphics[%
+          height=\tcb@height,
+          width=\tcb@width,
+          ]{\useKV[Cards]{ImageAv}}};%
+      \end{tcbclipinterior},%
+    }{}%
+  },%
   overlay unbroken and first={%
-    \coordinate[yshift=-0.5\hauteurtitre] (A) at (frame.north);
-    \node[rounded corners, draw=black, rectangle,minimum height=1cm,text width=\largeurcarte-6mm,fill=TrameCouleur] (T1) at
-    (A){\begin{minipage}{\largeurcarte-6mm}
-        \begin{center}
-          #1
-        \end{center}
-      \end{minipage}};
-    \node[yshift=-0.5em-0.5\hauteurtitre] (B) at (A){};
-    \ifboolKV[Cards]{Titre}{\node[fill=white] at (B) {\useKV[Cards]{NomTitre}};}{},
-  }
-}
+    \coordinate[yshift=-0.5\hauteurtitre] (A) at (frame.north);%
+    \node[rounded corners, draw=black, rectangle,minimum height=1cm,text width=\largeurcarte-6mm,fill=TrameCouleur] (T1) at (A){\begin{minipage}{\largeurcarte-6mm}%
+        \begin{center}%
+          #1%
+        \end{center}%
+      \end{minipage}};%
+    \node[yshift=-0.5em-0.5\hauteurtitre] (B) at (A){};%
+    \ifboolKV[Cards]{Titre}{\node[fill=white] at (B) {\useKV[Cards]{NomTitre}};}{},%
+  }%
+}%
 
 \newtcolorbox{MyboxSimpleAr}[1]{%
-  enhanced,
-  nobeforeafter,
-  left=0pt,right=0pt,top=\hauteurtitre,bottom=0pt,
-  text fill,
-  width=\largeurcarte,
-  height=\hauteurcarte,
-  arc=5pt,
-  colback=white,
+  enhanced,%
+  nobeforeafter,%
+  left=0pt,right=0pt,top=\hauteurtitre,bottom=0pt,%
+  text fill,%
+  width=\largeurcarte,%
+  height=\hauteurcarte,%
+  arc=5pt,%
+  colback=white,%
   underlay={%
     \ifboolKV[Cards]{BackgroundAr}{%
     \begin{tcbclipinterior}
@@ -14403,79 +16453,78 @@ Unite={},Largeur=1cm,Precision=2,Donnee=Valeurs,Effectif=Effectif,Grille=false,O
         height=\tcb@height,
         width=\tcb@width,
         ]{\useKV[Cards]{ImageAr}}};
-    \end{tcbclipinterior},
+    \end{tcbclipinterior},%
   }{}
-  },
+  },%
   overlay unbroken and first={%
-    \coordinate[yshift=-0.5\hauteurtitre] (A) at (frame.north);
-    \node[rounded corners, draw=black, rectangle,minimum height=1cm,text width=\largeurcarte-6mm,fill=TrameCouleur] (T1) at
-    (A){\begin{minipage}{\largeurcarte-6mm}
-        \begin{center}
-          #1
-        \end{center}
-      \end{minipage}};
-    %\node[yshift=-1em] (B) at (A){};
-    %\ifboolKV[Cards]{Titre}{\node[fill=white] at (B) {\useKV[Cards]{NomTitre}};}{},
-  }
-}
+    \coordinate[yshift=-0.5\hauteurtitre] (A) at (frame.north);%
+    \node[rounded corners, draw=black, rectangle,minimum height=1cm,text width=\largeurcarte-6mm,fill=TrameCouleur] (T1) at (A){\begin{minipage}{\largeurcarte-6mm}%
+        \begin{center}%
+          #1%
+        \end{center}%
+      \end{minipage}};%
+    % \node[yshift=-1em] (B) at (A){};
+    % \ifboolKV[Cards]{Titre}{\node[fill=white] at (B) {\useKV[Cards]{NomTitre}};}{},
+  }%
+}%
 \makeatother
 
-\newlength{\largeurcards}
-\newlength{\hauteurcards}
-\newlength{\largeurcarte}
-\newlength{\hauteurcarte}
-\newlength{\hauteurtitre}
-\newlength{\largeurtitre}
+\newlength{\largeurcards}%
+\newlength{\hauteurcards}%
+\newlength{\largeurcarte}%
+\newlength{\hauteurcarte}%
+\newlength{\hauteurtitre}%
+\newlength{\largeurtitre}%
 
-\newlength{\margeh}
-\newlength{\margev}
+\newlength{\margeh}%
+\newlength{\margev}%
 
 \NewEnviron{Trame}{%
   \begin{tikzpicture}[remember picture,overlay]
     % quadrillages horizontal et vertical
-    \coordinate[yshift=-\margev] (A) at (current page.north west);
-    \coordinate[yshift=-\margev] (B) at (current page.north east);
-    \coordinate[yshift=-\hauteurcards] (A1) at (A);
-    \coordinate[yshift=-\hauteurcards] (B1) at (B);
-    \coordinate[yshift=-\hauteurcards] (A2) at (A1);
-    \coordinate[yshift=-\hauteurcards] (B2) at (B1);
-    \coordinate[yshift=-\hauteurcards] (A3) at (A2);
-    \coordinate[yshift=-\hauteurcards] (B3) at (B2);
-    \coordinate[yshift=-\hauteurcards] (A4) at (A3);
-    \coordinate[yshift=-\hauteurcards] (B4) at (B3);
-    \coordinate[xshift=\margeh] (C) at (current page.north west);
-    \coordinate[xshift=\margeh] (D) at (current page.south west);
-    \coordinate[xshift=\largeurcards] (C1) at (C);
-    \coordinate[xshift=\largeurcards] (D1) at (D);
-    \coordinate[xshift=\largeurcards] (C2) at (C1);
-    \coordinate[xshift=\largeurcards] (D2) at (D1);
-    \coordinate[xshift=\largeurcards] (C3) at (C2);
-    \coordinate[xshift=\largeurcards] (D3) at (D2);
-    \draw (A) -- (B);
-    \draw (A1) -- (B1);
-    \draw (A2) -- (B2);
-    \draw (A3) -- (B3);
-    \draw (A4) -- (B4);
-    \draw (C)--(D);
-    \draw (C1)--(D1);
-    \draw (C2)--(D2);
-    \draw (C3)--(D3);
+    \coordinate[yshift=-\margev] (A) at (current page.north west);%
+    \coordinate[yshift=-\margev] (B) at (current page.north east);%
+    \coordinate[yshift=-\hauteurcards] (A1) at (A);%
+    \coordinate[yshift=-\hauteurcards] (B1) at (B);%
+    \coordinate[yshift=-\hauteurcards] (A2) at (A1);%
+    \coordinate[yshift=-\hauteurcards] (B2) at (B1);%
+    \coordinate[yshift=-\hauteurcards] (A3) at (A2);%
+    \coordinate[yshift=-\hauteurcards] (B3) at (B2);%
+    \coordinate[yshift=-\hauteurcards] (A4) at (A3);%
+    \coordinate[yshift=-\hauteurcards] (B4) at (B3);%
+    \coordinate[xshift=\margeh] (C) at (current page.north west);%
+    \coordinate[xshift=\margeh] (D) at (current page.south west);%
+    \coordinate[xshift=\largeurcards] (C1) at (C);%
+    \coordinate[xshift=\largeurcards] (D1) at (D);%
+    \coordinate[xshift=\largeurcards] (C2) at (C1);%
+    \coordinate[xshift=\largeurcards] (D2) at (D1);%
+    \coordinate[xshift=\largeurcards] (C3) at (C2);%
+    \coordinate[xshift=\largeurcards] (D3) at (D2);%
+    \draw (A) -- (B);%
+    \draw (A1) -- (B1);%
+    \draw (A2) -- (B2);%
+    \draw (A3) -- (B3);%
+    \draw (A4) -- (B4);%
+    \draw (C)--(D);%
+    \draw (C1)--(D1);%
+    \draw (C2)--(D2);%
+    \draw (C3)--(D3);%
     % point pour placer les cartes
-    \coordinate[xshift=\margeh+0.5\largeurcards,yshift=-0.5\hauteurcards] (Carte1) at (A);
-    \coordinate[xshift=\largeurcards,yshift=0mm] (Carte2) at (Carte1);
-    \coordinate[xshift=2\largeurcards,yshift=0mm] (Carte3) at (Carte1);
-    \coordinate[xshift=0mm,yshift=-\hauteurcards] (Carte4) at (Carte1);
-    \coordinate[xshift=0mm,yshift=-\hauteurcards] (Carte5) at (Carte2);
-    \coordinate[xshift=0mm,yshift=-\hauteurcards] (Carte6) at (Carte3);
-    \coordinate[xshift=0mm,yshift=-\hauteurcards] (Carte7) at (Carte4);
-    \coordinate[xshift=0mm,yshift=-\hauteurcards] (Carte8) at (Carte5);
-    \coordinate[xshift=0mm,yshift=-\hauteurcards] (Carte9) at (Carte6);
-    \BODY
-  \end{tikzpicture}
-}
+    \coordinate[xshift=\margeh+0.5\largeurcards,yshift=-0.5\hauteurcards] (Carte1) at (A);%
+    \coordinate[xshift=\largeurcards,yshift=0mm] (Carte2) at (Carte1);%
+    \coordinate[xshift=2\largeurcards,yshift=0mm] (Carte3) at (Carte1);%
+    \coordinate[xshift=0mm,yshift=-\hauteurcards] (Carte4) at (Carte1);%
+    \coordinate[xshift=0mm,yshift=-\hauteurcards] (Carte5) at (Carte2);%
+    \coordinate[xshift=0mm,yshift=-\hauteurcards] (Carte6) at (Carte3);%
+    \coordinate[xshift=0mm,yshift=-\hauteurcards] (Carte7) at (Carte4);%
+    \coordinate[xshift=0mm,yshift=-\hauteurcards] (Carte8) at (Carte5);%
+    \coordinate[xshift=0mm,yshift=-\hauteurcards] (Carte9) at (Carte6);%
+    \BODY%
+  \end{tikzpicture}%
+}%
 
 \setKVdefault[Cards]{Largeur=59,Hauteur=89,HauteurTheme=15,Marge=4,Landscape=false,Couleur=Cornsilk,Theme=Th\'eor\`eme\\de
-  Pythagore,ThemeSol=Solution,Trame=false,Titre=false,NomTitre=Jeu 1,Loop,BackgroundAv=false,BackgroundAr=false,ImageAv=4813762.jpg,ImageAr=4813762.jpg,AffichageSolution=true}
+  Pythagore,ThemeSol=Solution,Trame=false,Titre=false,NomTitre=Jeu 1,Loop,JaiQuia=false,BackgroundAv=false,BackgroundAr=false,ImageAv=4813762.jpg,ImageAr=4813762.jpg,AffichageSolution=true}%
 
 \newcommand\Cartes[2][]{%
   \useKVdefault[Cards]%
@@ -14489,88 +16538,111 @@ Unite={},Largeur=1cm,Precision=2,Donnee=Valeurs,Effectif=Effectif,Grille=false,O
     \setlength{\hauteurcards}{65mm}%
     \setlength{\margeh}{(297mm-3\largeurcards)/2}%
     \setlength{\margev}{(210mm-3\hauteurcards)/2}%
-  }{
+  }{%
     \setlength{\hauteurcarte}{\fpeval{\useKV[Cards]{Hauteur}-\useKV[Cards]{Marge}}mm}%
     \setlength{\largeurcarte}{\fpeval{\useKV[Cards]{Largeur}-\useKV[Cards]{Marge}}mm}%
-    \setlength{\largeurcards}{65mm}
-    \setlength{\hauteurcards}{95mm}
-    \setlength{\margeh}{(210mm-3\largeurcards)/2}
-    \setlength{\margev}{(297mm-3\hauteurcards)/2}
-  }
+    \setlength{\largeurcards}{65mm}%
+    \setlength{\hauteurcards}{95mm}%
+    \setlength{\margeh}{(210mm-3\largeurcards)/2}%
+    \setlength{\margev}{(297mm-3\hauteurcards)/2}%
+  }%
   \setlength{\hauteurtitre}{\fpeval{\useKV[Cards]{HauteurTheme}}mm}%
   \setlength{\largeurtitre}{\fpeval{(\useKV[Cards]{Largeur}-\useKV[Cards]{Marge}-9)/2}mm}%
-  \colorlet{TexteCouleur}{black}
-  \colorlet{TrameCouleur}{\useKV[Cards]{Couleur}}
-  \ifboolKV[Cards]{Loop}{%
+  \colorlet{TexteCouleur}{black}%
+  \colorlet{TrameCouleur}{\useKV[Cards]{Couleur}}%
+  \ifboolKV[Cards]{JaiQuia}{%
     \ifboolKV[Cards]{Trame}{%
       \clearpage%
       \thispagestyle{empty}%
       \begin{Trame}
         \multido{\i=1+1}{9}{%
           \node at (Carte\i) {%
-            \begin{Mybox}{\ListeCards[\i,1]}{\useKV[Cards]{Theme}}{\ListeCards[\i,2]}%
-              \ListeCards[\i,3]%
-            \end{Mybox}%
+            \begin{MyboxJQ}{\ListeCards[\i,1]}{\ListeCards[\i,2]}%
+              %%
+            \end{MyboxJQ}%
           };%
         }%
       \end{Trame}%
       \clearpage%
     }{%
-      \begin{Mybox}{\ListeCards[1,1]}{\useKV[Cards]{Theme}}{\ListeCards[1,2]}%
-        \ListeCards[1,3]%
-      \end{Mybox}%
+      \begin{MyboxJQ}{\ListeCards[1,1]}{\ListeCards[1,2]}%
+        %% 
+      \end{MyboxJQ}%
     }%
   }{%
-    \ifboolKV[Cards]{Trame}{%
-      \clearpage%
-      \thispagestyle{empty}%
-      \begin{Trame}
-        \multido{\i=1+1}{9}{%
-          \node[] at (Carte\i) {%
-            \begin{MyboxSimpleAv}{\useKV[Cards]{Theme}}%
-              \ListeCards[\i,1]%
-            \end{MyboxSimpleAv}%
-          };%
-        }%
-      \end{Trame}%
-      \clearpage%
-      \thispagestyle{empty}%
-      \begin{Trame}
-        \multido{\i=1+1}{3}{%
-          \node at (Carte\i) {%
-            \begin{MyboxSimpleAr}{\useKV[Cards]{ThemeSol}}%
-              \ListeCards[\fpeval{4-\i},2]%
-            \end{MyboxSimpleAr}%
-          };%
-        }%
-        \multido{\i=4+1}{3}{%
-          \node at (Carte\i) {%
-            \begin{MyboxSimpleAr}{\useKV[Cards]{ThemeSol}}%
-              \ListeCards[\fpeval{10-\i},2]%
-            \end{MyboxSimpleAr}%
-          };%
-        }%
-        \multido{\i=7+1}{3}{%
-          \node at (Carte\i) {%
-            \begin{MyboxSimpleAr}{\useKV[Cards]{ThemeSol}}%
-              \ListeCards[\fpeval{16-\i},2]%
-            \end{MyboxSimpleAr}%
-          };%
-        }%
-      \end{Trame}%
-      \clearpage%
+    \ifboolKV[Cards]{Loop}{%
+      \ifboolKV[Cards]{Trame}{%
+        \clearpage%
+        \thispagestyle{empty}%
+        \begin{Trame}
+          \multido{\i=1+1}{9}{%
+            \node at (Carte\i) {%
+              \begin{Mybox}{\ListeCards[\i,1]}{\useKV[Cards]{Theme}}{\ListeCards[\i,2]}%
+                \ListeCards[\i,3]%
+              \end{Mybox}%
+            };%
+          }%
+        \end{Trame}%
+        \clearpage%
+      }{%
+        \begin{Mybox}{\ListeCards[1,1]}{\useKV[Cards]{Theme}}{\ListeCards[1,2]}%
+          \ListeCards[1,3]%
+        \end{Mybox}%
+      }%
     }{%
-      \begin{MyboxSimpleAv}{\useKV[Cards]{Theme}}%
-        \ListeCards[1,1]%
-      \end{MyboxSimpleAv}
-      \ifboolKV[Cards]{AffichageSolution}{%
-      \begin{MyboxSimpleAr}{\useKV[Cards]{ThemeSol}}%
-        \ListeCards[1,2]%
-      \end{MyboxSimpleAr}
-      }{}%
+      \ifboolKV[Cards]{Trame}{%
+        \clearpage%
+        \thispagestyle{empty}%
+        \begin{Trame}
+          \multido{\i=1+1}{9}{%
+            \node[] at (Carte\i) {%
+              \begin{MyboxSimpleAv}{\useKV[Cards]{Theme}}%
+                \ListeCards[\i,1]%
+              \end{MyboxSimpleAv}%
+            };%
+          }%
+        \end{Trame}%
+        \ifboolKV[Cards]{AffichageSolution}{%
+          \clearpage%
+          \thispagestyle{empty}%
+          \begin{Trame}
+            \multido{\i=1+1}{3}{%
+              \node at (Carte\i) {%
+                \begin{MyboxSimpleAr}{\useKV[Cards]{ThemeSol}}%
+                  \ListeCards[\fpeval{4-\i},2]%
+                \end{MyboxSimpleAr}%
+              };%
+            }%
+            \multido{\i=4+1}{3}{%
+              \node at (Carte\i) {%
+                \begin{MyboxSimpleAr}{\useKV[Cards]{ThemeSol}}%
+                  \ListeCards[\fpeval{10-\i},2]%
+                \end{MyboxSimpleAr}%
+              };%
+            }%
+            \multido{\i=7+1}{3}{%
+              \node at (Carte\i) {%
+                \begin{MyboxSimpleAr}{\useKV[Cards]{ThemeSol}}%
+                  \ListeCards[\fpeval{16-\i},2]%
+                \end{MyboxSimpleAr}%
+              };%
+            }%
+          \end{Trame}%
+          \clearpage%
+        }{}%
+      }{%
+        \begin{MyboxSimpleAv}{\useKV[Cards]{Theme}}%
+          \ListeCards[1,1]%
+        \end{MyboxSimpleAv}%
+        \ifboolKV[Cards]{AffichageSolution}{%
+          \begin{MyboxSimpleAr}{\useKV[Cards]{ThemeSol}}%
+            \ListeCards[1,2]%
+          \end{MyboxSimpleAr}%
+        }{}%
+      }%
     }%
   }%
-}
+}%
 
 \newcommand\SolutionCarte[2]{%
   \begin{center}
@@ -14769,76 +16841,201 @@ Unite={},Largeur=1cm,Precision=2,Donnee=Valeurs,Effectif=Effectif,Grille=false,O
 %%%%
 % Prog de calculs "simples"
 %%%%
-\setKVdefault[ClesProg]{Ecart=2em,SansCalcul=false,Direct=true}
+\setKVdefault[ClesProg]{%
+  Ecart=2em,%
+  Direct,%
+  SansCalcul=false,%
+  Application=false,
+  Details=false,
+  Enonce=false,
+  Nom={},
+  CouleurCadre=black,%
+  CouleurFond=gray!10,%
+  Largeur={.95\linewidth},%
+  Epaisseur=.75pt,%
+  Pointilles=0,
+  ThemePerso=false,
+}
 
-\newcounter{nbprog}
-\setcounter{nbprog}{0}%
+\newcounter{NBprog}%
+\setcounter{NBprog}{0}%
+
+\newlength{\PointillesClesProg}%
 
 \newcommand\ProgCalcul[2][]{%
   % #1 : cl\'es
   % #2 : \'etapes
   \useKVdefault[ClesProg]%
   \setKV[ClesProg]{#1}%
-  \setsepchar[*]{,* }\ignoreemptyitems%
-  \readlist*\ListeProg{#2}%
-  \stepcounter{nbprog}%
-  \xdef\NbDepart{\ListeProg[1]}%
-  \ifboolKV[ClesProg]{SansCalcul}{%
-    $\NbDepart$\foreachitem\compteur\in\ListeProg[2]{%
-      \hspace{0.2em}\tikzmark{A-\thenbprog-\compteurcnt}\hspace{\useKV[ClesProg]{Ecart}}\tikzmark{B-\thenbprog-\compteurcnt}\hspace{0.2em}$\ListeProg[3,\compteurcnt]$%
-    }%
-    \begin{tikzpicture}[remember picture, overlay]
-      \foreachitem\compteur\in\ListeProg[2]{%
-        \edef\Test{\ListeProg[2,\compteurcnt]}
-        \expandarg%
-        \StrSubstitute{\Test}{^}{\empty\dots{}^}[\tempa]
-        \StrSubstitute{\tempa}{**}{^}[\tempab]
-        \StrSubstitute{\tempab}{*}{\times}[\tempac]
-        \StrSubstitute{\tempac}{/}{\div}[\tempad]
-        \draw[-stealth,transform canvas={yshift=0.25em}] (pic cs:A-\thenbprog-\compteurcnt) --
-        node[above]{\scriptsize$\tempad$}(pic cs:B-\thenbprog-\compteurcnt);
-      }
-    \end{tikzpicture}  
-  }{%
-    \num{\NbDepart}\foreachitem\compteur\in\ListeProg[2]{%
-      \hspace{0.2em}\tikzmark{A-\thenbprog-\compteurcnt}\hspace{\useKV[ClesProg]{Ecart}}\tikzmark{B-\thenbprog-\compteurcnt}\xdef\NbDepart{\fpeval{(\NbDepart)\ListeProg[2,\compteurcnt]}}\hspace{0.2em}\num{\NbDepart}%
+  \ifboolKV[ClesProg]{ThemePerso}{}{%
+    \tcbset{ProgCalcul/.style={%
+        boxsep=1mm,
+        bottom=.75mm,
+        middle=2mm,
+        boxrule={\useKV[ClesProg]{Epaisseur}},
+        text width={\useKV[ClesProg]{Largeur}},
+        colframe={\useKV[ClesProg]{CouleurCadre}},
+        colback={\useKV[ClesProg]{CouleurFond}},
+        halign upper=center
+      }%
     }%
-    \ifboolKV[ClesProg]{Direct}{%
-      \begin{tikzpicture}[remember picture, overlay]
-        \foreachitem\compteur\in\ListeProg[2]{%
-          \edef\Test{\ListeProg[2,\compteurcnt]}
-          \expandarg%
-          \StrSubstitute{\Test}{^}{\empty\dots{}^}[\tempa]
-          \StrSubstitute{\tempa}{**}{^}[\tempab]
-          \StrSubstitute{\tempab}{*}{\times}[\tempac]
-          \StrSubstitute{\tempac}{/}{\div}[\tempad]
-          \draw[-stealth,transform canvas={yshift=0.25em}] (pic cs:A-\thenbprog-\compteurcnt) --
-          node[above]{\scriptsize$\tempad$}(pic
-          cs:B-\thenbprog-\compteurcnt);
+  }%
+  \ifboolKV[ClesProg]{Application}{%
+    %    % by Thomas Dehon and cp
+    \setsepchar[*]{§*,}
+    % \setsepchar[*]{,* }%
+    \ignoreemptyitems%
+    \readlist*\ListeTotale{#2}%
+    \xdef\foo{\ListeTotale[1]}%
+    \xdef\faa{\ListeTotale[2]}%
+    %% 
+    \setsepchar{,}%    \ignoreemptyitems%
+    \readlist*\ListeEtapes{\foo}%
+    \setsepchar[*]{,* }\ignoreemptyitems%
+    \readlist*\ListeProg{\faa}%
+      \begin{tcolorbox}[%
+        ProgCalcul,%
+        ]
+        \ifthenelse{\equal{\useKV[ClesProg]{Nom}}{}}%
+        {}%
+        {%
+          {\color{\useKV[ClesProg]{CouleurCadre}}{\bfseries\useKV[ClesProg]{Nom}}}%
+          \tcblower
+        }%
+        \ifboolKV[ClesProg]{SansCalcul}{%
+          \begin{enumerate}
+          \item Choisir un nombre~\pointilles[]~$\ListeProg[1]$%
+            \foreachitem\etape\in\ListeEtapes{%
+            \item \etape~\pointilles[]~$\ListeProg[3,\etapecnt]$
+            }%
+          \end{enumerate}
+        }{\begin{enumerate}
+          \item Choisir un nombre~\pointilles[]~\xdef\NbDepart{\ListeProg[1]}\num{\NbDepart}
+            \foreachitem\etape\in\ListeEtapes{%
+            \item \etape~\pointilles[]~\edef\Test{\ListeProg[2,\etapecnt]}%
+              \expandarg%
+              \StrSubstitute{\Test}{^}{\empty\dots{}^}[\tempa]%
+              \StrSubstitute{\tempa}{**}{^}[\tempab]%
+              \StrSubstitute{\tempab}{*}{\times}[\tempac]%
+              \StrSubstitute{\tempac}{/}{\div}[\tempad]%
+              $\ifboolKV[ClesProg]{Details}{\num{\NbDepart}\tempad=}{}\xdef\NbDepart{\fpeval{(\NbDepart)\ListeProg[2,\etapecnt]}}\num{\NbDepart}$%
+            }%
+          \end{enumerate}
         }
-      \end{tikzpicture}
+      \end{tcolorbox}
+  }{%
+    \ifboolKV[ClesProg]{Enonce}{%
+      % by Thomas Dehon
+      \setsepchar[*]{,* }%
+      \ignoreemptyitems%
+      \readlist*\ListeEtapes{#2}% 
+      \begin{tcolorbox}[%
+        ProgCalcul,%
+        ]
+        \ifthenelse{\equal{\useKV[ClesProg]{Nom}}{}}%
+        {}%
+        {%
+          {\color{\useKV[ClesProg]{CouleurCadre}}{\bfseries\useKV[ClesProg]{Nom}}}%
+          \tcblower
+        }%
+        \begin{enumerate}
+          \foreachitem\etape\in\ListeEtapes{%
+          \item \etape 
+            \ifthenelse{\equal{\useKV[ClesProg]{Pointilles}}{0}}%
+            {}%
+            {%
+              \setlength{\PointillesClesProg}{\useKV[ClesProg]{Pointilles}}
+              \hfill \pointilles[\PointillesClesProg]%
+            }%
+          }
+        \end{enumerate}
+      \end{tcolorbox}
     }{%
-      \begin{tikzpicture}[remember picture, overlay]
-        \foreachitem\compteur\in\ListeProg[2]{%
-          \edef\Test{\ListeProg[2,\compteurcnt]}
-          \expandarg%
-          \StrSubstitute{\Test}{^2}{\empty\sqrt{\dots{}}}[\tempa]
-          \StrSubstitute{\tempa}{**}{^}[\tempab]
-          \StrSubstitute{\tempab}{*}{\div}[\tempac]
-          \StrSubstitute{\tempac}{/}{\times}[\tempad]
-          \StrSubstitute{\tempad}{-}{+}[\tempae]
-          \StrSubstitute{\tempae}{++}{-}[\tempaf]
-          \draw[-stealth,transform canvas={yshift=0.25em}] (pic cs:B-\thenbprog-\compteurcnt) --  node[above]{\scriptsize$\tempaf$}(pic cs:A-\thenbprog-\compteurcnt);
-        }
-      \end{tikzpicture}
+      \setsepchar[*]{,* }\ignoreemptyitems%
+      \readlist*\ListeProg{#2}%
+      \stepcounter{NBprog}%
+      \xdef\NbDepart{\ListeProg[1]}%
+      \ifboolKV[ClesProg]{SansCalcul}{%
+        $\NbDepart$\foreachitem\compteur\in\ListeProg[2]{%
+          \hspace{0.2em}\tikzmark{A-\theNBprog-\compteurcnt}\hspace{\useKV[ClesProg]{Ecart}}\tikzmark{B-\theNBprog-\compteurcnt}\hspace{0.2em}$\ListeProg[3,\compteurcnt]$%
+        }%
+        \begin{tikzpicture}[remember picture, overlay]
+          \foreachitem\compteur\in\ListeProg[2]{%
+            \edef\Test{\ListeProg[2,\compteurcnt]}
+            \expandarg%
+            \StrSubstitute{\Test}{^}{\empty\dots{}^}[\tempa]%
+            \StrSubstitute{\tempa}{**}{^}[\tempab]%
+            \StrSubstitute{\tempab}{*}{\times}[\tempac]%
+            \StrSubstitute{\tempac}{/}{\div}[\tempad]%
+            \draw[-stealth,transform canvas={yshift=0.25em}] (pic cs:A-\theNBprog-\compteurcnt) --
+            node[above]{\scriptsize$\tempad$}(pic cs:B-\theNBprog-\compteurcnt);
+          }
+        \end{tikzpicture}  
+      }{%
+        \num{\NbDepart}\foreachitem\compteur\in\ListeProg[2]{%
+          \hspace{0.2em}\tikzmark{A-\theNBprog-\compteurcnt}\hspace{\useKV[ClesProg]{Ecart}}\tikzmark{B-\theNBprog-\compteurcnt}\xdef\NbDepart{\fpeval{(\NbDepart)\ListeProg[2,\compteurcnt]}}\hspace{0.2em}\num{\NbDepart}%
+        }%
+        \ifboolKV[ClesProg]{Direct}{%
+          \begin{tikzpicture}[remember picture, overlay]
+            \foreachitem\compteur\in\ListeProg[2]{%
+              \edef\Test{\ListeProg[2,\compteurcnt]}
+              \expandarg%
+              \StrSubstitute{\Test}{^}{\empty\dots{}^}[\tempa]%
+              \StrSubstitute{\tempa}{**}{^}[\tempab]%
+              \StrSubstitute{\tempab}{*}{\times}[\tempac]%
+              \StrSubstitute{\tempac}{/}{\div}[\tempad]%
+              \draw[-stealth,transform canvas={yshift=0.25em}] (pic cs:A-\theNBprog-\compteurcnt) --
+              node[above]{\scriptsize$\tempad$}(pic
+              cs:B-\theNBprog-\compteurcnt);
+            }
+          \end{tikzpicture}
+        }{%
+          \begin{tikzpicture}[remember picture, overlay]
+            \foreachitem\compteur\in\ListeProg[2]{%
+              \edef\Test{\ListeProg[2,\compteurcnt]}
+              \expandarg%
+              \StrSubstitute{\Test}{^2}{\empty\sqrt{\dots{}}}[\tempa]%
+              \StrSubstitute{\tempa}{**}{^}[\tempab]%
+              \StrSubstitute{\tempab}{*}{\div}[\tempac]%
+              \StrSubstitute{\tempac}{/}{\times}[\tempad]%
+              \StrSubstitute{\tempad}{-}{+}[\tempae]%
+              \StrSubstitute{\tempae}{++}{-}[\tempaf]%
+              \draw[-stealth,transform canvas={yshift=0.25em}] (pic cs:B-\theNBprog-\compteurcnt) --  node[above]{\scriptsize$\tempaf$}(pic cs:A-\theNBprog-\compteurcnt);
+            }
+          \end{tikzpicture}
+        }%
+      }%
     }%
   }%
-}
+}%
 
 %%%
 % Papiers
 %%%
-\setKVdefault[Papiers]{Cinq=true,Seyes=false,Isometrique=false,Millimetre=false,Triangle=false,Largeur=5,Hauteur=4,Couleur=black,Grille=-1,PageEntiere=false,ZoneTexte=false}%
+\setKVdefault[Papiers]{Cinq=true,Seyes=false,Isometrique=false,Millimetre=false,Triangle=false,Largeur=5,Hauteur=4,Couleur=black,Grille=-1,PageEntiere=false,ZoneTexte=false,Baseline=false}%
+
+%\def\MPBaseLineSkip#1#2#3{%à retravailler : ne fonctionne pas :(
+%  %
+%  \ifluatex
+%  \mplibforcehmode
+%  \begin{mplibcode}
+%    path horizon,verticon;
+%    horizon=(0,0)--(#1*cm,0);
+%    %verticon=(0,0)--(0,#2*cm);
+%    drawoptions(withcolor #3);
+%    %for k=0 step 0.5 until #1:
+%    %draw verticon shifted((k*cm,0));
+%    %endfor;
+%    for k=(#2-(\mpdim{1.6ex}/1cm)) step (-\mpdim{\baselineskip}/1cm) until 0:
+%    draw horizon shifted((0,k*cm));
+%    endfor;
+%    drawoptions(withcolor blue);
+%    for k=#2 step (-\mpdim{\baselineskip}/1cm) until 0:
+%    draw horizon shifted((0,k*cm));
+%    endfor;
+%  \end{mplibcode}
+%  \fi
+%}
 
 \def\MPGrille#1#2#3#4{%
   \ifluatex%
@@ -15123,15 +17320,19 @@ Unite={},Largeur=1cm,Precision=2,Donnee=Valeurs,Effectif=Effectif,Grille=false,O
       \node[anchor=south west,inner sep=0pt,transform canvas={xshift=\PapierLeft,yshift=\PapierBottom}] at (current page.south west) {%
         \xintifboolexpr{\useKV[Papiers]{Grille}>0}{%
           \MPGrille{\PapierLargeur}{\PapierHauteur}{\PapierCouleur}{\PapierGrille}%
-        }{\ifboolKV[Papiers]{Triangle}{%
-            \MPTriangulaire{\PapierLargeur}{\PapierHauteur}{\PapierCouleur}%
-          }{\ifboolKV[Papiers]{Millimetre}{%
-              \MPMillimetre{\PapierLargeur}{\PapierHauteur}{\PapierCouleur}%
-            }{\ifboolKV[Papiers]{Isometrique}{%
-                \MPIsometrique{\PapierLargeur}{\PapierHauteur}{\PapierCouleur}%
-              }{\ifboolKV[Papiers]{Seyes}{%
-                  \MPSeyes{\PapierLargeur}{\PapierHauteur}{\PapierCouleur}%
-                }{\MPCinq{\PapierLargeur}{\PapierHauteur}{\PapierCouleur}%
+        }{\ifboolKV[Papiers]{Baseline}{%
+            \MPBaseLineSkip{\PapierLargeur}{\PapierHauteur}{\PapierCouleur}%
+          }{%
+            \ifboolKV[Papiers]{Triangle}{%
+              \MPTriangulaire{\PapierLargeur}{\PapierHauteur}{\PapierCouleur}%
+            }{\ifboolKV[Papiers]{Millimetre}{%
+                \MPMillimetre{\PapierLargeur}{\PapierHauteur}{\PapierCouleur}%
+              }{\ifboolKV[Papiers]{Isometrique}{%
+                  \MPIsometrique{\PapierLargeur}{\PapierHauteur}{\PapierCouleur}%
+                }{\ifboolKV[Papiers]{Seyes}{%
+                    \MPSeyes{\PapierLargeur}{\PapierHauteur}{\PapierCouleur}%
+                  }{\MPCinq{\PapierLargeur}{\PapierHauteur}{\PapierCouleur}%
+                  }%
                 }%
               }%
             }%
@@ -15166,15 +17367,19 @@ Unite={},Largeur=1cm,Precision=2,Donnee=Valeurs,Effectif=Effectif,Grille=false,O
     }{%
       \xintifboolexpr{\useKV[Papiers]{Grille}>0}{%
         \MPGrille{\PapierLargeur}{\PapierHauteur}{\PapierCouleur}{\PapierGrille}%
-      }{\ifboolKV[Papiers]{Triangle}{%
-          \MPTriangulaire{\PapierLargeur}{\PapierHauteur}{\PapierCouleur}%
-        }{\ifboolKV[Papiers]{Millimetre}{%
-            \MPMillimetre{\PapierLargeur}{\PapierHauteur}{\PapierCouleur}%
-          }{\ifboolKV[Papiers]{Isometrique}{%
-              \MPIsometrique{\PapierLargeur}{\PapierHauteur}{\PapierCouleur}%
-            }{\ifboolKV[Papiers]{Seyes}{%
-                \MPSeyes{\PapierLargeur}{\PapierHauteur}{\PapierCouleur}%
-              }{\MPCinq{\PapierLargeur}{\PapierHauteur}{\PapierCouleur}%
+      }{\ifboolKV[Papiers]{Baseline}{%
+          \MPBaseLineSkip{\PapierLargeur}{\PapierHauteur}{\PapierCouleur}%
+        }{%
+          \ifboolKV[Papiers]{Triangle}{%
+            \MPTriangulaire{\PapierLargeur}{\PapierHauteur}{\PapierCouleur}%
+          }{\ifboolKV[Papiers]{Millimetre}{%
+              \MPMillimetre{\PapierLargeur}{\PapierHauteur}{\PapierCouleur}%
+            }{\ifboolKV[Papiers]{Isometrique}{%
+                \MPIsometrique{\PapierLargeur}{\PapierHauteur}{\PapierCouleur}%
+              }{\ifboolKV[Papiers]{Seyes}{%
+                  \MPSeyes{\PapierLargeur}{\PapierHauteur}{\PapierCouleur}%
+                }{\MPCinq{\PapierLargeur}{\PapierHauteur}{\PapierCouleur}%
+                }%
               }%
             }%
           }%
-- 
cgit v1.2.3

