diff options
author | Norbert Preining <norbert@preining.info> | 2023-10-09 03:05:28 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2023-10-09 03:05:28 +0000 |
commit | 55c62aa6d5cc8ce94c28ac255b66a13ccd2375b2 (patch) | |
tree | 1b5eb4f2e66d4ee007cac50ea4d0f34c11cda50f /macros/latex/contrib | |
parent | 9f6bac4b7884af8d5a457275e30fc5e253ff9de8 (diff) |
CTAN sync 202310090305
Diffstat (limited to 'macros/latex/contrib')
54 files changed, 3759 insertions, 688 deletions
diff --git a/macros/latex/contrib/msu-thesis/README.md b/macros/latex/contrib/msu-thesis/README.md index 795023cc56..13a939dc53 100644 --- a/macros/latex/contrib/msu-thesis/README.md +++ b/macros/latex/contrib/msu-thesis/README.md @@ -1,4 +1,4 @@ -# MSU Thesis Class Version 4.1g 2023/08/12 +# MSU Thesis Class Version 4.1h 2023/10/07 Copyright 2011-2023 by Alan Munn <amunn@msu.edu> diff --git a/macros/latex/contrib/msu-thesis/docs/msu-thesis.tex b/macros/latex/contrib/msu-thesis/docs/msu-thesis.tex index 585e805657..98f76d3c07 100644 --- a/macros/latex/contrib/msu-thesis/docs/msu-thesis.tex +++ b/macros/latex/contrib/msu-thesis/docs/msu-thesis.tex @@ -2,8 +2,8 @@ \documentclass[11pt]{article} -\def\msuversion{4.1g} -\def\msudate{2023/08/12} +\def\msuversion{4.1h} +\def\msudate{2023/10/07} \title{\textbf{Using the MSU Thesis Class}} \author{\textbf{Alan Munn}\\Department of Linguistics, Languages, and Cultures\\Michigan State University\\\texttt{\href{mailto:amunn@msu.edu}{amunn@msu.edu}}} \date{Version \msuversion\\\msudate} diff --git a/macros/latex/contrib/msu-thesis/msu-thesis.cls b/macros/latex/contrib/msu-thesis/msu-thesis.cls index b6ff7192f3..f77d580788 100644 --- a/macros/latex/contrib/msu-thesis/msu-thesis.cls +++ b/macros/latex/contrib/msu-thesis/msu-thesis.cls @@ -189,13 +189,51 @@ % Version 4.1e 2023/07/24 Fixed per chapter appendices TOC bug; % Version 4.1f 2023/07/28 Fixed title page spacing issue % Version 4.1g 2023/08/12 Per chapter appendices and bibliography TOC issue -% +% Version 4.1h 2023/10/07 Changed option processing code % Report bugs/problems/questions to <amunn@msu.edu> % -\def\msu@version{4.1g} -\def\msu@date{2023/08/12} +\def\msu@version{4.1h} +\def\msu@date{2023/10/07} \NeedsTeXFormat{LaTeX2e} \ProvidesClass{msu-thesis}[\msu@date\space Michigan State University Thesis Class version \msu@version] +\DeclareKeys[msu-thesis] +{ +PhD.code = {\gdef\msu@degree{Doctor of Philosophy}}, +DEd.code = {\gdef\msu@degree{Doctor of Education}}, +DMA.code = {\gdef\msu@degree{Doctor of Musical Arts}}, +DNP.code = {\gdef\msu@degree{Doctor of Nursing Practice}}, +MA.code = {\gdef\msu@degree{Master of Arts}\global\msu@dissertationfalse}, +MS.code = {\gdef\msu@degree{Master of Science}\global\msu@dissertationfalse}, +MAT.code = {\gdef\msu@degree{Master of Arts for Teachers}\global\msu@dissertationfalse}, +MBA.code = {\gdef\msu@degree{Master of Business Administration}\global\msu@dissertationfalse}, +MFA.code = {\gdef\msu@degree{Master of Fine Arts}\global\msu@dissertationfalse}, +MIPS.code = {\gdef\msu@degree{Master of International Planning Studies}\global\msu@dissertationfalse}, +MHRL.code = {\gdef\msu@degree{Master of Human Resources and Labor Relations}\global\msu@dissertationfalse}, +MMus.code = {\gdef\msu@degree{Master of Music}\global\msu@dissertationfalse}, +%MSN.code = {\gdef\msu@degree{Master of Science in Nursing}\global\msu@dissertationfalse}, +MPH.code = {\gdef\msu@degree{Master of Public Health}\global\msu@dissertationfalse}, +MPP.code = {\gdef\msu@degree{Master of Public Policy}\global\msu@dissertationfalse}, +MSW.code = {\gdef\msu@degree{Master of Social Work}\global\msu@dissertationfalse}, +MURP.code = {\gdef\msu@degree{Master in Urban and Regional Planning}\global\msu@dissertationfalse}, +lscape.code = {% +\msu@lscapetrue +\AtEndDocument{\ClassWarningNoLine{msu-thesis}{You have chosen the [lscape] option. You may need to run latex twice to get landscape page numbering to display correctly}}}, +boldtoc.code = {\msu@stupidtoctrue\msu@plaintocfalse\msu@mixedtocfalse}, +plaintoc.code = {\msu@plaintoctrue\msu@stupidtocfalse\msu@mixedtocfalse}, +mixedtoc.code = {\msu@mixedtoctrue\msu@stupidtocfalse\msu@plaintocfalse}, +chapterbib.code = {\global\msu@chapterbibtrue\def\msu@bibtype{CHAPBIB}}, % per-chapter bibliographies added v3.0 +bibassection.code = {\def\msu@bibsection{section}}, % per-chapter bibs as sections in TOC +chapterapp.code = { + \global\msu@chapterapptrue + \def\msu@apptype{CHAPAPP} + % per-chapter appendices added v3.0 + \renewcommand\msuappendixnumformat{\the@ppsavesec\Alph{chapter}} % Appendix numbers per-chapter (now permitted) +}, +12pt.code = {\def\msu@sizeoption{12pt}}, % added v2.9 +11pt.code = {\def\msu@sizeoption{11pt}}, +10pt.code = {\def\msu@sizeoption{10pt}} +} + \newif\ifmsu@dissertation\msu@dissertationtrue % added v2.7 boolean for \msu@thesistype \newif\ifmsu@chapterbib\msu@chapterbibfalse % added v3.0 \def\msu@bibtype{BIB} @@ -210,42 +248,9 @@ \newif\ifmsu@colonintoc\msu@colonintocfalse \newif\ifmsu@hyperloaded\msu@hyperloadedfalse \newif\ifmsu@dualmajor\msu@dualmajorfalse -\DeclareOption{PhD}{\gdef\msu@degree{Doctor of Philosophy}} -\DeclareOption{DEd}{\gdef\msu@degree{Doctor of Education}} -\DeclareOption{DMA}{\gdef\msu@degree{Doctor of Musical Arts}} -\DeclareOption{DNP}{\gdef\msu@degree{Doctor of Nursing Practice}} -\DeclareOption{MA}{\gdef\msu@degree{Master of Arts}\global\msu@dissertationfalse} -\DeclareOption{MS}{\gdef\msu@degree{Master of Science}\global\msu@dissertationfalse} -\DeclareOption{MAT}{\gdef\msu@degree{Master of Arts for Teachers}\global\msu@dissertationfalse} -\DeclareOption{MBA}{\gdef\msu@degree{Master of Business Administration}\global\msu@dissertationfalse} -\DeclareOption{MFA}{\gdef\msu@degree{Master of Fine Arts}\global\msu@dissertationfalse} -\DeclareOption{MIPS}{\gdef\msu@degree{Master of International Planning Studies}\global\msu@dissertationfalse} -\DeclareOption{MHRL}{\gdef\msu@degree{Master of Human Resources and Labor Relations}\global\msu@dissertationfalse} -\DeclareOption{MMus}{\gdef\msu@degree{Master of Music}\global\msu@dissertationfalse} -%\DeclareOption{MSN}{\gdef\msu@degree{Master of Science in Nursing}\global\msu@dissertationfalse} -\DeclareOption{MPH}{\gdef\msu@degree{Master of Public Health}\global\msu@dissertationfalse} -\DeclareOption{MPP}{\gdef\msu@degree{Master of Public Policy}\global\msu@dissertationfalse} -\DeclareOption{MSW}{\gdef\msu@degree{Master of Social Work}\global\msu@dissertationfalse} -\DeclareOption{MURP}{\gdef\msu@degree{Master in Urban and Regional Planning}\global\msu@dissertationfalse} -\DeclareOption{lscape}{% -\msu@lscapetrue -\AtEndDocument{\ClassWarningNoLine{msu-thesis}{You have chosen the [lscape] option. You may need to run latex twice to get landscape page numbering to display correctly}}} -\DeclareOption{boldtoc}{\msu@stupidtoctrue\msu@plaintocfalse\msu@mixedtocfalse} -\DeclareOption{plaintoc}{\msu@plaintoctrue\msu@stupidtocfalse\msu@mixedtocfalse} -\DeclareOption{mixedtoc}{\msu@mixedtoctrue\msu@stupidtocfalse\msu@plaintocfalse} -\DeclareOption{chapterbib}{\global\msu@chapterbibtrue\def\msu@bibtype{CHAPBIB}} % per-chapter bibliographies added v3.0 \newcommand*\msu@bibsection{chapter} % per-chapter bibliographies like chapters in TOC -\DeclareOption{bibassection}{\def\msu@bibsection{section}} % per-chapter bibs as sections in TOC -\DeclareOption{chapterapp}{ - \global\msu@chapterapptrue - \def\msu@apptype{APPENDICES} - % per-chapter appendices added v3.0 - \renewcommand\msuappendixnumformat{\ifmsu@singleappendix\else\Alph{chapter}\fi} % Appendix numbers per-chapter not permitted as of v4 -} -\DeclareOption{12pt}{\def\msu@sizeoption{12pt}} % added v2.9 -\DeclareOption{11pt}{\def\msu@sizeoption{11pt}} -\DeclareOption{10pt}{\def\msu@sizeoption{10pt}} -\ExecuteOptions{PhD,12pt} +\SetKeys[msu-thesis]{PhD,12pt} +\ProcessKeyOptions[msu-thesis] \DeclareOption*{ \PassOptionsToClass{\CurrentOption}{memoir} } diff --git a/macros/latex/contrib/msu-thesis/msu-thesis.pdf b/macros/latex/contrib/msu-thesis/msu-thesis.pdf Binary files differindex f809ef25f8..4acc940f9f 100644 --- a/macros/latex/contrib/msu-thesis/msu-thesis.pdf +++ b/macros/latex/contrib/msu-thesis/msu-thesis.pdf diff --git a/macros/latex/contrib/msu-thesis/samples/MSU-thesis-testfile.pdf b/macros/latex/contrib/msu-thesis/samples/MSU-thesis-testfile.pdf Binary files differindex 7fc39a0110..c4d0e9127c 100644 --- a/macros/latex/contrib/msu-thesis/samples/MSU-thesis-testfile.pdf +++ b/macros/latex/contrib/msu-thesis/samples/MSU-thesis-testfile.pdf diff --git a/macros/latex/contrib/profcollege/doc/ProfCollege-doc.pdf b/macros/latex/contrib/profcollege/doc/ProfCollege-doc.pdf Binary files differindex c1a0ba2d78..1f3ab4aafb 100644 --- a/macros/latex/contrib/profcollege/doc/ProfCollege-doc.pdf +++ b/macros/latex/contrib/profcollege/doc/ProfCollege-doc.pdf diff --git a/macros/latex/contrib/profcollege/latex/PfCAllumettes.tex b/macros/latex/contrib/profcollege/latex/PfCAllumettes.tex new file mode 100644 index 0000000000..f603c71f96 --- /dev/null +++ b/macros/latex/contrib/profcollege/latex/PfCAllumettes.tex @@ -0,0 +1,35 @@ +%%% +% Allumettes +%%% +\setKVdefault[Allumettes]{Impression=false,Echelles=false}% +\defKV[Allumettes]{Echelle=\setKV[Allumettes]{Echelles}}% + +\ifluatex + \NewDocumentEnvironment{Allumettes}{o +b}{% + \useKVdefault[Allumettes]% + \setKV[Allumettes]{#1}% + \mplibforcehmode% + \begin{mplibcode}% + input PfCAllumettes; + % + boolean print,Echelles; + print=\useKV[Allumettes]{Impression}; + Echelles=\useKV[Allumettes]{Echelles}; + if Echelles: + Echelle=\useKV[Allumettes]{Echelle}; + DefinirUnite(Echelle); + else: + Echelle=1; + fi; + % + #2% + \end{mplibcode}% + }{} +\else% + \NewDocumentEnvironment{Allumettes}{o +b}{% + \setKV[Allumettes]{#1}% + \begin{mpost}[mpsettings={input PfCAllumettes;boolean print,Echelles;print=\useKV[Allumettes]{Impression};Echelles=\useKV[Allumettes]{Echelles};if Echelles:Echelle=\useKV[Allumettes]{Echelle};DefinirUnite(Echelle);else:Echelle=1;fi;}]% + #2% + \end{mpost} + }{}% +\fi%
\ No newline at end of file diff --git a/macros/latex/contrib/profcollege/latex/PfCBonbon.tex b/macros/latex/contrib/profcollege/latex/PfCBonbon.tex new file mode 100644 index 0000000000..37ddec940e --- /dev/null +++ b/macros/latex/contrib/profcollege/latex/PfCBonbon.tex @@ -0,0 +1,38 @@ +%%% +% Bonbon +%%% +\setKVdefault[Bonbon]{CouleurUn=red,Bicolore=false,Echelle=1} +\defKV[Bonbon]{CouleurDeux=\setKV[Bonbon]{Bicolore}} + +\NewDocumentCommand\Bonbon{o}{% + \useKVdefault[Bonbon]% + \setKV[Bonbon]{#1}% + \ifluatex% + \mplibforcehmode% + \begin{mplibcode} + boolean Bicolore; + Bicolore:=\useKV[Bonbon]{Bicolore}; + color CouleurUn,CouleurDeux; + CouleurUn:=\useKV[Bonbon]{CouleurUn}; + if Bicolore: + CouleurDeux:=\useKV[Bonbon]{CouleurDeux}; + fi; + Echelle:=\useKV[Bonbon]{Echelle}; + input PfCSolid; + + pas:=0.25132; + + Initialisation(10,50,50,15); + incolor:=CouleurUn; + outcolor:=CouleurUn; + if Bicolore: + draw Sparam("Echelle*(u,cos(u)*cos(v),cos(u)*sin(v))",0,pi,pas,0,2*pi,pas); + incolor:=CouleurDeux; + outcolor:=CouleurDeux; + draw Sparam("Echelle*(u,cos(u)*cos(v),cos(u)*sin(v))",pi,2*pi,pas,0,2*pi,pas); + else: + draw Sparam("Echelle*(u,cos(u)*cos(v),cos(u)*sin(v))",0,2*pi,pas,0,2*pi,pas); + fi; + \end{mplibcode} + \fi% +}%
\ No newline at end of file diff --git a/macros/latex/contrib/profcollege/latex/PfCCartesJeux.tex b/macros/latex/contrib/profcollege/latex/PfCCartesJeux.tex index 79aa74ca7d..289cfeb33b 100644 --- a/macros/latex/contrib/profcollege/latex/PfCCartesJeux.tex +++ b/macros/latex/contrib/profcollege/latex/PfCCartesJeux.tex @@ -1,7 +1,7 @@ %%% % Cards %%% -\setKVdefault[Cards]{Formats=false,Largeur=59,Hauteur=89,HauteurTheme=15,Marge=4,Landscape=false,Couleur=Cornsilk,CouleurAr=Cornsilk,Theme=Th\'eor\`eme\\de +\setKVdefault[Cards]{Formats=false,Largeur=165,Hauteur=250,HauteurTheme=40,Marge=12,Landscape=false,Couleur=Cornsilk,CouleurAr=Cornsilk,Theme=Th\'eor\`eme\\de Pythagore,ThemeSol=Solution,AfficheTheme=false,Trame=false,Jointes=false,TrameVisible=false,RayonArc=5pt,Titre=false,NomTitre=Jeu 1,Loop,JaiQuia=false,Eleve=false,BackgroundAv=false,BackgroundAr=false,%ImageAv=4813762.jpg,ImageAr=4813762.jpg, AffichageSolution=true,SolutionSeule=false,% % Pour la boite @@ -274,6 +274,7 @@ \newlength{\largeurcards}% \newlength{\hauteurcards}% +\newlength{\margecards}% \newlength{\largeurcarte}% \newlength{\hauteurcarte}% \newlength{\hauteurtitre}% @@ -290,61 +291,11 @@ \setlength{\PfCCardsEcartH}{0pt}% \setlength{\PfCCardsEcartV}{0pt}% -\NewDocumentEnvironment{Trame}{+b}{% - \ifodd\thepage% - \setlength{\PfCCardsH}{\largeurcards}% - \setlength{\PfCCardsV}{\hauteurcards}% - \else% - \setlength{\PfCCardsH}{\largeurcards+\PfCCardsEcartH}% - \setlength{\PfCCardsV}{\hauteurcards+\PfCCardsEcartV}% - \fi% - \begin{tikzpicture}[remember picture,overlay] - % quadrillages horizontal et vertical - \coordinate[yshift=-\margev] (A) at (current page.north west);% - \coordinate[yshift=-\margev] (B) at (current page.north east);% - \coordinate[yshift=-\hauteurcards] (A1) at (A);% - \coordinate[yshift=-\hauteurcards] (B1) at (B);% - \coordinate[yshift=-\hauteurcards] (A2) at (A1);% - \coordinate[yshift=-\hauteurcards] (B2) at (B1);% - \coordinate[yshift=-\hauteurcards] (A3) at (A2);% - \coordinate[yshift=-\hauteurcards] (B3) at (B2);% - \coordinate[yshift=-\hauteurcards] (A4) at (A3);% - \coordinate[yshift=-\hauteurcards] (B4) at (B3);% - \coordinate[xshift=\margeh] (C) at (current page.north west);% - \coordinate[xshift=\margeh] (D) at (current page.south west);% - \coordinate[xshift=\largeurcards] (C1) at (C);% - \coordinate[xshift=\largeurcards] (D1) at (D);% - \coordinate[xshift=\largeurcards] (C2) at (C1);% - \coordinate[xshift=\largeurcards] (D2) at (D1);% - \coordinate[xshift=\largeurcards] (C3) at (C2);% - \coordinate[xshift=\largeurcards] (D3) at (D2);% - \ifboolKV[Cards]{TrameVisible}{% - \draw (A)--(B);% - \draw (A1)--(B1);% - \draw (A2)--(B2);% - \draw (A3)--(B3);% - \draw (A4)--(B4);% - \draw (C)--(D);% - \draw (C1)--(D1);% - \draw (C2)--(D2);% - \draw (C3)--(D3);% - }{}% - % point pour placer les cartes - \coordinate[xshift=\margeh+0.5\PfCCardsH,yshift=-0.5\PfCCardsV] (Carte1) at (A);% - \coordinate[xshift=\largeurcards,yshift=0mm] (Carte2) at (Carte1);% - \coordinate[xshift=2\largeurcards,yshift=0mm] (Carte3) at (Carte1);% - \coordinate[xshift=0mm,yshift=-\hauteurcards] (Carte4) at (Carte1);% - \coordinate[xshift=0mm,yshift=-\hauteurcards] (Carte5) at (Carte2);% - \coordinate[xshift=0mm,yshift=-\hauteurcards] (Carte6) at (Carte3);% - \coordinate[xshift=0mm,yshift=-\hauteurcards] (Carte7) at (Carte4);% - \coordinate[xshift=0mm,yshift=-\hauteurcards] (Carte8) at (Carte5);% - \coordinate[xshift=0mm,yshift=-\hauteurcards] (Carte9) at (Carte6);% - #1% - \end{tikzpicture}% -}{}% +\NewDocumentCommand\Cartes{o +m}{% + \CartesPerso[#1]{#2}% +}% -%% Trame pour huit cartes format "A7" -\NewDocumentEnvironment{TrameASept}{+b}{% +\NewDocumentEnvironment{TramePerso}{+b}{% \ifodd\thepage% \setlength{\PfCCardsH}{\largeurcards}% \setlength{\PfCCardsV}{\hauteurcards}% @@ -353,313 +304,127 @@ \setlength{\PfCCardsV}{\hauteurcards+\PfCCardsEcartV}% \fi% \begin{tikzpicture}[remember picture,overlay] - % quadrillages horizontal et vertical \coordinate[yshift=-\margev] (A) at (current page.north west);% \coordinate[yshift=-\margev] (B) at (current page.north east);% - \coordinate[yshift=-\hauteurcards] (A1) at (A);% - \coordinate[yshift=-\hauteurcards] (B1) at (B);% - \coordinate[yshift=-\hauteurcards] (A2) at (A1);% - \coordinate[yshift=-\hauteurcards] (B2) at (B1);% + \xintFor* ##1 in{\xintSeq{0}{\PfCNbCartesHaut}}\do{% + \coordinate[yshift=-##1*\hauteurcards] (A##1) at (A);% + \coordinate[yshift=-##1*\hauteurcards] (B##1) at (B);% + }% \coordinate[xshift=\margeh] (C) at (current page.north west);% \coordinate[xshift=\margeh] (D) at (current page.south west);% - \coordinate[xshift=\largeurcards] (C1) at (C);% - \coordinate[xshift=\largeurcards] (D1) at (D);% - \coordinate[xshift=\largeurcards] (C2) at (C1);% - \coordinate[xshift=\largeurcards] (D2) at (D1);% - \coordinate[xshift=\largeurcards] (C3) at (C2);% - \coordinate[xshift=\largeurcards] (D3) at (D2);% - \draw (A) -- (B);% - \draw (A1) -- (B1);% - \draw (A2) -- (B2);% - \draw (C)--(D);% - \draw (C1)--(D1);% - \draw (C2)--(D2);% - \draw (C3)--(D3);% - \coordinate[xshift=\margeh+0.5\largeurcards,yshift=-0.5\hauteurcards] (Carte1) at (A);% - \coordinate[xshift=\largeurcards,yshift=0mm] (Carte2) at (Carte1);% - \coordinate[xshift=2\largeurcards,yshift=0mm] (Carte3) at (Carte1);% - \coordinate[xshift=0mm,yshift=-\hauteurcards] (Carte4) at (Carte1);% - \coordinate[xshift=\largeurcards,yshift=-\hauteurcards] (Carte5) at (Carte1);% - \coordinate[xshift=2\largeurcards,yshift=-\hauteurcards] (Carte6) at (Carte1);% - #1% - \end{tikzpicture}% -}% - -\newcommand\CartesASept[2][]{% - \useKVdefault[Cards]% - \setKV[Cards]{#1}% - \setsepchar[*]{§*/}% - \readlist*\ListeCards{#2}% - \setsepchar{,}% - \setlength{\hauteurcarte}{\fpeval{100-\useKV[Cards]{Marge}}mm}% - \setlength{\largeurcarte}{\fpeval{95-\useKV[Cards]{Marge}}mm}% - \setlength{\largeurcards}{95mm}% - \setlength{\hauteurcards}{100mm}% - \setlength{\margeh}{(297mm-287mm)/2}% - \setlength{\margev}{(210mm-200mm)/2}% - \setlength{\hauteurtitre}{\fpeval{\useKV[Cards]{HauteurTheme}}mm}% - \setlength{\largeurtitre}{\fpeval{(\useKV[Cards]{Largeur}-\useKV[Cards]{Marge}-9)/2}mm}% - \colorlet{TexteCouleur}{black}% - \colorlet{TrameCouleur}{\useKV[Cards]{Couleur}}% - \colorlet{TrameCouleurAr}{\useKV[Cards]{CouleurAr}}% - \begin{TrameASept} - %A - \multido{\i=1+1}{6}{% - \node[] at (Carte\i) {% - \begin{MyboxSimpleAv}{\useKV[Cards]{Theme}}% - \ListeCards[\i,1]% - \end{MyboxSimpleAv}% - };% + \xintFor* ##1 in{\xintSeq{0}{\PfCNbCartesHaut}}\do{% + \coordinate[xshift=\fpeval{##1*\largeurcards}] (C##1) at (C);% + \coordinate[xshift=\fpeval{##1*\largeurcards}] (D##1) at (D);% + }% + \ifboolKV[Cards]{TrameVisible}{% + \xintFor* ##1 in{\xintSeq{0}{\PfCNbCartesHaut}}\do{% + \draw (A##1)--(B##1); + }% + \xintFor* ##1 in{\xintSeq{0}{\PfCNbCartesHaut}}\do{% + \draw (C##1)--(D##1); }% - \end{TrameASept}% - \ifboolKV[Cards]{AffichageSolution}{% - \clearpage% - \thispagestyle{empty}% - \begin{TrameASept} - \multido{\i=1+1}{3}{% - \node at (Carte\i) {% - \begin{MyboxSimpleAr}{\useKV[Cards]{ThemeSol}}% - \ListeCards[\fpeval{4-\i},2]% - \end{MyboxSimpleAr}% - };% - }% - \multido{\i=4+1}{3}{% - \node at (Carte\i) {% - \begin{MyboxSimpleAr}{\useKV[Cards]{ThemeSol}}% - \ListeCards[\fpeval{10-\i},2]% - \end{MyboxSimpleAr}% - };% - }% - \end{TrameASept}% - \clearpage% }{}% -% }% -}% - - -%% Trame pour quatre cartes format A6 -\NewDocumentEnvironment{TrameASix}{+b}{% - \ifodd\thepage% - \setlength{\PfCCardsH}{\largeurcards}% - \setlength{\PfCCardsV}{\hauteurcards}% - \else% - \setlength{\PfCCardsH}{\largeurcards+\PfCCardsEcartH}% - \setlength{\PfCCardsV}{\hauteurcards+\PfCCardsEcartV}% - \fi% - \begin{tikzpicture}[remember picture,overlay] - % quadrillages horizontal et vertical - \coordinate[yshift=-\margev] (A) at (current page.north west);% - \coordinate[yshift=-\margev] (B) at (current page.north east);% - \coordinate[yshift=-\hauteurcards] (A1) at (A);% - \coordinate[yshift=-\hauteurcards] (B1) at (B);% - \coordinate[yshift=-\hauteurcards] (A2) at (A1);% - \coordinate[yshift=-\hauteurcards] (B2) at (B1);% - \coordinate[xshift=\margeh] (C) at (current page.north west);% - \coordinate[xshift=\margeh] (D) at (current page.south west);% - \coordinate[xshift=\largeurcards] (C1) at (C);% - \coordinate[xshift=\largeurcards] (D1) at (D);% - \coordinate[xshift=\largeurcards] (C2) at (C1);% - \coordinate[xshift=\largeurcards] (D2) at (D1);% - \draw (A) -- (B);% - \draw (A1) -- (B1);% - \draw (A2) -- (B2);% - \draw (C)--(D);% - \draw (C1)--(D1);% - \draw (C2)--(D2);% - \coordinate[xshift=\margeh+0.5\largeurcards,yshift=-0.5\hauteurcards] (Carte1) at (A);% - \coordinate[xshift=\largeurcards,yshift=0mm] (Carte2) at (Carte1);% - \coordinate[xshift=0mm,yshift=-\hauteurcards] (Carte3) at (Carte1);% - \coordinate[xshift=\largeurcards,yshift=-\hauteurcards] (Carte4) at (Carte1);% + % points pour placer les cartes + \coordinate[xshift=\margeh+0.5\PfCCardsH,yshift=-0.5\PfCCardsV] (Carte0) at (A);% + \xintFor* ##1 in{\xintSeq{0}{\fpeval{\PfCNbCartesHaut-1}}}\do{% + \xintFor* ##2 in{\xintSeq{0}{\fpeval{\PfCNbCartesLarg-1}}}\do{% + \xdef\PfCNumeroCartes{\fpeval{##1*\PfCNbCartesLarg+##2+1}}% + \coordinate[xshift=\fpeval{##2*\largeurcards},yshift=\fpeval{-##1*\hauteurcards}] (Carte\PfCNumeroCartes) at (Carte0);% + }% + }% #1% \end{tikzpicture}% -}% +}{}% -\newcommand\CartesASix[2][]{% +\NewDocumentCommand\CartesPerso{o +m}{% +% 0/ La largeur est \useKV[Cards]{Largeur} - La hauteur est \useKV[Cards]{Hauteur}.\par \useKVdefault[Cards]% \setKV[Cards]{#1}% +% 1/ La largeur est \useKV[Cards]{Largeur} - La hauteur est \useKV[Cards]{Hauteur}.\par \setsepchar[*]{§*/}% \readlist*\ListeCards{#2}% \setsepchar{,}% - \setlength{\hauteurcarte}{\fpeval{100-\useKV[Cards]{Marge}}mm}% - \setlength{\largeurcarte}{\fpeval{143.5-\useKV[Cards]{Marge}}mm}% - \setlength{\largeurcards}{143.5mm}% - \setlength{\hauteurcards}{100mm}% - \setlength{\margeh}{(297mm-287mm)/2}% - \setlength{\margev}{(210mm-200mm)/2}% - \setlength{\hauteurtitre}{\fpeval{\useKV[Cards]{HauteurTheme}}mm}% - \setlength{\largeurtitre}{\fpeval{(\useKV[Cards]{Largeur}-\useKV[Cards]{Marge}-9)/2}mm}% - \colorlet{TexteCouleur}{black}% - \colorlet{TrameCouleur}{\useKV[Cards]{Couleur}}% - \colorlet{TrameCouleurAr}{\useKV[Cards]{CouleurAr}}% - \begin{TrameASix} - %A - \multido{\i=1+1}{4}{% - \node[] at (Carte\i) {% - \begin{MyboxSimpleAv}{\useKV[Cards]{Theme}}% - \ListeCards[\i,1]% - \end{MyboxSimpleAv}% - };% - }% - \end{TrameASix}% - \ifboolKV[Cards]{AffichageSolution}{% - \clearpage% - \thispagestyle{empty}% - \begin{TrameASix} - \multido{\i=1+1}{2}{% - \node at (Carte\i) {% - \begin{MyboxSimpleAr}{\useKV[Cards]{ThemeSol}}% - \ListeCards[\fpeval{3-\i},2]% - \end{MyboxSimpleAr}% - };% - }% - \multido{\i=3+1}{2}{% - \node at (Carte\i) {% - \begin{MyboxSimpleAr}{\useKV[Cards]{ThemeSol}}% - \ListeCards[\fpeval{7-\i},2]% - \end{MyboxSimpleAr}% - };% - }% - \end{TrameASix}% - \clearpage% + % Dimensions extérieures des cartes + \ifboolKV[Cards]{Landscape}{% + \setlength{\largeurcards}{\fpeval{\useKV[Cards]{Hauteur}}pt}% + \setlength{\hauteurcards}{\fpeval{\useKV[Cards]{Largeur}}pt}% + }{% + \setlength{\largeurcards}{\fpeval{\useKV[Cards]{Largeur}}pt}% + \setlength{\hauteurcards}{\fpeval{\useKV[Cards]{Hauteur}}pt}% + }% + \setlength{\margecards}{\fpeval{\useKV[Cards]{Marge}}pt}% +% 2/ La largeur est \fpeval{\largeurcards} - La hauteur est \fpeval{\hauteurcards}.\par + % Format prédéfinis + \ifboolKV[Cards]{Formats}{% +% Ici, le format est \useKV[Cards]{Format} +% 3/ La largeur est \fpeval{\largeurcards} - La hauteur est \fpeval{\hauteurcards}.\par + \comparestrict% + \IfEq{\useKV[Cards]{Format}}{A5p}{% + % Dimensions extérieures des cartes + \setlength{\largeurcards}{405pt}% + \setlength{\hauteurcards}{538pt}% +% 4/ La largeur est \fpeval{\largeurcards} - La hauteur est \fpeval{\hauteurcards}.\par }{}% -% }% -}% - -%% Trame pour deux cartes format A5 -\NewDocumentEnvironment{TrameACinq}{+b}{% - \ifodd\thepage% - \setlength{\PfCCardsH}{\largeurcards}% - \setlength{\PfCCardsV}{\hauteurcards}% - \else% - \setlength{\PfCCardsH}{\largeurcards+\PfCCardsEcartH}% - \setlength{\PfCCardsV}{\hauteurcards+\PfCCardsEcartV}% - \fi% - \begin{tikzpicture}[remember picture,overlay] - % quadrillages horizontal et vertical - \coordinate[yshift=-\margev] (A) at (current page.north west);% - \coordinate[yshift=-\margev] (B) at (current page.north east);% - \coordinate[yshift=-\hauteurcards] (A1) at (A);% - \coordinate[yshift=-\hauteurcards] (B1) at (B);% - \coordinate[xshift=\margeh] (C) at (current page.north west);% - \coordinate[xshift=\margeh] (D) at (current page.south west);% - \coordinate[xshift=\largeurcards] (C1) at (C);% - \coordinate[xshift=\largeurcards] (D1) at (D);% - \coordinate[xshift=\largeurcards] (C2) at (C1);% - \coordinate[xshift=\largeurcards] (D2) at (D1);% - \draw (A) -- (B);% - \draw (A1) -- (B1);% - \draw (C)--(D);% - \draw (C1)--(D1);% - \draw (C2)--(D2);% - \coordinate[xshift=\margeh+0.5\largeurcards,yshift=-0.5\hauteurcards] (Carte1) at (A);% - \coordinate[xshift=\largeurcards,yshift=0mm] (Carte2) at (Carte1);% - #1% - \end{tikzpicture}% -}% - -\newcommand\CartesACinq[2][]{% - \useKVdefault[Cards]% - \setKV[Cards]{#1}% - \setsepchar[*]{§*/}% - \readlist*\ListeCards{#2}% - \setlength{\hauteurcarte}{\fpeval{200-\useKV[Cards]{Marge}}mm}% - \setlength{\largeurcarte}{\fpeval{143.5-\useKV[Cards]{Marge}}mm}% - \setlength{\largeurcards}{143.5mm}% - \setlength{\hauteurcards}{200mm}% - \setlength{\margeh}{(297mm-287mm)/2}% - \setlength{\margev}{(210mm-190mm)/2}% - \setlength{\hauteurtitre}{\fpeval{\useKV[Cards]{HauteurTheme}}mm}% - \setlength{\largeurtitre}{\fpeval{(\useKV[Cards]{Largeur}-\useKV[Cards]{Marge}-9)/2}mm}% + \IfEq{\useKV[Cards]{Format}}{A6p}{% + \setlength{\largeurcards}{405pt}% + \setlength{\hauteurcards}{283pt}% + }{}% + \IfEq{\useKV[Cards]{Format}}{Huitp}{% + \setlength{\largeurcards}{269pt}% + \setlength{\hauteurcards}{283pt}% + }{}% + }{% + % + % Dimensions extérieures des cartes +% \setlength{\largeurcards}{\fpeval{\useKV[Cards]{Largeur}}mm}% +% \setlength{\hauteurcards}{\fpeval{\useKV[Cards]{Hauteur}}mm}% + }% + \let\Trame\TramePerso\let\endTrame\endTramePerso + % Dimensions intérieures des cartes + \setlength{\hauteurcarte}{\fpeval{\hauteurcards-\margecards}pt}% + \setlength{\largeurcarte}{\fpeval{\largeurcards-\margecards}pt}% + % nombre de cartes sur la largeur + \xdef\PfCNbCartesLarg{\fpeval{floor(\paperwidth/\largeurcards)}}% + \xdef\PfCNbCartesHaut{\fpeval{floor(\paperheight/\hauteurcards)}}% + \xdef\PfCNbCartesPerso{\fpeval{\PfCNbCartesLarg*\PfCNbCartesHaut}}% + % Jointes + \ifboolKV[Cards]{Jointes}{\setlength{\largeurcards}{\largeurcarte}}{}% + \ifboolKV[Cards]{Jointes}{\setlength{\hauteurcards}{\hauteurcarte}}{}% + % décalage entre les cartes ou pas + \ifnum\PfCNbCartesLarg>1\relax + \setlength{\margeh}{\fpeval{(\paperwidth-\PfCNbCartesLarg*\largeurcards)/(\PfCNbCartesLarg-1)}pt}% + \fi + \ifnum\PfCNbCartesHaut>1\relax + \setlength{\margev}{\fpeval{(\paperheight-\PfCNbCartesHaut*\hauteurcards)/(\PfCNbCartesHaut-1)}pt}% + \fi + % + \setlength{\hauteurtitre}{\fpeval{\useKV[Cards]{HauteurTheme}}pt}% + \setlength{\largeurtitre}{\fpeval{(\largeurcarte-25)/2}pt}% \colorlet{TexteCouleur}{black}% \colorlet{TrameCouleur}{\useKV[Cards]{Couleur}}% \colorlet{TrameCouleurAr}{\useKV[Cards]{CouleurAr}}% - \begin{TrameACinq} - %A - \multido{\i=1+1}{2}{% - \node[] at (Carte\i) {% - \begin{MyboxSimpleAv}{\useKV[Cards]{Theme}}% - \ListeCards[\i,1]% - \end{MyboxSimpleAv}% - };% - }% - \end{TrameACinq}% - \ifboolKV[Cards]{AffichageSolution}{% - \clearpage% - \thispagestyle{empty}% - \begin{TrameACinq} - \multido{\i=1+1}{2}{% - \node at (Carte\i) {% - \begin{MyboxSimpleAr}{\useKV[Cards]{ThemeSol}}% - \ListeCards[\fpeval{3-\i},2]% - \end{MyboxSimpleAr}% - };% - }% - \end{TrameACinq}% - \clearpage% - }{}% -}% - -\NewDocumentCommand\Cartes{o +m}{% - \useKVdefault[Cards]% - \setKV[Cards]{#1}% - \setsepchar[*]{§*/}% - \readlist*\ListeCards{#2}% - \setsepchar{,}% - \ifboolKV[Cards]{Formats}{% - \comparestrict% - \IfEq{\useKV[Cards]{Format}}{A5p}{% - \CartesACinq[#1]{#2}% - }{}% - \IfEq{\useKV[Cards]{Format}}{A6p}{% - \CartesASix[#1]{#2}% - }{}% - \IfEq{\useKV[Cards]{Format}}{Huitp}{% - \CartesASept[#1]{#2}% - }{}% + \setlength{\PfCRayonArc}{\useKV[Cards]{RayonArc}}% + \ifboolKV[Cards]{Trivial}{% + \CartesTrivialPerso% }{% - \ifboolKV[Cards]{Landscape}{% - \setlength{\hauteurcarte}{\fpeval{\useKV[Cards]{Largeur}-\useKV[Cards]{Marge}}mm}% - \setlength{\largeurcarte}{\fpeval{\useKV[Cards]{Hauteur}-\useKV[Cards]{Marge}}mm}% - \setlength{\largeurcards}{95mm}% - \setlength{\hauteurcards}{65mm}% - \setlength{\margeh}{(297mm-3\largeurcards)/2}% - \setlength{\margev}{(210mm-3\hauteurcards)/2}% - }{% - \setlength{\hauteurcarte}{\fpeval{\useKV[Cards]{Hauteur}-\useKV[Cards]{Marge}}mm}% - \setlength{\largeurcarte}{\fpeval{\useKV[Cards]{Largeur}-\useKV[Cards]{Marge}}mm}% - \ifboolKV[Cards]{Jointes}{\setlength{\largeurcards}{\largeurcarte}}{\setlength{\largeurcards}{65mm}}% - \ifboolKV[Cards]{Jointes}{\setlength{\hauteurcards}{\hauteurcarte}}{\setlength{\hauteurcards}{95mm}}% - \setlength{\margeh}{(210mm-3\largeurcards)/2}% - \setlength{\margev}{(297mm-3\hauteurcards)/2} - }% - \setlength{\hauteurtitre}{\fpeval{\useKV[Cards]{HauteurTheme}}mm}% - \setlength{\largeurtitre}{\fpeval{(\useKV[Cards]{Largeur}-\useKV[Cards]{Marge}-9)/2}mm}% - \colorlet{TexteCouleur}{black}% - \colorlet{TrameCouleur}{\useKV[Cards]{Couleur}}% - \colorlet{TrameCouleurAr}{\useKV[Cards]{CouleurAr}}% - \setlength{\PfCRayonArc}{\useKV[Cards]{RayonArc}}% - \ifboolKV[Cards]{Trivial}{% - \CartesTrivial% + \ifboolKV[Cards]{JaiQuia}{% + \CartesJaiQuiaPerso% }{% - \ifboolKV[Cards]{JaiQuia}{% - \CartesJaiQuia% + \ifboolKV[Cards]{Loop}{% + \CartesLoopPerso% }{% - \ifboolKV[Cards]{Loop}{% - \CartesLoop% - }{% - \CartesClassique% - }% + \CartesClassiquePerso% }% }% }% }% -\NewDocumentCommand\CartesClassique{}{% +\NewDocumentCommand\CartesClassiquePerso{}{% \ifboolKV[Cards]{Trame}{% \clearpage% \thispagestyle{empty}% \begin{Trame} - \multido{\i=1+1}{9}{% + \multido{\i=1+1}{\PfCNbCartesPerso}{% \node[] at (Carte\i) {% \begin{MyboxSimpleAv}{\useKV[Cards]{Theme}}% \ListeCards[\i,1]% @@ -671,26 +436,16 @@ \clearpage% \thispagestyle{empty}% \begin{Trame} - \multido{\i=1+1}{3}{% - \node at (Carte\i) {% - \begin{MyboxSimpleAr}{\useKV[Cards]{ThemeSol}}% - \ListeCards[\fpeval{4-\i},2]% - \end{MyboxSimpleAr}% - };% - }% - \multido{\i=4+1}{3}{% - \node at (Carte\i) {% - \begin{MyboxSimpleAr}{\useKV[Cards]{ThemeSol}}% - \ListeCards[\fpeval{10-\i},2]% - \end{MyboxSimpleAr}% - };% - }% - \multido{\i=7+1}{3}{% - \node at (Carte\i) {% - \begin{MyboxSimpleAr}{\useKV[Cards]{ThemeSol}}% - \ListeCards[\fpeval{16-\i},2]% - \end{MyboxSimpleAr}% - };% + \xintFor* ##1 in{\xintSeq{0}{\fpeval{\PfCNbCartesHaut-1}}}\do{% + \xintFor* ##2 in{\xintSeq{0}{\fpeval{\PfCNbCartesLarg-1}}}\do{% + \xdef\PfCNumeroNoeud{\fpeval{##1*\PfCNbCartesLarg+##2+1}} + \xdef\PfCNumeroCartes{\fpeval{(##1+1)*\PfCNbCartesLarg-##2}} + \node at (Carte\PfCNumeroNoeud) {% + \begin{MyboxSimpleAr}{\useKV[Cards]{ThemeSol}}% + \ListeCards[\fpeval{\PfCNumeroCartes},2]% + \end{MyboxSimpleAr}% + };% + }% }% \end{Trame}% \clearpage% @@ -709,111 +464,83 @@ }% }% -\NewDocumentCommand\CartesLoop{}{% +\NewDocumentCommand\CartesLoopPerso{}{% \ifboolKV[Cards]{Trame}{% \clearpage% \thispagestyle{empty}% \begin{Trame} - \multido{\i=1+1}{9}{% - \node at (Carte\i) {% + \multido{\i=1+1}{\PfCNbCartesPerso}{% + \node[] at (Carte\i) {% \begin{Mybox}{\ListeCards[\i,1]}{\useKV[Cards]{Theme}}{\ListeCards[\i,2]}% \ListeCards[\i,3]% \end{Mybox}% };% }% \end{Trame}% - \clearpage% + \clearpage \ifboolKV[Cards]{AffichageSolution}{% + \clearpage% \thispagestyle{empty}% \begin{Trame} - \multido{\i=1+1}{3}{% - \node at (Carte\i) {% - \begin{MyboxAr}% - \end{MyboxAr}% - };% - }% - \multido{\i=4+1}{3}{% - \node at (Carte\i) {% - \begin{MyboxAr}% - \end{MyboxAr}% - };% - }% - \multido{\i=7+1}{3}{% - \node at (Carte\i) {% - \begin{MyboxAr}% - \end{MyboxAr}% - };% + \xintFor* ##1 in{\xintSeq{0}{\fpeval{\PfCNbCartesHaut-1}}}\do{% + \xintFor* ##2 in{\xintSeq{0}{\fpeval{\PfCNbCartesLarg-1}}}\do{% + \xdef\PfCNumeroNoeud{\fpeval{##1*\PfCNbCartesLarg+##2+1}} + \xdef\PfCNumeroCartes{\fpeval{(##1+1)*\PfCNbCartesLarg-##2}} + \node at (Carte\PfCNumeroNoeud) {% + \begin{MyboxAr}% + \end{MyboxAr}% + };% + }% }% \end{Trame}% \clearpage% }{}% }{% - \begin{Mybox}{\ListeCards[1,1]}{\useKV[Cards]{Theme}}{\ListeCards[1,2]}% - \ListeCards[1,3]% - \end{Mybox}% + \ifboolKV[Cards]{SolutionSeule}{}{% + \begin{Mybox}{\ListeCards[1,1]}{\useKV[Cards]{Theme}}{\ListeCards[1,2]}% + \ListeCards[1,3]% + \end{Mybox}% + }% \ifboolKV[Cards]{AffichageSolution}{% - \begin{MyboxAr}% - \end{MyboxAr}% + \begin{MyboxAr}% + \end{MyboxAr}% }{}% }% }% -\NewDocumentCommand\CartesJaiQuia{}{% +\NewDocumentCommand\CartesJaiQuiaPerso{}{% \ifboolKV[Cards]{Trame}{% \clearpage% \thispagestyle{empty}% - \begin{Trame}% - \multido{\i=1+1}{9}{% - \node at (Carte\i) {% + \begin{Trame} + \multido{\i=1+1}{\PfCNbCartesPerso}{% + \node[] at (Carte\i) {% \begin{MyboxJQ}{\ListeCards[\i,1]}{\ListeCards[\i,2]}% %% \end{MyboxJQ}% };% }% \end{Trame}% - \clearpage% \ifboolKV[Cards]{AffichageSolution}{% + \clearpage% \thispagestyle{empty}% \begin{Trame} - \multido{\i=1+1}{3}{% - \node at (Carte\i) {% - \ifboolKV[Cards]{AfficheTheme}{% - \begin{MyboxJQAr}{\useKV[Cards]{ThemeJaiQuiA}}% - \end{MyboxJQAr}% - }{% - \begin{MyboxJQAr}{}% - \end{MyboxJQAr}% - }% - };% - }% - \multido{\i=4+1}{3}{% - \node at (Carte\i) {% - \ifboolKV[Cards]{AfficheTheme}{% - \begin{MyboxJQAr}{\useKV[Cards]{ThemeJaiQuiA}}% - \end{MyboxJQAr}% - }{% - \begin{MyboxJQAr}{}% - \end{MyboxJQAr}% - }% - };% - }% - \multido{\i=7+1}{3}{% - \node at (Carte\i) {% - \ifboolKV[Cards]{AfficheTheme}{% + \xintFor* ##1 in{\xintSeq{0}{\fpeval{\PfCNbCartesHaut-1}}}\do{% + \xintFor* ##2 in{\xintSeq{0}{\fpeval{\PfCNbCartesLarg-1}}}\do{% + \xdef\PfCNumeroNoeud{\fpeval{##1*\PfCNbCartesLarg+##2+1}} + \xdef\PfCNumeroCartes{\fpeval{(##1+1)*\PfCNbCartesLarg-##2}} + \node at (Carte\PfCNumeroNoeud) {% \begin{MyboxJQAr}{\useKV[Cards]{ThemeJaiQuiA}}% \end{MyboxJQAr}% - }{% - \begin{MyboxJQAr}{}% - \end{MyboxJQAr}% - }% - };% + };% + }% }% \end{Trame}% \clearpage% }{}% }{% \begin{MyboxJQ}{\ListeCards[1,1]}{\ListeCards[1,2]}% - %% + %% \end{MyboxJQ}% \ifboolKV[Cards]{AffichageSolution}{% \ifboolKV[Cards]{AfficheTheme}{% @@ -827,15 +554,15 @@ }% }% -\NewDocumentCommand\CartesTrivial{}{% +\NewDocumentCommand\CartesTrivialPerso{}{% \xdef\PfCListeSymbolTrivial{\useKV[Cards]{Symboles}}% \setsepchar{,}\readlist*\ListeSymbolesTrivial{\PfCListeSymbolTrivial}% \setlength{\tabcolsep}{0.25\tabcolsep}% \ifboolKV[Cards]{Trame}{% \clearpage% \thispagestyle{empty}% - \begin{Trame}% - \multido{\i=1+1}{9}{% + \begin{Trame} + \multido{\i=1+1}{\PfCNbCartesPerso}{% \node[] at (Carte\i) {% \begin{MyboxTrivial}% \begin{center} @@ -852,45 +579,94 @@ \ifboolKV[Cards]{AffichageSolution}{% \clearpage% \thispagestyle{empty}% - \begin{Trame}% - \multido{\i=1+1}{3}{% - \node at (Carte\i) {% - \begin{MyboxTrivial}% - \begin{center}% - \begin{NiceTabular}[width=0.9\largeurcarte]{X[1,m]X[10,m]}[hvlines]% - \xintFor* ##1 in{\xintSeq{1}{6}}\do{% - \rule{0pt}{0.12\hauteurcards}\Block{1-1}{\ListeSymbolesTrivial[##1]}&\ListeCards[\fpeval{4-\i},\fpeval{2*##1}]\\ - }% - \end{NiceTabular}% - \end{center}% - \end{MyboxTrivial}% - };% - }% - \multido{\i=4+1}{3}{% - \node at (Carte\i) {% - \begin{MyboxTrivial}% + \begin{Trame} + \xintFor* ##1 in{\xintSeq{0}{\fpeval{\PfCNbCartesHaut-1}}}\do{% + \xintFor* ##2 in{\xintSeq{0}{\fpeval{\PfCNbCartesLarg-1}}}\do{% + \xdef\PfCNumeroNoeud{\fpeval{##1*\PfCNbCartesLarg+##2+1}}% + \xdef\PfCNumeroCartes{\fpeval{(##1+1)*\PfCNbCartesLarg-##2}}% + \node at (Carte\PfCNumeroNoeud) {% + \begin{MyboxTrivial}% \begin{center}% \begin{NiceTabular}[width=0.9\largeurcarte]{X[1,m]X[10,m]}[hvlines]% - \xintFor* ##1 in{\xintSeq{1}{6}}\do{% - \rule{0pt}{0.12\hauteurcards}\Block{1-1}{\ListeSymbolesTrivial[##1]}&\ListeCards[\fpeval{10-\i},\fpeval{2*##1}]\\ + \xintFor* ##3 in{\xintSeq{1}{6}}\do{% + \rule{0pt}{0.12\hauteurcards}\Block{1-1}{\ListeSymbolesTrivial[##3]}&\ListeCards[\fpeval{\PfCNumeroCartes},\fpeval{2*##3}] + \\ }% \end{NiceTabular}% \end{center}% \end{MyboxTrivial}% - };% + };% + }% }% - \multido{\i=7+1}{3}{% - \node at (Carte\i) {% - \begin{MyboxTrivial}% + \end{Trame}% + \clearpage% + }{}% + }{% + \begin{MyboxTrivial}% + \begin{center}% + \begin{NiceTabular}[width=0.9\largeurcarte]{X[1,m]X[10,m]}[hvlines]% + \xintFor* ##1 in{\xintSeq{1}{6}}\do{% + \rule{0pt}{0.12\hauteurcards}\Block{1-1}{\ListeSymbolesTrivial[##1]}&\ListeCards[1,\fpeval{1+2*(##1-1)}]\\ + }% + \end{NiceTabular}% + \end{center}% + \end{MyboxTrivial}% + \ifboolKV[Cards]{AffichageSolution}{% + \begin{MyboxTrivial}% + \begin{center}% + \begin{NiceTabular}[width=0.9\largeurcarte]{X[1,m]X[10,m]}[hvlines]% + \xintFor* ##1 in{\xintSeq{1}{6}}\do{% + \rule{0pt}{0.12\hauteurcards}\Block{1-1}{\ListeSymbolesTrivial[##1]}&\ListeCards[1,\fpeval{2*##1}]\\ + }% + \end{NiceTabular}% + \end{center}% + \end{MyboxTrivial}% + }{}% + }% +}% + +\NewDocumentCommand\CartesTrivialPersoold{}{% + \xdef\PfCListeSymbolTrivial{\useKV[Cards]{Symboles}}% + \setsepchar{,}\readlist*\ListeSymbolesTrivial{\PfCListeSymbolTrivial}% + \setlength{\tabcolsep}{0.25\tabcolsep}% + \ifboolKV[Cards]{Trame}{% + \clearpage% + \thispagestyle{empty}% + \begin{Trame} + \multido{\i=1+1}{\PfCNbCartesPerso}{% + \node[] at (Carte\i) {% + \begin{MyboxTrivial}% + \begin{center} + \begin{NiceTabular}[width=0.9\largeurcarte]{X[1,m]X[9,m]}[hvlines]% + \xintFor* ##1 in{\xintSeq{1}{6}}\do{% + \rule{0pt}{0.12\hauteurcards}\Block{1-1}{\ListeSymbolesTrivial[##1]}&\ListeCards[\i,\fpeval{1+2*(##1-1)}]\\ + }% + \end{NiceTabular}% + \end{center}% + \end{MyboxTrivial}% + };% + }% + \end{Trame}% + \ifboolKV[Cards]{AffichageSolution}{% + \clearpage% + \thispagestyle{empty}% + \begin{Trame} + \xintFor* ##1 in{\xintSeq{0}{\fpeval{\PfCNbCartesHaut-1}}}\do{% + \xintFor* ##2 in{\xintSeq{0}{\fpeval{\PfCNbCartesLarg-1}}}\do{% + \xdef\PfCNumeroNoeud{\fpeval{##1*\PfCNbCartesLarg+##2+1}} + \xdef\PfCNumeroCartes{\fpeval{(##1+1)*\PfCNbCartesLarg-##2}} + \node at (Carte\PfCNumeroNoeud) {% + \begin{MyboxTrivial}% \begin{center}% \begin{NiceTabular}[width=0.9\largeurcarte]{X[1,m]X[10,m]}[hvlines]% \xintFor* ##1 in{\xintSeq{1}{6}}\do{% - \rule{0pt}{0.12\hauteurcards}\Block{1-1}{\ListeSymbolesTrivial[##1]}&\ListeCards[\fpeval{16-\i},\fpeval{2*##1}]\\ + \rule{0pt}{0.12\hauteurcards}\Block{1-1}{\ListeSymbolesTrivial[##1]}&\ListeCards[\fpeval{4-\i},\fpeval{2*##1}]\\ }% \end{NiceTabular}% \end{center}% \end{MyboxTrivial}% - };% + };% + }% }% \end{Trame}% \clearpage% @@ -917,7 +693,6 @@ \end{MyboxTrivial}% }{}% }% - \setlength{\tabcolsep}{4\tabcolsep}% }% \newcommand\SolutionCarte[2]{% diff --git a/macros/latex/contrib/profcollege/latex/PfCCibleQOp.tex b/macros/latex/contrib/profcollege/latex/PfCCibleQOp.tex index cb5191d25a..cdd853a8fa 100644 --- a/macros/latex/contrib/profcollege/latex/PfCCibleQOp.tex +++ b/macros/latex/contrib/profcollege/latex/PfCCibleQOp.tex @@ -5,16 +5,16 @@ \xdef\RetiensNonDiviseurs{}% \anpcqo=#1% \bnpcqo=2% - \cnpcqo=1% + \cnpcqo=0% \whiledo{\bnpcqo<\anpcqo}{% \modulo{\the\anpcqo}{\the\bnpcqo}{}% \ifnum\remainder=0\relax - \ifnum\cnpcqo=1 + \cnpcqo=\numexpr\cnpcqo+1\relax + \ifnum\cnpcqo=1\relax \xdef\RetiensDiviseurs{\the\bnpcqo}% \else% \xdef\RetiensDiviseurs{\RetiensDiviseurs,\the\bnpcqo}% \fi% - \cnpcqo=\numexpr\cnpcqo+1% \else \ifnum\bnpcqo<10 \xdef\RetiensNonDiviseurs{\RetiensNonDiviseurs,\the\bnpcqo}% @@ -22,6 +22,9 @@ \fi% \bnpcqo=\numexpr\bnpcqo+1% }% + \ifnum\cnpcqo=0\relax% + \xdef\RetiensDiviseurs{1}% + \fi% }% \newtoks\toklistecibleA% @@ -35,6 +38,7 @@ \setKVdefault[CibleQO]{Couleur=Crimson,Rayon=2cm,ValeurMin=4,ValeurMax=10,Graines=false,Solution=false,Cibles=false,DivE=false,Style="<->"}% \defKV[CibleQO]{Graine=\setKV[CibleQO]{Graines}\PfCGraineAlea{#1}}% \defKV[CibleQO]{Cible=\setKV[CibleQO]{Cibles}}% + \NewDocumentCommand\CibleQuatreOperations{o}{% \useKVdefault[CibleQO]% \setKV[CibleQO]{#1}% @@ -56,6 +60,7 @@ \PfCCQODiviseurs{\PfCCibleQO}% \setsepchar{,}% \readlist*\PfCRetiensDiviseurs{\RetiensDiviseurs}% +% Il y a \PfCRetiensDiviseurslen{} diviseurs. \ifnum\PfCRetiensDiviseurslen=1\relax% \setKV[CibleQO]{DivE}% \fi diff --git a/macros/latex/contrib/profcollege/latex/PfCDefiTables.tex b/macros/latex/contrib/profcollege/latex/PfCDefiTables.tex index c4c120c920..20c48cb593 100644 --- a/macros/latex/contrib/profcollege/latex/PfCDefiTables.tex +++ b/macros/latex/contrib/profcollege/latex/PfCDefiTables.tex @@ -5,7 +5,7 @@ \setKVdefault[DefiTable]{Solution=false,Math=false,LargeurT=5mm,Graines=false,Creation=false,ValeurMin=1,ValeurMax=10,Restreint=false} \defKV[DefiTable]{Graine=\setKV[DefiTable]{Graines}}% -\newcommand\MelangeListeNew[2]{% +\NewDocumentCommand\MelangeListeNew{mm}{% % #1 Liste à mélanger % #2 Nombre d'éléments à conserver \setsepchar[*]{/}\ignoreemptyitems% @@ -57,30 +57,30 @@ \xdef\NombreDeProduitATester{\ListeDesProduitslen}% }% -\newcommand\DefiTableNombreLettreduCode[1]{% +\NewDocumentCommand\DefiTableNombreLettreduCode{m}{% \JeConstruisLesProduits{\useKV[DefiTable]{ValeurMin}}{\useKV[DefiTable]{ValeurMax}}% - \MelangeListeNew{\ListeDesProduitsFoo}{\NombreDeProduitATester} + \MelangeListeNew{\ListeDesProduitsFoo}{\NombreDeProduitATester}% % Les produits mélangés sont :\par \readlist*\ListeDesProduits{\faa}% - \xdef\ListeDesCaracteresFoo{a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/à/é/è/ê/ï/î/ô/ö/ù/ç/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O/P/Q/R/S/T/U/V/W/X/Y/Z/À/É/È/,/$?$/$;$/./$!$/$:$/-} + \xdef\ListeDesCaracteresFoo{a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/à/é/è/ê/ï/î/ô/ö/ù/ç/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O/P/Q/R/S/T/U/V/W/X/Y/Z/À/É/È/,/$?$/$;$/./$!$/$:$/-}% \savecomparemode% \comparestrict% - \xdef\PfCFooDepart{} + \xdef\PfCFooDepart{}% \StrLen{#1}[\LongueurMot]% \xintFor* ##1 in{\xintSeq{1}{\LongueurMot}}\do{% - \StrChar{#1}{##1}[\LettreMot] - \xdef\PfCFooDepart{\PfCFooDepart \LettreMot/} + \StrChar{#1}{##1}[\LettreMot]% + \xdef\PfCFooDepart{\PfCFooDepart \LettreMot/}% }% \setsepchar[*]{/}\reademptyitems% \readlist*\ListeDesLettres{\PfCFooDepart}% \xdef\PfCFooArrivee{\ListeDesLettres[1]}% \xintFor* ##1 in{\xintSeq{2}{\LongueurMot}}\do{% - \StrCompare{\ListeDesLettres[##1]}{\\}[\PfCRetiensEtoile] - \StrCompare{\ListeDesLettres[##1]}{ }[\PfCRetiensPara] + \StrCompare{\ListeDesLettres[##1]}{\\}[\PfCRetiensEtoile]% + \StrCompare{\ListeDesLettres[##1]}{ }[\PfCRetiensPara]% \xintifboolexpr{\PfCRetiensEtoile==0 || \PfCRetiensPara==0}{}{% \xdef\PfCTotal{0}% \xintFor* ##2 in{\xintSeq{1}{\fpeval{##1-1}}}\do{% - \StrCompare{\ListeDesLettres[##1]}{\ListeDesLettres[##2]}[\PfCRetiens] + \StrCompare{\ListeDesLettres[##1]}{\ListeDesLettres[##2]}[\PfCRetiens]% \xdef\PfCTotal{\fpeval{\PfCTotal+\PfCRetiens}}% }% \xintifboolexpr{\PfCTotal==\fpeval{##1-1}}{\xdef\PfCFooArrivee{\PfCFooArrivee/\ListeDesLettres[##1]}}{}% @@ -102,7 +102,7 @@ %Le caractère testé est \ListeTotaleDesCaracteres[##1]. On le compare à :% \xdef\PfCTotal{0}% \xintFor* ##2 in{\xintSeq{1}{\ListeDesLettresUniqueslen}}\do{% - \StrCompare{\ListeTotaleDesCaracteres[##1]}{\ListeDesLettresUniques[##2]}[\PfCRetiens] + \StrCompare{\ListeTotaleDesCaracteres[##1]}{\ListeDesLettresUniques[##2]}[\PfCRetiens]% \xdef\PfCTotal{\fpeval{\PfCTotal+\PfCRetiens}}% }% \xintifboolexpr{\PfCTotal==\ListeDesLettresUniqueslen}{\xdef\ListeCaracteresUniques{\ListeCaracteresUniques\ListeTotaleDesCaracteres[##1]/}}{}% @@ -110,44 +110,44 @@ %La liste des caractères uniques à ajouter \MelangeListeNew{\ListeCaracteresUniques}{\fpeval{\NombreDeProduitATester-\ListeDesLettresUniqueslen}}% %\par La liste des éléments à mélanger est :\par - \xdef\ListeDesCaracteresAUtiliser{} + \xdef\ListeDesCaracteresAUtiliser{}% \xintFor* ##1 in{\xintSeq{1}{\ListeDesLettresUniqueslen}}\do{% \xdef\ListeDesCaracteresAUtiliser{\ListeDesCaracteresAUtiliser \ListeDesLettresUniques[##1]/}% }% - \xdef\ListeDesCaracteresAUtiliser{\ListeDesCaracteresAUtiliser \faa} - \MelangeListeNew{\ListeDesCaracteresAUtiliser}{\NombreDeProduitATester} + \xdef\ListeDesCaracteresAUtiliser{\ListeDesCaracteresAUtiliser \faa}% + \MelangeListeNew{\ListeDesCaracteresAUtiliser}{\NombreDeProduitATester}% %Finalement, on utilise ces caractères :\par \ignoreemptyitems% - \readlist*\ListeFinaleDesCaracteres{\faa} - \restorecomparemode - \reademptyitems -} + \readlist*\ListeFinaleDesCaracteres{\faa}% + \restorecomparemode% + \reademptyitems% +}% -\newcommand\DefiTable[2][]{% +% \newcommand\DefiTable[2][]{% +\NewDocumentCommand\DefiTable{om}{% % 1 les clés % 2 la table de décodage \useKVdefault[DefiTable]% \setKV[DefiTable]{#1}% \ifboolKV[DefiTable]{Creation}{% \ifboolKV[DefiTable]{Graines}{\PfCGraineAlea{\useKV[DefiTable]{Graine}}}{}% - \DefiTableNombreLettreduCode{#2}% - \ifboolKV[DefiTable]{Restreint}{% + \DefiTableNombreLettreduCode{#2}% + \ifboolKV[DefiTable]{Restreint}{% \xdef\PfCNbColonnes{\fpeval{\useKV[DefiTable]{ValeurMax}-\useKV[DefiTable]{ValeurMin}+1}}% \begin{tabular}{|>{\columncolor{gray!15}}c|*{\PfCNbColonnes}{c|}} \hline \rowcolor{gray!15}$\times$&\xintFor* ##1 in {\xintSeq {1}{\PfCNbColonnes}}\do{% - \xintifForFirst{}{&}\fpeval{\useKV[DefiTable]{ValeurMin}+##1-1}% - }\\\hline% - \xintFor* ##1 in{\xintSeq{1}{10}}\do{% - ##1\xintFor* ##2 in{\xintSeq{\useKV[DefiTable]{ValeurMin}}{\useKV[DefiTable]{ValeurMax}}}\do{% - &\xintFor* ##3 in{\xintSeq{1}{\NombreDeProduitATester}}\do{% - \xintifboolexpr{\fpeval{##1*##2}==\ListeDesProduits[##3] 'and' any(\useKV[DefiTable]{ValeurMin}<=##2<=\useKV[DefiTable]{ValeurMax},\useKV[DefiTable]{ValeurMin}<=##1<=\useKV[DefiTable]{ValeurMax})}{\ListeFinaleDesCaracteres[##3]}{}% - }% - }\\\hline% + \xintifForFirst{}{&}\fpeval{\useKV[DefiTable]{ValeurMin}+##1-1}% + }\\\hline% + \xintFor* ##1 in{\xintSeq{1}{10}}\do{% + ##1\xintFor* ##2 in{\xintSeq{\useKV[DefiTable]{ValeurMin}}{\useKV[DefiTable]{ValeurMax}}}\do{% + &\xintFor* ##3 in{\xintSeq{1}{\NombreDeProduitATester}}\do{% + \xintifboolexpr{\fpeval{##1*##2}==\ListeDesProduits[##3] 'and' any(\useKV[DefiTable]{ValeurMin}<=##2<=\useKV[DefiTable]{ValeurMax},\useKV[DefiTable]{ValeurMin}<=##1<=\useKV[DefiTable]{ValeurMax})}{\ListeFinaleDesCaracteres[##3]}{}% }% - \end{tabular}% - }{% -% \begin{center} + }\\\hline% + }% + \end{tabular}% + }{% \begin{tabular}{|>{\columncolor{gray!15}}c|*{10}{c|}} \hline \rowcolor{gray!15}$\times$&\xintFor* ##1 in {\xintSeq {1}{10}}\do{% @@ -161,10 +161,9 @@ }\\\hline% }% \end{tabular}% -% \end{center} - } + }% }{% - \setsepchar[*]{§* }% + \setsepchar[*]{§* }% \readlist*\ListeDefiTableCode{#2}% \begin{NiceTabular}{>{\columncolor{gray!15}}{c}*{10}{c}}[hvlines] \rowcolor{gray!15}$\times$&\xintFor* ##1 in {\xintSeq {1}{10}}\do{% @@ -186,10 +185,12 @@ }% }% -\newcommand\DefiTableTexte[3][]{% +\NewDocumentCommand\DefiTableTexte{omm}{% \useKVdefault[DefiTable]% \setKV[DefiTable]{#1}% \ifboolKV[DefiTable]{Creation}{% + \ifboolKV[DefiTable]{Graines}{\PfCGraineAlea{\useKV[DefiTable]{Graine}}}{}% + \DefiTableNombreLettreduCode{#3}% \setsepchar[*]{\\* }% \readlist*\ListeDefiTableTableau{#3}% \xdef\ListeDefiTableMax{0}% diff --git a/macros/latex/contrib/profcollege/latex/PfCDessinAlgo.tex b/macros/latex/contrib/profcollege/latex/PfCDessinAlgo.tex new file mode 100644 index 0000000000..7c227831e1 --- /dev/null +++ b/macros/latex/contrib/profcollege/latex/PfCDessinAlgo.tex @@ -0,0 +1,370 @@ +%%% +% Dessin Algo +%%% +\newtoks\tokDessinAlgo% +\def\UpdatetoksDA#1\nil{\addtotok\tokDessinAlgo{#1,}}% + +\setKVdefault[DessinAlgo]{Solution=false,Largeur=14,Hauteur=14,Origine={(0,0)},Consignes=8,Enonce=false,Code=false,Relatif=false,Symbole=true}% +\defKV[DessinAlgo]{Traces=\setKV[DessinAlgo]{Code}}% +\defKV[DessinAlgo]{Couleur=\setKV[DessinAlgo]{Solution}}% + +\NewDocumentCommand\DessinAlgo{om}{% + \tokDessinAlgo{}% + \useKVdefault[DessinAlgo]% + \setKV[DessinAlgo]{#1}% + \setsepchar[*]{/}\ignoreemptyitems% + \readlist*\PfCListeDessinAlgo{#2}% + \foreachitem\compteur\in\PfCListeDessinAlgo{\expandafter\UpdatetoksDA\compteur\nil}% + \ifboolKV[DessinAlgo]{Relatif}{% + \BuildDessinAlgoRelatif{\the\tokDessinAlgo}% + }{% + \BuildDessinAlgo{\the\tokDessinAlgo}% + }% +}% + +\NewDocumentCommand\BuildDessinAlgoRelatif{m}{% + \ifluatex% + \mplibforcehmode% + \begin{mplibcode} + u:=1cm; + LongueurConsigne=\useKV[DessinAlgo]{Consignes}; + LargeurQuad=\useKV[DessinAlgo]{Largeur}; + HauteurQuad=\useKV[DessinAlgo]{Hauteur}; + pair A[][],B[]; + path zone; + zone=unitsquare scaled 3.5mm; + boolean Enonce,Code,Solution,Symbole; + Enonce=\useKV[DessinAlgo]{Enonce}; + Code=\useKV[DessinAlgo]{Code}; + Solution=\useKV[DessinAlgo]{Solution}; + Symbole=\useKV[DessinAlgo]{Symbole}; + color Couleur; + if Solution: + Couleur=\useKV[DessinAlgo]{Couleur}; + fi; + % + vardef DessineConsigne(text t)= + n:=0; + nborig:=0; + k=1; + l:=1; + %On détermine les points de départs; + for p_=t: + if pair p_: + nborig:=nborig+1; + if (n mod LongueurConsigne)>0: + l:=l-1; + elseif nborig=2: + l:=l-1; + fi; + k:=1; + n:=0; + B[nborig]=0.35*u*(k,2*l+0.5); + else: + if numeric p_: + n:=n+1; + NBorig[nborig]:=n; + if (n mod 2)=1: + Deplacement[nborig][(n+1) div 2]=p_; + else: + TourneAngle[nborig][n div 2]=p_ + fi; + fi; + fi; + endfor; + % On affiche + picture RetiensLong; + r:=0; + Long:=0; + h:=0; + for k=1 upto nborig: + if k>1: + r:=r-2; + Long:=0; + h:=0; + fi; + for l=1 step 2 until NBorig[nborig]-1: + if l=1: + RetiensLong:=image(label.rt(TEX("av "&decimal(Deplacement[k][(l+1) div 2])),(0,0))); + draw RetiensLong shifted (Long,5mm*r); + if nborig=1: + % + else: + label.lft(TEX("D$_"&decimal(k)&"$"),(Long,5mm*r)); + fi;% label(TEX(decimal(h)),3.5mm*(0,-h)) withcolor red; + Long:=Long+abs(lrcorner RetiensLong-llcorner RetiensLong)+1mm; + h:=h+1; + else: + EcartAngle:=TourneAngle[k][(l+1) div 2]-TourneAngle[k][(l-1) div 2]; + if EcartAngle>0: + if EcartAngle<180: + if Symbole: + RetiensLong:=image( + drawarrow ((point(1) of zone){dir90}..{dir180}(point(3) of zone)) shifted(1mm,-1mm); + label.rt(TEX("\ang{"&decimal(EcartAngle)&"}"),point(1) of zone); + ); + else: + RetiensLong:=image(label.rt(TEX("TG \ang{"&decimal(EcartAngle)&"}"),(0,0))); + fi; + else: + if Symbole: + RetiensLong:=image( + drawarrow ((point(0) of zone){dir90}..{dir0}(point(2) of zone)) shifted(1mm,-1mm); + label.rt(TEX("\ang{"&decimal(360-EcartAngle)&"}"),point(1) of zone); + ); + else: + RetiensLong:=image(label.rt(TEX("TD \ang{"&decimal(360-EcartAngle)&"}"),(0,0))); + fi; + fi; + else: + if abs(EcartAngle)<180: + if Symbole: + RetiensLong:=image( + drawarrow ((point(0) of zone){dir90}..{dir0}(point(2) of zone)) shifted(1mm,-1mm); + label.rt(TEX("\ang{"&decimal(abs(EcartAngle))&"}"),point(1) of zone); + ); + else: + RetiensLong:=image(label.rt(TEX("TD \ang{"&decimal(abs(EcartAngle))&"}"),(0,0))); + fi; + else: + if Symbole: + RetiensLong:=image( + drawarrow ((point(1) of zone){dir90}..{dir180}(point(3) of zone)) shifted(1mm,-1mm); + label.rt(TEX("\ang{"&decimal(360-abs(EcartAngle))&"}"),point(1) of zone); + ); + else: + RetiensLong:=image(label.rt(TEX("TG \ang{"&decimal(360-abs(EcartAngle))&"}"),(0,0))); + fi; + fi; + fi; + draw RetiensLong shifted (Long,5mm*r); + Long:=Long+abs(lrcorner RetiensLong-llcorner RetiensLong)+1mm; + %label(TEX(decimal(h)),3.5mm*(0,-h)) withcolor blue; + RetiensLong:=image(label.rt(TEX("Av "&decimal(Deplacement[k][(l+1) div 2])),(0,0))); + draw RetiensLong shifted (Long,5mm*r); + Long:=Long+abs(lrcorner RetiensLong-llcorner RetiensLong)+1mm; + h:=h+1; + %label(TEX(decimal(h)),3.5mm*(0,-h)) withcolor green; + fi; +% label(TEX(decimal(h mod 8)),3.5mm*(0,-h)) withcolor Purple; + if ((h mod LongueurConsigne)=0):% and (h>0): + %label(TEX("OKAYYYYYYY"),3.5mm*(0,-h)) withcolor Purple; + Long:=0; + r:=r-1; + h:=0; + fi; + endfor; + endfor; + enddef; + % + vardef DessinQuadrillage(text t)= + drawoptions(withcolor 0.7white); + for k=0 upto LargeurQuad: + trace (3.5mm*(k,0))--(3.5mm*(k,HauteurQuad)); + endfor; + for k=0 upto HauteurQuad: + trace (3.5mm*(0,k))--(3.5mm*(LargeurQuad,k)); + endfor; + drawoptions(); + % On détermine les points + n=0; + nborig:=0; + for p_=t: + if pair p_: + nborig:=nborig+1; + A[nborig][0]=3.5mm*p_; + n:=0; + else: + n:=n+1; + NombreOrig[nborig]:=n; + Nombre[nborig][n]=p_; + fi; + endfor; + for l=1 upto nborig: + for k=1 step 2 until NombreOrig[l]: + if (Nombre[l][k+1] mod 90)=0: + long:=3.5mm + else: + long:=sqrt(2)*3.5mm + fi; + A[l][(k+1) div 2]-A[l][k div 2]=long*Nombre[l][k]*(unitvector((1,0)-(0,0)) rotated Nombre[l][k+1]); + endfor; + endfor; + if nborig=1: + dotlabel("",A[nborig][0]); + label.ulft(TEX("D"),symetrie(A[nborig][1],A[nborig][0])); + drawarrow A[nborig][0]--(0.75[A[nborig][0],A[nborig][1]]); + else: + for k=1 upto nborig: + label(TEX("D$_"&decimal(k)&"$"),symetrie(A[k][1],A[k][0])); + dotlabel("",A[k][0]); + drawarrow A[k][0]--(0.75[A[k][0],A[k][1]]); + endfor; + fi; + enddef; + % + vardef DessineSolution= + for l=1 upto nborig: + for k=1 step 2 until NombreOrig[l]: + draw A[l][(k div 2)]--A[l][(k+1) div 2] withpen pencircle scaled 2 withcolor Couleur; + endfor; + endfor; + enddef; + if Enonce: + DessineConsigne(#1); + else: + DessinQuadrillage(#1); + if Code: + \useKV[DessinAlgo]{Traces}; + fi; + if Solution: + DessineSolution; + fi; + fi; + \end{mplibcode} + \fi% +}% + +\NewDocumentCommand\BuildDessinAlgo{m}{% + \ifluatex% + \mplibforcehmode% + \begin{mplibcode} + u:=1cm; + LongueurConsigne=\useKV[DessinAlgo]{Consignes}; + LargeurQuad=\useKV[DessinAlgo]{Largeur}; + HauteurQuad=\useKV[DessinAlgo]{Hauteur}; + pair A[][],B[]; + path zone; + zone=unitsquare scaled 3.5mm; + boolean Enonce,Code,Solution; + Enonce=\useKV[DessinAlgo]{Enonce}; + Code=\useKV[DessinAlgo]{Code}; + Solution=\useKV[DessinAlgo]{Solution}; + color Couleur; + if Solution: + Couleur=\useKV[DessinAlgo]{Couleur}; + fi; + % + vardef DessineConsigne(text t)= + n:=0; + nborig:=0; + k=1; + l:=1; + for p_=t: + if pair p_: + nborig:=nborig+1; + if (n mod LongueurConsigne)>0: + l:=l-1; + elseif nborig=2: + l:=l-1; + fi; + k:=1; + n:=0; + B[nborig]=0.35*u*(k,2*l+0.5); + else: + n:=n+1; +% draw (zone shifted(0.35*u*(k,2*l))); + if (n mod 2)=1: + label(TEX(decimal(p_)),(center zone) shifted(0.35*u*(k,2*l))); + k:=k+1; + else: + if p_=0: + drawarrow ((point(0) of (unitsquare scaled 3.5mm))--(point(1) of (unitsquare scaled 3.5mm))) shifted ((center zone) shifted(u*(0.35*k-0.175,0.35*2*l))); + elseif p_=45: + drawarrow ((point(0) of (unitsquare scaled 3.5mm))--(point(2) of (unitsquare scaled 3.5mm))) shifted ((llcorner zone) shifted(u*0.35*(k,2*l))); + elseif p_=90: + drawarrow ((point(0) of (unitsquare scaled 3.5mm))--(point(3) of (unitsquare scaled 3.5mm))) shifted ((llcorner zone) shifted(u*(0.35*k+0.175,0.35*2*l))); + elseif p_=135: + drawarrow ((point(1) of (unitsquare scaled 3.5mm))--(point(3) of (unitsquare scaled 3.5mm))) shifted ((llcorner zone) shifted(u*0.35*(k,2*l))); + elseif p_=180: + drawarrow ((point(1) of (unitsquare scaled 3.5mm))--(point(0) of (unitsquare scaled 3.5mm))) shifted ((center zone) shifted(u*(0.35*k-0.175,0.35*2*l))); + elseif p_=-45: + drawarrow ((point(3) of (unitsquare scaled 3.5mm))--(point(1) of (unitsquare scaled 3.5mm))) shifted ((llcorner zone) shifted(u*0.35*(k,2*l))); + elseif p_=-90: + drawarrow ((point(3) of (unitsquare scaled 3.5mm))--(point(0) of (unitsquare scaled 3.5mm))) shifted ((llcorner zone) shifted(u*(0.35*k+0.175,0.35*2*l))); + elseif p_=-135: + drawarrow ((point(2) of (unitsquare scaled 3.5mm))--(point(0) of (unitsquare scaled 3.5mm))) shifted ((llcorner zone) shifted(u*0.35*(k,2*l))); + fi; + drawoptions(); + k:=k+2; + fi; + if (k mod (2*LongueurConsigne+(LongueurConsigne)+1))>0: + else: + l:=l-1; + k:=1; + fi; + fi; + endfor; + if nborig=1: + label.lft(TEX("D"),B[1]); + else: + for k=1 upto nborig: + label.lft(TEX("D$_"&decimal(k)&"$"),B[k]); + endfor; + fi; + enddef; + % + vardef DessinQuadrillage(text t)= + drawoptions(withcolor 0.7white); + for k=0 upto LargeurQuad: + trace (3.5mm*(k,0))--(3.5mm*(k,HauteurQuad)); + endfor; + for k=0 upto HauteurQuad: + trace (3.5mm*(0,k))--(3.5mm*(LargeurQuad,k)); + endfor; + drawoptions(); + % Les points + n=0; + nborig:=0; + for p_=t: + if pair p_: + nborig:=nborig+1; + A[nborig][0]=3.5mm*p_; + n:=0; + else: + n:=n+1; + NombreOrig[nborig]:=n; + Nombre[nborig][n]=p_; + fi; + endfor; + for l=1 upto nborig: + for k=1 step 2 until NombreOrig[l]: + if (Nombre[l][k+1] mod 90)=0: + long:=3.5mm + else: + long:=sqrt(2)*3.5mm + fi; + A[l][(k+1) div 2]-A[l][k div 2]=long*Nombre[l][k]*(unitvector((1,0)-(0,0)) rotated Nombre[l][k+1]); + endfor; + endfor; + % + if nborig=1: + dotlabel.ulft(TEX("D"),A[nborig][0]); + else: + for k=1 upto nborig: + dotlabel.ulft(TEX("D$_"&decimal(k)&"$"),A[k][0]); + endfor; + fi; + enddef; + % + vardef DessineSolution= + for l=1 upto nborig: + for k=1 step 2 until NombreOrig[l]: + draw A[l][(k div 2)]--A[l][(k+1) div 2] withpen pencircle scaled 2 withcolor Couleur; + endfor; + endfor; + enddef; + if Enonce: + DessineConsigne(#1); + else: + DessinQuadrillage(#1); + if Code: + \useKV[DessinAlgo]{Traces}; + fi; + if Solution: + DessineSolution; + fi; + fi; + \end{mplibcode} + \fi% +}%
\ No newline at end of file diff --git a/macros/latex/contrib/profcollege/latex/PfCFractionAireCarre.tex b/macros/latex/contrib/profcollege/latex/PfCFractionAireCarre.tex new file mode 100644 index 0000000000..dbfe8109d2 --- /dev/null +++ b/macros/latex/contrib/profcollege/latex/PfCFractionAireCarre.tex @@ -0,0 +1,158 @@ +%%% +% Fraction d'aire d'un carré +%%% +\setKVdefault[JeuAireCarre]{Couleur=LightSteelBlue,CouleurFond=Cornsilk,Perso=false,Graines=false,Parts=3,Longueur=4,NbPoints=2,Angle=0}% +\defKV[JeuAireCarre]{Graine=\setKV[JeuAireCarre]{Graines}\PfCGraineAlea{#1}}% +\defKV[JeuAireCarre]{ListeParts=\setKV[JeuAireCarre]{Perso}\xdef\PfCFooJeuAireCarre{#1}}% +\NewDocumentCommand\FractionAireCarre{o}{% + \useKVdefault[JeuAireCarre]% + \setKV[JeuAireCarre]{#1}% + \ifboolKV[JeuAireCarre]{Perso}{% + \BuildJeuAireCarre{\PfCFooJeuAireCarre}% + }{% + \BuildJeuAireCarre{}% + }% +}% + +\def\BuildJeuAireCarreCode{% + vardef ChoixParmiEntier(expr nentier,nbretiens)= + numeric ListeInitiale[],ListeFinale[]; + for l=1 upto nentier: + ListeInitiale[l]=l; + ListeIntermed[l]=l; + endfor; + maxx=nentier; + for l=1 upto nbretiens: + intermed:=ceiling(uniformdeviate(maxx)); + ListeFinale[l]=ListeInitiale[intermed]; + f:=0; + for g=1 upto nentier: + if g<>intermed: + f:=f+1; + ListeIntermed[f]:=ListeInitiale[g]; + fi; + endfor; + maxx:=nentier-l; + for h=1 upto maxx: + ListeInitiale[h]:=ListeIntermed[h]; + endfor; + endfor; + enddef; + % On crée un Quick Sort + def QS(expr ndeb,nfin)= + begingroup + save v,m,x; + if ndeb<nfin: + v:=ListeFinale[cpt[ndeb]]; + m:=ndeb; + for i=(ndeb+1) upto nfin: + if ListeFinale[cpt[i]]<v: + m:=m+1; + x:=cpt[m];cpt[m]:=cpt[i];cpt[i]:=x; + fi + endfor; + x:=cpt[m];cpt[m]:=cpt[ndeb];cpt[ndeb]:=x; + QS(ndeb,m-1); + QS(m+1,nfin); + fi + endgroup + enddef; + % + vardef PartsPerso(text t)= + nbptsperso:=0; + for p_=t: + nbptsperso:=nbptsperso+1; + Base[nbptsperso]=point(length CarreSupport*p_/(4*Parts)) of CarreSupport; + endfor; + NbPoints:=nbptsperso; + enddef; + % + Cote=\useKV[JeuAireCarre]{Longueur}; + Parts=\useKV[JeuAireCarre]{Parts}; + NbPoints=\useKV[JeuAireCarre]{NbPoints}; + Angle=\useKV[JeuAireCarre]{Angle}; + color Couleur,CouleurFond; + CouleurFond=\useKV[JeuAireCarre]{CouleurFond}; + Couleur=\useKV[JeuAireCarre]{Couleur}; + boolean Perso; + Perso=\useKV[JeuAireCarre]{Perso}; + pair A[],M[],Base[]; + A1=(0,0); + A2=pointarc(cercles(A1,Cote*cm),45); + A3=rotation(A1,A2,-90); + A4-A3=A1-A2; + path CarreSupport; + CarreSupport=polygone(A1,A2,A3,A4); + Base0=A[1]; + for k=0 upto (4*Parts): + M[k]=point(length CarreSupport*k/(4*Parts)) of CarreSupport; + endfor; +} +% +\NewDocumentCommand\BuildJeuAireCarre{m}{% + \ifluatex + \mplibforcehmode + \begin{mplibcode} + \BuildJeuAireCarreCode + if Perso=false: + if NbPoints>2: + ChoixParmiEntier(4*Parts-1,NbPoints); + else: + ChoixParmiEntier(3*Parts-1,NbPoints); + fi; + for k=1 upto NbPoints: + cpt[k]=k; + endfor; + QS(1,NbPoints); + for k=1 upto NbPoints: + place:=ListeFinale[cpt[k]]; + Base[k]=M[place]; + endfor; + else: + PartsPerso(#1); + fi; + fill CarreSupport withcolor CouleurFond; + fill Base0 for k=1 upto NbPoints:--Base[k] endfor --cycle withcolor Couleur; + trace Base0 for k=1 upto NbPoints:--Base[k] endfor --cycle; + trace CarreSupport; + for k=0 upto (4*Parts): + draw cercles(M[k],0.5mm); + endfor; + picture Retiens; + Retiens=currentpicture; + currentpicture:=nullpicture; + trace rotation(Retiens,iso(A1,A3),Angle); + \end{mplibcode} + \else + \begin{mpost}[mpsettings={\BuildJeuAireCarreCode}] + if Perso=false: + if NbPoints>2: + ChoixParmiEntier(4*Parts-1,NbPoints); + else: + ChoixParmiEntier(3*Parts-1,NbPoints); + fi; + for k=1 upto NbPoints: + cpt[k]=k; + endfor; + QS(1,NbPoints); + for k=1 upto NbPoints: + place:=ListeFinale[cpt[k]]; + Base[k]=M[place]; + endfor; + else: + PartsPerso(#1); + fi; + fill CarreSupport withcolor CouleurFond; + fill Base0 for k=1 upto NbPoints:--Base[k] endfor --cycle withcolor Couleur; + trace Base0 for k=1 upto NbPoints:--Base[k] endfor --cycle; + trace CarreSupport; + for k=0 upto (4*Parts): + draw cercles(M[k],0.5mm); + endfor; + picture Retiens; + Retiens=currentpicture; + currentpicture:=nullpicture; + trace rotation(Retiens,iso(A1,A3),Angle); + \end{mpost} + \fi +}%
\ No newline at end of file diff --git a/macros/latex/contrib/profcollege/latex/PfCFractionNombre.tex b/macros/latex/contrib/profcollege/latex/PfCFractionNombre.tex new file mode 100644 index 0000000000..f373aecc6c --- /dev/null +++ b/macros/latex/contrib/profcollege/latex/PfCFractionNombre.tex @@ -0,0 +1,416 @@ +%%% +% Fraction Nombre +%%% +\newtoks\tokFractionNombrePerso% +\def\UpdatetoksFN#1\nil{\addtotok\tokFractionNombrePerso{"#1",}}% + +\setKVdefault[ClesFN]{Unite=5cm,Aire=false,Solution=false,Quadrillage=false,PasQuad=5mm,HautQuad=3,LargQuad=8,Vide=false,Creation=false,Couleur=blue,UniteAire=1x1}% +\defKV[ClesFN]{Perso=\setKV[ClesFN]{Creation}\xdef\PfCFooCheminFN{#1}}% + +\NewDocumentCommand\FractionNombre{om}{% + \useKVdefault[ClesFN]% + \setKV[ClesFN]{#1}% + \tokFractionNombrePerso{}% + \ifboolKV[ClesFN]{Creation}{% + \setsepchar{,}\ignoreemptyitems% + \readlist*\PfCListeDeplacements{\PfCFooCheminFN}% + \foreachitem\compteur\in\PfCListeDeplacements{\expandafter\UpdatetoksFN\compteur\nil}% + }{}% + \StrCut{#2}{/}\PfCNumA\PfCNumB% + \ifboolKV[ClesFN]{Aire}{% + \StrCut{\useKV[ClesFN]{UniteAire}}{x}\PfCAirex\PfCAirey% + \ifboolKV[ClesFN]{Creation}{% + \BuildFractionNombreAirePerso{\PfCNumA}{\PfCNumB}{\PfCAirex}{\PfCAirey}{\the\tokFractionNombrePerso}% + }{% + \BuildFractionNombreAire{\PfCNumA}{\PfCNumB}{\PfCAirex}{\PfCAirey}% + }% + }{% + \ifboolKV[ClesFN]{Quadrillage}{% + \BuildFractionNombreQuadrillage{\PfCNumA}{\PfCNumB}{\the\tokFractionNombrePerso}% + }{% + \BuildFractionNombreSegment{\PfCNumA}{\PfCNumB}% + }% + }% +}% + +\NewDocumentCommand\BuildFractionNombreAirePerso{mmmmm}{% + \ifluatex% + \mplibforcehmode% + \begin{mplibcode} + vardef LireMotif(text t)= + lmotif=0; + hmotif=0; + for p_=t: + hmotif:=hmotif+1; + if lmotif<(length p_): + lmotif:=length p_; + fi; + endfor; + enddef; + % + vardef PlacerMotif(text t)= + ChoixLigneD=hmotif+ceiling(uniformdeviate(HautQuad-1-hmotif)); + ChoixColonneD=ceiling(uniformdeviate(LargQuad-#3-1-lmotif)); + Colonne:=ChoixColonneD; + Ligne=ChoixLigneD; + for p_=t: + Colonne:=ChoixColonneD; + for k=0 upto ((length p_)-1): + if (substring(k,k+1) of p_)="x": + fill ((unitsquare scaled 5mm) shifted (5mm*(Colonne-1,Ligne-1))) withcolor LightSteelBlue; + fi; + Colonne:=Colonne+1; + endfor; + Ligne:=Ligne-1; + endfor; + enddef; + % + PasQuad=\useKV[ClesFN]{PasQuad}; + HautQuad=\useKV[ClesFN]{HautQuad}; + LargQuad=\useKV[ClesFN]{LargQuad}; + pair A,B,C,D,U[]; + A=(0,0); + B-A=PasQuad*(LargQuad,0); + C-B=PasQuad*(0,HautQuad); + D-C=A-B; + % l'unité + U0=C; + U1-U0=#3*PasQuad*(-1,0); + U3-U0=#4*PasQuad*(0,-1); + U2-U3=U1-U0; + % + LireMotif(#5); + PlacerMotif(#5); + % Tracage + fill polygone(U0,U1,U2,U3) withcolor 0.7white; + label.top(TEX("\textbf{1 ua}"),iso(U1,U0)); + %Le quadrillage + trace polygone(A,B,C,D); + for k=1 upto LargQuad-1: + trace (k/LargQuad)[A,B]--(k/LargQuad)[D,C]; + endfor; + for k=1 upto HautQuad-1: + trace (k/HautQuad)[A,D]--(k/HautQuad)[B,C]; + endfor; + \end{mplibcode} + \fi% +}% + +\NewDocumentCommand\BuildFractionNombreAire{mmmm}{% + \ifluatex% + \mplibforcehmode% + \begin{mplibcode} + boolean Impossible[][]; + % + vardef InitialisationZone= + for k=-1 upto HautQuad+1: + for l=-1 upto LargQuad+1: + Impossible[k][l]=true; + endfor; + endfor; + for k=1 upto HautQuad-1: + for l=1 upto LargQuad-#3-1: + Impossible[k][l]:=false; + endfor; + endfor; + enddef; + % + vardef RAZZone= + pair PileChemin[]; + indiceChemin:=0; + enddef; + % + def PushChemin(expr tt)= + if indiceChemin<1: + PileChemin[1]:=tt; + indiceChemin:=1; + else: + PileChemin[indiceChemin+1]:=tt; + indiceChemin:=indiceChemin+1; + fi; + enddef; + % + def PopChemin= + currentpicture:=nullpicture; + RAZZone; + for k=-1 upto HautQuad: + for l=-1 upto LargQuad: + Impossible[k][l]:=true; + endfor; + endfor; + for k=1 upto HautQuad-1: + for l=1 upto LargQuad-#3-1: + Impossible[k][l]:=false; + endfor; + endfor; + %Redemarrage + nbcaseschoisies:=1; + PushChemin((ChoixLigneD,ChoixColonneD)); + fill ((unitsquare scaled 5mm) shifted (5mm*(ChoixColonneD-1,ChoixLigneD-1))) withcolor LightSteelBlue; + Impossible[ChoixLigneD][ChoixColonneD]:=true; + VoisinDispo(ChoixLigneD,ChoixColonneD); + enddef; + % + %Pile des cases voisines de la case parcourue + pair PileVoisin[]; + numeric indiceVoisin; + indiceVoisin=0; + % + vardef RAZPileVoisin= + indiceVoisin:=0; + enddef; + % + def PushVoisin(expr tt)= + if indiceVoisin<1: + PileVoisin[1]:=tt; + indiceVoisin:=1; + else: + PileVoisin[indiceVoisin+1]:=tt; + indiceVoisin:=indiceVoisin+1; + fi; + enddef; + % + vardef VoisinDispo(expr la,lo)= + RAZPileVoisin; + numeric nbvoisin; + nbvoisin=0; + if Impossible[la+1][lo]=false: + nbvoisin:=nbvoisin+1; + PushVoisin((la+1,lo)); + fi; + if Impossible[la-1][lo]=false: + nbvoisin:=nbvoisin+1; + PushVoisin((la-1,lo)); + fi; + if Impossible[la][lo+1]=false: + nbvoisin:=nbvoisin+1; + PushVoisin((la,lo+1)); + fi; + if Impossible[la][lo-1]=false: + nbvoisin:=nbvoisin+1; + PushVoisin((la,lo-1)); + fi; + enddef; + % + PasQuad=\useKV[ClesFN]{PasQuad}; + HautQuad=\useKV[ClesFN]{HautQuad}; + LargQuad=\useKV[ClesFN]{LargQuad}; + pair A,B,C,D,U[]; + A=(0,0); + B-A=PasQuad*(LargQuad,0); + C-B=PasQuad*(0,HautQuad); + D-C=A-B; + % l'unité + U0=C; + U1-U0=#3*PasQuad*(-1,0); + U3-U0=#4*PasQuad*(0,-1); + U2-U3=U1-U0; + % Le nombres total de cases à colorier + NbTotalCasesAColorier=((#1*#3*#4)/#2); + NbTotalCasesRestantes=HautQuad*(LargQuad-#3-1); + % + InitialisationZone; + RAZZone; + % + ChoixLigneD=ceiling(uniformdeviate(HautQuad-1)); + ChoixColonneD=ceiling(uniformdeviate(LargQuad-#3-1)); + % + PushChemin((ChoixLigneD,ChoixColonneD)); + nbcaseschoisies=1; + fill ((unitsquare scaled 5mm) shifted (5mm*(ChoixColonneD-1,ChoixLigneD-1))) withcolor LightSteelBlue; + Impossible[ChoixLigneD][ChoixColonneD]:=true; + VoisinDispo(ChoixLigneD,ChoixColonneD); + % Le "parcours" + forever: exitif nbcaseschoisies>NbTotalCasesAColorier-1; + nb:=ceiling(uniformdeviate(nbvoisin)); + if nb>0: + for k=1 upto nbvoisin: + Impossible[xpart(PileVoisin[nb])][ypart(PileVoisin[nb])]:=true; + endfor; + PushChemin((xpart(PileVoisin[nb]),ypart(PileVoisin[nb]))); + nbcaseschoisies:=nbcaseschoisies+1; + fill ((unitsquare scaled 5mm) shifted (5mm*(ypart(PileVoisin[nb])-1,xpart(PileVoisin[nb])-1))) withcolor LightSteelBlue; + VoisinDispo(xpart(PileChemin[indiceChemin]),ypart(PileChemin[indiceChemin])); + else: + PopChemin; + fi; + endfor; + % Tracage + fill polygone(U0,U1,U2,U3) withcolor 0.7white; + label.top(TEX("\textbf{1 ua}"),iso(U1,U0)); + %Le quadrillage + trace polygone(A,B,C,D); + for k=1 upto LargQuad-1: + trace (k/LargQuad)[A,B]--(k/LargQuad)[D,C]; + endfor; + for k=1 upto HautQuad-1: + trace (k/HautQuad)[A,D]--(k/HautQuad)[B,C]; + endfor; + \end{mplibcode} + \fi +}% + +\NewDocumentCommand\BuildFractionNombreSegment{mm}{% + \ifluatex% + \mplibforcehmode% + \begin{mplibcode} + Unite:=\useKV[ClesFN]{Unite}; + boolean Solution,Vide; + Solution=\useKV[ClesFN]{Solution}; + Vide=\useKV[ClesFN]{Vide}; + color CoulFN; + CoulFN=\useKV[ClesFN]{Couleur}; + Num:=#1; + Pas:=#2; + pair A,B,C,D; + A=(0,0); + B=Unite*(1,0); + if Num>Pas: + C=((Num+1)/Pas)[A,B]; + Total=Num+1; + else: + C=B; + Total=Pas; + fi; + D=(Num/Pas)[A,B]; + trace segment(A,C); + for k=0 upto Total: + trace ((0,-1mm)--(0,1mm)) shifted ((k/Pas)[A,B]); + endfor; + trace cotationmil(A,B,5mm,15,TEX("1 ul")); + if Solution: + draw (A--D) withpen pencircle scaled 2 withcolor CoulFN; + trace cotationmil(A,D,-5mm,25,TEX("$?=\dfrac{"&decimal(#1)&"}{"&decimal(#2)&"}$~ul")); + else: + if Vide: + else: + trace cotationmil(A,D,-5mm,25,TEX("$?=\dots$~ul")); + fi; + fi; + \end{mplibcode} + \fi% +}% + +\NewDocumentCommand\BuildFractionNombreQuadrillage{mmm}{% + \ifluatex% + \mplibforcehmode% + \begin{mplibcode} + Unite:=#2;%\useKV[ClesFN]{Unite};%en carreaux + HautQuad:=\useKV[ClesFN]{HautQuad}; + Largeur:=Unite;%en carreaux + boolean Solution,Vide,Creation; + Solution=\useKV[ClesFN]{Solution}; + Vide=\useKV[ClesFN]{Vide}; + Creation=\useKV[ClesFN]{Creation}; + color CoulFN; + CoulFN=\useKV[ClesFN]{Couleur}; + Num:=#1; + Pas:=#2; + PasQuad:=\useKV[ClesFN]{PasQuad}; + pair A,B,C,D; + A=(0,0); + B=(((#1 div #2)+1)*Unite+1)*PasQuad*(1,0); + C-B=(0,HautQuad*PasQuad); + D-C=A-B; + trace polygone(A,B,C,D); + TotalLargeur=(((#1 div #2)+1)*Unite+1); + for k=1 upto TotalLargeur-1: + trace (k/TotalLargeur)[A,B]--(k/TotalLargeur)[D,C]; + endfor; + for k=1 upto HautQuad-1: + trace (k/HautQuad)[A,D]--(k/HautQuad)[B,C]; + endfor; + % Macro pour le chemin perso + vardef RemplirChemin(text t)= + nbpoints:=0; + % On compte le dénivelé + denivele=0; + denivmax:=0; + denivmin:=0; + for p_=t: + if p_="+": + denivmax:=denivmax+1; + elseif p_="-": + denivmin:=denivmin-1; + fi; + endfor; + depart:=-(denivmin)+floor(uniformdeviate(HautQuad-2-abs(denivmax-abs(denivmin)))); + ch[0]=PasQuad*(0,depart); + for p_=t: + nbpoints:=nbpoints+1; + if p_=">": + ch[nbpoints]=ch[nbpoints-1]+PasQuad*(1,0); + elseif p_="<": + ch[nbpoints]=ch[nbpoints-1]+PasQuad*(-1,0); + elseif p_="+": + ch[nbpoints]=ch[nbpoints-1]+PasQuad*(0,1); + elseif p_="-": + ch[nbpoints]=ch[nbpoints-1]+PasQuad*(0,-1); + fi; + endfor; + enddef; + % On choisit le départ. + pair ch[]; + numeric xe[],ye[]; + if Creation: + RemplirChemin(#3); + else: + depart:=floor(uniformdeviate(HautQuad-1)); + ch[0]=PasQuad*(0,depart); + xe0=0; + ye0=depart; + for k=1 upto #1: + if (k mod 2)=1: + ch[k]-ch[k-1]=PasQuad*(1,0); + xe[k]=xe[k-1]+1; + ye[k]=ye[k-1]; + else: + if ye[k-1]=0: + alea:=uniformdeviate(2); + if alea<1: + ch[k]-ch[k-1]=PasQuad*(0,1); + xe[k]=xe[k-1]; + ye[k]=ye[k-1]+1; + else: + ch[k]-ch[k-1]=PasQuad*(1,0); + xe[k]=xe[k-1]+1; + ye[k]=ye[k-1]; + fi; + elseif ye[k-1]=2: + alea:=uniformdeviate(2); + if alea<1: + ch[k]-ch[k-1]=PasQuad*(0,-1); + xe[k]=xe[k-1]; + ye[k]=ye[k-1]-1; + else: + ch[k]-ch[k-1]=PasQuad*(1,0); + xe[k]=xe[k-1]+1; + ye[k]=ye[k-1]; + fi; + else: + alea:=uniformdeviate(3); + if alea<1: + ch[k]-ch[k-1]=PasQuad*(0,1); + xe[k]=xe[k-1]; + ye[k]=ye[k-1]+1; + elseif alea<2: + ch[k]-ch[k-1]=PasQuad*(1,0); + xe[k]=xe[k-1]+1; + ye[k]=ye[k-1]; + else: + ch[k]-ch[k-1]=PasQuad*(0,-1); + xe[k]=xe[k-1]; + ye[k]=ye[k-1]-1; + fi; + fi; + fi; + endfor; + fi; + if Vide=false: + trace ch[0] for k=1 upto #1:--ch[k] endfor withpen pencircle scaled 2 withcolor CoulFN; + fi; + trace cotationmil(D,(D+#2*(PasQuad,0)),5mm,15,TEX("1 ul")); + trace segment(D,D+#2*(PasQuad,0)) withpen pencircle scaled 1.5; + \end{mplibcode} + \fi +}%
\ No newline at end of file diff --git a/macros/latex/contrib/profcollege/latex/PfCGeometrie.tex b/macros/latex/contrib/profcollege/latex/PfCGeometrie.tex index f7829c73e7..ab15f8754e 100644 --- a/macros/latex/contrib/profcollege/latex/PfCGeometrie.tex +++ b/macros/latex/contrib/profcollege/latex/PfCGeometrie.tex @@ -21,10 +21,10 @@ typetrace:="3D"; typerepre:="persp"; fi; - xa=xpart(Coinbg); - xb=xpart(Coinhd); - ya=ypart(Coinbg); - yb=ypart(Coinhd); + xa:=xpart(Coinbg); + xb:=xpart(Coinhd); + ya:=ypart(Coinbg); + yb:=ypart(Coinhd); feuille(xa,ya,xb,yb); _tfig:=if (xb-xa)>(yb-ya): (xb-xa) else: (yb-ya) fi; _tfig:=2*_tfig; @@ -48,10 +48,10 @@ typerepre:="persp"; fi;} ]% - xa=xpart(Coinbg); - xb=xpart(Coinhd);; - ya=ypart(Coinbg); - yb=ypart(Coinhd); + xa:=xpart(Coinbg); + xb:=xpart(Coinhd);; + ya:=ypart(Coinbg); + yb:=ypart(Coinhd); feuille(xa,ya,xb,yb); _tfig:=if (xb-xa)>(yb-ya): (xb-xa) else: (yb-ya) fi; _tfig:=2*_tfig; diff --git a/macros/latex/contrib/profcollege/latex/PfCJeuRangement.tex b/macros/latex/contrib/profcollege/latex/PfCJeuRangement.tex index 09b1dc7d68..6508e6cd1a 100644 --- a/macros/latex/contrib/profcollege/latex/PfCJeuRangement.tex +++ b/macros/latex/contrib/profcollege/latex/PfCJeuRangement.tex @@ -1,5 +1,6 @@ -\setKVdefault[JeuRgt]{Creation=false,Deno=12,Graines=false,Largeur=15pt,Hauteur=20pt,Negatif=false,Decimaux=false,Solution=false,ValeurMin=2,ValeurMax=50} +\setKVdefault[JeuRgt]{Creation=false,Deno=12,Graines=false,Largeur=15pt,Hauteur=20pt,Negatif=false,Decimaux=false,Solution=false,ValeurMin=2,ValeurMax=50,Exposants=false} \defKV[JeuRgt]{Graine=\setKV[JeuRgt]{Graines}}% +\defKV[JeuRgt]{Exposant=\setKV[JeuRgt]{Exposants}\setKV[JeuRgt]{Deno=1}}% \newlength{\PfCJeuRgtH} @@ -21,17 +22,23 @@ % Liste des nombres \ifboolKV[JeuRgt]{Creation}{% \xdef\ListeDesChoix{}% - \ifboolKV[JeuRgt]{Negatif}{% - \xdef\ListeDesChoix{-1}% + \ifboolKV[JeuRgt]{Exposants}{% \xintFor* ##1 in{\xintSeq{\useKV[JeuRgt]{ValeurMin}}{\useKV[JeuRgt]{ValeurMax}}}\do{% - \xdef\ListeDesChoix{\ListeDesChoix,-##1}% - }% - \xintFor* ##1 in{\xintSeq{\useKV[JeuRgt]{ValeurMin}}{\useKV[JeuRgt]{ValeurMax}}}\do{% - \xdef\ListeDesChoix{\ListeDesChoix,##1}% + \xdef\ListeDesChoix{\ListeDesChoix,\fpeval{##1*(10**\useKV[JeuRgt]{Exposant})+randint(0,(10**\useKV[JeuRgt]{Exposant})-1)}}% }% }{% - \xintFor* ##1 in{\xintSeq{\useKV[JeuRgt]{ValeurMin}}{\useKV[JeuRgt]{ValeurMax}}}\do{% - \xdef\ListeDesChoix{\ListeDesChoix,##1}% + \ifboolKV[JeuRgt]{Negatif}{% + \xdef\ListeDesChoix{-1}% + \xintFor* ##1 in{\xintSeq{\useKV[JeuRgt]{ValeurMin}}{\useKV[JeuRgt]{ValeurMax}}}\do{% + \xdef\ListeDesChoix{\ListeDesChoix,-##1}% + }% + \xintFor* ##1 in{\xintSeq{\useKV[JeuRgt]{ValeurMin}}{\useKV[JeuRgt]{ValeurMax}}}\do{% + \xdef\ListeDesChoix{\ListeDesChoix,##1}% + }% + }{% + \xintFor* ##1 in{\xintSeq{\useKV[JeuRgt]{ValeurMin}}{\useKV[JeuRgt]{ValeurMax}}}\do{% + \xdef\ListeDesChoix{\ListeDesChoix,##1}% + }% }% }% \MelangeListe{\ListeDesChoix}{\LongueurMot}% diff --git a/macros/latex/contrib/profcollege/latex/PfCMulJal.tex b/macros/latex/contrib/profcollege/latex/PfCMulJal.tex new file mode 100644 index 0000000000..befce7a110 --- /dev/null +++ b/macros/latex/contrib/profcollege/latex/PfCMulJal.tex @@ -0,0 +1,148 @@ +%%% +% Multiplication par jalousie +%%% +\setKVdefault[MulJal]{Solution=false,CouleurTab=gray!15}% +\defKV[MulJal]{CouleurSolution=\setKV[MulJal]{Solution}}% +% +\NewDocumentCommand\MulJalousie{om}{% + \useKVdefault[MulJal]% + \setKV[MulJal]{#1}% + \setsepchar{x}\ignoreemptyitems% + \readlist*\PfCMulJal{#2}% + \ifboolKV[MulJal]{Solution}{\colorlet{CouleurSolution}{\useKV[MulJal]{CouleurSolution}}}{\colorlet{CouleurSolution}{black}}% + % Les facteurs sont \showitems\PfCMulJal[]. + \BuildTabMulJal% +}% + +\NewDocumentCommand\BuildTabMulJal{}{% + \StrLen{\PfCMulJal[1]}[\PremierFacteurlen]% + \StrLen{\PfCMulJal[2]}[\DeuxiemeFacteurlen]% + \xdef\PfCMulJalPdt{\fpeval{\PfCMulJal[1]*\PfCMulJal[2]}}% + \StrLen{\PfCMulJalPdt}[\Produitlen]% + \StrChar{\PfCMulJal[1]}{1}[\PfCMulA]% + \StrChar{\PfCMulJal[2]}{1}[\PfCMulB]% + \xdef\PfCMulC{\fpeval{\PfCMulA*\PfCMulB}}% + \quotient{\PfCMulC}{10}\relax% + \xdef\Report{\the\intquotient/}% + \xintFor* ##1 in{\xintSeq{2}{\fpeval{\PremierFacteurlen+\DeuxiemeFacteurlen}}}\do{% + \xintFor* ##2 in{\xintSeq{1}{\DeuxiemeFacteurlen}}\do{% + \xintFor* ##3 in{\xintSeq{1}{\PremierFacteurlen}}\do{% + \xintifboolexpr{##2+##3==##1}{% + \ifnum##2=1% + \ifnum##3<\PremierFacteurlen% + \StrChar{\PfCMulJal[1]}{\fpeval{##3+1}}[\PfCMulA]% + \StrChar{\PfCMulJal[2]}{##2}[\PfCMulB]% + \xdef\PfCMulC{\fpeval{\PfCMulA*\PfCMulB}}% + \quotient{\PfCMulC}{10}\relax% + \xdef\Report{\Report \the\intquotient}% + \fi% + \fi% + \StrChar{\PfCMulJal[1]}{##3}[\PfCMulA]% + \StrChar{\PfCMulJal[2]}{##2}[\PfCMulB]% + \xdef\PfCMulC{\fpeval{\PfCMulA*\PfCMulB}}% + \modulo{\PfCMulC}{10}\relax% + \ifnum##3=\PremierFacteurlen% + \xdef\Report{\Report \the\remainder}% + \else% + \xdef\Report{\Report,\the\remainder}% + \fi% + \ifnum##2<\DeuxiemeFacteurlen% + \StrChar{\PfCMulJal[1]}{##3}[\PfCMulA]% + \StrChar{\PfCMulJal[2]}{\fpeval{##2+1}}[\PfCMulB]% + \xdef\PfCMulC{\fpeval{\PfCMulA*\PfCMulB}}% + \quotient{\PfCMulC}{10}\relax% + \xdef\Report{\Report,\the\intquotient}% + \fi% + }{}% + }% + }% + \xdef\Report{\Report/}% + }% + \setsepchar[*]{/*,}\ignoreemptyitems% + \readlist*\Lesdiagonales{\Report}% + %Calculs les sommes en diagonales. + \xintFor* ##1 in{\xintSeq{1}{\fpeval{\PremierFacteurlen+\DeuxiemeFacteurlen}}}\do{% + \xdef\PfCFoo{\Lesdiagonales[##1]}% + \setsepchar{,}\ignoreemptyitems% + \readlist*\LaDiagonale{\PfCFoo}% + \xdef\LaSomme{0}% + \foreachitem\compteur\in\LaDiagonale{\xdef\LaSomme{\fpeval{\LaSomme+\LaDiagonale[\compteurcnt]}}}% + }% + % + \colorlet{PfCFondTab}{\useKV[MulJal]{CouleurTab}}% + \begin{NiceTabular}{*{1}{p{25pt}}*{\PremierFacteurlen}{p{25pt}}c}% + \rule{0pt}{25pt}\xintFor* ##1 in{\xintSeq{1}{1}}\do{% + &}\xintFor* ##1 in{\xintSeq{1}{\PremierFacteurlen}}\do{% + \Block[fill=PfCFondTab,draw,v-center]{}{\StrChar{\PfCMulJal[1]}{##1}}&% + }\Block[fill=PfCFondTab,draw,v-center]{}{$\times$}\\% + \xintFor* ##1 in{\xintSeq{1}{\DeuxiemeFacteurlen}}\do{% + \rule{0pt}{25pt}% + \xintFor* ##3 in{\xintSeq{1}{1}}\do{% + &}\xintFor* ##2 in{\xintSeq{1}{\PremierFacteurlen}}\do{% + &}\Block[fill=PfCFondTab,draw,v-center]{}{\StrChar{\PfCMulJal[2]}{##1}}\\% + }% + \xintFor* ##1 in{\xintSeq{1}{\fpeval{\PremierFacteurlen+2}}}\do{% + \rule{0pt}{25pt}\xintifForLast{}{&}% + }\\% + \CodeAfter% + \ifboolKV[MulJal]{Solution}{% + \xintFor* ##1 in{\xintSeq{1}{\DeuxiemeFacteurlen}}\do{% + \xintFor* ##2 in{\xintSeq{1}{\PremierFacteurlen}}\do{% + \StrChar{\PfCMulJal[1]}{##2}[\PfCMulA]% + \StrChar{\PfCMulJal[2]}{##1}[\PfCMulB]% + \xdef\PfCMulC{\fpeval{\PfCMulA*\PfCMulB}}% + \xintifboolexpr{\PfCMulC>9}{% + \tikz{\node[anchor=north west] at (\fpeval{##1+1}-|\fpeval{##2+1}) {\StrChar{\PfCMulC}{1}};}% + \tikz{\node[anchor=south east] at (\fpeval{##1+2}-|\fpeval{##2+2}) {\StrChar{\PfCMulC}{2}};}% + }{% + \tikz{\node[anchor=north west] at (\fpeval{##1+1}-|\fpeval{##2+1}) {0};}% + \tikz{\node[anchor=south east] at (\fpeval{##1+2}-|\fpeval{##2+2}) {\PfCMulC};}% + }% + }% + }% + }{}% + % Affichage des diagonales + \xintFor* ##1 in{\xintSeq{1}{\fpeval{\DeuxiemeFacteurlen+1}}}\do{% + \xintFor* ##2 in {\xintSeq{1}{\fpeval{\PremierFacteurlen+1}}}\do{% + \tikz{\draw (\fpeval{##1+1}-|\fpeval{##2+1})--(\fpeval{##1+2}-|##2);}% + }% + }% + % affichage du quadrillage interieur + \xintFor* ##1 in {\xintSeq{1}{\PremierFacteurlen}}\do{% + \tikz{\draw (2-|\fpeval{##1+1}) -- (\fpeval{\DeuxiemeFacteurlen+2}-|\fpeval{##1+1});}% + }% + \xintFor* ##1 in {\xintSeq{1}{\fpeval{\DeuxiemeFacteurlen+1}}}\do{% + \tikz{\draw (\fpeval{##1+1}-|2)--(\fpeval{##1+1}-|last);}% + }% + % Affichage du produit + \ifboolKV[MulJal]{Solution}{% + \xintFor* ##1 in{\xintSeq{1}{\PremierFacteurlen}}\do{% + \StrChar{\PfCMulJalPdt}{\fpeval{\Produitlen+1-##1}}[\PfCMulJalChiffre]% + \tikz{\node[CouleurSolution] at (\fpeval{\DeuxiemeFacteurlen+2+0.5}-|\fpeval{\PremierFacteurlen+2-##1}) {\PfCMulJalChiffre};}% + }% + \xintFor* ##1 in{\xintSeq{1}{\DeuxiemeFacteurlen}}\do{% + \StrChar{\PfCMulJalPdt}{\fpeval{\Produitlen+1-\PremierFacteurlen-##1}}[\PfCMulJalChiffre]% + \tikz{\node[CouleurSolution] at (\fpeval{\DeuxiemeFacteurlen+3-##1}-|\fpeval{1.5}) {\PfCMulJalChiffre};}% + }% + % Affichage des retenues + \xdef\Retenue{0}% + \xintFor* ##1 in{\xintSeq{2}{\fpeval{\DeuxiemeFacteurlen+\PremierFacteurlen}}}\do{% + \xdef\PfCFoo{\Lesdiagonales[\fpeval{\DeuxiemeFacteurlen+\PremierFacteurlen+1-##1}]}% + \setsepchar{,}\ignoreemptyitems% + \readlist*\LaDiagonale{\PfCFoo}% + \xdef\LaSomme{0}% + \foreachitem\compteur\in\LaDiagonale{\xdef\LaSomme{\fpeval{\LaSomme+\LaDiagonale[\compteurcnt]}}}% + \xdef\LaSomme{\fpeval{\LaSomme+\Retenue}}% + \ifnum\LaSomme>9% + \quotient{\LaSomme}{10}% + \xdef\Retenue{\the\intquotient}% + \ifnum##1<\PremierFacteurlen% + \tikz{\node[anchor=north,inner sep=1pt] at (\fpeval{\DeuxiemeFacteurlen+2}-|\fpeval{\PremierFacteurlen+1.5-##1}) {\tiny$+\the\intquotient$};}% + \else% + \tikz{\node[anchor=east,inner sep=1pt] at (\fpeval{\DeuxiemeFacteurlen+1.5-(##1-\PremierFacteurlen)}-|2) {\tiny$\the\intquotient+$};}% + \fi% + \fi% + }% + }{}% + \end{NiceTabular}% +}%
\ No newline at end of file diff --git a/macros/latex/contrib/profcollege/latex/PfCNumerationsAnciennes.tex b/macros/latex/contrib/profcollege/latex/PfCNumerationsAnciennes.tex new file mode 100644 index 0000000000..f15a0b9827 --- /dev/null +++ b/macros/latex/contrib/profcollege/latex/PfCNumerationsAnciennes.tex @@ -0,0 +1,243 @@ +\NewDocumentCommand\Chinoise{m}{% + \BuildNumerationChinoise{#1}% +}% + +\NewDocumentCommand\Maya{m}{% + \BuildNumerationMaya{#1}% +}% + +\NewDocumentCommand\Babylone{m}{% + \BuildNumerationBabylone{#1}% +}% + +\NewDocumentCommand\BuildNumerationChinoise{m}{% + \ifluatex + \mplibnumbersystem{double}% + \mplibforcehmode + \begin{mplibcode} + drawoptions(withpen pencircle scaled 1.5); + ecart:=0.15u; + vardef Chiffre(expr t,a)= + picture Chinois; + Chinois=image( + if t<6: + if (a mod 2)=1: + if (t mod 2)=0: + for k=0 upto t-1: + draw ((0,0)--(u,0)) shifted(k*(0,ecart)); + endfor; + else: + for k=1 upto t: + draw ((0,0)--(u,0)) shifted((k-1)*(0,ecart)); + endfor; + fi; + else: + for k=0 upto t-1: + draw ((0,0)--(0,u)) shifted(k*(ecart,0)); + endfor; + fi; + else:%t>5 + if (a mod 2)=1: + for k=1 upto (t-5): + draw ((0,0)--(1u,0)) shifted((k-1)*(0,ecart)); + endfor; + draw ((0.5u,(t-5-1)*ecart))--(0.5u,u); + else: + if ((t-5) mod 2)=0: + for k=1 upto ((t-5) div 2): + draw ((0,0)--(0,u)) shifted((3*ecart,0)+(k-1)*(ecart,0)); + draw ((0,0)--(0,u)) shifted((2*ecart,0)-(k-1)*(ecart,0)); + endfor; + else: + draw ((2.5*ecart,0)--(2.5*ecart,u)); + for k=1 upto ((t-5) div 2): + draw ((0,0)--(0,u)) shifted((2.5*ecart,0)+k*(ecart,0)); + draw ((0,0)--(0,u)) shifted((2.5*ecart,0)-k*(ecart,0)); + endfor; + fi; + draw ((0,u)--(5*ecart,u)); + fi; + fi; + ); + if (a mod 2)=0: + Chinois:=Chinois shifted(u*(0.5,0.5)-center Chinois); + fi; + Chinois + enddef; + % On détermine l'exposant de la base le plus petit tel que 10^a>nombre + exposant=0; + Power=1; + forever: exitif Power>#1; + exposant:=exposant+1; + Power:=1 for l=1 upto exposant:*10 endfor; + endfor; + % On détermine les chiffres + Depart=#1; + % + for k=exposant-1 downto 0: + Power:=1 for l=1 upto k:*10 endfor; + Retiens:=Depart div Power; + RetiensChiffre[exposant-1-k]=Retiens; + Depart:=Depart-(Retiens*Power); + endfor; + %On affiche + for k=exposant-1 downto 0: + draw Chiffre(RetiensChiffre[exposant-1-k],k) shifted((exposant-1-k)*7*ecart,0); + endfor; + \end{mplibcode} + \mplibnumbersystem{scaled}% + \fi% +}% + +\NewDocumentCommand\BuildNumerationMaya{m}{% + \ifluatex + \mplibnumbersystem{double}% + \mplibforcehmode + \begin{mplibcode} + drawoptions(withpen pencircle scaled 1.5); + % + picture MayaZero; + MayaZero=image( + path cc,cd; + cc=cercles((0,0),0.3u); + cc:=cc yscaled 0.4; + cd=(point(0.45*length cc) of cc){dir-30}..{dir30}(point(0.05*length cc) of cc); + trace cd; + trace (point(0.2*length cc) of cc){dir-130}..{dir-50}(point(0.65*length cd) of cd); + trace (point(0.25*length cc) of cc){dir-130}..{dir-50}(point(0.5*length cd) of cd); + trace (point(0.3*length cc) of cc){dir-130}..{dir-50}(point(0.35*length cd) of cd); + trace cc; + ); + % + vardef Chiffre(expr t,a)= + picture Maya; + Maya=image(% + if t=0: + trace MayaZero; + else: + drawoptions(withpen pensquare); + for k=1 upto (t div 5): + draw ((-0.3u,0)--(0.3u,0)) shifted ((k-1)*u*(0,0.15)); + endfor; + drawoptions(); + if (t mod 5)>0: + if ((t mod 5) mod 2)=0: + for k=0 upto (t mod 5)-1: + fill (fullcircle scaled 1mm) shifted(k*u*(0.15,0)+(t div 5)*u*(0,0.15)-0.5*u*((t mod 5)-1)*(0.15,0)); + endfor; + else: + for k=0 upto ((t mod 5)-1): + fill (fullcircle scaled 1mm) shifted((t div 5)*u*(0,0.15)+k*u*(0.15,0)-0.5*((t mod 5)-1)*u*(0.15,0)); + endfor; + fi; + fi; + fi; + ); + Maya + enddef; + % On détermine l'exposant de la base le plus petit tel que 10^a>nombre + exposant=0; + Power=1; + if #1=0: + exposant:=1; + else: + forever: exitif Power>#1; + exposant:=exposant+1; + Power:=1 for l=1 upto exposant:*20 endfor; + endfor; + fi; + % On détermine les chiffres + Depart=#1; + % + for k=exposant-1 downto 0: + Power:=1 for l=1 upto k:*20 endfor; + Retiens:=Depart div Power; + RetiensChiffre[exposant-1-k]=Retiens; + Depart:=Depart-(Retiens*Power); + endfor; + % On affiche + for k=exposant-1 downto 0: + draw Chiffre(RetiensChiffre[exposant-1-k],exposant-1-k) shifted(u*(0,-(exposant-1-k)*4*0.25)); + endfor; + \end{mplibcode} + \mplibnumbersystem{scaled}% + \fi% +}% + +\NewDocumentCommand\BuildNumerationBabylone{m}{% + \ifluatex% + \mplibnumbersystem{double}% + \mplibforcehmode% + \begin{mplibcode} + u:=8mm; + drawoptions(withpen pencircle scaled 1.5); + % + picture Chevron,Clou; + Chevron=image(% + draw chemin(u*(0.4,0.4),(0,0),u*(0.4,-0.4));% + draw segment(u*(0.15,0.15),u*(0.15,-0.15));% + );% + Clou=image(% + draw chemin(u*(0.4,0.3),u*(0.3,0.4),u*(0.5,0.4),u*(0.4,0.3),u*(0.4,-0.4)); + ); + vardef Chiffre(expr t)= + picture Babylone; + Babylone=image(% + diz:=t div 10; + un:=t-diz*10; + k:=0; + forever: exitif k>diz-1; + g:=k div 2; + h:=k mod 2; + draw Chevron shifted(u*(0.5*h,g)); + k:=k+1; + endfor; + % + ecartH:=ecartH+ecart+ecartu+1;% pour avoir un ecart entre les divers exposants + % + k:=0; + ecart:=if diz<2: diz else:2 fi; + forever: exitif k>un-1; + g:=k div 3; + h:=k mod 3; + draw Clou shifted(u*(0.5*(h+ecart),g)); + k:=k+1; + endfor; + ecartu:=if un<3: un else:3 fi; +% label.top(TEX("e="&decimal(ecart)&";eu"&decimal(ecartu)),u*(ecartH*0.5,5)); + ); + Babylone + enddef; + % On détermine l'exposant de la base le plus petit tel que 60^a>nombre + exposant=0; + Power=1; + forever: exitif Power>#1; + exposant:=exposant+1; + Power:=1 for l=1 upto exposant:*60 endfor; + endfor; + % On détermine les chiffres + Depart=#1; + % + if Depart=0: + RetiensChiffre[0]=Retiens; + else: + for k=exposant-1 downto 0: + Power:=1 for l=1 upto k:*60 endfor; + Retiens:=Depart div Power; + RetiensChiffre[exposant-1-k]=Retiens; + Depart:=Depart-(Retiens*Power); + endfor; + fi; + % On affiche + ecart:=0; + ecartu:=0; + ecartH:=0; + for k=exposant-1 downto 0: + gg:=RetiensChiffre[exposant-1-k]; + draw Chiffre(gg) shifted(u*(ecartH*0.5,0)); +% draw (u*(ecartH*0.5,0)--u*(ecartH*0.5,5)) withcolor blue; + endfor; + \end{mplibcode} + \mplibnumbersystem{scaled}% + \fi% +}%
\ No newline at end of file diff --git a/macros/latex/contrib/profcollege/latex/PfCOperationsTrou.tex b/macros/latex/contrib/profcollege/latex/PfCOperationsTrou.tex index f53f3e9944..d26dbade32 100644 --- a/macros/latex/contrib/profcollege/latex/PfCOperationsTrou.tex +++ b/macros/latex/contrib/profcollege/latex/PfCOperationsTrou.tex @@ -3,26 +3,58 @@ %%% %% D'après https://tex.stackexchange.com/questions/277246/drawing-a-circle-around-the-numbers-in-xlop-package +%\begin{document}% +% +%\end{document} + \newcommand\PfCchiffre[2]{\tikz[remember picture] \node[inner sep=0pt](#1){#2};} \newcommand\PfCentoure[2]{\tikz[remember picture,overlay] \node[preaction={draw={\useKV[ClesOperations]{CouleurCadre}},ultra thick,opacity=1, transform canvas={xshift=0em,yshift=0em}},rectangle,rounded corners,ultra thick,inner sep=.55em,fit=(#1.center)(#2.center)]{};} +\newcommand\PfCchiffreclip[2]{% + \ifboolKV[ClesOperations]{Solution}{% + \xintFor* ##1 in{\xintSeq{1}{\PfCListeTroulen}}\do{% + \xintifboolexpr{\thedivxlop==\PfCListeTrou[##1]}{% + \color{PfCSolOp}}{}% + }% + }{}% + \tikz[remember picture] \node[inner sep=0pt](#1){#2};% +}% + +\newcommand\PfCentoureclip[2]{\tikz[remember picture,overlay] \node[preaction={draw={\useKV[ClesOperations]{CouleurCadre}},ultra thick,opacity=1, +transform canvas={xshift=0em,yshift=0em}},rectangle,fill=PfCSolOp,rounded corners,ultra thick,inner sep=.55em,fit=(#1.center)(#2.center)]{};} + \newcounter{divxlop}% -\newcounter{mulxlop}% -\newcounter{addxlop}% -\newcounter{subxlop}% +%\newcounter{mulxlop}% +%\newcounter{addxlop}% +%\newcounter{subxlop}% -\setKVdefault[ClesOperations]{Solution=false,CouleurCadre=LightSteelBlue,CouleurSolution=red,CouleurFond=white,CouleurVirgule=white} +\setKVdefault[ClesOperations]{Solution=false,CouleurCadre=LightSteelBlue,CouleurSolution=red,CouleurFond=white,CouleurVirgule=white,Listes=false} +\defKV[ClesOperations]{Liste=\setKV[ClesOperations]{Listes}\xdef\PfCFooListeTrou{#1}}% \newcommand\Division[3][]{% \useKVdefault[ClesOperations]% \setKV[ClesOperations]{#1}% \setcounter{divxlop}{0}% \ifboolKV[ClesOperations]{Solution}{\colorlet{PfCSolOp}{\useKV[ClesOperations]{CouleurSolution}}}{\colorlet{PfCSolOp}{\useKV[ClesOperations]{CouleurFond}}}% - \opidiv[lineheight=1.5em,columnwidth=1.25em,displayintermediary=all,voperator=bottom,intermediarystyle=\stepcounter{divxlop}\color{PfCSolOp}\PfCchiffre{A\thedivxlop},remainderstyle=\stepcounter{divxlop}\color{PfCSolOp}\PfCchiffre{A\thedivxlop},resultstyle=\stepcounter{divxlop}\color{PfCSolOp}\PfCchiffre{A\thedivxlop}]{#2}{#3}% - \foreach \i in {1,...,\thedivxlop}{% - \PfCentoure{A\i}{A\i}% + \ifboolKV[ClesOperations]{Listes}{% + \setsepchar{,}\ignoreemptyitems% + \readlist*\PfCListeTrou{\PfCFooListeTrou}% + \reademptyitems% + %,displayintermediary=all + \opidiv[lineheight=1.75em,columnwidth=1.5em,voperator=bottom,operandstyle=\stepcounter{divxlop}\PfCchiffreclip{A\thedivxlop},intermediarystyle=\stepcounter{divxlop}\PfCchiffreclip{A\thedivxlop},remainderstyle=\stepcounter{divxlop}\PfCchiffreclip{A\thedivxlop},resultstyle=\stepcounter{divxlop}\PfCchiffreclip{A\thedivxlop}]{#2}{#3}% + \ifboolKV[ClesOperations]{Solution}{}{% + \foreachitem\compteur\in\PfCListeTrou{% + \xdef\PfCRetiensTrou{\PfCListeTrou[\compteurcnt]}% + \PfCentoureclip{A\PfCRetiensTrou}{A\PfCRetiensTrou}% + }% + }% + }{% + \opidiv[lineheight=1.5em,columnwidth=1.25em,displayintermediary=all,voperator=bottom,intermediarystyle=\stepcounter{divxlop}\color{PfCSolOp}\PfCchiffre{A\thedivxlop},remainderstyle=\stepcounter{divxlop}\color{PfCSolOp}\PfCchiffre{A\thedivxlop},resultstyle=\stepcounter{divxlop}\color{PfCSolOp}\PfCchiffre{A\thedivxlop}]{#2}{#3}% + \foreach \i in {1,...,\thedivxlop}{% + \PfCentoure{A\i}{A\i}% + }% }% }% @@ -40,8 +72,29 @@ transform canvas={xshift=0em,yshift=0em}},rectangle,rounded corners,ultra thick, \newcommand\Multiplication[3][]{% \useKVdefault[ClesOperations]% \setKV[ClesOperations]{#1}% - \setcounter{mulxlop}{0}% + \setcounter{divxlop}{0}% \ifboolKV[ClesOperations]{Solution}{\colorlet{PfCSolOp}{\useKV[ClesOperations]{CouleurSolution}}\colorlet{PfCCouleurVirgule}{PfCSolOp}}{\colorlet{PfCSolOp}{\useKV[ClesOperations]{CouleurFond}}\colorlet{PfCCouleurVirgule}{\useKV[ClesOperations]{CouleurVirgule}}}% + \ifboolKV[ClesOperations]{Listes}{% + \setsepchar{,}\ignoreemptyitems% + \readlist*\PfCListeTrou{\PfCFooListeTrou}% + \reademptyitems% + \begingroup + \setlength{\baselineskip}{1.75em} + \StrLen{#3}[\PfCLongueurFacteurDeux] + \ifnum\PfCLongueurFacteurDeux=1\relax + \opset{lineheight=\baselineskip} % nécessaire + \else + \opset{lineheight=\baselineskip,displayintermediary=all,displayshiftintermediary=all} % nécessaire + \fi + \opmul[decimalsepsymbol={,},lineheight=1.75em,columnwidth=1.5em,voperator=bottom,operandstyle=\stepcounter{divxlop}\PfCchiffreclip{A\thedivxlop},intermediarystyle=\stepcounter{divxlop}\PfCchiffreclip{A\thedivxlop},resultstyle=\stepcounter{divxlop}\PfCchiffreclip{A\thedivxlop},resultstyle.d=\color{PfCCouleurVirgule}]{#2}{#3}% + \endgroup% + \ifboolKV[ClesOperations]{Solution}{}{% + \foreachitem\compteur\in\PfCListeTrou{% + \xdef\PfCRetiensTrou{\PfCListeTrou[\compteurcnt]}% + \PfCentoureclip{A\PfCRetiensTrou}{A\PfCRetiensTrou}% + }% + }% + }{% \begingroup \setlength{\baselineskip}{2em} \StrLen{#3}[\PfCLongueurFacteurDeux] @@ -50,42 +103,69 @@ transform canvas={xshift=0em,yshift=0em}},rectangle,rounded corners,ultra thick, \else \opset{lineheight=\baselineskip,displayintermediary=all,displayshiftintermediary=all} % nécessaire \fi - \opmul[decimalsepsymbol={,},lineheight=2em,columnwidth=1.5em,voperator=bottom,intermediarystyle=\stepcounter{mulxlop}\color{PfCSolOp}\PfCchiffre{A\themulxlop},resultstyle=\stepcounter{mulxlop}\color{PfCSolOp}\PfCchiffre{A\themulxlop},resultstyle.d=\color{PfCCouleurVirgule}]{#2}{#3}% - \foreach \i in {1,...,\themulxlop}{% + \opmul[decimalsepsymbol={,},lineheight=2em,columnwidth=1.5em,voperator=bottom,intermediarystyle=\stepcounter{divxlop}\color{PfCSolOp}\PfCchiffre{A\thedivxlop},resultstyle=\stepcounter{divxlop}\color{PfCSolOp}\PfCchiffre{A\thedivxlop},resultstyle.d=\color{PfCCouleurVirgule}]{#2}{#3}% + \foreach \i in {1,...,\thedivxlop}{% \PfCentoure{A\i}{A\i}% }% \endgroup + } }% \newcommand\Addition[3][]{% \useKVdefault[ClesOperations]% \setKV[ClesOperations]{#1}% - \setcounter{addxlop}{0}% + \setcounter{divxlop}{0}% \ifboolKV[ClesOperations]{Solution}{\opset{carryadd,carrystyle=\color{PfCSolOp}\scriptsize}\colorlet{PfCSolOp}{\useKV[ClesOperations]{CouleurSolution}}\colorlet{PfCCouleurVirgule}{PfCSolOp}}{\opset{carryadd=false}\colorlet{PfCSolOp}{\useKV[ClesOperations]{CouleurFond}}\colorlet{PfCCouleurVirgule}{\useKV[ClesOperations]{CouleurVirgule}}}% - \opadd[decimalsepsymbol={,},lineheight=1.75em,columnwidth=1.5em,voperator=bottom,resultstyle=\stepcounter{addxlop}\color{PfCSolOp}\PfCchiffre{A\theaddxlop},resultstyle.d=\color{PfCCouleurVirgule}]{#2}{#3} - \foreach \i in {1,...,\theaddxlop}{% - \PfCentoure{A\i}{A\i}% + \ifboolKV[ClesOperations]{Listes}{% + \setsepchar{,}\ignoreemptyitems% + \readlist*\PfCListeTrou{\PfCFooListeTrou}% + \reademptyitems% + \opadd[decimalsepsymbol={,},lineheight=1.75em,columnwidth=1.5em,voperator=bottom,operandstyle.1=\stepcounter{divxlop}\PfCchiffreclip{A\thedivxlop},operandstyle.2=\stepcounter{divxlop}\PfCchiffreclip{A\thedivxlop},resultstyle=\stepcounter{divxlop}\PfCchiffreclip{A\thedivxlop},resultstyle.d=\color{PfCCouleurVirgule}]{#2}{#3}% + \ifboolKV[ClesOperations]{Solution}{}{% + \foreachitem\compteur\in\PfCListeTrou{% + \xdef\PfCRetiensTrou{\PfCListeTrou[\compteurcnt]}% + \PfCentoureclip{A\PfCRetiensTrou}{A\PfCRetiensTrou}% + }% + }% + }{% + \opadd[decimalsepsymbol={,},lineheight=1.75em,columnwidth=1.5em,voperator=bottom,resultstyle=\stepcounter{divxlop}\color{PfCSolOp}\PfCchiffre{A\thedivxlop},resultstyle.d=\color{PfCCouleurVirgule}]{#2}{#3} + \foreach \i in {1,...,\thedivxlop}{% + \PfCentoure{A\i}{A\i}% + }% }% }% \newcommand\Soustraction[3][]{% \useKVdefault[ClesOperations]% \setKV[ClesOperations]{#1}% - \setcounter{subxlop}{0}% + \setcounter{divxlop}{0}% \ifboolKV[ClesOperations]{Solution}{\opset{carrysub,carrystyle=\color{PfCSolOp}\scriptsize}\colorlet{PfCSolOp}{\useKV[ClesOperations]{CouleurSolution}}\colorlet{PfCCouleurVirgule}{PfCSolOp}}{\opset{carrysub=false}\colorlet{PfCSolOp}{\useKV[ClesOperations]{CouleurFond}}\colorlet{PfCCouleurVirgule}{\useKV[ClesOperations]{CouleurVirgule}}}% - \opsub[decimalsepsymbol={,},lineheight=1.75em,columnwidth=1.5em,voperator=bottom,resultstyle=\stepcounter{subxlop}\color{PfCSolOp}\PfCchiffre{A\thesubxlop},resultstyle.d=\color{PfCCouleurVirgule}]{#2}{#3}% - \foreach \i in {1,...,\thesubxlop}{% - \PfCentoure{A\i}{A\i} + \ifboolKV[ClesOperations]{Listes}{% + \setsepchar{,}\ignoreemptyitems% + \readlist*\PfCListeTrou{\PfCFooListeTrou}% + \reademptyitems% + \opsub[decimalsepsymbol={,},lineheight=1.75em,columnwidth=1.5em,voperator=bottom,operandstyle=\stepcounter{divxlop}\PfCchiffreclip{A\thedivxlop},resultstyle=\stepcounter{divxlop}\PfCchiffreclip{A\thedivxlop},resultstyle.d=\color{PfCCouleurVirgule}]{#2}{#3}% + \ifboolKV[ClesOperations]{Solution}{}{% + \foreachitem\compteur\in\PfCListeTrou{% + \xdef\PfCRetiensTrou{\PfCListeTrou[\compteurcnt]}% + \PfCentoureclip{A\PfCRetiensTrou}{A\PfCRetiensTrou}% + }% + }% + }{% + \opsub[decimalsepsymbol={,},lineheight=1.75em,columnwidth=1.5em,voperator=bottom,resultstyle=\stepcounter{divxlop}\color{PfCSolOp}\PfCchiffre{A\thedivxlop},resultstyle.d=\color{PfCCouleurVirgule}]{#2}{#3}% + \foreach \i in {1,...,\thedivxlop}{% + \PfCentoure{A\i}{A\i} + }% }% }% \NewDocumentCommand\MultiAddition{om}{% \useKVdefault[ClesOperations]% \setKV[ClesOperations]{#1}% - \setcounter{addxlop}{0}% + \setcounter{divxlop}{0}% \ifboolKV[ClesOperations]{Solution}{\opset{carryadd,carrystyle=\color{PfCSolOp}\scriptsize}\colorlet{PfCSolOp}{\useKV[ClesOperations]{CouleurSolution}}\colorlet{PfCCouleurVirgule}{PfCSolOp}}{\opset{carryadd=false}\colorlet{PfCSolOp}{\useKV[ClesOperations]{CouleurFond}}\colorlet{PfCCouleurVirgule}{\useKV[ClesOperations]{CouleurVirgule}}}% - \opmanyadd[decimalsepsymbol={,},lineheight=1.75em,columnwidth=1.5em,vmanyoperator=bottom,resultstyle=\stepcounter{addxlop}\color{PfCSolOp}\PfCchiffre{A\theaddxlop},resultstyle.d=\color{PfCCouleurVirgule}]#2 - \foreach \i in {1,...,\theaddxlop}{% + \opmanyadd[decimalsepsymbol={,},lineheight=1.75em,columnwidth=1.5em,vmanyoperator=bottom,resultstyle=\stepcounter{divxlop}\color{PfCSolOp}\PfCchiffre{A\thedivxlop},resultstyle.d=\color{PfCCouleurVirgule}]#2 + \foreach \i in {1,...,\thedivxlop}{% \PfCentoure{A\i}{A\i}% }% }%
\ No newline at end of file diff --git a/macros/latex/contrib/profcollege/latex/PfCPattern.tex b/macros/latex/contrib/profcollege/latex/PfCPattern.tex new file mode 100644 index 0000000000..29fa45c08f --- /dev/null +++ b/macros/latex/contrib/profcollege/latex/PfCPattern.tex @@ -0,0 +1,779 @@ +%%% +% Visual Pattern +%%% +\setKVdefault[Pattern]{Type=1,Etape=3} + +\NewDocumentCommand\VisualPattern{o}{% + \useKVdefault[Pattern]% + \setKV[Pattern]{#1}% + \IfStrEqCase{\useKV[Pattern]{Type}}{% + {284}{\BuildPatternDeuxCentQuatreVingtQuatre}% + {254}{\BuildPatternDeuxCentCinquanteQuatre}% + {156}{\BuildPatternCentCinquanteSix}% + {155}{\BuildPatternCentCinquanteCinq}% + {55}{\BuildPatternCinquanteCinq}% + {53}{\BuildPatternCinquanteTrois}% + {48}{\BuildPatternQuaranteHuit}% + {46}{\BuildPatternQuaranteSix}% + {45}{\BuildPatternQuaranteCinq}% + {39}{\BuildPatternTrenteNeuf}% + {30}{\BuildPatternTrente}% + {24}{\BuildPatternVingtQuatre}% + {20}{\BuildPatternVingt}% + {19}{\BuildPatternDixNeuf}% + {18}{\BuildPatternDixHuit}% + {15}{\BuildPatternQuinze}% + {14}{\BuildPatternQuatorze}% + {6}{\BuildPatternSix}% + {5}{\BuildPatternCinq}% + {4}{\BuildPatternQuatre}% + {3}{\BuildPatternTrois}% + {2}{\BuildPatternDeux}% + {1}{\BuildPatternUn}% + }% +}% + +%284 +\NewDocumentCommand\BuildPatternDeuxCentQuatreVingtQuatre{}{ + \ifluatex% + \mplibforcehmode% + \begin{mplibcode} + Etape:=\useKV[Pattern]{Etape}; + input PfCSolid; + + intensite:=1.5; + Ferme[0]:=false; + outcolor:=LightSteelBlue; + incolor:=white; + nb:=1;subh:=1; + creux:=true; + + Initialisation(2500,40,20,50); + Objetcube1("a=0.25"); + nbobj:=1; + TR:=(0,a,0); + %base + for k=1 upto 2: + NBobj:=nbobj; + nbobj:=nbobj+1; + ObjetDeplacement[nbobj](NBobj); + endfor; + % barre gauche + for k=1 upto Etape: + TR:=(0,0,k*a); + NBobj:=1; + nbobj:=nbobj+1; + ObjetDeplacement[nbobj](NBobj); + endfor; + %barre gauche + for k=1 upto Etape-1: + TR:=(0,2*a,k*a); + NBobj:=1; + nbobj:=nbobj+1; + ObjetDeplacement[nbobj](NBobj); + endfor; + DessineFusion; + \end{mplibcode} + \fi +}% + +% 254 +\NewDocumentCommand\BuildPatternDeuxCentCinquanteQuatre{}{ + \ifluatex% + \mplibforcehmode% + \begin{mplibcode} + Etape:=\useKV[Pattern]{Etape}; + for k=0 upto Etape-1: + for l=0 upto Etape-1: + fill ((fullcircle scaled 4mm) shifted (5mm*(l,k))) withcolor LightSteelBlue; + trace ((fullcircle scaled 4mm) shifted (5mm*(l,k))); + endfor; + endfor; + fill ((fullcircle scaled 4mm) shifted (5mm*(0,-1))) withcolor LightSteelBlue; + trace ((fullcircle scaled 4mm) shifted (5mm*(0,-1))); + fill ((fullcircle scaled 4mm) shifted (5mm*(-1,0))) withcolor LightSteelBlue; + trace ((fullcircle scaled 4mm) shifted (5mm*(-1,0))); + fill ((fullcircle scaled 4mm) shifted (5mm*(0,Etape))) withcolor LightSteelBlue; + trace ((fullcircle scaled 4mm) shifted (5mm*(0,Etape))); + \end{mplibcode} + \fi +}% + +%156 +\NewDocumentCommand\BuildPatternCentCinquanteSix{}{ + \ifluatex% + \mplibforcehmode% + \begin{mplibcode} + Etape:=\useKV[Pattern]{Etape}; + input PfCSolid; + + intensite:=1.5; + Ferme[0]:=false; + outcolor:=LightSteelBlue; + incolor:=white; + nb:=1;subh:=1; + creux:=true; + + Initialisation(2500,40,20,50); + Objetcube1("a=0.25"); + nbobj:=1; + TR:=(0,a,0); + for k=1 upto Etape: + NBobj:=nbobj; + nbobj:=nbobj+1; + ObjetDeplacement[nbobj](NBobj); + endfor; + TR:=(0,0,-0.25); + for k=1 upto Etape: + NBobj:=nbobj; + nbobj:=nbobj+1; + ObjetDeplacement[nbobj](NBobj); + endfor; + TR:=(0,0.25,0); + for k=1 upto Etape: + NBobj:=nbobj; + nbobj:=nbobj+1; + ObjetDeplacement[nbobj](NBobj); + endfor; + %nbobj=4; + DessineFusion; + \end{mplibcode} + \fi +}% + +%155 +\NewDocumentCommand\BuildPatternCentCinquanteCinq{}{ + \ifluatex% + \mplibforcehmode + \begin{mplibcode} + Etape:=\useKV[Pattern]{Etape}; + input PfCSolid; + + intensite:=1.5; + Ferme[0]:=false; + outcolor:=LightSteelBlue; + incolor:=white; + nb:=1;subh:=1; + creux:=true; + + Initialisation(2500,40,20,50); + angx:=-40; + Objetcube1("a=0.25"); + angx:=0; + nbobj:=1; + TR:=(0,a*cosd(-40),a*sind(-40)); + for k=0 upto Etape-2: + NBobj:=nbobj; + nbobj:=nbobj+1; + ObjetDeplacement[nbobj](NBobj); + endfor; + NBobj:=1; + TR:=(0,-a*cosd(-40),-a*sind(-40)); + for k=0 upto Etape-2: + nbobj:=nbobj+1; + ObjetDeplacement[nbobj](NBobj); + NBobj:=nbobj; + endfor; + NBobj:=1; + TR:=(0,a*sind(-40),-a*cosd(-40)); + for k=0 upto Etape-2: + nbobj:=nbobj+1; + ObjetDeplacement[nbobj](NBobj); + NBobj:=nbobj; + endfor; + NBobj:=1; + TR:=(0,-a*sind(-40),a*cosd(-40)); + for k=0 upto Etape-2: + nbobj:=nbobj+1; + ObjetDeplacement[nbobj](NBobj); + NBobj:=nbobj; + endfor; + NBobj:=1; + TR:=(a,0,0);% + for k=0 upto Etape-2: + nbobj:=nbobj+1; + ObjetDeplacement[nbobj](NBobj); + NBobj:=nbobj; + endfor; + NBobj:=1; + TR:=(-a,0,0); + for k=0 upto Etape-2: + nbobj:=nbobj+1; + ObjetDeplacement[nbobj](NBobj); + NBobj:=nbobj; + endfor; + DessineFusion; + \end{mplibcode} + \fi% +}% + +%55 +\NewDocumentCommand\BuildPatternCinquanteCinq{}{% + \ifluatex% + \begin{Allumettes}[Echelle=0.35] + Etape=\useKV[Pattern]{Etape}; + pair A[],B[],C[],D[],E[]; + A0=(0,0); + B0=A0; + B1-B0=u*(0,1); + B2=rotation(B0,B1,108); + B3=rotation(B1,B2,108); + B4=rotation(B2,B3,108); + A1=B1; + A2-A1=u*(-1,0); + A3-A0=A2-A1; + trace Allu(B0,B1); + trace Allu(B1,B2); + trace Allu(B2,B3); + trace Allu(B3,B4); + trace Allu(B4,B0); + for k=0 upto Etape-1: + trace Allu(A3,A0) shifted(k*u*(-1,0)); + trace Allu(A1,A2) shifted(k*u*(-1,0)); + trace Allu(A2,A3) shifted(k*u*(-1,0)); + endfor; + \end{Allumettes} + \fi% +}% + +%53 +\NewDocumentCommand\BuildPatternCinquanteTrois{}{% + \ifluatex% + \begin{Allumettes}[Echelle=0.35] + Etape=\useKV[Pattern]{Etape}; + pair A[],B[],C[],D[],E[]; + A0=(0,0); + B0=A0; + B1-B0=u*(0,1); + B2=rotation(B0,B1,60); + A1=B1; + A2-A1=u*(-1,0); + A3-A0=A2-A1; + trace Allu(B0,B1); + trace Allu(B1,B2); + trace Allu(B2,B0); + for k=0 upto Etape-1: + trace Allu(A3,A0) shifted(k*u*(-1,0)); + trace Allu(A1,A2) shifted(k*u*(-1,0)); + trace Allu(A2,A3) shifted(k*u*(-1,0)); + endfor; + \end{Allumettes} + \fi% +}% + +%48 +\NewDocumentCommand\BuildPatternQuaranteHuit{}{ + \ifluatex% + \mplibforcehmode + \begin{mplibcode} + Etape:=\useKV[Pattern]{Etape}; + input PfCSolid; + + intensite:=1.5; + Ferme[0]:=false; + outcolor:=LightSteelBlue; + incolor:=white; + nb:=1;subh:=1; + creux:=true; + + Initialisation(2500,40,20,50); + Objetcube1("a=0.25"); + nbobj:=1; + TR:=(0,a,0); + for k=0 upto Etape-2: + NBobj:=nbobj; + nbobj:=nbobj+1; + ObjetDeplacement[nbobj](NBobj); + endfor; + NBobj:=1; + TR:=(-a,0,0); + for k=0 upto Etape-2: + nbobj:=nbobj+1; + ObjetDeplacement[nbobj](NBobj); + NBobj:=nbobj; + endfor; + NBobj:=1; + TR:=(0,0,a);% + for k=0 upto Etape-2: + nbobj:=nbobj+1; + ObjetDeplacement[nbobj](NBobj); + NBobj:=nbobj; + endfor; + DessineFusion; + \end{mplibcode} + \fi% +}% + +%46 +\NewDocumentCommand\BuildPatternQuaranteSix{}{ + \ifluatex% + \mplibforcehmode + \begin{mplibcode} + Etape:=\useKV[Pattern]{Etape}; + input PfCSolid; + + intensite:=1.5; + Ferme[0]:=false; + outcolor:=LightSteelBlue; + incolor:=white; + nb:=1;subh:=1; + creux:=true; + + Initialisation(2500,40,20,50); + Objetcube1("a=0.25"); + nbobj:=1; + TR:=(0,a,0); + for k=0 upto Etape-2: + NBobj:=nbobj; + nbobj:=nbobj+1; + ObjetDeplacement[nbobj](NBobj); + endfor; + NBobj:=1; + TR:=(0,-a,0); + for k=0 upto Etape-2: + nbobj:=nbobj+1; + ObjetDeplacement[nbobj](NBobj); + NBobj:=nbobj; + endfor; + NBobj:=1; + TR:=(a,0,0); + for k=0 upto Etape-2: + nbobj:=nbobj+1; + ObjetDeplacement[nbobj](NBobj); + NBobj:=nbobj; + endfor; + NBobj:=1; + TR:=(-a,0,0); + for k=0 upto Etape-2: + nbobj:=nbobj+1; + ObjetDeplacement[nbobj](NBobj); + NBobj:=nbobj; + endfor; + NBobj:=1; + TR:=(0,0,a);% + for k=0 upto Etape-2: + nbobj:=nbobj+1; + ObjetDeplacement[nbobj](NBobj); + NBobj:=nbobj; + endfor; + DessineFusion; + \end{mplibcode} + \fi% +}% + +%45 +\NewDocumentCommand\BuildPatternQuaranteCinq{}{% + \ifluatex% + \mplibforcehmode% + \begin{mplibcode} + pair A[]; + Etape:=\useKV[Pattern]{Etape}; + A[0]=(0,0); + path piece; + piece=unitsquare scaled 5mm shifted(-2.5mm,-2.5mm); + for k=0 upto (2*Etape): + for l=0 upto Etape: + if (k=Etape) and (l=0): + else: + trace piece shifted(5mm*(k,l)); + fi; + endfor; + endfor; + \end{mplibcode} + \fi +} + +%39 +\NewDocumentCommand\BuildPatternTrenteNeuf{}{ + \ifluatex% + \mplibforcehmode% + \begin{mplibcode} + Etape:=\useKV[Pattern]{Etape}; + input PfCSolid; + + intensite:=1.5; + Ferme[0]:=false; + outcolor:=Orange; + incolor:=white; + nb:=1;subh:=1; + creux:=true; + + Initialisation(2500,40,20,50); + Objetcube1("a=0.25"); + nbobj:=1; + for k=0 upto Etape-1:%x + for l=0 upto Etape-1:%y + for m=Etape-1-l downto 0:%z + nbobj:=nbobj+1; + TR:=(k*a,l*a,m*a); + ObjetDeplacement[nbobj](1); + endfor; + endfor; + endfor; + DessineFusion; + \end{mplibcode} + \fi +}% + +%30 +\NewDocumentCommand\BuildPatternTrente{}{% + \ifluatex% + \mplibforcehmode% + \begin{mplibcode} + pair A[]; + A[0]=(0,0); + Etape:=\useKV[Pattern]{Etape}; + picture Cle; + path piece; + piece=(unitsquare scaled 3mm) shifted(-1.5mm,-1.5mm); + if (Etape mod 2)=0: + A0:=(0,1.75mm)+(Etape div 2)*(0,3.5mm); + for k=0 upto Etape-1: + for l=0 upto Etape-1: + if (k*l)<>(Etape-1)*(Etape-1): + draw piece shifted(A[0]+3.5mm*(-k,l)); + draw symetrie(piece shifted(A[0]+3.5mm*(-k,l)),(0,0)); + fi; + endfor; + endfor; + for k=0 upto ((Etape div 2)-1): + draw piece shifted((0,1.75mm)+k*(0,3.5mm)); + draw symetrie(piece shifted((0,1.75mm)+k*(0,3.5mm)),(0,0)); + endfor; + else: + A0:=(0,0)+((Etape div 2)+1)*(0,3.5mm); + for k=0 upto Etape-1: + for l=0 upto Etape-1: + if (k*l)<>(Etape-1)*(Etape-1): + draw piece shifted(A[0]+3.5mm*(-k,l)); + draw symetrie(piece shifted(A[0]+3.5mm*(-k,l)),(0,0)); + fi; + endfor; + endfor; + for k=1 upto (Etape div 2): + draw piece shifted(k*(0,3.5mm)); + draw symetrie(piece shifted(k*(0,3.5mm)),(0,0)); + endfor; + draw piece; + fi; + Cle=currentpicture; + currentpicture:=nullpicture; + draw rotation(Cle,(0,0),40); + \end{mplibcode} + \fi% +}% + +%24 +\NewDocumentCommand\BuildPatternVingtQuatre{}{% + \ifluatex% + \mplibforcehmode% + \begin{mplibcode} + pair A[]; + Etape:=\useKV[Pattern]{Etape}; + A[0]=(0,0); + path piece; + piece=unitsquare scaled 5mm shifted(-2.5mm,-2.5mm); + drawoptions(withcolor Orange); + for k=0 upto Etape+1: + for l=0 upto Etape-1: + fill piece shifted(5mm*(k,l)); + endfor; + endfor; + fill (piece shifted(0,Etape*5mm)); + drawoptions(); + for k=0 upto Etape+1: + for l=0 upto Etape-1: + trace piece shifted(5mm*(k,l)); + endfor; + endfor; + trace (piece shifted(0,Etape*5mm)); + \end{mplibcode} + \fi +} + +%20 +\NewDocumentCommand\BuildPatternVingt{}{% + \ifluatex% + \mplibforcehmode% + \begin{mplibcode} + pair A[]; + Etape:=\useKV[Pattern]{Etape}; + A[0]=(0,0); + for l=0 upto Etape-1: + for k=0 upto Etape+1: + draw (unitsquare scaled 5mm) shifted(A[0]+5mm*(k,l)); + endfor; + endfor; + \end{mplibcode} + \fi% +}% + +%19 +\NewDocumentCommand\BuildPatternDixNeuf{}{% + \ifluatex% + \mplibforcehmode% + \begin{mplibcode} + pair A[]; + Etape:=\useKV[Pattern]{Etape}; + A[0]=(0,0); + path piece; + piece=unitsquare scaled 5mm shifted(-2.5mm,-2.5mm); + drawoptions(withcolor LightGreen); + for k=0 upto Etape+1: + for l=0 upto Etape-1: + fill piece shifted(5mm*(k,l)); + endfor; + endfor; + fill (piece shifted(5mm,-5mm)); + fill (piece shifted(5mm,Etape*5mm)); + drawoptions(); + for k=0 upto Etape+1: + for l=0 upto Etape-1: + trace piece shifted(5mm*(k,l)); + endfor; + endfor; + trace (piece shifted(5mm,-5mm)); + trace (piece shifted(5mm,Etape*5mm)); + \end{mplibcode} + \fi% +}% + +%18 +\NewDocumentCommand\BuildPatternDixHuit{}{% + \ifluatex% + \mplibforcehmode% + \begin{mplibcode} + pair A[]; + Etape:=\useKV[Pattern]{Etape}; + Somme=0; + for k=0 upto Etape-1: + A[k]=(0,0)+Somme*5mm*(2,-1); + for l=0 upto k: + fill polygone(A[k],A[k]+5mm*(2,0),A[k]+5mm*(2,1),A[k]+5mm*(1,1),A[k]+5mm*(1,2),A[k]+5mm*(0,2)) withcolor LightGreen; + endfor; + for l=0 upto k: + trace polygone(A[k],A[k]+5mm*(2,0),A[k]+5mm*(2,1),A[k]+5mm*(1,1),A[k]+5mm*(1,2),A[k]+5mm*(0,2)); + trace chemin(A[k]+5mm*(1,0),A[k]+5mm*(1,1),A[k]+5mm*(0,1)); + endfor; + Somme:=Somme+1; + endfor; + \end{mplibcode} + \fi +} + +%15 +\NewDocumentCommand\BuildPatternQuinze{}{% + \ifluatex% + \mplibforcehmode% + \begin{mplibcode} + pair A[]; + Etape:=\useKV[Pattern]{Etape}; + Somme=0; + trace (fullcircle scaled 3mm); + for k=0 upto Etape-1: + A[k]=(0,0)+Somme*4mm*(1,0); + %for l=0 upto k: + fill ((unitsquare scaled 3mm) shifted(A[k]+4mm*(1,0)-(center (unitsquare scaled 3mm)))) withcolor 0.7white; + trace ((unitsquare scaled 3mm) shifted(A[k]+4mm*(1,0)-(center (unitsquare scaled 3mm)))); + trace (fullcircle scaled 3mm) shifted(A[k]+4mm*(1,-1)); + trace (fullcircle scaled 3mm) shifted(A[k]+4mm*(1,1)); + trace (fullcircle scaled 3mm) shifted(A[k]+4mm*(2,0)); + %endfor; + Somme:=Somme+2; + endfor; + \end{mplibcode} + \fi% +}% + +%14 +\NewDocumentCommand\BuildPatternQuatorze{}{% + \ifluatex% + \mplibforcehmode% + \begin{mplibcode} + pair A[]; + Etape:=\useKV[Pattern]{Etape}; + A[0]=(0,0); + for l=0 upto Etape-1: + for m=0 upto 5: + draw (unitsquare scaled 5mm) shifted(A[0]+5mm*(-m,l)); + endfor; + endfor; + draw (unitsquare scaled 5mm) shifted(A[0]+5mm*(-5,Etape)); + \end{mplibcode} + \fi% +}% + +%6 +\NewDocumentCommand\BuildPatternSix{}{% + \ifluatex% + \begin{Allumettes}[Echelle=0.35] + Etape=\useKV[Pattern]{Etape}; + pair A[],B[],C[],D[],E[]; + A0=(0,0); + B0-A0=u*(1,0); + C0=rotation(B0,A0,60); + picture UnitTriangle; + UnitTriangle=image( + trace Allu(A0,B0); + trace Allu(B0,C0); + trace Allu(C0,A0); + ); + currentpicture:=nullpicture; + for k=0 upto Etape-1: + for l=0 upto k: + trace UnitTriangle shifted(A0+k*(B0-A0)+l*(C0-B0)); + endfor; + endfor; + \end{Allumettes} + \fi% +}% + +%5 +\NewDocumentCommand\BuildPatternCinq{}{% + \ifluatex% + \mplibforcehmode% + \begin{mplibcode} + pair A[]; + Etape:=\useKV[Pattern]{Etape}; + A0=(0,0); + for k=Etape-1 upto Etape-1: + drawoptions(withcolor LightSteelBlue); + fill (fullcircle scaled 3mm) shifted A[0]; + for l=0 upto k: + for m=1 upto k+2: + fill (fullcircle scaled 3mm) shifted(A[0]+5mm*(l,m)); + fill symetrie((fullcircle scaled 3mm) shifted(A[0]+5mm*(l,m)),A[0],A[0]+(-1,1)); + endfor; + endfor; + fill (fullcircle scaled 3mm) shifted(A[0]+5mm*(-1,k+2)); + fill symetrie((fullcircle scaled 3mm) shifted(A[0]+5mm*(-1,k+2)),A[0],A[0]+(-1,1)); + % trace + drawoptions(); + trace (fullcircle scaled 3mm) shifted A[0]; + for l=0 upto k: + for m=1 upto k+2: + trace (fullcircle scaled 3mm) shifted(A[0]+5mm*(l,m)); + trace symetrie((fullcircle scaled 3mm) shifted(A[0]+5mm*(l,m)),A[0],A[0]+(-1,1)); + endfor; + endfor; + trace (fullcircle scaled 3mm) shifted(A[0]+5mm*(-1,k+2)); + trace symetrie((fullcircle scaled 3mm) shifted(A[0]+5mm*(-1,k+2)),A[0],A[0]+(-1,1)); + endfor; + \end{mplibcode} + \fi% +} + +\NewDocumentCommand\BuildPatternQuatre{}{% + \ifluatex% + \mplibforcehmode% + \begin{mplibcode} + Etape:=\useKV[Pattern]{Etape}; + % + fill ((unitsquare scaled 5mm) shifted (5mm*0*(1,1))) withcolor LightSteelBlue; + trace ((unitsquare scaled 5mm) shifted (5mm*0*(1,1))); + for k=1 upto Etape: + for l=1 upto k: + fill ((unitsquare scaled 5mm) shifted (5mm*l*(1,1))) withcolor LightSteelBlue; + fill ((unitsquare scaled 5mm) shifted (5mm*l*(1,-1)))withcolor LightSteelBlue; + fill ((unitsquare scaled 5mm) shifted (5mm*l*(-1,1))) withcolor LightSteelBlue; + fill ((unitsquare scaled 5mm) shifted (5mm*l*(-1,-1))) withcolor LightSteelBlue; + endfor; + endfor; + % + for k=1 upto Etape: + for l=1 upto k: + trace ((unitsquare scaled 5mm) shifted (5mm*l*(1,1))); + trace ((unitsquare scaled 5mm) shifted (5mm*l*(1,-1))); + trace ((unitsquare scaled 5mm) shifted (5mm*l*(-1,1))); + trace ((unitsquare scaled 5mm) shifted (5mm*l*(-1,-1))); + endfor; + endfor; + % + \end{mplibcode} + \fi% +}% + +\NewDocumentCommand\BuildPatternTrois{}{% + \ifluatex% + \mplibforcehmode% + \begin{mplibcode} + Etape:=\useKV[Pattern]{Etape}; + % + for k=1 upto Etape: + for l=Etape downto k: + fill ((unitsquare scaled 5mm) shifted (5mm*(Etape-l+1,k-1))) withcolor LightSteelBlue; + endfor; + endfor; + for k=1 upto Etape: + for l=Etape downto k: + trace ((unitsquare scaled 5mm) shifted (5mm*(Etape-l+1,k-1))) withcolor white; + endfor; + endfor; + % + \end{mplibcode} + \fi% +}% + +\NewDocumentCommand\BuildPatternDeux{}{% + \ifluatex% + \mplibforcehmode% + \begin{mplibcode} + Etape:=\useKV[Pattern]{Etape}; + % + input PfCSolid; + % + intensite:=1.5; + Ferme[0]:=false; + outcolor:=LightSteelBlue; + incolor:=white; + nb:=1;subh:=1; + creux:=true; + % + Initialisation(2500,40,20,50); + Objetcube0("a=0.25"); + for k=1 upto Etape: + TR:=(0,2*k,0); + ObjetDeplacement1(0); + nbobj:=1; + for l=1 upto k-1: + TR:=(0,0.25*l,0); + nbobj:=nbobj+1; + ObjetDeplacement[nbobj](1); + endfor; + for l=1 upto k-1: + TR:=(0,0.25*(k-1),0.25*l); + nbobj:=nbobj+1; + ObjetDeplacement[nbobj](1); + endfor; + endfor; + %nbobj=13; + DessineFusion; + \end{mplibcode} + \fi% +}% + +\NewDocumentCommand\BuildPatternUn{}{% + \ifluatex% + \mplibforcehmode% + \begin{mplibcode} + u:=5mm; + pair A[],O[]; + path cc[],dd[]; + Etape=\useKV[Pattern]{Etape}; + % + k:=Etape; + O[k]=(0,0); + dd[k]=unitsquare scaled (k*u); + cc[k]=dd[k] shifted (O[k]-center(dd[k])); + trace cc[k]; + for l=1 upto 4: + A[l]:=point l of cc[k]; + endfor; + %horizontales et verticales + for m=1 upto k-1: + trace ((m/k)[A1,A4])--((m/k)[A2,A3]); + trace ((m/k)[A1,A2])--((m/k)[A4,A3]); + endfor; + \end{mplibcode} + \fi% +}%
\ No newline at end of file diff --git a/macros/latex/contrib/profcollege/latex/PfCPropor.tex b/macros/latex/contrib/profcollege/latex/PfCPropor.tex index 6c4774ac60..0933a3e460 100644 --- a/macros/latex/contrib/profcollege/latex/PfCPropor.tex +++ b/macros/latex/contrib/profcollege/latex/PfCPropor.tex @@ -143,9 +143,9 @@ \newcommand\FlechesPD[3]{% \begin{tikzpicture}[remember picture,overlay]% \ifnum#1<#2\relax% - \draw[FlechePropor,out=-30,in=30] (ProporD-#1) to node[transform canvas={xshift=1pt},inner sep=0pt, inner xsep=1pt,fill=\colorfill, pos=0.5,right]{#3}(ProporD-#2);% + \draw[FlechePropor,out=-30,in=30] (ProporD-#1) to node[transform canvas={xshift=1pt},inner sep=0pt, inner xsep=1pt,fill=\colorfill, pos=0.5,right]{#3}(ProporD-#2);% \else% - \draw[FlechePropor,out=30,in=-30] (ProporD-#1) to node[transform canvas={xshift=1pt},inner sep=0pt, inner xsep=1pt,fill=\colorfill, pos=0.5,right]{#3}(ProporD-#2);% + \draw[FlechePropor,out=30,in=-30] (ProporD-#1) to node[transform canvas={xshift=1pt},inner sep=0pt, inner xsep=1pt,fill=\colorfill, pos=0.5,right]{#3}(ProporD-#2);% \fi% \end{tikzpicture}% }% diff --git a/macros/latex/contrib/profcollege/latex/PfCPuissanceQuatre.tex b/macros/latex/contrib/profcollege/latex/PfCPuissanceQuatre.tex index 87f14051ae..1d8a929939 100644 --- a/macros/latex/contrib/profcollege/latex/PfCPuissanceQuatre.tex +++ b/macros/latex/contrib/profcollege/latex/PfCPuissanceQuatre.tex @@ -64,19 +64,19 @@ \ifluatex% \mplibforcehmode% \begin{mplibcode} - Largeur=\useKV[ClesPQuatre]{Largeur}; - LargeurUn=\useKV[ClesPQuatre]{LargeurUn}; - Echelle=\useKV[ClesPQuatre]{Echelle}; - color fond; - fond=\useKV[ClesPQuatre]{Couleur}; - boolean Libre,Multiplication,Texte; - Libre:=\useKV[ClesPQuatre]{Libre}; - Multiplication=\useKV[ClesPQuatre]{Multiplication}; - Texte:=\useKV[ClesPQuatre]{Texte}; + PQLargeur=\useKV[ClesPQuatre]{Largeur}; + PQLargeurUn=\useKV[ClesPQuatre]{LargeurUn}; + PQEchelle=\useKV[ClesPQuatre]{Echelle}; + color PQfond; + PQfond=\useKV[ClesPQuatre]{Couleur}; + boolean PQLibre,PQMultiplication,PQTexte; + PQLibre:=\useKV[ClesPQuatre]{Libre}; + PQMultiplication=\useKV[ClesPQuatre]{Multiplication}; + PQTexte:=\useKV[ClesPQuatre]{Texte}; - if Texte: - string Consignes; - Consignes=\useKV[ClesPQuatre]{Consignes}; + if PQTexte: + string PQConsignes; + PQConsignes=\useKV[ClesPQuatre]{Consignes}; fi; % On calcule le nombre de cases @@ -88,49 +88,49 @@ for p_=#2: nclargeur:=incr nclargeur; endfor; - if Libre=false: + if PQLibre=false: nchauteur:=7; nclargeur:=7; fi; %On affiche pair A,B,C,D,H[],V[],M[][]; A=(0,0); - B-A=Largeur*(nclargeur,0); - C-B=Largeur*(0,nchauteur); + B-A=PQLargeur*(nclargeur,0); + C-B=PQLargeur*(0,nchauteur); D-C=A-B; - fill polygone(A,B,C,D) withcolor fond; + fill polygone(A,B,C,D) withcolor PQfond; trace polygone(A,B,C,D); for k=0 upto (nclargeur-1): for l=0 upto (nchauteur-1): - M[k][l]=A+0.5*(Largeur,Largeur)+k*(Largeur,0)+l*(0,Largeur); - fill cercles(M[k][l],0.4*Largeur) withcolor blanc; - trace cercles(M[k][l],0.4*Largeur); + M[k][l]=A+0.5*(PQLargeur,PQLargeur)+k*(PQLargeur,0)+l*(0,PQLargeur); + fill cercles(M[k][l],0.4*PQLargeur) withcolor blanc; + trace cercles(M[k][l],0.4*PQLargeur); endfor; endfor; labeloffset:=labeloffset*2; - if Libre: - if Texte: - label.llft(TEX("\begin{minipage}{"&decimal(LargeurUn)&"pt}"&Consignes&"\end{minipage}") scaled Echelle,A); + if PQLibre: + if PQTexte: + label.llft(TEX("\begin{minipage}{"&decimal(PQLargeurUn)&"pt}"&PQConsignes&"\end{minipage}") scaled PQEchelle,A); fi; else: - if Multiplication: - label.llft(btex $\times$ etex scaled Echelle,A); + if PQMultiplication: + label.llft(TEX("$\times$") scaled PQEchelle,A); else: - label.llft(btex $+$ etex scaled Echelle,A); + label.llft(TEX("$+$") scaled PQEchelle,A); fi; fi; labeloffset:=labeloffset/2; vardef Vertical(text t)= n:=0; for p_=t: - label.lft(TEX(p_) scaled Echelle,A+(0,n*Largeur+Largeur/2)); + label.lft(TEX(p_) scaled PQEchelle,A+(0,n*PQLargeur+PQLargeur/2)); n:=n+1; endfor; enddef; vardef Horizontal(text t)= n:=0; for p_=t: - label.bot(TEX(p_) scaled Echelle,A+(n*Largeur+Largeur/2,0)); + label.bot(TEX(p_) scaled PQEchelle,A+(n*PQLargeur+PQLargeur/2,0)); n:=n+1; endfor; enddef; diff --git a/macros/latex/contrib/profcollege/latex/PfCPythagore.tex b/macros/latex/contrib/profcollege/latex/PfCPythagore.tex index 0ebc259286..5df5f0b03a 100644 --- a/macros/latex/contrib/profcollege/latex/PfCPythagore.tex +++ b/macros/latex/contrib/profcollege/latex/PfCPythagore.tex @@ -275,6 +275,10 @@ \NewDocumentCommand\CalculsPythagore{o m m m m}{% \xintifboolexpr{#3<#4 || #3==#4}{%\ifnum#3<#4% \xdef\ResultatPytha{\fpeval{round(sqrt(#3^2+#4^2),\useKV[ClesPythagore]{Precision})}}% + \ifboolKV[ClesPythagore]{EnchaineA}{\xdef\PfCPythaVA{\useKV[ClesPythagore]{ValeurA}}}{\xdef\PfCPythaVA{\fpeval{#3^2}}}% + \ifboolKV[ClesPythagore]{EnchaineB}{\xdef\PfCPythaVB{\useKV[ClesPythagore]{ValeurB}}}{\xdef\PfCPythaVB{\fpeval{#4^2}}}% + \xdef\ResultatAttendu{\fpeval{\PfCPythaVA+\PfCPythaVB}}% + \xdef\ResultatApproche{\fpeval{round(sqrt(\ResultatAttendu),\useKV[ClesPythagore]{Precision})^2}}% \begin{align*} \NomA\NomC^2&=\NomA\NomB^2+\NomB\NomC^2\\ \NomA\NomC^2&=\ifboolKV[ClesPythagore]{EnchaineA}{\opcopy{\useKV[ClesPythagore]{ValeurA}}{a1}\opexport{a1}{\Aun}\num{\Aun}}{\opexport{A1}{\Aun}\num{\Aun}^2}+\ifboolKV[ClesPythagore]{EnchaineB}{\opcopy{\useKV[ClesPythagore]{ValeurB}}{a2}\opexport{a2}{\Adeux}\num{\Adeux}}{\opexport{A2}{\Adeux}\num{\Adeux}^2}\\ @@ -282,11 +286,15 @@ \NomA\NomC^2&=\opadd*{a1}{a2}{a3}\opexport{a3}{\Atrois}\num{\Atrois}%\\ \ifboolKV[ClesPythagore]{AvantRacine}{}{% \ifboolKV[ClesPythagore]{Entier}{}{\\\NomA\NomC&=\sqrt{\opexport{a3}{\Atrois}\num{\Atrois}}} - \ifboolKV[ClesPythagore]{Racine}{}{\\\NomA\NomC&\IfInteger{\fpeval{round(sqrt(#3^2+#4^2),\useKV[ClesPythagore]{Precision})^2-#3^2-#4^2}}{=}{\approx}\opsqrt[maxdivstep=5]{a3}{a4}\opround{a4}{pres}{a4}\opunzero{a4}\opexport{a4}{\Aquatre}\SI{\Aquatre}{\PfCPythaUnit}}%\\ + \ifboolKV[ClesPythagore]{Racine}{}{\\\NomA\NomC&\IfStrEq{\ResultatApproche}{\ResultatAttendu}{=}{\approx}\opsqrt[maxdivstep=5]{a3}{a4}\opround{a4}{pres}{a4}\opunzero{a4}\opexport{a4}{\Aquatre}\SI{\Aquatre}{\PfCPythaUnit}}%\\ } \end{align*} - }{%\else + }{% \xdef\ResultatPytha{\fpeval{round(sqrt(#3^2-#4^2),\useKV[ClesPythagore]{Precision})}}% + \ifboolKV[ClesPythagore]{EnchaineC}{\xdef\PfCPythaVC{\useKV[ClesPythagore]{ValeurC}}}{\xdef\PfCPythaVC{\fpeval{#3^2}}}% + \ifboolKV[ClesPythagore]{EnchaineB}{\xdef\PfCPythaVB{\useKV[ClesPythagore]{ValeurB}}}{\xdef\PfCPythaVB{\fpeval{#4^2}}}% + \xdef\ResultatAttendu{\fpeval{\PfCPythaVC-\PfCPythaVB}}% + \xdef\ResultatApproche{\fpeval{round(sqrt(\ResultatAttendu),\useKV[ClesPythagore]{Precision})^2}}% \ifboolKV[ClesPythagore]{Soustraction}{% \begin{align*} \NomA\NomB^2&=\NomA\NomC^2-\NomB\NomC^2\\ @@ -295,7 +303,7 @@ \NomA\NomB^2&=\opsub*{a1}{a2}{a3}\opexport{a3}{\Atrois}\num{\Atrois}%\\ \ifboolKV[ClesPythagore]{AvantRacine}{}{% \ifboolKV[ClesPythagore]{Entier}{}{\\\NomA\NomB&=\sqrt{\opexport{a3}{\Atrois}\num{\Atrois}}} - \ifboolKV[ClesPythagore]{Racine}{}{\\\NomA\NomB&\IfInteger{\fpeval{round(sqrt(#3^2-#4^2),\useKV[ClesPythagore]{Precision})^2-#3^2+#4^2}}{=}{\approx}\opsqrt[maxdivstep=5]{a3}{a4}\opround{a4}{pres}{a4}\opunzero{a4}\opexport{a4}{\Aquatre}\SI{\Aquatre}{\PfCPythaUnit}}%\\ + \ifboolKV[ClesPythagore]{Racine}{}{\\\NomA\NomB&\IfStrEq{\ResultatApproche}{\ResultatAttendu}{=}{\approx}\opsqrt[maxdivstep=5]{a3}{a4}\opround{a4}{pres}{a4}\opunzero{a4}\opexport{a4}{\Aquatre}\SI{\Aquatre}{\PfCPythaUnit}}%\\ } \end{align*} }{% @@ -307,8 +315,8 @@ \NomA\NomB^2&=\opsub*{a1}{a2}{a3}\opexport{a3}{\Atrois}\num{\Atrois}%\\ \ifboolKV[ClesPythagore]{AvantRacine}{}{% \ifboolKV[ClesPythagore]{Entier}{}{\\\NomA\NomB&=\sqrt{\opexport{a3}{\Atrois}\num{\Atrois}}}% - \ifboolKV[ClesPythagore]{Racine}{}{\\\NomA\NomB&\IfInteger{\fpeval{round(sqrt(#3^2-#4^2),\useKV[ClesPythagore]{Precision})^2-#3^2+#4^2}}{=}{\approx}\opsqrt[maxdivstep=5]{a3}{a4}\opround{a4}{pres}{a4}\opunzero{a4}\opexport{a4}{\Aquatre}\SI{\Aquatre}{\PfCPythaUnit}}%\\ - } + \ifboolKV[ClesPythagore]{Racine}{}{\\\NomA\NomB&\IfStrEq{\ResultatApproche}{\ResultatAttendu}{=}{\approx}\opsqrt[maxdivstep=5]{a3}{a4}\opround{a4}{pres}{a4}\opunzero{a4}\opexport{a4}{\Aquatre}\SI{\Aquatre}{\PfCPythaUnit}}%\\ + } \end{align*} }% }%\fi% diff --git a/macros/latex/contrib/profcollege/latex/PfCReperage.tex b/macros/latex/contrib/profcollege/latex/PfCReperage.tex index 93bce3c393..9924f631f8 100644 --- a/macros/latex/contrib/profcollege/latex/PfCReperage.tex +++ b/macros/latex/contrib/profcollege/latex/PfCReperage.tex @@ -1,7 +1,7 @@ %%% % Reperage %%% -\setKVdefault[ClesReperage]{Unitex=1,Pasx=1,Unitey=1,Pasy=1,Unitez=1,Pasz=1,DemiDroite=false,Droite=false,Plan=false,Trace=false,ListeSegment={},Espace=false,Sphere=false,AnglePhi=30,CouleurLa=white,CouleurLon=Tomato,AffichageUnites=true,MarquePrimaire=true,AffichageNom=false,AffichageGrad=false,AffichageAbs=0,AffichageCoord=false,LectureCoord=false,ValeurUnitex=1,ValeurUnitey=1,ValeurOrigine=0,NomOrigine=O,EchelleEspace=50,CouleurCoord=black,Thermometre=false,Mercure=false,CouleurMercure=black,Celsius,Kelvin=false,Farenheit=false,ValeurMin=-4000,ValeurMax=4000,Etages=4,Code=false,Globe=false,Rho=1500,Phi=22,Theta=10,CouleurE=orange,CouleurG=green,Axes=false,TypeProj="persp",Niveaux=false} +\setKVdefault[ClesReperage]{Unitex=1,Pasx=1,Unitey=1,Pasy=1,Unitez=1,Pasz=1,DemiDroite=false,Droite=false,Plan=false,Trace=false,ListeSegment={},Espace=false,Sphere=false,AnglePhi=30,CouleurLa=white,CouleurLon=Tomato,AffichageUnites=true,MarquePrimaire=true,AffichageNom=false,AffichageGrad=false,AffichageAbs=0,AffichageCoord=false,LectureCoord=false,ValeurUnitex=1,ValeurUnitey=1,ValeurOrigine=0,NomOrigine=O,EchelleEspace=50,CouleurCoord=black,Thermometre=false,Mercure=false,CouleurMercure=black,Celsius,Kelvin=false,Farenheit=false,ValeurMin=-4000,ValeurMax=4000,Etages=4,Code=false,Globe=false,Rho=1500,Phi=22,Theta=10,CouleurE=orange,CouleurG=green,Axes=false,TypeProj="persp",Niveaux=false,Decale=false} \defKV[ClesReperage]{Traces=\setKV[ClesReperage]{Code}}% \defKV[ClesReperage]{Niveau=\setKV[ClesReperage]{Etages=#1}\setKV[ClesReperage]{Niveaux}}% % ValeurOrigine permet de faire des morceaux de demi-droite gradu\'ee en passant par droite :) @@ -1428,10 +1428,11 @@ AffichageGrad:=\AffichageGrad; AffichageCoord:=\useKV[ClesReperage]{AffichageAbs}; AffichageNom:=\AffichageNom; - boolean DemiDroite,AffichageUnites,MarquePrimaire; + boolean DemiDroite,AffichageUnites,MarquePrimaire,Decale; DemiDroite=\useKV[ClesReperage]{DemiDroite}; AffichageUnites=\useKV[ClesReperage]{AffichageUnites}; MarquePrimaire=\useKV[ClesReperage]{MarquePrimaire}; + Decale=\useKV[ClesReperage]{Decale}; numeric valeur[]; vardef titi(text t)= n:=0; @@ -1541,8 +1542,22 @@ if ACoord=4: pointe(unitp*(valeur[n],0)); elseif ACoord=3: - drawarrow ((unitp*valeur[n],-7mm))--((unitp*valeur[n],-3mm)); - label.bot(btex \hbox to2em{\dotfill} etex,((unitp*valeur[n],-8mm))); + if Decale: + drawarrow (unitp*valeur[n],-7mm if (n mod 2)=0:-5mm fi)--(unitp*valeur[n],-3mm); + else: + drawarrow (unitp*valeur[n],-7mm)--(unitp*valeur[n],-3mm); + fi; + numeric LongPoint; + Labeloffset:=labeloffset; + labeloffset:=0pt; + if DemiDroite: + LongPoint=abs(C-(B+unitp*(0.75,0))); + label.rt(TEX("\pointilles["&decimal(LongPoint)&"pt]"),C+(0,-1.6cm)); + else: + LongPoint=abs((C+unitp*(-0.75,0))-(B+unitp*(0.75,0))); + label.rt(TEX("\pointilles["&decimal(LongPoint)&"pt]"),C+unitp*(-0.75,0)+(0,-1.6cm)); + fi; + labeloffset:=Labeloffset; pointe(unitp*(valeur[n],0)); elseif ACoord=2: if ((ValeurUnitex*valeur[n]) mod pasx)<>0: @@ -1560,8 +1575,22 @@ pointe(unitp*(valeur[n],0)); elseif AffichageCoord=3: if p_<>"": - drawarrow ((unitp*valeur[n],-7mm))--((unitp*valeur[n],-3mm)); - label.bot(btex \hbox to2em{\dotfill} etex,((unitp*valeur[n],-8mm))); + if Decale: + drawarrow (unitp*valeur[n],-7mm if (n mod 2)=0:-5mm fi)--(unitp*valeur[n],-3mm); + else: + drawarrow (unitp*valeur[n],-7mm)--(unitp*valeur[n],-3mm); + fi; + numeric LongPoint; + Labeloffset:=labeloffset; + labeloffset:=0pt; + if DemiDroite: + LongPoint=abs(C-(B+unitp*(0.75,0))); + label.rt(TEX("\pointilles["&decimal(LongPoint)&"pt]"),C+(0,-1.6cm)); + else: + LongPoint=abs((C+unitp*(-0.75,0))-(B+unitp*(0.75,0))); + label.rt(TEX("\pointilles["&decimal(LongPoint)&"pt]"),C+unitp*(-0.75,0)+(0,-1.6cm)); + fi; + labeloffset:=Labeloffset; pointe(unitp*(valeur[n],0)); fi; elseif AffichageCoord=2: diff --git a/macros/latex/contrib/profcollege/latex/PfCSerpent.tex b/macros/latex/contrib/profcollege/latex/PfCSerpent.tex new file mode 100644 index 0000000000..b71434dc30 --- /dev/null +++ b/macros/latex/contrib/profcollege/latex/PfCSerpent.tex @@ -0,0 +1,365 @@ +%%% +% Serpent +%%% +\newtoks\tokListeSerpentPerso{}% +\def\UpdatetoksSerpent#1\nil{\addtotok\tokListeSerpentPerso{"#1"}}% + +\setKVdefault[Serpent]{Cases=9,Case=1,Solution=false,PasQuad=7mm,ValeurMin=2,ValeurMax=10,Creation=false,Graines=false} +\defKV[Serpent]{CouleurSolution=\setKV[Serpent]{Solution}}% +\defKV[Serpent]{Perso=\setKV[Serpent]{Creation}\xdef\PfCFooCheminSerpent{#1}}%+Liste des déplacements +\defKV[Serpent]{Graine=\setKV[Serpent]{Graines}}% + +\NewDocumentCommand\Serpent{o}{% + \useKVdefault[Serpent]% + \setKV[Serpent]{#1}% + \tokListeSerpentPerso{}% + \ifboolKV[Serpent]{Creation}{% + \setsepchar{,}\ignoreemptyitems% + \expandafter\UpdatetoksSerpent\PfCFooCheminSerpent\nil% + \BuildSerpent{\the\tokListeSerpentPerso}% + }{% + \BuildSerpent{}% + }% +}% + +\NewDocumentCommand\BuildSerpent{m}{% + \ifluatex% + \mplibforcehmode% + \mplibnumbersystem{double}% + \begin{mplibcode} + % + boolean Solution,Perso,Graines; + Solution=\useKV[Serpent]{Solution}; + Perso=\useKV[Serpent]{Creation}; + Graines=\useKV[Serpent]{Graines}; + % + if Graines: + randomseed:=\useKV[Serpent]{Graine}; + fi; + % + color CoulSolution; + if Solution: + CoulSolution=\useKV[Serpent]{CouleurSolution}; + fi; + % + numeric LongueurChemin,Depart; + LongueurChemin=\useKV[Serpent]{Cases}; + ValeurMin=\useKV[Serpent]{ValeurMin}; + ValeurMax=\useKV[Serpent]{ValeurMax}; + CaseDepart=\useKV[Serpent]{Case}; + Depart=ValeurMin+floor(uniformdeviate(ValeurMax-ValeurMin+1)); + % + boolean Impossible[][]; + % + vardef InitialisationZone= + for k=-1 upto HautQuad+1: + for l=-1 upto LargQuad+1: + Impossible[k][l]=true; + endfor; + endfor; + for k=1 upto HautQuad: + for l=1 upto LargQuad: + Impossible[k][l]:=false; + endfor; + endfor; + enddef; + % + vardef ReInitialisationZone= + for k=-1 upto HautQuad+1: + for l=-1 upto LargQuad+1: + Impossible[k][l]:=true; + endfor; + endfor; + for k=1 upto HautQuad: + for l=1 upto LargQuad: + Impossible[k][l]:=false; + endfor; + endfor; + enddef; + % + vardef RAZZone= + pair PileChemin[]; + indiceChemin:=0; + enddef; + % + def PushChemin(expr tt)= + if indiceChemin<1: + PileChemin[1]:=tt; + indiceChemin:=1; + else: + PileChemin[indiceChemin+1]:=tt; + indiceChemin:=indiceChemin+1; + fi; + enddef; + % + def PopChemin= + currentpicture:=nullpicture; + RAZZone; + ReInitialisationZone; + %Redemarrage + nbcaseschoisies:=1; + PushChemin((ChoixLigneD,ChoixColonneD)); + N[nbcaseschoisies]=4*PasQuad*(ChoixColonneD-1,ChoixLigneD-1); + Impossible[ChoixLigneD][ChoixColonneD]:=true; + VoisinDispo(ChoixLigneD,ChoixColonneD); + enddef; + % + %Pile des cases voisines de la case parcourue + pair PileVoisin[]; + numeric indiceVoisin; + indiceVoisin=0; + % + vardef RAZPileVoisin= + indiceVoisin:=0; + enddef; + % + def PushVoisin(expr tt)= + if indiceVoisin<1: + PileVoisin[1]:=tt; + indiceVoisin:=1; + else: + PileVoisin[indiceVoisin+1]:=tt; + indiceVoisin:=indiceVoisin+1; + fi; + enddef; + % + vardef VoisinDispo(expr la,lo)= + RAZPileVoisin; + numeric nbvoisin; + nbvoisin:=0; + if Impossible[la+1][lo]=false: + nbvoisin:=nbvoisin+1; + PushVoisin((la+1,lo)); + fi; + if Impossible[la-1][lo]=false: + nbvoisin:=nbvoisin+1; + PushVoisin((la-1,lo)); + fi; + if Impossible[la][lo+1]=false: + nbvoisin:=nbvoisin+1; + PushVoisin((la,lo+1)); + fi; + if Impossible[la][lo-1]=false: + nbvoisin:=nbvoisin+1; + PushVoisin((la,lo-1)); + fi; + enddef; + % + PasQuad=\useKV[Serpent]{PasQuad}; + HautQuad=if (LongueurChemin mod 2)=1:(LongueurChemin+1) div 2 else: LongueurChemin div 2 fi; + LargQuad=HautQuad; + % Démarrage du choix perso ou automatique du serpent + InitialisationZone; + RAZZone; + % + ChoixLigneD=(HautQuad div 2)+1; + ChoixColonneD=(LargQuad div 2)+1; + % + pair N[]; + vardef RemplirChemin(text t)= + nbpoints:=1; + N[1]:=4*PasQuad*(0,0); + string p_; + for k=2 upto LongueurChemin: + nbpoints:=nbpoints+1; + p_:=substring(k-2,k-1) of t; + if p_=">": + N[nbpoints]=N[nbpoints-1]+4*PasQuad*(1,0); + elseif p_="<": + N[nbpoints]=N[nbpoints-1]+4*PasQuad*(-1,0); + elseif p_="+": + N[nbpoints]=N[nbpoints-1]+4*PasQuad*(0,1); + elseif p_="-": + N[nbpoints]=N[nbpoints-1]+4*PasQuad*(0,-1); + fi; + endfor; + enddef; + % + if Perso: + % chemin personnel + RemplirChemin(#1); + else: + PushChemin((ChoixLigneD,ChoixColonneD)); + nbcaseschoisies=1; + N[nbcaseschoisies]=4*PasQuad*(ChoixColonneD-1,ChoixLigneD-1); + Impossible[ChoixLigneD][ChoixColonneD]:=true; + VoisinDispo(ChoixLigneD,ChoixColonneD); + % Le "parcours" + forever: exitif nbcaseschoisies>LongueurChemin-1; + nb:=ceiling(uniformdeviate(nbvoisin)); + if nb>0: + for k=1 upto nbvoisin: + Impossible[xpart(PileVoisin[nb])][ypart(PileVoisin[nb])]:=true; + endfor; + PushChemin((xpart(PileVoisin[nb]),ypart(PileVoisin[nb]))); + nbcaseschoisies:=nbcaseschoisies+1; + N[nbcaseschoisies]:=4*PasQuad*(ypart(PileVoisin[nb])-1,xpart(PileVoisin[nb])-1); + VoisinDispo(xpart(PileChemin[indiceChemin]),ypart(PileChemin[indiceChemin])); + else: + PopChemin; + fi; + endfor; + fi; + % Tracage + if CaseDepart=1: + label(TEX("\Large"&decimal(Depart)),N[1] shifted(PasQuad*(1,1))); + else: + if Solution: + label(TEX("\Large"&decimal(Depart)),N[1] shifted(PasQuad*(1,1))) withcolor CoulSolution; + fi; + fi; + for k=1 upto LongueurChemin: + trace (unitsquare scaled (2*PasQuad)) shifted N[k]; + endfor; + for k=1 upto LongueurChemin-1: + drawarrow (center (unitsquare scaled (2*PasQuad)) shifted N[k])--(center (unitsquare scaled (2*PasQuad)) shifted N[k+1]) cutbefore ((unitsquare scaled (2*PasQuad)) shifted N[k]) cutafter ((unitsquare scaled (2*PasQuad)) shifted N[k+1]); + endfor; + %%drawoptions(); + boolean PremierChiffre; + PremierChiffre=true; + %% Test Premier + vardef TestPremier(expr nombre)= + nbdiviseur:=0; + nbdiv:=0; + for k=2 upto nombre: + if (nombre mod k)=0: + nbdiviseur:=nbdiviseur+1; + if k<11: + nbdiv:=nbdiv+1; + Diviseur[nbdiv]:=k; + fi; + fi; + endfor; + if nbdiviseur>1: + PremierChiffre:=false; + else: + PremierChiffre:=true; + fi; + enddef; + % Les opérations + vardef EcrireSomme(expr tt)= + Somme:=5+ceiling(uniformdeviate(10)); + Chiffre[tt]=Chiffre[tt-1]+Somme; + St[tt]=iso(N[tt-1]+PasQuad*(1,1),N[tt]+PasQuad*(1,1)); + if xpart(N[tt])-xpart(N[tt-1])=0: + label.rt(TEX("$+"&decimal(Somme)&"$"),St[tt]); + else: + label.bot(TEX("$+"&decimal(Somme)&"$"),St[tt]); + fi; + enddef; + % + vardef EcrireProduit(expr tt)= + Multiple:=1+ceiling(uniformdeviate(8)); + Chiffre[tt]=Chiffre[tt-1]*Multiple; + St[tt]=iso(N[tt-1]+PasQuad*(1,1),N[tt]+PasQuad*(1,1)); + if xpart(N[tt])-xpart(N[tt-1])=0: + label.rt(TEX("$\times"&decimal(Multiple)&"$"),St[tt]); + else: + label.bot(TEX("$\times"&decimal(Multiple)&"$"),St[tt]); + fi; + enddef; + numeric Chiffre[]; + pair St[]; + Chiffre[1]=Depart; + % + vardef EcrireDifferenceCent(expr tt)= + Difference:=ceiling(Chiffre[tt-1]-15+uniformdeviate(10)); + Chiffre[tt]=Chiffre[tt-1]-Difference; + St[tt]=iso(N[tt-1]+PasQuad*(1,1),N[tt]+PasQuad*(1,1)); + if xpart(N[tt])-xpart(N[tt-1])=0: + label.rt(TEX("$-"&decimal(Difference)&"$"),St[tt]); + else: + label.bot(TEX("$-"&decimal(Difference)&"$"),St[tt]); + fi; + enddef; + % + vardef EcrireDifference(expr tt)= + Difference:=if Chiffre[tt-1]<20:1+floor(uniformdeviate(Chiffre[tt-1]-1)) else: 5+ceiling(uniformdeviate(10)) fi; + Chiffre[tt]=Chiffre[tt-1]-Difference; + St[tt]=iso(N[tt-1]+PasQuad*(1,1),N[tt]+PasQuad*(1,1)); + if xpart(N[tt])-xpart(N[tt-1])=0: + label.rt(TEX("$-"&decimal(Difference)&"$"),St[tt]); + else: + label.bot(TEX("$-"&decimal(Difference)&"$"),St[tt]); + fi; + enddef; + % + vardef EcrireQuotient(expr tt)= + choixdiv:=ceiling(nbdiv); + Quotient:=Diviseur[choixdiv]; + Chiffre[tt]=Chiffre[tt-1] div Quotient; + St[tt]=iso(N[tt-1]+PasQuad*(1,1),N[tt]+PasQuad*(1,1)); + if xpart(N[tt])-xpart(N[tt-1])=0: + label.rt(TEX("$\div"&decimal(Quotient)&"$"),St[tt]); + else: + label.bot(TEX("$\div"&decimal(Quotient)&"$"),St[tt]); + fi; + enddef; + % + for k=2 upto LongueurChemin: + if (Chiffre[k-1]=1) or (Chiffre[k-1]=0): + % On additionne ou on multiplie si c'est un + if Chiffre[k-1]=1: + alea:=ceiling(uniformdeviate(2)); + if alea=1: + EcrireSomme(k); + else: + EcrireProduit(k); + fi; + else: + EcrireSomme(k); + fi; + else: + TestPremier(Chiffre[k-1]); + if PremierChiffre: + if Chiffre[k-1]>100: + EcrireDifferenceCent(k); + else: + alea:=ceiling(uniformdeviate(3)); + if alea=1: + EcrireSomme(k); + elseif alea=2: + EcrireDifference(k); + elseif alea=3: + EcrireProduit(k); + fi; + fi; + if k=CaseDepart: + label(TEX("\Large"&decimal(Chiffre[k])),N[k] shifted(PasQuad*(1,1))); + elseif Solution: + label(TEX("\Large"&decimal(Chiffre[k])),N[k] shifted(PasQuad*(1,1))) withcolor CoulSolution; + fi; + else: + if Chiffre[k-1]>100: + alea:=ceiling(uniformdeviate(2)); + if alea=1: + EcrireDifferenceCent(k); + else: + EcrireQuotient(k); + fi; + else: + alea:=ceiling(uniformdeviate(4)); + if alea=1: + EcrireSomme(k); + elseif alea=2: + EcrireDifference(k); + elseif alea=3: + EcrireProduit(k); + elseif alea=4: + EcrireQuotient(k); + fi; + fi; + fi; + fi; + if k=CaseDepart: + label(TEX("\Large"&decimal(Chiffre[k])),N[k] shifted(PasQuad*(1,1))); + else: + if Solution: + label(TEX("\Large"&decimal(Chiffre[k])),N[k] shifted(PasQuad*(1,1))) withcolor CoulSolution; + fi; + fi; + endfor; + \end{mplibcode} + \mplibnumbersystem{scaled}% + \fi +}%
\ No newline at end of file diff --git a/macros/latex/contrib/profcollege/latex/PfCStatistiques.tex b/macros/latex/contrib/profcollege/latex/PfCStatistiques.tex index b5322f13e2..720186804f 100644 --- a/macros/latex/contrib/profcollege/latex/PfCStatistiques.tex +++ b/macros/latex/contrib/profcollege/latex/PfCStatistiques.tex @@ -1803,7 +1803,7 @@ Histogramme=false,UniteAire=1,MemeAmpli,DepartHisto=1% \foreachitem\don\in\ListeComplete{\xdef\EffectifTotal{\fpeval{\EffectifTotal+\ListeComplete[\doncnt,2]}}}% L'effectif total de la s\'erie est : \[\ListeComplete[1,2]\xintFor* ##1 in {\xintSeq {2}{\ListeCompletelen}}\do{% - +\ListeComplete[##1,2]}=\num{\EffectifTotal}\]} + +\ListeComplete[##1,2]}=\num{\EffectifTotal}.\]} }{}% \ifboolKV[ClesStat]{Liste}{\xdef\EffectifTotal{\ListeCompletelen}}{\xdef\EffectifTotal{\SommeDonnees}}% % %% celui de la moyenne @@ -1833,7 +1833,7 @@ Histogramme=false,UniteAire=1,MemeAmpli,DepartHisto=1% \opdiv*{\SommeDonnees}{\ListeCompletelen}{resultatmoy}{restemoy}% \opround{resultatmoy}{\useKV[ClesStat]{Precision}}{resultatmoy1}% \opcmp{resultatmoy}{resultatmoy1}\ifopeq=\else\approx\fi% - \num{\fpeval{round(\SommeDonnees/\ListeCompletelen,\useKV[ClesStat]{Precision})}}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}% + \num{\fpeval{round(\SommeDonnees/\ListeCompletelen,\useKV[ClesStat]{Precision})}}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}.% }% \]% }{}% @@ -1885,14 +1885,14 @@ Histogramme=false,UniteAire=1,MemeAmpli,DepartHisto=1% \xintifboolexpr{\ListeCompletelen<\useKV[ClesStat]{Coupure}}{% \[\DTLforeach{mtdb}{\numeroDonnee=Numeric}{\num{\numeroDonnee}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}\DTLiflastrow{.}{;}}\]% }{% - \medskip% + %\medskip% \begin{center} \begin{minipage}{0.9\linewidth} \DTLforeach*{mtdb}{\numeroDonnee=Numeric}{\num{\numeroDonnee}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}\DTLiflastrow{.}{; }\nbdonnees=\fpeval{\nbdonnees+1}\modulo{\nbdonnees}{\useKV[ClesStat]{Coupure}}\xintifboolexpr{\remainder==0}{\\}{}} \end{minipage} \end{center}% - \medskip% + %\medskip% }% \newcount\med% \newcount\meda% @@ -1994,7 +1994,7 @@ Histogramme=false,UniteAire=1,MemeAmpli,DepartHisto=1% \ifboolKV[ClesStat]{EffectifTotal}{% L'effectif total de la s\'erie est : \[\ListeComplete[1,2]\xintFor* ##1 in {\xintSeq {2}{\ListeCompletelen}}\do{% - +\ListeComplete[##1,2]}=\num{\EffectifTotal}\] + +\ListeComplete[##1,2]}=\num{\EffectifTotal}.\] }{}% \ifboolKV[ClesStat]{Moyenne}{% \ifboolKV[ClesStat]{Somme}{La somme des donn\'ees de la s\'erie est :% @@ -2018,7 +2018,7 @@ Histogramme=false,UniteAire=1,MemeAmpli,DepartHisto=1% \ifboolKV[ClesStat]{Liste}{ \num{\EffectifTotal}\\}{% \[\num{\ListeComplete[1,2]}\xintFor* ##1 in {\xintSeq {2}{\ListeCompletelen}}\do{% +\num{\ListeComplete[##1,2]} - }=\num{\EffectifTotal} + }=\num{\EffectifTotal}. \]% }% }% @@ -2028,7 +2028,7 @@ Histogramme=false,UniteAire=1,MemeAmpli,DepartHisto=1% \opdiv*{\SommeDonnees}{\EffectifTotal}{resultatmoy}{restemoy}% \opround{resultatmoy}{\useKV[ClesStat]{Precision}}{resultatmoy1}% \opcmp{resultatmoy}{resultatmoy1}\ifopeq=\else\approx\fi% - \num{\fpeval{round(\SommeDonnees/\EffectifTotal,\useKV[ClesStat]{Precision})}}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}% + \num{\fpeval{round(\SommeDonnees/\EffectifTotal,\useKV[ClesStat]{Precision})}}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}.% }% \]% }{}% diff --git a/macros/latex/contrib/profcollege/latex/PfCTableauxUnites.tex b/macros/latex/contrib/profcollege/latex/PfCTableauxUnites.tex index 8e75b05cdd..0c870c5207 100644 --- a/macros/latex/contrib/profcollege/latex/PfCTableauxUnites.tex +++ b/macros/latex/contrib/profcollege/latex/PfCTableauxUnites.tex @@ -1,8 +1,9 @@ %%% % Tableaux d'unit\'es %%% -\setKVdefault[ClesTableaux]{Virgule=true,Incline=false,Entiers=false,Decimaux=false,Milliards=false,Millions=false,Micro=false,Nano=false,Partie=false,CouleurG=gray!15,CouleurM=gray!15,Couleurm=gray!15,Couleuru=gray!15,Couleurd=gray!15,Classes=false,Nombres=false,Puissances=false,NbLignes=2,Metre=false,Are=false,Capacite=false,Carre=false,Cube=false,Litre=false,Gramme=false,Fleches=false,FlechesB=false,FlechesH=false,Colonnes=false,Prefixes=false,Escalier=false,Taille=5,Largeur=4.75em,Nom=PfCTableau,CodeAfter={},PuissancesSeules=false,Colonne=-1,Octet=false,CouleurGN=white,CadreGN=black,Tabcolsep=0.275\tabcolsep} - +\setKVdefault[ClesTableaux]{Virgule=true,Incline=false,Entiers=false,Decimaux=false,Milliards=false,Millions=false,Micro=false,Nano=false,Partie=false,CouleurG=gray!15,CouleurM=gray!15,Couleurm=gray!15,Couleuru=gray!15,Couleurd=gray!15,Classes=false,Nombres=false,Puissances=false,NbLignes=2,Metre=false,Are=false,Capacite=false,Carre=false,Cube=false,Litre=false,Gramme=false,Fleches=false,FlechesB=false,FlechesH=false,Colonnes=false,Prefixes=false,Escalier=false,Taille=5,Largeur=4.75em,Nom=PfCTableau,CodeAfter={},PuissancesSeules=false,Colonne=-1,Octet=false,CouleurGN=white,CadreGN=black,Tabcolsep=0.275\tabcolsep,Exterieur=false}% +\defKV[ClesTableaux]{ColonnesSup=\setKV[ClesTableaux]{Exterieur}}% +% \newcommand\PfCTBstrut{\rule[-1.2ex]{0pt}{3.8ex}}% Top and Bottom strut \newcommand\PfCTstrut{\rule{0pt}{3.8ex}}% Top strut \newcommand\PfCBstrut{\rule[-1.2ex]{0pt}{0ex}}% Bottom strut @@ -1047,29 +1048,70 @@ %%% Prise en compte de la cl\'e Metre % \ifboolKV[ClesTableaux]{Metre}{% + \xdef\PfCNbColonnesUnites{7}% + \xdef\PfCNbColonnesUnitesSup{0}% + \ifboolKV[ClesTableaux]{Exterieur}{% + \xdef\PfCNbColonnesUnites{\fpeval{\PfCNbColonnesUnites+2*\useKV[ClesTableaux]{ColonnesSup}}}% + \xdef\PfCNbColonnesUnitesSup{\useKV[ClesTableaux]{ColonnesSup}}% + }{}% \[\renewcommand{\arraystretch}{1.15}% - \begin{NiceTabular}{*{7}{wc{7.5mm}}}% - \Block[]{}{} - &\Block[]{}{} - &\Block[]{}{} - &\Block[]{}{} - &\Block[]{}{} - &\Block[]{}{} - &\Block[]{}{}\\ - \Block[draw]{}{km\PfCTBstrut}&\Block[draw]{1-1}{hm\PfCTBstrut}&\Block[draw]{1-1}{dam\PfCTBstrut}&\Block[draw]{1-1}{m\PfCTBstrut}&\Block[draw]{1-1}{dm\PfCTBstrut}&\Block[draw]{1-1}{cm\PfCTBstrut}&\Block[draw]{1-1}{mm\PfCTBstrut}\\ - \xintFor* ##1 in {\xintSeq {1}{\useKV[ClesTableaux]{NbLignes}}}\do{% - &&&&&&\\ + \begin{NiceTabular}{*{\PfCNbColonnesUnites}{wc{7.5mm}}}% + \ifboolKV[ClesTableaux]{Exterieur}{% + \xintFor* ##1 in{\xintSeq{1}{\useKV[ClesTableaux]{ColonnesSup}}}\do{% + \Block[]{}{}& + }}% + {}% + \Block[]{}{}% + &\Block[]{}{}% + &\Block[]{}{}% + &\Block[]{}{}% + &\Block[]{}{}% + &\Block[]{}{}% + &\Block[]{}{}% + \ifboolKV[ClesTableaux]{Exterieur}{% + \xintFor* ##1 in{\xintSeq{1}{\useKV[ClesTableaux]{ColonnesSup}}}\do{% + &\Block[]{}{}% }% - \Block[]{}{} - &\Block[]{}{} - &\Block[]{}{} - &\Block[]{}{} - &\Block[]{}{} - &\Block[]{}{} - &\Block[]{}{}\\ + }{}\\ + \ifboolKV[ClesTableaux]{Exterieur}{% + \xintFor* ##1 in{\xintSeq{1}{\useKV[ClesTableaux]{ColonnesSup}}}\do{% + \Block[]{}{}& + }% + }{}\Block[draw]{}{km\PfCTBstrut}&\Block[draw]{1-1}{hm\PfCTBstrut}&\Block[draw]{1-1}{dam\PfCTBstrut}&\Block[draw]{1-1}{m\PfCTBstrut}&\Block[draw]{1-1}{dm\PfCTBstrut}&\Block[draw]{1-1}{cm\PfCTBstrut}&\Block[draw]{1-1}{mm\PfCTBstrut}\ifboolKV[ClesTableaux]{Exterieur}{% + \xintFor* ##1 in{\xintSeq{1}{\useKV[ClesTableaux]{ColonnesSup}}}\do{% + &\Block[]{}{}% + }}{}\\ + \xintFor* ##1 in {\xintSeq {1}{\useKV[ClesTableaux]{NbLignes}}}\do{% + \ifboolKV[ClesTableaux]{Exterieur}{% + \xintFor* ##2 in{\xintSeq{1}{\useKV[ClesTableaux]{ColonnesSup}}}\do{% + \Block[]{}{}&% + }}{}&&&&&&\ifboolKV[ClesTableaux]{Exterieur}{% + \xintFor* ##2 in{\xintSeq{1}{\useKV[ClesTableaux]{ColonnesSup}}}\do{% + &\Block[]{}{} + }}{}% + \\% + }% + \ifboolKV[ClesTableaux]{Exterieur}{% + \xintFor* ##1 in{\xintSeq{1}{\useKV[ClesTableaux]{ColonnesSup}}}\do{% + \Block[]{}{}& + }% + }{}% + \Block[]{}{}% + &\Block[]{}{}% + &\Block[]{}{}% + &\Block[]{}{}% + &\Block[]{}{}% + &\Block[]{}{}% + &\Block[]{}{}% + \ifboolKV[ClesTableaux]{Exterieur}{% + \xintFor* ##1 in{\xintSeq{1}{\useKV[ClesTableaux]{ColonnesSup}}}\do{% + &\Block[]{}{}% + }% + }{}% + \\ \CodeAfter % on trace les lignes verticales - \xintFor* ##1 in {\xintSeq{1}{8}}\do{% + \xintFor* ##1 in {\xintSeq{\fpeval{1+\PfCNbColonnesUnitesSup}}{\fpeval{8+\PfCNbColonnesUnitesSup}}}\do{% \tikz\draw (3-|##1)--(\fpeval{3+\useKV[ClesTableaux]{NbLignes}}-|##1); }% % On place le nombre éventuel @@ -1077,7 +1119,7 @@ \else% \setsepchar[*]{,*/} \readlist*\ListeNombreAPlacer{#2}% - \xintFor* ##2 in{\xintSeq {1}{\ListeNombreAPlacerlen}}\do{ + \xintFor* ##2 in{\xintSeq{1}{\ListeNombreAPlacerlen}}\do{ \StrLen{\ListeNombreAPlacer[##2,1]}[\TabLongueurNombre]% \xintFor* ##1 in{\xintSeq {1}{\TabLongueurNombre}}\do{% \tikz\node at (\fpeval{##2+2.5}-|\fpeval{\ListeNombreAPlacer[##2,2]-0.5+##1}) {\PfCTBstrut\StrMid{\ListeNombreAPlacer[##2,1]}{##1}{##1}}; @@ -1087,12 +1129,12 @@ % on trace les flèches \ifboolKV[ClesTableaux]{Fleches}{\setKV[ClesTableaux]{FlechesH,FlechesB}}{}% \ifboolKV[ClesTableaux]{FlechesH}{% - \xintFor* ##1 in {\xintSeq{1}{6}}\do{% + \xintFor* ##1 in {\xintSeq{\fpeval{1+\PfCNbColonnesUnitesSup}}{\fpeval{6+\PfCNbColonnesUnitesSup}}}\do{% \tikz\draw[gray,->,>=latex,out=30,in=150] (1.5-|\fpeval{0.5+##1}) to node[above, midway]{\small$\times\num{10}$}(1.5-|\fpeval{1.5+##1});% }% }{}% \ifboolKV[ClesTableaux]{FlechesB}{% - \xintFor* ##1 in {\xintSeq{1}{6}}\do{% + \xintFor* ##1 in {\xintSeq{\fpeval{1+\PfCNbColonnesUnitesSup}}{\fpeval{6+\PfCNbColonnesUnitesSup}}}\do{% \tikz\draw[gray,->,>=latex,out=-150,in=-30] (\fpeval{3+\useKV[ClesTableaux]{NbLignes}+0.5}-|\fpeval{1.5+##1}) to node[below,midway]{\small$\div\num{10}$}(\fpeval{3+\useKV[ClesTableaux]{NbLignes}+0.5}-|\fpeval{0.5+##1});% }% }{}% diff --git a/macros/latex/contrib/profcollege/latex/ProfCollege.sty b/macros/latex/contrib/profcollege/latex/ProfCollege.sty index a179a3e281..cee8d5c58b 100644 --- a/macros/latex/contrib/profcollege/latex/ProfCollege.sty +++ b/macros/latex/contrib/profcollege/latex/ProfCollege.sty @@ -2,9 +2,9 @@ % licence : Released under the LaTeX Project Public License v1.3c % or later, see http://www.latex-project.org/lppl.txtf \NeedsTeXFormat{LaTeX2e}% -\def\filedate{2023/09/06}% +\def\filedate{2023/10/08}% \let\PfCfiledate\filedate% -\def\fileversion{0.99-z-t}% +\def\fileversion{0.99-z-u}% \let\PfCfileversion\fileversion% \ProvidesPackage{ProfCollege}[\filedate\space v\fileversion\space Aide pour utiliser LaTeX au college]% @@ -599,6 +599,15 @@ }%\emoticon }%\raisebox }% +\input{PfCDessinAlgo} +\input{PfCBonbon} +\input{PfCPattern} +\input{PfCNumerationsAnciennes} +\input{PfCSerpent} +\input{PfCFractionNombre} +\input{PfCAllumettes} +\input{PfCFractionAireCarre.tex} +\input{PfCMulJal} \input{PfCCibleQOp} \input{PfCFubuki} \input{PfCMulJap} diff --git a/macros/latex/contrib/profcollege/metapost/PfCAllumettes.mp b/macros/latex/contrib/profcollege/metapost/PfCAllumettes.mp new file mode 100644 index 0000000000..3ce248b99f --- /dev/null +++ b/macros/latex/contrib/profcollege/metapost/PfCAllumettes.mp @@ -0,0 +1,77 @@ +numeric longallu,epallu; +longallu=41.5mm; +epallu=2mm; +ecartpoint=epallu-0.1mm; + +color BurlyWood,PfCSoufre; +BurlyWood=(222,184,135)/256; +PfCSoufre=red; + +vardef Allu(expr dep,arr)= + save Retour; + picture Retour; + Retour=image( + pair depa,arra; + depa=dep+ecartpoint*unitvector(arr-dep); + arra=arr+ecartpoint*unitvector(dep-arr); + pair corps[]; + corps[1]-depa=0.5*epallu*unitvector(rotation(arr,dep,-90)-dep); + corps[4]=symetrie(corps[1],dep,arr); + corps2=corps1+0.975*(arra-depa); + corps3-corps2=corps4-corps1; + path Corps; + Corps=polygone(corps1,corps2,corps3,corps4); + fill Corps withcolor if print: white else:BurlyWood fi; + trace Corps withcolor 0.5[black,if print: white else:BurlyWood fi]; + pair cera,cerb,cerc; + cera=pointarc(cercles((0,0),1.5epallu),125); + cerb=pointarc(cercles((0,0),1.5epallu),235); + cerc=pointarc(cercles((0,0),1.5epallu),0); + path bout; + bout=arccercle(cerb,cerc,(0,0))--arccercle(cerc,cera,(0,0))--cycle; + fill (rotation(bout yscaled 0.385 xscaled 0.8,(0,0),angle(arra-depa)) shifted (arra+1.0*ecartpoint*unitvector(dep-arr))) withcolor if print:0.7white else: PfCSoufre fi; + draw (rotation(bout yscaled 0.385 xscaled 0.8,(0,0),angle(arra-depa)) shifted (arra+1.0*ecartpoint*unitvector(dep-arr))) withcolor 0.5[black,if print: 0.7white else: PfCSoufre fi]; + ); + Retour +enddef; + +vardef OldAllu(expr dep,arr)= + save Retour; + picture Retour; + Retour=image( + pair depa,arra; + depa=dep+ecartpoint*unitvector(arr-dep); + arra=arr+ecartpoint*unitvector(dep-arr); + pair corps[]; + corps[1]-depa=0.5*epallu*unitvector(rotation(arr,dep,-90)-dep); + corps[4]=symetrie(corps[1],dep,arr); + corps2=corps1+0.975*(arra-depa); + corps3-corps2=corps4-corps1; + path Corps; + Corps=polygone(corps1,corps2,corps3,corps4); +% fill Corps withcolor if print: white else:BurlyWood fi; +% trace Corps withcolor 0.5[black,if print: white else:BurlyWood fi] dashed evenly; + trace Corps dashed evenly; + pair cera,cerb,cerc; + cera=pointarc(cercles((0,0),1.5epallu),125); + cerb=pointarc(cercles((0,0),1.5epallu),235); + cerc=pointarc(cercles((0,0),1.5epallu),0); + path bout; + bout=arccercle(cerb,cerc,(0,0))--arccercle(cerc,cera,(0,0))--cycle; + fill (rotation(bout yscaled 0.385 xscaled 0.8,(0,0),angle(arra-depa)) shifted (arra+0.75*ecartpoint*unitvector(dep-arr))) withcolor white; + draw (rotation(bout yscaled 0.385 xscaled 0.8,(0,0),angle(arra-depa)) shifted (arra+0.75*ecartpoint*unitvector(dep-arr)));% withcolor 0.5[black,if print: 0.7white else: PfCSoufre fi]; + ); + Retour +enddef; + +u:=longallu+epallu; + +vardef DefinirUnite(expr pfcechelle)= + longallu:=longallu*pfcechelle; + epallu:=epallu*pfcechelle; + ecartpoint:=ecartpoint*pfcechelle; + u:=longallu+epallu; +enddef; + +endinput; + diff --git a/macros/latex/contrib/proflycee/doc/ProfLycee-doc.pdf b/macros/latex/contrib/proflycee/doc/ProfLycee-doc.pdf Binary files differindex 0197baf5f8..d30b6e2c4f 100644 --- a/macros/latex/contrib/proflycee/doc/ProfLycee-doc.pdf +++ b/macros/latex/contrib/proflycee/doc/ProfLycee-doc.pdf diff --git a/macros/latex/contrib/proflycee/doc/ProfLycee-doc.tex b/macros/latex/contrib/proflycee/doc/ProfLycee-doc.tex index 6535944623..976a0f42c5 100644 --- a/macros/latex/contrib/proflycee/doc/ProfLycee-doc.tex +++ b/macros/latex/contrib/proflycee/doc/ProfLycee-doc.tex @@ -5,8 +5,8 @@ % arara: lualatex: {shell: yes, synctex: no, interaction: batchmode} if found('log', '(undefined references|Please rerun|Rerun to get)') \documentclass[a4paper,french,11pt]{article} -\def\PLversion{2.7.7} -\def\PLdate{29 septembre 2023} +\def\PLversion{2.7.8} +\def\PLdate{8 octobre 2023} \usepackage{amsfonts} \usepackage{ProfLycee} \useproflyclib{piton,minted,pythontex,ecritures} @@ -144,12 +144,12 @@ keywordstyle={\color{violet}},% classoffset=2,% alsoletter={-},% - morekeywords={\ResolutionApprochee,\SolutionTVI,\CalculTermeRecurrence,\ToileRecurrence,\SolutionSeuil,\IntegraleApprochee,\GrilleTikz,\AxesTikz,\AxexTikz,\AxeyTikz,\FenetreTikz,\FenetreSimpleTikz,\DeclareFonctionTikz,\CourbeTikz,\OrigineTikz,\SplineTikz,\TangenteTikz,\MiniSchemaSignes,\MiniSchemaSignesTkzTab,\IntegraleApprocheeTikz,\CartoucheCapytale,\PaveTikz,\TetraedreTikz,\CercleTrigo,\AffPoint,\AffVecteur,\TrouveEqCartPlan,\TrouveEqParamDroite,\TrouveEqCartDroite,\TrouveNorme,\TrouveDistancePtPlan,\EquationReduite,\CalculsRegLin,\PointsRegLin,\NuagePointsTikz,\PointMoyenTikz,\BoiteMoustaches,\BoiteMoustachesAxe,\Histogramme,\CalcBinomP,\CalcBinomC,\BinomP,\BinomC,\CalcPoissP,\CalcPoissC,\PoissonP,\PoissonC,\CalcGeomP,\CalcGeomC,\GeomP,\GeomC,\CalcHypergeomP,\CalcHypergeomP,\HypergeomP,\HypergeomC,\CalcNormC,\NormaleC,\CalcExpoC,\ExpoC,\ArbreProbasTikz,\LoiNormaleGraphe,\LoiExpoGraphe,\NbAlea,\VarNbAlea,\TirageAleatoireEntiers,\Arrangement,\Combinaison,\ConversionDecBin,\ConversionBinHex,\ConversionVersDec,\ConversionBaseDix,\ConversionDepuisBaseDix,\PresentationPGCD,\EquationDiophantienne,\ConversionFraction,\SimplificationRacine,\EcritureEnsemble,\EcritureTrinome,\MesurePrincipale,\LigneTrigo,\SudoMaths,\FonctionRepartTikz,\IntervalleFF,\IntervalleFO,\IntervalleOF,\IntervalleOO,\RepereOij,\RepereOuv,\RepereOijk,\ReperePlan,\RepereEspace,\jfalg,\jfexp,\LoiNormale,\LoiBinomiale,\LoiPoisson,\LoiExpo,\LoiUnif,\Courbe,\Suite,\CoordPtPl,\CoordPtEsp,\CoordVecPl,\CoordVecEsp,\MatDeux,\Vecteur,\Esper,\Varianc,\EcType,\dx,\Integrale,\Modulo,\Arrondi,\CodePythonLstFichier,\CodePythonLstFichierAlt,\colorlet,\PtsDiscontinuite + morekeywords={\ResolutionApprochee,\SolutionTVI,\CalculTermeRecurrence,\ToileRecurrence,\SolutionSeuil,\IntegraleApprochee,\GrilleTikz,\AxesTikz,\AxexTikz,\AxeyTikz,\FenetreTikz,\FenetreSimpleTikz,\DeclareFonctionTikz,\CourbeTikz,\OrigineTikz,\SplineTikz,\TangenteTikz,\MiniSchemaSignes,\MiniSchemaSignesTkzTab,\IntegraleApprocheeTikz,\CartoucheCapytale,\PaveTikz,\TetraedreTikz,\CercleTrigo,\AffPoint,\AffVecteur,\TrouveEqCartPlan,\TrouveEqParamDroite,\TrouveEqCartDroite,\TrouveNorme,\TrouveDistancePtPlan,\EquationReduite,\CalculsRegLin,\PointsRegLin,\NuagePointsTikz,\PointMoyenTikz,\BoiteMoustaches,\BoiteMoustachesAxe,\Histogramme,\CalcBinomP,\CalcBinomC,\BinomP,\BinomC,\CalcPoissP,\CalcPoissC,\PoissonP,\PoissonC,\CalcGeomP,\CalcGeomC,\GeomP,\GeomC,\CalcHypergeomP,\CalcHypergeomP,\HypergeomP,\HypergeomC,\CalcNormC,\NormaleC,\CalcExpoC,\ExpoC,\ArbreProbasTikz,\LoiNormaleGraphe,\LoiExpoGraphe,\NbAlea,\VarNbAlea,\TirageAleatoireEntiers,\Arrangement,\Combinaison,\ConversionDecBin,\ConversionBinHex,\ConversionVersDec,\ConversionHexBin,\ConversionBaseDix,\ConversionDepuisBaseDix,\PresentationPGCD,\EquationDiophantienne,\ConversionFraction,\SimplificationRacine,\EcritureEnsemble,\EcritureTrinome,\MesurePrincipale,\LigneTrigo,\SudoMaths,\FonctionRepartTikz,\IntervalleFF,\IntervalleFO,\IntervalleOF,\IntervalleOO,\RepereOij,\RepereOuv,\RepereOijk,\ReperePlan,\RepereEspace,\jfalg,\jfexp,\LoiNormale,\LoiBinomiale,\LoiPoisson,\LoiExpo,\LoiUnif,\Courbe,\Suite,\CoordPtPl,\CoordPtEsp,\CoordVecPl,\CoordVecEsp,\MatDeux,\Vecteur,\Esper,\Varianc,\EcType,\dx,\Integrale,\Modulo,\Arrondi,\CodePythonLstFichier,\CodePythonLstFichierAlt,\colorlet,\PtsDiscontinuite,\ListeDiviseurs,\ArbreDiviseurs },% keywordstyle={\color{CouleurVertForet}},% classoffset=3,% alsoletter={-},% - morekeywords={minimum-decimal-digits,scale,nonamssymb,build,Precision,Intervalle,Variable,NomFct,NomSol,va,vb,Stretch,Balayage,Calculatrice,Majuscule,No,UNo,NomSuite,Simple,Exact,Conclusion,Sens,ResultatBrut,Methode,NbSubDiv,AffFormule,Expr,Signe,Variables,Affp,Affs,Epaisseur,Police,ElargirOx,ElargirOy,Labelx,Labely,AffLabel,PosLabelx,PosLabely,EchelleFleche,TypeFleche,PosGrad,HautGrad,AffGrad,AffOrigine,Annee,Trigo,Dfrac,Style,Coeffs,AffPoints,TaillePoints,xl,xr,Code,Racines,Largeur,Hauteur,Cadre,Fct,Nom,PosLabel,DecalLabel,TailleLabel,AffTermes,RemplirbOpacite,CouleurRemplissage,Lignes,Gobble,Alignement,Filigrane,BarreTitre,CouleurNombres,Centre,EspacementVertical,Label,Titre,Profondeur,Angle,Fuite,Sommets,Math,Aff,Plein,Cube,Alpha,Beta,Rayon,Marge,TailleValeurs,TailleAngles,CouleurFond,Decal,MoinsPi,AffAngles,AffTraits,AffValeurs,Equationcos,Equationsin,sin,cos,AffTraitsEq,CouleurSol,OptionCoeffs,SimplifCoeffs,Facteur,OptionCoeffs,Reel,Oppose,Rgras,SimplifCoeffs,VectDirecteur,NomCoeffa,NomCoeffb,NomCoeffr,NomCoeffrd,NomXmin,NomXmax,Ox,Oy,xg,yg,AffNom,Elevation,Moyenne,AffMoyenne,Pointilles,Valeurs,Elargir,Min,Max,DebutOx,FinOx,ListeCouleurs,ElargirX,ElargirY,LabelX,LabelY,GradX,GradY,AffEffectifs,PosEffectifs,Opacite,AffBornes,GrilleV,PoliceAxes,PoliceEffectifs,EpaisseurTraits,Unite,EspaceNiveau,EspaceFeuille,Type,PoliceProbas,InclineProbas,Fleche,StyleTrait,EpaisseurTrait,CouleurAire,CouleurCourbe,AfficheM,AfficheCadre,ValMin,ValMax,NbVal,Sep,Tri,Repetition,Notation,NotationAncien,Formule,AffBase,Details,BaseDep,Zeros,DecalH,DecalV,Noeud,Rect,CouleurRes,DecalRect,Rectangle,CouleurResultat,AfficheConclusion,AfficheDelimiteurs,Lettre,Inconnues,Entier,Cadres,PresPGCD,Mathpunct,Option,Alea,Anegatif,Crochets,Brut,Etapes,Epaisseurg,CouleurCase,CouleurTexte,NbSubCol,NbLig,NbCol,Legendes,PoliceLeg,ListeLegV,ListeLegH,DecalLegende,Couleur,Uno,Grille,ExtraGrilleY,PosLegende,Pointilles,Extremite,Frac,PremLigne,Type,Pos,Echelle},% + morekeywords={minimum-decimal-digits,scale,nonamssymb,build,Precision,Intervalle,Variable,NomFct,NomSol,va,vb,Stretch,Balayage,Calculatrice,Majuscule,No,UNo,NomSuite,Simple,Exact,Conclusion,Sens,ResultatBrut,Methode,NbSubDiv,AffFormule,Expr,Signe,Variables,Affp,Affs,Epaisseur,Police,ElargirOx,ElargirOy,Labelx,Labely,AffLabel,PosLabelx,PosLabely,EchelleFleche,TypeFleche,PosGrad,HautGrad,AffGrad,AffOrigine,Annee,Trigo,Dfrac,Style,Coeffs,AffPoints,TaillePoints,xl,xr,Code,Racines,Largeur,Hauteur,Cadre,Fct,Nom,PosLabel,DecalLabel,TailleLabel,AffTermes,RemplirbOpacite,CouleurRemplissage,Lignes,Gobble,Alignement,Filigrane,BarreTitre,CouleurNombres,Centre,EspacementVertical,Label,Titre,Profondeur,Angle,Fuite,Sommets,Math,Aff,Plein,Cube,Alpha,Beta,Rayon,Marge,TailleValeurs,TailleAngles,CouleurFond,Decal,MoinsPi,AffAngles,AffTraits,AffValeurs,Equationcos,Equationsin,sin,cos,AffTraitsEq,CouleurSol,OptionCoeffs,SimplifCoeffs,Facteur,OptionCoeffs,Reel,Oppose,Rgras,SimplifCoeffs,VectDirecteur,NomCoeffa,NomCoeffb,NomCoeffr,NomCoeffrd,NomXmin,NomXmax,Ox,Oy,xg,yg,AffNom,Elevation,Moyenne,AffMoyenne,Pointilles,Valeurs,Elargir,Min,Max,DebutOx,FinOx,ListeCouleurs,ElargirX,ElargirY,LabelX,LabelY,GradX,GradY,AffEffectifs,PosEffectifs,Opacite,AffBornes,GrilleV,PoliceAxes,PoliceEffectifs,EpaisseurTraits,Unite,EspaceNiveau,EspaceFeuille,Type,PoliceProbas,InclineProbas,Fleche,StyleTrait,EpaisseurTrait,CouleurAire,CouleurCourbe,AfficheM,AfficheCadre,ValMin,ValMax,NbVal,Sep,Tri,Repetition,Notation,NotationAncien,Formule,AffBase,Details,BaseDep,Zeros,DecalH,DecalV,Noeud,Rect,CouleurRes,DecalRect,Rectangle,CouleurResultat,AfficheConclusion,AfficheDelimiteurs,Lettre,Inconnues,Entier,Cadres,PresPGCD,Mathpunct,Option,Alea,Anegatif,Crochets,Brut,Etapes,Epaisseurg,CouleurCase,CouleurTexte,NbSubCol,NbLig,NbCol,Legendes,PoliceLeg,ListeLegV,ListeLegH,DecalLegende,Couleur,Uno,Grille,ExtraGrilleY,PosLegende,Pointilles,Extremite,Frac,PremLigne,Type,Pos,Echelle,AffNom,EspaceNiveau,CouleurDetails,Fleches,EspaceFeuille,Details},% keywordstyle={\color{orange!75!black}} } } @@ -854,6 +854,10 @@ Elles sont présentées de manière \textit{succincte}, mais elles sont présent \VarNbAlea{macro}{calcul} %liste d'entiers aléatoires \TirageAleatoireEntiers[options]{macro} +%liste des diviseurs +\ListeDiviseurs(*)[option]{nombre} +%arbre des diviseurs +\ArbreDiviseurs[options]{nombre} \end{PresCodeTexPL} \begin{PresCodeTexPL}{listing only} @@ -868,6 +872,7 @@ Elles sont présentées de manière \textit{succincte}, mais elles sont présent %conversions \ConversionDecBin(*)[clés]{nombre} \ConversionBinHex[clés]{nombre} +\ConversionHexBin[clés]{nombre} \ConversionVersDec[clés]{nombre} \ConversionBaseDix[clés]{nombre}{base de départ} \ConversionDepuisBaseDix[options]{nombre en base 10}{base d'arrivée} @@ -6738,6 +6743,7 @@ L'idée est de \textit{compléter} les possibilités offertes par le package \ct \begin{itemize} \item décimal en binaire avec blocs de 4 chiffres en sortie ; + \item hexadécimal en binaire avec blocs de 4 chiffres en sortie ; \item conversion binaire ou hexadécimal en décimal avec écriture polynomiale. \end{itemize} \vspace*{-\baselineskip}\leavevmode @@ -6875,6 +6881,51 @@ $\ConversionBinHex[AffBase=false,Details=false]{110011111}$ \pagebreak +\subsection{Conversion hexadécimal vers binaire}\label{convhexbin} + +\begin{noteblock} +\cmaj{2.7.8} L'idée est ici de présenter la conversion, grâce à la conversion \og directe \fg{} par blocs de 4 chiffres : + +\begin{itemize} + \item la macro découpe chaque caractère hexa en bloc de 4 chiffres binaires ; + \item elle affiche la conversion en binaire. +\end{itemize} +\vspace*{-\baselineskip}\leavevmode +\end{noteblock} + +\begin{PresCodeTexPL}{listing only} +\ConversionHexBin[clés]{nombre} +\end{PresCodeTexPL} + +\begin{cautionblock} +Quelques \Cle{clés} sont disponibles pour cette commande : + +\begin{itemize} + \item le booléen \Cle{AffBase} qui permet d'afficher ou non la base des nombres ; \hfill{}défaut \Cle{true} + \item le booléen \Cle{Details} qui permet d'afficher ou le détail par bloc de 4. \hfill{}défaut \Cle{true} + %\item la clé \Cle{trait} qui permet de modifier l'épaisseur du crochet. \hfill{}défaut \Cle{0.5pt} +\end{itemize} + +La commande est à insérer dans un environnement mathématique. +\end{cautionblock} + +\begin{PresCodeTexPL}{listing only} +%conversion avec détails et affichage de la base +$\ConversionHexBin{ACDC}$ +%conversion sans détails et affichage de la base +$\ConversionHexBin[Details=false]{ACDC}$ +%conversion sans détails et sans affichage de la base +$\ConversionHexBin[AffBase=false,Details=false]{ACDC}$ +\end{PresCodeTexPL} + +\begin{PresCodeSortiePL}{text only} +$\ConversionHexBin{ACDC}$ + +$\ConversionHexBin[Details=false]{ACDC}$ + +$\ConversionHexBin[AffBase=false,Details=false]{ACDC}$ +\end{PresCodeSortiePL} + \subsection{Conversion binaire ou hexadécimal en décimal} \begin{noteblock} @@ -7190,6 +7241,90 @@ L'argument obligatoire, et entre \ctex{\{...\}} est quant à lui l'équation, en \newpage +\section{Diviseurs}\label{listediv} + +\subsection{Idées} + +\begin{tipblock} +L'idée est de proposer des commandes pour travailler sur les diviseurs d'un entier : + +\begin{itemize} + \item afficher la liste des diviseurs sous forme d'un ensemble ordonné ; + \item créer un arbre pour retrouver les diviseurs par la décomposition en facteurs premiers. +\end{itemize} + +Le code se charge de déterminer les diviseurs et de mettre en forme l'arbre. +\end{tipblock} + +\begin{PresCodeTexPL}{listing only} +\ListeDiviseurs(*)[Clé]{nombre} +\end{PresCodeTexPL} + +\begin{PresCodeTexPL}{listing only} +\ArbreDiviseurs[Clés]{nombre} +\end{PresCodeTexPL} + +\subsection{Options et clés} + +\begin{cautionblock} +En ce qui concerne la commande pour la liste des diviseurs : + +\begin{itemize} + \item la version \textit{étoilée} permet d'afficher le nom de l'ensemble via \ctex{\textbackslash mathscr}, \ctex{\textbackslash mathcal} sinon; + \item le booléen \Cle{AffNom} permet d'afficher le nom de l'ensemble ; \hfill{}défaut \Cle{true} + \item l'argument obligatoire, et entre \ctex{\{...\}}, est quant lui le nombre, y compris en langage \ctex{xint}. +\end{itemize} + +À noter que la commande est incluse dans un bloc \ctex{\textbackslash ensuremath}, donc les \ctex{$...$} ne sont pas nécessaires. +\end{cautionblock} + +\begin{PresCodePL}{} +%sortie par défaut +\ListeDiviseurs{150} + +%sortie avec \mathscr (si chargé) +\ListeDiviseurs*{300} + +%sortie sans libellé +\ListeDiviseurs[AffNom=false]{60} +\end{PresCodePL} + +\begin{cautionblock} +En ce qui concerne la commande pour l'arbre (créé en \TikZ) permettant d'obtenir la liste des diviseurs (je remercie Christophe Poulain pour un \textit{bout de code} que j'ai adapté et pour son aide précieuse) : + +\begin{itemize} + \item les clés disponible sont : + \begin{itemize} + \item la clé \Cle{EspaceNiveau} qui est l'espace horizontal (en cm) entre les étages ; \hfill{}défaut \Cle{2.25} + \item la clé \Cle{EspaceFeuille} qui est l'espace vertical entre les feuilles ; \hfill{}défaut \Cle{0.66} + \item le booléen \Cle{Details} pour afficher les calculs des diviseurs ; \hfill{}défaut \Cle{true} + \item la clé \Cle{CouleurDetails} pour la couleur des détails ; \hfill{}défaut \Cle{red} + \item la clé \Cle{Echelle} pour spécifier une échelle globale (y compris le texte) de la figure ; + + \hfill{}défaut \Cle{1} + \item le booléen \Cle{Fleches} pour afficher une flèche sur les branches.\hfill{}défaut \Cle{true} + \end{itemize} + \item l'argument obligatoire, et entre \ctex{\{...\}}, est quant lui le nombre, y compris en langage \ctex{xint}. +\end{itemize} +\vspace*{-\baselineskip}\leavevmode +\end{cautionblock} + +\begin{PresCodePL}{} +%sortie par défaut +\ArbreDiviseurs{60} +\end{PresCodePL} + +\begin{PresCodePL}{} +%sortie personnalisée +\ArbreDiviseurs[EspaceNiveau=4,EspaceFeuille=1,Details=false]{60} +\end{PresCodePL} + +\begin{PresCodePL}{} +\ArbreDiviseurs[EspaceNiveau=2,Echelle=0.75,CouleurDetails=teal,Fleches=false]{2^2*3*5*7*11} +\end{PresCodePL} + +\newpage + \phantom{t}\par\vfill\par \begin{PART} \begin{center} @@ -7803,6 +7938,8 @@ La grille, créée en \TikZ, est portée par le rectangle de \og coins \fg{} $(0 \part{Historique} +{\small \bverb|v 2.7.8|~:~~~~Conversion présentée hexa/bin (page \pageref{convhexbin})} + Liste et arbres de diviseurs (page \pageref{listediv}) + {\small \bverb|v 2.7.7|~:~~~~Points de discontinuité pour des splines (page \pageref{discont})} {\small \bverb|v 2.7.6|~:~~~~Amélioration dans la console d'exécution avec \textsf{piton}} diff --git a/macros/latex/contrib/proflycee/tex/ProfLycee.sty b/macros/latex/contrib/proflycee/tex/ProfLycee.sty index 2726c7fa85..8c89863d8c 100644 --- a/macros/latex/contrib/proflycee/tex/ProfLycee.sty +++ b/macros/latex/contrib/proflycee/tex/ProfLycee.sty @@ -3,7 +3,8 @@ % or later, see http://www.latex-project.org/lppl.txtf \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{ProfLycee}[2023/09/29 2.7.7 Aide pour l'utilisation de LaTeX en lycee] +\ProvidesPackage{ProfLycee}[2023/10/06 2.7.8 Aide pour l'utilisation de LaTeX en lycee] +% 2.7.8 Conversion hexa->bin présentée % 2.7.7 Ajout d'une commande pour matérialiser des points de discontinuité % 2.7.6 Amélioration de la gestion de la console piton % 2.7.5 Ajout d'options pour les environnements de code (piton + listings) diff --git a/macros/latex/contrib/proflycee/tex/proflycee-tools-arithm.tex b/macros/latex/contrib/proflycee/tex/proflycee-tools-arithm.tex index 5980ef9000..0085e0ee98 100644 --- a/macros/latex/contrib/proflycee/tex/proflycee-tools-arithm.tex +++ b/macros/latex/contrib/proflycee/tex/proflycee-tools-arithm.tex @@ -8,6 +8,9 @@ % and version 1.3 or later is part of all distributions of LaTeX % version 2005/12/01 or later. +\RequirePackage{ifthen} +\RequirePackage{modulus} + %%------ConversionsBases %dec->bin avec blocs de 4 chiffres \setKVdefault[CONVDECBIN]{% @@ -25,7 +28,7 @@ } \setKVdefault[CONVBINHEX]{% - %trait=0.5pt,% + %Epaisseur=0.75pt,% AffBase=true,% Details=true } @@ -46,7 +49,7 @@ \useKVdefault[CONVBINHEX]% \setKV[CONVBINHEX]{#1}% on paramètres les nouvelles clés et on les simplifie \def\chbrut{#2}% - \StrLen{\chbrut}[\nbchiffres] %nb de chiffres du binaire + \StrLen{\chbrut}[\nbchiffres]%nb de chiffres du binaire \xdef\nbgrp{\fpeval{4*ceil(\nbchiffres/4,0)}} %nb de chiffres avec blocs de 4 \xdef\nbblocs{\fpeval{\nbgrp/4}} %nb de blocs %on rajoute des zeros si besoin := OK @@ -74,6 +77,43 @@ \xintBinToHex{\chbrut}\ifboolKV[CONVBINHEX]{AffBase}{_{16}}{}% } +%hexa-bin par bloc de 4 +\setKVdefault[CONVHEXBIN]{% + %Epaisseur=0.75pt, + AffBase=true,% + Details=true +} + +\newcommand\ConvHexBinBloc[1]{% + \def\binbrut{\xintHexToBin{#1}}% + \StrLen{\binbrut}[\nbchiffresbinbrut]%nb + \PLstrzeros{\xinteval{4-\nbchiffresbinbrut}}{\binbrut}% +} + +\newcommand\ConversionHexBin[2][]{% + \useKVdefault[CONVHEXBIN]% + \setKV[CONVHEXBIN]{#1}% on paramètres les nouvelles clés et on les simplifie + %\def\thicktraitshexbin{\useKV[CONVHEXBIN]{Epaisseur}}% + \ifboolKV[CONVHEXBIN]{AffBase}{#2_{16}=}{#2=}% + \StrLen{#2}[\nbchiffreshex]%nb + \ifboolKV[CONVHEXBIN]{Details}% + {% + \foreach \i in {1,...,\nbchiffreshex}{% + \StrChar{#2}{\i}[\tmpcharhex]% + {\underbracket{\ConvHexBinBloc{\tmpcharhex}}_{\tmpcharhex}\,} + }% + \ifboolKV[CONVHEXBIN]{AffBase}{{}_{2}}{}% + }% + {% + \foreach \i in {1,...,\nbchiffreshex}{% + \StrChar{#2}{\i}[\tmpcharhex]% + \ConvHexBinBloc{\tmpcharhex}\,% + }% + \!\ifboolKV[CONVHEXBIN]{AffBase}{{}_{2}}{}% + }% +} + + %hexa/bin->dec avec écriture polynomiale \defKV[CONVTODEC]{% BaseDep=\def\basedepart{#1} @@ -456,4 +496,180 @@ }% } +%liste diviseurs +\setKVdefault[listdiv]{% + AffNom=true +} +\NewDocumentCommand\ListeDiviseurs{ s O{} m }{% + \useKVdefault[listdiv]% + \setKV[listdiv]{#2}% + \xdef\tmplistdiv{1}% + \xdef\argcal{\xinteval{#3}}% + \xintFor* ##1 in {\xintSeq{2}{\argcal}}\do{% + \xintifboolexpr{ \xintiiRem{\argcal}{##1} == 0 }% + {% + \xdef\tmplistdiv{\tmplistdiv /\num{##1}} + }% + {}% + }% + \ensuremath{\ifboolKV[listdiv]{AffNom}{\IfBooleanTF{#1}{\mathscr{D}}{\mathcal{D}}_{\num{\argcal}}=}{}\EcritureEnsemble[\strut]{\tmplistdiv}} +} + +%arbre diviseurs +\defKV[arbrediviseurs]{% + EspaceNiveau=\def\TmpEspNiv{#1},% + EspaceFeuille=\def\TMpEspFeuille{#1},% + CouleurDetails=\def\TmpCoulDetails{#1},% + Echelle=\def\TmpEchelle{#1} +} + +\setKVdefault[arbrediviseurs]{% + EspaceNiveau=2.25,% + EspaceFeuille=0.66,% + Details=true,% + CouleurDetails=red,% + Echelle=1,% + Fleches=true +} + +\NewDocumentCommand\ArbreDiviseurs{ O{} m }{% + \useKVdefault[arbrediviseurs]% + \setKV[arbrediviseurs]{#1}% + % test avec CPoulain ^^ + \xdef\tmpcalc{\xinteval{#2}}% + \xdef\tmparg{}% + \newcount\anp\newcount\bnp\newcount\cnp% + \newcount\pileb\newcount\exposant% + \exposant=0\relax% + \anp=\tmpcalc\relax% + \bnp=2\relax% + \pileb=2\relax% + \whiledo{\the\anp > 1}{% + \modulo{\the\anp}{\the\bnp}% + \ifnum\remainder=0\relax% + \cnp=\numexpr\anp/\bnp\relax% + \exposant=\numexpr\exposant+1\relax% + \anp=\cnp\relax% + \else% + \ifnum\exposant>0\relax% + \xdef\tmparg{\tmparg\the\pileb,\the\exposant*}% + %\expandafter\UpdatetoksCPier\Foo\nil% + \fi% + \bnp=\numexpr\bnp+1\relax% + \pileb=\bnp\relax% + \exposant=0\relax% + \fi% + }% + \xdef\tmparg{\tmparg\the\bnp,{\the\exposant}}% + %\expandafter\UpdatetoksCPier\the\bnp,{\the\exposant}\nil% + % \xdef\argnum{\xinteval{#2}}% + % \def\decompotmp{\DecompoPremierExposant{#2}}% + \setsepchar{*/,}% + \xdef\Foo{\tmparg}% + \readlist*\readcaractdiv{\Foo}% + % fin test CPoulain ^^ + \xdef\arbredivnbdivprem{\readcaractdivlen}%nombre diviseurs permiers + \xdef\arbredivnbdiv{1}% + \xintFor* ##1 in {\xintSeq{1}{\arbredivnbdivprem}}\do{\xdef\arbredivnbdiv{\xinteval{\arbredivnbdiv*(\readcaractdiv[##1,2]+1)}}}%nombre diviseurs + \def\HauteurTotale{\xinteval{\arbredivnbdiv-1}}% + \ifboolKV[arbrediviseurs]{Fleches}% + {\tikzstyle{flechearbrediv} = [line width=\fpeval{\TmpEchelle*0.6}pt,->,>=latex]}% + {\tikzstyle{flechearbrediv} = [line width=\fpeval{\TmpEchelle*0.6}pt]}% + \begin{tikzpicture}[scale=\TmpEchelle,every node/.style={scale=\TmpEchelle}] + % grille d'aide + % \draw[xstep=\TmpEspNiv,ystep=\TMpEspFeuille,thin,lightgray] (0,{(-\arbredivnbdiv+1)*\TMpEspFeuille}) grid ({\arbredivnbdivprem*\TmpEspNiv},0) ; + % dernier niveau OK + \xdef\nbsommets{\arbredivnbdiv}% + \xintFor* ##1 in {\xintSeq{1}{\nbsommets}}\do% + {% + \itemtomacro\readcaractdiv[\arbredivnbdivprem,2]\tmppuiss% + \xdef\tmpdiv{\xinteval{\tmppuiss+1}}% + \node[outer sep=0pt] (N-\arbredivnbdivprem-##1) at ({\arbredivnbdivprem*\TmpEspNiv},{-(##1-1)*\TMpEspFeuille}) {$\num{\readcaractdiv[\arbredivnbdivprem,1]}^{\xinteval{\xintiiRem{\xinteval{##1-1}}{\tmpdiv}}}$} ;% + } + % niveaux suivants, en descendant + \xintFor* ##2 in {\xintSeq{\arbredivnbdivprem-1}{1}}\do% + {% + \xdef\nbsommets{\xintieval{\nbsommets/(\readcaractdiv[##2+1,2]+1)}}% + \xdef\espacementsommets{\xinteval{\arbredivnbdiv/(\nbsommets)}}% + \xdef\OffsetNiveau{\xintieval{(\HauteurTotale-(\nbsommets-1)*\espacementsommets)}}% + \xintFor* ##3 in {\xintSeq{1}{\nbsommets}}\do% + {% + \itemtomacro\readcaractdiv[##2,2]\tmppuiss% + \xdef\tmpdiv{\xinteval{\tmppuiss+1}}% + \node[outer sep=0pt] (N-##2-##3) at ({##2*\TmpEspNiv},{(-(##3-1)*\espacementsommets-0.5*\OffsetNiveau)*\TMpEspFeuille}) {$\num{\readcaractdiv[##2,1]}^{\xinteval{\xintiiRem{\xinteval{##3-1}}{\tmpdiv}}}$} ; + }% + }% + % racine + \coordinate (Racine) at ({0},{-0.5*(\arbredivnbdiv-1)*(\TMpEspFeuille)}) ; + % \draw (Racine) node {$\Omega$} ; + % les flèches, qui partent de la racine + \xintFor* ##4 in {\xintSeq{1}{\xinteval{\readcaractdiv[1,2]+1}}}\do% + {% + \draw[flechearbrediv] (Racine) -- (N-1-##4) ; + }% + % les flèches successives + \foreach \nivdep in {1,...,\xinteval{\arbredivnbdivprem-1}}% + {% + \xdef\nbsommetsniv{1}% + \foreach \i in {1,...,\nivdep}{\xdef\nbsommetsniv{\xinteval{\nbsommetsniv*(\readcaractdiv[\i,2]+1)}}}%calcul du nombre de sommets de départ + % boucle sur sommets de départ + \foreach \numsom in {1,...,\nbsommetsniv}% + {% + \xdef\nivplusun{\xinteval{\nivdep+1}}% + \foreach \nbsousbranches in {1,...,\xinteval{\readcaractdiv[\nivplusun,2]+1}}% + {% + \xdef\sumsomarriv{\xinteval{ (\readcaractdiv[\nivplusun,2]+1)*(\numsom-1) + \nbsousbranches }}% + \draw[flechearbrediv] (N-\nivdep-\numsom) -- (N-\nivplusun-\sumsomarriv) ; + } + }% + }% + \ifboolKV[arbrediviseurs]{Details}% + {% + % essai de génération des calculs := ouaiissssss + \foreach \i in {1,...,\arbredivnbdiv}{% + \xdef\resdiv{1}% + % on extrait la premiere puissance := on obtient la répartition ? + \itemtomacro\readcaractdiv[-1,2]\tmppuiss\xdef\tmpdiv{\xinteval{(\tmppuiss+1)}}% + % création de la liste des puissances !! + \xdef\calculdiviseur{\num{\readcaractdiv[-1,1]}^{\xinteval{\xintiiRem{\xinteval{\i-1}}{\tmpdiv}}}}% + \xdef\resdiv{\xinteval{\resdiv*(\readcaractdiv[-1,1])^(\xinteval{\xintiiRem{\xinteval{\i-1}}{\tmpdiv}})}}% + % on complète avec les autres parties ?? + \foreach \nbprem in {2,...,\arbredivnbdivprem}{% + % il reste à stocker les produits des puissances, en descendant... erf..... + \xdef\tmppuisscumul{1}% + \foreach \k in {1,...,\xinteval{\nbprem-1}}{% + \itemtomacro\readcaractdiv[-\k,2]\tmppuissrepet% + \xdef\tmppuisscumul{\xinteval{\tmppuisscumul*(\tmppuissrepet+1)}}% + }% + \itemtomacro\readcaractdiv[-\nbprem,2]\tmppuiss% + \xdef\tmpdivniv{\xinteval{(\tmppuiss+1)}}% + % \xdef\tmpdiv{\xinteval{(\tmppuissrepet+1)}}% + \xdef\calculdiviseur{\num{\readcaractdiv[-\nbprem,1]}^{\xinteval{\xintiiRem{\xintieval{trunc((\i-1)/(\tmppuisscumul),0)}}{\tmpdivniv}}}\times\calculdiviseur}% + \xdef\resdiv{\xinteval{\resdiv*(\readcaractdiv[-\nbprem,1])^(\xinteval{\xintiiRem{\xintieval{trunc((\i-1)/(\tmppuisscumul),0)}}{\tmpdivniv}})}}% + }% + \draw ([xshift=1cm]N-\arbredivnbdivprem-\i) node[right,\TmpCoulDetails] {$\calculdiviseur=\num{\resdiv}$} ; + }% + }{}% + \end{tikzpicture}% +} + +%somme des chiffres +\ifthenelse{\isundefined{\SommeChiffres}}% + {% + \NewDocumentCommand\SommeChiffres{ m }{% + \StrLen{#1}[\nbchiffres]% + \xdef\tmpres{0}% + \foreach \i in {1,...,\nbchiffres}{\StrChar{#1}{\i}[\tmpchf]\xdef\tmpres{\xinteval{\tmpres+\tmpchf}}}% + \ensuremath{\num{\tmpres}}% + } + }% + {% + \RenewDocumentCommand\SommeChiffres{ m }{% + \StrLen{#1}[\nbchiffres]% + \xdef\tmpres{0}% + \foreach \i in {1,...,\nbchiffres}{\StrChar{#1}{\i}[\tmpchf]\xdef\tmpres{\xinteval{\tmpres+\tmpchf}}}% + \ensuremath{\num{\tmpres}}% + } + }% + \endinput
\ No newline at end of file diff --git a/macros/latex/contrib/proflycee/tex/proflycee-tools-listings.tex b/macros/latex/contrib/proflycee/tex/proflycee-tools-listings.tex index 40dfdae779..5f094083fa 100644 --- a/macros/latex/contrib/proflycee/tex/proflycee-tools-listings.tex +++ b/macros/latex/contrib/proflycee/tex/proflycee-tools-listings.tex @@ -328,7 +328,7 @@ columns=fullflexible,firstnumber=\CodePseudoCodeLstFirstLine,% stringstyle=\color{MotsClesPseudoCodeChaine}, classoffset=0,% - keywords={Pour,Fonction,Début,allant,Fin,Si,alors,Sinon,SinonSi,FinSi,FinPour,FinTantQue,TantQue},% + keywords={Pour,Fonction,Début,Debut,allant,Fin,Si,alors,Sinon,SinonSi,FinSi,FinPour,FinTantQue,TantQue,Variable,Variables},% keywordstyle=\color{MotsClesPseudoCodeA},% classoffset=1,% morekeywords={Afficher,Retourner,Saisir},% @@ -473,7 +473,7 @@ columns=fullflexible,firstnumber=\CodePseudoCodeLstFirstLine, stringstyle=\color{MotsClesPseudoCodeChaine}, classoffset=0,% - keywords={Pour,Fonction,Début,allant,Fin,Si,alors,Sinon,SinonSi,FinSi,FinPour,FinTantQue,TantQue},% + keywords={Pour,Fonction,Debut,Début,allant,Fin,Si,alors,Sinon,SinonSi,FinSi,FinPour,FinTantQue,TantQue,Variable,Variables},% keywordstyle=\color{MotsClesPseudoCodeA},% classoffset=1,% morekeywords={Afficher,Retourner,Saisir},% diff --git a/macros/latex/contrib/proflycee/tex/proflycee-tools-piton.tex b/macros/latex/contrib/proflycee/tex/proflycee-tools-piton.tex index 53505ead0e..5c48f5e69a 100644 --- a/macros/latex/contrib/proflycee/tex/proflycee-tools-piton.tex +++ b/macros/latex/contrib/proflycee/tex/proflycee-tools-piton.tex @@ -137,7 +137,7 @@ } {}% %on crée la boîte - \tcolorbox[stylebase,filigrane,cadre,titre] + \tcolorbox[stylebase,filigrane,cadre,titre,#2] }% {% \endtcolorbox% diff --git a/macros/latex/contrib/schule/README b/macros/latex/contrib/schule/README index 7aa5b47b5e..55cf949be6 100644 --- a/macros/latex/contrib/schule/README +++ b/macros/latex/contrib/schule/README @@ -12,8 +12,8 @@ sequence diagrams, object diagrams and class diagrams) as well as into classes for written exams (tests, quizzes, teaching observations, information sheets, worksheets, and answer keys). ------------------------------------------------------------------------ -Version: 0.8.4 -Last change: 2023/03/19 +Version: 0.9.0 +Last change: 2023/10/07 The package is still a work in progress. Open development steps are shown in the documentation. diff --git a/macros/latex/contrib/schule/doc/Beispiele/bsp_aufgabe1/bsp_aufgabe_01.pdf b/macros/latex/contrib/schule/doc/Beispiele/bsp_aufgabe1/bsp_aufgabe_01.pdf Binary files differindex 5185edb7aa..564095dce7 100644 --- a/macros/latex/contrib/schule/doc/Beispiele/bsp_aufgabe1/bsp_aufgabe_01.pdf +++ b/macros/latex/contrib/schule/doc/Beispiele/bsp_aufgabe1/bsp_aufgabe_01.pdf diff --git a/macros/latex/contrib/schule/doc/Beispiele/bsp_aufgabe1/bsp_aufgabe_01.tex b/macros/latex/contrib/schule/doc/Beispiele/bsp_aufgabe1/bsp_aufgabe_01.tex index 872746a48e..994f41a4b8 100644 --- a/macros/latex/contrib/schule/doc/Beispiele/bsp_aufgabe1/bsp_aufgabe_01.tex +++ b/macros/latex/contrib/schule/doc/Beispiele/bsp_aufgabe1/bsp_aufgabe_01.tex @@ -13,6 +13,10 @@ \title{Beispielaufgabe 1} \begin{document} + \begin{aufgabenpoolHinweis} + Dieses ist nur eine Beispielaufgabe, die ohne weitere Optionen auskommt. + \end{aufgabenpoolHinweis} + \begin{aufgabe}[subtitle=Erste Beispielaufgabe] Blah blah blub. @@ -20,7 +24,6 @@ \teilaufgabe[2] Male ein X. \teilaufgabe[3] Schreibe einen Satz. - \end{teilaufgaben} \begin{erwartungen} \erwartung{malt ein X}{2} @@ -37,8 +40,7 @@ \caption{Ein x} \label{fig:x} \end{figure} - \teilaufgabe Eine möglicher Satz. \end{teilaufgaben} \end{loesung} -\end{document}
\ No newline at end of file +\end{document} diff --git a/macros/latex/contrib/schule/doc/Beispiele/bsp_aufgabe2/bsp_aufgabe.pdf b/macros/latex/contrib/schule/doc/Beispiele/bsp_aufgabe2/bsp_aufgabe.pdf Binary files differindex c5eb581df8..cfa4297177 100644 --- a/macros/latex/contrib/schule/doc/Beispiele/bsp_aufgabe2/bsp_aufgabe.pdf +++ b/macros/latex/contrib/schule/doc/Beispiele/bsp_aufgabe2/bsp_aufgabe.pdf diff --git a/macros/latex/contrib/schule/doc/Beispiele/bsp_aufgabe2/bsp_aufgabe.tex b/macros/latex/contrib/schule/doc/Beispiele/bsp_aufgabe2/bsp_aufgabe.tex index 653c53fde4..6949983ad7 100644 --- a/macros/latex/contrib/schule/doc/Beispiele/bsp_aufgabe2/bsp_aufgabe.tex +++ b/macros/latex/contrib/schule/doc/Beispiele/bsp_aufgabe2/bsp_aufgabe.tex @@ -12,7 +12,11 @@ \date{xx.xx.xxxx} \title{Beispielaufgabe} +\setAufgabenpoolOptionen{optionA,optionB} + \begin{document} + \inputOnce{bsp_text} + \begin{aufgabe}[subtitle=Beispielaufgabe, points=6] Ein wirklich anderer Text für eine Aufgabe. Dazu gibt es auch die \autoref{fig:objektdiagramm} @@ -23,7 +27,15 @@ \label{fig:objektdiagramm} \end{figure} - Mache etwas damit. + \ifAufgabenpoolOptionTF{optionA}{ + Mache etwas damit. + }{ + Dieses ist total egal. + }% + Sei glücklich.% + \ifAufgabenpoolOptionT{optionB}{ + Aber mache etwas wirklich gutes. + } \begin{erwartungen} \erwartung{macht etwas damit}{5} @@ -33,4 +45,4 @@ \begin{loesung} Eigentlich ist es ganz egal. \end{loesung} -\end{document}
\ No newline at end of file +\end{document} diff --git a/macros/latex/contrib/schule/doc/Beispiele/bsp_aufgabe2/bsp_text.pdf b/macros/latex/contrib/schule/doc/Beispiele/bsp_aufgabe2/bsp_text.pdf Binary files differnew file mode 100644 index 0000000000..476f386745 --- /dev/null +++ b/macros/latex/contrib/schule/doc/Beispiele/bsp_aufgabe2/bsp_text.pdf diff --git a/macros/latex/contrib/schule/doc/Beispiele/bsp_aufgabe2/bsp_text.tex b/macros/latex/contrib/schule/doc/Beispiele/bsp_aufgabe2/bsp_text.tex new file mode 100644 index 0000000000..b4d4ed94bc --- /dev/null +++ b/macros/latex/contrib/schule/doc/Beispiele/bsp_aufgabe2/bsp_text.tex @@ -0,0 +1,5 @@ +\documentclass[a4paper]{scrartcl} + +\begin{document} + Dieses ist ein einfacher Beispieltext. Er steht vor einer Aufgabe und erklärt etwas allgemeines. +\end{document} diff --git a/macros/latex/contrib/schule/doc/Beispiele/minimal-kl-aufgabenpool.pdf b/macros/latex/contrib/schule/doc/Beispiele/minimal-kl-aufgabenpool.pdf Binary files differindex 09e1116c33..6be283a536 100644 --- a/macros/latex/contrib/schule/doc/Beispiele/minimal-kl-aufgabenpool.pdf +++ b/macros/latex/contrib/schule/doc/Beispiele/minimal-kl-aufgabenpool.pdf diff --git a/macros/latex/contrib/schule/doc/Beispiele/minimal-kl-aufgabenpool.tex b/macros/latex/contrib/schule/doc/Beispiele/minimal-kl-aufgabenpool.tex index 7226e7bed3..a5952eb424 100644 --- a/macros/latex/contrib/schule/doc/Beispiele/minimal-kl-aufgabenpool.tex +++ b/macros/latex/contrib/schule/doc/Beispiele/minimal-kl-aufgabenpool.tex @@ -15,7 +15,9 @@ \title{Beispiel für Aufgabenpool} \begin{document} + \aufgabeninput[optionA]{bsp_aufgabe2}{bsp_aufgabe} + \aufgabeninput{bsp_aufgabe1}{bsp_aufgabe_01} - \aufgabeninput{bsp_aufgabe2}{bsp_aufgabe} -\end{document}
\ No newline at end of file + \aufgabeninput[optionB]{bsp_aufgabe2}{bsp_aufgabe} +\end{document} diff --git a/macros/latex/contrib/schule/doc/changelog.tex b/macros/latex/contrib/schule/doc/changelog.tex index aa61bf67b6..149be23c76 100644 --- a/macros/latex/contrib/schule/doc/changelog.tex +++ b/macros/latex/contrib/schule/doc/changelog.tex @@ -2,6 +2,12 @@ Im Laufe der Jahre wurde das Paket immer wieder erweitert. Nicht nur die Anpassung an veränderte Anforderungen, etwa bei den Unterrichtsbesuchen, sondern auch neue Funktionalitäten fließen in das Paket ein. Die folgende Liste bietet eine Übersicht über die letzten Änderungen. \begin{itemize} + \item \textbf{0.9.0} -- 2023-10-07 + \begin{itemize} + \item Modul Aufgabenpool ausgebaut, damit es variable einsetzbar ist + \item Aufgabentemplate auch für Lösungen setzbar gemacht + \item Reihenfolge beim Laden von Lizenzen geändert um Problemen mit hyperxmp besser aus dem Weg zu gehen + \end{itemize} \item \textbf{0.8.4} -- 2023-03-19 \begin{itemize} \item Modul Aufgabenpool hinzugefügt diff --git a/macros/latex/contrib/schule/doc/modulAufgaben.tex b/macros/latex/contrib/schule/doc/modulAufgaben.tex index a9710b49e7..904f48336c 100644 --- a/macros/latex/contrib/schule/doc/modulAufgaben.tex +++ b/macros/latex/contrib/schule/doc/modulAufgaben.tex @@ -52,6 +52,7 @@ Die vom Schulepaket gemachten Ergänzungen sind voll kompatibel zu \pkg{xsim}, s \begin{commands} \command{setzeAufgabentemplate}[\marg{Templatename}] setzt das Template mit dem die folgenden Aufgaben dargestellt werden. + \command{setzeLoesungentemplate}[\marg{Templatename}] setzt das Template mit dem die folgenden Lösungen dargestellt werden. Diese sind identisch mit denen der Aufgaben. \end{commands} \subsection{Teilaufgaben} diff --git a/macros/latex/contrib/schule/doc/modulAufgabenpool.tex b/macros/latex/contrib/schule/doc/modulAufgabenpool.tex index f4c6d49888..9b736eb0f6 100644 --- a/macros/latex/contrib/schule/doc/modulAufgabenpool.tex +++ b/macros/latex/contrib/schule/doc/modulAufgabenpool.tex @@ -2,10 +2,12 @@ \label{modul:aufgabenpool} Die Idee für das Modul \module{Aufgabenpool} bestand darin, dass Aufgaben einfach bei verschiedenen Klassenarbeiten oder Klausuren wieder genutzt werden können. Diese Aufgaben dürfen auch in verschiedenen Verzeichnissen liegen und sich einzeln setzen lassen. Besondere Berücksichtigung benötigen dabei eingebundene Dateien, wie z.\,B. Bilder oder Programmdateien, die relativ zur Aufgabendatei, an einem anderen Ort liegen als die Quelldatei für die Klausur. Für diesen Fall wird auf ein \textit{basedir} gesetzt, dass für jede eingebundene Aufgabe entsprechend gesetzt wird. Mit der Nutzung über \cs{getBasedir} lässt sich jede Datei relativ zur Aufgabendatei einbinden. Dieses gilt auch innerhalb der \env{loesung}-Umgebung. +Zur Verwendung einer Aufgabe aus dem Aufgabenpool lassen sich auch Hinweise in der Aufgabe ablegen. Diese werden dann nicht mit ausgegeben, wenn die Aufgabe in einer Klassenarbeit bzw. Klausur mit eingebunden wird. + \subsection{Befehle} \begin{commands} - \command{aufgabeninput}[\marg{Verzeichnis}\marg{Datei}] - Bindet die Datei mit der Aufgabe ein, die im angegebenen Verzeichnis steht. Die Angabe des Verzeichnis wird als Grundlage für das \textit{basedir} für diese Aufgabe genutzt. + \command{aufgabeninput}[\oarg{optionen}\marg{Verzeichnis}\marg{Datei}] + Bindet die Datei mit der Aufgabe ein, die im angegebenen Verzeichnis steht. Die Angabe des Verzeichnis wird als Grundlage für das \textit{basedir} für diese Aufgabe genutzt. Als optionalen Parameter lassen sich durch Komma getrennte Optionen angeben. Dadurch lässt sich in der eigentlichen Aufgabe steuern, ob bestimmte Elemente gesetzt werden sollen oder nicht. Näheres unter \ref{sec:optionen_aufgabenpool}. \command{getBasedir} Liefert das aktuelle \textit{basedir} zurück, um es in einer Aufgabe als Pfadergänzung bei der Einbindung von Dateien zu nutzen. \command{setBasedir} @@ -15,4 +17,27 @@ Die Idee für das Modul \module{Aufgabenpool} bestand darin, dass Aufgaben einfa aufgabe/begin-hook = \setBasedir, } \end{sourcecode} + \command{inputOnce}[\marg{Datei}]\sinceversion{0.9.0} + Die angegebene Datei wird eingebunden. Dieses geschieht innerhalb eines Dokumentes aber genau einmal, auch wenn dieser Aufruf in mehreren Aufgaben angegeben ist. So kann z.\,B. auf einen gemeinsamen Text zurückgegriffen werden. Das Basedir wird im Pfad zur Datei mit berücksichtigt, so dass \cs*{getBasedir} nicht in der Pfadangabe mit genutzt werden darf. +\end{commands} + +\subsection{Umgebungen} +\begin{environments} + \environment{aufgabenpoolHinweis}\sinceversion{0.9.0} + Innerhalb dieser Umgebung können Hinweise zur Aufgabe gemacht werden, die an den Steller der Arbeit bzw. Klausur gerichtet sind. Diese werden dann in der einzelnd stehenden Aufgabe auch angezeigt. Wird die Aufgabe in einer Klassenarbeit bzw. Klausur eingebunden, werden diese Hinweise nicht mit gesetzt. +\end{environments} + +\subsection{Optionen an Aufgaben}\sinceversion{0.9.0}\label{sec:optionen_aufgabenpool} +Zu jeder Aufgabe lassen sich einstellbare Optionen angeben. Mit diesen kann man regeln, ob bestimmte Teile im fertigen Dokument mit eingebunden werden sollen oder nicht. So lassen sich zum Beispiel bestimmte Teilaufgaben ausklammern und nicht bei jeder Nutzung der Aufgabe darstellen. Es gibt auch die Möglichkeit die Einbindung weiterer Dokumente so zu regeln, dass sie einmal in einer Klassenarbeit/Klausur gesetzt werden, auch wenn sie in mehreren Aufgaben aus dem Aufgabenpool vorkommen. + +\subsubsection{Befehle} +\begin{commands} + \command{ifAufgabenpoolOptionTF}[\marg{Optionname}\marg{<Wahr>}\marg{<Falsch>}] + Dieses bietet die Möglichkeit anhand der gewählten Option bestimmte Teile anzeigen zu lassen oder nicht. Der Wahr-Teil wird ausgeführt, wenn die angegeben Option gewählt ist. Gleiches gilt für den Falsch-Teil, wenn die Option nicht gewählt ist. Zur Vereinfachung gibt es diesen Befehl auch nur mit dem Wahr- oder Falsch-Teil. + \command{ifAufgabenpoolOptionT}[\marg{Optionname}\marg{<Wahr>}] + Siehe \cs*{ifAufgabenpoolOptionTF}. + \command{ifAufgabenpoolOptionF}[\marg{Optionname}\marg{<Falsch>}] + Siehe \cs*{ifAufgabenpoolOptionTF} + \command{setAufgabenpoolOptionen}[\marg{Optionennamen}] + Dieses kann im Kopf der Aufgabendatei genutzt werden, um die Optionen zu setzen. So lassen sich die verschiedenen Ansichten bereits im Aufgabendokument anzeigen. \end{commands} diff --git a/macros/latex/contrib/schule/doc/schule.pdf b/macros/latex/contrib/schule/doc/schule.pdf Binary files differindex 25ecb12e63..1129996f96 100644 --- a/macros/latex/contrib/schule/doc/schule.pdf +++ b/macros/latex/contrib/schule/doc/schule.pdf diff --git a/macros/latex/contrib/schule/doc/schule.tex b/macros/latex/contrib/schule/doc/schule.tex index 7e4e9fad3c..e2621da5a5 100644 --- a/macros/latex/contrib/schule/doc/schule.tex +++ b/macros/latex/contrib/schule/doc/schule.tex @@ -52,8 +52,8 @@ \setcnltx{ name = schule , title = schule , - version = 0.8.4 , - date = 2023-03-19 , + version = 0.9.0 , + date = 2023-10-07 , subtitle = {\LaTeX-Klassen und Pakete für den Einsatz im Bereich der Schule}, info = Paketdokumentation , authors = {Johannes Pieper, Johannes Kuhaupt, Ludger Humbert, Andr\'e Hilbig, Adrian Salamon, Daniel Spittank} , diff --git a/macros/latex/contrib/schule/latex/schule.mod.Aufgaben.code.tex b/macros/latex/contrib/schule/latex/schule.mod.Aufgaben.code.tex index d38890750d..1ea304ecf4 100644 --- a/macros/latex/contrib/schule/latex/schule.mod.Aufgaben.code.tex +++ b/macros/latex/contrib/schule/latex/schule.mod.Aufgaben.code.tex @@ -90,8 +90,16 @@ %Setzten des Aufgabentemplates \NewDocumentCommand{\setzeAufgabentemplate}{m}{ \xsimsetup{aufgabe/template=#1} + \xsimsetup{aufgabe*/template=#1} } +%Setzten des Lösungtemplates +\NewDocumentCommand{\setzeLoesungentemplate}{m}{ + \xsimsetup{loesung/template=#1} + \xsimsetup{loesung*/template=#1} +} + + % Teilaufgaben % -------------------------------------------------------------------- diff --git a/macros/latex/contrib/schule/latex/schule.mod.Aufgabenpool.code.tex b/macros/latex/contrib/schule/latex/schule.mod.Aufgabenpool.code.tex index 0c27afb1fb..76e66d9795 100644 --- a/macros/latex/contrib/schule/latex/schule.mod.Aufgabenpool.code.tex +++ b/macros/latex/contrib/schule/latex/schule.mod.Aufgabenpool.code.tex @@ -1,21 +1,83 @@ -\newcommand{\basedir}{.} - \ExplSyntaxOn -\DeclareDocumentCommand{\setBasedir}{}{ - \exp_args:Nnf\SetExerciseProperty{basedir}{\basedir}% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Optionen für den Aufgabenpool +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\clist_new:N \g__schule_aufgabenoptionen_clist + +\DeclareDocumentCommand{\ifAufgabenpoolOptionTF}{m m m}{ + \clist_if_in:NnTF \g__schule_aufgabenoptionen_clist {#1} {#2} {#3} +} + +\DeclareDocumentCommand{\ifAufgabenpoolOptionT}{m m}{ + \clist_if_in:NnT \g__schule_aufgabenoptionen_clist {#1} {#2} +} + +\DeclareDocumentCommand{\ifAufgabenpoolOptionF}{m m}{ + \clist_if_in:NnF \g__schule_aufgabenoptionen_clist {#1} {#2} +} + +\DeclareExerciseProperty-{poolOptionen} + +\DeclareDocumentCommand{\setAufgabenpoolOptionen}{m}{ + \clist_set:Nn \g__schule_aufgabenoptionen_clist {#1}% } -\DeclareDocumentCommand{\aufgabeninput}{mm}{ - \DeclareDocumentCommand{\basedir}{}{#1} - \input{#1/#2} +\DeclareDocumentCommand{\set@AufgabenpoolOptionen@Property}{}{ + \exp_args:Nnf\SetExerciseProperty{poolOptionen}{\clist_use:Nn \g__schule_aufgabenoptionen_clist {,}}% } + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Basedir Elemente +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\str_new:N \g__schule_basedir_string +\str_gset:Nn \g__schule_basedir_string {.} + \DeclareExerciseProperty-{basedir} +\DeclareDocumentCommand{\setBasedir}{}{ + \exp_args:Nnf\SetExerciseProperty{basedir}{\str_use:N \g__schule_basedir_string}% +} + \DeclareDocumentCommand{\getBasedir}{}{ - \GetExerciseProperty{basedir} + \str_use:N \g__schule_basedir_string +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Aufgabenhinweise +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\bool_new:N \g__schule_aufgabenhinweis_bool +\bool_gset_true:N \g__schule_aufgabenhinweis_bool +\NewDocumentEnvironment{aufgabenpoolHinweis}{+b}{ + \bool_if:NT \g__schule_aufgabenhinweis_bool {#1} +}{} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Aufgabeneinbindung +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\DeclareDocumentCommand{\aufgabeninput}{o m m}{ + \bool_gset_false:N \g__schule_aufgabenhinweis_bool + \str_gset:Nn \g__schule_basedir_string {#2} + \clist_set:Nn \g__schule_aufgabenoptionen_clist {#1} + \input{#2/#3} + \bool_gset_true:N \g__schule_aufgabenhinweis_bool } + \xsimsetup{ - aufgabe/begin-hook = \setBasedir, + aufgabe/begin-hook = \setBasedir\set@AufgabenpoolOptionen@Property, + loesung/begin-hook = \clist_set:Nx \g__schule_aufgabenoptionen_clist {\GetExerciseProperty{poolOptionen}} \str_gset:Nx \g__schule_basedir_string {\GetExerciseProperty{basedir}}, } -\ExplSyntaxOff
\ No newline at end of file + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% InputOnce +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\clist_new:N \g__schule_inputonce_clist + +\DeclareDocumentCommand{\inputOnce}{m}{ + \clist_if_in:NnF \g__schule_inputonce_clist {#1} { + \clist_gput_right:Nn \g__schule_inputonce_clist {#1} + \input{\getBasedir/#1} + } +} + +\ExplSyntaxOff diff --git a/macros/latex/contrib/schule/latex/schule.mod.Lizenzen.code.tex b/macros/latex/contrib/schule/latex/schule.mod.Lizenzen.code.tex index 56d4e61952..661a2c96b5 100644 --- a/macros/latex/contrib/schule/latex/schule.mod.Lizenzen.code.tex +++ b/macros/latex/contrib/schule/latex/schule.mod.Lizenzen.code.tex @@ -2,6 +2,30 @@ % Lizenz des Dokuments * % ******************************************************************** + +% Lizenz +% Paket hier laden, damit es mit der Reihenfolge zu hyperref nicht in Konflikt steht +\IfEqCase{\schule@lizenz}{ % + % Lizenz: CC-BY-NC-SA-EU 4.0 + {cc-by-nc-sa-eu-4}{ % + \RequirePackage[type={CC},modifier={by-nc-sa},version={4.0},hyperxmp=\schule@hyperxmp]{doclicense} + }% + % Lizenz: CC-BY-NC-SA 4.0 + {cc-by-nc-sa-4}{ % + \RequirePackage[type={CC},modifier={by-nc-sa},version={4.0},hyperxmp=\schule@hyperxmp]{doclicense} + }% + % Lizenz: CC-BY-SA 4.0 + {cc-by-sa-4}{ % + \RequirePackage[type={CC},modifier={by-sa},version={4.0},hyperxmp=\schule@hyperxmp]{doclicense} + }% + {cc-by-4}{ % + \RequirePackage[type={CC},modifier={by},version={4.0},hyperxmp=\schule@hyperxmp]{doclicense} + }% +}[% + % Sonstiges +] + + % Lizenzname % ******************************************************************** % Kurz diff --git a/macros/latex/contrib/schule/latex/schule.mod.Lizenzen.pakete.tex b/macros/latex/contrib/schule/latex/schule.mod.Lizenzen.pakete.tex index 8bfd6f7305..285d860b76 100644 --- a/macros/latex/contrib/schule/latex/schule.mod.Lizenzen.pakete.tex +++ b/macros/latex/contrib/schule/latex/schule.mod.Lizenzen.pakete.tex @@ -2,24 +2,4 @@ % * Paketabhängigkeiten * % ******************************************************************** -% Lizenz -\IfEqCase{\schule@lizenz}{ % - % Lizenz: CC-BY-NC-SA-EU 4.0 - {cc-by-nc-sa-eu-4}{ % - \RequirePackage[type={CC},modifier={by-nc-sa},version={4.0},hyperxmp=\schule@hyperxmp]{doclicense} - }% - % Lizenz: CC-BY-NC-SA 4.0 - {cc-by-nc-sa-4}{ % - \RequirePackage[type={CC},modifier={by-nc-sa},version={4.0},hyperxmp=\schule@hyperxmp]{doclicense} - }% - % Lizenz: CC-BY-SA 4.0 - {cc-by-sa-4}{ % - \RequirePackage[type={CC},modifier={by-sa},version={4.0},hyperxmp=\schule@hyperxmp]{doclicense} - }% - {cc-by-4}{ % - \RequirePackage[type={CC},modifier={by},version={4.0},hyperxmp=\schule@hyperxmp]{doclicense} - }% -}[% - % Sonstiges -] \RequirePackage{ccicons} diff --git a/macros/latex/contrib/schule/latex/schule.sty b/macros/latex/contrib/schule/latex/schule.sty index 27f9a1775c..ac95a93be7 100644 --- a/macros/latex/contrib/schule/latex/schule.sty +++ b/macros/latex/contrib/schule/latex/schule.sty @@ -1,5 +1,5 @@ \NeedsTeXFormat{LaTeX2e}[2011/11/11] -\ProvidesPackage{schule}[2023/03/19 v0.8.4 % +\ProvidesPackage{schule}[2023/10/07 v0.9.0 % Kommandos fuer die Schule] % ******************************************************************** |