summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/profcollege/latex/PfCMotsCodes.tex
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/profcollege/latex/PfCMotsCodes.tex')
-rw-r--r--macros/latex/contrib/profcollege/latex/PfCMotsCodes.tex59
1 files changed, 59 insertions, 0 deletions
diff --git a/macros/latex/contrib/profcollege/latex/PfCMotsCodes.tex b/macros/latex/contrib/profcollege/latex/PfCMotsCodes.tex
new file mode 100644
index 0000000000..ad49524c71
--- /dev/null
+++ b/macros/latex/contrib/profcollege/latex/PfCMotsCodes.tex
@@ -0,0 +1,59 @@
+%%%
+% Mots Cod\'es
+%%%
+\setKVdefault[MotsCodes]{LargeurT=1cm,Colonnes=5,Largeur=3cm,Solution=false,Math=false}%
+
+\newcommand\MotsCodes[2][]{%
+ \useKVdefault[MotsCodes]%
+ \setKV[MotsCodes]{#1}%
+ \setsepchar[*]{ยง*/}%
+ \readlist*\ListeMotsCodes{#2}%
+ \xdef\ListeMotsCodesPas{\fpeval{\ListeMotsCodeslen/\useKV[MotsCodes]{Colonnes}}}%
+ \begin{NiceTabular}{*{\fpeval{\useKV[MotsCodes]{Colonnes}}}{>{\centering\arraybackslash}m{\useKV[MotsCodes]{Largeur}}}}
+ \xintFor* ##1 in {\xintSeq {1}{\ListeMotsCodesPas}}\do{%
+ \xintFor* ##2 in {\xintSeq {1}{\fpeval{\useKV[MotsCodes]{Colonnes}}}}\do{%
+ \xintifForFirst{}{&}\Block[draw=black]{4-1}{}%
+ }\\
+ \xintFor* ##2 in {\xintSeq {1}{\fpeval{\useKV[MotsCodes]{Colonnes}}}}\do{%
+ \xintifForFirst{}{&}\ListeMotsCodes[\fpeval{(##1-1)*\useKV[MotsCodes]{Colonnes}+##2},1]
+ }\\
+ \xintFor* ##2 in {\xintSeq {1}{\fpeval{\useKV[MotsCodes]{Colonnes}}}}\do{%
+ \xintifForFirst{}{&}%
+ }\\
+ \xintFor* ##2 in {\xintSeq {1}{\fpeval{\useKV[MotsCodes]{Colonnes}}}}\do{%
+ \xintifForFirst{}{&}\textbf{\Large\ListeMotsCodes[\fpeval{(##1-1)*\useKV[MotsCodes]{Colonnes}+##2},2]}
+ }\\
+ }%
+ \end{NiceTabular}%
+}%
+
+\newcommand\MotsCodesTableau[3][]{%
+ \useKVdefault[MotsCodes]%
+ \setKV[MotsCodes]{#1}%
+ \setsepchar[*]{,*/}%
+ \readlist*\ListeMotsCodesTableau{#2}%
+ \xdef\ListeMotsCodesMax{0}%
+ \setsepchar{,}%
+ \readlist*\ListeMotsCodesPhrase{#3}%
+ \foreachitem\compteur\in\ListeMotsCodesTableau{%
+ \xintifboolexpr{\ListeMotsCodesMax<\listlen\ListeMotsCodesTableau[\compteurcnt]}{\xdef\ListeMotsCodesMax{\fpeval{\listlen\ListeMotsCodesTableau[\compteurcnt]}}}{}%
+ }%
+ \begin{NiceTabular}{*{\fpeval{\ListeMotsCodesMax}}{>{\centering\arraybackslash}m{\useKV[MotsCodes]{LargeurT}}}}
+ \xintFor* ##1 in {\xintSeq {1}{\fpeval{\ListeMotsCodesTableaulen}}}\do{%
+ \xintFor* ##2 in {\xintSeq {1}{\listlen\ListeMotsCodesTableau[##1]}}\do{%
+ \xintifForFirst{}{&}\ifboolKV[MotsCodes]{Solution}{%
+ \StrMid{\ListeMotsCodesPhrase[##1]}{##2}{##2}[\MotsCodesMaLettre]%
+ \IfStrEq{\MotsCodesMaLettre}{*}{\Block[draw=black,fill=black]{3-1}{}}{\Block[draw=black]{3-1}{\StrMid{\ListeMotsCodesPhrase[##1]}{##2}{##2}}}%
+ }{%
+ \IfStrEq{\ListeMotsCodesTableau[##1,##2]}{*}{\Block[draw=black,fill=black]{3-1}{}}{\Block[draw=black]{3-1}{}}%
+ }%%
+ }\\
+ \xintFor* ##2 in {\xintSeq {1}{\listlen\ListeMotsCodesTableau[##1]}}\do{%
+ \xintifForFirst{}{&}
+ }\\
+ \xintFor* ##2 in {\xintSeq {1}{\listlen\ListeMotsCodesTableau[##1]}}\do{%
+ \xintifForFirst{}{&}\IfStrEq{\ListeMotsCodesTableau[##1,##2]}{*}{}{\footnotesize\ifboolKV[MotsCodes]{Math}{\ListeMotsCodesTableau[##1,##2]}{\num{\ListeMotsCodesTableau[##1,##2]}}}%
+ }\\
+ }%
+ \end{NiceTabular}%
+}% \ No newline at end of file