summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/profcollege/latex/PfCQuiSuisJe.tex
blob: aa896d118563b614ba42fb90dd3c4fa847075c4d (plain)
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
%%%
% Qui suis-je
%%%
\setKVdefault[Quisuisje]{Solution=false,Largeur=5mm,Colonnes=5,CodePerso=false,TexteA=Lettre,TexteB=R\'esultat du calcul}%

\newcommand\QuisuisjeEnonce{%
  Chaque lettre du mot à découvrir porte un numéro qui correspond à un
  calcul à effectuer. Pour trouver les lettres de ce mot, tu dois donc
  effectuer les calculs proposés. Les résultats que tu auras trouvés
  te donneront, à l'aide du tableau de correspondance ci-dessous, les
  lettres du mot.
}%

\newcommand\QuisuisjeTableau[2][]{%
  \setKV[Quisuisje]{#1}%
  \setsepchar[*]{§*/}\ignoreemptyitems%
  \readlist*\ListeQuisuisje{#2}%
  \begin{NiceTabular}{|l|*{\ListeQuisuisjelen}{m{\useKV[Quisuisje]{Largeur}}|}}%
    \hline
    \useKV[Quisuisje]{TexteA}\xintFor* ##1 in {\xintSeq {1}{\ListeQuisuisjelen}}\do{%
      &\centering\arraybackslash\ListeQuisuisje[##1,1]
    }\\
    \hline
    \useKV[Quisuisje]{TexteB}\xintFor* ##1 in {\xintSeq {1}{\ListeQuisuisjelen}}\do{%
      &\centering\arraybackslash\ListeQuisuisje[##1,2]
    }\\
    \hline
  \end{NiceTabular}%
}%

\newcommand\QuisuisjeCodePerso[3][]{%
  \setKV[Quisuisje]{#1}%
  \setsepchar{ }%
  \readlist*\ListeQuisuisjeCode{#2}%
  \readlist*\ListeQuisuisjeLettres{#3}%
  \par\hfill%
  \begin{NiceTabular}{|*{\ListeQuisuisjeLettreslen}{m{7mm}|}}
    \hline
    \xintFor* ##1 in {\xintSeq {1}{\ListeQuisuisjeLettreslen}}\do{%
      \xintifForFirst{}{&}\ifboolKV[Quisuisje]{Solution}{\hfill\ListeQuisuisjeLettres[##1]}{\phantom{1}}
    }\\
    \xintFor* ##1 in {\xintSeq {1}{\ListeQuisuisjeLettreslen}}\do{%
      \xintifForFirst{}{&}\tiny\ListeQuisuisjeCode[##1]%
    }\\
    \hline
  \end{NiceTabular}%
}%

\newcommand\Quisuisje[3][]{%
  \useKVdefault[Quisuisje]%
  \setKV[Quisuisje]{#1}%
  \ifboolKV[Quisuisje]{CodePerso}{}{%
    \setsepchar{ }%
    \readlist\ListeLettres{#3}%
  }%
  \setsepchar{§}%
  \readlist\ListeCalculs{#2}%
  \ifboolKV[Quisuisje]{CodePerso}{}{%
    \par\hfill%
    \begin{NiceTabular}{|*{\ListeLettreslen}{m{7mm}|}}
      \hline
      \xintFor* ##1 in {\xintSeq {1}{\ListeLettreslen}}\do{%
        \xintifForFirst{}{&} \ifboolKV[Quisuisje]{Solution}{\hfill\ListeLettres[##1]}{\phantom{1}}
      }\\
      \xintFor* ##1 in {\xintSeq {1}{\ListeLettreslen}}\do{%
        \xintifForFirst{}{&}\tiny\num{##1}%
      }\\
      \hline
    \end{NiceTabular}%
  }%
  \par\bigskip\par
  \ifboolKV[Quisuisje]{Solution}{}{%
    \begin{multicols}{\useKV[Quisuisje]{Colonnes}}%
      \begin{enumerate}
        \xintFor* ##1 in {\xintSeq {1}{\ListeCalculslen}}\do{%
        \item\ListeCalculs[##1]
        }
      \end{enumerate}%
    \end{multicols}%
  }%
}%