Previous: , Up: Adding Your Own Definitions   [Contents][Index]


13.5 Defining Unit List Aliases

Unit list aliases are treated differently from unit definitions, because they are a data entry shorthand rather than a true definition for a new unit. A unit list alias definition begins with ‘!unitlist’ and includes the alias and the definition; for example, the aliases included in the standard units data file are

!unitlist   hms     hr;min;sec
!unitlist   time    year;day;hr;min;sec
!unitlist   dms     deg;arcmin;arcsec
!unitlist   ftin    ft;in;1|8 in
!unitlist   usvol   cup;3|4 cup;2|3 cup;1|2 cup;1|3 cup;1|4 cup;\
                    tbsp;tsp;1|2 tsp;1|4 tsp;1|8 tsp

Unit list aliases are only for unit lists, so the definition must include a ‘;’. Unit list aliases can never be combined with units or other unit list aliases, so the definition of ‘time’ shown above could not have been shortened to ‘year;day;hms’.

As usual, be sure to run ‘units --check to ensure that the units listed in unit list aliases are conformable.