Changes

Jump to navigation Jump to search
1,513 bytes added ,  16:16, 11 October 2015
Removing content which IMO showed the wrong way to do things
< [[Math]] [[Physics]] >
The units module comes with ConTeXt's default distribution, and can be accessed via <cmd>usemodule</cmd>[units].
 
However, in MkIV we have integrated an upgrade to this mechanism so if you're using that version you might want to skip this first part.
 
Additional documentation about units in MkIV is available from the [[http://www.pragma-ade.com/general/manuals/units-mkiv.pdf Units manual]]
 
The following is copied from the source file [[source:m-units.tex|m-units.tex]] and only slightly modified:
External link:
[[http://www.unc.edu/~rowlett/units/index.html How Many? A Dictionary of Units of Measurement]]
 
 
* 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)
* Energy, Electricity and Magnetism: <cmd>Joule</cmd>, <cmd>Watt</cmd>, <cmd>Cal</cmd>, <cmd>Farad</cmd>, <cmd>Henry</cmd>, <cmd>Ohm</cmd>, <cmd>Siemens</cmd>, <cmd>Ampere</cmd>, <cmd>Coulomb</cmd>, <cmd>Volt</cmd>, <cmd>Tesla</cmd>, <cmd>Gauss</cmd>, <cmd>VoltAC</cmd>, <cmd>VoltDC</cmd>, <cmd>EVolt</cmd>, <cmd>Weber</cmd>
* Temperature: <cmd>Degrees</cmd>, <cmd>Kelvin</cmd>, <cmd>Celsius</cmd>, <cmd>Fahrenheit</cmd>
* Angle: <cmd>Rad</cmd>, <cmd>Deg</cmd>, <cmd>Sterant</cmd>
* Frequency, Optics and Acoustics: <cmd>Hertz</cmd>, <cmd>RevPerSec</cmd>, <cmd>RevPerMin</cmd>, <cmd>Candela</cmd>, <cmd>Lux</cmd>, <cmd>Bell</cmd>
* Chemistry and Radiation: <cmd>Atom</cmd>, <cmd>Mol</cmd>, <cmd>Molair</cmd>, <cmd>Equivalent</cmd>, <cmd>Bequerel</cmd>, <cmd>Sievert</cmd>, <cmd>Gray</cmd>
* Informatics: <cmd>Baud</cmd>, <cmd>Bit</cmd>, <cmd>Byte</cmd>
* Other (please sort in): <cmd>Sterant</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===
 
In MkIV you can use the built-in <cmd>unit</cmd> command. This time we don't use commands, if only because it is somewhat cumbersome. Let's give a few examples:
 
<texcode>
10 \unit{km/h}
\unit{10 km/h}
\unit{~1 km/h}
\unit{KiloMeter/Hour}
\unit{10 cubic meter / second}
\unit{kilo pascal square meter / second}
\unit{kilo pascal square meter / kelvin second }$
\unit{10 AC}
$\frac{10 \unit{m/s}}{20 \unit{m/s}}$
{\ss 30 \unit{kilo pascal square meter / second kelvin}}
\unit{123.22^-3 km/s}
\unit{123.22e-3 km/s}
</texcode>
 
The command works in text as well as in math mode and spaces are normally ignored. You can define your own command:
 
<texcode>
\defineunits[un][alternative=text,separator=medium]
</texcode>
 
Valid separators are <code>cdot</code>, <code>big</code>, <code>medium</code>, and <code>space</code> with the first being the default. You can later tune the rendering with
 
<texcode>
\setupunits[un][separator=cdot]
</texcode>
 
In due time there will be a few more options. Numbers are formatted cf the digits mechanism (not discussed here).
 
 
[[Category:Math]]
[[Category:Modules]]

Navigation menu