Changes

Jump to navigation Jump to search
723 bytes removed ,  16:33, 28 May 2020
m
no edit summary
External link:
[[httphttps://www.unceasyunitconverter.educom/~rowlett/units/index.html How Many? A Dictionary of Units of MeasurementEasy Unit Converter]]
* Prefixes: <cmd>Atto</cmd> a, <cmd>Femto</cmd> f, <cmd>Pico</cmd> p, <cmd>Nano</cmd> n, <cmd>Micro</cmd> μ, <cmd>Milli</cmd> m, <cmd>Centi</cmd> c, <cmd>Deci</cmd> d, <cmd>Hecto</cmd> h, <cmd>Kilo</cmd> k, <cmd>Mega</cmd> M, <cmd>Giga</cmd> G, <cmd>Tera</cmd> T, <cmd>Peta</cmd> P, <cmd>Exa</cmd> E (missing: <cmd>Zetta</cmd> Z, <cmd>Yotta</cmd> Y, <cmd>Zepto</cmd> z, <cmd>Yocto</cmd> y)
* Informatics: <cmd>Baud</cmd>, <cmd>Bit</cmd>, <cmd>Byte</cmd>
* some old dutch (not listed)
 
===Define a new unit===
 
<context source="yes">
\usemodule[units]
\unit[Mynewunit]{Nu}{New Unit}
 
10 \Mynewunit
 
</context>
===Using the built-in command===
\unit{123.22e-3 km/s}
</texcode>
 
ConTeXt will take care of spacing and formatting. The parser is fairly flexible, and the following all work and give the same output.
 
{|
! width="45%"|
! width="10%"|
! width="45%"|
|-
| <texcode>
\unit{10 kg}
\unit{10kg}
\unit{10 kilo gram}
\unit{10 kilogram}
\unit{10 Kilo Gram}
\unit{10 KiloGram}
</texcode>
|
|<context mode=mkiv>
\starttext
\startlines
\unit{10 kg}
\unit{10kg}
\unit{10 kilo gram}
\unit{10 kilogram}
\unit{10 Kilo Gram}
\unit{10 KiloGram}
\stoplines
\stoptext
</context>
|}
The command works in text as well as in math mode and spaces are normally ignored. You can define your own command:
In due time there will be a few more options. Numbers are formatted cf the digits mechanism (not discussed here).
 
===Expressing Physical quantities===
 
A physical quantity is number plus unit, and should not be split. A simple way to do this follows - define your own macro:
 
<texcode>
\define[3]\physicalquantityle{\hbox{#1 \times \lunit{10^#2 #3}}}
</texcode>
 
You can then write
\physicalquantityle{number}{exponent}{unit}
 
This seems to give better results than any other way I have found of combining digits and units.
 
The full range of variants allow expression of physical quantities with and without exponents, with units in long form or not:
<texcode>
\define[2]\physicalquantity{\hbox{\unit{#1 #2}}}
% \physicalquantity{number}{unit} -- gives short form of unit
\define[2]\physicalquantityl{\hbox{\lunit{#1 #2}}}
% \physicalquantityl{number}{unit} -- gives long form of unit
\define[3]\physicalquantitye{\hbox{#1 \times \lunit{10^#2 #3}}}
% \physicalquantitye{number}{exponent}{unit} -- gives short form of unit
\define[3]\physicalquantityle{\hbox{#1 \times \lunit{10^#2 #3}}}
% \physicalquantityle{number}{exponent}{unit} -- gives long form of unit
</texcode>
 
 
You can also do ranges of units, that are otherwise messy to code up on an individual basis
 
 
<texcode>
\define[3]\physicalquantityspread{\hbox{#1\endash \lunit{#2 #3}}}
</texcode>
 
You can then write:
\physicalquantityspread{start}{end}{unit}
 
 

Navigation menu