-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupmc.cls
More file actions
5933 lines (5399 loc) · 192 KB
/
upmc.cls
File metadata and controls
5933 lines (5399 loc) · 192 KB
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
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
% exam.cls
%
% A LaTeX2e document class for preparing exams.
%% exam.cls
%% Copyright (c) 1994, 1997, 2000, 2004, 2008 Philip S. Hirschhorn
%
% 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 2003/12/01 or later.
%
% This work has the LPPL maintenance status "author-maintained".
%
% This work consists of the files exam.cls and examdoc.tex.
% The user documentation for exam.cls is in the file examdoc.tex.
%%% Philip Hirschhorn
%%% Department of Mathematics
%%% Wellesley College
%%% Wellesley, MA 02481
%%% psh@math.mit.edu
% The newest version of this documentclass should always be available
% from my web page: http://www-math.mit.edu/~psh/
\def\fileversion{2.3}
\def\filedate{2008/07/19}
%---------------------------------------------------------------------
%---------------------------------------------------------------------
%
% If there's some feature that you'd like that this file doesn't
% provide, tell me about it.
%
%
%
%
%
% Thanks to:
%
% Piet van Oostrum, from whose excellent ``fancyheadings.sty'' we
% shamelessly stole most of the code for setting the headers and
% footers.
%
% Mate Wierdl <mw@wierdlmpc.msci.memphis.edu>, who contributed the
% code so that if the number of points is ``1'', then the default
% value of \pointname will print ``1 point'' instead of ``1 points''.
%
% Tom Brikowski <brikowi@utdallas.edu>, who contributed the code for
% making the number of points and number of questions available as
% macros (as well as the idea of putting the number of points in a
% box, instead of in parentheses). (I changed his code to make this
% all optional, so if there are errors there, it's my fault and not
% his.)
%
% Ottmar Beucher <beucher@fh-karlsruhe.de>, Dan Drake
% <drake@math.umn.edu>, and Justus Piater <Justus.Piater@ULg.ac.be> who
% contributed ideas and code for the \pointsofquestion and \gradetable
% commands for printing a Grading Table. (I changed all the code to
% make this compatible with hyperref.sty, so if there are errors there,
% it's my fault and not theirs.)
%
% Justus Piater <Justus.Piater@ULg.ac.be>, who contributed the code for
% the solution environment. (I changed his code to allow page breaks
% inside solutions so, once again, if it's buggy, it's my fault.)
%
% Donald Arseneau <asnd@triumf.ca>, who created the excellent
% ``framed.sty'' and generously allowed me to include basically the
% whole thing in exam.cls, making the few changes needed for it to
% work well with question environments:
% framed.sty v 0.8a 21-Jul-2003
% Copyright (C) 1992-2003 by Donald Arseneau
% These macros may be freely transmitted, reproduced, or modified
% provided that this notice is left intact.
%
%--------------------------------------------------------------------
%--------------------------------------------------------------------
% Changelog since version 2.2:
%--------------------------------------------------------------------
% Version 2.3, 2008/07/16:
%
% Minor typographic corrections to comments.
%
%--------------------------------------------------------------------
% Version 2.222$\beta$, 2008/07/13:
%
% Corrected a typo in the error message displayed when
% \shadedsolutions is used without having said \usepackage{color}.
%
%--------------------------------------------------------------------
% Version 2.221$\beta$, 2008/07/03:
%
% \themarginpoints used to expand to
% \@points \@marginpointname
% whether the points were bonus or non-bonus. We fixed that, so that
% it expands to either
% \@points \@marginbonuspointname
% or
% \@points \@marginpointname
% depending on whether or not the points are bonus points.
%
%--------------------------------------------------------------------
% Version 2.220$\beta$, 2008/05/24:
%
% New command: \fillwithdottedlines
% New environment: solutionordottedlines
%
%
% \fillwithdottedlines is similar to \fillwithlines except that it
% inserts dotted lines (created by \dotfill) instead of solid lines.
%
% \fillwithdottedlines takes one argument, which is either a length or
% \fill, and it fills that much vertical space with dotted horizontal
% lines that run the length of the current line. That is, they extend
% from the current left margin (which depends on whether we're in a
% question, part, subpart, or subsubpart) to the right margin.
%
% The distance between the lines is \dottedlinefillheight, whose
% default value is set with the command
%
% \setlength\dottedlinefillheight{.25in}
%
% This value can be changed by giving a new \setlength command.
%
% The solutionordottedlines environment is almost identical to the
% solutionorlines environment, except that when solutions are not
% being printed and an optional argument appears specifying an amount
% of space to be left for answers, that space is filled with dotted
% lines (created by \dotfill), rather than filled with solid lines (as
% it is by the solutionorlines environment).
%
%--------------------------------------------------------------------
% Version 2.219$\beta$, 2007/11/24:
%
% There can now be partial grade tables and point tables, either bonus
% or non-bonus.
%
% New commands:
%
% \partialgradetable
% \partialbonusgradetable
% \partialpointtable
% \partialbonuspointtable
% \begingradingrange
% \endgradingrange
%
% The user defines a grading range by saying
%
% \begingradingrange{whatever}
%
% to start the range and
%
% \endgradingrange{whatever}
%
% to end the range (where ``whatever'' is a name chosen by the user).
% To create the table, the user says, e.g.,
%
% \partialgradetable{whatever}[v][questions]
%
% That is, each of \partialgradetable, \partialbonusgradetable,
% \partialpointtable, and \partialbonuspointtable takes
%
% one required argument (the name of the grading range) and
%
% two optional arguments, the first being either ``[v]'' or ``[h]'',
% the second being either ``[questions]'' or ``[pages]''.
%
% If either or both of the optional arguments are omitted, [questions]
% and [v] will be used.
%
% If the table is indexed by questions, then it will include all
% questions following the \begingradingrange{whatever} and preceding the
% \endgradingrange{whatever}.
%
% If the table is indexed by pages, then it will include all pages with
% points starting with the page containing the
% \begingradingrange{whatever} and ending with the page containing the
% \endgradingrange{whatever}.
%
% Otherwise,
%
% \partialgradetable is similar to \gradetable
% \partialbonsugradetable is similar to \bonusgradetable
% \partialpointtable is similar to \pointtable
% \partialbonuspointtable is similar to \bonuspointtable
%
%--------------------------------------------------------------------
% Version 2.218$\beta$, 2007/10/31:
%
% Instead of appending
% \the \pageinfo@commands \the \point@toks
% to \everypar, we insert them into the box \@labels. This corrects the
% problem that arose when a question (or part, etc.) begins with a list
% environment (including verbatim, flushleft, center, flushright, and
% possibly others that are implemented as trivlist environments). The
% \item command in those environments throws away the previous contents
% of \everypar, and so the tokens
% \the \pageinfo@commands \the \point@toks
% didn't get inserted where we expected. List environments *do*
% preserve the contents of the box \@labels, though.
% This version of exam.cls is not completely backward compatible with
% older versions. The changes only affect documents in which the user
% was doing something that probably should not have been done with the
% older versions, though. This new version does something useful in
% situations in which older versions did something not very useful:
% This change introduces a change in behavior for documents in which a
% question with points begins with a parts environment, so that the
% points for the first part (if any) would appear on the same line as
% the points for the question. In earlier versions of exam.cls, the
% points for the question would not be printed if there are points for
% the part that begins on the same line. In this version of exam.cls,
% all points will be printed. If they're both printed in the left
% margin, or both in the right margin, then they'll be printed directly
% on top of one another, which is not what you want. (You can use
% \pointsinmargin, \pointsinrightmargin, and \nopointsinmargin to print
% them in different places.) If points are being printed right in the
% text (i.e., \nopointsinmargin), then the points for the question will
% be printed *before* the label (a) for the first part is printed.
% The behavior of this new version of exam.cls seems clearly preferable
% to the old behavior, but it is a change!
%
%--------------------------------------------------------------------
% Version 2.217$\beta$, 2007/10/22:
%
% We changed things so that we're now compatible with calc.sty
%
% calc.sty redefines \setcounter and \addtocounter in a way that
% conflicts with a trick we were using to deal with \half points.
%
% We replaced one \setcounter command with
%
% \global\csname c@#1\endcsname 0#2\relax
%
% and one \addtocounter command with
%
% \global\advance\csname c@#1\endcsname 0#2\relax
%
%--------------------------------------------------------------------
% Version 2.216$\beta$, 2007/08/27:
%
% The command \answerline now takes an optional argument. If the
% optional argument appears, then when \printanswers is true the
% argument will be printed on the answer line. When \printanswers is
% false, the optional argument is ignored.
%
% When the argument is printed, it is printed with
% \CorrectChoiceEmphasis and it is a distance of \answerclearance above
% the line. The default value of \answerclearance is set with the
% command
%
% \setlength\answerclearance{0.2ex}
%
% and it can be changed with a \setlength command.
%
% The optional argument is centered on the answer line unless it is too
% long, in which case it extends to the right of the answer line.
%
%--------------------------------------------------------------------
% Version 2.215$\beta$, 2007/08/24:
%
% New commands:
%
% \pointtable
% \bonuspointtable
%
% Both of these take up to two optional arguments:
%
% The first can be either [v] or [h].
% The second can be either [questions] or [pages].
%
% These commands are similar to the commands
%
% \gradetable
% \bonusgradetable
%
% except that the new commands print only two columns (or rows),
% omitting the column (or row) for the score.
%
%--------------------------------------------------------------------
% Version 2.214$\beta$, 2007/07/19:
%
% New commands:
%
% \questionshook
% \partshook
% \subpartshook
% \subsubpartshook
% \choiceshook
%
% These are for advanced users who want to customize the list
% parameters (\topsep, \partopsep, \itemsep, \parsep, etc.) for the
% lists that these environments create. They are all defined to be
% empty, but the user can change them using \renewcommand.
%
%--------------------------------------------------------------------
% Version 2.213$\beta$, 2006/11/27:
%
% New documentclass option: addpoints
% Using this option is equivalent to giving the command
% \addpoints
% at the beginning of the document.
%
% New commands:
%
% \bonusquestion
% \bonustitledquestion
% \bonuspart
% \bonussubpart
% \bonussubsubpart
%
% \bonuspointsofquestion
% \bonuspointsonpage
%
% \numbonuspoints
%
% \bonuspointpoints
% \bonuspointformat
% \thebonuspoints
% \bonuspoints
% \bonuspointname
% \marginbonuspointname
%
% \bonusgradetable
%
% \bhqword
% \bhpword
% \bhsword
% \bhtword
% \bvqword
% \bvpword
% \bvsword
% \bvtword
%
% \bvpgword
% \bhpgword
%
%
% The commands
%
% \bonusquestion
% \bonustitledquestion
% \bonuspart
% \bonussubpart
% \bonussubsubpart
%
% are the same as the commands
%
% \question
% \titledquestion
% \part
% \subpart
% \subsubpart
%
% except that any points assigned become ``bonus points'', which by
% default are typeset in the form
%
% 1. (1 point (bonus))
%
% or
%
% 1. (2 points (bonus))
%
% If no points are assigned, then these ``bonus'' versions of the
% commands are equivalent to the non-bonus versions.
%
% The command
%
% \bonusgradetable
%
% is analogous to the command \gradetable; it can be used in any of the
% four forms
%
% \bonusgradetable[v][questions]
% \bonusgradetable[h][questions]
% \bonusgradetable[v][pages]
% \bonusgradetable[h][pages]
%
% and it counts only bonus points, while \gradetable counts only
% non-bonus points.
%
% The commands
%
% \bonuspointsofquestion
% \bonuspointsonpage
% \numbonuspoints
%
% are analogous to the commands
%
% \pointsofquestion
% \pointsonpage
% \numpoints
%
% The remaining new commands are for customizing the appearance of bonus
% points and bonusgradetable. The command
%
% \bonuspointpoints
%
% is analogous to the command \pointpoints; it takes two arguments, the
% first of which will appear after 1 or \half points the second to
% appear after any other number of points. The default was created by
% the equivalent of the command
%
% \bonuspointpoints{point (bonus)}{points (bonus)}
%
% If, for example, you give the command
%
% \bonuspointpoints{bonus point}{bonus points}
%
% then bonus points will look like
%
% 1. (1 bonus point)
%
% or
%
% 1. (2 bonus points)
%
% (The commands \bracketedpoints, \boxedpoints, and \nobracketedpoints
% have the same effect on bonus points that they have on non-bonus
% points, and the command \marksnotpionts replaces ``point'' with
% ``mark'' in all of these cases.)
%
% \bonuspointname is analogous to \pointname, and the defaults were
% created by the commands
%
% \pointname{ \points}
% \bonuspointname{ \bonuspoints}
%
% (Note the intentional space in each of those commands.)
%
% \marginbonuspointname is analogous to \marginpointname, and the
% default was created by the command
%
% \marginbonuspointname{ (bonus)}
%
% \bonuspointformat is analogous to \pointformat.
%
%
% The commands for customizing the words used in \bonusgradetable are
% analogous to those used for customizing the words used in \gradetable,
% except that they begin with a ``b'':
%
% \bhqword is analogous to \hqword
% \bhpword is analogous to \hpword
% \bhsword is analogous to \hsword
% \bhtword is analogous to \htword
% \bvqword is analogous to \vqword
% \bvpword is analogous to \vpword
% \bvsword is analogous to \vsword
% \bvtword is analogous to \vtword
% is analogous to
% \bvpgword is analogous to \vpgword
% \bhpgword is analogous to \hpgword
%
%
%--------------------------------------------------------------------
% Version 2.212$\beta$, 2006/11/13:
%
% Made \useslantedhalf and \usehorizontalhalf global.
%
%--------------------------------------------------------------------
% Version 2.211$\beta$, 2006/10/29:
%
% New commands:
%
% \pointformat
% \themarginpoints
%
% An old command that's also useful here is
%
% \thepoints
%
% \pointformat: The \pointformat command allows you to change the
% format used to print the points. It takes one argument, and that
% argument becomes the command to print the points, whether the points
% are being printed at the beginning of the question, in the left
% margin (because of \pointsinmargin), in the right margin (because of
% \pointsinrightmargin), or dropped in the right margin at the end of
% the question (because of \pointsdroppedatright).
%
% The argument to \pointformat should contain either the command
%
% \thepoints
%
% which expands to the number of points followed by the argument to
% the last \pointname command, or the command
%
% \themarginpoints
%
% which expands to the number of points followed by the argument to
% the last \marginpointname command.
%
% For example, the command \bracketedpoints is equivalent to
%
% \pointformat{[\thepoints]}
%
% if points are not being printed in the margin and to
%
% \pointformat{[\themarginpoints]}
%
% if points are being printed in the margin.
%
% For another example, the command \boxedpoints is equivalent to
%
% \pointformat{\fbox{\thepoints}}
%
% if points are not being printed in the margin and to
%
% \pointformat{\fbox{\themarginpoints}}
%
% if points are being printed in the margin.
%
% For another example, if you give the commands
%
% \pointsinmargin
% \marginpointname{\%}
% \pointformat{\slshape (\themarginpoints)}
%
% then the points will be printed in the left margin, followed by the
% symbol `%', surrounded by parentheses, all in slanted type.
%
% For another example, if you give the commands
%
% \pointsinrightmargin
% \marginpointname{\%}
% \pointformat{\fbox{\bfseries \boldmath \themarginpoints}}
%
% then the points will be printed in the right margin, followed by the
% symbol `%', all in bold and surrounded by a box. (Note: The commands
% \bfseries and \boldmath are needed here because the ``one half''
% printed when you use half points is printed in math mode while the
% rest of the points are printed in text mode.)
%
%--------------------------------------------------------------------
% Version 2.210$\beta$, 2006/09/28:
%
% Fixed the bug that prevented having two consecutive \correctchoice's
% in a choices or oneparchoices environment.
%
%--------------------------------------------------------------------
% Version 2.209$\beta$, 2006/05/26:
%
% We corrected the problem that \ifcontinuation and \ifincomplete paid
% attention only to parts, subparts, and subsubparts when deciding on
% which page a question ended, but ignored choices. We corrected this,
% so that a question is now thought to end on the page on which its last
% part, subpart, subsubpart, or choice begins.
%
%--------------------------------------------------------------------
% Version 2.208$\beta$, 2006/01/30:
%
% We corrected the description of the usage of \ifthenelse in the
% comments describing what's new in version 2.207beta.
%
%--------------------------------------------------------------------
% Version 2.207$\beta$, 2006/01/29:
%
% New feature: It's possible to say
%
% \ifprintanswers
% Some stuff
% \fi
%
% to insert ``Some stuff'' only when answers are being printed. It's
% also possible to say
%
% \ifprintanswers
% Some stuff
% \else
% Other stuff
% \fi
%
% to insert ``Some stuff'' when answers are being printed and ``Other
% stuff'' when answers aren't being printed.
%
% Alternatively, it's possible to accomplish the same thing by saying
%
% \ifthenelse{\boolean{printanswers}}{Some stuff}{Other stuff}
%
% If you want to ``Stuff'' only when answers aren't being printed, you
% can say either
%
% \ifprintanswers
% \else
% Stuff
% \fi
%
% or
%
% \ifthenelse{\boolean{printanswers}}{}{Stuff}
%
% We accomplished this by changing all uses of \if@printanswers,
% \@printanswerstrue, and \@printanswersfalse to \ifprintanswers,
% \printanswerstrue, and \printanswersfalse.
%
%--------------------------------------------------------------------
% Version 2.206$\beta$, 2005/08/24:
%
% New feature: When using a grading table indexed by questions, it's
% possible to replace the question numbers in the table with titles
% for the questions.
%
%
% There are two new commands: \titledquestion and \thequestiontitle.
%
%
% \titledquestion is a replacement for \question; it has one required
% argument (the title) and one optional argument (the point value), as
% in
%
% \titledquestion{Question \thequestion: Concepts}
%
% which sets the question title to ``Question 2: Concepts'' (if this
% is the second question) and doesn't set any pointvalues, or
%
% \titledquestion{Design}[10]
%
% which sets the question title to ``Design'' and sets the pointvalue
% to ``10''. (Note that the question title doesn't include the number
% of the question unless you put it there using the \thequestion
% command.)
%
% The title of the question then automatically replaces the question
% number in a grading table indexed by question numbers.
%
%
%
%
%
% \thequestiontitle: This command expands to the question title. This
% is for use in the argument of a \qformat command, so that you can make
% the question title appear in the actual question.
%
% If a question is begun with \question (instead of \titledquestion),
% then the value of \thequestiontitle will automatically be set to the
% number of the question.
%
% Note: The contents of \thequestiontitle don't appear anywhere in the
% actual question unless you do something to make it appear. For
% example, the command
%
% \qformat{\textbf{Question \thequestion: \thequestiontitle}\dotfill\thepoints}
%
% would insert the number of the question along with the title of the
% question and the point value at the beginning of the question.
%
%
% Note: If you use a grading table indexed by questions and you use the
% \titledquestion command, then the number of the question won't appear
% in the grading table unless you include \thequestion in the title of
% the question.
%
%
% Note: If \thequestion appears in both the argument to \qformat and the
% title of the question, then the question number will be printed
% twice.
%
%
% If the command \thequestiontitle is never used, then the only effect
% of using the command \titledquestion is that in a grading table
% indexed by question number, this question will be indexed by the
% number of the question, rather than by the argument to
% \titledquestion, and the title of the question would never appear
% except in the grading table.
%
%
%--------------------------------------------------------------------
%
% Version 2.205$\beta$, 2005/08/22:
%
% Bug fix: If a question began with a parts environment (i.e., if the
% parts environment began before we entered horizontal mode in the
% question), then a grading table indexed by questions would get the
% part number instead of the question number. That's fixed now.
%
%--------------------------------------------------------------------
%
% Version 2.204$\beta$, 2005/08/21:
%
% Bug fix: Hyperlinks didn't work on page numbers for horizontal
% grading tables indexed by page numbers. They do now.
%
%--------------------------------------------------------------------
%
% Version 2.203$\beta$, 2005/08/20:
%
% Eliminated \do@int@lbl, and replaced it with labels for each
% question, part, subpart, and subsubpart the names of which
% tell you what they're labelling.
%
% That allowed us to rewrite the grade table stuff so that, for tables
% indexed by question numbers, the question numbers are inserted with a
% \ref, so that if \usepackage{hyperref} and pdflatex are used, those
% question numbers will be clickable links that take you to the relevant
% question.
%
% We also added a label for the first points to appear on each page, and
% rewrote the grade table stuff for tables indexed by page number so
% that the page numbers are inserted with a \pageref, so that if
% \usepackage{hyperref} and pdflatex are used, those page numbers will
% be clickable links that take you to the relevant page.
%
%--------------------------------------------------------------------
%
% Version 2.202$\beta$, 2005/08/10:
%
% Created \correctchoice as a synonym for \CorrectChoice
%
% Changed \CorrectChoiceDeclarations to \CorrectChoiceEmphasis,
% and created \correctchoiceemphasis as a synonym for that.
%
%--------------------------------------------------------------------
%
% Version 2.201$\beta$, 2005/08/09:
%
% We created a \CorrectChoice command for use in the choices and
% oneparchoices environments.
%
% When solutions are not being printed, \CorrectChoice is equivalent to
% \choice.
%
% When solutions *are* being printed, the choice that was created with
% \CorrectChoice (rather than with \choice) will be printed subject to
% the declarations in the argument of the
%
% \CorrectChoiceDeclarations
%
% command. The default is
%
% \CorrectChoiceDeclarations{\bfseries}
%
% and so, when solutions are being printed, the correct choice is
% printed in boldface by default. If, e.g., you give the command
%
% \usepackage{color}
%
% after the \documentclass command and then give the command
%
% \CorrectChoiceDeclarations{\color{red}}
%
% then the correct choice will be printed in red. If, e.g., you give
% the command
%
% \CorrectChoiceDeclarations{\color{red}\bfseries}
%
% then the correct choice will be printed in red and in boldface.
%
% Note added later: \CorrectChoiceDeclarations was changed
% to \CorrectChoiceEmphasis in version 2.202$\beta$.
%
%--------------------------------------------------------------------
%--------------------------------------------------------------------
%--------------------------------------------------------------------
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{upmc}[\filedate\space Version \fileversion\space by
Philip Hirschhorn]
\RequirePackage{ifthen}
\newif\ifprintanswers
\printanswersfalse
\DeclareOption{answers}{\printanswerstrue}
\DeclareOption{noanswers}{\printanswersfalse}
\newif\ifaskname
\asknamefalse
\DeclareOption{askname}{\asknametrue}
% The following keeps track of whether the user has requested that we
% add up the points on the exam. We make the default false so that
% users who put other than numbers into the points argument of a
% question (or part, or subpart) won't get error messages.
% We use \if@printtotalpoints as a flag to signal that we are counting
% points, so that we will know to print the total on the screen (and
% in the log file). We use this separate flag so that the user can
% use both \addpoints and \noaddpoints to count some points and not
% others, but still have the total printed when we finish the file no
% matter what the state of \if@addpoints.
\newif\if@addpoints
\newif\if@printtotalpoints
\def\addpoints{\global\@addpointstrue\global\@printtotalpointstrue}
\def\noaddpoints{\global\@addpointsfalse}
\@addpointsfalse
\@printtotalpointsfalse
\DeclareOption{addpoints}{\addpoints}
\DeclareOption*{%
\PassOptionsToClass{\CurrentOption}{article}%
}
\ProcessOptions\relax
\LoadClass{article}
% *****************
% ** PAGE LAYOUT **
% *****************
% We set the parameters in terms of \paperwidth and \paperheight
% so that the options
% a4paper
% a5paper
% b5paper
% letterpaper
% legalpaper
% executivepaper
% landscape
% will all work:
\setlength{\textwidth}{\paperwidth}
%\addtolength{\textwidth}{-2in}
\setlength{\oddsidemargin}{0pt}
\setlength{\evensidemargin}{0pt}
\setlength{\headheight}{15pt}
\setlength{\headsep}{15pt}
\setlength{\topmargin}{0in}
\addtolength{\topmargin}{-\headheight}
\addtolength{\topmargin}{-\headsep}
\setlength{\footskip}{29pt}
\setlength{\textheight}{\paperheight}
%\addtolength{\textheight}{-2.2in}
\setlength{\marginparwidth}{.5in}
\setlength{\marginparsep}{5pt}
%--------------------------------------------------------------------
% ****************
% ** EXTRAWIDTH **
% ****************
\newlength\@extrawidth
% \@rightmargin is needed for \pointsinrightmargin and
% \pointsdroppedatright, so that we can right justify the points:
\newlength\@rightmargin
\setlength{\@rightmargin}{1in}
% We put the argument of \extrawidth into a length so that it will
% work correctly even if it's negative:
\def\extrawidth#1{%
\@extrawidth=#1
\advance \textwidth by \@extrawidth
\divide\@extrawidth by 2
\advance\oddsidemargin by -\@extrawidth
\advance\evensidemargin by -\@extrawidth
% Bug fix, 13 April 2004:
%\advance\@rightmargin by \@extrawidth
\advance\@rightmargin by -\@extrawidth
}
%--------------------------------------------------------------------
%--------------------------------------------------------------------
% Making room for large headers and footers
% The following are used to save the effect of any changes to
% \topmargin and \textheight caused by \extraheadheight or
% \extrafootheight commands. They hold the values currently in effect.
% We put them into lengths so that it will work correctly even if the
% argument is negative:
\newlength\@extrahead
\newlength\@extrafoot
\setlength{\@extrahead}{0in}
\setlength{\@extrafoot}{0in}
% The following are used to hold the requested values for extrahead and
% extrafoot, first page and all pages after the first, and then the
% similar things requested for the cover pages:
\newlength\run@exhd
\newlength\fp@exhd
\newlength\run@exft
\newlength\fp@exft
\newlength\covrun@exhd
\newlength\covfp@exhd
\newlength\covrun@exft
\newlength\covfp@exft
\setlength{\run@exhd}{0in}
\setlength{\fp@exhd}{0in}
\setlength{\run@exft}{0in}
\setlength{\fp@exft}{0in}
\setlength{\covrun@exhd}{0in}
\setlength{\covfp@exhd}{0in}
\setlength{\covrun@exft}{0in}
\setlength{\covfp@exft}{0in}
\newcommand*\adj@hdht@ftht{%
\if@coverpages
\ifnum\value{page}=1
\@setheadheight{\covfp@exhd}%
\@setfootheight{\covfp@exft}%
\else
\@setheadheight{\covrun@exhd}%
\@setfootheight{\covrun@exft}%
\fi
\else
\ifnum\value{page}=1
\@setheadheight{\fp@exhd}%
\@setfootheight{\fp@exft}%
\else
\@setheadheight{\run@exhd}%
\@setfootheight{\run@exft}%
\fi
\fi
}
\newcommand*\extraheadheight{%
\@ifnextchar[{\@xtrahd}{\@ytrahd}%
}
\def\@xtrahd[#1]#2{%
\setlength{\fp@exhd}{#1}%
\setlength{\run@exhd}{#2}%
\adj@hdht@ftht
}
\def\@ytrahd#1{%
\setlength{\fp@exhd}{#1}%
\setlength{\run@exhd}{#1}%
\adj@hdht@ftht
}
\newcommand*\extrafootheight{%
\@ifnextchar[{\@xtraft}{\@ytraft}%
}
\def\@xtraft[#1]#2{%
\setlength{\fp@exft}{#1}%
\setlength{\run@exft}{#2}%
\adj@hdht@ftht
}
\def\@ytraft#1{%
\setlength{\fp@exft}{#1}%
\setlength{\run@exft}{#1}%
\adj@hdht@ftht
}
\newcommand*\coverextraheadheight{%
\@ifnextchar[{\cov@xtrahd}{\cov@ytrahd}%
}
\def\cov@xtrahd[#1]#2{%
\setlength{\covfp@exhd}{#1}%
\setlength{\covrun@exhd}{#2}%
\adj@hdht@ftht
}
\def\cov@ytrahd#1{%
\setlength{\covfp@exhd}{#1}%
\setlength{\covrun@exhd}{#1}%
\adj@hdht@ftht
}
\newcommand*\coverextrafootheight{%
\@ifnextchar[{\cov@xtraft}{\cov@ytraft}%
}
\def\cov@xtraft[#1]#2{%
\setlength{\covfp@exft}{#1}%
\setlength{\covrun@exft}{#2}%
\adj@hdht@ftht
}
\def\cov@ytraft#1{%
\setlength{\covfp@exft}{#1}%
\setlength{\covrun@exft}{#1}%
\adj@hdht@ftht
}
\def\@appendoutput#1{%
\output=\expandafter{\the\output #1}%
}
\@appendoutput{\adj@hdht@ftht}