WeBWorK Problems

Trouble with answers including units in PGML

Re: Trouble with answers including units in PGML

by Davide Cervone -
Number of replies: 0
In the PGML block, don't enclose the correct answers in quotation marks if the variables already hold MathObjects. That causes the MathObject to be stringified and re-parsed, but since units are not parsed except by NumberWithUnits() or FormulaWithUnits(), these answers won't produce the correct MathObjects when re-parsed.

You only need to use quotation marks around the answer if it is a formula that hasn't been parsed into a MathObject yet (e.g., [____]{"x^2+3x-2"}.

Similarly, for your example $Temp = NumberWithUnits("$g", "m/s"); , there is no need to put $g in quotation marks, in general.

Finally, note that the definition of Terminal is missing the dollar sign (it should be $Terminal = ...