summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2008-07-23 22:06:36 +0000
committerKarl Berry <karl@freefriends.org>2008-07-23 22:06:36 +0000
commit8c7d1cdf9705933f11e3dff4105c1054427677d2 (patch)
tree0e9c65ee772af82525eb5256345d3481ea83d2f7 /Master
parent52efa785279f9f2f1f79c0836a3a67eecaa4ed16 (diff)
exam 2.3 (19jul08)
git-svn-id: svn://tug.org/texlive/trunk@9734 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/doc/latex/exam/README59
-rw-r--r--Master/texmf-dist/doc/latex/exam/exam-2.3.md53
-rw-r--r--Master/texmf-dist/doc/latex/exam/examdoc.pdfbin299271 -> 410111 bytes
-rw-r--r--Master/texmf-dist/doc/latex/exam/examdoc.tex4314
-rw-r--r--Master/texmf-dist/tex/latex/exam/exam.cls4036
5 files changed, 5395 insertions, 3017 deletions
diff --git a/Master/texmf-dist/doc/latex/exam/README b/Master/texmf-dist/doc/latex/exam/README
index 4388a1dd6c4..7e9ee445400 100644
--- a/Master/texmf-dist/doc/latex/exam/README
+++ b/Master/texmf-dist/doc/latex/exam/README
@@ -1,32 +1,45 @@
-This is version 2.2 of the exam documentclass, a major extension of
-version 2.01. Version 2.2 is fully backward compatible with version 2.01.
+This is version 2.3 of the exam document class, dated July 16, 2008.
-The exam documentclass, together with its documentation file
-examdoc.tex, attempts to make it easy for even a LaTeX novice to prepare
-exams. Simple commands are provided to:
+The exam document class, together with its documentation file
+examdoc.tex, attempts to make it easy for even a LaTeX novice to
+prepare exams. Simple commands are provided to:
-1. Create questions, parts of questions, subparts of parts, and subsubparts
-of subparts, all with optional point values.
+1. Create questions, parts of questions, subparts of parts, and
+subsubparts of subparts, all with optional point values.
-2. Create a grading table, indexed either by question number (listing each
-question and the total possible points for that question) or by page number
-(listing each page with points and the total possible points for that page).
+2. Create a grading table, indexed either by question number (listing
+each question and the total possible points for that question) or by
+page number (listing each page with points and the total possible
+points for that page).
-3. Create headers and footers that are each specified in three parts: One
-part to be left justified, one part to be centered, and one part to be right
-justified.
+3. Create headers and footers that are each specified in three parts:
+One part to be left justified, one part to be centered, and one part
+to be right justified.
-4. Headers and/or footers can be different on the first page of the exam,
-can be different on the last page of the exam, and can vary depending on
-whether the page number is odd or even, or on whether the current page
-continues a question from a previous page, or on whether the last question
-on the current page continues onto the following page.
+4. Have headers and/or footers that are different on the first page of
+the exam, different on the last page of the exam, and that vary
+depending on whether the page number is odd or even, or on whether the
+current page continues a question from a previous page, or on whether
+the last question on the current page continues onto the following
+page.
-5. Multiple line headers and/or footers are allowed, and it's easy to
-increase the part of the page devoted to headers and/or footers to allow
-for this.
+5. Have multiple line headers and/or footers, and to increase the part
+of the page devoted to headers and/or footers to allow for this.
+6. Include solutions and have these solutions either printed or
+ignored (or replaced automatically by space in which the students can
+write their answers) depending on a single command.
-The documentation file examdoc.tex attempts to explain all of the
-possibilities in a readable way, with many specific examples.
+7. Change the words that are inserted by the document class (for,
+e.g., point values, or table headings), so that they can be adapted to
+personal taste and/or languages other than English.
+
+The documentation file examdoc.tex attempts to explain all of the
+possibilities in a readable way, with many specific examples.
+
+--------------------------------------------------------------------
+
+This work may be distributed and/or modified under the conditions of
+the LaTeX Project Public License, either version 1.3 of this license
+or (at your option) any later version.
diff --git a/Master/texmf-dist/doc/latex/exam/exam-2.3.md5 b/Master/texmf-dist/doc/latex/exam/exam-2.3.md5
new file mode 100644
index 00000000000..575927f0882
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/exam/exam-2.3.md5
@@ -0,0 +1,3 @@
+1b4aa744438dd957cb0387f72027ce40 exam.cls
+f4f60059de1a00a5d561fad9f46bb5e4 examdoc.pdf
+e771547c36e897cc79a5da53676189f6 examdoc.tex
diff --git a/Master/texmf-dist/doc/latex/exam/examdoc.pdf b/Master/texmf-dist/doc/latex/exam/examdoc.pdf
index 60fdab58949..9356f293640 100644
--- a/Master/texmf-dist/doc/latex/exam/examdoc.pdf
+++ b/Master/texmf-dist/doc/latex/exam/examdoc.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/exam/examdoc.tex b/Master/texmf-dist/doc/latex/exam/examdoc.tex
index 2e6eaac9c9f..39c49337e06 100644
--- a/Master/texmf-dist/doc/latex/exam/examdoc.tex
+++ b/Master/texmf-dist/doc/latex/exam/examdoc.tex
@@ -8,17 +8,17 @@
% The exam documentclass itself is in the file exam.cls.
-%%% Copyright (c) 1997, 2000, 2004 Philip S. Hirschhorn
+%%% Copyright (c) 1997, 2000, 2004, 2008 Philip S. Hirschhorn
%
-% This program may be distributed and/or modified under the
-% conditions of the LaTeX Project Public License, either version 1.2
+% This work may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either version 1.3
% of this license or (at your option) any later version.
% The latest version of this license is in
% http://www.latex-project.org/lppl.txt
-% and version 1.2 or later is part of all distributions of LaTeX
-% version 1999/12/01 or later.
+% and version 1.3 or later is part of all distributions of LaTeX
+% version 2003/12/01 or later.
%
-% This program consists of the files exam.cls and examdoc.tex
+% This work consists of the files exam.cls and examdoc.tex
% The user documentation for exam.cls is in the file examdoc.tex.
@@ -37,24 +37,18 @@
%--------------------------------------------------------------------
\documentclass[12pt]{exam}
-%\usepackage{hyperref}
+\usepackage{hyperref}
-\newcommand{\docversion}{2.2}
-\newcommand{\docdate}{August 14, 2004}
+\newcommand{\docversion}{2.3}
+\newcommand{\docdate}{July 18, 2008}
%\newcommand{\docdate}{\today}
%--------------------------------------------------------------------
%
-% Changes from version 2.01 onward are described in the comments
+% Changes since version 2.2 are described in the comments
% near the beginning of the file exam.cls.
%
%--------------------------------------------------------------------
-%
-% The only change from version 2.0 to version 2.01 is that this
-% documentclass (and its accompanying documentation) is now
-% explicitly distributed under the LaTeX Project Public License.
-%
-%--------------------------------------------------------------------
%---------------------------------------------------------------------
\newenvironment{example}%
{\bigskip\filbreak
@@ -62,41 +56,38 @@
}%
{}
-
\def\samplehead#1#2#3#4{%
\begin{trivlist}
- \item[]
- \leavevmode
- \hbox to \textwidth{%
- \rlap{\parbox[b]{\textwidth}{\raggedright#1\strut}}%
- \hfil\parbox[b]{\textwidth}{\centering#2\strut}\hfil
- \llap{\parbox[b]{\textwidth}{\raggedleft#3\strut}}%
- }% hbox
- #4
+ \item[]
+ \leavevmode
+ \hbox to \textwidth{%
+ \rlap{\parbox[b]{\textwidth}{\raggedright#1\strut}}%
+ \hfil\parbox[b]{\textwidth}{\centering#2\strut}\hfil
+ \llap{\parbox[b]{\textwidth}{\raggedleft#3\strut}}%
+ }% hbox
+ #4
\end{trivlist}
}
\def\samplefoot#1#2#3#4{%
\begin{trivlist}
- \item[]
- \leavevmode
- #1
- \vskip 3pt
-
- \hbox to \textwidth{%
- \rlap{\parbox[t]{\textwidth}{\raggedright#2}}%
- \hfil\parbox[t]{\textwidth}{\centering#3}\hfil
- \llap{\parbox[t]{\textwidth}{\raggedleft#4}}%
+ \item[]
+ \leavevmode
+ #1
+ \vskip 3pt
+
+ \hbox to \textwidth{%
+ \rlap{\parbox[t]{\textwidth}{\raggedright#2}}%
+ \hfil\parbox[t]{\textwidth}{\centering#3}\hfil
+ \llap{\parbox[t]{\textwidth}{\raggedleft#4}}%
}% hbox
\end{trivlist}
}
-
-
\makeatletter
-\@ifundefined{AmS}{\def\AmS{{\protect\the\textfont\tw@
- A\kern-.1667em\lower.5ex\hbox{M}\kern-.125emS}}}
- {}
+ \@ifundefined{AmS}{\def\AmS{{\protect\the\textfont\tw@
+ A\kern-.1667em\lower.5ex\hbox{M}\kern-.125emS}}}
+ {}
\makeatother
@@ -110,12 +101,12 @@
\title{Using the exam document class}
\author{Philip Hirschhorn\\
-Department of Mathematics\\
-Wellesley College\\
-Wellesley, MA 02481\\
-psh@math.mit.edu\\[\bigskipamount]
-Copyright \copyright~1994, 1997, 2000, 2004 Philip Hirschhorn\\
- All rights reserved}
+ Department of Mathematics\\
+ Wellesley College\\
+ Wellesley, MA 02481\\
+ psh@math.mit.edu\\[\bigskipamount]
+ Copyright \copyright~1994, 1997, 2000, 2004, 2008 Philip Hirschhorn\\
+ All rights reserved}
\date{\docdate}
@@ -129,53 +120,53 @@ Copyright \copyright~1994, 1997, 2000, 2004 Philip Hirschhorn\\
\tableofcontents
+%--------------------------------------------------------------------
\section{Introduction}
The file \verb"exam.cls" provides the \verb"exam" document class,
which attempts to make it easy for even a \LaTeX{} novice to prepare
-exams. Most of what's done by the \verb"exam" document class can also
-be accomplished by using \verb"fancyheadings.sty", adjusting \LaTeX's
-page layout parameters (perhaps by using \verb"fullpage.sty"), and
-making careful use of the \verb"list" environment, but the \verb"exam"
-document class tries to make all this as simple as possible.
-
-Specifically, \verb"exam.cls" sets the page layout so that there are
-one inch margins all around (no matter what size paper you're using)
-and provides commands that make it easy to format questions, create
-very flexible headers and footers, and change the margins. In
-particular:
+exams. Specifically, \verb"exam.cls" sets the page layout so that
+there are one inch margins all around (no matter what size paper
+you're using) and provides commands that make it easy to format
+questions, create grading tables, create flexible headers and footers,
+and change the margins. In more detail:
\begin{itemize}
\item The class will automatically format and number the questions,
- parts of questions, subparts of questions, and subsubparts of
- questions, while making it easy to refer to specific questions by
- number in any special directions you need to print on the exam.
+ parts of questions, subparts of parts, and subsubparts of subparts
+ (see sections \ref{sec:Questions} and~\ref{sec:parts}).
\item You can include the point value of each question (or part, or
subpart, or subsubpart), with your choice of having the point values
printed at the beginning of the text of the question, opposite that
in the left margin, opposite that in the right margin, or in the
- right margin opposite the end of the question.
+ right margin opposite the end of the question (see
+ section~\ref{sec:points}).
\item The class will add up the total points for each question (and
all of its parts, subparts, and subsubparts) and the total points on
- each page, and make those totals available in macros. You can also
- have the class print a grading table indexed either by question
- number or by page number.
-\item You can specify the header in three parts: The left head, the
- center head, and the right head. The left head is left justified,
- the center head is centered, and the right head is right justified,
- and one or all of these can be omitted.
+ each page, and make those totals available in macros (see sections
+ \ref{sec:addup}, \ref{sec:pointsofq} and~\ref{sec:pointsonp}). You
+ can also have the class print a grading table indexed either by
+ question number or by page number (see
+ section~\ref{sec:GradeTables}).
+\item You specify the header in three parts: One part to be left
+ justified, one part to be centered, and one part to be right
+ justified, and one or all of these can be omitted (see
+ section~\ref{sec:header}).
\item The footer is also specified in three parts: Left justified,
- centered, and right justified.
+ centered, and right justified (see section~\ref{sec:footer}).
\item The header and footer for the first page can be different from
- the ones used on other pages.
+ the ones used on other pages (see sections \ref{sec:runningheader},
+ \ref{sec:lhead}, \ref{sec:runningfooter}, and \ref{sec:lfoot}).
\item Both headers and footers can contain more than one line. To
- accommodate headers and footers with many lines, simple commands are
- provided to increase the parts of the page devoted to the header
+ accommodate headers and footers with several lines, simple commands
+ are provided to enlarge the part of the page devoted to the header
and/or footer, and these commands can give one amount of space on
- the first page and a different amount of space on all other pages.
+ the first page and a different amount of space on all other pages
+ (see section~\ref{sec:extra-room}).
\item Macros are defined to enable you to state in the header and/or
- footer the total number of pages in the exam, and to change the
- header and/or footer that appears on the \emph{last} page of the
- exam.
+ footer the total number of pages in the exam (see
+ section~\ref{sec:numpages}) and to change the header and/or footer
+ that appears on the last page of the exam (see
+ section~\ref{sec:lastpage}).
\item Macros are defined so that the headers and footers can vary
depending on whether the current page begins a new question or
continues a question that started on an earlier page (and, if one
@@ -183,53 +174,109 @@ particular:
question is). Macros are also defined so that the headers and
footers can vary depending on whether a question is complete on the
current page or continues on to the next page (and, if one
- continues, to say what the number of that question is).
+ continues, to say what the number of that question is) (see
+ section~\ref{sec:QuesSpan}).
\item You can have a horizontal rule at the base of the header and/or
- at the top of the footer.
+ at the top of the footer (see section~\ref{sec:rules}).
+\item The exam can begin with one or more cover pages, which are
+ numbered separately from the main pages of the exam and which can
+ have headers and footers different from the ones in the main pages
+ of the exam (see section~\ref{sec:coverpages}).
+\item You can include solutions in your \LaTeX{} file and have these
+ solutions either printed or ignored (or replaced automatically by
+ space in which the students can write their answers) depending on a
+ single command (see section~\ref{sec:solutions},
+ section~\ref{sec:CorrectChoice}, and section~\ref{sec:AnsShortAns}).
\end{itemize}
+The latest version of \verb"exam.cls" (possibly a beta test version)
+should always be available at \verb"http://www-math.mit.edu/~psh/".
%--------------------------------------------------------------------
+%--------------------------------------------------------------------
\section{License}
\begin{itemize}
-\item This work may be distributed and/or modified under the conditions of
- the \LaTeX{} Project Public License, either version~1.3 of this
- license or (at your option) any later version. The latest version
- of this license is in \verb"http://www.latex-project.org/lppl.txt"
- and version 1.3 or later is part of all distributions of \LaTeX{}
- version 2003/12/01 or later.
-\item This work has the LPPL maintenance status
- ``author-maintained''.
-\item This work consists of the files exam.cls and examdoc.tex.
+\item This work may be distributed and/or modified under the
+ conditions of the \LaTeX{} Project Public License, either
+ version~1.3 of this license or (at your option) any later version.
+ The latest version of this license is in
+ \verb"http://www.latex-project.org/lppl.txt" and version 1.3 or
+ later is part of all distributions of \LaTeX{} version 2003/12/01 or
+ later.
+\item This work has the LPPL maintenance status ``author-maintained''.
+\item This work consists of the files \verb"exam.cls" and
+ \verb"examdoc.tex".
\end{itemize}
%---------------------------------------------------------------------
-\section{The \texttt{documentclass} command}
+%--------------------------------------------------------------------
+\section{The \texttt{\char`\\documentclass} command}
To use the \verb"exam" document class, you should specify \verb"exam"
-as your main document class. For example, if you want to use
-12~point type, then your \verb"documentclass" command should be
-%
+as the required argument to your \verb"\documentclass" command, as in
\begin{center}
-\verb"\documentclass[12pt]{exam}"
+ \verb"\documentclass{exam}"
\end{center}
-%
-If you would also like to use some of the features of \AmS-\LaTeX,
-then you should use the commands
-%
+or, e.g., if you want to use 12~point type,
+\begin{center}
+ \verb"\documentclass[12pt]{exam}"
+\end{center}
+There are two possible optional arguments that are specific to the
+\verb"exam" document class: \verb"addpoints" and \verb"solutions".
+Most documents that use the \verb"exam" document class should use the
+option \verb"addpoints" (see section~\ref{sec:addpoints}); the option
+\verb"answers" is used when you want to print solutions to the
+questions (see section~\ref{sec:answers}).
+
+%--------------------------------------------------------------------
+\subsection{The option \texttt{addpoints}}
+\label{sec:addpoints}
+
+The \verb"\documentclass" option \verb"addpoints", used as in
+\begin{center}
+ \verb"\documentclass[addpoints]{exam}"
+\end{center}
+or
+\begin{center}
+ \verb"\documentclass[12pt,addpoints]{exam}"
+\end{center}
+enables the commands that add up the points (see sections
+\ref{sec:addup}, \ref{sec:Count}, \ref{sec:pointsofq},
+and~\ref{sec:pointsonp}) and that produce grading tables and point
+tables (see sections \ref{sec:GradeTables} and~\ref{sec:PointTables}).
+This is an option, rather than the default, mainly for the sake of
+maintaining backward compatibility; most documents that use the
+\verb"exam" document class should use this option. The only reason
+\emph{not} to use the \verb"addpoints" option is that this option
+creates an error if you include any words in an argument that assigns
+points to a question (see section~\ref{sec:points}). If
+\verb"addpoints" is not in effect you can put whatever you want in the
+argument for the points, but if \verb"addpoints" \emph{is} in effect
+then the argument that contains the points must contain only digits
+and the command \verb"\half" (see section~\ref{sec:Half}).
+
+You can also turn \verb"addpoints" on and off wherever you like in the
+exam by using the commands
\begin{center}
\begin{tabular}{l}
- \verb"\documentclass[12pt]{exam}"\\
- \verb"\usepackage{amsmath}"
+ \verb"\addpoints"\\
+ \verb"\noaddpoints"
\end{tabular}
\end{center}
-%
-If you will be typing solutions into the exam (see
-section~\ref{sec:solutions}) and you'd like the solutions to be
-printed on the next run of \LaTeX, you should include the document
-class option \verb"answers", as in
+Using the document class option \verb"addpoints" is equivalent to
+giving the command \verb"\addpoints" at the beginning of the exam.
+
+%--------------------------------------------------------------------
+\subsection{The option \texttt{answers}}
+\label{sec:answers}
+
+If you will be typing solutions into the exam (see sections
+\ref{sec:solutions}, \ref{sec:CorrectChoice},
+and~\ref{sec:AnsShortAns}) and you'd like the solutions to be printed
+on the next run of \LaTeX, you should include the document class
+option \verb"answers", as in
\begin{center}
\verb"\documentclass[answers]{exam}"
\end{center}
@@ -237,12 +284,39 @@ or
\begin{center}
\verb"\documentclass[answers,12pt]{exam}"
\end{center}
-This is optional, though; you can accomplish the same thing by giving
-the command \verb"\printanswers" (see section~\ref{sec:solutions}).
-
-
+or
+\begin{center}
+ \verb"\documentclass[12pt,addpoints,answers]{exam}"
+\end{center}
+Using the document class option \verb"answers" is equivalent to giving
+the command \verb"\printanswers" at the beginning of the exam (see
+section~\ref{sec:solutions}). The effect of this is that
+\begin{itemize}
+\item the contents of the environments
+ \begin{center}
+ \begin{tabular}{l}
+ \verb"solution",\\
+ \verb"solutionorlines", and\\
+ \verb"solutionordottedlines"
+ \end{tabular}
+ \end{center}
+ (see section~\ref{sec:solutions}) will be printed on the next run of
+ \LaTeX,
+\item any choices of a \verb"choices" or \verb"oneparchoices"
+ environment (see section~\ref{sec:MulChc}) that are created using a
+ \verb"\CorrectChoice" command (see section~\ref{sec:CorrectChoice})
+ instead of a \verb"\choice" command will be printed with emphasis as
+ determined by the argument of the most recent
+ \verb"\CorrectChoiceEmphasis" command (which by default is
+ \verb"\bfseries"), and
+\item any \verb"\answerline" commands (see section~\ref{sec:ShortAns})
+ that include an optional argument containing the answer (see
+ section~\ref{sec:AnsShortAns}) will have the answer printed on the
+ answer line.
+\end{itemize}
%--------------------------------------------------------------------
+%--------------------------------------------------------------------
\section{Asking for the student's name}
This isn't anything specific to the \verb"exam" document class, but
@@ -250,7 +324,6 @@ it's worth mentioning because it isn't obvious. If you're leaving
space for the answers on the question pages (see
section~\ref{sec:LeaveSpace}), then you'll probably also want to leave
space for the student's name. If you type
-%
\begin{verbatim}
\begin{center}
\fbox{\fbox{\parbox{5.5in}{\centering
@@ -261,13 +334,12 @@ space for the student's name. If you type
\vspace{0.1in}
-\hbox to \textwidth{Name and section:\enspace\hrulefill}
+\makebox[\textwidth]{Name and section:\enspace\hrulefill}
\vspace{0.2in}
-\hbox to \textwidth{Instructor's name:\enspace\hrulefill}
+\makebox[\textwidth]{Instructor's name:\enspace\hrulefill}
\end{verbatim}
-%
after the \verb"\begin{document}" command and before the
\verb"\begin{questions}" command (see section~\ref{sec:Questions}),
then you'll get\\
@@ -282,24 +354,54 @@ then you'll get\\
\vspace{0.1in}
-\hbox to \textwidth{Name and section:\enspace\hrulefill}
+\makebox[\textwidth]{Name and section:\enspace\hrulefill}
\vspace{0.2in}
-\hbox to \textwidth{Instructor's name:\enspace\hrulefill}
+\makebox[\textwidth]{Instructor's name:\enspace\hrulefill}
}
%---------------------------------------------------------------------
-\section{Questions}
+%--------------------------------------------------------------------
+\section{Questions and points}
+\label{sec:QuestionsPoints}
+
+To create questions, you use a \verb"questions" environment (see
+section~\ref{sec:Questions}); each question is begun with a
+\verb"\question" command, which takes an optional argument to assign
+some number of points to the question (see section~\ref{sec:points}).
+The questions are numbered automatically. Point values can include
+half points (see section~\ref{sec:Half}).
+
+If you want a question to have several parts, you use a \verb"parts"
+environment (see section~\ref{sec:parts}); each part is begun with a
+\verb"\part" command, which takes an optional argument to assign some
+number of points to the part (see section~\ref{sec:points}). The
+parts are numbered automatically. Similarly, parts can have subparts,
+and subparts can have subsubparts (see section~\ref{sec:parts}).
+
+The points for a question (or part, or subpart, or subsubpart) appear
+by default at the beginning of the question (or part, etc.), but there
+are commands to have the points appear instead in either the left
+margin or in the right margin (see section~\ref{sec:whereprint} and
+section~\ref{sec:DrpPts}). The formatting of the points can also be
+customized (see sections \ref{sec:Boxed}, \ref{sec:pointname},
+\ref{sec:margins}, and~\ref{sec:pointformat}). It's also possible to
+have questions (or parts, etc.) that are worth ``bonus points'', which
+are added up separately from the non-bonus points (see
+section~\ref{sec:Bonus}).
+
+
+%--------------------------------------------------------------------
+\subsection{Questions}
\label{sec:Questions}
-To type the questions in the exam, you use the \verb"questions"
+To type the questions on the exam you use the \verb"questions"
environment. Each question is then begun with the command
-\verb"\question", and the questions will be numbered automatically.
+\verb"\question", and the questions are numbered automatically.
For example, if you type
-%
\begin{verbatim}
\begin{questions}
@@ -311,13 +413,10 @@ Why is there air?
How much wood would a woodchuck chuck if a woodchuck could chuck
wood?
-\question
-Compute $\displaystyle\int_0^1 x^2 \, dx$.
+\question Compute $\displaystyle\int_0^1 x^2 \, dx$.
\end{questions}
\end{verbatim}
-%
then you'll get
-%
\begin{questions}
\question
@@ -328,8 +427,7 @@ Why is there air?
How much wood would a woodchuck chuck if a woodchuck could chuck
wood?
-\question
-Compute $\displaystyle\int_0^1 x^2 \, dx$.
+\question Compute $\displaystyle\int_0^1 x^2 \, dx$.
\end{questions}
\bigskip
@@ -342,10 +440,10 @@ environment, and they will be ignored.
%---------------------------------------------------------------------
\subsection{Questions with parts and subparts (and subsubparts)}
+\label{sec:parts}
If you want a question to have several parts, then you use the
\verb"parts" environment. For example, if you type
-%
\begin{verbatim}
\begin{questions}
\question
@@ -376,7 +474,6 @@ If the universe were to end, how would you know?
\end{questions}
\end{verbatim}
-%
then you'll get
\begin{questions}
\question
@@ -410,27 +507,20 @@ If the universe were to end, how would you know?
\bigskip
The above example illustrates several things:
-%
\begin{itemize}
-\item
-Parts of a question should be put into a \verb"parts" environment.
-
-\item
-If a question begins with a \verb"parts" environment, then the first
-part will appear on the same line with the question number.
-
-\item
-You can leave blank lines before and after the \verb"\part" command,
-and they will be ignored.
+\item Parts of a question should be put into a \verb"parts"
+ environment.
+\item If a question begins with a \verb"parts" environment, then the
+ first part will appear on the same line with the question number.
+\item You can leave blank lines before and after the \verb"\part"
+ command, and they will be ignored.
\end{itemize}
-
\bigskip
There is also a \verb"subparts" environment, and even a
\verb"subsubparts" environment, and they work just as you would
expect. For example, if you type
-%
\begin{verbatim}
\begin{questions}
\question
@@ -500,7 +590,6 @@ This is another part.
\end{questions}
\end{verbatim}
-%
then you'll get
\begin{questions}
\question
@@ -570,17 +659,268 @@ This is another part.
\end{questions}
+The numbers and letters used to number questions, parts, subparts, and
+subsubparts can be customized; see section~\ref{sec:CustNumb}.
+
+%--------------------------------------------------------------------
+\subsection{Multiple choice questions}
+\label{sec:MulChc}
+
+There are two environments for listing the possible answers to a
+multiple choice question:
+\begin{itemize}
+\item The \verb"choices" environment creates a list with the choices
+ as the items in the list (see section~\ref{sec:choices}).
+\item The \verb"oneparchoices" environment lists all of the choices in
+ a single paragraph (that is a continuation of the paragraph
+ preceding the environment unless you leave a blank line before
+ beginning the environment) (see section~\ref{sec:oneparchoices}).
+\end{itemize}
+Both of these environments use upper case letters (i.e., ``A'', ``B'',
+``C'', \ldots) to label the choices; to change this, see
+section~\ref{sec:CustNumb}. Both of these environments allow you to
+designate one or more choices as correct choices and to have the
+correct choices printed with emphasis when solutions are being printed
+(see section~\ref{sec:CorrectChoice}).
+
+If you don't want the students to just circle the correct choices, you
+can use the \verb"\answerline" command to print a line on which the
+answer should be written (see section~\ref{sec:ShortAns}). The
+\verb"\anwerline" command allows you to include as an optional
+argument the answer to the question, and the answer will be printed on
+the line when solutions are bing printed (see
+section~\ref{sec:AnsShortAns}).
+
+
+
+%--------------------------------------------------------------------
+\subsubsection{The \texttt{choices} environment}
+\label{sec:choices}
+
+For example, if you type
+\begin{verbatim}
+\begin{questions}
+\question
+One of these things is not like the others; one of these things is not
+the same. Which one is different?
+\begin{choices}
+\choice John
+\choice Paul
+
+\choice
+
+George
+
+\choice Ringo
+
+\choice Socrates
+
+\end{choices}
+
+\end{questions}
+\end{verbatim}
+Then you'll get
+\begin{questions}
+\question
+One of these things is not like the others; one of these things is not
+the same. Which one is different?
+\begin{choices}
+\choice John
+\choice Paul
+
+\choice
+
+George
+
+\choice Ringo
+
+\choice Socrates
+
+\end{choices}
+
+\end{questions}
+
+%--------------------------------------------------------------------
+\subsubsection{The \texttt{oneparchoices} environment}
+\label{sec:oneparchoices}
+
+If instead of the \verb"choices" environment in the example of
+section~\ref{sec:choices} you use a \verb"oneparchoices" environment,
+then you'll get
+\begin{questions}
+\question
+One of these things is not like the others; one of these things is not
+the same. Which one is different?
+\begin{oneparchoices}
+\choice John
+\choice Paul
+
+\choice
+
+George
+
+\choice Ringo
+
+\choice Socrates
+
+\end{oneparchoices}
+
+\end{questions}
+
+If you insert a blank line before the \verb"\begin{oneparchoices}",
+ then you'll get
+\begin{questions}
+\question
+One of these things is not like the others; one of these things is not
+the same. Which one is different?
+
+\begin{oneparchoices}
+\choice John
+\choice Paul
+
+\choice
+
+George
+
+\choice Ringo
+
+\choice Socrates
+
+\end{oneparchoices}
+
+\end{questions}
+
+
+If you insert a blank line before the \verb"\begin{oneparchoices}" and
+\verb"\answerline" after the \verb"\end{oneparchoices}" (see
+section~\ref{sec:ShortAns} for a description of the \verb"\answerline"
+command), then you'll get
+\begin{questions}
+\question
+One of these things is not like the others; one of these things is not
+the same. Which one is different?
+
+\begin{oneparchoices}
+\choice John
+\choice Paul
+
+\choice
+
+George
+
+\choice Ringo
+
+\choice Socrates
+
+\end{oneparchoices}
+\answerline
+
+\end{questions}
+
+%--------------------------------------------------------------------
+\subsubsection{Solutions to multiple choice questions}
+\label{sec:CorrectChoice}
+
+The \verb"exam" document class defines several environments for
+solutions (see section~\ref{sec:solutions}), the contents of which
+will be printed only if you use the document class option
+\verb"answers" (as in \verb"\documentclass[answers]{exam}") or give
+the command \verb"\printanswers" (see section~\ref{sec:answers}). The
+\verb"choices" (see section~\ref{sec:choices}) and
+\verb"oneparchoices" (see section~\ref{sec:oneparchoices})
+environments allow you to designate one or more of the choices as
+correct choices, and to have the correct choices printed differently
+from the others when solutions are being printed.
+
+The command to define a correct choice is \verb"\CorrectChoice". When
+solutions are not being printed, \verb"\CorrectChoice" is equivalent
+to \verb"\choice". When solutions are being printed, though, any
+choices that were created with \verb"\CorrectChoice" (rather than with
+\verb"\choice") will be printed subject to the declarations in the
+argument of the
+\begin{center}
+ \verb"\CorrectChoiceEmphasis"
+\end{center}
+command. The default situation was created by the command
+\begin{center}
+ \verb"\CorrectChoiceEmphasis{\bfseries}"
+\end{center}
+and so when solutions are being printed the correct choices are
+printed in boldface by default.
+For example, if \verb"\printanswers" is in effect and you type
+\begin{verbatim}
+\begin{questions}
+ \question One of these things is not like the others; one of these
+ things is not the same. Which one is different?
+ \begin{oneparchoices}
+ \choice John
+ \choice Paul
+ \choice George
+ \choice Ringo
+ \CorrectChoice Socrates
+ \end{oneparchoices}
+\end{questions}
+\end{verbatim}
+then you'll get
+\printanswers
+\begin{questions}
+ \question One of these things is not like the others; one of these
+ things is not the same. Which one is different?
+ \begin{oneparchoices}
+ \choice John
+ \choice Paul
+ \choice George
+ \choice Ringo
+ \CorrectChoice Socrates
+ \end{oneparchoices}
+\end{questions}
+\noprintanswers
+If, e.g., you give the command
+\begin{center}
+ \verb"\usepackage{color}"
+\end{center}
+in the preamble of your document (i.e., after the
+\verb"\documentclass" command and before the \verb"\begin{document}"
+command) and then give the command
+\begin{center}
+ \verb"\CorrectChoiceEmphasis{\color{red}}"
+\end{center}
+then the correct choices will be printed in red (assuming that your
+printer can produce that color). For another example, if you give the
+command
+\begin{center}
+ \verb"\CorrectChoiceEmphasis{\color{red}\bfseries}"
+\end{center}
+then the correct choices will be printed in boldface red (again
+assuming that your printer can produce that color).
+
+To avoid confusion, \verb"\correctchoice" is defined to be a synonym
+for \verb"\CorrectChoice" and \verb"\correctchoiceemphasis" is defined
+to be a synonym for \verb"\CorrectChoiceEmphasis".
%---------------------------------------------------------------------
\subsection{Point values for the questions}
\label{sec:points}
-Each of the commands \verb"\question", \verb"\part", \verb"\subpart"
-and \verb"\subsubpart" take an optional argument, which is the number
-of points for that question, part, subpart, or subsubpart. (By
-default, the point values are enclosed in parentheses, but the
-parentheses can be replaced with either square brackets or a box; for
-this, see section~\ref{sec:Boxed}.)
+Each of the commands \verb"\question", \verb"\part", \verb"\subpart",
+and \verb"\subsubpart" takes an optional argument, which is the number
+of points for that question, part, subpart, or subsubpart. The
+default setup is that
+\begin{itemize}
+\item the point value is printed at the beginning of the question (or
+ part, or subpart, or subsubpart) (this can be changed to printing in
+ either the left or right margins on the first line of the question
+ or in the right margin at the end of the question; see
+ section~\ref{sec:whereprint} and section~\ref{sec:DrpPts}), and
+\item the point value is enclosed in parentheses (this can be changed
+ to either square brackets or a box; see section~\ref{sec:Boxed}).
+\end{itemize}
+Both of these things can be further customized; see
+section~\ref{sec:qformat} and section~\ref{sec:pointformat}.
+
+%--------------------------------------------------------------------
+\subsubsection{Where the points will be printed}
+\label{sec:whereprint}
The default is that the point value will be inserted at the beginning
of the question (or part, or subpart, or subsubpart) in parentheses,
@@ -602,7 +942,6 @@ etc.); for this, see section~\ref{sec:DrpPts}.
\medbreak
For example, if you type
-%
\begin{verbatim}
\begin{questions}
\question[20]
@@ -622,7 +961,6 @@ Describe the effect on the aircraft industry.
\end{questions}
\end{verbatim}
-%
then, with the default setup, you'll get
\nopointsinmargin
\begin{questions}
@@ -666,8 +1004,8 @@ Describe the effect on the aircraft industry.
\end{parts}
\end{questions}
-(To have a word (e.g., ``points'') inside the parentheses with the
-point values, see the \verb"\marginpointname" command in
+(To have a word (e.g., ``points'', or ``\%'') inside the parentheses
+with the point values, see the \verb"\marginpointname" command in
section~\ref{sec:pointname}.)
@@ -695,6 +1033,121 @@ Describe the effect on the aircraft industry.
\end{questions}
%--------------------------------------------------------------------
+\subsubsection{Printing the points at the end of the question}
+\label{sec:DrpPts}
+
+Instead of having the point value of a question (or part, or subpart,
+or subsubpart) printed on the first line of a question, you can have
+it printed in the right margin opposite the \emph{last} line, or even
+opposite a blank line following the paragraph. This is done with the
+\begin{center}
+ \verb"\pointsdroppedatright"
+ \quad and \quad
+ \verb"\droppoints"
+\end{center}
+commands.
+
+If you give the command
+\begin{center}
+ \verb"\pointsdroppedatright"
+\end{center}
+then point values are not printed until you give the command
+\verb"\droppoints" (and they're not printed at all if you don't give
+the command \verb"\droppoints"). The only exception to this rule is
+that if you've given a \verb"\qformat" command (see
+section~\ref{sec:qformat}), then question number lines are printed as
+specified by the argument to the \verb"\qformat" command even if you
+have given the command \verb"\pointsdroppedatright".
+
+The command \verb"\droppoints" should be given only at the end of a
+paragraph or between paragraphs; if you give it within a paragraph, it
+causes the paragraph to end. \verb"\droppoints" prints the point
+value in the right margin, formatted as it is when you give the
+command \verb"\pointsinrightmargin", except that the points appear
+opposite the last line of the paragraph (or, if the command
+\verb"\droppoints" is given between paragraphs, then additional
+vertical space is left between the paragraphs and the points are
+printed opposite the blank space). The formatting can be changed by
+giving the commands \verb"\bracketedpoints", \verb"\boxedpoints", or
+\verb"\marginpointname" (see section~\ref{sec:pointname}) just as if
+\verb"\pointsinrightmargin" were in effect. The command
+\verb"\droppoints" actually works this way even if one of the commands
+\begin{center}
+ \verb"\nopointsinmargin",\quad \verb"\pointsinmargin",\quad or\quad
+ \verb"\pointsinrightmargin"
+\end{center}
+is in effect, but if you use it that way the points will appear twice
+on the page, which is probably not what you want.
+
+
+For example, if you give the command \verb"\pointsdroppedatright" and
+then type
+\begin{verbatim}
+\begin{questions}
+\question[10]
+Describe the implications of the Michelson-Morley ink drop experiment
+for the use of punctuation marks such as colons and semicolons that
+require multiple drops of ink.
+\droppoints
+
+\question[10]
+Prove that the second dual of a finite dimensional real vector space
+is naturally isomorphic to the given vector space, except when the
+weapon chosen is a single shot pistol.\droppoints
+
+\end{questions}
+\end{verbatim}
+then you'll get
+\pointsdroppedatright
+\begin{questions}
+\question[10]
+Describe the implications of the Michelson-Morley ink drop experiment
+for the use of punctuation marks such as colons and semicolons that
+require multiple drops of ink.
+\droppoints
+
+\question[10]
+Prove that the second dual of a finite dimensional real vector space
+is naturally isomorphic to the given vector space, except when the
+weapon chosen is a single shot pistol.\droppoints
+
+\end{questions}
+and if you type
+\begin{verbatim}
+\begin{questions}
+\question[10]
+Describe the implications of the Michelson-Morley ink drop experiment
+for the use of punctuation marks such as colons and semicolons that
+require multiple drops of ink.
+
+\droppoints
+
+\question[10]
+Prove that the second dual of a finite dimensional real vector space
+is naturally isomorphic to the given vector space, except when the
+weapon chosen is a single shot pistol.
+
+\droppoints
+\end{questions}
+\end{verbatim}
+then you'll get
+\begin{questions}
+\question[10]
+Describe the implications of the Michelson-Morley ink drop experiment
+for the use of punctuation marks such as colons and semicolons that
+require multiple drops of ink.
+
+\droppoints
+
+\question[10]
+Prove that the second dual of a finite dimensional real vector space
+is naturally isomorphic to the given vector space, except when the
+weapon chosen is a single shot pistol.
+
+\droppoints
+\end{questions}
+\nopointsinmargin
+%--------------------------------------------------------------------
\subsubsection{Half points}
\label{sec:Half}
@@ -721,7 +1174,7 @@ To do this, you give the command
\begin{center}
\verb"\usehorizontalhalf"
\end{center}
-after which the printed appearance of half point values will be
+after which the printed appearance of point values will be
\usehorizontalhalf
\begin{center}
\begin{tabular}{@{\extracolsep{0.1in}}rccccccc}
@@ -743,14 +1196,13 @@ by giving the command
\subsubsection{Surrounding the points: Parentheses, brackets, or a box}
\label{sec:Boxed}
-If you prefer having the points enclosed in brackets, instead of in
+If you prefer having the points enclosed in brackets instead of in
parentheses, give the command
\begin{center}
\verb"\bracketedpoints"
\end{center}
For example, if you give the command \verb"\bracketedpoints", then the
questions typed above will produce
-%
\nopointsinmargin
\bracketedpoints
\begin{questions}
@@ -770,16 +1222,15 @@ Describe the effect on the aircraft industry.
\end{parts}
\end{questions}
-%
-If you prefer having the points enclosed in a box, instead of in
+
+If you prefer having the points enclosed in a box instead of in
parentheses, give the command
\begin{center}
\verb"\boxedpoints"
\end{center}
For example, if you give the command \verb"\boxedpoints", then the
questions typed above will produce
-%
\nopointsinmargin
\boxedpoints
\begin{questions}
@@ -799,7 +1250,6 @@ Describe the effect on the aircraft industry.
\end{parts}
\end{questions}
-%
If you give the commands \verb"\boxedpoints" and
\verb"\pointsinmargin", then the above questions will produce
\boxedpoints
@@ -821,7 +1271,6 @@ Describe the effect on the aircraft industry.
\end{parts}
\end{questions}
-%
If you give the commands \verb"\bracketedpoints" and
\verb"\pointsinrightmargin", then the above questions will produce
%
@@ -861,11 +1310,10 @@ whenever you want to switch. (The commands
they both return to the default of putting parentheses around the
points.)
-If you want a word automatically inserted following the point values
-when using either \verb"\pointsinmargin" or
-\verb"\pointsinrightmargin", see the
- \verb"\marginpointname" command
-in section~\ref{sec:pointname}.
+If you want some text (e.g., `` points'', or ``\%'') automatically
+inserted along with the point values when using either
+\verb"\pointsinmargin" or \verb"\pointsinrightmargin", see the command
+\verb"\marginpointname" in section~\ref{sec:pointname}.
@@ -874,27 +1322,28 @@ in section~\ref{sec:pointname}.
\label{sec:pointname}
With the default setup, the number of points is inserted before the
-text of the question followed by the word ``point'' if the number of
-points is 1 and by the word ``points'' otherwise. That is, the
-default is \verb"\nopointsinmargin" and \verb"\noboxedpoints" (see
-sections \ref{sec:points} and \ref{sec:Boxed}), and if you type
+text of the question followed by a single space and the word ``point''
+if the number of points is either \half{} or 1 and by the word
+``points'' otherwise. That is, the default is
+\verb"\nopointsinmargin" and \verb"\noboxedpoints" (see sections
+\ref{sec:whereprint} and \ref{sec:Boxed}), and if you type
\nopointsinmargin \noboxedpoints
\begin{verbatim}
\begin{questions}
-\question[1]
-This is a short question.
+ \question[1]
+ This is a short question.
-\question[5]
-This is a much longer question, requiring much more thought.
+ \question[5]
+ This is a longer question, requiring more thought.
\end{questions}
\end{verbatim}
then you'll get
\begin{questions}
-\question[1]
-This is a short question.
+ \question[1]
+ This is a short question.
-\question[5]
-This is a much longer question, requiring much more thought.
+ \question[5]
+ This is a longer question, requiring more thought.
\end{questions}
The way this is achieved is:
\begin{itemize}
@@ -903,8 +1352,9 @@ The way this is achieved is:
\verb"\points"
\end{center}
whose default definition expands to the word `point' if the number
- of points is 1 and to `points' otherwise. (This behavior can be
- modified by the command \verb"\pointpoints"; see below.)
+ of points is either \half{} or 1 and to `points' otherwise. (This
+ behavior can be modified by the command \verb"\pointpoints"; see
+ below.)
\item There is a command
\begin{center}
\verb"\pointname{Text}"
@@ -918,83 +1368,70 @@ The way this is achieved is:
(Note the single space before the command \verb"\points".)
\end{itemize}
-
-
-You can modify this setup by using the command \verb"\pointname", but
-there is also a command
+There is also a command
\begin{center}
\verb"\pointpoints{SingularText}{PluralText}"
\end{center}
that changes the behavior of the \verb"\points" command so that it
-expands to `SingularText' if the number of points is 1 and to
-`PluralText' otherwise. (The default is the result of the command
-\verb"\pointpoints{point}{points}".) Thus, if you give the
-command
-%
+expands to `SingularText' if the number of points is \half{} or 1 and
+to `PluralText' otherwise. (The default is the result of the command
+\verb"\pointpoints{point}{points}".) Thus, if you give the command
\begin{center}
\verb"\pointpoints{Punkt}{Punkte}"
\end{center}
-%
then typing the questions above would result in
-%
\pointpoints{Punkt}{Punkte}
\begin{questions}
-\question[1]
-This is a short question.
+ \question[1]
+ This is a short question.
-\question[5]
-This is a much longer question, requiring much more thought.
+ \question[5]
+ This is a longer question, requiring more thought.
\end{questions}
-%
-and if you give the command
-%
+There is also a command
\begin{center}
- \verb"\pointpoints{mark}{marks}"
+ \verb"\marksnotpoints"
\end{center}
-%
-then typing the questions above would result in
-%
-\pointpoints{mark}{marks}
-\begin{questions}
-\question[1]
-This is a short question.
-
-\question[5]
-%
-This is a much longer question, requiring much more thought.
-\end{questions}
-There is a shortcut for that; the command
+that is equivalent to the two commands
\begin{center}
- \verb"\marksnotpoints"
+ \begin{tabular}{l}
+ \verb"\pointpoints{mark}{marks}"\\
+ \verb"\bonuspointpoints{mark (bonus)}{marks (bonus)}"
+ \end{tabular}
\end{center}
-expands to \verb"\pointpoints{mark}{marks}".
+(the command \verb"\bonuspointpoints" is described in
+section~\ref{sec:Bonus}). That command would cause the above
+questions to be printed as \pointpoints{mark}{marks}
+\begin{questions}
+ \question[1]
+ This is a short question.
+ \question[5]
+ This is a longer question, requiring more thought.
+\end{questions}
\bigskip
-For example, if you give the command
-%
+For another example, if you give the command
\begin{center}
\verb"\pointname{\%}"
\end{center}
+then the above questions would be printed as
%
-and then type
-%
-\begin{verbatim}
-\question[25]
-Where, oh where, has my little dog gone?
-\end{verbatim}
-%
-then you'll get
\pointname{\%}
\nopointsinmargin
\noboxedpoints
\begin{questions}
-\question[25]
-Where, oh where, has my little dog gone?
+ \question[1]
+ This is a short question.
+
+ \question[5]
+ This is a longer question, requiring more thought.
\end{questions}
\pointname{ \points}
-%
+
+
+\subsubsection*{Using \texttt{\char`\\marginpointname}}
Similarly, the command \verb"\marginpointname" can be used to affect
the text set with the number of points when \verb"\pointsinmargin" or
@@ -1019,8 +1456,8 @@ then you'll get
\question[25]
Where, oh where, has my little dog gone?
\end{questions}
-unless, of course, you've also given the command \verb"\boxedpoints"
-(see section~\ref{sec:Boxed}), in which case you'll get
+unless, e.g., you've also given the command \verb"\boxedpoints" (see
+section~\ref{sec:Boxed}), in which case you'll get
%
\pointsinmargin
\boxedpoints
@@ -1047,10 +1484,7 @@ Where, oh where, has my little dog gone?
\nopointsinmargin
\marginpointname{}
\pointpoints{point}{points}
-
-
-
-
+\bonuspointpoints{point (bonus)}{points (bonus)}
Using the default is equivalent to giving the command
\begin{center}
@@ -1058,16 +1492,17 @@ Using the default is equivalent to giving the command
\end{center}
%--------------------------------------------------------------------
-\subsubsection{Using \texttt{marginpointname} and enlarging the
- margins}
+\subsubsection{Using \texttt{\char`\\marginpointname} and enlarging
+ the margins}
+\label{sec:margins}
The default margins are not very large, and so if you use
\verb"\marginpointname" (see section~\ref{sec:pointname}) to place any
words along with the point values in the margin, you may run out of
room. The solution to this problem is to enlarge the margins by using
the \verb"\extrawidth" command with a negative argument to
-\emph{decrease} the width of the text, and thus \emph{increase} the
-width of the margins. For example, the commands
+\emph{decrease} the width of the text area, and thus \emph{increase}
+the width of the margins. For example, the commands
\begin{center}
\begin{tabular}{ll}
\verb"\extrawidth{-1in}"\\
@@ -1078,206 +1513,258 @@ will increase each of the left and right margins by one half inch,
which will easily leave room for the word ``points''. (See
section~\ref{sec:pagesize} for a discussion of the \verb"\extrawidth"
command.)
-%---------------------------------------------------------------------
-\subsubsection{Questions that begin with a parts environment}
-
-One thing to keep in mind is that \emph{only one point value can
- appear on a line, and it will be the last one to be placed there}.
-This matters only if a question begins with a parts environment, or if
-a part begins with a subparts environment, or if a subpart begins with
-a subsubparts environment. In any of these cases, the question number
-and part number (or the part number and subpart number, etc.) will
-appear on the same line, and if both of these commands include an
-optional point value, \emph{only the last one given will be used}.
-For example, if you type
-%
-\begin{verbatim}
-\begin{questions}
-\question[10]
-\begin{parts}
-\part[5]
-Who put the ``bop'' in the ``bop, sh-bop sh-bop''?
-
-\part[5]
-Who put the ``ram'' in the ``rama, rama ding-dong''?
-\end{parts}
-\end{questions}
-\end{verbatim}
-%
-then you'll get
-%
-\noboxedpoints
-\marginpointname{}
-\begin{questions}
-\question[10]
-\begin{parts}
-\part[5]
-Who put the ``bop'' in the ``bop, sh-bop sh-bop''?
-
-\part[5]
-Who put the ``ram'' in the ``rama, rama ding-dong''?
-\end{parts}
-\end{questions}
-%
-Notice that the 10~points for the entire question are never mentioned
-anywhere, since they would have appeared on the same line with the
-5~points for the first part, and the 5~points for the part were placed
-later. This is true whether \verb"\pointsinmargin",
-\verb"\pointsinrightmargin", or \verb"\nopointsinmargin" is in effect.
-In addition, if you've given the command \verb"\addpoints" (see
-section~\ref{sec:Count}), then this question will have 20~points
-assigned to it (10 for the question itself plus 5 for each of the two
-parts) even though the 10 for the question itself will not be printed.
-
%--------------------------------------------------------------------
-\subsubsection{Printing the points at the end of the question}
-\label{sec:DrpPts}
-
-Instead of having the point value of a question (or part, or subpart,
-or subsubpart) printed on the first line of a question, you can have
-it printed in the right margin opposite the \emph{last} line, or even
-opposite a blank line following the paragraph. This is done with the
+\subsubsection{Completely customizing the points}
+\label{sec:pointformat}
+
+If the customizations described in section~\ref{sec:Boxed} and
+section~\ref{sec:pointname} (using \verb"\bracketedpoints",
+\verb"\boxedpoints", \verb"\pointpoints", \verb"\pointname", and
+\verb"\marginpointname") aren't sufficient, and you don't want to use
+the \verb"\qformat" command to create a customized question number
+line (see section~\ref{sec:qformat}), you can completely customize the
+way the points are printed by using the commands
\begin{center}
- \verb"\pointsdroppedatright"
- \quad and \quad
- \verb"\droppoints"
+ \begin{tabular}{l}
+ \verb"\pointformat"\\
+ \verb"\bonuspointformat"
+\end{tabular}
\end{center}
-commands.
-
-If you give the command
+The \verb"\pointformat" command controls the printing of ``regular''
+points (i.e., non-bonus points) and the \verb"\bonuspointformat"
+command controls the printing of bonus points (see
+section~\ref{sec:Bonus}).
+
+Each of the commands \verb"\pointformat" and \verb"\bonuspointformat"
+takes one argument, and that argument is what actually appears on the
+page whether the points are being printed at the beginning of the
+question (the default), in the left margin (because of
+\verb"\pointsinmargin"), in the right margin (because of
+\verb"\pointsinrightmargin"), or dropped in the right margin at the
+end of the question (because of \verb"\pointsdroppedatright"). The
+arguments to \verb"\pointformat" and \verb"\bonuspointformat" should
+contain either the command
\begin{center}
- \verb"\pointsdroppedatright"
+ \verb"\thepoints"
\end{center}
-then point values are not printed until you give the command
-\verb"\droppoints" (and they're not printed at all if you don't give
-the command \verb"\droppoints"). The only exception to this rule is
-that if you've given a \verb"\qformat" command (see
-section~\ref{sec:qformat}), then question number lines are printed as
-specified by the argument to the \verb"\qformat" command even if you
-have given the command \verb"\pointsdroppedatright".
-
-The command \verb"\droppoints" should be given only at the end of a
-paragraph or between paragraphs; if you give it within a paragraph, it
-causes the paragraph to end. \verb"\droppoints" prints the point
-value in the right margin, formatted as it is when you give the
-command \verb"\pointsinrightmargin", except that the points appear
-opposite the last line of the paragraph (or, if the command
-\verb"\droppoints" is given between paragraphs, then additional
-vertical space is left between the paragraphs and the points are
-printed opposite the blank space). Thus, the formatting can be
-changed by giving the commands \verb"\bracketedpoints",
-\verb"\boxedpoints", or \verb"\marginpointname" (see
-section~\ref{sec:pointname}). The command \verb"\droppoints" actually
-works this way even if one of the commands
+(which for non-bonus points prints the number of points followed by
+the argument to the last \verb"\pointname" command and for bonus
+points prints the number of bonus points followed by the argument to
+the last \verb"\bonuspointname" command; see
+section~\ref{sec:pointname}) or the command
\begin{center}
- \verb"\nopointsinmargin", \verb"\pointsinmargin", or
- \verb"\pointsinrightmargin"
+ \verb"\themarginpoints"
\end{center}
-is in effect, but if you use it that way the points will appear twice
-on the page, which is probably not what you want.
+(which for non-bonus points prints the number of points followed by
+the argument to the last \verb"\marginpointname" command and for bonus
+points prints the number of bonus points followed by the argument to
+the last \verb"\marginbonuspointname" command; see
+section~\ref{sec:pointname}). If the argument doesn't contain either
+\verb"\thepoints" or \verb"\themarginpoints", then the number of
+points will not appear.
+
+For example, the command \verb"\bracketedpoints" is equivalent to
+either
+\begin{center}
+ \begin{tabular}{l}
+ \verb"\pointformat{[\thepoints]}"\\
+ \verb"\bonuspointformat{[\thepoints]}"
+ \end{tabular}
+\end{center}
+if the points are being printed at the beginning of the question, or
+\begin{center}
+ \begin{tabular}{l}
+ \verb"\pointformat{[\themarginpoints]}"\\
+ \verb"\bonuspointformat{[\themarginpoints]}"
+ \end{tabular}
+\end{center}
+if the points are being printed in one of the margins.
+For another example, the command \verb"\boxedpoints" is equivalent to
+either
+\begin{center}
+ \begin{tabular}{l}
+ \verb"\pointformat{\fbox{\thepoints}}"\\
+ \verb"\bonuspointformat{\fbox{\thepoints}}"
+ \end{tabular}
+\end{center}
+if the points are being printed at the beginning of the question, or
+\begin{center}
+ \begin{tabular}{l}
+ \verb"\pointformat{\fbox{\themarginpoints}}"\\
+ \verb"\bonuspointformat{\fbox{\themarginpoints}}"
+ \end{tabular}
+\end{center}
+if the points are being printed in one of the margins.
-For example, if you give the command \verb"\pointsdroppedatright" and
-then type
+For another example, the commands
\begin{verbatim}
\begin{questions}
-\question[10]
-Describe the implications of the Michelson-Morley ink drop experiment
-for the use of punctuation marks such as colons and semicolons that
-require multiple drops of ink.
-\droppoints
-
-\question[10]
-Prove that the second dual of a finite dimensional real vector space
-is naturally isomorphic to the given vector space, except when the
-weapon chosen is a single shot pistol.\droppoints
-
+ \pointsinmargin
+ \marginpointname{\%}
+ \pointformat{\slshape (\themarginpoints)}
+ \question[3] What is the point?
\end{questions}
\end{verbatim}
-then you'll get
-\pointsdroppedatright
+will produce
\begin{questions}
-\question[10]
-Describe the implications of the Michelson-Morley ink drop experiment
-for the use of punctuation marks such as colons and semicolons that
-require multiple drops of ink.
-\droppoints
-
-\question[10]
-Prove that the second dual of a finite dimensional real vector space
-is naturally isomorphic to the given vector space, except when the
-weapon chosen is a single shot pistol.\droppoints
+ \pointsinmargin
+ \marginpointname{\%}
+ \pointformat{\slshape (\themarginpoints)}
+ \question[3] What is the point?
+\end{questions}
+For another example, the commands
+\begin{verbatim}
+\begin{questions}
+ \pointsinrightmargin
+ \marginpointname{\%}
+ \pointformat{\fbox{\bfseries\boldmath\themarginpoints}}
+ \question[3\half] What is the point?
\end{questions}
+\end{verbatim}
+will produce
+\begin{questions}
+ \pointsinrightmargin
+ \marginpointname{\%}
+ \pointformat{\fbox{\bfseries\boldmath\themarginpoints}}
+ \question[3\half] What is the point?
+\end{questions}
+\nopointsinmargin (Note: The commands \verb"\bfseries" and
+\verb"\boldmath" are both needed here because the \half{} printed when
+you use half points is printed in math mode while the rest of the
+points are printed in text mode.)
-If you type
+For another example, the commands
\begin{verbatim}
\begin{questions}
-\question[10]
-Describe the implications of the Michelson-Morley ink drop experiment
-for the use of punctuation marks such as colons and semicolons that
-require multiple drops of ink.
+ \pointname{}
+ \pointformat{\bfseries\boldmath(Points for this problem: \thepoints)}
+ \question[3\half] What is the point?
+\end{questions}
+\end{verbatim}
+will produce
+\begin{questions}
+ \pointname{}
+ \pointformat{\bfseries\boldmath(Points for this problem: \thepoints)}
+ \question[3\half] What is the point?
+\end{questions}
+% Put things back to the default situation, so we don't mess up
+% later examples:
+\noboxedpoints
+\nopointsinmargin
+\pointname{ \points}
-\droppoints
-\question[10]
-Prove that the second dual of a finite dimensional real vector space
-is naturally isomorphic to the given vector space, except when the
-weapon chosen is a single shot pistol.
-\droppoints
+
+%---------------------------------------------------------------------
+\subsubsection{Questions that begin with a parts environment}
+
+If a question begins with a parts environment, then the question
+number and the number of the first part in the parts environment will
+be printed on the same line (see section~\ref{sec:parts}). Thus, if
+points are assigned to both the question and to the first part, both
+of those point values will be printed on the same line. (Note: This
+was not true in versions of the \verb"exam" document class earlier
+than 2.3. In those versions, only the later of the two point values
+would actually be printed.) If \verb"\pointsinmargin" or
+\verb"\pointsinrightmargin" are in effect (see
+section~\ref{sec:whereprint}), then the two point values will be
+printed on top of each other, which is probably not what you want.
+The same problem arises if a part begins with a subparts environment
+or if a subpart begins with a subsubparts environment.
+
+If you want to assign points to both a question and to each part of a
+parts environment, and if the first part will begin on the same line
+as the question, the solution is to either use the default location
+(i.e., \verb"\nopointsinmargin") or to put some of the points in the
+margin and others not. For example, if you type
+\begin{verbatim}
+\begin{questions}
+ \pointsinmargin
+ \noaddpoints
+ \question[10]
+ \begin{parts}
+ \nopointsinmargin
+ \addpoints
+ \part[5] Who put the ``bop'' in the ``bop, sh-bop, sh-bop''?
+ \part[5] Who put the ``ram'' in the ``rama, rama ding-dong''?
+ \end{parts}
\end{questions}
\end{verbatim}
then you'll get
\begin{questions}
-\question[10]
-Describe the implications of the Michelson-Morley ink drop experiment
-for the use of punctuation marks such as colons and semicolons that
-require multiple drops of ink.
+ \pointsinmargin
+ \noaddpoints
+ \question[10]
+ \begin{parts}
+ \nopointsinmargin
+ \addpoints
+ \part[5] Who put the ``bop'' in the ``bop, sh-bop, sh-bop''?
+ \part[5] Who put the ``ram'' in the ``rama, rama ding-dong''?
+ \end{parts}
+\end{questions}
-\droppoints
-\question[10]
-Prove that the second dual of a finite dimensional real vector space
-is naturally isomorphic to the given vector space, except when the
-weapon chosen is a single shot pistol.
-\droppoints
-\end{questions}
-\nopointsinmargin
%--------------------------------------------------------------------
-\subsubsection{Adding up the points for each question}
-
+\subsubsection{Adding up the points for a question}
+\label{sec:addup}
-If you give the command \verb"\addpoints" (see
-section~\ref{sec:Count}), then you can use the command
+If you use the document class option \verb"addpoints" (as in
+\verb"\documentclass[addpoints]{exam}") or give the command
+\verb"\addpoints" (see section~\ref{sec:addpoints}), then you can use
+the command
\begin{center}
\verb"\droptotalpoints"
\end{center}
to put into the right margin the total number of points for the
current question (including the points for all parts, subparts, and
-subsubparts). The command \verb"\droptotalpoints" should be given
-only at the end of a paragraph or between paragraphs; if you give it
-within a paragraph, it causes the paragraph to end.
-\verb"\droptotalpoints" prints the total points for the current
-question in the right margin, formatted by default as:
+subsubparts). (Section~\ref{sec:adding} describes a different way to
+print the total number of points for a question.) The command
+\verb"\droptotalpoints" should be given only at the end of a paragraph
+or between paragraphs; if you give it within a paragraph, it causes
+the paragraph to end. \verb"\droptotalpoints" prints the total points
+for the current question in the right margin, formatted by default as:
\par\nobreak\medskip
-% \leavevmode\unskip\nobreak\hfill
\makeatletter
- \leavevmode\nobreak\hfill
- \rlap{%\hskip\rightmargin % Defined by the list environment
- \hskip\@rightmargin % Defined by exam.cls
- \hskip-\rightpointsmargin
- \llap{Total for Question 2: 25}%
- }% rlap
+\leavevmode\nobreak\hfill
+\rlap{%\hskip\rightmargin % Defined by the list environment
+ \hskip\@rightmargin % Defined by exam.cls
+ \hskip-\rightpointsmargin
+ \llap{Total for Question 2: 25}%
+}% rlap
\makeatother
- \par
-\medskip
-\noindent
-(Note: The number of points is followed by the value of
-\verb"\marginpointname", which by default is empty.)
+\par\medskip\noindent
+(Note: The number of points is followed by the argument to the most
+recently executed \verb"\marginpointname" command (see
+section~\ref{sec:pointname}), which by default is empty.)
+
+If the current question is worth any bonus points (see
+section~\ref{sec:Bonus}), then those bonus points will not be counted
+by the \verb"\droptotalpoints" command, but they will be counted by
+the
+\begin{center}
+ \verb"\droptotalbonuspoints"
+\end{center}
+command, which puts into the right margin the total number of bonus
+points for the current question, formatted by default as:
+\par\nobreak\medskip
+\makeatletter
+\leavevmode\nobreak\hfill
+\rlap{%\hskip\rightmargin % Defined by the list environment
+ \hskip\@rightmargin % Defined by exam.cls
+ \hskip-\rightpointsmargin
+ \llap{Total for Question 2: 10 (bonus)}%
+}% rlap
+\makeatother
+\par\medskip\noindent
+(Note: The number of bonus points is followed by the argument to the
+most recently executed \verb"\marginbonuspointname" command (see
+section~\ref{sec:Bonus}), which by default is `` (bonus)''.)
You can change the format used by the \verb"\droptotalpoints" command
with the
@@ -1300,20 +1787,34 @@ section~\ref{sec:pointsofq} for a discussion of the
\verb"\pointsofquestion" command.) For example, if you give the
command
\begin{center}
- \verb"\totalformat{Question \thequestion: \totalpoints \points}"
-\end{center}
-then the total points will be printed in the format
-\begin{center}
- Question 2: 25 points
+ \verb"\totalformat{Question \thequestion: \totalpoints}"
\end{center}
+then the total number of points will be printed in the format
+\par\nobreak\medskip
+\makeatletter
+\leavevmode\nobreak\hfill
+\rlap{%\hskip\rightmargin % Defined by the list environment
+ \hskip\@rightmargin % Defined by exam.cls
+ \hskip-\rightpointsmargin
+ \llap{Question 2: 25}%
+}% rlap
+\makeatother
+\par\medskip\noindent
and if you give the command
\begin{center}
\verb"\totalformat{\fbox{Total: \totalpoints}}"
\end{center}
-then the total points will be printed as
-\begin{center}
- \fbox{Total: 25}
-\end{center}
+then the total number of points will be printed as
+\par\nobreak\medskip
+\makeatletter
+\leavevmode\nobreak\hfill
+\rlap{%\hskip\rightmargin % Defined by the list environment
+ \hskip\@rightmargin % Defined by exam.cls
+ \hskip-\rightpointsmargin
+ \llap{\fbox{Total: 25}}%
+}% rlap
+\makeatother
+\par\medskip\noindent
Thus, if you've given the commands
\begin{center}
@@ -1331,7 +1832,7 @@ and you type
In no more than one paragraph, explain why the earth is round.
\droppoints
\part[10]
-Explain what changes to the van Allen radiation belt are needed to
+What changes to the van Allen radiation belt are needed to
make the earth into a regular icosahedron?
\droppoints
\end{parts}
@@ -1348,7 +1849,7 @@ then you'll get
In no more than one paragraph, explain why the earth is round.
\droppoints
\part[10]
-Explain what changes to the van Allen radiation belt are needed to
+What changes to the van Allen radiation belt are needed to
make the earth into a regular icosahedron?
\droppoints
\end{parts}
@@ -1381,7 +1882,7 @@ then you'll get
In no more than one paragraph, explain why the earth is round.
\droppoints
\part[10]
-Explain what changes to the van Allen radiation belt are needed to
+What changes to the van Allen radiation belt are needed to
make the earth into a regular icosahedron?
\droppoints
\end{parts}
@@ -1400,22 +1901,27 @@ make the earth into a regular icosahedron?
\nopointsinmargin
\nobracketedpoints
-
-
-If you want to switch back and forth between these formats during the
-exam, you can do so by giving one of the commands
+To change the format used by the \verb"\droptotalbonuspoints" command,
+you use the command
\begin{center}
- \begin{tabular}{l}
- \verb"\pointsinmargin"\\
- \verb"\pointsinrightmargin"\\
- \verb"\nopointsinmargin"
+ \verb"\bonustotalformat"
+\end{center}
+which is analogous to the \verb"\totalformat" command. The argument
+to \verb"\bonustotalformat" can contain the command
+\begin{center}
+ \begin{tabular}{ll}
+ \verb"\totalbonuspoints"& to print the number of bonus points, and\\
+ \verb"\thequestion"& to print the question number.
\end{tabular}
\end{center}
-whenever you want to switch.
+(\verb"\totalbonuspoints" expands to
+\verb"\bonuspointsofquestion{\arabic{question}}"; see
+section~\ref{sec:BonusTables} for a discussion of the
+\verb"\bonuspointsofquestion" command.)
%--------------------------------------------------------------------
-\subsubsection{Margin sizes when using \texttt{pointsinmargin} and
- \texttt{pointsinrightmargin}}
+\subsubsection{Margin sizes when using \texttt{\char`\\pointsinmargin}
+ and \texttt{\char`\\pointsinrightmargin}}
\begin{itemize}
@@ -1440,10 +1946,14 @@ whenever you want to switch.
and you can change it by giving a new \verb"\setlength" command.
\end{itemize}
+You can change the width of the text area (and, thus, change the width
+of the margins) with the \verb"\extrawidth" command (see
+section~\ref{sec:margins}).
%--------------------------------------------------------------------
-\subsubsection{Custom question number lines}
+\subsection{Custom question number lines: The \texttt{\char`\\qformat}
+command}
\label{sec:qformat}
The default setup is for the question number to appear in the left
@@ -1462,17 +1972,29 @@ where `Format specification' must contain some stretchability (e.g.,
at least one \verb"\hfill" or \verb"\dotfill" or \verb"\hrulefill" or
\ldots) and can contain the commands
\begin{itemize}
-\item \verb"\thequestion", which expands to the question number, and
-\item \verb"\thepoints", which expands to the number of points
- followed by the value of the last \verb"\pointname" command (if
- points are specified for the question) or to nothing (if no points
- were specified). (For a discussion of the \verb"\pointname"
- command, see section~\ref{sec:pointname})
+\item \verb"\thequestion", which expands to the question number,
+\item \verb"\thepoints", which expands to
+ \begin{itemize}
+ \item nothing, if no points were specified for the question,
+ \item the number of points followed by the argument to the last
+ \verb"\pointname" command, if this is a ``regular'' question
+ (i.e., not a bonus question; see section~\ref{sec:Bonus}), and
+ \item the number of bonus points followed by the argument to the
+ last \verb"\bonuspointname" command, if this is a bonus question
+ (see section~\ref{sec:Bonus})
+ \end{itemize}
+ (see section~\ref{sec:pointname} for a discussion of the
+ \verb"\pointname" and \verb"\bonuspointname" commands), and
+\item \verb"\totalpoints", which expands to the total number of points
+ specified for the question and all of its parts, subparts, and
+ subsubparts (see section~\ref{sec:addup}). The command
+ \verb"\totalpoints" expands to
+ \verb"\pointsofquestion{\arabic{question}}".
\end{itemize}
For example, if you give the commands
+%
\pointname{ \points}
\pointpoints{point}{points}
-%
\begin{verbatim}
\qformat{Question \thequestion \dotfill \thepoints}
\begin{questions}
@@ -1480,7 +2002,6 @@ For example, if you give the commands
What did Billy Joe MacAllister throw off the Tallahatchie Bridge?
\end{questions}
\end{verbatim}
-%
then you'll get
\qformat{Question \thequestion \dotfill \thepoints}
\begin{questions}
@@ -1514,47 +2035,244 @@ What did Billy Joe MacAllister throw off the Tallahatchie Bridge?
\noqformat
%--------------------------------------------------------------------
-\subsubsection{Adding up the points for each question}
+\subsubsection{Adding up the points for a question}
\label{sec:adding}
-You can also combine \verb"\qformat" with the \verb"\pointsofquestion"
-command (see section~\ref{sec:pointsofq}): If you assign points only
-to parts, subparts, and subsubparts of questions, but none to the
-questions themselves, and you give the commands
+You can combine \verb"\qformat" with the \verb"\totalpoints" command
+(see section~\ref{sec:addup}): If you assign points only to parts,
+subparts, and subsubparts of questions, but none to the questions
+themselves, and you give the command
\begin{verbatim}
-\addpoints
-\qformat{Question \thequestion\dotfill
- \emph{(\pointsofquestion{\arabic{question}} \points)}}
+\qformat{Question \thequestion\dotfill \emph{\totalpoints\ points}}
\end{verbatim}
-then you can type
-%
+(you must have used the document class option \verb"addpoints" or
+given the command \verb"\addpoints" in order to use the
+\verb"\totalpoints" command; see section~\ref{sec:addpoints}), then
+you can type
\begin{verbatim}
-\question
-\begin{parts}
-\part[10]
-In no more than one paragraph, explain why the earth is round.
-\part[10]
-What changes to the van Allen radiation belt are needed to make the
-earth into a regular icosahedron?
-\end{parts}
+\begin{questions}
+ \question
+ \begin{parts}
+ \part[10]
+ In no more than one paragraph, explain why the earth is round.
+ \part[10]
+ What changes to the van Allen radiation belt are needed to make
+ the earth into a regular icosahedron?
+ \end{parts}
+\end{questions}
\end{verbatim}
and you'll get
%
\nopointsinmargin
-\qformat{Question \thequestion\dotfill
- \emph{(20 \points)}}
+\qformat{Question \thequestion\dotfill \emph{20 points}}
\begin{questions}
-\question
-\begin{parts}
-\part[10]
-In no more than one paragraph, explain why the earth is round.
-\part[10]
-What changes to the van Allen radiation belt are needed to make the
-earth into a regular icosahedron?
-\end{parts}
+ \question
+ \begin{parts}
+ \part[10]
+ In no more than one paragraph, explain why the earth is round.
+ \part[10]
+ What changes to the van Allen radiation belt are needed to make
+ the earth into a regular icosahedron?
+ \end{parts}
\end{questions}
\noqformat
+For another method of printing the total points for a question, see
+the \verb"\droptotalpoints" command in section~\ref{sec:addup}.
+
+
+%--------------------------------------------------------------------
+\subsection{Titled questions}
+\label{sec:Titled}
+
+When using a grading table or point table indexed by question number
+(see sections \ref{sec:GradeTables} and~\ref{sec:PointTables}) it's
+possible to replace the question numbers in the table with titles for
+the questions. This is done using the \verb"\titledquestion" command
+(see section~\ref{sec:TitledQues}), and you can then print the title
+in places other than the table using the \verb"\thequestiontitle"
+command (see section~\ref{sec:questiontitle}).
+
+%--------------------------------------------------------------------
+\subsubsection{\texttt{\char`\\titledquestion}}
+\label{sec:TitledQues}
+
+The command \verb"\titledquestion" is a replacement for
+\verb"\question"; it has one required argument (the title) and one
+optional argument (the point value), as in
+\begin{center}
+ \verb"\titledquestion{Question \thequestion: Concepts}"
+\end{center}
+which sets the question title to ``Question 2: Concepts'' (if this is
+the second question) and doesn't set any point values, or
+\begin{center}
+ \verb"\titledquestion{Design}[10]"
+\end{center}
+which sets the question title to ``Design'' and sets the point value
+to ``10''. Note that the question title doesn't include the number of
+the question unless you put it there using the \verb"\thequestion"
+command.
+
+Using \verb"\titledquestion" instead of \verb"\question" doesn't
+change the appearance of the question (unless you use
+\verb"\thequestiontitle" in the argument of a \verb"\qformat" command;
+see section~\ref{sec:questiontitle}). The only direct effect of using
+\verb"\titledquestion" instead of \verb"\question" is that if you
+print a grading table indexed by question number (see
+section~\ref{sec:GradeTables}), then the title of the question will
+replace the number of the question in the table. To have the title of
+the question appear in the question itself, see the example in
+section~\ref{sec:questiontitle}.
+
+If you create a grading table or point table indexed by question
+number and you create a question using the \verb"\titledquestion"
+command, then the number of the question won't appear in the table
+unless you include \verb"\thequestion" in the title of the question.
+
+%--------------------------------------------------------------------
+\subsubsection{\texttt{\char`\\thequestiontitle}}
+\label{sec:questiontitle}
+
+The command \verb"\thequestiontitle" expands to
+\begin{itemize}
+\item the title of the question (if the question was defined using a
+ \verb"\titledquestion" command) or
+\item the number of the question (if the question was defined using a
+ \verb"\question" command).
+\end{itemize}
+This is for use in the argument of a \verb"\qformat" command (see
+section~\ref{sec:qformat}), so that you can have the question title
+appear in the question itself, and not just in a grading table or
+point table.
+
+The contents of \verb"\thequestiontitle" don't appear anywhere in the
+question itself unless you do something to make them appear. For
+example, if you give the command
+\begin{center}
+\verb"\qformat{Question \thequestion: \thequestiontitle\dotfill\thepoints}"
+\end{center}
+and then type
+\begin{verbatim}
+\begin{questions}
+ \titledquestion{History of Empirical Aerodynamics}[10]
+ What did Billy Joe MacAllister throw off the Tallahatchie Bridge?
+\end{questions}
+\end{verbatim}
+then you'll get
+\begin{questions}
+ \qformat{Question \thequestion: \thequestiontitle\dotfill\thepoints}
+ \titledquestion{History of Empirical Aerodynamics}[10]
+ What did Billy Joe MacAllister throw off the Tallahatchie Bridge?
+\end{questions}
+\noqformat
+
+If the command \verb"\thequestiontitle" is never used, then the only
+effect of using the command \verb"\titledquestion" instead of the
+command \verb"\question" is that, in a grading table or point table
+indexed by question number, this question will be indexed by the title
+of the question rather than by the question number, and the title of
+the question will never appear except in the table.
+
+%--------------------------------------------------------------------
+\subsection{Bonus points}
+\label{sec:Bonus}
+
+It's possible to create questions, parts, subparts, or subsubparts
+that are worth \emph{bonus points}, instead of regular points. To do
+this, you use the command
+\begin{center}
+ \begin{tabular}{l@{\qquad instead of\qquad}l}
+ \verb"\bonusquestion"& \verb"\question",\\
+ \verb"\bonustitledquestion"& \verb"\titledquestion",\\
+ \verb"\bonuspart"& \verb"\part",\\
+ \verb"\bonussubpart"& \verb"\subpart", and\\
+ \verb"\bonussubsubpart"& \verb"\subsubpart".
+ \end{tabular}
+\end{center}
+If you don't assign any points to these commands then using them is
+equivalent to using the corresponding non-bonus commands. If you do
+assign points, though, then
+\begin{itemize}
+\item the points are typeset differently (see below),
+\item the points are not counted by the \verb"\gradetable" or
+ \verb"\pointtable" commands (see sections \ref{sec:GradeTables}
+ and~\ref{sec:PointTables}), though they \emph{are} counted by the
+ \verb"\bonusgradetable" and \verb"\bonuspointtable" commands (see
+ section~\ref{sec:BonusTables}),
+\item the points are not counted by the \verb"\droptotalpoints"
+ command (see section~\ref{sec:addup}), though they are counted by
+ the \verb"\droptotalbonuspoints" command (see below),
+\item the points are not counted by the \verb"\pointsofquestion" (see
+ section~\ref{sec:pointsofq}) or \verb"\pointsonpage" (see
+ section~\ref{sec:pointsonp}) commands, though they \emph{are}
+ counted by the \verb"\bonuspointsofquestion" and
+ \verb"\bonuspointsonpage" (see section~\ref{sec:BonusTables})
+ commands, and
+\item the points are not counted by the \verb"\numpoints" command (see
+ section~\ref{sec:Count}), though they \emph{are} counted by the
+ \verb"\numbonuspoints" command (see section~\ref{sec:Count}).
+\end{itemize}
+
+The default setup is that if you type
+\begin{verbatim}
+\begin{questions}
+ \question[10] Who discovered America?
+ \bonusquestion[1] On what day of the week did he do it?
+ \bonusquestion[2] What color shirt was he wearing?
+\end{questions}
+\end{verbatim}
+then you'll get
+\begin{questions}
+ \question[10] Who discovered America?
+ \bonusquestion[1] On what day of the week did he do it?
+ \bonusquestion[2] What color shirt was he wearing?
+\end{questions}
+
+There is also a command \verb"\bonuspointpoints" that is analogous to
+\verb"\pointpoints" (see section~\ref{sec:pointname}); the default
+setup was created by the command
+\begin{center}
+ \verb"\bonuspointpoints{point (bonus)}{points (bonus)}"
+\end{center}
+and if you give the command
+\begin{center}
+ \verb"\bonuspointpoints{bonus point}{bonus points}"
+\end{center}
+then typing the above would produce
+\begin{questions}
+ \bonuspointpoints{bonus point}{bonus points}
+ \question[10] Who discovered America?
+ \bonusquestion[1] On what day of the week did he do it?
+ \bonusquestion[2] What color shirt was he wearing?
+\end{questions}
+There are also commands
+\begin{center}
+ \begin{tabular}{l}
+ \verb"\bonuspointname" and\\
+ \verb"\marginbonuspointname"
+ \end{tabular}
+ \qquad that are analogous to\qquad
+ \begin{tabular}{l}
+ \verb"\pointname" and\\
+ \verb"\marginpointname"
+ \end{tabular}
+\end{center}
+(see section~\ref{sec:pointname}), and commands
+\begin{center}
+ \begin{tabular}{l}
+ \verb"\droptotalbonuspoints",\\
+ \verb"\bonustotalformat", and\\
+ \verb"\totalbonuspoints"
+ \end{tabular}
+ \qquad that are analogous to\qquad
+ \begin{tabular}{l}
+ \verb"\droptotalpoints",\\
+ \verb"\totalformat", and\\
+ \verb"\totalpoints"
+ \end{tabular}
+\end{center}
+(see section~\ref{sec:addup}).
+
%--------------------------------------------------------------------
\subsection{Counting the questions and adding up the points}
@@ -1571,44 +2289,46 @@ the macros
\verb"\numsubsubparts"
\end{tabular}
\end{center}
-These numbers are also printed on the screen when you run \LaTeX, and
+These numbers are also printed on the screen when you run \LaTeX{} and
they are placed into the \verb".log" file as well. If you have more
than one \verb"questions" environment (for example, if your exam has
several parts, with the questions in each part numbered beginning with
``1''), then \verb"\numquestions" will hold the total number of
-questions on the exam.
-
-If you give the command
+questions on the exam. If you do have more than one \verb"questions"
+environment, though, you won't be able to use the \verb"\gradetable"
+or \verb"\pointtable" commands (see section~\ref{sec:Tables}).
+
+If you use the document class option \verb"addpoints" or give the
+command \verb"\addpoints" (see section~\ref{sec:addpoints}), then the
+class will add the total number of points and the total number of
+bonus points (see section~\ref{sec:Bonus}) that you've given to all of
+the questions, parts, subparts, and subsubparts of the exam, and make
+those totals available in the macros
\begin{center}
- \verb"\addpoints"
-\end{center}
-then the class will add the total number of points that you've given
-to all of the questions, parts, and subparts of the exam, and make
-that total available in the macro
-\begin{center}
- \verb"\numpoints"
+ \begin{tabular}{l}
+ \verb"\numpoints"\\
+ \verb"\numbonuspoints"
+ \end{tabular}
\end{center}
-(If you do give the command \verb"\addpoints", then the total number
-of points will also be displayed on the screen when you run \LaTeX,
-and placed into the \verb".log" file as well.) Thus, if you give the
-command \verb"\addpoints" (after the \verb"\documentclass" command and
-before the \verb"\begin{document}" command), and then type
+as well as displaying those totals on the screen when you run \LaTeX{}
+and placing them into the \verb".log" file. You can then type
\begin{verbatim}
\begin{center}
This exam has \numquestions\ questions, for a total of \numpoints\
- points.
+ points and \numbonuspoints\ bonus points.
\end{center}
\end{verbatim}
-after the \verb"\begin{document}" command, then you'll get
+and you'll get
\begin{center}
- This exam has 8 questions, for a total of 120 points.
+ This exam has 8 questions, for a total of 120 points and 10 bonus
+ points.
\end{center}
-
-\emph{Warning}: If you give the command \verb"\addpoints", your point
-values for questions, parts, and subparts must not contain anything
-other than digits. For example, if you \emph{don't} give the command
-\verb"\addpoints", then you can type
+\emph{Warning}: If \verb"addpoints" is in effect, your point values
+for questions, parts, subparts, and subsubparts must not contain
+anything other than digits and the command \verb"\half" (see
+section~\ref{sec:Half}). For example, if you \emph{don't} give the
+command \verb"\addpoints", then you can type
\begin{center}
\verb"\question[10\%]"
\end{center}
@@ -1625,14 +2345,14 @@ the command
\begin{center}
\verb"\noaddpoints"
\end{center}
-to turn off the adding of points, and the command \verb"\addpoints" to
+to turn off the adding of points and the command \verb"\addpoints" to
turn it back on.
-If you give the command \verb"\addpoints", then you can also use the
-command \verb"\gradetable" to print a grading table (see
-section~\ref{sec:Gradetable}) or the command \verb"\pointsofquestion"
-to list the total points for individual questions of the exam (see
-section~\ref{sec:pointsofq}).
+If \verb"addpoints" is in effect, then you can create grading tables
+(see section~\ref{sec:GradeTables}) and point tables (see
+section~\ref{sec:PointTables}) and use the commands
+\verb"\pointsofquestion" (see section~\ref{sec:pointsofq}) and
+\verb"\pointsonpage" (see section~\ref{sec:pointsonp}).
%---------------------------------------------------------------------
\subsection{Referring to specific questions by number (cross
@@ -1641,7 +2361,6 @@ section~\ref{sec:pointsofq}).
You can use the standard \LaTeX{} commands \verb"\label" and
\verb"\ref" to refer to questions (or parts, or subparts, or
subsubparts) by number. For example, if you type
-%
\begin{verbatim}
The first question is question number~\ref{ques:first}.
Question number~\ref{ques:second} has both a good part
@@ -1668,7 +2387,6 @@ This is the \emph{bad} part.
Is there a question?
\end{questions}
\end{verbatim}
-%
then you'll get:
\medskip
@@ -1707,302 +2425,458 @@ file through \LaTeX{} \emph{twice} to be sure that all the cross
references are correct.
-%---------------------------------------------------------------------
-\subsection{Including special instructions for a group of questions}
+%--------------------------------------------------------------------
+\subsection{Customizing the numbers}
+\label{sec:CustNumb}
+
+The default setup is that:
+\begin{questions}
+ \question Question numbers are arabic, and are followed by a period.
+ \begin{parts}
+ \part Part numbers are lower case letters, and are enclosed in
+ parentheses.
+ \begin{subparts}
+ \subpart Subpart numbers are lower case roman, and are followed
+ by a period.
+ \begin{subsubparts}
+ \subsubpart Subsubpart numbers are greek, and are followed by
+ a right parenthesis.
+ \begin{choices}
+ \choice Choices are upper case letters, and are followed by
+ a period.
+ \end{choices}
+ \end{subsubparts}
+ \end{subparts}
+ \end{parts}
+\end{questions}
+All of this can be changed.
+
+\bigskip
+
+To change the type of numbering, you would redefine the commands
+\begin{center}
+ \begin{tabular}{l}
+ \verb"\thequestion"\\
+ \verb"\thepartno"\\
+ \verb"\thesubpart"\\
+ \verb"\thesubsubpart"\\
+ \verb"\thechoice"
+ \end{tabular}
+\end{center}
+(Note: The second one listed there is \verb"\thepartno", \emph{not}
+\verb"\thepart". The command \verb"\thepart" refers to the counter
+used in the article document class standard sectioning command
+\verb"\part".) The numbering commands available are
+\begin{center}
+ \begin{tabular}{ll}
+ \verb"\arabic"& Regular arabic integers\\
+ \verb"\alph"& Lower case letters\\
+ \verb"\Alph"& Upper case letters\\
+ \verb"\roman"& Lower case roman numbers\\
+ \verb"\Roman"& Upper case roman numbers\\
+ \verb"\greeknum"& Greek letters
+ \end{tabular}
+\end{center}
+and any of these can be applied to the counters \verb"question",
+\verb"partno", \verb"subpart", \verb"subsubpart", and \verb"choice".
+(The \verb"\greeknum" command is defined by the exam document class,
+but all of the others are standard \LaTeX{} commands.)
+
+For example, to have questions numbered using upper case roman numbers
+and parts numbered using upper case letters, you would give the
+commands
+\begin{center}
+ \begin{tabular}{l}
+ \verb"\renewcommand\thequestion{\Roman{question}}"\\
+ \verb"\renewcommand\thepartno{\Alph{partno}}"
+ \end{tabular}
+\end{center}
+
+\bigskip
+
+
+The ``decorations'' around the numbers (i.e., the periods, or
+parentheses, or \ldots) are determined by the commands
+\begin{center}
+ \begin{tabular}{l}
+ \verb"\questionlabel"\\
+ \verb"\partlabel"\\
+ \verb"\subpartlabel"\\
+ \verb"\subsubpartlabel"\\
+ \verb"\choicelabel"
+ \end{tabular}
+\end{center}
+the default definitions of which are:
+\begin{center}
+ \begin{tabular}{l}
+ \verb"\newcommand\questionlabel{\thequestion.}"\\
+ \verb"\newcommand\partlabel{(\thepartno)}"\\
+ \verb"\newcommand\subpartlabel{\thesubpart.}"\\
+ \verb"\newcommand\subsubpartlabel{\thesubsubpart)}"\\
+ \verb"\newcommand\choicelabel{\thechoice.}"
+ \end{tabular}
+\end{center}
+You can change any of these by giving \verb"\renewcommand" commands to
+redefine them.
+
+%--------------------------------------------------------------------
+\subsection{Customizing the list parameters}
+\label{sec:CustList}
+
+Each of the environments \verb"questions", \verb"parts",
+\verb"subparts", \verb"subsubparts", and \verb"choices" is implemented
+as a \verb"list" environment. This section describes commands for
+advanced users who want to customize the list parameters
+(\verb"\topsep", \verb"\partopsep", \verb"\itemsep", \verb"\parsep",
+etc.) for the lists that those environments create.
+
+The \verb"exam" document class includes the expansion of
+\begin{center}
+ \begin{tabular}{l@{\qquad when creating a\qquad}l@{\qquad}l}
+ \verb"\questionshook"&\verb"questions"&environment,\\
+ \verb"\partshook"&\verb"parts"&environment,\\
+ \verb"\subpartshook"&\verb"subparts"&environment,\\
+ \verb"\subsubpartshook"&\verb"subsubparts"&environment, and\\
+ \verb"\choiceshook"&\verb"choices"&environment.
+ \end{tabular}
+\end{center}
+The \verb"exam" document class defines these as follows:
+\begin{center}
+ \begin{tabular}{ll}
+ \verb"\newcommand\questionshook{}"\\
+ \verb"\newcommand\partshook{}"\\
+ \verb"\newcommand\subpartshook{}"\\
+ \verb"\newcommand\subsubpartshook{}"\\
+ \verb"\newcommand\choiceshook{}"
+ \end{tabular}
+\end{center}
+Thus, by default, these commands have no effect, but you can change
+any of them with a \verb"\renewcommand" command. Thus, if you
+redefine, e.g., \verb"\questionshook" to expand to commands that set
+values for some of the list parameters, then those values will be used
+in the \verb"questions" environment.
+
+For example, if you give the command
+\begin{center}
+ \verb"\renewcommand\questionshook{\setlength{\itemsep}{1in}}"
+\end{center}
+then there will be an additional one inch of blank space inserted
+between questions (since the questions are the items in a
+\verb"questions" environment). For another example, if you give the
+command
+\begin{center}
+ \verb"\renewcommand\partshook{\setlength{\topsep}{0.5in}}"
+\end{center}
+then each parts environment will have an additional one half inch of
+space before and after the environment.
+
+
+%--------------------------------------------------------------------
+%--------------------------------------------------------------------
+\section{Escaping the indentation: \texttt{\char`\\uplevel} and
+ \texttt{\char`\\fullwidth}}
\label{sec:uplevel}
-There are two commands provided for including special instructions
-for specific questions: \verb"\uplevel" and \verb"\fullwidth". These
-commands allow you to give instructions that will be set with the
-left indentation appropriate for the scope of the instructions.
+There are two commands provided for printing text with a left margin
+smaller than the one currently in effect: \verb"\uplevel" and
+\verb"\fullwidth". Each of these commands takes one argument and
+typesets the argument with an altered left margin. The main uses for
+these commands are including instructions for a group of questions
+(see section~\ref{sec:Instructions}) and naming the parts of a long
+exam (see section~\ref{sec:Naming}), but you can use them however you
+like.
-For example, if you are inside of a parts environment, and you want
-to give directions for the next few parts, then those directions
-should be indented to the level of the question of which they are
-parts, i.e., up one level. If you type
-%
+%--------------------------------------------------------------------
+\subsection{Including instructions for a group of questions}
+\label{sec:Instructions}
+
+If you are inside of a parts environment and you want to give
+directions for the next few parts, then those directions should be
+indented to the level of the question of which they are parts, i.e.,
+up one level. If you type
\begin{verbatim}
\begin{questions}
-\question
-Why did you come to Casablanca?
+ \question
+ Why did you come to Casablanca?
-\question
-\begin{parts}
-\part
-Why, Oh why, Oh why, Oh; why did I ever leave Ohio?
+ \question
+ \begin{parts}
+ \part
+ Why, Oh why, Oh why, Oh; why did I ever leave Ohio?
-\uplevel{The following two parts should be answered in classical
-Greek:}
-\part
-Why do birds sing?
+ \uplevel{The following two parts should be answered in classical
+ Greek:}
+ \part
+ Why do birds sing?
-\part
-Why do fools fall in love?
+ \part
+ Why do fools fall in love?
-\end{parts}
+ \end{parts}
\end{questions}
\end{verbatim}
-%
then you'll get
\begin{questions}
-\question
-Why did you come to Casablanca?
-
+ \question
+ Why did you come to Casablanca?
-\question
-\begin{parts}
-\part
-Why, Oh why, Oh why, Oh; why did I ever leave Ohio?
+ \question
+ \begin{parts}
+ \part
+ Why, Oh why, Oh why, Oh; why did I ever leave Ohio?
-\uplevel{The following two parts should be answered in classical
-Greek:}
-\part
-Why do birds sing?
+ \uplevel{The following two parts should be answered in classical
+ Greek:}
+ \part
+ Why do birds sing?
-\part
-Why do fools fall in love?
+ \part
+ Why do fools fall in love?
-\end{parts}
+ \end{parts}
\end{questions}
-
-
-
-\bigskip
If you want to give instructions for a group of questions, then the
indenting for those instructions should be to the outer left margin,
i.e., up one level. For example, if you type
-%
\begin{verbatim}
\begin{questions}
-\question
-Approximate $\displaystyle \int_0^1 \sin x^2 \, dx$ within $.001$ of
-its true value.
+ \question
+ Approximate $\displaystyle \int_0^1 \sin x^2 \, dx$ within $.001$ of
+ its true value.
-\uplevel{Questions \ref{exact-start} through~\ref{exact-end} should
-be evaluated completely, not just approximated.}
+ \uplevel{Questions \ref{exact-start} through~\ref{exact-end} should
+ be evaluated completely, not just approximated.}
-\question
-\label{exact-start}
-$\displaystyle \int_0^1 \frac{x^2 \, dx}{\sqrt{1-x^2}}$
+ \question
+ \label{exact-start}
+ $\displaystyle \int_0^1 \frac{x^2 \, dx}{\sqrt{1-x^2}}$
-\question
-$\displaystyle \int_0^1 \frac{1}{1+x^2}\, dx$
+ \question
+ $\displaystyle \int_0^1 \frac{1}{1+x^2}\, dx$
-\question
-\label{exact-end}
-$\displaystyle \int_0^{\frac{\pi}{2}} \sin^3 x \cos x \, dx$
+ \question
+ \label{exact-end}
+ $\displaystyle \int_0^{\frac{\pi}{2}} \sin^3 x \cos x \, dx$
\end{questions}
\end{verbatim}
-%
you'll get
\begin{questions}
-\question
-Approximate $\displaystyle \int_0^1 \sin x^2 \, dx$ within $.001$ of
-its true value.
+ \question
+ Approximate $\displaystyle \int_0^1 \sin x^2 \, dx$ within $.001$ of
+ its true value.
-\uplevel{Questions \ref{exact-start} through~\ref{exact-end} should
-be evaluated completely, not just approximated.}
+ \uplevel{Questions \ref{exact-start} through~\ref{exact-end} should
+ be evaluated completely, not just approximated.}
-\question
-\label{exact-start}
-$\displaystyle \int_0^1 \frac{x^2 \, dx}{\sqrt{1-x^2}}$
+ \question
+ \label{exact-start}
+ $\displaystyle \int_0^1 \frac{x^2 \, dx}{\sqrt{1-x^2}}$
-\question
-$\displaystyle \int_0^1 \frac{1}{1+x^2}\, dx$
+ \question
+ $\displaystyle \int_0^1 \frac{1}{1+x^2}\, dx$
-\question
-\label{exact-end}
-$\displaystyle \int_0^{\frac{\pi}{2}} \sin^3 x \cos x \, dx$
+ \question
+ \label{exact-end}
+ $\displaystyle \int_0^{\frac{\pi}{2}} \sin^3 x \cos x \, dx$
\end{questions}
-
-
-
-
-
-\bigskip
If you want to give instructions that use the full width of the page
(rather than just going up one level of indentation), then use the
\verb"\fullwidth" command. For example, if you type
-%
\begin{verbatim}
\begin{questions}
-\question
-This is the first question.
-
-\question
-\begin{parts}
-\part
-This is the first part.
-
-\part
-This is the second part.
-\begin{subparts}
-\subpart
-This is a subpart.
+ \question
+ This is the first question.
-\fullwidth{When you finish this exam, you should go back and
-reexamine your work, both on the earlier part of this exam and in
-your life up until the day of this exam, for any errors that you may
-have made.}
+ \question
+ \begin{parts}
+ \part
+ This is the first part.
-\subpart
-This is another subpart.
-\end{subparts}
-\end{parts}
+ \part
+ This is the second part.
+ \begin{subparts}
+ \subpart
+ This is a subpart.
+
+ \fullwidth{When you finish this exam, you should go back and
+ reexamine your work, both on this exam and in your life up
+ until the day of this exam, for any errors that you may have
+ made.}
+
+ \subpart
+ This is another subpart.
+ \end{subparts}
+ \end{parts}
\end{questions}
\end{verbatim}
-%
then you'll get
\begin{questions}
-\question
-This is the first question.
-
-\question
-\begin{parts}
-\part
-This is the first part.
-
-\part
-This is the second part.
-\begin{subparts}
-\subpart
-This is a subpart.
+ \question
+ This is the first question.
-\fullwidth{When you finish this exam, you should go back and
-reexamine your work, both on the earlier part of this exam and in
-your life up until the day of this exam, for any errors that you may
-have made.}
+ \question
+ \begin{parts}
+ \part
+ This is the first part.
-\subpart
-This is another subpart.
-\end{subparts}
-\end{parts}
+ \part
+ This is the second part.
+ \begin{subparts}
+ \subpart
+ This is a subpart.
+
+ \fullwidth{When you finish this exam, you should go back and
+ reexamine your work, both on this exam and in your life up
+ until the day of this exam, for any errors that you may have
+ made.}
+
+ \subpart
+ This is another subpart.
+ \end{subparts}
+ \end{parts}
\end{questions}
-
-
-
-
%---------------------------------------------------------------------
\subsection{Naming the parts of a long exam}
+\label{sec:Naming}
There are two ways of naming the parts of a long exam. The first way
uses the \verb"\fullwidth" and \verb"\uplevel" commands (see
-section~\ref{sec:uplevel}), and the other way uses the standard
-\verb"\part" and \verb"\section" commands.
+section~\ref{sec:Namefullwidth}), and the other way uses the standard
+\verb"\part" and \verb"\section" commands (see
+section~\ref{sec:NameSection}).
-
-
-\subsubsection{Using \texttt{fullwidth} and \texttt{uplevel}}
+%--------------------------------------------------------------------
+\subsubsection{Using \texttt{\char`\\uplevel} and
+ \texttt{\char`\\fullwidth}}
+\label{sec:Namefullwidth}
To place a section name in the exam, just use a \verb"\fullwidth"
command (see section~\ref{sec:uplevel}) and include whatever font
changing commands that you want to use. For example, if you type
-%
\begin{verbatim}
\begin{questions}
-\question
-Is there, is there balm in Gilead?
-
-\fullwidth{\Large\bf Essay questions}
+ \question
+ Is there, is there balm in Gilead?
-\question
-Explain how the cooling of matter in the centuries following the big
-bang has influenced the British parliamentary system of government.
+ \fullwidth{\Large \textbf{Essay questions}}
+
+ \question
+ Explain how the cooling of matter in the centuries following the big
+ bang has influenced the British parliamentary system of government.
-\fullwidth{\Large\bf Laboratory questions}
+ \fullwidth{\Large \textbf{Laboratory questions}}
-\question
-In the cabinet below your laboratory bench you will find a single
-edged razor blade, several C-clamps, and a bottle of whiskey. Remove
-your appendix. Do not suture until your work has been inspected.
+ \question
+ In the cabinet below your laboratory bench you will find a single
+ edged razor blade, several C-clamps, and a bottle of whiskey.
+ Remove your appendix. Do not suture until your work has been
+ inspected.
\end{questions}
\end{verbatim}
-%
then you'll get
-%
\begin{questions}
-\question
-Is there, is there balm in Gilead?
-
-\fullwidth{\Large\bf Essay questions}
+ \question
+ Is there, is there balm in Gilead?
-\question
-Explain how the cooling of matter in the centuries following the big
-bang has influenced the British parliamentary system of government.
+ \fullwidth{\Large \textbf{Essay questions}}
+
+ \question
+ Explain how the cooling of matter in the centuries following the big
+ bang has influenced the British parliamentary system of government.
-\fullwidth{\Large\bf Laboratory questions}
+ \fullwidth{\Large \textbf{Laboratory questions}}
-\question
-In the cabinet below your laboratory bench you will find a single
-edged razor blade, several C-clamps, and a bottle of whiskey. Remove
-your appendix. Do not suture until your work has been inspected.
+ \question
+ In the cabinet below your laboratory bench you will find a single
+ edged razor blade, several C-clamps, and a bottle of whiskey.
+ Remove your appendix. Do not suture until your work has been
+ inspected.
\end{questions}
-
-
-
-
-
+%--------------------------------------------------------------------
\subsubsection{Using the standard sectioning commands}
+\label{sec:NameSection}
-The exam documentclass is built upon the standard article
-documentclass, and so the sectioning commands used with the article
-documentclass can be used here as well. In particular, you can give
-the commands \verb"\part", \verb"\part*", \verb"\section", and
+The exam document class is built upon the standard article document
+class, and so the sectioning commands used with the article document
+class can be used here as well. In particular, you can give the
+commands \verb"\part", \verb"\part*", \verb"\section", and
\verb"\section*". The definitions made in \verb"exam.cls" ensure that
if a \verb"\part" command appears \emph{outside of a parts
environment} it will be interpreted as a sectioning command, while
-if it appears \emph{inside} of a parts environment, it will be
+if it appears \emph{inside of a parts environment} it will be
interpreted as beginning a new part of a question.
-
-
You can give these commands in the middle of a questions environment
so as not to interrupt the numbering of the questions, or you can end
a questions environment, give a sectioning command, and then start a
-new questions environment (which would reset the question counter
-to start again with number~1). If you give any of these commands
-while inside of a questions environment, then the section titles will
-be indented to the same extent that questions are indented, unless
-they are given as the argument of a \verb"\fullwidth" or
-\verb"\uplevel" command. These
+new questions environment (which would reset the question counter to
+start again with number~1). If you have more than one questions
+environment, though, then you will be unable to use any of the
+commands that create grading tables or point tables (see
+section~\ref{sec:Tables}) or the commands that change the headers and
+footers depending on whether or not a question spans multiple pages
+(see section~\ref{sec:QuesSpan}).
+
+If you give any of these commands while inside of a questions
+environment, then the section titles will be indented to the same
+extent that questions are indented unless they are given as the
+argument of a \verb"\fullwidth" or \verb"\uplevel" command. These
commands have the advantage, however, that the unstarred versions
-provide automatic numbering of the parts (or sections).
+provide automatic numbering of the parts or sections.
+
+
+%--------------------------------------------------------------------
%---------------------------------------------------------------------
-\subsection{Leaving space for the answers}
+\section{Leaving space for the answers}
\label{sec:LeaveSpace}
+There are three different kinds of space that you can create:
+\begin{itemize}
+\item Blank space (see section~\ref{sec:BlankSpace}),
+\item space filled with lines (see section~\ref{sec:FillLines}), and
+\item space filled with dotted lines (see
+ section~\ref{sec:FillDotLines}).
+\end{itemize}
+If you type solutions using a \verb"solution", \verb"solutionorlines",
+or \verb"solutionordottedlines" environment (see
+section~\ref{sec:solutions}), then you can arrange for space to be
+created only when the solutions are not being printed; see
+section~\ref{sec:SolSpace}.
+
+You can also create answer lines for short answer questions (see
+section~\ref{sec:ShortAns}).
+
%--------------------------------------------------------------------
-\subsubsection{Leaving blank space}
+\subsection{Leaving blank space}
\label{sec:BlankSpace}
-To leave a specific amount of blank space on the page for the answer
-to a question, you should use the \verb"\vspace*" command. For
-example, the command \verb"\vspace*{1in}" inserts one inch of vertical
-space after the line in which it appears. (If it appears in between
-paragraphs, then it inserts the space right there.) You can also use
-the \verb"\vspace" command, the difference being that any space
-inserted by \verb"\vspace" will be deleted if it occurs at the top
-of a new page, whereas space inserted by \verb"\vspace*" will never
-be deleted.
+To leave blank space on the page for the answer to a question, you
+should use the \verb"\vspace*" command. For example, the command
+\verb"\vspace*{1in}" inserts one inch of vertical space after the line
+in which it appears. (If it appears in between paragraphs, then it
+inserts the space right there.) You can also use the \verb"\vspace"
+command, the difference being that space inserted by \verb"\vspace"
+will be deleted if it occurs at the top of a new page, whereas space
+inserted by \verb"\vspace*" will never be deleted.
If you want to equally distribute the blank space among the questions
on the page, then just put \verb"\vspace*{\fill}" after each question
on the page and use \verb"\newpage" to end the page.
-You can also leave blank space (when solutions are not being printed)
-by including an optional argument with the \verb"solution"
-environment; see section~\ref{sec:SolSpace}.
+You can also leave blank space when solutions are not being printed by
+using an optional argument with a \verb"solution" environment; see
+section~\ref{sec:SolSpace}.
%--------------------------------------------------------------------
-\subsubsection{Printing lined space for answers}
+\subsection{Printing lined space for answers}
\label{sec:FillLines}
-You can print blank lines with the command
+You can fill space with lines with the command
\begin{center}
\verb"\fillwithlines{length}"
\end{center}
@@ -2016,50 +2890,50 @@ question, part, subpart, or subsubpart) to the right margin.
For example, if you type
\begin{verbatim}
\begin{questions}
-\question
-In no more than one paragraph, explain why the earth is round.
+ \question
+ In no more than one paragraph, explain why the earth is round.
-\fillwithlines{1in}
-
-\question
-\begin{parts}
-\part
-What changes to the van Allen radiation belt are needed to make the
-earth into a regular icosahedron?
+ \fillwithlines{1in}
+
+ \question
+ \begin{parts}
+ \part
+ What changes to the van Allen radiation belt are needed to make
+ the earth into a regular icosahedron?
-\fillwithlines{1in}
+ \fillwithlines{1in}
-\part
-Where should the field generator be constructed if you want one of the
-vertices to be located at the Royal Observatory at Greenwich?
+ \part
+ Where should the field generator be constructed if you want one of
+ the vertices to be located at the Royal Observatory at Greenwich?
-\fillwithlines{1in}
+ \fillwithlines{1in}
-\end{parts}
+ \end{parts}
\end{questions}
\end{verbatim}
then you'll get
\begin{questions}
-\question
-In no more than one paragraph, explain why the earth is round.
-
-\fillwithlines{1in}
+ \question
+ In no more than one paragraph, explain why the earth is round.
-\question
-\begin{parts}
-\part
-What changes to the van Allen radiation belt are needed to make the
-earth into a regular icosahedron?
+ \fillwithlines{1in}
+
+ \question
+ \begin{parts}
+ \part
+ What changes to the van Allen radiation belt are needed to make
+ the earth into a regular icosahedron?
-\fillwithlines{1in}
+ \fillwithlines{1in}
-\part
-Where should the field generator be constructed if you want one of the
-vertices to be located at the Royal Observatory at Greenwich?
+ \part
+ Where should the field generator be constructed if you want one of
+ the vertices to be located at the Royal Observatory at Greenwich?
-\fillwithlines{1in}
+ \fillwithlines{1in}
-\end{parts}
+ \end{parts}
\end{questions}
\medskip
@@ -2077,8 +2951,6 @@ value of which is set with the command
and that value can also be changed by giving a new \verb"\setlength"
command.
-\medskip
-
If you want to fill the remaining space on the page with lines, you
should give the commands
\begin{center}
@@ -2092,12 +2964,103 @@ questions on the page, then just put \verb"\fillwithlines{\fill}"
after each question on the page and use \verb"\newpage" to end the
page.
-You can also insert lined space (when solutions are not being printed)
+You can also insert lined space when solutions are not being printed
by including an optional argument with the \verb"solutionorlines"
environment; see section~\ref{sec:SolSpace}.
+%--------------------------------------------------------------------
+\subsection{Printing dotted lined space}
+\label{sec:FillDotLines}
+
+You can fill space with dotted lines with the command
+\begin{center}
+ \verb"\fillwithdottedlines{length}"
+\end{center}
+which fills vertical space of height \verb"length" with dotted
+horizontal lines that run the length of the current line. That is,
+they extend from the current left margin (which depends on whether
+we're in a question, part, subpart, or subsubpart) to the right
+margin. The command \verb"\fillwithdottedlines" is almost identical
+to the \verb"\fillwithlines" command (see
+section~\ref{sec:FillLines}), except that the lines created are dotted
+and the distance between the lines is \verb"\dottedlinefillheight".
+The default value of \verb"\dottedlinefillheight" is set by the
+command
+\begin{center}
+ \verb"\setlength\dottedlinefillheight{.25in}"
+\end{center}
+and that value can be changed by giving a new \verb"\setlength"
+command.
+
+For example, if you type
+\begin{verbatim}
+\begin{questions}
+ \question
+ In no more than one paragraph, explain why the earth is round.
+
+ \fillwithdottedlines{1in}
+
+ \question
+ \begin{parts}
+ \part
+ What changes to the van Allen radiation belt are needed to make
+ the earth into a regular icosahedron?
+
+ \fillwithdottedlines{1in}
+
+ \part
+ Where should the field generator be constructed if you want one of
+ the vertices to be located at the Royal Observatory at Greenwich?
+
+ \fillwithdottedlines{1in}
+
+ \end{parts}
+\end{questions}
+\end{verbatim}
+then you'll get
+\begin{questions}
+ \question
+ In no more than one paragraph, explain why the earth is round.
+
+ \fillwithdottedlines{1in}
+
+ \question
+ \begin{parts}
+ \part
+ What changes to the van Allen radiation belt are needed to make
+ the earth into a regular icosahedron?
+
+ \fillwithdottedlines{1in}
+
+ \part
+ Where should the field generator be constructed if you want one of
+ the vertices to be located at the Royal Observatory at Greenwich?
+
+ \fillwithdottedlines{1in}
+
+ \end{parts}
+\end{questions}
+
+If you want to fill the remaining space on the page with dotted lines,
+you should give the commands
+\begin{center}
+ \begin{tabular}{l}
+ \verb"\fillwithdottedlines{\fill}"\\
+ \verb"\newpage"
+ \end{tabular}
+\end{center}
+If you want to equally distribute the space for answers among the
+questions on the page, then just put
+\verb"\fillwithdottedlines{\fill}" after each question on the page and
+use \verb"\newpage" to end the page.
+
+You can also insert dotted lined space when solutions are not being
+printed by including an optional argument with the
+\verb"solutionordottedlines" environment; see
+section~\ref{sec:SolSpace}.
+
%--------------------------------------------------------------------
-\subsubsection{Short answer questions}
+\subsection{Short answer questions}
\label{sec:ShortAns}
@@ -2125,225 +3088,138 @@ omitted.
For example, if you type
\begin{verbatim}
\begin{questions}
-\question
-Who's buried in Grant's tomb?
-\answerline
+ \question
+ Who's buried in Grant's tomb?
+ \answerline
-\question
-What was the color of George Washington's white horse?
-\answerline
+ \question
+ What was the color of George Washington's white horse?
+ \answerline
-\question
-Which is heavier: A pound of feathers, or a pound of lead?
-\answerline
+ \question
+ Which is heavier: A pound of feathers, or a pound of lead?
+ \answerline
\end{questions}
\end{verbatim}
then you'll get
\begin{questions}
-\question
-Who's buried in Grant's tomb?
-\answerline
+ \question
+ Who's buried in Grant's tomb?
+ \answerline
-\question
-What was the color of George Washington's white horse?
-\answerline
+ \question
+ What was the color of George Washington's white horse?
+ \answerline
-\question
-Which is heavier: A pound of feathers, or a pound of lead?
-\answerline
+ \question
+ Which is heavier: A pound of feathers, or a pound of lead?
+ \answerline
\end{questions}
and if you type
\begin{verbatim}
\begin{questions}
-\question
-Answer the following questions on the lines at the right:
-\begin{parts}
-\part
-Who's buried in Grant's tomb? \answerline
+ \question
+ Answer the following questions on the lines at the right:
+ \begin{parts}
+ \part
+ Who's buried in Grant's tomb? \answerline
-\part
-\begin{subparts}
-\subpart
-What light through yonder window breaks? \answerline
+ \part
+ \begin{subparts}
+ \subpart
+ What light through yonder window breaks? \answerline
-\subpart
-To be, or not to be; that is the question? \answerline
-\end{subparts}
+ \subpart
+ To be, or not to be; that is the question? \answerline
+ \end{subparts}
-\part
-What was the color of George Washington's white horse? \answerline
-\end{parts}
+ \part
+ What was the color of George Washington's white horse? \answerline
+ \end{parts}
\end{questions}
\end{verbatim}
then you'll get
\begin{questions}
-\question
-Answer the following questions on the lines at the right:
-\begin{parts}
-\part
-Who's buried in Grant's tomb? \answerline
+ \question
+ Answer the following questions on the lines at the right:
+ \begin{parts}
+ \part
+ Who's buried in Grant's tomb? \answerline
-\part
-\begin{subparts}
-\subpart
-What light through yonder window breaks? \answerline
+ \part
+ \begin{subparts}
+ \subpart
+ What light through yonder window breaks? \answerline
-\subpart
-To be, or not to be; that is the question? \answerline
-\end{subparts}
+ \subpart
+ To be, or not to be; that is the question? \answerline
+ \end{subparts}
-\part
-What was the color of George Washington's white horse? \answerline
-\end{parts}
+ \part
+ What was the color of George Washington's white horse? \answerline
+ \end{parts}
\end{questions}
-
-%--------------------------------------------------------------------
-\subsection{Multiple choice questions}
-\label{sec:MulChc}
-
-There are two environments for listing the possible answers to a
-multiple choice question:
-\begin{itemize}
-\item The \verb"choices" environment creates a list with the choices
- as the items in the list.
-\item The \verb"oneparchoices" environment lists all of the choices in
- a single paragraph (that is a continuation of the paragraph
- preceding the environment unless you leave a blank line before
- beginning the environment).
-\end{itemize}
-Both of these environments use upper case letters (i.e., ``A'', ``B'',
-``C'', \ldots) to label the choices; to change this, see
-section~\ref{sec:CustNumb}.
-
%--------------------------------------------------------------------
-\subsubsection{The \texttt{choices} environment}
-\label{sec:choices}
+\subsection{Printing the answers to short answer questions}
+\label{sec:AnsShortAns}
+
+The \verb"\answerline" command can take an optional argument so that
+you can have the answer to the question printed on the answer line
+when answers are being printed (see section~\ref{sec:answers}). When
+answers are not being printed, the optional argument is ignored.
+
+When answers are being printed, the optional argument is printed
+subject to the declarations in the argument of the last
+\verb"\CorrectChoiceEmphasis" command (which by default is
+\verb"\bfseries"; see section~\ref{sec:CorrectChoice}), and it is
+printed a distance of \verb"\answerclearance" above the line. The
+default value of \verb"\answerclearance" is set with the command
+\begin{center}
+ \verb"\setlength\answerclearance{0.2ex}"
+\end{center}
+and it can be changed with a \verb"\setlength" command. The optional
+argument is centered on the answer line unless it is longer than the
+line, in which case it extends to the right of the line.
For example, if you type
\begin{verbatim}
\begin{questions}
-\question
-One of these things is not like the others; one of these things is not
-the same. Which one is different?
-\begin{choices}
-\choice
-John
-
-\choice
-Paul
-
-\choice
-George
-
-\choice
-Ringo
-
-\choice
-Socrates
-
-\end{choices}
-
+ \question Who was the fifth Beatle? \answerline[Murray the K]
+ \question What is the answer to the ultimate question of life, the
+ universe, and everything? \answerline[42]
\end{questions}
\end{verbatim}
-Then you'll get
-\begin{questions}
-\question
-One of these things is not like the others; one of these things is not
-the same. Which one is different?
-\begin{choices}
-\choice
-John
-
-\choice
-Paul
-
-\choice
-George
-
-\choice
-Ringo
-
-\choice
-Socrates
-
-\end{choices}
-
-\end{questions}
-
-%--------------------------------------------------------------------
-\subsubsection{The \texttt{oneparchoices} environment}
-
-If instead of the \verb"choices" environment in the example of
-section~\ref{sec:choices} you use a \verb"oneparchoices" environment,
-then you'll get
+and if \verb"\noprintanswers" (the default) is in effect, you'll get
\begin{questions}
-\question
-One of these things is not like the others; one of these things is not
-the same. Which one is different?
-\begin{oneparchoices}
-\choice
-John
-
-\choice
-Paul
-
-\choice
-George
-
-\choice
-Ringo
-
-\choice
-Socrates
-
-\end{oneparchoices}
-
+ \question Who was the fifth Beatle? \answerline[Murray the K]
+ \question What is the answer to the ultimate question of life, the
+ universe, and everything? \answerline[42]
\end{questions}
-If you insert a blank line before the \verb"\begin{oneparchoices}",
- then you'll get
+while if \verb"\printanswers" is in effect, you'll get \printanswers
\begin{questions}
-\question
-One of these things is not like the others; one of these things is not
-the same. Which one is different?
-
-\begin{oneparchoices}
-\choice
-John
-
-\choice
-Paul
-
-\choice
-George
-
-\choice
-Ringo
-
-\choice
-Socrates
-
-\end{oneparchoices}
-
+ \question Who was the fifth Beatle? \answerline[Murray the K]
+ \question What is the answer to the ultimate question of life, the
+ universe, and everything? \answerline[42]
\end{questions}
+\noprintanswers
-
%--------------------------------------------------------------------
-\subsection{Including solutions}
+%--------------------------------------------------------------------
+\section{Including solutions}
\label{sec:solutions}
-
-
-There are two environments for printing solutions to the problems:
+There are three environments for printing solutions to the problems:
\begin{center}
\begin{tabular}{rll}
- The& \verb"solution"& environment, and\\
- the& \verb"solutionorlines"& environment.
+ The& \verb"solution"& environment,\\
+ the& \verb"solutionorlines"& environment, and\\
+ the& \verb"solutionordottedlines"& environment.
\end{tabular}
\end{center}
If you use these environments without any optional arguments, then
-they are identical: They either print the solution or nothing at all.
+they are identical: They print either the solution or nothing at all.
Whether or not solutions are printed is controlled by the two commands
\begin{center}
\begin{tabular}{l}
@@ -2351,28 +3227,39 @@ Whether or not solutions are printed is controlled by the two commands
\verb"\noprintanswers"
\end{tabular}
\end{center}
-Using these commands, you can print the solutions for the entire exam
-or for only certain parts of it. The default is that solutions are
-\emph{not} printed. There is also an \verb"answers" option to the
-exam documentclass, used as in
+Using these commands to turn printing of solutions on and off, you can
+print the solutions for the entire exam or for only certain parts of
+it. The default is that solutions are \emph{not} printed. There is
+also an \verb"answers" option to the \verb"exam" document class, used
+as in
\begin{center}
\verb"\documentclass[answers]{exam}"
\end{center}
that is equivalent to giving the command \verb"\printanswers" at the
-beginning of the document.
+beginning of the document (see section~\ref{sec:answers}).
-Both of these environments can take an optional argument, which is an
-amount of space to be inserted when solutions are not being printed.
-If this optional argument is used and solutions are not being printed,
-then:
+All of these environments can take an optional argument, which is an
+amount of space to be inserted when solutions are not being printed
+(see section~\ref{sec:SolSpace}). The only differences between these
+environments is that if this optional argument is used and solutions
+are not being printed, then
\begin{itemize}
-\item The \verb"solution" enviroment inserts that amount of blank
- space, and
-\item the \verb"solutionorlines" environment inserts that amound of
+\item the \verb"solution" enviroment inserts that amount of blank
+ space, as if you had given a \verb"\vspace*" command (see
+ section~\ref{sec:BlankSpace}),
+\item the \verb"solutionorlines" environment inserts that amount of
space with ruled lines, as if you had given a \verb"\fillwithlines"
- command (see section~\ref{sec:FillLines}).
+ command (see section~\ref{sec:FillLines}), and
+\item the \verb"solutionordottedlines" environment inserts that amount
+ of space with dotted lines, as if you had given a
+ \verb"\fillwithdottedlines" command (see
+ section~\ref{sec:FillDotLines}).
\end{itemize}
+%--------------------------------------------------------------------
+\subsection{Printing the solution in a box}
+\label{sec:SolutionAppearance}
+
By default, the solution is printed inside of a box (i.e., an
\verb"\fbox"), and if the solution is broken across pages, then each
piece is enclosed in a box. There is also a \verb"\shadedsolutions"
@@ -2386,98 +3273,94 @@ color, or at least grayscale (see section~\ref{sec:shaded}).
For example, if you type
\begin{verbatim}
\begin{questions}
-\question Did you mutter something?
-
-\begin{solution}
- Once upon a midnight dreary, while I pondered, weak and weary, Over
- many a quaint and curious volume of forgotten lore--- While I
- nodded, nearly napping, suddenly there came a tapping, As of some
- one gently rapping, rapping at my chamber door. ``\,'Tis some
- visitor,'' I muttered, ``tapping at my chamber door--- Only this and
- nothing more.''
-\end{solution}
+ \question Did you mutter something?
+
+ \begin{solution}
+ Once upon a midnight dreary, while I pondered, weak and weary,
+ Over many a quaint and curious volume of forgotten lore--- While I
+ nodded, nearly napping, suddenly there came a tapping, As of some
+ one gently rapping, rapping at my chamber door. ``\,'Tis some
+ visitor,'' I muttered, ``tapping at my chamber door--- Only this
+ and nothing more.''
+ \end{solution}
\end{questions}
\end{verbatim}
-and you've given the command \verb"\printanswers" or used the
-documentclass option \verb"answers", then you'll get
-\bigskip
+and you've given the command \verb"\printanswers" or used the document
+class option \verb"answers" (see section~\ref{sec:answers}), then
+you'll get \bigskip
\begin{questions}
-\question Did you mutter something?
-
-\begin{TheSolution}
- Once upon a midnight dreary, while I pondered, weak and weary, Over
- many a quaint and curious volume of forgotten lore--- While I
- nodded, nearly napping, suddenly there came a tapping, As of some
- one gently rapping, rapping at my chamber door. ``\,'Tis some
- visitor,'' I muttered, ``tapping at my chamber door--- Only this and
- nothing more.''
-\end{TheSolution}
+ \question Did you mutter something?
+
+ \begin{TheSolution}
+ Once upon a midnight dreary, while I pondered, weak and weary,
+ Over many a quaint and curious volume of forgotten lore--- While I
+ nodded, nearly napping, suddenly there came a tapping, As of some
+ one gently rapping, rapping at my chamber door. ``\,'Tis some
+ visitor,'' I muttered, ``tapping at my chamber door--- Only this
+ and nothing more.''
+ \end{TheSolution}
\end{questions}
\bigskip
-
The result would be exactly the same if the above \verb"solution"
-environment were replaced by a \verb"solutionorlines" environment.
+environment were replaced by either a \verb"solutionorlines" or
+\verb"solutionordottedlines" environment.
By default, the solution is printed in a box whose width equals that
of the text of the current question (or part, or subpart, or
subsubpart). That is, the indentation at the left of the solution
equals the current level of indentation. You can change this by
-enclosing the \verb"solution" or \verb"solutionorlines" environment in
-the argument of a \verb"\fullwidth" or \verb"\uplevel" command. For
-example, if you type
+enclosing the \verb"solution", \verb"solutionorlines", or
+\verb"solutionordottedlines" environment in the argument of a
+\verb"\fullwidth" or \verb"\uplevel" command (see
+section~\ref{sec:uplevel}). For example, if you type
\begin{verbatim}
\begin{questions}
-\question Did you mutter something?
-
-
-\fullwidth{\begin{solution}
- Once upon a midnight dreary, while I pondered, weak and weary, Over
- many a quaint and curious volume of forgotten lore--- While I
- nodded, nearly napping, suddenly there came a tapping, As of some
- one gently rapping, rapping at my chamber door. ``\,'Tis some
- visitor,'' I muttered, ``tapping at my chamber door--- Only this and
- nothing more.''
-\end{solution}}
+ \question Did you mutter something?
+
+ \fullwidth{\begin{solution}
+ Once upon a midnight dreary, while I pondered, weak and weary,
+ Over many a quaint and curious volume of forgotten lore--- While I
+ nodded, nearly napping, suddenly there came a tapping, As of some
+ one gently rapping, rapping at my chamber door. ``\,'Tis some
+ visitor,'' I muttered, ``tapping at my chamber door--- Only this
+ and nothing more.''
+ \end{solution}}
\end{questions}
\end{verbatim}
and you've given the command \verb"\printanswers" or used the
-documentclass option \verb"answers", then you'll get
+document class option \verb"answers", then you'll get
\bigskip
\begin{questions}
-\question Did you mutter something?
-
-
-\fullwidth{\begin{TheSolution}
- Once upon a midnight dreary, while I pondered, weak and weary, Over
- many a quaint and curious volume of forgotten lore--- While I
- nodded, nearly napping, suddenly there came a tapping, As of some
- one gently rapping, rapping at my chamber door. ``\,'Tis some
- visitor,'' I muttered, ``tapping at my chamber door--- Only this and
- nothing more.''
-\end{TheSolution}}
+ \question Did you mutter something?
+
+ \fullwidth{\begin{TheSolution}
+ Once upon a midnight dreary, while I pondered, weak and weary,
+ Over many a quaint and curious volume of forgotten lore--- While I
+ nodded, nearly napping, suddenly there came a tapping, As of some
+ one gently rapping, rapping at my chamber door. ``\,'Tis some
+ visitor,'' I muttered, ``tapping at my chamber door--- Only this
+ and nothing more.''
+ \end{TheSolution}}
\end{questions}
-
-
-For both of these environments, if solutions are not being printed
+With all of these environments, if solutions are not being printed
then the contents of the environment are ignored. If, however, you
-use the optional argument to the \verb"solution" environment (see
-section~\ref{sec:SolSpace}), then the requested amount of blank space
-will be inserted when the solution isn't printed, and if you use the
-optional argument to the \verb"solutionorlines" environment, then the
-requested amount of lined space will be inserted when solutions are
-not being printed. For all of this, see section~\ref{sec:SolSpace}.
+include the optional argument (see section~\ref{sec:SolSpace}), then
+the requested amount of space (blank, lined, or dotted lined) will be
+inserted when the solution isn't printed.
%--------------------------------------------------------------------
-\subsubsection{Printing the solution on a shaded background}
+\subsection{Printing the solution on a shaded background}
\label{sec:shaded}
If you load the \verb"color" package with the command
\begin{center}
\verb"\usepackage{color}"
\end{center}
-in the preamble of your document, then you can give the command
+in the preamble of your document (i.e., after the
+\verb"\documentclass" command and before the \verb"\begin{document}"
+ command), then you can give the command
\begin{center}
\verb"\shadedsolutions"
\end{center}
@@ -2485,7 +3368,7 @@ This will cause solutions to be printed on a shaded background, which
by default is a light gray. (Most laser printers can at least print
grayscale when printing with the correct driver.) If you want to
change the color of the shading, you can do so by redefining the color
-\verb"ShadeColor". For example, if you give the command
+\verb"SolutionColor". For example, if you give the command
\begin{center}
\verb"\definecolor{SolutionColor}{rgb}{0.8,0.9,1}"
\end{center}
@@ -2501,14 +3384,15 @@ which returns you to the default situation.
%--------------------------------------------------------------------
-\subsubsection{Customizing the heading of the solution}
+\subsection{Customizing the heading of the solution}
\label{sec:SolCust}
The word ``\textbf{Solution:}'' that you see at the beginning of the
-solutions printed by the \verb"solution" and \verb"solutionorlines"
-environment cans be changed by redefining the command
-\verb"\solutiontitle". The default value was created by the command
+solutions printed by the \verb"solution", \verb"solutionorlines", and
+\verb"solutionordottedlines" environments can be changed by redefining
+the command \verb"\solutiontitle". The default value was created by
+the command
\begin{center}
\verb"\newcommand{\solutiontitle}{\noindent\textbf{Solution:}\enspace}"
\end{center}
@@ -2533,39 +3417,44 @@ then the \verb"solution" environment above would print
\end{questions}
\renewcommand{\solutiontitle}{\noindent\textbf{Solution:}\enspace}
-
-\bigskip
-
-The appearance of the \verb"solution" and \verb"solutionorlines"
-environments can actually be totally customized, if you're up to
-defining a \LaTeX{} environment. The appearance of the solution typed
-into either a \verb"solution" or \verb"solutionorlines" environment is
+The appearance of the \verb"solution", \verb"solutionorlines", and
+\verb"solutionordottedlines" environments can actually be totally
+customized, if you're up to defining a \LaTeX{} environment. The
+appearance of the solution typed into any of these environments is
defined by an environment called \verb"TheSolution", and you can
change the definition of \verb"TheSolution" with a
\verb"\renewenvironment" command. That is, the \verb"solution"
environment decides whether the command \verb"\printanswers" has been
given and, if so, it feeds the contents of the \verb"solution"
environment into a \verb"TheSolution" environment. (The behavior of a
-\verb"solutionorlines" environment is similar.) If you use
-\verb"\renewenvironment" to change the definition of the
-\verb"TheSolution" environment, you'll be changing the way the
-solution is printed. For the default definition of the
+\verb"solutionorlines" or \verb"solutionordottedlines" environment is
+similar.) If you use \verb"\renewenvironment" to change the
+definition of the \verb"TheSolution" environment, you'll be changing
+the way the solution is printed. For the default definition of the
\verb"TheSolution" environment, see the file \verb"exam.cls".
-
%--------------------------------------------------------------------
-\subsubsection{Leaving blank space for the answers when solutions aren't
+\subsection{Leaving space for the answers when solutions aren't
printed}
\label{sec:SolSpace}
-Both the \verb"solution" and \verb"solutionorlines" environments take
-an optional argument:
+Each of the \verb"solution", \verb"solutionorlines", and
+\verb"solutionordottedlines" environments takes an optional argument:
\begin{itemize}
\item In a \verb"solution" environment this is an amount of blank
- space to be left when the solutions are not being printed, and
+ space to be left (just as if you had used a \verb"\vspace*" command;
+ see section~\ref{sec:BlankSpace}) when solutions are not being
+ printed,
\item in a \verb"solutionorlines" environment this is an amount of
- lined space to be left when the solutions are not being printed
+ lined space to be left (just as if you had used a
+ \verb"\fillwithlines" command; see section~\ref{sec:FillLines}) when
+ solutions are not being printed, and
+\item in a \verb"solutionordottedlines" environment this is an amount
+ of dotted lined space to be left (just as if you had used a
+ \verb"\fillwithdottedlines" command; see
+ section~\ref{sec:FillDotLines}) when solutions are not being
+ printed.
\end{itemize}
For example, if you type
\begin{verbatim}
@@ -2578,8 +3467,10 @@ For example, if you type
nothing more.''
\end{solution}
\end{verbatim}
-then there will be 2 inches of blank space inserted when solutions are
-not being printed, and if you type
+then there will be 2 inches of blank space inserted (as if you had
+given the command \verb"\vspace*{2in}"; see
+section~\ref{sec:BlankSpace}) when solutions are not being printed, if
+you type
\begin{verbatim}
\begin{solutionorlines}[2in]
Once upon a midnight dreary, while I pondered, weak and weary, Over
@@ -2591,152 +3482,167 @@ not being printed, and if you type
\end{solutionorlines}
\end{verbatim}
then there will be 2 inches of lined space inserted (as if you had
-given a \verb"\fillwithlines" command; see
-section~\ref{sec:FillLines}) when solutions are not being printed.
+given the command \verb"\fillwithlines{2in}"; see
+section~\ref{sec:FillLines}) when solutions are not being printed, and
+if you type
+\begin{verbatim}
+\begin{solutionordottedlines}[2in]
+ Once upon a midnight dreary, while I pondered, weak and weary, Over
+ many a quaint and curious volume of forgotten lore--- While I
+ nodded, nearly napping, suddenly there came a tapping, As of some
+ one gently rapping, rapping at my chamber door. ``\,'Tis some
+ visitor,'' I muttered, ``tapping at my chamber door--- Only this and
+ nothing more.''
+\end{solutionorlines}
+\end{verbatim}
+then there will be 2 inches of dotted lined space inserted (as if you
+had given the command \verb"\fillwithdottedlines{2in}"; see
+section~\ref{sec:FillDotLines}) when solutions are not being printed.
+%--------------------------------------------------------------------
+\subsection{Changes depending on whether or not solutions are
+ being printed}
+\label{sec:ifprintanswers}
+
+The command \verb"\ifprintanswers" is provided in case you want to
+vary what appears on the exam in ways other than those provided by the
+solution environments (see section~\ref{sec:solutions}), the
+\verb"\CorrectChoice" command in multiple choice environments (see
+section~\ref{sec:CorrectChoice}), and the optional argument to the
+\verb"\answerline" command (see section~\ref{sec:AnsShortAns}). You
+use this command by typing
+\begin{verbatim}
+\ifprintanswers
+ Stuff to appear only when answers are being printed.
+\else
+ Stuff to appear only when answers are not being printed.
+\fi
+\end{verbatim}
+The \verb"\else" clause is optional; you can also type
+\begin{verbatim}
+\ifprintanswers
+ Stuff to appear only when answers are being printed.
+\fi
+\end{verbatim}
+If you want something printed only when answers are not being printed,
+you can type
+\begin{verbatim}
+\ifprintanswers
+\else
+ Stuff to appear only when answers are not being printed.
+\fi
+\end{verbatim}
+Since the \verb"exam" document class automatically loads the
+\verb"ifthen" package, you can accomplish the same things using the
+\verb"\ifthenelse" command:
+\begin{verbatim}
+\ifthenelse{\boolean{printanswers}}
+ {Stuff to appear only when answers are being printed.}
+ {Stuff to appear only when answers are not being printed.}
+\end{verbatim}
+If you use \verb"\ifthenelse", then \verb"both" cases must be present,
+even if you leave one of them empty. Thus, e.g., if you want to print
+something only when answers are not being printed, you'd type
+\begin{verbatim}
+\ifthenelse{\boolean{printanswers}}
+ {}
+ {Stuff to appear only when answers are not being printed.}
+\end{verbatim}
-%--------------------------------------------------------------------
-\subsection{Customizing the numbers}
-\label{sec:CustNumb}
-The default setup is that:
-\begin{questions}
- \question Question numbers are arabic, and are followed by a period.
- \begin{parts}
- \part Part numbers are lower case letters, and are enclosed in
- parentheses.
- \begin{subparts}
- \subpart Subpart numbers are lower case roman, and are followed
- by a period.
- \begin{subsubparts}
- \subsubpart Subsubpart numbers are greek, and are followed by
- a right parenthesis.
- \begin{choices}
- \choice Choices are upper case letters, and are followed by
- a period.
- \end{choices}
- \end{subsubparts}
- \end{subparts}
- \end{parts}
-\end{questions}
-All of this can be changed.
-\bigskip
+%
+% If you want to ``Stuff'' only when answers aren't being printed, you
+% can say either
+%
+% \ifprintanswers
+% \else
+% Stuff
+% \fi
+%
+% or
+%
+% \ifthenelse{\boolean{printanswers}}{}{Stuff}
-To change the type of numbering, you would redefine the commands
-\begin{center}
- \begin{tabular}{l}
- \verb"\thequestion"\\
- \verb"\thepartno"\\
- \verb"\thesubpart"\\
- \verb"\thesubsubpart"\\
- \verb"\thechoice"
- \end{tabular}
-\end{center}
-(Note: The second one listed there is \verb"\thepartno", \emph{not}
-\verb"\thepart". The command \verb"\thepart" refers to the counter
-used in the article documentclass standard sectioning command
-\verb"\part".) The numbering commands available are
-\begin{center}
- \begin{tabular}{ll}
- \verb"\arabic"& Regular arabic integers\\
- \verb"\alph"& Lower case letters\\
- \verb"\Alph"& Upper case letters\\
- \verb"\roman"& Lower case roman numbers\\
- \verb"\Roman"& Upper case roman numbers\\
- \verb"\greeknum"& Greek letters
- \end{tabular}
-\end{center}
-and any of these can be applied to the counters \verb"question",
-\verb"partno", \verb"subpart", \verb"subsubpart", and \verb"choice".
-(The \verb"\greeknum" command is defined by the exam documentclass,
-but all of the others are standard \LaTeX{} commands.)
-For example, to have questions numbered using upper case roman numbers
-and parts numbered using upper case letters, you would give the
-commands
-\begin{center}
- \begin{tabular}{l}
- \verb"\renewcommand\thequestion{\Roman{question}}"\\
- \verb"\renewcommand\thepartno{\Alph{partno}}"
- \end{tabular}
-\end{center}
-\bigskip
+%--------------------------------------------------------------------
+%--------------------------------------------------------------------
+\section{Grading tables and point tables}
+\label{sec:Tables}
+\newlength\cwidth
-The ``decorations'' around the numbers (i.e., the periods, or
-parentheses, or \ldots) are determined by the commands
-\begin{center}
- \begin{tabular}{l}
- \verb"\questionlabel"\\
- \verb"\partlabel"\\
- \verb"\subpartlabel"\\
- \verb"\subsubpartlabel"\\
- \verb"\choicelabel"
- \end{tabular}
-\end{center}
-the default definitions of which are:
-\begin{center}
- \begin{tabular}{l}
- \verb"\newcommand\questionlabel{\thequestion.}"\\
- \verb"\newcommand\partlabel{(\thepartno)}"\\
- \verb"\newcommand\subpartlabel{\thesubpart.}"\\
- \verb"\newcommand\subsubpartlabel{\thesubsubpart)}"\\
- \verb"\newcommand\choicelabel{\thechoice.}"
- \end{tabular}
-\end{center}
-You can change any of these by giving \verb"\renewcommand" commands to
-redefine them.
+The \verb"exam" document class can print either
+\begin{itemize}
+\item a grading table, indexed either by question number or by page
+ number, which lists the points possible and leaves space for you to
+ fill in (by hand) the points earned (see
+ section~\ref{sec:GradeTables}), or
+\item a point table, indexed either by question number or by page
+ number, which lists the points possible but does not leave space for
+ you to fill in the points earned (see
+ section~\ref{sec:PointTables}).
+\end{itemize}
+It's also possible to print either a grading table or point table to
+cover only part of the exam (see section~\ref{sec:PartialTable}).
+If the exam has any bonus points (see section~\ref{sec:Bonus}), then
+the bonus points will be ignored by the tables described in sections
+\ref{sec:GradeTables}, \ref{sec:PointTables},
+and~\ref{sec:PartialTable}, but it's possible to print bonus grading
+tables and bonus point tables that list the bonus points and ignore
+the non-bonus points (see section~\ref{sec:BonusTables}).
-%--------------------------------------------------------------------
-\section{Grading tables}
-\label{sec:Gradetable}
-\newlength\cwidth
+%--------------------------------------------------------------------
+\subsection{Grading tables indexed by question number or by page
+ number}
+\label{sec:GradeTables}
-The exam documentclass can print a ``grading table'', indexed either
-by question number or by page numer. That is, you can print
+The \verb"exam" document class can print a grading table, indexed
+either by question number or by page number. That is, you can print
\begin{itemize}
-\item a table listing the question numbers and the total points
- possible for each question (including all of its parts, subparts,
- and subsubparts) and leaving space for you to fill in (by hand) the
- points earned on each question, or
+\item a table listing the question numbers (or question titles for
+ questions created using the \verb"\titledquestion" command instead
+ of the \verb"\question" command; see section~\ref{sec:Titled}) and
+ the total points possible for each question (including all of its
+ parts, subparts, and subsubparts) and leaving space for you to fill
+ in (by hand) the points earned on each question, or
\item a table listing each page that has at least one question, part,
subpart, or subsubpart with points assigned to it, the total number
of points possible on that page, and leaving space for you to fill
in (by hand) the points earned on that page.
\end{itemize}
-In order to use this feature you must give the command
-\verb"\addpoints" (see section~\ref{sec:Count}), and there must be
+In order to use this feature you must either include the optional
+argument \verb"addpoints" in your \verb"\documentclass" command (as in
+\verb"\documentclass[addpoints]{exam}") or give the command
+\verb"\addpoints" (see section~\ref{sec:addpoints}), and there must be
only one \verb"questions" environment in the entire exam. In
-addition, you must run \LaTeX{} \emph{twice} after making any changes
-to the file in order to make sure that the point values are correct on
-a grading table indexed by question number, and \emph{at least three
- times} for a grading table indexed by page number. (Since the table
-appears on the third run of \LaTeX{}, and the space it occupies can
-change the page on which each question falls, it may take a fourth run
-of \LaTeX{} for the table to have the points per page correct.)
-
-\medbreak
+addition, you must run \LaTeX{} twice after making any changes to the
+file in order to make sure that the point values are correct on a
+grading table indexed by question number and at least three times for
+a grading table indexed by page number. (Since the table appears on
+the third run of \LaTeX{}, and the space it occupies can change the
+page on which each question falls, it may take a fourth run of
+\LaTeX{} for the table to have the points per page correct.)
The command to create a grading table is
\begin{center}
- \verb"\gradetable",
+ \verb"\gradetable"
\end{center}
and it takes two optional arguments:
\begin{enumerate}
-\item The first optional argument should be either \verb"[v]" or
- \verb"[h]", to choose between a vertically oriented table or a
+\item The first optional argument can be either \verb"[v]" or
+ \verb"[h]", to choose between a vertically oriented table and a
horizontally oriented table, and
-\item the second optional argument should be either \verb"[questions]"
- or \verb"[pages]", to choose between a table indexed by question
- number or a table indexed by page number.
+\item the second optional argument can be either \verb"[questions]" or
+ \verb"[pages]", to choose between a table indexed by question number
+ and a table indexed by page number.
\end{enumerate}
-Thus,
+That is,
\begin{itemize}
\item \verb"\gradetable[v][questions]" prints a vertically oriented
table indexed by question number,
@@ -2748,8 +3654,8 @@ Thus,
table indexed by page number.
\end{itemize}
If you leave out the optional arguments (i.e., if you give the command
-\verb"\gradetable") you'll get a vertically oriented table indexed by
-question number.
+as ``\verb"\gradetable"'') you'll get a vertically oriented table
+indexed by question number.
For example, if the exam has 8 questions, each worth a total of 15
points, and you type
@@ -2887,56 +3793,492 @@ then you'll get
\end{tabular}
\end{center}
-\medskip
-
-\noindent \emph{Warning:} If you have a large number of questions on
+\emph{Warning:} If you have a large number of questions on
the exam, then these tables can easily become too large to fit on the
-page! If this becomes a problem, then you can use the
+page. If this becomes a problem, then you can use the
\verb"\pointsofquestion" command (see section~\ref{sec:pointsofq}) or
the \verb"\pointsonpage" command (see section~\ref{sec:pointsonp}) to
create a custom \verb"tabular" environment that has more rows (or
columns) than the tables produced by the \verb"gradingtable" command.
%--------------------------------------------------------------------
-\subsection{Customizing the table}
+\subsection{Point tables indexed by question number or by page
+ number}
+\label{sec:PointTables}
+
+Point tables are similar to grading tables (see
+section~\ref{sec:GradeTables}), except that there is no place in the
+table to fill in the points earned.
+
+The command to create a point table is
+\begin{center}
+ \verb"\pointtable"
+\end{center}
+and it takes two optional arguments:
+\begin{enumerate}
+\item The first optional argument can be either \verb"[v]" or
+ \verb"[h]", to choose between a vertically oriented table and a
+ horizontally oriented table, and
+\item the second optional argument can be either \verb"[questions]" or
+ \verb"[pages]", to choose between a table indexed by question number
+ and a table indexed by page number.
+\end{enumerate}
+That is,
+\begin{itemize}
+\item \verb"\pointtable[v][questions]" prints a vertically oriented
+ table indexed by question number,
+\item \verb"\pointtable[h][questions]" prints a horizontally oriented
+ table indexed by question number,
+\item \verb"\pointtable[v][pages]" prints a vertically oriented table
+ indexed by page number, and
+\item \verb"\pointtable[h][pages]" prints a horizontally oriented
+ table indexed by page number.
+\end{itemize}
+If you leave out the optional arguments (i.e., if you give the command
+as ``\verb"\pointtable"'') you'll get a vertically oriented table
+indexed by question number.
+
+For example, if the exam has 8 questions, each worth a total of 15
+points, and you type
+\begin{verbatim}
+\begin{center}
+ \pointtable[v][questions]
+\end{center}
+\end{verbatim}
+then you'll get
+\begin{center}
+ \cwidth=2em
+ \renewcommand\arraystretch{1.5}
+ \begin{tabular}{|c|c|}
+ \hline
+ Question& Points\\
+ \hline
+ 1& 15\\
+ \hline
+ 2& 15\\
+ \hline
+ 3& 15\\
+ \hline
+ 4& 15\\
+ \hline
+ 5& 15\\
+ \hline
+ 6& 15\\
+ \hline
+ 7& 15\\
+ \hline
+ 8& 15\\
+ \hline
+ Total:& 120\\
+ \hline
+ \end{tabular}
+\end{center}
+and if you type
+\begin{verbatim}
+\begin{center}
+ \pointtable[h][questions]
+\end{center}
+\end{verbatim}
+then you'll get
+\begin{center}
+ \cwidth=2em
+ \renewcommand\arraystretch{1.5}
+ \begin{tabular}{|l|c|c|c|c|c|c|c|c|c|}
+ \hline
+ Question:& 1& 2& 3& 4& 5& 6& 7& 8& Total\\
+ \hline
+ Points:&
+ 15&
+ 15&
+ 15&
+ 15&
+ 15&
+ 15&
+ 15&
+ 15&
+ 120\\
+ \hline
+ \end{tabular}
+\end{center}
+The number of points listed for a question is the sum of the point
+values for that question and all of its parts, subparts, and
+subsubparts.
+
+If those 8 questions are distributed two to a page on each of pages 2
+through 5 and if you type
+\begin{verbatim}
+\begin{center}
+ \pointtable[v][pages]
+\end{center}
+\end{verbatim}
+then you'll get
+\begin{center}
+ \cwidth=2em
+ \renewcommand\arraystretch{1.5}
+ \begin{tabular}{|c|c|}
+ \hline
+ Page& Points\\
+ \hline
+ 2& 30\\
+ \hline
+ 3& 30\\
+ \hline
+ 4& 30\\
+ \hline
+ 5& 30\\
+ \hline
+ Total:& 120\\
+ \hline
+ \end{tabular}
+\end{center}
+and if you type
+\begin{verbatim}
+\begin{center}
+ \pointtable[h][pages]
+\end{center}
+\end{verbatim}
+then you'll get
+\begin{center}
+ \cwidth=2em
+ \renewcommand\arraystretch{1.5}
+ \begin{tabular}{|l|c|c|c|c|c|}
+ \hline
+ Page:& 2& 3& 4& 5& Total\\
+ \hline
+ Points:&
+ 30&
+ 30&
+ 30&
+ 30&
+ 120\\
+ \hline
+ \end{tabular}
+\end{center}
+
+\emph{Warning:} If you have a large number of questions on
+the exam, then these tables can easily become too large to fit on the
+page. If this becomes a problem, then you can use the
+\verb"\pointsofquestion" command (see section~\ref{sec:pointsofq}) or
+the \verb"\pointsonpage" command (see section~\ref{sec:pointsonp}) to
+create a custom \verb"tabular" environment that has more rows (or
+columns) than the tables produced by the \verb"pointtable" command.
+
+%--------------------------------------------------------------------
+\subsection{Table entries as clickable links}
+\label{sec:Clickable}
+
+If you put the command
+\begin{center}
+ \verb"\usepackage{hyperref}"
+\end{center}
+into the preamble of your document (i.e., after the
+\verb"\documentclass" command and before the \verb"\begin{document}"
+command) and then produce a pdf file (either using dvipdf or
+directly by using pdflatex), then
+\begin{itemize}
+\item in a grading table or point table indexed by question number the
+ question numbers in the table will be clickable links that take you
+ to the corresponding question, and
+\item in a grading table or point table indexed by page number the
+ page numbers in the table will be clickable links that take you to
+ the corresponding page.
+\end{itemize}
+If you create questions using the \verb"\titledquestion" command
+instead of the \verb"\question" command (see
+section~\ref{sec:Titled}), then a grading table or point table indexed
+by question number will show the \emph{titles} of those questions
+instead of the numbers of those questions, and those question titles
+will be clickable links that take you to the corresponding question.
+
+%--------------------------------------------------------------------
+\subsection{Partial grading tables and partial point tables}
+\label{sec:PartialTable}
+
+The \verb"\partialgradetable" and \verb"\partialpointtable" commands
+make it possible to create grading tables and point tables that cover
+only part of the exam. These commands take one required argument, the
+name of a grading range defined using the \verb"\begingradingrange"
+and \verb"\endgradingrange" commands, plus the same two optional
+arguments used in the \verb"\gradetable" and \verb"\pointtable"
+commands.
+
+In more detail: You define a grading range by choosing a name with
+which to label the range, e.g., ``myrange'', and then put the command
+\begin{center}
+ \verb"\begingradingrange{myrange}"
+\end{center}
+at the start of the range and the command
+\begin{center}
+ \verb"\endgradingrange{myrange}"
+\end{center}
+at the end of the range. To create the table, you say, e.g.,
+\begin{center}
+ \verb"\partialgradetable{myrange}[v][questions]"
+\end{center}
+to create a vertically oriented table indexed by those questions that
+follow the command
+\begin{center}
+ \verb"\begingradingrange{myrange}"
+\end{center}
+and precede the command
+\begin{center}
+ \verb"\endgradingrange{myrange}"
+\end{center}
+If you say
+\begin{center}
+ \verb"\partialgradetable{myrange}[v][pages]"
+\end{center}
+then you'll get a vertically oriented table indexed by all pages with
+points starting with the page containing the command
+\begin{center}
+ \verb"\begingradingrange{myrange}"
+\end{center}
+and ending with the page containing the command
+\begin{center}
+ \verb"\endgradingrange{myrange}"
+\end{center}
+The \verb"\partialpointtable" command is similar to the
+\verb"\partialgradetable" command.
+
+%--------------------------------------------------------------------
+\subsection{\texttt{\char`\\pointsofquestion}}
+\label{sec:pointsofq}
+
+If you use the document class option \verb"addpoints" (as in
+\verb"\documentclass[addpoints]{exam}") or give the command
+\verb"\addpoints" (see section~\ref{sec:addpoints}), then you can use
+the
+\begin{center}
+ \verb"\pointsofquestion"
+\end{center}
+command. This command takes one argument, which must be the number of
+a question on the exam, and it prints the total number of points for
+that question. That is:
+\begin{itemize}
+\item \verb"\pointsofquestion{1}" prints the sum of the point values
+ for question 1 and all of its parts, subparts, and subsubparts.
+\item \verb"\pointsofquestion{2}" prints the sum of the point values
+ for question 2 and all of its parts, subparts, and subsubparts.
+\item Etc.
+\end{itemize}
+The \verb"\pointsofquestion" command is used by the \verb"\gradetable"
+and \verb"\pointtable" commands (see section~\ref{sec:Tables}),
+and it can be used to create a table using \LaTeX's \verb"tabular"
+environment when the tables produced using the \verb"\gradetable" and
+\verb"\pointtable" commands either don't fit on the page or are
+unsuitable for some other reason. It can also be used in a
+\verb"\qformat" command to list the total number of points of all
+parts, subparts, and subsubparts of a question on the line with the
+question number (see section~\ref{sec:adding}).
+
+The \verb"\pointsofquestion" command ignores any bonus points that you
+may have created (see section~\ref{sec:Bonus}). The
+\verb"\bonuspointsofquestion" command, however, counts the bonus
+points (see section~\ref{sec:BonusTables}).
+
+%--------------------------------------------------------------------
+
+\subsection{\texttt{\char`\\pointsonpage}}
+\label{sec:pointsonp}
+
+If you use the document class option \verb"addpoints" (as in
+\verb"\documentclass[addpoints]{exam}") or give the command
+\verb"\addpoints" (see section~\ref{sec:addpoints}), then you can use
+the \verb"\pointsonpage" command. This command takes one argument,
+which must be the number of a page of the exam, and it prints the
+total number of points for all the questions, parts, subparts, and
+subsubparts on that page. That is:
+\begin{itemize}
+\item \verb"\pointsonpage{1}" prints the sum of the point values for
+ all questions, etc., on page 1,
+\item \verb"\pointsonpage{2}" prints the sum of the point values for
+ all questions, etc., on page 2,
+\item Etc.
+\end{itemize}
+This command can be used to create a table using \LaTeX's
+\verb"tabular" environment when the tables produced using the
+\verb"\gradetable" and \verb"\pointtable" commands either don't fit on
+the page or are unsuitable for some other reason. It can also be used
+in headers and footers to print on each page the total number of
+points available on that page; for example, the command
+\begin{verbatim}
+ \runningfooter{}
+ {}
+ {Points earned: \makebox[1in]{\hrulefill}
+ out of a possible \pointsonpage{\thepage} points}
+\end{verbatim}
+(see section~\ref{sec:runningfooter}) will produce the footer
+\samplefoot{}{}{}{Points earned: \makebox[1in]{\hrulefill} out of a
+ possible 20 points} on all pages after the first. (For another
+example, see section~\ref{sec:PtsPgEx})
+
+\textbf{Caution:} The command \verb"\pointsonpage{\thepage}" will work
+reliably only in headers and footers, since the command
+\verb"\thepage" will work reliably only in headers and footers.
+
+The \verb"\pointsonpage" command ignores any bonus points that you may
+have created (see section~\ref{sec:Bonus}). The
+\verb"\bonuspointsonpage" command, however, counts the bonus points
+(see section~\ref{sec:BonusTables}).
+
+%--------------------------------------------------------------------
+\subsection{Bonus grading tables and bonus point tables}
+\label{sec:BonusTables}
+
+If your exam contains any bonus points (see section~\ref{sec:Bonus}),
+then those bonus points will be ignored by the grading table and point
+table commands described in sections \ref{sec:GradeTables},
+\ref{sec:PointTables}, and~\ref{sec:PartialTable} and by the
+\verb"\pointsofquestion" (see section~\ref{sec:pointsofq}) and
+\verb"\pointsonpage" (see section~\ref{sec:pointsonp}) commands.
+There are, however, analogous commands that count only the bonus
+points and ignore the non-bonus points. These commands, and the
+non-bonus commands to which they correspond, are as follows:
+\begin{center}
+ \begin{tabular}{l@{\qquad\qquad}l}
+ Bonus points& Non-bonus points\\[\medskipamount]
+ \verb"\bonusgradetable"& \verb"\gradetable"\\
+ \verb"\bonuspointtable"& \verb"\pointtable"\\
+ \verb"\bonuspartialgradetable"& \verb"\partialgradetable"\\
+ \verb"\bonuspartialpointtable"& \verb"\partialpointtable"\\[\medskipamount]
+ \verb"\bonuspointsofquestion"& \verb"\pointsofquestion"\\
+ \verb"\bonuspointsonpage"& \verb"\pointsonpage"
+ \end{tabular}
+\end{center}
+All of the the commands in the first column count bonus points and
+ignore non-bonus points, while all of the commands in the second
+column count non-bonus points and ignore bonus points. The
+\verb"\bonuspartialgradetable" and \verb"\bonuspartialpointtable"
+commands use the same \verb"\begingradingrange" and
+\verb"\endgradingrange" commands that are used by the corresponding
+non-bonus versions (see section~\ref{sec:PartialTable}). Just as is
+described in section~\ref{sec:Clickable} for their non-bonus
+counterparts, if you put the command
+\begin{center}
+ \verb"\usepackage{hyperref}"
+\end{center}
+into the preamble of your document (i.e., after the
+\verb"\documentclass" command and before the \verb"\begin{document}"
+command) and then produce a pdf file (either using dvipdf or
+directly by using pdflatex), then
+\begin{itemize}
+\item in a bonus grading table or bonus point table indexed by
+ question number the question numbers (or question titles, if you
+ used \verb"\bonustitledquestion"; see section~\ref{sec:Bonus}) in
+ the table will be clickable links that take you to the corresponding
+ question, and
+\item in a bonus grading table or bonus point table indexed by page
+ number the page numbers in the table will be clickable links that
+ take you to the corresponding page.
+\end{itemize}
+
+For example, if the exam has 8 questions, each worth a total of 5
+bonus points, and you type
+\begin{verbatim}
+\begin{center}
+ \bonusgradetable[h][questions]
+\end{center}
+\end{verbatim}
+then you'll get
+\begin{center}
+ \cwidth=2em
+ \renewcommand\arraystretch{1.5}
+ \begin{tabular}{|l|c|c|c|c|c|c|c|c|c|}
+ \hline
+ Question:& 1& 2& 3& 4& 5& 6& 7& 8& Total\\
+ \hline
+ Bonus Points:&
+ 5&
+ 5&
+ 5&
+ 5&
+ 5&
+ 5&
+ 5&
+ 5&
+ 40\\
+ \hline
+ Score:&
+ \hbox to \cwidth{\hfill}&
+ \hbox to \cwidth{\hfill}&
+ \hbox to \cwidth{\hfill}&
+ \hbox to \cwidth{\hfill}&
+ \hbox to \cwidth{\hfill}&
+ \hbox to \cwidth{\hfill}&
+ \hbox to \cwidth{\hfill}&
+ \hbox to \cwidth{\hfill}&\\
+ \hline
+ \end{tabular}
+\end{center}
+
+
+
+%--------------------------------------------------------------------
+\subsection{Customizing the tables}
\label{sec:CustTable}
There are three ways in which you can customize the default appearance
-of the grading tables:
+of grading tables and point tables:
\begin{itemize}
\item You can change the words (and the fonts) that appear in the
table.
-\item You can change the width of the cells that are left blank for
- you to write in the scores.
+\item You can change the minimum width of the blank cells into which
+ you will write the scores.
\item You can change the value of \verb"\baselinestretch" used for the
table.
\end{itemize}
-For vertical grading tables:
-\begin{center}
-\begin{tabular}{l@{\qquad}l}
-Command& Effect\\
-\verb"\vqword{text}"& substitutes \verb"text" for ``Question''\\
-\verb"\vpgword{text}"& substitutes \verb"text" for ``Page''\\
-\verb"\vpword{text}"& substitutes \verb"text" for ``Points''\\
-\verb"\vsword{text}"& substitutes \verb"text" for ``Score''\\
-\verb"\vtword{text}"& substitutes \verb"text" for ``Total:''
-\end{tabular}
+For vertical non-bonus tables (i.e., tables created by
+\verb"\gradetable[v]" or \verb"\pointtable[v]"):
+\begin{center}
+ \begin{tabular}{l@{\qquad}l}
+ Command& Effect\\
+ \verb"\vqword{text}"& substitutes \verb"text" for ``Question''\\
+ \verb"\vpgword{text}"& substitutes \verb"text" for ``Page''\\
+ \verb"\vpword{text}"& substitutes \verb"text" for ``Points''\\
+ \verb"\vsword{text}"& substitutes \verb"text" for ``Score''\\
+ \verb"\vtword{text}"& substitutes \verb"text" for ``Total:''
+ \end{tabular}
\end{center}
-For horizontal grading tables:
+For horizontal non-bonus tables (i.e., tables created by
+\verb"\gradetable[h]" or \verb"\pointtable[h]"):
\begin{center}
-\begin{tabular}{l@{\qquad}l}
-Command& Effect\\
-\verb"\hqword{text}"& substitutes \verb"text" for ``Question:''\\
-\verb"\hpgword{text}"& substitutes \verb"text" for ``Page:''\\
-\verb"\hpword{text}"& substitutes \verb"text" for ``Points:''\\
-\verb"\hsword{text}"& substitutes \verb"text" for ``Score:''\\
-\verb"\htword{text}"& substitutes \verb"text" for ``Total''
-\end{tabular}
+ \begin{tabular}{l@{\qquad}l}
+ Command& Effect\\
+ \verb"\hqword{text}"& substitutes \verb"text" for ``Question:''\\
+ \verb"\hpgword{text}"& substitutes \verb"text" for ``Page:''\\
+ \verb"\hpword{text}"& substitutes \verb"text" for ``Points:''\\
+ \verb"\hsword{text}"& substitutes \verb"text" for ``Score:''\\
+ \verb"\htword{text}"& substitutes \verb"text" for ``Total''
+ \end{tabular}
+\end{center}
+For vertical bonus tables (i.e., tables created by
+\verb"\bonusgradetable[v]" or \verb"\bonuspointtable[v]"):
+\begin{center}
+ \begin{tabular}{l@{\qquad}l}
+ Command& Effect\\
+ \verb"\bvqword{text}"& substitutes \verb"text" for ``Question''\\
+ \verb"\bvpgword{text}"& substitutes \verb"text" for ``Page''\\
+ \verb"\bvpword{text}"& substitutes \verb"text" for ``Bonus Points''\\
+ \verb"\bvsword{text}"& substitutes \verb"text" for ``Score''\\
+ \verb"\bvtword{text}"& substitutes \verb"text" for ``Total:''
+ \end{tabular}
+\end{center}
+For horizontal bonus tables (i.e., tables created by
+\verb"\bonusgradetable[h]" or \verb"\bonuspointtable[h]"):
+\begin{center}
+ \begin{tabular}{l@{\qquad}l}
+ Command& Effect\\
+ \verb"\bhqword{text}"& substitutes \verb"text" for ``Question:''\\
+ \verb"\bhpgword{text}"& substitutes \verb"text" for ``Page:''\\
+ \verb"\bhpword{text}"& substitutes \verb"text" for ``Bonus Points:''\\
+ \verb"\bhsword{text}"& substitutes \verb"text" for ``Score:''\\
+ \verb"\bhtword{text}"& substitutes \verb"text" for ``Total''
+ \end{tabular}
\end{center}
-For both vertical and horizontal grading tables:
+For all tables:
\begin{center}
\begin{tabular}{l@{\qquad}l}
- \verb"\cellwidth{length}"& changes the width of the blank cells to
+ \verb"\cellwidth{length}"& changes the minimum width of the blank cells to
\verb"length"\\
\verb"\gradetablestretch{number}"& uses \verb"number" as the
\verb"\baselinestretch"
@@ -2952,7 +4294,12 @@ values, which are defined by the commands
\verb"\gradetablestretch{1.5}"\\
\verb"\hpword{Points:}"& \verb"\vpword{Points}"\\
\verb"\hsword{Score:}"& \verb"\vsword{Score}"\\
- \verb"\htword{Total}"& \verb"\vtword{Total:}"
+ \verb"\htword{Total}"& \verb"\vtword{Total:}"\\[\medskipamount]
+ \verb"\bhqword{Question:}"& \verb"\bvqword{Question}"\\
+ \verb"\bhpgword{Page:}"& \verb"\bvpgword{Page}"\\
+ \verb"\bhpword{Bonus Points:}"& \verb"\bvpword{Bonus Points}"\\
+ \verb"\bhsword{Score:}"& \verb"\bvsword{Score}"\\
+ \verb"\bhtword{Total}"& \verb"\bvtword{Total:}"
\end{tabular}
\end{center}
@@ -2965,7 +4312,7 @@ For example, if you type
\htword{\textbf{Summe}}
\hsword{Davon erreicht:}
\cellwidth{2.2em}
- \gradetable[h]
+ \gradetable[h][questions]
\end{center}
\end{verbatim}
then you'll get
@@ -3002,96 +4349,22 @@ then you'll get
\end{center}
-
%--------------------------------------------------------------------
-\subsection{\texttt{pointsofquestion}}
-\label{sec:pointsofq}
-
-If you give the command \verb"\addpoints" (see
-section~\ref{sec:Count}), then you can use the
-\begin{center}
- \verb"\pointsofquestion"
-\end{center}
-command. This command takes one argument, which must be the number of
-a question on the exam, and it prints the total number of points for
-that question. That is:
-\begin{quote}
- \verb"\pointsofquestion{1}" prints the sum of the point values for
- question 1 and all of its parts, subparts, and subsubparts.
-
- \verb"\pointsofquestion{2}" prints the sum of the point values for
- question 2 and all of its parts, subparts, and subsubparts.
-
- Etc.
-\end{quote}
-The \verb"\pointsofquestion" command is used by the \verb"\gradetable"
-command (see section~\ref{sec:Gradetable}), and it can be used to
-create a grading table using \LaTeX's \verb"tabular" environment when
-the tables produced using the \verb"\gradetable" command either don't
-fit on the page or are unsuitable for some other reason. It can also
-be used in a \verb"\qformat" command to list the total number of
-points of all parts, subparts, and subsubparts of a question on the
-line with the question number (see section~\ref{sec:adding}).
-
-
%--------------------------------------------------------------------
-
-\subsection{\texttt{pointsonpage}}
-\label{sec:pointsonp}
-
-If you give the command \verb"\addpoints" (see
-section~\ref{sec:Count}), then you can use the \verb"\pointsonpage"
-command. This command takes one argument, which must be the number of
-a page of the exam, and it prints the total number of points for all
-the questions, parts, subparts, and subsubparts on that page. That
-is:
-\begin{quote}
- \verb"\pointsonpage{1}" prints the sum of the point values for
- all questions, etc., on page 1,
-
- \verb"\pointsonpage{2}" prints the sum of the point values for
- all questions, etc., on page 2,
-
- Etc.
-\end{quote}
-This command can be used, e.g., inside of a \verb"tabular" environment
-to print a custom grading table (if the grading tables that can be
-printed using the \verb"\gradetable" command (see
-section~ref{sec:Gradetable}) are somehow unsuitable). It can also be
-used in headers and footers to print on each page the total number of
-points available on that page; for example, the command
-\begin{verbatim}
- \runningfooter{}
- {}
- {Points earned: \hbox to 1in{\hrulefill}
- out of a possible \pointsonpage{\thepage} points}
-\end{verbatim}
-(see section~\ref{sec:runningfooter}) will produce the footer
-\samplefoot{}{}{}{Points earned: \hbox to 1in{\hrulefill} out of a
- possible 20 points} on all pages after the first. (For another
-example, see section~\ref{sec:PtsPgEx})
-
-\textbf{Caution:} The command \verb"\pointsonpage{\thepage}" will only
-work reliably in headers and footers, since \verb"\thepage" will only
-work reliably in headers and footers.
-
-
-%--------------------------------------------------------------------
-%\section{Changing the page size}
\section{Changing the page margins}
\label{sec:pagesize}
-The exam documentclass arranges things so that you get one inch
+The exam document class arranges things so that you get one inch
margins at the top, bottom, and sides no matter what size paper you
-use, as long as you use the corresponding documentclass option
+use, as long as you use the corresponding document class option
(\verb"a4paper", \verb"a5paper", \verb"b5paper", \verb"letterpaper",
-\verb"legalpaper", \verb"executivepaper", or \verb"landscape"). If
-you want to change the size of these margins, commands are provided to
+\verb"legalpaper", \verb"executivepaper", or \verb"landscape"). You
+can change the sizes of these margins by using the commands that
change the size of the printed area.
To change the width of the printed area, you would use the
\verb"\extrawidth" command. The \verb"\extrawidth" command takes one
-argument and enlarges the width of the printed area by the amount of
+argument, and enlarges the width of the printed area by the amount of
the argument. It keeps the printed area centered as it changes its
width. If the argument is negative, then the width of the printed
area is decreased.
@@ -3120,8 +4393,8 @@ description of these commands, see section~\ref{sec:extra-room}.
To move the top of the printed region (and any header that's present)
downwards, you use the command \verb"\extraheadheight". This command
-takes one argument and moves the top of the text and the header down
-by this amount (keeping the distance between header and text
+takes one argument, and moves the top of the text and the header down
+by this amount (keeping the distance between the header and the text
constant). Thus, to increase the top margin by three quarters of an
inch, you would give the command
\begin{center}
@@ -3141,9 +4414,9 @@ section~\ref{sec:extra-room}.
To move the bottom of the printed region (and any footer that's
present) upwards, you use the command \verb"\extrafootheight". This
command takes one argument, and moves the bottom of the text and the
-footer up by this amount (keeping the distance between footer and text
-constant). Thus, to increase the bottom margin by three quarters of an
-inch, you would give the command
+footer up by this amount (keeping the distance between the footer and
+the text constant). Thus, to increase the bottom margin by three
+quarters of an inch, you would give the command
\begin{center}
\verb"\extrafootheight{.75in}"
\end{center}
@@ -3171,20 +4444,18 @@ sections~\ref{sec:beginexamples} through~\ref{sec:endexamples} (on
pages~\pageref{sec:beginexamples} through~\pageref{sec:endexamples}).
You can then refer back to the technical sections for the full story
on whatever isn't clear from the examples. All of the commands
-described in this section should be given after the
-\verb"\documentclass" command and before the \verb"\begin{document}"
-command.
+described in this section should be given in the preamble, i.e., after
+the \verb"\documentclass" command and before the
+\verb"\begin{document}" command.
It's also important to remember that if you use a \verb"coverpages"
environment (described in section~\ref{sec:coverpages}), then the
commands described here affect only the pages in the main section of
the exam, and not the pages of the \verb"coverpages" environment.
-There are commands for headers and footers in cover pages that are
+There are commands for headers and footers in the cover pages that are
analogous to the commands described in this section; for that, see
section~\ref{sec:Coverhdft}.
-
-
%---------------------------------------------------------------------
\subsection{Page styles: Headers and/or footers}
@@ -3194,47 +4465,36 @@ header and footer are specified using the commands described in
sections~\ref{sec:header} through~\ref{sec:rules}, but it's the
\verb"\pagestyle" command that determines whether the header and
footer that you construct will actually be placed onto the page. The
-\verb"\pagestyle" command should be given after the
-\verb"\documentclass" command and before the \verb"\begin{document}"
- command.
+\verb"\pagestyle" command should be given in the preamble, i.e., after
+the \verb"\documentclass" command and before the
+\verb"\begin{document}" command.
To have both a header and a footer, give the command
-%
\begin{center}
-\verb"\pagestyle{headandfoot}"
+ \verb"\pagestyle{headandfoot}"
\end{center}
-%
If you want every page to have a header but no footer, give the
command
-%
+
\begin{center}
-\verb"\pagestyle{head}"
+ \verb"\pagestyle{head}"
\end{center}
-%
-To give every page a foot but no head, give the command
-%
+To give every page a footer but no header, give the command
\begin{center}
-\verb"\pagestyle{foot}"
+ \verb"\pagestyle{foot}"
\end{center}
-%
Finally, to omit both the header and the footer from the page, give
the command
-%
\begin{center}
-\verb"\pagestyle{empty}"
+ \verb"\pagestyle{empty}"
\end{center}
-\bigskip
-
-
-As is true in all \LaTeX{} document classes, you can change the page
+As is true for all \LaTeX{} document classes, you can change the page
style used on a single page by giving the command
-%
\begin{center}
-\verb"\thispagestyle{somestyle}"
+ \verb"\thispagestyle{somestyle}"
\end{center}
-%
somewhere on that page (where \verb"somestyle" is the style that you
want to use on that page). This is most often needed if you use the
\verb"\maketitle" command, since that command inserts a
@@ -3244,24 +4504,22 @@ use \verb"\pagestyle{headandfoot}", then you'll need to put the
command \verb"\thispagestyle{headandfoot}" immediately after the
\verb"\maketitle" command to override the \verb"\thispagestyle{plain}"
that is inserted by \verb"\maketitle".
-
+
+The default page style is \verb"headandfoot". That is, if you don't
+give any \verb"\pagestyle" commands, then the header and footer will
+appear on every page. The default header is empty, and the default
+footer consists of ``Page $n$'' centered in the footer (where $n$ is
+the page number).
%---------------------------------------------------------------------
\subsection{The three parts of the header}
\label{sec:header}
The header is specified in three parts:
-%
\begin{itemize}
-\item
-One part to be left justified.
-
-\item
-One part to be centered.
-
-\item
-One part to be right justified.
+\item One part to be left justified.
+\item One part to be centered.
+\item One part to be right justified.
\end{itemize}
-%
There are two different ways in which you can specify the three parts
of the header. The first uses the single command \verb"\header" to
specify all three parts of the header, or the commands
@@ -3271,19 +4529,16 @@ section~\ref{sec:runningheader}). The second uses the commands
\verb"\lhead", \verb"\chead", and \verb"\rhead", each of which takes
an optional argument to specify a different header for the first page
(see section~\ref{sec:lhead}). All of these commands should be given
-after the \verb"\documentclass" command and before the
-\verb"\begin{document}" command.
-
-
+in the preamble, i.e., after the \verb"\documentclass" command and
+before the \verb"\begin{document}" command.
%--------------------------------------------------------------------
-\subsubsection{Using \texttt{header}, \texttt{firstpageheader} and
- \texttt{runningheader}}
+\subsubsection{Using \texttt{\char`\\header},
+ \texttt{\char`\\firstpageheader} and \texttt{\char`\\runningheader}}
\label{sec:runningheader}
-
The command \verb"\header{Text 1}{Text 2}{Text 3}" puts ``Text~1''
-into the left justified header, ``Text~2'' into the centered header
+into the left justified header, ``Text~2'' into the centered header,
and ``Text~3'' into the right justified header on every page. If you
want the header on the first page to be different from that on the
other pages, then you should use the commands \verb"\firstpageheader"
@@ -3294,54 +4549,49 @@ either the first page or all pages except the first.
For example, to put the header
\samplehead{Math 115}{Second Exam}{July 4, 1776}{}
on every page of the exam, you would give the command
-%
\begin{verbatim}
\header{Math 115}{Second Exam}{July 4, 1776}
\end{verbatim}
-If you want to have different header on the first page from the header
-on all other pages, you would use the commands \verb"\firstpageheader"
-and \verb"\runningheader" instead of \verb"\header".
-For example, if you want the above header for the first
-page, but on all pages after the first you want to have the header
-\samplehead{Math 115}{Second Exam (Continued)}{July 4, 1776}{}
+If you want to use a header on the first page that's different from
+the header used on all other pages, you would use the commands
+\verb"\firstpageheader" and \verb"\runningheader" instead of
+\verb"\header". For example, if you want the above header for the
+first page, but on all pages after the first you want to have the
+header \samplehead{Math 115}{Second Exam (Continued)}{July 4, 1776}{}
then you would give the commands
-%
\begin{verbatim}
\firstpageheader{Math 115}{Second Exam}{July 4, 1776}
\runningheader{Math 115}{Second Exam (Continued)}{July 4, 1776}
\end{verbatim}
-
You can leave one or more of the three parts empty. To have the
header
\samplehead{Math 115}{Second Exam}{July 4, 1776}{}
on the first page, with the header
\samplehead{Math 115}{}{Second Exam (Continued)}{}
on all other pages, you would give the commands
-%
\begin{verbatim}
\firstpageheader{Math 115}{Second Exam}{July 4, 1776}
\runningheader{Math 115}{}{Second Exam (Continued)}
\end{verbatim}
-%
Any of the three parts of the header can have multiple lines. To
specify where the line breaks should go, you just type \verb"\\".
Thus, to have the header
-\samplehead{\bf\large Math 115\\Professor Hilbert}{}
- {\bf\large First Exam\\July 4, 1776}{}
+\samplehead{\bfseries\large Math 115\\Professor Hilbert}{}
+ {\bfseries\large First Exam\\July 4, 1776}{}
appear on every page, you would give the command
-%
\begin{verbatim}
-\header{\bf\large Math 115\\Professor Hilbert}%
- {}%
- {\bf\large First Exam\\July 4, 1776}
+\header{\bfseries\large Math 115\\Professor Hilbert}
+ {}
+ {\bfseries\large First Exam\\July 4, 1776}
\end{verbatim}
%--------------------------------------------------------------------
-\subsubsection{Using \texttt{lhead}, \texttt{chead} and \texttt{rhead}}
+\subsubsection{Using \texttt{\char`\\lhead}, \texttt{\char`\\chead}
+ and \texttt{\char`\\rhead}}
\label{sec:lhead}
The command \verb"\lhead{Text}" puts ``Text'' into the left justified
@@ -3356,7 +4606,6 @@ header.
For example, to put the header
\samplehead{Math 115}{Second Exam}{July 4, 1776}{}
on every page of the exam, you would give the commands
-%
\begin{verbatim}
\lhead{Math 115}
\chead{Second Exam}
@@ -3370,7 +4619,6 @@ command. For example, if you want the above header for the first
page, but on all pages after the first you want to have the header
\samplehead{Math 115}{Second Exam (Continued)}{July 4, 1776}{}
then you would give the commands
-%
\begin{verbatim}
\lhead{Math 115}
\chead[Second Exam]{Second Exam (Continued)}
@@ -3384,26 +4632,22 @@ header
on the first page, with the header
\samplehead{Math 115}{}{Second Exam (Continued)}{}
on all other pages, you would give the commands
-%
\begin{verbatim}
-\pagestyle{headandfoot}
\lhead{Math 115}
\chead[Second Exam]{}
\rhead[July 4, 1776]{Second Exam Continued)}
\end{verbatim}
-%
Any of the three parts of the header can have multiple lines. To
specify where the line breaks should go, you just type \verb"\\".
Thus, to have the header
-\samplehead{\bf\large Math 115\\Professor Hilbert}{}
- {\bf\large First Exam\\July 4, 1776}{}
+\samplehead{\bfseries\large Math 115\\Professor Hilbert}{}
+ {\bfseries\large First Exam\\July 4, 1776}{}
appear on every page, you would give the commands
-%
\begin{verbatim}
-\lhead{\bf\large Math 115\\Professor Hilbert}
+\lhead{\bfseries\large Math 115\\Professor Hilbert}
\chead{}
-\rhead{\bf\large First Exam\\July 4, 1776}
+\rhead{\bfseries\large First Exam\\July 4, 1776}
\end{verbatim}
@@ -3413,9 +4657,7 @@ appear on every page, you would give the commands
See section~\ref{sec:extra-room} for a description of the
\verb"\extraheadheight" command.
-
%---------------------------------------------------------------------
-
\subsection{The three parts of the footer}
\label{sec:footer}
@@ -3429,12 +4671,12 @@ parts of the footer, or the commands \verb"\firstpagefooter" and
\verb"\lfoot", \verb"\cfoot", and \verb"\rfoot", each of which takes
an optional argument to specify a different footer for the first page
(see section~\ref{sec:lfoot}). All of these commands should be given
-after the \verb"\documentclass" command and before the
-\verb"\begin{document}" command.
+in the preamble, i.e., after the \verb"\documentclass" command and
+before the \verb"\begin{document}" command.
%--------------------------------------------------------------------
-\subsubsection{Using \texttt{footer}, \texttt{firstpagefooter}
- and \texttt{runningfooter}}
+\subsubsection{Using \texttt{\char`\\footer},
+ \texttt{\char`\\firstpagefooter} and \texttt{\char`\\runningfooter}}
\label{sec:runningfooter}
The command \verb"\footer{Text 1}{Text 2}{Text 3}" puts ``Text~1''
@@ -3445,23 +4687,19 @@ other pages, then you should use the commands \verb"\firstpagefooter"
and \verb"\runningfooter", which also take three arguments and affect
either the first page or all pages except the first.
-
For example, to have an empty footer on the first page and the footer
\samplefoot{}{}{Page 3 of 5}{}
on all pages after the first, you would give the commands
-%
\begin{verbatim}
\firstpagefooter{}{}{}
\runningfooter{}{Page \thepage\ of \numpages}{}
\end{verbatim}
-%
(For an explanation of the \verb"\numpages" command, see
section~\ref{sec:numpages}.)
-
-
%--------------------------------------------------------------------
-\subsubsection{Using \texttt{lfoot}, \texttt{cfoot} and \texttt{rfoot}}
+\subsubsection{Using \texttt{\char`\\lfoot}, \texttt{\char`\\cfoot}
+ and \texttt{\char`\\rfoot}}
\label{sec:lfoot}
The command \verb"\lfoot{Text}" puts ``Text'' into the left justified
@@ -3472,31 +4710,23 @@ on all other pages. The commands \verb"\cfoot" and \verb"\rfoot" have
similar effects on the centered and right justified parts of the
footer.
-
For example, to have an empty footer on the first page and the footer
\samplefoot{}{}{Page 3 of 5}{}
on all pages after the first, you would give the commands
-%
\begin{verbatim}
\lfoot{}
\cfoot{}
\rfoot[]{Page \thepage\ of \numpages}
\end{verbatim}
-%
(For an explanation of the \verb"\numpages" command, see
section~\ref{sec:numpages}.)
-
-
%---------------------------------------------------------------------
\subsubsection*{Leaving extra room for multiple line footers}
See section~\ref{sec:extra-room} for a description of the
\verb"\extrafootheight" command.
-
-
-
%---------------------------------------------------------------------
\subsection{Leaving extra room for multiple line headers and footers}
\label{sec:extra-room}
@@ -3510,112 +4740,88 @@ command to adjust the size of the text area. The
\verb"\extraheadheight" command never changes the distance between the
header and the text.
-For example, to move the header and the text a half inch
+For example, to move the header and the text an additional half inch
down from the top of the page, you would give the command
-%
\begin{center}
-\verb"\extraheadheight{.5in}"
+ \verb"\extraheadheight{.5in}"
\end{center}
-%
-You can also specify a negative distance to \verb"extraheadheight" to
+You can also specify a negative distance to \verb"\extraheadheight" to
move the header up closer to the top of the paper. For example, the
command
-%
\begin{center}
-\verb"\extraheadheight{-.25in}"
+ \verb"\extraheadheight{-.25in}"
\end{center}
-%
moves the header one quarter inch closer to the top of the paper.
If you want to have a different value for \verb"\extraheadheight" on
the first page from that on the pages after the first, then use the
same syntax as in the \verb"\lhead", \verb"\chead", and \verb"\rhead"
-commands: Include an optional argument giving the extra head height
-for the first page, and the required argument will apply only to
-those pages after the first. For example, the command
-%
+commands (see section~\ref{sec:lhead}): Include an optional argument
+giving the extra head height for the first page, and the required
+argument will apply only to those pages after the first. For example,
+the command
\begin{center}
-\verb"\extraheadheight[.5in]{.25in}"
+ \verb"\extraheadheight[.5in]{.25in}"
\end{center}
-%
gives a half inch of extra head height on the first page and a
quarter inch of extra head height on all pages after the first.
If you say
-%
\begin{center}
-\verb"\extraheadheight[.5in]{}"
+ \verb"\extraheadheight[.5in]{}"
\end{center}
-%
then this will be interpreted as if it was
-%
\begin{center}
-\verb"\extraheadheight[.5in]{0in}"
+ \verb"\extraheadheight[.5in]{0in}"
\end{center}
-%
Note that the braces \emph{must} appear.
+If you give an \verb"\extraheadheight" command, it should be in the
+preamble, i.e., after the \verb"\documentclass" command and before the
+\verb"\begin{document}" command. The \verb"\extraheadheight" command
+can also be used to change the size of the text region (see
+section~\ref{sec:pagesize}).
-If you give an \verb"\extraheadheight" command, it should be after the
-\verb"\documentclass" command but before the \verb"\begin{document}"
-command. The \verb"\extraheadheight" command can also be used to
-change the size of the text region (see section~\ref{sec:pagesize}).
-
-
-
-
+%--------------------------------------------------------------------
\subsubsection*{Footers}
To leave extra room for multiple line footers, you use the command
-\verb"\extrafootheight". Thus, to move the footer one half inch
-higher up on the paper, you would give the command
-%
+\verb"\extrafootheight". To move the footer one half inch higher up
+on the paper, you would give the command
\begin{center}
-\verb"\extrafootheight{.5in}"
+ \verb"\extrafootheight{.5in}"
\end{center}
-%
If you wanted to move the footer an eighth of an inch lower down on
the paper, you would give the command
-%
\begin{center}
-\verb"\extrafootheight{-.125in}"
+ \verb"\extrafootheight{-.125in}"
\end{center}
If you want to have a different value for \verb"\extrafootheight" on
the first page from that on the pages after the first, then use the
same syntax as in the \verb"\lfoot", \verb"\cfoot", and \verb"\rfoot"
-commands: Include an optional argument giving the extra foot height
-for the first page, and the required argument will apply only to
-those pages after the first. For example, the command
-%
+commands (see section~\ref{sec:lfoot}): Include an optional argument
+giving the extra foot height for the first page, and the required
+argument will apply only to those pages after the first. For example,
+the command
\begin{center}
-\verb"\extrafootheight[.5in]{.25in}"
+ \verb"\extrafootheight[.5in]{.25in}"
\end{center}
-%
gives a half inch of extra foot height on the first page and a
quarter inch of extra foot height on all pages after the first.
If you say
-%
\begin{center}
-\verb"\extrafootheight[.5in]{}"
+ \verb"\extrafootheight[.5in]{}"
\end{center}
-%
then this will be interpreted as if it was
-%
\begin{center}
-\verb"\extrafootheight[.5in]{0in}"
+ \verb"\extrafootheight[.5in]{0in}"
\end{center}
-%
Note that the braces \emph{must} appear.
-
-If you give an \verb"\extrafootheight" command, it should be after the
-\verb"\documentstyle" command but before the \verb"\begin{document}"
-command. The \verb"\extrafootheight" command can also be used to
-change the size of the text region (see section~\ref{sec:pagesize}).
-
-
-
-
-
+If you give an \verb"\extrafootheight" command, it should be in the
+preamble, i.e., after the \verb"\documentclass" command and before the
+\verb"\begin{document}" command. The \verb"\extrafootheight" command
+can also be used to change the size of the text region (see
+section~\ref{sec:pagesize}).
%---------------------------------------------------------------------
\subsection{Horizontal rules}
@@ -3627,65 +4833,53 @@ this for the pages after the first page without affecting the first
page.
\begin{itemize}
-\item
-The command \verb"\runningheadrule" puts a horizontal rule below the
-header on all pages after the first.
-
-\item
-The command
-\verb"\firstpageheadrule" puts a rule under the header of only the
-first page.
-
-\item
-The command \verb"\headrule" is equivalent to the two
-commands \verb"\firstpageheadrule" and \verb"\runningheadrule".
-
-\item
-The command \verb"\runningfootrule" puts a horizontal rule above the
-footer on all pages after the first.
-
-\item
-The command
-\verb"\firstpagefootrule" puts a rule above the footer of only the
-first page.
-
-\item
-The command \verb"\footrule" is equivalent to the two
-commands \verb"\firstpagefootrule" and \verb"\runningfootrule".
-
+\item The command \verb"\runningheadrule" puts a horizontal rule below
+ the header on all pages after the first.
+\item The command \verb"\firstpageheadrule" puts a rule under the
+ header of only the first page.
+\item The command \verb"\headrule" is equivalent to the two commands
+ \verb"\firstpageheadrule" and \verb"\runningheadrule".
+\item The command \verb"\runningfootrule" puts a horizontal rule above
+ the footer on all pages after the first.
+\item The command \verb"\firstpagefootrule" puts a rule above the
+ footer of only the first page.
+\item The command \verb"\footrule" is equivalent to the two commands
+ \verb"\firstpagefootrule" and \verb"\runningfootrule".
\end{itemize}
-%
For example, to have the header
\samplehead{Math 115}{First Exam}{July 4, 1776}{}
on the first page, with the header
\samplehead{Math 115}{First Exam}{July 4, 1776}{\hrule}
-on all pages after the first, give the commands
-%
+on all pages after the first, give either the commands
+\begin{verbatim}
+\runningheadrule
+\header{Math 115}{First Exam}{July 4, 1776}
+\end{verbatim}
+or the commands
\begin{verbatim}
\runningheadrule
\lhead{Math 115}
\chead{First Exam}
\rhead{July 4, 1776}
\end{verbatim}
-
+For a description of the command \verb"\header" see
+section~\ref{sec:runningheader}; for a description of the commands
+\verb"\lhead", \verb"\chead", and \verb"\rhead", see
+section~\ref{sec:lhead}.
\bigskip
To have no footer on the first page, and the footer
\samplefoot{\hrule}{}{Page 3 of 5}{}
-on all pages after the first, you would give the commands
-%
+on all pages after the first, give the commands
\begin{verbatim}
\runningfootrule
\lfoot{}
\cfoot[]{Page \thepage\ of \numpages}
\rfoot{}
\end{verbatim}
-
-
-
-
-
+(see section~\ref{sec:numpages} for an explanation of the command
+\verb"\numpages").
%---------------------------------------------------------------------
\subsection{Listing the number of pages in the exam}
@@ -3695,16 +4889,20 @@ The \verb"exam" document class defines the command \verb"\numpages"
so that it will expand to the number of pages in the exam. Thus, to
have the footer
\samplefoot{}{}{Page \thepage\ of \numpages}{}
-you should give the commands
-%
+you should either give the command
+\begin{verbatim}
+\footer{}{Page \thepage\ of \numpages}{}
+\end{verbatim}
+or the commands
\begin{verbatim}
\lfoot{}
\cfoot{Page \thepage\ of \numpages}
\rfoot{}
\end{verbatim}
-%
-For a description of the commands \verb"\lfoot", \verb"\cfoot", and
-\verb"\rfoot", see section~\ref{sec:footer}.
+For a description of the command \verb"\footer" see
+section~\ref{sec:runningfooter}; for a description of the commands
+\verb"\lfoot", \verb"\cfoot", and \verb"\rfoot", see
+section~\ref{sec:lfoot}.
As with all other cross referencing commands in \LaTeX, you'll have to
run the file through \LaTeX{} \emph{twice} to be sure that
@@ -3717,26 +4915,34 @@ run the file through \LaTeX{} \emph{twice} to be sure that
If you want to vary the text that appears in the header or footer on
the last page of the exam, you should use the command
\verb"\iflastpage". The command
-%
\begin{center}
-\verb"\iflastpage{Text 1}{Text 2}"
+ \verb"\iflastpage{Text 1}{Text 2}"
\end{center}
+expands to `Text~1' on the last page and to `Text~2' on all pages
+before the last. Thus, to have the footer
%
-expands to `Text~1' on the last page, and to `Text~2' on all
-pages before the last. Thus, to have the footer
\samplefoot{}{}{Please go on to the next page\ldots}{}
-on all pages before the last page, and the footer
+%
+on all pages before the last page and the footer
+%
\samplefoot{}{}{End of exam}{}
-on the last page, you would give the commands
%
+on the last page, you should give the command
+\begin{verbatim}
+\footer{}
+ {\iflastpage{End of exam}{Please go on to the next page\ldots}}
+ {}
+\end{verbatim}
+or the commands
\begin{verbatim}
\lfoot{}
\cfoot{\iflastpage{End of exam}{Please go on to the next page\ldots}}
\rfoot{}
\end{verbatim}
-%
-For a description of the commands \verb"\lfoot", \verb"\cfoot", and
-\verb"\rfoot", see section~\ref{sec:footer}.
+For a description of the command \verb"\footer" see
+section~\ref{sec:runningfooter}; for a description of the commands
+\verb"\lfoot", \verb"\cfoot", and \verb"\rfoot", see
+section~\ref{sec:lfoot}.
As with all other cross referencing commands in \LaTeX, you'll have to
run the file through \LaTeX{} \emph{twice} to be sure that
@@ -3754,20 +4960,32 @@ number is odd it expands to the first argument; otherwise, it expands
to the second argument.
For example, to have the page number printed in the right head on odd
-numbered pages and in the left head on even numbered pages, you would
-use the commands
+numbered pages and in the left head on even numbered pages, you should
+give the command
+\begin{verbatim}
+\header{\oddeven{}{\thepage}}%
+ {}%
+ {\oddeven{\thepage}{}}
+\end{verbatim}
+or the commands
\begin{center}
\begin{verbatim}
-\rhead{\oddeven{\thepage}{}}
\lhead{\oddeven{}{\thepage}}
+\rhead{\oddeven{\thepage}{}}
\chead{}
\end{verbatim}
\end{center}
-If you wanted the footer of the even numbered pages to be empty and
-the footer of the odd numbered pages to contain the message ``Please
-continue\dots'', except that the last page of the exam should have an empty
-footer whether its page number is even or odd, then you would use the
-commands
+If you want the footer of the even numbered pages to be empty and the
+footer of the odd numbered pages to contain the centered message
+``Please continue\dots'', except that the last page of the exam should
+have an empty footer whether its page number is even or odd, then you
+should give the command
+\begin{verbatim}
+\footer{}
+ {\oddeven{\iflastpage{}{Please continue\ldots}}{}}
+ {}
+\end{verbatim}
+or the commands
\begin{center}
\begin{verbatim}
\lfoot{}
@@ -3778,20 +4996,21 @@ commands
(see section~\ref{sec:lastpage} for an explanation of
\verb"\iflastpage").
-Although the \verb"\oddeven" command can be used anywhere in the
-document (i.e., not just in headers and footers), it is reliable only
-in headers and footers. This is because \LaTeX{} generally processes
-more text than can fit on the current page before it outputs a page.
-When the \verb"\oddeven" command is encountered it will act as though
-it will appear on the current page whether it appears on that page or
-on the following page.
+The \verb"\oddeven" command can be used reliably only in headers and
+footers. This is because \LaTeX{} generally processes more text than
+can fit on the current page before it outputs a page. When the
+\verb"\oddeven" command is encountered it will act as though it will
+appear on the current page whether it will actually be printed on that
+page or on the following page; in headers and footers this never
+creates a problem.
+
%--------------------------------------------------------------------
\subsection{Questions that span multiple pages}
\label{sec:QuesSpan}
The exam document class provides the commands \verb"\ifcontinuation",
-\verb"\ContinuedQuestion", \verb"\ifincomplete" and
+\verb"\ContinuedQuestion", \verb"\ifincomplete", and
\verb"\IncompleteQuestion" to enable headers and footers that announce
whether this page is continuing a question begun on an earlier page
(and, if so, the number of that question) and whether the question at
@@ -3801,7 +5020,7 @@ number of that question).
\emph{These commands are only guaranteed to work in headers and
footers.} If you use any of them elsewhere, they may be fooled by
\LaTeX's practice of typesetting a bit too much material to fit on a
-page before it chooses the pagebreak and ships out the page. They
+page before it chooses the page break and ships out the page. They
also assume that there is only one \verb"questions" environment in the
entire exam.
@@ -3816,45 +5035,47 @@ continuing the last question.
In more detail:
\begin{itemize}
\item \verb"\ifcontinuation{Text 1}{Text 2}"\\
- Expands to `Text 1' if this page begins with a part, subpart or
- subsubpart of a question begun on an earlier page, and expands to
- `Text 2' if this page begins with a new question.
+ Expands to `Text 2' if the first question, part, subpart,
+ subsubpart, or choice that begins on this page is a question, and to
+ `Text 1' if it's a part, subpart, subsubpart, or choice. It also
+ expands to `Text 1' if no question, part, subpart, subsubpart, or
+ choice begins on this page and we're not beyond a page with the
+ command \verb"\nomorequestions" or before the page with question
+ number 1; otherwise, it expands to `Text2'.
- More specifically, it expands to `Text 2' if either
+ That is, it expands to `Text 2' if
\begin{itemize}
- \item a question begins on this page before any part, subpart, or
- subsubpart begins, or
- \item The current page is later than a page with the
- \verb"\nomorequestions" command
+ \item this page precedes the page containing question number 1,
+ \item this page is later than a page with the
+ \verb"\nomorequestions" command, or
+ \item a question begins on this page before any part, subpart,
+ subsubpart, or choice begins,
\end{itemize}
and otherwise it expands to `Text 1'.
\item \verb"\ContinuedQuestion"\\
- If this page does begin with a continuation of a question begun on
- an earlier page, then \verb"\ContinuedQuestion" expands to the
- number of that question.
+ If a question begun on an earlier page continues on this page, then
+ \verb"\ContinuedQuestion" expands to the number of that question.
- More specifically, \verb"\ContinuedQuestion" expands to a positive
- number if either
+ That is, \verb"\ContinuedQuestion" expands to the number of the last
+ question begun before this page if either
\begin{itemize}
+ \item the first question, part, subpart, subsubpart, or choice that
+ begins on this page is a part, subpart, subsubpart, or choice, or
\item this page doesn't contain the beginning of any question, part,
- subpart, or subsubpart, or
- \item this page has a part, subpart, or subsubpart that appears
- before any question appears,
+ subpart, subsubpart, or choice.
\end{itemize}
- in which case \verb"\ContinuedQuestion" expands to the number of the
- last question begun before this page.
\item \verb"\ifincomplete{Text 1}{Text 2}"\\
- Expands to \verb"Text 1" if we have not yet encountered a
+ Expands to \verb"Text 1" if we have not yet encountered a
\verb"\nomorequestions" command and if the last question begun on or
- before this page has a part, subpart, or subsubpart that begins on a
- later page. Otherwise, it expands to \verb"Text 2".
+ before this page has a part, subpart, subsubpart, or choice that
+ begins on a later page. Otherwise, it expands to \verb"Text 2".
\item \verb"\IncompleteQuestion"\\
If the last question begun on or before this page has a part,
- subpart, or subsubpart that begins on a later page, then this
- expands to the number of that question.
+ subpart, subsubpart, or choice that begins on a later page, then
+ this expands to the number of that question.
\item \verb"\nomorequestions"\\
No page following the page on which this command was given will be
@@ -3924,18 +5145,15 @@ on the first page, the header
\samplehead{Math 115}{First Exam, Page 2 of 5}{July 4, 1776}{\hrule}
on all pages after the first, and no footer on any page, give the
commands
-%
\begin{verbatim}
\pagestyle{head}
\runningheadrule
\firstpageheader{Math 115}{First Exam}{July 4, 1776}
-\runningheader{Math 115}%
- {First Exam, Page \thepage\ of \numpages}%
+\runningheader{Math 115}
+ {First Exam, Page \thepage\ of \numpages}
{July 4, 1776}
\end{verbatim}
-%
Alternatively, you could give the commands
-%
\begin{verbatim}
\pagestyle{head}
\runningheadrule
@@ -3943,7 +5161,6 @@ Alternatively, you could give the commands
\chead[First Exam]{First Exam, Page \thepage\ of \numpages}
\rhead{July 4, 1776}
\end{verbatim}
-%
\end{example}
%--------------------------------------------------------------------
@@ -3955,7 +5172,6 @@ on the first page, no header on the pages after the first, no footer
on the first page, and the footer
\samplefoot{\hrule}{Math 115}{First Exam}{Page 2 of 5}
on all pages after the first, give the commands
-%
\begin{verbatim}
\pagestyle{headandfoot}
\runningfootrule
@@ -3964,7 +5180,6 @@ on all pages after the first, give the commands
\firstpagefooter{}{}{}
\runningfooter{Math 115}{First Exam}{Page \thepage\ of \numpages}
\end{verbatim}
-%
Alternatively, you could give the commands
\begin{verbatim}
\pagestyle{headandfoot}
@@ -3976,42 +5191,40 @@ Alternatively, you could give the commands
\cfoot[]{First Exam}
\rfoot[]{Page \thepage\ of \numpages}
\end{verbatim}
-%
\end{example}
%--------------------------------------------------------------------
\begin{example}
To have the header
-\samplehead{\large\bf Mathematics 115\\
+\samplehead{\large\bfseries Mathematics 115\\
First Exam, July 4, 1776}%
- {}{\large\bf Name:\enspace\hbox to 2in{\hrulefill}}{}
+ {}{\large\bfseries Name:\enspace\makebox[2in]{\hrulefill}}{}
on the first page, the header
-\samplehead{\large\bf Mathematics 115\\
+\samplehead{\large\bfseries Mathematics 115\\
First Exam, July 4, 1776}%
{}{}{}
-on all pages after the first, an empty foot on the first page, and
+on all pages after the first, an empty footer on the first page, and
the footer
\samplefoot{}{}{Page 2}{}
on all pages after the first, give the commands
-%
\begin{verbatim}
\pagestyle{headandfoot}
-\firstpageheader{\large\bf Mathematics 115\\
- First Exam, July 4, 1776}%
- {}{\large\bf Name:\enspace\hbox to 2in{\hrulefill}}
-\runningheader{\large\bf Mathematics 115\\
+\firstpageheader{\large\bfseries Mathematics 115\\
+ First Exam, July 4, 1776}
+ {}
+ {\large\bfseries Name:\enspace\makebox[2in]{\hrulefill}}
+\runningheader{\large\bfseries Mathematics 115\\
First Exam, July 4, 1776}{}{}
\firstpagefooter{}{}{}
\runningfooter{}{Page \thepage}{}
\end{verbatim}
-%
Alternatively, you could give the commands
\begin{verbatim}
\pagestyle{headandfoot}
-\lhead{\large\bf Mathematics 115\\ First Exam, July 4, 1776}
+\lhead{\large\bfseries Mathematics 115\\ First Exam, July 4, 1776}
\chead{}
-\rhead[\large\bf Name:\enspace\hbox to 2in{\hrulefill}]{}
+\rhead[\large\bfseries Name:\enspace\makebox[2in]{\hrulefill}]{}
\lfoot{}
\cfoot[]{Page \thepage}
\rfoot{}
@@ -4022,58 +5235,69 @@ Alternatively, you could give the commands
\begin{example}
To have the header
-\samplehead{}{Wellesley College\\
- Second Semester Final Examination, Spring 1993\\
- Mathematics 115}{}{}
+\samplehead{}
+ {Wellesley College\\
+ Second Semester Final Examination, Spring 1993\\
+ Mathematics 115}
+ {}
+ {}
on the first page, the header
-\samplehead{}{Wellesley College\\
- Second Semester Final Examination, Spring 1993\\
- Mathematics 115 (Continued)}{}{}
+\samplehead{}
+ {Wellesley College\\
+ Second Semester Final Examination, Spring 1993\\
+ Mathematics 115 (Continued)}
+ {}
+ {}
on all pages after the first, the footer
\samplefoot{}{}{Page 3 of 10}{Please go on to the next page\ldots}
on all pages \emph{except the last} page, and the footer
\samplefoot{}{}{Page 10 of 10}{End of exam.}
on the last page, give the commands
-%
\begin{verbatim}
\pagestyle{headandfoot}
\extraheadheight{.25in}
-\firstpageheader{}{Wellesley College\\
- Second Semester Final Examination, Spring 1993\\
- Mathematics 115}{}
-\runningheader{}{Wellesley College\\
- Second Semester Final Examination, Spring 1993\\
- Mathematics 115 (Continued)}{}
-\footer{}{Page \thepage\ of \numpages}%
- {\iflastpage{End of exam.}{Please go on to the next page\ldots}}
+\firstpageheader{}
+ {Wellesley College\\
+ Second Semester Final Examination, Spring 1993\\
+ Mathematics 115}
+ {}
+\runningheader{}
+ {Wellesley College\\
+ Second Semester Final Examination, Spring 1993\\
+ Mathematics 115 (Continued)}
+ {}
+\footer{}
+ {Page \thepage\ of \numpages}
+ {\iflastpage{End of exam.}{Please go on to the next page\ldots}}
\end{verbatim}
-%
Alternatively, you could give the commands
\begin{verbatim}
\pagestyle{headandfoot}
\extraheadheight{.25in}
\lhead{}
\chead[Wellesley College\\
- Second Semester Final Examination, Spring 1993\\
- Mathematics 115]
+ Second Semester Final Examination, Spring 1993\\
+ Mathematics 115]
{Wellesley College\\
- Second Semester Final Examination, Spring 1993\\
- Mathematics 115 (Continued)}
+ Second Semester Final Examination, Spring 1993\\
+ Mathematics 115 (Continued)}
\rhead{}
\lfoot{}
\cfoot{Page \thepage\ of \numpages}
\rfoot{\iflastpage{End of exam.}{Please go on to the next page\ldots}}
\end{verbatim}
-
\end{example}
%--------------------------------------------------------------------
\begin{example}
To have the header
-\samplehead{}{Wellesley College\\
- Second Semester Final Examination, Spring 1993\\
- Mathematics 115}{}{}
+\samplehead{}
+ {Wellesley College\\
+ Second Semester Final Examination, Spring 1993\\
+ Mathematics 115}
+ {}
+ {}
on the first page, the header
\samplehead{Mathematics 115 (Continued)}{}{Spring, 1993}{}
on all pages after the first, the footer
@@ -4081,26 +5305,28 @@ on all pages after the first, the footer
on all pages \emph{except the last} page, and the footer
\samplefoot{}{}{Page 10 of 10}{End of exam.}
on the last page, give the commands
-%
\begin{verbatim}
\pagestyle{headandfoot}
\extraheadheight[.25in]{}
-\firstpageheader{}{Wellesley College\\
- Second Semester Final Examination, Spring 1993\\
- Mathematics 115}{}
-\runningheader{Mathematics 115}{}{Spring, 1993}
-\footer{}{Page \thepage\ of \numpages}%
- {\iflastpage{End of exam.}{Please go on to the next page\ldots}}
+\firstpageheader{}
+ {Wellesley College\\
+ Second Semester Final Examination, Spring 1993\\
+ Mathematics 115}
+ {}
+\runningheader{Mathematics 115 (Continued)}{}{Spring, 1993}
+\footer{}
+ {Page \thepage\ of \numpages}
+ {\iflastpage{End of exam.}{Please go on to the next page\ldots}}
\end{verbatim}
-%
Alternatively, you could give the commands
\begin{verbatim}
\pagestyle{headandfoot}
\extraheadheight[.25in]{}
-\lhead[]{Mathematics 115}
+\lhead[]{Mathematics 115 (Continued)}
\chead[Wellesley College\\
- Second Semester Final Examination, Spring 1993\\
- Mathematics 115]{}
+ Second Semester Final Examination, Spring 1993\\
+ Mathematics 115]
+ {}
\rhead[]{Spring, 1993}
\lfoot{}
\cfoot{Page \thepage\ of \numpages}
@@ -4137,17 +5363,15 @@ the following page, give the commands
\ifcontinuation{Question \ContinuedQuestion\ continues\ldots}{}%
}
\firstpageheader{Math 115}{First Exam}{July 4, 1776}
-\runningheader{\continuedmessage}%
- {First Exam}%
- {Page \thepage\ of \numpages}%
-\footer{}%
- {}%
+\runningheader{\continuedmessage}
+ {First Exam}
+ {Page \thepage\ of \numpages}
+\footer{}
+ {}
{\ifincomplete{Question \IncompleteQuestion\ continues
- on the next page\ldots}{}}
+ on the next page\ldots}{}}
\end{verbatim}
-%
Alternatively, you could give the commands
-%
\begin{verbatim}
\pagestyle{headandfoot}
\runningheadrule
@@ -4160,9 +5384,8 @@ Alternatively, you could give the commands
\lfoot{}
\cfoot{}
\rfoot{\ifincomplete{Question \IncompleteQuestion\ continues
- on the next page\ldots}{}}
+ on the next page\ldots}{}}
\end{verbatim}
-%
\end{example}
%--------------------------------------------------------------------
@@ -4180,7 +5403,7 @@ on the first page, the header
on all pages after the first, no footer on the first page, and the
footer
%
-\samplefoot{}{Page 3 of 5}{}{Points earned: \hbox to .5in{\hrulefill}\\
+\samplefoot{}{Page 3 of 5}{}{Points earned: \makebox[.5in]{\hrulefill}\\
out of a possible 20 points}
%
on all pages after the first, give the commands
@@ -4190,12 +5413,10 @@ on all pages after the first, give the commands
\runningheader{Second Exam}{}{July 4, 1776}
\runningfooter{Page \thepage\ of \numpages}
{}
- {Points earned: \hbox to .5in{\hrulefill}\\
- out of a possible \pointsonpage{\thepage} points}
+ {Points earned: \makebox[.5in]{\hrulefill}\\
+ out of a possible \pointsonpage{\thepage} points}
\end{verbatim}
-%
Alternatively, you could give the commands
-%
\begin{verbatim}
\pagestyle{headandfoot}
\lhead[Math 115]{Second Exam}
@@ -4203,10 +5424,9 @@ Alternatively, you could give the commands
\rhead{July 4, 1776}
\lfoot[]{Page \thepage\ of \numpages}
\cfoot{}
-\rfoot[]{Points earned: \hbox to .5in{\hrulefill}\\
- out of a possible \pointsonpage{\thepage} points}
+\rfoot[]{Points earned: \makebox[.5in]{\hrulefill}\\
+ out of a possible \pointsonpage{\thepage} points}
\end{verbatim}
-%
\end{example}
%--------------------------------------------------------------------
@@ -4254,20 +5474,18 @@ on all even numbered pages, give the commands
}
\newcommand\oddrightfoot{%
\ifincomplete{Page \thepage\ of \numpages\\
- Question \IncompleteQuestion\ continues\ldots}%
- {Page \thepage\ of \numpages}
+ Question \IncompleteQuestion\ continues\ldots}%
+ {Page \thepage\ of \numpages}
}
\firstpageheader{Math 115}{Second Exam}{July 4, 1776}
-\runningheader{\oddeven{}{\continuedmessage}}%
- {\oddeven{Second Exam}{Math 115}}%
+\runningheader{\oddeven{}{\continuedmessage}}
+ {\oddeven{Second Exam}{Math 115}}
{\oddeven{July 4, 1776}{}}
-\footer{\oddeven{}{Page \thepage\ of \numpages}}%
- {}%
+\footer{\oddeven{}{Page \thepage\ of \numpages}}
+ {}
{\oddeven{\oddrightfoot}{}}
\end{verbatim}
-%
Alternatively, you could give the commands
-%
\begin{verbatim}
\pagestyle{headandfoot}
\newcommand\continuedmessage{%
@@ -4275,8 +5493,8 @@ Alternatively, you could give the commands
}
\newcommand\oddrightfoot{%
\ifincomplete{Page \thepage\ of \numpages\\
- Question \IncompleteQuestion\ continues\ldots}%
- {Page \thepage\ of \numpages}
+ Question \IncompleteQuestion\ continues\ldots}%
+ {Page \thepage\ of \numpages}
}
\lhead[Math 115]{\oddeven{}{\continuedmessage}}
\chead{\oddeven{Second Exam}{Math 115}}
@@ -4285,7 +5503,6 @@ Alternatively, you could give the commands
\cfoot{}
\rfoot{\oddeven{\oddrightfoot}{}}
\end{verbatim}
-
\end{example}
@@ -4294,10 +5511,9 @@ Alternatively, you could give the commands
\section{Cover pages}
\label{sec:coverpages}
-
There is a \verb"coverpages" environment that allows you to have one
or more pages before page~1 of the exam. By default, there are no
-headers or footers printed on the coverpages, but if you put the page
+headers or footers printed on the cover pages, but if you put the page
number into the headers and/or footers (using the commands described
in section~\ref{sec:Coverhdft}), the page numbers of cover pages are
printed in roman numerals.
@@ -4326,17 +5542,17 @@ arabic numerals.
\subsection{Headers and footers}
\label{sec:Coverhdft}
-By default, there are no headers or footers on the cover pages. If
+By default, the headers and footers on the cover pages are empty. If
you'd like to have headers and/or footers on the cover pages, there
are commands to create them that are completely analogous to the
-commands described in section~\ref{sec:headfoot} for headers and/or
+commands described in section~\ref{sec:headfoot} for headers and
footers in the main part of the document. The commands for headers
-and footers in coverpages and the corresponding commands for the main
+and footers in cover pages and the corresponding commands for the main
exam pages are:
\begin{center}
\begin{tabular}{l@{\qquad\qquad}l}
-\multicolumn{1}{l}{Cover Pages Commands}& Main Pages Commands\\[\medskipamount]
+Cover Pages Commands& Main Pages Commands\\[\medskipamount]
\verb"\coverheader"&\verb"\header"\\
\verb"\coverrunningheader"&\verb"\runningheader"\\
\verb"\coverfirstpageheader"&\verb"\firstpageheader"\\[\medskipamount]
diff --git a/Master/texmf-dist/tex/latex/exam/exam.cls b/Master/texmf-dist/tex/latex/exam/exam.cls
index d6165bf4155..ea3516cbb46 100644
--- a/Master/texmf-dist/tex/latex/exam/exam.cls
+++ b/Master/texmf-dist/tex/latex/exam/exam.cls
@@ -3,7 +3,7 @@
% A LaTeX2e document class for preparing exams.
%% exam.cls
-%% Copyright (c) 1994, 1997, 2000, 2004 Philip S. Hirschhorn
+%% Copyright (c) 1994, 1997, 2000, 2004, 2008 Philip S. Hirschhorn
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
@@ -31,14 +31,10 @@
% from my web page: http://www-math.mit.edu/~psh/
-\def\fileversion{2.2}
-\def\filedate{2004/08/14}
+\def\fileversion{2.3}
+\def\filedate{2008/07/19}
%---------------------------------------------------------------------
%---------------------------------------------------------------------
-% PLEASE DO NOT MAKE ANY CHANGES TO THIS FILE!
-%
-% If you wish to make changes to this file, rename this file
-% to something other than exam.cls BEFORE YOU MAKE THE CHANGES!
%
% If there's some feature that you'd like that this file doesn't
% provide, tell me about it.
@@ -86,845 +82,684 @@
%
%--------------------------------------------------------------------
%--------------------------------------------------------------------
-% Changelog:
-
+% Changelog since version 2.2:
-% Version 2.2:
-%
-% Enough already with betatest.
-%
-%--------------------------------------------------------------------
-%
-% Version 2.116$\beta$:
-%
-% We futzed with the oneparchoices environment so that a bit more
-% space will be left before the first choice when the list of choices
-% continues the paragraph of the question.
-%
%--------------------------------------------------------------------
+% Version 2.3, 2008/07/16:
%
-% Version 2.115$\beta$:
-%
-% New environment: oneparchoices
-%
-% Intended for multiple choice questions (just like the choices
-% environment), except that the oneparchoices prints all the choices in
-% a single paragraph. This environment does *not* create a paragraph
-% break at its beginning, so if you begin the environment without
-% skipping a line before it, the choices will be printed as a
-% continuation of the paragraph preceding the environment.
+% Minor typographic corrections to comments.
%
%--------------------------------------------------------------------
+% Version 2.222$\beta$, 2008/07/13:
%
-% Version 2.114$\beta$:
-%
-% We fixed up the code for \uplevel and \fullwidth so that they work
-% correctly if a solution environment is inside the argument.
+% Corrected a typo in the error message displayed when
+% \shadedsolutions is used without having said \usepackage{color}.
%
%--------------------------------------------------------------------
+% Version 2.221$\beta$, 2008/07/03:
%
-% Version 2.113$\beta$:
-%
-% Added code to warn if point totals have changed since the last run of
-% LaTeX (which requires running LaTeX again to make sure that
-% gradetables, pointsofquestion, and pointsonpage values are correct).
-%
-%
-% We also added code to create a label for every question, part,
-% subpart, and subsubpart. We make no use of these labels, but we put
-% them there so that if a question (or part, etc.) is, e.g., moved from
-% one page to another, LaTeX will notice this and warn the user that
-% LaTeX must be run one more time to be sure everything is correct.
-%
-% We need to do this even though we've already included code to check
-% when point totals change because questions (and parts, etc.) know what
-% page they're on from reading the info written to the .aux file on the
-% previous run. Thus, if a question (or part, etc.) is moved to a
-% different page, then the pointsonpage totals won't notice until the
-% *second* subsequent run of LaTeX, and so there'll be no warning to the
-% user on the *first* run. Including these labels gives the user a
-% warning on that first run.
+% \themarginpoints used to expand to
+% \@points \@marginpointname
+% whether the points were bonus or non-bonus. We fixed that, so that
+% it expands to either
+% \@points \@marginbonuspointname
+% or
+% \@points \@marginpointname
+% depending on whether or not the points are bonus points.
%
%--------------------------------------------------------------------
+% Version 2.220$\beta$, 2008/05/24:
%
-% Version 2.112$\beta$:
+% New command: \fillwithdottedlines
+% New environment: solutionordottedlines
%
-% New environment: coverpages
%
-% This is for use only *before* any questions (or parts, or subparts, or
-% subsubparts). It allows you to print one or more cover pages,
-% numbered in a different sequence of page numbers from the main pages.
-% That is, the page number is reset to 1 at the end of a coverpages
-% environment.
+% \fillwithdottedlines is similar to \fillwithlines except that it
+% inserts dotted lines (created by \dotfill) instead of solid lines.
%
-% The default is that headers and footers are empty on the coverpages,
-% but if you print the page number (using \thepage in the header or
-% footer) then the page number will be printed in roman numerals. When
-% the coverpages environment ends, the page number is reset to 1 and the
-% page numbers revert to the (standard) arabic numbers.
+% \fillwithdottedlines takes one argument, which is either a length or
+% \fill, and it fills that much vertical space with dotted horizontal
+% lines that run the length of the current line. That is, they extend
+% from the current left margin (which depends on whether we're in a
+% question, part, subpart, or subsubpart) to the right margin.
%
-% Headers and footers on coverpages are determined by commands
-% completely analogous to the relevant commands for the main pages,
-% except that the names of the commands begin with the word ``cover''.
-% That is, the following commands are available to define headers and
-% footers, and to leave additional space for the headers and footers as
-% needed:
+% The distance between the lines is \dottedlinefillheight, whose
+% default value is set with the command
%
+% \setlength\dottedlinefillheight{.25in}
%
-% New commands:
-%
-% \coverheader
-% \coverrunningheader
-% \coverfirstpageheader
-%
-% \coverlhead
-% \coverchead
-% \coverrhead
-%
-% \coverfooter
-% \coverrunningfooter
-% \coverfirstpagefooter
-%
-% \coverlfoot
-% \covercfoot
-% \coverrfoot
+% This value can be changed by giving a new \setlength command.
%
-% \coverextraheadheight
-% \coverextrafootheight
+% The solutionordottedlines environment is almost identical to the
+% solutionorlines environment, except that when solutions are not
+% being printed and an optional argument appears specifying an amount
+% of space to be left for answers, that space is filled with dotted
+% lines (created by \dotfill), rather than filled with solid lines (as
+% it is by the solutionorlines environment).
%
%--------------------------------------------------------------------
-%
-% Version 2.111$\beta$:
-%
-% Bugfix: There was an incompatibility with spanish.ldf (loaded when the
-% user loads the babel package with the spanish option) (and possibly
-% with other language packages as well). That file redefines \@roman,
-% which is used by \roman, which I had used to define some internally
-% used command names. I replaced
-%
-% \roman{countername}
-%
-% with
-%
-% \romannumeral \csname c@countername\endcsname
-%
-% for all of those command names, and now all at least seems to be
-% well.
-%
-%
-% The following stuff isn't really complete yet:
-% New environment: coverpages
-%
+% Version 2.219$\beta$, 2007/11/24:
+%
+% There can now be partial grade tables and point tables, either bonus
+% or non-bonus.
+%
% New commands:
-%
-% \coverheader
-% \coverrunningheader
-% \coverfirstpageheader
-%
-% \coverlhead
-% \coverchead
-% \coverrhead
-%
-% \coverfooter
-% \coverrunningfooter
-% \coverfirstpagefooter
-%
-% \coverlfoot
-% \covercfoot
-% \coverrfoot
-%
-% \coverextraheadheight
-% \coverextrafootheight
-%
-%--------------------------------------------------------------------
-%
-% Version 2.110$\beta$:
-%
-% We change the definition of \half to print a fraction one half that
-% uses a slanted fraction bar. We also created two new commands:
-%
-% \newcommand*\usehorizontalhalf
-% \newcommand*\useslantedhalf
-%
-% The first one changes the definition of \half so that it produces a
-% fraction with a horizontal fraction bar (via $\frac{1}{2}$), and the
-% second one returns the definition of \half to its default.
-%
+%
+% \partialgradetable
+% \partialbonusgradetable
+% \partialpointtable
+% \partialbonuspointtable
+% \begingradingrange
+% \endgradingrange
+%
+% The user defines a grading range by saying
+%
+% \begingradingrange{whatever}
+%
+% to start the range and
+%
+% \endgradingrange{whatever}
+%
+% to end the range (where ``whatever'' is a name chosen by the user).
+% To create the table, the user says, e.g.,
+%
+% \partialgradetable{whatever}[v][questions]
+%
+% That is, each of \partialgradetable, \partialbonusgradetable,
+% \partialpointtable, and \partialbonuspointtable takes
+%
+% one required argument (the name of the grading range) and
+%
+% two optional arguments, the first being either ``[v]'' or ``[h]'',
+% the second being either ``[questions]'' or ``[pages]''.
+%
+% If either or both of the optional arguments are omitted, [questions]
+% and [v] will be used.
+%
+% If the table is indexed by questions, then it will include all
+% questions following the \begingradingrange{whatever} and preceding the
+% \endgradingrange{whatever}.
+%
+% If the table is indexed by pages, then it will include all pages with
+% points starting with the page containing the
+% \begingradingrange{whatever} and ending with the page containing the
+% \endgradingrange{whatever}.
+%
+% Otherwise,
+%
+% \partialgradetable is similar to \gradetable
+% \partialbonsugradetable is similar to \bonusgradetable
+% \partialpointtable is similar to \pointtable
+% \partialbonuspointtable is similar to \bonuspointtable
+%
%--------------------------------------------------------------------
-%
-% Version 2.109$\beta$:
-%
-% Point values for questions (and parts, etc.) can now include half
-% points. To specify a half point, you include ``\half'' immediately
-% following the integer part (or just with ``\half'' if the integer part
-% is zero). For example, the following are all valid point values:
-%
-% 0
-% \half
-% 1
-% 1\half
-% 2
-% 2\half
-% Etc.
+% Version 2.218$\beta$, 2007/10/31:
+%
+% Instead of appending
+% \the \pageinfo@commands \the \point@toks
+% to \everypar, we insert them into the box \@labels. This corrects the
+% problem that arose when a question (or part, etc.) begins with a list
+% environment (including verbatim, flushleft, center, flushright, and
+% possibly others that are implemented as trivlist environments). The
+% \item command in those environments throws away the previous contents
+% of \everypar, and so the tokens
+% \the \pageinfo@commands \the \point@toks
+% didn't get inserted where we expected. List environments *do*
+% preserve the contents of the box \@labels, though.
+
+% This version of exam.cls is not completely backward compatible with
+% older versions. The changes only affect documents in which the user
+% was doing something that probably should not have been done with the
+% older versions, though. This new version does something useful in
+% situations in which older versions did something not very useful:
+
+% This change introduces a change in behavior for documents in which a
+% question with points begins with a parts environment, so that the
+% points for the first part (if any) would appear on the same line as
+% the points for the question. In earlier versions of exam.cls, the
+% points for the question would not be printed if there are points for
+% the part that begins on the same line. In this version of exam.cls,
+% all points will be printed. If they're both printed in the left
+% margin, or both in the right margin, then they'll be printed directly
+% on top of one another, which is not what you want. (You can use
+% \pointsinmargin, \pointsinrightmargin, and \nopointsinmargin to print
+% them in different places.) If points are being printed right in the
+% text (i.e., \nopointsinmargin), then the points for the question will
+% be printed *before* the label (a) for the first part is printed.
+
+% The behavior of this new version of exam.cls seems clearly preferable
+% to the old behavior, but it is a change!
%
%--------------------------------------------------------------------
+% Version 2.217$\beta$, 2007/10/22:
+%
+% We changed things so that we're now compatible with calc.sty
%
-% Version 2.108$\beta$:
+% calc.sty redefines \setcounter and \addtocounter in a way that
+% conflicts with a trick we were using to deal with \half points.
%
-% New environment: solutionorlines
+% We replaced one \setcounter command with
%
-% This is almost identical to the solution environment, except that when
-% solutions are not being printed and an optional argument appears
-% specifying an amount of space to be left for answers, that space is
-% filled with ruled lines (created by \fillwithlines), rather than being
-% left blank (as it is by the solution environment).
+% \global\csname c@#1\endcsname 0#2\relax
%
-% Also: Changed the shade of gray used as the default color for
-% \shadedsolutions.
+% and one \addtocounter command with
%
-% Changed the default thickness of lines used by \fillwithlines.
+% \global\advance\csname c@#1\endcsname 0#2\relax
%
%--------------------------------------------------------------------
-%
-% Version 2.107$\beta$:
-%
-% We added an option to have solution environments use a \colorbox (from
-% the color package) instead of an \fbox. Instead of surrounding the
-% solution with a printed box, it prints the solution on a colored
-% background. The default color is a light gray (so that it can be
-% printed on any printer that can do grayscale), but the color can be
-% changed.
-%
-% To use this option, the user must load the color package with the
+% Version 2.216$\beta$, 2007/08/27:
+%
+% The command \answerline now takes an optional argument. If the
+% optional argument appears, then when \printanswers is true the
+% argument will be printed on the answer line. When \printanswers is
+% false, the optional argument is ignored.
+%
+% When the argument is printed, it is printed with
+% \CorrectChoiceEmphasis and it is a distance of \answerclearance above
+% the line. The default value of \answerclearance is set with the
% command
-%
-% \usepackage{color}
-%
-% in the preamble. (If appropriate, optional arguments can be used in
-% that command.) The user can then give the command
-%
-% \shadedsolutions
-%
-% to have all solutions printed using a \colorbox. After giving that
-% command, the user can change the color of the backgrounds of solutions
-% by defining the color ``SolutionColor''. The default SolutionColor is
-% set via the command
-%
-% \definecolor{SolutionColor}{gray}{0.9}
-%
-% and the user can change that by giving a \definecolor command *after*
-% giving the command \shadedsolutions. For example, the command
-%
-% \definecolor{SolutionColor}{rgb}{0.8,0.9,1}
-%
-% sets the background color to a light blue.
-%
-% You can return to the default situation of having solutions printed
-% inside an \fbox by giving the command
-%
-% \framedsolutions
-%
-% Note added later: The default shade of gray was changed in version
-% 2.108$\beta$.
-%
+%
+% \setlength\answerclearance{0.2ex}
+%
+% and it can be changed with a \setlength command.
+%
+% The optional argument is centered on the answer line unless it is too
+% long, in which case it extends to the right of the answer line.
+%
%--------------------------------------------------------------------
-%
-% Version 2.106$\beta$:
-%
-%
-% We redid the solution environment to use Donald Arseneau's framed.sty
-% macros, so that the solution can be broken across pages with each
-% piece enclosed in a frame.
-%
-% We also changed the default definition of \solutiontitle; it's now
-% defined by:
-%
-% \newcommand{\solutiontitle}{\noindent\textbf{Solution:}\enspace}
-%
-%
+% Version 2.215$\beta$, 2007/08/24:
+%
+% New commands:
+%
+% \pointtable
+% \bonuspointtable
+%
+% Both of these take up to two optional arguments:
+%
+% The first can be either [v] or [h].
+% The second can be either [questions] or [pages].
+%
+% These commands are similar to the commands
+%
+% \gradetable
+% \bonusgradetable
+%
+% except that the new commands print only two columns (or rows),
+% omitting the column (or row) for the score.
+%
%--------------------------------------------------------------------
+% Version 2.214$\beta$, 2007/07/19:
%
-% Version 2.105$\beta$:
-%
-% We're making the thickness of the lines used by \fillwithlines
-% changeable, and changing the default thickness.
-%
-% We're doing this by defining a new command:
-%
-% \linefill,
-%
-% which is similar to \hrulefill, except that \linefill uses a line of
-% height \linefillthickness, whose default value is 0.2pt.
-% (\fillwithlines used to use \hrulefill, which uses a line of height
-% 0.4pt.)
-%
-% The default value of \linefillthickness is set by the command
-%
-% \setlength\linefillthickness{0.2pt}
+% New commands:
%
-% and this can be changed by giving a new \setlength command.
+% \questionshook
+% \partshook
+% \subpartshook
+% \subsubpartshook
+% \choiceshook
%
-% Note added later: The default thickness was changed in version
-% 2.108$\beta$.
+% These are for advanced users who want to customize the list
+% parameters (\topsep, \partopsep, \itemsep, \parsep, etc.) for the
+% lists that these environments create. They are all defined to be
+% empty, but the user can change them using \renewcommand.
%
%--------------------------------------------------------------------
-%
-% Version 2.104$\beta$:
-%
-% We added a new command: \fillwithlines
-%
-% \fillwithlines takes one argument, which is either a length or \fill,
-% and it fills that much vertical space with horizontal lines that run
-% the length of the current line. That is, they extend from the current
-% left margin (which depends on whether we're in a question, part,
-% subpart, or subsubpart) to the right margin.
-%
-% The distance between the lines is \linefillheight, whose default value
-% is set with the command
-%
-% \setlength\linefillheight{.25in}
-%
-% This value can be changed by giving a new \setlength command.
+% Version 2.213$\beta$, 2006/11/27:
+%
+% New documentclass option: addpoints
+% Using this option is equivalent to giving the command
+% \addpoints
+% at the beginning of the document.
+%
+% New commands:
+%
+% \bonusquestion
+% \bonustitledquestion
+% \bonuspart
+% \bonussubpart
+% \bonussubsubpart
+%
+% \bonuspointsofquestion
+% \bonuspointsonpage
+%
+% \numbonuspoints
+%
+% \bonuspointpoints
+% \bonuspointformat
+% \thebonuspoints
+% \bonuspoints
+% \bonuspointname
+% \marginbonuspointname
+%
+% \bonusgradetable
+%
+% \bhqword
+% \bhpword
+% \bhsword
+% \bhtword
+% \bvqword
+% \bvpword
+% \bvsword
+% \bvtword
+%
+% \bvpgword
+% \bhpgword
+%
+%
+% The commands
+%
+% \bonusquestion
+% \bonustitledquestion
+% \bonuspart
+% \bonussubpart
+% \bonussubsubpart
+%
+% are the same as the commands
+%
+% \question
+% \titledquestion
+% \part
+% \subpart
+% \subsubpart
+%
+% except that any points assigned become ``bonus points'', which by
+% default are typeset in the form
+%
+% 1. (1 point (bonus))
+%
+% or
+%
+% 1. (2 points (bonus))
+%
+% If no points are assigned, then these ``bonus'' versions of the
+% commands are equivalent to the non-bonus versions.
+%
+% The command
+%
+% \bonusgradetable
+%
+% is analogous to the command \gradetable; it can be used in any of the
+% four forms
+%
+% \bonusgradetable[v][questions]
+% \bonusgradetable[h][questions]
+% \bonusgradetable[v][pages]
+% \bonusgradetable[h][pages]
+%
+% and it counts only bonus points, while \gradetable counts only
+% non-bonus points.
+%
+% The commands
+%
+% \bonuspointsofquestion
+% \bonuspointsonpage
+% \numbonuspoints
+%
+% are analogous to the commands
+%
+% \pointsofquestion
+% \pointsonpage
+% \numpoints
+%
+% The remaining new commands are for customizing the appearance of bonus
+% points and bonusgradetable. The command
+%
+% \bonuspointpoints
+%
+% is analogous to the command \pointpoints; it takes two arguments, the
+% first of which will appear after 1 or \half points the second to
+% appear after any other number of points. The default was created by
+% the equivalent of the command
+%
+% \bonuspointpoints{point (bonus)}{points (bonus)}
+%
+% If, for example, you give the command
+%
+% \bonuspointpoints{bonus point}{bonus points}
+%
+% then bonus points will look like
+%
+% 1. (1 bonus point)
+%
+% or
+%
+% 1. (2 bonus points)
+%
+% (The commands \bracketedpoints, \boxedpoints, and \nobracketedpoints
+% have the same effect on bonus points that they have on non-bonus
+% points, and the command \marksnotpionts replaces ``point'' with
+% ``mark'' in all of these cases.)
+%
+% \bonuspointname is analogous to \pointname, and the defaults were
+% created by the commands
+%
+% \pointname{ \points}
+% \bonuspointname{ \bonuspoints}
+%
+% (Note the intentional space in each of those commands.)
+%
+% \marginbonuspointname is analogous to \marginpointname, and the
+% default was created by the command
+%
+% \marginbonuspointname{ (bonus)}
+%
+% \bonuspointformat is analogous to \pointformat.
+%
+%
+% The commands for customizing the words used in \bonusgradetable are
+% analogous to those used for customizing the words used in \gradetable,
+% except that they begin with a ``b'':
+%
+% \bhqword is analogous to \hqword
+% \bhpword is analogous to \hpword
+% \bhsword is analogous to \hsword
+% \bhtword is analogous to \htword
+% \bvqword is analogous to \vqword
+% \bvpword is analogous to \vpword
+% \bvsword is analogous to \vsword
+% \bvtword is analogous to \vtword
+% is analogous to
+% \bvpgword is analogous to \vpgword
+% \bhpgword is analogous to \hpgword
+%
%
%--------------------------------------------------------------------
+% Version 2.212$\beta$, 2006/11/13:
%
-% Version 2.103$\beta$:
-%
-% We added a new command: \answerline
-%
-% This is intended for short answer questions. It inserts a \vskip of
-% length \answerskip and then inserts a horizontal line of length
-% \answerlinelength at the right margin, preceded by the number of the
-% current question, part, subpart, or subsubpart.
-%
-% The default values are set by the commands
-%
-% \setlength\answerlinelength{1in}
-% \setlength\answerskip{2ex}
-%
-% and these can be changed by giving new \setlength commands.
+% Made \useslantedhalf and \usehorizontalhalf global.
%
%--------------------------------------------------------------------
+% Version 2.211$\beta$, 2006/10/29:
%
-% Version 2.101$\beta$:
-%
-% We eliminated the command \marks, since it conflicts with a definition
-% of that name in some package or other. We changed the definition of
-% \marksnotpoints so that it still accomplishes the same thing, but now
-% it works through the \pointpoints command.
-%
-% We changed the default format for the \droptotalpoints command, so
-% that it now prints
-%
-% Total for Question 1: 25
-%
-% where the ``25'' is followed by \marginpointname, whose default value
-% is empty.
-%
-%--------------------------------------------------------------------
+% New commands:
%
-% Version 2.098$\beta$:
+% \pointformat
+% \themarginpoints
%
-% We moved the definitions of \thepartno, \thesubpart, and
-% \thesubsubpart outside of the associated list environments, so that
-% the user can redefine them once at the beginning of the LaTeX file and
-% not have their redefinition overridden in every such list.
+% An old command that's also useful here is
%
-% We also replaced most occurrences of \thequestion with
-% \arabic{question}, so that the user can safely redefine \thequestion
-% to something like \Alph{question}, etc.
+% \thepoints
%
-% We rewrote the components of the \gradetable[v][questions] and
-% \gradetable[h][questions] to use the question counter in place of
-% @iterator, and to insert \thequestion instead of \the@iterator as the
-% question number in the table (so that if the user redefines
-% \thequestion, then the table will print the question ``numbers'' (or
-% letters, etc.) in whatever format \thequestion prints the question
-% numbers on the exam).
+% \pointformat: The \pointformat command allows you to change the
+% format used to print the points. It takes one argument, and that
+% argument becomes the command to print the points, whether the points
+% are being printed at the beginning of the question, in the left
+% margin (because of \pointsinmargin), in the right margin (because of
+% \pointsinrightmargin), or dropped in the right margin at the end of
+% the question (because of \pointsdroppedatright).
%
-% We also created a new command:
+% The argument to \pointformat should contain either the command
%
-% \totalpoints
+% \thepoints
%
-% for use in the argument of a \totalformat command. \totalpoints is
-% just an abbreviation for \pointsofquestion{\arabic{question}}. That
-% is, it's a macro that prints the total number of points for the
-% current question.
+% which expands to the number of points followed by the argument to
+% the last \pointname command, or the command
%
-% We changed the longsolution environment to make it easy to change the
-% amount by which the left and right margins are increased. The default
-% amount is set by the command
+% \themarginpoints
%
-% \setlength{\longsolutionindent}{2em}
+% which expands to the number of points followed by the argument to
+% the last \marginpointname command.
%
-% and the user can change this by giving a new \setlength command.
+% For example, the command \bracketedpoints is equivalent to
%
-% Note added later: longsolution was eliminated in version
-% 2.106$\beta$.
+% \pointformat{[\thepoints]}
%
-%--------------------------------------------------------------------
+% if points are not being printed in the margin and to
%
-% Version 2.097$\beta$:
+% \pointformat{[\themarginpoints]}
%
-% We've changed the default format for the total points for a question
-% printed by the \droptotalpoints command. This command still prints
-% the total points for the question right justified a distance of
-% \rightpointsmargin from the right edge of the paper, but now the
-% number of points will, by default, be surrounded by either
+% if points are being printed in the margin.
%
-% a double box, if \boxedpoints is in effect,
-% double brackets, if \bracketedpoints is in effect, or
-% double parentheses, otherwise.
+% For another example, the command \boxedpoints is equivalent to
%
-% It's still true that if you use a \totalformat command, then the
-% format of the printed total points is completely controlled by the
-% argument of the \totalformat command and the default doesn't matter at
-% all.
+% \pointformat{\fbox{\thepoints}}
%
+% if points are not being printed in the margin and to
%
-% Note added later: We changed the default format again in version
-% 2.101$\beta$; see the notes above.
+% \pointformat{\fbox{\themarginpoints}}
%
-%--------------------------------------------------------------------
+% if points are being printed in the margin.
%
-% Version 2.096$\beta$:
+% For another example, if you give the commands
%
-% The labels for questions, parts, subparts, and subsubparts can now be
-% customized. The format now depends on the commands
+% \pointsinmargin
+% \marginpointname{\%}
+% \pointformat{\slshape (\themarginpoints)}
%
-% \questionlabel
-% \partlabel
-% \subpartlabel
-% \subsubpartlabel
+% then the points will be printed in the left margin, followed by the
+% symbol `%', surrounded by parentheses, all in slanted type.
%
-% the default definitions of which are:
+% For another example, if you give the commands
%
-% \newcommand\questionlabel{\thequestion.}
-% \newcommand\partlabel{(\thepartno)}
-% \newcommand\subpartlabel{\thesubpart.}
-% \newcommand\subsubpartlabel{\thesubsubpart)}
+% \pointsinrightmargin
+% \marginpointname{\%}
+% \pointformat{\fbox{\bfseries \boldmath \themarginpoints}}
%
-% These definions can be changed by using a \renewcommand command.
-% Note that the definition of \partlabel used `\thepartno', and *not*
-% `\thepart'. This is because `\thepart' refers to the counter for the
-% standard sectioning command \part, and not the counter used in the
-% parts environment. The counter used by the parts environment is
-% inserted with the command `\thepartno'.
+% then the points will be printed in the right margin, followed by the
+% symbol `%', all in bold and surrounded by a box. (Note: The commands
+% \bfseries and \boldmath are needed here because the ``one half''
+% printed when you use half points is printed in math mode while the
+% rest of the points are printed in text mode.)
%
%--------------------------------------------------------------------
+% Version 2.210$\beta$, 2006/09/28:
%
-% Version 2.095$\beta$:
-%
-% Added solution and longsolution environments.
-%
-% The command \printanswers causes both of these environments print the
-% solution, and the command \noprintanswers causes both of these
-% environments not to print the solution. The default is
-% \noprintanswers.
-%
-% The commands \printanswers and \noprintanswers can be given as many
-% times as desired to switch back and forth between the two.
-%
-% The documentclass option ``answers'' is equivalent to giving a
-% \printanswers command at the beginning of the file.
-%
-%
-% Both of these environments take an optional argument which is an
-% amount of blank vertical space to be left when \noprintanswers is in
-% effect. (The default value of this blank vertical space is 0pt.)
-%
-%
-% The solution environment prints the solution inside of a box, which
-% cannot be broken across pages. Thus, it is only appropriate for
-% solutions that are short enough to fit on a page.
-%
-% The longsolution environment prints the solution with left and right
-% margins slightly increased, and it can be broken across pages.
-%
-% When printing the solution, both environments begin with
-% \solutiontitle, the default value of which is created by the command
-%
-% \newcommand{\solutiontitle}{\textbf{Solution:}\enspace}
-%
-% This can be changed with the \renewcommand command.
-%
-% Note added later: solution was changed and longsolution was
-% eliminated in version 2.106$\beta$.
+% Fixed the bug that prevented having two consecutive \correctchoice's
+% in a choices or oneparchoices environment.
%
%--------------------------------------------------------------------
+% Version 2.209$\beta$, 2006/05/26:
%
-% Version 2.094$\beta$:
-%
-% We've expanded the options of the \gradetable command, so that you
-% can now get a grading table indexed by either question numbers or by
-% page numbers, and in either case you can have either a horizontally
-% oriented table or a vertically oriented table.
-%
-% \gradetable now takes two optional arguments: The first can be either
-% `[v]' or `[h]', and the second can be either `[questions]' or
-% `[pages]'. The defaults are `[v]' and `[questions]', and you must
-% specify a first option if you want to specify a second option.
-%
-% Thus: \gradetable is equivalent to \gradetable[v][questions]
-%
-% `[v]' and `[h]' are as before: Vertically oriented or horizontally
-% oriented.
-%
-% `[questions]' is the same as the earlier version: A table that lists
-% the question numbers, the possible total points for each question the
-% total for the entire exam, and spaces are left for the score on each
-% question.
-%
-% `[pages]' prints a table indexed by page numbers instead of by
-% question numbers. It lists only the numbers of pages that have points
-% on them, and for each such page it lists the number of points possible
-% on that page. It also lists the total possible points on the exam,
-% and spaces are left for the score on each page.
-%
-% For both tables indexed by questions and tables indexed by points,
-% there are commands that allow you to change the column and row
-% headings (the following are shown setting the default values:)
-%
-% \hpword{Points:}
-% \hsword{Score:}
-% \htword{Total}
-% \vpword{Points}
-% \vsword{Score}
-% \vtword{Total:}
-%
-% For tables indexed by questions, the appropriate row and column titles
-% are set by the following commands:
-%
-% \hqword{Question:}
-% \vqword{Question}
-%
-% For tables indexed by pages, the appropriate row and column titles are
-% set by the following commands:
-%
-% \hpgword{Page:}
-% \vpgword{Page}
-%
-%
-% For both \gradetable[h] and \gradetable [v], the width of the blank
-% cells created for filling in the grades can be changed with the
-% command \cellwidth, and the arraystretch applied to the table can be
-% changed with the command \gradetablestretch. The default values are
-% created by the commands:
-%
-% \cellwidth{2em}
-% \gradetablestretch{1.5}
+% We corrected the problem that \ifcontinuation and \ifincomplete paid
+% attention only to parts, subparts, and subsubparts when deciding on
+% which page a question ended, but ignored choices. We corrected this,
+% so that a question is now thought to end on the page on which its last
+% part, subpart, subsubpart, or choice begins.
%
%--------------------------------------------------------------------
-%
-% Version 2.093$\beta$:
-%
-% If the user gives the comman \addpoints, then
-% \pointsonpage{n} expands to the number of points on page n.
-%
+% Version 2.208$\beta$, 2006/01/30:
+%
+% We corrected the description of the usage of \ifthenelse in the
+% comments describing what's new in version 2.207beta.
+%
%--------------------------------------------------------------------
-%
-% Version 2.092$\beta$:
-%
-% Increased the \leftmargin in the choices environment.
-%
+% Version 2.207$\beta$, 2006/01/29:
+%
+% New feature: It's possible to say
+%
+% \ifprintanswers
+% Some stuff
+% \fi
+%
+% to insert ``Some stuff'' only when answers are being printed. It's
+% also possible to say
+%
+% \ifprintanswers
+% Some stuff
+% \else
+% Other stuff
+% \fi
+%
+% to insert ``Some stuff'' when answers are being printed and ``Other
+% stuff'' when answers aren't being printed.
+%
+% Alternatively, it's possible to accomplish the same thing by saying
+%
+% \ifthenelse{\boolean{printanswers}}{Some stuff}{Other stuff}
+%
+% If you want to ``Stuff'' only when answers aren't being printed, you
+% can say either
+%
+% \ifprintanswers
+% \else
+% Stuff
+% \fi
+%
+% or
+%
+% \ifthenelse{\boolean{printanswers}}{}{Stuff}
+%
+% We accomplished this by changing all uses of \if@printanswers,
+% \@printanswerstrue, and \@printanswersfalse to \ifprintanswers,
+% \printanswerstrue, and \printanswersfalse.
+%
%--------------------------------------------------------------------
+% Version 2.206$\beta$, 2005/08/24:
+%
+% New feature: When using a grading table indexed by questions, it's
+% possible to replace the question numbers in the table with titles
+% for the questions.
%
-% Version 2.091$\beta$:
-%
-% New commands:
-% \pointsdroppedatright
-% \droppoints
-% \droptotalpoints
-% \totalformat
-%
-% \pointsdroppedatright: The command \pointsdroppedatright causes points
-% not to be printed until you give the command \droppoints, except that
-% a \qformat command still works as expected (i.e., if you include
-% ``\thepoints'' in the argument of the \qformat, it will print the
-% points as usual).
-%
-%
-% \droppoints: The command \droppoints should be given only at the end
-% of a paragraph or between paragraphs; if you give it within a
-% paragraph, it causes the paragraph to end. \droppoints prints the
-% most recent point value in the right margin, formatted as it is when
-% you give the command \pointsinrightmargin, except that the points
-% appear opposite the last line of the paragraph (or, if the command
-% \droppoints is given between paragraphs, then additional vertical
-% space is left between the paragraphs and the points are printed
-% opposite the blank space). Thus, the formatting can be changed by
-% using giving the commands \bracketedpoints, \boxedpoints, or
-% \marginpointname.
-%
-% The command \droppoints actually works this way even if one of the
-% commands \pointsdroppedatright, \pointsinmargin, or
-% \pointsinrightmargin, is in effect, but if you use it that way the
-% points will appear twice on the page.
-%
-%
-% \droptotalpoints: To use the command \droptotalpoints, you must first
-% give the command \addpoints. The command \droptotalpoints should be
-% given only at the end of a paragraph or between paragraphs; if you
-% give it within a paragraph, it causes the paragraph to end.
-% \droptotalpoints prints the total points for the current question
-% (i.e., the sum of the points assigned to the question and to all of
-% its parts, subparts, and subsubparts) in the right margin, formatted
-% formatted by default inside either double brackets, double box, or
-% double parentheses, depending on whether \bracketedpoints,
-% \boxedpoints, or neither is in effect.
-%
-% \totalformat: The \totalformat command allows you to change the format
-% used by the \droptotalpoints command. It takes one argument, and that
-% argument becomes the command to print the total points, right
-% justified a distance of \rightpointsmargin from the right edge of the
-% paper. The argument should contain the expression
-% ``\pointsofquestion{\arabic{question}}'' at the point at which the number
-% of points should appear. For example, the command
-%
-% \totalformat{[\pointsofquestion{\arabic{question}}]}
-%
-% will produce the same appearance as the default does when the command
-% \bracketedpoints is in effect and \marginpointname is empty, and the
-% command
+%
+% There are two new commands: \titledquestion and \thequestiontitle.
+%
+%
+% \titledquestion is a replacement for \question; it has one required
+% argument (the title) and one optional argument (the point value), as
+% in
+%
+% \titledquestion{Question \thequestion: Concepts}
+%
+% which sets the question title to ``Question 2: Concepts'' (if this
+% is the second question) and doesn't set any pointvalues, or
+%
+% \titledquestion{Design}[10]
+%
+% which sets the question title to ``Design'' and sets the pointvalue
+% to ``10''. (Note that the question title doesn't include the number
+% of the question unless you put it there using the \thequestion
+% command.)
+%
+% The title of the question then automatically replaces the question
+% number in a grading table indexed by question numbers.
+%
+%
+%
%
-% \totalformat{\fbox{Total: \pointsofquestion{\arabic{question}}}}
+%
+% \thequestiontitle: This command expands to the question title. This
+% is for use in the argument of a \qformat command, so that you can make
+% the question title appear in the actual question.
+%
+% If a question is begun with \question (instead of \titledquestion),
+% then the value of \thequestiontitle will automatically be set to the
+% number of the question.
+%
+% Note: The contents of \thequestiontitle don't appear anywhere in the
+% actual question unless you do something to make it appear. For
+% example, the command
+%
+% \qformat{\textbf{Question \thequestion: \thequestiontitle}\dotfill\thepoints}
+%
+% would insert the number of the question along with the title of the
+% question and the point value at the beginning of the question.
+%
+%
+% Note: If you use a grading table indexed by questions and you use the
+% \titledquestion command, then the number of the question won't appear
+% in the grading table unless you include \thequestion in the title of
+% the question.
+%
%
-% produces a box surrounding ``Total: 25''.
+% Note: If \thequestion appears in both the argument to \qformat and the
+% title of the question, then the question number will be printed
+% twice.
+%
+%
+% If the command \thequestiontitle is never used, then the only effect
+% of using the command \titledquestion is that in a grading table
+% indexed by question number, this question will be indexed by the
+% number of the question, rather than by the argument to
+% \titledquestion, and the title of the question would never appear
+% except in the grading table.
%
+%
%--------------------------------------------------------------------
%
-% Version 2.087$\beta$:
-%
-% We changed ``\point@toks={}'' into ``\global \point@toks={}'' when
-% \point@toks is set, so that if the user somehow arranges for us to be
-% inside of a group when we enter horizontal mode, the \point@toks will
-% be properly set equal to null, and so the points won't accidentally be
-% placed a second time at the second paragraph of the question.
-%
-% Similarly, we changed ``\pageinfo@commands={}'' to
-% ``\global \pageinfo@commands={}''.
-%
-%--------------------------------------------------------------------
+% Version 2.205$\beta$, 2005/08/22:
%
-% Version 2.080$\beta$:
-%
-% We added a new command \gradetable that produces a grading table,
-% oriented either vertically or horizontally, that lists the questions,
-% their point values, and the total points, and leaves spaces for
-% entering the grade for each question and the total grade. We also
-% added a new command \pointsofquestion that takes one argument that is
-% assumed to be the number of a question and returns the total number of
-% points for that question. \pointsofquestion is used by the
-% \gradetable command, but the user can choose to use it separately.
-
-% To use either \gradetable or \pointsofquestion, the user must give the
-% command \addpoints. \pointsofquestion{n} will then return the total
-% number of points for question n and all of its parts, subparts, and
-% subsubparts. Since all this information is stored in the .aux file
-% and then read back on the next run of LaTeX, the user must run LaTeX
-% twice after any changes to the questions or points.
-
-% \gradetable[h] produces a horizonatlly oriented grade table, and
-% \gradetable[v] produces a vertically oriented grade table. The
-% command \gradetable is equivalent to \gradetable[v].
-
-% \gradetable[h] produces a table with three rows, titled (by default)
-% ``Question:'', ``Points:'', and ``Score:'' (the titles are in the
-% first column of the table). There is then one column for each
-% question (with the question number and point value in the first two
-% rows), plus a final column labelled ``Total'' with the total points in
-% the second row.
-
-% \gradetable[v] produces a table with three columns, titled (by
-% default) ``Question'', ``Points'', and ``Score'' (the titles are in
-% the first row of the table). There is then one row for each question
-% (with the question number and point value in the first two columns),
-% plus a final row labelled ``Total:'' with the total points in the
-% second column.
-
-% Note that \gradetable[h] produces row titles whose default values
-% contains colons, while \gradetable[v] produces column titles whose
-% default values do not contain colons.
-
-% The row and column titles and the word ``Total'' can be changed using
-% the commands \hqword, \hpword, \hsword, \htword, \vqword,
-% \vpword, \vsword, and \vtword, where the first four affect
-% \gradetable[h] and the second four affect \gradetable[v]. The default
-% values are created by the commands:
-
-% \hqword{Question:}
-% \hpword{Points:}
-% \hsword{Score:}
-% \htword{Total}
-% \vqword{Question}
-% \vpword{Points}
-% \vsword{Score}
-% \vtword{Total:}
-
-% For both \gradetable[h] and \gradetable [v], the width of the blank
-% cells created for filling in the grades can be changed with the
-% command \cellwidth, and the arraystretch applied to the table can be
-% changed with the command \gradetablestretch. The default values are
-% created by the commands:
-
-% \cellwidth{2em}
-% \gradetablestretch{1.5}
-
-
-
-% Changing the definition of \points:
-
-% The default definition of \points is that it expands to ``point'' if
-% the number of points is 1 and to ``points'' otherwise. There is now a
-% command ``\pointpoints'' that takes two arguments, after which
-% \points will expand to the first argument when the number of points is
-% 1 and to the second argument otherwise. For example, the default is
-% the result of the command \pointpoints{point}{points}.
+% Bug fix: If a question began with a parts environment (i.e., if the
+% parts environment began before we entered horizontal mode in the
+% question), then a grading table indexed by questions would get the
+% part number instead of the question number. That's fixed now.
%
%--------------------------------------------------------------------
%
-% Version 2.070$\beta$:
+% Version 2.204$\beta$, 2005/08/21:
%
-% We made this compatible with hyperref.sty.
-% We did this by eliminating all use of LaTeX's
-% \label, \newlabel, \ref, and \pageref commands.
-% We now put information into the .aux file using the
-% \PgInfo@write command, and get that info out of the aux file
-% using \PgInfo and \PgInfo@get, along with a few \gdef commands
-% written straight to the .aux file.
+% Bug fix: Hyperlinks didn't work on page numbers for horizontal
+% grading tables indexed by page numbers. They do now.
%
%--------------------------------------------------------------------
%
-% Version 2.067$\beta$:
+% Version 2.203$\beta$, 2005/08/20:
%
-% We're adding code to enable headers and footers
-% to know whether the current page continues a question started on an
-% earlier page, and whether the page ends with a question still
-% incomplete.
-
-%--------------------------------------------------------------------
-% For use in headers and footers:
-%
-% \ifcontinuation{Text 1}{Text 2}
-% Expands to ``Text 1'' if this page begins with a part or subpart or
-% subsubpart that continues a question begun on an earlier page, and
-% expands to ``Text 2'' if this page begins with a new question.
-%
-% \ContinuedQuestion expands to the number of the question that is
-% being continued from an earlier page.
+% Eliminated \do@int@lbl, and replaced it with labels for each
+% question, part, subpart, and subsubpart the names of which
+% tell you what they're labelling.
%
-% \ifincomplete{Text 1}{Text 2}
-% Expands to ``Text 1'' if the last question begun on or before this
-% page has a part, subpart, or subsubpart that begins on a later page,
-% and if we have not yet encountered a \nomorequestions command.
-%
-% \IncompleteQuestion expands to the number of the question that is
-% continued on the next page.
+% That allowed us to rewrite the grade table stuff so that, for tables
+% indexed by question numbers, the question numbers are inserted with a
+% \ref, so that if \usepackage{hyperref} and pdflatex are used, those
+% question numbers will be clickable links that take you to the relevant
+% question.
%
-% \nomorequestions is a command that you can give after the last
-% question if you intend to include extra material (e.g., tables for
-% use on the exam) but you don't want the pages containing the extra
-% material to be labelled as continuing the last question on the exam.
+% We also added a label for the first points to appear on each page, and
+% rewrote the grade table stuff for tables indexed by page number so
+% that the page numbers are inserted with a \pageref, so that if
+% \usepackage{hyperref} and pdflatex are used, those page numbers will
+% be clickable links that take you to the relevant page.
%
%--------------------------------------------------------------------
%
+% Version 2.202$\beta$, 2005/08/10:
%
-% Also:
-% Changed the code for headers and footers to
-% use the command \normalfont instead of \rm so that the main
-% document font will appear in headers and footers even when the
-% main document font is *not* a roman font.
-%
-% \def\marksnotpoints
+% Created \correctchoice as a synonym for \CorrectChoice
%
-% Changes \pointname so that it is identical to the default \pointname
-% except that the work ``mark'' is used instead of the word
-% ``point''. That is, if the number of points is 1, then you'll get
-% ``1 mark'', and if the number of points is other than 1 then you'll
-% get ``n marks'' (where n is the number of points).
+% Changed \CorrectChoiceDeclarations to \CorrectChoiceEmphasis,
+% and created \correctchoiceemphasis as a synonym for that.
%
+%--------------------------------------------------------------------
%
-% \bracketedpoints
-% \nobracketedpoints
-%
-% The default remains to put the points inside of parentheses.
-% \bracketedpoints switches to points inside of square brackets and
-% \boxedpoints switches to points in side of a box. Both
-% \nobracketedpoints and \noboxedpoints return to the default of
-% points inside of parentheses no matter how many \boxedpoints and
-% \bracketedpoints commands have been given in any order.
-%
-%
-% \pointsinrightmargin
-% \nopointsinrightmargin
-%
-% The default remains to put the points right after the question
-% number, before the text of the question. \pointsinrightmargin
-% switches to points in the right margin and \pointsinleftmargin
-% switches to points in the left margin. Both \nopointsinrightmargin
-% and \nopointsinleftmargin return to the default of points right
-% after the question number, before the text of the question, no
-% matter how many \pointsinrightmargin and \pointsinleftmargin
-% commands have been given in any order.
-%
-% if \pointsinrightmargin is used, then the points are printed
-% right justified in the right margin, with the right edge a distance
-% of \rightpointsmargin from the right edge of the paper.
-% The default value of \rightpointsmargin is 1 cm, but it can be set
-% to any other length with the usual \setlength command
-% (as in \setlength{\rightpointsmargin}{0.5cm}).
-%
+% Version 2.201$\beta$, 2005/08/09:
%
-% subsubparts environment
-% Numbered using lower case greek letters.
+% We created a \CorrectChoice command for use in the choices and
+% oneparchoices environments.
%
+% When solutions are not being printed, \CorrectChoice is equivalent to
+% \choice.
%
-% choices environment, for multiple choice answers
+% When solutions *are* being printed, the choice that was created with
+% \CorrectChoice (rather than with \choice) will be printed subject to
+% the declarations in the argument of the
%
+% \CorrectChoiceDeclarations
%
-% \qformat{Format line}
-%
-% Format line must have some stretch (e.g., at least one \hfil or
-% \dotfill or something similar).
-% \thequestion inserts the question number,
-% \thepoints inserts the number of points followed by pointname if
-% a number of points has been specified for this question, and it
-% inserts nothing at all if no points have been specified.
+% command. The default is
%
-% \noqformat returns to the standard question number formatting.
+% \CorrectChoiceDeclarations{\bfseries}
%
+% and so, when solutions are being printed, the correct choice is
+% printed in boldface by default. If, e.g., you give the command
%
+% \usepackage{color}
%
-% The standard options
-% a4paper
-% a5paper
-% b5paper
-% letterpaper
-% legalpaper
-% executivepaper
-% landscape
-% now all work.
-%
+% after the \documentclass command and then give the command
%
+% \CorrectChoiceDeclarations{\color{red}}
%
-% Two new commands for use in \pointname, \marginpointname, and
-% \qformat:
+% then the correct choice will be printed in red. If, e.g., you give
+% the command
%
-% \points expands to either ``point'' or ``points'', depending on
-% whether the number of points is 1 or other than 1.
+% \CorrectChoiceDeclarations{\color{red}\bfseries}
%
-% \marks expands to either ``mark'' or ``marks'', depending on
-% whether the number of points is 1 or other than 1.
+% then the correct choice will be printed in red and in boldface.
%
+% Note added later: \CorrectChoiceDeclarations was changed
+% to \CorrectChoiceEmphasis in version 2.202$\beta$.
%
%--------------------------------------------------------------------
%--------------------------------------------------------------------
-%
-% The only change from version 2.0 to version 2.01 is that this
-% documentclass (and its accompanying documentation) is now
-% explicitly distributed under the LaTeX Project Public License.
-%
-%--------------------------------------------------------------------
%--------------------------------------------------------------------
\NeedsTeXFormat{LaTeX2e}
@@ -934,10 +769,29 @@
\RequirePackage{ifthen}
-\newif\if@printanswers
-\@printanswersfalse
-\DeclareOption{answers}{\@printanswerstrue}
-\DeclareOption{noanswers}{\@printanswersfalse}
+\newif\ifprintanswers
+\printanswersfalse
+\DeclareOption{answers}{\printanswerstrue}
+\DeclareOption{noanswers}{\printanswersfalse}
+
+% The following keeps track of whether the user has requested that we
+% add up the points on the exam. We make the default false so that
+% users who put other than numbers into the points argument of a
+% question (or part, or subpart) won't get error messages.
+% We use \if@printtotalpoints as a flag to signal that we are counting
+% points, so that we will know to print the total on the screen (and
+% in the log file). We use this separate flag so that the user can
+% use both \addpoints and \noaddpoints to count some points and not
+% others, but still have the total printed when we finish the file no
+% matter what the state of \if@addpoints.
+\newif\if@addpoints
+\newif\if@printtotalpoints
+\def\addpoints{\global\@addpointstrue\global\@printtotalpointstrue}
+\def\noaddpoints{\global\@addpointsfalse}
+\@addpointsfalse
+\@printtotalpointsfalse
+\DeclareOption{addpoints}{\addpoints}
+
\DeclareOption*{%
\PassOptionsToClass{\CurrentOption}{article}%
@@ -983,10 +837,6 @@
\setlength{\marginparwidth}{.5in}
\setlength{\marginparsep}{5pt}
-
-
-
-
%--------------------------------------------------------------------
% ****************
@@ -1014,9 +864,6 @@
\advance\@rightmargin by -\@extrawidth
}
-
-
-
%--------------------------------------------------------------------
%--------------------------------------------------------------------
% Making room for large headers and footers
@@ -1053,7 +900,6 @@
\setlength{\covrun@exft}{0in}
\setlength{\covfp@exft}{0in}
-
\newcommand*\adj@hdht@ftht{%
\if@coverpages
\ifnum\value{page}=1
@@ -1074,7 +920,6 @@
\fi
}
-
\newcommand*\extraheadheight{%
\@ifnextchar[{\@xtrahd}{\@ytrahd}%
}
@@ -1107,7 +952,6 @@
\adj@hdht@ftht
}
-
\newcommand*\coverextraheadheight{%
\@ifnextchar[{\cov@xtrahd}{\cov@ytrahd}%
}
@@ -1285,8 +1129,6 @@
}%
}
-
-
\newcommand*\@dohead{%
\def\@oddhead{%
\if@coverpages
@@ -1335,9 +1177,6 @@
\let\@evenfoot=\@oddfoot
}
-
-
-
%--------------------------------------------------------------------
% \@fullhead, \run@fullhead, \@fullfoot, and \run@fullfoot:
@@ -1358,7 +1197,6 @@
}% vbox
}
-
\newcommand*\run@fullhead{%
\vbox to \headheight{%
\vss
@@ -1376,8 +1214,6 @@
}% vbox
}
-
-
% We arrange it so that the very top of first line of text in the
% foot is at a fixed position on the page, whether or not there's
% a footrule:
@@ -1400,7 +1236,6 @@
}% vbox
}
-
\newcommand*\run@fullfoot{%
\vbox to 0pt{%
\ifrun@footrule
@@ -1440,7 +1275,6 @@
}% vbox
}
-
\newcommand*\covrun@fullhead{%
\vbox to \headheight{%
\vss
@@ -1458,8 +1292,6 @@
}% vbox
}
-
-
% We arrange it so that the very top of first line of text in the
% foot is at a fixed position on the page, whether or not there's
% a footrule:
@@ -1482,7 +1314,6 @@
}% vbox
}
-
\newcommand*\covrun@fullfoot{%
\vbox to 0pt{%
\ifcovrun@footrule
@@ -1501,7 +1332,6 @@
}% vbox
}
-
%--------------------------------------------------------------------
%--------------------------------------------------------------------
%
@@ -1563,7 +1393,6 @@
\runningheader{#1}{#2}{#3}%
}
-
\def\firstpagefooter#1#2#3{%
\def\@lfoot{#1}%
\def\@cfoot{#2}%
@@ -1581,8 +1410,6 @@
\runningfooter{#1}{#2}{#3}%
}
-
-
\def\lhead{\@ifnextchar[{\@xlhead}{\@ylhead}}
\def\@xlhead[#1]#2{\def\@lhead{#1}\def\run@lhead{#2}}
\def\@ylhead#1{\def\run@lhead{#1}\def\@lhead{#1}}
@@ -1610,8 +1437,6 @@
% Initialize head and foot:
-
-
\pagestyle{headandfoot}
\lhead{}
@@ -1679,7 +1504,6 @@
\coverrunningheader{#1}{#2}{#3}%
}
-
\def\coverfirstpagefooter#1#2#3{%
\def\cov@lfoot{#1}%
\def\cov@cfoot{#2}%
@@ -1697,8 +1521,6 @@
\coverrunningfooter{#1}{#2}{#3}%
}
-
-
\def\coverlhead{\@ifnextchar[{\cov@xlhead}{\cov@ylhead}}
\def\cov@xlhead[#1]#2{\def\cov@lhead{#1}\def\covrun@lhead{#2}}
\def\cov@ylhead#1{\def\covrun@lhead{#1}\def\cov@lhead{#1}}
@@ -1726,7 +1548,6 @@
% Initialize coverpage head and foot:
-
\coverlhead{}
\coverchead{}
\coverrhead{}
@@ -1754,8 +1575,6 @@
\def\headrule{\@headruletrue\run@headruletrue}
\def\noheadrule{\@headrulefalse\run@headrulefalse}
-
-
\newif\if@footrule
\newif\ifrun@footrule
@@ -1768,14 +1587,11 @@
\def\footrule{\@footruletrue\run@footruletrue}
\def\nofootrule{\@footrulefalse\run@footrulefalse}
-
-
% Initialize:
\noheadrule
\nofootrule
-
% Cover page headrules and footrules:
\newif\ifcov@headrule
@@ -1790,8 +1606,6 @@
\def\coverheadrule{\cov@headruletrue\covrun@headruletrue}
\def\nocoverheadrule{\cov@headrulefalse\covrun@headrulefalse}
-
-
\newif\ifcov@footrule
\newif\ifcovrun@footrule
@@ -1804,15 +1618,11 @@
\def\coverfootrule{\cov@footruletrue\covrun@footruletrue}
\def\nocoverfootrule{\cov@footrulefalse\covrun@footrulefalse}
-
-
% Initialize:
\nocoverheadrule
\nocoverfootrule
-
-
%--------------------------------------------------------------------
%--------------------------------------------------------------------
@@ -1825,73 +1635,103 @@
% the number of questions as \numquestions,
% the number of parts as \numparts, and
% the number of subparts as \numsubparts
-%\def\numpages{\pageref{@lastpage}}
-%\def\numpoints{\pageref{@numpoints}}
-%\def\numquestions{\pageref{@numquestions}}
-%\def\numparts{\pageref{@numparts}}
-%\def\numsubparts{\pageref{@numsubparts}}
-%\def\numsubsubparts{\pageref{@numsubsubparts}}
-
-% This was previously done with \pageref commands. When I eliminated
-% all \label, \ref, and \pageref commands in order to make this
-% compatible with hyperref.sty, this stuff was created:
-
-% \gdef commands for exam@lastpage, exam@numpoints, exam@numquestions,
-% exam@numparts, exam@numsubparts and exam@numsubsubparts are written to
-% the .aux file via \AtEndDocument.
-
-% \gdef commands for pointsofq@i, pointsofq@ii, etc. are written to the
-% .aux file as each question is completed (see the definition of the
+
+% This was previously done with \pageref commands. When I stopped
+% using \pageref for this (in order to make this compatible with
+% hyperref.sty), this stuff was created:
+
+% \gdef commands for exam@lastpage, exam@numpoints,
+% exam@numbonuspoints, exam@numquestions, exam@numparts,
+% exam@numsubparts and exam@numsubsubparts are written to the .aux
+% file via \AtEndDocument.
+
+% \gdef commands for pointsofq@i, pointsofq@ii, etc. and
+% bonuspointsofq@i, bonuspointsofq@ii, etc. are written to the .aux
+% file as each question is completed (see the definition of the
% questions environment).
-% \gdef commands for pointsonpage@i, pointsonpage@ii, etc. are written
-% to the .aux file as we encounter points defined for a later page, and
-% for the last such page with AtEndDocument.
+% \gdef commands for pointsonpage@i, pointsonpage@ii, etc. and
+% bonuspointsonpage@i, bonuspointsonpage@ii, etc. are written to the
+% .aux file as we encounter points defined for a later page, and for
+% the last such page with AtEndDocument.
\def\numpages{\@ifundefined{exam@lastpage}%
{\mbox{\normalfont\bf ??}}%
\exam@lastpage
-}
+}% numpages
\def\numpoints{\@ifundefined{exam@numpoints}%
{\mbox{\normalfont\bf ??}}%
\exam@numpoints
-}
+}% numpoints
+\def\numbonuspoints{\@ifundefined{exam@numbonuspoints}%
+ {\mbox{\normalfont\bf ??}}%
+ \exam@numbonuspoints
+}% numbonuspoints
\def\numquestions{\@ifundefined{exam@numquestions}%
{\mbox{\normalfont\bf ??}}%
\exam@numquestions
-}
+}% numquestions
\def\numparts{\@ifundefined{exam@numparts}%
{\mbox{\normalfont\bf ??}}%
\exam@numparts
-}
+}% numparts
\def\numsubparts{\@ifundefined{exam@numsubparts}%
{\mbox{\normalfont\bf ??}}%
\exam@numsubparts
-}
+}% numsubparts
\def\numsubsubparts{\@ifundefined{exam@numsubsubparts}%
{\mbox{\normalfont\bf ??}}%
\exam@numsubsubparts
-}
+}% numsubsubparts
\def\pointsofquestion#1{\@ifundefined{pointsofq@\romannumeral #1}%
{\mbox{\normalfont\bf ??}}%
{\csname pointsofq@\romannumeral #1\endcsname}%
-}
+}% pointsofquestion
+\def\bonuspointsofquestion#1{\@ifundefined{bonuspointsofq@\romannumeral #1}%
+ {\mbox{\normalfont\bf ??}}%
+ {\csname bonuspointsofq@\romannumeral #1\endcsname}%
+}% bonuspointsofquestion
\def\pointsonpage#1{\@ifundefined{pointsonpage@\romannumeral #1}%
{\mbox{\normalfont\bf ??}}%
{\csname pointsonpage@\romannumeral #1\endcsname}%
-}
+}% pointsonpage
+\def\bonuspointsonpage#1{\@ifundefined{bonuspointsonpage@\romannumeral #1}%
+ {\mbox{\normalfont\bf ??}}%
+ {\csname bonuspointsonpage@\romannumeral #1\endcsname}%
+}% bonuspointsonpage
\newif\if@pointschanged
\@pointschangedfalse
+\newcommand*{\CheckIfChanged@hlf}[2]{%
+ % The first argument is the name of a half counter.
+ % The second argument expands to the name (without the escape
+ % character, and not assumed to be defined) of the control sequence
+ % holding the previous value.
+ \@ifundefined{#2}%
+ {\global\@pointschangedtrue}%
+ {%
+ % OK; it's defined. See if it's changed:
+ \begingroup
+ \set@hlfcntr{tmp@hlfcntr}{\csname #2\endcsname}%
+ \edef\othpt@check{\prtaux@hlfcntr{tmp@hlfcntr}}%
+ \edef\pt@check{\prtaux@hlfcntr{#1}}%
+ \ifx \pt@check \othpt@check
+ % Do nothing
+ \else
+ \global\@pointschangedtrue
+ \fi
+ \endgroup
+ }%
+}% CheckIfChanged@hlf
%%%\let\@realenddocument=\enddocument
@@ -1904,7 +1744,6 @@
%%% \@realenddocument
%%%}
-
\AtEndDocument{%
\clearpage
\if@filesw
@@ -1913,23 +1752,15 @@
{\string\gdef\string\exam@lastpage{\arabic{page}}}%
\advance\c@page+1 % In case some other package looks at \c@page
\immediate\write\@mainaux
- {\string\gdef\string\exam@numpoints{\prtaux@hlfcntr{numpoints}}}%
+ {\string\gdef\string\exam@numpoints{%
+ \prtaux@hlfcntr{numpoints}}}%
% See if this has changed from the last run of LaTeX:
- \@ifundefined{exam@numpoints}%
- {\global\@pointschangedtrue}%
- {%
- % OK; it's defined. See if it's changed:
- \begingroup
- \set@hlfcntr{tmp@hlfcntr}{\exam@numpoints}%
- \edef\othpt@check{\prtaux@hlfcntr{tmp@hlfcntr}}%
- \edef\pt@check{\prtaux@hlfcntr{numpoints}}%
- \ifx \pt@check \othpt@check
- % Do nothing
- \else
- \global\@pointschangedtrue
- \fi
- \endgroup
- }%
+ \CheckIfChanged@hlf{numpoints}{exam@numpoints}%
+ \immediate\write\@mainaux
+ {\string\gdef\string\exam@numbonuspoints{%
+ \prtaux@hlfcntr{numbonuspoints}}}%
+ % See if this has changed from the last run of LaTeX:
+ \CheckIfChanged@hlf{numbonuspoints}{exam@numbonuspoints}%
\immediate\write\@mainaux
{\string\gdef\string\exam@numquestions{\thenumquestions}}%
\immediate\write\@mainaux
@@ -1944,23 +1775,16 @@
\csname c@pageof@pagepoints\endcsname
{\prtaux@hlfcntr{@pagepoints}}}%
% See if this has changed from the last run of LaTeX:
- \@ifundefined{pointsonpage@\romannumeral
+ \CheckIfChanged@hlf{@pagepoints}{pointsonpage@\romannumeral
\csname c@pageof@pagepoints\endcsname}%
- {\global\@pointschangedtrue}%
- {%
- % OK; it's defined. See if it's changed:
- \begingroup
- \set@hlfcntr{tmp@hlfcntr}{\csname pointsonpage@\romannumeral
- \csname c@pageof@pagepoints\endcsname\endcsname}%
- \edef\othpt@check{\prtaux@hlfcntr{tmp@hlfcntr}}%
- \edef\pt@check{\prtaux@hlfcntr{@pagepoints}}%
- \ifx \pt@check \othpt@check
- % Do nothing
- \else
- \global\@pointschangedtrue
- \fi
- \endgroup
- }%
+ \fi
+ \ifnum \thepageof@pagebonuspoints > 0\relax
+ \immediate\write\@mainaux
+ {\string\gdef\string\bonuspointsonpage@\romannumeral
+ \csname c@pageof@pagebonuspoints\endcsname
+ {\prtaux@hlfcntr{@pagebonuspoints}}}%
+ \CheckIfChanged@hlf{@pagebonuspoints}{bonuspointsonpage@\romannumeral
+ \csname c@pageof@pagebonuspoints\endcsname}%
\fi
\immediate\write\@mainaux
{\string\gdef\string\lastpage@withpoints{\page@withpoints}}%
@@ -1979,6 +1803,23 @@
\fi
\endgroup
}%
+ \immediate\write\@mainaux
+ {\string\gdef\string\lastpage@withbonuspoints{\page@withbonuspoints}}%
+ % See if this has changed from the last run of LaTeX:
+ \@ifundefined{lastpage@withbonuspoints}%
+ {\global\@pointschangedtrue}%
+ {%
+ % OK; it's defined. See if it's changed:
+ \begingroup
+ \edef\othpt@check{\page@withbonuspoints}%
+ \edef\pt@check{\lastpage@withbonuspoints}%
+ \ifx \pt@check \othpt@check
+ % Do nothing
+ \else
+ \global\@pointschangedtrue
+ \fi
+ \endgroup
+ }%
\fi
% Echo numbers of questions, parts, and subparts:
\typeout{This exam contains \thenumquestions\space questions
@@ -1994,13 +1835,20 @@
\fi
}
\typeout{This exam has a total of \typ@expnd\space points.}
+ \def\typ@expnd{%
+ \thenumbonuspoints
+ \ifnumbonuspoints@half
+ \space and a half%
+ \fi
+ }
+ \typeout{This exam has a total of \typ@expnd\space bonus points.}
\endgroup
\fi
\if@pointschanged
\ClassWarningNoLine{exam}{Point totals have changed.
Rerun to get point totals right}%
\fi
-}
+}% AtEndDocument
% We define \iflastpage so that it can safely be used
@@ -2008,12 +1856,12 @@
\def\iflastpage#1#2{%
\@ifundefined{exam@lastpage}{\def\@@lastpage{-1}}%
{\edef\@@lastpage{\exam@lastpage}}%
- \ifnum\value{page}=\@@lastpage
+ \ifnum\value{page}=\@@lastpage\relax
#1%
\else
#2%
\fi
-}
+}% iflastpage
% The macro \oddeven takes two arguments. If the page number is odd,
@@ -2025,7 +1873,7 @@
\else
#2
\fi
-}
+}% oddeven
@@ -2048,7 +1896,7 @@
% with hyperref.sty, which redefines those commands.)
% We use \PgInfo, \PgInfo@write, and \PgInfo@get to know on which page
-% each question, part, subpart, and subsubpart appears.
+% each question, part, subpart, subsubpart, and choice appears.
% We use \PgInfo@write to write \PgInfo commands to the .aux file. The
% \PgInfo command takes two arguments: A question (or part, or subpart,
@@ -2066,6 +1914,10 @@
% The label for a subsubpart is of the form `subsubpart@2@1@3@4' (if
% it's subsubpart $\delta$ of subpart iii of part a of question 2).
+% Each question, part, subpart, subsubpart, and choice also gets a
+% \PgInfo@write command using a label of the form question2@object3 (if
+% it's the third object of the second question).
+
% The \PgInfo command defines a control sequence of the form `Pg@label'
% that expands to the page number for the corresponding question. For
% example, \PgInfo{subsubpart@2@1@3@4}{7} defines
@@ -2108,15 +1960,14 @@
% *before* calling \Pginfo@get
\def\PgInfo@get#1{\csname Pg@#1\endcsname}
-% \set@counter@to@pageof takes two arguments: The first is the name
-% of a counter, and the second (expands to) the label of a question,
-% part, subpart, or subsubpart. If that label exists, then we set
-% the counter equal to the page on which the question (or part, etc.)
-% appears. If that label doesn't exist, we set the counter equal
-% to -1. (No labels exist on the first run of LaTeX on the file,
-% and if a new question (or part, etc.) was created by editing the
-% file, then the label will not exist until the second run of LaTeX
-% after that.
+% \set@counter@to@pageof takes two arguments: The first is the name of a
+% counter, and the second (expands to) the label of a question, part,
+% subpart, subsubpart, or choice. If that label exists, then we set the
+% counter equal to the page on which the question (or part, etc.)
+% appears. If that label doesn't exist, we set the counter equal to -1.
+% (No labels exist on the first run of LaTeX on the file, and if a new
+% question (or part, etc.) was created by editing the file, then the
+% label will not exist until the run of LaTeX after that.)
\def\set@counter@to@pageof#1#2{%
\@ifundefined{Pg@#2}%
{\setcounter{#1}{-1}}%
@@ -2128,8 +1979,8 @@
% \ifcontinuation#1#2 expands to #2 if either: (1) The current page is
% before the page containing question number 1, or (2) A question begins
-% on this page before any part, subpart, or subsubpart begins, or (3)
-% The current page is later than a page with the \nomorequestions
+% on this page before any part, subpart, subsubpart, or choice begins,
+% or (3) The current page is later than a page with the \nomorequestions
% command. Otherwise, it expands to #1.
@@ -2182,8 +2033,6 @@
\PgInfo@write{@endquestions}%
}
-
-
%--------------------------------------------------------------------
% \ContinuedQuestion is for use in headers and footers, where we can
% assume that \thepage is the number of the page on which we'll
@@ -2195,14 +2044,14 @@
% ACTUALLY: \ContinuedQuestion expands to a positive number if either
% (1) this page doesn't contain the beginning of any question, part,
-% subpart, or subsubpart, or (2) this page has a part, subpart, or
-% subsubpart that appears before any question. That means that if the
-% current page actually begins with space for a continuation of the
-% previous question (but doesn't begin any part, subpart, or subsubpart
-% of that question) and then has a question, then we'll be asserting
-% that this page begins with a new question, but the actual top of the
-% page will begin with some blank space that's intended for the previous
-% question.
+% subpart, subsubpart, or choice, or (2) this page has a part, subpart,
+% subsubpart, or choice that appears before any question. That means
+% that if the current page actually begins with space for a continuation
+% of the previous question (but doesn't begin any part, subpart,
+% subsubpart, or choice of that question) and then has a question, then
+% we'll be asserting that this page begins with a new question, but the
+% actual top of the page will begin with some blank space that's
+% intended for the previous question.
% \ContinuedQuestion works by examining the value of the macro
% Contin@\thepage. If this page starts with a question (i.e., if no
@@ -2213,22 +2062,22 @@
% If Contin@\thepage is undefined, then when it is used in an \ifx
% command it will be temporarily set equal to \relax (which is
% *different* from being a macro that expands to \relax); in this case,
-% there is no question, part, subpart, or subsubpart that begins on this
-% page, and so \ContinuedQuestion will be set equal to the last question
-% that was begun on a page before this one.
+% there is no question, part, subpart, subsubpart, or choice that begins
+% on this page, and so \ContinuedQuestion will be set equal to the last
+% question that was begun on a page before this one.
% The last possibility is that this page begins with either a part,
-% subpart, or subsubpart. In this case, Contin@\thepage is defined, and
-% it expands to the number of the question that is continues onto this
-% page.
+% subpart, subsubpart, or choice. In this case, Contin@\thepage is
+% defined, and it expands to the number of the question that is
+% continues onto this page.
\def\ref@relax{\relax}
\def\ContinuedQuestion{%
\expandafter\ifx\csname Contin@\thepage\endcsname\relax
- % We get here if there's no question, part, subpart, or
- % subsubpart on this page, and so Contin@\thepage has
+ % We get here if there's no question, part, subpart,
+ % subsubpart, or choice on this page, and so Contin@\thepage has
% never been defined at all. In that case, this page
% continues whichever question was last begun on or
% before this page.
@@ -2240,10 +2089,10 @@
% which is why Contin@\thepage has been defined to be
% a macro that expands to \relax.
% ACTUALLY: We get here if this page has a question that
- % appears before any part, subpart, or subsubpart. That
+ % appears before any part, subpart, subsubpart, or choice. That
% means that if the current page actually begins with space
% for a continuation of the previous question but doesn't begin
- % any part, subpart, or subsubpart of that question, then
+ % any part, subpart, subsubpart, or choice of that question, then
% we'll be asserting that this page begins with a new question,
% but the actual top of the page will begin with some space
% that's intended for the previous question.
@@ -2331,18 +2180,18 @@
\fi
\next@dlq
}
-
-
%--------------------------------------------------------------------
%--------------------------------------------------------------------
%--------------------------------------------------------------------
\newcounter{ques@end}
+\newcounter{last@object}
+
\def\find@quesend{%
% We find the last question started on or before the current page
% and then find the page containing the last part (or subpart, or
- % subsubpart) of that question, and set the counter ques@end to that
- % page number.
+ % subsubpart, or choice) of that question, and set the counter
+ % ques@end to that page number.
% Set latest@ques equal to the correct question number:
\find@latestques
\ifnum \value{latest@ques} < 0\relax
@@ -2350,117 +2199,39 @@
% \PgInfo commands in the .aux file:
\setcounter{ques@end}{-1}%
\else
- % See if this question has any parts. (It has one or more parts
- % if and only if it has a part number 1.)
- \@ifundefined{Pg@part@\thelatest@ques @1}%
- {%
- % Nope; no parts.
- \setcounter{ques@end}{\PgInfo@get{question@\thelatest@ques}}%
- }%
- {\find@part}%
+ % We now know that this question has at least one object (since
+ % we know that latest@ques isn't negative).
+ % We'll find its highest numbered object by setting last@object
+ % equal to 2 and then calling \find@lastobject to recursively
+ % test whether that object number exists and, if so, incrementing
+ % last@object to test for a higher numbered one:
+ \setcounter{last@object}{2}%
+ \find@lastobject
+ \setcounter{ques@end}{\PgInfo@get{question\thelatest@ques
+ @object\thelast@object}}%
\fi
-}
-
-\newcounter{last@part}
-\def\find@part{%
- % We now know that this question has at least one part.
- % We'll find its highest numbered part by setting last@part
- % equal to 2 and then calling \find@lastpart to recursively
- % test whether that part number exists and, if so, incrementing
- % last@part to test for a higher numbered one:
- \setcounter{last@part}{2}%
- \find@lastpart
- % Now: See if this part has any subparts. (It has one or more
- % subparts if and only if it has a subpart numbered 1.)
- \@ifundefined{Pg@subpart@\thelatest@ques @\thelast@part @1}%
- {%
- % Nope; no subparts.
- \setcounter{ques@end}{\PgInfo@get{part@\thelatest@ques
- @\thelast@part}}%
+}% find@quesend
+
+\def\find@lastobject{%
+ % We check whether this question has an object numbered last@object
+ % and recursively increment last@object to find the highest
+ % numbered value for which the object exists:
+ \@ifundefined{Pg@question\thelatest@ques @object\thelast@object}%
+ {\addtocounter{last@object}{-1}%
+ \let\nextfind@lastobject=\relax
}%
- {\find@subpart}%
-}
-
-\def\find@lastpart{%
- % We check whether this question has a part numbered last@part
- % and recursively increment last@part to find the highest
- % numbered value for which the part exists:
- \@ifundefined{Pg@part@\thelatest@ques @\thelast@part}%
- {\addtocounter{last@part}{-1}%
- \let\nextfind@lastpart=\relax
- }%
- {\addtocounter{last@part}{1}%
- \let\nextfind@lastpart=\find@lastpart
- }%
- \nextfind@lastpart
-}
-
-\newcounter{last@subpart}
-\def\find@subpart{%
- % We now know that this part has at least one subpart.
- % We'll find its highest numbered subpart by setting last@subpart
- % equal to 2 and then calling \find@lastsubpart to recursively
- % test whether that subpart number exists and, if so, incrementing
- % last@subpart to test for a higher numbered one:
- \setcounter{last@subpart}{2}%
- \find@lastsubpart
- % Now: See if this subpart has any subsubparts. (It has one or more
- % subsubparts if and only if it has a subsubpart numbered 1.)
- \@ifundefined{Pg@subsubpart@\thelatest@ques
- @\thelast@part @\thelast@subpart @1}%
- {%
- % Nope; no subsubparts
- \setcounter{ques@end}{\PgInfo@get{subpart@\thelatest@ques
- @\thelast@part @\thelast@subpart}}%
+ {\addtocounter{last@object}{1}%
+ \let\nextfind@lastobject=\find@lastobject
}%
- {\find@subsubpart}%
-}
+ \nextfind@lastobject
+}% find@lastobject
-\def\find@lastsubpart{%
- % We check whether this part has a subpart numbered last@subpart
- % and recursively increment last@subpart to find the highest
- % numbered value for which the subpart exists:
- \@ifundefined{Pg@subpart@\thelatest@ques
- @\thelast@part @\thelast@subpart}%
- {\addtocounter{last@subpart}{-1}%
- \let\nextfind@lastsubpart=\relax
- }%
- {\addtocounter{last@subpart}{1}%
- \let\nextfind@lastsubpart=\find@lastsubpart
- }%
- \nextfind@lastsubpart
-}
-
-\newcounter{last@subsubpart}
-\def\find@subsubpart{%
- % We now know that this subpart has at least one subsubpart.
- % We'll find its highest numbered subsubpart by setting last@subsubpart
- % equal to 2 and then calling \find@lastsubsubpart to recursively
- % test whether that subsubpart number exists and, if so, incrementing
- % last@subsubpart to test for a higher numbered one:
- \setcounter{last@subsubpart}{2}%
- \find@lastsubsubpart
- \setcounter{ques@end}{\PgInfo@get{subsubpart@\thelatest@ques
- @\thelast@part @\thelast@subpart @\thelast@subsubpart}}%
-}
-
-\def\find@lastsubsubpart{%
- % We check whether this subpart has a subsubpart numbered last@subsubpart
- % and recursively increment last@subsubpart to find the highest
- % numbered value for which the subsubpart exists:
- \@ifundefined{Pg@subsubpart@\thelatest@ques
- @\thelast@part @\thelast@subpart @\thelast@subsubpart}%
- {\addtocounter{last@subsubpart}{-1}%
- \let\nextfind@lastsubsubpart=\relax
- }%
- {\addtocounter{last@subsubpart}{1}%
- \let\nextfind@lastsubsubpart=\find@lastsubsubpart
- }%
- \nextfind@lastsubsubpart
-}
%--------------------------------------------------------------------
+%--------------------------------------------------------------------
+%--------------------------------------------------------------------
+
\newcounter{incmp@ques}
\def\IncompleteQuestion{%
@@ -2497,7 +2268,6 @@
\fi
}
-
\def\ifincomplete#1#2{%
\def\incomp@first{#1}%
\def\incomp@second{#2}%
@@ -2516,27 +2286,6 @@
\fi
}
-
-
-
-%---------------------------------------------------------------------
-%
-% ***************************
-% ** QUESTION ENVIRONMENTS **
-% ***************************
-%
-%
-%
-
-% We define the command \part only inside of a parts environment, so
-% that we don't interfere with the meaning of the standard article
-% documentclass command \part if that is used inside of a questions
-% environment. The commands \question, \subpart, and \subsubpart are
-% defined everywhere inside of a questions environment. If the user
-% accidentally gives a \subpart command outside of a subparts
-% environment, then an error will be created.
-
-
%--------------------------------------------------------------------
% These are the commands for dealing with hlfcntr's, i.e., the things
% used to count points.
@@ -2549,12 +2298,14 @@
%
% The commands:
%
+% \new@hlfcntr{countername}
% \set@hlfcntr{countername}{value}
% \copy@hlfcntr{tocounter}{fromcounter}
% \addto@hlfcntr{countername}{value}
-% \add@hlfcntrtohlfcntr
+% \add@hlfcntrtohlfcntr{getsaddedto}{whatsadded}
% \ifhlfcntr@pos{countername}
% \prtaux@hlfcntr{countername}
+% \prt@hlfcntr{countername}
%
% ``value'' can be either a (nonnegative) integer, an integer followed by
% ``\half'', or just plain ``\half''. (Actually, ``value'' can be empty
@@ -2576,52 +2327,66 @@
% \ifsomething) aren't. Thus, we need to say ``\global'' when setting
% these things.
+% To create a hlfcntr:
+\newcommand*\new@hlfcntr[1]{%
+ \newcounter{#1}%
+ \expandafter\newif\csname if#1@half\endcsname
+}% new@hlfcntr
+
+
% A scratch hlfcntr:
-\newcounter{tmp@hlfcntr}
-\newif\iftmp@hlfcntr@half
+\new@hlfcntr{tmp@hlfcntr}
\newcommand*\horiz@half{$\frac{1}{2}$}
\newcommand*\slanted@half{%
$\raise0.6ex\hbox{$\scriptstyle 1$}\kern -.2em/\kern -.2em
\raise-0.5ex\hbox{$\scriptstyle 2$}$%
-}
-\newcommand*\useslantedhalf{\let\half\slanted@half}
-\newcommand*\usehorizontalhalf{\let\half\horiz@half}
+}% slanted@half
+\newcommand*\useslantedhalf{\global\let\half\slanted@half}
+\newcommand*\usehorizontalhalf{\global\let\half\horiz@half}
\newcommand*\half{\slanted@half}
\newcommand*\set@hlfcntr[2]{%
\begingroup
- \expandafter\global\csname #1@halffalse\endcsname
+ \global\csname #1@halffalse\endcsname
% If there as a `\half' present, it will be executed
% right after the assignment of the digit part of #2
% to the counter #1.
\def\half{%
- \expandafter\global\csname #1@halftrue\endcsname
+ \global\csname #1@halftrue\endcsname
}%
% We insert a `0' in case there are no digits present:
- \setcounter{#1}{0#2}\relax
+ % We avoid using \setcounter, because calc.sty redefines
+ % \setcounter in a way that conflicts with the \half trick
+ % we're using:
+ % \setcounter{#1}{0#2}\relax
+ \global\csname c@#1\endcsname 0#2\relax
\endgroup
-}
+}% set@hlfcntr
\newcommand*\copy@hlfcntr[2]{%
% We set #1 to the value of #2
\setcounter{#1}{\value{#2}}%
\csname if#2@half\endcsname
- \expandafter\global\csname #1@halftrue\endcsname
+ \global\csname #1@halftrue\endcsname
\else
- \expandafter\global\csname #1@halffalse\endcsname
+ \global\csname #1@halffalse\endcsname
\fi
-}
+}% copy@hlfcntr
\newcommand*\addto@hlfcntr[2]{%
% We add the valueandhalf #2 to hlfcntr #1
\begingroup
\def\half{\add@half{#1}}%
% We insert a `0' in case there are no digits present:
- \addtocounter{#1}{0#2}\relax
+ % We avoid using \addtocounter, because calc.sty redefines
+ % \addtocounter in a way that conflicts with the \half trick
+ % we're using:
+ % \addtocounter{#1}{0#2}\relax
+ \global\advance\csname c@#1\endcsname 0#2\relax
\endgroup
-}
+}% addto@hlfcntr
\newcommand*\add@hlfcntrtohlfcntr[2]{%
% We add the hlfcntr #2 to the hlfcntr #1
@@ -2629,17 +2394,17 @@
\csname if#2@half\endcsname
\add@half{#1}%
\fi
-}
+}% add@hlfcntrtohlfcntr
\newcommand*\add@half[1]{%
% We add one half to hlfcntr #1:
\csname if#1@half\endcsname
\addtocounter{#1}{1}%
- \expandafter\global\csname #1@halffalse\endcsname
+ \global\csname #1@halffalse\endcsname
\else
- \expandafter\global\csname #1@halftrue\endcsname
+ \global\csname #1@halftrue\endcsname
\fi
-}
+}% add@half
\newcounter{ifpos@cntr}
\def\ifhlfcntr@pos#1{%
@@ -2651,7 +2416,7 @@
\addtocounter{ifpos@cntr}{1}%
\fi
\ifnum \value{ifpos@cntr} > 0
-}
+}% ifhlfnctr@pos
% \prtaux@hlfcntr is used inside the argument of a \write command for
% writing to the .aux file:
@@ -2670,20 +2435,68 @@
% there's no \if visible until the \csname is expanded:
\prtaux@halforblank{#1}%
\fi
-}
+}% prtaux@hlfcntr
\newcommand*\prtaux@halforzero[1]{%
\csname if#1@half\endcsname
\string\half
\else
0%
\fi
-}
+}% prtaux@hlforzero
\newcommand*\prtaux@halforblank[1]{%
\csname if#1@half\endcsname
\string\half
\fi
-}
+}% prtaux@halforblank
+
+\newcommand*\prt@hlfcntr[1]{%
+ % We don't want a \relax after the 0 in the following
+ % line, because it would sometimes appear in the aux file:
+ \ifnum \value{#1} = 0
+ % We have to make the following a macro, because if we
+ % don't do this part, the \fi will cause confusion, since
+ % there's no \if visible until the \csname is expanded:
+ \prt@halforzero{#1}%
+ \else
+ \arabic{#1}%
+ % We have to make the following a macro, because if we
+ % don't do this part, the \fi will cause confusion, since
+ % there's no \if visible until the \csname is expanded:
+ \prt@halforblank{#1}%
+ \fi
+}% prt@hlfcntr
+\newcommand*\prt@halforzero[1]{%
+ \csname if#1@half\endcsname
+ \half
+ \else
+ 0%
+ \fi
+}% prt@hlforzero
+\newcommand*\prt@halforblank[1]{%
+ \csname if#1@half\endcsname
+ \half
+ \fi
+}% prt@halforblank
+
+% End of the commands for dealing with hlfcntr's
+
%--------------------------------------------------------------------
+%---------------------------------------------------------------------
+%
+% ***************************
+% ** QUESTION ENVIRONMENTS **
+% ***************************
+%
+%
+%
+
+% We define the command \part only inside of a parts environment, so
+% that we don't interfere with the meaning of the standard article
+% documentclass command \part if that is used inside of a questions
+% environment. The commands \question, \subpart, and \subsubpart are
+% defined everywhere inside of a questions environment. If the user
+% accidentally gives a \subpart command outside of a subparts
+% environment, then an error will be created.
@@ -2697,12 +2510,14 @@
\newcounter{subpart}
\newcounter{subsubpart}
\newcounter{choice}
-\newcounter{numpoints}
-\newif\ifnumpoints@half
+\new@hlfcntr{numpoints}
\set@hlfcntr{numpoints}{0}
-\newcounter{pointsof@thisquestion}
-\newif\ifpointsof@thisquestion@half
+\new@hlfcntr{numbonuspoints}
+\set@hlfcntr{numbonuspoints}{0}
+\new@hlfcntr{pointsof@thisquestion}
\set@hlfcntr{pointsof@thisquestion}{0}
+\new@hlfcntr{bonuspointsof@thisquestion}
+\set@hlfcntr{bonuspointsof@thisquestion}{0}
\newcounter{numquestions}
\newcounter{numparts}
\newcounter{numsubparts}
@@ -2710,19 +2525,22 @@
\newcounter{Curr@Page}
% @pagepoints accumulates the points on a single page:
-\newcounter{@pagepoints}
-\newif\if@pagepoints@half
-%\setcounter{@pagepoints}{0}
+\new@hlfcntr{@pagepoints}
\set@hlfcntr{@pagepoints}{0}
+\new@hlfcntr{@pagebonuspoints}
+\set@hlfcntr{@pagebonuspoints}{0}
\newcounter{pageof@pagepoints}
\setcounter{pageof@pagepoints}{0}
+\newcounter{pageof@pagebonuspoints}
+\setcounter{pageof@pagebonuspoints}{0}
% latest@points is a holding area for points until we know
% whether they'll land on the same page as the points
% currently counted in @pagepoints:
-\newcounter{latest@points}
-\newif\iflatest@points@half
+\new@hlfcntr{latest@points}
\set@hlfcntr{latest@points}{0}
+\new@hlfcntr{latest@bonuspoints}
+\set@hlfcntr{latest@bonuspoints}{0}
% Whenever we meet a new page on which points are defined, we'll
% redefine \page@withpoints to expand to that page. At the end of the
@@ -2730,10 +2548,11 @@
% a \gdef\lastpage@withpoints command to the .aux file.
% We initialize \page@withpoints here:
\def\page@withpoints{0}%
+\def\page@withbonuspoints{0}%
% \pageinfo@commands is used by each question, part, subpart, and
% subsubpart to insert into everypar the \PgInfo@write command to put
-% its page number inot the .aux file, the \PgInfo@get command to read
+% its page number into the .aux file, the \PgInfo@get command to read
% the page number into the counter Curr@Page, and to test and set
% \Contin@\theCurr@Page. \temp@toks is used by part, subpart, and
% subsubpart to append all that to \pageinfo@commands, rather than
@@ -2760,7 +2579,7 @@
$\rho$\or $\sigma$\or $\tau$\or $\upsilon$\or $\phi$\or $\chi$\or
$\psi$\or $\omega$\else \@ctrerr
\fi
-}%
+}% lc@greek
% The following macros are a variation on a trick from Victor
@@ -2773,24 +2592,26 @@
\def\prepend@toklist#1#2{%
\edef\do@it{\noexpand#1={\the#2\the#1}}%
\do@it
-}%
+}% prepend@toklist
\def\append@toklist#1#2{%
\edef\do@it{\noexpand#1={\the#1\the#2}}%
\do@it
-}%
+}% append@toklist
% The command \qformat is provided for the user who wants to
% design a nonstandard question line. If this command is used,
-% then the usual line containing the question numbers will be
-% replaced by the line specified by the \qformat command.
+% then the usual line containing the question number and the beginning
+% of the question will be replaced by the line specified by the
+% \qformat command, and the question will begin on the following
+% line.
% Within the argument of the \qformat command:
% \thequestion will be replaced by the question number, and
% \thepoints will be replaced by ``\@points \@pointname'' if the
% number of points has been specified for this question, and otherwise
% it inserts nothing at all. (The conditional @placepoints is used to
-% determine if the number of points is nonzero.)
+% determine if there were points specified for this question.)
% The argument to the \qformat command *must* contain some
% stretch, i.e., at least one \hfil or \dotfill or ...
\newif\if@qformat
@@ -2799,17 +2620,43 @@
\def\qformat#1{%
\global\@qformattrue
\gdef\@questionformat{#1}%
-}
+}% qformat
\newcommand\noqformat{%
\global\@qformatfalse
-}
-
+}% noqformat
+
+% \thepoints is for use in either a \qformat command
+% or a \pointformat command. It needs to have the
+% \if@placepoints so that if it's used in a \qformat command
+% it won't print anything if there are no points:
+%\newcommand\thepoints{%
+% \if@placepoints
+% \@points \@pointname
+% \fi
+%}
\newcommand\thepoints{%
\if@placepoints
- \@points \@pointname
+ \if@bonus
+ \@points \@bonuspointname
+ \else
+ \@points \@pointname
+ \fi
\fi
-}
+}% thepoints
+
+% \themarginpoints is for use only in a \pointformat command,
+% and so it doesn't need the \if@placepoints bit in \thepoints:
+%\newcommand\themarginpoints{%
+% \@points \@marginpointname
+%}% themarginpoints
+\newcommand\themarginpoints{%
+ \if@bonus
+ \@points \@marginbonuspointname
+ \else
+ \@points \@marginpointname
+ \fi
+}% themarginpoints
% We define the \subpart and \subsubpart commands when we enter a
% questions environment (rather than waiting until we enter a subparts
@@ -2819,6 +2666,31 @@
% can use the standard sectioning \part command outside of a parts
% environment.)
+% The counter ques@object will count the items in each question, where
+% an item is defined as either the question itself, or a part, or a
+% subpart, or a subsubpart, or a choice. This will be used by
+% \find@quesend to find the last page occupied by the last question
+% begun on or before the current page:
+\newcounter{ques@object}
+
+% if@bonus will be true when we're doing a bonusquestion or bonuspart
+% or etc., and it will also be used also to distinguish between
+% \gradetable and \bonusgradetable (and between \pointtable and
+% \bonuspointtable, etc.):
+\newif\if@bonus
+\@bonusfalse
+
+% The following are for advanced users who want to customize the list
+% parameters (\topsep, \partopsep, \itemsep, \parsep, etc.) for the
+% lists that these environments create. They are all defined to be
+% empty, but the user can change them using \renewcommand.
+\newcommand\questionshook{}
+\newcommand\partshook{}
+\newcommand\subpartshook{}
+\newcommand\subsubpartshook{}
+\newcommand\choiceshook{}
+
+
\newenvironment{questions}{%
% \@queslevel is used for two purposes:
% (1) We check that every \question, \part, \subpart, and
@@ -2829,7 +2701,29 @@
% \global \point@toks={} to avoid setting the points for a
% question other than via the qformat command.
\def\@queslevel{question}%
+ \def\titledquestion##1{%
+ \@bonusfalse
+ \def\thequestiontitle{##1}%
+ \process@question
+ }%
+ \def\bonustitledquestion##1{%
+ \@bonustrue
+ \def\thequestiontitle{##1}%
+ \process@question
+ }%
\def\question{%
+ \@bonusfalse
+ \def\thequestiontitle{\csname p@question\endcsname
+ \csname thequestion\endcsname}%
+ \process@question
+ }%
+ \def\bonusquestion{%
+ \@bonustrue
+ \def\thequestiontitle{\csname p@question\endcsname
+ \csname thequestion\endcsname}%
+ \process@question
+ }%
+ \def\process@question{%
\if@coverpages
\cover@question@error
\fi
@@ -2841,38 +2735,35 @@
% number of the question that was just completed.)
\if@filesw
\ifnum \arabic{question} > 0\relax
+ % First do regular points:
\immediate\write\@mainaux
{\string\gdef\string\pointsofq@
\romannumeral \csname c@question\endcsname
{\prtaux@hlfcntr{pointsof@thisquestion}}}%
% See if this has changed from the last run of LaTeX:
- \@ifundefined{pointsofq@\romannumeral
+ \CheckIfChanged@hlf{pointsof@thisquestion}{pointsofq@\romannumeral
\csname c@question\endcsname}%
- {\global\@pointschangedtrue}%
- {%
- % OK; it's defined. See if it's changed:
- \begingroup
- \set@hlfcntr{tmp@hlfcntr}{\csname pointsofq@\romannumeral
- \csname c@question\endcsname\endcsname}%
- \edef\othpt@check{\prtaux@hlfcntr{tmp@hlfcntr}}%
- \edef\pt@check{\prtaux@hlfcntr{pointsof@thisquestion}}%
- \ifx \pt@check \othpt@check
- % Do nothing
- \else
- \global\@pointschangedtrue
- \fi
- \endgroup
- }%
+ % Now do bonus points:
+ \immediate\write\@mainaux
+ {\string\gdef\string\bonuspointsofq@
+ \romannumeral \csname c@question\endcsname
+ {\prtaux@hlfcntr{bonuspointsof@thisquestion}}}%
+ % See if this has changed from the last run of LaTeX:
+ \CheckIfChanged@hlf{bonuspointsof@thisquestion}%
+ {bonuspointsofq@\romannumeral
+ \csname c@question\endcsname}%
\fi
\fi
\set@hlfcntr{pointsof@thisquestion}{0}%
+ \set@hlfcntr{bonuspointsof@thisquestion}{0}%
% If there was a question with points immediately preceding
% this question (i.e., there were no parts in the previous
% question), then @placepoints will still be true, and we need to
% cancel it. (We used to do this inside of the \thepoints macro,
% but that allowed for an error if the user specified points for a
% question but had a \qformat that didn't mention \thepoints.) We
- % also set @placepoints to be false in the \part command.
+ % also set @placepoints to be false when entering a parts
+ % environment.
\global \@placepointsfalse
% point@toks will normally be empty at this point, but it might be
% nonempty if there were points somewhere in the previous question
@@ -2888,10 +2779,47 @@
\pageinfo@commands={%
\edef\@queslabel{question@\arabic{question}}%
\PgInfo@write{\@queslabel}%
+ \setcounter{ques@object}{1}%
+ \edef\q@object@label{%
+ question\arabic{question}@object\arabic{ques@object}}%
+ \PgInfo@write{\q@object@label}%
+ % In addition to the \PgInfo@write we use an actual \label
+ % command. We do this in order to make the question numbers in
+ % the grade tables into \ref's, so that if the user says
+ % \usepackage{hyperref}, those question numbers will be clickable.
+ %
+ % A further purpose of these labels (which we actually do for all
+ % questions, parts, subparts, and subsubparts) is that if a
+ % question (or part, etc.) is, e.g., moved from one page to
+ % another, LaTeX will notice this and warn the user that LaTeX
+ % must be run one more time to be sure everything is correct.
+ %
+ % We need to do this even though we've already included code to
+ % check when point totals change because questions (and parts,
+ % etc.) know what page they're on from reading the info written to
+ % the .aux file on the previous run. Thus, if a question (or
+ % part, etc.) is moved to a different page, then the pointsonpage
+ % totals won't notice until the *second* subsequent run of LaTeX,
+ % and so there'll be no warning to the user on the *first* run.
+ % Including these labels gives the user a warning on that first
+ % run.
+ %
+ % Further futzing required: Since this is being put into the
+ % token list \pageinfo@commands, the contents of which won't
+ % actually be executed until we enter horizontal mode (which
+ % may well be in the first part of a parts environment), we need
+ % to make sure that \@currentlabel is the number of the
+ % question:
+ \begingroup % to confine the change to \@currentlabel
+% \def\@currentlabel{\csname p@question\endcsname
+% \csname thequestion\endcsname}%
+ \def\@currentlabel{\thequestiontitle}%
+ \label{\@queslabel}%
+ \endgroup
\set@counter@to@pageof{Curr@Page}{\@queslabel}%
\expandafter\ifx\csname Contin@\theCurr@Page\endcsname\relax
- % We're the first \question, \part, \subpart, or \subsubpart
- % on this page:
+ % We're the first \question, \part, \subpart, \subsubpart,
+ % or choice on this page:
\global\expandafter\edef
\csname Contin@\theCurr@Page\endcsname{\relax}%
\fi
@@ -2904,8 +2832,17 @@
\unskip\unskip \par
\fi
\@doitem
- }% question
+ }% process@question
\def\subpart{%
+ \@bonusfalse
+ \process@subpart
+ }%
+ \def\bonussubpart{%
+ \@bonustrue
+ \process@subpart
+ }%
+ \def\process@subpart{%
+ \@bonusfalse
\if@coverpages
\cover@question@error
\fi
@@ -2919,10 +2856,35 @@
\edef\@subpartlabel{subpart@\arabic{question}%
@\arabic{partno}@\arabic{subpart}}%
\PgInfo@write{\@subpartlabel}%
+ \addtocounter{ques@object}{1}%
+ \edef\q@object@label{%
+ question\arabic{question}@object\arabic{ques@object}}%
+ \PgInfo@write{\q@object@label}%
+ % In addition to the \PgInfo@write we use an actual \label
+ % command. We do this in order to make the question numbers in
+ % the grade tables into \ref's, so that if the user says
+ % \usepackage{hyperref}, those question numbers will be clickable.
+ %
+ % A further purpose of these labels (which we actually do for all
+ % questions, parts, subparts, and subsubparts) is that if a
+ % question (or part, etc.) is, e.g., moved from one page to
+ % another, LaTeX will notice this and warn the user that LaTeX
+ % must be run one more time to be sure everything is correct.
+ %
+ % We need to do this even though we've already included code to
+ % check when point totals change because questions (and parts,
+ % etc.) know what page they're on from reading the info written to
+ % the .aux file on the previous run. Thus, if a question (or
+ % part, etc.) is moved to a different page, then the pointsonpage
+ % totals won't notice until the *second* subsequent run of LaTeX,
+ % and so there'll be no warning to the user on the *first* run.
+ % Including these labels gives the user a warning on that first
+ % run.
+ \label{\@subpartlabel}%
\set@counter@to@pageof{Curr@Page}{\@subpartlabel}%
\expandafter\ifx\csname Contin@\theCurr@Page\endcsname\relax
- % We're the first \question, \part, \subpart, or \subsubpart
- % on this page:
+ % We're the first \question, \part, \subpart, \subsubpart,
+ % or choice on this page:
\global\expandafter\edef\csname
Contin@\theCurr@Page\endcsname{\arabic{question}}%
\fi
@@ -2936,8 +2898,17 @@
\unskip\unskip \par
\fi
\@doitem
- }% subpart
+ }% process@subpart
\def\subsubpart{%
+ \@bonusfalse
+ \process@subsubpart
+ }%
+ \def\bonussubsubpart{%
+ \@bonustrue
+ \process@subsubpart
+ }%
+ \def\process@subsubpart{%
+ \@bonusfalse
\if@coverpages
\cover@question@error
\fi
@@ -2951,10 +2922,35 @@
\edef\@subsubpartlabel{subsubpart@\arabic{question}%
@\arabic{partno}@\arabic{subpart}@\arabic{subsubpart}}%
\PgInfo@write{\@subsubpartlabel}%
+ \addtocounter{ques@object}{1}%
+ \edef\q@object@label{%
+ question\arabic{question}@object\arabic{ques@object}}%
+ \PgInfo@write{\q@object@label}%
+ % In addition to the \PgInfo@write we use an actual \label
+ % command. We do this in order to make the question numbers in
+ % the grade tables into \ref's, so that if the user says
+ % \usepackage{hyperref}, those question numbers will be clickable.
+ %
+ % A further purpose of these labels (which we actually do for all
+ % questions, parts, subparts, and subsubparts) is that if a
+ % question (or part, etc.) is, e.g., moved from one page to
+ % another, LaTeX will notice this and warn the user that LaTeX
+ % must be run one more time to be sure everything is correct.
+ %
+ % We need to do this even though we've already included code to
+ % check when point totals change because questions (and parts,
+ % etc.) know what page they're on from reading the info written to
+ % the .aux file on the previous run. Thus, if a question (or
+ % part, etc.) is moved to a different page, then the pointsonpage
+ % totals won't notice until the *second* subsequent run of LaTeX,
+ % and so there'll be no warning to the user on the *first* run.
+ % Including these labels gives the user a warning on that first
+ % run.
+ \label{\@subsubpartlabel}%
\set@counter@to@pageof{Curr@Page}{\@subsubpartlabel}%
\expandafter\ifx\csname Contin@\theCurr@Page\endcsname\relax
- % We're the first \question, \part, \subpart, or \subsubpart
- % on this page:
+ % We're the first \question, \part, \subpart, \subsubpart,
+ % or choice on this page:
\global\expandafter\edef\csname
Contin@\theCurr@Page\endcsname{\arabic{question}}%
\fi
@@ -2968,7 +2964,7 @@
\unskip\unskip \par
\fi
\@doitem
- }% subsubpart
+ }% process@subsubpart
\list{\question@number}%
{\usecounter{question}%
% We use the default definition of \makelabel
@@ -2977,39 +2973,36 @@
\settowidth{\leftmargin}{10.\hskip\labelsep}%
\labelwidth\leftmargin\advance\labelwidth-\labelsep
\partopsep=0pt
+ \questionshook
}%
- }%
+ }% End of the first argument of \newenvironment{questions}
{%
\endlist
% Write the number of points of the final question
% to the .aux file:
\if@filesw
\ifnum \arabic{question} > 0\relax
+ % First do the regular points:
\immediate\write\@mainaux
{\string\gdef\string\pointsofq@\romannumeral
\csname c@question\endcsname
{\prtaux@hlfcntr{pointsof@thisquestion}}}%
% See if this has changed from the last run of LaTeX:
- \@ifundefined{pointsofq@\romannumeral
+ \CheckIfChanged@hlf{pointsof@thisquestion}%
+ {pointsofq@\romannumeral
+ \csname c@question\endcsname}%
+ % Now do the bonus points:
+ \immediate\write\@mainaux
+ {\string\gdef\string\bonuspointsofq@\romannumeral
+ \csname c@question\endcsname
+ {\prtaux@hlfcntr{bonuspointsof@thisquestion}}}%
+ % See if this has changed from the last run of LaTeX:
+ \CheckIfChanged@hlf{bonuspointsof@thisquestion}%
+ {bonuspointsofq@\romannumeral
\csname c@question\endcsname}%
- {\global\@pointschangedtrue}%
- {%
- % OK; it's defined. See if it's changed:
- \begingroup
- \set@hlfcntr{tmp@hlfcntr}{\csname pointsofq@\romannumeral
- \csname c@question\endcsname\endcsname}%
- \edef\othpt@check{\prtaux@hlfcntr{tmp@hlfcntr}}%
- \edef\pt@check{\prtaux@hlfcntr{pointsof@thisquestion}}%
- \ifx \pt@check \othpt@check
- % Do nothing
- \else
- \global\@pointschangedtrue
- \fi
- \endgroup
- }%
\fi
\fi
- }
+ }% End of the second argument of \newenvironment{questions}
% \question@number is used as the label in the question list (instead
% of \questionlabel) so that if the user uses a \qformat command,
@@ -3031,8 +3024,8 @@
\newenvironment{parts}{%
\def\@queslevel{part}%
% If the question numbers are being inserted via a \qformat,
- % and if a question is beginning with a parts environmnt, then
- % we need to enter horizonal mode to the the qformat printed
+ % and if a question is beginning with a parts environment, then
+ % we need to enter horizonal mode to get the qformat printed
% on the page, rather than saving up the question label (and
% possible points) to be combined with the label of the first
% part. (\if@inlabel tells us if we are still waiting to enter
@@ -3052,6 +3045,14 @@
\global \@placepointsfalse
\fi
\def\part{%
+ \@bonusfalse
+ \process@part
+ }%
+ \def\bonuspart{%
+ \@bonustrue
+ \process@part
+ }%
+ \def\process@part{%
\if@coverpages
\cover@question@error
\fi
@@ -3064,6 +3065,31 @@
\temp@toks={%
\edef\@partlabel{part@\arabic{question}@\arabic{partno}}%
\PgInfo@write{\@partlabel}%
+ \addtocounter{ques@object}{1}%
+ \edef\q@object@label{%
+ question\arabic{question}@object\arabic{ques@object}}%
+ \PgInfo@write{\q@object@label}%
+ % In addition to the \PgInfo@write we use an actual \label
+ % command. We do this in order to make the question numbers in
+ % the grade tables into \ref's, so that if the user says
+ % \usepackage{hyperref}, those question numbers will be clickable.
+ %
+ % A further purpose of these labels (which we actually do for all
+ % questions, parts, subparts, and subsubparts) is that if a
+ % question (or part, etc.) is, e.g., moved from one page to
+ % another, LaTeX will notice this and warn the user that LaTeX
+ % must be run one more time to be sure everything is correct.
+ %
+ % We need to do this even though we've already included code to
+ % check when point totals change because questions (and parts,
+ % etc.) know what page they're on from reading the info written to
+ % the .aux file on the previous run. Thus, if a question (or
+ % part, etc.) is moved to a different page, then the pointsonpage
+ % totals won't notice until the *second* subsequent run of LaTeX,
+ % and so there'll be no warning to the user on the *first* run.
+ % Including these labels gives the user a warning on that first
+ % run.
+ \label{\@partlabel}%
\set@counter@to@pageof{Curr@Page}{\@partlabel}%
\expandafter\ifx\csname Contin@\theCurr@Page\endcsname\relax
\global\expandafter\edef\csname
@@ -3079,7 +3105,7 @@
\unskip\unskip \par
\fi
\@doitem
- }% part
+ }% process@part
\list{\partlabel}%
{%
\usecounter{partno}\def\makelabel##1{\hss\llap{##1}}%
@@ -3087,6 +3113,7 @@
\labelwidth\leftmargin\advance\labelwidth-\labelsep
\topsep=0pt
\partopsep=0pt
+ \partshook
}%
}% newenvironment{parts}
{\endlist}
@@ -3102,6 +3129,7 @@
\labelwidth\leftmargin\advance\labelwidth-\labelsep
\topsep=0pt
\partopsep=0pt
+ \subpartshook
}%
}%
{\endlist}
@@ -3117,6 +3145,7 @@
\labelwidth\leftmargin\advance\labelwidth-\labelsep
\topsep=0pt
\partopsep=0pt
+ \subsubpartshook
}%
}%
{\endlist}
@@ -3124,6 +3153,8 @@
\def\thesubsubpart{\greeknum{subsubpart}}
+
+
\pagepoint@commands={%
\ifhlfcntr@pos{latest@points}%
% We're putting a question (or part, etc.)
@@ -3139,27 +3170,17 @@
\romannumeral \csname c@pageof@pagepoints\endcsname
{\prtaux@hlfcntr{@pagepoints}}}%
% See if this has changed from the last run of LaTeX:
- \@ifundefined{pointsonpage@\romannumeral
+ \CheckIfChanged@hlf{@pagepoints}{pointsonpage@\romannumeral
\csname c@pageof@pagepoints\endcsname}%
- {\global\@pointschangedtrue}%
- {%
- % OK; it's defined. See if it's changed:
- \begingroup
- \set@hlfcntr{tmp@hlfcntr}{\csname pointsonpage@\romannumeral
- \csname c@pageof@pagepoints\endcsname\endcsname}%
- \edef\othpt@check{\prtaux@hlfcntr{tmp@hlfcntr}}%
- \edef\pt@check{\prtaux@hlfcntr{@pagepoints}}%
- \ifx \pt@check \othpt@check
- % Do nothing
- \else
- \global\@pointschangedtrue
- \fi
- \endgroup
- }%
\fi
% The following is a macro because \theCurr@Page and
% \thepageof@pagepoints might differ by more than 1:
\increment@pageof@pagepoints
+ % The following label is so that we can make the page
+ % numbers in a grade table indexed by page into \pageref's
+ % so that \usepackage{hyperref} and pdflatex will
+ % make them clickable:
+ \label{firstpoints@onpage@\arabic{Curr@Page}}%
\else
% These points go on the same page as the points
% currently counted in @pagepoints:
@@ -3167,7 +3188,40 @@
\set@hlfcntr{latest@points}{0}%
\fi
\fi
-}
+ \ifhlfcntr@pos{latest@bonuspoints}%
+ % We're putting a question (or part, etc.)
+ % with bonus points onto this page:
+ \ifnum \theCurr@Page > \thepageof@pagebonuspoints\relax
+ % These bonus points go on a later page than
+ % the points currently counted in @pagebonuspoints:
+ \ifnum \thepageof@pagebonuspoints = 0\relax
+ % Do nothing...
+ \else
+ \immediate\write\@mainaux
+ {\string\gdef\string\bonuspointsonpage@
+ \romannumeral \csname c@pageof@pagebonuspoints\endcsname
+ {\prtaux@hlfcntr{@pagebonuspoints}}}%
+ % See if this has changed from the last run of LaTeX:
+ \CheckIfChanged@hlf{@pagebonuspoints}%
+ {bonuspointsonpage@\romannumeral
+ \csname c@pageof@pagebonuspoints\endcsname}%
+ \fi
+ % The following is a macro because \theCurr@Page and
+ % \thepageof@pagebonuspoints might differ by more than 1:
+ \increment@pageof@pagebonuspoints
+ % The following label is so that we can make the page
+ % numbers in a bonus grade table indexed by page into \pageref's
+ % so that \usepackage{hyperref} and pdflatex will
+ % make them clickable:
+ \label{firstbonuspoints@onpage@\arabic{Curr@Page}}%
+ \else
+ % These points go on the same page as the points
+ % currently counted in @pagebonuspoints:
+ \add@hlfcntrtohlfcntr{@pagebonuspoints}{latest@bonuspoints}%
+ \set@hlfcntr{latest@bonuspoints}{0}%
+ \fi
+ \fi
+}% pagepoint@commands
\def\increment@pageof@pagepoints{%
\addtocounter{pageof@pagepoints}{1}%
\ifnum \theCurr@Page > \thepageof@pagepoints\relax
@@ -3198,13 +3252,48 @@
\set@hlfcntr{latest@points}{0}%
% \page@withpoints will be used to find the last
% page that has points, which will be written to
- % the .aux file vis \AtEndDocument:
+ % the .aux file via \AtEndDocument:
\global\edef\page@withpoints{\thepageof@pagepoints}%
\let\next@incr@pageof = \relax
\fi
\next@incr@pageof
-}
-
+}% increment@pageof@pagepoints
+\def\increment@pageof@pagebonuspoints{%
+ \addtocounter{pageof@pagebonuspoints}{1}%
+ \ifnum \theCurr@Page > \thepageof@pagebonuspoints\relax
+ \immediate\write\@mainaux
+ {\string\gdef\string\bonuspointsonpage@
+ \romannumeral \csname c@pageof@pagebonuspoints\endcsname{0}}%
+ % See if this has changed from the last run of LaTeX:
+ \@ifundefined{bonuspointsonpage@\romannumeral
+ \csname c@pageof@pagebonuspoints\endcsname}
+ {\global\@pointschangedtrue}%
+ {%
+ % OK; it's defined. See if it's changed:
+ \begingroup
+ \set@hlfcntr{tmp@hlfcntr}{\csname bonuspointsonpage@\romannumeral
+ \csname c@pageof@pagebonuspoints\endcsname\endcsname}%
+ \edef\othpt@check{\prtaux@hlfcntr{tmp@hlfcntr}}%
+ \def\pt@check{0}%
+ \ifx \pt@check \othpt@check
+ % Do nothing
+ \else
+ \global\@pointschangedtrue
+ \fi
+ \endgroup
+ }%
+ \let\next@incr@pageof = \increment@pageof@pagebonuspoints
+ \else
+ \copy@hlfcntr{@pagebonuspoints}{latest@bonuspoints}%
+ \set@hlfcntr{latest@bonuspoints}{0}%
+ % \page@withbonuspoints will be used to find the last
+ % page that has bonus points, which will be written to
+ % the .aux file via \AtEndDocument:
+ \global\edef\page@withbonuspoints{\thepageof@pagebonuspoints}%
+ \let\next@incr@pageof = \relax
+ \fi
+ \next@incr@pageof
+}% increment@pageof@pagebonuspoints
@@ -3241,46 +3330,29 @@
\def\@points{#1}%
\global \@placepointstrue
\if@addpoints
- \addto@hlfcntr{numpoints}{\@points}%
- \addto@hlfcntr{pointsof@thisquestion}{\@points}%
- % latest@points is a holding area for points to be
- % added to @pagepoints after we check whether they're
- % on the same page as the points currently counted
- % by @pagepoints:
- \addto@hlfcntr{latest@points}{\@points}%
+ \if@bonus
+ \addto@hlfcntr{numbonuspoints}{\@points}%
+ \addto@hlfcntr{bonuspointsof@thisquestion}{\@points}%
+ % latest@bonuspoints is a holding area for bonus points to be
+ % added to @pagepoints after we check whether they're
+ % on the same page as the points currently counted
+ % by @pagepoints:
+ \addto@hlfcntr{latest@bonuspoints}{\@points}%
+ \else
+ \addto@hlfcntr{numpoints}{\@points}%
+ \addto@hlfcntr{pointsof@thisquestion}{\@points}%
+ % latest@points is a holding area for points to be
+ % added to @pagepoints after we check whether they're
+ % on the same page as the points currently counted
+ % by @pagepoints:
+ \addto@hlfcntr{latest@points}{\@points}%
+ \fi
\fi
\item@points@pageinfo
}
-% do@int@lbl is the command used to create a label for every question,
-% part, subpart, and subsubpart. We make no use of these labels, but we
-% put them there so that if a question (or part, etc.) is, e.g., moved
-% from one page to another, LaTeX will notice this and warn the user
-% that LaTeX must be run one more time to be sure everything is correct.
-%
-% We need to do this even though we've already included code to check
-% when point totals change because questions (and parts, etc.) know what
-% page they're on from reading the info written to the .aux file on the
-% previous run. Thus, if a question (or part, etc.) is moved to a
-% different page, then the pointsonpage totals won't notice until the
-% *second* subsequent run of LaTeX, and so there'll be no warning to the
-% user on the *first* run. Including these labels gives the user a
-% warning on that first run.
-
-\newcounter{lbl@cntr}
-\def\do@int@lbl{%
- \addtocounter{lbl@cntr}{1}%
- % Looking at latex.ltx reveals that the argument to \label is
- % expanded, so we don't really need the \expandafter's in the
- % following, but I haven't seen any statement anywhere in
- % documentation about it being expanded, so we'll be paranoid and
- % protect against future changes in latex.ltx by using
- % \expandafter's:
- \expandafter\label\expandafter{\thelbl@cntr @@exam@lbl}%
-}
-
% Bug fix, 5 April 2004: \item@points@pageinfo
% Appending \point@toks and \pageinfo@commands to \everypar:
@@ -3298,10 +3370,10 @@
% Since we've put the command \global \point@toks={} inside of
% \point@toks and the command \pageinfo@commands={} inside of
% \pageinfo@commands, when the contents of \point@toks and of
-% \pageinfo@commands are executed when we enter horizontal mode and
-% \everypar is dumped in, the contents of \point@toks and
+% \pageinfo@commands are executed (when we enter horizontal mode and
+% \everypar is dumped in), the contents of \point@toks and
% \pageinfo@commands will be made empty, and so if
-% the second paragraph also get \the\point@toks and
+% the second paragraph also gets \the\point@toks and
% \the\pageinfo@commands, it won't matter.
\def\item@points@pageinfo{%
@@ -3327,12 +3399,42 @@
\fi
\fi
\if@placepoints
- % \setup@point@toks defines \point@block to be a macro that prints
- % the points with the correct choice of parentheses, brackets, or
- % box, and \@pointname or \@marginpointname and puts commands into
- % \point@toks to place \point@block at the correct spot. It
- % doesn't append anything to \everypar (we do that in this macro,
- % below).
+ % Since we want the user to be able to say \thepoints in the
+ % argument to a \pointformat command, we need \@placepointstrue
+ % when \point@block is expanded so that \thepoints will actually
+ % print something. (After setting up \point@toks, we do
+ % \@placepointsfalse, but \point@block isn't actually expanded
+ % until we enter horizontal mode.) Thus, we define
+ % \padded@point@block, and use that instead of \point@block. We
+ % put \begingroup and \endgroup around this to confine the
+ % effect of \@placepointstrue and also to confine the effect of
+ % any declarations like, e.g., \bfseries that the user might put
+ % in the argument of a \pointformat command.
+ %
+ % Note: We first tried using an \edef to expand \point@block right
+ % here, while @placepoints is true, but that causes problems if
+ % the user puts a \boldmath declaration in the argument of a
+ % \pointformat command. Apparently, expanding \boldmath (without
+ % executing anything) gives you bunches of undefined control
+ % sequence errors.
+ \if@bonus
+ \def\padded@point@block{%
+ \begingroup
+ \@placepointstrue
+ \bonuspoint@block
+ \endgroup
+ }%
+ \else
+ \def\padded@point@block{%
+ \begingroup
+ \@placepointstrue
+ \point@block
+ \endgroup
+ }%
+ \fi
+ % \setup@point@toks puts commands into \point@toks to place
+ % \padded@point@block at the correct spot. It doesn't append
+ % anything to \everypar (we do that in this macro, below).
\if@pointsdropped
% Do nothing!
\else
@@ -3347,11 +3449,17 @@
% Also: It's important to do this *after* the \item command above,
% since the \item command discards the previous contents of
% \everypar.
- \edef\append@everypar{\noexpand\everypar={\the\everypar
- \noexpand\the \noexpand\pageinfo@commands
- \noexpand\the \noexpand\point@toks}}%
- \append@everypar
- \do@int@lbl
+ % Version 2.217-beta changes:
+ % Instead of appending stuff to \everypar, we insert
+ % \the \pageinfo@commands and \the \point@toks
+ % into the box \@labels:
+ \global\setbox\@labels\hbox{\unhbox\@labels
+ \the \pageinfo@commands
+ \the \point@toks}%
+ % \edef\append@everypar{\noexpand\everypar={\the\everypar
+ % \noexpand\the \noexpand\pageinfo@commands
+ % \noexpand\the \noexpand\point@toks}}%
+ % \append@everypar
}
@@ -3361,20 +3469,19 @@
% Initialize \@points:
-% (Now that I think of it, this seems totally unnecessary,
-% but we're not deleting it because we're chicken.)
+% (The only reason I think this is necessary is in case the user uses
+% a \qformat command, puts \themarginpoints into the format (which is
+% *not* the intended use of \themarginpoints), and then doesn't have
+% any points for the first question.)
\def\@points{0}
\def\setup@point@toks{%
-% We begin by defining \point@block so that it expands to the properly
-% formatted points (including either \pointname or \marginpointname,
-% enclosed in either parentheses, brackets, or a box). We then set
-% the token list \point@toks equal to the sequence of commands needed
-% to put \point@block at the correct location, followed by the tokens
-% ``\global \point@toks={}''. The \question, \part, \subpart, or
-% \subsubpart command then adds the two tokens ``\the\point@toks'' to
-% \everypar.
+% We set the token list \point@toks equal to the sequence of commands
+% needed to put \padded@point@block at the correct location, followed by the
+% tokens ``\global \point@toks={}''. The \question, \part, \subpart,
+% or \subsubpart command then adds the two tokens ``\the\point@toks''
+% to \everypar.
%
% Note: It is not the *contents* of \point@toks that is added to
% \everypar; just the two tokens ``\the\point@toks''. This difference
@@ -3394,17 +3501,9 @@
% tokens ``\the\point@toks'' will insert an *empty* token list, which
% will do no harm.
%
-%
-% \point@block consists of \point@string surrounded by either
-% parentheses, brackets, or an fbox.
-%
-% \point@string is either \@points\@pointname or
-% \@points\@marginpointname.
- \setup@point@block
\if@pointsinleftmargin
- \def\point@string{\@points\@marginpointname}%
\point@toks={%
- \llap{\point@block
+ \llap{\padded@point@block
\hskip\@totalleftmargin
\hskip\marginpointssep
}%
@@ -3412,21 +3511,19 @@
}%
\else
\if@pointsinrightmargin
- \def\point@string{\@points\@marginpointname}%
\point@toks={%
\rlap{\hskip-\@totalleftmargin
\hskip\textwidth
\hskip\@rightmargin
\hskip-\rightpointsmargin
- \llap{\point@block}%
+ \llap{\padded@point@block}%
}%
\global \point@toks={}%
}%
\else
% The points just go after the question number:
- \def\point@string{\@points\@pointname}%
\point@toks={%
- \point@block
+ \padded@point@block
\enspace
\global \point@toks={}%
}%
@@ -3435,47 +3532,19 @@
}% setup@point@toks
-\def\setup@point@block{%
- \if@boxedpoints
- \def\point@block{\fbox{\point@string}}%
- \else
- \if@bracketedpoints
- \def\point@block{[\point@string]}%
- \else
- % plain old parentheses:
- \def\point@block{(\point@string)}%
- \fi
- \fi
-}
\def\droppoints{%
- \def\point@string{\@points\@marginpointname}%
- \setup@point@block
\leavevmode\unskip\nobreak\hfill
\rlap{\hskip\rightmargin % Defined by the list environment
\hskip\@rightmargin % Defined by exam.cls
\hskip-\rightpointsmargin
- \llap{\point@block}%
+ \llap{\padded@point@block}%
}% rlap
\par
}
-% The following is the default definition.
-% It will be redefined if the user givea a \totalformat command.
-\def\setup@total@block{%
- \def\total@block{%
- Total for Question \thequestion: \totalpoints\@marginpointname
- }%
-}
-
-\def\totalformat#1{%
- \def\setup@total@block{\def\total@block{#1}}%
-}
-% The following is for use in the argument to a \totalformat command:
-\def\totalpoints{\pointsofquestion{\arabic{question}}}
\def\droptotalpoints{%
- \setup@total@block
\leavevmode\unskip\nobreak\hfill
\rlap{\hskip\rightmargin % Defined by the list environment
\hskip\@rightmargin % Defined by exam.cls
@@ -3483,7 +3552,36 @@
\llap{\total@block}%
}% rlap
\par
-}
+}% droptotalpoints
+\def\droptotalbonuspoints{%
+ \leavevmode\unskip\nobreak\hfill
+ \rlap{\hskip\rightmargin % Defined by the list environment
+ \hskip\@rightmargin % Defined by exam.cls
+ \hskip-\rightpointsmargin
+ \llap{\bonustotal@block}%
+ }% rlap
+ \par
+}% droptotalbonuspoints
+
+% The following is the default definition;
+% it can be changed by a \totalformat command.
+\def\total@block{%
+ Total for Question \thequestion: \totalpoints\@marginpointname
+}% total@block
+\def\bonustotal@block{%
+ Total for Question \thequestion: \totalbonuspoints\@marginbonuspointname
+}% bonustotal@block
+
+\def\totalformat#1{%
+ \gdef\total@block{\begingroup #1\endgroup}%
+}% totalformat
+\def\bonustotalformat#1{%
+ \gdef\bonustotal@block{\begingroup #1\endgroup}%
+}% bonustotalformat
+% The following is for use in the argument to a \totalformat command:
+\def\totalpoints{\pointsofquestion{\arabic{question}}}
+\def\totalbonuspoints{\bonuspointsofquestion{\arabic{question}}}
+
% @placepoints is set true when we encounter a question (or part, etc.)
@@ -3491,12 +3589,12 @@
% to the sequence of commands required to put the properly formatted
% points onto the page (this happens only if @qformat is false or if
% @qformat is true but we're not doing a question), or (2) by a
-% \question or \part command (since if we're doing a question and
-% @qformat is true, we need to leave @placepoints true so that the
-% \thepoints command can tell if it should expand to points or to
-% nothing, and encountering a \question or \part command tells us that
-% we no longer have to deal with a possible \thepoints, since we won't
-% be expanding a qformat).
+% \question command or entering a parts environment (since if we're
+% doing a question and @qformat is true, we need to leave @placepoints
+% true so that the \thepoints command can tell if it should expand to
+% points or to nothing, and encountering a \question command or parts
+% environment tells us that we no longer have to deal with a possible
+% \thepoints, since we won't be expanding a qformat).
\newif\if@placepoints
\@placepointsfalse
@@ -3519,39 +3617,72 @@
\newif\if@pointsinrightmargin
\def\pointsinleftmargin{\global\@pointsinleftmargintrue
\global\@pointsinrightmarginfalse
- \global\@pointsdroppedfalse}
+ \global\@pointsdroppedfalse
+ \gdef\pt@name{\@marginpointname}%
+ \gdef\bnspt@name{\@marginbonuspointname}}
\def\pointsinrightmargin{\global\@pointsinrightmargintrue
\global\@pointsinleftmarginfalse
- \global\@pointsdroppedfalse}
+ \global\@pointsdroppedfalse
+ \gdef\pt@name{\@marginpointname}%
+ \gdef\bnspt@name{\@marginbonuspointname}}
\def\nopointsinmargin{\global\@pointsinleftmarginfalse
\global\@pointsinrightmarginfalse
- \global\@pointsdroppedfalse}
+ \global\@pointsdroppedfalse
+ \gdef\pt@name{\@pointname}%
+ \gdef\bnspt@name{\@bonuspointname}}
\def\pointsdroppedatright{\global\@pointsdroppedtrue
\global\@pointsinleftmarginfalse
- \global\@pointsinrightmarginfalse}
+ \global\@pointsinrightmarginfalse
+ \gdef\pt@name{\@marginpointname}%
+ \gdef\bnspt@name{\@marginbonuspointname}}
\let\pointsinmargin\pointsinleftmargin
\let\nopointsinrightmargin\nopointsinmargin
\let\nopointsinleftmargin\nopointsinmargin
-
\nopointsinmargin
% Will the points be displayed inside parentheses (the default), or
-% will they be boxed or bracketed:
-\newif\if@boxedpoints
-\def\boxedpoints{\global\@boxedpointstrue \global\@bracketedpointsfalse}
-\def\noboxedpoints{\global\@boxedpointsfalse \global\@bracketedpointsfalse}
-\@boxedpointsfalse
+% will they be boxed or bracketed, or customized using pointformat:
+\def\boxedpoints{%
+ \gdef\point@block{\fbox{\@points\pt@name}}%
+ \gdef\bonuspoint@block{\fbox{\@points\bnspt@name}}%
+}
+\def\noboxedpoints{%
+ \gdef\point@block{(\@points\pt@name)}%
+ \gdef\bonuspoint@block{(\@points\bnspt@name)}%
+}
+\def\bracketedpoints{%
+ \gdef\point@block{[\@points\pt@name]}%
+ \gdef\bonuspoint@block{[\@points\bnspt@name]}%
+}
+\let\nobracketedpoints=\noboxedpoints
+
+\def\pointformat#1{%
+ % We don't have to worry about the user putting things
+ % like \bfseries, etc. into \point@block, because
+ % \padded@point@block encloses \point@block in a group,
+ % which confines the effects of anything here:
+ \gdef\point@block{#1}%
+}
+
+\def\bonuspointformat#1{%
+ % We don't have to worry about the user putting things
+ % like \bfseries, etc. into \point@block, because
+ % \padded@point@block encloses \point@block in a group,
+ % which confines the effects of anything here:
+ \gdef\bonuspoint@block{#1}%
+}
+\def\thebonuspoints{\@points \@bonuspointname}
+
+%Initialize:
+\noboxedpoints
-\newif\if@bracketedpoints
-\def\bracketedpoints{\global\@bracketedpointstrue \global\@boxedpointsfalse}
-\def\nobracketedpoints{\global\@bracketedpointsfalse \global\@boxedpointsfalse}
-\@bracketedpointsfalse
\def\pointname#1{\gdef\@pointname{#1}}
+\def\bonuspointname#1{\gdef\@bonuspointname{#1}}
% Initialize to leave a space, and then the word `points':
%%\pointname{ points}
% The following improvement was contributed by
@@ -3563,13 +3694,21 @@
% Note the space before the \points in the following; it's
% intentional!)
\pointname{ \points}
-
+\bonuspointname{ \bonuspoints}
\newcommand\point@sing{point}
\newcommand\point@plur{points}
\newcommand\pointpoints[2]{%
\renewcommand\point@sing{#1}%
\renewcommand\point@plur{#2}%
}
+%\newcommand\bonuspoint@sing{bonus point}
+%\newcommand\bonuspoint@plur{bonus points}
+\newcommand\bonuspoint@sing{point (bonus)}
+\newcommand\bonuspoint@plur{points (bonus)}
+\newcommand\bonuspointpoints[2]{%
+ \renewcommand\bonuspoint@sing{#1}%
+ \renewcommand\bonuspoint@plur{#2}%
+}
@@ -3590,7 +3729,15 @@
\ifthenelse{\equal{\pt@string}{1} \or \equal{\pt@string}{\half}}
{\point@sing}{\point@plur}%
\endgroup
-}
+}% \points
+\newcommand\bonuspoints{%
+ \begingroup
+ \let\half=\relax
+ \edef\pt@string{\@points}%
+ \ifthenelse{\equal{\pt@string}{1} \or \equal{\pt@string}{\half}}
+ {\bonuspoint@sing}{\bonuspoint@plur}%
+ \endgroup
+}% \bonuspoints
%\newcommand\points{%
% \begingroup
% \let\half=\relax
@@ -3613,7 +3760,10 @@
% except that it expands to either ``mark'' or ``marks'', but that
% conflicts with some package or other. Thus, we'll implement
% \marksnotpoints using the \pointpoints command instead:
-\newcommand\marksnotpoints{\pointpoints{mark}{marks}}
+\newcommand\marksnotpoints{%
+ \pointpoints{mark}{marks}%
+ \bonuspointpoints{mark (bonus)}{marks (bonus)}%
+}% \marksnotpoints
% \@marginpointname is used in place of \@pointname if any of
@@ -3621,25 +3771,10 @@
% true:
\def\marginpointname#1{\gdef\@marginpointname{#1}}
\marginpointname{}
+\def\marginbonuspointname#1{\gdef\@marginbonuspointname{#1}}
+\marginbonuspointname{ (bonus)}
-% The following keeps track of whether the user has requested that we
-% add up the points on the exam. We make the default false so that
-% users who put other than numbers into the points argument of a
-% question (or part, or subpart) won't get error messages.
-% We use \if@printtotalpoints as a flag to signal that we are counting
-% points, so that we will know to print the total on the screen (and
-% in the log file). We use this separate flag so that the user can
-% use both \addpoints and \noaddpoints to count some points and not
-% others, but still have the total printed when we finish the file no
-% matter what the state of \if@addpoints.
-\newif\if@addpoints
-\newif\if@printtotalpoints
-\def\addpoints{\global\@addpointstrue\global\@printtotalpointstrue}
-\def\noaddpoints{\global\@addpointsfalse}
-\@addpointsfalse
-\@printtotalpointsfalse
-
%--------------------------------------------------------------------
% choices (for multiple choice)
@@ -3647,37 +3782,148 @@
\renewcommand\thechoice{\Alph{choice}}
\newcommand\choicelabel{\thechoice.}
+% We will have \@correctchoicetrue when we're printing solutions
+% and we're printing the correct choice of a choices or
+% oneparchoices environment.
+% We'll say \begingroup before saying \@correctchoicetrue
+% and we'll say \endgroup at either the next \choice or \correctchoice
+% or the end of the choices or oneparchoices environment.
+% Thus, we'll never again need to say \@correctchoicefalse
+\newif\if@correctchoice
+\@correctchoicefalse
+
+\newcommand\CorrectChoiceEmphasis[1]{%
+ \def\CorrectChoice@Emphasis{#1}%
+}
+\CorrectChoiceEmphasis{\bfseries}
+\let\correctchoiceemphasis\CorrectChoiceEmphasis
+
+
+\newtoks\choice@toks
+\def\do@choice@pageinfo{%
+ \choice@toks={%
+ \addtocounter{ques@object}{1}%
+ \edef\q@object@label{%
+ question\arabic{question}@object\arabic{ques@object}}%
+ \PgInfo@write{\q@object@label}%
+ \set@counter@to@pageof{Curr@Page}{\q@object@label}%
+ \expandafter\ifx\csname Contin@\theCurr@Page\endcsname\relax
+ % We're the first \question, \part, \subpart, \subsubpart,
+ % or choice on this page:
+ \global\expandafter\edef\csname
+ Contin@\theCurr@Page\endcsname{\arabic{question}}%
+ \fi
+ \choice@toks={}%
+ }%
+ % Version 2.217-beta changes:
+ % Instead of appending stuff to \everypar, we insert
+ % \the \pageinfo@commands and \the \point@toks
+ % into the box \@labels:
+ \global\setbox\@labels\hbox{\unhbox\@labels
+ \the \choice@toks}%
+ % \edef\append@everypar{\noexpand\everypar={\the\everypar
+ % \noexpand\the \noexpand\choice@toks}}%
+ % \append@everypar
+}% do@choice@pageinfo
+
+
+
% Added 22 April 2004: Increased the \leftmargin by 2.5em,
% so the choices will be visibly indented.
\newenvironment{choices}%
{\list{\choicelabel}%
{\usecounter{choice}\def\makelabel##1{\hss\llap{##1}}%
\settowidth{\leftmargin}{W.\hskip\labelsep\hskip 2.5em}%
- \let\choice=\item
+ \def\choice{%
+ \if@correctchoice
+ \endgroup
+ \fi
+ \item
+ \do@choice@pageinfo
+ } % choice
+ \def\CorrectChoice{%
+ \if@correctchoice
+ \endgroup
+ \fi
+ \ifprintanswers
+ % We can't say \choice here, because that would
+ % insert an \endgroup:
+ \begingroup \@correctchoicetrue
+ \CorrectChoice@Emphasis
+ \fi
+ \item
+ \do@choice@pageinfo
+ } % CorrectChoice
+ \let\correctchoice\CorrectChoice
\labelwidth\leftmargin\advance\labelwidth-\labelsep
\topsep=0pt
\partopsep=0pt
+ \choiceshook
}%
}%
- {\endlist}
+ {\if@correctchoice \endgroup \fi \endlist}
\newenvironment{oneparchoices}%
{%
\setcounter{choice}{0}%
\def\choice{%
- \refstepcounter{choice}%
- \ifnum\value{choice}>1
- \penalty -50\hskip 1em plus 1em\relax
- \fi
- \choicelabel\nobreak\enskip
- }%
+ \if@correctchoice \endgroup \fi
+ \refstepcounter{choice}%
+ \ifnum\value{choice}>1
+ \penalty -50\hskip 1em plus 1em\relax
+ \fi
+ \choicelabel
+ % No need to put the following into a token string; we just put
+ % the choicelabel onto the page, so we're at the spot whose page
+ % number we want to record:
+ \addtocounter{ques@object}{1}%
+ \edef\q@object@label{%
+ question\arabic{question}@object\arabic{ques@object}}%
+ \PgInfo@write{\q@object@label}%
+ \set@counter@to@pageof{Curr@Page}{\q@object@label}%
+ \expandafter\ifx\csname Contin@\theCurr@Page\endcsname\relax
+ % We're the first \question, \part, \subpart, \subsubpart,
+ % or choice on this page:
+ \global\expandafter\edef\csname
+ Contin@\theCurr@Page\endcsname{\arabic{question}}%
+ \fi
+ \nobreak\enskip
+ }% choice
+ \def\CorrectChoice{%
+ \if@correctchoice \endgroup \fi
+ \refstepcounter{choice}%
+ \ifprintanswers
+ \begingroup \@correctchoicetrue
+ \CorrectChoice@Emphasis
+ \fi
+ \ifnum\value{choice}>1
+ \penalty -50\hskip 1em plus 1em\relax
+ \fi
+ \choicelabel
+ % No need to put the following into a token string; we just put
+ % the choicelabel onto the page, so we're at the spot whose page
+ % number we want to record:
+ \addtocounter{ques@object}{1}%
+ \edef\q@object@label{%
+ question\arabic{question}@object\arabic{ques@object}}%
+ \PgInfo@write{\q@object@label}%
+ \set@counter@to@pageof{Curr@Page}{\q@object@label}%
+ \expandafter\ifx\csname Contin@\theCurr@Page\endcsname\relax
+ % We're the first \question, \part, \subpart, \subsubpart,
+ % or choice on this page:
+ \global\expandafter\edef\csname
+ Contin@\theCurr@Page\endcsname{\arabic{question}}%
+ \fi
+ \nobreak\enskip
+ }% CorrectChoice
+ \let\correctchoice\CorrectChoice
\let\par\@empty
% If we're continuing the paragraph containing the question,
% then leave a bit of space before the first choice:
\ifvmode\else\enskip\fi
\ignorespaces
}%
- {}
+ {\if@correctchoice \endgroup \fi}
%--------------------------------------------------------------------
@@ -3692,10 +3938,13 @@
\newlength\answerlinelength
\newlength\answerskip
+\newlength\answerclearance
\setlength\answerlinelength{1in}
\setlength\answerskip{2ex}
+\setlength\answerclearance{0.2ex}
-\def\answerline{%
+\newcommand\answerline[1][{}]{%
+ % One optional argument, the default value of which is empty.
\ifx\@queslevel\ques@ref
\let\ans@l=\questionlabel
\else
@@ -3717,9 +3966,16 @@
\fi
\fi
\par \nobreak \vskip \answerskip
- \hfill \ans@l~\hbox to \answerlinelength{\hrulefill}%
+ \hfill
+ \ifprintanswers
+ \ans@l~\hbox to 0pt{\hbox to \answerlinelength{\hrulefill}\hss}%
+ \raise \answerclearance\hbox to \answerlinelength{%
+ \CorrectChoice@Emphasis \hfil #1\hss}%
+ \else
+ \ans@l~\hbox to \answerlinelength{\hrulefill}%
+ \fi
\par
-}
+}% answerline
%--------------------------------------------------------------------
% \fillwithlines
@@ -3727,9 +3983,9 @@
% \fillwithlines takes one argument, which is either a length or \fill,
% and it fills that much vertical space with horizontal lines that run
-% the length of the current line. That is, the extend from the current
-% left margin (which depends on whether we're in a quesiton, parts,
-% subpart, or subsubpart) to the right margin.
+% the length of the current line. That is, they extend from the
+% current left margin (which depends on whether we're in a question,
+% part, subpart, or subsubpart) to the right margin.
%
% The distance between the lines is \linefillheight, whose default value
% is set with the command
@@ -3741,7 +3997,7 @@
% The thickness of the lines is \linefillthickness, whose default value
% is set with the command
%
-% \setlength\linefillthickness{.2pt}
+% \setlength\linefillthickness{.1pt}
%
% This value can be changed by giving a new \setlength command.
@@ -3772,6 +4028,46 @@
\endgroup
}
+%--------------------------------------------------------------------
+% \fillwithdottedlines
+
+
+% \fillwithdottedlines is similar to \fillwithlines, except that it
+% fills the space with dotted lines (created by \dotfill) rather than
+% with solid lines.
+
+% \fillwithdottedlines takes one argument, which is either a length or
+% \fill, and it fills that much vertical space with dotted lines that
+% run the length of the current line. That is, they extend from the
+% current left margin (which depends on whether we're in a question,
+% part, subpart, or subsubpart) to the right margin.
+%
+% The distance between the lines is \dottedlinefillheight, whose
+% default value is set with the command
+%
+% \setlength\dottedlinefillheight{.25in}
+%
+% This value can be changed by giving a new \setlength command.
+
+\newlength\dottedlinefillheight
+\setlength\dottedlinefillheight{.25in}
+
+\def\fillwithdottedlines#1{%
+ \begingroup
+ \ifhmode
+ \par
+ \fi
+ \hrule height \z@
+ \nobreak
+ \setbox0=\hbox to \hsize{\hskip \@totalleftmargin
+ \vrule height \dottedlinefillheight depth \z@ width \z@
+ \dotfill}%
+ % We use \cleaders (rather than \leaders) so that a given
+ % vertical space will always produce the same number of lines
+ % no matter where on the page it happens to start:
+ \cleaders \copy0 \vskip #1 \hbox{}%
+ \endgroup
+}
%--------------------------------------------------------------------
% \uplevel and \fullwidth:
@@ -3840,6 +4136,20 @@
\def\vpgword#1{\def\@vpgword{#1}}
\def\hpgword#1{\def\@hpgword{#1}}
+% The following are the versions for bonusgradetable:
+\def\bhqword#1{\def\@bhqword{#1}}
+\def\bhpword#1{\def\@bhpword{#1}}
+\def\bhsword#1{\def\@bhsword{#1}}
+\def\bhtword#1{\def\@bhtword{#1}}
+\def\bvqword#1{\def\@bvqword{#1}}
+\def\bvpword#1{\def\@bvpword{#1}}
+\def\bvsword#1{\def\@bvsword{#1}}
+\def\bvtword#1{\def\@bvtword{#1}}
+
+\def\bvpgword#1{\def\@bvpgword{#1}}
+\def\bhpgword#1{\def\@bhpgword{#1}}
+
+
% Initialize:
\cellwidth{2em}
\gradetablestretch{1.5}
@@ -3850,17 +4160,32 @@
\vsword{Score}
\vtword{Total:}
+\bhpword{Bonus Points:}
+\bhsword{Score:}
+\bhtword{Total}
+\bvpword{Bonus Points}
+\bvsword{Score}
+\bvtword{Total:}
+
% For tables indexed by question number:
\vqword{Question}
\hqword{Question:}
+\bvqword{Question}
+\bhqword{Question:}
% For tables indexed by page number:
\vpgword{Page}
\hpgword{Page:}
+\bvpgword{Page}
+\bhpgword{Page:}
-% The only command here accessible to the user is \gradetable.
+% The only commands here accessible to the user are \gradetable,
+% \bonusgradetable, \pointtable, \bonuspointtable, \partialgradetable,
+% \partialbonusgradetable, \partialpointtable,
+% \partialbonuspointtable, \begingradingrange, and \endgradingrange.
+
% The possibilities are
% \gradetable[v][questions]
@@ -3868,385 +4193,1181 @@
% \gradetable[h][questions]
% \gradetable[h][pages]
-% If one or both optional arguments are omitted, the defaults are `[v]'
-% and `[questions]'.
+% \bonusgradetable[v][questions]
+% \bonusgradetable[v][pages]
+% \bonusgradetable[h][questions]
+% \bonusgradetable[h][pages]
+
+% \pointtable[v][questions]
+% \pointtable[v][pages]
+% \pointtable[h][questions]
+% \pointtable[h][pages]
+
+% \bonuspointtable[v][questions]
+% \bonuspointtable[v][pages]
+% \bonuspointtable[h][questions]
+% \bonuspointtable[h][pages]
+
+% \partialgradetable{whatever}[v][questions]
+% \partialgradetable{whatever}[v][pages]
+% \partialgradetable{whatever}[h][questions]
+% \partialgradetable{whatever}[h][pages]
+
+% \partialbonusgradetable{whatever}[v][questions]
+% \partialbonusgradetable{whatever}[v][pages]
+% \partialbonusgradetable{whatever}[h][questions]
+% \partialbonusgradetable{whatever}[h][pages]
+
+% \partialpointtable{whatever}[v][questions]
+% \partialpointtable{whatever}[v][pages]
+% \partialpointtable{whatever}[h][questions]
+% \partialpointtable{whatever}[h][pages]
+
+% \partialbonuspointtable{whatever}[v][questions]
+% \partialbonuspointtable{whatever}[v][pages]
+% \partialbonuspointtable{whatever}[h][questions]
+% \partialbonuspointtable{whatever}[h][pages]
+
+% \begingradingrange{whatever}
+% \endgradingrange{whatever}
+%
+% where ``whatever'' is a label chosen by the user.
+
+% If one or both optional arguments are omitted, the defaults are
+% `[v]' and `[questions]'.
+
+% \@scorestrue means we're doing \gradetable
+% \@scoresfalse mans we're doing \pointtable
+\newif\if@scores
+
+% \@partialtrue means we're doing \partialgradetable,
+% \partialbonusgradetable, \partialpointtable, or
+% \partialbonuspointtable:
+\newif\if@partial
+
+
+% It's OK to use the counter num@cols as a scratch counter
+% in \begingradingrange and \endgradingrange because
+% it's only used in typesetting tables:
+\def\begingradingrange#1{%
+ \setcounter{num@cols}{\value{question}}%
+ \addtocounter{num@cols}{1}%
+ \immediate\write\@mainaux
+ {\string\expandafter\string\gdef
+ \string\csname\space tbl@#1@firstq\string\endcsname
+ {\arabic{num@cols}}}%
+ \write\@mainaux
+ {\string\expandafter\string\gdef
+ \string\csname\space tbl@#1@firstp\string\endcsname
+ {\thepage}}%
+}% begingradingrange
+
+\def\endgradingrange#1{%
+ \setcounter{num@cols}{\value{question}}%
+ \immediate\write\@mainaux
+ {\string\expandafter\string\gdef
+ \string\csname\space tbl@#1@lastq\string\endcsname
+ {\arabic{num@cols}}}%
+ \write\@mainaux
+ {\string\expandafter\string\gdef
+ \string\csname\space tbl@#1@lastp\string\endcsname
+ {\thepage}}%
+}% endgradingrange
+
+
+
+
+% Now that grading tables may be for only part of the exam,
+% we need the counter tbl@points to add up the total points
+% for the questions (or pages) that appear on the table:
+\new@hlfcntr{tbl@points}
+
+
+\def\partialgradetable#1{%
+ \@scorestrue
+ \@bonusfalse
+ \@partialtrue
+ \def\tbl@range{#1}%
+ % If the user doesn't include the optional argument
+ % choosing between vertical and horizontal,
+ % we give them vertical:
+ \@ifnextchar[{\i@gtable}{\i@gtable[v]}%
+}% partialgradetable
+
+\def\partialbonusgradetable#1{%
+ \@scorestrue
+ \@bonustrue
+ \@partialtrue
+ \def\tbl@range{#1}%
+ % If the user doesn't include the optional argument
+ % choosing between vertical and horizontal,
+ % we give them vertical:
+ \@ifnextchar[{\i@gtable}{\i@gtable[v]}%
+}% partialbonusgradetable
+
+\def\partialpointtable#1{%
+ \@scoresfalse
+ \@bonusfalse
+ \@partialtrue
+ \def\tbl@range{#1}%
+ % If the user doesn't include the optional argument
+ % choosing between vertical and horizontal,
+ % we give them vertical:
+ \@ifnextchar[{\i@gtable}{\i@gtable[v]}%
+}% partialpointtable
+
+\def\partialbonuspointtable#1{%
+ \@scoresfalse
+ \@bonustrue
+ \@partialtrue
+ \def\tbl@range{#1}%
+ % If the user doesn't include the optional argument
+ % choosing between vertical and horizontal,
+ % we give them vertical:
+ \@ifnextchar[{\i@gtable}{\i@gtable[v]}%
+}% partialbonuspointtable
+
+%--------------------------------------------------------------------
\def\gradetable{%
+ \@scorestrue
+ \@bonusfalse
+ \@partialfalse
% If the user doesn't include the optional argument
% choosing between vertical and horizontal,
% we give them vertical:
\@ifnextchar[{\i@gtable}{\i@gtable[v]}%
-}
-\def\i@gtable[#1]{%
+}% gradetable
+
+\def\bonusgradetable{%
+ \@scorestrue
+ \@bonustrue
+ \@partialfalse
+ % If the user doesn't include the optional argument
+ % choosing between vertical and horizontal,
+ % we give them vertical:
+ \@ifnextchar[{\i@gtable}{\i@gtable[v]}%
+}% bonusgradetable
+
+\def\pointtable{%
+ \@scoresfalse
+ \@bonusfalse
+ \@partialfalse
% If the user doesn't include the optional argument
- % choosing between questions and pages,
+ % choosing between vertical and horizontal,
+ % we give them vertical:
+ \@ifnextchar[{\i@gtable}{\i@gtable[v]}%
+}% pointtable
+
+\def\bonuspointtable{%
+ \@scoresfalse
+ \@bonustrue
+ \@partialfalse
+ % If the user doesn't include the optional argument
+ % choosing between vertical and horizontal,
+ % we give them vertical:
+ \@ifnextchar[{\i@gtable}{\i@gtable[v]}%
+}% bonuspointtable
+
+%--------------------------------------------------------------------
+
+% \i@gtable and \ii@gtable insert any missing optional arguments
+% (the defaults being [v] and [questions]) and then make sure
+% that the user said \addpoints and that this isn't the
+% first run of LaTeX.
+% \do@table then branches, depending on whether the user
+% selected [questions] or [pages].
+
+\def\i@gtable[#1]{%
+ % If the user doesn't include the second optional argument,
+ % which chooses between questions and pages,
% we give them questions:
\@ifnextchar[{\ii@gtable{#1}}{\ii@gtable{#1}[questions]}%
}
\def\ii@gtable#1[#2]{%
+ % We make sure the user said \addpoints, and then make sure
+ % that this isn't the first run of LaTeX (by checking that
+ % \exam@numpoints is defined). If both of those are OK,
+ % we go on to \do@table to see whether we're doing a table
+ % indexed by questions or by pages.
\if@addpoints
\@ifundefined{exam@numpoints}%
{\ClassWarning{exam}%
{%
- You must run LaTeX again to produce the grade table.
- \MessageBreak
+ You must run LaTeX again to produce the
+ table.\MessageBreak
}%
\fbox{Run \LaTeX{} again to produce the table}%
}%
- {\do@gtable{#1}{#2}}%
+ {\do@table{#1}{#2}}%
\else
\ClassError{exam}{%
You must give the command \protect\addpoints\MessageBreak
- \space\space in order to use the command \protect\gradetable
- \MessageBreak
+ \space\space in order to create a grade table.\MessageBreak
}{%
If you don't give the command \protect\addpoints\MessageBreak
\space\space then we're not keeping track of point values.
\MessageBreak
}%
\fi
-}
+}% ii@gtable
+
+
\def\@questionsref{questions}
\def\@pagesref{pages}
-\def\do@gtable#1#2{%
+\def\do@table#1#2{%
+ % See whether we're doing a table indexed by
+ % questions or by pages:
\begingroup % avoid trouble from using \@temp
\def\@temp{#2}%
\ifx\@temp\@questionsref
- \@grdtblquestions{#1}%
+ \find@qrange{#1}%
\else
\ifx\@temp\@pagesref
- \@grdtblpages{#1}%
+ \find@prange{#1}%
\else
\ClassError{exam}{%
- The second optional argument to \protect\gradetable \MessageBreak
- \space \space must be either `questions' or `pages'\MessageBreak
+ The second optional argument to a\MessageBreak
+ \space\space grade table or point table command\MessageBreak
+ \space \space must be either `questions' or
+ `pages',\MessageBreak
+ \space\space not `#2'.\MessageBreak
}{%
- Grade tables can be indexed by questions or pages;\MessageBreak
+ Grade tables and point tables can be indexed by questions or
+ pages;\MessageBreak
\space\space for others, you're on your own.\MessageBreak
}%
- \fbox{Error: Grade table: Invalid second optional argument `#1'.}%
+ \fbox{Error: grade or point table: Invalid second
+ optional argument `#2'.}%
\fi
\fi
\endgroup
-}
+}% do@table
+
+
+\def\range@undefined{%
+ \fbox{Warning: grading range `\tbl@range ' not defined;
+ run \LaTeX{} again.}%
+ \ClassWarning{exam}{%
+ Grading range `\tbl@range ' not defined.\MessageBreak
+ \space\space Run LaTeX again to produce the table.\MessageBreak
+ }%
+}% range@undefined
+
%--------------------------------------------------------------------
%--------------------------------------------------------------------
-% Grading tables indexed by question numbers:
+% Grade and point tables indexed by question numbers:
+
+% \find@qrange makes sure the grading range is defined and that
+% its last question isn't before its first question.
+% \@tblquestions branches, depending on whether the user
+% selected [v] or [h].
+
+\def\find@qrange#1{%
+ % We're doing a table indexed by question numbers.
+ \if@partial
+ \@ifundefined{tbl@\tbl@range @firstq}%
+ {%
+ \range@undefined
+ }%
+ {%
+ \@ifundefined{tbl@\tbl@range @lastq}%
+ {%
+ \range@undefined
+ }%
+ {%
+ \edef\tbl@firstq{\csname tbl@\tbl@range @firstq\endcsname}%
+ \edef\tbl@lastq{\csname tbl@\tbl@range @lastq\endcsname}%
+ % Check that firstq precedes or equals lastq:
+ \ifnum \tbl@firstq > \tbl@lastq
+ \fbox{Error: Grading Range `\tbl@range ':
+ Last question precedes first question.}%
+ \ClassError{exam}{%
+ In grading range `\tbl@range ',
+ the last question\MessageBreak
+ \space\space comes before the first question.\MessageBreak
+ }{%
+ \string\begingradingrange \space must precede
+ \string\endgradingrange \space by at
+ least one question.\MessageBreak
+ }%
+ \else
+ \@tblquestions{#1}%
+ \fi
+ }%
+ }%
+ \else
+ \def\tbl@firstq{1}%
+ % \numquestions is always defined, even if this is the first
+ % run of LaTeX and \exam@numquestions isn't defined.
+ % If it's the first run of LaTeX, then its value isn't useful,
+ % but it's never used until a later run (when its value is useful).
+ \def\tbl@lastq{\numquestions}%
+ \@tblquestions{#1}%
+ \fi
+}% find@qrange
-\def\@grdtblquestions#1{%
+\def\@tblquestions#1{%
\if v#1%
- \@vgrdtblquestions
+ \@vtblquestions
\else
\if h#1%
- \@hgrdtblquestions
+ \@htblquestions
\else
\ClassError{exam}{%
- The first optional argument to \protect\gradetable \MessageBreak
- \space \space must be either `h' or `v'\MessageBreak
+ The first optional argument to \protect\gradetable,\MessageBreak
+ \space\space \protect\bonusgradetable,
+ \protect\pointtable, or\MessageBreak
+ \space\space \protect\bonuspointtable
+ \space must be either `h' or `v'\MessageBreak
}{%
- Grade tables can be either horizontal or vertical;\MessageBreak
+ Grade tables and point tables can be either horizontal or
+ vertical;\MessageBreak
\space\space no diagonals allowed.\MessageBreak
}%
- \fbox{Error: Grade table: Invalid first optional argument `#1'.}%
+ \if@scores
+ \if@bonus
+ \fbox{Error: bonusgradetable: Invalid first optional argument
+ `#1'.}%
+ \else
+ \fbox{Error: gradetable: Invalid first optional argument
+ `#1'.}%
+ \fi
+ \else
+ \if@bonus
+ \fbox{Error: bonuspointtable: Invalid first optional argument
+ `#1'.}%
+ \else
+ \fbox{Error: pointtable: Invalid first optional argument
+ `#1'.}%
+ \fi
+ \fi
\fi
\fi
-}
+}% @tblquestions
%--------------------------------------------------------------------
% Vertical, indexed by question numbers:
-\def\@vgrdtblquestions{%
+\def\@vtblquestions{%
+ % The table is vertical and indexed by question numbers.
+ % See whether it's bonus or non-bonus, and
+ % gradetable or pointtable:
\begingroup
% Save the current value of question in @iterator, so that
- % we cna restore it after doing the table:
- \setcounter{@iterator}{\arabic{question}}%
+ % we can restore it after doing the table:
+ \setcounter{@iterator}{\value{question}}%
\renewcommand\arraystretch{\@gtblstretch}%
- \begin{tabular}{|c|c|c|}
- \hline
- {\@vqword}& {\@vpword}& {\@vsword}\\
- \hline
- \setcounter{question}{0}\do@vloop
- {\@vtword}& \numpoints&\hbox to \@cellwidth{\hfill}\\
- \hline
- \end{tabular}%
+ \if@bonus
+ \if@scores
+ \@bvgrdtblquestions
+ \else
+ \@bvpttblquestions
+ \fi
+ \else
+ \if@scores
+ \@vgrdtblquestions
+ \else
+ \@vpttblquestions
+ \fi
+ \fi
% Restore the saved value of question:
- \setcounter{question}{\arabic{@iterator}}%
+ \setcounter{question}{\value{@iterator}}%
\endgroup
-}
+}% @vtblquestions
+
+\def\@bvgrdtblquestions{%
+ % Vertical bonus gradetable, indexed by questions:
+ \set@hlfcntr{tbl@points}{0}%
+ \begin{tabular}{|c|c|c|}
+ \hline
+ {\@bvqword}& {\@bvpword}& {\@bvsword}\\
+ \hline
+ \setcounter{question}{\tbl@firstq}%
+ \addtocounter{question}{-1}\do@bvloop
+ {\@bvtword}& \prt@hlfcntr{tbl@points}&\hbox to \@cellwidth{\hfill}\\
+ \hline
+ \end{tabular}%
+}% @bvgrdtblquestions
+\def\do@bvloop{%
+ % \do@bvloop is used by \@bvgrdtblquestions
+ \addtocounter{question}{1}%
+ \ref{question@\arabic{question}} &
+ \bonuspointsofquestion{\arabic{question}}&\\
+ \hline
+ \@ifundefined{bonuspointsofq@\romannumeral \c@question}%
+ {}%
+ {\addto@hlfcntr{tbl@points}
+ {\csname bonuspointsofq@\romannumeral \c@question\endcsname}}%
+ \ifnum \value{question} < \tbl@lastq\relax
+ \let\next@bvloop=\do@bvloop
+ \else
+ \let\next@bvloop=\relax
+ \fi
+ \next@bvloop
+}% do@bvloop
+
+\def\@bvpttblquestions{%
+ % Vertical bonus point table, indexed by questions:
+ \set@hlfcntr{tbl@points}{0}%
+ \begin{tabular}{|c|c|}
+ \hline
+ {\@bvqword}& {\@bvpword}\\
+ \hline
+ \setcounter{question}{\tbl@firstq}%
+ \addtocounter{question}{-1}\do@bvptloop
+ {\@bvtword}& \prt@hlfcntr{tbl@points}\\
+ \hline
+ \end{tabular}%
+}% @bvpttblquestions
+\def\do@bvptloop{%
+ % \do@bvptloop is used by \@bvpttblquestions
+ \addtocounter{question}{1}%
+ \ref{question@\arabic{question}} &
+ \bonuspointsofquestion{\arabic{question}}\\
+ \hline
+ \@ifundefined{bonuspointsofq@\romannumeral \c@question}%
+ {}%
+ {\addto@hlfcntr{tbl@points}
+ {\csname bonuspointsofq@\romannumeral \c@question\endcsname}}%
+ \ifnum \value{question} < \tbl@lastq\relax
+ \let\next@bvptloop=\do@bvptloop
+ \else
+ \let\next@bvptloop=\relax
+ \fi
+ \next@bvptloop
+}% do@bvptloop
+
+\def\@vgrdtblquestions{%
+ % Vertical non-bonus grade table, indexed by questions:
+ \set@hlfcntr{tbl@points}{0}%
+ \begin{tabular}{|c|c|c|}
+ \hline
+ {\@vqword}& {\@vpword}& {\@vsword}\\
+ \hline
+ \setcounter{question}{\tbl@firstq}%
+ \addtocounter{question}{-1}\do@vloop
+ {\@vtword}& \prt@hlfcntr{tbl@points}&\hbox to \@cellwidth{\hfill}\\
+ \hline
+ \end{tabular}%
+}% @vgrdtblquestions
\def\do@vloop{%
+ % \do@vloop is used by \@vgrdtblquestions
\addtocounter{question}{1}%
- \thequestion & \pointsofquestion{\arabic{question}}&\\
+ \ref{question@\arabic{question}} &
+ \pointsofquestion{\arabic{question}}&\\
\hline
- \ifnum \arabic{question} < \numquestions\relax
+ \@ifundefined{pointsofq@\romannumeral \c@question}%
+ {}%
+ {\addto@hlfcntr{tbl@points}
+ {\csname pointsofq@\romannumeral \c@question\endcsname}}%
+ \ifnum \value{question} < \tbl@lastq\relax
\let\next@vloop=\do@vloop
\else
\let\next@vloop=\relax
\fi
\next@vloop
-}
+}% do@vloop
+
+\def\@vpttblquestions{%
+ % Vertical non-bonus point table, indexed by questions:
+ \set@hlfcntr{tbl@points}{0}%
+ \begin{tabular}{|c|c|}
+ \hline
+ {\@vqword}& {\@vpword}\\
+ \hline
+ \setcounter{question}{\tbl@firstq}%
+ \addtocounter{question}{-1}\do@vptloop
+ {\@vtword}& \prt@hlfcntr{tbl@points}\\
+ \hline
+ \end{tabular}%
+}% @vpttblquestions
+\def\do@vptloop{%
+ % \do@vptloop is used by \@vpttblquestions
+ \addtocounter{question}{1}%
+ \ref{question@\arabic{question}} &
+ \pointsofquestion{\arabic{question}}\\
+ \hline
+ \@ifundefined{pointsofq@\romannumeral \c@question}%
+ {}%
+ {\addto@hlfcntr{tbl@points}
+ {\csname pointsofq@\romannumeral \c@question\endcsname}}%
+ \ifnum \value{question} < \tbl@lastq\relax
+ \let\next@vptloop=\do@vptloop
+ \else
+ \let\next@vptloop=\relax
+ \fi
+ \next@vptloop
+}% do@vptloop
+
%--------------------------------------------------------------------
% Horizontal, indexed by question numbers:
-\def\@hgrdtblquestions{%
+\def\@htblquestions{%
+ % The table is horizontal and indexed by question numbers.
+ \@ifundefined{exam@numquestions}%
+ {}%
+ {%
+ \setcounter{num@cols}{\tbl@lastq}%
+ \addtocounter{num@cols}{-\tbl@firstq}%
+ \addtocounter{num@cols}{1}%
+ }%
+ % See whether it's bonus or non-bonus, and
+ % gradetable or pointtable:
\begingroup
% Save the current value of question in @iterator, so that
% we can restore it after doing the table:
- \setcounter{@iterator}{\arabic{question}}%
+ \setcounter{@iterator}{\value{question}}%
\renewcommand\arraystretch{\@gtblstretch}%
- \begin{tabular}{|l|*{\numquestions}{c|}c|}
- \hline
- {\@hqword}& \setcounter{question}{0}\do@qnumloop
- {\@htword}\\
- \hline
- {\@hpword}& \setcounter{question}{0}\do@ptloop
- \numpoints\\
- \hline
- {\@hsword}& \setcounter{question}{0}\do@sloop
- \\
- \hline
- \end{tabular}%
+ \if@bonus
+ \set@hlfcntr{tbl@points}{0}%
+ \begin{tabular}{|l|*{\thenum@cols}{c|}c|}
+ \hline
+ {\@bhqword}& \setcounter{question}{\tbl@firstq}%
+ \addtocounter{question}{-1}\do@qnumloop
+ {\@bhtword}\\
+ \hline
+ {\@bhpword}& \setcounter{question}{\tbl@firstq}%
+ \addtocounter{question}{-1}\do@bptloop
+ \prt@hlfcntr{tbl@points}\\
+ \hline
+ % If it's a grade table, add in the score line:
+ \if@scores
+ {\@bhsword}& \setcounter{question}{\tbl@firstq}%
+ \addtocounter{question}{-1}\do@sloop
+ \\
+ \hline
+ \fi
+ \end{tabular}%
+ \else
+ \set@hlfcntr{tbl@points}{0}%
+ \begin{tabular}{|l|*{\thenum@cols}{c|}c|}
+ \hline
+ {\@hqword}& \setcounter{question}{\tbl@firstq}%
+ \addtocounter{question}{-1}\do@qnumloop
+ {\@htword}\\
+ \hline
+ {\@hpword}& \setcounter{question}{\tbl@firstq}%
+ \addtocounter{question}{-1}\do@ptloop
+ \prt@hlfcntr{tbl@points}\\
+ \hline
+ % If it's a grade table, add in the score line:
+ \if@scores
+ {\@hsword}& \setcounter{question}{\tbl@firstq}%
+ \addtocounter{question}{-1}\do@sloop
+ \\
+ \hline
+ \fi
+ \end{tabular}%
+ \fi
% Restore the saved value of question:
- \setcounter{question}{\arabic{@iterator}}%
+ \setcounter{question}{\value{@iterator}}%
\endgroup
-}
+}% @htblquestions
+
+
+% \do@qnumloop and \do@sloop are used both by non-bonus gradetable and
+% by bonusgradetable:
\def\do@qnumloop{%
\addtocounter{question}{1}%
- \thequestion &
- \ifnum \arabic{question} < \numquestions\relax
+ \ref{question@\arabic{question}} &
+ \ifnum \value{question} < \tbl@lastq\relax
\let\next@qnloop=\do@qnumloop
\else
\let\next@qnloop=\relax
\fi
\next@qnloop
-}
+}% do@qnumloop
+\def\do@sloop{%
+ \addtocounter{question}{1}%
+ \hbox to \@cellwidth{\hfill}&
+ \ifnum \value{question} < \tbl@lastq\relax
+ \let\next@sloop=\do@sloop
+ \else
+ \let\next@sloop=\relax
+ \fi
+ \next@sloop
+}% do@sloop
+
+% \do@ptloop is used only by non-bonus gradetable:
\def\do@ptloop{%
\addtocounter{question}{1}%
\pointsofquestion{\arabic{question}}&
- \ifnum \arabic{question} < \numquestions\relax
+ \@ifundefined{pointsofq@\romannumeral \c@question}%
+ {}%
+ {\addto@hlfcntr{tbl@points}
+ {\csname pointsofq@\romannumeral \c@question\endcsname}}%
+ \ifnum \value{question} < \tbl@lastq\relax
\let\next@ptloop=\do@ptloop
\else
\let\next@ptloop=\relax
\fi
\next@ptloop
-}
-\def\do@sloop{%
+}% do@ptloop
+
+% \do@bptloop is used only by bonusgradetable:
+\def\do@bptloop{%
\addtocounter{question}{1}%
- \hbox to \@cellwidth{\hfill}&
- \ifnum \arabic{question} < \numquestions\relax
- \let\next@sloop=\do@sloop
+ \bonuspointsofquestion{\arabic{question}}&
+ \@ifundefined{bonuspointsofq@\romannumeral \c@question}%
+ {}%
+ {\addto@hlfcntr{tbl@points}
+ {\csname bonuspointsofq@\romannumeral \c@question\endcsname}}%
+ \ifnum \value{question} < \tbl@lastq\relax
+ \let\next@bptloop=\do@bptloop
\else
- \let\next@sloop=\relax
+ \let\next@bptloop=\relax
\fi
- \next@sloop
-}
+ \next@bptloop
+}% do@bptloop
%--------------------------------------------------------------------
%--------------------------------------------------------------------
-% Grading tables indexed by page numbers:
-%
+% Grade and point tables indexed by page numbers:
+
+
% The only pages listed are those on which there is a nonzero number
-% of points. We check pages 1 through \lastpage@withpoints; this way,
-% once we've checked that \lastpage@withpoints and
+% of points. We check pages \tbl@firstp through \tbl@lastp
+% Once we've checked that, e.g., \lastpage@withpoints and
% \pointsonpage@\romannumeral{\lastpage@withpoints} are defined, we
% can safely (we think) check \pointsonpage@\romannumeral{n} for all n
-% between 1 and \lastpage@withpoints without generating errors.
+% between \tbl@firstp and \tbl@lastp without generating errors.
+%
+% Actually: Since we added the notion of half points and half counters
+% (a long time ago), there won't be any errors even if
+% \pointsonpage@\romannumeral{n} isn't defined, since it's tested by the
+% lines:
+% \set@hlfcntr{tmp@hlfcntr}{\csname pointsonpage@\romannumeral
+% \csname c@@iterator\endcsname\endcsname}%
+% \ifhlfcntr@pos{tmp@hlfcntr}%
+% and if
+% \csname pointsonpage@\romannumeral
+% \csname c@@iterator\endcsname\endcsname
+% isn't defined, tmp@hlfcntr gets the value zero (because of the way
+% that \set@hlfcntr is written).
+
+
+% \find@prange makes sure the grading range is defined and that
+% its last page isn't before its first page.
+
+
+\def\find@prange#1{%
+ % We're doing a table indexed by pages.
+ \if@partial
+ \@ifundefined{tbl@\tbl@range @firstp}%
+ {%
+ \range@undefined
+ }%
+ {%
+ \@ifundefined{tbl@\tbl@range @lastp}%
+ {%
+ \range@undefined
+ }%
+ {%
+ \edef\tbl@firstp{\csname tbl@\tbl@range @firstp\endcsname}%
+ \edef\tbl@lastp{\csname tbl@\tbl@range @lastp\endcsname}%
+ % Check that firstp precedes or equals lastp:
+ \ifnum \tbl@firstp > \tbl@lastp
+ \fbox{Error: Grading Range `\tbl@range ':
+ Last page precedes first page.}%
+ \ClassError{exam}{%
+ In grading range `\tbl@range ', the last page\MessageBreak
+ \space\space comes before the first page.\MessageBreak
+ }{%
+ \string\begingradingrange \space must precede
+ \string\endgradingrange.\MessageBreak
+ }%
+ \else
+ \@tblpages{#1}%
+ \fi
+ }%
+ }%
+ \else
+ \def\tbl@firstp{1}%
+ % \tbl@lastp isn't used on the first run of LaTeX, and
+ % \lastpage@withbonuspoints is defined on the second and later runs.
+ \if@bonus
+ \def\tbl@lastp{\lastpage@withbonuspoints}%
+ \else
+ \def\tbl@lastp{\lastpage@withpoints}%
+ \fi
+ \@tblpages{#1}%
+ \fi
+}% find@prange
+
+
% Check that there's enough info from the .aux file to do a page
% indexed grade table:
-\def\@grdtblpages#1{%
+\def\@tblpages#1{%
\@ifundefined{lastpage@withpoints}%
{\ClassWarning{exam}{%
- You must run LaTeX twice more\MessageBreak
- \space\space to produce the grade table.\MessageBreak}%
- \fbox{Run \LaTeX{} twice more to produce the grade table}%
+ You must run LaTeX twice more\MessageBreak
+ \space\space to produce the table.\MessageBreak}%
+ \fbox{Run \LaTeX{} twice more to produce the table}%
}%
{%
\@ifundefined{pointsonpage@\romannumeral
\csname lastpage@withpoints\endcsname}%
{\ClassWarning{exam}{%
- You must run LaTeX again\MessageBreak
- \space\space to produce the grade table.\MessageBreak}%
- \fbox{Run \LaTeX{} again to produce the grade table}%
+ You must run LaTeX again\MessageBreak
+ \space\space to produce the table.\MessageBreak}%
+ \fbox{Run \LaTeX{} again to produce the table}%
}%
{%
\@whchtblpgs#1
}%
}%
-}
+}% @tblpages
\def\@whchtblpgs#1{%
+ % At this point, we know the table is indexed by pages.
+ % It can be vertical or horizontal,
+ % grade or point, and bonus or non-bonus.
\if v#1%
- \@vgrdtblpages
+ \@vtblpages
\else
\if h#1%
- \@hgrdtblpages
+ \@htblpages
\else
\ClassError{exam}{%
- The first optional argument to \protect\gradetable \MessageBreak
- \space \space must be either `h' or `v'\MessageBreak
+ The first optional argument to
+ \protect\gradetable,\MessageBreak
+ \space\space \protect\bonusgradetable,
+ \protect\pointtable, or\MessageBreak
+ \space\space
+ \protect\bonuspointtable \space must be either `h' or
+ `v'\MessageBreak
}{%
- Grade tables can be either horizontal or vertical;\MessageBreak
+ Grade tables and point tables can be either horizontal or
+ vertical;\MessageBreak
\space\space no diagonals allowed.\MessageBreak
}%
- \fbox{Error: Grade table: Invalid first optional argument `#1'.}%
+ \if@scores
+ \if@bonus
+ \fbox{Error: bonusgradetable: Invalid first optional argument
+ `#1'.}%
+ \else
+ \fbox{Error: gradetable: Invalid first optional argument
+ `#1'.}%
+ \fi
+ \else
+ \if@bonus
+ \fbox{Error: bonuspointtable: Invalid first optional argument
+ `#1'.}%
+ \else
+ \fbox{Error: pointtable: Invalid first optional argument
+ `#1'.}%
+ \fi
+ \fi
\fi
\fi
-}
+}% \@whchtblpgs
%--------------------------------------------------------------------
% Vertical, indexed by pages:
-\def\@vgrdtblpages{%
+\def\@vtblpages{%
+ % At this point, we know it's a vertical table indexed by pages.
+ % It can be grade or point, and bonus or non-bonus.
\begingroup
\renewcommand\arraystretch{\@gtblstretch}%
- \begin{tabular}{|c|c|c|}
- \hline
- {\@vpgword}& {\@vpword}& {\@vsword}\\
- \hline
- \setcounter{@iterator}{0}\pg@vloop
- {\@vtword}& \numpoints&\hbox to \@cellwidth{\hfill}\\
- \hline
- \end{tabular}%
+ \set@hlfcntr{tbl@points}{0}%
+ \if@bonus
+ \if@scores
+ \begin{tabular}{|c|c|c|}
+ \hline
+ {\@bvpgword}& {\@bvpword}& {\@bvsword}\\
+ \hline
+ \setcounter{@iterator}{\tbl@firstp}%
+ \addtocounter{@iterator}{-1}\pg@bvloop
+ {\@bvtword}& \prt@hlfcntr{tbl@points}&\hbox to \@cellwidth{\hfill}\\
+ \hline
+ \end{tabular}%
+ \else
+ \begin{tabular}{|c|c|}
+ \hline
+ {\@bvpgword}& {\@bvpword}\\
+ \hline
+ \setcounter{@iterator}{\tbl@firstp}%
+ \addtocounter{@iterator}{-1}\pg@ptbvloop
+ {\@bvtword}& \prt@hlfcntr{tbl@points}\\
+ \hline
+ \end{tabular}%
+ \fi
+ \else
+ \if@scores
+ \begin{tabular}{|c|c|c|}
+ \hline
+ {\@vpgword}& {\@vpword}& {\@vsword}\\
+ \hline
+ \setcounter{@iterator}{\tbl@firstp}%
+ \addtocounter{@iterator}{-1}\pg@vloop
+ {\@vtword}& \prt@hlfcntr{tbl@points}&\hbox to \@cellwidth{\hfill}\\
+ \hline
+ \end{tabular}%
+ \else
+ \begin{tabular}{|c|c|}
+ \hline
+ {\@vpgword}& {\@vpword}\\
+ \hline
+ \setcounter{@iterator}{\tbl@firstp}%
+ \addtocounter{@iterator}{-1}\pg@ptvloop
+ {\@vtword}& \prt@hlfcntr{tbl@points}\\
+ \hline
+ \end{tabular}%
+ \fi
+ \fi
\endgroup
-}
+}% @vtblpages
+
+
+% \pg@ptvloop and \pg@ptvloopline are used only by non-bonus pointtable:
+\def\pg@ptvloop{%
+ \addtocounter{@iterator}{1}%
+ % spanish.ldf redefines \@roman, so we'll avoid using \roman:
+ \set@hlfcntr{tmp@hlfcntr}{\csname pointsonpage@\romannumeral
+ \csname c@@iterator\endcsname\endcsname}%
+ \ifhlfcntr@pos{tmp@hlfcntr}%
+ \add@hlfcntrtohlfcntr{tbl@points}{tmp@hlfcntr}%
+ \pg@ptvloopline
+ \fi
+ \ifnum \the@iterator < \tbl@lastp\relax
+ \let\next@pg@ptvloop=\pg@ptvloop
+ \else
+ \let\next@pg@ptvloop=\relax
+ \fi
+ \next@pg@ptvloop
+}% pg@ptvloop
+\def\pg@ptvloopline{%
+ % We still don't understand why we need to hide this inside of a
+ % macro; there's some weird interaction with the \ifnum checking to
+ % see if something is ``>0''; checking that something is ``=0''
+ % doesn't cause the ``\ifnum incomplete'' (or whatever) error.
+ \pageref{firstpoints@onpage@\arabic{@iterator}} &
+ \pointsonpage{\the@iterator}\\
+ \hline
+}% pg@ptvloopline
+
+% \pg@vloop and \pg@vloopline are used only by non-bonus gradetable:
\def\pg@vloop{%
\addtocounter{@iterator}{1}%
+ % spanish.ldf redefines \@roman, so we'll avoid using \roman:
\set@hlfcntr{tmp@hlfcntr}{\csname pointsonpage@\romannumeral
- \csname c@@iterator\endcsname\endcsname}%
-% \set@hlfcntr{tmp@hlfcntr}{\csname pointsonpage@\roman{@iterator}\endcsname}%
-% spanish.ldf redefines \@roman, so we'll avoid \roman
+ \csname c@@iterator\endcsname\endcsname}%
\ifhlfcntr@pos{tmp@hlfcntr}%
+ \add@hlfcntrtohlfcntr{tbl@points}{tmp@hlfcntr}%
\pg@vloopline
\fi
- \ifnum \the@iterator < \lastpage@withpoints\relax
+ \ifnum \the@iterator < \tbl@lastp\relax
\let\next@pg@vloop=\pg@vloop
\else
\let\next@pg@vloop=\relax
\fi
\next@pg@vloop
-}
+}% pg@vloop
\def\pg@vloopline{%
% We still don't understand why we need to hide this inside of a
% macro; there's some weird interaction with the \ifnum checking to
% see if something is ``>0''; checking that something is ``=0''
% doesn't cause the ``\ifnum incomplete'' (or whatever) error.
- \the@iterator & \pointsonpage{\the@iterator}&\\
+ \pageref{firstpoints@onpage@\arabic{@iterator}} &
+ \pointsonpage{\the@iterator}&\\
\hline
-}
+}% pg@vloopline
+
+% \pg@bvloop and \pg@bvloopline are used only by bonus gradetable:
+\def\pg@bvloop{%
+ \addtocounter{@iterator}{1}%
+ % spanish.ldf redefines \@roman, so we'll avoid using \roman:
+ \set@hlfcntr{tmp@hlfcntr}{\csname bonuspointsonpage@\romannumeral
+ \csname c@@iterator\endcsname\endcsname}%
+ \ifhlfcntr@pos{tmp@hlfcntr}%
+ \add@hlfcntrtohlfcntr{tbl@points}{tmp@hlfcntr}%
+ \pg@bvloopline
+ \fi
+ \ifnum \the@iterator < \tbl@lastp\relax
+ \let\next@pg@bvloop=\pg@bvloop
+ \else
+ \let\next@pg@bvloop=\relax
+ \fi
+ \next@pg@bvloop
+}% pg@bvloop
+\def\pg@bvloopline{%
+ % We still don't understand why we need to hide this inside of a
+ % macro; there's some weird interaction with the \ifnum checking to
+ % see if something is ``>0''; checking that something is ``=0''
+ % doesn't cause the ``\ifnum incomplete'' (or whatever) error.
+ \pageref{firstbonuspoints@onpage@\arabic{@iterator}} &
+ \bonuspointsonpage{\the@iterator}&\\
+ \hline
+}% pg@bvloopline
+
+% \pg@ptbvloop and \pg@ptbvloopline are used only by bonus pointtable:
+\def\pg@ptbvloop{%
+ \addtocounter{@iterator}{1}%
+ % spanish.ldf redefines \@roman, so we'll avoid using \roman:
+ \set@hlfcntr{tmp@hlfcntr}{\csname bonuspointsonpage@\romannumeral
+ \csname c@@iterator\endcsname\endcsname}%
+ \ifhlfcntr@pos{tmp@hlfcntr}%
+ \add@hlfcntrtohlfcntr{tbl@points}{tmp@hlfcntr}%
+ \pg@ptbvloopline
+ \fi
+ \ifnum \the@iterator < \tbl@lastp\relax
+ \let\next@pg@ptbvloop=\pg@ptbvloop
+ \else
+ \let\next@pg@ptbvloop=\relax
+ \fi
+ \next@pg@ptbvloop
+}% pg@ptbvloop
+\def\pg@ptbvloopline{%
+ % We still don't understand why we need to hide this inside of a
+ % macro; there's some weird interaction with the \ifnum checking to
+ % see if something is ``>0''; checking that something is ``=0''
+ % doesn't cause the ``\ifnum incomplete'' (or whatever) error.
+ \pageref{firstbonuspoints@onpage@\arabic{@iterator}} &
+ \bonuspointsonpage{\the@iterator}\\
+ \hline
+}% pg@ptbvloopline
%--------------------------------------------------------------------
% Horizontal, indexed by pages:
-% For a horizontal table, we need to know how many pages there are
-% with points on them:
-\newcounter{numpgs@withpts}
+% For a horizontal table, before we begin we need to know how many
+% pages there are with points on them:
+\newcounter{num@cols}
\def\count@pgswpts{%
- \setcounter{numpgs@withpts}{0}%
- \setcounter{@iterator}{0}%
- \docount@pgswpts
-}
+ % \count@pgswpts is used for horizontal
+ % grade tables and point tables, both
+ % bonus and non-bonus.
+ \setcounter{num@cols}{0}%
+ \setcounter{@iterator}{\tbl@firstp}%
+ \addtocounter{@iterator}{-1}%
+ \if@bonus
+ \docount@pgswbpts
+ \else
+ \docount@pgswpts
+ \fi
+}% count@pgswpts
+
+% \docount@pgswpts is used for non-bonus gradetable:
\def\docount@pgswpts{%
\addtocounter{@iterator}{1}%
+ % spanish.ldf redefines \@roman, so we'll avoid using \roman:
\set@hlfcntr{tmp@hlfcntr}{\csname pointsonpage@\romannumeral
- \csname c@@iterator\endcsname\endcsname}%
-% \set@hlfcntr{tmp@hlfcntr}{\csname pointsonpage@\roman{@iterator}\endcsname}%
-% spanish.ldf redefines \@roman, so we'll avoid \roman
+ \csname c@@iterator\endcsname\endcsname}%
\ifhlfcntr@pos{tmp@hlfcntr}%
- \addtocounter{numpgs@withpts}{1}%
+ \addtocounter{num@cols}{1}%
\fi
- \ifnum \the@iterator < \lastpage@withpoints\relax
+ \ifnum \the@iterator < \tbl@lastp\relax
\let\next@docount=\docount@pgswpts
\else
\let\next@docount=\relax
\fi
\next@docount
-}
+}% docount@pgswpts
+% \docount@pgswbpts is used for bonusgradetable:
+\def\docount@pgswbpts{%
+ \addtocounter{@iterator}{1}%
+ % spanish.ldf redefines \@roman, so we'll avoid using \roman:
+ \set@hlfcntr{tmp@hlfcntr}{\csname bonuspointsonpage@\romannumeral
+ \csname c@@iterator\endcsname\endcsname}%
+ \ifhlfcntr@pos{tmp@hlfcntr}%
+ \addtocounter{num@cols}{1}%
+ \fi
+ \ifnum \the@iterator < \tbl@lastp\relax
+ \let\next@docount=\docount@pgswbpts
+ \else
+ \let\next@docount=\relax
+ \fi
+ \next@docount
+}% docount@pgswbpts
-\def\@hgrdtblpages{%
+%--------------------------------------------------------------------
+
+\def\@htblpages{%
\begingroup
\renewcommand\arraystretch{\@gtblstretch}%
\count@pgswpts
- \begin{tabular}{|l|*{\thenumpgs@withpts}{c|}c|}
- \hline
- {\@hpgword}& \setcounter{@iterator}{0}\do@pgnumloop
- {\@htword}\\
- \hline
- {\@hpword}& \setcounter{@iterator}{0}\do@pgptloop
- \numpoints\\
- \hline
- {\@hsword}& \setcounter{@iterator}{0}\do@pgsloop
- \\
- \hline
- \end{tabular}%
+ % Suppress ``extra alignment tab'' errors if \thenum@cols = 0:
+ \ifnum \thenum@cols = 0
+ \setcounter{num@cols}{1}%
+ \fi
+ \set@hlfcntr{tbl@points}{0}%
+ \if@bonus
+ \begin{tabular}{|l|*{\thenum@cols}{c|}c|}
+ \hline
+ {\@bhpgword}& \setcounter{@iterator}{\tbl@firstp}%
+ \addtocounter{@iterator}{-1}\do@bpgnumloop
+ {\@bhtword}\\
+ \hline
+ {\@bhpword}& \setcounter{@iterator}{\tbl@firstp}%
+ \addtocounter{@iterator}{-1}\do@bpgptloop
+ \prt@hlfcntr{tbl@points}\\
+ \hline
+ % If it's a grade table, do the line for scores:
+ \if@scores
+ {\@bhsword}& \setcounter{@iterator}{\tbl@firstp}%
+ \addtocounter{@iterator}{-1}\do@bpgsloop
+ \\
+ \hline
+ \fi
+ \end{tabular}%
+ \else
+ \begin{tabular}{|l|*{\thenum@cols}{c|}c|}
+ \hline
+ {\@hpgword}& \setcounter{@iterator}{\tbl@firstp}%
+ \addtocounter{@iterator}{-1}\do@pgnumloop
+ {\@htword}\\
+ \hline
+ {\@hpword}& \setcounter{@iterator}{\tbl@firstp}%
+ \addtocounter{@iterator}{-1}\do@pgptloop
+ \prt@hlfcntr{tbl@points}\\
+ \hline
+ % If it's a grade table, do the line for scores:
+ \if@scores
+ {\@hsword}& \setcounter{@iterator}{\tbl@firstp}%
+ \addtocounter{@iterator}{-1}\do@pgsloop
+ \\
+ \hline
+ \fi
+ \end{tabular}%
+ \fi
\endgroup
-}
+}% @htblpages
+% \do@pgnumloop, \pg@line, \do@pgptloop, \pgpt@line, \do@pgsloop, and
+% \pg@sline are only for non-bonus gradetable:
\def\do@pgnumloop{%
\addtocounter{@iterator}{1}%
+ % spanish.ldf redefines \@roman, so we'll avoid using \roman:
\set@hlfcntr{tmp@hlfcntr}{\csname pointsonpage@\romannumeral
- \csname c@@iterator\endcsname\endcsname}%
-% \set@hlfcntr{tmp@hlfcntr}{\csname pointsonpage@\roman{@iterator}\endcsname}%
-% spanish.ldf redefines \@roman, so we'll avoid \roman
+ \csname c@@iterator\endcsname\endcsname}%
\ifhlfcntr@pos{tmp@hlfcntr}%
\pg@line
\fi
- \ifnum \the@iterator < \lastpage@withpoints\relax
+ \ifnum \the@iterator < \tbl@lastp\relax
\let\next@pgnumloop=\do@pgnumloop
\else
\let\next@pgnumloop=\relax
\fi
\next@pgnumloop
-}
+}% \do@pgnumloop
\def\pg@line{%
- \the@iterator &
-}
+ \pageref{firstpoints@onpage@\arabic{@iterator}}&
+}% \pg@line
\def\do@pgptloop{%
\addtocounter{@iterator}{1}%
+ % spanish.ldf redefines \@roman, so we'll avoid using \roman:
\set@hlfcntr{tmp@hlfcntr}{\csname pointsonpage@\romannumeral
- \csname c@@iterator\endcsname\endcsname}%
-% \set@hlfcntr{tmp@hlfcntr}{\csname pointsonpage@\roman{@iterator}\endcsname}%
-% spanish.ldf redefines \@roman, so we'll avoid \roman
+ \csname c@@iterator\endcsname\endcsname}%
\ifhlfcntr@pos{tmp@hlfcntr}%
+ \add@hlfcntrtohlfcntr{tbl@points}{tmp@hlfcntr}%
\pgpt@line
\fi
- \ifnum \the@iterator < \lastpage@withpoints\relax
+ \ifnum \the@iterator < \tbl@lastp\relax
\let\next@pgptloop=\do@pgptloop
\else
\let\next@pgptloop=\relax
\fi
\next@pgptloop
-}
+}% \do@pgptloop
\def\pgpt@line{%
- \csname pointsonpage@\romannumeral \csname c@@iterator\endcsname\endcsname &
-% \csname pointsonpage@\roman{@iterator}\endcsname &
-% spanish.ldf redefines \@roman, so we'll avoid \roman
-}
+ % spanish.ldf redefines \@roman, so we'll avoid using \roman:
+ \csname pointsonpage@\romannumeral
+ \csname c@@iterator\endcsname\endcsname &
+}% \pgpt@line
\def\do@pgsloop{%
\addtocounter{@iterator}{1}%
-% \ifnum \csname pointsonpage@\roman{@iterator}\endcsname > 0\relax
+ % spanish.ldf redefines \@roman, so we'll avoid using \roman:
\set@hlfcntr{tmp@hlfcntr}{\csname pointsonpage@\romannumeral
- \csname c@@iterator\endcsname\endcsname}%
-% \set@hlfcntr{tmp@hlfcntr}{\csname pointsonpage@\roman{@iterator}\endcsname}%
-% spanish.ldf redefines \@roman, so we'll avoid \roman
+ \csname c@@iterator\endcsname\endcsname}%
\ifhlfcntr@pos{tmp@hlfcntr}%
+ \add@hlfcntrtohlfcntr{tbl@points}{tmp@hlfcntr}%
\pg@sline
\fi
- \ifnum \the@iterator < \lastpage@withpoints\relax
+ \ifnum \the@iterator < \tbl@lastp\relax
\let\next@pgsloop=\do@pgsloop
\else
\let\next@pgsloop=\relax
\fi
\next@pgsloop
-}
+}% \do@pgsloop
\def\pg@sline{%
\hbox to \@cellwidth{\hfill}&
-}
+}% \pg@sline
+
+%--------------------------------------------------------------------
+% These things are for bonusgradetable:
+
+% \do@bpgnumloop, \bpg@line, \do@bpgptloop, \bpgpt@line, \do@bpgsloop,
+% and \bpg@sline are only for bonusgradetable:
+\def\do@bpgnumloop{%
+ \addtocounter{@iterator}{1}%
+ % spanish.ldf redefines \@roman, so we'll avoid using \roman:
+ \set@hlfcntr{tmp@hlfcntr}{\csname bonuspointsonpage@\romannumeral
+ \csname c@@iterator\endcsname\endcsname}%
+ \ifhlfcntr@pos{tmp@hlfcntr}%
+ \bpg@line
+ \fi
+ \ifnum \the@iterator < \tbl@lastp\relax
+ \let\next@bpgnumloop=\do@bpgnumloop
+ \else
+ \let\next@bpgnumloop=\relax
+ \fi
+ \next@bpgnumloop
+}% do@bpgnumloop
+\def\bpg@line{%
+ \pageref{firstbonuspoints@onpage@\arabic{@iterator}}&
+}% bpg@line
+
+\def\do@bpgptloop{%
+ \addtocounter{@iterator}{1}%
+ % spanish.ldf redefines \@roman, so we'll avoid using \roman:
+ \set@hlfcntr{tmp@hlfcntr}{\csname bonuspointsonpage@\romannumeral
+ \csname c@@iterator\endcsname\endcsname}%
+ \ifhlfcntr@pos{tmp@hlfcntr}%
+ \add@hlfcntrtohlfcntr{tbl@points}{tmp@hlfcntr}%
+ \bpgpt@line
+ \fi
+ \ifnum \the@iterator < \tbl@lastp\relax
+ \let\next@bpgptloop=\do@bpgptloop
+ \else
+ \let\next@bpgptloop=\relax
+ \fi
+ \next@bpgptloop
+}% do@bpgptloop
+\def\bpgpt@line{%
+ % spanish.ldf redefines \@roman, so we'll avoid using \roman:
+ \csname bonuspointsonpage@\romannumeral
+ \csname c@@iterator\endcsname\endcsname &
+}% bpgpt@line
+
+\def\do@bpgsloop{%
+ \addtocounter{@iterator}{1}%
+ % spanish.ldf redefines \@roman, so we'll avoid using \roman:
+ \set@hlfcntr{tmp@hlfcntr}{\csname bonuspointsonpage@\romannumeral
+ \csname c@@iterator\endcsname\endcsname}%
+ \ifhlfcntr@pos{tmp@hlfcntr}%
+ \add@hlfcntrtohlfcntr{tbl@points}{tmp@hlfcntr}%
+ \bpg@sline
+ \fi
+ \ifnum \the@iterator < \tbl@lastp\relax
+ \let\next@bpgsloop=\do@bpgsloop
+ \else
+ \let\next@bpgsloop=\relax
+ \fi
+ \next@bpgsloop
+}% do@bpgsloop
+\def\bpg@sline{%
+ \hbox to \@cellwidth{\hfill}&
+}% bpg@sline
%--------------------------------------------------------------------
@@ -4259,21 +5380,22 @@
% If the documentclass options include ``answers'', then the command
-% \@printanswerstrue is given at the beginning of the run.
+% \printanswerstrue is given at the beginning of the run.
% If the documentclass options include ``noanswers'', then the command
-% \@printanswersfalse is given at the beginning of the run.
+% \printanswersfalse is given at the beginning of the run.
-\def\printanswers{\@printanswerstrue}
-\def\noprintanswers{\@printanswersfalse}
+\def\printanswers{\printanswerstrue}
+\def\noprintanswers{\printanswersfalse}
-% If @printanswers is true, we print the solution using a TheSolution
-% environment. If @printanswers is false, we insert blank vertical space
-% equal to the optional argument (the default value of which is 0pt).
+% If printanswers is true, we print the solution using a TheSolution
+% environment. If printanswers is false, we insert blank vertical
+% space equal to the optional argument (the default value of which is
+% 0pt).
\newenvironment{solution}[1][0pt]%
{%
- \if@printanswers
+ \ifprintanswers
\begin{TheSolution}%
\else
\par
@@ -4281,19 +5403,20 @@
\setbox\z@\vbox\bgroup
\fi
}{%
- \if@printanswers
+ \ifprintanswers
\end{TheSolution}%
\else
\egroup
\fi
}%
-% If @printanswers is true, we print the solution using a TheSolution
-% environment. If @printanswers is false, we insert lined vertical space
-% equal to the optional argument (the default value of which is 0pt).
+% If printanswers is true, we print the solution using a TheSolution
+% environment. If printanswers is false, we insert lined vertical
+% space equal to the optional argument (the default value of which is
+% 0pt).
\newenvironment{solutionorlines}[1][0pt]%
{%
- \if@printanswers
+ \ifprintanswers
\begin{TheSolution}%
\else
\par
@@ -4301,7 +5424,29 @@
\setbox\z@\vbox\bgroup
\fi
}{%
- \if@printanswers
+ \ifprintanswers
+ \end{TheSolution}%
+ \else
+ \egroup
+ \fi
+ }%
+
+
+% If printanswers is true, we print the solution using a TheSolution
+% environment. If printanswers is false, we insert dotted lined
+% vertical space equal to the optional argument (the default value of
+% which is 0pt).
+\newenvironment{solutionordottedlines}[1][0pt]%
+ {%
+ \ifprintanswers
+ \begin{TheSolution}%
+ \else
+ \par
+ \fillwithdottedlines{#1}%
+ \setbox\z@\vbox\bgroup
+ \fi
+ }{%
+ \ifprintanswers
\end{TheSolution}%
\else
\egroup
@@ -4309,12 +5454,13 @@
}%
-% The environment TheSolution is called from the solution environment
-% when @printanswers is true. It uses Donald Arseneau's
+% The environment TheSolution is called from the solution,
+% solutionorlines, and solutionordottedlines environments
+% when printanswers is true. It uses Donald Arseneau's
% framed.sty macros (included at the end if this file) to allow the
% solution to be broken across pages and have each piece enclosed in
% an fbox (or a colorbox, if the user has given the command
-% \shadedsolution).
+% \shadedsolutions).
%
% Of course, the user can change TheSolution with a \renewenvironment
% command.
@@ -4351,7 +5497,7 @@
\ClassError{exam}{%
You must load the color package with the command\MessageBreak
\space\space\protect\usepackage{color}\MessageBreak
- in order to use the command \protect\colorsolutions
+ in order to use the command \protect\shadedsolutions
\MessageBreak
}{%
This command makes use of the package color.sty,\MessageBreak