UNITDEF: Difference between revisions
(Created page with "{{Keyword | 1= <code>UNITDEF { "printname", symbol = expression }</code> | 2= Defines a new unit. The symbol is the name of the unit and must begin with a percent sign...") |
No edit summary |
||
Line 13: | Line 13: | ||
<code>UNITDEF{ "''", %inch = 0.0254 %metre }</code> defines inches and tells iMath to print them as a double dash. | <code>UNITDEF{ "''", %inch = 0.0254 %metre }</code> defines inches and tells iMath to print them as a double dash. | ||
| | |||
4= | |||
[[PREFIXDEF]] | |||
}} | }} | ||
[[Category:Definition]] | [[Category:Definition]] |
Revision as of 19:47, 27 June 2017
Syntax
UNITDEF { "printname", symbol = expression }
Implemented in iMath since version 2.2.0 or earlier.
Explanation
Defines a new unit. The symbol is the name of the unit and must begin with a percent sign % to distinguish it from a variable name. The expression defines the unit in terms of units already known to iMath. If this expression contains data types apart from units, powers of units, numerics, or constants already known to iMath, a warning is issued, but the unit definition is created anyway.
The printname (enclosed in double quotes) is optional and gives a text to be printed instead of the symbol. This is useful when defining units whose name is not a valid symbol.
Example
UNITDEF { "", %mm = 10^{-3} %metre }
defines a new unit %mm
.
UNITDEF{ "''", %inch = 0.0254 %metre }
defines inches and tells iMath to print them as a double dash.