PREP 2014 Question Authoring - Archived

Essay box and PGML

Essay box and PGML

by Michele Titcombe -
Number of replies: 2
I have been playing around with PGML, which was pretty straightforward until I thought of including an essay box within a question.

What if one wanted the following general idea for a problem?
-Part (a) of the question requires an essay answer.
-Part (b) requires that the student enters a vector function.

How does that work if there needs to be an ANS line in the code outside of the BEGIN_PGML...END_PGML section?
In reply to Michele Titcombe

Re: Essay box and PGML

by Davide Cervone -
You can include an essay box in PGML using the following:
loadMacros("PGessaymacros.pl","PGML.pl");

BEGIN_PGML
[@ ANS(essay_cmp); essay_box(5,50) @]*
END_PGML
This uses the ability to execute arbitrary commands via [@ ... @], and the fact that the result of the last command is inserted into the PGML output. The star at the end means insert it verbatim, without further processing (so the HTML that essay_box() produces will pass through unchanged).

Hope that is what you are looking for.

In reply to Davide Cervone

Re: Essay box and PGML

by Michele Titcombe -
Yes, thank you Davide, that is exactly what I was looking for. I didn't know that one could include the ANS call within [@...@], but now I do!