summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/profcollege/latex/PfCFicheMemo.tex
blob: 511e47da2f1ae6d8e71ddd0bda4e6c17915593ee (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
%%%
% Fiche m\'emorisation active
%%%
\setKVdefault[ClesFicheMemo]{TexteReponses=Réponses,TexteQuestions=Questions,Solution=false,Largeur=\linewidth}

\newcommand\FicheMemo[3][]{%
  \xdef\CountcolUn{0}%
  \xdef\CountcolDeux{0}%
  \useKVdefault[ClesFicheMemo]%
  \setKV[ClesFicheMemo]{#1}%
  \setsepchar[*]{§*/}\reademptyitems%
  \readlist*\ListeQuestionColonneUn{#2}%
  \readlist*\ListeQuestionColonneDeux{#3}%
  \renewcommand{\arraystretch}{1.35}%
  \begin{NiceTabular}[width=\useKV[ClesFicheMemo]{Largeur}]{X[1]X[1]X[1]X[1]}[hvlines]
    \CodeBefore%
    \rowcolor{gray!15}{1}%
    \tikz\draw[dashed,gray!50](2-|1.5) to (last-|1.5);%
    \tikz\draw[dashed,gray!50](2-|4.5) to (last-|4.5);%
    \Body%
    \Block{1-1}{\bfseries\useKV[ClesFicheMemo]{TexteReponses}}&&&\Block{1-1}{\bfseries\useKV[ClesFicheMemo]{TexteReponses}}\\
    \xintFor* ##1 in {\xintSeq {1}{\ListeQuestionColonneUnlen}}\do{%
      \xintifboolexpr{\listlen\ListeQuestionColonneUn[##1]==2}{%
        \uppercase{&}}{%
        \Block[l]{\fpeval{\ListeQuestionColonneUn[##1,1]}-1}{\ifboolKV[ClesFicheMemo]{Solution}{\ListeQuestionColonneUn[##1,3]}{}}%
        \uppercase{&}\xdef\CountcolUn{\fpeval{\CountcolUn+1}}\Block[l]{\fpeval{\ListeQuestionColonneUn[##1,1]}-1}{\ListeQuestionColonneUn[##1,2]}%
      }%
      &%
      \xintifboolexpr{\listlen\ListeQuestionColonneDeux[##1]==2}{%
        \uppercase{&}%
      }{%
        \xdef\CountcolDeux{\fpeval{\CountcolDeux+1}}\Block[l]{\fpeval{\ListeQuestionColonneDeux[##1,1]}-1}{\ListeQuestionColonneDeux[##1,2]}\uppercase{&}\Block[l]{\fpeval{\ListeQuestionColonneDeux[##1,1]}-1}{\ifboolKV[ClesFicheMemo]{Solution}{\ListeQuestionColonneDeux[##1,3]}{}}%
      }%
      \\%
    }%
    \CodeAfter%
    \tikz\node[xshift=0.5em] at (2-|1) {\scriptsize\faCut};%
    \xdef\PfCCountCutUn{2}%
    \xintFor* ##1 in {\xintSeq {1}{\ListeQuestionColonneUnlen}}\do{%
      \xintifboolexpr{\listlen\ListeQuestionColonneUn[##1]==2}{%
      }{%
        \xdef\PfCCountCutUn{\fpeval{\PfCCountCutUn+\ListeQuestionColonneUn[##1,1]}}%
        \tikz\node[xshift=0.5em] at (\fpeval{\PfCCountCutUn}-|1) {\scriptsize\faCut};%
      }%
    }%
    \tikz\node[xshift=-0.5em] at (2-|last) {\scriptsize\rotatebox{180}{\faCut}};%
    \xdef\PfCCountCutDeux{2}%
    \xintFor* ##1 in {\xintSeq {1}{\ListeQuestionColonneDeuxlen}}\do{%
      \xintifboolexpr{\listlen\ListeQuestionColonneDeux[##1]==2}{%
      }{%
        \xdef\PfCCountCutDeux{\fpeval{\PfCCountCutDeux+\ListeQuestionColonneDeux[##1,1]}}%
        \tikz\node[xshift=-0.5em] at (\fpeval{\PfCCountCutDeux}-|last) {\scriptsize\rotatebox{180}{\faCut}};%
      }%
    }%
    \tikz\node[xshift=0.5em] at (1-|1) {\color{gray}\scriptsize\faCut};%
    \tikz\node[xshift=0.5em] at (last-|1) {\color{gray}\scriptsize\faCut};%
    \tikz\node[xshift=-0.5em] at (1-|last) {\color{gray}\scriptsize\rotatebox{180}{\faCut}};%
    \tikz\node[xshift=-0.5em] at (last-|last) {\color{gray}\scriptsize\rotatebox{180}{\faCut}};%
    \tikz\node at (1.5-|2.5) {\bfseries\useKV[ClesFicheMemo]{TexteQuestions} 1 à \num{\CountcolUn}};%
    \tikz\node at (1.5-|3.5) {\bfseries\useKV[ClesFicheMemo]{TexteQuestions} \num{\fpeval{\CountcolUn+1}} à \num{\fpeval{\CountcolUn+\CountcolDeux}}};%
  \end{NiceTabular}%
  \renewcommand{\arraystretch}{1}%
  \setsepchar{,}%
}%