From 4f1cabae3381cd17b21ca6e7c89156edd09e23d5 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 1 Aug 2023 20:06:20 +0000 Subject: profcollege (1aug23) git-svn-id: svn://tug.org/texlive/trunk@67787 c570f23f-e606-0410-a88d-b1316a301751 --- .../doc/latex/profcollege/PfCLogoNumberHive.png | Bin 0 -> 54466 bytes .../doc/latex/profcollege/ProfCollege-doc.pdf | Bin 9328578 -> 9123899 bytes .../doc/latex/profcollege/ProfCollege-doc.zip | Bin 2360197 -> 2248866 bytes .../metapost/profcollege/PfCCalculatrice.mp | 10 +- .../metapost/profcollege/PfCLabyNombre.mp | 42 ++- .../texmf-dist/metapost/profcollege/PfCObjets.mp | 2 +- Master/texmf-dist/metapost/profcollege/PfCSolid.mp | 11 +- .../tex/latex/profcollege/PfCCalculatrice.tex | 17 +- .../tex/latex/profcollege/PfCCalculsFractions.tex | 8 +- .../tex/latex/profcollege/PfCCartesJeux.tex | 41 ++- .../texmf-dist/tex/latex/profcollege/PfCCible.tex | 225 +++++++++++++++ .../tex/latex/profcollege/PfCCompteBon.tex | 10 +- .../profcollege/PfCDecomposerNombrePremier.tex | 12 +- .../tex/latex/profcollege/PfCDistributivite.tex | 10 +- .../texmf-dist/tex/latex/profcollege/PfCDobble.tex | 2 +- .../tex/latex/profcollege/PfCEcritureLettres.tex | 3 - .../tex/latex/profcollege/PfCGrimuku.tex | 222 +++++++++++++++ .../tex/latex/profcollege/PfCHorloge.tex | 215 ++++++++++++++ .../tex/latex/profcollege/PfCLabyrintheNombre.tex | 203 +++++++++++++- .../tex/latex/profcollege/PfCMulPiecesPuzzle.tex | 151 ++++++++++ .../tex/latex/profcollege/PfCNonogramme.tex | 12 +- .../tex/latex/profcollege/PfCNotionFonction.tex | 308 +++++++++++++++------ .../tex/latex/profcollege/PfCOperationsTrou.tex | 11 + .../tex/latex/profcollege/PfCPourcentage.tex | 4 +- .../tex/latex/profcollege/PfCPyraVoca.tex | 28 ++ .../tex/latex/profcollege/PfCReperage.tex | 171 +++++++++++- .../latex/profcollege/PfCRepresenterTableur.tex | 10 +- .../tex/latex/profcollege/PfCRondeInfernale.tex | 18 +- .../texmf-dist/tex/latex/profcollege/PfCRose.tex | 284 ++++++++++++++++++- .../tex/latex/profcollege/PfCSolides.tex | 12 +- .../tex/latex/profcollege/PfCStatistiques.tex | 20 +- .../tex/latex/profcollege/PfCTableauxUnites.tex | 86 +++--- .../tex/latex/profcollege/PfCVueCubes.tex | 6 +- .../texmf-dist/tex/latex/profcollege/PfCdobble.lua | 82 ++++++ .../tex/latex/profcollege/ProfCollege.sty | 17 +- .../texmf-dist/tex/latex/profcollege/dobblePfC.lua | 82 ------ 36 files changed, 2028 insertions(+), 307 deletions(-) create mode 100644 Master/texmf-dist/doc/latex/profcollege/PfCLogoNumberHive.png create mode 100644 Master/texmf-dist/tex/latex/profcollege/PfCCible.tex create mode 100644 Master/texmf-dist/tex/latex/profcollege/PfCGrimuku.tex create mode 100644 Master/texmf-dist/tex/latex/profcollege/PfCHorloge.tex create mode 100644 Master/texmf-dist/tex/latex/profcollege/PfCMulPiecesPuzzle.tex create mode 100644 Master/texmf-dist/tex/latex/profcollege/PfCPyraVoca.tex create mode 100644 Master/texmf-dist/tex/latex/profcollege/PfCdobble.lua delete mode 100644 Master/texmf-dist/tex/latex/profcollege/dobblePfC.lua (limited to 'Master') diff --git a/Master/texmf-dist/doc/latex/profcollege/PfCLogoNumberHive.png b/Master/texmf-dist/doc/latex/profcollege/PfCLogoNumberHive.png new file mode 100644 index 00000000000..0ea42679319 Binary files /dev/null and b/Master/texmf-dist/doc/latex/profcollege/PfCLogoNumberHive.png differ diff --git a/Master/texmf-dist/doc/latex/profcollege/ProfCollege-doc.pdf b/Master/texmf-dist/doc/latex/profcollege/ProfCollege-doc.pdf index 08d43af5fa7..fe2337ad5b9 100644 Binary files a/Master/texmf-dist/doc/latex/profcollege/ProfCollege-doc.pdf and b/Master/texmf-dist/doc/latex/profcollege/ProfCollege-doc.pdf differ diff --git a/Master/texmf-dist/doc/latex/profcollege/ProfCollege-doc.zip b/Master/texmf-dist/doc/latex/profcollege/ProfCollege-doc.zip index d5aec00be8a..ff57a4e879f 100644 Binary files a/Master/texmf-dist/doc/latex/profcollege/ProfCollege-doc.zip and b/Master/texmf-dist/doc/latex/profcollege/ProfCollege-doc.zip differ diff --git a/Master/texmf-dist/metapost/profcollege/PfCCalculatrice.mp b/Master/texmf-dist/metapost/profcollege/PfCCalculatrice.mp index 406f7205940..633b3ab6a74 100644 --- a/Master/texmf-dist/metapost/profcollege/PfCCalculatrice.mp +++ b/Master/texmf-dist/metapost/profcollege/PfCCalculatrice.mp @@ -38,7 +38,7 @@ Math=true; decahoriz:=0; -vardef Test(expr cptk,cptnt)= +vardef Test(expr cptk)(text cptnt)= pair Decalage; if nblignes mod 2=0: Decalage:=u*((LargeurEcran,-8*(nblignes-1))-6*(length(cptnt)-cptk,0)); @@ -192,9 +192,17 @@ vardef LCD(text nt)(text rep)(expr NB)= Ecran:=(u*(0,-1)--u*(LargeurEcran,-1)--u*(LargeurEcran,7)--u*(0,7)--cycle) shifted(u*(0,-8*(nblignes-1))); fill Ecran withcolor if print=true:0.8white else:CouleurEcran fi; draw Ecran withcolor if print=true:0.8white else:CouleurEcran fi; + if Calcul: + string toto; + toto=decimal(rep); + for k=0 upto length(toto)-1: + Test(k,toto); + endfor; + else: for k=0 upto length(rep)-1: Test(k,rep); endfor; + fi; enddef; endinput; diff --git a/Master/texmf-dist/metapost/profcollege/PfCLabyNombre.mp b/Master/texmf-dist/metapost/profcollege/PfCLabyNombre.mp index 1ef8c396074..18a4e97931d 100644 --- a/Master/texmf-dist/metapost/profcollege/PfCLabyNombre.mp +++ b/Master/texmf-dist/metapost/profcollege/PfCLabyNombre.mp @@ -193,7 +193,47 @@ vardef TraceLabyrinthe= fi; ); $ -enddef; +enddef; + +vardef InitialisationLabyrintheMul(expr long,larg)= + LargeurLaby:=larg; + LongueurLaby:=long; + uh=2u; + uv=2u; + pair M[][],N[][];%centre de la case, coinbg de la case + boolean CaseExploree[][];%Case Exploree ou pas + %on initialise les cases comme non explorées pour celles qui sont à l'intérieur du labyrinthe + for k=-1 upto larg: + for l=-1 upto long: + M[k][l]:=(5mm,-uv+5mm)+(l*uh,-k*uv); + N[k][l]:=(l*uh,(-k-1)*uv); + if (k=-1) or (k=larg) or (l=-1) or (l=long): + CaseExploree[k][l]:=true; + else: + CaseExploree[k][l]:=false; + fi; + endfor; + endfor; +enddef; + +vardef TraceLabyrintheMul= + save $; + picture $; + $=image( + n:=0; + for k=0 upto LargeurLaby-1: + for l=0 upto LongueurLaby-1: + n:=n+1; + if (n mod 2)=1: + draw (Fullcircle scaled 10mm) shifted N[k][l]; + else: + draw (unitsquare scaled 10mm) shifted N[k][l]; + fi; + endfor; + endfor; + ); + $ +enddef; vardef murgauche= save $; diff --git a/Master/texmf-dist/metapost/profcollege/PfCObjets.mp b/Master/texmf-dist/metapost/profcollege/PfCObjets.mp index 6998c54e268..0fe551dc9c1 100644 --- a/Master/texmf-dist/metapost/profcollege/PfCObjets.mp +++ b/Master/texmf-dist/metapost/profcollege/PfCObjets.mp @@ -18,7 +18,7 @@ boolean creux; creux=false;%pour g boolean transformation; transformation=false;%pour gérer les transformations boolean Ferme[];%pour gérer les faces : si le solide est fermé, toutes les faces non vues ne sont pas intégrées aux calculs boolean perso[];%pour gérer les gestions personnelles des couleurs -for k=0 upto 100: +for k=0 upto 1000: perso[k]=false; endfor; boolean numeroteface; diff --git a/Master/texmf-dist/metapost/profcollege/PfCSolid.mp b/Master/texmf-dist/metapost/profcollege/PfCSolid.mp index b5f90b3ae43..765533109d0 100644 --- a/Master/texmf-dist/metapost/profcollege/PfCSolid.mp +++ b/Master/texmf-dist/metapost/profcollege/PfCSolid.mp @@ -121,12 +121,13 @@ vardef Projette(expr M)= elseif typerepre="cabinet": % (0.5*cosd(30)*Xpart(GCoord(M)),0.75*sind(30)*Ypart(GCoord(M)))*unit*DE % (Xpart(M)+0.5*cosd(30)*Zpart(M),Ypart(M)+0.5*sind(30)*Zpart(M))*20 - %(Xpart(M)+0.5*cosd(30)*Ypart(M),Zpart(M)+0.5*sind(30)*Ypart(M))*20 - %(Ypart(M)+0.5*cosd(30)*Xpart(M),Zpart(M)+0.5*sind(30)*Xpart(M))*20%Good avec Theta=-20/Phi=-10 +% (Xpart(M)+0.5*cosd(30)*Ypart(M),Zpart(M)+0.5*sind(30)*Ypart(M))*20 +% (Ypart(M)+0.5*cosd(30)*Xpart(M),Zpart(M)+0.5*sind(30)*Xpart(M))*20%Good avec Theta=-20/Phi=-10 %(Ypart(GCoord(M))+0.5*cosd(-30)*Xpart(GCoord(M)),Zpart(GCoord(M))+0.5*sind(-30)*Xpart(GCoord(M)))*20%Good avec Theta=-20/Phi=-10 - (Xpart(GCoord(M))*cosd(90-30),Ypart(GCoord(M))*sind(90-30)*0.5)*DE%à garder peut-être -% (Zpart(GCoord(M))+0.5*cosd(-30)*Ypart(GCoord(M)),Xpart(GCoord(M))+0.5*sind(-30)*Ypart(GCoord(M)))*20 - % (0.5*cosd(45)*Xpart(GCoord(M)),0.5*sind(45)*Ypart(GCoord(M)))*unit*DE +% (Xpart(GCoord(M))*cosd(90-30),Ypart(GCoord(M))*sind(90-30)*0.5)*DE%à garder peut-être ? + (Xpart(GCoordcabinet(M)),Ypart(GCoordcabinet(M)))*DE% + %(Zpart(GCoord(M))+0.5*cosd(-30)*Ypart(GCoord(M)),Xpart(GCoord(M))+0.5*sind(-30)*Ypart(GCoord(M)))*20 +% (0.5*cosd(45)*Xpart(GCoord(M)),0.5*sind(45)*Ypart(GCoord(M)))*unit*DE % (Xpart(GCoord(M)),Ypart(GCoord(M)))*unit*DE %(Xpart(GCoord(M)),Ypart(GCoord(M)))*10 fi diff --git a/Master/texmf-dist/tex/latex/profcollege/PfCCalculatrice.tex b/Master/texmf-dist/tex/latex/profcollege/PfCCalculatrice.tex index b6d70fe28e0..79ffe0f582c 100644 --- a/Master/texmf-dist/tex/latex/profcollege/PfCCalculatrice.tex +++ b/Master/texmf-dist/tex/latex/profcollege/PfCCalculatrice.tex @@ -110,10 +110,13 @@ \def\MPCalculatrice#1#2#3{ % #1 Calcul %2 r\'eponse \ifluatex + \mplibnumbersystem{double} \mplibforcehmode% \begin{mplibcode}% input PfCCalculatrice; LargeurEcran:=\useKV[ClesCalculatrice]{Largeur}; + boolean Calcul; + Calcul=\useKV[ClesCalculatrice]{Calcul}; LCD(#1)(#2)(#3); \end{mplibcode} \else @@ -123,15 +126,23 @@ \fi } -\setKVdefault[ClesCalculatrice]{Ecran=false,NbLignes=0,BL=0.775,Largeur=120} +\setKVdefault[ClesCalculatrice]{Ecran=false,NbLignes=0,BL=0.775,Largeur=120,Calcul=false} + +\newtoks\toklistenombrecalculatrice +\def\UpdatetoksCalculatrice#1\nil{\addtotok\toklistenombrecalculatrice{"\fpeval{#1}"}} \newcommand\Calculatrice[2][]{% \setstackgap{L}{\useKV[ClesCalculatrice]{BL}\baselineskip}% \useKVdefault[ClesCalculatrice]% \setKV[ClesCalculatrice]{#1}% \ifboolKV[ClesCalculatrice]{Ecran}{% - \setsepchar[*]{,*/}% - \readlist\ListeCalc{#2}% + \ifboolKV[ClesCalculatrice]{Calcul}{% + \setsepchar[*]{,*§}% + \readlist\ListeCalc{#2}% + }{% + \setsepchar[*]{,*/}% + \readlist\ListeCalc{#2}% + }% \MPCalculatrice{\ListeCalc[1,1]}{\ListeCalc[1,2]}{\useKV[ClesCalculatrice]{NbLignes}}% }{% \setsepchar[*]{,*/}% diff --git a/Master/texmf-dist/tex/latex/profcollege/PfCCalculsFractions.tex b/Master/texmf-dist/tex/latex/profcollege/PfCCalculsFractions.tex index 94e3a8d1201..2e6ff56149c 100644 --- a/Master/texmf-dist/tex/latex/profcollege/PfCCalculsFractions.tex +++ b/Master/texmf-dist/tex/latex/profcollege/PfCCalculsFractions.tex @@ -1,4 +1,5 @@ -\setKVdefault[CalculsFractions]{Couleur=Crimson} +\setKVdefault[CalculsFractions]{Couleurs=false} +\defKV[CalculsFractions]{Couleur=\setKV[CalculsFractions]{Couleurs}} \NewDocumentCommand\tofrac{m}{% \IfDecimal{#1}{#1}{% @@ -11,6 +12,7 @@ \NewDocumentCommand\AddFraction{soommo}{% \useKVdefault[CalculsFractions]% \setKV[CalculsFractions]{#2}% + \ifboolKV[CalculsFractions]{Couleurs}{\colorlet{CouleurDenoCom}{\useKV[CalculsFractions]{Couleur}}}{\colorlet{CouleurDenoCom}{black}}% \IfBooleanTF{#1}{% \xdef\PfCFractionOp{-}% }{% @@ -55,13 +57,13 @@ \else% \ifnum#3=1\relax% \ifnum\PfCPremierMul>1\relax% - \frac{\ListeFractions[1,1]_{\times\num{\PfCPremierMul}}}{\ListeFractions[1,2]_{\times\num{\PfCPremierMul}}} + \frac{\ListeFractions[1,1]_{\mathcolor{CouleurDenoCom}{\times\num{\PfCPremierMul}}}}{\ListeFractions[1,2]_{\mathcolor{CouleurDenoCom}{\times\num{\PfCPremierMul}}}} \else% \tofrac{#4}% \fi% \PfCFractionOp% \ifnum\PfCDeuxiemeMul>1\relax% - \frac{\ListeFractions[2,1]_{\times\num{\PfCDeuxiemeMul}}}{\ListeFractions[2,2]_{\times\num{\PfCDeuxiemeMul}}}% + \frac{\ListeFractions[2,1]_{\mathcolor{CouleurDenoCom}{\times\num{\PfCDeuxiemeMul}}}}{\ListeFractions[2,2]_{\mathcolor{CouleurDenoCom}{\times\num{\PfCDeuxiemeMul}}}}% \else% \tofrac{#5}% \fi% diff --git a/Master/texmf-dist/tex/latex/profcollege/PfCCartesJeux.tex b/Master/texmf-dist/tex/latex/profcollege/PfCCartesJeux.tex index 16a60d4a462..2871666b403 100644 --- a/Master/texmf-dist/tex/latex/profcollege/PfCCartesJeux.tex +++ b/Master/texmf-dist/tex/latex/profcollege/PfCCartesJeux.tex @@ -4,10 +4,17 @@ \setKVdefault[Cards]{Largeur=59,Hauteur=89,HauteurTheme=15,Marge=4,Landscape=false,Couleur=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 - NbCartes=16,TypeJeu=Boucle,Niveau=1,Numero=1,ThemeJeu=Nombres relatifs,CouleurTheme=black,CouleurNiveau=black,CouleurType=black,CouleurNb=black, + ANbCartes=false,ATypeJeu=false,ANiveau=false,ANumero=false,AThemeJeu=false,CouleurTheme=black,CouleurNiveau=black,CouleurType=black,CouleurNb=black, % Pour le trivial Trivial=false,Symboles={\faInfinity,\faSignal,\faProjectDiagram,\faHiking,\faRuler,\faLockOpen} }% +% Pour moduler l'affichage de textes sur la boite. +\defKV[Cards]{NbCartes=\setKV[Cards]{ANbCartes}}% +\defKV[Cards]{TypeJeu=\setKV[Cards]{ATypeJeu}}% +\defKV[Cards]{Niveau=\setKV[Cards]{ANiveau}}% +\defKV[Cards]{Numero=\setKV[Cards]{ANumero}}% +\defKV[Cards]{ThemeJeu=\setKV[Cards]{AThemeJeu}}% +% \defKV[Cards]{ThemeJaiQuiA=\setKV[Cards]{AfficheTheme}}% % \newtcolorbox{Mybox}[3]{% @@ -586,7 +593,7 @@ \def\BuildBoiteCartesCCCode{% Longueur=10cm; Largeur=7cm; - Epaisseur=\useKV[Cards]{NbCartes}*1mm; + Epaisseur=if \useKV[Cards]{ANbCartes}:\useKV[Cards]{NbCartes}*1mm else: 16mm fi; pair A[],B[],C[],D[]; A0=(0,0); A1-A0=Epaisseur*(1,0); @@ -644,6 +651,8 @@ \mplibforcehmode \begin{mplibcode} \BuildBoiteCartesCCCode; + boolean AThemeJeu; + AThemeJeu=\useKV[Cards]{AThemeJeu}; % trace chemin(A11,A12,A13,A0); trace chemin(D9,A11,A0,1/3[A1,A2]); @@ -688,15 +697,31 @@ trace polygone(D18,D17,D20,D19); trace chemin(1/3[D18,D17],D18,D19,D20,D17,2/3[D18,D17]); % label - drawoptions(withcolor \useKV[Cards]{CouleurTheme}); - label(btex \bfseries\Large\useKV[Cards]{ThemeJeu} etex,M2); + if AThemeJeu: +% drawoptions(withcolor \useKV[Cards]{CouleurTheme}); + label(TEX("\bfseries\Large\useKV[Cards]{ThemeJeu}"),M2); + drawoptions(); + fi; + if \useKV[Cards]{ANiveau}: + drawoptions(withcolor \useKV[Cards]{CouleurNiveau}); + label(TEX("\bfseries Niveau \useKV[Cards]{Niveau}"),M3); + drawoptions(); + fi; + if \useKV[Cards]{ANumero}: drawoptions(withcolor \useKV[Cards]{CouleurNiveau}); - label(btex \bfseries Niveau \useKV[Cards]{Niveau} etex,M3); - label(btex \bfseries Jeu \useKV[Cards]{Numero} etex,M4); + label(TEX("\bfseries Jeu \useKV[Cards]{Numero}"),M4); + drawoptions(); + fi; + if \useKV[Cards]{ANbCartes}: drawoptions(withcolor \useKV[Cards]{CouleurNb}); - label(btex \bfseries\useKV[Cards]{NbCartes} cartes etex,M5); + label(TEX("\bfseries\useKV[Cards]{NbCartes} cartes"),M5); + drawoptions(); + fi; + if \useKV[Cards]{ATypeJeu}: drawoptions(withcolor \useKV[Cards]{CouleurType}); - label(btex \bfseries\Huge\useKV[Cards]{TypeJeu} etex,M1); + label(TEX("\bfseries\Huge\useKV[Cards]{TypeJeu}"),M1); + drawoptions(); + fi; \end{mplibcode} \else \begin{mpost}[mpsettings={\BuildBoiteCartesCCCode;}] diff --git a/Master/texmf-dist/tex/latex/profcollege/PfCCible.tex b/Master/texmf-dist/tex/latex/profcollege/PfCCible.tex new file mode 100644 index 00000000000..f59ec3d5938 --- /dev/null +++ b/Master/texmf-dist/tex/latex/profcollege/PfCCible.tex @@ -0,0 +1,225 @@ +%%% +% Cibles +%%% +\newtoks\toklisteciblea% + +\def\UpdatetoksCibleA#1\nil{\addtotok\toklisteciblea{"#1",}}% + +\setKVdefault[Cible]{RayonBase=5mm,Ecart=5mm,Flechettes=false,RayonF=2.5cm,Impression=false}% + +\NewDocumentCommand\Cible{om}{% + \useKVdefault[Cible]% + \setKV[Cible]{#1}% + \toklisteciblea{}% + \xdef\PfCNombreZone{0}% + \ifboolKV[Cible]{Flechettes}{}{% + \setsepchar{,}% + \readlist*\PfCListeCible{#2}% + \foreachitem\compteur\in\PfCListeCible{\expandafter\UpdatetoksCibleA\compteur\nil}% + \xdef\PfCNombreZone{\PfCListeCiblelen}% + }% + \BuildCible{\the\toklisteciblea}% +}% + +\NewDocumentCommand\BuildCible{m}{% + \ifluatex% + \mplibforcehmode% + \begin{mplibcode} + Rayon=\useKV[Cible]{RayonBase}; + Ecart=\useKV[Cible]{Ecart}; + boolean Flechettes,Impression; + Flechettes=\useKV[Cible]{Flechettes}; + Impression=\useKV[Cible]{Impression}; + NombreCercles=\PfCNombreZone; + + vardef affichage(text t)= + pair O; + O=u*(5,5); + for k=NombreCercles downto 1: + if (k mod 2)=0: + fill cercles(O,Rayon+(k-1)*Ecart) withcolor 0.7white; + else: + fill cercles(O,Rayon+(k-1)*Ecart) withcolor white; + fi; + endfor; + for k=1 upto NombreCercles: + trace cercles(O,Rayon+(k-1)*Ecart); + endfor; + n:=0; + for p_=t: + n:=n+1; + if n=NombreCercles: + label(TEX(p_),O); + else: + label(TEX(p_),O+(NombreCercles+0.5-n)*(0,Ecart)); + label(TEX(p_),O-(NombreCercles+0.5-n)*(0,Ecart)); + fi; + endfor; + enddef; + + vardef affichageflechettes= + pair O; + O=u*(5,5); + RayonBase=\useKV[Cible]{RayonF}; + RayonA=(170/(0.5*451))*RayonBase; + RayonI=0.5*(RayonBase+RayonA); + RayonAa=(162/(0.5*451))*RayonBase; + RayonB=(107/(0.5*451))*RayonBase; + RayonBb=(99/(0.5*451))*RayonBase; + RayonC=(32/(0.5*451))*RayonBase; + RayonD=(12.7/(0.5*451))*RayonBase; + path cbase,ca,caa,cb,cbb,cc,cd; + cbase=cercles(O,RayonBase); + ca=cercles(O,RayonA); + caa=cercles(O,RayonAa); + cb=cercles(O,RayonB); + cbb=cercles(O,RayonBb); + cc=cercles(O,RayonC); + cd=cercles(O,RayonD); + fill cbase; + pair A[],Aa[],B[],Bb[],C[],D[],E[]; + for k=1 upto 21: + A[k]=pointarc(ca,9+(k-1)*18); + Aa[k]=pointarc(caa,9+(k-1)*18); + B[k]=pointarc(cb,9+(k-1)*18); + Bb[k]=pointarc(cbb,9+(k-1)*18); + C[k]=pointarc(cc,9+(k-1)*18); + D[k]=pointarc(cd,9+(k-1)*18); + E[k]=pointarc(cercles(O,RayonI),(k-1)*18); + endfor; + for k=2 step 2 until 20: + fill O--A[k]--arccercle(A[k],A[k+1],O)--cycle withcolor white; + endfor; + for k=1 upto 20: + if (k mod 2)=1: + fill Aa[k]--A[k]--arccercle(A[k],A[k+1],O)--reverse(arccercle(Aa[k],Aa[k+1],O))--cycle withcolor if Impression:0.4white else: Crimson fi; + fill Bb[k]--B[k]--arccercle(B[k],B[k+1],O)--reverse(arccercle(Bb[k],Bb[k+1],O))--cycle withcolor if Impression:0.4white else: Crimson fi; + else: + fill Aa[k]--A[k]--arccercle(A[k],A[k+1],O)--reverse(arccercle(Aa[k],Aa[k+1],O))--cycle withcolor if Impression:0.8white else: LightGreen fi; + fill Bb[k]--B[k]--arccercle(B[k],B[k+1],O)--reverse(arccercle(Bb[k],Bb[k+1],O))--cycle withcolor if Impression:0.8white else: LightGreen fi; + fi; + endfor; + fill cc withcolor if Impression:0.8white else: LightGreen fi; + fill cd withcolor if Impression:0.4white else: Crimson fi; + trace ca withcolor white; + trace caa withcolor white; + trace cb withcolor white; + trace cbb withcolor white; + trace cc withcolor white; + trace cd withcolor white; + enddef; + + vardef affichagetexteflechettes(text t)= + drawoptions(withcolor white); + n:=0; + for p_=t: + n:=n+1; + label(TEX("\bfseries "&p_),E[n]); + endfor; + enddef; + + if Flechettes: + affichageflechettes; + affichagetexteflechettes("6","13","4","18","1","20","5","12","9","14","11","8","16","7","19","3","17","2","15","10"); + else: + affichage(#1); + fi; + \end{mplibcode} + \else + \begin{mpost}[mpsettings={Rayon=\useKV[Cible]{RayonBase};Ecart=\useKV[Cible]{Ecart};boolean Flechettes,Impression;Flechettes=\useKV[Cible]{Flechettes};Impression=\useKV[Cible]{Impression};NombreCercles=\PfCNombreZone;}] + + vardef affichage(text t)= + pair O; + O=u*(5,5); + for k=NombreCercles downto 1: + if (k mod 2)=0: + fill cercles(O,Rayon+(k-1)*Ecart) withcolor 0.7white; + else: + fill cercles(O,Rayon+(k-1)*Ecart) withcolor white; + fi; + endfor; + for k=1 upto NombreCercles: + trace cercles(O,Rayon+(k-1)*Ecart); + endfor; + n:=0; + for p_=t: + n:=n+1; + if n=NombreCercles: + label(LATEX(p_),O); + else: + label(LATEX(p_),O+(NombreCercles+0.5-n)*(0,Ecart)); + label(LATEX(p_),O-(NombreCercles+0.5-n)*(0,Ecart)); + fi; + endfor; + enddef; + + vardef affichageflechettes= + pair O; + O=u*(5,5); + RayonBase=\useKV[Cible]{RayonF}; + RayonA=(170/(0.5*451))*RayonBase; + RayonI=0.5*(RayonBase+RayonA); + RayonAa=(162/(0.5*451))*RayonBase; + RayonB=(107/(0.5*451))*RayonBase; + RayonBb=(99/(0.5*451))*RayonBase; + RayonC=(32/(0.5*451))*RayonBase; + RayonD=(12.7/(0.5*451))*RayonBase; + path cbase,ca,caa,cb,cbb,cc,cd; + cbase=cercles(O,RayonBase); + ca=cercles(O,RayonA); + caa=cercles(O,RayonAa); + cb=cercles(O,RayonB); + cbb=cercles(O,RayonBb); + cc=cercles(O,RayonC); + cd=cercles(O,RayonD); + fill cbase; + pair A[],Aa[],B[],Bb[],C[],D[],E[]; + for k=1 upto 21: + A[k]=pointarc(ca,9+(k-1)*18); + Aa[k]=pointarc(caa,9+(k-1)*18); + B[k]=pointarc(cb,9+(k-1)*18); + Bb[k]=pointarc(cbb,9+(k-1)*18); + C[k]=pointarc(cc,9+(k-1)*18); + D[k]=pointarc(cd,9+(k-1)*18); + E[k]=pointarc(cercles(O,RayonI),(k-1)*18); + endfor; + for k=2 step 2 until 20: + fill O--A[k]--arccercle(A[k],A[k+1],O)--cycle withcolor white; + endfor; + for k=1 upto 20: + if (k mod 2)=1: + fill Aa[k]--A[k]--arccercle(A[k],A[k+1],O)--reverse(arccercle(Aa[k],Aa[k+1],O))--cycle withcolor if Impression:0.4white else: Crimson fi; + fill Bb[k]--B[k]--arccercle(B[k],B[k+1],O)--reverse(arccercle(Bb[k],Bb[k+1],O))--cycle withcolor if Impression:0.4white else: Crimson fi; + else: + fill Aa[k]--A[k]--arccercle(A[k],A[k+1],O)--reverse(arccercle(Aa[k],Aa[k+1],O))--cycle withcolor if Impression:0.8white else: LightGreen fi; + fill Bb[k]--B[k]--arccercle(B[k],B[k+1],O)--reverse(arccercle(Bb[k],Bb[k+1],O))--cycle withcolor if Impression:0.8white else: LightGreen fi; + fi; + endfor; + fill cc withcolor if Impression:0.8white else: LightGreen fi; + fill cd withcolor if Impression:0.4white else: Crimson fi; + trace ca withcolor white; + trace caa withcolor white; + trace cb withcolor white; + trace cbb withcolor white; + trace cc withcolor white; + trace cd withcolor white; + enddef; + + vardef affichagetexteflechettes(text t)= + drawoptions(withcolor white); + n:=0; + for p_=t: + n:=n+1; + label(LATEX("\bfseries "&p_),E[n]); + endfor; + enddef; + + if Flechettes: + affichageflechettes; + affichagetexteflechettes("6","13","4","18","1","20","5","12","9","14","11","8","16","7","19","3","17","2","15","10"); + else: + affichage(#1); + fi; + \end{mpost} + \fi +}% \ No newline at end of file diff --git a/Master/texmf-dist/tex/latex/profcollege/PfCCompteBon.tex b/Master/texmf-dist/tex/latex/profcollege/PfCCompteBon.tex index 1610cc93786..c61d8cf8701 100644 --- a/Master/texmf-dist/tex/latex/profcollege/PfCCompteBon.tex +++ b/Master/texmf-dist/tex/latex/profcollege/PfCCompteBon.tex @@ -166,15 +166,15 @@ \fbox{\PfCCBListeTirage[1]} \xintFor* ##1 in{\xintSeq{2}{\useKV[CompteBon]{Plaques}}}\do{\qquad \fbox{\PfCCBListeTirage[##1]}}% \end{center} - \xdef\PfCCBListeRappels{\the\tokPfCCBRappels} - \setsepchar[*]{,*=}\ignoreemptyitems - \readlist*\PfCCBDecompositionEtapes{\PfCCBListeRappels} - \reademptyitems + \xdef\PfCCBListeRappels{\the\tokPfCCBRappels}% + \setsepchar[*]{,*=}\ignoreemptyitems% + \readlist*\PfCCBDecompositionEtapes{\PfCCBListeRappels}% + \reademptyitems% \ifboolKV[CompteBon]{Solution}{% \begin{align*} \xintFor* ##1 in{\xintSeq{1}{\fpeval{\useKV[CompteBon]{Plaques}-1}}}\do{ \StrSubstitute{\PfCCBDecompositionEtapes[##1,1]}{*}{\times}[\PfCCBAffiche]\PfCCBAffiche&=\PfCCBDecompositionEtapes[##1,2]\xintifForLast{\\}{} - } + }% \end{align*} }{}% }% diff --git a/Master/texmf-dist/tex/latex/profcollege/PfCDecomposerNombrePremier.tex b/Master/texmf-dist/tex/latex/profcollege/PfCDecomposerNombrePremier.tex index 6fab8783f95..a70b818b256 100644 --- a/Master/texmf-dist/tex/latex/profcollege/PfCDecomposerNombrePremier.tex +++ b/Master/texmf-dist/tex/latex/profcollege/PfCDecomposerNombrePremier.tex @@ -30,7 +30,8 @@ \def\MPArbre#1{% \ifluatex - \mplibforcehmode + \mplibforcehmode + \mplibnumbersystem{double} \begin{mplibcode} input PfCArithmetique; numeric depart; @@ -84,7 +85,8 @@ \def\MPArbreComplet#1{% \ifluatex - \mplibforcehmode + \mplibforcehmode + \mplibnumbersystem{double} \begin{mplibcode} input PfCArithmetique; numeric depart; @@ -120,7 +122,8 @@ \def\MPArbreVide#1{% \ifluatex - \mplibforcehmode + \mplibforcehmode + \mplibnumbersystem{double} \begin{mplibcode} input PfCArithmetique; numeric depart; @@ -153,7 +156,8 @@ \def\MPArbreDessine#1#2{% \ifluatex% - \mplibforcehmode% + \mplibforcehmode% + \mplibnumbersystem{double} \begin{mplibcode} input PfCArithmetique; numeric depart; diff --git a/Master/texmf-dist/tex/latex/profcollege/PfCDistributivite.tex b/Master/texmf-dist/tex/latex/profcollege/PfCDistributivite.tex index a9c103ac857..b0d60d14e8f 100644 --- a/Master/texmf-dist/tex/latex/profcollege/PfCDistributivite.tex +++ b/Master/texmf-dist/tex/latex/profcollege/PfCDistributivite.tex @@ -38,8 +38,8 @@ % y a dans un "seul calcul". \setcounter{NbCalculDistri}{0} -\setKVdefault[ClesDistributivite]{Cours=false,Etape=1,Lettre=x,Fleches=false,AideMul=false,Reduction=false,AideAdda=false,AideAddb=false,CouleurAide=red,CouleurReduction=black,CouleurFH=blue,CouleurFB=red,Somme=false,Difference=false,RAZ=false,Oppose=false,All=false,NomExpression=A,Fin=4,Numerique=false,Remarquable=false,Echange=0,Tuile=false,Vide=false,Reperes=false,Impression=false,Tableau=false}%,AideAdd=false:inutile ? - +\setKVdefault[ClesDistributivite]{Cours=false,Etape=1,Lettre=x,Fleches=false,AideMul=false,Reduction=false,AideAdda=false,AideAddb=false,CouleurAide=red,CouleurFH=blue,CouleurFB=red,Somme=false,Difference=false,RAZ=false,Oppose=false,All=false,NomExpression=A,Fin=4,Numerique=false,Remarquable=false,Echange=0,Tuile=false,Vide=false,Reperes=false,Impression=false,Tableau=false}%,AideAdd=false:inutile ? +\defKV[ClesDistributivite]{CouleurReduction=\colorlet{DCReduction}{#1}\setKV[ClesDistributivite]{Reduction}}% \newcommand\Tuile[4]{% \ifluatex \mplibforcehmode @@ -452,13 +452,14 @@ \xdef\SommeC{0}% \newcommand\Distri[5][]{% + \colorlet{DCReduction}{black}% \useKVdefault[ClesDistributivite]%obligatoire car la macro n'est pas dans un groupe. \setKV[ClesDistributivite]{#1}%On lit les arguments optionnels \ifboolKV[ClesDistributivite]{RAZ}{\xdef\SommeA{0}\xdef\SommeB{0}\xdef\SommeC{0}% \setcounter{NbCalculDistri}{0}% }{}% \colorlet{DCAide}{\useKV[ClesDistributivite]{CouleurAide}}% - \colorlet{DCReduction}{\useKV[ClesDistributivite]{CouleurReduction}}% +% \colorlet{DCReduction}{\useKV[ClesDistributivite]{CouleurReduction}}% \colorlet{DCFlechesh}{\useKV[ClesDistributivite]{CouleurFH}}% \colorlet{DCFlechesb}{\useKV[ClesDistributivite]{CouleurFB}}% \ifboolKV[ClesDistributivite]{Cours}{% @@ -778,6 +779,7 @@ }% \newcommand\DistriEchange[5][]{% + \colorlet{DCReduction}{black} \ensuremath{% \useKVdefault[ClesDistributivite]% \setKV[ClesDistributivite]{#1}% @@ -785,7 +787,7 @@ \setcounter{NbCalculDistri}{0}% }{}% \colorlet{DCAide}{\useKV[ClesDistributivite]{CouleurAide}}% - \colorlet{DCReduction}{\useKV[ClesDistributivite]{CouleurReduction}}% +% \colorlet{DCReduction}{\useKV[ClesDistributivite]{CouleurReduction}}% \colorlet{DCFlechesh}{\useKV[ClesDistributivite]{CouleurFH}}% \colorlet{DCFlechesb}{\useKV[ClesDistributivite]{CouleurFB}}% \ifboolKV[ClesDistributivite]{Remarquable}{% diff --git a/Master/texmf-dist/tex/latex/profcollege/PfCDobble.tex b/Master/texmf-dist/tex/latex/profcollege/PfCDobble.tex index c832caf8923..2767a20c500 100644 --- a/Master/texmf-dist/tex/latex/profcollege/PfCDobble.tex +++ b/Master/texmf-dist/tex/latex/profcollege/PfCDobble.tex @@ -5,7 +5,7 @@ \NewDocumentCommand\dobble{m}{% \directlua{ - require('dobblePfC.lua') + require('PfCdobble.lua') dobble("#1"); }% }% diff --git a/Master/texmf-dist/tex/latex/profcollege/PfCEcritureLettres.tex b/Master/texmf-dist/tex/latex/profcollege/PfCEcritureLettres.tex index 650847b21ca..a2cd50db028 100644 --- a/Master/texmf-dist/tex/latex/profcollege/PfCEcritureLettres.tex +++ b/Master/texmf-dist/tex/latex/profcollege/PfCEcritureLettres.tex @@ -1,6 +1,3 @@ - - - %%% % Ecriture des nombres en lettres %%% diff --git a/Master/texmf-dist/tex/latex/profcollege/PfCGrimuku.tex b/Master/texmf-dist/tex/latex/profcollege/PfCGrimuku.tex new file mode 100644 index 00000000000..81e667533a3 --- /dev/null +++ b/Master/texmf-dist/tex/latex/profcollege/PfCGrimuku.tex @@ -0,0 +1,222 @@ +%%% +% Grimuku +%%% +\setKVdefault[Grimuku]{TLargeur=7,Solution=false,Largeur=30pt,CouleurCase=0.7white}% +\defKV[Grimuku]{CouleurSolution=\setKV[Grimuku]{Solution}}% + +\newtoks\toklistegrimukupdt +\newtoks\toklistegrimukunb + +\def\UpdatetoksGrimCases#1/#2/#3/#4\nil{\addtotok\toklistegrimukunb{"*",}\addtotok\toklistegrimukupdt{"#1",}\addtotok\toklistegrimukupdt{"#2",}\addtotok\toklistegrimukupdt{"#3",}\addtotok\toklistegrimukupdt{"#4",}}% +\def\UpdatetoksGrimCasesNb#1\nil{\addtotok\toklistegrimukunb{"#1",}\addtotok\toklistegrimukupdt{"",}\addtotok\toklistegrimukupdt{"",}\addtotok\toklistegrimukupdt{"",}\addtotok\toklistegrimukupdt{"",}}% + +\NewDocumentCommand\Grimuku{om}{% + \toklistegrimukunb{}% + \toklistegrimukupdt{}% + \useKVdefault[Grimuku]% + \setKV[Grimuku]{#1}% + \setsepchar[*]{,*/}\reademptyitems% + \readlist*\ListeCasesGrim{#2}% + \xdef\PfCGrimLargeur{\useKV[Grimuku]{TLargeur}}% + \xdef\PfCGrimHauteur{\fpeval{\ListeCasesGrimlen/\PfCGrimLargeur}}% + \savecomparemode% + \comparestrict% + \foreachitem\compteur\in\ListeCasesGrim{% + \StrCount{\ListeCasesGrim[\compteurcnt]}{/}[\PfCTestLongueur]% + \xintifboolexpr{\PfCTestLongueur>0}{% + \expandafter\UpdatetoksGrimCases\compteur\nil% + }{% + \expandafter\UpdatetoksGrimCasesNb\compteur\nil% + }% + }% + \restorecomparemode% + \BuildGrimuku{\the\toklistegrimukupdt}{\the\toklistegrimukunb}% +}% + +\NewDocumentCommand\BuildGrimuku{mm}{% + \ifluatex + \mplibforcehmode + \begin{mplibcode} + color CouleurSolution,CouleurCase; + + boolean Solution; + Solution=\useKV[Grimuku]{Solution}; + if Solution: + CouleurSolution=\useKV[Grimuku]{CouleurSolution}; + fi; + Unite=\useKV[Grimuku]{Largeur}; + Largeur=\useKV[Grimuku]{TLargeur}; + Hauteur=\PfCGrimHauteur; + + CouleurCase=\useKV[Grimuku]{CouleurCase}; + + path Base; + Base=(unitsquare scaled Unite) shifted ((0,0)-(Unite/2,Unite/2)); + + + vardef TraceFleche(expr a,b,c)= + if a="g": + drawarrow (Unite*(b-0.4,c))--(Unite*(b-0.75,c)); + elseif a="gh": + drawarrow (Unite*(b-0.4,c))--(Unite*(b-0.6,c))--(Unite*(b-0.6,c+0.5)); + elseif a="gb": + drawarrow (Unite*(b-0.4,c))--(Unite*(b-0.6,c))--(Unite*(b-0.6,c-0.5)); + elseif a="d": + drawarrow (Unite*(b+0.4,c))--(Unite*(b+0.75,c)); + elseif a="dh": + drawarrow (Unite*(b+0.4,c))--(Unite*(b+0.6,c))--(Unite*(b+0.6,c+0.5)); + elseif a="db": + drawarrow (Unite*(b+0.4,c))--(Unite*(b+0.6,c))--(Unite*(b+0.6,c-0.5)); + elseif a="h": + drawarrow (Unite*(b,c+0.15))--(Unite*(b,c+0.5)); + elseif a="hd": + drawarrow (Unite*(b,c+0.15))--(Unite*(b,c+0.35))--(Unite*(b+0.5,c+0.35)); + elseif a="hg": + drawarrow (Unite*(b,c+0.15))--(Unite*(b,c+0.35))--(Unite*(b-0.5,c+0.35)); + elseif a="b": + drawarrow (Unite*(b,c-0.15))--(Unite*(b,c-0.5)); + elseif a="bd": + drawarrow (Unite*(b,c-0.15))--(Unite*(b,c-0.35))--(Unite*(b+0.5,c-0.35)); + elseif a="bg": + drawarrow (Unite*(b,c-0.15))--(Unite*(b,c-0.35))--(Unite*(b-0.5,c-0.35)); + fi; + enddef; + + vardef EcritureProduits(text t)= + n:=0; + m:=-1; + for p_=t: + q:=n div Largeur; + r:=n mod Largeur; + m:=m+1; + if (m mod 4)=0: + label(TEX(p_),Unite*(r,-q+0.25)); + elseif (m mod 4)=1: + TraceFleche(p_,r,-q+0.25); + elseif (m mod 4)=2: + label(TEX(p_),Unite*(r,-q-0.25)); + elseif (m mod 4)=3: + TraceFleche(p_,r,-q-0.25); + n:=n+1; + fi; + endfor; + enddef; + + vardef Ecriture(text t)= + n=0; + for p_=t: + q:=n div Largeur; + r:=n mod Largeur; + if p_="*": + fill (Base shifted (Unite*(r,-q))) withcolor CouleurCase; + draw (Unite*(r-0.5,-q))--(Unite*(r+0.5,-q)); + else: + if Solution: + drawoptions(withcolor CouleurSolution); + label(TEX(p_),Unite*(r,-q)); + drawoptions(); + fi; + fi; + n:=n+1; + endfor; + enddef; + + Ecriture(#2); + EcritureProduits(#1); + % On quadrille + for k=0 upto Largeur-1: + for l=0 upto Hauteur-1: + trace Base shifted(Unite*(k,-l)); + endfor; + endfor; + \end{mplibcode} + \else + \begin{mpost}[mpsettings={color CouleurSolution,CouleurCase;boolean Solution;Solution=\useKV[Grimuku]{Solution}; if Solution: + CouleurSolution=\useKV[Grimuku]{CouleurSolution}; + fi; + Unite=\useKV[Grimuku]{Largeur}; + Largeur=\useKV[Grimuku]{TLargeur}; + Hauteur=\PfCGrimHauteur; + CouleurCase=\useKV[Grimuku]{CouleurCase}; + };] + path Base; + Base=(unitsquare scaled Unite) shifted ((0,0)-(Unite/2,Unite/2)); + % + vardef TraceFleche(expr a,b,c)= + if a="g": + drawarrow (Unite*(b-0.4,c))--(Unite*(b-0.75,c)); + elseif a="gh": + drawarrow (Unite*(b-0.4,c))--(Unite*(b-0.6,c))--(Unite*(b-0.6,c+0.5)); + elseif a="gb": + drawarrow (Unite*(b-0.4,c))--(Unite*(b-0.6,c))--(Unite*(b-0.6,c-0.5)); + elseif a="d": + drawarrow (Unite*(b+0.4,c))--(Unite*(b+0.75,c)); + elseif a="dh": + drawarrow (Unite*(b+0.4,c))--(Unite*(b+0.6,c))--(Unite*(b+0.6,c+0.5)); + elseif a="db": + drawarrow (Unite*(b+0.4,c))--(Unite*(b+0.6,c))--(Unite*(b+0.6,c-0.5)); + elseif a="h": + drawarrow (Unite*(b,c+0.15))--(Unite*(b,c+0.5)); + elseif a="hd": + drawarrow (Unite*(b,c+0.15))--(Unite*(b,c+0.35))--(Unite*(b+0.5,c+0.35)); + elseif a="hg": + drawarrow (Unite*(b,c+0.15))--(Unite*(b,c+0.35))--(Unite*(b-0.5,c+0.35)); + elseif a="b": + drawarrow (Unite*(b,c-0.15))--(Unite*(b,c-0.5)); + elseif a="bd": + drawarrow (Unite*(b,c-0.15))--(Unite*(b,c-0.35))--(Unite*(b+0.5,c-0.35)); + elseif a="bg": + drawarrow (Unite*(b,c-0.15))--(Unite*(b,c-0.35))--(Unite*(b-0.5,c-0.35)); + fi; + enddef; + % + vardef EcritureProduits(text t)= + n:=0; + m:=-1; + for p_=t: + q:=n div Largeur; + r:=n mod Largeur; + m:=m+1; + if (m mod 4)=0: + label(LATEX(p_),Unite*(r,-q+0.25)); + elseif (m mod 4)=1: + TraceFleche(p_,r,-q+0.25); + elseif (m mod 4)=2: + label(LATEX(p_),Unite*(r,-q-0.25)); + elseif (m mod 4)=3: + TraceFleche(p_,r,-q-0.25); + n:=n+1; + fi; + endfor; + enddef; + % + vardef Ecriture(text t)= + n=0; + for p_=t: + q:=n div Largeur; + r:=n mod Largeur; + if p_="*": + fill (Base shifted (Unite*(r,-q))) withcolor CouleurCase; + draw (Unite*(r-0.5,-q))--(Unite*(r+0.5,-q)); + else: + if Solution: + drawoptions(withcolor CouleurSolution); + label(LATEX(p_),Unite*(r,-q)); + drawoptions(); + fi; + fi; + n:=n+1; + endfor; + enddef; + + Ecriture(#2); + EcritureProduits(#1); + % On quadrille + for k=0 upto Largeur-1: + for l=0 upto Hauteur-1: + trace Base shifted(Unite*(k,-l)); + endfor; + endfor; + \end{mpost} + \fi +} \ No newline at end of file diff --git a/Master/texmf-dist/tex/latex/profcollege/PfCHorloge.tex b/Master/texmf-dist/tex/latex/profcollege/PfCHorloge.tex new file mode 100644 index 00000000000..1133714ecdc --- /dev/null +++ b/Master/texmf-dist/tex/latex/profcollege/PfCHorloge.tex @@ -0,0 +1,215 @@ +%%% +% Horloges +%%% +\setKVdefault[ClesHorloge]{Aiguilles,Numerique=false,Secondes,Cadre,Rayon=1,Impression=false} + +\NewDocumentCommand\Horloge{ }{%On désactive les : + \begingroup + \catcode`\:12 + \Horlogeaux +}% + +\NewDocumentCommand\Horlogeaux{om}{% + \endgroup + \useKVdefault[ClesHorloge] + \setKV[ClesHorloge]{#1} + \ifx\bla#2\bla + \timenow + \ifboolKV[ClesHorloge]{Numerique}{% + \MPAfficheurNew{\PfCTimeHeure}{\PfCTimeMinute}{0}% + }{% + \MPHorlogeNew{\PfCTimeHeure}{\PfCTimeMinute}{0}% + }% + \else + \setsepchar{:}% + \readlist*\PfCTime{#2}% + \ifboolKV[ClesHorloge]{Numerique}{% + \ifnum\PfCTimelen=1\relax + \MPAfficheurNew{\PfCTime[1]}{0}{0}% + \else + \ifnum\PfCTimelen=2\relax + \MPAfficheurNew{\PfCTime[1]}{\PfCTime[2]}{0}% + \else + \MPAfficheurNew{\PfCTime[1]}{\PfCTime[2]}{\PfCTime[3]}% + \fi + \fi + }{% + \ifnum\PfCTimelen=1\relax + \MPHorlogeNew{\PfCTime[1]}{0}{0}% + \else + \ifnum\PfCTimelen=2\relax + \MPHorlogeNew{\PfCTime[1]}{\PfCTime[2]}{0}% + \else + \MPHorlogeNew{\PfCTime[1]}{\PfCTime[2]}{\PfCTime[3]}% + \fi + \fi + }% + \fi% +}% + +\makeatletter +\def\timenow{\@tempcnta\time\relax + \@tempcntb\@tempcnta\relax + \divide\@tempcntb60\relax + \edef\PfCTimeHeure{\fpeval{\@tempcntb}}% + \multiply\@tempcntb60\relax + \advance\@tempcnta-\@tempcntb\relax + \edef\PfCTimeMinute{\fpeval{\@tempcnta}}% +}\relax +\makeatother + +\def\MPAfficheurNew#1#2#3{% + \ifluatex + \mplibforcehmode + \begin{mplibcode} + boolean Secondes,Impression; + Secondes=\useKV[ClesHorloge]{Secondes}; + Impression=\useKV[ClesHorloge]{Impression}; + if Impression: + LightSteelBlue:=0.9*white; + Crimson:=0.5*white; + fi; + u:=0.5u; + draw Afficheur(#1 div10,0); + draw Afficheur(#1 mod10,0) shifted(u*(1,0)); + draw Afficheur(10,0) shifted(u*(2,0)); + draw Afficheur(#2 div10,0) shifted(u*(3,0)); + draw Afficheur(#2 mod10,0) shifted(u*(4,0)); + if Secondes: + draw Afficheur(10,0) shifted(u*(5,0)); + draw Afficheur(#3 div10,0) shifted(u*(6,0)); + draw Afficheur(#3 mod10,0) shifted(u*(7,0)); + fi; + \end{mplibcode} + \else + \begin{mpost}[mpsettings={boolean Secondes;Secondes=\useKV[ClesHorloge]{Secondes};}] + u:=0.5u; + draw Afficheur(#1 div10,0); + draw Afficheur(#1 mod10,0) shifted(u*(1,0)); + draw Afficheur(10,0) shifted(u*(2,0)); + draw Afficheur(#2 div10,0) shifted(u*(3,0)); + draw Afficheur(#2 mod10,0) shifted(u*(4,0)); + if Secondes: + draw Afficheur(10,0) shifted(u*(5,0)); + draw Afficheur(#3 div10,0) shifted(u*(6,0)); + draw Afficheur(#3 mod10,0) shifted(u*(7,0)); + fi; + \end{mpost} + \fi +} + +\def\MPHorlogeNew#1#2#3{ + \ifluatex + \mplibforcehmode + \begin{mplibcode} + boolean Secondes,Aiguilles,Cadre; + Secondes=\useKV[ClesHorloge]{Secondes}; + Aiguilles=\useKV[ClesHorloge]{Aiguilles}; + Cadre=\useKV[ClesHorloge]{Cadre}; + marque_horloge=\useKV[ClesHorloge]{Rayon}; + save Hor; + picture Hor; + path gdeaig,pteaig,trot; + pair centrehorloge; + centrehorloge=(0,0); + path tourhorloge,toura; + tourhorloge=cercles(centrehorloge,marque_horloge*cm); + toura=cercles(centrehorloge,(marque_horloge+0.25)*cm); + Hor=image( + %% dessin du cadre + if Cadre: + pair A[]; + draw cercles(centrehorloge,(marque_horloge+0.5)*cm) withpen pencircle scaled 1.5; + for k=1 upto 12: + A[k]=pointarc(toura,90-30*k); + label(TEX(decimal(k)),A[k]); + endfor; + fi; + %% dessin de l'horloge + draw tourhorloge; + for i=0 upto 59: + if (i mod 5)=0: + if (i mod 15)=0: + draw pointarc(tourhorloge,6*i)--(pointarc(tourhorloge,6*i) shifted (7*unitvector(centrehorloge-pointarc(tourhorloge,6*i)))) withpen pencircle scaled 2bp; + else: + draw pointarc(tourhorloge,6*i)--(pointarc(tourhorloge,6*i) shifted (5*unitvector(centrehorloge-pointarc(tourhorloge,6*i)))) withpen pencircle scaled 1.5bp; + fi; + else: + draw pointarc(tourhorloge,6*i)--(pointarc(tourhorloge,6*i) shifted (3*unitvector(centrehorloge-pointarc(tourhorloge,6*i)))); + fi; + endfor; + path graduhorloge; + graduhorloge=cercles(centrehorloge,marque_horloge*cm+5*abs(unitvector(centrehorloge-pointarc(tourhorloge,0)))); + % + marque_p:="plein"; + pointe(centrehorloge); + marque_p:="rien"; + %% placement des aiguilles + if Aiguilles: + gdeaig=centrehorloge--(pointarc(tourhorloge,0) shifted (7*unitvector(centrehorloge-pointarc(tourhorloge,0)))); + pteaig=centrehorloge--(pointarc(tourhorloge,0) shifted (18*unitvector(centrehorloge-pointarc(tourhorloge,0)))); + if Secondes: + trot=centrehorloge--(pointarc(tourhorloge,0) shifted (10*unitvector(centrehorloge-pointarc(tourhorloge,0)))); + draw rotation(trot,centrehorloge,90-6*#3) withpen pencircle scaled0.4; + fi; + draw rotation(gdeaig,centrehorloge,90-6*#2) withpen pencircle scaled1.25; + draw rotation(pteaig,centrehorloge,90-30*(#1+#2/60)) withpen pencircle scaled 2bp; + fi; + ); + draw Hor; +\end{mplibcode} +\else + \begin{mpost}[mpsettings={boolean Secondes,Aiguilles,Cadre;Secondes=\useKV[ClesHorloge]{Secondes};Aiguilles=\useKV[ClesHorloge]{Aiguilles};Cadre=\useKV[ClesHorloge]{Cadre};marque_horloge=\useKV[ClesHorloge]{Rayon};}] + save Hor; + picture Hor; + path gdeaig,pteaig,trot; + pair centrehorloge; + centrehorloge=(0,0); + path tourhorloge,toura; + tourhorloge=cercles(centrehorloge,marque_horloge*cm); + toura=cercles(centrehorloge,(marque_horloge+0.25)*cm); + Hor=image( + %% dessin du cadre + if Cadre: + pair A[]; + draw cercles(centrehorloge,(marque_horloge+0.5)*cm) withpen pencircle scaled 1.5; + for k=1 upto 12: + A[k]=pointarc(toura,90-30*k); + label(LATEX(decimal(k)),A[k]); + endfor; + fi; + %% dessin de l'horloge + draw tourhorloge; + for i=0 upto 59: + if (i mod 5)=0: + if (i mod 15)=0: + draw pointarc(tourhorloge,6*i)--(pointarc(tourhorloge,6*i) shifted (7*unitvector(centrehorloge-pointarc(tourhorloge,6*i)))) withpen pencircle scaled 2bp; + else: + draw pointarc(tourhorloge,6*i)--(pointarc(tourhorloge,6*i) shifted (5*unitvector(centrehorloge-pointarc(tourhorloge,6*i)))) withpen pencircle scaled 1.5bp; + fi; + else: + draw pointarc(tourhorloge,6*i)--(pointarc(tourhorloge,6*i) shifted (3*unitvector(centrehorloge-pointarc(tourhorloge,6*i)))); + fi; + endfor; + path graduhorloge; + graduhorloge=cercles(centrehorloge,marque_horloge*cm+5*abs(unitvector(centrehorloge-pointarc(tourhorloge,0)))); + % + marque_p:="plein"; + pointe(centrehorloge); + marque_p:="rien"; + %% placement des aiguilles + if Aiguilles: + gdeaig=centrehorloge--(pointarc(tourhorloge,0) shifted (7*unitvector(centrehorloge-pointarc(tourhorloge,0)))); + pteaig=centrehorloge--(pointarc(tourhorloge,0) shifted (18*unitvector(centrehorloge-pointarc(tourhorloge,0)))); + if Secondes: + trot=centrehorloge--(pointarc(tourhorloge,0) shifted (10*unitvector(centrehorloge-pointarc(tourhorloge,0)))); + draw rotation(trot,centrehorloge,90-6*#3) withpen pencircle scaled0.4; + fi; + draw rotation(gdeaig,centrehorloge,90-6*#2) withpen pencircle scaled1.25; + draw rotation(pteaig,centrehorloge,90-30*(#1+#2/60)) withpen pencircle scaled 2bp; + fi; + ); + draw Hor; + \end{mpost} +\fi +} \ No newline at end of file diff --git a/Master/texmf-dist/tex/latex/profcollege/PfCLabyrintheNombre.tex b/Master/texmf-dist/tex/latex/profcollege/PfCLabyrintheNombre.tex index a7463ec7029..be5e05d6731 100644 --- a/Master/texmf-dist/tex/latex/profcollege/PfCLabyrintheNombre.tex +++ b/Master/texmf-dist/tex/latex/profcollege/PfCLabyrintheNombre.tex @@ -1,18 +1,211 @@ %%% % Labyrinthe Nombre %%% -\setKVdefault[ClesLabyNb]{Multiple=5,XDepart=0,YDepart=0,Longueur=7,Largeur=4,XArrivee=6,YArrivee=3,Solution=false,Echelle=1,Angle=0,Couleur=red,Murs=false,Nom=Ex1,CouleurChemin=LightSteelBlue,DoubleOperation=false,Chemin=false,EntreeSortie=false,Entree="Nord",Sortie="Sud",SortieUnique=true} +\setKVdefault[ClesLabyNb]{Multiple=5,XDepart=0,YDepart=0,Longueur=7,Largeur=4,Solution=false,Echelle=1,Angle=0,Couleur=red,Murs=false,Nom=Ex1,CouleurChemin=LightSteelBlue,DoubleOperation=false,Multiplication=false,Chemin=false,EntreeSortie=false,Entree="Nord",Sortie="Sud",SortieUnique=true,Graines=false,XArrivees=false,YArrivees=false,ArriveeX=5,ArriveeY=5} +\defKV[ClesLabyNb]{Graine=\setKV[ClesLabyNb]{Graines}} +\defKV[ClesLabyNb]{XArrivee=\setKV[ClesLabyNb]{XArrivees}\setKV[ClesLabyNb]{ArriveeX=#1}} +\defKV[ClesLabyNb]{YArrivee=\setKV[ClesLabyNb]{YArrivees}\setKV[ClesLabyNb]{ArriveeY=#1}} \newcommand\LabyNombre[1][]{% \useKVdefault[ClesLabyNb]% \setKV[ClesLabyNb]{#1}% - \ifboolKV[ClesLabyNb]{Solution}{% - \TraceLabyFactoSolution{\useKV[ClesLabyNb]{Multiple}}{\useKV[ClesLabyNb]{Longueur}}{\useKV[ClesLabyNb]{Largeur}}{(\useKV[ClesLabyNb]{YDepart},\useKV[ClesLabyNb]{XDepart})}{(\useKV[ClesLabyNb]{YArrivee},\useKV[ClesLabyNb]{XArrivee})}{\useKV[ClesLabyNb]{Solution}}% + \ifboolKV[ClesLabyNb]{XArrivees}{}{\setKV[ClesLabyNb]{ArriveeX=\fpeval{\useKV[ClesLabyNb]{Longueur}-1}}} + \ifboolKV[ClesLabyNb]{YArrivees}{}{\setKV[ClesLabyNb]{ArriveeY=\fpeval{\useKV[ClesLabyNb]{Largeur}-1}}} + \ifboolKV[ClesLabyNb]{Multiplication}{% + \TraceLabyMul{\useKV[ClesLabyNb]{Multiple}}{\useKV[ClesLabyNb]{Longueur}}{\useKV[ClesLabyNb]{Largeur}}{(\useKV[ClesLabyNb]{YDepart},\useKV[ClesLabyNb]{XDepart})}{(\useKV[ClesLabyNb]{ArriveeY},\useKV[ClesLabyNb]{ArriveeX})}% }{% - \TraceLabyFacto{\useKV[ClesLabyNb]{Multiple}}{\useKV[ClesLabyNb]{Longueur}}{\useKV[ClesLabyNb]{Largeur}}{(\useKV[ClesLabyNb]{YDepart},\useKV[ClesLabyNb]{XDepart})}{(\useKV[ClesLabyNb]{YArrivee},\useKV[ClesLabyNb]{XArrivee})}{\useKV[ClesLabyNb]{Solution}}% - }% + \ifboolKV[ClesLabyNb]{Solution}{% + \TraceLabyFactoSolution{\useKV[ClesLabyNb]{Multiple}}{\useKV[ClesLabyNb]{Longueur}}{\useKV[ClesLabyNb]{Largeur}}{(\useKV[ClesLabyNb]{YDepart},\useKV[ClesLabyNb]{XDepart})}{(\useKV[ClesLabyNb]{ArriveeY},\useKV[ClesLabyNb]{ArriveeX})}{\useKV[ClesLabyNb]{Solution}}% + }{% + \TraceLabyFacto{\useKV[ClesLabyNb]{Multiple}}{\useKV[ClesLabyNb]{Longueur}}{\useKV[ClesLabyNb]{Largeur}}{(\useKV[ClesLabyNb]{YDepart},\useKV[ClesLabyNb]{XDepart})}{(\useKV[ClesLabyNb]{ArriveeY},\useKV[ClesLabyNb]{ArriveeX})}{\useKV[ClesLabyNb]{Solution}}% + }% + }% }% +\newcommand\TraceLabyMul[5]{ + \ifluatex + \mplibnumbersystem{double} + \mplibforcehmode + \begin{mplibcode} + input PfCLabyNombre; + + boolean Murs,Solution,Graines; + Murs=\useKV[ClesLabyNb]{Murs}; + Solution:=\useKV[ClesLabyNb]{Solution}; + Graines:=\useKV[ClesLabyNb]{Graines}; + if Graines: + randomseed:=\useKV[ClesLabyNb]{Graine} + fi; + + path Fullcircle; + Fullcircle=fullcircle shifted((0.5,0.5)); + + numeric Multiple; + Multiple=#1; + % Initialisation du labyrinthe + InitialisationLabyrintheMul(#2,#3); + % On initialise les paramètres du parcours + numeric choixligneD,choixligneA,choixcolonneD,choixcolonneA; + choixligneD=xpart(#4); + choixcolonneD=ypart(#4); + choixligneA=xpart(#5); + choixcolonneA=ypart(#5);% + pair Depart; + Depart=N[choixligneD][choixcolonneD]; + pair Arrivee; + Arrivee=N[choixligneA][choixcolonneA]; + pair Mobile; + Mobile=Depart; + RAZPileChemin; + % Exploration du labyrinthe + PushChemin((choixligneD,choixcolonneD)); + CaseExploree[choixligneD][choixcolonneD]:=true; + VoisinDispo(choixligneD,choixcolonneD); + forever: exitif Mobile=Arrivee;%nb=0; + nb:=ceiling(uniformdeviate(nbvoisin)); + if nb>0: + for k=1 upto nbvoisin: + CaseExploree[xpart(PileVoisin[k])][ypart(PileVoisin[k])]:=true; + endfor; + PushChemin((xpart(PileVoisin[nb]),ypart(PileVoisin[nb]))); + Mobile:=N[xpart(PileChemin[indiceChemin])][ypart(PileChemin[indiceChemin])]; + VoisinDispo(xpart(PileChemin[indiceChemin]),ypart(PileChemin[indiceChemin])); + else: + PopChemin; + fi; + endfor; + + vardef PremierInfCent= + Totalpremier:=25; + + numeric p[]; boolean n_is_prime; p[1]=2; kis:=1; + for nis=3 step 2 until infinity: + n_is_prime := true; + for jis=2 upto kis: + if nis mod p[jis]=0: n_is_prime := false; fi + exitif nis/p[jis] < p[jis]; + endfor + if n_is_prime: p[incr kis] := nis; exitif kis=Totalpremier; fi + endfor fi + + numeric PR[],pretiens[]; + + for ki=1 upto Totalpremier-1: + pretiens[ki]:=p[ki+1]; + endfor; + + Kk:=0; + + for ki=Totalpremier-1 downto 1: + alea:=1+floor(uniformdeviate(ki)); + PR[incr Kk]:=pretiens[alea]; + Kkl:=0; + for li=1 upto ki: + if li<>alea: + pretiens[incr Kkl]:=pretiens[li]; + fi; + endfor; + endfor; + enddef; + + vardef ListeDiviseurs(expr nbtest)= + numeric diviseurs[],nondiviseurs[],pas; + nbdiv:=0; + nbnondiv:=0; + pas=2; + forever: + if (nbtest mod pas)=0: + nbdiv:=nbdiv+1; + diviseurs[nbdiv]=pas; + else: + nbnondiv:=nbnondiv+1; + nondiviseurs[nbnondiv]=pas; + fi; + pas:=pas+1; + exitif pas>10; + endfor; + enddef; + + % Affichagefinal + % on sauvegarde les nombres aléatoires + numeric NbAffiche[]; + numeric NbSol[]; + % on écrit des nombres premiers au hasard >10 + PremierInfCent; + numeric nbaffiche; + nbaffiche=0; + for k=0 upto LargeurLaby-1: + for l=0 upto LongueurLaby-1: + nbaffiche:=nbaffiche+1; + if (nbaffiche mod 2)=0: + nbpremier:=3+ceiling(uniformdeviate(Totalpremier-4)); + NbAffiche[nbaffiche]:=PR[nbpremier]; + else: + NbAffiche[nbaffiche]:=2+floor(uniformdeviate(8)); + fi; + endfor; + endfor; + % On crée des multiples du nombre choisi + NbSol[1]=Multiple; + for k=2 upto indiceChemin: + if (k mod 2)=0: + NbSol[k]=NbSol[k-1]*(2+ceiling(uniformdeviate(8))); + else: + % Diviseurs du précédent sauf 1 mais inférieur ou égal à 10 + % choix aléatoire du diviseur + ListeDiviseurs(NbSol[k-1]); + choixdiv:=ceiling(uniformdeviate(nbdiv)); + NbSol[k]=diviseurs[choixdiv]; + fi; + endfor; + % On affiche + picture Corps; + Corps=image( + drawoptions(withcolor 0.7white); + for k=0 upto LargeurLaby-1: + trace (N[k][0]--N[k][LongueurLaby-1]) shifted((5mm,0.25*uv)); + endfor; + for k=0 upto LongueurLaby-1: + trace (N[0][k]--N[LargeurLaby-1][k]) shifted((5mm,0.25*uv)); + endfor; + drawoptions(); + nbaffiche:=0; + for k=0 upto LargeurLaby-1: + for l=0 upto LongueurLaby-1: + nbaffiche:=nbaffiche+1; + remplis ((Fullcircle scaled 10mm) shifted N[k][l]) withcolor white; + label(TEX("\num{"&decimal(NbAffiche[nbaffiche])&"}"),M[k][l]); + endfor; + endfor; + if Solution: + trace ((center Fullcircle scaled 10mm) shifted N[choixligneD][choixcolonneD]) + for k=2 upto indiceChemin-1: + -- ((center Fullcircle scaled 10mm) shifted N[xpart(PileChemin[k])][ypart(PileChemin[k])]) + endfor + --((center Fullcircle scaled 10mm) shifted Arrivee) dashed evenly withpen pencircle scaled 1.5 withcolor Brown; + fi; + remplis ((Fullcircle scaled 10mm) shifted N[choixligneD][choixcolonneD]) withcolor \useKV[ClesLabyNb]{Couleur}; + if (LargeurLaby mod 2)=0: + remplis ((unitsquare scaled 10mm) shifted Arrivee) withcolor \useKV[ClesLabyNb]{Couleur}; + else: + remplis ((Fullcircle scaled 10mm) shifted Arrivee) withcolor \useKV[ClesLabyNb]{Couleur}; + fi; + for k=2 upto indiceChemin-1: + remplis ((Fullcircle scaled 10mm) shifted N[xpart(PileChemin[k])][ypart(PileChemin[k])]) withcolor white; + label(TEX("\num{"&decimal(NbSol[k])&"}"),M[xpart(PileChemin[k])][ypart(PileChemin[k])]); + endfor; + k:=1; + label(TEX("\num{"&decimal(NbSol[k])&"}"),M[xpart(PileChemin[k])][ypart(PileChemin[k])]); + k:=indiceChemin; + label(TEX("\num{"&decimal(NbSol[k])&"}"),M[xpart(PileChemin[k])][ypart(PileChemin[k])]); + trace TraceLabyrintheMul; + ); + Corps:=(Corps scaled \useKV[ClesLabyNb]{Echelle}) rotated \useKV[ClesLabyNb]{Angle}; + trace Corps; +\end{mplibcode} +\fi +} + \newcommand\TraceLabyFacto[6]{% \mplibforcehmode% \xdef\PfCNomLabyrinthe{\useKV[ClesLabyNb]{Nom}}% diff --git a/Master/texmf-dist/tex/latex/profcollege/PfCMulPiecesPuzzle.tex b/Master/texmf-dist/tex/latex/profcollege/PfCMulPiecesPuzzle.tex new file mode 100644 index 00000000000..56a7ad6943b --- /dev/null +++ b/Master/texmf-dist/tex/latex/profcollege/PfCMulPiecesPuzzle.tex @@ -0,0 +1,151 @@ +%%% +% Pièces de puzzle pour multiplication +%%% +%https://mirror.gutenberg-asso.fr/tex.loria.fr/prod-graph/metafun.pdf +\newtoks\toklistepuzzlea% + +\def\UpdatetoksPuzzleA#1\nil{\addtotok\toklistepuzzlea{"#1",}}% + +\setKVdefault[ClesPuzzleMul]{Solution=false,Unite=1cm,Couleur=LightSteelBlue} + +\NewDocumentCommand\PuzzleMul{om}{% + \useKVdefault[ClesPuzzleMul]% + \setKV[ClesPuzzleMul]{#1}% + \setsepchar{,}% + \readlist*\PfCListePuzzle{#2}% + \StrLen{\PfCListePuzzle[1]}[\TaillePuzzle]% + \xdef\HauteurPuzzle{\PfCListePuzzlelen}% + \toklistepuzzlea{}% + \foreachitem\compteur\in\PfCListePuzzle{\expandafter\UpdatetoksPuzzleA\compteur\nil}% + \BuildPuzzle{\the\toklistepuzzlea}% +} + +\def\BuildPuzzleCode{% + def PreDrawPuzzle ( expr ww, hh, uu ) = + %randomseed := random_seed; + def rand (expr x) = + (((x)+(uniformdeviate 10))/100) + enddef; + w := ww; + h := hh; + un := uu/100; + boolean swapone; swapone := false; + boolean swaptwo; swaptwo := false; + path p[], pw[], ph[]; + def buildpath (expr len, num) = + for j=1 upto num: + clearxy; + swaptwo := not swaptwo; + if odd num: + swapone := not swaptwo; + else: + swapone := swaptwo; + fi; + for i=0 upto len+1: + x[i]c = ((i*100)*un); + y[i]c = ((j*100)*un); + x[i]m = (x[i]c+50*un); + if swapone: + y[i]m = (y[i]c-25*un) + else: + y[i]m = (y[i]c+25*un) + fi; + x[i]l = (rand(85)[x[i]c,x[i]m]); + x[i]r = (rand(15)[x[i]m,x[i+1]c]); + y[i]l = y[i]r=y[i]c; + x[i]ll = (rand(75)[x[i]c,x[i]m]); + x[i]rr = (rand(25)[x[i]m,x[i+1]c]); + y[i]ll = y[i]rr=.50[y[i]c,y[i]m]; + endfor; + p[j] := + for i=0 upto len: + z[i]c..z[i]l..z[i]ll..z[i]m..z[i]rr..z[i]r.. + endfor + z[len+1]c ; + endfor; + enddef; + pw[1] := (100*un,100*un)--(100*un,(h+1)*100*un); + pw[w+1] := ((w+1)*100*un,100*un)--((w+1)*100*un,(h+1)*100*un); + ph[1] := (100*un,100*un)--((w+1)*100*un,100*un); + ph[h+1] := (100*un,(h+1)*100*un)--((w+1)*100*un,(h+1)*100*un); + buildpath (w+1,h); + for k=2 upto h: + ph[k] := p[k] cutbefore pw[1]; + ph[k] := ph[k] cutafter pw[w+1]; + endfor; + buildpath (h+1,w); + for k=2 upto w: + pw[k] := p[w-k+2] rotated 90 shifted ((w+2)*100*un,0); + pw[k] := pw[k] cutbefore ph[1]; + pw[k] := pw[k] cutafter ph[h+1]; + endfor; + path phw[][]; + for kh=1 upto h: + for kw=1 upto w: + phw[kh][kw] := buildcycle (ph[kh], pw[kw], ph[kh+1], pw[kw+1]); + endfor; + endfor; +enddef; +def DrawWholePuzzle = + for k=1 upto h+1: + draw ph[k] withpen pencircle scaled (2.5*un) shifted (-100*un,-100*un); + endfor; + for k=1 upto w+1: + draw pw[k] withpen pencircle scaled (2.5*un) shifted (-100*un,-100*un); + endfor; +enddef; +def DrawPuzzlePiece (expr ww, hh) = +draw phw[ww][hh] withpen pencircle scaled (2.5*un) shifted (-100*un,-100*un); +enddef; +def DrawPuzzleBorder = +draw (pw[1]--ph[1]--pw[w+1]--ph[h+1]--cycle) +withpen pencircle scaled (2.5*un) shifted (-100*un,-100*un); +enddef; +% +vardef AffichagePiece(text t)= +ligne:=Hauteur+1; +for p_=t: +ligne:=ligne-1; +colonne:=0; +for k=1 upto Taille: +colonne:=colonne+1; +if substring(k-1,k) of p_="X": +DrawPuzzlePiece(ligne,colonne); +else: +if Solution: +path titi; +titi=phw[ligne][colonne]; +fill (titi shifted (-100*un,-100*un)) withcolor CoulSolution; +draw titi withpen pencircle scaled (2.5*un) shifted (-100*un,-100*un); +fi; +fi; +endfor; +endfor; +enddef; +}% + +\NewDocumentCommand\BuildPuzzle{m}{% + \ifluatex + \mplibforcehmode + \begin{mplibcode} + \BuildPuzzleCode + Taille:=\TaillePuzzle; + Hauteur:=\HauteurPuzzle; + Unite:=\useKV[ClesPuzzleMul]{Unite}; + boolean Solution; + Solution=\useKV[ClesPuzzleMul]{Solution}; + color CoulSolution; + CoulSolution=\useKV[ClesPuzzleMul]{Couleur}; + + PreDrawPuzzle(Taille, Hauteur, Unite); + + AffichagePiece(#1); + \end{mplibcode} + \else% + \begin{mpost}[mpsettings={\BuildPuzzleCode;Taille:=\TaillePuzzle;Hauteur:=\HauteurPuzzle;Unite:=\useKV[ClesPuzzleMul]{Unite};boolean Solution;Solution=\useKV[ClesPuzzleMul]{Solution};color CoulSolution;CoulSolution=\useKV[ClesPuzzleMul]{Couleur};}] + PreDrawPuzzle(Taille, Hauteur, Unite); + + AffichagePiece(#1); + \end{mpost} + \fi% +}% \ No newline at end of file diff --git a/Master/texmf-dist/tex/latex/profcollege/PfCNonogramme.tex b/Master/texmf-dist/tex/latex/profcollege/PfCNonogramme.tex index 1493a2fcd8e..8adfbd5654e 100644 --- a/Master/texmf-dist/tex/latex/profcollege/PfCNonogramme.tex +++ b/Master/texmf-dist/tex/latex/profcollege/PfCNonogramme.tex @@ -46,6 +46,14 @@ \begin{mplibcode} Taille:=\useKV[Nono]{Taille}; u:=\useKV[Nono]{Unite}; + Unite=\useKV[Nono]{Unite}; + % + if u<7mm: + nu:=7mm; + else: + nu:=u; + fi; + % boolean Solution,Enonce; Solution:=\useKV[Nono]{Solution}; Enonce:=\useKV[Nono]{Enonce}; @@ -104,7 +112,7 @@ if unknown Sequence[cptnblignes][k]: else: nbpas:=nbpas+1; - label.lft(TEX(Sequence[cptnblignes][k]),(0,0) shifted (-(nbpas-1)*0.5*u-0.25*u,u*(-cptnblignes+0.5))); + label.lft(TEX(Sequence[cptnblignes][k]),(0,0) shifted (-(nbpas-1)*0.5*nu-0.25*nu,u*(-cptnblignes+0.5))); fi; endfor; endfor; @@ -130,7 +138,7 @@ if unknown SequenceCol[cptnbcolonnes][k]: else: nbpas:=nbpas+1; - label.top(TEX(SequenceCol[cptnbcolonnes][k]),(0,0) shifted (u*(cptnbcolonnes-0.5),(nbpas-1)*0.5*u+0.25*u)); + label.top(TEX(SequenceCol[cptnbcolonnes][k]),(0,0) shifted (u*(cptnbcolonnes-0.5),(nbpas-1)*0.5*nu+0.25*nu)); fi; endfor; endfor; diff --git a/Master/texmf-dist/tex/latex/profcollege/PfCNotionFonction.tex b/Master/texmf-dist/tex/latex/profcollege/PfCNotionFonction.tex index bb21fbb6ae7..9b6c46725a2 100644 --- a/Master/texmf-dist/tex/latex/profcollege/PfCNotionFonction.tex +++ b/Master/texmf-dist/tex/latex/profcollege/PfCNotionFonction.tex @@ -86,70 +86,163 @@ }% }% -\NewDocumentCommand\Fonctionold{o m}{% - \useKVdefault[ClesFonction]% - \setKV[ClesFonction]{#1}% - \ifboolKV[ClesFonction]{Trace}{% - \useKVdefault[TraceG]% - \setKV[TraceG]{#1}% - \tokPfCListeDesFonctions{}% - \tokPfCListeDesNomsFonctions{}% - \xdef\PfCFooFn{\useKV[ClesFonction]{Calcul}} - \xdef\PfCFooNomFn{\useKV[TraceG]{NomCourbe}} - \ifx\bla\PfCFooFn\bla% - \else - \readlist*\ListeDesFonctions{\PfCFooFn} - \foreachitem\compteur\in\ListeDesFonctions{\expandafter\UpdatePfCListeDesFonctions\compteur\nil}% - \fi - \ifx\bla\PfCFooNomFn\bla +\setKVdefault[LecGra]{NbPoints=7,Image=false,Antecedent=false,Equation=false,UniteX=1,UniteY=1,Epaisseur=1,CouleurTrace=black,Points} +\defKV[LecGra]{Graine=\PfCGraineAlea{#1}} + +\newread\myread + +\NewDocumentCommand\LectureGraphique{o}{% + \useKVdefault[LecGra]% + \setKV[LecGra]{#1}% + % Partie Trace + % On choisit les abscisses + \xdef\FooAbscisses{\fpeval{randint(-9,-5)}}% + \xdef\RappelA{\FooAbscisses}% + \xintFor*##1 in{\xintSeq{2}{\useKV[LecGra]{NbPoints}}}\do{% + \xdef\NewAbscisse{\fpeval{\RappelA+randint(2,3)}}% + \xdef\RappelA{\NewAbscisse}% + \xdef\FooAbscisses{\FooAbscisses,\NewAbscisse}% + }% + % on choisit les ordonnées. + \xdef\FooOrdonnees{\fpeval{randint(-3,3)}}% + \xdef\RappelO{\FooOrdonnees}% + \xdef\ListeDesEcartsO{1,2,3}% + \xdef\FooListeDesOperations{+,-}% + \MelangeListe{\FooListeDesOperations}{2}% + \setsepchar{,}\ignoreemptyitems% + \readlist*\PfCListeChoixOperations{\faa}% + \xintFor*##1 in{\xintSeq{2}{\useKV[LecGra]{NbPoints}}}\do{% + \MelangeListe{\ListeDesEcartsO}{1}% + \setsepchar{,}\ignoreemptyitems% + \readlist*\PfCListeEcartSeul{\faa}% + \reademptyitems% + \modulo{##1}{2}\relax% + \ifnum\remainder=0\relax% + \xdef\NewOrdonnee{\fpeval{\RappelO\PfCListeChoixOperations[1]\PfCListeEcartSeul[1]}}% \else - \readlist*\ListeDesNomsFonctions{\PfCFooNomFn} - \foreachitem\compteur\in\ListeDesNomsFonctions{\expandafter\UpdatePfCListeDesNomsFonctions\compteur\nil}% + \xdef\NewOrdonnee{\fpeval{\RappelO\PfCListeChoixOperations[2]\PfCListeEcartSeul[1]}}% \fi - \TraceMultiGraphique{\the\tokPfCListeDesFonctions}{\the\tokPfCListeDesNomsFonctions}% - }{% - \ifboolKV[ClesFonction]{Points}{% - \toklistePtsFn{}% - \setsepchar[*]{§*/}%\ignoreemptyitems% - \readlist*\ListePoints{#2}% - \ifboolKV[ClesFonction]{Catmull}{% - \xdef\PfCFooListePoints{(\ListePoints[1,2],\ListePoints[1,3]),}% - \foreachitem\compteur\in\ListePoints{% - \xdef\PfCFooListePoints{\PfCFooListePoints (\ListePoints[\compteurcnt,2],\ListePoints[\compteurcnt,3]),}% - }% - \xdef\PfCFooListePoints{\PfCFooListePoints (\ListePoints[\ListePointslen,2],\ListePoints[\ListePointslen,3]),}% - \MPCatmull{\PfCFooListePoints}{\useKV[ClesFonction]{PasX}}{\useKV[ClesFonction]{PasY}}{\useKV[ClesFonction]{UniteX}}{\useKV[ClesFonction]{UniteY}}% - }{% - \xdef\PfCFooListePoints{} - \ifboolKV[ClesFonction]{Tangentes}{% - \foreachitem\compteur\in\ListePoints{% - \xdef\PfCFooListePoints{\PfCFooListePoints \ListePoints[\compteurcnt,1],(\ListePoints[\compteurcnt,2],\ListePoints[\compteurcnt,3]),\ListePoints[\compteurcnt,4],}% - }% - }{% - \foreachitem\compteur\in\ListePoints{% - \xdef\PfCFooListePoints{\PfCFooListePoints (\ListePoints[\compteurcnt,2],\ListePoints[\compteurcnt,3]),}% - }% - }% - \MPCourbeNew{\PfCFooListePoints}% - }% - }{% - \setsepchar{,}\ignoreemptyitems% - \roeadlist*\ListeFonction{#2}% - \StrSubstitute{\useKV[ClesFonction]{Calcul}}{\useKV[ClesFonction]{Variable}}{\i}[\temp]% - \StrSubstitute{\useKV[ClesFonction]{Calcul}}{**}{^}[\tempa]% - \StrSubstitute{\tempa}{*}{}[\tempab]% - \ifboolKV[ClesFonction]{Ecriture}{% - \ensuremath{\useKV[ClesFonction]{Nom}(\useKV[ClesFonction]{Variable})=\tempab}% - }{}% - \ifboolKV[ClesFonction]{Definition}{% - \ensuremath{\useKV[ClesFonction]{Nom}:\useKV[ClesFonction]{Variable}\mapsto\tempab}% - }{}% - \ifboolKV[ClesFonction]{Tableau}{% - \buildtabfonction% - }{}% - \reademptyitems% - }% + \xdef\RappelO{\NewOrdonnee}% + \xdef\FooOrdonnees{\FooOrdonnees,\NewOrdonnee}% + }% + \setsepchar{,}% + \readlist*\ListeAbscisses{\FooAbscisses}% + \readlist*\ListeOrdonnees{\FooOrdonnees}% + \xdef\FooPoints{0/\ListeAbscisses[1]/\ListeOrdonnees[1]/0}% + \xintFor*##1 in{\xintSeq{2}{\useKV[LecGra]{NbPoints}}}\do{% + \xdef\FooPoints{\FooPoints§0/\ListeAbscisses[##1]/\ListeOrdonnees[##1]/0}% }% + \xdef\PfCOrdonneeMin{\fpeval{min(\FooOrdonnees)}}% + \xdef\PfCOrdonneeMax{\fpeval{max(\FooOrdonnees)}}% + \xdef\PfCAbscisseMin{\fpeval{min(\FooAbscisses)}}% + \xdef\PfCAbscisseMax{\fpeval{max(\FooAbscisses)}}% + \xdef\PfCChoixImage{\fpeval{randint(\PfCAbscisseMin,\PfCAbscisseMax)}}% + \xdef\PfCChoixAntecedent{\fpeval{randint(\PfCOrdonneeMin,\PfCOrdonneeMax)}}% + \ifboolKV[LecGra]{Image}{On effectue la lecture graphique à partir du point $(\num{\PfCChoixImage};0)$.}{}% + \ifboolKV[LecGra]{Antecedent}{On effectue la lecture graphique en cherchant tous les points de la courbe ayant pour ordonnée \num{\PfCChoixAntecedent}.}{}% + \begin{center} + \Fonction[ + Points, + Splines, + PointsCourbe=\useKV[LecGra]{Points}, + Epaisseur=\useKV[LecGra]{Epaisseur}, + CouleurTrace=\useKV[LecGra]{CouleurTrace}, + UniteX=\useKV[LecGra]{UniteX}, + UniteY=\useKV[LecGra]{UniteY}, + Traces={% + boolean PdtImage,PdtAntecedent,PdtEquation; + PdtImage:=\useKV[LecGra]{Image}; + PdtAntecedent:=\useKV[LecGra]{Antecedent}; + PdtEquation:=\useKV[LecGra]{Equation}; + % Image + PfCepsilon:=0.001; + pair A,B,C,D,Ant[]; + C=placepoint(\PfCChoixImage,0); + path droiteimage,AxeO,droiteantecedent; + droiteimage=placepoint(\PfCChoixImage,-100)--placepoint(\PfCChoixImage,100); + droiteantecedent=placepoint(-100,\PfCChoixAntecedent)--placepoint(100,\PfCChoixAntecedent); + AxeO=placepoint(0,-100)--placepoint(0,100); + intersectioncourbes(CourbeTotale,droiteimage); + A=pti[1]; + write decimal(ypart(retrouvecoord(A))) to "PfCValeurImage.tex";% + write EOF to "PfCValeurImage.tex"; + intersectioncourbes(CourbeTotale,AxeO); + if n>0: + B=pti[1]; + else: + B=placepoint(0,\PfCOrdonneeMax); + fi; + D=(xpart(B),ypart(A)); + if PdtImage: + drawoptions(dashed evenly); + drawarrow C--1/4[C,A]; + drawarrow A--3/4[A,D]; + trace (C--A--D) withpen pencircle scaled 1.25; + if ypart(A)>ypart(C): + label.bot(TEX("\num{\fpeval{\PfCChoixImage}}"),C); + else: + label.top(TEX("\num{\fpeval{\PfCChoixImage}}"),C); + fi; + drawoptions(); + fi; + %antecedent + intersectioncourbes(CourbeTotale,droiteantecedent); + for k=1 upto n: + Ant[k]=pti[k]; + endfor; + NbAntecedents:=1; + for k=2 upto n: + if abs(xpart(retrouvecoord(Ant[k]))-xpart(retrouvecoord(Ant[k-1])))>PfCepsilon: + NbAntecedents:=NbAntecedents+1; + Ant[NbAntecedents]:=pti[k]; + fi; + endfor; + write decimal(NbAntecedents) to "PfCNombreAntecedents.tex"; + write EOF to "PfCNombreAntecedents.tex"; + if NbAntecedents>0: + for k=1 upto NbAntecedents: + if PdtAntecedent or PdtEquation: + draw ((fullcircle scaled 1mm) shifted Ant[k]) withcolor red; + draw ((fullcircle scaled 1mm) shifted (xpart(Ant[k]),ypart(C))) withcolor red; + draw Ant[k]--(xpart(Ant[k]),ypart(C)) withcolor red; + drawarrow Ant[k]--1/4[Ant[k],(xpart(Ant[k]),ypart(C))] withcolor red; + fi; + write decimal(xpart(retrouvecoord(Ant[k]))) to "PfCListeAntecedents.tex"; + endfor; + fi; + write EOF to "PfCListeAntecedents.tex"; + if PdtAntecedent or PdtEquation: + draw droiteantecedent withcolor red; + if ypart(placepoint(0,\PfCChoixAntecedent))1\relax s\fi{} par la fonction $f$. % Titia vaut \Titia + \openin\myread=PfCListeAntecedents.tex + Par lecture graphique, \ifnum\NombreAntecedents>1\relax ce sont \xintFor* ##1 in{\xintSeq{1}{\NombreAntecedents}}\do{% + \read\myread to \ListeNombreAntecedents% + \xintifForLast{ et }{\xintifForFirst{}{;}}\num{\fpeval{round(\ListeNombreAntecedents,1)}}% + }\else c'est \read\myread to \ListeNombreAntecedents\num{\fpeval{round(\ListeNombreAntecedents,1)}}\fi + \fi.% + }{}% }% \def\MPSplineCode{% @@ -173,6 +266,25 @@ (q,r)*cm enplace enddef; % + def replace= + xscaled (1/X.u) yscaled (1/Y.u) + enddef; +% + def retrouvecoord(expr p)=% + (p/cm) replace + enddef; +% + vardef intersectioncourbes(expr aa,bb)= + pair pti[]; + n:=0; + for k=0 upto nbpoints-1: + if ((subpath(k/nbpoints*length aa,(k+1)/nbpoints*length aa) of aa) intersectiontimes bb)<>(-1,-1): + n:=n+1; + pti[n]:=(subpath(k/nbpoints*length aa,(k+1)/nbpoints*length aa) of aa) intersectionpoint bb; + fi; + endfor; + enddef; + % nbspline=0; % nbpoints=50; @@ -189,14 +301,12 @@ xx[k]=xzero+(k/nbpoints)*(xuno-xzero); yy[k]=a[nbspline]*(xx[k]**3)+b[nbspline]*(xx[k]**2)+c[nbspline]*xx[k]+d[nbspline]; endfor; - save $; - picture $; - $=image( - draw placepoint(xzero,yzero) for k=1 upto nbpoints-1: + save Spline; + path Spline; + Spline=placepoint(xzero,yzero) for k=1 upto nbpoints-1: --placepoint(xx[k],yy[k]) endfor --placepoint(xuno,yuno); - ); - $ + Spline enddef; } @@ -284,9 +394,12 @@ % path cadreexterieur; cadreexterieur=(((MinX-1)*X.u*cm,(MinY-1)*Y.u*cm)--((MaxX+1)*X.u*cm,(MinY-1)*Y.u*cm)--((MaxX+1)*X.u*cm,(MaxY+1)*Y.u*cm)--((MinX-1)*X.u*cm,(MaxY+1)*Y.u*cm)--cycle); + path SplineRecap[],CourbeTotale; for l=1 upto N-1: - draw SplineCubique(xpart(Xn[l]),ypart(Xn[l]),xpart(Xn[l+1]),ypart(Xn[l+1]),ypart(Dn[l]),xpart(Dn[l+1])) withpen pencircle scaled Epaisseur withcolor CoulTrace; + SplineRecap[l]=SplineCubique(xpart(Xn[l]),ypart(Xn[l]),xpart(Xn[l+1]),ypart(Xn[l+1]),ypart(Dn[l]),xpart(Dn[l+1])); endfor; + CourbeTotale=SplineRecap[1] for l=2 upto N-1:..SplineRecap[l] endfor; + draw CourbeTotale withpen pencircle scaled Epaisseur withcolor CoulTrace; clip currentpicture to cadreexterieur; picture RetiensCourbe; RetiensCourbe=currentpicture; @@ -489,8 +602,9 @@ % RetiensCouleur(\useKV[TraceG]{CouleurTrace}); % - pair Origine; + pair Origine,DecalageOrigine; Origine=(xmin,ymin)+\useKV[TraceG]{Origine}; + DecalageOrigine=\useKV[TraceG]{Origine}; % boolean Grille,Vide,Graduations,Code,LegendeX,LegendeY; Grille=\useKV[TraceG]{Grille}; @@ -547,14 +661,14 @@ enddef; % vardef NommeCourbes(text texto)= - n:=0; + nc:=0; for p_=texto: - n:=n+1; + nc:=nc+1; numeric tp; - tp=pos[n]*length Cb[n]; + tp=pos[nc]*length Cb[n]; pair PT,Tangente; - PT:=point (tp) of Cb[n]; - Tangente:=unitvector(direction tp of Cb[n]); + PT:=point (tp) of Cb[nc]; + Tangente:=unitvector(direction tp of Cb[nc]); label(TEX(p_) rotated angle(Tangente),PT+2mm*(Tangente rotated 90)); endfor; enddef; @@ -595,46 +709,56 @@ \PfCTraceMGCode if Grille: drawoptions(withcolor 0.75white); - for k=xpart(Origine) step grillex until xmax: - trace u*(k,ymin)--u*(k,ymax); + for k=xpart(Origine) step grillex until (xmax+grillex): + trace u*(k,ymin-grilley)--u*(k,ymax+grilley); endfor; - for k=xpart(Origine) step -grillex until xmin: - trace u*(k,ymin)--u*(k,ymax); + for k=xpart(Origine) step -grillex until (xmin-grillex): + trace u*(k,ymin-grilley)--u*(k,ymax+grilley); endfor; - for k=ypart(Origine) step grilley until ymax: - trace u*(xmin,k)--u*(xmax,k); + for k=ypart(Origine) step grilley until (ymax+grilley): + trace u*(xmin-grillex,k)--u*(xmax+grillex,k); endfor; - for k=ypart(Origine) step -grilley until ymin: - trace u*(xmin,k)--u*(xmax,k); + for k=ypart(Origine) step -grilley until (ymin-grilley): + trace u*(xmin-grillex,k)--u*(xmax+grillex,k); endfor; drawoptions(); fi; if Graduations: - for k=gradx step gradx until bornesupmax:%xmax*gradx/grillex: - dotlabel.bot(TEX("\num{"&decimal(k)&"}"),(k*xu+xpart(Origine*cm),ypart(Origine*cm))); + for k=gradx step gradx until (((xmax-xmin)-xpart(DecalageOrigine))*pasx): + dotlabel.bot(TEX("\num{"&decimal(k)&"}"),Origine*cm+(k*xu,0)); endfor; - for k=-gradx step -gradx until borneinfmin:%xmin*gradx/grillex: - dotlabel.bot(TEX("\num{"&decimal(k)&"}"),(k*xu+xpart(Origine*cm),ypart(Origine*cm))); + for k=-gradx step -gradx until (xpart(-DecalageOrigine)*pasx): + dotlabel.bot(TEX("\num{"&decimal(k)&"}"),Origine*cm+(k*xu,0)); endfor; - for k=grady step grady until ymax*grady/grilley: - dotlabel.lft(TEX("\num{"&decimal(k)&"}"),(xpart(Origine*cm),k*yu+ypart(Origine*cm))); + for k=grady step grady until (((ymax-ymin)-ypart(DecalageOrigine))*pasy): + dotlabel.lft(TEX("\num{"&decimal(k)&"}"),Origine*cm+(0,k*yu)); endfor; - for k=-grady step -grady until ymin*grady/grilley: - dotlabel.lft(TEX("\num{"&decimal(k)&"}"),(xpart(Origine*cm),k*yu+ypart(Origine*cm))); + for k=-grady step -grady until (ypart(-DecalageOrigine)*pasy): + dotlabel.lft(TEX("\num{"&decimal(k)&"}"),Origine*cm+(0,k*yu)); endfor; fi; % drawoptions(withpen pencircle scaled(1)); - drawarrow (u*(0,ymin)--u*(0,ymax)) shifted (u*(xpart(Origine),0)); - drawarrow (u*(xmin,0)--u*(xmax,0)) shifted (u*(0,ypart(Origine))); + drawarrow (u*(0,ymin-grilley)--u*(0,ymax+grilley)) shifted (u*(xpart(Origine),0)); + drawarrow (u*(xmin-grillex,0)--u*(xmax+grillex,0)) shifted (u*(0,ypart(Origine))); label.llft(btex 0 etex,u*Origine); drawoptions(); if Vide: + if Grille: + clip currentpicture to polygone(u*(xmin-grillex,ymin-grilley),u*(xmax+grillex,ymin-grilley),u*(xmax+grillex,ymax+grilley),u*(xmin-grillex,ymax+grilley)); + draw polygone(u*(xmin-grillex,ymin-grilley),u*(xmax+grillex,ymin-grilley),u*(xmax+grillex,ymax+grilley),u*(xmin-grillex,ymax+grilley)) withcolor 0.75white; + else: clip currentpicture to polygone(u*(xmin,ymin),u*(xmax,ymin),u*(xmax,ymax),u*(xmin,ymax)); + fi; else: DessineCourbes(#1); NommeCourbes(#2); + if Grille: + clip currentpicture to polygone(u*(xmin-grillex,ymin-grilley),u*(xmax+grillex,ymin-grilley),u*(xmax+grillex,ymax+grilley),u*(xmin-grillex,ymax+grilley)); + draw polygone(u*(xmin-grillex,ymin-grilley),u*(xmax+grillex,ymin-grilley),u*(xmax+grillex,ymax+grilley),u*(xmin-grillex,ymax+grilley)) withcolor 0.75white; + else: clip currentpicture to polygone(u*(xmin,ymin),u*(xmax,ymin),u*(xmax,ymax),u*(xmin,ymax)); + fi; % if Code: EffectuerTraces; diff --git a/Master/texmf-dist/tex/latex/profcollege/PfCOperationsTrou.tex b/Master/texmf-dist/tex/latex/profcollege/PfCOperationsTrou.tex index e5c9c7a5687..9567c563cde 100644 --- a/Master/texmf-dist/tex/latex/profcollege/PfCOperationsTrou.tex +++ b/Master/texmf-dist/tex/latex/profcollege/PfCOperationsTrou.tex @@ -68,4 +68,15 @@ transform canvas={xshift=0em,yshift=0em}},rectangle,rounded corners,ultra thick, \foreach \i in {1,...,\thesubxlop}{% \PfCentoure{A\i}{A\i} }% +}% + +\NewDocumentCommand\MultiAddition{om}{% + \useKVdefault[ClesOperations]% + \setKV[ClesOperations]{#1}% + \setcounter{addxlop}{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,displayintermediary=all,vmanyoperator=bottom,intermediarystyle=\stepcounter{addxlop}\color{PfCSolOp}\PfCchiffre{A\theaddxlop},resultstyle=\stepcounter{addxlop}\color{PfCSolOp}\PfCchiffre{A\theaddxlop},resultstyle.d=\color{PfCCouleurVirgule}]#2 + \foreach \i in {1,...,\theaddxlop}{% + \PfCentoure{A\i}{A\i}% + }% }% \ No newline at end of file diff --git a/Master/texmf-dist/tex/latex/profcollege/PfCPourcentage.tex b/Master/texmf-dist/tex/latex/profcollege/PfCPourcentage.tex index ff0bdd753fe..1f6f18b19b3 100644 --- a/Master/texmf-dist/tex/latex/profcollege/PfCPourcentage.tex +++ b/Master/texmf-dist/tex/latex/profcollege/PfCPourcentage.tex @@ -1,8 +1,8 @@ %%% % Application : pourcentage %%% -\setKVdefault[ClesPourcentage]{Appliquer,Calculer=false,Augmenter=false,Reduire=false,Fractionnaire=false,Decimal,Formule=false,Unite=g,Concret=false,GrandeurA=Grandeur A,GrandeurB=Total,Largeur=1cm,MotReduction=diminution,AideTableau=false,ColorFill=white,CouleurTab=gray!15} - +\setKVdefault[ClesPourcentage]{Appliquer,Calculer=false,Augmenter=false,Reduire=false,Fractionnaire=false,Decimal,Formule=false,Concret=false,GrandeurA=Grandeur A,GrandeurB=Total,Largeur=1cm,MotReduction=diminution,AideTableau=false,ColorFill=white,CouleurTab=gray!15} +\defKV[ClesPourcentage]{Unite=\setKV[ClesPourcentage]{Concret}} \newcommand\Pourcentage[3][]{% \useKVdefault[ClesPourcentage]% \setKV[ClesPourcentage]{#1}% diff --git a/Master/texmf-dist/tex/latex/profcollege/PfCPyraVoca.tex b/Master/texmf-dist/tex/latex/profcollege/PfCPyraVoca.tex new file mode 100644 index 00000000000..bfda6963006 --- /dev/null +++ b/Master/texmf-dist/tex/latex/profcollege/PfCPyraVoca.tex @@ -0,0 +1,28 @@ +%%% +% PyraVoca +%%% +\newlength{\PfCPyraVocaHauteur} + +\setKVdefault[PyraVoca]{Solution=false,Largeur=15pt} + +\NewDocumentCommand\PyraVoca{o m}{% + \useKVdefault[PyraVoca]% + \setKV[PyraVoca]{#1}% + \setsepchar[*]{,*/}\ignoreemptyitems% + \readlist*\PfCListePyraVoca{#2}% + \reademptyitems% + \StrLen{\PfCListePyraVoca[1,2]}[\Toto]% + \xdef\PfCFooNombreCases{\Toto}% + \xintFor* ##1 in{\xintSeq{2}{\PfCListePyraVocalen}}\do{% + \StrLen{\PfCListePyraVoca[##1,2]}[\Toto]% + \xdef\PfCFooNombreCases{\PfCFooNombreCases,\Toto}% + }% + \xdef\PfCNombreMaxCases{\fpeval{max(\PfCFooNombreCases)}}% + \setlength{\PfCPyraVocaHauteur}{\useKV[PyraVoca]{Largeur}+\tabcolsep}% + \begin{NiceTabular}{l*{\PfCNombreMaxCases}{m{\useKV[PyraVoca]{Largeur}}}}% + \xintFor* ##1 in{\xintSeq{1}{\PfCListePyraVocalen}}\do{% + \StrLen{\PfCListePyraVoca[##1,2]}[\Toto]% + \rule{0pt}{\PfCPyraVocaHauteur}\Block[draw,v-center,fill=\xintifboolexpr{\listlen\PfCListePyraVoca[##1]==3}{\PfCListePyraVoca[##1,3]}{white}]{1-1}{\PfCListePyraVoca[##1,1]}\xintFor* ##2 in{\xintSeq{1}{\Toto}}\do{&\Block[draw,v-center,fill=\xintifboolexpr{\listlen\PfCListePyraVoca[##1]==3}{\PfCListePyraVoca[##1,3]}{white}]{}{\ifboolKV[PyraVoca]{Solution}{\StrChar{\PfCListePyraVoca[##1,2]}{##2}}{}}}\\ + }% + \end{NiceTabular}% +}% \ No newline at end of file diff --git a/Master/texmf-dist/tex/latex/profcollege/PfCReperage.tex b/Master/texmf-dist/tex/latex/profcollege/PfCReperage.tex index 96c2d6512df..0d4ba8b3d69 100644 --- a/Master/texmf-dist/tex/latex/profcollege/PfCReperage.tex +++ b/Master/texmf-dist/tex/latex/profcollege/PfCReperage.tex @@ -1,12 +1,13 @@ %%% % Reperage %%% -\setKVdefault[ClesReperage]{Unitex=1,Pasx=1,Unitey=1,Pasy=1,Unitez=1,Pasz=1,DemiDroite=false,Droite=false,Plan=false,Trace=false,ListeSegment={},Espace=false,Sphere=false,AnglePhi=30,CouleurLa=white,CouleurLon=Tomato,AffichageNom=false,AffichageGrad=false,AffichageAbs=0,AffichageCoord=false,LectureCoord=false,ValeurUnitex=1,ValeurUnitey=1,ValeurOrigine=0,NomOrigine=O,EchelleEspace=50,CouleurCoord=black,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"} +\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} \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 :) \def\Updatetoksdroite#1/#2\nil{\addtotok\toklistepointdroite{#1,"#2",}} -\def\Updatetoksdroite#1/#2\nil{\addtotok\toklistepointdroite{#1,"#2",}} +%\def\Updatetoksdroite#1/#2\nil{\addtotok\toklistepointdroite{#1,"#2",}} \def\Updatetoksdemidroite#1/#2\nil{\addtotok\toklistenompointdemidroite{"#2",}} \def\Updatetoksrepere#1/#2/#3\nil{\addtotok\toklistepointrepere{#1,#2,"#3",}} \def\Updatetoksespace#1/#2/#3/#4\nil{\addtotok\toklistepointespace{#1,#2,#3,"#4",}} @@ -48,6 +49,7 @@ \def\MPGlobe#1#2{% \ifluatex + \mplibnumbersystem{double} \mplibforcehmode \begin{mplibcode} input PfCSolid; @@ -89,7 +91,6 @@ AffichagePfC2; % AffichageObjet2; if \useKV[ClesReperage]{Axes}: - TraceAxes; drawoptions(withpen pencircle scaled 1.05 withcolor CouleurE); AffichageEquateur3; drawoptions(withpen pencircle scaled 1 withcolor CouleurG); @@ -1424,8 +1425,10 @@ AffichageGrad:=\AffichageGrad; AffichageCoord:=\useKV[ClesReperage]{AffichageAbs}; AffichageNom:=\AffichageNom; - boolean DemiDroite; + boolean DemiDroite,AffichageUnites,MarquePrimaire; DemiDroite=\useKV[ClesReperage]{DemiDroite}; + AffichageUnites=\useKV[ClesReperage]{AffichageUnites}; + MarquePrimaire=\useKV[ClesReperage]{MarquePrimaire}; numeric valeur[]; vardef titi(text t)= n:=0; @@ -1452,15 +1455,15 @@ if minx>(-pasx-1): minx:=-2*pasx-1; fi; + if DemiDroite: + minx:=0; + fi; if minx<\useKV[ClesReperage]{ValeurMin}: minx:=\useKV[ClesReperage]{ValeurMin}; fi; if maxx>\useKV[ClesReperage]{ValeurMax}: maxx:=\useKV[ClesReperage]{ValeurMax}; fi; - if DemiDroite: - minx:=0; - fi; % ----- pair A,B,C; A=(0,0); @@ -1480,25 +1483,29 @@ draw marquedemidroite(C,B); draw marquesegment((k/maxx)[A,B],((k+1)/maxx)[A,B]); endfor; - else: + else: for k=(minx) step 2 until (maxx-1): draw marquesegment((k/maxx)[A,B],((k+1)/maxx)[A,B]); - endfor; - fi; + endfor; + fi; % marquage primaire marque_s:=marque_s*3; - for k=0 step pasx until (maxx-pasx): + if MarquePrimaire: + for k=0 step pasx until (maxx-pasx): draw marquesegment((k/maxx)[A,B],((k+pasx)/maxx)[A,B]); endfor; for k=0 step -pasx until (minx+pasx): draw marquesegment((k/maxx)[A,B],((k-pasx)/maxx)[A,B]); endfor; + fi; % marquage des points m_c:=m_c*3; marque_p:="croix"; labeloffset:=labeloffset*3; + if AffichageUnites: label.bot(TEX("\footnotesize\num{"&decimal(ValeurUnitex)&"}"),unitex*(1,0)); label.bot(TEX("\footnotesize\num{"&decimal(ValeurOrigine)&"}"),A); + fi; if AffichageGrad>0: for k=((minx+(minx mod pasx)) div pasx) upto (maxx div pasx): if (k<0) or (k>1): @@ -1531,7 +1538,7 @@ if ACoord=3: drawarrow ((unitp*valeur[n],-7mm))--((unitp*valeur[n],-3mm)); label.bot(btex \hbox to2em{\dotfill} etex,((unitp*valeur[n],-8mm))); - pointe(unitp*(valeur[n]-ValeurOrigine,0)); + pointe(unitp*(valeur[n],0)); elseif ACoord=2: if ((ValeurUnitex*valeur[n]) mod pasx)<>0: label.bot(TEX("\footnotesize$\frac{\num{\fpeval{"&decimal(ValeurOrigine*pasx)&"+"&decimal(ValeurUnitex-ValeurOrigine)&"*"&decimal(valeur[n])&"}}}{\num{"&decimal(pasx)&"}}$"),unitp*(valeur[n],0)); @@ -2280,4 +2287,144 @@ label.lft(LATEX("\noexpand\footnotesize\noexpand\SI{\noexpand\fpeval{"&decimal(V \foreachitem\compteur\in\ListePointDroite{\xdef\Listedesvaleursaplacersurlademidroite{\Listedesvaleursaplacersurlademidroite,\ListePointDroite[\compteurcnt,1]}}% \MPNewDROITEGradueeMulti{\Listedesvaleursaplacersurlademidroite}{\the\toklistenompointdemidroite}% \setsepchar{,}% +}% + +\def\MPMultiZoom#1#2#3{% + % #1 : liste des points \`a placer en pas. pour g\'erer le cas des rep\'erages fractionnaires + % #2 : liste des noms des points + % #3 : la décomposition du nombre à placer + \ifluatex + \mplibforcehmode + \begin{mplibcode} + unitex:=\useKV[ClesReperage]{Unitex}*cm; + pasx:=10; + unitp:=unitex/pasx; + ValeurUnitex:=\useKV[ClesReperage]{ValeurUnitex}; + ValeurOrigine:=\useKV[ClesReperage]{ValeurOrigine}; + AffichageGrad:=\AffichageGrad; + AffichageCoord:=\useKV[ClesReperage]{AffichageAbs}; + AffichageNom:=\AffichageNom; + NbEtages:=\useKV[ClesReperage]{Etages}; + EtagesMax=\LongueurPartieDecimale; + numeric valeur[]; + vardef titi(text t)= + n:=0; + for p_=t: + n:=n+1; + valeur[n]=p_; + endfor; + enddef; + titi(#1); + vardef toto(text t)= + n:=0; + for p_=t: + n:=n+1; + decomp[n]=p_; + endfor; + enddef; + toto(#3); + % Détermination des abscisses maximale et minimale + minx=floor(0); + maxx=ceiling(10); +% % ----- + pair A[],B[],C[]; + for l=0 upto (NbEtages-1): + A[l]=(0,-l*cm); + B[l]=unitp*(maxx,0)+(0,-l*cm); + C[l]=unitp*(minx,0)+(0,-l*cm); + % On trace la demi-droite + if floor(valeur[1]*(10**l))>0: + drawarrow (C[l]+unitp*(-0.75,0))--(B[l]+unitp*(0.75,0)); + else: + drawarrow A[l]--(B[l]+unitp*(0.75,0)); + fi; + % marquage secondaire + marque_s:=marque_s/3; + if ((maxx-minx) mod 2)=0: + for k=(minx+1) step 2 until (maxx-1): + draw marquedemidroite(C[l],B[l]); + draw marquesegment((k/maxx)[A[l],B[l]],((k+1)/maxx)[A[l],B[l]]); + endfor; + else: + for k=(minx) step 2 until (maxx-1): + draw marquesegment((k/maxx)[A[l],B[l]],((k+1)/maxx)[A[l],B[l]]); + endfor; + fi; + % marquage primaire + marque_s:=marque_s*3; + for k=0 step pasx until (maxx-pasx): + draw marquesegment((k/maxx)[A[l],B[l]],((k+pasx)/maxx)[A[l],B[l]]); + endfor; + for k=0 step -pasx until (minx+pasx): + draw marquesegment((k/maxx)[A[l],B[l]],((k-pasx)/maxx)[A[l],B[l]]); + endfor; + endfor; + for k=0 upto (\useKV[ClesReperage]{Etages}-2): + lp:=decomp[k+2]; + draw ((lp/10)[A[k],B[k]]--((lp+1)/10)[A[k],B[k]]) withpen pencircle scaled 1.5; + draw (lp/10)[A[k],B[k]]--A[k+1] dashed evenly scaled 0.5 withcolor 0.5white; + draw ((lp+1)/10)[A[k],B[k]]--B[k+1] dashed evenly scaled 0.5 withcolor 0.5white; + if lp>0: + label.bot(TEX("\footnotesize\num{\fpeval{floor("&decimal(valeur[1])&","&decimal(k+1)&")}}"),(lp/10)[A[k],B[k]]+(0,6mm)); + fi; + if lp<9: + label.bot(TEX("\footnotesize\num{\fpeval{ceil("&decimal(valeur[1])&","&decimal(k+1)&")}}"),((lp+1)/10)[A[k],B[k]]+(0,6mm)); + fi; + endfor; + Decomp=0; + for k=0 upto (NbEtages-1): + label.bot(TEX("\footnotesize\num{\fpeval{floor("&decimal(valeur[1])&","&decimal(k)&")}}"),A[k]+(0,6mm)); + label.bot(TEX("\footnotesize\num{\fpeval{ceil("&decimal(valeur[1])&","&decimal(k)&")}}"),B[k]+(0,6mm)); + endfor; + vardef tata(text t)=%on place les points + labeloffset:=labeloffset*2; + if AffichageNom>0: + for p_=t: + label.top(TEX("\footnotesize"&p_),unitp*(decomp[NbEtages+1],0)+(0,(-\useKV[ClesReperage]{Etages}+1)*cm)); + endfor; + fi; + if AffichageCoord=3: + for p_=t: + drawarrow (unitp*(decomp[NbEtages+1],-1)+(0,(-\useKV[ClesReperage]{Etages}+1)*cm))--(unitp*(decomp[NbEtages+1],-0.3)+(0,(-\useKV[ClesReperage]{Etages}+1)*cm)); + label.bot(TEX("\hbox to4em{\dotfill}"),(unitp*(decomp[NbEtages+1],-1))+(0,(-NbEtages+0.8)*cm)); + endfor; + else: + label.bot(TEX("\footnotesize\num{\fpeval{"&decimal(valeur[1])&"}}"),unitp*(decomp[NbEtages+1],0)+(0,(-\useKV[ClesReperage]{Etages}+1)*cm)); + fi; + labeloffset:=labeloffset/2; + enddef; + %%% + if NbEtages=EtagesMax: + tata(#2); + fi; + \end{mplibcode} + \fi +} + +\NewDocumentCommand\ReperageZoom{o m}{% + \useKVdefault[ClesReperage]% + \setKV[ClesReperage]{#1}% + \setsepchar[*]{,*/}\ignoreemptyitems% + \readlist*\ListePointDroite{#2}% + \StrBefore{\ListePointDroite[1,1]}{.}[\PartieEntiere]% + \StrBehind{\ListePointDroite[1,1]}{.}[\PartieDecimale]% + \StrLen{\PartieDecimale}[\LongueurPartieDecimale]% + \ifboolKV[ClesReperage]{Niveaux}{}{ + \setKV[ClesReperage]{Etages=\LongueurPartieDecimale}% + } + \xdef\Foo{\PartieEntiere}% + \xintFor* ##1 in {\xintSeq{1}{\LongueurPartieDecimale}}\do{% + \StrChar{\PartieDecimale}{##1}[\LettreActuelle]% + \xdef\Foo{\Foo,\LettreActuelle}% + }% + \toklistepointdroite{}% + \toklistenompointdemidroite{}% + \xdef\AffichageNom{0}\ifboolKV[ClesReperage]{AffichageNom}{\xdef\AffichageNom{1}}{}% + \xdef\AffichageCoord{\useKV[ClesReperage]{AffichageAbs}}% + \xdef\AffichageGrad{0}\ifboolKV[ClesReperage]{AffichageGrad}{\xdef\AffichageGrad{1}}{}% + \foreachitem\compteur\in\ListePointDroite{\expandafter\Updatetoksdemidroite\compteur\nil}% + \xdef\Listedesvaleursaplacersurlademidroite{}% + \foreachitem\compteur\in\ListePointDroite{\xdef\Listedesvaleursaplacersurlademidroite{\Listedesvaleursaplacersurlademidroite,\ListePointDroite[\compteurcnt,1]}}% + \MPMultiZoom{\Listedesvaleursaplacersurlademidroite}{\the\toklistenompointdemidroite}{\Foo}% + \setsepchar{,}% }% \ No newline at end of file diff --git a/Master/texmf-dist/tex/latex/profcollege/PfCRepresenterTableur.tex b/Master/texmf-dist/tex/latex/profcollege/PfCRepresenterTableur.tex index 8f156727084..fd505aa3e0f 100644 --- a/Master/texmf-dist/tex/latex/profcollege/PfCRepresenterTableur.tex +++ b/Master/texmf-dist/tex/latex/profcollege/PfCRepresenterTableur.tex @@ -59,21 +59,21 @@ wc{20pt}Y*{\fpeval{\useKV[Tableur]{Colonnes}-1}}{X}}[hvlines]% \CodeBefore % on colorie en gris toute la première ligne - \tikz\draw[fill=gray!15](row-1-|col-1) rectangle (row-2-|last);% + \tikz\fill[gray!15](row-1-|col-1) rectangle (row-2-|last);% % on colorie en gris toute la première colonne - \tikz\draw[fill=gray!15](row-1-|col-1) rectangle (last-|col-2);% + \tikz\fill[gray!15](row-1-|col-1) rectangle (last-|col-2);% % \xintifboolexpr{\useKV[Tableur]{Ligne}==0 || \useKV[Tableur]{Colonne}==0}{}{% \ifboolKV[Tableur]{Selection}{% \xdef\PfCTabCouleur{\useKV[Tableur]{Couleur}}% % on colorie les cellules sans les tracer - \tikz\draw[fill=\PfCTabCouleur!50](row-\fpeval{\useKV[Tableur]{Ligne}+1}-|col-\fpeval{\useKV[Tableur]{Colonne}+1}) rectangle (row-\fpeval{\useKV[Tableur]{Ligne}+1+\useKV[Tableur]{PasL}}-|col-\fpeval{\useKV[Tableur]{Colonne}+1+\useKV[Tableur]{PasC}});% + \tikz\fill[\PfCTabCouleur!50](row-\fpeval{\useKV[Tableur]{Ligne}+1}-|col-\fpeval{\useKV[Tableur]{Colonne}+1}) rectangle (row-\fpeval{\useKV[Tableur]{Ligne}+1+\useKV[Tableur]{PasL}}-|col-\fpeval{\useKV[Tableur]{Colonne}+1+\useKV[Tableur]{PasC}});% % on trace la première cellule qui a servi à sélectionner \tikz\draw[line width=1.25pt,fill=\PfCTabCouleur!50](row-\fpeval{\useKV[Tableur]{Ligne}+1}-|col-\fpeval{\useKV[Tableur]{Colonne}+1}) rectangle (row-\fpeval{\useKV[Tableur]{Ligne}+1+1}-|col-\fpeval{\useKV[Tableur]{Colonne}+1+1});% % on colorie la zone nécessaire sur la première ligne - \tikz\draw[fill=\PfCTabCouleur](row-1-|col-\fpeval{\useKV[Tableur]{Colonne}+1}) rectangle (row-2-|col-\fpeval{\useKV[Tableur]{Colonne}+1+\useKV[Tableur]{PasC}});% + \tikz\fill[\PfCTabCouleur](row-1-|col-\fpeval{\useKV[Tableur]{Colonne}+1}) rectangle (row-2-|col-\fpeval{\useKV[Tableur]{Colonne}+1+\useKV[Tableur]{PasC}});% % on colorie la zone nécessaire sur la première colonne - \tikz\draw[fill=\PfCTabCouleur](row-\fpeval{\useKV[Tableur]{Ligne}+1}-|col-1) rectangle (row-\fpeval{\useKV[Tableur]{Ligne}+1+\useKV[Tableur]{PasL}}-|col-2);% + \tikz\fill[\PfCTabCouleur](row-\fpeval{\useKV[Tableur]{Ligne}+1}-|col-1) rectangle (row-\fpeval{\useKV[Tableur]{Ligne}+1+\useKV[Tableur]{PasL}}-|col-2);% }{% \tikz\draw[line width=1.25pt](row-\fpeval{\useKV[Tableur]{Ligne}+1}-|col-\fpeval{\useKV[Tableur]{Colonne}+1}) rectangle (row-\fpeval{\useKV[Tableur]{Ligne}+1+\useKV[Tableur]{PasL}}-|col-\fpeval{\useKV[Tableur]{Colonne}+1+\useKV[Tableur]{PasC}});% }% diff --git a/Master/texmf-dist/tex/latex/profcollege/PfCRondeInfernale.tex b/Master/texmf-dist/tex/latex/profcollege/PfCRondeInfernale.tex index 8426646d551..7917c5138bd 100644 --- a/Master/texmf-dist/tex/latex/profcollege/PfCRondeInfernale.tex +++ b/Master/texmf-dist/tex/latex/profcollege/PfCRondeInfernale.tex @@ -46,17 +46,25 @@ \fi } -\setKVdefault[RondeInfernale]{Solution=false,Relatifs=false,Etapes=4,Perso=false,Cles=false,Vide,Rayon=2.5cm,Graines=false,Rectangle=false}% -\defKV[RondeInfernale]{Graine=\setKV[RondeInfernale]{Graines}}% +\setKVdefault[RondeInfernale]{Solution=false,Relatifs=false,Etapes=4,Perso=false,Cles=false,Vide,Rayon=2.5cm,Rectangle=false}% +\defKV[RondeInfernale]{Graine=\PfCGraineAlea{#1}} \defKV[RondeInfernale]{Cle=\setKV[RondeInfernale]{Cles}\setKV[RondeInfernale]{Vide=false}}% \defKV[RondeInfernale]{ListeOperations=\setKV[RondeInfernale]{Perso}}% \defKV[RondeInfernale]{ListeNombres=\setKV[RondeInfernale]{Perso}}% -% -\NewDocumentCommand\RondeInfernale{o}{% +% + +\NewDocumentCommand\RondeInfernale{ }{%Mise en place pour les germanistes : le " est actif :( + \begingroup + \catcode`\"12 + \RondeInfernaleaux +}% + +\NewDocumentCommand\RondeInfernaleaux{o}{% + \endgroup \useKVdefault[RondeInfernale]% \setKV[RondeInfernale]{#1}% % Graine - \ifboolKV[RondeInfernale]{Graines}{\PfCGraineAlea{\useKV[RondeInfernale]{Graine}}}{}% +% \ifboolKV[RondeInfernale]{Graines}{\PfCGraineAlea{\useKV[RondeInfernale]{Graine}}}{}% % Nombre clé \ifboolKV[RondeInfernale]{Cles}{% \xdef\PfCRINombreCle{\useKV[RondeInfernale]{Cle}}% diff --git a/Master/texmf-dist/tex/latex/profcollege/PfCRose.tex b/Master/texmf-dist/tex/latex/profcollege/PfCRose.tex index 2c8ff3fd069..e238d42390a 100644 --- a/Master/texmf-dist/tex/latex/profcollege/PfCRose.tex +++ b/Master/texmf-dist/tex/latex/profcollege/PfCRose.tex @@ -1,20 +1,257 @@ %%% % Rose %%% -\setKVdefault[ClesRose]{Vide=false,Couleur=white,Produits=false,Solution=false,Rayon=2cm,Petales=7,Aide=false,FacteurMin=2,FacteurMax=10,ProduitVide=false,CaseVide=false,Polygone=false,Nom=Rose1}% +\setKVdefault[ClesRose]{Vide=false,Couleur=white,Produits=false,Solution=false,Rayon=2cm,Petales=7,Aide=false,FacteurMin=2,FacteurMax=10,ProduitVide=false,CaseVide=false,Polygone=false,Nom=Rose1,Creation=false,Addition=false}% +\defKV[ClesRose]{LesNombres=\setKV[ClesRose]{Creation}}% +\defKV[ClesRose]{LesProduits=\setKV[ClesRose]{Creation}}% +\defKV[ClesRose]{LesSommes=\setKV[ClesRose]{Addition}}% + +\def\UpdatetoksRM#1\nil{\addtotok\toklisterosemul{"#1",}}% \NewDocumentCommand\RoseMul{o}{% + \newtoks\toklisterosemul% \useKVdefault[ClesRose]% \setKV[ClesRose]{#1}% - \ifluatex% - \ifboolKV[ClesRose]{Solution}{% - \DessineRoseMulSol% + \ifboolKV[ClesRose]{Creation}{% + \xdef\PfCFooRoseMul{\useKV[ClesRose]{LesNombres}}% + \ifboolKV[ClesRose]{Addition}{% + \xdef\PfCFooRoseMul{\PfCFooRoseMul,\useKV[ClesRose]{LesSommes}}% + }{% + \xdef\PfCFooRoseMul{\PfCFooRoseMul,\useKV[ClesRose]{LesProduits}}% + }% + \setsepchar{,}% + \readlist*\ListeCompleteRoseMul{\PfCFooRoseMul}% + \foreachitem\compteur\in\ListeCompleteRoseMul{\expandafter\UpdatetoksRM\compteur\nil}% + \xdef\PfCRetiensLesFacteurs{}% + \foreachitem\compteur\in\ListeCompleteRoseMul{% + \StrLen{\ListeCompleteRoseMul[\compteurcnt]}[\PfCLongueurArg]% + \ifnum\PfCLongueurArg>0\relax% + \xdef\PfCRetiensLesFacteurs{\PfCRetiensLesFacteurs \ListeCompleteRoseMul[\compteurcnt],}% + \else% + \xdef\PfCRetiensLesFacteurs{\PfCRetiensLesFacteurs "a",}% + \fi% + }% + \DessineRoseMulPerso{\the\toklisterosemul}{\PfCRetiensLesFacteurs}% }{% - \DessineRoseMul% + \ifluatex% + \ifboolKV[ClesRose]{Solution}{% + \DessineRoseMulSol% + }{% + \DessineRoseMul% + }% + \else% + \DessineRoseMul% + \fi% }% - \else% - \DessineRoseMul% - \fi% +}% + +\def\DessineRoseMulPersoCode{% + pair A[],B[],O; + O=(0,0); + path cc; + cc=cercles(O,Rayon); + for k=0 upto Petales: + A[k]=pointarc(cc,(360/Petales)*k); + endfor; + for k=0 upto Petales-1: + B[k]=iso(A[k],A[k+1]); + endfor; + B[Petales]=B[0]; + path BoiteRec; + if Polygone: + BoiteRec=(pointarc(fullcircle,0) for k=1 upto Petales:--pointarc(fullcircle,k*(360/Petales)) endfor --cycle) scaled 1u; + else: + BoiteRec=((-0.4,-0.5)--(0.4,-0.5){dir0}..{dir90}(0.5,-0.4)--(0.5,0.4){dir90}..{dir180}(0.4,0.5)--(-0.4,0.5){dir180}..{dir-90}(-0.5,0.4)--(-0.5,-0.4){dir-90}..cycle) scaled 1u; + fi; + % On récupère la liste des nombres et facteurs + vardef RecupListe(text t)= + nbpetales:=0; + nbfacteur:=0; + nbproduit:=0; + numfacteurconnu:=0; + for p_=t: + if nbpetales{\columncolor{gray!15}}{c}*{3}{m{4.75em}}}% + }}{m{\useKV[ClesTableaux]{Largeur}}}>{\columncolor{gray!15}}{c}*{3}{m{\useKV[ClesTableaux]{Largeur}}}}% % %%% Prise en compte de la cl\'e Partie % @@ -741,33 +757,33 @@ }{}% % %%% Valeurs ci-dessous par d\'efaut - % + % \hline \ifboolKV[ClesTableaux]{Milliards}{% - \Block[borders={left,right}]{}{\fontsize{5}{5}\selectfont centaines de milliards}% - &\Block[borders={right}]{}{\fontsize{5}{5}\selectfont dizaines de milliards}% - &\Block[borders={right}]{}{\fontsize{5}{5}\selectfont unit\'es de milliards}% - &\Block[borders={right}]{}{\fontsize{5}{5}\selectfont centaines de millions}% - &\Block[borders={right}]{}{\fontsize{5}{5}\selectfont dizaines de millions}% - &\Block[]{}{\fontsize{5}{5}\selectfont unit\'es de millions}% + \Block[borders={left,right}]{}{\fontsize{5}{5}\selectfont\PfCCG}% + &\Block[borders={right}]{}{\fontsize{5}{5}\selectfont\PfCDG}% + &\Block[borders={right}]{}{\fontsize{5}{5}\selectfont\PfCUG}% + &\Block[borders={right}]{}{\fontsize{5}{5}\selectfont\PfCCM}% + &\Block[borders={right}]{}{\fontsize{5}{5}\selectfont\PfCDM}% + &\Block[]{}{\fontsize{5}{5}\selectfont\PfCUM}% & }{}% \ifboolKV[ClesTableaux]{Millions}{% - \Block[borders={left,right}]{}{\fontsize{5}{5}\selectfont centaines de millions}% - &\Block[borders={right}]{}{\fontsize{5}{5}\selectfont dizaines de millions}% - &\Block[]{}{\fontsize{5}{5}\selectfont unit\'es de millions}% + \Block[borders={left,right}]{}{\fontsize{5}{5}\selectfont\PfCCM}% + &\Block[borders={right}]{}{\fontsize{5}{5}\selectfont\PfCDM}% + &\Block[]{}{\fontsize{5}{5}\selectfont\PfCUM}% & }{}% - \Block[borders={left,right}]{}{\fontsize{5}{5}\selectfont centaines de milliers}% - &\Block[borders={right}]{}{\fontsize{5}{5}\selectfont dizaines de milliers}% - &\Block[borders={right}]{}{\fontsize{5}{5}\selectfont unit\'es de milliers}% - &\Block[borders={right}]{}{\fontsize{5}{5}\selectfont centaines}% - &\Block[borders={right}]{}{\fontsize{5}{5}\selectfont dizaines}% - &\Block[borders={right}]{}{\fontsize{5}{5}\selectfont unit\'es}% + \Block[borders={left,right}]{}{\fontsize{5}{5}\selectfont\PfCCm}% + &\Block[borders={right}]{}{\fontsize{5}{5}\selectfont\PfCDm}% + &\Block[borders={right}]{}{\fontsize{5}{5}\selectfont\PfCUm}% + &\Block[borders={right}]{}{\fontsize{5}{5}\selectfont\PfCC}% + &\Block[borders={right}]{}{\fontsize{5}{5}\selectfont\PfCD}% + &\Block[borders={right}]{}{\fontsize{5}{5}\selectfont\PfCU}% &\Block[borders={right}]{}{\ifboolKV[ClesTableaux]{Virgule}{,}{}}% - &\Block[borders={right}]{}{\fontsize{5}{5}\selectfont dixi\`emes}% - &\Block[borders={right}]{}{\fontsize{5}{5}\selectfont centi\`emes}% - &\Block[borders={right}]{}{\fontsize{5}{5}\selectfont milli\`emes}\\ + &\Block[borders={right}]{}{\fontsize{5}{5}\selectfont\PfCd}% + &\Block[borders={right}]{}{\fontsize{5}{5}\selectfont\PfCc}% + &\Block[borders={right}]{}{\fontsize{5}{5}\selectfont\PfCm}\\ % %%% Prise en compte de la cl\'e Nombres % diff --git a/Master/texmf-dist/tex/latex/profcollege/PfCVueCubes.tex b/Master/texmf-dist/tex/latex/profcollege/PfCVueCubes.tex index 91f90c96d2e..5f284e051e6 100644 --- a/Master/texmf-dist/tex/latex/profcollege/PfCVueCubes.tex +++ b/Master/texmf-dist/tex/latex/profcollege/PfCVueCubes.tex @@ -1,7 +1,7 @@ %%% % Vue Cubes %%% -\setKVdefault[VueCubes]{Solution=false,Hauteur=5,Profondeur=4,Largeur=3,Angle=60,Nom=Ex1,Trou=false,Echelle=0.25,CouleurCube=LightSteelBlue,CouleurFleche=LightGray,Face=false,Creation=false,Grilles=false} +\setKVdefault[VueCubes]{Solution=false,Hauteur=5,Profondeur=4,Largeur=3,Angle=60,Nom=Ex1,Trou=false,Echelle=0.25,CouleurCube=LightSteelBlue,CouleurFleche=LightGray,Face=false,Creation=false,Grilles=false,Seul=false} \newtoks\toklisteVueCube% \def\UpdatetoksVueCube#1\nil{\addtotok\toklisteVueCube{#1,}}% @@ -162,8 +162,9 @@ endfor; fi; \end{mplibcode} + \ifboolKV[VueCubes]{Seul}{}{% \ifboolKV[VueCubes]{Grilles}{}{% - \hspace*{1.5cm} +% \hspace*{1.5cm} \begin{mplibcode}[\PfCVueCubeNom] input PfCSolid; @@ -216,6 +217,7 @@ DessineFusion; \end{mplibcode} }% + }% \fi }% diff --git a/Master/texmf-dist/tex/latex/profcollege/PfCdobble.lua b/Master/texmf-dist/tex/latex/profcollege/PfCdobble.lua new file mode 100644 index 00000000000..06df34391b2 --- /dev/null +++ b/Master/texmf-dist/tex/latex/profcollege/PfCdobble.lua @@ -0,0 +1,82 @@ +math.randomseed(os.time()) + +-- p=5, nombre de symboles "1+p+p^2=31" +symbole = {} + +function dobble(p) + -- p : nombre premier (génération de 1+p+p² cartes à partir + -- du même nombre de symboles + -- on va générer un tableau où chaque case correspond + -- à une carte et contient la liste des numéros de symbole à mettre + for i=1,1+p+p*p do + symbole[i] = "\\PfCListeSymboleDobble["..i.."]" + end + local cartes={}; + -- première carte + cartes[0]={}; + for i=0,p do + cartes[0][i]=i; + end + printcard(cartes[0],p); + -- p+p*p suivantes + for i=1,p do + -- p premières + cartes[i]={}; + for j=0,p do + if j==0 then + cartes[i][j]=0; + else + -- on place les symboles aléatoirement + table.insert(cartes[i],math.random(j),i*p+j); + end + end + printcard(cartes[i],p); + -- p*p suivantes + for j=1,p do + cartes[p+(i-1)*p+j]={}; + for k=0,p do + if k==0 then + cartes[p+(i-1)*p+j][k]=i; + else + -- on place les symboles aléatoirement + table.insert(cartes[p+(i-1)*p+j],math.random(k),(k)*p+((k*i+j-1)%p)+1); + end + end + printcard(cartes[p+(i-1)*p+j],p); + end + end + return cartes; +end + + +function printcard(carte,p) + -- prend une carte en entrée (tableau de p+1 éléments) + -- et génère le code tex d'une page à partir des images + -- nommées suivant le prefixe + tex.sprint("\\newpage\\begin{tikzpicture}[remember picture, overlay]\\coordinate(Or) at (current page.north west);"); + -- cadre de la carte + tex.sprint("\\ifboolKV[ClesDobble]{Cercle}{\\draw[line width=.2cm,PfCDobbleColor] (4,-4) circle (3.9cm);}{\\draw[line width=.2cm,PfCDobbleColor] ($(Or)+(0.1,-0.1)$) rectangle ($(Or)+(7.9,-7.9)$);}"); + -- entier aléatoire pour l'élément au centre + local has=intrand(p+1); + local compt=0; + for i=0,p do + -- l'image au contre + if i== has then + tex.sprint("\\node[scale="..scalerand(0.7,1)..",rotate="..intrand(360).."] at ($(Or)+(4,-4)$) {"..symbole[carte[i]+1].."};"); + else + -- les autres tout le tour, taille aléatoire, rayon variant, rotation aléatoire + tex.sprint("\\node[scale="..scalerand(0.7,1)..",rotate="..intrand(360).."] at ($("..(360/(p)*compt)..":"..scalerand(2.4,2.5)..")+(Or)+(4,-4)$) {"..symbole[carte[i]+1].."};"); + compt=compt+1; + end + end + tex.sprint("\\end{tikzpicture}"); +end + + +function intrand(p) -- retourne un entier entre 0 et p-1 + return math.floor(p*math.random()); +end + +function scalerand(a,b) -- retourne un nombre aléatoire entre a et b + return a+(b-a)*math.random(); +end diff --git a/Master/texmf-dist/tex/latex/profcollege/ProfCollege.sty b/Master/texmf-dist/tex/latex/profcollege/ProfCollege.sty index 7be8c2783f2..1a1ef8f18dc 100644 --- a/Master/texmf-dist/tex/latex/profcollege/ProfCollege.sty +++ b/Master/texmf-dist/tex/latex/profcollege/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/07/05}% +\def\filedate{2023/08/02}% \let\PfCfiledate\filedate% -\def\fileversion{0.99-z-o}% +\def\fileversion{0.99-z-q}% \let\PfCfileversion\fileversion% \ProvidesPackage{ProfCollege}[\filedate\space v\fileversion\space Aide pour utiliser LaTeX au college]% @@ -95,13 +95,13 @@ \RequirePackage{xlop}% \RequirePackage{xfp}% -\RequirePackage[most]{tcolorbox}% +\RequirePackage{tcolorbox}% +\tcbuselibrary{breakable,external,fitting,hooks,magazine,poster,raster,skins,theorems,listings,listingsutf8} \RequirePackage{tikz}% % https://tex.stackexchange.com/questions/349259/curved-arrow-describing-a-step-in-a-equation-derivation %https://tex.stackexchange.com/questions/58656/best-way-to-draw-a-chevron-diagram-using-tikz -\usetikzlibrary{calc,shapes,arrows,tikzmark,chains,positioning,shapes.symbols,babel,fit}% -\usetikzlibrary{backgrounds}% +\usetikzlibrary{calc,shapes,arrows,tikzmark,chains,positioning,shapes.symbols,babel,fit,backgrounds}% \RequirePackage{suffix}%pour la commande étoilée @@ -571,7 +571,12 @@ \draw[thick] (0,0) circle (2ex); }%\emoticon }%\raisebox -} +}% +\input{PfCGrimuku} +\input{PfCHorloge} +\input{PfCCible} +\input{PfCMulPiecesPuzzle} +\input{PfCPyraVoca} \input{PfCAutomatismes} \input{PfCNumberHive} \input{PfCPatronPaves} diff --git a/Master/texmf-dist/tex/latex/profcollege/dobblePfC.lua b/Master/texmf-dist/tex/latex/profcollege/dobblePfC.lua deleted file mode 100644 index 83cf8f62185..00000000000 --- a/Master/texmf-dist/tex/latex/profcollege/dobblePfC.lua +++ /dev/null @@ -1,82 +0,0 @@ -math.randomseed(os.time()) - --- p=5, nombre de symboles "1+p+p^2=31" -symbole = {} - -function dobble(p) - -- p : nombre premier (génération de 1+p+p² cartes à partir - -- du même nombre de symboles - -- on va générer un tableau où chaque case correspond - -- à une carte et contient la liste des numéros de symbole à mettre - for i=1,7 do - symbole[i] = "\\PfCListeSymboleDobble["..i.."]" - end - local cartes={}; - -- première carte - cartes[0]={}; - for i=0,p do - cartes[0][i]=i; - end - printcard(cartes[0],p); - -- p+p*p suivantes - for i=1,p do - -- p premières - cartes[i]={}; - for j=0,p do - if j==0 then - cartes[i][j]=0; - else - -- on place les symboles aléatoirement - table.insert(cartes[i],math.random(j),i*p+j); - end - end - printcard(cartes[i],p); - -- p*p suivantes - for j=1,p do - cartes[p+(i-1)*p+j]={}; - for k=0,p do - if k==0 then - cartes[p+(i-1)*p+j][k]=i; - else - -- on place les symboles aléatoirement - table.insert(cartes[p+(i-1)*p+j],math.random(k),(k)*p+((k*i+j-1)%p)+1); - end - end - printcard(cartes[p+(i-1)*p+j],p); - end - end - return cartes; -end - - -function printcard(carte,p) - -- prend une carte en entrée (tableau de p+1 éléments) - -- et génère le code tex d'une page à partir des images - -- nommées suivant le prefixe - tex.sprint("\\newpage\\begin{tikzpicture}[remember picture, overlay]\\coordinate(Or) at (current page.north west);"); - -- cadre de la carte - tex.sprint("\\ifboolKV[ClesDobble]{Cercle}{\\draw[line width=.2cm,PfCDobbleColor] (4,-4) circle (3.9cm);}{\\draw[line width=.2cm,PfCDobbleColor] ($(Or)+(0.1,-0.1)$) rectangle ($(Or)+(7.9,-7.9)$);}"); - -- entier aléatoire pour l'élément au centre - local has=intrand(p+1); - local compt=0; - for i=0,p do - -- l'image au contre - if i== has then - tex.sprint("\\node[scale="..scalerand(0.7,1)..",rotate="..intrand(360).."] at ($(Or)+(4,-4)$) {"..symbole[carte[i]+1].."};"); - else - -- les autres tout le tour, taille aléatoire, rayon variant, rotation aléatoire - tex.sprint("\\node[scale="..scalerand(0.7,1)..",rotate="..intrand(360).."] at ($("..(360/(p)*compt)..":"..scalerand(2.4,2.5)..")+(Or)+(4,-4)$) {"..symbole[carte[i]+1].."};"); - compt=compt+1; - end - end - tex.sprint("\\end{tikzpicture}"); -end - - -function intrand(p) -- retourne un entier entre 0 et p-1 - return math.floor(p*math.random()); -end - -function scalerand(a,b) -- retourne un nombre aléatoire entre a et b - return a+(b-a)*math.random(); -end -- cgit v1.2.3