diff options
author | Norbert Preining <norbert@preining.info> | 2023-07-05 03:01:54 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2023-07-05 03:01:54 +0000 |
commit | 973c785dccc1812d63162178e8362e83e8c263c2 (patch) | |
tree | b2cb12a6b36a0a59e90f1611d32cf7e8d125d575 /macros/latex | |
parent | ab7f5e4df027c13f5aef4fbdb032184cf2f3d5c3 (diff) |
CTAN sync 202307050301
Diffstat (limited to 'macros/latex')
129 files changed, 7528 insertions, 924 deletions
diff --git a/macros/latex/contrib/beamer-contrib/themes/beamertheme-rainbow/README.md b/macros/latex/contrib/beamer-contrib/themes/beamertheme-rainbow/README.md new file mode 100644 index 0000000000..3d8f35fb39 --- /dev/null +++ b/macros/latex/contrib/beamer-contrib/themes/beamertheme-rainbow/README.md @@ -0,0 +1,9 @@ +# beamertheme-rainbow + +A beamer colour theme which alternates theme colours on every frame + +Current version: 2023/07/04 version v0.1 + +This project is licensed under the LaTeX Project Public License v1.3c or later, see http://www.latex-project.org/lppl.txt + +The project repository, including a bug tracker, can be found at https://github.com/samcarter/beamertheme-rainbow/issues diff --git a/macros/latex/contrib/beamer-contrib/themes/beamertheme-rainbow/beamercolorthemerainbow.sty b/macros/latex/contrib/beamer-contrib/themes/beamertheme-rainbow/beamercolorthemerainbow.sty new file mode 100644 index 0000000000..94e9a0f10c --- /dev/null +++ b/macros/latex/contrib/beamer-contrib/themes/beamertheme-rainbow/beamercolorthemerainbow.sty @@ -0,0 +1,69 @@ +% !TeX root = test.tex +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% The rainbow colour theme +% A beamer colour theme which alternates theme colours on every frame +% Maintained by samcarter +% +% Project repository and bug tracker: +% https://github.com/samcarter/beamertheme-rainbow +% +% Released under the LaTeX Project Public License v1.3c or later +% See http://www.latex-project.org/lppl.txt +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\ProvidesPackage{beamercolorthemerainbow}[2023/07/04 version v0.1 Beamer colour theme with alternating theme colours] + +\mode<presentation> + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Default colours +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\definecolor{rainbow@0}{HTML}{e50000} +\definecolor{rainbow@1}{HTML}{ff8d00} +\definecolor{rainbow@2}{HTML}{ffee00} +\definecolor{rainbow@3}{HTML}{028121} +\definecolor{rainbow@4}{HTML}{004cff} +\definecolor{rainbow@5}{HTML}{770088} +\colorlet{beamer@structure@color}{rainbow@0} +\setbeamercolor{structure}{fg=beamer@structure@color} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Reading theme options +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\DeclareOptionBeamer{colors}{\def\rainbow@colors{#1}} +\ExecuteOptionsBeamer{colors={rainbow@0,rainbow@1,rainbow@2,rainbow@3,rainbow@4,rainbow@5}} +\ProcessOptionsBeamer + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Defining colours +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\ExplSyntaxOn + +% list to store colour list +\clist_new:N \l_rainbow_clist +\clist_set:Nx \l_rainbow_clist \rainbow@colors + +% setting colour based on frame number +\pretocmd{\beamer@@@frame}{ + \colorlet{beamer@structure@color}{ + \clist_item:Nn \l_rainbow_clist { + \int_eval:n { + \int_mod:nn { \insertframenumber }{ + \clist_count:N \l_rainbow_clist + } + 1 + } + } + } +}{}{} + +\ExplSyntaxOff + +\mode +<all> diff --git a/macros/latex/contrib/beamer-contrib/themes/beamertheme-rainbow/beamertheme-rainbow-doc.pdf b/macros/latex/contrib/beamer-contrib/themes/beamertheme-rainbow/beamertheme-rainbow-doc.pdf Binary files differnew file mode 100644 index 0000000000..beb9295d5f --- /dev/null +++ b/macros/latex/contrib/beamer-contrib/themes/beamertheme-rainbow/beamertheme-rainbow-doc.pdf diff --git a/macros/latex/contrib/beamer-contrib/themes/beamertheme-rainbow/beamertheme-rainbow-doc.tex b/macros/latex/contrib/beamer-contrib/themes/beamertheme-rainbow/beamertheme-rainbow-doc.tex new file mode 100644 index 0000000000..14f84a1b1a --- /dev/null +++ b/macros/latex/contrib/beamer-contrib/themes/beamertheme-rainbow/beamertheme-rainbow-doc.tex @@ -0,0 +1,195 @@ +% !TeX TS-program = latexmk -time -pdf -pdflatex="pdflatex -synctex=1 -interaction=nonstopmode -shell-escape %%O %%S" % | txs:///view-log | txs:///view-pdf + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Documentation for the rainbow colour theme +% A beamer colour theme which alternates theme colours on every frame +% Maintained by samcarter +% +% Project repository and bug tracker: +% https://github.com/samcarter/beamertheme-rainbow +% +% Released under the LaTeX Project Public License v1.3c or later +% See http://www.latex-project.org/lppl.txt +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\documentclass[parskip=half]{scrartcl} + +% packages %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\usepackage[T1]{fontenc} +\usepackage[utf8]{inputenc} +\usepackage[english]{babel} +\let\hrulefillx\hrulefill +\usepackage[bitstream-charter]{mathdesign} +\let\hrulefill\hrulefillx +\usepackage[most]{tcolorbox} +\usepackage[paper=a4paper,hmargin=2.9cm,vmargin=2.5cm]{geometry} +\usepackage{scrlayer-scrpage} +\usepackage{gradient-text} +\usepackage[colorlinks=true,breaklinks=true,urlcolor=blendedblue,linkcolor=blendedblue,citecolor=blendedblue,filecolor=blendedblue]{hyperref} + +% customisation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\definecolor{blendedblue}{rgb}{0.2,0.2,0.7} +\addtokomafont{sectioning}{\color{blendedblue}} +\addtokomafont{date}{\normalsize} +\addtokomafont{author}{\normalsize} +\renewcommand*\dictumwidth{0.35\linewidth} +\renewcommand*{\dictumrule}{\vskip1ex} +\renewcommand*{\dictumauthorformat}[1]{#1} + +\lstdefinestyle{tcolorboxstyle}{% + language={[latex]TeX}, + tabsize=2, + breaklines, + basicstyle=\ttfamily, + columns=fullflexible, +} + +\tcbset{% + toptitle=1mm, + left=2mm, + title={Example}, + fonttitle=\large\sffamily, + colbacktitle=blendedblue!75!black, + colframe=blendedblue!75!black, + colback=blendedblue!75!black!10!white, + boxrule=0cm, + frame hidden, + arc=1.3mm, + arc=2mm, + sidebyside, + listing options={style=tcolorboxstyle}, + bottom=0pt, + top=0pt, + lower separated=false, + comment style={scale=2}, + enhanced, + drop fuzzy shadow=black!90, + title code app={ + \shade[top color=blendedblue!75!black,bottom color=blendedblue!75!black!10!white] (title.south west) rectangle ([yshift=-1mm]title.south east); + } +} + +\lstset{style=tcolorboxstyle} + +\newcommand{\prefix}{./build} +\tcbset{ + compilable listing/.style={listing file={\prefix/\jobname-listing-\thetcblistingcount.tex}}, + run pdflatex/.style={run@system@command={cd\space \prefix;\space pdflatex}{\jobname-listing-\thetcblistingcount.tex}},% +} + +% meta %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\title{\texorpdfstring{\gradientRGB{The rainbow beamer colour theme}{255,128,51}{51,51,255}}{The rainbow beamer coloir theme}} +\subtitle{A beamer colour theme which alternates theme colours on every frame} +\author{% + \texorpdfstring{ + \texttt{samcarter}\\ + \url{https://github.com/samcarter/beamertheme-rainbow}\\ +% \url{https://www.ctan.org/pkg/beamertheme-rainbow} + }{samcarter}} +\date{Version v0.1 \textendash{} 2023/07/04} + +\begin{document} +\maketitle + +\dictum[Marc Chagall]{Colour is all. When colour is right, form is right. Colour is everything, colour is vibration like music; everything is vibration.} + +\section{Introduction} +\label{intro} + +The rainbow beamer colour theme will bring more colours to your presentation. It works similarly to the structure beamer colour theme, but instead of having just one theme colour throughout the whole presentation, the rainbow beamer colour theme will cycle through a list of colors and change the theme colour on every frame. + +By default, it will cycle through colours of the rainbow (hence the name), but a custom set of colours is also possible. + +%The package is included in \TeX{}Live and MiK\TeX\ and available from \textsc{CTAN} (\url{https://www.ctan.org/pkg/beamertheme-tcolorbox}). +The development version of this package is located at \url{https://github.com/samcarter/beamertheme-rainbow}. If you have any problems, ideas or other feedback, please make constructive use of the issue tracker. + +Copyright \raisebox{0.2em}{\tiny\fontfamily{cmr}\selectfont\textcopyright} \texttt{samcarter}. Permission is granted to copy, distribute and\slash or modify this software under the terms of the LaTeX project public licence, version 1.3c or later \url{http://www.latex-project.org/lppl.txt}. + +\section{Usage} + +The basic usage is fairly simple. After choosing a beamer theme, one can load the rainbow beamer colour theme via +\begin{tcolorbox}[title={}] +\begin{lstlisting} +\usecolortheme{rainbow} +\end{lstlisting} +\end{tcolorbox} + +This will work with most of the themes which are provided by the beamer class as well some third party themes. Notable exceptions are the \lstinline|AnnArbor| and \lstinline|CambridgeUS| themes. + +\newpage + +This basic usage will colour frames in alternating rainbow colours: +\begin{tcblisting}{ + listing and comment, + pdf comment, + freeze pdf, + compilable listing, + run pdflatex, + comment={ + \begin{tikzpicture} + \foreach \i in {1,...,6}{% + \node at (0.4*\i,-0.7*\i) {\includegraphics[page=\i,width=4cm]{beamertheme-rainbow-doc-listing-1.pdf}}; + } + \end{tikzpicture} + }, + title={Basic example} +} +\documentclass{beamer} + +\usetheme{Berkeley} +\usecolortheme{rainbow} + +\begin{document} + +% just for this test example +\ExplSyntaxOn +\prg_replicate:nn{6}{\frame{}} +\ExplSyntaxOff + +\end{document} +\end{tcblisting} + +As pretty as rainbow colours are, there might be some users who would like to choose their own colours. This can be done with the \lstinline|colors={...}| option which accepts a comma separated list of colours. The colours can be predefined colours e.g. from the \lstinline|xcolor| package, user-defined colours or (for more fun) from the \lstinline|xkcdcolors| package. + +\begin{tcblisting}{ + listing and comment, + pdf comment, + freeze pdf, + compilable listing, + run pdflatex, + comment={ + \begin{tikzpicture} + \foreach \i in {1,...,6}{% + \node at (0.4*\i,-0.7*\i) {\includegraphics[page=\i,width=4cm]{beamertheme-rainbow-doc-listing-2.pdf}}; + } + \end{tikzpicture} + }, + title={\strut Custom colours} +} +\documentclass{beamer} + +\usetheme{Copenhagen} +\usepackage{xkcdcolors} +\definecolor{mycolor} + {RGB}{127,0,127} +\usecolortheme[ + colors={ + orange, + mycolor, + xkcdVibrantBlue + } +]{rainbow} + +\begin{document} + +% just for this test example +\ExplSyntaxOn +\prg_replicate:nn{6}{\frame{\frametitle{title}}} +\ExplSyntaxOff + +\end{document} +\end{tcblisting} + +\end{document} + diff --git a/macros/latex/contrib/fail-fast/README.md b/macros/latex/contrib/fail-fast/README.md index b16917e2b1..e2fb8b5493 100644 --- a/macros/latex/contrib/fail-fast/README.md +++ b/macros/latex/contrib/fail-fast/README.md @@ -25,3 +25,5 @@ then run `l3build ctan` in the root directory. It should compile everything without errors. If not, submit an issue and wait. Otherwise, make your changes and then run `l3build ctan` again. If the build is still clean, submit a pull request. + +Copyright (c) 2023 Yegor Bugayenko, MIT License
\ No newline at end of file diff --git a/macros/latex/contrib/fail-fast/fail-fast.dtx b/macros/latex/contrib/fail-fast/fail-fast.dtx index 2a1c4a39dc..c312d11102 100644 --- a/macros/latex/contrib/fail-fast/fail-fast.dtx +++ b/macros/latex/contrib/fail-fast/fail-fast.dtx @@ -50,7 +50,7 @@ %<package>\NeedsTeXFormat{LaTeX2e} %<package>\ProvidesPackage{fail-fast} %<*package> -[2023-07-01 0.0.1 Turns warnings into errors] +[2023-07-04 0.0.2 Turns warnings into errors] %</package> %<*driver> \documentclass{ltxdoc} @@ -98,7 +98,8 @@ % \StopEventually{} % \section{Implementation} -% \changes{v0.1.0}{2023/07/01}{Initial version, which turns warnings into errors} +% \changes{v0.0.1}{2023/07/01}{Initial version, which turns warnings into errors} +% \changes{v0.0.2}{2023/07/04}{Minor changes in the documentation} % \begin{macrocode} \message{fail-fast: Starting from now all warnings diff --git a/macros/latex/contrib/fail-fast/fail-fast.pdf b/macros/latex/contrib/fail-fast/fail-fast.pdf Binary files differindex 81db765dee..7bb9905fb7 100644 --- a/macros/latex/contrib/fail-fast/fail-fast.pdf +++ b/macros/latex/contrib/fail-fast/fail-fast.pdf diff --git a/macros/latex/contrib/lettrine/contrib/optfile.cfl b/macros/latex/contrib/lettrine/contrib/lettrine-optfile.cfl index 407ed82c99..407ed82c99 100644 --- a/macros/latex/contrib/lettrine/contrib/optfile.cfl +++ b/macros/latex/contrib/lettrine/contrib/lettrine-optfile.cfl diff --git a/macros/latex/contrib/lettrine/contrib/pacl.cfl b/macros/latex/contrib/lettrine/contrib/lettrine-pacl.cfl index e8de17b6d6..e8de17b6d6 100644 --- a/macros/latex/contrib/lettrine/contrib/pacl.cfl +++ b/macros/latex/contrib/lettrine/contrib/lettrine-pacl.cfl diff --git a/macros/latex/contrib/lettrine/contrib/padl.cfl b/macros/latex/contrib/lettrine/contrib/lettrine-padl.cfl index 784bebc935..784bebc935 100644 --- a/macros/latex/contrib/lettrine/contrib/padl.cfl +++ b/macros/latex/contrib/lettrine/contrib/lettrine-padl.cfl diff --git a/macros/latex/contrib/lettrine/contrib/pzc2.cfl b/macros/latex/contrib/lettrine/contrib/lettrine-pzc2.cfl index 7779968780..7779968780 100644 --- a/macros/latex/contrib/lettrine/contrib/pzc2.cfl +++ b/macros/latex/contrib/lettrine/contrib/lettrine-pzc2.cfl diff --git a/macros/latex/contrib/lettrine/contrib/pzc3.cfl b/macros/latex/contrib/lettrine/contrib/lettrine-pzc3.cfl index a67ba9b5b0..a67ba9b5b0 100644 --- a/macros/latex/contrib/lettrine/contrib/pzc3.cfl +++ b/macros/latex/contrib/lettrine/contrib/lettrine-pzc3.cfl diff --git a/macros/latex/contrib/lettrine/doc/lettrine-demo-de.pdf b/macros/latex/contrib/lettrine/doc/lettrine-demo-de.pdf Binary files differindex 5e71166cd7..4b3ff4d6e1 100644 --- a/macros/latex/contrib/lettrine/doc/lettrine-demo-de.pdf +++ b/macros/latex/contrib/lettrine/doc/lettrine-demo-de.pdf diff --git a/macros/latex/contrib/lettrine/doc/lettrine-demo-fr.pdf b/macros/latex/contrib/lettrine/doc/lettrine-demo-fr.pdf Binary files differindex b12099b93a..c616adba03 100644 --- a/macros/latex/contrib/lettrine/doc/lettrine-demo-fr.pdf +++ b/macros/latex/contrib/lettrine/doc/lettrine-demo-fr.pdf diff --git a/macros/latex/contrib/lettrine/doc/lettrine-demo-lua.pdf b/macros/latex/contrib/lettrine/doc/lettrine-demo-lua.pdf Binary files differindex 31d231ce83..cc433b0fab 100644 --- a/macros/latex/contrib/lettrine/doc/lettrine-demo-lua.pdf +++ b/macros/latex/contrib/lettrine/doc/lettrine-demo-lua.pdf diff --git a/macros/latex/contrib/lettrine/doc/lettrine.pdf b/macros/latex/contrib/lettrine/doc/lettrine.pdf Binary files differindex 0299b73102..ad1c4ac4c0 100644 --- a/macros/latex/contrib/lettrine/doc/lettrine.pdf +++ b/macros/latex/contrib/lettrine/doc/lettrine.pdf diff --git a/macros/latex/contrib/lettrine/lettrine.dtx b/macros/latex/contrib/lettrine/lettrine.dtx index 8403bc644b..3c1a191780 100644 --- a/macros/latex/contrib/lettrine/lettrine.dtx +++ b/macros/latex/contrib/lettrine/lettrine.dtx @@ -106,7 +106,7 @@ \ProvidesFile{lettrine.dtx} %</dtx> %<*sty|dtx> - [2023-07-02 v2.50 (Daniel Flipo)] + [2023-07-04 v2.51 (Daniel Flipo)] %</sty|dtx> % \fi % diff --git a/macros/latex/contrib/mitthesis/MIT-Thesis.pdf b/macros/latex/contrib/mitthesis/MIT-Thesis.pdf Binary files differindex d859b8cbfd..51f4a87371 100644 --- a/macros/latex/contrib/mitthesis/MIT-Thesis.pdf +++ b/macros/latex/contrib/mitthesis/MIT-Thesis.pdf diff --git a/macros/latex/contrib/mitthesis/MIT-thesis-template/MIT-Thesis.tex b/macros/latex/contrib/mitthesis/MIT-thesis-template/MIT-Thesis.tex index bcd15c440b..c0a22d37d7 100644 --- a/macros/latex/contrib/mitthesis/MIT-thesis-template/MIT-Thesis.tex +++ b/macros/latex/contrib/mitthesis/MIT-thesis-template/MIT-Thesis.tex @@ -3,7 +3,7 @@ % !BIB program = biber % This file is MIT-Thesis.tex, a template for producing MIT theses with the mitthesis class. -% Version: 1.03, 2023/06/26 +% Version: 1.04, 2023/07/03 % Author: John H. Lienhard (c) 2023. Reuse under the MIT license: https://ctan.org/license/mit % Documentation: https://ctan.org/pkg/mitthesis diff --git a/macros/latex/contrib/mitthesis/MIT-thesis-template/mitthesis-sample.bib b/macros/latex/contrib/mitthesis/MIT-thesis-template/mitthesis-sample.bib index 87828e0351..786739e5ea 100644 --- a/macros/latex/contrib/mitthesis/MIT-thesis-template/mitthesis-sample.bib +++ b/macros/latex/contrib/mitthesis/MIT-thesis-template/mitthesis-sample.bib @@ -1,6 +1,6 @@ %% Sample bibliography file for mitthesis.cls %% -%% Revised: 13 June 2023 +%% Revised: 30 June 2023 %% Copyright John H. Lienhard, MIT %% Offered under the MIT license: https://ctan.org/license/mit @@ -218,7 +218,7 @@ @bookinbook{churchill1948, author = {Winston S. Churchill}, year = {1948}, - title = {The Gathering Storm}, + title = {{The Gathering Storm}}, series = {The Second World War}, volume = {1}, chapter = {5, {``The Locust Years''}}, diff --git a/macros/latex/contrib/mitthesis/README.md b/macros/latex/contrib/mitthesis/README.md index bfc1c21905..be1ebfe217 100644 --- a/macros/latex/contrib/mitthesis/README.md +++ b/macros/latex/contrib/mitthesis/README.md @@ -1,7 +1,7 @@ #mitthesis --- A LaTeX template for MIT theses# - v1.03 dated 2023/06/26. + v1.04 dated 2023/07/03. ####Overview#### This class provides a LaTeX template for MIT theses formatted according to @@ -53,6 +53,9 @@ --- ####Change log#### + v1.04 (3 July 2023): + - Embed default fontset in class file, in case fontset directory is missing + v1.03 (26 June 2023): - Bug fix: fontset naming for older LaTeX formats - Change default biblatex style to IEEE diff --git a/macros/latex/contrib/mitthesis/fontsets/mitthesis-defaultfonts.tex b/macros/latex/contrib/mitthesis/fontsets/mitthesis-defaultfonts.tex index 826945277d..935408ea07 100644 --- a/macros/latex/contrib/mitthesis/fontsets/mitthesis-defaultfonts.tex +++ b/macros/latex/contrib/mitthesis/fontsets/mitthesis-defaultfonts.tex @@ -1,8 +1,7 @@ % From mitthesis package -% Version: 1.01, 2023/06/19 +% Version: 1.02, 2023/07/03 % Documentation: https://ctan.org/pkg/mitthesis - %% Default fonts % \ifpdftex @@ -12,7 +11,7 @@ \else \typeout{^^JLoading Latin Modern text and math fonts (default for unicode engines).^^J} % - \usepackage[warnings-off={mathtools-colon,mathtools-overbracket}]{unicode-math} + \RequirePackage[warnings-off={mathtools-colon,mathtools-overbracket}]{unicode-math} % suppress tiresome warnings about lack of integration between mathtools and unicode-math. - % Unicode-math loads the fontspec package, but the default fonts are not selected by fontspec, so + % Unicode-math loads fontspec package, but default fonts are not selected by fontspec in this case. \fi diff --git a/macros/latex/contrib/mitthesis/fontsets/mitthesis-fira-newtxsf.tex b/macros/latex/contrib/mitthesis/fontsets/mitthesis-fira-newtxsf.tex index 6cebc4054c..55e6a7de52 100644 --- a/macros/latex/contrib/mitthesis/fontsets/mitthesis-fira-newtxsf.tex +++ b/macros/latex/contrib/mitthesis/fontsets/mitthesis-fira-newtxsf.tex @@ -1,5 +1,5 @@ % From mitthesis package -% Version: 1.01, 2023/06/19 +% Version: 1.02, 2023/07/03 % Documentation: https://ctan.org/pkg/mitthesis @@ -14,7 +14,7 @@ \RequirePackage{bm} \else \ClassWarning{mitnewthesis}{The newtx font set requires pdflatex. Defaulting to LMR fonts} - \usepackage[warnings-off={mathtools-colon,mathtools-overbracket}]{unicode-math} + \RequirePackage[warnings-off={mathtools-colon,mathtools-overbracket}]{unicode-math} % suppress tiresome warnings about lack of integration between mathtools and unicode-math. - % Unicode-math loads the fontspec package, but the default fonts are not selected by fontspec, so + % Unicode-math loads the fontspec package, but the default fonts are not selected by fontspec in this case. \fi diff --git a/macros/latex/contrib/mitthesis/fontsets/mitthesis-heros-stix2.tex b/macros/latex/contrib/mitthesis/fontsets/mitthesis-heros-stix2.tex index 943fe6a84b..fabfd030cf 100644 --- a/macros/latex/contrib/mitthesis/fontsets/mitthesis-heros-stix2.tex +++ b/macros/latex/contrib/mitthesis/fontsets/mitthesis-heros-stix2.tex @@ -1,5 +1,5 @@ % From mitthesis package -% Version: 1.00, 2023/06/17 +% Version: 1.01, 2023/07/03 % Documentation: https://ctan.org/pkg/mitthesis @@ -18,7 +18,7 @@ \else \typeout{^^JTeX Gyre Heros (sans serif) text font with STIX2 math font and Inconsolata monospaced font.^^J} % - \usepackage[warnings-off={mathtools-colon,mathtools-overbracket}]{unicode-math} + \RequirePackage[warnings-off={mathtools-colon,mathtools-overbracket}]{unicode-math} % suppress tiresome warnings about lack of integration between mathtools and unicode-math % unicode-math loads the fontspec package diff --git a/macros/latex/contrib/mitthesis/fontsets/mitthesis-libertine.tex b/macros/latex/contrib/mitthesis/fontsets/mitthesis-libertine.tex index 81d33bff72..12e2a80ef6 100644 --- a/macros/latex/contrib/mitthesis/fontsets/mitthesis-libertine.tex +++ b/macros/latex/contrib/mitthesis/fontsets/mitthesis-libertine.tex @@ -1,5 +1,5 @@ % From mitthesis package -% Version: 1.00, 2023/06/17 +% Version: 1.01, 2023/07/03 % Documentation: https://ctan.org/pkg/mitthesis %% Linux Libertine (serif) text font with newtxmath[libertine] (pdftex) or Libertinus (unicode) math font @@ -10,16 +10,16 @@ % \ifpdftex \typeout{^^JLoading newtx-libertine text and math fonts with insolata typewriter font^^J} - \usepackage[lining,semibold]{libertine} - \usepackage[T1]{fontenc} - \usepackage[varqu,varl]{inconsolata}% typewriter + \RequirePackage[lining,semibold]{libertine} + \RequirePackage[T1]{fontenc} + \RequirePackage[varqu,varl]{inconsolata}% typewriter % \usepackage{amsthm}% must be loaded before newtxmath - \usepackage[libertine,vvarbb]{newtxmath} - \usepackage{bm}% load after all math to give access to bold math + \RequirePackage[libertine,vvarbb]{newtxmath} + \RequirePackage{bm}% load after all math to give access to bold math \else \typeout{^^JLoading Linux Libertine (serif) text font with Libertinus math font^^J} % - \usepackage[warnings-off={mathtools-colon,mathtools-overbracket}]{unicode-math} + \RequirePackage[warnings-off={mathtools-colon,mathtools-overbracket}]{unicode-math} % suppress tiresome warnings about lack of integration between mathtools and unicode-math % unicode math loads the fontspec package % diff --git a/macros/latex/contrib/mitthesis/fontsets/mitthesis-lucida.tex b/macros/latex/contrib/mitthesis/fontsets/mitthesis-lucida.tex index a6689059d5..57107e7624 100644 --- a/macros/latex/contrib/mitthesis/fontsets/mitthesis-lucida.tex +++ b/macros/latex/contrib/mitthesis/fontsets/mitthesis-lucida.tex @@ -1,5 +1,5 @@ % From mitthesis package -% Version: 1.00, 2023/06/17 +% Version: 1.01, 2023/07/03 % Documentation: https://ctan.org/pkg/mitthesis @@ -12,7 +12,7 @@ \RequirePackage[expert,vargreek,altbullet,seriftt]{lucidabr} % switch text and math fonts \RequirePackage{bm} \else - \usepackage[warnings-off={mathtools-colon,mathtools-overbracket}]{unicode-math} + \RequirePackage[warnings-off={mathtools-colon,mathtools-overbracket}]{unicode-math} % suppress tiresome warnings about lack of integration between mathtools and unicode-math % unicode-math loads the fontspec package diff --git a/macros/latex/contrib/mitthesis/fontsets/mitthesis-newtx-sans-text.tex b/macros/latex/contrib/mitthesis/fontsets/mitthesis-newtx-sans-text.tex index 174aae2d17..faa64929b0 100644 --- a/macros/latex/contrib/mitthesis/fontsets/mitthesis-newtx-sans-text.tex +++ b/macros/latex/contrib/mitthesis/fontsets/mitthesis-newtx-sans-text.tex @@ -1,5 +1,5 @@ % From mitthesis package -% Version: 1.01, 2023/06/19 +% Version: 1.01, 2023/07/03 % Documentation: https://ctan.org/pkg/mitthesis @@ -15,9 +15,9 @@ \RequirePackage{bm}% bold math \else \ClassWarning{mitnewthesis}{The newtx font set requires pdflatex. Defaulting to LMR fonts} - \usepackage[warnings-off={mathtools-colon,mathtools-overbracket}]{unicode-math} + \RequirePackage[warnings-off={mathtools-colon,mathtools-overbracket}]{unicode-math} % suppress tiresome warnings about lack of integration between mathtools and unicode-math. - % Unicode-math loads the fontspec package, but the default fonts are not selected by fontspec, so + % Unicode-math loads the fontspec package, but the default fonts are not selected by fontspec in this case. \fi
\ No newline at end of file diff --git a/macros/latex/contrib/mitthesis/fontsets/mitthesis-newtx.tex b/macros/latex/contrib/mitthesis/fontsets/mitthesis-newtx.tex index ec240a7cea..2d4f5b0110 100644 --- a/macros/latex/contrib/mitthesis/fontsets/mitthesis-newtx.tex +++ b/macros/latex/contrib/mitthesis/fontsets/mitthesis-newtx.tex @@ -1,5 +1,5 @@ % From mitthesis package -% Version: 1.01, 2023/06/19 +% Version: 1.02, 2023/07/03 % Documentation: https://ctan.org/pkg/mitthesis @@ -12,9 +12,9 @@ \let\textsuperscript\textsu% newtx changes the default superiors font; this is needed to get commas aligned in sequential footnotes \else \ClassWarning{mitnewthesis}{The newtx font set requires pdflatex. Defaulting to LMR fonts} - \usepackage[warnings-off={mathtools-colon,mathtools-overbracket}]{unicode-math} + \RequirePackage[warnings-off={mathtools-colon,mathtools-overbracket}]{unicode-math} % suppress tiresome warnings about lack of integration between mathtools and unicode-math. - % Unicode-math loads the fontspec package, but the default fonts are not selected by fontspec, so + % Unicode-math loads the fontspec package, but the default fonts are not selected by fontspec in this case. \fi
\ No newline at end of file diff --git a/macros/latex/contrib/mitthesis/fontsets/mitthesis-stix2.tex b/macros/latex/contrib/mitthesis/fontsets/mitthesis-stix2.tex index 9e4e7c68b6..b85f36d727 100644 --- a/macros/latex/contrib/mitthesis/fontsets/mitthesis-stix2.tex +++ b/macros/latex/contrib/mitthesis/fontsets/mitthesis-stix2.tex @@ -1,5 +1,5 @@ % From mitthesis package -% Version: 1.01, 2023/06/19 +% Version: 1.02, 2023/07/03 % Documentation: https://ctan.org/pkg/mitthesis @@ -18,7 +18,7 @@ \else \typeout{^^JLoading STIX Two text and math fonts with Heros sans serif font and Inconsolata monospaced font.^^J} % - \usepackage[warnings-off={mathtools-colon,mathtools-overbracket}]{unicode-math} + \RequirePackage[warnings-off={mathtools-colon,mathtools-overbracket}]{unicode-math} % suppress tiresome warnings about lack of integration between mathtools and unicode-math % unicode-math loads the fontspec package % diff --git a/macros/latex/contrib/mitthesis/fontsets/mitthesis-termes-stix2.tex b/macros/latex/contrib/mitthesis/fontsets/mitthesis-termes-stix2.tex index 8d08f84a89..62a5013a50 100644 --- a/macros/latex/contrib/mitthesis/fontsets/mitthesis-termes-stix2.tex +++ b/macros/latex/contrib/mitthesis/fontsets/mitthesis-termes-stix2.tex @@ -1,5 +1,5 @@ % From mitthesis package -% Version: 1.01, 2023/06/19 +% Version: 1.02, 2023/07/03 % Documentation: https://ctan.org/pkg/mitthesis @@ -18,7 +18,7 @@ \else \typeout{^^JLoading TeX Gyre Termes text font with STIX2 math font, Heros sans serif font, and Inconsolata monospaced font.^^J} % - \usepackage[warnings-off={mathtools-colon,mathtools-overbracket}]{unicode-math} + \RequirePackage[warnings-off={mathtools-colon,mathtools-overbracket}]{unicode-math} % suppress tiresome warnings about lack of integration between mathtools and unicode-math % unicode-math loads the fontspec package % diff --git a/macros/latex/contrib/mitthesis/fontsets/mitthesis-termes.tex b/macros/latex/contrib/mitthesis/fontsets/mitthesis-termes.tex index a1d5aece4e..6579eb4f31 100644 --- a/macros/latex/contrib/mitthesis/fontsets/mitthesis-termes.tex +++ b/macros/latex/contrib/mitthesis/fontsets/mitthesis-termes.tex @@ -1,5 +1,5 @@ % From mitthesis package -% Version: 1.01, 2023/06/19 +% Version: 1.02, 2023/07/03 % Documentation: https://ctan.org/pkg/mitthesis @@ -14,7 +14,7 @@ \RequirePackage{bm} \else \typeout{^^JLoading TeX Gyre Termes text and math fonts, Heros sans serif font, and Cursor monospaced font^^J} - \usepackage[warnings-off={mathtools-colon,mathtools-overbracket}]{unicode-math} + \RequirePackage[warnings-off={mathtools-colon,mathtools-overbracket}]{unicode-math} % suppress tiresome warnings about lack of integration between mathtools and unicode-math % unicode-math loads the fontspec package % diff --git a/macros/latex/contrib/mitthesis/mitthesis.cls b/macros/latex/contrib/mitthesis/mitthesis.cls index 92e237e18d..b0453036a9 100644 --- a/macros/latex/contrib/mitthesis/mitthesis.cls +++ b/macros/latex/contrib/mitthesis/mitthesis.cls @@ -7,8 +7,8 @@ %% MIT Libraries' requirements as of 2023. %% %% This file's version and date: - \def\versionno{1.03} - \def\versiondate{2023/06/26\space} + \def\versionno{1.04} + \def\versiondate{2023/07/03\space} %% %% Author: John H. Lienhard, V %% Department of Mechanical Engineering @@ -227,12 +227,26 @@ \titleformat{\section}{\mathversion{bold}\normalfont\Large\bfseries}{\thesection }{1em}{} \titleformat{\subsection}{\mathversion{bold}\normalfont\large\bfseries}{\thesubsection}{1em}{} \titleformat{\subsubsection}{\mathversion{bold}\normalfont\normalsize\bfseries}{\thesubsubsection}{1em}{} - % ==> NOT every font includes a bold math version, so you may need to use other math macros in the headings to get bold math <== + % ==> NOT every font includes a bold math version, so you may need to use other math macros in the headings to get bold math <== \fi %% Font loading -\typeout{^^JFontset key is \mit@fontset^^J} -\input{fontsets/\ClassName-\mit@fontset.tex} +\typeout{^^JFontset key is \mit@fontset.^^J} +\IfFileExists{fontsets/\ClassName-\mit@fontset.tex}{% 2023/07/03 + \input{fontsets/\ClassName-\mit@fontset.tex} +}{% + \typeout{^^JFontset file \ClassName-\mit@fontset.tex not found, using defaultfonts.} + \ifpdftex + \typeout{^^JLoading Computer Modern text and math fonts (default for pdftex).^^J} + \RequirePackage[T1]{fontenc} + \RequirePackage{bm} + \else + \typeout{^^JLoading Latin Modern text and math fonts (default for unicode engines).^^J} + \RequirePackage[warnings-off={mathtools-colon,mathtools-overbracket}]{unicode-math} + % suppress tiresome warnings about lack of integration between mathtools and unicode-math. + % Unicode-math loads fontspec package, but default fonts are not selected by fontspec in this case. + \fi +} \RequirePackage{graphicx} diff --git a/macros/latex/contrib/profcollege/doc/ProfCollege-doc.pdf b/macros/latex/contrib/profcollege/doc/ProfCollege-doc.pdf Binary files differindex d93d8015fc..08d43af5fa 100644 --- a/macros/latex/contrib/profcollege/doc/ProfCollege-doc.pdf +++ b/macros/latex/contrib/profcollege/doc/ProfCollege-doc.pdf diff --git a/macros/latex/contrib/profcollege/latex/PfCAutomatismes.tex b/macros/latex/contrib/profcollege/latex/PfCAutomatismes.tex new file mode 100644 index 0000000000..fbf80943d4 --- /dev/null +++ b/macros/latex/contrib/profcollege/latex/PfCAutomatismes.tex @@ -0,0 +1,227 @@ +%%% +% Automatismes +%%% +\NewDocumentCommand\ChoixAleaMixold{mmmm}{% + \ChoixAlea{1}{2}{\Autograine}% + \ifnum\Autograine=1\relax% + \ifnum#3=\useKV[Automatismes]{ValeurMin}\relax% + \xdef#4{\fpeval{randint(#3+1,#2)}}% + \else% + \xdef#4{\fpeval{randint(#1,#3-1)}}% + \fi% + \else% + \ifnum#3=\useKV[Automatismes]{ValeurMax}\relax% + \xdef#4{\fpeval{randint(#1,#3-1)}}% + \else% + \xdef#4{\fpeval{randint(#3+1,#2)}}% + \fi% + \fi% +}% + +\NewDocumentCommand\ChoixAleaMix{mmmm}{% + \xintifboolexpr{#1==0 || #1==#3}{% + \xdef\PfCListeNombreMix{\fpeval{#1+1}}% + \xdef\PfCAutoDebutCompte{2}% + }{% + \xdef\PfCListeNombreMix{#1}% + \xdef\PfCAutoDebutCompte{1}% + }% + \xintFor* ##1 in{\xintSeq{\PfCAutoDebutCompte}{\fpeval{#2-#1}}}\do{% + \xintifboolexpr{\fpeval{#1+##1}==0 || \fpeval{#1+##1}==#3}{}{% + \xdef\PfCListeNombreMix{\PfCListeNombreUn,\fpeval{\useKV[Automatismes]{ValeurMin}+##1}}% + }% + }% + \MelangeListe{\PfCListeNombreMix}{1}% + \xdef#4{\faa}% +}% + +\newcounter{PfCAutoNbcpt}% + +\NewDocumentCommand\ChoixNombreUn{om}{% + \setKV[Automatismes]{#1}% + \ifboolKV[Automatismes]{Fractions}{% + \xdef\PfCAutoNumUn{\PfCListeNombreMelangeUn[\thePfCAutoNbcpt]}% + \ChoixAleaMix{\useKV[Automatismes]{ValeurMin}}{\useKV[Automatismes]{ValeurMax}}{\PfCAutoNumUn}{\PfCAutomatismesPremierTerme}% + }{% + \xdef\PfCAutoNombreUn{\PfCListeNombreMelangeUn[\thePfCAutoNbcpt]}% + }% +}% + +\NewDocumentCommand\ChoixNombreDeux{om}{% + \setKV[Automatismes]{#1}% + \ifboolKV[Automatismes]{Fractions}{% + \IfStrEq{\PfCAutomatismesListeOperations[#2]}{+}{% + \ChoixAleaMix{\useKV[Automatismes]{ValeurMin}}{\useKV[Automatismes]{ValeurMax}}{\PfCAutomatismesPremierTerme}{\PfCAutoNumDeux}% + \xdef\PfCAutomatismesDeuxiemeTerme{\PfCAutomatismesPremierTerme}% + }{% + \IfStrEq{\PfCAutomatismesListeOperations[#2]}{-}{% + \ChoixAleaMix{\useKV[Automatismes]{ValeurMin}}{\useKV[Automatismes]{ValeurMax}}{\PfCAutomatismesPremierTerme}{\PfCAutoNumDeux}% + \xdef\PfCAutomatismesDeuxiemeTerme{\PfCAutomatismesPremierTerme}% + }{% + \xdef\PfCAutoNumDeux{\PfCListeNombreMelangeDeux[\thePfCAutoNbcpt]}% + \ChoixAleaMix{\useKV[Automatismes]{ValeurMin}}{\useKV[Automatismes]{ValeurMax}}{0}{\PfCAutomatismesDeuxiemeTerme}% + }% + }% + }{% + \ifboolKV[Automatismes]{Relatifs}{% + \IfStrEq{\PfCAutomatismesListeOperations[#2]}{/}{% + \xdef\PfCAutoNombreDeux{\PfCListeNombreMelangeDeux[\thePfCAutoNbcpt]}% + \VariableAlea{\PfCAutoNombreUn}{\PfCAutoNombreUn*\PfCAutoNombreDeux}% + }{% + \xdef\PfCAutoNombreDeux{\PfCListeNombreMelangeDeux[\thePfCAutoNbcpt]}% + }% + }{% + % Entiers + \IfStrEq{\PfCAutomatismesListeOperations[#2]}{-}{% + \xdef\PfCAutoRetiensDif{\fpeval{\PfCListeNombreMelangeUn[\thePfCAutoNbcpt]-\PfCListeNombreMelangeDeux[\thePfCAutoNbcpt]}}% + \ifnum\PfCAutoRetiensDif<0\relax% + \xdef\PfCAutoNombreUn{\PfCListeNombreMelangeDeux[\thePfCAutoNbcpt]}% + \xdef\PfCAutoNombreDeux{\fpeval{\PfCAutoNombreUn+\PfCAutoRetiensDif}}% + \else% + \xdef\PfCAutoNombreUn{\PfCListeNombreMelangeUn[\thePfCAutoNbcpt]}% + \xdef\PfCAutoNombreDeux{\PfCListeNombreMelangeDeux[\thePfCAutoNbcpt]}% + \fi + }{% + \IfStrEq{\PfCAutomatismesListeOperations[#2]}{/}{% + \xdef\PfCAutoNombreDeux{\PfCListeNombreMelangeDeux[\thePfCAutoNbcpt]}% + \VariableAlea{\PfCAutoNombreUn}{\PfCAutoNombreUn*\PfCAutoNombreDeux}% + }{% + \xdef\PfCAutoNombreDeux{\PfCListeNombreMelangeDeux[\thePfCAutoNbcpt]}% + }% + }% + }% + }% +}% + +\NewDocumentCommand\SoustractionPositive{omm}{% + \setKV[Automatismes]{#1}% + \ifboolKV[Automatismes]{Relatifs}{% + \PfCNum{#2}-\PfCNum{#3}% + }{% + \ifnum#2>#3\relax% + \num{#2}-\num{#3}% + \else% + \num{#3}-\num{#2}% + \fi% + }% +}% + +\setKVdefault[Automatismes]{Questions=10,ValeurMin=1,ValeurMax=15,Entiers,Relatifs=false,Fractions=false,Stretch=1.5,Graines=false,Priorites=false}% +\defKV[Automatismes]{Graine=\setKV[Automatismes]{Graines}}% + +\newcommand\PfCTabstrut{\rule{0pt}{2.4ex}}% Top strut + +\NewDocumentCommand\Automatismes{o m}{% + \setcounter{PfCAutoNbcpt}{0}% + \useKVdefault[Automatismes]% + \setKV[Automatismes]{#1}% + \ifboolKV[Automatismes]{Graines}{\PfCGraineAlea{\useKV[Automatismes]{Graine}}}{}% + \xdef\PfCAutomatismesEtages{\fpeval{\useKV[Automatismes]{Questions}}}% + % On définit deux listes de nombres + \xdef\PfCListeNombreUn{\useKV[Automatismes]{ValeurMin}}% + \xintFor* ##1 in{\xintSeq{1}{\fpeval{\useKV[Automatismes]{ValeurMax}-\useKV[Automatismes]{ValeurMin}}}}\do{% + \xintifboolexpr{\fpeval{\useKV[Automatismes]{ValeurMin}+##1}==0}{}{% + \xdef\PfCListeNombreUn{\PfCListeNombreUn,\fpeval{\useKV[Automatismes]{ValeurMin}+##1}}% + }% + }% + \MelangeListe{\PfCListeNombreUn}{\fpeval{\useKV[Automatismes]{ValeurMax}-\useKV[Automatismes]{ValeurMin}+1}}% + \readlist*\PfCListeNombreMelangeUn{\faa}% + %%% la deuxième + \xdef\PfCListeNombreDeux{\useKV[Automatismes]{ValeurMin}}% + \xintFor* ##1 in{\xintSeq{1}{\fpeval{\useKV[Automatismes]{ValeurMax}-\useKV[Automatismes]{ValeurMin}}}}\do{% + \xintifboolexpr{\fpeval{\useKV[Automatismes]{ValeurMin}+##1}==0}{}{% + \xdef\PfCListeNombreDeux{\PfCListeNombreDeux,\fpeval{\useKV[Automatismes]{ValeurMin}+##1}}% + }% + }% + \MelangeListe{\PfCListeNombreDeux}{\fpeval{\useKV[Automatismes]{ValeurMax}-\useKV[Automatismes]{ValeurMin}+1}}% + \readlist*\PfCListeNombreMelangeDeux{\faa}% + \setcounter{PfCAutoNbcpt}{0}% + \renewcommand{\arraystretch}{\useKV[Automatismes]{Stretch}}% + \ifboolKV[Automatismes]{Priorites}{% + %On définit une troisième liste + \xdef\PfCListeNombreTrois{\useKV[Automatismes]{ValeurMin}}% + \xintFor* ##1 in{\xintSeq{1}{\fpeval{\useKV[Automatismes]{ValeurMax}-\useKV[Automatismes]{ValeurMin}}}}\do{% + \xintifboolexpr{\fpeval{\useKV[Automatismes]{ValeurMin}+##1}==0}{}{% + \xdef\PfCListeNombreTrois{\PfCListeNombreTrois,\fpeval{\useKV[Automatismes]{ValeurMin}+##1}}% + }% + }% + \MelangeListe{\PfCListeNombreTrois}{\fpeval{\useKV[Automatismes]{ValeurMax}-\useKV[Automatismes]{ValeurMin}+1}}% + \readlist*\PfCListeNombreMelangeTrois{\faa}% +% La liste un est \showitems\PfCListeNombreMelangeUn\\ +% La liste deux est \showitems\PfCListeNombreMelangeDeux\\ +% La liste trois est \showitems\PfCListeNombreMelangeTrois\\ + \begin{NiceTabular}{|ccc|}[hlines]% + \xintFor* ##1 in{\xintSeq{1}{\PfCAutomatismesEtages}}\do{% + % On mélange les opérations + \MelangeListe{+,-}{1}% + \xdef\PfCAutoFoo{\faa ,*}% + \MelangeListe{\PfCAutoFoo}{2}% + \ignoreemptyitems% + \readlist*\PfCAutomatismesListeOperations{\faa}% + \reademptyitems% + % Il faut positiver les soustractions pour les 6eme + \ChoixAlea{1}{2}{\PfCChoixParen}% + \ensuremath{% + \IfStrEq{\PfCAutomatismesListeOperations[1]}{*}{% + \xintifboolexpr{\PfCChoixParen==1}{% + \num{\PfCListeNombreMelangeUn[##1]}\times\left(% + \IfStrEq{\PfCAutomatismesListeOperations[2]}{-}{\SoustractionPositive[#1]{\PfCListeNombreMelangeDeux[##1]}{\PfCListeNombreMelangeTrois[##1]}}{\PfCNum{\PfCListeNombreMelangeDeux[##1]}+\PfCNum{\PfCListeNombreMelangeTrois[##1]}}% + \right)% + }{% + \IfStrEq{\PfCAutomatismesListeOperations[2]}{-}{% + \ifboolKV[Automatismes]{Relatifs}{% + \num{\PfCListeNombreMelangeUn[##1]}\times\PfCNum{\PfCListeNombreMelangeDeux[##1]}\PfCAutomatismesListeOperations[2]\PfCNum{\PfCListeNombreMelangeTrois[##1]}% + }{\xintifboolexpr{\fpeval{\PfCListeNombreMelangeUn[##1]*\PfCListeNombreMelangeDeux[##1]\PfCAutomatismesListeOperations[2]\PfCListeNombreMelangeTrois[##1]}>0}{% + \num{\PfCListeNombreMelangeUn[##1]}\times\PfCNum{\PfCListeNombreMelangeDeux[##1]}\PfCAutomatismesListeOperations[2]\PfCNum{\PfCListeNombreMelangeTrois[##1]}% + }{\num{\PfCListeNombreMelangeTrois[##1]}\PfCAutomatismesListeOperations[2]\PfCNum{\PfCListeNombreMelangeUn[##1]}\times\PfCNum{\PfCListeNombreMelangeDeux[##1]}% + }% + } + }{% + \num{\PfCListeNombreMelangeTrois[##1]}\PfCAutomatismesListeOperations[2]\PfCNum{\PfCListeNombreMelangeUn[##1]}\times\PfCNum{\PfCListeNombreMelangeDeux[##1]}% + % }% + }% + }% + }% + {% + \xintifboolexpr{\PfCChoixParen==1}{% + \left(\IfStrEq{\PfCAutomatismesListeOperations[2]}{-}{\SoustractionPositive[#1]{\PfCListeNombreMelangeUn[##1]}{\PfCListeNombreMelangeDeux[##1]}}{\PfCNum{\PfCListeNombreMelangeUn[##1]}+\PfCNum{\PfCListeNombreMelangeDeux[##1]}}\right)\times\PfCNum{\PfCListeNombreMelangeTrois[##1]}% + }{% + \ifboolKV[Automatismes]{Relatifs}{% + \num{\PfCListeNombreMelangeDeux[##1]}\times\PfCNum{\PfCListeNombreMelangeTrois[##1]}\PfCAutomatismesListeOperations[1]\PfCNum{\PfCListeNombreMelangeUn[##1]}% + }{% + \xintifboolexpr{\fpeval{\PfCListeNombreMelangeUn[##1]\PfCAutomatismesListeOperations[1]\PfCListeNombreMelangeDeux[##1]*\PfCListeNombreMelangeTrois[##1]}>0}{% + \num{\PfCListeNombreMelangeUn[##1]}\PfCAutomatismesListeOperations[1]\PfCNum{\PfCListeNombreMelangeDeux[##1]}\times\PfCNum{\PfCListeNombreMelangeTrois[##1]}}{% + \num{\PfCListeNombreMelangeDeux[##1]}\times\PfCNum{\PfCListeNombreMelangeTrois[##1]}\PfCAutomatismesListeOperations[1]\PfCNum{\PfCListeNombreMelangeUn[##1]}}% + }% + }% + }% + }% + &=&\pointilles[1cm]\\ + }% + \end{NiceTabular}% + }{% + \setsepchar{,}\ignoreemptyitems% + \readlist*\PfCAutomatismesListeOperations{#2}% + \reademptyitems% + \begin{NiceTabular}{|ccccc|}[hlines] + \xintFor* ##1 in{\xintSeq{1}{\PfCAutomatismesEtages}}\do{% + \stepcounter{PfCAutoNbcpt}% + \xintifboolexpr{\PfCAutomatismesListeOperationslen==1}{% + \ChoixNombreUn[#1]{1}\ChoixNombreDeux[#1]{1}% + }{% + \ChoixNombreUn[#1]{##1}\ChoixNombreDeux[#1]{##1}% + }% + \Block{}{\ifboolKV[Automatismes]{Fractions}{$\dfrac{\PfCTabstrut\num{\PfCAutoNumUn}}{\PfCBstrut\num{\PfCAutomatismesPremierTerme}}$}{\num{\PfCAutoNombreUn}}}% + &\xintifboolexpr{\PfCAutomatismesListeOperationslen==1}{% + \StrSubstitute{\PfCAutomatismesListeOperations[1]}{*}{\times}[\PfCCBAffiche]% + }{% + \StrSubstitute{\PfCAutomatismesListeOperations[##1]}{*}{\times}[\PfCCBAffiche]% + }% + \StrSubstitute{\PfCCBAffiche}{/}{\div}[\PfCCBAffiche]% + $\PfCCBAffiche$% + &\Block{}{\ifboolKV[Automatismes]{Fractions}{$\dfrac{\PfCTabstrut\num{\PfCAutoNumDeux}}{\PfCBstrut\num{\PfCAutomatismesDeuxiemeTerme}}$}{\PfCNum{\PfCAutoNombreDeux}}}% + &=&\pointilles[1cm]\\ + }% + \end{NiceTabular}% + }% +}%
\ No newline at end of file diff --git a/macros/latex/contrib/profcollege/latex/PfCCartographie.tex b/macros/latex/contrib/profcollege/latex/PfCCartographie.tex index 9156779cd7..fdfa7cd0a5 100644 --- a/macros/latex/contrib/profcollege/latex/PfCCartographie.tex +++ b/macros/latex/contrib/profcollege/latex/PfCCartographie.tex @@ -1,17 +1,17 @@ %%% % 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/2022/texmf-dist/metapost/profcollege/datastest/",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} \defKV[Cartographie]{EchelleCarte=\setKV[Cartographie]{Carte}} \defKV[Cartographie]{Pays=\setKV[Cartographie]{PaysSeul}} \defKV[Cartographie]{Villes=\setKV[Cartographie]{VillesSup}} \newcommand\Cartographie[3][]{% - \ifluatex - \useKVdefault[Cartographie] - \setKV[Cartographie]{#1} + \ifluatex% + \useKVdefault[Cartographie]% + \setKV[Cartographie]{#1}% + \mplibforcehmode% \ifboolKV[Cartographie]{Projection}{% - \mplibforcehmode \begin{mplibcode} input PfCMonde; string arborescence; @@ -131,7 +131,7 @@ fi; \end{mplibcode} }{% - \mplibforcehmode +% \mplibforcehmode \begin{mplibcode} input PfCMonde; string arborescence; @@ -169,7 +169,7 @@ 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&\useKV[Cartographie]{Pays}&".dat",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)); @@ -201,6 +201,7 @@ closefrom nomfichiermul; fi; else: + draw(0,0)--(50,50); mappemonde(#2,#3); fi; \end{mplibcode} diff --git a/macros/latex/contrib/profcollege/latex/PfCDobble.tex b/macros/latex/contrib/profcollege/latex/PfCDobble.tex index e330d761aa..c832caf892 100644 --- a/macros/latex/contrib/profcollege/latex/PfCDobble.tex +++ b/macros/latex/contrib/profcollege/latex/PfCDobble.tex @@ -23,5 +23,5 @@ \xintifboolexpr{\PfCListeSymboleDobblelen==\PfCDobbleTotalSymboles}{% \dobble{\PfCDobbleNiveau}% }{% - Pour un dooble basé sur le nombre premier \useKV[ClesDobble]{Niveau}, le nombre de symboles doit être égal à \num{\PfCDobbleTotalSymboles}.}% + Pour un dobble basé sur le nombre premier \useKV[ClesDobble]{Niveau}, le nombre de symboles doit être égal à \num{\PfCDobbleTotalSymboles}.}% }%
\ No newline at end of file diff --git a/macros/latex/contrib/profcollege/latex/PfCEcrireQCMold.tex b/macros/latex/contrib/profcollege/latex/PfCEcrireQCMold.tex new file mode 100644 index 0000000000..a7d4622f5f --- /dev/null +++ b/macros/latex/contrib/profcollege/latex/PfCEcrireQCMold.tex @@ -0,0 +1,148 @@ +%%% +% 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/PfCEcrireunQCM.tex b/macros/latex/contrib/profcollege/latex/PfCEcrireunQCM.tex index bd0cb57204..6233753795 100644 --- a/macros/latex/contrib/profcollege/latex/PfCEcrireunQCM.tex +++ b/macros/latex/contrib/profcollege/latex/PfCEcrireunQCM.tex @@ -6,6 +6,7 @@ \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][]{% @@ -13,12 +14,12 @@ \setKV[ClesQCM]{#1}% \setcounter{QuestionQCM}{\fpeval{\useKV[ClesQCM]{Depart}-1}}% \setcounter{TitreQCM}{0} - \setsepchar[*]{§*&}\ignoreemptyitems% + \setsepchar[*]{,*&}\ignoreemptyitems% \readlist*\ListeQCM{#2}% + \renewcommand{\arraystretch}{\useKV[ClesQCM]{Stretch}}% + \xdef\NBcases{\fpeval{\useKV[ClesQCM]{Reponses}+1}}% \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}% @@ -35,13 +36,13 @@ }% \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}% - \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}% @@ -55,9 +56,9 @@ \hline% \end{tabular} }{% - \renewcommand{\arraystretch}{\useKV[ClesQCM]{Stretch}}% + %\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\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{% @@ -75,7 +76,7 @@ }% }% \renewcommand{\arraystretch}{1}% - }% + } }{% \newcommand\QCM[2][]{% \useKVdefault[ClesQCM]% @@ -84,10 +85,10 @@ \setcounter{TitreQCM}{0} \setsepchar[*]{,*&}\ignoreemptyitems% \readlist*\ListeQCM{#2}% + \renewcommand{\arraystretch}{\useKV[ClesQCM]{Stretch}}% + \xdef\NBcases{\fpeval{\useKV[ClesQCM]{Reponses}+1}}% \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}% @@ -108,7 +109,7 @@ }{% \ifboolKV[ClesQCM]{VF}{% \setKV[ClesQCM]{Reponses=2}% - \renewcommand{\arraystretch}{\useKV[ClesQCM]{Stretch}}% +% \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}}% @@ -124,9 +125,9 @@ \hline% \end{tabular} }{% - \renewcommand{\arraystretch}{\useKV[ClesQCM]{Stretch}}% + %\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\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{% diff --git a/macros/latex/contrib/profcollege/latex/PfCEcritureUnites.tex b/macros/latex/contrib/profcollege/latex/PfCEcritureUnites.tex index d532e10b2f..c4b19598fb 100644 --- a/macros/latex/contrib/profcollege/latex/PfCEcritureUnites.tex +++ b/macros/latex/contrib/profcollege/latex/PfCEcritureUnites.tex @@ -191,9 +191,9 @@ }% }% -\NewDocumentCommand\Lg{o m}{% +\NewDocumentCommand\Lg{s o m}{% \useKVdefault[Unites]% - \setKV[Unites]{#1}% + \setKV[Unites]{#2}% \ifboolKV[Unites]{nm}{% \DeclareSIUnit{\Tempo}{\nano\meter}% }{% @@ -226,18 +226,27 @@ }% }% }% - }% - \ifboolKV[Unites]{Nombre}{% - \SI{#2}{\Tempo}% + }% + \IfBooleanTF{#1}{% + \ifboolKV[Unites]{Nombre}{% + \SI[parse-numbers=false]{#3}{\Tempo}% + }{% + \setlength{\PfCLgUnites}{\useKV[Unites]{Dots}}% + \pointilles[\PfCLgUnites]\,\si{\Tempo}% + }% }{% - \setlength{\PfCLgUnites}{\useKV[Unites]{Dots}}% - \pointilles[\PfCLgUnites]\,\si{\Tempo}% + \ifboolKV[Unites]{Nombre}{% + \SI{#3}{\Tempo}% + }{% + \setlength{\PfCLgUnites}{\useKV[Unites]{Dots}}% + \pointilles[\PfCLgUnites]\,\si{\Tempo}% + }% }% }% -\NewDocumentCommand\Masse{o m}{% +\NewDocumentCommand\Masse{s o m}{% \useKVdefault[Unites]% - \setKV[Unites]{#1}% + \setKV[Unites]{#2}% \ifboolKV[Unites]{ng}{% \DeclareSIUnit{\Tempo}{\nano\gram}% }{\ifboolKV[Unites]{ug}{% @@ -271,17 +280,26 @@ }% }% }% - \ifboolKV[Unites]{Nombre}{% - \SI{#2}{\Tempo}% + \IfBooleanTF{#1}{% + \ifboolKV[Unites]{Nombre}{% + \SI[parse-numbers=false]{#3}{\Tempo}% + }{% + \setlength{\PfCLgUnites}{\useKV[Unites]{Dots}}% + \pointilles[\PfCLgUnites]\,\si{\Tempo}% + }% + }{% + \ifboolKV[Unites]{Nombre}{% + \SI{#3}{\Tempo}% }{% \setlength{\PfCLgUnites}{\useKV[Unites]{Dots}}% \pointilles[\PfCLgUnites]\,\si{\Tempo}% }% + } }% -\NewDocumentCommand\Capa{o m}{% +\NewDocumentCommand\Capa{s o m}{% \useKVdefault[Unites]% - \setKV[Unites]{#1}% + \setKV[Unites]{#2}% \ifboolKV[Unites]{kL}{% \DeclareSIUnit{\Tempo}{\kilo\liter}% }{\ifboolKV[Unites]{hL}{% @@ -302,17 +320,26 @@ }% }% }% + \IfBooleanTF{#1}{% + \ifboolKV[Unites]{Nombre}{% + \SI[parse-numbers=false]{#3}{\Tempo}% + }{% + \setlength{\PfCLgUnites}{\useKV[Unites]{Dots}}% + \pointilles[\PfCLgUnites]\,\si{\Tempo}% + }% + }{% \ifboolKV[Unites]{Nombre}{% - \SI{#2}{\Tempo}% + \SI{#3}{\Tempo}% }{% \setlength{\PfCLgUnites}{\useKV[Unites]{Dots}}% \pointilles[\PfCLgUnites]\,\si{\Tempo}% }% + }% }% -\NewDocumentCommand\Aire{o m}{% +\NewDocumentCommand\Aire{s o m}{% \useKVdefault[Unites]% - \setKV[Unites]{#1}% + \setKV[Unites]{#2}% \ifboolKV[Unites]{ha}{% \DeclareSIUnit{\Tempo}{\hectare}% }{% @@ -354,17 +381,26 @@ }% }% }% - \ifboolKV[Unites]{Nombre}{% - \SI{#2}{\Tempo}% + \IfBooleanTF{#1}{% + \ifboolKV[Unites]{Nombre}{% + \SI[parse-numbers=false]{#3}{\Tempo}% + }{% + \setlength{\PfCLgUnites}{\useKV[Unites]{Dots}}% + \pointilles[\PfCLgUnites]\,\si{\Tempo}% + }% }{% - \setlength{\PfCLgUnites}{\useKV[Unites]{Dots}}% - \pointilles[\PfCLgUnites]\,\si{\Tempo}% + \ifboolKV[Unites]{Nombre}{% + \SI{#3}{\Tempo}% + }{% + \setlength{\PfCLgUnites}{\useKV[Unites]{Dots}}% + \pointilles[\PfCLgUnites]\,\si{\Tempo}% + }% }% }% -\NewDocumentCommand\Vol{o m}{% +\NewDocumentCommand\Vol{s o m}{% \useKVdefault[Unites]% - \setKV[Unites]{#1}% + \setKV[Unites]{#2}% \ifboolKV[Unites]{nm}{% \DeclareSIUnit{\Tempo}{\nano\meter}% }{% @@ -397,12 +433,21 @@ }% }% }% - }% - \ifboolKV[Unites]{Nombre}{% - \SI{#2}{\cubic\Tempo}% + }% + \IfBooleanTF{#1}{% + \ifboolKV[Unites]{Nombre}{% + \SI[parse-numbers=false]{#3}{\cubic\Tempo}% + }{% + \setlength{\PfCLgUnites}{\useKV[Unites]{Dots}}% + \pointilles[\PfCLgUnites]\,\si{\cubic\Tempo}% + }% }{% - \setlength{\PfCLgUnites}{\useKV[Unites]{Dots}}% - \pointilles[\PfCLgUnites]\,\si{\cubic\Tempo}% + \ifboolKV[Unites]{Nombre}{% + \SI{#3}{\cubic\Tempo}% + }{% + \setlength{\PfCLgUnites}{\useKV[Unites]{Dots}}% + \pointilles[\PfCLgUnites]\,\si{\cubic\Tempo}% + }% }% }% diff --git a/macros/latex/contrib/profcollege/latex/PfCFonctionAffine.tex b/macros/latex/contrib/profcollege/latex/PfCFonctionAffine.tex index 3c29cfcae3..b9ff48e176 100644 --- a/macros/latex/contrib/profcollege/latex/PfCFonctionAffine.tex +++ b/macros/latex/contrib/profcollege/latex/PfCFonctionAffine.tex @@ -1,7 +1,7 @@ %%% % Fonction Affine %%% -\setKVdefault[ClesAffine]{Nom=f,Variable=x,Ligne=false,Image=false,Antecedent=false,Graphique=false,Retrouve=false,ProgCalcul=false,Unitex=1,Unitey=1,VoirCoef=false,ACoef=0,Redaction=false,Ecriture=false,Definition=false}%ACoefficient=false%: inutile ? +\setKVdefault[ClesAffine]{Nom=f,Variable=x,CoefDir=a,OrdoOrig=b,Ligne=false,Image=false,Antecedent=false,Graphique=false,Retrouve=false,ProgCalcul=false,Unitex=1,Unitey=1,VoirCoef=false,ACoef=0,Redaction=false,Ecriture=false,Definition=false}%ACoefficient=false%: inutile ? \newcommand\FonctionAffine[5][]{% % #1 nombre ou abscisse premier point @@ -58,20 +58,20 @@ }% }{% \ifboolKV[ClesAffine]{Retrouve}{% - On sait que $\useKV[ClesAffine]{Nom}$ est une fonction affine. Donc elle s'\'ecrit sous la forme : \[\useKV[ClesAffine]{Nom}(\useKV[ClesAffine]{Variable})=a\useKV[ClesAffine]{Variable}+b\] + On sait que $\useKV[ClesAffine]{Nom}$ est une fonction affine. Donc elle s'\'ecrit sous la forme : \[\useKV[ClesAffine]{Nom}(\useKV[ClesAffine]{Variable})=\useKV[ClesAffine]{CoefDir}\useKV[ClesAffine]{Variable}+\useKV[ClesAffine]{OrdoOrig}\] Or, $\useKV[ClesAffine]{Nom}(\num{#2})=\num{#3}$ et $\useKV[ClesAffine]{Nom}(\num{#4})=\num{#5}$. Par cons\'equent, d'apr\`es la propri\'et\'e des accroissements : \begin{align*} - a&=\frac{\useKV[ClesAffine]{Nom}(\num{#2})-\useKV[ClesAffine]{Nom}(\num{#4})}{\num{#2}-\xintifboolexpr{#4<0}{(\num{#4})}{\num{#4}}}\\ - a&=\frac{\num{#3}-\xintifboolexpr{#5<0}{(\num{#5})}{\num{#5}}}{\num{\fpeval{#2-#4}}}\\ - a&=\frac{\num{\fpeval{#3-#5}}}{\num{\fpeval{#2-#4}}}%\\ - \SSimpliTest{\fpeval{#3-#5}}{\fpeval{#2-#4}}\ifthenelse{\boolean{Simplification}}{\\a&=\SSimplifie{\fpeval{#3-#5}}{\fpeval{#2-#4}}}{}% + \useKV[ClesAffine]{CoefDir}&=\frac{\useKV[ClesAffine]{Nom}(\num{#2})-\useKV[ClesAffine]{Nom}(\num{#4})}{\num{#2}-\xintifboolexpr{#4<0}{(\num{#4})}{\num{#4}}}\\ + \useKV[ClesAffine]{CoefDir}&=\frac{\num{#3}-\xintifboolexpr{#5<0}{(\num{#5})}{\num{#5}}}{\num{\fpeval{#2-#4}}}\\ + \useKV[ClesAffine]{CoefDir}&=\frac{\num{\fpeval{#3-#5}}}{\num{\fpeval{#2-#4}}}%\\ + \SSimpliTest{\fpeval{#3-#5}}{\fpeval{#2-#4}}\ifthenelse{\boolean{Simplification}}{\\\useKV[ClesAffine]{CoefDir}&=\SSimplifie{\fpeval{#3-#5}}{\fpeval{#2-#4}}}{}% \end{align*} - La fonction $\useKV[ClesAffine]{Nom}$ s'\'ecrit alors sous la forme $\displaystyle\useKV[ClesAffine]{Nom}(\useKV[ClesAffine]{Variable})=\SSimplifie{\fpeval{#3-#5}}{\fpeval{#2-#4}}\useKV[ClesAffine]{Variable}+b$. + La fonction $\useKV[ClesAffine]{Nom}$ s'\'ecrit alors sous la forme $\displaystyle\useKV[ClesAffine]{Nom}(\useKV[ClesAffine]{Variable})=\SSimplifie{\fpeval{#3-#5}}{\fpeval{#2-#4}}\useKV[ClesAffine]{Variable}+\useKV[ClesAffine]{OrdoOrig}$. \\De plus, comme $\useKV[ClesAffine]{Nom}(\num{#2})=\num{#3}$, alors : \begin{align*} - \SSimplifie{\fpeval{#3-#5}}{\fpeval{#2-#4}}\times\xintifboolexpr{#2<0}{(\num{#2})}{\num{#2}}+b&=\num{#3}\\ - \SSimplifie{\fpeval{(#3-#5)*#2}}{\fpeval{#2-#4}}+b&=\num{#3}\\ - b&=\num{\fpeval{#3-(#3-#5)*#2/(#2-#4)}} + \SSimplifie{\fpeval{#3-#5}}{\fpeval{#2-#4}}\times\xintifboolexpr{#2<0}{(\num{#2})}{\num{#2}}+\useKV[ClesAffine]{OrdoOrig}&=\num{#3}\\ + \SSimplifie{\fpeval{(#3-#5)*#2}}{\fpeval{#2-#4}}+\useKV[ClesAffine]{OrdoOrig}&=\num{#3}\\ + \useKV[ClesAffine]{OrdoOrig}&=\num{\fpeval{#3-(#3-#5)*#2/(#2-#4)}} \end{align*} \xdef\OrdOrigine{\fpeval{#3-(#3-#5)*#2/(#2-#4)}} La fonction affine $\useKV[ClesAffine]{Nom}$ cherch\'ee est : diff --git a/macros/latex/contrib/profcollege/latex/PfCJeuRangement.tex b/macros/latex/contrib/profcollege/latex/PfCJeuRangement.tex index f9530be658..a36720d06a 100644 --- a/macros/latex/contrib/profcollege/latex/PfCJeuRangement.tex +++ b/macros/latex/contrib/profcollege/latex/PfCJeuRangement.tex @@ -39,7 +39,8 @@ \Rangement[Seul]{\faa}% \PfCListeRgtRecup \setsepchar{,}% % Liste des nombres - \readlist*\ListeDesNombres{\PfCListeRgtRecup} + % \readlist*\ListeDesNombres{\PfCListeRgtRecup} + \readlist*\ListeDesNombres{\PfCRetiensRangement} }{% \setsepchar{,}% % Liste des nombres diff --git a/macros/latex/contrib/profcollege/latex/PfCMentalo.tex b/macros/latex/contrib/profcollege/latex/PfCMentalo.tex index 48ac74aef3..da5dfc85e7 100644 --- a/macros/latex/contrib/profcollege/latex/PfCMentalo.tex +++ b/macros/latex/contrib/profcollege/latex/PfCMentalo.tex @@ -1,10 +1,18 @@ %%% % Mentalo %%% -\NewDocumentCommand\PfCNum{m}{% +\NewDocumentCommand\PfCNumold{m}{% \xintifboolexpr{#1<0}{(\num{#1})}{\num{#1}}% }% +\NewDocumentCommand\PfCNum{m}{% + \ifnum#1<0\relax% + (\num{#1})% + \else% + \num{#1}% + \fi% +}% + \setKVdefault[Mentalo]{Questions=10,ValeurMin=1,ValeurMax=15} \NewDocumentCommand\Mentalo{o m}{% diff --git a/macros/latex/contrib/profcollege/latex/PfCNonogramme.tex b/macros/latex/contrib/profcollege/latex/PfCNonogramme.tex index 8c72ca696e..1493a2fcd8 100644 --- a/macros/latex/contrib/profcollege/latex/PfCNonogramme.tex +++ b/macros/latex/contrib/profcollege/latex/PfCNonogramme.tex @@ -104,7 +104,7 @@ if unknown Sequence[cptnblignes][k]: else: nbpas:=nbpas+1; - label.lft(TEX(Sequence[cptnblignes][k]),(0,0) shifted (-(nbpas-1)*5mm-2.5mm,u*(-cptnblignes+0.5))); + label.lft(TEX(Sequence[cptnblignes][k]),(0,0) shifted (-(nbpas-1)*0.5*u-0.25*u,u*(-cptnblignes+0.5))); fi; endfor; endfor; @@ -130,7 +130,7 @@ if unknown SequenceCol[cptnbcolonnes][k]: else: nbpas:=nbpas+1; - label.top(TEX(SequenceCol[cptnbcolonnes][k]),(0,0) shifted (u*(cptnbcolonnes-0.5),(nbpas-1)*5mm+2.5mm)); + label.top(TEX(SequenceCol[cptnbcolonnes][k]),(0,0) shifted (u*(cptnbcolonnes-0.5),(nbpas-1)*0.5*u+0.25*u)); fi; endfor; endfor; diff --git a/macros/latex/contrib/profcollege/latex/PfCNotionFonction.tex b/macros/latex/contrib/profcollege/latex/PfCNotionFonction.tex index 65ec863b11..bb21fbb6ae 100644 --- a/macros/latex/contrib/profcollege/latex/PfCNotionFonction.tex +++ b/macros/latex/contrib/profcollege/latex/PfCNotionFonction.tex @@ -1,7 +1,7 @@ %%% % Fonction %%% -\setKVdefault[ClesFonction]{Nom=f,Variable=x,Calcul=x,Tableau=false,Largeur=5mm,Ecriture=false,Definition=false,Points=false,Tangentes=false,PasX=1,PasY=1,UniteX=1,UniteY=1,Prolonge=false,Trace=false,Catmull=false,Epaisseur=1,Couleur=black,CouleurTrace=black,PointsCourbe=true,Codes=false,Origine={(0,0)},Vide=false} +\setKVdefault[ClesFonction]{Nom=f,Variable=x,Calcul=x,Tableau=false,Largeur=5mm,Ecriture=false,Definition=false,Points=false,Tangentes=false,PasX=1,PasY=1,UniteX=1,UniteY=1,Prolonge=false,Trace=false,Catmull=false,Splines=false,Epaisseur=1,Couleur=black,CouleurTrace=black,PointsCourbe=true,Codes=false,Origine={(0,0)},Vide=false} \defKV[ClesFonction]{Traces=\setKV[ClesFonction]{Codes}}% \newtoks\toklistePtsFn%pour la discipline @@ -38,6 +38,80 @@ \toklistePtsFn{}% \setsepchar[*]{§*/}%\ignoreemptyitems% \readlist*\ListePoints{#2}% + \ifboolKV[ClesFonction]{Splines}{% + \xdef\PfCFooListePoints{}% + \foreachitem\compteur\in\ListePoints{% + \xdef\PfCFooListePoints{\PfCFooListePoints (\ListePoints[\compteurcnt,2],\ListePoints[\compteurcnt,3]),(\ListePoints[\compteurcnt,1],\ListePoints[\compteurcnt,4]),}% + }% + \MPSpline{\PfCFooListePoints}{\useKV[ClesFonction]{PasX}}{\useKV[ClesFonction]{PasY}}{\useKV[ClesFonction]{UniteX}}{\useKV[ClesFonction]{UniteY}}% + }{% + \ifboolKV[ClesFonction]{Catmull}{% + \xdef\PfCFooListePoints{(\ListePoints[1,2],\ListePoints[1,3]),}% + \foreachitem\compteur\in\ListePoints{% + \xdef\PfCFooListePoints{\PfCFooListePoints (\ListePoints[\compteurcnt,2],\ListePoints[\compteurcnt,3]),}% + }% + \xdef\PfCFooListePoints{\PfCFooListePoints (\ListePoints[\ListePointslen,2],\ListePoints[\ListePointslen,3]),}% + \MPCatmull{\PfCFooListePoints}{\useKV[ClesFonction]{PasX}}{\useKV[ClesFonction]{PasY}}{\useKV[ClesFonction]{UniteX}}{\useKV[ClesFonction]{UniteY}}% + }{% + \xdef\PfCFooListePoints{} + \ifboolKV[ClesFonction]{Tangentes}{% + \foreachitem\compteur\in\ListePoints{% + \xdef\PfCFooListePoints{\PfCFooListePoints \ListePoints[\compteurcnt,1],(\ListePoints[\compteurcnt,2],\ListePoints[\compteurcnt,3]),\ListePoints[\compteurcnt,4],}% + }% + }{% + \foreachitem\compteur\in\ListePoints{% + \xdef\PfCFooListePoints{\PfCFooListePoints (\ListePoints[\compteurcnt,2],\ListePoints[\compteurcnt,3]),}% + }% + }% + \MPCourbeNew{\PfCFooListePoints}% + }% + }% + }{% + \setsepchar{,}\ignoreemptyitems% + \readlist*\ListeFonction{#2}% + \StrSubstitute{\useKV[ClesFonction]{Calcul}}{\useKV[ClesFonction]{Variable}}{\i}[\temp]% + \StrSubstitute{\useKV[ClesFonction]{Calcul}}{**}{^}[\tempa]% + \StrSubstitute{\tempa}{*}{}[\tempab]% + \ifboolKV[ClesFonction]{Ecriture}{% + \ensuremath{\useKV[ClesFonction]{Nom}(\useKV[ClesFonction]{Variable})=\tempab}% + }{}% + \ifboolKV[ClesFonction]{Definition}{% + \ensuremath{\useKV[ClesFonction]{Nom}:\useKV[ClesFonction]{Variable}\mapsto\tempab}% + }{}% + \ifboolKV[ClesFonction]{Tableau}{% + \buildtabfonction% + }{}% + \reademptyitems% + }% + }% +}% + +\NewDocumentCommand\Fonctionold{o m}{% + \useKVdefault[ClesFonction]% + \setKV[ClesFonction]{#1}% + \ifboolKV[ClesFonction]{Trace}{% + \useKVdefault[TraceG]% + \setKV[TraceG]{#1}% + \tokPfCListeDesFonctions{}% + \tokPfCListeDesNomsFonctions{}% + \xdef\PfCFooFn{\useKV[ClesFonction]{Calcul}} + \xdef\PfCFooNomFn{\useKV[TraceG]{NomCourbe}} + \ifx\bla\PfCFooFn\bla% + \else + \readlist*\ListeDesFonctions{\PfCFooFn} + \foreachitem\compteur\in\ListeDesFonctions{\expandafter\UpdatePfCListeDesFonctions\compteur\nil}% + \fi + \ifx\bla\PfCFooNomFn\bla + \else + \readlist*\ListeDesNomsFonctions{\PfCFooNomFn} + \foreachitem\compteur\in\ListeDesNomsFonctions{\expandafter\UpdatePfCListeDesNomsFonctions\compteur\nil}% + \fi + \TraceMultiGraphique{\the\tokPfCListeDesFonctions}{\the\tokPfCListeDesNomsFonctions}% + }{% + \ifboolKV[ClesFonction]{Points}{% + \toklistePtsFn{}% + \setsepchar[*]{§*/}%\ignoreemptyitems% + \readlist*\ListePoints{#2}% \ifboolKV[ClesFonction]{Catmull}{% \xdef\PfCFooListePoints{(\ListePoints[1,2],\ListePoints[1,3]),}% \foreachitem\compteur\in\ListePoints{% @@ -60,7 +134,7 @@ }% }{% \setsepchar{,}\ignoreemptyitems% - \readlist*\ListeFonction{#2}% + \roeadlist*\ListeFonction{#2}% \StrSubstitute{\useKV[ClesFonction]{Calcul}}{\useKV[ClesFonction]{Variable}}{\i}[\temp]% \StrSubstitute{\useKV[ClesFonction]{Calcul}}{**}{^}[\tempa]% \StrSubstitute{\tempa}{*}{}[\tempab]% @@ -78,6 +152,274 @@ }% }% +\def\MPSplineCode{% + boolean PointsCourbe,Code,Prolonge; + PointsCourbe=\useKV[ClesFonction]{PointsCourbe}; + Code=\useKV[ClesFonction]{Codes}; + Prolonge:=\useKV[ClesFonction]{Prolonge}; + color CoulTrace; + CoulTrace:=\useKV[ClesFonction]{CouleurTrace}; + Epaisseur:=\useKV[ClesFonction]{Epaisseur}; + % + vardef EffectuerTraces= + \useKV[ClesFonction]{Traces}; + enddef; +% + def enplace= + xscaled X.u yscaled Y.u + enddef; + % + vardef placepoint(expr q,r)= + (q,r)*cm enplace + enddef; + % + 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; + a[nbspline]*(xuno**3)+b[nbspline]*(xuno**2)+c[nbspline]*xuno+d[nbspline]=yuno; + a[nbspline]*(3*(xzero**2))+b[nbspline]*(2*xzero)+c[nbspline]=dzero; + a[nbspline]*(3*(xuno**2))+b[nbspline]*(2*xuno)+c[nbspline]=duno; + % + numeric xx[],yy[]; + for k=1 upto nbpoints-1: + xx[k]=xzero+(k/nbpoints)*(xuno-xzero); + yy[k]=a[nbspline]*(xx[k]**3)+b[nbspline]*(xx[k]**2)+c[nbspline]*xx[k]+d[nbspline]; + endfor; + save $; + picture $; + $=image( + draw placepoint(xzero,yzero) for k=1 upto nbpoints-1: + --placepoint(xx[k],yy[k]) + endfor --placepoint(xuno,yuno); + ); + $ + enddef; +} + +\def\MPSpline#1#2#3#4#5{% + % #1 la liste des points + % #2: pas en x + % #3: pas en y + % #4: unit\'e en x + % #5: unit\'e en y + \ifluatex + \mplibforcehmode + \begin{mplibcode} + \MPSplineCode; + + x.u:=#2; + y.u:=#3; + X.u:=#4; + Y.u:=#5; + + pair Xn[],Fn[],Dn[];%Xn abscisse,ordonnée D : dérivé g,dérivée d + n=0; + for p_=#1: + n:=n+1; + if (n mod 2)=1: + Xn[(n div 2)+1]=p_; + Fn[(n div 2)+1]=cm*(X.u*xpart(p_),Y.u*ypart(p_)); + else: + Dn[(n div 2)]=p_ + fi; + endfor; + N:=n div 2; + MinX=999; + MaxX=-999; + MinY=999; + MaxY=-999; + if Prolonge: + debutbalai=2; + finbalai=N-1; + else: + debutbalai=1; + finbalai=N; + fi; + for k=debutbalai upto finbalai: + if xpart(Xn[k])<MinX: + MinX:=xpart(Xn[k]); + fi; + if xpart(Xn[k])>MaxX: + MaxX:=xpart(Xn[k]); + fi; + if ypart(Xn[k])<MinY: + MinY:=ypart(Xn[k]); + fi; + if ypart(Xn[k])>MaxY: + MaxY:=ypart(Xn[k]); + fi; + endfor; + if MaxY<1: + MaxY:=2; + fi; + if MinY>-1: + MinY:=-2; + fi; + if MinY<0: + if MinY<>ceiling(MinY): + MinY:=ceiling(MinY)-1; + fi; + fi; + if MinX<0: + if MinX<>ceiling(MinX): + MinX:=ceiling(MinX)-1; + fi; + fi; + if MaxY<>ceiling(MaxY): + MaxY:=ceiling(MaxY); + fi; + if MaxX<>ceiling(MaxX): + MaxX:=ceiling(MaxX); + fi; + if MaxX<1: + MaxX:=1; + fi; + if MaxY<1: + MaxY:=1; + fi; + % + path cadreexterieur; + cadreexterieur=(((MinX-1)*X.u*cm,(MinY-1)*Y.u*cm)--((MaxX+1)*X.u*cm,(MinY-1)*Y.u*cm)--((MaxX+1)*X.u*cm,(MaxY+1)*Y.u*cm)--((MinX-1)*X.u*cm,(MaxY+1)*Y.u*cm)--cycle); + for l=1 upto N-1: + draw SplineCubique(xpart(Xn[l]),ypart(Xn[l]),xpart(Xn[l+1]),ypart(Xn[l+1]),ypart(Dn[l]),xpart(Dn[l+1])) withpen pencircle scaled Epaisseur withcolor CoulTrace; + endfor; + clip currentpicture to cadreexterieur; + picture RetiensCourbe; + RetiensCourbe=currentpicture; + currentpicture:=nullpicture; + for k=MinY-1 step y.u until MaxY+1: + draw cm*((MinX-1)*X.u,k*Y.u)--cm*((MaxX+1)*X.u,k*Y.u) withcolor 0.75white; + endfor; + for k=MinX-1 step x.u until MaxX+1: + draw cm*(k*X.u,(MinY-1)*Y.u)--cm*(k*X.u,(MaxY+1)*Y.u) withcolor 0.75white; + endfor; + if PointsCourbe: + for k=debutbalai upto finbalai: + fill cercles(Fn[k],0.5mm); + endfor; + fi; + drawarrow (0,(MinY-1)*Y.u*cm)--(0,(MaxY+1)*Y.u*cm); + drawarrow ((MinX-1)*X.u*cm,0)--((MaxX+1)*X.u*cm,0); + % + draw RetiensCourbe; + label.llft(btex O etex,(0,0)); + dotlabel.bot(btex 1 etex,cm*X.u*(1,0)); + dotlabel.lft(btex 1 etex,cm*Y.u*(0,1)); + if Code: + EffectuerTraces; + fi; + \end{mplibcode} + \else + \begin{mpost}[mpsettings={\MPSplineCode;}] + x.u:=#2; + y.u:=#3; + X.u:=#4; + Y.u:=#5; + + pair Xn[],Fn[],Dn[];%Xn abscisse,ordonnée D : dérivé g,dérivée d + n=0; + for p_=#1: + n:=n+1; + if (n mod 2)=1: + Xn[(n div 2)+1]=p_; + Fn[(n div 2)+1]=cm*(X.u*xpart(p_),Y.u*ypart(p_)); + else: + Dn[(n div 2)]=p_ + fi; + endfor; + N:=n div 2; + MinX=999; + MaxX=-999; + MinY=999; + MaxY=-999; + if Prolonge: + debutbalai=2; + finbalai=N-1; + else: + debutbalai=1; + finbalai=N; + fi; + for k=debutbalai upto finbalai: + if xpart(Xn[k])<MinX: + MinX:=xpart(Xn[k]); + fi; + if xpart(Xn[k])>MaxX: + MaxX:=xpart(Xn[k]); + fi; + if ypart(Xn[k])<MinY: + MinY:=ypart(Xn[k]); + fi; + if ypart(Xn[k])>MaxY: + MaxY:=ypart(Xn[k]); + fi; + endfor; + if MaxY<1: + MaxY:=2; + fi; + if MinY>-1: + MinY:=-2; + fi; + if MinY<0: + if MinY<>ceiling(MinY): + MinY:=ceiling(MinY)-1; + fi; + fi; + if MinX<0: + if MinX<>ceiling(MinX): + MinX:=ceiling(MinX)-1; + fi; + fi; + if MaxY<>ceiling(MaxY): + MaxY:=ceiling(MaxY); + fi; + if MaxX<>ceiling(MaxX): + MaxX:=ceiling(MaxX); + fi; + if MaxX<1: + MaxX:=1; + fi; + if MaxY<1: + MaxY:=1; + fi; + % + path cadreexterieur; + cadreexterieur=(((MinX-1)*X.u*cm,(MinY-1)*Y.u*cm)--((MaxX+1)*X.u*cm,(MinY-1)*Y.u*cm)--((MaxX+1)*X.u*cm,(MaxY+1)*Y.u*cm)--((MinX-1)*X.u*cm,(MaxY+1)*Y.u*cm)--cycle); + for l=1 upto N-1: + draw SplineCubique(xpart(Xn[l]),ypart(Xn[l]),xpart(Xn[l+1]),ypart(Xn[l+1]),ypart(Dn[l]),xpart(Dn[l+1])) withpen pencircle scaled Epaisseur withcolor CoulTrace; + endfor; + clip currentpicture to cadreexterieur; + picture RetiensCourbe; + RetiensCourbe=currentpicture; + currentpicture:=nullpicture; + for k=MinY-1 step y.u until MaxY+1: + draw cm*((MinX-1)*X.u,k*Y.u)--cm*((MaxX+1)*X.u,k*Y.u) withcolor 0.75white; + endfor; + for k=MinX-1 step x.u until MaxX+1: + draw cm*(k*X.u,(MinY-1)*Y.u)--cm*(k*X.u,(MaxY+1)*Y.u) withcolor 0.75white; + endfor; + if PointsCourbe: + for k=debutbalai upto finbalai: + fill cercles(Fn[k],0.5mm); + endfor; + fi; + drawarrow (0,(MinY-1)*Y.u*cm)--(0,(MaxY+1)*Y.u*cm); + drawarrow ((MinX-1)*X.u*cm,0)--((MaxX+1)*X.u*cm,0); + % + draw RetiensCourbe; + label.llft(btex O etex,(0,0)); + dotlabel.bot(btex 1 etex,cm*X.u*(1,0)); + dotlabel.lft(btex 1 etex,cm*Y.u*(0,1)); + if Code: + EffectuerTraces; + fi; + \end{mpost} + \fi +} + \def\PfCTraceMGCode{% nbcourbe=\ListeDesFonctionslen; % diff --git a/macros/latex/contrib/profcollege/latex/PfCNumberHive.tex b/macros/latex/contrib/profcollege/latex/PfCNumberHive.tex new file mode 100644 index 0000000000..309d5aaa9f --- /dev/null +++ b/macros/latex/contrib/profcollege/latex/PfCNumberHive.tex @@ -0,0 +1,399 @@ +%%% +% Number Hive +%%% +\setKVdefault[NumberHive]{Negatif=false,Produit=false,Niveau=8,Double=false,ListeCouleurs={Cornsilk,LightSteelBlue},CouleurCase=false,Jeton=false,Graines=false,Aide=false,UniteHexa=6mm}% +\defKV[NumberHive]{Cases=\setKV[NumberHive]{CouleurCase}}% +\defKV[NumberHive]{Jetons=\setKV[NumberHive]{Jeton}}% +\defKV[NumberHive]{Graine=\setKV[NumberHive]{Graines}}% + +\newtoks\toklistenumberhive% +\newtoks\toklistecasescoloreesNH% + +\def\UpdatetoksNHive#1\nil{\addtotok\toklistenumberhive{"#1",}}% +\def\UpdatetoksCCNHive#1\nil{\addtotok\toklistecasescoloreesNH{#1,}}% + +\NewDocumentCommand\NumberHive{o}{% + \useKVdefault[NumberHive]% + \setKV[NumberHive]{#1}% + \toklistenumberhive{}% + \toklistecasescoloreesNH{}% + \ifboolKV[NumberHive]{CouleurCase}{% + \xdef\PfCFooNH{\useKV[NumberHive]{Cases}}% + \setsepchar{,}\ignoreemptyitems% + \readlist*\ListeCasesColoreesNH{\PfCFooNH}% + \reademptyitems% + \foreachitem\compteur\in\ListeCasesColoreesNH{\expandafter\UpdatetoksCCNHive\compteur\nil}% + }{}% + \xdef\ListeAvantCouleurs{\useKV[NumberHive]{ListeCouleurs}}% + \ifboolKV[NumberHive]{Graines}{\PfCGraineAlea{\useKV[NumberHive]{Graine}}}{}% + \ifboolKV[NumberHive]{Produit}{% + \xdef\PfCNHListe{1,2,3,4,5,6,7,8,9,10,11,12,14,16,18,20,22,24,15,21,27,30,33,36,28,32,40,44,48,25,35,45,50,55,60,42,54,66,72,56,63,70,77,84,64,72,80,88,96,81,90,99,108,100,110,120,121,132,144}% + \ifboolKV[NumberHive]{Double}{% + \MelangeListe{\PfCNHListe}{59}% + }{% + \xdef\PfCNHListe{\PfCNHListe,\PfCNHListe}% + \MelangeListe{\PfCNHListe}{46}% + }% + }{% + \ifboolKV[NumberHive]{Negatif}{% + \xdef\PfCNHListe{-12,-11,-10,-9,-8,-7,-5,-4,-3,-2,-1,0,1,2,3,4,5,7,8,9,10,11,12}% + }{% + \xdef\PfCNHListe{2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24}% + }% + \xdef\PfCNHListe{\PfCNHListe,\PfCNHListe}% + \MelangeListe{\PfCNHListe}{46}% + }% + \setsepchar{,}% + \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[anchor=north west] at (0,0) {\BuildNumberHiveAdditif{\the\toklistenumberhive}{\useKV[NumberHive]{Niveau}}{\useKV[NumberHive]{Jetons}}{\ListeAvantCouleurs}{\the\toklistecasescoloreesNH}}; + \end{tikzpicture} +}% + +\NewDocumentCommand\BuildNumberHiveAdditif{mmmmm}{% + \ifluatex + \mplibforcehmode + \begin{mplibcode} + boolean Produit,Negatif,CouleurCase,Double,Jeton,Aide; + Double=\useKV[NumberHive]{Double}; + Produit=\useKV[NumberHive]{Produit}; + Negatif=\useKV[NumberHive]{Negatif}; + CouleurCase=\useKV[NumberHive]{CouleurCase}; + Jeton=\useKV[NumberHive]{Jeton}; + Aide=\useKV[NumberHive]{Aide}; + UniteHexa=\useKV[NumberHive]{UniteHexa}; + + numeric JetonNegatif[]; + JetonNegatif[1]=-6; + JetonNegatif[2]=-5; + JetonNegatif[3]=-4; + JetonNegatif[4]=-3; + JetonNegatif[5]=-2; + JetonNegatif[6]=-1; + JetonNegatif[7]=1; + JetonNegatif[8]=2; + JetonNegatif[9]=3; + JetonNegatif[10]=4; + JetonNegatif[11]=5; + JetonNegatif[12]=6; + + color C[]; + nb=0; + + vardef RecupCouleurs(text t)= + for p_=t: + nb:=nb+1; + C[nb]=p_; + endfor; + enddef; + + RecupCouleurs(#4); + + pair bu,bv; + bu=(1,0); + bv=(0,1); + vardef unithexa= + (cosd(30)*bu+sind(30)*bv)--(cosd(90)*bu+sind(90)*bv)--(cosd(150)*bu+sind(150)*bv)--(cosd(210)*bu+sind(210)*bv)--(cosd(270)*bu+sind(270)*bv)--(cosd(330)*bu+sind(330)*bv)--cycle + enddef; + + pair A[]; + numeric numcase; + + vardef PlacerAncres= + numcase:=0; + if Double: + for n=5 upto #2: + for k=1 upto n: + numcase:=numcase+1; + A[numcase]:=(0,0) shifted((3-n)*(UniteHexa*cosd(30),3*UniteHexa*sind(30))+k*(2*UniteHexa*cosd(30),0)); + endfor; + endfor; + % ligne n-1 + for k=1 upto #2-1: + numcase:=numcase+1; + A[numcase]:=(0,0) shifted(((3-(#2-1))*UniteHexa*cosd(30),3*UniteHexa*sind(30))+(k*2*UniteHexa*cosd(30),-(3*(#2-1))*UniteHexa*sind(30))); + endfor; + %dernières lignes + for n=#2+2 upto #2+5: + for k=(n-#2) upto #2+1: + numcase:=numcase+1; + A[numcase]:=(0,0) shifted((3-n)*(UniteHexa*cosd(30),3*UniteHexa*sind(30))+k*(2*UniteHexa*cosd(30),0)); + endfor; + endfor; + %% + else: + for n=3 upto #2: + for k=1 upto n: + numcase:=numcase+1; + A[numcase]:=(0,0) shifted((3-n)*(UniteHexa*cosd(30),3*UniteHexa*sind(30))+k*(2*UniteHexa*cosd(30),0)); + endfor; + endfor; + % ligne n-1 + for k=1 upto #2-1: + numcase:=numcase+1; + A[numcase]:=(0,0) shifted(((3-(#2-1))*UniteHexa*cosd(30),3*UniteHexa*sind(30))+(k*2*UniteHexa*cosd(30),-(3*(#2-1))*UniteHexa*sind(30))); + endfor; + %ligne n + for k=1 upto #2-2: + numcase:=numcase+1; + A[numcase]:=(0,0) shifted(((3-(#2-2))*UniteHexa*cosd(30),3*UniteHexa*sind(30))+(k*2*UniteHexa*cosd(30),-(3*#2)*UniteHexa*sind(30))); + endfor; + fi; + NbTotalCases=numcase; + enddef; + + vardef PlacerCasesColorees(text t)= + rang:=0; + for p_=t: + rang:=rang+1; + fill ((unithexa scaled UniteHexa) shifted A[p_]) withcolor if (rang mod 2)=1:C[1] else: C[2] fi; + endfor; + enddef; + + vardef TracerHexagones= + for k=1 upto NbTotalCases: + trace (unithexa scaled UniteHexa) shifted A[k]; + if Aide: + label.top(TEX("\tiny"&decimal(k)),A[k]+(0,-UniteHexa)); + fi; + endfor; + enddef; + + vardef PlacerNombres(text t)= + nbcase:=0; + for p_=t: + if nbcase<numcase: + nbcase:=nbcase+1; + label(TEX("\num{"&p_&"}"),A[nbcase]); + fi; + endfor; + enddef; + + vardef PlaceJeton(expr ja,jb)= + drawoptions(withpen pencircle scaled 1.15); + trace cercles(BPlateau[ja],0.75*UniteHexa); + trace cercles(BPlateau[jb] shifted(5*2*UniteHexa*cosd(30)+3*3mm,0),0.75*UniteHexa); + drawoptions(); + enddef; + + pair BPlateau[]; + pair Decal; + + vardef Plateau= + picture PGauche; + PGauche=image( + NomCase:=0; + if Double: + Decalage:=10; + else: + Decalage:=5; + fi; + for l=0 upto 2: + for k=3 downto 0:% + NomCase:=NomCase+1; + Decal:=(-((k-1)*2*UniteHexa*cosd(30)+k*3mm*cosd(0),(#2+Decalage)*2*UniteHexa*sind(30)+l*(2*UniteHexa*sind(30)+UniteHexa))); + BPlateau[NomCase]=(0,0) shifted Decal; + fill ((unithexa scaled UniteHexa) shifted Decal) withcolor 0.75white; + trace ((unithexa scaled UniteHexa)) shifted Decal; + if Negatif: + label(TEX("$"&decimal(JetonNegatif[NomCase])&"$"),(0,0) shifted Decal); + else: + label(TEX(decimal(NomCase)),(0,0) shifted Decal); + fi; + endfor; + endfor; + ); + draw PGauche; + draw PGauche shifted(5*2*UniteHexa*cosd(30)+3*3mm,0); + if Jeton: + PlaceJeton(#3); + fi; + if Produit: + label(TEX("\Huge$\times$"),(0,0) shifted(-(-4*UniteHexa*cosd(30),(#2+Decalage)*2*UniteHexa*sind(30)+1*(2*UniteHexa*sind(30)+UniteHexa)))); + else: + label(TEX("\Huge$+$"),(0,0) shifted(-(-4*UniteHexa*cosd(30),(#2+Decalage)*2*UniteHexa*sind(30)+1*(2*UniteHexa*sind(30)+UniteHexa)))); + fi; + enddef; + + PlacerAncres; + if CouleurCase: + PlacerCasesColorees(#5); + fi; + TracerHexagones; + PlacerNombres(#1); + Plateau; + \end{mplibcode} + \else% + \begin{mpost}[mpsettings={boolean Produit,Negatif,CouleurCase,Double,Jeton,Aide; + Double=\useKV[NumberHive]{Double}; + Produit=\useKV[NumberHive]{Produit}; + Negatif=\useKV[NumberHive]{Negatif}; + CouleurCase=\useKV[NumberHive]{CouleurCase}; + Jeton=\useKV[NumberHive]{Jeton}; + Aide=\useKV[NumberHive]{Aide}; + UniteHexa=\useKV[NumberHive]{UniteHexa}; + }] + numeric JetonNegatif[]; + JetonNegatif[1]=-6; + JetonNegatif[2]=-5; + JetonNegatif[3]=-4; + JetonNegatif[4]=-3; + JetonNegatif[5]=-2; + JetonNegatif[6]=-1; + JetonNegatif[7]=1; + JetonNegatif[8]=2; + JetonNegatif[9]=3; + JetonNegatif[10]=4; + JetonNegatif[11]=5; + JetonNegatif[12]=6; + + color C[]; + nb=0; + + vardef RecupCouleurs(text t)= + for p_=t: + nb:=nb+1; + C[nb]=p_; + endfor; + enddef; + + RecupCouleurs(#4); + + pair bu,bv; + bu=(1,0); + bv=(0,1); + vardef unithexa= + (cosd(30)*bu+sind(30)*bv)--(cosd(90)*bu+sind(90)*bv)--(cosd(150)*bu+sind(150)*bv)--(cosd(210)*bu+sind(210)*bv)--(cosd(270)*bu+sind(270)*bv)--(cosd(330)*bu+sind(330)*bv)--cycle + enddef; + + pair A[]; + numeric numcase; + + vardef PlacerAncres= + numcase:=0; + if Double: + for n=5 upto #2: + for k=1 upto n: + numcase:=numcase+1; + A[numcase]:=(0,0) shifted((3-n)*(UniteHexa*cosd(30),3*UniteHexa*sind(30))+k*(2*UniteHexa*cosd(30),0)); + endfor; + endfor; + % ligne n-1 + for k=1 upto #2-1: + numcase:=numcase+1; + A[numcase]:=(0,0) shifted(((3-(#2-1))*UniteHexa*cosd(30),3*UniteHexa*sind(30))+(k*2*UniteHexa*cosd(30),-(3*(#2-1))*UniteHexa*sind(30))); + endfor; + %dernières lignes + for n=#2+2 upto #2+5: + for k=(n-#2) upto #2+1: + numcase:=numcase+1; + A[numcase]:=(0,0) shifted((3-n)*(UniteHexa*cosd(30),3*UniteHexa*sind(30))+k*(2*UniteHexa*cosd(30),0)); + endfor; + endfor; + %% + else: + for n=3 upto #2: + for k=1 upto n: + numcase:=numcase+1; + A[numcase]:=(0,0) shifted((3-n)*(UniteHexa*cosd(30),3*UniteHexa*sind(30))+k*(2*UniteHexa*cosd(30),0)); + endfor; + endfor; + % ligne n-1 + for k=1 upto #2-1: + numcase:=numcase+1; + A[numcase]:=(0,0) shifted(((3-(#2-1))*UniteHexa*cosd(30),3*UniteHexa*sind(30))+(k*2*UniteHexa*cosd(30),-(3*(#2-1))*UniteHexa*sind(30))); + endfor; + %ligne n + for k=1 upto #2-2: + numcase:=numcase+1; + A[numcase]:=(0,0) shifted(((3-(#2-2))*UniteHexa*cosd(30),3*UniteHexa*sind(30))+(k*2*UniteHexa*cosd(30),-(3*#2)*UniteHexa*sind(30))); + endfor; + fi; + NbTotalCases=numcase; + enddef; + + vardef PlacerCasesColorees(text t)= + rang:=0; + for p_=t: + rang:=rang+1; + fill ((unithexa scaled UniteHexa) shifted A[p_]) withcolor if (rang mod 2)=1:C[1] else: C[2] fi; + endfor; + enddef; + + vardef TracerHexagones= + for k=1 upto NbTotalCases: + trace (unithexa scaled UniteHexa) shifted A[k]; + if Aide: + label.top(LATEX("\tiny"&decimal(k)),A[k]+(0,-UniteHexa)); + fi; + endfor; + enddef; + + vardef PlacerNombres(text t)= + nbcase:=0; + for p_=t: + if nbcase<numcase: + nbcase:=nbcase+1; + label(LATEX("\num{"&p_&"}"),A[nbcase]); + fi; + endfor; + enddef; + + vardef PlaceJeton(expr ja,jb)= + drawoptions(withpen pencircle scaled 1.15); + trace cercles(BPlateau[ja],0.75*UniteHexa); + trace cercles(BPlateau[jb] shifted(5*2*UniteHexa*cosd(30)+3*3mm,0),0.75*UniteHexa); + drawoptions(); + enddef; + + pair BPlateau[]; + pair Decal; + + vardef Plateau= + picture PGauche; + PGauche=image( + NomCase:=0; + if Double: + Decalage:=10; + else: + Decalage:=5; + fi; + for l=0 upto 2: + for k=3 downto 0:% + NomCase:=NomCase+1; + Decal:=(-((k-1)*2*UniteHexa*cosd(30)+k*3mm*cosd(0),(#2+Decalage)*2*UniteHexa*sind(30)+l*(2*UniteHexa*sind(30)+4*3mm))); + BPlateau[NomCase]=(0,0) shifted Decal; + fill ((unithexa scaled UniteHexa) shifted Decal) withcolor 0.75white; + trace ((unithexa scaled UniteHexa)) shifted Decal; + if Negatif: + label(LATEX("$"&decimal(JetonNegatif[NomCase])&"$"),(0,0) shifted Decal); + else: + label(LATEX(decimal(NomCase)),(0,0) shifted Decal); + fi; + endfor; + endfor; + ); + draw PGauche; + draw PGauche shifted(5*2*UniteHexa*cosd(30)+3*3mm,0); + if Jeton: + PlaceJeton(#3); + fi; + if Produit: + label(LATEX("\Huge$\times$"),(0,0) shifted(-(-4*UniteHexa*cosd(30),(#2+Decalage)*2*UniteHexa*sind(30)+1*(2*UniteHexa*sind(30)+4*3mm)))); + else: + label(LATEX("\Huge$+$"),(0,0) shifted(-(-4*UniteHexa*cosd(30),(#2+Decalage)*2*UniteHexa*sind(30)+1*(2*UniteHexa*sind(30)+4*3mm)))); + fi; + enddef; + + PlacerAncres; + if CouleurCase: + PlacerCasesColorees(#5); + fi; + TracerHexagones; + PlacerNombres(#1); + Plateau; + \end{mpost} + \fi +}
\ No newline at end of file diff --git a/macros/latex/contrib/profcollege/latex/PfCPavage.tex b/macros/latex/contrib/profcollege/latex/PfCPavage.tex index 245afb0593..2d25df1b99 100644 --- a/macros/latex/contrib/profcollege/latex/PfCPavage.tex +++ b/macros/latex/contrib/profcollege/latex/PfCPavage.tex @@ -21,6 +21,8 @@ Basej={u*(0,0.5)}, Quadrilatere=false, Escher=false, + Einstein=false, + Vampire=false, Rayon=1, Epaisseur=1, Position=0.5, @@ -1189,9 +1191,137 @@ vardef pavagescar(expr chemin,tour,coul)= \fi% }% +\def\MPEinsteinHatCode{ + boolean After; + After:=\useKV[Pavage]{After}; + % + def TraceFill(expr o,coul)= + fill o withcolor coul; + trace o;% withpen pencircle scaled 2; + enddef; + % + def TraceHache(expr o,coul,ang)= + trace hachurage(o,ang,0.2,0) withcolor coul; + trace o;% withpen pencircle scaled 2; + enddef; + % + vardef EffectuerTraces= + \useKV[Pavage]{Traces} + enddef; + % + path Hat; + pair O[],A[],B[],C[],D[],E[],F[]; + Rayon=\useKV[Pavage]{Rayon}*u; + O1=u*(3,3); + O3=pointarc(cercles(O1,Rayon),300); + O2=rotation(O3,O1,-60); + O4=CentreCercleC(O1,O2,O3); + O5=symetrie(O1,iso(O2,O3)); + Rayonbis=abs(O1-CentreCercleC(O1,O2,O3)); + draw polygone(O1,O2,O3) withcolor 0.7white; + path cc[]; + cc1=cercles(O1,Rayonbis); + cc2=cercles(O2,Rayonbis); + cc3=cercles(O3,Rayonbis); + drawoptions(dashed evenly withcolor 0.7white); + trace cc1;trace cc2;trace cc3; + drawoptions(); + for k=1 upto 3: + A[k]=pointarc(cc[k],30+0); + B[k]=pointarc(cc[k],30+60); + C[k]=pointarc(cc[k],30+2*60); + D[k]=pointarc(cc[k],30+3*60); + E[k]=pointarc(cc[k],30+4*60); + F[k]=pointarc(cc[k],30+5*60); + endfor; + drawoptions(dashed evenly); + trace polygone(A1,B1,C1,D1,E1,F1); + trace polygone(A2,B2,C2,D2,E2,F2); + trace polygone(A3,B3,C3,D3,E3,F3); + drawoptions(); + Hat=polygone(O1,iso(C1,D1),D1,iso(D1,E1),O2,iso(E2,F2),F2,iso(D3,E3),O3,iso(F3,A3),A3,B3,iso(B3,C3)); + color Coul[]; + Coul1=Cyan;%; + Coul2=0.5[Blue,white]; + Coul3=Cornsilk; + Coul4=0.5[Crimson,white]; + Coul5=0.5[Purple,white]; + Coul6=LightGreen; + % + vardef TileGen(expr aHat,bHat,ech)= + pair H[]; + H0=iso(F2,E2); + H1-H0=Rayonbis*(aHat/ech)*unitvector(E2-F2); + H2-H1=Rayonbis*(aHat/ech)*unitvector(D2-E2); + H3-H2=Rayonbis*(bHat/ech)*unitvector(O2-iso(E2,D2)); + H4-H3=Rayonbis*(bHat/ech)*unitvector(iso(B2,C2)-O2); + H5-H4=Rayonbis*(aHat/ech)*unitvector(B2-C2); + H6-H5=Rayonbis*(aHat/ech)*unitvector(C1-D1); + H7-H6=Rayonbis*(bHat/ech)*unitvector(O1-iso(C1,D1)); + H8-H7=Rayonbis*(bHat/ech)*unitvector(iso(E1,F1)-O1); + H9-H8=Rayonbis*(aHat/ech)*unitvector(F2-E2); + H10-H9=Rayonbis*(aHat/ech)*unitvector(A3-B3); + H11-H10=Rayonbis*(bHat/ech)*unitvector(O3-iso(A3,B3)); + H12-H11=Rayonbis*(bHat/ech)*unitvector(iso(C3,D3)-O3); + H13-H12=Rayonbis*(aHat/ech)*unitvector(F2-A2); + H14=iso(H0,H1,H2,H3,H4,H5,H6,H7,H8,H9,H10,H11,H12,H13); + save $; + path $; + $=polygone(H0,H1,H2,H3,H4,H5,H6,H7,H8,H9,H10,H11,H12,H13); + $ + enddef; +% + vardef VampireGen(expr ech)= + pair Vp[]; + Vp0=iso(F2,E2); + Vp1-Vp0=Rayonbis*(1/ech)*unitvector(E2-F2); + Vp2-Vp1=Rayonbis*(1/ech)*unitvector(D2-E2); + Vp3-Vp2=Rayonbis*(1/ech)*unitvector(O2-iso(E2,D2)); + Vp4-Vp3=Rayonbis*(1/ech)*unitvector(iso(B2,C2)-O2); + Vp5-Vp4=Rayonbis*(1/ech)*unitvector(B2-C2); + Vp6-Vp5=Rayonbis*(1/ech)*unitvector(C1-D1); + Vp7-Vp6=Rayonbis*(1/ech)*unitvector(O1-iso(C1,D1)); + Vp8-Vp7=Rayonbis*(1/ech)*unitvector(iso(E1,F1)-O1); + Vp9-Vp8=Rayonbis*(1/ech)*unitvector(F2-E2); + Vp10-Vp9=Rayonbis*(1/ech)*unitvector(A3-B3); + Vp11-Vp10=Rayonbis*(1/ech)*unitvector(O3-iso(A3,B3)); + Vp12-Vp11=Rayonbis*(1/ech)*unitvector(iso(C3,D3)-O3); + Vp13-Vp12=Rayonbis*(1/ech)*unitvector(F2-A2); + Vp14=Vp0; + Vp15=iso(Vp0,Vp1,Vp2,Vp3,Vp4,Vp5,Vp6,Vp7,Vp8,Vp9,Vp10,Vp11,Vp12,Vp13); + save $; + path $; + $=polygone(Vp0,Vp1,Vp2,Vp3,Vp4,Vp5,Vp6,Vp7,Vp8,Vp9,Vp10,Vp11,Vp12,Vp13); + $ + enddef; +} + +\def\MPEinstein{%Pentoma : https://www.pentoma.de/the_hat/ + \ifluatex + \mplibforcehmode + \begin{mplibcode} + \MPEinsteinHatCode + if After: + EffectuerTraces; + fi; + \end{mplibcode} + \else + \begin{mpost}[mpsettings={\MPEinsteinHatCode} + if After: + EffectuerTraces; + fi; + \end{mpost} + \fi +}% + \NewDocumentCommand\Pavage{o}{% \useKVdefault[Pavage]% \setKV[Pavage]{#1}% + \ifboolKV[Pavage]{Einstein}{% + \ifboolKV[Pavage]{Vampire}{}{% + \MPEinstein% + }% + }{% \ifboolKV[Pavage]{Regulier}{% \MPRegulier% }{% @@ -1213,4 +1343,5 @@ vardef pavagescar(expr chemin,tour,coul)= }% }% }% + }% }%
\ No newline at end of file diff --git a/macros/latex/contrib/profcollege/latex/PfCPropor.tex b/macros/latex/contrib/profcollege/latex/PfCPropor.tex index b72e4d5a5d..4a7f3c6de3 100644 --- a/macros/latex/contrib/profcollege/latex/PfCPropor.tex +++ b/macros/latex/contrib/profcollege/latex/PfCPropor.tex @@ -3,6 +3,8 @@ %%% \setKVdefault[ClesPropor]{GrandeurA=Grandeur A,GrandeurB=Grandeur B,Largeur=1cm,Math=false,Stretch=1,ColorFill=white,CouleurTab=gray!15,Vertical=false,Simple=false}% +\tikzstyle{FlechePropor}=[-stealth] + \def\Updatetoksmath#1/#2\nil{\addtotok\tabtoksa{}\addtotok\tabtoksb{}}% \def\updatetokspropor#1/#2\nil{\addtotok\tabtoksa{&\num{#1}}\addtotok\tabtoksb{&\num{#2}}} \def\Buildtabpropor{% @@ -108,9 +110,9 @@ \newcommand\FlechesPH[3]{% \begin{tikzpicture}[remember picture,overlay]% \ifnum#1<#2\relax% - \draw[-stealth,out=50,in=130] (ProporH-#1) to node[inner sep=0pt, inner xsep=1pt,fill=\colorfill, pos=0.5, sloped]{#3}(ProporH-#2);% + \draw[FlechePropor,out=50,in=130] (ProporH-#1) to node[inner sep=0pt, inner xsep=1pt,fill=\colorfill, pos=0.5, sloped]{#3}(ProporH-#2);% \else% - \draw[-stealth,out=130,in=50] (ProporH-#1) to node[inner sep=0pt, inner xsep=1pt,fill=\colorfill, pos=0.5, sloped]{#3}(ProporH-#2);% + \draw[FlechePropor,out=130,in=50] (ProporH-#1) to node[inner sep=0pt, inner xsep=1pt,fill=\colorfill, pos=0.5, sloped]{#3}(ProporH-#2);% \fi% \end{tikzpicture}% }% @@ -118,11 +120,11 @@ \newcommand\FlechesPB[3]{% \ifnum\number#1<\number#2\relax% \begin{tikzpicture}[remember picture,overlay]% - \draw[-stealth,out=-50,in=-130] (ProporB-#1) to node[inner sep=0pt, inner xsep=1pt,fill=\colorfill, pos=0.5, sloped]{#3}(ProporB-#2);% + \draw[FlechePropor,out=-50,in=-130] (ProporB-#1) to node[inner sep=0pt, inner xsep=1pt,fill=\colorfill, pos=0.5, sloped]{#3}(ProporB-#2);% \end{tikzpicture}% \else% \begin{tikzpicture}[remember picture,overlay]% - \draw[-stealth,out=-130,in=-50] (ProporB-#1) to node[inner sep=0pt, inner xsep=1pt,fill=\colorfill, pos=0.5, sloped]{#3}(ProporB-#2);% + \draw[FlechePropor,out=-130,in=-50] (ProporB-#1) to node[inner sep=0pt, inner xsep=1pt,fill=\colorfill, pos=0.5, sloped]{#3}(ProporB-#2);% \end{tikzpicture}% \fi% }% @@ -130,9 +132,9 @@ \newcommand\FlechesPG[3]{% \begin{tikzpicture}[remember picture,overlay]% \ifnum#1<#2\relax% - \draw[-stealth,out=-150,in=150] (ProporG-#1) to node[transform canvas={xshift=-1pt},inner sep=0pt, inner xsep=1pt,fill=\colorfill, pos=0.5,left]{#3}(ProporG-#2);% + \draw[FlechePropor,out=-150,in=150] (ProporG-#1) to node[transform canvas={xshift=-1pt},inner sep=0pt, inner xsep=1pt,fill=\colorfill, pos=0.5,left]{#3}(ProporG-#2);% \else% - \draw[-stealth,out=150,in=-150] (ProporG-#1) to node[transform canvas={xshift=-1pt},inner sep=0pt, inner xsep=1pt,fill=\colorfill, pos=0.5, left]{#3}(ProporG-#2);% + \draw[FlechePropor,out=150,in=-150] (ProporG-#1) to node[transform canvas={xshift=-1pt},inner sep=0pt, inner xsep=1pt,fill=\colorfill, pos=0.5, left]{#3}(ProporG-#2);% \fi% \end{tikzpicture}% }% @@ -140,9 +142,9 @@ \newcommand\FlechesPD[3]{% \begin{tikzpicture}[remember picture,overlay]% \ifnum#1<#2\relax% - \draw[-stealth,out=-30,in=30] (ProporD-#1) to node[transform canvas={xshift=1pt},inner sep=0pt, inner xsep=1pt,fill=\colorfill, pos=0.5,right]{#3}(ProporD-#2);% + \draw[FlechePropor,out=-30,in=30] (ProporD-#1) to node[transform canvas={xshift=1pt},inner sep=0pt, inner xsep=1pt,fill=\colorfill, pos=0.5,right]{#3}(ProporD-#2);% \else% - \draw[-stealth,out=30,in=-30] (ProporD-#1) to node[transform canvas={xshift=1pt},inner sep=0pt, inner xsep=1pt,fill=\colorfill, pos=0.5,right]{#3}(ProporD-#2);% + \draw[FlechePropor,out=30,in=-30] (ProporD-#1) to node[transform canvas={xshift=1pt},inner sep=0pt, inner xsep=1pt,fill=\colorfill, pos=0.5,right]{#3}(ProporD-#2);% \fi% \end{tikzpicture}% }% @@ -167,7 +169,7 @@ \draw[out=-30,in=-150,gray] (aux3) to (aux4); }% \draw[gray] (aux2) -- (aux3); - \draw[-stealth,gray] (aux4) -- (aux1); + \draw[FlechePropor,gray] (aux4) -- (aux1); \end{tikzpicture}% }% @@ -191,7 +193,7 @@ \draw[out=30,in=150,gray] (aux1) to (aux2); }% \draw[gray] (aux4) -- (aux1); - \draw[-stealth,gray] (aux2) -- (aux3); + \draw[FlechePropor,gray] (aux2) -- (aux3); \end{tikzpicture}% }% @@ -215,7 +217,7 @@ \draw[out=-30,in=30,gray] (aux3) to (aux4); }% \draw[gray] (aux2) -- (aux3); - \draw[-stealth,gray] (aux4) -- (aux1); + \draw[FlechePropor,gray] (aux4) -- (aux1); \end{tikzpicture}% }% @@ -239,7 +241,7 @@ \draw[out=-150,in=150,gray] (aux1) to (aux2); }% \draw[gray] (aux4) -- (aux1); - \draw[-stealth,gray] (aux2) -- (aux3); + \draw[FlechePropor,gray] (aux2) -- (aux3); \end{tikzpicture}% }% @@ -248,9 +250,9 @@ \node[inner sep=0pt] (MilieuH) at ($(ProporG-#1)!0.5!(ProporG-#2)$) {};% \node[circle,draw,inner sep=0pt] [left of=MilieuH] (aux) {#4} ;% \coordinate[left of=aux] (aux1);% - \draw[-stealth] (ProporG-#1) -| (aux);% - \draw[-stealth] (ProporG-#2) -| (aux);% - \draw[-stealth] (aux) -- (aux1) |- (ProporG-#3);% + \draw[FlechePropor] (ProporG-#1) -| (aux);% + \draw[FlechePropor] (ProporG-#2) -| (aux);% + \draw[FlechePropor] (aux) -- (aux1) |- (ProporG-#3);% \end{tikzpicture}% }% @@ -259,9 +261,9 @@ \node[inner sep=0pt] (MilieuH) at ($(ProporD-#1)!0.5!(ProporD-#2)$) {};% \node[circle,draw,inner sep=0pt] [right of=MilieuH] (aux) {#4} ;% \coordinate[right of=aux] (aux1);% - \draw[-stealth] (ProporD-#1) -| (aux);% - \draw[-stealth] (ProporD-#2) -| (aux);% - \draw[-stealth] (aux) -- (aux1) |- (ProporD-#3);% + \draw[FlechePropor] (ProporD-#1) -| (aux);% + \draw[FlechePropor] (ProporD-#2) -| (aux);% + \draw[FlechePropor] (aux) -- (aux1) |- (ProporD-#3);% \end{tikzpicture}% }% @@ -285,7 +287,7 @@ \node[] (Point2) at ($(ProporH-\LongListe)!0.9!(ProporB-\LongListe)$) {};% \coordinate[right of=Point1,node distance=0.5*#1+\tabcolsep] (point1);% \coordinate[right of=Point2,node distance=0.5*#1+\tabcolsep] (point2);% - \draw[-stealth,out=-20,in=20] (point1) to node[midway,right,inner sep=1pt]{#2}(point2);% + \draw[FlechePropor,out=-20,in=20] (point1) to node[midway,right,inner sep=1pt]{#2}(point2);% \end{tikzpicture}% }% @@ -295,7 +297,7 @@ \node[] (Noeud2) at ($(ProporHD)!0.9!(ProporBD)$) {};% \coordinate[left of=Noeud1,node distance=#1] (noeud1);% \coordinate[left of=Noeud2,node distance=#1] (noeud2);% - \draw[-stealth,out=160,in=-160] (noeud2) to node[midway,left,inner sep=1pt]{#2}(noeud1);% + \draw[FlechePropor,out=160,in=-160] (noeud2) to node[midway,left,inner sep=1pt]{#2}(noeud1);% \end{tikzpicture}% }% @@ -305,7 +307,7 @@ \node[] (Point2) at ($(ProporH-\LongListe)!0.9!(ProporB-\LongListe)$) {};% \coordinate[right of=Point1,node distance=0.5*#1+\tabcolsep] (point1);% \coordinate[right of=Point2,node distance=0.5*#1+\tabcolsep] (point2);% - \draw[-stealth,out=20,in=-20] (point2) to node[midway,right,inner sep=1pt]{#2}(point1);% + \draw[FlechePropor,out=20,in=-20] (point2) to node[midway,right,inner sep=1pt]{#2}(point1);% \end{tikzpicture}% }% @@ -314,9 +316,9 @@ \node[inner sep=0pt] (MilieuH) at ($(ProporH-#1)!0.5!(ProporH-#2)$) {};% \node[circle,draw,inner sep=0pt] [above of=MilieuH] (aux) {#4} ;% \coordinate[above of=aux] (aux1);% - \draw[-stealth] (ProporH-#1) |- (aux);% - \draw[-stealth] (ProporH-#2) |- (aux);% - \draw[-stealth] (aux) -- (aux1) -| (ProporH-#3);% + \draw[FlechePropor] (ProporH-#1) |- (aux);% + \draw[FlechePropor] (ProporH-#2) |- (aux);% + \draw[FlechePropor] (aux) -- (aux1) -| (ProporH-#3);% \end{tikzpicture}% }% @@ -325,8 +327,8 @@ \node[inner sep=0pt] (MilieuB) at ($(ProporB-#1)!0.5!(ProporB-#2)$) {};% \node[circle,draw,inner sep=0pt] [below of=MilieuB] (aux) {#4};% \coordinate[below of=aux,node distance=3mm] (aux1);% - \draw[-stealth] (ProporB-#1) |- (aux);% - \draw[-stealth] (ProporB-#2) |- (aux);% - \draw[-stealth] (aux) -- (aux1) -| (ProporB-#3);% + \draw[FlechePropor] (ProporB-#1) |- (aux);% + \draw[FlechePropor] (ProporB-#2) |- (aux);% + \draw[FlechePropor] (aux) -- (aux1) -| (ProporB-#3);% \end{tikzpicture}% }%
\ No newline at end of file diff --git a/macros/latex/contrib/profcollege/latex/PfCPyramideCalculs.tex b/macros/latex/contrib/profcollege/latex/PfCPyramideCalculs.tex index 6ec347c5dc..3e17ac010e 100644 --- a/macros/latex/contrib/profcollege/latex/PfCPyramideCalculs.tex +++ b/macros/latex/contrib/profcollege/latex/PfCPyramideCalculs.tex @@ -1,5 +1,3 @@ - - %%% % Pyramide de calculs %%% @@ -179,9 +177,10 @@ label(TEX(p_),B[Nbeb]); fi; endfor; + fi; \end{mplibcode} \else - \begin{mpost}[mpsettings={nbetages:=\useKV[ClesPyramide]{Etages};largeur:=\useKV[ClesPyramide]{Largeur};hauteur:=\useKV[ClesPyramide]{Hauteur};boolean Vide;Vide=\useKV[ClesPyramide]{Vide};boolean Inverse;Inverse=\useKV[ClesPyramide]{Inverse};color CaseCouleur; CaseCouleur:=\useKV[ClesPyramide]{Couleur};boolean Double;Double=\useKV[ClesPyramide]{Double}; color CouleurNombre;CouleurNombre=\useKV[ClesPyramide]{CouleurNombre};}] + \begin{mpost}[mpsettings={nbetages:=\useKV[ClesPyramide]{Etages};largeur:=\useKV[ClesPyramide]{Largeur};hauteur:=\useKV[ClesPyramide]{Hauteur};boolean Vide,Inverse,Double;Vide=\useKV[ClesPyramide]{Vide};Inverse=\useKV[ClesPyramide]{Inverse};Double=\useKV[ClesPyramide]{Double};color CaseCouleur;CouleurNombre; CaseCouleur:=\useKV[ClesPyramide]{Couleur};CouleurNombre=\useKV[ClesPyramide]{CouleurNombre};}] pair A[][],B[]; path Case[]; Nbeb:=0; @@ -205,7 +204,7 @@ endfor; endfor; else: - if \useKV[ClesPyramide]{Inverse}: + if Inverse: change:=-1; else: change=1; @@ -220,7 +219,7 @@ endfor; endfor; fi; - if \useKV[ClesPyramide]{Vide}: + if Vide: else: Nbeb:=0; for p_=#1: @@ -237,6 +236,7 @@ label(LATEX(p_),B[Nbeb]); fi; endfor; + fi; \end{mpost} \fi }% diff --git a/macros/latex/contrib/profcollege/latex/PfCPythagore.tex b/macros/latex/contrib/profcollege/latex/PfCPythagore.tex index 5606728dd9..4af4528b81 100644 --- a/macros/latex/contrib/profcollege/latex/PfCPythagore.tex +++ b/macros/latex/contrib/profcollege/latex/PfCPythagore.tex @@ -281,8 +281,8 @@ \NomA\NomC^2&=\ifboolKV[ClesPythagore]{EnchaineA}{\opexport{a1}{\Aun}\num{\Aun}}{\opmul*{A1}{A1}{a1}\opexport{a1}{\Aun}\num{\Aun}}+\ifboolKV[ClesPythagore]{EnchaineB}{\opexport{a2}{\Adeux}\num{\Adeux}}{\opmul*{A2}{A2}{a2}\opexport{a2}{\Adeux}\num{\Adeux}}\\ \NomA\NomC^2&=\opadd*{a1}{a2}{a3}\opexport{a3}{\Atrois}\num{\Atrois}%\\ \ifboolKV[ClesPythagore]{AvantRacine}{}{% - \ifboolKV[ClesPythagore]{Entier}{}{\\\NomA\NomC&=\sqrt{\opexport{a3}{\Atrois}\num{\Atrois}}} - \ifboolKV[ClesPythagore]{Racine}{}{\\\ifboolKV[ClesPythagore]{Exact}{\NomA\NomC&=\opsqrt[maxdivstep=3]{a3}{a4}\opunzero{a4}\opexport{a4}{\Aquatre}\SI{\Aquatre}{\PfCPythaUnit}}{\NomA\NomC&\approx\opsqrt[maxdivstep=5]{a3}{a4}\opround{a4}{pres}{a4}\opunzero{a4}\opexport{a4}{\Aquatre}\SI{\Aquatre}{\PfCPythaUnit}}}%\\ + \ifboolKV[ClesPythagore]{Entier}{}{\\\NomA\NomC&=\sqrt{\opexport{a3}{\Atrois}\num{\Atrois}}} + \ifboolKV[ClesPythagore]{Racine}{}{\\\NomA\NomC&\IfInteger{\fpeval{round(sqrt(#3^2+#4^2),\useKV[ClesPythagore]{Precision})^2-#3^2-#4^2}}{=}{\approx}\opsqrt[maxdivstep=5]{a3}{a4}\opround{a4}{pres}{a4}\opunzero{a4}\opexport{a4}{\Aquatre}\SI{\Aquatre}{\PfCPythaUnit}}%\\ } \end{align*} }{%\else @@ -295,7 +295,7 @@ \NomA\NomB^2&=\opsub*{a1}{a2}{a3}\opexport{a3}{\Atrois}\num{\Atrois}%\\ \ifboolKV[ClesPythagore]{AvantRacine}{}{% \ifboolKV[ClesPythagore]{Entier}{}{\\\NomA\NomB&=\sqrt{\opexport{a3}{\Atrois}\num{\Atrois}}} - \ifboolKV[ClesPythagore]{Racine}{}{\\\ifboolKV[ClesPythagore]{Exact}{\NomA\NomB&=\opsqrt[maxdivstep=3]{a3}{a4}\opunzero{a4}\opexport{a4}{\Aquatre}\SI{\Aquatre}{\PfCPythaUnit}}{\NomA\NomB&\approx\opsqrt[maxdivstep=5]{a3}{a4}\opround{a4}{pres}{a4}\opunzero{a4}\opexport{a4}{\Aquatre}\SI{\Aquatre}{\PfCPythaUnit}}}%\\ + \ifboolKV[ClesPythagore]{Racine}{}{\\\NomA\NomB&\IfInteger{\fpeval{round(sqrt(#3^2-#4^2),\useKV[ClesPythagore]{Precision})^2-#3^2+#4^2}}{=}{\approx}\opsqrt[maxdivstep=5]{a3}{a4}\opround{a4}{pres}{a4}\opunzero{a4}\opexport{a4}{\Aquatre}\SI{\Aquatre}{\PfCPythaUnit}}%\\ } \end{align*} }{% @@ -307,7 +307,7 @@ \NomA\NomB^2&=\opsub*{a1}{a2}{a3}\opexport{a3}{\Atrois}\num{\Atrois}%\\ \ifboolKV[ClesPythagore]{AvantRacine}{}{% \ifboolKV[ClesPythagore]{Entier}{}{\\\NomA\NomB&=\sqrt{\opexport{a3}{\Atrois}\num{\Atrois}}}% - \ifboolKV[ClesPythagore]{Racine}{}{\\\ifboolKV[ClesPythagore]{Exact}{\NomA\NomB&=\opsqrt[maxdivstep=3]{a3}{a4}\opunzero{a4}\opexport{a4}{\Aquatre}\SI{\Aquatre}{\PfCPythaUnit}}{\NomA\NomB&\approx\opsqrt[maxdivstep=5]{a3}{a4}\opround{a4}{pres}{a4}\opunzero{a4}\opexport{a4}{\Aquatre}\SI{\Aquatre}{\PfCPythaUnit}}}%\\ + \ifboolKV[ClesPythagore]{Racine}{}{\\\NomA\NomB&\IfInteger{\fpeval{round(sqrt(#3^2-#4^2),\useKV[ClesPythagore]{Precision})^2-#3^2+#4^2}}{=}{\approx}\opsqrt[maxdivstep=5]{a3}{a4}\opround{a4}{pres}{a4}\opunzero{a4}\opexport{a4}{\Aquatre}\SI{\Aquatre}{\PfCPythaUnit}}%\\ } \end{align*} }% diff --git a/macros/latex/contrib/profcollege/latex/PfCRangementNombres.tex b/macros/latex/contrib/profcollege/latex/PfCRangementNombres.tex index 436511bcf5..e248c04401 100644 --- a/macros/latex/contrib/profcollege/latex/PfCRangementNombres.tex +++ b/macros/latex/contrib/profcollege/latex/PfCRangementNombres.tex @@ -1,13 +1,130 @@ %%% % Rangement des nombres %%% -\setKVdefault[ClesRgt]{Croissant,Decroissant=false,Strict,Fraction=false,Details=false,Seul=false} +\setKVdefault[ClesRgt]{Croissant,Decroissant=false,Strict,Fraction=false,Details=false,Seul=false}% \dtlexpandnewvalue% \DTLgnewdb{mtnumedb}% \DTLgnewdb{mtRGTdb}% Pb de doublon avec mtdb de Mediane -\newcommand\Rangement[2][]{% +%\begin{document} + +\NewDocumentCommand\RangementListe{m}{% + \readlist*\ListeRgt{#1}% + \xdef\Foo{\ListeRgt[1]} + \xintFor* ##1 in{\xintSeq{2}{\ListeRgtlen}}\do{% + \xdef\Foo{\Foo,\ListeRgt[##1]} + }% + \xdef\Fooa{\Foo}% + \xdef\PfCRetiensRangement{}% + \xintFor* ##1 in{\xintSeq{1}{\fpeval{\ListeRgtlen-1}}}\do{% + \xdef\Element{\fpeval{min(\Fooa)}}% + \xintifboolexpr{##1>1}{% + \xdef\PfCRetiensRangement{\PfCRetiensRangement,\Element}% + }{% + \xdef\PfCRetiensRangement{\Element}% + }% + \readlist*\RetiensListe{\Fooa}% + % La liste des rangements vaut \RetiensRangement.\par + % La retiensliste vaut \showitems\RetiensListe[]\par + \xdef\Fooi{}% + \foreachitem\rgt\in\RetiensListe{% + % \rgtcnt~\RetiensListe[\rgtcnt] et \Element% + \xintifboolexpr{\RetiensListe[\rgtcnt]==\Element}{}{% + \xdef\Fooi{\Fooi,\RetiensListe[\rgtcnt]} + }% + % La liste Fooi est \Fooi\par + }% + \readlist*\ListeTempo{\Fooi}% + \xintifboolexpr{\ListeTempolen>1}{% + \xdef\Fooa{\ListeTempo[1]}% + \xintFor* ##2 in{\xintSeq{2}{\ListeTempolen}}\do{% + \xdef\Fooa{\Fooa,\ListeTempo[##2]}% + }% + }{% + % \xdef\Fooa{\ListeTempo[1]}% + \xdef\PfCRetiensRangement{\PfCRetiensRangement,\ListeTempo[1]} + }% + % La liste Fooa vaut \Fooa\par + }% +}% + +\NewDocumentCommand\Rangement{om}{% + \useKVdefault[ClesRgt]% + \setKV[ClesRgt]{#1}% + \ignoreemptyitems% + \readlist*\ListeRgt{#2}% + % \showitems\ListeRgt[]\par% + \ifboolKV[ClesRgt]{Fraction}{% + \setsepchar[*]{,*/}\ignoreemptyitems% + \readlist*\ListeRgt{#2}% + % on cherche le d\'enominateur commun + \ppcm=1\relax + \foreachitem\x\in\ListeRgt{% + \PPCM{\fpeval{\ListeRgt[\xcnt,2]}}{\fpeval{\the\ppcm}}% + }% + % + \xdef\FooFraction{\fpeval{\ListeRgt[1,1]*\the\ppcm/\ListeRgt[1,2]}}% + \xintFor* ##1 in{\xintSeq{2}{\ListeRgtlen}}\do{% + \xdef\FooFraction{\FooFraction,\fpeval{\ListeRgt[##1,1]*\the\ppcm/\ListeRgt[##1,2]}}% + }% + \RangementListe{\FooFraction}% + \readlist*\PfCListeFinaleRgt{\PfCRetiensRangement}% + %%%%%%%%% + \ifboolKV[ClesRgt]{Decroissant}{% + \ifboolKV[ClesRgt]{Details}{% + \ensuremath{% + \xintFor* ##1 in{\xintSeq{0}{\fpeval{\PfCListeFinaleRgtlen-1}}}\do{% + \xintifForFirst{}{\ifboolKV[ClesRgt]{Strict}{>}{\geqslant}}\frac{\num{\PfCListeFinaleRgt[\fpeval{\PfCListeFinaleRgtlen-##1}]}}{\num{\the\ppcm}} + }% + }% + }{% + \ensuremath{ + \xintFor* ##1 in{\xintSeq{0}{\fpeval{\PfCListeFinaleRgtlen-1}}}\do{% + \xintifForFirst{}{\ifboolKV[ClesRgt]{Strict}{>}{\qeqslant}}\Simplification{\PfCListeFinaleRgt[\fpeval{\PfCListeFinaleRgtlen-##1}]}{\the\ppcm}}% + }% + }% + }{% + \ifboolKV[ClesRgt]{Details}{% + \ensuremath{% + \xintFor* ##1 in{\xintSeq{1}{\PfCListeFinaleRgtlen}}\do{% + \xintifForFirst{}{\ifboolKV[ClesRgt]{Strict}{<}{\leqslant}}\frac{\num{\PfCListeFinaleRgt[##1]}}{\num{\the\ppcm}}% + }% + }% + }{% + \ensuremath{% + \xintFor* ##1 in{\xintSeq{1}{\PfCListeFinaleRgtlen}}\do{% + \xintifForFirst{}{\ifboolKV[ClesRgt]{Strict}{<}{\leqslant}}\Simplification{\PfCListeFinaleRgt[##1]}{\the\ppcm}% + }% + }% + }% + }% %%%%%%%%%%%%% + }{% + \RangementListe{#2}% + % + % \PfCRetiensRangement% + \ifboolKV[ClesRgt]{Seul}{}{% + \readlist*\PfCListeFinaleRgt{\PfCRetiensRangement} + % \par \showitems\PfCListeFinaleRgt[] -- La longueur de la liste est \PfCListeFinaleRgtlen + \ifboolKV[ClesRgt]{Decroissant}{% + \ensuremath{% + \xintFor* ##1 in{\xintSeq{0}{\fpeval{\PfCListeFinaleRgtlen-1}}}\do{% + \xintifForFirst{}{\ifboolKV[ClesRgt]{Strict}{>}{\geqslant}}\num{\PfCListeFinaleRgt[\fpeval{\PfCListeFinaleRgtlen-##1}]}% + }% + }% + }{% + \ensuremath{% + \xintFor* ##1 in{\xintSeq{1}{\fpeval{\PfCListeFinaleRgtlen}}}\do{% + \xintifForFirst{}{\ifboolKV[ClesRgt]{Strict}{<}{\leqslant}}\num{\PfCListeFinaleRgt[##1]}% + }% + }% + }% + }% + }% + \reademptyitems + } + +\NewDocumentCommand\Rangementold{om}{% \useKVdefault[ClesRgt]% \setKV[ClesRgt]{#1}% \ifboolKV[ClesRgt]{Fraction}{% @@ -20,21 +137,21 @@ }% % On cr\'ee la liste des rangements. \DTLcleardb{mtnumedb}% -% % on les trie pour les ranger par ordre croissant + % % on les trie pour les ranger par ordre croissant \foreachitem\x\in\ListeRgt{% \DTLnewrow{mtnumedb}% \xdef\toto{\fpeval{\ListeRgt[\xcnt,1]*\the\ppcm/\ListeRgt[\xcnt,2]}}% \DTLnewdbentry{mtnumedb}{numeric}{\toto}% }% -% % On trie + % % On trie \ifboolKV[ClesRgt]{Decroissant}{% -% % On trie la liste + % % On trie la liste \dtlsort{numeric=descending}{mtnumedb}{\dtlicompare}% \ifboolKV[ClesRgt]{Details}{\ensuremath{\DTLforeach{mtnumedb}{\numeroDonnee=numeric}{\frac{\num{\numeroDonnee}}{\num{\the\ppcm}}\DTLiflastrow{}{\ifboolKV[ClesRgt]{Strict}{>}{\geqslant}}}}}{% \ensuremath{\DTLforeach{mtnumedb}{\numeroDonnee=numeric}{\Simplification{\numeroDonnee}{\ppcm}\DTLiflastrow{}{\ifboolKV[ClesRgt]{Strict}{>}{\geqslant}}}}% - } + }% }{% -% % On trie la liste + % % On trie la liste \dtlsort{numeric}{mtnumedb}{\dtlicompare}% \ifboolKV[ClesRgt]{Details}{% \ensuremath{\DTLforeach{mtnumedb}{\numeroDonnee=numeric}{\frac{\num{\numeroDonnee}}{\num{\the\ppcm}}\DTLiflastrow{}{\ifboolKV[ClesRgt]{Strict}{<}{\leqslant}}}}% @@ -47,27 +164,29 @@ \readlist*\ListeRgt{#2}% % on cr\'ee la base de donn\'ees des valeurs \DTLcleardb{mtRGTdb}% -% % on les trie pour les ranger par ordre croissant - \foreachitem\x\in\ListeRgt{% + % % on les trie pour les ranger par ordre croissant + \foreachitem\xcompteur\in\ListeRgt{% + % Les nombres sont \showitems\ListeRgt[] \DTLnewrow{mtRGTdb}% - \itemtomacro\ListeRgt[\xcnt]\y% - \DTLnewdbentry{mtRGTdb}{numeric}{\y}% + \itemtomacro\ListeRgt[\xcompteurcnt]\ycompteur% + \DTLnewdbentry{mtRGTdb}{numeric}{\ycompteur}% }% -% % + \DTLdisplaydb[]{mtRGTdb}% + % % \ifboolKV[ClesRgt]{Seul}{% - \xdef\PfCListeRgtRecup{}% + \xdef\PfCListeRgtRecup{}% \dtlsort{numeric}{mtRGTdb}{\dtlicompare}% \DTLforeach{mtRGTdb}{\numeroDonnee=numeric}{\xdef\PfCListeRgtRecup{\PfCListeRgtRecup \numeroDonnee\DTLiflastrow{}{,}}}% }{% - \ifboolKV[ClesRgt]{Decroissant}{% - % On trie la liste - \dtlsort{numeric=descending}{mtRGTdb}{\dtlicompare}% - \ensuremath{\DTLforeach{mtRGTdb}{\numeroDonnee=numeric}{\num{\numeroDonnee}\DTLiflastrow{}{\ifboolKV[ClesRgt]{Strict}{>}{\geqslant}}}}% - }{% -% % On trie la liste - \dtlsort{numeric}{mtRGTdb}{\dtlicompare}% - \ensuremath{\DTLforeach{mtRGTdb}{\numeroDonnee=numeric}{\num{\numeroDonnee}\DTLiflastrow{}{\ifboolKV[ClesRgt]{Strict}{<}{\leqslant}}}}% + \ifboolKV[ClesRgt]{Decroissant}{% + % On trie la liste + \dtlsort{numeric=descending}{mtRGTdb}{\dtlicompare}% + \ensuremath{\DTLforeach{mtRGTdb}{\numeroDonnee=numeric}{\num{\numeroDonnee}\DTLiflastrow{}{\ifboolKV[ClesRgt]{Strict}{>}{\geqslant}}}}% + }{% + % % On trie la liste + \dtlsort{numeric}{mtRGTdb}{\dtlicompare}% + \ensuremath{\DTLforeach{mtRGTdb}{\numeroDonnee=numeric}{\num{\numeroDonnee}\DTLiflastrow{}{\ifboolKV[ClesRgt]{Strict}{<}{\leqslant}}}}% + }% }% }% -}% }%
\ No newline at end of file diff --git a/macros/latex/contrib/profcollege/latex/PfCReperage.tex b/macros/latex/contrib/profcollege/latex/PfCReperage.tex index 20259f4a86..96c2d6512d 100644 --- a/macros/latex/contrib/profcollege/latex/PfCReperage.tex +++ b/macros/latex/contrib/profcollege/latex/PfCReperage.tex @@ -86,9 +86,10 @@ ObjetEquateur3("R=5"); ObjetGreenwich4("R=5"); fi; - AffichagePfC2; + AffichagePfC2; % AffichageObjet2; if \useKV[ClesReperage]{Axes}: + TraceAxes; drawoptions(withpen pencircle scaled 1.05 withcolor CouleurE); AffichageEquateur3; drawoptions(withpen pencircle scaled 1 withcolor CouleurG); @@ -1533,7 +1534,7 @@ pointe(unitp*(valeur[n]-ValeurOrigine,0)); elseif ACoord=2: if ((ValeurUnitex*valeur[n]) mod pasx)<>0: - label.bot(TEX("\footnotesize$\frac{\num{\fpeval{"&decimal(ValeurUnitex)&"*"&decimal(valeur[n])&"}}}{\num{"&decimal(pasx)&"}}$"),unitp*(valeur[n],0)); + label.bot(TEX("\footnotesize$\frac{\num{\fpeval{"&decimal(ValeurOrigine*pasx)&"+"&decimal(ValeurUnitex-ValeurOrigine)&"*"&decimal(valeur[n])&"}}}{\num{"&decimal(pasx)&"}}$"),unitp*(valeur[n],0)); else: label.bot(TEX("\footnotesize\num{\fpeval{"&decimal(ValeurUnitex)&"*"&decimal(valeur[n])&"/"&decimal(pasx)&"}}"),unitp*(valeur[n],0)); fi; @@ -1552,9 +1553,9 @@ elseif AffichageCoord=2: if p_<>"": if ((ValeurUnitex*valeur[n]) mod pasx)<>0: - label.bot(TEX("\footnotesize$\frac{\num{\fpeval{"&decimal(ValeurUnitex)&"*"&decimal(valeur[n])&"}}}{\num{"&decimal(pasx)&"}}$"),unitp*(valeur[n],0)); + label.bot(TEX("\footnotesize$\frac{\num{\fpeval{"&decimal(ValeurOrigine*pasx)&"+"&decimal(ValeurUnitex-ValeurOrigine)&"*"&decimal(valeur[n])&"}}}{\num{"&decimal(pasx)&"}}$"),unitp*(valeur[n],0)); else: - label.bot(TEX("\footnotesize\num{\fpeval{"&decimal(ValeurUnitex)&"*"&decimal(valeur[n])&"/"&decimal(pasx)&"}}"),unitp*(valeur[n],0)); + label.bot(TEX("\footnotesize\num{\fpeval{"&decimal(ValeurOrigine)&"+"&decimal(ValeurUnitex-ValeurOrigine)&"*"&decimal(valeur[n])&"/"&decimal(pasx)&"}}"),unitp*(valeur[n],0)); fi; pointe(unitp*(valeur[n],0)); fi; diff --git a/macros/latex/contrib/profcollege/latex/PfCSolides.tex b/macros/latex/contrib/profcollege/latex/PfCSolides.tex index 35bbeb74f5..ef0829af90 100644 --- a/macros/latex/contrib/profcollege/latex/PfCSolides.tex +++ b/macros/latex/contrib/profcollege/latex/PfCSolides.tex @@ -239,7 +239,7 @@ nombresommets=\useKV[ClesSolides]{SommetsPyramide}; color PfCOutColor,DecalageSommet; PfCOutColor=\useKV[ClesSolides]{Couleur}; - DecalageSommet=if Reguliere:(0,0,0) else: #3 fi; + DecalageSommet=#3;%if Reguliere:(0,0,0) else: #3 fi; Figure(-10u,-10u,10u,10u); Initialisation(PfCRho,PfCPhi,PfCTheta,PfCDistance); @@ -567,6 +567,8 @@ color A,B,C,D,E,F,G,H; color Sommet[]; trace Pave(A,B,C,D,E,F,G,H)(#3); + picture Depart; + Depart=currentpicture; currentpicture:=nullpicture; Sommet1=A; Sommet2=B; @@ -613,6 +615,7 @@ % trace polygone(MSection1,MSection2,MSection3,MSection4); color dcer,ccer; % 1er cote -> ok + DotLabel("",RetiensDefSection[4]); dcer:=Oeil-RetiensDefSection[4]; ccer:=Normal(RetiensDefSection[4],RetiensDefSection[2],RetiensDefSection[1]); draw chemin(MSection1,MSection2) if (ProduitScalaire(dcer,ccer)<0):dashed evenly fi; @@ -673,7 +676,8 @@ %trace polygone(MSection1,MSection2,MSection3,MSection4); fi; - trace Pave(A,B,C,D,E,F,G,H)(#3); + % trace Pave(A,B,C,D,E,F,G,H)(#3); + trace Depart; DefinirSommetsSection(#4); diff --git a/macros/latex/contrib/profcollege/latex/PfCStatistiques.tex b/macros/latex/contrib/profcollege/latex/PfCStatistiques.tex index 8f63507b5b..75913cc025 100644 --- a/macros/latex/contrib/profcollege/latex/PfCStatistiques.tex +++ b/macros/latex/contrib/profcollege/latex/PfCStatistiques.tex @@ -10,26 +10,33 @@ \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,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,TableauVide=false,ECC=false,Coupure=10,CouleurTab=gray!15,Graphique=false,Batons=true,% +Etendue=false,Moyenne=false,SET=false,ValeurExacte=false,MoyenneA,Somme,Mediane=false,DetailsMediane=false,UneMediane=false,QuartileUn=false,QuartileTrois=false,Total=false,Concret=false,% +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,% +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,% +Rayon=3cm,AffichageAngle=false,AffichageDonnee=false,ListeCouleurs={white},Hachures=false,ListeHachures={60},LectureInverse=false,EcartHachures=0.25,EpaisseurHachures=1,Legende,LegendeVide=false,ACompleter=false,DebutAngle=0,% %Pour les représentations Representation=false,% %Pour les barres horizontales -Barre=false,Longueur=10cm,Hauteur=5mm,Bicolore=false,EcartBarre=0%Grille est dispo +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 +% compl\'ements +%\defKV[ClesStat]{ListeHachures=\setKV[ClesStat]{Hachures}}% +\defKV[ClesStat]{Unite=\setKV[ClesStat]{Concret}}% \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% @@ -37,12 +44,12 @@ Barre=false,Longueur=10cm,Hauteur=5mm,Bicolore=false,EcartBarre=0%Grille est dis % \newcounter{PfCCompteLignes}% % -\def\BuildtabStat{% %%Tableau sans total +\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}{% - \renewcommand{\arraystretch}{\useKV[ClesStat]{Stretch}}% \begin{NiceTabular}{c*{\fpeval{\ListeCompletelen+1}}{>{\centering\arraybackslash}p{\useKV[ClesStat]{Largeur}}}}% \CodeBefore% \rowcolor{\useKV[ClesStat]{CouleurTab}}{1}% @@ -84,7 +91,6 @@ Barre=false,Longueur=10cm,Hauteur=5mm,Bicolore=false,EcartBarre=0%Grille est dis }% \end{NiceTabular}% }{% - \renewcommand{\arraystretch}{\useKV[ClesStat]{Stretch}}% \begin{NiceTabular}{c*{\fpeval{\ListeCompletelen}}{>{\centering\arraybackslash}p{\useKV[ClesStat]{Largeur}}}}% \CodeBefore% \rowcolor{\useKV[ClesStat]{CouleurTab}}{1}% @@ -194,12 +200,14 @@ Barre=false,Longueur=10cm,Hauteur=5mm,Bicolore=false,EcartBarre=0%Grille est dis }% \def\UpdateCoul#1\nil{\addtotok\toklistecouleur{#1,}}% +\def\UpdateHach#1\nil{\addtotok\toklisteanglehachure{#1,}}% \def\UpdateLegende#1\nil{\addtotok\toklistelegende{#1,}}% % Pour construire le diagramme circulaire qualitatif \def\buildgraphcq#1{% \newtoks\toklistepointq\toklistepointq{}% \newtoks\toklistecouleur\toklistecouleur{}% + \newtoks\toklisteanglehachure\toklisteanglehachure{}% \newtoks\toklistelegende\toklistelegende{}% \ifboolKV[ClesStat]{LegendeVide}{% \xdef\foo{\useKV[ClesStat]{LegendesVides}}% @@ -212,7 +220,10 @@ Barre=false,Longueur=10cm,Hauteur=5mm,Bicolore=false,EcartBarre=0%Grille est dis \xdef\ListeAvantCouleurs{\useKV[ClesStat]{ListeCouleurs}}% \readlist*\ListeCouleur{\ListeAvantCouleurs}% \foreachitem\couleur\in\ListeCouleur{\expandafter\UpdateCoul\couleur\nil}% - \NewMPStatCirculaireQ{\the\toklistepointq}{#1}{\the\toklistecouleur}{\the\toklistelegende}% + \xdef\ListeAvantHachures{\useKV[ClesStat]{ListeHachures}}% + \readlist*\ListeHachure{\ListeAvantHachures}% + \foreachitem\valeurangle\in\ListeHachure{\expandafter\UpdateHach\valeurangle\nil}% + \NewMPStatCirculaireQ{\the\toklistepointq}{#1}{\the\toklistecouleur}{\the\toklistelegende}{\the\toklisteanglehachure}% }% %% calcul des fr\'equences @@ -231,6 +242,8 @@ Barre=false,Longueur=10cm,Hauteur=5mm,Bicolore=false,EcartBarre=0%Grille est dis %% calcul des ECC \newcount\CompteurECC% \newcount\CompteurECCTotal% +\newcount\CompteurECCC% +\newcount\CompteurECCCTotal% \newcommand\CalculECC[1]{% \xdef\TotalECC{0}% @@ -451,7 +464,16 @@ Barre=false,Longueur=10cm,Hauteur=5mm,Bicolore=false,EcartBarre=0%Grille est dis unitey:=\useKV[ClesStat]{Unitey}*cm; xpartorigine:=\useKV[ClesStat]{Origine}; AngleRotation=\useKV[ClesStat]{AngleRotationAbscisse}; - boolean Rotation,Lecture,LectureFine,AideLecture,DonneesSup,Reponses,Qualitatif,Tiret,LegendeVide,Retour; + 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}; @@ -541,16 +563,28 @@ Barre=false,Longueur=10cm,Hauteur=5mm,Bicolore=false,EcartBarre=0%Grille est dis 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)); @@ -627,20 +661,36 @@ Barre=false,Longueur=10cm,Hauteur=5mm,Bicolore=false,EcartBarre=0%Grille est dis 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); @@ -796,6 +846,7 @@ Barre=false,Longueur=10cm,Hauteur=5mm,Bicolore=false,EcartBarre=0%Grille est dis ang[0]:=0; path cc; cc=(fullcircle scaled (2*Rayon)); + % vardef AfficheLegende(text t)= picture ResultatLegende; ResultatLegende=image( @@ -806,12 +857,12 @@ Barre=false,Longueur=10cm,Hauteur=5mm,Bicolore=false,EcartBarre=0%Grille est dis 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)): + 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])<xpart(O)) and (ypart(C[n])>ypart(O)): + if (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.ulft(TEX(p_),D[n]);fi; @@ -821,7 +872,7 @@ Barre=false,Longueur=10cm,Hauteur=5mm,Bicolore=false,EcartBarre=0%Grille est dis draw C[n]--D[n]; if Retour=false:label.llft(TEX(p_),D[n]);fi; fi; - if (xpart(C[n])>xpart(O)) and (ypart(C[n])<ypart(O)): + if ((xpart(C[n])>xpart(O)) or (xpart(C[n])=xpart(O))) and (ypart(C[n])<ypart(O)): D[n]=C[n]+(0.5cm,0); draw C[n]--D[n]; if Retour=false:label.lrt(TEX(p_),D[n]);fi; @@ -842,12 +893,12 @@ Barre=false,Longueur=10cm,Hauteur=5mm,Bicolore=false,EcartBarre=0%Grille est dis 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)): + if (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(LATEX(p_),D[n]);fi; fi; - if (xpart(C[n])<xpart(O)) and (ypart(C[n])>ypart(O)): + if (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.ulft(LATEX(p_),D[n]);fi; @@ -871,19 +922,22 @@ Barre=false,Longueur=10cm,Hauteur=5mm,Bicolore=false,EcartBarre=0%Grille est dis } % la construction du graphique qualitatif -\def\NewMPStatCirculaireQ#1#2#3#4{% +% la construction du graphique qualitatif +\def\NewMPStatCirculaireQ#1#2#3#4#5{% %#1 : la liste des données %#2 : 360 ou 180 %#3 : liste des couleurs %#4 : liste des légendes à effacer. + %#5 : liste des angles des hachures \ifluatex \mplibforcehmode \begin{mplibcode} \NewMPStatCirculaireCodeQ + DebutAngle=\useKV[ClesStat]{DebutAngle}; if Inverse=false: - A[0]=point(0) of cc; + A[0]=point(0+DebutAngle) of cc; else: - A[0]=point(180) of cc; + A[0]=point(180+DebutAngle) of cc; fi; % on r\'ecup\`ere les couleurs color Col[]; @@ -892,6 +946,13 @@ Barre=false,Longueur=10cm,Hauteur=5mm,Bicolore=false,EcartBarre=0%Grille est dis n:=n+1; Col[n]=p_; endfor; + % on r\'ecup\`ere les angles d'hachures + numeric anglehach[]; + n:=0; + for p_=#5: + n:=n+1; + anglehach[n]=p_; + endfor; vardef toto(text t)= n:=0; for p_=t: @@ -920,8 +981,8 @@ Barre=false,Longueur=10cm,Hauteur=5mm,Bicolore=false,EcartBarre=0%Grille est dis 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) + else:arccercle(A[n],A[n-1],O) fi--cycle),if unknown anglehach[n]:p_*(#2/total[N]) if + (n mod 2)=0: +90 else: -90 fi else: anglehach[n] 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: @@ -1027,6 +1088,13 @@ Barre=false,Longueur=10cm,Hauteur=5mm,Bicolore=false,EcartBarre=0%Grille est dis n:=n+1; Col[n]=p_; endfor; + % on r\'ecup\`ere les angles d'hachures + numeric anglehach[]; + n:=0; + for p_=#5: + n:=n+1; + anglehach[n]=p_; + endfor; if Inverse=false: A[0]=point(0) of cc; else: @@ -1060,8 +1128,8 @@ Barre=false,Longueur=10cm,Hauteur=5mm,Bicolore=false,EcartBarre=0%Grille est dis 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) + else:arccercle(A[n],A[n-1],O) fi--cycle),if unknown anglehach[n]:p_*(#2/total[N]) if + (n mod 2)=0: +90 else: -90 fi else: anglehach[n] 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: @@ -1166,477 +1234,905 @@ Barre=false,Longueur=10cm,Hauteur=5mm,Bicolore=false,EcartBarre=0%Grille est dis \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]<minx: + minx:=X[p]; + fi; + 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]{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]{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% + }{}% + }% }{% - \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}% + \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]{Sondage}{% + \ifboolKV[ClesStat]{Liste}{% \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}% + \xdef\foo{}% + \setsepchar[*]{,*/}\ignoreemptyitems% + \xintFor* ##1 in {\xintSeq {1}{\Listelen}}\do{% + \xdef\foo{\foo 1/\Liste[##1],}% }% - \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}}% + \readlist*\ListeComplete{\foo}% + \setKV[ClesStat]{Qualitatif}% }{% - \ifboolKV[ClesStat]{Qualitatif}{% - % % on lit la liste \'ecrite sous la forme valeur/effectif - \setsepchar[*]{,*/}\ignoreemptyitems% - \readlist*\ListeInitiale{#2}% + \ifboolKV[ClesStat]{Sondage}{% + \setsepchar{,}\ignoreemptyitems% + \readlist*\Liste{#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}% + \newtoks\tabtoksEEa% + \tabtoksEEa{}% + % % "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}% + \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 + }{}% }% - \dtlsort{Val}{mtdbEEqual}{\dtlicompare}% - \DTLforeach{mtdbEEqual}{\Val=Val,\Eff=Eff}{% - \expandafter\AjoutListEEy\Val\nil% - \expandafter\AjoutListEEx\Eff\nil% + \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\listEE{\the\tabtoksEE} + \xdef\listEEb{\the\tabtoksEEa} \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]}}}% + \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}{% + \ifboolKV[ClesStat]{Somme}{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]{MoyenneA}{% + \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]{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 :% + +\ListeComplete[##1,2]}=\num{\EffectifTotal}\] + }{}% + \ifboolKV[ClesStat]{Moyenne}{% + \ifboolKV[ClesStat]{Somme}{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}}}{}% - \]}{% + \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}}}{} + \] + }{% \[ - \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}}}{}% - \]% + \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]{MoyenneA}{\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} + \]% + }% }% - \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} + \[\frac{\num{\SommeDonnees}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}}{\num{\EffectifTotal}}% \ifboolKV[ClesStat]{ValeurExacte}{}{% - \opdiv*{\SommeDonnees}{\ListeCompletelen}{resultatmoy}{restemoy}% + \opdiv*{\SommeDonnees}{\EffectifTotal}{resultatmoy}{restemoy}% \opround{resultatmoy}{\useKV[ClesStat]{Precision}}{resultatmoy1}% \opcmp{resultatmoy}{resultatmoy1}\ifopeq=\else\approx\fi% - \num{\fpeval{round(\SommeDonnees/\ListeCompletelen,\useKV[ClesStat]{Precision})}}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}% + \num{\fpeval{round(\SommeDonnees/\EffectifTotal,\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}}% + % % 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% - }% - %%% - \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\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\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}}$.\\ + \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{\ListeCompletelen/2}\relax% + \med=\fpeval{\EffectifTotal/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}$.\\ + L'effectif total de la s\'erie est \num{\EffectifTotal}. Or, $\num{\EffectifTotal}=\num{\fpeval{\med}}+\num{\fpeval{\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% + \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% + }% }% - %%%%%%% - }{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}}}{}% + %%% 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% }% - \]% - }{}% - % % 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}}$. % + %%% 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\k% - \k=0% + \newcount\PfCQtroisk% + \PfCQtroisk=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}.}{.}% + \PfCQtroisk=\numexpr\PfCQtroisk+1\relax% + \ifnum\PfCQtroisk=\PfCQuartileTrois% + \xdef\QuartileTrois{\ListeComplete[##1,1]}% \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]% + }% + }% + }{}% }% - % 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/PfCStatistiquesold.tex b/macros/latex/contrib/profcollege/latex/PfCStatistiquesold.tex new file mode 100644 index 0000000000..ca8be38394 --- /dev/null +++ b/macros/latex/contrib/profcollege/latex/PfCStatistiquesold.tex @@ -0,0 +1,2106 @@ +%%% +% Statistiques +%%% +\newcommand\NbDonnees{}% +\newcommand\SommeDonnees{}% +\newcommand\EffectifTotal{}% +\newcommand\Moyenne{}% +\newcommand\Etendue{}% +\newcommand\Mediane{}% +\newcommand\DonneeMax{}% +\newcommand\DonneeMin{}% +\newcommand\EffectifMax{}% + +\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,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)) and (ypart(C[n])>ypart(O)): + D[n]=C[n]+(0.5cm,0); + draw C[n]--D[n]; + if Retour=false:label.urt(TEX(p_),D[n]);fi; + fi; + if (xpart(C[n])<xpart(O)) and (ypart(C[n])>ypart(O)): + D[n]=C[n]-(0.5cm,0); + draw C[n]--D[n]; + if Retour=false:label.ulft(TEX(p_),D[n]);fi; + fi; + if (xpart(C[n])<xpart(O)) and (ypart(C[n])<ypart(O)): + D[n]=C[n]-(0.5cm,0); + draw C[n]--D[n]; + if Retour=false:label.llft(TEX(p_),D[n]);fi; + fi; + if (xpart(C[n])>xpart(O)) and (ypart(C[n])<ypart(O)): + D[n]=C[n]+(0.5cm,0); + draw C[n]--D[n]; + if Retour=false:label.lrt(TEX(p_),D[n]);fi; + fi; + fi; + endfor; + ); + ResultatLegende + % fi; + enddef; + vardef AfficheLegendePDF(text t)= + picture ResultatLegende; + ResultatLegende=image( + for p_=t: + if string p_: + n:=n+1; + C[n]=A[n-1] rotatedabout(O,if Inverse:-1* fi(ang[n]-ang[n-1])/2); + draw 0.95[O,C[n]]--1.05[O,C[n]]; + C[n]:=1.05[O,C[n]]; + Test(n); + if (xpart(C[n])>xpart(O)) and (ypart(C[n])>ypart(O)): + D[n]=C[n]+(0.5cm,0); + draw C[n]--D[n]; + if Retour=false:label.urt(LATEX(p_),D[n]);fi; + fi; + if (xpart(C[n])<xpart(O)) and (ypart(C[n])>ypart(O)): + D[n]=C[n]-(0.5cm,0); + draw C[n]--D[n]; + if Retour=false:label.ulft(LATEX(p_),D[n]);fi; + fi; + if (xpart(C[n])<xpart(O)) and (ypart(C[n])<ypart(O)): + D[n]=C[n]-(0.5cm,0); + draw C[n]--D[n]; + if Retour=false:label.llft(LATEX(p_),D[n]);fi; + fi; + if (xpart(C[n])>xpart(O)) and (ypart(C[n])<ypart(O)): + D[n]=C[n]+(0.5cm,0); + draw C[n]--D[n]; + if Retour=false:label.lrt(LATEX(p_),D[n]);fi; + fi; + fi; + endfor; + ); + ResultatLegende + % fi; + enddef; +} + +% la construction du graphique qualitatif +\def\NewMPStatCirculaireQ#1#2#3#4{% + %#1 : la liste des données + %#2 : 360 ou 180 + %#3 : liste des couleurs + %#4 : liste des légendes à effacer. + \ifluatex + \mplibforcehmode + \begin{mplibcode} + \NewMPStatCirculaireCodeQ + if Inverse=false: + A[0]=point(0) of cc; + else: + A[0]=point(180) of cc; + fi; + % on r\'ecup\`ere les couleurs + color Col[]; + n:=0; + for p_=#3: + n:=n+1; + Col[n]=p_; + endfor; + 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,(((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]<minx: + minx:=X[p]; + fi; + 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 new file mode 100644 index 0000000000..72a33f9dd4 --- /dev/null +++ b/macros/latex/contrib/profcollege/latex/PfCStatistiquesoldold.tex @@ -0,0 +1,2109 @@ +%%% +% 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])<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.ulft(TEX(p_),D[n]);fi; + fi; + if (xpart(C[n])<xpart(O)) and (ypart(C[n])<ypart(O)): + D[n]=C[n]-(0.5cm,0); + draw C[n]--D[n]; + if Retour=false:label.llft(TEX(p_),D[n]);fi; + fi; + if ((xpart(C[n])>xpart(O)) or (xpart(C[n])=xpart(O))) and (ypart(C[n])<ypart(O)): + D[n]=C[n]+(0.5cm,0); + draw C[n]--D[n]; + if Retour=false:label.lrt(TEX(p_),D[n]);fi; + fi; + fi; + endfor; + ); + ResultatLegende + % fi; + enddef; + vardef AfficheLegendePDF(text t)= + picture ResultatLegende; + ResultatLegende=image( + for p_=t: + if string p_: + n:=n+1; + C[n]=A[n-1] rotatedabout(O,if Inverse:-1* fi(ang[n]-ang[n-1])/2); + draw 0.95[O,C[n]]--1.05[O,C[n]]; + C[n]:=1.05[O,C[n]]; + Test(n); + if (xpart(C[n])>xpart(O)) and ((ypart(C[n])>ypart(O)) 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])<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.ulft(LATEX(p_),D[n]);fi; + fi; + if (xpart(C[n])<xpart(O)) and (ypart(C[n])<ypart(O)): + D[n]=C[n]-(0.5cm,0); + draw C[n]--D[n]; + if Retour=false:label.llft(LATEX(p_),D[n]);fi; + fi; + if (xpart(C[n])>xpart(O)) and (ypart(C[n])<ypart(O)): + D[n]=C[n]+(0.5cm,0); + draw C[n]--D[n]; + if Retour=false:label.lrt(LATEX(p_),D[n]);fi; + fi; + fi; + endfor; + ); + ResultatLegende + % fi; + enddef; +} + +% la construction du graphique qualitatif +\def\NewMPStatCirculaireQ#1#2#3#4{% + %#1 : la liste des données + %#2 : 360 ou 180 + %#3 : liste des couleurs + %#4 : liste des légendes à effacer. + \ifluatex + \mplibforcehmode + \begin{mplibcode} + \NewMPStatCirculaireCodeQ + if Inverse=false: + A[0]=point(0) of cc; + else: + A[0]=point(180) of cc; + fi; + % on r\'ecup\`ere les couleurs + color Col[]; + n:=0; + for p_=#3: + n:=n+1; + Col[n]=p_; + endfor; + 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,(((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]<minx: + minx:=X[p]; + fi; + 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 381e2a8df6..8da863a7b1 100644 --- a/macros/latex/contrib/profcollege/latex/PfCTableauxUnites.tex +++ b/macros/latex/contrib/profcollege/latex/PfCTableauxUnites.tex @@ -969,9 +969,9 @@ }% \StrLen{\ListeNombreAPlacer[##2,2]}[\TabLongueurNombre]% \xintifboolexpr{\ListeNombreAPlacer[##2,2]==0}{}{% - %On place la virgule - \tikz\node[xshift=1em] at (\fpeval{\DecalageLigne+##2+4.5}-|\fpeval{\PfCDerniereColonneEntiere-0.5-\TabLongueurNombre+1}) {\PfCTBstrut,};% - %on écrit la partie décimale + % On place la virgule + \tikz\node[xshift=1em] at (\fpeval{\DecalageLigne+##2+4.5}-|\fpeval{\PfCPremiereColonneDecimale-1-0.5}) {\PfCTBstrut,};% + % on écrit la partie décimale \xintFor* ##1 in{\xintSeq {1}{\TabLongueurNombre}}\do{% \tikz\node at (\fpeval{\DecalageLigne+##2+4.5}-|\fpeval{\PfCPremiereColonneDecimale-1.5+##1}) {\PfCTBstrut\StrMid{\ListeNombreAPlacer[##2,2]}{##1}{##1}};% }% diff --git a/macros/latex/contrib/profcollege/latex/PfCTablesOperations.tex b/macros/latex/contrib/profcollege/latex/PfCTablesOperations.tex index 40015eaeec..c88c18363c 100644 --- a/macros/latex/contrib/profcollege/latex/PfCTablesOperations.tex +++ b/macros/latex/contrib/profcollege/latex/PfCTablesOperations.tex @@ -1,7 +1,7 @@ %%% % Tables Addition-Multiplication %%% -\setKVdefault[Tables]{Addition=false,Multiplication=true,Seul=false,Debut=0,Fin=10,Couleur=white} +\setKVdefault[Tables]{Addition=false,Soustraction=false,Multiplication,Seul=false,Debut=0,Fin=10,Couleur=white} % pour m\'emoire \newcommand\TableMultiplicationComplete{% @@ -84,20 +84,39 @@ }% }% +\newcommand\TableSoustractionSeule[1]{% + \ensuremath{% + \begin{array}{ccccc} + \xintFor* ##1 in {\xintSeq + {\fpeval{#1+\useKV[Tables]{Debut}}}{\fpeval{#1+\useKV[Tables]{Fin}}}}\do{ + ##1&-&=&\fpeval{##1-#1}\\ + } + \end{array} + }% +}% + \newcommand\Tables[2][]{% \useKVdefault[Tables]% \setKV[Tables]{#1}% \ifboolKV[Tables]{Seul}{% - \ifboolKV[Tables]{Addition}{% - \TableAdditionSeule{#2}% + \ifboolKV[Tables]{Soustraction}{% + \TableSoustractionSeule{#2}% }{% - \TableMultiplicationSeule{#2}% + \ifboolKV[Tables]{Addition}{% + \TableAdditionSeule{#2}% + }{% + \TableMultiplicationSeule{#2}% + }% }% }{% - \ifboolKV[Tables]{Addition}{% - \TableAdditionComplete% + \ifboolKV[Tables]{Soustraction}{% + La clé Soustraction n'est pas disponible ici.% }{% - \TableMultiplicationCompleteColore% + \ifboolKV[Tables]{Addition}{% + \TableAdditionComplete% + }{% + \TableMultiplicationCompleteColore% + }% }% }% }%
\ No newline at end of file diff --git a/macros/latex/contrib/profcollege/latex/ProfCollege.sty b/macros/latex/contrib/profcollege/latex/ProfCollege.sty index 7df0da0008..7be8c2783f 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/05/19}% +\def\filedate{2023/07/05}% \let\PfCfiledate\filedate% -\def\fileversion{0.99-z-m}% +\def\fileversion{0.99-z-o}% \let\PfCfileversion\fileversion% \ProvidesPackage{ProfCollege}[\filedate\space v\fileversion\space Aide pour utiliser LaTeX au college]% @@ -217,14 +217,15 @@ \ooalign{$\genfrac{}{}{0pt}{0}{#1}{#2}$\cr\PfCdotover\cr}% }% -\NewDocumentCommand\MultiCol{O{}m+m}{% +\NewDocumentCommand\MultiCol{O{}+m+m}{% \setsepchar[*]{/}% \readlist*\ListeNombreCol{#2}% \setsepchar[*]{§}% \readlist*\ListeContenuCol{#3}% \xintFor* ##1 in {\xintSeq{1}{\ListeNombreCollen}}\do{% + \itemtomacro\ListeContenuCol[##1]\PfMTexte \begin{minipage}[#1]{\ListeNombreCol[##1]\linewidth}% - \ListeContenuCol[##1]% + \PfMTexte \end{minipage}% \xintifboolexpr{##1<\ListeNombreCollen}{\hfill\vrule width \columnseprule\hfill}{}% }% @@ -571,6 +572,8 @@ }%\emoticon }%\raisebox } +\input{PfCAutomatismes} +\input{PfCNumberHive} \input{PfCPatronPaves} \input{PfCErathostene} \input{PfCDobble} diff --git a/macros/latex/contrib/profcollege/metapost/PfCMonde-futurenew.mp b/macros/latex/contrib/profcollege/metapost/PfCMonde.mp index 2e7b5977f8..11051483e4 100644 --- a/macros/latex/contrib/profcollege/metapost/PfCMonde-futurenew.mp +++ b/macros/latex/contrib/profcollege/metapost/PfCMonde.mp @@ -547,7 +547,7 @@ vardef Lecturecapitales= enddef; vardef Lecture(expr Nomfichier)= - NomFichier:=arborescence&Nomfichier; + NomFichier:=arborescence&"PfC"&Nomfichier; nblec:=scantokens readfrom NomFichier; for w=1 upto nblec: if projection="non": @@ -1221,38 +1221,38 @@ vardef Projection(expr TH,PH,Zoom)= 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; fi; if All=true: - Lecture("PfCCameriquesud.dat"); - Lecture("PfCCcaraibes.dat"); - Lecture("PfCCameriquecentrale.dat"); - Lecture("PfCCameriquenord.dat"); - Lecture("PfCCasia.dat"); - Lecture("PfCCeurope.dat"); - Lecture("PfCCafrique.dat"); + Lecture("Cameriquesud.dat"); + Lecture("Ccaraibes.dat"); + Lecture("Cameriquecentrale.dat"); + Lecture("Cameriquenord.dat"); + Lecture("Casia.dat"); + Lecture("Ceurope.dat"); + Lecture("Cafrique.dat"); else: if Amsud=true: - Lecture("PfCCameriquesud.dat"); + Lecture("Cameriquesud.dat"); fi; if Amnord=true: - Lecture("PfCCameriquenord.dat"); + Lecture("Cameriquenord.dat"); fi; if Amcentrale=true: - Lecture("PfCCameriquecentrale.dat"); + Lecture("Cameriquecentrale.dat"); fi; if Caraibes=true: - Lecture("PfCCcaraibes.dat"); + Lecture("Ccaraibes.dat"); fi; if Asie=true: if projection="bonne": - Lecture("PfCCasie.dat"); + Lecture("Casie.dat"); else: - Lecture("PfCCasia.dat"); + Lecture("Casia.dat"); fi; fi; if Europe=true: - Lecture("PfCCeurope.dat"); + Lecture("Ceurope.dat"); fi; if Afrique=true: - Lecture("PfCCafrique.dat"); + Lecture("Cafrique.dat"); fi; fi; if lacs=true: @@ -1288,13 +1288,13 @@ vardef Simple(expr TH,PH,Zoom)= theta:=TH; phi:=PH; zoom(Zoom); - Lecture("PfCCameriquesud.dat"); - Lecture("PfCCcaraibes.dat"); - Lecture("PfCCameriquecentrale.dat"); - Lecture("PfCCameriquenord.dat"); - Lecture("PfCCasia.dat"); - Lecture("PfCCeurope.dat"); - Lecture("PfCCafrique.dat"); + Lecture("Cameriquesud.dat"); + Lecture("Ccaraibes.dat"); + Lecture("Cameriquecentrale.dat"); + Lecture("Cameriquenord.dat"); + Lecture("Casia.dat"); + Lecture("Ceurope.dat"); + Lecture("Cafrique.dat"); if lacs=true: Lecturelacsp; Lecturelacspsup; @@ -1316,13 +1316,13 @@ vardef Mercator(expr TH,PH,Zoom)= theta:=TH; phi:=PH; zoom(Zoom); - Lecture("PfCCameriquesud.dat"); - Lecture("PfCCcaraibes.dat"); - Lecture("PfCCameriquecentrale.dat"); - Lecture("PfCCameriquenord.dat"); - Lecture("PfCCasia.dat"); - Lecture("PfCCeurope.dat"); - Lecture("PfCCafrique.dat"); + Lecture("Cameriquesud.dat"); + Lecture("Ccaraibes.dat"); + Lecture("Cameriquecentrale.dat"); + Lecture("Cameriquenord.dat"); + Lecture("Casia.dat"); + Lecture("Ceurope.dat"); + Lecture("Cafrique.dat"); if lacs=true: Lecturelacsp; Lecturelacspsup; @@ -1344,13 +1344,13 @@ vardef Winkel(expr TH,PH,Zoom)= theta:=TH; phi:=PH; zoom(Zoom); - Lecture("PfCCameriquesud.dat"); - Lecture("PfCCcaraibes.dat"); - Lecture("PfCCameriquecentrale.dat"); - Lecture("PfCCameriquenord.dat"); - Lecture("PfCCasia.dat"); - Lecture("PfCCeurope.dat"); - Lecture("PfCCafrique.dat"); + Lecture("Cameriquesud.dat"); + Lecture("Ccaraibes.dat"); + Lecture("Cameriquecentrale.dat"); + Lecture("Cameriquenord.dat"); + Lecture("Casia.dat"); + Lecture("Ceurope.dat"); + Lecture("Cafrique.dat"); if lacs=true: Lecturelacsp; Lecturelacspsup; @@ -1372,13 +1372,13 @@ vardef Cylindrique(expr TH,PH,Zoom)= theta:=TH; phi:=PH; zoom(Zoom); - Lecture("PfCCameriquesud.dat"); - Lecture("PfCCcaraibes.dat"); - Lecture("PfCCameriquecentrale.dat"); - Lecture("PfCCameriquenord.dat"); - Lecture("PfCCasia.dat"); - Lecture("PfCCeurope.dat"); - Lecture("PfCCafrique.dat"); + Lecture("Cameriquesud.dat"); + Lecture("Ccaraibes.dat"); + Lecture("Cameriquecentrale.dat"); + Lecture("Cameriquenord.dat"); + Lecture("Casia.dat"); + Lecture("Ceurope.dat"); + Lecture("Cafrique.dat"); if lacs=true: Lecturelacsp; Lecturelacspsup; @@ -1401,13 +1401,13 @@ vardef Bonne(expr TH,PH,Zoom)= phi:=PH; zoom(Zoom); 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; - Lecture("PfCCameriquesud.dat"); - Lecture("PfCCcaraibes.dat"); - Lecture("PfCCameriquecentrale.dat"); - Lecture("PfCCameriquenord.dat"); - Lecture("PfCCasie.dat"); - Lecture("PfCCeurope.dat"); - Lecture("PfCCafrique.dat"); + Lecture("Cameriquesud.dat"); + Lecture("Ccaraibes.dat"); + Lecture("Cameriquecentrale.dat"); + Lecture("Cameriquenord.dat"); + Lecture("Casie.dat"); + Lecture("Ceurope.dat"); + Lecture("Cafrique.dat"); if lacs=true: Lecturelacsp; Lecturelacspsup; @@ -1429,13 +1429,13 @@ enddef; vardef ConiqueH= projection:="coniqueh"; - Lecture("PfCCameriquesud.dat"); - Lecture("PfCCcaraibes.dat"); - Lecture("PfCCameriquecentrale.dat"); - Lecture("PfCCameriquenord.dat"); - Lecture("PfCCasie.dat"); - Lecture("PfCCeurope.dat"); - Lecture("PfCCafrique.dat"); + Lecture("Cameriquesud.dat"); + Lecture("Ccaraibes.dat"); + Lecture("Cameriquecentrale.dat"); + Lecture("Cameriquenord.dat"); + Lecture("Casie.dat"); + Lecture("Ceurope.dat"); + Lecture("Cafrique.dat"); if lacs=true: Lecturelacsp; Lecturelacspsup; @@ -1455,13 +1455,13 @@ enddef; vardef ConiqueB= projection:="coniqueb"; - Lecture("PfCCameriquesud.dat"); - Lecture("PfCCcaraibes.dat"); - Lecture("PfCCameriquecentrale.dat"); - Lecture("PfCCameriquenord.dat"); - Lecture("PfCCasie.dat"); - Lecture("PfCCeurope.dat"); - Lecture("PfCCafrique.dat"); + Lecture("Cameriquesud.dat"); + Lecture("Ccaraibes.dat"); + Lecture("Cameriquecentrale.dat"); + Lecture("Cameriquenord.dat"); + Lecture("Casie.dat"); + Lecture("Ceurope.dat"); + Lecture("Cafrique.dat"); if lacs=true: Lecturelacsp; Lecturelacspsup; @@ -1521,27 +1521,27 @@ vardef Mappemonde(expr longobs,latobs)= phip:=phii; fi; fill cercles(pte3,pte1,pte3,pte1,pte4) withcolor couleurfond; - Lecture("PfCCameriquesud.dat"); - Lecture("PfCCcaraibes.dat"); - Lecture("PfCCameriquecentrale.dat"); - Lecture("PfCCameriquenord.dat"); - Lecture("PfCCasie.dat"); - Lecture("PfCCeurope.dat"); - Lecture("PfCCafrique.dat"); +% Lecture("Cameriquesud.dat"); +% Lecture("Ccaraibes.dat"); +% Lecture("Cameriquecentrale.dat"); +% Lecture("Cameriquenord.dat"); +% Lecture("Casie.dat"); +% Lecture("Ceurope.dat"); +% Lecture("Cafrique.dat"); if volcans=true: - Lecturevolcans; +% Lecturevolcans; fi; if lacs=true: - Lecturelacs; - Lecturelacssup; +% Lecturelacs; +% Lecturelacssup; fi; - Lectureiles; +% Lectureiles; if capitales=true: - Lecturecapitales; +% Lecturecapitales; fi; if fleuves=true: - Lecturerivieres; - %Lecturerivieressup; +% Lecturerivieres; +% %Lecturerivieressup; fi; if maillage=true: drawoptions(withcolor couleurmaillage); @@ -1580,13 +1580,13 @@ vardef mappemonde(expr longobs,latobs)= phip:=phii; fi; fill cercles(pte3,pte1,pte3,pte1,pte4) withcolor couleurfond; - Lecture("PfCCameriquesud.dat"); - Lecture("PfCCcaraibes.dat"); - Lecture("PfCCameriquecentrale.dat"); - Lecture("PfCCameriquenord.dat"); - Lecture("PfCCasie.dat"); - Lecture("PfCCeurope.dat"); - Lecture("PfCCafrique.dat"); + Lecture("Cameriquesud.dat"); + Lecture("Ccaraibes.dat"); + Lecture("Cameriquecentrale.dat"); + Lecture("Cameriquenord.dat"); + Lecture("Casie.dat"); + Lecture("Ceurope.dat"); + Lecture("Cafrique.dat"); if volcans=true: Lecturevolcans; fi; diff --git a/macros/latex/contrib/profcollege/metapost/PfCObjets.mp b/macros/latex/contrib/profcollege/metapost/PfCObjets.mp index 3d6571c808..6998c54e26 100644 --- a/macros/latex/contrib/profcollege/metapost/PfCObjets.mp +++ b/macros/latex/contrib/profcollege/metapost/PfCObjets.mp @@ -834,10 +834,10 @@ vardef ObjetSphereCabinet[](expr Rn)= for l=0 upto (subh-1): tcpt.@[apj]:=apj; OTFc.@[apj].nb:=4; - OTFc.@[apj][1]:=(Famille(umin+(k+1)*upas,vmin+l*vpas));%1 - OTFc.@[apj][2]:=(Famille(umin+k*upas,vmin+l*vpas));%2 - OTFc.@[apj][3]:=(Famille(umin+k*upas,vmin+(l+1)*vpas));%3 - OTFc.@[apj][4]:=(Famille(umin+(k+1)*upas,vmin+(l+1)*vpas));%4 + OTFc.@[apj][1]:=Famille(umin+(k+1)*upas,vmin+l*vpas);%1 + OTFc.@[apj][2]:=Famille(umin+k*upas,vmin+l*vpas);%2 + OTFc.@[apj][3]:=Famille(umin+k*upas,vmin+(l+1)*vpas);%3 + OTFc.@[apj][4]:=Famille(umin+(k+1)*upas,vmin+(l+1)*vpas);%4 OTFc.@[apj].iso:=(OTFc.@[apj][1]+OTFc.@[apj][2]+OTFc.@[apj][3]+OTFc.@[apj][4])/4; ALT.@[apj]:=-Zpart(GCoord(OTFc.@[apj].iso)); PfCPS:=ProduitScalaire(Oeil-OTFc.@[apj][1],Normal(OTFc.@[apj][1],OTFc.@[apj][2],OTFc.@[apj][3]))/1000; diff --git a/macros/latex/contrib/profcollege/metapost/PfCScratch.mp b/macros/latex/contrib/profcollege/metapost/PfCScratch.mp index b3edc8af1f..18fe1c904a 100644 --- a/macros/latex/contrib/profcollege/metapost/PfCScratch.mp +++ b/macros/latex/contrib/profcollege/metapost/PfCScratch.mp @@ -15,7 +15,6 @@ numeric Nblignes; Nblignes:=1; pair DebutListe; DebutListe=(0,0); boolean NumeroteLignes; NumeroteLignes=false; boolean NumeroteFinBloc; NumeroteFinBloc=false; - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% couleurs color CoulLignes; CoulLignes:=black; color ColBloc; % alias des couleurs de bloc @@ -57,7 +56,7 @@ def Place expr o = enddef; def Placer expr o = - if path o: draw o else: draw o fi + if path o: draw o else: draw o fi; enddef; %impression @@ -819,8 +818,8 @@ enddef; vardef Tournerg(expr nbpas)= LONG:=0; - save $; - picture $, texto; + save Tourner; + picture Tourner, texto; if string nbpas: if symbole=true: texto=ColleBoxNew("tourner",Arcgauche,"de",OvalNb(nbpas),"degré(s)"); @@ -835,8 +834,8 @@ vardef Tournerg(expr nbpas)= fi; fi; ColBloc:=BleuMouvTrois; - $=Affichage(texto); - $ + Tourner=Affichage(texto); + Tourner enddef; vardef Orienter(expr nbpas)= @@ -1398,8 +1397,8 @@ vardef NoteImage= save $; picture $; $=image( - linecap := butt; - linejoin := mitered; +% linecap := butt; +% linejoin := mitered; fill (80.695297,716.262024)..controls (80.574203,716.257996) and (80.476601,716.171997)..(80.480499,716.062988) --(80.687500,704.125000)..controls (79.941399,704.570007) and (78.644501,704.637024)..(77.312500,704.223022) ..controls (75.503899,703.659973) and (74.339798,702.429993)..(74.710899,701.473022) @@ -1548,8 +1547,8 @@ vardef CrayonImage= picture cray; cray=image(% drawoptions (if print=false:withcolor (0.298050,0.556850,0.917650) fi); - linecap := butt; - linejoin := mitered; +% linecap := butt; +% linejoin := mitered; fill (0.960938,1.390630)--(1.644530,2.996090)..controls (1.730470,3.199220) and (1.917970,3.500000)..(2.062500,3.664060)..controls (2.324220,3.968750) and (3.539060,2.753910)..(3.234380,2.488280)..controls (3.070310,2.343750) and (2.769530,2.160160)..(2.566410,2.074220)--cycle; drawoptions (withcolor (0.349030,0.368640,0.450970)); pickup pencircle scaled 0.498140bp; @@ -2197,8 +2196,8 @@ enddef; vardef DrapeauImage= save $; picture $; $=image( - linecap := butt; - linejoin := rounded; +% linecap := butt; +% linejoin := rounded; if print = false: drawoptions(withcolor(76/255,191/255,86/255)) fi; fill (72.000000,713.254028)--(72.000000,718.918030)--(72.507797,718.979980) --(72.984398,719.026978)--(73.437500,719.054993)--(73.867203,719.070007) @@ -2350,7 +2349,7 @@ vardef CommandeVide(expr commande)= picture $,texto,TEXT; if string commande : texto=image( - label.lrt(TEX("\barre \hbox to"&commande&"cm{}"),if unknown _coinprec: (0,0) else:_coinprec fi); + label.lrt(TEX("\sffamily\bfseries\longbarre \hbox to"&commande&"cm{}"),if unknown _coinprec: (0,0) else:_coinprec fi); ); else: texto=commande; @@ -2365,18 +2364,12 @@ vardef LigneVide= save $; picture $,texto,TEXT; texto=image( - label.lrt(TEX("\barre \hbox to2cm{}"),if unknown _coinprec: (0,0) else:_coinprec fi); + label.lrt(TEX("\sffamily\bfseries\longbarre \hbox to4cm{}"),if unknown _coinprec: (0,0) else:_coinprec fi); ); TEXT=image( path cadre; cadre=CADRE(texto); unfill cadre; - %draw (urcorner texto+(0,eb))-- - % (ulcorner texto+(0.625cm,0)+(eb,eb)){dir180}.. - % {dir180}(ulcorner texto+(0.625cm,0))-- - % (ulcorner texto+(0.375cm,0)){dir180}.. - % {dir180}(ulcorner texto+(0.375cm,0)+(-eb,eb))-- - % (ulcorner texto+(0,eb)) withpen pencircle scaled 0; ); $=TEXT shifted (if unknown _coinprec:(0,0) else :_coinprec fi - ulcorner TEXT); _coinprec:=llcorner $; @@ -2390,6 +2383,7 @@ fi; $ enddef; + vardef LigneVideVar(expr commande)= LONG:=0; save $; @@ -2415,6 +2409,7 @@ TEXT=image( (ulcorner texto+(0.375cm,0)+(-eb,eb))-- (ulcorner texto+(0,eb))--(ulcorner texto+(-eb,0))--cycle; fill cadre withcolor white; + draw cadre; % draw (urcorner texto+(0,eb))-- % (ulcorner texto+(0.625cm,0)+(eb,eb))-- % (ulcorner texto+(0.625cm,0))-- @@ -2434,6 +2429,22 @@ fi; $ enddef; +vardef LigneVideVarUn(expr commande)= + LONG:=0; + save $; + picture $,texto,TEXT; + if string texto: + texto=image( + label.lrt(TEX("\barre \hbox to2cm{}"),if unknown _coinprec: (0,0) else:_coinprec fi); + ); +else: + texto=commande; +fi; +ColBloc:=white; +$=Affichage(texto); +$ +enddef; + vardef LignePointilles= LONG:=0; save $; diff --git a/macros/latex/contrib/profcollege/metapost/PfCSolid.mp b/macros/latex/contrib/profcollege/metapost/PfCSolid.mp index bc4b9517ee..b5f90b3ae4 100644 --- a/macros/latex/contrib/profcollege/metapost/PfCSolid.mp +++ b/macros/latex/contrib/profcollege/metapost/PfCSolid.mp @@ -107,6 +107,10 @@ vardef GCoord(expr N)= (-Xpart(N)*Aux1+Ypart(N)*Aux3,-Xpart(N)*Aux5-Ypart(N)*Aux6+Zpart(N)*Aux4,-Xpart(N)*Aux7-Ypart(N)*Aux8-Zpart(N)*Aux2+Rho) enddef; +vardef GCoordcabinet(expr N)= + (-(Xpart(N)*sind(30)*0.5)*Aux1+Ypart(N)*cosd(30)*Aux3,-(Xpart(N)*cosd(30)*0.5)*Aux5-Ypart(N)*Aux6+Zpart(N)*Aux4,-Xpart(N)*Aux7-Ypart(N)*Aux8-Zpart(N)*Aux2+Rho) +enddef; + unit:=1;%pour les mises l'chelle :) Merci pst-solides3d vardef Projette(expr M)= @@ -116,8 +120,13 @@ vardef Projette(expr M)= (Xpart(GCoord(M)),Ypart(GCoord(M)))*unit*DE elseif typerepre="cabinet": % (0.5*cosd(30)*Xpart(GCoord(M)),0.75*sind(30)*Ypart(GCoord(M)))*unit*DE - (Xpart(GCoord(M))+0.5*cosd(30)*Zpart(GCoord(M)),Ypart(GCoord(M))+0.5*sind(30)*Zpart(GCoord(M)))*20 -% (0.5*cosd(45)*Xpart(GCoord(M)),0.5*sind(45)*Ypart(GCoord(M)))*unit*DE +% (Xpart(M)+0.5*cosd(30)*Zpart(M),Ypart(M)+0.5*sind(30)*Zpart(M))*20 + %(Xpart(M)+0.5*cosd(30)*Ypart(M),Zpart(M)+0.5*sind(30)*Ypart(M))*20 + %(Ypart(M)+0.5*cosd(30)*Xpart(M),Zpart(M)+0.5*sind(30)*Xpart(M))*20%Good avec Theta=-20/Phi=-10 + %(Ypart(GCoord(M))+0.5*cosd(-30)*Xpart(GCoord(M)),Zpart(GCoord(M))+0.5*sind(-30)*Xpart(GCoord(M)))*20%Good avec Theta=-20/Phi=-10 + (Xpart(GCoord(M))*cosd(90-30),Ypart(GCoord(M))*sind(90-30)*0.5)*DE% garder peut-tre +% (Zpart(GCoord(M))+0.5*cosd(-30)*Ypart(GCoord(M)),Xpart(GCoord(M))+0.5*sind(-30)*Ypart(GCoord(M)))*20 + % (0.5*cosd(45)*Xpart(GCoord(M)),0.5*sind(45)*Ypart(GCoord(M)))*unit*DE % (Xpart(GCoord(M)),Ypart(GCoord(M)))*unit*DE %(Xpart(GCoord(M)),Ypart(GCoord(M)))*10 fi @@ -1036,7 +1045,7 @@ vardef DefinirSommets(text t)= nbauto:=0; for p_=t: nbauto:=nbauto+1; - if unknown p_:p_=Sommet[nbauto]; else: p_:=Sommet[nbauto] fi; + if unknown p_: p_=Sommet[nbauto]; else: p_:=Sommet[nbauto]; fi; endfor; enddef; @@ -1045,7 +1054,7 @@ vardef DefinirSommetsSection(text t)= nbauto:=0; for p_=t: nbauto:=nbauto+1; - if unknown p_:p_=MSection[nbauto]; else: p_:=MSection[nbauto] fi; + if unknown p_: p_=MSection[nbauto]; else: p_:=MSection[nbauto]; fi; endfor; enddef; diff --git a/macros/latex/contrib/reledmac/doc-more/page-typesetting-columns.pdf b/macros/latex/contrib/reledmac/doc-more/page-typesetting-columns.pdf Binary files differindex a2c8ba5bb6..523946af89 100644 --- a/macros/latex/contrib/reledmac/doc-more/page-typesetting-columns.pdf +++ b/macros/latex/contrib/reledmac/doc-more/page-typesetting-columns.pdf diff --git a/macros/latex/contrib/reledmac/examples/1-criticalendnotes.pdf b/macros/latex/contrib/reledmac/examples/1-criticalendnotes.pdf Binary files differindex 6718d07e1c..19ba32bad0 100644 --- a/macros/latex/contrib/reledmac/examples/1-criticalendnotes.pdf +++ b/macros/latex/contrib/reledmac/examples/1-criticalendnotes.pdf diff --git a/macros/latex/contrib/reledmac/examples/1-criticalnotes.pdf b/macros/latex/contrib/reledmac/examples/1-criticalnotes.pdf Binary files differindex 372a14dcd5..fe66f4945b 100644 --- a/macros/latex/contrib/reledmac/examples/1-criticalnotes.pdf +++ b/macros/latex/contrib/reledmac/examples/1-criticalnotes.pdf diff --git a/macros/latex/contrib/reledmac/examples/1-sidenotes.pdf b/macros/latex/contrib/reledmac/examples/1-sidenotes.pdf Binary files differindex 4b412e8c94..951422285e 100644 --- a/macros/latex/contrib/reledmac/examples/1-sidenotes.pdf +++ b/macros/latex/contrib/reledmac/examples/1-sidenotes.pdf diff --git a/macros/latex/contrib/reledmac/examples/1-tabular.pdf b/macros/latex/contrib/reledmac/examples/1-tabular.pdf Binary files differindex 7481913d9e..8d351658e9 100644 --- a/macros/latex/contrib/reledmac/examples/1-tabular.pdf +++ b/macros/latex/contrib/reledmac/examples/1-tabular.pdf diff --git a/macros/latex/contrib/reledmac/examples/1-verses-doublenumbering.pdf b/macros/latex/contrib/reledmac/examples/1-verses-doublenumbering.pdf Binary files differindex bf23212e5f..1ef8d93197 100644 --- a/macros/latex/contrib/reledmac/examples/1-verses-doublenumbering.pdf +++ b/macros/latex/contrib/reledmac/examples/1-verses-doublenumbering.pdf diff --git a/macros/latex/contrib/reledmac/examples/1-verses.pdf b/macros/latex/contrib/reledmac/examples/1-verses.pdf Binary files differindex d92d74d5e3..4989ff02b1 100644 --- a/macros/latex/contrib/reledmac/examples/1-verses.pdf +++ b/macros/latex/contrib/reledmac/examples/1-verses.pdf diff --git a/macros/latex/contrib/reledmac/examples/2-antilabe.pdf b/macros/latex/contrib/reledmac/examples/2-antilabe.pdf Binary files differindex 101950acdd..13b5060290 100644 --- a/macros/latex/contrib/reledmac/examples/2-antilabe.pdf +++ b/macros/latex/contrib/reledmac/examples/2-antilabe.pdf diff --git a/macros/latex/contrib/reledmac/examples/2-cross_referencing.pdf b/macros/latex/contrib/reledmac/examples/2-cross_referencing.pdf Binary files differindex 73961b2311..e0cb89f043 100644 --- a/macros/latex/contrib/reledmac/examples/2-cross_referencing.pdf +++ b/macros/latex/contrib/reledmac/examples/2-cross_referencing.pdf diff --git a/macros/latex/contrib/reledmac/examples/2-footnote_spacing.pdf b/macros/latex/contrib/reledmac/examples/2-footnote_spacing.pdf Binary files differindex 3132c5d3aa..2e1a4a6334 100644 --- a/macros/latex/contrib/reledmac/examples/2-footnote_spacing.pdf +++ b/macros/latex/contrib/reledmac/examples/2-footnote_spacing.pdf diff --git a/macros/latex/contrib/reledmac/examples/2-glossaries.pdf b/macros/latex/contrib/reledmac/examples/2-glossaries.pdf Binary files differindex 04ed547699..e65fe02f84 100644 --- a/macros/latex/contrib/reledmac/examples/2-glossaries.pdf +++ b/macros/latex/contrib/reledmac/examples/2-glossaries.pdf diff --git a/macros/latex/contrib/reledmac/examples/2-indexing.pdf b/macros/latex/contrib/reledmac/examples/2-indexing.pdf Binary files differindex 0c0fbad885..956bdb0ffb 100644 --- a/macros/latex/contrib/reledmac/examples/2-indexing.pdf +++ b/macros/latex/contrib/reledmac/examples/2-indexing.pdf diff --git a/macros/latex/contrib/reledmac/examples/2-lemma_disambigution.pdf b/macros/latex/contrib/reledmac/examples/2-lemma_disambigution.pdf Binary files differindex 5d1594698e..4ccc2a650b 100644 --- a/macros/latex/contrib/reledmac/examples/2-lemma_disambigution.pdf +++ b/macros/latex/contrib/reledmac/examples/2-lemma_disambigution.pdf diff --git a/macros/latex/contrib/reledmac/examples/2-line_numbers_in_header.pdf b/macros/latex/contrib/reledmac/examples/2-line_numbers_in_header.pdf Binary files differindex 44c9ca68ae..0f7d961a91 100644 --- a/macros/latex/contrib/reledmac/examples/2-line_numbers_in_header.pdf +++ b/macros/latex/contrib/reledmac/examples/2-line_numbers_in_header.pdf diff --git a/macros/latex/contrib/reledmac/examples/2-linespacing.pdf b/macros/latex/contrib/reledmac/examples/2-linespacing.pdf Binary files differindex ce1e005316..5c5f13a442 100644 --- a/macros/latex/contrib/reledmac/examples/2-linespacing.pdf +++ b/macros/latex/contrib/reledmac/examples/2-linespacing.pdf diff --git a/macros/latex/contrib/reledmac/examples/2-manuscript-apparatus.pdf b/macros/latex/contrib/reledmac/examples/2-manuscript-apparatus.pdf Binary files differindex c3f10d9bab..9c5d315d01 100644 --- a/macros/latex/contrib/reledmac/examples/2-manuscript-apparatus.pdf +++ b/macros/latex/contrib/reledmac/examples/2-manuscript-apparatus.pdf diff --git a/macros/latex/contrib/reledmac/examples/2-notes-width.pdf b/macros/latex/contrib/reledmac/examples/2-notes-width.pdf Binary files differindex 2d2ddd6780..22c41071f1 100644 --- a/macros/latex/contrib/reledmac/examples/2-notes-width.pdf +++ b/macros/latex/contrib/reledmac/examples/2-notes-width.pdf diff --git a/macros/latex/contrib/reledmac/examples/2-one_series_per_pstart.pdf b/macros/latex/contrib/reledmac/examples/2-one_series_per_pstart.pdf Binary files differindex fc5afbfa26..354a3cc663 100644 --- a/macros/latex/contrib/reledmac/examples/2-one_series_per_pstart.pdf +++ b/macros/latex/contrib/reledmac/examples/2-one_series_per_pstart.pdf diff --git a/macros/latex/contrib/reledmac/examples/2-performances.pdf b/macros/latex/contrib/reledmac/examples/2-performances.pdf Binary files differindex 48a9b6289d..2dd623c65f 100644 --- a/macros/latex/contrib/reledmac/examples/2-performances.pdf +++ b/macros/latex/contrib/reledmac/examples/2-performances.pdf diff --git a/macros/latex/contrib/reledmac/examples/2-reledmac-right-to-left.pdf b/macros/latex/contrib/reledmac/examples/2-reledmac-right-to-left.pdf Binary files differindex dd00c33a60..f98c09da4b 100644 --- a/macros/latex/contrib/reledmac/examples/2-reledmac-right-to-left.pdf +++ b/macros/latex/contrib/reledmac/examples/2-reledmac-right-to-left.pdf diff --git a/macros/latex/contrib/reledmac/examples/2-reledmac-right-to-left.tex b/macros/latex/contrib/reledmac/examples/2-reledmac-right-to-left.tex index 469a027b84..863575f1f4 100644 --- a/macros/latex/contrib/reledmac/examples/2-reledmac-right-to-left.tex +++ b/macros/latex/contrib/reledmac/examples/2-reledmac-right-to-left.tex @@ -1,75 +1,61 @@ \documentclass{article} -\usepackage[osf,p]{libertinus} +\usepackage[osf,p,nomath]{libertinus} \usepackage{microtype} \usepackage[pdfusetitle,hidelinks]{hyperref} \usepackage[noend,nofamiliar,noeledsec,series={A}]{reledmac} -\usepackage{ifluatex} -\ifluatex - \usepackage[main=english,bidi=basic]{babel} - \babelprovide[import=he]{hebrew} - \babelfont{rm}{Libertinus Serif} - \babelfont[hebrew]{rm}{Ezra SIL} - \newcommand{\texthebrew}[2][]{\foreignlanguage{hebrew}{#2}} - \newenvironment{hebrew}[2][]{\begin{otherlanguage}{hebrew}}{\end{otherlanguage}} - \usepackage{metalogo} -\else - \usepackage{polyglossia} - \setmainlanguage{english} - \setotherlanguage{hebrew} - \newfontfamily{\hebrewfont}[Scale=0.9]{Ezra SIL} -\fi - +\usepackage[bidi=default,english]{babel} +\babelprovide[import=he]{hebrew} +\babelfont{rm}{Libertinus Serif} +\babelfont[hebrew]{rm}{Ezra SIL} +\newcommand{\texthebrew}[2][]{\foreignlanguage{hebrew}{#2}} +\newcommand{\textenglish}[2][]{\foreignlanguage{english}{#2}} +\usepackage{metalogo} +\Xparafootsep{$||$\ } \Xarrangement{paragraph} -\Xbeforeinserting{\LTR} -\Xlemmaseparator{[}%Will be reversed by Ezra SIL font \Xafterlemmaseparator{0.5em} \Xbeforelemmaseparator{0.25em} -\Xwrapcontent{\textenglish} -\Xwraplemma{\RL} -\linenumincrement{2} +\linenumincrement{1} \firstlinenum{1} -\title{Editing right-to-left text with left-to-right notes} +% Here the reledmac settings for RTL +\Xwrapcontent{\textenglish} +\Xbhookgroup{\textdir TRT} +\Xlemmaseparator{[}%Will be reversed by Ezra SIL font + + \title{Editing right-to-left text} \date{} \begin{document} \maketitle \begin{abstract} + In this example, we use Lua\LaTeX. + After this introduction page, all the document will be in Hebrew, except some notes in English. + So the apparatus will be typeset right-to-left, except the comment, which will be typeset left-to-right. +\end{abstract} -In this file, we provide an example of an edition with right-to-left text and left-to-right notes, using \XeLaTeX. - -\begin{itemize} - \item The `hebrew' environment allows us to write Hebrew right-to-left. - \item \verb+\Xbeforeinserting{\LTR}+ makes the critical notes be typeset left-to-right. - \item \verb+\Xwraplemma{\RL}+ ensures the lemmas, which are in Hebrew, are typeset right-to-left. - \item \verb+\Xwrapcontent{\textenglish}+ ensures the content of the note is marked as English text. - \item As the `Ezra SIL' font transforms a `]' to a `[', we use a `[' as lemma separator, that will be typeset as `]' by `Ezra SIL'. So the need for \verb+\Xlemmaseparator+ is not directly linked to reledmac. -\end{itemize} - -\end{abstract} +\newpage +\selectlanguage{hebrew} -\begin{hebrew} \beginnumbering \pstart -\edtext{בְּרֵאשִׁ֖ית בָּרָ֣א}{\Afootnote{Some comment}} +\edtext{בְּרֵאשִׁ֖ית בָּרָ֣א}{\Afootnote{Some comment (1)}} אֱלֹהִ֑ים אֵ֥ת הַשָּׁמַ֖יִם וְאֵ֥ת הָאָֽרֶץ׃ -\edtext{וְהָאָ֗רֶץ הָיְתָ֥ה}{\Afootnote{Some comment}} -\edtext{ +\edtext{וְהָאָ֗רֶץ הָיְתָ֥ה}{\Afootnote{Some comment (2)}} +\edtext{% תֹ֨הוּ֙ וָבֹ֔הוּ וְחֹ֖שֶׁךְ עַל־פְּנֵ֣י תְהֹ֑ום וְר֣וּחַ אֱלֹהִ֔ים מְרַחֶ֖פֶת עַל־פְּנֵ֥י הַמָּֽיִם׃ -וַיֹּ֥אמֶר אֱלֹהִ֖ים יְהִ֣י אֹ֑ור וַֽיְהִי־אֹֽור׃ -}{\Afootnote{Some comment on a long lemma}} +וַיֹּ֥אמֶר אֱלֹהִ֖ים יְהִ֣י אֹ֑ור וַֽיְהִי־אֹֽור׃% +}{\Afootnote{Some comment on a long lemma (3)}} וַיַּ֧רְא אֱלֹהִ֛ים אֶת־הָאֹ֖ור כִּי־טֹ֑וב וַיַּבְדֵּ֣ל אֱלֹהִ֔ים בֵּ֥ין הָאֹ֖ור וּבֵ֥ין הַחֹֽשֶׁךְ׃ -\edtext{וַיִּקְרָ֨א אֱלֹהִ֤ים׀}{\Afootnote{Some comment}} +\edtext{וַיִּקְרָ֨א אֱלֹהִ֤ים׀}{\Afootnote{Some comment (4)}} לָאֹור֙ יֹ֔ום וְלַחֹ֖שֶׁךְ קָ֣רָא לָ֑יְלָה וַֽיְהִי־עֶ֥רֶב וַֽיְהִי־בֹ֖קֶר יֹ֥ום אֶחָֽד׃ פ -\edtext{וַיַּ֤רְא אֱלֹהִים֙}{\Afootnote{Some comment}} + \edtext{וַיַּ֤רְא אֱלֹהִים֙}{\Afootnote{Some comment (5)}} אֶת־כָּל־אֲשֶׁ֣ר עָשָׂ֔ה וְהִנֵּה־טֹ֖וב מְאֹ֑ד וַֽיְהִי־עֶ֥רֶב וַֽיְהִי־בֹ֖קֶר יֹ֥ום הַשִּׁשִּֽׁי׃ פ \pend \endnumbering -\end{hebrew} -\end{document} +\end{document} diff --git a/macros/latex/contrib/reledmac/examples/2-subdivision-number-in-header.pdf b/macros/latex/contrib/reledmac/examples/2-subdivision-number-in-header.pdf Binary files differindex 3963fa9cf0..99106157b5 100644 --- a/macros/latex/contrib/reledmac/examples/2-subdivision-number-in-header.pdf +++ b/macros/latex/contrib/reledmac/examples/2-subdivision-number-in-header.pdf diff --git a/macros/latex/contrib/reledmac/examples/2-titles_in_line_numbering_with_notes.pdf b/macros/latex/contrib/reledmac/examples/2-titles_in_line_numbering_with_notes.pdf Binary files differindex b1cce47306..b2bb7fb529 100644 --- a/macros/latex/contrib/reledmac/examples/2-titles_in_line_numbering_with_notes.pdf +++ b/macros/latex/contrib/reledmac/examples/2-titles_in_line_numbering_with_notes.pdf diff --git a/macros/latex/contrib/reledmac/examples/2-titles_not_in_line_numbering.pdf b/macros/latex/contrib/reledmac/examples/2-titles_not_in_line_numbering.pdf Binary files differindex 8fb7815549..26ec158089 100644 --- a/macros/latex/contrib/reledmac/examples/2-titles_not_in_line_numbering.pdf +++ b/macros/latex/contrib/reledmac/examples/2-titles_not_in_line_numbering.pdf diff --git a/macros/latex/contrib/reledmac/examples/3-reledpar_columns_different_languages.pdf b/macros/latex/contrib/reledmac/examples/3-reledpar_columns_different_languages.pdf Binary files differindex cd60587a70..595db9ad5f 100644 --- a/macros/latex/contrib/reledmac/examples/3-reledpar_columns_different_languages.pdf +++ b/macros/latex/contrib/reledmac/examples/3-reledpar_columns_different_languages.pdf diff --git a/macros/latex/contrib/reledmac/examples/3-reledpar_mwe.pdf b/macros/latex/contrib/reledmac/examples/3-reledpar_mwe.pdf Binary files differindex bd7d288890..033bd89660 100644 --- a/macros/latex/contrib/reledmac/examples/3-reledpar_mwe.pdf +++ b/macros/latex/contrib/reledmac/examples/3-reledpar_mwe.pdf diff --git a/macros/latex/contrib/reledmac/examples/3-reledpar_pages_different_languages_lualatex.pdf b/macros/latex/contrib/reledmac/examples/3-reledpar_pages_different_languages_lualatex.pdf Binary files differindex a036d76974..cd38fbfd95 100644 --- a/macros/latex/contrib/reledmac/examples/3-reledpar_pages_different_languages_lualatex.pdf +++ b/macros/latex/contrib/reledmac/examples/3-reledpar_pages_different_languages_lualatex.pdf diff --git a/macros/latex/contrib/reledmac/examples/3-reledpar_same_page_number_in_both_side.pdf b/macros/latex/contrib/reledmac/examples/3-reledpar_same_page_number_in_both_side.pdf Binary files differindex 526eab6028..0a9fe7c53e 100644 --- a/macros/latex/contrib/reledmac/examples/3-reledpar_same_page_number_in_both_side.pdf +++ b/macros/latex/contrib/reledmac/examples/3-reledpar_same_page_number_in_both_side.pdf diff --git a/macros/latex/contrib/reledmac/examples/3-reledpar_sync_setting_advancedshifted-nomax.pdf b/macros/latex/contrib/reledmac/examples/3-reledpar_sync_setting_advancedshifted-nomax.pdf Binary files differindex 2ea055f0e6..d17c1ac8f1 100644 --- a/macros/latex/contrib/reledmac/examples/3-reledpar_sync_setting_advancedshifted-nomax.pdf +++ b/macros/latex/contrib/reledmac/examples/3-reledpar_sync_setting_advancedshifted-nomax.pdf diff --git a/macros/latex/contrib/reledmac/examples/3-reledpar_sync_setting_advancedshifted.pdf b/macros/latex/contrib/reledmac/examples/3-reledpar_sync_setting_advancedshifted.pdf Binary files differindex 84fa9f70ee..c0bbca8579 100644 --- a/macros/latex/contrib/reledmac/examples/3-reledpar_sync_setting_advancedshifted.pdf +++ b/macros/latex/contrib/reledmac/examples/3-reledpar_sync_setting_advancedshifted.pdf diff --git a/macros/latex/contrib/reledmac/examples/3-reledpar_sync_setting_default.pdf b/macros/latex/contrib/reledmac/examples/3-reledpar_sync_setting_default.pdf Binary files differindex 9074228adc..49afdc60c5 100644 --- a/macros/latex/contrib/reledmac/examples/3-reledpar_sync_setting_default.pdf +++ b/macros/latex/contrib/reledmac/examples/3-reledpar_sync_setting_default.pdf diff --git a/macros/latex/contrib/reledmac/examples/3-reledpar_sync_setting_nomax-shifted.pdf b/macros/latex/contrib/reledmac/examples/3-reledpar_sync_setting_nomax-shifted.pdf Binary files differindex 47e23321e1..1ec7968e16 100644 --- a/macros/latex/contrib/reledmac/examples/3-reledpar_sync_setting_nomax-shifted.pdf +++ b/macros/latex/contrib/reledmac/examples/3-reledpar_sync_setting_nomax-shifted.pdf diff --git a/macros/latex/contrib/reledmac/examples/3-reledpar_sync_setting_nomax.pdf b/macros/latex/contrib/reledmac/examples/3-reledpar_sync_setting_nomax.pdf Binary files differindex 9615eca582..267dfe8114 100644 --- a/macros/latex/contrib/reledmac/examples/3-reledpar_sync_setting_nomax.pdf +++ b/macros/latex/contrib/reledmac/examples/3-reledpar_sync_setting_nomax.pdf diff --git a/macros/latex/contrib/reledmac/examples/3-reledpar_sync_setting_nosync.pdf b/macros/latex/contrib/reledmac/examples/3-reledpar_sync_setting_nosync.pdf Binary files differindex c45fd43eda..4deba4efeb 100644 --- a/macros/latex/contrib/reledmac/examples/3-reledpar_sync_setting_nosync.pdf +++ b/macros/latex/contrib/reledmac/examples/3-reledpar_sync_setting_nosync.pdf diff --git a/macros/latex/contrib/reledmac/examples/3-reledpar_sync_setting_shifted.pdf b/macros/latex/contrib/reledmac/examples/3-reledpar_sync_setting_shifted.pdf Binary files differindex 4ee71747c2..5ab2e7e3f1 100644 --- a/macros/latex/contrib/reledmac/examples/3-reledpar_sync_setting_shifted.pdf +++ b/macros/latex/contrib/reledmac/examples/3-reledpar_sync_setting_shifted.pdf diff --git a/macros/latex/contrib/reledmac/examples/4-reledpar_column_mix_with_not_column-continuous-numbering.pdf b/macros/latex/contrib/reledmac/examples/4-reledpar_column_mix_with_not_column-continuous-numbering.pdf Binary files differindex d11ecdce7c..bec579ad90 100644 --- a/macros/latex/contrib/reledmac/examples/4-reledpar_column_mix_with_not_column-continuous-numbering.pdf +++ b/macros/latex/contrib/reledmac/examples/4-reledpar_column_mix_with_not_column-continuous-numbering.pdf diff --git a/macros/latex/contrib/reledmac/examples/4-reledpar_column_mix_with_not_column.pdf b/macros/latex/contrib/reledmac/examples/4-reledpar_column_mix_with_not_column.pdf Binary files differindex 07b85c0036..6f2b389507 100644 --- a/macros/latex/contrib/reledmac/examples/4-reledpar_column_mix_with_not_column.pdf +++ b/macros/latex/contrib/reledmac/examples/4-reledpar_column_mix_with_not_column.pdf diff --git a/macros/latex/contrib/reledmac/examples/4-reledpar_columns_alignment.pdf b/macros/latex/contrib/reledmac/examples/4-reledpar_columns_alignment.pdf Binary files differindex eb9a8e2aa3..471e042ef0 100644 --- a/macros/latex/contrib/reledmac/examples/4-reledpar_columns_alignment.pdf +++ b/macros/latex/contrib/reledmac/examples/4-reledpar_columns_alignment.pdf diff --git a/macros/latex/contrib/reledmac/examples/4-reledpar_columns_titles_in_line_numbering_with_notes.pdf b/macros/latex/contrib/reledmac/examples/4-reledpar_columns_titles_in_line_numbering_with_notes.pdf Binary files differindex ea0ed3234b..d7410052fa 100644 --- a/macros/latex/contrib/reledmac/examples/4-reledpar_columns_titles_in_line_numbering_with_notes.pdf +++ b/macros/latex/contrib/reledmac/examples/4-reledpar_columns_titles_in_line_numbering_with_notes.pdf diff --git a/macros/latex/contrib/reledmac/examples/4-reledpar_inside-outside-columns.pdf b/macros/latex/contrib/reledmac/examples/4-reledpar_inside-outside-columns.pdf Binary files differindex 5a3661bc4e..b5f3b61ae0 100644 --- a/macros/latex/contrib/reledmac/examples/4-reledpar_inside-outside-columns.pdf +++ b/macros/latex/contrib/reledmac/examples/4-reledpar_inside-outside-columns.pdf diff --git a/macros/latex/contrib/reledmac/examples/4-reledpar_one_series_per_pstart.pdf b/macros/latex/contrib/reledmac/examples/4-reledpar_one_series_per_pstart.pdf Binary files differindex f4978b8e85..58e1fa96d2 100644 --- a/macros/latex/contrib/reledmac/examples/4-reledpar_one_series_per_pstart.pdf +++ b/macros/latex/contrib/reledmac/examples/4-reledpar_one_series_per_pstart.pdf diff --git a/macros/latex/contrib/reledmac/examples/4-reledpar_pages_long_notes.pdf b/macros/latex/contrib/reledmac/examples/4-reledpar_pages_long_notes.pdf Binary files differindex edda5a1570..f1e920079c 100644 --- a/macros/latex/contrib/reledmac/examples/4-reledpar_pages_long_notes.pdf +++ b/macros/latex/contrib/reledmac/examples/4-reledpar_pages_long_notes.pdf diff --git a/macros/latex/contrib/reledmac/examples/4-reledpar_pages_notes_leftpage.pdf b/macros/latex/contrib/reledmac/examples/4-reledpar_pages_notes_leftpage.pdf Binary files differindex 0a5a91ac26..80d084ea17 100644 --- a/macros/latex/contrib/reledmac/examples/4-reledpar_pages_notes_leftpage.pdf +++ b/macros/latex/contrib/reledmac/examples/4-reledpar_pages_notes_leftpage.pdf diff --git a/macros/latex/contrib/reledmac/examples/4-reledpar_pages_paragraph_separator_between.pdf b/macros/latex/contrib/reledmac/examples/4-reledpar_pages_paragraph_separator_between.pdf Binary files differindex 0b67d713d5..527331fa0b 100644 --- a/macros/latex/contrib/reledmac/examples/4-reledpar_pages_paragraph_separator_between.pdf +++ b/macros/latex/contrib/reledmac/examples/4-reledpar_pages_paragraph_separator_between.pdf diff --git a/macros/latex/contrib/reledmac/examples/4-reledpar_pages_titles_in_line_numbering_with_notes.pdf b/macros/latex/contrib/reledmac/examples/4-reledpar_pages_titles_in_line_numbering_with_notes.pdf Binary files differindex 20724af5b3..79a4d85b83 100644 --- a/macros/latex/contrib/reledmac/examples/4-reledpar_pages_titles_in_line_numbering_with_notes.pdf +++ b/macros/latex/contrib/reledmac/examples/4-reledpar_pages_titles_in_line_numbering_with_notes.pdf diff --git a/macros/latex/contrib/reledmac/examples/4-reledpar_titles_not_in_line_numbering.pdf b/macros/latex/contrib/reledmac/examples/4-reledpar_titles_not_in_line_numbering.pdf Binary files differindex 8fb2a74cb2..84a04f5278 100644 --- a/macros/latex/contrib/reledmac/examples/4-reledpar_titles_not_in_line_numbering.pdf +++ b/macros/latex/contrib/reledmac/examples/4-reledpar_titles_not_in_line_numbering.pdf diff --git a/macros/latex/contrib/reledmac/examples/4-reledpar_verse_text_between.pdf b/macros/latex/contrib/reledmac/examples/4-reledpar_verse_text_between.pdf Binary files differindex 972199e49d..2fbe4f7db8 100644 --- a/macros/latex/contrib/reledmac/examples/4-reledpar_verse_text_between.pdf +++ b/macros/latex/contrib/reledmac/examples/4-reledpar_verse_text_between.pdf diff --git a/macros/latex/contrib/reledmac/examples/makefile b/macros/latex/contrib/reledmac/examples/makefile index 6ab0cfccf3..ebb0f728ba 100644 --- a/macros/latex/contrib/reledmac/examples/makefile +++ b/macros/latex/contrib/reledmac/examples/makefile @@ -24,7 +24,7 @@ PDF:$(OBJ) latexmk --xelatex $< 2-reledmac-right-to-left.pdf: 2-reledmac-right-to-left.tex - latexmk --xelatex $< + latexmk --lualatex $< clean: @$(RM) *pdf *toc *.1* *.2* *.3* *.4* *.5* *.6* *.7* *.8* *.9* *.eledsec* *.Aend* *.Bend* *.fls* *.xdv* *.glg* *.glo* *.gls* *.ist* *.log *.fdb_latexmk *.aux *.end *.ilg *.ind *.idx *.out *.synctex.gz *.synctex.gz\(busy\) diff --git a/macros/latex/contrib/reledmac/migration.pdf b/macros/latex/contrib/reledmac/migration.pdf Binary files differindex 7bb32f83fa..9aa00f694a 100644 --- a/macros/latex/contrib/reledmac/migration.pdf +++ b/macros/latex/contrib/reledmac/migration.pdf diff --git a/macros/latex/contrib/reledmac/reledmac.dtx b/macros/latex/contrib/reledmac/reledmac.dtx index a5b00a144a..416894fb73 100644 --- a/macros/latex/contrib/reledmac/reledmac.dtx +++ b/macros/latex/contrib/reledmac/reledmac.dtx @@ -591,6 +591,9 @@ % \changes{v2.38.2}{2021/11/03}{Fix some trouble in indentation in stanza, when switching to some language with \protect\package{polyglossia}.} % \changes{v2.39.0}{2021/01/11}{Add \protect\cs{Xnotboxingsubline} and \protect\cs{Xendnotboxingsubline} hooks.} % \changes{v2.39.1}{2021/02/04}{Fix bug with index in familiar and critical footnotes.} +% \changes{v2.39.2}{2023/07/04}{Fix bug with \protect\cs{edlabel} in \protect\cs{eledsection} and related.} +% \changes{v2.39.2}{2022/07/04}{Fix bug with with \protect\option{continuousnumberingwithcolumns} when right column starts a new page and we use lineation by page.} +% \changes{v2.39.2}{2022/07/04}{Tools for \protect\parpackage v2.25.4} % Typeset scholarly editions with \LaTeX\thanks{This file (\dtxfilename) % has version number \fileversion, last revised \filedate.}} % @@ -4503,7 +4506,7 @@ % \begin{macrocode} %<*code> \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{reledmac}[2022/02/04 v2.39.1 typesetting critical editions]% +\ProvidesPackage{reledmac}[2023/07/04 v2.39.2 typesetting critical editions]% % \end{macrocode} % % \subsection{Package options} @@ -6745,6 +6748,7 @@ \@page{#1}% \ifledRcol% \@nl@regR% + \csnumgdef{@page@forlineR@\the\section@numR @\the\absline@numR}{#1}% \else% \@nl@reg% \fi% @@ -6834,10 +6838,16 @@ \csnumgdef{@lastline@forpageR@\the\page@numR}{\the\line@numR}% \csnumgdef{@lastsubline@forpageR@\the\page@numR}{\the\subline@numR}% \ifbypage@R + \letcs{\prevsection@last@page@num}{last@page@num@\the\numexpr\section@num-1\relax}% + \ifundef{\prevsection@last@page@num}{\def\prevsection@last@page@num{-999}}{}% \ifx\l@dchset@num\relax%Not resetting if preceded by a \setlinenum \ifboolexpr{% (bool{continuousnumberingwithcolumns} or bool{resumenumberingR@start})% and test {\ifnumequal{\last@page@numR}{-10000}}% + and not (% + bool{continuousnumberingwithcolumns}% + and test {\ifnumcomp{\prevsection@last@page@num}{<}{#1}}% + )% }% {}% {% @@ -6871,7 +6881,8 @@ \global\this@section@page@num=#1% \last@page@num=#1% \global\this@section@last@page@num=#1% - \def\next@page@num{#1}% + \global\csdef{last@page@num@\the\section@num}{#1}% + \gdef\next@page@num{#1}% % \end{macrocode} % And we set a flag that tells \cs{@nl} that a new page number is % to be set, because other associated actions shouldn't occur until the @@ -9393,7 +9404,7 @@ % % \subsubsection{Process for \enquote{normal} line} % \begin{macro}{\print@line} -% \changes{v1.13.1}{2014/09/25}{Coming back of add@penalties, mistakenly deleted in version 0.17!} +% \changes{v1.13.1}{2014/09/25}{Coming back of \protect\cs{add@penalties}, mistakenly deleted in version 0.17.} % \changes{v1.18.0}{2015/02/23}{Compatibility with \LuaLaTeX\ RTL languages.} % \protect\cs{print@line} is for normal line, i. e line without sectioning command. % \begin{macrocode} @@ -9491,6 +9502,7 @@ % \begin{macrocode} \def\print@eledsection{% \disable@edindex% + \disable@edlabel% \if@firstlineofpage% \set@Xtxtbeforenotes% \set@txtbeforenotesX% @@ -9522,6 +9534,7 @@ \vskip-\baselineskip% \continuousnumberingwithcolumns@sync@linenumber@singletext% \restore@edindex% + \restore@edlabel% } % \end{macrocode} % \end{macro} @@ -20340,17 +20353,21 @@ % \end{macro} % \end{macro} % -% \begin{macro}{\EDLABEL} -% \begin{macro}{\xedlabel} +% \begin{macro}{\disable@edlabel} +% \begin{macro}{\restore@edlabel} % We need to be able to modify and restore the \protect\cs{edlabel} macro. % \begin{macrocode} -\let\EDLABEL=\edlabel -\newcommand*{\xedlabel}[1]{\EDLABEL{#1}} +\newcommand{\disable@edlabel}{% + \global\let\old@edlabel\edlabel% + \global\let\edlabel\@gobble% +}% +\newcommand{\restore@edlabel}{% + \global\let\edlabel\old@edlabel% +}% % \end{macrocode} % \end{macro} % \end{macro} % -% % \begin{macro}{\xedindex} % \begin{macro}{\nulledindex} % Macros supporting modification and restoration of \protect\cs{edindex}. @@ -20403,7 +20420,8 @@ \let\edtext\relax \def\do##1{\global\csletcs{##1footnote}{l@dgobbleoptarg}}% \dolistloop{\@series}% - \let\edindex\nulledindex + \let\edindex\nulledinde% + \disable@edlabel% \let\linenum\@gobble} \newcommand{\l@drestoreforedtext}{% \def\do##1{\global\csletcs{##1footnote}{##1@@footnote}} @@ -20441,8 +20459,8 @@ \let\linenum\@line@@num \hilfsskip=\l@dcolwidth% \advance\hilfsskip by -\wd\hilfsbox - \def\edlabel##1{\xedlabel{##1}}} - + \restore@edlabel% +}% % \end{macrocode} % \end{macro} % \begin{macro}{\disablel@dtabfeet} diff --git a/macros/latex/contrib/reledmac/reledmac.pdf b/macros/latex/contrib/reledmac/reledmac.pdf Binary files differindex 4bf3db4261..5dad2b6ea2 100644 --- a/macros/latex/contrib/reledmac/reledmac.pdf +++ b/macros/latex/contrib/reledmac/reledmac.pdf diff --git a/macros/latex/contrib/reledmac/reledpar.dtx b/macros/latex/contrib/reledmac/reledpar.dtx index b2f8fb7d88..081ba44c16 100644 --- a/macros/latex/contrib/reledmac/reledpar.dtx +++ b/macros/latex/contrib/reledmac/reledpar.dtx @@ -351,6 +351,7 @@ % \changes{v2.25.1}{2021/01/21}{\protect\cs{ifsublines@R} migrated to \protect\macpackage} % \changes{v2.25.2}{2021/09/27}{Fix incompatibility with \protect\package{babel} v3.61} % \changes{v2.25.3}{2022/04/22}{Fix incompatibility with \protect\package{polyglossia} v1.55} +% \changes{v2.25.4}{2023/07/04}{Fix bug with \protect\cs{linenumOnlyPagesForColumnsR} and multiple numbered sections} % ^^A PW added following as the definitions are at some unknown elsewhere % % \newcommand{\egstart}{% @@ -1407,7 +1408,7 @@ % \begin{macrocode} %<*code> \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{reledpar}[2022/04/22 v2.25.3 reledmac extension for parallel texts]% +\ProvidesPackage{reledpar}[2023/07/04 v2.25.4 reledmac extension for parallel texts]% % \end{macrocode} % \subsection{Package's requirement} @@ -4657,17 +4658,17 @@ {\@l@dtempcntb=\line@margin@columnsR}% {\@l@dtempcntb=\line@marginR}% \ifnum\@l@dtempcntb>\@ne - \advance\@l@dtempcntb by\page@numR + \advance\@l@dtempcntb by \numexpr\csuse{@page@forlineR@\the\section@numR @\the\absline@numR}+0\relax% \fi \ifboolexpr{% bool {l@dprintingcolumns}% and (% (test {\ifdefstring{\linenum@OnlyPages@ForColumnsR}{left}}% - and test {\ifnumodd{\page@numR}}% + and test {\ifnumodd{\csuse{@page@forlineR@\the\section@numR @\the\absline@numR}+0}}% )% or% (test {\ifdefstring{\linenum@OnlyPages@ForColumnsR}{right}}% - and not test {\ifnumodd{\page@numR}}% + and not test {\ifnumodd{\csuse{@page@forlineR@\the\section@numR @\the\absline@numR}+0}}% )% )% }% diff --git a/macros/latex/contrib/reledmac/reledpar.pdf b/macros/latex/contrib/reledmac/reledpar.pdf Binary files differindex 5749dd6b44..19ca6cadca 100644 --- a/macros/latex/contrib/reledmac/reledpar.pdf +++ b/macros/latex/contrib/reledmac/reledpar.pdf diff --git a/macros/latex/contrib/se2thesis/CHANGELOG.md b/macros/latex/contrib/se2thesis/CHANGELOG.md index 96e937e109..a7a887addf 100644 --- a/macros/latex/contrib/se2thesis/CHANGELOG.md +++ b/macros/latex/contrib/se2thesis/CHANGELOG.md @@ -7,6 +7,19 @@ and this project adheres to ## [Unreleased] +## [v3.1.0] – 2023–07–04 + +### Changed + +- The `lua-widow-control` package causes build failures in different settings, + although the same TeX Live version is used. Until this can be resolved, we + deactivate the loading of this package from `se2packages` by default. It can + still be activated manually by adding the `widowcontrol=true` option to the + `se2packages` package. +- Set penalties for widows and orphans only if `lua-widow-control` package is + not loaded. +- Change the formatting of chapter headings. + ## [v3.0.0] – 2023–04–18 ### Added @@ -124,6 +137,7 @@ These changes might be breaking changes! ### Added - First official release +[v3.1.0]: https://github.com/se2p/se2thesis/compare/v3.1.0...v3.0.0 [v3.0.0]: https://github.com/se2p/se2thesis/compare/v3.0.0...v2.1.0 [v2.1.0]: https://github.com/se2p/se2thesis/compare/v2.1.0...v2.0.0 [v2.0.0]: https://github.com/se2p/se2thesis/compare/v2.0.0...v1.3.1 diff --git a/macros/latex/contrib/se2thesis/se2colors.dtx b/macros/latex/contrib/se2thesis/se2colors.dtx index bf2af3728f..8b4f738c8c 100644 --- a/macros/latex/contrib/se2thesis/se2colors.dtx +++ b/macros/latex/contrib/se2thesis/se2colors.dtx @@ -231,7 +231,7 @@ % % Identify the package and give the overall version information. % \begin{macrocode} -\ProvidesExplPackage {se2colors} {2023-04-18} {3.0.0} +\ProvidesExplPackage {se2colors} {2023-07-04} {3.1.0} {A colour support package for the se2thesis bundle} % \end{macrocode} % diff --git a/macros/latex/contrib/se2thesis/se2fonts.dtx b/macros/latex/contrib/se2thesis/se2fonts.dtx index dccb8420b1..09e2351a94 100644 --- a/macros/latex/contrib/se2thesis/se2fonts.dtx +++ b/macros/latex/contrib/se2thesis/se2fonts.dtx @@ -159,7 +159,7 @@ % % Identify the package and give the overall version information. % \begin{macrocode} -\ProvidesExplPackage {se2fonts} {2023-04-18} {3.0.0} +\ProvidesExplPackage {se2fonts} {2023-07-04} {3.1.0} {A font-selection support package for the se2thesis bundle} % \end{macrocode} % diff --git a/macros/latex/contrib/se2thesis/se2packages.dtx b/macros/latex/contrib/se2thesis/se2packages.dtx index 319bbfeed1..1e987c3575 100644 --- a/macros/latex/contrib/se2thesis/se2packages.dtx +++ b/macros/latex/contrib/se2thesis/se2packages.dtx @@ -162,6 +162,11 @@ % The former implements a better control over ligatures, % the latter provides better control over orphans and widows. % +% For some reason we were not yet able to fix properly, +% \pkg{lua-widow-control} works on some machine but fails on others, +% although they are using the same version of \TeXLive. +% We therefore deactivate \pkg{lua-widow-control} by default. +% % \subsubsection{Use \pkg{microtype} for Microtypographic Optimisation} % % \pkg{microtype} is a game changer when writing documents. @@ -299,8 +304,8 @@ % |nowidowcontrol| % \end{syntax} % The argument to |widowcontrol| can be one of |true| or |false|. -% The latter does not load \pkg{lua-widow-control}, -% the former is the default value. +% The former loads \pkg{lua-widow-control}, +% the latter is the default value. % By using |nowidowcontrol| you can also avoid % that \pkg{lua-widow-control} is loaded. % \end{function} @@ -426,7 +431,7 @@ % % Identify the package and give the overall version information. % \begin{macrocode} -\ProvidesExplPackage {se2packages} {2023-04-18} {3.0.0} +\ProvidesExplPackage {se2packages} {2023-07-04} {3.1.0} {Supporting packages for the se2thesis bundle} % \end{macrocode} % @@ -541,7 +546,7 @@ noselnolig .meta:n = {selnolig=false}, widowcontrol .bool_gset:N = \l_@@_luawidowcontrol_bool, - widowcontrol .initial:n = true, + widowcontrol .initial:n = false, nowidowcontrol .meta:n = {widowcontrol=false}, microtype .bool_gset:N = \l_@@_microtype_bool, @@ -727,14 +732,20 @@ % \end{macrocode} % % Conditionally load and configure \pkg{microtype}. +% If a package option requires for the \pkg{lua-widow-control} package, +% we do not set penalties for widows and orphans +% but let that package control these penalties. % \begin{macrocode} \bool_if:NT \l_@@_microtype_bool { \msg_info:nnn { seiipackages } { load-package } { microtype } \RequirePackage{microtype} - \clubpenalty=10000 - \widowpenalty=10000 - \displaywidowpenalty=10000 + \bool_if:NF \l_@@_luawidowcontrol_bool + { + \clubpenalty=10000 + \widowpenalty=10000 + \displaywidowpenalty=10000 + } \SetExtraKerning{ encoding = {OT1,T1,T2A,LY1,OT4,QX,T5,TS1,EU1,EU2} }{ diff --git a/macros/latex/contrib/se2thesis/se2thesis-master-thesis-example.pdf b/macros/latex/contrib/se2thesis/se2thesis-master-thesis-example.pdf Binary files differindex df38c24126..8cb95d80c3 100644 --- a/macros/latex/contrib/se2thesis/se2thesis-master-thesis-example.pdf +++ b/macros/latex/contrib/se2thesis/se2thesis-master-thesis-example.pdf diff --git a/macros/latex/contrib/se2thesis/se2thesis-master-thesis-example.tex b/macros/latex/contrib/se2thesis/se2thesis-master-thesis-example.tex index da47aaa56e..106aa4b541 100644 --- a/macros/latex/contrib/se2thesis/se2thesis-master-thesis-example.tex +++ b/macros/latex/contrib/se2thesis/se2thesis-master-thesis-example.tex @@ -1,5 +1,5 @@ \documentclass[% - chapterprefix=true,% + chapterprefix=false,% open=right,% twoside=true,% paper=a4,% diff --git a/macros/latex/contrib/se2thesis/se2thesis.dtx b/macros/latex/contrib/se2thesis/se2thesis.dtx index 8826356f6c..9e04544bab 100644 --- a/macros/latex/contrib/se2thesis/se2thesis.dtx +++ b/macros/latex/contrib/se2thesis/se2thesis.dtx @@ -589,7 +589,7 @@ % % Identify the class and give the overall version number. % \begin{macrocode} -\ProvidesExplClass {se2thesis} {2023-04-18} {3.0.0} +\ProvidesExplClass {se2thesis} {2023-07-04} {3.1.0} {A thesis class for the Chair of Software Engineering II} % \end{macrocode} % @@ -1349,11 +1349,16 @@ \addtokomafont{section}{\large\mdseries} \addtokomafont{subsection}{\normalsize\mdseries} \renewcommand*{\chapterformat}{% - \mbox{% - \scalebox{1.3}{\chapappifchapterprefix{\nobreakspace}}% - \scalebox{3.5}{\color{UPSE2-Gray}\thechapter\autodot}\enskip% + \enskip\mbox{% + \scalebox{3}{\color{UPSE2-DarkGray}\thechapter\autodot}% }% } +\renewcommand{\chapterlinesformat}[3]{% + \parbox[b]{\textwidth}{\hrulefill#2}\par% + #3\par\bigskip% + \hrule% +} +\RedeclareSectionCommand[afterskip=1.5\baselineskip]{chapter} \renewcommand*{\chapterlineswithprefixformat}[3]{% \Ifstr{#1}{chapter} {#2\textls*[75]{\MakeUppercase{#3}}}% change definition for chapter @@ -1610,7 +1615,7 @@ % We provide the following English translations. % % \begin{macrocode} -\ProvideDictionaryFor{English}{se2translations}[2023/04/18] +\ProvideDictionaryFor{English}{se2translations}[2023/07/04] \ProvideDictTranslation{abstract}{abstract} \ProvideDictTranslation{Abstract}{Abstract} \ProvideDictTranslation{acknowledgement}{acknowledgement} @@ -1661,7 +1666,7 @@ % We provide the following German translations. % % \begin{macrocode} -\ProvideDictionaryFor{German}{se2translations}[2023/04/18] +\ProvideDictionaryFor{German}{se2translations}[2023/07/04] \ProvideDictTranslation{abstract}{Zusammenfassung} \ProvideDictTranslation{Abstract}{Zusammenfassung} \ProvideDictTranslation{acknowledgement}{Danksagung} diff --git a/macros/latex/contrib/se2thesis/se2thesis.pdf b/macros/latex/contrib/se2thesis/se2thesis.pdf Binary files differindex dd2d5278ec..04e910061f 100644 --- a/macros/latex/contrib/se2thesis/se2thesis.pdf +++ b/macros/latex/contrib/se2thesis/se2thesis.pdf diff --git a/macros/latex/contrib/tugboat/NEWS b/macros/latex/contrib/tugboat/NEWS index aa1e53391e..53621cccdc 100644 --- a/macros/latex/contrib/tugboat/NEWS +++ b/macros/latex/contrib/tugboat/NEWS @@ -1,6 +1,19 @@ -$Id: NEWS 463 2023-03-08 21:59:19Z karl $ +$Id: NEWS 490 2023-07-03 22:27:49Z karl $ This file records noteworthy changes. This file is public domain. +ltugboat.cls: +- print page numbers with preceding ? in draft mode, including in references, + by redefining \thepage. +- new abbrev \XMP. + +tugboat.bst: +- for webpage entry type, do not output random material in brackets. +- new field "monthtie" to editorially force a tie after the month. + +ltubguid documentation: +- mention preferred placement of captions, namely below figures +but above tables and listings. + ----------------- 2.29 (2023-03-08): diff --git a/macros/latex/contrib/tugboat/ltubguid.ltx b/macros/latex/contrib/tugboat/ltubguid.ltx index 7d15fd9c6c..088a8e19af 100644 --- a/macros/latex/contrib/tugboat/ltubguid.ltx +++ b/macros/latex/contrib/tugboat/ltubguid.ltx @@ -1,4 +1,4 @@ -% $Id: ltubguid.ltx 458 2023-01-16 18:44:30Z karl $ +% $Id: ltubguid.ltx 487 2023-06-22 22:39:59Z karl $ % ltubguid.ltx - documentation for ltugboat classes. % % Copyright 1994-2023 TeX Users Group. @@ -571,25 +571,18 @@ normal text size. \section{Floating inserts} -The classes do not make any change to \LaTeX{}'s built-in provision -for floating inserts, so that authors may generate figures and tables -just as they would in any `normal' \LaTeX{} document. Figure and -table captions, and labels referring to them, are also substantially -untouched. - -However, since both classes typeset in two columns, authors must -distinguish between the \envname{figure} and \envname{table} environments -(which produce floats that are the same width as the column) and the -\envname{figure*} and \envname{table*} (which produce floats that are the same -width as the page). - -%\begin{itemize} -%\item figures and tables as normal -%\item captions and labels work whatever (i.e., no restriction on -% numbering) -%\item twocolumn setting implies distinction between \envname{figure} and -% \envname{figure*} -%\end{itemize} +The classes do not make any change to \LaTeX{}'s built-in provision for +floating inserts, so that authors may write figures and tables as usual, + +The default is for floats to be the width of the column. To make a float +which is the width of the whole page, use \envname{figure*} and +\envname{table*}. + +Regarding caption placement, \TUB's convention is to put captions for +figures beneath the figure, but captions for tables and listings above +the table\slash listing. Please follow this convention unless there is a +specific reason not to. As a reminder, \cs{label} commands should always +follow the \cs{caption}. \section{Special-purpose typesetting} @@ -830,16 +823,16 @@ aliases for \textsf{@misc}. \CTAN, following the fields output by the \pkgname{ctanbib} script (in the package of the same name, \url{ctan.org/pkg/ctanbib}). -\item For completeness only: \verb|tugboat.bst| provides editor-intended -fields \textsf{journaltie} to output a tie instead of space after the \textsf{journal} value, +\item For completeness only: \verb|tugboat.bst| provides several +fields intended to be used by the editors: \textsf{journaltie} to output +a tie instead of space after the \textsf{journal} value, +\textsf{monthtie} for the same after \textsf{month}, \textsf{newpage} to force a page break after the current item, -\textsf{nowarning} to omit empty field warnings, -\textsf{prebibitem} to output material before \cs{bibitem} (e.g., a -section heading), and +\textsf{nowarning} to omit empty field warnings, \textsf{prebibitem} to +output material before \cs{bibitem} (e.g., a section heading), and \textsf{urlnewline} to force a line break before the \textsf{url} value. -As editors, we've found that these presentation -tweaks can be desirable for the final typeset output. Authors need not -worry about them. +As editors, we've found that these presentation tweaks can be desirable +for the final typeset output. Authors need not worry about them. \end{itemize} diff --git a/macros/latex/contrib/tugboat/ltubguid.pdf b/macros/latex/contrib/tugboat/ltubguid.pdf Binary files differindex 3d39af7dad..5d4df0b38f 100644 --- a/macros/latex/contrib/tugboat/ltubguid.pdf +++ b/macros/latex/contrib/tugboat/ltubguid.pdf diff --git a/macros/latex/contrib/tugboat/tugboat.pdf b/macros/latex/contrib/tugboat/tugboat-code.pdf Binary files differindex fc6500607f..2c5c124fa8 100644 --- a/macros/latex/contrib/tugboat/tugboat.pdf +++ b/macros/latex/contrib/tugboat/tugboat-code.pdf diff --git a/macros/latex/contrib/tugboat/tugboat.bst b/macros/latex/contrib/tugboat/tugboat.bst index 1129bb8ab5..403256d1a4 100644 --- a/macros/latex/contrib/tugboat/tugboat.bst +++ b/macros/latex/contrib/tugboat/tugboat.bst @@ -1,4 +1,4 @@ -%%% $Id: tugboat.bst 462 2023-03-08 17:26:54Z karl $ +%%% $Id: tugboat.bst 487 2023-06-22 22:39:59Z karl $ %%% TUGboat changes are public domain. %%% %%% Modified for TUGboat from abbrvurl.bst: @@ -28,7 +28,7 @@ %%% "nowarning" - if set, omit empty field warnings from output.check. %%% "prebibitem" - material output before \bibitem, with newline appended %%% (for example, section headings). -%%% "urlnewline" - force line break before url value; +%%% "urlnewline" - force line break before url or doi value; %%% --karl, originally created 24jul18. %%% %%% Modification of BibTeX style file /usr/local/texlive/2009/texmf-dist/bibtex/bst/base/abbrv.bst @@ -85,6 +85,7 @@ ENTRY version % ctan % journaltie % tub + monthtie % tub newpage % tub nowarning % tub prebibitem % tub @@ -189,9 +190,10 @@ FUNCTION {output.nonnull.original} { last.output.check "journal" = not { ", " * } { journaltie empty$ not - { "~" * } - { " " * } + { "~" } + { " " } if$ + * } if$ write$ @@ -350,10 +352,18 @@ FUNCTION {output.bibitem.original} % urlbst (renamed from output.bibitem, so it before.all 'output.state := } -FUNCTION {fin.entry.original} % urlbst (renamed from fin.entry, so it can be wrapped below) +% we wrap this function below to handle urls. +% The url string to print (of whatever sort) is on the stack to write$. +% If the `urlnewline' field is set, write "\newline" first. +FUNCTION {fin.entry.original} % urlbst (renamed from fin.entry) { doi empty$ url empty$ and { add.period$ } - { skip$ } + { + urlnewline empty$ not + { "\newline " write$ } + 'skip$ + if$ + } if$ write$ newline$ @@ -600,7 +610,14 @@ FUNCTION {format.date} } { month empty$ 'year - { month " " * year * } + { month + monthtie empty$ not + { "~" } + { " " } + if$ + * + year * + } if$ } if$ @@ -1033,17 +1050,11 @@ FUNCTION {format.doi} % so that `format.url format.lastchecked * output' ends up with both % the URL and the lastchecked in brackets. % -% If the `urlnewline' field is present, output \newline before the -% url value. FUNCTION {output.url} { url empty$ 'skip$ { new.block format.url output - urlnewline empty$ not - { "\newline " write$ } - 'skip$ - if$ format.lastchecked output } if$ @@ -1108,10 +1119,10 @@ FUNCTION {fin.entry} % Title and url fields required; % author, note, year, month, and lastchecked fields optional % See references -% ISO 690-2 http://www.nlc-bnc.ca/iso/tc46sc9/standard/690-2e.htm -% http://www.classroom.net/classroom/CitingNetResources.html -% http://neal.ctstateu.edu/history/cite.html -% http://www.cas.usf.edu/english/walker/mla.html +% [gone] ISO 690-2 http://www.nlc-bnc.ca/iso/tc46sc9/standard/690-2e.htm +% [gone] http://www.classroom.net/classroom/CitingNetResources.html +% [gone] http://neal.ctstateu.edu/history/cite.html +% [gone] http://www.cas.usf.edu/english/walker/mla.html % for citation formats for web pages. FUNCTION {webpage} { output.bibitem @@ -1130,7 +1141,8 @@ FUNCTION {webpage} new.block title empty$ 'skip$ 'possibly.setup.inlinelink if$ format.title "title" output.check - inbrackets onlinestring output + % This causes the year to be output in brackets, which we don't want: + % inbrackets onlinestring output new.block year empty$ 'skip$ diff --git a/macros/latex/contrib/tugboat/tugboat.dtx b/macros/latex/contrib/tugboat/tugboat.dtx index ea7f22af77..a4b558b158 100644 --- a/macros/latex/contrib/tugboat/tugboat.dtx +++ b/macros/latex/contrib/tugboat/tugboat.dtx @@ -1,5 +1,5 @@ % \iffalse (this is a meta-comment (so they say)) -% $Id: tugboat.dtx 462 2023-03-08 17:26:54Z karl $ +% $Id: tugboat.dtx 490 2023-07-03 22:27:49Z karl $ % tugboat.dtx - main source for LaTeX TUGboat classes. % % Copyright 1994-2023 TeX Users Group. @@ -28,7 +28,7 @@ %<ltugboatsty>\ProvidesPackage{ltugboat} %<ltugprocsty>\ProvidesPackage{ltugproc} %<ltugcomn> \ProvidesPackage{ltugcomn} - [2023-03-08 v2.29 + [2023-07-03 v2.30 %<ltugboatcls> TUGboat journal class% %<ltugproccls> TUG conference proceedings class% %<ltugboatsty|ltugprocsty> TUG compatibility package% @@ -318,19 +318,13 @@ % Class options: |draft| vs.\ |preprint| vs.\ |final|. % % \begin{macrocode} -\DeclareOption{draft}{% +\DeclareOption{draft}{% [draft], the default + % If the user loads hyperref, avoid passing on the global draft option + % (which would remove all links in the pdf). + \PassOptionsToPackage{final}{hyperref} + % \AtEndOfClass{% \setcounter{page}{901}% - % - % Put a question mark into the page number in draft mode. - \let\tuborigthepage = \thepage - \def\thepage{% - \ifnum\value{page}>900 - \textsl{?\texorpdfstring{\,}{}\@arabic{\numexpr\the\c@page-900\relax}}% - \else - \arabic{page}% - \fi}% - % \BlackBoxes \def\MakeRegistrationMarks{}% \PrelimDrafttrue @@ -338,22 +332,21 @@ } \newif\ifpreprint -\def\preprint{\preprinttrue} +\def\preprint{\preprinttrue} % [preprint], hardly used \DeclareOption{preprint}{% \preprinttrue } -\newif\iftubfinaloption % [final] +\newif\iftubfinaloption % [final], manually inserted by us for processing \DeclareOption{final}{% \tubfinaloptiontrue \AtEndOfClass{% - \let\thepage=\tuborigthepage - \NoBlackBoxes % Insert draft date into the header even with [final], if we are not % doing a production run. (tugboat.dates sets up page numbers % above 900 in such pseudo-draft mode.) We use [final] in the first - % place for this case because draft can change page layout, wrt - % registration marks, etc. + % place for this case because draft vs. final can change page + % layout, wrt registration marks, etc. (Not good, but too painful to + % change at this late date.) \ifnum\value{page}>900 \PrelimDrafttrue \else \PrelimDraftfalse \fi \@tubrunningfull }% @@ -377,7 +370,7 @@ \pdfstringdefDisableCommands{% \let\acro\relax \let\origDash=\Dash \def\Dash{\texorpdfstring{\origDash}{--}}% - % lots more could be added. + % lots more could/should be added. }% \fi } @@ -480,10 +473,15 @@ % Occasionally, we need to start an article in the second column of a % page, due to splicing with a previous article. Let's try declaring that. % Then, before |\maketitle|, we'll force the move to the second column. +% +% And sometimes we need to add space at the top of that second column +% (e.g., |tb136lettre|); there's no way to intervene in the article +% source, so define a hook |\tubsecondcolstartextra|. % % \begin{macrocode} -\newif\iftubsecondcolstart +\newif\iftubsecondcolstart \DeclareOption{secondcolstart}{\tubsecondcolstarttrue} +\let\tubsecondcolstartextra\relax % \end{macrocode} % \end{macro} % @@ -683,7 +681,8 @@ % % Font used for the METAFONT logo, etc. % \begin{macrocode} -\DeclareRobustCommand{\AllTeX}{(\La\kern-.075em)\kern-.075em\TeX} +\DeclareRobustCommand{\AllTeX}{% + \texorpdfstring{(\La\kern-.075em)\kern-.075em\TeX}{(La)TeX}} \def\AMS{American Mathematical Society} \def\AmS{$\mathcal{A}$\kern-.1667em\lower.5ex\hbox {$\mathcal{M}$}\kern-.125em$\mathcal{S}$} @@ -876,7 +875,7 @@ \def\TANGLE{\texttt{TANGLE}\@} \def\TB{\textsl{The \TeX\-book}} \def\TIFF{\acro{TIFF}} -\def\TP{\textsl{\TeX}:\ \textsl{The Program}} +\def\TP{\textsl{\TeX:\ The Program\/}} \DeclareRobustCommand{\TeX}{T\kern-.1667em\lower.424ex\hbox{E}\kern-.125emX\@} \def\TeXhax{\TeX hax} \def\TeXMaG{\TeX M\kern-.1667em\lower.5ex\hbox{A}% @@ -927,6 +926,7 @@ \def\VorTeX{V\kern-2.7\p@\lower.5ex\hbox{O\kern-1.4\p@ R}\kern-2.6\p@\TeX} \def\XeT{X\kern-.125em\lower.424ex\hbox{E}\kern-.1667emT\@} \def\XML{\acro{XML}} +\def\XMP{\acro{XMP}} \def\WEB{\texttt{WEB}\@} \def\WEAVE{\texttt{WEAVE}\@} \def\WYSIWYG{\acro{WYSIWYG}} @@ -1012,11 +1012,12 @@ % ellipsis character (U+2026) a single character's width, typically more % squashed together than three period characters. This just looks wrong. % It is too painful to try to redefine in general, but provide the -% normal definition for \cs{let} in individual papers. -\DeclareRobustCommand{\tubdots}{% +% normal definition to reset in individual papers with, e.g.: +% |\ifx\tubdots\undefined \else \let\dots\tubdots \let\ldots\tubdots \fi| +\DeclareRobustCommand{\tubdots}{\ifmmode\mathellipsis\else .\kern\fontdimen3\font .\kern\fontdimen3\font - .\kern\fontdimen3\font} + .\kern\fontdimen3\font\fi} % % \begin{macro}{\allowhyphens} % Hyphen control: first, we save (via \cs{edef}) the hyphenpenalties in @@ -1216,7 +1217,7 @@ % % \subsection{Assorted user-level markup} % -% \LaTeXe{} defines a robust \cs{,}, but that we provide a new definition +% \LaTeXe{} defines a robust \cs{,} we provide a new definition % of |~| by redefining \cs{\nobreakspace} (\cs{DeclareRobustCommand} % doesn't mind redefinition, fortunately). This is based on the version % in AMS-\TeX---the \LaTeXe{} version (|ltspace.dtx|) has \cs{leavevmode} @@ -2281,8 +2282,7 @@ % more full columns, % above the top of an article to leave space to paste up a previous % article that has finished on the same page. This is a fall back to -% accommodate the fact that multiple articles cannot yet be run together -% easily with \LaTeXe. +% accommodate the fact that multiple articles cannot be run together % easily. % % In addition, if the |secondcolstart| option was specified, do % |\null\newpage| to move over. This is separate from |\PreTitleDrop|, @@ -2295,16 +2295,16 @@ {\@articletitletrue\@r@maketitle}% } \def\@r@maketitle{\par + \iftubsecondcolstart \null\newpage\tubsecondcolstartextra \fi \ifdim\PreTitleDrop > \z@ \loop \ifdim \PreTitleDrop > \textheight \vbox{}\vfil\eject \advance\PreTitleDrop by -\textheight \repeat - \vbox to \PreTitleDrop{} + \vbox to \PreTitleDrop{\vfil}% \global\PreTitleDrop=\z@ \fi - \iftubsecondcolstart \null\newpage\fi \begingroup \setcounter{footnote}{0} \global\@topnum\z@ % disallow floats above the title @@ -2738,15 +2738,46 @@ % \end{macrocode} % % \begin{macrocode} -\def\l@section#1#2{\addpenalty{\@secpenalty}% +% |#1| is both the section number and title; |#2| is the page number. +% Per Ulrike, the hook calls are for tagging, introduced with the +% June 2023 \LaTeX. +\def\l@section#1#2{% + \addpenalty{\@secpenalty}% \addvspace{\TBtocsectionspace}% \@tempdima 1.5em \begingroup - \parindent\z@ \rightskip\z@ % article style makes \rightskip > 0 + \parindent\z@ + \rightskip\z@ % article style makes \rightskip > 0 \parfillskip\z@ \TBtocsectionfont - \leavevmode\advance\leftskip\@tempdima\hskip-\leftskip#1\nobreak\hfil - \nobreak\hb@xt@\@pnumwidth{\hss #2}\par + \leavevmode + \advance\leftskip\@tempdima + \hskip-\leftskip + \ifx\UseHookWithArguments\undefined\else + \UseHookWithArguments{contentsline/text/before}{4} + {\toclevel@part}{#1}{#2}{\@contentsline@destination}% + \fi + % don't worry if this cs is not defined, hence the \csname. + \csname contentsline@text@1@format\endcsname{#1}% number and title + \ifx\UseHookWithArguments\undefined\else + \UseHookWithArguments{contentsline/text/after}{4} + {\toclevel@part}{#1}{#2}{\@contentsline@destination}% + \fi + \nobreak + \hfil + \nobreak + % page number + \hb@xt@\@pnumwidth{\hss + \ifx\UseHookWithArguments\undefined\else + \UseHookWithArguments{contentsline/page/before}{4} + {\toclevel@part}{#1}{#2}{\@contentsline@destination}% + \fi + #2% + \ifx\UseHookWithArguments\undefined\else + \UseHookWithArguments{contentsline/page/after}{4} + {\toclevel@part}{#1}{#2}{\@contentsline@destination}% + \fi + }\par \endgroup} % \end{macrocode} % @@ -2844,7 +2875,13 @@ % The name label comes from the moveable bit of the section argument; % we subvert the \cs{@sect} and \cs{@ssect} commands (the latter % deals with starred section commands) to grab the relevant argument. +% +% As of the June 2023 \LaTeX\ (or somewhat earlier, but this is good +% enough), there are hooks that allow us to avoid redefinig +% \cs{@sect} and \cs{@ssect}. +% % \begin{macrocode} +\@ifl@t@r\fmtversion{2023-06-01}{}{% \let\TB@@sect\@sect \let\TB@@ssect\@ssect \def\@sect#1#2#3#4#5#6[#7]#8{% @@ -2855,6 +2892,7 @@ \def\@currentlabelname{#5}% \TB@@ssect{#1}{#2}{#3}{#4}{#5}% } +} % LaTeX earlier than June 2023 % \end{macrocode} % % We output the name label as a second \cs{newlabel} command @@ -2863,26 +2901,28 @@ % So we redefine \cs{label} to first call the standard \LaTeX\ % \cs{label} and then write our named label as |nr<label>|. % -% \begin{macrocode} -\let\@savelatexlabel=\label % so save original LaTeX command -% -\def\label#1{% de - \@savelatexlabel{#1}% - \@bsphack - \if@filesw - \protected@write\@auxout{}% - {\string\newlabel{nr@#1}{{\@currentlabel}{\@currentlabelname}}}% - \fi - \@esphack +% Similarly, we only need this with pre-June 2023 \LaTeX. +% With more recent LaTeX, define \@currentlabelname via hooks. +% \begin{macrocode} +\@ifl@t@r\fmtversion{2023-06-01}{% + \AddToHookWithArguments{cmd/@sect/before}{\def\@currentlabelname{#7}}% + \AddToHookWithArguments{cmd/@ssect/before}{\def\@currentlabelname{#5}}% +}{% + \let\@savelatexlabel=\label % so save original LaTeX command + % + \def\label#1{% + \@savelatexlabel{#1}% + \@bsphack + \if@filesw + \protected@write\@auxout{}% + {\string\newlabel{nr@#1}{{\@currentlabel}{\@currentlabelname}}}% + \fi + \@esphack} + % in case there are no sectioning commands: + \let\@currentlabelname\@empty } % \end{macrocode} % -% Of course, in the case of a sufficiently mad author, there will be -% no sectioning commands, so we need to -% \begin{macrocode} -\let\@currentlabelname\@empty -% \end{macrocode} -% % Getting named references is then just like getting page references in % the \LaTeX\ kernel (see |ltxref.dtx|). % @@ -2899,9 +2939,18 @@ % % \begin{macrocode} \AtBeginDocument{% - \providecommand\nameref[1]{% - \expandafter\@setref - \csname r@nr@#1\endcsname\@secondoftwo{#1}% + \@ifl@t@r\fmtversion{2023-06-01}% + { % after June 2023, LaTeX stores the label name; use that. + \long\def\@thirdoffive#1#2#3#4#5{#3} + \providecommand\nameref[1]{% + \expandafter\@setref + \csname r@#1\endcsname\@thirdoffive{#1}}% + } + { % for earlier versions, still avoid overwriting \nameref per above. + % but if not otherwise defined, use the "nr" label defined by our \label. + \providecommand\nameref[1]{% + \expandafter\@setref + \csname r@nr@#1\endcsname\@secondoftwo{#1}}% }% } % \end{macrocode} @@ -3488,11 +3537,38 @@ \def\@oddhead{\MakeRegistrationMarks \frenchspacing \normalsize\csname normalshape\endcsname\rm \tubheadhook - \rtitlex\qquad \midrtitle\hfil \rtitlenexttopage\quad \thepage} + \rtitlex\qquad \midrtitle\hfil \rtitlenexttopage\quad\thepage} \def\@evenhead{\MakeRegistrationMarks \frenchspacing \normalsize\csname normalshape\endcsname\rm \tubheadhook - \thepage \quad\rtitlenexttopage \hfil\midrtitle \qquad\rtitlex} + \thepage\quad\rtitlenexttopage \hfil\midrtitle \qquad\rtitlex} + +% Put a ? into the page number in all but a final run, so people +% aren't tempted to cite it. +% +% We redefine |\thepage| so that the ? will also be used in page +% references (in the text) and the toc. This is what's recommended by +% the LaTeX developers: https://tex.stackexchange.com/questions/687258. +% (Ulrike's example does this after loading hyperref, but doesn't seem +% to matter?) +\renewcommand\thepage{% + \ifnum\value{page}>900 + % in CM, numerals are exactly .5em. + % + % The \texorpdfstring avoids the usual hyperref warning: + % Token not allowed in a PDF string ... removing `\@ifnextchar' + \texorpdfstring{\makebox[.5em][l]{\small ?}}{?}% + % + \textsl{\@arabic{\numexpr\value{page}-900\relax}}% e-tex + \else + \@arabic{\value{page}}% + \fi +} +% This custom page number format will break makeindex, etc., so we have +% to tell about the format. Per Ulrike: +% \usepackage{index} +% \newcommand\specialthepage{\inteval{\value{page}-900}} +% \newindex[specialthepage]*{default}{idx}{ind}{Index} % can be used to reset the font, e.g., tb98kuester. \def\tubheadhook{} @@ -3745,6 +3821,7 @@ \def\thefootnote{}% % no period, please, also no fnmark. \def\@makefntext##1{##1}% + \def\Hy@Warning##1{}% \footnotetext{\noindent #1#2}% \endgroup } |