WeBWorK Main Forum

How add a compound unit (e.g. teslas) to list of allowed units?

How add a compound unit (e.g. teslas) to list of allowed units?

by Christian Seberino -
Number of replies: 2
Magnetic fields are measured in "teslas".  This is a common unit in physics
that is defined in terms of other SI units.

How add to Webwork's list of acceptable predefined units?

cs
In reply to Christian Seberino

Re: How add a compound unit (e.g. teslas) to list of allowed units?

by Tim Alderson -
I have had some luck using the macros
"parserNumberWithUnits.pl",
  "parserFormulaWithUnits.pl"

(See the following for a working example: NPL Directory: WHFreeman/Rogawski_Calculus_Early_Transcendentals_Second_Edition/9_Introduction_to_Differential_Equations/9.2_Models_Involving_y'=k(y-b)/9.2.8.pg)

I hope this helps...
In reply to Christian Seberino

Re: How add a compound unit (e.g. teslas) to list of allowed units?

by Michael Gage -
You need to add the new unit  to the pg/lib/Units.pm  file -- it's fairly clear how to do this from all of the other entries.  

If you do this and want to submit for general webwork use send the file to me or Jason (or if you have your own github account already set up you can send a pull request to github.com/openwebwork/pg

-- Mike