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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
% Author : M. Vignal
% License : Released under the LaTeX Project Public License v1.3c or later, see http://www.latex-project.org/lppl.txt
\ProvidesPackage{RoueQuestions}[2023/06/27 0.0.2 Aide pour générer des roues de questions]
\RequirePackage{tikz}
\RequirePackage{simplekv}
\RequirePackage{listofitems}
\RequirePackage{ifthen}
\setKVdefault[roueQuestions]{
Titre = {},
Consigne = {},
Conseil = {},
LineWidth = 2pt,
RayonCentral= 6,
RayonTotal = 8,
BordureCouleur=black,
CasesCouleur=white,
CentreCouleur=white,
Image = {},
ImageOpacite= 0.2,
Decoupe = true,
DecoupeCouleur=blue,
Pliage = true,
PliageCouleur=green!30!black,
Solution = false,
EspaceRoues = -0.5cm
}
\newcommand{\roueQuestions}[2][]{%
\restoreKV[roueQuestions] %paramètres par défaut
\setKV[roueQuestions]{#1} % lecture des paramètres passés à la macro et remplacement des valeurs
\readlist*\listeequations{#2}%
\pgfmathparse{int(\listeequationslen)}\let\nbequations\pgfmathresult%
\pgfmathparse{360/\nbequations}\let\angle\pgfmathresult
\pgfmathparse{\useKV[roueQuestions]{RayonCentral}}\let\RayonCentral\pgfmathresult
\pgfmathparse{\useKV[roueQuestions]{RayonTotal}}\let\RayonTotal\pgfmathresult
\pgfmathparse{(2*\RayonCentral+\RayonTotal)/3}\let\RayonTexte\pgfmathresult
\pgfmathparse{(4*\RayonCentral)/3}\let\LargeurTexte\pgfmathresult
\edef\LineWidth{\useKV[roueQuestions]{LineWidth}}
\edef\Image{\useKV[roueQuestions]{Image}}
\pgfmathparse{\useKV[roueQuestions]{ImageOpacite}}\let\ImageOpacite\pgfmathresult
\edef\DecoupeCouleur{\useKV[roueQuestions]{DecoupeCouleur}}
\edef\PliageCouleur{\useKV[roueQuestions]{PliageCouleur}}
\edef\CasesCouleur{\useKV[roueQuestions]{CasesCouleur}}
\edef\CentreCouleur{\useKV[roueQuestions]{CentreCouleur}}
\edef\BordureCouleur{\useKV[roueQuestions]{BordureCouleur}}
%
\ifboolKV[roueQuestions]{Solution}{%
\vspace{\useKV[roueQuestions]{EspaceRoues}}
}{}
%
\begin{tikzpicture}[remember picture]
\foreach \n in {1,...,\nbequations}{%
%pour masquer ce qui dépasse du scope
\filldraw[\CentreCouleur] (0,0) -- (\angle*\n:\RayonCentral) -- (\angle*\n+\angle:\RayonCentral) -- cycle;
}
%scope
\begin{scope}
\clip (0,0) circle (\RayonCentral);
\ifthenelse{\equal{\Image}{}}{}{%
c{}{
%\filldraw[blue] (-7,-7) rectangle (7,7);
%ajout image
\node[opacity=\ImageOpacite] (centre) at(0,0) {\includegraphics[]{\Image}};
}
}
\end{scope}
\foreach \n in {1,...,\nbequations}{%
%pour masquer ce qui dépasse du scope
\filldraw[\CasesCouleur] (\angle*\n-\angle:\RayonCentral) -- (\angle*\n-\angle:\RayonTotal) -- (\angle*\n:\RayonTotal) -- (\angle*\n:\RayonCentral) -- cycle;
}
\foreach \n in {1,...,\nbequations}{%
\ifboolKV[roueQuestions]{Decoupe}{%
\edef\couleurExt{\DecoupeCouleur}
}{%
\edef\couleurExt{\BordureCouleur}
}
\ifboolKV[roueQuestions]{Pliage}{%
\edef\couleurPli{\PliageCouleur}
}{%
\edef\couleurPli{\BordureCouleur}
}
% intérieur vers extérieur
\ifboolKV[roueQuestions]{Solution}{%
\draw[line width={\useKV[roueQuestions]{LineWidth}}] (\angle*\n:\RayonCentral) -- (\angle*\n:\RayonTotal) ;
}{%
\draw[\couleurExt,line width={\useKV[roueQuestions]{LineWidth}},dashed] (\angle*\n:\RayonCentral) -- (\angle*\n:\RayonTotal) ;
}
% intérieur
\ifboolKV[roueQuestions]{Solution}{\draw[line width={\useKV[roueQuestions]{LineWidth}}] (\angle*\n:\RayonCentral) -- (\angle*\n+\angle:\RayonCentral) ; }{\draw[\couleurPli,line width={\useKV[roueQuestions]{LineWidth}}] (\angle*\n:\RayonCentral) -- (\angle*\n+\angle:\RayonCentral) ; }
% extérieur
\draw[\couleurExt, line width={\useKV[roueQuestions]{LineWidth}}] (\angle*\n:\RayonTotal) -- (\angle*\n+\angle:\RayonTotal) ;
% texte de l'onglet
% angle de rotation du texte = 180 - \angle/2
\pgfmathparse{270 + \angle*\n - \angle/2}\let\angleTexte\pgfmathresult
\node[rotate=\angleTexte] at (\angle*\n-\angle/2:\RayonTexte) {\listeequations[\n]};
}
\node at(0,2*\RayonCentral/3) {\textbf{\useKV[roueQuestions]{Titre}}};
\node[text width=\LargeurTexte cm,text justified] at(0,0) {\useKV[roueQuestions]{Consigne}};
\end{tikzpicture}
}
\newcommand{\rouesQuestions}[3][]{%
\roueQuestions[#1]{#2}
\begin{flushright}
\roueQuestions[#1,Solution]{#3}
\end{flushright}
}
|