This shows you the differences between two versions of the page.
Both sides previous revision
Previous revision
Next revision
|
Previous revision
|
manual:chapter3:units [2019/11/19 13:33] claudio [Custom Units] |
manual:chapter3:units [2019/11/19 13:34] claudio [Custom Units] |
Custom units can also be defined as derived units, in terms of other base units. This is done with the ''UDEFINE'' command. For example typing ''750_ml'' ''%%'mug'%%'' ''UDEFINE'' would define a unit named ''mug'' as 750 ml. From that moment ''mug'' can be used in the exact same way as any system-defined unit, and it will be considered consistent with all other volume units. | Custom units can also be defined as derived units, in terms of other base units. This is done with the ''UDEFINE'' command. For example typing ''750_ml'' ''%%'mug'%%'' ''UDEFINE'' would define a unit named ''mug'' as 750 ml. From that moment ''mug'' can be used in the exact same way as any system-defined unit, and it will be considered consistent with all other volume units. |
| |
Custom units may also accept SI prefixes, but this needs to be explicitly enabled during the unit definition. To create a custom unit that accepts SI prefixes, the name of the unit needs to be preceded by a question mark ''?'' when the unit is defined. For example, following the previous example, fur the unit ''mug'' to accept SI prefixes, the definition should be done typing ''750_ml'' ''%%'?mug'%%'' ''UDEFINE'' creates a unit ''mug'' exactly as before, except now ''1_[Mmug]'' ''UBASE'' will produce ''750_m^3'', as expected. | Custom units may also accept SI prefixes, but this needs to be explicitly enabled during the unit definition. To create a custom unit that accepts SI prefixes, the name of the unit needs to be preceded by a question mark ''?'' when the unit is defined. For example, following the previous example, for the unit ''mug'' to accept SI prefixes, the definition should be done typing ''750_ml'' ''%%'?mug'%%'' ''UDEFINE'' creates a unit ''mug'' exactly as before, except now ''1_[Mmug]'' ''UBASE'' will produce ''750_m^3'', as expected. |
| |
New units can also be defined in terms of new (unknown) base units. For example typing ''3_apples'' ''%%'oranges'%%'' ''UDEFINE'' will define ''oranges'' as equivalent to 3 ''apples'', where ''apples'' is a base unit (amount of fruit?) that may or may not have been explicitly defined before. | New units can also be defined in terms of new (unknown) base units. For example typing ''3_apples'' ''%%'oranges'%%'' ''UDEFINE'' will define ''oranges'' as equivalent to 3 ''apples'', where ''apples'' is a base unit (amount of fruit?) that may or may not have been explicitly defined before. |