summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/alterqcm/latex/alterqcm.sty
blob: 3ea1a35f68b2831673e777ad89fc74f538d4f896 (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
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
%% alterqcm.sty
%% Copyright (C)  2021n Alain Matthes
%% Copyright (C)  2019 Alain Matthes, Apostolos Syropoulos, and Anastasios Dimou
%% Copyright (C)  2009 Alain Matthes  
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% of this license or (at your option) any later version.
% The latest version of this license is in
%   http://www.latex-project.org/lppl.txt
% and version 1.3 or later is part of all distributions of LaTeX
% version 2005/12/01 or later.
% This work has the LPPL maintenance status `maintained'.
% The Current Maintainer of this work is Alain Matthes
%<------------------------->
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{alterqcm}[2021/05/17 v4.42c]
\newcount\aqlocall@ng% to set language specific strings:
 % 0 stands for French, 1 for English, 2 for German,  3 for Greek ,4 for russian, 5 for italien, 6 for chinese 
\aqlocall@ng=0%
%<------------------------->
  % name of new LANGUAGE
  % codenumber(s) of new LANGUAGE(S), 4, 5, ...;
  % 0..6 = french, english,...
  % title of columns for QUESTIONS
  % title of columns for ANSWERS
  % Continuation ...
\DeclareOption{french}{%           
\def\aqlabelforquest{Questions}%
\def\aqlabelforrep{R\'eponses}%
\def\aqfoottext{suite sur la page suivante\ldots}}% 
                                
%<------------------------->
\DeclareOption{english}{%
\aqlocall@ng=1%
\def\aqlabelforquest{Questions}%
\def\aqlabelforrep{Answers}%
\def\aqfoottext{Continued on the next page\ldots}}%
%<------------------------->
\DeclareOption{german}{%
\aqlocall@ng=2%
\def\aqlabelforquest{Fragen}%
\def\aqlabelforrep{Antworten}%
\def\aqfoottext{Fortsetzung nächste Seite\ldots}}%
%<------------------------->
\DeclareOption{greek}{%
\aqlocall@ng=3%
\def\aqlabelforquest{Ερωτήσεις}%
\def\aqlabelforrep{Απαντήσεις}%
\def\aqfoottext{Συνεχίζεται στην επόμενη σελίδα\ldots}}%
%<------------------------->
\DeclareOption{russian}{%
\aqlocall@ng=4%
\def\aqlabelforquest{Вопросы}%
\def\aqlabelforrep{Ответы}%
\def\aqfoottext{Продолжение на следующей странице\ldots}}%
%<------------------------->
\DeclareOption{italian}{%     
\aqlocall@ng=5%                                          
\def\aqlabelforquest{Domande}  
\def\aqlabelforrep{Risposte}  
\def\aqfoottext{Continua alla pagina successiva\ldots}}
%<------------------------->
\DeclareOption{chinese}{%
\aqlocall@ng=6%
\def\aqlabelforquest{问题}%
\def\aqlabelforrep{答案}%
\def\aqfoottext{请翻页\ldots}}%
%<------------------------->
\DeclareOption{unknown}{%
\aqlocall@ng=7%
\def\aqlabelforquest{unknown}%
\def\aqlabelforrep{unknown}%
\def\aqfoottext{unknown}}%
%<------------------------->
\ExecuteOptions{french}
\ProcessOptions\relax
\RequirePackage{xkeyval}[2005/11/25] 
\RequirePackage{calc}
\RequirePackage{ifthen}
\RequirePackage{array}
\RequirePackage{multirow}
\RequirePackage{pifont}% v1.00
%<--------------------------------------------------------------->
% from RANDOM.TEX       v.1   (Donald Arseneau)
%<--------------------------------------------------------------->
\newcount\aq@randomi % the random number seed (while executing)
\newcounter{aq@identRow}
\newcounter{aq@identCol}
\newcount\aq@tmp
\def\aqutil@empty{}  
\global\aq@randomi\catcode`\@  % scratch variable during definitions
\catcode`\@=11

\def\nextrandom{\begingroup
 \ifnum\aq@randomi<\@ne % then initialize with time
    \global\aq@randomi\time
    \global\multiply\aq@randomi388 \global\advance\aq@randomi\year
    \global\multiply\aq@randomi31 \global\advance\aq@randomi\day
    \global\multiply\aq@randomi97 \global\advance\aq@randomi\month
    \message{Randomizer initialized to \the\aq@randomi.}%
    \nextrandom \nextrandom \nextrandom
 \fi
 \count@ii\aq@randomi
 \divide\count@ii 127773 % modulus = multiplier * 127773 + 2836
 \count@\count@ii
 \multiply\count@ii 127773
 \global\advance\aq@randomi-\count@ii % random mod 127773
 \global\multiply\aq@randomi 16807
 \multiply\count@ 2836
 \global\advance\aq@randomi-\count@
 \ifnum\aq@randomi<\z@ \global\advance\aq@randomi 2147483647\relax\fi
 \endgroup
}

\countdef\count@ii=2 % use only in boxes!
\ifx\@tempcnta\undefined \csname newcount\endcsname \@tempcnta \fi
\ifx\@tempcntb\undefined \csname newcount\endcsname \@tempcntb \fi

\def\setrannum#1#2#3{% count register, minimum, maximum
 \@tempcnta#3\advance\@tempcnta-#2\advance\@tempcnta\@ne
 \@tempcntb 2147483645 %  =  m - 2  =  2^{31} - 3
 \divide\@tempcntb\@tempcnta
 \getr@nval
 \advance\aq@ranval#2\relax
 #1\aq@ranval
}

\def\getr@nval{% The values in \@tempcnta and \@tempcntb are parameters
 \nextrandom
 \aq@ranval\aq@randomi \advance\aq@ranval\m@ne \divide\aq@ranval\@tempcntb
 \ifnum\aq@ranval<\@tempcnta\else \expandafter\getr@nval \fi
}

\catcode`\@=\aq@randomi
\global\aq@randomi=0
\newcount\aq@ranval
%<--------------------------------------------------------------->
\newtoks\aq@tdml@a
\newtoks\aq@tdml@b
\newcount\aq@alea
\newcount\aq@n@arg 
\newbox\aq@tempbox 
\newdimen\aq@hauteurquest 
\newdimen\aq@hauteurprop 
\newdimen\aq@wdquest 
\newdimen\aq@wdprop
\newdimen\aq@dimtmpa 
\newdimen\aq@dimtmpb 
\newdimen\aq@dimtmp 
\newcounter{AQ@numquestion}\setcounter{AQ@numquestion}{0}%
\newcounter{aq@numb}
\newcounter{AQ@numprop}\setcounter{AQ@numprop}{0}% v0.93
\newcounter{alea@numfirst}
\newcounter{alea@numlast}
\newcommand\points[1]{%
\marginpar{%    
\begin{tabular}{|c|}
 \hline  
 \textbf{#1}\\ 
 \hline\\ 
 \hline 
\end{tabular}}}%
\newcommand\aqheightadvance{4pt}% U. Fischer tex.stackexchange
\newcommand\aqdepthadvance{3pt}%
%<------------------------->
%                         Début Code QCM
%       New MC Code (Multiple Choice)
%<------------------------->
% modif 4.3
\define@choicekey*[AQ]{global}{language}[\val\aq@nr]{french,
                                                     english,
                                                     german,
                                                     greek,
                                                     russian,
                                                     italian,
                                                     chinese,
                                                     unknown
                                                     }{%
\edef\AQ@global@language{\aq@nr}
\let\aqlocall@ng\aq@nr
\ifcase\aq@nr\relax
\def\cmdAQ@global@tone{Questions}
\def\cmdAQ@global@ttwo{R\'eponses}
\def\aqfoottext{Suite sur la page suivante\ldots}   
\renewcommand{\aq@pre}{Pour chacune des questions ci-dessous, une seule des r\'eponses propos\'ees est exacte. Vous devez  cocher la r\'eponse exacte sans justification.
Une bonne r\'eponse rapporte \textbf{\cmdAQ@global@bonus\ point}. Une mauvaise r\'eponse enl\`eve \textbf{\cmdAQ@global@malus\ point}.  L'absence de r\'eponse ne rapporte ni n'enl\`eve aucun point. Si le total des points est n\'egatif, la note globale attribu\'ee \`a l'exercice est \textbf{0}.}%
%
\renewcommand{\aq@preVF}{Pour chacune des affirmations ci-dessous, cocher la case V (l'affirmation est vraie) ou la case F (l'affirmation est fausse) sur l'ANNEXE, \`a rendre avec la copie. Les r\'eponses ne seront pas justifi\'ees.
Une bonne r\'eponse rapporte \textbf{\cmdAQ@global@bonus\ point}. Une mauvaise r\'eponse enl\`eve \textbf{\cmdAQ@global@malus\ point}.  L'absence de r\'eponse ne rapporte ni n'enl\`eve aucun point. Si le total des points est n\'egatif, la note globale attribu\'ee \`a l'exercice est \textbf{0}.}%
\or   
\def\cmdAQ@global@tone{Questions}
\def\cmdAQ@global@ttwo{Answers}
\def\aqfoottext{Continued on the next page\ldots} 
\renewcommand{\aq@pre}{For each of the questions below, only one of the proposed answers is true. You must choose the right answer without justification.}%
\renewcommand{\aq@preVF}{For each of the statements below, check the \textbf{T} box (the statement is true) or the \textbf{F} box (the statement is false).}%
\or 
\def\cmdAQ@global@tone{Fragen}
\def\cmdAQ@global@ttwo{Antworten}
\def\aqfoottext{Fortsetzung nächste Seite\ldots} 
\renewcommand{\aq@pre}{Bei jeder der unterstehenden Fragen ist nur eine der vorgeschlagenen Antworten richtig. Kreuzen Sie die richtige Antwort ohne Begründung an.}%
\renewcommand{\aq@preVF}{Bei jeder der unterstehenden Aussagen kreuzen Sie  \textbf{R} (für die richtige Aussage) oder \textbf{F} (für die falsche Aussage) an.}%
\or
\def\cmdAQ@global@tone{Ερωτήσεις}
\def\cmdAQ@global@ttwo{Απαντήσεις}
\def\aqfoottext{Συνεχίζεται στην επόμενη σελίδα\ldots} 
\renewcommand{\aq@pre}{Από τις επόμενες προτάσεις επιλέξετε αυτήν, που θεωρείτε σωστή.}%
\renewcommand{\aq@preVF}{Να επιλέξετε \textbf{Σ}(ωστό), αν θεωρείτε την πρόταση που δίνεται παρακάτω σωστή, ή \textbf{Λ}(άθος) αν την θεωρείτε λανθασμένη.}%
\or
\def\cmdAQ@global@tone{Вопросов}
\def\cmdAQ@global@ttwo{Ответы}
\def\aqfoottext{Продолжение на следующей странице\ldots}
\renewcommand{\aq@pre}{На каждый из приведенных ниже вопросов верным является только один из предложенных ответов.
Проверьте правильный ответ без обоснования.}%
\renewcommand{\aq@preVF}{Для каждого из приведенных ниже утверждений проверьте П (для правильного утверждения) и Ф (для неверного утверждения).}%
\or 
\def\cmdAQ@global@tone{Domande} 
\def\cmdAQ@global@ttwo{Risposte} 
\def\aqfoottext{Continua alla pagina successiva\ldots} 
\renewcommand{\aq@pre} % only one answer is true; choose right answer
{Per ciascuna delle domande che seguono, solo una delle risposte proposte è vera. È necessario scegliere la risposta giusta senza alcuna giustificazione.}%
\renewcommand{\aq@preVF} % only one answer is true; check corresponding box
{Per ciascuna delle seguenti affermazioni, selezionare la casella \textbf{V} (l'affermazione è vera) o la casella \textbf{F} (l'affermazione è falsa).}%
\or 
\def\cmdAQ@global@tone{问题} 
\def\cmdAQ@global@ttwo{答案} 
\def\aqfoottext{请翻页\ldots} 
\renewcommand{\aq@pre}{对于以下提出的各个问题,仅有一个答案是正确的,请选择你认为正确的答案(不需要提供理由)。}%
\renewcommand{\aq@preVF}{对于以下各项陈述,根据陈述内容的正误选择相应的选项(正确的选择“正”,错误的选择“误”)。}%
\or
\def\cmdAQ@global@tone{\aqlabelforquest}
\def\cmdAQ@global@ttwo{\aqlabelforrep}
\def\aqfoottext{unknown\ldots}
\renewcommand{\aq@pre}{\aqpretxt}%
\renewcommand{\aq@preVF}{\aqpretxtVF}%
\fi%
}
\def\aqpretxt{}%
\def\aqpretxtVF{}%
\define@cmdkey  [AQ] {global} {lq}{}
\define@cmdkey  [AQ] {global} {pq}{}
\define@cmdkey  [AQ] {global} {points}{}
\define@cmdkey  [AQ] {global} {symb}{}
\define@cmdkey  [AQ] {global} {corsymb}{}
\define@cmdkey  [AQ] {global} {bonus}{}
\define@cmdkey  [AQ] {global} {malus}{}
\define@cmdkey  [AQ] {global} {numstyle}{}
\define@cmdkey  [AQ] {global} {propstyle}{} 
\define@cmdkey  [AQ] {global} {size}{}
\define@cmdkey  [AQ] {global} {tone}{}  
\define@cmdkey  [AQ] {global} {ttwo}{}
\define@cmdkey  [AQ] {global} {numbreak}{}
\define@cmdkey  [AQ] {global} {afterpreskip}{}
\define@boolkey [AQ] {global} {transparent}[true]{}
\define@boolkey [AQ] {global} {VF}         [true]{}
\define@boolkey [AQ] {global} {sep}        [true]{}
\define@boolkey [AQ] {global} {pre}        [true]{}
\define@boolkey [AQ] {global} {title}      [true]{}
\define@boolkey [AQ] {global} {long}       [true]{}
\define@boolkey [AQ] {global} {num}        [true]{}
\define@boolkey [AQ] {global} {numprop}    [false]{} 
\define@boolkey [AQ] {global} {nosquare}   [false]{} 
\define@boolkey [AQ] {global} {correction} [true]{}
\define@boolkey [AQ] {global} {alea}       [true]{}
\presetkeys     [AQ] {global} {
                               lq          = 100mm,
                               pq          = 0pt,
                               points      = {},
                               sep         = false,
                               pre         = false,
                               bonus       = {0,5},
                               malus       = {0,25},
                               VF          = false,
                               long        = false,
                               symb        = $\square$,
                               corsymb     = $\blacksquare$,
                               afterpreskip = \medskip, 
                               num         = true,
                               transparent = false,
                               nosquare    = false,
                               correction  = false,%v1.00
                               numstyle    = \arabic,
                               propstyle   = \alph,%  v0.93
                               numprop     = false,%   v0.93
                               size        = {}, %3.7 same size la fonte
                               title       = true,
                               ttwo        = \aqlabelforrep,
                               tone        = \aqlabelforquest,
                               numbreak    = 0,
                               alea        = false}{}
\define@cmdkey[AQ]{local}{pq}{}
\define@cmdkey[AQ]{local}{br}{}
\presetkeys[AQ]{local}{br=5,pq= \cmdAQ@global@pq}{}%

\ifcase\aqlocall@ng
\newcommand{\aq@pre}{Pour chacune des questions ci-dessous, une seule des r\'eponses propos\'ees est exacte. Vous devez  cocher la r\'eponse exacte sans justification.
Une bonne r\'eponse rapporte \textbf{\cmdAQ@global@bonus\ point}. Une mauvaise r\'eponse enl\`eve \textbf{\cmdAQ@global@malus\ point}.  L'absence de r\'eponse ne rapporte ni n'enl\`eve aucun point. Si le total des points est n\'egatif, la note globale attribu\'ee \`a l'exercice est \textbf{0}.}%
%
\newcommand{\aq@preVF}{Pour chacune des affirmations ci-dessous, cocher la case V (l'affirmation est vraie) ou la case F (l'affirmation est fausse) sur l'ANNEXE, \`a rendre avec la copie. Les r\'eponses ne seront pas justifi\'ees.
Une bonne r\'eponse rapporte \textbf{\cmdAQ@global@bonus\ point}. Une mauvaise r\'eponse enl\`eve \textbf{\cmdAQ@global@malus\ point}.  L'absence de r\'eponse ne rapporte ni n'enl\`eve aucun point. Si le total des points est n\'egatif, la note globale attribu\'ee \`a l'exercice est \textbf{0}.}%
\or
\newcommand{\aq@pre}{For each of the questions below, only one of the proposed answers is true. You must choose the right answer without justification.}%
\newcommand{\aq@preVF}{For each of the statements below, check the \textbf{T} box (the statement is true) or the \textbf{F} box (the statement is false).}%
\or
\newcommand{\aq@pre}{Bei jeder der unterstehenden Fragen ist nur eine der vorgeschlagenen Antworten richtig. Kreuzen Sie die richtige Antwort ohne Begründung an.}%
\newcommand{\aq@preVF}{Bei jeder der unterstehenden Aussagen kreuzen Sie  \textbf{R} (für die richtige Aussage) oder \textbf{F} (für die falsche Aussage) an.}%
\or
\newcommand{\aq@pre}{Από τις επόμενες προτάσεις επιλέξετε αυτήν, που θεωρείτε σωστή.}%
\newcommand{\aq@preVF}{Να επιλέξετε \textbf{Σ}(ωστό), αν θεωρείτε την πρόταση που δίνεται παρακάτω σωστή, ή \textbf{Λ}(άθος) αν την θεωρείτε λανθασμένη.}%
\or %--- wjb
\newcommand{\aq@pre}{На каждый из приведенных ниже вопросов верным является только один из предложенных ответов.
Проверьте правильный ответ без обоснования.}%
\newcommand{\aq@preVF}{Для каждого из приведенных ниже утверждений проверьте П (для правильного утверждения) и Ф (для неверного утверждения).}%
% Insert text(s) for NEW LANGUAGE(S), e.g. Italian
\or
\newcommand{\aq@pre} % only one answer is true; choose right answer
{Per ciascuna delle domande che seguono, solo una delle risposte proposte è vera. È necessario scegliere la risposta giusta senza alcuna giustificazione.}%
\newcommand{\aq@preVF} % only one answer is true; check corresponding box
{Per ciascuna delle seguenti affermazioni, selezionare la casella \textbf{V} (l'affermazione è vera) o la casella \textbf{F} (l'affermazione è falsa).}%
\or %% TODO 中文
\newcommand{\aq@pre}{对于以下提出的各个问题,仅有一个答案是正确的,请选择你认为正确的答案(不需要提供理由)。}%
\newcommand{\aq@preVF}{对于以下各项陈述,根据陈述内容的正误选择相应的选项(正确的选择“正”,错误的选择“误”)。}%
\or % unknown
\newcommand{\aq@pre}{\aqpretxt}%
\newcommand{\aq@preVF}{\aqpretxtVF}%
\fi
%
\newcommand*{\AQms}{\aq@ms}%
\def\aq@ms(#1,#2){\vrule height #1pt depth #2pt width 0pt}
\newcommand*{\altersquare}{\mbox{\vbox{\hrule\hbox to 6pt{\vrule height 5.2pt \hfil\vrule}\hrule}}}%
\@ifundefined{square}{\let\square\altersquare}{}%

\newcommand*{\dingsquare}{\ding{114}}%
\newcommand*{\dingchecksquare}{\mbox{\ding{114}\hspace{-.7em}\raisebox{.2ex}[1ex]{\ding{51}}}} 
\newcommand*{\aq@style@title}{\textbf}%
\newcommand*{\aq@style@numquest}{\textbf}% 
\newcommand*{\aq@style@numrep}{\textbf}%
\newcommand{\aq@title}{%
\hline%
   \hfil{\aq@style@title{\cmdAQ@global@tone}}\hfil%
 & \hfil{\aq@style@title{\cmdAQ@global@ttwo}}\hfil\\ \hline%
 \ifAQ@global@long \endfirsthead
\hline 
   \hfil{\aq@style@title{\cmdAQ@global@tone}}\hfil%
 & \hfil{\aq@style@title{\cmdAQ@global@ttwo}}\hfil\\ \hline%
\endhead
& \raisebox{-1em}\hfill{\emph{\aqfoottext}} \\ \hline
\endfoot
\endlastfoot\fi
}%

\newcommand{\AQmessage}[1]{%
\multicolumn{2}{|l|}{%
\begin{minipage}{\textwidth-\tabcolsep*2-\arrayrulewidth*2}%
#1
\end{minipage}}\\ \hline%
}%

\newcommand{\aq@melange}{%
\setrannum{\aq@alea}{1}{\value{aq@numb}}% 
   \ifcase\aq@alea%
      \or
      \global\let\aq@tempfirst\aq@arga
      \or
      \global\let\aq@tempfirst\aq@argb
      \or
      \global\let\aq@tempfirst\aq@argc
      \or
      \global\let\aq@tempfirst\aq@argd
      \or
      \global\let\aq@tempfirst\aq@arge
      \fi
\setcounter{alea@numfirst}{\aq@alea}%
\setrannum{\aq@alea}{1}{\value{aq@numb}}%
   \ifcase\aq@alea%
      \or
      \global\let\aq@templast\aq@arga
      \or
      \global\let\aq@templast\aq@argb
      \or
      \global\let\aq@templast\aq@argc
      \or
      \global\let\aq@templast\aq@argd
      \or
      \global\let\aq@templast\aq@arge
      \fi
\setcounter{alea@numlast}{\aq@alea}%
\global\let\aq@temp\aq@tempfirst%
\global\let\aq@tempfirst\aq@templast%
\global\let\aq@templast\aq@temp%
\global\expandafter\let\csname aq@arg\alph{alea@numfirst}%
\endcsname\aq@tempfirst%
\global\expandafter\let\csname aq@arg\alph{alea@numlast}%
\endcsname\aq@templast%
}%
%<------------------------->
\newcommand{\aq@hauteurbox}[1]{%
\setbox\aq@tempbox=%
\vbox{\parbox[t]{\textwidth-\tabcolsep*4-\arrayrulewidth*3-\cmdAQ@global@lq}%
{\cmdAQ@global@symb\quad\mbox{#1}}}% \cmdAQ@global@symb remplace $\square$
\aq@dimtmpa\ht\aq@tempbox\relax%  
\aq@dimtmpb\dp\aq@tempbox\relax%  
\advance\aq@dimtmpa by\aq@dimtmpb}%
%<------------------------->
\newcommand{\aq@adjust}[1]{%
\setbox\aq@tempbox=%
\vbox{%
\parbox[t]{\cmdAQ@global@lq}{\aq@style@numquest{\number\value{AQ@numquestion}.}\hspace{3pt}#1}}%
\aq@dimtmpa\ht\aq@tempbox
\aq@dimtmpb\dp\aq@tempbox
\aq@wdquest\wd\aq@wdquest
\advance\aq@dimtmpa by\aq@dimtmpb\relax% 
\aq@hauteurquest=\aq@dimtmpa
\aq@hauteurbox{\aq@arga}%
\aq@hauteurprop=\aq@dimtmpa
\aq@hauteurbox{\aq@argb}%
\advance\aq@hauteurprop by\aq@dimtmpa\relax% 
\ifnum\value{aq@numb}>2\relax
\aq@hauteurbox{\aq@argc}%
\advance\aq@hauteurprop by\aq@dimtmpa\relax\fi 
\ifnum\value{aq@numb}>3\relax
\aq@hauteurbox{\aq@argd}%
\advance\aq@hauteurprop by\aq@dimtmpa\relax\fi
\ifnum\value{aq@numb}>4\relax
\aq@hauteurbox{\aq@arge}%
\advance\aq@hauteurprop by\aq@dimtmpa\relax\fi
\ifdim\aq@hauteurquest<\aq@hauteurprop%
\global\aq@dimtmp=0pt
\aq@dimtmpa\ht\aq@tempbox
\aq@dimtmpb\dp\aq@tempbox
\advance\aq@dimtmpa by3pt
\advance\aq@dimtmpb by2pt
\vrule height\aq@dimtmpa depth\aq@dimtmpb width0pt
\else
\advance\aq@hauteurquest by-\aq@hauteurprop
\divide\aq@hauteurquest by\theaq@numb\relax
\divide\aq@hauteurquest by2\relax%
\global\aq@dimtmp=\aq@hauteurquest\fi
}%
%<------------------------->
\newcommand{\aq@prop}[2]{%
\setbox\aq@tempbox=\vbox{#1}%
\aq@wdprop\wd\aq@tempbox
\aq@dimtmpa\ht\aq@tempbox\advance\aq@dimtmpa by\aqheightadvance\advance\aq@dimtmpa by\aq@dimtmp\relax
\aq@dimtmpb\dp\aq@tempbox\advance\aq@dimtmpb by\aqdepthadvance\advance\aq@dimtmpb by\aq@dimtmp\relax
\ifAQ@global@VF\hfil\fi 
\ifAQ@global@transparent\def\cmdAQ@global@corsymb{$\bigcirc$}%
\def\cmdAQ@global@symb{}\fi
\ifAQ@global@numprop\stepcounter{AQ@numprop}%
{\aq@style@numrep{(\cmdAQ@global@propstyle{AQ@numprop})}}%
\else
  \ifAQ@global@nosquare
    \else%
      \ifAQ@global@correction
      \def\@stop{1}
        \@for\goodrep:=\cmdAQ@local@br\do{%
        \ifnum\@stop<6 %
         \global\let\mysymb\cmdAQ@global@symb
         \ifthenelse{\equal{\goodrep}{#2}}{%
                     \global\let\mysymb\cmdAQ@global@corsymb \def\@stop{9}}{%
                     }%
                     \fi}%
                     \mysymb\hspace*{6pt}%
      \else 
          \cmdAQ@global@symb\hspace*{6pt}%
       \fi
      \fi
 \fi
 \ifAQ@global@transparent
 \vrule height0pt depth0pt width\aq@wdprop
 \else
 \ignorespaces#1%
 \fi
 \vrule height\aq@dimtmpa depth\aq@dimtmpb width0pt
 \ifAQ@global@VF\hfil\fi}%
%<------------------------->
\newcommand{\AQquestion}[3][]{%
\setkeys[AQ]{local}{#1}%
\stepcounter{AQ@numquestion}% 
\setcounter{AQ@numprop}{0} % v0.93
\setcounter{aq@numb}{0}%
\@for\liste:=#3\do{%
\stepcounter{aq@numb}%
\begingroup
\ifnum\aqlocall@ng=3 \nogreekalph\fi
\global\expandafter\let\csname aq@arg\alph{aq@numb}\endcsname\liste
\endgroup}%
\ifAQ@global@alea\ifAQ@global@VF
\else
\aq@n@arg=0 %
\loop\ifnum\aq@n@arg<\value{aq@numb}\aq@melange\advance\aq@n@arg by1\repeat\fi
\fi
\aq@adjust{#2}%
\multirow{1}{\cmdAQ@global@lq}[\cmdAQ@local@pq]{%
\ifAQ@global@num\aq@style@numquest{\cmdAQ@global@numstyle{AQ@numquestion}.}%
\hspace{3pt}\fi
\ifAQ@global@transparent%
\hrule height0pt depth0pt width\aq@wdquest%
\else
#2\vss
\fi
 }%
&\setkeys[AQ]{local}{#1}%
      \aq@prop{\aq@arga}{1}\\%
      \ifAQ@global@sep\cline{2-2}\fi
&\setkeys[AQ]{local}{#1}%
      \aq@prop{\aq@argb}{2}\\
      \ifAQ@global@sep\cline{2-2}\fi
      \ifnum\value{aq@numb}=2\hline\else\ifAQ@global@sep\cline{2-2}\fi
&\setkeys[AQ]{local}{#1}%
      \aq@prop{\aq@argc}{3}\\
      \ifnum\value{aq@numb}=3\hline\else\ifAQ@global@sep\cline{2-2}\fi
&\setkeys[AQ]{local}{#1}%
      \aq@prop{\aq@argd}{4}\\
      \ifnum\value{aq@numb}=4\hline\else\ifAQ@global@sep\cline{2-2}\fi
&\setkeys[AQ]{local}{#1}%
     \aq@prop{\aq@arge}{5}\\
\hline\fi\fi\fi}%
%<------------------------->
\def\aqtextfortrue{\textbf{V}}
\def\aqtextforfalse{\textbf{F}}
\newcommand{\aq@questionVF}[2][]{%
\setkeys[AQ]{local}{#1}
\stepcounter{AQ@numquestion}% 
\setcounter{AQ@numprop}{0}% v0.93 
\ifcase\aqlocall@ng
\protected@xdef\aq@arga{\textbf{V}}
\protected@xdef\aq@argb{\textbf{F}}
\or
\protected@xdef\aq@arga{\textbf{T}}
\protected@xdef\aq@argb{\textbf{F}}
\or
\protected@xdef\aq@arga{\textbf{R}}
\protected@xdef\aq@argb{\textbf{F}}
\or
\protected@xdef\aq@arga{\textbf{Σ}}
\protected@xdef\aq@argb{\textbf{Λ}}
\or %--- wjb
\protected@xdef\aq@arga{\textbf{П}}
\protected@xdef\aq@argb{\textbf{Ф}}
\or
\protected@xdef\aq@arga{\textbf{V}}
\protected@xdef\aq@argb{\textbf{F}}
\or 
\protected@xdef\aq@arga{\textbf{正}}
\protected@xdef\aq@argb{\textbf{误}}
\or
\protected@xdef\aq@arga{\aqtextfortrue}
\protected@xdef\aq@argb{\aqtextforfalse}
\fi
\setcounter{aq@numb}{2}%
\aq@adjust{#2}%
\multirow{3}{\cmdAQ@global@lq}[\cmdAQ@local@pq]{%
\ifAQ@global@num\aq@style@numquest{\cmdAQ@global@numstyle{AQ@numquestion}.}\hspace{3pt}\fi
#2\vss}%
  &\setkeys[AQ]{local}{#1}\aq@prop{\aq@arga}{1}\\
\ifAQ@global@sep \cline{2-2}\fi 
  &\setkeys[AQ]{local}{#1}\aq@prop{\aq@argb}{2}\\
\hline}%
%<------------------------->
\newenvironment{alterqcm}[1][]{%
\ifAQ@global@numprop \setkeys [AQ] {global} {nosquare = true}{}\fi
\setkeys[AQ]{global}{#1}%
\ifx\aqutil@empty\cmdAQ@global@points \else
\points{\cmdAQ@global@points}
\fi
\setcounter{AQ@numquestion}{\cmdAQ@global@numbreak}%
\ifAQ@global@VF\let\AQquestion\aq@questionVF\let\aq@pre\aq@preVF\fi
\ifAQ@global@pre\aq@pre\par\cmdAQ@global@afterpreskip\fi
\ifAQ@global@long%
\setlength\LTleft{0pt}%
\setlength\LTright\fill%
\setlength{\LTpre}{\intextsep}%
\setlength{\LTpost}{\intextsep}%
\begin{longtable}[l]{%
@{}|>{\cmdAQ@global@size}p{\cmdAQ@global@lq}!{\extracolsep{\fill}}%
|>{\cmdAQ@global@size}p{\textwidth-\tabcolsep*4-\arrayrulewidth*3-\cmdAQ@global@lq}|@{}}%
 \else
   \begin{tabular}{%
    @{}|>{\cmdAQ@global@size}p{\cmdAQ@global@lq}%
    |>{\cmdAQ@global@size}p{%
       \textwidth-\tabcolsep*4-\arrayrulewidth*3-\cmdAQ@global@lq}%
    |@{}}%
 \fi
 \ifAQ@global@title\aq@title\else\hline\fi%
}%
{\ifAQ@global@long
 \end{longtable}%
 \else
 \end{tabular}%
 \fi
}%
%<------------------------->
% #1 chemin & #2 theme & #3 liste de numéros
% code de JC Charpentier
%----------------------------------------------------------%
\newcommand\InputQuestionList[3]{% 
  \aq@tdml@a={}%
  \aq@tdml@b={}%
  \ifx\relax#3\relax\else
    \tdml@#3,\@nil,\expandafter\tdml@clean\the\aq@tdml@a\@nil
  \fi
   \expandafter\gdef\expandafter\last@val\expandafter{\the\aq@tdml@b}%
  \AQ@TA{#1}{#2}{\the\aq@tdml@a}%
  \AQ@TB{#1}{#2}{\last@val}}
%----------------------------------------------------------%
\long\def\tdml@#1,{%
  \ifx\@nil#1\relax
  \else
    \expandafter\addtotoks\the\aq@tdml@b,\to\aq@tdml@a
    \aq@tdml@b={#1}%
    \expandafter\tdml@
  \fi
}
%----------------------------------------------------------%
\long\def\addtotoks#1\to#2{%
  #2=\expandafter{\the#2#1}%
}%
%----------------------------------------------------------%
\long\def\tdml@clean,#1\@nil{%
  \ifx\relax#1\relax
    \aq@tdml@a{}%
  \else
    \tdml@@clean#1\@nil
  \fi
}
%----------------------------------------------------------%
\long\def\tdml@@clean#1,\@nil{%
    \aq@tdml@a{#1}%
}%
%----------------------------------------------------------%
%----------------------------------------------------------%
\newcommand\AQ@TA[3]{\@for\nb:=#3\do{%
\input #1#2\nb}%
}%
\newcommand\AQ@TB[3]{\input#1#2#3}%
%----------------------------------------------------------% 
% from forloop.sty
\newcommand{\aq@forLoop}[5][1]
{%
\setcounter{#4}{#2}%
\ifthenelse{\value{#4}<#3}%
{#5\addtocounter{#4}{#1}%
\aq@forLoop[#1]{\value{#4}}{#3}{#4}{#5}%
}%
{\ifthenelse{\value{#4}=#3}%
{#5}{}}}%

%----------------------------------------------------------%
\def\aq@tvi(#1,#2){\vrule height #1pt depth #2pt width 0pt}
\define@cmdkey [AQ] {ann} {propstyle}[true]{}
\define@boolkey[AQ] {ann} {VF}[true]{}
\presetkeys    [AQ] {ann} {propstyle   = \arabic,
                           VF          = false}{}
\newcommand*{\AQannexe}[4][]{%
\setkeys[AQ]{ann}{#1}% 
\aq@tmp=#4 %
\advance\aq@tmp by 1 %
\begin{tabular}{*{\number\aq@tmp}{|>{\hfill}c}|}\hline%
 \ifAQ@ann@VF%
N&V&F%
 \else
N\aq@forLoop{1}{#4}{aq@identCol}%
   {& \cmdAQ@ann@propstyle{aq@identCol}}\fi
\tabularnewline\hline%
\aq@forLoop{#2}{#3}{aq@identRow}
 {\number\value{aq@identRow}&%
 \aq@forLoop{2}{\number\aq@tmp}{aq@identCol}%
    {$\ $%
    \ifthenelse{\equal{\value{aq@identCol}}{#4}}{}{&}%
    }%
\tabularnewline\hline}%
\end{tabular}%
}%
%----------------------------------------------------------%
\newcommand\AQpoints[1]{%
\marginpar{%    
\begin{tabular}{|c|}
 \hline  
 \textbf{#1}\\ 
 \hline\\ 
 \hline 
\end{tabular}}} 
\endinput