PREP 2015 Question Authoring - Archived

Units displayed in "Correct answer" with Number

Re: Units displayed in "Correct answer" with Number

by Davide Cervone -
Number of replies: 0
You should be able to do what you did originally and have it work, so this is a bug in the NumberWithUnits() macro. It turns out that when the number that you pass to NumberWithUnits() is already a MathObject, NumberWithUnits() will not create a new one but reuses that object and adds the unit information to it. But if the MathObject came from Compute(), it will have set the correct answer to what was passed to it, and NumberWithUnits() unfortunately doesn't change that, so the units are missing when the correct answer is used.


I've put an updated copy of parserNumberWithUnits.pl in our course's templates/macros folder as a temporary fix, but will need to do a more thorough one for the official release. in any case, your original file should show correct units now.