Answers in Option Form - PGML
Specifying the Width of an Answer Rule
Normally, the width of an answer blank in PGML is proportional to the number of underscores used in the brackets that defined the blank. So a longer answer blank uses more underscores. It is also possible to give the width of the answer blank numerically. To do so, put the width in braces following the answer.
BEGIN_PGML This value of [: sqrt($a) :] is [_____]{sqrt($a)}{10} END_PGML
Here, the width the answer answer rule will be 10 regardless of how many underscores are used.
Specifying Answers via Options
Normally, the answer and optional width are given by enclosing them in braces following the answer blank. It is also possible to use key/value pairs to specify the answer and width (in any order).
BEGIN_PGML This value of [: sqrt($a) :] is [_____]{width=>10, answer=>sqrt($a)} END_PGML
This takes a little more space, but make the meanings of the values more clear. It also makes it possible to provide the width without providing an answer (if you are using ANS()
to specify the answer checker).
BEGIN_PGML This value of [: sqrt($a) :] is [_____]{width=>10} END_PGML ANS(Real(sqrt($a))->cmp);