4.5: Statement
- Page ID
- 555712
\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)
\( \newcommand{\dsum}{\displaystyle\sum\limits} \)
\( \newcommand{\dint}{\displaystyle\int\limits} \)
\( \newcommand{\dlim}{\displaystyle\lim\limits} \)
\( \newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\)
( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\)
\( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)
\( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\)
\( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)
\( \newcommand{\Span}{\mathrm{span}}\)
\( \newcommand{\id}{\mathrm{id}}\)
\( \newcommand{\Span}{\mathrm{span}}\)
\( \newcommand{\kernel}{\mathrm{null}\,}\)
\( \newcommand{\range}{\mathrm{range}\,}\)
\( \newcommand{\RealPart}{\mathrm{Re}}\)
\( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)
\( \newcommand{\Argument}{\mathrm{Arg}}\)
\( \newcommand{\norm}[1]{\| #1 \|}\)
\( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)
\( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\AA}{\unicode[.8,0]{x212B}}\)
\( \newcommand{\vectorA}[1]{\vec{#1}} % arrow\)
\( \newcommand{\vectorAt}[1]{\vec{\text{#1}}} % arrow\)
\( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\( \newcommand{\vectorC}[1]{\textbf{#1}} \)
\( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)
\( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)
\( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \)
\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\(\newcommand{\longvect}{\overrightarrow}\)
\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)
\(\newcommand{\ket}[1]{\left| #1 \right>}\)
\(\newcommand{\bra}[1]{\left< #1 \right|}\)
\(\newcommand{\braket}[2]{\left< #1 \vphantom{#2} \right| \left. #2 \vphantom{#1} \right>}\)
\(\newcommand{\braopket}[3]{\left< #1 \vphantom{#2}\vphantom{#3} \right| #2 \vphantom{#1}\vphantom{#3} \left| #3 \vphantom{#1}\vphantom{#2} \right>}\)
\(\newcommand{\qmvec}[1]{\mathbf{\vec{#1}}}\)
\(\newcommand{\op}[1]{\hat{\mathbf{#1}}}\)
\(\newcommand{\expect}[1]{\langle #1 \rangle}\)
\(\newcommand{\dfn}[1]{\emph{\textbf{#1}}}\)
\(\newcommand{\avec}{\mathbf a}\) \(\newcommand{\bvec}{\mathbf b}\) \(\newcommand{\cvec}{\mathbf c}\) \(\newcommand{\dvec}{\mathbf d}\) \(\newcommand{\dtil}{\widetilde{\mathbf d}}\) \(\newcommand{\evec}{\mathbf e}\) \(\newcommand{\fvec}{\mathbf f}\) \(\newcommand{\nvec}{\mathbf n}\) \(\newcommand{\pvec}{\mathbf p}\) \(\newcommand{\qvec}{\mathbf q}\) \(\newcommand{\svec}{\mathbf s}\) \(\newcommand{\tvec}{\mathbf t}\) \(\newcommand{\uvec}{\mathbf u}\) \(\newcommand{\vvec}{\mathbf v}\) \(\newcommand{\wvec}{\mathbf w}\) \(\newcommand{\xvec}{\mathbf x}\) \(\newcommand{\yvec}{\mathbf y}\) \(\newcommand{\zvec}{\mathbf z}\) \(\newcommand{\rvec}{\mathbf r}\) \(\newcommand{\mvec}{\mathbf m}\) \(\newcommand{\zerovec}{\mathbf 0}\) \(\newcommand{\onevec}{\mathbf 1}\) \(\newcommand{\real}{\mathbb R}\) \(\newcommand{\twovec}[2]{\left[\begin{array}{r}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\ctwovec}[2]{\left[\begin{array}{c}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\threevec}[3]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\cthreevec}[3]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\fourvec}[4]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\cfourvec}[4]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\fivevec}[5]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\cfivevec}[5]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\mattwo}[4]{\left[\begin{array}{rr}#1 \amp #2 \\ #3 \amp #4 \\ \end{array}\right]}\) \(\newcommand{\laspan}[1]{\text{Span}\{#1\}}\) \(\newcommand{\bcal}{\cal B}\) \(\newcommand{\ccal}{\cal C}\) \(\newcommand{\scal}{\cal S}\) \(\newcommand{\wcal}{\cal W}\) \(\newcommand{\ecal}{\cal E}\) \(\newcommand{\coords}[2]{\left\{#1\right\}_{#2}}\) \(\newcommand{\gray}[1]{\color{gray}{#1}}\) \(\newcommand{\lgray}[1]{\color{lightgray}{#1}}\) \(\newcommand{\rank}{\operatorname{rank}}\) \(\newcommand{\row}{\text{Row}}\) \(\newcommand{\col}{\text{Col}}\) \(\renewcommand{\row}{\text{Row}}\) \(\newcommand{\nul}{\text{Nul}}\) \(\newcommand{\var}{\text{Var}}\) \(\newcommand{\corr}{\text{corr}}\) \(\newcommand{\len}[1]{\left|#1\right|}\) \(\newcommand{\bbar}{\overline{\bvec}}\) \(\newcommand{\bhat}{\widehat{\bvec}}\) \(\newcommand{\bperp}{\bvec^\perp}\) \(\newcommand{\xhat}{\widehat{\xvec}}\) \(\newcommand{\vhat}{\widehat{\vvec}}\) \(\newcommand{\uhat}{\widehat{\uvec}}\) \(\newcommand{\what}{\widehat{\wvec}}\) \(\newcommand{\Sighat}{\widehat{\Sigma}}\) \(\newcommand{\lt}{<}\) \(\newcommand{\gt}{>}\) \(\newcommand{\amp}{&}\) \(\definecolor{fillinmathshade}{gray}{0.9}\)
Statement
The Statement is the student-facing prompt written in PGML. It is where the story, data, and tasks become visible, and where each blank must be tied to one answer object from Setup.
The Statement never grades anything. Blanks are just hooks into Setup, and PGML reads top to bottom like a worksheet, not like code. If something grades incorrectly, the cause is almost never here, even if the formatting looks scary.
How to read this code
The statement is the only part of the file that students actually read. Your goal here is to keep the text readable while making sure every blank is unambiguous and attached to the correct answer checker. PGML allows you to do this without mixing formatting logic into setup code.
The excerpt below shows the full statement used in the example, including how answer objects are inserted into the text.
BEGIN_PGML
My favorite color is
[_]{$radio1}
The same question with horizontal options:
My favorite color is [_]{$radio2}
END_PGML
Line notes
| Line or snippet | What it does | What you would change first |
|---|---|---|
BEGIN_PGML |
Starts PGML rendering. | Required for PGML formatting. |
| Plain text | Displays directly to students. | Edit freely for clarity. |
[_]{$radio1} |
Inserts a blank bound to an answer checker. | Reorder or duplicate blanks here. |
{$radio2} |
References a second answer object. | Update if setup changes. |
END_PGML |
Ends the PGML block. | Always required. |
If grading works but students are confused, the problem is usually here rather than in setup. Read the statement out loud and check whether each blank clearly signals what kind of answer is expected.
Think of the Statement as a contract. The text you show here must match what the checker accepts, or students will feel the grading is arbitrary even when their reasoning is right. Example: the prompt asks for one choice, but the blank is tied to a different answer object.
Choose the structure that reduces reading load: use short paragraphs for a single task, lists for steps, and tables for multi-value data. For emphasis and color options, see Text Coloring and Emphasis. If a prompt feels hard to scan, structure is usually the fix, not more words.
Why this exists: it is the student-facing prompt that ties the story to the answer blanks.
| Common edits | Common failures |
|---|---|
|
|
Fast test: render one seed, enter the expected answer, confirm grading, then change the seed and repeat.
Blanks map
| Blank label | What it asks for | Answer object | Student format expectations |
|---|---|---|---|
| radio1 | Single-choice selection | $radio1 | Select one option. |
| radio2 | Single-choice selection (horizontal) | $radio2 | Select one option. |
Blank binding smell test: if a blank is visible but always marks wrong, confirm it is attached to an answer object defined in Setup.
Broken example: blank attached to the wrong answer object
This is one of the most common PGML mistakes. The problem renders cleanly, but answers are silently mismatched.
BEGIN_PGML
The enzyme with the highest activity is [_]{$radio2}.
END_PGML
In setup, $radio1 and $radio2 are both defined, but $radio2 corresponds to a different question.
What went wrong
- The blank is bound to the wrong answer object.
- The prompt text and grading logic no longer refer to the same concept.
- There is no syntax error, so nothing warns the author.
How to recognize it
- The blank accepts input, but grading feels random.
- Swapping answers between blanks changes which one grades correctly.
- Reviewing setup reveals multiple answer objects with similar names.
How to fix it
Use consistent naming and keep the statement immediately adjacent to the setup during editing. When in doubt, temporarily print ->correct_ans in the solution to confirm alignment.
Use tables only when there is real data to scan or compare, not to simulate layout. Lists and short paragraphs are usually better for narrative prompts.
Structure patterns
| Pattern | When to use | Avoid when |
|---|---|---|
| Short paragraphs | One clear story with 1 to 2 tasks. | Steps are procedural or multi-part. |
| Lists | Protocols or multi-step directions. | The prompt is a single sentence. |
| Tables | Real data or comparisons need scanning. | Two values can be in plain text. |
| Inline math | Small substitutions and unit checks. | Equations are long or multi-line. |
For radio buttons and other choice-based inserts, load parserRadioButtons.pl and follow the OpenWeBWorK technique samples for multiple choice patterns, using those pages as the pattern directory.
MultiAnswer is an optional advanced variant for interdependent blanks; use the parserMultiAnswer.pl documentation and its sample problem when you need shared logic.


