Changes

Jump to navigation Jump to search
1,069 bytes removed ,  16:16, 11 October 2015
Removing content which IMO showed the wrong way to do things
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:
* 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===
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}
 
 
[[Category:Math]]
[[Category:Physics]]
[[Category:Modules]]

Navigation menu