1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
%%%
% Garam
%%%
\setKVdefault[Garam]{Taille=7,Largeur=15pt,Solution=false,CouleurSolution=Black}
\newlength\PfCGaramHeight
\NewDocumentCommand\Garam{o m}{%
\useKVdefault[Garam]
\setKV[Garam]{#1}%
\setlength{\PfCGaramHeight}{\useKV[Garam]{Largeur}+\tabcolsep}%
\reademptyitems%
\setsepchar[*]{§*,*/}%
\readlist*\PfCListeGaram{#2}%
\colorlet{PfCGaramCoulSol}{\useKV[Garam]{CouleurSolution}}%
\begin{NiceTabular}{*{\useKV[Garam]{Taille}}{m{\useKV[Garam]{Largeur}}}}
\CodeBefore
\xintFor* ##1 in{\xintSeq{2}{\fpeval{\useKV[Garam]{Taille}}}}\do{%
\tikz{\draw[dashed,LightGray] (1-|##1)--(last-|##1);}%
}%
\xintFor* ##1 in{\xintSeq{2}{\fpeval{\PfCListeGaramlen-1}}}\do{%
\tikz{\draw[dashed,LightGray] (##1-|1)--(##1-|last);}%
}%
\tikz{\draw (1-|1) rectangle (last-|last);}%
\Body
\xintFor* ##1 in{\xintSeq{1}{\PfCListeGaramlen}}\do{%
\rule{0pt}{\PfCGaramHeight}\xintFor* ##2 in {\xintSeq{1}{\useKV[Garam]{Taille}}}\do{%
\xintifForFirst{}{&}\StrChar{\PfCListeGaram[##1,##2,1]}{1}[\PfCCaracGaram]%
\IfStrEq{\PfCCaracGaram}{*}{\Block[draw,fill=black]{1-1}{}}{%
\IfStrEq{\PfCCaracGaram}{!}{\Block{}{\ifboolKV[Garam]{Solution}{\StrGobbleLeft{\PfCListeGaram[##1,##2,1]}{1}}{}}}{\Block{}{\color{PfCGaramCoulSol}\PfCListeGaram[##1,##2,1]}}%
}%
}\\
}%
\CodeAfter
% On place les symboles
\xintFor* ##1 in{\xintSeq{1}{\PfCListeGaramlen}}\do{%
\xintFor* ##2 in {\xintSeq{1}{\useKV[Garam]{Taille}}}\do{%
\StrChar{\PfCListeGaram[##1,##2,1]}{1}[\PfCCaracGaram]%
\IfStrEq{\PfCCaracGaram}{*}{}{%
\tikz{%
\StrSubstitute{\PfCListeGaram[##1,##2,2]}{x}{\PfCSymbolTimes}[\PfCGaramUn]%
\StrSubstitute{\PfCGaramUn}{:}{\div}[\PfCGaramUn]%
\StrSubstitute{\PfCListeGaram[##1,##2,3]}{x}{\PfCSymbolTimes}[\PfCGaramDeux]%
\StrSubstitute{\PfCGaramDeux}{:}{\div}[\PfCGaramDeux]%
\xintifForLast{}{\node at (\fpeval{##1+0.5}-|\fpeval{##2+1}) {$\PfCGaramUn$};}
\node at (\fpeval{##1+1}-|\fpeval{##2+0.5}) {$\PfCGaramDeux$};
}%
}%
}%
}%
\end{NiceTabular}
}%
|