Answers in Option Form - PGML

From WeBWorK_wiki
Revision as of 08:23, 13 May 2015 by Dpvc (talk | contribs) (Initial version)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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.

 This value of [: sqrt($a) :] is [_____]{sqrt($a)}{10}

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).

 This value of [: sqrt($a) :] is [_____]{width=>10, answer=>sqrt($a)}

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).

 This value of [: sqrt($a) :] is [_____]{width=>10}