I'm writing an exam in the exam
class and I'd like to set the point value for an entire group of questions at once. For example:
\documentclass{exam}
\title{Know your US States and Capitals!}
\begin{document}
\begin{questions}
\begingroup
\defaultpoints{2}
\question What is the capital of California?
\begin{choices}
\choice Los Angeles
\choice Sacramento
\choice San Francisco
\choice San Diego
\end{choices}
\question Which city serves as the capital of Texas?
\begin{choices}
\choice Dallas
\choice Houston
\choice Austin
\choice San Antonio
\end{choices}
\question What is the capital of Florida?
\begin{choices}
\choice Miami
\choice Orlando
\choice Jacksonville
\choice Tallahassee
\end{choices}
\endgroup
\begingroup
\defaultpoints{3}
\question Which city is the capital of New York?
\begin{choices}
\choice Buffalo
\choice Albany
\choice New York City
\choice Syracuse
\end{choices}
\question What is the capital of Nevada?
\begin{choices}
\choice Reno
\choice Henderson
\choice Carson City
\choice Las Vegas
\end{choices}
\question Which city serves as the capital of Colorado?
\begin{choices}
\choice Denver
\choice Boulder
\choice Colorado Springs
\choice Aurora
\end{choices}
\question What is the capital of Massachusetts?
\begin{choices}
\choice Springfield
\choice Boston
\choice Worcester
\choice Cambridge
\end{choices}
\question Which city is the capital of Washington state?
\begin{choices}
\choice Seattle
\choice Tacoma
\choice Spokane
\choice Olympia
\end{choices}
\endgroup
% no points should be specified
\question What is the capital of Hawaii?
\begin{choices}
\choice Maui
\choice Honolulu
\choice Kauai
\choice Hilo
\end{choices}
\question[5] Which city serves as the capital of Ohio?
\begin{choices}
\choice Cincinnati
\choice Columbus
\choice Cleveland
\choice Dayton
\end{choices}
\end{questions}
\end{document}
(N.B. I don't mean to comment on the actual difficulty of these questions!)
The output should be the same as if the first three questions were declared with \question[2]
, and the next five with \question[3]
. The ninth question is outside a group of default points, so shouldn't have any points attached to it. The last question should work as a normal question with points defined.
I have a h@cky solution already and I will post it eventually, but I'm curious to see if there are better ones.