From 3593305133bcfb167225af1b35c299bde1456579 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Tue, 15 Aug 2023 03:00:53 +0000 Subject: CTAN sync 202308150300 --- .../contrib/profcollege/doc/ProfCollege-doc.pdf | Bin 9123899 -> 9105909 bytes .../contrib/profcollege/latex/PfCCalculatrice.tex | 25 +- .../profcollege/latex/PfCCalculsCroises.tex | 269 ++- .../contrib/profcollege/latex/PfCCalisson.tex | 114 +- .../contrib/profcollege/latex/PfCCartographie.tex | 101 +- .../latex/PfCDecomposerNombrePremier.tex | 6 +- .../profcollege/latex/PfCDistributivite.tex | 4 +- .../latex/contrib/profcollege/latex/PfCDomino.tex | 4 +- .../contrib/profcollege/latex/PfCEcrireQCMold.tex | 148 -- .../profcollege/latex/PfCEcritureUnites.tex | 2 +- .../profcollege/latex/PfCEngrenagesBase.tex | 6 +- .../contrib/profcollege/latex/PfCErathostene.tex | 2 +- .../profcollege/latex/PfCLabyrintheNombre.tex | 1 + .../latex/contrib/profcollege/latex/PfCMulArt.tex | 472 +++++ .../profcollege/latex/PfCNotionFonction.tex | 6 +- .../contrib/profcollege/latex/PfCNumberHive.tex | 2 +- .../profcollege/latex/PfCPyramideCalculs.tex | 4 +- .../profcollege/latex/PfCQuestionsRelier.tex | 4 +- .../contrib/profcollege/latex/PfCReperage.tex | 7 +- .../latex/contrib/profcollege/latex/PfCSolides.tex | 19 +- .../profcollege/latex/PfCStatistiquesold.tex | 2106 ------------------- .../profcollege/latex/PfCStatistiquesoldold.tex | 2109 -------------------- .../profcollege/latex/PfCTableauxUnites.tex | 2 +- .../latex/contrib/profcollege/latex/PfCThales.tex | 4 +- .../contrib/profcollege/latex/ProfCollege.sty | 24 +- .../contrib/profcollege/metapost/PfCGeometrie.mp | 247 ++- 26 files changed, 1040 insertions(+), 4648 deletions(-) delete mode 100644 macros/latex/contrib/profcollege/latex/PfCEcrireQCMold.tex create mode 100644 macros/latex/contrib/profcollege/latex/PfCMulArt.tex delete mode 100644 macros/latex/contrib/profcollege/latex/PfCStatistiquesold.tex delete mode 100644 macros/latex/contrib/profcollege/latex/PfCStatistiquesoldold.tex (limited to 'macros/latex/contrib/profcollege') diff --git a/macros/latex/contrib/profcollege/doc/ProfCollege-doc.pdf b/macros/latex/contrib/profcollege/doc/ProfCollege-doc.pdf index fe2337ad5b..3b1cda34d7 100644 Binary files a/macros/latex/contrib/profcollege/doc/ProfCollege-doc.pdf and b/macros/latex/contrib/profcollege/doc/ProfCollege-doc.pdf differ diff --git a/macros/latex/contrib/profcollege/latex/PfCCalculatrice.tex b/macros/latex/contrib/profcollege/latex/PfCCalculatrice.tex index 79ffe0f582..8a7efd3342 100644 --- a/macros/latex/contrib/profcollege/latex/PfCCalculatrice.tex +++ b/macros/latex/contrib/profcollege/latex/PfCCalculatrice.tex @@ -111,20 +111,21 @@ % #1 Calcul %2 r\'eponse \ifluatex \mplibnumbersystem{double} - \mplibforcehmode% - \begin{mplibcode}% - input PfCCalculatrice; - LargeurEcran:=\useKV[ClesCalculatrice]{Largeur}; - boolean Calcul; - Calcul=\useKV[ClesCalculatrice]{Calcul}; - LCD(#1)(#2)(#3); - \end{mplibcode} + \mplibforcehmode% + \begin{mplibcode}% + input PfCCalculatrice; + LargeurEcran:=\useKV[ClesCalculatrice]{Largeur}; + boolean Calcul; + Calcul=\useKV[ClesCalculatrice]{Calcul}; + LCD(#1)(#2)(#3); + \end{mplibcode} + \mplibnumbersystem{scaled} \else - \begin{mpost}[mpsettings={input PfCCalculatrice;LargeurEcran:=\useKV[ClesCalculatrice]{Largeur};}] - LCD(#1)(#2)(#3); - \end{mpost} + \begin{mpost}[mpsettings={input PfCCalculatrice;LargeurEcran:=\useKV[ClesCalculatrice]{Largeur};}] + LCD(#1)(#2)(#3); + \end{mpost} \fi -} +}% \setKVdefault[ClesCalculatrice]{Ecran=false,NbLignes=0,BL=0.775,Largeur=120,Calcul=false} diff --git a/macros/latex/contrib/profcollege/latex/PfCCalculsCroises.tex b/macros/latex/contrib/profcollege/latex/PfCCalculsCroises.tex index da114a33f2..a29f47f9af 100644 --- a/macros/latex/contrib/profcollege/latex/PfCCalculsCroises.tex +++ b/macros/latex/contrib/profcollege/latex/PfCCalculsCroises.tex @@ -1,19 +1,22 @@ %%% % Calculs Croises %%% -\setKVdefault[CalculsCroises]{Largeur=20pt,Solution=false,Inverse=false,Creation=false,Graines=false,Vide=false,Couleur=LightGray,Negatifs=false,Aide=false} +\setKVdefault[CalculsCroises]{Largeur=20pt,Solution=false,Inverse=false,Creation=false,Graines=false,Vide=false,Couleur=LightGray,Negatifs=false,Aide=false,CouleurS=blue} \defKV[CalculsCroises]{Graine=\setKV[CalculsCroises]{Graines}}% \defKV[CalculsCroises]{ListeNombres=\setKV[CalculsCroises]{Aide}}% \newlength\PfCCalculsCroises% +\newcounter{CCRetiensAide}% + \NewDocumentCommand\CalculsCroises{o m}{% \useKVdefault[CalculsCroises]% \savecomparemode% \comparestrict% \setKV[CalculsCroises]{#1}% \colorlet{PfCCouleurCC}{\useKV[CalculsCroises]{Couleur}}% + \colorlet{PfCCouleurCCS}{\useKV[CalculsCroises]{CouleurS}}% \setlength{\PfCCalculsCroises}{\useKV[CalculsCroises]{Largeur}+\tabcolsep}% - \ifboolKV[CalculsCroises]{Inverse}{\setKV[CalculsCroises]{Solution}}{}% + \ifboolKV[CalculsCroises]{Inverse}{\setKV[CalculsCroises]{Solution}\colorlet{PfCCouleurCCS}{black}}{}% \ifboolKV[CalculsCroises]{Creation}{% \ifboolKV[CalculsCroises]{Graines}{\PfCGraineAlea{\useKV[CalculsCroises]{Graine}}}{}% \ifboolKV[CalculsCroises]{Negatifs}{% @@ -24,70 +27,145 @@ \MelangeListe{\PfCCCFoo}{9}% \setsepchar{,}% \readlist*\PfCListeCCNb{\faa}% - \readlist*\PfCListeCCOp{#2}% + \readlist*\PfCListeCCOpRetiens{#2}% + \xdef\PfCFoo{}% + \xintFor* ##1 in{\xintSeq{1}{3}}\do{% + \xintifForLast{\xdef\PfCFoo{\PfCFoo,\PfCListeCCNb[##1],\PfCListeCCOpRetiens[##1],\PfCListeCCOpRetiens[\fpeval{##1+1}],\PfCListeCCOpRetiens[\fpeval{##1+2}]}}{\xdef\PfCFoo{\PfCFoo,\PfCListeCCNb[##1],\PfCListeCCOpRetiens[##1]}}% + }% + \xintFor* ##1 in{\xintSeq{4}{6}}\do{% + \xintifForLast{\xdef\PfCFoo{\PfCFoo,\PfCListeCCNb[##1],\PfCListeCCOpRetiens[\fpeval{##1+2}],\PfCListeCCOpRetiens[\fpeval{##1+3}],\PfCListeCCOpRetiens[\fpeval{##1+4}]}}{\xdef\PfCFoo{\PfCFoo,\PfCListeCCNb[##1],\PfCListeCCOpRetiens[\fpeval{##1+2}]}}% + }% + \xintFor* ##1 in{\xintSeq{7}{9}}\do{% + \xintifForLast{\xdef\PfCFoo{\PfCFoo,\PfCListeCCNb[##1]}}{\xdef\PfCFoo{\PfCFoo, \PfCListeCCNb[##1],\PfCListeCCOpRetiens[\fpeval{##1+4}]}}% + }% + \setsepchar{,}\ignoreemptyitems% + \readlist*\PfCListeCCOp{\PfCFoo}% + \reademptyitems \xdef\PfCCCfoo{\useKV[CalculsCroises]{ListeNombres}}% \readlist*\PfCListeCCAide{\PfCCCfoo}% - \begin{NiceTabular}{*{6}{m{\useKV[CalculsCroises]{Largeur}}}} - \rule{0pt}{\PfCCalculsCroises}\Block{}{\ifboolKV[CalculsCroises]{Solution}{\num{\PfCListeCCNb[1]}}{% - \ifboolKV[CalculsCroises]{Aide}{% - \xintFor* ##1 in{\xintSeq{1}{\PfCListeCCAidelen}}\do{% - \xintifboolexpr{\PfCListeCCNb[1]==\PfCListeCCAide[##1]}{\num{\PfCListeCCNb[1]}}{}% - }% + }{% + \ifboolKV[CalculsCroises]{Vide}{}{% + \readlist*\PfCListeCCOp{#2}% + \xdef\PfCCCfoo{\useKV[CalculsCroises]{ListeNombres}}% + \readlist*\PfCListeCCAide{\PfCCCfoo}% + }% + }% + % On affiche + \begin{NiceTabular}{*{6}{m{\useKV[CalculsCroises]{Largeur}}}} + \ifboolKV[CalculsCroises]{Vide}{% + \rule{0pt}{\PfCCalculsCroises}\Block{}{}&\Block{}{}&\Block{}{}&\Block{}{}&\Block{}{}&\Block[borders={bottom,right,top},fill=PfCCouleurCC]{}{}\\ + \rule{0pt}{\PfCCalculsCroises}\Block{}{}&\Block[fill=black]{}{}&\Block{}{}&\Block[fill=black]{}{}&\Block{}{}\\ + \rule{0pt}{\PfCCalculsCroises}\Block{}{}&\Block{}{}&\Block{}{}&\Block{}{}&\Block{}{}&\Block[borders={bottom,right,top},fill=PfCCouleurCC]{}{}\\ + \rule{0pt}{\PfCCalculsCroises}\Block{}{}&\Block[fill=black]{}{}&\Block{}{}&\Block[fill=black]{}{}&\Block{}{}\\ + \rule{0pt}{\PfCCalculsCroises}\Block{}{}&\Block{}{}&\Block{}{}&\Block{}{}&\Block{}{}&\Block[borders={bottom,right,top},fill=PfCCouleurCC]{}{}\\ + \rule{0pt}{\PfCCalculsCroises}\Block[borders={left,bottom,right},fill=PfCCouleurCC]{}{}&&\Block[borders={left,bottom,right},fill=PfCCouleurCC]{}{}&&\Block[borders={left,bottom,right},fill=PfCCouleurCC]{}{}\\ + }{% + \rule{0pt}{\PfCCalculsCroises}\Block{}{% + \ifboolKV[CalculsCroises]{Aide}{% + \setcounter{CCRetiensAide}{0}% + \xintFor* ##1 in{\xintSeq{1}{\PfCListeCCAidelen}}\do{% + \xintifboolexpr{\PfCListeCCOp[1]==\PfCListeCCAide[##1]}{\num{\PfCListeCCOp[1]}}{\stepcounter{CCRetiensAide}}% + }% + \xintifboolexpr{\theCCRetiensAide==\PfCListeCCAidelen}{\ifboolKV[CalculsCroises]{Solution}{\color{PfCCouleurCCS}\num{\PfCListeCCOp[1]}}{}}{}% + }{\ifboolKV[CalculsCroises]{Solution}{% + \color{PfCCouleurCCS}\num{\PfCListeCCOp[1]}% }{}% - }}&\StrCompare{\PfCListeCCOp[1]}{*}[\PfCTestEtoile]\Block{}{\xintifboolexpr{\PfCTestEtoile==0}{$\times$}{$\PfCListeCCOp[1]$}}&\Block{}{\ifboolKV[CalculsCroises]{Solution}{\num{\PfCListeCCNb[2]}}{% - \ifboolKV[CalculsCroises]{Aide}{% - \xintFor* ##1 in{\xintSeq{1}{\PfCListeCCAidelen}}\do{% - \xintifboolexpr{\PfCListeCCNb[2]==\PfCListeCCAide[##1]}{\num{\PfCListeCCNb[2]}}{}% - }% + }% + }&\StrCompare{\PfCListeCCOp[2]}{*}[\PfCTestEtoile]\Block{}{\xintifboolexpr{\PfCTestEtoile==0}{$\times$}{$\PfCListeCCOp[2]$}}&\Block{}{% + \ifboolKV[CalculsCroises]{Aide}{% + \setcounter{CCRetiensAide}{0}% + \xintFor* ##1 in{\xintSeq{1}{\PfCListeCCAidelen}}\do{% + \xintifboolexpr{\PfCListeCCOp[3]==\PfCListeCCAide[##1]}{\num{\PfCListeCCOp[3]}}{\stepcounter{CCRetiensAide}}% + }% + \xintifboolexpr{\theCCRetiensAide==\PfCListeCCAidelen}{\ifboolKV[CalculsCroises]{Solution}{\color{PfCCouleurCCS}\num{\PfCListeCCOp[3]}}{}}{}% + }{\ifboolKV[CalculsCroises]{Solution}{% + \color{PfCCouleurCCS}\num{\PfCListeCCOp[3]}% }{}% - }}&\StrCompare{\PfCListeCCOp[2]}{*}[\PfCTestEtoile]\Block{}{\xintifboolexpr{\PfCTestEtoile==0}{$\times$}{$\PfCListeCCOp[2]$}}&\Block{}{\ifboolKV[CalculsCroises]{Solution}{\num{\PfCListeCCNb[3]}}{% - \ifboolKV[CalculsCroises]{Aide}{% - \xintFor* ##1 in{\xintSeq{1}{\PfCListeCCAidelen}}\do{% - \xintifboolexpr{\PfCListeCCNb[3]==\PfCListeCCAide[##1]}{\num{\PfCListeCCNb[3]}}{}% - }% + }% + }&\StrCompare{\PfCListeCCOp[4]}{*}[\PfCTestEtoile]\Block{}{\xintifboolexpr{\PfCTestEtoile==0}{$\times$}{$\PfCListeCCOp[4]$}}&\Block{}{% + \ifboolKV[CalculsCroises]{Aide}{% + \setcounter{CCRetiensAide}{0} + \xintFor* ##1 in{\xintSeq{1}{\PfCListeCCAidelen}}\do{% + \xintifboolexpr{\PfCListeCCOp[5]==\PfCListeCCAide[##1]}{\num{\PfCListeCCOp[5]}}{\stepcounter{CCRetiensAide}}% + }% + \xintifboolexpr{\theCCRetiensAide==\PfCListeCCAidelen}{\ifboolKV[CalculsCroises]{Solution}{\color{PfCCouleurCCS}\num{\PfCListeCCOp[5]}}{}}{}% + }{\ifboolKV[CalculsCroises]{Solution}{% + \color{PfCCouleurCCS}\num{\PfCListeCCOp[5]}% }{}% - }}&\Block[borders={bottom,right,top},fill=PfCCouleurCC]{}{\ifboolKV[CalculsCroises]{Inverse}{}{\num{\fpeval{\PfCListeCCNb[1]\PfCListeCCOp[1]\PfCListeCCNb[2]\PfCListeCCOp[2]\PfCListeCCNb[3]}}}}\\ - \rule{0pt}{\PfCCalculsCroises}\StrCompare{\PfCListeCCOp[3]}{*}[\PfCTestEtoile]\Block{}{\xintifboolexpr{\PfCTestEtoile==0}{$\times$}{$\PfCListeCCOp[3]$}}&\Block[fill=black]{}{~}&\StrCompare{\PfCListeCCOp[4]}{*}[\PfCTestEtoile]\Block{}{\xintifboolexpr{\PfCTestEtoile==0}{$\times$}{$\PfCListeCCOp[4]$}}&\Block[fill=black]{}{~}&\StrCompare{\PfCListeCCOp[5]}{*}[\PfCTestEtoile]\Block{}{\xintifboolexpr{\PfCTestEtoile==0}{$\times$}{$\PfCListeCCOp[5]$}}\\ - \rule{0pt}{\PfCCalculsCroises}\Block{}{\ifboolKV[CalculsCroises]{Solution}{\num{\PfCListeCCNb[4]}}{% + }% + }&\Block[borders={bottom,right,top},fill=PfCCouleurCC]{}{\ifboolKV[CalculsCroises]{Inverse}{}{\num{\fpeval{\PfCListeCCOp[1]\PfCListeCCOp[2]\PfCListeCCOp[3]\PfCListeCCOp[4]\PfCListeCCOp[5]}}}}\\ + \rule{0pt}{\PfCCalculsCroises}\StrCompare{\PfCListeCCOp[6]}{*}[\PfCTestEtoile]\Block{}{\xintifboolexpr{\PfCTestEtoile==0}{$\times$}{$\PfCListeCCOp[6]$}}&\Block[fill=black]{}{~}&\StrCompare{\PfCListeCCOp[7]}{*}[\PfCTestEtoile]\Block{}{\xintifboolexpr{\PfCTestEtoile==0}{$\times$}{$\PfCListeCCOp[7]$}}&\Block[fill=black]{}{~}&\StrCompare{\PfCListeCCOp[8]}{*}[\PfCTestEtoile]\Block{}{\xintifboolexpr{\PfCTestEtoile==0}{$\times$}{$\PfCListeCCOp[8]$}}\\ + \rule{0pt}{\PfCCalculsCroises}\Block{}{% + \setcounter{CCRetiensAide}{0}% \ifboolKV[CalculsCroises]{Aide}{% - \xintFor* ##1 in{\xintSeq{1}{\PfCListeCCAidelen}}\do{% - \xintifboolexpr{\PfCListeCCNb[4]==\PfCListeCCAide[##1]}{\num{\PfCListeCCNb[4]}}{}% - }% + \xintFor* ##1 in{\xintSeq{1}{\PfCListeCCAidelen}}\do{% + \xintifboolexpr{\PfCListeCCOp[9]==\PfCListeCCAide[##1]}{\num{\PfCListeCCOp[9]}}{\stepcounter{CCRetiensAide}}% + }% + \xintifboolexpr{\theCCRetiensAide==\PfCListeCCAidelen}{\ifboolKV[CalculsCroises]{Solution}{\color{PfCCouleurCCS}\num{\PfCListeCCOp[9]}}{}}{}% + }{\ifboolKV[CalculsCroises]{Solution}{% + \color{PfCCouleurCCS}\num{\PfCListeCCOp[9]}% }{}% - }}&\StrCompare{\PfCListeCCOp[6]}{*}[\PfCTestEtoile]\Block{}{\xintifboolexpr{\PfCTestEtoile==0}{$\times$}{$\PfCListeCCOp[6]$}}&\Block{}{\ifboolKV[CalculsCroises]{Solution}{\num{\PfCListeCCNb[5]}}{% - \ifboolKV[CalculsCroises]{Aide}{% - \xintFor* ##1 in{\xintSeq{1}{\PfCListeCCAidelen}}\do{% - \xintifboolexpr{\PfCListeCCNb[5]==\PfCListeCCAide[##1]}{\num{\PfCListeCCNb[5]}}{}% - }% + }% + }&\StrCompare{\PfCListeCCOp[10]}{*}[\PfCTestEtoile]\Block{}{\xintifboolexpr{\PfCTestEtoile==0}{$\times$}{$\PfCListeCCOp[10]$}}&\Block{}{% + \ifboolKV[CalculsCroises]{Aide}{% + \setcounter{CCRetiensAide}{0}% + \xintFor* ##1 in{\xintSeq{1}{\PfCListeCCAidelen}}\do{% + \xintifboolexpr{\PfCListeCCOp[11]==\PfCListeCCAide[##1]}{\num{\PfCListeCCOp[11]}}{\stepcounter{CCRetiensAide}}% + }% + \xintifboolexpr{\theCCRetiensAide==\PfCListeCCAidelen}{\ifboolKV[CalculsCroises]{Solution}{\color{PfCCouleurCCS}\num{\PfCListeCCOp[11]}}{}}{}% + }{\ifboolKV[CalculsCroises]{Solution}{% + \color{PfCCouleurCCS}\num{\PfCListeCCOp[11]}% }{}% - }}&\StrCompare{\PfCListeCCOp[7]}{*}[\PfCTestEtoile]\Block{}{\xintifboolexpr{\PfCTestEtoile==0}{$\times$}{$\PfCListeCCOp[7]$}}&\Block{}{\ifboolKV[CalculsCroises]{Solution}{\num{\PfCListeCCNb[6]}}{% - \ifboolKV[CalculsCroises]{Aide}{% - \xintFor* ##1 in{\xintSeq{1}{\PfCListeCCAidelen}}\do{% - \xintifboolexpr{\PfCListeCCNb[6]==\PfCListeCCAide[##1]}{\num{\PfCListeCCNb[6]}}{}% - }% + }% + }&\StrCompare{\PfCListeCCOp[12]}{*}[\PfCTestEtoile]\Block{}{\xintifboolexpr{\PfCTestEtoile==0}{$\times$}{$\PfCListeCCOp[12]$}}&\Block{}{% + \ifboolKV[CalculsCroises]{Aide}{% + \setcounter{CCRetiensAide}{0}% + \xintFor* ##1 in{\xintSeq{1}{\PfCListeCCAidelen}}\do{% + \xintifboolexpr{\PfCListeCCOp[13]==\PfCListeCCAide[##1]}{\num{\PfCListeCCOp[13]}}{\stepcounter{CCRetiensAide}}% + }% + \xintifboolexpr{\theCCRetiensAide==\PfCListeCCAidelen}{\ifboolKV[CalculsCroises]{Solution}{\color{PfCCouleurCCS}\num{\PfCListeCCOp[13]}}{}}{}% + }{\ifboolKV[CalculsCroises]{Solution}{% + \color{PfCCouleurCCS}\num{\PfCListeCCOp[13]}% }{}% - }}&\Block[borders={bottom,right,top},fill=PfCCouleurCC]{}{\ifboolKV[CalculsCroises]{Inverse}{}{\num{\fpeval{\PfCListeCCNb[4]\PfCListeCCOp[6]\PfCListeCCNb[5]\PfCListeCCOp[7]\PfCListeCCNb[6]}}}}\\ - \rule{0pt}{\PfCCalculsCroises}\StrCompare{\PfCListeCCOp[8]}{*}[\PfCTestEtoile]\Block{}{\xintifboolexpr{\PfCTestEtoile==0}{$\times$}{$\PfCListeCCOp[8]$}}&\Block[fill=black]{}{~}&\StrCompare{\PfCListeCCOp[9]}{*}[\PfCTestEtoile]\Block{}{\xintifboolexpr{\PfCTestEtoile==0}{$\times$}{$\PfCListeCCOp[9]$}}&\Block[fill=black]{}{~}&\StrCompare{\PfCListeCCOp[10]}{*}[\PfCTestEtoile]\Block{}{\xintifboolexpr{\PfCTestEtoile==0}{$\times$}{$\PfCListeCCOp[10]$}}\\ - \rule{0pt}{\PfCCalculsCroises}\Block{}{\ifboolKV[CalculsCroises]{Solution}{\num{\PfCListeCCNb[7]}}{% + }% + }&\Block[borders={bottom,right,top},fill=PfCCouleurCC]{}{\ifboolKV[CalculsCroises]{Inverse}{}{\num{\fpeval{\PfCListeCCOp[9]\PfCListeCCOp[10]\PfCListeCCOp[11]\PfCListeCCOp[12]\PfCListeCCOp[13]}}}}\\ + \rule{0pt}{\PfCCalculsCroises}\StrCompare{\PfCListeCCOp[14]}{*}[\PfCTestEtoile]\Block{}{\xintifboolexpr{\PfCTestEtoile==0}{$\times$}{$\PfCListeCCOp[14]$}}&\Block[fill=black]{}{~}&\StrCompare{\PfCListeCCOp[15]}{*}[\PfCTestEtoile]\Block{}{\xintifboolexpr{\PfCTestEtoile==0}{$\times$}{$\PfCListeCCOp[15]$}}&\Block[fill=black]{}{~}&\StrCompare{\PfCListeCCOp[16]}{*}[\PfCTestEtoile]\Block{}{\xintifboolexpr{\PfCTestEtoile==0}{$\times$}{$\PfCListeCCOp[16]$}}\\ + \rule{0pt}{\PfCCalculsCroises}\Block{}{% \ifboolKV[CalculsCroises]{Aide}{% + \setcounter{CCRetiensAide}{0}% \xintFor* ##1 in{\xintSeq{1}{\PfCListeCCAidelen}}\do{% - \xintifboolexpr{\PfCListeCCNb[7]==\PfCListeCCAide[##1]}{\num{\PfCListeCCNb[7]}}{}% + \xintifboolexpr{\PfCListeCCOp[17]==\PfCListeCCAide[##1]}{\num{\PfCListeCCOp[17]}}{\stepcounter{CCRetiensAide}}% }% - }{}% - }}&\StrCompare{\PfCListeCCOp[11]}{*}[\PfCTestEtoile]\Block{}{\xintifboolexpr{\PfCTestEtoile==0}{$\times$}{$\PfCListeCCOp[11]$}}&\Block{}{\ifboolKV[CalculsCroises]{Solution}{\num{\PfCListeCCNb[8]}}{% + \xintifboolexpr{\theCCRetiensAide==\PfCListeCCAidelen}{\ifboolKV[CalculsCroises]{Solution}{\color{PfCCouleurCCS}\num{\PfCListeCCOp[17]}}{}}{}% + }{\ifboolKV[CalculsCroises]{Solution}{% + \color{PfCCouleurCCS}\num{\PfCListeCCOp[17]}% + }{}% + }% + }&\StrCompare{\PfCListeCCOp[18]}{*}[\PfCTestEtoile]\Block{}{\xintifboolexpr{\PfCTestEtoile==0}{$\times$}{$\PfCListeCCOp[18]$}}&\Block{}{% \ifboolKV[CalculsCroises]{Aide}{% - \xintFor* ##1 in{\xintSeq{1}{\PfCListeCCAidelen}}\do{% - \xintifboolexpr{\PfCListeCCNb[8]==\PfCListeCCAide[##1]}{\num{\PfCListeCCNb[8]}}{}% - }% + \setcounter{CCRetiensAide}{0}% + \xintFor* ##1 in{\xintSeq{1}{\PfCListeCCAidelen}}\do{% + \xintifboolexpr{\PfCListeCCOp[19]==\PfCListeCCAide[##1]}{\num{\PfCListeCCOp[19]}}{\stepcounter{CCRetiensAide}}% + }% + \xintifboolexpr{\theCCRetiensAide==\PfCListeCCAidelen}{\ifboolKV[CalculsCroises]{Solution}{\color{PfCCouleurCCS}\num{\PfCListeCCOp[19]}}{}}{}% + }{\ifboolKV[CalculsCroises]{Solution}{% + \color{PfCCouleurCCS}\num{\PfCListeCCOp[19]}% }{}% - }}&\StrCompare{\PfCListeCCOp[12]}{*}[\PfCTestEtoile]\Block{}{\xintifboolexpr{\PfCTestEtoile==0}{$\times$}{$\PfCListeCCOp[12]$}}&\Block{}{\ifboolKV[CalculsCroises]{Solution}{\num{\PfCListeCCNb[9]}}{% - \ifboolKV[CalculsCroises]{Aide}{% - \xintFor* ##1 in{\xintSeq{1}{\PfCListeCCAidelen}}\do{% - \xintifboolexpr{\PfCListeCCNb[9]==\PfCListeCCAide[##1]}{\num{\PfCListeCCNb[9]}}{}% - }% + }% + }&\StrCompare{\PfCListeCCOp[20]}{*}[\PfCTestEtoile]\Block{}{\xintifboolexpr{\PfCTestEtoile==0}{$\times$}{$\PfCListeCCOp[20]$}}&\Block{}{% + \ifboolKV[CalculsCroises]{Aide}{% + \setcounter{CCRetiensAide}{0}% + \xintFor* ##1 in{\xintSeq{1}{\PfCListeCCAidelen}}\do{% + \xintifboolexpr{\PfCListeCCOp[21]==\PfCListeCCAide[##1]}{\num{\PfCListeCCOp[21]}}{\stepcounter{CCRetiensAide}}% + }% + \xintifboolexpr{\theCCRetiensAide==\PfCListeCCAidelen}{\ifboolKV[CalculsCroises]{Solution}{\color{PfCCouleurCCS}\num{\PfCListeCCOp[21]}}{}}{}% + }{\ifboolKV[CalculsCroises]{Solution}{% + \color{PfCCouleurCCS}\num{\PfCListeCCOp[21]}% }{}% - }}&\Block[borders={bottom,right,top},fill=PfCCouleurCC]{}{\ifboolKV[CalculsCroises]{Inverse}{}{\num{\fpeval{\PfCListeCCNb[7]\PfCListeCCOp[11]\PfCListeCCNb[8]\PfCListeCCOp[12]\PfCListeCCNb[9]}}}}\\ - \rule{0pt}{\PfCCalculsCroises}\Block[borders={left,bottom,right},fill=PfCCouleurCC]{}{\ifboolKV[CalculsCroises]{Inverse}{}{\num{\fpeval{\PfCListeCCNb[1]\PfCListeCCOp[3]\PfCListeCCNb[4]\PfCListeCCOp[8]\PfCListeCCNb[7]}}}}&&\Block[borders={left,bottom,right},fill=PfCCouleurCC]{}{\ifboolKV[CalculsCroises]{Inverse}{}{\num{\fpeval{\PfCListeCCNb[2]\PfCListeCCOp[4]\PfCListeCCNb[5]\PfCListeCCOp[9]\PfCListeCCNb[8]}}}}&&\Block[borders={left,bottom,right},fill=PfCCouleurCC]{}{\ifboolKV[CalculsCroises]{Inverse}{}{\num{\fpeval{\PfCListeCCNb[3]\PfCListeCCOp[5]\PfCListeCCNb[6]\PfCListeCCOp[10]\PfCListeCCNb[9]}}}}\\ + }% + }&\Block[borders={bottom,right,top},fill=PfCCouleurCC]{}{\ifboolKV[CalculsCroises]{Inverse}{}{\num{\fpeval{\PfCListeCCOp[17]\PfCListeCCOp[18]\PfCListeCCOp[19]\PfCListeCCOp[20]\PfCListeCCOp[21]}}}}\\ + \rule{0pt}{\PfCCalculsCroises}\Block[borders={left,bottom,right},fill=PfCCouleurCC]{}{\ifboolKV[CalculsCroises]{Inverse}{}{\num{\fpeval{\PfCListeCCOp[1]\PfCListeCCOp[6]\PfCListeCCOp[9]\PfCListeCCOp[14]\PfCListeCCOp[17]}}}}&&\Block[borders={left,bottom,right},fill=PfCCouleurCC]{}{\ifboolKV[CalculsCroises]{Inverse}{}{\num{\fpeval{\PfCListeCCOp[3]\PfCListeCCOp[7]\PfCListeCCOp[11]\PfCListeCCOp[15]\PfCListeCCOp[19]}}}}&&\Block[borders={left,bottom,right},fill=PfCCouleurCC]{}{\ifboolKV[CalculsCroises]{Inverse}{}{\num{\fpeval{\PfCListeCCOp[5]\PfCListeCCOp[8]\PfCListeCCOp[13]\PfCListeCCOp[16]\PfCListeCCOp[21]}}}}\\ + }% \CodeAfter \tikz\draw (1-|1) rectangle (6-|6); \xintFor* ##1 in{\xintSeq{2}{5}}\do{% @@ -96,91 +174,6 @@ \xintFor* ##1 in{\xintSeq{2}{5}}\do{% \tikz\draw (##1-|1) -- (##1-|6); }% - \end{NiceTabular} - }{% - \ifboolKV[CalculsCroises]{Vide}{% - \begin{NiceTabular}{*{6}{m{\useKV[CalculsCroises]{Largeur}}}} - \rule{0pt}{\PfCCalculsCroises}\Block{}{}&\Block{}{}&\Block{}{}&\Block{}{}&\Block{}{}&\Block[borders={bottom,right,top},fill=PfCCouleurCC]{}{}\\ - \rule{0pt}{\PfCCalculsCroises}\Block{}{}&\Block[fill=black]{}{}&\Block{}{}&\Block[fill=black]{}{}&\Block{}{}\\ - \rule{0pt}{\PfCCalculsCroises}\Block{}{}&\Block{}{}&\Block{}{}&\Block{}{}&\Block{}{}&\Block[borders={bottom,right,top},fill=PfCCouleurCC]{}{}\\ - \rule{0pt}{\PfCCalculsCroises}\Block{}{}&\Block[fill=black]{}{}&\Block{}{}&\Block[fill=black]{}{}&\Block{}{}\\ - \rule{0pt}{\PfCCalculsCroises}\Block{}{}&\Block{}{}&\Block{}{}&\Block{}{}&\Block{}{}&\Block[borders={bottom,right,top},fill=PfCCouleurCC]{}{}\\ - \rule{0pt}{\PfCCalculsCroises}\Block[borders={left,bottom,right},fill=PfCCouleurCC]{}{}&&\Block[borders={left,bottom,right},fill=PfCCouleurCC]{}{}&&\Block[borders={left,bottom,right},fill=PfCCouleurCC]{}{}\\ - \CodeAfter - \tikz\draw (1-|1) rectangle (6-|6); - \xintFor* ##1 in{\xintSeq{2}{5}}\do{% - \tikz\draw (1-|##1) -- (6-|##1); - }% - \xintFor* ##1 in{\xintSeq{2}{5}}\do{% - \tikz\draw (##1-|1) -- (##1-|6); - }% - \end{NiceTabular} - }{% - \readlist*\PfCListeCCOp{#2}% - \xdef\PfCCCfoo{\useKV[CalculsCroises]{ListeNombres}}% - \readlist*\PfCListeCCAide{\PfCCCfoo}% - \begin{NiceTabular}{*{6}{m{\useKV[CalculsCroises]{Largeur}}}} - \rule{0pt}{\PfCCalculsCroises}\Block{}{\ifboolKV[CalculsCroises]{Solution}{\num{\PfCListeCCOp[1]}}{\ifboolKV[CalculsCroises]{Aide}{% - \xintFor* ##1 in{\xintSeq{1}{\PfCListeCCAidelen}}\do{% - \xintifboolexpr{\PfCListeCCOp[1]==\PfCListeCCAide[##1]}{\num{\PfCListeCCOp[1]}}{}% - }% - }{}% -}}&\StrCompare{\PfCListeCCOp[2]}{*}[\PfCTestEtoile]\Block{}{\xintifboolexpr{\PfCTestEtoile==0}{$\times$}{$\PfCListeCCOp[2]$}}&\Block{}{\ifboolKV[CalculsCroises]{Solution}{\num{\PfCListeCCOp[3]}}{\ifboolKV[CalculsCroises]{Aide}{% - \xintFor* ##1 in{\xintSeq{1}{\PfCListeCCAidelen}}\do{% - \xintifboolexpr{\PfCListeCCOp[3]==\PfCListeCCAide[##1]}{\num{\PfCListeCCOp[3]}}{}% - }% - }{}% -}}&\StrCompare{\PfCListeCCOp[4]}{*}[\PfCTestEtoile]\Block{}{\xintifboolexpr{\PfCTestEtoile==0}{$\times$}{$\PfCListeCCOp[4]$}}&\Block{}{\ifboolKV[CalculsCroises]{Solution}{\num{\PfCListeCCOp[5]}}{\ifboolKV[CalculsCroises]{Aide}{% - \xintFor* ##1 in{\xintSeq{1}{\PfCListeCCAidelen}}\do{% - \xintifboolexpr{\PfCListeCCOp[5]==\PfCListeCCAide[##1]}{\num{\PfCListeCCOp[5]}}{}% - }% - }{}% -}}&\Block[borders={bottom,right,top},fill=PfCCouleurCC]{}{\ifboolKV[CalculsCroises]{Inverse}{}{\num{\fpeval{\PfCListeCCOp[1]\PfCListeCCOp[2]\PfCListeCCOp[3]\PfCListeCCOp[4]\PfCListeCCOp[5]}}}}\\ - \rule{0pt}{\PfCCalculsCroises}\StrCompare{\PfCListeCCOp[6]}{*}[\PfCTestEtoile]\Block{}{\xintifboolexpr{\PfCTestEtoile==0}{$\times$}{$\PfCListeCCOp[6]$}}&\Block[fill=black]{}{~}&\StrCompare{\PfCListeCCOp[7]}{*}[\PfCTestEtoile]\Block{}{\xintifboolexpr{\PfCTestEtoile==0}{$\times$}{$\PfCListeCCOp[7]$}}&\Block[fill=black]{}{~}&\StrCompare{\PfCListeCCOp[8]}{*}[\PfCTestEtoile]\Block{}{\xintifboolexpr{\PfCTestEtoile==0}{$\times$}{$\PfCListeCCOp[8]$}}\\ - \rule{0pt}{\PfCCalculsCroises}\Block{}{\ifboolKV[CalculsCroises]{Solution}{\num{\PfCListeCCOp[9]}}{\ifboolKV[CalculsCroises]{Aide}{% - \xintFor* ##1 in{\xintSeq{1}{\PfCListeCCAidelen}}\do{% - \xintifboolexpr{\PfCListeCCOp[9]==\PfCListeCCAide[##1]}{\num{\PfCListeCCOp[9]}}{}% - }% - }{}% -}}&\StrCompare{\PfCListeCCOp[10]}{*}[\PfCTestEtoile]\Block{}{\xintifboolexpr{\PfCTestEtoile==0}{$\times$}{$\PfCListeCCOp[10]$}}&\Block{}{\ifboolKV[CalculsCroises]{Solution}{\num{\PfCListeCCOp[11]}}{\ifboolKV[CalculsCroises]{Aide}{% - \xintFor* ##1 in{\xintSeq{1}{\PfCListeCCAidelen}}\do{% - \xintifboolexpr{\PfCListeCCOp[11]==\PfCListeCCAide[##1]}{\num{\PfCListeCCOp[11]}}{}% - }% - }{}% -}}&\StrCompare{\PfCListeCCOp[12]}{*}[\PfCTestEtoile]\Block{}{\xintifboolexpr{\PfCTestEtoile==0}{$\times$}{$\PfCListeCCOp[12]$}}&\Block{}{\ifboolKV[CalculsCroises]{Solution}{\num{\PfCListeCCOp[13]}}{\ifboolKV[CalculsCroises]{Aide}{% - \xintFor* ##1 in{\xintSeq{1}{\PfCListeCCAidelen}}\do{% - \xintifboolexpr{\PfCListeCCOp[13]==\PfCListeCCAide[##1]}{\num{\PfCListeCCOp[13]}}{}% - }% - }{}% -}}&\Block[borders={bottom,right,top},fill=PfCCouleurCC]{}{\ifboolKV[CalculsCroises]{Inverse}{}{\num{\fpeval{\PfCListeCCOp[9]\PfCListeCCOp[10]\PfCListeCCOp[11]\PfCListeCCOp[12]\PfCListeCCOp[13]}}}}\\ - \rule{0pt}{\PfCCalculsCroises}\StrCompare{\PfCListeCCOp[14]}{*}[\PfCTestEtoile]\Block{}{\xintifboolexpr{\PfCTestEtoile==0}{$\times$}{$\PfCListeCCOp[14]$}}&\Block[fill=black]{}{~}&\StrCompare{\PfCListeCCOp[15]}{*}[\PfCTestEtoile]\Block{}{\xintifboolexpr{\PfCTestEtoile==0}{$\times$}{$\PfCListeCCOp[15]$}}&\Block[fill=black]{}{~}&\StrCompare{\PfCListeCCOp[16]}{*}[\PfCTestEtoile]\Block{}{\xintifboolexpr{\PfCTestEtoile==0}{$\times$}{$\PfCListeCCOp[16]$}}\\ - \rule{0pt}{\PfCCalculsCroises}\Block{}{\ifboolKV[CalculsCroises]{Solution}{\num{\PfCListeCCOp[17]}}{\ifboolKV[CalculsCroises]{Aide}{% - \xintFor* ##1 in{\xintSeq{1}{\PfCListeCCAidelen}}\do{% - \xintifboolexpr{\PfCListeCCOp[17]==\PfCListeCCAide[##1]}{\num{\PfCListeCCOp[17]}}{}% - }% - }{}% -}}&\StrCompare{\PfCListeCCOp[18]}{*}[\PfCTestEtoile]\Block{}{\xintifboolexpr{\PfCTestEtoile==0}{$\times$}{$\PfCListeCCOp[18]$}}&\Block{}{\ifboolKV[CalculsCroises]{Solution}{\num{\PfCListeCCOp[19]}}{\ifboolKV[CalculsCroises]{Aide}{% - \xintFor* ##1 in{\xintSeq{1}{\PfCListeCCAidelen}}\do{% - \xintifboolexpr{\PfCListeCCOp[19]==\PfCListeCCAide[##1]}{\num{\PfCListeCCOp[19]}}{}% - }% - }{}% -}}&\StrCompare{\PfCListeCCOp[20]}{*}[\PfCTestEtoile]\Block{}{\xintifboolexpr{\PfCTestEtoile==0}{$\times$}{$\PfCListeCCOp[20]$}}&\Block{}{\ifboolKV[CalculsCroises]{Solution}{\num{\PfCListeCCOp[21]}}{\ifboolKV[CalculsCroises]{Aide}{% - \xintFor* ##1 in{\xintSeq{1}{\PfCListeCCAidelen}}\do{% - \xintifboolexpr{\PfCListeCCOp[21]==\PfCListeCCAide[##1]}{\num{\PfCListeCCOp[21]}}{}% - }% - }{}% -}}&\Block[borders={bottom,right,top},fill=PfCCouleurCC]{}{\ifboolKV[CalculsCroises]{Inverse}{}{\num{\fpeval{\PfCListeCCOp[17]\PfCListeCCOp[18]\PfCListeCCOp[19]\PfCListeCCOp[20]\PfCListeCCOp[21]}}}}\\ - \rule{0pt}{\PfCCalculsCroises}\Block[borders={left,bottom,right},fill=PfCCouleurCC]{}{\ifboolKV[CalculsCroises]{Inverse}{}{\num{\fpeval{\PfCListeCCOp[1]\PfCListeCCOp[6]\PfCListeCCOp[9]\PfCListeCCOp[14]\PfCListeCCOp[17]}}}}&&\Block[borders={left,bottom,right},fill=PfCCouleurCC]{}{\ifboolKV[CalculsCroises]{Inverse}{}{\num{\fpeval{\PfCListeCCOp[3]\PfCListeCCOp[7]\PfCListeCCOp[11]\PfCListeCCOp[15]\PfCListeCCOp[19]}}}}&&\Block[borders={left,bottom,right},fill=PfCCouleurCC]{}{\ifboolKV[CalculsCroises]{Inverse}{}{\num{\fpeval{\PfCListeCCOp[5]\PfCListeCCOp[8]\PfCListeCCOp[13]\PfCListeCCOp[16]\PfCListeCCOp[21]}}}}\\ - \CodeAfter - \tikz\draw (1-|1) rectangle (6-|6); - \xintFor* ##1 in{\xintSeq{2}{5}}\do{% - \tikz\draw (1-|##1) -- (6-|##1); - }% - \xintFor* ##1 in{\xintSeq{2}{5}}\do{% - \tikz\draw (##1-|1) -- (##1-|6); - }% - \end{NiceTabular} - }% - }% - \restorecomparemode% + \end{NiceTabular} + \restorecomparemode% }% \ No newline at end of file diff --git a/macros/latex/contrib/profcollege/latex/PfCCalisson.tex b/macros/latex/contrib/profcollege/latex/PfCCalisson.tex index 08f3d91521..60c424bdff 100644 --- a/macros/latex/contrib/profcollege/latex/PfCCalisson.tex +++ b/macros/latex/contrib/profcollege/latex/PfCCalisson.tex @@ -56,47 +56,86 @@ }% }% }% - %Liste gauche : \the\tokcalissonlistetracesg% + % Liste gauche : \the\tokcalissonlistetracesg% +% \par Pour la droite, Il reste \Reste % Partie droite - \StrLeft{0\Reste}{3}[\Depart]% - \expandafter\UpdatetoksCalissondDepart\Depart\nil% - \StrGobbleLeft{0\Reste}{3}[\Reste]% - \xintFor* ##1 in {\xintSeq{1}{\fpeval{\useKV[Calisson]{Taille}-2}}}\do{% + \xintifboolexpr{\useKV[Calisson]{Taille}==2}{% + % 10 \StrLeft{0\Reste}{3}[\Depart]% - \expandafter\UpdatetoksCalissond\Depart\nil% + \expandafter\UpdatetoksCalissondDepart\Depart\nil% \StrGobbleLeft{0\Reste}{3}[\Reste]% - }% - \StrLeft{00\Reste}{3}[\Depart]% - \StrGobbleLeft{00\Reste}{3}[\Reste]% - \expandafter\UpdatetoksCalissond\Depart\nil% -% fin premiere ligne - \xintFor* ##1 in {\xintSeq{1}{\fpeval{\useKV[Calisson]{Taille}-1}}}\do{% + % 11 + \StrLeft{00\Reste}{3}[\Depart]% + \expandafter\UpdatetoksCalissond\Depart\nil% + \StrGobbleLeft{00\Reste}{3}[\Reste]% + % 12 \StrLeft{\Reste}{1}[\Depart]% - \expandafter\UpdatetoksCalissond\Depart00\nil% + \expandafter\UpdatetoksCalissond\Depart\nil% \StrGobbleLeft{\Reste}{1}[\Reste]% - \xintFor* ##2 in {\xintSeq{1}{\fpeval{\useKV[Calisson]{Taille}-1}}}\do{% - \StrLeft{\Reste}{3}[\Depart]% - \expandafter\UpdatetoksCalissond\Depart\nil% - \StrGobbleLeft{\Reste}{3}[\Reste]% - }% + % 13 + \StrLeft{\Reste}{3}[\Depart]% + \expandafter\UpdatetoksCalissond\Depart\nil% + \StrGobbleLeft{\Reste}{3}[\Reste]% + % 14 \StrLeft{00\Reste}{3}[\Depart]% \expandafter\UpdatetoksCalissond\Depart\nil% \StrGobbleLeft{00\Reste}{3}[\Reste]% - }% - %% fin des lignes intermédiaires - \xintFor* ##1 in {\xintSeq{1}{\fpeval{\useKV[Calisson]{Taille}}}}\do{% + % 15 \StrLeft{\Reste}{1}[\Depart]% - \expandafter\UpdatetoksCalissond\Depart00\nil% + \expandafter\UpdatetoksCalissond\Depart0\nil% \StrGobbleLeft{\Reste}{1}[\Reste]% - \xintifboolexpr{##1>\fpeval{\useKV[Calisson]{Taille}-1}}{}{% - \xintFor* ##2 in {\xintSeq{\fpeval{\useKV[Calisson]{Taille}-##1}}{1}}\do{% + % 16 + \StrLeft{\Reste}{3}[\Depart]% + \expandafter\UpdatetoksCalissond\Depart\nil% + \StrGobbleLeft{\Reste}{3}[\Reste]% + % 17 + \StrLeft{\Reste}{1}[\Depart]% + \expandafter\UpdatetoksCalissond\Depart00\nil% +% \StrGobbleLeft{\Reste}{2}[\Reste]% + }{% + \StrLeft{0\Reste}{3}[\Depart]% + \expandafter\UpdatetoksCalissondDepart\Depart\nil% + \StrGobbleLeft{0\Reste}{3}[\Reste]% + \xintFor* ##1 in {\xintSeq{1}{\fpeval{\useKV[Calisson]{Taille}-2}}}\do{% + \StrLeft{0\Reste}{3}[\Depart]% + \expandafter\UpdatetoksCalissond\Depart\nil% + \StrGobbleLeft{0\Reste}{3}[\Reste]% + }% + \StrLeft{00\Reste}{3}[\Depart]% + \StrGobbleLeft{00\Reste}{3}[\Reste]% + \expandafter\UpdatetoksCalissond\Depart\nil% + % \par A la première ligne : \the\tokcalissonlistetracesd + % fin premiere ligne + \StrLeft{0\Reste}{3}[\Depart]% + \xintFor* ##1 in {\xintSeq{1}{\fpeval{\useKV[Calisson]{Taille}-1}}}\do{% + \StrLeft{\Reste}{1}[\Depart]% + \expandafter\UpdatetoksCalissond\Depart00\nil% + \StrGobbleLeft{\Reste}{1}[\Reste]% + \xintFor* ##2 in {\xintSeq{1}{\fpeval{\useKV[Calisson]{Taille}-1}}}\do{% \StrLeft{\Reste}{3}[\Depart]% \expandafter\UpdatetoksCalissond\Depart\nil% \StrGobbleLeft{\Reste}{3}[\Reste]% }% + \StrLeft{00\Reste}{3}[\Depart]% + \expandafter\UpdatetoksCalissond\Depart\nil% + \StrGobbleLeft{00\Reste}{3}[\Reste]% + } + %% fin des lignes intermédiaires + \xintFor* ##1 in {\xintSeq{1}{\fpeval{\useKV[Calisson]{Taille}}}}\do{% + \StrLeft{\Reste}{1}[\Depart]% + \expandafter\UpdatetoksCalissond\Depart00\nil% + \StrGobbleLeft{\Reste}{1}[\Reste]% + \xintifboolexpr{##1>\fpeval{\useKV[Calisson]{Taille}-1}}{}{% + \xintFor* ##2 in {\xintSeq{\fpeval{\useKV[Calisson]{Taille}-##1}}{1}}\do{% + \StrLeft{\Reste}{3}[\Depart]% + \expandafter\UpdatetoksCalissond\Depart\nil% + \StrGobbleLeft{\Reste}{3}[\Reste]% + }% + }% }% }% -% \par Liste droite :\the\tokcalissonlistetracesd +% \par Liste droite :\the\tokcalissonlistetracesd\par + %\par Liste cp : \tokcalissonlistetracesd{"0ss",0f0","ftf","ssf","0ff","tt0","0sf","sfs"}\the\tokcalissonlistetracesd\par \BuildCalisson{\the\tokcalissonlistetracesg}{\the\tokcalissonlistetracesd}% }% @@ -109,7 +148,7 @@ % Rayon=\useKV[Calisson]{Rayon}; Taille=\useKV[Calisson]{Taille}; - % + % pair A,B,C,D,E,F,O; O=(0,0); path cc; @@ -127,8 +166,8 @@ Bas=A--B--C; TopGauche=E--F--A; BasDroit=D--C--B; - % - pair Hor,Ver,Horn; + % + pair Hor,Ver,Horn,Retenir; Hor=(1/Taille)[E,F]; Ver=rotation(Hor,E,60); Horn=rotation(Hor,E,120); @@ -140,36 +179,37 @@ for l=0 upto Taille: n:=n+1; M[n]=E+k*(Ver-E)+l*(Hor-E); - % dotlabel.top(decimal(n),M[n]); + %dotlabel.top(decimal(n),M[n]); endfor; endfor; for k=Taille upto 2*Taille-1: for l=0 upto (2*Taille-1-k): n:=n+1; M[n]=E+k*(Ver-E)+l*(Hor-E); - % dotlabel.top(decimal(n),M[n]); + %dotlabel.top(decimal(n),M[n]); endfor; endfor; % Partie Droite -> ok for k=1 upto Taille: n:=n+1; M[n]=E+k*(Horn-E); - % dotlabel.top(decimal(n),M[n]); +% dotlabel.top(decimal(n),M[n]); endfor; for k=1 upto Taille-1: for l=0 upto Taille: n:=n+1; M[n]=E+k*(Ver-E)+l*(Horn-E); - % dotlabel.top(decimal(n),M[n]); +% dotlabel.top(decimal(n),M[n]); endfor; endfor; for k=Taille upto 2*Taille-1: for l=0 upto (2*Taille-1-k): n:=n+1; M[n]=E+k*(Ver-E)+l*(Horn-E); - % dotlabel.top(decimal(n),M[n]); + %dotlabel.top(decimal(n),M[n]); endfor; endfor; + drawoptions(); % % string Retiens; @@ -177,7 +217,7 @@ % pair Depla; Depla:=Hor; - % + % vardef LesTracesg(text t)= trace polygone(A,B,C,D,E,F) withpen pencircle scaled 2; for k=1 upto 2*Taille-1: @@ -207,6 +247,11 @@ enddef; % vardef LesTracesd(text t)= + %if Taille=2: + %Hor:=(1/Taille)[E,F]; + %Ver:=rotation(Hor,E,60); + %Horn:=rotation(Hor,E,120); + %fi; for p_=t: n:=n+1; for d=1 upto 3: @@ -215,6 +260,7 @@ elseif d=2:Depla:=Ver else : Depla:=Hor fi; +% fill ((fullcircle scaled 3mm) shifted M[n]); if (Retiens="0") or (Retiens="f"): elseif Retiens="t": trace (chemin(Depla,E) shifted (M[n]-E)) withpen pencircle scaled 2; diff --git a/macros/latex/contrib/profcollege/latex/PfCCartographie.tex b/macros/latex/contrib/profcollege/latex/PfCCartographie.tex index fdfa7cd0a5..a2bccc2321 100644 --- a/macros/latex/contrib/profcollege/latex/PfCCartographie.tex +++ b/macros/latex/contrib/profcollege/latex/PfCCartographie.tex @@ -1,10 +1,11 @@ %%% % Cartographie %%% -\setKVdefault[Cartographie]{Echelle=1,Carte=false,All=false,Europe=false,Asie=false,Amsud=false,Amnord=false,Amcentre=false,Caraibes=false,Afrique=false,AfficheEchelle=false,PaysSeul=false,VillesSup=false,Capitales=false,Impression=false,Fleuves=false,CouleurFond=ciel,Largeur=12,Hauteur=12,Arborescence="/usr/local/texlive/2023/texmf-dist/metapost/profcollege/",Projection=false,TypeProjection="mercator",CouleurPays=Cornsilk,Pasl=2,PasL=2} +\setKVdefault[Cartographie]{Echelle=1,Carte=false,All=false,Europe=false,Asie=false,Amsud=false,Amnord=false,Amcentre=false,Caraibes=false,Afrique=false,AfficheEchelle=false,PaysSeul=false,VillesSup=false,Capitales=false,Impression=false,Fleuves=false,CouleurFond=ciel,Largeur=12,Hauteur=12,Arborescence="/usr/local/texlive/2023/texmf-dist/metapost/profcollege/",Projection=false,TypeProjection="mercator",CouleurPays=Cornsilk,Pasl=2,PasL=2,Codes=false,Epaisseur=2} \defKV[Cartographie]{EchelleCarte=\setKV[Cartographie]{Carte}} \defKV[Cartographie]{Pays=\setKV[Cartographie]{PaysSeul}} \defKV[Cartographie]{Villes=\setKV[Cartographie]{VillesSup}} +\defKV[Cartographie]{Traces=\setKV[Cartographie]{Codes}} \newcommand\Cartographie[3][]{% \ifluatex% @@ -138,18 +139,20 @@ arborescence:=\useKV[Cartographie]{Arborescence}; LargeurCadre=\useKV[Cartographie]{Largeur}; HauteurCadre=\useKV[Cartographie]{Hauteur}; + Epaisseur:=\useKV[Cartographie]{Epaisseur}; distanceecran=100*\useKV[Cartographie]{Echelle}; fleuves:=\useKV[Cartographie]{Fleuves}; - boolean Carte,Impression,VillesSup; + boolean Carte,Impression,VillesSup,Codes; Carte=\useKV[Cartographie]{Carte}; Impression=\useKV[Cartographie]{Impression}; VillesSup=\useKV[Cartographie]{VillesSup}; + Codes=\useKV[Cartographie]{Codes}; couleurfond:=\useKV[Cartographie]{CouleurFond}; if Impression: - noncolore:=true; - payscolor:=0.85white; - couleurfond:=white; - couleurfleuve:=couleurfond; + noncolore:=true; + payscolor:=0.85white; + couleurfond:=white; + couleurfleuve:=couleurfond; fi; capitales:=\useKV[Cartographie]{Capitales}; All:=\useKV[Cartographie]{All}; @@ -161,48 +164,52 @@ Caraibes:=\useKV[Cartographie]{Caraibes}; Afrique:=\useKV[Cartographie]{Afrique}; if Carte: - Echelle:=\useKV[Cartographie]{AfficheEchelle}; - figure(-0.5u*LargeurCadre,-0.5u*HauteurCadre,0.5u*LargeurCadre,0.5u*HauteurCadre); - if \useKV[Cartographie]{PaysSeul}: - projection:="bonne"; - theta:=#2; - phi:=#3; - zoom(echelle(#2,#3,\useKV[Cartographie]{EchelleCarte})); - fill (bonnec(-90,-180) for k=-85 step 5 until 90:..bonnec(k,-180) endfor)..reverse(bonnec(-90,180) for k=-85 step 5 until 90:..bonnec(k,180) endfor)..cycle withcolor couleurfond; - lecturep(arborescence&"PfC"&\useKV[Cartographie]{Pays}&".dat",couleurfond);% - trace feuillet withpen pencircle scaled 2; - if Echelle=true: - draw ((Xa,Ya)+u*(1,1))--((Xa,Ya)+u*(2,1)); - labeloffset:=labeloffset*1.5; - label.top(btex 0 etex,(Xa,Ya)+u*(1,1)); - label.top(TEX(""&decimal(Long)&"~km"),(Xa,Ya)+u*(2,1)); - labeloffset:=labeloffset/1.5; - draw ((Xa,Ya)+u*(1,1.1))--((Xa,Ya)+u*(1,0.9)); - draw (((Xa,Ya)+u*(1,1.1))--((Xa,Ya)+u*(1,0.9))) shifted(u*(1,0)); - fi; - else: - projection:="bonne"; - Projection(#2,#3,echelle(#2,#3,\useKV[Cartographie]{EchelleCarte})); - trace feuillet withpen pencircle scaled 2; - fi; - if VillesSup: - nomfichiermul:=\useKV[Cartographie]{Villes}; - nblec:=scantokens readfrom nomfichiermul; - drawoptions(withcolor (0.15,0.15,0.15)); - projection:="bonne"; - for p=1 upto nblec: - pair Coord[],latlon;string p_; - latlon=scantokens readfrom nomfichiermul; - p_=scantokens readfrom nomfichiermul; - Coord[p]=bonnec(ypart(latlon),xpart(latlon)); - dotlabel.scantokens readfrom nomfichiermul(TEX(""&p_&""),Coord[p]); - endfor; - drawoptions(); - closefrom nomfichiermul; - fi; + Echelle:=\useKV[Cartographie]{AfficheEchelle}; + figure(-0.5u*LargeurCadre,-0.5u*HauteurCadre,0.5u*LargeurCadre,0.5u*HauteurCadre); + if \useKV[Cartographie]{PaysSeul}: + projection:="bonne"; + theta:=#2; + phi:=#3; + zoom(echelle(#2,#3,\useKV[Cartographie]{EchelleCarte})); + fill (bonnec(-90,-180) for k=-85 step 5 until 90:..bonnec(k,-180) endfor)..reverse(bonnec(-90,180) for k=-85 step 5 until 90:..bonnec(k,180) endfor)..cycle withcolor couleurfond; + lecturep(arborescence&"PfC"&\useKV[Cartographie]{Pays}&".dat",couleurfond);% + if Echelle=true: + draw ((Xa,Ya)+u*(1,1))--((Xa,Ya)+u*(2,1)); + labeloffset:=labeloffset*1.5; + label.top(btex 0 etex,(Xa,Ya)+u*(1,1)); + label.top(TEX(""&decimal(Long)&"~km"),(Xa,Ya)+u*(2,1)); + labeloffset:=labeloffset/1.5; + draw ((Xa,Ya)+u*(1,1.1))--((Xa,Ya)+u*(1,0.9)); + draw (((Xa,Ya)+u*(1,1.1))--((Xa,Ya)+u*(1,0.9))) shifted(u*(1,0)); + fi; + else: + projection:="bonne"; + Projection(#2,#3,echelle(#2,#3,\useKV[Cartographie]{EchelleCarte})); + fi; + if Epaisseur>0: + trace feuillet withpen pencircle scaled Epaisseur; + fi; + if VillesSup: + nomfichiermul:=\useKV[Cartographie]{Villes}; + nblec:=scantokens readfrom nomfichiermul; + drawoptions(withcolor (0.15,0.15,0.15)); + projection:="bonne"; + for p=1 upto nblec: + pair Coord[],latlon;string p_; + latlon=scantokens readfrom nomfichiermul; + p_=scantokens readfrom nomfichiermul; + Coord[p]=bonnec(ypart(latlon),xpart(latlon)); + dotlabel.scantokens readfrom nomfichiermul(TEX(""&p_&""),Coord[p]); + endfor; + drawoptions(); + closefrom nomfichiermul; + fi; + if Codes: + \useKV[Cartographie]{Traces}; + fi; else: - draw(0,0)--(50,50); - mappemonde(#2,#3); + draw(0,0)--(50,50); + mappemonde(#2,#3); fi; \end{mplibcode} } diff --git a/macros/latex/contrib/profcollege/latex/PfCDecomposerNombrePremier.tex b/macros/latex/contrib/profcollege/latex/PfCDecomposerNombrePremier.tex index a70b818b25..253f12533d 100644 --- a/macros/latex/contrib/profcollege/latex/PfCDecomposerNombrePremier.tex +++ b/macros/latex/contrib/profcollege/latex/PfCDecomposerNombrePremier.tex @@ -57,6 +57,7 @@ endfor; fi; \end{mplibcode} + \mplibnumbersystem{scaled} \else \begin{mpost}[mpsettings={numeric decalage;decalage=\useKV[ClesNombrePremier]{Decalage}*1mm; boolean Entoure; Entoure=\useKV[ClesNombrePremier]{Entoure};}] input PfCArithmetique; @@ -103,7 +104,8 @@ if \useKV[ClesNombrePremier]{Entoure}: draw polygone(N[nbe-1][0]+(-0.25*dx,0.25*decalage),N[nbe-1][nbe-1]+(0.25*dx,0.25*decalage),N[nbe-1][nbe-1]+(0.25*dx,-0.25*decalage),N[nbe-1][0]+(-0.25*dx,-0.25*decalage)) dashed evenly; fi; - \end{mplibcode} +\end{mplibcode} + \mplibnumbersystem{scaled} \else \begin{mpost}[mpsettings={numeric decalage;decalage=\useKV[ClesNombrePremier]{Decalage}*1mm;}] input PfCArithmetique; @@ -138,6 +140,7 @@ PositionsVide(NbEtape(#1)); \end{mplibcode} + \mplibnumbersystem{scaled} \else \begin{mpost}[mpsettings={numeric decalage; decalage=\useKV[ClesNombrePremier]{Decalage}*1mm;}] input PfCArithmetique; @@ -258,6 +261,7 @@ trace feuillage; draw Bilan; \end{mplibcode} + \mplibnumbersystem{scaled} \else \begin{mpost}[mpsettings={numeric decalage;decalage=\useKV[ClesNombrePremier]{Decalage}*1mm;color CouleurTronc,CouleurFeuillage,CouleurFruits,CouleurTexte;CouleurTronc=\useKV[ClesNombrePremier]{CouleurTronc};CouleurFeuillage=\useKV[ClesNombrePremier]{CouleurFeuillage};CouleurFruits=\useKV[ClesNombrePremier]{CouleurFruits}; CouleurTexte=\useKV[ClesNombrePremier]{CouleurTexte}; boolean Vide; Vide=\useKV[ClesNombrePremier]{Vide};}] input PfCArithmetiquePDF; diff --git a/macros/latex/contrib/profcollege/latex/PfCDistributivite.tex b/macros/latex/contrib/profcollege/latex/PfCDistributivite.tex index b0d60d14e8..272e260d0a 100644 --- a/macros/latex/contrib/profcollege/latex/PfCDistributivite.tex +++ b/macros/latex/contrib/profcollege/latex/PfCDistributivite.tex @@ -995,9 +995,9 @@ \xintifboolexpr{\Multij==0}{}{\xintifboolexpr{\Multi==0}{}{+}\xintifboolexpr{\Multij<0}{(}{}\AffichageEchange{\Multij}{0}{0}\xintifboolexpr{\Multij<0}{)}{}}% \xintifboolexpr{\Multik==0}{}{\xintifboolexpr{\Multil==0}{\xintifboolexpr{#2=0}{}{+}}{+}\xintifboolexpr{\Multik<0}{(}{}\AffichageEchange{0}{0}{\Multik}\xintifboolexpr{\Multik<0}{)}{}}% \xintifboolexpr{\Multil==0}{}{+}\xintifboolexpr{\Multil<0}{(}{}\AffichageEchange{0}{\Multil}{0}\xintifboolexpr{\Multil<0}{)}{}% - \xdef\Multim{\fpeval{#2*#4+#3*#5}}% + \xdef\Multim{\fpeval{#2*#4+#3*#5}}% \ifboolKV[ClesDistributivite]{Somme}{\xdef\SommeA{\fpeval{\SommeA+\Multik}}\xdef\SommeB{\fpeval{\SommeB+\Multim}}\xdef\SommeC{\fpeval{\SommeC+\Multij}}}{}% - \ifboolKV[ClesDistributivite]{Difference}{\xdef\SommeA{\fpeval{\SommeA-\Multik}}\xdef\SommeB{\fpeval{\SommeB-\Multim}}\xdef\SommeC{\fpeval{\SommeC-\Multij}}}{}% + \ifboolKV[ClesDistributivite]{Difference}{\xdef\SommeA{\fpeval{\SommeA-\Multik}}\xdef\SommeB{\fpeval{\SommeB-\Multim}}\xdef\SommeC{\fpeval{\SommeC-\Multij}}}{}% }{}% \xintifboolexpr{\useKV[ClesDistributivite]{Echange}==2}{% \xintifboolexpr{\theNbCalculDistri>1}{\xintifboolexpr{\Multi<0}{(\AffichageEchange{0}{\Multi}{0})}{\AffichageEchange{0}{\Multi}{0}}}{\AffichageEchange{0}{\Multi}{0}}% diff --git a/macros/latex/contrib/profcollege/latex/PfCDomino.tex b/macros/latex/contrib/profcollege/latex/PfCDomino.tex index e0e8fbd417..a21e068e56 100644 --- a/macros/latex/contrib/profcollege/latex/PfCDomino.tex +++ b/macros/latex/contrib/profcollege/latex/PfCDomino.tex @@ -94,7 +94,7 @@ \end{MyDominoMini}% }{% \begin{MyDominoMini}[sidebyside,sidebyside gap=4mm,righthand ratio=\ratiodomino]% - \ListeDominos[\i,1]\tcblower\ListeDominos[\i,2]% + \ListeDominos[\i,1]\tcblower\ListeDominos[\i,2]% \end{MyDominoMini}% }% }; @@ -120,7 +120,7 @@ }{% \begin{MyDominoMini}[sidebyside,sidebyside gap=4mm,righthand ratio=\ratiodomino]% \ListeDominos[1,1]\tcblower% - \ListeDominos[1,2]% + \ListeDominos[1,2]% \end{MyDominoMini}% }% }% diff --git a/macros/latex/contrib/profcollege/latex/PfCEcrireQCMold.tex b/macros/latex/contrib/profcollege/latex/PfCEcrireQCMold.tex deleted file mode 100644 index a7d4622f5f..0000000000 --- a/macros/latex/contrib/profcollege/latex/PfCEcrireQCMold.tex +++ /dev/null @@ -1,148 +0,0 @@ -%%% -% QCM -%%% -\setKVdefault[ClesQCM]{Reponses=3,Solution=false,Stretch=1,Largeur=2cm,Couleur=gray!15,Titre=false,Nom=R\'eponse,NomV=Vrai,NomF=Faux,Alph=false,AlphT=false,VF=false,Depart=1,Alterne=false,Noms={A/B/C},Multiple=false,Parties={Yeux,Nez,Bouche}}% -\newlength{\LargeurQCM}% -\newlength{\PfCLargeurQCM}% -\newcounter{QuestionQCM}% -\newcounter{TitreQCM}% -\ifdef{\QCM}{% - \PackageWarning{ProfCollege}{La commande \noexpand\QCM étant définie par la classe du document, ProfCollege modifie sa commande \noexpand\QCM en \noexpand\QCMPfC.}% - \newcommand\QCMPfC[2][]{% - \useKVdefault[ClesQCM]% - \setKV[ClesQCM]{#1}% - \setcounter{QuestionQCM}{\fpeval{\useKV[ClesQCM]{Depart}-1}}% - \setcounter{TitreQCM}{0} - \setsepchar[*]{§*&}\ignoreemptyitems% - \readlist*\ListeQCM{#2}% - \ifboolKV[ClesQCM]{Multiple}{% - \renewcommand{\arraystretch}{\useKV[ClesQCM]{Stretch}}% - \setlength{\LargeurQCM}{\fpeval{(\linewidth-\useKV[ClesQCM]{Reponses}*(3*\tabcolsep+\useKV[ClesQCM]{Largeur}))}pt}% - \xdef\NBcases{\fpeval{\useKV[ClesQCM]{Reponses}+1}}% - \xdef\ListeNom{\useKV[ClesQCM]{Noms}}% - \setsepchar[*]{/}% - \readlist*\ListeNomsMul{\ListeNom}% - \begin{tabular}{|p{\LargeurQCM}|*{\useKV[ClesQCM]{Reponses}}{>{\centering\arraybackslash}p{\useKV[ClesQCM]{Largeur}}|}}% - \cline{2-\NBcases}% - \multicolumn{1}{c|}{}\xintFor* ##2 in {\xintSeq {1}{\useKV[ClesQCM]{Reponses}}}\do{% - &\ListeNomsMul[##2]}% - \\ - \hline% - \xintFor* ##1 in {\xintSeq {1}{\ListeQCMlen}}\do{% - \stepcounter{QuestionQCM}\ifboolKV[ClesQCM]{Alterne}{\modulo{\theQuestionQCM}{2}\ifnum\remainder=0\cellcolor{gray!15}\fi}{}\ifboolKV[ClesQCM]{Alph}{\textbf{\Alph{QuestionQCM}}/}{\textbf{\theQuestionQCM/}}~\ListeQCM[##1,1]\xintFor* ##2 in {\xintSeq {1}{\useKV[ClesQCM]{Reponses}}}\do{% - &\ifboolKV[ClesQCM]{Alterne}{\modulo{\theQuestionQCM}{2}\ifnum\remainder=0\cellcolor{gray!15}\fi}{}\ifboolKV[ClesQCM]{Solution}{\xintifboolexpr{\ListeQCM[##1,\fpeval{##2+1}]==1}{$\boxtimes$}{$\square$}}{$\square$}% - }\\ - }% - \hline% - \end{tabular}% - }{% - \ifboolKV[ClesQCM]{VF}{% - \setKV[ClesQCM]{Reponses=2}% - \setlength{\PfCLargeurQCM}{\useKV[ClesQCM]{Largeur}}% - \setlength{\LargeurQCM}{\linewidth-6\tabcolsep-2\PfCLargeurQCM-4\arrayrulewidth}% - \renewcommand{\arraystretch}{\useKV[ClesQCM]{Stretch}}% - \setlength{\LargeurQCM}{\fpeval{(\linewidth-\useKV[ClesQCM]{Reponses}*(3*\tabcolsep+\useKV[ClesQCM]{Largeur}))}pt}% - \xdef\NBcases{\fpeval{\useKV[ClesQCM]{Reponses}+1}}% - \begin{tabular}{|p{\LargeurQCM}|*{\useKV[ClesQCM]{Reponses}}{>{\centering\arraybackslash}p{\useKV[ClesQCM]{Largeur}}|}}% - \cline{2-\NBcases}% - \multicolumn{1}{c|}{}&\useKV[ClesQCM]{NomV}&\useKV[ClesQCM]{NomF}\\ - \hline% - \xintFor* ##1 in {\xintSeq {1}{\ListeQCMlen}}\do{% - \stepcounter{QuestionQCM}\ifboolKV[ClesQCM]{Alterne}{\modulo{\theQuestionQCM}{2}\ifnum\remainder=0\cellcolor{gray!15}\fi}{}\ifboolKV[ClesQCM]{Alph}{\textbf{\Alph{QuestionQCM}}/}{\textbf{\theQuestionQCM/}}~\ListeQCM[##1,1]\xintFor* ##2 in {\xintSeq {1}{\useKV[ClesQCM]{Reponses}}}\do{% - &\ifboolKV[ClesQCM]{Alterne}{\modulo{\theQuestionQCM}{2}\ifnum\remainder=0\cellcolor{gray!15}\fi}{}\ifboolKV[ClesQCM]{Solution}{\xintifboolexpr{##2==\ListeQCM[##1,2]}{$\boxtimes$}{$\square$}}{$\square$}% - }\\ - }% - \hline% - \end{tabular} - }{% - \renewcommand{\arraystretch}{\useKV[ClesQCM]{Stretch}}% - \setlength{\LargeurQCM}{\fpeval{(\linewidth-\useKV[ClesQCM]{Reponses}*(3*\tabcolsep+\useKV[ClesQCM]{Largeur}))}pt}% - \xdef\NBcases{\fpeval{\useKV[ClesQCM]{Reponses}+1}}% - \begin{tabular}{|p{\LargeurQCM}|*{\useKV[ClesQCM]{Reponses}}{>{\centering\arraybackslash}p{\useKV[ClesQCM]{Largeur}}|}}% - \ifboolKV[ClesQCM]{Titre}{\cline{2-\NBcases}% - \multicolumn{1}{c|}{}\xintFor* ##2 in {\xintSeq {1}{\useKV[ClesQCM]{Reponses}}}\do{% - &\stepcounter{TitreQCM}\useKV[ClesQCM]{Nom} \ifboolKV[ClesQCM]{AlphT}{\Alph{TitreQCM}}{##2}}% - \\ - }{} - \hline% - \xintFor* ##1 in {\xintSeq {1}{\ListeQCMlen}}\do{% - \stepcounter{QuestionQCM}\ifboolKV[ClesQCM]{Alterne}{\modulo{\theQuestionQCM}{2}\ifnum\remainder=0\cellcolor{gray!15}\fi}{}\ifboolKV[ClesQCM]{Alph}{\textbf{\Alph{QuestionQCM}}/}{\textbf{\theQuestionQCM/}}~\ListeQCM[##1,1]\xintFor* ##2 in {\xintSeq {1}{\useKV[ClesQCM]{Reponses}}}\do{% - &\ifboolKV[ClesQCM]{Alterne}{\modulo{\theQuestionQCM}{2}\ifnum\remainder=0\cellcolor{gray!15}\fi}{}\ifboolKV[ClesQCM]{Solution}{\xdef\NumeroReponse{\fpeval{\useKV[ClesQCM]{Reponses}+2}}\xintifboolexpr{##2==\ListeQCM[##1,\NumeroReponse]}{\cellcolor{\useKV[ClesQCM]{Couleur}}}{}}{}\ListeQCM[##1,##2+1]% - }\\ - }% - \hline% - \end{tabular}% - }% - }% - \renewcommand{\arraystretch}{1}% - }% -}{% - \NewDocumentCommand\QCM{om}{% - \useKVdefault[ClesQCM]% - \setKV[ClesQCM]{#1}% - \setcounter{QuestionQCM}{\fpeval{\useKV[ClesQCM]{Depart}-1}}% - \setcounter{TitreQCM}{0} - \setsepchar[*]{,*&}\ignoreemptyitems% - \readlist*\ListeQCM{#2}% - \ifboolKV[ClesQCM]{Multiple}{% - \renewcommand{\arraystretch}{\useKV[ClesQCM]{Stretch}}% - \setlength{\LargeurQCM}{\fpeval{(\linewidth-\useKV[ClesQCM]{Reponses}*(3*\tabcolsep+\useKV[ClesQCM]{Largeur}))}pt}% - \xdef\NBcases{\fpeval{\useKV[ClesQCM]{Reponses}+1}}% - \xdef\ListeNom{\useKV[ClesQCM]{Noms}}% - \setsepchar[*]{/}% - \readlist*\ListeNomsMul{\ListeNom}% - \begin{tabular}{|p{\LargeurQCM}|*{\useKV[ClesQCM]{Reponses}}{>{\centering\arraybackslash}p{\useKV[ClesQCM]{Largeur}}|}}% - \cline{2-\NBcases}% - \multicolumn{1}{c|}{}\xintFor* ##2 in {\xintSeq {1}{\useKV[ClesQCM]{Reponses}}}\do{% - &\ListeNomsMul[##2]}% - \\ - \hline% - \xintFor* ##1 in {\xintSeq {1}{\ListeQCMlen}}\do{% - \stepcounter{QuestionQCM}\ifboolKV[ClesQCM]{Alterne}{\modulo{\theQuestionQCM}{2}\ifnum\remainder=0\cellcolor{gray!15}\fi}{}\ifboolKV[ClesQCM]{Alph}{\textbf{\Alph{QuestionQCM}}/}{\textbf{\theQuestionQCM/}}~\ListeQCM[##1,1]\xintFor* ##2 in {\xintSeq {1}{\useKV[ClesQCM]{Reponses}}}\do{% - &\ifboolKV[ClesQCM]{Alterne}{\modulo{\theQuestionQCM}{2}\ifnum\remainder=0\cellcolor{gray!15}\fi}{}\ifboolKV[ClesQCM]{Solution}{\xintifboolexpr{\ListeQCM[##1,\fpeval{##2+1}]==1}{$\boxtimes$}{$\square$}}{$\square$}% - }\\ - }% - \hline% - \end{tabular}% - \renewcommand{\arraystretch}{1}% - }{% - \ifboolKV[ClesQCM]{VF}{% - \setKV[ClesQCM]{Reponses=2}% - \renewcommand{\arraystretch}{\useKV[ClesQCM]{Stretch}}% - \setlength{\PfCLargeurQCM}{\useKV[ClesQCM]{Largeur}}% - \setlength{\LargeurQCM}{\linewidth-6\tabcolsep-2\PfCLargeurQCM-4\arrayrulewidth}% - \xdef\NBcases{\fpeval{\useKV[ClesQCM]{Reponses}+1}}% - \begin{tabular}{|p{\LargeurQCM}|*{\useKV[ClesQCM]{Reponses}}{>{\centering\arraybackslash}p{\useKV[ClesQCM]{Largeur}}|}}% - \cline{2-\NBcases}% - \multicolumn{1}{c|}{}&\useKV[ClesQCM]{NomV}&\useKV[ClesQCM]{NomF}\\ - \hline% - \xintFor* ##1 in {\xintSeq {1}{\ListeQCMlen}}\do{% - \stepcounter{QuestionQCM}\ifboolKV[ClesQCM]{Alterne}{\modulo{\theQuestionQCM}{2}\ifnum\remainder=0\cellcolor{gray!15}\fi}{}\ifboolKV[ClesQCM]{Alph}{\textbf{\Alph{QuestionQCM}}/}{\textbf{\theQuestionQCM/}}~\ListeQCM[##1,1]\xintFor* ##2 in {\xintSeq {1}{\useKV[ClesQCM]{Reponses}}}\do{% - &\ifboolKV[ClesQCM]{Alterne}{\modulo{\theQuestionQCM}{2}\ifnum\remainder=0\cellcolor{gray!15}\fi}{}\ifboolKV[ClesQCM]{Solution}{\xintifboolexpr{##2==\ListeQCM[##1,2]}{$\boxtimes$}{$\square$}}{$\square$}% - }\\ - }% - \hline% - \end{tabular} - }{% - \renewcommand{\arraystretch}{\useKV[ClesQCM]{Stretch}}% - \setlength{\LargeurQCM}{\fpeval{(\linewidth-\useKV[ClesQCM]{Reponses}*(3*\tabcolsep+\useKV[ClesQCM]{Largeur}))}pt}% - \xdef\NBcases{\fpeval{\useKV[ClesQCM]{Reponses}+1}}% - \begin{tabular}{|p{\LargeurQCM}|*{\useKV[ClesQCM]{Reponses}}{>{\centering\arraybackslash}p{\useKV[ClesQCM]{Largeur}}|}}% - \ifboolKV[ClesQCM]{Titre}{\cline{2-\NBcases}% - \multicolumn{1}{c|}{}\xintFor* ##2 in {\xintSeq {1}{\useKV[ClesQCM]{Reponses}}}\do{% - &\stepcounter{TitreQCM}\useKV[ClesQCM]{Nom} \ifboolKV[ClesQCM]{AlphT}{\Alph{TitreQCM}}{##2}}% - \\ - }{} - \hline% - \xintFor* ##1 in {\xintSeq {1}{\ListeQCMlen}}\do{% - \stepcounter{QuestionQCM}\ifboolKV[ClesQCM]{Alterne}{\modulo{\theQuestionQCM}{2}\ifnum\remainder=0\cellcolor{gray!15}\fi}{}\ifboolKV[ClesQCM]{Alph}{\textbf{\Alph{QuestionQCM}}/}{\textbf{\theQuestionQCM/}}~\ListeQCM[##1,1]\xintFor* ##2 in {\xintSeq {1}{\useKV[ClesQCM]{Reponses}}}\do{% - &\ifboolKV[ClesQCM]{Alterne}{\modulo{\theQuestionQCM}{2}\ifnum\remainder=0\cellcolor{gray!15}\fi}{}\ifboolKV[ClesQCM]{Solution}{\xdef\NumeroReponse{\fpeval{\useKV[ClesQCM]{Reponses}+2}}\xintifboolexpr{##2==\ListeQCM[##1,\NumeroReponse]}{\cellcolor{\useKV[ClesQCM]{Couleur}}}{}}{}\ListeQCM[##1,##2+1]% - }\\ - }% - \hline% - \end{tabular}% - }% - }% - \renewcommand{\arraystretch}{1}% - }% -}% \ No newline at end of file diff --git a/macros/latex/contrib/profcollege/latex/PfCEcritureUnites.tex b/macros/latex/contrib/profcollege/latex/PfCEcritureUnites.tex index c4b19598fb..ecb975ff3b 100644 --- a/macros/latex/contrib/profcollege/latex/PfCEcritureUnites.tex +++ b/macros/latex/contrib/profcollege/latex/PfCEcritureUnites.tex @@ -52,7 +52,7 @@ \SI{#3}{\jour}% }{% \setlength{\PfCLgUnites}{\useKV[Unites]{Dots}}% - \pointilles[\PfCLgUnites]\,\si{\jour}}% + \pointilles[\PfCLgUnites]\,\si{\jour}}% \IfNoValueF{#4}{\,}% }% }% diff --git a/macros/latex/contrib/profcollege/latex/PfCEngrenagesBase.tex b/macros/latex/contrib/profcollege/latex/PfCEngrenagesBase.tex index 68e7bdbea4..86d323139e 100644 --- a/macros/latex/contrib/profcollege/latex/PfCEngrenagesBase.tex +++ b/macros/latex/contrib/profcollege/latex/PfCEngrenagesBase.tex @@ -24,7 +24,7 @@ \def\BuildEngrenagesCode#1{% u:=\useKV[Engrenages]{Unite}; CouleurEngrenage=\useKV[Engrenages]{Couleur}; - % + % vardef LectureDonnees(text t)= n:=0;k=0;l=0; for p_=t: @@ -38,7 +38,7 @@ fi; endfor; enddef; - % + % LectureDonnees(#1); % pair K; @@ -48,7 +48,7 @@ trace Engrenage(Mm[1],Zz[1],(0,0)); % Signe=1; - % + % for w=2 upto (n div 2): K:=K+pointarc(cercles((0,0),u*Mm[w]*(Zz[w-1]+Zz[w])*0.5+0.04*u),0); AngleRot[w]:=360/(2*Zz[w]); diff --git a/macros/latex/contrib/profcollege/latex/PfCErathostene.tex b/macros/latex/contrib/profcollege/latex/PfCErathostene.tex index 983770d0f9..2924d856d5 100644 --- a/macros/latex/contrib/profcollege/latex/PfCErathostene.tex +++ b/macros/latex/contrib/profcollege/latex/PfCErathostene.tex @@ -69,7 +69,7 @@ }{%Le nombre choisi n'est pas un nombre premier, ses multiples ont déjà étaient criblés. }% }% - }% + }% \Body \xintFor* ##1 in{\xintSeq{0}{\fpeval{\useKV[ClesEra]{Lignes}-1}}}\do{% \xintFor* ##2 in{\xintSeq{1}{\useKV[ClesEra]{Colonnes}}}\do{% diff --git a/macros/latex/contrib/profcollege/latex/PfCLabyrintheNombre.tex b/macros/latex/contrib/profcollege/latex/PfCLabyrintheNombre.tex index be5e05d673..509ca1d200 100644 --- a/macros/latex/contrib/profcollege/latex/PfCLabyrintheNombre.tex +++ b/macros/latex/contrib/profcollege/latex/PfCLabyrintheNombre.tex @@ -203,6 +203,7 @@ Corps:=(Corps scaled \useKV[ClesLabyNb]{Echelle}) rotated \useKV[ClesLabyNb]{Angle}; trace Corps; \end{mplibcode} +\mplibnumbersystem{scaled} \fi } diff --git a/macros/latex/contrib/profcollege/latex/PfCMulArt.tex b/macros/latex/contrib/profcollege/latex/PfCMulArt.tex new file mode 100644 index 0000000000..601d6e52f1 --- /dev/null +++ b/macros/latex/contrib/profcollege/latex/PfCMulArt.tex @@ -0,0 +1,472 @@ +%%% +% Mulart +%%% +\setKVdefault[TabMul]{Multiple=2,Cibles=false,Largeur=20pt,Couleurs=false,Graines=false,Operations=false,Enonce=false,SchemaEnonce=false} +\defKV[TabMul]{Couleur=\setKV[TabMul]{Couleurs}} +\defKV[TabMul]{Graine=\setKV[TabMul]{Graines}\PfCGraineAlea{#1}} +\defKV[TabMul]{Cible=\setKV[TabMul]{Cibles}}% + +\newtoks\tokstabmul +\newtoks\tokstabmulpdts +\newtoks\tokstabmulnonpdts +\newtoks\tokstabmulpdtscible +\def\UpdatetoksTabMul#1\nil{\addtotok\tokstabmul{"#1",}}% +\def\UpdatetoksTabMulPdts#1\nil{\addtotok\tokstabmulpdts{"#1",}}% +\def\UpdatetoksTabMulNonPdts#1\nil{\addtotok\tokstabmulnonpdts{"#1",}}% +\def\UpdatetoksTabMulPdtsCible#1\nil{\addtotok\tokstabmulpdtscible{"#1",}}% + +\NewDocumentCommand\TableauMultiplicatif{om}{% + \useKVdefault[TabMul]% + \setKV[TabMul]{#1}% + \setsepchar{,}\ignoreemptyitems% + \readlist*\PfCListeTabMul{#2}% + \reademptyitems% + \StrLen{\PfCListeTabMul[1]}[\TailleTabMul]% + \tokstabmul{}% + \foreachitem\compteur\in\PfCListeTabMul{\expandafter\UpdatetoksTabMul\compteur\nil}% + \savecomparemode% + \comparestrict% + \ifboolKV[TabMul]{Cibles}{% + \tokstabmulpdtscible{}% + \xdef\PfCCompteurX{0}% + \xdef\PfCCompteurO{0}% + \xintFor* ##1 in {\xintSeq{1}{\PfCListeTabMullen}}\do{% + \xintFor* ##2 in {\xintSeq{1}{\TailleTabMul}}\do{% + \StrChar{\PfCListeTabMul[##1]}{##2}[\PfCLettre]% + \IfStrEq{\PfCLettre}{x}{% + \xdef\PfCCompteurX{\fpeval{\PfCCompteurX+1}}% + }{\IfStrEq{\PfCLettre}{o}{% + \xdef\PfCCompteurO{\fpeval{\PfCCompteurO+1}}% + }{}% + }% + }% + }% + \xdef\PfCFooRetiensCible{\useKV[TabMul]{Cible}}% + \readlist*\PfCListeDesNombresCibles{\PfCFooRetiensCible}% + \xintFor* ##2 in{\xintSeq{1}{\PfCListeDesNombresCibleslen}}\do{% + \PfCListeDiviseurs{\PfCListeDesNombresCibles[##2]}% + \setsepchar{,}\ignoreemptyitems% + \readlist*\PfCTabMulDiviseursCible{\PfCListeDiviseursRetour}% + \xdef\PfCFooListePdtCible{$1\times\num{\PfCListeDesNombresCibles[##2]}$,$\num{\PfCListeDesNombresCibles[##2]}\times1$}% + \xintFor* ##1 in {\xintSeq{1}{\PfCNbDiviseurs}}\do{% + \xdef\PfCFooListePdtCible{\PfCFooListePdtCible,$\num{\PfCTabMulDiviseursCible[##1]}\times\num{\fpeval{\PfCListeDesNombresCibles[##2]/\PfCTabMulDiviseursCible[##1]}}$,$\num{\fpeval{\PfCListeDesNombresCibles[##2]/\PfCTabMulDiviseursCible[##1]}}\times\num{\PfCTabMulDiviseursCible[##1]}$}% + }% + }% + \ignoreemptyitems% + \readlist*\PfCListeProduitsCible{\PfCFooListePdtCible}% + \foreachitem\compteur\in\PfCListeProduitsCible{\expandafter\UpdatetoksTabMulPdtsCible\compteur\nil}% + \BuildTabMulCible{\the\tokstabmul}{\the\tokstabmulpdtscible}{\PfCFooRetiensCible}% + }{% + \ifboolKV[TabMul]{Operations}{% + \xdef\PfCTabMulListePdts{4,6,8,9,10,12,14,15,16,18,20,21,24,25,27,28,30,32,35,36,40,42,45,48,49,50,54,56,60,63,64,70,72,80,81,90,100}%37 + \xdef\PfCTabMulListeNonPdts{2,3,5,7,11,13,17,19,22,23,26,29,31,33,34,37,38,39,41,43,44,46,47,51,52,53,55,57,58,59,61,62,65,66,67,68,69,71,73,74,75,76,77,78,79,82,83,84,85,86,87,88,89,91,92,93,94,95,96,97,98,99}%62 + \xdef\PfCCompteurX{0} + \xdef\PfCCompteurO{0} + \xintFor* ##1 in {\xintSeq{1}{\PfCListeTabMullen}}\do{% + \xintFor* ##2 in {\xintSeq{1}{\TailleTabMul}}\do{% + \StrChar{\PfCListeTabMul[##1]}{##2}[\PfCLettre]% + \IfStrEq{\PfCLettre}{x}{% + \xdef\PfCCompteurX{\fpeval{\PfCCompteurX+1}}% + }{\IfStrEq{\PfCLettre}{o}{% + \xdef\PfCCompteurO{\fpeval{\PfCCompteurO+1}}% + }{}% + }% + }% + }% + \xdef\NombreRepetX{\fpeval{ceil(\PfCCompteurX/37)}}% + \xdef\NombreRepetO{\fpeval{ceil(\PfCCompteurO/62)}}% + \xdef\PfCTabMulListeFinalePdts{} + \xdef\PfCTabMulListeFinaleNonPdts{} + \xintFor* ##1 in {\xintSeq{1}{\NombreRepetX}}\do{% + \xdef\PfCTabMulListeFinalePdts{\PfCTabMulListeFinalePdts,\PfCTabMulListePdts} + }% + \xintFor* ##1 in {\xintSeq{1}{\NombreRepetO}}\do{% + \xdef\PfCTabMulListeFinaleNonPdts{\PfCTabMulListeFinaleNonPdts,\PfCTabMulListeNonPdts} + }% + \MelangeListe{\PfCTabMulListeFinalePdts}{\PfCCompteurX} + \ignoreemptyitems + \readlist*\PfCListeProduits{\faa} + \MelangeListe{\PfCTabMulListeFinaleNonPdts}{\PfCCompteurO} + \ignoreemptyitems + \readlist*\PfCListeNonProduits{\faa} + \ifboolKV[TabMul]{Enonce}{% + \begin{enumerate} + \xintFor* ##1 in {\xintSeq{1}{\PfCCompteurX}}\do{% + \PfCListeDiviseurs{\PfCListeProduits[##1]}% + \ifnum\PfCNbDiviseurs>1\relax + \MelangeListe{\PfCListeDiviseursRetour}{1}% + \else + \xdef\faa{\PfCListeDiviseursRetour} + \fi + \ignoreemptyitems + \readlist*\PfCListeDiviseurChoisi{\faa}% + \item $\PfCListeDiviseurChoisi[1]\times\fpeval{\PfCListeProduits[##1]/\PfCListeDiviseurChoisi[1]}=$ + } + \end{enumerate} + }{} + \ifboolKV[TabMul]{SchemaEnonce}{% + \tokstabmulpdts{} + \tokstabmulnonpdts{} + \xdef\PfCFoo{\PfCListeProduits[1]} + \xintFor* ##3 in {\xintSeq{2}{\PfCCompteurX}}\do{% + \xdef\PfCFoo{\PfCFoo,\PfCListeProduits[##3]}% + }% + \MelangeListe{\PfCFoo}{\PfCCompteurX}% + \ignoreemptyitems + \readlist*\PfCListeProduits{\faa}% + \foreachitem\compteur\in\PfCListeProduits{\expandafter\UpdatetoksTabMulPdts\compteur\nil}% + \foreachitem\compteur\in\PfCListeNonProduits{\expandafter\UpdatetoksTabMulNonPdts\compteur\nil}% + \BuildTabMulEnonce{\the\tokstabmul}{\the\tokstabmulpdts}{\the\tokstabmulnonpdts} + }{}%% + }{% + \BuildTabMul{\the\tokstabmul}% + } + } + \restorecomparemode% + \reademptyitems% +}% + +\NewDocumentCommand\PfCListeDiviseurs{m}{% + \ifnum#1<10\relax + \xdef\PfCLimiteDiv{#1} + \else + \xdef\PfCLimiteDiv{10} + \fi + \xdef\PfCListeDiviseursRetour{} + \xdef\PfCNbDiviseurs{} + \xintFor* ##2 in {\xintSeq{2}{\PfCLimiteDiv}}\do{% + \modulo{#1}{##2}\relax + \ifnum\remainder=0\relax + \xdef\PfCListeDiviseursRetour{\PfCListeDiviseursRetour ##2,}% + \xdef\PfCNbDiviseurs{\fpeval{\PfCNbDiviseurs+1}}% + \fi + }% +}% + +\def\TabMulCibleCode{% + NbCasesLarg=\TailleTabMul; + Largeur=\useKV[TabMul]{Largeur}; + color CoulFond; + boolean Colore,Stop,Graines; + Colore=\useKV[TabMul]{Couleurs}; + if Colore: + CoulFond=\useKV[TabMul]{Couleur}; + fi; + Graines=\useKV[TabMul]{Graines}; + if Graines: + randomseed:=\useKV[TabMul]{Graine}; + fi; + vardef NombresCibles(text t)= + nbc=0; + for p_=t: + nbc:=nbc+1; + Cible[nbc]=p_; + endfor; + enddef; + % + vardef LectureDesProduits(text t)= + string Sproduits[]; + nbp=0; + for p_=t: + nbp:=nbp+1; + Sproduits[nbp]=p_; + endfor; + enddef; + % + vardef Remplissage(text t)= + pair M[][]; + n=0; + for p_=t: + for k=0 upto NbCasesLarg-1: + l:=n mod NbCasesLarg; + h:=n div NbCasesLarg; + M[l][h]=Largeur*(l,-h); + if (substring(k,k+1) of p_)="x": + if Colore: + fill ((unitsquare scaled Largeur) shifted M[l][h]) withcolor CoulFond; + fi; + label(TEX(Sproduits[ceiling(uniformdeviate(nbp))]),M[l][h] shifted (Largeur*(0.5,0.5))); + elseif (substring(k,k+1) of p_)="X": + fill ((unitsquare scaled Largeur) shifted M[l][h]); + else: + Stop:=false; + forever: + basea:=ceiling(1+uniformdeviate(9)); + baseb:=ceiling(1+uniformdeviate(9)); + basec:=0; + for r=1 upto nbc: + if (basea*baseb)<>Cible[r]: + basec:=basec+1; + fi; + endfor; + if basec=nbc: + Stop:=true; + fi; + exitif Stop; + endfor; + label(TEX("$\num{"&decimal(basea)&"}\times\num{"&decimal(baseb)&"}$"),M[l][h] shifted (Largeur*(0.5,0.5))); + fi; + trace (unitsquare scaled Largeur) shifted M[l][h]; + n:=n+1; + endfor; + endfor; + enddef; + % + vardef RemplissagePDF(text t)= + pair M[][]; + n=0; + for p_=t: + for k=0 upto NbCasesLarg-1: + l:=n mod NbCasesLarg; + h:=n div NbCasesLarg; + M[l][h]=Largeur*(l,-h); + if (substring(k,k+1) of p_)="x": + if Colore: + fill ((unitsquare scaled Largeur) shifted M[l][h]) withcolor CoulFond; + fi; + label(LATEX(Sproduits[ceiling(uniformdeviate(nbp))]),M[l][h] shifted (Largeur*(0.5,0.5))); + elseif (substring(k,k+1) of p_)="X": + fill ((unitsquare scaled Largeur) shifted M[l][h]); + else: + Stop:=false; + forever: + basea:=ceiling(1+uniformdeviate(9)); + baseb:=ceiling(1+uniformdeviate(9)); + basec:=0; + for r=1 upto nbc: + if (basea*baseb)<>Cible[r]: + basec:=basec+1; + fi; + endfor; + if basec=nbc: + Stop:=true; + fi; + exitif Stop; + endfor; + label(LATEX("$\num{"&decimal(basea)&"}\times\num{"&decimal(baseb)&"}$"),M[l][h] shifted (Largeur*(0.5,0.5))); + fi; + trace (unitsquare scaled Largeur) shifted M[l][h]; + n:=n+1; + endfor; + endfor; + enddef; +}% + +\NewDocumentCommand\BuildTabMulCible{mmm}{% + \ifluatex + \mplibforcehmode + \mplibnumbersystem{double} + \begin{mplibcode} + \TabMulCibleCode + NombresCibles(#3); + LectureDesProduits(#2); + Remplissage(#1); + \end{mplibcode} + \mplibnumbersystem{scaled} + \else + \begin{mpost}[mpsettings={\TabMulCibleCode}] + NombresCibles(#3); + LectureDesProduits(#2); + RemplissagePDF(#1); + \end{mpost} + \fi +} + +\def\TabMulCode{% + NbCasesLarg=\TailleTabMul; + Multiple=\useKV[TabMul]{Multiple}; + Largeur=\useKV[TabMul]{Largeur}; + color CoulFond; + boolean Colore,Stop,Graines; + Colore=\useKV[TabMul]{Couleurs}; + if Colore: + CoulFond=\useKV[TabMul]{Couleur}; + fi; + Graines=\useKV[TabMul]{Graines}; + if Graines: + randomseed:=\useKV[TabMul]{Graine}; + fi; + vardef Remplissage(text t)= + pair M[][]; + n=0; + for p_=t: + for k=0 upto NbCasesLarg-1: + l:=n mod NbCasesLarg; + h:=n div NbCasesLarg; + M[l][h]=Largeur*(l,-h); + if (substring(k,k+1) of p_)="x": + if Colore: + fill ((unitsquare scaled Largeur) shifted M[l][h]) withcolor CoulFond; + fi; + label(TEX(decimal(Multiple*ceiling(uniformdeviate(9)+1))),M[l][h] shifted (Largeur*(0.5,0.5))); + elseif (substring(k,k+1) of p_)="X": + fill ((unitsquare scaled Largeur) shifted M[l][h]); + else: + Stop:=false; + forever: + base:=ceiling((1+uniformdeviate(9))*(1+uniformdeviate(9))); + if (base mod Multiple)>0: + Stop:=true; + fi; + exitif Stop; + endfor; + label(TEX(decimal(base)),M[l][h] shifted (Largeur*(0.5,0.5))); + fi; + trace (unitsquare scaled Largeur) shifted M[l][h]; + n:=n+1; + endfor; + endfor; + enddef; + % + vardef RemplissagePDF(text t)= + pair M[][]; + n=0; + for p_=t: + for k=0 upto NbCasesLarg-1: + l:=n mod NbCasesLarg; + h:=n div NbCasesLarg; + M[l][h]=Largeur*(l,-h); + if (substring(k,k+1) of p_)="x": + if Colore: + fill ((unitsquare scaled Largeur) shifted M[l][h]) withcolor CoulFond; + fi; + label(LATEX(decimal(Multiple*ceiling(uniformdeviate(9)+1))),M[l][h] shifted (Largeur*(0.5,0.5))); + elseif (substring(k,k+1) of p_)="X": + fill ((unitsquare scaled Largeur) shifted M[l][h]); + else: + Stop:=false; + forever: + base:=ceiling((1+uniformdeviate(9))*(1+uniformdeviate(9))); + if (base mod Multiple)>0: + Stop:=true; + fi; + exitif Stop; + endfor; + label(LATEX(decimal(base)),M[l][h] shifted (Largeur*(0.5,0.5))); + fi; + trace (unitsquare scaled Largeur) shifted M[l][h]; + n:=n+1; + endfor; + endfor; + enddef; + } + +\NewDocumentCommand\BuildTabMul{m}{% + \ifluatex + \mplibforcehmode + \mplibnumbersystem{double} + \begin{mplibcode} + \TabMulCode + Remplissage(#1); + \end{mplibcode} + \mplibnumbersystem{scaled} + \else + \begin{mpost}[mpsettings={\TabMulCode}] + Remplissage(#1); + \end{mpost} + \fi +} + +\def\TabMulEnonceCode{ + NbCasesLarg=\TailleTabMul; + Multiple=\useKV[TabMul]{Multiple}; + Largeur=\useKV[TabMul]{Largeur}; + color CoulFond; + boolean Colore,Stop;%,Graines; + Colore=\useKV[TabMul]{Couleurs}; + if Colore: + CoulFond=\useKV[TabMul]{Couleur}; + fi; + vardef Remplissage(text t)(text listepdt)(text listenonpdt)= + string pdt[],nonpdt[]; + n:=0; + for p_=listepdt: + pdt[n]=p_; + n:=n+1; + endfor; + n:=0; + for p_=listenonpdt: + nonpdt[n]=p_; + n:=n+1; + endfor; + pair M[][]; + n:=0; + nx=0; + no=0; + for p_=t: + for k=0 upto NbCasesLarg-1: + l:=n mod NbCasesLarg; + h:=n div NbCasesLarg; + M[l][h]=Largeur*(l,-h); + if (substring(k,k+1) of p_)="x": + if Colore: + fill ((unitsquare scaled Largeur) shifted M[l][h]) withcolor CoulFond; + fi; + label(TEX(pdt[nx]),M[l][h] shifted (Largeur*(0.5,0.5))); + nx:=nx+1; + elseif (substring(k,k+1) of p_)="X": + fill ((unitsquare scaled Largeur) shifted M[l][h]); + else: + label(TEX(nonpdt[no]),M[l][h] shifted (Largeur*(0.5,0.5))); + no:=no+1; + fi; + trace (unitsquare scaled Largeur) shifted M[l][h]; + n:=n+1; + endfor; + endfor; + enddef; + vardef RemplissagePDF(text t)(text listepdt)(text listenonpdt)= + string pdt[],nonpdt[]; + n:=0; + for p_=listepdt: + pdt[n]=p_; + n:=n+1; + endfor; + n:=0; + for p_=listenonpdt: + nonpdt[n]=p_; + n:=n+1; + endfor; + pair M[][]; + n:=0; + nx=0; + no=0; + for p_=t: + for k=0 upto NbCasesLarg-1: + l:=n mod NbCasesLarg; + h:=n div NbCasesLarg; + M[l][h]=Largeur*(l,-h); + if (substring(k,k+1) of p_)="x": + if Colore: + fill ((unitsquare scaled Largeur) shifted M[l][h]) withcolor CoulFond; + fi; + label(TEX(pdt[nx]),M[l][h] shifted (Largeur*(0.5,0.5))); + nx:=nx+1; + elseif (substring(k,k+1) of p_)="X": + fill ((unitsquare scaled Largeur) shifted M[l][h]); + else: + label(TEX(nonpdt[no]),M[l][h] shifted (Largeur*(0.5,0.5))); + no:=no+1; + fi; + trace (unitsquare scaled Largeur) shifted M[l][h]; + n:=n+1; + endfor; + endfor; + enddef; + } + +\NewDocumentCommand\BuildTabMulEnonce{mmm}{% + \ifluatex + \mplibforcehmode + \mplibnumbersystem{double} + \begin{mplibcode} + \TabMulEnonceCode + Remplissage(#1)(#2)(#3); + \end{mplibcode} + \mplibnumbersystem{scaled} + \else + \begin{mpost}[mpsettings={\TabMulEnonceCode}] + RemplissagePDF(#1)(#2)(#3); + \end{mpost} + \fi +} \ No newline at end of file diff --git a/macros/latex/contrib/profcollege/latex/PfCNotionFonction.tex b/macros/latex/contrib/profcollege/latex/PfCNotionFonction.tex index 9b6c46725a..0941c913ee 100644 --- a/macros/latex/contrib/profcollege/latex/PfCNotionFonction.tex +++ b/macros/latex/contrib/profcollege/latex/PfCNotionFonction.tex @@ -288,7 +288,7 @@ nbspline=0; % nbpoints=50; - % + % vardef SplineCubique(expr xzero,yzero,xuno,yuno,dzero,duno)= nbspline:=nbspline+1; a[nbspline]*(xzero**3)+b[nbspline]*(xzero**2)+c[nbspline]*xzero+d[nbspline]=yzero; @@ -737,7 +737,7 @@ dotlabel.lft(TEX("\num{"&decimal(k)&"}"),Origine*cm+(0,k*yu)); endfor; fi; -% +% drawoptions(withpen pencircle scaled(1)); drawarrow (u*(0,ymin-grilley)--u*(0,ymax+grilley)) shifted (u*(xpart(Origine),0)); drawarrow (u*(xmin-grillex,0)--u*(xmax+grillex,0)) shifted (u*(0,ypart(Origine))); @@ -798,7 +798,7 @@ dotlabel.lft(LATEX("\num{"&decimal(k)&"}"),(xpart(Origine*cm),k*yu+ypart(Origine*cm))); endfor; fi; -% +% drawoptions(withpen pencircle scaled(1)); drawarrow (u*(0,ymin)--u*(0,ymax)) shifted (u*(xpart(Origine),0)); drawarrow (u*(xmin,0)--u*(xmax,0)) shifted (u*(0,ypart(Origine))); diff --git a/macros/latex/contrib/profcollege/latex/PfCNumberHive.tex b/macros/latex/contrib/profcollege/latex/PfCNumberHive.tex index 309d5aaa9f..3c7903c3a0 100644 --- a/macros/latex/contrib/profcollege/latex/PfCNumberHive.tex +++ b/macros/latex/contrib/profcollege/latex/PfCNumberHive.tex @@ -47,7 +47,7 @@ \readlist*\ListeCompoNH{\faa}% \foreachitem\compteur\in\ListeCompoNH{\expandafter\UpdatetoksNHive\compteur\nil}% \begin{tikzpicture} - \node[xshift=1cm,yshift=-1cm,rotate=45] at (0,0) {\includegraphics[scale=0.1]{LogoNumberHive.png}}; + \node[xshift=1cm,yshift=-1cm,rotate=45] at (0,0) {\includegraphics[scale=0.1]{PfCLogoNumberHive.png}}; \node[anchor=north west] at (0,0) {\BuildNumberHiveAdditif{\the\toklistenumberhive}{\useKV[NumberHive]{Niveau}}{\useKV[NumberHive]{Jetons}}{\ListeAvantCouleurs}{\the\toklistecasescoloreesNH}}; \end{tikzpicture} }% diff --git a/macros/latex/contrib/profcollege/latex/PfCPyramideCalculs.tex b/macros/latex/contrib/profcollege/latex/PfCPyramideCalculs.tex index 3e17ac010e..fdd5c7b685 100644 --- a/macros/latex/contrib/profcollege/latex/PfCPyramideCalculs.tex +++ b/macros/latex/contrib/profcollege/latex/PfCPyramideCalculs.tex @@ -93,11 +93,11 @@ Produit[3]=Facteur[3] * Facteur[1]; for k=1 upto 3: if Produit or Solution: - label(TEX("\num{"&decimal(Produit[k])&"}"),(1.75[O,B[k]]-center BoiteRec)); + label(LATEX("\num{"&decimal(Produit[k])&"}"),(1.75[O,B[k]]-center BoiteRec)); fi; if Produit: else: - label(TEX("\num{"&decimal(Facteur[k])&"}"),(0.5[O,A[k]]-center BoiteRec)); + label(LATEX("\num{"&decimal(Facteur[k])&"}"),(0.5[O,A[k]]-center BoiteRec)); fi; endfor; fi; diff --git a/macros/latex/contrib/profcollege/latex/PfCQuestionsRelier.tex b/macros/latex/contrib/profcollege/latex/PfCQuestionsRelier.tex index 1b425a7701..f921498c54 100644 --- a/macros/latex/contrib/profcollege/latex/PfCQuestionsRelier.tex +++ b/macros/latex/contrib/profcollege/latex/PfCQuestionsRelier.tex @@ -31,7 +31,7 @@ picture]{\node[name=RelieD-\theNbRelie,inner sep=0pt]{};\fill[] (RelieD-\theNbRelie) circle[radius=1.5pt]}}cp{\useKV[ClesRelie]{LargeurD}}}% \xintFor* ##1 in {\xintSeq {1}{\ListeRelielen}}\do{\ListeRelie[##1,1]\itemtomacro\ListeRelie[##1,1]\untest% -\ifx\bla\untest\bla% +\ifx\bla\untest\bla% \uppercase{&}\stepcounter{NbRelie}% \else \uppercase{&}\stepcounter{NbRelie}\tikz[remember @@ -49,7 +49,7 @@ \begin{tabular}{p{\useKV[ClesRelie]{LargeurG}}cp{\useKV[ClesRelie]{Ecart}}>{\tikz[remember picture,baseline]{\node[name=RelieD-\theNbRelie]{\Large\textbullet};}}cp{\useKV[ClesRelie]{LargeurD}}}% \xintFor* ##1 in {\xintSeq {1}{\ListeRelielen}}\do{\ListeRelie[##1,1]\itemtomacro\ListeRelie[##1,1]\untest% -\ifx\bla\untest\bla% +\ifx\bla\untest\bla% \uppercase{&}\stepcounter{NbRelie}% \else \uppercase{&}\stepcounter{NbRelie}\tikz[remember picture,baseline]{\node[name=RelieG-\theNbRelie]{\Large\textbullet};} diff --git a/macros/latex/contrib/profcollege/latex/PfCReperage.tex b/macros/latex/contrib/profcollege/latex/PfCReperage.tex index 0d4ba8b3d6..48d4942761 100644 --- a/macros/latex/contrib/profcollege/latex/PfCReperage.tex +++ b/macros/latex/contrib/profcollege/latex/PfCReperage.tex @@ -147,6 +147,7 @@ % label.top(TEX("Oeil="&decimal(greenpart(Oeil))),(0,2cm)); % label.top(TEX("Oeil="&decimal(bluepart(Oeil))),(0,3cm)); \end{mplibcode} + \mplibnumbersystem{scaled} \else \begin{mpost}[mpsettings={PfCRho=\useKV[ClesReperage]{Rho};PfCPhi=\useKV[ClesReperage]{Phi};PfCTheta=\useKV[ClesReperage]{Theta};color CouleurE,CouleurG;CouleurE=\useKV[ClesReperage]{CouleurE};CouleurG=\useKV[ClesReperage]{CouleurG};boolean AffichageNom,Axes;AffichageNom=\useKV[ClesReperage]{AffichageNom};Axes=\useKV[ClesReperage]{Axes};}] input PfCSolid; @@ -767,7 +768,7 @@ drawarrow (B+(-0.75*unitpx,0))--(C+(0.75*unitpx,0)); drawarrow (D+(0,-0.75*unitpy))--(E+(0,0.75*unitpy)); % graduation compl\`ete ou pas ? - label.llft(btex \footnotesize 0 etex,A); + label.llft(TEX("\footnotesize 0"),A); if #6>0: for k=minx upto maxx: if (xpart((k*unitex,0))>xpart(B+(-0.75*unitpx,0))) and (xpart((k*unitex,0)){\centering\arraybackslash}p{\useKV[ClesStat]{Largeur}}}}% - \CodeBefore% - \rowcolor{\useKV[ClesStat]{CouleurTab}}{1}% - \columncolor{\useKV[ClesStat]{CouleurTab}}{1}% - \Body% - \the\tabtoksa&Total\\% - \ifboolKV[ClesStat]{EffVide}{\useKV[ClesStat]{Effectif}\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&}}{\the\tabtoksb&\num{\EffectifTotal}}\\% - \ifboolKV[ClesStat]{Frequence}{\stepcounter{PfCCompteLignes}Fr\'equence (\%)\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{\num{\CalculFrequence{##1}}}}}&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{100}}\\}{}% - \ifboolKV[ClesStat]{Angle}{\stepcounter{PfCCompteLignes}Angle (\si{\degree})\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculAngle{##1}}}}&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{360}}\\}{}% - \ifboolKV[ClesStat]{SemiAngle}{\stepcounter{PfCCompteLignes}Angle (\si{\degree})\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculSemiAngle{##1}}}}&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{180}}\\}{}% - \ifboolKV[ClesStat]{ECC}{\stepcounter{PfCCompteLignes}E.C.C.\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{ECCVide}{}{\CalculECC{##1}}}}&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{ECCVide}{}{\num{\EffectifTotal}}}\\}{}% - \CodeAfter% - % On crée la liste des colonnes à vider - \xintifboolexpr{\useKV[ClesStat]{ColVide}>0}{% - \xdef\FooStat{\useKV[ClesStat]{ColVide}}% - \setsepchar{,}% - \readlist*\ListeColonnesAVider{\FooStat}% - \foreachitem\compteur\in\ListeColonnesAVider{% - \tikz\fill[white] (row-2-|col-\fpeval{\compteur+1}) rectangle (last-|col-\fpeval{\compteur+2});% - }% - }{}% - % On crée la liste des cases à vider - \ifboolKV[ClesStat]{CaseVide}{% - \xdef\FooStatCases{\useKV[ClesStat]{CasesVides}}% - \setsepchar[*]{,*/}% - \readlist*\ListeCasesAVider{\FooStatCases}% - \foreachitem\compteur\in\ListeCasesAVider{% - \tikz\fill[white] (row-\fpeval{\ListeCasesAVider[\compteurcnt,1]+1}-|col-\fpeval{\ListeCasesAVider[\compteurcnt,2]+1}) rectangle (row-\fpeval{\ListeCasesAVider[\compteurcnt,1]+2}-|col-\fpeval{\ListeCasesAVider[\compteurcnt,2]+2});% - }% - }{}% - % On retrace le tableau - %Les colonnes - \xintFor* ##1 in {\xintSeq{1}{\fpeval{\ListeCompletelen+3}}}\do{% - \tikz\draw (row-1-|col-##1) -- (last-|col-##1);% - }% - % Les lignes - \xintFor* ##1 in {\xintSeq{1}{\fpeval{\thePfCCompteLignes+3}}}\do{% - \tikz\draw (row-##1-|col-1) -- (row-##1-|last);% - }% - \end{NiceTabular}% - }{% - \begin{NiceTabular}{c*{\fpeval{\ListeCompletelen}}{>{\centering\arraybackslash}p{\useKV[ClesStat]{Largeur}}}}% - \CodeBefore% - \rowcolor{\useKV[ClesStat]{CouleurTab}}{1}% - \columncolor{\useKV[ClesStat]{CouleurTab}}{1}% - \Body% - \the\tabtoksa\\% - \ifboolKV[ClesStat]{EffVide}{\useKV[ClesStat]{Effectif}\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&}}{\the\tabtoksb}\\% - \ifboolKV[ClesStat]{Frequence}{\stepcounter{PfCCompteLignes}Fr\'equence (\%)\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{\num{\CalculFrequence{##1}}}}}\\}{}% - \ifboolKV[ClesStat]{Angle}{\stepcounter{PfCCompteLignes}Angle (\si{\degree})\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculAngle{##1}}}}\\}{}% - \ifboolKV[ClesStat]{SemiAngle}{\stepcounter{PfCCompteLignes}Angle (\si{\degree})\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculSemiAngle{##1}}}}\\}{}% - \ifboolKV[ClesStat]{ECC}{\stepcounter{PfCCompteLignes}E.C.C.\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{ECCVide}{}{\CalculECC{##1}}}}\\}{}% - \CodeAfter% - % On crée la liste des colonnes à vider - \xintifboolexpr{\useKV[ClesStat]{ColVide}>0}{% - \xdef\FooStat{\useKV[ClesStat]{ColVide}}% - \setsepchar{,}% - \readlist*\ListeColonnesAVider{\FooStat}% - \foreachitem\compteur\in\ListeColonnesAVider{% - \tikz\fill[white] (row-2-|col-\fpeval{\compteur+1}) rectangle (last-|col-\fpeval{\compteur+2});% - }% - }{}% - % On crée la liste des cases à vider - \ifboolKV[ClesStat]{CaseVide}{% - \xdef\FooStatCases{\useKV[ClesStat]{CasesVides}}% - \setsepchar[*]{,*/}% - \readlist*\ListeCasesAVider{\FooStatCases}% - \foreachitem\compteur\in\ListeCasesAVider{% - \tikz\fill[white] (row-\fpeval{\ListeCasesAVider[\compteurcnt,1]+1}-|col-\fpeval{\ListeCasesAVider[\compteurcnt,2]+1}) rectangle (row-\fpeval{\ListeCasesAVider[\compteurcnt,1]+2}-|col-\fpeval{\ListeCasesAVider[\compteurcnt,2]+2});% - }% - }{}% - % On retrace le tableau - %Les colonnes - \xintFor* ##1 in {\xintSeq{1}{\fpeval{\ListeCompletelen+2}}}\do{% - \tikz\draw (row-1-|col-##1) -- (last-|col-##1);% - }% - % Les lignes - \xintFor* ##1 in {\xintSeq{1}{\fpeval{\thePfCCompteLignes+3}}}\do{% - \tikz\draw (row-##1-|col-1) -- (row-##1-|last);% - }% - \end{NiceTabular}% - }% -}% - -% Pour construire le diagramme en barres horizontales -\def\UpdatetoksHor#1/#2/#3\nil{\addtotok\toklistenomhor{"#1",}\addtotok\toklistedonhor{#3,}\addtotok\toklisteaffhor{"#2",}}% - -\newcommand\buildgraphbarhor{% - \newtoks\toklistenomhor% - \newtoks\toklistedonhor% - \newtoks\toklisteaffhor% - \newtoks\toklistecouleur% - \xdef\PfCfooStat{}% - \xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{% - \xdef\PfCfooStat{\PfCfooStat \ListeComplete[##1,2],}% - }% - \xdef\DivMax{\fpeval{max(\PfCfooStat)}}% - \xdef\ExposantDivMax{\fpeval{round(ln(\DivMax)/ln(10))}}% - \xdef\DivMax{\fpeval{10**\ExposantDivMax}}% - \xdef\PfCfooStat{}% - \xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{% - \xdef\PfCfooStat{\PfCfooStat \ListeComplete[##1,1]/\ListeComplete[##1,2]/\fpeval{\ListeComplete[##1,2]/\DivMax},}% - }% - \readlist*\ListeCompleteDiagHor{\PfCfooStat}% - \foreachitem\compteur\in\ListeCompleteDiagHor{\expandafter\UpdatetoksHor\compteur\nil}% - \xdef\ListeAvantCouleurs{\useKV[ClesStat]{ListeCouleurs}}% - \readlist*\ListeCouleur{\ListeAvantCouleurs}% - \foreachitem\couleur\in\ListeCouleur{\expandafter\UpdateCoul\couleur\nil}% - \NewMPDiagBarreHor{\the\toklistenomhor}{\the\toklistedonhor}{\the\toklisteaffhor}{\the\toklistecouleur}% -}% - -% Pour construire le diagramme en bâtons -\def\Updatetoks#1/#2\nil{\addtotok\toklistepoint{(#1,#2),}}% -\newcommand\buildgraph[1][]{% - \newtoks\toklistepoint\toklistepoint{}% - \newtoks\toklistecouleur\toklistecouleur{}% - \newtoks\toklistelegende\toklistelegende{}% - \ifboolKV[ClesStat]{LegendeVide}{% - \xdef\foo{\useKV[ClesStat]{LegendesVides}}% - \readlist*\ListeLegendesAEffacer{\foo}% - }{\xdef\foo{-1}\readlist*\ListeLegendesAEffacer{\foo}% - }% - \foreachitem\compteur\in\ListeLegendesAEffacer{\expandafter\UpdateLegende\compteur\nil}% - \foreachitem\compteur\in\ListeComplete{\expandafter\Updatetoks\compteur\nil}% - \xdef\ListeAvantCouleurs{\useKV[ClesStat]{ListeCouleursB}}% - \readlist*\ListeCouleur{\ListeAvantCouleurs}% - \foreachitem\couleur\in\ListeCouleur{\expandafter\UpdateCoul\couleur\nil}% - \MPStatNew{\the\toklistepoint}{\the\toklistecouleur}{\the\toklistelegende} -}% - -% Pour construire le diagramme en bâtons qualitatif -\def\Updatetoksq#1/#2\nil{\addtotok\toklistepointq{"#1",#2,}}% -\newcommand\buildgraphq[1][]{% - \newtoks\toklistepointq\toklistepointq{}% - \newtoks\toklistecouleur\toklistecouleur{}% - \newtoks\toklistelegende\toklistelegende{}% - \ifboolKV[ClesStat]{LegendeVide}{% - \xdef\foo{\useKV[ClesStat]{LegendesVides}}% - \readlist*\ListeLegendesAEffacer{\foo}% - }{\xdef\foo{-1}\readlist*\ListeLegendesAEffacer{\foo}% - }% - \foreachitem\compteur\in\ListeLegendesAEffacer{\expandafter\UpdateLegende\compteur\nil}% - \foreachitem\compteur\in\ListeComplete{\expandafter\Updatetoksq\compteur\nil}% - \xdef\ListeAvantCouleurs{\useKV[ClesStat]{ListeCouleursB}}% - \readlist*\ListeCouleur{\ListeAvantCouleurs}% - \foreachitem\couleur\in\ListeCouleur{\expandafter\UpdateCoul\couleur\nil}% - \MPStatNew{\the\toklistepointq}{\the\toklistecouleur}{\the\toklistelegende}% -}% - -\def\UpdateCoul#1\nil{\addtotok\toklistecouleur{#1,}}% -\def\UpdateLegende#1\nil{\addtotok\toklistelegende{#1,}}% - -% Pour construire le diagramme circulaire qualitatif -\def\buildgraphcq#1{% - \newtoks\toklistepointq\toklistepointq{}% - \newtoks\toklistecouleur\toklistecouleur{}% - \newtoks\toklistelegende\toklistelegende{}% - \ifboolKV[ClesStat]{LegendeVide}{% - \xdef\foo{\useKV[ClesStat]{LegendesVides}}% - \readlist*\ListeLegendesAEffacer{\foo}% - }{\xdef\foo{0}\readlist*\ListeLegendesAEffacer{\foo}% - }% - \foreachitem\compteur\in\ListeLegendesAEffacer{\expandafter\UpdateLegende\compteur\nil}% - % - \foreachitem\compteur\in\ListeComplete{\expandafter\Updatetoksq\compteur\nil}% - \xdef\ListeAvantCouleurs{\useKV[ClesStat]{ListeCouleurs}}% - \readlist*\ListeCouleur{\ListeAvantCouleurs}% - \foreachitem\couleur\in\ListeCouleur{\expandafter\UpdateCoul\couleur\nil}% - \NewMPStatCirculaireQ{\the\toklistepointq}{#1}{\the\toklistecouleur}{\the\toklistelegende}% -}% - -%% calcul des fr\'equences -\newcommand\CalculFrequence[1]{% - \fpeval{round(\ListeComplete[#1,2]*100/\EffectifTotal,\useKV[ClesStat]{PrecisionF})} -} - -%% calcul des angles -\newcommand\CalculAngle[1]{% - \fpeval{round(\ListeComplete[#1,2]*360/\EffectifTotal,0)} -} -\newcommand\CalculSemiAngle[1]{% - \fpeval{round(\ListeComplete[#1,2]*180/\EffectifTotal,0)} -} - -%% calcul des ECC -\newcount\CompteurECC% -\newcount\CompteurECCTotal% -\newcount\CompteurECCC% -\newcount\CompteurECCCTotal% - -\newcommand\CalculECC[1]{% - \xdef\TotalECC{0}% - \CompteurECC=1% - \CompteurECCTotal=\numexpr#1+1% - \whiledo{\CompteurECC < \CompteurECCTotal}{% - \xdef\TotalECC{\fpeval{\TotalECC+\ListeComplete[\the\CompteurECC,2]}}% - \CompteurECC=\numexpr\CompteurECC+1% - }% - \num{\TotalECC}% -} - -\def\NewMPDiagBarreHorCode{% - Longueur:=\useKV[ClesStat]{Longueur}; - Hauteur:=\useKV[ClesStat]{Hauteur}; - Ecart:=\useKV[ClesStat]{EcartBarre}; - ExposantDivMax:=\ExposantDivMax; - ecarthachures=\useKV[ClesStat]{EcartHachures}; - epaisseurhachures=\useKV[ClesStat]{EpaisseurHachures}; - boolean Hachures,Bicolore,Grille,AffichageDonnee,LegendeVide; - Hachures=\useKV[ClesStat]{Hachures}; - Bicolore=\useKV[ClesStat]{Bicolore}; - Grille=\useKV[ClesStat]{Grille}; - AffichageDonnee=\useKV[ClesStat]{AffichageDonnee}; - LegendeVide=\useKV[ClesStat]{LegendeVide}; - vardef CalculNombreDonneesEtDonneeMax(text t)= - nbdon:=0;%nombre de données - DonneeMax:=0;%donnée DonneeMaximale - for p_=t: - nbdon:=nbdon+1; - if p_>DonneeMax: - DonneeMax:=p_; - fi; - endfor; - enddef; - vardef ListeDonnees(text t)= - n:=0; - for p_=t: - n:=n+1; - Donnees[n]:=p_; - endfor; - enddef; - vardef RecuperationCouleurs(text t)= - color Col[]; - n:=0; - for p_=t: - n:=n+1; - Col[n]=p_; - endfor; - enddef; -} - -% Construction d'un diagramme en barres horizontal -\newcommand\NewMPDiagBarreHor[4]{% - % #1 Liste des noms - % #2 Liste des valeurs associées - % #3 Liste des valeurs à afficher (si pb calcul MP) - % #4 Liste des couleurs - \ifluatex% - \mplibforcehmode% - \begin{mplibcode}% - \NewMPDiagBarreHorCode% - vardef TraceDiag= - if Grille: - pair Zz[];%Pour déterminer "le dernier point" - Zz0=(0,-(nbdon-1)*(Hauteur+Ecart)-Ecart); - Zz2=(0,(Hauteur+Ecart)); - Zz1=((1/DonneeMax)*Longueur,-(nbdon-1)*(Hauteur+Ecart)-Ecart); - Zz3=if ExposantDivMax=0 : (DonneeMax+1)[Zz0,Zz1] else: ((floor(DonneeMax*10+2))/10)[Zz0,Zz1];fi; - if ExposantDivMax=0: - for k=1 upto DonneeMax+1: - trace (Zz0--Zz2) shifted (k*(Zz1-Zz0)) dashed evenly withcolor 0.5white; - endfor; - else: - for k=1 upto (floor(DonneeMax*10+2)): - trace (Zz0--Zz2) shifted ((k/10)*(Zz1-Zz0)) dashed evenly withcolor 0.5white; - endfor; - fi; - if ExposantDivMax=0: - for k=1 upto (DonneeMax+1): - label.bot(TEX("\num{"&decimal(k)&"}"),Zz0+k*(Zz1-Zz0)); - endfor; - else: - if ExposantDivMax<5: - for k=1 upto (floor(DonneeMax*10+2)): - label.bot(TEX("\num{\fpeval{"&decimal(k)&"*(10**"&decimal(ExposantDivMax-1)&")}}"),Zz0+(k/10)*(Zz1-Zz0)); - endfor; - else: - dotlabel.bot(TEX("\num{\fpeval{10**"&decimal(ExposantDivMax)&"}}"),Zz1); - fi; - fi; - fi; - for k=0 upto nbdon-1: - path RectangleDonnee; - RectangleDonnee=(unitsquare xscaled ((Donnees[k+1]/DonneeMax)*Longueur) yscaled Hauteur) shifted(0,-k*(Hauteur+Ecart)); - if Hachures: - fill RectangleDonnee withcolor white; - trace Hachurage(RectangleDonnee,60 if - (k mod 2)=0: +90 fi,ecarthachures,if (k mod 2)=0 : 0 else: 1 fi) - withpen pencircle scaled epaisseurhachures; - else: - remplis RectangleDonnee withcolor if unknown Col[k+1]: if Bicolore:Col[(k mod 2)+1] else: white fi; else:if Bicolore:Col[(k mod 2)+1] else: Col[k+1] fi; fi; - fi; - trace RectangleDonnee; - endfor; - if Grille: - drawarrow (0,-(nbdon-1)*(Hauteur+Ecart)-Ecart)--(0,(Hauteur+Ecart)) withpen pencircle scaled 1.5; - drawarrow (0,-(nbdon-1)*(Hauteur+Ecart)-Ecart)--(Zz3+u*(0.25,0)) withpen pencircle scaled 1.5; - fi; - enddef; - vardef AffichageNom(text t)= - k:=0; - for p_=t: - label.lft(TEX(p_),0.5[(0,0),(0,Hauteur)] shifted (0,-k*(Hauteur+Ecart))); - k:=k+1; - endfor; - enddef; - vardef AffichageDonnees(text t)= - k:=0; - for p_=t: - label.rt(TEX("\num{"&p_&"}"),0.5[(0,0),(0,Hauteur)] shifted (((Donnees[k+1]/DonneeMax)*Longueur),-k*(Hauteur+Ecart))); - k:=k+1; - endfor; - enddef; - CalculNombreDonneesEtDonneeMax(#2); - ListeDonnees(#2); - RecuperationCouleurs(#4); - TraceDiag; - if LegendeVide=false: - AffichageNom(#1); - fi; - if AffichageDonnee: - AffichageDonnees(#3); - fi; - \end{mplibcode} - \else% - \begin{mpost}[mpsettings={\NewMPDiagBarreHorCode}] - vardef TraceDiag= - if Grille: - pair Zz[];%Pour déterminer "le dernier point" - Zz0=(0,-(nbdon-1)*(Hauteur+Ecart)-Ecart); - Zz2=(0,(Hauteur+Ecart)); - Zz1=((1/DonneeMax)*Longueur,-(nbdon-1)*(Hauteur+Ecart)-Ecart); - Zz3=if ExposantDivMax=0 : (DonneeMax+1)[Zz0,Zz1] else: ((floor(DonneeMax*10+2))/10)[Zz0,Zz1];fi; - if ExposantDivMax=0: - for k=1 upto DonneeMax+1: - trace (Zz0--Zz2) shifted (k*(Zz1-Zz0)) dashed evenly withcolor 0.5white; - endfor; - else: - for k=1 upto (floor(DonneeMax*10+2)): - trace (Zz0--Zz2) shifted ((k/10)*(Zz1-Zz0)) dashed evenly withcolor 0.5white; - endfor; - fi; - if ExposantDivMax=0: - for k=1 upto (DonneeMax+1): - label.bot(LATEX("\num{"&decimal(k)&"}"),Zz0+k*(Zz1-Zz0)); - endfor; - else: - if ExposantDivMax<5: - for k=1 upto (floor(DonneeMax*10+2)): - label.bot(LATEX("\num{\noexpand\fpeval{"&decimal(k)&"*(10**"&decimal(ExposantDivMax-1)&")}}"),Zz0+(k/10)*(Zz1-Zz0)); - endfor; - else: - dotlabel.bot(LATEX("\num{\noexpand\fpeval{10**"&decimal(ExposantDivMax)&"}}"),Zz1); - fi; - fi; - fi; - for k=0 upto nbdon-1: - path RectangleDonnee; - RectangleDonnee=(unitsquare xscaled ((Donnees[k+1]/DonneeMax)*Longueur) yscaled Hauteur) shifted(0,-k*(Hauteur+Ecart)); - if Hachures: - fill RectangleDonnee withcolor white; - trace Hachurage(RectangleDonnee,60 if - (k mod 2)=0: +90 fi,ecarthachures,if (k mod 2)=0 : 0 else: 1 fi) - withpen pencircle scaled epaisseurhachures; - else: - remplis RectangleDonnee withcolor if unknown Col[k+1]: if Bicolore:Col[(k mod 2)+1] else: white fi; else:if Bicolore:Col[(k mod 2)+1] else: Col[k+1] fi; fi; - fi; - trace RectangleDonnee; - endfor; - if Grille: - drawarrow (0,-(nbdon-1)*(Hauteur+Ecart)-Ecart)--(0,(Hauteur+Ecart)) withpen pencircle scaled 1.5; - drawarrow (0,-(nbdon-1)*(Hauteur+Ecart)-Ecart)--(Zz3+u*(0.25,0)) withpen pencircle scaled 1.5; - fi; - enddef; - vardef AffichageNom(text t)= - k:=0; - for p_=t: - label.lft(LATEX(p_),0.5[(0,0),(0,Hauteur)] shifted (0,-k*(Hauteur+Ecart))); - k:=k+1; - endfor; - enddef; - vardef AffichageDonnees(text t)= - k:=0; - for p_=t: - label.rt(LATEX("\num{"&p_&"}"),0.5[(0,0),(0,Hauteur)] shifted (((Donnees[k+1]/DonneeMax)*Longueur),-k*(Hauteur+Ecart))); - k:=k+1; - endfor; - enddef; - CalculNombreDonneesEtDonneeMax(#2); - ListeDonnees(#2); - RecuperationCouleurs(#4); - TraceDiag; - if LegendeVide=false: - AffichageNom(#1); - fi; - if AffichageDonnee: - AffichageDonnees(#3); - fi; - \end{mpost} - \fi% -}% - -\def\MPStatNewCode{% - maxx:=0; - maxy:=0; - unitex:=\useKV[ClesStat]{Unitex}*cm; - unitey:=\useKV[ClesStat]{Unitey}*cm; - xpartorigine:=\useKV[ClesStat]{Origine}; - AngleRotation=\useKV[ClesStat]{AngleRotationAbscisse}; - boolean Rotation,Lecture,LectureFine,AideLecture,DonneesSup,Reponses,Qualitatif,Tiret,LegendeVide,Retour,GrandNombrex,GrandNombrey,Date; - GrandNombrex=\useKV[ClesStat]{GrandNombrex}; - GrandNombrey=\useKV[ClesStat]{GrandNombrey}; - if GrandNombrex: - GrandNombreA=\useKV[ClesStat]{GrandNombreA}; - fi; - if GrandNombrey: - GrandNombreO=\useKV[ClesStat]{GrandNombreO}; - fi; - Date:=\useKV[ClesStat]{Date}; - Rotation=\useKV[ClesStat]{AbscisseRotation}; - Lecture:=\useKV[ClesStat]{Lecture}; - LectureFine:=\useKV[ClesStat]{LectureFine}; - AideLecture:=\useKV[ClesStat]{AideLecture}; - DonneesSup:=\useKV[ClesStat]{DonneesSup}; - Reponses:=\useKV[ClesStat]{Reponses}; - LegendeVide=\useKV[ClesStat]{LegendeVide}; - epaisseurbatons=\useKV[ClesStat]{EpaisseurBatons}; - Qualitatif=\useKV[ClesStat]{Qualitatif}; - Tiret=\useKV[ClesStat]{Tiret}; - Retour=false; - color CoulDefaut; - CoulDefaut=\useKV[ClesStat]{CouleurDefaut}; - Depart=\useKV[ClesStat]{Depart}; - % - pair A[],B[],P[]; - vardef toto(text t)=%points quantitatif - n:=0; - for p_=t: - if pair p_: - n:=n+1; - P[n]=((xpart(p_)-(xpartorigine))*unitex,ypart(p_)*unitey); - if xpart(p_)>maxx: - maxx:=xpart(p_)-(xpartorigine); - fi; - if ypart(p_)>maxy: - maxy:=ypart(p_); - fi; - A[n]=unitex*(xpart(p_)-(xpartorigine),0); - B[n]=unitey*(0,ypart(p_)); - fi; - endfor; - enddef; - vardef tutu(text t)=%points qualitatif - n:=0; - for p_=t: - if numeric p_: - P[n]=((n)*unitex,unitey*(p_-Depart)); - B[n]=(0,unitey*(p_-Depart)); - if p_>maxy: - maxy:=p_; - fi; - else: - n:=n+1; - A[n]=unitex*(n,0); - fi; - endfor; - maxy:=maxy-Depart; - maxx:=n; - enddef; -} - -% Construction du graphique en bâtons -\newcommand\MPStatNew[3]{% - \ifluatex - \mplibforcehmode - \begin{mplibcode} - \MPStatNewCode - % - vardef Test(expr nb)= - Retour:=false; - op:=0; - for l_=#3: - if l_=nb: - op:=op+1; - fi; - endfor; - if op>0: - Retour:=true; - fi; - enddef; - % - % on r\'ecup\`ere les couleurs - color Col[]; - n:=0; - for p_=#2: - n:=n+1; - if color p_: - Col[n]=p_; - else: - Col[n]=CoulDefaut; - fi; - endfor; - vardef tata(text t)=%affichage quantitatif - l=0; - for p_=t: - if pair p_: - l:=l+1; - if Rotation: - if Date: - label.bot(TEX(decimal(xpart(p_))) rotated AngleRotation,A[l]); - else: - label.bot(TEX("\num{"&decimal(xpart(p_))&"}") rotated AngleRotation,A[l]); - fi; - else : - if Date: - label.bot(TEX(decimal(xpart(p_))),A[l]); - else: - label.bot(TEX("\num{"&decimal(xpart(p_))&"}"),A[l]); - fi; - fi; - if Reponses: - if DonneesSup: - Test(l); - if Retour=false: - if GrandNombrey: - label.top(TEX("\num{"&decimal(ypart(p_))&"}"),P[l]); - else: - label.top(TEX("\num{"&decimal(ypart(p_))&"}"),P[l]); - fi; - fi; - else: - if Tiret: - trace (B[l]+(-1pt,0))--(B[l]+(1pt,0)); - label.lft(TEX("\num{"&decimal(p_)&"}"),B[l]); - else: - dotlabel.lft(TEX("\num{"&decimal(ypart(p_))&"}"),B[l]); - fi; - fi; - fi; - fi; - endfor; - enddef; - vardef titi(text t)=%affichage qualitatif - l:=0; - for p_=t: - if numeric p_: - if Reponses: - if DonneesSup: - Test(l); - if Retour=false: - label.top(TEX("\num{"&decimal(p_)&"}"),P[l]); - fi; - else: - if Tiret: - trace (B[l]+(-1pt,0))--(B[l]+(1pt,0)); - label.lft(TEX("\num{"&decimal(p_)&"}"),B[l]); - else: - dotlabel.lft(TEX("\num{"&decimal(p_)&"}"),B[l]); - fi; - fi; - fi; - else: - l:=l+1; - if Rotation: - if AngleRotation<>0: - picture TEXTELABEL; - TEXTELABEL=image( - labeloffset:=labeloffset*2; - label.lft(TEX(p_),A[l]); - labeloffset:=labeloffset/2; - ); - trace rotation(TEXTELABEL,A[l],AngleRotation); - else : - label.bot(TEX(p_),A[l]); - fi; - fi; - fi; - endfor; - enddef; - if Qualitatif: tutu(#1); else: toto(#1); fi; - boolean Grille; - Grille:=\useKV[ClesStat]{Grille}; - Pasx:=\useKV[ClesStat]{Pasx}; - Pasy:=\useKV[ClesStat]{Pasy}; - if Grille: - drawoptions(withcolor 0.75white); - for k=0 step Pasx until ((maxx+1)): - trace (k*unitex,0)--(k*unitex,unitey*(maxy+2*Pasy)); - endfor; - for k=0 step Pasy until ((maxy+2*Pasy)): - trace (0,k*unitey)--(unitex*(maxx+1),k*unitey); - endfor; - drawoptions(); - fi; - if epaisseurbatons<>0: - for k=1 upto n: - fill polygone(A[k]-(epaisseurbatons*1pt,0),A[k]+(epaisseurbatons*1pt,0),P[k]+(epaisseurbatons*1pt,0),P[k]-(epaisseurbatons*1pt,0)) withcolor if unknown Col[k]: CoulDefaut else:Col[k] fi; - if AideLecture: - draw B[k]--P[k] dashed evenly; - fi; - endfor; - fi; - if LectureFine: - for k=0 step Pasy until ((maxy+1*Pasy)): - if Tiret: - trace (1pt,k*unitey)--(-1pt,k*unitey); - if GrandNombrey: - label.lft(TEX("\num{\fpeval{\useKV[ClesStat]{GrandNombreO}*"&decimal(k+Depart)&"}}"),(0,k*unitey)); - else: - label.lft(TEX("\num{"&decimal(k+Depart)&"}"),(0,k*unitey)); - fi; - else: - if GrandNombrey: - dotlabel.lft(TEX("\num{\fpeval{\useKV[ClesStat]{GrandNombreO}*"&decimal(k+Depart)&"}}"),(0,k*unitey)); - else: - dotlabel.lft(TEX("\num{"&decimal(k+Depart)&"}"),(0,k*unitey)); - fi; - fi; - endfor; - fi; - if Lecture: - for k=0 step Pasy until Pasy: - if Tiret: - trace (1pt,k*unitey)--(-1pt,k*unitey); - if GrandNombrey: - label.lft(TEX("\num{\fpeval{\useKV[ClesStat]{GrandNombreO}*"&decimal(k)&"}}"),(0,k*unitey)); - else: - label.lft(TEX("\num{"&decimal(k)&"}"),(0,k*unitey)); - fi; - else: - if GrandNombrey: - dotlabel.lft(TEX("\num{\fpeval{\useKV[ClesStat]{GrandNombreO}*"&decimal(k)&"}}"),(0,k*unitey)); - else: - dotlabel.lft(TEX("\num{"&decimal(k)&"}"),(0,k*unitey)); - fi; - fi; - endfor; - fi; - drawarrow (0,0)--unitex*(maxx+1,0); - drawarrow (0,0)--unitey*(0,maxy+2*Pasy); - label.lrt(btex \useKV[ClesStat]{Donnee} etex,unitex*(maxx+1,0)); - label.urt(btex \useKV[ClesStat]{Effectif} etex,unitey*(0,maxy+2*Pasy)); - if Qualitatif: titi(#1); else:tata(#1); fi; - \end{mplibcode} - \else - \begin{mpost}[mpsettings={\MPStatNewCode}] - % on r\'ecup\`ere les couleurs - color Col[]; - n:=0; - for p_=#2: - n:=n+1; - if color p_: - Col[n]=p_; - else: - Col[n]=CoulDefaut; - fi; - endfor; - % - vardef tata(text t)=%affichage quantitatif - l=0; - for p_=t: - if pair p_: - l:=l+1; - if Rotation: - label.bot(LATEX("\num{"&decimal(xpart(p_))&"}") rotated AngleRotation,A[l]); - else : - label.bot(LATEX("\num{"&decimal(xpart(p_))&"}"),A[l]); - fi; - if Reponses: - if DonneesSup: - label.top(LATEX("\num{"&decimal(ypart(p_))&"}"),P[l]); - else: - if Tiret: - trace (B[l]+(-1pt,0))--(B[l]+(1pt,0)); - label.lft(LATEX("\num{"&decimal(p_)&"}"),B[l]); - else: - dotlabel.lft(LATEX("\num{"&decimal(ypart(p_))&"}"),B[l]); - fi; - fi; - fi; - fi; - endfor; - enddef; - vardef titi(text t)=%affichage qualitatif - l:=0; - for p_=t: - if numeric p_: - if Reponses: - if DonneesSup: - label.top(LATEX("\num{"&decimal(p_)&"}"),P[l]); - else: - if Tiret: - trace (B[l]+(-1pt,0))--(B[l]+(1pt,0)); - label.lft(LATEX("\num{"&decimal(p_)&"}"),B[l]); - else: - dotlabel.lft(LATEX("\num{"&decimal(p_)&"}"),B[l]); - fi; - fi; - fi; - else: - l:=l+1; - if Rotation: - if AngleRotation<>0: - picture TEXTELABEL; - TEXTELABEL=image( - labeloffset:=labeloffset*2; - label.lft(LATEX(p_),A[l]); - labeloffset:=labeloffset/2; - ); - trace rotation(TEXTELABEL,A[l],AngleRotation); - else : - label.bot(LATEX(p_),A[l]); - fi; - fi; - fi; - endfor; - enddef; - if Qualitatif: tutu(#1); else: toto(#1); fi; - boolean Grille; - Grille:=\useKV[ClesStat]{Grille}; - Pasx:=\useKV[ClesStat]{Pasx}; - Pasy:=\useKV[ClesStat]{Pasy}; - if Grille: - drawoptions(withcolor 0.75white); - for k=0 step Pasx until ((maxx+1)): - trace (k*unitex,0)--(k*unitex,unitey*(maxy+2*Pasy)); - endfor; - for k=0 step Pasy until ((maxy+2*Pasy)): - trace (0,k*unitey)--(unitex*(maxx+1),k*unitey); - endfor; - drawoptions(); - fi; - if epaisseurbatons<>0: - for k=1 upto n: - fill polygone(A[k]-(epaisseurbatons*1pt,0),A[k]+(epaisseurbatons*1pt,0),P[k]+(epaisseurbatons*1pt,0),P[k]-(epaisseurbatons*1pt,0)) withcolor if unknown Col[k]: CoulDefaut else:Col[k] fi; - if AideLecture: - draw B[k]--P[k] dashed evenly; - fi; - endfor; - fi; - if LectureFine: - for k=0 step Pasy until ((maxy+1*Pasy)): - if Tiret: - trace (1pt,k*unitey)--(-1pt,k*unitey); - label.lft(LATEX("\num{"&decimal(k)&"}"),(0,k*unitey)); - else: - dotlabel.lft(LATEX("\num{"&decimal(k)&"}"),(0,k*unitey)); - fi; - endfor; - fi; - if Lecture: - for k=0 step Pasy until Pasy: - if Tiret: - trace (1pt,k*unitey)--(-1pt,k*unitey); - label.lft(LATEX("\num{"&decimal(k)&"}"),(0,k*unitey)); - else: - dotlabel.lft(LATEX("\num{"&decimal(k)&"}"),(0,k*unitey)); - fi; - endfor; - fi; - drawarrow (0,0)--unitex*(maxx+1,0); - drawarrow (0,0)--unitey*(0,maxy+2*Pasy); - label.lrt(btex \useKV[ClesStat]{Donnee} etex,unitex*(maxx+1,0)); - label.urt(btex \useKV[ClesStat]{Effectif} etex,unitey*(0,maxy+2*Pasy)); - if Qualitatif: titi(#1); else:tata(#1); fi; - \end{mpost} - \fi -} - -\def\NewMPStatCirculaireCodeQ{% - Rayon:=\useKV[ClesStat]{Rayon}; - ecarthachures=\useKV[ClesStat]{EcartHachures}; - epaisseurhachures=\useKV[ClesStat]{EpaisseurHachures}; - boolean AffichageAngle,AffichageDonnee,Hachures,Inverse,Legende,LegendeVide,Retour,ACompleter; - AffichageAngle=\useKV[ClesStat]{AffichageAngle}; - AffichageDonnee=\useKV[ClesStat]{AffichageDonnee}; - Hachures=\useKV[ClesStat]{Hachures}; - Inverse=\useKV[ClesStat]{LectureInverse}; - Legende=\useKV[ClesStat]{Legende}; - LegendeVide=\useKV[ClesStat]{LegendeVide}; - Retour=false; - ACompleter=\useKV[ClesStat]{ACompleter}; - % - pair A[],O,B[],C[],D[]; - O=(0,0); - n:=0; - numeric total[],ang[]; - total[0]=0; - ang[0]:=0; - path cc; - cc=(fullcircle scaled (2*Rayon)); - vardef AfficheLegende(text t)= - picture ResultatLegende; - ResultatLegende=image( - for p_=t: - if string p_: - n:=n+1; - C[n]=A[n-1] rotatedabout(O,if Inverse:-1* fi(ang[n]-ang[n-1])/2); - draw 0.95[O,C[n]]--1.05[O,C[n]]; - C[n]:=1.05[O,C[n]]; - Test(n); - if (xpart(C[n])>xpart(O)) and (ypart(C[n])>ypart(O)): - D[n]=C[n]+(0.5cm,0); - draw C[n]--D[n]; - if Retour=false:label.urt(TEX(p_),D[n]);fi; - fi; - if (xpart(C[n])ypart(O)): - D[n]=C[n]-(0.5cm,0); - draw C[n]--D[n]; - if Retour=false:label.ulft(TEX(p_),D[n]);fi; - fi; - if (xpart(C[n])xpart(O)) and (ypart(C[n])xpart(O)) and (ypart(C[n])>ypart(O)): - D[n]=C[n]+(0.5cm,0); - draw C[n]--D[n]; - if Retour=false:label.urt(LATEX(p_),D[n]);fi; - fi; - if (xpart(C[n])ypart(O)): - D[n]=C[n]-(0.5cm,0); - draw C[n]--D[n]; - if Retour=false:label.ulft(LATEX(p_),D[n]);fi; - fi; - if (xpart(C[n])xpart(O)) and (ypart(C[n])15: - if (n mod 2)=0: - marque_a:=20*0.75*Rayon/cm; - else: - marque_a:=20*0.5*Rayon/cm; - fi; - if Hachures: - if Inverse=false: - undraw - Codeangle(A[n-1],O,A[n],0,(((TEX("\ang{"&decimal(round(p_*(#2/total[N])))&"}"))))); - else: - undraw - Codeangle(A[n],O,A[n-1],0,(((TEX("\ang{"&decimal(round(p_*(#2/total[N])))&"}"))))); - fi; - fill cercles(w shifted(marque_ang*unitvector(w-O)),3mm) withcolor - blanc; - fi; - if Inverse=false: - draw - Codeangle(A[n-1],O,A[n],0,(((TEX("\ang{"&decimal(round(p_*(#2/total[N])))&"}"))))); - else: - draw - Codeangle(A[n],O,A[n-1],0,(((TEX("\ang{"&decimal(round(p_*(#2/total[N])))&"}"))))); - fi; - fi; - elseif AffichageDonnee: - if round(p_*(#2/total[N]))>15: - if (n mod 2)=0: - marque_a:=20*0.75*Rayon/cm; - else: - marque_a:=20*0.5*Rayon/cm; - fi; - if Hachures: - if Inverse=false: - undraw - Codeangle(A[n-1],O,A[n],0,TEX(""&decimal(p_)&"")); - else: - undraw - Codeangle(A[n],O,A[n-1],0,(((TEX(""&decimal(p_)&""))))); - fi; - fill cercles(w shifted(marque_ang*unitvector(w-O)),3mm) withcolor - blanc; - fi; - if Inverse=false: - draw - Codeangle(A[n-1],O,A[n],0,(((TEX(""&decimal(p_)&""))))); - else: - draw - Codeangle(A[n],O,A[n-1],0,(((TEX(""&decimal(p_)&""))))); - fi; - fi; - fi; - % - fi; - endfor; - if #2=360: - draw cc if Hachures: withpen pencircle scaled2 fi; - else: - draw (subpath(0,length cc/2) of cc)--cycle if Hachures: withpen pencircle scaled2 fi;; - fi; - n:=0; - enddef; - vardef Test(expr nb)= - Retour:=false; - op:=0; - for l_=#4: - if l_=nb: - op:=op+1; - fi; - endfor; - if op>0: - Retour:=true; - fi; - enddef; - Figure(-10u,-10u,10u,10u); - toto(#1); - if Legende: - n:=0; - draw AfficheLegende(#1); - fi; - \end{mplibcode} - \else - \begin{mpost}[mpsettings={\NewMPStatCirculaireCodeQ}] - pair A[],O,B[],C[],D[]; - O=(0,0); - n:=0; - numeric total[],ang[]; - total[0]=0; - ang[0]:=0; - path cc; - cc=(fullcircle scaled (2*Rayon)); - % on r\'ecup\`ere les couleurs - color Col[]; - n:=0; - for p_=#3: - n:=n+1; - Col[n]=p_; - endfor; - if Inverse=false: - A[0]=point(0) of cc; - else: - A[0]=point(180) of cc; - fi; - vardef toto(text t)= - n:=0; - for p_=t: - if numeric p_: - n:=n+1; - total[n]:=total[n-1]+p_; - fi; - endfor; - N=n; - for k=1 upto N: - ang[k]=(#2/total[N])*total[k]; - endfor; - n:=0; - for p_=t: - if numeric p_: - n:=n+1; - if Inverse=false: - A[n]=A[n-1] rotatedabout(O,p_*(#2/total[N])); - else: - A[n]=A[n-1] rotatedabout(O,-p_*(#2/total[N])); - fi; - %hachure ou pas ? - if Hachures=false: - fill (O--if Inverse=false:arccercle(A[n-1],A[n],O) else: - arccercle(A[n],A[n-1],O) fi--cycle) withcolor if unknown Col[n]: white else:Col[n] fi; - else: - draw - Hachurage((O--if Inverse=false:arccercle(A[n-1],A[n],O) - else:arccercle(A[n],A[n-1],O) fi--cycle),p_*(#2/total[N]) if - (n mod 2)=0: +90 else: -90 fi,ecarthachures,if (n mod 2)=0 : 0 else: 1 fi) - withpen pencircle scaled epaisseurhachures if AffichageAngle: withcolor 0.5white fi; - fi; - if ACompleter=false: - draw A[n-1]--O--A[n] if Hachures: withpen pencircle scaled2 fi; - fi; - % Affichage des angles associ\'es - if AffichageAngle: - if round(p_*(#2/total[N]))>15: - if (n mod 2)=0: - marque_a:=20*0.75*Rayon/cm; - else: - marque_a:=20*0.5*Rayon/cm; - fi; - if Hachures: - if Inverse=false: - undraw - Codeangle(A[n-1],O,A[n],0,(((LATEX("\ang{"&decimal(round(p_*(#2/total[N])))&"}"))))); - else: - undraw - Codeangle(A[n],O,A[n-1],0,(((LATEX("\ang{"&decimal(round(p_*(#2/total[N])))&"}"))))); - fi; - fill cercles(w shifted(marque_ang*unitvector(w-O)),3mm) withcolor - blanc; - fi; - if Inverse=false: - draw - Codeangle(A[n-1],O,A[n],0,(((LATEX("\ang{"&decimal(round(p_*(#2/total[N])))&"}"))))); - else: - draw - Codeangle(A[n],O,A[n-1],0,(((LATEX("\ang{"&decimal(round(p_*(#2/total[N])))&"}"))))); - fi; - fi; - elseif AffichageDonnee: - if round(p_*(#2/total[N]))>15: - if (n mod 2)=0: - marque_a:=20*0.75*Rayon/cm; - else: - marque_a:=20*0.5*Rayon/cm; - fi; - if Hachures: - if Inverse=false: - undraw - Codeangle(A[n-1],O,A[n],0,LATEX(""&decimal(p_)&"")); - else: - undraw - Codeangle(A[n],O,A[n-1],0,(((LATEX(""&decimal(p_)&""))))); - fi; - fill cercles(w shifted(marque_ang*unitvector(w-O)),3mm) withcolor - blanc; - fi; - if Inverse=false: - draw - Codeangle(A[n-1],O,A[n],0,(((LATEX(""&decimal(p_)&""))))); - else: - draw - Codeangle(A[n],O,A[n-1],0,(((LATEX(""&decimal(p_)&""))))); - fi; - fi; - fi; - % - fi; - endfor; - if #2=360: - draw cc if Hachures: withpen pencircle scaled2 fi; - else: - draw (subpath(0,length cc/2) of cc)--cycle if Hachures: withpen pencircle scaled2 fi;; - fi; - enddef; - vardef Test(expr nb)= - Retour:=false; - op:=0; - for l_=#4: - if l_=nb: - op:=op+1; - fi; - endfor; - if op>0: - Retour:=true; - fi; - enddef; - Figure(-10u,-10u,10u,10u); - toto(#1); - if Legende: - n:=0; - draw AfficheLegendePDF(#1); - fi; - \end{mpost} - \fi -}% - -%Pour la m\'ediane. -\DTLgnewdb{mtdb}% -\dtlexpandnewvalue% -\newcount\nbdonnees% -% -\def\AjoutListEEaa#1\nil{\addtotok\tabtoksEEa{#1,}}% -\def\AjoutListEEab#1\nil{\addtotok\tabtoksEEa{#1/}}% -\def\AjoutListEEb#1\nil{\addtotok\tabtoksEEb{#1,}}% -\def\AjoutListEEx#1\nil{\addtotok\tabtoksEE{#1,}}% -\def\AjoutListEEy#1\nil{\addtotok\tabtoksEE{#1/}}% - -\DTLgnewdb{mtdbEE}% -\DTLgnewdb{mtdbEEqual}% -% - -% Pour les classes -% Pour construire l'histogramme -\def\UpdatetoksHisto#1/#2/#3\nil{\addtotok\toklisteelmtsclasse{#1,#2,}\addtotok\toklistedonhisto{#3,}} -\def\UpdatetoksECC#1\nil{\addtotok\toklistedonhisto{#1,}} - -\NewDocumentCommand\buildgraphhisto{}{% - \newtoks\toklisteelmtsclasse% - \newtoks\toklistedonhisto% - \newtoks\toklistecouleur% - \newtoks\toklistelegende% - \ifboolKV[ClesStat]{LegendeVide}{% - \xdef\foo{\useKV[ClesStat]{LegendesVides}}% - \readlist*\ListeLegendesAEffacer{\foo}% - }{\xdef\foo{-1}\readlist*\ListeLegendesAEffacer{\foo}% - }% - \foreachitem\compteur\in\ListeLegendesAEffacer{\expandafter\UpdateLegende\compteur\nil}% - \foreachitem\compteur\in\ListeDepart{\expandafter\UpdatetoksHisto\compteur\nil}% - \ifboolKV[ClesStat]{ECC}{% - \toklistedonhisto{}% - \xdef\PfCFooECC{\ListeDepart[1,3]}% - \xintFor* ##1 in{\xintSeq{2}{\ListeDepartlen}}\do{% - \xdef\PfCFooRetiens{0}% - \xintFor* ##2 in{\xintSeq{1}{##1}}\do{% - \xdef\PfCFooRetiens{\fpeval{\PfCFooRetiens+\ListeDepart[##2,3]}}% - }% - \xdef\PfCFooECC{\PfCFooECC,\PfCFooRetiens}% - }% - \readlist*\PfCListeECC{\PfCFooECC}% - \foreachitem\compteur\in\PfCListeECC{\expandafter\UpdatetoksECC\compteur\nil}% - }{}% - \xdef\PfCEcartClasse{\fpeval{\ListeDepart[1,2]-\ListeDepart[1,1]}}% - \foreachitem\compteur\in\ListeDepart{% - \xdef\PfCEcartClasse{\PfCEcartClasse,\fpeval{\ListeDepart[\compteurcnt,2]-\ListeDepart[\compteurcnt,1]}} - }% - \xintifboolexpr{\fpeval{min(\PfCEcartClasse)}==\fpeval{max(\PfCEcartClasse)}}{}{\setKV[ClesStat]{MemeAmpli=false}} - % Pour les couleurs - \xdef\ListeAvantCouleurs{\useKV[ClesStat]{ListeCouleurs}}% - \readlist*\ListeCouleur{\ListeAvantCouleurs}% - \foreachitem\couleur\in\ListeCouleur{\expandafter\UpdateCoul\couleur\nil}% - % - \MPBuildHisto{\the\toklisteelmtsclasse}{\the\toklistedonhisto}{\the\toklistecouleur}{\the\toklistelegende}% -} - -%% calcul des fr\'equences -\newcommand\CalculFrequenceClasses[1]{% - \fpeval{round(\ListeDepart[#1,3]*100/\EffectifTotal,\useKV[ClesStat]{PrecisionF})} -} - -\newcommand\CalculECCClasses[1]{% - \xdef\TotalECCC{0}% - \CompteurECCC=1% - \CompteurECCCTotal=\numexpr#1+1% - \whiledo{\CompteurECCC < \CompteurECCCTotal}{% - \xdef\TotalECCC{\fpeval{\TotalECCC+\ListeDepart[\the\CompteurECCC,3]}}% - \CompteurECCC=\numexpr\CompteurECCC+1% - }% - \num{\TotalECCC}% -} - -\NewDocumentCommand\buildtabclasses{}{% - \setcounter{PfCCompteLignes}{0}% - \renewcommand{\arraystretch}{\useKV[ClesStat]{Stretch}}% - \begin{NiceTabular}{l*{\ListeDepartlen}{c}}%[hvlines] - \CodeBefore% - \rowcolor{\useKV[ClesStat]{CouleurTab}}{1}% - \columncolor{\useKV[ClesStat]{CouleurTab}}{1}% - \Body - \useKV[ClesStat]{Donnee}\xintFor* ##1 in{\xintSeq{1}{\ListeDepartlen}}\do{% - &$\num{\ListeDepart[##1,1]}\leqslant\dots<\num{\ListeDepart[##1,2]}$ - }\\ - \useKV[ClesStat]{Effectif}\xintFor* ##1 in{\xintSeq{1}{\ListeDepartlen}}\do{% - &\ifboolKV[ClesStat]{EffVide}{}{\num{\ListeDepart[##1,3]}}% - }\\ - \ifboolKV[ClesStat]{Frequence}{\stepcounter{PfCCompteLignes}Fr\'equence (\%)\xintFor* ##1 in {\xintSeq {1}{\ListeDepartlen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{\num{\CalculFrequenceClasses{##1}}}}}\\ - }{}% - \ifboolKV[ClesStat]{ECC}{\stepcounter{PfCCompteLignes}E.C.C.\xintFor* ##1 in {\xintSeq {1}{\ListeDepartlen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{ECCVide}{}{\CalculECCClasses{##1}}}}\\}{}% - \CodeAfter% - % On crée la liste des colonnes à vider - \xintifboolexpr{\useKV[ClesStat]{ColVide}>0}{% - \xdef\FooStat{\useKV[ClesStat]{ColVide}}% - \setsepchar{,}% - \readlist*\ListeColonnesAVider{\FooStat}% - \foreachitem\compteur\in\ListeColonnesAVider{% - \tikz\fill[white] (row-2-|col-\fpeval{\compteur+1}) rectangle (last-|col-\fpeval{\compteur+2});% - }% - }{}% -% % On crée la liste des cases à vider - \ifboolKV[ClesStat]{CaseVide}{% - \xdef\FooStatCases{\useKV[ClesStat]{CasesVides}}% - \setsepchar[*]{,*/}% - \readlist*\ListeCasesAVider{\FooStatCases}% - \foreachitem\compteur\in\ListeCasesAVider{% - \tikz\fill[white] (row-\fpeval{\ListeCasesAVider[\compteurcnt,1]+1}-|col-\fpeval{\ListeCasesAVider[\compteurcnt,2]+1}) rectangle (row-\fpeval{\ListeCasesAVider[\compteurcnt,1]+2}-|col-\fpeval{\ListeCasesAVider[\compteurcnt,2]+2});% - }% - }{}% -% % On retrace le tableau -% % Les colonnes - \xintFor* ##1 in {\xintSeq{1}{\fpeval{\ListeDepartlen+2}}}\do{% - \tikz\draw (row-1-|col-##1) -- (last-|col-##1);% - }% -% % Les lignes - \xintFor* ##1 in {\xintSeq{1}{\fpeval{\thePfCCompteLignes+3}}}\do{% - \tikz\draw (row-##1-|col-1) -- (row-##1-|last);% - }% - \end{NiceTabular} -}% - -\NewDocumentCommand\MPBuildHisto{mmmm}{% - \ifluatex - \mplibforcehmode - \begin{mplibcode} - maxx:=-infinity; - minx:=infinity; - maxy:=-infinity; - miny:=0; - unitex:=\useKV[ClesStat]{Unitex}*cm; - unitey:=\useKV[ClesStat]{Unitey}*cm; - Pasx:=\useKV[ClesStat]{Pasx}; - Pasy:=\useKV[ClesStat]{Pasy}; - UniteAire=\useKV[ClesStat]{UniteAire}; - Ecarthachures=\useKV[ClesStat]{EcartHachures}; - Epaisseurhachures=\useKV[ClesStat]{EpaisseurHachures}; - boolean MemeAmpli,Hachures,Lecture,LectureFine,AideLecture,DonneesSup,Tiret,LegendeVide,Retour,Mediane,ECC; - ECC=\useKV[ClesStat]{ECC}; - Mediane=\useKV[ClesStat]{Mediane}; - MemeAmpli=\useKV[ClesStat]{MemeAmpli}; - Hachures:=\useKV[ClesStat]{Hachures}; - % - Lecture:=\useKV[ClesStat]{Lecture}; - LectureFine:=\useKV[ClesStat]{LectureFine}; - Tiret=\useKV[ClesStat]{Tiret}; - AideLecture:=\useKV[ClesStat]{AideLecture}; - DonneesSup:=\useKV[ClesStat]{DonneesSup}; - LegendeVide=\useKV[ClesStat]{LegendeVide}; - Retour=false; - % Test affichage - vardef Test(expr nb)= - Retour:=false; - op:=0; - for l_=#4: - if l_=nb: - op:=op+1; - fi; - endfor; - if op>0: - Retour:=true; - fi; - enddef; - %Affichage ou pas des légendes - vardef AfficheLegende(text t)= - l=0; - for p_=t: - l:=l+1; - if DonneesSup: - Test(l); - if Retour=false: - label.top(TEX("\num{"&decimal(Y[l])&"}"),(unitex*(Depart+(0.5*(X[2*l]+X[2*l-2])-X[1])/Pasx),unitey*Z[l])); - fi; - fi; - endfor; - enddef; - % on r\'ecup\`ere les couleurs - Depart=\useKV[ClesStat]{DepartHisto}; - color Col[],CoulDefaut; - CoulDefaut=white; - n:=0; - for p_=#3: - n:=n+1; - Col[n]=p_; - endfor; - % - numeric X[]; - numeric ecartabs[]; - vardef RecupValeursAbscisses(text t)= - p:=0; - for p_=t: - p:=p+1; - X[p]:=p_; - if X[p]maxx: - maxx:=X[p]; - fi; - endfor; - X[0]=X[1]; - TotalAbscisses=p; - enddef; - numeric Y[],Z[]; - numeric EffectifTotal[]; - numeric EffectifTotalA[]; - vardef RecupValeursDonnees(text t)= - p:=0; - EffectifTotal[0]:=0; - EffectifTotalA[0]:=0; - for p_=t: - p:=p+1; - EffectifTotal[p]:=p_; - EffectifTotalA[p]:=EffectifTotalA[p-1]+p_; - Y[p]:=p_; - Z[p]=(Y[p]/(UniteAire*(X[2*p]-X[2*p-1])/Pasx)); - R[p]=ceiling(Z[p]); - if R[p]>maxy: - maxy:=R[p]; - fi; - endfor; - NbDonnees:=p; - enddef; - %On affiche la médiane dans le cas des ECC - vardef AfficheMedianeECC(text t)= - YMed:=Z[NbDonnees]/2; - DemiDonnees:=EffectifTotal[NbDonnees]/2; - p:=0; - forever: - p:=p+1; - exitif EffectifTotal[p]>DemiDonnees; - endfor; - path MedHor,MedLineaire,MedVer; - MedLineaire=(unitex*(Depart+(X[2*p-2]-X[1]/Pasx)),unitey*Z[p-1])--(unitex*(Depart+(X[2*p]-X[1])/Pasx),unitey*Z[p]); - MedHor=((0,unitey*YMed)--(unitex*((maxx-minx)/Pasx+2),unitey*YMed)); - MedVer=(xpart(MedLineaire intersectionpoint MedHor),0)--(MedLineaire intersectionpoint MedHor); - draw MedLineaire; - draw MedHor; - draw MedVer; - enddef; - % On affiche la médiane dans le cas non ECC - vardef AfficheMediane(text t)= - DemiDonnees:=EffectifTotalA[NbDonnees]/2; - p:=0; - forever: - p:=p+1; - exitif EffectifTotalA[p]>DemiDonnees; - endfor; - path MedVer; - numeric CoefLineaire,pMed; - pMed=p; - CoefLineaire=(DemiDonnees-EffectifTotalA[p-1])/Y[p]; - MedVer=(unitex*(Depart+(X[2*p-2]-X[1])/Pasx+CoefLineaire*(X[2*p]-X[2*p-2])/Pasx),0)--(unitex*(Depart+(X[2*p-2]-X[1])/Pasx+CoefLineaire*(X[2*p]-X[2*p-2])/Pasx),unitey*Z[p]); - draw MedVer dashed evenly; - enddef; - % On commence le tracé : on récupère les informations - RecupValeursAbscisses(#1); - RecupValeursDonnees(#2); - % on définit une grille - vardef Grille= - if MemeAmpli: - Ajout:=1; - else: - Ajout:=3; - fi; - drawoptions(withcolor 0.7white); - for k=0 upto ((maxx-minx)/Pasx+2): - trace (unitex*k,0)--(unitex*k,(maxy+Ajout)*unitey);%withcolor red; - endfor; - for k=0 upto (maxy+Ajout): - trace (0,k*unitey)--(unitex*((maxx-minx)/Pasx+2),k*unitey);% withcolor blue; - endfor; - drawoptions(); - enddef; - % Fin Grille - % On trace les rectangles - vardef AfficheRectangles= - if Hachures: - Grille; - for k=2 step 2 until TotalAbscisses: - draw hachurage(polygone(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0)),60,0.2,0); - draw chemin(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0)); - endfor; - else: - for k=2 step 2 until TotalAbscisses: - fill polygone(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0)) withcolor if unknown Col[k/2]: CoulDefaut else: Col[k/2] fi; - endfor; - Grille; - for k=2 step 2 until TotalAbscisses: - draw chemin(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0)); - endfor; - fi; - enddef; - % Affichage final - if ECC: - AfficheRectangles; - if Mediane: - AfficheMedianeECC(#2); - fi; - else: - if Mediane: - AfficheMediane(#2); - if Hachures: - Grille; - %Partie gauche - for k=2 step 2 until (2*pMed-2): - draw hachurage(polygone(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0)),60,0.2,0); - draw chemin(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0)); - endfor; - draw hachurage(polygone(unitex*(Depart+(X[2*pMed-2]-X[1])/Pasx,0),point(0) of MedVer,point(1) of MedVer,(unitex*(Depart+(X[2*pMed-2]-X[1])/Pasx),unitey*Z[pMed])),60,0.2,0); - draw polygone(unitex*(Depart+(X[2*pMed-2]-X[1])/Pasx,0),point(0) of MedVer,point(1) of MedVer,(unitex*(Depart+(X[2*pMed-2]-X[1])/Pasx),unitey*Z[pMed])); - % Partie droite - for k=2*pMed+2 step 2 until TotalAbscisses: - draw hachurage(polygone(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0)),120,0.2,1); - draw chemin(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0)); - endfor; - draw hachurage(polygone(unitex*(Depart+(X[2*pMed]-X[1])/Pasx,0),point(0) of MedVer,point(1) of MedVer,(unitex*(Depart+(X[2*pMed]-X[1])/Pasx),unitey*Z[pMed])),120,0.2,1); - draw polygone(unitex*(Depart+(X[2*pMed]-X[1])/Pasx,0),point(0) of MedVer,point(1) of MedVer,(unitex*(Depart+(X[2*pMed]-X[1])/Pasx),unitey*Z[pMed])); - else: - %Partie gauche - for k=2 step 2 until (2*pMed-2): - fill polygone(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0)) withcolor if unknown Col[1]: CoulDefaut else: Col[1] fi; - endfor; - fill polygone(unitex*(Depart+(X[2*pMed-2]-X[1])/Pasx,0),point(0) of MedVer,point(1) of MedVer,(unitex*(Depart+(X[2*pMed-2]-X[1])/Pasx),unitey*Z[pMed])) withcolor if unknown Col[1]: CoulDefaut else: Col[1] fi ; - % Partie droite - for k=2*pMed+2 step 2 until TotalAbscisses: - fill polygone(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0)) withcolor if unknown Col[2]: CoulDefaut else: Col[2] fi; - endfor; - fill polygone(unitex*(Depart+(X[2*pMed]-X[1])/Pasx,0),point(0) of MedVer,point(1) of MedVer,(unitex*(Depart+(X[2*pMed]-X[1])/Pasx),unitey*Z[pMed])) withcolor if unknown Col[2]: CoulDefaut else: Col[2] fi; - Grille; - %Partie Gauche - for k=2 step 2 until (2*pMed-2): - trace polygone(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0)); - endfor; - trace polygone(unitex*(Depart+(X[2*pMed-2]-X[1])/Pasx,0),point(0) of MedVer,point(1) of MedVer,(unitex*(Depart+(X[2*pMed-2]-X[1])/Pasx),unitey*Z[pMed]));%(Y[pMed]/(UniteAire*(X[2*pMed-2]-X[2*pMed-3])/Pasx)))); - for k=2*pMed+2 step 2 until TotalAbscisses: - draw chemin(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0)); - endfor; - draw polygone(unitex*(Depart+(X[2*pMed]-X[1])/Pasx,0),point(0) of MedVer,point(1) of MedVer,(unitex*(Depart+(X[2*pMed]-X[1])/Pasx),unitey*Z[pMed])); - fi; - draw MedVer withpen pencircle scaled 2; - else: - AfficheRectangles; - fi; - fi; - %Affichage ou pas des axes, de la médiane - if MemeAmpli: - drawarrow (0,0)--unitey*(0,maxy+1); - EcartAmpli:=(X[2]-X[1])/Pasx; - if AideLecture: - for k=2 step 2 until TotalAbscisses: - trace ((unitex*(Depart+(X[k]-X[1])/Pasx),unitey*Z[k/2]))--(unitey*(0,Z[k/2])) dashed evenly; - endfor; - fi; - if LectureFine: - for k=0 upto ((maxy+1)): - if Tiret: - trace (1pt,k*unitey)--(-1pt,k*unitey); - label.lft(TEX("\num{"&decimal(k*UniteAire*EcartAmpli)&"}"),(0,k*unitey)); - else: - dotlabel.lft(TEX("\num{"&decimal(k*UniteAire*EcartAmpli)&"}"),(0,k*unitey)); - fi; - endfor; - fi; - if Lecture: - for k=0 upto 1: - if Tiret: - trace (1pt,k*unitey)--(-1pt,k*unitey); - label.lft(TEX("\num{"&decimal(k*UniteAire*EcartAmpli)&"}"),(0,k*unitey)); - else: - dotlabel.lft(TEX("\num{"&decimal(k*UniteAire*EcartAmpli)&"}"),(0,k*unitey)); - fi; - endfor; - fi; - else:%Pas même ampli : on n'affiche pas l'axe vertical - trace hachurage(polygone((unitex,unitey*(maxy+2)),(unitex*2,unitey*(maxy+2)),(unitex*2,unitey*(maxy+1)),(unitex,unitey*(maxy+1))),60,0.2,0); - trace polygone((unitex,unitey*(maxy+2)),(unitex*2,unitey*(maxy+2)),(unitex*2,unitey*(maxy+1)),(unitex,unitey*(maxy+1))); - label.rt(TEX(decimal(UniteAire)&"~\useKV[ClesStat]{Effectif}"),(unitex*2,unitey*(maxy+1.5))); -% if Mediane: -% AfficheMediane(#2); -% fi; - fi; - % On trace l'axe des abscisses - drawarrow (0,0)--unitex*((maxx-minx)/Pasx+2,0); - %On labelise l'axe des abscisses - dotlabel.bot(TEX("\num{"&decimal(X[1])&"}"),unitex*(Depart,0)); - for k=2 step 2 until TotalAbscisses: - dotlabel.bot(TEX("\num{"&decimal(X[k])&"}"),unitex*(Depart+(X[k]-X[1])/Pasx,0)); - endfor; - label.rt(TEX("\useKV[ClesStat]{Donnee}"),(unitex*((maxx-minx)/Pasx+2),0)); - %On affiche les données sup ou pas. - AfficheLegende(#2); - \end{mplibcode} - \fi -} -% - -\newcommand\Stat[2][]{% - \useKVdefault[ClesStat]% - \setKV[ClesStat]{#1}% - \setsepchar[*]{,*/}% - \readlist*\ListeAvantUtilisation{#2}% - \xintifboolexpr{\listlen\ListeAvantUtilisation[1]==3}{\setKV[ClesStat]{Classes}}{}% - \ifboolKV[ClesStat]{Classes}{% - \setsepchar[*]{,*/}% - \readlist*\ListeDepart{#2}% - \xdef\EffectifTotal{0}% - \xintFor* ##1 in{\xintSeq{1}{\ListeDepartlen}}\do{% - \xdef\EffectifTotal{\fpeval{\EffectifTotal+\ListeDepart[##1,3]}}% - }% - \ifboolKV[ClesStat]{Histogramme}{% - \buildgraphhisto% - }{% - \ifboolKV[ClesStat]{Tableau}{% - \buildtabclasses% - }{}% - }% - }{% - \setsepchar{,}% - \ifboolKV[ClesStat]{Representation}{% - \setKV[TraceG]{Xmin=0,Ymin=0}% - \setKV[TraceG]{#1}% - \readlist*\ListePointsPlaces{#2}% - \newtoks\toklistepoint% - \foreachitem\compteur\in\ListePointsPlaces{\expandafter\Updatetoks\compteur\nil}% - \MPPlacePoint[#1]{\the\toklistepoint}% - }{% - \ifboolKV[ClesStat]{Liste}{% - \setsepchar{,}\ignoreemptyitems% - \readlist*\Liste{#2}% - \xdef\foo{}% - \setsepchar[*]{,*/}\ignoreemptyitems% - \xintFor* ##1 in {\xintSeq {1}{\Listelen}}\do{% - \xdef\foo{\foo 1/\Liste[##1],}% - }% - \readlist*\ListeComplete{\foo}% - \setKV[ClesStat]{Qualitatif}% - }{% - \ifboolKV[ClesStat]{Sondage}{% - \setsepchar{,}\ignoreemptyitems% - \readlist*\Liste{#2}% - % "liste vide" - \newtoks\tabtoksEEa% - \tabtoksEEa{}% - % - % "liste vide" - \newtoks\tabtoksEEb% - \tabtoksEEb{}% - % - \readlist*\ListeSansDoublonsEE{999}% %% Pour ne pas avoir une liste vide - % - \newcount\cmptEE% - \newcount\PasNumEE% %% Permettra de savoir si ce sondage est qualitatif ou quantitatif - \PasNumEE=0\relax% - \DTLcleardb{mtdbEE}% - % on range les resultats du sondage par ordre croissant. - \foreachitem\x\in\Liste{% - \DTLnewrow{mtdbEE}% - \DTLnewdbentry{mtdbEE}{Numeric}{\x}% - }% - \dtlsort{Numeric}{mtdbEE}{\dtlicompare}% - \DTLforeach{mtdbEE}{\nba=Numeric}{% - \IfDecimal{\nba}{}{\PasNumEE=\numexpr\PasNumEE+1\relax}% - \cmptEE=0\relax% - \foreachitem\nbb\in\ListeSansDoublonsEE{% - \ifthenelse{\equal{\nba}{\nbb}}{\cmptEE=\numexpr\cmptEE+1\relax}{}% - }% - \ifthenelse{\equal{\the\cmptEE}{0}}{% - \expandafter\AjoutListEEb\nba\nil% - \xdef\listEEa{\the\tabtoksEEb}% - \ignoreemptyitems% - \setsepchar{,}% - \readlist*\ListeSansDoublonsEE\listEEa% %%% Enl\`eve tous les \'elements - %%% identiques de Liste - }{}% - }% - \foreachitem\nba\in\ListeSansDoublonsEE{% - \cmptEE=0\relax% - \DTLforeach{mtdbEE}{\nbb=Numeric}{% - \ifthenelse{\equal{\nba}{\nbb}}{\cmptEE=\numexpr\cmptEE+1\relax}{}% - }% - \expandafter\AjoutListEEab\nba\nil% - \expandafter\AjoutListEEaa\the\cmptEE\nil% %%% Compte tous les \'elements - %%% identiques de Liste - }% - \xdef\listEEb{\the\tabtoksEEa} - \ignoreemptyitems% - \setsepchar[*]{,*/}% - \readlist*\ListeComplete\listEEb% - % - \ifthenelse{\equal{\the\PasNumEE}{0}}{\setKV[ClesStat]{Quantitatif}}{\setKV[ClesStat]{Qualitatif}}% - }{% - \ifboolKV[ClesStat]{Qualitatif}{% - % % on lit la liste \'ecrite sous la forme valeur/effectif - \setsepchar[*]{,*/}\ignoreemptyitems% - \readlist*\ListeInitiale{#2}% - % "liste vide" - \newtoks\tabtoksEE% - \tabtoksEE{}% - \DTLcleardb{mtdbEEqual}% - \foreachitem\x\in\ListeInitiale{% - \DTLnewrow{mtdbEEqual}% - \itemtomacro\ListeInitiale[\xcnt,1]\x% - \DTLnewdbentry{mtdbEEqual}{Val}{\x}% - \itemtomacro\ListeInitiale[\xcnt,2]\y% - \DTLnewdbentry{mtdbEEqual}{Eff}{\y}% - }% - \DTLforeach{mtdbEEqual}{\Val=Val,\Eff=Eff}{% - \expandafter\AjoutListEEy\Val\nil% - \expandafter\AjoutListEEx\Eff\nil% - }% - \xdef\listEE{\the\tabtoksEE} - \ignoreemptyitems% - \setsepchar[*]{,*/}% - \readlist*\ListeComplete\listEE% - }{% Dans le qualitatif, on trie d'abord les valeurs. - \setsepchar[*]{,*/}\ignoreemptyitems% - \readlist*\ListeInitiale{#2}% - % "liste vide" - \newtoks\tabtoksEE% - \tabtoksEE{}% - \DTLcleardb{mtdbEEqual}% - \foreachitem\x\in\ListeInitiale{% - \DTLnewrow{mtdbEEqual}% - \itemtomacro\ListeInitiale[\xcnt,1]\x% - \DTLnewdbentry{mtdbEEqual}{Val}{\x}% - \itemtomacro\ListeInitiale[\xcnt,2]\y% - \DTLnewdbentry{mtdbEEqual}{Eff}{\y}% - }% - \dtlsort{Val}{mtdbEEqual}{\dtlicompare}% - \DTLforeach{mtdbEEqual}{\Val=Val,\Eff=Eff}{% - \expandafter\AjoutListEEy\Val\nil% - \expandafter\AjoutListEEx\Eff\nil% - }% - \xdef\listEE{\the\tabtoksEE} - \ignoreemptyitems% - \setsepchar[*]{,*/}% - \readlist*\ListeComplete\listEE% - }}}% - % on cr\'ee la base de donn\'ees des valeurs dans le cas qualitatif - \DTLcleardb{mtdb}% - % on les trie pour la m\'ediane dans le cas qualitatif % Touhami / Texnique.fr - \foreachitem\x\in\ListeComplete{% - \DTLnewrow{mtdb}% - \itemtomacro\ListeComplete[\xcnt,2]\y% - \DTLnewdbentry{mtdb}{Numeric}{\y}% - }% - \dtlsort{Numeric}{mtdb}{\dtlicompare}% - % % on r\'einitialise les valeurs des crit\`eres de position et de - % dispersion - \renewcommand\NbDonnees{}% - \renewcommand\SommeDonnees{}% - \renewcommand\EffectifTotal{}% - \renewcommand\Moyenne{}% - \renewcommand\Etendue{}% - \renewcommand\Mediane{}% - \renewcommand\DonneeMax{0}% - \renewcommand\EffectifMax{0}% - \renewcommand\DonneeMin{999999999}% - \ifboolKV[ClesStat]{Qualitatif}{%D\'ebut qualitatif - % Calculs - % %% celui de la somme des donn\'ees - \foreachitem\don\in\ListeComplete{\xdef\SommeDonnees{\fpeval{\SommeDonnees+\ListeComplete[\doncnt,2]}}}% - % %% celui de l'effectif total - \ifboolKV[ClesStat]{EffectifTotal}{% - \ifboolKV[ClesStat]{Liste}{L'effectif total de la s\'erie est - \num{\ListeCompletelen}.\par}{% - \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}\]} - }{}% - \ifboolKV[ClesStat]{Liste}{\xdef\EffectifTotal{\ListeCompletelen}}{\xdef\EffectifTotal{\SommeDonnees}}% - % %% celui de la moyenne - \xdef\Moyenne{\fpeval{\SommeDonnees/\ListeCompletelen}}% - \ifboolKV[ClesStat]{Moyenne}{% - \ifboolKV[ClesStat]{Liste}{% - La somme des donn\'ees de la s\'erie est :% - \xintifboolexpr{\ListeCompletelen<\useKV[ClesStat]{Coupure}}{% - \[ - \num{\ListeComplete[1,2]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}\xintFor* ##1 in {\xintSeq {2}{\ListeCompletelen}}\do{% - +\num{\ListeComplete[##1,2]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{} - }=\num{\SommeDonnees}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}% - \]}{% - \[ - \num{\ListeComplete[1,2]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}\xintFor* ##1 in {\xintSeq {2}{3}}\do{% - +\num{\ListeComplete[##1,2]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}}+\dots\xintFor* ##1 in {\xintSeq {\ListeCompletelen-1}{\ListeCompletelen}}\do{% - +\num{\ListeComplete[##1,2]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{} - }=\num{\SommeDonnees}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}% - \]% - }% - \ifboolKV[ClesStat]{SET}{}{Le nombre de donn\'ees de la s\'erie est \num{\ListeCompletelen}.\\}% - Donc la moyenne de la s\'erie est \'egale \`a :% - \[\frac{\num{\SommeDonnees}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}}{\num{\ListeCompletelen}}%\IfInteger{\fpeval{round(\fpeval{\SommeDonnees/\ListeCompletelen},\useKV[ClesStat]{Precision})}}{=}{\approx} - \ifboolKV[ClesStat]{ValeurExacte}{}{% - \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}}}{}% - }% - \]% - }{Pas de moyenne possible pour une s\'erie de donn\'ees \`a caract\`ere qualitatif.}}{}% - % % %% celui de l'\'etendue - \xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{% - \xintifboolexpr{\ListeComplete[##1,2]>\DonneeMax}{% - \xdef\DonneeMax{\ListeComplete[##1,2]}% - }{}% - \xintifboolexpr{\ListeComplete[##1,2]<\DonneeMin}{% - \xdef\DonneeMin{\ListeComplete[##1,2]}% - }{}% - }% - \xdef\EffectifMax{\DonneeMax}% - \xdef\Etendue{\fpeval{\DonneeMax-\DonneeMin}}% - \ifboolKV[ClesStat]{Etendue}{% - \ifboolKV[ClesStat]{Liste}{% - L'\'etendue de la s\'erie est \'egale \`a $\num{\DonneeMax}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}-\num{\DonneeMin}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}=\num{\Etendue}$\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}% - }{Pas d'\'etendue possible pour une s\'erie de donn\'ees \`a caract\`ere qualitatif.}}{}% - % celui de la mediane - %%% Recuperation de la mediane %%%%%%%%%%%%%%%%%%%%% - \newcount\Recapmed% - \newcount\Recapmeda% - \ifodd\number\ListeCompletelen%odd impair - \Recapmed=\fpeval{(\ListeCompletelen+1)/2}\relax% - \else% - \Recapmed=\fpeval{\ListeCompletelen/2}\relax% - \Recapmeda=\numexpr\Recapmed+1\relax% - \fi% - \newcount\Recapk% - \Recapk=0% - \DTLforeach{mtdb}{\numeroDonnee=Numeric}{\Recapk=\numexpr\Recapk+1\relax% - \ifnum\Recapk=\Recapmed% - \ifodd\number\ListeCompletelen% - \xdef\Mediane{\numeroDonnee}% - \else% - \xdef\Mediane{\numeroDonnee}% - \fi% - \fi% - \ifnum\Recapk=\Recapmeda% - \xdef\Mediane{\fpeval{(\Mediane+\numeroDonnee)/2}}% - \fi% - }% - %%% - \ifboolKV[ClesStat]{Mediane}{% - \ifboolKV[ClesStat]{Liste}{% - On range les donn\'ees par ordre croissant :% - \nbdonnees=0% - \xintifboolexpr{\ListeCompletelen<\useKV[ClesStat]{Coupure}}{% - \[\DTLforeach{mtdb}{\numeroDonnee=Numeric}{\num{\numeroDonnee}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}\DTLiflastrow{.}{;}}\]% - }{% - \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% - }% - \newcount\med% - \newcount\meda% - \ifodd\number\ListeCompletelen%odd impair - \med=\fpeval{(\ListeCompletelen+1)/2}\relax% - L'effectif total de la s\'erie est \num{\ListeCompletelen}. Or, $\num{\ListeCompletelen}=\num{\fpeval{\med-1}}+1+\num{\fpeval{\med-1}}$.\\ - \else% pair - \med=\fpeval{\ListeCompletelen/2}\relax% - \meda=\numexpr\med+1\relax% - L'effectif total de la s\'erie est \num{\ListeCompletelen}. Or, $\num{\ListeCompletelen}=\num{\the\med}+\num{\the\med}$.\\ - \fi% - \newcount\k% - \k=0% - \DTLforeach{mtdb}{\numeroDonnee=Numeric}{\k=\numexpr\k+1\relax% - \ifnum\k=\med %La m\'ediane vaut \numeroDonnee\fi - \ifodd\number\ListeCompletelen% - La m\'ediane de la s\'erie est la \the\med\ieme{} donn\'ee.\\Donc la m\'ediane de la s\'erie est \num{\numeroDonnee}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}% - \xdef\Mediane{\numeroDonnee}% - \else% - La \the\med\ieme{} donn\'ee est \num{\numeroDonnee}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}. }{. }\xdef\Mediane{\numeroDonnee}% - \fi% - \fi% - \ifnum\k=\meda - La \the\meda\ieme{} donn\'ee est \num{\numeroDonnee}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.} Donc la m\'ediane de la s\'erie est \xdef\Mediane{\fpeval{(\Mediane+\numeroDonnee)/2}}\num{\Mediane}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}% - \fi% - }% - %%%%%%% - }{Pas de m\'ediane possible pour une s\'erie de donn\'ees \`a caract\`ere qualitatif.}}{} - %%% Quartile un - \newcount\PfCQuartileUn% - \modulo{\ListeCompletelen}{4}\relax% - \ifnum\remainder=0% - \PfCQuartileUn=\fpeval{\ListeCompletelen/4}% - \else% - \PfCQuartileUn=\fpeval{ceil(\ListeCompletelen/4)}% - \fi% - \newcount\PfCQunk% - \PfCQunk=0% - \DTLforeach{mtdb}{\numeroDonnee=Numeric}{\PfCQunk=\numexpr\PfCQunk+1\relax% - \ifnum\PfCQunk=\PfCQuartileUn% - \xdef\QuartileUn{\numeroDonnee}% - \fi% - }% - %%% Quartile trois - \newcount\PfCQuartileTrois% - \modulo{\ListeCompletelen}{4}\relax% - \ifnum\remainder=0% - \PfCQuartileTrois=\fpeval{3*\ListeCompletelen/4}% - \else% - \PfCQuartileTrois=\fpeval{ceil(3*\ListeCompletelen/4)}% - \fi% - \newcount\PfCQtroisk% - \PfCQtroisk=0% - \DTLforeach{mtdb}{\numeroDonnee=Numeric}{\PfCQtroisk=\numexpr\PfCQtroisk+1\relax% - \ifnum\PfCQtroisk=\PfCQuartileTrois%La m\'ediane vaut \numeroDonnee\fi - \xdef\QuartileTrois{\numeroDonnee}% - \fi% - }% - % Construction du tableau - \ifboolKV[ClesStat]{Tableau}{% - \ifboolKV[ClesStat]{Liste}{Pas de tableau possible avec la cl\'e Liste.\\Utilisez plut\^ot la cl\'e Sondage si vous voulez un tableau avec cette liste.}{\BuildtabStat}}{}% - % Construction du graphique - \ifboolKV[ClesStat]{Graphique}{% - \ifboolKV[ClesStat]{Liste}{Pas de graphique possible avec la cl\'e Liste.\\Utilisez plut\^ot la cl\'e Sondage si vous voulez un graphique avec cette liste.}{% - \ifboolKV[ClesStat]{Barre}{% - \buildgraphbarhor% - }{% - \ifboolKV[ClesStat]{Angle}{% - \buildgraphcq{360}% - }{% - \ifboolKV[ClesStat]{SemiAngle}{% - \buildgraphcq{180}% - }{% - \buildgraphq[#1]% - }% - }% - }% - }% - }{}% - }{%%%%%%%%%%%%%%%%%%%%%D\'ebut quantitatif - % % on effectue les calculs - % %% celui de la somme des donn\'ees - \foreachitem\don\in\ListeComplete{\xdef\SommeDonnees{\fpeval{\SommeDonnees+\ListeComplete[\doncnt,1]*\ListeComplete[\doncnt,2]}}}% - % %% celui de l'effectif total - \foreachitem\don\in\ListeComplete{\xdef\EffectifTotal{\fpeval{\EffectifTotal+\ListeComplete[\doncnt,2]}}}% - % %% celui de l'\'etendue - \xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{% - \xintifboolexpr{\ListeComplete[##1,1]>\DonneeMax}{% - \xdef\DonneeMax{\ListeComplete[##1,1]}% - }{}% - \xintifboolexpr{\ListeComplete[##1,1]<\DonneeMin}{% - \xdef\DonneeMin{\ListeComplete[##1,1]}% - }{}% - }% - % \xdef\EffectifMax{\DonneeMax}% - \xdef\Etendue{\fpeval{\DonneeMax-\DonneeMin}}%% - % %% celui de la moyenne - \xdef\Moyenne{\fpeval{\SommeDonnees/\EffectifTotal}}% - \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}\] - }{}% - \ifboolKV[ClesStat]{Moyenne}{% - La somme des donn\'ees de la s\'erie est :% - \xintifboolexpr{\ListeCompletelen<\useKV[ClesStat]{Coupure}}{% - \[ - \ifnum\ListeComplete[1,2]=1\else\num{\ListeComplete[1,2]}\times\fi\num{\ListeComplete[1,1]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}\xintFor* ##1 in {\xintSeq {2}{\ListeCompletelen}}\do{% - +\ifnum\ListeComplete[##1,2]=1\else\num{\ListeComplete[##1,2]}\times\fi\num{\ListeComplete[##1,1]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{} - }=\num{\SommeDonnees}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{} - \] - }{% - \[ - \ifnum\ListeComplete[1,2]=1\else\num{\ListeComplete[1,2]}\times\fi\num{\ListeComplete[1,1]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}\xintFor* ##1 in {\xintSeq {2}{2}}\do{% - +\ifnum\ListeComplete[##1,2]=1\else\num{\ListeComplete[##1,2]}\times\fi\num{\ListeComplete[##1,1]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{} - }+\dots\xintFor* ##1 in {\xintSeq {\ListeCompletelen-1}{\ListeCompletelen}}\do{% - +\ifnum\ListeComplete[##1,2]=1\else\num{\ListeComplete[##1,2]}\times\fi\num{\ListeComplete[##1,1]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{} - }=\num{\SommeDonnees}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{} - \] - }% - \ifboolKV[ClesStat]{SET}{}{L'effectif total de la s\'erie est :% - \ifboolKV[ClesStat]{Liste}{ \num{\EffectifTotal}\\}{% - \[\num{\ListeComplete[1,2]}\xintFor* ##1 in {\xintSeq {2}{\ListeCompletelen}}\do{% - +\num{\ListeComplete[##1,2]} - }=\num{\EffectifTotal} - \]% - }% - }% - Donc la moyenne de la s\'erie est \'egale \`a :% - \[\frac{\num{\SommeDonnees}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}}{\num{\EffectifTotal}}% - \ifboolKV[ClesStat]{ValeurExacte}{}{% - \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}}}{}% - }% - \]% - }{}% - % % Affichage des r\'eponses. - % %% pour l'\'etendue - \ifboolKV[ClesStat]{Etendue}{L'\'etendue de la s\'erie est \'egale \`a $\num{\ListeComplete[\ListeCompletelen,1]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}-\num{\ListeComplete[1,1]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}=\num{\Etendue}$\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}}{}% - % pour la m\'ediane - %%% Recuperation Mediane - \newcount\Recupmed% - \newcount\Recupmeda% - \ifodd\number\EffectifTotal%odd impair - \Recupmed=\fpeval{(\EffectifTotal+1)/2}\relax% - \else% pair - \Recupmed=\fpeval{\EffectifTotal/2}\relax% - \Recupmeda=\numexpr\Recupmed+1\relax% - \fi% - \newcount\Recupk% - \Recupk=0% - \xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{% - \xintFor* ##2 in {\xintSeq {1}{\ListeComplete[##1,2]}}\do{% - \Recupk=\numexpr\Recupk+1\relax% - \ifnum\Recupk=\Recupmed% - \ifodd\number\EffectifTotal% - \xdef\Mediane{\ListeComplete[##1,1]}% - \else% - \xdef\Mediane{\ListeComplete[##1,1]}% - \fi% - \fi% - \ifnum\Recupk=\Recupmeda% - \xdef\Mediane{\fpeval{(\Mediane+\ListeComplete[##1,1])/2}}% - \fi% - }% - }% - %%% - \ifboolKV[ClesStat]{Mediane}{% - - \newcount\med% - \newcount\meda% - \ifodd\number\EffectifTotal%odd impair - \med=\fpeval{(\EffectifTotal+1)/2}\relax% - L'effectif total de la s\'erie est \num{\EffectifTotal}. Or, $\num{\EffectifTotal}=\num{\fpeval{\med-1}}+1+\num{\fpeval{\med-1}}$. % - \else% pair - \med=\fpeval{\EffectifTotal/2}\relax% - \meda=\numexpr\med+1\relax% - L'effectif total de la s\'erie est \num{\EffectifTotal}. Or, $\num{\EffectifTotal}=\num{\fpeval{\med}}+\num{\fpeval{\med}}$. % - \fi% - \newcount\k% - \k=0% - \xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{% - \xintFor* ##2 in {\xintSeq {1}{\ListeComplete[##1,2]}}\do{% - \k=\numexpr\k+1\relax% - \ifnum\k=\med% - \ifodd\number\EffectifTotal% - La m\'ediane de la s\'erie est la \the\med\ieme{} donn\'ee. Donc la m\'ediane de la s\'erie est \num{\ListeComplete[##1,1]}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}% - \else% - La \the\med\ieme{} donn\'ee est \num{\ListeComplete[##1,1]}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}. }{. }\xdef\Mediane{\ListeComplete[##1,1]}% - \fi% - \fi% - \ifnum\k=\meda% - La \the\meda\ieme{} donn\'ee est \num{\ListeComplete[##1,1]}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}\\Donc la m\'ediane de la s\'erie est \xdef\Mediane{\fpeval{(\Mediane+\ListeComplete[##1,1])/2}}\num{\Mediane}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}% - \fi% - }% - }% - }{}% - %%% Quartile un - \newcount\PfCQuartileUn% - \modulo{\EffectifTotal}{4}\relax% - \ifnum\remainder=0% - \PfCQuartileUn=\fpeval{\EffectifTotal/4}% - \else% - \PfCQuartileUn=\fpeval{ceil(\EffectifTotal/4)}% - \fi% - \newcount\PfCQunk% - \PfCQunk=0% - \xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{% - \xintFor* ##2 in {\xintSeq {1}{\ListeComplete[##1,2]}}\do{% - \PfCQunk=\numexpr\PfCQunk+1\relax% - \ifnum\PfCQunk=\PfCQuartileUn% - \xdef\QuartileUn{\ListeComplete[##1,1]}% - \fi% - }% - }% - %%% Quartile trois - \newcount\PfCQuartileTrois% - \modulo{\EffectifTotal}{4}\relax% - \ifnum\remainder=0% - \PfCQuartileTrois=\fpeval{3*\EffectifTotal/4}% - \else% - \PfCQuartileTrois=\fpeval{ceil(3*\EffectifTotal/4)}% - \fi% - \newcount\PfCQtroisk% - \PfCQtroisk=0% - \xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{% - \xintFor* ##2 in {\xintSeq {1}{\ListeComplete[##1,2]}}\do{% - \PfCQtroisk=\numexpr\PfCQtroisk+1\relax% - \ifnum\PfCQtroisk=\PfCQuartileTrois% - \xdef\QuartileTrois{\ListeComplete[##1,1]}% - \fi% - }% - }% - % Construction de tableau - \ifboolKV[ClesStat]{Tableau}{\BuildtabStat}{}% - % Construction du graphique ?? - \ifboolKV[ClesStat]{Graphique}{% - \ifboolKV[ClesStat]{Angle}{% - \buildgraphcq{360}% - }{% - \ifboolKV[ClesStat]{SemiAngle}{% - \buildgraphcq{180}% - }{% - \buildgraph[#1]% - }% - }% - }{}% - }% - }% - }% -}% \ No newline at end of file diff --git a/macros/latex/contrib/profcollege/latex/PfCStatistiquesoldold.tex b/macros/latex/contrib/profcollege/latex/PfCStatistiquesoldold.tex deleted file mode 100644 index 72a33f9dd4..0000000000 --- a/macros/latex/contrib/profcollege/latex/PfCStatistiquesoldold.tex +++ /dev/null @@ -1,2109 +0,0 @@ -%%% -% Statistiques -%%% -\newcommand\NbDonnees{}% -\newcommand\SommeDonnees{}% -\newcommand\EffectifTotal{}% -\newcommand\Moyenne{}% -\newcommand\Etendue{}% -\newcommand\Mediane{}% -\newcommand\DonneeMax{}% -\newcommand\DonneeMin{}% -\newcommand\EffectifMax{}% -\newcommand\PfCArticleMediane{la}% - -\setKVdefault[ClesStat]{ColVide=0,CaseVide=false,EffVide=false,% -FreqVide=false,AngVide=false,ECCVide=false,TotalVide=false,Sondage=false,Liste=false,% -Tableau=false,Stretch=1,Frequence=false,EffectifTotal=false,% -Etendue=false,Moyenne=false,SET=false,ValeurExacte=false,Mediane=false,DetailsMediane=false,UneMediane=false,QuartileUn=false,QuartileTrois=false,Total=false,Concret=false,% -Unite={},Largeur=1cm,Precision=2,PrecisionF=0,Donnee=Valeurs,Effectif=Effectif,Grille=false,Origine=0,Angle=false,SemiAngle=false,Qualitatif=false,Classes=false,TableauVide=false,ECC=false,Coupure=10,CouleurTab=gray!15,Graphique=false,Batons=true,% -% Pour les diags batons -EpaisseurBatons=1,ListeCouleursB={a},Lecture=false,LectureFine=false,AideLecture=false,Reponses=false,DonneesSup=false,AbscisseRotation=false,Tiret=false,AngleRotationAbscisse=0,Pasx=1,Pasy=1,Unitex=0.5,Unitey=0.5,Depart=0,CouleurDefaut=black,Date=false,GrandNombrey=false,GrandNombrex=false,% -% Pour les diags circulaires -Rayon=3cm,AffichageAngle=false,AffichageDonnee=false,ListeCouleurs={white},Hachures=false,LectureInverse=false,EcartHachures=0.25,EpaisseurHachures=1,Legende,LegendeVide=false,ACompleter=false,% -%Pour les représentations -Representation=false,% -%Pour les barres horizontales -Barre=false,Longueur=10cm,Hauteur=5mm,Bicolore=false,EcartBarre=0,%Grille est dispo -% Pour les histogrammes -Histogramme=false,UniteAire=1,MemeAmpli,DepartHisto=1% -}% -%compl\'ements -\defKV[ClesStat]{AngleRotationAbscisse=\setKV[ClesStat]{AbscisseRotation}}% -\defKV[ClesStat]{AffichageDonnees=\setKV[ClesStat]{AffichageAngle=false}\setKV[ClesStat]{AffichageDonnee}}% -\defKV[ClesStat]{CasesVides=\setKV[ClesStat]{CaseVide}}% -\defKV[ClesStat]{LegendesVides=\setKV[ClesStat]{LegendeVide}}% -\defKV[ClesStat]{GrandNombreO=\setKV[ClesStat]{GrandNombrey}}% -\defKV[ClesStat]{GrandNombreA=\setKV[ClesStat]{GrandNombrex}}% -% La construction du tableau -\def\addtotok#1#2{#1\expandafter{\the#1#2}}% -\newtoks\tabtoksa\newtoks\tabtoksb\newtoks\tabtoksc% -\def\updatetoks#1/#2\nil{\addtotok\tabtoksa{\ifboolKV[ClesStat]{Qualitatif}{}{&\num{#1}}}\addtotok\tabtoksb{&\num{#2}}}% -% -\newcounter{PfCCompteLignes}% -% -\def\BuildtabStat{% %%Tableau sans/avec total - \setcounter{PfCCompteLignes}{0}% - \tabtoksa{\useKV[ClesStat]{Donnee}}\tabtoksb{\useKV[ClesStat]{Effectif}}% - \foreachitem\compteur\in\ListeComplete{\expandafter\updatetoks\compteur\nil}% - \renewcommand{\arraystretch}{\useKV[ClesStat]{Stretch}}% - \ifboolKV[ClesStat]{Total}{% - \begin{NiceTabular}{c*{\fpeval{\ListeCompletelen+1}}{>{\centering\arraybackslash}p{\useKV[ClesStat]{Largeur}}}}% - \CodeBefore% - \rowcolor{\useKV[ClesStat]{CouleurTab}}{1}% - \columncolor{\useKV[ClesStat]{CouleurTab}}{1}% - \Body% - \the\tabtoksa&Total\\% - \ifboolKV[ClesStat]{EffVide}{\useKV[ClesStat]{Effectif}\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&}}{\the\tabtoksb&\num{\EffectifTotal}}\\% - \ifboolKV[ClesStat]{Frequence}{\stepcounter{PfCCompteLignes}Fr\'equence (\%)\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{\num{\CalculFrequence{##1}}}}}&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{100}}\\}{}% - \ifboolKV[ClesStat]{Angle}{\stepcounter{PfCCompteLignes}Angle (\si{\degree})\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculAngle{##1}}}}&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{360}}\\}{}% - \ifboolKV[ClesStat]{SemiAngle}{\stepcounter{PfCCompteLignes}Angle (\si{\degree})\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculSemiAngle{##1}}}}&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{180}}\\}{}% - \ifboolKV[ClesStat]{ECC}{\stepcounter{PfCCompteLignes}E.C.C.\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{ECCVide}{}{\CalculECC{##1}}}}&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{ECCVide}{}{\num{\EffectifTotal}}}\\}{}% - \CodeAfter% - % On crée la liste des colonnes à vider - \xintifboolexpr{\useKV[ClesStat]{ColVide}>0}{% - \xdef\FooStat{\useKV[ClesStat]{ColVide}}% - \setsepchar{,}% - \readlist*\ListeColonnesAVider{\FooStat}% - \foreachitem\compteur\in\ListeColonnesAVider{% - \tikz\fill[white] (row-2-|col-\fpeval{\compteur+1}) rectangle (last-|col-\fpeval{\compteur+2});% - }% - }{}% - % On crée la liste des cases à vider - \ifboolKV[ClesStat]{CaseVide}{% - \xdef\FooStatCases{\useKV[ClesStat]{CasesVides}}% - \setsepchar[*]{,*/}% - \readlist*\ListeCasesAVider{\FooStatCases}% - \foreachitem\compteur\in\ListeCasesAVider{% - \tikz\fill[white] (row-\fpeval{\ListeCasesAVider[\compteurcnt,1]+1}-|col-\fpeval{\ListeCasesAVider[\compteurcnt,2]+1}) rectangle (row-\fpeval{\ListeCasesAVider[\compteurcnt,1]+2}-|col-\fpeval{\ListeCasesAVider[\compteurcnt,2]+2});% - }% - }{}% - % On retrace le tableau - %Les colonnes - \xintFor* ##1 in {\xintSeq{1}{\fpeval{\ListeCompletelen+3}}}\do{% - \tikz\draw (row-1-|col-##1) -- (last-|col-##1);% - }% - % Les lignes - \xintFor* ##1 in {\xintSeq{1}{\fpeval{\thePfCCompteLignes+3}}}\do{% - \tikz\draw (row-##1-|col-1) -- (row-##1-|last);% - }% - \end{NiceTabular}% - }{% - \begin{NiceTabular}{c*{\fpeval{\ListeCompletelen}}{>{\centering\arraybackslash}p{\useKV[ClesStat]{Largeur}}}}% - \CodeBefore% - \rowcolor{\useKV[ClesStat]{CouleurTab}}{1}% - \columncolor{\useKV[ClesStat]{CouleurTab}}{1}% - \Body% - \the\tabtoksa\\% - \ifboolKV[ClesStat]{EffVide}{\useKV[ClesStat]{Effectif}\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&}}{\the\tabtoksb}\\% - \ifboolKV[ClesStat]{Frequence}{\stepcounter{PfCCompteLignes}Fr\'equence (\%)\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{\num{\CalculFrequence{##1}}}}}\\}{}% - \ifboolKV[ClesStat]{Angle}{\stepcounter{PfCCompteLignes}Angle (\si{\degree})\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculAngle{##1}}}}\\}{}% - \ifboolKV[ClesStat]{SemiAngle}{\stepcounter{PfCCompteLignes}Angle (\si{\degree})\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculSemiAngle{##1}}}}\\}{}% - \ifboolKV[ClesStat]{ECC}{\stepcounter{PfCCompteLignes}E.C.C.\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{ECCVide}{}{\CalculECC{##1}}}}\\}{}% - \CodeAfter% - % On crée la liste des colonnes à vider - \xintifboolexpr{\useKV[ClesStat]{ColVide}>0}{% - \xdef\FooStat{\useKV[ClesStat]{ColVide}}% - \setsepchar{,}% - \readlist*\ListeColonnesAVider{\FooStat}% - \foreachitem\compteur\in\ListeColonnesAVider{% - \tikz\fill[white] (row-2-|col-\fpeval{\compteur+1}) rectangle (last-|col-\fpeval{\compteur+2});% - }% - }{}% - % On crée la liste des cases à vider - \ifboolKV[ClesStat]{CaseVide}{% - \xdef\FooStatCases{\useKV[ClesStat]{CasesVides}}% - \setsepchar[*]{,*/}% - \readlist*\ListeCasesAVider{\FooStatCases}% - \foreachitem\compteur\in\ListeCasesAVider{% - \tikz\fill[white] (row-\fpeval{\ListeCasesAVider[\compteurcnt,1]+1}-|col-\fpeval{\ListeCasesAVider[\compteurcnt,2]+1}) rectangle (row-\fpeval{\ListeCasesAVider[\compteurcnt,1]+2}-|col-\fpeval{\ListeCasesAVider[\compteurcnt,2]+2});% - }% - }{}% - % On retrace le tableau - %Les colonnes - \xintFor* ##1 in {\xintSeq{1}{\fpeval{\ListeCompletelen+2}}}\do{% - \tikz\draw (row-1-|col-##1) -- (last-|col-##1);% - }% - % Les lignes - \xintFor* ##1 in {\xintSeq{1}{\fpeval{\thePfCCompteLignes+3}}}\do{% - \tikz\draw (row-##1-|col-1) -- (row-##1-|last);% - }% - \end{NiceTabular}% - }% -}% - -% Pour construire le diagramme en barres horizontales -\def\UpdatetoksHor#1/#2/#3\nil{\addtotok\toklistenomhor{"#1",}\addtotok\toklistedonhor{#3,}\addtotok\toklisteaffhor{"#2",}}% - -\newcommand\buildgraphbarhor{% - \newtoks\toklistenomhor% - \newtoks\toklistedonhor% - \newtoks\toklisteaffhor% - \newtoks\toklistecouleur% - \xdef\PfCfooStat{}% - \xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{% - \xdef\PfCfooStat{\PfCfooStat \ListeComplete[##1,2],}% - }% - \xdef\DivMax{\fpeval{max(\PfCfooStat)}}% - \xdef\ExposantDivMax{\fpeval{round(ln(\DivMax)/ln(10))}}% - \xdef\DivMax{\fpeval{10**\ExposantDivMax}}% - \xdef\PfCfooStat{}% - \xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{% - \xdef\PfCfooStat{\PfCfooStat \ListeComplete[##1,1]/\ListeComplete[##1,2]/\fpeval{\ListeComplete[##1,2]/\DivMax},}% - }% - \readlist*\ListeCompleteDiagHor{\PfCfooStat}% - \foreachitem\compteur\in\ListeCompleteDiagHor{\expandafter\UpdatetoksHor\compteur\nil}% - \xdef\ListeAvantCouleurs{\useKV[ClesStat]{ListeCouleurs}}% - \readlist*\ListeCouleur{\ListeAvantCouleurs}% - \foreachitem\couleur\in\ListeCouleur{\expandafter\UpdateCoul\couleur\nil}% - \NewMPDiagBarreHor{\the\toklistenomhor}{\the\toklistedonhor}{\the\toklisteaffhor}{\the\toklistecouleur}% -}% - -% Pour construire le diagramme en bâtons -\def\Updatetoks#1/#2\nil{\addtotok\toklistepoint{(#1,#2),}}% -\newcommand\buildgraph[1][]{% - \newtoks\toklistepoint\toklistepoint{}% - \newtoks\toklistecouleur\toklistecouleur{}% - \newtoks\toklistelegende\toklistelegende{}% - \ifboolKV[ClesStat]{LegendeVide}{% - \xdef\foo{\useKV[ClesStat]{LegendesVides}}% - \readlist*\ListeLegendesAEffacer{\foo}% - }{\xdef\foo{-1}\readlist*\ListeLegendesAEffacer{\foo}% - }% - \foreachitem\compteur\in\ListeLegendesAEffacer{\expandafter\UpdateLegende\compteur\nil}% - \foreachitem\compteur\in\ListeComplete{\expandafter\Updatetoks\compteur\nil}% - \xdef\ListeAvantCouleurs{\useKV[ClesStat]{ListeCouleursB}}% - \readlist*\ListeCouleur{\ListeAvantCouleurs}% - \foreachitem\couleur\in\ListeCouleur{\expandafter\UpdateCoul\couleur\nil}% - \MPStatNew{\the\toklistepoint}{\the\toklistecouleur}{\the\toklistelegende} -}% - -% Pour construire le diagramme en bâtons qualitatif -\def\Updatetoksq#1/#2\nil{\addtotok\toklistepointq{"#1",#2,}}% -\newcommand\buildgraphq[1][]{% - \newtoks\toklistepointq\toklistepointq{}% - \newtoks\toklistecouleur\toklistecouleur{}% - \newtoks\toklistelegende\toklistelegende{}% - \ifboolKV[ClesStat]{LegendeVide}{% - \xdef\foo{\useKV[ClesStat]{LegendesVides}}% - \readlist*\ListeLegendesAEffacer{\foo}% - }{\xdef\foo{-1}\readlist*\ListeLegendesAEffacer{\foo}% - }% - \foreachitem\compteur\in\ListeLegendesAEffacer{\expandafter\UpdateLegende\compteur\nil}% - \foreachitem\compteur\in\ListeComplete{\expandafter\Updatetoksq\compteur\nil}% - \xdef\ListeAvantCouleurs{\useKV[ClesStat]{ListeCouleursB}}% - \readlist*\ListeCouleur{\ListeAvantCouleurs}% - \foreachitem\couleur\in\ListeCouleur{\expandafter\UpdateCoul\couleur\nil}% - \MPStatNew{\the\toklistepointq}{\the\toklistecouleur}{\the\toklistelegende}% -}% - -\def\UpdateCoul#1\nil{\addtotok\toklistecouleur{#1,}}% -\def\UpdateLegende#1\nil{\addtotok\toklistelegende{#1,}}% - -% Pour construire le diagramme circulaire qualitatif -\def\buildgraphcq#1{% - \newtoks\toklistepointq\toklistepointq{}% - \newtoks\toklistecouleur\toklistecouleur{}% - \newtoks\toklistelegende\toklistelegende{}% - \ifboolKV[ClesStat]{LegendeVide}{% - \xdef\foo{\useKV[ClesStat]{LegendesVides}}% - \readlist*\ListeLegendesAEffacer{\foo}% - }{\xdef\foo{0}\readlist*\ListeLegendesAEffacer{\foo}% - }% - \foreachitem\compteur\in\ListeLegendesAEffacer{\expandafter\UpdateLegende\compteur\nil}% - % - \foreachitem\compteur\in\ListeComplete{\expandafter\Updatetoksq\compteur\nil}% - \xdef\ListeAvantCouleurs{\useKV[ClesStat]{ListeCouleurs}}% - \readlist*\ListeCouleur{\ListeAvantCouleurs}% - \foreachitem\couleur\in\ListeCouleur{\expandafter\UpdateCoul\couleur\nil}% - \NewMPStatCirculaireQ{\the\toklistepointq}{#1}{\the\toklistecouleur}{\the\toklistelegende}% -}% - -%% calcul des fr\'equences -\newcommand\CalculFrequence[1]{% - \fpeval{round(\ListeComplete[#1,2]*100/\EffectifTotal,\useKV[ClesStat]{PrecisionF})} -} - -%% calcul des angles -\newcommand\CalculAngle[1]{% - \fpeval{round(\ListeComplete[#1,2]*360/\EffectifTotal,0)} -} -\newcommand\CalculSemiAngle[1]{% - \fpeval{round(\ListeComplete[#1,2]*180/\EffectifTotal,0)} -} - -%% calcul des ECC -\newcount\CompteurECC% -\newcount\CompteurECCTotal% -\newcount\CompteurECCC% -\newcount\CompteurECCCTotal% - -\newcommand\CalculECC[1]{% - \xdef\TotalECC{0}% - \CompteurECC=1% - \CompteurECCTotal=\numexpr#1+1% - \whiledo{\CompteurECC < \CompteurECCTotal}{% - \xdef\TotalECC{\fpeval{\TotalECC+\ListeComplete[\the\CompteurECC,2]}}% - \CompteurECC=\numexpr\CompteurECC+1% - }% - \num{\TotalECC}% -} - -\def\NewMPDiagBarreHorCode{% - Longueur:=\useKV[ClesStat]{Longueur}; - Hauteur:=\useKV[ClesStat]{Hauteur}; - Ecart:=\useKV[ClesStat]{EcartBarre}; - ExposantDivMax:=\ExposantDivMax; - ecarthachures=\useKV[ClesStat]{EcartHachures}; - epaisseurhachures=\useKV[ClesStat]{EpaisseurHachures}; - boolean Hachures,Bicolore,Grille,AffichageDonnee,LegendeVide; - Hachures=\useKV[ClesStat]{Hachures}; - Bicolore=\useKV[ClesStat]{Bicolore}; - Grille=\useKV[ClesStat]{Grille}; - AffichageDonnee=\useKV[ClesStat]{AffichageDonnee}; - LegendeVide=\useKV[ClesStat]{LegendeVide}; - vardef CalculNombreDonneesEtDonneeMax(text t)= - nbdon:=0;%nombre de données - DonneeMax:=0;%donnée DonneeMaximale - for p_=t: - nbdon:=nbdon+1; - if p_>DonneeMax: - DonneeMax:=p_; - fi; - endfor; - enddef; - vardef ListeDonnees(text t)= - n:=0; - for p_=t: - n:=n+1; - Donnees[n]:=p_; - endfor; - enddef; - vardef RecuperationCouleurs(text t)= - color Col[]; - n:=0; - for p_=t: - n:=n+1; - Col[n]=p_; - endfor; - enddef; -} - -% Construction d'un diagramme en barres horizontal -\newcommand\NewMPDiagBarreHor[4]{% - % #1 Liste des noms - % #2 Liste des valeurs associées - % #3 Liste des valeurs à afficher (si pb calcul MP) - % #4 Liste des couleurs - \ifluatex% - \mplibforcehmode% - \begin{mplibcode}% - \NewMPDiagBarreHorCode% - vardef TraceDiag= - if Grille: - pair Zz[];%Pour déterminer "le dernier point" - Zz0=(0,-(nbdon-1)*(Hauteur+Ecart)-Ecart); - Zz2=(0,(Hauteur+Ecart)); - Zz1=((1/DonneeMax)*Longueur,-(nbdon-1)*(Hauteur+Ecart)-Ecart); - Zz3=if ExposantDivMax=0 : (DonneeMax+1)[Zz0,Zz1] else: ((floor(DonneeMax*10+2))/10)[Zz0,Zz1];fi; - if ExposantDivMax=0: - for k=1 upto DonneeMax+1: - trace (Zz0--Zz2) shifted (k*(Zz1-Zz0)) dashed evenly withcolor 0.5white; - endfor; - else: - for k=1 upto (floor(DonneeMax*10+2)): - trace (Zz0--Zz2) shifted ((k/10)*(Zz1-Zz0)) dashed evenly withcolor 0.5white; - endfor; - fi; - if ExposantDivMax=0: - for k=1 upto (DonneeMax+1): - label.bot(TEX("\num{"&decimal(k)&"}"),Zz0+k*(Zz1-Zz0)); - endfor; - else: - if ExposantDivMax<5: - for k=1 upto (floor(DonneeMax*10+2)): - label.bot(TEX("\num{\fpeval{"&decimal(k)&"*(10**"&decimal(ExposantDivMax-1)&")}}"),Zz0+(k/10)*(Zz1-Zz0)); - endfor; - else: - dotlabel.bot(TEX("\num{\fpeval{10**"&decimal(ExposantDivMax)&"}}"),Zz1); - fi; - fi; - fi; - for k=0 upto nbdon-1: - path RectangleDonnee; - RectangleDonnee=(unitsquare xscaled ((Donnees[k+1]/DonneeMax)*Longueur) yscaled Hauteur) shifted(0,-k*(Hauteur+Ecart)); - if Hachures: - fill RectangleDonnee withcolor white; - trace Hachurage(RectangleDonnee,60 if - (k mod 2)=0: +90 fi,ecarthachures,if (k mod 2)=0 : 0 else: 1 fi) - withpen pencircle scaled epaisseurhachures; - else: - remplis RectangleDonnee withcolor if unknown Col[k+1]: if Bicolore:Col[(k mod 2)+1] else: white fi; else:if Bicolore:Col[(k mod 2)+1] else: Col[k+1] fi; fi; - fi; - trace RectangleDonnee; - endfor; - if Grille: - drawarrow (0,-(nbdon-1)*(Hauteur+Ecart)-Ecart)--(0,(Hauteur+Ecart)) withpen pencircle scaled 1.5; - drawarrow (0,-(nbdon-1)*(Hauteur+Ecart)-Ecart)--(Zz3+u*(0.25,0)) withpen pencircle scaled 1.5; - fi; - enddef; - vardef AffichageNom(text t)= - k:=0; - for p_=t: - label.lft(TEX(p_),0.5[(0,0),(0,Hauteur)] shifted (0,-k*(Hauteur+Ecart))); - k:=k+1; - endfor; - enddef; - vardef AffichageDonnees(text t)= - k:=0; - for p_=t: - label.rt(TEX("\num{"&p_&"}"),0.5[(0,0),(0,Hauteur)] shifted (((Donnees[k+1]/DonneeMax)*Longueur),-k*(Hauteur+Ecart))); - k:=k+1; - endfor; - enddef; - CalculNombreDonneesEtDonneeMax(#2); - ListeDonnees(#2); - RecuperationCouleurs(#4); - TraceDiag; - if LegendeVide=false: - AffichageNom(#1); - fi; - if AffichageDonnee: - AffichageDonnees(#3); - fi; - \end{mplibcode} - \else% - \begin{mpost}[mpsettings={\NewMPDiagBarreHorCode}] - vardef TraceDiag= - if Grille: - pair Zz[];%Pour déterminer "le dernier point" - Zz0=(0,-(nbdon-1)*(Hauteur+Ecart)-Ecart); - Zz2=(0,(Hauteur+Ecart)); - Zz1=((1/DonneeMax)*Longueur,-(nbdon-1)*(Hauteur+Ecart)-Ecart); - Zz3=if ExposantDivMax=0 : (DonneeMax+1)[Zz0,Zz1] else: ((floor(DonneeMax*10+2))/10)[Zz0,Zz1];fi; - if ExposantDivMax=0: - for k=1 upto DonneeMax+1: - trace (Zz0--Zz2) shifted (k*(Zz1-Zz0)) dashed evenly withcolor 0.5white; - endfor; - else: - for k=1 upto (floor(DonneeMax*10+2)): - trace (Zz0--Zz2) shifted ((k/10)*(Zz1-Zz0)) dashed evenly withcolor 0.5white; - endfor; - fi; - if ExposantDivMax=0: - for k=1 upto (DonneeMax+1): - label.bot(LATEX("\num{"&decimal(k)&"}"),Zz0+k*(Zz1-Zz0)); - endfor; - else: - if ExposantDivMax<5: - for k=1 upto (floor(DonneeMax*10+2)): - label.bot(LATEX("\num{\noexpand\fpeval{"&decimal(k)&"*(10**"&decimal(ExposantDivMax-1)&")}}"),Zz0+(k/10)*(Zz1-Zz0)); - endfor; - else: - dotlabel.bot(LATEX("\num{\noexpand\fpeval{10**"&decimal(ExposantDivMax)&"}}"),Zz1); - fi; - fi; - fi; - for k=0 upto nbdon-1: - path RectangleDonnee; - RectangleDonnee=(unitsquare xscaled ((Donnees[k+1]/DonneeMax)*Longueur) yscaled Hauteur) shifted(0,-k*(Hauteur+Ecart)); - if Hachures: - fill RectangleDonnee withcolor white; - trace Hachurage(RectangleDonnee,60 if - (k mod 2)=0: +90 fi,ecarthachures,if (k mod 2)=0 : 0 else: 1 fi) - withpen pencircle scaled epaisseurhachures; - else: - remplis RectangleDonnee withcolor if unknown Col[k+1]: if Bicolore:Col[(k mod 2)+1] else: white fi; else:if Bicolore:Col[(k mod 2)+1] else: Col[k+1] fi; fi; - fi; - trace RectangleDonnee; - endfor; - if Grille: - drawarrow (0,-(nbdon-1)*(Hauteur+Ecart)-Ecart)--(0,(Hauteur+Ecart)) withpen pencircle scaled 1.5; - drawarrow (0,-(nbdon-1)*(Hauteur+Ecart)-Ecart)--(Zz3+u*(0.25,0)) withpen pencircle scaled 1.5; - fi; - enddef; - vardef AffichageNom(text t)= - k:=0; - for p_=t: - label.lft(LATEX(p_),0.5[(0,0),(0,Hauteur)] shifted (0,-k*(Hauteur+Ecart))); - k:=k+1; - endfor; - enddef; - vardef AffichageDonnees(text t)= - k:=0; - for p_=t: - label.rt(LATEX("\num{"&p_&"}"),0.5[(0,0),(0,Hauteur)] shifted (((Donnees[k+1]/DonneeMax)*Longueur),-k*(Hauteur+Ecart))); - k:=k+1; - endfor; - enddef; - CalculNombreDonneesEtDonneeMax(#2); - ListeDonnees(#2); - RecuperationCouleurs(#4); - TraceDiag; - if LegendeVide=false: - AffichageNom(#1); - fi; - if AffichageDonnee: - AffichageDonnees(#3); - fi; - \end{mpost} - \fi% -}% - -\def\MPStatNewCode{% - maxx:=0; - maxy:=0; - unitex:=\useKV[ClesStat]{Unitex}*cm; - unitey:=\useKV[ClesStat]{Unitey}*cm; - xpartorigine:=\useKV[ClesStat]{Origine}; - AngleRotation=\useKV[ClesStat]{AngleRotationAbscisse}; - boolean Rotation,Lecture,LectureFine,AideLecture,DonneesSup,Reponses,Qualitatif,Tiret,LegendeVide,Retour,GrandNombrex,GrandNombrey,Date; - GrandNombrex=\useKV[ClesStat]{GrandNombrex}; - GrandNombrey=\useKV[ClesStat]{GrandNombrey}; - if GrandNombrex: - GrandNombreA=\useKV[ClesStat]{GrandNombreA}; - fi; - if GrandNombrey: - GrandNombreO=\useKV[ClesStat]{GrandNombreO}; - fi; - Date:=\useKV[ClesStat]{Date}; - Rotation=\useKV[ClesStat]{AbscisseRotation}; - Lecture:=\useKV[ClesStat]{Lecture}; - LectureFine:=\useKV[ClesStat]{LectureFine}; - AideLecture:=\useKV[ClesStat]{AideLecture}; - DonneesSup:=\useKV[ClesStat]{DonneesSup}; - Reponses:=\useKV[ClesStat]{Reponses}; - LegendeVide=\useKV[ClesStat]{LegendeVide}; - epaisseurbatons=\useKV[ClesStat]{EpaisseurBatons}; - Qualitatif=\useKV[ClesStat]{Qualitatif}; - Tiret=\useKV[ClesStat]{Tiret}; - Retour=false; - color CoulDefaut; - CoulDefaut=\useKV[ClesStat]{CouleurDefaut}; - Depart=\useKV[ClesStat]{Depart}; - % - pair A[],B[],P[]; - vardef toto(text t)=%points quantitatif - n:=0; - for p_=t: - if pair p_: - n:=n+1; - P[n]=((xpart(p_)-(xpartorigine))*unitex,ypart(p_)*unitey); - if xpart(p_)>maxx: - maxx:=xpart(p_)-(xpartorigine); - fi; - if ypart(p_)>maxy: - maxy:=ypart(p_); - fi; - A[n]=unitex*(xpart(p_)-(xpartorigine),0); - B[n]=unitey*(0,ypart(p_)); - fi; - endfor; - enddef; - vardef tutu(text t)=%points qualitatif - n:=0; - for p_=t: - if numeric p_: - P[n]=((n)*unitex,unitey*(p_-Depart)); - B[n]=(0,unitey*(p_-Depart)); - if p_>maxy: - maxy:=p_; - fi; - else: - n:=n+1; - A[n]=unitex*(n,0); - fi; - endfor; - maxy:=maxy-Depart; - maxx:=n; - enddef; -} - -% Construction du graphique en bâtons -\newcommand\MPStatNew[3]{% - \ifluatex - \mplibforcehmode - \begin{mplibcode} - \MPStatNewCode - % - vardef Test(expr nb)= - Retour:=false; - op:=0; - for l_=#3: - if l_=nb: - op:=op+1; - fi; - endfor; - if op>0: - Retour:=true; - fi; - enddef; - % - % on r\'ecup\`ere les couleurs - color Col[]; - n:=0; - for p_=#2: - n:=n+1; - if color p_: - Col[n]=p_; - else: - Col[n]=CoulDefaut; - fi; - endfor; - vardef tata(text t)=%affichage quantitatif - l=0; - for p_=t: - if pair p_: - l:=l+1; - if Rotation: - if Date: - label.bot(TEX(decimal(xpart(p_))) rotated AngleRotation,A[l]); - else: - label.bot(TEX("\num{"&decimal(xpart(p_))&"}") rotated AngleRotation,A[l]); - fi; - else : - if Date: - label.bot(TEX(decimal(xpart(p_))),A[l]); - else: - label.bot(TEX("\num{"&decimal(xpart(p_))&"}"),A[l]); - fi; - fi; - if Reponses: - if DonneesSup: - Test(l); - if Retour=false: - if GrandNombrey: - label.top(TEX("\num{"&decimal(ypart(p_))&"}"),P[l]); - else: - label.top(TEX("\num{"&decimal(ypart(p_))&"}"),P[l]); - fi; - fi; - else: - if Tiret: - trace (B[l]+(-1pt,0))--(B[l]+(1pt,0)); - label.lft(TEX("\num{"&decimal(p_)&"}"),B[l]); - else: - dotlabel.lft(TEX("\num{"&decimal(ypart(p_))&"}"),B[l]); - fi; - fi; - fi; - fi; - endfor; - enddef; - vardef titi(text t)=%affichage qualitatif - l:=0; - for p_=t: - if numeric p_: - if Reponses: - if DonneesSup: - Test(l); - if Retour=false: - label.top(TEX("\num{"&decimal(p_)&"}"),P[l]); - fi; - else: - if Tiret: - trace (B[l]+(-1pt,0))--(B[l]+(1pt,0)); - label.lft(TEX("\num{"&decimal(p_)&"}"),B[l]); - else: - dotlabel.lft(TEX("\num{"&decimal(p_)&"}"),B[l]); - fi; - fi; - fi; - else: - l:=l+1; - if Rotation: - if AngleRotation<>0: - picture TEXTELABEL; - TEXTELABEL=image( - labeloffset:=labeloffset*2; - label.lft(TEX(p_),A[l]); - labeloffset:=labeloffset/2; - ); - trace rotation(TEXTELABEL,A[l],AngleRotation); - else : - label.bot(TEX(p_),A[l]); - fi; - fi; - fi; - endfor; - enddef; - if Qualitatif: tutu(#1); else: toto(#1); fi; - boolean Grille; - Grille:=\useKV[ClesStat]{Grille}; - Pasx:=\useKV[ClesStat]{Pasx}; - Pasy:=\useKV[ClesStat]{Pasy}; - if Grille: - drawoptions(withcolor 0.75white); - for k=0 step Pasx until ((maxx+1)): - trace (k*unitex,0)--(k*unitex,unitey*(maxy+2*Pasy)); - endfor; - for k=0 step Pasy until ((maxy+2*Pasy)): - trace (0,k*unitey)--(unitex*(maxx+1),k*unitey); - endfor; - drawoptions(); - fi; - if epaisseurbatons<>0: - for k=1 upto n: - fill polygone(A[k]-(epaisseurbatons*1pt,0),A[k]+(epaisseurbatons*1pt,0),P[k]+(epaisseurbatons*1pt,0),P[k]-(epaisseurbatons*1pt,0)) withcolor if unknown Col[k]: CoulDefaut else:Col[k] fi; - if AideLecture: - draw B[k]--P[k] dashed evenly; - fi; - endfor; - fi; - if LectureFine: - for k=0 step Pasy until ((maxy+1*Pasy)): - if Tiret: - trace (1pt,k*unitey)--(-1pt,k*unitey); - if GrandNombrey: - label.lft(TEX("\num{\fpeval{\useKV[ClesStat]{GrandNombreO}*"&decimal(k+Depart)&"}}"),(0,k*unitey)); - else: - label.lft(TEX("\num{"&decimal(k+Depart)&"}"),(0,k*unitey)); - fi; - else: - if GrandNombrey: - dotlabel.lft(TEX("\num{\fpeval{\useKV[ClesStat]{GrandNombreO}*"&decimal(k+Depart)&"}}"),(0,k*unitey)); - else: - dotlabel.lft(TEX("\num{"&decimal(k+Depart)&"}"),(0,k*unitey)); - fi; - fi; - endfor; - fi; - if Lecture: - for k=0 step Pasy until Pasy: - if Tiret: - trace (1pt,k*unitey)--(-1pt,k*unitey); - if GrandNombrey: - label.lft(TEX("\num{\fpeval{\useKV[ClesStat]{GrandNombreO}*"&decimal(k)&"}}"),(0,k*unitey)); - else: - label.lft(TEX("\num{"&decimal(k)&"}"),(0,k*unitey)); - fi; - else: - if GrandNombrey: - dotlabel.lft(TEX("\num{\fpeval{\useKV[ClesStat]{GrandNombreO}*"&decimal(k)&"}}"),(0,k*unitey)); - else: - dotlabel.lft(TEX("\num{"&decimal(k)&"}"),(0,k*unitey)); - fi; - fi; - endfor; - fi; - drawarrow (0,0)--unitex*(maxx+1,0); - drawarrow (0,0)--unitey*(0,maxy+2*Pasy); - label.lrt(btex \useKV[ClesStat]{Donnee} etex,unitex*(maxx+1,0)); - label.urt(btex \useKV[ClesStat]{Effectif} etex,unitey*(0,maxy+2*Pasy)); - if Qualitatif: titi(#1); else:tata(#1); fi; - \end{mplibcode} - \else - \begin{mpost}[mpsettings={\MPStatNewCode}] - % on r\'ecup\`ere les couleurs - color Col[]; - n:=0; - for p_=#2: - n:=n+1; - if color p_: - Col[n]=p_; - else: - Col[n]=CoulDefaut; - fi; - endfor; - % - vardef tata(text t)=%affichage quantitatif - l=0; - for p_=t: - if pair p_: - l:=l+1; - if Rotation: - label.bot(LATEX("\num{"&decimal(xpart(p_))&"}") rotated AngleRotation,A[l]); - else : - label.bot(LATEX("\num{"&decimal(xpart(p_))&"}"),A[l]); - fi; - if Reponses: - if DonneesSup: - label.top(LATEX("\num{"&decimal(ypart(p_))&"}"),P[l]); - else: - if Tiret: - trace (B[l]+(-1pt,0))--(B[l]+(1pt,0)); - label.lft(LATEX("\num{"&decimal(p_)&"}"),B[l]); - else: - dotlabel.lft(LATEX("\num{"&decimal(ypart(p_))&"}"),B[l]); - fi; - fi; - fi; - fi; - endfor; - enddef; - vardef titi(text t)=%affichage qualitatif - l:=0; - for p_=t: - if numeric p_: - if Reponses: - if DonneesSup: - label.top(LATEX("\num{"&decimal(p_)&"}"),P[l]); - else: - if Tiret: - trace (B[l]+(-1pt,0))--(B[l]+(1pt,0)); - label.lft(LATEX("\num{"&decimal(p_)&"}"),B[l]); - else: - dotlabel.lft(LATEX("\num{"&decimal(p_)&"}"),B[l]); - fi; - fi; - fi; - else: - l:=l+1; - if Rotation: - if AngleRotation<>0: - picture TEXTELABEL; - TEXTELABEL=image( - labeloffset:=labeloffset*2; - label.lft(LATEX(p_),A[l]); - labeloffset:=labeloffset/2; - ); - trace rotation(TEXTELABEL,A[l],AngleRotation); - else : - label.bot(LATEX(p_),A[l]); - fi; - fi; - fi; - endfor; - enddef; - if Qualitatif: tutu(#1); else: toto(#1); fi; - boolean Grille; - Grille:=\useKV[ClesStat]{Grille}; - Pasx:=\useKV[ClesStat]{Pasx}; - Pasy:=\useKV[ClesStat]{Pasy}; - if Grille: - drawoptions(withcolor 0.75white); - for k=0 step Pasx until ((maxx+1)): - trace (k*unitex,0)--(k*unitex,unitey*(maxy+2*Pasy)); - endfor; - for k=0 step Pasy until ((maxy+2*Pasy)): - trace (0,k*unitey)--(unitex*(maxx+1),k*unitey); - endfor; - drawoptions(); - fi; - if epaisseurbatons<>0: - for k=1 upto n: - fill polygone(A[k]-(epaisseurbatons*1pt,0),A[k]+(epaisseurbatons*1pt,0),P[k]+(epaisseurbatons*1pt,0),P[k]-(epaisseurbatons*1pt,0)) withcolor if unknown Col[k]: CoulDefaut else:Col[k] fi; - if AideLecture: - draw B[k]--P[k] dashed evenly; - fi; - endfor; - fi; - if LectureFine: - for k=0 step Pasy until ((maxy+1*Pasy)): - if Tiret: - trace (1pt,k*unitey)--(-1pt,k*unitey); - label.lft(LATEX("\num{"&decimal(k)&"}"),(0,k*unitey)); - else: - dotlabel.lft(LATEX("\num{"&decimal(k)&"}"),(0,k*unitey)); - fi; - endfor; - fi; - if Lecture: - for k=0 step Pasy until Pasy: - if Tiret: - trace (1pt,k*unitey)--(-1pt,k*unitey); - label.lft(LATEX("\num{"&decimal(k)&"}"),(0,k*unitey)); - else: - dotlabel.lft(LATEX("\num{"&decimal(k)&"}"),(0,k*unitey)); - fi; - endfor; - fi; - drawarrow (0,0)--unitex*(maxx+1,0); - drawarrow (0,0)--unitey*(0,maxy+2*Pasy); - label.lrt(btex \useKV[ClesStat]{Donnee} etex,unitex*(maxx+1,0)); - label.urt(btex \useKV[ClesStat]{Effectif} etex,unitey*(0,maxy+2*Pasy)); - if Qualitatif: titi(#1); else:tata(#1); fi; - \end{mpost} - \fi -} - -\def\NewMPStatCirculaireCodeQ{% - Rayon:=\useKV[ClesStat]{Rayon}; - ecarthachures=\useKV[ClesStat]{EcartHachures}; - epaisseurhachures=\useKV[ClesStat]{EpaisseurHachures}; - boolean AffichageAngle,AffichageDonnee,Hachures,Inverse,Legende,LegendeVide,Retour,ACompleter; - AffichageAngle=\useKV[ClesStat]{AffichageAngle}; - AffichageDonnee=\useKV[ClesStat]{AffichageDonnee}; - Hachures=\useKV[ClesStat]{Hachures}; - Inverse=\useKV[ClesStat]{LectureInverse}; - Legende=\useKV[ClesStat]{Legende}; - LegendeVide=\useKV[ClesStat]{LegendeVide}; - Retour=false; - ACompleter=\useKV[ClesStat]{ACompleter}; - % - pair A[],O,B[],C[],D[]; - O=(0,0); - n:=0; - numeric total[],ang[]; - total[0]=0; - ang[0]:=0; - path cc; - cc=(fullcircle scaled (2*Rayon)); - % - vardef AfficheLegende(text t)= - picture ResultatLegende; - ResultatLegende=image( - for p_=t: - if string p_: - n:=n+1; - C[n]=A[n-1] rotatedabout(O,if Inverse:-1* fi(ang[n]-ang[n-1])/2); - draw 0.95[O,C[n]]--1.05[O,C[n]]; - C[n]:=1.05[O,C[n]]; - Test(n); - if ((xpart(C[n])>xpart(O)) or (xpart(C[n])=xpart(O))) and ((ypart(C[n])>ypart(O)) or (ypart(C[n])=ypart(O))): - D[n]=C[n]+(0.5cm,0); - draw C[n]--D[n]; - if Retour=false:label.urt(TEX(p_),D[n]);fi; - fi; - if (xpart(C[n])ypart(O)) or (ypart(C[n])=ypart(O))): - D[n]=C[n]-(0.5cm,0); - draw C[n]--D[n]; - if Retour=false:label.ulft(TEX(p_),D[n]);fi; - fi; - if (xpart(C[n])xpart(O)) or (xpart(C[n])=xpart(O))) and (ypart(C[n])xpart(O)) and ((ypart(C[n])>ypart(O)) or (ypart(C[n])=ypart(O))): - D[n]=C[n]+(0.5cm,0); - draw C[n]--D[n]; - if Retour=false:label.urt(LATEX(p_),D[n]);fi; - fi; - if (xpart(C[n])ypart(O)) or (ypart(C[n])=ypart(O))): - D[n]=C[n]-(0.5cm,0); - draw C[n]--D[n]; - if Retour=false:label.ulft(LATEX(p_),D[n]);fi; - fi; - if (xpart(C[n])xpart(O)) and (ypart(C[n])15: - if (n mod 2)=0: - marque_a:=20*0.75*Rayon/cm; - else: - marque_a:=20*0.5*Rayon/cm; - fi; - if Hachures: - if Inverse=false: - undraw - Codeangle(A[n-1],O,A[n],0,(((TEX("\ang{"&decimal(round(p_*(#2/total[N])))&"}"))))); - else: - undraw - Codeangle(A[n],O,A[n-1],0,(((TEX("\ang{"&decimal(round(p_*(#2/total[N])))&"}"))))); - fi; - fill cercles(w shifted(marque_ang*unitvector(w-O)),3mm) withcolor - blanc; - fi; - if Inverse=false: - draw - Codeangle(A[n-1],O,A[n],0,(((TEX("\ang{"&decimal(round(p_*(#2/total[N])))&"}"))))); - else: - draw - Codeangle(A[n],O,A[n-1],0,(((TEX("\ang{"&decimal(round(p_*(#2/total[N])))&"}"))))); - fi; - fi; - elseif AffichageDonnee: - if round(p_*(#2/total[N]))>15: - if (n mod 2)=0: - marque_a:=20*0.75*Rayon/cm; - else: - marque_a:=20*0.5*Rayon/cm; - fi; - if Hachures: - if Inverse=false: - undraw - Codeangle(A[n-1],O,A[n],0,TEX(""&decimal(p_)&"")); - else: - undraw - Codeangle(A[n],O,A[n-1],0,(((TEX(""&decimal(p_)&""))))); - fi; - fill cercles(w shifted(marque_ang*unitvector(w-O)),3mm) withcolor - blanc; - fi; - if Inverse=false: - draw - Codeangle(A[n-1],O,A[n],0,(((TEX(""&decimal(p_)&""))))); - else: - draw - Codeangle(A[n],O,A[n-1],0,(((TEX(""&decimal(p_)&""))))); - fi; - fi; - fi; - % - fi; - endfor; - if #2=360: - draw cc if Hachures: withpen pencircle scaled2 fi; - else: - draw (subpath(0,length cc/2) of cc)--cycle if Hachures: withpen pencircle scaled2 fi;; - fi; - n:=0; - enddef; - vardef Test(expr nb)= - Retour:=false; - op:=0; - for l_=#4: - if l_=nb: - op:=op+1; - fi; - endfor; - if op>0: - Retour:=true; - fi; - enddef; - Figure(-10u,-10u,10u,10u); - toto(#1); - if Legende: - n:=0; - draw AfficheLegende(#1); - fi; - \end{mplibcode} - \else - \begin{mpost}[mpsettings={\NewMPStatCirculaireCodeQ}] - pair A[],O,B[],C[],D[]; - O=(0,0); - n:=0; - numeric total[],ang[]; - total[0]=0; - ang[0]:=0; - path cc; - cc=(fullcircle scaled (2*Rayon)); - % on r\'ecup\`ere les couleurs - color Col[]; - n:=0; - for p_=#3: - n:=n+1; - Col[n]=p_; - endfor; - if Inverse=false: - A[0]=point(0) of cc; - else: - A[0]=point(180) of cc; - fi; - vardef toto(text t)= - n:=0; - for p_=t: - if numeric p_: - n:=n+1; - total[n]:=total[n-1]+p_; - fi; - endfor; - N=n; - for k=1 upto N: - ang[k]=(#2/total[N])*total[k]; - endfor; - n:=0; - for p_=t: - if numeric p_: - n:=n+1; - if Inverse=false: - A[n]=A[n-1] rotatedabout(O,p_*(#2/total[N])); - else: - A[n]=A[n-1] rotatedabout(O,-p_*(#2/total[N])); - fi; - %hachure ou pas ? - if Hachures=false: - fill (O--if Inverse=false:arccercle(A[n-1],A[n],O) else: - arccercle(A[n],A[n-1],O) fi--cycle) withcolor if unknown Col[n]: white else:Col[n] fi; - else: - draw - Hachurage((O--if Inverse=false:arccercle(A[n-1],A[n],O) - else:arccercle(A[n],A[n-1],O) fi--cycle),p_*(#2/total[N]) if - (n mod 2)=0: +90 else: -90 fi,ecarthachures,if (n mod 2)=0 : 0 else: 1 fi) - withpen pencircle scaled epaisseurhachures if AffichageAngle: withcolor 0.5white fi; - fi; - if ACompleter=false: - draw A[n-1]--O--A[n] if Hachures: withpen pencircle scaled2 fi; - fi; - % Affichage des angles associ\'es - if AffichageAngle: - if round(p_*(#2/total[N]))>15: - if (n mod 2)=0: - marque_a:=20*0.75*Rayon/cm; - else: - marque_a:=20*0.5*Rayon/cm; - fi; - if Hachures: - if Inverse=false: - undraw - Codeangle(A[n-1],O,A[n],0,(((LATEX("\ang{"&decimal(round(p_*(#2/total[N])))&"}"))))); - else: - undraw - Codeangle(A[n],O,A[n-1],0,(((LATEX("\ang{"&decimal(round(p_*(#2/total[N])))&"}"))))); - fi; - fill cercles(w shifted(marque_ang*unitvector(w-O)),3mm) withcolor - blanc; - fi; - if Inverse=false: - draw - Codeangle(A[n-1],O,A[n],0,(((LATEX("\ang{"&decimal(round(p_*(#2/total[N])))&"}"))))); - else: - draw - Codeangle(A[n],O,A[n-1],0,(((LATEX("\ang{"&decimal(round(p_*(#2/total[N])))&"}"))))); - fi; - fi; - elseif AffichageDonnee: - if round(p_*(#2/total[N]))>15: - if (n mod 2)=0: - marque_a:=20*0.75*Rayon/cm; - else: - marque_a:=20*0.5*Rayon/cm; - fi; - if Hachures: - if Inverse=false: - undraw - Codeangle(A[n-1],O,A[n],0,LATEX(""&decimal(p_)&"")); - else: - undraw - Codeangle(A[n],O,A[n-1],0,(((LATEX(""&decimal(p_)&""))))); - fi; - fill cercles(w shifted(marque_ang*unitvector(w-O)),3mm) withcolor - blanc; - fi; - if Inverse=false: - draw - Codeangle(A[n-1],O,A[n],0,(((LATEX(""&decimal(p_)&""))))); - else: - draw - Codeangle(A[n],O,A[n-1],0,(((LATEX(""&decimal(p_)&""))))); - fi; - fi; - fi; - % - fi; - endfor; - if #2=360: - draw cc if Hachures: withpen pencircle scaled2 fi; - else: - draw (subpath(0,length cc/2) of cc)--cycle if Hachures: withpen pencircle scaled2 fi;; - fi; - enddef; - vardef Test(expr nb)= - Retour:=false; - op:=0; - for l_=#4: - if l_=nb: - op:=op+1; - fi; - endfor; - if op>0: - Retour:=true; - fi; - enddef; - Figure(-10u,-10u,10u,10u); - toto(#1); - if Legende: - n:=0; - draw AfficheLegendePDF(#1); - fi; - \end{mpost} - \fi -}% - -%Pour la m\'ediane. -\DTLgnewdb{mtdb}% -\dtlexpandnewvalue% -\newcount\nbdonnees% -% -\def\AjoutListEEaa#1\nil{\addtotok\tabtoksEEa{#1,}}% -\def\AjoutListEEab#1\nil{\addtotok\tabtoksEEa{#1/}}% -\def\AjoutListEEb#1\nil{\addtotok\tabtoksEEb{#1,}}% -\def\AjoutListEEx#1\nil{\addtotok\tabtoksEE{#1,}}% -\def\AjoutListEEy#1\nil{\addtotok\tabtoksEE{#1/}}% - -\DTLgnewdb{mtdbEE}% -\DTLgnewdb{mtdbEEqual}% -% - -% Pour les classes -% Pour construire l'histogramme -\def\UpdatetoksHisto#1/#2/#3\nil{\addtotok\toklisteelmtsclasse{#1,#2,}\addtotok\toklistedonhisto{#3,}} -\def\UpdatetoksECC#1\nil{\addtotok\toklistedonhisto{#1,}} - -\NewDocumentCommand\buildgraphhisto{}{% - \newtoks\toklisteelmtsclasse% - \newtoks\toklistedonhisto% - \newtoks\toklistecouleur% - \newtoks\toklistelegende% - \ifboolKV[ClesStat]{LegendeVide}{% - \xdef\foo{\useKV[ClesStat]{LegendesVides}}% - \readlist*\ListeLegendesAEffacer{\foo}% - }{\xdef\foo{-1}\readlist*\ListeLegendesAEffacer{\foo}% - }% - \foreachitem\compteur\in\ListeLegendesAEffacer{\expandafter\UpdateLegende\compteur\nil}% - \foreachitem\compteur\in\ListeDepart{\expandafter\UpdatetoksHisto\compteur\nil}% - \ifboolKV[ClesStat]{ECC}{% - \toklistedonhisto{}% - \xdef\PfCFooECC{\ListeDepart[1,3]}% - \xintFor* ##1 in{\xintSeq{2}{\ListeDepartlen}}\do{% - \xdef\PfCFooRetiens{0}% - \xintFor* ##2 in{\xintSeq{1}{##1}}\do{% - \xdef\PfCFooRetiens{\fpeval{\PfCFooRetiens+\ListeDepart[##2,3]}}% - }% - \xdef\PfCFooECC{\PfCFooECC,\PfCFooRetiens}% - }% - \readlist*\PfCListeECC{\PfCFooECC}% - \foreachitem\compteur\in\PfCListeECC{\expandafter\UpdatetoksECC\compteur\nil}% - }{}% - \xdef\PfCEcartClasse{\fpeval{\ListeDepart[1,2]-\ListeDepart[1,1]}}% - \foreachitem\compteur\in\ListeDepart{% - \xdef\PfCEcartClasse{\PfCEcartClasse,\fpeval{\ListeDepart[\compteurcnt,2]-\ListeDepart[\compteurcnt,1]}} - }% - \xintifboolexpr{\fpeval{min(\PfCEcartClasse)}==\fpeval{max(\PfCEcartClasse)}}{}{\setKV[ClesStat]{MemeAmpli=false}} - % Pour les couleurs - \xdef\ListeAvantCouleurs{\useKV[ClesStat]{ListeCouleurs}}% - \readlist*\ListeCouleur{\ListeAvantCouleurs}% - \foreachitem\couleur\in\ListeCouleur{\expandafter\UpdateCoul\couleur\nil}% - % - \MPBuildHisto{\the\toklisteelmtsclasse}{\the\toklistedonhisto}{\the\toklistecouleur}{\the\toklistelegende}% -} - -%% calcul des fr\'equences -\newcommand\CalculFrequenceClasses[1]{% - \fpeval{round(\ListeDepart[#1,3]*100/\EffectifTotal,\useKV[ClesStat]{PrecisionF})} -} - -\newcommand\CalculECCClasses[1]{% - \xdef\TotalECCC{0}% - \CompteurECCC=1% - \CompteurECCCTotal=\numexpr#1+1% - \whiledo{\CompteurECCC < \CompteurECCCTotal}{% - \xdef\TotalECCC{\fpeval{\TotalECCC+\ListeDepart[\the\CompteurECCC,3]}}% - \CompteurECCC=\numexpr\CompteurECCC+1% - }% - \num{\TotalECCC}% -} - -\NewDocumentCommand\buildtabclasses{}{% - \setcounter{PfCCompteLignes}{0}% - \renewcommand{\arraystretch}{\useKV[ClesStat]{Stretch}}% - \begin{NiceTabular}{l*{\ListeDepartlen}{c}}%[hvlines] - \CodeBefore% - \rowcolor{\useKV[ClesStat]{CouleurTab}}{1}% - \columncolor{\useKV[ClesStat]{CouleurTab}}{1}% - \Body - \useKV[ClesStat]{Donnee}\xintFor* ##1 in{\xintSeq{1}{\ListeDepartlen}}\do{% - &$\num{\ListeDepart[##1,1]}\leqslant\dots<\num{\ListeDepart[##1,2]}$ - }\\ - \useKV[ClesStat]{Effectif}\xintFor* ##1 in{\xintSeq{1}{\ListeDepartlen}}\do{% - &\ifboolKV[ClesStat]{EffVide}{}{\num{\ListeDepart[##1,3]}}% - }\\ - \ifboolKV[ClesStat]{Frequence}{\stepcounter{PfCCompteLignes}Fr\'equence (\%)\xintFor* ##1 in {\xintSeq {1}{\ListeDepartlen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{\num{\CalculFrequenceClasses{##1}}}}}\\ - }{}% - \ifboolKV[ClesStat]{ECC}{\stepcounter{PfCCompteLignes}E.C.C.\xintFor* ##1 in {\xintSeq {1}{\ListeDepartlen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{ECCVide}{}{\CalculECCClasses{##1}}}}\\}{}% - \CodeAfter% - % On crée la liste des colonnes à vider - \xintifboolexpr{\useKV[ClesStat]{ColVide}>0}{% - \xdef\FooStat{\useKV[ClesStat]{ColVide}}% - \setsepchar{,}% - \readlist*\ListeColonnesAVider{\FooStat}% - \foreachitem\compteur\in\ListeColonnesAVider{% - \tikz\fill[white] (row-2-|col-\fpeval{\compteur+1}) rectangle (last-|col-\fpeval{\compteur+2});% - }% - }{}% -% % On crée la liste des cases à vider - \ifboolKV[ClesStat]{CaseVide}{% - \xdef\FooStatCases{\useKV[ClesStat]{CasesVides}}% - \setsepchar[*]{,*/}% - \readlist*\ListeCasesAVider{\FooStatCases}% - \foreachitem\compteur\in\ListeCasesAVider{% - \tikz\fill[white] (row-\fpeval{\ListeCasesAVider[\compteurcnt,1]+1}-|col-\fpeval{\ListeCasesAVider[\compteurcnt,2]+1}) rectangle (row-\fpeval{\ListeCasesAVider[\compteurcnt,1]+2}-|col-\fpeval{\ListeCasesAVider[\compteurcnt,2]+2});% - }% - }{}% -% % On retrace le tableau -% % Les colonnes - \xintFor* ##1 in {\xintSeq{1}{\fpeval{\ListeDepartlen+2}}}\do{% - \tikz\draw (row-1-|col-##1) -- (last-|col-##1);% - }% -% % Les lignes - \xintFor* ##1 in {\xintSeq{1}{\fpeval{\thePfCCompteLignes+3}}}\do{% - \tikz\draw (row-##1-|col-1) -- (row-##1-|last);% - }% - \end{NiceTabular} -}% - -\NewDocumentCommand\MPBuildHisto{mmmm}{% - \ifluatex - \mplibforcehmode - \begin{mplibcode} - maxx:=-infinity; - minx:=infinity; - maxy:=-infinity; - miny:=0; - unitex:=\useKV[ClesStat]{Unitex}*cm; - unitey:=\useKV[ClesStat]{Unitey}*cm; - Pasx:=\useKV[ClesStat]{Pasx}; - Pasy:=\useKV[ClesStat]{Pasy}; - UniteAire=\useKV[ClesStat]{UniteAire}; - Ecarthachures=\useKV[ClesStat]{EcartHachures}; - Epaisseurhachures=\useKV[ClesStat]{EpaisseurHachures}; - boolean MemeAmpli,Hachures,Lecture,LectureFine,AideLecture,DonneesSup,Tiret,LegendeVide,Retour,Mediane,ECC; - ECC=\useKV[ClesStat]{ECC}; - Mediane=\useKV[ClesStat]{Mediane}; - MemeAmpli=\useKV[ClesStat]{MemeAmpli}; - Hachures:=\useKV[ClesStat]{Hachures}; - % - Lecture:=\useKV[ClesStat]{Lecture}; - LectureFine:=\useKV[ClesStat]{LectureFine}; - Tiret=\useKV[ClesStat]{Tiret}; - AideLecture:=\useKV[ClesStat]{AideLecture}; - DonneesSup:=\useKV[ClesStat]{DonneesSup}; - LegendeVide=\useKV[ClesStat]{LegendeVide}; - Retour=false; - % Test affichage - vardef Test(expr nb)= - Retour:=false; - op:=0; - for l_=#4: - if l_=nb: - op:=op+1; - fi; - endfor; - if op>0: - Retour:=true; - fi; - enddef; - %Affichage ou pas des légendes - vardef AfficheLegende(text t)= - l=0; - for p_=t: - l:=l+1; - if DonneesSup: - Test(l); - if Retour=false: - label.top(TEX("\num{"&decimal(Y[l])&"}"),(unitex*(Depart+(0.5*(X[2*l]+X[2*l-2])-X[1])/Pasx),unitey*Z[l])); - fi; - fi; - endfor; - enddef; - % on r\'ecup\`ere les couleurs - Depart=\useKV[ClesStat]{DepartHisto}; - color Col[],CoulDefaut; - CoulDefaut=white; - n:=0; - for p_=#3: - n:=n+1; - Col[n]=p_; - endfor; - % - numeric X[]; - numeric ecartabs[]; - vardef RecupValeursAbscisses(text t)= - p:=0; - for p_=t: - p:=p+1; - X[p]:=p_; - if X[p]maxx: - maxx:=X[p]; - fi; - endfor; - X[0]=X[1]; - TotalAbscisses=p; - enddef; - numeric Y[],Z[]; - numeric EffectifTotal[]; - numeric EffectifTotalA[]; - vardef RecupValeursDonnees(text t)= - p:=0; - EffectifTotal[0]:=0; - EffectifTotalA[0]:=0; - for p_=t: - p:=p+1; - EffectifTotal[p]:=p_; - EffectifTotalA[p]:=EffectifTotalA[p-1]+p_; - Y[p]:=p_; - Z[p]=(Y[p]/(UniteAire*(X[2*p]-X[2*p-1])/Pasx)); - R[p]=ceiling(Z[p]); - if R[p]>maxy: - maxy:=R[p]; - fi; - endfor; - NbDonnees:=p; - enddef; - %On affiche la médiane dans le cas des ECC - vardef AfficheMedianeECC(text t)= - YMed:=Z[NbDonnees]/2; - DemiDonnees:=EffectifTotal[NbDonnees]/2; - p:=0; - forever: - p:=p+1; - exitif EffectifTotal[p]>DemiDonnees; - endfor; - path MedHor,MedLineaire,MedVer; - MedLineaire=(unitex*(Depart+(X[2*p-2]-X[1]/Pasx)),unitey*Z[p-1])--(unitex*(Depart+(X[2*p]-X[1])/Pasx),unitey*Z[p]); - MedHor=((0,unitey*YMed)--(unitex*((maxx-minx)/Pasx+2),unitey*YMed)); - MedVer=(xpart(MedLineaire intersectionpoint MedHor),0)--(MedLineaire intersectionpoint MedHor); - draw MedLineaire; - draw MedHor; - draw MedVer; - enddef; - % On affiche la médiane dans le cas non ECC - vardef AfficheMediane(text t)= - DemiDonnees:=EffectifTotalA[NbDonnees]/2; - p:=0; - forever: - p:=p+1; - exitif EffectifTotalA[p]>DemiDonnees; - endfor; - path MedVer; - numeric CoefLineaire,pMed; - pMed=p; - CoefLineaire=(DemiDonnees-EffectifTotalA[p-1])/Y[p]; - MedVer=(unitex*(Depart+(X[2*p-2]-X[1])/Pasx+CoefLineaire*(X[2*p]-X[2*p-2])/Pasx),0)--(unitex*(Depart+(X[2*p-2]-X[1])/Pasx+CoefLineaire*(X[2*p]-X[2*p-2])/Pasx),unitey*Z[p]); - draw MedVer dashed evenly; - enddef; - % On commence le tracé : on récupère les informations - RecupValeursAbscisses(#1); - RecupValeursDonnees(#2); - % on définit une grille - vardef Grille= - if MemeAmpli: - Ajout:=1; - else: - Ajout:=3; - fi; - drawoptions(withcolor 0.7white); - for k=0 upto ((maxx-minx)/Pasx+2): - trace (unitex*k,0)--(unitex*k,(maxy+Ajout)*unitey);%withcolor red; - endfor; - for k=0 upto (maxy+Ajout): - trace (0,k*unitey)--(unitex*((maxx-minx)/Pasx+2),k*unitey);% withcolor blue; - endfor; - drawoptions(); - enddef; - % Fin Grille - % On trace les rectangles - vardef AfficheRectangles= - if Hachures: - Grille; - for k=2 step 2 until TotalAbscisses: - draw hachurage(polygone(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0)),60,0.2,0); - draw chemin(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0)); - endfor; - else: - for k=2 step 2 until TotalAbscisses: - fill polygone(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0)) withcolor if unknown Col[k/2]: CoulDefaut else: Col[k/2] fi; - endfor; - Grille; - for k=2 step 2 until TotalAbscisses: - draw chemin(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0)); - endfor; - fi; - enddef; - % Affichage final - if ECC: - AfficheRectangles; - if Mediane: - AfficheMedianeECC(#2); - fi; - else: - if Mediane: - AfficheMediane(#2); - if Hachures: - Grille; - %Partie gauche - for k=2 step 2 until (2*pMed-2): - draw hachurage(polygone(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0)),60,0.2,0); - draw chemin(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0)); - endfor; - draw hachurage(polygone(unitex*(Depart+(X[2*pMed-2]-X[1])/Pasx,0),point(0) of MedVer,point(1) of MedVer,(unitex*(Depart+(X[2*pMed-2]-X[1])/Pasx),unitey*Z[pMed])),60,0.2,0); - draw polygone(unitex*(Depart+(X[2*pMed-2]-X[1])/Pasx,0),point(0) of MedVer,point(1) of MedVer,(unitex*(Depart+(X[2*pMed-2]-X[1])/Pasx),unitey*Z[pMed])); - % Partie droite - for k=2*pMed+2 step 2 until TotalAbscisses: - draw hachurage(polygone(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0)),120,0.2,1); - draw chemin(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0)); - endfor; - draw hachurage(polygone(unitex*(Depart+(X[2*pMed]-X[1])/Pasx,0),point(0) of MedVer,point(1) of MedVer,(unitex*(Depart+(X[2*pMed]-X[1])/Pasx),unitey*Z[pMed])),120,0.2,1); - draw polygone(unitex*(Depart+(X[2*pMed]-X[1])/Pasx,0),point(0) of MedVer,point(1) of MedVer,(unitex*(Depart+(X[2*pMed]-X[1])/Pasx),unitey*Z[pMed])); - else: - %Partie gauche - for k=2 step 2 until (2*pMed-2): - fill polygone(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0)) withcolor if unknown Col[1]: CoulDefaut else: Col[1] fi; - endfor; - fill polygone(unitex*(Depart+(X[2*pMed-2]-X[1])/Pasx,0),point(0) of MedVer,point(1) of MedVer,(unitex*(Depart+(X[2*pMed-2]-X[1])/Pasx),unitey*Z[pMed])) withcolor if unknown Col[1]: CoulDefaut else: Col[1] fi ; - % Partie droite - for k=2*pMed+2 step 2 until TotalAbscisses: - fill polygone(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0)) withcolor if unknown Col[2]: CoulDefaut else: Col[2] fi; - endfor; - fill polygone(unitex*(Depart+(X[2*pMed]-X[1])/Pasx,0),point(0) of MedVer,point(1) of MedVer,(unitex*(Depart+(X[2*pMed]-X[1])/Pasx),unitey*Z[pMed])) withcolor if unknown Col[2]: CoulDefaut else: Col[2] fi; - Grille; - %Partie Gauche - for k=2 step 2 until (2*pMed-2): - trace polygone(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0)); - endfor; - trace polygone(unitex*(Depart+(X[2*pMed-2]-X[1])/Pasx,0),point(0) of MedVer,point(1) of MedVer,(unitex*(Depart+(X[2*pMed-2]-X[1])/Pasx),unitey*Z[pMed]));%(Y[pMed]/(UniteAire*(X[2*pMed-2]-X[2*pMed-3])/Pasx)))); - for k=2*pMed+2 step 2 until TotalAbscisses: - draw chemin(unitex*(Depart+(X[k]-X[1])/Pasx,0),(unitex*(Depart+(X[k]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),unitey*(Y[k/2]/(UniteAire*(X[k]-X[k-1])/Pasx))),(unitex*(Depart+(X[k-1]-X[1])/Pasx),0)); - endfor; - draw polygone(unitex*(Depart+(X[2*pMed]-X[1])/Pasx,0),point(0) of MedVer,point(1) of MedVer,(unitex*(Depart+(X[2*pMed]-X[1])/Pasx),unitey*Z[pMed])); - fi; - draw MedVer withpen pencircle scaled 2; - else: - AfficheRectangles; - fi; - fi; - %Affichage ou pas des axes, de la médiane - if MemeAmpli: - drawarrow (0,0)--unitey*(0,maxy+1); - EcartAmpli:=(X[2]-X[1])/Pasx; - if AideLecture: - for k=2 step 2 until TotalAbscisses: - trace ((unitex*(Depart+(X[k]-X[1])/Pasx),unitey*Z[k/2]))--(unitey*(0,Z[k/2])) dashed evenly; - endfor; - fi; - if LectureFine: - for k=0 upto ((maxy+1)): - if Tiret: - trace (1pt,k*unitey)--(-1pt,k*unitey); - label.lft(TEX("\num{"&decimal(k*UniteAire*EcartAmpli)&"}"),(0,k*unitey)); - else: - dotlabel.lft(TEX("\num{"&decimal(k*UniteAire*EcartAmpli)&"}"),(0,k*unitey)); - fi; - endfor; - fi; - if Lecture: - for k=0 upto 1: - if Tiret: - trace (1pt,k*unitey)--(-1pt,k*unitey); - label.lft(TEX("\num{"&decimal(k*UniteAire*EcartAmpli)&"}"),(0,k*unitey)); - else: - dotlabel.lft(TEX("\num{"&decimal(k*UniteAire*EcartAmpli)&"}"),(0,k*unitey)); - fi; - endfor; - fi; - else:%Pas même ampli : on n'affiche pas l'axe vertical - trace hachurage(polygone((unitex,unitey*(maxy+2)),(unitex*2,unitey*(maxy+2)),(unitex*2,unitey*(maxy+1)),(unitex,unitey*(maxy+1))),60,0.2,0); - trace polygone((unitex,unitey*(maxy+2)),(unitex*2,unitey*(maxy+2)),(unitex*2,unitey*(maxy+1)),(unitex,unitey*(maxy+1))); - label.rt(TEX(decimal(UniteAire)&"~\useKV[ClesStat]{Effectif}"),(unitex*2,unitey*(maxy+1.5))); -% if Mediane: -% AfficheMediane(#2); -% fi; - fi; - % On trace l'axe des abscisses - drawarrow (0,0)--unitex*((maxx-minx)/Pasx+2,0); - %On labelise l'axe des abscisses - dotlabel.bot(TEX("\num{"&decimal(X[1])&"}"),unitex*(Depart,0)); - for k=2 step 2 until TotalAbscisses: - dotlabel.bot(TEX("\num{"&decimal(X[k])&"}"),unitex*(Depart+(X[k]-X[1])/Pasx,0)); - endfor; - label.rt(TEX("\useKV[ClesStat]{Donnee}"),(unitex*((maxx-minx)/Pasx+2),0)); - %On affiche les données sup ou pas. - AfficheLegende(#2); - \end{mplibcode} - \fi -} -% - -\newcommand\Stat[2][]{% - \useKVdefault[ClesStat]% - \setKV[ClesStat]{#1}% - \ifboolKV[ClesStat]{UneMediane}{\renewcommand{\PfCArticleMediane}{une}}{\renewcommand{\PfCArticleMediane}{la}}% - \setsepchar[*]{,*/}% - \readlist*\ListeAvantUtilisation{#2}% - \xintifboolexpr{\listlen\ListeAvantUtilisation[1]==3}{\setKV[ClesStat]{Classes}}{}% - \ifboolKV[ClesStat]{Classes}{% - \setsepchar[*]{,*/}% - \readlist*\ListeDepart{#2}% - \xdef\EffectifTotal{0}% - \xintFor* ##1 in{\xintSeq{1}{\ListeDepartlen}}\do{% - \xdef\EffectifTotal{\fpeval{\EffectifTotal+\ListeDepart[##1,3]}}% - }% - \ifboolKV[ClesStat]{Histogramme}{% - \buildgraphhisto% - }{% - \ifboolKV[ClesStat]{Tableau}{% - \buildtabclasses% - }{}% - }% - }{% - \setsepchar{,}% - \ifboolKV[ClesStat]{Representation}{% - \setKV[TraceG]{Xmin=0,Ymin=0}% - \setKV[TraceG]{#1}% - \readlist*\ListePointsPlaces{#2}% - \newtoks\toklistepoint% - \foreachitem\compteur\in\ListePointsPlaces{\expandafter\Updatetoks\compteur\nil}% - \MPPlacePoint[#1]{\the\toklistepoint}% - }{% - \ifboolKV[ClesStat]{Liste}{% - \setsepchar{,}\ignoreemptyitems% - \readlist*\Liste{#2}% - \xdef\foo{}% - \setsepchar[*]{,*/}\ignoreemptyitems% - \xintFor* ##1 in {\xintSeq {1}{\Listelen}}\do{% - \xdef\foo{\foo 1/\Liste[##1],}% - }% - \readlist*\ListeComplete{\foo}% - \setKV[ClesStat]{Qualitatif}% - }{% - \ifboolKV[ClesStat]{Sondage}{% - \setsepchar{,}\ignoreemptyitems% - \readlist*\Liste{#2}% - % "liste vide" - \newtoks\tabtoksEEa% - \tabtoksEEa{}% - % - % "liste vide" - \newtoks\tabtoksEEb% - \tabtoksEEb{}% - % - \readlist*\ListeSansDoublonsEE{999}% %% Pour ne pas avoir une liste vide - % - \newcount\cmptEE% - \newcount\PasNumEE% %% Permettra de savoir si ce sondage est qualitatif ou quantitatif - \PasNumEE=0\relax% - \DTLcleardb{mtdbEE}% - % on range les resultats du sondage par ordre croissant. - \foreachitem\x\in\Liste{% - \DTLnewrow{mtdbEE}% - \DTLnewdbentry{mtdbEE}{Numeric}{\x}% - }% - \dtlsort{Numeric}{mtdbEE}{\dtlicompare}% - \DTLforeach{mtdbEE}{\nba=Numeric}{% - \IfDecimal{\nba}{}{\PasNumEE=\numexpr\PasNumEE+1\relax}% - \cmptEE=0\relax% - \foreachitem\nbb\in\ListeSansDoublonsEE{% - \ifthenelse{\equal{\nba}{\nbb}}{\cmptEE=\numexpr\cmptEE+1\relax}{}% - }% - \ifthenelse{\equal{\the\cmptEE}{0}}{% - \expandafter\AjoutListEEb\nba\nil% - \xdef\listEEa{\the\tabtoksEEb}% - \ignoreemptyitems% - \setsepchar{,}% - \readlist*\ListeSansDoublonsEE\listEEa% %%% Enl\`eve tous les \'elements - %%% identiques de Liste - }{}% - }% - \foreachitem\nba\in\ListeSansDoublonsEE{% - \cmptEE=0\relax% - \DTLforeach{mtdbEE}{\nbb=Numeric}{% - \ifthenelse{\equal{\nba}{\nbb}}{\cmptEE=\numexpr\cmptEE+1\relax}{}% - }% - \expandafter\AjoutListEEab\nba\nil% - \expandafter\AjoutListEEaa\the\cmptEE\nil% %%% Compte tous les \'elements - %%% identiques de Liste - }% - \xdef\listEEb{\the\tabtoksEEa} - \ignoreemptyitems% - \setsepchar[*]{,*/}% - \readlist*\ListeComplete\listEEb% - % - \ifthenelse{\equal{\the\PasNumEE}{0}}{\setKV[ClesStat]{Quantitatif}}{\setKV[ClesStat]{Qualitatif}}% - }{% - \ifboolKV[ClesStat]{Qualitatif}{% - % % on lit la liste \'ecrite sous la forme valeur/effectif - \setsepchar[*]{,*/}\ignoreemptyitems% - \readlist*\ListeInitiale{#2}% - % "liste vide" - \newtoks\tabtoksEE% - \tabtoksEE{}% - \DTLcleardb{mtdbEEqual}% - \foreachitem\x\in\ListeInitiale{% - \DTLnewrow{mtdbEEqual}% - \itemtomacro\ListeInitiale[\xcnt,1]\x% - \DTLnewdbentry{mtdbEEqual}{Val}{\x}% - \itemtomacro\ListeInitiale[\xcnt,2]\y% - \DTLnewdbentry{mtdbEEqual}{Eff}{\y}% - }% - \DTLforeach{mtdbEEqual}{\Val=Val,\Eff=Eff}{% - \expandafter\AjoutListEEy\Val\nil% - \expandafter\AjoutListEEx\Eff\nil% - }% - \xdef\listEE{\the\tabtoksEE} - \ignoreemptyitems% - \setsepchar[*]{,*/}% - \readlist*\ListeComplete\listEE% - }{% Dans le qualitatif, on trie d'abord les valeurs. - \setsepchar[*]{,*/}\ignoreemptyitems% - \readlist*\ListeInitiale{#2}% - % "liste vide" - \newtoks\tabtoksEE% - \tabtoksEE{}% - \DTLcleardb{mtdbEEqual}% - \foreachitem\x\in\ListeInitiale{% - \DTLnewrow{mtdbEEqual}% - \itemtomacro\ListeInitiale[\xcnt,1]\x% - \DTLnewdbentry{mtdbEEqual}{Val}{\x}% - \itemtomacro\ListeInitiale[\xcnt,2]\y% - \DTLnewdbentry{mtdbEEqual}{Eff}{\y}% - }% - \dtlsort{Val}{mtdbEEqual}{\dtlicompare}% - \DTLforeach{mtdbEEqual}{\Val=Val,\Eff=Eff}{% - \expandafter\AjoutListEEy\Val\nil% - \expandafter\AjoutListEEx\Eff\nil% - }% - \xdef\listEE{\the\tabtoksEE} - \ignoreemptyitems% - \setsepchar[*]{,*/}% - \readlist*\ListeComplete\listEE% - }}}% - % on cr\'ee la base de donn\'ees des valeurs dans le cas qualitatif - \DTLcleardb{mtdb}% - % on les trie pour la m\'ediane dans le cas qualitatif % Touhami / Texnique.fr - \foreachitem\x\in\ListeComplete{% - \DTLnewrow{mtdb}% - \itemtomacro\ListeComplete[\xcnt,2]\y% - \DTLnewdbentry{mtdb}{Numeric}{\y}% - }% - \dtlsort{Numeric}{mtdb}{\dtlicompare}% - % % on r\'einitialise les valeurs des crit\`eres de position et de - % dispersion - \renewcommand\NbDonnees{}% - \renewcommand\SommeDonnees{}% - \renewcommand\EffectifTotal{}% - \renewcommand\Moyenne{}% - \renewcommand\Etendue{}% - \renewcommand\Mediane{}% - \renewcommand\DonneeMax{0}% - \renewcommand\EffectifMax{0}% - \renewcommand\DonneeMin{999999999}% - \ifboolKV[ClesStat]{Qualitatif}{%D\'ebut qualitatif - % Calculs - % %% celui de la somme des donn\'ees - \foreachitem\don\in\ListeComplete{\xdef\SommeDonnees{\fpeval{\SommeDonnees+\ListeComplete[\doncnt,2]}}}% - % %% celui de l'effectif total - \ifboolKV[ClesStat]{EffectifTotal}{% - \ifboolKV[ClesStat]{Liste}{L'effectif total de la s\'erie est - \num{\ListeCompletelen}.\par}{% - \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}\]} - }{}% - \ifboolKV[ClesStat]{Liste}{\xdef\EffectifTotal{\ListeCompletelen}}{\xdef\EffectifTotal{\SommeDonnees}}% - % %% celui de la moyenne - \xdef\Moyenne{\fpeval{\SommeDonnees/\ListeCompletelen}}% - \ifboolKV[ClesStat]{Moyenne}{% - \ifboolKV[ClesStat]{Liste}{% - La somme des donn\'ees de la s\'erie est :% - \xintifboolexpr{\ListeCompletelen<\useKV[ClesStat]{Coupure}}{% - \[ - \num{\ListeComplete[1,2]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}\xintFor* ##1 in {\xintSeq {2}{\ListeCompletelen}}\do{% - +\num{\ListeComplete[##1,2]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{} - }=\num{\SommeDonnees}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}% - \]}{% - \[ - \num{\ListeComplete[1,2]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}\xintFor* ##1 in {\xintSeq {2}{3}}\do{% - +\num{\ListeComplete[##1,2]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}}+\dots\xintFor* ##1 in {\xintSeq {\ListeCompletelen-1}{\ListeCompletelen}}\do{% - +\num{\ListeComplete[##1,2]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{} - }=\num{\SommeDonnees}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}% - \]% - }% - \ifboolKV[ClesStat]{SET}{}{Le nombre de donn\'ees de la s\'erie est \num{\ListeCompletelen}.\\}% - Donc la moyenne de la s\'erie est \'egale \`a :% - \[\frac{\num{\SommeDonnees}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}}{\num{\ListeCompletelen}}%\IfInteger{\fpeval{round(\fpeval{\SommeDonnees/\ListeCompletelen},\useKV[ClesStat]{Precision})}}{=}{\approx} - \ifboolKV[ClesStat]{ValeurExacte}{}{% - \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}}}{}% - }% - \]% - }{Pas de moyenne possible pour une s\'erie de donn\'ees \`a caract\`ere qualitatif.}}{}% - % % %% celui de l'\'etendue - \xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{% - \xintifboolexpr{\ListeComplete[##1,2]>\DonneeMax}{% - \xdef\DonneeMax{\ListeComplete[##1,2]}% - }{}% - \xintifboolexpr{\ListeComplete[##1,2]<\DonneeMin}{% - \xdef\DonneeMin{\ListeComplete[##1,2]}% - }{}% - }% - \xdef\EffectifMax{\DonneeMax}% - \xdef\Etendue{\fpeval{\DonneeMax-\DonneeMin}}% - \ifboolKV[ClesStat]{Etendue}{% - \ifboolKV[ClesStat]{Liste}{% - L'\'etendue de la s\'erie est \'egale \`a $\num{\DonneeMax}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}-\num{\DonneeMin}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}=\num{\Etendue}$\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}% - }{Pas d'\'etendue possible pour une s\'erie de donn\'ees \`a caract\`ere qualitatif.}}{}% - % celui de la mediane - %%% Recuperation de la mediane %%%%%%%%%%%%%%%%%%%%% - \newcount\Recapmed% - \newcount\Recapmeda% - \ifodd\number\ListeCompletelen%odd impair - \Recapmed=\fpeval{(\ListeCompletelen+1)/2}\relax% - \else% - \Recapmed=\fpeval{\ListeCompletelen/2}\relax% - \Recapmeda=\numexpr\Recapmed+1\relax% - \fi% - \newcount\Recapk% - \Recapk=0% - \DTLforeach{mtdb}{\numeroDonnee=Numeric}{\Recapk=\numexpr\Recapk+1\relax% - \ifnum\Recapk=\Recapmed% - \ifodd\number\ListeCompletelen% - \xdef\Mediane{\numeroDonnee}% - \else% - \xdef\Mediane{\numeroDonnee}% - \fi% - \fi% - \ifnum\Recapk=\Recapmeda% - \xdef\Mediane{\fpeval{(\Mediane+\numeroDonnee)/2}}% - \fi% - }% - %%% - \ifboolKV[ClesStat]{Mediane}{% - \ifboolKV[ClesStat]{Liste}{% - On range les donn\'ees par ordre croissant :% - \nbdonnees=0% - \xintifboolexpr{\ListeCompletelen<\useKV[ClesStat]{Coupure}}{% - \[\DTLforeach{mtdb}{\numeroDonnee=Numeric}{\num{\numeroDonnee}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}\DTLiflastrow{.}{;}}\]% - }{% - \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% - }% - \newcount\med% - \newcount\meda% - \ifodd\number\ListeCompletelen%odd impair - \med=\fpeval{(\ListeCompletelen+1)/2}\relax% - L'effectif total de la s\'erie est \num{\ListeCompletelen}. Or, $\num{\ListeCompletelen}=\num{\fpeval{\med-1}}+1+\num{\fpeval{\med-1}}$.\\ - \else% pair - \med=\fpeval{\ListeCompletelen/2}\relax% - \meda=\numexpr\med+1\relax% - L'effectif total de la s\'erie est \num{\ListeCompletelen}. Or, $\num{\ListeCompletelen}=\num{\the\med}+\num{\the\med}$.\\ - \fi% - \newcount\k% - \k=0% - \DTLforeach{mtdb}{\numeroDonnee=Numeric}{\k=\numexpr\k+1\relax% - \ifnum\k=\med %La m\'ediane vaut \numeroDonnee\fi - \ifodd\number\ListeCompletelen% - La m\'ediane de la s\'erie est la \the\med\ieme{} donn\'ee.\\Donc la m\'ediane de la s\'erie est \num{\numeroDonnee}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}% - \xdef\Mediane{\numeroDonnee}% - \else% - La \the\med\ieme{} donn\'ee est \num{\numeroDonnee}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}. }{. }\xdef\Mediane{\numeroDonnee}% - \fi% - \fi% - \ifnum\k=\meda - La \the\meda\ieme{} donn\'ee est \num{\numeroDonnee}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}\\Donc \PfCArticleMediane{} m\'ediane de la s\'erie est \xdef\Mediane{\fpeval{(\Mediane+\numeroDonnee)/2}}$\ifboolKV[ClesStat]{DetailsMediane}{\dfrac{\num{\Mediane}+\num{\numeroDonnee}}{2}=}{}\num{\Mediane}$\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}% - \fi% - }% - %%%%%%% - }{Pas de m\'ediane possible pour une s\'erie de donn\'ees \`a caract\`ere qualitatif.}}{} - %%% Quartile un - \newcount\PfCQuartileUn% - \modulo{\ListeCompletelen}{4}\relax% - \ifnum\remainder=0% - \PfCQuartileUn=\fpeval{\ListeCompletelen/4}% - \else% - \PfCQuartileUn=\fpeval{ceil(\ListeCompletelen/4)}% - \fi% - \newcount\PfCQunk% - \PfCQunk=0% - \DTLforeach{mtdb}{\numeroDonnee=Numeric}{\PfCQunk=\numexpr\PfCQunk+1\relax% - \ifnum\PfCQunk=\PfCQuartileUn% - \xdef\QuartileUn{\numeroDonnee}% - \fi% - }% - %%% Quartile trois - \newcount\PfCQuartileTrois% - \modulo{\ListeCompletelen}{4}\relax% - \ifnum\remainder=0% - \PfCQuartileTrois=\fpeval{3*\ListeCompletelen/4}% - \else% - \PfCQuartileTrois=\fpeval{ceil(3*\ListeCompletelen/4)}% - \fi% - \newcount\PfCQtroisk% - \PfCQtroisk=0% - \DTLforeach{mtdb}{\numeroDonnee=Numeric}{\PfCQtroisk=\numexpr\PfCQtroisk+1\relax% - \ifnum\PfCQtroisk=\PfCQuartileTrois%La m\'ediane vaut \numeroDonnee\fi - \xdef\QuartileTrois{\numeroDonnee}% - \fi% - }% - % Construction du tableau - \ifboolKV[ClesStat]{Tableau}{% - \ifboolKV[ClesStat]{Liste}{Pas de tableau possible avec la cl\'e Liste.\\Utilisez plut\^ot la cl\'e Sondage si vous voulez un tableau avec cette liste.}{\BuildtabStat}}{}% - % Construction du graphique - \ifboolKV[ClesStat]{Graphique}{% - \ifboolKV[ClesStat]{Liste}{Pas de graphique possible avec la cl\'e Liste.\\Utilisez plut\^ot la cl\'e Sondage si vous voulez un graphique avec cette liste.}{% - \ifboolKV[ClesStat]{Barre}{% - \buildgraphbarhor% - }{% - \ifboolKV[ClesStat]{Angle}{% - \buildgraphcq{360}% - }{% - \ifboolKV[ClesStat]{SemiAngle}{% - \buildgraphcq{180}% - }{% - \buildgraphq[#1]% - }% - }% - }% - }% - }{}% - }{%%%%%%%%%%%%%%%%%%%%%D\'ebut quantitatif - % % on effectue les calculs - % %% celui de la somme des donn\'ees - \foreachitem\don\in\ListeComplete{\xdef\SommeDonnees{\fpeval{\SommeDonnees+\ListeComplete[\doncnt,1]*\ListeComplete[\doncnt,2]}}}% - % %% celui de l'effectif total - \foreachitem\don\in\ListeComplete{\xdef\EffectifTotal{\fpeval{\EffectifTotal+\ListeComplete[\doncnt,2]}}}% - % %% celui de l'\'etendue - \xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{% - \xintifboolexpr{\ListeComplete[##1,1]>\DonneeMax}{% - \xdef\DonneeMax{\ListeComplete[##1,1]}% - }{}% - \xintifboolexpr{\ListeComplete[##1,1]<\DonneeMin}{% - \xdef\DonneeMin{\ListeComplete[##1,1]}% - }{}% - }% - % \xdef\EffectifMax{\DonneeMax}% - \xdef\Etendue{\fpeval{\DonneeMax-\DonneeMin}}%% - % %% celui de la moyenne - \xdef\Moyenne{\fpeval{\SommeDonnees/\EffectifTotal}}% - \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}\] - }{}% - \ifboolKV[ClesStat]{Moyenne}{% - La somme des donn\'ees de la s\'erie est :% - \xintifboolexpr{\ListeCompletelen<\useKV[ClesStat]{Coupure}}{% - \[ - \ifnum\ListeComplete[1,2]=1\else\num{\ListeComplete[1,2]}\times\fi\num{\ListeComplete[1,1]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}\xintFor* ##1 in {\xintSeq {2}{\ListeCompletelen}}\do{% - +\ifnum\ListeComplete[##1,2]=1\else\num{\ListeComplete[##1,2]}\times\fi\num{\ListeComplete[##1,1]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{} - }=\num{\SommeDonnees}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{} - \] - }{% - \[ - \ifnum\ListeComplete[1,2]=1\else\num{\ListeComplete[1,2]}\times\fi\num{\ListeComplete[1,1]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}\xintFor* ##1 in {\xintSeq {2}{2}}\do{% - +\ifnum\ListeComplete[##1,2]=1\else\num{\ListeComplete[##1,2]}\times\fi\num{\ListeComplete[##1,1]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{} - }+\dots\xintFor* ##1 in {\xintSeq {\ListeCompletelen-1}{\ListeCompletelen}}\do{% - +\ifnum\ListeComplete[##1,2]=1\else\num{\ListeComplete[##1,2]}\times\fi\num{\ListeComplete[##1,1]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{} - }=\num{\SommeDonnees}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{} - \] - }% - \ifboolKV[ClesStat]{SET}{}{L'effectif total de la s\'erie est :% - \ifboolKV[ClesStat]{Liste}{ \num{\EffectifTotal}\\}{% - \[\num{\ListeComplete[1,2]}\xintFor* ##1 in {\xintSeq {2}{\ListeCompletelen}}\do{% - +\num{\ListeComplete[##1,2]} - }=\num{\EffectifTotal} - \]% - }% - }% - Donc la moyenne de la s\'erie est \'egale \`a :% - \[\frac{\num{\SommeDonnees}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}}{\num{\EffectifTotal}}% - \ifboolKV[ClesStat]{ValeurExacte}{}{% - \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}}}{}% - }% - \]% - }{}% - % % Affichage des r\'eponses. - % %% pour l'\'etendue - \ifboolKV[ClesStat]{Etendue}{L'\'etendue de la s\'erie est \'egale \`a $\num{\ListeComplete[\ListeCompletelen,1]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}-\num{\ListeComplete[1,1]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}=\num{\Etendue}$\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}}{}% - % pour la m\'ediane - %%% Recuperation Mediane - \newcount\Recupmed% - \newcount\Recupmeda% - \ifodd\number\EffectifTotal%odd impair - \Recupmed=\fpeval{(\EffectifTotal+1)/2}\relax% - \else% pair - \Recupmed=\fpeval{\EffectifTotal/2}\relax% - \Recupmeda=\numexpr\Recupmed+1\relax% - \fi% - \newcount\Recupk% - \Recupk=0% - \xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{% - \xintFor* ##2 in {\xintSeq {1}{\ListeComplete[##1,2]}}\do{% - \Recupk=\numexpr\Recupk+1\relax% - \ifnum\Recupk=\Recupmed% - \ifodd\number\EffectifTotal% - \xdef\Mediane{\ListeComplete[##1,1]}% - \else% - \xdef\Mediane{\ListeComplete[##1,1]}% - \fi% - \fi% - \ifnum\Recupk=\Recupmeda% - \xdef\Mediane{\fpeval{(\Mediane+\ListeComplete[##1,1])/2}}% - \fi% - }% - }% - %%% - \ifboolKV[ClesStat]{Mediane}{% - - \newcount\med% - \newcount\meda% - \ifodd\number\EffectifTotal%odd impair - \med=\fpeval{(\EffectifTotal+1)/2}\relax% - L'effectif total de la s\'erie est \num{\EffectifTotal}. Or, $\num{\EffectifTotal}=\num{\fpeval{\med-1}}+1+\num{\fpeval{\med-1}}$. % - \else% pair - \med=\fpeval{\EffectifTotal/2}\relax% - \meda=\numexpr\med+1\relax% - L'effectif total de la s\'erie est \num{\EffectifTotal}. Or, $\num{\EffectifTotal}=\num{\fpeval{\med}}+\num{\fpeval{\med}}$. % - \fi% - \newcount\k% - \k=0% - \xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{% - \xintFor* ##2 in {\xintSeq {1}{\ListeComplete[##1,2]}}\do{% - \k=\numexpr\k+1\relax% - \ifnum\k=\med% - \ifodd\number\EffectifTotal% - La m\'ediane de la s\'erie est la \the\med\ieme{} donn\'ee. Donc la m\'ediane de la s\'erie est \num{\ListeComplete[##1,1]}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}% - \else% - La \the\med\ieme{} donn\'ee est \num{\ListeComplete[##1,1]}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}. }{. }\xdef\Mediane{\ListeComplete[##1,1]}% - \fi% - \fi% - \ifnum\k=\meda% - La \the\meda\ieme{} donn\'ee est \num{\ListeComplete[##1,1]}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}\\Donc \PfCArticleMediane{} m\'ediane de la s\'erie est $\ifboolKV[ClesStat]{DetailsMediane}{\dfrac{\num{\Mediane}+\num{\ListeComplete[##1,1]}}2=}{}\xdef\Mediane{\fpeval{(\Mediane+\ListeComplete[##1,1])/2}}\num{\Mediane}$\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}% - \fi% - }% - }% - }{}% - %%% Quartile un - \newcount\PfCQuartileUn% - \modulo{\EffectifTotal}{4}\relax% - \ifnum\remainder=0% - \PfCQuartileUn=\fpeval{\EffectifTotal/4}% - \else% - \PfCQuartileUn=\fpeval{ceil(\EffectifTotal/4)}% - \fi% - \newcount\PfCQunk% - \PfCQunk=0% - \xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{% - \xintFor* ##2 in {\xintSeq {1}{\ListeComplete[##1,2]}}\do{% - \PfCQunk=\numexpr\PfCQunk+1\relax% - \ifnum\PfCQunk=\PfCQuartileUn% - \xdef\QuartileUn{\ListeComplete[##1,1]}% - \fi% - }% - }% - %%% Quartile trois - \newcount\PfCQuartileTrois% - \modulo{\EffectifTotal}{4}\relax% - \ifnum\remainder=0% - \PfCQuartileTrois=\fpeval{3*\EffectifTotal/4}% - \else% - \PfCQuartileTrois=\fpeval{ceil(3*\EffectifTotal/4)}% - \fi% - \newcount\PfCQtroisk% - \PfCQtroisk=0% - \xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{% - \xintFor* ##2 in {\xintSeq {1}{\ListeComplete[##1,2]}}\do{% - \PfCQtroisk=\numexpr\PfCQtroisk+1\relax% - \ifnum\PfCQtroisk=\PfCQuartileTrois% - \xdef\QuartileTrois{\ListeComplete[##1,1]}% - \fi% - }% - }% - % Construction de tableau - \ifboolKV[ClesStat]{Tableau}{\BuildtabStat}{}% - % Construction du graphique ?? - \ifboolKV[ClesStat]{Graphique}{% - \ifboolKV[ClesStat]{Angle}{% - \buildgraphcq{360}% - }{% - \ifboolKV[ClesStat]{SemiAngle}{% - \buildgraphcq{180}% - }{% - \buildgraph[#1]% - }% - }% - }{}% - }% - }% - }% -}% \ No newline at end of file diff --git a/macros/latex/contrib/profcollege/latex/PfCTableauxUnites.tex b/macros/latex/contrib/profcollege/latex/PfCTableauxUnites.tex index 23f8e431fe..7cc556894d 100644 --- a/macros/latex/contrib/profcollege/latex/PfCTableauxUnites.tex +++ b/macros/latex/contrib/profcollege/latex/PfCTableauxUnites.tex @@ -959,7 +959,7 @@ % \xintFor* ##1 in {\xintSeq{1}{\useKV[ClesTableaux]{NbLignes}}}\do{% \ifboolKV[ClesTableaux]{Milliards}{% - &&&&&&}{}% + &&&&&&}{}% \ifboolKV[ClesTableaux]{Millions}{% &&&}{}% &&&&&&&&&&\\}% diff --git a/macros/latex/contrib/profcollege/latex/PfCThales.tex b/macros/latex/contrib/profcollege/latex/PfCThales.tex index 7e1583c23e..1b8ed8a5ba 100644 --- a/macros/latex/contrib/profcollege/latex/PfCThales.tex +++ b/macros/latex/contrib/profcollege/latex/PfCThales.tex @@ -678,7 +678,7 @@ \xdef\ResultatThalesz{\fpeval{round(#8*#3/#6,\useKV[ClesThales]{Precision})}}% }{}}{} }}{} - }% + }% %% \StrMid{\the\zzz}{1}{1}[\cmza]% \StrMid{\the\yyy}{1}{1}[\cmya]% @@ -903,7 +903,7 @@ \edef\Nomz{#5}\valz=#8\Valz=#3\denoz=#6% }{}}{} }}{} - }% + }% %% \StrMid{\the\zzz}{1}{1}[\cmza]% \StrMid{\the\yyy}{1}{1}[\cmya]% diff --git a/macros/latex/contrib/profcollege/latex/ProfCollege.sty b/macros/latex/contrib/profcollege/latex/ProfCollege.sty index 1a1ef8f18d..de1b3c5da0 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/08/02}% +\def\filedate{2023/08/15}% \let\PfCfiledate\filedate% -\def\fileversion{0.99-z-q}% +\def\fileversion{0.99-z-r}% \let\PfCfileversion\fileversion% \ProvidesPackage{ProfCollege}[\filedate\space v\fileversion\space Aide pour utiliser LaTeX au college]% @@ -61,6 +61,7 @@ \ifluatex% \RequirePackage{luacas}% \RequirePackage{luamplib}% +\mplibtextextlabel{enable}%à partir de la v2.25 de mplibcode \everymplib{input PfCSvgnames; input PfCConstantes; input PfCGeometrie; input PfCAfficheur; beginfig(1);}% \everyendmplib{endfig;}% \else% @@ -135,15 +136,15 @@ %% Colorer en mode mathématique. \color ne gère pas les espaces propres au mode mathématique. Donc besoin de changer % https://tex.stackexchange.com/questions/21598/how-to-color-math-symbols -\makeatletter% -\def\mathcolor#1#{\@mathcolor{#1}}% -\def\@mathcolor#1#2#3{% - \protect\leavevmode% - \begingroup% - \color#1{#2}#3% - \endgroup% -}% -\makeatother% +%\makeatletter% +%\def\mathcolor#1#{\@mathcolor{#1}}% +%\def\@mathcolor#1#2#3{% +% \protect\leavevmode% +% \begingroup% +% \color#1{#2}#3% +% \endgroup% +%}% +%\makeatother% % Pb ProfCollege<->Chinois soulev\'e par Denis % Solution by egreg :) @@ -572,6 +573,7 @@ }%\emoticon }%\raisebox }% +\input{PfCMulArt} \input{PfCGrimuku} \input{PfCHorloge} \input{PfCCible} diff --git a/macros/latex/contrib/profcollege/metapost/PfCGeometrie.mp b/macros/latex/contrib/profcollege/metapost/PfCGeometrie.mp index 52869904af..95c18757f1 100644 --- a/macros/latex/contrib/profcollege/metapost/PfCGeometrie.mp +++ b/macros/latex/contrib/profcollege/metapost/PfCGeometrie.mp @@ -1315,19 +1315,19 @@ enddef; %Outils numeric echelleequerre; -echelleequerre=2; -vardef equerre(expr dte,drte,perpe,sens)= +echelleequerre=0.5; +vardef equerreold(expr dte,drte,perpe,sens)= save picequerre; picture picequerre; pair ww,t[]; path intermede; pair perpen,ptt,pttt; perpen:=projection(perpe,dte,drte); - %if sens=1 : - ptt:=longueurequerre*(drte-dte) rotated 90 shifted perpen; - %else : -% ptt:=longueurequerre*(drte-dte) rotated (-90) shifted perpen; - %fi; + if sens=1 : + ptt:=echelleequerre*(drte-dte) rotated 90 shifted perpen; + else : + ptt:=echelleequerre*(drte-dte) rotated (-90) shifted perpen; + fi; ww=unitvector(drte-dte); intermede=ptt--(10[ptt,(perpen rotatedabout(ptt,if sens=1: 30 else:-30 fi))]); pttt=intermede intersectionpoint (10[dte,drte]--10[drte,dte]); @@ -1338,6 +1338,78 @@ vardef equerre(expr dte,drte,perpe,sens)= picequerre enddef; +vardef equerre(text gradua)(expr ea,eb,ec)= + save picequerre; + picture picequerre; + pair EA,EB,EC,ED,EE,EF,EI; + EA:=ea; + EB:=eb; + EC:=ec; + ED=projection(EC,EA,EB); + EE-ED=EB-EA; + EF-ED=echelleequerre*abs(EE-ED)*(unitvector(EE-ED) rotated 90); + EI=CentreCercleI(EE,ED,EF); + picequerre=image( + fill (EE--ED--EF--cycle) withcolor 0.7white; + draw codeperp(EE,ED,EF,5); + draw EE--ED--EF--cycle; + fill ((((EE--ED--EF--cycle) shifted ((0,0)-EI)) scaled 0.5) shifted EI) withcolor white; + trace (((EE--ED--EF--cycle) shifted ((0,0)-EI)) scaled 0.5) shifted EI; + % if abs(EE-ED)>abs(EF-ED): +% for k=10 upto 50:% +% trace (ED+k*1mm*unitvector(EE-ED))--(ED+k*1mm*unitvector(EE-ED)+1mm*unitvector(EF-ED)); +% endfor; +% else: +% for k=10 upto 50:% +% trace (ED+k*1mm*unitvector(EF-ED))--(ED+k*1mm*unitvector(EF-ED)+1mm*unitvector(EE-ED)); +% endfor; +% fi; + ); + picequerre +enddef; + + +% ww; +% pair Intermede; +% pair perpen,I,ptt;%,pttt +% perpen:=projection(perpe,dte,drte); +% Intermede:=echelleequerre[dte,drte]; +% ptt-perpen=abs(Intermede-perpen)*0.5*unitvector(perpe-perpen); +% I:=CentreCercleI(perpen,ptt,Intermede); +% ww=unitvector(drte-dte); +% intermede=ptt--(10[ptt,(perpen rotatedabout(ptt,if sens=1: 30 else:-30 fi))]); +% pttt=intermede intersectionpoint (10[dte,drte]--10[drte,dte]); +% picequerre=image( +% +% draw codeperp(ptt,perpen,Intermede,5); +% k=0; +% pair Equa,Equb,Equc; +% Equa:=perpen; +% boolean Stop; +% Stop=false; +% forever: +% label.top(TEX(decimal(angle(drte-perpen)-angle(perpe-perpen))),A); +% for k=1 upto 100: +% k:=k+1; +% Equa:=perpen+k*1mm*unitvector(drte-perpen); +% dotlabel("",Equa); +% Equb:=Equa+1mm*unitvector(drte-perpen); +% Equc:=rotation(Equb,Equa,-angle((drte-perpen)-(perpe-perpen))); +% drawoptions(withcolor red); +% dotlabel("",Equc); +% drawoptions(); +% if abs(Equa-perpen)>9mm:% +% trace Equa--Equc; +% fi; + % if abs(drte-Equa)<1cm: +% Stop:=false; +% fi; +% exitif: Stop; +% endfor; +% ); +% picequerre +%enddef; + vardef regle(expr depart,arrivee,rr)= save picregle; picture picregle,grad[],gradu[],final; @@ -1425,16 +1497,167 @@ vardef crayon(expr depart,arrive,ptplace,nbechelle)= piccray enddef; -boolean Simple; -Simple=false; +boolean Simpleold; +Simpleold=false; + +vardef Rapporteur(text t)(expr rapcentre,pointsupport,rr,pasgrad)= + picture rap; + path cc,cd,cent; + pair grada[],gradb[],rapv,rapw,rapt,rapww,rapvv,rap[],rapp[],RA[],RB[]; + boolean Simple,Double,Aleph,Tiret; + Simple=true; + Double=false; + Aleph=false; + Tiret=false; + for p_=t: + if p_="Double": + Double:=true; + Simple:=false; + elseif p_="Aleph": + Aleph:=true; + Tiret:=true; + elseif p_="Tiret": + Tiret:=true; + fi; + endfor; + % Le cercle + RA1=0.3[rapcentre,pointsupport]; + RA2=0.375[rapcentre,pointsupport]; + RA3=0.45[rapcentre,pointsupport]; + RB1=rotation(RA1,rapcentre,rr*45); + RB2=rotation(RA2,rapcentre,rr*45); + RB3=rotation(RA3,rapcentre,rr*45); + cc=cercles(rapcentre,0.75*abs(rapcentre-pointsupport)); + rapt=cc intersectionpoint (rapcentre--pointsupport); + rapw=rapt-2*unitvector(pointsupport-rapcentre);rapv=symetrie(rapw,rapt); + rapww=rapt-5*unitvector(pointsupport-rapcentre);rapvv=symetrie(rapww,rapt); + grada0=(rapww-rapcentre) shifted rapcentre; + gradb0=(rapvv-rapcentre) shifted rapcentre; + path cerc; + cerc=subpath((angle(pointsupport-rapcentre)*(length cc))/360,((length cc)/2)+(angle(pointsupport-rapcentre)*(length cc))/360) of cc; + % On trace les graduations + for i=0 upto 71 : + for j=1 upto 4 : + grada[5*i+j]=(rapw-rapcentre) rotated (rr*(5*i+j)) shifted rapcentre; + gradb[5*i+j]=(rapv-rapcentre) rotated (rr*(5*i+j)) shifted rapcentre; + endfor; + grada[5*(i+1)]=(rapww-rapcentre) rotated (rr*(5*(i+1))) shifted rapcentre; + gradb[5*(i+1)]=(rapvv-rapcentre) rotated (rr*(5*(i+1))) shifted rapcentre; + endfor; + if Aleph: + fincompteur:=72; + else: + fincompteur:=36; + fi; + if (pasgrad=10) or (pasgrad=5) or (pasgrad=1): + for i=0 upto (fincompteur-1)/2: + draw grada[10*i]--gradb[10*i] withpen pencircle scaled 1.15; + endfor; + fi; + if (pasgrad=5) or (pasgrad=1): + for i=1 step 2 until (fincompteur-1): +% draw grada[5*i]--gradb[5*i]; + draw 0.9[grada[5*i],gradb[5*i]]--0.9[gradb[5*i],grada[5*i]]; + endfor; + fi; + if pasgrad=1: + for i=0 upto (fincompteur-1) : + for j=1 upto 4 : + draw grada[5*i+j]--gradb[5*i+j]; + endfor; + endfor; + fi; + % On affiche les graduations + picture nomb[],nombre[]; + if Aleph: + for j=0 upto (fincompteur/2): + nombre[10*j]=image( + label.top(TEX("\fontsize{4}{4}\selectfont"&decimal(10*j)&""),gradb[10*j]); + currentpicture:=currentpicture rotatedabout(gradb[10*j],angle(gradb[10*j]-rapcentre)-90); + ); + endfor; + else: + if rr=1: + for j=0 upto 18: + nombre[10*j]=image( + label.bot(TEX("\fontsize{4}{4}\selectfont"&decimal(10*j)&""),grada[10*j]); + currentpicture:=currentpicture rotatedabout(grada[10*j],angle(grada[10*j]-rapcentre)-90); + ); + endfor + for j=0 upto 18: + nombre[10*j+1]=image( + label.top(TEX("\fontsize{4}{4}\selectfont"&decimal(180-10*j)&""),gradb[10*j]); + currentpicture:=currentpicture rotatedabout(gradb[10*j],angle(gradb[10*j]-rapcentre)-90); + ); + endfor + else: + for j=0 upto 18: + nombre[10*j]=image( + label.bot(TEX("\fontsize{4}{4}\selectfont"&decimal(180-10*j)&""),grada[10*j]); + currentpicture:=currentpicture rotatedabout(grada[10*j],angle(grada[10*j]-rapcentre)-90); + ); + endfor + for j=18 downto 0: + nombre[10*j+1]=image( + label.top(TEX("\fontsize{4}{4}\selectfont"&decimal(10*j)&""),gradb[10*j]); + currentpicture:=currentpicture rotatedabout(gradb[10*j],angle(gradb[10*j]-rapcentre)-90); + ); + endfor + fi; + fi; + picture $; + $=image( + if Aleph: + for i=0 upto (fincompteur/2)-1 : + draw nombre[10*i]; + endfor; + else: + for i=0 upto (fincompteur/2) : + draw nombre[10*i+1]; + if Simple=false: + draw nombre[10*i]; + fi; + endfor; + fi; + if Aleph: + draw cc; + draw grada[0]--grada[180]; + else: + if rr=-1: + draw cerc reflectedabout(pointsupport,rapcentre)--cycle; + else: + draw cerc--cycle; + fi; + fi; + cent=cercle(rapcentre,0.05*u); + if Tiret: + trace ((0.05[rapcentre,grada[0]])--(0.05[rapcentre,grada[180]])) withpen pencircle scaled 1.25; + trace rotation(((0.05[rapcentre,grada[0]])--(0.05[rapcentre,grada[180]])),rapcentre,90) withpen pencircle scaled 1.25; + else: + fill cent withcolor if unknown fillrap: 0.9white else: fillrap fi; + fi; + if Aleph=true: + if rr=1: + for k=1 upto 3: + drawarrow arccercle(RA[k],RB[k],rapcentre); + endfor; + else: + for k=1 upto 3: + drawarrow reverse(arccercle(RB[k],RA[k],rapcentre)); + endfor; + fi; + fi; + ); + $ + enddef; vardef rapporteur(expr centre,segment,rr)= save raps; picture raps; raps=image( - Simple:=true; + Simpleold:=true; trace rapporteurdouble(centre,segment,rr); - Simple:=false; + Simpleold:=false; ); raps enddef; @@ -1491,7 +1714,7 @@ vardef rapporteurdouble(expr centre,segment,rr)= rap=image( for i=0 upto 18 : draw nombre[10*i+1]; - if Simple=false: + if Simpleold=false: draw nombre[10*i]; fi; endfor; -- cgit v1.2.3