texlive[72123] Master/texmf-dist: profmaquette (28aug24)

commits+karl at tug.org commits+karl at tug.org
Wed Aug 28 23:05:23 CEST 2024


Revision: 72123
          https://tug.org/svn/texlive?view=revision&revision=72123
Author:   karl
Date:     2024-08-28 23:05:23 +0200 (Wed, 28 Aug 2024)
Log Message:
-----------
profmaquette (28aug24)

Modified Paths:
--------------
    trunk/Master/texmf-dist/tex/latex/profmaquette/ProfMaquette.sty

Added Paths:
-----------
    trunk/Master/texmf-dist/doc/latex/profmaquette/profmaquette-doc.pdf
    trunk/Master/texmf-dist/doc/latex/profmaquette/profmaquette-doc.zip

Removed Paths:
-------------
    trunk/Master/texmf-dist/doc/latex/profmaquette/ProfMaquette-doc.pdf
    trunk/Master/texmf-dist/doc/latex/profmaquette/ProfMaquette-doc.zip

Deleted: trunk/Master/texmf-dist/doc/latex/profmaquette/ProfMaquette-doc.pdf
===================================================================
(Binary files differ)

Deleted: trunk/Master/texmf-dist/doc/latex/profmaquette/ProfMaquette-doc.zip
===================================================================
(Binary files differ)

Added: trunk/Master/texmf-dist/doc/latex/profmaquette/profmaquette-doc.pdf
===================================================================
(Binary files differ)

Index: trunk/Master/texmf-dist/doc/latex/profmaquette/profmaquette-doc.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex/profmaquette/profmaquette-doc.pdf	2024-08-27 23:41:54 UTC (rev 72122)
+++ trunk/Master/texmf-dist/doc/latex/profmaquette/profmaquette-doc.pdf	2024-08-28 21:05:23 UTC (rev 72123)

Property changes on: trunk/Master/texmf-dist/doc/latex/profmaquette/profmaquette-doc.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/profmaquette/profmaquette-doc.zip
===================================================================
(Binary files differ)

Index: trunk/Master/texmf-dist/doc/latex/profmaquette/profmaquette-doc.zip
===================================================================
--- trunk/Master/texmf-dist/doc/latex/profmaquette/profmaquette-doc.zip	2024-08-27 23:41:54 UTC (rev 72122)
+++ trunk/Master/texmf-dist/doc/latex/profmaquette/profmaquette-doc.zip	2024-08-28 21:05:23 UTC (rev 72123)

Property changes on: trunk/Master/texmf-dist/doc/latex/profmaquette/profmaquette-doc.zip
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Modified: trunk/Master/texmf-dist/tex/latex/profmaquette/ProfMaquette.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/profmaquette/ProfMaquette.sty	2024-08-27 23:41:54 UTC (rev 72122)
+++ trunk/Master/texmf-dist/tex/latex/profmaquette/ProfMaquette.sty	2024-08-28 21:05:23 UTC (rev 72123)
@@ -2,20 +2,33 @@
 % licence    : Released under the LaTeX Project Public License v1.3c
 % or later, see http://www.latex-project.org/lppl.txtf
 \NeedsTeXFormat{LaTeX2e}%
-\def\filedate{2024/05/02}%
+\def\filedate{2024/08/27}%
 \let\PfMfiledate\filedate%
-\def\fileversion{0.94}%
+\def\fileversion{0.97b}%
 \let\PfMfileversion\fileversion%
 
 \ProvidesPackage{ProfMaquette}[\filedate\space v\fileversion\space Maquettage de documents]%
 
 \newif\if at Dyslexie \@Dyslexiefalse
+\newif\if at CAN \@CANfalse
+\newif\if at Revision \@Revisionfalse
+\newif\if at AssembleCorrections \@AssembleCorrectionsfalse
+\newif\if at Personnel \@Personnelfalse
 
 \DeclareOption{Dyslexie}{\@Dyslexietrue}
+\DeclareOption{CAN}{\@CANtrue}
+\DeclareOption{Revision}{\@Revisiontrue}
+\DeclareOption{AssembleCorrections}{\@AssembleCorrectionstrue}
+\DeclareOption{Personnel}{\@Personneltrue}
 \ProcessOptions\relax
+
+\if at AssembleCorrections
+  \AddToHook{env/document/end}[AC]{\PfMAffichageTousCorriges}%
+\fi
+
 % packages nécessaires
 \RequirePackage{verbatim}%
-
+\RequirePackage{xintexpr}
 \RequirePackage{calc}%
 
 \RequirePackage{xlop}%
@@ -34,7 +47,7 @@
 \RequirePackage{modulus}%
 
 \RequirePackage{ragged2e}%
-
+\RequirePackage{fontawesome5}
 \makeatletter
 \gdef\PfMFontSize{\@ptsize}
 %\gdef\PfMFontSize{\f at size}
@@ -41,8 +54,9 @@
 \makeatother
 %définition des clés
 \RequirePackage{simplekv}%
-\setKVdefault[Boulot]{Dys=false,Taille=14,Cours=false,Base=false,BaseHTML=false,CAN=false,Fiche=false,DM=false,DS=false,IE=false,Kholle=false,RecapBrevet=false,PdT=false,Parcours=false,Contrat=false,FdR=false,ParcoursPerso=false,OlympiadesAPMEP=false,CorrigeInverse=false,CorrigeSeul=false,CorrigeApres=false,CorrigeFin=false,CorrigeAll=false,Brevet=false,BaremeComplet=false,BaremeGlobal=false,CorrectionColonnes=false,Epaisseur=0pt,VersSolution=false,AvecEntrainement=false,Small=false,Footnotesize=false,Scriptsize=false,AllDirect=false,AllPouce=false}%Les deux derniers pour essayer de mettre tous les exercices d'un même fichier en mode Reponse, en mode Indice. Pas implanté, pas testé
+\setKVdefault[Boulot]{Dys=false,Taille=14,Cours=false,Base=false,BaseHTML=false,CAN=false,Fiche=false,DM=false,DS=false,IE=false,Kholle=false,RecapBrevet=false,PdT=false,Parcours=false,Contrat=false,FdR=false,ParcoursPerso=false,OlympiadesAPMEP=false,LivreHeros=false,CorrigeInverse=false,CorrigeSeul=false,CorrigeApres=false,CorrigeFin=false,CorrigeAll=false,Brevet=false,BaremeComplet=false,BaremeGlobal=false,CorrectionColonnes=false,EntrainementColonnes=false,Epaisseur=0pt,VersSolution=false,AvecEntrainement=false,Small=false,Footnotesize=false,Scriptsize=false,AllDirect=false,AllPouce=false,Input=false}%Les deux derniers pour essayer de mettre tous les exercices d'un même fichier en mode Reponse, en mode Indice. Pas implanté, pas testé
 \defKV[Boulot]{Colonnes=\setKV[Boulot]{CorrectionColonnes}}%
+\defKV[Boulot]{EColonnes=\setKV[Boulot]{EntrainementColonnes}}%
 \setKVdefault[Cours]{Couleur=Crimson,Theme=Trace écrite,NomExercice=Exercice}%
 \setKVdefault[DM]{Numero=1,Date=\today,Classe={},Niveau=3,Code=\jobname}%
 \setKVdefault[DS]{Numero=1,Date=\today,Classe={},Niveau=3,Code=\jobname,Calculatrice=false,Sujet=A}%
@@ -49,8 +63,9 @@
 \setKVdefault[Fiche]{Theme=Les nombres décimaux,Date=\today,Niveau=6,Classe={},Code={},NomExercice=Exercice,}%
 \setKVdefault[PdT]{Theme=Les nombres décimaux,Date=\today,Niveau=6,Classe={},Code={},NomExercice=Exercice}%
 \setKVdefault[FdR]{Theme=Les nombres décimaux,Date=\today,Niveau=6,Classe={},Code={},NomExercice=Exercice}%
-\setKVdefault[Parcours]{Theme=Les nombres décimaux,Date=\today,Niveau=6,Classe={},Code={},NomExercice=Exercice,Vertical=false}%
+\setKVdefault[Parcours]{Theme=Les nombres décimaux,Date=\today,Niveau=6,Classe={},Code={},NomExercice=Exercice,Vertical=false,Plan=false,Court=false}%
 \setKVdefault[Contrat]{Theme=Les nombres décimaux,Date=\today,Niveau=6,Classe={},Code={},NomExercice=Exercice}%
+\setKVdefault[OlympiadesAPMEP]{Theme=Les nombres décimaux}%
 \setKVdefault[ParcoursPerso]{Fichier={}}%
 \setKVdefault[IE]{Nom=\'Evaluation,Sujets=false,Theme={},Numero=1,Date=\today,Classe={},Niveau=3,Code=\jobname,Calculatrice=false}%
 \defKV[IE]{Sujet=\setKV[IE]{Sujets}}%
@@ -58,7 +73,7 @@
 \setKVdefault[Kholle]{Sujet=1,Numero=1,Date=15,Niveau=TSI-1,Code=\jobname,Lieu=Lycée
   du Hainaut (Valenciennes),NomEleve=Albert Einstein,CR=false}%
 \setKVdefault[CAN]{Date=\today,Niveau=6,Duree=9,CoefQ=0.4,CoefR=0.35,CoefJ=0.1}%
-\setKVdefault[ClesExercices]{NbQuestions=1,PasTitre=false,AffichageSource=false,BaremeTotal,BaremeDetaille=false,MotPoint=point,AffichageTitre=false,Calculatrice=true,Oral=false,Difficulte=0,AffichageCompetence=false,PasCorrige=false,Direct=false,Pouce=false,Parcours=false,Contrat=false,FdR=false,Routes=false,Stops=false,Background=white,Cadre=gray!50,Numerote,Ligne=false,Doublespacing=false,Onehalfspacing=false,Cadres=false,TitreSol=false,NonUtilise=false,Profile=false,PasEntrainement=false}%
+\setKVdefault[ClesExercices]{NbQuestions=1,PasTitre=false,AffichageSource=false,BaremeTotal,BaremeDetaille=false,MotPoint=point,AffichageTitre=false,Calculatrice=true,Oral=false,Difficulte=0,AffichageCompetence=false,PasCorrige=false,Direct=false,Pouce=false,Parcours=false,Contrat=false,FdR=false,Routes=false,Stops=false,Background=white,Cadre=gray!50,Numerote,Ligne=false,Doublespacing=false,Onehalfspacing=false,Cadres=false,TitreSol=false,NonUtilise=false,Profile=false,AEntretenir=false,Fragile=false,AvecIndications=false,ACompleter=false,Aide=0}%
 \defKV[ClesExercices]{TitreSolution=\setKV[ClesExercices]{TitreSol}}%
 \defKV[ClesExercices]{Source=\setKV[ClesExercices]{AffichageSource}}%
 \defKV[ClesExercices]{Titre=\setKV[ClesExercices]{AffichageTitre}}%
@@ -70,9 +85,18 @@
 \defKV[ClesExercices]{Lignes=\setKV[ClesExercices]{Ligne}}%
 \defKV[ClesExercices]{Encart=\setKV[ClesExercices]{Cadres}}%
 \def\PfMTexteEncart{Indique ton travail ci-dessous.}%
-\setKVdefault[SchemaParcours]{Colonnes=100,Rayon=2.5mm,Largeur=7.5mm,Couleur=LightSteelBlue,Csv=false}%
+\setKVdefault[SchemaParcours]{Colonnes=100,Rayon=2.5mm,Largeur=7.5mm,Couleur=gray!70}%,Csv=false}%
 \setKVdefault[SchemaContrat]{Ecart=7mm,Rayon=2.5mm}%
-\setKVdefault[SchemaFdR]{Ecart=7mm,Colonnes=100,Rayon=2.5mm,Largeur=7.5mm,Couleur=LightSteelBlue,Csv=false}%
+\setKVdefault[SchemaFdR]{Ecart=7mm,Colonnes=100,Rayon=2.5mm,Largeur=7.5mm,Couleur=gray!70}%,Csv=false}%
+% Commande pour retenir le nombre d'exercices par maquette.Utile seulement pour la clé AssembleCorrection
+\xdef\PfMRetiensLienExoMa{}%
+\xdef\PfMRetiensLienDefMa{}%
+% Commande pour passer des options à travers la clé Input. Elle remplace \input :)
+\NewDocumentCommand\Input{om}{%
+  \def\Relecture{\setKV[ClesExercices]{#1}}
+  \input{#2}
+  \def\Relecture{}
+}%
 % Sucres
 \makeatletter%
 \NewDocumentCommand\PfMDotfill{}{%
@@ -88,7 +112,15 @@
 %
 \NewDocumentCommand\PfMNbLignesRestantes{}{%
   \edef\measurepage{\dimexpr\pagegoal-\pagetotal\relax}%
+  \edef\measurepagemax{\dimexpr\textheight\relax}%
+ % \edef\measurepage{\dimeval{\pagegoal-\pagetotal-\baselineskip}}%
   \xdef\PfMResteLignes{\fpeval{trunc((\the\measurepage)/(\baselineskip),0)}}%
+  \xdef\PfMResteLignesMax{\fpeval{trunc((\the\measurepagemax)/(\baselineskip),0)}}%
+  \ifnum\PfMResteLignesMax<\PfMResteLignes\relax
+    \xdef\PfMResteLignes{\PfMResteLignesMax}
+  \fi
+  %\xdef\PfMResteLignes{\dimeval{trunc((\the\measurepage)/(\baselineskip),0)}}%
+  %Il reste \PfMResteLignes{} lignes alors que le nombre maximal de lignes sur une page est \PfMResteLignesMax{}.
 }%
 
 \NewDocumentCommand\PfMLignesFinales{}{%
@@ -123,23 +155,30 @@
 \newlength\PfMLargeurJury%
 \newlength\PfMEspaceAvantLignes%
 \newlength\PfMEspaceApresLignes%
-\newlength\PfMLargeurComp
+\newlength\PfMLargeurComp%
 \newlength\CRRHauteur%
 \newlength\PfMEcartSupInterMots%
-\setlength{\CRRHauteur}{10cm}
+\newlength\PfMCoefcompetences%
+\def\PfMCoefCompetences{0.85}%
+\setlength{\CRRHauteur}{10cm}%
 \setlength{\PfMHauteurAppreciation}{5cm}%
 \setlength{\PfMHauteurRemarque}{5cm}%
-\setlength{\PfMEspaceAvantLignes}{1em}
-\setlength{\PfMEspaceApresLignes}{1em}
+\setlength{\PfMEspaceAvantLignes}{1em}%
+\setlength{\PfMEspaceApresLignes}{1em}%
 \setlength{\PfMEcartSupInterMots}{1pt}%
+\setlength{\PfMCoefcompetences}{0.7\linewidth}%
 % définition des compteurs
 \newcounter{PfMMaquette}%Pour compter le nombres de "travaux"
 \setcounter{PfMMaquette}{0}%
+\newcounter{PfMMaquetteSol}[PfMMaquette]%Pour compter le nombres de "travaux" dans les corrections
+\setcounter{PfMMaquetteSol}{0}%
 \newcounter{PfMSection}%Pour le barème et ne pas faire obstruction à section
 \setcounter{PfMSection}{0}%
 \newcounter{PfMExo}[PfMMaquette]%Numéro des exercices
 \setcounter{PfMExo}{0}%
-\newcounter{PfMExoSol}%Pour repérer les valeurs aléatoires construites automatiquement dans la solution
+%\newcounter{PfMExoSolAlea}%Pour repérer les valeurs aléatoires construites automatiquement dans la solution
+%\setcounter{PfMExoSolAlea}{0}%
+\newcounter{PfMExoSol}[PfMMaquette]%
 \setcounter{PfMExoSol}{0}%
 \newcounter{PfMExoEntrai}%Pour repérer les entrainements
 \setcounter{PfMExoEntrai}{0}%
@@ -152,12 +191,17 @@
 \newcounter{RetiensSol}%Pour l'affichage des solutions
 \newcounter{RetiensRep}%Pour l'affichage des reponses.
 \newcounter{RetiensInd}%Pour l'affichage des indices.
+\newcounter{RetiensIndic}%Pour l'affichage des indications.
+\newcounter{PfMRetiensQr}%Pour l'affichage des entrainements
 \setcounter{RetiensSol}{0}%
 \setcounter{RetiensRep}{0}%
 \setcounter{RetiensInd}{0}%
+\setcounter{RetiensIndic}{0}%
+\setcounter{PfMRetiensQr}{0}%
 \newcounter{PfMNbLogo}%Pour décaler les logos sur la ligne haute de tcolorbox
 \setcounter{PfMNbLogo}{0}%
 \newcount\Orientation%Pour le schéma des parcours
+\newcount\TotalParcoursTikz%Pour le total des exos à utiliser dans l'affichage des parcours tikz
 \newcounter{PfMCNNumQ}%
 
 \newcounter{Nbcolonnes}
@@ -166,6 +210,8 @@
 
 \newif\ifPfMDeuxColonnes
 \newif\ifPfMRectoVerso
+\newif\ifPfMRevision
+
 \makeatletter
 \if at twocolumn
   \PfMDeuxColonnestrue
@@ -179,6 +225,11 @@
 \else
   \PfMRectoVersofalse
 \fi
+\if at Revision
+  \PfMRevisiontrue
+\else
+  \PfMRevisionfalse
+\fi
 \makeatother
 
 % couleurs
@@ -228,6 +279,22 @@
 \ifboolKV[Boulot]{CAN}{}{\end{tcolorbox}}%
 }%
 
+\tcbset{%
+  indications/.style={
+    empty,
+    right=0pt,
+    left=0mm,
+    top=0pt,
+    bottom=0pt,
+    frame engine=path,
+    % colframe=Crimson!10,
+    frame hidden,
+    notitle,
+    sharp corners=west,
+    borderline west={3pt}{0pt}{black!50}
+  }
+}
+
 %% Option french pour les mathématiques
 % By CT
 \NewDocumentCommand\TypoMathFrance{}{%
@@ -291,7 +358,7 @@
 \NewDocumentCommand\RepartirEffectifTotal{mmm}{%
   % #1 valeur de l'effectif total
   % #2 nombre de valeurs à obtenir
-  % #3 écart acceptable :) autour de la moyenen
+  % #3 écart acceptable :) autour de la moyenne
   \xdef\PfCSLEffectifs{}%
   \xdef\PfCValeurMoyenneTemp{\fpeval{floor(#1/#2)}}%
   \xdef\PfCRetiensRETSomme{}%
@@ -882,7 +949,7 @@
 }
 
 \def\buildtabcompetences{%
-  \[\begin{tabular}{|p{0.70\linewidth}|*{3}{>{\centering\arraybackslash}p{0.05\linewidth}|}}
+  \[\begin{tabular}{|p{\PfMCoefcompetences}|*{3}{>{\centering\arraybackslash}p{0.05\linewidth}|}}
       \cline{2-4}
       \multicolumn{1}{c|}{}&\PfMCompNA&\PfMCompECA&\PfMCompA\\
       \hline
@@ -892,7 +959,7 @@
 }%
 
 \def\Buildtabcompetences#1#2{%
-  \setlength{\PfMLargeurComp}{\fpeval{0.85-0.05*#1}\linewidth-\fpeval{2*(#1-3)}\tabcolsep}%
+  \setlength{\PfMLargeurComp}{\fpeval{\PfMCoefCompetences-0.05*#1}\linewidth-\fpeval{2*(#1-3)}\tabcolsep}%
   \[\begin{tabular}{|p{\PfMLargeurComp}|*{#1}{>{\centering\arraybackslash}p{0.05\linewidth}|}}%
       \cline{2-\fpeval{1+#1}}%
       \multicolumn{1}{c|}{}\xintFor* ##1 in{\xintSeq{1}{#1}}\do{%
@@ -914,7 +981,7 @@
 \def\SolutionWrite{%
   \setcounter{PfMAlea}{0}%
   \@bsphack%
-  \immediate\openout \verbatim at out "\jobname-Ex\thePfMExo.sol"%
+  \immediate\openout \verbatim at out "\jobname-Ma\thePfMMaquette-Ex\thePfMExo.sol"%
   \let\do\@makeother\dospecials%
   \catcode`\^^M\active%
   \def\verbatim at processline{%
@@ -924,7 +991,7 @@
 
 \def\SolutionWritePP{%
   \@bsphack
-  \immediate\openout \verbatim at out "\jobname-PPEx\thePfMExo.sol" %
+  \immediate\openout \verbatim at out "\jobname-Ma\thePfMMaquette-PPEx\thePfMExo.sol" %
   \let\do\@makeother\dospecials
   \catcode`\^^M\active
   \def\verbatim at processline{%
@@ -934,7 +1001,7 @@
 
 \def\ReponseWrite{%
   \@bsphack
-  \immediate\openout \verbatim at out "\jobname-Ex\thePfMExo.rep" %
+  \immediate\openout \verbatim at out "\jobname-Ma\thePfMMaquette-Ex\thePfMExo.rep" %
   \let\do\@makeother\dospecials
   \catcode`\^^M\active
   \def\verbatim at processline{%
@@ -944,7 +1011,7 @@
 
 \def\IndiceWrite{%
   \@bsphack
-  \immediate\openout \verbatim at out "\jobname-Ex\thePfMExo.cdp" %coup de pouce
+  \immediate\openout \verbatim at out "\jobname-Ma\thePfMMaquette-Ex\thePfMExo.cdp" %coup de pouce
   \let\do\@makeother\dospecials
   \catcode`\^^M\active
   \def\verbatim at processline{%
@@ -953,7 +1020,7 @@
 \def\endIndiceWrite{\immediate\closeout\verbatim at out\@esphack}
 \makeatother
 
-\def\SolutionNow{\textbf{Correction de l'exercice --}\par\nopagebreak\setcounter{PfMExoSol}{\thePfMExo}\setcounter{PfMAlea}{0}\PfMAffichageHideItemSolution}
+\def\SolutionNow{\textbf{Correction de l'exercice --}\par\nopagebreak\setcounter{PfMExoSol}{\thePfMExo}\setcounter{PfMAlea}{0}\PfMAffichageHideItemSolution}%\setcounter{PfMExoSolAlea}{\thePfMExo}
 \def\endSolutionNow{\par\goodbreak\PfMshowitems}
 
 \def\ReponseNow{\textbf{Réponse(s) de l'exercice --}\par\nopagebreak\PfMAffichageHideItemSolution}
@@ -965,7 +1032,53 @@
 \NewDocumentEnvironment{Solution}{}{}{}%
 \NewDocumentEnvironment{Reponse}{}{}{}%
 \NewDocumentEnvironment{Indice}{}{}{}%
+\NewDocumentEnvironment{PfMHide}{+b}{}{}%
+\NewDocumentEnvironment{PfMSeek}{+b}{#1}{}%
 
+\NewDocumentEnvironment{AideA}{+b}{%
+  \ifnum\fpeval{\useKV[ClesExercices]{Aide}}>0\relax%
+    \begin{PfMSeek}%
+  \else%
+    \begin{PfMHide}%
+  \fi%
+  #1
+}{%
+  \ifnum\fpeval{\useKV[ClesExercices]{Aide}}>0\relax%
+    \end{PfMSeek}%
+  \else%
+    \end{PfMHide}%
+  \fi%
+}%
+
+\NewDocumentEnvironment{AideB}{+b}{%
+  \ifnum\fpeval{\useKV[ClesExercices]{Aide}}>1\relax%
+    \begin{PfMSeek}%
+  \else%
+    \begin{PfMHide}%
+  \fi%
+  #1
+}{%
+  \ifnum\fpeval{\useKV[ClesExercices]{Aide}}>1\relax%
+    \end{PfMSeek}%
+  \else%
+    \end{PfMHide}%
+  \fi%
+}%
+  
+\NewDocumentEnvironment{Indications}{+b}{%
+  \ifnum\theRetiensIndic=1\relax%
+    \textbf{\PfMTexteDesIndications :}\par%
+  \else%
+    \begin{PfMHide}%
+  \fi%
+  #1
+}{%
+  \ifnum\theRetiensIndic=1\relax%
+  \else
+  \end{PfMHide}%
+  \fi%
+}%
+
 \NewDocumentCommand\PfMChoixAffichageCorrection{}{%
   \ifboolKV[Boulot]{CorrigeAll}{%
       \let\Solution\SolutionWrite\let\endSolution\endSolutionWrite
@@ -1050,24 +1163,40 @@
   }%
 }%
 
-\def\PfMTexteDuCorrige{Corrigé de l'exercice}
-\def\PfMTexteDeLEntrainement{Automatisme(s) lié(s) à l'exercice}
+\NewDocumentCommand\PfMChoixEntrainement{}{%
+  \setcounter{PfMRetiensQr}{0}%
+  \ifboolKV[ClesExercices]{AEntretenir}{\setcounter{PfMRetiensQr}{1}}{}%
+}%
 
+\NewDocumentCommand\PfMChoixAffichageEntrainement{}{%
+  \ifnum\thePfMRetiensQr=1\relax%
+    \let\Entrainement\EntrainementWrite\let\endEntrainement\endEntrainementWrite%
+  \else%
+    \let\Entrainement\comment\let\endEntrainement\endcomment
+  \fi%
+}%
+
+\def\PfMTexteDuCorrige{Corrigé de l'exercice}%
+\def\PfMTexteDeLEntrainement{Automatisme(s) lié(s) à l'exercice}%
+\def\PfMTexteDesIndications{Indications}%
+
 \NewDocumentCommand\PfMAffichageCorrige{}{%
   \ifboolKV[Boulot]{CAN}{%
     \xintFor* ##1 in{\xintSeq{1}{\PfMCANTotalExo}}\do{%
       \setcounter{PfMExoSol}{##1}%
       \setcounter{PfMAlea}{0}%
-      \IfFileExists{\jobname-Ex##1.sol}{\textbf{Question\ifnum\PfMCANTotalExo=1\relax\else~\ifboolKV[Boulot]{CorrigeSeul}{##1}{\ref{TestCAN-##1}}:\fi}~\input{\jobname-Ex##1.sol}\par\goodbreak}{}%page-\thePfMMaquette-##1
+      \IfFileExists{\jobname-Ma\thePfMMaquette-Ex##1.sol}{\textbf{Question\ifnum\PfMCANTotalExo=1\relax\else~\ifboolKV[Boulot]{CorrigeSeul}{##1}{\ref{TestCAN-##1}}:\fi}~\input{\jobname-Ma\thePfMMaquette-Ex##1.sol}\par\goodbreak}{}%page-\thePfMMaquette-##1
     }%
   }{%
     \setcounter{PfMExoSol}{0}%
+    %\setcounter{PfMExoSolAlea}{0}%
     \xintFor* ##1 in{\xintSeq{1}{\thePfMExo}}\do{%
       \refstepcounter{PfMExoSol}%{##1}%
-      \label{pagesol-\thePfMMaquette-\thePfMExoSol}
+      %\stepcounter{PfMExoSolAlea}%
+      \label{pagesol-\thePfMMaquette-\thePfMExoSol}%
       \setcounter{PfMAlea}{0}%
-      \IfFileExists{\jobname-Ex##1.sol}{\PfMAffichageHideItemSolution\textbf{\PfMTexteDuCorrige\ifnum\thePfMExo=1\relax\else~\ifboolKV[Boulot]{CorrigeSeul}{##1}{\ref{page-\thePfMMaquette-##1}}\fi\PfMAffichageTitreSolution}\par\nopagebreak\input{\jobname-Ex##1.sol}\par\goodbreak}{\IfFileExists{\jobname-Ex##1.rep}{\PfMAffichageHideItemSolution\textbf{Réponse(s) seule(s) de l'exercice\ifnum\thePfMExo=1\relax\else~\ifboolKV[Boulot]{CorrigeSeul}{##1}{\ref{page-\thePfMMaquette-##1}}\fi}\par\nopagebreak\input{\jobname-Ex##1.rep}\par\goodbreak}{%
-          \IfFileExists{\jobname-Ex##1.cdp}{\PfMAffichageHideItemSolution\textbf{Indice(s) pour l'exercice\ifnum\thePfMExo=1\relax\else~\ifboolKV[Boulot]{CorrigeSeul}{##1}{\ref{page-\thePfMMaquette-##1}}\fi}\par\nopagebreak\input{\jobname-Ex##1.cdp}\par\goodbreak}{}%
+      \IfFileExists{\jobname-Ma\thePfMMaquette-Ex##1.sol}{\PfMAffichageHideItemSolution\textbf{\PfMTexteDuCorrige\ifnum\thePfMExo=1\relax\else~\ifboolKV[Boulot]{CorrigeSeul}{##1}{\ref{page-\thePfMMaquette-##1}}\fi\PfMAffichageTitreSolution}\par\nopagebreak\input{\jobname-Ma\thePfMMaquette-Ex##1.sol}\par\goodbreak}{\IfFileExists{\jobname-Ma\thePfMMaquette-Ex##1.rep}{\PfMAffichageHideItemSolution\textbf{Réponse(s) seule(s) de l'exercice\ifnum\thePfMExo=1\relax\else~\ifboolKV[Boulot]{CorrigeSeul}{##1}{\ref{page-\thePfMMaquette-##1}}\fi}\par\nopagebreak\input{\jobname-Ma\thePfMMaquette-Ex##1.rep}\par\goodbreak}{%
+          \IfFileExists{\jobname-Ma\thePfMMaquette-Ex##1.cdp}{\PfMAffichageHideItemSolution\textbf{Indice(s) pour l'exercice\ifnum\thePfMExo=1\relax\else~\ifboolKV[Boulot]{CorrigeSeul}{##1}{\ref{page-\thePfMMaquette-##1}}\fi}\par\nopagebreak\input{\jobname-Ma\thePfMMaquette-Ex##1.cdp}\par\goodbreak}{}%
         }%
       }%
       \PfMshowitems%
@@ -1075,12 +1204,43 @@
   }%
 }%
 
+% Tous les corrigés
+\NewDocumentCommand\PfMAffichageTousCorriges{}{%
+  \setsepchar{,}\ignoreemptyitems%
+  \readlist*\ListeNombreExoMq{\PfMRetiensLienExoMa}%
+  \reademptyitems%
+  \xintFor* ##2 in{\xintSeq{1}{\thePfMMaquette}}\do{%
+    \refstepcounter{PfMMaquetteSol}%
+    \setcounter{PfMExoSol}{0}%
+    %\setcounter{PfMExoSolAlea}{0}%
+    \ifPfMRectoVerso%
+      \cleardoublepage%
+    \else%
+      \clearpage%
+    \fi%
+    \input{\jobname-DefiMq-##2}
+    \ifboolKV[Boulot]{CorrectionColonnes}{\begin{multicols}{\useKV[Boulot]{Colonnes}}}{}%
+    \xintFor* ##1 in{\xintSeq{1}{\ListeNombreExoMq[##2]}}\do{%
+      \stepcounter{PfMExoSol}%
+      %\stepcounter{PfMExoSolAlea}%
+      \label{pagesol-\thePfMMaquetteSol-\thePfMExoSol}%
+      \setcounter{PfMAlea}{0}%
+      \IfFileExists{\jobname-Ma##2-Ex##1.sol}{\PfMAffichageHideItemSolution\textbf{\PfMTexteDuCorrige\ifnum\thePfMExo=1\relax\else~\ifboolKV[Boulot]{CorrigeSeul}{##1}{\ref{page-##2-##1}}\fi\PfMAffichageTitreSolution}\par\nopagebreak\input{\jobname-Ma##2-Ex##1.sol}\par\goodbreak}{\IfFileExists{\jobname-Ma##2-Ex##1.rep}{\PfMAffichageHideItemSolution\textbf{Réponse(s) seule(s) de l'exercice\ifnum\thePfMExo=1\relax\else~\ifboolKV[Boulot]{CorrigeSeul}{##1}{\ref{page-##2-##1}}\fi}\par\nopagebreak\input{\jobname-Ma##2-Ex##1.rep}\par\goodbreak}{%
+          \IfFileExists{\jobname-Ma##2-Ex##1.cdp}{\PfMAffichageHideItemSolution\textbf{Indice(s) pour l'exercice\ifnum\thePfMExo=1\relax\else~\ifboolKV[Boulot]{CorrigeSeul}{##1}{\ref{page-##2-##1}}\fi}\par\nopagebreak\input{\jobname-Ma##2-Ex##1.cdp}\par\goodbreak}{}%
+        }%
+      }%
+      \PfMshowitems%
+    }%
+    \ifboolKV[Boulot]{CorrectionColonnes}{\end{multicols}}{}%
+  }%
+}%
+
 \NewDocumentEnvironment{Entrainement}{}{}{}%
 
 \makeatletter
 \def\EntrainementWrite{%
   \@bsphack%
-  \immediate\openout \verbatim at out "\jobname-Ex\thePfMExo.qrc"%
+  \immediate\openout \verbatim at out "\jobname-Ma\thePfMMaquette-Ex\thePfMExo.qrc"%
   \let\do\@makeother\dospecials%
   \catcode`\^^M\active%
   \def\verbatim at processline{%
@@ -1087,21 +1247,30 @@
     \immediate\write\verbatim at out{\the\verbatim at line}}%
   \verbatim at start}%
 \def\endEntrainementWrite{\immediate\closeout\verbatim at out\@esphack}%
-
-\let\Entrainement\EntrainementWrite\let\endEntrainement\endEntrainementWrite%
 \makeatother
 
 \NewDocumentCommand\PfMAffichageEntrainement{}{%
-  \clearpage
+  \ifPfMDeuxColonnes
+    \newpage
+  \else
+    \ifPfMRectoVerso
+      \cleardoublepage
+    \else
+      \clearpage
+    \fi
+  \fi
   \TikzAutomatismes
+  \ifboolKV[Boulot]{EntrainementColonnes}{\begin{multicols}{\useKV[Boulot]{EColonnes}}}{}%
   \setcounter{PfMExoEntrai}{0}%
   \xintFor* ##1 in{\xintSeq{1}{\thePfMExo}}\do{%
     \refstepcounter{PfMExoEntrai}%
-    \IfFileExists{\jobname-Ex##1.qrc}{%
+    \IfFileExists{\jobname-Ma\thePfMMaquette-Ex##1.qrc}{%
       \begin{center}
-      \label{pageentrai-\thePfMMaquette-\thePfMExoEntrai}%
-      \textbf{\PfMTexteDeLEntrainement\ifnum\thePfMExo=1\relax\else~\ref{page-\thePfMMaquette-##1}\fi}\par\nopagebreak\input{\jobname-Ex##1.qrc}\end{center}}{}%
+        \label{pageentrai-\thePfMMaquette-\thePfMExoEntrai}%
+        \textbf{\PfMTexteDeLEntrainement\ifnum\thePfMExo=1\relax\else~\ref{page-\thePfMMaquette-##1}\fi}\par\nopagebreak\input{\jobname-Ma\thePfMMaquette-Ex##1.qrc}\end{center}%
+    }{}%
   }%
+  \ifboolKV[Boulot]{EntrainementColonnes}{\end{multicols}}{}%
 }%
 
 \NewDocumentCommand\TikzAutomatismes{}{%
@@ -1128,17 +1297,23 @@
 
 \newcommand*\brm[1]{%
   \ifboolKV[Boulot]{Fiche}{}{%
-    \immediate\write\@auxout{%
-      \string\opadd*{#1}%
-      {total\the\c at PfMSection-\the\c at PfMExo}%
-      {total\the\c at PfMSection-\the\c at PfMExo}%
-      \string\opcopy{\thePfMExo}{TotalExo}%
+    \ifboolKV[Boulot]{FdR}{}{%
+      \ifboolKV[Boulot]{Contrat}{}{%
+        \ifboolKV[Boulot]{Parcours}{}{%
+          \immediate\write\@auxout{%
+            \string\opadd*{#1}%
+            {total\the\c at PfMSection-\the\c at PfMExo}%
+            {total\the\c at PfMSection-\the\c at PfMExo}%
+            \string\opcopy{\thePfMExo}{TotalExo}%
+          }%
+          \ifboolKV[ClesExercices]{BaremeDetaille}{%
+            \setlength{\brouillon}{\BaremeEspace at Marge-\linewidth+\textwidth}%
+            \makebox[0pt][r]{\footnotesize\FranPt{#1}\hspace*{\brouillon}}%
+            \ignorespaces%
+          }{}%
+        }%
+      }%
     }%
-    \ifboolKV[ClesExercices]{BaremeDetaille}{%
-      \setlength{\brouillon}{\BaremeEspace at Marge-\linewidth+\textwidth}%
-      \makebox[0pt][r]{\footnotesize\FranPt{#1}\hspace*{\brouillon}}%
-      \ignorespaces%
-    }{}%
   }%
 }%
 
@@ -1251,12 +1426,12 @@
 
 \NewDocumentCommand{\PfMLienVersEntrainement}{}{%
   \ifboolKV[Boulot]{AvecEntrainement}{%
-    \ifboolKV[ClesExercices]{PasEntrainement}{}{%
+    \ifboolKV[ClesExercices]{AEntretenir}{%
       \node[%
       fill=tcbcolback,%
       anchor=center,rotate=45%
       ] at ($(frame.north east)!0.75!(frame.south east)$){\hyperref[pageentrai-\thePfMMaquette-\thePfMExo]{\faDumbbell}};%
-    }%
+    }{}%
   }{}%
 }%
 
@@ -1307,7 +1482,6 @@
 %%% Base des exercices DM
 \tcbset{%
   tikzdm/.style={%
-    %lowerbox=ignored,
     enhanced,
     breakable,
     colback=white,
@@ -1346,21 +1520,23 @@
   }%
 }%
 
-\NewDocumentEnvironment{exerciceDM}{so+b}{%
+\NewDocumentEnvironment{exerciceDM}{so}{%
   \setcounter{PfMAlea}{0}%
+  % Mettre les indications hors-jeu
+  \setcounter{RetiensIndic}{0}
   \useKVdefault[ClesExercices]%
   \setKV[ClesExercices]{#2}%
+  \ifboolKV[Boulot]{Input}{\Relecture}{}%
   \ifboolKV[ClesExercices]{NonUtilise}{%
     % Mettre la correction hors-jeu
     \setKV[ClesExercices]{PasCorrige}%
     \PfMChoixCorrection%
+    \begin{PfMHide}
   }{%
   \IfBooleanTF{#1}{%
     \setKV[ClesExercices]{Numerote=false}%
   }{}%
-  \refstepcounter{PfMSection}%
-  \PfMChoixCorrection%
-  \refstepcounter{PfMExo}%
+  \PfMAvantLesExercices%
   \ifboolKV[Boulot]{CorrigeSeul}{}{%
   \PfMChoixTitreSolution%
   \immediate\write\@auxout{%
@@ -1376,12 +1552,11 @@
   label=page-\thePfMMaquette-\thePfMExo,%
   ]%
   \ifboolKV[Boulot]{Dys}{\raggedright}{}%
-  #3
 }%
 }%
 }{%
-  \ifboolKV[ClesExercices]{NonUtilise}{}{%
-            \ifboolKV[Boulot]{CorrigeSeul}{}{
+  \ifboolKV[ClesExercices]{NonUtilise}{\end{PfMHide}}{%
+    \ifboolKV[Boulot]{CorrigeSeul}{}{
   \end{tcolorbox}%
   \PfMApresLesExercices%
 }%
@@ -1509,23 +1684,25 @@
 }%
 
  
-\NewDocumentEnvironment{exerciceContrat}{so+b}{%
+\NewDocumentEnvironment{exerciceContrat}{so}{%
   \setcounter{PfMAlea}{0}%
   \setcounter{PfMNbLogo}{1}%
+  % Mettre les indications hors-jeu
+  \setcounter{RetiensIndic}{0}
   \useKVdefault[ClesExercices]%
   \setKV[ClesExercices]{#2}%
+  \ifboolKV[Boulot]{Input}{\Relecture}{}%
   \ifboolKV[ClesExercices]{NonUtilise}{%
     % Mettre la correction hors-jeu
     \setKV[ClesExercices]{PasCorrige}%
     \PfMChoixCorrection%
+    \begin{PfMHide}
   }{%
   \IfBooleanTF{#1}{%
     \setKV[ClesExercices]{Numerote=false}%
   }{}%
   \setKV[ClesExercices]{BaremeTotal=false,BaremeDetaille=false}%
-  \refstepcounter{PfMSection}%
-  \PfMChoixCorrection%
-  \refstepcounter{PfMExo}%
+  \PfMAvantLesExercices%
   \ifboolKV[Boulot]{CorrigeSeul}{}{%
   \PfMChoixTitreSolution%
   \immediate\write\@auxout{\string\opcopy{\thePfMExo}{\Roman{PfMMaquette}-ContratTotalExo}}%
@@ -1546,11 +1723,10 @@
     label=page-\thePfMMaquette-\thePfMExo
     ]
     \ifboolKV[Boulot]{Dys}{\raggedright}{}%
-    #3
   }%
   }%
 }{%
-  \ifboolKV[ClesExercices]{NonUtilise}{}{%
+  \ifboolKV[ClesExercices]{NonUtilise}{\end{PfMHide}}{%
       \ifboolKV[Boulot]{CorrigeSeul}{}{%
     \end{tcolorbox}
     \PfMApresLesExercices%
@@ -1799,7 +1975,7 @@
    \xdef\RetiensLeDepart{0}%
    \xdef\RetiensLesReponses{0}%
    \xdef\RetiensNonAffichees{0}%
-   \xdef\RetiensEtage{0}
+   \xdef\RetiensEtage{0}%
    \xintFor* ##1 in{\xintSeq{1}{\ListeRouteHautelen}}\do{%
      \xintifboolexpr{\ListeRouteHaute[##1]==0}{%
        \xdef\RetiensEtage{\fpeval{\RetiensEtage+1}}%
@@ -1814,7 +1990,7 @@
        \xintifboolexpr{\fpeval{\RetiensLesReponses-1}==\RetiensNonAffichees}{%
 %         %
        }{%
-         \xintFor* ##2 in{\xintSeq{\fpeval{\RetiensLeDepart+1}}{\fpeval{\RetiensLeDepart+\RetiensLesReponses}}}\do{
+         \xintFor* ##2 in{\xintSeq{\fpeval{\RetiensLeDepart+1}}{\fpeval{\RetiensLeDepart+\RetiensLesReponses}}}\do{%
            \xintifboolexpr{\ListeRouteHaute[##2]<0}{%
              \draw (B-##2) to (B-\fpeval{##2+1});%
            }{%
@@ -1863,24 +2039,28 @@
   \fi
   \immediate\write\@auxout{\noexpand\expandafter\gdef\noexpand\csname \Roman{PfMMaquette}FdR#1\endcsname{\csname \Roman{PfMMaquette}route#1\endcsname}}%
 }%
- 
-\NewDocumentEnvironment{exerciceFdR}{so+b}{%
+
+\def\Relecture{}%
+
+\NewDocumentEnvironment{exerciceFdR}{so}{%
   \setcounter{PfMAlea}{0}%
   \setcounter{PfMNbLogo}{1}%
+  % Mettre les indications hors-jeu
+  \setcounter{RetiensIndic}{0}
   \useKVdefault[ClesExercices]%
   \setKV[ClesExercices]{#2}%
+  \ifboolKV[Boulot]{Input}{\Relecture}{}%
   \ifboolKV[ClesExercices]{NonUtilise}{%
     % Mettre la correction hors-jeu
     \setKV[ClesExercices]{PasCorrige}%
     \PfMChoixCorrection%
+    \begin{PfMHide}
   }{%
   \IfBooleanTF{#1}{%
     \setKV[ClesExercices]{Numerote=false}%
   }{}%
   \setKV[ClesExercices]{BaremeTotal=false,BaremeDetaille=false}%
-  \stepcounter{PfMSection}%
-  \PfMChoixCorrection%
-  \refstepcounter{PfMExo}%
+  \PfMAvantLesExercices%
   \ifboolKV[Boulot]{CorrigeSeul}{}{%
   \PfMChoixTitreSolution%
   \immediate\write\@auxout{\string\opcopy{\thePfMExo}{\Roman{PfMMaquette}-FdRTotalExo}}%
@@ -1914,11 +2094,10 @@
     label=page-\thePfMMaquette-\thePfMExo
     ]
     \ifboolKV[Boulot]{Dys}{\raggedright}{}%
-    #3
   }%
   }%
 }{%
-  \ifboolKV[ClesExercices]{NonUtilise}{}{%
+  \ifboolKV[ClesExercices]{NonUtilise}{\end{PfMHide}}{%
       \ifboolKV[Boulot]{CorrigeSeul}{}{%
   \end{tcolorbox}
   \PfMApresLesExercices%
@@ -1945,7 +2124,7 @@
     \string\opcopy{\thePfMExo}{TotalExo}%
   }%
   \@bsphack%
-  \immediate\openout \verbatim at out "\jobname-Ex\thePfMExo.can"%
+  \immediate\openout \verbatim at out "\jobname-Ma\thePfMMaquette-Ex\thePfMExo.can"%
   \let\do\@makeother\dospecials%
   \catcode`\^^M\active%
   \def\verbatim at processline{\immediate\write\verbatim at out{\the\verbatim at line}}%
@@ -1970,7 +2149,6 @@
 \tcbset{%
   usercan/.style={%
     enhanced,
-    % spread upwards=-1cm,colback=gray!5%
     frame hidden,
     colback=white,
     middle=24pt,
@@ -2030,7 +2208,6 @@
       \Large\sffamily Course aux nombres (Correction)
     \end{center}
     \hfill\useKV[CAN]{Niveau}%
-    %\par{\tiny\useKV[CAN]{Code}}\hfill{\scriptsize\useKV[CAN]{Date}}%
   \end{tcolorbox}%
 }
 %%% FdR %%%
@@ -2112,19 +2289,33 @@
     \reademptyitems%
     \xdef\PfMFooTestA{\ListeExercicesPA[1]}%
     \ifnum\ListeExercicesPAlen>1\relax%
-    \xintFor* ##1 in{\xintSeq{2}{\ListeExercicesPAlen}}\do{%
-      \xdef\PfMFooTestA{\PfMFooTestA,\ListeExercicesPA[##1]}%
-    }%
+      \xintFor* ##1 in{\xintSeq{2}{\ListeExercicesPAlen}}\do{%
+        \xdef\PfMFooTestA{\PfMFooTestA,\ListeExercicesPA[##1]}%
+      }%
     \fi%
-    \ifboolKV[Parcours]{Vertical}{%
-      \BuildParcoursTikzV{\ParcoursTotalExo}{\PfMFooTestA}%
+    \ifboolKV[Parcours]{Plan}{%
+      \BuildParcoursPlan{\ParcoursTotalExo}{\PfMFooTestA}%
     }{%
-      \BuildParcoursTikz{\ParcoursTotalExo}{\PfMFooTestA}%
+      \ifboolKV[Parcours]{Vertical}{%
+        \BuildParcoursTikzV{\ParcoursTotalExo}{\PfMFooTestA}%
+      }{%
+        \BuildParcoursTikz{\ParcoursTotalExo}{\PfMFooTestA}%
+      }%
     }%
   }%
 }%
 %\makeatother
 
+\NewDocumentCommand\BuildParcoursPlan{mm}{%
+  \setsepchar{,}%
+  \readlist*\ListeRetiens{#2}%
+  \begin{enumerate}
+    \foreachitem\compteur\in\ListeRetiens{%
+    \item[$\square$] Exercice \ref{page-\thePfMMaquette-\ListeRetiens[\compteurcnt]}%
+    }%
+  \end{enumerate}
+}%
+
 \NewDocumentCommand\BuildParcoursTikzV{mm}{%
   \setsepchar{,}%
   \readlist*\ListeRetiens{#2}%
@@ -2155,8 +2346,13 @@
   \begin{tikzpicture}[anchor=center,baseline=-1.25mm]
     % On place les points
     \Orientation=1\relax
+    \ifboolKV[Parcours]{Court}{%
+      \TotalParcoursTikz=\ListeRetienslen%
+    }{%
+      \TotalParcoursTikz=#1%
+    }%
     \coordinate[anchor=base,baseline=-1.25mm] (A-1) at (0,0);%
-    \xintFor* ##1 in{\xintSeq{2}{\fpeval{#1+1}}}\do{%
+    \xintFor* ##1 in{\xintSeq{2}{\fpeval{\the\TotalParcoursTikz+1}}}\do{%
       \modulo{##1}{\useKV[SchemaParcours]{Colonnes}}%
       \ifnum\remainder=0\relax%
       \Orientation=\numexpr\Orientation*(-1)\relax%
@@ -2165,18 +2361,24 @@
       \coordinate[xshift=\the\Orientation*\PfMLargeurSchemaParcours] (A-##1) at (A-\fpeval{##1-1});%
       \fi%
     }%
-    \foreach\i in{2,...,#1}{%
-      \draw[line width=1pt] (A-\fpeval{\i-1}) -- (A-\i);%
+    \foreach\i in{1,...,\the\TotalParcoursTikz}{%
+      \draw[line width=1pt] (A-\i) -- (A-\fpeval{\i+1});%
     }%
-    %
-    \draw[line width=1pt,>=latex,->] (A-#1)--(A-\fpeval{#1+1});
-    %
-    \xintFor* ##1 in{\xintSeq{1}{#1}}\do{%
-      \draw[fill=white,dashed](A-##1) circle (2.5mm) node{##1};%
+%    %
+    \draw[line width=1pt,>=latex,->] (A-\the\TotalParcoursTikz)--(A-\fpeval{\the\TotalParcoursTikz+1});
+%    %
+    \ifboolKV[Parcours]{Court}{%
+      \foreachitem\compteur\in\ListeRetiens{%
+        \draw[fill=PfMCouleurSP](A-\compteurcnt) circle (2.5mm) node{\ref{page-\thePfMMaquette-\ListeRetiens[\compteurcnt]}};%
+      }%
+    }{%
+      \xintFor* ##1 in{\xintSeq{1}{\the\TotalParcoursTikz}}\do{%
+        \draw[fill=white,dashed](A-##1) circle (2.5mm) node{##1};%
+      }%
+      \foreachitem\compteur\in\ListeRetiens{%
+        \draw[fill=PfMCouleurSP](A-\ListeRetiens[\compteurcnt]) circle (2.5mm) node{\ref{page-\thePfMMaquette-\ListeRetiens[\compteurcnt]}};%
+      }%
     }%
-    \foreachitem\compteur\in\ListeRetiens{%
-      \draw[fill=PfMCouleurSP](A-\ListeRetiens[\compteurcnt]) circle (2.5mm) node{\ref{page-\thePfMMaquette-\ListeRetiens[\compteurcnt]}};%
-    }%
   \end{tikzpicture}%
 }%
 
@@ -2195,7 +2397,7 @@
   \stepcounter{PfMExo}%
   \PfMChoixCorrection%
   \@bsphack%
-  \immediate\openout \verbatim at out "\jobname-PPEx\thePfMExo.tex" %
+  \immediate\openout \verbatim at out "\jobname-Ma\thePfMMaquette-PPEx\thePfMExo.tex" %
   \immediate\write\verbatim at out{\string\begin{exercice}}
   \let\do\@makeother\dospecials%
   \catcode`\^^M\active%
@@ -2205,23 +2407,25 @@
 
 \def\endexerciceParcoursPerso{\immediate\write\verbatim at out{\string\end{exercice}}\immediate\closeout\verbatim at out\@esphack}%
   
-\NewDocumentEnvironment{exerciceParcours}{so+b}{%
+\NewDocumentEnvironment{exerciceParcours}{so}{%
   \setcounter{PfMAlea}{0}%
   \setcounter{PfMNbLogo}{1}%
+  % Mettre les indications hors-jeu
+  \setcounter{RetiensIndic}{0}
   \useKVdefault[ClesExercices]%
   \setKV[ClesExercices]{#2}%
+  \ifboolKV[Boulot]{Input}{\Relecture}{}%
   \ifboolKV[ClesExercices]{NonUtilise}{%
     % Mettre la correction hors-jeu
     \setKV[ClesExercices]{PasCorrige}%
     \PfMChoixCorrection%
+    \begin{PfMHide}
   }{%
   \IfBooleanTF{#1}{%
     \setKV[ClesExercices]{Numerote=false}%
   }{}%
   \setKV[ClesExercices]{BaremeTotal=false,BaremeDetaille=false}%
-  \refstepcounter{PfMSection}%
-  \PfMChoixCorrection%
-  \refstepcounter{PfMExo}%
+  \PfMAvantLesExercices%
   \ifboolKV[Boulot]{CorrigeSeul}{}{%
   \PfMChoixTitreSolution%
   \immediate\write\@auxout{\string\opcopy{\thePfMExo}{\Roman{PfMMaquette}-ParcoursTotalExo}}%
@@ -2242,11 +2446,10 @@
     label=page-\thePfMMaquette-\thePfMExo
     ]
     \ifboolKV[Boulot]{Dys}{\raggedright}{}%
-    #3
   }%
   }%
 }{%
-  \ifboolKV[ClesExercices]{NonUtilise}{}{%
+  \ifboolKV[ClesExercices]{NonUtilise}{\end{PfMHide}}{%
         \ifboolKV[Boulot]{CorrigeSeul}{}{%
   \end{tcolorbox}
   \PfMApresLesExercices%
@@ -2312,16 +2515,25 @@
 
 \NewDocumentCommand\PfMApresLesExercices{}{%
   \ifboolKV[ClesExercices]{Ligne}{%
-      % \vspace{\PfMEspaceAvantLignes}
-      \PfMSetStretch\PfMLignespointilles{\useKV[ClesExercices]{Lignes}}%
+    \vspace*{\PfMEspaceAvantLignes}%
+    \PfMSetStretch\PfMLignespointilles{\useKV[ClesExercices]{Lignes}}%
     \par\vspace*{\PfMEspaceApresLignes}\par%
   }{}%
   \par%
   \ifboolKV[ClesExercices]{Cadres}{%
-      \begin{PfMtcbEncart}%
-        %
-      \end{PfMtcbEncart}%
+    \begin{PfMtcbEncart}%
+      % 
+    \end{PfMtcbEncart}%
   }{}%
+  \ifboolKV[ClesExercices]{Profile}{\PfMshowitems}{}%
+  \ifboolKV[ClesExercices]{ACompleter}{%
+    \IfHookExistsTF{env/center/begin}{\RemoveFromHook{env/center/begin}[*]}{}%
+    \IfHookExistsTF{env/center/end}{\RemoveFromHook{env/center/after}[*]}{}%
+    \IfHookExistsTF{env/itemize/begin}{\RemoveFromHook{env/itemize/begin}[*]}{}%
+    \IfHookExistsTF{env/itemize/end}{\RemoveFromHook{env/itemize/after}[*]}{}%
+    \IfHookExistsTF{env/description/begin}{\RemoveFromHook{env/description/begin}[*]}{}%
+    \IfHookExistsTF{env/description/end}{\RemoveFromHook{env/description/after}[*]}{}%
+  }{}%
 }%
 
 \NewDocumentCommand\PfMAffichageTitreSolution{}{%
@@ -2329,7 +2541,7 @@
   \expandafter\xdef\csname PfMEcrireTitreSol\endcsname{\csname PfMTSol\Roman{PfMExoSol}\endcsname}%
   \ifx\bla\PfMEcrireTitreSol\bla%
   \else
-    \PfMEcrireTitreSol%
+    ~:~\PfMEcrireTitreSol%
   \fi%
 }%
 
@@ -2361,68 +2573,105 @@
   \fi%
 }%
 
-\newbox\PfMBoxSauvegarde%
+\NewDocumentCommand\PfMAvantLesExercices{}{%
+  \ifboolKV[ClesExercices]{AvecIndications}{\setcounter{RetiensIndic}{1}}{}%
+  \ifboolKV[ClesExercices]{Profile}{\PfMhideitems}{}%
+  \refstepcounter{PfMSection}%
+  \PfMChoixCorrection%
+  \PfMChoixEntrainement%
+  \refstepcounter{PfMExo}%
+  \ifboolKV[ClesExercices]{ACompleter}{%
+    \let\oldenumerate\enumerate%
+    \let\oldendenumerate\endenumerate%
+    \let\enumerate\autoenumerate%
+    \let\endenumerate\endautoenumerate%
+    \AddToHook{env/center/begin}[Bcenter]{\let\item\olditem}%
+    \AddToHook{env/center/end}[Ecenter]{\let\item\litem}%
+    \AddToHook{env/description/begin}[Bdescription]{\let\item\olditem}%
+    \AddToHook{env/description/end}[Edescription]{\let\item\litem}%
+    \AddToHook{env/itemize/begin}[Bitemize]{\let\item\olditem}%
+    \AddToHook{env/itemize/end}[Eitemize]{\let\item\litem}%
+  }{}%
+}%
 
-\NewDocumentEnvironment{exerciceFiche}{so+b}{%
+\NewDocumentEnvironment{exerciceFiche}{so}{%
   \setcounter{PfMAlea}{0}%
   \setcounter{PfMNbLogo}{1}%
+  % Mettre les indications hors-jeu
+  \setcounter{RetiensIndic}{0}
   \useKVdefault[ClesExercices]%
   \setKV[ClesExercices]{#2}%
+  \ifboolKV[Boulot]{Input}{\Relecture}{}%
   \ifboolKV[ClesExercices]{NonUtilise}{%
     % Mettre la correction hors-jeu
     \setKV[ClesExercices]{PasCorrige}%
     \PfMChoixCorrection%
+    \begin{PfMHide}
   }{%
     \IfBooleanTF{#1}{%
       \setKV[ClesExercices]{Numerote=false}%
     }{}%
-    \ifboolKV[ClesExercices]{Profile}{\PfMhideitems}{}%
     \colorlet{ColExoFiche}{\useKV[ClesExercices]{Background}}%
     \colorlet{PfMCadreFiche}{\useKV[ClesExercices]{Cadre}}%
     \setKV[ClesExercices]{BaremeTotal=false,BaremeDetaille=false}%
-    \refstepcounter{PfMSection}%
-    \PfMChoixCorrection%
-    \refstepcounter{PfMExo}%
+    \PfMAvantLesExercices%
     \ifboolKV[Boulot]{CorrigeSeul}{}{%
-    \PfMChoixTitreSolution%
-    \PfMChoixHideItemSolution%
-    \begin{tcolorbox}[%
-      tikzfiche,
-      label is label,
-      label=page-\thePfMMaquette-\thePfMExo
-      ]
-      \ifboolKV[Boulot]{Dys}{\raggedright}{}%
-        %
-        #3
+      \PfMChoixTitreSolution%
+      \PfMChoixHideItemSolution%
+      \begin{tcolorbox}[%
+        tikzfiche,
+        label is label,
+        label=page-\thePfMMaquette-\thePfMExo
+        ]
+        \ifboolKV[Boulot]{Dys}{\raggedright}{}%
       }%
     }%
   }{%
-    \ifboolKV[ClesExercices]{NonUtilise}{}{%
+    \ifboolKV[ClesExercices]{NonUtilise}{\end{PfMHide}}{%
       \ifboolKV[Boulot]{CorrigeSeul}{}{
         \end{tcolorbox}%
-        \ifboolKV[ClesExercices]{Profile}{\PfMshowitems}{}%
+        % \ifboolKV[ClesExercices]{Profile}{\PfMshowitems}{}%
         \PfMApresLesExercices%
       }%
     }%
 }%
 
+%\makeatletter
+\NewDocumentCommand\TikzOlympiadesAPMEPCor{m}{%
+  \ifPfMRectoVerso%
+    \cleardoublepage%
+  \else%
+    \clearpage%
+  \fi%
+  \setKV[OlympiadesAPMEP]{#1}%
+  \begin{tcolorbox}[colback=colLogo]
+    \begin{Dispo}*{\normalsize\logoapmep{\scale at logo}}
+      \Large\sffamily \useKV[OlympiadesAPMEP]{Theme}
+
+      (Correction)%
+    \end{Dispo}
+  \end{tcolorbox}%
+}%
+%\makeatother
+
 \NewDocumentEnvironment{exerciceOlympiadesAPMEP}{so}{%
   \setcounter{PfMAlea}{0}%
   \setcounter{PfMNbLogo}{1}%
+  % Mettre les indications hors-jeu
+  \setcounter{RetiensIndic}{0}
   \useKVdefault[ClesExercices]%
   \setKV[ClesExercices]{#2}%
+  \ifboolKV[Boulot]{Input}{\Relecture}{}%
   \ifboolKV[ClesExercices]{NonUtilise}{%
     % Mettre la correction hors-jeu
     \setKV[ClesExercices]{PasCorrige}%
     \PfMChoixCorrection%
+    \begin{PfMHide}
   }{%
     \IfBooleanTF{#1}{%
       \setKV[ClesExercices]{Numerote=false}%
     }{}%
-    \ifboolKV[ClesExercices]{Profile}{\PfMhideitems}{}%
-    \colorlet{ColExoFiche}{\useKV[ClesExercices]{Background}}%
-    \colorlet{PfMCadreFiche}{\useKV[ClesExercices]{Cadre}}%
-    \setKV[ClesExercices]{BaremeTotal=false,BaremeDetaille=false}%
+    \PfMAvantLesExercices%
     \refstepcounter{PfMSection}%
     \PfMChoixCorrection%
     \refstepcounter{PfMExo}%
@@ -2438,29 +2687,30 @@
       }%
     }%
   }{%
-    \ifboolKV[ClesExercices]{NonUtilise}{}{%
+    \ifboolKV[ClesExercices]{NonUtilise}{\end{PfMHide}}{%
   \end{tcolorbox}%
-  \ifboolKV[ClesExercices]{Profile}{\PfMshowitems}{}%
+  %\ifboolKV[ClesExercices]{Profile}{\PfMshowitems}{}%
   \PfMApresLesExercices%
-  }
+  }%
 }%
 
-\NewDocumentEnvironment{exerciceDS}{so+b}{%
+\NewDocumentEnvironment{exerciceDS}{so}{%
   \setcounter{PfMAlea}{0}%
+  % Mettre les indications hors-jeu
+  \setcounter{RetiensIndic}{0}
   \useKVdefault[ClesExercices]%
   \setKV[ClesExercices]{#2}%
+  \ifboolKV[Boulot]{Input}{\Relecture}{}%
   \ifboolKV[ClesExercices]{NonUtilise}{%
     % Mettre la correction hors-jeu
     \setKV[ClesExercices]{PasCorrige}%
     \PfMChoixCorrection%
+    \begin{PfMHide}
   }{%
     \IfBooleanTF{#1}{%
       \setKV[ClesExercices]{Numerote=false}%
     }{}%
-    \ifboolKV[ClesExercices]{Profile}{\PfMhideitems}{}%
-    \refstepcounter{PfMSection}%
-    \PfMChoixCorrection%
-    \refstepcounter{PfMExo}%
+    \PfMAvantLesExercices
     \ifboolKV[Boulot]{CorrigeSeul}{}{%
       \PfMChoixTitreSolution%
       \immediate\write\@auxout{%
@@ -2476,11 +2726,10 @@
         label=page-\thePfMMaquette-\thePfMExo
         ]
         \ifboolKV[Boulot]{Dys}{\raggedright}{}%
-        #3
       }%
     }%
 }{%
-  \ifboolKV[ClesExercices]{NonUtilise}{}{%
+  \ifboolKV[ClesExercices]{NonUtilise}{\end{PfMHide}}{%
     \ifboolKV[Boulot]{CorrigeSeul}{}{%
       \end{tcolorbox}%
       \PfMApresLesExercices%
@@ -2490,8 +2739,11 @@
 
 \NewDocumentEnvironment{ExerciceRecapBrevet}{so}{%
   \setcounter{PfMAlea}{0}%
+  % Mettre les indications hors-jeu
+  \setcounter{RetiensIndic}{0}
   \useKVdefault[ClesExercices]%
   \setKV[ClesExercices]{#2}%
+  \ifboolKV[Boulot]{Input}{\Relecture}{}%
   \IfBooleanTF{#1}{%
     \setKV[ClesExercices]{Numerote=false}%
   }{}%
@@ -2655,8 +2907,11 @@
 \newenvironment{exercicePdT}[1][]{%
   \setcounter{PfMAlea}{0}%
   \setcounter{PfMNbLogo}{1}
+  % Mettre les indications hors-jeu
+  \setcounter{RetiensIndic}{0}
   \useKVdefault[ClesExercices]%
   \setKV[ClesExercices]{#1}%
+  \ifboolKV[Boulot]{Input}{\Relecture}{}%
   \setKV[ClesExercices]{BaremeTotal=false,BaremeDetaille=false}%
   \refstepcounter{PfMSection}%
   \PfMChoixCorrection%
@@ -2704,6 +2959,17 @@
   \end{tikzpicture}%
 }%
 
+\NewDocumentCommand\CheminNeutre{m}{%
+  \setsepchar[*]{,*/}%
+  \readlist*\ListeCheminVrai{#1}%
+  \setsepchar{,}%
+  \begin{tikzpicture}[remember picture,overlay]%
+    \foreachitem\compteur\in\ListeCheminVrai{%
+      \draw[cheminPdT] (\ListeCheminVrai[\compteurcnt,1]) to (\ListeCheminVrai[\compteurcnt,2]);%
+    }%
+  \end{tikzpicture}%
+}%
+
 \NewDocumentCommand\CheminFaux{m}{%
   \setsepchar[*]{,*/}%
   \readlist*\ListeCheminVrai{#1}%
@@ -2785,8 +3051,11 @@
 }%
 
 \NewDocumentEnvironment{exerciceKholle}{o}{%
+  % Mettre les indications hors-jeu
+  \setcounter{RetiensIndic}{0}
   \useKVdefault[ClesExercices]%
   \setKV[ClesExercices]{#1}%
+  \ifboolKV[Boulot]{Input}{\Relecture}{}%
   \setKV[ClesExercices]{BaremeTotal=false,BaremeDetaille=false}%
   \PfMChoixCorrection%
   \refstepcounter{PfMExo}%
@@ -2803,8 +3072,11 @@
 \newenvironment{exerciceBase}[1][]{%
   \setcounter{PfMAlea}{0}%
   \setcounter{PfMNbLogo}{1}
+  % Mettre les indications hors-jeu
+  \setcounter{RetiensIndic}{0}
   \useKVdefault[ClesExercices]
   \setKV[ClesExercices]{#1}
+  \ifboolKV[Boulot]{Input}{\Relecture}{}%
   \setKV[ClesExercices]{BaremeTotal=false,BaremeDetaille=false}
   \refstepcounter{PfMExo}
   \tcolorbox[%
@@ -2816,8 +3088,11 @@
 \newenvironment{exerciceBaseHTML}[1][]{%
   \setcounter{PfMAlea}{0}%
   \setcounter{PfMNbLogo}{1}
+  % Mettre les indications hors-jeu
+  \setcounter{RetiensIndic}{0}
   \useKVdefault[ClesExercices]
   \setKV[ClesExercices]{#1}
+  \ifboolKV[Boulot]{Input}{\Relecture}{}%
   \setKV[ClesExercices]{BaremeTotal=false,BaremeDetaille=false}
   \refstepcounter{PfMExo}
   \tcolorbox[%
@@ -3083,7 +3358,7 @@
     % colframe=PfMCadreFiche,
     frame hidden,
     overlay unbroken and first={%
-      \draw[colLogo,line width=1pt] ([yshift=-10pt]frame.north west)--([yshift=-10pt]frame.north east);
+      \draw[colLogo,line width=1pt] ([yshift=-12pt]frame.north west)--([yshift=-12pt]frame.north east);
       \node[%
       name=A,
       fill=ColExoFiche,
@@ -3311,13 +3586,13 @@
       \ifnum\fpeval{\ListeExerciceslen}=1\relax{}
         \setKVdefault[ClesExercices]{Numerote=false}
 %        \begin{exercice}*
-          \input{\jobname-PPEx\ListeExercices[1].tex}%
+          \input{\jobname-Ma\thePfMMaquette-PPEx\ListeExercices[1].tex}%
           % \end{exercice}%
           \setKVdefault[ClesExercices]{Numerote}
       \else
         \foreach\i in{1,...,\ListeExerciceslen}{%
   %        \begin{exercice}
-            \input{\jobname-PPEx\ListeExercices[\i].tex}%
+            \input{\jobname-Ma\thePfMMaquette-PPEx\ListeExercices[\i].tex}%
    %       \end{exercice}%
         }
       \fi
@@ -3327,10 +3602,10 @@
         \TikzFicheCor{#1,Code=\normalsize\Prenom~\Nom}%
         \readlist*\ListeExercices{\RecapListeExo}%
         \ifnum\fpeval{\ListeExerciceslen}=1\relax{}
-          \textbf{Corrigé de l'exercice} : \input{\jobname-PPEx\ListeExercices[1].sol}\par\goodbreak%
+          \textbf{Corrigé de l'exercice} : \input{\jobname-Ma\thePfMMaquette-PPEx\ListeExercices[1].sol}\par\goodbreak%
         \else
           \foreach\i in{1,...,\ListeExerciceslen}{%
-            \textbf{Corrigé de l'exercice \i} : \input{\jobname-PPEx\ListeExercices[\i].sol}\par\goodbreak%
+            \textbf{Corrigé de l'exercice \i} : \input{\jobname-Ma\thePfMMaquette-PPEx\ListeExercices[\i].sol}\par\goodbreak%
           }%
         \fi%
       \fi%
@@ -3344,7 +3619,7 @@
     \TikzFicheCor{#1,Code=\normalsize\Prenom~\Nom}%
     \readlist*\ListeExercices{\RecapListeExo}%
     \foreach\i in{1,...,\ListeExerciceslen}{%
-      \IfFileExists{\jobname-PPEx\ListeExercices[\i].sol}{\textbf{Corrigé de l'exercice \i} : \input{\jobname-PPEx\ListeExercices[\i].sol}\par\goodbreak}{}%
+      \IfFileExists{\jobname-PPEx\ListeExercices[\i].sol}{\textbf{Corrigé de l'exercice \i} : \input{\jobname-Ma\thePfMMaquette-PPEx\ListeExercices[\i].sol}\par\goodbreak}{}%
     }%
   }%
 }%
@@ -3363,14 +3638,6 @@
   }{%
     \ifnum\thePfMMaquette=1\relax%
     \else%
-      %\ifnum\PfMFontSize=0\relax%
-      %  \fontsize{10}{\fpeval{1.2*10}}%
-      %\else\ifnum\PfMFontSize=1\relax%
-      %    \fontsize{11}{\fpeval{1.2*11}}%
-      %  \else%
-      %    \fontsize{12}{\fpeval{1.2*12}}%
-      %  \fi%
-      %\fi%
       \fontsize{\fpeval{10+\PfMFontSize}}{\fpeval{1.2*(10+\PfMFontSize)}}%
       \selectfont%
       \renewcommand{\JustifyingParindent}{\parindent}
@@ -3395,9 +3662,17 @@
 }%
 
 %% Pour factoriser l'appel aux corrections dans l'environnement Maquette
+\makeatletter
 \NewDocumentCommand\PfMPrepareCorrection{m}{%
   \useKVdefault[Boulot]%
   \setKV[Boulot]{#1}%
+  \if at CAN
+    \ifnum\thepage<5\relax
+      \xintFor* ##1 in{\xintSeq{1}{\fpeval{5-\thepage}}}\do{%
+        ~\clearpage%
+      }%
+    \fi%
+  \fi%
   \if at Dyslexie%
     \setKV[Boulot]{Dys}%
   \fi%
@@ -3405,6 +3680,7 @@
   \setlength{\columnseprule}{\useKV[Boulot]{Epaisseur}}%
   \PfMChangerTailleCorrection%
 }%
+\makeatletter
 
 \NewDocumentCommand\PfMAffichageCorrectionColonnes{}{%
   \ifboolKV[Boulot]{CorrectionColonnes}{\begin{multicols}{\useKV[Boulot]{Colonnes}}}{}%
@@ -3418,9 +3694,63 @@
   \ifboolKV[Boulot]{CorrectionColonnes}{\end{multicols}}{}%
 }%
 
+% GameBook
+\tcbset{%
+  userlivreheros/.style={%
+    spread upwards=-1cm,colback=Ivory,colframe=black!25!Ivory%
+  }%
+}%
+
+\setKVdefault[LivreHeros]{Theme=Les nombres décimaux}
+
+\NewDocumentCommand\vaen{m}{\ref{#1}}%
+
+\NewDocumentCommand\TikzLivreHeros{}{%
+  \begin{tcolorbox}[userlivreheros]%
+    \begin{center}
+      \Large\sffamily \useKV[LivreHeros]{Theme}
+      \end{center}
+  \end{tcolorbox}%
+}%
+
+\tcbset{%
+  tikzLH/.style={%
+    before skip=1em,
+    enhanced,
+    coltitle=black,
+    colbacktitle=black!10!Ivory,
+    colframe=white,
+    colback=white,
+    attach boxed title to top center={yshift=-2mm},
+    label is label
+  }%
+}%
+
+\newcounter{PfMGameBook}[PfMMaquette]
+\setcounter{PfMGameBook}{0}
+
+\makeatletter
+\def\ExoGBWrite{%
+  \setcounter{PfMAlea}{0}%
+  \PfMChoixCorrection%
+  \stepcounter{PfMExo}%
+  \immediate\write\@auxout{%
+    \string\opcopy{\thePfMExo}{TotalExo}%
+  }%
+  \@bsphack%
+  \immediate\openout \verbatim at out "\jobname-Ma\thePfMMaquette-Ex\thePfMExo.gb"%
+  \let\do\@makeother\dospecials%
+  \catcode`\^^M\active%
+  \def\verbatim at processline{\immediate\write\verbatim at out{\the\verbatim at line}}%
+  \verbatim at start}%
+\def\endExoGBWrite{\immediate\closeout\verbatim at out\@esphack}%
+\makeatother
+%%%%
+
 %%%%%%%%%%%%%%% Debut Maquette %%%%%%%
 % Environnement englobant le tout.
 \makeatletter
+\newwrite\PfMfile at out%
 \NewDocumentEnvironment{Maquette}{om}{%
   % on remet à zéro les compteurs de solutions : inutile ?
   \setcounter{RetiensSol}{0}%
@@ -3431,10 +3761,17 @@
   \setcounter{PfMSOS}{0}%
   % nouvelles valeurs.
   \stepcounter{PfMMaquette}%
+  \if at AssembleCorrections
+  \immediate\openout\PfMfile at out \jobname-DefiMq-\thePfMMaquette.tex%
+  \immediate\write\PfMfile at out{\unexpanded{\useKVdefault[Boulot]}}%
+  \immediate\write\PfMfile at out{\unexpanded{\setKV[Boulot]{#1}}}%
+  \immediate\write\PfMfile at out{\TikzFicheCor{\unexpanded{#2}}}%
+  \immediate\closeout\PfMfile at out%
+  \fi
   % options de boulot
   \IfHookExistsTF{env/Maquette/after}{\RemoveFromHook{env/Maquette/after}[*]}{}%
-  %\IfHookExistsTF{env/exercice/after}{\RemoveFromHook{env/exercice/after}[*]}{}%
-  % \AddToHook{env/exercice/after}[ChoixExo]{\PfMChoixAffichageCorrection}%
+  \AddToHook{env/Maquette/after}[RetiensExo]{\xdef\PfMRetiensLienExoMa{\PfMRetiensLienExoMa,\thePfMExo}}
+    %--------------
   \useKVdefault[Boulot]%
   \setKV[Boulot]{#1}%
   \ifboolKV[Boulot]{CorrigeSeul}{\setKV[Boulot]{CorrigeFin}}{}%
@@ -3442,32 +3779,34 @@
     \setKV[Boulot]{Dys}
   \fi
   \PfMBasculeDys%
-  \IfHookExistsTF{env/exercice/after}{\RemoveFromHook{env/exercice/after}[*]\AddToHook{env/exercice/after}[ChoixExo]{\PfMChoixAffichageCorrection}}{\AddToHook{env/exercice/after}[ChoixExo]{\PfMChoixAffichageCorrection}}%
+  \IfHookExistsTF{env/exercice/after}{\RemoveFromHook{env/exercice/after}[*]\AddToHook{env/exercice/after}[ChoixExo]{\PfMChoixAffichageCorrection\PfMChoixAffichageEntrainement}}{\AddToHook{env/exercice/after}[ChoixExo]{\PfMChoixAffichageCorrection\PfMChoixAffichageEntrainement}}%
   % Test
   \IfHookExistsTF{env/exercice/begin}{\RemoveFromHook{env/exercice/begin}[*]}{}%
   \IfHookExistsTF{env/Maquette/end}{\RemoveFromHook{env/Maquette/end}[*]}{}%
   \ifboolKV[Boulot]{OlympiadesAPMEP}{%
-      \setKV[OlympiadesAPMEP]{#2}%\TikzOlympiadesAPMEP%
-      \let\exercice\exerciceOlympiadesAPMEP\let\endexercice\endexerciceOlympiadesAPMEP%
-      \ifboolKV[Boulot]{CorrigeFin}{%
-          \AddToHook{env/Maquette/after}[Correction]{%
-            \PfMPrepareCorrection{#1}%
-            \PfMAffichageCorrectionColonnes%
-          }%
-        }{}%
-      }{%
-  \ifboolKV[Boulot]{CAN}{%
+    % \input{PfMMaquetteOlympAPMEP}%
+    \setKV[OlympiadesAPMEP]{#2}%\TikzOlympiadesAPMEP%
+    \let\exercice\exerciceOlympiadesAPMEP\let\endexercice\endexerciceOlympiadesAPMEP%
+    \ifboolKV[Boulot]{CorrigeFin}{%
+      \AddToHook{env/Maquette/after}[Correction]{%
+        \PfMPrepareCorrection{#1}%
+        \TikzOlympiadesAPMEPCor{#2}%
+        \PfMAffichageCorrectionColonnes%
+      }%
+    }{}%
+  }{%
+    \ifboolKV[Boulot]{CAN}{%
+      % \input{PfMMaquetteCAN.tex}
       \setKV[CAN]{#2}%
-      %\ifboolKV[Boulot]{CorrigeSeul}{}{\TikzCAN}%
       \setcounter{PfMCNNumQ}{0}%
       \setlength{\PfMLargeurQuestion}{\useKV[CAN]{CoefQ}\linewidth}\setlength{\PfMLargeurReponse}{\useKV[CAN]{CoefR}\linewidth}\setlength{\PfMLargeurJury}{\useKV[CAN]{CoefJ}\linewidth}%
       \let\exercice\ExoCANWrite\let\endexercice\endExoCANWrite%
       \AddToHook{env/exercice/begin}{\setcounter{PfMAlea}{0}}%
       \AddToHook{env/Maquette/end}{%
-        \xdef\PfMAncienneGraine{\PfMChoisisGraineAlea{123456789}}
+        \xdef\PfMAncienneGraine{\PfMChoisisGraineAlea{123456789}}%
         \xdef\PfMCANTotalExo{\thePfMExo}%
         \setbox\PfMSauvegardeBox\vbox{%
-          \PfMGraineAlea{\thePfMMaquette}
+          \PfMGraineAlea{\thePfMMaquette}%
           \setcounter{PfMExo}{0}%
           \renewcommand{\arraystretch}{2}%
           \begin{longtable}{|c|m{\PfMLargeurQuestion}|>{\centering\arraybackslash}m{\PfMLargeurReponse}|m{\PfMLargeurJury}|}%
@@ -3476,21 +3815,21 @@
             \hline%
             \endhead%
             \xintFor* ##1 in {\xintSeq{1}{\PfMCANTotalExo}}\do{%
-              \refstepcounter{PfMCNNumQ}\ttfamily{\thePfMCNNumQ}\label{TestCAN-\thePfMCNNumQ}&\Complement{}\stepcounter{PfMExo}\setcounter{PfMAlea}{0}\input{\jobname-Ex##1.can}&\CNReponse&\\
+              \refstepcounter{PfMCNNumQ}\ttfamily{\thePfMCNNumQ}\label{TestCAN-\thePfMCNNumQ}&\Complement{}\stepcounter{PfMExo}\setcounter{PfMAlea}{0}\input{\jobname-Ma\thePfMMaquette-Ex##1.can}&\CNReponse&\\
               \hline%
             }%
           \end{longtable}%
           \renewcommand{\arraystretch}{1}%
-        }
+        }%
         \ifboolKV[Boulot]{CorrigeInverse}{%
-        \PfMPrepareCorrection{#1}%
-        \TikzCANCor{#2}%
-        \PfMAffichageCorrectionColonnes%
-        \clearpage
-        \normalsize%
-        \TikzCAN%
-        \PfMGraineAlea{\thePfMMaquette}%
-        \setcounter{PfMCNNumQ}{0}%
+          \PfMPrepareCorrection{#1}%
+          \TikzCANCor{#2}%
+          \PfMAffichageCorrectionColonnes%
+          \clearpage
+          \normalsize%
+          \TikzCAN%
+          \PfMGraineAlea{\thePfMMaquette}%
+          \setcounter{PfMCNNumQ}{0}%
           \setcounter{PfMExo}{0}%
           \renewcommand{\arraystretch}{2}%
           \begin{longtable}{|c|m{\PfMLargeurQuestion}|>{\centering\arraybackslash}m{\PfMLargeurReponse}|m{\PfMLargeurJury}|}%
@@ -3499,7 +3838,7 @@
             \hline%
             \endhead%
             \xintFor* ##1 in {\xintSeq{1}{\PfMCANTotalExo}}\do{%
-              \refstepcounter{PfMCNNumQ}\ttfamily{\thePfMCNNumQ}\label{TestCAN-\thePfMCNNumQ}&\Complement{}\stepcounter{PfMExo}\setcounter{PfMAlea}{0}\input{\jobname-Ex##1.can}&\CNReponse&\\
+              \refstepcounter{PfMCNNumQ}\ttfamily{\thePfMCNNumQ}\label{TestCAN-\thePfMCNNumQ}&\Complement{}\stepcounter{PfMExo}\setcounter{PfMAlea}{0}\input{\jobname-Ma\thePfMMaquette-Ex##1.can}&\CNReponse&\\
               \hline%
             }%
           \end{longtable}%
@@ -3508,7 +3847,7 @@
           \PfMGraineAlea{\PfMAncienneGraine}%
           \TikzCAN%
           \setcounter{PfMCNNumQ}{0}%
-        \setcounter{PfMExo}{0}%
+          \setcounter{PfMExo}{0}%
           \renewcommand{\arraystretch}{2}%
           \begin{longtable}{|c|m{\PfMLargeurQuestion}|>{\centering\arraybackslash}m{\PfMLargeurReponse}|m{\PfMLargeurJury}|}%
             \hhline{~---}%
@@ -3516,233 +3855,276 @@
             \hline%
             \endhead%
             \xintFor* ##1 in {\xintSeq{1}{\PfMCANTotalExo}}\do{%
-              \refstepcounter{PfMCNNumQ}\ttfamily{\thePfMCNNumQ}\label{TestCAN-\thePfMCNNumQ}&\Complement{}\stepcounter{PfMExo}\setcounter{PfMAlea}{0}\input{\jobname-Ex##1.can}&\CNReponse&\\
+              \refstepcounter{PfMCNNumQ}\ttfamily{\thePfMCNNumQ}\label{TestCAN-\thePfMCNNumQ}&\Complement{}\stepcounter{PfMExo}\setcounter{PfMAlea}{0}\input{\jobname-Ma\thePfMMaquette-Ex##1.can}&\CNReponse&\\
               \hline%
             }%
           \end{longtable}%
           \renewcommand{\arraystretch}{1}%
-          \ifboolKV[Boulot]{CorrigeFin}{\ifboolKV[Boulot]{CorrigeInverse}{}{\clearpage
-        \PfMPrepareCorrection{#1}%
-        \TikzCANCor{#2}%
-        \PfMAffichageCorrectionColonnes%
-        }
-        }{}
-        }
+          \ifboolKV[Boulot]{CorrigeFin}{%
+            \ifboolKV[Boulot]{CorrigeInverse}{}{%
+              \clearpage
+              \PfMPrepareCorrection{#1}%
+              \TikzCANCor{#2}%
+              \PfMAffichageCorrectionColonnes%
+            }%
+          }{}%
+        }%
       }%
     }{%
       \ifboolKV[Boulot]{FdR}{%
-          \ifboolKV[Boulot]{CorrigeSeul}{}{%
-              \setKV[FdR]{#2}\TikzFdR%
-            }
-            \let\exercice\exerciceFdR\let\endexercice\endexerciceFdR%
-            \ifboolKV[Boulot]{AvecEntrainement}{%
-                    \AddToHook{env/Maquette/end}[Haltere]{%
-                      \PfMAffichageEntrainementColonnes%
-                    }%
-                  }{}%
-      \ifboolKV[Boulot]{CorrigeFin}{%
-          \AddToHook{env/Maquette/after}[Correction]{%
-            \PfMPrepareCorrection{#1}%
-          \TikzFdRCor{#2}%
-          \PfMAffichageCorrectionColonnes
+        % \input{PfMMaquetteFdR.tex}%
+        \ifboolKV[Boulot]{CorrigeSeul}{}{%
+          \setKV[FdR]{#2}\TikzFdR%
         }%
-      }{}%
-   }{%
-     \ifboolKV[Boulot]{Contrat}{%
-         \ifboolKV[Boulot]{CorrigeSeul}{}{%
-             \setKV[Contrat]{#2}\TikzContrat%
-           }
-           \let\exercice\exerciceContrat\let\endexercice\endexerciceContrat%
-           \ifboolKV[Boulot]{AvecEntrainement}{%
-               \AddToHook{env/Maquette/end}[Haltere]{%
-                 \PfMAffichageEntrainementColonnes%
-               }%
-             }{}%
-      \ifboolKV[Boulot]{CorrigeFin}{%
+        \let\exercice\exerciceFdR\let\endexercice\endexerciceFdR%
+        \ifboolKV[Boulot]{AvecEntrainement}{%
+          \AddToHook{env/Maquette/end}[Haltere]{%
+            \PfMAffichageEntrainementColonnes%
+          }%
+        }{}%
+        \ifboolKV[Boulot]{CorrigeFin}{%
           \AddToHook{env/Maquette/after}[Correction]{%
             \PfMPrepareCorrection{#1}%
-          \TikzContratCor{#2}%
-          \PfMAffichageCorrectionColonnes%
-        }%
-      }{}%
-   }{%
-  \ifboolKV[Boulot]{Cours}{%
-    \setKV[Cours]{#2}%
-    \TikzCours%
-    \let\exercice\exerciceFiche\let\endexercice\endexerciceFiche%
-    \ifboolKV[Boulot]{CorrigeFin}{%
-        \AddToHook{env/Maquette/after}[Correction]{%
-          \PfMPrepareCorrection{#1}%
-        \TikzFicheCor{#2}%
-        \PfMAffichageCorrectionColonnes
-        }%
-      }{}%
-    }{%
-     \ifboolKV[Boulot]{RecapBrevet}{%
-    \setKV[RecapBrevet]{#2}%
-    \TikzRecapBrevet%
-    \let\exercice\ExerciceRecapBrevet\let\endexercice\endExerciceRecapBrevet%
-    \ifboolKV[Boulot]{CorrigeFin}{%
-        \AddToHook{env/Maquette/after}[Correction]{%
-          \PfMPrepareCorrection{#1}%
-          \TikzRecapBrevetCor{#2}%
-          \PfMAffichageCorrectionColonnes%
-      }%
-    }{}%
-  }{%
-    \ifboolKV[Boulot]{ParcoursPerso}{%
-      \setKV[ParcoursPerso]{#2}%
-      \DTLloaddb[noheader,keys={PrenomEleve,NomEleve,ListeExo}]{dataperso}{\useKV[ParcoursPerso]{Fichier}.csv}%
-      \let\exercice\exerciceParcoursPerso\let\endexercice\endexerciceParcoursPerso%
-      \ifboolKV[Boulot]{CorrigeFin}{\setcounter{PfMCorrigeParcoursPerso}{1}}{}%
-      \setcounter{PfMExo}{0}%
-      \AtEndDocument{%
-        \Recapitulatif{#1}{#2}%
-      }%
-    }{%
-      \ifboolKV[Boulot]{Parcours}{%
+            \TikzFdRCor{#2}%
+            \PfMAffichageCorrectionColonnes%
+          }%
+        }{}%
+      }{%
+        \ifboolKV[Boulot]{Contrat}{%
+          % \input{PfMMaquetteContrat.tex}%
           \ifboolKV[Boulot]{CorrigeSeul}{}{%
-              \setKV[Parcours]{#2}\TikzParcours%
-            }
-            \let\exercice\exerciceParcours\let\endexercice\endexerciceParcours%
-            \ifboolKV[Boulot]{AvecEntrainement}{%
-                \AddToHook{env/Maquette/end}[Haltere]{%
-                  \PfMAffichageEntrainementColonnes%
-                }%
-              }{}%
-        \ifboolKV[Boulot]{CorrigeFin}{%
+            \setKV[Contrat]{#2}\TikzContrat%
+          }%
+          \let\exercice\exerciceContrat\let\endexercice\endexerciceContrat%
+          \ifboolKV[Boulot]{AvecEntrainement}{%
+            \AddToHook{env/Maquette/end}[Haltere]{%
+              \PfMAffichageEntrainementColonnes%
+            }%
+          }{}%
+          \ifboolKV[Boulot]{CorrigeFin}{%
             \AddToHook{env/Maquette/after}[Correction]{%
               \PfMPrepareCorrection{#1}%
-              \TikzParcoursCor{#2}
-              \PfMAffichageCorrectionColonnes
+              \TikzContratCor{#2}%
+              \PfMAffichageCorrectionColonnes%
             }%
-        }{}%
-      }{%
-        \ifboolKV[Boulot]{PdT}{%
-                            \ifboolKV[Boulot]{CorrigeSeul}{}{%
-                                \setKV[PdT]{#2}\TikzPdT%
-                                }
-          \let\exercice\exercicePdT\let\endexercice\endexercicePdT%
-          \ifboolKV[Boulot]{CorrigeFin}{%
+          }{}%
+        }{%
+          \ifboolKV[Boulot]{Cours}{%
+            % \input{PfMMaquetteCours.tex}%
+            \setKV[Cours]{#2}%
+            \TikzCours%
+            \let\exercice\exerciceFiche\let\endexercice\endexerciceFiche%
+            \ifboolKV[Boulot]{CorrigeFin}{%
               \AddToHook{env/Maquette/after}[Correction]{%
                 \PfMPrepareCorrection{#1}%
-                \TikzPdTCor{#2}%
+                \TikzFicheCor{#2}%
                 \PfMAffichageCorrectionColonnes%
-            }%
-          }{}%
-        }{%
-          \ifboolKV[Boulot]{DM}{%
-            \ifboolKV[Boulot]{CorrigeSeul}{}{%
-              \setKV[DM]{#2}\TikzDM%
-            }
-            \let\exercice\exerciceDM\let\endexercice\endexerciceDM%
-            \ifboolKV[Boulot]{CorrigeFin}{%
+              }%
+            }{}%
+          }{%
+            \ifboolKV[Boulot]{RecapBrevet}{%
+              % \input{PfMMaquetteRecapBrevet.tex}%
+              \setKV[RecapBrevet]{#2}%
+              \TikzRecapBrevet%
+              \let\exercice\ExerciceRecapBrevet\let\endexercice\endExerciceRecapBrevet%
+              \ifboolKV[Boulot]{CorrigeFin}{%
                 \AddToHook{env/Maquette/after}[Correction]{%
                   \PfMPrepareCorrection{#1}%
-                  \TikzDMCor{#2}%
+                  \TikzRecapBrevetCor{#2}%
                   \PfMAffichageCorrectionColonnes%
-              }%
-            }{}%
-          }{%
-            \ifboolKV[Boulot]{Fiche}{%
-                \ifboolKV[Boulot]{CorrigeSeul}{}{%
-                \setKV[Fiche]{#2}%
-                \TikzFiche%
                 }%
-                \let\exercice\exerciceFiche\let\endexercice\endexerciceFiche%
-                \ifboolKV[Boulot]{AvecEntrainement}{%
+              }{}%
+            }{%
+              \ifboolKV[Boulot]{ParcoursPerso}{%
+                % \input{PfMMaquetteParcoursPerso.tex}%
+                \setKV[ParcoursPerso]{#2}%
+                \DTLloaddb[noheader,keys={PrenomEleve,NomEleve,ListeExo}]{dataperso}{\useKV[ParcoursPerso]{Fichier}.csv}%
+                \let\exercice\exerciceParcoursPerso\let\endexercice\endexerciceParcoursPerso%
+                \ifboolKV[Boulot]{CorrigeFin}{\setcounter{PfMCorrigeParcoursPerso}{1}}{}%
+                \setcounter{PfMExo}{0}%
+                \AtEndDocument{%
+                  \Recapitulatif{#1}{#2}%
+                }%
+              }{%
+                \ifboolKV[Boulot]{Parcours}{%
+                  % \input{PfMMaquetteParcours.tex}%
+                  \ifboolKV[Boulot]{CorrigeSeul}{}{%
+                    \setKV[Parcours]{#2}\TikzParcours%
+                  }%
+                  \let\exercice\exerciceParcours\let\endexercice\endexerciceParcours%
+                  \ifboolKV[Boulot]{AvecEntrainement}{%
                     \AddToHook{env/Maquette/end}[Haltere]{%
                       \PfMAffichageEntrainementColonnes%
                     }%
                   }{}%
-                \ifboolKV[Boulot]{CorrigeFin}{%
-                    \ifboolKV[Boulot]{CorrigeAll}{%
-                        \AddToHook{env/Maquette/after}[Correction]{%
-                          \PfMPrepareCorrection{#1}%
-                          \TikzFicheCor{#2}%
-                      \ifboolKV[Boulot]{CorrectionColonnes}{\begin{multicols}{\useKV[Boulot]{Colonnes}}}{}%
-                          \xintFor* ##1 in{\xintSeq{1}{\thePfMExo}}\do{%
-                            \IfFileExists{\jobname-Ex##1.sol}{\textbf{Corrigé de l'exercice ##1}\par\nopagebreak\input{\jobname-Ex##1.sol}\par\goodbreak}{}%
-                          }% 
-                      \ifboolKV[Boulot]{CorrectionColonnes}{\end{multicols}}{}%
-                      \TikzFicheCorRep{#2}%
-                      \ifboolKV[Boulot]{CorrectionColonnes}{\begin{multicols}{\useKV[Boulot]{Colonnes}}}{}%
-                          \xintFor* ##1 in{\xintSeq{1}{\thePfMExo}}\do{%
-                            \IfFileExists{\jobname-Ex##1.rep}{\textbf{Réponse(s) de l'exercice ##1}\par\nopagebreak\input{\jobname-Ex##1.rep}\par\goodbreak}{}%
-                          }% 
-                      \ifboolKV[Boulot]{CorrectionColonnes}{\end{multicols}}{}%
-                      \TikzFicheCorInd{#2}%
-                      \ifboolKV[Boulot]{CorrectionColonnes}{\begin{multicols}{\useKV[Boulot]{Colonnes}}}{}%
-                          \xintFor* ##1 in{\xintSeq{1}{\thePfMExo}}\do{%
-                            \IfFileExists{\jobname-Ex##1.cdp}{\textbf{Indice(s) pour l'exercice ##1}\par\nopagebreak\input{\jobname-Ex##1.cdp}\par\goodbreak}{}%
-                          }% 
-                          \ifboolKV[Boulot]{CorrectionColonnes}{\end{multicols}}{}%
-                        }%
-                   }{%
-                     \AddToHook{env/Maquette/after}[Correction]{%
-                       \useKVdefault[Boulot]%
-                       \setKV[Boulot]{#1}%
-                       %%
-                       \if at Dyslexie
-              \setKV[Boulot]{Dys}
-            \fi
-                       \PfMBasculeDys%
-                     \setlength{\columnseprule}{\useKV[Boulot]{Epaisseur}}%
-                     \TikzFicheCor{#2}%
-                     \PfMChangerTailleCorrection%
-                     \ifboolKV[Boulot]{CorrectionColonnes}{\begin{multicols}{\useKV[Boulot]{Colonnes}}}{}%
-                       \PfMAffichageCorrige%
-                     \ifboolKV[Boulot]{CorrectionColonnes}{\end{multicols}}{}%
-                   }%
-                 }%
-              }{}%
-            }{%
-              \ifboolKV[Boulot]{DS}{%
-                \ifboolKV[Boulot]{CorrigeSeul}{}{%
-                  \setKV[DS]{#2}\TikzDS%
-                }%
-                \let\exercice\exerciceDS\let\endexercice\endexerciceDS%
-                \ifboolKV[Boulot]{BaremeComplet}{%
-                  \begin{center}
-                    \TableauRecapitulatif
-                  \end{center}
-                }{}%
-                \ifboolKV[Boulot]{CorrigeFin}{%
+                  \ifboolKV[Boulot]{CorrigeFin}{%
                     \AddToHook{env/Maquette/after}[Correction]{%
-                      \PfMPrepareCorrection{#1}
-                      \TikzDSCor{#2}%
+                      \PfMPrepareCorrection{#1}%
+                      \TikzParcoursCor{#2}%
                       \PfMAffichageCorrectionColonnes%
-                  }%
-                }{}%
-              }{%
-                \ifboolKV[Boulot]{IE}{%
-                    \ifboolKV[Boulot]{CorrigeSeul}{}{%
-                        \setKV[IE]{#2}\TikzIE%
-                      }
-                  \let\exercice\exerciceDS\let\endexercice\endexerciceDS%On garde exerciceDS
-                  \ifboolKV[Boulot]{CorrigeFin}{%
-                      \AddToHook{env/Maquette/after}[Correction]{%
-                        \PfMPrepareCorrection{#1}
-                      \TikzIECor{#2}%
-                      \PfMAffichageCorrectionColonnes
                     }%
                   }{}%
                 }{%
-                  \ifboolKV[Boulot]{Kholle}{%
-                    \setKV[Kholle]{#2}%
-                    \TikzKholle%
-                    \let\exercice\exerciceKholle\let\endexercice\endexerciceKholle%
-                    \ifboolKV[Kholle]{CR}{}{%
+                  \ifboolKV[Boulot]{PdT}{%
+                    % \input{PfMMaquettePdT.tex}%
+                    \ifboolKV[Boulot]{CorrigeSeul}{}{%
+                      \setKV[PdT]{#2}\TikzPdT%
+                    }%
+                    \let\exercice\exercicePdT\let\endexercice\endexercicePdT%
+                    \ifboolKV[Boulot]{CorrigeFin}{%
+                      \AddToHook{env/Maquette/after}[Correction]{%
+                        \PfMPrepareCorrection{#1}%
+                        \TikzPdTCor{#2}%
+                        \PfMAffichageCorrectionColonnes%
+                      }%
+                    }{}%
+                  }{%
+                    \ifboolKV[Boulot]{DM}{%
+                      % \input{PfMMaquetteDM.tex}%
+                      \ifboolKV[Boulot]{CorrigeSeul}{}{%
+                        \setKV[DM]{#2}\TikzDM%
+                      }%
+                      \let\exercice\exerciceDM\let\endexercice\endexerciceDM%
                       \ifboolKV[Boulot]{CorrigeFin}{%
                         \AddToHook{env/Maquette/after}[Correction]{%
-                          \TikzKholleCor{#2}%
-                          \TikzKholleCor{#2}%
-                          \TikzKholleCor{#2}%
-                          \PfMAffichageCorrige%
+                          \PfMPrepareCorrection{#1}%
+                          \TikzDMCor{#2}%
+                          \PfMAffichageCorrectionColonnes%
                         }%
                       }{}%
+                    }{%
+                      \ifboolKV[Boulot]{Fiche}{%
+                        \ifboolKV[Boulot]{CorrigeSeul}{}{%
+                          \setKV[Fiche]{#2}%
+                          \TikzFiche%
+                        }%
+                        \let\exercice\exerciceFiche\let\endexercice\endexerciceFiche%
+                        \ifboolKV[Boulot]{AvecEntrainement}{%
+                          \AddToHook{env/Maquette/end}[Haltere]{%
+                            \PfMAffichageEntrainementColonnes%
+                          }%
+                        }{}%
+                        \ifboolKV[Boulot]{CorrigeFin}{%
+                          \ifboolKV[Boulot]{CorrigeAll}{%
+                            \AddToHook{env/Maquette/after}[Correction]{%
+                              \PfMPrepareCorrection{#1}%
+                              \TikzFicheCor{#2}%
+                              \ifboolKV[Boulot]{CorrectionColonnes}{\begin{multicols}{\useKV[Boulot]{Colonnes}}}{}%
+                              \xintFor* ##1 in{\xintSeq{1}{\thePfMExo}}\do{%
+                                \IfFileExists{\jobname-Ma\thePfMMaquette-Ex##1.sol}{\textbf{Corrigé de l'exercice ##1}\par\nopagebreak\input{\jobname-Ma\thePfMMaquette-Ex##1.sol}\par\goodbreak}{}%
+                              }%
+                              \ifboolKV[Boulot]{CorrectionColonnes}{\end{multicols}}{}%
+                              \TikzFicheCorRep{#2}%
+                              \ifboolKV[Boulot]{CorrectionColonnes}{\begin{multicols}{\useKV[Boulot]{Colonnes}}}{}%
+                              \xintFor* ##1 in{\xintSeq{1}{\thePfMExo}}\do{%
+                                \IfFileExists{\jobname-Ma\thePfMMaquette-Ex##1.rep}{\textbf{Réponse(s) de l'exercice ##1}\par\nopagebreak\input{\jobname-Ma\thePfMMaquette-Ex##1.rep}\par\goodbreak}{}%
+                              }%
+                              \ifboolKV[Boulot]{CorrectionColonnes}{\end{multicols}}{}%
+                              \TikzFicheCorInd{#2}%
+                              \ifboolKV[Boulot]{CorrectionColonnes}{\begin{multicols}{\useKV[Boulot]{Colonnes}}}{}%
+                              \xintFor* ##1 in{\xintSeq{1}{\thePfMExo}}\do{%
+                                \IfFileExists{\jobname-Ma\thePfMMaquette-Ex##1.cdp}{\textbf{Indice(s) pour l'exercice ##1}\par\nopagebreak\input{\jobname-Ma\thePfMMaquette-Ex##1.cdp}\par\goodbreak}{}%
+                              }% 
+                              \ifboolKV[Boulot]{CorrectionColonnes}{\end{multicols}}{}%
+                            }%
+                          }{%
+                            \AddToHook{env/Maquette/after}[Correction]{%
+%                              \useKVdefault[Boulot]%
+%                              \setKV[Boulot]{#1}%
+%                              %%
+%                              \if at Dyslexie
+%                                \setKV[Boulot]{Dys}%
+%                              \fi
+%                              \PfMBasculeDys%
+%                              \setlength{\columnseprule}{\useKV[Boulot]{Epaisseur}}%
+                              \if at AssembleCorrections
+                              \else
+                                \PfMPrepareCorrection{#1}%
+                                \TikzFicheCor{#2}%
+                                \PfMAffichageCorrectionColonnes%
+                              \fi%
+                            }%
+                          }%
+                        }{}%
+                      }{%
+                        \ifboolKV[Boulot]{DS}{%
+                          % \input{PfMMaquetteDS.tex}%
+                          \ifboolKV[Boulot]{CorrigeSeul}{}{%
+                            \setKV[DS]{#2}\TikzDS%
+                          }%
+                          \let\exercice\exerciceDS\let\endexercice\endexerciceDS%
+                          \ifboolKV[Boulot]{BaremeComplet}{%
+                            \begin{center}
+                              \TableauRecapitulatif
+                            \end{center}
+                          }{}%
+                          \ifboolKV[Boulot]{CorrigeFin}{%
+                            \AddToHook{env/Maquette/after}[Correction]{%
+                              \PfMPrepareCorrection{#1}%
+                              \TikzDSCor{#2}%
+                              \PfMAffichageCorrectionColonnes%
+                            }%
+                          }{}%
+                        }{%
+                          \ifboolKV[Boulot]{IE}{%
+                            % \input{PfMMaquetteIE.tex}%
+                            \ifboolKV[Boulot]{CorrigeSeul}{}{%
+                              \setKV[IE]{#2}\TikzIE%
+                            }%
+                            \let\exercice\exerciceDS\let\endexercice\endexerciceDS%On garde exerciceDS
+                            \ifboolKV[Boulot]{CorrigeFin}{%
+                              \AddToHook{env/Maquette/after}[Correction]{%
+                                \PfMPrepareCorrection{#1}%
+                                \TikzIECor{#2}%
+                                \PfMAffichageCorrectionColonnes%
+                              }%
+                            }{}%
+                          }{%
+                            \ifboolKV[Boulot]{Kholle}{%
+                              % \input{PfMMaquetteKholle.tex}%
+                              \setKV[Kholle]{#2}%
+                              \TikzKholle%
+                              \let\exercice\exerciceKholle\let\endexercice\endexerciceKholle%
+                              \ifboolKV[Kholle]{CR}{}{%
+                                \ifboolKV[Boulot]{CorrigeFin}{%
+                                  \AddToHook{env/Maquette/after}[Correction]{%
+                                    \TikzKholleCor{#2}%
+                                    \TikzKholleCor{#2}%
+                                    \TikzKholleCor{#2}%
+                                    \PfMAffichageCorrige%
+                                  }%
+                                }{}%
+                              }%
+                            }{%
+                              \ifboolKV[Boulot]{LivreHeros}{%
+                                \setKV[LivreHeros]{#2}%
+                                \TikzLivreHeros%
+                                \let\exercice\ExoGBWrite\let\endexercice\endExoGBWrite%
+                                \AddToHook{env/Maquette/end}{%
+                                  \xdef\PfMListeExoGB{}%
+                                  \xintFor* ##1 in{\xintSeq{2}{\thePfMExo}}\do{%
+                                    \xdef\PfMListeExoGB{\PfMListeExoGB,##1}%
+                                  }%
+                                  \MelangeListe{\PfMListeExoGB}{\fpeval{\thePfMExo-1}}%
+                                  \xdef\PfMFooMelange{1,\faa}%
+                                  \setsepchar{,}\ignoreemptyitems\readlist*\ListePerm{\PfMFooMelange}\reademptyitems%
+                                  \phantomsection{}
+                                  \addcontentsline{toc}{section}{\useKV[LivreHeros]{Theme}}%
+                                  \xintFor* ##1 in{\xintSeq{1}{\thePfMExo}}\do{%
+                                    \itemtomacro\ListePerm[##1]\PfMPermute%
+                                    \begin{tcolorbox}[tikzLH,title=##1]%
+                                      \refstepcounter{PfMGameBook}%
+                                      \input{\jobname-Ma\thePfMMaquette-Ex\PfMPermute.gb}%
+                                    \end{tcolorbox}%
+                                  }%
+                                }%
+                              }{}%
+                            }%
+                          }%
+                        }%
+                      }%
                     }%
-                  }{}%
+                  }%
                 }%
               }%
             }%
@@ -3751,11 +4133,6 @@
       }%
     }%
   }%
-}%
-}%
-}%
-}%
-}%
 }{}%
 \makeatother
 %D'après JCC
@@ -4391,8 +4768,9 @@
 \BaremeEspaceMarge{-82pt}
 }
 
-\AddToHook{env/multicols/begin}{\setcounter{Nbcolonnes}{2}}%
-\AddToHook{env/multicols/after}{\setcounter{Nbcolonnes}{4}}%
+%\AddToHook{env/multicols/begin}{\setcounter{Nbcolonnes}{2}}%
+%\AddToHook{env/multicols/after}{\setcounter{Nbcolonnes}{4}}%
+
 \NewDocumentEnvironment{Dispo}{sm+b}{%
   \ifPfMDeuxColonnes
     \IfBooleanTF{#1}{%
@@ -4468,4 +4846,114 @@
                                                                                  }%
     \fi%
   \end{align*}
+}{}%
+
+\def\RetiensEchelle{1cm}
+\def\ChoixNbQuestions{3}
+\makeatletter
+\if at CAN
+  \AddToHook{env/document/before}{%
+    \ProvidesPackage{ProfMaquette}[Mode CAN (CP)]%
+    \RequirePackage{pgfmorepages}
+    \pgfmorepagesloadextralayouts
+    \pgfpagesuselayout{4 on 2, book format}[a4paper,landscape]
+  }
+\fi
+
+\if at Revision
+  \AddToHook{env/document/before}{%
+    \ProvidesPackage{ProfMaquette}[Mode Revision (CP)]%
+    \setcounter{Nbcolonnes}{2}%
+    \def\RetiensEchelle{0.5cm}
+    \RequirePackage{pgfmorepages}
+    \pgfmorepagesloadextralayouts
+    \pgfpagesuselayout{4 on 2, book format}[a4paper]
+  }
+\fi
+
+\if at Personnel
+  \input{PfMPerso.cfg}
+\fi
+\makeatother
+
+% enumitem obligatoire ^^
+\RequirePackage{enumitem}
+% d'après https://tex.stackexchange.com/questions/164613/adding-code-at-the-end-of-each-list-item
+\newif\iffirstlegal\firstlegalfalse% We need a toggle to track whether the item is first in the list or not
+
+\newlist{Test}{enumerate}{3}
+
+\def\PfMPar{\par}
+
+\NewDocumentCommand\litem{}{}
+
+\let\olditem\item% save the standard definition of \item in a macro, \olditem
+
+\setlist[Test,1]{%
+  leftmargin=*,
+  label=\arabic*.,
+  before={%
+    \setcounter{PfMProfondeur}{1}%
+    \setcounter{PfMNbLignesFinitem}{0}
+    \firstlegaltrue% set the toggle for first item in the list to true
+    \def\Primeitem{\iffirstlegal\olditem\stepcounter{PfMNbLignesFinitem}%
+        \firstlegalfalse
+      \else
+        \ifnum\PfMListeDesAjoutsdeLignes[\thePfMNbLignesFinitem]>1\relax\PfMPar\Lignespointilles{\PfMListeDesAjoutsdeLignes[\thePfMNbLignesFinitem]}\else\ifnum\PfMListeDesAjoutsdeLignes[\thePfMNbLignesFinitem]=1\relax\PfMPar\pointilles\fi\fi%
+        \olditem\stepcounter{PfMNbLignesFinitem}%
+      \fi
+    }% new, temporary defition of \item
+    \let\litem\Primeitem
+    \let\item\litem
+  },
+  after={%
+    \ifnum\PfMListeDesAjoutsdeLignes[\thePfMNbLignesFinitem]>0\relax\PfMPar\Lignespointilles{\PfMListeDesAjoutsdeLignes[\thePfMNbLignesFinitem]}\else\ifnum\PfMListeDesAjoutsdeLignes[\thePfMNbLignesFinitem]=1\relax\PfMPar\pointilles\fi\fi%
+    % fill for final item in list
+    \let\litem\olditem% restore standard definition of \item
+    \let\item\olditem
+    \setcounter{PfMProfondeur}{0}%
+  }%
+}%
+
+\setlist[Test,2]{%
+  leftmargin=*,
+  label=(\alph*),
+  before={%
+    \setcounter{PfMProfondeur}{2}%
+    \setcounter{PfMNbLignesFinitemi}{0}
+    \firstlegaltrue%
+    \def\Seconditem{\iffirstlegal\olditem\stepcounter{PfMNbLignesFinitemi}\firstlegalfalse\else%
+        \ifnum\PfMListeDesAjoutsdeLignesi[\thePfMNbLignesFinitemi]>1\relax\PfMPar\Lignespointilles{\PfMListeDesAjoutsdeLignesi[\thePfMNbLignesFinitemi]}\else\ifnum\PfMListeDesAjoutsdeLignesi[\thePfMNbLignesFinitemi]=1\relax\PfMPar\pointilles\fi
+      \fi%
+        \olditem\stepcounter{PfMNbLignesFinitemi}
+      \fi
+    }% new, temporary defition of \item
+    \let\litem\Seconditem
+    \let\item\litem
+  },
+  after={%
+    \ifnum\PfMListeDesAjoutsdeLignesi[\thePfMNbLignesFinitemi]>1\relax\PfMPar\Lignespointilles{\PfMListeDesAjoutsdeLignesi[\thePfMNbLignesFinitemi]}\else\ifnum\PfMListeDesAjoutsdeLignesi[\thePfMNbLignesFinitemi]=1\relax\PfMPar\pointilles\fi
+    \fi%
+%    % fill for final item in list
+    \let\litem\Primeitem%
+    \let\item\litem
+    \setcounter{PfMProfondeur}{1}%
+  }%
+}
+
+\newcounter{PfMNbLignesFinitem}
+\newcounter{PfMNbLignesFinitemi}
+\newcounter{PfMProfondeur}
+\setcounter{PfMProfondeur}{0}%
+
+\NewDocumentEnvironment{autoenumerate}{O{}m +b}{%
+  \setsepchar{,}\ignoreemptyitems%
+  \ifnum\thePfMProfondeur=0\relax%
+    \readlist*\PfMListeDesAjoutsdeLignes{#2}%
+  \else%
+    \readlist*\PfMListeDesAjoutsdeLignesi{#2}%
+  \fi%
+  \begin{Test}[#1]%
+    #3
+  \end{Test}%
 }{}%
\ No newline at end of file



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