summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/interactiveworkbook/interactiveworkbook.sty/interactiveworkbook.sty
blob: b8661905849126b1321de8f22e30fb85bf65b78a (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
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%   INTERACTIVEWORKBOOK STYLE FILE: put this file in /tex/latex/graphics file
%                                   if using MiKTeX for Windows
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\NeedsTeXFormat{LaTeX2e}[1995/06/01]
\ProvidesPackage{interactiveworkbook}[1999/06/04]

\RequirePackage{epsfig} % allows text fields, to be placed anywhere on page
\RequirePackage{color} % allows fonts to be colored
\RequirePackage{xspace} % allows appropriate space after fieldone, say
\RequirePackage{ifthen} % allows question taker to choose between clear, submit buttons

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%  BUTTON APPEARANCE: PREVIOUS, INDEX, NEXT, EXERQUES, SUBMIT, CLEAR, RETURN,
%                     SELECTED (UP) AND UNSELECTED (DOWN)
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\AtBeginDocument{\epsfig{file=buttonappearance.eps,height=1bp,width=1bp}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%  THREE PAGE OUTPUT FOR EACH QUESTION (ONE *EXERCISE* OFTEN HAS MANY QUESTIONS):
%  QUESTION (FIRST) PAGE, CORRECT (SECOND) PAGE, INCORRECT (THIRD) PAGE
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newcommand{\questionandresponses}[7]{ % seven arguments
    \setcounter{page}{1} % specifies "page one" versions of check, popup, field and radio buttons
    \textcolor{black}{#5} % put question, argument #5, on first page (of three) pages
    \vfill
    % locations of previous, index and next exercise files are [2], [3], [4], respectively
    \prevsetup{#2} \ndexsetup{#3} \nextsetup{#4}
    \begin{center} % Clear, argument #1, is either check, popup, field or radio
        \clear{#1} \hfill \prev \ndex \next \hfill \submit{#1}
    \end{center} % Previous, Index, Next, and Submit Buttons
    % put correct response page on second page
    \newpage
    \setcounter{page}{2} % specifies "page two" versions of check, popup, field and radio buttons
    \textcolor{black}{#5} % repeat question, argument #5, on correct response page
    \par\smallskip %
    % blue correct answer hint is argument #6
    \textcolor{blue}{#6} % give hint related to correct answer
    \par\vfill %
    % \correct (answer), argument #1, is either check, popup, field or radio
    % \correct, argument #2, is found on the correct (response) page
    \begin{center}
        \correct{#1}{right} \hfill \prev \ndex \next \hfill \return
    \end{center} % Return from response to question page
    % put incorrect response page on third page
    \newpage
    \setcounter{page}{3} % specifies "page three" versions of check, popup, field and radio buttons
    \textcolor{black}{#5} % repeat question, argument #5, on incorrect response page
    \par\smallskip %
    % red incorrect answer hint is argument #7
    \textcolor{red}{#7} % give hint related to correct answer
    \par\vfill %
    \begin{center} % \correct, argument #2, is found on the correct (response) page
        \correct{#1}{wrong} \hfill \prev \ndex \next \hfill \return
    \end{center} % Return from response to question page
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%  QUESTION *TAKER* ANSWERS: CHECK, FIELD, POPUP, RADIO
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% five check boxes, for question taker,
% first click puts in "X" (button is "on"), second click removes "X" (button is "off")

\newcommand{\checkone}{% check box one, for either page one, two or three
    \ifthenelse{\equal{\value{page}}{1}}{\epsfig{file=pageonecheckone.eps,height=10bp}}{}
    \ifthenelse{\equal{\value{page}}{2}}{\epsfig{file=pagetwocheckone.eps,height=10bp}}{}
    \ifthenelse{\equal{\value{page}}{3}}{\epsfig{file=pagethreecheckone.eps,height=10bp}}{}
    \relax\xspace%
}
\newcommand{\checktwo}{% check box two
    \ifthenelse{\equal{\value{page}}{1}}{\epsfig{file=pageonechecktwo.eps,height=10bp}}{}
    \ifthenelse{\equal{\value{page}}{2}}{\epsfig{file=pagetwochecktwo.eps,height=10bp}}{}
    \ifthenelse{\equal{\value{page}}{3}}{\epsfig{file=pagethreechecktwo.eps,height=10bp}}{}
    \relax\xspace%
}
\newcommand{\checkthree}{% check box three
    \ifthenelse{\equal{\value{page}}{1}}{\epsfig{file=pageonecheckthree.eps,height=10bp}}{}
    \ifthenelse{\equal{\value{page}}{2}}{\epsfig{file=pagetwocheckthree.eps,height=10bp}}{}
    \ifthenelse{\equal{\value{page}}{3}}{\epsfig{file=pagethreecheckthree.eps,height=10bp}}{}
    \relax\xspace%
}
\newcommand{\checkfour}{% check box four
    \ifthenelse{\equal{\value{page}}{1}}{\epsfig{file=pageonecheckfour.eps,height=10bp}}{}
    \ifthenelse{\equal{\value{page}}{2}}{\epsfig{file=pagetwocheckfour.eps,height=10bp}}{}
    \ifthenelse{\equal{\value{page}}{3}}{\epsfig{file=pagethreecheckfour.eps,height=10bp}}{}
    \relax\xspace%
}
\newcommand{\checkfive}{% check box five
    \ifthenelse{\equal{\value{page}}{1}}{\epsfig{file=pageonecheckfive.eps,height=10bp}}{}
    \ifthenelse{\equal{\value{page}}{2}}{\epsfig{file=pagetwocheckfive.eps,height=10bp}}{}
    \ifthenelse{\equal{\value{page}}{3}}{\epsfig{file=pagethreecheckfive.eps,height=10bp}}{}
    \relax\xspace%
}

% five text fields, for question taker

\newcommand{\fieldone}{
    \ifthenelse{\equal{\value{page}}{1}}{\epsfig{file=pageonefieldone.eps,height=15bp}}{}
    \ifthenelse{\equal{\value{page}}{2}}{\epsfig{file=pagetwofieldone.eps,height=15bp}}{}
    \ifthenelse{\equal{\value{page}}{3}}{\epsfig{file=pagethreefieldone.eps,height=15bp}}{}
    \relax\xspace%
}
\newcommand{\fieldtwo}{% text field two
    \ifthenelse{\equal{\value{page}}{1}}{\epsfig{file=pageonefieldtwo.eps,height=15bp}}{}
    \ifthenelse{\equal{\value{page}}{2}}{\epsfig{file=pagetwofieldtwo.eps,height=15bp}}{}
    \ifthenelse{\equal{\value{page}}{3}}{\epsfig{file=pagethreefieldtwo.eps,height=15bp}}{}
    \relax\xspace%
}
\newcommand{\fieldthree}{% text field three
    \ifthenelse{\equal{\value{page}}{1}}{\epsfig{file=pageonefieldthree.eps,height=15bp}}{}
    \ifthenelse{\equal{\value{page}}{2}}{\epsfig{file=pagetwofieldthree.eps,height=15bp}}{}
    \ifthenelse{\equal{\value{page}}{3}}{\epsfig{file=pagethreefieldthree.eps,height=15bp}}{}
    \relax\xspace%
}
\newcommand{\fieldfour}{% text field four
    \ifthenelse{\equal{\value{page}}{1}}{\epsfig{file=pageonefieldfour.eps,height=15bp}}{}
    \ifthenelse{\equal{\value{page}}{2}}{\epsfig{file=pagetwofieldfour.eps,height=15bp}}{}
    \ifthenelse{\equal{\value{page}}{3}}{\epsfig{file=pagethreefieldfour.eps,height=15bp}}{}
    \relax\xspace%
}
\newcommand{\fieldfive}{% text field five
    \ifthenelse{\equal{\value{page}}{1}}{\epsfig{file=pageonefieldfive.eps,height=15bp}}{}
    \ifthenelse{\equal{\value{page}}{2}}{\epsfig{file=pagetwofieldfive.eps,height=15bp}}{}
    \ifthenelse{\equal{\value{page}}{3}}{\epsfig{file=pagethreefieldfive.eps,height=15bp}}{}
    \relax\xspace%
}

% five popup menus, for question taker,
% nine possible choices, a,b,c,d,e,f,g,h and i, each popup

\newcommand{\popupone}{ % popup menu one, for pages one, two and three
    \ifthenelse{\equal{\value{page}}{1}}{\epsfig{file=pageonepopupone.eps,height=15bp}}{}
    \ifthenelse{\equal{\value{page}}{2}}{\epsfig{file=pagetwopopupone.eps,height=15bp}}{}
    \ifthenelse{\equal{\value{page}}{3}}{\epsfig{file=pagethreepopupone.eps,height=15bp}}{}
    \relax\xspace%
}
\newcommand{\popuptwo}{% popup menu two
    \ifthenelse{\equal{\value{page}}{1}}{\epsfig{file=pageonepopuptwo.eps,height=15bp}}{}
    \ifthenelse{\equal{\value{page}}{2}}{\epsfig{file=pagetwopopuptwo.eps,height=15bp}}{}
    \ifthenelse{\equal{\value{page}}{3}}{\epsfig{file=pagethreepopuptwo.eps,height=15bp}}{}
    \relax\xspace%
}
\newcommand{\popupthree}{% popup menu three
    \ifthenelse{\equal{\value{page}}{1}}{\epsfig{file=pageonepopupthree.eps,height=15bp}}{}
    \ifthenelse{\equal{\value{page}}{2}}{\epsfig{file=pagetwopopupthree.eps,height=15bp}}{}
    \ifthenelse{\equal{\value{page}}{3}}{\epsfig{file=pagethreepopupthree.eps,height=15bp}}{}
    \relax\xspace%
}
\newcommand{\popupfour}{% popup menu four
    \ifthenelse{\equal{\value{page}}{1}}{\epsfig{file=pageonepopupfour.eps,height=15bp}}{}
    \ifthenelse{\equal{\value{page}}{2}}{\epsfig{file=pagetwopopupfour.eps,height=15bp}}{}
    \ifthenelse{\equal{\value{page}}{3}}{\epsfig{file=pagethreepopupfour.eps,height=15bp}}{}
    \relax\xspace%
}
\newcommand{\popupfive}{% popup menu five
    \ifthenelse{\equal{\value{page}}{1}}{\epsfig{file=pageonepopupfive.eps,height=15bp}}{}
    \ifthenelse{\equal{\value{page}}{2}}{\epsfig{file=pagetwopopupfive.eps,height=15bp}}{}
    \ifthenelse{\equal{\value{page}}{3}}{\epsfig{file=pagethreepopupfive.eps,height=15bp}}{}
    \relax\xspace%
}

% five radio buttons, for question taker,
% choose (only) one of five possible choices, a,b,c,d and e

\newcommand{\radioone}{ % radio button one, 11by seems to be "right" height for radio button
    \ifthenelse{\equal{\value{page}}{1}}{\epsfig{file=pageoneradioone.eps,height=11bp}}{}
    \ifthenelse{\equal{\value{page}}{2}}{\epsfig{file=pagetworadioone.eps,height=11bp}}{}
    \ifthenelse{\equal{\value{page}}{3}}{\epsfig{file=pagethreeradioone.eps,height=11bp}}{}
    \relax\xspace%
}
\newcommand{\radiotwo}{% radio button two
    \ifthenelse{\equal{\value{page}}{1}}{\epsfig{file=pageoneradiotwo.eps,height=11bp}}{}
    \ifthenelse{\equal{\value{page}}{2}}{\epsfig{file=pagetworadiotwo.eps,height=11bp}}{}
    \ifthenelse{\equal{\value{page}}{3}}{\epsfig{file=pagethreeradiotwo.eps,height=11bp}}{}
    \relax\xspace%
}
\newcommand{\radiothree}{% radio button three
    \ifthenelse{\equal{\value{page}}{1}}{\epsfig{file=pageoneradiothree.eps,height=11bp}}{}
    \ifthenelse{\equal{\value{page}}{2}}{\epsfig{file=pagetworadiothree.eps,height=11bp}}{}
    \ifthenelse{\equal{\value{page}}{3}}{\epsfig{file=pagethreeradiothree.eps,height=11bp}}{}
    \relax\xspace%
}
\newcommand{\radiofour}{% radio button four
    \ifthenelse{\equal{\value{page}}{1}}{\epsfig{file=pageoneradiofour.eps,height=11bp}}{}
    \ifthenelse{\equal{\value{page}}{2}}{\epsfig{file=pagetworadiofour.eps,height=11bp}}{}
    \ifthenelse{\equal{\value{page}}{3}}{\epsfig{file=pagethreeradiofour.eps,height=11bp}}{}
    \relax\xspace%
}
\newcommand{\radiofive}{% radio button five
    \ifthenelse{\equal{\value{page}}{1}}{\epsfig{file=pageoneradiofive.eps,height=11bp}}{}
    \ifthenelse{\equal{\value{page}}{2}}{\epsfig{file=pagetworadiofive.eps,height=11bp}}{}
    \ifthenelse{\equal{\value{page}}{3}}{\epsfig{file=pagethreeradiofive.eps,height=11bp}}{}
    \relax\xspace%
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%  QUESTION *GIVER* ANSWERS, FOR CHECK, POPUP, FIELD, RADIO
%       DUMMY BUTTONS WHICH DO NOT APPEAR ON THE SCREEN
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% five check boxes, for question giver,
% designates button "On" ("X") or "Off" (removes "X")

\newcommand{\answercheckone}[1]{% check box answer one, argument [1] is "On" or "Off"
    \special{ps::
    [
        /T (checkanswer1) % title is checkanswer1, used in checksubmit.eps
        /Rect [0 0 30 30] % dummy check box print area, does not appear on screen
        /Subtype /Widget % check box widget
        /F 4 % printable, "X" or not "X"
        /FT /Btn % type, check box
        /V(#1) % argument #1 is value (when window first opened), which is "On" or "Off"
        /DV(#1) % default value, if reset, is "On" or "Off", whatever argument #1 is
    /ANN pdfmark
    }%
    \relax\xspace%
}
\newcommand{\answerchecktwo}[1]{% check box answer two
    \special{ps::
    [
        /T (checkanswer2)
        /Rect [0 0 30 30]
        /Subtype /Widget
        /F 4
        /FT /Btn
        /DV(#1)
        /V(#1)
    /ANN pdfmark
    }%
    \relax\xspace%
}
\newcommand{\answercheckthree}[1]{% check box answer three
    \special{ps::
    [
        /T (checkanswer3)
        /Rect [0 0 30 30]
        /Subtype /Widget
        /F 4
        /FT /Btn
        /DV(#1)
        /V(#1)
    /ANN pdfmark
    }%
    \relax\xspace%
}
\newcommand{\answercheckfour}[1]{% check box answer four
    \special{ps::
    [
        /T (checkanswer4)
        /Rect [0 0 30 30]
        /Subtype /Widget
        /F 4
        /FT /Btn
        /DV(#1)
        /V(#1)
    /ANN pdfmark
    }%
    \relax\xspace%
}
\newcommand{\answercheckfive}[1]{% check box answer five
    \special{ps::
    [
        /T (checkanswer5)
        /Rect [0 0 30 30]
        /Subtype /Widget
        /F 4
        /FT /Btn
        /DV(#1)
        /V(#1)
    /ANN pdfmark
    }%
    \relax\xspace%
}

% five popup menu answers, for question giver,
% correct answers typed in tex files, as argument of "answerpopup..."

\newcommand{\answerpopupone}[1]{% argument [1] text answer
    \special{ps::
    [
        /T (popupanswer1) % question giver text *title* used in various submit.eps
        /Subtype /Widget
        /FT /Ch  % popup (choice, list) menu
        /Ff 393216 % popup list
        /Opt [ [(a)(a)] [(b)(b)] [(c)(c)] [(d)(d)] [(e)(e)] [(f)(f)] [(g)(g)] [(h)(h)] [(i)(i)] ]
        /Rect [500 2290 560 2320] % dummy popup menu
        /V (#1) % argument is question giver text
        /DV (#1) % argument is question giver text
    /ANN pdfmark
    }%
    \relax\xspace%
}
\newcommand{\answerpopuptwo}[1]{
    \special{ps::
    [
        /T (popupanswer2)
        /Subtype /Widget
        /FT /Ch
        /Ff 393216
        /Opt [ [(a)(a)] [(b)(b)] [(c)(c)] [(d)(d)] [(e)(e)] [(f)(f)] [(g)(g)] [(h)(h)] [(i)(i)] ]
        /Rect [500 2290 560 2320]
        /F 4
        /V (#1)
        /DV (#1)
    /ANN pdfmark
    }%
    \relax\xspace%
}
\newcommand{\answerpopupthree}[1]{
    \special{ps::
    [
        /T (popupanswer3)
        /Subtype /Widget
        /FT /Ch
        /Ff 393216
        /Opt [ [(a)(a)] [(b)(b)] [(c)(c)] [(d)(d)] [(e)(e)] [(f)(f)] [(g)(g)] [(h)(h)] [(i)(i)] ]
        /Rect [500 2290 560 2320]
        /F 4
        /V (#1)
        /DV (#1)
    /ANN pdfmark
    }%
    \relax\xspace%
}
\newcommand{\answerpopupfour}[1]{
    \special{ps::
    [
        /T (popupanswer4)
        /Subtype /Widget
        /FT /Ch
        /Ff 393216
        /Opt [ [(a)(a)] [(b)(b)] [(c)(c)] [(d)(d)] [(e)(e)] [(f)(f)] [(g)(g)] [(h)(h)] [(i)(i)] ]
        /Rect [500 2290 560 2320]
        /F 4
        /V (#1)
        /DV (#1)
    /ANN pdfmark
    }%
    \relax\xspace%
}
\newcommand{\answerpopupfive}[1]{
    \special{ps::
    [
        /T (popupanswer5)
        /Subtype /Widget
        /FT /Ch
        /Ff 393216
        /Opt [ [(a)(a)] [(b)(b)] [(c)(c)] [(d)(d)] [(e)(e)] [(f)(f)] [(g)(g)] [(h)(h)] [(i)(i)] ]
        /Rect [500 2290 560 2320]
        /F 4
        /V (#1)
        /DV (#1)
    /ANN pdfmark
    }%
    \relax\xspace%
}

% five answers, for user,
% correct answers typed in tex files, as argument of answerone, say

\newcommand{\answerfieldone}[1]{% argument [1] text answer
    \special{ps::
    [
        /T (fieldanswer1) % question giver text *title* used in various submit.eps
        /Subtype /Widget
        /FT /Tx % dummy text, required in definition of widget
        /Rect [450 2290 750 2320] % dummy text field size
        /F 4
        /V (#1) % argument is question giver text
        /DV (#1) % argument is question giver text
    /ANN pdfmark
    }%
    \relax\xspace%
}
\newcommand{\answerfieldtwo}[1]{
    \special{ps::
    [
        /T (fieldanswer2)
        /Subtype /Widget
        /FT /Tx
        /Rect [450 2290 750 2320]
        /F 4
        /V (#1)
        /DV (#1)
    /ANN pdfmark
    }%
    \relax\xspace%
}
\newcommand{\answerfieldthree}[1]{
    \special{ps::
    [
        /T (fieldanswer3)
        /Subtype /Widget
        /FT /Tx
        /Rect [450 2290 750 2320]
        /F 4
        /V (#1)
        /DV (#1) % argument is question giver text
    /ANN pdfmark
    }%
    \relax\xspace%
}
\newcommand{\answerfieldfour}[1]{
    \special{ps::
    [
        /T (fieldanswer4)
        /Subtype /Widget
        /FT /Tx
        /Rect [450 2290 750 2320]
        /F 4
        /V (#1)
        /DV (#1)
    /ANN pdfmark
    }%
    \relax\xspace%
}
\newcommand{\answerfieldfive}[1]{
    \special{ps::
    [
        /T (fieldanswer5)
        /Subtype /Widget
        /FT /Tx
        /Rect [450 2290 750 2320]
        /F 4
        /V (#1)
        /DV (#1)
    /ANN pdfmark
    }%
    \relax\xspace%
}

% five radio button answers, for question giver,
% only one of the five buttons may be "On", all others must be "Off"

\newcommand{\answerradioone}[1]{ % radio button answer one, argument [1] is "On" or "Off"
    \special{ps::
    [
        /T (radioanswer1) % title is radioanswer1, used in radiosubmit.eps
        /Rect [0 0 30 30] % dummy radio button area
        /Subtype /Widget % dummy radio button widget
        /F 4 % printable, "On" or "Off"
        /FT /Btn % type, radio button
        /V(#1) % value (when window first opened) is "On" or "Off"
        /DV(#1) % default value, if reset, is "On" or "Off", whatever argument #1 is
    /ANN pdfmark
    }%
    \relax\xspace%
}
\newcommand{\answerradiotwo}[1]{ % radio button answer two
    \special{ps::
    [
        /T (radioanswer2)
        /Rect [0 0 30 30]
        /Subtype /Widget
        /F 4
        /FT /Btn
        /V(#1)
        /DV(#1)
    /ANN pdfmark
    }%
    \relax\xspace%
}
\newcommand{\answerradiothree}[1]{ % radio button answer three
    \special{ps::
    [
        /T (radioanswer3)
        /Rect [0 0 30 30]
        /Subtype /Widget
        /F 4
        /FT /Btn
        /V(#1)
        /DV(#1)
    /ANN pdfmark
    }%
    \relax\xspace%
}
\newcommand{\answerradiofour}[1]{ % radio answer four
    \special{ps::
    [
        /T (radioanswer4)
        /Rect [0 0 30 30]
        /Subtype /Widget
        /F 4
        /FT /Btn
        /V(#1)
        /DV(#1)
    /ANN pdfmark
    }%
    \relax\xspace%
}
\newcommand{\answerradiofive}[1]{% radio answer five
    \special{ps::
    [
        /T (radioanswer5)
        /Rect [0 0 30 30]
        /Subtype /Widget
        /F 4
        /FT /Btn
        /V(#1)
        /DV(#1)
    /ANN pdfmark
    }%
    \relax\xspace%
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%   PREVIOUS, INDEX, NEXT
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% two newcommands required (because of difficulty of changing ps "real time") for "Prev" button
% prevsetup newcommand uses ps, allows question giver input argument, [1]
% prev newcommand uses eps, allows prev button to be placed anywhere on question page

\newcommand{\prevsetup}[1]{% sets up previous action, allows question giver input, argument [1]
    \special{ps::
        [/_objdef {prev_def} /type /dict /OBJ pdfmark % defines previous button
        [ {prev_def} << /Type /Action /S /Launch /F (#1) /NewWindow false >> /PUT pdfmark
    }%
}
\newcommand{\prev}{% executes previous action (with argument [1]), prev button placed anywhere
    \epsfig{file=prev.eps,height=15bp}%
    \relax\xspace % spaces button properly with respect to other buttons, text
}

\newcommand{\ndexsetup}[1]{%
    \special{ps::
        [/_objdef {ndex_def} /type /dict /OBJ pdfmark
        [ {ndex_def} << /Type /Action /S /Launch /F (#1) /NewWindow false >> /PUT pdfmark
    }%
}
\newcommand{\ndex}{
    \epsfig{file=ndex.eps,height=15bp}%
    \relax\xspace
}

\newcommand{\nextsetup}[1]{% sets up next action, allows question giver input, argument [1]
    \special{ps::
        [/_objdef {next_def} /type /dict /OBJ pdfmark % defines next button
        [ {next_def} << /Type /Action /S /Launch /F (#1) /NewWindow false >> /PUT pdfmark
    }%
}
\newcommand{\next}{% executes next action (with argument [1]), next button placed anywhere
    \epsfig{file=next.eps,height=15bp}%
    \relax\xspace%
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%   EXERQUES BUTTONS
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newcommand{\exerquessetupone}[1]{% sets up exerques1 action
    \special{ps::
        [/_objdef {exerques_def1} /type /dict /OBJ pdfmark
        [ {exerques_def1} << /Type /Action /S /Launch /F (#1) /NewWindow false >> /PUT pdfmark
    }%
}
\newcommand{\exerquessetuptwo}[1]{
    \special{ps::
        [/_objdef {exerques_def2} /type /dict /OBJ pdfmark
        [ {exerques_def2} << /Type /Action /S /Launch /F (#1) /NewWindow false >> /PUT pdfmark
    }%
}
\newcommand{\exerquessetupthree}[1]{
    \special{ps::
        [/_objdef {exerques_def3} /type /dict /OBJ pdfmark
        [ {exerques_def3} << /Type /Action /S /Launch /F (#1) /NewWindow false >> /PUT pdfmark
    }%
}
\newcommand{\exerquessetupfour}[1]{
    \special{ps::
        [/_objdef {exerques_def4} /type /dict /OBJ pdfmark
        [ {exerques_def4} << /Type /Action /S /Launch /F (#1) /NewWindow false >> /PUT pdfmark
    }%
}

\newcommand{\exerquessetupfive}[1]{
    \special{ps::
        [/_objdef {exerques_def5} /type /dict /OBJ pdfmark
        [ {exerques_def5} << /Type /Action /S /Launch /F (#1) /NewWindow false >> /PUT pdfmark
    }%
}
\newcommand{\exerquessetupsix}[1]{
    \special{ps::
        [/_objdef {exerques_def6} /type /dict /OBJ pdfmark
        [ {exerques_def6} << /Type /Action /S /Launch /F (#1) /NewWindow false >> /PUT pdfmark
    }%
}
\newcommand{\exerquessetupseven}[1]{
    \special{ps::
        [/_objdef {exerques_def7} /type /dict /OBJ pdfmark
        [ {exerques_def7} << /Type /Action /S /Launch /F (#1) /NewWindow false >> /PUT pdfmark
    }%
}
\newcommand{\exerquessetupeight}[1]{
    \special{ps::
        [/_objdef {exerques_def8} /type /dict /OBJ pdfmark
        [ {exerques_def8} << /Type /Action /S /Launch /F (#1) /NewWindow false >> /PUT pdfmark
    }%
}

\newcommand{\exerquessetupnine}[1]{
    \special{ps::
        [/_objdef {exerques_def9} /type /dict /OBJ pdfmark
        [ {exerques_def9} << /Type /Action /S /Launch /F (#1) /NewWindow false >> /PUT pdfmark
    }%
}
\newcommand{\exerquessetupten}[1]{
    \special{ps::
        [/_objdef {exerques_def10} /type /dict /OBJ pdfmark
        [ {exerques_def10} << /Type /Action /S /Launch /F (#1) /NewWindow false >> /PUT pdfmark
    }%
}
\newcommand{\exerquessetupeleven}[1]{
    \special{ps::
        [/_objdef {exerques_def11} /type /dict /OBJ pdfmark
        [ {exerques_def11} << /Type /Action /S /Launch /F (#1) /NewWindow false >> /PUT pdfmark
    }%
}
\newcommand{\exerquessetuptwelve}[1]{
    \special{ps::
        [/_objdef {exerques_def12} /type /dict /OBJ pdfmark
        [ {exerques_def12} << /Type /Action /S /Launch /F (#1) /NewWindow false >> /PUT pdfmark
    }%
}

\newcommand{\exerquessetupthirteen}[1]{
    \special{ps::
        [/_objdef {exerques_def13} /type /dict /OBJ pdfmark
        [ {exerques_def13} << /Type /Action /S /Launch /F (#1) /NewWindow false >> /PUT pdfmark
    }%
}
\newcommand{\exerquessetupfourteen}[1]{
    \special{ps::
        [/_objdef {exerques_def14} /type /dict /OBJ pdfmark
        [ {exerques_def14} << /Type /Action /S /Launch /F (#1) /NewWindow false >> /PUT pdfmark
    }%
}
\newcommand{\exerquessetupfifteen}[1]{
    \special{ps::
        [/_objdef {exerques_def15} /type /dict /OBJ pdfmark
        [ {exerques_def15} << /Type /Action /S /Launch /F (#1) /NewWindow false >> /PUT pdfmark
    }%
}
\newcommand{\exerquessetupsixteen}[1]{
    \special{ps::
        [/_objdef {exerques_def16} /type /dict /OBJ pdfmark
        [ {exerques_def16} << /Type /Action /S /Launch /F (#1) /NewWindow false >> /PUT pdfmark
    }%
}

\newcommand{\exerquessetupseventeen}[1]{
    \special{ps::
        [/_objdef {exerques_def17} /type /dict /OBJ pdfmark
        [ {exerques_def17} << /Type /Action /S /Launch /F (#1) /NewWindow false >> /PUT pdfmark
    }%
}
\newcommand{\exerquessetupeighteen}[1]{
    \special{ps::
        [/_objdef {exerques_def18} /type /dict /OBJ pdfmark
        [ {exerques_def18} << /Type /Action /S /Launch /F (#1) /NewWindow false >> /PUT pdfmark
    }%
}
\newcommand{\exerquessetupnineteen}[1]{
    \special{ps::
        [/_objdef {exerques_def19} /type /dict /OBJ pdfmark
        [ {exerques_def19} << /Type /Action /S /Launch /F (#1) /NewWindow false >> /PUT pdfmark
    }%
}
\newcommand{\exerquessetuptwenty}[1]{
    \special{ps::
        [/_objdef {exerques_def20} /type /dict /OBJ pdfmark
        [ {exerques_def20} << /Type /Action /S /Launch /F (#1) /NewWindow false >> /PUT pdfmark
    }%
}

\newcommand{\exerquesone}{% executes exerques1 action, button placed anywhere
    \epsfig{file=exerques1.eps,height=15bp}%
    \relax\xspace%
}
\newcommand{\exerquestwo}{
    \epsfig{file=exerques2.eps,height=15bp}%
    \relax\xspace%
}
\newcommand{\exerquesthree}{
    \epsfig{file=exerques3.eps,height=15bp}%
    \relax\xspace%
}
\newcommand{\exerquesfour}{
    \epsfig{file=exerques4.eps,height=15bp}%
    \relax\xspace%
}

\newcommand{\exerquesfive}{
    \epsfig{file=exerques5.eps,height=15bp}%
    \relax\xspace%
}
\newcommand{\exerquessix}{
    \epsfig{file=exerques6.eps,height=15bp}%
    \relax\xspace%
}
\newcommand{\exerquesseven}{
    \epsfig{file=exerques7.eps,height=15bp}%
    \relax\xspace%
}
\newcommand{\exerqueseight}{
    \epsfig{file=exerques8.eps,height=15bp}%
    \relax\xspace%
}

\newcommand{\exerquesnine}{
    \epsfig{file=exerques9.eps,height=15bp}%
    \relax\xspace%
}
\newcommand{\exerquesten}{
    \epsfig{file=exerques10.eps,height=15bp}%
    \relax\xspace%
}
\newcommand{\exerqueseleven}{
    \epsfig{file=exerques11.eps,height=15bp}%
    \relax\xspace%
}
\newcommand{\exerquestwelve}{
    \epsfig{file=exerques12.eps,height=15bp}%
    \relax\xspace%
}

\newcommand{\exerquesthirteen}{
    \epsfig{file=exerques13.eps,height=15bp}%
    \relax\xspace%
}
\newcommand{\exerquesfourteen}{
    \epsfig{file=exerques14.eps,height=15bp}%
    \relax\xspace%
}
\newcommand{\exerquesfifteen}{
    \epsfig{file=exerques15.eps,height=15bp}%
    \relax\xspace%
}
\newcommand{\exerquessixteen}{
    \epsfig{file=exerques16.eps,height=15bp}%
    \relax\xspace%
}

\newcommand{\exerquesseventeen}{
    \epsfig{file=exerques17.eps,height=15bp}%
    \relax\xspace%
}
\newcommand{\exerqueseighteen}{
    \epsfig{file=exerques18.eps,height=15bp}%
    \relax\xspace%
}
\newcommand{\exerquesnineteen}{
    \epsfig{file=exerques19.eps,height=15bp}%
    \relax\xspace%
}
\newcommand{\exerquestwenty}{
    \epsfig{file=exerques20.eps,height=15bp}%
    \relax\xspace%
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%  INDEX INTRODUCTION TO EXERCISE OF QUESTIONS
%  USED TO GROUP QUESTIONS TOGETHER INTO ONE EXERCISE
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newcommand{\exerciseintroduction}[1]{\textcolor{black}{#1}} % index introduction is argument #1


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%   SUBMIT (TEXT, POPUP, FIELD, RADIO) BUTTON
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newcommand{\checksubmit}{% button, when pressed, goes to either correct or incorrect page
    \epsfig{file=checksubmit.eps,height=15bp}%
    \relax\xspace%
}
\newcommand{\fieldsubmit}{
    \epsfig{file=fieldsubmit.eps,height=15bp}%
    \relax\xspace%
}
\newcommand{\popupsubmit}{
    \epsfig{file=popupsubmit.eps,height=15bp}%
    \relax\xspace%
}
\newcommand{\radiosubmit}{
    \epsfig{file=radiosubmit.eps,height=15bp}%
    \relax\xspace%
}
\newcommand{\submit}[1]{ % pick type of submit button
    \ifthenelse{\equal{#1}{check}}{\checksubmit}{}%
    \ifthenelse{\equal{#1}{popup}}{\popupsubmit}{}%
    \ifthenelse{\equal{#1}{field}}{\fieldsubmit}{}%
    \ifthenelse{\equal{#1}{radio}}{\radiosubmit}{}%
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%  CORRECT ANSWER (CHECK, FIELD, POPUP, RADIO) BUTTON
%       DISPLAYS CORRECT (QUESTION GIVER) ANSWERS
%       CORRECT (RIGHT) RESPONSE AND INCORRECT (WRONG) RESPONSE BUTTONS
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newcommand{\rightcheckcorrect}{ % checks off correct (question giver) check boxes with answers
    \epsfig{file=rightcheckcorrect.eps,height=15bp} % when on right (correct) response page
    \relax\xspace%
}
\newcommand{\wrongcheckcorrect}{ % checks off correct (question giver) check boxes with answers
    \epsfig{file=wrongcheckcorrect.eps,height=15bp} % when on wrong (correct) response page
    \relax\xspace%
}
\newcommand{\rightfieldcorrect}{% fills in correct (question giver) text field answers
    \epsfig{file=rightfieldcorrect.eps,height=15bp}%
    \relax\xspace%
}
\newcommand{\wrongfieldcorrect}{% fills in incorrect (question giver) text field answers
    \epsfig{file=wrongfieldcorrect.eps,height=15bp}%
    \relax\xspace%
}
\newcommand{\rightpopupcorrect}{% chooses correct (question giver) popup menu answers
    \epsfig{file=rightpopupcorrect.eps,height=15bp}%
    \relax\xspace%
}
\newcommand{\wrongpopupcorrect}{% chooses incorrect (question giver) popup menu answers
    \epsfig{file=wrongpopupcorrect.eps,height=15bp}%
    \relax\xspace%
}
\newcommand{\rightradiocorrect}{% selects correct (question giver) radio button answer
    \epsfig{file=rightradiocorrect.eps,height=15bp}%
    \relax\xspace%
}
\newcommand{\wrongradiocorrect}{% selects incorrect (question giver) radio button answer
    \epsfig{file=wrongradiocorrect.eps,height=15bp}%
    \relax\xspace%
}
\newcommand{\correct}[2]{ % arg #1 type of button, arg #2 correct or incorrect response page
% if check button, then either right (correct) response page or wrong (incorrect) response page
    \ifthenelse{ \equal{#1}{check} }
        { \ifthenelse{\equal{#2}{right}}{\rightcheckcorrect}{\wrongcheckcorrect}  }
        {} % if *not* check button, then must be another type of button
    \ifthenelse{ \equal{#1}{popup} }
        { \ifthenelse{\equal{#2}{right}}{\rightpopupcorrect}{\wrongpopupcorrect}  }
        {}
    \ifthenelse{ \equal{#1}{field} }
        { \ifthenelse{\equal{#2}{right}}{\rightfieldcorrect}{\wrongfieldcorrect}  }
        {}
    \ifthenelse{ \equal{#1}{radio} }
        { \ifthenelse{\equal{#2}{right}}{\rightradiocorrect}{\wrongradiocorrect}  }
        {}
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%  CLEAR (CHECK, FIELD, POPUP, RADIO) BUTTON
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newcommand{\checkclear}{% clears all check box answers
    \epsfig{file=checkclear.eps,height=15bp}%
    \relax\xspace%
}
\newcommand{\fieldclear}{% clears user text field answers
    \epsfig{file=fieldclear.eps,height=15bp}%
    \relax\xspace%
}
\newcommand{\popupclear}{% clears user popup menu answers
    \epsfig{file=popupclear.eps,height=15bp}%
    \relax\xspace%
}
\newcommand{\radioclear}{% clears user radio button answers
    \epsfig{file=radioclear.eps,height=15bp}%
    \relax\xspace%
}
\newcommand{\clear}[1]{ % pick type of clear button
    \ifthenelse{\equal{#1}{check}}{\checkclear}{}
    \ifthenelse{\equal{#1}{popup}}{\popupclear}{}
    \ifthenelse{\equal{#1}{field}}{\fieldclear}{}
    \ifthenelse{\equal{#1}{radio}}{\radioclear}{}
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%  RETURN BUTTON
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newcommand{\return}{% button, when pressed, goes to question (first, zeroth) pg of question
    \epsfig{file=return.eps,height=15bp}%
    \relax\xspace%
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%   SCREEN VIEW PREFERENCES
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\special{ps::
    [{Catalog}
    << /ViewerPreferences <<
        /HideToolbar true
        /FitWindow true  % also, set general preference "fit in window"  in Acrobat Reader
        /CenterWindow true
        /PageLayout /SinglePage
        /HideWindowUI true
        >>
    >>
    /PUT pdfmark
}%

% set crop box for 4in by 4in page
% this is specific to PS->PDF conversion (?)

\special{ps::
    [ /CropBox [ 0 432 360 792 ] /PAGES pdfmark
}%

% latex commands

% shrink the page size

\setlength\paperheight{5in}
\setlength\paperwidth{5in}

% eliminate the offsets

\setlength{\hoffset}{-1in}
\setlength{\voffset}{-1in}

% 1/2 inch margin on left and top

\setlength{\oddsidemargin}{0.3in}
\setlength{\topmargin}{0.5in}

% header takes up 1/2 inch

\setlength{\headheight}{0.3in}
\setlength{\headsep}{0.2in}

% 1/2 margin on the bottom and right

\setlength{\textheight}{4in}
\setlength{\textwidth}{4.4in}

% no margin paragraphs

\setlength{\marginparsep}{0in}
\setlength{\marginparwidth}{0in}

% footer takes up 1/2 inch

\setlength{\footskip}{0in}

% pages not numbered

\pagestyle{empty}

\endinput