UNITDEF

From iMath
Jump to: navigation, search

Syntax

UNITDEF { "printname", symbol|string = expression }

Implemented in iMath since version 2.2.0 or earlier. The alternative quoted string for the unit name was implemented in iMath 2.2.10.

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. If this is not possible (e.g. your unitname contains special characters like superscripts), you can use a quoted string instead. 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.

See also

PREFIXDEF