summaryrefslogtreecommitdiff
path: root/macros/latex
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex')
-rw-r--r--macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/README7
-rw-r--r--macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/documentation/biblatex-manuscripts-philology-example.pdfbin36324 -> 36204 bytes
-rw-r--r--macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/documentation/biblatex-manuscripts-philology.pdfbin100109 -> 102294 bytes
-rw-r--r--macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/documentation/biblatex-manuscripts-philology.tex9
-rw-r--r--macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/english-manuscripts.lbx2
-rw-r--r--macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/french-manuscripts.lbx2
-rw-r--r--macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/italian-manuscripts.lbx2
-rw-r--r--macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/latin-manuscripts.lbx46
-rw-r--r--macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/manuscripts-NewBibliographyString.sty2
-rw-r--r--macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/manuscripts-noautoshorthand.bbx2
-rw-r--r--macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/manuscripts-noautoshorthand.dbx2
-rw-r--r--macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/manuscripts-shared.bbx3
-rw-r--r--macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/manuscripts-shared.dbx2
-rw-r--r--macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/manuscripts.bbx2
-rw-r--r--macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/manuscripts.dbx2
-rw-r--r--macros/latex/contrib/profcollege/doc/ProfCollege-doc.pdfbin9158838 -> 9283470 bytes
-rw-r--r--macros/latex/contrib/profcollege/latex/PfCCalisson.tex376
-rw-r--r--macros/latex/contrib/profcollege/latex/PfCCartesJeux.tex107
-rw-r--r--macros/latex/contrib/profcollege/latex/PfCDecDeci.tex251
-rw-r--r--macros/latex/contrib/profcollege/latex/PfCDessinGradue.tex189
-rw-r--r--macros/latex/contrib/profcollege/latex/PfCEngrenagesBase.tex164
-rw-r--r--macros/latex/contrib/profcollege/latex/PfCNombreAstral.tex49
-rw-r--r--macros/latex/contrib/profcollege/latex/PfCPapiers.tex559
-rw-r--r--macros/latex/contrib/profcollege/latex/PfCPavage.tex1216
-rw-r--r--macros/latex/contrib/profcollege/latex/PfCPavageAvecMotifImage.tex1040
-rw-r--r--macros/latex/contrib/profcollege/latex/PfCRLE.tex274
-rw-r--r--macros/latex/contrib/profcollege/latex/PfCRappelsFormules.tex56
-rw-r--r--macros/latex/contrib/profcollege/latex/PfCRepresenterFraction.tex1412
-rw-r--r--macros/latex/contrib/profcollege/latex/PfCSquaro.tex70
-rw-r--r--macros/latex/contrib/profcollege/latex/PfCSquaroaprioriold.tex107
-rw-r--r--macros/latex/contrib/profcollege/latex/PfCStatistiques.tex538
-rw-r--r--macros/latex/contrib/profcollege/latex/PfCTableauxUnites.tex97
-rw-r--r--macros/latex/contrib/profcollege/latex/PfCTortueBase.tex3
-rw-r--r--macros/latex/contrib/profcollege/latex/PfCVueCubes.tex2
-rw-r--r--macros/latex/contrib/profcollege/latex/ProfCollege.sty6
-rw-r--r--macros/latex/contrib/profcollege/metapost/PfCConstantes.mp16
-rw-r--r--macros/latex/contrib/profcollege/metapost/PfCScratch.mp5
-rw-r--r--macros/latex/contrib/srdp-mathematik/README.md2
-rw-r--r--macros/latex/contrib/srdp-mathematik/srdp-mathematik.pdfbin180732 -> 181160 bytes
-rw-r--r--macros/latex/contrib/srdp-mathematik/srdp-mathematik.sty44
-rw-r--r--macros/latex/contrib/srdp-mathematik/srdp-mathematik.tex9
41 files changed, 4216 insertions, 2459 deletions
diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/README b/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/README
index da94e9ad0d..cc650b3ee3 100644
--- a/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/README
+++ b/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/README
@@ -4,7 +4,7 @@ biblatex-manuscripts-philology
Biblatex style and datatools to describe manuscripts in the perspective of a critical edition of text.
This work contains:
-- The biblatex styles files:
+- The biblatex styles files:
- manuscripts.bbx
- manuscripts.dbx
- french-manuscripts.lbx
@@ -23,3 +23,8 @@ This work contains:
- This README file
All features can be requested in https://github.com/maieul/biblatex-manuscripts-philology/issues
+
+# Copyright
+
+Maïeul Rouquette 2014-…
+LaTeX Project Public Licence 1.3
diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/documentation/biblatex-manuscripts-philology-example.pdf b/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/documentation/biblatex-manuscripts-philology-example.pdf
index 4e4579b104..78ef54212d 100644
--- a/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/documentation/biblatex-manuscripts-philology-example.pdf
+++ b/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/documentation/biblatex-manuscripts-philology-example.pdf
Binary files differ
diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/documentation/biblatex-manuscripts-philology.pdf b/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/documentation/biblatex-manuscripts-philology.pdf
index 85aa0b6e56..f26a2f11e2 100644
--- a/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/documentation/biblatex-manuscripts-philology.pdf
+++ b/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/documentation/biblatex-manuscripts-philology.pdf
Binary files differ
diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/documentation/biblatex-manuscripts-philology.tex b/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/documentation/biblatex-manuscripts-philology.tex
index b67c426528..5d99b3c572 100644
--- a/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/documentation/biblatex-manuscripts-philology.tex
+++ b/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/documentation/biblatex-manuscripts-philology.tex
@@ -21,8 +21,8 @@
subtitle={New data types},
email={maieul <at> maieul <dot> net},
author={Maïeul Rouquette},
- revision={2.1.2},
- date={07/01/2020},
+ revision={2.1.4},
+ date={01/05/2023},
url={https://github.com/maieul/biblatex-manuscripts-philology}}
@@ -415,7 +415,10 @@ The version 2.0.0 adds some modification which could require modifications in yo
\begin{changelog}
-\begin{release}{2.1.2}{2019-01-07}
+\begin{release}{2.1.4}{2023-05-01}
+\item Add latin translation (Domenico Cufalo)
+\end{release}
+\begin{release}{2.1.2}{2020-01-07}
\item Fix bug when changing language in the middle of an handbook.
\end{release}
diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/english-manuscripts.lbx b/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/english-manuscripts.lbx
index e7fb481848..9793d945d1 100644
--- a/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/english-manuscripts.lbx
+++ b/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/english-manuscripts.lbx
@@ -12,7 +12,7 @@
%
% The Current Maintainer of this work is Maïeul Rouquette
% This work consists of the files manuscripts*.dbx, manuscripts*.bbx, manuscripts*.lbx
-\ProvidesFile{english-manuscripts.lbx}[2020/01/07 v2.1.2 manuscripts biblatex localisation]%
+\ProvidesFile{english-manuscripts.lbx}[2023/05/01 v2.1.4 manuscripts biblatex localisation]%
\InheritBibliographyStrings{english}
\InheritBibliographyExtras{english}
diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/french-manuscripts.lbx b/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/french-manuscripts.lbx
index 2b084281c6..cca1e27ade 100644
--- a/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/french-manuscripts.lbx
+++ b/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/french-manuscripts.lbx
@@ -12,7 +12,7 @@
%
% The Current Maintainer of this work is Maïeul Rouquette
% This work consists of the files manuscripts*.dbx, manuscripts*.bbx, manuscripts*.lbx
-\ProvidesFile{french-manuscripts.lbx}[2020/01/07 v2.1.2 manuscripts biblatex localisation]%
+\ProvidesFile{french-manuscripts.lbx}[2023/05/01 v2.1.4 manuscripts biblatex localisation]%
\InheritBibliographyStrings{french}
\InheritBibliographyExtras{french}
diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/italian-manuscripts.lbx b/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/italian-manuscripts.lbx
index 0faaa3a752..05a41e252a 100644
--- a/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/italian-manuscripts.lbx
+++ b/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/italian-manuscripts.lbx
@@ -12,7 +12,7 @@
%
% The Current Maintainer of this work is Maïeul Rouquette
% This work consists of the files manuscripts*.dbx, manuscripts*.bbx, manuscripts*.lbx
-\ProvidesFile{italian-manuscripts.lbx}[2020/01/07 v2.1.2 manuscripts biblatex localisation]%
+\ProvidesFile{italian-manuscripts.lbx}[2023/05/01 v2.1.4 manuscripts biblatex localisation]%
\InheritBibliographyStrings{italian}
\InheritBibliographyExtras{italian}
diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/latin-manuscripts.lbx b/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/latin-manuscripts.lbx
new file mode 100644
index 0000000000..12342bc460
--- /dev/null
+++ b/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/latin-manuscripts.lbx
@@ -0,0 +1,46 @@
+%% Copyright 2013-… Maïeul Rouquette
+%% Copyright 2023-… Domenico Cufalo
+%
+% This work may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either version 1.3
+% of this license or (at your option) any later version.
+% The latest version of this license is in
+% http://www.latex-project.org/lppl.txt
+% and version 1.3 or later is part of all distributions of LaTeX
+% version 2005/12/01 or later.
+%
+% This work has the LPPL maintenance status `maintained'.
+%
+% The Current Maintainer of this work is Maïeul Rouquette
+% The Current Maintainer of this latin locale is Domenico Cufalo
+% This work consists of the files manuscripts*.dbx, manuscripts*.bbx, manuscripts*.lbx
+\ProvidesFile{latin-manuscripts.lbx}[2023/05/01 v2.1.4 manuscripts biblatex localisation]%
+\InheritBibliographyStrings{italian}
+\InheritBibliographyExtras{italian}
+
+
+\DeclareBibliographyStrings{%
+ 1column = {{plaena pagina}{1\addnbspace col\adddot}},
+ 2column = {{binis columnis}{2\addnbspace col\adddot}},
+ annotation = {{adnotationes}{adnotationes}},
+ birch-bark = {{in foliis betulae scriptus}{in f\adddotspace betul\adddotspace scr\adddotspace}},
+ catalog = {{catalogus}{cat\adddot}},
+ contents = {{continens}{continens}},
+ folio = {{folius}{f\adddot}},
+ folios = {{folii}{ff\adddot}},
+ foliototal = {{folius}{f\adddot}},
+ foliototals = {{folii}{f\adddot}},
+ inflayer = {{scriptura inferior}{script\adddotspace inf\adddot}},
+ suplayer = {{scriptura superior}{script\adddotspace sup\adddot}},
+ origin = {{originem ducens ex}{orig\adddotspace duc\adddotspace ex}},
+ owner = {{possessor}{poss\adddot}},
+ palm-leaf = {{in foliis palmarum scriptus}{in f\adddotspace palm\adddotspace scr\adddotspace}},
+ paper = {{chartaceus}{chart\adddot}},
+ papyrus = {{papiraceus}{pap\adddot}},
+ parchment = {{membranaceus}{membr\adddot}},
+ pergament = {{membranaceus}{membr\adddot}},% Kept for ascendant compatibility, cf. https://github.com/maieul/biblatex-manuscripts-philology/issues/6
+ scribe = {{scriba}{scr\adddot}}
+}
+
+
+\endinput
diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/manuscripts-NewBibliographyString.sty b/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/manuscripts-NewBibliographyString.sty
index 9edd170fdf..762883bca0 100644
--- a/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/manuscripts-NewBibliographyString.sty
+++ b/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/manuscripts-NewBibliographyString.sty
@@ -1,4 +1,4 @@
-\ProvidesFile{manuscript-NewBibliographyString.sty}[2017/11/26 v1.12.3 manuscripts biblatex declaration of localisation string]%
+\ProvidesFile{manuscript-NewBibliographyString.sty}[2023/05/01 v2.1.4 manuscripts biblatex declaration of localisation string]%
\NewBibliographyString{1column}
diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/manuscripts-noautoshorthand.bbx b/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/manuscripts-noautoshorthand.bbx
index 066eeccce6..fd6f27de3f 100644
--- a/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/manuscripts-noautoshorthand.bbx
+++ b/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/manuscripts-noautoshorthand.bbx
@@ -12,7 +12,7 @@
%
% The Current Maintainer of this work is Maïeul Rouquette
% This work consists of the files manuscripts*.dbx, manuscripts*.bbx, manuscripts*.lbx
-\ProvidesFile{manuscripts-noautoshorthand.bbx}[2020/01/07 v2.1.2 biblatex bibliography style (MR)]%
+\ProvidesFile{manuscripts-noautoshorthand.bbx}[2023/05/01 v2.1.4 biblatex bibliography style (MR)]%
\RequireBibliographyStyle{manuscripts-shared}
diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/manuscripts-noautoshorthand.dbx b/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/manuscripts-noautoshorthand.dbx
index 43475e0c0f..c5a3b64a98 100644
--- a/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/manuscripts-noautoshorthand.dbx
+++ b/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/manuscripts-noautoshorthand.dbx
@@ -12,5 +12,5 @@
%
% The Current Maintainer of this work is Maïeul Rouquette
% This work consists of the files manuscripts*.dbx, manuscripts*.bbx, manuscripts*.lbx
-\ProvidesFile{manuscripts-noautoshorthand.dbx}[2020/01/07 v2.1.2 biblatex bibliography style (MR)]
+\ProvidesFile{manuscripts-noautoshorthand.dbx}[2023/05/01 v2.1.4 biblatex bibliography style (MR)]
\blx@inputonce{manuscripts-shared.dbx}{}{}{}{}{}
diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/manuscripts-shared.bbx b/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/manuscripts-shared.bbx
index 7208cfbad3..30956f07e8 100644
--- a/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/manuscripts-shared.bbx
+++ b/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/manuscripts-shared.bbx
@@ -13,7 +13,7 @@
% The Current Maintainer of this work is Maïeul Rouquette
% This work consists of the files manuscripts*.dbx, manuscripts*.bbx, manuscripts*.lbx
-\ProvidesFile{manuscripts-commons}[2020/01/07 v2.1.2 biblatex bibliography style (MR)]%
+\ProvidesFile{manuscripts-commons}[2023/05/01 v2.1.4 biblatex bibliography style (MR)]%
\ifdef{\biblatexmultipledm@bibstyle}
{\RequireBibliographyStyle{\biblatexmultipledm@bibstyle}}
@@ -300,6 +300,7 @@
\DeclareLanguageMapping{english}{english-manuscripts}
\DeclareLanguageMapping{french}{french-manuscripts}
\DeclareLanguageMapping{italian}{italian-manuscripts}
+\DeclareLanguageMapping{latin}{latin-manuscripts}
% 5.5 bibcheck
diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/manuscripts-shared.dbx b/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/manuscripts-shared.dbx
index acbb65b5f3..75760ad98b 100644
--- a/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/manuscripts-shared.dbx
+++ b/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/manuscripts-shared.dbx
@@ -12,7 +12,7 @@
%
% The Current Maintainer of this work is Maïeul Rouquette
% This work consists of the files manuscripts.dbx, manuscripts.bbx, french-manuscripts.lbx and english-manuscripts.lbx
-\ProvidesFile{manuscripts-shared.dbx}[2020/01/07 v2.1.2 biblatex bibliography style (MR)]%
+\ProvidesFile{manuscripts-shared.dbx}[2023/05/01 v2.1.4 biblatex bibliography style (MR)]%
\DeclareDatamodelEntrytypes{manuscript}
\DeclareDatamodelFields[type=field,datatype=literal]{%
catalog,
diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/manuscripts.bbx b/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/manuscripts.bbx
index e593d99d79..1c434b74cb 100644
--- a/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/manuscripts.bbx
+++ b/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/manuscripts.bbx
@@ -12,7 +12,7 @@
%
% The Current Maintainer of this work is Maïeul Rouquette
% This work consists of the files manuscripts*.dbx, manuscripts*.bbx, manuscripts*.lbx
-\ProvidesFile{manuscripts.bbx}[2020/01/07 v2.1.2 biblatex bibliography style (MR)]%
+\ProvidesFile{manuscripts.bbx}[2023/05/01 v2.1.4 biblatex bibliography style (MR)]%
\RequireBibliographyStyle{manuscripts-shared}
diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/manuscripts.dbx b/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/manuscripts.dbx
index c16712c749..80e5f266fc 100644
--- a/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/manuscripts.dbx
+++ b/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/manuscripts.dbx
@@ -12,5 +12,5 @@
%
% The Current Maintainer of this work is Maïeul Rouquette
% This work consists of the files manuscripts*.dbx, manuscripts*.bbx, manuscripts*.lbx
-\ProvidesFile{manuscripts.dbx}[2020/01/07 v2.1.2 biblatex bibliography style (MR)]
+\ProvidesFile{manuscripts.dbx}[2023/05/01 v2.1.4 biblatex bibliography style (MR)]
\blx@inputonce{manuscripts-shared.dbx}{}{}{}{}{}
diff --git a/macros/latex/contrib/profcollege/doc/ProfCollege-doc.pdf b/macros/latex/contrib/profcollege/doc/ProfCollege-doc.pdf
index 28279dff29..b4144010b6 100644
--- a/macros/latex/contrib/profcollege/doc/ProfCollege-doc.pdf
+++ b/macros/latex/contrib/profcollege/doc/ProfCollege-doc.pdf
Binary files differ
diff --git a/macros/latex/contrib/profcollege/latex/PfCCalisson.tex b/macros/latex/contrib/profcollege/latex/PfCCalisson.tex
index 08834c7311..08f3d91521 100644
--- a/macros/latex/contrib/profcollege/latex/PfCCalisson.tex
+++ b/macros/latex/contrib/profcollege/latex/PfCCalisson.tex
@@ -100,260 +100,144 @@
\BuildCalisson{\the\tokcalissonlistetracesg}{\the\tokcalissonlistetracesd}%
}%
+\def\BuildCalissonCode{%
+ boolean Solution;
+ Solution:=\useKV[Calisson]{Solution};
+ %
+ color CouleurSolution;
+ CouleurSolution:=\useKV[Calisson]{Couleur};
+ %
+ Rayon=\useKV[Calisson]{Rayon};
+ Taille=\useKV[Calisson]{Taille};
+ %
+ pair A,B,C,D,E,F,O;
+ O=(0,0);
+ path cc;
+ cc=cercles(O,Rayon);
+ D=pointarc(cc,30);
+ E=pointarc(cc,90);
+ F=pointarc(cc,150);
+ A=pointarc(cc,210);
+ B=pointarc(cc,270);
+ C=pointarc(cc,330);
+ path Gauche,Droit,Haut,Bas,TopGauche,BasDroit;
+ Gauche=F--A--B;
+ Droit=E--D--C;
+ Haut=F--E--D;
+ Bas=A--B--C;
+ TopGauche=E--F--A;
+ BasDroit=D--C--B;
+ %
+ pair Hor,Ver,Horn;
+ Hor=(1/Taille)[E,F];
+ Ver=rotation(Hor,E,60);
+ Horn=rotation(Hor,E,120);
+ % On positionne les points
+ pair M[];
+ n=0;
+ % Partie Gauche -> ok
+ for k=0 upto Taille-1:
+ for l=0 upto Taille:
+ n:=n+1;
+ M[n]=E+k*(Ver-E)+l*(Hor-E);
+ % dotlabel.top(decimal(n),M[n]);
+ endfor;
+ endfor;
+ for k=Taille upto 2*Taille-1:
+ for l=0 upto (2*Taille-1-k):
+ n:=n+1;
+ M[n]=E+k*(Ver-E)+l*(Hor-E);
+ % dotlabel.top(decimal(n),M[n]);
+ endfor;
+ endfor;
+ % Partie Droite -> ok
+ for k=1 upto Taille:
+ n:=n+1;
+ M[n]=E+k*(Horn-E);
+ % dotlabel.top(decimal(n),M[n]);
+ endfor;
+ for k=1 upto Taille-1:
+ for l=0 upto Taille:
+ n:=n+1;
+ M[n]=E+k*(Ver-E)+l*(Horn-E);
+ % dotlabel.top(decimal(n),M[n]);
+ endfor;
+ endfor;
+ for k=Taille upto 2*Taille-1:
+ for l=0 upto (2*Taille-1-k):
+ n:=n+1;
+ M[n]=E+k*(Ver-E)+l*(Horn-E);
+ % dotlabel.top(decimal(n),M[n]);
+ endfor;
+ endfor;
+ %
+ %
+ string Retiens;
+ Retiens="";
+ %
+ pair Depla;
+ Depla:=Hor;
+ %
+ vardef LesTracesg(text t)=
+ trace polygone(A,B,C,D,E,F) withpen pencircle scaled 2;
+ for k=1 upto 2*Taille-1:
+ trace (point(k*length Gauche/(2*Taille)) of Gauche)--(point(k*length Droit/(2*Taille)) of Droit) dashed evenly;
+ trace (point(k*length Haut/(2*Taille)) of Haut)--(point(k*length Bas/(2*Taille)) of Bas) dashed evenly;
+ trace (point(k*length TopGauche/(2*Taille)) of TopGauche)--(point(k*length BasDroit/(2*Taille)) of BasDroit) dashed evenly;
+ endfor;
+ n:=0;
+ for p_=t:
+ n:=n+1;
+ for d=1 upto 3:
+ Retiens:=substring(d-1,d) of p_;
+ if d=1:Depla:=Hor
+ elseif d=2:Depla:=Ver
+ else : Depla:=Horn
+ fi;
+ if (Retiens="0") or (Retiens="f"):
+ elseif Retiens="t":
+ trace (chemin(Depla,E) shifted (M[n]-E)) withpen pencircle scaled 2;
+ elseif Retiens="s":
+ if Solution:
+ trace (chemin(Depla,E) shifted (M[n]-E)) withpen pencircle scaled 2 withcolor CouleurSolution;
+ fi;
+ fi;
+ endfor;
+ endfor;
+ enddef;
+ %
+ vardef LesTracesd(text t)=
+ for p_=t:
+ n:=n+1;
+ for d=1 upto 3:
+ Retiens:=substring(d-1,d) of p_;
+ if d=1:Depla:=Horn
+ elseif d=2:Depla:=Ver
+ else : Depla:=Hor
+ fi;
+ if (Retiens="0") or (Retiens="f"):
+ elseif Retiens="t":
+ trace (chemin(Depla,E) shifted (M[n]-E)) withpen pencircle scaled 2;
+ elseif Retiens="s":
+ if Solution:
+ trace (chemin(Depla,E) shifted (M[n]-E)) withpen pencircle scaled 2 withcolor CouleurSolution;
+ fi;
+ fi;
+ endfor;
+ endfor;
+ enddef;
+}
+
\NewDocumentCommand\BuildCalisson{m m}{%
\ifluatex
\mplibforcehmode
\begin{mplibcode}
- boolean Solution;
- Solution:=\useKV[Calisson]{Solution};
-
- color CouleurSolution;
- CouleurSolution:=\useKV[Calisson]{Couleur};
-
- Rayon=\useKV[Calisson]{Rayon};
- Taille=\useKV[Calisson]{Taille};
-
- pair A,B,C,D,E,F,O;
- O=(0,0);
- path cc;
- cc=cercles(O,Rayon);
- D=pointarc(cc,30);
- E=pointarc(cc,90);
- F=pointarc(cc,150);
- A=pointarc(cc,210);
- B=pointarc(cc,270);
- C=pointarc(cc,330);
- trace polygone(A,B,C,D,E,F) withpen pencircle scaled 2;
- path Gauche,Droit,Haut,Bas,TopGauche,BasDroit;
- Gauche=F--A--B;
- Droit=E--D--C;
- Haut=F--E--D;
- Bas=A--B--C;
- TopGauche=E--F--A;
- BasDroit=D--C--B;
- for k=1 upto 2*Taille-1:
- trace (point(k*length Gauche/(2*Taille)) of Gauche)--(point(k*length Droit/(2*Taille)) of Droit) dashed evenly;
- trace (point(k*length Haut/(2*Taille)) of Haut)--(point(k*length Bas/(2*Taille)) of Bas) dashed evenly;
- trace (point(k*length TopGauche/(2*Taille)) of TopGauche)--(point(k*length BasDroit/(2*Taille)) of BasDroit) dashed evenly;
- endfor;
-
- pair Hor,Ver,Horn;
- Hor=(1/Taille)[E,F];
- Ver=rotation(Hor,E,60);
- Horn=rotation(Hor,E,120);
-
- % On positionne les points
- pair M[];
- n=0;
- %Partie Gauche -> ok
- for k=0 upto Taille-1:
- for l=0 upto Taille:
- n:=n+1;
- M[n]=E+k*(Ver-E)+l*(Hor-E);
- %dotlabel.top(decimal(n),M[n]);
- endfor;
- endfor;
- for k=Taille upto 2*Taille-1:
- for l=0 upto (2*Taille-1-k):
- n:=n+1;
- M[n]=E+k*(Ver-E)+l*(Hor-E);
- %dotlabel.top(decimal(n),M[n]);
- endfor;
- endfor;
- % Partie Droite -> ok
- for k=1 upto Taille:
- n:=n+1;
- M[n]=E+k*(Horn-E);
- %dotlabel.top(decimal(n),M[n]);
- endfor;
- for k=1 upto Taille-1:
- for l=0 upto Taille:
- n:=n+1;
- M[n]=E+k*(Ver-E)+l*(Horn-E);
- %dotlabel.top(decimal(n),M[n]);
- endfor;
- endfor;
- for k=Taille upto 2*Taille-1:
- for l=0 upto (2*Taille-1-k):
- n:=n+1;
- M[n]=E+k*(Ver-E)+l*(Horn-E);
- %dotlabel.top(decimal(n),M[n]);
- endfor;
- endfor;
- %
-
- string Retiens;
- Retiens="";
-
- pair Depla;
- Depla:=Hor;
-
- vardef LesTracesg(text t)=
- n:=0;
- for p_=t:
- n:=n+1;
- for d=1 upto 3:
- Retiens:=substring(d-1,d) of p_;
- if d=1:Depla:=Hor
- elseif d=2:Depla:=Ver
- else : Depla:=Horn
- fi;
- if (Retiens="0") or (Retiens="f"):
- elseif Retiens="t":
- trace (chemin(Depla,E) shifted (M[n]-E)) withpen pencircle scaled 2;
- elseif Retiens="s":
- if Solution:
- trace (chemin(Depla,E) shifted (M[n]-E)) withpen pencircle scaled 2 withcolor CouleurSolution;
- fi;
- fi;
- endfor;
- endfor;
- enddef;
-
- vardef LesTracesd(text t)=
- for p_=t:
- n:=n+1;
- for d=1 upto 3:
- Retiens:=substring(d-1,d) of p_;
- if d=1:Depla:=Horn
- elseif d=2:Depla:=Ver
- else : Depla:=Hor
- fi;
- if (Retiens="0") or (Retiens="f"):
- elseif Retiens="t":
- trace (chemin(Depla,E) shifted (M[n]-E)) withpen pencircle scaled 2;
- elseif Retiens="s":
- if Solution:
- trace (chemin(Depla,E) shifted (M[n]-E)) withpen pencircle scaled 2 withcolor CouleurSolution;
- fi;
- fi;
- endfor;
- endfor;
- enddef;
-
+ \BuildCalissonCode
LesTracesg(#1);
LesTracesd(#2);
\end{mplibcode}
\else
- \begin{mpost}[mpsettings={boolean Solution; Solution:=\useKV[Calisson]{Solution}; Rayon=\useKV[Calisson]{Rayon};Taille=\useKV[Calisson]{Taille};color CouleurSolution; CouleurSolution:=\useKV[Calisson]{Couleur};}]
- pair A,B,C,D,E,F,O;
- O=(0,0);
- path cc;
- cc=cercles(O,Rayon);
- D=pointarc(cc,30);
- E=pointarc(cc,90);
- F=pointarc(cc,150);
- A=pointarc(cc,210);
- B=pointarc(cc,270);
- C=pointarc(cc,330);
- trace polygone(A,B,C,D,E,F) withpen pencircle scaled 2;
- path Gauche,Droit,Haut,Bas,TopGauche,BasDroit;
- Gauche=F--A--B;
- Droit=E--D--C;
- Haut=F--E--D;
- Bas=A--B--C;
- TopGauche=E--F--A;
- BasDroit=D--C--B;
- for k=1 upto 2*Taille-1:
- trace (point(k*length Gauche/(2*Taille)) of Gauche)--(point(k*length Droit/(2*Taille)) of Droit) dashed evenly;
- trace (point(k*length Haut/(2*Taille)) of Haut)--(point(k*length Bas/(2*Taille)) of Bas) dashed evenly;
- trace (point(k*length TopGauche/(2*Taille)) of TopGauche)--(point(k*length BasDroit/(2*Taille)) of BasDroit) dashed evenly;
- endfor;
-
- pair Hor,Ver,Horn;
- Hor=(1/Taille)[E,F];
- Ver=rotation(Hor,E,60);
- Horn=rotation(Hor,E,120);
-
- % On positionne les points
- pair M[];
- n=0;
- %Partie Gauche -> ok
- for k=0 upto Taille-1:
- for l=0 upto Taille:
- n:=n+1;
- M[n]=E+k*(Ver-E)+l*(Hor-E);
- %dotlabel.top(decimal(n),M[n]);
- endfor;
- endfor;
- for k=Taille upto 2*Taille-1:
- for l=0 upto (2*Taille-1-k):
- n:=n+1;
- M[n]=E+k*(Ver-E)+l*(Hor-E);
- %dotlabel.top(decimal(n),M[n]);
- endfor;
- endfor;
- % Partie Droite -> ok
- for k=1 upto Taille:
- n:=n+1;
- M[n]=E+k*(Horn-E);
- %dotlabel.top(decimal(n),M[n]);
- endfor;
- for k=1 upto Taille-1:
- for l=0 upto Taille:
- n:=n+1;
- M[n]=E+k*(Ver-E)+l*(Horn-E);
- %dotlabel.top(decimal(n),M[n]);
- endfor;
- endfor;
- for k=Taille upto 2*Taille-1:
- for l=0 upto (2*Taille-1-k):
- n:=n+1;
- M[n]=E+k*(Ver-E)+l*(Horn-E);
- %dotlabel.top(decimal(n),M[n]);
- endfor;
- endfor;
- %
-
- string Retiens;
- Retiens="";
-
- pair Depla;
- Depla:=Hor;
-
- vardef LesTracesg(text t)=
- n:=0;
- for p_=t:
- n:=n+1;
- for d=1 upto 3:
- Retiens:=substring(d-1,d) of p_;
- if d=1:Depla:=Hor
- elseif d=2:Depla:=Ver
- else : Depla:=Horn
- fi;
- if (Retiens="0") or (Retiens="f"):
- elseif Retiens="t":
- trace (chemin(Depla,E) shifted (M[n]-E)) withpen pencircle scaled 2;
- elseif Retiens="s":
- if Solution:
- trace (chemin(Depla,E) shifted (M[n]-E)) withpen pencircle scaled 2 withcolor CouleurSolution;
- fi;
- fi;
- endfor;
- endfor;
- enddef;
-
- vardef LesTracesd(text t)=
- for p_=t:
- n:=n+1;
- for d=1 upto 3:
- Retiens:=substring(d-1,d) of p_;
- if d=1:Depla:=Horn
- elseif d=2:Depla:=Ver
- else : Depla:=Hor
- fi;
- if (Retiens="0") or (Retiens="f"):
- elseif Retiens="t":
- trace (chemin(Depla,E) shifted (M[n]-E)) withpen pencircle scaled 2;
- elseif Retiens="s":
- if Solution:
- trace (chemin(Depla,E) shifted (M[n]-E)) withpen pencircle scaled 2 withcolor CouleurSolution;
- fi;
- fi;
- endfor;
- endfor;
- enddef;
-
+ \begin{mpost}[mpsettings={\BuildCalissonCode}]
LesTracesg(#1);
LesTracesd(#2);
\end{mpost}
diff --git a/macros/latex/contrib/profcollege/latex/PfCCartesJeux.tex b/macros/latex/contrib/profcollege/latex/PfCCartesJeux.tex
index 100807c748..88b2e3a57b 100644
--- a/macros/latex/contrib/profcollege/latex/PfCCartesJeux.tex
+++ b/macros/latex/contrib/profcollege/latex/PfCCartesJeux.tex
@@ -8,7 +8,7 @@
text fill,%
width=\largeurcarte,%
height=\hauteurcarte,%
- arc=5pt,%
+ arc=\PfCRayonArc,%
overlay unbroken and first={%
\coordinate[yshift=-0.5\hauteurtitre] (A1) at (frame.north west);%
\coordinate[yshift=-0.5\hauteurtitre] (B1) at (frame.north east);%
@@ -39,6 +39,7 @@
}%
\newcommand\PfCTexteJai{J'ai}
+\newcommand\PfCTexteJesuis{Je suis\dots}
\newcommand\PfCTexteQuia{Qui a ?}
\makeatletter
@@ -49,7 +50,7 @@
text fill,%
width=\largeurcarte,%
height=\hauteurcarte,%
- arc=5pt,%
+ arc=\PfCRayonArc,%\useKV[Cards]{RayonArc},%
underlay={%
\ifboolKV[Cards]{BackgroundAv}{%
\begin{tcbclipinterior}
@@ -64,19 +65,33 @@
},%
overlay unbroken and first={%
\coordinate[yshift=-0.5\hauteurtitre] (A1) at (frame.north west);
- \coordinate[yshift=0\hauteurtitre] (S3) at (frame.center);
+ \ifboolKV[Cards]{Eleve}{%
+ \coordinate[yshift=0.1\hauteurcarte] (S3) at (frame.center);
+ \coordinate[yshift=-0.1\hauteurcarte] (S5) at (frame.center);
+ }{%
+ \coordinate (S3) at (frame.center);
+ \coordinate (S5) at (frame.center);
+ }%
\coordinate[yshift=3mm] (C3) at (frame.south);
\coordinate[xshift=\largeurcarte/2] (A3) at (A1);
+ %Partie Haute
\node[rounded corners, draw=black, rectangle,minimum height=1cm,text width=\largeurcarte-6mm,fill=TrameCouleur] (T1) at (A3){};
- \node[TexteCouleur] (T1a) at (T1){\Large \PfCTexteJai};
- \node[rounded corners, draw=black, rectangle,minimum height=1cm,text width=\largeurcarte-6mm,fill=TrameCouleur] (T2) at (S3){};
- \node[TexteCouleur] (T2a) at (T2){\Large \PfCTexteQuia};
+ \node[TexteCouleur] at (T1){\Large \PfCTexteJai};
\node[minimum height=1cm,text width=\largeurcarte-6mm] (PointTexte1) at ($(A3)!0.5!(S3)$) {\begin{minipage}{\largeurcarte-6mm}%
\begin{center}%
#1%
\end{center}%
- \end{minipage}};
- \node[minimum height=1cm,text width=\largeurcarte-6mm] (PointTexte2) at ($(C3)!0.5!(S3)$) {\begin{minipage}{\largeurcarte-6mm}%
+ \end{minipage}%
+ };
+ % Partie Milieu
+ \ifboolKV[Cards]{Eleve}{%
+ \node[rounded corners, draw=black, rectangle,minimum height=1cm,text width=\largeurcarte-6mm,fill=TrameCouleur] (T3) at (S3){};
+ \node[TexteCouleur] at (T3){\Large \PfCTexteJesuis};
+ }{}
+ % Partie Basse
+ \node[rounded corners, draw=black, rectangle,minimum height=1cm,text width=\largeurcarte-6mm,fill=TrameCouleur] (T2) at (S5){};
+ \node[TexteCouleur] at (T2){\Large \PfCTexteQuia};
+ \node[minimum height=1cm,text width=\largeurcarte-6mm] (PointTexte2) at ($(C3)!0.5!(S5)$) {\begin{minipage}{\largeurcarte-6mm}%
\begin{center}%
#2%
\end{center}%
@@ -85,16 +100,16 @@
colback=white
}%
%
-\newtcolorbox{MyboxJQAr}{%
+\newtcolorbox{MyboxJQAr}[1]{%
enhanced,%
nobeforeafter,%
left=0pt,right=0pt,top=0pt,%
text fill,%
width=\largeurcarte,%
height=\hauteurcarte,%
- arc=5pt,%
+ arc=\PfCRayonArc,%
underlay={%
- \ifboolKV[Cards]{BackgroundAv}{%
+ \ifboolKV[Cards]{BackgroundAr}{%
\begin{tcbclipinterior}
\node[anchor=center,opacity=1]
at (interior.center) {%
@@ -105,6 +120,18 @@
\end{tcbclipinterior}%
}{}%
},%
+ overlay unbroken and first={%
+ \ifboolKV[Cards]{AfficheTheme}{%
+ % \coordinate[yshift=-0.5\hauteurtitre] (A) at (frame.north);%
+ \coordinate[yshift=-2.5mm] (A) at (frame.north);%
+ \node[anchor=north,rounded corners,draw=black,rectangle,minimum height=1cm,text width=\largeurcarte-6mm,fill=TrameCouleur] at (A){\begin{minipage}{\largeurcarte-6mm}%
+ \begin{center}%
+ #1%
+ \end{center}%
+ \end{minipage}
+ };%
+ }{}%
+ },%
colback=white
}%
\makeatother
@@ -118,7 +145,7 @@
text fill,%
width=\largeurcarte,%
height=\hauteurcarte,%
- arc=5pt,%
+ arc=\PfCRayonArc,%
colback=white,%
underlay={%
\ifboolKV[Cards]{BackgroundAv}{%
@@ -151,7 +178,7 @@
text fill,%
width=\largeurcarte,%
height=\hauteurcarte,%
- arc=5pt,%
+ arc=\PfCRayonArc,%
colback=white,%
underlay={%
\ifboolKV[Cards]{BackgroundAr}{%
@@ -183,7 +210,7 @@
text fill,%
width=\largeurcarte,%
height=\hauteurcarte,%
- arc=5pt,%
+ arc=\PfCRayonArc,%
colback=white,%
#1
}%
@@ -197,6 +224,7 @@
\newlength{\margeh}%
\newlength{\margev}%
+\newlength{\PfCRayonArc}%
\newlength{\PfCCardsH}%pour retenir en cas de décalage sur une page paire
\newlength{\PfCCardsEcartH}%Pour décaler sur une page paire
@@ -233,6 +261,7 @@
\coordinate[xshift=\largeurcards] (D2) at (D1);%
\coordinate[xshift=\largeurcards] (C3) at (C2);%
\coordinate[xshift=\largeurcards] (D3) at (D2);%
+ \ifboolKV[Cards]{TrameVisible}{%
\draw (A)--(B);%
\draw (A1)--(B1);%
\draw (A2)--(B2);%
@@ -242,6 +271,7 @@
\draw (C1)--(D1);%
\draw (C2)--(D2);%
\draw (C3)--(D3);%
+ }{}
% point pour placer les cartes
\coordinate[xshift=\margeh+0.5\PfCCardsH,yshift=-0.5\PfCCardsV] (Carte1) at (A);%
\coordinate[xshift=\largeurcards,yshift=0mm] (Carte2) at (Carte1);%
@@ -301,11 +331,12 @@
}{}%
\setKVdefault[Cards]{Largeur=59,Hauteur=89,HauteurTheme=15,Marge=4,Landscape=false,Couleur=Cornsilk,Theme=Th\'eor\`eme\\de
- Pythagore,ThemeSol=Solution,Trame=false,Titre=false,NomTitre=Jeu 1,Loop,JaiQuia=false,BackgroundAv=false,BackgroundAr=false,ImageAv=4813762.jpg,ImageAr=4813762.jpg,AffichageSolution=true,SolutionSeule=false,%
+ 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 le trivial
Trivial=false,Symboles={\faInfinity,\faSignal,\faProjectDiagram,\faHiking,\faRuler,\faLockOpen}
}%
-
+\defKV[Cards]{ThemeJaiQuiA=\setKV[Cards]{AfficheTheme}}
+%
\NewDocumentCommand\Cartes{o +m}{%[2][]{%
\useKVdefault[Cards]%
\setKV[Cards]{#1}%
@@ -322,15 +353,16 @@
}{%
\setlength{\hauteurcarte}{\fpeval{\useKV[Cards]{Hauteur}-\useKV[Cards]{Marge}}mm}%
\setlength{\largeurcarte}{\fpeval{\useKV[Cards]{Largeur}-\useKV[Cards]{Marge}}mm}%
- \setlength{\largeurcards}{65mm}%
- \setlength{\hauteurcards}{95mm}%
+ \ifboolKV[Cards]{Jointes}{\setlength{\largeurcards}{\largeurcarte}}{\setlength{\largeurcards}{65mm}}%
+ \ifboolKV[Cards]{Jointes}{\setlength{\hauteurcards}{\hauteurcarte}}{\setlength{\hauteurcards}{95mm}}%
\setlength{\margeh}{(210mm-3\largeurcards)/2}%
- \setlength{\margev}{(297mm-3\hauteurcards)/2}%
+ \setlength{\margev}{(297mm-3\hauteurcards)/2}
}%
\setlength{\hauteurtitre}{\fpeval{\useKV[Cards]{HauteurTheme}}mm}%
\setlength{\largeurtitre}{\fpeval{(\useKV[Cards]{Largeur}-\useKV[Cards]{Marge}-9)/2}mm}%
\colorlet{TexteCouleur}{black}%
\colorlet{TrameCouleur}{\useKV[Cards]{Couleur}}%
+ \setlength{\PfCRayonArc}{\useKV[Cards]{RayonArc}}%
\ifboolKV[Cards]{Trivial}{%
\xdef\PfCListeSymbolTrivial{\useKV[Cards]{Symboles}}%
\setsepchar{,}\readlist*\ListeSymbolesTrivial{\PfCListeSymbolTrivial}%
@@ -442,20 +474,35 @@
\begin{Trame}
\multido{\i=1+1}{3}{%
\node at (Carte\i) {%
- \begin{MyboxJQAr}%
- \end{MyboxJQAr}%
+ \ifboolKV[Cards]{AfficheTheme}{%
+ \begin{MyboxJQAr}{\useKV[Cards]{ThemeJaiQuiA}}%
+ \end{MyboxJQAr}%
+ }{%
+ \begin{MyboxJQAr}{}%
+ \end{MyboxJQAr}%
+ }%
};%
}%
\multido{\i=4+1}{3}{%
\node at (Carte\i) {%
- \begin{MyboxJQAr}%
- \end{MyboxJQAr}%
+ \ifboolKV[Cards]{AfficheTheme}{%
+ \begin{MyboxJQAr}{\useKV[Cards]{ThemeJaiQuiA}}%
+ \end{MyboxJQAr}%
+ }{%
+ \begin{MyboxJQAr}{}%
+ \end{MyboxJQAr}%
+ }%
};%
}%
\multido{\i=7+1}{3}{%
\node at (Carte\i) {%
- \begin{MyboxJQAr}%
- \end{MyboxJQAr}%
+ \ifboolKV[Cards]{AfficheTheme}{%
+ \begin{MyboxJQAr}{\useKV[Cards]{ThemeJaiQuiA}}%
+ \end{MyboxJQAr}%
+ }{%
+ \begin{MyboxJQAr}{}%
+ \end{MyboxJQAr}%
+ }%
};%
}%
\end{Trame}%
@@ -466,9 +513,13 @@
%%
\end{MyboxJQ}%
\ifboolKV[Cards]{AffichageSolution}{%
- \begin{MyboxJQAr}%
- %%
- \end{MyboxJQAr}%
+ \ifboolKV[Cards]{AfficheTheme}{%
+ \begin{MyboxJQAr}{\useKV[Cards]{ThemeJaiQuiA}}%
+ \end{MyboxJQAr}%
+ }{%
+ \begin{MyboxJQAr}{}%
+ \end{MyboxJQAr}%
+ }%
}{}%
}%
}{%
diff --git a/macros/latex/contrib/profcollege/latex/PfCDecDeci.tex b/macros/latex/contrib/profcollege/latex/PfCDecDeci.tex
index 3e9cc7d1c8..31daba08fc 100644
--- a/macros/latex/contrib/profcollege/latex/PfCDecDeci.tex
+++ b/macros/latex/contrib/profcollege/latex/PfCDecDeci.tex
@@ -1,7 +1,7 @@
%%%
% Décomposition décimale
%%
-\setKVdefault[DecompDeci]{Parentheses,Colore=false,CouleurU=Blue,CouleurD=Red,CouleurC=Green,Fleches=false,Details=false}
+\setKVdefault[DecompDeci]{Parentheses,Colore=false,CouleurU=Blue,CouleurD=Red,CouleurC=Green,Fleches=false,Details=false,ResultatSeul=false,SansMul=false}
\newcounter{PfCNbDecDeci}
\setcounter{PfCNbDecDeci}{0}
@@ -26,125 +26,146 @@
\modulo{\fpeval{\PfCNombrePuisMax}}{3}%
\xintifboolexpr{\remainder==0}{%
\xdef\PfCDecDeciEcart{0}
- }{\xintifboolexpr{\remainder==1}{\xdef\PfCDecDeciEcart{1}}{\xdef\PfCDecDeciEcart{2}}}
- \ifboolKV[DecompDeci]{Fleches}{%
- \colorlet{oldcolor}{black}%
- % On affiche
- \begin{center}
- \xintFor* ##1 in {\xintSeq{1}{\fpeval{\PfCNombrePuisMax}}}\do{%
- \StrChar{#2}{##1}[\PfCNombreChiffre]%
+ }{\xintifboolexpr{\remainder==1}{\xdef\PfCDecDeciEcart{1}}{\xdef\PfCDecDeciEcart{2}}}%
+ %%%%
+ \ifboolKV[DecompDeci]{SansMul}{%
+ \ensuremath{%
+ \ifboolKV[DecompDeci]{ResultatSeul}{}{\num{#2}=}%
+ \xintFor* ##1 in {\xintSeq{1}{\fpeval{\PfCNombrePuisMax-\PfCRetiensPuis}}}\do{%
+ \StrChar{#2}{##1}[\PfCNombreChiffre]
\modulo{\fpeval{\PfCNombrePuisMax+\PfCDecDeciEcart--##1}}{3}%
- \xintifboolexpr{\remainder==0}{%
- \color{\useKV[DecompDeci]{CouleurU}}\tikzmarknode[anchor=south,inner ysep=2pt]{DDA-\thePfCNbDecDeci-##1}{\PfCNombreChiffre}{}\xintifForLast{}{\,\color{oldcolor}}}{%
- \xintifboolexpr{\remainder==1}{%
- \color{\useKV[DecompDeci]{CouleurC}}\tikzmarknode[anchor=south,inner ysep=2pt]{DDA-\thePfCNbDecDeci-##1}{\PfCNombreChiffre}{}}{%
- \color{\useKV[DecompDeci]{CouleurD}}\tikzmarknode[anchor=south,inner ysep=2pt]{DDA-\thePfCNbDecDeci-##1}{\PfCNombreChiffre}{}%
- }%
+ % \colorlet{oldcolor}{.}
+ %\xintifboolexpr{\remainder==0}{\color{\useKV[DecompDeci]{CouleurU}}}{%
+ % \xintifboolexpr{\remainder==1}{\color{\useKV[DecompDeci]{CouleurC}}}{%
+ % \color{\useKV[DecompDeci]{CouleurD}}%
+ % }%
+ %}%
+ \xintifboolexpr{\PfCNombreChiffre==0}{}{%
+ \num{\fpeval{\PfCNombreChiffre*10^(\PfCNombrePuisMax-##1)}}%\color{oldcolor}%
+ \xintifForLast{}{+}%
}%
- }\color{oldcolor}%
-
- \vspace*{3em}
-
- \ifboolKV[DecompDeci]{Details}{%
+ }%
+ }%
+ }{%
+ \ifboolKV[DecompDeci]{Fleches}{%
+ \colorlet{oldcolor}{black}%
+ % On affiche
+ \begin{center}
+ \xintFor* ##1 in {\xintSeq{1}{\fpeval{\PfCNombrePuisMax}}}\do{%
+ \StrChar{#2}{##1}[\PfCNombreChiffre]%
+ \modulo{\fpeval{\PfCNombrePuisMax+\PfCDecDeciEcart--##1}}{3}%
+ \xintifboolexpr{\remainder==0}{%
+ \color{\useKV[DecompDeci]{CouleurU}}\tikzmarknode[anchor=south,inner ysep=2pt]{DDA-\thePfCNbDecDeci-##1}{\PfCNombreChiffre}{}\xintifForLast{}{\,\color{oldcolor}}}{%
+ \xintifboolexpr{\remainder==1}{%
+ \color{\useKV[DecompDeci]{CouleurC}}\tikzmarknode[anchor=south,inner ysep=2pt]{DDA-\thePfCNbDecDeci-##1}{\PfCNombreChiffre}{}}{%
+ \color{\useKV[DecompDeci]{CouleurD}}\tikzmarknode[anchor=south,inner ysep=2pt]{DDA-\thePfCNbDecDeci-##1}{\PfCNombreChiffre}{}%
+ }%
+ }%
+ }\color{oldcolor}%
+
+ \vspace*{3em}
+
+ \ifboolKV[DecompDeci]{Details}{%
+ \ensuremath{%
+ \xintFor* ##1 in {\xintSeq{1}{\fpeval{\PfCNombrePuisMax-\PfCRetiensPuis}}}\do{%
+ \StrChar{#2}{##1}[\PfCNombreChiffre]
+ \modulo{\fpeval{\PfCNombrePuisMax+\PfCDecDeciEcart--##1}}{3}%
+ \colorlet{oldcolor}{.}
+ \xintifboolexpr{\remainder==0}{\color{\useKV[DecompDeci]{CouleurU}}}{%
+ \xintifboolexpr{\remainder==1}{\color{\useKV[DecompDeci]{CouleurC}}}{%
+ \color{\useKV[DecompDeci]{CouleurD}}%
+ }%
+ }%
+ \xintifboolexpr{\PfCNombreChiffre==0}{}{%
+ \tikzmarknode[anchor=north,inner ysep=2pt]{DDC-\thePfCNbDecDeci-##1}{\boxed{\num{\fpeval{\PfCNombreChiffre*10^(\PfCNombrePuisMax-##1)}}}}\color{oldcolor}%
+ \xintifForLast{}{+}%
+ }%
+ }%
+ }%
+
+ \vspace*{3em}
+
+ }{}%
+
\ensuremath{%
\xintFor* ##1 in {\xintSeq{1}{\fpeval{\PfCNombrePuisMax-\PfCRetiensPuis}}}\do{%
\StrChar{#2}{##1}[\PfCNombreChiffre]
- \modulo{\fpeval{\PfCNombrePuisMax+\PfCDecDeciEcart--##1}}{3}%
- \colorlet{oldcolor}{.}
- \xintifboolexpr{\remainder==0}{\color{\useKV[DecompDeci]{CouleurU}}}{%
- \xintifboolexpr{\remainder==1}{\color{\useKV[DecompDeci]{CouleurC}}}{%
- \color{\useKV[DecompDeci]{CouleurD}}%
- }%
- }%
\xintifboolexpr{\PfCNombreChiffre==0}{}{%
- \tikzmarknode[anchor=north,inner ysep=2pt]{DDC-\thePfCNbDecDeci-##1}{\boxed{\num{\fpeval{\PfCNombreChiffre*10^(\PfCNombrePuisMax-##1)}}}}\color{oldcolor}%
+ \modulo{\fpeval{\PfCNombrePuisMax+\PfCDecDeciEcart--##1}}{3}%
+ \colorlet{oldcolor}{.}
+ \xintifboolexpr{\remainder==0}{\color{\useKV[DecompDeci]{CouleurU}}}{%
+ \xintifboolexpr{\remainder==1}{\color{\useKV[DecompDeci]{CouleurC}}}{%
+ \color{\useKV[DecompDeci]{CouleurD}}%
+ }%
+ }%
+ \tikzmarknode[anchor=north,inner ysep=2pt]{DDB-\thePfCNbDecDeci-##1}{\boxed{\PfCNombreChiffre\times\num{\fpeval{10^(\PfCNombrePuisMax-##1)}}}}{}\color{oldcolor}%
\xintifForLast{}{+}%
}%
}%
}%
-
- \vspace*{3em}
-
- }{}%
-
- \ensuremath{%
+ \end{center}
+ \begin{tikzpicture}[remember picture,overlay]
\xintFor* ##1 in {\xintSeq{1}{\fpeval{\PfCNombrePuisMax-\PfCRetiensPuis}}}\do{%
- \StrChar{#2}{##1}[\PfCNombreChiffre]
- \xintifboolexpr{\PfCNombreChiffre==0}{}{%
- \modulo{\fpeval{\PfCNombrePuisMax+\PfCDecDeciEcart--##1}}{3}%
- \colorlet{oldcolor}{.}
- \xintifboolexpr{\remainder==0}{\color{\useKV[DecompDeci]{CouleurU}}}{%
- \xintifboolexpr{\remainder==1}{\color{\useKV[DecompDeci]{CouleurC}}}{%
- \color{\useKV[DecompDeci]{CouleurD}}%
- }%
+ \StrChar{#2}{##1}[\PfCNombreChiffre]%
+ \modulo{\fpeval{\PfCNombrePuisMax+\PfCDecDeciEcart--##1}}{3}%
+ \xintifboolexpr{\remainder==0}{%
+ \colorlet{PfCDecDeciColor}{\useKV[DecompDeci]{CouleurU}}}{%
+ \xintifboolexpr{\remainder==1}{%
+ \colorlet{PfCDecDeciColor}{\useKV[DecompDeci]{CouleurC}}}{%
+ \colorlet{PfCDecDeciColor}{\useKV[DecompDeci]{CouleurD}}%
}%
- \tikzmarknode[anchor=north,inner ysep=2pt]{DDB-\thePfCNbDecDeci-##1}{\boxed{\PfCNombreChiffre\times\num{\fpeval{10^(\PfCNombrePuisMax-##1)}}}}{}\color{oldcolor}%
- \xintifForLast{}{+}%
}%
- }%
- }%
- \end{center}
- \begin{tikzpicture}[remember picture,overlay]
- \xintFor* ##1 in {\xintSeq{1}{\fpeval{\PfCNombrePuisMax-\PfCRetiensPuis}}}\do{%
- \StrChar{#2}{##1}[\PfCNombreChiffre]%
- \modulo{\fpeval{\PfCNombrePuisMax+\PfCDecDeciEcart--##1}}{3}%
- \xintifboolexpr{\remainder==0}{%
- \colorlet{PfCDecDeciColor}{\useKV[DecompDeci]{CouleurU}}}{%
- \xintifboolexpr{\remainder==1}{%
- \colorlet{PfCDecDeciColor}{\useKV[DecompDeci]{CouleurC}}}{%
- \colorlet{PfCDecDeciColor}{\useKV[DecompDeci]{CouleurD}}%
+ \ifboolKV[DecompDeci]{Details}{%
+ \xintifboolexpr{\PfCNombreChiffre>0}{%
+ \draw[-stealth,PfCDecDeciColor] (pic cs:DDA-\thePfCNbDecDeci-##1) to (pic cs:DDC-\thePfCNbDecDeci-##1);
+ \node (DDD-\thePfCNbDecDeci-##1) at ($(pic cs:DDC-\thePfCNbDecDeci-##1)!0.35!(pic cs:DDB-\thePfCNbDecDeci-##1)$) {};
+ \draw[-stealth,PfCDecDeciColor] (DDD-\thePfCNbDecDeci-##1) to (pic cs:DDB-\thePfCNbDecDeci-##1);
+ }{}%
+ }{%
+ \xintifboolexpr{\PfCNombreChiffre>0}{%
+ \draw[-stealth,PfCDecDeciColor] (pic cs:DDA-\thePfCNbDecDeci-##1) to (pic cs:DDB-\thePfCNbDecDeci-##1);
+ }{}%
}%
}%
- \ifboolKV[DecompDeci]{Details}{%
- \xintifboolexpr{\PfCNombreChiffre>0}{%
- \draw[-stealth,PfCDecDeciColor] (pic cs:DDA-\thePfCNbDecDeci-##1) to (pic cs:DDC-\thePfCNbDecDeci-##1);
- \node (DDD-\thePfCNbDecDeci-##1) at ($(pic cs:DDC-\thePfCNbDecDeci-##1)!0.35!(pic cs:DDB-\thePfCNbDecDeci-##1)$) {};
- \draw[-stealth,PfCDecDeciColor] (DDD-\thePfCNbDecDeci-##1) to (pic cs:DDB-\thePfCNbDecDeci-##1);
- }{}%
- }{%
- \xintifboolexpr{\PfCNombreChiffre>0}{%
- \draw[-stealth,PfCDecDeciColor] (pic cs:DDA-\thePfCNbDecDeci-##1) to (pic cs:DDB-\thePfCNbDecDeci-##1);
- }{}%
- }%
- }%
- \end{tikzpicture}
- }{%
- \ifboolKV[DecompDeci]{Colore}{%
- \colorlet{oldcolor}{black}%
- \ensuremath{%
- \xintFor* ##1 in {\xintSeq{1}{\fpeval{\PfCNombrePuisMax}}}\do{%
- \StrChar{#2}{##1}[\PfCNombreChiffre]%
- \modulo{\fpeval{\PfCNombrePuisMax+\PfCDecDeciEcart--##1}}{3}%
- \xintifboolexpr{\remainder==0}{\color{\useKV[DecompDeci]{CouleurU}}\PfCNombreChiffre\xintifForLast{}{\,\color{oldcolor}}}{%
- \xintifboolexpr{\remainder==1}{\color{\useKV[DecompDeci]{CouleurC}}\PfCNombreChiffre}{%
- \color{\useKV[DecompDeci]{CouleurD}}\PfCNombreChiffre%
+ \end{tikzpicture}
+ }{%
+ \ifboolKV[DecompDeci]{Colore}{%
+ \colorlet{oldcolor}{black}%
+ \ensuremath{%
+ \xintFor* ##1 in {\xintSeq{1}{\fpeval{\PfCNombrePuisMax}}}\do{%
+ \StrChar{#2}{##1}[\PfCNombreChiffre]%
+ \modulo{\fpeval{\PfCNombrePuisMax+\PfCDecDeciEcart--##1}}{3}%
+ \xintifboolexpr{\remainder==0}{\color{\useKV[DecompDeci]{CouleurU}}\PfCNombreChiffre\xintifForLast{}{\,\color{oldcolor}}}{%
+ \xintifboolexpr{\remainder==1}{\color{\useKV[DecompDeci]{CouleurC}}\PfCNombreChiffre}{%
+ \color{\useKV[DecompDeci]{CouleurD}}\PfCNombreChiffre%
+ }%
}%
- }%
- }\color{oldcolor}%
- =
- \xintFor* ##1 in {\xintSeq{1}{\fpeval{\PfCNombrePuisMax-\PfCRetiensPuis}}}\do{%
- \StrChar{#2}{##1}[\PfCNombreChiffre]
- \xintifboolexpr{\PfCNombreChiffre==0}{}{%
- \modulo{\fpeval{\PfCNombrePuisMax-\PfCRetiensPuis-##1}}{3}
- \colorlet{oldcolor}{.}
- \xintifboolexpr{\remainder==0}{\color{\useKV[DecompDeci]{CouleurU}}}{%
- \xintifboolexpr{\remainder==1}{\color{\useKV[DecompDeci]{CouleurD}}}{%
- \color{\useKV[DecompDeci]{CouleurC}}%
+ }\color{oldcolor}%
+ =
+ \xintFor* ##1 in {\xintSeq{1}{\fpeval{\PfCNombrePuisMax-\PfCRetiensPuis}}}\do{%
+ \StrChar{#2}{##1}[\PfCNombreChiffre]
+ \xintifboolexpr{\PfCNombreChiffre==0}{}{%
+ \modulo{\fpeval{\PfCNombrePuisMax-\PfCRetiensPuis-##1}}{3}
+ \colorlet{oldcolor}{.}
+ \xintifboolexpr{\remainder==0}{\color{\useKV[DecompDeci]{CouleurU}}}{%
+ \xintifboolexpr{\remainder==1}{\color{\useKV[DecompDeci]{CouleurD}}}{%
+ \color{\useKV[DecompDeci]{CouleurC}}%
+ }%
}%
+ \boxed{\PfCNombreChiffre\times\num{\fpeval{10^(\PfCNombrePuisMax-##1)}}}\color{oldcolor}%
+ \xintifForLast{}{+}%
}%
- \boxed{\PfCNombreChiffre\times\num{\fpeval{10^(\PfCNombrePuisMax-##1)}}}\color{oldcolor}%
- \xintifForLast{}{+}%
}%
- }%
- }
- }{%
- \ensuremath{%
- \num{#2}=
- \xintFor* ##1 in {\xintSeq{1}{\fpeval{\PfCNombrePuisMax-\PfCRetiensPuis}}}\do{%
- \StrChar{#2}{##1}[\PfCNombreChiffre]
- \xintifboolexpr{\PfCNombreChiffre==0}{}{%
- \ifboolKV[DecompDeci]{Parentheses}{\left(}{}\PfCNombreChiffre\times\num{\fpeval{10^(\PfCNombrePuisMax-##1)}}\ifboolKV[DecompDeci]{Parentheses}{\right)}{}%
- \xintifForLast{}{+}%
+ }
+ }{%
+ \ensuremath{%
+ \ifboolKV[DecompDeci]{ResultatSeul}{}{\num{#2}=}%
+ \xintFor* ##1 in {\xintSeq{1}{\fpeval{\PfCNombrePuisMax-\PfCRetiensPuis}}}\do{%
+ \StrChar{#2}{##1}[\PfCNombreChiffre]
+ \xintifboolexpr{\PfCNombreChiffre==0}{}{%
+ \ifboolKV[DecompDeci]{Parentheses}{\left(}{}\PfCNombreChiffre\times\num{\fpeval{10^(\PfCNombrePuisMax-##1)}}\ifboolKV[DecompDeci]{Parentheses}{\right)}{}%
+ \xintifForLast{}{+}%
+ }%
}%
}%
}%
@@ -163,13 +184,27 @@
\xdef\PfCRetiensPuis{\fpeval{\PfCRetiensPuis+1}}%
}{}%
}%
- \ensuremath{%
- \num{#2}=
- \xintFor* ##1 in {\xintSeq{1}{\PfCNombrePuisMax-\PfCRetiensPuis}}\do{%
- \StrChar{\PfCRetiensNombreEntier}{##1}[\PfCNombreChiffre]
- \xintifboolexpr{\PfCNombreChiffre==0}{}{%
- \ifboolKV[DecompDeci]{Parentheses}{\left(}{}\PfCNombreChiffre\times\num{\fpeval{10^(\PfCNombrePuisMax-##1-\PfCPuisDeci-1)}}\ifboolKV[DecompDeci]{Parentheses}{\right)}{}%
- \xintifForLast{}{+}%
+ %%
+ \ifboolKV[DecompDeci]{SansMul}{%
+ \ensuremath{%
+ \ifboolKV[DecompDeci]{ResultatSeul}{}{\num{#2}=}%
+ \xintFor* ##1 in {\xintSeq{1}{\PfCNombrePuisMax-\PfCRetiensPuis}}\do{%
+ \StrChar{\PfCRetiensNombreEntier}{##1}[\PfCNombreChiffre]
+ \xintifboolexpr{\PfCNombreChiffre==0}{}{%
+ \num{\fpeval{\PfCNombreChiffre*10^(\PfCNombrePuisMax-##1-\PfCPuisDeci-1)}}%
+ \xintifForLast{}{+}%
+ }%
+ }%
+ }%
+ }{%
+ \ensuremath{%
+ \ifboolKV[DecompDeci]{ResultatSeul}{}{\num{#2}=}%
+ \xintFor* ##1 in {\xintSeq{1}{\PfCNombrePuisMax-\PfCRetiensPuis}}\do{%
+ \StrChar{\PfCRetiensNombreEntier}{##1}[\PfCNombreChiffre]
+ \xintifboolexpr{\PfCNombreChiffre==0}{}{%
+ \ifboolKV[DecompDeci]{Parentheses}{\left(}{}\PfCNombreChiffre\times\num{\fpeval{10^(\PfCNombrePuisMax-##1-\PfCPuisDeci-1)}}\ifboolKV[DecompDeci]{Parentheses}{\right)}{}%
+ \xintifForLast{}{+}%
+ }%
}%
}%
}%
diff --git a/macros/latex/contrib/profcollege/latex/PfCDessinGradue.tex b/macros/latex/contrib/profcollege/latex/PfCDessinGradue.tex
index 682572bfc1..3bfacac68c 100644
--- a/macros/latex/contrib/profcollege/latex/PfCDessinGradue.tex
+++ b/macros/latex/contrib/profcollege/latex/PfCDessinGradue.tex
@@ -4,69 +4,76 @@
\setKVdefault[DessinGradue]{Lignes=10,Debut=-5,Fin=5,Pas=10,Solution=false,EcartVertical=1.5,LignesIdentiques,Longueur=10,Echelle=1,Droites=false,DemiDroites=false,OrigineVariable=false,Code=false}
\defKV[DessinGradue]{Traces=\setKV[DessinGradue]{Code}}%
+\def\TraceDessinGradueCompletCode{%
+ % Paramètres
+ LongueurLigne=\useKV[DessinGradue]{Longueur};
+ EcartVertical=\useKV[DessinGradue]{EcartVertical};
+ Pas:=\useKV[DessinGradue]{Pas};
+ NbLignes=\useKV[DessinGradue]{Lignes};
+ Echelle=\useKV[DessinGradue]{Echelle};
+ Debut:=\useKV[DessinGradue]{Debut};
+ Fin:=\useKV[DessinGradue]{Fin};
+ %
+ boolean Solution,Droites,DemiDroites,LignesIdentiques,OrigineVariable,Code;
+ Solution=\useKV[DessinGradue]{Solution};
+ LignesIdentiques:=\useKV[DessinGradue]{LignesIdentiques};
+ OrigineVariable:=\useKV[DessinGradue]{OrigineVariable};
+ Droites=\useKV[DessinGradue]{Droites};
+ DemiDroites=\useKV[DessinGradue]{DemiDroites};
+ Code=\useKV[DessinGradue]{Code};
+ vardef EffectuerLesTraces=
+ if Code:
+ \useKV[DessinGradue]{Traces};
+ fi;
+ enddef;
+ %
+ pair La,Lb,Lab[];
+ pair A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,A',B',C',D',E',F',G',H',I',J',K',L',M',N',O',P',Q',R',S',T',U',V',W',X',Y',Z',A'',B'',C'',D'',E'',F'',G'',H'',I'',J'',K'',L'',M'',N'',O'',P'',Q'',R'',S'',T'',U'',V'',W'',X'',Y'',Z'';
+ %
+ La=(0,0);
+ Lb-La=u*(LongueurLigne,0);
+ %
+ % On définit une fonction pour tracer les lignes en fonction du pas "Partage"
+ vardef TraceLignes(expr Partage)=
+ save RecupLigne;
+ picture RecupLigne;
+ RecupLigne=image(
+ if Droites:
+ drawarrow 1.05[Lb,La]--1.05[La,Lb];
+ elseif DemiDroites:
+ drawarrow La--1.05[La,Lb];
+ else:
+ trace segment(La,Lb);
+ fi;
+ for kl=0 upto Partage:
+ Lab[kl]:=(kl/Partage)[La,Lb];
+ trace (Lab[kl]+u*(0,-0.1))--(Lab[kl]+u*(0,0.1));
+ endfor;
+ );
+ RecupLigne
+ enddef;
+ % On définit une fonction pour nommer les points nécessaires.
+ vardef DefinirPoints(text t)=
+ numeric nblignes,nbpas;
+ n:=0;
+ for p_=t:
+ n:=n+1;
+ if (n mod 3)=1:
+ nblignes:=p_;
+ elseif (n mod 3)=2:
+ nbpas:=p_;
+ elseif (n mod 3)=0:
+ p_=(nbpas/TotalPas[nblignes])[La,Lb] shifted(u*(0,(nblignes-1)*(-EcartVertical)));
+ fi;
+ endfor;
+ enddef;
+}
+
\def\TraceDessinGradueComplet#1#2#3{%
\ifluatex
\mplibforcehmode
\begin{mplibcode}
- % Paramètres
- LongueurLigne=\useKV[DessinGradue]{Longueur};
- EcartVertical=\useKV[DessinGradue]{EcartVertical};
- Pas:=\useKV[DessinGradue]{Pas};
- NbLignes=\useKV[DessinGradue]{Lignes};
- Echelle=\useKV[DessinGradue]{Echelle};
- Debut:=\useKV[DessinGradue]{Debut};
- Fin:=\useKV[DessinGradue]{Fin};
-
- boolean Solution,Droites,DemiDroites,LignesIdentiques,OrigineVariable,Code;
- Solution=\useKV[DessinGradue]{Solution};
- LignesIdentiques:=\useKV[DessinGradue]{LignesIdentiques};
- OrigineVariable:=\useKV[DessinGradue]{OrigineVariable};
- Droites=\useKV[DessinGradue]{Droites};
- DemiDroites=\useKV[DessinGradue]{DemiDroites};
- Code=\useKV[DessinGradue]{Code};
-
- pair La,Lb,Lab[];
- pair A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,A',B',C',D',E',F',G',H',I',J',K',L',M',N',O',P',Q',R',S',T',U',V',W',X',Y',Z',A'',B'',C'',D'',E'',F'',G'',H'',I'',J'',K'',L'',M'',N'',O'',P'',Q'',R'',S'',T'',U'',V'',W'',X'',Y'',Z'';
-
- La=(0,0);
- Lb-La=u*(\useKV[DessinGradue]{Longueur},0);
-
- % On définit une fonction pour tracer les lignes en fonction du pas "Partage"
- vardef TraceLignes(expr Partage)=
- save RecupLigne;
- picture RecupLigne;
- RecupLigne=image(
- if \useKV[DessinGradue]{Droites}:
- drawarrow 1.05[Lb,La]--1.05[La,Lb];
- elseif \useKV[DessinGradue]{DemiDroites}:
- drawarrow La--1.05[La,Lb];
- else:
- trace segment(La,Lb);
- fi;
- for kl=0 upto Partage:
- Lab[kl]:=(kl/Partage)[La,Lb];
- trace (Lab[kl]+u*(0,-0.1))--(Lab[kl]+u*(0,0.1));
- endfor;
- );
- RecupLigne
- enddef;
-
- % On définit une fonction pour nommer les points nécessaires.
- vardef DefinirPoints(text t)=
- numeric nblignes,nbpas;
- n:=0;
- for p_=t:
- n:=n+1;
- if (n mod 3)=1:
- nblignes:=p_;
- elseif (n mod 3)=2:
- nbpas:=p_;
- elseif (n mod 3)=0:
- p_=(nbpas/TotalPas[nblignes])[La,Lb] shifted(u*(0,(nblignes-1)*(-EcartVertical)));
- fi;
- endfor;
- enddef;
-
+ \TraceDessinGradueCompletCode%
% On détermine le nombre de lignes et les origines particulières
pair OrigA[],OrigB[];
if LignesIdentiques:
@@ -141,69 +148,7 @@
trace EnsembleLignes scaled \useKV[DessinGradue]{Echelle};
\end{mplibcode}
\else
- \begin{mpost}[mpsettings={%
- LongueurLigne=\useKV[DessinGradue]{Longueur};
- EcartVertical=\useKV[DessinGradue]{EcartVertical};
- Pas:=\useKV[DessinGradue]{Pas};
- NbLignes=\useKV[DessinGradue]{Lignes};
- Echelle=\useKV[DessinGradue]{Echelle};
- Debut:=\useKV[DessinGradue]{Debut};
- Fin:=\useKV[DessinGradue]{Fin};
- boolean Solution,Droites,DemiDroites,LignesIdentiques,OrigineVariable,Code;
- Solution=\useKV[DessinGradue]{Solution};
- LignesIdentiques:=\useKV[DessinGradue]{LignesIdentiques};
- OrigineVariable:=\useKV[DessinGradue]{OrigineVariable};
- Droites=\useKV[DessinGradue]{Droites};
- DemiDroites=\useKV[DessinGradue]{DemiDroites};
- Code=\useKV[DessinGradue]{Code};
- vardef EffectuerLesTraces=
- if Code:
- \useKV[DessinGradue]{Traces};
- fi;
- enddef;
- }]
- pair La,Lb,Lab[];
- pair A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,A',B',C',D',E',F',G',H',I',J',K',L',M',N',O',P',Q',R',S',T',U',V',W',X',Y',Z',A'',B'',C'',D'',E'',F'',G'',H'',I'',J'',K'',L'',M'',N'',O'',P'',Q'',R'',S'',T'',U'',V'',W'',X'',Y'',Z'';
-
- La=(0,0);
- Lb-La=u*(\useKV[DessinGradue]{Longueur},0);
-
- % On définit une fonction pour tracer les lignes en fonction du pas "Partage"
- vardef TraceLignes(expr Partage)=
- save RecupLigne;
- picture RecupLigne;
- RecupLigne=image(
- if \useKV[DessinGradue]{Droites}:
- drawarrow 1.05[Lb,La]--1.05[La,Lb];
- elseif \useKV[DessinGradue]{DemiDroites}:
- drawarrow La--1.05[La,Lb];
- else:
- trace segment(La,Lb);
- fi;
- for kl=0 upto Partage:
- Lab[kl]:=(kl/Partage)[La,Lb];
- trace (Lab[kl]+u*(0,-0.1))--(Lab[kl]+u*(0,0.1));
- endfor;
- );
- RecupLigne
- enddef;
-
- % On définit une fonction pour nommer les points nécessaires.
- vardef DefinirPoints(text t)=
- numeric nblignes,nbpas;
- n:=0;
- for p_=t:
- n:=n+1;
- if (n mod 3)=1:
- nblignes:=p_;
- elseif (n mod 3)=2:
- nbpas:=p_;
- elseif (n mod 3)=0:
- p_=(nbpas/TotalPas[nblignes])[La,Lb] shifted(u*(0,(nblignes-1)*(-EcartVertical)));
- fi;
- endfor;
- enddef;
-
+ \begin{mpost}[mpsettings={\TraceDessinGradueCompletCode}]
% On détermine le nombre de lignes et les origines particulières
pair OrigA[],OrigB[];
if LignesIdentiques:
diff --git a/macros/latex/contrib/profcollege/latex/PfCEngrenagesBase.tex b/macros/latex/contrib/profcollege/latex/PfCEngrenagesBase.tex
index 17846d9d54..68e7bdbea4 100644
--- a/macros/latex/contrib/profcollege/latex/PfCEngrenagesBase.tex
+++ b/macros/latex/contrib/profcollege/latex/PfCEngrenagesBase.tex
@@ -15,121 +15,79 @@
\readlist*\ListePfCEngrenages{#2}%
\setsepchar{,}
\xdef\PfCFooEngrenages{}
- % \foreachitem\compteur\in\ListePfCEngrenages{\expandafter\UpdatetoksEngrenages\compteur\nil}%
\foreachitem\compteur\in\ListePfCEngrenages{%
\xdef\PfCFooEngrenages{\PfCFooEngrenages \ListePfCEngrenages[\compteurcnt,1],\ListePfCEngrenages[\compteurcnt,2],}%
}%
\BuildEngrenages{\PfCFooEngrenages}%
}%
+\def\BuildEngrenagesCode#1{%
+ u:=\useKV[Engrenages]{Unite};
+ CouleurEngrenage=\useKV[Engrenages]{Couleur};
+ %
+ vardef LectureDonnees(text t)=
+ n:=0;k=0;l=0;
+ for p_=t:
+ n:=n+1;
+ if (n mod 2)=0:
+ l:=l+1;
+ Zz[l]=p_;
+ else:
+ k:=k+1;
+ Mm[k]=p_;
+ fi;
+ endfor;
+ enddef;
+ %
+ LectureDonnees(#1);
+ %
+ pair K;
+ K=(0,0);
+ picture EngrenageFinal;
+ EngrenageFinal=image(
+ trace Engrenage(Mm[1],Zz[1],(0,0));
+ %
+ Signe=1;
+ %
+ for w=2 upto (n div 2):
+ K:=K+pointarc(cercles((0,0),u*Mm[w]*(Zz[w-1]+Zz[w])*0.5+0.04*u),0);
+ AngleRot[w]:=360/(2*Zz[w]);
+ if w=2:
+ trace rotation(Engrenage(Mm[w],Zz[w],K),K,180-AngleRot[w]);
+ if (Zz[w] mod 2)=0:
+ Signe:=Signe*(-1);
+ fi;
+ else:
+ if (Zz[w] mod 2)=1:
+ if Signe=-1:
+ trace rotation(Engrenage(Mm[w],Zz[w],K),K,180);
+ else:
+ trace rotation(Engrenage(Mm[w],Zz[w],K),K,180-AngleRot[w]);
+ fi;
+ else:
+ Signe:=Signe*(-1);
+ if Signe=1:
+ trace rotation(Engrenage(Mm[w],Zz[w],K),K,180);
+ else:
+ trace rotation(Engrenage(Mm[w],Zz[w],K),K,180-AngleRot[w]);
+ fi;
+ fi;
+ fi;
+ endfor;
+ );
+}
+
\NewDocumentCommand\BuildEngrenages{m}{%
\ifluatex
\mplibforcehmode
\begin{mplibcode}
input PfCEngrenages;
-
- u:=\useKV[Engrenages]{Unite};
- CouleurEngrenage=\useKV[Engrenages]{Couleur};
-
- vardef LectureDonnees(text t)=
- n:=0;k=0;l=0;
- for p_=t:
- n:=n+1;
- if (n mod 2)=0:
- l:=l+1;
- Zz[l]=p_;
- else:
- k:=k+1;
- Mm[k]=p_;
- fi;
- endfor;
- enddef;
-
- LectureDonnees(#1);
-
- pair K;
- K=(0,0);
-
- trace Engrenage(Mm[1],Zz[1],(0,0));
-
- Signe=1;
-
- for w=2 upto (n div 2):
- K:=K+pointarc(cercles((0,0),u*Mm[w]*(Zz[w-1]+Zz[w])*0.5+0.04*u),0);
- AngleRot[w]:=360/(2*Zz[w]);
- if w=2:
- trace rotation(Engrenage(Mm[w],Zz[w],K),K,180-AngleRot[w]);
- if (Zz[w] mod 2)=0:
- Signe:=Signe*(-1);
- fi;
- else:
- if (Zz[w] mod 2)=1:
- if Signe=-1:
- trace rotation(Engrenage(Mm[w],Zz[w],K),K,180);
- else:
- trace rotation(Engrenage(Mm[w],Zz[w],K),K,180-AngleRot[w]);
- fi;
- else:
- Signe:=Signe*(-1);
- if Signe=1:
-trace rotation(Engrenage(Mm[w],Zz[w],K),K,180);
- else:
-trace rotation(Engrenage(Mm[w],Zz[w],K),K,180-AngleRot[w]);
- fi;
- fi;
- fi;
- endfor;
+ \BuildEngrenagesCode{#1}
+ trace EngrenageFinal;
\end{mplibcode}
\else
- \begin{mpost}[mpsettings={input PfCEngrenages;u:=\useKV[Engrenages]{Unite};CouleurEngrenage=\useKV[Engrenages]{Couleur};}]
- vardef LectureDonnees(text t)=
- n:=0;k=0;l=0;
- for p_=t:
- n:=n+1;
- if (n mod 2)=0:
- l:=l+1;
- Zz[l]=p_;
- else:
- k:=k+1;
- Mm[k]=p_;
- fi;
- endfor;
- enddef;
-
- LectureDonnees(#1);
-
- pair K;
- K=(0,0);
-
- trace Engrenage(Mm[1],Zz[1],(0,0));
-
- Signe=1;
-
- for w=2 upto (n div 2):
- K:=K+pointarc(cercles((0,0),u*Mm[w]*(Zz[w-1]+Zz[w])*0.5+0.04*u),0);
- AngleRot[w]:=360/(2*Zz[w]);
- if w=2:
- trace rotation(Engrenage(Mm[w],Zz[w],K),K,180-AngleRot[w]);
- if (Zz[w] mod 2)=0:
- Signe:=Signe*(-1);
- fi;
- else:
- if (Zz[w] mod 2)=1:
- if Signe=-1:
- trace rotation(Engrenage(Mm[w],Zz[w],K),K,180);
- else:
- trace rotation(Engrenage(Mm[w],Zz[w],K),K,180-AngleRot[w]);
- fi;
- else:
- Signe:=Signe*(-1);
- if Signe=1:
-trace rotation(Engrenage(Mm[w],Zz[w],K),K,180);
- else:
-trace rotation(Engrenage(Mm[w],Zz[w],K),K,180-AngleRot[w]);
- fi;
- fi;
- fi;
- endfor;
+ \begin{mpost}[mpsettings={input PfCEngrenages;\BuildEngrenagesCode{#1}}]
+ trace EngrenageFinal;
\end{mpost}
\fi
-} \ No newline at end of file
+}% \ No newline at end of file
diff --git a/macros/latex/contrib/profcollege/latex/PfCNombreAstral.tex b/macros/latex/contrib/profcollege/latex/PfCNombreAstral.tex
index ea30623503..f1142bcdcf 100644
--- a/macros/latex/contrib/profcollege/latex/PfCNombreAstral.tex
+++ b/macros/latex/contrib/profcollege/latex/PfCNombreAstral.tex
@@ -1,7 +1,7 @@
%%%
% Nombre Astral
%%%
-\setKVdefault[NombreAstral]{Solution=false,Graines=false,Echelle=1}
+\setKVdefault[NombreAstral]{Solution=false,Graines=false,Echelle=1,Couleur=LightSteelBlue}
\defKV[NombreAstral]{Graine=\setKV[NombreAstral]{Graines}}%
\newtoks\toklisteNANombres%
@@ -51,9 +51,12 @@
\mplibforcehmode
\begin{mplibcode}
Cible=\PfCNACible;
+
+ color MiseEnValeurSol;
+ MiseEnValeurSol=\useKV[NombreAstral]{Couleur};
boolean Solution;
- Solution:=\useKV[NombreAstral]{Solution};
+ Solution=\useKV[NombreAstral]{Solution};
Echelle:=\useKV[NombreAstral]{Echelle};
@@ -102,11 +105,19 @@
fill ca[k] withcolor white;
trace ca[k];
endfor;
- vardef Affichage(text t)=
+
+ vardef DefinirRappel(text t)=
n:=0;
for p_=t:
n:=n+1;
Rappel[n]=p_;
+ endfor;
+ enddef;
+
+ vardef Affichage(text t)=
+ n:=0;
+ for p_=t:
+ n:=n+1;
label(TEX("\Large"&p_),A[n]);
endfor;
enddef;
@@ -115,16 +126,20 @@
k:=0;
for p_=t:
k:=k+1;
- fill ca[p_] withcolor white;
+ fill ca[p_] withcolor if Solution=false: white else: MiseEnValeurSol fi;
trace ca[p_];
label(TEX("\Large"&Rappel[p_]),u*(-7,5.6-1.5k));
trace cercles(u*(-7,5.6-1.5k),0.6u);
endfor;
enddef;
-
- Affichage(#1);
+
+ DefinirRappel(#1);
if Solution=false:
+ Affichage(#1);
+ Suppression(#2);
+ else:
Suppression(#2);
+ Affichage(#1);
fi;
picture recap;%
recap:=currentpicture scaled Echelle;%
@@ -134,6 +149,8 @@
\else
\begin{mpost}[mpsettings={%
Echelle:=\useKV[NombreAstral]{Echelle};
+ color MiseEnValeurSol;
+ MiseEnValeurSol=\useKV[NombreAstral]{Couleur};
Cible=\PfCNACible;boolean Solution;Solution:=\useKV[NombreAstral]{Solution};
string Rappel[];
n:=0;
@@ -187,11 +204,20 @@
fill ca[k] withcolor white;
trace ca[k];
endfor;
+
+ vardef DefinirRappel(text t)=
+ n:=0;
+ for p_=t:
+ n:=n+1;
+ Rappel[n]=p_;
+ endfor;
+ enddef;
+
vardef Affichage(text t)=
n:=0;
for p_=t:
n:=n+1;
- label(LATEX("\noexpand\Large"&Rappel[n]),A[n]);
+ label(LATEX("\noexpand\Large"&p_),A[n]);
endfor;
enddef;
@@ -199,18 +225,21 @@
k:=0;
for p_=t:
k:=k+1;
- fill ca[p_] withcolor white;
+ fill ca[p_] withcolor if Solution=false: white else: MiseEnValeurSol fi;
trace ca[p_];
label(LATEX("\noexpand\Large"&Rappel[p_]),u*(-7,5.6-1.5k));
trace cercles(u*(-7,5.6-1.5k),0.6u);
endfor;
enddef;
- Affichage(#1);
+ DefinirRappel(#1);
if Solution=false:
+ Affichage(#1);
Suppression(#2);
+ else:
+ Suppression(#2);
+ Affichage(#1);
fi;
-
picture recap;%
recap:=currentpicture scaled Echelle;%
currentpicture:=nullpicture;%
diff --git a/macros/latex/contrib/profcollege/latex/PfCPapiers.tex b/macros/latex/contrib/profcollege/latex/PfCPapiers.tex
index 8196c4d557..0bb41363ec 100644
--- a/macros/latex/contrib/profcollege/latex/PfCPapiers.tex
+++ b/macros/latex/contrib/profcollege/latex/PfCPapiers.tex
@@ -27,306 +27,264 @@
% \fi
%}
-\def\MPGrille#1#2#3#4{%
- \ifluatex%
- \mplibforcehmode%
- \begin{mplibcode}%
- path horizon,verticon;
- horizon=(0,0)--(#1*cm,0);
- verticon=(0,0)--(0,#2*cm);
- drawoptions(withcolor #3);
- for k=0 step (#4*100) until (#1*100):
- draw verticon shifted(((k/100)*cm,0));
- endfor;
- for k=0 step (#4*100) until (#2*100):
- draw horizon shifted((0,(k/100)*cm));
- endfor;
- \end{mplibcode}%
- \else%
- \begin{mpost}%
- path horizon,verticon;
- horizon=(0,0)--(#1*cm,0);
- verticon=(0,0)--(0,#2*cm);
- drawoptions(withcolor #3);
- for k=0 step 0.5 until #1:
- draw verticon shifted((k*cm,0));
- endfor;
- for k=0 step 0.5 until #2:
- draw horizon shifted((0,k*cm));
- endfor;
- \end{mpost}%
- \fi%
+\def\MPGrilleCode{%
+ PapierLargeur=\PapierLargeur;
+ PapierHauteur=\PapierHauteur;
+ PapierGrille=\PapierGrille;
+ PapierGrillePointe=\PapierGrillePointe;
+ color PapierCouleur;
+ PapierCouleur=\useKV[Papiers]{Couleur};
+ %
+ path horizon,verticon;
+ horizon=(0,0)--(PapierLargeur*cm,0);
+ verticon=(0,0)--(0,PapierHauteur*cm);
+ vardef Papier=
+ picture Papiers;
+ Papiers=image(
+ drawoptions(withcolor PapierCouleur);
+ if PapierGrillePointe>0:
+ for k=0 step (PapierGrillePointe*100) until (PapierLargeur*100):
+ for l=0 step (PapierGrillePointe*100) until (PapierHauteur*100):
+ fill (cercles((0,0),1pt) shifted(((k/100)*cm,(l/100)*cm)));
+ endfor;
+ endfor;
+ else:
+ for k=0 step (PapierGrille*100) until (PapierLargeur*100):
+ draw verticon shifted(((k/100)*cm,0));
+ endfor;
+ for k=0 step (PapierGrille*100) until (PapierHauteur*100):
+ draw horizon shifted((0,(k/100)*cm));
+ endfor;
+ fi;
+ );
+ Papiers
+ enddef;
}%
-\def\MPGrillePointe#1#2#3#4{%
+\def\MPGrille{%
\ifluatex%
\mplibforcehmode%
\begin{mplibcode}%
- drawoptions(withcolor #3);
- for k=0 step (#4*100) until (#1*100):
- for l=0 step (#4*100) until (#2*100):
- fill (cercles((0,0),1pt) shifted(((k/100)*cm,(l/100)*cm)));
- endfor;
- endfor;
+ \MPGrilleCode
+ trace Papier;
\end{mplibcode}%
\else%
- \begin{mpost}%
- drawoptions(withcolor #3);
- for k=0 step (#4*100) until (#1*100):
- for l=0 step (#4*100) until (#2*100):
- fill (cercles((0,0),0.5pt) shifted(((k/100)*cm,(l/100)*cm)));
- endfor;
- endfor;
+ \begin{mpost}[mpsettings={\MPGrilleCode}]
+ trace Papier;
\end{mpost}%
\fi%
}%
-\def\MPCinq#1#2#3{%
- \ifluatex%
- \mplibforcehmode%
- \begin{mplibcode}%
- path horizon,verticon;
- horizon=(0,0)--(#1*cm,0);
- verticon=(0,0)--(0,#2*cm);
- drawoptions(withcolor #3);
- for k=0 step 0.5 until #1:
- draw verticon shifted((k*cm,0));
- endfor;
- for k=0 step 0.5 until #2:
- draw horizon shifted((0,k*cm));
- endfor;
- if \useKV[Papiers]{CodeAfter}:
- \useKV[Papiers]{Traces};
- fi;
- \end{mplibcode}%
- \else%
- \begin{mpost}
- path horizon,verticon;
- horizon=(0,0)--(#1*cm,0);
- verticon=(0,0)--(0,#2*cm);
- drawoptions(withcolor #3);
- for k=0 step 0.5 until #1:
- draw verticon shifted((k*cm,0));
- endfor;
- for k=0 step 0.5 until #2:
- draw horizon shifted((0,k*cm));
- endfor;
- \end{mpost}%
- \fi%
+\def\MPCinq{%
+ \xdef\PapierGrille{0.5}%
+ \MPGrille
}%
-\def\MPSeyes#1#2#3{%
+\def\MPSeyesCode{%
+ PapierLargeur=\PapierLargeur;
+ PapierHauteur=\PapierHauteur;
+ color PapierCouleur;
+ PapierCouleur=\useKV[Papiers]{Couleur};
+ u:=\useKV[Papiers]{Echelle};
+ path horizon,verticon;
+ horizon=(0,0)--(PapierLargeur*cm,0);
+ verticon=(0,0)--(0,PapierHauteur*cm);
+ vardef Seyes=
+ picture PapierSeyes;
+ PapierSeyes=image(
+ drawoptions(withcolor PapierCouleur);
+ for k=0 step u until (PapierLargeur*10):
+ draw verticon shifted(((k/10)*cm,0));
+ endfor;
+ for k=0 step (u/4) until (PapierHauteur*10):
+ draw horizon shifted((0,(k/10)*cm)) withpen pencircle scaled 0.5;
+ endfor;
+ for k=0 step u until (PapierHauteur*10):
+ draw horizon shifted((0,(k/10)*cm)) withpen pencircle scaled 1.25;
+ endfor;
+ );
+ PapierSeyes
+ enddef;
+}
+
+\def\MPSeyes{%
\ifluatex%
\mplibforcehmode%
\begin{mplibcode}%
- u:=\useKV[Papiers]{Echelle};
- path horizon,verticon;
- horizon=(0,0)--(#1*cm,0);
- verticon=(0,0)--(0,#2*cm);
- drawoptions(withcolor #3);
- for k=0 step u until (#1*10):
- draw verticon shifted(((k/10)*cm,0));
- endfor;
- for k=0 step (u/4) until (#2*10):
- draw horizon shifted((0,(k/10)*cm)) withpen pencircle scaled 0.5;
- endfor;
- for k=0 step u until (#2*10):
- draw horizon shifted((0,(k/10)*cm)) withpen pencircle scaled 1.25;
- endfor;
+ \MPSeyesCode
+ trace Seyes;
\end{mplibcode}%
\else%
- \begin{mpost}[mpsettings={u:=\useKV[Papiers]{Echelle};}]%
- path horizon,verticon;
- horizon=(0,0)--(#1*cm,0);
- verticon=(0,0)--(0,#2*cm);
- drawoptions(withcolor #3);
- for k=0 step u until (#1*10):
- draw verticon shifted(((k/10)*cm,0));
- endfor;
- for k=0 step (u/4) until (#2*10):
- draw horizon shifted((0,(k/10)*cm)) withpen pencircle scaled 0.5;
- endfor;
- for k=0 step u until (#2*10):
- draw horizon shifted((0,(k/10)*cm)) withpen pencircle scaled 1.25;
- endfor;
+ \begin{mpost}[mpsettings={\MPSeyesCode}]%
+ trace Seyes;
\end{mpost}
\fi%
}%
-\def\MPMillimetre#1#2#3{%
+\def\MPMillimetreCode{%
+ PapierLargeur=\PapierLargeur;
+ PapierHauteur=\PapierHauteur;
+ color PapierCouleur;
+ PapierCouleur=\useKV[Papiers]{Couleur};
+ path horizon,verticon;
+ horizon=(0,0)--(PapierLargeur*cm,0);
+ verticon=(0,0)--(0,PapierHauteur*cm);
+ vardef MPMilli=
+ picture MPMillimetre;
+ MPMillimetre=image(
+ drawoptions(withcolor PapierCouleur);
+ for k=0 step 1 until (PapierLargeur*10):
+ draw verticon shifted(((k/10)*cm,0)) withpen pencircle scaled 0.2;
+ endfor;
+ for k=0 step 5 until (PapierLargeur*10):
+ draw verticon shifted(((k/10)*cm,0)) withpen pencircle scaled 0.5;
+ endfor;
+ for k=0 step 1 until (PapierLargeur):
+ draw verticon shifted((k*cm,0)) withpen pencircle scaled 1.25;
+ endfor;
+ for k=0 step 1 until (PapierHauteur*10):
+ draw horizon shifted((0,(k/10)*cm)) withpen pencircle scaled 0.2;
+ endfor;
+ for k=0 step 5 until (PapierHauteur*10):
+ draw horizon shifted((0,(k/10)*cm)) withpen pencircle scaled 0.5;
+ endfor;
+ for k=0 step 1 until (PapierHauteur):
+ draw horizon shifted((0,k*cm)) withpen pencircle scaled 1.25;
+ endfor;
+ );
+ MPMillimetre
+ enddef;
+}
+
+\def\MPMillimetre{%
\ifluatex%
\mplibforcehmode%
\begin{mplibcode}%
- path horizon,verticon;
- horizon=(0,0)--(#1*cm,0);
- verticon=(0,0)--(0,#2*cm);
- drawoptions(withcolor #3);
- for k=0 step 1 until (#1*10):
- draw verticon shifted(((k/10)*cm,0)) withpen pencircle scaled 0.2;
- endfor;
- for k=0 step 5 until (#1*10):
- draw verticon shifted(((k/10)*cm,0)) withpen pencircle scaled 0.5;
- endfor;
- for k=0 step 1 until (#1):
- draw verticon shifted((k*cm,0)) withpen pencircle scaled 1.25;
- endfor;
- for k=0 step 1 until (#2*10):
- draw horizon shifted((0,(k/10)*cm)) withpen pencircle scaled 0.2;
- endfor;
- for k=0 step 5 until (#2*10):
- draw horizon shifted((0,(k/10)*cm)) withpen pencircle scaled 0.5;
- endfor;
- for k=0 step 1 until (#2):
- draw horizon shifted((0,k*cm)) withpen pencircle scaled 1.25;
- endfor;
+ \MPMillimetreCode
+ trace MPMilli;
\end{mplibcode}%
\else%
- \begin{mpost}%
- path horizon,verticon;
- horizon=(0,0)--(#1*cm,0);
- verticon=(0,0)--(0,#2*cm);
- drawoptions(withcolor #3);
- for k=0 step 1 until (#1*10):
- draw verticon shifted(((k/10)*cm,0)) withpen pencircle scaled 0.2;
- endfor;
- for k=0 step 5 until (#1*10):
- draw verticon shifted(((k/10)*cm,0)) withpen pencircle scaled 0.5;
- endfor;
- for k=0 step 1 until (#1):
- draw verticon shifted((k*cm,0)) withpen pencircle scaled 1.25;
- endfor;
- for k=0 step 1 until (#2*10):
- draw horizon shifted((0,(k/10)*cm)) withpen pencircle scaled 0.2;
- endfor;
- for k=0 step 5 until (#2*10):
- draw horizon shifted((0,(k/10)*cm)) withpen pencircle scaled 0.5;
- endfor;
- for k=0 step 1 until (#2):
- draw horizon shifted((0,k*cm)) withpen pencircle scaled 1.25;
- endfor;
+ \begin{mpost}[mpsettings={\MPMillimetreCode}]
+ trace MPMilli;
\end{mpost}%
\fi%
}%
-\def\MPIsometrique#1#2#3{%
+\def\MPIsometriqueCode{%
+ PapierLargeur=\PapierLargeur;
+ PapierHauteur=\PapierHauteur;
+ color PapierCouleur;
+ PapierCouleur=\useKV[Papiers]{Couleur};
+ path diagon,antidiagon;
+ diagon=(0,0)--PapierHauteur*cm*(sqrt(3),1);
+ antidiagon=(0,0)--PapierHauteur*cm*(-sqrt(3),1);
+ vardef MPIso=
+ picture MPIsom;
+ MPIsom=image(
+ drawoptions(withcolor PapierCouleur);
+ for k=0 upto 2*(PapierLargeur+PapierHauteur):
+ draw antidiagon shifted((k*cm,0));
+ endfor;
+ for k=-(2*ceiling(PapierLargeur+PapierHauteur)) upto (2*ceiling(PapierLargeur+PapierHauteur)):
+ draw diagon shifted((k*cm,0));
+ endfor;
+ clip currentpicture to polygone((0,0),(PapierLargeur*cm,0),(PapierLargeur*cm,PapierHauteur*cm),(0,PapierHauteur*cm));
+ );
+ MPIsom
+ enddef;
+}
+
+\def\MPIsometrique{%
\ifluatex%
\mplibforcehmode%
\begin{mplibcode}%
- path diagon,antidiagon;
- diagon=(0,0)--#2*(sqrt(3)*cm,1*cm);
- antidiagon=(0,0)--#2*(-sqrt(3)*cm,1*cm);
- drawoptions(withcolor #3);
- for k=0 step 1 until (#1):
- draw diagon shifted((k*cm,0));
- draw antidiagon shifted((k*cm,0));
- endfor;
- for k=0 step (sqrt(3)/3) until (#2):
- draw diagon shifted((0,k*cm));
- draw antidiagon shifted((#1*cm,k*cm));
- endfor;
- clip currentpicture to polygone((0,0),(#1*cm,0),(#1*cm,#2*cm),(0,#2*cm));
+ \MPIsometriqueCode
+ trace MPIso;
\end{mplibcode}%
\else%
- \begin{mpost}%
- path diagon,antidiagon;
- diagon=(0,0)--#2*(sqrt(3)*cm,1*cm);
- antidiagon=(0,0)--#2*(-sqrt(3)*cm,1*cm);
- drawoptions(withcolor #3);
- for k=0 step 1 until (#1):
- draw diagon shifted((k*cm,0));
- draw antidiagon shifted((k*cm,0));
- endfor;
- for k=0 step (sqrt(3)/3) until (#2):
- draw diagon shifted((0,k*cm));
- draw antidiagon shifted((#1*cm,k*cm));
- endfor;
- clip currentpicture to polygone((0,0),(#1*cm,0),(#1*cm,#2*cm),(0,#2*cm));
+ \begin{mpost}[mpsettings={\MPIsometriqueCode}]
+ trace MPIso;
\end{mpost}%
\fi%
}%
-\def\MPIsometriquePointe#1#2#3{%
+\def\MPIsometriquePointeCode{%
+ PapierLargeur=\PapierLargeur;
+ PapierHauteur=\PapierHauteur;
+ color PapierCouleur;
+ PapierCouleur=\useKV[Papiers]{Couleur};
+ pair diagon,antidiagon;
+ diagon=(1pt,1pt);
+ antidiagon=(1pt+0.5cm,1pt+0.5*(sqrt(3)*1cm/3));
+ vardef TraceIsoPointe=
+ picture PapierIsoPointe;
+ PapierIsoPointe=image(
+ drawoptions(withcolor PapierCouleur);
+ for k=0 step (sqrt(3)/3) until (PapierHauteur):
+ for l=0 step 1 until (PapierLargeur):
+ fill (cercles(diagon,1pt) shifted((l*cm,k*cm)));
+ fill (cercles(antidiagon,1pt) shifted((l*cm,k*cm)));
+ endfor;
+ endfor;
+ clip currentpicture to polygone((0,0),(PapierLargeur*cm+2pt,0),(PapierLargeur*cm+2pt,PapierHauteur*cm+1pt),(0,PapierHauteur*cm+1pt));
+ );
+ PapierIsoPointe
+ enddef;
+}
+
+\def\MPIsometriquePointe{%
\ifluatex%
\mplibforcehmode%
\begin{mplibcode}%
- pair diagon,antidiagon;
- diagon=(1pt,1pt);
- antidiagon=(1pt+0.5cm,1pt+0.5*(sqrt(3)*1cm/3));
- drawoptions(withcolor #3);
- for k=0 step (sqrt(3)/3) until (#2):
- for l=0 step 1 until (#1):
- fill (cercles(diagon,1pt) shifted((l*cm,k*cm)));
- fill (cercles(antidiagon,1pt) shifted((l*cm,k*cm)));
- endfor;
- endfor;
- clip currentpicture to polygone((0,0),(#1*cm+2pt,0),(#1*cm+2pt,#2*cm+1pt),(0,#2*cm+1pt));
+ \MPIsometriquePointeCode
+ trace TraceIsoPointe;
\end{mplibcode}%
\else%
- \begin{mpost}%
- pair diagon,antidiagon;
- diagon=(1pt,1pt);
- antidiagon=(1pt+0.5cm,1pt+0.5*(sqrt(3)*1cm/3));
- drawoptions(withcolor #3);
- for k=0 step (sqrt(3)/3) until (#2):
- for l=0 step 1 until (#1):
- fill (cercles(diagon,1pt) shifted((l*cm,k*cm)));
- fill (cercles(antidiagon,1pt) shifted((l*cm,k*cm)));
- endfor;
- endfor;
- clip currentpicture to polygone((0,0),(#1*cm+2pt,0),(#1*cm+2pt,#2*cm+1pt),(0,#2*cm+1pt));
+ \begin{mpost}[mpsettings={\MPIsometriquePointeCode}]
+ trace TraceIsoPointe;
\end{mpost}%
\fi%
}%
-\def\MPTriangulaire#1#2#3{%
+\def\MPTriangulaireCode{%
+ PapierLargeur=\PapierLargeur;
+ PapierHauteur=\PapierHauteur;
+ color PapierCouleur;
+ PapierCouleur=\useKV[Papiers]{Couleur};
+ path horizon,diagon,antidiagon;
+ horizon=(0,0)--(PapierLargeur*cm,0);
+ diagon=(0,0)--PapierHauteur*cm*(sqrt(3)/3,1);
+ antidiagon=(0,0)--PapierHauteur*cm*(-sqrt(3)/3,1);
+ vardef PapierTri=
+ picture PapierTriangle;
+ PapierTriangle=image(
+ drawoptions(withcolor PapierCouleur);
+ for k=0 upto 2*ceiling(PapierLargeur):
+ draw diagon shifted((k*cm,0));
+ draw antidiagon shifted((k*cm,0));
+ endfor;
+ for k=sqrt(3) step (sqrt(3)) until (PapierHauteur):
+ draw diagon shifted((0,k*cm));
+ endfor;
+ for k=0 step (sqrt(3)/2) until (PapierHauteur):
+ draw horizon shifted((0,k*cm));
+ endfor;
+ clip currentpicture to polygone((0,0),(PapierLargeur*cm,0),(PapierLargeur*cm,PapierHauteur*cm),(0,PapierHauteur*cm));
+ );
+ PapierTriangle
+ enddef;
+}
+
+\def\MPTriangulaire{%
\ifluatex%
\mplibforcehmode%
\begin{mplibcode}%
- path horizon,diagon,antidiagon;
- horizon=(0,0)--(#1*cm,0);
- diagon=(0,0)--#2*(sqrt(3)*cm/3,1*cm);
- antidiagon=(0,0)--#2*(-sqrt(3)*cm/3,1*cm);
- drawoptions(withcolor #3);
- for k=0 step 1 until #1:
- draw diagon shifted((k*cm,0));
- endfor;
- for k=0 step (sqrt(3)) until (#2):
- draw diagon shifted((0,k*cm));
- endfor;
- for k=0 step 1 until (#1):
- draw antidiagon shifted((k*cm,0));
- endfor;
- for k=0 step (sqrt(3)) until (#2):
- draw antidiagon shifted((#1*cm,k*cm));
- endfor;
- for k=0 step (sqrt(3)/2) until (#2):
- draw horizon shifted((0,k*cm));
- endfor;
- clip currentpicture to polygone((0,0),(#1*cm,0),(#1*cm,#2*cm),(0,#2*cm));
+ \MPTriangulaireCode
+ trace PapierTri;
\end{mplibcode}%
\else%
- \begin{mpost}%
- path horizon,diagon,antidiagon;
- horizon=(0,0)--(#1*cm,0);
- diagon=(0,0)--#2*(sqrt(3)*cm/3,1*cm);
- antidiagon=(0,0)--#2*(-sqrt(3)*cm/3,1*cm);
- drawoptions(withcolor #3);
- for k=0 step 1 until #1:
- draw diagon shifted((k*cm,0));
- endfor;
- for k=0 step (sqrt(3)) until (#2):
- draw diagon shifted((0,k*cm));
- endfor;
- for k=0 step 1 until (#1):
- draw antidiagon shifted((k*cm,0));
- endfor;
- for k=0 step (sqrt(3)) until (#2):
- draw antidiagon shifted((#1*cm,k*cm));
- endfor;
- for k=0 step (sqrt(3)/2) until (#2):
- draw horizon shifted((0,k*cm));
- endfor;
- clip currentpicture to polygone((0,0),(#1*cm,0),(#1*cm,#2*cm),(0,#2*cm));
+ \begin{mpost}[mpsettings={\MPTriangulaireCode}]
+ trace PapierTri;
\end{mpost}%
\fi%
}%
@@ -335,6 +293,33 @@
\newlength{\PapierLeftCurrent}
+\def\PfCPapierTest{%
+ \xintifboolexpr{\useKV[Papiers]{GrillePointe}>0 || \useKV[Papiers]{Grille}>0}{%
+ \MPGrille%
+ }{\ifboolKV[Papiers]{Baseline}{%
+ \MPBaseLineSkip{\PapierLargeur}{\PapierHauteur}{\PapierCouleur}%
+ }{%
+ \ifboolKV[Papiers]{IsometriquePointe}{%
+ \MPIsometriquePointe%
+ }{%
+ \ifboolKV[Papiers]{Triangle}{%
+ \MPTriangulaire%
+ }{\ifboolKV[Papiers]{Millimetre}{%
+ \MPMillimetre%
+ }{\ifboolKV[Papiers]{Isometrique}{%
+ \MPIsometrique%
+ }{\ifboolKV[Papiers]{Seyes}{%
+ \MPSeyes%
+ }{\MPCinq%
+ }%
+ }%
+ }%
+ }%
+ }%
+ }%
+ }%
+}%
+
\newcommand\Papiers[1][]{%
\useKVdefault[Papiers]%
\setKV[Papiers]{#1}%
@@ -355,34 +340,7 @@
\xdef\PapierLargeur{\fpeval{\textwidth/1cm}}%
\begin{tikzpicture}[remember picture,overlay]%
\node[anchor=south west,inner sep=0pt,transform canvas={xshift=\PapierLeft,yshift=\PapierBottom}] at (current page.south west) {%
- \xintifboolexpr{\useKV[Papiers]{GrillePointe}>0}{%
- \MPGrillePointe{\PapierLargeur}{\PapierHauteur}{\PapierCouleur}{\PapierGrillePointe}%
- }{%
- \xintifboolexpr{\useKV[Papiers]{Grille}>0}{%
- \MPGrille{\PapierLargeur}{\PapierHauteur}{\PapierCouleur}{\PapierGrille}%
- }{\ifboolKV[Papiers]{Baseline}{%
- \MPBaseLineSkip{\PapierLargeur}{\PapierHauteur}{\PapierCouleur}%
- }{%
- \ifboolKV[Papiers]{IsometriquePointe}{%
- \MPIsometriquePointe{\PapierLargeur}{\PapierHauteur}{\PapierCouleur}%
- }{%
- \ifboolKV[Papiers]{Triangle}{%
- \MPTriangulaire{\PapierLargeur}{\PapierHauteur}{\PapierCouleur}%
- }{\ifboolKV[Papiers]{Millimetre}{%
- \MPMillimetre{\PapierLargeur}{\PapierHauteur}{\PapierCouleur}%
- }{\ifboolKV[Papiers]{Isometrique}{%
- \MPIsometrique{\PapierLargeur}{\PapierHauteur}{\PapierCouleur}%
- }{\ifboolKV[Papiers]{Seyes}{%
- \MPSeyes{\PapierLargeur}{\PapierHauteur}{\PapierCouleur}%
- }{\MPCinq{\PapierLargeur}{\PapierHauteur}{\PapierCouleur}%
- }%
- }%
- }%
- }%
- }%
- }%
- }%
- }%
+ \PfCPapierTest%
};%
\end{tikzpicture}%
}{%
@@ -398,60 +356,11 @@
\xdef\PapierLargeur{\fpeval{\paperwidth/1cm}}%
\begin{tikzpicture}[remember picture,overlay]%
\node[anchor=south west,inner sep=0pt] at (current page.south west) {%
- \xintifboolexpr{\useKV[Papiers]{GrillePointe}>0}{%
- \MPGrillePointe{\PapierLargeur}{\PapierHauteur}{\PapierCouleur}{\PapierGrillePointe}%
- }{%
- \xintifboolexpr{\useKV[Papiers]{Grille}>0}{%
- \MPGrille{\PapierLargeur}{\PapierHauteur}{\PapierCouleur}{\PapierGrille}%
- }{\ifboolKV[Papiers]{IsometriquePointe}{%
- \MPIsometriquePointe{\PapierLargeur}{\PapierHauteur}{\PapierCouleur}%
- }{\ifboolKV[Papiers]{Triangle}{%
- \MPTriangulaire{\PapierLargeur}{\PapierHauteur}{\PapierCouleur}%
- }{\ifboolKV[Papiers]{Millimetre}{%
- \MPMillimetre{\PapierLargeur}{\PapierHauteur}{\PapierCouleur}%
- }{\ifboolKV[Papiers]{Isometrique}{%
- \MPIsometrique{\PapierLargeur}{\PapierHauteur}{\PapierCouleur}%
- }{\ifboolKV[Papiers]{Seyes}{%
- \MPSeyes{\PapierLargeur}{\PapierHauteur}{\PapierCouleur}%
- }{\MPCinq{\PapierLargeur}{\PapierHauteur}{\PapierCouleur}%
- }%
- }%
- }%
- }%
- }%
- }%
- }%
+ \PfCPapierTest%
};%
\end{tikzpicture}%
}{%
- \xintifboolexpr{\useKV[Papiers]{GrillePointe}>0}{%
- \MPGrillePointe{\PapierLargeur}{\PapierHauteur}{\PapierCouleur}{\PapierGrillePointe}%
- }{%
- \xintifboolexpr{\useKV[Papiers]{Grille}>0}{%
- \MPGrille{\PapierLargeur}{\PapierHauteur}{\PapierCouleur}{\PapierGrille}%
- }{\ifboolKV[Papiers]{Baseline}{%
- \MPBaseLineSkip{\PapierLargeur}{\PapierHauteur}{\PapierCouleur}%
- }{%
- \ifboolKV[Papiers]{IsometriquePointe}{%
- \MPIsometriquePointe{\PapierLargeur}{\PapierHauteur}{\PapierCouleur}%
- }{%
- \ifboolKV[Papiers]{Triangle}{%
- \MPTriangulaire{\PapierLargeur}{\PapierHauteur}{\PapierCouleur}%
- }{\ifboolKV[Papiers]{Millimetre}{%
- \MPMillimetre{\PapierLargeur}{\PapierHauteur}{\PapierCouleur}%
- }{\ifboolKV[Papiers]{Isometrique}{%
- \MPIsometrique{\PapierLargeur}{\PapierHauteur}{\PapierCouleur}%
- }{\ifboolKV[Papiers]{Seyes}{%
- \MPSeyes{\PapierLargeur}{\PapierHauteur}{\PapierCouleur}%
- }{\MPCinq{\PapierLargeur}{\PapierHauteur}{\PapierCouleur}%
- }%
- }%
- }%
- }%
- }%
- }%
- }%
- }%
+ \PfCPapierTest
}%
}%
}% \ No newline at end of file
diff --git a/macros/latex/contrib/profcollege/latex/PfCPavage.tex b/macros/latex/contrib/profcollege/latex/PfCPavage.tex
new file mode 100644
index 0000000000..245afb0593
--- /dev/null
+++ b/macros/latex/contrib/profcollege/latex/PfCPavage.tex
@@ -0,0 +1,1216 @@
+%%%
+% Pavage
+%%%
+\setKVdefault[Pavage]{%
+ Before=false,
+ Niveau=3,
+ Couleur=white,
+ Backgrounds=false,
+ Numerotation=false,
+ Depart=0,
+ Complete=false,
+ After=false,
+ Demo=false,
+ Regulier=false,
+ Cote=1,
+ Lignes=4,
+ Colonnes=4,
+ SemiRegulier=false,
+ Reseau=false,
+ Basei={u*(0.75,0)},
+ Basej={u*(0,0.5)},
+ Quadrilatere=false,
+ Escher=false,
+ Rayon=1,
+ Epaisseur=1,
+ Position=0.5,
+ Ecart=10,
+ Colore=false,
+ CouleurUn=white,
+ CouleurDeux=white,
+ CouleurTrois=white,
+ CouleurQuatre=white
+}%
+\defKV[Pavage]{Motif=\setKV[Pavage]{Before}}%
+\defKV[Pavage]{Traces=\setKV[Pavage]{After}}%
+\defKV[Pavage]{ArrierePlan=\setKV[Pavage]{Backgrounds}}%
+\defKV[Pavage]{CouleurUn=\setKV[Pavage]{Colore}}%
+\defKV[Pavage]{CouleurDeux=\setKV[Pavage]{Colore}}%
+\defKV[Pavage]{CouleurTrois=\setKV[Pavage]{Colore}}%
+\defKV[Pavage]{CouleurQuatre=\setKV[Pavage]{Colore}}%
+
+\def\MPPavageBase{%
+ boolean Before,Numerote,Complete,Backgrounds,After,Demo;
+ Before=\useKV[Pavage]{Before};
+ After=\useKV[Pavage]{After};
+ Numerote=\useKV[Pavage]{Numerotation};
+ Complete=\useKV[Pavage]{Complete};
+ Backgrounds=\useKV[Pavage]{Backgrounds};
+ Demo=\useKV[Pavage]{Demo};
+ color ColPavage,ColArrierePlan;
+ ColPavage=\useKV[Pavage]{Couleur};
+ ColArrierePlan=if Backgrounds:\useKV[Pavage]{ArrierePlan} else:ColPavage fi;
+ Niveau=\useKV[Pavage]{Niveau};
+ Depart=\useKV[Pavage]{Depart};
+ Epaisseur=\useKV[Pavage]{Epaisseur};
+ vardef pavages(expr chemin,tour,coul)=
+ if Backgrounds:
+ fill CadrePavage withcolor ColArrierePlan;
+ fi;
+ save Base;
+ picture Base;
+ pair A,B,C,D;
+ A=u*(0,0);
+ B=u*(1,0);
+ C=u*(1,1);
+ D=u*(0,1);
+ path especes;
+ especes=chemin--rotation(chemin,B,-90)--reverse(rotation(symetrie(chemin,B,C),B,-90))--rotation(chemin,B,90)--cycle;
+ if tour=0:
+ Base=image(
+ trace chemin;
+ );
+ elseif tour=1:
+ Base=image(
+ fill especes withcolor coul;
+ trace especes;
+ A:=A shifted(u*(0,-1));
+ B:=B shifted(u*(1,-1));
+ C:=C shifted(u*(1,0));
+ );
+ elseif tour>=2:
+ Base=pavages(chemin,tour-1,coul);
+ Base:=image(
+ trace Base;
+ trace symetrie(Base,B,C);
+ trace rotation(symetrie(Base,B,C),B,-90);
+ trace rotation(Base,B,90);
+ A:=A shifted(u*(0,-(2**(tour-1))));
+ B:=B shifted(u*(2**(tour-1),-(2**(tour-1))));
+ C:=C shifted(u*(2**(tour-1),0));
+ );
+ fi;
+ Base
+enddef;
+%
+vardef pavagescar(expr chemin,tour,coul)=
+ save BaseCar;
+ picture BaseCar;
+ pair A,B,C,D;
+ A=u*(0,0);
+ B=u*(1,0);
+ C=u*(1,1);
+ D=u*(0,1);
+ if tour=0:
+ BaseCar=image(
+ trace chemin;
+ trace A--B--C--D--cycle dashed dashpattern(on12bp off6bp on3bp off 6bp) withcolor gris;
+ );
+ elseif tour=1:
+ BaseCar=image(
+ trace chemin;
+ drawoptions(dashed evenly);
+ trace rotation(chemin,B,-90);
+ trace reverse(rotation(symetrie(chemin,B,C),B,-90));
+ trace rotation(chemin,B,90);
+ drawoptions();
+ A:=A shifted(u*(0,-1));
+ B:=B shifted(u*(1,-1));
+ C:=C shifted(u*(1,0));
+ trace A--B--C--D--cycle dashed dashpattern(on12bp off6bp on3bp off 6bp) withcolor gris;
+ trace iso(A,D)--iso(B,C) dashed dashpattern(on12bp off6bp on3bp off 6bp) withcolor gris;
+ trace iso(A,B)--iso(C,D) dashed dashpattern(on12bp off6bp on3bp off 6bp) withcolor gris;
+ );
+ elseif tour>=2:
+ BaseCar=image(
+ trace pavages(chemin,tour-1,coul);
+ trace symetrie(pavages(chemin,tour-1,coul),B,C);%coul+0.5blanc
+ trace rotation(symetrie(pavages(chemin,tour-1,coul),B,C),B,-90);
+ trace rotation(pavages(chemin,tour-1,coul),B,90);
+ A:=A shifted(u*(0,-(2**(tour-1))));
+ B:=B shifted(u*(2**(tour-1),-(2**(tour-1))));
+ C:=C shifted(u*(2**(tour-1),0));
+ );
+ fi;
+ BaseCar
+ enddef;
+ %
+ vardef CadrePavage=
+ u*(0,1)--u*(0,-(2**Niveau-1))--u*(2**Niveau,-(2**Niveau-1))--u*(2**(Niveau),1)--cycle
+ enddef;
+ %
+ vardef Numerotation=
+ n:=Depart;
+ pair B;
+ B=u*(1,0);
+ if Complete:
+ for k=0 upto 2**(Niveau)-2:
+ for l=0 upto (2**(Niveau-1))-1:
+ n:=n+1;
+ if (k mod 2)=0:
+ label(TEX(decimal(n)),B+u*(2l,-k));
+ else:
+ if l<(2**(Niveau-1))-1:
+ label(TEX(decimal(n)),B+u*(2l+1,-k));
+ else:
+ n:=n-1;
+ fi;
+ fi;
+ endfor;
+ endfor;
+ else:
+ for k=0 upto (2**(Niveau-1))-1:
+ for l=0 upto (2**(Niveau-1))-1:
+ n:=n+1;
+ label(TEX(decimal(n)),B+2u*(l,-k));
+ endfor;
+ endfor;
+ fi;
+ enddef;
+ %
+ vardef NumerotationPDF=
+ n:=Depart;
+ pair B;
+ B=u*(1,0);
+ if Complete:
+ for k=0 upto 2**(Niveau)-2:
+ for l=0 upto (2**(Niveau-1))-1:
+ n:=n+1;
+ if (k mod 2)=0:
+ label(TEX(decimal(n)),B+u*(2l,-k));
+ else:
+ if l<(2**(Niveau-1))-1:
+ label(LATEX(decimal(n)),B+u*(2l+1,-k));
+ fi;
+ fi;
+ endfor;
+ endfor;
+ else:
+ for k=0 upto (2**(Niveau-1))-1:
+ for l=0 upto (2**(Niveau-1))-1:
+ n:=n+1;
+ label(LATEX(decimal(n)),B+2u*(l,-k));
+ endfor;
+ endfor;
+ fi;
+ enddef;
+ %
+ vardef PlacePointSupport=
+ n:=Depart;
+ pair K[],L[],M[],N[];
+ K[0]=u*(0,0);
+ M[0]=u*(1,1);
+ if Complete:
+ for k=0 upto 2**(Niveau)-2:
+ for l=0 upto (2**(Niveau-1))-1:
+ n:=n+1;
+ if (k mod 2)=0:
+ K[n]:=K0+u*(2l,-k);
+ M[n]:=M0+u*(2l,-k);
+ else:
+ if l<(2**(Niveau-1))-1:
+ K[n]:=K0+u*(2l+1,-k);
+ M[n]:=M0+u*(2l+1,-k);
+ else:
+ n:=n-1;
+ fi;
+ fi;
+ endfor;
+ endfor;
+ else:
+ for k=0 upto (2**(Niveau-1))-1:
+ for l=0 upto (2**(Niveau-1))-1:
+ n:=n+1;
+ K[n]=K[0]+2u*(l,-k);
+ M[n]=M[0]+2u*(l,-k);
+ endfor;
+ endfor;
+ fi;
+ enddef;
+ vardef EffectuerTraces=
+ \useKV[Pavage]{Traces}
+ enddef;
+}%
+
+\def\MPReseauRegulier{%
+ boolean Before,Numerote,Backgrounds,After;
+ Before=\useKV[Pavage]{Before};
+ After=\useKV[Pavage]{After};
+ Numerote=\useKV[Pavage]{Numerotation};
+ Backgrounds=\useKV[Pavage]{Backgrounds};
+ color ColPavage,ColArrierePlan;
+ ColPavage=\useKV[Pavage]{Couleur};
+ ColArrierePlan=if Backgrounds:\useKV[Pavage]{ArrierePlan} else:ColPavage fi;
+ Cote=\useKV[Pavage]{Cote};
+ Lignes=\useKV[Pavage]{Lignes};
+ Colonnes=\useKV[Pavage]{Colonnes};
+ Niveau=\useKV[Pavage]{Niveau};
+ Depart=\useKV[Pavage]{Depart};
+ Epaisseur=\useKV[Pavage]{Epaisseur};
+ pair A[];
+ A1=(0,0);
+ A2-A1=u*Cote*(1,0);
+ vardef PavageRegulier(expr Niv)=
+ picture Retour;
+ if Niv=3:
+ A3=rotation(A2,A1,60);
+ path TriBase,CadrePavage;
+ TriBase=polygone(A1,A2,A3);
+ CadrePavage=polygone(A1,Cote*cm*(Colonnes,0),Cote*cm*(Colonnes,0.5*sqrt(3)*Lignes),Cote*cm*(0,0.5*sqrt(3)*Lignes));
+ Retour=image(
+ fill CadrePavage withcolor ColPavage;
+ for k=0 upto Lignes:
+ for l=-1 upto Colonnes+1:
+ if k mod 2=0:
+ trace TriBase shifted (Cote*cm*(l,0.5*sqrt(3)*k));
+ else:
+ trace TriBase shifted (Cote*cm*(l+0.5,0.5*sqrt(3)*k));
+ fi;
+ endfor;
+ endfor;
+ clip currentpicture to CadrePavage;
+ trace CadrePavage withpen pencircle scaled Epaisseur;
+ );
+ elseif Niv=4:
+ A3=rotation(A1,A2,-90);
+ A4-A3=A1-A2;
+ path QuadriBase,CadrePavage;
+ QuadriBase=polygone(A1,A2,A3,A4);
+ CadrePavage=polygone(A1,Cote*cm*(Colonnes,0),Cote*cm*(Colonnes,Lignes),Cote*cm*(0,Lignes));
+ Retour=image(
+ fill CadrePavage withcolor ColPavage;
+ for k=0 upto Lignes-1:
+ for l=0 upto Colonnes-1:
+ trace QuadriBase shifted (Cote*cm*(l,k));
+ endfor;
+ endfor;
+ clip currentpicture to CadrePavage;
+ trace CadrePavage withpen pencircle scaled Epaisseur;
+ );
+ elseif Niv=6:
+ A3=rotation(A1,A2,-120);
+ A4=rotation(A2,A3,-120);
+ A5=rotation(A3,A4,-120);
+ A6=rotation(A4,A5,-120);
+ path HexaBase,CadrePavage;
+ HexaBase=polygone(A1,A2,A3,A4,A5,A6);
+ CadrePavage=polygone(Cote*cm*(1,0),Cote*cm*(3*Colonnes,0),Cote*cm*(3*Colonnes,sqrt(3)*(Lignes-1)),Cote*cm*(1,sqrt(3)*(Lignes-1)));
+ Retour=image(%
+ fill CadrePavage withcolor ColPavage;
+ for k=-1 upto 2*Lignes+1:
+ for l=-1 upto Colonnes+1:
+ if k mod 2=1:
+ trace HexaBase shifted (Cote*cm*(3*l,0.5*sqrt(3)*k));
+ else:
+ trace HexaBase shifted (Cote*cm*(1.5+3*l,sqrt(3)+0.5*sqrt(3)*k));
+ fi;
+ endfor;
+ endfor;
+ clip currentpicture to CadrePavage;
+ trace CadrePavage withpen pencircle scaled Epaisseur;
+ );
+ fi;
+ Retour
+ enddef;
+ %
+ vardef PlacePointSupport=
+ n:=Depart;
+ pair B;pair C;pair vdepla;
+ pair Hexa[],Hexb[],Hexc[],Hexd[],Hexe[],Hexf[];
+ pair Cara[],Carb[],Carc[],Card[];
+ pair Tria[],Trib[],Tric[];
+ path Maille[];
+ if Niveau=3:
+ B=iso(A1,A2,A3);
+ C=symetrie(B,A2,A3);
+ for k=1 upto Lignes:
+ for l=1 upto 2*Colonnes-1:
+ n:=n+1;
+ if k mod 2=1:
+ nbv:=(k-1)*1.5;
+ if l mod 2=1:
+ vdepla:=(Cote*cm*((l-1) div 2),nbv*Cote*cm*sqrt(3)/3);
+ else:
+ vdepla:=(Cote*cm*((l-1) div 2),nbv*Cote*cm*sqrt(3)/3)+(C-B);
+ fi;
+ else:
+ nbv:=(k-1)*1.5+0.5;
+ if l mod 2=1:
+ vdepla:=(Cote*cm*((l-1) div 2),nbv*Cote*cm*sqrt(3)/3);
+ else:
+ vdepla:=(Cote*cm*((l-1) div 2),(nbv*Cote*cm*sqrt(3)/3))+(xpart(C-B),-ypart(C-B));
+ fi;
+ fi;
+ if (n mod 2)=0:
+ Tria[n]=rotation(A1,B,180) shifted vdepla;
+ Trib[n]=rotation(A2,B,180) shifted vdepla;
+ Tric[n]=rotation(A3,B,180) shifted vdepla;
+ else:
+ Tria[n]-A1=vdepla;
+ Trib[n]-A2=vdepla;
+ Tric[n]-A3=vdepla;
+ fi;
+ Maille[n]=polygone(Tria[n],Trib[n],Tric[n]);
+ endfor;
+ endfor;
+ elseif Niveau=4:
+ B=iso(A1,A2,A3,A4);
+ for k=1 upto Lignes:
+ for l=1 upto Colonnes:
+ n:=n+1;
+ vdepla:=Cote*cm*((l-1),(k-1));
+ Cara[n]-A1=vdepla;
+ Carb[n]-A2=vdepla;
+ Carc[n]-A3=vdepla;
+ Card[n]-A4=vdepla;
+ Maille[n]=polygone(Cara[n],Carb[n],Carc[n],Card[n]);
+ endfor;
+ endfor;
+ elseif Niveau=6:
+ B=iso(A1,A2,A3,A4,A5,A6);
+ C=symetrie(B,A3,A4);
+ for k=1 upto Lignes-1:
+ for l=1 upto 2*Colonnes-1:
+ n:=n+1;
+ nbv:=(k-1)*3;
+ if l mod 2=1:
+ vdepla:=(1.5*Cote*cm*(l-1)+1.5*Cote*cm,nbv*Cote*cm*sqrt(3)/3);
+ else:
+ vdepla:=(1.5*Cote*cm*(l-2)+1.5*Cote*cm,nbv*Cote*cm*sqrt(3)/3)+(C-B);
+ fi;
+ if k=Lignes-1:
+ if l mod 2=1:
+ Hexa[n]-A1=vdepla;
+ Hexb[n]-A2=vdepla;
+ Hexc[n]-A3=vdepla;
+ Hexd[n]-A4=vdepla;
+ Hexe[n]-A5=vdepla;
+ Hexf[n]-A6=vdepla;
+ else:
+ n:=n-1;
+ fi;
+ else:
+ Hexa[n]-A1=vdepla;
+ Hexb[n]-A2=vdepla;
+ Hexc[n]-A3=vdepla;
+ Hexd[n]-A4=vdepla;
+ Hexe[n]-A5=vdepla;
+ Hexf[n]-A6=vdepla;
+ fi;
+ Maille[n]:=polygone(Hexa[n],Hexb[n],Hexc[n],Hexd[n],Hexe[n],Hexf[n]);
+ endfor;
+ endfor;
+ fi;
+ enddef;
+ %
+ vardef Numerotation=
+ n:=Depart;
+ pair B;pair C;pair vdepla;
+ if Niveau=3:
+ B=iso(A1,A2,A3);
+ C=symetrie(B,A2,A3);
+ for k=1 upto Lignes:
+ for l=1 upto 2*Colonnes-1:
+ n:=n+1;
+ if k mod 2=1:
+ nbv:=(k-1)*1.5;
+ if l mod 2=1:
+ vdepla:=(Cote*cm*((l-1) div 2),nbv*Cote*cm*sqrt(3)/3);
+ else:
+ vdepla:=(Cote*cm*((l-1) div 2),nbv*Cote*cm*sqrt(3)/3)+(C-B);
+ fi;
+ else:
+ nbv:=(k-1)*1.5+0.5;
+ if l mod 2=1:
+ vdepla:=(Cote*cm*((l-1) div 2),nbv*Cote*cm*sqrt(3)/3);
+ else:
+ vdepla:=(Cote*cm*((l-1) div 2),(nbv*Cote*cm*sqrt(3)/3))+(xpart(C-B),-ypart(C-B));
+ fi;
+ fi;
+ label(TEX(decimal(n)),B shifted vdepla);
+ endfor;
+ endfor;
+ elseif Niveau=4:
+ B=iso(A1,A2,A3,A4);
+ for k=1 upto Lignes:
+ for l=1 upto Colonnes:
+ n:=n+1;
+ vdepla:=Cote*cm*((l-1),(k-1));
+ label(TEX(decimal(n)),B shifted vdepla);
+ endfor;
+ endfor;
+ elseif Niveau=6:
+ B=iso(A1,A2,A3,A4,A5,A6);
+ C=symetrie(B,A3,A4);
+ for k=1 upto Lignes-1:
+ for l=1 upto 2*Colonnes-1:
+ n:=n+1;
+ nbv:=(k-1)*3;
+ if l mod 2=1:
+ vdepla:=(1.5*Cote*cm*(l-1)+1.5*Cote*cm,nbv*Cote*cm*sqrt(3)/3);
+ else:
+ vdepla:=(1.5*Cote*cm*(l-2)+1.5*Cote*cm,nbv*Cote*cm*sqrt(3)/3)+(C-B);
+ fi;
+ if k=Lignes-1:
+ if l mod 2=1:
+ label(TEX(decimal(n)),B shifted vdepla);
+ else:
+ n:=n-1;
+ fi;
+ else:
+ label(TEX(decimal(n)),B shifted vdepla);
+ fi;
+ endfor;
+ endfor;
+ fi;
+ enddef;
+ %
+ vardef NumerotationPDF=
+ n:=Depart;
+ pair B;pair C;pair vdepla;
+ if Niveau=3:
+ B=iso(A1,A2,A3);
+ C=symetrie(B,A2,A3);
+ for k=1 upto Lignes:
+ for l=1 upto 2*Colonnes-1:
+ n:=n+1;
+ if k mod 2=1:
+ nbv:=(k-1)*1.5;
+ if l mod 2=1:
+ vdepla:=(Cote*cm*((l-1) div 2),nbv*Cote*cm*sqrt(3)/3);
+ else:
+ vdepla:=(Cote*cm*((l-1) div 2),nbv*Cote*cm*sqrt(3)/3)+(C-B);
+ fi;
+ else:
+ nbv:=(k-1)*1.5+0.5;
+ if l mod 2=1:
+ vdepla:=(Cote*cm*((l-1) div 2),nbv*Cote*cm*sqrt(3)/3);
+ else:
+ vdepla:=(Cote*cm*((l-1) div 2),(nbv*Cote*cm*sqrt(3)/3))+(xpart(C-B),-ypart(C-B));
+ fi;
+ fi;
+ label(LATEX(decimal(n)),B shifted vdepla);
+ endfor;
+ endfor;
+ elseif Niveau=4:
+ B=iso(A1,A2,A3,A4);
+ for k=1 upto Lignes:
+ for l=1 upto Colonnes:
+ n:=n+1;
+ vdepla:=Cote*cm*((l-1),(k-1));
+ label(LATEX(decimal(n)),B shifted vdepla);
+ endfor;
+ endfor;
+ elseif Niveau=6:
+ B=iso(A1,A2,A3,A4,A5,A6);
+ C=symetrie(B,A3,A4);
+ for k=1 upto Lignes-1:
+ for l=1 upto 2*Colonnes-1:
+ n:=n+1;
+ nbv:=(k-1)*3;
+ if l mod 2=1:
+ vdepla:=(1.5*Cote*cm*(l-1)+1.5*Cote*cm,nbv*Cote*cm*sqrt(3)/3);
+ else:
+ vdepla:=(1.5*Cote*cm*(l-2)+1.5*Cote*cm,nbv*Cote*cm*sqrt(3)/3)+(C-B);
+ fi;
+ if k=Lignes-1:
+ if l mod 2=1:
+ label(LATEX(decimal(n)),B shifted vdepla);
+ else:
+ n:=n-1;
+ fi;
+ else:
+ label(LATEX(decimal(n)),B shifted vdepla);
+ fi;
+ endfor;
+ endfor;
+ fi;
+ enddef;
+ vardef EffectuerTraces=
+ \useKV[Pavage]{Traces}
+ enddef;
+}%
+
+\def\MPReseauCode{%
+ boolean Before,Numerote,Backgrounds,After;
+ Before=\useKV[Pavage]{Before};
+ After=\useKV[Pavage]{After};
+ Numerote=\useKV[Pavage]{Numerotation};
+ Backgrounds=\useKV[Pavage]{Backgrounds};
+ color ColPavage,ColArrierePlan;
+ ColPavage=\useKV[Pavage]{Couleur};
+ ColArrierePlan=if Backgrounds:\useKV[Pavage]{ArrierePlan} else:ColPavage fi;
+ Cote=\useKV[Pavage]{Cote};
+ Lignes=\useKV[Pavage]{Lignes};
+ Colonnes=\useKV[Pavage]{Colonnes};
+ Niveau=\useKV[Pavage]{Niveau};
+ Depart=\useKV[Pavage]{Depart};
+ Epaisseur=\useKV[Pavage]{Epaisseur};
+ pair basei,basej;
+ basei=\useKV[Pavage]{Basei};
+ basej=\useKV[Pavage]{Basej};
+ vardef PavageReseau=
+ for k=0 upto Lignes-1:
+ for l=0 upto Colonnes -1:
+ trace Motif shifted (k*basei+l*basej);
+ endfor;
+ endfor;
+ enddef;
+ vardef Numerotation=
+ n:=Depart;
+ k:=0;
+ pair A[],B[];
+ A[0]=point(0) of Motif;
+ B[0]=A[0];
+ forever:
+ k:=k+1;
+ A[k]=point(k) of Motif;
+ B[0]:=B[0]+A[k];
+ exitif A[k]=A[0];
+ endfor;
+ B[0]:=B[0]/k;
+ for k=0 upto Lignes-1:
+ for l=0 upto Colonnes -1:
+ n:=n+1;
+ label(decimal(n),B[0] shifted(k*basei+l*basej));
+ endfor;
+ endfor;
+ enddef;
+ vardef PlacePointSupport=
+ pair M[][];
+ path Maille[];
+ n:=Depart;
+ k:=0;
+ pair A[],B[];
+ A[0]=point(0) of Motif;
+ forever:
+ k:=k+1;
+ A[k]=point(k) of Motif;
+ B[0]:=B[0]+A[k];
+ exitif A[k]=A[0];
+ endfor;
+ B[0]:=B[0]/k;
+ NbSommet:=k;
+ for k=0 upto Lignes-1:
+ for l=0 upto Colonnes -1:
+ n:=n+1;
+ for m=1 upto NbSommet:
+ M[n][m]=A[m] shifted (k*basei+l*basej);
+ endfor;
+ Maille[n]=polygone(M[n][1] for r=2 upto NbSommet:,M[n][r] endfor);
+ endfor;
+ endfor;
+ enddef;
+ vardef EffectuerTraces=
+ \useKV[Pavage]{Traces}
+ enddef;
+}%
+
+\def\MPPeriodiqueCode{%
+ boolean Before,Numerote,Backgrounds,After;
+ Before=\useKV[Pavage]{Before};
+ After=\useKV[Pavage]{After};
+ Numerote=\useKV[Pavage]{Numerotation};
+ Backgrounds=\useKV[Pavage]{Backgrounds};
+ color ColPavage,ColArrierePlan;
+ ColPavage=\useKV[Pavage]{Couleur};
+ ColArrierePlan=if Backgrounds:\useKV[Pavage]{ArrierePlan} else:ColPavage fi;
+ Cote=\useKV[Pavage]{Cote};
+ Lignes=\useKV[Pavage]{Lignes};
+ Colonnes=\useKV[Pavage]{Colonnes};
+ Niveau=\useKV[Pavage]{Niveau};
+ Depart=\useKV[Pavage]{Depart};
+ Epaisseur=\useKV[Pavage]{Epaisseur};
+ pair basei,basej;
+ vardef PavagePeriodique=
+ basei=iso(A1,A2)-iso(A1,A0);
+ basej=iso(A0,A3)-iso(A1,A0);
+ path CadrePavage;
+ pair Cpa[];
+ Cpa1=(0,ypart(-2*basej));
+ Cpa2=(xpart(2*Colonnes*basei),ypart(-2*basej));
+ Cpa3=(xpart(2*Colonnes*basei),ypart(2*Lignes*basej));
+ Cpa4=(0,ypart(2*Lignes*basej));
+ CadrePavage=Cpa1--Cpa2--Cpa3--Cpa4--cycle;
+ picture BlocContour,BlocPavage;
+ BlocContour=image(
+ for k=-Lignes upto Lignes+1:
+ for l=-1 upto Colonnes+1:
+ if ColPavage<>white:
+ fill Motif shifted (2*l*basei+2*k*basej) withcolor ColPavage;
+ fill symetrie(Motif,iso(A1,A2)) shifted (2*l*basei+2*k*basej) withcolor ColPavage;
+ fi;
+ trace Motif shifted (2*l*basei+2*k*basej);
+ trace symetrie(Motif,iso(A1,A2)) shifted (2*l*basei+2*k*basej);
+ endfor;
+ endfor;
+ drawoptions();
+ );
+ BlocPavage=image(
+ trace BlocContour;
+ clip currentpicture to CadrePavage;
+ trace CadrePavage withpen pencircle scaled Epaisseur;
+ );
+ BlocPavage
+ enddef;
+ vardef Numerotation=
+ n:=-1;
+ pair ISO;
+ for k=-Lignes upto Lignes+1:
+ for l=-1 upto Colonnes+1:
+ n:=n+2;
+ ISO:=B[0] shifted (2*l*basei+2*k*basej);
+ if (xpart(ISO)>xpart(Cpa1+u*(0.2,0))) and (xpart(ISO)<xpart(Cpa2-u*(0.2,0))) and (ypart(ISO)>ypart(Cpa1+u*(0.2,0))) and (ypart(ISO)<ypart(Cpa4-u*(0.2,0))):
+ label(TEX(decimal(n)),ISO);
+ else:
+ n:=n-2;
+ fi;
+ endfor;
+ endfor;
+ %2eme tour
+ n:=-1;
+ for k=-Lignes upto Lignes+1:
+ for l=-1 upto Colonnes+1:
+ n:=n+2;
+ ISO:=symetrie(B[0],iso(A1,A2)) shifted (2*l*basei+2*k*basej);
+ if (xpart(ISO)>xpart(Cpa1+u*(0.2,0))) and (xpart(ISO)<xpart(Cpa2-u*(0.2,0))) and (ypart(ISO)>ypart(Cpa1+u*(0,0.2))) and (ypart(ISO)<ypart(Cpa4-u*(0,0.2))):
+ label(TEX(decimal(n+1)),ISO);
+ else:
+ n:=n-2;
+ fi;
+ endfor;
+ endfor;
+ enddef;
+ vardef PlacePointSupport=
+ path Maille[];
+ pair QuadA[],QuadB[],QuadC[],QuadD[];
+ n:=-1;
+ pair ISO;
+ for k=-Lignes upto Lignes+1:
+ for l=-1 upto Colonnes+1:
+ n:=n+2;
+ ISO:=B[0] shifted (2*l*basei+2*k*basej);
+ if (xpart(ISO)>xpart(Cpa1+u*(0.2,0))) and (xpart(ISO)<xpart(Cpa2-u*(0.2,0))) and (ypart(ISO)>ypart(Cpa1+u*(0,0.2))) and (ypart(ISO)<ypart(Cpa4-u*(0,0.2))):
+ QuadA[n]=A0 shifted (2*l*basei+2*k*basej);
+ QuadB[n]=A1 shifted (2*l*basei+2*k*basej);
+ QuadC[n]=A2 shifted (2*l*basei+2*k*basej);
+ QuadD[n]=A3 shifted (2*l*basei+2*k*basej);
+ Maille[n]=polygone(QuadA[n],QuadB[n],QuadC[n],QuadD[n]);
+ else:
+ n:=n-2;
+ fi;
+ endfor;
+ endfor;
+ %2eme tour
+ n:=-1;
+ for k=-Lignes upto Lignes+1:
+ for l=-1 upto Colonnes+1:
+ n:=n+2;
+ ISO:=symetrie(B[0],iso(A1,A2)) shifted (2*l*basei+2*k*basej);
+ if (xpart(ISO)>xpart(Cpa1+u*(0.2,0))) and (xpart(ISO)<xpart(Cpa2-u*(0.2,0))) and (ypart(ISO)>ypart(Cpa1+u*(0,0.2))) and (ypart(ISO)<ypart(Cpa4-u*(0,0.2))):
+ QuadA[n+1]=symetrie(A0,iso(A1,A2)) shifted (2*l*basei+2*k*basej);
+ QuadB[n+1]=symetrie(A1,iso(A1,A2)) shifted (2*l*basei+2*k*basej);
+ QuadC[n+1]=symetrie(A2,iso(A1,A2)) shifted (2*l*basei+2*k*basej);
+ QuadD[n+1]=symetrie(A3,iso(A1,A2)) shifted (2*l*basei+2*k*basej);
+ Maille[n+1]=polygone(QuadA[n+1],QuadB[n+1],QuadC[n+1],QuadD[n+1]);
+ else:
+ n:=n-2;
+ fi;
+ endfor;
+ endfor;
+ enddef;
+ vardef EffectuerTraces=
+ \useKV[Pavage]{Traces}
+ enddef;
+}%
+
+\def\MPPavageEscherCode{%
+ boolean Before,Numerote,Backgrounds,After,Colore;
+ Before=\useKV[Pavage]{Before};
+ After=\useKV[Pavage]{After};
+ Numerote=\useKV[Pavage]{Numerotation};
+ Backgrounds=\useKV[Pavage]{Backgrounds};
+ Colore=\useKV[Pavage]{Colore};
+ color ColPavage,ColArrierePlan,CouleurUn,CouleurDeux,CouleurTrois,CouleurQuatre;
+ if Colore:
+ CouleurUn=\useKV[Pavage]{CouleurUn};
+ CouleurDeux=\useKV[Pavage]{CouleurDeux};
+ CouleurTrois=\useKV[Pavage]{CouleurTrois};
+ CouleurQuatre=\useKV[Pavage]{CouleurQuatre};
+ fi;
+ ColPavage=\useKV[Pavage]{Couleur};
+ ColArrierePlan=if Backgrounds:\useKV[Pavage]{ArrierePlan} else:ColPavage fi;
+ Cote=\useKV[Pavage]{Cote};
+ Rayon=\useKV[Pavage]{Rayon};
+ Lignes=\useKV[Pavage]{Lignes};
+ Colonnes=\useKV[Pavage]{Colonnes};
+ Niveau=\useKV[Pavage]{Niveau};
+ Depart=\useKV[Pavage]{Depart};
+ Ecart=\useKV[Pavage]{Ecart};
+ Position=\useKV[Pavage]{Position};
+ Epaisseur=\useKV[Pavage]{Epaisseur};
+ pair basei,basej;
+ picture Motif;
+ vardef PavageEscher=
+ path cc;
+ cc=cercles((0,0),u*Rayon);
+ if Niveau=3:
+ pair O[];
+ O1=pointarc(cc,0);
+ O3=pointarc(cc,120);
+ O5=pointarc(cc,240);
+ O2=Position[O3,O1]+Ecart*unitvector((O3-O1) rotated -90);
+ O4=rotation(O2,O3,-120);
+ O6=rotation(O4,O5,-120);
+ picture Motif;
+ Motif=image(
+ if Colore:
+ if known CouleurUn: fill polygone(O1,O2,O3,O4,O5,O6) withcolor CouleurUn fi;
+ if known CouleurDeux: fill rotation(polygone(O1,O2,O3,O4,O5,O6),O1,120) withcolor CouleurDeux fi;
+ if known CouleurTrois:fill rotation(polygone(O1,O2,O3,O4,O5,O6),O1,-120) withcolor CouleurTrois fi;
+ fi;
+ trace polygone(O1,O2,O3,O4,O5,O6);
+ trace rotation(polygone(O1,O2,O3,O4,O5,O6),O1,120);
+ trace rotation(polygone(O1,O2,O3,O4,O5,O6),O1,-120);
+ );
+ basei=(rotation(O2,O1,-120)-O4);
+ basej:=(rotation(O5,O1,-120)-O5);
+ elseif Niveau=4:
+ pair O[];
+ O1=pointarc(cc,0);
+ O3=pointarc(cc,90);
+ O5=pointarc(cc,180);
+ O7=pointarc(cc,270);
+ O2=Position[O3,O1]+Ecart*unitvector((O3-O1) rotated -90);
+ O4=rotation(O2,O3,-90);
+ O6=rotation(O4,O5,-90);
+ O8=rotation(O6,O7,-90);
+ picture Motif;
+ Motif=image(
+ if Colore:
+ if known CouleurUn: fill polygone(O1,O2,O3,O4,O5,O6,O7,O8) withcolor CouleurUn fi;
+ if known CouleurDeux: fill rotation(polygone(O1,O2,O3,O4,O5,O6,O7,O8),O1,90) withcolor CouleurDeux fi;
+ if known CouleurTrois:fill rotation(polygone(O1,O2,O3,O4,O5,O6,O7,O8),O1,180) withcolor CouleurTrois fi;
+ if known CouleurQuatre:fill rotation(polygone(O1,O2,O3,O4,O5,O6,O7,O8),O1,270) withcolor CouleurQuatre fi;
+ fi;
+ trace polygone(O1,O2,O3,O4,O5,O6,O7,O8);
+ trace rotation(polygone(O1,O2,O3,O4,O5,O6,O7,O8),O1,90);
+ trace rotation(polygone(O1,O2,O3,O4,O5,O6,O7,O8),O1,180);
+ trace rotation(polygone(O1,O2,O3,O4,O5,O6,O7,O8),O1,270);
+ );
+ basei=(rotation(O5,O1,180)-O5);
+ basej:=(rotation(O5,O1,-90)-O5);
+ elseif Niveau=6:
+ pair O[];
+ O1=pointarc(cc,0);
+ O3=pointarc(cc,60);
+ O5=pointarc(cc,120);
+ O7=pointarc(cc,180);
+ O9=pointarc(cc,240);
+ O11=pointarc(cc,300);
+ O2=Position[O3,O1]+Ecart*unitvector((O3-O1) rotated -90);
+ O4=rotation(O2,O3,-120);
+ O6=rotation(O4,O5,-120);
+ O8=rotation(O6,O7,-120);
+ O10=rotation(O8,O9,-120);
+ O12=rotation(O10,O11,-120);
+ picture Motif;
+ Motif=image(
+ if Colore:
+ if known CouleurUn: fill polygone(O1,O2,O3,O4,O5,O6,O7,O8,O9,O10,O11,O12) withcolor CouleurUn fi;
+ if known CouleurDeux: fill rotation(polygone(O1,O2,O3,O4,O5,O6,O7,O8,O9,O10,O11,O12),O1,120) withcolor CouleurDeux fi;
+ if known CouleurTrois: fill rotation(polygone(O1,O2,O3,O4,O5,O6,O7,O8,O9,O10,O11,O12),O1,-120) withcolor CouleurTrois fi;
+ fi;
+ trace polygone(O1,O2,O3,O4,O5,O6,O7,O8,O9,O10,O11,O12);
+ trace rotation(polygone(O1,O2,O3,O4,O5,O6,O7,O8,O9,O10,O11,O12),O1,120);
+ trace rotation(polygone(O1,O2,O3,O4,O5,O6,O7,O8,O9,O10,O11,O12),O1,-120);
+ );
+ basei=(rotation(O4,O1,-120)-O6);
+ basej:=(rotation(O9,O1,-120)-O9);
+ fi;
+ path CadrePavage;
+ pair Cpa[];
+ Cpa1=(0,ypart(-2*basej));
+ Cpa2=(xpart(2*Colonnes*basei),ypart(-2*basej));
+ Cpa3=(xpart(2*Colonnes*basei),ypart(2*Lignes*basej));
+ Cpa4=(0,ypart(2*Lignes*basej));
+ CadrePavage=Cpa1--Cpa2--Cpa3--Cpa4--cycle;
+ picture BlocContour,BlocPavage;
+ BlocContour=image(
+ for k=-2*Lignes upto 2*Lignes:
+ for l=-2*Colonnes upto 2*Colonnes:
+ trace Motif shifted (l*basei+k*basej);
+ endfor;
+ endfor;
+ );
+ BlocPavage=image(
+ trace BlocContour;
+ clip currentpicture to CadrePavage;
+ trace CadrePavage withpen pencircle scaled Epaisseur;
+ );
+ BlocPavage
+ enddef;
+ vardef BaryMotif(expr nimech)=
+ save Escherbary;
+ pair Escherbary,EB[],EBSom;
+ tour:=0;
+ EB[0]=point(0) of nimech;
+ EBSom=(0,0);
+ forever:
+ tour:=tour+1;
+ EB[tour]=point(tour) of nimech;
+ EBSom:=EBSom+EB[tour];
+ exitif EB[tour]=EB[0];
+ endfor;
+ Escherbary=EBSom/tour;
+ Escherbary
+ enddef;
+ %
+ vardef Numerotation=
+ pair ISORetiens;
+ for k=1 upto TotalMaille:
+ ISORetiens:=BaryMotif(Maille[k]);
+ label(TEX(""&decimal(k)&""),ISORetiens);
+ endfor;
+ enddef;
+ %
+ vardef AssocierPoint(expr nbpt,ll,kk,aanngg)=
+ PointE[nbpt][1]=rotation(O1,O1,aanngg) shifted (ll*basei+kk*basej);
+ PointE[nbpt][2]=rotation(O2,O1,aanngg) shifted (ll*basei+kk*basej);
+ PointE[nbpt][3]=rotation(O3,O1,aanngg) shifted (ll*basei+kk*basej);
+ PointE[nbpt][4]=rotation(O4,O1,aanngg) shifted (ll*basei+kk*basej);
+ PointE[nbpt][5]=rotation(O5,O1,aanngg) shifted (ll*basei+kk*basej);
+ PointE[nbpt][6]=rotation(O6,O1,aanngg) shifted (ll*basei+kk*basej);
+ if Niveau>3:
+ PointE[nbpt][7]=rotation(O7,O1,aanngg) shifted (ll*basei+kk*basej);
+ PointE[nbpt][8]=rotation(O8,O1,aanngg) shifted (ll*basei+kk*basej);
+ fi;
+ if Niveau>4:
+ PointE[nbpt][9]=rotation(O9,O1,aanngg) shifted (ll*basei+kk*basej);
+ PointE[nbpt][10]=rotation(O10,O1,aanngg) shifted (ll*basei+kk*basej);
+ PointE[nbpt][11]=rotation(O11,O1,aanngg) shifted (ll*basei+kk*basej);
+ PointE[nbpt][12]=rotation(O12,O1,aanngg) shifted (ll*basei+kk*basej);
+ fi;
+ enddef;
+ vardef AssocierMaille(expr nbpt)=
+ Maille[nbpt]=if Niveau=3:
+ polygone(PointE[nbpt][1],PointE[nbpt][2],PointE[nbpt][3],PointE[nbpt][4],PointE[nbpt][5],PointE[nbpt][6])
+ elseif Niveau=4:
+ polygone(PointE[nbpt][1],PointE[nbpt][2],PointE[nbpt][3],PointE[nbpt][4],PointE[nbpt][5],PointE[nbpt][6],PointE[nbpt][7],PointE[nbpt][8])
+ elseif Niveau=6:
+ polygone(PointE[nbpt][1],PointE[nbpt][2],PointE[nbpt][3],PointE[nbpt][4],PointE[nbpt][5],PointE[nbpt][6],PointE[nbpt][7],PointE[nbpt][8],PointE[nbpt][9],PointE[nbpt][10],PointE[nbpt][11],PointE[nbpt][12])
+ fi;
+ enddef;
+ vardef PlacePointSupport=
+ pair PointE[][];
+ path Maille[];
+ pair ISO[];
+ if Niveau=3:
+ ISO1:=(0,0);
+ ISO2=rotation(ISO1,O1,120);
+ ISO3=rotation(ISO1,O1,-120);
+ basei=(rotation(O2,O1,-120)-O4);
+ basej:=(rotation(O5,O1,-120)-O5);
+ elseif Niveau=4:
+ ISO1=(0,0);
+ ISO2=rotation(ISO1,O1,90);
+ ISO3=rotation(ISO1,O1,180);
+ ISO4=rotation(ISO1,O1,270);
+ basei=(rotation(O5,O1,180)-O5);
+ basej:=(rotation(O5,O1,-90)-O5);
+ elseif Niveau=6:
+ ISO1=(0,0);
+ ISO2=rotation(ISO1,O1,120);
+ ISO3=rotation(ISO1,O1,-120);
+ basei=(rotation(O4,O1,-120)-O6);
+ basej:=(rotation(O9,O1,-120)-O9);
+ fi;
+ n:=0;
+ pair ISORetiens;
+ for k=-2*Lignes upto 2*Lignes:
+ for l=-2*Colonnes upto 2*Colonnes:
+ n:=n+1;
+ ISORetiens:=ISO1 shifted (l*basei+k*basej);
+ if (xpart(ISORetiens)>xpart(Cpa1+u*(0.2,0))) and (xpart(ISORetiens)<xpart(Cpa2-u*(0.2,0))) and (ypart(ISORetiens)>ypart(Cpa1+u*(0,0.2))) and (ypart(ISORetiens)<ypart(Cpa4-u*(0,0.2))):
+ AssocierPoint(n,l,k,0);
+ AssocierMaille(n);
+ else:
+ n:=n-1;
+ fi;
+ n:=n+1;
+ ISORetiens:=ISO2 shifted (l*basei+k*basej);
+ if (xpart(ISORetiens)>xpart(Cpa1+u*(0.2,0))) and (xpart(ISORetiens)<xpart(Cpa2-u*(0.2,0))) and (ypart(ISORetiens)>ypart(Cpa1+u*(0,0.2))) and (ypart(ISORetiens)<ypart(Cpa4-u*(0,0.2))):
+ if Niveau=4:
+ AssocierPoint(n,l,k,90);
+ else:
+ AssocierPoint(n,l,k,120);
+ fi;
+ AssocierMaille(n);
+ else:
+ n:=n-1;
+ fi;
+ n:=n+1;
+ ISORetiens:=ISO3 shifted (l*basei+k*basej);
+ if (xpart(ISORetiens)>xpart(Cpa1+u*(0.2,0))) and (xpart(ISORetiens)<xpart(Cpa2-u*(0.2,0))) and (ypart(ISORetiens)>ypart(Cpa1+u*(0,0.2))) and (ypart(ISORetiens)<ypart(Cpa4-u*(0,0.2))):
+ if Niveau=4:
+ AssocierPoint(n,l,k,180);
+ else:
+ AssocierPoint(n,l,k,-120);
+ fi;
+ AssocierMaille(n);
+ else:
+ n:=n-1;
+ fi;
+ if Niveau=4:
+ n:=n+1;
+ ISORetiens:=ISO4 shifted (l*basei+k*basej);
+ if (xpart(ISORetiens)>xpart(Cpa1+u*(0.2,0))) and (xpart(ISORetiens)<xpart(Cpa2-u*(0.2,0))) and (ypart(ISORetiens)>ypart(Cpa1+u*(0,0.2))) and (ypart(ISORetiens)<ypart(Cpa4-u*(0,0.2))):
+ AssocierPoint(n,l,k,270);
+ AssocierMaille(n);
+ else:
+ n:=n-1;
+ fi;
+ fi;
+ endfor;
+ endfor;
+ TotalMaille=n;
+ enddef;
+ %
+ vardef EffectuerTraces=
+ \useKV[Pavage]{Traces}
+ enddef;
+}%
+
+\def\MPPavageEscher{%
+ \ifluatex%
+ \mplibforcehmode%
+ \begin{mplibcode}
+ \MPPavageEscherCode
+ picture Motif;
+ trace PavageEscher;
+ PlacePointSupport;
+ if After:
+ EffectuerTraces;
+ fi;
+ if Numerote:
+ Numerotation;
+ fi;
+ \end{mplibcode}
+ \else
+ \begin{mpost}[mpsettings={\MPPavageEscherCode}]
+ picture Motif;
+ trace PavageEscher;
+ PlacePointSupport;
+ if After:
+ EffectuerTraces;
+ fi;
+ if Numerote:
+ Numerotation;
+ fi;
+ \end{mpost}
+ \fi%
+}%
+
+\def\MPPeriodique{%
+ \ifluatex
+ \mplibforcehmode
+ \begin{mplibcode}
+ \MPPeriodiqueCode
+ path Motif;
+ if Before:
+ Motif=\useKV[Pavage]{Motif};
+ else:
+ Motif=(0,0)--u*(1,-2)--u*(2,0.5)--u*(0.75,1)--cycle;
+ fi;
+ pair A[],B[];
+ A[0]=point(0) of Motif;
+ B[0]=A[0];
+ k:=0;
+ forever:
+ k:=k+1;
+ A[k]=point(k) of Motif;
+ B[0]:=B[0]+A[k];
+ exitif A[k]=A[0];
+ endfor;
+ B[0]:=B[0]/k;
+ trace PavagePeriodique;
+ PlacePointSupport;
+ if After:
+ EffectuerTraces;
+ fi;
+ if Numerote:
+ Numerotation;
+ fi;
+ \end{mplibcode}
+ \else
+ \begin{mpost}[\MPPeriodiqueCode]
+ path Motif;
+ if Before:
+ Motif=\useKV[Pavage]{Motif};
+ else:
+ Motif=(0,0)--u*(1,-2)--u*(2,0.5)--u*(0.75,1)--cycle;
+ fi;
+ pair A[],B[];
+ A[0]=point(0) of Motif;
+ B[0]=A[0];
+ k:=0;
+ forever:
+ k:=k+1;
+ A[k]=point(k) of Motif;
+ B[0]:=B[0]+A[k];
+ exitif A[k]=A[0];
+ endfor;
+ B[0]:=B[0]/k;
+ trace PavagePeriodique;
+ PlacePointSupport;
+% if Numerote:
+% Numerotation;
+% fi;
+ if After:
+ EffectuerTraces;
+ fi;
+ \end{mpost}
+ \fi
+}%
+
+\def\MPReseau{%
+ \ifluatex
+ \mplibforcehmode
+ \begin{mplibcode}
+ \MPReseauCode
+ path Motif;
+ if Before:
+ Motif=\useKV[Pavage]{Motif};
+ else:
+ Motif=u*(0,0)--u*(0.75,0)--u*(1,0.5)--u*(0.25,0.5)--cycle;
+ fi;
+ PavageReseau;
+ PlacePointSupport;
+ if After:
+ EffectuerTraces;
+ fi;
+ if Numerote:
+ Numerotation;
+ fi;
+ \end{mplibcode}
+ \else
+ \begin{mpost}[mpsettings={\MPReseauCode}]
+ path Motif;
+ if Before:
+ Motif=\useKV[Pavage]{Motif};
+ else:
+ Motif=u*(0,0)--u*(0.75,0)--u*(1,0.5)--u*(0.25,0.5)--cycle;
+ fi;
+ PavageReseau;
+ PlacePointSupport;
+ if After:
+ EffectuerTraces;
+ fi;
+ if Numerote:
+ Numerotation;
+ fi;
+ \end{mpost}
+ \fi
+}%
+
+\def\MPRegulier{%
+ \ifluatex
+ \mplibforcehmode
+ \begin{mplibcode}
+ \MPReseauRegulier
+ trace PavageRegulier(Niveau);
+ PlacePointSupport;
+ if Numerote:
+ Numerotation;
+ fi;
+ if After:
+ EffectuerTraces;
+ fi;
+ \end{mplibcode}
+ \else
+ \begin{mpost}[mpsettings={\MPReseauRegulier}]
+ trace PavageRegulier(Niveau);
+ PlacePointSupport;
+ if Numerote:
+ Numerotation;
+ fi;
+ if After:
+ EffectuerTraces;
+ fi;
+ \end{mpost}
+ \fi
+}%
+
+\def\MPPavage{%
+ \ifluatex%
+ \mplibforcehmode%
+ \begin{mplibcode}%
+ \MPPavageBase
+ path Motif;
+ if Before:
+ Motif=\useKV[Pavage]{Motif};
+ else:
+ Motif=u*(0,0)..u*(0.25,.1)..u*(0.5,0.7)..u*(1,1);
+ fi;
+ if Demo:
+ trace pavagescar(Motif,0,ColPavage);
+ else:
+ trace pavages(Motif,Niveau,ColPavage);
+ fi;
+ PlacePointSupport;
+ if Numerote:
+ Numerotation;
+ fi;
+ if After:
+ EffectuerTraces;
+ fi;
+ if Demo=false:
+ trace CadrePavage withpen pencircle scaled Epaisseur;
+ fi;
+ \end{mplibcode}
+ \else
+ \begin{mpost}[mpsettings={\MPPavageBase}]
+ path Motif;
+ if Before:
+ Motif=\useKV[Pavage]{Motif};
+ else:
+ Motif=u*(0,0)..u*(0.25,.1)..u*(0.5,0.7)..u*(1,1);
+ fi;
+ trace pavages(Motif,Niveau,ColPavage);
+ PlacePointSupport;
+ if Numerote:
+ Numerotation;
+ fi;
+ if After:
+ EffectuerTraces;
+ fi;
+ trace CadrePavage withpen pencircle scaled Epaisseur;
+ \end{mpost}
+ \fi%
+}%
+
+\NewDocumentCommand\Pavage{o}{%
+ \useKVdefault[Pavage]%
+ \setKV[Pavage]{#1}%
+ \ifboolKV[Pavage]{Regulier}{%
+ \MPRegulier%
+ }{%
+ \ifboolKV[Pavage]{SemiRegulier}{%
+ %
+ }{%
+ \ifboolKV[Pavage]{Reseau}{%
+ \MPReseau%
+ }{%
+ \ifboolKV[Pavage]{Quadrilatere}{%
+ \MPPeriodique%
+ }{%
+ \ifboolKV[Pavage]{Escher}{%
+ \MPPavageEscher%
+ }{%
+ \MPPavage%
+ }%
+ }%
+ }%
+ }%
+ }%
+}% \ No newline at end of file
diff --git a/macros/latex/contrib/profcollege/latex/PfCPavageAvecMotifImage.tex b/macros/latex/contrib/profcollege/latex/PfCPavageAvecMotifImage.tex
new file mode 100644
index 0000000000..a7cfd4eeb6
--- /dev/null
+++ b/macros/latex/contrib/profcollege/latex/PfCPavageAvecMotifImage.tex
@@ -0,0 +1,1040 @@
+%%%
+% Pavage
+%%%
+\setKVdefault[Pavage]{%
+ Before=false,
+ Niveau=3,
+ Couleur=orange,
+ Backgrounds=false,
+ Numerotation=false,
+ Depart=0,
+ Complete=false,
+ After=false,
+ Demo=false,
+ Regulier=false,
+ Cote=1,
+ Lignes=4,
+ Colonnes=4,
+ SemiRegulier=false,
+ Reseau=false,
+ Basei={u*(0.75,0)},
+ Basej={u*(0,0.5)},
+ Periodique=false,
+ Image=false
+}%
+\defKV[Pavage]{Motif=\setKV[Pavage]{Before}}
+\defKV[Pavage]{Traces=\setKV[Pavage]{After}}
+\defKV[Pavage]{ArrierePlan=\setKV[Pavage]{Backgrounds}}
+
+\def\MPPavageBase{%
+ boolean Before,Numerote,Complete,Backgrounds,After,Demo;
+ Before=\useKV[Pavage]{Before};
+ After=\useKV[Pavage]{After};
+ Numerote=\useKV[Pavage]{Numerotation};
+ Complete=\useKV[Pavage]{Complete};
+ Backgrounds=\useKV[Pavage]{Backgrounds};
+ Demo=\useKV[Pavage]{Demo};
+ color ColPavage,ColArrierePlan;
+ ColPavage=\useKV[Pavage]{Couleur};
+ ColArrierePlan=if Backgrounds:\useKV[Pavage]{ArrierePlan} else:ColPavage fi;
+ Niveau=\useKV[Pavage]{Niveau};
+ Depart=\useKV[Pavage]{Depart};
+ vardef pavages(expr chemin,tour,coul)=
+ if Backgrounds:
+ fill CadrePavage withcolor ColArrierePlan;
+ trace CadrePavage;
+ fi;
+ save Base;
+ picture Base;
+ pair A,B,C,D;
+ A=u*(0,0);
+ B=u*(1,0);
+ C=u*(1,1);
+ D=u*(0,1);
+ path especes;
+ especes=chemin--rotation(chemin,B,-90)--reverse(rotation(symetrie(chemin,B,C),B,-90))--rotation(chemin,B,90)--cycle;
+ if tour=0:
+ Base=image(
+ trace chemin;
+ );
+ elseif tour=1:
+ Base=image(
+ fill especes withcolor coul;
+ trace especes;
+ A:=A shifted(u*(0,-1));
+ B:=B shifted(u*(1,-1));
+ C:=C shifted(u*(1,0));
+ );
+ elseif tour>=2:
+ Base=pavages(chemin,tour-1,coul);
+ Base:=image(
+ trace Base;
+ trace symetrie(Base,B,C);
+ trace rotation(symetrie(Base,B,C),B,-90);
+ trace rotation(Base,B,90);
+ A:=A shifted(u*(0,-(2**(tour-1))));
+ B:=B shifted(u*(2**(tour-1),-(2**(tour-1))));
+ C:=C shifted(u*(2**(tour-1),0));
+ );
+ fi;
+ Base
+enddef;
+%
+vardef pavagescar(expr chemin,tour,coul)=
+ save BaseCar;
+ picture BaseCar;
+ pair A,B,C,D;
+ A=u*(0,0);
+ B=u*(1,0);
+ C=u*(1,1);
+ D=u*(0,1);
+ if tour=0:
+ BaseCar=image(
+ trace chemin;
+ trace A--B--C--D--cycle dashed dashpattern(on12bp off6bp on3bp off 6bp) withcolor gris;
+ );
+ elseif tour=1:
+ BaseCar=image(
+ trace chemin;
+ drawoptions(dashed evenly);
+ trace rotation(chemin,B,-90);
+ trace reverse(rotation(symetrie(chemin,B,C),B,-90));
+ trace rotation(chemin,B,90);
+ drawoptions();
+ A:=A shifted(u*(0,-1));
+ B:=B shifted(u*(1,-1));
+ C:=C shifted(u*(1,0));
+ trace A--B--C--D--cycle dashed dashpattern(on12bp off6bp on3bp off 6bp) withcolor gris;
+ trace iso(A,D)--iso(B,C) dashed dashpattern(on12bp off6bp on3bp off 6bp) withcolor gris;
+ trace iso(A,B)--iso(C,D) dashed dashpattern(on12bp off6bp on3bp off 6bp) withcolor gris;
+ );
+ elseif tour>=2:
+ BaseCar=image(
+ trace pavages(chemin,tour-1,coul);
+ trace symetrie(pavages(chemin,tour-1,coul),B,C);%coul+0.5blanc
+ trace rotation(symetrie(pavages(chemin,tour-1,coul),B,C),B,-90);
+ trace rotation(pavages(chemin,tour-1,coul),B,90);
+ A:=A shifted(u*(0,-(2**(tour-1))));
+ B:=B shifted(u*(2**(tour-1),-(2**(tour-1))));
+ C:=C shifted(u*(2**(tour-1),0));
+ );
+ fi;
+ BaseCar
+ enddef;
+ %
+ vardef CadrePavage=
+ u*(0,1)--u*(0,-(2**Niveau-1))--u*(2**Niveau,-(2**Niveau-1))--u*(2**(Niveau),1)--cycle
+ enddef;
+ %
+ vardef Numerotation=
+ n:=Depart;
+ pair B;
+ B=u*(1,0);
+ if Complete:
+ for k=0 upto 2**(Niveau)-2:
+ for l=0 upto (2**(Niveau-1))-1:
+ n:=n+1;
+ if (k mod 2)=0:
+ label(TEX(decimal(n)),B+u*(2l,-k));
+ else:
+ if l<(2**(Niveau-1))-1:
+ label(TEX(decimal(n)),B+u*(2l+1,-k));
+ else:
+ n:=n-1;
+ fi;
+ fi;
+ endfor;
+ endfor;
+ else:
+ for k=0 upto (2**(Niveau-1))-1:
+ for l=0 upto (2**(Niveau-1))-1:
+ n:=n+1;
+ label(TEX(decimal(n)),B+2u*(l,-k));
+ endfor;
+ endfor;
+ fi;
+ enddef;
+ %
+ vardef NumerotationPDF=
+ n:=Depart;
+ pair B;
+ B=u*(1,0);
+ if Complete:
+ for k=0 upto 2**(Niveau)-2:
+ for l=0 upto (2**(Niveau-1))-1:
+ n:=n+1;
+ if (k mod 2)=0:
+ label(TEX(decimal(n)),B+u*(2l,-k));
+ else:
+ if l<(2**(Niveau-1))-1:
+ label(LATEX(decimal(n)),B+u*(2l+1,-k));
+ fi;
+ fi;
+ endfor;
+ endfor;
+ else:
+ for k=0 upto (2**(Niveau-1))-1:
+ for l=0 upto (2**(Niveau-1))-1:
+ n:=n+1;
+ label(LATEX(decimal(n)),B+2u*(l,-k));
+ endfor;
+ endfor;
+ fi;
+ enddef;
+ %
+ vardef PlacePointSupport=
+ n:=Depart;
+ pair K[],L[],M[],N[];
+ K[0]=u*(0,0);
+ M[0]=u*(1,1);
+ if Complete:
+ for k=0 upto 2**(Niveau)-2:
+ for l=0 upto (2**(Niveau-1))-1:
+ n:=n+1;
+ if (k mod 2)=0:
+ K[n]:=K0+u*(2l,-k);
+ M[n]:=M0+u*(2l,-k);
+ else:
+ if l<(2**(Niveau-1))-1:
+ K[n]:=K0+u*(2l+1,-k);
+ M[n]:=M0+u*(2l+1,-k);
+ else:
+ n:=n-1;
+ fi;
+ fi;
+ endfor;
+ endfor;
+ else:
+ for k=0 upto (2**(Niveau-1))-1:
+ for l=0 upto (2**(Niveau-1))-1:
+ n:=n+1;
+ K[n]=K[0]+2u*(l,-k);
+ M[n]=M[0]+2u*(l,-k);
+ endfor;
+ endfor;
+ fi;
+ enddef;
+ vardef EffectuerTraces=
+ \useKV[Pavage]{Traces}
+ enddef;
+}
+
+\def\MPReseauRegulier{
+ boolean Before,Numerote,Backgrounds,After;
+ Before=\useKV[Pavage]{Before};
+ After=\useKV[Pavage]{After};
+ Numerote=\useKV[Pavage]{Numerotation};
+ Backgrounds=\useKV[Pavage]{Backgrounds};
+ color ColPavage,ColArrierePlan;
+ ColPavage=\useKV[Pavage]{Couleur};
+ ColArrierePlan=if Backgrounds:\useKV[Pavage]{ArrierePlan} else:ColPavage fi;
+ Cote=\useKV[Pavage]{Cote};
+ Lignes=\useKV[Pavage]{Lignes};
+ Colonnes=\useKV[Pavage]{Colonnes};
+ Niveau=\useKV[Pavage]{Niveau};
+ Depart=\useKV[Pavage]{Depart};
+ pair A[];
+ A1=(0,0);
+ A2-A1=u*Cote*(1,0);
+ vardef PavageRegulier(expr Niv)=
+ picture Retour;
+ if Niv=3:
+ A3=rotation(A2,A1,60);
+ path TriBase,CadrePavage;
+ TriBase=polygone(A1,A2,A3);
+ CadrePavage=polygone(A1,Cote*cm*(Colonnes,0),Cote*cm*(Colonnes,0.5*sqrt(3)*Lignes),Cote*cm*(0,0.5*sqrt(3)*Lignes));
+ Retour=image(
+ fill CadrePavage withcolor ColPavage;
+ for k=0 upto Lignes:
+ for l=-1 upto Colonnes+1:
+ if k mod 2=0:
+ trace TriBase shifted (Cote*cm*(l,0.5*sqrt(3)*k));
+ else:
+ trace TriBase shifted (Cote*cm*(l+0.5,0.5*sqrt(3)*k));
+ fi;
+ endfor;
+ endfor;
+ clip currentpicture to CadrePavage;
+ trace CadrePavage withpen pencircle scaled 1.5;
+ );
+ elseif Niv=4:
+ A3=rotation(A1,A2,-90);
+ A4-A3=A1-A2;
+ path QuadriBase,CadrePavage;
+ QuadriBase=polygone(A1,A2,A3,A4);
+ CadrePavage=polygone(A1,Cote*cm*(Colonnes,0),Cote*cm*(Colonnes,Lignes),Cote*cm*(0,Lignes));
+ Retour=image(
+ fill CadrePavage withcolor ColPavage;
+ for k=0 upto Lignes-1:
+ for l=0 upto Colonnes-1:
+ trace QuadriBase shifted (Cote*cm*(l,k));
+ endfor;
+ endfor;
+ clip currentpicture to CadrePavage;
+ trace CadrePavage withpen pencircle scaled 1.5;
+ );
+ elseif Niv=6:
+ A3=rotation(A1,A2,-120);
+ A4=rotation(A2,A3,-120);
+ A5=rotation(A3,A4,-120);
+ A6=rotation(A4,A5,-120);
+ path HexaBase,CadrePavage;
+ HexaBase=polygone(A1,A2,A3,A4,A5,A6);
+ CadrePavage=polygone(Cote*cm*(1,0),Cote*cm*(3*Colonnes,0),Cote*cm*(3*Colonnes,sqrt(3)*(Lignes-1)),Cote*cm*(1,sqrt(3)*(Lignes-1)));
+ Retour=image(%
+ fill CadrePavage withcolor ColPavage;
+ for k=-1 upto 2*Lignes+1:
+ for l=-1 upto Colonnes+1:
+ if k mod 2=1:
+ trace HexaBase shifted (Cote*cm*(3*l,0.5*sqrt(3)*k));
+ else:
+ trace HexaBase shifted (Cote*cm*(1.5+3*l,sqrt(3)+0.5*sqrt(3)*k));
+ fi;
+ endfor;
+ endfor;
+ clip currentpicture to CadrePavage;
+ trace CadrePavage withpen pencircle scaled 1.5;
+ );
+ fi;
+ Retour
+ enddef;
+ %
+ vardef PlacePointSupport=
+ n:=Depart;
+ pair B;pair C;pair vdepla;
+ pair Hexa[],Hexb[],Hexc[],Hexd[],Hexe[],Hexf[];
+ pair Cara[],Carb[],Carc[],Card[];
+ pair Tria[],Trib[],Tric[];
+ if Niveau=3:
+ B=iso(A1,A2,A3);
+ C=symetrie(B,A2,A3);
+ for k=1 upto Lignes:
+ for l=1 upto 2*Colonnes-1:
+ n:=n+1;
+ if k mod 2=1:
+ nbv:=(k-1)*1.5;
+ if l mod 2=1:
+ vdepla:=(Cote*cm*((l-1) div 2),nbv*Cote*cm*sqrt(3)/3);
+ else:
+ vdepla:=(Cote*cm*((l-1) div 2),nbv*Cote*cm*sqrt(3)/3)+(C-B);
+ fi;
+ else:
+ nbv:=(k-1)*1.5+0.5;
+ if l mod 2=1:
+ vdepla:=(Cote*cm*((l-1) div 2),nbv*Cote*cm*sqrt(3)/3);
+ else:
+ vdepla:=(Cote*cm*((l-1) div 2),(nbv*Cote*cm*sqrt(3)/3))+(xpart(C-B),-ypart(C-B));
+ fi;
+ fi;
+ if (n mod 2)=0:
+ Tria[n]=rotation(A1,B,180) shifted vdepla;
+ Trib[n]=rotation(A2,B,180) shifted vdepla;
+ Tric[n]=rotation(A3,B,180) shifted vdepla;
+ else:
+ Tria[n]-A1=vdepla;
+ Trib[n]-A2=vdepla;
+ Tric[n]-A3=vdepla;
+ fi;
+ endfor;
+ endfor;
+ elseif Niveau=4:
+ B=iso(A1,A2,A3,A4);
+ for k=1 upto Lignes:
+ for l=1 upto Colonnes:
+ n:=n+1;
+ vdepla:=Cote*cm*((l-1),(k-1));
+ Cara[n]-A1=vdepla;
+ Carb[n]-A2=vdepla;
+ Carc[n]-A3=vdepla;
+ Card[n]-A4=vdepla;
+ endfor;
+ endfor;
+ elseif Niveau=6:
+ B=iso(A1,A2,A3,A4,A5,A6);
+ C=symetrie(B,A3,A4);
+ for k=1 upto Lignes-1:
+ for l=1 upto 2*Colonnes-1:
+ n:=n+1;
+ nbv:=(k-1)*3;
+ if l mod 2=1:
+ vdepla:=(1.5*Cote*cm*(l-1)+1.5*Cote*cm,nbv*Cote*cm*sqrt(3)/3);
+ else:
+ vdepla:=(1.5*Cote*cm*(l-2)+1.5*Cote*cm,nbv*Cote*cm*sqrt(3)/3)+(C-B);
+ fi;
+ if k=Lignes-1:
+ if l mod 2=1:
+ Hexa[n]-A1=vdepla;
+ Hexb[n]-A2=vdepla;
+ Hexc[n]-A3=vdepla;
+ Hexd[n]-A4=vdepla;
+ Hexe[n]-A5=vdepla;
+ Hexf[n]-A6=vdepla;
+ else:
+ n:=n-1;
+ fi;
+ else:
+ Hexa[n]-A1=vdepla;
+ Hexb[n]-A2=vdepla;
+ Hexc[n]-A3=vdepla;
+ Hexd[n]-A4=vdepla;
+ Hexe[n]-A5=vdepla;
+ Hexf[n]-A6=vdepla;
+ fi;
+ endfor;
+ endfor;
+ fi;
+ enddef;
+ %
+ vardef Numerotation=
+ n:=Depart;
+ pair B;pair C;pair vdepla;
+ if Niveau=3:
+ B=iso(A1,A2,A3);
+ C=symetrie(B,A2,A3);
+ for k=1 upto Lignes:
+ for l=1 upto 2*Colonnes-1:
+ n:=n+1;
+ if k mod 2=1:
+ nbv:=(k-1)*1.5;
+ if l mod 2=1:
+ vdepla:=(Cote*cm*((l-1) div 2),nbv*Cote*cm*sqrt(3)/3);
+ else:
+ vdepla:=(Cote*cm*((l-1) div 2),nbv*Cote*cm*sqrt(3)/3)+(C-B);
+ fi;
+ else:
+ nbv:=(k-1)*1.5+0.5;
+ if l mod 2=1:
+ vdepla:=(Cote*cm*((l-1) div 2),nbv*Cote*cm*sqrt(3)/3);
+ else:
+ vdepla:=(Cote*cm*((l-1) div 2),(nbv*Cote*cm*sqrt(3)/3))+(xpart(C-B),-ypart(C-B));
+ fi;
+ fi;
+ label(TEX(decimal(n)),B shifted vdepla);
+ endfor;
+ endfor;
+ elseif Niveau=4:
+ B=iso(A1,A2,A3,A4);
+ for k=1 upto Lignes:
+ for l=1 upto Colonnes:
+ n:=n+1;
+ vdepla:=Cote*cm*((l-1),(k-1));
+ label(TEX(decimal(n)),B shifted vdepla);
+ endfor;
+ endfor;
+ elseif Niveau=6:
+ B=iso(A1,A2,A3,A4,A5,A6);
+ C=symetrie(B,A3,A4);
+ for k=1 upto Lignes-1:
+ for l=1 upto 2*Colonnes-1:
+ n:=n+1;
+ nbv:=(k-1)*3;
+ if l mod 2=1:
+ vdepla:=(1.5*Cote*cm*(l-1)+1.5*Cote*cm,nbv*Cote*cm*sqrt(3)/3);
+ else:
+ vdepla:=(1.5*Cote*cm*(l-2)+1.5*Cote*cm,nbv*Cote*cm*sqrt(3)/3)+(C-B);
+ fi;
+ if k=Lignes-1:
+ if l mod 2=1:
+ label(TEX(decimal(n)),B shifted vdepla);
+ else:
+ n:=n-1;
+ fi;
+ else:
+ label(TEX(decimal(n)),B shifted vdepla);
+ fi;
+ endfor;
+ endfor;
+ fi;
+ enddef;
+ %
+ vardef NumerotationPDF=
+ n:=Depart;
+ pair B;pair C;pair vdepla;
+ if Niveau=3:
+ B=iso(A1,A2,A3);
+ C=symetrie(B,A2,A3);
+ for k=1 upto Lignes:
+ for l=1 upto 2*Colonnes-1:
+ n:=n+1;
+ if k mod 2=1:
+ nbv:=(k-1)*1.5;
+ if l mod 2=1:
+ vdepla:=(Cote*cm*((l-1) div 2),nbv*Cote*cm*sqrt(3)/3);
+ else:
+ vdepla:=(Cote*cm*((l-1) div 2),nbv*Cote*cm*sqrt(3)/3)+(C-B);
+ fi;
+ else:
+ nbv:=(k-1)*1.5+0.5;
+ if l mod 2=1:
+ vdepla:=(Cote*cm*((l-1) div 2),nbv*Cote*cm*sqrt(3)/3);
+ else:
+ vdepla:=(Cote*cm*((l-1) div 2),(nbv*Cote*cm*sqrt(3)/3))+(xpart(C-B),-ypart(C-B));
+ fi;
+ fi;
+ label(LATEX(decimal(n)),B shifted vdepla);
+ endfor;
+ endfor;
+ elseif Niveau=4:
+ B=iso(A1,A2,A3,A4);
+ for k=1 upto Lignes:
+ for l=1 upto Colonnes:
+ n:=n+1;
+ vdepla:=Cote*cm*((l-1),(k-1));
+ label(LATEX(decimal(n)),B shifted vdepla);
+ endfor;
+ endfor;
+ elseif Niveau=6:
+ B=iso(A1,A2,A3,A4,A5,A6);
+ C=symetrie(B,A3,A4);
+ for k=1 upto Lignes-1:
+ for l=1 upto 2*Colonnes-1:
+ n:=n+1;
+ nbv:=(k-1)*3;
+ if l mod 2=1:
+ vdepla:=(1.5*Cote*cm*(l-1)+1.5*Cote*cm,nbv*Cote*cm*sqrt(3)/3);
+ else:
+ vdepla:=(1.5*Cote*cm*(l-2)+1.5*Cote*cm,nbv*Cote*cm*sqrt(3)/3)+(C-B);
+ fi;
+ if k=Lignes-1:
+ if l mod 2=1:
+ label(LATEX(decimal(n)),B shifted vdepla);
+ else:
+ n:=n-1;
+ fi;
+ else:
+ label(LATEX(decimal(n)),B shifted vdepla);
+ fi;
+ endfor;
+ endfor;
+ fi;
+ enddef;
+ vardef EffectuerTraces=
+ \useKV[Pavage]{Traces}
+ enddef;
+}
+
+\def\MPReseauCode{%
+ boolean Before,Numerote,Backgrounds,After;
+ Before=\useKV[Pavage]{Before};
+ After=\useKV[Pavage]{After};
+ Numerote=\useKV[Pavage]{Numerotation};
+ Backgrounds=\useKV[Pavage]{Backgrounds};
+ color ColPavage,ColArrierePlan;
+ ColPavage=\useKV[Pavage]{Couleur};
+ ColArrierePlan=if Backgrounds:\useKV[Pavage]{ArrierePlan} else:ColPavage fi;
+ Cote=\useKV[Pavage]{Cote};
+ Lignes=\useKV[Pavage]{Lignes};
+ Colonnes=\useKV[Pavage]{Colonnes};
+ Niveau=\useKV[Pavage]{Niveau};
+ Depart=\useKV[Pavage]{Depart};
+ pair basei,basej;
+ basei=\useKV[Pavage]{Basei};
+ basej=\useKV[Pavage]{Basej};
+ vardef PavageReseau=
+ for k=0 upto Lignes-1:
+ for l=0 upto Colonnes -1:
+ trace Motif shifted (k*basei+l*basej);
+ endfor;
+ endfor;
+ enddef;
+ vardef Numerotation=
+ n:=0;
+ k:=0;
+ pair A[],B[];
+ A[0]=point(0) of Motif;
+ B[0]=A[0];
+ forever:
+ k:=k+1;
+ A[k]=point(k) of Motif;
+ B[0]:=B[0]+A[k];
+ exitif A[k]=A[0];
+ endfor;
+ B[0]:=B[0]/k;
+ for k=0 upto Lignes-1:
+ for l=0 upto Colonnes -1:
+ n:=n+1;
+ label(decimal(n),B[0] shifted(k*basei+l*basej));
+ endfor;
+ endfor;
+ enddef;
+ vardef PlacePointSupport=
+ pair M[][];
+ n:=0;
+ k:=0;
+ pair A[],B[];
+ A[0]=point(0) of Motif;
+ forever:
+ k:=k+1;
+ A[k]=point(k) of Motif;
+ B[0]:=B[0]+A[k];
+ exitif A[k]=A[0];
+ endfor;
+ B[0]:=B[0]/k;
+ NbSommet:=k;
+ for k=0 upto Lignes-1:
+ for l=0 upto Colonnes -1:
+ n:=n+1;
+ for m=1 upto NbSommet:
+ M[n][m]=A[m] shifted (k*basei+l*basej);
+ endfor;
+ endfor;
+ endfor;
+ enddef;
+ vardef EffectuerTraces=
+ \useKV[Pavage]{Traces}
+ enddef;
+}
+
+\def\MPPeriodiqueCode{%
+ boolean Before,Numerote,Backgrounds,After;
+ Before=\useKV[Pavage]{Before};
+ After=\useKV[Pavage]{After};
+ Numerote=\useKV[Pavage]{Numerotation};
+ Backgrounds=\useKV[Pavage]{Backgrounds};
+ color ColPavage,ColArrierePlan;
+ ColPavage=\useKV[Pavage]{Couleur};
+ ColArrierePlan=if Backgrounds:\useKV[Pavage]{ArrierePlan} else:ColPavage fi;
+ Cote=\useKV[Pavage]{Cote};
+ Lignes=\useKV[Pavage]{Lignes};
+ Colonnes=\useKV[Pavage]{Colonnes};
+ Niveau=\useKV[Pavage]{Niveau};
+ Depart=\useKV[Pavage]{Depart};
+ pair basei,basej;
+ vardef PavagePeriodique=
+ basei=iso(A1,A2)-iso(A1,A0);
+ basej=iso(A0,A3)-iso(A1,A0);
+ path CadrePavage;
+ pair Cpa[];
+ Cpa1=(0,ypart(-2*basej));
+ Cpa2=(xpart(2*Colonnes*basei),ypart(-2*basej));
+ Cpa3=(xpart(2*Colonnes*basei),ypart(2*Lignes*basej));
+ Cpa4=(0,ypart(2*Lignes*basej));
+ CadrePavage=Cpa1--Cpa2--Cpa3--Cpa4--cycle;
+ %drawarrow iso(A1,A0)--(iso(A1,A0)+basei);
+ %drawarrow iso(A1,A0)--(iso(A1,A0)+basej);
+ picture BlocContour,BlocPavage;
+ BlocContour=image(
+ for k=-Lignes upto Lignes+1:
+ for l=-1 upto Colonnes+1:
+ fill Motif shifted (2*l*basei+2*k*basej) withcolor ColPavage;
+ fill symetrie(Motif,iso(A1,A2)) shifted (2*l*basei+2*k*basej) withcolor ColPavage;
+ trace Motif shifted (2*l*basei+2*k*basej);
+ trace symetrie(Motif,iso(A1,A2)) shifted (2*l*basei+2*k*basej);
+ endfor;
+ endfor;
+ drawoptions();
+ );
+ BlocPavage=image(
+ trace BlocContour;
+ %trace BlocContour shifted(4*basei+2*basej);
+ clip currentpicture to CadrePavage;
+ trace CadrePavage withpen pencircle scaled 2;
+ );
+ BlocPavage
+ enddef;
+ vardef Numerotation=
+ n:=-1;
+ pair ISO;
+ for k=-Lignes upto Lignes+1:
+ for l=-1 upto Colonnes+1:
+ n:=n+2;
+ ISO:=B[0] shifted (2*l*basei+2*k*basej);
+ if (xpart(ISO)>xpart(Cpa1+u*(0.2,0))) and (xpart(ISO)<xpart(Cpa2-u*(0.2,0))) and (ypart(ISO)>ypart(Cpa1+u*(0.2,0))) and (ypart(ISO)<ypart(Cpa4-u*(0.2,0))):
+ label(decimal(n),ISO);
+ else:
+ n:=n-2;
+ fi;
+ endfor;
+ endfor;
+ %2eme tour
+ n:=-1;
+ for k=-Lignes upto Lignes+1:
+ for l=-1 upto Colonnes+1:
+ n:=n+2;
+ ISO:=symetrie(B[0],iso(A1,A2)) shifted (2*l*basei+2*k*basej);
+ if (xpart(ISO)>xpart(Cpa1+u*(0.2,0))) and (xpart(ISO)<xpart(Cpa2-u*(0.2,0))) and (ypart(ISO)>ypart(Cpa1+u*(0.2,0))) and (ypart(ISO)<ypart(Cpa4-u*(0.2,0))):
+ label(decimal(n+1),ISO);
+ else:
+ n:=n-2;
+ fi;
+ endfor;
+ endfor;
+ enddef;
+ vardef PlacePointSupport=
+ pair QuadA[],QuadB[],QuadC[],QuadD[];
+ n:=-1;
+ pair ISO;
+ for k=-Lignes upto Lignes+1:
+ for l=-1 upto Colonnes+1:
+ n:=n+2;
+ ISO:=B[0] shifted (2*l*basei+2*k*basej);
+ if (xpart(ISO)>xpart(Cpa1)) and (xpart(ISO)<xpart(Cpa2)) and (ypart(ISO)>ypart(Cpa1)) and (ypart(ISO)<ypart(Cpa4)):
+ QuadA[n]=A0 shifted (2*l*basei+2*k*basej);
+ QuadB[n]=A1 shifted (2*l*basei+2*k*basej);
+ QuadC[n]=A2 shifted (2*l*basei+2*k*basej);
+ QuadD[n]=A3 shifted (2*l*basei+2*k*basej);
+ else:
+ n:=n-2;
+ fi;
+ endfor;
+ endfor;
+ %2eme tour
+ n:=-1;
+ for k=-Lignes upto Lignes+1:
+ for l=-1 upto Colonnes+1:
+ n:=n+2;
+ ISO:=symetrie(B[0],iso(A1,A2)) shifted (2*l*basei+2*k*basej);
+ if (xpart(ISO)>xpart(Cpa1+u*(0.1,0))) and (xpart(ISO)<xpart(Cpa2)) and (ypart(ISO)>ypart(Cpa1)) and (ypart(ISO)<ypart(Cpa4)):
+ QuadA[n+1]=symetrie(A0,iso(A1,A2)) shifted (2*l*basei+2*k*basej);
+ QuadB[n+1]=symetrie(A1,iso(A1,A2)) shifted (2*l*basei+2*k*basej);
+ QuadC[n+1]=symetrie(A2,iso(A1,A2)) shifted (2*l*basei+2*k*basej);
+ QuadD[n+1]=symetrie(A3,iso(A1,A2)) shifted (2*l*basei+2*k*basej);
+ else:
+ n:=n-2;
+ fi;
+ endfor;
+ endfor;
+ enddef;
+ vardef EffectuerTraces=
+ \useKV[Pavage]{Traces}
+ enddef;
+}
+
+\def\MPPavageImageCode{%
+ boolean Before,Numerote,Backgrounds,After;
+ Before=\useKV[Pavage]{Before};
+ After=\useKV[Pavage]{After};
+ Numerote=\useKV[Pavage]{Numerotation};
+ Backgrounds=\useKV[Pavage]{Backgrounds};
+ color ColPavage,ColArrierePlan;
+ ColPavage=\useKV[Pavage]{Couleur};
+ ColArrierePlan=if Backgrounds:\useKV[Pavage]{ArrierePlan} else:ColPavage fi;
+ Cote=\useKV[Pavage]{Cote};
+ Lignes=\useKV[Pavage]{Lignes};
+ Colonnes=\useKV[Pavage]{Colonnes};
+ Niveau=\useKV[Pavage]{Niveau};
+ Depart=\useKV[Pavage]{Depart};
+ pair basei,basej;
+ %basei=\useKV[Pavage]{Basei};
+ %basej=\useKV[Pavage]{Basej};
+ vardef PavageImage=
+ basei=(rotation(O2,O1,-120)-O4);
+ basej:=(rotation(O5,O1,-120)-O5);
+ path CadrePavage;
+ pair Cpa[];
+ Cpa1=(0,ypart(-2*basej));
+ Cpa2=(xpart(2*Colonnes*basei),ypart(-2*basej));
+ Cpa3=(xpart(2*Colonnes*basei),ypart(2*Lignes*basej));
+ Cpa4=(0,ypart(2*Lignes*basej));
+ CadrePavage=Cpa1--Cpa2--Cpa3--Cpa4--cycle;
+ %drawarrow iso(A1,A0)--(iso(A1,A0)+basei);
+ %drawarrow iso(A1,A0)--(iso(A1,A0)+basej);
+ picture BlocContour,BlocPavage;
+ BlocContour=image(
+ for k=0 upto Lignes:
+ for l=0 upto Colonnes:
+ %fill Motif shifted (l*basei+k*basej) withcolor Cornsilk;
+ trace Motif shifted (l*basei+k*basej);
+ endfor;
+ endfor;
+ drawoptions();
+ );
+ BlocPavage=image(
+ trace BlocContour;
+ %trace BlocContour shifted(4*basei+2*basej);
+ %clip currentpicture to CadrePavage;
+ %trace CadrePavage withpen pencircle scaled 2;
+ );
+ BlocPavage
+ enddef;
+% vardef Numerotation=
+% n:=-1;
+% pair ISO;
+% for k=-Lignes upto Lignes+1:
+% for l=-1 upto Colonnes+1:
+% n:=n+2;
+% ISO:=B[0] shifted (2*l*basei+2*k*basej);
+% if (xpart(ISO)>xpart(Cpa1+u*(0.2,0))) and (xpart(ISO)<xpart(Cpa2-u*(0.2,0))) and (ypart(ISO)>ypart(Cpa1+u*(0.2,0))%) and (ypart(ISO)<ypart(Cpa4-u*(0.2,0))):
+% label(decimal(n),ISO);
+% else:
+% n:=n-2;
+% fi;
+% endfor;
+% endfor;
+% %2eme tour
+% n:=-1;
+% for k=-Lignes upto Lignes+1:
+% for l=-1 upto Colonnes+1:
+% n:=n+2;
+% ISO:=symetrie(B[0],iso(A1,A2)) shifted (2*l*basei+2*k*basej);
+% if (xpart(ISO)>xpart(Cpa1+u*(0.2,0))) and (xpart(ISO)<xpart(Cpa2-u*(0.2,0))) and (ypart(ISO)>ypart(Cpa1+u*(0.2,0))) and (ypart(ISO)<ypart(Cpa4-u*(0.2,0))):
+% label(decimal(n+1),ISO);
+% else:
+% n:=n-2;
+% fi;
+% endfor;
+% endfor;
+% enddef;
+% vardef PlacePointSupport=
+% pair QuadA[],QuadB[],QuadC[],QuadD[];
+% n:=-1;
+% pair ISO;
+% for k=-Lignes upto Lignes+1:
+% for l=-1 upto Colonnes+1:
+% n:=n+2;
+% ISO:=B[0] shifted (2*l*basei+2*k*basej);
+% if (xpart(ISO)>xpart(Cpa1)) and (xpart(ISO)<xpart(Cpa2)) and (ypart(ISO)>ypart(Cpa1)) and (ypart(ISO)<ypart(Cpa4)):
+% QuadA[n]=A0 shifted (2*l*basei+2*k*basej);
+% QuadB[n]=A1 shifted (2*l*basei+2*k*basej);
+% QuadC[n]=A2 shifted (2*l*basei+2*k*basej);
+% QuadD[n]=A3 shifted (2*l*basei+2*k*basej);
+% else:
+% n:=n-2;
+% fi;
+% endfor;
+% endfor;
+% %2eme tour
+% n:=-1;
+% for k=-Lignes upto Lignes+1:
+% for l=-1 upto Colonnes+1:
+% n:=n+2;
+% ISO:=symetrie(B[0],iso(A1,A2)) shifted (2*l*basei+2*k*basej);
+% if (xpart(ISO)>xpart(Cpa1+u*(0.1,0))) and (xpart(ISO)<xpart(Cpa2)) and (ypart(ISO)>ypart(Cpa1)) and (ypart(ISO)<ypart(Cpa4)):
+% QuadA[n+1]=symetrie(A0,iso(A1,A2)) shifted (2*l*basei+2*k*basej);
+% QuadB[n+1]=symetrie(A1,iso(A1,A2)) shifted (2*l*basei+2*k*basej);
+% QuadC[n+1]=symetrie(A2,iso(A1,A2)) shifted (2*l*basei+2*k*basej);
+% QuadD[n+1]=symetrie(A3,iso(A1,A2)) shifted (2*l*basei+2*k*basej);
+% else:
+% n:=n-2;
+% fi;
+% endfor;
+% endfor;
+% enddef;
+ vardef EffectuerTraces=
+ \useKV[Pavage]{Traces}
+ enddef;
+}
+
+\def\MPPavageImage{%
+ \ifluatex
+ \mplibforcehmode
+ \begin{mplibcode}
+ \MPPavageImageCode
+ picture Motif;
+ if Before:
+ \PfCImagePavage
+ Motif=\useKV[Pavage]{Motif};
+ else:
+ picture BaseImage;
+ BaseImage=image(
+ trace fullsquare scaled 1cm;
+ );
+ Motif=BaseImage;
+ fi;
+ trace PavageImage;
+ if After:
+ EffectuerTraces;
+ fi;
+ \end{mplibcode}
+ \fi
+}
+
+\def\MPPeriodique{%
+ \ifluatex
+ \mplibforcehmode
+ \begin{mplibcode}
+ \MPPeriodiqueCode
+ path Motif;
+ if Before:
+ Motif=\useKV[Pavage]{Motif};
+ else:
+ Motif=(0,0)--u*(1,-2)--u*(2,0.5)--u*(0.75,1)--cycle;
+ fi;
+ pair A[],B[];
+ A[0]=point(0) of Motif;
+ B[0]=A[0];
+ k:=0;
+ forever:
+ k:=k+1;
+ A[k]=point(k) of Motif;
+ B[0]:=B[0]+A[k];
+ exitif A[k]=A[0];
+ endfor;
+ B[0]:=B[0]/k;
+ trace PavagePeriodique;
+ PlacePointSupport;
+ if Numerote:
+ Numerotation;
+ fi;
+ if After:
+ EffectuerTraces;
+ fi;
+ \end{mplibcode}
+ \else
+ \begin{mpost}[\MPPeriodiqueCode]
+ path Motif;
+ if Before:
+ Motif=\useKV[Pavage]{Motif};
+ else:
+ Motif=(0,0)--u*(1,-2)--u*(2,0.5)--u*(0.75,1)--cycle;
+ fi;
+ pair A[],B[];
+ A[0]=point(0) of Motif;
+ B[0]=A[0];
+ k:=0;
+ forever:
+ k:=k+1;
+ A[k]=point(k) of Motif;
+ B[0]:=B[0]+A[k];
+ exitif A[k]=A[0];
+ endfor;
+ B[0]:=B[0]/k;
+ trace PavagePeriodique;
+ PlacePointSupport;
+ if Numerote:
+ Numerotation;
+ fi;
+ if After:
+ EffectuerTraces;
+ fi;
+ \end{mpost}
+ \fi
+}
+
+\def\MPReseau{%
+ \ifluatex
+ \mplibforcehmode
+ \begin{mplibcode}
+ \MPReseauCode
+ path Motif;
+ if Before:
+ Motif=\useKV[Pavage]{Motif};
+ else:
+ Motif=u*(0,0)--u*(0.75,0)--u*(1,0.5)--u*(0.25,0.5)--cycle;
+ fi;
+ PavageReseau;
+ PlacePointSupport;
+ if Numerote:
+ Numerotation;
+ fi;
+ if After:
+ EffectuerTraces;
+ fi;
+ \end{mplibcode}
+ \else
+ \begin{mpost}[mpsettings={\MPReseauCode}]
+ path Motif;
+ if Before:
+ Motif=\useKV[Pavage]{Motif};
+ else:
+ Motif=u*(0,0)--u*(0.75,0)--u*(1,0.5)--u*(0.25,0.5)--cycle;
+ fi;
+ PavageReseau;
+ PlacePointSupport;
+ if Numerote:
+ Numerotation;
+ fi;
+ if After:
+ EffectuerTraces;
+ fi;
+ \end{mpost}
+ \fi
+}
+
+\def\MPRegulier{%
+ \ifluatex
+ \mplibforcehmode
+ \begin{mplibcode}
+ \MPReseauRegulier
+ trace PavageRegulier(Niveau);
+ PlacePointSupport;
+ if Numerote:
+ Numerotation;
+ fi;
+ if After:
+ EffectuerTraces;
+ fi;
+ \end{mplibcode}
+ \else
+ \begin{mpost}[mpsettings={\MPReseauRegulier}]
+ trace PavageRegulier(Niveau);
+ PlacePointSupport;
+ if Numerote:
+ Numerotation;
+ fi;
+ if After:
+ EffectuerTraces;
+ fi;
+ \end{mpost}
+ \fi
+}%
+
+\def\MPPavage{%
+ \ifluatex%
+ \mplibforcehmode%
+ \begin{mplibcode}%
+ \MPPavageBase
+ path Motif;
+ if Before:
+ Motif=\useKV[Pavage]{Motif};
+ else:
+ Motif=u*(0,0)..u*(0.25,.1)..u*(0.5,0.7)..u*(1,1);
+ fi;
+ if Demo:
+ trace pavagescar(Motif,0,ColPavage);
+ else:
+ trace pavages(Motif,Niveau,ColPavage);
+ fi;
+ PlacePointSupport;
+ if Numerote:
+ Numerotation;
+ fi;
+ if After:
+ EffectuerTraces;
+ fi;
+ \end{mplibcode}
+ \else
+ \begin{mpost}[mpsettings={\MPPavageBase}]
+ path Motif;
+ if Before:
+ Motif=\useKV[Pavage]{Motif};
+ else:
+ Motif=u*(0,0)..u*(0.25,.1)..u*(0.5,0.7)..u*(1,1);
+ fi;
+ trace pavages(Motif,Niveau,ColPavage);
+ PlacePointSupport;
+ if Numerote:
+ Numerotation;
+ fi;
+ if After:
+ EffectuerTraces;
+ fi;
+ \end{mpost}
+ \fi%
+}
+
+\NewDocumentCommand\Pavage{o}{%
+ \useKVdefault[Pavage]%
+ \setKV[Pavage]{#1}%
+ \ifboolKV[Pavage]{Regulier}{%
+ \MPRegulier%
+ }{%
+ \ifboolKV[Pavage]{SemiRegulier}{%
+ %
+ }{%
+ \ifboolKV[Pavage]{Reseau}{%
+ \MPReseau
+ }{%
+ \ifboolKV[Pavage]{Periodique}{%
+ \MPPeriodique%
+ }{%
+ \ifboolKV[Pavage]{Image}{%
+ \MPPavageImage%
+ }{%
+ \MPPavage%
+ }%
+ }%
+ }%
+ }%
+ }%
+}% \ No newline at end of file
diff --git a/macros/latex/contrib/profcollege/latex/PfCRLE.tex b/macros/latex/contrib/profcollege/latex/PfCRLE.tex
index 280c5aef85..a8f035a577 100644
--- a/macros/latex/contrib/profcollege/latex/PfCRLE.tex
+++ b/macros/latex/contrib/profcollege/latex/PfCRLE.tex
@@ -18,93 +18,114 @@
\BuildRLE{\the\toklisterle}%
}
+\def\BuildRLECode{%
+ Taille:=\useKV[RLE]{Taille};
+ u:=\useKV[RLE]{Unite};
+ boolean Solution,Enonce;
+ Solution:=\useKV[RLE]{Solution};
+ Enonce:=\useKV[RLE]{Enonce};
+ %
+ color RLEFill;
+ RLEFill=white;
+ %
+ numeric nbretenir[][];
+ %
+ vardef NombreLigne(text t)=
+ retiens:=0;
+ nblignes:=0;
+ for p_=t:
+ retiens:=retiens+p_;
+ if retiens=Taille:
+ nblignes:=nblignes+1;
+ retiens:=0;
+ fi;
+ endfor;
+ enddef;
+ %
+ path Square;
+ Square=unitsquare scaled u;
+ %
+ vardef RLE(text t)=
+ nbcoups:=0;
+ nbcases:=0;
+ nbcaseslignes:=0;
+ cptretiensnb:=0;
+ cptretiensnblignes:=1;
+ for p_=t:
+ if p_=0:
+ cptretiensnb:=cptretiensnb+1;
+ nbretenir[cptretiensnblignes][cptretiensnb]=p_;
+ RLEFill:=black;
+ else:
+ nbcoups:=nbcoups+1;
+ for l=0 upto p_-1:
+ if Solution: fill ((Square scaled 0.95) shifted(u*((nbcases mod Taille)+l,-(nbcases div Taille))+u*(0.025,0.025))) withcolor RLEFill; fi;
+ trace (Square shifted(u*((nbcases mod Taille)+l,-(nbcases div Taille))));
+ endfor;
+ nbcaseslignes:=nbcaseslignes+p_;
+ nbcases:=nbcases+p_;
+ if (nbcaseslignes mod Taille)=0:
+ RLEFill:=white;
+ cptretiensnb:=cptretiensnb+1;
+ nbretenir[cptretiensnblignes][cptretiensnb]=p_;
+ cptretiensnblignes:=cptretiensnblignes+1;
+ cptretiensnb:=0;
+ else:
+ if RLEFill=white: RLEFill:=black else: RLEFill:=white fi;
+ cptretiensnb:=cptretiensnb+1;
+ nbretenir[cptretiensnblignes][cptretiensnb]=p_;
+ fi;
+ fi;
+ endfor;
+ enddef;
+ %
+ string Sequence[];
+ %
+ boolean STOP;
+ STOP:=false;
+ %
+ vardef Affichage=
+ for k=1 upto nblignes:
+ Sequence[k]=decimal(nbretenir[k][1]);
+ n:=1;
+ forever:
+ n:=n+1;
+ if unknown nbretenir[k][n]:
+ STOP:=true;
+ else:
+ Sequence[k]:=Sequence[k]&","&decimal(nbretenir[k][n]);
+ fi;
+ exitif STOP;
+ endfor;
+ label.rt(TEX(Sequence[k]),u*(Taille+1,-k+1+0.5));
+ STOP:=false;
+ endfor;
+ enddef;
+ %
+ vardef AffichagePDF=
+ for k=1 upto nblignes:
+ Sequence[k]=decimal(nbretenir[k][1]);
+ n:=1;
+ forever:
+ n:=n+1;
+ if unknown nbretenir[k][n]:
+ STOP:=true;
+ else:
+ Sequence[k]:=Sequence[k]&","&decimal(nbretenir[k][n]);
+ fi;
+ exitif STOP;
+ endfor;
+ label.rt(LATEX(Sequence[k]),u*(Taille+1,-k+1+0.5));
+ STOP:=false;
+ endfor;
+ enddef;
+}
+
\NewDocumentCommand\BuildRLE{m}{%
\ifluatex
\mplibforcehmode
\begin{mplibcode}
- Taille:=\useKV[RLE]{Taille};
- u:=\useKV[RLE]{Unite};
- boolean Solution,Enonce;
- Solution:=\useKV[RLE]{Solution};
- Enonce:=\useKV[RLE]{Enonce};
-
- color RLEFill;
- RLEFill=white;
-
- numeric nbretenir[][];
-
- vardef NombreLigne(text t)=
- retiens:=0;
- nblignes:=0;
- for p_=t:
- retiens:=retiens+p_;
- if retiens=Taille:
- nblignes:=nblignes+1;
- retiens:=0;
- fi;
- endfor;
- enddef;
-
- path Square;
- Square=unitsquare scaled u;
-
- vardef RLE(text t)=
- nbcoups:=0;
- nbcases:=0;
- nbcaseslignes:=0;
- cptretiensnb:=0;
- cptretiensnblignes:=1;
- for p_=t:
- if p_=0:
- cptretiensnb:=cptretiensnb+1;
- nbretenir[cptretiensnblignes][cptretiensnb]=p_;
- RLEFill:=black;
- else:
- nbcoups:=nbcoups+1;
- for l=0 upto p_-1:
- if Solution: fill ((Square scaled 0.95) shifted(u*((nbcases mod Taille)+l,-(nbcases div Taille))+u*(0.025,0.025))) withcolor RLEFill; fi;
- trace (Square shifted(u*((nbcases mod Taille)+l,-(nbcases div Taille))));
- endfor;
- nbcaseslignes:=nbcaseslignes+p_;
- nbcases:=nbcases+p_;
- if (nbcaseslignes mod Taille)=0:
- RLEFill:=white;
- cptretiensnb:=cptretiensnb+1;
- nbretenir[cptretiensnblignes][cptretiensnb]=p_;
- cptretiensnblignes:=cptretiensnblignes+1;
- cptretiensnb:=0;
- else:
- if RLEFill=white: RLEFill:=black else: RLEFill:=white fi;
- cptretiensnb:=cptretiensnb+1;
- nbretenir[cptretiensnblignes][cptretiensnb]=p_;
- fi;
- fi;
- endfor;
- enddef;
-
- string Sequence[];
-
- boolean STOP;
- STOP:=false;
-
- vardef Affichage=
- for k=1 upto nblignes:
- Sequence[k]=decimal(nbretenir[k][1]);
- n:=1;
- forever:
- n:=n+1;
- if unknown nbretenir[k][n]:
- STOP:=true;
- else:
- Sequence[k]:=Sequence[k]&","&decimal(nbretenir[k][n]);
- fi;
- exitif STOP;
- endfor;
- label.rt(TEX(Sequence[k]),u*(Taille+1,-k+1+0.5));
- STOP:=false;
- endfor;
- enddef;
-
+ \BuildRLECode
NombreLigne(#1);
RLE(#1);
if Enonce:
@@ -112,94 +133,11 @@
fi;
\end{mplibcode}
\else
- \begin{mpost}[mpsettings={%
- Taille:=\useKV[RLE]{Taille};
- u:=\useKV[RLE]{Unite};
- boolean Solution,Enonce;
- Solution:=\useKV[RLE]{Solution};
- Enonce:=\useKV[RLE]{Enonce};
- }]
- color RLEFill;
- RLEFill=white;
-
- numeric nbretenir[][];
-
- vardef NombreLigne(text t)=
- retiens:=0;
- nblignes:=0;
- for p_=t:
- retiens:=retiens+p_;
- if retiens=Taille:
- nblignes:=nblignes+1;
- retiens:=0;
- fi;
- endfor;
- enddef;
-
- path Square;
- Square=unitsquare scaled u;
-
- vardef RLE(text t)=
- nbcoups:=0;
- nbcases:=0;
- nbcaseslignes:=0;
- cptretiensnb:=0;
- cptretiensnblignes:=1;
- for p_=t:
- if p_=0:
- cptretiensnb:=cptretiensnb+1;
- nbretenir[cptretiensnblignes][cptretiensnb]=p_;
- RLEFill:=black;
- else:
- nbcoups:=nbcoups+1;
- for l=0 upto p_-1:
- if Solution: fill ((Square scaled 0.95) shifted(u*((nbcases mod Taille)+l,-(nbcases div Taille))+u*(0.025,0.025))) withcolor RLEFill; fi;
- trace (Square shifted(u*((nbcases mod Taille)+l,-(nbcases div Taille))));
- endfor;
- nbcaseslignes:=nbcaseslignes+p_;
- nbcases:=nbcases+p_;
- if (nbcaseslignes mod Taille)=0:
- RLEFill:=white;
- cptretiensnb:=cptretiensnb+1;
- nbretenir[cptretiensnblignes][cptretiensnb]=p_;
- cptretiensnblignes:=cptretiensnblignes+1;
- cptretiensnb:=0;
- else:
- if RLEFill=white: RLEFill:=black else: RLEFill:=white fi;
- cptretiensnb:=cptretiensnb+1;
- nbretenir[cptretiensnblignes][cptretiensnb]=p_;
- fi;
- fi;
- endfor;
- enddef;
-
- string Sequence[];
-
- boolean STOP;
- STOP:=false;
-
- vardef Affichage=
- for k=1 upto nblignes:
- Sequence[k]=decimal(nbretenir[k][1]);
- n:=1;
- forever:
- n:=n+1;
- if unknown nbretenir[k][n]:
- STOP:=true;
- else:
- Sequence[k]:=Sequence[k]&","&decimal(nbretenir[k][n]);
- fi;
- exitif STOP;
- endfor;
- label.rt(LATEX(Sequence[k]),u*(Taille+1,-k+1+0.5));
- STOP:=false;
- endfor;
- enddef;
-
+ \begin{mpost}[mpsettings={\BuildRLECode}]
NombreLigne(#1);
RLE(#1);
if Enonce:
- Affichage;
+ AffichagePDF;
fi;
\end{mpost}
\fi
diff --git a/macros/latex/contrib/profcollege/latex/PfCRappelsFormules.tex b/macros/latex/contrib/profcollege/latex/PfCRappelsFormules.tex
index 2c22e2b45a..c2a4d95954 100644
--- a/macros/latex/contrib/profcollege/latex/PfCRappelsFormules.tex
+++ b/macros/latex/contrib/profcollege/latex/PfCRappelsFormules.tex
@@ -3,43 +3,37 @@
%%%
\setKVdefault[ClesFormule]{Perimetre=false,Aire=false,Volume=false,Surface=carr\'e,Solide=pav\'e,Angle=0,Ancre={(0,0)},Largeur=5cm,Couleur=white,EchelleEspace=70,Echelle=1cm}
+\def\MPFigureCarreCode{%
+ u:=\useKV[ClesFormule]{Echelle};
+ vardef FigCarre=
+ drawoptions(dashed dashpattern(on1cm));
+ pair A,B,C,D;
+ A=u*(1,1);
+ B-A=u*(2,0);
+ C=rotation(A,B,-90);
+ D-C=A-B;
+ draw polygone(A,B,C,D);
+ draw codeperp(A,B,C,5);
+ draw codeperp(B,C,D,5);
+ draw codeperp(C,D,A,5);
+ draw codeperp(D,A,B,5);
+ marque_s:=marque_s/3;
+ draw Codelongueur(A,B,B,C,C,D,D,A,2);
+ marque_s:=marque_s*3;
+ draw appelation(A,B,-3mm,btex $c$ etex);
+ enddef;
+}%
+
\def\MPFigureCarre{%
\ifluatex
\mplibforcehmode
\begin{mplibcode}
- u:=\useKV[ClesFormule]{Echelle};
- drawoptions( dashed dashpattern(on1cm));
- pair A,B,C,D;
- A=u*(1,1);
- B-A=u*(2,0);
- C=rotation(A,B,-90);
- D-C=A-B;
- draw polygone(A,B,C,D);
- draw codeperp(A,B,C,5);
- draw codeperp(B,C,D,5);
- draw codeperp(C,D,A,5);
- draw codeperp(D,A,B,5);
- marque_s:=marque_s/3;
- draw Codelongueur(A,B,B,C,C,D,D,A,2);
- marque_s:=marque_s*3;
- draw appelation(A,B,-3mm,btex $c$ etex);
+ \MPFigureCarreCode
+ FigCarre;
\end{mplibcode}
\else
- \begin{mpost}[mpsettings={u:=\useKV[ClesFormule]{Echelle};}]
- pair A,B,C,D;
- A=u*(1,1);
- B-A=u*(2,0);
- C=rotation(A,B,-90);
- D-C=A-B;
- draw polygone(A,B,C,D);
- draw codeperp(A,B,C,5);
- draw codeperp(B,C,D,5);
- draw codeperp(C,D,A,5);
- draw codeperp(D,A,B,5);
- marque_s:=marque_s/3;
- draw Codelongueur(A,B,B,C,C,D,D,A,2);
- marque_s:=marque_s*3;
- draw appelation(A,B,-3mm,btex $c$ etex);
+ \begin{mpost}[mpsettings={\MPFigureCarreCode}]
+ FigCarre;
\end{mpost}
\fi
}
diff --git a/macros/latex/contrib/profcollege/latex/PfCRepresenterFraction.tex b/macros/latex/contrib/profcollege/latex/PfCRepresenterFraction.tex
index d7878556d8..aed889bfcb 100644
--- a/macros/latex/contrib/profcollege/latex/PfCRepresenterFraction.tex
+++ b/macros/latex/contrib/profcollege/latex/PfCRepresenterFraction.tex
@@ -1,968 +1,556 @@
%%%
% Fractions
%%%
-\setKVdefault[ClesFraction]{Rayon=2cm,Disque,Regulier=false,Segment=false,Rectangle=false,Longueur=5cm,Largeur=2cm,Cotes=5,Triangle=false,Parts=3,Couleur=green,Reponse=false,Multiple=1,Hachures=false,Epaisseur=1}
-
-\def\MPFractionTriangle#1#2#3#4#5{%
- % #1 longueur du c\^ot\'e
- % #2 partage sur le c\^ot\'e
- % #3 num
- % #4 d\'eno (attention : = #2^2)
- % #5 couleur
- \ifluatex
- \mplibforcehmode
- \begin{mplibcode}
- 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=(#1,0);
- C=rotation(B,A,60);
-
- nbparts:=#2;
-
- path M[];
-
- path Tria,Trir;
- 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;
-
- m:=#3 div #4;
-
- drawoptions(shifted(m*(#1+1cm,0)));
- for l=1 upto (#3 mod #4):
- fill M[l] withcolor #5;
- for k=1 upto nbparts:
- trace segment((k/nbparts)[A,B],(k/nbparts)[A,C]);
- trace segment((k/nbparts)[B,A],(k/nbparts)[B,C]);
- trace segment((k/nbparts)[C,A],(k/nbparts)[C,B]);
- endfor;
- endfor;
-
- for l=0 upto (m-1):
- drawoptions(shifted(l*(#1+1cm,0)));
- remplis polygone(A,B,C) withcolor #5;
- for k=1 upto nbparts:
- trace segment((k/nbparts)[A,B],(k/nbparts)[A,C]);
- trace segment((k/nbparts)[B,A],(k/nbparts)[B,C]);
- trace segment((k/nbparts)[C,A],(k/nbparts)[C,B]);
- endfor;
- endfor;
- \end{mplibcode}
- \else
- \begin{mpost}
- 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=(#1,0);
- C=rotation(B,A,60);
-
- nbparts:=#2;
-
- path M[];
-
- path Tria,Trir;
- 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;
-
- m:=#3 div #4;
-
- drawoptions(shifted(m*(#1+1cm,0)));
- for l=1 upto (#3 mod #4):
- fill M[l] withcolor #5;
- for k=1 upto nbparts:
- trace segment((k/nbparts)[A,B],(k/nbparts)[A,C]);
- trace segment((k/nbparts)[B,A],(k/nbparts)[B,C]);
- trace segment((k/nbparts)[C,A],(k/nbparts)[C,B]);
- endfor;
- endfor;
-
- for l=0 upto (m-1):
- drawoptions(shifted(l*(#1+1cm,0)));
- remplis polygone(A,B,C) withcolor #5;
- for k=1 upto nbparts:
- trace segment((k/nbparts)[A,B],(k/nbparts)[A,C]);
- trace segment((k/nbparts)[B,A],(k/nbparts)[B,C]);
- trace segment((k/nbparts)[C,A],(k/nbparts)[C,B]);
- endfor;
- endfor;
- \end{mpost}
- \fi
- }
-
- \def\MPFractionTriangleH#1#2#3#4#5#6{
- % #1 longueur du c\^ot\'e
- % #2 partage sur le c\^ot\'e
- % #3 num
- % #4 d\'eno (attention : = #2^2)
- % #5 couleur
- % #6 \'epaisseur
- \ifluatex
- \mplibforcehmode
- \begin{mplibcode}
- 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=(#1,0);
- C=rotation(B,A,60);
-
- nbparts:=#2;
-
- path M[];
-
- path Tria,Trir;
- 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;
-
- m:=#3 div #4;
-
- for l=1 upto (#3 mod #4):
- drawoptions(withpen pencircle scaled #6);
- trace hachurage(M[l] shifted(m*(#1+1cm,0)),90,0.2,0) withcolor #5;%M[l] withcolor #5;
- for k=1 upto nbparts:
- drawoptions(withpen pencircle scaled #6);
- trace segment((k/nbparts)[A,B],(k/nbparts)[A,C]) shifted(m*(#1+1cm,0));
- trace segment((k/nbparts)[B,A],(k/nbparts)[B,C]) shifted(m*(#1+1cm,0));
- trace segment((k/nbparts)[C,A],(k/nbparts)[C,B]) shifted(m*(#1+1cm,0));
- endfor;
- endfor;
-
- for l=0 upto (m-1):
- drawoptions(shifted(l*(#1+1cm,0)) withpen pencircle scaled #6);
- trace hachurage(polygone(A,B,C),90,0.2,0) withcolor #5;%polygone(A,B,C) withcolor #5;
- drawoptions(shifted(l*(#1+1cm,0)) withpen pencircle scaled #6);
- for k=1 upto nbparts:
- trace segment((k/nbparts)[A,B],(k/nbparts)[A,C]);
- trace segment((k/nbparts)[B,A],(k/nbparts)[B,C]);
- trace segment((k/nbparts)[C,A],(k/nbparts)[C,B]);
- endfor;
- endfor;
- \end{mplibcode}
- \else
- \begin{mpost}
- 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=(#1,0);
- C=rotation(B,A,60);
-
- nbparts:=#2;
-
- path M[];
-
- path Tria,Trir;
- 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;
-
- diversite=floor(uniformdeviate(#2**2-#3-1));
-
- for k=(1+diversite) upto (#3+diversite):
- drawoptions(withpen pencircle scaled #6);
- trace hachurage(M[k],90,0.2,0) withcolor #5;
- endfor;
- drawoptions(withpen pencircle scaled #6);
-
- for k=1 upto nbparts:
- trace segment((k/nbparts)[A,B],(k/nbparts)[A,C]);
- trace segment((k/nbparts)[B,A],(k/nbparts)[B,C]);
- trace segment((k/nbparts)[C,A],(k/nbparts)[C,B]);
- endfor;
- \end{mpost}
- \fi
- }
-
-\def\MPFractionRegulier#1#2#3#4#5{%
- % #1 rayon, #2 nb c\^ot\'es, #3 num, #4 deno, #5 couleur
- \ifluatex
- \mplibforcehmode
- \begin{mplibcode}
- pair O,A[],B[];
- O=u*(0,0);
- path cc,cd;
- cc=cercles(O,#1);
- for k=0 upto #2:
- A[k]=pointarc(cc,k*(360/#2));
- endfor;
- cd=polygone(A0 for k=1 upto #2-1:,A[k] endfor);
- for k=0 upto #4-1:
- B[k]=point(k*(#2/#4)) of cd;
- endfor;
- picture fondcolore;
- fondcolore=image(
- remplis O--arccercle(B[0],B[#3 mod #4],O)--cycle withcolor #5;
- clip currentpicture to cd;
- for k=0 upto #4-1:
- draw segment(O,B[k]) cutafter cd;
- endfor;
- trace cd;
- );
- currentpicture:=nullpicture;
- m=#3 div #4;
- if (#3 mod #4)=0:m:=m-1; fi;
- if m>0:
- for l=0 upto (m-1):
- fill cd shifted(l*(#1*2+0.5cm,0)) withcolor #5;
- trace cd shifted(l*(#1*2+0.5cm,0));
- if #4>1:
- for k=0 upto #4-1:
- draw (segment(O,B[k]) cutafter cd) shifted(l*(#1*2+0.5cm,0));
- endfor;
- fi;
- endfor;
- fi;
- draw fondcolore shifted(m*(#1*2+0.5cm,0));
- draw cd shifted(m*(#1*2+0.5cm,0));
- if #4>1:
- for k=0 upto #4-1:
- draw (segment(O,B[k]) cutafter cd) shifted(m*(#1*2+0.5cm,0));
- endfor;
- fi;
- \end{mplibcode}
- \else
- \begin{mpost}
- pair O,A[],B[];
- O=u*(0,0);
- path cc,cd;
- cc=cercles(O,#1);
- for k=0 upto #2:
- A[k]=pointarc(cc,k*(360/#2));
- endfor;
- cd=polygone(A0 for k=1 upto #2-1:,A[k] endfor);
- for k=0 upto #4-1:
- B[k]=point(k*(#2/#4)) of cd;
- endfor;
- picture fondcolore;
- fondcolore=image(
- remplis O--arccercle(B[0],B[#3 mod #4],O)--cycle withcolor #5;
- clip currentpicture to cd;
- for k=0 upto #4-1:
- draw segment(O,B[k]) cutafter cd;
- endfor;
- trace cd;
- );
- currentpicture:=nullpicture;
- m=#3 div #4;
- if (#3 mod #4)=0:m:=m-1; fi;
- if m>0:
- for l=0 upto (m-1):
- fill cd shifted(l*(#1*2+0.5cm,0)) withcolor #5;
- trace cd shifted(l*(#1*2+0.5cm,0));
- if #4>1:
- for k=0 upto #4-1:
- draw (segment(O,B[k]) cutafter cd) shifted(l*(#1*2+0.5cm,0));
- endfor;
- fi;
- endfor;
- fi;
- draw fondcolore shifted(m*(#1*2+0.5cm,0));
- draw cd shifted(m*(#1*2+0.5cm,0));
- if #4>1:
- for k=0 upto #4-1:
- draw (segment(O,B[k]) cutafter cd) shifted(m*(#1*2+0.5cm,0));
- endfor;
- fi;
- \end{mpost}
- \fi
+\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}
+
+\def\MPFractionEprouvetteCode{%
+ Hauteur=\useKV[ClesFraction]{Longueur};
+ color ColEprou;
+ ColEprou=\useKV[ClesFraction]{Couleur};
+ boolean Hachures,Reponse;
+ Reponse=\useKV[ClesFraction]{Reponse};
+ Hachures=\useKV[ClesFraction]{Hachures};
+ Epaisseur=\useKV[ClesFraction]{Epaisseur};
+ vardef eprouvette(expr deno,nume)=
+ picture PfCEprou,PfCEprouGrad;
+ path Cc;
+ Cc=cercles((0,0),1u) yscaled 0.2;
+ PfCEprouGrad=image(
+ trace Cc shifted((0,Hauteur));
+ trace subpath(0,length Cc/2) of Cc dashed evenly;
+ trace subpath(length Cc/2,length Cc) of Cc;
+ trace segment(point(0) of Cc,point(0) of Cc shifted((0,Hauteur)));
+ trace segment(point(length Cc/2) of Cc,point(length Cc/2) of (Cc shifted((0,Hauteur))));
+ for k=1 upto (deno-1):
+ trace (subpath(length Cc/2,length Cc*0.7) of Cc) shifted ((k/deno)*(0,Hauteur));
+ endfor;
+ );
+ m=nume div deno;
+ if (nume mod deno)=0:m:=m-1; fi;
+ PfCEprou=image(%
+ path Volume,VolumeComplet;
+ Volume=(point(0) of Cc)--(subpath(0,length Cc/2) of Cc shifted(((nume mod deno)/deno)*(0,Hauteur)))--(point(length Cc/2) of Cc shifted(((nume mod deno)/deno)*(0,Hauteur)))--(subpath(length Cc/2,length Cc) of Cc)--cycle;
+ VolumeComplet=(point(0) of Cc)--(subpath(0,length Cc/2) of Cc shifted((0,Hauteur)))--(point(length Cc/2) of Cc)--(subpath(length Cc/2,length Cc) of Cc)--cycle;
+ if m>0:
+ for l=0 upto (m-1):
+ if Reponse:
+ if Hachures:
+ drawoptions(withpen pencircle scaled Epaisseur);
+ trace hachurage(VolumeComplet shifted(l*(3u,0)),60,0.2,0) withcolor ColEprou;
+ drawoptions(withpen pencircle scaled Epaisseur);
+ else:
+ remplis (VolumeComplet shifted(l*(3u,0))) withcolor ColEprou;
+ fi;
+ fi;
+ endfor;
+ fi;
+ if (nume mod deno)<>0:
+ if Reponse:
+ if Hachures:
+ drawoptions(withpen pencircle scaled Epaisseur);
+ trace hachurage(Volume shifted(m*(3u,0)),60,0.2,0) withcolor ColEprou;
+ drawoptions(withpen pencircle scaled Epaisseur);
+ else:
+ remplis (Volume shifted(m*(3u,0))) withcolor ColEprou;
+ fi;
+ trace (Cc shifted(((nume mod deno)/deno)*(0,Hauteur))) shifted(m*(3u,0));
+ fi;
+ else:
+ if Reponse:
+ if Hachures:
+ drawoptions(withpen pencircle scaled Epaisseur);
+ trace hachurage(VolumeComplet shifted(m*(3u,0)),60,0.2,0) withcolor ColEprou;
+ drawoptions(withpen pencircle scaled Epaisseur);
+ else:
+ remplis (VolumeComplet shifted(m*(3u,0))) withcolor ColEprou;
+ fi;
+ fi;
+ fi;
+ for k=0 upto m:
+ trace PfCEprouGrad shifted((3u*k,0));
+ endfor;
+ );
+ PfCEprou
+ enddef;
}
-
-\def\MPFractionRegulierH#1#2#3#4#5#6{%
- % #1 rayon, #2 nb c\^ot\'es, #3 num, #4 deno, #5 couleur, #6 épaisseur
+
+\def\MPFractionEprouvette#1#2{%
+ % #1 num
+ % #2 d\'eno
\ifluatex
- \mplibforcehmode
+ \mplibforcehmode
\begin{mplibcode}
- pair O,A[],B[];
- O=u*(0,0);
- path cc,cd;
- cc=cercles(O,#1);
- for k=0 upto #2:
- A[k]=pointarc(cc,k*(360/#2));
- endfor;
- cd=polygone(A0 for k=1 upto #2-1:,A[k] endfor);
- for k=0 upto #4-1:
- B[k]=point(k*(#2/#4)) of cd;
- endfor;
- picture fondcolore;
- fondcolore=image(%
- drawoptions(withpen pencircle scaled #6);
- trace hachurage(O--arccercle(B[0],B[#3 mod #4],O)--cycle,1.5*360/#2,0.25,0) withcolor #5;
- clip currentpicture to cd;
- drawoptions(withpen pencircle scaled #6);
- for k=0 upto #4-1:
- draw segment(O,B[k]) cutafter cd;
- endfor;
- trace cd;
- );
- currentpicture:=nullpicture;
- m=#3 div #4;
- if (#3 mod #4)=0:m:=m-1; fi;
- if m>0:
- for l=0 upto (m-1):
- drawoptions(withpen pencircle scaled #6);
- trace hachurage(cd shifted(l*(#1*2+0.5cm,0)),1.5*360/#2,0.25,0) withcolor #5;
- drawoptions(withpen pencircle scaled #6);
- trace cd shifted(l*(#1*2+0.5cm,0));
- if #4>1:
- for k=0 upto #4-1:
- drawoptions(withpen pencircle scaled #6);
- draw (segment(O,B[k]) cutafter cd) shifted(l*(#1*2+0.5cm,0));
- endfor;
- fi;
- endfor;
- fi;
- draw fondcolore shifted(m*(#1*2+0.5cm,0));
- drawoptions(withpen pencircle scaled #6);
- draw cd shifted(m*(#1*2+0.5cm,0));
- if #4>1:
- drawoptions(withpen pencircle scaled #6);
- for k=0 upto #4-1:
- draw (segment(O,B[k]) cutafter cd) shifted(m*(#1*2+0.5cm,0));
- endfor;
- fi;
+ \MPFractionEprouvetteCode
+ trace eprouvette(#2,#1);
\end{mplibcode}
\else
-\begin{mpost}
- pair O,A[],B[];
- O=u*(0,0);
- path cc,cd;
- cc=cercles(O,#1);
- for k=0 upto #2:
- A[k]=pointarc(cc,k*(360/#2));
- endfor;
- cd=polygone(A0 for k=1 upto #2-1:,A[k] endfor);
- for k=0 upto #4-1:
- B[k]=point(k*(#2/#4)) of cd;
- endfor;
- picture fondcolore;
- fondcolore=image(%
- drawoptions(withpen pencircle scaled #6);
- trace hachurage(O--arccercle(B[0],B[#3 mod #4],O)--cycle,1.5*360/#2,0.25,0) withcolor #5;
- clip currentpicture to cd;
- drawoptions(withpen pencircle scaled #6);
- for k=0 upto #4-1:
- draw segment(O,B[k]) cutafter cd;
- endfor;
- trace cd;
- );
- currentpicture:=nullpicture;
- m=#3 div #4;
- if (#3 mod #4)=0:m:=m-1; fi;
- if m>0:
- for l=0 upto (m-1):
- drawoptions(withpen pencircle scaled #6);
- trace hachurage(cd shifted(l*(#1*2+0.5cm,0)),1.5*360/#2,0.25,0) withcolor #5;
- drawoptions(withpen pencircle scaled #6);
- trace cd shifted(l*(#1*2+0.5cm,0));
- if #4>1:
- for k=0 upto #4-1:
- drawoptions(withpen pencircle scaled #6);
- draw (segment(O,B[k]) cutafter cd) shifted(l*(#1*2+0.5cm,0));
- endfor;
- fi;
- endfor;
- fi;
- draw fondcolore shifted(m*(#1*2+0.5cm,0));
- drawoptions(withpen pencircle scaled #6);
- draw cd shifted(m*(#1*2+0.5cm,0));
- if #4>1:
- drawoptions(withpen pencircle scaled #6);
- for k=0 upto #4-1:
- draw (segment(O,B[k]) cutafter cd) shifted(m*(#1*2+0.5cm,0));
- endfor;
- fi;
+ \begin{mpost}[mpsettings={\MPFractionEprouvetteCode}]
+ trace eprouvette(#2,#1);
\end{mpost}
\fi
}
-\def\MPFractionRectangle#1#2#3#4#5#6{%
- % #1 longueur, #2 largeur, #3 num, #4 deno, #5 couleur, #6 multiple
+\def\MPFractionRegulierCode{%
+ 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);
+ vardef FractionPolyReg(expr nume,deno)=
+ for k=0 upto deno-1:
+ B[k]=point(k*(Cotes/deno)) of cd;
+ endfor;
+ picture fondcolore,FractionPoly;
+ fondcolore=image(
+ if Hachures:
+ drawoptions(withpen pencircle scaled Epaisseur);
+ trace hachurage(O--arccercle(B[0],B[nume mod deno],O)--cycle,1.5*360/Cotes,0.25,0) withcolor ColPolyReg;
+ drawoptions(withpen pencircle scaled Epaisseur);
+ else:
+ remplis O--arccercle(B[0],B[nume mod deno],O)--cycle withcolor ColPolyReg;
+ fi;
+ clip currentpicture to cd;
+ for k=0 upto deno-1:
+ draw segment(O,B[k]) cutafter cd;
+ endfor;
+ trace cd;
+ );
+ currentpicture:=nullpicture;
+ m=nume div deno;
+ if (nume mod deno)=0:m:=m-1; fi;
+ FractionPoly=image(
+ if m>0:
+ for l=0 upto (m-1):
+ if Reponse:
+ if Hachures:
+ drawoptions(withpen pencircle scaled Epaisseur);
+ trace hachurage(cd shifted(l*(Rayon*2+0.5cm,0)),1.5*360/Cotes,0.25,0) withcolor ColPolyReg;
+ drawoptions(withpen pencircle scaled Epaisseur);
+ else:
+ fill cd shifted(l*(Rayon*2+0.5cm,0)) withcolor ColPolyReg;
+ fi;
+ fi;
+ trace cd shifted(l*(Rayon*2+0.5cm,0));
+ if deno>1:
+ for k=0 upto deno-1:
+ draw (segment(O,B[k]) cutafter cd) shifted(l*(Rayon*2+0.5cm,0));
+ endfor;
+ fi;
+ endfor;
+ fi;
+ if Reponse:
+ draw fondcolore shifted(m*(Rayon*2+0.5cm,0));
+ fi;
+ draw cd shifted(m*(Rayon*2+0.5cm,0));
+ if deno>1:
+ for k=0 upto deno-1:
+ draw (segment(O,B[k]) cutafter cd) shifted(m*(Rayon*2+0.5cm,0));
+ endfor;
+ fi;
+ );
+ FractionPoly
+ enddef;
+}%
+
+\def\MPFractionRegulier#1#2{%
+ % #1 num, #2 deno
\ifluatex
- \mplibforcehmode
+ \mplibforcehmode
\begin{mplibcode}
- pair A,B,C,D,M[],N[],R[],S[];
- A=(1,1);
- B-A=(#1,0);
- C-B=(0,#2);
- D-C=A-B;
- numeric parts;
- parts=(#4 div #6);
- for k=0 upto parts:
- M[k]=(k/parts)[A,B];
- N[k]=(k/parts)[D,C];
- endfor;
- if #6>1:
- for k=0 upto #6:
- R[k]=(k/#6)[A,D];
- S[k]=(k/#6)[B,C];
- endfor;
- fi;
- picture FondRectangle;
- FondRectangle=image(%
- draw polygone(A,B,C,D);
- for k=1 upto (parts-1):
- draw segment(M[k],N[k]);
- endfor;
- if #6>1:
- for k=1 upto (#6-1):
- draw segment(R[k],S[k]);
- endfor;
- fi;
- );
- picture FondRectangleColorie;
- FondRectangleColorie=image(%
- if #6=1:
- remplis polygone(A,M[#3 mod #4],N[#3 mod #4],D) withcolor #5;
- else:
- DDiv=(#3 mod #4) div parts;
- MMod=(#3 mod #4) mod parts;
- remplis polygone(A,B,S[DDiv],R[DDiv]) withcolor #5;
- remplis polygone(R[DDiv],(xpart(M[MMod]),ypart(R[DDiv])),(xpart(M[MMod]),ypart(R[DDiv+1])),R[DDiv+1]) withcolor #5;
- fi;
- );
- m=#3 div #4;
- if (#3 mod #4)=0:m:=m-1; fi;
- if m>0:
- for l=0 upto m-1:
- remplis (polygone(A,B,C,D) shifted(l*(#1+1cm,0))) withcolor #5;
- trace FondRectangle shifted(l*(#1+1cm,0));
- endfor;
- fi;
- if (#3 mod #4)<>0:
- trace FondRectangleColorie shifted(m*(#1+1cm,0));
- else:
- remplis (polygone(A,B,C,D) shifted(m*(#1+1cm,0))) withcolor #5;
- fi;
- trace FondRectangle shifted(m*(#1+1cm,0));
+ \MPFractionRegulierCode
+ trace FractionPolyReg(#1,#2);
\end{mplibcode}
\else
-\begin{mpost}
- pair A,B,C,D,M[],N[],R[],S[];
- A=(1,1);
- B-A=(#1,0);
- C-B=(0,#2);
- D-C=A-B;
- numeric parts;
- parts=(#4 div #6);
- for k=0 upto parts:
- M[k]=(k/parts)[A,B];
- N[k]=(k/parts)[D,C];
- endfor;
- if #6>1:
- for k=0 upto #6:
- R[k]=(k/#6)[A,D];
- S[k]=(k/#6)[B,C];
- endfor;
- fi;
- picture FondRectangle;
- FondRectangle=image(%
- draw polygone(A,B,C,D);
- for k=1 upto (parts-1):
- draw segment(M[k],N[k]);
- endfor;
- if #6>1:
- for k=1 upto (#6-1):
- draw segment(R[k],S[k]);
- endfor;
- fi;
- );
- picture FondRectangleColorie;
- FondRectangleColorie=image(%
- if #6=1:
- remplis polygone(A,M[#3 mod #4],N[#3 mod #4],D) withcolor #5;
- else:
- DDiv=(#3 mod #4) div parts;
- MMod=(#3 mod #4) mod parts;
- remplis polygone(A,B,S[DDiv],R[DDiv]) withcolor #5;
- remplis polygone(R[DDiv],(xpart(M[MMod]),ypart(R[DDiv])),(xpart(M[MMod]),ypart(R[DDiv+1])),R[DDiv+1]) withcolor #5;
- fi;
- );
- m=#3 div #4;
- if (#3 mod #4)=0:m:=m-1; fi;
- if m>0:
- for l=0 upto m-1:
- remplis (polygone(A,B,C,D) shifted(l*(#1+1cm,0))) withcolor #5;
- trace FondRectangle shifted(l*(#1+1cm,0));
- endfor;
- fi;
- if (#3 mod #4)<>0:
- trace FondRectangleColorie shifted(m*(#1+1cm,0));
- else:
- remplis (polygone(A,B,C,D) shifted(m*(#1+1cm,0))) withcolor #5;
- fi;
- trace FondRectangle shifted(m*(#1+1cm,0));
+ \begin{mpost}[mpsettings={\MPFractionRegulierCode}]
+ trace FractionPolyReg(#1,#2);
\end{mpost}
\fi
-}
-
-\def\MPFractionRectangleH#1#2#3#4#5#6#7{%
- % #1 longueur, #2 largeur, #3 num, #4 deno, #5 couleur, #6 multiple
+}%
+
+\def\MPFractionTriangleCode{%
+ 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;
+ %
+ vardef FractionTriangle(expr nume,deno)=
+ m:=nume div deno;
+ picture RetourFraction;
+ RetourFraction=image(
+ for l=1 upto (nume mod deno):
+ if Reponse:
+ if Hachures:
+ drawoptions(withpen pencircle scaled Epaisseur);
+ trace hachurage(M[l] shifted(m*(Longueur+1cm,0)),90,0.2,0) withcolor ColTriangle;
+ drawoptions(withpen pencircle scaled Epaisseur);
+ else:
+ fill (M[l] shifted(m*(Longueur+1cm,0))) withcolor ColTriangle;
+ fi;
+ fi;
+ for k=1 upto nbparts:
+ trace segment((k/nbparts)[A,B],(k/nbparts)[A,C]) shifted(m*(Longueur+1cm,0));
+ trace segment((k/nbparts)[B,A],(k/nbparts)[B,C]) shifted(m*(Longueur+1cm,0));
+ trace segment((k/nbparts)[C,A],(k/nbparts)[C,B]) shifted(m*(Longueur+1cm,0));
+ endfor;
+ endfor;
+ %
+ for l=0 upto (m-1):
+ if Reponse:
+ if Hachures:
+ drawoptions(withpen pencircle scaled Epaisseur);
+ 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;
+ fi;
+ fi;
+ for k=1 upto nbparts:
+ trace segment((k/nbparts)[A,B],(k/nbparts)[A,C]) shifted(l*(Longueur+1cm,0));
+ trace segment((k/nbparts)[B,A],(k/nbparts)[B,C]) shifted(l*(Longueur+1cm,0));
+ trace segment((k/nbparts)[C,A],(k/nbparts)[C,B]) shifted(l*(Longueur+1cm,0));
+ endfor;
+ endfor;
+ );
+ RetourFraction
+ enddef;
+}%
+
+\def\MPFractionTriangle#1#2{%
+ % #1 num #2 d\'eno (attention : = partage^2)
\ifluatex
- \mplibforcehmode
+ \mplibforcehmode
\begin{mplibcode}
- pair A,B,C,D,M[],N[],R[],S[];
- A=(1,1);
- B-A=(#1,0);
- C-B=(0,#2);
- D-C=A-B;
- numeric parts;
- parts=(#4 div #6);
- for k=0 upto parts:
- M[k]=(k/parts)[A,B];
- N[k]=(k/parts)[D,C];
- endfor;
- if #6>1:
- for k=0 upto #6:
- R[k]=(k/#6)[A,D];
- S[k]=(k/#6)[B,C];
- endfor;
- fi;
- picture FondRectangle;
- FondRectangle=image(%
- draw polygone(A,B,C,D);
- for k=1 upto (parts-1):
- draw segment(M[k],N[k]);
- endfor;
- if #6>1:
- for k=1 upto (#6-1):
- draw segment(R[k],S[k]);
- endfor;
- fi;
- );
- picture FondRectangleColorie;
- FondRectangleColorie=image(%
- if #6=1:
- drawoptions(withpen pencircle scaled#7);
- trace hachurage(polygone(A,M[#3 mod #4],N[#3 mod #4],D),45,0.25,0) withcolor #5;
- else:
- DDiv=(#3 mod #4) div parts;
- MMod=(#3 mod #4) mod parts;
- drawoptions(withpen pencircle scaled#7);
- trace hachurage(polygone(A,B,S[DDiv],R[DDiv]),45,0.25,0) withcolor #5;
- drawoptions(withpen pencircle scaled#7);
- trace hachurage(polygone(R[DDiv],(xpart(M[MMod]),ypart(R[DDiv])),(xpart(M[MMod]),ypart(R[DDiv+1])),R[DDiv+1]),45,0.25,0) withcolor #5;
- fi;
- );
- m=#3 div #4;
- if (#3 mod #4)=0:m:=m-1; fi;
- if m>0:
- for l=0 upto m-1:
- drawoptions(withpen pencircle scaled#7);
- trace hachurage(polygone(A,B,C,D) shifted(l*(#1+1cm,0)),45,0.25,0) withcolor #5;
- drawoptions(withpen pencircle scaled#7);
- trace FondRectangle shifted(l*(#1+1cm,0));
- endfor;
- fi;
- if (#3 mod #4)<>0:
- drawoptions(withpen pencircle scaled#7);
- trace FondRectangleColorie shifted(m*(#1+1cm,0));
- else:
- drawoptions(withpen pencircle scaled#7);
- trace hachurage(polygone(A,B,C,D) shifted(m*(#1+1cm,0)),45,0.25,0) withcolor #5;
- fi;
- drawoptions(withpen pencircle scaled#7);
- trace FondRectangle shifted(m*(#1+1cm,0));
+ \MPFractionTriangleCode
+ draw FractionTriangle(#1,#2);
\end{mplibcode}
\else
-\begin{mpost}
- pair A,B,C,D,M[],N[],R[],S[];
- A=(1,1);
- B-A=(#1,0);
- C-B=(0,#2);
- D-C=A-B;
- numeric parts;
- parts=(#4 div #6);
- for k=0 upto parts:
- M[k]=(k/parts)[A,B];
- N[k]=(k/parts)[D,C];
- endfor;
- if #6>1:
- for k=0 upto #6:
- R[k]=(k/#6)[A,D];
- S[k]=(k/#6)[B,C];
- endfor;
- fi;
- if #6=1:
- drawoptions(withpen pencircle scaled#7);
- draw hachurage(polygone(A,M[#3],N[#3],D),45,0.25,0) withcolor #5;
- else:
- DDiv=#3 div parts;
- MMod=#3 mod parts;
- drawoptions(withpen pencircle scaled#7);
- draw hachurage(polygone(A,B,S[DDiv],R[DDiv]),45,0.25,0) withcolor #5;
- drawoptions(withpen pencircle scaled#7);
- draw hachurage(polygone(R[DDiv],(xpart(M[MMod]),ypart(R[DDiv])),(xpart(M[MMod]),ypart(R[DDiv+1])),R[DDiv+1]),45,0.25,0) withcolor #5;
- fi;
- drawoptions(withpen pencircle scaled#7);
- draw polygone(A,B,C,D);
- for k=1 upto (parts-1):
- draw segment(M[k],N[k]);
- endfor;
- if #6>1:
- for k=1 upto (#6-1):
- draw segment(R[k],S[k]);
- endfor;
- drawoptions();
- fi;
+ \begin{mpost}[mpsettings={\MPFractionTriangleCode}]
+ draw FractionTriangle(#1,#2);
\end{mpost}
\fi
-}
-
-\def\MPFractionDisque#1#2#3#4{%
- \ifluatex
- \mplibforcehmode
+}%
+
+\def\MPFractionRectangleCode{%
+ 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=(1,1);
+ 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(%
+ draw polygone(A,B,C,D);
+ for k=1 upto (parts-1):
+ draw segment(M[k],N[k]);
+ endfor;
+ if Multiple>1:
+ for k=1 upto (Multiple-1):
+ draw segment(R[k],S[k]);
+ endfor;
+ fi;
+ );
+ picture FondRectangleColorie;
+ FondRectangleColorie=image(%
+ if Multiple=1:
+ if Hachures:
+ drawoptions(withpen pencircle scaled Epaisseur);
+ trace hachurage(polygone(A,M[nume mod deno],N[nume mod deno],D),45,0.25,0) withcolor ColRectangle;
+ drawoptions(withpen pencircle scaled Epaisseur);
+ else:
+ remplis polygone(A,M[nume mod deno],N[nume mod deno],D) withcolor ColRectangle;
+ fi;
+ else:
+ DDiv=(nume mod deno) div parts;
+ MMod=(nume mod deno) mod parts;
+ if Hachures:
+ drawoptions(withpen pencircle scaled Epaisseur);
+ trace hachurage(polygone(A,B,S[DDiv],R[DDiv]),45,0.25,0) withcolor ColRectangle;
+ drawoptions(withpen pencircle scaled Epaisseur);
+ trace hachurage(polygone(R[DDiv],(xpart(M[MMod]),ypart(R[DDiv])),(xpart(M[MMod]),ypart(R[DDiv+1])),R[DDiv+1]),45,0.25,0) withcolor ColRectangle;
+ drawoptions(withpen pencircle scaled Epaisseur);
+ else:
+ remplis polygone(A,B,S[DDiv],R[DDiv]) withcolor ColRectangle;
+ remplis polygone(R[DDiv],(xpart(M[MMod]),ypart(R[DDiv])),(xpart(M[MMod]),ypart(R[DDiv+1])),R[DDiv+1]) withcolor ColRectangle;
+ fi;
+ fi;
+ );
+ picture RetourRectangle;
+ RetourRectangle=image(
+ if m>0:
+ for l=0 upto m-1:
+ if Reponse:
+ if Hachures:
+ drawoptions(withpen pencircle scaled Epaisseur);
+ trace hachurage(polygone(A,B,C,D) shifted(l*(Longueur+1cm,0)),45,0.25,0) withcolor ColRectangle;
+ drawoptions(withpen pencircle scaled Epaisseur);
+ else:
+ remplis (polygone(A,B,C,D) shifted(l*(Longueur+1cm,0))) withcolor ColRectangle;
+ fi;
+ fi;
+ trace FondRectangle shifted(l*(Longueur+1cm,0));
+ endfor;
+ fi;
+ if (nume mod deno)<>0:
+ if Reponse:
+ trace FondRectangleColorie shifted(m*(Longueur+1cm,0));
+ fi;
+ else:
+ if Reponse:
+ if Hachures:
+ trace hachurage(polygone(A,B,C,D) shifted(m*(Longueur+1cm,0)),45,0.25,0) withcolor ColRectangle;
+ else:
+ remplis (polygone(A,B,C,D) shifted(m*(Longueur+1cm,0))) withcolor ColRectangle;
+ fi;
+ fi;
+ fi;
+ trace FondRectangle shifted(m*(Longueur+1cm,0));
+ );
+ RetourRectangle
+ enddef;
+}%
+
+\def\MPFractionRectangle#1#2{%
+ % #1 num, #2 deno
+ \ifluatex%
+ \mplibforcehmode%
\begin{mplibcode}
- pair A,B[];
- A=(0,0);
- path cc;
- cc=cercles(A,#1);
- for k=0 upto #3:
- B[k]=pointarc(cc,(360/#3)*k);
- endfor;
- m=(#2 div #3);
- if (#2 mod #3)=0:m:=m-1; fi;
- if m>0:
- for l=0 upto (m-1):
- fill cc shifted(l*(2*#1+1cm,0)) withcolor #4;
- endfor;
- fi;
- fill ((A--B0--arccercle(B[0],B[#2 mod #3],A)--cycle) shifted (m*(2*#1+1cm,0))) withcolor #4;
- for l=0 upto m:
- draw cc shifted(l*(2*#1+1cm,0));
- for k=0 upto (#3-1):
- draw segment(A,B[k]) shifted(l*(2*#1+1cm,0));
- endfor;
- endfor;
+ \MPFractionRectangleCode
+ trace FractionRectangle(#1,#2);
\end{mplibcode}
- \else
- \begin{mpost}
- pair A,B[];
- A=(0,0);
- path cc;
- cc=cercles(A,#1);
- for k=0 upto #3:
- B[k]=pointarc(cc,(360/#3)*k);
- endfor;
- m=#2 div #3;
- if (#2 mod #3)=0:m:=m-1; fi;
- if m>0:
- for l=0 upto (m-1):
- fill cc shifted(l*(2*#1+1cm,0)) withcolor #4;
- endfor;
- fi;
- fill ((A--B0--arccercle(B[0],B[#2 mod #3],A)--cycle) shifted (m*(2*#1+1cm,0))) withcolor #4;
- for l=0 upto m:
- draw cc shifted(l*(2*#1+1cm,0));
- for k=0 upto (#3-1):
- draw segment(A,B[k]) shifted(l*(2*#1+1cm,0));
- endfor;
- endfor;
+ \else%
+ \begin{mpost}[mpsettings={\MPFractionRectangleCode}]
+ trace FractionRectangle(#1,#2);
\end{mpost}
- \fi
-}
-
-\def\MPFractionDisqueH#1#2#3#4#5{%
+ \fi%
+}%
+
+\def\MPFractionDisqueCode{%
+ 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;
+ cc=cercles(A,Rayon);
+ vardef FractionDisque(expr nume,deno)=
+ for k=0 upto deno:
+ B[k]=pointarc(cc,(360/deno)*k);
+ endfor;
+ m=(nume div deno);
+ if (nume mod deno)=0:m:=m-1; fi;
+ picture RetourFraction;
+ RetourFraction=image(%
+ if Reponse:
+ if m>0:
+ for l=0 upto (m-1):
+ if Hachures:
+ drawoptions(withpen pencircle scaled Epaisseur);
+ draw hachurage(cc shifted(l*(2*Rayon+1cm,0)),1.5*360/deno,0.25,0) withcolor ColDisque;
+ else:
+ fill cc shifted(l*(2*Rayon+1cm,0)) withcolor ColDisque;
+ fi;
+ endfor;
+ fi;
+ if Hachures:
+ drawoptions(withpen pencircle scaled Epaisseur);
+ draw hachurage((A--B0--arccercle(B[0],B[nume mod deno],A)--cycle) shifted(m*(2*Rayon+1cm,0)),1.5*360/deno,0.25,0) withcolor ColDisque;
+ else:
+ fill ((A--B0--arccercle(B[0],B[nume mod deno],A)--cycle) shifted (m*(2*Rayon+1cm,0))) withcolor ColDisque;
+ fi;
+ fi;
+ 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;
+ );
+ RetourFraction
+ enddef;
+}%
+
+\NewDocumentCommand\MPFractionDisque{mm}{%
\ifluatex
- \mplibforcehmode
+ \mplibforcehmode
\begin{mplibcode}
- pair A,B[];
- A=(0,0);
- path cc;
- cc=cercles(A,#1);
- for k=0 upto #3:
- B[k]=pointarc(cc,(360/#3)*k);
- endfor;
- m=#2 div #3;
- if (#2 mod #3)=0:m:=m-1; fi;
- if m>0:
- for l=0 upto (m-1):
- drawoptions(withpen pencircle scaled#5);
- draw hachurage(cc shifted(l*(2*#1+1cm,0)),1.5*360/#3,0.25,0) withcolor #4;
- endfor;
- fi;
- drawoptions(withpen pencircle scaled#5);
- draw hachurage((A--B0--arccercle(B[0],B[#2 mod #3],A)--cycle) shifted(m*(2*#1+1cm,0)),1.5*360/#3,0.25,0) withcolor #4;
- drawoptions(withpen pencircle scaled#5);
- for l=0 upto m:
- draw cc shifted(l*(2*#1+1cm,0));
- for k=0 upto (#3-1):
- draw segment(A,B[k]) shifted(l*(2*#1+1cm,0));
- endfor;
- endfor;
+ \MPFractionDisqueCode
+ trace FractionDisque(#1,#2);
\end{mplibcode}
\else
- \begin{mpost}
- pair A,B[];
- A=(0,0);
- path cc;
- cc=cercles(A,#1);
- for k=0 upto #3:
- B[k]=pointarc(cc,(360/#3)*k);
- endfor;
- m=#2 div #3;
- if (#2 mod #3)=0:m:=m-1; fi;
- if m>0:
- for l=0 upto (m-1):
- drawoptions(withpen pencircle scaled#5);
- draw hachurage(cc shifted(l*(2*#1+1cm,0)),1.5*360/#3,0.25,0) withcolor #4;
- endfor;
- fi;
- drawoptions(withpen pencircle scaled#5);
- draw hachurage((A--B0--arccercle(B[0],B[#2 mod #3],A)--cycle) shifted(m*(2*#1+1cm,0)),1.5*360/#3,0.25,0) withcolor #4;
- drawoptions(withpen pencircle scaled#5);
- for l=0 upto m:
- draw cc shifted(l*(2*#1+1cm,0));
- for k=0 upto (#3-1):
- draw segment(A,B[k]) shifted(l*(2*#1+1cm,0));
- endfor;
- endfor;
+ \begin{mpost}[mpsettings={\MPFractionDisqueCode}]
+ trace FractionDisque(#1,#2);
\end{mpost}
\fi
}
-\def\MPFractionSegment#1#2#3#4{
- \ifluatex
- \mplibforcehmode
- \begin{mplibcode}
- pair A,C,B[];
- A=(0,0);
- C-A=(#1,0);
- for k=0 upto #3:
- B[k]=(k/#3)[A,C];
- endfor;
- m=#2 div #3;
- if m>0:
- for l=0 upto (m-1):
- draw (segment(B[0],B[#3]) shifted(l*(#1+1cm,0))) withpen pencircle scaled 2 withcolor #4;
- endfor;
- fi;
- if (#2 mod #3)<>0:
- draw (segment(B[0],B[#2 mod #3]) shifted(m*(#1+1cm,0))) withpen pencircle scaled 2 withcolor #4;
- draw segment(A,C) shifted(m*(#1+1cm,0));
- fi;
- marque_p:="tiretv";
- for l=0 upto m-1:
- for k=0 upto #3:
- pointe(B[k] shifted(l*(#1+1cm,0)));
- endfor;
- endfor;
- if (#2 mod #3)<>0:
- for k=0 upto #3:
- pointe(B[k] shifted(m*(#1+1cm,0)));
- endfor;
- fi;
- \end{mplibcode}
- \else
- \begin{mpost}
- pair A,C,B[];
- A=(0,0);
- C-A=(#1,0);
- for k=0 upto #3:
- B[k]=(k/#3)[A,C];
- endfor;
- m=#2 div #3;
- if m>0:
- for l=0 upto (m-1):
- draw (segment(B[0],B[#3]) shifted(l*(#1+1cm,0))) withpen pencircle scaled 2 withcolor #4;
- endfor;
- fi;
- if (#2 mod #3)<>0:
- draw (segment(B[0],B[#2 mod #3]) shifted(m*(#1+1cm,0))) withpen pencircle scaled 2 withcolor #4;
- draw segment(A,C) shifted(m*(#1+1cm,0));
- fi;
- marque_p:="tiretv";
- for l=0 upto m-1:
- for k=0 upto #3:
- pointe(B[k] shifted(l*(#1+1cm,0)));
- endfor;
- endfor;
- if (#2 mod #3)<>0:
- for k=0 upto #3:
- pointe(B[k] shifted(m*(#1+1cm,0)));
- endfor;
- fi;
- \end{mpost}
- \fi
+\def\MPFractionSegmentCode{%
+ 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);
+ %
+ vardef FractionSegment(expr nume,deno)=
+ for k=0 upto deno:
+ B[k]=(k/deno)[A,C];
+ endfor;
+ m=nume div deno;
+ picture RetourFraction;
+ RetourFraction=image(
+ if m>0:
+ for l=0 upto (m-1):
+ if Reponse:
+ if Hachures:
+ drawoptions(withpen pencircle scaled Epaisseur);
+ draw hachurage(polygone(B[0]+u*(0,-0.15),B[deno]+u*(0,-0.15),B[deno]+u*(0,0.15),B[0]+u*(0,0.15)) shifted(l*(Longueur+1cm,0)),120,0.2,0) withcolor ColSegment;
+ drawoptions();
+ else:
+ draw (segment(B[0],B[deno]) shifted(l*(Longueur+1cm,0))) withpen pencircle scaled 2 withcolor ColSegment;
+ fi;
+ fi;
+ draw (segment(B[0],B[deno]) shifted(l*(Longueur+1cm,0)));
+ endfor;
+ fi;
+ if (nume mod deno)<>0:
+ if Reponse:
+ if Hachures:
+ drawoptions(withpen pencircle scaled Epaisseur);
+ draw hachurage(polygone(B[0]+u*(0,-0.15),B[nume mod deno]+u*(0,-0.15),B[nume mod deno]+u*(0,0.15),B[0]+u*(0,0.15)) shifted(m*(Longueur+1cm,0)),120,0.2,0) withcolor ColSegment;
+ drawoptions();
+ else:
+ draw (segment(B[0],B[nume mod deno]) shifted(m*(Longueur+1cm,0))) withpen pencircle scaled 2 withcolor ColSegment;
+ draw segment(A,C) shifted(m*(Longueur+1cm,0));
+ fi;
+ fi;
+ draw (segment(B[0],B[nume mod deno]) shifted(m*(Longueur+1cm,0)));
+ draw segment(A,C) shifted(m*(Longueur+1cm,0));
+ fi;
+ 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\MPFractionSegmentH#1#2#3#4#5{%
+\NewDocumentCommand\MPFractionSegment{mm}{%
\ifluatex
- \mplibforcehmode
+ \mplibforcehmode
\begin{mplibcode}
- pair A,C,B[];
- A=(0,0);
- C-A=(#1,0);
- for k=0 upto #3:
- B[k]=(k/#3)[A,C];
- endfor;
- m=#2 div #3;
- if m>0:
- for l=0 upto (m-1):
- drawoptions(withpen pencircle scaled#5);
- draw hachurage(polygone(B[0]+u*(0,-0.15),B[#3]+u*(0,-0.15),B[#3]+u*(0,0.15),B[0]+u*(0,0.15)) shifted(l*(#1+1cm,0)),120,0.2,0) withcolor #4;
- drawoptions(withpen pencircle scaled#5);
- draw segment(A,C) shifted(l*(#1+1cm,0));
- endfor;
- fi;
- if (#2 mod #3)<>0:
- drawoptions(withpen pencircle scaled#5);
- draw hachurage(polygone(B[0]+u*(0,-0.15),B[#2 mod #3]+u*(0,-0.15),B[#2 mod #3]+u*(0,0.15),B[0]+u*(0,0.15)) shifted(m*(#1+1cm,0)),120,0.2,0) withcolor #4;
- drawoptions(withpen pencircle scaled#5);
- draw segment(A,C) shifted(m*(#1+1cm,0));
- fi;
- marque_p:="tiretv";
- for l=0 upto m-1:
- for k=0 upto #3:
- pointe(B[k] shifted(l*(#1+1cm,0)));
- endfor;
- endfor;
- if (#2 mod #3)<>0:
- for k=0 upto #3:
- pointe(B[k] shifted(m*(#1+1cm,0)));
- endfor;
- fi;
+ \MPFractionSegmentCode
+ trace FractionSegment(#1,#2);
\end{mplibcode}
\else
- \begin{mpost}
- pair A,C,B[];
- A=(0,0);
- C-A=(#1,0);
- for k=0 upto #3:
- B[k]=(k/#3)[A,C];
- endfor;
- m=#2 div #3;
- if m>0:
- for l=0 upto (m-1):
- drawoptions(withpen pencircle scaled#5);
- draw hachurage(polygone(B[0]+u*(0,-0.15),B[#3]+u*(0,-0.15),B[#3]+u*(0,0.15),B[0]+u*(0,0.15)) shifted(l*(#1+1cm,0)),120,0.2,0) withcolor #4;
- drawoptions(withpen pencircle scaled#5);
- draw segment(A,C) shifted(l*(#1+1cm,0));
- endfor;
- fi;
- if (#2 mod #3)<>0:
- drawoptions(withpen pencircle scaled#5);
- draw hachurage(polygone(B[0]+u*(0,-0.15),B[#2 mod #3]+u*(0,-0.15),B[#2 mod #3]+u*(0,0.15),B[0]+u*(0,0.15)) shifted(m*(#1+1cm,0)),120,0.2,0) withcolor #4;
- drawoptions(withpen pencircle scaled#5);
- draw segment(A,C) shifted(m*(#1+1cm,0));
- fi;
- marque_p:="tiretv";
- for l=0 upto m-1:
- for k=0 upto #3:
- pointe(B[k] shifted(l*(#1+1cm,0)));
- endfor;
- endfor;
- if (#2 mod #3)<>0:
- for k=0 upto #3:
- pointe(B[k] shifted(m*(#1+1cm,0)));
- endfor;
- fi;
+ \begin{mpost}[mpsettings={\MPFractionSegmentCode}]
+ trace FractionSegment(#1,#2);
\end{mpost}
\fi
}
-\newcommand\Fraction[2][]{%
+\NewDocumentCommand\Fraction{o m}{%
\useKVdefault[ClesFraction]%
\setKV[ClesFraction]{#1}%
\setsepchar[*]{/}%
\readlist*\ListeFraction{#2}%
- \ifboolKV[ClesFraction]{Triangle}{%
- \ifboolKV[ClesFraction]{Reponse}{}{\setKV[ClesFraction]{Couleur=white}}%
- \ifboolKV[ClesFraction]{Hachures}{%
- \MPFractionTriangleH{\useKV[ClesFraction]{Longueur}}{\useKV[ClesFraction]{Parts}}{\ListeFraction[1]}{\ListeFraction[2]}{\useKV[ClesFraction]{Couleur}}{\useKV[ClesFraction]{Epaisseur}}%
- }{%
- \MPFractionTriangle{\useKV[ClesFraction]{Longueur}}{\useKV[ClesFraction]{Parts}}{\ListeFraction[1]}{\ListeFraction[2]}{\useKV[ClesFraction]{Couleur}}%
- }%
+ \ifboolKV[ClesFraction]{Eprouvette}{%
+ \MPFractionEprouvette{\ListeFraction[1]}{\ListeFraction[2]}%
}{%
- \ifboolKV[ClesFraction]{Regulier}{%
- \ifboolKV[ClesFraction]{Reponse}{}{\setKV[ClesFraction]{Couleur=white}}%
- \ifboolKV[ClesFraction]{Hachures}{%
- \MPFractionRegulierH{\useKV[ClesFraction]{Rayon}}{\useKV[ClesFraction]{Cotes}}{\ListeFraction[1]}{\ListeFraction[2]}{\useKV[ClesFraction]{Couleur}}{\useKV[ClesFraction]{Epaisseur}}%
- }{%
- \MPFractionRegulier{\useKV[ClesFraction]{Rayon}}{\useKV[ClesFraction]{Cotes}}{\ListeFraction[1]}{\ListeFraction[2]}{\useKV[ClesFraction]{Couleur}}%
- }%
+ \ifboolKV[ClesFraction]{Triangle}{%
+ \MPFractionTriangle{\ListeFraction[1]}{\ListeFraction[2]}%
}{%
- \ifboolKV[ClesFraction]{Segment}{%
- \ifboolKV[ClesFraction]{Reponse}{}{\setKV[ClesFraction]{Couleur=white}}%
- \ifboolKV[ClesFraction]{Hachures}{%
- \MPFractionSegmentH{\useKV[ClesFraction]{Longueur}}{\ListeFraction[1]}{\ListeFraction[2]}{\useKV[ClesFraction]{Couleur}}{\useKV[ClesFraction]{Epaisseur}}%
- }{%
- \MPFractionSegment{\useKV[ClesFraction]{Longueur}}{\ListeFraction[1]}{\ListeFraction[2]}{\useKV[ClesFraction]{Couleur}}%
- }%
+ \ifboolKV[ClesFraction]{Regulier}{%
+ \MPFractionRegulier{\ListeFraction[1]}{\ListeFraction[2]}%
}{%
- \ifboolKV[ClesFraction]{Rectangle}{%rectangle
- \ifboolKV[ClesFraction]{Reponse}{}{\setKV[ClesFraction]{Couleur=white}}%
- \ifboolKV[ClesFraction]{Hachures}{%
- \MPFractionRectangleH{\useKV[ClesFraction]{Longueur}}{\useKV[ClesFraction]{Largeur}}{\ListeFraction[1]}{\ListeFraction[2]}{\useKV[ClesFraction]{Couleur}}{\useKV[ClesFraction]{Multiple}}{\useKV[ClesFraction]{Epaisseur}}%
- }{%
- \MPFractionRectangle{\useKV[ClesFraction]{Longueur}}{\useKV[ClesFraction]{Largeur}}{\ListeFraction[1]}{\ListeFraction[2]}{\useKV[ClesFraction]{Couleur}}{\useKV[ClesFraction]{Multiple}}%
- }%
- }{%disque
- \ifboolKV[ClesFraction]{Reponse}{}{\setKV[ClesFraction]{Couleur=white}}%
- \ifboolKV[ClesFraction]{Hachures}{%
- \MPFractionDisqueH{\useKV[ClesFraction]{Rayon}}{\ListeFraction[1]}{\ListeFraction[2]}{\useKV[ClesFraction]{Couleur}}{\useKV[ClesFraction]{Epaisseur}}%
+ \ifboolKV[ClesFraction]{Segment}{%
+ \MPFractionSegment{\ListeFraction[1]}{\ListeFraction[2]}%
+ }{%
+ \ifboolKV[ClesFraction]{Rectangle}{%
+ \MPFractionRectangle{\ListeFraction[1]}{\ListeFraction[2]}%
}{%
- \MPFractionDisque{\useKV[ClesFraction]{Rayon}}{\ListeFraction[1]}{\ListeFraction[2]}{\useKV[ClesFraction]{Couleur}}%
+ \MPFractionDisque{\ListeFraction[1]}{\ListeFraction[2]}%
}%
}%
}%
diff --git a/macros/latex/contrib/profcollege/latex/PfCSquaro.tex b/macros/latex/contrib/profcollege/latex/PfCSquaro.tex
index f6b67bdb52..9de4a7afdf 100644
--- a/macros/latex/contrib/profcollege/latex/PfCSquaro.tex
+++ b/macros/latex/contrib/profcollege/latex/PfCSquaro.tex
@@ -6,31 +6,33 @@
\NewDocumentCommand\SquarO{o}{%
\useKVdefault[Squaro]%
- \setKVdefault[Squaro]{#1}%
- \ifboolKV[Squaro]{Solution}{\BuildSquaroSolution}{\BuildSquaro}%
+ \setKV[Squaro]{#1}%
+ \BuildSquaro%
+}%
+
+\def\BuildSquarobase{%
+ numeric Longueur,Largeur;
+ Longueur=\useKV[Squaro]{Longueur};
+ Largeur=\useKV[Squaro]{Largeur};
+ boolean Solution,Graines;
+ Solution=\useKV[Squaro]{Solution};
+ Graines=\useKV[Squaro]{Graines};
+ if Graines:
+ randomseed:=\useKV[Squaro]{Graine};
+ fi;
+ %
+ u:=\useKV[Squaro]{Echelle};
+ %
+ p:=0;
+ pair A[];%centre des carrés.
+ boolean Allume[][];
}
\NewDocumentCommand\BuildSquaro{}{%
\ifluatex
- \mplibforcehmode
- \xdef\PfCSquaroNom{\useKV[Squaro]{Nom}}%
- \begin{mplibcode}[\PfCSquaroNom]
- numeric Longueur,Largeur;
- Longueur=\useKV[Squaro]{Longueur};
- Largeur=\useKV[Squaro]{Largeur};
- boolean Solution,Graines;
- Solution=\useKV[Squaro]{Solution};
- Graines:=\useKV[Squaro]{Graines};
- if Graines:
- randomseed:=\useKV[Squaro]{Graine};
- fi;
-
- u:=\useKV[Squaro]{Echelle};
-
- p:=0;
- pair A[];%centre des carrés.
- boolean Allume[][];
-
+ \mplibforcehmode
+ \begin{mplibcode}
+ \BuildSquarobase
for k=0 upto Longueur-1:
for l=0 upto Largeur-1:
p:=p+1;
@@ -63,29 +65,25 @@
label(TEX(decimal(Retiens)),u*(l+0.5,-k+0.5));
endfor;
endfor;
- \end{mplibcode}
- \fi
-}
-
-\NewDocumentCommand\BuildSquaroSolution{}{%
- \ifluatex
- \mplibforcehmode
- \xdef\PfCSquaroNom{\useKV[Squaro]{Nom}}%
- \begin{mplibcode}[\PfCSquaroNom]
- u:=\useKV[Squaro]{Echelle};
- p:=0;
+ \end{mplibcode}
+ \else
+ \begin{mpost}[mpsettings={\BuildSquarobase}]
for k=0 upto Longueur-1:
for l=0 upto Largeur-1:
p:=p+1;
+ A[p]=u*(k,-l);
trace (unitsquare scaled u) shifted A[p];
endfor;
endfor;
for k=0 upto Largeur:
for l=0 upto Longueur:
- if Allume[k][l]=true:
- fill cercles(u*(l,-k+1),1mm);
+ m:=uniformdeviate(1);
+ if m<0.5:
+ Allume[k][l]=true;
+ fill cercles(u*(l,-k+1),1mm) if Solution=false:withcolor white fi;
else:
+ Allume[k][l]=false;
fill cercles(u*(l,-k+1),1mm) withcolor white;
fi;
trace cercles(u*(l,-k+1),1mm);
@@ -99,9 +97,9 @@
if Allume[k][l+1]:Retiens:=Retiens+1 fi;
if Allume[k+1][l]:Retiens:=Retiens+1 fi;
if Allume[k+1][l+1]:Retiens:=Retiens+1 fi;
- label(TEX(decimal(Retiens)),u*(l+0.5,-k+0.5));
+ label(LATEX(decimal(Retiens)),u*(l+0.5,-k+0.5));
endfor;
endfor;
- \end{mplibcode}
+ \end{mpost}
\fi
}% \ No newline at end of file
diff --git a/macros/latex/contrib/profcollege/latex/PfCSquaroaprioriold.tex b/macros/latex/contrib/profcollege/latex/PfCSquaroaprioriold.tex
new file mode 100644
index 0000000000..ec3717b9c6
--- /dev/null
+++ b/macros/latex/contrib/profcollege/latex/PfCSquaroaprioriold.tex
@@ -0,0 +1,107 @@
+%%%
+% Squaro
+%%%
+\setKVdefault[Squaro]{Solution=false,Longueur=8,Largeur=8,Echelle=8mm,Nom=Jeu1,Graines=false}
+\defKV[Squaro]{Graine=\setKV[Squaro]{Graines}}%
+
+\NewDocumentCommand\SquarO{o}{%
+ \useKVdefault[Squaro]%
+ \setKVdefault[Squaro]{#1}%
+ \ifboolKV[Squaro]{Solution}{\BuildSquaroSolution}{\BuildSquaro}%
+}
+
+\NewDocumentCommand\BuildSquaro{}{%
+ \ifluatex
+ \mplibforcehmode
+ \xdef\PfCSquaroNom{\useKV[Squaro]{Nom}}%
+ \begin{mplibcode}[\PfCSquaroNom]
+ numeric Longueur,Largeur;
+ Longueur=\useKV[Squaro]{Longueur};
+ Largeur=\useKV[Squaro]{Largeur};
+ boolean Solution,Graines;
+ Solution=\useKV[Squaro]{Solution};
+ Graines:=\useKV[Squaro]{Graines};
+ if Graines:
+ randomseed:=\useKV[Squaro]{Graine};
+ fi;
+
+ u:=\useKV[Squaro]{Echelle};
+
+ p:=0;
+ pair A[];%centre des carrés.
+ boolean Allume[][];
+
+ for k=0 upto Longueur-1:
+ for l=0 upto Largeur-1:
+ p:=p+1;
+ A[p]=u*(k,-l);
+ trace (unitsquare scaled u) shifted A[p];
+ endfor;
+ endfor;
+
+ for k=0 upto Largeur:
+ for l=0 upto Longueur:
+ m:=uniformdeviate(1);
+ if m<0.5:
+ Allume[k][l]=true;
+ fill cercles(u*(l,-k+1),1mm) if Solution=false:withcolor white fi;
+ else:
+ Allume[k][l]=false;
+ fill cercles(u*(l,-k+1),1mm) withcolor white;
+ fi;
+ trace cercles(u*(l,-k+1),1mm);
+ endfor;
+ endfor;
+
+ for k=0 upto Largeur-1:
+ for l=0 upto Longueur-1:
+ Retiens:=0;
+ if Allume[k][l]:Retiens:=Retiens+1 fi;
+ if Allume[k][l+1]:Retiens:=Retiens+1 fi;
+ if Allume[k+1][l]:Retiens:=Retiens+1 fi;
+ if Allume[k+1][l+1]:Retiens:=Retiens+1 fi;
+ label(TEX(decimal(Retiens)),u*(l+0.5,-k+0.5));
+ endfor;
+ endfor;
+ \end{mplibcode}
+ \fi
+}
+
+\NewDocumentCommand\BuildSquaroSolution{}{%
+ \ifluatex
+ \mplibforcehmode
+ \xdef\PfCSquaroNom{\useKV[Squaro]{Nom}}%
+ \begin{mplibcode}[\PfCSquaroNom]
+ u:=\useKV[Squaro]{Echelle};
+ p:=0;
+ for k=0 upto Longueur-1:
+ for l=0 upto Largeur-1:
+ p:=p+1;
+ trace (unitsquare scaled u) shifted A[p];
+ endfor;
+ endfor;
+
+ for k=0 upto Largeur:
+ for l=0 upto Longueur:
+ if Allume[k][l]=true:
+ fill cercles(u*(l,-k+1),1mm);
+ else:
+ fill cercles(u*(l,-k+1),1mm) withcolor white;
+ fi;
+ trace cercles(u*(l,-k+1),1mm);
+ endfor;
+ endfor;
+
+ for k=0 upto Largeur-1:
+ for l=0 upto Longueur-1:
+ Retiens:=0;
+ if Allume[k][l]:Retiens:=Retiens+1 fi;
+ if Allume[k][l+1]:Retiens:=Retiens+1 fi;
+ if Allume[k+1][l]:Retiens:=Retiens+1 fi;
+ if Allume[k+1][l+1]:Retiens:=Retiens+1 fi;
+ label(TEX(decimal(Retiens)),u*(l+0.5,-k+0.5));
+ endfor;
+ endfor;
+ \end{mplibcode}
+ \fi
+}% \ No newline at end of file
diff --git a/macros/latex/contrib/profcollege/latex/PfCStatistiques.tex b/macros/latex/contrib/profcollege/latex/PfCStatistiques.tex
index 03fb0f7ec6..6be4545dee 100644
--- a/macros/latex/contrib/profcollege/latex/PfCStatistiques.tex
+++ b/macros/latex/contrib/profcollege/latex/PfCStatistiques.tex
@@ -229,6 +229,46 @@ Barre=false,Longueur=10cm,Hauteur=5mm,Bicolore=false,EcartBarre=0%Grille est dis
\num{\TotalECC}%
}
+\def\NewMPDiagBarreHorCode{%
+ Longueur:=\useKV[ClesStat]{Longueur};
+ Hauteur:=\useKV[ClesStat]{Hauteur};
+ Ecart:=\useKV[ClesStat]{EcartBarre};
+ ExposantDivMax:=\ExposantDivMax;
+ ecarthachures=\useKV[ClesStat]{EcartHachures};
+ epaisseurhachures=\useKV[ClesStat]{EpaisseurHachures};
+ boolean Hachures,Bicolore,Grille,AffichageDonnee,LegendeVide;
+ Hachures=\useKV[ClesStat]{Hachures};
+ Bicolore=\useKV[ClesStat]{Bicolore};
+ Grille=\useKV[ClesStat]{Grille};
+ AffichageDonnee=\useKV[ClesStat]{AffichageDonnee};
+ LegendeVide=\useKV[ClesStat]{LegendeVide};
+ vardef CalculNombreDonneesEtDonneeMax(text t)=
+ nbdon:=0;%nombre de données
+ DonneeMax:=0;%donnée DonneeMaximale
+ for p_=t:
+ nbdon:=nbdon+1;
+ if p_>DonneeMax:
+ DonneeMax:=p_;
+ fi;
+ endfor;
+ enddef;
+ vardef ListeDonnees(text t)=
+ n:=0;
+ for p_=t:
+ n:=n+1;
+ Donnees[n]:=p_;
+ endfor;
+ enddef;
+ vardef RecuperationCouleurs(text t)=
+ color Col[];
+ n:=0;
+ for p_=t:
+ n:=n+1;
+ Col[n]=p_;
+ endfor;
+ enddef;
+}
+
% Construction d'un diagramme en barres horizontal
\newcommand\NewMPDiagBarreHor[4]{%
% #1 Liste des noms
@@ -238,47 +278,7 @@ Barre=false,Longueur=10cm,Hauteur=5mm,Bicolore=false,EcartBarre=0%Grille est dis
\ifluatex%
\mplibforcehmode%
\begin{mplibcode}%
- Longueur:=\useKV[ClesStat]{Longueur};
- Hauteur:=\useKV[ClesStat]{Hauteur};
- Ecart:=\useKV[ClesStat]{EcartBarre};
- ExposantDivMax:=\ExposantDivMax;
- ecarthachures=\useKV[ClesStat]{EcartHachures};
- epaisseurhachures=\useKV[ClesStat]{EpaisseurHachures};
- boolean Hachures;
- Hachures=\useKV[ClesStat]{Hachures};
- boolean Bicolore;
- Bicolore=\useKV[ClesStat]{Bicolore};
- boolean Grille;
- Grille=\useKV[ClesStat]{Grille};
- boolean AffichageDonnee;
- AffichageDonnee=\useKV[ClesStat]{AffichageDonnee};
- boolean LegendeVide;
- LegendeVide=\useKV[ClesStat]{LegendeVide};
- vardef CalculNombreDonneesEtDonneeMax(text t)=
- nbdon:=0;%nombre de données
- DonneeMax:=0;%donnée DonneeMaximale
- for p_=t:
- nbdon:=nbdon+1;
- if p_>DonneeMax:
- DonneeMax:=p_;
- fi;
- endfor;
- enddef;
- vardef ListeDonnees(text t)=
- n:=0;
- for p_=t:
- n:=n+1;
- Donnees[n]:=p_;
- endfor;
- enddef;
- vardef RecuperationCouleurs(text t)=
- color Col[];
- n:=0;
- for p_=t:
- n:=n+1;
- Col[n]=p_;
- endfor;
- enddef;
+ \NewMPDiagBarreHorCode%
vardef TraceDiag=
if Grille:
pair Zz[];%Pour déterminer "le dernier point"
@@ -353,49 +353,7 @@ Barre=false,Longueur=10cm,Hauteur=5mm,Bicolore=false,EcartBarre=0%Grille est dis
fi;
\end{mplibcode}
\else%
- \begin{mpost}[mpsettings={%
- Longueur:=\useKV[ClesStat]{Longueur};
- Hauteur:=\useKV[ClesStat]{Hauteur};
- Ecart:=\useKV[ClesStat]{EcartBarre};
- ExposantDivMax:=\ExposantDivMax;
- ecarthachures=\useKV[ClesStat]{EcartHachures};
- epaisseurhachures=\useKV[ClesStat]{EpaisseurHachures};
- boolean Hachures;
- Hachures=\useKV[ClesStat]{Hachures};
- boolean Bicolore;
- Bicolore=\useKV[ClesStat]{Bicolore};
- boolean Grille;
- Grille=\useKV[ClesStat]{Grille};
- boolean AffichageDonnee;
- AffichageDonnee=\useKV[ClesStat]{AffichageDonnee};
- boolean LegendeVide;
- LegendeVide=\useKV[ClesStat]{LegendeVide};
- }]
- vardef CalculNombreDonneesEtDonneeMax(text t)=
- nbdon:=0;%nombre de données
- DonneeMax:=0;%donnée DonneeMaximale
- for p_=t:
- nbdon:=nbdon+1;
- if p_>DonneeMax:
- DonneeMax:=p_;
- fi;
- endfor;
- enddef;
- vardef ListeDonnees(text t)=
- n:=0;
- for p_=t:
- n:=n+1;
- Donnees[n]:=p_;
- endfor;
- enddef;
- vardef RecuperationCouleurs(text t)=
- color Col[];
- n:=0;
- for p_=t:
- n:=n+1;
- Col[n]=p_;
- endfor;
- enddef;
+ \begin{mpost}[mpsettings={\NewMPDiagBarreHorCode}]
vardef TraceDiag=
if Grille:
pair Zz[];%Pour déterminer "le dernier point"
@@ -472,37 +430,70 @@ Barre=false,Longueur=10cm,Hauteur=5mm,Bicolore=false,EcartBarre=0%Grille est dis
\fi%
}%
+\def\MPStatNewCode{%
+ maxx:=0;
+ maxy:=0;
+ unitex:=\useKV[ClesStat]{Unitex}*cm;
+ unitey:=\useKV[ClesStat]{Unitey}*cm;
+ xpartorigine:=\useKV[ClesStat]{Origine};
+ AngleRotation=\useKV[ClesStat]{AngleRotationAbscisse};
+ boolean Rotation,Lecture,LectureFine,AideLecture,DonneesSup,Reponses,Qualitatif,Tiret;
+ Rotation=\useKV[ClesStat]{AbscisseRotation};
+ Lecture:=\useKV[ClesStat]{Lecture};
+ LectureFine:=\useKV[ClesStat]{LectureFine};
+ AideLecture:=\useKV[ClesStat]{AideLecture};
+ DonneesSup:=\useKV[ClesStat]{DonneesSup};
+ Reponses:=\useKV[ClesStat]{Reponses};
+ epaisseurbatons=\useKV[ClesStat]{EpaisseurBatons};
+ Qualitatif=\useKV[ClesStat]{Qualitatif};
+ Tiret=\useKV[ClesStat]{Tiret};
+ color CoulDefaut;
+ CoulDefaut=\useKV[ClesStat]{CouleurDefaut};
+ Depart=\useKV[ClesStat]{Depart};
+ %
+ pair A[],B[],P[];
+ vardef toto(text t)=%points quantitatif
+ n:=0;
+ for p_=t:
+ if pair p_:
+ n:=n+1;
+ P[n]=((xpart(p_)-(xpartorigine))*unitex,ypart(p_)*unitey);
+ if xpart(p_)>maxx:
+ maxx:=xpart(p_)-(xpartorigine);
+ fi;
+ if ypart(p_)>maxy:
+ maxy:=ypart(p_);
+ fi;
+ A[n]=unitex*(xpart(p_)-(xpartorigine),0);
+ B[n]=unitey*(0,ypart(p_));
+ fi;
+ endfor;
+ enddef;
+ vardef tutu(text t)=%points qualitatif
+ n:=0;
+ for p_=t:
+ if numeric p_:
+ P[n]=((n)*unitex,unitey*(p_-Depart));
+ B[n]=(0,unitey*(p_-Depart));
+ if p_>maxy:
+ maxy:=p_;
+ fi;
+ else:
+ n:=n+1;
+ A[n]=unitex*(n,0);
+ fi;
+ endfor;
+ maxy:=maxy-Depart;
+ maxx:=n;
+ enddef;
+}
+
% Construction du graphique en bâtons
\newcommand\MPStatNew[2]{%
\ifluatex
\mplibforcehmode
\begin{mplibcode}
- maxx:=0;
- maxy:=0;
- unitex:=\useKV[ClesStat]{Unitex}*cm;
- unitey:=\useKV[ClesStat]{Unitey}*cm;
- xpartorigine:=\useKV[ClesStat]{Origine};
- AngleRotation=\useKV[ClesStat]{AngleRotationAbscisse};
- boolean Rotation;
- Rotation=\useKV[ClesStat]{AbscisseRotation};
- boolean Lecture;
- Lecture:=\useKV[ClesStat]{Lecture};
- boolean LectureFine;
- LectureFine:=\useKV[ClesStat]{LectureFine};
- boolean AideLecture;
- AideLecture:=\useKV[ClesStat]{AideLecture};
- boolean DonneesSup;
- DonneesSup:=\useKV[ClesStat]{DonneesSup};
- boolean Reponses;
- Reponses:=\useKV[ClesStat]{Reponses};
- epaisseurbatons=\useKV[ClesStat]{EpaisseurBatons};
- boolean Qualitatif;
- Qualitatif=\useKV[ClesStat]{Qualitatif};
- boolean Tiret;
- Tiret=\useKV[ClesStat]{Tiret};
- color CoulDefaut;
- CoulDefaut=\useKV[ClesStat]{CouleurDefaut};
- Depart=\useKV[ClesStat]{Depart};
+ \MPStatNewCode
% on r\'ecup\`ere les couleurs
color Col[];
n:=0;
@@ -514,42 +505,6 @@ Barre=false,Longueur=10cm,Hauteur=5mm,Bicolore=false,EcartBarre=0%Grille est dis
Col[n]=CoulDefaut;
fi;
endfor;
- %
- pair A[],B[],P[];
- vardef toto(text t)=%points quantitatif
- n:=0;
- for p_=t:
- if pair p_:
- n:=n+1;
- P[n]=((xpart(p_)-(xpartorigine))*unitex,ypart(p_)*unitey);
- if xpart(p_)>maxx:
- maxx:=xpart(p_)-(xpartorigine);
- fi;
- if ypart(p_)>maxy:
- maxy:=ypart(p_);
- fi;
- A[n]=unitex*(xpart(p_)-(xpartorigine),0);
- B[n]=unitey*(0,ypart(p_));
- fi;
- endfor;
- enddef;
- vardef tutu(text t)=%points qualitatif
- n:=0;
- for p_=t:
- if numeric p_:
- P[n]=((n)*unitex,unitey*(p_-Depart));
- B[n]=(0,unitey*(p_-Depart));
- if p_>maxy:
- maxy:=p_;
- fi;
- else:
- n:=n+1;
- A[n]=unitex*(n,0);
- fi;
- endfor;
- maxy:=maxy-Depart;
- maxx:=n;
- enddef;
vardef tata(text t)=%affichage quantitatif
l=0;
for p_=t:
@@ -659,33 +614,7 @@ Barre=false,Longueur=10cm,Hauteur=5mm,Bicolore=false,EcartBarre=0%Grille est dis
if Qualitatif: titi(#1); else:tata(#1); fi;
\end{mplibcode}
\else
- \begin{mpost}[mpsettings={%
- unitex:=\useKV[ClesStat]{Unitex}*cm;
- unitey:=\useKV[ClesStat]{Unitey}*cm;
- xpartorigine:=\useKV[ClesStat]{Origine};
- AngleRotation=\useKV[ClesStat]{AngleRotationAbscisse};
- boolean Rotation,Lecture;
- Rotation=\useKV[ClesStat]{AbscisseRotation};
-% boolean Lecture;
- Lecture:=\useKV[ClesStat]{Lecture};
- boolean LectureFine;
- LectureFine:=\useKV[ClesStat]{LectureFine};
- boolean AideLecture;
- AideLecture:=\useKV[ClesStat]{AideLecture};
- boolean DonneesSup;
- DonneesSup:=\useKV[ClesStat]{DonneesSup};
- boolean Reponses;
- Reponses:=\useKV[ClesStat]{Reponses};
- epaisseurbatons=\useKV[ClesStat]{EpaisseurBatons};
- boolean Qualitatif;
- Qualitatif=\useKV[ClesStat]{Qualitatif};
- boolean Tiret;
- Tiret=\useKV[ClesStat]{Tiret};
- color CoulDefaut;
- CoulDefaut=\useKV[ClesStat]{CouleurDefaut};
- Depart=\useKV[ClesStat]{Depart};}]
- maxx:=0;
- maxy:=0;
+ \begin{mpost}[mpsettings={\MPStatNewCode}]
% on r\'ecup\`ere les couleurs
color Col[];
n:=0;
@@ -698,24 +627,6 @@ Barre=false,Longueur=10cm,Hauteur=5mm,Bicolore=false,EcartBarre=0%Grille est dis
fi;
endfor;
%
- pair A[],B[],P[];
- vardef toto(text t)=%points quantitatif
- n:=0;
- for p_=t:
- if pair p_:
- n:=n+1;
- P[n]=((xpart(p_)-(xpartorigine))*unitex,ypart(p_)*unitey);
- if xpart(p_)>maxx:
- maxx:=xpart(p_)-(xpartorigine);
- fi;
- if ypart(p_)>maxy:
- maxy:=ypart(p_);
- fi;
- A[n]=unitex*(xpart(p_)-(xpartorigine),0);
- B[n]=unitey*(0,ypart(p_));
- fi;
- endfor;
- enddef;
vardef tata(text t)=%affichage quantitatif
l=0;
for p_=t:
@@ -741,22 +652,6 @@ Barre=false,Longueur=10cm,Hauteur=5mm,Bicolore=false,EcartBarre=0%Grille est dis
fi;
endfor;
enddef;
- vardef tutu(text t)=%points qualitatif
- n:=0;
- for p_=t:
- if numeric p_:
- P[n]=((n)*unitex,unitey*p_);
- B[n]=(0,unitey*p_);
- if p_>maxy:
- maxy:=p_;
- fi;
- else:
- n:=n+1;
- A[n]=unitex*(n,0);
- fi;
- endfor;
- maxx:=n;
- enddef;
vardef titi(text t)=%affichage qualitatif
l:=0;
for p_=t:
@@ -843,6 +738,102 @@ Barre=false,Longueur=10cm,Hauteur=5mm,Bicolore=false,EcartBarre=0%Grille est dis
\fi
}
+\def\NewMPStatCirculaireCodeQ{%
+ Rayon:=\useKV[ClesStat]{Rayon};
+ ecarthachures=\useKV[ClesStat]{EcartHachures};
+ epaisseurhachures=\useKV[ClesStat]{EpaisseurHachures};
+ boolean AffichageAngle,AffichageDonnee,Hachures,Inverse,Legende,LegendeVide,Retour,ACompleter;
+ AffichageAngle=\useKV[ClesStat]{AffichageAngle};
+ AffichageDonnee=\useKV[ClesStat]{AffichageDonnee};
+ Hachures=\useKV[ClesStat]{Hachures};
+ Inverse=\useKV[ClesStat]{LectureInverse};
+ Legende=\useKV[ClesStat]{Legende};
+ LegendeVide=\useKV[ClesStat]{LegendeVide};
+ Retour=false;
+ ACompleter=\useKV[ClesStat]{ACompleter};
+ %
+ pair A[],O,B[],C[],D[];
+ O=(0,0);
+ n:=0;
+ numeric total[],ang[];
+ total[0]=0;
+ ang[0]:=0;
+ path cc;
+ cc=(fullcircle scaled (2*Rayon));
+ vardef AfficheLegende(text t)=
+ picture ResultatLegende;
+ ResultatLegende=image(
+ for p_=t:
+ if string p_:
+ n:=n+1;
+ C[n]=A[n-1] rotatedabout(O,if Inverse:-1* fi(ang[n]-ang[n-1])/2);
+ draw 0.95[O,C[n]]--1.05[O,C[n]];
+ C[n]:=1.05[O,C[n]];
+ Test(n);
+ if (xpart(C[n])>xpart(O)) and (ypart(C[n])>ypart(O)):
+ D[n]=C[n]+(0.5cm,0);
+ draw C[n]--D[n];
+ if Retour=false:label.urt(TEX(p_),D[n]);fi;
+ fi;
+ if (xpart(C[n])<xpart(O)) and (ypart(C[n])>ypart(O)):
+ D[n]=C[n]-(0.5cm,0);
+ draw C[n]--D[n];
+ if Retour=false:label.ulft(TEX(p_),D[n]);fi;
+ fi;
+ if (xpart(C[n])<xpart(O)) and (ypart(C[n])<ypart(O)):
+ D[n]=C[n]-(0.5cm,0);
+ draw C[n]--D[n];
+ if Retour=false:label.llft(TEX(p_),D[n]);fi;
+ fi;
+ if (xpart(C[n])>xpart(O)) and (ypart(C[n])<ypart(O)):
+ D[n]=C[n]+(0.5cm,0);
+ draw C[n]--D[n];
+ if Retour=false:label.lrt(TEX(p_),D[n]);fi;
+ fi;
+ fi;
+ endfor;
+ );
+ ResultatLegende
+ % fi;
+ enddef;
+ vardef AfficheLegendePDF(text t)=
+ picture ResultatLegende;
+ ResultatLegende=image(
+ for p_=t:
+ if string p_:
+ n:=n+1;
+ C[n]=A[n-1] rotatedabout(O,if Inverse:-1* fi(ang[n]-ang[n-1])/2);
+ draw 0.95[O,C[n]]--1.05[O,C[n]];
+ C[n]:=1.05[O,C[n]];
+ Test(n);
+ if (xpart(C[n])>xpart(O)) and (ypart(C[n])>ypart(O)):
+ D[n]=C[n]+(0.5cm,0);
+ draw C[n]--D[n];
+ if Retour=false:label.urt(LATEX(p_),D[n]);fi;
+ fi;
+ if (xpart(C[n])<xpart(O)) and (ypart(C[n])>ypart(O)):
+ D[n]=C[n]-(0.5cm,0);
+ draw C[n]--D[n];
+ if Retour=false:label.ulft(LATEX(p_),D[n]);fi;
+ fi;
+ if (xpart(C[n])<xpart(O)) and (ypart(C[n])<ypart(O)):
+ D[n]=C[n]-(0.5cm,0);
+ draw C[n]--D[n];
+ if Retour=false:label.llft(LATEX(p_),D[n]);fi;
+ fi;
+ if (xpart(C[n])>xpart(O)) and (ypart(C[n])<ypart(O)):
+ D[n]=C[n]+(0.5cm,0);
+ draw C[n]--D[n];
+ if Retour=false:label.lrt(LATEX(p_),D[n]);fi;
+ fi;
+ fi;
+ endfor;
+ );
+ ResultatLegende
+ % fi;
+ enddef;
+}
+
% la construction du graphique qualitatif
\def\NewMPStatCirculaireQ#1#2#3#4{%
%#1 : la liste des données
@@ -852,33 +843,12 @@ Barre=false,Longueur=10cm,Hauteur=5mm,Bicolore=false,EcartBarre=0%Grille est dis
\ifluatex
\mplibforcehmode
\begin{mplibcode}
- Rayon:=\useKV[ClesStat]{Rayon};
- ecarthachures=\useKV[ClesStat]{EcartHachures};
- epaisseurhachures=\useKV[ClesStat]{EpaisseurHachures};
- boolean AffichageAngle;
- AffichageAngle=\useKV[ClesStat]{AffichageAngle};
- boolean AffichageDonnee;
- AffichageDonnee=\useKV[ClesStat]{AffichageDonnee};
- boolean Hachures;
- Hachures=\useKV[ClesStat]{Hachures};
- boolean Inverse;
- Inverse=\useKV[ClesStat]{LectureInverse};
- boolean Legende;
- Legende=\useKV[ClesStat]{Legende};
- boolean LegendeVide;
- LegendeVide=\useKV[ClesStat]{LegendeVide};
- boolean Retour;
- Retour=false;
- boolean ACompleter;
- ACompleter=\useKV[ClesStat]{ACompleter};
- pair A[],O,B[],C[],D[];
- O=(0,0);
- n:=0;
- numeric total[],ang[];
- total[0]=0;
- ang[0]:=0;
- path cc;
- cc=(fullcircle scaled (2*Rayon));
+ \NewMPStatCirculaireCodeQ
+ if Inverse=false:
+ A[0]=point(0) of cc;
+ else:
+ A[0]=point(180) of cc;
+ fi;
% on r\'ecup\`ere les couleurs
color Col[];
n:=0;
@@ -886,11 +856,6 @@ Barre=false,Longueur=10cm,Hauteur=5mm,Bicolore=false,EcartBarre=0%Grille est dis
n:=n+1;
Col[n]=p_;
endfor;
- if Inverse=false:
- A[0]=point(0) of cc;
- else:
- A[0]=point(180) of cc;
- fi;
vardef toto(text t)=
n:=0;
for p_=t:
@@ -989,37 +954,6 @@ Barre=false,Longueur=10cm,Hauteur=5mm,Bicolore=false,EcartBarre=0%Grille est dis
draw (subpath(0,length cc/2) of cc)--cycle if Hachures: withpen pencircle scaled2 fi;;
fi;
n:=0;
- if Legende:
- for p_=t:
- if string p_:
- n:=n+1;
- C[n]=A[n-1] rotatedabout(O,if Inverse:-1* fi(ang[n]-ang[n-1])/2);
- draw 0.95[O,C[n]]--1.05[O,C[n]];
- C[n]:=1.05[O,C[n]];
- Test(n);
- if (xpart(C[n])>xpart(O)) and (ypart(C[n])>ypart(O)):
- D[n]=C[n]+(0.5cm,0);
- draw C[n]--D[n];
- if Retour=false:label.urt(TEX(p_),D[n]);fi;
- fi;
- if (xpart(C[n])<xpart(O)) and (ypart(C[n])>ypart(O)):
- D[n]=C[n]-(0.5cm,0);
- draw C[n]--D[n];
- if Retour=false:label.ulft(TEX(p_),D[n]);fi;
- fi;
- if (xpart(C[n])<xpart(O)) and (ypart(C[n])<ypart(O)):
- D[n]=C[n]-(0.5cm,0);
- draw C[n]--D[n];
- if Retour=false:label.llft(TEX(p_),D[n]);fi;
- fi;
- if (xpart(C[n])>xpart(O)) and (ypart(C[n])<ypart(O)):
- D[n]=C[n]+(0.5cm,0);
- draw C[n]--D[n];
- if Retour=false:label.lrt(TEX(p_),D[n]);fi;
- fi;
- fi;
- endfor;
- fi;
enddef;
vardef Test(expr nb)=
Retour:=false;
@@ -1035,29 +969,13 @@ Barre=false,Longueur=10cm,Hauteur=5mm,Bicolore=false,EcartBarre=0%Grille est dis
enddef;
Figure(-10u,-10u,10u,10u);
toto(#1);
+ if Legende:
+ n:=0;
+ draw AfficheLegende(#1);
+ fi;
\end{mplibcode}
\else
- \begin{mpost}[mpsettings={%
- Rayon:=\useKV[ClesStat]{Rayon};
- ecarthachures=\useKV[ClesStat]{EcartHachures};
- epaisseurhachures=\useKV[ClesStat]{EpaisseurHachures};
- boolean AffichageAngle;
- AffichageAngle=\useKV[ClesStat]{AffichageAngle};
- boolean AffichageDonnee;
- AffichageDonnee=\useKV[ClesStat]{AffichageDonnee};
- boolean Hachures;
- Hachures=\useKV[ClesStat]{Hachures};
- boolean Inverse;
- Inverse=\useKV[ClesStat]{LectureInverse};
- boolean Legende;
- Legende=\useKV[ClesStat]{Legende};
- boolean LegendeVide;
- LegendeVide=\useKV[ClesStat]{LegendeVide};
- boolean ACompleter;
- ACompleter=\useKV[ClesStat]{ACompleter};
- }]
- boolean Retour;
- Retour=false;
+ \begin{mpost}[mpsettings={\NewMPStatCirculaireCodeQ}]
pair A[],O,B[],C[],D[];
O=(0,0);
n:=0;
@@ -1175,40 +1093,6 @@ Barre=false,Longueur=10cm,Hauteur=5mm,Bicolore=false,EcartBarre=0%Grille est dis
else:
draw (subpath(0,length cc/2) of cc)--cycle if Hachures: withpen pencircle scaled2 fi;;
fi;
- n:=0;
- if Legende:
- for p_=t:
- if string p_:
- n:=n+1;
- C[n]=A[n-1] rotatedabout(O,if Inverse:-1* fi(ang[n]-ang[n-1])/2);
- draw 0.95[O,C[n]]--1.05[O,C[n]];
- C[n]:=1.05[O,C[n]];
- Test(n);
- if Retour=false:
- if (xpart(C[n])>xpart(O)) and (ypart(C[n])>ypart(O)):
- D[n]=C[n]+(0.5cm,0);
- draw C[n]--D[n];
- label.urt(LATEX(p_),D[n]);
- fi;
- if (xpart(C[n])<xpart(O)) and (ypart(C[n])>ypart(O)):
- D[n]=C[n]-(0.5cm,0);
- draw C[n]--D[n];
- label.ulft(LATEX(p_),D[n]);
- fi;
- if (xpart(C[n])<xpart(O)) and (ypart(C[n])<ypart(O)):
- D[n]=C[n]-(0.5cm,0);
- draw C[n]--D[n];
- label.llft(LATEX(p_),D[n]);
- fi;
- if (xpart(C[n])>xpart(O)) and (ypart(C[n])<ypart(O)):
- D[n]=C[n]+(0.5cm,0);
- draw C[n]--D[n];
- label.lrt(LATEX(p_),D[n]);
- fi;
- fi;
- fi;
- endfor;
- fi;
enddef;
vardef Test(expr nb)=
Retour:=false;
@@ -1224,6 +1108,10 @@ Barre=false,Longueur=10cm,Hauteur=5mm,Bicolore=false,EcartBarre=0%Grille est dis
enddef;
Figure(-10u,-10u,10u,10u);
toto(#1);
+ if Legende:
+ n:=0;
+ draw AfficheLegendePDF(#1);
+ fi;
\end{mpost}
\fi
}%
diff --git a/macros/latex/contrib/profcollege/latex/PfCTableauxUnites.tex b/macros/latex/contrib/profcollege/latex/PfCTableauxUnites.tex
index 4eaee98489..381e2a8df6 100644
--- a/macros/latex/contrib/profcollege/latex/PfCTableauxUnites.tex
+++ b/macros/latex/contrib/profcollege/latex/PfCTableauxUnites.tex
@@ -1,7 +1,7 @@
%%%
% Tableaux d'unit\'es
%%%
-\setKVdefault[ClesTableaux]{Virgule=true,Incline=false,Entiers=false,Decimaux=false,Milliards=false,Millions=false,Micro=false,Nano=false,Partie=false,CouleurG=gray!15,CouleurM=gray!15,Couleurm=gray!15,Couleuru=gray!15,Couleurd=gray!15,Classes=false,Nombres=false,Puissances=false,NbLignes=2,Metre=false,Are=false,Capacite=false,Carre=false,Cube=false,Litre=false,Gramme=false,Fleches=false,FlechesB=false,FlechesH=false,Colonnes=false,Prefixes=false,Escalier=false,Taille=5,Largeur=4.75em,Nom=PfCTableau,CodeAfter={},PuissancesSeules=false,Colonne=-1,Octet=false}
+\setKVdefault[ClesTableaux]{Virgule=true,Incline=false,Entiers=false,Decimaux=false,Milliards=false,Millions=false,Micro=false,Nano=false,Partie=false,CouleurG=gray!15,CouleurM=gray!15,Couleurm=gray!15,Couleuru=gray!15,Couleurd=gray!15,Classes=false,Nombres=false,Puissances=false,NbLignes=2,Metre=false,Are=false,Capacite=false,Carre=false,Cube=false,Litre=false,Gramme=false,Fleches=false,FlechesB=false,FlechesH=false,Colonnes=false,Prefixes=false,Escalier=false,Taille=5,Largeur=4.75em,Nom=PfCTableau,CodeAfter={},PuissancesSeules=false,Colonne=-1,Octet=false,CouleurGN=white,CadreGN=black}
\newcommand\PfCTBstrut{\rule[-1.2ex]{0pt}{3.8ex}}% Top and Bottom strut
\newcommand\PfCTstrut{\rule{0pt}{3.8ex}}% Top strut
@@ -1025,7 +1025,7 @@
\end{NiceTabular}%
\end{center}%
\setlength{\tabcolsep}{100\tabcolsep}%
- }{}%
+ }{}%
%
%%% Prise en compte de la cl\'e Metre
%
@@ -1386,4 +1386,97 @@
\tikz\draw[out=215,in=-90,-stealth,gray,transform canvas={yshift=-2mm}] (7-|3.5) to node[midway,left]{\footnotesize$\div\num{\PfCCoefConversion}$}(5-|2.5);
\tikz\draw[out=215,in=-90,-stealth,gray,transform canvas={yshift=-2mm}] (5-|2.5) to node[midway,left]{\footnotesize$\div\num{\PfCCoefConversion}$}(3-|1.5);
\end{NiceTabular}%
+}%
+
+%%%
+% Glisse Nombre
+%%%
+\NewDocumentCommand\GlisseNombre{o m}{%
+ \useKVdefault[ClesTableaux]%
+ \setKV[ClesTableaux]{#1}%
+ \colorlet{PfCCouleurFondGN}{\useKV[ClesTableaux]{CouleurGN}}%
+ \colorlet{PfCCouleurCadreGN}{\useKV[ClesTableaux]{CadreGN}}%
+ \xintifboolexpr{\useKV[ClesTableaux]{NbLignes}<10}{\setKV[ClesTableaux]{NbLignes=10}}{}%
+ \ifboolKV[ClesTableaux]{Entiers}{%
+ \colorlet{PfCCouleurA}{\useKV[ClesTableaux]{CouleurG}}%
+ \colorlet{PfCCouleurB}{\useKV[ClesTableaux]{CouleurM}}%
+ \colorlet{PfCCouleurC}{\useKV[ClesTableaux]{CouleurM}}%
+ \colorlet{PfCCouleurD}{\useKV[ClesTableaux]{Couleurm}}%
+ \colorlet{PfCCouleurE}{\useKV[ClesTableaux]{Couleurm}}%
+ \colorlet{PfCCouleurF}{\useKV[ClesTableaux]{Couleuru}}%
+ \setsepchar{,}%
+ \readlist*\PfCNomUnites{Milliards,Centaines\\de millions,Dizaines\\de millions,Millions,Centaines\\de milliers,Dizaines\\de milliers,Milliers,Centaines,Dizaines,Unités}%
+ }{%
+ \colorlet{PfCCouleurA}{\useKV[ClesTableaux]{Couleurm}}%
+ \colorlet{PfCCouleurB}{\useKV[ClesTableaux]{Couleurm}}%
+ \colorlet{PfCCouleurC}{\useKV[ClesTableaux]{Couleuru}}%
+ \colorlet{PfCCouleurD}{\useKV[ClesTableaux]{Couleuru}}%
+ \colorlet{PfCCouleurE}{\useKV[ClesTableaux]{Couleurd}}%
+ \colorlet{PfCCouleurF}{\useKV[ClesTableaux]{Couleurd}}%
+ \setsepchar{,}%
+ \readlist*\PfCNomUnites{Centaines\\de milliers,Dizaines\\de milliers,Milliers,Centaines,Dizaines,Unités,Dixièmes,Centièmes,Millièmes,Dix-millièmes}%
+ }%
+ \begin{center}
+ \fcolorbox{PfCCouleurCadreGN}{PfCCouleurFondGN}{%
+ \begin{minipage}{0.8\linewidth}%
+ \setlength{\tabcolsep}{0.01\tabcolsep}%
+ \begin{center}%
+ \xdef\PfCDerniereColonne{11}%
+ \begin{NiceTabular}{*{6}{wc{30pt}wc{10pt}}*{4}{wc{30pt}wc{10pt}}wc{30pt}}%
+ \CodeBefore%
+ \tikz\draw[draw=black,fill=PfCCouleurA] (1|-5)--(2|-1)--(3|-1)--++(20pt,0)--(2|-5)--cycle;%m->A
+ \tikz\draw[draw=black,fill=PfCCouleurB] (3|-5)--(4|-1)--(5|-1)--++(20pt,0)--(4|-5)--cycle;%m->B
+ \tikz\draw[draw=black,fill=PfCCouleurB] (5|-5)--(6|-1)--(7|-1)--++(20pt,0)--(6|-5)--cycle;%m->B
+ \tikz\draw[draw=black,fill=PfCCouleurC] (7|-5)--(8|-1)--(9|-1)--++(20pt,0)--(8|-5)--cycle;%u->C
+ \tikz\draw[draw=black,fill=PfCCouleurD] (9|-5)--(10|-1)--(11|-1)--++(20pt,0)--(10|-5)--cycle;%u->D
+ \tikz\draw[draw=black,fill=PfCCouleurD] (11|-5)--(12|-1)--(13|-1)--++(20pt,0)--(12|-5)--cycle;%u->D
+ \tikz\draw[draw=black,fill=PfCCouleurE] (13|-5)--(14|-1)--(15|-1)--++(20pt,0)--(14|-5)--cycle;%d->E
+ \tikz\draw[draw=black,fill=PfCCouleurF] (15|-5)--(16|-1)--(17|-1)--++(20pt,0)--(16|-5)--cycle;%d->F
+ \tikz\draw[draw=black,fill=PfCCouleurF] (17|-5)--(18|-1)--(19|-1)--++(20pt,0)--(18|-5)--cycle;%d->F
+ \tikz\draw[draw=black,fill=PfCCouleurF] (19|-5)--(20|-1)--(21|-1)--++(20pt,0)--(20|-5)--cycle;%d->F
+ %
+ \Body
+ %% Pour décaler et laisser la place nécessaire
+ \xintFor* ##1 in {\xintSeq{1}{4}}\do{%
+ &&&&&&&&&&&&&&&&&&&&\\
+ }%
+ %% Lignes vierges
+ \xintFor* ##1 in {\xintSeq{1}{\fpeval{\useKV[ClesTableaux]{NbLignes}-2}}}\do{%
+ &&&&&&&&&&&&&&&&&&&&\\
+ }%
+ &&&&&&&&&&&\ifboolKV[ClesTableaux]{Entiers}{}{\Huge\bfseries ,}&&&&&&&&&\\
+ &&&&&&&&&&&&&&&&&&&&\\
+ \CodeAfter
+ \tikz\draw (last-|1)--(last-|\fpeval{2*\PfCDerniereColonne-2});
+ \xintFor* ##1 in {\xintSeq{1}{\fpeval{2*\PfCDerniereColonne-2}}}\do{%
+ \tikz\draw[dashed] (5-|##1)--(\fpeval{5+\useKV[ClesTableaux]{NbLignes}}-|##1);%
+ \tikz\draw (5-|##1)--(\fpeval{7}-|##1);%
+ \tikz\draw (\fpeval{5+\useKV[ClesTableaux]{NbLignes}}-|##1)--(\fpeval{3+\useKV[ClesTableaux]{NbLignes}}-|##1);%
+ }%
+ %
+ \tikz\node[rotate=60] at (2|-3) {\begin{minipage}{60pt}\begin{center}\scriptsize \PfCNomUnites[1]\end{center}\end{minipage}};%
+ \tikz\node[rotate=60] at (4|-3) {\begin{minipage}{60pt}\begin{center}\scriptsize \PfCNomUnites[2]\end{center}\end{minipage}};%
+ \tikz\node[rotate=60] at (6|-3) {\begin{minipage}{60pt}\begin{center}\scriptsize \PfCNomUnites[3]\end{center}\end{minipage}};%
+ \tikz\node[rotate=60] at (8|-3) {\begin{minipage}{60pt}\begin{center}\scriptsize \PfCNomUnites[4]\end{center}\end{minipage}};%
+ \tikz\node[rotate=60] at (10|-3) {\begin{minipage}{60pt}\begin{center}\scriptsize \PfCNomUnites[5]\end{center}\end{minipage}};%
+ \tikz\node[rotate=60] at (12|-3) {\begin{minipage}{60pt}\begin{center}\scriptsize \PfCNomUnites[6]\end{center}\end{minipage}};%
+ \tikz\node[rotate=60] at (14|-3) {\begin{minipage}{60pt}\begin{center}\scriptsize \PfCNomUnites[7]\end{center}\end{minipage}};%
+ \tikz\node[rotate=60] at (16|-3) {\begin{minipage}{60pt}\begin{center}\scriptsize \PfCNomUnites[8]\end{center}\end{minipage}};%
+ \tikz\node[rotate=60] at (18|-3) {\begin{minipage}{60pt}\begin{center}\scriptsize \PfCNomUnites[9]\end{center}\end{minipage}};%
+ \tikz\node[rotate=60] at (20|-3) {\begin{minipage}{60pt}\begin{center}\scriptsize \PfCNomUnites[10]\end{center}\end{minipage}};%
+ \end{NiceTabular}%
+ \end{center}%
+ \setlength{\tabcolsep}{100\tabcolsep}%
+ \end{minipage}%
+ }%
+ \end{center}
+ \begin{center}
+ \begin{NiceTabular}{m{0.97\linewidth}}%
+ \xintFor* ##1 in{\xintSeq{1}{\fpeval{\useKV[ClesTableaux]{NbLignes}-4}}}\do{%
+ \Block[fill=PfCCouleurFondGN]{}{\phantom{A}}\\
+ }%
+ \CodeAfter%
+ \tikz\draw (1-|1) rectangle (last-|last);%
+ \end{NiceTabular}
+ \end{center}
}% \ No newline at end of file
diff --git a/macros/latex/contrib/profcollege/latex/PfCTortueBase.tex b/macros/latex/contrib/profcollege/latex/PfCTortueBase.tex
index e5f99c7f4a..949c781ce7 100644
--- a/macros/latex/contrib/profcollege/latex/PfCTortueBase.tex
+++ b/macros/latex/contrib/profcollege/latex/PfCTortueBase.tex
@@ -6,6 +6,7 @@
Etapes=false,%Pour arrêter la construction à une étape particulière
Nom=\jobname,%Pour la sauvegarde du fichier mp
Grille=false,%Pour faire apparaître une grille
+ Couleur=black,%Couleur du tracé
LargeurG=10,%Largeur Grille
HauteurG=10,%Hauteur Grille
TortueD=false,%Affiche la tortue au départ
@@ -194,7 +195,7 @@
\mplibforcehmode
\begin{mplibcode}
input PfCTurtleTestRemplis.mp;
-
+ drawoptions(withcolor \useKV[Tortue]{Couleur});
pair Depart;
Depart=\useKV[Tortue]{Depart} if \useKV[Tortue]{Cases}:+(15,15)fi;
pair A[],B[];
diff --git a/macros/latex/contrib/profcollege/latex/PfCVueCubes.tex b/macros/latex/contrib/profcollege/latex/PfCVueCubes.tex
index 5afdcfecaa..91f90c96d2 100644
--- a/macros/latex/contrib/profcollege/latex/PfCVueCubes.tex
+++ b/macros/latex/contrib/profcollege/latex/PfCVueCubes.tex
@@ -161,8 +161,6 @@
draw Projette((k/Hauteur)[Adg0,Adg3])--Projette((k/Hauteur)[Adg1,Adg2]);
endfor;
fi;
-
- %draw (llcorner currentpicture)--(lrcorner currentpicture)--(urcorner currentpicture)--(ulcorner currentpicture)--cycle;
\end{mplibcode}
\ifboolKV[VueCubes]{Grilles}{}{%
\hspace*{1.5cm}
diff --git a/macros/latex/contrib/profcollege/latex/ProfCollege.sty b/macros/latex/contrib/profcollege/latex/ProfCollege.sty
index 1b4f7c5a7b..80dca0a8df 100644
--- a/macros/latex/contrib/profcollege/latex/ProfCollege.sty
+++ b/macros/latex/contrib/profcollege/latex/ProfCollege.sty
@@ -2,9 +2,9 @@
% licence : Released under the LaTeX Project Public License v1.3c
% or later, see http://www.latex-project.org/lppl.txtf
\NeedsTeXFormat{LaTeX2e}%
-\def\filedate{2023/04/17}%
+\def\filedate{2023/05/01}%
\let\PfCfiledate\filedate%
-\def\fileversion{0.99-z-j}%
+\def\fileversion{0.99-z-k}%
\let\PfCfileversion\fileversion%
\ProvidesPackage{ProfCollege}[\filedate\space v\fileversion\space Aide pour utiliser LaTeX au college]%
@@ -569,7 +569,7 @@
}%\emoticon
}%\raisebox
}
-
+\input{PfCPavage}
\input{PfCNonogramme}
\input{PfCJeuRangement}
\input{PfCTrio}
diff --git a/macros/latex/contrib/profcollege/metapost/PfCConstantes.mp b/macros/latex/contrib/profcollege/metapost/PfCConstantes.mp
index 02895dcf8c..bdef5781f1 100644
--- a/macros/latex/contrib/profcollege/metapost/PfCConstantes.mp
+++ b/macros/latex/contrib/profcollege/metapost/PfCConstantes.mp
@@ -18,3 +18,19 @@ orangevif=(1,0.25,0.1);
vert=(0,1,0);
jaune=rouge+vert;
gris=0.8*white;
+
+%coloriage et lumière
+vardef Hsv(expr CC)=%CC couleur donnée en hsv d'après http://en.wikipedia.org/wiki/HSL_color_space
+ save $;
+ color $;
+ SSw:=floor(redpart(CC)/60);
+ SSh:=SSw mod 6;
+ SSf:=(redpart(CC)/60)-floor(SSw);
+ SSs:=greenpart((CC));
+ SSv:=bluepart((CC));
+ SSp:=SSv*(1-SSs);
+ SSq:=SSv*(1-SSf*SSs);
+ SSt:=SSv*(1-(1-SSf)*SSs);
+ if SSh=0: $=(SSv,SSt,SSp) elseif SSh=1:$=(SSq,SSv,SSp) elseif SSh=2:$=(SSp,SSv,SSt) elseif SSh=3:$=(SSp,SSq,SSv) elseif SSh=4:$=(SSt,SSp,SSv) elseif SSh=5:$=(SSv,SSp,SSq) fi;
+ $
+enddef;
diff --git a/macros/latex/contrib/profcollege/metapost/PfCScratch.mp b/macros/latex/contrib/profcollege/metapost/PfCScratch.mp
index 3c6826777a..b3edc8af1f 100644
--- a/macros/latex/contrib/profcollege/metapost/PfCScratch.mp
+++ b/macros/latex/contrib/profcollege/metapost/PfCScratch.mp
@@ -14,6 +14,7 @@ pair _coinnum;%milieu côté gauche pour placer la numérotation des lignes
numeric Nblignes; Nblignes:=1;
pair DebutListe; DebutListe=(0,0);
boolean NumeroteLignes; NumeroteLignes=false;
+boolean NumeroteFinBloc; NumeroteFinBloc=false;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% couleurs
color CoulLignes; CoulLignes:=black;
@@ -1711,6 +1712,10 @@ $=image(
_coinprec:=(llcorner $);
_coinprec:=_coinprec+(0,eb);
numblocrep:=numblocrep-1;
+if NumeroteFinBloc=true:
+ label(TEX("\footnotesize"&decimal(Nblignes)&""),_coinprec+(-3*eb,2*eb));
+ Nblignes:=Nblignes+1;
+fi;
$
enddef;
diff --git a/macros/latex/contrib/srdp-mathematik/README.md b/macros/latex/contrib/srdp-mathematik/README.md
index 2d3d4ee7a5..e66f6b3f8c 100644
--- a/macros/latex/contrib/srdp-mathematik/README.md
+++ b/macros/latex/contrib/srdp-mathematik/README.md
@@ -1,4 +1,4 @@
-# srdp-mathematik.sty v1.11.0
+# srdp-mathematik.sty v1.12.0
This package provides basic commands for the defined formats of the Austrian sRDP in mathematics.
Furthermore, it includes ways to implement answers in the tex file, which can be voluntarily displayed in the pdf file and
diff --git a/macros/latex/contrib/srdp-mathematik/srdp-mathematik.pdf b/macros/latex/contrib/srdp-mathematik/srdp-mathematik.pdf
index d58f360d39..9fc554aeb0 100644
--- a/macros/latex/contrib/srdp-mathematik/srdp-mathematik.pdf
+++ b/macros/latex/contrib/srdp-mathematik/srdp-mathematik.pdf
Binary files differ
diff --git a/macros/latex/contrib/srdp-mathematik/srdp-mathematik.sty b/macros/latex/contrib/srdp-mathematik/srdp-mathematik.sty
index 7b1238730c..163e7b57df 100644
--- a/macros/latex/contrib/srdp-mathematik/srdp-mathematik.sty
+++ b/macros/latex/contrib/srdp-mathematik/srdp-mathematik.sty
@@ -10,7 +10,7 @@
%
\NeedsTeXFormat{LaTeX2e}[1996/12/26]
-\ProvidesPackage{srdp-mathematik}[2022/12/16 v1.11.0 Standard-Schularbeitsformate]
+\ProvidesPackage{srdp-mathematik}[2023/05/01 v1.12.0 Standard-Schularbeitsformate]
\usepackage{color}
@@ -86,6 +86,7 @@
\newcounter{info}
\newcounter{marker}
\DeclareOption{solution_on}{\setcounter{Antworten}{1}}
+\DeclareOption{solution_minimal}{\setcounter{Antworten}{1}}
\DeclareOption{solution_off}{\setcounter{Antworten}{0}}
\DeclareOption{info_on}{\setcounter{info}{1}}
\DeclareOption{info_off}{\setcounter{info}{0}}
@@ -229,21 +230,28 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcounter{number}
+\newcounter{counterhalfpoints}
\newcommand*\rfrac[2]{{}^{#1}\!/_{#2}}
\makeatletter
+
\def\addifisinteger#1{%
\sbox\z@{\@tempcnta=0#1\relax}%
\expandafter\ifdim\wd\z@>\z@\relax
- {}\else
+ \IfEndWith{#1}{.5}{\addtocounter{punkte}{\fpeval{trunc(#1,0)}}\stepcounter{counterhalfpoints}}{\PackageError{srdp-mathemathik}{Points must be integers or ".5"}{Only numbers are allowed as input. Decimal point must be "." not ","}}\else
\addtocounter{punkte}{#1}\fi}
-\makeatother
-\makeatletter
\def\checkifinteger#1#2{%
\sbox\z@{\@tempcnta=0#1\relax}%
\expandafter\ifdim\wd\z@>\z@\relax
\scriptsize$\rfrac{#2}{2}$\small\else#1\fi}
+
+\def\dottocomma#1{%
+\sbox\z@{\@tempcnta=0#1\relax}%
+\expandafter\ifdim\wd\z@>\z@\relax
+\begingroup\def\@tempa##1.##2\@nil{##1,\ifx\relax##2\relax\else##2\fi}%
+\@tempa#1\@nil
+\endgroup\else#1\fi}
\makeatother
\NewEnviron{beispiel}[2][\unskip]{\FPeval{\halbepunkte}{clip(#2/2)}%
@@ -255,7 +263,7 @@
\end{minipage}
- \begin{minipage}[t]{0.11\textwidth} \raggedleft \small{\_\_\_/\ifthenelse{\equal{#1}{\string 1/2}}{\checkifinteger{\halbepunkte}{#2}/}{\ifthenelse{\equal{#1}{\string 1}}{1/}{}}#2\addifisinteger{#2}\\
+ \begin{minipage}[t]{0.11\textwidth} \raggedleft \small{\_\_\_/\ifthenelse{\equal{#1}{\string 1/2}}{\checkifinteger{\halbepunkte}{#2}/}{\ifthenelse{\equal{#1}{\string 1}}{1/}{}}\dottocomma{#2}\addifisinteger{#2}\\
\ifthenelse{\equal{#1}{\string 1/2}}{}{\antwort{\footnotesize #1 \normalsize}}}
\end{minipage}
\vspace{\baselineskip}
@@ -306,9 +314,9 @@
\rightmargin.12\textwidth
\def\makelabel##1{\stepcounter{number}%
\hss\llap{\thenumber.}%
- \addtocounter{punkte}{##1}%
- \rlap{\kern\dimexpr\textwidth-\leftmargin
- \llap{\small\_\_\_/##1}}}}%
+ \addifisinteger{##1}%
+ \rlap{\kern\dimexpr\textwidth-\leftmargin+6pt
+ \llap{\small\_\_\_/\dottocomma{##1}}}}}%
}
{\endlist}
@@ -400,14 +408,14 @@
%%%%%%%%%%%% NOTENSCHLUESSEL %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%
-
-\NewDocumentCommand{\notenschluessel}{ O{} O{} O{} m m m m}{
+\newcounter{temporarygesamtpunkte}
+\NewDocumentCommand{\notenschluessel}{ O{} O{} O{} m m m m}{\ifthenelse{\isodd{\thecounterhalfpoints}}{\setcounter{temporarygesamtpunkte}{\numexpr\thepunkte+(\thecounterhalfpoints-1)/2\relax}}{\setcounter{temporarygesamtpunkte}{\numexpr\thepunkte+\thecounterhalfpoints/2\relax}}%
\null\vfill
\STautoround{3}\renewcommand{\arraystretch}{0}\tiny
\begin{spreadtab}[\STsavecell\gutgenau{b2} \STsavecell\befriedigendgenau{c2} \STsavecell\genuegendgenau{d2} \STsavecell\nichtgenuegendgenau{e2}
\STsavecell\gut{b3} \STsavecell\befriedigend{c3} \STsavecell\genuegend{d3} \STsavecell\nichtgenuegend{e3}
\STsavecell\gutpluseins{b4} \STsavecell\befriedigendpluseins{c4} \STsavecell\genuegendpluseins{d4} \STsavecell\nichtgenuegendpluseins{e4} \STsavecell\gutminuseins{b5} \STsavecell\befriedigendminuseins{c5} \STsavecell\genuegendminuseins{d5} \STsavecell\nichtgenuegendminuseins{e5}]{{tabular}{ccccc}}
- \SThidecol\thepunkte &\SThidecol 1 &\SThidecol2 &\SThidecol 3 &\SThidecol 4 \\
+ \SThidecol \thetemporarygesamtpunkte &\SThidecol 1 &\SThidecol2 &\SThidecol 3 &\SThidecol 4 \\
& a1*#4 &a1*#5 & a1*#6 & a1*#7 \\
&trunc(a1*#4,0) & trunc(a1*#5,0) &trunc(a1*#6,0) &trunc(a1*#7,0) \\
&b3+1 &c3+1 &d3+1 & e3+1\\
@@ -418,31 +426,31 @@
\begin{tabular}{|C{3cm}C{3cm}C{3cm}C{3cm}C{3cm}|} \hline
\ifthenelse{\equal{#2}{prozent}}{%
Erreichte Punkte & Prozent & Gesamt & \multicolumn{2}{c|}{Note} \\
-&& \multirow{2}{*}{\thepunkte} && \\%
+&& \multirow{2}{*}{\ifthenelse{\isodd{\thecounterhalfpoints}}{\thetemporarygesamtpunkte ,5}{\thetemporarygesamtpunkte}} && \\%
}{%
Erreichte Punkte &Gesamt&\multicolumn{2}{c}{Note}& \\
-&\multirow{2}{*}{\thepunkte} &&& \\}
+&\multirow{2}{*}{\ifthenelse{\isodd{\thecounterhalfpoints}}{\thetemporarygesamtpunkte ,5}{\thetemporarygesamtpunkte}} &&& \\}
&&&& \\ \hline \hline
\ifthenelse{\equal{#3}{ms}}{}{\scriptsize{Sehr gut}} & \ifthenelse{\equal{#3}{ms}}{}{\scriptsize{Gut}} & \scriptsize{Befriedigend} & \scriptsize{Gen\"ugend} & \scriptsize{Nicht gen\"ugend} \\
-\ifthenelse{\equal{#3}{ms}}{}{\scriptsize{\thepunkte\ ~-~ \ifdim\gut pt=\gutgenau pt \gut\else\gutpluseins\fi}}& \ifthenelse{\equal{#3}{ms}}{}{\scriptsize{\ifdim\gut pt=\gutgenau pt \gutminuseins\else\gut\fi \ifthenelse{\equal{#1}{1/2}}{,5}{} ~-~ \ifdim\befriedigend pt=\befriedigendgenau pt \befriedigend\else\befriedigendpluseins\fi}} & \scriptsize{\ifdim\befriedigend pt=\befriedigendgenau pt \befriedigendminuseins\else\befriedigend\fi \ifthenelse{\equal{#1}{1/2}}{,5}{} ~-~ \ifdim\genuegend pt=\genuegendgenau pt \genuegend\else\genuegendpluseins\fi} & \scriptsize{\ifdim\genuegend pt=\genuegendgenau pt \genuegendminuseins\else\genuegend\fi \ifthenelse{\equal{#1}{1/2}}{,5}{} ~-~ \ifdim\nichtgenuegend pt=\nichtgenuegendgenau pt \nichtgenuegend\else\nichtgenuegendpluseins\fi} & \scriptsize{unter \ifdim\nichtgenuegend pt=\nichtgenuegendgenau pt \nichtgenuegend\else\nichtgenuegendpluseins\fi} \\ \hline
+\ifthenelse{\equal{#3}{ms}}{}{\scriptsize{\ifthenelse{\isodd{\thecounterhalfpoints}}{\thetemporarygesamtpunkte ,5}{\thetemporarygesamtpunkte} ~-~ \ifdim\gut pt=\gutgenau pt \gut\else\gutpluseins\fi}}& \ifthenelse{\equal{#3}{ms}}{}{\scriptsize{\ifdim\gut pt=\gutgenau pt \gutminuseins\else\gut\fi \ifthenelse{\equal{#1}{1/2}}{,5}{} ~-~ \ifdim\befriedigend pt=\befriedigendgenau pt \befriedigend\else\befriedigendpluseins\fi}} & \scriptsize{\ifdim\befriedigend pt=\befriedigendgenau pt \befriedigendminuseins\else\befriedigend\fi \ifthenelse{\equal{#1}{1/2}}{,5}{} ~-~ \ifdim\genuegend pt=\genuegendgenau pt \genuegend\else\genuegendpluseins\fi} & \scriptsize{\ifdim\genuegend pt=\genuegendgenau pt \genuegendminuseins\else\genuegend\fi \ifthenelse{\equal{#1}{1/2}}{,5}{} ~-~ \ifdim\nichtgenuegend pt=\nichtgenuegendgenau pt \nichtgenuegend\else\nichtgenuegendpluseins\fi} & \scriptsize{unter \ifdim\nichtgenuegend pt=\nichtgenuegendgenau pt \nichtgenuegend\else\nichtgenuegendpluseins\fi} \\ \hline
\end{tabular}
\end{center}\STautoround{}\normalsize}
-\NewDocumentCommand{\individualnotenschluessel}{ O{} O{} m m m m m m m}{
+\NewDocumentCommand{\individualnotenschluessel}{ O{} O{} m m m m m m m}{\ifthenelse{\isodd{\thecounterhalfpoints}}{\setcounter{temporarygesamtpunkte}{\numexpr\thepunkte+(\thecounterhalfpoints-1)/2\relax}}{\setcounter{temporarygesamtpunkte}{\numexpr\thepunkte+\thecounterhalfpoints/2\relax}}%
\null\vfill
\footnotesize\renewcommand{\arraystretch}{1}
\begin{center}
\begin{tabular}{|C{3cm}C{3cm}C{3cm}C{3cm}C{3cm}|} \hline
\ifthenelse{\equal{#2}{prozent}}{%
Erreichte Punkte & Prozent & Gesamt & \multicolumn{2}{c|}{Note} \\
-&& \multirow{2}{*}{\ifthenelse{\equal{#1}{}}{\thepunkte}{#1}} && \\%
+&& \multirow{2}{*}{\ifthenelse{\equal{#1}{}}{\ifthenelse{\isodd{\thecounterhalfpoints}}{\thetemporarygesamtpunkte ,5}{\thetemporarygesamtpunkte}}{#1}} && \\%
}{%
Erreichte Punkte &Gesamt&\multicolumn{2}{c}{Note}& \\
-&\multirow{2}{*}{\ifthenelse{\equal{#1}{}}{\thepunkte}{#1}} &&& \\}
+&\multirow{2}{*}{\ifthenelse{\equal{#1}{}}{\ifthenelse{\isodd{\thecounterhalfpoints}}{\thetemporarygesamtpunkte ,5}{\thetemporarygesamtpunkte}}{#1}} &&& \\}
&&&& \\ \hline \hline
\scriptsize{Sehr gut} & \scriptsize{Gut} & \scriptsize{Befriedigend} & \scriptsize{Gen\"ugend} & \scriptsize{Nicht gen\"ugend} \\
-\scriptsize{\ifthenelse{\equal{#1}{}}{\thepunkte\ }{#1} ~-~ #3}& \scriptsize{#4 ~-~ #5} & \scriptsize{#6 ~-~ #7} & \scriptsize{#8 ~-~ #9} & \scriptsize{unter #9} \\ \hline
+\scriptsize{\ifthenelse{\equal{#1}{}}{\ifthenelse{\isodd{\thecounterhalfpoints}}{\thetemporarygesamtpunkte ,5}{\thetemporarygesamtpunkte} }{#1} ~-~ #3}& \scriptsize{#4 ~-~ #5} & \scriptsize{#6 ~-~ #7} & \scriptsize{#8 ~-~ #9} & \scriptsize{unter #9} \\ \hline
\end{tabular}
\end{center}\normalsize}
diff --git a/macros/latex/contrib/srdp-mathematik/srdp-mathematik.tex b/macros/latex/contrib/srdp-mathematik/srdp-mathematik.tex
index e82cc7b51e..9d95549765 100644
--- a/macros/latex/contrib/srdp-mathematik/srdp-mathematik.tex
+++ b/macros/latex/contrib/srdp-mathematik/srdp-mathematik.tex
@@ -55,7 +55,7 @@ hidelinks
\vfill
-\Huge The \textit{srdp-mathematik} package v1.11.0\\[1cm]
+\Huge The \textit{srdp-mathematik} package v1.12.0\\[1cm]
Documentation \\ [1cm]
@@ -92,7 +92,7 @@ Die \textit{allgemeinen Befehle} erleichtern das Erstellen von Tests, Schularbei
\subsection{Beispielumgebungen}
-Jedes Beispiel sollte innerhalb einer Beispielumgebung gesetzt werden, welche bei der Formatierung und der Verarbeitung der Punkte unterstützt. Dabei werden zwei Beispiel-Typen unterschieden: \texttt{beispiel} und \texttt{langesbeispiel}.
+Jedes Beispiel sollte innerhalb einer Beispielumgebung gesetzt werden, welche bei der Formatierung und der Verarbeitung der Punkte unterstützt. Als Punkte sind natürliche Zahlen sowie halbe Punkte (z.B.: 3.5) möglich. Dabei werden zwei Beispiel-Typen unterschieden: \texttt{beispiel} und \texttt{langesbeispiel}.
\vspace{1cm}
\subsubsection{\texttt{\textbackslash begin\{beispiel\} \ldots\ \textbackslash end\{beispiel\}}}
@@ -300,9 +300,9 @@ Analog zum individuellen Notenschlüssel kann auch das Beurteilungsschema belieb
\newpage
-\subsection{Paketoption -- Lösungseingabe: \texttt{[solution\_on/off]}}
+\subsection{Paketoption -- Lösungseingabe: \texttt{[solution\_on/off/minimal]}}
-Es besteht die Möglichkeit, die Lösung in der erstellten \texttt{tex}-Datei zu implementieren und diese bei Bedarf in der \texttt{PDF}-Datei ein- bzw. auszublenden. Um diese Funktion nutzen zu können, muss die \texttt{solution\_on/off} Option im \texttt{srdp-mathematik}-Paket geladen werden. Diese kann durch hinzufügen durch "`\texttt{solution\_on}"' bzw. "`\texttt{solution\_off}"' aktiviert bzw. deaktiviert werden. Also:
+Es besteht die Möglichkeit, die Lösung in der erstellten \texttt{tex}-Datei zu implementieren und diese bei Bedarf in der \texttt{PDF}-Datei ein- bzw. auszublenden. Um diese Funktion nutzen zu können, muss die \texttt{solution\_on/off/minimal} Option im \texttt{srdp-mathematik}-Paket geladen werden. Diese kann durch hinzufügen durch "`\texttt{solution\_on}"' bzw. "`\texttt{solution\_off}"' aktiviert bzw. deaktiviert werden. Also:
\begin{verbatim}
\usepackage[solution_on]{srdp-mathematik}
@@ -314,6 +314,7 @@ oder
\usepackage[solution_off]{srdp-mathematik}
\end{verbatim}
+Die Option "`\texttt{solution\_minimal}"' zeigt zwar alle Lösungen an, jedoch wird die deutliche Markierung der Lösungsanzeige nicht dargestellt.\leer
Die korrekte Lösungseingabe der vorformatierten Typ-1-Aufgaben wird bei den entsprechenden Befehlen direkt erklärt. Unabhängig davon, gibt es die Möglichkeit mithilfe des \texttt{antwort}-Befehls, beliebige Abschnitte als \textit{Antwort} zu deklarieren. (verwendeter counter: \texttt{Antworten=0, 1})