Debian Codegraph @

texmf-dist/doc/latex/exam/examdoc.tex

raw
1 %--------------------------------------------------------------------
2 %--------------------------------------------------------------------
3 % examdoc.tex
4 %
5 % This is the user's guide for the exam documentclass,
6 % by Philip Hirschhorn.
7 %
8 % The exam documentclass itself is in the file exam.cls.
9
10
11 %%% Copyright (c) 1997, 2000, 2004, 2008, 2011, 2015, 2017, 2021, 2023
12 % Philip S. Hirschhorn
13 %
14 % This work may be distributed and/or modified under the
15 % conditions of the LaTeX Project Public License, either version 1.3
16 % of this license or (at your option) any later version.
17 % The latest version of this license is in
18 % http://www.latex-project.org/lppl.txt
19 % and version 1.3 or later is part of all distributions of LaTeX
20 % version 2003/12/01 or later.
21 %
22 % This work consists of the files exam.cls and examdoc.tex
23
24 % The user's guide for exam.cls is in the file examdoc.tex.
25
26
27 %%% Philip Hirschhorn
28 %%% Department of Mathematics
29 %%% Wellesley College
30 %%% Wellesley, MA 02481
31 %%% [email protected]
32
33 % The newest version of this documentclass should always be available
34 % from my web page: http://www-math.mit.edu/~psh/
35
36
37 %--------------------------------------------------------------------
38 %--------------------------------------------------------------------
39
40 \documentclass[12pt]{exam}
41 \usepackage{amssymb}
42
43 \usepackage{makeidx}
44
45 \usepackage[colorlinks]{hyperref}
46
47 % In case we're not using hyperref.sty:
48 \providecommand{\texorpdfstring}[2]{#1}
49 % The following can be used in \section commands
50 % to print a backslash (which will be omitted from the
51 % pdf string) without generating pdf warnings.
52 % Usage: \texttt{\bs documentclass}
53 \newcommand{\bs}{\texorpdfstring{\char`\\}{}}
54
55 \newcommand{\docversion}{2.704}
56 \newcommand{\docdate}{July 9, 2023}
57 %\newcommand{\docdate}{Draft: \today}
58
59 %--------------------------------------------------------------------
60 %
61 % Changes since version 2.4 are described in the comments
62 % near the beginning of the file exam.cls.
63 %
64 %--------------------------------------------------------------------
65
66 \makeindex
67
68 \newcommand{\indc}[1]{\index{#1@\texttt{\char`\\#1}}}
69 \newcommand{\indcsub}[2]{\index{#1@\texttt{\char`\\#1}!#2}}
70 \newcommand{\indcstart}[1]{\index{#1@\texttt{\char`\\#1}|(}}
71 \newcommand{\indcstop}[1]{\index{#1@\texttt{\char`\\#1}|)}}
72
73 \newcommand{\indt}[1]{\index{#1@\texttt{#1}}}
74 \newcommand{\indtsub}[2]{\index{#1@\texttt{#1}!#2}}
75 \newcommand{\indtstart}[1]{\index{#1@\texttt{#1}|(}}
76 \newcommand{\indtstop}[1]{\index{#1@\texttt{#1}|)}}
77 \index{xcolor|see{color}}
78 %---------------------------------------------------------------------
79 \newenvironment{example}%
80 {\bigskip\filbreak
81 \subsubsection{Example:}
82 }%
83 {}
84
85 \def\samplehead#1#2#3#4{%
86 \begin{trivlist}
87 \item[]
88 \leavevmode
89 \hbox to \textwidth{%
90 \rlap{\parbox[b]{\textwidth}{\raggedright#1\strut}}%
91 \hfil\parbox[b]{\textwidth}{\centering#2\strut}\hfil
92 \llap{\parbox[b]{\textwidth}{\raggedleft#3\strut}}%
93 }% hbox
94 #4
95 \end{trivlist}
96 }
97
98 \def\samplefoot#1#2#3#4{%
99 \begin{trivlist}
100 \item[]
101 \leavevmode
102 #1
103 \vskip 3pt
104
105 \hbox to \textwidth{%
106 \rlap{\parbox[t]{\textwidth}{\raggedright#2}}%
107 \hfil\parbox[t]{\textwidth}{\centering#3}\hfil
108 \llap{\parbox[t]{\textwidth}{\raggedleft#4}}%
109 }% hbox
110 \end{trivlist}
111 }
112
113 % \makeatletter
114 % \@ifundefined{AmS}{\def\AmS{{\protect\the\textfont\tw@
115 % A\kern-.1667em\lower.5ex\hbox{M}\kern-.125emS}}}
116 % {}
117 % \makeatother
118
119
120 %---------------------------------------------------------------------
121 %---------------------------------------------------------------------
122 %---------------------------------------------------------------------
123 %---------------------------------------------------------------------
124
125 \begin{document}
126
127 \title{Using the exam document class}
128
129 \author{Philip Hirschhorn\\
130 Department of Mathematics\\
131 Wellesley College\\
132 Wellesley, MA 02481\\
133 [email protected]\\[\bigskipamount]
134 Copyright \copyright~1994, 1997, 2000, 2004, 2008, 2011, 2015, 2017,
135 2021, 2023\\
136 Philip Hirschhorn\\
137 All rights reserved}
138
139 \date{\docdate}
140
141 \maketitle
142
143 \begin{center}
144 \small
145 This is the user's guide for version~\docversion{} of the
146 \verb"exam" document class.
147 \end{center}
148
149 \tableofcontents
150
151 %--------------------------------------------------------------------
152 \section{Introduction}
153
154 The file \verb"exam.cls" provides the \verb"exam" document class,
155 which attempts to make it easy for even a \LaTeX{} novice to prepare
156 exams. Specifically, \verb"exam.cls" sets the page layout so that
157 there are one inch margins\index{margins} all around (no matter what
158 size paper you're using) and provides commands that make it easy to
159 format questions, create flexible headers and footers, change the
160 margins, and create grading tables. In more detail:
161 \begin{itemize}
162 \item The class will automatically format and number the questions,
163 parts of questions, subparts of parts, and subsubparts of subparts
164 (see sections \ref{sec:Questions} and~\ref{sec:parts}).
165 \item You can include the point value\index{points} of each question
166 (or part, or subpart, or subsubpart), with your choice of having the
167 point values printed at the beginning of the text of the question,
168 opposite that in the left margin, opposite that in the right margin,
169 or in the right margin opposite the end of the question (see
170 section~\ref{sec:points}).
171 \item The class will add up the total points for each question (and
172 all of its parts, subparts, and subsubparts) and the total
173 points\index{points!total} on each page, and make those totals
174 available in macros (see sections \ref{sec:addup},
175 \ref{sec:pointsofq} and~\ref{sec:pointsonp}).
176 \item You can have the class print a grading table, indexed either by
177 question number or by page number (see
178 section~\ref{sec:GradeTables}).
179 \item You specify the header in three parts: One part to be left
180 justified, one part to be centered, and one part to be right
181 justified, and one or all of these can be omitted (see
182 section~\ref{sec:header}).
183 \item The footer is also specified in three parts: Left justified,
184 centered, and right justified (see section~\ref{sec:footer}).
185 \item The header and footer for the first page can be different from
186 the ones used on other pages (see sections \ref{sec:runningheader},
187 \ref{sec:lhead}, \ref{sec:runningfooter}, and \ref{sec:lfoot}).
188 \item Both headers and footers can contain more than one line. To
189 accommodate headers and footers with several lines, simple commands
190 are provided to enlarge the part of the page devoted to the header
191 and/or footer, and these commands can give one amount of space on
192 the first page and a different amount of space on all other pages
193 (see section~\ref{sec:extra-room}).
194 \item Macros are defined to enable you to state the total number of
195 pages in the exam (see section~\ref{sec:numpages}) and to change the
196 header and/or footer that appears on the last page of the exam (see
197 section~\ref{sec:lastpage}).
198 \item Macros are defined so that the headers and footers can vary
199 depending on whether the current page begins a new question or
200 continues a question that started on an earlier page (and, if one
201 continues onto the current page, to say what the number of that
202 question is). Macros are also defined so that the headers and
203 footers can vary depending on whether a question is complete on the
204 current page or continues on to the next page (and, if one
205 continues, to say what the number of that question is) (see
206 section~\ref{sec:QuesSpan}).
207 \item You can have a horizontal rule at the base of the header and/or
208 at the top of the footer (see section~\ref{sec:rules}).
209 \item The exam can begin with one or more cover pages, which are
210 numbered separately from the main pages of the exam and which can
211 have headers and footers different from the ones in the main pages
212 of the exam (see section~\ref{sec:coverpages}).
213 \item You can include solutions in your \LaTeX{} file and have these
214 solutions either printed or ignored (or replaced automatically by
215 space in which the students can write their answers) depending on a
216 single command (see section~\ref{sec:solutions},
217 section~\ref{sec:CorrectChoice}, and section~\ref{sec:AnsShortAns}).
218 \end{itemize}
219
220 The latest version of \verb"exam.cls" (possibly a
221 %
222 beta\index{beta test} test version) should always be available at
223 \verb"http://www-math.mit.edu/~psh/"\index{web page}.
224
225 %--------------------------------------------------------------------
226 \subsection{License}
227
228 \begin{itemize}
229 \item This work may be distributed and/or modified under the
230 %
231 \index{Latex Project Public License@\LaTeX{} Project Public License}
232 %
233 conditions of the \LaTeX{} Project Public
234 License\index{license},\index{LPPL} either version~1.3 of this
235 license or (at your option) any later version. The latest version
236 of this license is in \verb"http://www.latex-project.org/lppl.txt"
237 and version 1.3 or later is part of all distributions of \LaTeX{}
238 version 2003/12/01 or later.
239 \item This work has the LPPL maintenance status ``author-maintained''.
240 \item This work consists of the files \verb"exam.cls" and
241 \verb"examdoc.tex".
242 \end{itemize}
243
244 %--------------------------------------------------------------------
245 %--------------------------------------------------------------------
246 \section{Simple instructions for a basic exam}
247 \label{sec:Basic}
248
249 Producing a basic exam with the \texttt{exam} document class is fairly
250 easy. After you learn to do that, you can read the parts of this
251 user's guide that describe how to customize whatever you want to
252 change.
253 %--------------------------------------------------------------------
254 \subsection{The \texttt{\bs documentclass} command}
255 \label{sec:BasicDocumentclass}
256
257 To use the \texttt{exam} document class, your \verb"\documentclass"
258 command should be\indc{documentclass}
259 \begin{center}
260 \verb"\documentclass[addpoints]{exam}"
261 \end{center}
262 or, if you want to use 12~point type,
263 \begin{center}
264 \verb"\documentclass[addpoints,12pt]{exam}"
265 \end{center}
266 There are other options; for the full story, see
267 section~\ref{sec:Documentclass}.
268
269 %--------------------------------------------------------------------
270 \subsection{Asking for the student's name}
271 \label{sec:BasicName}
272
273 If you'll be leaving space for the answers on the question pages (see
274 sections~\ref{sec:BasicSpace} and \ref{sec:LeaveSpace}), then you'll
275 probably also want to leave space for the student's name%
276 \index{name}\index{student's name}. If you type
277 \begin{verbatim}
278 \begin{center}
279 \fbox{\fbox{\parbox{5.5in}{\centering
280 Answer the questions in the spaces provided on the
281 question sheets. If you run out of room for an answer,
282 continue on the back of the page.}}}
283 \end{center}
284
285 \vspace{0.1in}
286
287 \makebox[\textwidth]{Name and section:\enspace\hrulefill}
288
289 \vspace{0.2in}
290
291 \makebox[\textwidth]{Instructor's name:\enspace\hrulefill}
292 \end{verbatim}
293 after the \verb"\begin{document}" command and before the
294 \verb"\begin{questions}" command (see section~\ref{sec:Questions}),
295 then you'll get\\
296 \noindent
297 \parbox{\textwidth}{
298 \begin{center}
299 \fbox{\fbox{\parbox{5.5in}{\centering
300 Answer the questions in the spaces provided on the
301 question sheets. If you run out of room for an answer,
302 continue on the back of the page.}}}
303 \end{center}
304
305 \vspace{0.1in}
306
307 \makebox[\textwidth]{Name and section:\enspace\hrulefill}
308
309 \vspace{0.2in}
310
311 \makebox[\textwidth]{Instructor's name:\enspace\hrulefill}
312 }
313
314 %--------------------------------------------------------------------
315 \subsection{Asking questions}
316 \label{sec:BasicQuestions}
317
318 Once you've typed \verb"\begin{document}" and (if the students will be
319 writing their answers on the question pages) asked for the student's
320 name (see section~\ref{sec:BasicName}), you can list the questions
321 on the exam in a \texttt{questions} environment. You begin each
322 question with a \verb"\question"\indc{question} command, which is
323 optionally followed by a number of points inside of square brackets.
324 For example, if you type
325 %
326 \index{questions environment}\index{environment!questions}
327 \indt{questions}
328 \begin{verbatim}
329 \begin{questions}
330
331 \question[10]
332 Why is there air?
333
334 \question[15]
335
336 How much wood would a woodchuck chuck if a woodchuck could chuck
337 wood?
338
339 \question[10] Compute $\displaystyle\int_0^1 x^2 \, dx$.
340 \end{questions}
341 \end{verbatim}
342 then you'll get
343 \begin{questions}
344
345 \question[10]
346 Why is there air?
347
348 \question[15]
349
350 How much wood would a woodchuck chuck if a woodchuck could chuck
351 wood?
352
353 \question[10] Compute $\displaystyle\int_0^1 x^2 \, dx$.
354 \end{questions}
355
356 \bigskip
357
358 As the above example illustrates, you can leave blank lines
359 %
360 \index{blank lines} between the \verb"\question" command and the
361 actual beginning of the question, or before the first \verb"\question"
362 command in the environment, and they will be ignored. The point
363 values are entirely optional; if you omit the point values, you should
364 also omit the square brackets containing them.
365
366 If you give the command \verb"\marksnotpoints"\indc{marksnotpoints},
367 then the words ``point'' and ``points'' will be replaced by the words
368 ``mark'' and ``marks''. There are many other customizations possible
369 for the points, including using a different language, changing the way
370 the points are printed, and by having them printed in one of the
371 margins. For the full story, see section~\ref{sec:points}.
372
373
374 %--------------------------------------------------------------------
375 \subsection{Questions with parts, and subparts, and subsubparts}
376 \label{sec:BasicParts}
377
378 If you want to create a question with parts, you use a
379 \texttt{parts}\indt{parts} environment and begin each part with the
380 command \verb"\part"\indc{part}. The \texttt{parts} environment can
381 be at the beginning of a question or after some text that begins the
382 question. (There are also \texttt{subparts} and \texttt{subsubparts}
383 environments; for the full details, see section~\ref{sec:parts}.) For
384 example, if you type
385 %
386 \index{parts environment}\index{environment!parts}
387 \begin{verbatim}
388 \begin{questions}
389 \question[10]
390 Why is there air?
391
392 \question
393 What if there were no air?
394
395 \begin{parts}
396 \part[5]
397 Describe the effect on the balloon industry.
398
399 \part[5]
400 Describe the effect on the aircraft industry.
401 \end{parts}
402
403 \question[20]
404
405 \begin{parts}
406 \part
407 Define the universe. Give three examples.
408
409 \part
410 If the universe were to end, how would you know?
411
412 \end{parts}
413
414
415 \end{questions}
416 \end{verbatim}
417 then you'll get
418 \begin{questions}
419 \question[10]
420 Why is there air?
421
422 \question
423 What if there were no air?
424
425 \begin{parts}
426 \part[5]
427 Describe the effect on the balloon industry.
428
429 \part[5]
430 Describe the effect on the aircraft industry.
431 \end{parts}
432
433 \question[20]
434
435 \begin{parts}
436 \part
437 Define the universe. Give three examples.
438
439 \part
440 If the universe were to end, how would you know?
441
442 \end{parts}
443
444
445 \end{questions}
446
447 \bigskip
448
449 The above example illustrates several things:
450 \begin{itemize}
451 \item Parts of a question should be put into a
452 \verb"parts"\indt{parts}\index{parts environment}%
453 \index{environment!parts} environment.
454 \item If a question begins with a \verb"parts" environment, then the
455 first part will appear on the same line with the question number.
456 \item You can leave blank
457 %
458 lines\index{blank lines} before and after the \verb"\part" command,
459 and they will be ignored.
460 \item You can assign points either to the question or to the parts of
461 a question.
462 \end{itemize}
463
464 %--------------------------------------------------------------------
465 \subsection{Leaving space for the answers}
466 \label{sec:BasicSpace}
467 \index{space!for answers}
468 \index{answer space}
469
470 To leave blank space after a question you use the \verb"\vspace"
471 command, and you end a page with the \verb"\newpage" command. For
472 example, if you wanted to leave 3~inches of space after the first
473 question and 2~inches of space after each of the parts of the second
474 question, your \texttt{questions} environment would contain the
475 following:
476 %
477 \index{blank space}\index{space!blank}
478 \begin{verbatim}
479 \question[10]
480 Why is there air?
481
482 \vspace{3in}
483
484 \question
485 What if there were no air?
486
487 \begin{parts}
488 \part[5]
489 Describe the effect on the balloon industry.
490 \vspace{2in}
491
492 \part[5]
493 Describe the effect on the aircraft industry.
494 \vspace{2in}
495 \end{parts}
496 \newpage
497 \end{verbatim}
498 If you want to equally distribute the space on a page among several
499 questions (or parts, or subparts, or subsubparts), you should
500 type\indc{stretch}\index{space!allocating}
501 %
502 \index{allocating space}
503 \begin{center}
504 \verb"\vspace{\stretch{1}}"
505 \end{center}
506 after each of the questions (or parts, etc.\@) and end the page with
507 \verb"\newpage". If you'd like one of those questions to receive
508 twice as much space as each of the others, then follow that one
509 question with \verb"\vspace{\stretch{2}}" and follow each of the
510 others with \verb"\vspace{\stretch{1}}". (You can use any decimal
511 number for the \verb"\stretch" value. For example,
512 \verb"\vspace{\stretch{1.5}}" will allocate 1.5 times the amount of
513 space allocated by \verb"\vspace{\stretch{1}}".)
514
515 In addition to leaving blank space, it's also possible to leave lined
516 space, dotted lined space, space printed with a grid, or an empty box.
517 For the full story, see section~\ref{sec:LeaveSpace}.
518
519 %--------------------------------------------------------------------
520 \subsection{Headers and footers}
521 \label{sec:BasicHeadFoot}
522 \index{header|(}
523 \index{footer|(}
524
525 To produce headers and footers, you give the command\indc{pagestyle}
526 \begin{center}
527 \verb"\pagestyle{headandfoot}"
528 \end{center}
529 in the preamble (i.e., after the \verb"\documentclass" command and
530 before the \verb"\begin{document}" command), followed by the commands
531 that say what will be in the headers and footers. Headers and
532 footers each have three parts: One part on the left, one centered
533 part, and one part on the right, and any of these can be empty.
534
535 The headers and footers are determined by the commands%
536 \indc{firstpageheader}\indc{firstpagefooter}\indc{firstpageheadrule}%
537 \indc{firstpagefootrule}\indc{runningheader}\indc{runningfooter}%
538 \indc{runningheadrule}\indc{runningfootrule}
539 \begin{center}
540 \begin{tabular}{l@{\qquad}l}
541 \verb"\firstpageheader"& for the header on the first page,\\
542 \verb"\firstpagefooter"& for the footer on the first page,\\
543 \verb"\firstpageheadrule"& to put a horizontal rule in the head of
544 the first page,\\
545 \verb"\firstpagefootrule"& to put a horizontal rule in the foot of
546 the first page,\\[0.5ex]
547 \verb"\runningheader"& for the header after the first page,\\
548 \verb"\runningfooter"& for the footer after the first page\\
549 \verb"\runningheadrule"& to put a horizontal rule in the head
550 after the first page, and\\
551 \verb"\runningfootrule"& to put a horizontal rule in the foot
552 after the first page.\\
553 \end{tabular}
554 \end{center}
555
556 For example, to have the header
557 %
558 \samplehead{Math 115}{First Exam}{July 4, 1776}{}
559 %
560 on the first page, the header
561 %
562 \samplehead{Math 115}{First Exam, Page 2 of 5}{July 4, 1776}{\hrule}
563 %
564 on all pages after the first, and no footer on any page, give the
565 commands
566 \begin{verbatim}
567 \pagestyle{headandfoot}
568 \runningheadrule
569 \firstpageheader{Math 115}{First Exam}{July 4, 1776}
570 \runningheader{Math 115}
571 {First Exam, Page \thepage\ of \numpages}
572 {July 4, 1776}
573 \firstpagefooter{}{}{}
574 \runningfooter{}{}{}
575 \end{verbatim}
576
577 For another example, to have the header
578 %
579 \samplehead{Math 115}{First Exam}{July 4, 1776}{}
580 %
581 on the first page, no header on the pages after the first, no footer
582 on the first page, and the footer
583 %
584 \samplefoot{\hrule}{Math 115}{First Exam}{Page 2 of 5}
585 %
586 on all pages after the first, give the commands
587 \begin{verbatim}
588 \pagestyle{headandfoot}
589 \firstpageheader{Math 115}{First Exam}{July 4, 1776}
590 \runningheader{}{}{}
591 \firstpagefooter{}{}{}
592 \runningfooter{Math 115}{First Exam}{Page \thepage\ of \numpages}
593 \runningfootrule
594 \end{verbatim}
595
596 Sections~\ref{sec:beginexamples} through \ref{sec:endexamples} contain
597 many other examples of headers and footers, and the full explanation
598 of the commands for headers and footers (including header and footer
599 commands other than the ones we've just mentioned) is in
600 sections~\ref{sec:pagestyle}--\ref{sec:QuesSpan}.
601
602 \index{header|)}
603 \index{footer|)}
604
605 %---------------------------------------------------------------------
606 %--------------------------------------------------------------------
607 \section{The \texttt{\bs documentclass} command}
608 \label{sec:Documentclass}
609
610 To use the \verb"exam" document class, you should specify \verb"exam"
611 as the required argument to your
612 \verb"\documentclass"\indc{documentclass}
613 command, as in
614 \begin{center}
615 \verb"\documentclass{exam}"
616 \end{center}
617 or, e.g., if you want to use 12~point type,
618 \begin{center}
619 \verb"\documentclass[12pt]{exam}"
620 \end{center}
621 There are two possible optional arguments that are specific to the
622 \verb"exam" document class:
623 \verb"addpoints"\indcsub{documentclass}{options} and \verb"solutions".
624 Most documents that use the \verb"exam" document class should use the
625 option \verb"addpoints" (see section~\ref{sec:addpoints}); the option
626 \verb"answers" is used when you want to print solutions to the
627 questions (see section~\ref{sec:answers}).
628
629 %--------------------------------------------------------------------
630 \subsection{The option \texttt{addpoints}}
631 \label{sec:addpoints}
632
633 The \verb"\documentclass" option
634 \verb"addpoints"\indt{addpoints}\indcsub{documentclass}{options}, used
635 as in
636 \begin{center}
637 \verb"\documentclass[addpoints]{exam}"
638 \end{center}
639 or
640 \begin{center}
641 \verb"\documentclass[12pt,addpoints]{exam}"
642 \end{center}
643 enables the commands that add up the points (see sections
644 \ref{sec:addup}, \ref{sec:Count}, \ref{sec:pointsofq},
645 and~\ref{sec:pointsonp}) and that produce grading tables and point
646 tables (see sections \ref{sec:GradeTables} and~\ref{sec:PointTables}).
647 This is an option, rather than the default, mainly for the sake of
648 maintaining backward compatibility; most documents that use the
649 \verb"exam" document class should use this option. The only reason
650 \emph{not} to use the \verb"addpoints" option is that this option
651 creates an error if you include any words in an argument that assigns
652 points to a question (see section~\ref{sec:points}). If
653 \verb"addpoints" is not in effect you can put whatever you want in the
654 argument for the points, but if \verb"addpoints" \emph{is} in effect
655 then the argument that contains the points must contain only digits
656 and the command \verb"\half" (see section~\ref{sec:Half}).
657
658 You can also turn \verb"addpoints" on and off wherever you like in the
659 exam by using the commands\indc{addpoints}\indc{noaddpoints}
660 \begin{center}
661 \begin{tabular}{l}
662 \verb"\addpoints"\\
663 \verb"\noaddpoints"
664 \end{tabular}
665 \end{center}
666 Using the document class option \verb"addpoints" is equivalent to
667 giving the command \verb"\addpoints" at the beginning of the exam.
668
669 %--------------------------------------------------------------------
670 \subsection{The option \texttt{answers}}
671 \label{sec:answers}
672
673 If you will be typing solutions into the exam (see sections
674 \ref{sec:solutions}, \ref{sec:CorrectChoice},
675 and~\ref{sec:AnsShortAns}) and you'd like the solutions to be printed
676 on the next run of \LaTeX, you should include the document class
677 option \verb"answers"\indt{answers}\indcsub{documentclass}{options},
678 as in
679 \begin{center}
680 \verb"\documentclass[answers]{exam}"
681 \end{center}
682 or
683 \begin{center}
684 \verb"\documentclass[answers,12pt]{exam}"
685 \end{center}
686 or
687 \begin{center}
688 \verb"\documentclass[12pt,addpoints,answers]{exam}"
689 \end{center}
690 Using the document class option \verb"answers" is equivalent to giving
691 the command \verb"\printanswers"\indc{printanswers} at the beginning
692 of the exam (see section~\ref{sec:solutions}). The effect of this is
693 that
694 \begin{itemize}
695 \item the contents of the environments
696 %
697 \index{solution environment@\texttt{solution} environment}%
698 %
699 \indt{solutionorbox}%
700 \indt{solutionorlines}\indt{solutionordottedlines}%
701 \indt{solutionorgrid}\indt{solutionbox}
702 \begin{center}
703 \begin{tabular}{l}
704 \verb"solution",\\
705 \verb"solutionorbox",\\
706 \verb"solutionorlines",\\
707 \verb"solutionordottedlines",\\
708 \verb"solutionorgrid", and\\
709 \verb"solutionbox"
710 \end{tabular}
711 \end{center}
712 (see section~\ref{sec:solutions}) will be printed,
713 \item any choices of a \texttt{choices}\indt{choices},
714 \texttt{oneparchoices}\indt{oneparchoices},
715 \texttt{checkboxes}\indt{checkboxes}, or
716 \texttt{oneparcheckboxes}\indt{oneparcheckboxes} environment (see
717 section~\ref{sec:MulChc}) that are created using a
718 \verb"\CorrectChoice"\indc{CorrectChoice} command (see
719 section~\ref{sec:CorrectChoice}) instead of a
720 \verb"\choice"\indc{choice} command will be printed with emphasis as
721 determined by the argument of the most recent
722 \verb"\CorrectChoiceEmphasis"\indc{CorrectChoiceEmphasis} command
723 (which by default is \verb"\bfseries"), and
724 \item any \verb"\answerline"\indc{answerline} commands (see
725 section~\ref{sec:ShortAns})\indcsub{answerline}{optional~argument}
726 that include an optional argument containing the answer (see
727 section~\ref{sec:AnsShortAns}) will have the answer printed on the
728 answer line.
729 \end{itemize}
730
731
732 %---------------------------------------------------------------------
733 %--------------------------------------------------------------------
734 \section{Questions and points}
735 \label{sec:QuestionsPoints}
736
737 To create questions, you use a \verb"questions"\indt{questions}
738 %
739 environment\index{questions environment}\index{environment!questions}
740 (see section~\ref{sec:Questions}); each question is begun with a
741 \verb"\question"\indc{question} command, which takes an optional
742 argument to assign some number of points\index{points} to the question
743 (see section~\ref{sec:points}). The questions are numbered
744 automatically. Point values can include half points (see
745 section~\ref{sec:Half}).
746
747 If you want a question to have several parts, you use a
748 %
749 \verb"parts"\indt{parts}%
750 \index{parts environment}\index{environment!parts} environment (see
751 section~\ref{sec:parts}); each part is begun with a
752 \verb"\part"\indc{part} command, which takes an optional argument to
753 assign some number of points to the part (see
754 section~\ref{sec:points}). The parts are numbered automatically.
755 Similarly, parts can have subparts, and subparts can have subsubparts
756 (see section~\ref{sec:parts}).
757
758 The points for a question (or part, or subpart, or subsubpart) appear
759 by default at the beginning of the question (or part, etc.), but there
760 are commands to have the points appear instead in either the left
761 margin or in the right margin (see section~\ref{sec:whereprint} and
762 section~\ref{sec:DrpPts}). The formatting of the points can also be
763 customized (see sections \ref{sec:Boxed}, \ref{sec:pointname},
764 \ref{sec:margins}, and~\ref{sec:pointformat}). It's also possible to
765 have questions (or parts, etc.) that are worth ``bonus points'', which
766 are added up separately from the non-bonus points (see
767 section~\ref{sec:Bonus}).
768
769
770 %--------------------------------------------------------------------
771 \subsection{Questions}
772 \label{sec:Questions}
773
774 To type the questions on the exam you use the
775 %
776 \verb"questions"\indt{questions}\index{questions environment}%
777 \index{environment!questions} environment. Each question is then
778 begun with the command \verb"\question"\indc{question}, and the
779 questions are numbered automatically.
780
781 For example, if you type
782 \begin{verbatim}
783 \begin{questions}
784
785 \question
786 Why is there air?
787
788 \question
789
790 How much wood would a woodchuck chuck if a woodchuck could chuck
791 wood?
792
793 \question Compute $\displaystyle\int_0^1 x^2 \, dx$.
794 \end{questions}
795 \end{verbatim}
796 then you'll get
797 \begin{questions}
798
799 \question
800 Why is there air?
801
802 \question
803
804 How much wood would a woodchuck chuck if a woodchuck could chuck
805 wood?
806
807 \question Compute $\displaystyle\int_0^1 x^2 \, dx$.
808 \end{questions}
809
810 \bigskip
811
812 As the above example illustrates, you can leave blank lines
813 %
814 \index{blank lines} between the \verb"\question" command and the
815 actual beginning of the question, or before the first \verb"\question"
816 command in the environment, and they will be ignored.
817
818
819 %---------------------------------------------------------------------
820 \subsection{Questions with parts and subparts (and subsubparts)}
821 \label{sec:parts}
822
823 If you want a question to have several parts, then you use the
824 %
825 \verb"parts"\indt{parts}\index{parts environment}%
826 \index{environment!parts} environment. For example, if you type
827 \begin{verbatim}
828 \begin{questions}
829 \question
830 Why is there air?
831
832 \question
833 What if there were no air?
834
835 \begin{parts}
836 \part
837 Describe the effect on the balloon industry.
838
839 \part
840 Describe the effect on the aircraft industry.
841 \end{parts}
842
843 \question
844
845 \begin{parts}
846 \part
847 Define the universe. Give three examples.
848
849 \part
850 If the universe were to end, how would you know?
851
852 \end{parts}
853
854
855 \end{questions}
856 \end{verbatim}
857 then you'll get
858 \begin{questions}
859 \question
860 Why is there air?
861
862 \question
863 What if there were no air?
864
865 \begin{parts}
866 \part
867 Describe the effect on the balloon industry.
868
869 \part
870 Describe the effect on the aircraft industry.
871 \end{parts}
872
873 \question
874
875 \begin{parts}
876 \part
877 Define the universe. Give three examples.
878
879 \part
880 If the universe were to end, how would you know?
881
882 \end{parts}
883
884
885 \end{questions}
886
887 \bigskip
888
889 The above example illustrates several things:
890 \begin{itemize}
891 \item Parts of a question should be put into a
892 \verb"parts"\indt{parts}\index{parts environment}%
893 \index{environment!parts} environment.
894 \item If a question begins with a \verb"parts" environment, then the
895 first part will appear on the same line with the question number.
896 \item You can leave blank
897 %
898 lines\index{blank lines} before and after the \verb"\part" command,
899 and they will be ignored.
900 \end{itemize}
901
902 \bigskip
903
904 There is also a \verb"subparts"\indt{subparts}%
905 \index{subparts environment}\index{environment!subparts} environment,
906 and even a \verb"subsubparts"\indt{subsubparts}%
907 \index{subsubparts environment}\index{environment!subsubparts}
908 environment, and they work just as you would expect. For example, if
909 you type\indc{subpart}\indc{subsubpart}
910 \begin{verbatim}
911 \begin{questions}
912 \question
913 \begin{parts}
914 \part
915 What do you do with a drunken sailor?
916
917 \part
918 Is your answer different if it is before noon?
919
920 \end{parts}
921
922 \question
923 This is the second question.
924
925 \begin{parts}
926 \part
927 This is a part.
928
929 \part
930 This is also a part.
931
932 \begin{subparts}
933 \subpart
934 This is a subpart.
935
936 \subpart
937 This is a periscope.
938
939 \subpart
940 This is a pair of diving planes.
941
942 \subpart
943 \begin{subsubparts}
944 \subsubpart
945 This is a subsubpart.
946
947 \subsubpart
948 The lower surface of a diving plane?
949
950 \subsubpart
951 The ocean floor, perhaps?
952
953 \end{subsubparts}
954 \end{subparts}
955
956 \part
957 It's sad to be apart.
958
959 \end{parts}
960
961 \question
962 \begin{parts}
963 \part
964 \begin{subparts}
965 \subpart
966 This is a subpart.
967
968 \subpart
969 This is another subpart.
970 \end{subparts}
971 \part
972 This is another part.
973
974 \end{parts}
975
976
977 \end{questions}
978 \end{verbatim}
979 then you'll get
980 \begin{questions}
981 \question
982 \begin{parts}
983 \part
984 What do you do with a drunken sailor?
985
986 \part
987 Is your answer different if it is before noon?
988
989 \end{parts}
990
991 \question
992 This is the second question.
993
994 \begin{parts}
995 \part
996 This is a part.
997
998 \part
999 This is also a part.
1000
1001 \begin{subparts}
1002 \subpart
1003 This is a subpart.
1004
1005 \subpart
1006 This is a periscope.
1007
1008 \subpart
1009 This is a pair of diving planes.
1010
1011 \subpart
1012 \begin{subsubparts}
1013 \subsubpart
1014 This is a subsubpart.
1015
1016 \subsubpart
1017 The lower surface of a diving plane?
1018
1019 \subsubpart
1020 The ocean floor, perhaps?
1021
1022 \end{subsubparts}
1023 \end{subparts}
1024
1025 \part
1026 It's sad to be apart.
1027
1028 \end{parts}
1029
1030 \question
1031 \begin{parts}
1032 \part
1033 \begin{subparts}
1034 \subpart
1035 This is a subpart.
1036
1037 \subpart
1038 This is another subpart.
1039 \end{subparts}
1040 \part
1041 This is another part.
1042
1043 \end{parts}
1044
1045
1046 \end{questions}
1047
1048 The numbers and letters used to number questions, parts, subparts, and
1049 subsubparts can be customized; see section~\ref{sec:CustNumb}.
1050
1051 %---------------------------------------------------------------------
1052 \subsection{Point values for the questions}
1053 \label{sec:points}
1054 \indcsub{question}{optional argument}
1055 \indcsub{part}{optional argument}
1056 \indcsub{subpart}{optional argument}
1057 \indcsub{subsubpart}{optional argument}
1058 \index{points|(}
1059
1060 Each of the commands \verb"\question", \verb"\part", \verb"\subpart",
1061 and \verb"\subsubpart" takes an optional argument, which is the number
1062 of points for that question, part, subpart, or subsubpart. The
1063 default setup is that
1064 \begin{itemize}
1065 \item the point value is printed at the beginning of the question (or
1066 part, or subpart, or subsubpart) (this can be changed to printing in
1067 either the left or right margins on the first line of the question
1068 or in the right margin at the end of the question; see
1069 section~\ref{sec:whereprint} and section~\ref{sec:DrpPts}), and
1070 \item the point value is enclosed in parentheses (this can be changed
1071 to either square brackets or a box; see section~\ref{sec:Boxed}).
1072 \end{itemize}
1073 Both of these things can be further customized; see
1074 section~\ref{sec:qformat} and section~\ref{sec:pointformat}.
1075
1076 %--------------------------------------------------------------------
1077 \subsubsection{Where the points will be printed}
1078 \label{sec:whereprint}
1079 \index{points!where printed|(}
1080
1081 The default is that the point value will be inserted at the beginning
1082 of the question (or part, or subpart, or subsubpart) in parentheses,
1083 but
1084 \begin{itemize}
1085 \item the command \verb"\pointsinmargin"\indc{pointsinmargin} (or,
1086 equivalently, the command
1087 \verb"\pointsinleftmargin"\indc{pointsinleftmargin}) will cause the
1088 point values to be set in the left margin,
1089 \item the command
1090 \verb"\pointsinrightmargin"\indc{pointsinrightmargin} will cause the
1091 point values to be set in the right margin,
1092 \item the command
1093 \verb"\pointstwosided"\indc{pointstwosided} will cause the
1094 point values to be set
1095 \begin{itemize}
1096 \item in the right margin on odd numbered pages and
1097 \item in the left margin on even numbered pages,
1098 \end{itemize}
1099 \item the command
1100 \verb"\pointstwosidedreversed"\indc{pointstwosidedreversed} will
1101 cause the point values to be set
1102 \begin{itemize}
1103 \item in the left margin on odd numbered pages and
1104 \item in the right margin on even numbered pages, and
1105 \end{itemize}
1106 \item the commands \verb"\nopointsinmargin"\indc{nopointsinmargin} and
1107 \verb"\nopointsinrightmargin"\indc{nopointsinrightmargin} are
1108 equivalent, and either of them will revert to the default situation.
1109 \end{itemize}
1110 All of these print the point values on the first line of the question
1111 (or part, or subpart, or subsubpart). There is also a way to print
1112 the point values on the \emph{last} line of the question (or part,
1113 etc.); for this, see section~\ref{sec:DrpPts}.
1114
1115 \medbreak
1116
1117 For example, if you type
1118 \begin{verbatim}
1119 \begin{questions}
1120 \question[20]
1121 Why is there air?
1122
1123
1124 \question
1125 What if there were no air?
1126
1127 \begin{parts}
1128 \part[10]
1129 Describe the effect on the balloon industry.
1130
1131 \part[10]
1132 Describe the effect on the aircraft industry.
1133 \end{parts}
1134
1135 \end{questions}
1136 \end{verbatim}
1137 then, with the default setup, you'll get
1138 \nopointsinmargin
1139 \begin{questions}
1140 \question[20]
1141 Why is there air?
1142
1143
1144 \question
1145 What if there were no air?
1146
1147 \begin{parts}
1148 \part[10]
1149 Describe the effect on the balloon industry.
1150
1151 \part[10]
1152 Describe the effect on the aircraft industry.
1153 \end{parts}
1154
1155 \end{questions}
1156 (To change the word ``points'', see the commands described in
1157 section~\ref{sec:pointname}.)
1158
1159 \bigskip If you give the command
1160 \verb"\pointsinmargin"\indc{pointsinmargin} (or, equivalently,
1161 \verb"\pointsinleftmargin"\indc{pointsinleftmargin}), then the above input
1162 will produce instead \pointsinmargin
1163 \begin{questions}
1164 \question[20]
1165 Why is there air?
1166
1167
1168 \question
1169 What if there were no air?
1170
1171 \begin{parts}
1172 \part[10]
1173 Describe the effect on the balloon industry.
1174
1175 \part[10]
1176 Describe the effect on the aircraft industry.
1177 \end{parts}
1178
1179 \end{questions}
1180 (To have a word (e.g., ``points'', or ``\%'') inside the parentheses
1181 with the point values, see the
1182 \verb"\marginpointname"\indc{marginpointname} command in
1183 section~\ref{sec:pointname}.)
1184
1185
1186 \bigskip
1187
1188 If you give the command
1189 \verb"\pointsinrightmargin"\indc{pointsinrightmargin}, then the above
1190 input will produce instead
1191 %
1192 \pointsinrightmargin
1193 \begin{questions}
1194 \question[20]
1195 Why is there air?
1196
1197
1198 \question
1199 What if there were no air?
1200
1201 \begin{parts}
1202 \part[10]
1203 Describe the effect on the balloon industry.
1204
1205 \part[10]
1206 Describe the effect on the aircraft industry.
1207 \end{parts}
1208
1209 \end{questions}
1210
1211 %--------------------------------------------------------------------
1212 \subsubsection{Printing the points at the end of the question}
1213 \label{sec:DrpPts}
1214 \index{points!at the end of the question|(}
1215 \indcstart{pointsdroppedatright}
1216 \indcstart{droppoints}
1217
1218
1219 Instead of having the point value of a question (or part, or subpart,
1220 or subsubpart) printed on the first line of a question, you can have
1221 it printed in the right margin opposite the \emph{last} line, or even
1222 opposite a blank line following the paragraph. This is done with the
1223 \begin{center}
1224 \verb"\pointsdroppedatright"
1225 \quad and \quad
1226 \verb"\droppoints"
1227 \end{center}
1228 commands.
1229
1230 If you give the command
1231 \begin{center}
1232 \verb"\pointsdroppedatright"
1233 \end{center}
1234 then point values are not printed until you give the command
1235 \verb"\droppoints" (and they're not printed at all if you don't give
1236 the command \verb"\droppoints"). The only exception to this rule is
1237 that if you've given a \verb"\qformat"\indc{qformat} command (see
1238 section~\ref{sec:qformat}), then question number lines are printed as
1239 specified by the argument to the \verb"\qformat" command even if you
1240 have given the command
1241 \verb"\pointsdroppedatright"
1242
1243 The command \verb"\droppoints" should be given only at the end of a
1244 paragraph or between paragraphs; if you give it within a paragraph, it
1245 causes the paragraph to end. \verb"\droppoints" prints the point
1246 value in the right margin, formatted as it is when you give the
1247 command \verb"\pointsinrightmargin"\indc{pointsinrightmargin}, except
1248 that the points appear opposite the last line of the paragraph (or, if
1249 the command \verb"\droppoints" is given between paragraphs, then
1250 additional vertical space is left between the paragraphs and the
1251 points are printed opposite the blank space). The formatting can be
1252 changed by giving the commands
1253 \verb"\bracketedpoints"\indc{bracketedpoints},
1254 \verb"\boxedpoints"\indc{boxedpoints}, or
1255 \verb"\marginpointname"\indc{marginpointname} (see
1256 section~\ref{sec:pointname}) just as if \verb"\pointsinrightmargin"
1257 were in effect. The command \verb"\droppoints" actually works this
1258 way even if one of the commands
1259 \begin{center}
1260 \verb"\nopointsinmargin",\quad \verb"\pointsinmargin",\quad or\quad
1261 \verb"\pointsinrightmargin"
1262 \end{center}
1263 is in effect, but if you use it that way the points will appear twice
1264 on the page, which is probably not what you want.
1265
1266
1267 For example, if you give the command \verb"\pointsdroppedatright" and
1268 then type
1269 \begin{verbatim}
1270 \begin{questions}
1271 \question[10]
1272 Describe the implications of the Michelson-Morley ink drop experiment
1273 for the use of punctuation marks such as colons and semicolons that
1274 require multiple drops of ink.
1275 \droppoints
1276
1277 \question[10]
1278 Prove that the second dual of a finite dimensional real vector space
1279 is naturally isomorphic to the given vector space, except when the
1280 weapon chosen is a single shot pistol.\droppoints
1281
1282 \end{questions}
1283 \end{verbatim}
1284 then you'll get
1285 \pointsdroppedatright
1286 \begin{questions}
1287 \question[10]
1288 Describe the implications of the Michelson-Morley ink drop experiment
1289 for the use of punctuation marks such as colons and semicolons that
1290 require multiple drops of ink.
1291 \droppoints
1292
1293 \question[10]
1294 Prove that the second dual of a finite dimensional real vector space
1295 is naturally isomorphic to the given vector space, except when the
1296 weapon chosen is a single shot pistol.\droppoints
1297
1298 \end{questions}
1299 and if you type
1300 \begin{verbatim}
1301 \begin{questions}
1302 \question[10]
1303 Describe the implications of the Michelson-Morley ink drop experiment
1304 for the use of punctuation marks such as colons and semicolons that
1305 require multiple drops of ink.
1306
1307 \droppoints
1308
1309 \question[10]
1310 Prove that the second dual of a finite dimensional real vector space
1311 is naturally isomorphic to the given vector space, except when the
1312 weapon chosen is a single shot pistol.
1313
1314 \droppoints
1315 \end{questions}
1316 \end{verbatim}
1317 then you'll get
1318 \begin{questions}
1319 \question[10]
1320 Describe the implications of the Michelson-Morley ink drop experiment
1321 for the use of punctuation marks such as colons and semicolons that
1322 require multiple drops of ink.
1323
1324 \droppoints
1325
1326 \question[10]
1327 Prove that the second dual of a finite dimensional real vector space
1328 is naturally isomorphic to the given vector space, except when the
1329 weapon chosen is a single shot pistol.
1330
1331 \droppoints
1332 \end{questions}
1333 \nopointsinmargin
1334
1335 \indcstop{droppoints}
1336 \indcstop{pointsdroppedatright}
1337 \index{points!at the end of the question|)}
1338 \index{points!where printed|)}
1339
1340 %--------------------------------------------------------------------
1341 \subsubsection{Half points}
1342 \label{sec:Half}
1343 \index{points!half|(}
1344 \index{half points|(}
1345
1346 The point values of questions, parts, subparts, and subsubparts can
1347 include half points. To specify half points, you either
1348 type\indc{half}
1349 \begin{center}
1350 \verb"\half"
1351 \end{center}
1352 immediately following the integer part of the point value or just type
1353 \verb"\half" as the entire point value. That is, the valid point
1354 values and their (default) printed appearances are:\indc{half}
1355 \begin{center}
1356 \begin{tabular}{@{\extracolsep{0.1in}}rccccccc}
1357 Typed:& \verb"0"& \verb"\half"& \verb"1"& \verb"1\half"& \verb"2"&
1358 \verb"2\half"& $\cdots$\\[1ex]
1359 Printed:& 0& \half& 1& 1\half& 2& 2\half& $\cdots$
1360 \end{tabular}
1361 \end{center}
1362 If you prefer, you can cause the fraction \half{} to be printed as
1363 \makeatletter
1364 \horiz@half.
1365 \makeatother
1366 To do this, you give the
1367 command\indc{usehorizontalhalf}%
1368 \index{customization!\texttt{\char`\\half}}%
1369 \indcsub{half}{customization}
1370 \begin{center}
1371 \verb"\usehorizontalhalf"
1372 \end{center}
1373 after which the printed appearance of point values will be
1374 \usehorizontalhalf
1375 \begin{center}
1376 \begin{tabular}{@{\extracolsep{0.1in}}rccccccc}
1377 Typed:& \verb"0"& \verb"\half"& \verb"1"& \verb"1\half"& \verb"2"&
1378 \verb"2\half"& $\cdots$\\[1ex]
1379 Printed:& 0& \half& 1& 1\half& 2& 2\half& $\cdots$
1380 \end{tabular}
1381 \end{center}
1382 If you want to return to using the default appearance, you can do that
1383 by giving the command\indc{useslantedhalf}
1384 \begin{center}
1385 \verb"\useslantedhalf"
1386 \end{center}
1387 \useslantedhalf
1388
1389 \index{half points|)}
1390 \index{points!half|)}
1391
1392
1393 %--------------------------------------------------------------------
1394 \subsubsection{Surrounding the points: Parentheses, brackets, or a box}
1395 \label{sec:Boxed}
1396 \index{customization!points|(}
1397 \index{points!customization|(}
1398
1399 If you prefer having the points enclosed in brackets instead of in
1400 parentheses, give the command\indc{bracketedpoints}
1401 \begin{center}
1402 \verb"\bracketedpoints"
1403 \end{center}
1404 For example, if you give the command \verb"\bracketedpoints", then the
1405 questions typed above will produce
1406 \nopointsinmargin
1407 \bracketedpoints
1408 \begin{questions}
1409 \question[20]
1410 Why is there air?
1411
1412
1413 \question
1414 What if there were no air?
1415
1416 \begin{parts}
1417 \part[10]
1418 Describe the effect on the balloon industry.
1419
1420 \part[10]
1421 Describe the effect on the aircraft industry.
1422 \end{parts}
1423
1424 \end{questions}
1425
1426
1427 If you prefer having the points enclosed in a box instead of in
1428 parentheses, give the command\indc{boxedpoints}
1429 \begin{center}
1430 \verb"\boxedpoints"
1431 \end{center}
1432 For example, if you give the command \verb"\boxedpoints", then the
1433 questions typed above will produce
1434 \nopointsinmargin
1435 \boxedpoints
1436 \begin{questions}
1437 \question[20]
1438 Why is there air?
1439
1440
1441 \question
1442 What if there were no air?
1443
1444 \begin{parts}
1445 \part[10]
1446 Describe the effect on the balloon industry.
1447
1448 \part[10]
1449 Describe the effect on the aircraft industry.
1450 \end{parts}
1451
1452 \end{questions}
1453 If you give the commands \verb"\boxedpoints"\indc{boxedpoints} and
1454 \verb"\pointsinmargin"\indc{pointsinmargin}, then the above questions
1455 will produce
1456 %
1457 \boxedpoints \pointsinmargin
1458 \begin{questions}
1459 \question[20]
1460 Why is there air?
1461
1462
1463 \question
1464 What if there were no air?
1465
1466 \begin{parts}
1467 \part[10]
1468 Describe the effect on the balloon industry.
1469
1470 \part[10]
1471 Describe the effect on the aircraft industry.
1472 \end{parts}
1473
1474 \end{questions}
1475 If you give the commands \verb"\bracketedpoints"\indc{bracketedpoints}
1476 and \verb"\pointsinrightmargin"\indc{pointsinrightmargin}, then the
1477 above questions will produce
1478 %
1479 \bracketedpoints
1480 \pointsinrightmargin
1481 \begin{questions}
1482 \question[20]
1483 Why is there air?
1484
1485
1486 \question
1487 What if there were no air?
1488
1489 \begin{parts}
1490 \part[10]
1491 Describe the effect on the balloon industry.
1492
1493 \part[10]
1494 Describe the effect on the aircraft industry.
1495 \end{parts}
1496
1497 \end{questions}
1498 Other combinations of these commands will produce similar effects.
1499
1500 If you want to switch back and forth between formats during the exam,
1501 you can do so by giving one of the
1502 commands\indc{boxedpoints}\indc{bracketedpoints}\indc{noboxedpoints}
1503 \indc{nobracketedpoints}
1504 \begin{center}
1505 \begin{tabular}{l}
1506 \verb"\boxedpoints"\\
1507 \verb"\bracketedpoints"\\
1508 \verb"\noboxedpoints"\\
1509 \verb"\nobracketedpoints"
1510 \end{tabular}
1511 \end{center}
1512 whenever you want to switch. (The commands
1513 \verb"\nobracketedpoints" and \verb"\noboxedpoints" are equivalent;
1514 they both return to the default of putting parentheses around the
1515 points.)
1516
1517 If you want some text (e.g., `` points'', or ``\%'') automatically
1518 inserted along with the point values when using either
1519 \verb"\pointsinmargin", \verb"\pointsinrightmargin",
1520 \verb"\pointstwosided", or \verb"\pointstwosidedreversed", see the
1521 command \verb"\marginpointname" in section~\ref{sec:pointname}.
1522
1523
1524
1525 %---------------------------------------------------------------------
1526 \subsubsection{Using a substitute for the word ``points''}
1527 \label{sec:pointname}
1528 \index{points!substitute words|(}
1529 \index{points!language|(}
1530
1531 With the default setup, the number of points is inserted before the
1532 text of the question followed by a single space and the word ``point''
1533 if the number of points is either \half{} or 1 and by the word
1534 ``points'' otherwise. That is, the default is
1535 \verb"\nopointsinmargin"\indc{nopointsinmargin} and
1536 \verb"\noboxedpoints"\indc{noboxedpoints} (see sections
1537 \ref{sec:whereprint} and \ref{sec:Boxed}), and if you type
1538 %
1539 \nopointsinmargin
1540 \noboxedpoints
1541 \begin{verbatim}
1542 \begin{questions}
1543 \question[1]
1544 This is a short question.
1545
1546 \question[5]
1547 This is a longer question, requiring more thought.
1548 \end{questions}
1549 \end{verbatim}
1550 then you'll get
1551 \begin{questions}
1552 \question[1]
1553 This is a short question.
1554
1555 \question[5]
1556 This is a longer question, requiring more thought.
1557 \end{questions}
1558 The way this is achieved is:
1559 \begin{itemize}
1560 \item There is a command\indc{points}
1561 \begin{center}
1562 \verb"\points"
1563 \end{center}
1564 whose default definition expands to the word `point' if the number
1565 of points is either \half{} or 1 and to `points' otherwise. (This
1566 behavior can be modified by the command
1567 \verb"\pointpoints"\indc{pointpoints}; see below.)
1568 \item There is a command\indc{pointname}
1569 \begin{center}
1570 \verb"\pointname{Text}"
1571 \end{center}
1572 that causes `Text' to be inserted following the number of points of
1573 a question, part, subpart, or subsubpart. The default setup is the
1574 result of the command\indc{pointname}\indc{points}
1575 \begin{center}
1576 \verb"\pointname{ \points}"
1577 \end{center}
1578 (Note the single space before the command \verb"\points".)
1579 \end{itemize}
1580
1581 There is also a command\indc{pointpoints}
1582 \begin{center}
1583 \verb"\pointpoints{SingularText}{PluralText}"
1584 \end{center}
1585 that changes the behavior of the \verb"\points" command so that it
1586 expands to `SingularText' if the number of points is \half{} or 1 and
1587 to `PluralText' otherwise. (The default is the result of the command
1588 \verb"\pointpoints{point}{points}"\indc{pointpoints}.) Thus, if you
1589 give the command
1590 \begin{center}
1591 \verb"\pointpoints{Punkt}{Punkte}"
1592 \end{center}
1593 then typing the questions above would result in
1594 \pointpoints{Punkt}{Punkte}
1595 \begin{questions}
1596 \question[1]
1597 This is a short question.
1598
1599 \question[5]
1600 This is a longer question, requiring more thought.
1601 \end{questions}
1602 There is also a command\indc{marksnotpoints}\index{marks}
1603 \begin{center}
1604 \verb"\marksnotpoints"
1605 \end{center}
1606 that is equivalent to the two
1607 commands\indc{pointpoints}\indc{bonuspointpoints}\index{marks}
1608 \begin{center}
1609 \begin{tabular}{l}
1610 \verb"\pointpoints{mark}{marks}"\\
1611 \verb"\bonuspointpoints{mark (bonus)}{marks (bonus)}"
1612 \end{tabular}
1613 \end{center}
1614 (the command \verb"\bonuspointpoints" is described in
1615 section~\ref{sec:Bonus}). That command would cause the above
1616 questions to be printed as
1617 %
1618 \pointpoints{mark}{marks}
1619 \begin{questions}
1620 \question[1]
1621 This is a short question.
1622
1623 \question[5]
1624 This is a longer question, requiring more thought.
1625 \end{questions}
1626
1627 \bigskip
1628
1629 For another example, if you give the command\indc{pointname}
1630 \begin{center}
1631 \verb"\pointname{\%}"
1632 \end{center}
1633 then the above questions would be printed as
1634 %
1635 \pointname{\%}
1636 \nopointsinmargin
1637 \noboxedpoints
1638 \begin{questions}
1639 \question[1]
1640 This is a short question.
1641
1642 \question[5]
1643 This is a longer question, requiring more thought.
1644 \end{questions}
1645 \pointname{ \points}
1646
1647
1648 \subsubsection*{Using \texttt{\char`\\marginpointname}}
1649
1650 Similarly, the command \verb"\marginpointname"\indc{marginpointname}
1651 can be used to affect the text set with the number of points when
1652 \verb"\pointsinmargin"\indc{pointsinmargin} or
1653 \verb"\pointsinrightmargin"\indc{pointsinrightmargin} is in effect.
1654 For example, if you give the commands
1655 \begin{center}
1656 \begin{tabular}{l}
1657 \verb"\pointsinmargin"\\
1658 \verb"\marginpointname{\%}"
1659 \end{tabular}
1660 \end{center}
1661 and then type
1662 \begin{verbatim}
1663 \question[25]
1664 Where, oh where, has my little dog gone?
1665 \end{verbatim}
1666 then you'll get
1667 \pointsinmargin
1668 \noboxedpoints
1669 \marginpointname{\%}
1670 \begin{questions}
1671 \question[25]
1672 Where, oh where, has my little dog gone?
1673 \end{questions}
1674 unless, e.g., you've also given the command
1675 \verb"\boxedpoints"\indc{boxedpoints} (see section~\ref{sec:Boxed}),
1676 in which case you'll get
1677 %
1678 \pointsinmargin
1679 \boxedpoints
1680 \marginpointname{\%}
1681 \begin{questions}
1682 \question[25]
1683 Where, oh where, has my little dog gone?
1684 \end{questions}
1685 If you give the commands
1686 \begin{center}
1687 \begin{tabular}{l}
1688 \verb"\marksnotpoints"\\
1689 \verb"\marginpointname{ \points}"
1690 \end{tabular}
1691 \end{center}
1692 then the above will print
1693 \noboxedpoints
1694 \marginpointname{ \points}
1695 \marksnotpoints
1696 \begin{questions}
1697 \question[25]
1698 Where, oh where, has my little dog gone?
1699 \end{questions}
1700 \nopointsinmargin
1701 \marginpointname{}
1702 \pointpoints{point}{points}
1703 \bonuspointpoints{point (bonus)}{points (bonus)}
1704
1705 Using the default is equivalent to giving the
1706 command\indc{marginpointname}
1707 \begin{center}
1708 \verb"\marginpointname{}"
1709 \end{center}
1710
1711
1712 %--------------------------------------------------------------------
1713 \subsubsection{Using \texttt{\bs marginpointname} and enlarging the
1714 margins}
1715 \label{sec:margins}
1716
1717 The default margins are not very large, and so if you use
1718 \verb"\marginpointname"\indc{marginpointname} (see
1719 section~\ref{sec:pointname}) to place any words along with the point
1720 values in the margin, you may run out of room. The solution to this
1721 problem is to enlarge the margins\index{margins!enlarge} by using the
1722 \verb"\extrawidth"\indc{extrawidth} command with a negative argument
1723 to \emph{decrease} the width of the text area, and thus
1724 \emph{increase} the width of the margins. For example, the commands
1725 \begin{center}
1726 \begin{tabular}{ll}
1727 \verb"\extrawidth{-1in}"\\
1728 \verb"\marginpointname{ \points}"
1729 \end{tabular}
1730 \end{center}
1731 will increase each of the left and right margins by one half inch,
1732 which will easily leave room for the word ``points''. (See
1733 section~\ref{sec:pagesize} for a discussion of the \verb"\extrawidth"
1734 command.)
1735
1736 %--------------------------------------------------------------------
1737 \subsubsection{Completely customizing the points}
1738 \label{sec:pointformat}
1739
1740 If the customizations described in section~\ref{sec:Boxed} and
1741 section~\ref{sec:pointname} (using \verb"\bracketedpoints",
1742 \verb"\boxedpoints", \verb"\pointpoints", \verb"\pointname", and
1743 \verb"\marginpointname") aren't sufficient, and you don't want to use
1744 the \verb"\qformat" command to create a customized question number
1745 line (see section~\ref{sec:qformat}), you can completely customize the
1746 way the points are printed by using the
1747 commands\indc{pointformat}\indc{bonuspointformat}
1748 \begin{center}
1749 \begin{tabular}{l}
1750 \verb"\pointformat"\\
1751 \verb"\bonuspointformat"
1752 \end{tabular}
1753 \end{center}
1754 The \verb"\pointformat" command controls the printing of ``regular''
1755 points (i.e., non-bonus points) and the \verb"\bonuspointformat"
1756 command controls the printing of bonus points (see
1757 section~\ref{sec:Bonus}).
1758
1759 Each of the commands \verb"\pointformat" and \verb"\bonuspointformat"
1760 takes one argument, and that argument is what actually appears on the
1761 page whether the points are being printed at the beginning of the
1762 question (the default), in the left margin (because of
1763 \verb"\pointsinmargin"), in the right margin (because of
1764 \verb"\pointsinrightmargin"), or dropped in the right margin at the
1765 end of the question (because of \verb"\pointsdroppedatright"). The
1766 arguments to \verb"\pointformat" and \verb"\bonuspointformat" should
1767 contain either the command\indc{thepoints}
1768 \begin{center}
1769 \verb"\thepoints"
1770 \end{center}
1771 (which for non-bonus points prints the number of points followed by
1772 the argument to the last \verb"\pointname"\indc{pointname} command and
1773 for bonus points prints the number of bonus points followed by the
1774 argument to the last \verb"\bonuspointname"\indc{bonuspointname}
1775 command; see section~\ref{sec:pointname}) or the
1776 command\indc{themarginpoints}
1777 \begin{center}
1778 \verb"\themarginpoints"
1779 \end{center}
1780 (which for non-bonus points prints the number of points followed by
1781 the argument to the last \verb"\marginpointname"\indc{marginpointname}
1782 command and for bonus points prints the number of bonus points
1783 followed by the argument to the last
1784 \verb"\marginbonuspointname"\indc{marginbonuspointname} command; see
1785 section~\ref{sec:pointname}). If the argument doesn't contain either
1786 \verb"\thepoints" or \verb"\themarginpoints", then the number of
1787 points will not appear.
1788
1789 For example, the command \verb"\bracketedpoints" is equivalent to
1790 either\indc{bracketedpoints}\indc{pointformat}%
1791 \indc{bonuspointformat}\indc{thepoints}
1792 \begin{center}
1793 \begin{tabular}{l}
1794 \verb"\pointformat{[\thepoints]}"\\
1795 \verb"\bonuspointformat{[\thepoints]}"
1796 \end{tabular}
1797 \end{center}
1798 if the points are being printed at the beginning of the question, or
1799 \indc{pointformat}\indc{bonuspointformat}\indc{themarginpoints}
1800 \begin{center}
1801 \begin{tabular}{l}
1802 \verb"\pointformat{[\themarginpoints]}"\\
1803 \verb"\bonuspointformat{[\themarginpoints]}"
1804 \end{tabular}
1805 \end{center}
1806 if the points are being printed in one of the margins.
1807
1808 For another example, the command \verb"\boxedpoints" is equivalent to
1809 either\indc{pointformat}\indc{bonuspointformat}\indc{thepoints}
1810 \begin{center}
1811 \begin{tabular}{l}
1812 \verb"\pointformat{\fbox{\thepoints}}"\\
1813 \verb"\bonuspointformat{\fbox{\thepoints}}"
1814 \end{tabular}
1815 \end{center}
1816 if the points are being printed at the beginning of the question, or
1817 \indc{pointformat}\indc{bonuspointformat}\indc{themarginpoints}
1818 \begin{center}
1819 \begin{tabular}{l}
1820 \verb"\pointformat{\fbox{\themarginpoints}}"\\
1821 \verb"\bonuspointformat{\fbox{\themarginpoints}}"
1822 \end{tabular}
1823 \end{center}
1824 if the points are being printed in one of the margins.
1825
1826 For another example, the
1827 commands\indc{marginpointname}\indc{pointsinmargin}\indc{pointformat}%
1828 \indc{pointsinmargin}
1829 \begin{verbatim}
1830 \begin{questions}
1831 \pointsinmargin
1832 \marginpointname{\%}
1833 \pointformat{\slshape (\themarginpoints)}
1834 \question[3] What is the point?
1835 \end{questions}
1836 \end{verbatim}
1837 will produce
1838 \begin{questions}
1839 \pointsinmargin
1840 \marginpointname{\%}
1841 \pointformat{\slshape (\themarginpoints)}
1842 \question[3] What is the point?
1843 \end{questions}
1844
1845 For another example, the
1846 commands\indc{marginpointname}\indc{pointsinmargin}\indc{pointformat}%
1847 \indc{pointsinrightmargin}
1848 \begin{verbatim}
1849 \begin{questions}
1850 \pointsinrightmargin
1851 \marginpointname{\%}
1852 \pointformat{\fbox{\bfseries\boldmath\themarginpoints}}
1853 \question[3\half] What is the point?
1854 \end{questions}
1855 \end{verbatim}
1856 will produce
1857 \begin{questions}
1858 \pointsinrightmargin
1859 \marginpointname{\%}
1860 \pointformat{\fbox{\bfseries\boldmath\themarginpoints}}
1861 \question[3\half] What is the point?
1862 \end{questions}
1863 \nopointsinmargin (Note: The commands \verb"\bfseries" and
1864 \verb"\boldmath"\indc{boldmath} are both needed here because the
1865 \half{} printed when you use half points is printed in math mode while
1866 the rest of the points are printed in text mode.)
1867
1868 For another example, the commands\indc{pointformat}\indc{boldmath}
1869 \begin{verbatim}
1870 \begin{questions}
1871 \pointname{}
1872 \pointformat{\bfseries\boldmath(Points for this problem: \thepoints)}
1873 \question[3\half] What is the point?
1874 \end{questions}
1875 \end{verbatim}
1876 will produce
1877 \begin{questions}
1878 \pointname{}
1879 \pointformat{\bfseries\boldmath(Points for this problem: \thepoints)}
1880 \question[3\half] What is the point?
1881 \end{questions}
1882 % Put things back to the default situation, so we don't mess up
1883 % later examples:
1884 \noboxedpoints
1885 \nopointsinmargin
1886 \pointname{ \points}
1887
1888 \index{points!language|)}
1889 \index{points!substitute words|)}
1890 \index{points!customization|)}
1891 \index{customization!points|)}
1892
1893 %---------------------------------------------------------------------
1894 \subsubsection{Questions that begin with a parts environment}
1895 \index{questions!that begin with a parts environment}
1896 \index{points!for both question and part}
1897
1898 If a question begins with a parts environment, then the question
1899 number and the number of the first part in the parts environment will
1900 be printed on the same line (see section~\ref{sec:parts}). Thus, if
1901 points are assigned to both the question and to the first part, both
1902 of those point values will be printed on the same line. (Note: This
1903 was not true in versions of the \verb"exam" document class earlier
1904 than 2.3. In those versions, only the later of the two point values
1905 would actually be printed.) If \verb"\pointsinmargin" or
1906 \verb"\pointsinrightmargin" are in effect (see
1907 section~\ref{sec:whereprint}), then the two point values will be
1908 printed on top of each other, which is probably not what you want.
1909 The same problem arises if a part begins with a subparts environment
1910 or if a subpart begins with a subsubparts environment.
1911
1912 If you want to assign points to both a question and to each part of a
1913 parts environment, and if the first part will begin on the same line
1914 as the question, the solution is to either use the default location
1915 (i.e., \verb"\nopointsinmargin") or to put some of the points in the
1916 margin and others not. For example, if you type
1917 \begin{verbatim}
1918 \begin{questions}
1919 \pointsinmargin
1920 \noaddpoints
1921 \question[10]
1922 \begin{parts}
1923 \nopointsinmargin
1924 \addpoints
1925 \part[5] Who put the ``bop'' in the ``bop, sh-bop, sh-bop''?
1926 \part[5] Who put the ``ram'' in the ``rama, rama ding-dong''?
1927 \end{parts}
1928 \end{questions}
1929 \end{verbatim}
1930 then you'll get
1931 \begin{questions}
1932 \pointsinmargin
1933 \noaddpoints
1934 \question[10]
1935 \begin{parts}
1936 \nopointsinmargin
1937 \addpoints
1938 \part[5] Who put the ``bop'' in the ``bop, sh-bop, sh-bop''?
1939 \part[5] Who put the ``ram'' in the ``rama, rama ding-dong''?
1940 \end{parts}
1941 \end{questions}
1942
1943
1944
1945
1946 %--------------------------------------------------------------------
1947 \subsubsection{Adding up the points for a question}
1948 \label{sec:addup}
1949 \indt{addpoints}
1950 \indc{addpoints}
1951
1952 If you use the document class option \verb"addpoints" (as in
1953 \verb"\documentclass[addpoints]{exam}") or give the command
1954 \verb"\addpoints" (see section~\ref{sec:addpoints}), then you can use
1955 the command\indc{droptotalpoints}
1956 \begin{center}
1957 \verb"\droptotalpoints"
1958 \end{center}
1959 to put into the right margin the total number of points for the
1960 current question (including the points for all parts, subparts, and
1961 subsubparts). (Section~\ref{sec:adding} describes a different way to
1962 print the total number of points for a question.) The command
1963 \verb"\droptotalpoints" should be used only at the end of a paragraph
1964 or between paragraphs; if you use it within a paragraph, it causes the
1965 paragraph to end. \verb"\droptotalpoints" prints the total points for
1966 the current question in the right margin, formatted by default as:
1967 %
1968 \par\nobreak\medskip
1969 \makeatletter
1970 \leavevmode\nobreak\hfill
1971 \rlap{%\hskip\rightmargin % Defined by the list environment
1972 \hskip\@rightmargin % Defined by exam.cls
1973 \hskip-\rightpointsmargin
1974 \llap{Total for Question 2: 25}%
1975 }% rlap
1976 \makeatother
1977 \par\medskip\noindent
1978 %
1979 (Note: The number of points is followed by the argument to the most
1980 recently executed \verb"\marginpointname"\indc{marginpointname}
1981 command (see section~\ref{sec:pointname}), which by default is empty.)
1982
1983 If the current question is worth any bonus points (see
1984 section~\ref{sec:Bonus}), then those bonus points will not be counted
1985 by the \verb"\droptotalpoints" command, but they will be counted by
1986 the\indc{droptotalbonuspoints}
1987 \begin{center}
1988 \verb"\droptotalbonuspoints"
1989 \end{center}
1990 command, which puts into the right margin the total number of bonus
1991 points for the current question, formatted by default as:
1992 \par\nobreak\medskip
1993 \makeatletter
1994 \leavevmode\nobreak\hfill
1995 \rlap{%\hskip\rightmargin % Defined by the list environment
1996 \hskip\@rightmargin % Defined by exam.cls
1997 \hskip-\rightpointsmargin
1998 \llap{Total for Question 2: 10 (bonus)}%
1999 }% rlap
2000 \makeatother
2001 \par\medskip\noindent
2002 (Note: The number of bonus points is followed by the argument to the
2003 most recently executed
2004 \verb"\marginbonuspointname"\indc{marginbonuspointname} command (see
2005 section~\ref{sec:Bonus}), which by default is `` (bonus)''.)
2006
2007 You can change the format used by the
2008 \verb"\droptotalpoints"\indc{droptotalpoints} command with
2009 the\indc{totalformat}
2010 \begin{center}
2011 \verb"\totalformat"
2012 \end{center}
2013 command. It takes one argument, and that argument becomes the command
2014 to print the total points, right justified a distance of
2015 \verb"\rightpointsmargin"\indc{rightpointsmargin} from the right edge
2016 of the paper. The argument can contain the
2017 command\indc{totalpoints}\indc{thequestion}
2018 \begin{center}
2019 \begin{tabular}{ll}
2020 \verb"\totalpoints"& to print the number of points, and\\
2021 \verb"\thequestion"& to print the question number.
2022 \end{tabular}
2023 \end{center}
2024 (\verb"\totalpoints" expands to
2025 \verb"\pointsofquestion{\arabic{question}}"\indc{pointsofquestion};
2026 see section~\ref{sec:pointsofq} for a discussion of the
2027 \verb"\pointsofquestion" command.) For example, if you give the
2028 command\indc{totalformat}\indc{thequestion}\indc{totalpoints}
2029 \begin{center}
2030 \verb"\totalformat{Question \thequestion: \totalpoints}"
2031 \end{center}
2032 then the total number of points will be printed in the format
2033 %
2034 \par\nobreak\medskip
2035 \makeatletter
2036 \leavevmode\nobreak\hfill
2037 \rlap{%\hskip\rightmargin % Defined by the list environment
2038 \hskip\@rightmargin % Defined by exam.cls
2039 \hskip-\rightpointsmargin
2040 \llap{Question 2: 25}%
2041 }% rlap
2042 \makeatother
2043 \par\medskip\noindent
2044 %
2045 and if you give the command\indc{totalformat}\indc{totalpoints}
2046 \begin{center}
2047 \verb"\totalformat{\fbox{Total: \totalpoints}}"
2048 \end{center}
2049 then the total number of points will be printed as
2050 %
2051 \par\nobreak\medskip
2052 \makeatletter
2053 \leavevmode\nobreak\hfill
2054 \rlap{%\hskip\rightmargin % Defined by the list environment
2055 \hskip\@rightmargin % Defined by exam.cls
2056 \hskip-\rightpointsmargin
2057 \llap{\fbox{Total: 25}}%
2058 }% rlap
2059 \makeatother
2060 \par\medskip\noindent
2061
2062 Thus, if you've given the
2063 commands\indc{addpoints}\indc{bracketedpoints}\indc{pointsdroppedatright}
2064 \begin{center}
2065 \begin{tabular}{l}
2066 \verb"\addpoints"\\
2067 \verb"\bracketedpoints"\\
2068 \verb"\pointsdroppedatright"
2069 \end{tabular}
2070 \end{center}
2071 and you type
2072 \begin{verbatim}
2073 \question
2074 \begin{parts}
2075 \part[10]
2076 In no more than one paragraph, explain why the earth is round.
2077 \droppoints
2078 \part[10]
2079 What changes to the van Allen radiation belt are needed to
2080 make the earth into a regular icosahedron?
2081 \droppoints
2082 \end{parts}
2083 \droptotalpoints
2084 \end{verbatim}
2085 then you'll get
2086 \addpoints
2087 \pointsdroppedatright
2088 \bracketedpoints
2089 \begin{questions}
2090 \question
2091 \begin{parts}
2092 \part[10]
2093 In no more than one paragraph, explain why the earth is round.
2094 \droppoints
2095 \part[10]
2096 What changes to the van Allen radiation belt are needed to
2097 make the earth into a regular icosahedron?
2098 \droppoints
2099 \end{parts}
2100 \leavevmode\unskip\nobreak\hfill
2101 \makeatletter
2102 \rlap{\hskip\rightmargin % Defined by the list environment
2103 \hskip\@rightmargin % Defined by exam.cls
2104 \hskip-\rightpointsmargin
2105 \llap{Total for Question 1: 20}%
2106 }% rlap
2107 \makeatother
2108 \par
2109 %\droptotalpoints
2110 \end{questions}
2111 \noaddpoints \nopointsinmargin \nobracketedpoints If you've also given
2112 the command\indc{totalformat}\indc{totalpoints}\indc{thequestion}
2113 \begin{center}
2114 \verb"\totalformat{Total for Question \thequestion: [\totalpoints]}"
2115 \end{center}
2116 then you'll get
2117 \addpoints
2118 \pointsdroppedatright
2119 \bracketedpoints
2120 \begin{questions}
2121 \question
2122 \begin{parts}
2123 \part[10]
2124 In no more than one paragraph, explain why the earth is round.
2125 \droppoints
2126 \part[10]
2127 What changes to the van Allen radiation belt are needed to
2128 make the earth into a regular icosahedron?
2129 \droppoints
2130 \end{parts}
2131 %\droptotalpoints
2132 \leavevmode\unskip\nobreak\hfill
2133 \makeatletter
2134 \rlap{\hskip\rightmargin % Defined by the list environment
2135 \hskip\@rightmargin % Defined by exam.cls
2136 \hskip-\rightpointsmargin
2137 \llap{Total for Question 1: [20]}%
2138 }% rlap
2139 \makeatother
2140 \par
2141 \end{questions}
2142 \noaddpoints
2143 \nopointsinmargin
2144 \nobracketedpoints
2145
2146 To change the format used by the
2147 \verb"\droptotalbonuspoints"\indc{droptotalbonuspoints} command, you
2148 use the command\indc{bonustotalformat}
2149 \begin{center}
2150 \verb"\bonustotalformat"
2151 \end{center}
2152 which is analogous to the \verb"\totalformat" command. The argument
2153 to \verb"\bonustotalformat" can contain the
2154 command\indc{totalbonuspoints}\indc{thequestion}
2155 \begin{center}
2156 \begin{tabular}{ll}
2157 \verb"\totalbonuspoints"& to print the number of bonus points, and\\
2158 \verb"\thequestion"& to print the question number.
2159 \end{tabular}
2160 \end{center}
2161 (\verb"\totalbonuspoints" expands to
2162 \verb"\bonuspointsofquestion{\arabic{question}}"; see
2163 section~\ref{sec:BonusTables} for a discussion of the
2164 \verb"\bonuspointsofquestion"\indc{bonuspointsofquestion} command.)
2165
2166 \index{points|)}
2167
2168 %--------------------------------------------------------------------
2169 \subsubsection{Margin sizes when using \texttt{\bs pointsinmargin} and
2170 \texttt{\bs pointsinrightmargin}}
2171 \index{margins!enlarge|(}
2172
2173 \begin{itemize}
2174 \item If you give the command
2175 \verb"\pointsinmargin"\indc{pointsinmargin}, then the points are
2176 printed right justified in the left margin, with the right edge a
2177 distance of \verb"\marginpointssep"\indc{marginpointssep} from the
2178 left edge of the text area. The default value of
2179 \verb"\marginpointssep" is the result of the command
2180 \begin{center}
2181 \verb"\setlength{\marginpointssep}{5pt}"
2182 \end{center}
2183 and you can change it by giving a new \verb"\setlength" command.
2184
2185 \item If you give the command
2186 \verb"\pointsinrightmargin"\indc{pointsinrightmargin}, then the
2187 points are printed right justified in the right margin, with the
2188 right edge a distance of
2189 \verb"\rightpointsmargin"\indc{rightpointsmargin} from the right
2190 edge of the paper. The default value of \verb"\rightpointsmargin"
2191 is the result of the command
2192 \begin{center}
2193 \verb"\setlength{\rightpointsmargin}{1cm}"
2194 \end{center}
2195 and you can change it by giving a new \verb"\setlength" command.
2196 \end{itemize}
2197
2198 You can change the width of the text area (and, thus, change the width
2199 of the margins) with the \verb"\extrawidth"\indc{extrawidth} command
2200 (see section~\ref{sec:margins}).
2201
2202 \index{margins!enlarge|)}
2203
2204 %--------------------------------------------------------------------
2205 \subsection{Custom question number lines: The \texttt{\bs qformat}
2206 command}
2207 \label{sec:qformat}
2208 \indc{qformat}
2209 \index{questions!customization|(}
2210
2211 The default setup is for the question number to appear in the left
2212 margin and for the text of the question to begin on that line. It's
2213 possible to change this so that the text of the question starts on the
2214 line following the question number, and the format of the line
2215 containing the question number is determined by the user. This is
2216 done using the \verb"\qformat" command. There is also a
2217 \verb"\noqformat"\indc{noqformat} command, which reverts to the
2218 default setup.
2219
2220 To use the \verb"\qformat"\indc{qformat} command, you give the command
2221 \begin{center}
2222 \verb"\qformat{Format specification}"
2223 \end{center}
2224 where \texttt{Format specification} must contain some stretchability
2225 (e.g., at least one \verb"\hfill" or \verb"\dotfill" or
2226 \verb"\hrulefill" or \ldots) and can contain the commands
2227 \begin{itemize}
2228 \item \verb"\thequestion"\indc{thequestion}, which expands to the
2229 question number,
2230 \item \verb"\thequestiontitle"\indc{thequestiontitle} (see
2231 section~\ref{sec:questiontitle}), which expands to
2232 \begin{itemize}
2233 \item the title of the question, if this question was defined using
2234 a \verb"\titledquestion"\indc{titledquestion} command (see
2235 section~\ref{sec:TitledQues}) instead of a \verb"\question"
2236 command, or
2237 \item the number of the question, if this question was defined using
2238 a \verb"\question" command,
2239 \end{itemize}
2240 \item \verb"\thepoints"\indc{thepoints}, which expands to
2241 \begin{itemize}
2242 \item the number of points followed by the argument to the last
2243 \verb"\pointname"\indc{pointname} command, if there were points
2244 specified for the question, or
2245 \item nothing, if no points were specified for the question
2246 \end{itemize}
2247 (see section~\ref{sec:pointname} for a discussion of the
2248 \verb"\pointname" command), and
2249 \item \verb"\totalpoints"\indc{totalpoints}, which expands to the
2250 total number of points specified for the question and all of its
2251 parts, subparts, and subsubparts (see section~\ref{sec:addup}). The
2252 command \verb"\totalpoints" expands to
2253 \verb"\pointsofquestion{\arabic{question}}"\indc{pointsofquestion}
2254 (see section~\ref{sec:pointsofq}).
2255 \end{itemize}
2256 For example, if you give the
2257 commands\indc{pointpoints}\indc{points}\indc{thepoints}\indc{thequestion}
2258 %
2259 \pointname{ \points}
2260 \pointpoints{point}{points}
2261 \begin{verbatim}
2262 \qformat{Question \thequestion \dotfill \thepoints}
2263 \begin{questions}
2264 \question[10]
2265 What did Billy Joe MacAllister throw off the Tallahatchie Bridge?
2266 \end{questions}
2267 \end{verbatim}
2268 then you'll get
2269 \qformat{Question \thequestion \dotfill \thepoints}
2270 \begin{questions}
2271 \question[10]
2272 What did Billy Joe MacAllister throw off the Tallahatchie Bridge?
2273 \end{questions}
2274 %
2275 \medskip
2276 If you instead use the command
2277 \begin{verbatim}
2278 \qformat{\textbf{Question \thequestion}\quad (\thepoints)\hfill}
2279 \end{verbatim}
2280 then you'll get
2281 \begin{questions}
2282 \qformat{\textbf{Question \thequestion}\quad (\thepoints)\hfill}
2283 \question[10]
2284 What did Billy Joe MacAllister throw off the Tallahatchie Bridge?
2285 \end{questions}
2286 %
2287 \medskip If you instead use the
2288 command\indc{qformat}\indc{thequestion}\indc{thepoints}
2289 \begin{verbatim}
2290 \qformat{\hfill Question \thequestion\hfill (\thepoints)}
2291 \end{verbatim}
2292 then you'll get
2293 \begin{questions}
2294 \qformat{\hfill Question \thequestion\hfill (\thepoints)}
2295 \question[10]
2296 What did Billy Joe MacAllister throw off the Tallahatchie Bridge?
2297 \end{questions}
2298 \noqformat
2299
2300 If you use a \verb"\qformat"\indc{qformat} (and, if there are any
2301 bonus questions, also a \verb"\bonusqformat"\indc{bonusqformat}; see
2302 section~\ref{sec:Bonus}), so that there are no labels on any of the
2303 questions, and you'd like to remove the
2304 indentation\index{indentation!remove} of the questions, you should
2305 give the command
2306 \begin{verbatim}
2307 \renewcommand{\questionshook}{%
2308 \setlength{\leftmargin}{0pt}%
2309 \setlength{\labelwidth}{-\labelsep}%
2310 }
2311 \end{verbatim}
2312 (see section~\ref{sec:CustList}) before the \texttt{questions}
2313 environment.
2314
2315 \index{questions!customization|)}
2316
2317 %--------------------------------------------------------------------
2318 \subsubsection{Adding up the points for a question}
2319 \label{sec:adding}
2320 \index{points!adding}
2321
2322 You can combine \verb"\qformat"\indc{qformat} with the
2323 \verb"\totalpoints"\indc{totalpoints} command (see
2324 section~\ref{sec:addup}): If you assign points only to parts,
2325 subparts, and subsubparts of questions, but none to the questions
2326 themselves, and you give the
2327 command\indc{thequestion}\indc{totalpoints}
2328 \begin{verbatim}
2329 \qformat{Question \thequestion\dotfill \emph{\totalpoints\ points}}
2330 \end{verbatim}
2331 (you must have used the document class option
2332 \verb"addpoints"\indt{addpoints} or given the command
2333 \verb"\addpoints"\indc{addpoints} in order to use the
2334 \verb"\totalpoints" command; see section~\ref{sec:addpoints}), then
2335 you can type
2336 \begin{verbatim}
2337 \begin{questions}
2338 \question
2339 \begin{parts}
2340 \part[10]
2341 In no more than one paragraph, explain why the earth is round.
2342 \part[10]
2343 What changes to the van Allen radiation belt are needed to make
2344 the earth into a regular icosahedron?
2345 \end{parts}
2346 \end{questions}
2347 \end{verbatim}
2348 and you'll get
2349 %
2350 \nopointsinmargin
2351 \qformat{Question \thequestion\dotfill \emph{20 points}}
2352 \begin{questions}
2353 \question
2354 \begin{parts}
2355 \part[10]
2356 In no more than one paragraph, explain why the earth is round.
2357 \part[10]
2358 What changes to the van Allen radiation belt are needed to make
2359 the earth into a regular icosahedron?
2360 \end{parts}
2361 \end{questions}
2362 \noqformat
2363
2364 For another method of printing the total points for a question, see
2365 the \verb"\droptotalpoints" command in section~\ref{sec:addup}.
2366
2367
2368 %--------------------------------------------------------------------
2369 \subsection{Titled questions}
2370 \label{sec:Titled}
2371
2372 The \verb"\titledquestion"\indc{titledquestion} command (see
2373 section~\ref{sec:TitledQues}) allows you to assign a \emph{title} to a
2374 question, and to have the question title replace the question number
2375 in a grading table or point table indexed by question number (see
2376 sections \ref{sec:GradeTables} and~\ref{sec:PointTables}). If you use
2377 a \verb"\qformat"\indc{qformat} (see section~\ref{sec:qformat}) then
2378 you can include the question title in the question by using the
2379 \verb"\thequestiontitle"\indc{thequestiontitle} command (see the
2380 example in section~\ref{sec:questiontitle}).
2381
2382
2383 %--------------------------------------------------------------------
2384 \subsubsection{\texttt{\bs titledquestion}}
2385 \label{sec:TitledQues}
2386
2387 The command \verb"\titledquestion"\indc{titledquestion} is a
2388 replacement for \verb"\question"\indc{question}; it takes one required
2389 argument, the title, and one optional argument, the point value, as in
2390 \begin{center}
2391 \verb"\titledquestion{Question \thequestion: Concepts}"
2392 \end{center}
2393 which sets the question title to ``Question 2: Concepts'' (if this is
2394 the second question) and doesn't set any point values, or
2395 \begin{center}
2396 \verb"\titledquestion{Design}[10]"
2397 \end{center}
2398 which sets the question title to ``Design'' and sets the point value
2399 to ``10''. Note that the question title doesn't include the number of
2400 the question unless you put it there using the
2401 \verb"\thequestion"\indc{thequestion} command.
2402
2403 Using \verb"\titledquestion"\indc{titledquestion} instead of
2404 \verb"\question" doesn't change the appearance of the question (unless
2405 you use \verb"\thequestiontitle"\indc{thequestiontitle} in the
2406 argument of a \verb"\qformat"\indc{qformat} command; see
2407 section~\ref{sec:questiontitle}). The only direct effect of using
2408 \verb"\titledquestion" instead of \verb"\question" is that if you
2409 print a grading table or point table indexed by question number (see
2410 section~\ref{sec:GradeTables}), then the title of the question will
2411 replace the number of the question in the table. To have the title of
2412 the question appear in the question itself, see the example in
2413 section~\ref{sec:questiontitle}.
2414
2415 If you create a grading table or point table indexed by question
2416 number and you create a question using the
2417 \verb"\titledquestion"\indc{titledquestion} command, then the number
2418 of the
2419 %
2420 question\index{question number} won't appear in the table unless you
2421 include \verb"\thequestion"\indc{thequestion} in the title of the
2422 question.
2423
2424 %--------------------------------------------------------------------
2425 \subsubsection{\texttt{\bs thequestiontitle}}
2426 \label{sec:questiontitle}
2427
2428 The command \verb"\thequestiontitle"\indc{thequestiontitle} expands to
2429 \begin{itemize}
2430 \item the title of the question (if the question was defined using a
2431 \verb"\titledquestion"\indc{titledquestion} command) or
2432 \item the number of the
2433 %
2434 question\index{question number} (if the question was defined using a
2435 \verb"\question"\indc{question} command).
2436 \end{itemize}
2437 This is for use in the argument of a \verb"\qformat"\indc{qformat}
2438 command (see section~\ref{sec:qformat}), so that you can have the
2439 question title appear in the question itself, and not just in a
2440 grading table or point table.
2441
2442 The contents of \verb"\thequestiontitle"\indc{thequestiontitle} don't
2443 appear anywhere in the question itself unless you do something to make
2444 them appear. For example, if you give the command
2445 \begin{center}
2446 \verb"\qformat{Question \thequestion: \thequestiontitle\dotfill\thepoints}"
2447 \end{center}
2448 and then type\indc{titledquestion}
2449 \begin{verbatim}
2450 \begin{questions}
2451 \titledquestion{History of Empirical Aerodynamics}[10]
2452 What did Billy Joe MacAllister throw off the Tallahatchie Bridge?
2453 \end{questions}
2454 \end{verbatim}
2455 then you'll get
2456 \begin{questions}
2457 \qformat{Question \thequestion: \thequestiontitle\dotfill\thepoints}
2458 \titledquestion{History of Empirical Aerodynamics}[10]
2459 What did Billy Joe MacAllister throw off the Tallahatchie Bridge?
2460 \end{questions}
2461 \noqformat
2462
2463 If the command \verb"\thequestiontitle" is never used, then the only
2464 effect of using the command \verb"\titledquestion" instead of the
2465 command \verb"\question" is that, in a grading table or point table
2466 indexed by question number, this question will be indexed by the title
2467 of the question rather than by the question number, and the title of
2468 the question will never appear except in the table.
2469
2470 %--------------------------------------------------------------------
2471 \subsection{Bonus points}
2472 \label{sec:Bonus}
2473 \index{bonus points|(}
2474 \index{points!bonus|(}
2475
2476 It's possible to create questions, parts, subparts, or subsubparts
2477 that are worth \emph{bonus points}, instead of regular points. To do
2478 this, you use the
2479 command\indc{bonusquestion}\indc{bonustitledquestion}%
2480 \indc{bonuspart}\indc{bonussubpart}\indc{bonussubsubpart}
2481 \begin{center}
2482 \begin{tabular}{l@{\qquad instead of\qquad}l}
2483 \verb"\bonusquestion"& \verb"\question",\\
2484 \verb"\bonustitledquestion"& \verb"\titledquestion",\\
2485 \verb"\bonuspart"& \verb"\part",\\
2486 \verb"\bonussubpart"& \verb"\subpart", and\\
2487 \verb"\bonussubsubpart"& \verb"\subsubpart".
2488 \end{tabular}
2489 \end{center}
2490 There is also a \verb"\bonusqformat"\indc{bonusqformat} command that
2491 affects the \verb"\bonusquestion"\indc{bonusquestion} command in the
2492 same way that the \verb"\qformat"\indc{qformat} command affects the
2493 \verb"\question" command (see section~\ref{sec:qformat}), and a
2494 \verb"\nobonusqformat"\indc{nobonusqformat} command that cancels the
2495 effect of \verb"\bonusqformat" in the same way that
2496 \verb"\noqformat"\indc{noqformat} cancels the effect of
2497 \verb"\qformat". Note that the command
2498 \verb"\thepoints"\indc{thepoints} is defined so that it works equally
2499 well in \verb"\qformat" and \verb"\bonusqformat"\indc{bonusqformat}
2500 commands (see section~\ref{sec:qformat}).
2501
2502 If \indc{bonusquestion}\indc{bonustitledquestion}%
2503 \indc{bonuspart}\indc{bonussubpart}\indc{bonussubsubpart}%
2504 you don't assign any points to a \verb"\bonusquestion",
2505 \verb"\bonuspart", \verb"\bonussubpart", or \verb"\bonussubsubpart"
2506 then, aside from the fact that \verb"\bonusqformat" alters
2507 \verb"\bonusquestion" while \verb"\qformat" alters \verb"\question",
2508 then they're printed in the same way that they would be printed if you
2509 had used the corresponding non-bonus command. However, if you assign
2510 points, then
2511 \begin{itemize}
2512 \item the points are typeset differently (see below),
2513 \item {\sloppy the points are not counted by the
2514 \verb"\gradetable"\indc{gradetable}\indc{pointtable}%
2515 \indc{bonusgradetable}\indc{bonuspointtable}%
2516 \indc{combinedgradetable}\indc{combinedpointtable}%
2517 or \verb"\pointtable" commands (see sections \ref{sec:GradeTables}
2518 and~\ref{sec:PointTables}) or their partial variants (see
2519 section~\ref{sec:PartialTable}), though they \emph{are} counted by
2520 the \verb"\bonusgradetable", \verb"\bonuspointtable",
2521 \verb"\combinedgradetable", and \verb"\combinedpointtable"
2522 commands and their partial variants (see
2523 sections~\ref{sec:BonusTables} and \ref{sec:CombinedTables}),\par}
2524 \item the points are not counted by the
2525 \verb"\droptotalpoints"\indc{droptotalpoints} command (see
2526 section~\ref{sec:addup}), though they are counted by the
2527 \verb"\droptotalbonuspoints"\indc{droptotalbonuspoints} command (see
2528 below),
2529 \item the points are not counted by the
2530 \verb"\pointsofquestion"\indc{pointsofquestion} (see
2531 section~\ref{sec:pointsofq}) or
2532 \verb"\pointsonpage"\indc{pointsonpage} (see
2533 section~\ref{sec:pointsonp}) commands, though they \emph{are}
2534 counted by the
2535 \verb"\bonuspointsofquestion"\indc{bonuspointsofquestion} and
2536 \verb"\bonuspointsonpage"\indc{bonuspointsonpage} (see
2537 section~\ref{sec:BonusTables}) commands, and
2538 \item the points are not counted by the
2539 \verb"\numpoints"\indc{numpoints} command (see
2540 section~\ref{sec:Count}), though they \emph{are} counted by the
2541 \verb"\numbonuspoints"\indc{numbonuspoints} command (see
2542 section~\ref{sec:Count}).
2543 \end{itemize}
2544
2545 The default setup is that if you type
2546 \begin{verbatim}
2547 \begin{questions}
2548 \question[10] Who discovered America?
2549 \bonusquestion[1] On what day of the week did he do it?
2550 \bonusquestion[2] What color shirt was he wearing?
2551 \end{questions}
2552 \end{verbatim}
2553 then you'll get
2554 \begin{questions}
2555 \question[10] Who discovered America?
2556 \bonusquestion[1] On what day of the week did he do it?
2557 \bonusquestion[2] What color shirt was he wearing?
2558 \end{questions}
2559
2560 There is also a command
2561 \verb"\bonuspointpoints"\indc{bonuspointpoints} that is analogous to
2562 \verb"\pointpoints" (see section~\ref{sec:pointname}); the default
2563 setup was created by the command
2564 \begin{center}
2565 \verb"\bonuspointpoints{point (bonus)}{points (bonus)}"
2566 \end{center}
2567 and if you give the command
2568 \begin{center}
2569 \verb"\bonuspointpoints{bonus point}{bonus points}"
2570 \end{center}
2571 then typing the above would produce\indc{bonuspointpoints}
2572 \begin{questions}
2573 \bonuspointpoints{bonus point}{bonus points}
2574 \question[10] Who discovered America?
2575 \bonusquestion[1] On what day of the week did he do it?
2576 \bonusquestion[2] What color shirt was he wearing?
2577 \end{questions}
2578 There are also
2579 commands\indc{bonuspointname}\indc{marginbonuspointname}
2580 \begin{center}
2581 \begin{tabular}{l}
2582 \verb"\bonuspointname" and\\
2583 \verb"\marginbonuspointname"
2584 \end{tabular}
2585 \qquad that are analogous to\qquad
2586 \begin{tabular}{l}
2587 \verb"\pointname" and\\
2588 \verb"\marginpointname"
2589 \end{tabular}
2590 \end{center}
2591 (see section~\ref{sec:pointname}), and
2592 commands\indc{droptotalpoints}\indc{bonustotalformat}%
2593 \indc{totalbonuspoints}
2594 \begin{center}
2595 \begin{tabular}{l}
2596 \verb"\droptotalbonuspoints",\\
2597 \verb"\bonustotalformat", and\\
2598 \verb"\totalbonuspoints"
2599 \end{tabular}
2600 \qquad that are analogous to\qquad
2601 \begin{tabular}{l}
2602 \verb"\droptotalpoints",\\
2603 \verb"\totalformat", and\\
2604 \verb"\totalpoints"
2605 \end{tabular}
2606 \end{center}
2607 (see section~\ref{sec:addup}).
2608
2609 \index{points!bonus|)}
2610 \index{bonus points|)}
2611
2612
2613 %--------------------------------------------------------------------
2614 \subsection{Counting the questions and adding up the points}
2615 \label{sec:Count}
2616 \index{questions!counting|(}
2617
2618
2619 The \verb"exam" document class automatically counts the numbers of
2620 questions, parts, and subparts, and makes these numbers available as
2621 the macros\indc{numquestions}\indc{numparts}\indc{numsubparts}%
2622 \indc{numsubsubparts}
2623 \begin{center}
2624 \begin{tabular}{l}
2625 \verb"\numquestions"\\
2626 \verb"\numparts"\\
2627 \verb"\numsubparts"\\
2628 \verb"\numsubsubparts"
2629 \end{tabular}
2630 \end{center}
2631 These numbers are also printed on the screen when you run \LaTeX{} and
2632 they are placed into the \verb".log" file as well. If you have more
2633 than one \verb"questions" environment (for example, if your exam has
2634 several parts, with the questions in each part numbered beginning with
2635 ``1''), then \verb"\numquestions" will hold the total number of
2636 questions on the exam. If you do have more than one \verb"questions"
2637 environment, though, you won't be able to use the
2638 \verb"\gradetable"\indc{gradetable} or
2639 \verb"\pointtable"\indc{pointtable} commands (see
2640 section~\ref{sec:Tables}).
2641
2642 If you use the document class option \verb"addpoints"\indt{addpoints}
2643 or give the command \verb"\addpoints"\indc{addpoints} (see
2644 section~\ref{sec:addpoints}), then the class will add the total number
2645 of points and the total number of bonus points (see
2646 section~\ref{sec:Bonus}) that you've given to all of the questions,
2647 parts, subparts, and subsubparts of the exam, and make those totals
2648 available in the macros\indc{numpoints}\indc{numbonuspoints}
2649 \begin{center}
2650 \begin{tabular}{l}
2651 \verb"\numpoints"\\
2652 \verb"\numbonuspoints"
2653 \end{tabular}
2654 \end{center}
2655 as well as displaying those totals on the screen when you run \LaTeX{}
2656 and placing them into the \texttt{.log} file. You can then type
2657 \begin{verbatim}
2658 \begin{center}
2659 This exam has \numquestions\ questions, for a total of \numpoints\
2660 points and \numbonuspoints\ bonus points.
2661 \end{center}
2662 \end{verbatim}
2663 and you'll get
2664 \begin{center}
2665 This exam has 8 questions, for a total of 120 points and 10 bonus
2666 points.
2667 \end{center}
2668
2669 \emph{Warning}: If \verb"addpoints"\indt{addpoints} is in effect, your
2670 point values for questions, parts, subparts, and subsubparts must not
2671 contain anything other than digits and the command \verb"\half" (see
2672 section~\ref{sec:Half}). For example, if you \emph{don't} give the
2673 command \verb"\addpoints", then you can
2674 %
2675 type\index{points!acceptable entries}
2676 \begin{center}
2677 \verb"\question[10\%]"
2678 \end{center}
2679 with no problems, but this will cause errors if you've given the
2680 command \verb"\addpoints"\indc{addpoints}. The correct way to
2681 accomplish what you want is to give the command
2682 \verb"\marginpointname{\%}"\indc{marginpointname} or
2683 \verb"\pointname{\%}"\indc{pointname} and then type
2684 \verb"\question[10]" (see section~\ref{sec:pointname}).
2685
2686 If you want to temporarily turn off the adding of points (for example,
2687 if you list both the total points for each question and the points for
2688 each part, but you don't want to count the points twice), you can give
2689 the command\indc{noaddpoints}
2690 \begin{center}
2691 \verb"\noaddpoints"
2692 \end{center}
2693 to turn off the adding of points and the command \verb"\addpoints" to
2694 turn it back on.
2695
2696 If \verb"addpoints"\indc{addpoints} is in effect, then you can create
2697 grading tables (see section~\ref{sec:GradeTables}) and point tables
2698 (see section~\ref{sec:PointTables}) and use the commands
2699 \verb"\pointsofquestion" (see section~\ref{sec:pointsofq}) and
2700 \verb"\pointsonpage" (see section~\ref{sec:pointsonp}).
2701
2702 \index{questions!counting|)}
2703
2704 %---------------------------------------------------------------------
2705 \subsection{Referring to specific questions by number (cross
2706 references)}
2707 \index{cross references|(}
2708
2709 You can use the standard \LaTeX{} commands \verb"\label" and
2710 \verb"\ref" to refer to questions (or parts, or subparts, or
2711 subsubparts) by number. For example, if you type
2712 \begin{verbatim}
2713 The first question is question number~\ref{ques:first}.
2714 Question number~\ref{ques:second} has both a good part
2715 (part~\ref{part:good}) and a bad part (part~\ref{part:bad}).
2716
2717 \begin{questions}
2718 \question
2719 \label{ques:first}
2720 This is the first question.
2721
2722 \question
2723 \label{ques:second}
2724 \begin{parts}
2725 \part
2726 \label{part:good}
2727 This is the good part.
2728
2729 \part
2730 \label{part:bad}
2731 This is the \emph{bad} part.
2732 \end{parts}
2733
2734 \question
2735 Is there a question?
2736 \end{questions}
2737 \end{verbatim}
2738 then you'll get:
2739
2740 \medskip
2741
2742 The first question is question number~\ref{ques:first}.
2743 Question number~\ref{ques:second} has both a good part
2744 (part~\ref{part:good}) and a bad part (part~\ref{part:bad}).
2745
2746 \begin{questions}
2747 \question
2748 \label{ques:first}
2749 This is the first question.
2750
2751 \question
2752 \label{ques:second}
2753 \begin{parts}
2754 \part
2755 \label{part:good}
2756 This is the good part.
2757
2758 \part
2759 \label{part:bad}
2760 This is the \emph{bad} part.
2761 \end{parts}
2762
2763 \question
2764 Is there a question?
2765 \end{questions}
2766
2767
2768
2769 \bigskip
2770
2771 As with all other cross references in \LaTeX, you'll have to run your
2772 file through \LaTeX{} \emph{twice} to be sure that all the cross
2773 references are correct.
2774
2775 \index{cross references|)}
2776
2777 %--------------------------------------------------------------------
2778 \subsection{Customizing the numbers}
2779 \label{sec:CustNumb}
2780 \index{customization!question numbers|(}
2781
2782
2783 The default setup is that:
2784 \begin{questions}
2785 \question Question numbers are arabic, and are followed by a period.
2786 \begin{parts}
2787 \part Part numbers are lower case letters, and are enclosed in
2788 parentheses.
2789 \begin{subparts}
2790 \subpart Subpart numbers are lower case roman, and are followed
2791 by a period.
2792 \begin{subsubparts}
2793 \subsubpart Subsubpart numbers are greek, and are followed by
2794 a right parenthesis.
2795 \begin{choices}
2796 \choice Choices are upper case letters, and are followed by
2797 a period.
2798 \end{choices}
2799 \end{subsubparts}
2800 \end{subparts}
2801 \end{parts}
2802 \end{questions}
2803 All of this can be changed.
2804
2805 \bigskip
2806
2807 To change the type of numbering, you would redefine the
2808 commands\indc{thequestion}\indc{thepartno}\indc{thesubpart}%
2809 \indc{thesubsubpart}\indc{thechoice}
2810 \begin{center}
2811 \begin{tabular}{l}
2812 \verb"\thequestion"\\
2813 \verb"\thepartno"\\
2814 \verb"\thesubpart"\\
2815 \verb"\thesubsubpart"\\
2816 \verb"\thechoice"
2817 \end{tabular}
2818 \end{center}
2819 (Note: The second one listed there is \verb"\thepartno", \emph{not}
2820 \verb"\thepart". The command \verb"\thepart" refers to the counter
2821 used in the article document class standard sectioning command
2822 \verb"\part".) The numbering commands available
2823 are\indc{arabic}\indc{alph}\indc{Alph}\indc{roman}%
2824 \indc{Roman}\indc{greeknum}
2825 \begin{center}
2826 \begin{tabular}{ll}
2827 \verb"\arabic"& Regular arabic integers\\
2828 \verb"\alph"& Lower case letters\\
2829 \verb"\Alph"& Upper case letters\\
2830 \verb"\roman"& Lower case roman numbers\\
2831 \verb"\Roman"& Upper case roman numbers\\
2832 \verb"\greeknum"& Greek letters
2833 \end{tabular}
2834 \end{center}
2835 and any of these can be applied to the
2836 counters\index{question counter}\index{part counter}%
2837 \index{subpart counter}\index{subsubpart counter}%
2838 \index{choice counter}%
2839 \verb"question"\indt{question}, \verb"partno"\indt{partno},
2840 \verb"subpart"\indt{subpart}, \verb"subsubpart"\indt{subsubpart}, and
2841 \verb"choice"\indt{choice}. (The \verb"\greeknum"\indc{greeknum}
2842 command is defined by the exam document class, but all of the others
2843 are standard \LaTeX{} commands.)
2844
2845 For example, to have questions numbered using upper case roman numbers
2846 and parts numbered using upper case letters, you would give the
2847 commands\indc{thequestion}\indc{thepartno}
2848 \begin{center}
2849 \begin{tabular}{l}
2850 \verb"\renewcommand{\thequestion}{\Roman{question}}"\\
2851 \verb"\renewcommand{\thepartno}{\Alph{partno}}"
2852 \end{tabular}
2853 \end{center}
2854
2855 \bigskip
2856
2857
2858 The ``decorations'' around the numbers (i.e., the periods, or
2859 parentheses, or \ldots) are determined by the
2860 commands\indc{questionlabel}\indc{partlabel}\indc{subpartlabel}%
2861 \indc{subsubpartlabel}\indc{choicelabel}
2862 \begin{center}
2863 \begin{tabular}{l}
2864 \verb"\questionlabel"\\
2865 \verb"\partlabel"\\
2866 \verb"\subpartlabel"\\
2867 \verb"\subsubpartlabel"\\
2868 \verb"\choicelabel"
2869 \end{tabular}
2870 \end{center}
2871 the default definitions of which are:
2872 \begin{center}
2873 \begin{tabular}{l}
2874 \verb"\newcommand{\questionlabel}{\thequestion.}"\\
2875 \verb"\newcommand{\partlabel}{(\thepartno)}"\\
2876 \verb"\newcommand{\subpartlabel}{\thesubpart.}"\\
2877 \verb"\newcommand{\subsubpartlabel}{\thesubsubpart)}"\\
2878 \verb"\newcommand{\choicelabel}{\thechoice.}"
2879 \end{tabular}
2880 \end{center}
2881 You can change any of these by giving \verb"\renewcommand" commands to
2882 redefine them. This can, of course, be used to change the
2883 ``decorations'' around the numbers, but there are other uses as well.
2884 For example, if you use the Fourier project's Utopia
2885 font\index{Utopia~font} by including the commands
2886 \begin{center}
2887 \begin{tabular}{l}
2888 \verb"\usepackage[T1]{fontenc}"\\
2889 \verb"\usepackage{fourier}"
2890 \end{tabular}
2891 \end{center}
2892 after your \verb"\documentclass" command, then you'll see that the
2893 kerning\index{kerning} makes ``\verb"F."" look so much like
2894 ``\verb"E"" that a student could confuse the two. You can turn off
2895 the kerning with the command
2896 \verb"\renewcommand{\choicelabel}{\thechoice{}.}"\indc{choicelabel}.
2897
2898 \index{customization!question numbers|)}
2899
2900
2901 %--------------------------------------------------------------------
2902 \subsection{Customizing the list parameters}
2903 \label{sec:CustList}
2904 \index{list environment|(}
2905 \index{environment!list|(}
2906 \index{customization!list parameters|(}
2907
2908 The environments \texttt{questions}, \texttt{parts},
2909 \texttt{subparts}, \texttt{subsubparts}, \texttt{choices}, and
2910 \texttt{checkboxes} are all implemented as \LaTeX{} \texttt{list}
2911 environments. This section describes commands for advanced users who
2912 want to customize the list parameters (\verb"\topsep"\indc{topsep},
2913 \verb"\partopsep"\indc{partopsep}, \verb"\itemsep"\indc{itemsep},
2914 \verb"\parsep"\indc{parsep}, etc.) for the lists that those
2915 environments create.
2916
2917 The \verb"exam" document class includes the expansion
2918 of\indc{questionshook}\indc{partshook}\indc{subpartshook}%
2919 \indc{subsubpartshook}\indc{choiceshook}\indc{checkboxeshook}
2920 \begin{center}
2921 \begin{tabular}{l@{\qquad when creating a\qquad}l@{\qquad}l}
2922 \verb"\questionshook"&\verb"questions"&environment,\\
2923 \verb"\partshook"&\verb"parts"&environment,\\
2924 \verb"\subpartshook"&\verb"subparts"&environment,\\
2925 \verb"\subsubpartshook"&\verb"subsubparts"&environment,\\
2926 \verb"\choiceshook"&\verb"choices"&environment, and\\
2927 \verb"\checkboxeshook"&\verb"checkboxes"&environment.
2928 \end{tabular}
2929 \end{center}
2930 The \verb"exam" document class defines these as follows:
2931 \begin{center}
2932 \begin{tabular}{ll}
2933 \verb"\newcommand{\questionshook}{}"\\
2934 \verb"\newcommand{\partshook}{}"\\
2935 \verb"\newcommand{\subpartshook}{}"\\
2936 \verb"\newcommand{\subsubpartshook}{}"\\
2937 \verb"\newcommand{\choiceshook}{}"\\
2938 \verb"\newcommand{\checkboxeshook}{}"
2939 \end{tabular}
2940 \end{center}
2941 Thus, the default is that these commands have no effect, but you can
2942 change any of them with a \verb"\renewcommand" command. Thus, if you
2943 redefine, e.g., \verb"\questionshook" to expand to commands that set
2944 values for some of the list parameters, then those values will be used
2945 in the \verb"questions" environment.
2946
2947 For example, if you give the command\indc{questionshook}
2948 \begin{center}
2949 \verb"\renewcommand{\questionshook}{\setlength{\itemsep}{1in}}"
2950 \end{center}
2951 then there will be an additional one inch of blank space inserted
2952 between questions (since the questions are the items in a
2953 \verb"questions" environment). For another example, if you give the
2954 command\indc{partshook}
2955 \begin{center}
2956 \verb"\renewcommand{\partshook}{\setlength{\topsep}{0.5in}}"
2957 \end{center}
2958 then each parts environment will have an additional one half inch of
2959 space before and after the environment.
2960
2961 For another example, if you're using a \verb"\qformat"\indc{qformat}
2962 (see section~\ref{sec:qformat}) (and, if there are any bonus
2963 questions, also a \verb"\bonusqformat"\indc{bonusqformat}; see
2964 section~\ref{sec:Bonus}), so that there are no labels on any of the
2965 questions, and you'd like to remove the indentation of the questions,
2966 give the
2967 command\index{indentation!remove}\indc{leftmargin}\indc{labelsep}
2968 \begin{verbatim}
2969 \renewcommand{\questionshook}{%
2970 \setlength{\leftmargin}{0pt}%
2971 \setlength{\labelwidth}{-\labelsep}%
2972 }
2973 \end{verbatim}
2974
2975 \index{customization!list parameters|)}
2976 \index{environment!list|)}
2977 \index{list environment|)}
2978
2979 %--------------------------------------------------------------------
2980 %--------------------------------------------------------------------
2981 \section{Multiple choice and fill in the blank questions}
2982 \label{sec:MulChc}
2983 \index{multiple choice}
2984
2985 There are four environments for listing the possible answers to a
2986 multiple choice question: two of them label the choices, and the other
2987 two print checkboxes in front of the choices for the student to place
2988 checks next to the chosen answers.
2989 \begin{itemize}
2990 \item The first two environments use upper case letters (i.e., ``A'',
2991 ``B'', ``C'', \ldots) to label the choices. (To change the
2992 appearance of the labels, see section~\ref{sec:CustNumb}.)
2993 \begin{itemize}
2994 \item The \verb"choices"\indt{choices}\index{choices environment}%
2995 \index{environment!choices} environment creates a list environment
2996 with the choices as the items in the list (see
2997 section~\ref{sec:choices}).
2998 \item The \verb"oneparchoices"\indt{oneparchoices}%
2999 \index{oneparchoices environment}%
3000 \index{environment!oneparchoices} environment lists all of the
3001 choices in a single paragraph which is a continuation of the
3002 paragraph preceding the environment unless you leave a blank line
3003 before beginning the environment (see
3004 section~\ref{sec:oneparchoices}).
3005 \end{itemize}
3006 If you don't want the students to just circle the correct choices,
3007 you can use the \verb"\answerline"\indc{answerline} command to print
3008 a line on which the answer should be written (see
3009 section~\ref{sec:ShortAns}). The
3010 \verb"\anwerline"\indcsub{answerline}{optional~argument}
3011 command allows you to include as an optional argument the answer to
3012 the question, and the answer will be printed on the line when
3013 solutions are bing printed (see section~\ref{sec:AnsShortAns}).
3014 \item The last two environments print checkboxes in front of the
3015 choices for the students to use to place checks next to the chosen
3016 answers.
3017 \begin{itemize}
3018 \item The \verb"checkboxes"\indt{checkboxes}%
3019 \index{checkboxes environment}%
3020 \index{environment!checkboxes} environment creates a list
3021 environment with the choices as the items in the list (see
3022 section~\ref{sec:checkboxes}).
3023 \item The \verb"oneparcheckboxes"\indt{oneparcheckboxes}%
3024 \index{oneparcheckboxes environment}%
3025 \index{environment!oneparcheckboxes} environment lists all of the
3026 choices in a single paragraph which is a continuation of the
3027 paragraph preceding the environment unless you leave a blank line
3028 before beginning the environment (see
3029 section~\ref{sec:oneparcheckboxes}).
3030 \end{itemize}
3031 \end{itemize}
3032 All of those environments allow you to designate one or more choices
3033 as correct choices and to have the correct choices printed with
3034 emphasis when solutions are being printed (see
3035 section~\ref{sec:CorrectChoice}).
3036
3037 %--------------------------------------------------------------------
3038 \subsection{The \texttt{choices} environment}
3039 \label{sec:choices}
3040 \indt{choices}
3041 \indc{choice}
3042 \index{choices environment}
3043 \index{environment!choices}
3044
3045 For example, if you type
3046 \begin{verbatim}
3047 \begin{questions}
3048 \question
3049 One of these things is not like the others; one of these things is not
3050 the same. Which one is different?
3051 \begin{choices}
3052 \choice John
3053 \choice Paul
3054
3055 \choice
3056
3057 George
3058
3059 \choice Ringo
3060
3061 \choice Socrates
3062
3063 \end{choices}
3064
3065 \end{questions}
3066 \end{verbatim}
3067 Then you'll get
3068 \begin{questions}
3069 \question
3070 One of these things is not like the others; one of these things is not
3071 the same. Which one is different?
3072 \begin{choices}
3073 \choice John
3074 \choice Paul
3075
3076 \choice
3077
3078 George
3079
3080 \choice Ringo
3081
3082 \choice Socrates
3083
3084 \end{choices}
3085
3086 \end{questions}
3087 As that example illustrates, you can leave blank lines between the
3088 \verb"\choice" command and the text of the choice, or between the
3089 various choices, and those blank lines will be ignored.
3090
3091 %--------------------------------------------------------------------
3092 \subsection{The \texttt{oneparchoices} environment}
3093 \label{sec:oneparchoices}
3094 \indt{oneparchoices}
3095 \indc{choice}
3096 \index{oneparchoices environment}
3097 \index{environment!oneparchoices}
3098
3099 If you use a \verb"oneparchoices" environment instead of the
3100 \verb"choices" environment in the example of
3101 section~\ref{sec:choices}, then you'll get
3102 \begin{questions}
3103 \question
3104 One of these things is not like the others; one of these things is not
3105 the same. Which one is different?
3106 \begin{oneparchoices}
3107 \choice John
3108 \choice Paul
3109
3110 \choice
3111
3112 George
3113
3114 \choice Ringo
3115
3116 \choice Socrates
3117
3118 \end{oneparchoices}
3119
3120 \end{questions}
3121
3122 If you insert a blank line before the \verb"\begin{oneparchoices}",
3123 then you'll get
3124 \begin{questions}
3125 \question
3126 One of these things is not like the others; one of these things is not
3127 the same. Which one is different?
3128
3129 \begin{oneparchoices}
3130 \choice John
3131 \choice Paul
3132
3133 \choice
3134
3135 George
3136
3137 \choice Ringo
3138
3139 \choice Socrates
3140
3141 \end{oneparchoices}
3142
3143 \end{questions}
3144
3145
3146 If you insert a blank line before the \verb"\begin{oneparchoices}" and
3147 \verb"\answerline" after the \verb"\end{oneparchoices}" (see
3148 section~\ref{sec:ShortAns} for a description of the
3149 \verb"\answerline"\indc{answerline} command), then you'll get
3150 \begin{questions}
3151 \question
3152 One of these things is not like the others; one of these things is not
3153 the same. Which one is different?
3154
3155 \begin{oneparchoices}
3156 \choice John
3157 \choice Paul
3158
3159 \choice
3160
3161 George
3162
3163 \choice Ringo
3164
3165 \choice Socrates
3166
3167 \end{oneparchoices}
3168 \answerline
3169
3170 \end{questions}
3171
3172 %--------------------------------------------------------------------
3173 \subsection{The \texttt{checkboxes} environment}
3174 \label{sec:checkboxes}
3175 \indt{checkboxes}
3176 \indc{choice}
3177 \index{checkboxes environment}
3178 \index{environment!checkboxes}
3179
3180 If you use a \texttt{checkboxes} environment instead of the
3181 \texttt{choices} environment in the example of
3182 section~\ref{sec:choices}, then you'll get
3183 \begin{questions}
3184 \question
3185 One of these things is not like the others; one of these things is not
3186 the same. Which one is different?
3187 \begin{checkboxes}
3188 \choice John
3189 \choice Paul
3190
3191 \choice
3192
3193 George
3194
3195 \choice Ringo
3196
3197 \choice Socrates
3198
3199 \end{checkboxes}
3200
3201 \end{questions}
3202 The appearance of the checkbox can be customized (see
3203 section~\ref{sec:MulChceCust}).
3204
3205
3206 %--------------------------------------------------------------------
3207 \subsection{The \texttt{oneparcheckboxes} environment}
3208 \label{sec:oneparcheckboxes}
3209 \indt{oneparcheckboxes}
3210 \indc{choice}
3211 \index{oneparcheckboxes environment}
3212 \index{environment!oneparcheckboxes}
3213
3214 If you use a \verb"oneparcheckboxes" environment instead of the
3215 \verb"choices" environment in the example of
3216 section~\ref{sec:choices}, then you'll get
3217 \begin{questions}
3218 \question
3219 One of these things is not like the others; one of these things is not
3220 the same. Which one is different?
3221 \begin{oneparcheckboxes}
3222 \choice John
3223 \choice Paul
3224
3225 \choice
3226
3227 George
3228
3229 \choice Ringo
3230
3231 \choice Socrates
3232
3233 \end{oneparcheckboxes}
3234
3235 \end{questions}
3236
3237 If you insert a blank line before the \verb"\begin{oneparcheckboxes}",
3238 then you'll get
3239 \begin{questions}
3240 \question
3241 One of these things is not like the others; one of these things is not
3242 the same. Which one is different?
3243
3244 \begin{oneparcheckboxes}
3245 \choice John
3246 \choice Paul
3247
3248 \choice
3249
3250 George
3251
3252 \choice Ringo
3253
3254 \choice Socrates
3255
3256 \end{oneparcheckboxes}
3257
3258 \end{questions}
3259 The appearance of the checkbox can be customized (see
3260 section~\ref{sec:MulChceCust}).
3261
3262
3263
3264 %--------------------------------------------------------------------
3265 \subsection{Solutions to multiple choice questions}
3266 \label{sec:CorrectChoice}
3267 \index{solutions}
3268 \index{choices environment!correct choice}
3269 \index{environment!choices!correct choice}
3270 \index{oneparchoices environment!correct choice}
3271 \index{environment!oneparchoices!correct choice}
3272 \index{checkboxes environment!correct choice}
3273 \index{environment!checkboxes!correct choice}
3274 \index{oneparcheckboxes environment!correct choice}
3275 \index{environment!oneparcheckboxes!correct choice}
3276
3277
3278 The \verb"exam" document class defines several environments for
3279 solutions (see section~\ref{sec:solutions}), the contents of which
3280 will be printed only if you use the document class option
3281 \verb"answers"\indt{answers} (as in
3282 \verb"\documentclass[answers]{exam}") or give the command
3283 \verb"\printanswers"\indc{printanswers} (see
3284 section~\ref{sec:answers}). Each of the environments for multiple
3285 choice questions (see
3286 sections~\ref{sec:choices}--\ref{sec:oneparcheckboxes}) allows you to
3287 designate one or more of the choices as \emph{correct choices}, and to
3288 have the correct choices printed with emphasis when solutions are
3289 being printed.
3290
3291 The command to define a correct choice is
3292 \verb"\CorrectChoice"\indc{CorrectChoice}, which is used in place of
3293 the command \verb"\choice"\indc{choice}. (To avoid confusion,
3294 \verb"\correctchoice"\indc{correctchoice} is defined to be a synonym
3295 for \verb"\CorrectChoice".) When solutions are not being printed,
3296 \verb"\CorrectChoice" is equivalent to \verb"\choice". When solutions
3297 are being printed, though, any choices that were created with
3298 \verb"\CorrectChoice" (rather than with \verb"\choice") will be
3299 printed in bold. (This can be changed; see
3300 section~\ref{sec:MulChceCust}.) In addition, in the
3301 \texttt{checkboxes}\indt{checkboxes} and
3302 \texttt{oneparcheckboxes}\indt{oneparcheckboxes} environments, each
3303 correct choice will have its checkbox replaced by a check.
3304
3305 For example, if \verb"\printanswers"\indc{printanswers} is in effect
3306 and you type\indc{CorrectChoice}
3307 \begin{verbatim}
3308 \begin{questions}
3309 \question One of these things is not like the others; one of these
3310 things is not the same. Which one is different?
3311 \begin{oneparchoices}
3312 \choice John
3313 \choice Paul
3314 \choice George
3315 \choice Ringo
3316 \CorrectChoice Socrates
3317 \end{oneparchoices}
3318 \end{questions}
3319 \end{verbatim}
3320 then you'll get
3321 \printanswers
3322 \begin{questions}
3323 \question One of these things is not like the others; one of these
3324 things is not the same. Which one is different?
3325 \begin{oneparchoices}
3326 \choice John
3327 \choice Paul
3328 \choice George
3329 \choice Ringo
3330 \CorrectChoice Socrates
3331 \end{oneparchoices}
3332 \end{questions}
3333 \noprintanswers
3334 %
3335 If you use a \texttt{oneparcheckboxes}\indt{oneparcheckboxes}
3336 environment instead of the \texttt{oneparchoices}\indt{oneparchoices}
3337 environment in that example, then you'll get\indc{printanswers}
3338 %
3339 \printanswers
3340 \begin{questions}
3341 \question One of these things is not like the others; one of these
3342 things is not the same. Which one is different?
3343 \begin{oneparcheckboxes}
3344 \choice John
3345 \choice Paul
3346 \choice George
3347 \choice Ringo
3348 \CorrectChoice Socrates
3349 \end{oneparcheckboxes}
3350 \end{questions}
3351 \noprintanswers
3352
3353 %--------------------------------------------------------------------
3354 \subsection{Fill in the blank questions}
3355 \label{sec:Fillin}
3356
3357 \indcstart{fillin}
3358 \index{fill in the blank|(}
3359
3360 There is a \verb"\fillin" command that prints underlined empty space
3361 for creating ``fill in the blank'' questions. The \verb"\fillin"
3362 command can take two optional arguments:
3363 \begin{itemize}
3364 \item the first optional argument is the answer to the question, which
3365 will be printed above the line when answers are being printed, and
3366 \item the second optional argument is the length of line to be
3367 printed, if you want some length other than the default.
3368 \end{itemize}
3369 If answers are being printed and you supply the answer as the first
3370 (and possibly only) optional argument, then the answer is printed
3371 subject to the declarations in the argument of the most recent
3372 \verb"\CorrectChoiceEmphasis" command. It is centered on the line
3373 unless it is too long, in which case it extends to the right of the
3374 line. The default length of the line and the distance down from the
3375 baseline of the text to the empty line can both be customized (see
3376 section~\ref{sec:CustFillin}).
3377
3378 For example, if you type
3379 \begin{verbatim}
3380 \begin{questions}
3381 \question \fillin is the color of my true love's hair.
3382 \end{questions}
3383 \end{verbatim}
3384 then you'll get
3385 \begin{questions}
3386 \question \fillin is the color of my true love's hair.
3387 \end{questions}
3388 If, instead, you type
3389 \begin{verbatim}
3390 \begin{questions}
3391 \question \fillin[Black] is the color of my true love's hair.
3392 \end{questions}
3393 \end{verbatim}
3394 then if answers are not being printed you'll get
3395 \begin{questions}
3396 \question \fillin[Black] is the color of my true love's hair.
3397 \end{questions}
3398 and if answers are being printed you'll get
3399 \printanswers
3400 \begin{questions}
3401 \question \fillin[Black] is the color of my true love's hair.
3402 \end{questions}
3403 \noprintanswers
3404
3405 For another example, if answers are being printed and you type
3406 \begin{verbatim}
3407 \begin{questions}
3408 \question The magic word is \fillin[prestidigitator].
3409 \end{questions}
3410 \end{verbatim}
3411 then you'll get
3412 \printanswers
3413 \begin{questions}
3414 \question The magic word is \fillin[prestidigitator].
3415 \end{questions}
3416 \noprintanswers
3417 which shows what happens when the answer is too long for the fillin
3418 line. If, however, you type
3419 \begin{verbatim}
3420 \begin{questions}
3421 \question The magic word is \fillin[prestidigitator][2in].
3422 \end{questions}
3423 \end{verbatim}
3424 then you'll get
3425 \printanswers
3426 \begin{questions}
3427 \question The magic word is \fillin[prestidigitator][2in].
3428 \end{questions}
3429 \noprintanswers
3430
3431 \verb"\fillin" eats (and ignores) space characters appearing before
3432 the first optional argument. It also eats (and ignores) space
3433 characters appearing after the first optional argument and before the
3434 second optional argument. However, if exactly one optional argument
3435 appears, and if there are one or more space characters following that
3436 one optional argument, then those spaces are replaced by a single
3437 space character, but not eaten.
3438 %--------------------------------------------------------------------
3439 \subsubsection{True/False questions}
3440 \label{sec:truefalse}
3441
3442 \index{true/false questions|(}
3443 The \verb"\fillin" command can also be used to create True/False
3444 questions. If you give the command
3445 \begin{verbatim}
3446 \newcommand{\tf}[1][{}]{%
3447 \fillin[#1][0.25in]%
3448 }
3449 \end{verbatim}
3450 then you can type
3451 \begin{verbatim}
3452 \begin{questions}
3453 \question \tf[T] The world is all that is the case.
3454 \question \tf[F] My favorite color is blue.
3455 \end{questions}
3456 \end{verbatim}
3457 \newcommand{\tf}[1][{}]{%
3458 \fillin[#1][0.25in]%
3459 }
3460 and if answers are not being printed you'll get
3461 \begin{questions}
3462 \question \tf[T] The world is all that is the case.
3463 \question \tf[F] My favorite color is blue.
3464 \end{questions}
3465 but if answers are being printed then you'll get
3466 \printanswers
3467 \begin{questions}
3468 \question \tf[T] The world is all that is the case.
3469 \question \tf[F] My favorite color is blue.
3470 \end{questions}
3471 \noprintanswers
3472
3473 \index{true/false questions|)}
3474
3475 %--------------------------------------------------------------------
3476 \subsubsection{Customizing the \texttt{\bs fillin} command}
3477 \label{sec:CustFillin}
3478 \index{customization!\texttt{\char`\\fillin}|(}
3479
3480 You can customize the \verb"\fillin" command by changing
3481 \begin{itemize}
3482 \item the default length of the underlined space,
3483 \item the distance below the text baseline that the line is printed, and
3484 \item the emphasis applied to the answer (when answers are being
3485 printed).
3486 \end{itemize}
3487 The default length of the underlined space is called
3488 \verb"\fillinlinelength"\indc{fillinlinelength}, and its value was set
3489 by the command
3490 \begin{center}
3491 \verb"\setlength\fillinlinelength{1in}"
3492 \end{center}
3493 You can change this by giving a new \verb"\setlength" command.
3494
3495 The line is printed a distance of
3496 \verb"\answerclearance"\indc{answerclearance} below the baseline, and
3497 its value was set by the command
3498 \begin{center}
3499 \verb"\setlength\answerclearance{0.2ex}"
3500 \end{center}
3501 You can change this by giving a new \verb"\setlength" command. Note:
3502 \verb"\answerclearance" is also used by the \verb"\answerline" command
3503 (see section~\ref{sec:ShortAns}).
3504
3505 When answers are being printed and you include the optional argument
3506 containing the answer, then the answer is printed subject to the
3507 declarations in the argument of the most recent
3508 \verb"\CorrectChoiceEmphasis"\indc{CorrectChoiceEmphasis} command.
3509 The default situation was created by the command
3510 \begin{center}
3511 \verb"\CorrectChoiceEmphasis{\bfseries}"
3512 \end{center}
3513 and you can change this by giving a new \verb"\CorrectChoiceEmphasis"
3514 command (see section~\ref{sec:MulChceCust}).
3515
3516 \index{customization!\texttt{\char`\\fillin}|)}
3517 \index{fill in the blank|)}
3518 \indcstop{fillin}
3519
3520
3521 %--------------------------------------------------------------------
3522 \subsection{Customizing the multiple choice environments}
3523 \label{sec:MulChceCust}
3524 \index{customization!multiple choice questions|(}
3525
3526 When solutions are being printed, the correct choices in any of the
3527 environments \texttt{choices}\indt{choices},
3528 \texttt{oneparchoices}\indt{oneparchoices},
3529 \texttt{checkboxes}\indt{checkboxes}, and
3530 \texttt{oneparcheckboxes}\indt{oneparcheckboxes} will be printed
3531 subject to the declarations in the argument of the most
3532 recent\indc{CorrectChoiceEmphasis}
3533 \begin{center}
3534 \verb"\CorrectChoiceEmphasis"
3535 \end{center}
3536 command. The default situation is created by the command
3537 \begin{center}
3538 \verb"\CorrectChoiceEmphasis{\bfseries}"
3539 \end{center}
3540 and so when solutions are being printed the correct choices are
3541 printed in boldface by default. You can change this, for example, by
3542 giving the command
3543 \begin{center}
3544 \verb"\CorrectChoiceEmphasis{\itshape}"
3545 \end{center}
3546 which would cause correct choices to be printed in italics when
3547 solutions are being printed.
3548
3549 For another example, if you give the command
3550 \verb"\usepackage{color}"\indt{color} (or \verb"\usepackage{xcolor}")
3551 in the preamble\index{preamble} of your document (i.e., after the
3552 \verb"\documentclass" command and before the \verb"\begin{document}"),
3553 and then give the command\indc{CorrectChoiceEmphasis}
3554 \begin{center}
3555 \verb"\CorrectChoiceEmphasis{\color{red}}"
3556 \end{center}
3557 then when solutions are being printed the correct choices will be
3558 printed in red (assuming your printer can produce that color).
3559
3560 For another example, if you give the command
3561 \verb"\usepackage{color}"\indt{color} (or \verb"\usepackage{xcolor}")
3562 in the preamble of your document (i.e., after the
3563 \verb"\documentclass" command and before the \verb"\begin{document}"
3564 command) and then give the command
3565 \begin{center}
3566 \verb"\CorrectChoiceEmphasis{\color{red}\bfseries}"
3567 \end{center}
3568 then the correct choices will be printed in boldface red (again
3569 assuming that your printer can produce that color).
3570
3571 {\sloppy To avoid confusion,
3572 \verb"\correctchoiceemphasis"\indc{correctchoiceemphasis} is defined
3573 to be a synonym for
3574 \verb"\CorrectChoiceEmphasis"\indc{CorrectChoiceEmphasis}.\par}
3575
3576 \bigskip
3577
3578 The \texttt{checkboxes}\indt{checkboxes} and
3579 \texttt{oneparcheckboxes}\indt{oneparcheckboxes} environments also
3580 allow customization of the characters used for checkboxes and checks:
3581 \begin{itemize}
3582 \item The checkbox\index{checkbox} that is printed in the
3583 \texttt{checkboxes} and \texttt{oneparcheckboxes} environments is
3584 the argument of the most recent
3585 \verb"\checkboxchar"\indc{checkboxchar} command. The default is
3586 created by the command
3587 \begin{center}
3588 \verb"\checkboxchar{$\bigcirc$}"
3589 \end{center}
3590 For example, if you give the command
3591 \verb"\usepackage{amssymb}"\indt{amssymb} in the
3592 preamble\index{preamble} of your document (i.e., after the
3593 \verb"\documentclass" command and before the
3594 \verb"\begin{document}"), then the command\indc{Box}
3595 \begin{center}
3596 \verb"\checkboxchar{$\Box$}"
3597 \end{center}
3598 will cause squares to be printed instead of circles.
3599
3600 \item The check that is printed for correct choices in the
3601 \texttt{checkboxes}\indt{checkboxes} and
3602 \texttt{oneparcheckboxes}\indt{oneparcheckboxes} environments
3603 when solutions are being printed is the argument of the most
3604 recent \verb"\checkedchar"\indc{checkedchar} command. The
3605 default is created by the command\indc{surd}
3606 \begin{center}
3607 \verb"\checkedchar{$\surd$}"
3608 \end{center}
3609 \end{itemize}
3610
3611 For example, if you've given the command
3612 \verb"\usepackage{amssymb}"\indt{amssymb} in the
3613 preamble\index{preamble} of your document (i.e., after the
3614 \verb"\documentclass" command and before the \verb"\begin{document}"),
3615 then the commands\indc{Box}\indc{blacksquare}
3616 \begin{center}
3617 \begin{tabular}{l}
3618 \verb"\checkboxchar{$\Box$}"\\
3619 \verb"\checkedchar{$\blacksquare$}"
3620 \end{tabular}
3621 \end{center}
3622 will cause the example in section~\ref{sec:CorrectChoice} to appear as
3623 %
3624 \printanswers
3625 \checkboxchar{$\Box$}
3626 \checkedchar{$\blacksquare$}
3627 \begin{questions}
3628 \question One of these things is not like the others; one of
3629 these things is not the same. Which one is different?
3630 \begin{oneparcheckboxes}
3631 \choice John
3632 \choice Paul
3633 \choice George
3634 \choice Ringo
3635 \CorrectChoice Socrates
3636 \end{oneparcheckboxes}
3637 \end{questions}
3638 \noprintanswers
3639
3640 \index{customization!multiple choice questions|)}
3641 %--------------------------------------------------------------------
3642 %--------------------------------------------------------------------
3643 \section{Escaping the indentation: \texttt{\bs uplevel} and
3644 \texttt{\bs fullwidth}}
3645 \label{sec:uplevel}
3646 \index{indentation|(}
3647
3648 There are two commands provided for printing text with a left margin
3649 smaller than the one currently in effect:
3650 \verb"\uplevel"\indc{uplevel} and \verb"\fullwidth"\indc{fullwidth}.
3651 Each of these commands takes one argument and typesets the argument
3652 with an altered left margin.
3653
3654 The \verb"\fullwidth" command prints its argument using the full width
3655 of the printed region, temporarily canceling the indentation created
3656 by the \texttt{questions} environment (and the \texttt{parts},
3657 \texttt{subparts}, and \texttt{subsubparts} environments, if you're
3658 inside any of those). The \verb"\uplevel" command prints its argument
3659 using the indentation in effect before you entered the current
3660 innermost environment.
3661
3662 There are also two environments,
3663 \texttt{EnvUplevel}\indt{EnvUplevel}\index{environment!EnvUplevel}%
3664 \index{EnvUplevel environment} and
3665 \texttt{EnvFullwidth}\indt{EnvFullwidth}\index{environment!EnvFullwidth}%
3666 \index{EnvFullwidth environment}. The \texttt{EnvUplevel} environment
3667 is similar to the \verb"\uplevel" command and the
3668 \texttt{EnvFullwidth} environment is similar to the \verb"\fullwidth"
3669 command. The environments have the advantage that you can have
3670 verbatim material inside of the environment, while there cannot be any
3671 verbatim material in the argument of \verb"\uplevel" or
3672 \verb"\fullwidth".
3673
3674 The main uses for these commands are including instructions for a
3675 group of questions (see section~\ref{sec:Instructions}) and naming the
3676 parts of a long exam (see section~\ref{sec:Naming}), but you can use
3677 them however you like.
3678
3679 %--------------------------------------------------------------------
3680 \subsection{Including instructions for a group of questions}
3681 \label{sec:Instructions}
3682 \index{instructions|(}
3683 \indcstart{uplevel}
3684 \indtstart{EnvUplevel}
3685 \index{EnvUplevel environment|(}
3686 \index{environment!EnvUplevel|(}
3687
3688
3689 If you are inside of a parts environment and you want to give
3690 directions for the next few parts, then those directions should be
3691 indented to the level of the question of which they are parts, i.e.,
3692 up one level. If you type
3693 \begin{verbatim}
3694 \begin{questions}
3695 \question
3696 Why did you come to Casablanca?
3697
3698 \question
3699 \begin{parts}
3700 \part
3701 Why, Oh why, Oh why, Oh; why did I ever leave Ohio?
3702
3703 \uplevel{The following two parts should be answered in classical
3704 Greek:}
3705 \part
3706 Why do birds sing?
3707
3708 \part
3709 Why do fools fall in love?
3710
3711 \end{parts}
3712 \end{questions}
3713 \end{verbatim}
3714 then you'll get
3715 \begin{questions}
3716 \question
3717 Why did you come to Casablanca?
3718
3719 \question
3720 \begin{parts}
3721 \part
3722 Why, Oh why, Oh why, Oh; why did I ever leave Ohio?
3723
3724 \uplevel{The following two parts should be answered in classical
3725 Greek:}
3726 \part
3727 Why do birds sing?
3728
3729 \part
3730 Why do fools fall in love?
3731
3732 \end{parts}
3733 \end{questions}
3734 You can accomplish exactly the same thing by replacing
3735 \begin{verbatim}
3736 \uplevel{The following two parts should be answered in classical
3737 Greek:}
3738 \end{verbatim}
3739 by
3740 \begin{verbatim}
3741 \begin{EnvUplevel}
3742 The following two parts should be answered in classical Greek:
3743 \end{EnvUplevel}
3744 \end{verbatim}
3745
3746 If you want to give instructions for a group of questions, then the
3747 indenting for those instructions should be to the outer left margin,
3748 i.e., up one level. For example, if you type
3749 \begin{verbatim}
3750 \begin{questions}
3751 \question
3752 Approximate $\displaystyle \int_0^1 \sin x^2 \, dx$ within $.001$ of
3753 its true value.
3754
3755 \uplevel{Questions \ref{exact-start} through~\ref{exact-end} should
3756 be evaluated completely, not just approximated.}
3757
3758 \question
3759 \label{exact-start}
3760 $\displaystyle \int_0^1 \frac{x^2 \, dx}{\sqrt{1-x^2}}$
3761
3762 \question
3763 $\displaystyle \int_0^1 \frac{1}{1+x^2}\, dx$
3764
3765 \question
3766 \label{exact-end}
3767 $\displaystyle \int_0^{\frac{\pi}{2}} \sin^3 x \cos x \, dx$
3768 \end{questions}
3769 \end{verbatim}
3770 you'll get
3771 \begin{questions}
3772 \question
3773 Approximate $\displaystyle \int_0^1 \sin x^2 \, dx$ within $.001$ of
3774 its true value.
3775
3776 \uplevel{Questions \ref{exact-start} through~\ref{exact-end} should
3777 be evaluated completely, not just approximated.}
3778
3779 \question
3780 \label{exact-start}
3781 $\displaystyle \int_0^1 \frac{x^2 \, dx}{\sqrt{1-x^2}}$
3782
3783 \question
3784 $\displaystyle \int_0^1 \frac{1}{1+x^2}\, dx$
3785
3786 \question
3787 \label{exact-end}
3788 $\displaystyle \int_0^{\frac{\pi}{2}} \sin^3 x \cos x \, dx$
3789 \end{questions}
3790 You can accomplish exactly the same thing by replacing
3791 \begin{verbatim}
3792 \uplevel{Questions \ref{exact-start} through~\ref{exact-end} should
3793 be evaluated completely, not just approximated.}
3794 \end{verbatim}
3795 by
3796 \begin{verbatim}
3797 \begin{EnvUplevel}
3798 Questions \ref{exact-start} through~\ref{exact-end} should be
3799 evaluated completely, not just approximated.
3800 \end{EnvUplevel}
3801 \end{verbatim}
3802 \indcstop{uplevel}
3803 \indtstop{EnvUplevel}
3804 \index{EnvUplevel environment|)}
3805 \index{environment!EnvUplevel|)}
3806
3807 \indcstart{fullwidth}
3808 \indtstart{EnvFullwidth}
3809 \index{EnvFullwidth environment|(}
3810 \index{environment!EnvFullwidth|(}
3811 If you want to give instructions that use the full width of the page
3812 (rather than just going up one level of indentation), then use the
3813 \verb"\fullwidth" command. For example, if you type
3814 \begin{verbatim}
3815 \begin{questions}
3816 \question
3817 This is the first question.
3818
3819 \question
3820 \begin{parts}
3821 \part
3822 This is the first part.
3823
3824 \part
3825 This is the second part.
3826 \begin{subparts}
3827 \subpart
3828 This is a subpart.
3829
3830 \fullwidth{When you finish this exam, you should go back and
3831 reexamine your work, both on this exam and in your life up
3832 until the day of this exam, for any errors that you may have
3833 made.}
3834
3835 \subpart
3836 This is another subpart.
3837 \end{subparts}
3838 \end{parts}
3839 \end{questions}
3840 \end{verbatim}
3841 then you'll get
3842 \begin{questions}
3843 \question
3844 This is the first question.
3845
3846 \question
3847 \begin{parts}
3848 \part
3849 This is the first part.
3850
3851 \part
3852 This is the second part.
3853 \begin{subparts}
3854 \subpart
3855 This is a subpart.
3856
3857 \fullwidth{When you finish this exam, you should go back and
3858 reexamine your work, both on this exam and in your life up
3859 until the day of this exam, for any errors that you may have
3860 made.}
3861
3862 \subpart
3863 This is another subpart.
3864 \end{subparts}
3865 \end{parts}
3866 \end{questions}
3867 You can accomplish exactly the same thing by replacing
3868 \begin{verbatim}
3869 \fullwidth{When you finish this exam, you should go back and
3870 reexamine your work, both on this exam and in your life up
3871 until the day of this exam, for any errors that you may have
3872 made.}
3873 \end{verbatim}
3874 by
3875 \begin{verbatim}
3876 \begin{EnvFullwidth}
3877 When you finish this exam, you should go back and
3878 reexamine your work, both on this exam and in your life up
3879 until the day of this exam, for any errors that you may have
3880 made.
3881 \end{EnvFullwidth}
3882 \end{verbatim}
3883 \indcstop{fullwidth}
3884 \indtstop{EnvFullwidth}
3885 \index{EnvFullwidth environment|)}
3886 \index{environment!EnvFullwidth|)}
3887
3888 \index{instructions|)}
3889
3890 %---------------------------------------------------------------------
3891 \subsection{Naming the parts of a long exam}
3892 \label{sec:Naming}
3893 \index{naming parts of the exam|(}
3894
3895 There are two ways of naming the parts of a long exam. The first way
3896 uses the \verb"\fullwidth"\indc{fullwidth} and
3897 \verb"\uplevel"\indc{uplevel} commands (see
3898 section~\ref{sec:Namefullwidth}), and the other way uses the standard
3899 %
3900 \verb"\part"\indcsub{part}{standard sectioning command}
3901 %
3902 and \verb"\section"\indc{section} commands (see
3903 section~\ref{sec:NameSection}).
3904
3905 %--------------------------------------------------------------------
3906 \subsubsection{Using \texttt{\bs uplevel} and \texttt{\bs fullwidth}}
3907 \label{sec:Namefullwidth}
3908 \indcstart{uplevel}
3909 \indcstart{fullwidth}
3910 \indtstart{EnvFullwidth}
3911 \index{EnvFullwidth environment|(}
3912 \index{environment!EnvFullwidth|(}
3913
3914 To place a section name in the exam, just use a \verb"\fullwidth"
3915 command (see section~\ref{sec:uplevel}) and include whatever font
3916 changing commands that you want to use. For example, if you type
3917 \begin{verbatim}
3918 \begin{questions}
3919 \question
3920 Is there, is there balm in Gilead?
3921
3922 \fullwidth{\Large \textbf{Essay questions}}
3923
3924 \question
3925 Explain how the cooling of matter in the centuries following the big
3926 bang has influenced the British parliamentary system of government.
3927
3928 \fullwidth{\Large \textbf{Laboratory questions}}
3929
3930 \question
3931 In the cabinet below your laboratory bench you will find a single
3932 edged razor blade, several C-clamps, and a bottle of whiskey.
3933 Remove your appendix. Do not suture until your work has been
3934 inspected.
3935 \end{questions}
3936 \end{verbatim}
3937 then you'll get
3938 \begin{questions}
3939 \question
3940 Is there, is there balm in Gilead?
3941
3942 \fullwidth{\Large \textbf{Essay questions}}
3943
3944 \question
3945 Explain how the cooling of matter in the centuries following the big
3946 bang has influenced the British parliamentary system of government.
3947
3948 \fullwidth{\Large \textbf{Laboratory questions}}
3949
3950 \question
3951 In the cabinet below your laboratory bench you will find a single
3952 edged razor blade, several C-clamps, and a bottle of whiskey.
3953 Remove your appendix. Do not suture until your work has been
3954 inspected.
3955 \end{questions}
3956 You can accomplish exactly the same thing by replacing
3957 \begin{verbatim}
3958 \fullwidth{\Large \textbf{Essay questions}}
3959 \end{verbatim}
3960 by
3961 \begin{verbatim}
3962 \begin{EnvFullwidth}
3963 \Large \textbf{Essay questions}
3964 \end{EnvFullwidth}
3965 \end{verbatim}
3966 and replacing
3967 \begin{verbatim}
3968 \fullwidth{\Large \textbf{Laboratory questions}}
3969 \end{verbatim}
3970 by
3971 \begin{verbatim}
3972 \begin{EnvFullwidth}
3973 \Large \textbf{Laboratory questions}
3974 \end{EnvFullwidth}
3975 \end{verbatim}
3976
3977
3978 \indcstop{fullwidth}
3979 \indtstop{EnvFullwidth}
3980 \index{EnvFullwidth environment|)}
3981 \index{environment!EnvFullwidth|)}
3982 \indcstop{uplevel}
3983
3984 %--------------------------------------------------------------------
3985 \subsubsection{Using the standard sectioning commands}
3986 \label{sec:NameSection}
3987
3988 The exam document class is built upon the standard article document
3989 class, and so the sectioning commands used with the article document
3990 class can be used here as well. In particular, you can give the
3991 commands \verb"\part",
3992 %
3993 \verb"\part"\indcsub{part}{standard sectioning command}
3994 %
3995 \verb"\part*", \verb"\section"\indc{section}, and \verb"\section*".
3996 The definitions made in \verb"exam.cls" ensure that if a \verb"\part"
3997 command appears \emph{outside of a parts environment} it will be
3998 interpreted as a sectioning command, while if it appears \emph{inside
3999 of a parts environment} it will be interpreted as beginning a new
4000 part of a question.
4001
4002 You can give these commands in the middle of a questions environment
4003 so as not to interrupt the numbering of the questions, or you can end
4004 a questions environment, give a sectioning command, and then start a
4005 new questions environment (which would reset the question counter to
4006 start again with number~1). If you have more than one questions
4007 environment, though, then you will be unable to use any of the
4008 commands that create grading\indc{gradetable} tables or
4009 point\indc{pointtable} tables (see section~\ref{sec:Tables}) or the
4010 commands that change the headers and footers depending on whether or
4011 not a question spans multiple pages (see
4012 section~\ref{sec:QuesSpan}).\indc{ifincomplete}\indc{ifcontinuation}
4013
4014 If you give any of these commands while inside of a questions
4015 environment, then the section titles will be indented to the same
4016 extent that questions are indented unless they are given as the
4017 argument of a \verb"\fullwidth"\indc{fullwidth} or
4018 \verb"\uplevel"\indc{uplevel} command. These commands have the
4019 advantage, however, that the unstarred versions provide automatic
4020 numbering of the parts or sections.
4021
4022
4023 \index{naming parts of the exam|)}
4024 \index{indentation|)}
4025
4026
4027 %--------------------------------------------------------------------
4028 %---------------------------------------------------------------------
4029 \section{Leaving space for the answers}
4030 \label{sec:LeaveSpace}
4031 \index{space!for answers|(}
4032 \index{answer space|(}
4033
4034 There are five different kinds of space that you can create:
4035 \begin{itemize}
4036 \item Blank space (see section~\ref{sec:BlankSpace}),
4037 \item an empty box (see section~\ref{sec:EmptyBox}),
4038 \item space filled with lines (see section~\ref{sec:FillLines}),
4039 \item space filled with dotted lines (see
4040 section~\ref{sec:FillDotLines}), and
4041 \item space filled with a grid (see section~\ref{sec:FillGrid}).
4042 \end{itemize}
4043 You can also create answer lines for short answer questions (see
4044 section~\ref{sec:ShortAns}).
4045 In section~\ref{sec:solutions} we describe five environments for
4046 typing solutions to questions:
4047 \begin{itemize}
4048 \item \texttt{solution},
4049 \item \texttt{solutionorbox},
4050 \item \texttt{solutionorlines},
4051 \item \texttt{solutionordottedlines}, and
4052 \item \texttt{solutionorgrid}.
4053 \end{itemize}
4054 Each of those environments can take an optional argument specifying an
4055 amount of space to be created when solutions are not being printed;
4056 see section~\ref{sec:SolSpace}.
4057
4058
4059 %--------------------------------------------------------------------
4060 \subsection{Leaving blank space}
4061 \label{sec:BlankSpace}
4062 \index{blank space|(}
4063 \index{space!blank|(}
4064
4065 To leave blank space on the page for the answer to a question, you
4066 should use the \verb"\vspace*"\indc{vspace*} command. For example,
4067 the command \verb"\vspace*{1in}" inserts one inch of vertical space
4068 after the line in which it appears. (If it appears in between
4069 paragraphs, then it inserts the space right there.) You can also use
4070 the \verb"\vspace"\indc{vspace} command, the difference being that
4071 space inserted by \verb"\vspace" will be deleted if it occurs at the
4072 top of a new page, whereas space inserted by \verb"\vspace*" will
4073 never be deleted.
4074
4075 If you want to leave all the remaining space on the page blank, you
4076 should give the commands\indc{stretch}
4077 \begin{center}
4078 \begin{tabular}{l}
4079 \verb"\vspace*{\stretch{1}}"\\
4080 \verb"\newpage"
4081 \end{tabular}
4082 \end{center}
4083 If you want to equally distribute the blank space among several
4084 questions on the page, then just put
4085 \verb"\vspace*{\stretch{1}}"\index{space!allocating} after each of the
4086 questions and use \verb"\newpage"\indc{newpage} to end the page. You
4087 can also distribute the available space in some other ratio. For
4088 example, to give one of the questions on the page twice as much space
4089 as any of the others, put \verb"\vspace*{\stretch{2}}" after that
4090 question and \verb"\vspace*{\stretch{1}}" after each of the others.
4091
4092 You can also leave blank space when solutions are not being printed by
4093 using an optional argument with a \verb"solution" environment; see
4094 section~\ref{sec:SolSpace}.
4095
4096 \index{space!blank|)}
4097 \index{blank space|)}
4098
4099 %--------------------------------------------------------------------
4100 \subsection{Printing an empty box}
4101 \label{sec:EmptyBox}
4102 \index{space!empty box|(}
4103 \index{empty box|(}
4104 \indcstart{makeemptybox}
4105
4106 You can print an empty box with the command
4107 \begin{center}
4108 \verb"\makeemptybox{length}"
4109 \end{center}
4110 which prints an empty box of height \verb"length" whose width equals
4111 that of the current line. That is, the left edge is at the current
4112 left margin (which depends on whether we're in a question, part,
4113 subpart, or subsubpart) and the right edge is at the right margin.
4114 (The box printed by the \verb"\makeemptybox" command can be printed in
4115 color; for that, see section~\ref{sec:colorboxes}.)
4116
4117
4118 \medskip
4119
4120 For example, if you type
4121 \begin{verbatim}
4122 \begin{questions}
4123 \question
4124 In no more than one paragraph, explain why the earth is round.
4125
4126 \makeemptybox{1in}
4127
4128 \question
4129 \begin{parts}
4130 \part
4131 What changes to the van Allen radiation belt are needed to make
4132 the earth into a regular icosahedron?
4133
4134 \makeemptybox{1in}
4135
4136 \part
4137 Where should the field generator be constructed if you want one of
4138 the vertices to be located at the Royal Observatory at Greenwich?
4139
4140 \makeemptybox{1in}
4141
4142 \end{parts}
4143 \end{questions}
4144 \end{verbatim}
4145 then you'll get
4146 \begin{questions}
4147 \question
4148 In no more than one paragraph, explain why the earth is round.
4149
4150 \makeemptybox{1in}
4151
4152 \question
4153 \begin{parts}
4154 \part
4155 What changes to the van Allen radiation belt are needed to make
4156 the earth into a regular icosahedron?
4157
4158 \makeemptybox{1in}
4159
4160 \part
4161 Where should the field generator be constructed if you want one of
4162 the vertices to be located at the Royal Observatory at Greenwich?
4163
4164 \makeemptybox{1in}
4165
4166 \end{parts}
4167 \end{questions}
4168
4169 \medskip
4170
4171 If you want to fill the remaining space on the page with an empty box,
4172 you should give the commands\indc{stretch}
4173 \begin{center}
4174 \begin{tabular}{l}
4175 \verb"\makeemptybox{\stretch{1}}"\\
4176 \verb"\newpage"
4177 \end{tabular}
4178 \end{center}
4179 If you want to equally distribute the space for the answers among
4180 several questions on the page, then just put
4181 \verb"\makeemptybox{\stretch{1}}"\index{space!allocating} after each
4182 of those questions and use \verb"\newpage"\indc{newpage} to end the
4183 page. You can also distribute the available space in some other
4184 ratio. For example, to give one of the questions on the page twice as
4185 much space as any of the others, put \verb"\makeemptybox{\stretch{2}}"
4186 after that question, \verb"\makeemptybox{\stretch{1}}" after each of
4187 the others, and use \verb"\newpage" to end the page.
4188
4189 You can also insert an empty box when solutions are not being printed
4190 by including an optional argument with the \verb"solutionoremptybox"
4191 environment; see section~\ref{sec:SolSpace}.
4192
4193
4194 \indcstop{makeemptybox}
4195 \index{empty box|)}
4196 \index{space!empty box|)}
4197
4198 %--------------------------------------------------------------------
4199 \subsection{Printing lined space}
4200 \label{sec:FillLines}
4201 \index{space!lined|(}
4202 \index{lined space|(}
4203 \indcstart{fillwithlines}
4204
4205
4206 You can fill space with lines with the command
4207 \begin{center}
4208 \verb"\fillwithlines{length}"
4209 \end{center}
4210 which fills vertical space of height \verb"length" with horizontal
4211 lines that run the length of the current line. That is, they extend
4212 from the current left margin (which depends on whether we're in a
4213 question, part, subpart, or subsubpart) to the right margin.
4214
4215 By default, the lines are in black. However, if you give the
4216 commands\indc{colorfillwithlines}\index{color package}
4217 \begin{center}
4218 \begin{tabular}{l}
4219 \verb"\usepackage{color}"\\
4220 \verb"\colorfillwithlines"
4221 \end{tabular}
4222 \end{center}
4223 (or \verb"\usepackage{xcolor}" instead of
4224 \verb"\usepackage{color}")(or \verb"\usepackage{xcolor}") then the
4225 lines will be in color, by default a light gray. That default color
4226 was defined by the command\indc{definecolor}\indt{FillWithLinesColor}
4227 \begin{center}
4228 \verb"\definecolor{FillWithLinesColor}{gray}{0.8}"
4229 \end{center}
4230 \index{customization!\texttt{\char`\\fillwithlines}} You can change
4231 the color by giving a new \verb"\definecolor" command to redefine the
4232 color \texttt{FillWithLinesColor}.
4233
4234 \medskip
4235
4236 For example, if you type
4237 \begin{verbatim}
4238 \begin{questions}
4239 \question
4240 In no more than one paragraph, explain why the earth is round.
4241
4242 \fillwithlines{1in}
4243
4244 \question
4245 \begin{parts}
4246 \part
4247 What changes to the van Allen radiation belt are needed to make
4248 the earth into a regular icosahedron?
4249
4250 \fillwithlines{1in}
4251
4252 \part
4253 Where should the field generator be constructed if you want one of
4254 the vertices to be located at the Royal Observatory at Greenwich?
4255
4256 \fillwithlines{1in}
4257
4258 \end{parts}
4259 \end{questions}
4260 \end{verbatim}
4261 then you'll get
4262 \begin{questions}
4263 \question
4264 In no more than one paragraph, explain why the earth is round.
4265
4266 \fillwithlines{1in}
4267
4268 \question
4269 \begin{parts}
4270 \part
4271 What changes to the van Allen radiation belt are needed to make
4272 the earth into a regular icosahedron?
4273
4274 \fillwithlines{1in}
4275
4276 \part
4277 Where should the field generator be constructed if you want one of
4278 the vertices to be located at the Royal Observatory at Greenwich?
4279
4280 \fillwithlines{1in}
4281
4282 \end{parts}
4283 \end{questions}
4284
4285 \medskip The distance between the lines is
4286 \verb"\linefillheight"\indc{linefillheight}, the default value of
4287 which is set with the
4288 command\index{customization!\texttt{\char`\\fillwithlines}}
4289 \begin{center}
4290 \verb"\setlength\linefillheight{.25in}"
4291 \end{center}
4292 That value can be changed by giving a new \verb"\setlength" command.
4293 The thickness of the lines is
4294 \verb"\linefillthickness"\indc{linefillthickness}, the default value
4295 of which is set with the command
4296 \begin{center}
4297 \verb"\setlength\linefillthickness{0.1pt}"
4298 \end{center}
4299 and that value can also be changed by giving a new \verb"\setlength"
4300 command.
4301
4302 If you want to fill the remaining space on the page with lines, you
4303 should give the commands\indc{stretch}
4304 \begin{center}
4305 \begin{tabular}{l}
4306 \verb"\fillwithlines{\stretch{1}}"\\
4307 \verb"\newpage"
4308 \end{tabular}
4309 \end{center}
4310 If you want to equally distribute the space for the answers among
4311 several questions on the page, then just put
4312 \verb"\fillwithlines{\stretch{1}}"\index{space!allocating} after each
4313 of those questions and use \verb"\newpage" to end the page. You can
4314 also distribute the available space in some other ratio. For example,
4315 to give one of the questions on the page twice as much space as any of
4316 the others, put \verb"\fillwithlines{\stretch{2}}" after that
4317 question, \verb"\fillwithlines{\stretch{1}}" after each of the others,
4318 and use \verb"\newpage" to end the page.
4319
4320 You can also insert lined space when solutions are not being printed
4321 by including an optional argument with the \verb"solutionorlines"
4322 environment; see section~\ref{sec:SolSpace}.
4323
4324 \indcstop{fillwithlines}
4325 \index{lined space|)}
4326 \index{space!lined|)}
4327
4328 %--------------------------------------------------------------------
4329 \subsection{Printing dotted lined space}
4330 \label{sec:FillDotLines}
4331 \index{space!dotted lined|(}
4332 \index{dotted lined space|(}
4333 \indcstart{fillwithdottedlines}
4334
4335
4336 You can fill space with dotted lines with the command
4337 \begin{center}
4338 \verb"\fillwithdottedlines{length}"
4339 \end{center}
4340 which fills vertical space of height \verb"length" with dotted
4341 horizontal lines that run the length of the current line. That is,
4342 they extend from the current left margin (which depends on whether
4343 we're in a question, part, subpart, or subsubpart) to the right
4344 margin. The command \verb"\fillwithdottedlines" is almost identical
4345 to the \verb"\fillwithlines" command (see
4346 section~\ref{sec:FillLines}), except that the lines created are dotted
4347 and the distance between the lines is
4348 \verb"\dottedlinefillheight"\indc{dottedlinefillheight}. The default
4349 value of \verb"\dottedlinefillheight" is set by the
4350 command\index{customization!\texttt{\char`\\fillwithdottedlines}}
4351 \begin{center}
4352 \verb"\setlength\dottedlinefillheight{.25in}"
4353 \end{center}
4354 and that value can be changed by giving a new \verb"\setlength"
4355 command.
4356
4357 By default, the dotted lines are in black. However, if you give the
4358 commands\indc{colorfillwithdottedlines}\index{color package}
4359 \begin{center}
4360 \begin{tabular}{l}
4361 \verb"\usepackage{color}"\\
4362 \verb"\colorfillwithdottedlines"
4363 \end{tabular}
4364 \end{center}
4365 (or \verb"\usepackage{xcolor}" instead of \verb"\usepackage{color}")
4366 then the dotted lines will be in color, by default a light gray. That
4367 default color was defined by the
4368 command\indc{definecolor}\indt{FillWithDottedLinesColor}
4369 \begin{center}
4370 \verb"\definecolor{FillWithDottedLinesColor}{gray}{0.8}"
4371 \end{center}
4372 \index{customization!\texttt{\char`\\fillwithdottedlines}} You can
4373 change the color by giving a new \verb"\definecolor" command to
4374 redefine the color \texttt{FillWithDottedLinesColor}.
4375
4376 \medskip
4377
4378 For example, if you type
4379 \begin{verbatim}
4380 \begin{questions}
4381 \question
4382 In no more than one paragraph, explain why the earth is round.
4383
4384 \fillwithdottedlines{1in}
4385
4386 \question
4387 \begin{parts}
4388 \part
4389 What changes to the van Allen radiation belt are needed to make
4390 the earth into a regular icosahedron?
4391
4392 \fillwithdottedlines{1in}
4393
4394 \part
4395 Where should the field generator be constructed if you want one of
4396 the vertices to be located at the Royal Observatory at Greenwich?
4397
4398 \fillwithdottedlines{1in}
4399
4400 \end{parts}
4401 \end{questions}
4402 \end{verbatim}
4403 then you'll get
4404 \begin{questions}
4405 \question
4406 In no more than one paragraph, explain why the earth is round.
4407
4408 \fillwithdottedlines{1in}
4409
4410 \question
4411 \begin{parts}
4412 \part
4413 What changes to the van Allen radiation belt are needed to make
4414 the earth into a regular icosahedron?
4415
4416 \fillwithdottedlines{1in}
4417
4418 \part
4419 Where should the field generator be constructed if you want one of
4420 the vertices to be located at the Royal Observatory at Greenwich?
4421
4422 \fillwithdottedlines{1in}
4423
4424 \end{parts}
4425 \end{questions}
4426
4427 If you want to fill the remaining space on the page with dotted lines,
4428 you should give the commands\indc{stretch}
4429 \begin{center}
4430 \begin{tabular}{l}
4431 \verb"\fillwithdottedlines{\stretch{1}}"\\
4432 \verb"\newpage"
4433 \end{tabular}
4434 \end{center}
4435 If you want to equally distribute the space for the answers among
4436 several questions on the page, then just put
4437 \verb"\fillwithdottedlines{\stretch{1}}"\index{space!allocating} after
4438 each question on the page and use \verb"\newpage" to end the page.
4439 You can also distribute the available space in some other ratio. For
4440 example, to give one of the questions on the page twice as much space
4441 as any of the others, put \verb"\fillwithdottedlines{\stretch{2}}"
4442 after that question, \verb"\fillwithdottedlines{\stretch{1}}" after
4443 each of the others, and use \verb"\newpage" to end the page.
4444
4445 You can also insert dotted lined space when solutions are not being
4446 printed by including an optional argument with the
4447 \verb"solutionordottedlines" environment; see
4448 section~\ref{sec:SolSpace}.
4449
4450 \indcstop{fillwithdottedlines}
4451 \index{dotted lined space|)}
4452 \index{space!dotted lined|)}
4453
4454 %--------------------------------------------------------------------
4455 \subsection{Printing space filled with a grid}
4456 \label{sec:FillGrid}
4457 \index{space!grid|(}
4458 \index{grid space|(}
4459 \indcstart{fillwithgrid}
4460
4461
4462 You can fill space with a grid with the command
4463 \begin{center}
4464 \verb"\fillwithgrid{length}"
4465 \end{center}
4466 which fills vertical space of height \texttt{length} with a grid that
4467 runs the length of the current line. That is, it extends from the
4468 current left margin (which depends on whether we're in a question,
4469 part, subpart, or subsubpart) to the right margin.
4470 The default grid size and grid line thickness were set by the
4471 commands
4472 \begin{center}
4473 \begin{tabular}{l}
4474 \verb"\setlength{\gridsize}{5mm}"\\
4475 \verb"\setlength{\gridlinewidth}{0.1pt}"
4476 \end{tabular}
4477 \end{center}
4478 \index{customization!\texttt{\char`\\fillwithgrid}} You can change
4479 either or both of those by giving new \verb"\setlength" commands. The
4480 period of the grid is \verb"\gridsize" (both horizontally and
4481 vertically). That is, the horizontal distance from the left edge of
4482 one vertical line to the left edge of the next vertical line is
4483 \verb"\gridsize", as is the vertical distance from the top edge of one
4484 horizontal line to the top edge of the next horizontal line. Thus,
4485 each square has outer side length equal to
4486 \verb"\gridsize+\gridlinewidth".
4487
4488 By default, the created grids are in black. However, if you give the
4489 commands\indc{colorgrids}\index{color package}
4490 \begin{center}
4491 \begin{tabular}{l}
4492 \verb"\usepackage{color}"\\
4493 \verb"\colorgrids"
4494 \end{tabular}
4495 \end{center}
4496 (or \verb"\usepackage{xcolor}" instead of \verb"\usepackage{color}")
4497 then the grids will be in color, by default a light gray. That
4498 default color was defined by the
4499 command\indc{definecolor}\indt{GridColor}
4500 \begin{center}
4501 \verb"\definecolor{GridColor}{gray}{0.8}"
4502 \end{center}
4503 \index{customization!\texttt{\char`\\fillwithgrid}} You can change the
4504 color by giving a new \verb"\definecolor" command to redefine the
4505 color \texttt{GridColor}.
4506
4507
4508 For example, if you type
4509 \begin{verbatim}
4510 \begin{questions}
4511 \question
4512 In no more than one paragraph, explain why the earth is round.
4513
4514 \smallskip\fillwithgrid{1in}
4515
4516 \question
4517 \begin{parts}
4518 \part
4519 What changes to the van Allen radiation belt are needed to make
4520 the earth into a regular icosahedron?
4521
4522 \smallskip\fillwithgrid{1in}
4523
4524 \part
4525 Where should the field generator be constructed if you want one of
4526 the vertices to be located at the Royal Observatory at Greenwich?
4527
4528 \smallskip\fillwithgrid{1in}
4529
4530 \end{parts}
4531 \end{questions}
4532 \end{verbatim}
4533 then you'll get
4534 \begin{questions}
4535 \question
4536 In no more than one paragraph, explain why the earth is round.
4537
4538 \smallskip\fillwithgrid{1in}
4539
4540 \question
4541 \begin{parts}
4542 \part
4543 What changes to the van Allen radiation belt are needed to make
4544 the earth into a regular icosahedron?
4545
4546 \smallskip\fillwithgrid{1in}
4547
4548 \part
4549 Where should the field generator be constructed if you want one of
4550 the vertices to be located at the Royal Observatory at Greenwich?
4551
4552 \smallskip\fillwithgrid{1in}
4553
4554 \end{parts}
4555 \end{questions}
4556
4557 If you want to fill the remaining space on the page with a grid, you
4558 should give the commands\indc{stretch}
4559 \begin{center}
4560 \begin{tabular}{l}
4561 \verb"\fillwithgrid{\stretch{1}}"\\
4562 \verb"\newpage"
4563 \end{tabular}
4564 \end{center}
4565 If you want to equally distribute the space for the answers among
4566 several questions on the page, then just put
4567 \verb"\fillwithgrid{\stretch{1}}"\index{space!allocating} after each
4568 question on the page and use \verb"\newpage" to end the page. You can
4569 also distribute the available space in some other ratio. For example,
4570 to give one of the questions on the page twice as much space as any of
4571 the others, put \verb"\fillwithgrid{\stretch{2}}" after that question,
4572 \verb"\fillwithgrid{\stretch{1}}" after each of the others, and use
4573 \verb"\newpage" to end the page.
4574
4575 You can also insert a grid only when solutions are not being
4576 printed by including an optional argument with the
4577 \verb"solutionorgrid" environment; see
4578 section~\ref{sec:SolSpace}.
4579
4580 %--------------------------------------------------------------------
4581 \subsubsection{Covering every page with a grid}
4582 \label{sec:CoverWGrid}
4583 \index{grid!covering every page}
4584
4585 If you'd like \emph{every} page to be completely covered by a grid,
4586 with the exam printed right on top of that grid, you can do that by
4587 using a \verb"\fillwithgrid" command in the footer. For this, make
4588 sure you're using either \verb"\pagestyle{headandfoot}" (the default)
4589 or \verb"\pagestyle{foot}" (see section~\ref{sec:pagestyle}), and put
4590 the following into your preamble (i.e., after the
4591 \verb"\documentclass" command and before the \verb"\begin{document}"
4592 command):\index{color package}\indc{gridfromfoot}
4593 \begin{verbatim}
4594 \usepackage{color}
4595 \colorgrids
4596 \newlength{\scratchlength}
4597 \newcommand{\gridfromfoot}{%
4598 \setlength{\scratchlength}{\textheight}%
4599 \addtolength{\scratchlength}{\baselineskip}%
4600 \leavevmode\rlap{\vbox to 0pt{%
4601 \vss
4602 \fillwithgrid{\scratchlength}%
4603 \vspace*{\footskip}%
4604 }% vbox
4605 }% rlap
4606 }% gridfromfoot
4607
4608 \footer{\gridfromfoot Math 115}
4609 {}
4610 {Page \thepage\ of \numpages}
4611 \end{verbatim}
4612 (You could also use \verb"\usepackage{xcolor}" instead of
4613 \verb"\usepackage{color}")
4614
4615 %--------------------------------------------------------------------
4616 \subsubsection{Printing graph paper}
4617 \label{sec:GraphPaper}
4618
4619 You can also use the \verb"\fillwithgrid" command to print graph
4620 paper:\index{graph paper}
4621 \begin{verbatim}
4622 \documentclass{exam}
4623 \pagestyle{empty}
4624 \begin{document}
4625
4626 \fillwithgrid{\stretch{1}}
4627
4628 \newpage
4629
4630 \fillwithgrid{\stretch{1}}
4631
4632 \end{document}
4633 \end{verbatim}
4634
4635
4636
4637 \indcstop{fillwithgrid}
4638 \index{grid space|)}
4639 \index{space!grid|)}
4640
4641
4642 %--------------------------------------------------------------------
4643 \subsection{Short answer questions}
4644 \label{sec:ShortAns}
4645 \indcstart{answerline}
4646 \index{short answers|(}
4647
4648 The exam class can print answer lines for short answer questions. The
4649 command
4650 \begin{center}
4651 \verb"\answerline"
4652 \end{center}
4653 leaves blank vertical space of length
4654 \verb"\answerskip"\indc{answerskip} and then inserts a horizontal line
4655 of length \verb"\answerlinelength"\indc{answerlinelength}%
4656 \index{customization!\texttt{\char`\\answerline}} at the right margin,
4657 preceded by the number of the current question, part, subpart, or
4658 subsubpart. The default values of \verb"\answerskip" and
4659 \verb"\answerlinelength" are set by the
4660 commands\index{customization!\texttt{\char`\\answerline}}
4661 \begin{center}
4662 \begin{tabular}{l}
4663 \verb"\setlength\answerskip{2ex}"\\
4664 \verb"\setlength\answerlinelength{1in}"
4665 \end{tabular}
4666 \end{center}
4667 and these can be changed by giving new \verb"\setlength" commands.
4668 If you use the command \verb"\answerline" outside of a
4669 \verb"questions" environment, then the number before the line will be
4670 omitted.
4671
4672 For example, if you type
4673 \begin{verbatim}
4674 \begin{questions}
4675 \question
4676 Who's buried in Grant's tomb?
4677 \answerline
4678
4679 \question
4680 What was the color of George Washington's white horse?
4681 \answerline
4682
4683 \question
4684 Which is heavier: A pound of feathers, or a pound of lead?
4685 \answerline
4686 \end{questions}
4687 \end{verbatim}
4688 then you'll get
4689 \begin{questions}
4690 \question
4691 Who's buried in Grant's tomb?
4692 \answerline
4693
4694 \question
4695 What was the color of George Washington's white horse?
4696 \answerline
4697
4698 \question
4699 Which is heavier: A pound of feathers, or a pound of lead?
4700 \answerline
4701 \end{questions}
4702 and if you type
4703 \begin{verbatim}
4704 \begin{questions}
4705 \question
4706 Answer the following questions on the lines at the right:
4707 \begin{parts}
4708 \part
4709 Who's buried in Grant's tomb? \answerline
4710
4711 \part
4712 \begin{subparts}
4713 \subpart
4714 What light through yonder window breaks? \answerline
4715
4716 \subpart
4717 To be, or not to be; that is the question? \answerline
4718 \end{subparts}
4719
4720 \part
4721 What was the color of George Washington's white horse? \answerline
4722 \end{parts}
4723 \end{questions}
4724 \end{verbatim}
4725 then you'll get
4726 \begin{questions}
4727 \question
4728 Answer the following questions on the lines at the right:
4729 \begin{parts}
4730 \part
4731 Who's buried in Grant's tomb? \answerline
4732
4733 \part
4734 \begin{subparts}
4735 \subpart
4736 What light through yonder window breaks? \answerline
4737
4738 \subpart
4739 To be, or not to be; that is the question? \answerline
4740 \end{subparts}
4741
4742 \part
4743 What was the color of George Washington's white horse? \answerline
4744 \end{parts}
4745 \end{questions}
4746
4747 %--------------------------------------------------------------------
4748 \subsection{Printing the answers to short answer questions}
4749 \label{sec:AnsShortAns}
4750 \index{short answers!answers to|(}
4751 \index{answers!to short answers|(}
4752
4753 The \verb"\answerline"\indcsub{answerline}{optional~argument} command
4754 can take an optional argument so that you can have the answer to the
4755 question printed on the answer line when answers are being printed
4756 (see section~\ref{sec:answers}). When answers are not being printed,
4757 the optional argument is ignored.
4758
4759 When answers are being printed, the optional argument is printed
4760 subject to the declarations in the argument of the last
4761 \verb"\CorrectChoiceEmphasis"\indc{CorrectChoiceEmphasis} command
4762 (which by default is
4763 \verb"\bfseries"\index{customization!\texttt{\char`\\CorrectChoice}};
4764 see section~\ref{sec:CorrectChoice}), and it is printed a distance of
4765 \verb"\answerclearance"\indc{answerclearance}%
4766 \index{customization!\texttt{\char`\\answerline}} above the line. The
4767 default value of \verb"\answerclearance" is set with the command
4768 \begin{center}
4769 \verb"\setlength\answerclearance{0.2ex}"
4770 \end{center}
4771 and it can be changed with a \verb"\setlength" command. The optional
4772 argument is centered on the answer line unless it is longer than the
4773 line, in which case it extends to the right of the line.
4774
4775 For example, if you type
4776 \begin{verbatim}
4777 \begin{questions}
4778 \question Who was the fifth Beatle? \answerline[Murray the K]
4779 \question What is the answer to the ultimate question of life, the
4780 universe, and everything? \answerline[42]
4781 \end{questions}
4782 \end{verbatim}
4783 and if \verb"\noprintanswers" (the default) is in effect, you'll get
4784 \begin{questions}
4785 \question Who was the fifth Beatle? \answerline[Murray the K]
4786 \question What is the answer to the ultimate question of life, the
4787 universe, and everything? \answerline[42]
4788 \end{questions}
4789 while if \verb"\printanswers" is in effect, you'll get \printanswers
4790 \begin{questions}
4791 \question Who was the fifth Beatle? \answerline[Murray the K]
4792 \question What is the answer to the ultimate question of life, the
4793 universe, and everything? \answerline[42]
4794 \end{questions}
4795 \noprintanswers
4796
4797 \index{answers!to short answers|)}
4798 \index{short answers!answers to|)}
4799
4800 \index{short answers|)}
4801 \indcstop{answerline}
4802
4803 \index{answer space|)}
4804 \index{space!for answers|)}
4805
4806 %--------------------------------------------------------------------
4807 %--------------------------------------------------------------------
4808 \section{Solutions}
4809 \label{sec:solutions}
4810
4811 %--------------------------------------------------------------------
4812 \subsection{Solution environments}
4813 \label{sec:SolEnv}
4814 \index{solutions|(}
4815 \index{solution environment@\texttt{solution} environment|(}
4816 \index{answers|(}
4817 \index{environment!solution@\texttt{solution}|(}
4818 \index{environment!solutionorbox@\texttt{solutionorbox}|(}
4819 \index{environment!solutionorlines@\texttt{solutionorlines}|(}
4820 \index{environment!solutionordottedlines@\texttt{solutionordottedlines}|(}
4821 \index{environment!solutionorgrid@\texttt{solutionorgrid}|(}
4822 \index{solutionorbox environment|(}
4823 \index{solutionorlines environment|(}
4824 \index{solutionordottedlines environment|(}
4825
4826
4827 There are six environments for typing solutions to the problems.
4828 These environments all allow you to either print the solutions or omit
4829 them with a single command. Whether or not solutions are
4830 printed is controlled by the two
4831 commands\indc{printanswers}\indc{noprintanswers}
4832 \begin{center}
4833 \begin{tabular}{l}
4834 \verb"\printanswers"\\
4835 \verb"\noprintanswers"
4836 \end{tabular}
4837 \end{center}
4838 Using these commands to turn printing of solutions on and off, you can
4839 print the solutions for the entire exam or for only certain parts of
4840 it. The default is that solutions are \emph{not} printed. There is
4841 also an \verb"answers"\indt{answers}\indcsub{documentclass}{options}
4842 option to the \verb"exam" document class, used as in
4843 \begin{center}
4844 \verb"\documentclass[answers]{exam}"
4845 \end{center}
4846 that is equivalent to giving the command
4847 \verb"\printanswers"\indc{printanswers} at the beginning of the
4848 document (see section~\ref{sec:answers}).
4849
4850 The six environments for solutions are divided into two types.
4851 \begin{itemize}
4852 \item The \texttt{solutionbox} environment (see
4853 section~\ref{sec:solutionbox}) always prints a box, of whatever size
4854 you choose, and if solutions are being printed it prints the
4855 solution inside of the box.
4856 \item Each of the remaining five (see section~\ref{sec:SolSpace}),
4857 \begin{center}
4858 \begin{tabular}{rll}
4859 the& \verb"solution"& environment,\\
4860 the& \verb"solutionorbox"& environment,\\
4861 the& \verb"solutionorlines"& environment,\\
4862 the& \verb"solutionordottedlines"& environment, and\\
4863 the& \verb"solutionorgrid"& environment,
4864 \end{tabular}
4865 \end{center}
4866 by default prints either the solution or nothing at all. However,
4867 they all can take one optional argument, which is an amount of space
4868 to be left when solutions are not being printed. If you use these
4869 environments without any optional arguments, then they are
4870 identical: They print either the solution or nothing at all. They
4871 differ only in the type of space they leave when you do include the
4872 optional argument and solutions are not being printed.
4873
4874 The differences between these five environments are that if the
4875 optional argument is used and solutions are not being printed, then
4876 %
4877 \index{solution environment@\texttt{solution} environment!optional argument}
4878 %
4879 \begin{itemize}
4880 \item the \verb"solution" environment inserts that amount of blank
4881 space, as if you had given a \verb"\vspace*"\indc{vspace*} command
4882 (or, if you've given the command
4883 \verb"\unstarredvspace"\indc{unstarredvspace}, as if you had given
4884 a \verb"\vspace"\indc{vspace} command) (see
4885 section~\ref{sec:BlankSpace}),
4886 \item the \verb"solutionorbox" environment inserts an empty box of
4887 that height, as if you had given a
4888 \verb"\makeemptybox"\indc{makeemptybox} command (see
4889 section~\ref{sec:EmptyBox}),
4890 \item the \verb"solutionorlines" environment inserts that amount of
4891 space with ruled lines, as if you had given a
4892 \verb"\fillwithlines"\indc{fillwithlines} command (see
4893 section~\ref{sec:FillLines}),
4894 \item the \verb"solutionordottedlines" environment inserts that
4895 amount of space with dotted lines, as if you had given a
4896 \verb"\fillwithdottedlines"\indc{fillwithdottedlines} command (see
4897 section~\ref{sec:FillDotLines}), and
4898 \item the \verb"solutionorgrid" environment inserts that amount of
4899 space filled with a grid, as if you had given a
4900 \verb"\fillwithgrid"\indc{fillwithgrid} command (see
4901 section~\ref{sec:FillGrid}).
4902 \end{itemize}
4903 \end{itemize}
4904
4905 Note that there are two commands that affect the space inserted by the
4906 optional argument to a \verb"solution" environment: The command
4907 \verb"\unstarredvspace"\indc{unstarredvspace} causes any space
4908 inserted by an optional argument to the \verb"solution" environment to
4909 be inserted using a \verb"\vspace" command, instead of the
4910 \verb"\vspace*" command. You can return to having such space inserted
4911 using a \verb"\vspace*" command by giving the command
4912 \verb"\nounstarredvspace"\indc{nounstarredvspace}.
4913
4914 You can use a parts, subparts, or subsubparts environment inside any
4915 of the solution environments without having their points (if any)
4916 counted as actual points on the exam. If there are points assigned to
4917 any of these commands inside any of the solution environments, those
4918 points are not added to the points of the question or the points on
4919 the page, and do not affect any gradetables or pointtables.
4920
4921
4922 \index{solutionorbox environment|)}
4923 \index{solutionorlines environment|)}
4924 \index{solutionordottedlines environment|)}
4925 \index{environment!solution@\texttt{solution}|)}
4926 \index{environment!solutionorbox@\texttt{solutionorbox}|)}
4927 \index{environment!solutionorlines@\texttt{solutionorlines}|)}
4928 \index{environment!solutionordottedlines@\texttt{solutionordottedlines}|)}
4929 \index{environment!solutionorgrid@\texttt{solutionorgrid}|)}
4930
4931 %--------------------------------------------------------------------
4932 \subsection{The appearance of the solution}
4933 \label{sec:SolAppear}
4934 \index{solution!appearance|(}
4935
4936 The solutions printed by the
4937 \begin{center}
4938 \begin{tabular}{l}
4939 \verb"solution",\\
4940 \verb"solutionorbox",\\
4941 \verb"solutionorlines",\\
4942 \verb"solutionordottedlines", and\\
4943 \verb"solutionorgrid"
4944 \end{tabular}
4945 \end{center}
4946 environments can be printed either
4947 \begin{itemize}
4948 \item in a box (i.e., an \verb"\fbox") (see section~\ref{sec:SolBox};
4949 this is the default),
4950 \item on a shaded background (see section~\ref{sec:shaded}), or
4951 \item with no framing or shading (see section~\ref{sec:SolPlain}).
4952 \end{itemize}
4953 In all of these cases, solutions can be broken across pages, and the
4954 part on each page will be boxed or shaded as appropriate. In
4955 addition, the \verb"\SolutionEmphasis" command can be used to
4956 highlight the text of the solution (using, e.g., boldface, or italics,
4957 or color); see section~\ref{sec:SolEmph}.
4958
4959
4960 %--------------------------------------------------------------------
4961 \subsubsection{Printing the solution in a box}
4962 \label{sec:SolBox}
4963 \index{solution!in a box|(}
4964
4965 By default, the solution is printed inside of a box (i.e., an
4966 \verb"\fbox"\indc{fbox}), and if the solution is broken across pages,
4967 then each piece is enclosed in a box. (The box can be printed in
4968 color; for that, see section~\ref{sec:colorboxes}.) There is also a
4969 \verb"\shadedsolutions"\indc{shadedsolutions} command to instead have
4970 the solution printed in a \verb"\colorbox"\indc{colorbox} (i.e.,
4971 printed on a shaded background); for this, you must load the
4972 %
4973 \verb"color"\index{color package} package and your printer must be
4974 capable of printing color, or at least grayscale (see
4975 section~\ref{sec:shaded}).
4976
4977 \medskip
4978
4979 For example, if you type
4980 \begin{verbatim}
4981 \begin{questions}
4982 \question Did you mutter something?
4983
4984 \begin{solution}
4985 Once upon a midnight dreary, while I pondered, weak and weary,
4986 Over many a quaint and curious volume of forgotten lore--- While I
4987 nodded, nearly napping, suddenly there came a tapping, As of some
4988 one gently rapping, rapping at my chamber door. ``\,'Tis some
4989 visitor,'' I muttered, ``tapping at my chamber door--- Only this
4990 and nothing more.''
4991 \end{solution}
4992 \end{questions}
4993 \end{verbatim}
4994 and you've given the command \verb"\printanswers"\indc{printanswers}
4995 or used the document class option \verb"answers"\indt{answers} (see
4996 section~\ref{sec:answers}), then you'll get \bigskip
4997 \begin{questions}
4998 \question Did you mutter something?
4999
5000 \begin{TheSolution}
5001 Once upon a midnight dreary, while I pondered, weak and weary,
5002 Over many a quaint and curious volume of forgotten lore--- While I
5003 nodded, nearly napping, suddenly there came a tapping, As of some
5004 one gently rapping, rapping at my chamber door. ``\,'Tis some
5005 visitor,'' I muttered, ``tapping at my chamber door--- Only this
5006 and nothing more.''
5007 \end{TheSolution}
5008 \end{questions}
5009 The result would be exactly the same if that \texttt{solution}
5010 environment were replaced by a \texttt{solutionorbox},
5011 \texttt{solutionorlines}, \texttt{solutionordottedlines}, or
5012 \texttt{solutionorgrid} environment.
5013
5014 By default, the solution is printed in a box whose width equals that
5015 of the text of the current question (or part, or subpart, or
5016 subsubpart). That is, the indentation at the left of the solution
5017 equals the current level of indentation. You can change this by
5018 enclosing the \texttt{solution}, \texttt{solutionorbox},
5019 \texttt{solutionorlines}, \texttt{solutionordottedlines}, or
5020 \texttt{solutionorgrid} environment in the argument of a
5021 \verb"\fullwidth"\indc{fullwidth} or \verb"\uplevel"\indc{uplevel}
5022 command, or inside of a \texttt{EnvFullwidth}\indt{EnvFullwidth}%
5023 \index{EnvFullwidth environment}\index{environment!EnvFullwidth} or
5024 %
5025 \texttt{EnvUplevel}\indt{EnvUplevel}\index{EnvUplevel environment}%
5026 \index{environment!EnvUplevel}%
5027 environment (see section~\ref{sec:uplevel}). For example, if you type
5028 \begin{verbatim}
5029 \begin{questions}
5030 \question Did you mutter something?
5031
5032 \begin{EnvFullwidth}
5033 \begin{TheSolution}
5034 Once upon a midnight dreary, while I pondered, weak and weary,
5035 Over many a quaint and curious volume of forgotten lore--- While
5036 I nodded, nearly napping, suddenly there came a tapping, As of
5037 some one gently rapping, rapping at my chamber door. ``\,'Tis
5038 some visitor,'' I muttered, ``tapping at my chamber door--- Only
5039 this and nothing more.''
5040 \end{TheSolution}
5041 \end{EnvFullwidth}
5042 \end{questions}
5043 \end{verbatim}
5044 and you've given the command \verb"\printanswers"\indc{printanswers}
5045 or used the document class option \verb"answers"\indt{answers}, then
5046 you'll get \bigskip
5047 \begin{questions}
5048 \question Did you mutter something?
5049
5050 \begin{EnvFullwidth}
5051 \begin{TheSolution}
5052 Once upon a midnight dreary, while I pondered, weak and weary,
5053 Over many a quaint and curious volume of forgotten lore--- While
5054 I nodded, nearly napping, suddenly there came a tapping, As of
5055 some one gently rapping, rapping at my chamber door. ``\,'Tis
5056 some visitor,'' I muttered, ``tapping at my chamber door--- Only
5057 this and nothing more.''
5058 \end{TheSolution}
5059 \end{EnvFullwidth}
5060 \end{questions}
5061
5062 With all of these environments, if solutions are not being printed
5063 then the contents of the environment are ignored. If, however, you
5064 include the optional argument (see section~\ref{sec:SolSpace}), then
5065 the requested amount of space (blank, lined, or dotted lined) will be
5066 inserted when the solution isn't printed.
5067
5068 \index{solution!in a box|)}
5069
5070 %--------------------------------------------------------------------
5071 \subsubsection{Printing the solution on a shaded background}
5072 \label{sec:shaded}
5073 \index{solution!shaded|(}
5074
5075 If you load the \verb"color" package with the
5076 command\index{color package}
5077 \begin{center}
5078 \verb"\usepackage{color}"
5079 \end{center}
5080 (or the \verb"xcolor" package with the command
5081 \verb"\usepackage{xcolor}") in the preamble of your document (i.e.,
5082 after the \verb"\documentclass" command and before the
5083 \verb"\begin{document}" command), then you can give the
5084 command\indc{shadedsolutions}
5085 \begin{center}
5086 \verb"\shadedsolutions"
5087 \end{center}
5088 This will cause solutions to be printed on a shaded background, which
5089 by default is a light gray. (Most laser printers can at least print
5090 grayscale when printing with the correct driver.) If you want to
5091 change the color of the shading, you can do so by redefining the color
5092 \verb"SolutionColor"\indc{SolutionColor}. For example, if you give
5093 the command
5094 \begin{center}
5095 \verb"\definecolor{SolutionColor}{rgb}{0.8,0.9,1}"
5096 \end{center}
5097 then the solutions will be printed on a light blue background
5098 (assuming that your printer is capable of producing that color).
5099
5100 If you want to switch back to printing solutions inside of an
5101 \verb"\fbox"\indc{fbox}, you can do so by giving the
5102 command\indc{framedsolutions}
5103 \begin{center}
5104 \verb"\framedsolutions"
5105 \end{center}
5106 which returns you to the default situation.
5107
5108 \index{solution!shaded|)}
5109
5110 %--------------------------------------------------------------------
5111 \subsubsection{Printing the solution with no framing or shading}
5112 \label{sec:SolPlain}
5113 \index{solution!no framing or shading|(}
5114
5115 If you give the command\indc{unframedsolutions}
5116 \begin{center}
5117 \verb"\unframedsolutions"
5118 \end{center}
5119 then solutions will be printed as normal text, with no framing or
5120 shading. If you use this option, you'll almost certainly want to use
5121 the command \verb"\SolutionEmphasis"\indc{SolutionEmphasis} (see
5122 section~\ref{sec:SolEmph}) to distinguish the solution from the
5123 surrounding text.
5124
5125 If you want to switch back to printing solutions inside of an
5126 \verb"\fbox", you can do so by giving the
5127 command\indc{framedsolutions}
5128 \begin{center}
5129 \verb"\framedsolutions"
5130 \end{center}
5131 which returns you to the default situation.
5132
5133 \index{solution!no framing or shading|)}
5134
5135 %--------------------------------------------------------------------
5136 \subsection{Imported graphics in solutions}
5137 \label{sec:graphics}
5138 \index{graphics|(}
5139 \indc{includegraphics}
5140
5141 Graphics can be included inside solution environments using the
5142 \verb"\includegraphics" command, as long as you've given the command
5143 \verb"\usepackage{graphicx}" in the preamble (i.e., after the
5144 \verb"\documentclass" command and before the \verb"\begin{document}"
5145 command).
5146
5147 A problem sometimes arises because many \LaTeX{} manuals say that you
5148 should put an \verb"\includegraphics" command inside of a
5149 \texttt{figure} environment, so that it will float to a convenient
5150 place on a page. The problem with this is that floating environments
5151 can't appear inside of a solution environment.
5152
5153 There are (at least) two solutions to this problem, depending on
5154 whether you really want the graphic to float away from the location at
5155 which you've typed it.
5156 \begin{itemize}
5157 \item If you want the graphic to float, put the \texttt{figure}
5158 environment \emph{outside} of the solution environment, using
5159 \verb"\ifprintanswers" to ensure that it's printed only when
5160 solutions are being printed, as in
5161 \begin{verbatim}
5162 \ifprintanswers
5163 \begin{figure}
5164 \includegraphics[width=7cm]{myfigure.pdf}
5165 \caption{This is a lovely figure}
5166 \label{fig:lovely}
5167 \end{figure}
5168 \fi
5169 \end{verbatim}
5170 \item If you \emph{don't} want the graphic to float, then omit the
5171 \texttt{figure} environment and just put the \verb"\includegraphics"
5172 command wherever you want the graphic to appear. If you want the
5173 graphic to have a caption, then put the command
5174 \verb"\usepackage{caption}" in your preamble and then use the
5175 \verb"\captionof" command, as in
5176 \begin{verbatim}
5177 \includegraphics[width=7cm]{myfigure.pdf}
5178 \captionof{figure}{This is a lovely figure}
5179 \label{fig:lovely}
5180 \end{verbatim}
5181 \end{itemize}
5182
5183 \index{graphics|)}
5184
5185 %--------------------------------------------------------------------
5186 \subsection{Customizing the solution}
5187 \label{sec:SolCust}
5188 \index{customization!solution|(}
5189 \index{solution!customizing|(}
5190
5191 The solutions printed by any of the solution environments (see
5192 section~\ref{sec:SolEnv}) can be customized:
5193 \begin{itemize}
5194 \item the title (by default, ``\textbf{Solution:}'') can be changed
5195 (see section~\ref{sec:SolTitle}),
5196 \item emphasis can be applied to the solution to distinguish it from
5197 the surrounding text (see section~\ref{sec:SolEmph}), and
5198 \item advanced users can entirely change the appearance of the
5199 solutions by defining a \LaTeX{} environment (see
5200 section~\ref{sec:AdvCust}).
5201 \end{itemize}
5202
5203 %--------------------------------------------------------------------
5204 \subsubsection{The title}
5205 \label{sec:SolTitle}
5206
5207 The word ``\textbf{Solution:}'' that you see at the beginning of the
5208 solutions printed by the \texttt{solution}, \texttt{solutionorbox},
5209 \texttt{solutionorlines}, and \texttt{solutionordottedlines}
5210 environments can be changed by redefining the command
5211 \verb"\solutiontitle"\indc{solutiontitle}. The default value was
5212 created by the command
5213 \begin{center}
5214 \verb"\newcommand{\solutiontitle}{\noindent\textbf{Solution:}\enspace}"
5215 \end{center}
5216 If, for example, you give the command
5217 \begin{center}
5218 \verb"\renewcommand{\solutiontitle}{\noindent\textbf{Solution:}\par\noindent}"
5219 \end{center}
5220 then the \verb"solution" environment above would print
5221 \renewcommand{\solutiontitle}{\noindent\textbf{Solution:}\par\noindent}
5222 \par\bigskip
5223 \begin{questions}
5224 \question Did you mutter something?
5225
5226 \begin{TheSolution}
5227 Once upon a midnight dreary, while I pondered, weak and weary, Over
5228 many a quaint and curious volume of forgotten lore--- While I
5229 nodded, nearly napping, suddenly there came a tapping, As of some
5230 one gently rapping, rapping at my chamber door. ``\,'Tis some
5231 visitor,'' I muttered, ``tapping at my chamber door--- Only this and
5232 nothing more.''
5233 \end{TheSolution}
5234 \end{questions}
5235 \renewcommand{\solutiontitle}{\noindent\textbf{Solution:}\enspace}
5236
5237 %--------------------------------------------------------------------
5238 \subsubsection{Solution emphasis}
5239 \label{sec:SolEmph}
5240
5241 You can change the appearance of the text of the solution with the
5242 \verb"\SolutionEmphasis"\indc{SolutionEmphasis} command. The contents
5243 of the solution are enclosed in a group, and that group is begun with
5244 the argument of the most recent
5245 \verb"\SolutionEmphasis"\indc{SolutionEmphasis} command. The default
5246 was created by the command
5247 \begin{center}
5248 \verb"\SolutionEmphasis{}"
5249 \end{center}
5250 That is, the default is not to add any emphasis at all. If, for
5251 example, you give the command
5252 \begin{center}
5253 \verb"\SolutionEmphasis{\itshape\small}"
5254 \end{center}
5255 then the solutions will be set in italics, in small type. For another
5256 example, if you've given the command \verb"\usepackage{color}" (or
5257 \verb"\usepackage{xcolor}") in the preamble of your document (i.e.,
5258 after the \verb"\documentclass" command and before the
5259 \verb"\begin{document}") and you give the
5260 command\indc{SolutionEmphasis}
5261 \begin{center}
5262 \verb"\SolutionEmphasis{\color{red}}"
5263 \end{center}
5264 then the solutions will be printed in red (assuming your printer is
5265 capable of producing that color).
5266
5267 \textbf{Note:} If you've given the command
5268 \verb"\unframedsolutions"\indc{unframedsolutions} (see
5269 section~\ref{sec:SolPlain}), so that solutions are printed as normal
5270 text with no framing or shading, then you'll almost certainly want to
5271 use the \verb"\SolutionEmphasis"\indc{SolutionEmphasis} command to
5272 create some visible difference between the solutions and the
5273 surrounding text.
5274
5275
5276 %--------------------------------------------------------------------
5277 \subsubsection{Advanced customizations}
5278 \label{sec:AdvCust}
5279 \index{TheSolution environment}
5280 \index{environment!TheSolution}
5281
5282 The appearance of all of these solution environments can actually be
5283 totally customized, if you're up to defining a \LaTeX{} environment.
5284 The appearance of the solution typed into any of these environments is
5285 defined by an environment called \verb"TheSolution"\indt{TheSolution},
5286 and you can change the definition of \verb"TheSolution" with a
5287 \verb"\renewenvironment" command. That is, the \verb"solution"
5288 environment decides whether the command \verb"\printanswers" has been
5289 given and, if so, it feeds the contents of the \verb"solution"
5290 environment into a \verb"TheSolution" environment. (The behavior of a
5291 \texttt{solutionorbox}, \texttt{solutionorlines} or
5292 \texttt{solutionordottedlines} environment is similar.) If you use
5293 \verb"\renewenvironment" to change the definition of the
5294 \verb"TheSolution" environment, you'll be changing the way the
5295 solution is printed. For the default definition of the
5296 \verb"TheSolution" environment, see the file \verb"exam.cls".
5297
5298 \index{solution!customizing|)}
5299 \index{customization!solution|)}
5300
5301 \index{solution!appearance|)}
5302
5303 %--------------------------------------------------------------------
5304 \subsection{Leaving space for the answers when solutions aren't
5305 printed}
5306 \label{sec:SolSpace}
5307 \index{space!for answers|(}
5308 \index{answer space|(}
5309 \index{solution environment@\texttt{solution} environment!optional argument|(}
5310
5311 Each of the \texttt{solution}, \texttt{solutionorbox},
5312 \texttt{solutionorlines}, \texttt{solutionordottedlines}, and
5313 \texttt{solutionorgrid} environments takes an optional argument:
5314 \begin{itemize}
5315 \item In a
5316 %
5317 \verb"solution"
5318 %
5319 \index{solution environment@\texttt{solution} environment!optional argument}
5320 %
5321 environment this is an amount of blank space to be left (just as if
5322 you had used a \verb"\vspace*"\indc{vspace*} command (or, if you've
5323 given the command \verb"\unstarredvspace"\indc{unstarredvspace}, as
5324 if you had given a \verb"\vspace"\indc{vspace} command); see
5325 section~\ref{sec:BlankSpace}) when solutions are not being printed,
5326 \item in a
5327 %
5328 \verb"solutionorbox"\indtsub{solutionorbox}{optional argument}
5329 %
5330 environment this is the height of an empty box to be drawn (just as
5331 if you had used a \verb"\makeemptybox"\indc{makeemptybox} command;
5332 see section~\ref{sec:EmptyBox}) when solutions are not being
5333 printed,
5334 \item in a
5335 %
5336 \verb"solutionorlines"\indtsub{solutionorlines}{optional argument}
5337 %
5338 environment this is an amount of lined space to be left (just as if
5339 you had used a \verb"\fillwithlines"\indc{fillwithlines} command;
5340 see section~\ref{sec:FillLines}) when solutions are not being
5341 printed,
5342 \item in a\indtsub{solutionordottedlines}{optional argument}
5343 \verb"solutionordottedlines" environment this is an amount of dotted
5344 lined space to be left (just as if you had used a
5345 \verb"\fillwithdottedlines"\indc{fillwithdottedlines} command; see
5346 section~\ref{sec:FillDotLines}) when solutions are not being
5347 printed.
5348 \item in a\indtsub{solutionorgrid}{optional argument}
5349 \verb"solutionorgrid" environment this is an amount of space to be
5350 filled with a grid (just as if you had used a
5351 \verb"\fillwithgrid"\indc{fillwithgrid} command; see
5352 section~\ref{sec:FillGrid}) when solutions are not being
5353 printed.
5354 \end{itemize}
5355 For example, if you type
5356 \begin{verbatim}
5357 \begin{solution}[2in]
5358 Once upon a midnight dreary, while I pondered, weak and weary, Over
5359 many a quaint and curious volume of forgotten lore--- While I
5360 nodded, nearly napping, suddenly there came a tapping, As of some
5361 one gently rapping, rapping at my chamber door. ``\,'Tis some
5362 visitor,'' I muttered, ``tapping at my chamber door--- Only this and
5363 nothing more.''
5364 \end{solution}
5365 \end{verbatim}
5366 then there will be 2 inches of blank space inserted (as if you had
5367 given the command \verb"\vspace*{2in}"; see
5368 section~\ref{sec:BlankSpace}) when solutions are not being printed, if
5369 you type
5370 \begin{verbatim}
5371 \begin{solutionorbox}[2in]
5372 Once upon a midnight dreary, while I pondered, weak and weary, Over
5373 many a quaint and curious volume of forgotten lore--- While I
5374 nodded, nearly napping, suddenly there came a tapping, As of some
5375 one gently rapping, rapping at my chamber door. ``\,'Tis some
5376 visitor,'' I muttered, ``tapping at my chamber door--- Only this and
5377 nothing more.''
5378 \end{solutionorbox}
5379 \end{verbatim}
5380 then there will be an empty box 2 inches tall inserted (as if you had
5381 given the command \verb"\makeemptybox{2in}"; see
5382 section~\ref{sec:EmptyBox}) when solutions are not being printed, if
5383 you type
5384 \begin{verbatim}
5385 \begin{solutionorlines}[2in]
5386 Once upon a midnight dreary, while I pondered, weak and weary, Over
5387 many a quaint and curious volume of forgotten lore--- While I
5388 nodded, nearly napping, suddenly there came a tapping, As of some
5389 one gently rapping, rapping at my chamber door. ``\,'Tis some
5390 visitor,'' I muttered, ``tapping at my chamber door--- Only this and
5391 nothing more.''
5392 \end{solutionorlines}
5393 \end{verbatim}
5394 then there will be 2 inches of lined space inserted (as if you had
5395 given the command \verb"\fillwithlines{2in}"; see
5396 section~\ref{sec:FillLines}) when solutions are not being printed, if
5397 you type
5398 \begin{verbatim}
5399 \begin{solutionordottedlines}[2in]
5400 Once upon a midnight dreary, while I pondered, weak and weary, Over
5401 many a quaint and curious volume of forgotten lore--- While I
5402 nodded, nearly napping, suddenly there came a tapping, As of some
5403 one gently rapping, rapping at my chamber door. ``\,'Tis some
5404 visitor,'' I muttered, ``tapping at my chamber door--- Only this and
5405 nothing more.''
5406 \end{solutionordottedlines}
5407 \end{verbatim}
5408 then there will be 2 inches of dotted lined space inserted (as if you
5409 had given the command \verb"\fillwithdottedlines{2in}"; see
5410 section~\ref{sec:FillDotLines}) when solutions are not being printed.
5411 and if you type
5412 \begin{verbatim}
5413 \begin{solutionorgrid}[2in]
5414 Once upon a midnight dreary, while I pondered, weak and weary, Over
5415 many a quaint and curious volume of forgotten lore--- While I
5416 nodded, nearly napping, suddenly there came a tapping, As of some
5417 one gently rapping, rapping at my chamber door. ``\,'Tis some
5418 visitor,'' I muttered, ``tapping at my chamber door--- Only this and
5419 nothing more.''
5420 \end{solutionordottedlines}
5421 \end{verbatim}
5422 then there will be 2 inches of grid inserted (as if you had given the
5423 command \verb"\fillwithgrid{2in}"; see section~\ref{sec:FillGrid})
5424 when solutions are not being printed.
5425
5426
5427 %--------------------------------------------------------------------
5428 \subsubsection{Cancelling the space from the optional arguments}
5429 \label{sec:cancelspace}
5430 \indcstart{cancelspace}
5431 \indcstart{nocancelspace}
5432
5433 If you've typed any of the environments \texttt{solution},
5434 \texttt{solutionorbox}, \texttt{solutionorlines},
5435 \texttt{solutionordottedlines}, or \texttt{solutionorgrid} (see
5436 section~\ref{sec:SolEnv}), and you've
5437 \begin{itemize}
5438 \item included an optional argument to leave space for answers when
5439 solutions are not being printed, but
5440 \item you would now like to print the exam \emph{without} printing the
5441 solutions and \emph{without} leaving space for the answers,
5442 \end{itemize}
5443 then you can cancel the space that would be created by the optional
5444 arguments by using the
5445 \texttt{cancelspace}\indt{cancelspace}\indcsub{documentclass}{options}
5446 document class option. That is, if you use the \verb"\documentclass"
5447 command
5448 \begin{center}
5449 \verb"\documentclass[cancelspace]{exam}"
5450 \end{center}
5451 then optional arguments to any of the four solution environments will
5452 be ignored. There are also commands \verb"\cancelspace" and
5453 \verb"\nocancelspace"; using the document class option
5454 \texttt{cancelspace} is equivalent to giving the command
5455 \verb"\cancelspace" at the beginning of the file. The command
5456 \verb"\nocancelspace" reverts to the default situation (in which the
5457 optional arguments are not ignored).
5458
5459 The document class option \texttt{cancelspace} has no effect at all if
5460 solutions are being printed.
5461
5462 \emph{Note:} The document class option \texttt{cancelspace} and the
5463 command \verb"\cancelspace" only affect the optional arguments of of
5464 the five solution environments \texttt{solution},
5465 \texttt{solutionorbox}, \texttt{solutionorlines},
5466 \texttt{solutionordottedlines}, and \texttt{solutionorgrid}; they do
5467 \emph{not} affect any \verb"\vspace" commands that you put into the
5468 file.
5469
5470 \indcstop{nocancelspace}
5471 \indcstop{cancelspace}
5472
5473 \index{solution environment@\texttt{solution} environment!optional argument|)}
5474
5475 %--------------------------------------------------------------------
5476 \subsection{The solutionbox environment}
5477 \label{sec:solutionbox}
5478 \indt{solutionbox}
5479 \index{solution!in a box}
5480
5481 The solutionbox environment is different from the other solution
5482 environments (\texttt{solution}, \texttt{solutionorbox},
5483 \texttt{solutionorlines}, \texttt{solutionordottedlines}, and
5484 \texttt{solutionorgrid}), in that
5485 \begin{enumerate}
5486 \item The box is always printed, whether answers are being printed or
5487 not.
5488 \item The argument giving the size of the box is a required argument,
5489 not an optional argument, and so it should be enclosed in braces,
5490 not in brackets. It can be either a length or
5491 \verb"\stretch{number}". Note: \emph{It is the user's
5492 responsibility to be sure that the box is large enough to hold the
5493 solution!} If the solution takes up too much vertical space, then
5494 it will spill out of the bottom of the box, overwriting whatever
5495 follows the box.
5496 \item The \texttt{solutionbox} environment makes no use of the
5497 \texttt{TheSolution} environment; the \texttt{solutionbox}
5498 environment is completely freestanding.
5499 \end{enumerate}
5500 If answers are not being printed then only the box is printed, with
5501 nothing in it. If answers are being printed, then the solution is
5502 printed inside of the box. (The box printed by the
5503 \texttt{solutionbox} environment can be printed in color; for that,
5504 see section~\ref{sec:colorboxes}.)
5505
5506
5507
5508 For example, if you type
5509 \begin{verbatim}
5510 \begin{solutionbox}{2in}
5511 Once upon a midnight dreary, while I pondered, weak and weary, Over
5512 many a quaint and curious volume of forgotten lore--- While I
5513 nodded, nearly napping, suddenly there came a tapping, As of some
5514 one gently rapping, rapping at my chamber door. ``\,'Tis some
5515 visitor,'' I muttered, ``tapping at my chamber door--- Only this and
5516 nothing more.''
5517 \end{solutionbox}
5518 \end{verbatim}
5519 (note that the amount of space is required, and is typed as
5520 ``\verb"{2in}"'', rather than ``\verb"[2in]"'') and solutions are not
5521 being printed, then you'll get
5522 \begin{solutionbox}{2in}
5523 Once upon a midnight dreary, while I pondered, weak and weary, Over
5524 many a quaint and curious volume of forgotten lore--- While I
5525 nodded, nearly napping, suddenly there came a tapping, As of some
5526 one gently rapping, rapping at my chamber door. ``\,'Tis some
5527 visitor,'' I muttered, ``tapping at my chamber door--- Only this and
5528 nothing more.''
5529 \end{solutionbox}
5530 If solutions \emph{are} being printed, then the exact same box would
5531 be printed, but it would have the solution printed inside of it.
5532
5533 \index{answer space|)}
5534 \index{space!for answers|)}
5535
5536 %--------------------------------------------------------------------
5537 \subsection{Solution box frames in color}
5538 \label{sec:colorboxes}
5539
5540 The frames that are printed by the commands that create solution boxes
5541 can be printed in color. (By ``frame'' we mean the four lines that
5542 constitute the box, not any solution that may appear inside that box.)
5543 This includes
5544 \begin{itemize}
5545 \item the box printed by the \texttt{solutionbox}
5546 environment\index{customization!\texttt{solutionbox}}
5547 (see section~\ref{sec:solutionbox}),
5548 \item the box printed by the \verb"\makeemptybox"
5549 command\index{customization!\texttt{\char`\\makeemptybox}}
5550 (see section~\ref{sec:EmptyBox}),
5551 \item the box printed by the optional argument of the
5552 \texttt{solutionorbox}
5553 environment\index{customization!\texttt{solutionorbox}} (see
5554 section~\ref{sec:SolEnv}), and
5555 \item the box printed around the solution by
5556 the\index{customization!\texttt{solution} environments}
5557 \begin{itemize}
5558 \item \texttt{solution},
5559 \item \texttt{solutionorbox},
5560 \item \texttt{solutionorlines},
5561 \item \texttt{solutionordottedlines}, and
5562 \item \texttt{solutionorgrid}
5563 \end{itemize}
5564 environments when solutions are being printed and the default
5565 solution appearance (\verb"\framedsolutions") is being used (see
5566 section~\ref{sec:SolBox}).
5567 \end{itemize}
5568
5569 If you've given the command
5570 \begin{center}
5571 \verb"\usepackage{color}"\index{color package}
5572 \end{center}
5573 (or \verb"\usepackage{xcolor}") in the preamble of your document
5574 (i.e., after the \verb"\documentclass" command and before the
5575 \verb"\begin{document}" command), then you can give the
5576 command\indc{colorsolutionboxes}
5577 \begin{center}
5578 \verb"\colorsolutionboxes"
5579 \end{center}
5580 to have the frame printed in color. The color of the frame will be
5581 \texttt{SolutionBoxColor}, the default value of which was created by
5582 the command\indc{definecolor}\indt{SolutionBoxColor}
5583 \begin{center}
5584 \verb"\definecolor{SolutionBoxColor}{gray}{0.8}"
5585 \end{center}
5586 You can change the color by giving a new \verb"\definecolor" command,
5587 but you must do this \emph{after} the \verb"\colorsolutionboxes"
5588 command.
5589
5590 To cancel color \texttt{solutionbox} frames and return to black, give
5591 the command\indc{nocolorsolutionboxes}
5592 \begin{center}
5593 \verb"\nocolorsolutionboxes"
5594 \end{center}
5595
5596 %--------------------------------------------------------------------
5597 \subsection{Equations inside solutions}
5598 \label{sec:EqsInSolutions}
5599
5600 If you use an \verb"equation" environment inside of a solution, then
5601 that environment (like all \verb"equation" environments) will be
5602 numbered using the \verb"equation" counter%
5603 \index{equation counter@\texttt{equation} counter}, which will affect
5604 the numbering of equations that follow. However, if you then print a
5605 version of your exam without using the \verb"\printanswers" command
5606 (or the documentclass option \verb"answers"), then the equation inside
5607 the solution environment will not appear, and this will change the
5608 equation numbers of the later \verb"equation" environments.
5609
5610 If you want to avoid having \verb"equation" numbers change depending
5611 on whether or not solutions are being printed, you can do this either
5612 by using the documentclass option
5613 \begin{center}
5614 \verb"solutionsreseteqcounter"
5615 \end{center}
5616 or by giving the command
5617 \begin{center}
5618 \verb"\solutionsreseteqcounter"\indc{solutionsreseteqcounter}
5619 \end{center}
5620 at the beginning of your file. That command causes equation numbers
5621 inside each solution to be independent of the equation numbers outside
5622 of the solution environment or in other solution environments.
5623
5624 In more detail: If you give the command
5625 \verb"\solutionsreseteqcounter" then every time you begin one of the
5626 solution environments, the \verb"equation" counter will be reset to
5627 zero (so that the first \verb"equation" environment in the solution
5628 will be number 1), and when you end that solution environment the
5629 \verb"equation" counter will be restored to whatever it was before the
5630 solution environment.
5631
5632 If you've given the command \verb"\solutionsreseteqcounter" and you
5633 want to change back to not having solutions reset the equation
5634 counter, you can do that by giving the command
5635 \begin{center}
5636 \verb"\nosolutionsreseteqcounter"\indc{nosolutionsreseteqcounter}
5637 \end{center}
5638
5639
5640
5641 %--------------------------------------------------------------------
5642 \subsection{Changes depending on whether or not solutions are
5643 being printed}
5644 \label{sec:ifprintanswers}
5645 \indcstart{ifprintanswers}
5646
5647 The command \verb"\ifprintanswers" is provided in case you want to
5648 vary what appears on the exam in ways other than those provided by the
5649 solution environments (see section~\ref{sec:solutions}), the
5650 \verb"\CorrectChoice" command in multiple choice environments (see
5651 section~\ref{sec:CorrectChoice}), and the optional argument to the
5652 \verb"\answerline" command (see section~\ref{sec:AnsShortAns}). You
5653 use this command by typing
5654 \begin{verbatim}
5655 \ifprintanswers
5656 Stuff to appear only when answers are being printed.
5657 \else
5658 Stuff to appear only when answers are not being printed.
5659 \fi
5660 \end{verbatim}
5661 The \verb"\else" clause is optional; you can also type
5662 \begin{verbatim}
5663 \ifprintanswers
5664 Stuff to appear only when answers are being printed.
5665 \fi
5666 \end{verbatim}
5667 If you want something printed only when answers are not being printed,
5668 you can type
5669 \begin{verbatim}
5670 \ifprintanswers
5671 \else
5672 Stuff to appear only when answers are not being printed.
5673 \fi
5674 \end{verbatim}
5675 Since the \verb"exam" document class automatically loads the
5676 \verb"ifthen" package, you can accomplish the same things using the
5677 \verb"\ifthenelse" command:
5678 \begin{verbatim}
5679 \ifthenelse{\boolean{printanswers}}
5680 {Stuff to appear only when answers are being printed.}
5681 {Stuff to appear only when answers are not being printed.}
5682 \end{verbatim}
5683 If you use \verb"\ifthenelse", then \verb"both" cases must be present,
5684 even if you leave one of them empty. Thus, e.g., if you want to print
5685 something only when answers are not being printed, you'd type
5686 \begin{verbatim}
5687 \ifthenelse{\boolean{printanswers}}
5688 {}
5689 {Stuff to appear only when answers are not being printed.}
5690 \end{verbatim}
5691
5692
5693 %--------------------------------------------------------------------
5694 \subsubsection{Printing only selected solutions}
5695 \label{sec:selectedsolutions}
5696 \index{selected solution}
5697 \index{solution!selected}
5698
5699 The \verb"\ifprintanswers" command can be used to print only certain
5700 of the solutions in an exam. To do that, you'd put the lines
5701 \begin{verbatim}
5702 \newif\ifprintselected
5703 \printselectedtrue
5704 %\printselectedfalse
5705
5706 \newenvironment{select}
5707 {\ifprintselected
5708 \printanswers
5709 \fi
5710 }
5711 {}
5712 \end{verbatim}
5713 into your preamble (i.e., after the \verb"\documentclass" command and
5714 before the \verb"\begin{document}" command). That defines a
5715 \texttt{select} environment, in which you can wrap any of the
5716 solution environments, as in
5717 \begin{verbatim}
5718 \begin{select}
5719 \begin{solutionorlines}[1in]
5720 Only when the number is two.
5721 \end{solutionorlines}
5722 \end{select}
5723 \end{verbatim}
5724 As long as you leave the command \verb"\printselectedtrue"
5725 uncommented, then everything wrapped in a \texttt{select} environment
5726 will be printed. If you comment out \verb"\printselectedtrue" and
5727 uncomment \verb"\printselectedfalse", then the \texttt{select}
5728 environment will have no effect.
5729
5730 \indcstop{ifprintanswers}
5731
5732 \index{answers|)}
5733 \index{solution environment@\texttt{solution} environment|)}
5734 \index{solutions|)}
5735
5736
5737 %--------------------------------------------------------------------
5738 %--------------------------------------------------------------------
5739 \section{Grading tables and point tables}
5740 \label{sec:Tables}
5741 \index{grading table|(}
5742 \index{point table|(}
5743 \indcstart{gradetable}
5744 \indcstart{pointtable}
5745
5746 \newlength\cwidth
5747
5748 The \verb"exam" document class can print either
5749 \begin{itemize}
5750 \item a grading table, indexed either by question number or by page
5751 number, which lists the points possible and leaves space for you to
5752 fill in (by hand) the points earned (see
5753 section~\ref{sec:GradeTables}), or
5754 \item a point table, indexed either by question number or by page
5755 number, which lists the points possible but does not leave space for
5756 you to fill in the points earned (see
5757 section~\ref{sec:PointTables}).
5758 \end{itemize}
5759 It's also possible to print either a grading table or point table to
5760 cover only part of the exam (see section~\ref{sec:PartialTable}).
5761
5762 If the exam has any bonus points (see section~\ref{sec:Bonus}), then
5763 the bonus points will be ignored by the tables described in sections
5764 \ref{sec:GradeTables}, \ref{sec:PointTables},
5765 and~\ref{sec:PartialTable}, but it's possible to print bonus grading
5766 tables and bonus point tables that list the bonus points and ignore
5767 the non-bonus points (see section~\ref{sec:BonusTables}) or combined
5768 grading tables and combined point tables that list both regular points
5769 and bonus points (see section~\ref{sec:CombinedTables}).
5770
5771 %--------------------------------------------------------------------
5772 \subsection{Grading tables indexed by question number or by page
5773 number}
5774 \label{sec:GradeTables}
5775 \index{grading table!by question number or page number|(}
5776
5777 The \verb"exam" document class can print a grading table, indexed
5778 either by question number or by page number. That is, you can print
5779 \begin{itemize}
5780 \item a table listing the question numbers (or question titles for
5781 questions created using the \verb"\titledquestion" command instead
5782 of the \verb"\question" command; see section~\ref{sec:Titled}) and
5783 the total points possible for each question (including all of its
5784 parts, subparts, and subsubparts) and leaving space for you to fill
5785 in (by hand) the points earned on each question, or
5786 \item a table listing each page that has at least one question, part,
5787 subpart, or subsubpart with points assigned to it, the total number
5788 of points possible on that page, and leaving space for you to fill
5789 in (by hand) the points earned on that page.
5790 \end{itemize}
5791 In order to use this feature you must either include the optional
5792 argument
5793 \verb"addpoints"\indt{addpoints}\indcsub{documentclass}{options} in
5794 your \verb"\documentclass" command (as in
5795 \verb"\documentclass[addpoints]{exam}") or give the command
5796 \verb"\addpoints"\indc{addpoints} (see section~\ref{sec:addpoints}),
5797 and there must be only one \verb"questions"
5798 %
5799 environment\index{questions environment!only one} in the entire exam.
5800 In addition, you must run \LaTeX{} twice after making any changes to
5801 the file in order to make sure that the point values are correct on a
5802 grading table indexed by question number and at least three times for
5803 a grading table indexed by page number. (Since the table appears on
5804 the third run of \LaTeX{}, and the space it occupies can change the
5805 page on which each question falls, it may take a fourth run of
5806 \LaTeX{} for the table to have the points per page correct.)
5807
5808 The command to create a grading table is
5809 \begin{center}
5810 \verb"\gradetable"
5811 \end{center}
5812 and it takes two optional
5813 arguments:\indc{gradetable[v]}\indc{gradetable[h]}
5814 \begin{enumerate}
5815 \item The first optional argument can be either \verb"[v]" or
5816 \verb"[h]", to choose between a vertically oriented table and a
5817 horizontally oriented table, and
5818 \item the second optional argument can be either \verb"[questions]" or
5819 \verb"[pages]", to choose between a table indexed by question number
5820 and a table indexed by page number.
5821 \end{enumerate}
5822 That is,\indc{gradetable[v][questions]}\indc{gradetable[v][pages]}%
5823 \indc{gradetable[h][questions]}\indc{gradetable[h][pages]}
5824 \begin{itemize}
5825 \item \verb"\gradetable[v][questions]" prints a vertically oriented
5826 table indexed by question number,
5827 \item \verb"\gradetable[h][questions]" prints a horizontally oriented
5828 table indexed by question number,
5829 \item \verb"\gradetable[v][pages]" prints a vertically oriented table
5830 indexed by page number, and
5831 \item \verb"\gradetable[h][pages]" prints a horizontally oriented
5832 table indexed by page number.
5833 \end{itemize}
5834 If you leave out the optional arguments (i.e., if you give the command
5835 as ``\verb"\gradetable"'') you'll get a vertically oriented table
5836 indexed by question number.
5837
5838 For example, if the exam has 8 questions, each worth a total of 15
5839 points, and you type
5840 \begin{verbatim}
5841 \begin{center}
5842 \gradetable[v][questions]
5843 \end{center}
5844 \end{verbatim}
5845 then you'll get
5846 \begin{center}
5847 \cwidth=2em
5848 \renewcommand{\arraystretch}{1.5}
5849 \begin{tabular}{|c|c|c|}
5850 \hline
5851 Question& Points& Score\\
5852 \hline
5853 1& 15& \hbox to \cwidth{\hfill}\\
5854 \hline
5855 2& 15& \hbox to \cwidth{\hfill}\\
5856 \hline
5857 3& 15& \hbox to \cwidth{\hfill}\\
5858 \hline
5859 4& 15& \hbox to \cwidth{\hfill}\\
5860 \hline
5861 5& 15& \hbox to \cwidth{\hfill}\\
5862 \hline
5863 6& 15& \hbox to \cwidth{\hfill}\\
5864 \hline
5865 7& 15& \hbox to \cwidth{\hfill}\\
5866 \hline
5867 8& 15& \hbox to \cwidth{\hfill}\\
5868 \hline
5869 Total:& 120&\\
5870 \hline
5871 \end{tabular}
5872 \end{center}
5873 and if you type
5874 \begin{verbatim}
5875 \begin{center}
5876 \gradetable[h][questions]
5877 \end{center}
5878 \end{verbatim}
5879 then you'll get
5880 \begin{center}
5881 \cwidth=2em
5882 \renewcommand{\arraystretch}{1.5}
5883 \begin{tabular}{|l|c|c|c|c|c|c|c|c|c|}
5884 \hline
5885 Question:& 1& 2& 3& 4& 5& 6& 7& 8& Total\\
5886 \hline
5887 Points:&
5888 15&
5889 15&
5890 15&
5891 15&
5892 15&
5893 15&
5894 15&
5895 15&
5896 120\\
5897 \hline
5898 Score:&
5899 \hbox to \cwidth{\hfill}&
5900 \hbox to \cwidth{\hfill}&
5901 \hbox to \cwidth{\hfill}&
5902 \hbox to \cwidth{\hfill}&
5903 \hbox to \cwidth{\hfill}&
5904 \hbox to \cwidth{\hfill}&
5905 \hbox to \cwidth{\hfill}&
5906 \hbox to \cwidth{\hfill}&
5907 \\
5908 \hline
5909 \end{tabular}
5910 \end{center}
5911 The number of points listed for a question is the sum of the point
5912 values for that question and all of its parts, subparts, and
5913 subsubparts.
5914
5915 If those 8 questions are distributed two to a page on each of pages 2
5916 through 5 and if you type
5917 \begin{verbatim}
5918 \begin{center}
5919 \gradetable[v][pages]
5920 \end{center}
5921 \end{verbatim}
5922 then you'll get
5923 \begin{center}
5924 \cwidth=2em
5925 \renewcommand{\arraystretch}{1.5}
5926 \begin{tabular}{|c|c|c|}
5927 \hline
5928 Page& Points& Score\\
5929 \hline
5930 2& 30& \hbox to \cwidth{\hfill}\\
5931 \hline
5932 3& 30& \hbox to \cwidth{\hfill}\\
5933 \hline
5934 4& 30& \hbox to \cwidth{\hfill}\\
5935 \hline
5936 5& 30& \hbox to \cwidth{\hfill}\\
5937 \hline
5938 Total:& 120&\\
5939 \hline
5940 \end{tabular}
5941 \end{center}
5942 and if you type
5943 \begin{verbatim}
5944 \begin{center}
5945 \gradetable[h][pages]
5946 \end{center}
5947 \end{verbatim}
5948 then you'll get
5949 \begin{center}
5950 \cwidth=2em
5951 \renewcommand{\arraystretch}{1.5}
5952 \begin{tabular}{|l|c|c|c|c|c|}
5953 \hline
5954 Page:& 2& 3& 4& 5& Total\\
5955 \hline
5956 Points:&
5957 30&
5958 30&
5959 30&
5960 30&
5961 120\\
5962 \hline
5963 Score:&
5964 \hbox to \cwidth{\hfill}&
5965 \hbox to \cwidth{\hfill}&
5966 \hbox to \cwidth{\hfill}&
5967 \hbox to \cwidth{\hfill}&
5968 \hbox to \cwidth{\hfill}
5969 \\
5970 \hline
5971 \end{tabular}
5972 \end{center}
5973
5974 \emph{Warning:} If you have a large number of questions on
5975 the exam, then these tables can easily become too large to fit on the
5976 page. If this becomes a problem, then you can either
5977 \begin{itemize}
5978 \item create grading ranges (see section~\ref{sec:PartialTable}) and
5979 print several partial grading tables, making each one small enough
5980 to fit on the page, or
5981 \item use the \verb"\multirowgradetable" or
5982 \verb"\multicolumngradetable" command (see section~\ref{sec:MulRows}
5983 and section~\ref{sec:MulCols}) to create a grading table with
5984 multiple rows or multiple columns.
5985 \end{itemize}
5986 \index{grading table!by question number or page number|)}
5987
5988 %--------------------------------------------------------------------
5989 \subsubsection{Grading tables with multiple rows}
5990 \label{sec:MulRows}
5991
5992 If you want to print a horizontal grading table but the table would be
5993 too large for the page, you can print a grading table with multiple
5994 rows by giving the command
5995 \begin{center}
5996 \verb"\multirowgradetable{numrows}[questions or pages]"
5997 \end{center}
5998 \indc{multirowgradetable}Note that the first argument
5999 (\texttt{numrows}) is \emph{required}, and so it is enclosed in
6000 braces, but the second argument (\texttt{questions} or \texttt{pages})
6001 is optional, and is enclosed in square brackets, just as in the
6002 \verb"\gradetable" command (see section~\ref{sec:GradeTables}). For
6003 example, to print a grading table with 3 rows indexed by questions,
6004 you would give the command
6005 \begin{center}
6006 \verb"\multirowgradetable{3}[questions]"
6007 \end{center}
6008 The command
6009 \begin{center}
6010 \verb"\gradetable[h][questions]"
6011 \end{center}
6012 is equivalent to
6013 \begin{center}
6014 \verb"\multirowgradetable{1}[questions]"
6015 \end{center}
6016
6017 The distance between the rows of a multirow table is
6018 \verb"\doublerulesep", the default value of which is 2.0pt. You can
6019 change that using a \verb"\setlength" command, as in
6020 \begin{center}
6021 \verb"\setlength{\doublerulesep}{0.5in}"
6022 \end{center}
6023 (see section~\ref{sec:CustTable}).
6024
6025 For example, if an exam has 16 questions, each worth a total of 15
6026 points, and you type
6027 \begin{verbatim}
6028 \begin{center}
6029 \setlength{\doublerulesep}{0.25in}
6030 \multirowgradetable{2}[questions]
6031 \end{center}
6032 \end{verbatim}
6033 then you'll get
6034 \begin{center}
6035 \setlength{\doublerulesep}{0.25in}
6036 \cwidth=2em
6037 \renewcommand{\arraystretch}{1.5}
6038 \begin{tabular}{|l|c|c|c|c|c|c|c|c|c|}
6039 \hline
6040 Question:& 1& 2& 3& 4& 5& 6& 7& 8& 9\\
6041 \hline
6042 Points:&
6043 15&
6044 15&
6045 15&
6046 15&
6047 15&
6048 15&
6049 15&
6050 15&
6051 15\\
6052 \hline
6053 Score:&
6054 \hbox to \cwidth{\hfill}&
6055 \hbox to \cwidth{\hfill}&
6056 \hbox to \cwidth{\hfill}&
6057 \hbox to \cwidth{\hfill}&
6058 \hbox to \cwidth{\hfill}&
6059 \hbox to \cwidth{\hfill}&
6060 \hbox to \cwidth{\hfill}&
6061 \hbox to \cwidth{\hfill}&
6062 \\
6063 \hline
6064 \hline
6065 Question:& 10& 11& 12& 13& 14& 15& 16&& Total\\
6066 \hline
6067 Points:&
6068 15&
6069 15&
6070 15&
6071 15&
6072 15&
6073 15&
6074 15&
6075 &
6076 240\\
6077 \hline
6078 Score:&
6079 \hbox to \cwidth{\hfill}&
6080 \hbox to \cwidth{\hfill}&
6081 \hbox to \cwidth{\hfill}&
6082 \hbox to \cwidth{\hfill}&
6083 \hbox to \cwidth{\hfill}&
6084 \hbox to \cwidth{\hfill}&
6085 \hbox to \cwidth{\hfill}&
6086 \hbox to \cwidth{\hfill}&
6087 \\
6088 \hline
6089 \end{tabular}
6090 \end{center}
6091
6092
6093 %--------------------------------------------------------------------
6094 \subsubsection{Grading tables with multiple columns}
6095 \label{sec:MulCols}
6096
6097 If you want to print a vertical grading table but the table would be
6098 too large for the page, you can print a grading table with multiple
6099 columns by giving the command
6100 \begin{center}
6101 \verb"\multicolumngradetable{numcols}[questions or pages]"
6102 \end{center}
6103 \indc{multicolumngradetable}Note that the first argument
6104 (\texttt{numcols}) is \emph{required}, and so it is enclosed in
6105 braces, but the second argument (\texttt{questions} or \texttt{pages})
6106 is optional, and is enclosed in square brackets, just as in the
6107 \verb"\gradetable" command (see section~\ref{sec:GradeTables}). For
6108 example, to print a grading table with 3 columns indexed by questions,
6109 you would give the command
6110 \begin{center}
6111 \verb"\multicolumngradetable{3}[questions]"
6112 \end{center}
6113 The command
6114 \begin{center}
6115 \verb"\gradetable[v][questions]"
6116 \end{center}
6117 is equivalent to
6118 \begin{center}
6119 \verb"\multicolumngradetable{1}[questions]"
6120 \end{center}
6121
6122 The distance between the columns of a multicolumn table is
6123 \verb"\doublerulesep", the default value of which is 2.0pt. You can
6124 change that using a \verb"\setlength" command, as in
6125 \begin{center}
6126 \verb"\setlength{\doublerulesep}{0.5in}"
6127 \end{center}
6128 (see section~\ref{sec:CustTable}).
6129
6130 For example, if an exam has 10 questions, each worth a total of 15
6131 points, and you type
6132 \begin{verbatim}
6133 \begin{center}
6134 \setlength{\doublerulesep}{0.5in}
6135 \multicolumngradetable{2}[questions]
6136 \end{center}
6137 \end{verbatim}
6138 then you'll get
6139 \begin{center}
6140 \cwidth=2em
6141 \setlength{\doublerulesep}{0.5in}
6142 \renewcommand{\arraystretch}{1.5}
6143 \begin{tabular}{|c|c|c|c|c|c|c|}
6144 \cline{1-3}\cline{5-7}
6145 Question& Points& Score&
6146 \hspace*{-\arrayrulewidth}\hspace*{\doublerulesep}&
6147 Question& Points& Score\\
6148 \cline{1-3}\cline{5-7}
6149 1& 15& \hbox to \cwidth{\hfill}&&7& 15& \hbox to \cwidth{\hfill}\\
6150 \cline{1-3}\cline{5-7}
6151 2& 15& \hbox to \cwidth{\hfill}&&8& 15& \hbox to \cwidth{\hfill}\\
6152 \cline{1-3}\cline{5-7}
6153 3& 15& \hbox to \cwidth{\hfill}&&9& 15& \hbox to \cwidth{\hfill}\\
6154 \cline{1-3}\cline{5-7}
6155 4& 15& \hbox to \cwidth{\hfill}&&10& 15& \hbox to \cwidth{\hfill}\\
6156 \cline{1-3}\cline{5-7}
6157 5& 15& \hbox to \cwidth{\hfill}&& & & \hbox to \cwidth{\hfill}\\
6158 \cline{1-3}\cline{5-7}
6159 6& 15& \hbox to \cwidth{\hfill}&&Total:& 150& \hbox to \cwidth{\hfill}\\
6160 \cline{1-3}\cline{5-7}
6161
6162 \cline{1-3}\cline{5-7}
6163 \end{tabular}
6164 \end{center}
6165
6166
6167
6168 %--------------------------------------------------------------------
6169 \subsection{Point tables indexed by question number or by page
6170 number}
6171 \label{sec:PointTables}
6172 \index{point table!by question number or page number|(}
6173
6174 Point tables are similar to grading tables (see
6175 section~\ref{sec:GradeTables}), except that there is no place in the
6176 table to fill in the points earned.
6177
6178 The command to create a point table is
6179 \begin{center}
6180 \verb"\pointtable"
6181 \end{center}
6182 and it takes two optional
6183 arguments:\indc{pointtable[v]}\indc{pointtable[h]}
6184 \begin{enumerate}
6185 \item The first optional argument can be either \verb"[v]" or
6186 \verb"[h]", to choose between a vertically oriented table and a
6187 horizontally oriented table, and
6188 \item the second optional argument can be either \verb"[questions]" or
6189 \verb"[pages]", to choose between a table indexed by question number
6190 and a table indexed by page number.
6191 \end{enumerate}
6192 That is,\indc{pointtable[v][questions]}\indc{pointtable[v][pages]}%
6193 \indc{pointtable[h][questions]}\indc{pointtable[h][pages]}
6194 \begin{itemize}
6195 \item \verb"\pointtable[v][questions]" prints a vertically oriented
6196 table indexed by question number,
6197 \item \verb"\pointtable[h][questions]" prints a horizontally oriented
6198 table indexed by question number,
6199 \item \verb"\pointtable[v][pages]" prints a vertically oriented table
6200 indexed by page number, and
6201 \item \verb"\pointtable[h][pages]" prints a horizontally oriented
6202 table indexed by page number.
6203 \end{itemize}
6204 If you leave out the optional arguments (i.e., if you give the command
6205 as ``\verb"\pointtable"'') you'll get a vertically oriented table
6206 indexed by question number.
6207
6208 For example, if the exam has 8 questions, each worth a total of 15
6209 points, and you type
6210 \begin{verbatim}
6211 \begin{center}
6212 \pointtable[v][questions]
6213 \end{center}
6214 \end{verbatim}
6215 then you'll get
6216 \begin{center}
6217 \cwidth=2em
6218 \renewcommand{\arraystretch}{1.5}
6219 \begin{tabular}{|c|c|}
6220 \hline
6221 Question& Points\\
6222 \hline
6223 1& 15\\
6224 \hline
6225 2& 15\\
6226 \hline
6227 3& 15\\
6228 \hline
6229 4& 15\\
6230 \hline
6231 5& 15\\
6232 \hline
6233 6& 15\\
6234 \hline
6235 7& 15\\
6236 \hline
6237 8& 15\\
6238 \hline
6239 Total:& 120\\
6240 \hline
6241 \end{tabular}
6242 \end{center}
6243 and if you type
6244 \begin{verbatim}
6245 \begin{center}
6246 \pointtable[h][questions]
6247 \end{center}
6248 \end{verbatim}
6249 then you'll get
6250 \begin{center}
6251 \cwidth=2em
6252 \renewcommand{\arraystretch}{1.5}
6253 \begin{tabular}{|l|c|c|c|c|c|c|c|c|c|}
6254 \hline
6255 Question:& 1& 2& 3& 4& 5& 6& 7& 8& Total\\
6256 \hline
6257 Points:&
6258 15&
6259 15&
6260 15&
6261 15&
6262 15&
6263 15&
6264 15&
6265 15&
6266 120\\
6267 \hline
6268 \end{tabular}
6269 \end{center}
6270 The number of points listed for a question is the sum of the point
6271 values for that question and all of its parts, subparts, and
6272 subsubparts.
6273
6274 If those 8 questions are distributed two to a page on each of pages 2
6275 through 5 and if you type
6276 \begin{verbatim}
6277 \begin{center}
6278 \pointtable[v][pages]
6279 \end{center}
6280 \end{verbatim}
6281 then you'll get
6282 \begin{center}
6283 \cwidth=2em
6284 \renewcommand{\arraystretch}{1.5}
6285 \begin{tabular}{|c|c|}
6286 \hline
6287 Page& Points\\
6288 \hline
6289 2& 30\\
6290 \hline
6291 3& 30\\
6292 \hline
6293 4& 30\\
6294 \hline
6295 5& 30\\
6296 \hline
6297 Total:& 120\\
6298 \hline
6299 \end{tabular}
6300 \end{center}
6301 and if you type
6302 \begin{verbatim}
6303 \begin{center}
6304 \pointtable[h][pages]
6305 \end{center}
6306 \end{verbatim}
6307 then you'll get
6308 \begin{center}
6309 \cwidth=2em
6310 \renewcommand{\arraystretch}{1.5}
6311 \begin{tabular}{|l|c|c|c|c|c|}
6312 \hline
6313 Page:& 2& 3& 4& 5& Total\\
6314 \hline
6315 Points:&
6316 30&
6317 30&
6318 30&
6319 30&
6320 120\\
6321 \hline
6322 \end{tabular}
6323 \end{center}
6324
6325 \emph{Warning:} If you have a large number of questions on
6326 the exam, then these tables can easily become too large to fit on the
6327 page. If this becomes a problem, then you can either
6328 \begin{itemize}
6329 \item create grading ranges (see section~\ref{sec:PartialTable}) and
6330 print several partial point tables, making each one small enough
6331 to fit on the page, or
6332 \item use the \verb"\multirowpointtable" or
6333 \verb"\multicolumnpointtable" command (see
6334 section~\ref{sec:PtMulRows} and section~\ref{sec:PtMulCols}) to
6335 create a point table with multiple rows or multiple columns.
6336 \end{itemize}
6337 \index{point table!by question number or page number|)}
6338
6339 %--------------------------------------------------------------------
6340 \subsubsection{Point tables with multiple rows}
6341 \label{sec:PtMulRows}
6342
6343 If you want to print a horizontal point table but the table would be
6344 too large for the page, you can print a point table with multiple
6345 rows by giving the command
6346 \begin{center}
6347 \verb"\multirowpointtable{numrows}[questions or pages]"
6348 \end{center}
6349 \indc{multirowpointtable}Note that the first argument
6350 (\texttt{numrows}) is \emph{required}, and so it is enclosed in
6351 braces, but the second argument (\texttt{questions} or \texttt{pages})
6352 is optional, and is enclosed in square brackets, just as in the
6353 \verb"\pointtable" command (see section~\ref{sec:PointTables}). For
6354 example, to print a point table with 3 rows indexed by questions, you
6355 would give the command
6356 \begin{center}
6357 \verb"\multirowpointtable{3}[questions]"
6358 \end{center}
6359 The command
6360 \begin{center}
6361 \verb"\pointtable[h][questions]"
6362 \end{center}
6363 is equivalent to
6364 \begin{center}
6365 \verb"\multirowpointtable{1}[questions]"
6366 \end{center}
6367
6368 The distance between the rows of a multirow table is
6369 \verb"\doublerulesep", the default value of which is 2.0pt. You can
6370 change that using a \verb"\setlength" command, as in
6371 \begin{center}
6372 \verb"\setlength{\doublerulesep}{0.5in}"
6373 \end{center}
6374 (see section~\ref{sec:CustTable}).
6375
6376 %--------------------------------------------------------------------
6377 \subsubsection{Point tables with multiple columns}
6378 \label{sec:PtMulCols}
6379
6380 If you want to print a vertical point table but the table would be
6381 too large for the page, you can print a point table with multiple
6382 columns by giving the command
6383 \begin{center}
6384 \verb"\multicolumnpointtable{numcols}[questions or pages]"
6385 \end{center}
6386 \indc{multicolumnpointtable}Note that the first argument
6387 (\texttt{numcols}) is \emph{required}, and so it is enclosed in
6388 braces, but the second argument (\texttt{questions} or \texttt{pages})
6389 is optional, and is enclosed in square brackets, just as in the
6390 \verb"\pointtable" command (see section~\ref{sec:PointTables}). For
6391 example, to print a point table with 3 columns indexed by questions,
6392 you would give the command
6393 \begin{center}
6394 \verb"\multicolumnpointtable{3}[questions]"
6395 \end{center}
6396 The command
6397 \begin{center}
6398 \verb"\pointtable[v][questions]"
6399 \end{center}
6400 is equivalent to
6401 \begin{center}
6402 \verb"\multicolumnpointtable{1}[questions]"
6403 \end{center}
6404
6405 The distance between the columns of a multicolumn table is
6406 \verb"\doublerulesep", the default value of which is 2.0pt. You can
6407 change that using a \verb"\setlength" command, as in
6408 \begin{center}
6409 \verb"\setlength{\doublerulesep}{0.5in}"
6410 \end{center}
6411 (see section~\ref{sec:CustTable}).
6412
6413 %--------------------------------------------------------------------
6414 \subsection{Table entries as clickable links}
6415 \label{sec:Clickable}
6416 \index{grading table!clickable links}
6417 \index{point table!clickable links}
6418 \index{clickable links}
6419
6420 If you put the command\indc{usepackage\{hyperref\}}\indt{hyperref}
6421 \begin{center}
6422 \verb"\usepackage{hyperref}"
6423 \end{center}
6424 into the preamble of your document (i.e., after the
6425 \verb"\documentclass" command and before the \verb"\begin{document}"
6426 command) and then produce a pdf file (either using dvipdf or
6427 directly by using pdflatex), then
6428 \begin{itemize}
6429 \item in a grading table or point table indexed by question number the
6430 question numbers in the table will be clickable links that take you
6431 to the corresponding question, and
6432 \item in a grading table or point table indexed by page number the
6433 page numbers in the table will be clickable links that take you to
6434 the corresponding page.
6435 \end{itemize}
6436 If you create questions using the \verb"\titledquestion" command
6437 instead of the \verb"\question" command (see
6438 section~\ref{sec:Titled}), then a grading table or point table indexed
6439 by question number will show the \emph{titles} of those questions
6440 instead of the numbers of those questions, and those question titles
6441 will be clickable links that take you to the corresponding question.
6442
6443 %--------------------------------------------------------------------
6444 \subsection{Grading ranges, partial grading tables, and partial point
6445 tables}
6446 \label{sec:PartialTable}
6447 \index{grading range|(}
6448 \indcstart{begingradingrange}
6449 \indcstart{endgradingrange}
6450 \index{range!grading|(}
6451
6452 It is possible to define one or more ``grading ranges'', and then to
6453 count the points in a range and create grading tables and point tables
6454 that cover only that range.
6455
6456 In more detail: You can define a grading range by choosing a name with
6457 which to label the range, e.g., ``myrange'', and then putting the
6458 command
6459 \begin{itemize}
6460 \item[] \verb"\begingradingrange{myrange}" at the start of the range
6461 and the command
6462 \item[] \verb"\endgradingrange{myrange}" at the end of the range.
6463 \end{itemize}
6464 You can then use the commands
6465 \begin{itemize}
6466 \item \verb"\pointsinrange{myrange}"\indc{pointsinrange}, which will
6467 expand to the number of points in the range,
6468 \item \verb"\firstqinrange{myrange}"\indc{firstqinrange}, which will
6469 expand to the number of the first question in the range,
6470 \item \verb"\lastqinrange{myrange}"\indc{lastqinrange}, which will
6471 expand to the number of the last question in the range, and
6472 \item \verb"\numqinrange{myrange}"\indc{numqinrange}, which will
6473 expand to the number of questions in the range.
6474 \end{itemize}
6475 You can define as many grading ranges as you like, wherever you like.
6476 That is, grading ranges do \emph{not} need to be nested; you can begin
6477 the range \texttt{otherrange} somewhere in the middle of the range
6478 \texttt{myrange} and then end the range \texttt{otherrange} after the
6479 end of \texttt{myrange}.
6480
6481 You can create a grading table or point table that covers only the
6482 questions in a range by using the
6483 \verb"\partialgradetable"\indc{partialgradetable} or
6484 \verb"\partialpointtable"\indc{partialpointtable} command. These are
6485 similar to the \verb"\gradetable" and \verb"\pointtable" commands,
6486 except that they each have one required argument (the name of the
6487 grading range) before the two optional arguments (the first of which
6488 must be either \verb"[v]" or \verb"[h]" and the second of which must
6489 be either \verb"[questions]" or \verb"[pages]"). For example, the
6490 command
6491 \begin{center}
6492 \verb"\partialgradetable{myrange}[v][questions]"
6493 \end{center}
6494 would create a vertically grading oriented table indexed by the
6495 questions in the range, and the command
6496 \begin{center}
6497 \verb"\partialgradetable{myrange}[v][pages]"
6498 \end{center}
6499 would create a vertically oriented grading table indexed by all pages
6500 with points starting with the page containing the command
6501 \verb"\begingradingrange{myrange}" and ending with the page containing
6502 the command \verb"\endgradingrange{myrange}"
6503
6504 If the exam has any bonus points (see section~\ref{sec:Bonus}), then
6505 the bonus points will be ignored by the \verb"\pointsinrange",
6506 \verb"\partialgradetable", and \verb"\partialpointtable" commands, but
6507 they will be counted by the \verb"\bonuspointsinrange" command (see
6508 section~\ref{sec:BonusTables}) and tabulated by the
6509 \verb"\partialbonusgradetable", \verb"\partialbonuspointtable",
6510 \verb"\partialcombinedgradetable", and
6511 \verb"\partialcombinedponttable" commands (see
6512 section~\ref{sec:BonusTables} and section~\ref{sec:CombinedTables}).
6513
6514 \index{range!grading|)}
6515 \indcstop{endgradingrange}
6516 \indcstop{begingradingrange}
6517 \index{grading range|)}
6518
6519
6520 %--------------------------------------------------------------------
6521 \subsubsection{Partial grading tables and partial point tables with
6522 multiple rows}
6523 \label{sec:PartMulRows}
6524
6525 If you want to print a horizontal partial grading table or partial
6526 point table but the table would be too large for the page, you can
6527 print a partial grading table or partial point table with multiple
6528 rows by giving the one of the commands
6529 \begin{center}
6530 \verb"\multirowpartialgradetable{numrows}{rangename}[questions or pages]"
6531 \verb"\multirowpartialpointtable{numrows}{rangename}[questions or pages]"
6532 \end{center}
6533 \indc{multirowpartialgradetable}\indc{multirowpartialpointtable}Note
6534 that the first two arguments (\texttt{numrows} and \texttt{rangename})
6535 are \emph{required}, and so they are enclosed in braces, but the third
6536 argument (\texttt{questions} or \texttt{pages}) is optional, and is
6537 enclosed in square brackets, just as in the \verb"\partialgradetable"
6538 and \verb"\partialpointtable" commands (see
6539 section~\ref{sec:PartialTable}). For example, to print a partial
6540 grading table with 3 rows covering the range \texttt{myrange} indexed
6541 by questions, you would give the command
6542 \begin{center}
6543 \verb"\multirowpartialgradetable{3}{myrange}[questions]"
6544 \end{center}
6545 The command
6546 \begin{center}
6547 \verb"\partialgradetable{myrange}[h][questions]"
6548 \end{center}
6549 is equivalent to
6550 \begin{center}
6551 \verb"\multirowpartialgradetable{1}{myrange}[questions]"
6552 \end{center}
6553
6554 The distance between the rows of a multirow table is
6555 \verb"\doublerulesep", the default value of which is 2.0pt. You can
6556 change that using a \verb"\setlength" command, as in
6557 \begin{center}
6558 \verb"\setlength{\doublerulesep}{0.5in}"
6559 \end{center}
6560 (see section~\ref{sec:CustTable}).
6561
6562 %--------------------------------------------------------------------
6563 \subsubsection{Partial grading tables and partial point tables with
6564 multiple columns}
6565 \label{sec:PartMulCols}
6566
6567 If you want to print a vertical partial grading table or partial point
6568 table but the table would be too large for the page, you can print a
6569 partial grading table or partial point table with multiple columns by
6570 giving one of the commands
6571 \begin{center}
6572 \verb"\multicolumnpartialgradetable{numcols}{rangename}[questions or pages]"\\
6573 \verb"\multicolumnpartialpointtable{numcols}{rangename}[questions or pages]"
6574 \end{center}
6575 \indc{multicolumnpartialgradetable}\indc{multicolumnpartialpointtable}Note
6576 that the first two arguments (\texttt{numcols} and
6577 \texttt{rangename}) are \emph{required}, and so they are enclosed in
6578 braces, but the third argument (\texttt{questions} or \texttt{pages})
6579 is optional, and is enclosed in square brackets, just as in the
6580 \verb"\partialgradetable" and \verb"\partialpointtable" commands (see
6581 section~\ref{sec:PartialTable}). For example, to print a partial
6582 grading table with 3 columns covering the range \texttt{myrange}
6583 indexed by questions, you would give the command
6584 \begin{center}
6585 \verb"\multicolumnpartialgradetable{3}{myrange}[questions]"
6586 \end{center}
6587 The command
6588 \begin{center}
6589 \verb"\partialgradetable{myrange}[v][questions]"
6590 \end{center}
6591 is equivalent to
6592 \begin{center}
6593 \verb"\multicolumnpartialgradetable{1}{myrange}[questions]"
6594 \end{center}
6595
6596 The distance between the columns of a multicolumn table is
6597 \verb"\doublerulesep", the default value of which is 2.0pt. You can
6598 change that using a \verb"\setlength" command, as in
6599 \begin{center}
6600 \verb"\setlength{\doublerulesep}{0.5in}"
6601 \end{center}
6602 (see section~\ref{sec:CustTable}).
6603
6604 %--------------------------------------------------------------------
6605 \subsection{\texttt{\bs pointsofquestion}}
6606 \label{sec:pointsofq}
6607
6608 If you use the document class option \verb"addpoints"\indt{addpoints}
6609 (as in
6610 \verb"\documentclass[addpoints]{exam}"\indcsub{documentclass}{options})
6611 or give the command \verb"\addpoints"\indc{addpoints} (see
6612 section~\ref{sec:addpoints}), then you can use
6613 the\indc{pointsofquestion}
6614 \begin{center}
6615 \verb"\pointsofquestion"
6616 \end{center}
6617 command. This command takes one argument, which must be the number of
6618 a question on the exam, and it prints the total number of points for
6619 that question. That is:
6620 \begin{itemize}
6621 \item \verb"\pointsofquestion{1}" prints the sum of the point values
6622 for question 1 and all of its parts, subparts, and subsubparts.
6623 \item \verb"\pointsofquestion{2}" prints the sum of the point values
6624 for question 2 and all of its parts, subparts, and subsubparts.
6625 \item Etc.
6626 \end{itemize}
6627 The \verb"\pointsofquestion" command is used by the \verb"\gradetable"
6628 and \verb"\pointtable" commands (see section~\ref{sec:Tables}),
6629 and it can be used to create a table using \LaTeX's \verb"tabular"
6630 environment when the tables produced using the \verb"\gradetable" and
6631 \verb"\pointtable" commands either don't fit on the page or are
6632 unsuitable for some other reason. It can also be used in a
6633 \verb"\qformat" command to list the total number of points of all
6634 parts, subparts, and subsubparts of a question on the line with the
6635 question number (see section~\ref{sec:adding}).
6636
6637 The \verb"\pointsofquestion"\indc{pointsofquestion} command ignores
6638 any bonus points that you may have created (see
6639 section~\ref{sec:Bonus}). The \verb"\bonuspointsofquestion" command,
6640 however, counts the bonus points (see section~\ref{sec:BonusTables}).
6641
6642 %--------------------------------------------------------------------
6643 \subsection{\texttt{\bs pointsonpage}}
6644 \label{sec:pointsonp}
6645
6646 If you use the document class option \verb"addpoints"\indt{addpoints}
6647 (as in
6648 \verb"\documentclass[addpoints]{exam}"\indcsub{documentclass}{options})
6649 or give the command \verb"\addpoints"\indc{addpoints} (see
6650 section~\ref{sec:addpoints}), then you can use the
6651 \verb"\pointsonpage"\indc{pointsonpage} command. This command takes
6652 one argument, which must be the number of a page of the exam, and it
6653 prints the total number of points for all the questions, parts,
6654 subparts, and subsubparts on that page. That is:
6655 \begin{itemize}
6656 \item \verb"\pointsonpage{1}" prints the sum of the point values for
6657 all questions, etc., on page 1,
6658 \item \verb"\pointsonpage{2}" prints the sum of the point values for
6659 all questions, etc., on page 2,
6660 \item Etc.
6661 \end{itemize}
6662 This command can be used to create a table using \LaTeX's
6663 \verb"tabular" environment when the tables produced using the
6664 \verb"\gradetable" and \verb"\pointtable" commands either don't fit on
6665 the page or are unsuitable for some other reason. It can also be used
6666 in headers and footers to print on each page the total number of
6667 points available on that page; for example, the command
6668 \begin{verbatim}
6669 \runningfooter{}
6670 {}
6671 {Points earned: \makebox[1in]{\hrulefill}
6672 out of a possible \pointsonpage{\thepage} points}
6673 \end{verbatim}
6674 \indcsub{pointsonpage}{in footer} (see
6675 section~\ref{sec:runningfooter}) will produce the footer
6676 \samplefoot{}{}{}{Points earned: \makebox[1in]{\hrulefill} out of a
6677 possible 20 points} on all pages after the first. (For another
6678 example, see section~\ref{sec:PtsPgEx})
6679
6680 \textbf{Caution:} The command \verb"\pointsonpage{\thepage}" will work
6681 reliably only in headers and footers, since the command
6682 %
6683 \verb"\thepage"\indcsub{thepage}{reliable only in headers and footers}
6684 will work reliably only in headers and footers.
6685
6686 The \verb"\pointsonpage" command ignores any bonus points that you may
6687 have created (see section~\ref{sec:Bonus}). The
6688 \verb"\bonuspointsonpage" command, however, counts the bonus points
6689 (see section~\ref{sec:BonusTables}).
6690
6691 %--------------------------------------------------------------------
6692 \subsection{Bonus grading tables and bonus point tables}
6693 \label{sec:BonusTables}
6694 \index{grading table!bonus|(}
6695 \index{point table!bonus|(}
6696
6697 If your exam contains any bonus
6698 %
6699 points\index{bonus points}\index{points!bonus} (see
6700 section~\ref{sec:Bonus}), then those bonus points will be ignored by
6701 the grading table and point table commands described in sections
6702 \ref{sec:GradeTables}, \ref{sec:PointTables},
6703 and~\ref{sec:PartialTable} and by the
6704 \verb"\pointsofquestion"\indc{pointsofquestion} (see
6705 section~\ref{sec:pointsofq}) and
6706 \verb"\pointsonpage"\indc{pointsonpage} (see
6707 section~\ref{sec:pointsonp}) commands. There are, however, analogous
6708 commands that count only the bonus points and ignore the non-bonus
6709 points. (There are also commands that create tables listing both
6710 non-bonus and bonus points; see section~\ref{sec:CombinedTables}.)
6711 These commands, and the non-bonus commands to which they correspond,
6712 are as follows:
6713 \begin{center}
6714 \begin{tabular}{l@{\qquad\qquad}l}
6715 Bonus points& Non-bonus points\\[\bigskipamount]
6716 \verb"\bonusgradetable"& \verb"\gradetable"\\
6717 \verb"\multirowbonusgradetable"& \verb"\multirowgradetable"\\
6718 \verb"\multicolumnbonusgradetable"& \verb"\multicolumngradetable"\\
6719 \verb"\bonuspointtable"& \verb"\pointtable"\\
6720 \verb"\multirowbonuspointtable"& \verb"\multirowpointtable"\\
6721 \verb"\multicolumnbonuspointtable"&
6722 \verb"\multicolumnpointtable"\\[\medskipamount]
6723 \verb"\partialbonusgradetable"& \verb"\partialgradetable"\\
6724 \verb"\multirowpartialbonusgradetable"&
6725 \verb"\multirowpartialgradetable"\\
6726 \verb"\multicolumnpartialbonusgradetable"&
6727 \verb"\multicolumnpartialgradetable"\\
6728 \verb"\partialbonuspointtable"&
6729 \verb"\partialpointtable"\\
6730 \verb"\multirowpartialbonuspointtable"&
6731 \verb"\multirowpartialpointtable"\\
6732 \verb"\multicolumnpartialbonuspointtable"&
6733 \verb"\multicolumnpartialpointtable"\\[\medskipamount]
6734 \verb"\bonuspointsinrange"& \verb"\pointsinrange"\\
6735 \verb"\bonuspointsofquestion"& \verb"\pointsofquestion"\\
6736 \verb"\bonuspointsonpage"& \verb"\pointsonpage"
6737 \end{tabular}
6738 \end{center}
6739 \indc{bonusgradetable}\indc{bonuspointtable}%
6740 \indc{bonuspointsinrange}\indc{partialbonusgradetable}%
6741 \indc{partialbonuspointtable}\indc{bonuspointsofquestion}%
6742 \indc{bonuspointsonpage}%
6743 \indc{multirowbonusgradetable}%
6744 \indc{multicolumnbonusgradetable}%
6745 \indc{multirowbonuspointtable}%
6746 \indc{multicolumnbonuspointtable}%
6747 \indc{multirowpartialbonusgradetable}%
6748 \indc{multicolumnpartialbonusgradetable}%
6749 \indc{multirowpartialbonuspointtable}%
6750 \indc{multicolumnpartialbonuspointtable}%
6751 All of the the commands in the first column count bonus points and
6752 ignore non-bonus points, while all of the commands in the second
6753 column count non-bonus points and ignore bonus points. The commands
6754 \begin{center}
6755 \begin{tabular}{l}
6756 \verb"\partialbonusgradetable",\\
6757 \verb"\multirowpartialbonusgradetable",\\
6758 \verb"\multicolumnpartialbonusgradetable",\\
6759 \verb"\partialbonuspointtable",\\
6760 \verb"\multirowpartialbonuspointtable", and\\
6761 \verb"\multicolumnpartialbonuspointtable"
6762 \end{tabular}
6763 \end{center}
6764 use the same \verb"\begingradingrange"\indc{begingradingrange} and
6765 \verb"\endgradingrange"\indc{endgradingrange} commands that are used
6766 by the corresponding non-bonus versions (see
6767 section~\ref{sec:PartialTable}). Just as is described in
6768 section~\ref{sec:Clickable} for their non-bonus counterparts, if you
6769 put the command\indc{usepackage\{hyperref\}}\indt{hyperref}
6770 \begin{center}
6771 \verb"\usepackage{hyperref}"
6772 \end{center}
6773 into the preamble of your document (i.e., after the
6774 \verb"\documentclass" command and before the \verb"\begin{document}"
6775 command) and then produce a pdf file (either using dvipdf or
6776 directly by using pdflatex),
6777 %
6778 then\index{clickable links}
6779 \begin{itemize}
6780 \item in a bonus grading table or bonus point table indexed by
6781 question number, the question numbers (or question titles, if you
6782 used \verb"\bonustitledquestion"; see section~\ref{sec:Bonus}) in
6783 the table will be clickable links that take you to the corresponding
6784 question, and
6785 \item in a bonus grading table or bonus point table indexed by page
6786 number the page numbers in the table will be clickable links that
6787 take you to the corresponding page.
6788 \end{itemize}
6789
6790 For example, if the exam has 8 questions, with each odd numbered
6791 question worth a total of 10 regular points and each even numbered
6792 question worth a total of 5 bonus points, and you type
6793 \begin{verbatim}
6794 \begin{center}
6795 \bonusgradetable[h][questions]
6796 \end{center}
6797 \end{verbatim}
6798 then you'll get
6799 \begin{center}
6800 \cwidth=2em
6801 \renewcommand{\arraystretch}{1.5}
6802 \begin{tabular}{|l|c|c|c|c|c|c|c|c|c|}
6803 \hline
6804 Question:& 1& 2& 3& 4& 5& 6& 7& 8& Total\\
6805 \hline
6806 Bonus Points:&
6807 0&
6808 5&
6809 0&
6810 5&
6811 0&
6812 5&
6813 0&
6814 5&
6815 20\\
6816 \hline
6817 Score:&
6818 \hbox to \cwidth{\hfill}&
6819 \hbox to \cwidth{\hfill}&
6820 \hbox to \cwidth{\hfill}&
6821 \hbox to \cwidth{\hfill}&
6822 \hbox to \cwidth{\hfill}&
6823 \hbox to \cwidth{\hfill}&
6824 \hbox to \cwidth{\hfill}&
6825 \hbox to \cwidth{\hfill}&\\
6826 \hline
6827 \end{tabular}
6828 \end{center}
6829
6830 \index{point table!bonus|)}
6831 \index{grading table!bonus|)}
6832
6833 %--------------------------------------------------------------------
6834 \subsection{Combined grading tables and combined point tables}
6835 \label{sec:CombinedTables}
6836 \index{grading table!combined|(}
6837 \index{point table!combined|(}
6838
6839
6840 There are commands for producing \emph{combined} grading and point
6841 tables, both partial and full, that tabulate both regular points and
6842 bonus points (see section~\ref{sec:Bonus}). The single-row and
6843 single-column versions of these commands, and the
6844 non-bonus and bonus commands to which they correspond, are
6845 \indc{combinedgradetable}\indc{combinedpointtable}%
6846 \indc{partialcombinedgradetable}\indc{partialcombinedpointtable}%
6847 \begin{center}
6848 \begin{tabular}{l@{\enskip}l@{\enskip}l}
6849 Non-Bonus points only& \multicolumn{1}{c}{Bonus points only}&
6850 \multicolumn{1}{c}{Combined}\\[\medskipamount]
6851 \verb"\gradetable"& \verb"\bonusgradetable"&
6852 \verb"\combinedgradetable"\\
6853 \verb"\pointtable"& \verb"\bonuspointtable"&
6854 \verb"\combinedpointtable"\\
6855 \verb"\partialgradetable"& \verb"\partialbonusgradetable"&
6856 \verb"\partialcombinedgradetable"\\
6857 \verb"\partialpointtable"& \verb"\partialbonuspointtable"&
6858 \verb"\partialcombinedpointtable"
6859 \end{tabular}
6860 \end{center}
6861 The first two commands in each column take two optional arguments, the
6862 first being either \verb"[v]" or \verb"[h]" and the second being
6863 either \verb"[questions]" or \verb"[pages]". The last two commands in
6864 each column take one required argument, the name of the grading range
6865 (defined using the \verb"\begingradingrange" and
6866 \verb"\endgradingrange" commands; see section~\ref{sec:PartialTable}),
6867 and then the same two optional arguments as the other commands (the
6868 first being either \verb"[v]" or \verb"[h]" and the second being
6869 either \verb"[questions]" or \verb"[pages]").
6870
6871 The multirow and multicolumn versions of combined grading tables and
6872 combined point tables are produced by the commands
6873 \indc{multirowcombinedgradetable}%
6874 \indc{multirowcombinedpointtable}%
6875 \indc{multirowpartialcombinedgradetable}%
6876 \indc{multirowpartialcombinedpointtable}%
6877 \indc{multicolumncombinedgradetable}%
6878 \indc{multicolumncombinedpointtable}%
6879 \indc{multicolumnpartialcombinedgradetable}%
6880 \indc{multicolumnpartialcombinedpointtable}%
6881 \begin{verbatim}
6882 \multirowcombinedgradetable{numrows}[questions or pages]
6883 \multirowcombinedpointtable{numrows}[questions or pages]
6884 \multirowpartialcombinedgradetable{numrows}{rangename}[questions or pages]
6885 \multirowpartialcombinedpointtable{numrows}{rangename}[questions or pages]
6886 \multicolumncombinedgradetable{numcols}[questions or pages]
6887 \multicolumncombinedpointtable{numcols}[questions or pages]
6888 \multicolumnpartialcombinedgradetable{numcols}{rangename}[questions or pages]
6889 \multicolumnpartialcombinedpointtable{numcols}{rangename}[questions or pages]
6890 \end{verbatim}
6891 The distance between the rows of a multirow table and between the
6892 columns of a multicolumn table is \verb"\doublerulesep", the default
6893 value of which is 2.0pt. You can change that using a
6894 \verb"\setlength" command, as in
6895 \begin{center}
6896 \verb"\setlength{\doublerulesep}{0.5in}"
6897 \end{center}
6898 (see section~\ref{sec:CustTable}).
6899
6900
6901
6902 Just as is described in section~\ref{sec:Clickable} for their regular
6903 points and section~\ref{sec:BonusTables} for bonus points, if you put
6904 the
6905 %
6906 command\index{clickable links}\indc{usepackage\{hyperref\}}%
6907 \indt{hyperref}
6908 \begin{center}
6909 \verb"\usepackage{hyperref}"
6910 \end{center}
6911 into the preamble of your document (i.e., after the
6912 \verb"\documentclass" command and before the \verb"\begin{document}"
6913 command) and then produce a pdf file (either using dvipdf or
6914 directly by using pdflatex), then
6915 \begin{itemize}
6916 \item in a combined grading table or combined point table indexed by
6917 question number, the question numbers (or question titles, if you
6918 used either \verb"\titledquestion" (see section~\ref{sec:Titled}) or
6919 \verb"\bonustitledquestion" (see section~\ref{sec:Bonus})) in the
6920 table will be clickable links that take you to the corresponding
6921 question, and
6922 \item in a combined grading table or combined point table indexed by
6923 page number the page numbers in the table will be clickable links
6924 that take you to the corresponding page.
6925 \end{itemize}
6926
6927 For example, if the exam has 8 questions, with each odd numbered
6928 question worth a total of 10 regular points and each even numbered
6929 question worth a total of 5 bonus points, and you type
6930 \begin{verbatim}
6931 \begin{center}
6932 \combinedgradetable[h][questions]
6933 \end{center}
6934 \end{verbatim}
6935 then you'll get
6936 \begin{center}
6937 \cwidth=2em
6938 \renewcommand{\arraystretch}{1.5}
6939 \begin{tabular}{|l|c|c|c|c|c|c|c|c|c|}
6940 \hline
6941 Question:& 1& 2& 3& 4& 5& 6& 7& 8& Total\\
6942 \hline
6943 Points:&
6944 10&
6945 0&
6946 10&
6947 0&
6948 10&
6949 0&
6950 10&
6951 0&
6952 40\\
6953 \hline
6954 Bonus Points:&
6955 0&
6956 5&
6957 0&
6958 5&
6959 0&
6960 5&
6961 0&
6962 5&
6963 20\\
6964 \hline
6965 Score:&
6966 \hbox to \cwidth{\hfill}&
6967 \hbox to \cwidth{\hfill}&
6968 \hbox to \cwidth{\hfill}&
6969 \hbox to \cwidth{\hfill}&
6970 \hbox to \cwidth{\hfill}&
6971 \hbox to \cwidth{\hfill}&
6972 \hbox to \cwidth{\hfill}&
6973 \hbox to \cwidth{\hfill}&\\
6974 \hline
6975 \end{tabular}
6976 \end{center}
6977
6978 \index{point table!combined|)}
6979 \index{grading table!combined|)}
6980
6981 %--------------------------------------------------------------------
6982 \subsection{Changing the total points in a table}
6983 \label{sec:Totalpoints}
6984 \index{grading table!changing total points|(}
6985 \index{point table!changing total points|(}
6986
6987
6988 There are commands for changing the total points and total bonus
6989 points in grading and point tables, so that the stated point total
6990 will not equal the sum of the point values in the table. These
6991 commands are intended for exams in which the students are required to
6992 do some subset of the problems, but not all of them, and so the total
6993 number of points possible on the exam is less than the sum of the
6994 points for all of the questions. The commands
6995 are\indc{settabletotalpoints}\indc{settabletotalbonuspoints}
6996 \begin{center}
6997 \begin{tabular}{l}
6998 \verb"\settabletotalpoints"\\
6999 \verb"\settabletotalbonuspoints"
7000 \end{tabular}
7001 \end{center}
7002 Each of those commands takes one argument. After giving the command
7003 \begin{center}
7004 \verb"\settabletotalpoints{number}"
7005 \end{center}
7006 any grading or point table (regular or combined, partial or full) will
7007 list the total points as \texttt{number} instead of the actual total
7008 number of points in the table. After giving the command
7009 \begin{center}
7010 \verb"\settabletotalbonuspoints{number}"
7011 \end{center}
7012 any grading or point table (bonus or combined, partial or full) will
7013 list the total bonus points as \texttt{number} instead of the actual
7014 total number of bonus points in the table.
7015
7016 To have these commands affect only a single table, confine the command
7017 and the command to create the table inside of a group (possibly by
7018 just placing those commands inside of a \texttt{center} environment).
7019 For example, if an exam has 8 questions, each worth 10 points, and the
7020 students are required to do any 6 of the 8, then the commands
7021 \begin{verbatim}
7022 \begin{center}
7023 \settabletotalpoints{60}
7024 \gradetable[h][questions]
7025 \end{center}
7026 \end{verbatim}
7027 will produce
7028 \begin{center}
7029 \cwidth=2em
7030 \renewcommand{\arraystretch}{1.5}
7031 \begin{tabular}{|l|c|c|c|c|c|c|c|c|c|}
7032 \hline
7033 Question:& 1& 2& 3& 4& 5& 6& 7& 8& Total\\
7034 \hline
7035 Points:&
7036 10&
7037 10&
7038 10&
7039 10&
7040 10&
7041 10&
7042 10&
7043 10&
7044 60\\
7045 \hline
7046 Score:&
7047 \hbox to \cwidth{\hfill}&
7048 \hbox to \cwidth{\hfill}&
7049 \hbox to \cwidth{\hfill}&
7050 \hbox to \cwidth{\hfill}&
7051 \hbox to \cwidth{\hfill}&
7052 \hbox to \cwidth{\hfill}&
7053 \hbox to \cwidth{\hfill}&
7054 \hbox to \cwidth{\hfill}&\\
7055 \hline
7056 \end{tabular}
7057 \end{center}
7058 and no other tables will be affected by that
7059 \verb"\settabletotalpoints" command.
7060
7061 \index{point table!changing total points|)}
7062 \index{grading table!changing total points|)}
7063
7064 %--------------------------------------------------------------------
7065 \subsection{Customizing the tables}
7066 \label{sec:CustTable}
7067 \index{customization!grading table|(}
7068 \index{customization!point table|(}
7069 \index{grade table!customization|(}
7070 \index{point table!customization|(}
7071
7072 There are four ways in which you can customize the appearance of
7073 grading tables and point tables:
7074 \begin{itemize}
7075 \item You can change the words (and the fonts) that appear in the
7076 table.
7077 \item You can change the minimum width of the blank cells into which
7078 you will write the scores.
7079 \item You can change the value of
7080 \verb"\baselinestretch"\indc{baselinestretch} used for the table.
7081 \item You can change the distance between the rows in a multirow table
7082 and the distance between the columns in a multicolumn table.
7083 \end{itemize}
7084 For all grading and point tables:\indc{gradetablestretch}\indc{cellwidth}
7085 \indc{doublerulesep}%
7086 \begin{center}
7087 \begin{tabular}{l@{\qquad}p{3in}}
7088 \verb"\cellwidth{length}"& sets the minimum width of the blank cells to
7089 \verb"length"\\[\medskipamount]
7090 \verb"\gradetablestretch{number}"& uses \verb"number" as the
7091 \verb"\baselinestretch"\\[\medskipamount]
7092 \verb"\setlength{\doublerulesep}{length}"& sets the distance
7093 between the columns of a multicolumn table and the distance
7094 between the rows of a multirow table to \verb"length".
7095 \end{tabular}
7096 \end{center}
7097 For vertical non-bonus tables:
7098 % (i.e., tables created by
7099 % \verb"\gradetable[v]", \verb"\multicolumngradetable",
7100 % \verb"\pointtable[v]", \verb"\multicolumnpointtable",
7101 % \verb"\partialgradetable{rangename}[v]",
7102 % \verb"\multicolumnpartialgradetable",
7103 % \verb"\partialpointtable{rangename}[v]", or
7104 % \verb"\multicolumnpartialpointtable"):%
7105 \indc{vqword}\indc{vpgword}\indc{vpword}\indc{vsword}\indc{vtword}
7106 \begin{center}
7107 \begin{tabular}{l@{\qquad}l}
7108 Command& \multicolumn{1}{c}{Effect}\\[\medskipamount]
7109 \verb"\vqword{text}"& substitutes \verb"text" for ``Question''\\
7110 \verb"\vpgword{text}"& substitutes \verb"text" for ``Page''\\
7111 \verb"\vpword{text}"& substitutes \verb"text" for ``Points''\\
7112 \verb"\vsword{text}"& substitutes \verb"text" for ``Score''\\
7113 \verb"\vtword{text}"& substitutes \verb"text" for ``Total:''
7114 \end{tabular}
7115 \end{center}
7116 For horizontal non-bonus tables:
7117 % (i.e., tables created by
7118 % \verb"\gradetable[h]", \verb"\pointtable[h]",
7119 % \verb"\partialgradetable{rangename}[h]", or
7120 % \verb"\partialpointtable{rangename}[h]"):%
7121 \indc{hqword}\indc{hpgword}\indc{hpword}\indc{hsword}\indc{htword}
7122 \begin{center}
7123 \begin{tabular}{l@{\qquad}l}
7124 Command& \multicolumn{1}{c}{Effect}\\[\medskipamount]
7125 \verb"\hqword{text}"& substitutes \verb"text" for ``Question:''\\
7126 \verb"\hpgword{text}"& substitutes \verb"text" for ``Page:''\\
7127 \verb"\hpword{text}"& substitutes \verb"text" for ``Points:''\\
7128 \verb"\hsword{text}"& substitutes \verb"text" for ``Score:''\\
7129 \verb"\htword{text}"& substitutes \verb"text" for ``Total''
7130 \end{tabular}
7131 \end{center}
7132 For vertical bonus tables:
7133 % (i.e., tables created by
7134 % \verb"\bonusgradetable[v]", \verb"\bonuspointtable[v]",
7135 % \verb"\partialbonusgradetable{rangename}[v]", or
7136 % \verb"\partialbonuspointtable{rangename}[v]"):
7137 \indc{bvqword}\indc{bvpgword}\indc{bvpword}\indc{bvsword}%
7138 \indc{bvtword}
7139 \begin{center}
7140 \begin{tabular}{l@{\qquad}l}
7141 Command& \multicolumn{1}{c}{Effect}\\[\medskipamount]
7142 \verb"\bvqword{text}"& substitutes \verb"text" for ``Question''\\
7143 \verb"\bvpgword{text}"& substitutes \verb"text" for ``Page''\\
7144 \verb"\bvpword{text}"& substitutes \verb"text" for ``Bonus Points''\\
7145 \verb"\bvsword{text}"& substitutes \verb"text" for ``Score''\\
7146 \verb"\bvtword{text}"& substitutes \verb"text" for ``Total:''
7147 \end{tabular}
7148 \end{center}
7149 For horizontal bonus tables:
7150 % (i.e., tables created by
7151 % \verb"\bonusgradetable[h]", \\
7152 % \verb"\bonuspointtable[h]",
7153 % \verb"\partialbonusgradetable{rangename}[h]", or\\
7154 % \verb"\partialbonuspointtable{rangename}[h]"):
7155 \indc{bhqword}%
7156 \indc{bhpgword}\indc{bhpword}\indc{bhsword}\indc{bhtword}
7157 \begin{center}
7158 \begin{tabular}{l@{\qquad}l}
7159 Command& \multicolumn{1}{c}{Effect}\\[\medskipamount]
7160 \verb"\bhqword{text}"& substitutes \verb"text" for ``Question:''\\
7161 \verb"\bhpgword{text}"& substitutes \verb"text" for ``Page:''\\
7162 \verb"\bhpword{text}"& substitutes \verb"text" for ``Bonus Points:''\\
7163 \verb"\bhsword{text}"& substitutes \verb"text" for ``Score:''\\
7164 \verb"\bhtword{text}"& substitutes \verb"text" for ``Total''
7165 \end{tabular}
7166 \end{center}
7167 For vertical combined tables:
7168 % (i.e., tables created by
7169 % \verb"\combinedgradetable[v]",\\
7170 % \verb"\combinedpointtable[v]",
7171 % \verb"\partialcombinedgradetable{rangename}[v]", or\\
7172 % \verb"\partialcombinedpointtable{rangename}[v]"):
7173 \indc{cvqword}%
7174 \indc{cvpgword}\indc{cvpword}\indc{cvbpword}\indc{cvsword}%
7175 \indc{cvtword}
7176 \begin{center}
7177 \begin{tabular}{l@{\qquad}l}
7178 Command& \multicolumn{1}{c}{Effect}\\[\medskipamount]
7179 \verb"\cvqword{text}"& substitutes \verb"text" for ``Question''\\
7180 \verb"\cvpgword{text}"& substitutes \verb"text" for ``Page''\\
7181 \verb"\cvpword{text}"& substitutes \verb"text" for ``Points''\\
7182 \verb"\cvbpword{text}"& substitutes \verb"text" for ``Bonus Points''\\
7183 \verb"\cvsword{text}"& substitutes \verb"text" for ``Score''\\
7184 \verb"\cvtword{text}"& substitutes \verb"text" for ``Total:''
7185 \end{tabular}
7186 \end{center}
7187 For horizontal combined tables:
7188 % (i.e., tables created by
7189 % \verb"\combinedgradetable[h]", \\
7190 % \verb"\combinedpointtable[h]",
7191 % \verb"\partialcombinedgradetable{rangename}[h]", or\\
7192 % \verb"\partialcombinedpointtable{rangename}[h]"):
7193 \indc{chqword}%
7194 \indc{chpgword}\indc{chpword}\indc{chbpword}\indc{chsword}%
7195 \indc{chtword}
7196 \begin{center}
7197 \begin{tabular}{l@{\qquad}l}
7198 Command& \multicolumn{1}{c}{Effect}\\[\medskipamount]
7199 \verb"\chqword{text}"& substitutes \verb"text" for ``Question:''\\
7200 \verb"\chpgword{text}"& substitutes \verb"text" for ``Page:''\\
7201 \verb"\chpword{text}"& substitutes \verb"text" for ``Points:''\\
7202 \verb"\chbpword{text}"& substitutes \verb"text" for ``Bonus Points:''\\
7203 \verb"\chsword{text}"& substitutes \verb"text" for ``Score:''\\
7204 \verb"\chtword{text}"& substitutes \verb"text" for ``Total''
7205 \end{tabular}
7206 \end{center}
7207 If you don't use any of these commands then you get the default
7208 values, which are defined by the commands in the following
7209 table:\indc{doublerulesep}\indc{gradetablestretch}\indc{cellwidth}
7210 \begin{center}
7211 \begin{tabular}{l@{\quad}l}
7212 \multicolumn{2}{c}{\bfseries Defaults for grading and point
7213 tables}\\*[\bigskipamount]
7214 \verb"\hqword{Question:}"& \verb"\vqword{Question}"\\
7215 \verb"\hpgword{Page:}"& \verb"\vpgword{Page}"\\
7216 \verb"\hpword{Points:}"& \verb"\vpword{Points}"\\
7217 \verb"\hsword{Score:}"& \verb"\vsword{Score}"\\
7218 \verb"\htword{Total}"& \verb"\vtword{Total:}"\\[\medskipamount]
7219 %
7220 \verb"\bhqword{Question:}"& \verb"\bvqword{Question}"\\
7221 \verb"\bhpgword{Page:}"& \verb"\bvpgword{Page}"\\
7222 \verb"\bhpword{Bonus Points:}"& \verb"\bvpword{Bonus Points}"\\
7223 \verb"\bhsword{Score:}"& \verb"\bvsword{Score}"\\
7224 \verb"\bhtword{Total}"& \verb"\bvtword{Total:}"\\[\medskipamount]
7225 %
7226 \verb"\chqword{Question:}"& \verb"\cvqword{Question}"\\
7227 \verb"\chpgword{Page:}"& \verb"\cvpgword{Page}"\\
7228 \verb"\chpword{Points:}"& \verb"\cvpword{Points}"\\
7229 \verb"\chbpword{Bonus Points:}"& \verb"\cvbpword{Bonus Points}"\\
7230 \verb"\chsword{Score:}"& \verb"\cvsword{Score}"\\
7231 \verb"\chtword{Total}"& \verb"\cvtword{Total:}"\\[\medskipamount]
7232 \verb"\cellwidth{2em}"\\
7233 \verb"\gradetablestretch{1.5}"\\
7234 \verb"\setlength{\doublerulesep}{2.0pt}"
7235 \end{tabular}
7236 \end{center}
7237
7238 \bigskip
7239 For example, if you type
7240 \begin{verbatim}
7241 \begin{center}
7242 \hqword{Aufgabe Nr.:}
7243 \hpword{Punktzahl:}
7244 \htword{\textbf{Summe}}
7245 \hsword{Davon erreicht:}
7246 \cellwidth{2.2em}
7247 \gradetable[h][questions]
7248 \end{center}
7249 \end{verbatim}
7250 then you'll get
7251 \begin{center}
7252 \cwidth=2.2em
7253 \renewcommand{\arraystretch}{1.5}
7254 \begin{tabular}{|l|c|c|c|c|c|c|c|c|c|}
7255 \hline
7256 Aufgabe Nr.:& 1& 2& 3& 4& 5& 6& 7& 8& \textbf{Summe}\\
7257 \hline
7258 Punktzahl:&
7259 15&
7260 15&
7261 15&
7262 15&
7263 15&
7264 15&
7265 15&
7266 15&
7267 120\\
7268 \hline
7269 Davon erreicht:&
7270 \hbox to \cwidth{\hfill}&
7271 \hbox to \cwidth{\hfill}&
7272 \hbox to \cwidth{\hfill}&
7273 \hbox to \cwidth{\hfill}&
7274 \hbox to \cwidth{\hfill}&
7275 \hbox to \cwidth{\hfill}&
7276 \hbox to \cwidth{\hfill}&
7277 \hbox to \cwidth{\hfill}&
7278 \\
7279 \hline
7280 \end{tabular}
7281 \end{center}
7282
7283 \index{point table!customization|)}
7284 \index{grade table!customization|)}
7285 \index{customization!point table|)}
7286 \index{customization!grading table|)}
7287
7288
7289 \indcstop{pointtable}
7290 \indcstop{gradetable}
7291 \index{point table|)}
7292 \index{grading table|)}
7293
7294
7295 %--------------------------------------------------------------------
7296 %--------------------------------------------------------------------
7297 \section{Changing the page margins}
7298 \label{sec:pagesize}
7299 \index{margins|(}
7300 \index{customization!margins|(}
7301
7302 The exam document class arranges things so that you get one inch
7303 margins at the top, bottom, and sides no matter what size paper you
7304 use, as long as you use the corresponding document class option
7305 (\verb"a4paper", \verb"a5paper", \verb"b5paper", \verb"letterpaper",
7306 \verb"legalpaper", \verb"executivepaper", or \verb"landscape"). You
7307 can change the sizes of these margins by using the commands that
7308 change the size of the printed area.
7309
7310 To change the width of the printed area, you would use the
7311 \verb"\extrawidth"\indc{extrawidth} command. The \verb"\extrawidth"
7312 command takes one argument, and enlarges the width of the printed area
7313 by the amount of the argument. It keeps the printed area centered as
7314 it changes its width. If the argument is negative, then the width of
7315 the printed area is decreased.
7316
7317 For example, to enlarge the left and right margins by one half inch
7318 each, you would use the command
7319 \begin{center}
7320 \verb"\extrawidth{-1in}"
7321 \end{center}
7322 since the printed region must shrink by one inch to allow an
7323 additional one half inch on both sides. To decrease the left and
7324 right margins to three quarters of an inch each, you would use the
7325 command
7326 \begin{center}
7327 \verb"\extrawidth{.5in}"
7328 \end{center}
7329 since the printed region must grow by one half inch to decrease both
7330 margins by one quarter of an inch.
7331
7332 To change the height of the printed area, you must choose whether the
7333 top or the bottom of the printed area (or possibly both) should move.
7334 The commands for this are principally intended to allow additional
7335 room for large headers and footers, and so they are called
7336 \verb"\extraheadheight"\indc{extraheadheight} and
7337 \verb"\extrafootheight"\indc{extrafootheight}. For a full description
7338 of these commands, see section~\ref{sec:extra-room}.
7339
7340 To move the top of the printed region (and any header that's present)
7341 downwards, you use the command \verb"\extraheadheight". This command
7342 takes one argument, and moves the top of the text and the header down
7343 by this amount (keeping the distance between the header and the text
7344 constant). Thus, to increase the top margin by three quarters of an
7345 inch, you would give the command
7346 \begin{center}
7347 \verb"\extraheadheight{.75in}"
7348 \end{center}
7349 To decrease the top margin by one half inch, you would give the
7350 command
7351 \begin{center}
7352 \verb"\extraheadheight{-.5in}"
7353 \end{center}
7354 The
7355 %
7356 \verb"\extraheadheight"\indcsub{extraheadheight}{optional argument}%
7357 \index{head height!first page different} command takes an optional
7358 argument to provide a top margin on the first page that's different
7359 from that on all other pages. For an explanation of this, see
7360 section~\ref{sec:extra-room}.
7361
7362 To move the bottom of the printed region (and any footer that's
7363 present) upwards, you use the command
7364 \verb"\extrafootheight"\indc{extrafootheight}. This command takes one
7365 argument, and moves the bottom of the text and the footer up by this
7366 amount (keeping the distance between the footer and the text
7367 constant). Thus, to increase the bottom margin by three quarters of
7368 an inch, you would give the command
7369 \begin{center}
7370 \verb"\extrafootheight{.75in}"
7371 \end{center}
7372 To decrease the bottom margin by one half inch, you would give the
7373 command
7374 \begin{center}
7375 \verb"\extrafootheight{-.5in}"
7376 \end{center}
7377 The
7378 %
7379 \verb"\extrafootheight"\indcsub{extrafootheight}{optional argument}%
7380 \index{foot height!first page different} command takes an optional
7381 argument to provide a bottom margin on the first page that's different
7382 from that on all other pages. For an explanation of this, see
7383 section~\ref{sec:extra-room}.
7384
7385 \index{customization!margins|)}
7386 \index{margins|)}
7387
7388
7389 %--------------------------------------------------------------------
7390 %---------------------------------------------------------------------
7391 \section{Headers and footers}
7392 \label{sec:headfoot}
7393 \index{header|(}
7394 \index{footer|(}
7395
7396 The following sections explain all of the commands that deal with
7397 headers and footers. There are a number of things to explain here,
7398 and so you may find it easier to skip these sections and instead look
7399 at the examples in sections~\ref{sec:beginexamples}
7400 through~\ref{sec:endexamples} (on pages~\pageref{sec:beginexamples}
7401 through~\pageref{sec:endexamples}). You can then refer back to these
7402 sections for the full story on whatever isn't clear from the examples.
7403 All of the commands described in these sections should be given in the
7404 preamble, i.e., after the \verb"\documentclass" command and before the
7405 \verb"\begin{document}" command.
7406
7407 It's also important to remember that if you use a \verb"coverpages"
7408 environment (described in section~\ref{sec:coverpages}), then the
7409 commands described here affect only the pages in the main section of
7410 the exam, and not the pages of the \verb"coverpages" environment.
7411 There are commands for headers and footers in the cover pages that are
7412 analogous to the commands described in this section; for that, see
7413 section~\ref{sec:Coverhdft}.
7414
7415 %---------------------------------------------------------------------
7416 \subsection{Page styles: Headers and/or footers}
7417 \label{sec:pagestyle}
7418 \indcstart{pagestyle}
7419 \index{header!on or off}
7420 \index{footer!on or off}
7421
7422 It's the \verb"\pagestyle" command that determines whether the exam
7423 will have headers, footers, both, or neither. The contents of the
7424 header and footer are specified using the commands described in
7425 sections~\ref{sec:header} through~\ref{sec:rules}, but it's the
7426 \verb"\pagestyle" command that determines whether the header and
7427 footer that you construct will actually be placed onto the page. The
7428 \verb"\pagestyle" command should be given in the preamble, i.e., after
7429 the \verb"\documentclass" command and before the
7430 \verb"\begin{document}" command.
7431
7432 To have both a header and a footer, give the
7433 command\indt{headandfoot}\indc{pagestyle\{headandfoot\}}
7434 \begin{center}
7435 \verb"\pagestyle{headandfoot}"
7436 \end{center}
7437 If you want every page to have a header but no footer, give the
7438 command\indt{head}\indc{pagestyle\{head\}}
7439 \begin{center}
7440 \verb"\pagestyle{head}"
7441 \end{center}
7442 To give every page a footer but no header, give the
7443 command\indt{foot}\indc{pagestyle\{foot\}}
7444 \begin{center}
7445 \verb"\pagestyle{foot}"
7446 \end{center}
7447 Finally, to omit both the header and the footer from the page, give
7448 the command\indt{empty}\indc{pagestyle\{empty\}}
7449 \begin{center}
7450 \verb"\pagestyle{empty}"
7451 \end{center}
7452
7453
7454 As is true for all \LaTeX{} document classes, you can change the page
7455 style used on a single page by giving the command\indc{thispagestyle}
7456 \begin{center}
7457 \verb"\thispagestyle{somestyle}"
7458 \end{center}
7459 somewhere on that page (where \verb"somestyle" is the style that you
7460 want to use on that page). This is most often needed if you use the
7461 \verb"\maketitle"\indc{maketitle}\indcsub{maketitle}{overriding}
7462 command, since that command inserts a \verb"\thispagestyle{plain}"
7463 immediately following the title. If you use the \verb"\maketitle"
7464 command and you want the entire document to use
7465 \verb"\pagestyle{headandfoot}", then you'll need to put the command
7466 \verb"\thispagestyle{headandfoot}"\indc{thispagestyle\{headandfoot\}}
7467 immediately after the \verb"\maketitle" command to override the
7468 \verb"\thispagestyle{plain}" that is inserted by \verb"\maketitle".
7469
7470 The default page style is
7471 \verb"headandfoot"\indcsub{pagestyle}{default}. That is, if you don't
7472 give any \verb"\pagestyle" commands, then the header and footer will
7473 appear on every page. The default header is empty, and the default
7474 footer consists of ``Page $n$'' centered in the footer (where $n$ is
7475 the page number).
7476
7477 \indcstop{pagestyle}
7478
7479 %---------------------------------------------------------------------
7480 \subsection{The three parts of the header}
7481 \label{sec:header}
7482 \index{header!three parts|(}
7483
7484 The header is specified in three parts:
7485 \begin{itemize}
7486 \item One part to be left justified.
7487 \item One part to be centered.
7488 \item One part to be right justified.
7489 \end{itemize}
7490 There are two different ways in which you can specify the three parts
7491 of the header. The first uses the single command \verb"\header" to
7492 specify all three parts of the header, or the commands
7493 \verb"\firstpageheader" and \verb"\runningheader" to specify a
7494 different header for the first page (see
7495 section~\ref{sec:runningheader}). The second uses the commands
7496 \verb"\lhead", \verb"\chead", and \verb"\rhead", each of which can
7497 have an optional argument to specify a different header for the first
7498 page (see section~\ref{sec:lhead}). All of these commands should be
7499 given in the preamble, i.e., after the \verb"\documentclass" command
7500 and before the \verb"\begin{document}" command.
7501
7502 %--------------------------------------------------------------------
7503 \subsubsection{Using \texttt{\bs header}, \texttt{\bs firstpageheader} and
7504 \texttt{\bs runningheader}}
7505 \label{sec:runningheader}
7506 \indcstart{header}
7507 \indcstart{firstpageheader}
7508 \indcstart{runningheader}
7509
7510 The command \verb"\header{Text 1}{Text 2}{Text 3}" puts ``Text~1''
7511 into the left justified header, ``Text~2'' into the centered header,
7512 and ``Text~3'' into the right justified header on every page. If you
7513 want the header on the first page to be different from that on the
7514 other pages, then you should use the commands \verb"\firstpageheader"
7515 and
7516 %
7517 \verb"\runningheader"\index{header!different on first page}, which
7518 also take three arguments and affect either the first page or all
7519 pages except the first.
7520
7521
7522 For example, to put the header
7523 \samplehead{Math 115}{Second Exam}{July 4, 1776}{}
7524 on every page of the exam, you would give the command
7525 \begin{verbatim}
7526 \header{Math 115}{Second Exam}{July 4, 1776}
7527 \end{verbatim}
7528
7529 If you want to use a header on the first page that's different from
7530 the header used on all other pages, you would use the commands
7531 \verb"\firstpageheader" and \verb"\runningheader" instead of
7532 \verb"\header". For example, if you want the above header for the
7533 first page, but on all pages after the first you want to have the
7534 header \samplehead{Math 115}{Second Exam (Continued)}{July 4, 1776}{}
7535 then you would give the commands
7536 \begin{verbatim}
7537 \firstpageheader{Math 115}{Second Exam}{July 4, 1776}
7538 \runningheader{Math 115}{Second Exam (Continued)}{July 4, 1776}
7539 \end{verbatim}
7540
7541 You can leave one or more of the three parts empty. To have the
7542 header
7543 \samplehead{Math 115}{Second Exam}{July 4, 1776}{}
7544 on the first page, with the header
7545 \samplehead{Math 115}{}{Second Exam (Continued)}{}
7546 on all other pages, you would give the commands
7547 \begin{verbatim}
7548 \firstpageheader{Math 115}{Second Exam}{July 4, 1776}
7549 \runningheader{Math 115}{}{Second Exam (Continued)}
7550 \end{verbatim}
7551
7552 Any of the three parts of the header can have multiple lines. To
7553 specify where the line breaks should go, you just type \verb"\\".
7554 Thus, to have the header
7555 \samplehead{\bfseries\large Math 115\\Professor Hilbert}{}
7556 {\bfseries\large First Exam\\July 4, 1776}{}
7557 appear on every page, you would give the command
7558 \begin{verbatim}
7559 \header{\bfseries\large Math 115\\Professor Hilbert}
7560 {}
7561 {\bfseries\large First Exam\\July 4, 1776}
7562 \end{verbatim}
7563
7564 \indcstop{header}
7565 \indcstop{firstpageheader}
7566 \indcstop{runningheader}
7567
7568 %--------------------------------------------------------------------
7569 \subsubsection{Using \texttt{\bs lhead}, \texttt{\bs chead} and
7570 \texttt{\bs rhead}}
7571 \label{sec:lhead}
7572 \indcstart{lhead}
7573 \indcstart{chead}
7574 \indcstart{rhead}
7575
7576
7577 The command \verb"\lhead{Text}" puts ``Text'' into the left justified
7578 part of the header on every page. The command
7579 \index{header!different on first page}%
7580 \indcsub{lhead}{optional argument}%
7581 \indcsub{chead}{optional argument}%
7582 \indcsub{rhead}{optional argument}%
7583 \indcsub{lhead}{different on first page}%
7584 \indcsub{chead}{different on first page}%
7585 \indcsub{rhead}{different on first page}%
7586 \verb"\lhead[Text 1]{Text 2}" puts ``Text~1'' into the left justified
7587 header on the first page and ``Text~2'' into the left justified header
7588 on all other pages. The commands \verb"\chead" and \verb"\rhead" have
7589 similar effects on the centered and right justified parts of the
7590 header.
7591
7592
7593 For example, to put the header
7594 \samplehead{Math 115}{Second Exam}{July 4, 1776}{}
7595 on every page of the exam, you would give the commands
7596 \begin{verbatim}
7597 \lhead{Math 115}
7598 \chead{Second Exam}
7599 \rhead{July 4, 1776}
7600 \end{verbatim}
7601
7602 If you want any of the three parts to have a special version to be
7603 used only on the first page, then you just include that special
7604 version as an optional argument (enclosed in square brackets) to the
7605 command. For example, if you want the above header for the first
7606 page, but on all pages after the first you want to have the header
7607 \samplehead{Math 115}{Second Exam (Continued)}{July 4, 1776}{}
7608 then you would give the commands
7609 \begin{verbatim}
7610 \lhead{Math 115}
7611 \chead[Second Exam]{Second Exam (Continued)}
7612 \rhead{July 4, 1776}
7613 \end{verbatim}
7614
7615 You can leave one or more of the three parts empty. To have the
7616 header
7617 \samplehead{Math 115}{Second Exam}{July 4, 1776}{}
7618 on the first page, with the header
7619 \samplehead{Math 115}{}{Second Exam (Continued)}{}
7620 on all other pages, you would give the commands
7621 \begin{verbatim}
7622 \lhead{Math 115}
7623 \chead[Second Exam]{}
7624 \rhead[July 4, 1776]{Second Exam (Continued)}
7625 \end{verbatim}
7626
7627 Any of the three parts of the header can have multiple lines. To
7628 specify where the line breaks should go, you just type \verb"\\".
7629 Thus, to have the
7630 %
7631 header\index{header!multiple lines}
7632 \samplehead{\bfseries\large Math 115\\Professor Hilbert}{}
7633 {\bfseries\large First Exam\\July 4, 1776}{}
7634 appear on every page, you would give the commands
7635 \begin{verbatim}
7636 \lhead{\bfseries\large Math 115\\Professor Hilbert}
7637 \chead{}
7638 \rhead{\bfseries\large First Exam\\July 4, 1776}
7639 \end{verbatim}
7640
7641 \indcstop{lhead}
7642 \indcstop{chead}
7643 \indcstop{rhead}
7644
7645 \index{header!three parts|)}
7646
7647 %--------------------------------------------------------------------
7648 \subsubsection{Commands with optional arguments}
7649 \label{sec:OptArg}
7650 \index{optional arguments}
7651
7652 \LaTeX{} has the property that if a command takes an optional
7653 argument, and if that optional argument contains a command that also
7654 has an optional argument, then \emph{that inner command must be
7655 enclosed within curly braces}. For example, if you want the right
7656 justified part of the first page header to be
7657 \samplehead{}{}{Name:\enspace\makebox[2in]{\hrulefill}}{} but you want
7658 the right justified part of the header on pages after the first to be
7659 empty, then you should give the command
7660 \begin{verbatim}
7661 \rhead[{Name:\enspace\makebox[2in]{\hrulefill}}]{}
7662 \end{verbatim}
7663 Note that the optional argument to the \verb"\rhead" command is
7664 \begin{verbatim}
7665 {Name:\enspace\makebox[2in]{\hrulefill}}
7666 \end{verbatim}
7667 and not
7668 \begin{verbatim}
7669 Name:\enspace\makebox[2in]{\hrulefill}
7670 \end{verbatim}
7671 This is due to the way that \LaTeX{} delimits optional arguments, and
7672 is nothing special about the \verb"exam" document class.
7673
7674 %---------------------------------------------------------------------
7675 \subsubsection*{Leaving extra room for multiple line headers}
7676
7677 See section~\ref{sec:extra-room} for a description of the
7678 %
7679 \verb"\extraheadheight"\index{header!multiple lines} command.
7680
7681 %---------------------------------------------------------------------
7682 \subsection{The three parts of the footer}
7683 \label{sec:footer}
7684 \index{footer!three parts|(}
7685
7686 The footer is composed of three parts, the whole setup being similar
7687 to that for the header (see section~\ref{sec:header}). There are two
7688 different ways in which you can specify the three parts of the footer.
7689 The first uses the single command \verb"\footer" to specify all three
7690 parts of the footer, or the commands \verb"\firstpagefooter" and
7691 \verb"\runningfooter" to specify a different footer for the first page
7692 (see section~\ref{sec:runningfooter}). The second uses the commands
7693 \verb"\lfoot", \verb"\cfoot", and \verb"\rfoot", each of which can
7694 have an optional argument to specify a different footer for the first
7695 page (see section~\ref{sec:lfoot}). All of these commands should be
7696 given in the preamble, i.e., after the \verb"\documentclass" command
7697 and before the \verb"\begin{document}" command.
7698
7699 %--------------------------------------------------------------------
7700 \subsubsection{Using \texttt{\bs footer}, \texttt{\bs firstpagefooter}
7701 and \texttt{\bs runningfooter}}
7702 \label{sec:runningfooter}
7703 \indcstart{footer}
7704 \indcstart{firstpagefooter}
7705 \indcstart{runningfooter}
7706
7707 The command \verb"\footer{Text 1}{Text 2}{Text 3}" puts ``Text~1''
7708 into the left justified footer, ``Text~2'' into the centered footer
7709 and ``Text~3'' into the right justified footer on every page. If you
7710 want the footer on the first page to be different from that on the
7711 other pages, then you should use the commands \verb"\firstpagefooter"
7712 and \verb"\runningfooter", which also take three arguments and affect
7713 either the first page or all pages except the first.
7714
7715 For example, to have an empty footer on the first page and the footer
7716 \samplefoot{}{}{Page 3 of 5}{}
7717 on all pages after the first, you would give the commands
7718 \begin{verbatim}
7719 \firstpagefooter{}{}{}
7720 \runningfooter{}{Page \thepage\ of \numpages}{}
7721 \end{verbatim}
7722 (For an explanation of the \verb"\numpages" command, see
7723 section~\ref{sec:numpages}.)
7724
7725 \indcstop{footer}
7726 \indcstop{firstpagefooter}
7727 \indcstop{runningfooter}
7728
7729 %--------------------------------------------------------------------
7730 \subsubsection{Using \texttt{\bs lfoot}, \texttt{\bs cfoot}, and
7731 \texttt{\bs rfoot}}
7732 \label{sec:lfoot}
7733 \indcstart{lfoot}
7734 \indcstart{cfoot}
7735 \indcstart{rfoot}
7736
7737
7738 The command \verb"\lfoot{Text}" puts ``Text'' into the left justified
7739 part of the footer on every page. The command
7740 \verb"\lfoot[Text 1]{Text 2}" puts ``Text~1'' into the left justified
7741 footer on the first page and ``Text~2'' into the left justified footer
7742 on all other pages. The commands \verb"\cfoot" and \verb"\rfoot" have
7743 similar effects on the centered and right justified parts of the
7744 footer.
7745
7746 For example, to have an empty footer on the first page and the footer
7747 \samplefoot{}{}{Page 3 of 5}{}
7748 on all pages after the first, you would give the commands
7749 \begin{verbatim}
7750 \lfoot{}
7751 \cfoot{}
7752 \rfoot[]{Page \thepage\ of \numpages}
7753 \end{verbatim}
7754 (For an explanation of the \verb"\numpages" command, see
7755 section~\ref{sec:numpages}.)
7756
7757 \indcstop{lfoot}
7758 \indcstop{cfoot}
7759 \indcstop{rfoot}
7760
7761 \index{footer!three parts|)}
7762
7763 %---------------------------------------------------------------------
7764 \subsubsection*{Leaving extra room for multiple line footers}
7765
7766 See section~\ref{sec:extra-room} for a description of the
7767 \verb"\extrafootheight" command.
7768
7769 %---------------------------------------------------------------------
7770 \subsection{Leaving extra room for multiple line headers and footers}
7771 \label{sec:extra-room}
7772
7773 \subsubsection*{Headers}
7774 \index{header!with multiple lines|(}
7775
7776 If you specify more than one or two lines for any part of the header,
7777 then you may want to move the header down slightly so that it doesn't
7778 run off of the top of the paper. The command for this is
7779 \verb"\extraheadheight"\indc{extraheadheight}. You can also use the
7780 \verb"\extraheadheight" command to adjust the size of the text area.
7781 The \verb"\extraheadheight" command never changes the distance between
7782 the header and the text.
7783
7784 For example, to move the header and the text an additional half inch
7785 down from the top of the page, you would give the command
7786 \begin{center}
7787 \verb"\extraheadheight{.5in}"
7788 \end{center}
7789 You can also specify a negative distance to \verb"\extraheadheight" to
7790 move the header up closer to the top of the paper. For example, the
7791 command
7792 \begin{center}
7793 \verb"\extraheadheight{-.25in}"
7794 \end{center}
7795 moves the header one quarter inch closer to the top of the paper.
7796
7797 If you want to have a different value for \verb"\extraheadheight" on
7798 the first page from that on the pages after the first, then use the
7799 same syntax as in the \verb"\lhead", \verb"\chead", and \verb"\rhead"
7800 commands (see section~\ref{sec:lhead}): Include an optional argument
7801 giving the extra head height for the first page, and the required
7802 argument will apply only to those pages after the first. For example,
7803 the
7804 %
7805 command\indcsub{extraheadheight}{different on first page}
7806 \begin{center}
7807 \verb"\extraheadheight[.5in]{.25in}"
7808 \end{center}
7809 gives a half inch of extra head height on the first page and a
7810 quarter inch of extra head height on all pages after the first.
7811
7812 If you give an \verb"\extraheadheight"\indc{extraheadheight} command,
7813 it should be in the preamble, i.e., after the \verb"\documentclass"
7814 command and before the \verb"\begin{document}" command. The
7815 \verb"\extraheadheight" command can also be used to change the size
7816 of the text region (see section~\ref{sec:pagesize}).
7817
7818 \index{header!with multiple lines|)}
7819
7820 %--------------------------------------------------------------------
7821 \subsubsection*{Footers}
7822 \index{footer!with multiple lines|(}
7823
7824
7825 To leave extra room for multiple line footers, you use the command
7826 \verb"\extrafootheight". To move the footer one half inch higher up
7827 on the paper, you would give the command\indc{extrafootheight}
7828 \begin{center}
7829 \verb"\extrafootheight{.5in}"
7830 \end{center}
7831 If you wanted to move the footer an eighth of an inch lower down on
7832 the paper, you would give the command
7833 \begin{center}
7834 \verb"\extrafootheight{-.125in}"
7835 \end{center}
7836
7837 If you want to have a different value for \verb"\extrafootheight" on
7838 the first page from that on the pages after the first, then use the
7839 same syntax as in the \verb"\lfoot", \verb"\cfoot", and \verb"\rfoot"
7840 commands (see section~\ref{sec:lfoot}): Include an optional argument
7841 giving the extra foot height for the first page, and the required
7842 argument will apply only to those pages after the first. For example,
7843 the
7844 %
7845 command\indcsub{extrafootheight}{different on first page}
7846 \begin{center}
7847 \verb"\extrafootheight[.5in]{.25in}"
7848 \end{center}
7849 gives a half inch of extra foot height on the first page and a
7850 quarter inch of extra foot height on all pages after the first.
7851
7852 If you give an \verb"\extrafootheight"\indc{extrafootheight} command,
7853 it should be in the preamble, i.e., after the \verb"\documentclass"
7854 command and before the \verb"\begin{document}" command. The
7855 \verb"\extrafootheight" command can also be used to change the size
7856 of the text region (see section~\ref{sec:pagesize}).
7857
7858 \index{footer!with multiple lines|)}
7859
7860
7861 %---------------------------------------------------------------------
7862 \subsection{Horizontal rules}
7863 \label{sec:rules}
7864 \index{rule!in header or footer|(}
7865 \index{header!rule|(}
7866 \index{footer!rule|(}
7867
7868 The \verb"exam" document class make it easy to put a horizontal rule
7869 under the header and one above the footer. It is also easy to do
7870 this for the pages after the first page without affecting the first
7871 page.
7872
7873 \begin{itemize}
7874 \item The command \verb"\runningheadrule"\indc{runningheadrule} puts a
7875 horizontal rule below the header on all pages after the first.
7876 \item The command \verb"\firstpageheadrule"\indc{firstpageheadrule}
7877 puts a rule under the header of only the first page.
7878 \item The command \verb"\headrule"\indc{headrule} is equivalent to the
7879 two commands \verb"\firstpageheadrule" and \verb"\runningheadrule".
7880 \item The command \verb"\runningfootrule"\indc{runningfootrule} puts a
7881 horizontal rule above the footer on all pages after the first.
7882 \item The command \verb"\firstpagefootrule"\indc{firstpagefootrule}
7883 puts a rule above the footer of only the first page.
7884 \item The command \verb"\footrule"\indc{footrule} is equivalent to the
7885 two commands \verb"\firstpagefootrule" and \verb"\runningfootrule".
7886 \end{itemize}
7887 For example, to have the header
7888 \samplehead{Math 115}{First Exam}{July 4, 1776}{}
7889 on the first page, with the header
7890 \samplehead{Math 115}{First Exam}{July 4, 1776}{\hrule}
7891 on all pages after the first, give either the commands
7892 \begin{verbatim}
7893 \runningheadrule
7894 \header{Math 115}{First Exam}{July 4, 1776}
7895 \end{verbatim}
7896 or the commands
7897 \begin{verbatim}
7898 \runningheadrule
7899 \lhead{Math 115}
7900 \chead{First Exam}
7901 \rhead{July 4, 1776}
7902 \end{verbatim}
7903 For a description of the command \verb"\header" see
7904 section~\ref{sec:runningheader}; for a description of the commands
7905 \verb"\lhead", \verb"\chead", and \verb"\rhead", see
7906 section~\ref{sec:lhead}.
7907
7908 \bigskip
7909
7910 To have no footer on the first page, and the footer
7911 \samplefoot{\hrule}{}{Page 3 of 5}{}
7912 on all pages after the first, give the commands
7913 \begin{verbatim}
7914 \runningfootrule
7915 \lfoot{}
7916 \cfoot[]{Page \thepage\ of \numpages}
7917 \rfoot{}
7918 \end{verbatim}
7919 (For an explanation of the \verb"\numpages" command, see
7920 section~\ref{sec:numpages}.)
7921
7922 \index{rule!in header or footer|)}
7923 \index{header!rule|)}
7924 \index{footer!rule|)}
7925
7926
7927 %---------------------------------------------------------------------
7928 \subsection{Listing the number of pages in the exam}
7929 \label{sec:numpages}
7930
7931 The \verb"exam" document class defines the command
7932 \verb"\numpages"\indc{numpages} so that it will expand to the number
7933 of pages in the exam. Thus, to have the footer
7934 %
7935 \samplefoot{}{}{Page \thepage\ of \numpages}{}
7936 %
7937 you should either give the command
7938 \begin{verbatim}
7939 \footer{}{Page \thepage\ of \numpages}{}
7940 \end{verbatim}
7941 or the commands
7942 \begin{verbatim}
7943 \lfoot{}
7944 \cfoot{Page \thepage\ of \numpages}
7945 \rfoot{}
7946 \end{verbatim}
7947 For a description of the command \verb"\footer" see
7948 section~\ref{sec:runningfooter}; for a description of the commands
7949 \verb"\lfoot", \verb"\cfoot", and \verb"\rfoot", see
7950 section~\ref{sec:lfoot}.
7951
7952 Note that if your document has a \texttt{coverpages} environment (see
7953 section~\ref{sec:coverpages}), then those pages will not be counted in
7954 %
7955 \verb"\numpages"\indcsub{numpages}{doesn't count cover pages}; the
7956 \texttt{exam} document class defines the command
7957 \verb"\numcoverpages"\indc{numcoverpages} so that it will expand to
7958 the number of cover pages in the exam. If there is no
7959 \texttt{coverpages}\indt{coverpages}\index{environment!coverpages}
7960 environment, then \verb"\numcoverpages" expands to 0. The
7961 \texttt{exam} class also defines the command
7962 \verb"\totalnumpages"\indc{totalnumpages}, which expands to the sum of
7963 \verb"\numpages" and \verb"\numcoverpages". Note that if there are
7964 pages preceding a \texttt{coverpages} environment, then those pages
7965 will not be counted by \verb"\totalnumpages".
7966
7967 As with all other cross referencing commands in \LaTeX, you'll have to
7968 run the file through \LaTeX{} \emph{twice} to be sure that
7969 \verb"\numpages", \verb"\numcoverpages", and \verb"\totalnumpages" are
7970 correct.
7971
7972
7973
7974 %---------------------------------------------------------------------
7975 \subsection{Treating the last page differently}
7976 \label{sec:lastpage}
7977 \index{last page|(}
7978
7979 If you want to vary the text that appears in the header or footer on
7980 the last page of the exam, you should use the command
7981 \verb"\iflastpage"\indc{iflastpage}. The command
7982 \begin{center}
7983 \verb"\iflastpage{Text 1}{Text 2}"
7984 \end{center}
7985 expands to `Text~1' on the last page and to `Text~2' on all pages
7986 before the last. Thus, to have the footer
7987 %
7988 \samplefoot{}{}{Please go on to the next page\ldots}{}
7989 %
7990 on all pages before the last page and the footer
7991 %
7992 \samplefoot{}{}{End of exam}{}
7993 %
7994 on the last page, you should give the command
7995 \begin{verbatim}
7996 \footer{}
7997 {\iflastpage{End of exam}{Please go on to the next page\ldots}}
7998 {}
7999 \end{verbatim}
8000 or the commands
8001 \begin{verbatim}
8002 \lfoot{}
8003 \cfoot{\iflastpage{End of exam}{Please go on to the next page\ldots}}
8004 \rfoot{}
8005 \end{verbatim}
8006 For a description of the command \verb"\footer" see
8007 section~\ref{sec:runningfooter}; for a description of the commands
8008 \verb"\lfoot", \verb"\cfoot", and \verb"\rfoot", see
8009 section~\ref{sec:lfoot}.
8010
8011 As with all other cross referencing commands in \LaTeX, you'll have to
8012 run the file through \LaTeX{} \emph{twice} to be sure that
8013 \verb"\iflastpage"\indc{iflastpage} correctly detects the last page.
8014
8015 \index{last page|)}
8016
8017 %--------------------------------------------------------------------
8018 \subsection{Treating odd and even numbered pages differently}
8019 \index{odd pages!different from even pages|(}
8020 \index{even pages!different from odd pages|(}
8021
8022 If you'd like odd and even numbered pages to be treated differently
8023 (perhaps because you'll be printing onto both sides of the paper), you
8024 should use the \verb"\oddeven"\indc{oddeven} command. The command
8025 \begin{center}
8026 \verb"\oddeven{Text 1}{Text 2}"
8027 \end{center}
8028 expands to `Text~1' on odd numbered pages and to `Text~2' on even
8029 numbered pages.
8030
8031 For example, to have the page number printed in the right head on odd
8032 numbered pages and in the left head on even numbered pages, you should
8033 give the command\indc{oddeven}
8034 \begin{verbatim}
8035 \header{\oddeven{}{\thepage}}%
8036 {}%
8037 {\oddeven{\thepage}{}}
8038 \end{verbatim}
8039 or the commands
8040 \begin{center}
8041 \begin{verbatim}
8042 \lhead{\oddeven{}{\thepage}}
8043 \rhead{\oddeven{\thepage}{}}
8044 \chead{}
8045 \end{verbatim}
8046 \end{center}
8047 If you want the footer of the even numbered pages to be empty and the
8048 footer of the odd numbered pages to contain the centered message
8049 ``Please continue\dots'', except that the last page of the exam should
8050 have an empty footer whether its page number is even or odd, then you
8051 should give the command\indc{iflastpage}
8052 \begin{verbatim}
8053 \footer{}
8054 {\oddeven{\iflastpage{}{Please continue\ldots}}{}}
8055 {}
8056 \end{verbatim}
8057 or the commands
8058 \begin{center}
8059 \begin{verbatim}
8060 \lfoot{}
8061 \rfoot{}
8062 \cfoot{\oddeven{\iflastpage{}{Please continue\dots}}{}}
8063 \end{verbatim}
8064 \end{center}
8065 (see section~\ref{sec:lastpage} for an explanation of
8066 \verb"\iflastpage").
8067
8068 The \verb"\oddeven"\indcsub{oddeven}{only in headers and footers}
8069 command can be used reliably only in headers and footers. This is
8070 because \LaTeX{} generally processes more text than can fit on the
8071 current page before chooses a page break it outputs a page. When the
8072 \verb"\oddeven" command is encountered it will act as though it will
8073 appear on the current page whether it will actually be printed on that
8074 page or on the following page; in headers and footers this never
8075 creates a problem.
8076
8077 \index{odd pages!different from even pages|)}
8078 \index{even pages!different from odd pages|)}
8079
8080 %--------------------------------------------------------------------
8081 \subsection{Questions that span multiple pages}
8082 \label{sec:QuesSpan}
8083 \index{questions!that span multiple pages|(}
8084
8085 The exam document class provides the commands
8086 \begin{itemize}
8087 \item \verb"\ifcontinuation"\indc{ifcontinuation} and
8088 \verb"\ContinuedQuestion"\indc{ContinuedQuestion} to enable headers
8089 and footers that announce whether the current page is continuing a
8090 question begun on an earlier page and, if so, the number of that
8091 question (see section~\ref{sec:ifcontin}), and
8092 \item \verb"\ifincomplete"\indc{ifincomplete} and
8093 \verb"\IncompleteQuestion"\indc{IncompleteQuestion} to enable
8094 headers and footers that announce whether the question at the bottom
8095 of the current page continues onto the next page and, if so, the
8096 number of that question (see section~\ref{sec:ifincomp}).
8097 \end{itemize}
8098 \emph{These commands are only guaranteed to work reliably in headers
8099 and footers.}%
8100 \indcsub{ifcontinuation}{reliable only in headers and footers}%
8101 \indcsub{ContinuedQuestion}{reliable only in headers and footers}%
8102 \indcsub{ifincomplete}{reliable only in headers and footers}%
8103 \indcsub{IncompleteQuestion}{reliable only in headers and footers} If
8104 you use any of them elsewhere, they may be fooled by \LaTeX's practice
8105 of typesetting a bit too much material to fit on a page before it
8106 chooses a page break and ships out the page. They also assume that
8107 there is only one \verb"questions" environment in the entire exam.
8108
8109 %--------------------------------------------------------------------
8110 \subsubsection{Questions continuing from the previous page}
8111 \label{sec:ifcontin}
8112
8113 Headers and footers can announce whether the current page continues a
8114 question begun on an earlier page. The command\indc{ifcontinuation}
8115 \begin{center}
8116 \verb"\ifcontinuation{Text 1}{Text 2}"
8117 \end{center}
8118 expands to `Text 1' if the current page begins with a continuation of
8119 a question begun on an earlier page, and to `Text 2' otherwise. If
8120 the current page does continue a question begun on an earlier page,
8121 then the command\indc{ContinuedQuestion}
8122 \begin{center}
8123 \verb"\ContinuedQuestion"
8124 \end{center}
8125 expands to the number of that question.
8126
8127 For example, to have the header
8128 \samplehead{}{First Exam}{Page 4}{}
8129 %
8130 on all pages that begin a new question and the header
8131 \samplehead{Question 6 continues\ldots}{First Exam}{Page 4}{}
8132 %
8133 on all pages that continue a question begun on a previous page, you
8134 would give the commands\indc{ContinuedQuestion}\indc{ifcontinuation}
8135 \begin{verbatim}
8136 \lhead{\ifcontinuation{Question \ContinuedQuestion\ continues\ldots}{}}
8137 \chead{First Exam}
8138 \rhead{Page \thepage}
8139 \end{verbatim}
8140 (See section~\ref{sec:lhead} for an explanation of \verb"\lhead",
8141 \verb"\chead" and \verb"\rhead".)
8142
8143
8144
8145
8146
8147 The \verb"\ifcontinuation" command figures out which text to use by
8148 checking whether there is a \verb"\question" command appearing on the
8149 page before any of the commands \verb"\part", \verb"\subpart",
8150 \verb"\subsubpart", \verb"\choice", or \verb"\CorrectChoice", and this
8151 works well for most pages. However, the \verb"\ifcontinuation"
8152 command can make mistakes on pages on which none of those commands
8153 appear. The default is to assume that a page with none of those
8154 commands continues a question begun on an earlier page, but there are
8155 two commands you can use to tell the \verb"\ifcontinuation" command
8156 that it should \emph{not} assume that:
8157 \begin{itemize}
8158 \item the \verb"\nomorequestions"\indc{nomorequestions} command can be
8159 used to mark the point at which the last question ends. This can be
8160 useful if you want to include supplementary material (e.g., tables
8161 or figures) at the end of the exam but you don't want that material
8162 to be described as continuing the last question. The
8163 \verb"\nomorequestions" command also tells the \verb"\ifincomplete"
8164 command (see section~\ref{sec:ifincomp}) that all questions are now
8165 complete.
8166 \item The \verb"\noquestionsonthispage" command tells the
8167 \verb"\ifcontinuation" command (and the \verb"\ifincomplete"
8168 command; see section~\ref{sec:ifincomp}) that this page does not
8169 continue a question begun on an earlier page. This is similar to
8170 the job done by the \verb"\nomorequestions" command for the pages
8171 that follow the end of all of the questions. Note that if you're
8172 tempted to use this command on a page that follows the end of all of
8173 the questions, then you should probably use the command
8174 \verb"\nomorequestions" instead.
8175 \end{itemize}
8176
8177 Thus, in more detail, the command
8178 \verb"\ifcontinuation{Text 1}{Text 2}"
8179 \begin{itemize}
8180 \item expands to `Text 2' if
8181 \begin{itemize}
8182 \item a \verb"\question" appears on this page before any
8183 \verb"\part", \verb"\subpart", \verb"\subsubpart", \verb"\choice",
8184 or \verb"\CorrectChoice", or
8185 \item the command \verb"\noquestionsonthispage" has been given on
8186 this page, or
8187 \item the current page is before the page containing question number
8188 1, or
8189 \item the current page is later than a page with the
8190 \verb"\nomorequestions" command,
8191 \end{itemize}
8192 \item and otherwise it expands to `Text 1'.
8193 \end{itemize}
8194
8195
8196 %--------------------------------------------------------------------
8197 \subsubsection{Questions that continue onto a later page}
8198 \label{sec:ifincomp}
8199 \indcstart{ifincomplete}
8200
8201 Headers and footers can announce whether a question on the current
8202 page continues onto a later page. The command\indc{ifincomplete}
8203 \begin{center}
8204 \verb"\ifincomplete{Text 1}{Text 2}"
8205 \end{center}
8206 expands to `Text 1' if the last question begun on or before the
8207 current page continues onto a page after this one, and to `Text~2'
8208 otherwise. If the last question begun on or before the current page
8209 does continue onto a later page, then the
8210 command\indc{IncompleteQuestion}
8211 \begin{center}
8212 \verb"\IncompleteQuestion"
8213 \end{center}
8214 expands to the number of that question.
8215
8216 For example, to have the footer
8217 \samplefoot{\hrule}{}{Question 3 continues\ldots}{}
8218 %
8219 on all pages that end with a question that will be continued onto the
8220 next page, the footer
8221 \samplefoot{\hrule}{}{End of Exam}{}
8222 %
8223 on the last page, and the footer
8224 \samplefoot{\hrule}{}{Exam continues\ldots}{}
8225 %
8226 on all other pages, you would give the
8227 commands\indc{ifincomplete}\indc{IncompleteQuestion}\indc{iflastpage}
8228 \begin{verbatim}
8229 \footrule
8230 \lfoot{}
8231 \newcommand{\continues}{\ifincomplete
8232 {Question \IncompleteQuestion\ continues\ldots}
8233 {Exam continues\ldots}}
8234 \cfoot{\iflastpage{End of Exam}{\continues}}
8235 \rfoot{}
8236 \end{verbatim}
8237 (See section~\ref{sec:lfoot} for an explanation of \verb"\lfoot",
8238 \verb"\cfoot" and \verb"\rfoot", and section~\ref{sec:lastpage} for an
8239 explanation of \verb"\iflastpage").
8240
8241 There are two situations in which you may have to give an additional
8242 command for the \verb"\ifincomplete" command to correctly decide if
8243 the current question is incomplete:
8244 \begin{enumerate}
8245 \item The \verb"\ifincomplete" command expands to `Text~2' if there is
8246 a \verb"\part", \verb"\subpart", \verb"\subsubpart", \verb"\choice",
8247 or \verb"\CorrectChoice" command belonging to this question on the
8248 following page. For those situations in which the current question
8249 flows onto the next page, but there is no \verb"\part",
8250 \verb"\subpart", \verb"\subsubpart", \verb"\choice", or
8251 \verb"\CorrectChoice" belonging to this question on that page, you
8252 should give the command\indc{addquestionobject}
8253 \begin{center}
8254 \verb"\addquestionobject"
8255 \end{center}
8256 at the end of the text of the question to inform the
8257 \verb"\ifincomplete" command that some portion of the question
8258 appears on that following page.
8259
8260 \item If there are pages on which none of those commands appear, the
8261 default is to assume that that page continues a question begun on an
8262 earlier page. There are two commands that you can use to tell the
8263 \verb"\ifincomplete" command that it should \emph{not} assume that:
8264 \begin{itemize}
8265 \item the \verb"\nomorequestions"\indc{nomorequestions} command can
8266 be used to mark the point at which the last question ends. This
8267 can be useful if you want to include supplementary material (e.g.,
8268 tables or figures) at the end of the exam but you don't want the
8269 last question on the exam to be described as incomplete. The
8270 \verb"\nomorequestions" command also tells the
8271 \verb"\ifcontinuation" command (see section~\ref{sec:ifcontin})
8272 that all questions are now complete.
8273 \item The \verb"\noquestionsonthispage"\indc{noquestionsonthispage}
8274 command tells the \verb"\ifincomplete" command (and the
8275 \verb"\ifcontinuation" command; see section~\ref{sec:ifcontin})
8276 that this page does not contain any incomplete questions, and does
8277 not continue a question begun on an earlier page. This is similar
8278 to the job done by the \verb"\nomorequestions" command for the
8279 pages that follow the end of all of the questions. Note that if
8280 you're tempted to use this command on a page that follows the end
8281 of all of the questions, then you should probably use the command
8282 \verb"\nomorequestions" instead.
8283 \end{itemize}
8284 \end{enumerate}
8285 If you give the command
8286 \verb"\noquestionsonthispage"\indc{noquestionsonthispage} on a page,
8287 then
8288 \begin{itemize}
8289 \item an \verb"\ifcontinuation"\indc{ifcontinuation} command on that
8290 page will expand to its second argument,
8291 \item an \verb"\ifincomplete" on that page will expand to its second
8292 argument, and
8293 \item an \verb"\ifincomplete" command on an earlier page will not
8294 assume that a question from that earlier page continues onto this
8295 page.
8296 \end{itemize}
8297 The way that this command affects the \verb"\ifincomplete" command on
8298 earlier pages is as follows: If there is a page with no
8299 \verb"\question", \verb"\part", \verb"\subpart", \verb"\subsubparts",
8300 \verb"\choice", \verb"\CorrectChoice", or
8301 \verb"\addquestionobject"\indc{addquestionobject} commands, then the
8302 last page before that with a \verb"\question" (or \verb"\part", etc.)
8303 would normally be deemed to have an incomplete question; if, however,
8304 the page with no \verb"\question" (or \verb"\part", etc.) (along with
8305 all adjacent pages with no \verb"\question" or \verb"\part" etc.) has
8306 a \verb"\noquestionsonthispage" command, then that last page with a
8307 \verb"\question" (or \verb"\part", etc.) will not be deemed
8308 incomplete.
8309
8310
8311 \indcstop{ifincomplete}
8312
8313 \index{questions!that span multiple pages|)}
8314
8315 %--------------------------------------------------------------------
8316 \subsection{Examples}
8317 \indcstart{lhead}
8318 \indcstart{chead}
8319 \indcstart{rhead}
8320 \indcstart{lfoot}
8321 \indcstart{cfoot}
8322 \indcstart{rfoot}
8323
8324 \begin{example}
8325 \label{sec:beginexamples}
8326 To have the header
8327 \samplehead{Math 115}{First Exam}{July 4, 1776}{}
8328 on the first page, the header
8329 \samplehead{Math 115}{First Exam, Page 2 of 5}{July 4, 1776}{\hrule}
8330 on all pages after the first, and no footer on any page, give the
8331 commands\indc{firstpageheader}\indc{runningheader}%
8332 \indc{runningheadrule}
8333 \begin{verbatim}
8334 \pagestyle{head}
8335 \runningheadrule
8336 \firstpageheader{Math 115}{First Exam}{July 4, 1776}
8337 \runningheader{Math 115}
8338 {First Exam, Page \thepage\ of \numpages}
8339 {July 4, 1776}
8340 \end{verbatim}
8341 Alternatively, you could give the commands
8342 \begin{verbatim}
8343 \pagestyle{head}
8344 \runningheadrule
8345 \lhead{Math 115}
8346 \chead[First Exam]{First Exam, Page \thepage\ of \numpages}
8347 \rhead{July 4, 1776}
8348 \end{verbatim}
8349 \end{example}
8350
8351 %--------------------------------------------------------------------
8352
8353 \begin{example}
8354 To have the header
8355 \samplehead{Math 115}{First Exam}{July 4, 1776}{}
8356 on the first page, no header on the pages after the first, no footer
8357 on the first page, and the footer
8358 \samplefoot{\hrule}{Math 115}{First Exam}{Page 2 of 5}
8359 on all pages after the first, give the
8360 commands\indc{runningfootrule}\indc{firstpageheader}%
8361 \indc{runningheader}\indc{firstpagefooter}\indc{runningfooter}
8362 \begin{verbatim}
8363 \pagestyle{headandfoot}
8364 \runningfootrule
8365 \firstpageheader{Math 115}{First Exam}{July 4, 1776}
8366 \runningheader{}{}{}
8367 \firstpagefooter{}{}{}
8368 \runningfooter{Math 115}{First Exam}{Page \thepage\ of \numpages}
8369 \end{verbatim}
8370 Alternatively, you could give the commands
8371 \begin{verbatim}
8372 \pagestyle{headandfoot}
8373 \runningfootrule
8374 \lhead[Math 115]{}
8375 \chead[First Exam]{}
8376 \rhead[July 4, 1776]{}
8377 \lfoot[]{Math 115}
8378 \cfoot[]{First Exam}
8379 \rfoot[]{Page \thepage\ of \numpages}
8380 \end{verbatim}
8381 \end{example}
8382
8383 %--------------------------------------------------------------------
8384
8385 \begin{example}
8386 To have the header
8387 \samplehead{\large\bfseries Mathematics 115\\
8388 First Exam, July 4, 1776}%
8389 {}{\large\bfseries Name:\enspace\makebox[2in]{\hrulefill}}{}
8390 on the first page, the header
8391 \samplehead{\large\bfseries Mathematics 115\\
8392 First Exam, July 4, 1776}%
8393 {}{}{}
8394 on all pages after the first, an empty footer on the first page, and
8395 the footer
8396 \samplefoot{}{}{Page 2}{}
8397 on all pages after the first, give the
8398 commands\indc{firstpageheader}\indc{runningheader}%
8399 \indc{firstpagefooter}\indc{runningfooter}
8400 \begin{verbatim}
8401 \pagestyle{headandfoot}
8402 \firstpageheader{\large\bfseries Mathematics 115\\
8403 First Exam, July 4, 1776}
8404 {}
8405 {\large\bfseries Name:\enspace\makebox[2in]{\hrulefill}}
8406 \runningheader{\large\bfseries Mathematics 115\\
8407 First Exam, July 4, 1776}{}{}
8408 \firstpagefooter{}{}{}
8409 \runningfooter{}{Page \thepage}{}
8410 \end{verbatim}
8411 Alternatively, you could give the commands
8412 \begin{verbatim}
8413 \pagestyle{headandfoot}
8414 \lhead{\large\bfseries Mathematics 115\\ First Exam, July 4, 1776}
8415 \chead{}
8416 \rhead[{\large\bfseries Name:\enspace\makebox[2in]{\hrulefill}}]{}
8417 \lfoot{}
8418 \cfoot[]{Page \thepage}
8419 \rfoot{}
8420 \end{verbatim}
8421 (For an explanation of why there seems to be an extra pair of curly
8422 braces in the optional argument to the \verb"\rhead" command, see
8423 section~\ref{sec:OptArg}.)
8424 \end{example}
8425
8426 %--------------------------------------------------------------------
8427
8428 \begin{example}
8429 To have the header
8430 \samplehead{}
8431 {Wellesley College\\
8432 Second Semester Final Examination, Spring 1993\\
8433 Mathematics 115}
8434 {}
8435 {}
8436 on the first page, the header
8437 \samplehead{}
8438 {Wellesley College\\
8439 Second Semester Final Examination, Spring 1993\\
8440 Mathematics 115 (Continued)}
8441 {}
8442 {}
8443 on all pages after the first, the footer
8444 \samplefoot{}{}{Page 3 of 10}{Please go on to the next page\ldots}
8445 on all pages \emph{except the last} page, and the footer
8446 \samplefoot{}{}{Page 10 of 10}{End of exam.}
8447 on the last page, give the
8448 commands\indc{extraheadheight}\indc{firstpageheader}%
8449 \indc{runningheader}\indc{footer}\indc{numpages}\indc{thepage}%
8450 \indc{iflastpage}
8451 \begin{verbatim}
8452 \pagestyle{headandfoot}
8453 \extraheadheight{.25in}
8454 \firstpageheader{}
8455 {Wellesley College\\
8456 Second Semester Final Examination, Spring 1993\\
8457 Mathematics 115}
8458 {}
8459 \runningheader{}
8460 {Wellesley College\\
8461 Second Semester Final Examination, Spring 1993\\
8462 Mathematics 115 (Continued)}
8463 {}
8464 \footer{}
8465 {Page \thepage\ of \numpages}
8466 {\iflastpage{End of exam.}{Please go on to the next page\ldots}}
8467 \end{verbatim}
8468 Alternatively, you could give the commands
8469 \begin{verbatim}
8470 \pagestyle{headandfoot}
8471 \extraheadheight{.25in}
8472 \lhead{}
8473 \chead[Wellesley College\\
8474 Second Semester Final Examination, Spring 1993\\
8475 Mathematics 115]
8476 {Wellesley College\\
8477 Second Semester Final Examination, Spring 1993\\
8478 Mathematics 115 (Continued)}
8479 \rhead{}
8480 \lfoot{}
8481 \cfoot{Page \thepage\ of \numpages}
8482 \rfoot{\iflastpage{End of exam.}{Please go on to the next page\ldots}}
8483 \end{verbatim}
8484 \end{example}
8485
8486 %--------------------------------------------------------------------
8487
8488 \begin{example}
8489 To have the header
8490 \samplehead{}
8491 {Wellesley College\\
8492 Second Semester Final Examination, Spring 1993\\
8493 Mathematics 115}
8494 {}
8495 {}
8496 on the first page, the header
8497 \samplehead{Mathematics 115 (Continued)}{}{Spring, 1993}{}
8498 on all pages after the first, the footer
8499 \samplefoot{}{}{Page 3 of 10}{Please go on to the next page\ldots}
8500 on all pages \emph{except the last} page, and the footer
8501 \samplefoot{}{}{Page 10 of 10}{End of exam.}
8502 on the last page, give the commands\indc{extraheadheight}%
8503 \indc{firstpageheader}\indc{runningheader}\indc{footer}
8504 \begin{verbatim}
8505 \pagestyle{headandfoot}
8506 \extraheadheight[.25in]{}
8507 \firstpageheader{}
8508 {Wellesley College\\
8509 Second Semester Final Examination, Spring 1993\\
8510 Mathematics 115}
8511 {}
8512 \runningheader{Mathematics 115 (Continued)}{}{Spring, 1993}
8513 \footer{}
8514 {Page \thepage\ of \numpages}
8515 {\iflastpage{End of exam.}{Please go on to the next page\ldots}}
8516 \end{verbatim}
8517 Alternatively, you could give the commands
8518 \begin{verbatim}
8519 \pagestyle{headandfoot}
8520 \extraheadheight[.25in]{}
8521 \lhead[]{Mathematics 115 (Continued)}
8522 \chead[Wellesley College\\
8523 Second Semester Final Examination, Spring 1993\\
8524 Mathematics 115]
8525 {}
8526 \rhead[]{Spring, 1993}
8527 \lfoot{}
8528 \cfoot{Page \thepage\ of \numpages}
8529 \rfoot{\iflastpage{End of exam.}{Please go on to the next page\ldots}}
8530 \end{verbatim}
8531 \end{example}
8532
8533 %--------------------------------------------------------------------
8534
8535 \begin{example}
8536 To have the header
8537 %
8538 \samplehead{Math 115}{First Exam}{July 4, 1776}{}
8539 on the first page, the header
8540 %
8541 \samplehead{Question 3 continues\ldots}{First Exam}{Page 3 of 10}{\hrule}
8542 %
8543 on all pages after the first that continue a question begun on an
8544 earlier page, the header
8545 %
8546 \samplehead{}{First Exam}{Page 3 of 10}{\hrule}
8547 on all pages after the first that don't continue a question begun on
8548 an earlier page, the footer
8549 %
8550 \samplefoot{}{}{}{Question 6 continues on the next page\ldots}
8551 %
8552 on all pages whose last question continues onto the following page,
8553 and no footer on pages that don't have a question that continues
8554 onto the following page, give the
8555 commands\indc{runningheadrule}\indc{ifcontinuation}%
8556 \indc{ContinuedQuestion}\indc{firstpageheader}\indc{runningheader}%
8557 \indc{footer}\indc{thepage}\indc{numpages}\indc{ifincomplete}%
8558 \indc{IncompleteQuestion}
8559 \begin{verbatim}
8560 \pagestyle{headandfoot}
8561 \runningheadrule
8562 \newcommand{\continuedmessage}{%
8563 \ifcontinuation{Question \ContinuedQuestion\ continues\ldots}{}%
8564 }
8565 \firstpageheader{Math 115}{First Exam}{July 4, 1776}
8566 \runningheader{\continuedmessage}
8567 {First Exam}
8568 {Page \thepage\ of \numpages}
8569 \footer{}
8570 {}
8571 {\ifincomplete{Question \IncompleteQuestion\ continues
8572 on the next page\ldots}{}}
8573 \end{verbatim}
8574 Alternatively, you could give the commands
8575 \begin{verbatim}
8576 \pagestyle{headandfoot}
8577 \runningheadrule
8578 \newcommand{\continuedmessage}{%
8579 \ifcontinuation{Question \ContinuedQuestion\ continues\ldots}{}%
8580 }
8581 \lhead[Math 115]{\continuedmessage}
8582 \chead[First Exam]{First Exam}
8583 \rhead[July 4, 1776]{Page \thepage\ of \numpages}
8584 \lfoot{}
8585 \cfoot{}
8586 \rfoot{\ifincomplete{Question \IncompleteQuestion\ continues
8587 on the next page\ldots}{}}
8588 \end{verbatim}
8589 \end{example}
8590
8591 %--------------------------------------------------------------------
8592 \begin{example}
8593 \label{sec:PtsPgEx}
8594 To have the header
8595 %
8596 \samplehead{Math 115}{Second Exam}{July 4, 1776}{}
8597 %
8598 on the first page, the header
8599 %
8600 \samplehead{Second Exam}{}{July 4, 1776}{}
8601 %
8602 on all pages after the first, no footer on the first page, and the
8603 footer
8604 %
8605 \samplefoot{}{Page 3 of 5}{}{Points earned: \makebox[.5in]{\hrulefill}\\
8606 out of a possible 20 points}
8607 %
8608 on all pages after the first, give the commands\indc{firstpageheader}%
8609 \indc{runningheader}\indc{runningfooter}\indc{pointsonpage}%
8610 \indc{thepage}\indc{numpages}
8611 \begin{verbatim}
8612 \pagestyle{headandfoot}
8613 \firstpageheader{Math 115}{Second Exam}{July 4, 1776}
8614 \runningheader{Second Exam}{}{July 4, 1776}
8615 \runningfooter{Page \thepage\ of \numpages}
8616 {}
8617 {Points earned: \makebox[.5in]{\hrulefill}\\
8618 out of a possible \pointsonpage{\thepage} points}
8619 \end{verbatim}
8620 Alternatively, you could give the commands
8621 \begin{verbatim}
8622 \pagestyle{headandfoot}
8623 \lhead[Math 115]{Second Exam}
8624 \chead[Second Exam]{}
8625 \rhead{July 4, 1776}
8626 \lfoot[]{Page \thepage\ of \numpages}
8627 \cfoot{}
8628 \rfoot[]{Points earned: \makebox[.5in]{\hrulefill}\\
8629 out of a possible \pointsonpage{\thepage} points}
8630 \end{verbatim}
8631 \end{example}
8632
8633 %--------------------------------------------------------------------
8634
8635 \begin{example}
8636 \label{sec:endexamples}
8637 To have the header
8638 %
8639 \samplehead{Math 115}{Second Exam}{July 4, 1776}{}
8640 %
8641 on the first page, the header
8642 %
8643 \samplehead{}{Second Exam}{July 4, 1776}{}
8644 %
8645 on all odd numbered pages after the first, the header
8646 %
8647 \samplehead{Question 3 continues\ldots}{Math 115}{}{}
8648 %
8649 on all even numbered pages that continue a question begun on an
8650 earlier page, the header
8651 %
8652 \samplehead{}{Math 115}{}{}
8653 %
8654 on all even numbered pages that don't continue a question begun on
8655 an earlier page, the footer
8656 %
8657 \samplefoot{}{}{}{Page 5 of 10\\Question 6 continues\ldots}
8658 %
8659 on all odd numbered pages that have a question that continues onto
8660 the following page, the footer
8661 %
8662 \samplefoot{}{}{}{Page 5 of 10}
8663 %
8664 on all odd numbered pages that don't have a question that continues
8665 onto the following page, and the footer
8666 %
8667 \samplefoot{}{Page 4 of 10}{}{}
8668 %
8669 on all even numbered pages, give the commands\indc{ifcontinuation}%
8670 \indc{thepage}\indc{numpages}\indc{IncompleteQuestion}%
8671 \indc{firstpageheader}\indc{runningheader}\indc{oddeven}%
8672 \indc{footer}
8673 \begin{verbatim}
8674 \pagestyle{headandfoot}
8675 \newcommand{\continuedmessage}{%
8676 \ifcontinuation{Question \ContinuedQuestion\ continues\ldots}{}%
8677 }
8678 \newcommand{\oddrightfoot}{%
8679 \ifincomplete{Page \thepage\ of \numpages\\
8680 Question \IncompleteQuestion\ continues\ldots}%
8681 {Page \thepage\ of \numpages}
8682 }
8683 \firstpageheader{Math 115}{Second Exam}{July 4, 1776}
8684 \runningheader{\oddeven{}{\continuedmessage}}
8685 {\oddeven{Second Exam}{Math 115}}
8686 {\oddeven{July 4, 1776}{}}
8687 \footer{\oddeven{}{Page \thepage\ of \numpages}}
8688 {}
8689 {\oddeven{\oddrightfoot}{}}
8690 \end{verbatim}
8691 Alternatively, you could give the commands
8692 \begin{verbatim}
8693 \pagestyle{headandfoot}
8694 \newcommand{\continuedmessage}{%
8695 \ifcontinuation{Question \ContinuedQuestion\ continues\ldots}{}%
8696 }
8697 \newcommand{\oddrightfoot}{%
8698 \ifincomplete{Page \thepage\ of \numpages\\
8699 Question \IncompleteQuestion\ continues\ldots}%
8700 {Page \thepage\ of \numpages}
8701 }
8702 \lhead[Math 115]{\oddeven{}{\continuedmessage}}
8703 \chead{\oddeven{Second Exam}{Math 115}}
8704 \rhead{\oddeven{July 4, 1776}{}}
8705 \lfoot{\oddeven{}{Page \thepage\ of \numpages}}
8706 \cfoot{}
8707 \rfoot{\oddeven{\oddrightfoot}{}}
8708 \end{verbatim}
8709 \end{example}
8710
8711
8712 \indcstop{lhead}
8713 \indcstop{chead}
8714 \indcstop{rhead}
8715 \indcstop{lfoot}
8716 \indcstop{cfoot}
8717 \indcstop{rfoot}
8718 \index{footer|)}
8719 \index{header|)}
8720
8721 %--------------------------------------------------------------------
8722 %--------------------------------------------------------------------
8723 \section{Cover pages}
8724 \label{sec:coverpages}
8725 \index{cover pages|(}
8726 \index{environment!coverpages|(}
8727 \indtstart{coverpages}
8728
8729 There is a \verb"coverpages" environment that allows you to have one
8730 or more pages before page~1 of the exam. By default, there are no
8731 headers or footers printed on the cover pages, but if you put the page
8732 number into the headers and/or footers (using the commands described
8733 in section~\ref{sec:Coverhdft}), the page numbers of cover pages are
8734 printed in roman numerals.
8735
8736 The \verb"coverpages" environment must begin and end \emph{before} the
8737 beginning of the \verb"questions" environment. You begin the
8738 environment with the command
8739 \begin{center}
8740 \verb"\begin{coverpages}"
8741 \end{center}
8742 and you end it with the command
8743 \begin{center}
8744 \verb"\end{coverpages}"
8745 \end{center}
8746 In between those two commands you can put whatever you want, except
8747 that you are not allowed to begin the \verb"questions" environment
8748 until you've ended the \verb"coverpages" environment. The command
8749 \verb"\begin{coverpages}" sets the page number to 1 and causes any
8750 page numbers printed (using the commands described in
8751 section~\ref{sec:Coverhdft}) to appear as roman numerals. The command
8752 \verb"\end{coverpages}" causes the current page to end, sets the page
8753 number of the following page to 1, and changes page numbering back to
8754 arabic numerals.
8755
8756 %--------------------------------------------------------------------
8757 \subsection{Headers and footers}
8758 \label{sec:Coverhdft}
8759 \index{header!on cover pages|(}
8760 \index{footer!on cover pages|(}
8761
8762 By default, the headers and footers on the cover pages are empty. If
8763 you'd like to have headers and/or footers on the cover pages, there
8764 are commands to create them that are completely analogous to the
8765 commands described in section~\ref{sec:headfoot} for headers and
8766 footers in the main part of the document. The commands for headers
8767 and footers in cover pages and the corresponding commands for the main
8768 exam pages are:\indc{coverheader}\indc{coverrunningheader}%
8769 \indc{coverfirstpageheader}\indc{coverlhead}\indc{coverchead}%
8770 \indc{coverrhead}\indc{coverfooter}\indc{coverrunningfooter}%
8771 \indc{coverfirstpagefooter}\indc{coverlfoot}\indc{covercfoot}%
8772 \indc{coverrfoot}\indc{coverextraheadheight}%
8773 \indc{coverextrafootheight}
8774 \begin{center}
8775 \begin{tabular}{l@{\qquad\qquad}l}
8776 Cover Pages Commands& Main Pages Commands\\[\medskipamount]
8777 \verb"\coverheader"&\verb"\header"\\
8778 \verb"\coverrunningheader"&\verb"\runningheader"\\
8779 \verb"\coverfirstpageheader"&\verb"\firstpageheader"\\[\medskipamount]
8780
8781 \verb"\coverlhead"&\verb"\lhead"\\
8782 \verb"\coverchead"&\verb"\chead"\\
8783 \verb"\coverrhead"&\verb"\rhead"\\[\medskipamount]
8784
8785 \verb"\coverfooter"&\verb"\footer"\\
8786 \verb"\coverrunningfooter"&\verb"\runningheader"\\
8787 \verb"\coverfirstpagefooter"&\verb"\firstpageheader"\\[\medskipamount]
8788
8789 \verb"\coverlfoot"&\verb"\lfoot"\\
8790 \verb"\covercfoot"&\verb"\cfoot"\\
8791 \verb"\coverrfoot"&\verb"\rfoot"\\[\medskipamount]
8792
8793 \verb"\coverextraheadheight"&\verb"\extraheadheight"\\
8794 \verb"\coverextrafootheight"&\verb"\extrafootheight"
8795 \end{tabular}
8796 \end{center}
8797 The commands \verb"\coverlhead", \verb"\coverchead",
8798 \verb"\coverrhead", \verb"\coverlfoot", \verb"\covercfoot",
8799 \verb"\coverrfoot", \verb"\coverextraheadheight", and
8800 \verb"\coverextrafootheight" all all take the same optional arguments
8801 (for special treatment of page number 1) as the corresponding commands
8802 for the main pages. For an explanation of these commands, see
8803 section~\ref{sec:headfoot}.
8804
8805 \index{header!on cover pages|)}
8806 \index{footer!on cover pages|)}
8807
8808 %--------------------------------------------------------------------
8809 \subsection{Listing the number of cover pages}
8810 \label{sec:NumCvrpgs}
8811 \index{cover pages!counting|(}
8812 \indcstart{numcoverpages}
8813 \indcstart{totalnumpages}
8814
8815 The \texttt{exam} document class defines the command
8816 \verb"\numcoverpages" so that it will expand to the number of cover
8817 pages in the exam. If there is no \texttt{coverpages} environment,
8818 then \verb"\numcoverpages" expands to 0. The \texttt{exam} class also
8819 defines the command \verb"\totalnumpages", which expands to the sum of
8820 \verb"\numpages" and \verb"\numcoverpages".
8821 \emph{Note:} if there are pages preceding a \texttt{coverpages}
8822 environment, then those pages will not be counted by
8823 \verb"\totalnumpages".
8824
8825 For an example, to have the footer
8826 %
8827 \samplefoot{}{}{Page ii of iv}{}
8828 on all cover pages you should either give the
8829 command\indc{romannumeral}
8830 \begin{verbatim}
8831 \coverfooter{}{Page \thepage\ of \romannumeral\numcoverpages}{}
8832 \end{verbatim}
8833 or the commands
8834 \begin{verbatim}
8835 \coverlfoot{}
8836 \covercfoot{Page \thepage\ of \romannumeral\numcoverpages}
8837 \coverrfoot{}
8838 \end{verbatim}
8839 As with all other cross referencing commands in \LaTeX, you'll have to
8840 run the file through \LaTeX{} \emph{twice} to be sure that
8841 \verb"\numpages", \verb"\numcoverpages", and \verb"\totalnumpages" are
8842 correct.
8843
8844 \index{cover pages!counting|)}
8845 \indcstop{numcoverpages}
8846 \indcstop{totalnumpages}
8847
8848 \indtstop{coverpages}
8849 \index{environment!coverpages|)}
8850 \index{cover pages|)}
8851
8852 %--------------------------------------------------------------------
8853 \clearpage
8854 \addcontentsline{toc}{section}{Index}
8855 \printindex
8856
8857 % The following is necessary to avoid warnings, since we have multiple
8858 % questions environments in this documentation file:
8859 \makeatletter
8860 \@pointschangedfalse
8861 \makeatother
8862
8863
8864
8865
8866 \end{document}
8867 %--------------------------------------------------------------------
8868 %--------------------------------------------------------------------
8869 %--------------------------------------------------------------------
8870
8871 %%% Local Variables:
8872 %%% mode: latex
8873 %%% TeX-master: t
8874 %%% End: