summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/profcollege
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/profcollege')
-rw-r--r--macros/latex/contrib/profcollege/doc/ProfCollege-doc.pdfbin9288098 -> 9462857 bytes
-rw-r--r--macros/latex/contrib/profcollege/latex/PfCAllumettes.tex35
-rw-r--r--macros/latex/contrib/profcollege/latex/PfCBonbon.tex38
-rw-r--r--macros/latex/contrib/profcollege/latex/PfCCartesJeux.tex661
-rw-r--r--macros/latex/contrib/profcollege/latex/PfCCibleQOp.tex11
-rw-r--r--macros/latex/contrib/profcollege/latex/PfCDefiTables.tex73
-rw-r--r--macros/latex/contrib/profcollege/latex/PfCDessinAlgo.tex370
-rw-r--r--macros/latex/contrib/profcollege/latex/PfCFractionAireCarre.tex158
-rw-r--r--macros/latex/contrib/profcollege/latex/PfCFractionNombre.tex416
-rw-r--r--macros/latex/contrib/profcollege/latex/PfCGeometrie.tex16
-rw-r--r--macros/latex/contrib/profcollege/latex/PfCJeuRangement.tex25
-rw-r--r--macros/latex/contrib/profcollege/latex/PfCMulJal.tex148
-rw-r--r--macros/latex/contrib/profcollege/latex/PfCNumerationsAnciennes.tex243
-rw-r--r--macros/latex/contrib/profcollege/latex/PfCOperationsTrou.tex122
-rw-r--r--macros/latex/contrib/profcollege/latex/PfCPattern.tex779
-rw-r--r--macros/latex/contrib/profcollege/latex/PfCPropor.tex4
-rw-r--r--macros/latex/contrib/profcollege/latex/PfCPuissanceQuatre.tex54
-rw-r--r--macros/latex/contrib/profcollege/latex/PfCPythagore.tex18
-rw-r--r--macros/latex/contrib/profcollege/latex/PfCReperage.tex41
-rw-r--r--macros/latex/contrib/profcollege/latex/PfCSerpent.tex365
-rw-r--r--macros/latex/contrib/profcollege/latex/PfCStatistiques.tex14
-rw-r--r--macros/latex/contrib/profcollege/latex/PfCTableauxUnites.tex90
-rw-r--r--macros/latex/contrib/profcollege/latex/ProfCollege.sty13
-rw-r--r--macros/latex/contrib/profcollege/metapost/PfCAllumettes.mp77
24 files changed, 3178 insertions, 593 deletions
diff --git a/macros/latex/contrib/profcollege/doc/ProfCollege-doc.pdf b/macros/latex/contrib/profcollege/doc/ProfCollege-doc.pdf
index c1a0ba2d78..1f3ab4aafb 100644
--- a/macros/latex/contrib/profcollege/doc/ProfCollege-doc.pdf
+++ b/macros/latex/contrib/profcollege/doc/ProfCollege-doc.pdf
Binary files differ
diff --git a/macros/latex/contrib/profcollege/latex/PfCAllumettes.tex b/macros/latex/contrib/profcollege/latex/PfCAllumettes.tex
new file mode 100644
index 0000000000..f603c71f96
--- /dev/null
+++ b/macros/latex/contrib/profcollege/latex/PfCAllumettes.tex
@@ -0,0 +1,35 @@
+%%%
+% Allumettes
+%%%
+\setKVdefault[Allumettes]{Impression=false,Echelles=false}%
+\defKV[Allumettes]{Echelle=\setKV[Allumettes]{Echelles}}%
+
+\ifluatex
+ \NewDocumentEnvironment{Allumettes}{o +b}{%
+ \useKVdefault[Allumettes]%
+ \setKV[Allumettes]{#1}%
+ \mplibforcehmode%
+ \begin{mplibcode}%
+ input PfCAllumettes;
+ %
+ boolean print,Echelles;
+ print=\useKV[Allumettes]{Impression};
+ Echelles=\useKV[Allumettes]{Echelles};
+ if Echelles:
+ Echelle=\useKV[Allumettes]{Echelle};
+ DefinirUnite(Echelle);
+ else:
+ Echelle=1;
+ fi;
+ %
+ #2%
+ \end{mplibcode}%
+ }{}
+\else%
+ \NewDocumentEnvironment{Allumettes}{o +b}{%
+ \setKV[Allumettes]{#1}%
+ \begin{mpost}[mpsettings={input PfCAllumettes;boolean print,Echelles;print=\useKV[Allumettes]{Impression};Echelles=\useKV[Allumettes]{Echelles};if Echelles:Echelle=\useKV[Allumettes]{Echelle};DefinirUnite(Echelle);else:Echelle=1;fi;}]%
+ #2%
+ \end{mpost}
+ }{}%
+\fi% \ No newline at end of file
diff --git a/macros/latex/contrib/profcollege/latex/PfCBonbon.tex b/macros/latex/contrib/profcollege/latex/PfCBonbon.tex
new file mode 100644
index 0000000000..37ddec940e
--- /dev/null
+++ b/macros/latex/contrib/profcollege/latex/PfCBonbon.tex
@@ -0,0 +1,38 @@
+%%%
+% Bonbon
+%%%
+\setKVdefault[Bonbon]{CouleurUn=red,Bicolore=false,Echelle=1}
+\defKV[Bonbon]{CouleurDeux=\setKV[Bonbon]{Bicolore}}
+
+\NewDocumentCommand\Bonbon{o}{%
+ \useKVdefault[Bonbon]%
+ \setKV[Bonbon]{#1}%
+ \ifluatex%
+ \mplibforcehmode%
+ \begin{mplibcode}
+ boolean Bicolore;
+ Bicolore:=\useKV[Bonbon]{Bicolore};
+ color CouleurUn,CouleurDeux;
+ CouleurUn:=\useKV[Bonbon]{CouleurUn};
+ if Bicolore:
+ CouleurDeux:=\useKV[Bonbon]{CouleurDeux};
+ fi;
+ Echelle:=\useKV[Bonbon]{Echelle};
+ input PfCSolid;
+
+ pas:=0.25132;
+
+ Initialisation(10,50,50,15);
+ incolor:=CouleurUn;
+ outcolor:=CouleurUn;
+ if Bicolore:
+ draw Sparam("Echelle*(u,cos(u)*cos(v),cos(u)*sin(v))",0,pi,pas,0,2*pi,pas);
+ incolor:=CouleurDeux;
+ outcolor:=CouleurDeux;
+ draw Sparam("Echelle*(u,cos(u)*cos(v),cos(u)*sin(v))",pi,2*pi,pas,0,2*pi,pas);
+ else:
+ draw Sparam("Echelle*(u,cos(u)*cos(v),cos(u)*sin(v))",0,2*pi,pas,0,2*pi,pas);
+ fi;
+ \end{mplibcode}
+ \fi%
+}% \ No newline at end of file
diff --git a/macros/latex/contrib/profcollege/latex/PfCCartesJeux.tex b/macros/latex/contrib/profcollege/latex/PfCCartesJeux.tex
index 79aa74ca7d..289cfeb33b 100644
--- a/macros/latex/contrib/profcollege/latex/PfCCartesJeux.tex
+++ b/macros/latex/contrib/profcollege/latex/PfCCartesJeux.tex
@@ -1,7 +1,7 @@
%%%
% Cards
%%%
-\setKVdefault[Cards]{Formats=false,Largeur=59,Hauteur=89,HauteurTheme=15,Marge=4,Landscape=false,Couleur=Cornsilk,CouleurAr=Cornsilk,Theme=Th\'eor\`eme\\de
+\setKVdefault[Cards]{Formats=false,Largeur=165,Hauteur=250,HauteurTheme=40,Marge=12,Landscape=false,Couleur=Cornsilk,CouleurAr=Cornsilk,Theme=Th\'eor\`eme\\de
Pythagore,ThemeSol=Solution,AfficheTheme=false,Trame=false,Jointes=false,TrameVisible=false,RayonArc=5pt,Titre=false,NomTitre=Jeu 1,Loop,JaiQuia=false,Eleve=false,BackgroundAv=false,BackgroundAr=false,%ImageAv=4813762.jpg,ImageAr=4813762.jpg,
AffichageSolution=true,SolutionSeule=false,%
% Pour la boite
@@ -274,6 +274,7 @@
\newlength{\largeurcards}%
\newlength{\hauteurcards}%
+\newlength{\margecards}%
\newlength{\largeurcarte}%
\newlength{\hauteurcarte}%
\newlength{\hauteurtitre}%
@@ -290,61 +291,11 @@
\setlength{\PfCCardsEcartH}{0pt}%
\setlength{\PfCCardsEcartV}{0pt}%
-\NewDocumentEnvironment{Trame}{+b}{%
- \ifodd\thepage%
- \setlength{\PfCCardsH}{\largeurcards}%
- \setlength{\PfCCardsV}{\hauteurcards}%
- \else%
- \setlength{\PfCCardsH}{\largeurcards+\PfCCardsEcartH}%
- \setlength{\PfCCardsV}{\hauteurcards+\PfCCardsEcartV}%
- \fi%
- \begin{tikzpicture}[remember picture,overlay]
- % quadrillages horizontal et vertical
- \coordinate[yshift=-\margev] (A) at (current page.north west);%
- \coordinate[yshift=-\margev] (B) at (current page.north east);%
- \coordinate[yshift=-\hauteurcards] (A1) at (A);%
- \coordinate[yshift=-\hauteurcards] (B1) at (B);%
- \coordinate[yshift=-\hauteurcards] (A2) at (A1);%
- \coordinate[yshift=-\hauteurcards] (B2) at (B1);%
- \coordinate[yshift=-\hauteurcards] (A3) at (A2);%
- \coordinate[yshift=-\hauteurcards] (B3) at (B2);%
- \coordinate[yshift=-\hauteurcards] (A4) at (A3);%
- \coordinate[yshift=-\hauteurcards] (B4) at (B3);%
- \coordinate[xshift=\margeh] (C) at (current page.north west);%
- \coordinate[xshift=\margeh] (D) at (current page.south west);%
- \coordinate[xshift=\largeurcards] (C1) at (C);%
- \coordinate[xshift=\largeurcards] (D1) at (D);%
- \coordinate[xshift=\largeurcards] (C2) at (C1);%
- \coordinate[xshift=\largeurcards] (D2) at (D1);%
- \coordinate[xshift=\largeurcards] (C3) at (C2);%
- \coordinate[xshift=\largeurcards] (D3) at (D2);%
- \ifboolKV[Cards]{TrameVisible}{%
- \draw (A)--(B);%
- \draw (A1)--(B1);%
- \draw (A2)--(B2);%
- \draw (A3)--(B3);%
- \draw (A4)--(B4);%
- \draw (C)--(D);%
- \draw (C1)--(D1);%
- \draw (C2)--(D2);%
- \draw (C3)--(D3);%
- }{}%
- % point pour placer les cartes
- \coordinate[xshift=\margeh+0.5\PfCCardsH,yshift=-0.5\PfCCardsV] (Carte1) at (A);%
- \coordinate[xshift=\largeurcards,yshift=0mm] (Carte2) at (Carte1);%
- \coordinate[xshift=2\largeurcards,yshift=0mm] (Carte3) at (Carte1);%
- \coordinate[xshift=0mm,yshift=-\hauteurcards] (Carte4) at (Carte1);%
- \coordinate[xshift=0mm,yshift=-\hauteurcards] (Carte5) at (Carte2);%
- \coordinate[xshift=0mm,yshift=-\hauteurcards] (Carte6) at (Carte3);%
- \coordinate[xshift=0mm,yshift=-\hauteurcards] (Carte7) at (Carte4);%
- \coordinate[xshift=0mm,yshift=-\hauteurcards] (Carte8) at (Carte5);%
- \coordinate[xshift=0mm,yshift=-\hauteurcards] (Carte9) at (Carte6);%
- #1%
- \end{tikzpicture}%
-}{}%
+\NewDocumentCommand\Cartes{o +m}{%
+ \CartesPerso[#1]{#2}%
+}%
-%% Trame pour huit cartes format "A7"
-\NewDocumentEnvironment{TrameASept}{+b}{%
+\NewDocumentEnvironment{TramePerso}{+b}{%
\ifodd\thepage%
\setlength{\PfCCardsH}{\largeurcards}%
\setlength{\PfCCardsV}{\hauteurcards}%
@@ -353,313 +304,127 @@
\setlength{\PfCCardsV}{\hauteurcards+\PfCCardsEcartV}%
\fi%
\begin{tikzpicture}[remember picture,overlay]
- % quadrillages horizontal et vertical
\coordinate[yshift=-\margev] (A) at (current page.north west);%
\coordinate[yshift=-\margev] (B) at (current page.north east);%
- \coordinate[yshift=-\hauteurcards] (A1) at (A);%
- \coordinate[yshift=-\hauteurcards] (B1) at (B);%
- \coordinate[yshift=-\hauteurcards] (A2) at (A1);%
- \coordinate[yshift=-\hauteurcards] (B2) at (B1);%
+ \xintFor* ##1 in{\xintSeq{0}{\PfCNbCartesHaut}}\do{%
+ \coordinate[yshift=-##1*\hauteurcards] (A##1) at (A);%
+ \coordinate[yshift=-##1*\hauteurcards] (B##1) at (B);%
+ }%
\coordinate[xshift=\margeh] (C) at (current page.north west);%
\coordinate[xshift=\margeh] (D) at (current page.south west);%
- \coordinate[xshift=\largeurcards] (C1) at (C);%
- \coordinate[xshift=\largeurcards] (D1) at (D);%
- \coordinate[xshift=\largeurcards] (C2) at (C1);%
- \coordinate[xshift=\largeurcards] (D2) at (D1);%
- \coordinate[xshift=\largeurcards] (C3) at (C2);%
- \coordinate[xshift=\largeurcards] (D3) at (D2);%
- \draw (A) -- (B);%
- \draw (A1) -- (B1);%
- \draw (A2) -- (B2);%
- \draw (C)--(D);%
- \draw (C1)--(D1);%
- \draw (C2)--(D2);%
- \draw (C3)--(D3);%
- \coordinate[xshift=\margeh+0.5\largeurcards,yshift=-0.5\hauteurcards] (Carte1) at (A);%
- \coordinate[xshift=\largeurcards,yshift=0mm] (Carte2) at (Carte1);%
- \coordinate[xshift=2\largeurcards,yshift=0mm] (Carte3) at (Carte1);%
- \coordinate[xshift=0mm,yshift=-\hauteurcards] (Carte4) at (Carte1);%
- \coordinate[xshift=\largeurcards,yshift=-\hauteurcards] (Carte5) at (Carte1);%
- \coordinate[xshift=2\largeurcards,yshift=-\hauteurcards] (Carte6) at (Carte1);%
- #1%
- \end{tikzpicture}%
-}%
-
-\newcommand\CartesASept[2][]{%
- \useKVdefault[Cards]%
- \setKV[Cards]{#1}%
- \setsepchar[*]{§*/}%
- \readlist*\ListeCards{#2}%
- \setsepchar{,}%
- \setlength{\hauteurcarte}{\fpeval{100-\useKV[Cards]{Marge}}mm}%
- \setlength{\largeurcarte}{\fpeval{95-\useKV[Cards]{Marge}}mm}%
- \setlength{\largeurcards}{95mm}%
- \setlength{\hauteurcards}{100mm}%
- \setlength{\margeh}{(297mm-287mm)/2}%
- \setlength{\margev}{(210mm-200mm)/2}%
- \setlength{\hauteurtitre}{\fpeval{\useKV[Cards]{HauteurTheme}}mm}%
- \setlength{\largeurtitre}{\fpeval{(\useKV[Cards]{Largeur}-\useKV[Cards]{Marge}-9)/2}mm}%
- \colorlet{TexteCouleur}{black}%
- \colorlet{TrameCouleur}{\useKV[Cards]{Couleur}}%
- \colorlet{TrameCouleurAr}{\useKV[Cards]{CouleurAr}}%
- \begin{TrameASept}
- %A
- \multido{\i=1+1}{6}{%
- \node[] at (Carte\i) {%
- \begin{MyboxSimpleAv}{\useKV[Cards]{Theme}}%
- \ListeCards[\i,1]%
- \end{MyboxSimpleAv}%
- };%
+ \xintFor* ##1 in{\xintSeq{0}{\PfCNbCartesHaut}}\do{%
+ \coordinate[xshift=\fpeval{##1*\largeurcards}] (C##1) at (C);%
+ \coordinate[xshift=\fpeval{##1*\largeurcards}] (D##1) at (D);%
+ }%
+ \ifboolKV[Cards]{TrameVisible}{%
+ \xintFor* ##1 in{\xintSeq{0}{\PfCNbCartesHaut}}\do{%
+ \draw (A##1)--(B##1);
+ }%
+ \xintFor* ##1 in{\xintSeq{0}{\PfCNbCartesHaut}}\do{%
+ \draw (C##1)--(D##1);
}%
- \end{TrameASept}%
- \ifboolKV[Cards]{AffichageSolution}{%
- \clearpage%
- \thispagestyle{empty}%
- \begin{TrameASept}
- \multido{\i=1+1}{3}{%
- \node at (Carte\i) {%
- \begin{MyboxSimpleAr}{\useKV[Cards]{ThemeSol}}%
- \ListeCards[\fpeval{4-\i},2]%
- \end{MyboxSimpleAr}%
- };%
- }%
- \multido{\i=4+1}{3}{%
- \node at (Carte\i) {%
- \begin{MyboxSimpleAr}{\useKV[Cards]{ThemeSol}}%
- \ListeCards[\fpeval{10-\i},2]%
- \end{MyboxSimpleAr}%
- };%
- }%
- \end{TrameASept}%
- \clearpage%
}{}%
-% }%
-}%
-
-
-%% Trame pour quatre cartes format A6
-\NewDocumentEnvironment{TrameASix}{+b}{%
- \ifodd\thepage%
- \setlength{\PfCCardsH}{\largeurcards}%
- \setlength{\PfCCardsV}{\hauteurcards}%
- \else%
- \setlength{\PfCCardsH}{\largeurcards+\PfCCardsEcartH}%
- \setlength{\PfCCardsV}{\hauteurcards+\PfCCardsEcartV}%
- \fi%
- \begin{tikzpicture}[remember picture,overlay]
- % quadrillages horizontal et vertical
- \coordinate[yshift=-\margev] (A) at (current page.north west);%
- \coordinate[yshift=-\margev] (B) at (current page.north east);%
- \coordinate[yshift=-\hauteurcards] (A1) at (A);%
- \coordinate[yshift=-\hauteurcards] (B1) at (B);%
- \coordinate[yshift=-\hauteurcards] (A2) at (A1);%
- \coordinate[yshift=-\hauteurcards] (B2) at (B1);%
- \coordinate[xshift=\margeh] (C) at (current page.north west);%
- \coordinate[xshift=\margeh] (D) at (current page.south west);%
- \coordinate[xshift=\largeurcards] (C1) at (C);%
- \coordinate[xshift=\largeurcards] (D1) at (D);%
- \coordinate[xshift=\largeurcards] (C2) at (C1);%
- \coordinate[xshift=\largeurcards] (D2) at (D1);%
- \draw (A) -- (B);%
- \draw (A1) -- (B1);%
- \draw (A2) -- (B2);%
- \draw (C)--(D);%
- \draw (C1)--(D1);%
- \draw (C2)--(D2);%
- \coordinate[xshift=\margeh+0.5\largeurcards,yshift=-0.5\hauteurcards] (Carte1) at (A);%
- \coordinate[xshift=\largeurcards,yshift=0mm] (Carte2) at (Carte1);%
- \coordinate[xshift=0mm,yshift=-\hauteurcards] (Carte3) at (Carte1);%
- \coordinate[xshift=\largeurcards,yshift=-\hauteurcards] (Carte4) at (Carte1);%
+ % points pour placer les cartes
+ \coordinate[xshift=\margeh+0.5\PfCCardsH,yshift=-0.5\PfCCardsV] (Carte0) at (A);%
+ \xintFor* ##1 in{\xintSeq{0}{\fpeval{\PfCNbCartesHaut-1}}}\do{%
+ \xintFor* ##2 in{\xintSeq{0}{\fpeval{\PfCNbCartesLarg-1}}}\do{%
+ \xdef\PfCNumeroCartes{\fpeval{##1*\PfCNbCartesLarg+##2+1}}%
+ \coordinate[xshift=\fpeval{##2*\largeurcards},yshift=\fpeval{-##1*\hauteurcards}] (Carte\PfCNumeroCartes) at (Carte0);%
+ }%
+ }%
#1%
\end{tikzpicture}%
-}%
+}{}%
-\newcommand\CartesASix[2][]{%
+\NewDocumentCommand\CartesPerso{o +m}{%
+% 0/ La largeur est \useKV[Cards]{Largeur} - La hauteur est \useKV[Cards]{Hauteur}.\par
\useKVdefault[Cards]%
\setKV[Cards]{#1}%
+% 1/ La largeur est \useKV[Cards]{Largeur} - La hauteur est \useKV[Cards]{Hauteur}.\par
\setsepchar[*]{§*/}%
\readlist*\ListeCards{#2}%
\setsepchar{,}%
- \setlength{\hauteurcarte}{\fpeval{100-\useKV[Cards]{Marge}}mm}%
- \setlength{\largeurcarte}{\fpeval{143.5-\useKV[Cards]{Marge}}mm}%
- \setlength{\largeurcards}{143.5mm}%
- \setlength{\hauteurcards}{100mm}%
- \setlength{\margeh}{(297mm-287mm)/2}%
- \setlength{\margev}{(210mm-200mm)/2}%
- \setlength{\hauteurtitre}{\fpeval{\useKV[Cards]{HauteurTheme}}mm}%
- \setlength{\largeurtitre}{\fpeval{(\useKV[Cards]{Largeur}-\useKV[Cards]{Marge}-9)/2}mm}%
- \colorlet{TexteCouleur}{black}%
- \colorlet{TrameCouleur}{\useKV[Cards]{Couleur}}%
- \colorlet{TrameCouleurAr}{\useKV[Cards]{CouleurAr}}%
- \begin{TrameASix}
- %A
- \multido{\i=1+1}{4}{%
- \node[] at (Carte\i) {%
- \begin{MyboxSimpleAv}{\useKV[Cards]{Theme}}%
- \ListeCards[\i,1]%
- \end{MyboxSimpleAv}%
- };%
- }%
- \end{TrameASix}%
- \ifboolKV[Cards]{AffichageSolution}{%
- \clearpage%
- \thispagestyle{empty}%
- \begin{TrameASix}
- \multido{\i=1+1}{2}{%
- \node at (Carte\i) {%
- \begin{MyboxSimpleAr}{\useKV[Cards]{ThemeSol}}%
- \ListeCards[\fpeval{3-\i},2]%
- \end{MyboxSimpleAr}%
- };%
- }%
- \multido{\i=3+1}{2}{%
- \node at (Carte\i) {%
- \begin{MyboxSimpleAr}{\useKV[Cards]{ThemeSol}}%
- \ListeCards[\fpeval{7-\i},2]%
- \end{MyboxSimpleAr}%
- };%
- }%
- \end{TrameASix}%
- \clearpage%
+ % Dimensions extérieures des cartes
+ \ifboolKV[Cards]{Landscape}{%
+ \setlength{\largeurcards}{\fpeval{\useKV[Cards]{Hauteur}}pt}%
+ \setlength{\hauteurcards}{\fpeval{\useKV[Cards]{Largeur}}pt}%
+ }{%
+ \setlength{\largeurcards}{\fpeval{\useKV[Cards]{Largeur}}pt}%
+ \setlength{\hauteurcards}{\fpeval{\useKV[Cards]{Hauteur}}pt}%
+ }%
+ \setlength{\margecards}{\fpeval{\useKV[Cards]{Marge}}pt}%
+% 2/ La largeur est \fpeval{\largeurcards} - La hauteur est \fpeval{\hauteurcards}.\par
+ % Format prédéfinis
+ \ifboolKV[Cards]{Formats}{%
+% Ici, le format est \useKV[Cards]{Format}
+% 3/ La largeur est \fpeval{\largeurcards} - La hauteur est \fpeval{\hauteurcards}.\par
+ \comparestrict%
+ \IfEq{\useKV[Cards]{Format}}{A5p}{%
+ % Dimensions extérieures des cartes
+ \setlength{\largeurcards}{405pt}%
+ \setlength{\hauteurcards}{538pt}%
+% 4/ La largeur est \fpeval{\largeurcards} - La hauteur est \fpeval{\hauteurcards}.\par
}{}%
-% }%
-}%
-
-%% Trame pour deux cartes format A5
-\NewDocumentEnvironment{TrameACinq}{+b}{%
- \ifodd\thepage%
- \setlength{\PfCCardsH}{\largeurcards}%
- \setlength{\PfCCardsV}{\hauteurcards}%
- \else%
- \setlength{\PfCCardsH}{\largeurcards+\PfCCardsEcartH}%
- \setlength{\PfCCardsV}{\hauteurcards+\PfCCardsEcartV}%
- \fi%
- \begin{tikzpicture}[remember picture,overlay]
- % quadrillages horizontal et vertical
- \coordinate[yshift=-\margev] (A) at (current page.north west);%
- \coordinate[yshift=-\margev] (B) at (current page.north east);%
- \coordinate[yshift=-\hauteurcards] (A1) at (A);%
- \coordinate[yshift=-\hauteurcards] (B1) at (B);%
- \coordinate[xshift=\margeh] (C) at (current page.north west);%
- \coordinate[xshift=\margeh] (D) at (current page.south west);%
- \coordinate[xshift=\largeurcards] (C1) at (C);%
- \coordinate[xshift=\largeurcards] (D1) at (D);%
- \coordinate[xshift=\largeurcards] (C2) at (C1);%
- \coordinate[xshift=\largeurcards] (D2) at (D1);%
- \draw (A) -- (B);%
- \draw (A1) -- (B1);%
- \draw (C)--(D);%
- \draw (C1)--(D1);%
- \draw (C2)--(D2);%
- \coordinate[xshift=\margeh+0.5\largeurcards,yshift=-0.5\hauteurcards] (Carte1) at (A);%
- \coordinate[xshift=\largeurcards,yshift=0mm] (Carte2) at (Carte1);%
- #1%
- \end{tikzpicture}%
-}%
-
-\newcommand\CartesACinq[2][]{%
- \useKVdefault[Cards]%
- \setKV[Cards]{#1}%
- \setsepchar[*]{§*/}%
- \readlist*\ListeCards{#2}%
- \setlength{\hauteurcarte}{\fpeval{200-\useKV[Cards]{Marge}}mm}%
- \setlength{\largeurcarte}{\fpeval{143.5-\useKV[Cards]{Marge}}mm}%
- \setlength{\largeurcards}{143.5mm}%
- \setlength{\hauteurcards}{200mm}%
- \setlength{\margeh}{(297mm-287mm)/2}%
- \setlength{\margev}{(210mm-190mm)/2}%
- \setlength{\hauteurtitre}{\fpeval{\useKV[Cards]{HauteurTheme}}mm}%
- \setlength{\largeurtitre}{\fpeval{(\useKV[Cards]{Largeur}-\useKV[Cards]{Marge}-9)/2}mm}%
+ \IfEq{\useKV[Cards]{Format}}{A6p}{%
+ \setlength{\largeurcards}{405pt}%
+ \setlength{\hauteurcards}{283pt}%
+ }{}%
+ \IfEq{\useKV[Cards]{Format}}{Huitp}{%
+ \setlength{\largeurcards}{269pt}%
+ \setlength{\hauteurcards}{283pt}%
+ }{}%
+ }{%
+ %
+ % Dimensions extérieures des cartes
+% \setlength{\largeurcards}{\fpeval{\useKV[Cards]{Largeur}}mm}%
+% \setlength{\hauteurcards}{\fpeval{\useKV[Cards]{Hauteur}}mm}%
+ }%
+ \let\Trame\TramePerso\let\endTrame\endTramePerso
+ % Dimensions intérieures des cartes
+ \setlength{\hauteurcarte}{\fpeval{\hauteurcards-\margecards}pt}%
+ \setlength{\largeurcarte}{\fpeval{\largeurcards-\margecards}pt}%
+ % nombre de cartes sur la largeur
+ \xdef\PfCNbCartesLarg{\fpeval{floor(\paperwidth/\largeurcards)}}%
+ \xdef\PfCNbCartesHaut{\fpeval{floor(\paperheight/\hauteurcards)}}%
+ \xdef\PfCNbCartesPerso{\fpeval{\PfCNbCartesLarg*\PfCNbCartesHaut}}%
+ % Jointes
+ \ifboolKV[Cards]{Jointes}{\setlength{\largeurcards}{\largeurcarte}}{}%
+ \ifboolKV[Cards]{Jointes}{\setlength{\hauteurcards}{\hauteurcarte}}{}%
+ % décalage entre les cartes ou pas
+ \ifnum\PfCNbCartesLarg>1\relax
+ \setlength{\margeh}{\fpeval{(\paperwidth-\PfCNbCartesLarg*\largeurcards)/(\PfCNbCartesLarg-1)}pt}%
+ \fi
+ \ifnum\PfCNbCartesHaut>1\relax
+ \setlength{\margev}{\fpeval{(\paperheight-\PfCNbCartesHaut*\hauteurcards)/(\PfCNbCartesHaut-1)}pt}%
+ \fi
+ %
+ \setlength{\hauteurtitre}{\fpeval{\useKV[Cards]{HauteurTheme}}pt}%
+ \setlength{\largeurtitre}{\fpeval{(\largeurcarte-25)/2}pt}%
\colorlet{TexteCouleur}{black}%
\colorlet{TrameCouleur}{\useKV[Cards]{Couleur}}%
\colorlet{TrameCouleurAr}{\useKV[Cards]{CouleurAr}}%
- \begin{TrameACinq}
- %A
- \multido{\i=1+1}{2}{%
- \node[] at (Carte\i) {%
- \begin{MyboxSimpleAv}{\useKV[Cards]{Theme}}%
- \ListeCards[\i,1]%
- \end{MyboxSimpleAv}%
- };%
- }%
- \end{TrameACinq}%
- \ifboolKV[Cards]{AffichageSolution}{%
- \clearpage%
- \thispagestyle{empty}%
- \begin{TrameACinq}
- \multido{\i=1+1}{2}{%
- \node at (Carte\i) {%
- \begin{MyboxSimpleAr}{\useKV[Cards]{ThemeSol}}%
- \ListeCards[\fpeval{3-\i},2]%
- \end{MyboxSimpleAr}%
- };%
- }%
- \end{TrameACinq}%
- \clearpage%
- }{}%
-}%
-
-\NewDocumentCommand\Cartes{o +m}{%
- \useKVdefault[Cards]%
- \setKV[Cards]{#1}%
- \setsepchar[*]{§*/}%
- \readlist*\ListeCards{#2}%
- \setsepchar{,}%
- \ifboolKV[Cards]{Formats}{%
- \comparestrict%
- \IfEq{\useKV[Cards]{Format}}{A5p}{%
- \CartesACinq[#1]{#2}%
- }{}%
- \IfEq{\useKV[Cards]{Format}}{A6p}{%
- \CartesASix[#1]{#2}%
- }{}%
- \IfEq{\useKV[Cards]{Format}}{Huitp}{%
- \CartesASept[#1]{#2}%
- }{}%
+ \setlength{\PfCRayonArc}{\useKV[Cards]{RayonArc}}%
+ \ifboolKV[Cards]{Trivial}{%
+ \CartesTrivialPerso%
}{%
- \ifboolKV[Cards]{Landscape}{%
- \setlength{\hauteurcarte}{\fpeval{\useKV[Cards]{Largeur}-\useKV[Cards]{Marge}}mm}%
- \setlength{\largeurcarte}{\fpeval{\useKV[Cards]{Hauteur}-\useKV[Cards]{Marge}}mm}%
- \setlength{\largeurcards}{95mm}%
- \setlength{\hauteurcards}{65mm}%
- \setlength{\margeh}{(297mm-3\largeurcards)/2}%
- \setlength{\margev}{(210mm-3\hauteurcards)/2}%
- }{%
- \setlength{\hauteurcarte}{\fpeval{\useKV[Cards]{Hauteur}-\useKV[Cards]{Marge}}mm}%
- \setlength{\largeurcarte}{\fpeval{\useKV[Cards]{Largeur}-\useKV[Cards]{Marge}}mm}%
- \ifboolKV[Cards]{Jointes}{\setlength{\largeurcards}{\largeurcarte}}{\setlength{\largeurcards}{65mm}}%
- \ifboolKV[Cards]{Jointes}{\setlength{\hauteurcards}{\hauteurcarte}}{\setlength{\hauteurcards}{95mm}}%
- \setlength{\margeh}{(210mm-3\largeurcards)/2}%
- \setlength{\margev}{(297mm-3\hauteurcards)/2}
- }%
- \setlength{\hauteurtitre}{\fpeval{\useKV[Cards]{HauteurTheme}}mm}%
- \setlength{\largeurtitre}{\fpeval{(\useKV[Cards]{Largeur}-\useKV[Cards]{Marge}-9)/2}mm}%
- \colorlet{TexteCouleur}{black}%
- \colorlet{TrameCouleur}{\useKV[Cards]{Couleur}}%
- \colorlet{TrameCouleurAr}{\useKV[Cards]{CouleurAr}}%
- \setlength{\PfCRayonArc}{\useKV[Cards]{RayonArc}}%
- \ifboolKV[Cards]{Trivial}{%
- \CartesTrivial%
+ \ifboolKV[Cards]{JaiQuia}{%
+ \CartesJaiQuiaPerso%
}{%
- \ifboolKV[Cards]{JaiQuia}{%
- \CartesJaiQuia%
+ \ifboolKV[Cards]{Loop}{%
+ \CartesLoopPerso%
}{%
- \ifboolKV[Cards]{Loop}{%
- \CartesLoop%
- }{%
- \CartesClassique%
- }%
+ \CartesClassiquePerso%
}%
}%
}%
}%
-\NewDocumentCommand\CartesClassique{}{%
+\NewDocumentCommand\CartesClassiquePerso{}{%
\ifboolKV[Cards]{Trame}{%
\clearpage%
\thispagestyle{empty}%
\begin{Trame}
- \multido{\i=1+1}{9}{%
+ \multido{\i=1+1}{\PfCNbCartesPerso}{%
\node[] at (Carte\i) {%
\begin{MyboxSimpleAv}{\useKV[Cards]{Theme}}%
\ListeCards[\i,1]%
@@ -671,26 +436,16 @@
\clearpage%
\thispagestyle{empty}%
\begin{Trame}
- \multido{\i=1+1}{3}{%
- \node at (Carte\i) {%
- \begin{MyboxSimpleAr}{\useKV[Cards]{ThemeSol}}%
- \ListeCards[\fpeval{4-\i},2]%
- \end{MyboxSimpleAr}%
- };%
- }%
- \multido{\i=4+1}{3}{%
- \node at (Carte\i) {%
- \begin{MyboxSimpleAr}{\useKV[Cards]{ThemeSol}}%
- \ListeCards[\fpeval{10-\i},2]%
- \end{MyboxSimpleAr}%
- };%
- }%
- \multido{\i=7+1}{3}{%
- \node at (Carte\i) {%
- \begin{MyboxSimpleAr}{\useKV[Cards]{ThemeSol}}%
- \ListeCards[\fpeval{16-\i},2]%
- \end{MyboxSimpleAr}%
- };%
+ \xintFor* ##1 in{\xintSeq{0}{\fpeval{\PfCNbCartesHaut-1}}}\do{%
+ \xintFor* ##2 in{\xintSeq{0}{\fpeval{\PfCNbCartesLarg-1}}}\do{%
+ \xdef\PfCNumeroNoeud{\fpeval{##1*\PfCNbCartesLarg+##2+1}}
+ \xdef\PfCNumeroCartes{\fpeval{(##1+1)*\PfCNbCartesLarg-##2}}
+ \node at (Carte\PfCNumeroNoeud) {%
+ \begin{MyboxSimpleAr}{\useKV[Cards]{ThemeSol}}%
+ \ListeCards[\fpeval{\PfCNumeroCartes},2]%
+ \end{MyboxSimpleAr}%
+ };%
+ }%
}%
\end{Trame}%
\clearpage%
@@ -709,111 +464,83 @@
}%
}%
-\NewDocumentCommand\CartesLoop{}{%
+\NewDocumentCommand\CartesLoopPerso{}{%
\ifboolKV[Cards]{Trame}{%
\clearpage%
\thispagestyle{empty}%
\begin{Trame}
- \multido{\i=1+1}{9}{%
- \node at (Carte\i) {%
+ \multido{\i=1+1}{\PfCNbCartesPerso}{%
+ \node[] at (Carte\i) {%
\begin{Mybox}{\ListeCards[\i,1]}{\useKV[Cards]{Theme}}{\ListeCards[\i,2]}%
\ListeCards[\i,3]%
\end{Mybox}%
};%
}%
\end{Trame}%
- \clearpage%
+ \clearpage
\ifboolKV[Cards]{AffichageSolution}{%
+ \clearpage%
\thispagestyle{empty}%
\begin{Trame}
- \multido{\i=1+1}{3}{%
- \node at (Carte\i) {%
- \begin{MyboxAr}%
- \end{MyboxAr}%
- };%
- }%
- \multido{\i=4+1}{3}{%
- \node at (Carte\i) {%
- \begin{MyboxAr}%
- \end{MyboxAr}%
- };%
- }%
- \multido{\i=7+1}{3}{%
- \node at (Carte\i) {%
- \begin{MyboxAr}%
- \end{MyboxAr}%
- };%
+ \xintFor* ##1 in{\xintSeq{0}{\fpeval{\PfCNbCartesHaut-1}}}\do{%
+ \xintFor* ##2 in{\xintSeq{0}{\fpeval{\PfCNbCartesLarg-1}}}\do{%
+ \xdef\PfCNumeroNoeud{\fpeval{##1*\PfCNbCartesLarg+##2+1}}
+ \xdef\PfCNumeroCartes{\fpeval{(##1+1)*\PfCNbCartesLarg-##2}}
+ \node at (Carte\PfCNumeroNoeud) {%
+ \begin{MyboxAr}%
+ \end{MyboxAr}%
+ };%
+ }%
}%
\end{Trame}%
\clearpage%
}{}%
}{%
- \begin{Mybox}{\ListeCards[1,1]}{\useKV[Cards]{Theme}}{\ListeCards[1,2]}%
- \ListeCards[1,3]%
- \end{Mybox}%
+ \ifboolKV[Cards]{SolutionSeule}{}{%
+ \begin{Mybox}{\ListeCards[1,1]}{\useKV[Cards]{Theme}}{\ListeCards[1,2]}%
+ \ListeCards[1,3]%
+ \end{Mybox}%
+ }%
\ifboolKV[Cards]{AffichageSolution}{%
- \begin{MyboxAr}%
- \end{MyboxAr}%
+ \begin{MyboxAr}%
+ \end{MyboxAr}%
}{}%
}%
}%
-\NewDocumentCommand\CartesJaiQuia{}{%
+\NewDocumentCommand\CartesJaiQuiaPerso{}{%
\ifboolKV[Cards]{Trame}{%
\clearpage%
\thispagestyle{empty}%
- \begin{Trame}%
- \multido{\i=1+1}{9}{%
- \node at (Carte\i) {%
+ \begin{Trame}
+ \multido{\i=1+1}{\PfCNbCartesPerso}{%
+ \node[] at (Carte\i) {%
\begin{MyboxJQ}{\ListeCards[\i,1]}{\ListeCards[\i,2]}%
%%
\end{MyboxJQ}%
};%
}%
\end{Trame}%
- \clearpage%
\ifboolKV[Cards]{AffichageSolution}{%
+ \clearpage%
\thispagestyle{empty}%
\begin{Trame}
- \multido{\i=1+1}{3}{%
- \node at (Carte\i) {%
- \ifboolKV[Cards]{AfficheTheme}{%
- \begin{MyboxJQAr}{\useKV[Cards]{ThemeJaiQuiA}}%
- \end{MyboxJQAr}%
- }{%
- \begin{MyboxJQAr}{}%
- \end{MyboxJQAr}%
- }%
- };%
- }%
- \multido{\i=4+1}{3}{%
- \node at (Carte\i) {%
- \ifboolKV[Cards]{AfficheTheme}{%
- \begin{MyboxJQAr}{\useKV[Cards]{ThemeJaiQuiA}}%
- \end{MyboxJQAr}%
- }{%
- \begin{MyboxJQAr}{}%
- \end{MyboxJQAr}%
- }%
- };%
- }%
- \multido{\i=7+1}{3}{%
- \node at (Carte\i) {%
- \ifboolKV[Cards]{AfficheTheme}{%
+ \xintFor* ##1 in{\xintSeq{0}{\fpeval{\PfCNbCartesHaut-1}}}\do{%
+ \xintFor* ##2 in{\xintSeq{0}{\fpeval{\PfCNbCartesLarg-1}}}\do{%
+ \xdef\PfCNumeroNoeud{\fpeval{##1*\PfCNbCartesLarg+##2+1}}
+ \xdef\PfCNumeroCartes{\fpeval{(##1+1)*\PfCNbCartesLarg-##2}}
+ \node at (Carte\PfCNumeroNoeud) {%
\begin{MyboxJQAr}{\useKV[Cards]{ThemeJaiQuiA}}%
\end{MyboxJQAr}%
- }{%
- \begin{MyboxJQAr}{}%
- \end{MyboxJQAr}%
- }%
- };%
+ };%
+ }%
}%
\end{Trame}%
\clearpage%
}{}%
}{%
\begin{MyboxJQ}{\ListeCards[1,1]}{\ListeCards[1,2]}%
- %%
+ %%
\end{MyboxJQ}%
\ifboolKV[Cards]{AffichageSolution}{%
\ifboolKV[Cards]{AfficheTheme}{%
@@ -827,15 +554,15 @@
}%
}%
-\NewDocumentCommand\CartesTrivial{}{%
+\NewDocumentCommand\CartesTrivialPerso{}{%
\xdef\PfCListeSymbolTrivial{\useKV[Cards]{Symboles}}%
\setsepchar{,}\readlist*\ListeSymbolesTrivial{\PfCListeSymbolTrivial}%
\setlength{\tabcolsep}{0.25\tabcolsep}%
\ifboolKV[Cards]{Trame}{%
\clearpage%
\thispagestyle{empty}%
- \begin{Trame}%
- \multido{\i=1+1}{9}{%
+ \begin{Trame}
+ \multido{\i=1+1}{\PfCNbCartesPerso}{%
\node[] at (Carte\i) {%
\begin{MyboxTrivial}%
\begin{center}
@@ -852,45 +579,94 @@
\ifboolKV[Cards]{AffichageSolution}{%
\clearpage%
\thispagestyle{empty}%
- \begin{Trame}%
- \multido{\i=1+1}{3}{%
- \node at (Carte\i) {%
- \begin{MyboxTrivial}%
- \begin{center}%
- \begin{NiceTabular}[width=0.9\largeurcarte]{X[1,m]X[10,m]}[hvlines]%
- \xintFor* ##1 in{\xintSeq{1}{6}}\do{%
- \rule{0pt}{0.12\hauteurcards}\Block{1-1}{\ListeSymbolesTrivial[##1]}&\ListeCards[\fpeval{4-\i},\fpeval{2*##1}]\\
- }%
- \end{NiceTabular}%
- \end{center}%
- \end{MyboxTrivial}%
- };%
- }%
- \multido{\i=4+1}{3}{%
- \node at (Carte\i) {%
- \begin{MyboxTrivial}%
+ \begin{Trame}
+ \xintFor* ##1 in{\xintSeq{0}{\fpeval{\PfCNbCartesHaut-1}}}\do{%
+ \xintFor* ##2 in{\xintSeq{0}{\fpeval{\PfCNbCartesLarg-1}}}\do{%
+ \xdef\PfCNumeroNoeud{\fpeval{##1*\PfCNbCartesLarg+##2+1}}%
+ \xdef\PfCNumeroCartes{\fpeval{(##1+1)*\PfCNbCartesLarg-##2}}%
+ \node at (Carte\PfCNumeroNoeud) {%
+ \begin{MyboxTrivial}%
\begin{center}%
\begin{NiceTabular}[width=0.9\largeurcarte]{X[1,m]X[10,m]}[hvlines]%
- \xintFor* ##1 in{\xintSeq{1}{6}}\do{%
- \rule{0pt}{0.12\hauteurcards}\Block{1-1}{\ListeSymbolesTrivial[##1]}&\ListeCards[\fpeval{10-\i},\fpeval{2*##1}]\\
+ \xintFor* ##3 in{\xintSeq{1}{6}}\do{%
+ \rule{0pt}{0.12\hauteurcards}\Block{1-1}{\ListeSymbolesTrivial[##3]}&\ListeCards[\fpeval{\PfCNumeroCartes},\fpeval{2*##3}]
+ \\
}%
\end{NiceTabular}%
\end{center}%
\end{MyboxTrivial}%
- };%
+ };%
+ }%
}%
- \multido{\i=7+1}{3}{%
- \node at (Carte\i) {%
- \begin{MyboxTrivial}%
+ \end{Trame}%
+ \clearpage%
+ }{}%
+ }{%
+ \begin{MyboxTrivial}%
+ \begin{center}%
+ \begin{NiceTabular}[width=0.9\largeurcarte]{X[1,m]X[10,m]}[hvlines]%
+ \xintFor* ##1 in{\xintSeq{1}{6}}\do{%
+ \rule{0pt}{0.12\hauteurcards}\Block{1-1}{\ListeSymbolesTrivial[##1]}&\ListeCards[1,\fpeval{1+2*(##1-1)}]\\
+ }%
+ \end{NiceTabular}%
+ \end{center}%
+ \end{MyboxTrivial}%
+ \ifboolKV[Cards]{AffichageSolution}{%
+ \begin{MyboxTrivial}%
+ \begin{center}%
+ \begin{NiceTabular}[width=0.9\largeurcarte]{X[1,m]X[10,m]}[hvlines]%
+ \xintFor* ##1 in{\xintSeq{1}{6}}\do{%
+ \rule{0pt}{0.12\hauteurcards}\Block{1-1}{\ListeSymbolesTrivial[##1]}&\ListeCards[1,\fpeval{2*##1}]\\
+ }%
+ \end{NiceTabular}%
+ \end{center}%
+ \end{MyboxTrivial}%
+ }{}%
+ }%
+}%
+
+\NewDocumentCommand\CartesTrivialPersoold{}{%
+ \xdef\PfCListeSymbolTrivial{\useKV[Cards]{Symboles}}%
+ \setsepchar{,}\readlist*\ListeSymbolesTrivial{\PfCListeSymbolTrivial}%
+ \setlength{\tabcolsep}{0.25\tabcolsep}%
+ \ifboolKV[Cards]{Trame}{%
+ \clearpage%
+ \thispagestyle{empty}%
+ \begin{Trame}
+ \multido{\i=1+1}{\PfCNbCartesPerso}{%
+ \node[] at (Carte\i) {%
+ \begin{MyboxTrivial}%
+ \begin{center}
+ \begin{NiceTabular}[width=0.9\largeurcarte]{X[1,m]X[9,m]}[hvlines]%
+ \xintFor* ##1 in{\xintSeq{1}{6}}\do{%
+ \rule{0pt}{0.12\hauteurcards}\Block{1-1}{\ListeSymbolesTrivial[##1]}&\ListeCards[\i,\fpeval{1+2*(##1-1)}]\\
+ }%
+ \end{NiceTabular}%
+ \end{center}%
+ \end{MyboxTrivial}%
+ };%
+ }%
+ \end{Trame}%
+ \ifboolKV[Cards]{AffichageSolution}{%
+ \clearpage%
+ \thispagestyle{empty}%
+ \begin{Trame}
+ \xintFor* ##1 in{\xintSeq{0}{\fpeval{\PfCNbCartesHaut-1}}}\do{%
+ \xintFor* ##2 in{\xintSeq{0}{\fpeval{\PfCNbCartesLarg-1}}}\do{%
+ \xdef\PfCNumeroNoeud{\fpeval{##1*\PfCNbCartesLarg+##2+1}}
+ \xdef\PfCNumeroCartes{\fpeval{(##1+1)*\PfCNbCartesLarg-##2}}
+ \node at (Carte\PfCNumeroNoeud) {%
+ \begin{MyboxTrivial}%
\begin{center}%
\begin{NiceTabular}[width=0.9\largeurcarte]{X[1,m]X[10,m]}[hvlines]%
\xintFor* ##1 in{\xintSeq{1}{6}}\do{%
- \rule{0pt}{0.12\hauteurcards}\Block{1-1}{\ListeSymbolesTrivial[##1]}&\ListeCards[\fpeval{16-\i},\fpeval{2*##1}]\\
+ \rule{0pt}{0.12\hauteurcards}\Block{1-1}{\ListeSymbolesTrivial[##1]}&\ListeCards[\fpeval{4-\i},\fpeval{2*##1}]\\
}%
\end{NiceTabular}%
\end{center}%
\end{MyboxTrivial}%
- };%
+ };%
+ }%
}%
\end{Trame}%
\clearpage%
@@ -917,7 +693,6 @@
\end{MyboxTrivial}%
}{}%
}%
- \setlength{\tabcolsep}{4\tabcolsep}%
}%
\newcommand\SolutionCarte[2]{%
diff --git a/macros/latex/contrib/profcollege/latex/PfCCibleQOp.tex b/macros/latex/contrib/profcollege/latex/PfCCibleQOp.tex
index cb5191d25a..cdd853a8fa 100644
--- a/macros/latex/contrib/profcollege/latex/PfCCibleQOp.tex
+++ b/macros/latex/contrib/profcollege/latex/PfCCibleQOp.tex
@@ -5,16 +5,16 @@
\xdef\RetiensNonDiviseurs{}%
\anpcqo=#1%
\bnpcqo=2%
- \cnpcqo=1%
+ \cnpcqo=0%
\whiledo{\bnpcqo<\anpcqo}{%
\modulo{\the\anpcqo}{\the\bnpcqo}{}%
\ifnum\remainder=0\relax
- \ifnum\cnpcqo=1
+ \cnpcqo=\numexpr\cnpcqo+1\relax
+ \ifnum\cnpcqo=1\relax
\xdef\RetiensDiviseurs{\the\bnpcqo}%
\else%
\xdef\RetiensDiviseurs{\RetiensDiviseurs,\the\bnpcqo}%
\fi%
- \cnpcqo=\numexpr\cnpcqo+1%
\else
\ifnum\bnpcqo<10
\xdef\RetiensNonDiviseurs{\RetiensNonDiviseurs,\the\bnpcqo}%
@@ -22,6 +22,9 @@
\fi%
\bnpcqo=\numexpr\bnpcqo+1%
}%
+ \ifnum\cnpcqo=0\relax%
+ \xdef\RetiensDiviseurs{1}%
+ \fi%
}%
\newtoks\toklistecibleA%
@@ -35,6 +38,7 @@
\setKVdefault[CibleQO]{Couleur=Crimson,Rayon=2cm,ValeurMin=4,ValeurMax=10,Graines=false,Solution=false,Cibles=false,DivE=false,Style="<->"}%
\defKV[CibleQO]{Graine=\setKV[CibleQO]{Graines}\PfCGraineAlea{#1}}%
\defKV[CibleQO]{Cible=\setKV[CibleQO]{Cibles}}%
+
\NewDocumentCommand\CibleQuatreOperations{o}{%
\useKVdefault[CibleQO]%
\setKV[CibleQO]{#1}%
@@ -56,6 +60,7 @@
\PfCCQODiviseurs{\PfCCibleQO}%
\setsepchar{,}%
\readlist*\PfCRetiensDiviseurs{\RetiensDiviseurs}%
+% Il y a \PfCRetiensDiviseurslen{} diviseurs.
\ifnum\PfCRetiensDiviseurslen=1\relax%
\setKV[CibleQO]{DivE}%
\fi
diff --git a/macros/latex/contrib/profcollege/latex/PfCDefiTables.tex b/macros/latex/contrib/profcollege/latex/PfCDefiTables.tex
index c4c120c920..20c48cb593 100644
--- a/macros/latex/contrib/profcollege/latex/PfCDefiTables.tex
+++ b/macros/latex/contrib/profcollege/latex/PfCDefiTables.tex
@@ -5,7 +5,7 @@
\setKVdefault[DefiTable]{Solution=false,Math=false,LargeurT=5mm,Graines=false,Creation=false,ValeurMin=1,ValeurMax=10,Restreint=false}
\defKV[DefiTable]{Graine=\setKV[DefiTable]{Graines}}%
-\newcommand\MelangeListeNew[2]{%
+\NewDocumentCommand\MelangeListeNew{mm}{%
% #1 Liste à mélanger
% #2 Nombre d'éléments à conserver
\setsepchar[*]{/}\ignoreemptyitems%
@@ -57,30 +57,30 @@
\xdef\NombreDeProduitATester{\ListeDesProduitslen}%
}%
-\newcommand\DefiTableNombreLettreduCode[1]{%
+\NewDocumentCommand\DefiTableNombreLettreduCode{m}{%
\JeConstruisLesProduits{\useKV[DefiTable]{ValeurMin}}{\useKV[DefiTable]{ValeurMax}}%
- \MelangeListeNew{\ListeDesProduitsFoo}{\NombreDeProduitATester}
+ \MelangeListeNew{\ListeDesProduitsFoo}{\NombreDeProduitATester}%
% Les produits mélangés sont :\par
\readlist*\ListeDesProduits{\faa}%
- \xdef\ListeDesCaracteresFoo{a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/à/é/è/ê/ï/î/ô/ö/ù/ç/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O/P/Q/R/S/T/U/V/W/X/Y/Z/À/É/È/,/$?$/$;$/./$!$/$:$/-}
+ \xdef\ListeDesCaracteresFoo{a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/à/é/è/ê/ï/î/ô/ö/ù/ç/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O/P/Q/R/S/T/U/V/W/X/Y/Z/À/É/È/,/$?$/$;$/./$!$/$:$/-}%
\savecomparemode%
\comparestrict%
- \xdef\PfCFooDepart{}
+ \xdef\PfCFooDepart{}%
\StrLen{#1}[\LongueurMot]%
\xintFor* ##1 in{\xintSeq{1}{\LongueurMot}}\do{%
- \StrChar{#1}{##1}[\LettreMot]
- \xdef\PfCFooDepart{\PfCFooDepart \LettreMot/}
+ \StrChar{#1}{##1}[\LettreMot]%
+ \xdef\PfCFooDepart{\PfCFooDepart \LettreMot/}%
}%
\setsepchar[*]{/}\reademptyitems%
\readlist*\ListeDesLettres{\PfCFooDepart}%
\xdef\PfCFooArrivee{\ListeDesLettres[1]}%
\xintFor* ##1 in{\xintSeq{2}{\LongueurMot}}\do{%
- \StrCompare{\ListeDesLettres[##1]}{\\}[\PfCRetiensEtoile]
- \StrCompare{\ListeDesLettres[##1]}{ }[\PfCRetiensPara]
+ \StrCompare{\ListeDesLettres[##1]}{\\}[\PfCRetiensEtoile]%
+ \StrCompare{\ListeDesLettres[##1]}{ }[\PfCRetiensPara]%
\xintifboolexpr{\PfCRetiensEtoile==0 || \PfCRetiensPara==0}{}{%
\xdef\PfCTotal{0}%
\xintFor* ##2 in{\xintSeq{1}{\fpeval{##1-1}}}\do{%
- \StrCompare{\ListeDesLettres[##1]}{\ListeDesLettres[##2]}[\PfCRetiens]
+ \StrCompare{\ListeDesLettres[##1]}{\ListeDesLettres[##2]}[\PfCRetiens]%
\xdef\PfCTotal{\fpeval{\PfCTotal+\PfCRetiens}}%
}%
\xintifboolexpr{\PfCTotal==\fpeval{##1-1}}{\xdef\PfCFooArrivee{\PfCFooArrivee/\ListeDesLettres[##1]}}{}%
@@ -102,7 +102,7 @@
%Le caractère testé est \ListeTotaleDesCaracteres[##1]. On le compare à :%
\xdef\PfCTotal{0}%
\xintFor* ##2 in{\xintSeq{1}{\ListeDesLettresUniqueslen}}\do{%
- \StrCompare{\ListeTotaleDesCaracteres[##1]}{\ListeDesLettresUniques[##2]}[\PfCRetiens]
+ \StrCompare{\ListeTotaleDesCaracteres[##1]}{\ListeDesLettresUniques[##2]}[\PfCRetiens]%
\xdef\PfCTotal{\fpeval{\PfCTotal+\PfCRetiens}}%
}%
\xintifboolexpr{\PfCTotal==\ListeDesLettresUniqueslen}{\xdef\ListeCaracteresUniques{\ListeCaracteresUniques\ListeTotaleDesCaracteres[##1]/}}{}%
@@ -110,44 +110,44 @@
%La liste des caractères uniques à ajouter
\MelangeListeNew{\ListeCaracteresUniques}{\fpeval{\NombreDeProduitATester-\ListeDesLettresUniqueslen}}%
%\par La liste des éléments à mélanger est :\par
- \xdef\ListeDesCaracteresAUtiliser{}
+ \xdef\ListeDesCaracteresAUtiliser{}%
\xintFor* ##1 in{\xintSeq{1}{\ListeDesLettresUniqueslen}}\do{%
\xdef\ListeDesCaracteresAUtiliser{\ListeDesCaracteresAUtiliser \ListeDesLettresUniques[##1]/}%
}%
- \xdef\ListeDesCaracteresAUtiliser{\ListeDesCaracteresAUtiliser \faa}
- \MelangeListeNew{\ListeDesCaracteresAUtiliser}{\NombreDeProduitATester}
+ \xdef\ListeDesCaracteresAUtiliser{\ListeDesCaracteresAUtiliser \faa}%
+ \MelangeListeNew{\ListeDesCaracteresAUtiliser}{\NombreDeProduitATester}%
%Finalement, on utilise ces caractères :\par
\ignoreemptyitems%
- \readlist*\ListeFinaleDesCaracteres{\faa}
- \restorecomparemode
- \reademptyitems
-}
+ \readlist*\ListeFinaleDesCaracteres{\faa}%
+ \restorecomparemode%
+ \reademptyitems%
+}%
-\newcommand\DefiTable[2][]{%
+% \newcommand\DefiTable[2][]{%
+\NewDocumentCommand\DefiTable{om}{%
% 1 les clés
% 2 la table de décodage
\useKVdefault[DefiTable]%
\setKV[DefiTable]{#1}%
\ifboolKV[DefiTable]{Creation}{%
\ifboolKV[DefiTable]{Graines}{\PfCGraineAlea{\useKV[DefiTable]{Graine}}}{}%
- \DefiTableNombreLettreduCode{#2}%
- \ifboolKV[DefiTable]{Restreint}{%
+ \DefiTableNombreLettreduCode{#2}%
+ \ifboolKV[DefiTable]{Restreint}{%
\xdef\PfCNbColonnes{\fpeval{\useKV[DefiTable]{ValeurMax}-\useKV[DefiTable]{ValeurMin}+1}}%
\begin{tabular}{|>{\columncolor{gray!15}}c|*{\PfCNbColonnes}{c|}}
\hline
\rowcolor{gray!15}$\times$&\xintFor* ##1 in {\xintSeq {1}{\PfCNbColonnes}}\do{%
- \xintifForFirst{}{&}\fpeval{\useKV[DefiTable]{ValeurMin}+##1-1}%
- }\\\hline%
- \xintFor* ##1 in{\xintSeq{1}{10}}\do{%
- ##1\xintFor* ##2 in{\xintSeq{\useKV[DefiTable]{ValeurMin}}{\useKV[DefiTable]{ValeurMax}}}\do{%
- &\xintFor* ##3 in{\xintSeq{1}{\NombreDeProduitATester}}\do{%
- \xintifboolexpr{\fpeval{##1*##2}==\ListeDesProduits[##3] 'and' any(\useKV[DefiTable]{ValeurMin}<=##2<=\useKV[DefiTable]{ValeurMax},\useKV[DefiTable]{ValeurMin}<=##1<=\useKV[DefiTable]{ValeurMax})}{\ListeFinaleDesCaracteres[##3]}{}%
- }%
- }\\\hline%
+ \xintifForFirst{}{&}\fpeval{\useKV[DefiTable]{ValeurMin}+##1-1}%
+ }\\\hline%
+ \xintFor* ##1 in{\xintSeq{1}{10}}\do{%
+ ##1\xintFor* ##2 in{\xintSeq{\useKV[DefiTable]{ValeurMin}}{\useKV[DefiTable]{ValeurMax}}}\do{%
+ &\xintFor* ##3 in{\xintSeq{1}{\NombreDeProduitATester}}\do{%
+ \xintifboolexpr{\fpeval{##1*##2}==\ListeDesProduits[##3] 'and' any(\useKV[DefiTable]{ValeurMin}<=##2<=\useKV[DefiTable]{ValeurMax},\useKV[DefiTable]{ValeurMin}<=##1<=\useKV[DefiTable]{ValeurMax})}{\ListeFinaleDesCaracteres[##3]}{}%
}%
- \end{tabular}%
- }{%
-% \begin{center}
+ }\\\hline%
+ }%
+ \end{tabular}%
+ }{%
\begin{tabular}{|>{\columncolor{gray!15}}c|*{10}{c|}}
\hline
\rowcolor{gray!15}$\times$&\xintFor* ##1 in {\xintSeq {1}{10}}\do{%
@@ -161,10 +161,9 @@
}\\\hline%
}%
\end{tabular}%
-% \end{center}
- }
+ }%
}{%
- \setsepchar[*]{§* }%
+ \setsepchar[*]{§* }%
\readlist*\ListeDefiTableCode{#2}%
\begin{NiceTabular}{>{\columncolor{gray!15}}{c}*{10}{c}}[hvlines]
\rowcolor{gray!15}$\times$&\xintFor* ##1 in {\xintSeq {1}{10}}\do{%
@@ -186,10 +185,12 @@
}%
}%
-\newcommand\DefiTableTexte[3][]{%
+\NewDocumentCommand\DefiTableTexte{omm}{%
\useKVdefault[DefiTable]%
\setKV[DefiTable]{#1}%
\ifboolKV[DefiTable]{Creation}{%
+ \ifboolKV[DefiTable]{Graines}{\PfCGraineAlea{\useKV[DefiTable]{Graine}}}{}%
+ \DefiTableNombreLettreduCode{#3}%
\setsepchar[*]{\\* }%
\readlist*\ListeDefiTableTableau{#3}%
\xdef\ListeDefiTableMax{0}%
diff --git a/macros/latex/contrib/profcollege/latex/PfCDessinAlgo.tex b/macros/latex/contrib/profcollege/latex/PfCDessinAlgo.tex
new file mode 100644
index 0000000000..7c227831e1
--- /dev/null
+++ b/macros/latex/contrib/profcollege/latex/PfCDessinAlgo.tex
@@ -0,0 +1,370 @@
+%%%
+% Dessin Algo
+%%%
+\newtoks\tokDessinAlgo%
+\def\UpdatetoksDA#1\nil{\addtotok\tokDessinAlgo{#1,}}%
+
+\setKVdefault[DessinAlgo]{Solution=false,Largeur=14,Hauteur=14,Origine={(0,0)},Consignes=8,Enonce=false,Code=false,Relatif=false,Symbole=true}%
+\defKV[DessinAlgo]{Traces=\setKV[DessinAlgo]{Code}}%
+\defKV[DessinAlgo]{Couleur=\setKV[DessinAlgo]{Solution}}%
+
+\NewDocumentCommand\DessinAlgo{om}{%
+ \tokDessinAlgo{}%
+ \useKVdefault[DessinAlgo]%
+ \setKV[DessinAlgo]{#1}%
+ \setsepchar[*]{/}\ignoreemptyitems%
+ \readlist*\PfCListeDessinAlgo{#2}%
+ \foreachitem\compteur\in\PfCListeDessinAlgo{\expandafter\UpdatetoksDA\compteur\nil}%
+ \ifboolKV[DessinAlgo]{Relatif}{%
+ \BuildDessinAlgoRelatif{\the\tokDessinAlgo}%
+ }{%
+ \BuildDessinAlgo{\the\tokDessinAlgo}%
+ }%
+}%
+
+\NewDocumentCommand\BuildDessinAlgoRelatif{m}{%
+ \ifluatex%
+ \mplibforcehmode%
+ \begin{mplibcode}
+ u:=1cm;
+ LongueurConsigne=\useKV[DessinAlgo]{Consignes};
+ LargeurQuad=\useKV[DessinAlgo]{Largeur};
+ HauteurQuad=\useKV[DessinAlgo]{Hauteur};
+ pair A[][],B[];
+ path zone;
+ zone=unitsquare scaled 3.5mm;
+ boolean Enonce,Code,Solution,Symbole;
+ Enonce=\useKV[DessinAlgo]{Enonce};
+ Code=\useKV[DessinAlgo]{Code};
+ Solution=\useKV[DessinAlgo]{Solution};
+ Symbole=\useKV[DessinAlgo]{Symbole};
+ color Couleur;
+ if Solution:
+ Couleur=\useKV[DessinAlgo]{Couleur};
+ fi;
+ %
+ vardef DessineConsigne(text t)=
+ n:=0;
+ nborig:=0;
+ k=1;
+ l:=1;
+ %On détermine les points de départs;
+ for p_=t:
+ if pair p_:
+ nborig:=nborig+1;
+ if (n mod LongueurConsigne)>0:
+ l:=l-1;
+ elseif nborig=2:
+ l:=l-1;
+ fi;
+ k:=1;
+ n:=0;
+ B[nborig]=0.35*u*(k,2*l+0.5);
+ else:
+ if numeric p_:
+ n:=n+1;
+ NBorig[nborig]:=n;
+ if (n mod 2)=1:
+ Deplacement[nborig][(n+1) div 2]=p_;
+ else:
+ TourneAngle[nborig][n div 2]=p_
+ fi;
+ fi;
+ fi;
+ endfor;
+ % On affiche
+ picture RetiensLong;
+ r:=0;
+ Long:=0;
+ h:=0;
+ for k=1 upto nborig:
+ if k>1:
+ r:=r-2;
+ Long:=0;
+ h:=0;
+ fi;
+ for l=1 step 2 until NBorig[nborig]-1:
+ if l=1:
+ RetiensLong:=image(label.rt(TEX("av "&decimal(Deplacement[k][(l+1) div 2])),(0,0)));
+ draw RetiensLong shifted (Long,5mm*r);
+ if nborig=1:
+ %
+ else:
+ label.lft(TEX("D$_"&decimal(k)&"$"),(Long,5mm*r));
+ fi;% label(TEX(decimal(h)),3.5mm*(0,-h)) withcolor red;
+ Long:=Long+abs(lrcorner RetiensLong-llcorner RetiensLong)+1mm;
+ h:=h+1;
+ else:
+ EcartAngle:=TourneAngle[k][(l+1) div 2]-TourneAngle[k][(l-1) div 2];
+ if EcartAngle>0:
+ if EcartAngle<180:
+ if Symbole:
+ RetiensLong:=image(
+ drawarrow ((point(1) of zone){dir90}..{dir180}(point(3) of zone)) shifted(1mm,-1mm);
+ label.rt(TEX("\ang{"&decimal(EcartAngle)&"}"),point(1) of zone);
+ );
+ else:
+ RetiensLong:=image(label.rt(TEX("TG \ang{"&decimal(EcartAngle)&"}"),(0,0)));
+ fi;
+ else:
+ if Symbole:
+ RetiensLong:=image(
+ drawarrow ((point(0) of zone){dir90}..{dir0}(point(2) of zone)) shifted(1mm,-1mm);
+ label.rt(TEX("\ang{"&decimal(360-EcartAngle)&"}"),point(1) of zone);
+ );
+ else:
+ RetiensLong:=image(label.rt(TEX("TD \ang{"&decimal(360-EcartAngle)&"}"),(0,0)));
+ fi;
+ fi;
+ else:
+ if abs(EcartAngle)<180:
+ if Symbole:
+ RetiensLong:=image(
+ drawarrow ((point(0) of zone){dir90}..{dir0}(point(2) of zone)) shifted(1mm,-1mm);
+ label.rt(TEX("\ang{"&decimal(abs(EcartAngle))&"}"),point(1) of zone);
+ );
+ else:
+ RetiensLong:=image(label.rt(TEX("TD \ang{"&decimal(abs(EcartAngle))&"}"),(0,0)));
+ fi;
+ else:
+ if Symbole:
+ RetiensLong:=image(
+ drawarrow ((point(1) of zone){dir90}..{dir180}(point(3) of zone)) shifted(1mm,-1mm);
+ label.rt(TEX("\ang{"&decimal(360-abs(EcartAngle))&"}"),point(1) of zone);
+ );
+ else:
+ RetiensLong:=image(label.rt(TEX("TG \ang{"&decimal(360-abs(EcartAngle))&"}"),(0,0)));
+ fi;
+ fi;
+ fi;
+ draw RetiensLong shifted (Long,5mm*r);
+ Long:=Long+abs(lrcorner RetiensLong-llcorner RetiensLong)+1mm;
+ %label(TEX(decimal(h)),3.5mm*(0,-h)) withcolor blue;
+ RetiensLong:=image(label.rt(TEX("Av "&decimal(Deplacement[k][(l+1) div 2])),(0,0)));
+ draw RetiensLong shifted (Long,5mm*r);
+ Long:=Long+abs(lrcorner RetiensLong-llcorner RetiensLong)+1mm;
+ h:=h+1;
+ %label(TEX(decimal(h)),3.5mm*(0,-h)) withcolor green;
+ fi;
+% label(TEX(decimal(h mod 8)),3.5mm*(0,-h)) withcolor Purple;
+ if ((h mod LongueurConsigne)=0):% and (h>0):
+ %label(TEX("OKAYYYYYYY"),3.5mm*(0,-h)) withcolor Purple;
+ Long:=0;
+ r:=r-1;
+ h:=0;
+ fi;
+ endfor;
+ endfor;
+ enddef;
+ %
+ vardef DessinQuadrillage(text t)=
+ drawoptions(withcolor 0.7white);
+ for k=0 upto LargeurQuad:
+ trace (3.5mm*(k,0))--(3.5mm*(k,HauteurQuad));
+ endfor;
+ for k=0 upto HauteurQuad:
+ trace (3.5mm*(0,k))--(3.5mm*(LargeurQuad,k));
+ endfor;
+ drawoptions();
+ % On détermine les points
+ n=0;
+ nborig:=0;
+ for p_=t:
+ if pair p_:
+ nborig:=nborig+1;
+ A[nborig][0]=3.5mm*p_;
+ n:=0;
+ else:
+ n:=n+1;
+ NombreOrig[nborig]:=n;
+ Nombre[nborig][n]=p_;
+ fi;
+ endfor;
+ for l=1 upto nborig:
+ for k=1 step 2 until NombreOrig[l]:
+ if (Nombre[l][k+1] mod 90)=0:
+ long:=3.5mm
+ else:
+ long:=sqrt(2)*3.5mm
+ fi;
+ A[l][(k+1) div 2]-A[l][k div 2]=long*Nombre[l][k]*(unitvector((1,0)-(0,0)) rotated Nombre[l][k+1]);
+ endfor;
+ endfor;
+ if nborig=1:
+ dotlabel("",A[nborig][0]);
+ label.ulft(TEX("D"),symetrie(A[nborig][1],A[nborig][0]));
+ drawarrow A[nborig][0]--(0.75[A[nborig][0],A[nborig][1]]);
+ else:
+ for k=1 upto nborig:
+ label(TEX("D$_"&decimal(k)&"$"),symetrie(A[k][1],A[k][0]));
+ dotlabel("",A[k][0]);
+ drawarrow A[k][0]--(0.75[A[k][0],A[k][1]]);
+ endfor;
+ fi;
+ enddef;
+ %
+ vardef DessineSolution=
+ for l=1 upto nborig:
+ for k=1 step 2 until NombreOrig[l]:
+ draw A[l][(k div 2)]--A[l][(k+1) div 2] withpen pencircle scaled 2 withcolor Couleur;
+ endfor;
+ endfor;
+ enddef;
+ if Enonce:
+ DessineConsigne(#1);
+ else:
+ DessinQuadrillage(#1);
+ if Code:
+ \useKV[DessinAlgo]{Traces};
+ fi;
+ if Solution:
+ DessineSolution;
+ fi;
+ fi;
+ \end{mplibcode}
+ \fi%
+}%
+
+\NewDocumentCommand\BuildDessinAlgo{m}{%
+ \ifluatex%
+ \mplibforcehmode%
+ \begin{mplibcode}
+ u:=1cm;
+ LongueurConsigne=\useKV[DessinAlgo]{Consignes};
+ LargeurQuad=\useKV[DessinAlgo]{Largeur};
+ HauteurQuad=\useKV[DessinAlgo]{Hauteur};
+ pair A[][],B[];
+ path zone;
+ zone=unitsquare scaled 3.5mm;
+ boolean Enonce,Code,Solution;
+ Enonce=\useKV[DessinAlgo]{Enonce};
+ Code=\useKV[DessinAlgo]{Code};
+ Solution=\useKV[DessinAlgo]{Solution};
+ color Couleur;
+ if Solution:
+ Couleur=\useKV[DessinAlgo]{Couleur};
+ fi;
+ %
+ vardef DessineConsigne(text t)=
+ n:=0;
+ nborig:=0;
+ k=1;
+ l:=1;
+ for p_=t:
+ if pair p_:
+ nborig:=nborig+1;
+ if (n mod LongueurConsigne)>0:
+ l:=l-1;
+ elseif nborig=2:
+ l:=l-1;
+ fi;
+ k:=1;
+ n:=0;
+ B[nborig]=0.35*u*(k,2*l+0.5);
+ else:
+ n:=n+1;
+% draw (zone shifted(0.35*u*(k,2*l)));
+ if (n mod 2)=1:
+ label(TEX(decimal(p_)),(center zone) shifted(0.35*u*(k,2*l)));
+ k:=k+1;
+ else:
+ if p_=0:
+ drawarrow ((point(0) of (unitsquare scaled 3.5mm))--(point(1) of (unitsquare scaled 3.5mm))) shifted ((center zone) shifted(u*(0.35*k-0.175,0.35*2*l)));
+ elseif p_=45:
+ drawarrow ((point(0) of (unitsquare scaled 3.5mm))--(point(2) of (unitsquare scaled 3.5mm))) shifted ((llcorner zone) shifted(u*0.35*(k,2*l)));
+ elseif p_=90:
+ drawarrow ((point(0) of (unitsquare scaled 3.5mm))--(point(3) of (unitsquare scaled 3.5mm))) shifted ((llcorner zone) shifted(u*(0.35*k+0.175,0.35*2*l)));
+ elseif p_=135:
+ drawarrow ((point(1) of (unitsquare scaled 3.5mm))--(point(3) of (unitsquare scaled 3.5mm))) shifted ((llcorner zone) shifted(u*0.35*(k,2*l)));
+ elseif p_=180:
+ drawarrow ((point(1) of (unitsquare scaled 3.5mm))--(point(0) of (unitsquare scaled 3.5mm))) shifted ((center zone) shifted(u*(0.35*k-0.175,0.35*2*l)));
+ elseif p_=-45:
+ drawarrow ((point(3) of (unitsquare scaled 3.5mm))--(point(1) of (unitsquare scaled 3.5mm))) shifted ((llcorner zone) shifted(u*0.35*(k,2*l)));
+ elseif p_=-90:
+ drawarrow ((point(3) of (unitsquare scaled 3.5mm))--(point(0) of (unitsquare scaled 3.5mm))) shifted ((llcorner zone) shifted(u*(0.35*k+0.175,0.35*2*l)));
+ elseif p_=-135:
+ drawarrow ((point(2) of (unitsquare scaled 3.5mm))--(point(0) of (unitsquare scaled 3.5mm))) shifted ((llcorner zone) shifted(u*0.35*(k,2*l)));
+ fi;
+ drawoptions();
+ k:=k+2;
+ fi;
+ if (k mod (2*LongueurConsigne+(LongueurConsigne)+1))>0:
+ else:
+ l:=l-1;
+ k:=1;
+ fi;
+ fi;
+ endfor;
+ if nborig=1:
+ label.lft(TEX("D"),B[1]);
+ else:
+ for k=1 upto nborig:
+ label.lft(TEX("D$_"&decimal(k)&"$"),B[k]);
+ endfor;
+ fi;
+ enddef;
+ %
+ vardef DessinQuadrillage(text t)=
+ drawoptions(withcolor 0.7white);
+ for k=0 upto LargeurQuad:
+ trace (3.5mm*(k,0))--(3.5mm*(k,HauteurQuad));
+ endfor;
+ for k=0 upto HauteurQuad:
+ trace (3.5mm*(0,k))--(3.5mm*(LargeurQuad,k));
+ endfor;
+ drawoptions();
+ % Les points
+ n=0;
+ nborig:=0;
+ for p_=t:
+ if pair p_:
+ nborig:=nborig+1;
+ A[nborig][0]=3.5mm*p_;
+ n:=0;
+ else:
+ n:=n+1;
+ NombreOrig[nborig]:=n;
+ Nombre[nborig][n]=p_;
+ fi;
+ endfor;
+ for l=1 upto nborig:
+ for k=1 step 2 until NombreOrig[l]:
+ if (Nombre[l][k+1] mod 90)=0:
+ long:=3.5mm
+ else:
+ long:=sqrt(2)*3.5mm
+ fi;
+ A[l][(k+1) div 2]-A[l][k div 2]=long*Nombre[l][k]*(unitvector((1,0)-(0,0)) rotated Nombre[l][k+1]);
+ endfor;
+ endfor;
+ %
+ if nborig=1:
+ dotlabel.ulft(TEX("D"),A[nborig][0]);
+ else:
+ for k=1 upto nborig:
+ dotlabel.ulft(TEX("D$_"&decimal(k)&"$"),A[k][0]);
+ endfor;
+ fi;
+ enddef;
+ %
+ vardef DessineSolution=
+ for l=1 upto nborig:
+ for k=1 step 2 until NombreOrig[l]:
+ draw A[l][(k div 2)]--A[l][(k+1) div 2] withpen pencircle scaled 2 withcolor Couleur;
+ endfor;
+ endfor;
+ enddef;
+ if Enonce:
+ DessineConsigne(#1);
+ else:
+ DessinQuadrillage(#1);
+ if Code:
+ \useKV[DessinAlgo]{Traces};
+ fi;
+ if Solution:
+ DessineSolution;
+ fi;
+ fi;
+ \end{mplibcode}
+ \fi%
+}% \ No newline at end of file
diff --git a/macros/latex/contrib/profcollege/latex/PfCFractionAireCarre.tex b/macros/latex/contrib/profcollege/latex/PfCFractionAireCarre.tex
new file mode 100644
index 0000000000..dbfe8109d2
--- /dev/null
+++ b/macros/latex/contrib/profcollege/latex/PfCFractionAireCarre.tex
@@ -0,0 +1,158 @@
+%%%
+% Fraction d'aire d'un carré
+%%%
+\setKVdefault[JeuAireCarre]{Couleur=LightSteelBlue,CouleurFond=Cornsilk,Perso=false,Graines=false,Parts=3,Longueur=4,NbPoints=2,Angle=0}%
+\defKV[JeuAireCarre]{Graine=\setKV[JeuAireCarre]{Graines}\PfCGraineAlea{#1}}%
+\defKV[JeuAireCarre]{ListeParts=\setKV[JeuAireCarre]{Perso}\xdef\PfCFooJeuAireCarre{#1}}%
+\NewDocumentCommand\FractionAireCarre{o}{%
+ \useKVdefault[JeuAireCarre]%
+ \setKV[JeuAireCarre]{#1}%
+ \ifboolKV[JeuAireCarre]{Perso}{%
+ \BuildJeuAireCarre{\PfCFooJeuAireCarre}%
+ }{%
+ \BuildJeuAireCarre{}%
+ }%
+}%
+
+\def\BuildJeuAireCarreCode{%
+ vardef ChoixParmiEntier(expr nentier,nbretiens)=
+ numeric ListeInitiale[],ListeFinale[];
+ for l=1 upto nentier:
+ ListeInitiale[l]=l;
+ ListeIntermed[l]=l;
+ endfor;
+ maxx=nentier;
+ for l=1 upto nbretiens:
+ intermed:=ceiling(uniformdeviate(maxx));
+ ListeFinale[l]=ListeInitiale[intermed];
+ f:=0;
+ for g=1 upto nentier:
+ if g<>intermed:
+ f:=f+1;
+ ListeIntermed[f]:=ListeInitiale[g];
+ fi;
+ endfor;
+ maxx:=nentier-l;
+ for h=1 upto maxx:
+ ListeInitiale[h]:=ListeIntermed[h];
+ endfor;
+ endfor;
+ enddef;
+ % On crée un Quick Sort
+ def QS(expr ndeb,nfin)=
+ begingroup
+ save v,m,x;
+ if ndeb<nfin:
+ v:=ListeFinale[cpt[ndeb]];
+ m:=ndeb;
+ for i=(ndeb+1) upto nfin:
+ if ListeFinale[cpt[i]]<v:
+ m:=m+1;
+ x:=cpt[m];cpt[m]:=cpt[i];cpt[i]:=x;
+ fi
+ endfor;
+ x:=cpt[m];cpt[m]:=cpt[ndeb];cpt[ndeb]:=x;
+ QS(ndeb,m-1);
+ QS(m+1,nfin);
+ fi
+ endgroup
+ enddef;
+ %
+ vardef PartsPerso(text t)=
+ nbptsperso:=0;
+ for p_=t:
+ nbptsperso:=nbptsperso+1;
+ Base[nbptsperso]=point(length CarreSupport*p_/(4*Parts)) of CarreSupport;
+ endfor;
+ NbPoints:=nbptsperso;
+ enddef;
+ %
+ Cote=\useKV[JeuAireCarre]{Longueur};
+ Parts=\useKV[JeuAireCarre]{Parts};
+ NbPoints=\useKV[JeuAireCarre]{NbPoints};
+ Angle=\useKV[JeuAireCarre]{Angle};
+ color Couleur,CouleurFond;
+ CouleurFond=\useKV[JeuAireCarre]{CouleurFond};
+ Couleur=\useKV[JeuAireCarre]{Couleur};
+ boolean Perso;
+ Perso=\useKV[JeuAireCarre]{Perso};
+ pair A[],M[],Base[];
+ A1=(0,0);
+ A2=pointarc(cercles(A1,Cote*cm),45);
+ A3=rotation(A1,A2,-90);
+ A4-A3=A1-A2;
+ path CarreSupport;
+ CarreSupport=polygone(A1,A2,A3,A4);
+ Base0=A[1];
+ for k=0 upto (4*Parts):
+ M[k]=point(length CarreSupport*k/(4*Parts)) of CarreSupport;
+ endfor;
+}
+%
+\NewDocumentCommand\BuildJeuAireCarre{m}{%
+ \ifluatex
+ \mplibforcehmode
+ \begin{mplibcode}
+ \BuildJeuAireCarreCode
+ if Perso=false:
+ if NbPoints>2:
+ ChoixParmiEntier(4*Parts-1,NbPoints);
+ else:
+ ChoixParmiEntier(3*Parts-1,NbPoints);
+ fi;
+ for k=1 upto NbPoints:
+ cpt[k]=k;
+ endfor;
+ QS(1,NbPoints);
+ for k=1 upto NbPoints:
+ place:=ListeFinale[cpt[k]];
+ Base[k]=M[place];
+ endfor;
+ else:
+ PartsPerso(#1);
+ fi;
+ fill CarreSupport withcolor CouleurFond;
+ fill Base0 for k=1 upto NbPoints:--Base[k] endfor --cycle withcolor Couleur;
+ trace Base0 for k=1 upto NbPoints:--Base[k] endfor --cycle;
+ trace CarreSupport;
+ for k=0 upto (4*Parts):
+ draw cercles(M[k],0.5mm);
+ endfor;
+ picture Retiens;
+ Retiens=currentpicture;
+ currentpicture:=nullpicture;
+ trace rotation(Retiens,iso(A1,A3),Angle);
+ \end{mplibcode}
+ \else
+ \begin{mpost}[mpsettings={\BuildJeuAireCarreCode}]
+ if Perso=false:
+ if NbPoints>2:
+ ChoixParmiEntier(4*Parts-1,NbPoints);
+ else:
+ ChoixParmiEntier(3*Parts-1,NbPoints);
+ fi;
+ for k=1 upto NbPoints:
+ cpt[k]=k;
+ endfor;
+ QS(1,NbPoints);
+ for k=1 upto NbPoints:
+ place:=ListeFinale[cpt[k]];
+ Base[k]=M[place];
+ endfor;
+ else:
+ PartsPerso(#1);
+ fi;
+ fill CarreSupport withcolor CouleurFond;
+ fill Base0 for k=1 upto NbPoints:--Base[k] endfor --cycle withcolor Couleur;
+ trace Base0 for k=1 upto NbPoints:--Base[k] endfor --cycle;
+ trace CarreSupport;
+ for k=0 upto (4*Parts):
+ draw cercles(M[k],0.5mm);
+ endfor;
+ picture Retiens;
+ Retiens=currentpicture;
+ currentpicture:=nullpicture;
+ trace rotation(Retiens,iso(A1,A3),Angle);
+ \end{mpost}
+ \fi
+}% \ No newline at end of file
diff --git a/macros/latex/contrib/profcollege/latex/PfCFractionNombre.tex b/macros/latex/contrib/profcollege/latex/PfCFractionNombre.tex
new file mode 100644
index 0000000000..f373aecc6c
--- /dev/null
+++ b/macros/latex/contrib/profcollege/latex/PfCFractionNombre.tex
@@ -0,0 +1,416 @@
+%%%
+% Fraction Nombre
+%%%
+\newtoks\tokFractionNombrePerso%
+\def\UpdatetoksFN#1\nil{\addtotok\tokFractionNombrePerso{"#1",}}%
+
+\setKVdefault[ClesFN]{Unite=5cm,Aire=false,Solution=false,Quadrillage=false,PasQuad=5mm,HautQuad=3,LargQuad=8,Vide=false,Creation=false,Couleur=blue,UniteAire=1x1}%
+\defKV[ClesFN]{Perso=\setKV[ClesFN]{Creation}\xdef\PfCFooCheminFN{#1}}%
+
+\NewDocumentCommand\FractionNombre{om}{%
+ \useKVdefault[ClesFN]%
+ \setKV[ClesFN]{#1}%
+ \tokFractionNombrePerso{}%
+ \ifboolKV[ClesFN]{Creation}{%
+ \setsepchar{,}\ignoreemptyitems%
+ \readlist*\PfCListeDeplacements{\PfCFooCheminFN}%
+ \foreachitem\compteur\in\PfCListeDeplacements{\expandafter\UpdatetoksFN\compteur\nil}%
+ }{}%
+ \StrCut{#2}{/}\PfCNumA\PfCNumB%
+ \ifboolKV[ClesFN]{Aire}{%
+ \StrCut{\useKV[ClesFN]{UniteAire}}{x}\PfCAirex\PfCAirey%
+ \ifboolKV[ClesFN]{Creation}{%
+ \BuildFractionNombreAirePerso{\PfCNumA}{\PfCNumB}{\PfCAirex}{\PfCAirey}{\the\tokFractionNombrePerso}%
+ }{%
+ \BuildFractionNombreAire{\PfCNumA}{\PfCNumB}{\PfCAirex}{\PfCAirey}%
+ }%
+ }{%
+ \ifboolKV[ClesFN]{Quadrillage}{%
+ \BuildFractionNombreQuadrillage{\PfCNumA}{\PfCNumB}{\the\tokFractionNombrePerso}%
+ }{%
+ \BuildFractionNombreSegment{\PfCNumA}{\PfCNumB}%
+ }%
+ }%
+}%
+
+\NewDocumentCommand\BuildFractionNombreAirePerso{mmmmm}{%
+ \ifluatex%
+ \mplibforcehmode%
+ \begin{mplibcode}
+ vardef LireMotif(text t)=
+ lmotif=0;
+ hmotif=0;
+ for p_=t:
+ hmotif:=hmotif+1;
+ if lmotif<(length p_):
+ lmotif:=length p_;
+ fi;
+ endfor;
+ enddef;
+ %
+ vardef PlacerMotif(text t)=
+ ChoixLigneD=hmotif+ceiling(uniformdeviate(HautQuad-1-hmotif));
+ ChoixColonneD=ceiling(uniformdeviate(LargQuad-#3-1-lmotif));
+ Colonne:=ChoixColonneD;
+ Ligne=ChoixLigneD;
+ for p_=t:
+ Colonne:=ChoixColonneD;
+ for k=0 upto ((length p_)-1):
+ if (substring(k,k+1) of p_)="x":
+ fill ((unitsquare scaled 5mm) shifted (5mm*(Colonne-1,Ligne-1))) withcolor LightSteelBlue;
+ fi;
+ Colonne:=Colonne+1;
+ endfor;
+ Ligne:=Ligne-1;
+ endfor;
+ enddef;
+ %
+ PasQuad=\useKV[ClesFN]{PasQuad};
+ HautQuad=\useKV[ClesFN]{HautQuad};
+ LargQuad=\useKV[ClesFN]{LargQuad};
+ pair A,B,C,D,U[];
+ A=(0,0);
+ B-A=PasQuad*(LargQuad,0);
+ C-B=PasQuad*(0,HautQuad);
+ D-C=A-B;
+ % l'unité
+ U0=C;
+ U1-U0=#3*PasQuad*(-1,0);
+ U3-U0=#4*PasQuad*(0,-1);
+ U2-U3=U1-U0;
+ %
+ LireMotif(#5);
+ PlacerMotif(#5);
+ % Tracage
+ fill polygone(U0,U1,U2,U3) withcolor 0.7white;
+ label.top(TEX("\textbf{1 ua}"),iso(U1,U0));
+ %Le quadrillage
+ trace polygone(A,B,C,D);
+ for k=1 upto LargQuad-1:
+ trace (k/LargQuad)[A,B]--(k/LargQuad)[D,C];
+ endfor;
+ for k=1 upto HautQuad-1:
+ trace (k/HautQuad)[A,D]--(k/HautQuad)[B,C];
+ endfor;
+ \end{mplibcode}
+ \fi%
+}%
+
+\NewDocumentCommand\BuildFractionNombreAire{mmmm}{%
+ \ifluatex%
+ \mplibforcehmode%
+ \begin{mplibcode}
+ boolean Impossible[][];
+ %
+ vardef InitialisationZone=
+ for k=-1 upto HautQuad+1:
+ for l=-1 upto LargQuad+1:
+ Impossible[k][l]=true;
+ endfor;
+ endfor;
+ for k=1 upto HautQuad-1:
+ for l=1 upto LargQuad-#3-1:
+ Impossible[k][l]:=false;
+ endfor;
+ endfor;
+ enddef;
+ %
+ vardef RAZZone=
+ pair PileChemin[];
+ indiceChemin:=0;
+ enddef;
+ %
+ def PushChemin(expr tt)=
+ if indiceChemin<1:
+ PileChemin[1]:=tt;
+ indiceChemin:=1;
+ else:
+ PileChemin[indiceChemin+1]:=tt;
+ indiceChemin:=indiceChemin+1;
+ fi;
+ enddef;
+ %
+ def PopChemin=
+ currentpicture:=nullpicture;
+ RAZZone;
+ for k=-1 upto HautQuad:
+ for l=-1 upto LargQuad:
+ Impossible[k][l]:=true;
+ endfor;
+ endfor;
+ for k=1 upto HautQuad-1:
+ for l=1 upto LargQuad-#3-1:
+ Impossible[k][l]:=false;
+ endfor;
+ endfor;
+ %Redemarrage
+ nbcaseschoisies:=1;
+ PushChemin((ChoixLigneD,ChoixColonneD));
+ fill ((unitsquare scaled 5mm) shifted (5mm*(ChoixColonneD-1,ChoixLigneD-1))) withcolor LightSteelBlue;
+ Impossible[ChoixLigneD][ChoixColonneD]:=true;
+ VoisinDispo(ChoixLigneD,ChoixColonneD);
+ enddef;
+ %
+ %Pile des cases voisines de la case parcourue
+ pair PileVoisin[];
+ numeric indiceVoisin;
+ indiceVoisin=0;
+ %
+ vardef RAZPileVoisin=
+ indiceVoisin:=0;
+ enddef;
+ %
+ def PushVoisin(expr tt)=
+ if indiceVoisin<1:
+ PileVoisin[1]:=tt;
+ indiceVoisin:=1;
+ else:
+ PileVoisin[indiceVoisin+1]:=tt;
+ indiceVoisin:=indiceVoisin+1;
+ fi;
+ enddef;
+ %
+ vardef VoisinDispo(expr la,lo)=
+ RAZPileVoisin;
+ numeric nbvoisin;
+ nbvoisin=0;
+ if Impossible[la+1][lo]=false:
+ nbvoisin:=nbvoisin+1;
+ PushVoisin((la+1,lo));
+ fi;
+ if Impossible[la-1][lo]=false:
+ nbvoisin:=nbvoisin+1;
+ PushVoisin((la-1,lo));
+ fi;
+ if Impossible[la][lo+1]=false:
+ nbvoisin:=nbvoisin+1;
+ PushVoisin((la,lo+1));
+ fi;
+ if Impossible[la][lo-1]=false:
+ nbvoisin:=nbvoisin+1;
+ PushVoisin((la,lo-1));
+ fi;
+ enddef;
+ %
+ PasQuad=\useKV[ClesFN]{PasQuad};
+ HautQuad=\useKV[ClesFN]{HautQuad};
+ LargQuad=\useKV[ClesFN]{LargQuad};
+ pair A,B,C,D,U[];
+ A=(0,0);
+ B-A=PasQuad*(LargQuad,0);
+ C-B=PasQuad*(0,HautQuad);
+ D-C=A-B;
+ % l'unité
+ U0=C;
+ U1-U0=#3*PasQuad*(-1,0);
+ U3-U0=#4*PasQuad*(0,-1);
+ U2-U3=U1-U0;
+ % Le nombres total de cases à colorier
+ NbTotalCasesAColorier=((#1*#3*#4)/#2);
+ NbTotalCasesRestantes=HautQuad*(LargQuad-#3-1);
+ %
+ InitialisationZone;
+ RAZZone;
+ %
+ ChoixLigneD=ceiling(uniformdeviate(HautQuad-1));
+ ChoixColonneD=ceiling(uniformdeviate(LargQuad-#3-1));
+ %
+ PushChemin((ChoixLigneD,ChoixColonneD));
+ nbcaseschoisies=1;
+ fill ((unitsquare scaled 5mm) shifted (5mm*(ChoixColonneD-1,ChoixLigneD-1))) withcolor LightSteelBlue;
+ Impossible[ChoixLigneD][ChoixColonneD]:=true;
+ VoisinDispo(ChoixLigneD,ChoixColonneD);
+ % Le "parcours"
+ forever: exitif nbcaseschoisies>NbTotalCasesAColorier-1;
+ nb:=ceiling(uniformdeviate(nbvoisin));
+ if nb>0:
+ for k=1 upto nbvoisin:
+ Impossible[xpart(PileVoisin[nb])][ypart(PileVoisin[nb])]:=true;
+ endfor;
+ PushChemin((xpart(PileVoisin[nb]),ypart(PileVoisin[nb])));
+ nbcaseschoisies:=nbcaseschoisies+1;
+ fill ((unitsquare scaled 5mm) shifted (5mm*(ypart(PileVoisin[nb])-1,xpart(PileVoisin[nb])-1))) withcolor LightSteelBlue;
+ VoisinDispo(xpart(PileChemin[indiceChemin]),ypart(PileChemin[indiceChemin]));
+ else:
+ PopChemin;
+ fi;
+ endfor;
+ % Tracage
+ fill polygone(U0,U1,U2,U3) withcolor 0.7white;
+ label.top(TEX("\textbf{1 ua}"),iso(U1,U0));
+ %Le quadrillage
+ trace polygone(A,B,C,D);
+ for k=1 upto LargQuad-1:
+ trace (k/LargQuad)[A,B]--(k/LargQuad)[D,C];
+ endfor;
+ for k=1 upto HautQuad-1:
+ trace (k/HautQuad)[A,D]--(k/HautQuad)[B,C];
+ endfor;
+ \end{mplibcode}
+ \fi
+}%
+
+\NewDocumentCommand\BuildFractionNombreSegment{mm}{%
+ \ifluatex%
+ \mplibforcehmode%
+ \begin{mplibcode}
+ Unite:=\useKV[ClesFN]{Unite};
+ boolean Solution,Vide;
+ Solution=\useKV[ClesFN]{Solution};
+ Vide=\useKV[ClesFN]{Vide};
+ color CoulFN;
+ CoulFN=\useKV[ClesFN]{Couleur};
+ Num:=#1;
+ Pas:=#2;
+ pair A,B,C,D;
+ A=(0,0);
+ B=Unite*(1,0);
+ if Num>Pas:
+ C=((Num+1)/Pas)[A,B];
+ Total=Num+1;
+ else:
+ C=B;
+ Total=Pas;
+ fi;
+ D=(Num/Pas)[A,B];
+ trace segment(A,C);
+ for k=0 upto Total:
+ trace ((0,-1mm)--(0,1mm)) shifted ((k/Pas)[A,B]);
+ endfor;
+ trace cotationmil(A,B,5mm,15,TEX("1 ul"));
+ if Solution:
+ draw (A--D) withpen pencircle scaled 2 withcolor CoulFN;
+ trace cotationmil(A,D,-5mm,25,TEX("$?=\dfrac{"&decimal(#1)&"}{"&decimal(#2)&"}$~ul"));
+ else:
+ if Vide:
+ else:
+ trace cotationmil(A,D,-5mm,25,TEX("$?=\dots$~ul"));
+ fi;
+ fi;
+ \end{mplibcode}
+ \fi%
+}%
+
+\NewDocumentCommand\BuildFractionNombreQuadrillage{mmm}{%
+ \ifluatex%
+ \mplibforcehmode%
+ \begin{mplibcode}
+ Unite:=#2;%\useKV[ClesFN]{Unite};%en carreaux
+ HautQuad:=\useKV[ClesFN]{HautQuad};
+ Largeur:=Unite;%en carreaux
+ boolean Solution,Vide,Creation;
+ Solution=\useKV[ClesFN]{Solution};
+ Vide=\useKV[ClesFN]{Vide};
+ Creation=\useKV[ClesFN]{Creation};
+ color CoulFN;
+ CoulFN=\useKV[ClesFN]{Couleur};
+ Num:=#1;
+ Pas:=#2;
+ PasQuad:=\useKV[ClesFN]{PasQuad};
+ pair A,B,C,D;
+ A=(0,0);
+ B=(((#1 div #2)+1)*Unite+1)*PasQuad*(1,0);
+ C-B=(0,HautQuad*PasQuad);
+ D-C=A-B;
+ trace polygone(A,B,C,D);
+ TotalLargeur=(((#1 div #2)+1)*Unite+1);
+ for k=1 upto TotalLargeur-1:
+ trace (k/TotalLargeur)[A,B]--(k/TotalLargeur)[D,C];
+ endfor;
+ for k=1 upto HautQuad-1:
+ trace (k/HautQuad)[A,D]--(k/HautQuad)[B,C];
+ endfor;
+ % Macro pour le chemin perso
+ vardef RemplirChemin(text t)=
+ nbpoints:=0;
+ % On compte le dénivelé
+ denivele=0;
+ denivmax:=0;
+ denivmin:=0;
+ for p_=t:
+ if p_="+":
+ denivmax:=denivmax+1;
+ elseif p_="-":
+ denivmin:=denivmin-1;
+ fi;
+ endfor;
+ depart:=-(denivmin)+floor(uniformdeviate(HautQuad-2-abs(denivmax-abs(denivmin))));
+ ch[0]=PasQuad*(0,depart);
+ for p_=t:
+ nbpoints:=nbpoints+1;
+ if p_=">":
+ ch[nbpoints]=ch[nbpoints-1]+PasQuad*(1,0);
+ elseif p_="<":
+ ch[nbpoints]=ch[nbpoints-1]+PasQuad*(-1,0);
+ elseif p_="+":
+ ch[nbpoints]=ch[nbpoints-1]+PasQuad*(0,1);
+ elseif p_="-":
+ ch[nbpoints]=ch[nbpoints-1]+PasQuad*(0,-1);
+ fi;
+ endfor;
+ enddef;
+ % On choisit le départ.
+ pair ch[];
+ numeric xe[],ye[];
+ if Creation:
+ RemplirChemin(#3);
+ else:
+ depart:=floor(uniformdeviate(HautQuad-1));
+ ch[0]=PasQuad*(0,depart);
+ xe0=0;
+ ye0=depart;
+ for k=1 upto #1:
+ if (k mod 2)=1:
+ ch[k]-ch[k-1]=PasQuad*(1,0);
+ xe[k]=xe[k-1]+1;
+ ye[k]=ye[k-1];
+ else:
+ if ye[k-1]=0:
+ alea:=uniformdeviate(2);
+ if alea<1:
+ ch[k]-ch[k-1]=PasQuad*(0,1);
+ xe[k]=xe[k-1];
+ ye[k]=ye[k-1]+1;
+ else:
+ ch[k]-ch[k-1]=PasQuad*(1,0);
+ xe[k]=xe[k-1]+1;
+ ye[k]=ye[k-1];
+ fi;
+ elseif ye[k-1]=2:
+ alea:=uniformdeviate(2);
+ if alea<1:
+ ch[k]-ch[k-1]=PasQuad*(0,-1);
+ xe[k]=xe[k-1];
+ ye[k]=ye[k-1]-1;
+ else:
+ ch[k]-ch[k-1]=PasQuad*(1,0);
+ xe[k]=xe[k-1]+1;
+ ye[k]=ye[k-1];
+ fi;
+ else:
+ alea:=uniformdeviate(3);
+ if alea<1:
+ ch[k]-ch[k-1]=PasQuad*(0,1);
+ xe[k]=xe[k-1];
+ ye[k]=ye[k-1]+1;
+ elseif alea<2:
+ ch[k]-ch[k-1]=PasQuad*(1,0);
+ xe[k]=xe[k-1]+1;
+ ye[k]=ye[k-1];
+ else:
+ ch[k]-ch[k-1]=PasQuad*(0,-1);
+ xe[k]=xe[k-1];
+ ye[k]=ye[k-1]-1;
+ fi;
+ fi;
+ fi;
+ endfor;
+ fi;
+ if Vide=false:
+ trace ch[0] for k=1 upto #1:--ch[k] endfor withpen pencircle scaled 2 withcolor CoulFN;
+ fi;
+ trace cotationmil(D,(D+#2*(PasQuad,0)),5mm,15,TEX("1 ul"));
+ trace segment(D,D+#2*(PasQuad,0)) withpen pencircle scaled 1.5;
+ \end{mplibcode}
+ \fi
+}% \ No newline at end of file
diff --git a/macros/latex/contrib/profcollege/latex/PfCGeometrie.tex b/macros/latex/contrib/profcollege/latex/PfCGeometrie.tex
index f7829c73e7..ab15f8754e 100644
--- a/macros/latex/contrib/profcollege/latex/PfCGeometrie.tex
+++ b/macros/latex/contrib/profcollege/latex/PfCGeometrie.tex
@@ -21,10 +21,10 @@
typetrace:="3D";
typerepre:="persp";
fi;
- xa=xpart(Coinbg);
- xb=xpart(Coinhd);
- ya=ypart(Coinbg);
- yb=ypart(Coinhd);
+ xa:=xpart(Coinbg);
+ xb:=xpart(Coinhd);
+ ya:=ypart(Coinbg);
+ yb:=ypart(Coinhd);
feuille(xa,ya,xb,yb);
_tfig:=if (xb-xa)>(yb-ya): (xb-xa) else: (yb-ya) fi;
_tfig:=2*_tfig;
@@ -48,10 +48,10 @@
typerepre:="persp";
fi;}
]%
- xa=xpart(Coinbg);
- xb=xpart(Coinhd);;
- ya=ypart(Coinbg);
- yb=ypart(Coinhd);
+ xa:=xpart(Coinbg);
+ xb:=xpart(Coinhd);;
+ ya:=ypart(Coinbg);
+ yb:=ypart(Coinhd);
feuille(xa,ya,xb,yb);
_tfig:=if (xb-xa)>(yb-ya): (xb-xa) else: (yb-ya) fi;
_tfig:=2*_tfig;
diff --git a/macros/latex/contrib/profcollege/latex/PfCJeuRangement.tex b/macros/latex/contrib/profcollege/latex/PfCJeuRangement.tex
index 09b1dc7d68..6508e6cd1a 100644
--- a/macros/latex/contrib/profcollege/latex/PfCJeuRangement.tex
+++ b/macros/latex/contrib/profcollege/latex/PfCJeuRangement.tex
@@ -1,5 +1,6 @@
-\setKVdefault[JeuRgt]{Creation=false,Deno=12,Graines=false,Largeur=15pt,Hauteur=20pt,Negatif=false,Decimaux=false,Solution=false,ValeurMin=2,ValeurMax=50}
+\setKVdefault[JeuRgt]{Creation=false,Deno=12,Graines=false,Largeur=15pt,Hauteur=20pt,Negatif=false,Decimaux=false,Solution=false,ValeurMin=2,ValeurMax=50,Exposants=false}
\defKV[JeuRgt]{Graine=\setKV[JeuRgt]{Graines}}%
+\defKV[JeuRgt]{Exposant=\setKV[JeuRgt]{Exposants}\setKV[JeuRgt]{Deno=1}}%
\newlength{\PfCJeuRgtH}
@@ -21,17 +22,23 @@
% Liste des nombres
\ifboolKV[JeuRgt]{Creation}{%
\xdef\ListeDesChoix{}%
- \ifboolKV[JeuRgt]{Negatif}{%
- \xdef\ListeDesChoix{-1}%
+ \ifboolKV[JeuRgt]{Exposants}{%
\xintFor* ##1 in{\xintSeq{\useKV[JeuRgt]{ValeurMin}}{\useKV[JeuRgt]{ValeurMax}}}\do{%
- \xdef\ListeDesChoix{\ListeDesChoix,-##1}%
- }%
- \xintFor* ##1 in{\xintSeq{\useKV[JeuRgt]{ValeurMin}}{\useKV[JeuRgt]{ValeurMax}}}\do{%
- \xdef\ListeDesChoix{\ListeDesChoix,##1}%
+ \xdef\ListeDesChoix{\ListeDesChoix,\fpeval{##1*(10**\useKV[JeuRgt]{Exposant})+randint(0,(10**\useKV[JeuRgt]{Exposant})-1)}}%
}%
}{%
- \xintFor* ##1 in{\xintSeq{\useKV[JeuRgt]{ValeurMin}}{\useKV[JeuRgt]{ValeurMax}}}\do{%
- \xdef\ListeDesChoix{\ListeDesChoix,##1}%
+ \ifboolKV[JeuRgt]{Negatif}{%
+ \xdef\ListeDesChoix{-1}%
+ \xintFor* ##1 in{\xintSeq{\useKV[JeuRgt]{ValeurMin}}{\useKV[JeuRgt]{ValeurMax}}}\do{%
+ \xdef\ListeDesChoix{\ListeDesChoix,-##1}%
+ }%
+ \xintFor* ##1 in{\xintSeq{\useKV[JeuRgt]{ValeurMin}}{\useKV[JeuRgt]{ValeurMax}}}\do{%
+ \xdef\ListeDesChoix{\ListeDesChoix,##1}%
+ }%
+ }{%
+ \xintFor* ##1 in{\xintSeq{\useKV[JeuRgt]{ValeurMin}}{\useKV[JeuRgt]{ValeurMax}}}\do{%
+ \xdef\ListeDesChoix{\ListeDesChoix,##1}%
+ }%
}%
}%
\MelangeListe{\ListeDesChoix}{\LongueurMot}%
diff --git a/macros/latex/contrib/profcollege/latex/PfCMulJal.tex b/macros/latex/contrib/profcollege/latex/PfCMulJal.tex
new file mode 100644
index 0000000000..befce7a110
--- /dev/null
+++ b/macros/latex/contrib/profcollege/latex/PfCMulJal.tex
@@ -0,0 +1,148 @@
+%%%
+% Multiplication par jalousie
+%%%
+\setKVdefault[MulJal]{Solution=false,CouleurTab=gray!15}%
+\defKV[MulJal]{CouleurSolution=\setKV[MulJal]{Solution}}%
+%
+\NewDocumentCommand\MulJalousie{om}{%
+ \useKVdefault[MulJal]%
+ \setKV[MulJal]{#1}%
+ \setsepchar{x}\ignoreemptyitems%
+ \readlist*\PfCMulJal{#2}%
+ \ifboolKV[MulJal]{Solution}{\colorlet{CouleurSolution}{\useKV[MulJal]{CouleurSolution}}}{\colorlet{CouleurSolution}{black}}%
+ % Les facteurs sont \showitems\PfCMulJal[].
+ \BuildTabMulJal%
+}%
+
+\NewDocumentCommand\BuildTabMulJal{}{%
+ \StrLen{\PfCMulJal[1]}[\PremierFacteurlen]%
+ \StrLen{\PfCMulJal[2]}[\DeuxiemeFacteurlen]%
+ \xdef\PfCMulJalPdt{\fpeval{\PfCMulJal[1]*\PfCMulJal[2]}}%
+ \StrLen{\PfCMulJalPdt}[\Produitlen]%
+ \StrChar{\PfCMulJal[1]}{1}[\PfCMulA]%
+ \StrChar{\PfCMulJal[2]}{1}[\PfCMulB]%
+ \xdef\PfCMulC{\fpeval{\PfCMulA*\PfCMulB}}%
+ \quotient{\PfCMulC}{10}\relax%
+ \xdef\Report{\the\intquotient/}%
+ \xintFor* ##1 in{\xintSeq{2}{\fpeval{\PremierFacteurlen+\DeuxiemeFacteurlen}}}\do{%
+ \xintFor* ##2 in{\xintSeq{1}{\DeuxiemeFacteurlen}}\do{%
+ \xintFor* ##3 in{\xintSeq{1}{\PremierFacteurlen}}\do{%
+ \xintifboolexpr{##2+##3==##1}{%
+ \ifnum##2=1%
+ \ifnum##3<\PremierFacteurlen%
+ \StrChar{\PfCMulJal[1]}{\fpeval{##3+1}}[\PfCMulA]%
+ \StrChar{\PfCMulJal[2]}{##2}[\PfCMulB]%
+ \xdef\PfCMulC{\fpeval{\PfCMulA*\PfCMulB}}%
+ \quotient{\PfCMulC}{10}\relax%
+ \xdef\Report{\Report \the\intquotient}%
+ \fi%
+ \fi%
+ \StrChar{\PfCMulJal[1]}{##3}[\PfCMulA]%
+ \StrChar{\PfCMulJal[2]}{##2}[\PfCMulB]%
+ \xdef\PfCMulC{\fpeval{\PfCMulA*\PfCMulB}}%
+ \modulo{\PfCMulC}{10}\relax%
+ \ifnum##3=\PremierFacteurlen%
+ \xdef\Report{\Report \the\remainder}%
+ \else%
+ \xdef\Report{\Report,\the\remainder}%
+ \fi%
+ \ifnum##2<\DeuxiemeFacteurlen%
+ \StrChar{\PfCMulJal[1]}{##3}[\PfCMulA]%
+ \StrChar{\PfCMulJal[2]}{\fpeval{##2+1}}[\PfCMulB]%
+ \xdef\PfCMulC{\fpeval{\PfCMulA*\PfCMulB}}%
+ \quotient{\PfCMulC}{10}\relax%
+ \xdef\Report{\Report,\the\intquotient}%
+ \fi%
+ }{}%
+ }%
+ }%
+ \xdef\Report{\Report/}%
+ }%
+ \setsepchar[*]{/*,}\ignoreemptyitems%
+ \readlist*\Lesdiagonales{\Report}%
+ %Calculs les sommes en diagonales.
+ \xintFor* ##1 in{\xintSeq{1}{\fpeval{\PremierFacteurlen+\DeuxiemeFacteurlen}}}\do{%
+ \xdef\PfCFoo{\Lesdiagonales[##1]}%
+ \setsepchar{,}\ignoreemptyitems%
+ \readlist*\LaDiagonale{\PfCFoo}%
+ \xdef\LaSomme{0}%
+ \foreachitem\compteur\in\LaDiagonale{\xdef\LaSomme{\fpeval{\LaSomme+\LaDiagonale[\compteurcnt]}}}%
+ }%
+ %
+ \colorlet{PfCFondTab}{\useKV[MulJal]{CouleurTab}}%
+ \begin{NiceTabular}{*{1}{p{25pt}}*{\PremierFacteurlen}{p{25pt}}c}%
+ \rule{0pt}{25pt}\xintFor* ##1 in{\xintSeq{1}{1}}\do{%
+ &}\xintFor* ##1 in{\xintSeq{1}{\PremierFacteurlen}}\do{%
+ \Block[fill=PfCFondTab,draw,v-center]{}{\StrChar{\PfCMulJal[1]}{##1}}&%
+ }\Block[fill=PfCFondTab,draw,v-center]{}{$\times$}\\%
+ \xintFor* ##1 in{\xintSeq{1}{\DeuxiemeFacteurlen}}\do{%
+ \rule{0pt}{25pt}%
+ \xintFor* ##3 in{\xintSeq{1}{1}}\do{%
+ &}\xintFor* ##2 in{\xintSeq{1}{\PremierFacteurlen}}\do{%
+ &}\Block[fill=PfCFondTab,draw,v-center]{}{\StrChar{\PfCMulJal[2]}{##1}}\\%
+ }%
+ \xintFor* ##1 in{\xintSeq{1}{\fpeval{\PremierFacteurlen+2}}}\do{%
+ \rule{0pt}{25pt}\xintifForLast{}{&}%
+ }\\%
+ \CodeAfter%
+ \ifboolKV[MulJal]{Solution}{%
+ \xintFor* ##1 in{\xintSeq{1}{\DeuxiemeFacteurlen}}\do{%
+ \xintFor* ##2 in{\xintSeq{1}{\PremierFacteurlen}}\do{%
+ \StrChar{\PfCMulJal[1]}{##2}[\PfCMulA]%
+ \StrChar{\PfCMulJal[2]}{##1}[\PfCMulB]%
+ \xdef\PfCMulC{\fpeval{\PfCMulA*\PfCMulB}}%
+ \xintifboolexpr{\PfCMulC>9}{%
+ \tikz{\node[anchor=north west] at (\fpeval{##1+1}-|\fpeval{##2+1}) {\StrChar{\PfCMulC}{1}};}%
+ \tikz{\node[anchor=south east] at (\fpeval{##1+2}-|\fpeval{##2+2}) {\StrChar{\PfCMulC}{2}};}%
+ }{%
+ \tikz{\node[anchor=north west] at (\fpeval{##1+1}-|\fpeval{##2+1}) {0};}%
+ \tikz{\node[anchor=south east] at (\fpeval{##1+2}-|\fpeval{##2+2}) {\PfCMulC};}%
+ }%
+ }%
+ }%
+ }{}%
+ % Affichage des diagonales
+ \xintFor* ##1 in{\xintSeq{1}{\fpeval{\DeuxiemeFacteurlen+1}}}\do{%
+ \xintFor* ##2 in {\xintSeq{1}{\fpeval{\PremierFacteurlen+1}}}\do{%
+ \tikz{\draw (\fpeval{##1+1}-|\fpeval{##2+1})--(\fpeval{##1+2}-|##2);}%
+ }%
+ }%
+ % affichage du quadrillage interieur
+ \xintFor* ##1 in {\xintSeq{1}{\PremierFacteurlen}}\do{%
+ \tikz{\draw (2-|\fpeval{##1+1}) -- (\fpeval{\DeuxiemeFacteurlen+2}-|\fpeval{##1+1});}%
+ }%
+ \xintFor* ##1 in {\xintSeq{1}{\fpeval{\DeuxiemeFacteurlen+1}}}\do{%
+ \tikz{\draw (\fpeval{##1+1}-|2)--(\fpeval{##1+1}-|last);}%
+ }%
+ % Affichage du produit
+ \ifboolKV[MulJal]{Solution}{%
+ \xintFor* ##1 in{\xintSeq{1}{\PremierFacteurlen}}\do{%
+ \StrChar{\PfCMulJalPdt}{\fpeval{\Produitlen+1-##1}}[\PfCMulJalChiffre]%
+ \tikz{\node[CouleurSolution] at (\fpeval{\DeuxiemeFacteurlen+2+0.5}-|\fpeval{\PremierFacteurlen+2-##1}) {\PfCMulJalChiffre};}%
+ }%
+ \xintFor* ##1 in{\xintSeq{1}{\DeuxiemeFacteurlen}}\do{%
+ \StrChar{\PfCMulJalPdt}{\fpeval{\Produitlen+1-\PremierFacteurlen-##1}}[\PfCMulJalChiffre]%
+ \tikz{\node[CouleurSolution] at (\fpeval{\DeuxiemeFacteurlen+3-##1}-|\fpeval{1.5}) {\PfCMulJalChiffre};}%
+ }%
+ % Affichage des retenues
+ \xdef\Retenue{0}%
+ \xintFor* ##1 in{\xintSeq{2}{\fpeval{\DeuxiemeFacteurlen+\PremierFacteurlen}}}\do{%
+ \xdef\PfCFoo{\Lesdiagonales[\fpeval{\DeuxiemeFacteurlen+\PremierFacteurlen+1-##1}]}%
+ \setsepchar{,}\ignoreemptyitems%
+ \readlist*\LaDiagonale{\PfCFoo}%
+ \xdef\LaSomme{0}%
+ \foreachitem\compteur\in\LaDiagonale{\xdef\LaSomme{\fpeval{\LaSomme+\LaDiagonale[\compteurcnt]}}}%
+ \xdef\LaSomme{\fpeval{\LaSomme+\Retenue}}%
+ \ifnum\LaSomme>9%
+ \quotient{\LaSomme}{10}%
+ \xdef\Retenue{\the\intquotient}%
+ \ifnum##1<\PremierFacteurlen%
+ \tikz{\node[anchor=north,inner sep=1pt] at (\fpeval{\DeuxiemeFacteurlen+2}-|\fpeval{\PremierFacteurlen+1.5-##1}) {\tiny$+\the\intquotient$};}%
+ \else%
+ \tikz{\node[anchor=east,inner sep=1pt] at (\fpeval{\DeuxiemeFacteurlen+1.5-(##1-\PremierFacteurlen)}-|2) {\tiny$\the\intquotient+$};}%
+ \fi%
+ \fi%
+ }%
+ }{}%
+ \end{NiceTabular}%
+}% \ No newline at end of file
diff --git a/macros/latex/contrib/profcollege/latex/PfCNumerationsAnciennes.tex b/macros/latex/contrib/profcollege/latex/PfCNumerationsAnciennes.tex
new file mode 100644
index 0000000000..f15a0b9827
--- /dev/null
+++ b/macros/latex/contrib/profcollege/latex/PfCNumerationsAnciennes.tex
@@ -0,0 +1,243 @@
+\NewDocumentCommand\Chinoise{m}{%
+ \BuildNumerationChinoise{#1}%
+}%
+
+\NewDocumentCommand\Maya{m}{%
+ \BuildNumerationMaya{#1}%
+}%
+
+\NewDocumentCommand\Babylone{m}{%
+ \BuildNumerationBabylone{#1}%
+}%
+
+\NewDocumentCommand\BuildNumerationChinoise{m}{%
+ \ifluatex
+ \mplibnumbersystem{double}%
+ \mplibforcehmode
+ \begin{mplibcode}
+ drawoptions(withpen pencircle scaled 1.5);
+ ecart:=0.15u;
+ vardef Chiffre(expr t,a)=
+ picture Chinois;
+ Chinois=image(
+ if t<6:
+ if (a mod 2)=1:
+ if (t mod 2)=0:
+ for k=0 upto t-1:
+ draw ((0,0)--(u,0)) shifted(k*(0,ecart));
+ endfor;
+ else:
+ for k=1 upto t:
+ draw ((0,0)--(u,0)) shifted((k-1)*(0,ecart));
+ endfor;
+ fi;
+ else:
+ for k=0 upto t-1:
+ draw ((0,0)--(0,u)) shifted(k*(ecart,0));
+ endfor;
+ fi;
+ else:%t>5
+ if (a mod 2)=1:
+ for k=1 upto (t-5):
+ draw ((0,0)--(1u,0)) shifted((k-1)*(0,ecart));
+ endfor;
+ draw ((0.5u,(t-5-1)*ecart))--(0.5u,u);
+ else:
+ if ((t-5) mod 2)=0:
+ for k=1 upto ((t-5) div 2):
+ draw ((0,0)--(0,u)) shifted((3*ecart,0)+(k-1)*(ecart,0));
+ draw ((0,0)--(0,u)) shifted((2*ecart,0)-(k-1)*(ecart,0));
+ endfor;
+ else:
+ draw ((2.5*ecart,0)--(2.5*ecart,u));
+ for k=1 upto ((t-5) div 2):
+ draw ((0,0)--(0,u)) shifted((2.5*ecart,0)+k*(ecart,0));
+ draw ((0,0)--(0,u)) shifted((2.5*ecart,0)-k*(ecart,0));
+ endfor;
+ fi;
+ draw ((0,u)--(5*ecart,u));
+ fi;
+ fi;
+ );
+ if (a mod 2)=0:
+ Chinois:=Chinois shifted(u*(0.5,0.5)-center Chinois);
+ fi;
+ Chinois
+ enddef;
+ % On détermine l'exposant de la base le plus petit tel que 10^a>nombre
+ exposant=0;
+ Power=1;
+ forever: exitif Power>#1;
+ exposant:=exposant+1;
+ Power:=1 for l=1 upto exposant:*10 endfor;
+ endfor;
+ % On détermine les chiffres
+ Depart=#1;
+ %
+ for k=exposant-1 downto 0:
+ Power:=1 for l=1 upto k:*10 endfor;
+ Retiens:=Depart div Power;
+ RetiensChiffre[exposant-1-k]=Retiens;
+ Depart:=Depart-(Retiens*Power);
+ endfor;
+ %On affiche
+ for k=exposant-1 downto 0:
+ draw Chiffre(RetiensChiffre[exposant-1-k],k) shifted((exposant-1-k)*7*ecart,0);
+ endfor;
+ \end{mplibcode}
+ \mplibnumbersystem{scaled}%
+ \fi%
+}%
+
+\NewDocumentCommand\BuildNumerationMaya{m}{%
+ \ifluatex
+ \mplibnumbersystem{double}%
+ \mplibforcehmode
+ \begin{mplibcode}
+ drawoptions(withpen pencircle scaled 1.5);
+ %
+ picture MayaZero;
+ MayaZero=image(
+ path cc,cd;
+ cc=cercles((0,0),0.3u);
+ cc:=cc yscaled 0.4;
+ cd=(point(0.45*length cc) of cc){dir-30}..{dir30}(point(0.05*length cc) of cc);
+ trace cd;
+ trace (point(0.2*length cc) of cc){dir-130}..{dir-50}(point(0.65*length cd) of cd);
+ trace (point(0.25*length cc) of cc){dir-130}..{dir-50}(point(0.5*length cd) of cd);
+ trace (point(0.3*length cc) of cc){dir-130}..{dir-50}(point(0.35*length cd) of cd);
+ trace cc;
+ );
+ %
+ vardef Chiffre(expr t,a)=
+ picture Maya;
+ Maya=image(%
+ if t=0:
+ trace MayaZero;
+ else:
+ drawoptions(withpen pensquare);
+ for k=1 upto (t div 5):
+ draw ((-0.3u,0)--(0.3u,0)) shifted ((k-1)*u*(0,0.15));
+ endfor;
+ drawoptions();
+ if (t mod 5)>0:
+ if ((t mod 5) mod 2)=0:
+ for k=0 upto (t mod 5)-1:
+ fill (fullcircle scaled 1mm) shifted(k*u*(0.15,0)+(t div 5)*u*(0,0.15)-0.5*u*((t mod 5)-1)*(0.15,0));
+ endfor;
+ else:
+ for k=0 upto ((t mod 5)-1):
+ fill (fullcircle scaled 1mm) shifted((t div 5)*u*(0,0.15)+k*u*(0.15,0)-0.5*((t mod 5)-1)*u*(0.15,0));
+ endfor;
+ fi;
+ fi;
+ fi;
+ );
+ Maya
+ enddef;
+ % On détermine l'exposant de la base le plus petit tel que 10^a>nombre
+ exposant=0;
+ Power=1;
+ if #1=0:
+ exposant:=1;
+ else:
+ forever: exitif Power>#1;
+ exposant:=exposant+1;
+ Power:=1 for l=1 upto exposant:*20 endfor;
+ endfor;
+ fi;
+ % On détermine les chiffres
+ Depart=#1;
+ %
+ for k=exposant-1 downto 0:
+ Power:=1 for l=1 upto k:*20 endfor;
+ Retiens:=Depart div Power;
+ RetiensChiffre[exposant-1-k]=Retiens;
+ Depart:=Depart-(Retiens*Power);
+ endfor;
+ % On affiche
+ for k=exposant-1 downto 0:
+ draw Chiffre(RetiensChiffre[exposant-1-k],exposant-1-k) shifted(u*(0,-(exposant-1-k)*4*0.25));
+ endfor;
+ \end{mplibcode}
+ \mplibnumbersystem{scaled}%
+ \fi%
+}%
+
+\NewDocumentCommand\BuildNumerationBabylone{m}{%
+ \ifluatex%
+ \mplibnumbersystem{double}%
+ \mplibforcehmode%
+ \begin{mplibcode}
+ u:=8mm;
+ drawoptions(withpen pencircle scaled 1.5);
+ %
+ picture Chevron,Clou;
+ Chevron=image(%
+ draw chemin(u*(0.4,0.4),(0,0),u*(0.4,-0.4));%
+ draw segment(u*(0.15,0.15),u*(0.15,-0.15));%
+ );%
+ Clou=image(%
+ draw chemin(u*(0.4,0.3),u*(0.3,0.4),u*(0.5,0.4),u*(0.4,0.3),u*(0.4,-0.4));
+ );
+ vardef Chiffre(expr t)=
+ picture Babylone;
+ Babylone=image(%
+ diz:=t div 10;
+ un:=t-diz*10;
+ k:=0;
+ forever: exitif k>diz-1;
+ g:=k div 2;
+ h:=k mod 2;
+ draw Chevron shifted(u*(0.5*h,g));
+ k:=k+1;
+ endfor;
+ %
+ ecartH:=ecartH+ecart+ecartu+1;% pour avoir un ecart entre les divers exposants
+ %
+ k:=0;
+ ecart:=if diz<2: diz else:2 fi;
+ forever: exitif k>un-1;
+ g:=k div 3;
+ h:=k mod 3;
+ draw Clou shifted(u*(0.5*(h+ecart),g));
+ k:=k+1;
+ endfor;
+ ecartu:=if un<3: un else:3 fi;
+% label.top(TEX("e="&decimal(ecart)&";eu"&decimal(ecartu)),u*(ecartH*0.5,5));
+ );
+ Babylone
+ enddef;
+ % On détermine l'exposant de la base le plus petit tel que 60^a>nombre
+ exposant=0;
+ Power=1;
+ forever: exitif Power>#1;
+ exposant:=exposant+1;
+ Power:=1 for l=1 upto exposant:*60 endfor;
+ endfor;
+ % On détermine les chiffres
+ Depart=#1;
+ %
+ if Depart=0:
+ RetiensChiffre[0]=Retiens;
+ else:
+ for k=exposant-1 downto 0:
+ Power:=1 for l=1 upto k:*60 endfor;
+ Retiens:=Depart div Power;
+ RetiensChiffre[exposant-1-k]=Retiens;
+ Depart:=Depart-(Retiens*Power);
+ endfor;
+ fi;
+ % On affiche
+ ecart:=0;
+ ecartu:=0;
+ ecartH:=0;
+ for k=exposant-1 downto 0:
+ gg:=RetiensChiffre[exposant-1-k];
+ draw Chiffre(gg) shifted(u*(ecartH*0.5,0));
+% draw (u*(ecartH*0.5,0)--u*(ecartH*0.5,5)) withcolor blue;
+ endfor;
+ \end{mplibcode}
+ \mplibnumbersystem{scaled}%
+ \fi%
+}% \ No newline at end of file
diff --git a/macros/latex/contrib/profcollege/latex/PfCOperationsTrou.tex b/macros/latex/contrib/profcollege/latex/PfCOperationsTrou.tex
index f53f3e9944..d26dbade32 100644
--- a/macros/latex/contrib/profcollege/latex/PfCOperationsTrou.tex
+++ b/macros/latex/contrib/profcollege/latex/PfCOperationsTrou.tex
@@ -3,26 +3,58 @@
%%%
%% D'après https://tex.stackexchange.com/questions/277246/drawing-a-circle-around-the-numbers-in-xlop-package
+%\begin{document}%
+%
+%\end{document}
+
\newcommand\PfCchiffre[2]{\tikz[remember picture] \node[inner sep=0pt](#1){#2};}
\newcommand\PfCentoure[2]{\tikz[remember picture,overlay] \node[preaction={draw={\useKV[ClesOperations]{CouleurCadre}},ultra thick,opacity=1,
transform canvas={xshift=0em,yshift=0em}},rectangle,rounded corners,ultra thick,inner sep=.55em,fit=(#1.center)(#2.center)]{};}
+\newcommand\PfCchiffreclip[2]{%
+ \ifboolKV[ClesOperations]{Solution}{%
+ \xintFor* ##1 in{\xintSeq{1}{\PfCListeTroulen}}\do{%
+ \xintifboolexpr{\thedivxlop==\PfCListeTrou[##1]}{%
+ \color{PfCSolOp}}{}%
+ }%
+ }{}%
+ \tikz[remember picture] \node[inner sep=0pt](#1){#2};%
+}%
+
+\newcommand\PfCentoureclip[2]{\tikz[remember picture,overlay] \node[preaction={draw={\useKV[ClesOperations]{CouleurCadre}},ultra thick,opacity=1,
+transform canvas={xshift=0em,yshift=0em}},rectangle,fill=PfCSolOp,rounded corners,ultra thick,inner sep=.55em,fit=(#1.center)(#2.center)]{};}
+
\newcounter{divxlop}%
-\newcounter{mulxlop}%
-\newcounter{addxlop}%
-\newcounter{subxlop}%
+%\newcounter{mulxlop}%
+%\newcounter{addxlop}%
+%\newcounter{subxlop}%
-\setKVdefault[ClesOperations]{Solution=false,CouleurCadre=LightSteelBlue,CouleurSolution=red,CouleurFond=white,CouleurVirgule=white}
+\setKVdefault[ClesOperations]{Solution=false,CouleurCadre=LightSteelBlue,CouleurSolution=red,CouleurFond=white,CouleurVirgule=white,Listes=false}
+\defKV[ClesOperations]{Liste=\setKV[ClesOperations]{Listes}\xdef\PfCFooListeTrou{#1}}%
\newcommand\Division[3][]{%
\useKVdefault[ClesOperations]%
\setKV[ClesOperations]{#1}%
\setcounter{divxlop}{0}%
\ifboolKV[ClesOperations]{Solution}{\colorlet{PfCSolOp}{\useKV[ClesOperations]{CouleurSolution}}}{\colorlet{PfCSolOp}{\useKV[ClesOperations]{CouleurFond}}}%
- \opidiv[lineheight=1.5em,columnwidth=1.25em,displayintermediary=all,voperator=bottom,intermediarystyle=\stepcounter{divxlop}\color{PfCSolOp}\PfCchiffre{A\thedivxlop},remainderstyle=\stepcounter{divxlop}\color{PfCSolOp}\PfCchiffre{A\thedivxlop},resultstyle=\stepcounter{divxlop}\color{PfCSolOp}\PfCchiffre{A\thedivxlop}]{#2}{#3}%
- \foreach \i in {1,...,\thedivxlop}{%
- \PfCentoure{A\i}{A\i}%
+ \ifboolKV[ClesOperations]{Listes}{%
+ \setsepchar{,}\ignoreemptyitems%
+ \readlist*\PfCListeTrou{\PfCFooListeTrou}%
+ \reademptyitems%
+ %,displayintermediary=all
+ \opidiv[lineheight=1.75em,columnwidth=1.5em,voperator=bottom,operandstyle=\stepcounter{divxlop}\PfCchiffreclip{A\thedivxlop},intermediarystyle=\stepcounter{divxlop}\PfCchiffreclip{A\thedivxlop},remainderstyle=\stepcounter{divxlop}\PfCchiffreclip{A\thedivxlop},resultstyle=\stepcounter{divxlop}\PfCchiffreclip{A\thedivxlop}]{#2}{#3}%
+ \ifboolKV[ClesOperations]{Solution}{}{%
+ \foreachitem\compteur\in\PfCListeTrou{%
+ \xdef\PfCRetiensTrou{\PfCListeTrou[\compteurcnt]}%
+ \PfCentoureclip{A\PfCRetiensTrou}{A\PfCRetiensTrou}%
+ }%
+ }%
+ }{%
+ \opidiv[lineheight=1.5em,columnwidth=1.25em,displayintermediary=all,voperator=bottom,intermediarystyle=\stepcounter{divxlop}\color{PfCSolOp}\PfCchiffre{A\thedivxlop},remainderstyle=\stepcounter{divxlop}\color{PfCSolOp}\PfCchiffre{A\thedivxlop},resultstyle=\stepcounter{divxlop}\color{PfCSolOp}\PfCchiffre{A\thedivxlop}]{#2}{#3}%
+ \foreach \i in {1,...,\thedivxlop}{%
+ \PfCentoure{A\i}{A\i}%
+ }%
}%
}%
@@ -40,8 +72,29 @@ transform canvas={xshift=0em,yshift=0em}},rectangle,rounded corners,ultra thick,
\newcommand\Multiplication[3][]{%
\useKVdefault[ClesOperations]%
\setKV[ClesOperations]{#1}%
- \setcounter{mulxlop}{0}%
+ \setcounter{divxlop}{0}%
\ifboolKV[ClesOperations]{Solution}{\colorlet{PfCSolOp}{\useKV[ClesOperations]{CouleurSolution}}\colorlet{PfCCouleurVirgule}{PfCSolOp}}{\colorlet{PfCSolOp}{\useKV[ClesOperations]{CouleurFond}}\colorlet{PfCCouleurVirgule}{\useKV[ClesOperations]{CouleurVirgule}}}%
+ \ifboolKV[ClesOperations]{Listes}{%
+ \setsepchar{,}\ignoreemptyitems%
+ \readlist*\PfCListeTrou{\PfCFooListeTrou}%
+ \reademptyitems%
+ \begingroup
+ \setlength{\baselineskip}{1.75em}
+ \StrLen{#3}[\PfCLongueurFacteurDeux]
+ \ifnum\PfCLongueurFacteurDeux=1\relax
+ \opset{lineheight=\baselineskip} % nécessaire
+ \else
+ \opset{lineheight=\baselineskip,displayintermediary=all,displayshiftintermediary=all} % nécessaire
+ \fi
+ \opmul[decimalsepsymbol={,},lineheight=1.75em,columnwidth=1.5em,voperator=bottom,operandstyle=\stepcounter{divxlop}\PfCchiffreclip{A\thedivxlop},intermediarystyle=\stepcounter{divxlop}\PfCchiffreclip{A\thedivxlop},resultstyle=\stepcounter{divxlop}\PfCchiffreclip{A\thedivxlop},resultstyle.d=\color{PfCCouleurVirgule}]{#2}{#3}%
+ \endgroup%
+ \ifboolKV[ClesOperations]{Solution}{}{%
+ \foreachitem\compteur\in\PfCListeTrou{%
+ \xdef\PfCRetiensTrou{\PfCListeTrou[\compteurcnt]}%
+ \PfCentoureclip{A\PfCRetiensTrou}{A\PfCRetiensTrou}%
+ }%
+ }%
+ }{%
\begingroup
\setlength{\baselineskip}{2em}
\StrLen{#3}[\PfCLongueurFacteurDeux]
@@ -50,42 +103,69 @@ transform canvas={xshift=0em,yshift=0em}},rectangle,rounded corners,ultra thick,
\else
\opset{lineheight=\baselineskip,displayintermediary=all,displayshiftintermediary=all} % nécessaire
\fi
- \opmul[decimalsepsymbol={,},lineheight=2em,columnwidth=1.5em,voperator=bottom,intermediarystyle=\stepcounter{mulxlop}\color{PfCSolOp}\PfCchiffre{A\themulxlop},resultstyle=\stepcounter{mulxlop}\color{PfCSolOp}\PfCchiffre{A\themulxlop},resultstyle.d=\color{PfCCouleurVirgule}]{#2}{#3}%
- \foreach \i in {1,...,\themulxlop}{%
+ \opmul[decimalsepsymbol={,},lineheight=2em,columnwidth=1.5em,voperator=bottom,intermediarystyle=\stepcounter{divxlop}\color{PfCSolOp}\PfCchiffre{A\thedivxlop},resultstyle=\stepcounter{divxlop}\color{PfCSolOp}\PfCchiffre{A\thedivxlop},resultstyle.d=\color{PfCCouleurVirgule}]{#2}{#3}%
+ \foreach \i in {1,...,\thedivxlop}{%
\PfCentoure{A\i}{A\i}%
}%
\endgroup
+ }
}%
\newcommand\Addition[3][]{%
\useKVdefault[ClesOperations]%
\setKV[ClesOperations]{#1}%
- \setcounter{addxlop}{0}%
+ \setcounter{divxlop}{0}%
\ifboolKV[ClesOperations]{Solution}{\opset{carryadd,carrystyle=\color{PfCSolOp}\scriptsize}\colorlet{PfCSolOp}{\useKV[ClesOperations]{CouleurSolution}}\colorlet{PfCCouleurVirgule}{PfCSolOp}}{\opset{carryadd=false}\colorlet{PfCSolOp}{\useKV[ClesOperations]{CouleurFond}}\colorlet{PfCCouleurVirgule}{\useKV[ClesOperations]{CouleurVirgule}}}%
- \opadd[decimalsepsymbol={,},lineheight=1.75em,columnwidth=1.5em,voperator=bottom,resultstyle=\stepcounter{addxlop}\color{PfCSolOp}\PfCchiffre{A\theaddxlop},resultstyle.d=\color{PfCCouleurVirgule}]{#2}{#3}
- \foreach \i in {1,...,\theaddxlop}{%
- \PfCentoure{A\i}{A\i}%
+ \ifboolKV[ClesOperations]{Listes}{%
+ \setsepchar{,}\ignoreemptyitems%
+ \readlist*\PfCListeTrou{\PfCFooListeTrou}%
+ \reademptyitems%
+ \opadd[decimalsepsymbol={,},lineheight=1.75em,columnwidth=1.5em,voperator=bottom,operandstyle.1=\stepcounter{divxlop}\PfCchiffreclip{A\thedivxlop},operandstyle.2=\stepcounter{divxlop}\PfCchiffreclip{A\thedivxlop},resultstyle=\stepcounter{divxlop}\PfCchiffreclip{A\thedivxlop},resultstyle.d=\color{PfCCouleurVirgule}]{#2}{#3}%
+ \ifboolKV[ClesOperations]{Solution}{}{%
+ \foreachitem\compteur\in\PfCListeTrou{%
+ \xdef\PfCRetiensTrou{\PfCListeTrou[\compteurcnt]}%
+ \PfCentoureclip{A\PfCRetiensTrou}{A\PfCRetiensTrou}%
+ }%
+ }%
+ }{%
+ \opadd[decimalsepsymbol={,},lineheight=1.75em,columnwidth=1.5em,voperator=bottom,resultstyle=\stepcounter{divxlop}\color{PfCSolOp}\PfCchiffre{A\thedivxlop},resultstyle.d=\color{PfCCouleurVirgule}]{#2}{#3}
+ \foreach \i in {1,...,\thedivxlop}{%
+ \PfCentoure{A\i}{A\i}%
+ }%
}%
}%
\newcommand\Soustraction[3][]{%
\useKVdefault[ClesOperations]%
\setKV[ClesOperations]{#1}%
- \setcounter{subxlop}{0}%
+ \setcounter{divxlop}{0}%
\ifboolKV[ClesOperations]{Solution}{\opset{carrysub,carrystyle=\color{PfCSolOp}\scriptsize}\colorlet{PfCSolOp}{\useKV[ClesOperations]{CouleurSolution}}\colorlet{PfCCouleurVirgule}{PfCSolOp}}{\opset{carrysub=false}\colorlet{PfCSolOp}{\useKV[ClesOperations]{CouleurFond}}\colorlet{PfCCouleurVirgule}{\useKV[ClesOperations]{CouleurVirgule}}}%
- \opsub[decimalsepsymbol={,},lineheight=1.75em,columnwidth=1.5em,voperator=bottom,resultstyle=\stepcounter{subxlop}\color{PfCSolOp}\PfCchiffre{A\thesubxlop},resultstyle.d=\color{PfCCouleurVirgule}]{#2}{#3}%
- \foreach \i in {1,...,\thesubxlop}{%
- \PfCentoure{A\i}{A\i}
+ \ifboolKV[ClesOperations]{Listes}{%
+ \setsepchar{,}\ignoreemptyitems%
+ \readlist*\PfCListeTrou{\PfCFooListeTrou}%
+ \reademptyitems%
+ \opsub[decimalsepsymbol={,},lineheight=1.75em,columnwidth=1.5em,voperator=bottom,operandstyle=\stepcounter{divxlop}\PfCchiffreclip{A\thedivxlop},resultstyle=\stepcounter{divxlop}\PfCchiffreclip{A\thedivxlop},resultstyle.d=\color{PfCCouleurVirgule}]{#2}{#3}%
+ \ifboolKV[ClesOperations]{Solution}{}{%
+ \foreachitem\compteur\in\PfCListeTrou{%
+ \xdef\PfCRetiensTrou{\PfCListeTrou[\compteurcnt]}%
+ \PfCentoureclip{A\PfCRetiensTrou}{A\PfCRetiensTrou}%
+ }%
+ }%
+ }{%
+ \opsub[decimalsepsymbol={,},lineheight=1.75em,columnwidth=1.5em,voperator=bottom,resultstyle=\stepcounter{divxlop}\color{PfCSolOp}\PfCchiffre{A\thedivxlop},resultstyle.d=\color{PfCCouleurVirgule}]{#2}{#3}%
+ \foreach \i in {1,...,\thedivxlop}{%
+ \PfCentoure{A\i}{A\i}
+ }%
}%
}%
\NewDocumentCommand\MultiAddition{om}{%
\useKVdefault[ClesOperations]%
\setKV[ClesOperations]{#1}%
- \setcounter{addxlop}{0}%
+ \setcounter{divxlop}{0}%
\ifboolKV[ClesOperations]{Solution}{\opset{carryadd,carrystyle=\color{PfCSolOp}\scriptsize}\colorlet{PfCSolOp}{\useKV[ClesOperations]{CouleurSolution}}\colorlet{PfCCouleurVirgule}{PfCSolOp}}{\opset{carryadd=false}\colorlet{PfCSolOp}{\useKV[ClesOperations]{CouleurFond}}\colorlet{PfCCouleurVirgule}{\useKV[ClesOperations]{CouleurVirgule}}}%
- \opmanyadd[decimalsepsymbol={,},lineheight=1.75em,columnwidth=1.5em,vmanyoperator=bottom,resultstyle=\stepcounter{addxlop}\color{PfCSolOp}\PfCchiffre{A\theaddxlop},resultstyle.d=\color{PfCCouleurVirgule}]#2
- \foreach \i in {1,...,\theaddxlop}{%
+ \opmanyadd[decimalsepsymbol={,},lineheight=1.75em,columnwidth=1.5em,vmanyoperator=bottom,resultstyle=\stepcounter{divxlop}\color{PfCSolOp}\PfCchiffre{A\thedivxlop},resultstyle.d=\color{PfCCouleurVirgule}]#2
+ \foreach \i in {1,...,\thedivxlop}{%
\PfCentoure{A\i}{A\i}%
}%
}% \ No newline at end of file
diff --git a/macros/latex/contrib/profcollege/latex/PfCPattern.tex b/macros/latex/contrib/profcollege/latex/PfCPattern.tex
new file mode 100644
index 0000000000..29fa45c08f
--- /dev/null
+++ b/macros/latex/contrib/profcollege/latex/PfCPattern.tex
@@ -0,0 +1,779 @@
+%%%
+% Visual Pattern
+%%%
+\setKVdefault[Pattern]{Type=1,Etape=3}
+
+\NewDocumentCommand\VisualPattern{o}{%
+ \useKVdefault[Pattern]%
+ \setKV[Pattern]{#1}%
+ \IfStrEqCase{\useKV[Pattern]{Type}}{%
+ {284}{\BuildPatternDeuxCentQuatreVingtQuatre}%
+ {254}{\BuildPatternDeuxCentCinquanteQuatre}%
+ {156}{\BuildPatternCentCinquanteSix}%
+ {155}{\BuildPatternCentCinquanteCinq}%
+ {55}{\BuildPatternCinquanteCinq}%
+ {53}{\BuildPatternCinquanteTrois}%
+ {48}{\BuildPatternQuaranteHuit}%
+ {46}{\BuildPatternQuaranteSix}%
+ {45}{\BuildPatternQuaranteCinq}%
+ {39}{\BuildPatternTrenteNeuf}%
+ {30}{\BuildPatternTrente}%
+ {24}{\BuildPatternVingtQuatre}%
+ {20}{\BuildPatternVingt}%
+ {19}{\BuildPatternDixNeuf}%
+ {18}{\BuildPatternDixHuit}%
+ {15}{\BuildPatternQuinze}%
+ {14}{\BuildPatternQuatorze}%
+ {6}{\BuildPatternSix}%
+ {5}{\BuildPatternCinq}%
+ {4}{\BuildPatternQuatre}%
+ {3}{\BuildPatternTrois}%
+ {2}{\BuildPatternDeux}%
+ {1}{\BuildPatternUn}%
+ }%
+}%
+
+%284
+\NewDocumentCommand\BuildPatternDeuxCentQuatreVingtQuatre{}{
+ \ifluatex%
+ \mplibforcehmode%
+ \begin{mplibcode}
+ Etape:=\useKV[Pattern]{Etape};
+ input PfCSolid;
+
+ intensite:=1.5;
+ Ferme[0]:=false;
+ outcolor:=LightSteelBlue;
+ incolor:=white;
+ nb:=1;subh:=1;
+ creux:=true;
+
+ Initialisation(2500,40,20,50);
+ Objetcube1("a=0.25");
+ nbobj:=1;
+ TR:=(0,a,0);
+ %base
+ for k=1 upto 2:
+ NBobj:=nbobj;
+ nbobj:=nbobj+1;
+ ObjetDeplacement[nbobj](NBobj);
+ endfor;
+ % barre gauche
+ for k=1 upto Etape:
+ TR:=(0,0,k*a);
+ NBobj:=1;
+ nbobj:=nbobj+1;
+ ObjetDeplacement[nbobj](NBobj);
+ endfor;
+ %barre gauche
+ for k=1 upto Etape-1:
+ TR:=(0,2*a,k*a);
+ NBobj:=1;
+ nbobj:=nbobj+1;
+ ObjetDeplacement[nbobj](NBobj);
+ endfor;
+ DessineFusion;
+ \end{mplibcode}
+ \fi
+}%
+
+% 254
+\NewDocumentCommand\BuildPatternDeuxCentCinquanteQuatre{}{
+ \ifluatex%
+ \mplibforcehmode%
+ \begin{mplibcode}
+ Etape:=\useKV[Pattern]{Etape};
+ for k=0 upto Etape-1:
+ for l=0 upto Etape-1:
+ fill ((fullcircle scaled 4mm) shifted (5mm*(l,k))) withcolor LightSteelBlue;
+ trace ((fullcircle scaled 4mm) shifted (5mm*(l,k)));
+ endfor;
+ endfor;
+ fill ((fullcircle scaled 4mm) shifted (5mm*(0,-1))) withcolor LightSteelBlue;
+ trace ((fullcircle scaled 4mm) shifted (5mm*(0,-1)));
+ fill ((fullcircle scaled 4mm) shifted (5mm*(-1,0))) withcolor LightSteelBlue;
+ trace ((fullcircle scaled 4mm) shifted (5mm*(-1,0)));
+ fill ((fullcircle scaled 4mm) shifted (5mm*(0,Etape))) withcolor LightSteelBlue;
+ trace ((fullcircle scaled 4mm) shifted (5mm*(0,Etape)));
+ \end{mplibcode}
+ \fi
+}%
+
+%156
+\NewDocumentCommand\BuildPatternCentCinquanteSix{}{
+ \ifluatex%
+ \mplibforcehmode%
+ \begin{mplibcode}
+ Etape:=\useKV[Pattern]{Etape};
+ input PfCSolid;
+
+ intensite:=1.5;
+ Ferme[0]:=false;
+ outcolor:=LightSteelBlue;
+ incolor:=white;
+ nb:=1;subh:=1;
+ creux:=true;
+
+ Initialisation(2500,40,20,50);
+ Objetcube1("a=0.25");
+ nbobj:=1;
+ TR:=(0,a,0);
+ for k=1 upto Etape:
+ NBobj:=nbobj;
+ nbobj:=nbobj+1;
+ ObjetDeplacement[nbobj](NBobj);
+ endfor;
+ TR:=(0,0,-0.25);
+ for k=1 upto Etape:
+ NBobj:=nbobj;
+ nbobj:=nbobj+1;
+ ObjetDeplacement[nbobj](NBobj);
+ endfor;
+ TR:=(0,0.25,0);
+ for k=1 upto Etape:
+ NBobj:=nbobj;
+ nbobj:=nbobj+1;
+ ObjetDeplacement[nbobj](NBobj);
+ endfor;
+ %nbobj=4;
+ DessineFusion;
+ \end{mplibcode}
+ \fi
+}%
+
+%155
+\NewDocumentCommand\BuildPatternCentCinquanteCinq{}{
+ \ifluatex%
+ \mplibforcehmode
+ \begin{mplibcode}
+ Etape:=\useKV[Pattern]{Etape};
+ input PfCSolid;
+
+ intensite:=1.5;
+ Ferme[0]:=false;
+ outcolor:=LightSteelBlue;
+ incolor:=white;
+ nb:=1;subh:=1;
+ creux:=true;
+
+ Initialisation(2500,40,20,50);
+ angx:=-40;
+ Objetcube1("a=0.25");
+ angx:=0;
+ nbobj:=1;
+ TR:=(0,a*cosd(-40),a*sind(-40));
+ for k=0 upto Etape-2:
+ NBobj:=nbobj;
+ nbobj:=nbobj+1;
+ ObjetDeplacement[nbobj](NBobj);
+ endfor;
+ NBobj:=1;
+ TR:=(0,-a*cosd(-40),-a*sind(-40));
+ for k=0 upto Etape-2:
+ nbobj:=nbobj+1;
+ ObjetDeplacement[nbobj](NBobj);
+ NBobj:=nbobj;
+ endfor;
+ NBobj:=1;
+ TR:=(0,a*sind(-40),-a*cosd(-40));
+ for k=0 upto Etape-2:
+ nbobj:=nbobj+1;
+ ObjetDeplacement[nbobj](NBobj);
+ NBobj:=nbobj;
+ endfor;
+ NBobj:=1;
+ TR:=(0,-a*sind(-40),a*cosd(-40));
+ for k=0 upto Etape-2:
+ nbobj:=nbobj+1;
+ ObjetDeplacement[nbobj](NBobj);
+ NBobj:=nbobj;
+ endfor;
+ NBobj:=1;
+ TR:=(a,0,0);%
+ for k=0 upto Etape-2:
+ nbobj:=nbobj+1;
+ ObjetDeplacement[nbobj](NBobj);
+ NBobj:=nbobj;
+ endfor;
+ NBobj:=1;
+ TR:=(-a,0,0);
+ for k=0 upto Etape-2:
+ nbobj:=nbobj+1;
+ ObjetDeplacement[nbobj](NBobj);
+ NBobj:=nbobj;
+ endfor;
+ DessineFusion;
+ \end{mplibcode}
+ \fi%
+}%
+
+%55
+\NewDocumentCommand\BuildPatternCinquanteCinq{}{%
+ \ifluatex%
+ \begin{Allumettes}[Echelle=0.35]
+ Etape=\useKV[Pattern]{Etape};
+ pair A[],B[],C[],D[],E[];
+ A0=(0,0);
+ B0=A0;
+ B1-B0=u*(0,1);
+ B2=rotation(B0,B1,108);
+ B3=rotation(B1,B2,108);
+ B4=rotation(B2,B3,108);
+ A1=B1;
+ A2-A1=u*(-1,0);
+ A3-A0=A2-A1;
+ trace Allu(B0,B1);
+ trace Allu(B1,B2);
+ trace Allu(B2,B3);
+ trace Allu(B3,B4);
+ trace Allu(B4,B0);
+ for k=0 upto Etape-1:
+ trace Allu(A3,A0) shifted(k*u*(-1,0));
+ trace Allu(A1,A2) shifted(k*u*(-1,0));
+ trace Allu(A2,A3) shifted(k*u*(-1,0));
+ endfor;
+ \end{Allumettes}
+ \fi%
+}%
+
+%53
+\NewDocumentCommand\BuildPatternCinquanteTrois{}{%
+ \ifluatex%
+ \begin{Allumettes}[Echelle=0.35]
+ Etape=\useKV[Pattern]{Etape};
+ pair A[],B[],C[],D[],E[];
+ A0=(0,0);
+ B0=A0;
+ B1-B0=u*(0,1);
+ B2=rotation(B0,B1,60);
+ A1=B1;
+ A2-A1=u*(-1,0);
+ A3-A0=A2-A1;
+ trace Allu(B0,B1);
+ trace Allu(B1,B2);
+ trace Allu(B2,B0);
+ for k=0 upto Etape-1:
+ trace Allu(A3,A0) shifted(k*u*(-1,0));
+ trace Allu(A1,A2) shifted(k*u*(-1,0));
+ trace Allu(A2,A3) shifted(k*u*(-1,0));
+ endfor;
+ \end{Allumettes}
+ \fi%
+}%
+
+%48
+\NewDocumentCommand\BuildPatternQuaranteHuit{}{
+ \ifluatex%
+ \mplibforcehmode
+ \begin{mplibcode}
+ Etape:=\useKV[Pattern]{Etape};
+ input PfCSolid;
+
+ intensite:=1.5;
+ Ferme[0]:=false;
+ outcolor:=LightSteelBlue;
+ incolor:=white;
+ nb:=1;subh:=1;
+ creux:=true;
+
+ Initialisation(2500,40,20,50);
+ Objetcube1("a=0.25");
+ nbobj:=1;
+ TR:=(0,a,0);
+ for k=0 upto Etape-2:
+ NBobj:=nbobj;
+ nbobj:=nbobj+1;
+ ObjetDeplacement[nbobj](NBobj);
+ endfor;
+ NBobj:=1;
+ TR:=(-a,0,0);
+ for k=0 upto Etape-2:
+ nbobj:=nbobj+1;
+ ObjetDeplacement[nbobj](NBobj);
+ NBobj:=nbobj;
+ endfor;
+ NBobj:=1;
+ TR:=(0,0,a);%
+ for k=0 upto Etape-2:
+ nbobj:=nbobj+1;
+ ObjetDeplacement[nbobj](NBobj);
+ NBobj:=nbobj;
+ endfor;
+ DessineFusion;
+ \end{mplibcode}
+ \fi%
+}%
+
+%46
+\NewDocumentCommand\BuildPatternQuaranteSix{}{
+ \ifluatex%
+ \mplibforcehmode
+ \begin{mplibcode}
+ Etape:=\useKV[Pattern]{Etape};
+ input PfCSolid;
+
+ intensite:=1.5;
+ Ferme[0]:=false;
+ outcolor:=LightSteelBlue;
+ incolor:=white;
+ nb:=1;subh:=1;
+ creux:=true;
+
+ Initialisation(2500,40,20,50);
+ Objetcube1("a=0.25");
+ nbobj:=1;
+ TR:=(0,a,0);
+ for k=0 upto Etape-2:
+ NBobj:=nbobj;
+ nbobj:=nbobj+1;
+ ObjetDeplacement[nbobj](NBobj);
+ endfor;
+ NBobj:=1;
+ TR:=(0,-a,0);
+ for k=0 upto Etape-2:
+ nbobj:=nbobj+1;
+ ObjetDeplacement[nbobj](NBobj);
+ NBobj:=nbobj;
+ endfor;
+ NBobj:=1;
+ TR:=(a,0,0);
+ for k=0 upto Etape-2:
+ nbobj:=nbobj+1;
+ ObjetDeplacement[nbobj](NBobj);
+ NBobj:=nbobj;
+ endfor;
+ NBobj:=1;
+ TR:=(-a,0,0);
+ for k=0 upto Etape-2:
+ nbobj:=nbobj+1;
+ ObjetDeplacement[nbobj](NBobj);
+ NBobj:=nbobj;
+ endfor;
+ NBobj:=1;
+ TR:=(0,0,a);%
+ for k=0 upto Etape-2:
+ nbobj:=nbobj+1;
+ ObjetDeplacement[nbobj](NBobj);
+ NBobj:=nbobj;
+ endfor;
+ DessineFusion;
+ \end{mplibcode}
+ \fi%
+}%
+
+%45
+\NewDocumentCommand\BuildPatternQuaranteCinq{}{%
+ \ifluatex%
+ \mplibforcehmode%
+ \begin{mplibcode}
+ pair A[];
+ Etape:=\useKV[Pattern]{Etape};
+ A[0]=(0,0);
+ path piece;
+ piece=unitsquare scaled 5mm shifted(-2.5mm,-2.5mm);
+ for k=0 upto (2*Etape):
+ for l=0 upto Etape:
+ if (k=Etape) and (l=0):
+ else:
+ trace piece shifted(5mm*(k,l));
+ fi;
+ endfor;
+ endfor;
+ \end{mplibcode}
+ \fi
+}
+
+%39
+\NewDocumentCommand\BuildPatternTrenteNeuf{}{
+ \ifluatex%
+ \mplibforcehmode%
+ \begin{mplibcode}
+ Etape:=\useKV[Pattern]{Etape};
+ input PfCSolid;
+
+ intensite:=1.5;
+ Ferme[0]:=false;
+ outcolor:=Orange;
+ incolor:=white;
+ nb:=1;subh:=1;
+ creux:=true;
+
+ Initialisation(2500,40,20,50);
+ Objetcube1("a=0.25");
+ nbobj:=1;
+ for k=0 upto Etape-1:%x
+ for l=0 upto Etape-1:%y
+ for m=Etape-1-l downto 0:%z
+ nbobj:=nbobj+1;
+ TR:=(k*a,l*a,m*a);
+ ObjetDeplacement[nbobj](1);
+ endfor;
+ endfor;
+ endfor;
+ DessineFusion;
+ \end{mplibcode}
+ \fi
+}%
+
+%30
+\NewDocumentCommand\BuildPatternTrente{}{%
+ \ifluatex%
+ \mplibforcehmode%
+ \begin{mplibcode}
+ pair A[];
+ A[0]=(0,0);
+ Etape:=\useKV[Pattern]{Etape};
+ picture Cle;
+ path piece;
+ piece=(unitsquare scaled 3mm) shifted(-1.5mm,-1.5mm);
+ if (Etape mod 2)=0:
+ A0:=(0,1.75mm)+(Etape div 2)*(0,3.5mm);
+ for k=0 upto Etape-1:
+ for l=0 upto Etape-1:
+ if (k*l)<>(Etape-1)*(Etape-1):
+ draw piece shifted(A[0]+3.5mm*(-k,l));
+ draw symetrie(piece shifted(A[0]+3.5mm*(-k,l)),(0,0));
+ fi;
+ endfor;
+ endfor;
+ for k=0 upto ((Etape div 2)-1):
+ draw piece shifted((0,1.75mm)+k*(0,3.5mm));
+ draw symetrie(piece shifted((0,1.75mm)+k*(0,3.5mm)),(0,0));
+ endfor;
+ else:
+ A0:=(0,0)+((Etape div 2)+1)*(0,3.5mm);
+ for k=0 upto Etape-1:
+ for l=0 upto Etape-1:
+ if (k*l)<>(Etape-1)*(Etape-1):
+ draw piece shifted(A[0]+3.5mm*(-k,l));
+ draw symetrie(piece shifted(A[0]+3.5mm*(-k,l)),(0,0));
+ fi;
+ endfor;
+ endfor;
+ for k=1 upto (Etape div 2):
+ draw piece shifted(k*(0,3.5mm));
+ draw symetrie(piece shifted(k*(0,3.5mm)),(0,0));
+ endfor;
+ draw piece;
+ fi;
+ Cle=currentpicture;
+ currentpicture:=nullpicture;
+ draw rotation(Cle,(0,0),40);
+ \end{mplibcode}
+ \fi%
+}%
+
+%24
+\NewDocumentCommand\BuildPatternVingtQuatre{}{%
+ \ifluatex%
+ \mplibforcehmode%
+ \begin{mplibcode}
+ pair A[];
+ Etape:=\useKV[Pattern]{Etape};
+ A[0]=(0,0);
+ path piece;
+ piece=unitsquare scaled 5mm shifted(-2.5mm,-2.5mm);
+ drawoptions(withcolor Orange);
+ for k=0 upto Etape+1:
+ for l=0 upto Etape-1:
+ fill piece shifted(5mm*(k,l));
+ endfor;
+ endfor;
+ fill (piece shifted(0,Etape*5mm));
+ drawoptions();
+ for k=0 upto Etape+1:
+ for l=0 upto Etape-1:
+ trace piece shifted(5mm*(k,l));
+ endfor;
+ endfor;
+ trace (piece shifted(0,Etape*5mm));
+ \end{mplibcode}
+ \fi
+}
+
+%20
+\NewDocumentCommand\BuildPatternVingt{}{%
+ \ifluatex%
+ \mplibforcehmode%
+ \begin{mplibcode}
+ pair A[];
+ Etape:=\useKV[Pattern]{Etape};
+ A[0]=(0,0);
+ for l=0 upto Etape-1:
+ for k=0 upto Etape+1:
+ draw (unitsquare scaled 5mm) shifted(A[0]+5mm*(k,l));
+ endfor;
+ endfor;
+ \end{mplibcode}
+ \fi%
+}%
+
+%19
+\NewDocumentCommand\BuildPatternDixNeuf{}{%
+ \ifluatex%
+ \mplibforcehmode%
+ \begin{mplibcode}
+ pair A[];
+ Etape:=\useKV[Pattern]{Etape};
+ A[0]=(0,0);
+ path piece;
+ piece=unitsquare scaled 5mm shifted(-2.5mm,-2.5mm);
+ drawoptions(withcolor LightGreen);
+ for k=0 upto Etape+1:
+ for l=0 upto Etape-1:
+ fill piece shifted(5mm*(k,l));
+ endfor;
+ endfor;
+ fill (piece shifted(5mm,-5mm));
+ fill (piece shifted(5mm,Etape*5mm));
+ drawoptions();
+ for k=0 upto Etape+1:
+ for l=0 upto Etape-1:
+ trace piece shifted(5mm*(k,l));
+ endfor;
+ endfor;
+ trace (piece shifted(5mm,-5mm));
+ trace (piece shifted(5mm,Etape*5mm));
+ \end{mplibcode}
+ \fi%
+}%
+
+%18
+\NewDocumentCommand\BuildPatternDixHuit{}{%
+ \ifluatex%
+ \mplibforcehmode%
+ \begin{mplibcode}
+ pair A[];
+ Etape:=\useKV[Pattern]{Etape};
+ Somme=0;
+ for k=0 upto Etape-1:
+ A[k]=(0,0)+Somme*5mm*(2,-1);
+ for l=0 upto k:
+ fill polygone(A[k],A[k]+5mm*(2,0),A[k]+5mm*(2,1),A[k]+5mm*(1,1),A[k]+5mm*(1,2),A[k]+5mm*(0,2)) withcolor LightGreen;
+ endfor;
+ for l=0 upto k:
+ trace polygone(A[k],A[k]+5mm*(2,0),A[k]+5mm*(2,1),A[k]+5mm*(1,1),A[k]+5mm*(1,2),A[k]+5mm*(0,2));
+ trace chemin(A[k]+5mm*(1,0),A[k]+5mm*(1,1),A[k]+5mm*(0,1));
+ endfor;
+ Somme:=Somme+1;
+ endfor;
+ \end{mplibcode}
+ \fi
+}
+
+%15
+\NewDocumentCommand\BuildPatternQuinze{}{%
+ \ifluatex%
+ \mplibforcehmode%
+ \begin{mplibcode}
+ pair A[];
+ Etape:=\useKV[Pattern]{Etape};
+ Somme=0;
+ trace (fullcircle scaled 3mm);
+ for k=0 upto Etape-1:
+ A[k]=(0,0)+Somme*4mm*(1,0);
+ %for l=0 upto k:
+ fill ((unitsquare scaled 3mm) shifted(A[k]+4mm*(1,0)-(center (unitsquare scaled 3mm)))) withcolor 0.7white;
+ trace ((unitsquare scaled 3mm) shifted(A[k]+4mm*(1,0)-(center (unitsquare scaled 3mm))));
+ trace (fullcircle scaled 3mm) shifted(A[k]+4mm*(1,-1));
+ trace (fullcircle scaled 3mm) shifted(A[k]+4mm*(1,1));
+ trace (fullcircle scaled 3mm) shifted(A[k]+4mm*(2,0));
+ %endfor;
+ Somme:=Somme+2;
+ endfor;
+ \end{mplibcode}
+ \fi%
+}%
+
+%14
+\NewDocumentCommand\BuildPatternQuatorze{}{%
+ \ifluatex%
+ \mplibforcehmode%
+ \begin{mplibcode}
+ pair A[];
+ Etape:=\useKV[Pattern]{Etape};
+ A[0]=(0,0);
+ for l=0 upto Etape-1:
+ for m=0 upto 5:
+ draw (unitsquare scaled 5mm) shifted(A[0]+5mm*(-m,l));
+ endfor;
+ endfor;
+ draw (unitsquare scaled 5mm) shifted(A[0]+5mm*(-5,Etape));
+ \end{mplibcode}
+ \fi%
+}%
+
+%6
+\NewDocumentCommand\BuildPatternSix{}{%
+ \ifluatex%
+ \begin{Allumettes}[Echelle=0.35]
+ Etape=\useKV[Pattern]{Etape};
+ pair A[],B[],C[],D[],E[];
+ A0=(0,0);
+ B0-A0=u*(1,0);
+ C0=rotation(B0,A0,60);
+ picture UnitTriangle;
+ UnitTriangle=image(
+ trace Allu(A0,B0);
+ trace Allu(B0,C0);
+ trace Allu(C0,A0);
+ );
+ currentpicture:=nullpicture;
+ for k=0 upto Etape-1:
+ for l=0 upto k:
+ trace UnitTriangle shifted(A0+k*(B0-A0)+l*(C0-B0));
+ endfor;
+ endfor;
+ \end{Allumettes}
+ \fi%
+}%
+
+%5
+\NewDocumentCommand\BuildPatternCinq{}{%
+ \ifluatex%
+ \mplibforcehmode%
+ \begin{mplibcode}
+ pair A[];
+ Etape:=\useKV[Pattern]{Etape};
+ A0=(0,0);
+ for k=Etape-1 upto Etape-1:
+ drawoptions(withcolor LightSteelBlue);
+ fill (fullcircle scaled 3mm) shifted A[0];
+ for l=0 upto k:
+ for m=1 upto k+2:
+ fill (fullcircle scaled 3mm) shifted(A[0]+5mm*(l,m));
+ fill symetrie((fullcircle scaled 3mm) shifted(A[0]+5mm*(l,m)),A[0],A[0]+(-1,1));
+ endfor;
+ endfor;
+ fill (fullcircle scaled 3mm) shifted(A[0]+5mm*(-1,k+2));
+ fill symetrie((fullcircle scaled 3mm) shifted(A[0]+5mm*(-1,k+2)),A[0],A[0]+(-1,1));
+ % trace
+ drawoptions();
+ trace (fullcircle scaled 3mm) shifted A[0];
+ for l=0 upto k:
+ for m=1 upto k+2:
+ trace (fullcircle scaled 3mm) shifted(A[0]+5mm*(l,m));
+ trace symetrie((fullcircle scaled 3mm) shifted(A[0]+5mm*(l,m)),A[0],A[0]+(-1,1));
+ endfor;
+ endfor;
+ trace (fullcircle scaled 3mm) shifted(A[0]+5mm*(-1,k+2));
+ trace symetrie((fullcircle scaled 3mm) shifted(A[0]+5mm*(-1,k+2)),A[0],A[0]+(-1,1));
+ endfor;
+ \end{mplibcode}
+ \fi%
+}
+
+\NewDocumentCommand\BuildPatternQuatre{}{%
+ \ifluatex%
+ \mplibforcehmode%
+ \begin{mplibcode}
+ Etape:=\useKV[Pattern]{Etape};
+ %
+ fill ((unitsquare scaled 5mm) shifted (5mm*0*(1,1))) withcolor LightSteelBlue;
+ trace ((unitsquare scaled 5mm) shifted (5mm*0*(1,1)));
+ for k=1 upto Etape:
+ for l=1 upto k:
+ fill ((unitsquare scaled 5mm) shifted (5mm*l*(1,1))) withcolor LightSteelBlue;
+ fill ((unitsquare scaled 5mm) shifted (5mm*l*(1,-1)))withcolor LightSteelBlue;
+ fill ((unitsquare scaled 5mm) shifted (5mm*l*(-1,1))) withcolor LightSteelBlue;
+ fill ((unitsquare scaled 5mm) shifted (5mm*l*(-1,-1))) withcolor LightSteelBlue;
+ endfor;
+ endfor;
+ %
+ for k=1 upto Etape:
+ for l=1 upto k:
+ trace ((unitsquare scaled 5mm) shifted (5mm*l*(1,1)));
+ trace ((unitsquare scaled 5mm) shifted (5mm*l*(1,-1)));
+ trace ((unitsquare scaled 5mm) shifted (5mm*l*(-1,1)));
+ trace ((unitsquare scaled 5mm) shifted (5mm*l*(-1,-1)));
+ endfor;
+ endfor;
+ %
+ \end{mplibcode}
+ \fi%
+}%
+
+\NewDocumentCommand\BuildPatternTrois{}{%
+ \ifluatex%
+ \mplibforcehmode%
+ \begin{mplibcode}
+ Etape:=\useKV[Pattern]{Etape};
+ %
+ for k=1 upto Etape:
+ for l=Etape downto k:
+ fill ((unitsquare scaled 5mm) shifted (5mm*(Etape-l+1,k-1))) withcolor LightSteelBlue;
+ endfor;
+ endfor;
+ for k=1 upto Etape:
+ for l=Etape downto k:
+ trace ((unitsquare scaled 5mm) shifted (5mm*(Etape-l+1,k-1))) withcolor white;
+ endfor;
+ endfor;
+ %
+ \end{mplibcode}
+ \fi%
+}%
+
+\NewDocumentCommand\BuildPatternDeux{}{%
+ \ifluatex%
+ \mplibforcehmode%
+ \begin{mplibcode}
+ Etape:=\useKV[Pattern]{Etape};
+ %
+ input PfCSolid;
+ %
+ intensite:=1.5;
+ Ferme[0]:=false;
+ outcolor:=LightSteelBlue;
+ incolor:=white;
+ nb:=1;subh:=1;
+ creux:=true;
+ %
+ Initialisation(2500,40,20,50);
+ Objetcube0("a=0.25");
+ for k=1 upto Etape:
+ TR:=(0,2*k,0);
+ ObjetDeplacement1(0);
+ nbobj:=1;
+ for l=1 upto k-1:
+ TR:=(0,0.25*l,0);
+ nbobj:=nbobj+1;
+ ObjetDeplacement[nbobj](1);
+ endfor;
+ for l=1 upto k-1:
+ TR:=(0,0.25*(k-1),0.25*l);
+ nbobj:=nbobj+1;
+ ObjetDeplacement[nbobj](1);
+ endfor;
+ endfor;
+ %nbobj=13;
+ DessineFusion;
+ \end{mplibcode}
+ \fi%
+}%
+
+\NewDocumentCommand\BuildPatternUn{}{%
+ \ifluatex%
+ \mplibforcehmode%
+ \begin{mplibcode}
+ u:=5mm;
+ pair A[],O[];
+ path cc[],dd[];
+ Etape=\useKV[Pattern]{Etape};
+ %
+ k:=Etape;
+ O[k]=(0,0);
+ dd[k]=unitsquare scaled (k*u);
+ cc[k]=dd[k] shifted (O[k]-center(dd[k]));
+ trace cc[k];
+ for l=1 upto 4:
+ A[l]:=point l of cc[k];
+ endfor;
+ %horizontales et verticales
+ for m=1 upto k-1:
+ trace ((m/k)[A1,A4])--((m/k)[A2,A3]);
+ trace ((m/k)[A1,A2])--((m/k)[A4,A3]);
+ endfor;
+ \end{mplibcode}
+ \fi%
+}% \ No newline at end of file
diff --git a/macros/latex/contrib/profcollege/latex/PfCPropor.tex b/macros/latex/contrib/profcollege/latex/PfCPropor.tex
index 6c4774ac60..0933a3e460 100644
--- a/macros/latex/contrib/profcollege/latex/PfCPropor.tex
+++ b/macros/latex/contrib/profcollege/latex/PfCPropor.tex
@@ -143,9 +143,9 @@
\newcommand\FlechesPD[3]{%
\begin{tikzpicture}[remember picture,overlay]%
\ifnum#1<#2\relax%
- \draw[FlechePropor,out=-30,in=30] (ProporD-#1) to node[transform canvas={xshift=1pt},inner sep=0pt, inner xsep=1pt,fill=\colorfill, pos=0.5,right]{#3}(ProporD-#2);%
+ \draw[FlechePropor,out=-30,in=30] (ProporD-#1) to node[transform canvas={xshift=1pt},inner sep=0pt, inner xsep=1pt,fill=\colorfill, pos=0.5,right]{#3}(ProporD-#2);%
\else%
- \draw[FlechePropor,out=30,in=-30] (ProporD-#1) to node[transform canvas={xshift=1pt},inner sep=0pt, inner xsep=1pt,fill=\colorfill, pos=0.5,right]{#3}(ProporD-#2);%
+ \draw[FlechePropor,out=30,in=-30] (ProporD-#1) to node[transform canvas={xshift=1pt},inner sep=0pt, inner xsep=1pt,fill=\colorfill, pos=0.5,right]{#3}(ProporD-#2);%
\fi%
\end{tikzpicture}%
}%
diff --git a/macros/latex/contrib/profcollege/latex/PfCPuissanceQuatre.tex b/macros/latex/contrib/profcollege/latex/PfCPuissanceQuatre.tex
index 87f14051ae..1d8a929939 100644
--- a/macros/latex/contrib/profcollege/latex/PfCPuissanceQuatre.tex
+++ b/macros/latex/contrib/profcollege/latex/PfCPuissanceQuatre.tex
@@ -64,19 +64,19 @@
\ifluatex%
\mplibforcehmode%
\begin{mplibcode}
- Largeur=\useKV[ClesPQuatre]{Largeur};
- LargeurUn=\useKV[ClesPQuatre]{LargeurUn};
- Echelle=\useKV[ClesPQuatre]{Echelle};
- color fond;
- fond=\useKV[ClesPQuatre]{Couleur};
- boolean Libre,Multiplication,Texte;
- Libre:=\useKV[ClesPQuatre]{Libre};
- Multiplication=\useKV[ClesPQuatre]{Multiplication};
- Texte:=\useKV[ClesPQuatre]{Texte};
+ PQLargeur=\useKV[ClesPQuatre]{Largeur};
+ PQLargeurUn=\useKV[ClesPQuatre]{LargeurUn};
+ PQEchelle=\useKV[ClesPQuatre]{Echelle};
+ color PQfond;
+ PQfond=\useKV[ClesPQuatre]{Couleur};
+ boolean PQLibre,PQMultiplication,PQTexte;
+ PQLibre:=\useKV[ClesPQuatre]{Libre};
+ PQMultiplication=\useKV[ClesPQuatre]{Multiplication};
+ PQTexte:=\useKV[ClesPQuatre]{Texte};
- if Texte:
- string Consignes;
- Consignes=\useKV[ClesPQuatre]{Consignes};
+ if PQTexte:
+ string PQConsignes;
+ PQConsignes=\useKV[ClesPQuatre]{Consignes};
fi;
% On calcule le nombre de cases
@@ -88,49 +88,49 @@
for p_=#2:
nclargeur:=incr nclargeur;
endfor;
- if Libre=false:
+ if PQLibre=false:
nchauteur:=7;
nclargeur:=7;
fi;
%On affiche
pair A,B,C,D,H[],V[],M[][];
A=(0,0);
- B-A=Largeur*(nclargeur,0);
- C-B=Largeur*(0,nchauteur);
+ B-A=PQLargeur*(nclargeur,0);
+ C-B=PQLargeur*(0,nchauteur);
D-C=A-B;
- fill polygone(A,B,C,D) withcolor fond;
+ fill polygone(A,B,C,D) withcolor PQfond;
trace polygone(A,B,C,D);
for k=0 upto (nclargeur-1):
for l=0 upto (nchauteur-1):
- M[k][l]=A+0.5*(Largeur,Largeur)+k*(Largeur,0)+l*(0,Largeur);
- fill cercles(M[k][l],0.4*Largeur) withcolor blanc;
- trace cercles(M[k][l],0.4*Largeur);
+ M[k][l]=A+0.5*(PQLargeur,PQLargeur)+k*(PQLargeur,0)+l*(0,PQLargeur);
+ fill cercles(M[k][l],0.4*PQLargeur) withcolor blanc;
+ trace cercles(M[k][l],0.4*PQLargeur);
endfor;
endfor;
labeloffset:=labeloffset*2;
- if Libre:
- if Texte:
- label.llft(TEX("\begin{minipage}{"&decimal(LargeurUn)&"pt}"&Consignes&"\end{minipage}") scaled Echelle,A);
+ if PQLibre:
+ if PQTexte:
+ label.llft(TEX("\begin{minipage}{"&decimal(PQLargeurUn)&"pt}"&PQConsignes&"\end{minipage}") scaled PQEchelle,A);
fi;
else:
- if Multiplication:
- label.llft(btex $\times$ etex scaled Echelle,A);
+ if PQMultiplication:
+ label.llft(TEX("$\times$") scaled PQEchelle,A);
else:
- label.llft(btex $+$ etex scaled Echelle,A);
+ label.llft(TEX("$+$") scaled PQEchelle,A);
fi;
fi;
labeloffset:=labeloffset/2;
vardef Vertical(text t)=
n:=0;
for p_=t:
- label.lft(TEX(p_) scaled Echelle,A+(0,n*Largeur+Largeur/2));
+ label.lft(TEX(p_) scaled PQEchelle,A+(0,n*PQLargeur+PQLargeur/2));
n:=n+1;
endfor;
enddef;
vardef Horizontal(text t)=
n:=0;
for p_=t:
- label.bot(TEX(p_) scaled Echelle,A+(n*Largeur+Largeur/2,0));
+ label.bot(TEX(p_) scaled PQEchelle,A+(n*PQLargeur+PQLargeur/2,0));
n:=n+1;
endfor;
enddef;
diff --git a/macros/latex/contrib/profcollege/latex/PfCPythagore.tex b/macros/latex/contrib/profcollege/latex/PfCPythagore.tex
index 0ebc259286..5df5f0b03a 100644
--- a/macros/latex/contrib/profcollege/latex/PfCPythagore.tex
+++ b/macros/latex/contrib/profcollege/latex/PfCPythagore.tex
@@ -275,6 +275,10 @@
\NewDocumentCommand\CalculsPythagore{o m m m m}{%
\xintifboolexpr{#3<#4 || #3==#4}{%\ifnum#3<#4%
\xdef\ResultatPytha{\fpeval{round(sqrt(#3^2+#4^2),\useKV[ClesPythagore]{Precision})}}%
+ \ifboolKV[ClesPythagore]{EnchaineA}{\xdef\PfCPythaVA{\useKV[ClesPythagore]{ValeurA}}}{\xdef\PfCPythaVA{\fpeval{#3^2}}}%
+ \ifboolKV[ClesPythagore]{EnchaineB}{\xdef\PfCPythaVB{\useKV[ClesPythagore]{ValeurB}}}{\xdef\PfCPythaVB{\fpeval{#4^2}}}%
+ \xdef\ResultatAttendu{\fpeval{\PfCPythaVA+\PfCPythaVB}}%
+ \xdef\ResultatApproche{\fpeval{round(sqrt(\ResultatAttendu),\useKV[ClesPythagore]{Precision})^2}}%
\begin{align*}
\NomA\NomC^2&=\NomA\NomB^2+\NomB\NomC^2\\
\NomA\NomC^2&=\ifboolKV[ClesPythagore]{EnchaineA}{\opcopy{\useKV[ClesPythagore]{ValeurA}}{a1}\opexport{a1}{\Aun}\num{\Aun}}{\opexport{A1}{\Aun}\num{\Aun}^2}+\ifboolKV[ClesPythagore]{EnchaineB}{\opcopy{\useKV[ClesPythagore]{ValeurB}}{a2}\opexport{a2}{\Adeux}\num{\Adeux}}{\opexport{A2}{\Adeux}\num{\Adeux}^2}\\
@@ -282,11 +286,15 @@
\NomA\NomC^2&=\opadd*{a1}{a2}{a3}\opexport{a3}{\Atrois}\num{\Atrois}%\\
\ifboolKV[ClesPythagore]{AvantRacine}{}{%
\ifboolKV[ClesPythagore]{Entier}{}{\\\NomA\NomC&=\sqrt{\opexport{a3}{\Atrois}\num{\Atrois}}}
- \ifboolKV[ClesPythagore]{Racine}{}{\\\NomA\NomC&\IfInteger{\fpeval{round(sqrt(#3^2+#4^2),\useKV[ClesPythagore]{Precision})^2-#3^2-#4^2}}{=}{\approx}\opsqrt[maxdivstep=5]{a3}{a4}\opround{a4}{pres}{a4}\opunzero{a4}\opexport{a4}{\Aquatre}\SI{\Aquatre}{\PfCPythaUnit}}%\\
+ \ifboolKV[ClesPythagore]{Racine}{}{\\\NomA\NomC&\IfStrEq{\ResultatApproche}{\ResultatAttendu}{=}{\approx}\opsqrt[maxdivstep=5]{a3}{a4}\opround{a4}{pres}{a4}\opunzero{a4}\opexport{a4}{\Aquatre}\SI{\Aquatre}{\PfCPythaUnit}}%\\
}
\end{align*}
- }{%\else
+ }{%
\xdef\ResultatPytha{\fpeval{round(sqrt(#3^2-#4^2),\useKV[ClesPythagore]{Precision})}}%
+ \ifboolKV[ClesPythagore]{EnchaineC}{\xdef\PfCPythaVC{\useKV[ClesPythagore]{ValeurC}}}{\xdef\PfCPythaVC{\fpeval{#3^2}}}%
+ \ifboolKV[ClesPythagore]{EnchaineB}{\xdef\PfCPythaVB{\useKV[ClesPythagore]{ValeurB}}}{\xdef\PfCPythaVB{\fpeval{#4^2}}}%
+ \xdef\ResultatAttendu{\fpeval{\PfCPythaVC-\PfCPythaVB}}%
+ \xdef\ResultatApproche{\fpeval{round(sqrt(\ResultatAttendu),\useKV[ClesPythagore]{Precision})^2}}%
\ifboolKV[ClesPythagore]{Soustraction}{%
\begin{align*}
\NomA\NomB^2&=\NomA\NomC^2-\NomB\NomC^2\\
@@ -295,7 +303,7 @@
\NomA\NomB^2&=\opsub*{a1}{a2}{a3}\opexport{a3}{\Atrois}\num{\Atrois}%\\
\ifboolKV[ClesPythagore]{AvantRacine}{}{%
\ifboolKV[ClesPythagore]{Entier}{}{\\\NomA\NomB&=\sqrt{\opexport{a3}{\Atrois}\num{\Atrois}}}
- \ifboolKV[ClesPythagore]{Racine}{}{\\\NomA\NomB&\IfInteger{\fpeval{round(sqrt(#3^2-#4^2),\useKV[ClesPythagore]{Precision})^2-#3^2+#4^2}}{=}{\approx}\opsqrt[maxdivstep=5]{a3}{a4}\opround{a4}{pres}{a4}\opunzero{a4}\opexport{a4}{\Aquatre}\SI{\Aquatre}{\PfCPythaUnit}}%\\
+ \ifboolKV[ClesPythagore]{Racine}{}{\\\NomA\NomB&\IfStrEq{\ResultatApproche}{\ResultatAttendu}{=}{\approx}\opsqrt[maxdivstep=5]{a3}{a4}\opround{a4}{pres}{a4}\opunzero{a4}\opexport{a4}{\Aquatre}\SI{\Aquatre}{\PfCPythaUnit}}%\\
}
\end{align*}
}{%
@@ -307,8 +315,8 @@
\NomA\NomB^2&=\opsub*{a1}{a2}{a3}\opexport{a3}{\Atrois}\num{\Atrois}%\\
\ifboolKV[ClesPythagore]{AvantRacine}{}{%
\ifboolKV[ClesPythagore]{Entier}{}{\\\NomA\NomB&=\sqrt{\opexport{a3}{\Atrois}\num{\Atrois}}}%
- \ifboolKV[ClesPythagore]{Racine}{}{\\\NomA\NomB&\IfInteger{\fpeval{round(sqrt(#3^2-#4^2),\useKV[ClesPythagore]{Precision})^2-#3^2+#4^2}}{=}{\approx}\opsqrt[maxdivstep=5]{a3}{a4}\opround{a4}{pres}{a4}\opunzero{a4}\opexport{a4}{\Aquatre}\SI{\Aquatre}{\PfCPythaUnit}}%\\
- }
+ \ifboolKV[ClesPythagore]{Racine}{}{\\\NomA\NomB&\IfStrEq{\ResultatApproche}{\ResultatAttendu}{=}{\approx}\opsqrt[maxdivstep=5]{a3}{a4}\opround{a4}{pres}{a4}\opunzero{a4}\opexport{a4}{\Aquatre}\SI{\Aquatre}{\PfCPythaUnit}}%\\
+ }
\end{align*}
}%
}%\fi%
diff --git a/macros/latex/contrib/profcollege/latex/PfCReperage.tex b/macros/latex/contrib/profcollege/latex/PfCReperage.tex
index 93bce3c393..9924f631f8 100644
--- a/macros/latex/contrib/profcollege/latex/PfCReperage.tex
+++ b/macros/latex/contrib/profcollege/latex/PfCReperage.tex
@@ -1,7 +1,7 @@
%%%
% Reperage
%%%
-\setKVdefault[ClesReperage]{Unitex=1,Pasx=1,Unitey=1,Pasy=1,Unitez=1,Pasz=1,DemiDroite=false,Droite=false,Plan=false,Trace=false,ListeSegment={},Espace=false,Sphere=false,AnglePhi=30,CouleurLa=white,CouleurLon=Tomato,AffichageUnites=true,MarquePrimaire=true,AffichageNom=false,AffichageGrad=false,AffichageAbs=0,AffichageCoord=false,LectureCoord=false,ValeurUnitex=1,ValeurUnitey=1,ValeurOrigine=0,NomOrigine=O,EchelleEspace=50,CouleurCoord=black,Thermometre=false,Mercure=false,CouleurMercure=black,Celsius,Kelvin=false,Farenheit=false,ValeurMin=-4000,ValeurMax=4000,Etages=4,Code=false,Globe=false,Rho=1500,Phi=22,Theta=10,CouleurE=orange,CouleurG=green,Axes=false,TypeProj="persp",Niveaux=false}
+\setKVdefault[ClesReperage]{Unitex=1,Pasx=1,Unitey=1,Pasy=1,Unitez=1,Pasz=1,DemiDroite=false,Droite=false,Plan=false,Trace=false,ListeSegment={},Espace=false,Sphere=false,AnglePhi=30,CouleurLa=white,CouleurLon=Tomato,AffichageUnites=true,MarquePrimaire=true,AffichageNom=false,AffichageGrad=false,AffichageAbs=0,AffichageCoord=false,LectureCoord=false,ValeurUnitex=1,ValeurUnitey=1,ValeurOrigine=0,NomOrigine=O,EchelleEspace=50,CouleurCoord=black,Thermometre=false,Mercure=false,CouleurMercure=black,Celsius,Kelvin=false,Farenheit=false,ValeurMin=-4000,ValeurMax=4000,Etages=4,Code=false,Globe=false,Rho=1500,Phi=22,Theta=10,CouleurE=orange,CouleurG=green,Axes=false,TypeProj="persp",Niveaux=false,Decale=false}
\defKV[ClesReperage]{Traces=\setKV[ClesReperage]{Code}}%
\defKV[ClesReperage]{Niveau=\setKV[ClesReperage]{Etages=#1}\setKV[ClesReperage]{Niveaux}}%
% ValeurOrigine permet de faire des morceaux de demi-droite gradu\'ee en passant par droite :)
@@ -1428,10 +1428,11 @@
AffichageGrad:=\AffichageGrad;
AffichageCoord:=\useKV[ClesReperage]{AffichageAbs};
AffichageNom:=\AffichageNom;
- boolean DemiDroite,AffichageUnites,MarquePrimaire;
+ boolean DemiDroite,AffichageUnites,MarquePrimaire,Decale;
DemiDroite=\useKV[ClesReperage]{DemiDroite};
AffichageUnites=\useKV[ClesReperage]{AffichageUnites};
MarquePrimaire=\useKV[ClesReperage]{MarquePrimaire};
+ Decale=\useKV[ClesReperage]{Decale};
numeric valeur[];
vardef titi(text t)=
n:=0;
@@ -1541,8 +1542,22 @@
if ACoord=4:
pointe(unitp*(valeur[n],0));
elseif ACoord=3:
- drawarrow ((unitp*valeur[n],-7mm))--((unitp*valeur[n],-3mm));
- label.bot(btex \hbox to2em{\dotfill} etex,((unitp*valeur[n],-8mm)));
+ if Decale:
+ drawarrow (unitp*valeur[n],-7mm if (n mod 2)=0:-5mm fi)--(unitp*valeur[n],-3mm);
+ else:
+ drawarrow (unitp*valeur[n],-7mm)--(unitp*valeur[n],-3mm);
+ fi;
+ numeric LongPoint;
+ Labeloffset:=labeloffset;
+ labeloffset:=0pt;
+ if DemiDroite:
+ LongPoint=abs(C-(B+unitp*(0.75,0)));
+ label.rt(TEX("\pointilles["&decimal(LongPoint)&"pt]"),C+(0,-1.6cm));
+ else:
+ LongPoint=abs((C+unitp*(-0.75,0))-(B+unitp*(0.75,0)));
+ label.rt(TEX("\pointilles["&decimal(LongPoint)&"pt]"),C+unitp*(-0.75,0)+(0,-1.6cm));
+ fi;
+ labeloffset:=Labeloffset;
pointe(unitp*(valeur[n],0));
elseif ACoord=2:
if ((ValeurUnitex*valeur[n]) mod pasx)<>0:
@@ -1560,8 +1575,22 @@
pointe(unitp*(valeur[n],0));
elseif AffichageCoord=3:
if p_<>"":
- drawarrow ((unitp*valeur[n],-7mm))--((unitp*valeur[n],-3mm));
- label.bot(btex \hbox to2em{\dotfill} etex,((unitp*valeur[n],-8mm)));
+ if Decale:
+ drawarrow (unitp*valeur[n],-7mm if (n mod 2)=0:-5mm fi)--(unitp*valeur[n],-3mm);
+ else:
+ drawarrow (unitp*valeur[n],-7mm)--(unitp*valeur[n],-3mm);
+ fi;
+ numeric LongPoint;
+ Labeloffset:=labeloffset;
+ labeloffset:=0pt;
+ if DemiDroite:
+ LongPoint=abs(C-(B+unitp*(0.75,0)));
+ label.rt(TEX("\pointilles["&decimal(LongPoint)&"pt]"),C+(0,-1.6cm));
+ else:
+ LongPoint=abs((C+unitp*(-0.75,0))-(B+unitp*(0.75,0)));
+ label.rt(TEX("\pointilles["&decimal(LongPoint)&"pt]"),C+unitp*(-0.75,0)+(0,-1.6cm));
+ fi;
+ labeloffset:=Labeloffset;
pointe(unitp*(valeur[n],0));
fi;
elseif AffichageCoord=2:
diff --git a/macros/latex/contrib/profcollege/latex/PfCSerpent.tex b/macros/latex/contrib/profcollege/latex/PfCSerpent.tex
new file mode 100644
index 0000000000..b71434dc30
--- /dev/null
+++ b/macros/latex/contrib/profcollege/latex/PfCSerpent.tex
@@ -0,0 +1,365 @@
+%%%
+% Serpent
+%%%
+\newtoks\tokListeSerpentPerso{}%
+\def\UpdatetoksSerpent#1\nil{\addtotok\tokListeSerpentPerso{"#1"}}%
+
+\setKVdefault[Serpent]{Cases=9,Case=1,Solution=false,PasQuad=7mm,ValeurMin=2,ValeurMax=10,Creation=false,Graines=false}
+\defKV[Serpent]{CouleurSolution=\setKV[Serpent]{Solution}}%
+\defKV[Serpent]{Perso=\setKV[Serpent]{Creation}\xdef\PfCFooCheminSerpent{#1}}%+Liste des déplacements
+\defKV[Serpent]{Graine=\setKV[Serpent]{Graines}}%
+
+\NewDocumentCommand\Serpent{o}{%
+ \useKVdefault[Serpent]%
+ \setKV[Serpent]{#1}%
+ \tokListeSerpentPerso{}%
+ \ifboolKV[Serpent]{Creation}{%
+ \setsepchar{,}\ignoreemptyitems%
+ \expandafter\UpdatetoksSerpent\PfCFooCheminSerpent\nil%
+ \BuildSerpent{\the\tokListeSerpentPerso}%
+ }{%
+ \BuildSerpent{}%
+ }%
+}%
+
+\NewDocumentCommand\BuildSerpent{m}{%
+ \ifluatex%
+ \mplibforcehmode%
+ \mplibnumbersystem{double}%
+ \begin{mplibcode}
+ %
+ boolean Solution,Perso,Graines;
+ Solution=\useKV[Serpent]{Solution};
+ Perso=\useKV[Serpent]{Creation};
+ Graines=\useKV[Serpent]{Graines};
+ %
+ if Graines:
+ randomseed:=\useKV[Serpent]{Graine};
+ fi;
+ %
+ color CoulSolution;
+ if Solution:
+ CoulSolution=\useKV[Serpent]{CouleurSolution};
+ fi;
+ %
+ numeric LongueurChemin,Depart;
+ LongueurChemin=\useKV[Serpent]{Cases};
+ ValeurMin=\useKV[Serpent]{ValeurMin};
+ ValeurMax=\useKV[Serpent]{ValeurMax};
+ CaseDepart=\useKV[Serpent]{Case};
+ Depart=ValeurMin+floor(uniformdeviate(ValeurMax-ValeurMin+1));
+ %
+ boolean Impossible[][];
+ %
+ vardef InitialisationZone=
+ for k=-1 upto HautQuad+1:
+ for l=-1 upto LargQuad+1:
+ Impossible[k][l]=true;
+ endfor;
+ endfor;
+ for k=1 upto HautQuad:
+ for l=1 upto LargQuad:
+ Impossible[k][l]:=false;
+ endfor;
+ endfor;
+ enddef;
+ %
+ vardef ReInitialisationZone=
+ for k=-1 upto HautQuad+1:
+ for l=-1 upto LargQuad+1:
+ Impossible[k][l]:=true;
+ endfor;
+ endfor;
+ for k=1 upto HautQuad:
+ for l=1 upto LargQuad:
+ Impossible[k][l]:=false;
+ endfor;
+ endfor;
+ enddef;
+ %
+ vardef RAZZone=
+ pair PileChemin[];
+ indiceChemin:=0;
+ enddef;
+ %
+ def PushChemin(expr tt)=
+ if indiceChemin<1:
+ PileChemin[1]:=tt;
+ indiceChemin:=1;
+ else:
+ PileChemin[indiceChemin+1]:=tt;
+ indiceChemin:=indiceChemin+1;
+ fi;
+ enddef;
+ %
+ def PopChemin=
+ currentpicture:=nullpicture;
+ RAZZone;
+ ReInitialisationZone;
+ %Redemarrage
+ nbcaseschoisies:=1;
+ PushChemin((ChoixLigneD,ChoixColonneD));
+ N[nbcaseschoisies]=4*PasQuad*(ChoixColonneD-1,ChoixLigneD-1);
+ Impossible[ChoixLigneD][ChoixColonneD]:=true;
+ VoisinDispo(ChoixLigneD,ChoixColonneD);
+ enddef;
+ %
+ %Pile des cases voisines de la case parcourue
+ pair PileVoisin[];
+ numeric indiceVoisin;
+ indiceVoisin=0;
+ %
+ vardef RAZPileVoisin=
+ indiceVoisin:=0;
+ enddef;
+ %
+ def PushVoisin(expr tt)=
+ if indiceVoisin<1:
+ PileVoisin[1]:=tt;
+ indiceVoisin:=1;
+ else:
+ PileVoisin[indiceVoisin+1]:=tt;
+ indiceVoisin:=indiceVoisin+1;
+ fi;
+ enddef;
+ %
+ vardef VoisinDispo(expr la,lo)=
+ RAZPileVoisin;
+ numeric nbvoisin;
+ nbvoisin:=0;
+ if Impossible[la+1][lo]=false:
+ nbvoisin:=nbvoisin+1;
+ PushVoisin((la+1,lo));
+ fi;
+ if Impossible[la-1][lo]=false:
+ nbvoisin:=nbvoisin+1;
+ PushVoisin((la-1,lo));
+ fi;
+ if Impossible[la][lo+1]=false:
+ nbvoisin:=nbvoisin+1;
+ PushVoisin((la,lo+1));
+ fi;
+ if Impossible[la][lo-1]=false:
+ nbvoisin:=nbvoisin+1;
+ PushVoisin((la,lo-1));
+ fi;
+ enddef;
+ %
+ PasQuad=\useKV[Serpent]{PasQuad};
+ HautQuad=if (LongueurChemin mod 2)=1:(LongueurChemin+1) div 2 else: LongueurChemin div 2 fi;
+ LargQuad=HautQuad;
+ % Démarrage du choix perso ou automatique du serpent
+ InitialisationZone;
+ RAZZone;
+ %
+ ChoixLigneD=(HautQuad div 2)+1;
+ ChoixColonneD=(LargQuad div 2)+1;
+ %
+ pair N[];
+ vardef RemplirChemin(text t)=
+ nbpoints:=1;
+ N[1]:=4*PasQuad*(0,0);
+ string p_;
+ for k=2 upto LongueurChemin:
+ nbpoints:=nbpoints+1;
+ p_:=substring(k-2,k-1) of t;
+ if p_=">":
+ N[nbpoints]=N[nbpoints-1]+4*PasQuad*(1,0);
+ elseif p_="<":
+ N[nbpoints]=N[nbpoints-1]+4*PasQuad*(-1,0);
+ elseif p_="+":
+ N[nbpoints]=N[nbpoints-1]+4*PasQuad*(0,1);
+ elseif p_="-":
+ N[nbpoints]=N[nbpoints-1]+4*PasQuad*(0,-1);
+ fi;
+ endfor;
+ enddef;
+ %
+ if Perso:
+ % chemin personnel
+ RemplirChemin(#1);
+ else:
+ PushChemin((ChoixLigneD,ChoixColonneD));
+ nbcaseschoisies=1;
+ N[nbcaseschoisies]=4*PasQuad*(ChoixColonneD-1,ChoixLigneD-1);
+ Impossible[ChoixLigneD][ChoixColonneD]:=true;
+ VoisinDispo(ChoixLigneD,ChoixColonneD);
+ % Le "parcours"
+ forever: exitif nbcaseschoisies>LongueurChemin-1;
+ nb:=ceiling(uniformdeviate(nbvoisin));
+ if nb>0:
+ for k=1 upto nbvoisin:
+ Impossible[xpart(PileVoisin[nb])][ypart(PileVoisin[nb])]:=true;
+ endfor;
+ PushChemin((xpart(PileVoisin[nb]),ypart(PileVoisin[nb])));
+ nbcaseschoisies:=nbcaseschoisies+1;
+ N[nbcaseschoisies]:=4*PasQuad*(ypart(PileVoisin[nb])-1,xpart(PileVoisin[nb])-1);
+ VoisinDispo(xpart(PileChemin[indiceChemin]),ypart(PileChemin[indiceChemin]));
+ else:
+ PopChemin;
+ fi;
+ endfor;
+ fi;
+ % Tracage
+ if CaseDepart=1:
+ label(TEX("\Large"&decimal(Depart)),N[1] shifted(PasQuad*(1,1)));
+ else:
+ if Solution:
+ label(TEX("\Large"&decimal(Depart)),N[1] shifted(PasQuad*(1,1))) withcolor CoulSolution;
+ fi;
+ fi;
+ for k=1 upto LongueurChemin:
+ trace (unitsquare scaled (2*PasQuad)) shifted N[k];
+ endfor;
+ for k=1 upto LongueurChemin-1:
+ drawarrow (center (unitsquare scaled (2*PasQuad)) shifted N[k])--(center (unitsquare scaled (2*PasQuad)) shifted N[k+1]) cutbefore ((unitsquare scaled (2*PasQuad)) shifted N[k]) cutafter ((unitsquare scaled (2*PasQuad)) shifted N[k+1]);
+ endfor;
+ %%drawoptions();
+ boolean PremierChiffre;
+ PremierChiffre=true;
+ %% Test Premier
+ vardef TestPremier(expr nombre)=
+ nbdiviseur:=0;
+ nbdiv:=0;
+ for k=2 upto nombre:
+ if (nombre mod k)=0:
+ nbdiviseur:=nbdiviseur+1;
+ if k<11:
+ nbdiv:=nbdiv+1;
+ Diviseur[nbdiv]:=k;
+ fi;
+ fi;
+ endfor;
+ if nbdiviseur>1:
+ PremierChiffre:=false;
+ else:
+ PremierChiffre:=true;
+ fi;
+ enddef;
+ % Les opérations
+ vardef EcrireSomme(expr tt)=
+ Somme:=5+ceiling(uniformdeviate(10));
+ Chiffre[tt]=Chiffre[tt-1]+Somme;
+ St[tt]=iso(N[tt-1]+PasQuad*(1,1),N[tt]+PasQuad*(1,1));
+ if xpart(N[tt])-xpart(N[tt-1])=0:
+ label.rt(TEX("$+"&decimal(Somme)&"$"),St[tt]);
+ else:
+ label.bot(TEX("$+"&decimal(Somme)&"$"),St[tt]);
+ fi;
+ enddef;
+ %
+ vardef EcrireProduit(expr tt)=
+ Multiple:=1+ceiling(uniformdeviate(8));
+ Chiffre[tt]=Chiffre[tt-1]*Multiple;
+ St[tt]=iso(N[tt-1]+PasQuad*(1,1),N[tt]+PasQuad*(1,1));
+ if xpart(N[tt])-xpart(N[tt-1])=0:
+ label.rt(TEX("$\times"&decimal(Multiple)&"$"),St[tt]);
+ else:
+ label.bot(TEX("$\times"&decimal(Multiple)&"$"),St[tt]);
+ fi;
+ enddef;
+ numeric Chiffre[];
+ pair St[];
+ Chiffre[1]=Depart;
+ %
+ vardef EcrireDifferenceCent(expr tt)=
+ Difference:=ceiling(Chiffre[tt-1]-15+uniformdeviate(10));
+ Chiffre[tt]=Chiffre[tt-1]-Difference;
+ St[tt]=iso(N[tt-1]+PasQuad*(1,1),N[tt]+PasQuad*(1,1));
+ if xpart(N[tt])-xpart(N[tt-1])=0:
+ label.rt(TEX("$-"&decimal(Difference)&"$"),St[tt]);
+ else:
+ label.bot(TEX("$-"&decimal(Difference)&"$"),St[tt]);
+ fi;
+ enddef;
+ %
+ vardef EcrireDifference(expr tt)=
+ Difference:=if Chiffre[tt-1]<20:1+floor(uniformdeviate(Chiffre[tt-1]-1)) else: 5+ceiling(uniformdeviate(10)) fi;
+ Chiffre[tt]=Chiffre[tt-1]-Difference;
+ St[tt]=iso(N[tt-1]+PasQuad*(1,1),N[tt]+PasQuad*(1,1));
+ if xpart(N[tt])-xpart(N[tt-1])=0:
+ label.rt(TEX("$-"&decimal(Difference)&"$"),St[tt]);
+ else:
+ label.bot(TEX("$-"&decimal(Difference)&"$"),St[tt]);
+ fi;
+ enddef;
+ %
+ vardef EcrireQuotient(expr tt)=
+ choixdiv:=ceiling(nbdiv);
+ Quotient:=Diviseur[choixdiv];
+ Chiffre[tt]=Chiffre[tt-1] div Quotient;
+ St[tt]=iso(N[tt-1]+PasQuad*(1,1),N[tt]+PasQuad*(1,1));
+ if xpart(N[tt])-xpart(N[tt-1])=0:
+ label.rt(TEX("$\div"&decimal(Quotient)&"$"),St[tt]);
+ else:
+ label.bot(TEX("$\div"&decimal(Quotient)&"$"),St[tt]);
+ fi;
+ enddef;
+ %
+ for k=2 upto LongueurChemin:
+ if (Chiffre[k-1]=1) or (Chiffre[k-1]=0):
+ % On additionne ou on multiplie si c'est un
+ if Chiffre[k-1]=1:
+ alea:=ceiling(uniformdeviate(2));
+ if alea=1:
+ EcrireSomme(k);
+ else:
+ EcrireProduit(k);
+ fi;
+ else:
+ EcrireSomme(k);
+ fi;
+ else:
+ TestPremier(Chiffre[k-1]);
+ if PremierChiffre:
+ if Chiffre[k-1]>100:
+ EcrireDifferenceCent(k);
+ else:
+ alea:=ceiling(uniformdeviate(3));
+ if alea=1:
+ EcrireSomme(k);
+ elseif alea=2:
+ EcrireDifference(k);
+ elseif alea=3:
+ EcrireProduit(k);
+ fi;
+ fi;
+ if k=CaseDepart:
+ label(TEX("\Large"&decimal(Chiffre[k])),N[k] shifted(PasQuad*(1,1)));
+ elseif Solution:
+ label(TEX("\Large"&decimal(Chiffre[k])),N[k] shifted(PasQuad*(1,1))) withcolor CoulSolution;
+ fi;
+ else:
+ if Chiffre[k-1]>100:
+ alea:=ceiling(uniformdeviate(2));
+ if alea=1:
+ EcrireDifferenceCent(k);
+ else:
+ EcrireQuotient(k);
+ fi;
+ else:
+ alea:=ceiling(uniformdeviate(4));
+ if alea=1:
+ EcrireSomme(k);
+ elseif alea=2:
+ EcrireDifference(k);
+ elseif alea=3:
+ EcrireProduit(k);
+ elseif alea=4:
+ EcrireQuotient(k);
+ fi;
+ fi;
+ fi;
+ fi;
+ if k=CaseDepart:
+ label(TEX("\Large"&decimal(Chiffre[k])),N[k] shifted(PasQuad*(1,1)));
+ else:
+ if Solution:
+ label(TEX("\Large"&decimal(Chiffre[k])),N[k] shifted(PasQuad*(1,1))) withcolor CoulSolution;
+ fi;
+ fi;
+ endfor;
+ \end{mplibcode}
+ \mplibnumbersystem{scaled}%
+ \fi
+}% \ No newline at end of file
diff --git a/macros/latex/contrib/profcollege/latex/PfCStatistiques.tex b/macros/latex/contrib/profcollege/latex/PfCStatistiques.tex
index b5322f13e2..720186804f 100644
--- a/macros/latex/contrib/profcollege/latex/PfCStatistiques.tex
+++ b/macros/latex/contrib/profcollege/latex/PfCStatistiques.tex
@@ -1803,7 +1803,7 @@ Histogramme=false,UniteAire=1,MemeAmpli,DepartHisto=1%
\foreachitem\don\in\ListeComplete{\xdef\EffectifTotal{\fpeval{\EffectifTotal+\ListeComplete[\doncnt,2]}}}%
L'effectif total de la s\'erie est : \[\ListeComplete[1,2]\xintFor* ##1 in
{\xintSeq {2}{\ListeCompletelen}}\do{%
- +\ListeComplete[##1,2]}=\num{\EffectifTotal}\]}
+ +\ListeComplete[##1,2]}=\num{\EffectifTotal}.\]}
}{}%
\ifboolKV[ClesStat]{Liste}{\xdef\EffectifTotal{\ListeCompletelen}}{\xdef\EffectifTotal{\SommeDonnees}}%
% %% celui de la moyenne
@@ -1833,7 +1833,7 @@ Histogramme=false,UniteAire=1,MemeAmpli,DepartHisto=1%
\opdiv*{\SommeDonnees}{\ListeCompletelen}{resultatmoy}{restemoy}%
\opround{resultatmoy}{\useKV[ClesStat]{Precision}}{resultatmoy1}%
\opcmp{resultatmoy}{resultatmoy1}\ifopeq=\else\approx\fi%
- \num{\fpeval{round(\SommeDonnees/\ListeCompletelen,\useKV[ClesStat]{Precision})}}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}%
+ \num{\fpeval{round(\SommeDonnees/\ListeCompletelen,\useKV[ClesStat]{Precision})}}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}.%
}%
\]%
}{}%
@@ -1885,14 +1885,14 @@ Histogramme=false,UniteAire=1,MemeAmpli,DepartHisto=1%
\xintifboolexpr{\ListeCompletelen<\useKV[ClesStat]{Coupure}}{%
\[\DTLforeach{mtdb}{\numeroDonnee=Numeric}{\num{\numeroDonnee}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}\DTLiflastrow{.}{;}}\]%
}{%
- \medskip%
+ %\medskip%
\begin{center}
\begin{minipage}{0.9\linewidth}
\DTLforeach*{mtdb}{\numeroDonnee=Numeric}{\num{\numeroDonnee}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}\DTLiflastrow{.}{;
}\nbdonnees=\fpeval{\nbdonnees+1}\modulo{\nbdonnees}{\useKV[ClesStat]{Coupure}}\xintifboolexpr{\remainder==0}{\\}{}}
\end{minipage}
\end{center}%
- \medskip%
+ %\medskip%
}%
\newcount\med%
\newcount\meda%
@@ -1994,7 +1994,7 @@ Histogramme=false,UniteAire=1,MemeAmpli,DepartHisto=1%
\ifboolKV[ClesStat]{EffectifTotal}{%
L'effectif total de la s\'erie est : \[\ListeComplete[1,2]\xintFor* ##1 in
{\xintSeq {2}{\ListeCompletelen}}\do{%
- +\ListeComplete[##1,2]}=\num{\EffectifTotal}\]
+ +\ListeComplete[##1,2]}=\num{\EffectifTotal}.\]
}{}%
\ifboolKV[ClesStat]{Moyenne}{%
\ifboolKV[ClesStat]{Somme}{La somme des donn\'ees de la s\'erie est :%
@@ -2018,7 +2018,7 @@ Histogramme=false,UniteAire=1,MemeAmpli,DepartHisto=1%
\ifboolKV[ClesStat]{Liste}{ \num{\EffectifTotal}\\}{%
\[\num{\ListeComplete[1,2]}\xintFor* ##1 in {\xintSeq {2}{\ListeCompletelen}}\do{%
+\num{\ListeComplete[##1,2]}
- }=\num{\EffectifTotal}
+ }=\num{\EffectifTotal}.
\]%
}%
}%
@@ -2028,7 +2028,7 @@ Histogramme=false,UniteAire=1,MemeAmpli,DepartHisto=1%
\opdiv*{\SommeDonnees}{\EffectifTotal}{resultatmoy}{restemoy}%
\opround{resultatmoy}{\useKV[ClesStat]{Precision}}{resultatmoy1}%
\opcmp{resultatmoy}{resultatmoy1}\ifopeq=\else\approx\fi%
- \num{\fpeval{round(\SommeDonnees/\EffectifTotal,\useKV[ClesStat]{Precision})}}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}%
+ \num{\fpeval{round(\SommeDonnees/\EffectifTotal,\useKV[ClesStat]{Precision})}}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}.%
}%
\]%
}{}%
diff --git a/macros/latex/contrib/profcollege/latex/PfCTableauxUnites.tex b/macros/latex/contrib/profcollege/latex/PfCTableauxUnites.tex
index 8e75b05cdd..0c870c5207 100644
--- a/macros/latex/contrib/profcollege/latex/PfCTableauxUnites.tex
+++ b/macros/latex/contrib/profcollege/latex/PfCTableauxUnites.tex
@@ -1,8 +1,9 @@
%%%
% Tableaux d'unit\'es
%%%
-\setKVdefault[ClesTableaux]{Virgule=true,Incline=false,Entiers=false,Decimaux=false,Milliards=false,Millions=false,Micro=false,Nano=false,Partie=false,CouleurG=gray!15,CouleurM=gray!15,Couleurm=gray!15,Couleuru=gray!15,Couleurd=gray!15,Classes=false,Nombres=false,Puissances=false,NbLignes=2,Metre=false,Are=false,Capacite=false,Carre=false,Cube=false,Litre=false,Gramme=false,Fleches=false,FlechesB=false,FlechesH=false,Colonnes=false,Prefixes=false,Escalier=false,Taille=5,Largeur=4.75em,Nom=PfCTableau,CodeAfter={},PuissancesSeules=false,Colonne=-1,Octet=false,CouleurGN=white,CadreGN=black,Tabcolsep=0.275\tabcolsep}
-
+\setKVdefault[ClesTableaux]{Virgule=true,Incline=false,Entiers=false,Decimaux=false,Milliards=false,Millions=false,Micro=false,Nano=false,Partie=false,CouleurG=gray!15,CouleurM=gray!15,Couleurm=gray!15,Couleuru=gray!15,Couleurd=gray!15,Classes=false,Nombres=false,Puissances=false,NbLignes=2,Metre=false,Are=false,Capacite=false,Carre=false,Cube=false,Litre=false,Gramme=false,Fleches=false,FlechesB=false,FlechesH=false,Colonnes=false,Prefixes=false,Escalier=false,Taille=5,Largeur=4.75em,Nom=PfCTableau,CodeAfter={},PuissancesSeules=false,Colonne=-1,Octet=false,CouleurGN=white,CadreGN=black,Tabcolsep=0.275\tabcolsep,Exterieur=false}%
+\defKV[ClesTableaux]{ColonnesSup=\setKV[ClesTableaux]{Exterieur}}%
+%
\newcommand\PfCTBstrut{\rule[-1.2ex]{0pt}{3.8ex}}% Top and Bottom strut
\newcommand\PfCTstrut{\rule{0pt}{3.8ex}}% Top strut
\newcommand\PfCBstrut{\rule[-1.2ex]{0pt}{0ex}}% Bottom strut
@@ -1047,29 +1048,70 @@
%%% Prise en compte de la cl\'e Metre
%
\ifboolKV[ClesTableaux]{Metre}{%
+ \xdef\PfCNbColonnesUnites{7}%
+ \xdef\PfCNbColonnesUnitesSup{0}%
+ \ifboolKV[ClesTableaux]{Exterieur}{%
+ \xdef\PfCNbColonnesUnites{\fpeval{\PfCNbColonnesUnites+2*\useKV[ClesTableaux]{ColonnesSup}}}%
+ \xdef\PfCNbColonnesUnitesSup{\useKV[ClesTableaux]{ColonnesSup}}%
+ }{}%
\[\renewcommand{\arraystretch}{1.15}%
- \begin{NiceTabular}{*{7}{wc{7.5mm}}}%
- \Block[]{}{}
- &\Block[]{}{}
- &\Block[]{}{}
- &\Block[]{}{}
- &\Block[]{}{}
- &\Block[]{}{}
- &\Block[]{}{}\\
- \Block[draw]{}{km\PfCTBstrut}&\Block[draw]{1-1}{hm\PfCTBstrut}&\Block[draw]{1-1}{dam\PfCTBstrut}&\Block[draw]{1-1}{m\PfCTBstrut}&\Block[draw]{1-1}{dm\PfCTBstrut}&\Block[draw]{1-1}{cm\PfCTBstrut}&\Block[draw]{1-1}{mm\PfCTBstrut}\\
- \xintFor* ##1 in {\xintSeq {1}{\useKV[ClesTableaux]{NbLignes}}}\do{%
- &&&&&&\\
+ \begin{NiceTabular}{*{\PfCNbColonnesUnites}{wc{7.5mm}}}%
+ \ifboolKV[ClesTableaux]{Exterieur}{%
+ \xintFor* ##1 in{\xintSeq{1}{\useKV[ClesTableaux]{ColonnesSup}}}\do{%
+ \Block[]{}{}&
+ }}%
+ {}%
+ \Block[]{}{}%
+ &\Block[]{}{}%
+ &\Block[]{}{}%
+ &\Block[]{}{}%
+ &\Block[]{}{}%
+ &\Block[]{}{}%
+ &\Block[]{}{}%
+ \ifboolKV[ClesTableaux]{Exterieur}{%
+ \xintFor* ##1 in{\xintSeq{1}{\useKV[ClesTableaux]{ColonnesSup}}}\do{%
+ &\Block[]{}{}%
}%
- \Block[]{}{}
- &\Block[]{}{}
- &\Block[]{}{}
- &\Block[]{}{}
- &\Block[]{}{}
- &\Block[]{}{}
- &\Block[]{}{}\\
+ }{}\\
+ \ifboolKV[ClesTableaux]{Exterieur}{%
+ \xintFor* ##1 in{\xintSeq{1}{\useKV[ClesTableaux]{ColonnesSup}}}\do{%
+ \Block[]{}{}&
+ }%
+ }{}\Block[draw]{}{km\PfCTBstrut}&\Block[draw]{1-1}{hm\PfCTBstrut}&\Block[draw]{1-1}{dam\PfCTBstrut}&\Block[draw]{1-1}{m\PfCTBstrut}&\Block[draw]{1-1}{dm\PfCTBstrut}&\Block[draw]{1-1}{cm\PfCTBstrut}&\Block[draw]{1-1}{mm\PfCTBstrut}\ifboolKV[ClesTableaux]{Exterieur}{%
+ \xintFor* ##1 in{\xintSeq{1}{\useKV[ClesTableaux]{ColonnesSup}}}\do{%
+ &\Block[]{}{}%
+ }}{}\\
+ \xintFor* ##1 in {\xintSeq {1}{\useKV[ClesTableaux]{NbLignes}}}\do{%
+ \ifboolKV[ClesTableaux]{Exterieur}{%
+ \xintFor* ##2 in{\xintSeq{1}{\useKV[ClesTableaux]{ColonnesSup}}}\do{%
+ \Block[]{}{}&%
+ }}{}&&&&&&\ifboolKV[ClesTableaux]{Exterieur}{%
+ \xintFor* ##2 in{\xintSeq{1}{\useKV[ClesTableaux]{ColonnesSup}}}\do{%
+ &\Block[]{}{}
+ }}{}%
+ \\%
+ }%
+ \ifboolKV[ClesTableaux]{Exterieur}{%
+ \xintFor* ##1 in{\xintSeq{1}{\useKV[ClesTableaux]{ColonnesSup}}}\do{%
+ \Block[]{}{}&
+ }%
+ }{}%
+ \Block[]{}{}%
+ &\Block[]{}{}%
+ &\Block[]{}{}%
+ &\Block[]{}{}%
+ &\Block[]{}{}%
+ &\Block[]{}{}%
+ &\Block[]{}{}%
+ \ifboolKV[ClesTableaux]{Exterieur}{%
+ \xintFor* ##1 in{\xintSeq{1}{\useKV[ClesTableaux]{ColonnesSup}}}\do{%
+ &\Block[]{}{}%
+ }%
+ }{}%
+ \\
\CodeAfter
% on trace les lignes verticales
- \xintFor* ##1 in {\xintSeq{1}{8}}\do{%
+ \xintFor* ##1 in {\xintSeq{\fpeval{1+\PfCNbColonnesUnitesSup}}{\fpeval{8+\PfCNbColonnesUnitesSup}}}\do{%
\tikz\draw (3-|##1)--(\fpeval{3+\useKV[ClesTableaux]{NbLignes}}-|##1);
}%
% On place le nombre éventuel
@@ -1077,7 +1119,7 @@
\else%
\setsepchar[*]{,*/}
\readlist*\ListeNombreAPlacer{#2}%
- \xintFor* ##2 in{\xintSeq {1}{\ListeNombreAPlacerlen}}\do{
+ \xintFor* ##2 in{\xintSeq{1}{\ListeNombreAPlacerlen}}\do{
\StrLen{\ListeNombreAPlacer[##2,1]}[\TabLongueurNombre]%
\xintFor* ##1 in{\xintSeq {1}{\TabLongueurNombre}}\do{%
\tikz\node at (\fpeval{##2+2.5}-|\fpeval{\ListeNombreAPlacer[##2,2]-0.5+##1}) {\PfCTBstrut\StrMid{\ListeNombreAPlacer[##2,1]}{##1}{##1}};
@@ -1087,12 +1129,12 @@
% on trace les flèches
\ifboolKV[ClesTableaux]{Fleches}{\setKV[ClesTableaux]{FlechesH,FlechesB}}{}%
\ifboolKV[ClesTableaux]{FlechesH}{%
- \xintFor* ##1 in {\xintSeq{1}{6}}\do{%
+ \xintFor* ##1 in {\xintSeq{\fpeval{1+\PfCNbColonnesUnitesSup}}{\fpeval{6+\PfCNbColonnesUnitesSup}}}\do{%
\tikz\draw[gray,->,>=latex,out=30,in=150] (1.5-|\fpeval{0.5+##1}) to node[above, midway]{\small$\times\num{10}$}(1.5-|\fpeval{1.5+##1});%
}%
}{}%
\ifboolKV[ClesTableaux]{FlechesB}{%
- \xintFor* ##1 in {\xintSeq{1}{6}}\do{%
+ \xintFor* ##1 in {\xintSeq{\fpeval{1+\PfCNbColonnesUnitesSup}}{\fpeval{6+\PfCNbColonnesUnitesSup}}}\do{%
\tikz\draw[gray,->,>=latex,out=-150,in=-30] (\fpeval{3+\useKV[ClesTableaux]{NbLignes}+0.5}-|\fpeval{1.5+##1}) to node[below,midway]{\small$\div\num{10}$}(\fpeval{3+\useKV[ClesTableaux]{NbLignes}+0.5}-|\fpeval{0.5+##1});%
}%
}{}%
diff --git a/macros/latex/contrib/profcollege/latex/ProfCollege.sty b/macros/latex/contrib/profcollege/latex/ProfCollege.sty
index a179a3e281..cee8d5c58b 100644
--- a/macros/latex/contrib/profcollege/latex/ProfCollege.sty
+++ b/macros/latex/contrib/profcollege/latex/ProfCollege.sty
@@ -2,9 +2,9 @@
% licence : Released under the LaTeX Project Public License v1.3c
% or later, see http://www.latex-project.org/lppl.txtf
\NeedsTeXFormat{LaTeX2e}%
-\def\filedate{2023/09/06}%
+\def\filedate{2023/10/08}%
\let\PfCfiledate\filedate%
-\def\fileversion{0.99-z-t}%
+\def\fileversion{0.99-z-u}%
\let\PfCfileversion\fileversion%
\ProvidesPackage{ProfCollege}[\filedate\space v\fileversion\space Aide pour utiliser LaTeX au college]%
@@ -599,6 +599,15 @@
}%\emoticon
}%\raisebox
}%
+\input{PfCDessinAlgo}
+\input{PfCBonbon}
+\input{PfCPattern}
+\input{PfCNumerationsAnciennes}
+\input{PfCSerpent}
+\input{PfCFractionNombre}
+\input{PfCAllumettes}
+\input{PfCFractionAireCarre.tex}
+\input{PfCMulJal}
\input{PfCCibleQOp}
\input{PfCFubuki}
\input{PfCMulJap}
diff --git a/macros/latex/contrib/profcollege/metapost/PfCAllumettes.mp b/macros/latex/contrib/profcollege/metapost/PfCAllumettes.mp
new file mode 100644
index 0000000000..3ce248b99f
--- /dev/null
+++ b/macros/latex/contrib/profcollege/metapost/PfCAllumettes.mp
@@ -0,0 +1,77 @@
+numeric longallu,epallu;
+longallu=41.5mm;
+epallu=2mm;
+ecartpoint=epallu-0.1mm;
+
+color BurlyWood,PfCSoufre;
+BurlyWood=(222,184,135)/256;
+PfCSoufre=red;
+
+vardef Allu(expr dep,arr)=
+ save Retour;
+ picture Retour;
+ Retour=image(
+ pair depa,arra;
+ depa=dep+ecartpoint*unitvector(arr-dep);
+ arra=arr+ecartpoint*unitvector(dep-arr);
+ pair corps[];
+ corps[1]-depa=0.5*epallu*unitvector(rotation(arr,dep,-90)-dep);
+ corps[4]=symetrie(corps[1],dep,arr);
+ corps2=corps1+0.975*(arra-depa);
+ corps3-corps2=corps4-corps1;
+ path Corps;
+ Corps=polygone(corps1,corps2,corps3,corps4);
+ fill Corps withcolor if print: white else:BurlyWood fi;
+ trace Corps withcolor 0.5[black,if print: white else:BurlyWood fi];
+ pair cera,cerb,cerc;
+ cera=pointarc(cercles((0,0),1.5epallu),125);
+ cerb=pointarc(cercles((0,0),1.5epallu),235);
+ cerc=pointarc(cercles((0,0),1.5epallu),0);
+ path bout;
+ bout=arccercle(cerb,cerc,(0,0))--arccercle(cerc,cera,(0,0))--cycle;
+ fill (rotation(bout yscaled 0.385 xscaled 0.8,(0,0),angle(arra-depa)) shifted (arra+1.0*ecartpoint*unitvector(dep-arr))) withcolor if print:0.7white else: PfCSoufre fi;
+ draw (rotation(bout yscaled 0.385 xscaled 0.8,(0,0),angle(arra-depa)) shifted (arra+1.0*ecartpoint*unitvector(dep-arr))) withcolor 0.5[black,if print: 0.7white else: PfCSoufre fi];
+ );
+ Retour
+enddef;
+
+vardef OldAllu(expr dep,arr)=
+ save Retour;
+ picture Retour;
+ Retour=image(
+ pair depa,arra;
+ depa=dep+ecartpoint*unitvector(arr-dep);
+ arra=arr+ecartpoint*unitvector(dep-arr);
+ pair corps[];
+ corps[1]-depa=0.5*epallu*unitvector(rotation(arr,dep,-90)-dep);
+ corps[4]=symetrie(corps[1],dep,arr);
+ corps2=corps1+0.975*(arra-depa);
+ corps3-corps2=corps4-corps1;
+ path Corps;
+ Corps=polygone(corps1,corps2,corps3,corps4);
+% fill Corps withcolor if print: white else:BurlyWood fi;
+% trace Corps withcolor 0.5[black,if print: white else:BurlyWood fi] dashed evenly;
+ trace Corps dashed evenly;
+ pair cera,cerb,cerc;
+ cera=pointarc(cercles((0,0),1.5epallu),125);
+ cerb=pointarc(cercles((0,0),1.5epallu),235);
+ cerc=pointarc(cercles((0,0),1.5epallu),0);
+ path bout;
+ bout=arccercle(cerb,cerc,(0,0))--arccercle(cerc,cera,(0,0))--cycle;
+ fill (rotation(bout yscaled 0.385 xscaled 0.8,(0,0),angle(arra-depa)) shifted (arra+0.75*ecartpoint*unitvector(dep-arr))) withcolor white;
+ draw (rotation(bout yscaled 0.385 xscaled 0.8,(0,0),angle(arra-depa)) shifted (arra+0.75*ecartpoint*unitvector(dep-arr)));% withcolor 0.5[black,if print: 0.7white else: PfCSoufre fi];
+ );
+ Retour
+enddef;
+
+u:=longallu+epallu;
+
+vardef DefinirUnite(expr pfcechelle)=
+ longallu:=longallu*pfcechelle;
+ epallu:=epallu*pfcechelle;
+ ecartpoint:=ecartpoint*pfcechelle;
+ u:=longallu+epallu;
+enddef;
+
+endinput;
+