13.1 Class length

class length( f, type="u", unit=None)
The constructor of the length class expects as its first argument a number f, which represents the prefactor of the given length. By default this length is interpreted as a user length (type="u") in units of the current default unit (see set() function of the unit module). Optionally, a different type may be specified, namely "u" for user lengths, "v" for visual lengths, "w" for width lengths, "x" for TEX length, and "t" for true lengths. Furthermore, a different unit may be specified using the unit argument. Allowed values are "cm", "mm", "inch", and "pt".

Instances of the length class support addition and substraction either by another length or by a number which is then interpeted as being a user length in default units, multiplication by a number and division either by another length in which case a float is returned or by a number in which case a length instance is returned. When two lengths are compared, they are first converted to meters (using the currently set scaling), and then the resulting values are compared.