texlive[72573] Master/texmf-dist: profmaquette (17oct24)
commits+karl at tug.org
commits+karl at tug.org
Thu Oct 17 21:22:40 CEST 2024
Revision: 72573
https://tug.org/svn/texlive?view=revision&revision=72573
Author: karl
Date: 2024-10-17 21:22:39 +0200 (Thu, 17 Oct 2024)
Log Message:
-----------
profmaquette (17oct24)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/latex/profmaquette/profmaquette-doc.pdf
trunk/Master/texmf-dist/doc/latex/profmaquette/profmaquette-doc.zip
trunk/Master/texmf-dist/tex/latex/profmaquette/ProfMaquette.sty
Modified: trunk/Master/texmf-dist/doc/latex/profmaquette/profmaquette-doc.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/latex/profmaquette/profmaquette-doc.zip
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/tex/latex/profmaquette/ProfMaquette.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/profmaquette/ProfMaquette.sty 2024-10-17 19:22:31 UTC (rev 72572)
+++ trunk/Master/texmf-dist/tex/latex/profmaquette/ProfMaquette.sty 2024-10-17 19:22:39 UTC (rev 72573)
@@ -2,9 +2,9 @@
% licence : Released under the LaTeX Project Public License v1.3c
% or later, see http://www.latex-project.org/lppl.txtf
\NeedsTeXFormat{LaTeX2e}%
-\def\filedate{2024/09/17}%
+\def\filedate{2024/10/16}%
\let\PfMfiledate\filedate%
-\def\fileversion{0.99}%
+\def\fileversion{0.99-g}%
\let\PfMfileversion\fileversion%
\ProvidesPackage{ProfMaquette}[\filedate\space v\fileversion\space Maquettage de documents]%
@@ -54,13 +54,18 @@
\makeatother
%définition des clés
\RequirePackage{simplekv}%
-\setKVdefault[Boulot]{Graine=1,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,EEpaisseur=0pt,ESansSaut=false,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é
+\setKVdefault[Boulot]{PixelArt=false,AMC=false,IntroductionAMC=false,Graine=1,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,EEpaisseur=0pt,ESansSaut=false,VersSolution=false,AvecEntrainement=false,Small=false,Footnotesize=false,Scriptsize=false,AllDirect=false,AllPouce=false,Input=false}%
\defKV[Boulot]{Colonnes=\setKV[Boulot]{CorrectionColonnes}}%
\defKV[Boulot]{EColonnes=\setKV[Boulot]{EntrainementColonnes}}%
+\setKVdefault[PixelArt]{Aleatoire=false,Landscape=false,CoupureTableau=false,Fichier={},Lettres={},Largeur={},Hauteur={},ListeCouleurs={},Solution=false,Theme=Essai,Arcenciel=false,LargeurTab=40pt}%
+\defKV[PixelArt]{CoupeTableau=\setKV[PixelArt]{CoupureTableau}}%
+%\defKV[PixelArt]{ListeNombres=\setKV[PixelArt]{Aleatoire}\setsepchar{,}\ignoreemptyitems\readlist*\ListePourLesItems{#1}\reademptyitems}
+\setKVdefault[AMC]{Date=\today,Classe={},Niveau={},Code=\jobname,NomExercice=Exercice,Theme=Numération,Calculatrice=false}%
\setKVdefault[Cours]{Couleur=Crimson,Theme=Trace \'ecrite,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}%
-\setKVdefault[Fiche]{Theme=Les nombres d\'ecimaux,Date=\today,Niveau=6,Classe={},Code={},NomExercice=Exercice,}%
+\setKVdefault[Beamer]{Theme=Les nombres d\'ecimaux,SousTheme={},Date=\today,Niveau=6,Classe={},Code={},NomExercice=Exercice,}%
+\setKVdefault[Fiche]{Theme=Les nombres d\'ecimaux,Date=\today,Niveau=6,Classe={},Code={},NomExercice=Exercice}%
\setKVdefault[PdT]{Theme=Les nombres d\'ecimaux,Date=\today,Niveau=6,Classe={},Code={},NomExercice=Exercice}%
\setKVdefault[FdR]{Theme=Les nombres d\'ecimaux,Date=\today,Niveau=6,Classe={},Code={},NomExercice=Exercice}%
\setKVdefault[Parcours]{Theme=Les nombres d\'ecimaux,Date=\today,Niveau=6,Classe={},Code={},NomExercice=Exercice,Vertical=false,Plan=false,Court=false}%
@@ -73,7 +78,8 @@
\setKVdefault[Kholle]{Sujet=1,Numero=1,Date=15,Niveau=TSI-1,Code=\jobname,Lieu=Lyc\'ee
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,Grilles=false,Cinq=false,Huit=false,TitreSol=false,NonUtilise=false,Profile=false,AEntretenir=false,Fragile=false,AvecIndications=false,ACompleter=false,Aide=0,Score=0,EchelleSeyes=8,Ajout={},TitreCorrige=Corrigé de l'exercice}%
+\setKVdefault[ClesExercices]{Open,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,Grilles=false,Cinq=false,Huit=false,TitreSol=false,NonUtilise=false,Profile=false,AEntretenir=false,Fragile=false,AvecIndications=false,ACompleter=false,Aide=0,Score=0,EchelleSeyes=8,Ajout={},TitreCorrige=Corrigé de l'exercice,Interieur=false}%
+%\defKV[ClesExercices]{AMCReponses=\ifboolKV[Boulot]{AMC}{\setKV[ClesExercices]{Open=false}}{}}%
\defKV[ClesExercices]{TitreSolution=\setKV[ClesExercices]{TitreSol}}%
\defKV[ClesExercices]{Source=\setKV[ClesExercices]{AffichageSource}}%
\defKV[ClesExercices]{Titre=\setKV[ClesExercices]{AffichageTitre}}%
@@ -89,7 +95,7 @@
\def\PfMTexteEncart{Indique ton travail ci-dessous.}%
\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=gray!70}%,Csv=false}%
+\setKVdefault[SchemaFdR]{Ecart=7mm,Colonnes=100,Rayon=2.5mm,Largeur=7.5mm,Hauteur=1cm,Couleur=gray!70}%,Csv=false}%
% Commande pour retenir le nombre d'exercices par maquette.Utile seulement pour la clé AssembleCorrection
\xdef\PfMRetiensLienExoMa{}%
\xdef\PfMRetiensLienDefMa{}%
@@ -143,6 +149,7 @@
}%
}%
% Definition de longueurs
+\newlength\PfMLargeurTableauPixelArt%
\newlength\PfMLargeurSchemaParcours%
\newlength\PfMRayonSchemaParcours%
\newlength\PfMLargeurSchemaContrat%
@@ -149,6 +156,7 @@
\newlength\PfMRayonSchemaContrat%
\newlength\PfMLargeurSchemaFdR%
\newlength\PfMRayonSchemaFdR%
+\newlength\PfMHauteurSchemaFdR%
\newlength\PfMHauteurAppreciation%
\newlength\PfMHauteurRemarque%
\newlength\PfMLargeurQuestion%
@@ -191,6 +199,9 @@
\setcounter{PfMSOS}{0}%
\newcounter{PfMAlea}%Pour repérer les valeurs aléatoires construites automatiquement
\setcounter{PfMAlea}{0}%
+%
+\newcounter{PfMNbListeReponsesAMC}%%Pour différencier les questions lors d'un exercice à plusieurs questions.
+\newcounter{PfMAMCOpen}%%Pour différencier les questions lors d'un exercice à plusieurs questions.
\newcounter{RetiensSol}%Pour l'affichage des solutions
\newcounter{RetiensRep}%Pour l'affichage des reponses.
\newcounter{RetiensInd}%Pour l'affichage des indices.
@@ -453,8 +464,8 @@
\RenewDocumentCommand\VariableAlea{s m m}{%
\IfBooleanTF{#1}{%
\stepcounter{PfMAlea}%
- \expandafter\xdef\csname valeur\Roman{PfMExo}\roman{PfMAlea}\endcsname{\fpeval{#3}}%
- \expandafter\xdef\csname #2\endcsname{\csname valeur\Roman{PfMExo}\roman{PfMAlea}\endcsname}%
+ \expandafter\xdef\csname valeur\Roman{PfMMaquette}\Roman{PfMExo}\roman{PfMAlea}\endcsname{\fpeval{#3}}%
+ \expandafter\xdef\csname #2\endcsname{\csname valeur\Roman{PfMMaquette}\Roman{PfMExo}\roman{PfMAlea}\endcsname}%
}{%
\xdef#2{\fpeval{#3}}%
}%
@@ -476,11 +487,11 @@
\IfBooleanTF{#1}{%
\stepcounter{PfMAlea}%
\IfNoValueTF{#2}{%
- \expandafter\xdef\csname valeur\Roman{PfMExo}\roman{PfMAlea}\endcsname{\fpeval{randint(#3,#4)}}%
- \expandafter\xdef\csname #5\endcsname{\csname valeur\Roman{PfMExo}\roman{PfMAlea}\endcsname}%
+ \expandafter\xdef\csname valeur\Roman{PfMMaquette}\Roman{PfMExo}\roman{PfMAlea}\endcsname{\fpeval{randint(#3,#4)}}%
+ \expandafter\xdef\csname #5\endcsname{\csname valeur\Roman{PfMMaquette}\Roman{PfMExo}\roman{PfMAlea}\endcsname}%
}{%
- \expandafter\xdef\csname valeur\Roman{PfMExo}\roman{PfMAlea}\endcsname{\fpeval{round(randint(#3,#4)+rand(),#2)}}%
- \expandafter\xdef\csname #5\endcsname{\csname valeur\Roman{PfMExo}\roman{PfMAlea}\endcsname}%
+ \expandafter\xdef\csname valeur\Roman{PfMMaquette}\Roman{PfMExo}\roman{PfMAlea}\endcsname{\fpeval{round(randint(#3,#4)+rand(),#2)}}%
+ \expandafter\xdef\csname #5\endcsname{\csname valeur\Roman{PfMMaquette}\Roman{PfMExo}\roman{PfMAlea}\endcsname}%
}%
}{%
\IfNoValueTF{#2}{%
@@ -522,7 +533,8 @@
\else%
\xdef\PfMMixFoo{#2}%
\setsepchar{,}\ignoreemptyitems%
- \readlist*\ListeValeursExclues{#4}%
+ \xdef\PfMMixFooEx{#4}%
+ \readlist*\ListeValeursExclues{\PfMMixFooEx}%
\xintFor* ##1 in{\xintSeq{\fpeval{#2+1}}{#3}}\do{%
\xdef\PfMMixFoo{\PfMMixFoo,##1}%
}%
@@ -537,8 +549,12 @@
\ignoreemptyitems%
\readlist*\ListeValeursRetenues{\PfMMixFoo}%
}%
- \MelangeListe{\PfMMixFoo}{#1}%
- \xdef#5{\faa}%
+ \ifnum\ListeValeursRetenueslen=1\relax%
+ \xdef#5{\PfMMixFoo}%
+ \else%
+ \MelangeListe{\PfMMixFoo}{#1}%
+ \xdef#5{\faa}%
+ \fi%
\fi%
}%
@@ -697,7 +713,8 @@
\xdef\PfCRetiensRetenues{}%
\xdef\PfMMixFoo{#2,#3}%
\setsepchar{,}\ignoreemptyitems%
- \readlist*\ListeValeursExclues{#4}%
+ \xdef\PfMMixFooExclues{#4}%
+ \readlist*\ListeValeursExclues{\PfMMixFooExclues}%
\xintFor* ##1 in{\xintSeq{\fpeval{#2+1}}{\fpeval{#3-1}}}\do{%
\xdef\PfCRetiensExclues{0}%
\xintFor* ##2 in{\xintSeq{1}{\ListeValeursExclueslen}}\do{%
@@ -835,7 +852,7 @@
\NewDocumentCommand\RestoreChoixAlea{m}{%
\stepcounter{PfMAlea}%
%Je restaure la valeur \thePfMExoSol-\thePfMAlea
- \expandafter\xdef\csname #1\endcsname{\csname valeur\Roman{PfMExoSol}\roman{PfMAlea}\endcsname}%
+ \expandafter\xdef\csname #1\endcsname{\csname valeur\Roman{PfMMaquette}\Roman{PfMExoSol}\roman{PfMAlea}\endcsname}%
}%
\NewDocumentCommand\ExporteListe{mm}{%
@@ -842,14 +859,14 @@
%#1 le nom de la liste
%#2 le contenu de la liste.
\stepcounter{PfMAlea}%
- \expandafter\xdef\csname Liste\Roman{PfMExo}\roman{PfMAlea}\endcsname{#2}%
- \expandafter\xdef\csname #1\endcsname{\csname Liste\Roman{PfMExo}\roman{PfMAlea}\endcsname}%
+ \expandafter\xdef\csname Liste\Roman{PfMMaquette}\Roman{PfMExo}\roman{PfMAlea}\endcsname{#2}%
+ \expandafter\xdef\csname #1\endcsname{\csname Liste\Roman{PfMMaquette}\Roman{PfMExo}\roman{PfMAlea}\endcsname}%
}%
\NewDocumentCommand\RestoreListe{m}{%
%#1 le nom de la liste à restaurer
\stepcounter{PfMAlea}%
- \expandafter\xdef\csname #1\endcsname{\csname Liste\Roman{PfMExoSol}\roman{PfMAlea}\endcsname}%
+ \expandafter\xdef\csname #1\endcsname{\csname Liste\Roman{PfMMaquette}\Roman{PfMExoSol}\roman{PfMAlea}\endcsname}%
}%
%%
@@ -1073,22 +1090,20 @@
\NewDocumentEnvironment{Indications}{+b}{%
\ifnum\theRetiensIndic=1\relax%
\textbf{\PfMTexteDesIndications :}\par%
- \else%
- \begin{PfMHide}%
+ #1
\fi%
- #1
}{%
- \ifnum\theRetiensIndic=1\relax%
- \else
- \end{PfMHide}%
- \fi%
}%
+\makeatletter
\NewDocumentCommand\PfMChoixAffichageCorrection{}{%
+ \if at AssembleCorrections
+ \let\Solution\SolutionWrite\let\endSolution\endSolutionWrite
+ \fi
\ifboolKV[Boulot]{CorrigeAll}{%
- \let\Solution\SolutionWrite\let\endSolution\endSolutionWrite
- \let\Reponse\ReponseWrite\let\endReponse\endReponseWrite
- \let\Indice\IndiceWrite\let\endIndice\endIndiceWrite
+ \let\Solution\SolutionWrite\let\endSolution\endSolutionWrite
+ \let\Reponse\ReponseWrite\let\endReponse\endReponseWrite
+ \let\Indice\IndiceWrite\let\endIndice\endIndiceWrite
}{%
\ifboolKV[Boulot]{ParcoursPerso}{%
\let\Solution\SolutionWritePP\let\endSolution\endSolutionWritePP
@@ -1128,11 +1143,16 @@
}%
}%
}%
+\makeatother
+\makeatletter
\NewDocumentCommand\PfMChoixCorrection{}{%
\setcounter{RetiensSol}{0}%
\setcounter{RetiensRep}{0}%
\setcounter{RetiensInd}{0}%
+ \if at AssembleCorrections
+ \setcounter{RetiensSol}{1}%
+ \else
\ifboolKV[Boulot]{CorrigeFin}{%
% \ifboolKV[Boulot]{CorrigeAll}{%
% \setcounter{RetiensSol}{1}%
@@ -1149,6 +1169,7 @@
\setcounter{RetiensInd}{0}%
}{}%
}%
+ \fi
\ifboolKV[ClesExercices]{PasCorrige}{%
\setcounter{RetiensSol}{0}%
\setcounter{RetiensRep}{0}%
@@ -1167,6 +1188,7 @@
}%
}%
}%
+\makeatother
\NewDocumentCommand\PfMChoixEntrainement{}{%
\setcounter{PfMRetiensQr}{0}%
@@ -1215,8 +1237,10 @@
\setsepchar{,}\ignoreemptyitems%
\readlist*\ListeNombreExoMq{\PfMRetiensLienExoMa}%
\reademptyitems%
- \xintFor* ##2 in{\xintSeq{1}{\thePfMMaquette}}\do{%
+ \xdef\Tototaltal{\thePfMMaquette}%
+ \xintFor* ##2 in{\xintSeq{1}{\Tototaltal}}\do{%
\refstepcounter{PfMMaquetteSol}%
+ \setcounter{PfMMaquette}{##2}%
\setcounter{PfMExoSol}{0}%
%\setcounter{PfMExoSolAlea}{0}%
\ifPfMRectoVerso%
@@ -1224,7 +1248,7 @@
\else%
\clearpage%
\fi%
- \input{\jobname-DefiMq-##2}
+ \input{\jobname-DefiMq-\thePfMMaquette}%
\ifboolKV[Boulot]{CorrectionColonnes}{\begin{multicols}{\useKV[Boulot]{Colonnes}}}{}%
\xintFor* ##1 in{\xintSeq{1}{\ListeNombreExoMq[##2]}}\do{%
\stepcounter{PfMExoSol}%
@@ -1584,7 +1608,8 @@
}%
}{%
\ifboolKV[ClesExercices]{NonUtilise}{\end{PfMHide}}{%
- \ifboolKV[Boulot]{CorrigeSeul}{}{
+ \ifboolKV[Boulot]{CorrigeSeul}{}{%
+ \PfMJusteAvantLaFinDesExercices%
\end{tcolorbox}%
\PfMApresLesExercices%
}%
@@ -1754,7 +1779,8 @@
}%
}{%
\ifboolKV[ClesExercices]{NonUtilise}{\end{PfMHide}}{%
- \ifboolKV[Boulot]{CorrigeSeul}{}{%
+ \ifboolKV[Boulot]{CorrigeSeul}{}{%
+ \PfMJusteAvantLaFinDesExercices%
\end{tcolorbox}
\PfMApresLesExercices%
}%
@@ -1831,6 +1857,7 @@
\setKV[SchemaFdR]{#1}%
\setlength{\PfMLargeurSchemaFdR}{\useKV[SchemaFdR]{Ecart}}%
\setlength{\PfMRayonSchemaFdR}{\useKV[SchemaFdR]{Rayon}}%
+ \setlength{\PfMHauteurSchemaFdR}{\useKV[SchemaFdR]{Hauteur}}%
\colorlet{PfMCouleurFdR}{\useKV[SchemaFdR]{Couleur}}%
\@ifundefined{Op@\Roman{PfMMaquette}-FdRTotalExo}{Recompilez pour obtenir la feuille de route.}%
{%
@@ -1978,7 +2005,7 @@
\begin{tikzpicture}
\coordinate (A-0) at (-\PfMLargeurSchemaFdR,0);
\coordinate (A-1) at (0,0);%
- \coordinate (B-1) at (0,1);%
+ \coordinate (B-1) at (0,\PfMHauteurSchemaFdR);%
\xintFor* ##1 in{\xintSeq{2}{\ListeRouteBasselen}}\do{%
\coordinate[xshift=\PfMLargeurSchemaFdR] (A-##1) at (A-\fpeval{##1-1});%
\coordinate[xshift=\PfMLargeurSchemaFdR] (B-##1) at (B-\fpeval{##1-1});%
@@ -2126,7 +2153,8 @@
}%
}{%
\ifboolKV[ClesExercices]{NonUtilise}{\end{PfMHide}}{%
- \ifboolKV[Boulot]{CorrigeSeul}{}{%
+ \ifboolKV[Boulot]{CorrigeSeul}{}{%
+ \PfMJusteAvantLaFinDesExercices%
\end{tcolorbox}
\PfMApresLesExercices%
}%
@@ -2480,7 +2508,8 @@
}%
}{%
\ifboolKV[ClesExercices]{NonUtilise}{\end{PfMHide}}{%
- \ifboolKV[Boulot]{CorrigeSeul}{}{%
+ \ifboolKV[Boulot]{CorrigeSeul}{}{%
+ \PfMJusteAvantLaFinDesExercices%
\end{tcolorbox}
\PfMApresLesExercices%
}%
@@ -2667,26 +2696,53 @@
\end{center}
}%
-\NewDocumentCommand\PfMApresLesExercices{}{%
- \ifboolKV[ClesExercices]{Ligne}{%
- \vspace*{\PfMEspaceAvantLignes}%
- \PfMSetStretch\PfMLignespointilles{\useKV[ClesExercices]{Lignes}}%
- \par\vspace*{\PfMEspaceApresLignes}\par%
- }{}%
- \par%
- \ifboolKV[ClesExercices]{Cadres}{%
- \begin{PfMtcbEncart}%
- %
- \end{PfMtcbEncart}%
- }{}%
- \ifboolKV[ClesExercices]{Grilles}{%
+\NewDocumentCommand\PfMJusteAvantLaFinDesExercices{}{%
+ \ifboolKV[ClesExercices]{Interieur}{%
+ \ifboolKV[ClesExercices]{Ligne}{%
+ \vspace*{\PfMEspaceAvantLignes}\par%
+ \PfMSetStretch%
+ \PfMLignespointilles{\useKV[ClesExercices]{Lignes}}%
+ \par\vspace*{\PfMEspaceApresLignes}\par%
+ }{}%
+ \par%
+ \ifboolKV[ClesExercices]{Cadres}{%
+ \begin{PfMtcbEncart}%
+ %
+ \end{PfMtcbEncart}%
+ }{}%
+ \ifboolKV[ClesExercices]{Grilles}{%
\ifboolKV[ClesExercices]{Cinq}{%
- \PfMPapierCinqCinq{\useKV[ClesExercices]{CinqCinq}}{\useKV[ClesExercices]{Score}}%
+ \PfMPapierCinqCinq{\useKV[ClesExercices]{CinqCinq}}{\useKV[ClesExercices]{Score}}%
+ }{}%
+ \ifboolKV[ClesExercices]{Huit}{%
+ \PfMPapierSeyes{\useKV[ClesExercices]{Seyes}}{\useKV[ClesExercices]{Score}}%
+ }{}%
}{}%
- \ifboolKV[ClesExercices]{Huit}{%
- \PfMPapierSeyes{\useKV[ClesExercices]{Seyes}}{\useKV[ClesExercices]{Score}}%
+ }{}%
+}%
+
+\NewDocumentCommand\PfMApresLesExercices{}{%
+ \ifboolKV[ClesExercices]{Interieur}{}{%
+ \ifboolKV[ClesExercices]{Ligne}{%
+ \vspace*{\PfMEspaceAvantLignes}%
+ \PfMSetStretch\PfMLignespointilles{\useKV[ClesExercices]{Lignes}}%
+ \par\vspace*{\PfMEspaceApresLignes}\par%
}{}%
- }{}%
+ \par%
+ \ifboolKV[ClesExercices]{Cadres}{%
+ \begin{PfMtcbEncart}%
+ %
+ \end{PfMtcbEncart}%
+ }{}%
+ \ifboolKV[ClesExercices]{Grilles}{%
+ \ifboolKV[ClesExercices]{Cinq}{%
+ \PfMPapierCinqCinq{\useKV[ClesExercices]{CinqCinq}}{\useKV[ClesExercices]{Score}}%
+ }{}%
+ \ifboolKV[ClesExercices]{Huit}{%
+ \PfMPapierSeyes{\useKV[ClesExercices]{Seyes}}{\useKV[ClesExercices]{Score}}%
+ }{}%
+ }{}
+ }%
\ifboolKV[ClesExercices]{Profile}{\PfMshowitems}{}%
\ifboolKV[ClesExercices]{ACompleter}{%
\IfHookExistsTF{env/center/begin}{\RemoveFromHook{env/center/begin}[*]}{}%
@@ -2795,9 +2851,9 @@
}%
}{%
\ifboolKV[ClesExercices]{NonUtilise}{\end{PfMHide}}{%
- \ifboolKV[Boulot]{CorrigeSeul}{}{
+ \ifboolKV[Boulot]{CorrigeSeul}{}{%
+ \PfMJusteAvantLaFinDesExercices%
\end{tcolorbox}%
- % \ifboolKV[ClesExercices]{Profile}{\PfMshowitems}{}%
\PfMApresLesExercices%
}%
}%
@@ -2838,10 +2894,10 @@
\IfBooleanTF{#1}{%
\setKV[ClesExercices]{Numerote=false}%
}{}%
+ \colorlet{ColExoFiche}{\useKV[ClesExercices]{Background}}%
\PfMAvantLesExercices%
\refstepcounter{PfMSection}%
\PfMChoixCorrection%
- \refstepcounter{PfMExo}%
\ifboolKV[Boulot]{CorrigeSeul}{}{%
\PfMChoixTitreSolution%
\PfMChoixHideItemSolution%
@@ -2855,6 +2911,7 @@
}%
}{%
\ifboolKV[ClesExercices]{NonUtilise}{\end{PfMHide}}{%
+ \PfMJusteAvantLaFinDesExercices%
\end{tcolorbox}%
%\ifboolKV[ClesExercices]{Profile}{\PfMshowitems}{}%
\PfMApresLesExercices%
@@ -2898,6 +2955,7 @@
}{%
\ifboolKV[ClesExercices]{NonUtilise}{\end{PfMHide}}{%
\ifboolKV[Boulot]{CorrigeSeul}{}{%
+ \PfMJusteAvantLaFinDesExercices%
\end{tcolorbox}%
\PfMApresLesExercices%
}%
@@ -2932,6 +2990,7 @@
]
\ifboolKV[Boulot]{Dys}{\raggedright}{}%
}{%
+ \PfMJusteAvantLaFinDesExercices%
\end{tcolorbox}
\PfMApresLesExercices%
}%
@@ -3528,7 +3587,6 @@
enhanced,
breakable,
colback=ColExoFiche,
- % colframe=PfMCadreFiche,
frame hidden,
overlay unbroken and first={%
\draw[colLogo,line width=1pt] ([yshift=-12pt]frame.north west)--([yshift=-12pt]frame.north east);
@@ -3537,7 +3595,7 @@
fill=ColExoFiche,
anchor=west,
xshift=\kvtcb at leftlower,
- ] at (frame.north west){\color{colLogo}\resizebox{1em}{!}{\carreEntoure{}}~\Large\bfseries\sffamily\useKV[Fiche]{NomExercice}\ifboolKV[ClesExercices]{Numerote}{ \thePfMExo}{}\ifboolKV[ClesExercices]{AffichageTitre}{\ifboolKV[ClesExercices]{Numerote}{.~}{\xdef\PfMTitiLgNE{\useKV[Fiche]{NomExercice}}\IfStrEq{\PfMTitiLgNE}{}{}{.~}}\useKV[ClesExercices]{Titre}}{}};
+ ] at (frame.north west){\color{colLogo}\resizebox{1em}{!}{\carreEntoure{}}~\thePfMExo\Large\bfseries\sffamily\useKV[Fiche]{NomExercice}\ifboolKV[ClesExercices]{Numerote}{ \thePfMExo}{}\ifboolKV[ClesExercices]{AffichageTitre}{\ifboolKV[ClesExercices]{Numerote}{.~}{\xdef\PfMTitiLgNE{\useKV[Fiche]{NomExercice}}\IfStrEq{\PfMTitiLgNE}{}{}{.~}}\useKV[ClesExercices]{Titre}}{}};
%%
\useKV[ClesExercices]{Ajout}%
%%
@@ -3641,7 +3699,7 @@
\end{tcolorbox}%
}%
-\newcommand\TikzDSCor[1]{%
+\NewDocumentCommand\TikzDSCor{m}{%
\ifPfMRectoVerso%
\cleardoublepage%
\else%
@@ -3923,6 +3981,419 @@
\makeatother
%%%%
+\NewDocumentEnvironment{exerciceBeamer}{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}%
+ }{}%
+ \colorlet{ColExoFiche}{\useKV[ClesExercices]{Background}}%
+ \colorlet{PfMCadreFiche}{\useKV[ClesExercices]{Cadre}}%
+ \setKV[ClesExercices]{BaremeTotal=false,BaremeDetaille=false}%
+ \PfMAvantLesExercices%
+ \ifboolKV[Boulot]{CorrigeSeul}{}{%
+ \PfMChoixTitreSolution%
+ \PfMChoixHideItemSolution%
+ \begin{tcolorbox}[%
+ tikzbeamer,
+ label is label,
+ label=page-\thePfMMaquette-\thePfMExo
+ ]
+ \ifboolKV[Boulot]{Dys}{\raggedright}{}%
+ }%
+ }%
+ }{%
+ \ifboolKV[ClesExercices]{NonUtilise}{\end{PfMHide}}{%
+ \ifboolKV[Boulot]{CorrigeSeul}{}{%
+ \PfMJusteAvantLaFinDesExercices%
+ \end{tcolorbox}%
+ % \ifboolKV[ClesExercices]{Profile}{\PfMshowitems}{}%
+ \PfMApresLesExercices%
+ }%
+ }%
+}%
+
+\makeatletter
+\tcbset{%
+ tikzbeamer/.style={%
+ before skip=0.5em,
+ enhanced,
+ breakable,
+ colback=white,%ColExoFiche,
+ frame hidden,
+ %colframe=PfMCadreFiche,
+ overlay unbroken and first={%
+ \node[%
+ name=A,
+ anchor=center,
+ xshift=8*\kvtcb at leftlower/10,
+ yshift=-10*\kvtcb at leftlower/9,
+ ] at (frame.north west){\thePfMExo};
+ %%
+ \useKV[ClesExercices]{Ajout}%
+ %%
+ \PfMAffichageSource%
+ }%
+ }%
+}%
+\makeatother
+
+%%%%%%%%%%%%%%%%% AMC
+
+\def\PfMTexteAMC{\scriptsize Pour chaque question, remplir avec un stylo {\em noir} la case associée à {\em l'unique} réponse correcte.\par En cas d'erreur, {\em ne redessiner pas} la case cochée par erreur, mettez simplement un coup de « blanc » dessus.}
+
+\newcommand\TikzAMC{%
+ \begin{tcolorbox}[%
+ colback=LightGray!10,
+ colframe=LightGray,
+ enhanced,%
+ overlay unbroken and first={%
+ \ifboolKV[AMC]{Calculatrice}{\node[yshift=1em] at (frame.south) {\scriptsize\sffamily-- Calculatrice autorisée --};}{}%
+ }%
+ ]%
+ \sffamily \useKV[AMC]{Theme}
+ \vspace{1em}
+ \par\hfill{\scriptsize\useKV[AMC]{Date}}
+ \end{tcolorbox}%
+ \ifboolKV[Boulot]{IntroductionAMC}{\PfMTexteAMC}{}%
+ \par\bigskip%
+}%
+
+\NewDocumentCommand\ListeReponses{sm}{%
+ \ifboolKV[Boulot]{AMC}{%
+ \setsepchar{,}\ignoreemptyitems%
+ \readlist*\ListeAMCRep{#2}%
+ \reademptyitems%
+ \setcounter{PfMAMCOpen}{1}%
+ \stepcounter{PfMNbListeReponsesAMC}%
+ \par
+ \ifnum\fpeval{\ListeAMCReplen}=1\relax%
+ \begin{questionmultx}{\Roman{PfMExo}\roman{PfMNbListeReponsesAMC}}
+ \IfInteger{\ListeAMCRep[1]}{%
+ \itemtomacro\ListeAMCRep[1]\Toto%
+ \StrLen{\fpeval{abs(\Toto)}}[\PfMLongueurCaseAMC]%
+ \IfBooleanTF{#1}{%
+ \AMCnumericChoices{\fpeval{\ListeAMCRep[1]}}{digits=\PfMLongueurCaseAMC,sign,borderwidth=0pt,backgroundcol=gray!20,scoreexact=1,hspace=0.25em,vspace=0ex}%
+ }{%
+ \AMCnumericChoices{\fpeval{\ListeAMCRep[1]}}{digits=\PfMLongueurCaseAMC,sign=false,borderwidth=0pt,backgroundcol=gray!20,scoreexact=1,hspace=0.25em,vspace=0ex}%
+ }%
+ }{%
+ \itemtomacro\ListeAMCRep[1]\Toto%
+ \StrCut{\Toto}{.}{\TotoAv}{\TotoAp}%
+ \StrLen{\fpeval{abs(\TotoAv)}}[\PfMLongueurCaseAMCAv]%
+ \StrLen{\TotoAp}[\PfMLongueurCaseAMCAp]%
+ \IfBooleanTF{#1}{%
+ \AMCnumericChoices{\fpeval{\ListeAMCRep[1]}}{digits=\fpeval{\PfMLongueurCaseAMCAv+\PfMLongueurCaseAMCAp},decimals=\PfMLongueurCaseAMCAp,sign,Tpoint={,},borderwidth=0pt,backgroundcol=gray!20,scoreexact=1,hspace=0.25em,vspace=0ex}%
+ }{%
+ \AMCnumericChoices{\fpeval{\ListeAMCRep[1]}}{digits=\fpeval{\PfMLongueurCaseAMCAv+\PfMLongueurCaseAMCAp},decimals=\PfMLongueurCaseAMCAp,sign=false,Tpoint={,},borderwidth=0pt,backgroundcol=gray!20,scoreexact=1,hspace=0.25em,vspace=0ex}%
+ }%
+ }%
+ \end{questionmultx}
+ \else%
+ \begin{question}{\Roman{PfMExo}\roman{PfMNbListeReponsesAMC}}
+ \ifPfMDeuxColonnes
+ \begin{reponses}%
+ \bonne{\ListeAMCRep[1]}%
+ \xintFor* ##1 in{\xintSeq{2}{\ListeAMCReplen}}\do{%
+ \mauvaise{\ListeAMCRep[##1]}%
+ }%
+ \end{reponses}%
+ \else
+ \begin{reponseshoriz}%
+ \bonne{\ListeAMCRep[1]}%
+ \xintFor* ##1 in{\xintSeq{2}{\ListeAMCReplen}}\do{%
+ \mauvaise{\ListeAMCRep[##1]}%
+ }%
+ \end{reponseshoriz}%
+ \fi
+ \end{question}
+ \fi
+ }{}%
+}%
+
+\makeatletter
+\tcbset{%
+ tikzamc/.style={%
+ before skip=0em,
+ bottom=0pt,
+ enhanced,
+ breakable,
+ colback=white,
+ frame hidden,
+ overlay unbroken and first={%
+ \node[%
+ name=A,
+ fill=white,
+ anchor=west,
+ %xshift=\kvtcb at leftlower,
+ ] at (frame.north west){\bfseries\sffamily\useKV[AMC]{NomExercice}\ifboolKV[ClesExercices]{Numerote}{ \thePfMExo}{}\ifboolKV[ClesExercices]{AffichageTitre}{\ifboolKV[ClesExercices]{Numerote}{~:~}{\xdef\PfMTitiLgNE{\useKV[Fiche]{NomExercice}}\IfStrEq{\PfMTitiLgNE}{}{}{~:~}}\useKV[ClesExercices]{Titre}}{}};
+ %%
+ \useKV[ClesExercices]{Ajout}%
+% %%
+ }%
+ }%
+}%
+\makeatother
+
+\def\PfMScoreA{5}%
+\def\PfMScoreB{3}%
+\def\PfMScoreC{1}%
+\def\PfMScoreD{0.1}%
+
+\NewDocumentEnvironment{exerciceAmc}{o}{%
+ \setcounter{PfMNbLogo}{1}%
+ \setcounter{PfMAMCOpen}{0}%
+ \useKVdefault[ClesExercices]%
+ \setKV[ClesExercices]{#1}%
+ \ifboolKV[Boulot]{Input}{\Relecture}{}%
+ \PfMAvantLesExercices%
+ \begin{tcolorbox}[tikzamc]%
+ }{%
+ \ifnum\thePfMAMCOpen=0\relax
+ \PfMApresLesExercices
+ \par
+ \begin{question}{\Roman{PfMExo}}
+ \AMCOpen{lineup=true,lineuptext=~,dots=false,backgroundcol=gray!20}{\mauvaise[RR]{RR}\scoring{\PfMScoreD}\mauvaise[R]{R}\scoring{\PfMScoreC}\mauvaise[V]{V}\scoring{\PfMScoreB}\bonne[VV]{VV}\scoring{\PfMScoreA}}%gray!15
+ \end{question}%
+ \fi
+ \end{tcolorbox}%
+}%
+
+%%%%%%%%%%%%%%%%% Fin AMC
+
+%%% PixelArt
+\newtoks\ToksPXTheme%
+\newtoks\ToksPXNiveau%
+\def\UpdateToksPXNiveau#1\nil{\addtotok\ToksPXNiveau{#1}}%
+\def\UpdateToksPXTheme#1\nil{\addtotok\ToksPXTheme{#1}}%
+
+\NewDocumentCommand\PfMPXCount{}{%
+ \stepcounter{PfMLettresPixelArt}%
+ \xdef\PfMCountPX{\csname p\Alph{PfMLettresPixelArt}\endcsname}%
+ \PfMCountPX%
+}%
+
+\newcounter{PfMLettresPixelArt}
+
+\NewDocumentCommand\MPPixelArt{mm}{
+ \mplibforcehmode
+ \begin{mplibcode}
+ path carre[];
+
+ u:=0.5mm;
+
+ color ColorEntier[],ColFond;
+
+ vardef BlocAffichage=
+ for k=0 upto 34:
+ carre[k]:=(unitsquare scaled u) shifted(u*(k mod 5,5-(k div 5)));
+ endfor;
+ enddef;
+
+ vardef Affichage(expr decomp)=
+ save $;
+ picture $;
+ drawoptions(withpen pensquare scaled0.1);
+ $=image(%
+ for k=0 upto 34:
+ if (substring(k,k+1) of decomp)="1":
+ fill carre[k] withcolor ColFond;
+ fi;
+ endfor;
+ );
+ drawoptions();
+ $
+ enddef;
+
+ nblignes:=1;
+
+ decahoriz:=0;
+
+ vardef Test(expr cptk)(text cptnt)=
+ pair Decalage;
+ Decalage=u*(decahoriz,-8*(nblignes-1));
+ decahoriz:=decahoriz+6;
+ if substring(cptk,cptk+1) of cptnt="A":draw Affichage("01110100011000110001111111000110001") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt="B":draw Affichage("11110100011000111110100011000111110") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt="C":draw Affichage("01110100011000010000100001000101110") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt="D":draw Affichage("11100100101000110001100011001011100") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt="E":draw Affichage("11111100001000011111100001000011111") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt="F":draw Affichage("11111100001000011111100001000010000") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt="G":draw Affichage("01110100011000010111100011000101110") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt="H":draw Affichage("10001100011000111111100011000110001") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt="I":draw Affichage("01110001000010000100001000010001110") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt="J":draw Affichage("00111000100001000010000101001001100") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt="K":draw Affichage("10001100101010011000101001001010001") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt="L":draw Affichage("10000100001000010000100001000011111") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt="M":draw Affichage("10001110111010110101100011000110001") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt="N":draw Affichage("10001100011100110101100111000110001") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt="O":draw Affichage("01110100011000110001100011000101110") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt="P":draw Affichage("11110100011000111110100001000010000") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt="Q":draw Affichage("01110100011000110001101011001001101") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt="R":draw Affichage("11110100011000111110101001001010001") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt="S":draw Affichage("01111100001000001110000010000111110") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt="T":draw Affichage("11111001000010000100001000010000100") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt="U":draw Affichage("10001100011000110001100011000101110") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt="V":draw Affichage("10001100011000110001100010101000100") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt="W":draw Affichage("10101101011010110101101011010101010") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt="X":draw Affichage("10001100010101000100010101000110001") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt="Y":draw Affichage("10001100011000101010001000010000100") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt="Z":draw Affichage("11111000010001000100010001000011111") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt="a":draw Affichage("00000000000111100001011111000101111") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt="b":draw Affichage("10000100001011011001100011000111110") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt="c":draw Affichage("00000000000111010000100001000101110") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt="d":draw Affichage("00001000010110110011100011000101111") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt="e":draw Affichage("00000000000111010001111111000001110") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt="f":draw Affichage("00110010010100011100010000100001000") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt="g":draw Affichage("00000011111000110001011110000101110") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt="h":draw Affichage("10000100001011011001100011000110001") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt="i":draw Affichage("00100000000110000100001000010001110") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt="j":draw Affichage("00010000000011000010000101001001100") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt="k":draw Affichage("10000100001001010100110001010010010") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt="l":draw Affichage("01100001000010000100001000010001110") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt="m":draw Affichage("00000000001101010101101011000110001") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt="n":draw Affichage("00000000001011011001100011000110001") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt="o":draw Affichage("00000000000111010001100011000101110") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt="p":draw Affichage("00000000001111010001111101000010000") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt="q":draw Affichage("00000000000110110011011110000100001") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt="r":draw Affichage("00000000001011011001100001000010000") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt="s":draw Affichage("00000000000111010000011100000111110") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt="t":draw Affichage("01000010001110001000010000100100110") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt="u":draw Affichage("00000000001000110001100011001101101") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt="v":draw Affichage("00000000001000110001100010111000100") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt="w":draw Affichage("00000000001010110101101011010101110") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt="x":draw Affichage("00000000001000101010001000101010001") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt="y":draw Affichage("00000000001000110001011110000101110") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt="z":draw Affichage("00000000001111100010001000100011111") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt="0":draw Affichage("01110100011001110101110011000101110") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt="1":draw Affichage("00100011000010000100001000010001110") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt="2":draw Affichage("01110100010000100010001000100011111") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt="3":draw Affichage("11111000100010000010000011000101110") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt="4":draw Affichage("00010001100101010010111110001000010") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt="5":draw Affichage("11111100001111000001000011000101110") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt="6":draw Affichage("00110010001000011110100011000101110") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt="7":draw Affichage("11111000010001000100010000100001000") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt="8":draw Affichage("01110100011000101110100011000101110") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt="9":draw Affichage("01110100011000101111000010001001100") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt="!":draw Affichage("00100001000010000100000000000000100") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt="'":draw Affichage("01100001000100000000000000000000000") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt="(":draw Affichage("00010001000100001000010000010000010") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt=")":draw Affichage("01000001000001000010000100010001000") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt="*":draw Affichage("00000001001010101110101010010000000") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt="+":draw Affichage("00000001000010011111001000010000000") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt="-":draw Affichage("00000000000000011111000000000000000") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt=".":draw Affichage("00000000000000000000000000110001100") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt=":":draw Affichage("00000011000110000000011000110000000") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt=";":draw Affichage("00000011000110000000011000010001000") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt="<":draw Affichage("00010001000100010000010000010000010") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt="=":draw Affichage("00000000001111100000111110000000000") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt=">":draw Affichage("10000010000010000010001000100010000") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt="?":draw Affichage("01110100010000100010001000000000100") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt="[":draw Affichage("01110010000100001000010000100001110") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt="]":draw Affichage("01110000100001000010000100001001110") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt="`":draw Affichage("01000001000001000000000000000000000") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt="|":draw Affichage("00100001000010000100001000010000100") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt=" ":draw Affichage("00000000000000000000000000000000000") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt="&":draw Affichage("00000100001100011100110001000000000") shifted(Decalage);
+% elseif substring(cptk,cptk+1) of cptnt="$":draw Affichage("00000000000000100001000010000111111") shifted(Decalage);
+% elseif substring(cptk,cptk+1) of cptnt="^":draw Affichage("00100010101000100000000000000000000") shifted(Decalage);
+ elseif substring(cptk,cptk+1) of cptnt="_":draw Affichage("00000000000000000000000000000000000") shifted(Decalage);
+% elseif substring(cptk,cptk+1) of cptnt="~":draw Affichage("01000010000111001000010000100001000") shifted(Decalage);
+ fi;
+enddef;
+
+vardef LCDSeul(text nt)=
+ decahoriz:=0;
+ ColFond:=black;
+ if length(nt)>0:
+ for k=0 upto length(nt)-1:
+ BlocAffichage;
+ Test(k,nt);
+ endfor;
+ fi;
+ enddef;
+
+ picture TestLCD;
+ TestLCD=image(
+ LCDSeul(#1);
+ );
+ bboxmargin:=3u;
+ maxlarg=abs(lrcorner bbox TestLCD - llcorner bbox TestLCD)/u;
+ maxhaut=abs(urcorner bbox TestLCD - lrcorner bbox TestLCD)/u;
+ for k=0 upto maxlarg-1:
+ for l=0 upto maxhaut-1:
+ draw (unitsquare scaled u) shifted(llcorner bbox TestLCD+u*(k,l)) withcolor 0.8white;
+ endfor;
+ endfor;
+ draw bbox TestLCD;
+
+ draw TestLCD;
+ picture Retiens;
+ Retiens=currentpicture;
+ currentpicture:=nullpicture;
+ draw Retiens scaled 2;
+ \end{mplibcode}
+}%
+
+\NewDocumentCommand\TikzPixelArt{}{%
+ \ToksPXNiveau{}%
+ \xdef\Titi{"Classe de \useKV[PixelArt]{Niveau}"}%
+ \expandafter\UpdateToksPXNiveau\Titi\nil%
+ \ToksPXTheme{}%
+ \xdef\Toto{"\useKV[PixelArt]{Theme}"}%
+ \expandafter\UpdateToksPXTheme\Toto\nil%
+ \xdef\ListeAvantCouleurs{\useKV[PixelArt]{ListeCouleurs}}%
+ \begin{center}
+ \MPPixelArt{\the\ToksPXTheme}{\ListeAvantCouleurs}%
+ \end{center}
+}%
+
+\newcounter{PfMPX}[PfMMaquette]
+\setcounter{PfMPX}{0}
+
+\NewDocumentCommand\PfMSolPixelArt{m}{%
+ \ifboolKV[Boulot]{PixelArt}{%
+ \stepcounter{PfMLettresPixelArt}%
+ \ifboolKV[PixelArt]{Aleatoire}{%
+ \hfill\textbf{Lettre \ListePourLesItems[\fpeval{\thePfMLettresPixelArt+1}]}%
+ %Num Lettre = \thePfMLettresPixelArt
+ }{%
+ \hfill\textbf{Lettre \Alph{PfMLettresPixelArt}}%
+ }%
+ \ifdef{\ListeSolAv}{%
+ \xdef\ListeSolAv{\ListeSolAv,#1}%
+ }{%
+ \xdef\ListeSolAv{#1}%
+ }%
+ }{}%
+}%
+
+\NewDocumentEnvironment{exercicePX}{o}{%
+ \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}%
+}{}
+%%% Fin PixelArt
+
+\def\PfMLogoBeamer{}
+
%%%%%%%%%%%%%%% Debut Maquette %%%%%%%
% Environnement englobant le tout.
\makeatletter
@@ -3931,34 +4402,46 @@
\IfClassLoadedTF{beamer}{%
%-> tex.stackexchange.com/questions/605282/beamer-custom-frame-environment-with-options
\NewDocumentEnvironment{Maquette}{om}{%
+ \ifcsname PfMGraineBeamer\endcsname%
+ \setKVdefault[Boulot]{Graine=\fpeval{\PfMGraineBeamer+\thePfMMaquette}}%
+ \else%
+ \def\PfMGraineBeamer{\fpeval{randint(1000)}}%
+ \fi%
+ \immediate\write\@auxout{\noexpand\expandafter\gdef\noexpand\csname PfMGraineBeamer\endcsname{\csname PfMGraineBeamer\endcsname}}%
+ %
\setcounter{RetiensSol}{0}%
\setcounter{RetiensRep}{0}%
\setcounter{RetiensInd}{0}%
% on remet à zéro le compteur des exercices
- %\setcounter{PfMExo}{0}%
+ % \setcounter{PfMExo}{0}%
\setcounter{PfMSOS}{0}%
% nouvelles valeurs.
\stepcounter{PfMMaquette}%
- \IfHookExistsTF{env/exercice/after}{\RemoveFromHook{env/exercice/after}[*]\AddToHook{env/exercice/after}[ChoixExo]{\PfMChoixAffichageCorrection\PfMChoixAffichageEntrainement}}{\AddToHook{env/exercice/after}[ChoixExo]{\PfMChoixAffichageCorrection\PfMChoixAffichageEntrainement}}%
- \useKVdefault[FdR]%
- \setKV[FdR]{#1}%
+ \IfHookExistsTF{env/exercice/after}{\RemoveFromHook{env/exercice/after}[*]\AddToHook{env/exercice/after}[ChoixExo]{\PfMChoixAffichageCorrection\PfMChoixAffichageEntrainement}}{\AddToHook{env/exercice/after}[ChoixExo]{\PfMChoixAffichageCorrection\PfMChoixAffichageEntrainement}}%
+ \useKVdefault[Boulot]%
+ \setKV[Boulot]{#1}%
+ \ifboolKV[Boulot]{CorrigeFin}{%
+ \AtEndDocument{%
+ \PfMPrepareCorrection{#1}%
+ \begin{frame}
+ \frametitle{\useKV[Beamer]{Theme}\hfill\raisebox{-0.25\height}{%
+ \PfMLogoBeamer}~\phantom{t}}%
+ \PfMAffichageCorrige%
+ \end{frame}
+ }%
+ }{}%
+ \useKVdefault[Beamer]%
+ \setKV[Beamer]{#2}%
\let\exercice\exerciceBeamer\let\endexercice\endexerciceBeamer%
\begin{frame}[environment=Maquette,fragile]
- \setcounter{PfMExo}{10}%
+ \setcounter{PfMExo}{0}%
\PfCGraineAlea{\useKV[Boulot]{Graine}}%
- \frametitle{\useKV[FdR]{Theme}\hfill\raisebox{-0.25\height}{\mplibforcehmode\begin{mplibcode}
- labeloffset:=1pt;
- fill cercle((0,0),4mm) withcolor white;
- trace cercle((0,0),4mm) withcolor \mpcolor{Evidence!50};
- drawoptions(withcolor 0.5white);
- label.top(TEX("\tiny alea\TeX"),(0,0));
- drawoptions(withcolor \mpcolor{Evidence});
- label.bot(TEX("\tiny SL \& CP$^2$"),(0,0));
- \end{mplibcode}}~\phantom{t}}
+ \frametitle{\useKV[Beamer]{Theme}\hfill\raisebox{-0.25\height}{%
+ \PfMLogoBeamer}~\phantom{t}}%
}{%
\end{frame}
- }
-}{
+ }%
+}{%
\NewDocumentEnvironment{Maquette}{om}{%
% on remet à zéro les compteurs de solutions : inutile ?
\setcounter{RetiensSol}{0}%
@@ -3972,12 +4455,20 @@
\immediate\write\@auxout{%
\string\opcopy{0}{ScoreTotal\thePfMMaquette}
}%
- %%\opadd*{#1}{ScoreTotal\thePfMMaquette}{ScoreTotal\thePfMMaquette}%
+ %% \opadd*{#1}{ScoreTotal\thePfMMaquette}{ScoreTotal\thePfMMaquette}%
+ \useKVdefault[Boulot]%
+ \setKV[Boulot]{#1}%
\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}}}%
+ \ifboolKV[Boulot]{Fiche}{\immediate\write\PfMfile at out{\TikzFicheCor{\unexpanded{#2}}}}{}%
+ \ifboolKV[Boulot]{DS}{\immediate\write\PfMfile at out{\TikzDSCor{\unexpanded{#2}}}}{}%
+ \ifboolKV[Boulot]{DM}{\immediate\write\PfMfile at out{\TikzDMCor{\unexpanded{#2}}}}{}%
+ \ifboolKV[Boulot]{IE}{\immediate\write\PfMfile at out{\TikzIECor{\unexpanded{#2}}}}{}%
+ \ifboolKV[Boulot]{FdR}{\immediate\write\PfMfile at out{\TikzFdRCor{\unexpanded{#2}}}}{}%
+ \ifboolKV[Boulot]{Contrat}{\immediate\write\PfMfile at out{\TikzContratCor{\unexpanded{#2}}}}{}%
+ \ifboolKV[Boulot]{Parcours}{\immediate\write\PfMfile at out{\TikzParcoursCor{\unexpanded{#2}}}}{}%
\immediate\closeout\PfMfile at out%
\fi
% options de boulot
@@ -3984,8 +4475,8 @@
\IfHookExistsTF{env/Maquette/after}{\RemoveFromHook{env/Maquette/after}[*]}{}%
\AddToHook{env/Maquette/after}[RetiensExo]{\xdef\PfMRetiensLienExoMa{\PfMRetiensLienExoMa,\thePfMExo}}
%--------------
- \useKVdefault[Boulot]%
- \setKV[Boulot]{#1}%
+% \useKVdefault[Boulot]%
+% \setKV[Boulot]{#1}%
\ifboolKV[Boulot]{CorrigeSeul}{\setKV[Boulot]{CorrigeFin}}{}%
\if at Dyslexie%
\setKV[Boulot]{Dys}%
@@ -3995,10 +4486,13 @@
% Test
\IfHookExistsTF{env/exercice/begin}{\RemoveFromHook{env/exercice/begin}[*]}{}%
\IfHookExistsTF{env/Maquette/end}{\RemoveFromHook{env/Maquette/end}[*]}{}%
-% \ifboolKV[Boulot]{Diaporama}{%
-% }{%
+ \ifboolKV[Boulot]{AMC}{%
+ \setcounter{PfMNbListeReponsesAMC}{0}%
+ \setKV[AMC]{#2}%
+ \let\exercice\exerciceAmc\let\endexercice\endexerciceAmc%
+ \TikzAMC%
+ }{%
\ifboolKV[Boulot]{OlympiadesAPMEP}{%
- % \input{PfMMaquetteOlympAPMEP}%
\setKV[OlympiadesAPMEP]{#2}%\TikzOlympiadesAPMEP%
\let\exercice\exerciceOlympiadesAPMEP\let\endexercice\endexerciceOlympiadesAPMEP%
\ifboolKV[Boulot]{CorrigeFin}{%
@@ -4010,7 +4504,6 @@
}{}%
}{%
\ifboolKV[Boulot]{CAN}{%
- % \input{PfMMaquetteCAN.tex}
\setKV[CAN]{#2}%
\setcounter{PfMCNNumQ}{0}%
\setlength{\PfMLargeurQuestion}{\useKV[CAN]{CoefQ}\linewidth}\setlength{\PfMLargeurReponse}{\useKV[CAN]{CoefR}\linewidth}\setlength{\PfMLargeurJury}{\useKV[CAN]{CoefJ}\linewidth}%
@@ -4274,9 +4767,12 @@
}{}%
\ifboolKV[Boulot]{CorrigeFin}{%
\AddToHook{env/Maquette/after}[Correction]{%
- \PfMPrepareCorrection{#1}%
- \TikzDSCor{#2}%
- \PfMAffichageCorrectionColonnes%
+ \if at AssembleCorrections
+ \else
+ \PfMPrepareCorrection{#1}%
+ \TikzDSCor{#2}%
+ \PfMAffichageCorrectionColonnes%
+ \fi%
}%
}{}%
}{%
@@ -4335,7 +4831,124 @@
}%
\ifboolKV[Boulot]{CorrectionColonnes}{\end{multicols}}{}%
}%
- }{}%
+ }{%
+ \ifboolKV[Boulot]{PixelArt}{%
+ \setcounter{PfMLettresPixelArt}{0}
+ \xdef\ListeSolAv{}%
+ \setKV[PixelArt]{#2}%
+ \setlength{\PfMLargeurTableauPixelArt}{\useKV[PixelArt]{LargeurTab}}%
+ \ifboolKV[PixelArt]{Aleatoire}{%
+ \setcounter{PfMLettresPixelArt}{1}%
+ \StrLen{\useKV[PixelArt]{Lettres}}[\PfMNbLettres]%
+ \ChoixSommet{\PfMNbLettres}{S}%
+ \xdef\ListePourLesItemsAv{\pA}%
+ \xintFor* ##1 in{\xintSeq{2}{\PfMNbLettres}}\do{%
+ \stepcounter{PfMLettresPixelArt}%
+ \xdef\ListePourLesItemsAv{\ListePourLesItemsAv,\csname p\Alph{PfMLettresPixelArt}\endcsname}%
+ }%
+ \setsepchar{,}\ignoreemptyitems\readlist*\ListePourLesItems{\ListePourLesItemsAv}\reademptyitems%
+ \setcounter{PfMLettresPixelArt}{-1}%
+ \setKVdefault[PfMPixelArt]{ListeNombres={\ListePourLesItemsAv}}%
+ }{}%
+ \TikzPixelArt%
+ \let\exercice\exercicePX\let\endexercice\endexercicePX%
+ \AddToHook{env/Maquette/end}{%
+ \StrLen{\useKV[PixelArt]{Lettres}}[\PfMNbLettres]
+ \setsepchar{,}\ignoreemptyitems
+ \readlist*\ListeSolPX{\ListeSolAv}%
+ \reademptyitems
+ \ifnum\fpeval{\ListeSolPXlen}=\fpeval{\PfMNbLettres}\relax
+ \xdef\PfMListeExoPX{}%
+ \xintFor* ##1 in{\xintSeq{1}{\ListeSolPXlen}}\do{%
+ \xdef\PfMListeExoPX{\PfMListeExoPX,##1}%
+ }%
+ \MelangeListe{\PfMListeExoPX}{\ListeSolPXlen}%
+ \xdef\PfMFooMelange{\faa}%
+ \xdef\PfMListeCouleursAv{\useKV[PixelArt]{ListeCouleurs}}%
+ \setsepchar{,}\ignoreemptyitems%
+ \readlist*\ListePerm{\PfMFooMelange}%
+ \readlist*\ListeCouleursPX{\PfMListeCouleursAv}%
+ \reademptyitems%
+% Le nombre de couleurs est \ListeCouleursPXlen.\\
+% Le nombre de lettres est \PfMNbLettres\\
+ \ifnum\fpeval{\ListeCouleursPXlen}=\fpeval{\PfMNbLettres}\relax
+ \ifboolKV[PixelArt]{CoupureTableau}{%
+ \begin{center}
+ \quotient{\ListeSolPXlen}{\useKV[PixelArt]{CoupeTableau}}%
+ \modulo{\ListeSolPXlen}{\useKV[PixelArt]{CoupeTableau}}%
+ \xintFor* ##1 in{\xintSeq{1}{\the\intquotient}}\do{%
+ \begin{tabular}{|*{\useKV[PixelArt]{CoupeTableau}}{>{\centering\arraybackslash}m{\PfMLargeurTableauPixelArt}|}}%
+ \hline%
+ \xintFor* ##2 in{\xintSeq{1}{\useKV[PixelArt]{CoupeTableau}}}\do{%
+ \itemtomacro\ListePerm[\fpeval{\useKV[PixelArt]{CoupeTableau}*(##1-1)+##2}]\PfMPermute%
+ \itemtomacro\ListeCouleursPX[\PfMPermute]\Toto%
+ \xdef\Titi{\Toto}%
+ \cellcolor{\Titi}\xintifForLast{}{&}%\Titi
+ }\\
+ \hline%
+ \xintFor* ##2 in{\xintSeq{1}{\useKV[PixelArt]{CoupeTableau}}}\do{%
+ \itemtomacro\ListePerm[\fpeval{\useKV[PixelArt]{CoupeTableau}*(##1-1)+##2}]\PfMPermute%
+ \itemtomacro\ListeSolPX[\PfMPermute]\Toto%
+ \Toto\xintifForLast{}{&}%\Toto
+ }\\
+ \hline
+ \end{tabular}\par%
+ }%
+ \ifnum\remainder>0\relax
+ \begin{tabular}{|*{\the\remainder}{>{\centering\arraybackslash}m{\PfMLargeurTableauPixelArt}|}}%
+ \hline
+ \xintFor* ##2 in{\xintSeq{1}{\the\remainder}}\do{%
+ \itemtomacro\ListePerm[\fpeval{\useKV[PixelArt]{CoupeTableau}*\the\intquotient+##2}]\PfMPermute%
+ \itemtomacro\ListeCouleursPX[\PfMPermute]\Toto%
+ \xdef\Titi{\Toto}%
+ \cellcolor{\Titi}\xintifForLast{}{&}%\Titi
+ }\\
+ \hline
+ \xintFor* ##2 in{\xintSeq{1}{\the\remainder}}\do{%
+ \itemtomacro\ListePerm[\fpeval{\useKV[PixelArt]{CoupeTableau}*\the\intquotient+##2}]\PfMPermute%
+ \itemtomacro\ListeSolPX[\PfMPermute]\Toto%
+ \Toto\xintifForLast{}{&}%\Toto
+ }\\
+ \hline
+ \end{tabular}
+ \fi
+ \end{center}
+ }{%
+ \begin{center}
+ \begin{tabular}{|*{\ListeSolPXlen}{>{\centering\arraybackslash}m{\PfMLargeurTableauPixelArt}|}}
+ \hline%
+ \xintFor* ##1 in{\xintSeq{1}{\ListeSolPXlen}}\do{%
+ \itemtomacro\ListePerm[##1]\PfMPermute%
+ \itemtomacro\ListeCouleursPX[\PfMPermute]\Toto%
+ \xdef\Titi{\Toto}%
+ \cellcolor{\Titi}\xintifForLast{}{&}
+ }\\
+ \hline
+ \xintFor* ##1 in{\xintSeq{1}{\ListeSolPXlen}}\do{%
+ \itemtomacro\ListePerm[##1]\PfMPermute%
+ \itemtomacro\ListeSolPX[\PfMPermute]\Toto%
+ \Toto\xintifForLast{}{&}
+ }\\
+ \hline
+ \end{tabular}
+ \end{center}%
+ }
+ \begin{center}
+ \PfMPixelArt[#2]{\useKV[PixelArt]{Fichier}}%
+ \end{center}
+ \else
+ Le nombre de couleurs et le nombre de lettres ne correspondent pas.
+ \fi
+ \else
+ \ifnum\fpeval{\ListeSolPXlen}<\fpeval{\PfMNbLettres}\relax
+ Il manque des éléments de solutions.
+ \else
+ Il y a trop d'éléments de solutions.
+ \fi
+ \fi
+ }%
+ }{}%
+ }%
}%
}%
}%
@@ -4350,7 +4963,8 @@
}%
}%
}%
-}
+}%
+}%
}{}%
\makeatother
%D'après JCC
@@ -4989,6 +5603,14 @@
%\AddToHook{env/multicols/begin}{\setcounter{Nbcolonnes}{2}}%
%\AddToHook{env/multicols/after}{\setcounter{Nbcolonnes}{4}}%
+\NewDocumentCommand\Cicontre{s}{%
+ \ifPfMDeuxColonnes
+ \IfBooleanTF{#1}{ci-dessous}{ci-dessus}%
+ \else
+ ci-contre%
+ \fi
+}%
+
\NewDocumentEnvironment{Dispo}{sm+b}{%
\ifPfMDeuxColonnes
\IfBooleanTF{#1}{%
@@ -5067,7 +5689,23 @@
}{}%
\def\RetiensEchelle{1cm}
-\def\ChoixNbQuestions{3}
+\def\ChoixNbQuestions{5}
+
+\NewDocumentCommand\QuestionBoulotold{}{%
+ \ifboolKV[Boulot]{CAN}{\setKV[ClesExercices]{NbQuestions=1}}{%
+ \ifboolKV[Boulot]{AMC}{\setKV[ClesExercices]{NbQuestions=1}}{%
+ \setKV[ClesExercices]{NbQuestions=\ChoixNbQuestions}%
+ }%
+ }%
+}%
+
+\NewDocumentCommand\QuestionBoulot{O{\ChoixNbQuestions}}{%
+ \ifboolKV[Boulot]{CAN}{%
+ \setKV[ClesExercices]{NbQuestions=1}%
+ }{%
+ \setKV[ClesExercices]{NbQuestions=#1}%
+ }%
+}%
\makeatletter
\if at CAN
\AddToHook{env/document/before}{%
@@ -5177,4 +5815,392 @@
#3
\end{Test}%
}{}%
-}
\ No newline at end of file
+}%
+
+%%%
+% PixelArt
+%%%
+\newtoks\toklistePfMPANombre%
+\newtoks\tokPfMPXNomCouleur%
+\def\UpdatetoksPfMPANombre#1\nil{\addtotok\toklistePfMPANombre{"#1",}}%
+\def\UpdatetoksPfMPXNomCouleur#1\nil{\addtotok\tokPfMPXNomCouleur{"#1",}}%
+
+\setKVdefault[PfMPixelArt]{Largeur=29,Hauteur=29,Solution=false,Lettres=ABCDEFGHIJK,Nombres=false,ListeCouleurs={},Unite=5mm,Geant=false,HauteurD=1,LargeurD=1,Complet=false,Numero=1,Separations=false,Deforme=false,Coefx=0.25,Coefy=0.25,Borne=false,Graines=false}%
+\defKV[PfMPixelArt]{ListeNombres=\setKV[PfMPixelArt]{Nombres}}%
+\defKV[PfMPixelArt]{Graine=\setKV[PfMPixelArt]{Graines}}%
+
+%"mario1.txt"
+
+\NewDocumentCommand\PfMPixelArt{o m}{%
+ \toklistePfMPANombre{}%
+ \tokPfMPXNomCouleur{}%
+ \useKVdefault[PfMPixelArt]%
+ \setKV[PfMPixelArt]{#1}%
+% \expandafter\UpdatetoksPfMPXNomFichier\useKV[PixelArt]{Fichier}\nil%
+% Le tok fichier est \the\tokPfMPXNomFichier
+ \xdef\ListeAvantCouleurs{\useKV[PfMPixelArt]{ListeCouleurs}}%
+ \setsepchar{,}\ignoreemptyitems%
+ \readlist*\ListePACouleur{\ListeAvantCouleurs}%
+ \reademptyitems%
+ \foreachitem\compteur\in\ListePACouleur{\expandafter\UpdatetoksPfMPXNomCouleur\compteur\nil}%
+ \ifboolKV[PfMPixelArt]{Nombres}{%
+ \xdef\ListeAvantNombres{\useKV[PfMPixelArt]{ListeNombres}}%
+ \setsepchar{,}%
+ \readlist*\ListePANombre{\ListeAvantNombres}%
+ \foreachitem\compteur\in\ListePANombre{\expandafter\UpdatetoksPfMPANombre\compteur\nil}%
+ }{}
+ \ifboolKV[PfMPixelArt]{Geant}{%
+ % Découpe en hauteur : \fpeval{\useKV[PfMPixelArt]{Hauteur}/\useKV[PfMPixelArt]{HauteurD}}\\
+ % Découpe en largeur : \fpeval{\useKV[PfMPixelArt]{Largeur}/\useKV[PfMPixelArt]{LargeurD}-1}}\par
+ \ifboolKV[PfMPixelArt]{Complet}{%
+ \xintFor* ##1 in{\xintSeq{0}{\fpeval{\useKV[PfMPixelArt]{Hauteur}/\useKV[PfMPixelArt]{HauteurD}-1}}}\do{%
+ \xintFor* ##2 in{\xintSeq{0}{\fpeval{\useKV[PfMPixelArt]{Largeur}/\useKV[PfMPixelArt]{LargeurD}-1}}}\do{%
+ \fpeval{##1*\useKV[PfMPixelArt]{Hauteur}/\useKV[PfMPixelArt]{HauteurD}+##2} : \PfMBuildPixelArtGeant{#2}{\useKV[PfMPixelArt]{Lettres}}{\ListeAvantCouleurs}{\the\toklistePfMPANombre}{##1}{##2}\\%
+ }%
+ }%
+ }{%
+% \quotient{\fpeval{\useKV[PfMPixelArt]{Numero}-1}}{\fpeval{\useKV[PfMPixelArt]{Hauteur}/\useKV[PfMPixelArt]{HauteurD}}}%
+% \modulo{\fpeval{\useKV[PfMPixelArt]{Numero}-1}}{\fpeval{\useKV[PfMPixelArt]{Hauteur}/\useKV[PfMPixelArt]{HauteurD}}}%
+ \quotient{\fpeval{\useKV[PfMPixelArt]{Numero}-1}}{\fpeval{\useKV[PfMPixelArt]{Largeur}/\useKV[PfMPixelArt]{LargeurD}}}%
+ \modulo{\fpeval{\useKV[PfMPixelArt]{Numero}-1}}{\fpeval{\useKV[PfMPixelArt]{Largeur}/\useKV[PfMPixelArt]{LargeurD}}}%
+% quotient = \the\intquotient -- remainder = \the\remainder :\\
+ \PfMBuildPixelArtGeant{#2}{\useKV[PfMPixelArt]{Lettres}}{\ListeAvantCouleurs}{\the\toklistePfMPANombre}{\the\intquotient}{\the\remainder}%
+ }%
+ }{%
+ \ifboolKV[PfMPixelArt]{Deforme}{%
+ \PfMBuildPixelArtDeforme{#2}{\useKV[PfMPixelArt]{Lettres}}{\ListeAvantCouleurs}{\the\toklistePfMPANombre}%
+ }{%
+ % \PfMBuildPixelArt{#2}{\useKV[PfMPixelArt]{Lettres}}{\ListeAvantCouleurs}{\the\toklistePfMPANombre}%
+ \PfMBuildPixelArt{#2}{\useKV[PfMPixelArt]{Lettres}}{\the\tokPfMPXNomCouleur}{\the\toklistePfMPANombre}%%
+ }%
+ }%
+}%
+
+\NewDocumentCommand\PfMBuildPixelArt{m m m m}{%
+ \ifluatex
+ \mplibforcehmode
+ \begin{mplibcode}
+% largeur:=\useKV[PfMPixelArt]{Largeur};
+% hauteur:=\useKV[PfMPixelArt]{Hauteur};
+ largeurd:=\useKV[PfMPixelArt]{LargeurD};
+ hauteurd:=\useKV[PfMPixelArt]{HauteurD};
+ Unite:=\useKV[PfMPixelArt]{Unite};
+
+ boolean Solution,Nombres,Separations,RotationPixel;
+ Solution:=\useKV[PfMPixelArt]{Solution};
+ Nombres:=\useKV[PfMPixelArt]{Nombres};
+ Separations:=\useKV[PfMPixelArt]{Separations};
+ RotationPixel:=\useKV[PixelArt]{Landscape};
+
+ string BaseLettres;
+ BaseLettres=str #2;
+ numeric EchelleScale;
+ EchelleScale=Unite/5mm;
+
+ color ColorEntier[],ColFond;
+ n:=0;
+ for p_=#3:
+ n:=n+1;
+ index:=0;
+ for k=0 upto (length p_-1):
+ if substring(k,k+1) of p_="!":
+ index:=k;
+ fi;
+ endfor;
+ if index>0:
+ color base;
+ base=scantokens(substring(0,index) of p_);
+ atte:=scantokens(substring(index+1,length p_) of p_);
+ ColorEntier[n]:=(atte/100)[white,base];
+ else:
+ ColorEntier[n]:=scantokens(p_);
+ fi;
+% ColorEntier[n]:=black;
+ endfor;
+
+ string RetiensNombres[];
+ if Nombres:
+ k:=0;
+ for p_=#4:
+ k:=k+1;
+ RetiensNombres[k]=p_;
+ endfor;
+ else:
+ m:=0;
+ for p_=0 upto n-1:
+ m:=m+1;
+ RetiensNombres[m]=substring(p_,p_+1) of BaseLettres;
+ endfor;
+ fi;
+
+ picture Etiquette[];
+ for k=1 upto n:
+ Etiquette[k]=image(
+ label(TEX(RetiensNombres[k]) scaled EchelleScale,(0,0));
+ );
+ endfor;
+
+ vardef Largeur(expr nomfichier)=
+ string p_;
+ p_=readfrom nomfichier;
+ largeur=(length p_+1) div 2;
+ closefrom nomfichier;
+ enddef;
+
+ vardef Hauteur(expr nomfichier)=
+ string p_;
+ hauteur=0;
+ p_=readfrom nomfichier;
+ forever: exitif p_=EOF;
+ hauteur:=hauteur+1;
+ p_:=readfrom nomfichier;
+ endfor;
+ closefrom nomfichier;
+ enddef;
+
+ vardef Lecturecsv(expr nomfichier)=
+ for h=hauteur downto 1:
+ string p_;
+ p_=readfrom nomfichier;
+ l:=0;
+ for p=0 step 2 until 2*largeur-2:
+ l:=l+1;
+ if Solution=false:
+ if (substring(p,p+1) of p_)="-":
+ else:
+ for m=0 upto (length BaseLettres-1):
+ if (substring(p,p+1) of p_)=substring(m,m+1) of BaseLettres:
+ draw Etiquette[m+1] shifted((l-1)*Unite,(h-1)*Unite);
+ fi;
+ endfor;
+ fi;
+ fi;
+ if Solution:
+ if (substring(p,p+1) of p_)="-":
+ else:
+ for m=0 upto (length BaseLettres-1):
+ if (substring(p,p+1) of p_)=substring(m,m+1) of BaseLettres:
+ ColFond:=ColorEntier[m+1];
+ fi;
+ endfor;
+ if unknown ColFond:
+ else:
+ fill (unitsquare scaled Unite) shifted ((l-1)*Unite-0.5*Unite,(h-1)*Unite-0.5*Unite) withcolor ColFond
+ fi;
+ fi;
+ fi;
+ trace (unitsquare scaled Unite) shifted ((l-1)*Unite-0.5*Unite,(h-1)*Unite-0.5*Unite);
+ endfor;
+ endfor;
+ closefrom nomfichier;
+ enddef;
+
+ Largeur(#1);
+ Hauteur(#1);
+% label.top(TEX("Largeur = "&decimal(largeur)),(0,-1cm));
+% label.bot(TEX("Hauteur = "&decimal(hauteur)),(0,-1cm));
+ Lecturecsv(#1);
+ if Separations:
+ drawoptions(withcolor Purple);
+ for k=hauteur step -hauteurd until 0:
+ draw (Unite*(-1,k-0.5)--Unite*(largeur,k-0.5)) withpen pencircle scaled 1.25;
+ endfor;
+ for k=0 step largeurd until largeur:
+ draw (Unite*(k-0.5,hauteur+0.125)--Unite*(k-0.5,-0.875)) withpen pencircle scaled 1.25;
+ endfor;
+ drawoptions();
+ fi;
+ if RotationPixel:
+ picture Retiens;
+ Retiens:=currentpicture;
+ currentpicture:=nullpicture;
+ draw Retiens rotatedabout(center Retiens,90);
+ fi;
+ \end{mplibcode}
+ \fi
+}%
+
+\NewDocumentCommand\PfMBuildPixelArtDeforme{m m m m}{%
+ \ifluatex
+ \mplibforcehmode
+ \begin{mplibcode}
+ largeur:=\useKV[PfMPixelArt]{Largeur};
+ hauteur:=\useKV[PfMPixelArt]{Hauteur};
+ largeurd:=\useKV[PfMPixelArt]{LargeurD};
+ hauteurd:=\useKV[PfMPixelArt]{HauteurD};
+ Unite:=\useKV[PfMPixelArt]{Unite};
+
+ %Deformation
+ Coefx=\useKV[PfMPixelArt]{Coefx};
+ Coefy=\useKV[PfMPixelArt]{Coefy};
+ boolean Borne,Graines;
+ Borne=\useKV[PfMPixelArt]{Borne};
+ Graines=\useKV[PfMPixelArt]{Graines};
+ if Graines:
+ randomseed:=\useKV[PfMPixelArt]{Graine};
+ fi;
+ %
+ pair M[][];
+ for l=1 upto hauteur+1:
+ for c=1 upto largeur+1:
+ if Borne:
+ if (l=1) or (l=hauteur+1):
+ M[l][c]=Unite*(c,l)+Unite*(-Coefx+uniformdeviate(2*Coefx),0);
+ if (c=1) or (c=largeur+1):
+ M[l][c]:=Unite*(c,l);
+ fi;
+ else:
+ if (c=1) or (c=largeur+1):
+ M[l][c]=Unite*(c,l-1)+Unite*(0,uniformdeviate(Coefy));
+ else:
+ M[l][c]=Unite*(c,l)+Unite*(-Coefx+uniformdeviate(2*Coefx),-Coefy+uniformdeviate(2*Coefy));
+ fi;
+ fi;
+ else:
+ M[l][c]=Unite*(c,l)+Unite*(-Coefx+uniformdeviate(2*Coefx),-Coefy+uniformdeviate(2*Coefy));
+ fi;
+ %dotlabel("",M[l][c]);
+ endfor;
+ endfor;
+
+ boolean Solution,Nombres,Separations;
+ Solution:=\useKV[PfMPixelArt]{Solution};
+ Nombres:=\useKV[PfMPixelArt]{Nombres};
+ Separations:=\useKV[PfMPixelArt]{Separations};
+
+ string BaseLettres;
+ BaseLettres=str #2;
+ numeric EchelleScale;
+ EchelleScale=Unite/10mm;
+
+ color ColorEntier[],ColFond;
+ n:=0;
+ for p_=#3:
+ n:=n+1;
+ ColorEntier[n]:=p_;
+ endfor;
+
+ string RetiensNombres[];
+ if Nombres:
+ n:=0;
+ for p_=#4:
+ n:=n+1;
+ RetiensNombres[n]=p_;
+ endfor;
+ fi;
+
+ vardef Lecturecsv(expr nomfichier)=
+ for h=hauteur downto 1:
+ string p_;
+ p_=readfrom nomfichier;
+ l:=0;
+ for p=0 step 2 until 2*largeur-2:
+ l:=l+1;
+ if (substring(p,p+1) of p_)="-":
+ else:
+ if Nombres:
+ for m=0 upto (length BaseLettres-1):
+ if (substring(p,p+1) of p_)=substring(m,m+1) of BaseLettres:
+ label(TEX(RetiensNombres[m+1]) scaled EchelleScale,iso(M[h+1][l],M[h][l],M[h][l+1],M[h+1][l+1]));
+ fi;
+ endfor;
+ else:
+ label(TEX(substring(p,p+1) of p_) scaled EchelleScale,iso(M[h+1][l],M[h][l],M[h][l+1],M[h+1][l+1]));
+ fi;
+ if Solution:
+ for m=0 upto (length BaseLettres-1):
+ if (substring(p,p+1) of p_)=substring(m,m+1) of BaseLettres:
+ ColFond:=ColorEntier[m+1];
+ fi;
+ endfor;
+ if unknown ColFond: else: fill polygone(M[h+1][l],M[h][l],M[h][l+1],M[h+1][l+1]) withcolor ColFond fi;
+ fi;
+ trace polygone(M[h+1][l],M[h][l],M[h][l+1],M[h+1][l+1]);
+ fi;
+ endfor;
+ endfor;
+ closefrom nomfichier;
+ enddef;
+
+ Lecturecsv("#1");
+ \end{mplibcode}
+\fi
+}%
+
+\NewDocumentCommand\PfMBuildPixelArtGeant{m m m m m m}{%
+ \ifluatex%
+ \mplibforcehmode%
+ \begin{mplibcode}%
+ largeur:=\useKV[PfMPixelArt]{Largeur};
+ hauteur:=\useKV[PfMPixelArt]{Hauteur};
+ largeurd:=\useKV[PfMPixelArt]{LargeurD};
+ hauteurd:=\useKV[PfMPixelArt]{HauteurD};
+
+ Unite:=\useKV[PfMPixelArt]{Unite};
+
+ boolean Solution,Nombres;
+ Solution:=\useKV[PfMPixelArt]{Solution};
+ Nombres:=\useKV[PfMPixelArt]{Nombres};
+
+ string BaseLettres;
+ BaseLettres=str #2;
+
+ numeric EchelleScale;
+ EchelleScale=Unite/5mm;
+
+ color ColorEntier[],ColFond;
+ n:=0;
+ for p_=#3:
+ n:=n+1;
+ ColorEntier[n]:=p_;
+ endfor;
+
+ string RetiensNombres[];
+ if Nombres:
+ n:=0;
+ for p_=#4:
+ n:=n+1;
+ RetiensNombres[n]=p_;
+ endfor;
+ fi;
+
+ vardef Lecturecsv(expr nomfichier)=
+ % for h=hauteur-#5*hauteurd downto hauteur-(#5+1)*hauteurd:
+ for h=hauteur downto 1:
+ string p_;
+ p_=readfrom nomfichier;
+ l:=0;
+ if (h>hauteur-(#5+1)*hauteurd) and (h<hauteur-#5*hauteurd+1):
+ for p=2*#6*largeurd step 2 until 2*(#6+1)*largeurd-2:
+ l:=l+1;
+ if (substring(p,p+1) of p_)="-":
+ else:
+ if Nombres:
+ for m=0 upto (length BaseLettres-1):
+ if (substring(p,p+1) of p_)=substring(m,m+1) of BaseLettres:
+ label(TEX(RetiensNombres[m+1]) scaled EchelleScale,((l-1)*Unite,(h-1)*Unite));
+ fi;
+ endfor;
+ else:
+ label(TEX(substring(p,p+1) of p_) scaled EchelleScale,((l-1)*Unite,(h-1)*Unite));
+ fi;
+ if Solution:
+ for m=0 upto (length BaseLettres-1):
+ if (substring(p,p+1) of p_)=substring(m,m+1) of BaseLettres:
+ ColFond:=ColorEntier[m+1];
+ fi;
+ endfor;
+ if unknown ColFond: else: fill (unitsquare scaled Unite) shifted ((l-1)*Unite-0.5*Unite,(h-1)*Unite-0.5*Unite) withcolor ColFond fi;
+ fi;
+ trace (unitsquare scaled Unite) shifted ((l-1)*Unite-0.5*Unite,(h-1)*Unite-0.5*Unite);
+ fi;
+ endfor;
+ fi;
+ endfor;
+ closefrom nomfichier;
+ enddef;
+
+ Lecturecsv("#1");
+ \end{mplibcode}
+ \fi%
+}%
\ No newline at end of file
More information about the tex-live-commits
mailing list.