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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
|
%--------------------------------------------------------------------
%--------------------------------------------------------------------
% examdoc.tex
%
% This is the documentation for the exam documentclass,
% by Philip Hirschhorn.
%
% The exam documentclass itself is in the file exam.cls.
%%% Copyright (c) 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 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/
%--------------------------------------------------------------------
%--------------------------------------------------------------------
\documentclass[12pt]{exam}
\usepackage{hyperref}
\newcommand{\docversion}{2.3}
\newcommand{\docdate}{July 18, 2008}
%\newcommand{\docdate}{\today}
%--------------------------------------------------------------------
%
% Changes since version 2.2 are described in the comments
% near the beginning of the file exam.cls.
%
%--------------------------------------------------------------------
%---------------------------------------------------------------------
\newenvironment{example}%
{\bigskip\filbreak
\subsubsection{Example:}
}%
{}
\def\samplehead#1#2#3#4{%
\begin{trivlist}
\item[]
\leavevmode
\hbox to \textwidth{%
\rlap{\parbox[b]{\textwidth}{\raggedright#1\strut}}%
\hfil\parbox[b]{\textwidth}{\centering#2\strut}\hfil
\llap{\parbox[b]{\textwidth}{\raggedleft#3\strut}}%
}% hbox
#4
\end{trivlist}
}
\def\samplefoot#1#2#3#4{%
\begin{trivlist}
\item[]
\leavevmode
#1
\vskip 3pt
\hbox to \textwidth{%
\rlap{\parbox[t]{\textwidth}{\raggedright#2}}%
\hfil\parbox[t]{\textwidth}{\centering#3}\hfil
\llap{\parbox[t]{\textwidth}{\raggedleft#4}}%
}% hbox
\end{trivlist}
}
\makeatletter
\@ifundefined{AmS}{\def\AmS{{\protect\the\textfont\tw@
A\kern-.1667em\lower.5ex\hbox{M}\kern-.125emS}}}
{}
\makeatother
%---------------------------------------------------------------------
%---------------------------------------------------------------------
%---------------------------------------------------------------------
%---------------------------------------------------------------------
\begin{document}
\title{Using the exam document class}
\author{Philip Hirschhorn\\
Department of Mathematics\\
Wellesley College\\
Wellesley, MA 02481\\
psh@math.mit.edu\\[\bigskipamount]
Copyright \copyright~1994, 1997, 2000, 2004, 2008 Philip Hirschhorn\\
All rights reserved}
\date{\docdate}
\maketitle
\begin{center}
\small
This is the documentation for version~\docversion{} of the
\verb"exam" document class.
\end{center}
\tableofcontents
%--------------------------------------------------------------------
\section{Introduction}
The file \verb"exam.cls" provides the \verb"exam" document class,
which attempts to make it easy for even a \LaTeX{} novice to prepare
exams. Specifically, \verb"exam.cls" sets the page layout so that
there are one inch margins all around (no matter what size paper
you're using) and provides commands that make it easy to format
questions, create grading tables, create flexible headers and footers,
and change the margins. In more detail:
\begin{itemize}
\item The class will automatically format and number the questions,
parts of questions, subparts of parts, and subsubparts of subparts
(see sections \ref{sec:Questions} and~\ref{sec:parts}).
\item You can include the point value of each question (or part, or
subpart, or subsubpart), with your choice of having the point values
printed at the beginning of the text of the question, opposite that
in the left margin, opposite that in the right margin, or in the
right margin opposite the end of the question (see
section~\ref{sec:points}).
\item The class will add up the total points for each question (and
all of its parts, subparts, and subsubparts) and the total points on
each page, and make those totals available in macros (see sections
\ref{sec:addup}, \ref{sec:pointsofq} and~\ref{sec:pointsonp}). You
can also have the class print a grading table indexed either by
question number or by page number (see
section~\ref{sec:GradeTables}).
\item You specify the header in three parts: One part to be left
justified, one part to be centered, and one part to be right
justified, and one or all of these can be omitted (see
section~\ref{sec:header}).
\item The footer is also specified in three parts: Left justified,
centered, and right justified (see section~\ref{sec:footer}).
\item The header and footer for the first page can be different from
the ones used on other pages (see sections \ref{sec:runningheader},
\ref{sec:lhead}, \ref{sec:runningfooter}, and \ref{sec:lfoot}).
\item Both headers and footers can contain more than one line. To
accommodate headers and footers with several lines, simple commands
are provided to enlarge the part of the page devoted to the header
and/or footer, and these commands can give one amount of space on
the first page and a different amount of space on all other pages
(see section~\ref{sec:extra-room}).
\item Macros are defined to enable you to state in the header and/or
footer the total number of pages in the exam (see
section~\ref{sec:numpages}) and to change the header and/or footer
that appears on the last page of the exam (see
section~\ref{sec:lastpage}).
\item Macros are defined so that the headers and footers can vary
depending on whether the current page begins a new question or
continues a question that started on an earlier page (and, if one
continues onto the current page, to say what the number of that
question is). Macros are also defined so that the headers and
footers can vary depending on whether a question is complete on the
current page or continues on to the next page (and, if one
continues, to say what the number of that question is) (see
section~\ref{sec:QuesSpan}).
\item You can have a horizontal rule at the base of the header and/or
at the top of the footer (see section~\ref{sec:rules}).
\item The exam can begin with one or more cover pages, which are
numbered separately from the main pages of the exam and which can
have headers and footers different from the ones in the main pages
of the exam (see section~\ref{sec:coverpages}).
\item You can include solutions in your \LaTeX{} file and have these
solutions either printed or ignored (or replaced automatically by
space in which the students can write their answers) depending on a
single command (see section~\ref{sec:solutions},
section~\ref{sec:CorrectChoice}, and section~\ref{sec:AnsShortAns}).
\end{itemize}
The latest version of \verb"exam.cls" (possibly a beta test version)
should always be available at \verb"http://www-math.mit.edu/~psh/".
%--------------------------------------------------------------------
%--------------------------------------------------------------------
\section{License}
\begin{itemize}
\item 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
\verb"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.
\item This work has the LPPL maintenance status ``author-maintained''.
\item This work consists of the files \verb"exam.cls" and
\verb"examdoc.tex".
\end{itemize}
%---------------------------------------------------------------------
%--------------------------------------------------------------------
\section{The \texttt{\char`\\documentclass} command}
To use the \verb"exam" document class, you should specify \verb"exam"
as the required argument to your \verb"\documentclass" command, as in
\begin{center}
\verb"\documentclass{exam}"
\end{center}
or, e.g., if you want to use 12~point type,
\begin{center}
\verb"\documentclass[12pt]{exam}"
\end{center}
There are two possible optional arguments that are specific to the
\verb"exam" document class: \verb"addpoints" and \verb"solutions".
Most documents that use the \verb"exam" document class should use the
option \verb"addpoints" (see section~\ref{sec:addpoints}); the option
\verb"answers" is used when you want to print solutions to the
questions (see section~\ref{sec:answers}).
%--------------------------------------------------------------------
\subsection{The option \texttt{addpoints}}
\label{sec:addpoints}
The \verb"\documentclass" option \verb"addpoints", used as in
\begin{center}
\verb"\documentclass[addpoints]{exam}"
\end{center}
or
\begin{center}
\verb"\documentclass[12pt,addpoints]{exam}"
\end{center}
enables the commands that add up the points (see sections
\ref{sec:addup}, \ref{sec:Count}, \ref{sec:pointsofq},
and~\ref{sec:pointsonp}) and that produce grading tables and point
tables (see sections \ref{sec:GradeTables} and~\ref{sec:PointTables}).
This is an option, rather than the default, mainly for the sake of
maintaining backward compatibility; most documents that use the
\verb"exam" document class should use this option. The only reason
\emph{not} to use the \verb"addpoints" option is that this option
creates an error if you include any words in an argument that assigns
points to a question (see section~\ref{sec:points}). If
\verb"addpoints" is not in effect you can put whatever you want in the
argument for the points, but if \verb"addpoints" \emph{is} in effect
then the argument that contains the points must contain only digits
and the command \verb"\half" (see section~\ref{sec:Half}).
You can also turn \verb"addpoints" on and off wherever you like in the
exam by using the commands
\begin{center}
\begin{tabular}{l}
\verb"\addpoints"\\
\verb"\noaddpoints"
\end{tabular}
\end{center}
Using the document class option \verb"addpoints" is equivalent to
giving the command \verb"\addpoints" at the beginning of the exam.
%--------------------------------------------------------------------
\subsection{The option \texttt{answers}}
\label{sec:answers}
If you will be typing solutions into the exam (see sections
\ref{sec:solutions}, \ref{sec:CorrectChoice},
and~\ref{sec:AnsShortAns}) and you'd like the solutions to be printed
on the next run of \LaTeX, you should include the document class
option \verb"answers", as in
\begin{center}
\verb"\documentclass[answers]{exam}"
\end{center}
or
\begin{center}
\verb"\documentclass[answers,12pt]{exam}"
\end{center}
or
\begin{center}
\verb"\documentclass[12pt,addpoints,answers]{exam}"
\end{center}
Using the document class option \verb"answers" is equivalent to giving
the command \verb"\printanswers" at the beginning of the exam (see
section~\ref{sec:solutions}). The effect of this is that
\begin{itemize}
\item the contents of the environments
\begin{center}
\begin{tabular}{l}
\verb"solution",\\
\verb"solutionorlines", and\\
\verb"solutionordottedlines"
\end{tabular}
\end{center}
(see section~\ref{sec:solutions}) will be printed on the next run of
\LaTeX,
\item any choices of a \verb"choices" or \verb"oneparchoices"
environment (see section~\ref{sec:MulChc}) that are created using a
\verb"\CorrectChoice" command (see section~\ref{sec:CorrectChoice})
instead of a \verb"\choice" command will be printed with emphasis as
determined by the argument of the most recent
\verb"\CorrectChoiceEmphasis" command (which by default is
\verb"\bfseries"), and
\item any \verb"\answerline" commands (see section~\ref{sec:ShortAns})
that include an optional argument containing the answer (see
section~\ref{sec:AnsShortAns}) will have the answer printed on the
answer line.
\end{itemize}
%--------------------------------------------------------------------
%--------------------------------------------------------------------
\section{Asking for the student's name}
This isn't anything specific to the \verb"exam" document class, but
it's worth mentioning because it isn't obvious. If you're leaving
space for the answers on the question pages (see
section~\ref{sec:LeaveSpace}), then you'll probably also want to leave
space for the student's name. If you type
\begin{verbatim}
\begin{center}
\fbox{\fbox{\parbox{5.5in}{\centering
Answer the questions in the spaces provided on the
question sheets. If you run out of room for an answer,
continue on the back of the page.}}}
\end{center}
\vspace{0.1in}
\makebox[\textwidth]{Name and section:\enspace\hrulefill}
\vspace{0.2in}
\makebox[\textwidth]{Instructor's name:\enspace\hrulefill}
\end{verbatim}
after the \verb"\begin{document}" command and before the
\verb"\begin{questions}" command (see section~\ref{sec:Questions}),
then you'll get\\
\noindent
\parbox{\textwidth}{
\begin{center}
\fbox{\fbox{\parbox{5.5in}{\centering
Answer the questions in the spaces provided on the
question sheets. If you run out of room for an answer,
continue on the back of the page.}}}
\end{center}
\vspace{0.1in}
\makebox[\textwidth]{Name and section:\enspace\hrulefill}
\vspace{0.2in}
\makebox[\textwidth]{Instructor's name:\enspace\hrulefill}
}
%---------------------------------------------------------------------
%--------------------------------------------------------------------
\section{Questions and points}
\label{sec:QuestionsPoints}
To create questions, you use a \verb"questions" environment (see
section~\ref{sec:Questions}); each question is begun with a
\verb"\question" command, which takes an optional argument to assign
some number of points to the question (see section~\ref{sec:points}).
The questions are numbered automatically. Point values can include
half points (see section~\ref{sec:Half}).
If you want a question to have several parts, you use a \verb"parts"
environment (see section~\ref{sec:parts}); each part is begun with a
\verb"\part" command, which takes an optional argument to assign some
number of points to the part (see section~\ref{sec:points}). The
parts are numbered automatically. Similarly, parts can have subparts,
and subparts can have subsubparts (see section~\ref{sec:parts}).
The points for a question (or part, or subpart, or subsubpart) appear
by default at the beginning of the question (or part, etc.), but there
are commands to have the points appear instead in either the left
margin or in the right margin (see section~\ref{sec:whereprint} and
section~\ref{sec:DrpPts}). The formatting of the points can also be
customized (see sections \ref{sec:Boxed}, \ref{sec:pointname},
\ref{sec:margins}, and~\ref{sec:pointformat}). It's also possible to
have questions (or parts, etc.) that are worth ``bonus points'', which
are added up separately from the non-bonus points (see
section~\ref{sec:Bonus}).
%--------------------------------------------------------------------
\subsection{Questions}
\label{sec:Questions}
To type the questions on the exam you use the \verb"questions"
environment. Each question is then begun with the command
\verb"\question", and the questions are numbered automatically.
For example, if you type
\begin{verbatim}
\begin{questions}
\question
Why is there air?
\question
How much wood would a woodchuck chuck if a woodchuck could chuck
wood?
\question Compute $\displaystyle\int_0^1 x^2 \, dx$.
\end{questions}
\end{verbatim}
then you'll get
\begin{questions}
\question
Why is there air?
\question
How much wood would a woodchuck chuck if a woodchuck could chuck
wood?
\question Compute $\displaystyle\int_0^1 x^2 \, dx$.
\end{questions}
\bigskip
As the above example illustrates, you can leave blank lines between
the \verb"\question" command and the actual beginning of the
question, or before the first \verb"\question" command in the
environment, and they will be ignored.
%---------------------------------------------------------------------
\subsection{Questions with parts and subparts (and subsubparts)}
\label{sec:parts}
If you want a question to have several parts, then you use the
\verb"parts" environment. For example, if you type
\begin{verbatim}
\begin{questions}
\question
Why is there air?
\question
What if there were no air?
\begin{parts}
\part
Describe the effect on the balloon industry.
\part
Describe the effect on the aircraft industry.
\end{parts}
\question
\begin{parts}
\part
Define the universe. Give three examples.
\part
If the universe were to end, how would you know?
\end{parts}
\end{questions}
\end{verbatim}
then you'll get
\begin{questions}
\question
Why is there air?
\question
What if there were no air?
\begin{parts}
\part
Describe the effect on the balloon industry.
\part
Describe the effect on the aircraft industry.
\end{parts}
\question
\begin{parts}
\part
Define the universe. Give three examples.
\part
If the universe were to end, how would you know?
\end{parts}
\end{questions}
\bigskip
The above example illustrates several things:
\begin{itemize}
\item Parts of a question should be put into a \verb"parts"
environment.
\item If a question begins with a \verb"parts" environment, then the
first part will appear on the same line with the question number.
\item You can leave blank lines before and after the \verb"\part"
command, and they will be ignored.
\end{itemize}
\bigskip
There is also a \verb"subparts" environment, and even a
\verb"subsubparts" environment, and they work just as you would
expect. For example, if you type
\begin{verbatim}
\begin{questions}
\question
\begin{parts}
\part
What do you do with a drunken sailor?
\part
Is your answer different if it is before noon?
\end{parts}
\question
This is the second question.
\begin{parts}
\part
This is a part.
\part
This is also a part.
\begin{subparts}
\subpart
This is a subpart.
\subpart
This is a periscope.
\subpart
This is a pair of diving planes.
\subpart
\begin{subsubparts}
\subsubpart
This is a subsubpart.
\subsubpart
The lower surface of a diving plane?
\subsubpart
The ocean floor, perhaps?
\end{subsubparts}
\end{subparts}
\part
It's sad to be apart.
\end{parts}
\question
\begin{parts}
\part
\begin{subparts}
\subpart
This is a subpart.
\subpart
This is another subpart.
\end{subparts}
\part
This is another part.
\end{parts}
\end{questions}
\end{verbatim}
then you'll get
\begin{questions}
\question
\begin{parts}
\part
What do you do with a drunken sailor?
\part
Is your answer different if it is before noon?
\end{parts}
\question
This is the second question.
\begin{parts}
\part
This is a part.
\part
This is also a part.
\begin{subparts}
\subpart
This is a subpart.
\subpart
This is a periscope.
\subpart
This is a pair of diving planes.
\subpart
\begin{subsubparts}
\subsubpart
This is a subsubpart.
\subsubpart
The lower surface of a diving plane?
\subsubpart
The ocean floor, perhaps?
\end{subsubparts}
\end{subparts}
\part
It's sad to be apart.
\end{parts}
\question
\begin{parts}
\part
\begin{subparts}
\subpart
This is a subpart.
\subpart
This is another subpart.
\end{subparts}
\part
This is another part.
\end{parts}
\end{questions}
The numbers and letters used to number questions, parts, subparts, and
subsubparts can be customized; see section~\ref{sec:CustNumb}.
%--------------------------------------------------------------------
\subsection{Multiple choice questions}
\label{sec:MulChc}
There are two environments for listing the possible answers to a
multiple choice question:
\begin{itemize}
\item The \verb"choices" environment creates a list with the choices
as the items in the list (see section~\ref{sec:choices}).
\item The \verb"oneparchoices" environment lists all of the choices in
a single paragraph (that is a continuation of the paragraph
preceding the environment unless you leave a blank line before
beginning the environment) (see section~\ref{sec:oneparchoices}).
\end{itemize}
Both of these environments use upper case letters (i.e., ``A'', ``B'',
``C'', \ldots) to label the choices; to change this, see
section~\ref{sec:CustNumb}. Both of these environments allow you to
designate one or more choices as correct choices and to have the
correct choices printed with emphasis when solutions are being printed
(see section~\ref{sec:CorrectChoice}).
If you don't want the students to just circle the correct choices, you
can use the \verb"\answerline" command to print a line on which the
answer should be written (see section~\ref{sec:ShortAns}). The
\verb"\anwerline" command allows you to include as an optional
argument the answer to the question, and the answer will be printed on
the line when solutions are bing printed (see
section~\ref{sec:AnsShortAns}).
%--------------------------------------------------------------------
\subsubsection{The \texttt{choices} environment}
\label{sec:choices}
For example, if you type
\begin{verbatim}
\begin{questions}
\question
One of these things is not like the others; one of these things is not
the same. Which one is different?
\begin{choices}
\choice John
\choice Paul
\choice
George
\choice Ringo
\choice Socrates
\end{choices}
\end{questions}
\end{verbatim}
Then you'll get
\begin{questions}
\question
One of these things is not like the others; one of these things is not
the same. Which one is different?
\begin{choices}
\choice John
\choice Paul
\choice
George
\choice Ringo
\choice Socrates
\end{choices}
\end{questions}
%--------------------------------------------------------------------
\subsubsection{The \texttt{oneparchoices} environment}
\label{sec:oneparchoices}
If instead of the \verb"choices" environment in the example of
section~\ref{sec:choices} you use a \verb"oneparchoices" environment,
then you'll get
\begin{questions}
\question
One of these things is not like the others; one of these things is not
the same. Which one is different?
\begin{oneparchoices}
\choice John
\choice Paul
\choice
George
\choice Ringo
\choice Socrates
\end{oneparchoices}
\end{questions}
If you insert a blank line before the \verb"\begin{oneparchoices}",
then you'll get
\begin{questions}
\question
One of these things is not like the others; one of these things is not
the same. Which one is different?
\begin{oneparchoices}
\choice John
\choice Paul
\choice
George
\choice Ringo
\choice Socrates
\end{oneparchoices}
\end{questions}
If you insert a blank line before the \verb"\begin{oneparchoices}" and
\verb"\answerline" after the \verb"\end{oneparchoices}" (see
section~\ref{sec:ShortAns} for a description of the \verb"\answerline"
command), then you'll get
\begin{questions}
\question
One of these things is not like the others; one of these things is not
the same. Which one is different?
\begin{oneparchoices}
\choice John
\choice Paul
\choice
George
\choice Ringo
\choice Socrates
\end{oneparchoices}
\answerline
\end{questions}
%--------------------------------------------------------------------
\subsubsection{Solutions to multiple choice questions}
\label{sec:CorrectChoice}
The \verb"exam" document class defines several environments for
solutions (see section~\ref{sec:solutions}), the contents of which
will be printed only if you use the document class option
\verb"answers" (as in \verb"\documentclass[answers]{exam}") or give
the command \verb"\printanswers" (see section~\ref{sec:answers}). The
\verb"choices" (see section~\ref{sec:choices}) and
\verb"oneparchoices" (see section~\ref{sec:oneparchoices})
environments allow you to designate one or more of the choices as
correct choices, and to have the correct choices printed differently
from the others when solutions are being printed.
The command to define a correct choice is \verb"\CorrectChoice". When
solutions are not being printed, \verb"\CorrectChoice" is equivalent
to \verb"\choice". When solutions are being printed, though, any
choices that were created with \verb"\CorrectChoice" (rather than with
\verb"\choice") will be printed subject to the declarations in the
argument of the
\begin{center}
\verb"\CorrectChoiceEmphasis"
\end{center}
command. The default situation was created by the command
\begin{center}
\verb"\CorrectChoiceEmphasis{\bfseries}"
\end{center}
and so when solutions are being printed the correct choices are
printed in boldface by default.
For example, if \verb"\printanswers" is in effect and you type
\begin{verbatim}
\begin{questions}
\question One of these things is not like the others; one of these
things is not the same. Which one is different?
\begin{oneparchoices}
\choice John
\choice Paul
\choice George
\choice Ringo
\CorrectChoice Socrates
\end{oneparchoices}
\end{questions}
\end{verbatim}
then you'll get
\printanswers
\begin{questions}
\question One of these things is not like the others; one of these
things is not the same. Which one is different?
\begin{oneparchoices}
\choice John
\choice Paul
\choice George
\choice Ringo
\CorrectChoice Socrates
\end{oneparchoices}
\end{questions}
\noprintanswers
If, e.g., you give the command
\begin{center}
\verb"\usepackage{color}"
\end{center}
in the preamble of your document (i.e., after the
\verb"\documentclass" command and before the \verb"\begin{document}"
command) and then give the command
\begin{center}
\verb"\CorrectChoiceEmphasis{\color{red}}"
\end{center}
then the correct choices will be printed in red (assuming that your
printer can produce that color). For another example, if you give the
command
\begin{center}
\verb"\CorrectChoiceEmphasis{\color{red}\bfseries}"
\end{center}
then the correct choices will be printed in boldface red (again
assuming that your printer can produce that color).
To avoid confusion, \verb"\correctchoice" is defined to be a synonym
for \verb"\CorrectChoice" and \verb"\correctchoiceemphasis" is defined
to be a synonym for \verb"\CorrectChoiceEmphasis".
%---------------------------------------------------------------------
\subsection{Point values for the questions}
\label{sec:points}
Each of the commands \verb"\question", \verb"\part", \verb"\subpart",
and \verb"\subsubpart" takes an optional argument, which is the number
of points for that question, part, subpart, or subsubpart. The
default setup is that
\begin{itemize}
\item the point value is printed at the beginning of the question (or
part, or subpart, or subsubpart) (this can be changed to printing in
either the left or right margins on the first line of the question
or in the right margin at the end of the question; see
section~\ref{sec:whereprint} and section~\ref{sec:DrpPts}), and
\item the point value is enclosed in parentheses (this can be changed
to either square brackets or a box; see section~\ref{sec:Boxed}).
\end{itemize}
Both of these things can be further customized; see
section~\ref{sec:qformat} and section~\ref{sec:pointformat}.
%--------------------------------------------------------------------
\subsubsection{Where the points will be printed}
\label{sec:whereprint}
The default is that the point value will be inserted at the beginning
of the question (or part, or subpart, or subsubpart) in parentheses,
but
\begin{itemize}
\item the command \verb"\pointsinmargin" will cause the point values
to be set in the left margin,
\item the command \verb"\pointsinrightmargin" will cause the point
values to be set in the right margin, and
\item the commands \verb"\nopointsinmargin" and
\verb"\nopointsinrightmargin" are equivalent, and either of them
will revert to the default situation.
\end{itemize}
All of these print the point values on the first line of the question
(or part, or subpart, or subsubpart). There is also a way to print
the point values on the \emph{last} line of the question (or part,
etc.); for this, see section~\ref{sec:DrpPts}.
\medbreak
For example, if you type
\begin{verbatim}
\begin{questions}
\question[20]
Why is there air?
\question
What if there were no air?
\begin{parts}
\part[10]
Describe the effect on the balloon industry.
\part[10]
Describe the effect on the aircraft industry.
\end{parts}
\end{questions}
\end{verbatim}
then, with the default setup, you'll get
\nopointsinmargin
\begin{questions}
\question[20]
Why is there air?
\question
What if there were no air?
\begin{parts}
\part[10]
Describe the effect on the balloon industry.
\part[10]
Describe the effect on the aircraft industry.
\end{parts}
\end{questions}
(To change the word ``points'', see the commands described in
section~\ref{sec:pointname}.)
\bigskip
If you give the command \verb"\pointsinmargin", then the above input
will produce instead
\pointsinmargin
\begin{questions}
\question[20]
Why is there air?
\question
What if there were no air?
\begin{parts}
\part[10]
Describe the effect on the balloon industry.
\part[10]
Describe the effect on the aircraft industry.
\end{parts}
\end{questions}
(To have a word (e.g., ``points'', or ``\%'') inside the parentheses
with the point values, see the \verb"\marginpointname" command in
section~\ref{sec:pointname}.)
\bigskip
If you give the command \verb"\pointsinrightmargin", then the above
input will produce instead
\pointsinrightmargin
\begin{questions}
\question[20]
Why is there air?
\question
What if there were no air?
\begin{parts}
\part[10]
Describe the effect on the balloon industry.
\part[10]
Describe the effect on the aircraft industry.
\end{parts}
\end{questions}
%--------------------------------------------------------------------
\subsubsection{Printing the points at the end of the question}
\label{sec:DrpPts}
Instead of having the point value of a question (or part, or subpart,
or subsubpart) printed on the first line of a question, you can have
it printed in the right margin opposite the \emph{last} line, or even
opposite a blank line following the paragraph. This is done with the
\begin{center}
\verb"\pointsdroppedatright"
\quad and \quad
\verb"\droppoints"
\end{center}
commands.
If you give the command
\begin{center}
\verb"\pointsdroppedatright"
\end{center}
then point values are not printed until you give the command
\verb"\droppoints" (and they're not printed at all if you don't give
the command \verb"\droppoints"). The only exception to this rule is
that if you've given a \verb"\qformat" command (see
section~\ref{sec:qformat}), then question number lines are printed as
specified by the argument to the \verb"\qformat" command even if you
have given the command \verb"\pointsdroppedatright".
The command \verb"\droppoints" should be given only at the end of a
paragraph or between paragraphs; if you give it within a paragraph, it
causes the paragraph to end. \verb"\droppoints" prints the point
value in the right margin, formatted as it is when you give the
command \verb"\pointsinrightmargin", except that the points appear
opposite the last line of the paragraph (or, if the command
\verb"\droppoints" is given between paragraphs, then additional
vertical space is left between the paragraphs and the points are
printed opposite the blank space). The formatting can be changed by
giving the commands \verb"\bracketedpoints", \verb"\boxedpoints", or
\verb"\marginpointname" (see section~\ref{sec:pointname}) just as if
\verb"\pointsinrightmargin" were in effect. The command
\verb"\droppoints" actually works this way even if one of the commands
\begin{center}
\verb"\nopointsinmargin",\quad \verb"\pointsinmargin",\quad or\quad
\verb"\pointsinrightmargin"
\end{center}
is in effect, but if you use it that way the points will appear twice
on the page, which is probably not what you want.
For example, if you give the command \verb"\pointsdroppedatright" and
then type
\begin{verbatim}
\begin{questions}
\question[10]
Describe the implications of the Michelson-Morley ink drop experiment
for the use of punctuation marks such as colons and semicolons that
require multiple drops of ink.
\droppoints
\question[10]
Prove that the second dual of a finite dimensional real vector space
is naturally isomorphic to the given vector space, except when the
weapon chosen is a single shot pistol.\droppoints
\end{questions}
\end{verbatim}
then you'll get
\pointsdroppedatright
\begin{questions}
\question[10]
Describe the implications of the Michelson-Morley ink drop experiment
for the use of punctuation marks such as colons and semicolons that
require multiple drops of ink.
\droppoints
\question[10]
Prove that the second dual of a finite dimensional real vector space
is naturally isomorphic to the given vector space, except when the
weapon chosen is a single shot pistol.\droppoints
\end{questions}
and if you type
\begin{verbatim}
\begin{questions}
\question[10]
Describe the implications of the Michelson-Morley ink drop experiment
for the use of punctuation marks such as colons and semicolons that
require multiple drops of ink.
\droppoints
\question[10]
Prove that the second dual of a finite dimensional real vector space
is naturally isomorphic to the given vector space, except when the
weapon chosen is a single shot pistol.
\droppoints
\end{questions}
\end{verbatim}
then you'll get
\begin{questions}
\question[10]
Describe the implications of the Michelson-Morley ink drop experiment
for the use of punctuation marks such as colons and semicolons that
require multiple drops of ink.
\droppoints
\question[10]
Prove that the second dual of a finite dimensional real vector space
is naturally isomorphic to the given vector space, except when the
weapon chosen is a single shot pistol.
\droppoints
\end{questions}
\nopointsinmargin
%--------------------------------------------------------------------
\subsubsection{Half points}
\label{sec:Half}
The point values of questions, parts, subparts, and subsubparts can
include half points. To specify half points, you either type
\begin{center}
\verb"\half"
\end{center}
immediately following the integer part of the point value or just type
\verb"\half" as the entire point value. That is, the valid point
values and their (default) printed appearances are:
\begin{center}
\begin{tabular}{@{\extracolsep{0.1in}}rccccccc}
Typed:& \verb"0"& \verb"\half"& \verb"1"& \verb"1\half"& \verb"2"&
\verb"2\half"& $\cdots$\\[1ex]
Printed:& 0& \half& 1& 1\half& 2& 2\half& $\cdots$
\end{tabular}
\end{center}
If you prefer, you can cause the fraction \half{} to be printed as
\makeatletter
\horiz@half.
\makeatother
To do this, you give the command
\begin{center}
\verb"\usehorizontalhalf"
\end{center}
after which the printed appearance of point values will be
\usehorizontalhalf
\begin{center}
\begin{tabular}{@{\extracolsep{0.1in}}rccccccc}
Typed:& \verb"0"& \verb"\half"& \verb"1"& \verb"1\half"& \verb"2"&
\verb"2\half"& $\cdots$\\[1ex]
Printed:& 0& \half& 1& 1\half& 2& 2\half& $\cdots$
\end{tabular}
\end{center}
If you want to return to using the default appearance, you can do that
by giving the command
\begin{center}
\verb"\useslantedhalf"
\end{center}
\useslantedhalf
%--------------------------------------------------------------------
\subsubsection{Surrounding the points: Parentheses, brackets, or a box}
\label{sec:Boxed}
If you prefer having the points enclosed in brackets instead of in
parentheses, give the command
\begin{center}
\verb"\bracketedpoints"
\end{center}
For example, if you give the command \verb"\bracketedpoints", then the
questions typed above will produce
\nopointsinmargin
\bracketedpoints
\begin{questions}
\question[20]
Why is there air?
\question
What if there were no air?
\begin{parts}
\part[10]
Describe the effect on the balloon industry.
\part[10]
Describe the effect on the aircraft industry.
\end{parts}
\end{questions}
If you prefer having the points enclosed in a box instead of in
parentheses, give the command
\begin{center}
\verb"\boxedpoints"
\end{center}
For example, if you give the command \verb"\boxedpoints", then the
questions typed above will produce
\nopointsinmargin
\boxedpoints
\begin{questions}
\question[20]
Why is there air?
\question
What if there were no air?
\begin{parts}
\part[10]
Describe the effect on the balloon industry.
\part[10]
Describe the effect on the aircraft industry.
\end{parts}
\end{questions}
If you give the commands \verb"\boxedpoints" and
\verb"\pointsinmargin", then the above questions will produce
\boxedpoints
\pointsinmargin
\begin{questions}
\question[20]
Why is there air?
\question
What if there were no air?
\begin{parts}
\part[10]
Describe the effect on the balloon industry.
\part[10]
Describe the effect on the aircraft industry.
\end{parts}
\end{questions}
If you give the commands \verb"\bracketedpoints" and
\verb"\pointsinrightmargin", then the above questions will produce
%
\bracketedpoints
\pointsinrightmargin
\begin{questions}
\question[20]
Why is there air?
\question
What if there were no air?
\begin{parts}
\part[10]
Describe the effect on the balloon industry.
\part[10]
Describe the effect on the aircraft industry.
\end{parts}
\end{questions}
Other combinations of these commands will produce similar effects.
If you want to switch back and forth between formats during the exam,
you can do so by giving one of the commands
\begin{center}
\begin{tabular}{l}
\verb"\boxedpoints"\\
\verb"\bracketedpoints"\\
\verb"\noboxedpoints"\\
\verb"\nobracketedpoints"
\end{tabular}
\end{center}
whenever you want to switch. (The commands
\verb"\nobracketedpoints" and \verb"\noboxedpoints" are equivalent;
they both return to the default of putting parentheses around the
points.)
If you want some text (e.g., `` points'', or ``\%'') automatically
inserted along with the point values when using either
\verb"\pointsinmargin" or \verb"\pointsinrightmargin", see the command
\verb"\marginpointname" in section~\ref{sec:pointname}.
%---------------------------------------------------------------------
\subsubsection{Using a substitute for the word ``points''}
\label{sec:pointname}
With the default setup, the number of points is inserted before the
text of the question followed by a single space and the word ``point''
if the number of points is either \half{} or 1 and by the word
``points'' otherwise. That is, the default is
\verb"\nopointsinmargin" and \verb"\noboxedpoints" (see sections
\ref{sec:whereprint} and \ref{sec:Boxed}), and if you type
\nopointsinmargin \noboxedpoints
\begin{verbatim}
\begin{questions}
\question[1]
This is a short question.
\question[5]
This is a longer question, requiring more thought.
\end{questions}
\end{verbatim}
then you'll get
\begin{questions}
\question[1]
This is a short question.
\question[5]
This is a longer question, requiring more thought.
\end{questions}
The way this is achieved is:
\begin{itemize}
\item There is a command
\begin{center}
\verb"\points"
\end{center}
whose default definition expands to the word `point' if the number
of points is either \half{} or 1 and to `points' otherwise. (This
behavior can be modified by the command \verb"\pointpoints"; see
below.)
\item There is a command
\begin{center}
\verb"\pointname{Text}"
\end{center}
that causes `Text' to be inserted following the number of points of
a question, part, subpart, or subsubpart. The default setup is the
result of the command
\begin{center}
\verb"\pointname{ \points}"
\end{center}
(Note the single space before the command \verb"\points".)
\end{itemize}
There is also a command
\begin{center}
\verb"\pointpoints{SingularText}{PluralText}"
\end{center}
that changes the behavior of the \verb"\points" command so that it
expands to `SingularText' if the number of points is \half{} or 1 and
to `PluralText' otherwise. (The default is the result of the command
\verb"\pointpoints{point}{points}".) Thus, if you give the command
\begin{center}
\verb"\pointpoints{Punkt}{Punkte}"
\end{center}
then typing the questions above would result in
\pointpoints{Punkt}{Punkte}
\begin{questions}
\question[1]
This is a short question.
\question[5]
This is a longer question, requiring more thought.
\end{questions}
There is also a command
\begin{center}
\verb"\marksnotpoints"
\end{center}
that is equivalent to the two commands
\begin{center}
\begin{tabular}{l}
\verb"\pointpoints{mark}{marks}"\\
\verb"\bonuspointpoints{mark (bonus)}{marks (bonus)}"
\end{tabular}
\end{center}
(the command \verb"\bonuspointpoints" is described in
section~\ref{sec:Bonus}). That command would cause the above
questions to be printed as \pointpoints{mark}{marks}
\begin{questions}
\question[1]
This is a short question.
\question[5]
This is a longer question, requiring more thought.
\end{questions}
\bigskip
For another example, if you give the command
\begin{center}
\verb"\pointname{\%}"
\end{center}
then the above questions would be printed as
%
\pointname{\%}
\nopointsinmargin
\noboxedpoints
\begin{questions}
\question[1]
This is a short question.
\question[5]
This is a longer question, requiring more thought.
\end{questions}
\pointname{ \points}
\subsubsection*{Using \texttt{\char`\\marginpointname}}
Similarly, the command \verb"\marginpointname" can be used to affect
the text set with the number of points when \verb"\pointsinmargin" or
\verb"\pointsinrightmargin" is in effect. For example, if you give
the commands
\begin{center}
\begin{tabular}{l}
\verb"\pointsinmargin"\\
\verb"\marginpointname{\%}"
\end{tabular}
\end{center}
and then type
\begin{verbatim}
\question[25]
Where, oh where, has my little dog gone?
\end{verbatim}
then you'll get
\pointsinmargin
\noboxedpoints
\marginpointname{\%}
\begin{questions}
\question[25]
Where, oh where, has my little dog gone?
\end{questions}
unless, e.g., you've also given the command \verb"\boxedpoints" (see
section~\ref{sec:Boxed}), in which case you'll get
%
\pointsinmargin
\boxedpoints
\marginpointname{\%}
\begin{questions}
\question[25]
Where, oh where, has my little dog gone?
\end{questions}
If you give the commands
\begin{center}
\begin{tabular}{l}
\verb"\marksnotpoints"\\
\verb"\marginpointname{ \points}"
\end{tabular}
\end{center}
then the above will print
\noboxedpoints
\marginpointname{ \points}
\marksnotpoints
\begin{questions}
\question[25]
Where, oh where, has my little dog gone?
\end{questions}
\nopointsinmargin
\marginpointname{}
\pointpoints{point}{points}
\bonuspointpoints{point (bonus)}{points (bonus)}
Using the default is equivalent to giving the command
\begin{center}
\verb"\marginpointname{}"
\end{center}
%--------------------------------------------------------------------
\subsubsection{Using \texttt{\char`\\marginpointname} and enlarging
the margins}
\label{sec:margins}
The default margins are not very large, and so if you use
\verb"\marginpointname" (see section~\ref{sec:pointname}) to place any
words along with the point values in the margin, you may run out of
room. The solution to this problem is to enlarge the margins by using
the \verb"\extrawidth" command with a negative argument to
\emph{decrease} the width of the text area, and thus \emph{increase}
the width of the margins. For example, the commands
\begin{center}
\begin{tabular}{ll}
\verb"\extrawidth{-1in}"\\
\verb"\marginpointname{ \points}"
\end{tabular}
\end{center}
will increase each of the left and right margins by one half inch,
which will easily leave room for the word ``points''. (See
section~\ref{sec:pagesize} for a discussion of the \verb"\extrawidth"
command.)
%--------------------------------------------------------------------
\subsubsection{Completely customizing the points}
\label{sec:pointformat}
If the customizations described in section~\ref{sec:Boxed} and
section~\ref{sec:pointname} (using \verb"\bracketedpoints",
\verb"\boxedpoints", \verb"\pointpoints", \verb"\pointname", and
\verb"\marginpointname") aren't sufficient, and you don't want to use
the \verb"\qformat" command to create a customized question number
line (see section~\ref{sec:qformat}), you can completely customize the
way the points are printed by using the commands
\begin{center}
\begin{tabular}{l}
\verb"\pointformat"\\
\verb"\bonuspointformat"
\end{tabular}
\end{center}
The \verb"\pointformat" command controls the printing of ``regular''
points (i.e., non-bonus points) and the \verb"\bonuspointformat"
command controls the printing of bonus points (see
section~\ref{sec:Bonus}).
Each of the commands \verb"\pointformat" and \verb"\bonuspointformat"
takes one argument, and that argument is what actually appears on the
page whether the points are being printed at the beginning of the
question (the default), in the left margin (because of
\verb"\pointsinmargin"), in the right margin (because of
\verb"\pointsinrightmargin"), or dropped in the right margin at the
end of the question (because of \verb"\pointsdroppedatright"). The
arguments to \verb"\pointformat" and \verb"\bonuspointformat" should
contain either the command
\begin{center}
\verb"\thepoints"
\end{center}
(which for non-bonus points prints the number of points followed by
the argument to the last \verb"\pointname" command and for bonus
points prints the number of bonus points followed by the argument to
the last \verb"\bonuspointname" command; see
section~\ref{sec:pointname}) or the command
\begin{center}
\verb"\themarginpoints"
\end{center}
(which for non-bonus points prints the number of points followed by
the argument to the last \verb"\marginpointname" command and for bonus
points prints the number of bonus points followed by the argument to
the last \verb"\marginbonuspointname" command; see
section~\ref{sec:pointname}). If the argument doesn't contain either
\verb"\thepoints" or \verb"\themarginpoints", then the number of
points will not appear.
For example, the command \verb"\bracketedpoints" is equivalent to
either
\begin{center}
\begin{tabular}{l}
\verb"\pointformat{[\thepoints]}"\\
\verb"\bonuspointformat{[\thepoints]}"
\end{tabular}
\end{center}
if the points are being printed at the beginning of the question, or
\begin{center}
\begin{tabular}{l}
\verb"\pointformat{[\themarginpoints]}"\\
\verb"\bonuspointformat{[\themarginpoints]}"
\end{tabular}
\end{center}
if the points are being printed in one of the margins.
For another example, the command \verb"\boxedpoints" is equivalent to
either
\begin{center}
\begin{tabular}{l}
\verb"\pointformat{\fbox{\thepoints}}"\\
\verb"\bonuspointformat{\fbox{\thepoints}}"
\end{tabular}
\end{center}
if the points are being printed at the beginning of the question, or
\begin{center}
\begin{tabular}{l}
\verb"\pointformat{\fbox{\themarginpoints}}"\\
\verb"\bonuspointformat{\fbox{\themarginpoints}}"
\end{tabular}
\end{center}
if the points are being printed in one of the margins.
For another example, the commands
\begin{verbatim}
\begin{questions}
\pointsinmargin
\marginpointname{\%}
\pointformat{\slshape (\themarginpoints)}
\question[3] What is the point?
\end{questions}
\end{verbatim}
will produce
\begin{questions}
\pointsinmargin
\marginpointname{\%}
\pointformat{\slshape (\themarginpoints)}
\question[3] What is the point?
\end{questions}
For another example, the commands
\begin{verbatim}
\begin{questions}
\pointsinrightmargin
\marginpointname{\%}
\pointformat{\fbox{\bfseries\boldmath\themarginpoints}}
\question[3\half] What is the point?
\end{questions}
\end{verbatim}
will produce
\begin{questions}
\pointsinrightmargin
\marginpointname{\%}
\pointformat{\fbox{\bfseries\boldmath\themarginpoints}}
\question[3\half] What is the point?
\end{questions}
\nopointsinmargin (Note: The commands \verb"\bfseries" and
\verb"\boldmath" are both needed here because the \half{} printed when
you use half points is printed in math mode while the rest of the
points are printed in text mode.)
For another example, the commands
\begin{verbatim}
\begin{questions}
\pointname{}
\pointformat{\bfseries\boldmath(Points for this problem: \thepoints)}
\question[3\half] What is the point?
\end{questions}
\end{verbatim}
will produce
\begin{questions}
\pointname{}
\pointformat{\bfseries\boldmath(Points for this problem: \thepoints)}
\question[3\half] What is the point?
\end{questions}
% Put things back to the default situation, so we don't mess up
% later examples:
\noboxedpoints
\nopointsinmargin
\pointname{ \points}
%---------------------------------------------------------------------
\subsubsection{Questions that begin with a parts environment}
If a question begins with a parts environment, then the question
number and the number of the first part in the parts environment will
be printed on the same line (see section~\ref{sec:parts}). Thus, if
points are assigned to both the question and to the first part, both
of those point values will be printed on the same line. (Note: This
was not true in versions of the \verb"exam" document class earlier
than 2.3. In those versions, only the later of the two point values
would actually be printed.) If \verb"\pointsinmargin" or
\verb"\pointsinrightmargin" are in effect (see
section~\ref{sec:whereprint}), then the two point values will be
printed on top of each other, which is probably not what you want.
The same problem arises if a part begins with a subparts environment
or if a subpart begins with a subsubparts environment.
If you want to assign points to both a question and to each part of a
parts environment, and if the first part will begin on the same line
as the question, the solution is to either use the default location
(i.e., \verb"\nopointsinmargin") or to put some of the points in the
margin and others not. For example, if you type
\begin{verbatim}
\begin{questions}
\pointsinmargin
\noaddpoints
\question[10]
\begin{parts}
\nopointsinmargin
\addpoints
\part[5] Who put the ``bop'' in the ``bop, sh-bop, sh-bop''?
\part[5] Who put the ``ram'' in the ``rama, rama ding-dong''?
\end{parts}
\end{questions}
\end{verbatim}
then you'll get
\begin{questions}
\pointsinmargin
\noaddpoints
\question[10]
\begin{parts}
\nopointsinmargin
\addpoints
\part[5] Who put the ``bop'' in the ``bop, sh-bop, sh-bop''?
\part[5] Who put the ``ram'' in the ``rama, rama ding-dong''?
\end{parts}
\end{questions}
%--------------------------------------------------------------------
\subsubsection{Adding up the points for a question}
\label{sec:addup}
If you use the document class option \verb"addpoints" (as in
\verb"\documentclass[addpoints]{exam}") or give the command
\verb"\addpoints" (see section~\ref{sec:addpoints}), then you can use
the command
\begin{center}
\verb"\droptotalpoints"
\end{center}
to put into the right margin the total number of points for the
current question (including the points for all parts, subparts, and
subsubparts). (Section~\ref{sec:adding} describes a different way to
print the total number of points for a question.) The command
\verb"\droptotalpoints" should be given only at the end of a paragraph
or between paragraphs; if you give it within a paragraph, it causes
the paragraph to end. \verb"\droptotalpoints" prints the total points
for the current question in the right margin, formatted by default as:
\par\nobreak\medskip
\makeatletter
\leavevmode\nobreak\hfill
\rlap{%\hskip\rightmargin % Defined by the list environment
\hskip\@rightmargin % Defined by exam.cls
\hskip-\rightpointsmargin
\llap{Total for Question 2: 25}%
}% rlap
\makeatother
\par\medskip\noindent
(Note: The number of points is followed by the argument to the most
recently executed \verb"\marginpointname" command (see
section~\ref{sec:pointname}), which by default is empty.)
If the current question is worth any bonus points (see
section~\ref{sec:Bonus}), then those bonus points will not be counted
by the \verb"\droptotalpoints" command, but they will be counted by
the
\begin{center}
\verb"\droptotalbonuspoints"
\end{center}
command, which puts into the right margin the total number of bonus
points for the current question, formatted by default as:
\par\nobreak\medskip
\makeatletter
\leavevmode\nobreak\hfill
\rlap{%\hskip\rightmargin % Defined by the list environment
\hskip\@rightmargin % Defined by exam.cls
\hskip-\rightpointsmargin
\llap{Total for Question 2: 10 (bonus)}%
}% rlap
\makeatother
\par\medskip\noindent
(Note: The number of bonus points is followed by the argument to the
most recently executed \verb"\marginbonuspointname" command (see
section~\ref{sec:Bonus}), which by default is `` (bonus)''.)
You can change the format used by the \verb"\droptotalpoints" command
with the
\begin{center}
\verb"\totalformat"
\end{center}
command. It takes one argument, and that argument becomes the command
to print the total points, right justified a distance of
\verb"\rightpointsmargin" from the right edge of the paper. The
argument can contain the command
\begin{center}
\begin{tabular}{ll}
\verb"\totalpoints"& to print the number of points, and\\
\verb"\thequestion"& to print the question number.
\end{tabular}
\end{center}
(\verb"\totalpoints" expands to
\verb"\pointsofquestion{\arabic{question}}"; see
section~\ref{sec:pointsofq} for a discussion of the
\verb"\pointsofquestion" command.) For example, if you give the
command
\begin{center}
\verb"\totalformat{Question \thequestion: \totalpoints}"
\end{center}
then the total number of points will be printed in the format
\par\nobreak\medskip
\makeatletter
\leavevmode\nobreak\hfill
\rlap{%\hskip\rightmargin % Defined by the list environment
\hskip\@rightmargin % Defined by exam.cls
\hskip-\rightpointsmargin
\llap{Question 2: 25}%
}% rlap
\makeatother
\par\medskip\noindent
and if you give the command
\begin{center}
\verb"\totalformat{\fbox{Total: \totalpoints}}"
\end{center}
then the total number of points will be printed as
\par\nobreak\medskip
\makeatletter
\leavevmode\nobreak\hfill
\rlap{%\hskip\rightmargin % Defined by the list environment
\hskip\@rightmargin % Defined by exam.cls
\hskip-\rightpointsmargin
\llap{\fbox{Total: 25}}%
}% rlap
\makeatother
\par\medskip\noindent
Thus, if you've given the commands
\begin{center}
\begin{tabular}{l}
\verb"\addpoints"\\
\verb"\bracketedpoints"\\
\verb"\pointdroppedatright"
\end{tabular}
\end{center}
and you type
\begin{verbatim}
\question
\begin{parts}
\part[10]
In no more than one paragraph, explain why the earth is round.
\droppoints
\part[10]
What changes to the van Allen radiation belt are needed to
make the earth into a regular icosahedron?
\droppoints
\end{parts}
\droptotalpoints
\end{verbatim}
then you'll get
\addpoints
\pointsdroppedatright
\bracketedpoints
\begin{questions}
\question
\begin{parts}
\part[10]
In no more than one paragraph, explain why the earth is round.
\droppoints
\part[10]
What changes to the van Allen radiation belt are needed to
make the earth into a regular icosahedron?
\droppoints
\end{parts}
\leavevmode\unskip\nobreak\hfill
\makeatletter
\rlap{\hskip\rightmargin % Defined by the list environment
\hskip\@rightmargin % Defined by exam.cls
\hskip-\rightpointsmargin
\llap{Total for Question 1: 20}%
}% rlap
\makeatother
\par
%\droptotalpoints
\end{questions}
\noaddpoints
\nopointsinmargin
\nobracketedpoints
If you've also given the command
\begin{center}
\verb"\totalformat{Total for Question \thequestion: [\totalpoints]}"
\end{center}
then you'll get
\addpoints
\pointsdroppedatright
\bracketedpoints
\begin{questions}
\question
\begin{parts}
\part[10]
In no more than one paragraph, explain why the earth is round.
\droppoints
\part[10]
What changes to the van Allen radiation belt are needed to
make the earth into a regular icosahedron?
\droppoints
\end{parts}
%\droptotalpoints
\leavevmode\unskip\nobreak\hfill
\makeatletter
\rlap{\hskip\rightmargin % Defined by the list environment
\hskip\@rightmargin % Defined by exam.cls
\hskip-\rightpointsmargin
\llap{Total for Question 1: [20]}%
}% rlap
\makeatother
\par
\end{questions}
\noaddpoints
\nopointsinmargin
\nobracketedpoints
To change the format used by the \verb"\droptotalbonuspoints" command,
you use the command
\begin{center}
\verb"\bonustotalformat"
\end{center}
which is analogous to the \verb"\totalformat" command. The argument
to \verb"\bonustotalformat" can contain the command
\begin{center}
\begin{tabular}{ll}
\verb"\totalbonuspoints"& to print the number of bonus points, and\\
\verb"\thequestion"& to print the question number.
\end{tabular}
\end{center}
(\verb"\totalbonuspoints" expands to
\verb"\bonuspointsofquestion{\arabic{question}}"; see
section~\ref{sec:BonusTables} for a discussion of the
\verb"\bonuspointsofquestion" command.)
%--------------------------------------------------------------------
\subsubsection{Margin sizes when using \texttt{\char`\\pointsinmargin}
and \texttt{\char`\\pointsinrightmargin}}
\begin{itemize}
\item If you give the command \verb"\pointsinmargin", then the points
are printed right justified in the left margin, with the right edge
a distance of \verb"\marginpointsep" from the left edge of the text
area. The default value of \verb"\marginpointsep" is the result of
the command
\begin{center}
\verb"\setlength{\marginpointssep}{5pt}"
\end{center}
and you can change it by giving a new \verb"\setlength" command.
\item If you give the command \verb"\pointsinrightmargin", then the
points are printed right justified in the right margin, with the
right edge a distance of \verb"\rightpointsmargin" from the right
edge of the paper. The default value of \verb"\rightpointsmargin"
is the result of the command
\begin{center}
\verb"\setlength{\rightpointsmargin}{1cm}"
\end{center}
and you can change it by giving a new \verb"\setlength" command.
\end{itemize}
You can change the width of the text area (and, thus, change the width
of the margins) with the \verb"\extrawidth" command (see
section~\ref{sec:margins}).
%--------------------------------------------------------------------
\subsection{Custom question number lines: The \texttt{\char`\\qformat}
command}
\label{sec:qformat}
The default setup is for the question number to appear in the left
margin and for the text of the question to begin on that line. It's
possible to change this so that the text of the question starts on the
line following the question number, and the format of the line
containing the question number is determined by the user. This is
done using the \verb"\qformat" command. (There is also a
\verb"\noqformat" command, which reverts to the default setup.)
To use the \verb"\qformat" command, you give the command
\begin{center}
\verb"\qformat{Format specification}"
\end{center}
where `Format specification' must contain some stretchability (e.g.,
at least one \verb"\hfill" or \verb"\dotfill" or \verb"\hrulefill" or
\ldots) and can contain the commands
\begin{itemize}
\item \verb"\thequestion", which expands to the question number,
\item \verb"\thepoints", which expands to
\begin{itemize}
\item nothing, if no points were specified for the question,
\item the number of points followed by the argument to the last
\verb"\pointname" command, if this is a ``regular'' question
(i.e., not a bonus question; see section~\ref{sec:Bonus}), and
\item the number of bonus points followed by the argument to the
last \verb"\bonuspointname" command, if this is a bonus question
(see section~\ref{sec:Bonus})
\end{itemize}
(see section~\ref{sec:pointname} for a discussion of the
\verb"\pointname" and \verb"\bonuspointname" commands), and
\item \verb"\totalpoints", which expands to the total number of points
specified for the question and all of its parts, subparts, and
subsubparts (see section~\ref{sec:addup}). The command
\verb"\totalpoints" expands to
\verb"\pointsofquestion{\arabic{question}}".
\end{itemize}
For example, if you give the commands
%
\pointname{ \points}
\pointpoints{point}{points}
\begin{verbatim}
\qformat{Question \thequestion \dotfill \thepoints}
\begin{questions}
\question[10]
What did Billy Joe MacAllister throw off the Tallahatchie Bridge?
\end{questions}
\end{verbatim}
then you'll get
\qformat{Question \thequestion \dotfill \thepoints}
\begin{questions}
\question[10]
What did Billy Joe MacAllister throw off the Tallahatchie Bridge?
\end{questions}
%
\medskip
If you instead use the command
\begin{verbatim}
\qformat{\textbf{Question \thequestion}\quad (\thepoints)\hfill}
\end{verbatim}
then you'll get
\begin{questions}
\qformat{\textbf{Question \thequestion}\quad (\thepoints)\hfill}
\question[10]
What did Billy Joe MacAllister throw off the Tallahatchie Bridge?
\end{questions}
%
\medskip
If you instead use the command
\begin{verbatim}
\qformat{\hfill Question \thequestion\hfill (\thepoints)}
\end{verbatim}
then you'll get
\begin{questions}
\qformat{\hfill Question \thequestion\hfill (\thepoints)}
\question[10]
What did Billy Joe MacAllister throw off the Tallahatchie Bridge?
\end{questions}
\noqformat
%--------------------------------------------------------------------
\subsubsection{Adding up the points for a question}
\label{sec:adding}
You can combine \verb"\qformat" with the \verb"\totalpoints" command
(see section~\ref{sec:addup}): If you assign points only to parts,
subparts, and subsubparts of questions, but none to the questions
themselves, and you give the command
\begin{verbatim}
\qformat{Question \thequestion\dotfill \emph{\totalpoints\ points}}
\end{verbatim}
(you must have used the document class option \verb"addpoints" or
given the command \verb"\addpoints" in order to use the
\verb"\totalpoints" command; see section~\ref{sec:addpoints}), then
you can type
\begin{verbatim}
\begin{questions}
\question
\begin{parts}
\part[10]
In no more than one paragraph, explain why the earth is round.
\part[10]
What changes to the van Allen radiation belt are needed to make
the earth into a regular icosahedron?
\end{parts}
\end{questions}
\end{verbatim}
and you'll get
%
\nopointsinmargin
\qformat{Question \thequestion\dotfill \emph{20 points}}
\begin{questions}
\question
\begin{parts}
\part[10]
In no more than one paragraph, explain why the earth is round.
\part[10]
What changes to the van Allen radiation belt are needed to make
the earth into a regular icosahedron?
\end{parts}
\end{questions}
\noqformat
For another method of printing the total points for a question, see
the \verb"\droptotalpoints" command in section~\ref{sec:addup}.
%--------------------------------------------------------------------
\subsection{Titled questions}
\label{sec:Titled}
When using a grading table or point table indexed by question number
(see sections \ref{sec:GradeTables} and~\ref{sec:PointTables}) it's
possible to replace the question numbers in the table with titles for
the questions. This is done using the \verb"\titledquestion" command
(see section~\ref{sec:TitledQues}), and you can then print the title
in places other than the table using the \verb"\thequestiontitle"
command (see section~\ref{sec:questiontitle}).
%--------------------------------------------------------------------
\subsubsection{\texttt{\char`\\titledquestion}}
\label{sec:TitledQues}
The command \verb"\titledquestion" is a replacement for
\verb"\question"; it has one required argument (the title) and one
optional argument (the point value), as in
\begin{center}
\verb"\titledquestion{Question \thequestion: Concepts}"
\end{center}
which sets the question title to ``Question 2: Concepts'' (if this is
the second question) and doesn't set any point values, or
\begin{center}
\verb"\titledquestion{Design}[10]"
\end{center}
which sets the question title to ``Design'' and sets the point value
to ``10''. Note that the question title doesn't include the number of
the question unless you put it there using the \verb"\thequestion"
command.
Using \verb"\titledquestion" instead of \verb"\question" doesn't
change the appearance of the question (unless you use
\verb"\thequestiontitle" in the argument of a \verb"\qformat" command;
see section~\ref{sec:questiontitle}). The only direct effect of using
\verb"\titledquestion" instead of \verb"\question" is that if you
print a grading table indexed by question number (see
section~\ref{sec:GradeTables}), then the title of the question will
replace the number of the question in the table. To have the title of
the question appear in the question itself, see the example in
section~\ref{sec:questiontitle}.
If you create a grading table or point table indexed by question
number and you create a question using the \verb"\titledquestion"
command, then the number of the question won't appear in the table
unless you include \verb"\thequestion" in the title of the question.
%--------------------------------------------------------------------
\subsubsection{\texttt{\char`\\thequestiontitle}}
\label{sec:questiontitle}
The command \verb"\thequestiontitle" expands to
\begin{itemize}
\item the title of the question (if the question was defined using a
\verb"\titledquestion" command) or
\item the number of the question (if the question was defined using a
\verb"\question" command).
\end{itemize}
This is for use in the argument of a \verb"\qformat" command (see
section~\ref{sec:qformat}), so that you can have the question title
appear in the question itself, and not just in a grading table or
point table.
The contents of \verb"\thequestiontitle" don't appear anywhere in the
question itself unless you do something to make them appear. For
example, if you give the command
\begin{center}
\verb"\qformat{Question \thequestion: \thequestiontitle\dotfill\thepoints}"
\end{center}
and then type
\begin{verbatim}
\begin{questions}
\titledquestion{History of Empirical Aerodynamics}[10]
What did Billy Joe MacAllister throw off the Tallahatchie Bridge?
\end{questions}
\end{verbatim}
then you'll get
\begin{questions}
\qformat{Question \thequestion: \thequestiontitle\dotfill\thepoints}
\titledquestion{History of Empirical Aerodynamics}[10]
What did Billy Joe MacAllister throw off the Tallahatchie Bridge?
\end{questions}
\noqformat
If the command \verb"\thequestiontitle" is never used, then the only
effect of using the command \verb"\titledquestion" instead of the
command \verb"\question" is that, in a grading table or point table
indexed by question number, this question will be indexed by the title
of the question rather than by the question number, and the title of
the question will never appear except in the table.
%--------------------------------------------------------------------
\subsection{Bonus points}
\label{sec:Bonus}
It's possible to create questions, parts, subparts, or subsubparts
that are worth \emph{bonus points}, instead of regular points. To do
this, you use the command
\begin{center}
\begin{tabular}{l@{\qquad instead of\qquad}l}
\verb"\bonusquestion"& \verb"\question",\\
\verb"\bonustitledquestion"& \verb"\titledquestion",\\
\verb"\bonuspart"& \verb"\part",\\
\verb"\bonussubpart"& \verb"\subpart", and\\
\verb"\bonussubsubpart"& \verb"\subsubpart".
\end{tabular}
\end{center}
If you don't assign any points to these commands then using them is
equivalent to using the corresponding non-bonus commands. If you do
assign points, though, then
\begin{itemize}
\item the points are typeset differently (see below),
\item the points are not counted by the \verb"\gradetable" or
\verb"\pointtable" commands (see sections \ref{sec:GradeTables}
and~\ref{sec:PointTables}), though they \emph{are} counted by the
\verb"\bonusgradetable" and \verb"\bonuspointtable" commands (see
section~\ref{sec:BonusTables}),
\item the points are not counted by the \verb"\droptotalpoints"
command (see section~\ref{sec:addup}), though they are counted by
the \verb"\droptotalbonuspoints" command (see below),
\item the points are not counted by the \verb"\pointsofquestion" (see
section~\ref{sec:pointsofq}) or \verb"\pointsonpage" (see
section~\ref{sec:pointsonp}) commands, though they \emph{are}
counted by the \verb"\bonuspointsofquestion" and
\verb"\bonuspointsonpage" (see section~\ref{sec:BonusTables})
commands, and
\item the points are not counted by the \verb"\numpoints" command (see
section~\ref{sec:Count}), though they \emph{are} counted by the
\verb"\numbonuspoints" command (see section~\ref{sec:Count}).
\end{itemize}
The default setup is that if you type
\begin{verbatim}
\begin{questions}
\question[10] Who discovered America?
\bonusquestion[1] On what day of the week did he do it?
\bonusquestion[2] What color shirt was he wearing?
\end{questions}
\end{verbatim}
then you'll get
\begin{questions}
\question[10] Who discovered America?
\bonusquestion[1] On what day of the week did he do it?
\bonusquestion[2] What color shirt was he wearing?
\end{questions}
There is also a command \verb"\bonuspointpoints" that is analogous to
\verb"\pointpoints" (see section~\ref{sec:pointname}); the default
setup was created by the command
\begin{center}
\verb"\bonuspointpoints{point (bonus)}{points (bonus)}"
\end{center}
and if you give the command
\begin{center}
\verb"\bonuspointpoints{bonus point}{bonus points}"
\end{center}
then typing the above would produce
\begin{questions}
\bonuspointpoints{bonus point}{bonus points}
\question[10] Who discovered America?
\bonusquestion[1] On what day of the week did he do it?
\bonusquestion[2] What color shirt was he wearing?
\end{questions}
There are also commands
\begin{center}
\begin{tabular}{l}
\verb"\bonuspointname" and\\
\verb"\marginbonuspointname"
\end{tabular}
\qquad that are analogous to\qquad
\begin{tabular}{l}
\verb"\pointname" and\\
\verb"\marginpointname"
\end{tabular}
\end{center}
(see section~\ref{sec:pointname}), and commands
\begin{center}
\begin{tabular}{l}
\verb"\droptotalbonuspoints",\\
\verb"\bonustotalformat", and\\
\verb"\totalbonuspoints"
\end{tabular}
\qquad that are analogous to\qquad
\begin{tabular}{l}
\verb"\droptotalpoints",\\
\verb"\totalformat", and\\
\verb"\totalpoints"
\end{tabular}
\end{center}
(see section~\ref{sec:addup}).
%--------------------------------------------------------------------
\subsection{Counting the questions and adding up the points}
\label{sec:Count}
The \verb"exam" document class automatically counts the numbers of
questions, parts, and subparts, and makes these numbers available as
the macros
\begin{center}
\begin{tabular}{l}
\verb"\numquestions"\\
\verb"\numparts"\\
\verb"\numsubparts"\\
\verb"\numsubsubparts"
\end{tabular}
\end{center}
These numbers are also printed on the screen when you run \LaTeX{} and
they are placed into the \verb".log" file as well. If you have more
than one \verb"questions" environment (for example, if your exam has
several parts, with the questions in each part numbered beginning with
``1''), then \verb"\numquestions" will hold the total number of
questions on the exam. If you do have more than one \verb"questions"
environment, though, you won't be able to use the \verb"\gradetable"
or \verb"\pointtable" commands (see section~\ref{sec:Tables}).
If you use the document class option \verb"addpoints" or give the
command \verb"\addpoints" (see section~\ref{sec:addpoints}), then the
class will add the total number of points and the total number of
bonus points (see section~\ref{sec:Bonus}) that you've given to all of
the questions, parts, subparts, and subsubparts of the exam, and make
those totals available in the macros
\begin{center}
\begin{tabular}{l}
\verb"\numpoints"\\
\verb"\numbonuspoints"
\end{tabular}
\end{center}
as well as displaying those totals on the screen when you run \LaTeX{}
and placing them into the \verb".log" file. You can then type
\begin{verbatim}
\begin{center}
This exam has \numquestions\ questions, for a total of \numpoints\
points and \numbonuspoints\ bonus points.
\end{center}
\end{verbatim}
and you'll get
\begin{center}
This exam has 8 questions, for a total of 120 points and 10 bonus
points.
\end{center}
\emph{Warning}: If \verb"addpoints" is in effect, your point values
for questions, parts, subparts, and subsubparts must not contain
anything other than digits and the command \verb"\half" (see
section~\ref{sec:Half}). For example, if you \emph{don't} give the
command \verb"\addpoints", then you can type
\begin{center}
\verb"\question[10\%]"
\end{center}
with no problems, but this will cause errors if you've given the
command \verb"\addpoints". The correct way to accomplish what you
want is to give the command \verb"\marginpointname{\%}" or
\verb"\pointname{\%}" and then type \verb"\question[10]" (see
section~\ref{sec:pointname}).
If you want to temporarily turn off the adding of points (for example,
if you list both the total points for each question and the points for
each part, but you don't want to count the points twice), you can give
the command
\begin{center}
\verb"\noaddpoints"
\end{center}
to turn off the adding of points and the command \verb"\addpoints" to
turn it back on.
If \verb"addpoints" is in effect, then you can create grading tables
(see section~\ref{sec:GradeTables}) and point tables (see
section~\ref{sec:PointTables}) and use the commands
\verb"\pointsofquestion" (see section~\ref{sec:pointsofq}) and
\verb"\pointsonpage" (see section~\ref{sec:pointsonp}).
%---------------------------------------------------------------------
\subsection{Referring to specific questions by number (cross
references)}
You can use the standard \LaTeX{} commands \verb"\label" and
\verb"\ref" to refer to questions (or parts, or subparts, or
subsubparts) by number. For example, if you type
\begin{verbatim}
The first question is question number~\ref{ques:first}.
Question number~\ref{ques:second} has both a good part
(part~\ref{part:good}) and a bad part (part~\ref{part:bad}).
\begin{questions}
\question
\label{ques:first}
This is the first question.
\question
\label{ques:second}
\begin{parts}
\part
\label{part:good}
This is the good part.
\part
\label{part:bad}
This is the \emph{bad} part.
\end{parts}
\question
Is there a question?
\end{questions}
\end{verbatim}
then you'll get:
\medskip
The first question is question number~\ref{ques:first}.
Question number~\ref{ques:second} has both a good part
(part~\ref{part:good}) and a bad part (part~\ref{part:bad}).
\begin{questions}
\question
\label{ques:first}
This is the first question.
\question
\label{ques:second}
\begin{parts}
\part
\label{part:good}
This is the good part.
\part
\label{part:bad}
This is the \emph{bad} part.
\end{parts}
\question
Is there a question?
\end{questions}
\bigskip
As with all other cross references in \LaTeX, you'll have to run your
file through \LaTeX{} \emph{twice} to be sure that all the cross
references are correct.
%--------------------------------------------------------------------
\subsection{Customizing the numbers}
\label{sec:CustNumb}
The default setup is that:
\begin{questions}
\question Question numbers are arabic, and are followed by a period.
\begin{parts}
\part Part numbers are lower case letters, and are enclosed in
parentheses.
\begin{subparts}
\subpart Subpart numbers are lower case roman, and are followed
by a period.
\begin{subsubparts}
\subsubpart Subsubpart numbers are greek, and are followed by
a right parenthesis.
\begin{choices}
\choice Choices are upper case letters, and are followed by
a period.
\end{choices}
\end{subsubparts}
\end{subparts}
\end{parts}
\end{questions}
All of this can be changed.
\bigskip
To change the type of numbering, you would redefine the commands
\begin{center}
\begin{tabular}{l}
\verb"\thequestion"\\
\verb"\thepartno"\\
\verb"\thesubpart"\\
\verb"\thesubsubpart"\\
\verb"\thechoice"
\end{tabular}
\end{center}
(Note: The second one listed there is \verb"\thepartno", \emph{not}
\verb"\thepart". The command \verb"\thepart" refers to the counter
used in the article document class standard sectioning command
\verb"\part".) The numbering commands available are
\begin{center}
\begin{tabular}{ll}
\verb"\arabic"& Regular arabic integers\\
\verb"\alph"& Lower case letters\\
\verb"\Alph"& Upper case letters\\
\verb"\roman"& Lower case roman numbers\\
\verb"\Roman"& Upper case roman numbers\\
\verb"\greeknum"& Greek letters
\end{tabular}
\end{center}
and any of these can be applied to the counters \verb"question",
\verb"partno", \verb"subpart", \verb"subsubpart", and \verb"choice".
(The \verb"\greeknum" command is defined by the exam document class,
but all of the others are standard \LaTeX{} commands.)
For example, to have questions numbered using upper case roman numbers
and parts numbered using upper case letters, you would give the
commands
\begin{center}
\begin{tabular}{l}
\verb"\renewcommand\thequestion{\Roman{question}}"\\
\verb"\renewcommand\thepartno{\Alph{partno}}"
\end{tabular}
\end{center}
\bigskip
The ``decorations'' around the numbers (i.e., the periods, or
parentheses, or \ldots) are determined by the commands
\begin{center}
\begin{tabular}{l}
\verb"\questionlabel"\\
\verb"\partlabel"\\
\verb"\subpartlabel"\\
\verb"\subsubpartlabel"\\
\verb"\choicelabel"
\end{tabular}
\end{center}
the default definitions of which are:
\begin{center}
\begin{tabular}{l}
\verb"\newcommand\questionlabel{\thequestion.}"\\
\verb"\newcommand\partlabel{(\thepartno)}"\\
\verb"\newcommand\subpartlabel{\thesubpart.}"\\
\verb"\newcommand\subsubpartlabel{\thesubsubpart)}"\\
\verb"\newcommand\choicelabel{\thechoice.}"
\end{tabular}
\end{center}
You can change any of these by giving \verb"\renewcommand" commands to
redefine them.
%--------------------------------------------------------------------
\subsection{Customizing the list parameters}
\label{sec:CustList}
Each of the environments \verb"questions", \verb"parts",
\verb"subparts", \verb"subsubparts", and \verb"choices" is implemented
as a \verb"list" environment. This section describes commands for
advanced users who want to customize the list parameters
(\verb"\topsep", \verb"\partopsep", \verb"\itemsep", \verb"\parsep",
etc.) for the lists that those environments create.
The \verb"exam" document class includes the expansion of
\begin{center}
\begin{tabular}{l@{\qquad when creating a\qquad}l@{\qquad}l}
\verb"\questionshook"&\verb"questions"&environment,\\
\verb"\partshook"&\verb"parts"&environment,\\
\verb"\subpartshook"&\verb"subparts"&environment,\\
\verb"\subsubpartshook"&\verb"subsubparts"&environment, and\\
\verb"\choiceshook"&\verb"choices"&environment.
\end{tabular}
\end{center}
The \verb"exam" document class defines these as follows:
\begin{center}
\begin{tabular}{ll}
\verb"\newcommand\questionshook{}"\\
\verb"\newcommand\partshook{}"\\
\verb"\newcommand\subpartshook{}"\\
\verb"\newcommand\subsubpartshook{}"\\
\verb"\newcommand\choiceshook{}"
\end{tabular}
\end{center}
Thus, by default, these commands have no effect, but you can change
any of them with a \verb"\renewcommand" command. Thus, if you
redefine, e.g., \verb"\questionshook" to expand to commands that set
values for some of the list parameters, then those values will be used
in the \verb"questions" environment.
For example, if you give the command
\begin{center}
\verb"\renewcommand\questionshook{\setlength{\itemsep}{1in}}"
\end{center}
then there will be an additional one inch of blank space inserted
between questions (since the questions are the items in a
\verb"questions" environment). For another example, if you give the
command
\begin{center}
\verb"\renewcommand\partshook{\setlength{\topsep}{0.5in}}"
\end{center}
then each parts environment will have an additional one half inch of
space before and after the environment.
%--------------------------------------------------------------------
%--------------------------------------------------------------------
\section{Escaping the indentation: \texttt{\char`\\uplevel} and
\texttt{\char`\\fullwidth}}
\label{sec:uplevel}
There are two commands provided for printing text with a left margin
smaller than the one currently in effect: \verb"\uplevel" and
\verb"\fullwidth". Each of these commands takes one argument and
typesets the argument with an altered left margin. The main uses for
these commands are including instructions for a group of questions
(see section~\ref{sec:Instructions}) and naming the parts of a long
exam (see section~\ref{sec:Naming}), but you can use them however you
like.
%--------------------------------------------------------------------
\subsection{Including instructions for a group of questions}
\label{sec:Instructions}
If you are inside of a parts environment and you want to give
directions for the next few parts, then those directions should be
indented to the level of the question of which they are parts, i.e.,
up one level. If you type
\begin{verbatim}
\begin{questions}
\question
Why did you come to Casablanca?
\question
\begin{parts}
\part
Why, Oh why, Oh why, Oh; why did I ever leave Ohio?
\uplevel{The following two parts should be answered in classical
Greek:}
\part
Why do birds sing?
\part
Why do fools fall in love?
\end{parts}
\end{questions}
\end{verbatim}
then you'll get
\begin{questions}
\question
Why did you come to Casablanca?
\question
\begin{parts}
\part
Why, Oh why, Oh why, Oh; why did I ever leave Ohio?
\uplevel{The following two parts should be answered in classical
Greek:}
\part
Why do birds sing?
\part
Why do fools fall in love?
\end{parts}
\end{questions}
If you want to give instructions for a group of questions, then the
indenting for those instructions should be to the outer left margin,
i.e., up one level. For example, if you type
\begin{verbatim}
\begin{questions}
\question
Approximate $\displaystyle \int_0^1 \sin x^2 \, dx$ within $.001$ of
its true value.
\uplevel{Questions \ref{exact-start} through~\ref{exact-end} should
be evaluated completely, not just approximated.}
\question
\label{exact-start}
$\displaystyle \int_0^1 \frac{x^2 \, dx}{\sqrt{1-x^2}}$
\question
$\displaystyle \int_0^1 \frac{1}{1+x^2}\, dx$
\question
\label{exact-end}
$\displaystyle \int_0^{\frac{\pi}{2}} \sin^3 x \cos x \, dx$
\end{questions}
\end{verbatim}
you'll get
\begin{questions}
\question
Approximate $\displaystyle \int_0^1 \sin x^2 \, dx$ within $.001$ of
its true value.
\uplevel{Questions \ref{exact-start} through~\ref{exact-end} should
be evaluated completely, not just approximated.}
\question
\label{exact-start}
$\displaystyle \int_0^1 \frac{x^2 \, dx}{\sqrt{1-x^2}}$
\question
$\displaystyle \int_0^1 \frac{1}{1+x^2}\, dx$
\question
\label{exact-end}
$\displaystyle \int_0^{\frac{\pi}{2}} \sin^3 x \cos x \, dx$
\end{questions}
If you want to give instructions that use the full width of the page
(rather than just going up one level of indentation), then use the
\verb"\fullwidth" command. For example, if you type
\begin{verbatim}
\begin{questions}
\question
This is the first question.
\question
\begin{parts}
\part
This is the first part.
\part
This is the second part.
\begin{subparts}
\subpart
This is a subpart.
\fullwidth{When you finish this exam, you should go back and
reexamine your work, both on this exam and in your life up
until the day of this exam, for any errors that you may have
made.}
\subpart
This is another subpart.
\end{subparts}
\end{parts}
\end{questions}
\end{verbatim}
then you'll get
\begin{questions}
\question
This is the first question.
\question
\begin{parts}
\part
This is the first part.
\part
This is the second part.
\begin{subparts}
\subpart
This is a subpart.
\fullwidth{When you finish this exam, you should go back and
reexamine your work, both on this exam and in your life up
until the day of this exam, for any errors that you may have
made.}
\subpart
This is another subpart.
\end{subparts}
\end{parts}
\end{questions}
%---------------------------------------------------------------------
\subsection{Naming the parts of a long exam}
\label{sec:Naming}
There are two ways of naming the parts of a long exam. The first way
uses the \verb"\fullwidth" and \verb"\uplevel" commands (see
section~\ref{sec:Namefullwidth}), and the other way uses the standard
\verb"\part" and \verb"\section" commands (see
section~\ref{sec:NameSection}).
%--------------------------------------------------------------------
\subsubsection{Using \texttt{\char`\\uplevel} and
\texttt{\char`\\fullwidth}}
\label{sec:Namefullwidth}
To place a section name in the exam, just use a \verb"\fullwidth"
command (see section~\ref{sec:uplevel}) and include whatever font
changing commands that you want to use. For example, if you type
\begin{verbatim}
\begin{questions}
\question
Is there, is there balm in Gilead?
\fullwidth{\Large \textbf{Essay questions}}
\question
Explain how the cooling of matter in the centuries following the big
bang has influenced the British parliamentary system of government.
\fullwidth{\Large \textbf{Laboratory questions}}
\question
In the cabinet below your laboratory bench you will find a single
edged razor blade, several C-clamps, and a bottle of whiskey.
Remove your appendix. Do not suture until your work has been
inspected.
\end{questions}
\end{verbatim}
then you'll get
\begin{questions}
\question
Is there, is there balm in Gilead?
\fullwidth{\Large \textbf{Essay questions}}
\question
Explain how the cooling of matter in the centuries following the big
bang has influenced the British parliamentary system of government.
\fullwidth{\Large \textbf{Laboratory questions}}
\question
In the cabinet below your laboratory bench you will find a single
edged razor blade, several C-clamps, and a bottle of whiskey.
Remove your appendix. Do not suture until your work has been
inspected.
\end{questions}
%--------------------------------------------------------------------
\subsubsection{Using the standard sectioning commands}
\label{sec:NameSection}
The exam document class is built upon the standard article document
class, and so the sectioning commands used with the article document
class can be used here as well. In particular, you can give the
commands \verb"\part", \verb"\part*", \verb"\section", and
\verb"\section*". The definitions made in \verb"exam.cls" ensure that
if a \verb"\part" command appears \emph{outside of a parts
environment} it will be interpreted as a sectioning command, while
if it appears \emph{inside of a parts environment} it will be
interpreted as beginning a new part of a question.
You can give these commands in the middle of a questions environment
so as not to interrupt the numbering of the questions, or you can end
a questions environment, give a sectioning command, and then start a
new questions environment (which would reset the question counter to
start again with number~1). If you have more than one questions
environment, though, then you will be unable to use any of the
commands that create grading tables or point tables (see
section~\ref{sec:Tables}) or the commands that change the headers and
footers depending on whether or not a question spans multiple pages
(see section~\ref{sec:QuesSpan}).
If you give any of these commands while inside of a questions
environment, then the section titles will be indented to the same
extent that questions are indented unless they are given as the
argument of a \verb"\fullwidth" or \verb"\uplevel" command. These
commands have the advantage, however, that the unstarred versions
provide automatic numbering of the parts or sections.
%--------------------------------------------------------------------
%---------------------------------------------------------------------
\section{Leaving space for the answers}
\label{sec:LeaveSpace}
There are three different kinds of space that you can create:
\begin{itemize}
\item Blank space (see section~\ref{sec:BlankSpace}),
\item space filled with lines (see section~\ref{sec:FillLines}), and
\item space filled with dotted lines (see
section~\ref{sec:FillDotLines}).
\end{itemize}
If you type solutions using a \verb"solution", \verb"solutionorlines",
or \verb"solutionordottedlines" environment (see
section~\ref{sec:solutions}), then you can arrange for space to be
created only when the solutions are not being printed; see
section~\ref{sec:SolSpace}.
You can also create answer lines for short answer questions (see
section~\ref{sec:ShortAns}).
%--------------------------------------------------------------------
\subsection{Leaving blank space}
\label{sec:BlankSpace}
To leave blank space on the page for the answer to a question, you
should use the \verb"\vspace*" command. For example, the command
\verb"\vspace*{1in}" inserts one inch of vertical space after the line
in which it appears. (If it appears in between paragraphs, then it
inserts the space right there.) You can also use the \verb"\vspace"
command, the difference being that space inserted by \verb"\vspace"
will be deleted if it occurs at the top of a new page, whereas space
inserted by \verb"\vspace*" will never be deleted.
If you want to equally distribute the blank space among the questions
on the page, then just put \verb"\vspace*{\fill}" after each question
on the page and use \verb"\newpage" to end the page.
You can also leave blank space when solutions are not being printed by
using an optional argument with a \verb"solution" environment; see
section~\ref{sec:SolSpace}.
%--------------------------------------------------------------------
\subsection{Printing lined space for answers}
\label{sec:FillLines}
You can fill space with lines with the command
\begin{center}
\verb"\fillwithlines{length}"
\end{center}
which fills vertical space of height \verb"length" with 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.
\medskip
For example, if you type
\begin{verbatim}
\begin{questions}
\question
In no more than one paragraph, explain why the earth is round.
\fillwithlines{1in}
\question
\begin{parts}
\part
What changes to the van Allen radiation belt are needed to make
the earth into a regular icosahedron?
\fillwithlines{1in}
\part
Where should the field generator be constructed if you want one of
the vertices to be located at the Royal Observatory at Greenwich?
\fillwithlines{1in}
\end{parts}
\end{questions}
\end{verbatim}
then you'll get
\begin{questions}
\question
In no more than one paragraph, explain why the earth is round.
\fillwithlines{1in}
\question
\begin{parts}
\part
What changes to the van Allen radiation belt are needed to make
the earth into a regular icosahedron?
\fillwithlines{1in}
\part
Where should the field generator be constructed if you want one of
the vertices to be located at the Royal Observatory at Greenwich?
\fillwithlines{1in}
\end{parts}
\end{questions}
\medskip
The distance between the lines is \verb"\linefillheight", the default
value of which is set with the command
\begin{center}
\verb"\setlength\linefillheight{.25in}"
\end{center}
That value can be changed by giving a new \verb"\setlength" command.
The thickness of the lines is \verb"\linefillthickness", the default
value of which is set with the command
\begin{center}
\verb"\setlength\linefillthickness{0.1pt}"
\end{center}
and that value can also be changed by giving a new \verb"\setlength"
command.
If you want to fill the remaining space on the page with lines, you
should give the commands
\begin{center}
\begin{tabular}{l}
\verb"\fillwithlines{\fill}"\\
\verb"\newpage"
\end{tabular}
\end{center}
If you want to equally distribute the space for answers among the
questions on the page, then just put \verb"\fillwithlines{\fill}"
after each question on the page and use \verb"\newpage" to end the
page.
You can also insert lined space when solutions are not being printed
by including an optional argument with the \verb"solutionorlines"
environment; see section~\ref{sec:SolSpace}.
%--------------------------------------------------------------------
\subsection{Printing dotted lined space}
\label{sec:FillDotLines}
You can fill space with dotted lines with the command
\begin{center}
\verb"\fillwithdottedlines{length}"
\end{center}
which fills vertical space of height \verb"length" 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 command \verb"\fillwithdottedlines" is almost identical
to the \verb"\fillwithlines" command (see
section~\ref{sec:FillLines}), except that the lines created are dotted
and the distance between the lines is \verb"\dottedlinefillheight".
The default value of \verb"\dottedlinefillheight" is set by the
command
\begin{center}
\verb"\setlength\dottedlinefillheight{.25in}"
\end{center}
and that value can be changed by giving a new \verb"\setlength"
command.
For example, if you type
\begin{verbatim}
\begin{questions}
\question
In no more than one paragraph, explain why the earth is round.
\fillwithdottedlines{1in}
\question
\begin{parts}
\part
What changes to the van Allen radiation belt are needed to make
the earth into a regular icosahedron?
\fillwithdottedlines{1in}
\part
Where should the field generator be constructed if you want one of
the vertices to be located at the Royal Observatory at Greenwich?
\fillwithdottedlines{1in}
\end{parts}
\end{questions}
\end{verbatim}
then you'll get
\begin{questions}
\question
In no more than one paragraph, explain why the earth is round.
\fillwithdottedlines{1in}
\question
\begin{parts}
\part
What changes to the van Allen radiation belt are needed to make
the earth into a regular icosahedron?
\fillwithdottedlines{1in}
\part
Where should the field generator be constructed if you want one of
the vertices to be located at the Royal Observatory at Greenwich?
\fillwithdottedlines{1in}
\end{parts}
\end{questions}
If you want to fill the remaining space on the page with dotted lines,
you should give the commands
\begin{center}
\begin{tabular}{l}
\verb"\fillwithdottedlines{\fill}"\\
\verb"\newpage"
\end{tabular}
\end{center}
If you want to equally distribute the space for answers among the
questions on the page, then just put
\verb"\fillwithdottedlines{\fill}" after each question on the page and
use \verb"\newpage" to end the page.
You can also insert dotted lined space when solutions are not being
printed by including an optional argument with the
\verb"solutionordottedlines" environment; see
section~\ref{sec:SolSpace}.
%--------------------------------------------------------------------
\subsection{Short answer questions}
\label{sec:ShortAns}
The exam class can print answer lines for short answer questions. The
command
\begin{center}
\verb"\answerline"
\end{center}
leaves blank vertical space of length \verb"\answerskip" and then
inserts a horizontal line of length \verb"\answerlinelength" at the
right margin, preceded by the number of the current question, part,
subpart, or subsubpart. The default values of \verb"\answerskip" and
\verb"\answerlinelength" are set by the commands
\begin{center}
\begin{tabular}{l}
\verb"\setlength\answerskip{2ex}"\\
\verb"\setlength\answerlinelength{1in}"
\end{tabular}
\end{center}
and these can be changed by giving new \verb"\setlength" commands.
If you use the command \verb"\answerline" outside of a
\verb"questions" environment, then the number before the line will be
omitted.
For example, if you type
\begin{verbatim}
\begin{questions}
\question
Who's buried in Grant's tomb?
\answerline
\question
What was the color of George Washington's white horse?
\answerline
\question
Which is heavier: A pound of feathers, or a pound of lead?
\answerline
\end{questions}
\end{verbatim}
then you'll get
\begin{questions}
\question
Who's buried in Grant's tomb?
\answerline
\question
What was the color of George Washington's white horse?
\answerline
\question
Which is heavier: A pound of feathers, or a pound of lead?
\answerline
\end{questions}
and if you type
\begin{verbatim}
\begin{questions}
\question
Answer the following questions on the lines at the right:
\begin{parts}
\part
Who's buried in Grant's tomb? \answerline
\part
\begin{subparts}
\subpart
What light through yonder window breaks? \answerline
\subpart
To be, or not to be; that is the question? \answerline
\end{subparts}
\part
What was the color of George Washington's white horse? \answerline
\end{parts}
\end{questions}
\end{verbatim}
then you'll get
\begin{questions}
\question
Answer the following questions on the lines at the right:
\begin{parts}
\part
Who's buried in Grant's tomb? \answerline
\part
\begin{subparts}
\subpart
What light through yonder window breaks? \answerline
\subpart
To be, or not to be; that is the question? \answerline
\end{subparts}
\part
What was the color of George Washington's white horse? \answerline
\end{parts}
\end{questions}
%--------------------------------------------------------------------
\subsection{Printing the answers to short answer questions}
\label{sec:AnsShortAns}
The \verb"\answerline" command can take an optional argument so that
you can have the answer to the question printed on the answer line
when answers are being printed (see section~\ref{sec:answers}). When
answers are not being printed, the optional argument is ignored.
When answers are being printed, the optional argument is printed
subject to the declarations in the argument of the last
\verb"\CorrectChoiceEmphasis" command (which by default is
\verb"\bfseries"; see section~\ref{sec:CorrectChoice}), and it is
printed a distance of \verb"\answerclearance" above the line. The
default value of \verb"\answerclearance" is set with the command
\begin{center}
\verb"\setlength\answerclearance{0.2ex}"
\end{center}
and it can be changed with a \verb"\setlength" command. The optional
argument is centered on the answer line unless it is longer than the
line, in which case it extends to the right of the line.
For example, if you type
\begin{verbatim}
\begin{questions}
\question Who was the fifth Beatle? \answerline[Murray the K]
\question What is the answer to the ultimate question of life, the
universe, and everything? \answerline[42]
\end{questions}
\end{verbatim}
and if \verb"\noprintanswers" (the default) is in effect, you'll get
\begin{questions}
\question Who was the fifth Beatle? \answerline[Murray the K]
\question What is the answer to the ultimate question of life, the
universe, and everything? \answerline[42]
\end{questions}
while if \verb"\printanswers" is in effect, you'll get \printanswers
\begin{questions}
\question Who was the fifth Beatle? \answerline[Murray the K]
\question What is the answer to the ultimate question of life, the
universe, and everything? \answerline[42]
\end{questions}
\noprintanswers
%--------------------------------------------------------------------
%--------------------------------------------------------------------
\section{Including solutions}
\label{sec:solutions}
There are three environments for printing solutions to the problems:
\begin{center}
\begin{tabular}{rll}
The& \verb"solution"& environment,\\
the& \verb"solutionorlines"& environment, and\\
the& \verb"solutionordottedlines"& environment.
\end{tabular}
\end{center}
If you use these environments without any optional arguments, then
they are identical: They print either the solution or nothing at all.
Whether or not solutions are printed is controlled by the two commands
\begin{center}
\begin{tabular}{l}
\verb"\printanswers"\\
\verb"\noprintanswers"
\end{tabular}
\end{center}
Using these commands to turn printing of solutions on and off, you can
print the solutions for the entire exam or for only certain parts of
it. The default is that solutions are \emph{not} printed. There is
also an \verb"answers" option to the \verb"exam" document class, used
as in
\begin{center}
\verb"\documentclass[answers]{exam}"
\end{center}
that is equivalent to giving the command \verb"\printanswers" at the
beginning of the document (see section~\ref{sec:answers}).
All of these environments can take an optional argument, which is an
amount of space to be inserted when solutions are not being printed
(see section~\ref{sec:SolSpace}). The only differences between these
environments is that if this optional argument is used and solutions
are not being printed, then
\begin{itemize}
\item the \verb"solution" enviroment inserts that amount of blank
space, as if you had given a \verb"\vspace*" command (see
section~\ref{sec:BlankSpace}),
\item the \verb"solutionorlines" environment inserts that amount of
space with ruled lines, as if you had given a \verb"\fillwithlines"
command (see section~\ref{sec:FillLines}), and
\item the \verb"solutionordottedlines" environment inserts that amount
of space with dotted lines, as if you had given a
\verb"\fillwithdottedlines" command (see
section~\ref{sec:FillDotLines}).
\end{itemize}
%--------------------------------------------------------------------
\subsection{Printing the solution in a box}
\label{sec:SolutionAppearance}
By default, the solution is printed inside of a box (i.e., an
\verb"\fbox"), and if the solution is broken across pages, then each
piece is enclosed in a box. There is also a \verb"\shadedsolutions"
command to instead have the solution printed in a \verb"\colorbox"
(i.e., printed on a shaded background); for this, you must load the
\verb"color" package and your printer must be capable of printing
color, or at least grayscale (see section~\ref{sec:shaded}).
\medskip
For example, if you type
\begin{verbatim}
\begin{questions}
\question Did you mutter something?
\begin{solution}
Once upon a midnight dreary, while I pondered, weak and weary,
Over many a quaint and curious volume of forgotten lore--- While I
nodded, nearly napping, suddenly there came a tapping, As of some
one gently rapping, rapping at my chamber door. ``\,'Tis some
visitor,'' I muttered, ``tapping at my chamber door--- Only this
and nothing more.''
\end{solution}
\end{questions}
\end{verbatim}
and you've given the command \verb"\printanswers" or used the document
class option \verb"answers" (see section~\ref{sec:answers}), then
you'll get \bigskip
\begin{questions}
\question Did you mutter something?
\begin{TheSolution}
Once upon a midnight dreary, while I pondered, weak and weary,
Over many a quaint and curious volume of forgotten lore--- While I
nodded, nearly napping, suddenly there came a tapping, As of some
one gently rapping, rapping at my chamber door. ``\,'Tis some
visitor,'' I muttered, ``tapping at my chamber door--- Only this
and nothing more.''
\end{TheSolution}
\end{questions}
\bigskip
The result would be exactly the same if the above \verb"solution"
environment were replaced by either a \verb"solutionorlines" or
\verb"solutionordottedlines" environment.
By default, the solution is printed in a box whose width equals that
of the text of the current question (or part, or subpart, or
subsubpart). That is, the indentation at the left of the solution
equals the current level of indentation. You can change this by
enclosing the \verb"solution", \verb"solutionorlines", or
\verb"solutionordottedlines" environment in the argument of a
\verb"\fullwidth" or \verb"\uplevel" command (see
section~\ref{sec:uplevel}). For example, if you type
\begin{verbatim}
\begin{questions}
\question Did you mutter something?
\fullwidth{\begin{solution}
Once upon a midnight dreary, while I pondered, weak and weary,
Over many a quaint and curious volume of forgotten lore--- While I
nodded, nearly napping, suddenly there came a tapping, As of some
one gently rapping, rapping at my chamber door. ``\,'Tis some
visitor,'' I muttered, ``tapping at my chamber door--- Only this
and nothing more.''
\end{solution}}
\end{questions}
\end{verbatim}
and you've given the command \verb"\printanswers" or used the
document class option \verb"answers", then you'll get
\bigskip
\begin{questions}
\question Did you mutter something?
\fullwidth{\begin{TheSolution}
Once upon a midnight dreary, while I pondered, weak and weary,
Over many a quaint and curious volume of forgotten lore--- While I
nodded, nearly napping, suddenly there came a tapping, As of some
one gently rapping, rapping at my chamber door. ``\,'Tis some
visitor,'' I muttered, ``tapping at my chamber door--- Only this
and nothing more.''
\end{TheSolution}}
\end{questions}
With all of these environments, if solutions are not being printed
then the contents of the environment are ignored. If, however, you
include the optional argument (see section~\ref{sec:SolSpace}), then
the requested amount of space (blank, lined, or dotted lined) will be
inserted when the solution isn't printed.
%--------------------------------------------------------------------
\subsection{Printing the solution on a shaded background}
\label{sec:shaded}
If you load the \verb"color" package with the command
\begin{center}
\verb"\usepackage{color}"
\end{center}
in the preamble of your document (i.e., after the
\verb"\documentclass" command and before the \verb"\begin{document}"
command), then you can give the command
\begin{center}
\verb"\shadedsolutions"
\end{center}
This will cause solutions to be printed on a shaded background, which
by default is a light gray. (Most laser printers can at least print
grayscale when printing with the correct driver.) If you want to
change the color of the shading, you can do so by redefining the color
\verb"SolutionColor". For example, if you give the command
\begin{center}
\verb"\definecolor{SolutionColor}{rgb}{0.8,0.9,1}"
\end{center}
then the solutions will be printed on a light blue background
(assuming that your printer is capable of producing that color).
If you want to switch back to printing solutions inside of an
\verb"\fbox", you can do so by giving the command
\begin{center}
\verb"\framedsolutions"
\end{center}
which returns you to the default situation.
%--------------------------------------------------------------------
\subsection{Customizing the heading of the solution}
\label{sec:SolCust}
The word ``\textbf{Solution:}'' that you see at the beginning of the
solutions printed by the \verb"solution", \verb"solutionorlines", and
\verb"solutionordottedlines" environments can be changed by redefining
the command \verb"\solutiontitle". The default value was created by
the command
\begin{center}
\verb"\newcommand{\solutiontitle}{\noindent\textbf{Solution:}\enspace}"
\end{center}
If, for example, you give the command
\begin{center}
\verb"\renewcommand{\solutiontitle}{\noindent\textbf{Solution:}\par\noindent}"
\end{center}
then the \verb"solution" environment above would print
\renewcommand{\solutiontitle}{\noindent\textbf{Solution:}\par\noindent}
\par\bigskip
\begin{questions}
\question Did you mutter something?
\begin{TheSolution}
Once upon a midnight dreary, while I pondered, weak and weary, Over
many a quaint and curious volume of forgotten lore--- While I
nodded, nearly napping, suddenly there came a tapping, As of some
one gently rapping, rapping at my chamber door. ``\,'Tis some
visitor,'' I muttered, ``tapping at my chamber door--- Only this and
nothing more.''
\end{TheSolution}
\end{questions}
\renewcommand{\solutiontitle}{\noindent\textbf{Solution:}\enspace}
The appearance of the \verb"solution", \verb"solutionorlines", and
\verb"solutionordottedlines" environments can actually be totally
customized, if you're up to defining a \LaTeX{} environment. The
appearance of the solution typed into any of these environments is
defined by an environment called \verb"TheSolution", and you can
change the definition of \verb"TheSolution" with a
\verb"\renewenvironment" command. That is, the \verb"solution"
environment decides whether the command \verb"\printanswers" has been
given and, if so, it feeds the contents of the \verb"solution"
environment into a \verb"TheSolution" environment. (The behavior of a
\verb"solutionorlines" or \verb"solutionordottedlines" environment is
similar.) If you use \verb"\renewenvironment" to change the
definition of the \verb"TheSolution" environment, you'll be changing
the way the solution is printed. For the default definition of the
\verb"TheSolution" environment, see the file \verb"exam.cls".
%--------------------------------------------------------------------
\subsection{Leaving space for the answers when solutions aren't
printed}
\label{sec:SolSpace}
Each of the \verb"solution", \verb"solutionorlines", and
\verb"solutionordottedlines" environments takes an optional argument:
\begin{itemize}
\item In a \verb"solution" environment this is an amount of blank
space to be left (just as if you had used a \verb"\vspace*" command;
see section~\ref{sec:BlankSpace}) when solutions are not being
printed,
\item in a \verb"solutionorlines" environment this is an amount of
lined space to be left (just as if you had used a
\verb"\fillwithlines" command; see section~\ref{sec:FillLines}) when
solutions are not being printed, and
\item in a \verb"solutionordottedlines" environment this is an amount
of dotted lined space to be left (just as if you had used a
\verb"\fillwithdottedlines" command; see
section~\ref{sec:FillDotLines}) when solutions are not being
printed.
\end{itemize}
For example, if you type
\begin{verbatim}
\begin{solution}[2in]
Once upon a midnight dreary, while I pondered, weak and weary, Over
many a quaint and curious volume of forgotten lore--- While I
nodded, nearly napping, suddenly there came a tapping, As of some
one gently rapping, rapping at my chamber door. ``\,'Tis some
visitor,'' I muttered, ``tapping at my chamber door--- Only this and
nothing more.''
\end{solution}
\end{verbatim}
then there will be 2 inches of blank space inserted (as if you had
given the command \verb"\vspace*{2in}"; see
section~\ref{sec:BlankSpace}) when solutions are not being printed, if
you type
\begin{verbatim}
\begin{solutionorlines}[2in]
Once upon a midnight dreary, while I pondered, weak and weary, Over
many a quaint and curious volume of forgotten lore--- While I
nodded, nearly napping, suddenly there came a tapping, As of some
one gently rapping, rapping at my chamber door. ``\,'Tis some
visitor,'' I muttered, ``tapping at my chamber door--- Only this and
nothing more.''
\end{solutionorlines}
\end{verbatim}
then there will be 2 inches of lined space inserted (as if you had
given the command \verb"\fillwithlines{2in}"; see
section~\ref{sec:FillLines}) when solutions are not being printed, and
if you type
\begin{verbatim}
\begin{solutionordottedlines}[2in]
Once upon a midnight dreary, while I pondered, weak and weary, Over
many a quaint and curious volume of forgotten lore--- While I
nodded, nearly napping, suddenly there came a tapping, As of some
one gently rapping, rapping at my chamber door. ``\,'Tis some
visitor,'' I muttered, ``tapping at my chamber door--- Only this and
nothing more.''
\end{solutionorlines}
\end{verbatim}
then there will be 2 inches of dotted lined space inserted (as if you
had given the command \verb"\fillwithdottedlines{2in}"; see
section~\ref{sec:FillDotLines}) when solutions are not being printed.
%--------------------------------------------------------------------
\subsection{Changes depending on whether or not solutions are
being printed}
\label{sec:ifprintanswers}
The command \verb"\ifprintanswers" is provided in case you want to
vary what appears on the exam in ways other than those provided by the
solution environments (see section~\ref{sec:solutions}), the
\verb"\CorrectChoice" command in multiple choice environments (see
section~\ref{sec:CorrectChoice}), and the optional argument to the
\verb"\answerline" command (see section~\ref{sec:AnsShortAns}). You
use this command by typing
\begin{verbatim}
\ifprintanswers
Stuff to appear only when answers are being printed.
\else
Stuff to appear only when answers are not being printed.
\fi
\end{verbatim}
The \verb"\else" clause is optional; you can also type
\begin{verbatim}
\ifprintanswers
Stuff to appear only when answers are being printed.
\fi
\end{verbatim}
If you want something printed only when answers are not being printed,
you can type
\begin{verbatim}
\ifprintanswers
\else
Stuff to appear only when answers are not being printed.
\fi
\end{verbatim}
Since the \verb"exam" document class automatically loads the
\verb"ifthen" package, you can accomplish the same things using the
\verb"\ifthenelse" command:
\begin{verbatim}
\ifthenelse{\boolean{printanswers}}
{Stuff to appear only when answers are being printed.}
{Stuff to appear only when answers are not being printed.}
\end{verbatim}
If you use \verb"\ifthenelse", then \verb"both" cases must be present,
even if you leave one of them empty. Thus, e.g., if you want to print
something only when answers are not being printed, you'd type
\begin{verbatim}
\ifthenelse{\boolean{printanswers}}
{}
{Stuff to appear only when answers are not being printed.}
\end{verbatim}
%
% 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}
%--------------------------------------------------------------------
%--------------------------------------------------------------------
\section{Grading tables and point tables}
\label{sec:Tables}
\newlength\cwidth
The \verb"exam" document class can print either
\begin{itemize}
\item a grading table, indexed either by question number or by page
number, which lists the points possible and leaves space for you to
fill in (by hand) the points earned (see
section~\ref{sec:GradeTables}), or
\item a point table, indexed either by question number or by page
number, which lists the points possible but does not leave space for
you to fill in the points earned (see
section~\ref{sec:PointTables}).
\end{itemize}
It's also possible to print either a grading table or point table to
cover only part of the exam (see section~\ref{sec:PartialTable}).
If the exam has any bonus points (see section~\ref{sec:Bonus}), then
the bonus points will be ignored by the tables described in sections
\ref{sec:GradeTables}, \ref{sec:PointTables},
and~\ref{sec:PartialTable}, but it's possible to print bonus grading
tables and bonus point tables that list the bonus points and ignore
the non-bonus points (see section~\ref{sec:BonusTables}).
%--------------------------------------------------------------------
\subsection{Grading tables indexed by question number or by page
number}
\label{sec:GradeTables}
The \verb"exam" document class can print a grading table, indexed
either by question number or by page number. That is, you can print
\begin{itemize}
\item a table listing the question numbers (or question titles for
questions created using the \verb"\titledquestion" command instead
of the \verb"\question" command; see section~\ref{sec:Titled}) and
the total points possible for each question (including all of its
parts, subparts, and subsubparts) and leaving space for you to fill
in (by hand) the points earned on each question, or
\item a table listing each page that has at least one question, part,
subpart, or subsubpart with points assigned to it, the total number
of points possible on that page, and leaving space for you to fill
in (by hand) the points earned on that page.
\end{itemize}
In order to use this feature you must either include the optional
argument \verb"addpoints" in your \verb"\documentclass" command (as in
\verb"\documentclass[addpoints]{exam}") or give the command
\verb"\addpoints" (see section~\ref{sec:addpoints}), and there must be
only one \verb"questions" environment in the entire exam. In
addition, you must run \LaTeX{} twice after making any changes to the
file in order to make sure that the point values are correct on a
grading table indexed by question number and at least three times for
a grading table indexed by page number. (Since the table appears on
the third run of \LaTeX{}, and the space it occupies can change the
page on which each question falls, it may take a fourth run of
\LaTeX{} for the table to have the points per page correct.)
The command to create a grading table is
\begin{center}
\verb"\gradetable"
\end{center}
and it takes two optional arguments:
\begin{enumerate}
\item The first optional argument can be either \verb"[v]" or
\verb"[h]", to choose between a vertically oriented table and a
horizontally oriented table, and
\item the second optional argument can be either \verb"[questions]" or
\verb"[pages]", to choose between a table indexed by question number
and a table indexed by page number.
\end{enumerate}
That is,
\begin{itemize}
\item \verb"\gradetable[v][questions]" prints a vertically oriented
table indexed by question number,
\item \verb"\gradetable[h][questions]" prints a horizontally oriented
table indexed by question number,
\item \verb"\gradetable[v][pages]" prints a vertically oriented table
indexed by page number, and
\item \verb"\gradetable[h][pages]" prints a horizontally oriented
table indexed by page number.
\end{itemize}
If you leave out the optional arguments (i.e., if you give the command
as ``\verb"\gradetable"'') you'll get a vertically oriented table
indexed by question number.
For example, if the exam has 8 questions, each worth a total of 15
points, and you type
\begin{verbatim}
\begin{center}
\gradetable[v][questions]
\end{center}
\end{verbatim}
then you'll get
\begin{center}
\cwidth=2em
\renewcommand\arraystretch{1.5}
\begin{tabular}{|c|c|c|}
\hline
Question& Points& Score\\
\hline
1& 15& \hbox to \cwidth{\hfill}\\
\hline
2& 15& \hbox to \cwidth{\hfill}\\
\hline
3& 15& \hbox to \cwidth{\hfill}\\
\hline
4& 15& \hbox to \cwidth{\hfill}\\
\hline
5& 15& \hbox to \cwidth{\hfill}\\
\hline
6& 15& \hbox to \cwidth{\hfill}\\
\hline
7& 15& \hbox to \cwidth{\hfill}\\
\hline
8& 15& \hbox to \cwidth{\hfill}\\
\hline
Total:& 120&\\
\hline
\end{tabular}
\end{center}
and if you type
\begin{verbatim}
\begin{center}
\gradetable[h][questions]
\end{center}
\end{verbatim}
then you'll get
\begin{center}
\cwidth=2em
\renewcommand\arraystretch{1.5}
\begin{tabular}{|l|c|c|c|c|c|c|c|c|c|}
\hline
Question:& 1& 2& 3& 4& 5& 6& 7& 8& Total\\
\hline
Points:&
15&
15&
15&
15&
15&
15&
15&
15&
120\\
\hline
Score:&
\hbox to \cwidth{\hfill}&
\hbox to \cwidth{\hfill}&
\hbox to \cwidth{\hfill}&
\hbox to \cwidth{\hfill}&
\hbox to \cwidth{\hfill}&
\hbox to \cwidth{\hfill}&
\hbox to \cwidth{\hfill}&
\hbox to \cwidth{\hfill}&
\\
\hline
\end{tabular}
\end{center}
The number of points listed for a question is the sum of the point
values for that question and all of its parts, subparts, and
subsubparts.
If those 8 questions are distributed two to a page on each of pages 2
through 5 and if you type
\begin{verbatim}
\begin{center}
\gradetable[v][pages]
\end{center}
\end{verbatim}
then you'll get
\begin{center}
\cwidth=2em
\renewcommand\arraystretch{1.5}
\begin{tabular}{|c|c|c|}
\hline
Page& Points& Score\\
\hline
2& 30& \hbox to \cwidth{\hfill}\\
\hline
3& 30& \hbox to \cwidth{\hfill}\\
\hline
4& 30& \hbox to \cwidth{\hfill}\\
\hline
5& 30& \hbox to \cwidth{\hfill}\\
\hline
Total:& 120&\\
\hline
\end{tabular}
\end{center}
and if you type
\begin{verbatim}
\begin{center}
\gradetable[h][pages]
\end{center}
\end{verbatim}
then you'll get
\begin{center}
\cwidth=2em
\renewcommand\arraystretch{1.5}
\begin{tabular}{|l|c|c|c|c|c|}
\hline
Page:& 2& 3& 4& 5& Total\\
\hline
Points:&
30&
30&
30&
30&
120\\
\hline
Score:&
\hbox to \cwidth{\hfill}&
\hbox to \cwidth{\hfill}&
\hbox to \cwidth{\hfill}&
\hbox to \cwidth{\hfill}&
\hbox to \cwidth{\hfill}
\\
\hline
\end{tabular}
\end{center}
\emph{Warning:} If you have a large number of questions on
the exam, then these tables can easily become too large to fit on the
page. If this becomes a problem, then you can use the
\verb"\pointsofquestion" command (see section~\ref{sec:pointsofq}) or
the \verb"\pointsonpage" command (see section~\ref{sec:pointsonp}) to
create a custom \verb"tabular" environment that has more rows (or
columns) than the tables produced by the \verb"gradingtable" command.
%--------------------------------------------------------------------
\subsection{Point tables indexed by question number or by page
number}
\label{sec:PointTables}
Point tables are similar to grading tables (see
section~\ref{sec:GradeTables}), except that there is no place in the
table to fill in the points earned.
The command to create a point table is
\begin{center}
\verb"\pointtable"
\end{center}
and it takes two optional arguments:
\begin{enumerate}
\item The first optional argument can be either \verb"[v]" or
\verb"[h]", to choose between a vertically oriented table and a
horizontally oriented table, and
\item the second optional argument can be either \verb"[questions]" or
\verb"[pages]", to choose between a table indexed by question number
and a table indexed by page number.
\end{enumerate}
That is,
\begin{itemize}
\item \verb"\pointtable[v][questions]" prints a vertically oriented
table indexed by question number,
\item \verb"\pointtable[h][questions]" prints a horizontally oriented
table indexed by question number,
\item \verb"\pointtable[v][pages]" prints a vertically oriented table
indexed by page number, and
\item \verb"\pointtable[h][pages]" prints a horizontally oriented
table indexed by page number.
\end{itemize}
If you leave out the optional arguments (i.e., if you give the command
as ``\verb"\pointtable"'') you'll get a vertically oriented table
indexed by question number.
For example, if the exam has 8 questions, each worth a total of 15
points, and you type
\begin{verbatim}
\begin{center}
\pointtable[v][questions]
\end{center}
\end{verbatim}
then you'll get
\begin{center}
\cwidth=2em
\renewcommand\arraystretch{1.5}
\begin{tabular}{|c|c|}
\hline
Question& Points\\
\hline
1& 15\\
\hline
2& 15\\
\hline
3& 15\\
\hline
4& 15\\
\hline
5& 15\\
\hline
6& 15\\
\hline
7& 15\\
\hline
8& 15\\
\hline
Total:& 120\\
\hline
\end{tabular}
\end{center}
and if you type
\begin{verbatim}
\begin{center}
\pointtable[h][questions]
\end{center}
\end{verbatim}
then you'll get
\begin{center}
\cwidth=2em
\renewcommand\arraystretch{1.5}
\begin{tabular}{|l|c|c|c|c|c|c|c|c|c|}
\hline
Question:& 1& 2& 3& 4& 5& 6& 7& 8& Total\\
\hline
Points:&
15&
15&
15&
15&
15&
15&
15&
15&
120\\
\hline
\end{tabular}
\end{center}
The number of points listed for a question is the sum of the point
values for that question and all of its parts, subparts, and
subsubparts.
If those 8 questions are distributed two to a page on each of pages 2
through 5 and if you type
\begin{verbatim}
\begin{center}
\pointtable[v][pages]
\end{center}
\end{verbatim}
then you'll get
\begin{center}
\cwidth=2em
\renewcommand\arraystretch{1.5}
\begin{tabular}{|c|c|}
\hline
Page& Points\\
\hline
2& 30\\
\hline
3& 30\\
\hline
4& 30\\
\hline
5& 30\\
\hline
Total:& 120\\
\hline
\end{tabular}
\end{center}
and if you type
\begin{verbatim}
\begin{center}
\pointtable[h][pages]
\end{center}
\end{verbatim}
then you'll get
\begin{center}
\cwidth=2em
\renewcommand\arraystretch{1.5}
\begin{tabular}{|l|c|c|c|c|c|}
\hline
Page:& 2& 3& 4& 5& Total\\
\hline
Points:&
30&
30&
30&
30&
120\\
\hline
\end{tabular}
\end{center}
\emph{Warning:} If you have a large number of questions on
the exam, then these tables can easily become too large to fit on the
page. If this becomes a problem, then you can use the
\verb"\pointsofquestion" command (see section~\ref{sec:pointsofq}) or
the \verb"\pointsonpage" command (see section~\ref{sec:pointsonp}) to
create a custom \verb"tabular" environment that has more rows (or
columns) than the tables produced by the \verb"pointtable" command.
%--------------------------------------------------------------------
\subsection{Table entries as clickable links}
\label{sec:Clickable}
If you put the command
\begin{center}
\verb"\usepackage{hyperref}"
\end{center}
into the preamble of your document (i.e., after the
\verb"\documentclass" command and before the \verb"\begin{document}"
command) and then produce a pdf file (either using dvipdf or
directly by using pdflatex), then
\begin{itemize}
\item in a grading table or point table indexed by question number the
question numbers in the table will be clickable links that take you
to the corresponding question, and
\item in a grading table or point table indexed by page number the
page numbers in the table will be clickable links that take you to
the corresponding page.
\end{itemize}
If you create questions using the \verb"\titledquestion" command
instead of the \verb"\question" command (see
section~\ref{sec:Titled}), then a grading table or point table indexed
by question number will show the \emph{titles} of those questions
instead of the numbers of those questions, and those question titles
will be clickable links that take you to the corresponding question.
%--------------------------------------------------------------------
\subsection{Partial grading tables and partial point tables}
\label{sec:PartialTable}
The \verb"\partialgradetable" and \verb"\partialpointtable" commands
make it possible to create grading tables and point tables that cover
only part of the exam. These commands take one required argument, the
name of a grading range defined using the \verb"\begingradingrange"
and \verb"\endgradingrange" commands, plus the same two optional
arguments used in the \verb"\gradetable" and \verb"\pointtable"
commands.
In more detail: You define a grading range by choosing a name with
which to label the range, e.g., ``myrange'', and then put the command
\begin{center}
\verb"\begingradingrange{myrange}"
\end{center}
at the start of the range and the command
\begin{center}
\verb"\endgradingrange{myrange}"
\end{center}
at the end of the range. To create the table, you say, e.g.,
\begin{center}
\verb"\partialgradetable{myrange}[v][questions]"
\end{center}
to create a vertically oriented table indexed by those questions that
follow the command
\begin{center}
\verb"\begingradingrange{myrange}"
\end{center}
and precede the command
\begin{center}
\verb"\endgradingrange{myrange}"
\end{center}
If you say
\begin{center}
\verb"\partialgradetable{myrange}[v][pages]"
\end{center}
then you'll get a vertically oriented table indexed by all pages with
points starting with the page containing the command
\begin{center}
\verb"\begingradingrange{myrange}"
\end{center}
and ending with the page containing the command
\begin{center}
\verb"\endgradingrange{myrange}"
\end{center}
The \verb"\partialpointtable" command is similar to the
\verb"\partialgradetable" command.
%--------------------------------------------------------------------
\subsection{\texttt{\char`\\pointsofquestion}}
\label{sec:pointsofq}
If you use the document class option \verb"addpoints" (as in
\verb"\documentclass[addpoints]{exam}") or give the command
\verb"\addpoints" (see section~\ref{sec:addpoints}), then you can use
the
\begin{center}
\verb"\pointsofquestion"
\end{center}
command. This command takes one argument, which must be the number of
a question on the exam, and it prints the total number of points for
that question. That is:
\begin{itemize}
\item \verb"\pointsofquestion{1}" prints the sum of the point values
for question 1 and all of its parts, subparts, and subsubparts.
\item \verb"\pointsofquestion{2}" prints the sum of the point values
for question 2 and all of its parts, subparts, and subsubparts.
\item Etc.
\end{itemize}
The \verb"\pointsofquestion" command is used by the \verb"\gradetable"
and \verb"\pointtable" commands (see section~\ref{sec:Tables}),
and it can be used to create a table using \LaTeX's \verb"tabular"
environment when the tables produced using the \verb"\gradetable" and
\verb"\pointtable" commands either don't fit on the page or are
unsuitable for some other reason. It can also be used in a
\verb"\qformat" command to list the total number of points of all
parts, subparts, and subsubparts of a question on the line with the
question number (see section~\ref{sec:adding}).
The \verb"\pointsofquestion" command ignores any bonus points that you
may have created (see section~\ref{sec:Bonus}). The
\verb"\bonuspointsofquestion" command, however, counts the bonus
points (see section~\ref{sec:BonusTables}).
%--------------------------------------------------------------------
\subsection{\texttt{\char`\\pointsonpage}}
\label{sec:pointsonp}
If you use the document class option \verb"addpoints" (as in
\verb"\documentclass[addpoints]{exam}") or give the command
\verb"\addpoints" (see section~\ref{sec:addpoints}), then you can use
the \verb"\pointsonpage" command. This command takes one argument,
which must be the number of a page of the exam, and it prints the
total number of points for all the questions, parts, subparts, and
subsubparts on that page. That is:
\begin{itemize}
\item \verb"\pointsonpage{1}" prints the sum of the point values for
all questions, etc., on page 1,
\item \verb"\pointsonpage{2}" prints the sum of the point values for
all questions, etc., on page 2,
\item Etc.
\end{itemize}
This command can be used to create a table using \LaTeX's
\verb"tabular" environment when the tables produced using the
\verb"\gradetable" and \verb"\pointtable" commands either don't fit on
the page or are unsuitable for some other reason. It can also be used
in headers and footers to print on each page the total number of
points available on that page; for example, the command
\begin{verbatim}
\runningfooter{}
{}
{Points earned: \makebox[1in]{\hrulefill}
out of a possible \pointsonpage{\thepage} points}
\end{verbatim}
(see section~\ref{sec:runningfooter}) will produce the footer
\samplefoot{}{}{}{Points earned: \makebox[1in]{\hrulefill} out of a
possible 20 points} on all pages after the first. (For another
example, see section~\ref{sec:PtsPgEx})
\textbf{Caution:} The command \verb"\pointsonpage{\thepage}" will work
reliably only in headers and footers, since the command
\verb"\thepage" will work reliably only in headers and footers.
The \verb"\pointsonpage" command ignores any bonus points that you may
have created (see section~\ref{sec:Bonus}). The
\verb"\bonuspointsonpage" command, however, counts the bonus points
(see section~\ref{sec:BonusTables}).
%--------------------------------------------------------------------
\subsection{Bonus grading tables and bonus point tables}
\label{sec:BonusTables}
If your exam contains any bonus points (see section~\ref{sec:Bonus}),
then those bonus points will be ignored by the grading table and point
table commands described in sections \ref{sec:GradeTables},
\ref{sec:PointTables}, and~\ref{sec:PartialTable} and by the
\verb"\pointsofquestion" (see section~\ref{sec:pointsofq}) and
\verb"\pointsonpage" (see section~\ref{sec:pointsonp}) commands.
There are, however, analogous commands that count only the bonus
points and ignore the non-bonus points. These commands, and the
non-bonus commands to which they correspond, are as follows:
\begin{center}
\begin{tabular}{l@{\qquad\qquad}l}
Bonus points& Non-bonus points\\[\medskipamount]
\verb"\bonusgradetable"& \verb"\gradetable"\\
\verb"\bonuspointtable"& \verb"\pointtable"\\
\verb"\bonuspartialgradetable"& \verb"\partialgradetable"\\
\verb"\bonuspartialpointtable"& \verb"\partialpointtable"\\[\medskipamount]
\verb"\bonuspointsofquestion"& \verb"\pointsofquestion"\\
\verb"\bonuspointsonpage"& \verb"\pointsonpage"
\end{tabular}
\end{center}
All of the the commands in the first column count bonus points and
ignore non-bonus points, while all of the commands in the second
column count non-bonus points and ignore bonus points. The
\verb"\bonuspartialgradetable" and \verb"\bonuspartialpointtable"
commands use the same \verb"\begingradingrange" and
\verb"\endgradingrange" commands that are used by the corresponding
non-bonus versions (see section~\ref{sec:PartialTable}). Just as is
described in section~\ref{sec:Clickable} for their non-bonus
counterparts, if you put the command
\begin{center}
\verb"\usepackage{hyperref}"
\end{center}
into the preamble of your document (i.e., after the
\verb"\documentclass" command and before the \verb"\begin{document}"
command) and then produce a pdf file (either using dvipdf or
directly by using pdflatex), then
\begin{itemize}
\item in a bonus grading table or bonus point table indexed by
question number the question numbers (or question titles, if you
used \verb"\bonustitledquestion"; see section~\ref{sec:Bonus}) in
the table will be clickable links that take you to the corresponding
question, and
\item in a bonus grading table or bonus point table indexed by page
number the page numbers in the table will be clickable links that
take you to the corresponding page.
\end{itemize}
For example, if the exam has 8 questions, each worth a total of 5
bonus points, and you type
\begin{verbatim}
\begin{center}
\bonusgradetable[h][questions]
\end{center}
\end{verbatim}
then you'll get
\begin{center}
\cwidth=2em
\renewcommand\arraystretch{1.5}
\begin{tabular}{|l|c|c|c|c|c|c|c|c|c|}
\hline
Question:& 1& 2& 3& 4& 5& 6& 7& 8& Total\\
\hline
Bonus Points:&
5&
5&
5&
5&
5&
5&
5&
5&
40\\
\hline
Score:&
\hbox to \cwidth{\hfill}&
\hbox to \cwidth{\hfill}&
\hbox to \cwidth{\hfill}&
\hbox to \cwidth{\hfill}&
\hbox to \cwidth{\hfill}&
\hbox to \cwidth{\hfill}&
\hbox to \cwidth{\hfill}&
\hbox to \cwidth{\hfill}&\\
\hline
\end{tabular}
\end{center}
%--------------------------------------------------------------------
\subsection{Customizing the tables}
\label{sec:CustTable}
There are three ways in which you can customize the default appearance
of grading tables and point tables:
\begin{itemize}
\item You can change the words (and the fonts) that appear in the
table.
\item You can change the minimum width of the blank cells into which
you will write the scores.
\item You can change the value of \verb"\baselinestretch" used for the
table.
\end{itemize}
For vertical non-bonus tables (i.e., tables created by
\verb"\gradetable[v]" or \verb"\pointtable[v]"):
\begin{center}
\begin{tabular}{l@{\qquad}l}
Command& Effect\\
\verb"\vqword{text}"& substitutes \verb"text" for ``Question''\\
\verb"\vpgword{text}"& substitutes \verb"text" for ``Page''\\
\verb"\vpword{text}"& substitutes \verb"text" for ``Points''\\
\verb"\vsword{text}"& substitutes \verb"text" for ``Score''\\
\verb"\vtword{text}"& substitutes \verb"text" for ``Total:''
\end{tabular}
\end{center}
For horizontal non-bonus tables (i.e., tables created by
\verb"\gradetable[h]" or \verb"\pointtable[h]"):
\begin{center}
\begin{tabular}{l@{\qquad}l}
Command& Effect\\
\verb"\hqword{text}"& substitutes \verb"text" for ``Question:''\\
\verb"\hpgword{text}"& substitutes \verb"text" for ``Page:''\\
\verb"\hpword{text}"& substitutes \verb"text" for ``Points:''\\
\verb"\hsword{text}"& substitutes \verb"text" for ``Score:''\\
\verb"\htword{text}"& substitutes \verb"text" for ``Total''
\end{tabular}
\end{center}
For vertical bonus tables (i.e., tables created by
\verb"\bonusgradetable[v]" or \verb"\bonuspointtable[v]"):
\begin{center}
\begin{tabular}{l@{\qquad}l}
Command& Effect\\
\verb"\bvqword{text}"& substitutes \verb"text" for ``Question''\\
\verb"\bvpgword{text}"& substitutes \verb"text" for ``Page''\\
\verb"\bvpword{text}"& substitutes \verb"text" for ``Bonus Points''\\
\verb"\bvsword{text}"& substitutes \verb"text" for ``Score''\\
\verb"\bvtword{text}"& substitutes \verb"text" for ``Total:''
\end{tabular}
\end{center}
For horizontal bonus tables (i.e., tables created by
\verb"\bonusgradetable[h]" or \verb"\bonuspointtable[h]"):
\begin{center}
\begin{tabular}{l@{\qquad}l}
Command& Effect\\
\verb"\bhqword{text}"& substitutes \verb"text" for ``Question:''\\
\verb"\bhpgword{text}"& substitutes \verb"text" for ``Page:''\\
\verb"\bhpword{text}"& substitutes \verb"text" for ``Bonus Points:''\\
\verb"\bhsword{text}"& substitutes \verb"text" for ``Score:''\\
\verb"\bhtword{text}"& substitutes \verb"text" for ``Total''
\end{tabular}
\end{center}
For all tables:
\begin{center}
\begin{tabular}{l@{\qquad}l}
\verb"\cellwidth{length}"& changes the minimum width of the blank cells to
\verb"length"\\
\verb"\gradetablestretch{number}"& uses \verb"number" as the
\verb"\baselinestretch"
\end{tabular}
\end{center}
If you don't use any of these commands then you get the default
values, which are defined by the commands
\begin{center}
\begin{tabular}{l@{\qquad}l@{\qquad}l}
\verb"\hqword{Question:}"& \verb"\vqword{Question}"&
\verb"\cellwidth{2em}"\\
\verb"\hpgword{Page:}"& \verb"\vpgword{Page}"&
\verb"\gradetablestretch{1.5}"\\
\verb"\hpword{Points:}"& \verb"\vpword{Points}"\\
\verb"\hsword{Score:}"& \verb"\vsword{Score}"\\
\verb"\htword{Total}"& \verb"\vtword{Total:}"\\[\medskipamount]
\verb"\bhqword{Question:}"& \verb"\bvqword{Question}"\\
\verb"\bhpgword{Page:}"& \verb"\bvpgword{Page}"\\
\verb"\bhpword{Bonus Points:}"& \verb"\bvpword{Bonus Points}"\\
\verb"\bhsword{Score:}"& \verb"\bvsword{Score}"\\
\verb"\bhtword{Total}"& \verb"\bvtword{Total:}"
\end{tabular}
\end{center}
\medskip
For example, if you type
\begin{verbatim}
\begin{center}
\hqword{Aufgabe Nr.:}
\hpword{Punktzahl:}
\htword{\textbf{Summe}}
\hsword{Davon erreicht:}
\cellwidth{2.2em}
\gradetable[h][questions]
\end{center}
\end{verbatim}
then you'll get
\begin{center}
\cwidth=2.2em
\renewcommand\arraystretch{1.5}
\begin{tabular}{|l|c|c|c|c|c|c|c|c|c|}
\hline
Aufgabe Nr.:& 1& 2& 3& 4& 5& 6& 7& 8& \textbf{Summe}\\
\hline
Punktzahl:&
15&
15&
15&
15&
15&
15&
15&
15&
120\\
\hline
Davon erreicht:&
\hbox to \cwidth{\hfill}&
\hbox to \cwidth{\hfill}&
\hbox to \cwidth{\hfill}&
\hbox to \cwidth{\hfill}&
\hbox to \cwidth{\hfill}&
\hbox to \cwidth{\hfill}&
\hbox to \cwidth{\hfill}&
\hbox to \cwidth{\hfill}&
\\
\hline
\end{tabular}
\end{center}
%--------------------------------------------------------------------
%--------------------------------------------------------------------
\section{Changing the page margins}
\label{sec:pagesize}
The exam document class arranges things so that you get one inch
margins at the top, bottom, and sides no matter what size paper you
use, as long as you use the corresponding document class option
(\verb"a4paper", \verb"a5paper", \verb"b5paper", \verb"letterpaper",
\verb"legalpaper", \verb"executivepaper", or \verb"landscape"). You
can change the sizes of these margins by using the commands that
change the size of the printed area.
To change the width of the printed area, you would use the
\verb"\extrawidth" command. The \verb"\extrawidth" command takes one
argument, and enlarges the width of the printed area by the amount of
the argument. It keeps the printed area centered as it changes its
width. If the argument is negative, then the width of the printed
area is decreased.
For example, to enlarge the left and right margins by one half inch
each, you would use the command
\begin{center}
\verb"\extrawidth{-1in}"
\end{center}
since the printed region must shrink by one inch to allow an
additional one half inch on both sides. To decrease the left and
right margins to three quarters of an inch each, you would use the
command
\begin{center}
\verb"\extrawidth{.5in}"
\end{center}
since the printed region must grow by one half inch to decrease both
margins by one quarter of an inch.
To change the height of the printed area, you must choose whether the
top or the bottom of the printed area (or possibly both) should move.
The commands for this are principally intended to allow additional
room for large headers and footers, and so they are called
\verb"\extraheadheight" and \verb"\extrafootheight". For a full
description of these commands, see section~\ref{sec:extra-room}.
To move the top of the printed region (and any header that's present)
downwards, you use the command \verb"\extraheadheight". This command
takes one argument, and moves the top of the text and the header down
by this amount (keeping the distance between the header and the text
constant). Thus, to increase the top margin by three quarters of an
inch, you would give the command
\begin{center}
\verb"\extraheadheight{.75in}"
\end{center}
To decrease the top margin by one half inch, you would give the
command
\begin{center}
\verb"\extraheadheight{-.5in}"
\end{center}
The \verb"\extraheadheight" command takes an optional argument to
provide a top margin on the first page that's different from that on
all other pages. For an explanation of this, see
section~\ref{sec:extra-room}.
To move the bottom of the printed region (and any footer that's
present) upwards, you use the command \verb"\extrafootheight". This
command takes one argument, and moves the bottom of the text and the
footer up by this amount (keeping the distance between the footer and
the text constant). Thus, to increase the bottom margin by three
quarters of an inch, you would give the command
\begin{center}
\verb"\extrafootheight{.75in}"
\end{center}
To decrease the bottom margin by one half inch, you would give the
command
\begin{center}
\verb"\extrafootheight{-.5in}"
\end{center}
The \verb"\extrafootheight" command takes an optional argument to
provide a bottom margin on the first page that's different from that
on all other pages. For an explanation of this, see
section~\ref{sec:extra-room}.
%--------------------------------------------------------------------
%---------------------------------------------------------------------
\section{Headers and footers}
\label{sec:headfoot}
The following sections explain all of the technicalities of the
commands that deal with headers and footers. There are a number of
things to explain here, and so you may find it easier to skip this
section and instead look at the examples in
sections~\ref{sec:beginexamples} through~\ref{sec:endexamples} (on
pages~\pageref{sec:beginexamples} through~\pageref{sec:endexamples}).
You can then refer back to the technical sections for the full story
on whatever isn't clear from the examples. All of the commands
described in this section should be given in the preamble, i.e., after
the \verb"\documentclass" command and before the
\verb"\begin{document}" command.
It's also important to remember that if you use a \verb"coverpages"
environment (described in section~\ref{sec:coverpages}), then the
commands described here affect only the pages in the main section of
the exam, and not the pages of the \verb"coverpages" environment.
There are commands for headers and footers in the cover pages that are
analogous to the commands described in this section; for that, see
section~\ref{sec:Coverhdft}.
%---------------------------------------------------------------------
\subsection{Page styles: Headers and/or footers}
It's the \verb"\pagestyle" command that determines whether the exam
will have headers, footers, both, or neither. The contents of the
header and footer are specified using the commands described in
sections~\ref{sec:header} through~\ref{sec:rules}, but it's the
\verb"\pagestyle" command that determines whether the header and
footer that you construct will actually be placed onto the page. The
\verb"\pagestyle" command should be given in the preamble, i.e., after
the \verb"\documentclass" command and before the
\verb"\begin{document}" command.
To have both a header and a footer, give the command
\begin{center}
\verb"\pagestyle{headandfoot}"
\end{center}
If you want every page to have a header but no footer, give the
command
\begin{center}
\verb"\pagestyle{head}"
\end{center}
To give every page a footer but no header, give the command
\begin{center}
\verb"\pagestyle{foot}"
\end{center}
Finally, to omit both the header and the footer from the page, give
the command
\begin{center}
\verb"\pagestyle{empty}"
\end{center}
As is true for all \LaTeX{} document classes, you can change the page
style used on a single page by giving the command
\begin{center}
\verb"\thispagestyle{somestyle}"
\end{center}
somewhere on that page (where \verb"somestyle" is the style that you
want to use on that page). This is most often needed if you use the
\verb"\maketitle" command, since that command inserts a
\verb"\thispagestyle{plain}" immediately following the title. If you
use the \verb"\maketitle" command and you want the entire document to
use \verb"\pagestyle{headandfoot}", then you'll need to put the
command \verb"\thispagestyle{headandfoot}" immediately after the
\verb"\maketitle" command to override the \verb"\thispagestyle{plain}"
that is inserted by \verb"\maketitle".
The default page style is \verb"headandfoot". That is, if you don't
give any \verb"\pagestyle" commands, then the header and footer will
appear on every page. The default header is empty, and the default
footer consists of ``Page $n$'' centered in the footer (where $n$ is
the page number).
%---------------------------------------------------------------------
\subsection{The three parts of the header}
\label{sec:header}
The header is specified in three parts:
\begin{itemize}
\item One part to be left justified.
\item One part to be centered.
\item One part to be right justified.
\end{itemize}
There are two different ways in which you can specify the three parts
of the header. The first uses the single command \verb"\header" to
specify all three parts of the header, or the commands
\verb"\firstpageheader" and \verb"\runningheader" to specify a
different header for the first page (see
section~\ref{sec:runningheader}). The second uses the commands
\verb"\lhead", \verb"\chead", and \verb"\rhead", each of which takes
an optional argument to specify a different header for the first page
(see section~\ref{sec:lhead}). All of these commands should be given
in the preamble, i.e., after the \verb"\documentclass" command and
before the \verb"\begin{document}" command.
%--------------------------------------------------------------------
\subsubsection{Using \texttt{\char`\\header},
\texttt{\char`\\firstpageheader} and \texttt{\char`\\runningheader}}
\label{sec:runningheader}
The command \verb"\header{Text 1}{Text 2}{Text 3}" puts ``Text~1''
into the left justified header, ``Text~2'' into the centered header,
and ``Text~3'' into the right justified header on every page. If you
want the header on the first page to be different from that on the
other pages, then you should use the commands \verb"\firstpageheader"
and \verb"\runningheader", which also take three arguments and affect
either the first page or all pages except the first.
For example, to put the header
\samplehead{Math 115}{Second Exam}{July 4, 1776}{}
on every page of the exam, you would give the command
\begin{verbatim}
\header{Math 115}{Second Exam}{July 4, 1776}
\end{verbatim}
If you want to use a header on the first page that's different from
the header used on all other pages, you would use the commands
\verb"\firstpageheader" and \verb"\runningheader" instead of
\verb"\header". For example, if you want the above header for the
first page, but on all pages after the first you want to have the
header \samplehead{Math 115}{Second Exam (Continued)}{July 4, 1776}{}
then you would give the commands
\begin{verbatim}
\firstpageheader{Math 115}{Second Exam}{July 4, 1776}
\runningheader{Math 115}{Second Exam (Continued)}{July 4, 1776}
\end{verbatim}
You can leave one or more of the three parts empty. To have the
header
\samplehead{Math 115}{Second Exam}{July 4, 1776}{}
on the first page, with the header
\samplehead{Math 115}{}{Second Exam (Continued)}{}
on all other pages, you would give the commands
\begin{verbatim}
\firstpageheader{Math 115}{Second Exam}{July 4, 1776}
\runningheader{Math 115}{}{Second Exam (Continued)}
\end{verbatim}
Any of the three parts of the header can have multiple lines. To
specify where the line breaks should go, you just type \verb"\\".
Thus, to have the header
\samplehead{\bfseries\large Math 115\\Professor Hilbert}{}
{\bfseries\large First Exam\\July 4, 1776}{}
appear on every page, you would give the command
\begin{verbatim}
\header{\bfseries\large Math 115\\Professor Hilbert}
{}
{\bfseries\large First Exam\\July 4, 1776}
\end{verbatim}
%--------------------------------------------------------------------
\subsubsection{Using \texttt{\char`\\lhead}, \texttt{\char`\\chead}
and \texttt{\char`\\rhead}}
\label{sec:lhead}
The command \verb"\lhead{Text}" puts ``Text'' into the left justified
part of the header on every page. The command
\verb"\lhead[Text 1]{Text 2}" puts ``Text~1'' into the left justified
header on the first page and ``Text~2'' into the left justified header
on all other pages. The commands \verb"\chead" and \verb"\rhead" have
similar effects on the centered and right justified parts of the
header.
For example, to put the header
\samplehead{Math 115}{Second Exam}{July 4, 1776}{}
on every page of the exam, you would give the commands
\begin{verbatim}
\lhead{Math 115}
\chead{Second Exam}
\rhead{July 4, 1776}
\end{verbatim}
If you want any of the three parts to have a special version to be
used only on the first page, then you just include that special
version as an optional argument (enclosed in square brackets) to the
command. For example, if you want the above header for the first
page, but on all pages after the first you want to have the header
\samplehead{Math 115}{Second Exam (Continued)}{July 4, 1776}{}
then you would give the commands
\begin{verbatim}
\lhead{Math 115}
\chead[Second Exam]{Second Exam (Continued)}
\rhead{July 4, 1776}
\end{verbatim}
You can leave one or more of the three parts empty. To have the
header
\samplehead{Math 115}{Second Exam}{July 4, 1776}{}
on the first page, with the header
\samplehead{Math 115}{}{Second Exam (Continued)}{}
on all other pages, you would give the commands
\begin{verbatim}
\lhead{Math 115}
\chead[Second Exam]{}
\rhead[July 4, 1776]{Second Exam Continued)}
\end{verbatim}
Any of the three parts of the header can have multiple lines. To
specify where the line breaks should go, you just type \verb"\\".
Thus, to have the header
\samplehead{\bfseries\large Math 115\\Professor Hilbert}{}
{\bfseries\large First Exam\\July 4, 1776}{}
appear on every page, you would give the commands
\begin{verbatim}
\lhead{\bfseries\large Math 115\\Professor Hilbert}
\chead{}
\rhead{\bfseries\large First Exam\\July 4, 1776}
\end{verbatim}
%---------------------------------------------------------------------
\subsubsection*{Leaving extra room for multiple line headers}
See section~\ref{sec:extra-room} for a description of the
\verb"\extraheadheight" command.
%---------------------------------------------------------------------
\subsection{The three parts of the footer}
\label{sec:footer}
The footer is composed of three parts, the whole setup being similar
to that for the header (see section~\ref{sec:header}). There are two
different ways in which you can specify the three parts of the footer.
The first uses the single command \verb"\footer" to specify all three
parts of the footer, or the commands \verb"\firstpagefooter" and
\verb"\runningfooter" to specify a different footer for the first page
(see section~\ref{sec:runningfooter}). The second uses the commands
\verb"\lfoot", \verb"\cfoot", and \verb"\rfoot", each of which takes
an optional argument to specify a different footer for the first page
(see section~\ref{sec:lfoot}). All of these commands should be given
in the preamble, i.e., after the \verb"\documentclass" command and
before the \verb"\begin{document}" command.
%--------------------------------------------------------------------
\subsubsection{Using \texttt{\char`\\footer},
\texttt{\char`\\firstpagefooter} and \texttt{\char`\\runningfooter}}
\label{sec:runningfooter}
The command \verb"\footer{Text 1}{Text 2}{Text 3}" puts ``Text~1''
into the left justified footer, ``Text~2'' into the centered footer
and ``Text~3'' into the right justified footer on every page. If you
want the footer on the first page to be different from that on the
other pages, then you should use the commands \verb"\firstpagefooter"
and \verb"\runningfooter", which also take three arguments and affect
either the first page or all pages except the first.
For example, to have an empty footer on the first page and the footer
\samplefoot{}{}{Page 3 of 5}{}
on all pages after the first, you would give the commands
\begin{verbatim}
\firstpagefooter{}{}{}
\runningfooter{}{Page \thepage\ of \numpages}{}
\end{verbatim}
(For an explanation of the \verb"\numpages" command, see
section~\ref{sec:numpages}.)
%--------------------------------------------------------------------
\subsubsection{Using \texttt{\char`\\lfoot}, \texttt{\char`\\cfoot}
and \texttt{\char`\\rfoot}}
\label{sec:lfoot}
The command \verb"\lfoot{Text}" puts ``Text'' into the left justified
part of the footer on every page. The command
\verb"\lfoot[Text 1]{Text 2}" puts ``Text~1'' into the left justified
footer on the first page and ``Text~2'' into the left justified footer
on all other pages. The commands \verb"\cfoot" and \verb"\rfoot" have
similar effects on the centered and right justified parts of the
footer.
For example, to have an empty footer on the first page and the footer
\samplefoot{}{}{Page 3 of 5}{}
on all pages after the first, you would give the commands
\begin{verbatim}
\lfoot{}
\cfoot{}
\rfoot[]{Page \thepage\ of \numpages}
\end{verbatim}
(For an explanation of the \verb"\numpages" command, see
section~\ref{sec:numpages}.)
%---------------------------------------------------------------------
\subsubsection*{Leaving extra room for multiple line footers}
See section~\ref{sec:extra-room} for a description of the
\verb"\extrafootheight" command.
%---------------------------------------------------------------------
\subsection{Leaving extra room for multiple line headers and footers}
\label{sec:extra-room}
\subsubsection*{Headers}
If you specify more than one or two lines for any part of the header,
then you may want to move the header down slightly so that it doesn't
run off of the top of the paper. The command for this is
\verb"\extraheadheight". You can also use the \verb"\extraheadheight"
command to adjust the size of the text area. The
\verb"\extraheadheight" command never changes the distance between the
header and the text.
For example, to move the header and the text an additional half inch
down from the top of the page, you would give the command
\begin{center}
\verb"\extraheadheight{.5in}"
\end{center}
You can also specify a negative distance to \verb"\extraheadheight" to
move the header up closer to the top of the paper. For example, the
command
\begin{center}
\verb"\extraheadheight{-.25in}"
\end{center}
moves the header one quarter inch closer to the top of the paper.
If you want to have a different value for \verb"\extraheadheight" on
the first page from that on the pages after the first, then use the
same syntax as in the \verb"\lhead", \verb"\chead", and \verb"\rhead"
commands (see section~\ref{sec:lhead}): Include an optional argument
giving the extra head height for the first page, and the required
argument will apply only to those pages after the first. For example,
the command
\begin{center}
\verb"\extraheadheight[.5in]{.25in}"
\end{center}
gives a half inch of extra head height on the first page and a
quarter inch of extra head height on all pages after the first.
If you say
\begin{center}
\verb"\extraheadheight[.5in]{}"
\end{center}
then this will be interpreted as if it was
\begin{center}
\verb"\extraheadheight[.5in]{0in}"
\end{center}
Note that the braces \emph{must} appear.
If you give an \verb"\extraheadheight" command, it should be in the
preamble, i.e., after the \verb"\documentclass" command and before the
\verb"\begin{document}" command. The \verb"\extraheadheight" command
can also be used to change the size of the text region (see
section~\ref{sec:pagesize}).
%--------------------------------------------------------------------
\subsubsection*{Footers}
To leave extra room for multiple line footers, you use the command
\verb"\extrafootheight". To move the footer one half inch higher up
on the paper, you would give the command
\begin{center}
\verb"\extrafootheight{.5in}"
\end{center}
If you wanted to move the footer an eighth of an inch lower down on
the paper, you would give the command
\begin{center}
\verb"\extrafootheight{-.125in}"
\end{center}
If you want to have a different value for \verb"\extrafootheight" on
the first page from that on the pages after the first, then use the
same syntax as in the \verb"\lfoot", \verb"\cfoot", and \verb"\rfoot"
commands (see section~\ref{sec:lfoot}): Include an optional argument
giving the extra foot height for the first page, and the required
argument will apply only to those pages after the first. For example,
the command
\begin{center}
\verb"\extrafootheight[.5in]{.25in}"
\end{center}
gives a half inch of extra foot height on the first page and a
quarter inch of extra foot height on all pages after the first.
If you say
\begin{center}
\verb"\extrafootheight[.5in]{}"
\end{center}
then this will be interpreted as if it was
\begin{center}
\verb"\extrafootheight[.5in]{0in}"
\end{center}
Note that the braces \emph{must} appear.
If you give an \verb"\extrafootheight" command, it should be in the
preamble, i.e., after the \verb"\documentclass" command and before the
\verb"\begin{document}" command. The \verb"\extrafootheight" command
can also be used to change the size of the text region (see
section~\ref{sec:pagesize}).
%---------------------------------------------------------------------
\subsection{Horizontal rules}
\label{sec:rules}
The \verb"exam" document class make it easy to put a horizontal rule
under the header and one above the footer. It is also easy to do
this for the pages after the first page without affecting the first
page.
\begin{itemize}
\item The command \verb"\runningheadrule" puts a horizontal rule below
the header on all pages after the first.
\item The command \verb"\firstpageheadrule" puts a rule under the
header of only the first page.
\item The command \verb"\headrule" is equivalent to the two commands
\verb"\firstpageheadrule" and \verb"\runningheadrule".
\item The command \verb"\runningfootrule" puts a horizontal rule above
the footer on all pages after the first.
\item The command \verb"\firstpagefootrule" puts a rule above the
footer of only the first page.
\item The command \verb"\footrule" is equivalent to the two commands
\verb"\firstpagefootrule" and \verb"\runningfootrule".
\end{itemize}
For example, to have the header
\samplehead{Math 115}{First Exam}{July 4, 1776}{}
on the first page, with the header
\samplehead{Math 115}{First Exam}{July 4, 1776}{\hrule}
on all pages after the first, give either the commands
\begin{verbatim}
\runningheadrule
\header{Math 115}{First Exam}{July 4, 1776}
\end{verbatim}
or the commands
\begin{verbatim}
\runningheadrule
\lhead{Math 115}
\chead{First Exam}
\rhead{July 4, 1776}
\end{verbatim}
For a description of the command \verb"\header" see
section~\ref{sec:runningheader}; for a description of the commands
\verb"\lhead", \verb"\chead", and \verb"\rhead", see
section~\ref{sec:lhead}.
\bigskip
To have no footer on the first page, and the footer
\samplefoot{\hrule}{}{Page 3 of 5}{}
on all pages after the first, give the commands
\begin{verbatim}
\runningfootrule
\lfoot{}
\cfoot[]{Page \thepage\ of \numpages}
\rfoot{}
\end{verbatim}
(see section~\ref{sec:numpages} for an explanation of the command
\verb"\numpages").
%---------------------------------------------------------------------
\subsection{Listing the number of pages in the exam}
\label{sec:numpages}
The \verb"exam" document class defines the command \verb"\numpages"
so that it will expand to the number of pages in the exam. Thus, to
have the footer
\samplefoot{}{}{Page \thepage\ of \numpages}{}
you should either give the command
\begin{verbatim}
\footer{}{Page \thepage\ of \numpages}{}
\end{verbatim}
or the commands
\begin{verbatim}
\lfoot{}
\cfoot{Page \thepage\ of \numpages}
\rfoot{}
\end{verbatim}
For a description of the command \verb"\footer" see
section~\ref{sec:runningfooter}; for a description of the commands
\verb"\lfoot", \verb"\cfoot", and \verb"\rfoot", see
section~\ref{sec:lfoot}.
As with all other cross referencing commands in \LaTeX, you'll have to
run the file through \LaTeX{} \emph{twice} to be sure that
\verb"\numpages" is correct.
%---------------------------------------------------------------------
\subsection{Treating the last page differently}
\label{sec:lastpage}
If you want to vary the text that appears in the header or footer on
the last page of the exam, you should use the command
\verb"\iflastpage". The command
\begin{center}
\verb"\iflastpage{Text 1}{Text 2}"
\end{center}
expands to `Text~1' on the last page and to `Text~2' on all pages
before the last. Thus, to have the footer
%
\samplefoot{}{}{Please go on to the next page\ldots}{}
%
on all pages before the last page and the footer
%
\samplefoot{}{}{End of exam}{}
%
on the last page, you should give the command
\begin{verbatim}
\footer{}
{\iflastpage{End of exam}{Please go on to the next page\ldots}}
{}
\end{verbatim}
or the commands
\begin{verbatim}
\lfoot{}
\cfoot{\iflastpage{End of exam}{Please go on to the next page\ldots}}
\rfoot{}
\end{verbatim}
For a description of the command \verb"\footer" see
section~\ref{sec:runningfooter}; for a description of the commands
\verb"\lfoot", \verb"\cfoot", and \verb"\rfoot", see
section~\ref{sec:lfoot}.
As with all other cross referencing commands in \LaTeX, you'll have to
run the file through \LaTeX{} \emph{twice} to be sure that
\verb"\iflastpage" correctly detects the last page.
%--------------------------------------------------------------------
\subsection{Treating odd and even numbered pages differently}
If you'd like odd and even numbered pages to be treated differently
(perhaps because you'll be printing onto both sides of the paper), you
should use the \verb"\oddeven" command.
The \verb"\oddeven" command takes two arguments. If the current page
number is odd it expands to the first argument; otherwise, it expands
to the second argument.
For example, to have the page number printed in the right head on odd
numbered pages and in the left head on even numbered pages, you should
give the command
\begin{verbatim}
\header{\oddeven{}{\thepage}}%
{}%
{\oddeven{\thepage}{}}
\end{verbatim}
or the commands
\begin{center}
\begin{verbatim}
\lhead{\oddeven{}{\thepage}}
\rhead{\oddeven{\thepage}{}}
\chead{}
\end{verbatim}
\end{center}
If you want the footer of the even numbered pages to be empty and the
footer of the odd numbered pages to contain the centered message
``Please continue\dots'', except that the last page of the exam should
have an empty footer whether its page number is even or odd, then you
should give the command
\begin{verbatim}
\footer{}
{\oddeven{\iflastpage{}{Please continue\ldots}}{}}
{}
\end{verbatim}
or the commands
\begin{center}
\begin{verbatim}
\lfoot{}
\rfoot{}
\cfoot{\oddeven{\iflastpage{}{Please continue\dots}}{}}
\end{verbatim}
\end{center}
(see section~\ref{sec:lastpage} for an explanation of
\verb"\iflastpage").
The \verb"\oddeven" command can be used reliably only in headers and
footers. This is because \LaTeX{} generally processes more text than
can fit on the current page before it outputs a page. When the
\verb"\oddeven" command is encountered it will act as though it will
appear on the current page whether it will actually be printed on that
page or on the following page; in headers and footers this never
creates a problem.
%--------------------------------------------------------------------
\subsection{Questions that span multiple pages}
\label{sec:QuesSpan}
The exam document class provides the commands \verb"\ifcontinuation",
\verb"\ContinuedQuestion", \verb"\ifincomplete", and
\verb"\IncompleteQuestion" to enable headers and footers that announce
whether this page is continuing a question begun on an earlier page
(and, if so, the number of that question) and whether the question at
the bottom of this page continues onto the next page (and, if so, the
number of that question).
\emph{These commands are only guaranteed to work in headers and
footers.} If you use any of them elsewhere, they may be fooled by
\LaTeX's practice of typesetting a bit too much material to fit on a
page before it chooses the page break and ships out the page. They
also assume that there is only one \verb"questions" environment in the
entire exam.
There is also a command \verb"\nomorequestions" to mark the point at
which the last question ends, which can be useful if you want to
include supplementary material (e.g., tables or figures) at the end of
the exam but you don't want that material to be described as
continuing the last question.
\medskip
In more detail:
\begin{itemize}
\item \verb"\ifcontinuation{Text 1}{Text 2}"\\
Expands to `Text 2' if the first question, part, subpart,
subsubpart, or choice that begins on this page is a question, and to
`Text 1' if it's a part, subpart, subsubpart, or choice. It also
expands to `Text 1' if no question, part, subpart, subsubpart, or
choice begins on this page and we're not beyond a page with the
command \verb"\nomorequestions" or before the page with question
number 1; otherwise, it expands to `Text2'.
That is, it expands to `Text 2' if
\begin{itemize}
\item this page precedes the page containing question number 1,
\item this page is later than a page with the
\verb"\nomorequestions" command, or
\item a question begins on this page before any part, subpart,
subsubpart, or choice begins,
\end{itemize}
and otherwise it expands to `Text 1'.
\item \verb"\ContinuedQuestion"\\
If a question begun on an earlier page continues on this page, then
\verb"\ContinuedQuestion" expands to the number of that question.
That is, \verb"\ContinuedQuestion" expands to the number of the last
question begun before this page if either
\begin{itemize}
\item the first question, part, subpart, subsubpart, or choice that
begins on this page is a part, subpart, subsubpart, or choice, or
\item this page doesn't contain the beginning of any question, part,
subpart, subsubpart, or choice.
\end{itemize}
\item \verb"\ifincomplete{Text 1}{Text 2}"\\
Expands to \verb"Text 1" if we have not yet encountered a
\verb"\nomorequestions" command and if the last question begun on or
before this page has a part, subpart, subsubpart, or choice that
begins on a later page. Otherwise, it expands to \verb"Text 2".
\item \verb"\IncompleteQuestion"\\
If the last question begun on or before this page has a part,
subpart, subsubpart, or choice that begins on a later page, then
this expands to the number of that question.
\item \verb"\nomorequestions"\\
No page following the page on which this command was given will be
considered to continue a question from an earlier page. Thus, if
you give this command after the last question is complete, then you
can include extra material (e.g., tables for use on the exam)
without having those pages labelled as continuing the last question
on the exam.
\end{itemize}
\medskip
Thus, to have the header
\samplehead{}{First Exam}{Page 4}{}
%
on all pages that begin a new question and the header
\samplehead{Question 6 continues\ldots}{First Exam}{Page 4}{}
%
on all pages that continue a question begun on a previous page, you
would give the commands
\begin{verbatim}
\lhead{\ifcontinuation{Question \ContinuedQuestion\ continues\ldots}{}}
\chead{First Exam}
\rhead{Page \thepage}
\end{verbatim}
(See section~\ref{sec:lhead} for an explanation of \verb"\lhead",
\verb"\chead" and \verb"\rhead".)
\medskip
To have the footer
\samplefoot{\hrule}{}{Question 3 continues\ldots}{}
%
on all pages that end with a question that will be continued onto the
next page, the footer
\samplefoot{\hrule}{}{End of Exam}{}
%
on the last page, and the footer
\samplefoot{\hrule}{}{Exam continues\ldots}{}
%
on all other pages, you would give the commands
\begin{verbatim}
\footrule
\lfoot{}
\newcommand\continues{\ifincomplete{\incompletemessage}{Exam continues\ldots}}
\newcommand\incompletemessage{Question \IncompleteQuestion\ continues\ldots}
\cfoot{\iflastpage{End of Exam}{\continues}}
\rfoot{}
\end{verbatim}
(See section~\ref{sec:lfoot} for an explanation of \verb"\lfoot",
\verb"\cfoot" and \verb"\rfoot", and section~\ref{sec:lastpage} for an
explanation of \verb"\iflastpage").
%--------------------------------------------------------------------
\subsection{Examples}
\begin{example}
\label{sec:beginexamples}
To have the header
\samplehead{Math 115}{First Exam}{July 4, 1776}{}
on the first page, the header
\samplehead{Math 115}{First Exam, Page 2 of 5}{July 4, 1776}{\hrule}
on all pages after the first, and no footer on any page, give the
commands
\begin{verbatim}
\pagestyle{head}
\runningheadrule
\firstpageheader{Math 115}{First Exam}{July 4, 1776}
\runningheader{Math 115}
{First Exam, Page \thepage\ of \numpages}
{July 4, 1776}
\end{verbatim}
Alternatively, you could give the commands
\begin{verbatim}
\pagestyle{head}
\runningheadrule
\lhead{Math 115}
\chead[First Exam]{First Exam, Page \thepage\ of \numpages}
\rhead{July 4, 1776}
\end{verbatim}
\end{example}
%--------------------------------------------------------------------
\begin{example}
To have the header
\samplehead{Math 115}{First Exam}{July 4, 1776}{}
on the first page, no header on the pages after the first, no footer
on the first page, and the footer
\samplefoot{\hrule}{Math 115}{First Exam}{Page 2 of 5}
on all pages after the first, give the commands
\begin{verbatim}
\pagestyle{headandfoot}
\runningfootrule
\firstpageheader{Math 115}{First Exam}{July 4, 1776}
\runningheader{}{}{}
\firstpagefooter{}{}{}
\runningfooter{Math 115}{First Exam}{Page \thepage\ of \numpages}
\end{verbatim}
Alternatively, you could give the commands
\begin{verbatim}
\pagestyle{headandfoot}
\runningfootrule
\lhead[Math 115]{}
\chead[First Exam]{}
\rhead[July 4, 1776]{}
\lfoot[]{Math 115}
\cfoot[]{First Exam}
\rfoot[]{Page \thepage\ of \numpages}
\end{verbatim}
\end{example}
%--------------------------------------------------------------------
\begin{example}
To have the header
\samplehead{\large\bfseries Mathematics 115\\
First Exam, July 4, 1776}%
{}{\large\bfseries Name:\enspace\makebox[2in]{\hrulefill}}{}
on the first page, the header
\samplehead{\large\bfseries Mathematics 115\\
First Exam, July 4, 1776}%
{}{}{}
on all pages after the first, an empty footer on the first page, and
the footer
\samplefoot{}{}{Page 2}{}
on all pages after the first, give the commands
\begin{verbatim}
\pagestyle{headandfoot}
\firstpageheader{\large\bfseries Mathematics 115\\
First Exam, July 4, 1776}
{}
{\large\bfseries Name:\enspace\makebox[2in]{\hrulefill}}
\runningheader{\large\bfseries Mathematics 115\\
First Exam, July 4, 1776}{}{}
\firstpagefooter{}{}{}
\runningfooter{}{Page \thepage}{}
\end{verbatim}
Alternatively, you could give the commands
\begin{verbatim}
\pagestyle{headandfoot}
\lhead{\large\bfseries Mathematics 115\\ First Exam, July 4, 1776}
\chead{}
\rhead[\large\bfseries Name:\enspace\makebox[2in]{\hrulefill}]{}
\lfoot{}
\cfoot[]{Page \thepage}
\rfoot{}
\end{verbatim}
\end{example}
%--------------------------------------------------------------------
\begin{example}
To have the header
\samplehead{}
{Wellesley College\\
Second Semester Final Examination, Spring 1993\\
Mathematics 115}
{}
{}
on the first page, the header
\samplehead{}
{Wellesley College\\
Second Semester Final Examination, Spring 1993\\
Mathematics 115 (Continued)}
{}
{}
on all pages after the first, the footer
\samplefoot{}{}{Page 3 of 10}{Please go on to the next page\ldots}
on all pages \emph{except the last} page, and the footer
\samplefoot{}{}{Page 10 of 10}{End of exam.}
on the last page, give the commands
\begin{verbatim}
\pagestyle{headandfoot}
\extraheadheight{.25in}
\firstpageheader{}
{Wellesley College\\
Second Semester Final Examination, Spring 1993\\
Mathematics 115}
{}
\runningheader{}
{Wellesley College\\
Second Semester Final Examination, Spring 1993\\
Mathematics 115 (Continued)}
{}
\footer{}
{Page \thepage\ of \numpages}
{\iflastpage{End of exam.}{Please go on to the next page\ldots}}
\end{verbatim}
Alternatively, you could give the commands
\begin{verbatim}
\pagestyle{headandfoot}
\extraheadheight{.25in}
\lhead{}
\chead[Wellesley College\\
Second Semester Final Examination, Spring 1993\\
Mathematics 115]
{Wellesley College\\
Second Semester Final Examination, Spring 1993\\
Mathematics 115 (Continued)}
\rhead{}
\lfoot{}
\cfoot{Page \thepage\ of \numpages}
\rfoot{\iflastpage{End of exam.}{Please go on to the next page\ldots}}
\end{verbatim}
\end{example}
%--------------------------------------------------------------------
\begin{example}
To have the header
\samplehead{}
{Wellesley College\\
Second Semester Final Examination, Spring 1993\\
Mathematics 115}
{}
{}
on the first page, the header
\samplehead{Mathematics 115 (Continued)}{}{Spring, 1993}{}
on all pages after the first, the footer
\samplefoot{}{}{Page 3 of 10}{Please go on to the next page\ldots}
on all pages \emph{except the last} page, and the footer
\samplefoot{}{}{Page 10 of 10}{End of exam.}
on the last page, give the commands
\begin{verbatim}
\pagestyle{headandfoot}
\extraheadheight[.25in]{}
\firstpageheader{}
{Wellesley College\\
Second Semester Final Examination, Spring 1993\\
Mathematics 115}
{}
\runningheader{Mathematics 115 (Continued)}{}{Spring, 1993}
\footer{}
{Page \thepage\ of \numpages}
{\iflastpage{End of exam.}{Please go on to the next page\ldots}}
\end{verbatim}
Alternatively, you could give the commands
\begin{verbatim}
\pagestyle{headandfoot}
\extraheadheight[.25in]{}
\lhead[]{Mathematics 115 (Continued)}
\chead[Wellesley College\\
Second Semester Final Examination, Spring 1993\\
Mathematics 115]
{}
\rhead[]{Spring, 1993}
\lfoot{}
\cfoot{Page \thepage\ of \numpages}
\rfoot{\iflastpage{End of exam.}{Please go on to the next page\ldots}}
\end{verbatim}
\end{example}
%--------------------------------------------------------------------
\begin{example}
To have the header
%
\samplehead{Math 115}{First Exam}{July 4, 1776}{}
on the first page, the header
%
\samplehead{Question 3 continues\ldots}{First Exam}{Page 3 of 10}{\hrule}
on all pages after the first that continue a question begun on an
earlier page, the header
%
\samplehead{}{First Exam}{Page 3 of 10}{\hrule}
on all pages after the first that don't continue a question begun on
an earlier page, the footer
%
\samplefoot{}{}{}{Question 6 continues on the next page\ldots}
%
on all pages whose last question continues onto the following page,
and no footer on pages that don't have a question that continues onto
the following page, give the commands
%
\begin{verbatim}
\pagestyle{headandfoot}
\runningheadrule
\newcommand\continuedmessage{%
\ifcontinuation{Question \ContinuedQuestion\ continues\ldots}{}%
}
\firstpageheader{Math 115}{First Exam}{July 4, 1776}
\runningheader{\continuedmessage}
{First Exam}
{Page \thepage\ of \numpages}
\footer{}
{}
{\ifincomplete{Question \IncompleteQuestion\ continues
on the next page\ldots}{}}
\end{verbatim}
Alternatively, you could give the commands
\begin{verbatim}
\pagestyle{headandfoot}
\runningheadrule
\newcommand\continuedmessage{%
\ifcontinuation{Question \ContinuedQuestion\ continues\ldots}{}%
}
\lhead[Math 115]{\continuedmessage}
\chead[First Exam]{First Exam}
\rhead[July 4, 1776]{Page \thepage\ of \numpages}
\lfoot{}
\cfoot{}
\rfoot{\ifincomplete{Question \IncompleteQuestion\ continues
on the next page\ldots}{}}
\end{verbatim}
\end{example}
%--------------------------------------------------------------------
\begin{example}
\label{sec:PtsPgEx}
To have the header
%
\samplehead{Math 115}{Second Exam}{July 4, 1776}{}
%
on the first page, the header
%
\samplehead{Second Exam}{}{July 4, 1776}{}
%
on all pages after the first, no footer on the first page, and the
footer
%
\samplefoot{}{Page 3 of 5}{}{Points earned: \makebox[.5in]{\hrulefill}\\
out of a possible 20 points}
%
on all pages after the first, give the commands
\begin{verbatim}
\pagestyle{headandfoot}
\firstpageheader{Math 115}{Second Exam}{July 4, 1776}
\runningheader{Second Exam}{}{July 4, 1776}
\runningfooter{Page \thepage\ of \numpages}
{}
{Points earned: \makebox[.5in]{\hrulefill}\\
out of a possible \pointsonpage{\thepage} points}
\end{verbatim}
Alternatively, you could give the commands
\begin{verbatim}
\pagestyle{headandfoot}
\lhead[Math 115]{Second Exam}
\chead[Second Exam]{}
\rhead{July 4, 1776}
\lfoot[]{Page \thepage\ of \numpages}
\cfoot{}
\rfoot[]{Points earned: \makebox[.5in]{\hrulefill}\\
out of a possible \pointsonpage{\thepage} points}
\end{verbatim}
\end{example}
%--------------------------------------------------------------------
\begin{example}
\label{sec:endexamples}
To have the header
%
\samplehead{Math 115}{Second Exam}{July 4, 1776}{}
%
on the first page, the header
%
\samplehead{}{Second Exam}{July 4, 1776}{}
%
on all odd numbered pages after the first, the header
%
\samplehead{Question 3 continues\ldots}{Math 115}{}{}
%
on all even numbered pages that continue a question begun on an
earlier page, the header
%
\samplehead{}{Math 115}{}{}
%
on all even numbered pages that don't continue a question begun on an
earlier page, the footer
%
\samplefoot{}{}{}{Page 5 of 10\\Question 6 continues\ldots}
%
on all odd numbered pages that have a question that continues onto the
following page, the footer
%
\samplefoot{}{}{}{Page 5 of 10}
%
on all odd numbered pages that don't have a question that continues
onto the following page, and the footer
%
\samplefoot{}{Page 4 of 10}{}{}
%
on all even numbered pages, give the commands
\begin{verbatim}
\pagestyle{headandfoot}
\newcommand\continuedmessage{%
\ifcontinuation{Question \ContinuedQuestion\ continues\ldots}{}%
}
\newcommand\oddrightfoot{%
\ifincomplete{Page \thepage\ of \numpages\\
Question \IncompleteQuestion\ continues\ldots}%
{Page \thepage\ of \numpages}
}
\firstpageheader{Math 115}{Second Exam}{July 4, 1776}
\runningheader{\oddeven{}{\continuedmessage}}
{\oddeven{Second Exam}{Math 115}}
{\oddeven{July 4, 1776}{}}
\footer{\oddeven{}{Page \thepage\ of \numpages}}
{}
{\oddeven{\oddrightfoot}{}}
\end{verbatim}
Alternatively, you could give the commands
\begin{verbatim}
\pagestyle{headandfoot}
\newcommand\continuedmessage{%
\ifcontinuation{Question \ContinuedQuestion\ continues\ldots}{}%
}
\newcommand\oddrightfoot{%
\ifincomplete{Page \thepage\ of \numpages\\
Question \IncompleteQuestion\ continues\ldots}%
{Page \thepage\ of \numpages}
}
\lhead[Math 115]{\oddeven{}{\continuedmessage}}
\chead{\oddeven{Second Exam}{Math 115}}
\rhead{\oddeven{July 4, 1776}{}}
\lfoot{\oddeven{}{Page \thepage\ of \numpages}}
\cfoot{}
\rfoot{\oddeven{\oddrightfoot}{}}
\end{verbatim}
\end{example}
%--------------------------------------------------------------------
%--------------------------------------------------------------------
\section{Cover pages}
\label{sec:coverpages}
There is a \verb"coverpages" environment that allows you to have one
or more pages before page~1 of the exam. By default, there are no
headers or footers printed on the cover pages, but if you put the page
number into the headers and/or footers (using the commands described
in section~\ref{sec:Coverhdft}), the page numbers of cover pages are
printed in roman numerals.
The \verb"coverpages" environment must begin and end \emph{before} the
beginning of the \verb"questions" environment. You begin the
environment with the command
\begin{center}
\verb"\begin{coverpages}"
\end{center}
and you end it with the command
\begin{center}
\verb"\end{coverpages}"
\end{center}
In between those two commands you can put whatever you want, except
that you are not allowed to begin the \verb"questions" environment
until you've ended the \verb"coverpages" environment. The command
\verb"\begin{coverpages}" sets the page number to 1 and causes any
page numbers printed (using the commands described in
section~\ref{sec:Coverhdft}) to appear as roman numerals. The command
\verb"\end{coverpages}" causes the current page to end, sets the page
number of the following page to 1, and changes page numbering back to
arabic numerals.
%--------------------------------------------------------------------
\subsection{Headers and footers}
\label{sec:Coverhdft}
By default, the headers and footers on the cover pages are empty. If
you'd like to have headers and/or footers on the cover pages, there
are commands to create them that are completely analogous to the
commands described in section~\ref{sec:headfoot} for headers and
footers in the main part of the document. The commands for headers
and footers in cover pages and the corresponding commands for the main
exam pages are:
\begin{center}
\begin{tabular}{l@{\qquad\qquad}l}
Cover Pages Commands& Main Pages Commands\\[\medskipamount]
\verb"\coverheader"&\verb"\header"\\
\verb"\coverrunningheader"&\verb"\runningheader"\\
\verb"\coverfirstpageheader"&\verb"\firstpageheader"\\[\medskipamount]
\verb"\coverlhead"&\verb"\lhead"\\
\verb"\coverchead"&\verb"\chead"\\
\verb"\coverrhead"&\verb"\rhead"\\[\medskipamount]
\verb"\coverfooter"&\verb"\footer"\\
\verb"\coverrunningfooter"&\verb"\runningheader"\\
\verb"\coverfirstpagefooter"&\verb"\firstpageheader"\\[\medskipamount]
\verb"\coverlfoot"&\verb"\lfoot"\\
\verb"\covercfoot"&\verb"\cfoot"\\
\verb"\coverrfoot"&\verb"\rfoot"\\[\medskipamount]
\verb"\coverextraheadheight"&\verb"\extraheadheight"\\
\verb"\coverextrafootheight"&\verb"\extrafootheight"
\end{tabular}
\end{center}
The commands \verb"\coverlhead", \verb"\coverchead",
\verb"\coverrhead", \verb"\coverlfoot", \verb"\covercfoot",
\verb"\coverrfoot", \verb"\coverextraheadheight", and
\verb"\coverextrafootheight" all all take the same optional arguments
(for special treatment of page number 1) as the corresponding commands
for the main pages. For an explanation of these commands, see
section~\ref{sec:headfoot}.
% The following is necessary to avoid warnings, since we have multiple
% questions environments in this documentation file:
\makeatletter
\@pointschangedfalse
\makeatother
\end{document}
%--------------------------------------------------------------------
%--------------------------------------------------------------------
%--------------------------------------------------------------------
|