texlive[72181] Master/texmf-dist: profcollege (3sep24)
commits+karl at tug.org
commits+karl at tug.org
Tue Sep 3 22:31:38 CEST 2024
Revision: 72181
https://tug.org/svn/texlive?view=revision&revision=72181
Author: karl
Date: 2024-09-03 22:31:38 +0200 (Tue, 03 Sep 2024)
Log Message:
-----------
profcollege (3sep24)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/latex/profcollege/profcollege-doc.pdf
trunk/Master/texmf-dist/doc/latex/profcollege/profcollege-doc.zip
trunk/Master/texmf-dist/tex/latex/profcollege/PfCBillard.tex
trunk/Master/texmf-dist/tex/latex/profcollege/PfCDecomposerNombrePremier.tex
trunk/Master/texmf-dist/tex/latex/profcollege/PfCLego.tex
trunk/Master/texmf-dist/tex/latex/profcollege/PfCRepresentationGraphique.tex
trunk/Master/texmf-dist/tex/latex/profcollege/PfCRepresenterFraction.tex
trunk/Master/texmf-dist/tex/latex/profcollege/ProfCollege.sty
Added Paths:
-----------
trunk/Master/texmf-dist/tex/latex/profcollege/PfCCheque.tex
Modified: trunk/Master/texmf-dist/doc/latex/profcollege/profcollege-doc.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/latex/profcollege/profcollege-doc.zip
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/tex/latex/profcollege/PfCBillard.tex
===================================================================
--- trunk/Master/texmf-dist/tex/latex/profcollege/PfCBillard.tex 2024-09-03 20:31:10 UTC (rev 72180)
+++ trunk/Master/texmf-dist/tex/latex/profcollege/PfCBillard.tex 2024-09-03 20:31:38 UTC (rev 72181)
@@ -1,8 +1,8 @@
%%%
% Billard
%%%
-\def\filedateBillard{2024/08/04}%
-\def\fileversionBillard{0.1}%
+\def\filedateBillard{2024/08/28}%
+\def\fileversionBillard{0.1a}%
\message{-- \filedateBillard\space v\fileversionBillard}%
%
\newtoks\tokPfCMotBillard{}%
@@ -231,11 +231,9 @@
}%
\def\MPBillardSolution#1#2#3{%
- % \mplibcodeinherit{enable}%
\mplibforcehmode
\xdef\PfCNomBillard{\useKV[ClesBillard]{Nom}}
\begin{mplibcode}[\PfCNomBillard]
-% Figure(0,0,\useKV[ClesBillard]{Longueur}+2cm,\useKV[ClesBillard]{Largeur}+3cm);
trace rec;
% Tracés
drawarrow Pt[1]--(Pt[1]+1.5cm*unitvector(Pt[2]-Pt[1])) withpen pencircle scaled 1.25;
@@ -257,14 +255,16 @@
else:
dotlabel.bot(TEX(substring(0,1) of #1),Pt[1]);
fi;
+ path segmenttest;
for k=2 upto BLong:
- if (demidroite(1/1000[Pt[k-1],Pt[k]],Pt[k]) intersectiontimes cote[1])<>(-1,-1):
+ segmenttest:=(9/10)[Pt[k-1],Pt[k]]--(11/10)[Pt[k-1],Pt[k]];
+ if segmenttest intersectiontimes cote[1]<>(-1,-1):
dotlabel.bot(TEX(substring(k-1,k) of #1),Pt[k]);
- elseif (demidroite(1/1000[Pt[k-1],Pt[k]],Pt[k]) intersectiontimes cote[2])<>(-1,-1):
+ elseif segmenttest intersectiontimes cote[2]<>(-1,-1):
dotlabel.rt(TEX(substring(k-1,k) of #1),Pt[k]);
- elseif (demidroite(1/1000[Pt[k-1],Pt[k]],Pt[k]) intersectiontimes cote[3])<>(-1,-1):
+ elseif segmenttest intersectiontimes cote[3]<>(-1,-1):
dotlabel.top(TEX(substring(k-1,k) of #1),Pt[k]);
- elseif (demidroite(1/1000[Pt[k-1],Pt[k]],Pt[k]) intersectiontimes cote[4])<>(-1,-1):
+ elseif segmenttest intersectiontimes cote[4]<>(-1,-1):
dotlabel.lft(TEX(substring(k-1,k) of #1),Pt[k]);
fi;
endfor;
@@ -274,5 +274,4 @@
label.top(TEX(substring(k-1,k) of #1),((xpart(Co),5mm)-center Reponse)+(k-1)*(7mm,0)+(2.5mm,0));
endfor;
\end{mplibcode}%
-% \mplibcodeinherit{disable}%
}%
\ No newline at end of file
Added: trunk/Master/texmf-dist/tex/latex/profcollege/PfCCheque.tex
===================================================================
--- trunk/Master/texmf-dist/tex/latex/profcollege/PfCCheque.tex (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/profcollege/PfCCheque.tex 2024-09-03 20:31:38 UTC (rev 72181)
@@ -0,0 +1,125 @@
+%%%
+% PfCCheque
+%%%
+\def\filedateCheque{2024/09/03}%
+\def\fileversionCheque{0.1}%
+\message{-- \filedateCheque\space v\fileversionCheque}%
+\newlength{\oldbaseline}
+\newlength{\PfCTailleCursive}
+
+\setKVdefault[Cheque]{Sigle=CMF,Banque=Crédit Mathématique de France,Date=\today,Lieu={},Lire=false,Destinataire=Institut Curie,Solution=false,Longueur=15,Taille=\normalsize,Ajust=0pt}
+
+%https://tex.stackexchange.com/questions/406015/defining-macro-gsetlength-as-global-setlength-reliable
+\makeatletter
+\gdef\gsetlength#1#2{%
+ \begingroup
+ \setlength\skip@{#2}% Local assignment to a scratch register.
+ \global#1=\skip@ % Global assignement to #1;
+ % \relax is not necessary because of the following \endgroup.
+ \endgroup % \skip@ is restored by end of group.
+}
+\makeatother
+
+\NewDocumentCommand{\Cheque}{om}{%
+ \useKVdefault[Cheque]%
+ \setKV[Cheque]{#1}%
+ \setbox1=\hbox{\useKV[Cheque]{Taille}\myfontCursive abcdefghijklmnopqrstuvwxyz}%
+ {\useKV[Cheque]{Taille}\myfontCursive\gsetlength{\oldbaseline}{\baselineskip}\normalsize}%
+ \setlength{\PfCTailleCursive}{0.5\ht1+\useKV[Cheque]{Ajust}}%
+ \BuildCheque{#2}%
+}%
+
+\NewDocumentCommand{\BuildCheque}{m}{%
+ \ifluatex
+ \mplibforcehmode
+ \begin{mplibcode}
+ boolean Solution,Lire;
+ Solution=\useKV[Cheque]{Solution};
+ Lire=\useKV[Cheque]{Lire};
+ Longueur=\useKV[Cheque]{Longueur};
+ baselinecp=\fpeval{\oldbaseline};
+ %
+ pair A,B,C,D,M[],N[];
+ A=(0,0);
+ B-A=u*(Longueur,0);
+ C-B=u*(0,5);
+ D-C=A-B;
+ %
+ M1=1/3[D,A];
+ %
+ picture Payez;
+ Payez=image(
+ label.rt(TEX("Payez contre ce chèque"),M1);
+ );
+ %
+ M20=(xpart(M1),ypart(llcorner Payez));
+ M2-M20=(0,-baselinecp);
+ M3-M2=u*(0,-0.5);
+ M4-M3=M2-M1;
+ M5-M4=u*(0.4*Longueur,-0.25);
+ M6-M4=u*(0,-0.25)+u*(0.5,0);
+ M7-M6=u*(2,0);
+ %
+ A:=(xpart(M4),ypart(M6)-1u);
+ B:=A+C-D;
+ %
+ N1=1/2[M1,M2]+0.8*(B-A);
+ N2-N1=M2-M1;
+ N3-N2=0.18*(B-A);
+ N4-N3=N1-N2;
+ drawoptions(withcolor NavyBlue);
+ picture BaseLettre;
+ %%%%%%%%%%%%%%%%
+ fill polygone(A,B,C,D) withcolor 0.8[LightSteelBlue,white];
+ trace polygone(A,B,C,D);
+ draw Payez;
+ label.rt(TEX("{\sffamily \Huge \useKV[Cheque]{Sigle}}"),D+u*(0,-0.5));
+ label.rt(TEX("{\sffamily \useKV[Cheque]{Banque}}"),D+u*(0,-1));
+ trace (lrcorner Payez)--(0.75[(xpart(M1),ypart(lrcorner Payez)),(xpart(M1+B-A),ypart(lrcorner Payez))]);
+ label.rt(TEX("\tiny non endossable sauf au profit d'une banque ou d'un établissement assimilé."),M1+u*(0,-0.300));
+ trace 1/90[M2,M2+B-A]--(0.75[M2,M2+B-A]);
+ label.rt(TEX("À \useKV[Cheque]{Destinataire}"),M3);
+ trace 1/45[M3+u*(0,-0.2),M3+u*(0,-0.2)+B-A]--(0.75[M3+u*(0,-0.2),M3+u*(0,-0.2)+B-A]);
+ fill polygone(N1,N2,N3,N4) withcolor white;
+ trace polygone(N1,N2,N3,N4) withpen pencircle scaled 1.2 withcolor NavyBlue;
+ if Lire=false:
+ label.rt(TEX("\si{\EuRo}~#1"),iso(N1,N2));
+ else:
+ if Solution:
+ label.rt(TEX("\si{\EuRo}~\num{#1}"),iso(N1,N2));
+ fi;
+ fi;
+ label.rt(TEX("À~\hbox to"&decimal(Longueur/5)&"cm{\hrulefill}\quad Le~\hbox to"&decimal(Longueur/5)&"cm{\hrulefill}"),M5);
+ label.top(TEX("\Huge \si{\EuRo}uro"),iso(N4,N1)+u*(0,1));
+ label(TEX("\tiny « à régler exclusivement en euros »"),iso(N4,N1)+u*(-0.5,1));
+ label(TEX("\ChoixAlea{100000}{999999}{\numcheque}\numcheque"),iso(M6,M7));
+ trace cotationmil(M6,M7,2.5mm,25,TEX("\scriptsize chèque \no"));
+ %%
+% drawoptions(withcolor red);
+% draw (llcorner Payez)--(llcorner Payez+B-A);
+% draw M2--(M2+B-A);
+% drawoptions();
+ picture Sous;
+ Sous=image(%
+ label(TEX("\begin{minipage}{\fpeval{0.75*"&decimal(Longueur)&"}cm}
+ \hspace{"&decimal(abs(lrcorner Payez-llcorner Payez))&"pt}\myfontCursive\useKV[Cheque]{Taille}\Ecriture{#1}~euros
+ \end{minipage}"),(0,0));
+ );
+ pair PointBase,PointTest,Decalage;
+ PointBase=1/2[M20,M2+(u*0.75Longueur,0)];
+ PointTest=(0,0);%
+ if abs(llcorner Sous-ulcorner Sous)>baselinecp:
+ Decalage=(8pt,\fpeval{\PfCTailleCursive});
+ else:
+ Decalage=(8pt,2*\fpeval{\PfCTailleCursive});
+ fi;
+ if Lire:
+ draw Sous shifted (PointBase-PointTest+Decalage);
+ else:
+ if Solution:
+ draw Sous shifted (PointBase-PointTest+Decalage);
+ fi;
+ fi;
+ \end{mplibcode}
+ \fi%
+}%
\ No newline at end of file
Property changes on: trunk/Master/texmf-dist/tex/latex/profcollege/PfCCheque.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/texmf-dist/tex/latex/profcollege/PfCDecomposerNombrePremier.tex
===================================================================
--- trunk/Master/texmf-dist/tex/latex/profcollege/PfCDecomposerNombrePremier.tex 2024-09-03 20:31:10 UTC (rev 72180)
+++ trunk/Master/texmf-dist/tex/latex/profcollege/PfCDecomposerNombrePremier.tex 2024-09-03 20:31:38 UTC (rev 72181)
@@ -1,8 +1,8 @@
%%%
% Nombre Premier
%%%
-\def\filedateDecompNbPremier{2024/08/04}%
-\def\fileversionDecompNbPremier{0.1}%
+\def\filedateDecompNbPremier{2024/09/01}%
+\def\fileversionDecompNbPremier{0.1a}%
\message{-- \filedateDecompNbPremier\space v\fileversionDecompNbPremier}%
%
\setKVdefault[ClesNombrePremier]{Tableau=false,TableauVide=false,TableauVertical=false,TableauVerticalVide=false,Exposant=false,Longue=false,All=false,Arbre=false,ArbreVide=false,ArbreComplet=false,ArbreDessine=false,ArbreDessineVide=false,Entoure=false,Entourefin=false,Diviseurs=false,DiviseursT=false,Dot=\dotfill,Impose=false,ImposeAll=false,Potence=false,Decalage=10,Vide=false,CouleurFeuillage=ForestGreen,CouleurTronc=BurlyWood,CouleurFruits=Red,CouleurTexte=white,Poisson=false,Echelle=1cm,AngleArete=45,CouleurPoisson=white,Visible=false,Solution=false}%
@@ -963,13 +963,13 @@
\begin{tabular}{c|c}%
1&\num{#1}\\
\xintFor* ##1 in {\xintSeq {1}{\fpeval{(\cnpT+1)/2}}}\do{%
- \DiviseurNumero{#1}{##1}\num{\fpeval{\dnpT}}\uppercase{&}\DiviseurNumero{#1}{##1}\xintifboolexpr{\dnpT=\fpeval{#1/\dnpT}}{}{\num{\fpeval{#1/\dnpT}}}\\
+ \DiviseurNumero{#1}{##1}\num{\fpeval{\dnpT}}\uppercase{&}\DiviseurNumero{#1}{##1}\xintifboolexpr{\dnpT==\fpeval{#1/\dnpT}}{\num{\fpeval{\dnpT}}}{\num{\fpeval{#1/\dnpT}}}\\
}
\end{tabular}%
\else%
\begin{tabular}{c|c}
1&\num{#1}
- \ifnum\cnpT>2\relax\\
+ \ifnum\cnpT>1\relax\\
\xintFor* ##1 in {\xintSeq {1}{\fpeval{\cnpT/2}}}\do{%
\DiviseurNumero{#1}{##1}\num{\fpeval{\dnpT}}\uppercase{&}\DiviseurNumero{#1}{##1}\num{\fpeval{#1/\dnpT}}\\
}
Modified: trunk/Master/texmf-dist/tex/latex/profcollege/PfCLego.tex
===================================================================
--- trunk/Master/texmf-dist/tex/latex/profcollege/PfCLego.tex 2024-09-03 20:31:10 UTC (rev 72180)
+++ trunk/Master/texmf-dist/tex/latex/profcollege/PfCLego.tex 2024-09-03 20:31:38 UTC (rev 72181)
@@ -1,8 +1,8 @@
%%%
% Lego
%%%
-\def\filedateLego{2024/08/04}%
-\def\fileversionLego{0.1}%
+\def\filedateLego{2024/09/01}%
+\def\fileversionLego{0.1a}%
\message{-- \filedateLego\space v\fileversionLego}%
%
\setKVdefault[Lego]{Echelle=1,Couleur=LightSteelBlue,Unite=8,Diviseur=2,Perso=false,Plaque=false,Largeura=2,Largeurb=2,Unique=false}%
@@ -31,10 +31,14 @@
}{%
\xdef\PfCNbCouleurs{\fpeval{floor(\useKV[Lego]{Unite}/\useKV[Lego]{Diviseur})}}%
}%
- \ChoixCouleur{\PfCNbCouleurs}%
\ifboolKV[Lego]{Perso}{%
+ \setsepchar{,}\ignoreemptyitems%
+ \readlist*\ListeAvantChoixCouleurs{\PfCFooLegoListePerso}%
+ \ChoixCouleur{\ListeAvantChoixCouleurslen}%
+ \reademptyitems%
\BuildBarreLego{\FooCouleur}{\PfCFooLegoListePerso}%
}{%
+ \ChoixCouleur{\PfCNbCouleurs}%
\BuildBarreLego{\FooCouleur}{}%
}%
}%
Modified: trunk/Master/texmf-dist/tex/latex/profcollege/PfCRepresentationGraphique.tex
===================================================================
--- trunk/Master/texmf-dist/tex/latex/profcollege/PfCRepresentationGraphique.tex 2024-09-03 20:31:10 UTC (rev 72180)
+++ trunk/Master/texmf-dist/tex/latex/profcollege/PfCRepresentationGraphique.tex 2024-09-03 20:31:38 UTC (rev 72181)
@@ -91,7 +91,7 @@
fi;
endfor;
label.ulft(TEX("\num{"&decimal(ymin)&"}"),(0,0) shifted Origine);
- for k=1 step pasgrady until (ymax-ymin):
+ for k=pasgrady step pasgrady until (ymax-ymin):
trace ((-0.5mm,0)--(0.5mm,0)) shifted ((0,k*y.u) shifted Origine) withpen pencircle scaled1.25;
label.lft(TEX("\num{"&decimal(ymin+k)&"}"),(0,k*y.u) shifted Origine);
endfor;
Modified: trunk/Master/texmf-dist/tex/latex/profcollege/PfCRepresenterFraction.tex
===================================================================
--- trunk/Master/texmf-dist/tex/latex/profcollege/PfCRepresenterFraction.tex 2024-09-03 20:31:10 UTC (rev 72180)
+++ trunk/Master/texmf-dist/tex/latex/profcollege/PfCRepresenterFraction.tex 2024-09-03 20:31:38 UTC (rev 72181)
@@ -1,11 +1,11 @@
%%%
% Fractions
%%%
-\def\filedateRepFrac{2024/08/04}%
-\def\fileversionRepFrac{0.1}%
+\def\filedateRepFrac{2024/08/30}%
+\def\fileversionRepFrac{0.1a}%
\message{-- \filedateRepFrac\space v\fileversionRepFrac}%
%
-\setKVdefault[ClesFraction]{Rayon=2cm,Disque,Regulier=false,Segment=false,Rectangle=false,Longueur=5cm,Largeur=2cm,Cotes=5,Triangle=false,Parts=3,Eprouvette=false,Couleur=green,Reponse=false,Multiple=1,Hachures=false,Epaisseur=1}
+\setKVdefault[ClesFraction]{Rayon=2cm,Disque,Regulier=false,Segment=false,Rectangle=false,Longueur=5cm,Largeur=2cm,Cotes=5,Triangle=false,Parts=3,Eprouvette=false,Couleur=green,Reponse=false,Multiple=1,Hachures=false,Epaisseur=1,Aleatoire=false}
\def\MPFractionEprouvetteCode{%
Hauteur=\useKV[ClesFraction]{Longueur};
@@ -84,6 +84,7 @@
\ifluatex
\mplibforcehmode
\begin{mplibcode}
+ % Pas d'aléa ici : l'eau ne peut pas être en lévitation :)
\MPFractionEprouvetteCode
trace eprouvette(#2,#1);
\end{mplibcode}
@@ -94,6 +95,107 @@
\fi
}
+\def\MPFractionRegulierCodeAlea{%
+ Rayon=\useKV[ClesFraction]{Rayon};
+ Cotes=\useKV[ClesFraction]{Cotes};
+ color ColPolyReg;
+ ColPolyReg=\useKV[ClesFraction]{Couleur};
+ boolean Hachures,Reponse;
+ Reponse=\useKV[ClesFraction]{Reponse};
+ Hachures=\useKV[ClesFraction]{Hachures};
+ Epaisseur=\useKV[ClesFraction]{Epaisseur};
+ pair O,A[],B[];
+ O=u*(0,0);
+ path cc,cd;
+ cc=cercles(O,Rayon);
+ for k=0 upto Cotes:
+ A[k]=pointarc(cc,k*(360/Cotes));
+ endfor;
+ cd=polygone(A0 for k=1 upto Cotes-1:,A[k] endfor);
+ path part[];
+ vardef FractionPolyReg(expr nume,deno)=
+ for k=0 upto deno:
+ B[k]=point(k*(Cotes/deno)) of cd;
+ dotlabel("",B[k]);
+ endfor;
+ for k=0 upto deno-1:
+ part[k]=O--B[k] for l=1 upto Cotes-1:if (B[k]--B[k+1]) intersectiontimes (O--A[l])<>(-1,-1):--A[l] fi endfor --B[k+1]--cycle;%O--arccercle(B[k],B[k+1],O)--cycle;
+ endfor;
+ m=(nume div deno);
+ if (nume mod deno)=0:m:=m-1; fi;
+ picture RetourFraction;
+ RetourFraction=image(%
+ Reste=((nume div deno)+1)*deno;
+ RetiensPart=0;
+ if Reponse:
+ if m>0:
+ for l=0 upto (m-1):
+ for k=0 upto deno-1:
+ if RetiensPart<nume:
+ if Reste>(nume-RetiensPart):
+ test:=uniformdeviate(1);
+ if test>0.5:
+ RetiensPart:=RetiensPart+1;
+ if Hachures:
+ drawoptions(withpen pencircle scaled Epaisseur);
+ draw hachurage(part[k] shifted(l*(2*Rayon+0.5cm,0)),1.5*360/deno,0.25,0) withcolor ColPolyReg;
+ else:
+ fill part[k] shifted(l*(2*Rayon+0.5cm,0)) withcolor ColPolyReg;
+ fi;
+ fi;
+ else:
+ RetiensPart:=RetiensPart+1;
+ if Hachures:
+ drawoptions(withpen pencircle scaled Epaisseur);
+ draw hachurage(part[k] shifted(l*(2*Rayon+0.5cm,0)),1.5*360/deno,0.25,0) withcolor ColPolyReg;
+ else:
+ fill part[k] shifted(l*(2*Rayon+0.5cm,0)) withcolor ColPolyReg;
+ fi;
+ fi;
+ fi;
+ Reste:=Reste-1;
+ endfor;
+ endfor;
+ fi;
+ for k=0 upto deno-1:
+ if RetiensPart<nume:
+ if Reste>(nume-RetiensPart):
+ test:=uniformdeviate(1);
+ if test>0.5:
+ RetiensPart:=RetiensPart+1;
+ if Hachures:
+ drawoptions(withpen pencircle scaled Epaisseur);
+ draw hachurage(part[k] shifted(m*(2*Rayon+0.5cm,0)),1.5*360/deno,0.25,0) withcolor ColPolyReg;
+ else:
+ fill part[k] shifted(m*(2*Rayon+0.5cm,0)) withcolor ColPolyReg;
+ fi;
+ fi;
+ else:
+ RetiensPart:=RetiensPart+1;
+ if Hachures:
+ drawoptions(withpen pencircle scaled Epaisseur);
+ draw hachurage(part[k] shifted(m*(2*Rayon+0.5cm,0)),1.5*360/deno,0.25,0) withcolor ColPolyReg;
+ else:
+ fill part[k] shifted(m*(2*Rayon+0.5cm,0)) withcolor ColPolyReg;
+ fi;
+ fi;
+ fi;
+ Reste:=Reste-1;
+ endfor;
+ fi;
+ drawoptions(withpen pencircle scaled Epaisseur);
+ for l=0 upto m:
+ draw cd shifted(l*(2*Rayon+0.5cm,0));
+ for k=0 upto (deno-1):
+ draw segment(O,B[k]) shifted(l*(2*Rayon+0.5cm,0));
+ endfor;
+ endfor;
+ drawoptions();
+ );
+ RetourFraction
+ enddef;
+}%
+
\def\MPFractionRegulierCode{%
Rayon=\useKV[ClesFraction]{Rayon};
Cotes=\useKV[ClesFraction]{Cotes};
@@ -172,7 +274,13 @@
\ifluatex
\mplibforcehmode
\begin{mplibcode}
+ boolean Alea;
+ Alea=\useKV[ClesFraction]{Aleatoire};
+ if Alea:
+ \MPFractionRegulierCodeAlea;
+ else:
\MPFractionRegulierCode
+ fi;
trace FractionPolyReg(#1,#2);
\end{mplibcode}
\else
@@ -182,6 +290,122 @@
\fi
}%
+\def\MPFractionTriangleCodeAlea{%
+ Longueur:=\useKV[ClesFraction]{Longueur};
+ nbparts:=\useKV[ClesFraction]{Parts};
+ color ColTriangle;
+ ColTriangle=\useKV[ClesFraction]{Couleur};
+ boolean Hachures,Reponse;
+ Reponse=\useKV[ClesFraction]{Reponse};
+ Hachures=\useKV[ClesFraction]{Hachures};
+ Epaisseur=\useKV[ClesFraction]{Epaisseur};
+ nbtriangle=0;
+ %
+ vardef Ligne(expr longueur)=
+ for k=0 upto 2*(longueur-1):
+ nbtriangle:=nbtriangle+1;
+ if (k mod 2)=0:
+ M[nbtriangle]=(Tria shifted(0.5*k*(1/nbparts)*(B-A))) shifted((nbparts-longueur)*(1/nbparts)*(C-A));
+ else:
+ M[nbtriangle]=(Trir shifted(0.5*(k-1)*(1/nbparts)*(B-A))) shifted((nbparts-longueur)*(1/nbparts)*(C-A));
+ fi;
+ endfor;
+ enddef;
+ %
+ pair A,B,C;
+ A=u*(0.5,0.5);
+ B-A=(Longueur,0);
+ C=rotation(B,A,60);
+ %
+ path Tria,Trir,M[];
+ Tria=polygone(A,(1/nbparts)[A,B],(1/nbparts)[A,C]);
+ Trir=symetrie(Tria,(1/nbparts)[A,B],(1/nbparts)[A,C]);
+ %
+ for k=nbparts downto 1:
+ Ligne(k);
+ endfor;
+ %
+ picture FondTriangle;
+ FondTriangle=image(
+ for k=1 upto nbtriangle:
+ trace M[k];
+ endfor;
+ );
+ %
+ vardef FractionTriangle(expr nume,deno)=
+ m:=nume div deno;
+ if (nume mod deno)=0:
+ m:=m-1;
+ fi;
+ picture RetourFraction;
+ RetourFraction=image(
+ Reste=((nume div deno)+1)*deno;
+ RetiensPart=0;
+ if Reponse:
+ if m>0:
+ for l=0 upto (m-1):
+ for k=1 upto nbtriangle:
+ if RetiensPart<nume:
+ if Reste>(nume-RetiensPart):
+ test:=uniformdeviate(1);
+ if test>0.5:
+ RetiensPart:=RetiensPart+1;
+ if Hachures:
+ drawoptions(withpen pencircle scaled Epaisseur);
+ draw hachurage(M[k] shifted(l*(Longueur+1cm,0)),90,0.2,0) withcolor ColTriangle;
+ else:
+ fill M[k] shifted(l*(Longueur+1cm,0)) withcolor ColTriangle;
+ fi;
+ fi;
+ else:
+ RetiensPart:=RetiensPart+1;
+ if Hachures:
+ drawoptions(withpen pencircle scaled Epaisseur);
+ draw hachurage(M[k] shifted(l*(Longueur+1cm,0)),90,0.2,0) withcolor ColTriangle;
+ else:
+ fill M[k] shifted(l*(Longueur+1cm,0)) withcolor ColTriangle;
+ fi;
+ fi;
+ fi;
+ Reste:=Reste-1;
+ endfor;
+ endfor;
+ fi;
+ for k=1 upto nbtriangle:
+ if RetiensPart<nume:
+ if Reste>(nume-RetiensPart):
+ test:=uniformdeviate(1);
+ if test>0.5:
+ RetiensPart:=RetiensPart+1;
+ if Hachures:
+ drawoptions(withpen pencircle scaled Epaisseur);
+ draw hachurage(M[k] shifted(m*(Longueur+1cm,0)),90,0.2,0) withcolor ColTriangle;
+ else:
+ fill M[k] shifted(m*(Longueur+1cm,0)) withcolor ColTriangle;
+ fi;
+ fi;
+ else:
+ RetiensPart:=RetiensPart+1;
+ if Hachures:
+ drawoptions(withpen pencircle scaled Epaisseur);
+ draw hachurage(M[k] shifted(m*(Longueur+1cm,0)),90,0.2,0) withcolor ColTriangle;
+ else:
+ fill M[k] shifted(m*(Longueur+1cm,0)) withcolor ColTriangle;
+ fi;
+ fi;
+ fi;
+ Reste:=Reste-1;
+ endfor;
+ fi;
+ drawoptions(withpen pencircle scaled Epaisseur);
+ for l=0 upto m:
+ trace FondTriangle shifted(l*(Longueur+1cm,0));
+ endfor;
+ );
+ RetourFraction
+enddef;
+}%
+
\def\MPFractionTriangleCode{%
Longueur:=\useKV[ClesFraction]{Longueur};
nbparts:=\useKV[ClesFraction]{Parts};
@@ -245,7 +469,7 @@
trace hachurage(polygone(A,B,C) shifted(l*(Longueur+1cm,0)),90,0.2,0) withcolor ColTriangle;
drawoptions(withpen pencircle scaled Epaisseur);
else:
- remplis polygone(A,B,C) withcolor ColRectangle;
+ remplis polygone(A,B,C) withcolor ColTriangle;
fi;
fi;
for k=1 upto nbparts:
@@ -264,7 +488,13 @@
\ifluatex
\mplibforcehmode
\begin{mplibcode}
- \MPFractionTriangleCode
+ boolean Alea;
+ Alea=\useKV[ClesFraction]{Aleatoire};
+ if Alea:
+ \MPFractionTriangleCodeAlea;
+ else:
+ \MPFractionTriangleCode;
+ fi;
draw FractionTriangle(#1,#2);
\end{mplibcode}
\else
@@ -274,6 +504,117 @@
\fi
}%
+\def\MPFractionRectangleCodeAlea{%
+ Longueur=\useKV[ClesFraction]{Longueur};
+ Largeur=\useKV[ClesFraction]{Largeur};
+ color ColRectangle;
+ ColRectangle=\useKV[ClesFraction]{Couleur};
+ boolean Hachures,Reponse;
+ Reponse=\useKV[ClesFraction]{Reponse};
+ Hachures=\useKV[ClesFraction]{Hachures};
+ Epaisseur=\useKV[ClesFraction]{Epaisseur};
+ Multiple=\useKV[ClesFraction]{Multiple};
+ %
+ pair A,B,C,D,M[],N[],R[],S[];
+ A=(0,0);
+ B-A=(Longueur,0);
+ C-B=(0,Largeur);
+ D-C=A-B;
+ vardef FractionRectangle(expr nume,deno)=
+ m=nume div deno;
+ if (nume mod deno)=0:
+ m:=m-1;
+ fi;
+ numeric parts;
+ parts=(deno div Multiple);
+ for k=0 upto parts:
+ M[k]=(k/parts)[A,B];
+ N[k]=(k/parts)[D,C];
+ endfor;
+ if Multiple>1:
+ for k=0 upto Multiple:
+ R[k]=(k/Multiple)[A,D];
+ S[k]=(k/Multiple)[B,C];
+ endfor;
+ fi;
+ picture FondRectangle;
+ FondRectangle=image(%
+ path case[];
+ for k=0 upto Multiple-1:
+ for l=0 step Multiple until (deno-1):
+ case[k*(deno div Multiple)+(l div Multiple)]=(unitsquare xscaled (Multiple*abs(A-B)/deno) yscaled (abs(D-A)/Multiple)) shifted (((l/deno)[A,B]-A)+((k/Multiple)[A,D]-A));
+ trace case[k*(deno div Multiple)+(l div Multiple)];
+ endfor;
+ endfor;
+ );
+ picture RetourRectangle;
+ RetourRectangle=image(
+ Reste=((nume div deno)+1)*deno;
+ RetiensPart=0;
+ if Reponse:
+ if m>0:
+ for l=0 upto (m-1):
+ for k=0 upto deno-1:
+ if RetiensPart<nume:
+ if Reste>(nume-RetiensPart):
+ test:=uniformdeviate(1);
+ if test>0.5:
+ RetiensPart:=RetiensPart+1;
+ if Hachures:
+ drawoptions(withpen pencircle scaled Epaisseur);
+ draw hachurage(case[k] shifted(l*(Longueur+1cm,0)),45,0.25,0) withcolor ColRectangle;
+ else:
+ fill case[k] shifted(l*(Longueur+1cm,0)) withcolor ColRectangle;
+ fi;
+ fi;
+ else:
+ RetiensPart:=RetiensPart+1;
+ if Hachures:
+ drawoptions(withpen pencircle scaled Epaisseur);
+ draw hachurage(case[k] shifted(l*(Longueur+1cm,0)),45,0.25,0) withcolor ColRectangle;
+ else:
+ fill case[k] shifted(l*(Longueur+1cm,0)) withcolor ColRectangle;
+ fi;
+ fi;
+ fi;
+ Reste:=Reste-1;
+ endfor;
+ endfor;
+ fi;
+ for k=0 upto deno-1:
+ if RetiensPart<nume:
+ if Reste>(nume-RetiensPart):
+ test:=uniformdeviate(1);
+ if test>0.5:
+ RetiensPart:=RetiensPart+1;
+ if Hachures:
+ drawoptions(withpen pencircle scaled Epaisseur);
+ draw hachurage(case[k] shifted(m*(Longueur+1cm,0)),45,0.25,0) withcolor ColRectangle;
+ else:
+ fill case[k] shifted(m*(Longueur+1cm,0)) withcolor ColRectangle;
+ fi;
+ fi;
+ else:
+ RetiensPart:=RetiensPart+1;
+ if Hachures:
+ drawoptions(withpen pencircle scaled Epaisseur);
+ draw hachurage(case[k] shifted(m*(Longueur+1cm,0)),45,0.25,0) withcolor ColRectangle;
+ else:
+ fill case[k] shifted(m*(Longueur+1cm,0)) withcolor ColRectangle;
+ fi;
+ fi;
+ fi;
+ Reste:=Reste-1;
+ endfor;
+ fi;
+ for l=0 upto m:
+ trace FondRectangle shifted(l*(Longueur+1cm,0));
+ endfor;
+ );
+ RetourRectangle
+ enddef;
+}%
+
\def\MPFractionRectangleCode{%
Longueur=\useKV[ClesFraction]{Longueur};
Largeur=\useKV[ClesFraction]{Largeur};
@@ -382,7 +723,13 @@
\ifluatex%
\mplibforcehmode%
\begin{mplibcode}
- \MPFractionRectangleCode
+ boolean Alea;
+ Alea=\useKV[ClesFraction]{Aleatoire};
+ if Alea:
+ \MPFractionRectangleCodeAlea;
+ else:
+ \MPFractionRectangleCode;
+ fi;
trace FractionRectangle(#1,#2);
\end{mplibcode}
\else%
@@ -392,6 +739,101 @@
\fi%
}%
+\def\MPFractionDisqueCodeAlea{%
+ Rayon=\useKV[ClesFraction]{Rayon};
+ Epaisseur=\useKV[ClesFraction]{Epaisseur};
+ color ColDisque;
+ ColDisque=\useKV[ClesFraction]{Couleur};
+ boolean Hachures,Reponse;
+ Hachures=\useKV[ClesFraction]{Hachures};
+ Reponse:=\useKV[ClesFraction]{Reponse};
+ %
+ pair A,B[];
+ A=(0,0);
+ path cc,part[];
+ cc=cercles(A,Rayon);
+ vardef FractionDisque(expr nume,deno)=
+ for k=0 upto deno+1:
+ B[k]=pointarc(cc,(360/deno)*k);
+ endfor;
+ for k=0 upto deno-1:
+ part[k]=A--arccercle(B[k],B[k+1],A)--cycle;
+ endfor;
+ m=(nume div deno);
+ if (nume mod deno)=0:m:=m-1; fi;
+ picture RetourFraction;
+ RetourFraction=image(%
+ Reste=((nume div deno)+1)*deno;
+ RetiensPart=0;
+ if Reponse:
+ if m>0:
+ for l=0 upto (m-1):
+ for k=0 upto deno-1:
+ if RetiensPart<nume:
+ if Reste>(nume-RetiensPart):
+ test:=uniformdeviate(1);
+ if test>0.5:
+ RetiensPart:=RetiensPart+1;
+ if Hachures:
+ drawoptions(withpen pencircle scaled Epaisseur);
+ draw hachurage(part[k] shifted(l*(2*Rayon+1cm,0)),1.5*360/deno,0.25,0) withcolor ColDisque;
+ else:
+ fill part[k] shifted(l*(2*Rayon+1cm,0)) withcolor ColDisque;
+ fi;
+ fi;
+ else:
+ RetiensPart:=RetiensPart+1;
+ if Hachures:
+ drawoptions(withpen pencircle scaled Epaisseur);
+ draw hachurage(part[k] shifted(l*(2*Rayon+1cm,0)),1.5*360/deno,0.25,0) withcolor ColDisque;
+ else:
+ fill part[k] shifted(l*(2*Rayon+1cm,0)) withcolor ColDisque;
+ fi;
+ fi;
+ fi;
+ Reste:=Reste-1;
+ endfor;
+ endfor;
+ fi;
+ for k=0 upto deno-1:
+ if RetiensPart<nume:
+ if Reste>(nume-RetiensPart):
+ test:=uniformdeviate(1);
+ if test>0.5:
+ RetiensPart:=RetiensPart+1;
+ if Hachures:
+ drawoptions(withpen pencircle scaled Epaisseur);
+ draw hachurage(part[k] shifted(m*(2*Rayon+1cm,0)),1.5*360/deno,0.25,0) withcolor ColDisque;
+ else:
+ fill part[k] shifted(m*(2*Rayon+1cm,0)) withcolor ColDisque;
+ fi;
+ fi;
+ else:
+ RetiensPart:=RetiensPart+1;
+ if Hachures:
+ drawoptions(withpen pencircle scaled Epaisseur);
+ draw hachurage(part[k] shifted(m*(2*Rayon+1cm,0)),1.5*360/deno,0.25,0) withcolor ColDisque;
+ else:
+ fill part[k] shifted(m*(2*Rayon+1cm,0)) withcolor ColDisque;
+ fi;
+ fi;
+ fi;
+ Reste:=Reste-1;
+ endfor;
+ fi;
+ drawoptions(withpen pencircle scaled Epaisseur);
+ for l=0 upto m:
+ draw cc shifted(l*(2*Rayon+1cm,0));
+ for k=0 upto (deno-1):
+ draw segment(A,B[k]) shifted(l*(2*Rayon+1cm,0));
+ endfor;
+ endfor;
+ drawoptions();
+ );
+ RetourFraction
+ enddef;
+}%
+
\def\MPFractionDisqueCode{%
Rayon=\useKV[ClesFraction]{Rayon};
Epaisseur=\useKV[ClesFraction]{Epaisseur};
@@ -448,7 +890,13 @@
\ifluatex
\mplibforcehmode
\begin{mplibcode}
+ boolean Alea;
+ Alea=\useKV[ClesFraction]{Aleatoire};
+ if Alea:
+ \MPFractionDisqueCodeAlea;
+ else:
\MPFractionDisqueCode
+ fi;
trace FractionDisque(#1,#2);
\end{mplibcode}
\else
@@ -458,6 +906,115 @@
\fi
}
+\def\MPFractionSegmentCodeAlea{%
+ Longueur=\useKV[ClesFraction]{Longueur};
+ color ColSegment;
+ ColSegment=\useKV[ClesFraction]{Couleur};
+ boolean Hachures,Reponse;
+ Reponse=\useKV[ClesFraction]{Reponse};
+ Hachures=\useKV[ClesFraction]{Hachures};
+ Epaisseur=\useKV[ClesFraction]{Epaisseur};
+ %
+ pair A,C,B[];
+ A=(0,0);
+ C-A=(Longueur,0);
+ %
+ path part[];
+ %
+ vardef FractionSegment(expr nume,deno)=
+ for k=0 upto deno:
+ B[k]=(k/deno)[A,C];
+ endfor;
+ for k=0 upto deno-1:
+ part[k]=polygone(B[k]+u*(0,-0.15),B[k+1]+u*(0,-0.15),B[k+1]+u*(0,0.15),B[k]+u*(0,0.15));
+ endfor;
+ m=nume div deno;
+ picture RetourFraction;
+ RetourFraction=image(
+ Reste=((nume div deno)+1)*deno;
+ RetiensPart=0;
+ % Reponse
+ if Reponse:
+ if m>0:
+ for l=0 upto (m-1):
+ for k=0 upto deno-1:
+ if RetiensPart<nume:
+ if Reste>(nume-RetiensPart):
+ test:=uniformdeviate(1);
+ if test>0.5:
+ RetiensPart:=RetiensPart+1;
+ if Hachures:
+ drawoptions(withpen pencircle scaled Epaisseur);
+ draw hachurage(part[k] shifted(l*(Longueur+1cm,0)),120,0.2,0) withcolor ColSegment;
+ drawoptions();
+ else:
+ draw (segment(B[k],B[k+1]) shifted(l*(Longueur+1cm,0))) withpen pencircle scaled 2 withcolor ColSegment;
+ fi;
+ fi;
+ else:
+ RetiensPart:=RetiensPart+1;
+ if Hachures:
+ drawoptions(withpen pencircle scaled Epaisseur);
+ draw hachurage(part[k] shifted(l*(Longueur+1cm,0)),120,0.2,0) withcolor ColSegment;
+ drawoptions();
+ else:
+ draw (segment(B[k],B[k+1]) shifted(l*(Longueur+1cm,0))) withpen pencircle scaled 2 withcolor ColSegment;
+ fi;
+ fi;
+ fi;
+ Reste:=Reste-1;
+ endfor;
+ endfor;
+ fi;
+ for k=0 upto deno-1:
+ if RetiensPart<nume:
+ if Reste>(nume-RetiensPart):
+ test:=uniformdeviate(1);
+ if test>0.5:
+ RetiensPart:=RetiensPart+1;
+ if Hachures:
+ drawoptions(withpen pencircle scaled Epaisseur);
+ draw hachurage(part[k] shifted(m*(Longueur+1cm,0)),120,0.2,0) withcolor ColSegment;
+ drawoptions();
+ else:
+ draw (segment(B[k],B[k+1]) shifted(m*(Longueur+1cm,0))) withpen pencircle scaled 2 withcolor ColSegment;
+ fi;
+ fi;
+ else:
+ RetiensPart:=RetiensPart+1;
+ if Hachures:
+ drawoptions(withpen pencircle scaled Epaisseur);
+ draw hachurage(part[k] shifted(m*(Longueur+1cm,0)),120,0.2,0) withcolor ColSegment;
+ else:
+ draw (segment(B[k],B[k+1]) shifted(m*(Longueur+1cm,0))) withpen pencircle scaled 2 withcolor ColSegment;
+ fi;
+ fi;
+ fi;
+ Reste:=Reste-1;
+ endfor;
+ fi;
+ %fin Reponse
+ if Hachures:drawoptions(withpen pencircle scaled Epaisseur);fi;
+ % draw (segment(B[0],B[nume mod deno]) shifted(m*(Longueur+1cm,0)));
+ for l=0 upto m:
+ draw segment(A,C) shifted(l*(Longueur+1cm,0));
+ endfor;
+ marque_p:="tiretv";
+ for l=0 upto m-1:
+ for k=0 upto deno:
+ pointe(B[k] shifted(l*(Longueur+1cm,0)));
+ endfor;
+ endfor;
+ if (nume mod deno)<>0:
+ for k=0 upto deno:
+ pointe(B[k] shifted(m*(Longueur+1cm,0)));
+ endfor;
+ fi;
+ );
+ RetourFraction
+ enddef;
+}
+
\def\MPFractionSegmentCode{%
Longueur=\useKV[ClesFraction]{Longueur};
color ColSegment;
@@ -529,7 +1086,13 @@
\ifluatex
\mplibforcehmode
\begin{mplibcode}
+ boolean Alea;
+ Alea=\useKV[ClesFraction]{Aleatoire};
+ if Alea:
+ \MPFractionSegmentCodeAlea;
+ else:
\MPFractionSegmentCode
+ fi;
trace FractionSegment(#1,#2);
\end{mplibcode}
\else
Modified: trunk/Master/texmf-dist/tex/latex/profcollege/ProfCollege.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/profcollege/ProfCollege.sty 2024-09-03 20:31:10 UTC (rev 72180)
+++ trunk/Master/texmf-dist/tex/latex/profcollege/ProfCollege.sty 2024-09-03 20:31:38 UTC (rev 72181)
@@ -2,9 +2,9 @@
% licence : Released under the LaTeX Project Public License v1.3c
% or later, see http://www.latex-project.org/lppl.txtf
\NeedsTeXFormat{LaTeX2e}%
-\def\filedate{2024/08/27}%
+\def\filedate{2024/09/03}%
\let\PfCfiledate\filedate%
-\def\fileversion{0.99-A-h}%
+\def\fileversion{0.99-A-i}%
\let\PfCfileversion\fileversion%
\ProvidesPackage{ProfCollege}[\filedate\space v\fileversion\space Aide pour utiliser LaTeX au college]%
@@ -856,6 +856,7 @@
\def\PfCSymbolTimes{\times}%
\def\PfCSymbolDiv{\div}%
+\input{PfCCheque}
\input{PfCCalculsDetailles}
\input{PfCTableauDoubleEntree}
\input{PfCUrneProba}
More information about the tex-live-commits
mailing list.