UNITDEF

From iMath
Revision as of 19:47, 27 June 2017 by Jrheinlaender (talk | contribs)
Jump to navigation Jump to search

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.

See also

PREFIXDEF