NamedAnswerRules: Difference between revisions
Jump to navigation
Jump to search
(Created page with "<h2>Your title here: PG Code Snippet</h2> <!-- Header for these sections -- no modification needed --> <p style="background-color:#eeeeee;border:black solid 1px;padding:3...") |
No edit summary |
||
Line 1: | Line 1: | ||
<h2> | <h2>Name Answer Rules</h2> | ||
<!-- Header for these sections -- no modification needed --> | <!-- Header for these sections -- no modification needed --> | ||
<p style="background-color:#eeeeee;border:black solid 1px;padding:3px;"> | <p style="background-color:#eeeeee;border:black solid 1px;padding:3px;"> | ||
<em>This PG code shows how to | <em>This PG code shows how to used named answers in problems in such a way that the problem will work in both homework and gateway quizzes. Note that this is an <b>insertion</b>, not a complete PG file. This code will have to be incorporated into the problem file on which you are working.</em> | ||
</p> | </p> | ||
Line 34: | Line 34: | ||
<p> | <p> | ||
<b>Initialization:</b> | <b>Initialization:</b> | ||
The usual stuff here. | |||
</p> | </p> | ||
</td> | </td> |
Revision as of 16:10, 6 May 2021
Name Answer Rules
This PG code shows how to used named answers in problems in such a way that the problem will work in both homework and gateway quizzes. Note that this is an insertion, not a complete PG file. This code will have to be incorporated into the problem file on which you are working.
PG problem file | Explanation |
---|---|
DOCUMENT(); loadMacros( "PGstandard.pl", "MathObjects.pl", ); TEXT(beginproblem()); |
Initialization: The usual stuff here. |
Context("....."); Define context and variables for the questions $expr = Formula("...."); |
Setup:
We specify that the Context should be Notes: on using this and related Contexts. |
BEGIN_TEXT ...... question text ...... END_TEXT |
Main Text: The problem text section of the file is as we'd expect. |
$showPartialCorrectAnswers = 1; ANS( $expr->cmp() ); ENDDOCUMENT(); |
Answer Evaluation: As is the answer. |
- POD documentation: nameOfMacro.pl
- PG macro: nameOfMacro.pl