fix(exam): keep each question whole across page breaks (#29) - #30
Merged
Conversation
Exam questions frequently split across a page boundary — a stem stranded at
the bottom of a page with its answer choices pushed to the next. Beyond
readability, on a proctored paper exam this invites "I never saw part (d)"
disputes.
reference_exam.tex now, in the preamble only:
- reserves \qreserve (default 5\baselineskip) at the top of every top-level
question \item via an enumitem before-hook; level-2 (choice) items are
exempt, so only whole questions are space-reserved
- glues each stem to its choice list (\@beginparpenalty)
- damps widows/orphans (\clubpenalty/\widowpenalty)
- sets \raggedbottom so pages run short rather than force-fit a question
Automatic (no per-question authoring change) and parser-safe: the authored
"\item ... \textit{(N pts)}" pattern is untouched, so exam_pack form-splitting
(_QSTART_RE / _PTS_RE) and outline parsing are unaffected. No Python change.
\qreserve is tunable per exam. Applies to exams authored from the template
going forward; existing exam .tex are not backfilled.
Verification: a 40-question four-choice stress build splits 3 questions with
the pre-#29 template and 0 with this template, at the same page count. Full
suite green (405 passed).
Docs: docs/design/exam-tex-format.md (new "Page-break discipline" section),
CHANGELOG.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011L61RXxaELhXPvbW2RBF5m
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #29.
Problem
Exam questions frequently split across a page boundary — a stem stranded at the bottom of a page with its answer choices pushed to the next. Beyond readability, on a proctored paper exam this invites "I never saw part (d)" disputes.
Fix (template-only, preamble)
references/reference_exam.tex:\qreservereserve (default5\baselineskip) at the top of every top-level question\itemvia anenumitembefore-hook — if that much room isn't left, the whole question moves to the next page. Level-2 (choice) items are exempt (theenumerate,2hook restores the plain\item), so only whole questions are space-reserved.\@beginparpenalty=9999.\clubpenalty/\widowpenalty= 10000).\raggedbottomso pages run short rather than stretch to force-fit a question.\qreserveis tunable per exam.Why it's safe
\item ... \textit{(N pts)}pattern is untouched, soexam_packform-splitting (_QSTART_RE/_PTS_RE) and outline parsing are unaffected. No Python change..texare not modified (per maintainer direction).Verification
reference_exam.texcompiles clean in both student and\answersmodekey builds.Docs
docs/design/exam-tex-format.md— new "Page-break discipline — questions stay whole" section (mechanism,\qreservetuning, parser-safety note, verification).CHANGELOG.md— Unreleased entry.🤖 Generated with Claude Code
https://claude.ai/code/session_011L61RXxaELhXPvbW2RBF5m