summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/profcollege/latex/PfCEcrireunQCM.tex
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/profcollege/latex/PfCEcrireunQCM.tex')
-rw-r--r--macros/latex/contrib/profcollege/latex/PfCEcrireunQCM.tex148
1 files changed, 148 insertions, 0 deletions
diff --git a/macros/latex/contrib/profcollege/latex/PfCEcrireunQCM.tex b/macros/latex/contrib/profcollege/latex/PfCEcrireunQCM.tex
new file mode 100644
index 0000000000..bd0cb57204
--- /dev/null
+++ b/macros/latex/contrib/profcollege/latex/PfCEcrireunQCM.tex
@@ -0,0 +1,148 @@
+%%%
+% QCM
+%%%
+\setKVdefault[ClesQCM]{Reponses=3,Solution=false,Stretch=1,Largeur=2cm,Couleur=gray!15,Titre=false,Nom=R\'eponse,NomV=Vrai,NomF=Faux,Alph=false,AlphT=false,VF=false,Depart=1,Alterne=false,Noms={A/B/C},Multiple=false,Parties={Yeux,Nez,Bouche}}%
+\newlength{\LargeurQCM}%
+\newlength{\PfCLargeurQCM}%
+\newcounter{QuestionQCM}%
+\newcounter{TitreQCM}%
+\ifdef{\QCM}{%
+ \PackageWarning{ProfCollege}{La commande \noexpand\QCM étant définie par la classe du document, ProfCollege modifie sa commande \noexpand\QCM en \noexpand\QCMPfC.}%
+ \newcommand\QCMPfC[2][]{%
+ \useKVdefault[ClesQCM]%
+ \setKV[ClesQCM]{#1}%
+ \setcounter{QuestionQCM}{\fpeval{\useKV[ClesQCM]{Depart}-1}}%
+ \setcounter{TitreQCM}{0}
+ \setsepchar[*]{§*&}\ignoreemptyitems%
+ \readlist*\ListeQCM{#2}%
+ \ifboolKV[ClesQCM]{Multiple}{%
+ \renewcommand{\arraystretch}{\useKV[ClesQCM]{Stretch}}%
+ \setlength{\LargeurQCM}{\fpeval{(\linewidth-\useKV[ClesQCM]{Reponses}*(3*\tabcolsep+\useKV[ClesQCM]{Largeur}))}pt}%
+ \xdef\NBcases{\fpeval{\useKV[ClesQCM]{Reponses}+1}}%
+ \xdef\ListeNom{\useKV[ClesQCM]{Noms}}%
+ \setsepchar[*]{/}%
+ \readlist*\ListeNomsMul{\ListeNom}%
+ \begin{tabular}{|p{\LargeurQCM}|*{\useKV[ClesQCM]{Reponses}}{>{\centering\arraybackslash}p{\useKV[ClesQCM]{Largeur}}|}}%
+ \cline{2-\NBcases}%
+ \multicolumn{1}{c|}{}\xintFor* ##2 in {\xintSeq {1}{\useKV[ClesQCM]{Reponses}}}\do{%
+ &\ListeNomsMul[##2]}%
+ \\
+ \hline%
+ \xintFor* ##1 in {\xintSeq {1}{\ListeQCMlen}}\do{%
+ \stepcounter{QuestionQCM}\ifboolKV[ClesQCM]{Alterne}{\modulo{\theQuestionQCM}{2}\ifnum\remainder=0\cellcolor{gray!15}\fi}{}\ifboolKV[ClesQCM]{Alph}{\textbf{\Alph{QuestionQCM}}/}{\textbf{\theQuestionQCM/}}~\ListeQCM[##1,1]\xintFor* ##2 in {\xintSeq {1}{\useKV[ClesQCM]{Reponses}}}\do{%
+ &\ifboolKV[ClesQCM]{Alterne}{\modulo{\theQuestionQCM}{2}\ifnum\remainder=0\cellcolor{gray!15}\fi}{}\ifboolKV[ClesQCM]{Solution}{\xintifboolexpr{\ListeQCM[##1,\fpeval{##2+1}]==1}{$\boxtimes$}{$\square$}}{$\square$}%
+ }\\
+ }%
+ \hline%
+ \end{tabular}%
+ }{%
+ \ifboolKV[ClesQCM]{VF}{%
+ \setKV[ClesQCM]{Reponses=2}%
+ \setlength{\PfCLargeurQCM}{\useKV[ClesQCM]{Largeur}}%
+ \setlength{\LargeurQCM}{\linewidth-6\tabcolsep-2\PfCLargeurQCM-4\arrayrulewidth}%
+ \renewcommand{\arraystretch}{\useKV[ClesQCM]{Stretch}}%
+ \setlength{\LargeurQCM}{\fpeval{(\linewidth-\useKV[ClesQCM]{Reponses}*(3*\tabcolsep+\useKV[ClesQCM]{Largeur}))}pt}%
+ \xdef\NBcases{\fpeval{\useKV[ClesQCM]{Reponses}+1}}%
+ \begin{tabular}{|p{\LargeurQCM}|*{\useKV[ClesQCM]{Reponses}}{>{\centering\arraybackslash}p{\useKV[ClesQCM]{Largeur}}|}}%
+ \cline{2-\NBcases}%
+ \multicolumn{1}{c|}{}&\useKV[ClesQCM]{NomV}&\useKV[ClesQCM]{NomF}\\
+ \hline%
+ \xintFor* ##1 in {\xintSeq {1}{\ListeQCMlen}}\do{%
+ \stepcounter{QuestionQCM}\ifboolKV[ClesQCM]{Alterne}{\modulo{\theQuestionQCM}{2}\ifnum\remainder=0\cellcolor{gray!15}\fi}{}\ifboolKV[ClesQCM]{Alph}{\textbf{\Alph{QuestionQCM}}/}{\textbf{\theQuestionQCM/}}~\ListeQCM[##1,1]\xintFor* ##2 in {\xintSeq {1}{\useKV[ClesQCM]{Reponses}}}\do{%
+ &\ifboolKV[ClesQCM]{Alterne}{\modulo{\theQuestionQCM}{2}\ifnum\remainder=0\cellcolor{gray!15}\fi}{}\ifboolKV[ClesQCM]{Solution}{\xintifboolexpr{##2==\ListeQCM[##1,2]}{$\boxtimes$}{$\square$}}{$\square$}%
+ }\\
+ }%
+ \hline%
+ \end{tabular}
+ }{%
+ \renewcommand{\arraystretch}{\useKV[ClesQCM]{Stretch}}%
+ \setlength{\LargeurQCM}{\fpeval{(\linewidth-\useKV[ClesQCM]{Reponses}*(3*\tabcolsep+\useKV[ClesQCM]{Largeur}))}pt}%
+ \xdef\NBcases{\fpeval{\useKV[ClesQCM]{Reponses}+1}}%
+ \begin{tabular}{|p{\LargeurQCM}|*{\useKV[ClesQCM]{Reponses}}{>{\centering\arraybackslash}p{\useKV[ClesQCM]{Largeur}}|}}%
+ \ifboolKV[ClesQCM]{Titre}{\cline{2-\NBcases}%
+ \multicolumn{1}{c|}{}\xintFor* ##2 in {\xintSeq {1}{\useKV[ClesQCM]{Reponses}}}\do{%
+ &\stepcounter{TitreQCM}\useKV[ClesQCM]{Nom} \ifboolKV[ClesQCM]{AlphT}{\Alph{TitreQCM}}{##2}}%
+ \\
+ }{}
+ \hline%
+ \xintFor* ##1 in {\xintSeq {1}{\ListeQCMlen}}\do{%
+ \stepcounter{QuestionQCM}\ifboolKV[ClesQCM]{Alterne}{\modulo{\theQuestionQCM}{2}\ifnum\remainder=0\cellcolor{gray!15}\fi}{}\ifboolKV[ClesQCM]{Alph}{\textbf{\Alph{QuestionQCM}}/}{\textbf{\theQuestionQCM/}}~\ListeQCM[##1,1]\xintFor* ##2 in {\xintSeq {1}{\useKV[ClesQCM]{Reponses}}}\do{%
+ &\ifboolKV[ClesQCM]{Alterne}{\modulo{\theQuestionQCM}{2}\ifnum\remainder=0\cellcolor{gray!15}\fi}{}\ifboolKV[ClesQCM]{Solution}{\xdef\NumeroReponse{\fpeval{\useKV[ClesQCM]{Reponses}+2}}\xintifboolexpr{##2==\ListeQCM[##1,\NumeroReponse]}{\cellcolor{\useKV[ClesQCM]{Couleur}}}{}}{}\ListeQCM[##1,##2+1]%
+ }\\
+ }%
+ \hline%
+ \end{tabular}%
+ }%
+ }%
+ \renewcommand{\arraystretch}{1}%
+ }%
+}{%
+ \newcommand\QCM[2][]{%
+ \useKVdefault[ClesQCM]%
+ \setKV[ClesQCM]{#1}%
+ \setcounter{QuestionQCM}{\fpeval{\useKV[ClesQCM]{Depart}-1}}%
+ \setcounter{TitreQCM}{0}
+ \setsepchar[*]{,*&}\ignoreemptyitems%
+ \readlist*\ListeQCM{#2}%
+ \ifboolKV[ClesQCM]{Multiple}{%
+ \renewcommand{\arraystretch}{\useKV[ClesQCM]{Stretch}}%
+ \setlength{\LargeurQCM}{\fpeval{(\linewidth-\useKV[ClesQCM]{Reponses}*(3*\tabcolsep+\useKV[ClesQCM]{Largeur}))}pt}%
+ \xdef\NBcases{\fpeval{\useKV[ClesQCM]{Reponses}+1}}%
+ \xdef\ListeNom{\useKV[ClesQCM]{Noms}}%
+ \setsepchar[*]{/}%
+ \readlist*\ListeNomsMul{\ListeNom}%
+ \begin{tabular}{|p{\LargeurQCM}|*{\useKV[ClesQCM]{Reponses}}{>{\centering\arraybackslash}p{\useKV[ClesQCM]{Largeur}}|}}%
+ \cline{2-\NBcases}%
+ \multicolumn{1}{c|}{}\xintFor* ##2 in {\xintSeq {1}{\useKV[ClesQCM]{Reponses}}}\do{%
+ &\ListeNomsMul[##2]}%
+ \\
+ \hline%
+ \xintFor* ##1 in {\xintSeq {1}{\ListeQCMlen}}\do{%
+ \stepcounter{QuestionQCM}\ifboolKV[ClesQCM]{Alterne}{\modulo{\theQuestionQCM}{2}\ifnum\remainder=0\cellcolor{gray!15}\fi}{}\ifboolKV[ClesQCM]{Alph}{\textbf{\Alph{QuestionQCM}}/}{\textbf{\theQuestionQCM/}}~\ListeQCM[##1,1]\xintFor* ##2 in {\xintSeq {1}{\useKV[ClesQCM]{Reponses}}}\do{%
+ &\ifboolKV[ClesQCM]{Alterne}{\modulo{\theQuestionQCM}{2}\ifnum\remainder=0\cellcolor{gray!15}\fi}{}\ifboolKV[ClesQCM]{Solution}{\xintifboolexpr{\ListeQCM[##1,\fpeval{##2+1}]==1}{$\boxtimes$}{$\square$}}{$\square$}%
+ }\\
+ }%
+ \hline%
+ \end{tabular}%
+ \renewcommand{\arraystretch}{1}%
+ }{%
+ \ifboolKV[ClesQCM]{VF}{%
+ \setKV[ClesQCM]{Reponses=2}%
+ \renewcommand{\arraystretch}{\useKV[ClesQCM]{Stretch}}%
+ \setlength{\PfCLargeurQCM}{\useKV[ClesQCM]{Largeur}}%
+ \setlength{\LargeurQCM}{\linewidth-6\tabcolsep-2\PfCLargeurQCM-4\arrayrulewidth}%
+ \xdef\NBcases{\fpeval{\useKV[ClesQCM]{Reponses}+1}}%
+ \begin{tabular}{|p{\LargeurQCM}|*{\useKV[ClesQCM]{Reponses}}{>{\centering\arraybackslash}p{\useKV[ClesQCM]{Largeur}}|}}%
+ \cline{2-\NBcases}%
+ \multicolumn{1}{c|}{}&\useKV[ClesQCM]{NomV}&\useKV[ClesQCM]{NomF}\\
+ \hline%
+ \xintFor* ##1 in {\xintSeq {1}{\ListeQCMlen}}\do{%
+ \stepcounter{QuestionQCM}\ifboolKV[ClesQCM]{Alterne}{\modulo{\theQuestionQCM}{2}\ifnum\remainder=0\cellcolor{gray!15}\fi}{}\ifboolKV[ClesQCM]{Alph}{\textbf{\Alph{QuestionQCM}}/}{\textbf{\theQuestionQCM/}}~\ListeQCM[##1,1]\xintFor* ##2 in {\xintSeq {1}{\useKV[ClesQCM]{Reponses}}}\do{%
+ &\ifboolKV[ClesQCM]{Alterne}{\modulo{\theQuestionQCM}{2}\ifnum\remainder=0\cellcolor{gray!15}\fi}{}\ifboolKV[ClesQCM]{Solution}{\xintifboolexpr{##2==\ListeQCM[##1,2]}{$\boxtimes$}{$\square$}}{$\square$}%
+ }\\
+ }%
+ \hline%
+ \end{tabular}
+ }{%
+ \renewcommand{\arraystretch}{\useKV[ClesQCM]{Stretch}}%
+ \setlength{\LargeurQCM}{\fpeval{(\linewidth-\useKV[ClesQCM]{Reponses}*(3*\tabcolsep+\useKV[ClesQCM]{Largeur}))}pt}%
+ \xdef\NBcases{\fpeval{\useKV[ClesQCM]{Reponses}+1}}%
+ \begin{tabular}{|p{\LargeurQCM}|*{\useKV[ClesQCM]{Reponses}}{>{\centering\arraybackslash}p{\useKV[ClesQCM]{Largeur}}|}}%
+ \ifboolKV[ClesQCM]{Titre}{\cline{2-\NBcases}%
+ \multicolumn{1}{c|}{}\xintFor* ##2 in {\xintSeq {1}{\useKV[ClesQCM]{Reponses}}}\do{%
+ &\stepcounter{TitreQCM}\useKV[ClesQCM]{Nom} \ifboolKV[ClesQCM]{AlphT}{\Alph{TitreQCM}}{##2}}%
+ \\
+ }{}
+ \hline%
+ \xintFor* ##1 in {\xintSeq {1}{\ListeQCMlen}}\do{%
+ \stepcounter{QuestionQCM}\ifboolKV[ClesQCM]{Alterne}{\modulo{\theQuestionQCM}{2}\ifnum\remainder=0\cellcolor{gray!15}\fi}{}\ifboolKV[ClesQCM]{Alph}{\textbf{\Alph{QuestionQCM}}/}{\textbf{\theQuestionQCM/}}~\ListeQCM[##1,1]\xintFor* ##2 in {\xintSeq {1}{\useKV[ClesQCM]{Reponses}}}\do{%
+ &\ifboolKV[ClesQCM]{Alterne}{\modulo{\theQuestionQCM}{2}\ifnum\remainder=0\cellcolor{gray!15}\fi}{}\ifboolKV[ClesQCM]{Solution}{\xdef\NumeroReponse{\fpeval{\useKV[ClesQCM]{Reponses}+2}}\xintifboolexpr{##2==\ListeQCM[##1,\NumeroReponse]}{\cellcolor{\useKV[ClesQCM]{Couleur}}}{}}{}\ListeQCM[##1,##2+1]%
+ }\\
+ }%
+ \hline%
+ \end{tabular}%
+ }%
+ }%
+ \renewcommand{\arraystretch}{1}%
+ }%
+}% \ No newline at end of file