diff options
Diffstat (limited to 'macros/latex/contrib/profcollege/latex/PfCMotsEmpiles.tex')
-rw-r--r-- | macros/latex/contrib/profcollege/latex/PfCMotsEmpiles.tex | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/macros/latex/contrib/profcollege/latex/PfCMotsEmpiles.tex b/macros/latex/contrib/profcollege/latex/PfCMotsEmpiles.tex new file mode 100644 index 0000000000..634baa969e --- /dev/null +++ b/macros/latex/contrib/profcollege/latex/PfCMotsEmpiles.tex @@ -0,0 +1,34 @@ +%%% +% Mots empilés +%%% +\setKVdefault[ClesMotEmpile]{Colonne=4,Solution=false,Couleur=black} + +\newcounter{CompteurMotEmpile} + +\newcommand\MotsEmpiles[2][]{% + \useKVdefault[ClesMotEmpile]% + \setKV[ClesMotEmpile]{#1}% + \setcounter{CompteurMotEmpile}{0}% + \setsepchar[*]{,*/}% + \readlist*\ListeMotsEmpiles{#2}% + \xdef\ListeMotsEmpilesMax{0}% + \colorlet{MotEmpileCouleur}{\useKV[ClesMotEmpile]{Couleur}}% + \foreachitem\compteur\in\ListeMotsEmpiles{% + \StrLen{\ListeMotsEmpiles[\compteurcnt,2]}[\LongueurMot]% + \xintifboolexpr{\ListeMotsEmpilesMax<\fpeval{\ListeMotsEmpiles[\compteurcnt,1]+\LongueurMot}}{\xdef\ListeMotsEmpilesMax{\fpeval{\ListeMotsEmpiles[\compteurcnt,1]+\LongueurMot}}}{}% + }% + \begin{NiceTabular}{c|*{\fpeval{\ListeMotsEmpilesMax}}{m{10pt}}}% + \Block{1-\fpeval{\useKV[ClesMotEmpile]{Colonne}+2}}{}\xintFor* ##1 in {\xintSeq {1}{\fpeval{\useKV[ClesMotEmpile]{Colonne}}}}\do{&}&$\downarrow$\xintFor* ##1 in {\xintSeq {1}{\fpeval{\ListeMotsEmpilesMax-\useKV[ClesMotEmpile]{Colonne}-1}}}\do{&}\\ + \xintFor* ##1 in {\xintSeq {1}{\fpeval{\ListeMotsEmpileslen}}}\do{% + \rule[-1.2ex]{0pt}{3.8ex}\stepcounter{CompteurMotEmpile}\Alph{CompteurMotEmpile}&\Block{1-\fpeval{\ListeMotsEmpiles[##1,1]}}{}\xintFor* ##2 in {\xintSeq {1}{\fpeval{\ListeMotsEmpiles[##1,1]}}}\do{% + & + }% + \StrLen{\ListeMotsEmpiles[##1,2]}[\LongueurMot]% + \xintFor* ##3 in {\xintSeq {1}{\fpeval{\LongueurMot}}}\do{% + \xintifForFirst{}{&}\Block[draw=black]{1-1}{\ifboolKV[ClesMotEmpile]{Solution}{\centering\arraybackslash\StrMid{\ListeMotsEmpiles[##1,2]}{##3}{##3}}{}}%% + }% + \\ + }% + \CodeAfter\tikz\draw[line width=1.5pt,MotEmpileCouleur](row-2-|col-\fpeval{\useKV[ClesMotEmpile]{Colonne}+2}) rectangle (row-\fpeval{\ListeMotsEmpileslen+2}-|col-\fpeval{\useKV[ClesMotEmpile]{Colonne}+3}); + \end{NiceTabular}% +}%
\ No newline at end of file |