summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/proflycee/tex/ProfLycee.sty
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/proflycee/tex/ProfLycee.sty')
-rw-r--r--macros/latex/contrib/proflycee/tex/ProfLycee.sty132
1 files changed, 130 insertions, 2 deletions
diff --git a/macros/latex/contrib/proflycee/tex/ProfLycee.sty b/macros/latex/contrib/proflycee/tex/ProfLycee.sty
index 56dda985a4..7fdd37b256 100644
--- a/macros/latex/contrib/proflycee/tex/ProfLycee.sty
+++ b/macros/latex/contrib/proflycee/tex/ProfLycee.sty
@@ -3,7 +3,8 @@
% or later, see http://www.latex-project.org/lppl.txtf
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{ProfLycee}[2022/09/03 v1.2.5 - Aide pour l'utilisation de LaTeX en lycee]
+\ProvidesPackage{ProfLycee}[2022/09/22 v1.2.6 - Aide pour l'utilisation de LaTeX en lycee]
+% 1.2.6 Ajout d'un environnement tikz pour des sudomaths personnalisés
% 1.2.5 Ajout d'une commande pour des boites à moustaches, en tikz
% 1.2.4 Correction de quelques bugs mineurs, et mise à jour de la doc
% 1.2.3 Ajout d'un environnement simplifié pour du code python
@@ -2011,7 +2012,7 @@
\def\BaMaxexmax{\fpeval{\BaMAxeMax+\BaMAxeElarg*\BaMaxelargeur}}
\draw[\BaMAxeEpaisseur,->] (\BaMaxexmin,0) -- (\BaMaxexmax,0) ;
\ifboolKV[boiteamoustachesaxe]{affvaleurs}
- {\foreach \x in \BaMAxeValeurs \draw[\BaMAxeEpaisseur] (\x,3pt)--(\x,-3pt) node[below=3pt] {\x} ;}
+ {\foreach \x in \BaMAxeValeurs \draw[\BaMAxeEpaisseur] (\x,3pt)--(\x,-3pt) node[below=3pt] {\num{\x}} ;}
{}
}
@@ -2051,4 +2052,131 @@
{}
}
+%================SUDOMATHS============= OK !!
+\defKV[PLTIKZSUDOM]{%
+ couleurtexte=\def\PLSMcoultexte{#1},%
+ epaisseur=\def\PLSMepf{#1},%
+ epaisseurg=\def\PLSMepg{#1},%
+ unite=\def\PLSMunite{#1},%
+ couleurcase=\def\PLSMcoulcase{#1},%
+ nbcol=\def\PLSMnbcol{#1},%
+ nbsubcol=\def\PLSMnbsubcol{#1},%
+ nblig=\def\PLSMnblig{#1},%
+ nbsublig=\def\PLSMnbsublig{#1},%
+ police=\def\PLSMfonte{#1},%
+ policeleg=\def\PLSMfonteleg{#1},%
+ listelegv=\def\PLSMlistelegv{#1},%
+ listelegh=\def\PLSMlistelegh{#1},%
+ decallegende=\def\PLSMdecalleg{#1}
+}
+
+\setKVdefault[PLTIKZSUDOM]{%
+ epaisseurg=1.5pt,%
+ epaisseur=0.5pt,%
+ unite=1cm,%
+ couleurcase=LightBlue!50,%
+ couleurtexte=blue,%
+ nbcol=9,%
+ nbsubcol=3,%
+ nblig=9,%
+ nbsublig=3,
+ police=\normalfont\normalsize,%
+ policeleg=\normalfont\sffamily,%
+ legendes=true,%
+ listelegv=ABCDEFGHIJKLMNOPQRSTUVWXYZ,%
+ listelegh=abcdefghijklmnopqrstuvwxyz,%
+ decallegende=0.45
+}
+
+\NewDocumentEnvironment{PLenvsudomaths}{ O{} m }
+ {
+ \useKVdefault[PLTIKZSUDOM]
+ \setKV[PLTIKZSUDOM]{#1}% on paramètres les nouvelles clés et on les simplifie
+ %calculs intermédiaires
+ \def\larcolinter{\inteval{\PLSMnbcol/\PLSMnbsubcol}}
+ \def\larliginter{\inteval{\PLSMnblig/\PLSMnbsublig}}
+ %lecture liste
+ \IfEq{#2}{}{}%
+ {%
+ \setsepchar[.]{§./}%
+ \readlist*\SPGrilleSudoMaths{#2}%
+ }
+ %débt envtik
+ \begin{tikzpicture}[x=\PLSMunite,y=\PLSMunite,line join=miter]
+ %cases
+ \IfEq{#2}{}{}%
+ {%
+ \foreach \i in {1,2,...,\PLSMnblig}{%
+ \foreach \j in {1,2,...,\PLSMnbcol}{%
+ \itemtomacro\SPGrilleSudoMaths[\i,\j]\SMcase
+ \IfSubStr{\SMcase}{*}%si on veut colorier via *
+ {%
+ \StrDel{\SMcase}{*}[\SMcaseb]%
+ \draw[draw=none,fill=\PLSMcoulcase] ({\j-1},{1-\i}) rectangle++ (1,-1) node[inner sep=0pt,outer sep=0pt,\PLSMcoultexte,font=\PLSMfonte,midway] {\SMcaseb} ;%
+ }
+ {%
+ \draw ({\j-0.5},{0.5-\i}) node[inner sep=0pt,outer sep=0pt,\PLSMcoultexte,font=\PLSMfonte] {\SMcase} ;%
+ }
+ }
+ }%
+ }
+ %grilles
+ \draw[line width=\PLSMepg] (0,0) rectangle ({\PLSMnbcol},{-\PLSMnblig}) ;
+ \draw[line width=\PLSMepf,xstep=1,ystep=1] (0,0) grid ({\PLSMnbcol},{-\PLSMnblig}) ;
+ \draw[line width=\PLSMepg,xstep=\larcolinter,ystep=\larliginter] (0,0) grid ({\PLSMnbcol},{-\PLSMnblig}) ;
+ %légendes
+ \ifboolKV[PLTIKZSUDOM]{legendes}
+ {%
+ \foreach \i in {1,2,...,\PLSMnbcol}{\draw ({\i-0.5},{\PLSMdecalleg}) node[inner sep=0pt,outer sep=0pt,font=\PLSMfonteleg] {\strut\StrChar{\PLSMlistelegh}{\i}} ;}
+ \foreach \j in {1,2,...,\PLSMnblig}{\draw ({-\PLSMdecalleg},{0.5-\j}) node[inner sep=0pt,outer sep=0pt,font=\PLSMfonteleg] {\StrChar{\PLSMlistelegv}{\j}} ;}
+ }{}
+ }
+ {
+ \end{tikzpicture}
+ }
+
+\NewDocumentCommand\PLsudomaths{ O{} m }{%
+ \useKVdefault[PLTIKZSUDOM]
+ \setKV[PLTIKZSUDOM]{#1}% on paramètres les nouvelles clés et on les simplifie
+ %calculs intermédiaires
+ \def\larcolinter{\inteval{\PLSMnbcol/\PLSMnbsubcol}}
+ \def\larliginter{\inteval{\PLSMnblig/\PLSMnbsublig}}
+ %lecture liste
+ \IfEq{#2}{}{}%
+ {%
+ \setsepchar[.]{§./}%
+ \readlist*\SPGrilleSudoMaths{#2}%
+ }
+ %débt envtik
+ \begin{tikzpicture}[x=\PLSMunite,y=\PLSMunite,line join=miter]
+ %cases
+ \IfEq{#2}{}{}%
+ {%
+ \foreach \i in {1,2,...,\PLSMnblig}{%
+ \foreach \j in {1,2,...,\PLSMnbcol}{%
+ \itemtomacro\SPGrilleSudoMaths[\i,\j]\SMcase
+ \IfSubStr{\SMcase}{*}%si on veut colorier via *
+ {%
+ \StrDel{\SMcase}{*}[\SMcaseb]%
+ \draw[draw=none,fill=\PLSMcoulcase] ({\j-1},{1-\i}) rectangle++ (1,-1) node[inner sep=0pt,outer sep=0pt,\PLSMcoultexte,font=\PLSMfonte,midway] {\SMcaseb} ;%
+ }
+ {%
+ \draw ({\j-0.5},{0.5-\i}) node[inner sep=0pt,outer sep=0pt,\PLSMcoultexte,font=\PLSMfonte] {\SMcase} ;%
+ }
+ }
+ }%
+ }
+ %grilles
+ \draw[line width=\PLSMepg] (0,0) rectangle ({\PLSMnbcol},{-\PLSMnblig}) ;
+ \draw[line width=\PLSMepf,xstep=1,ystep=1] (0,0) grid ({\PLSMnbcol},{-\PLSMnblig}) ;
+ \draw[line width=\PLSMepg,xstep=\larcolinter,ystep=\larliginter] (0,0) grid ({\PLSMnbcol},{-\PLSMnblig}) ;
+ %légendes
+ \ifboolKV[PLTIKZSUDOM]{legendes}
+ {%
+ \foreach \i in {1,2,...,\PLSMnbcol}{\draw ({\i-0.5},{\PLSMdecalleg}) node[inner sep=0pt,outer sep=0pt,font=\PLSMfonteleg] {\strut\StrChar{\PLSMlistelegh}{\i}} ;}
+ \foreach \j in {1,2,...,\PLSMnblig}{\draw ({-\PLSMdecalleg},{0.5-\j}) node[inner sep=0pt,outer sep=0pt,font=\PLSMfonteleg] {\StrChar{\PLSMlistelegv}{\j}} ;}
+ }{}
+ \end{tikzpicture}
+}
+
\endinput \ No newline at end of file