Changes

Jump to navigation Jump to search
2,591 bytes added ,  08:28, 2 July 2022
m
Text replacement - "pragma-ade.com" to "pragma-ade.nl"
< [[Math]] [[Physics]] >
The units module comes with ConTeXt's default distribution.The following In MkIV the units module comes built-in, however there is copied from still the source file <tt>m-option to access the old module and its commands via {{cmd|usemodule}}[units.tex</tt> and only slightly modified:]
Additional documentation about units in MkIV is available from the [[http://www.pragma-ade.nl/general/manuals/units-mkiv.pdf Units manual]] ===Using the built--in command===
Scientific units In MkIV you can be typeset use the built-in math mode pretty well, but occasionally one has {{cmd|unit}} command to take care of spacing.Furthermore, entering these parse units is not that natural as wanted. Therefore Some examples of this module presents a more natural way of doing things, likeare shown below:
<texcode>
10 \unit{km/h}\unit{10 km/h}\unit{~1km/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.23 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}\Cubic unit{10 kilo gram}\Meter unit{10 kilogram}\Per unit{10 Kilo Gram}\Secondunit{10 KiloGram}
</texcode>
|
|<context mode=mkiv>
\startlines
\unit{10 kg}
\unit{10kg}
\unit{10 kilo gram}
\unit{10 kilogram}
\unit{10 Kilo Gram}
\unit{10 KiloGram}
\stoplines
</context>
|}
This example shows that we use the order The command works in which we say things, instead of typeset thingstext as well as in math mode and spaces are normally ignored. There is a separate [httpYou can define your own command://www.pragma-ade.com/general/manuals/ manual for this module].
--<texcode> link is dead, couldn't find the manual --\defineunits[un][User:Hraban|Hraban]alternative=text,separator=medium]</texcode>
This runtime loadable module implements a way of defining units. The core macro is Valid separators are <code>cdot</code>, <code>big</code>, <cmdcode>dimensionmedium</cmdcode>, a rather clever one that is able to cooperate and <code>space</code> with some other dimension related macrosthe first being the default. As said, this module enables user to enter:You can later tune the rendering with
<texcode>
some 10 \Square \Meter \Per \Second or moresetupunits[un][separator=cdot]
</texcode>
 
In due time there will be a few more options. Numbers are formatted cf the digits mechanism (not discussed here).
 
===Using the old units module===
 
The following is copied from the source file [[source:m-units.tex|m-units.tex]] and only slightly modified:
 
----
 
* Scientific units can be typeset in math mode pretty well, but occasionally one has to take care of spacing.
Furthermore, entering these units is not that natural as wanted. Therefore this module presents a more natural way of doing things, like:
 
<context source="yes">
\usemodule[units]
1.23 \Cubic \Meter \Per \Second
</context>
 
This example shows that we use the order in which we say things, instead of typeset things. There is no dedicated manual for this module, but an article (in dutch)
has been published in [[http://www.ntg.nl/maps/pdf/21_16.pdf Maps#21]], the journal of the NTG.
 
 
* This runtime loadable module implements a way of defining units. The core macro is {{cmd|dimension}}, a rather clever one that is able to cooperate with some other dimension related macros. As said, this module enables user to enter:
 
<context source="yes">
\usemodule[units]
Some 10 \Square \Meter \Per \Second\ or more.
</context>
 
(Note that the space after {{cmd|Second}} needs to be explicitly specified; otherwise, it will get eaten.)
 
 
* Units act upon signals that they insert in the text, in case no quantity is given you need to start the unit sequence using {{cmd|Unit}}
 
<context source="yes">
\usemodule[units]
Units of measurement is \Unit \Milli \Meter
</context>
The units itself are implemented as synonyms.
</texcode>
This definition means that we can ask for the meaning of a unit using <{{cmd>|unitmeaning</cmd> }} and get a list of used units by saying <{{cmd>|placelistofunits</cmd>}}.
We have to use the command <{{cmd>|unitmeaning</cmd> }} instead of <{{cmd>|meaning</cmd>}}, simply because the latter is a TeX primitive we don't want to looselose. We use the label text mechanism for translations.
----
===Macros defined in units===
External link: [[https://www.easyunitconverter.com/ Easy Unit Converter]] * ModifiersPrefixes: <{{cmd>Square</|Atto}} a, {{cmd>|Femto}} f, <{{cmd>Cubic</|Pico}} p, {{cmd>|Nano}} n, <{{cmd>Inverse</|Micro}} μ, {{cmd>|Milli}} m, <{{cmd>Pico</|Centi}} c, {{cmd>|Deci}} d, <{{cmd>Nano</|Hecto}} h, {{cmd>|Kilo}} k, <{{cmd>Micro</|Mega}} M, {{cmd>|Giga}} G, <{{cmd>Milli</|Tera}} T, {{cmd>|Peta}} P, <{{cmd>Centi</|Exa}} E (missing: {{cmd>|Zetta}} Z, <{{cmd>Deci</|Yotta}} Y, {{cmd>|Zepto}} z, {{cmd|Yocto}} y)* Suffixes: {{cmd|Linear}} <cmdsup>Hecto1</cmdsup>, {{cmd|Square}} <cmdsup>Kilo2</cmdsup>, {{cmd|Cubic}} <cmdsup>Mega3</cmdsup>, {{cmd|Inverse}} or {{cmd|ILinear}} <cmdsup>Giga-1</cmdsup>, {{cmd|ISquare}} <cmdsup>Tera-2</cmdsup>, {{cmd|ICubic}} <cmdsup>-3</cmdsup>* Fraction: <{{cmd>|Per</cmd>}}, <{{cmd>|Percent</cmd>}}, <{{cmd>|Permille</cmd>}}, <{{cmd>|Promille</cmd>}}* Time: <{{cmd>|Second</cmd>}}, <{{cmd>|Minute</cmd>}}, <{{cmd>|Hour</cmd>}}, <{{cmd>|Day</cmd>}}, <{{cmd>|Month</cmd>}}, <{{cmd>|Year</cmd>}}* Length, Area, Volume: <{{cmd>|Meter</cmd>}}, <{{cmd>|Angstrom</cmd>}}, <{{cmd>|Foot</cmd>}}, <{{cmd>|Inch</cmd>}}, <{{cmd>|Liter</cmd>}}* Mass, Force and Pressure: <{{cmd>|Gram</cmd>}}, <{{cmd>|Atom</cmd>}}, <{{cmd>|Newton</cmd>}}, <{{cmd>|Pascal</cmd>}}, <{{cmd>|Mol</cmd>, }}, <cmd>at</{{cmd>|At}}, <{{cmd>|Atm</cmd>}}, <{{cmd>|Bar</cmd>}}, <{{cmd>|Force</cmd>}}* Energy , Electricity and ElectricityMagnetism: <{{cmd>|Joule</cmd>}}, <{{cmd>|Watt</cmd>}}, <{{cmd>|Cal</cmd>}}, <{{cmd>|Farad</}}, {{cmd>|Henry}}, <{{cmd>|Ohm</cmd>}}, <{{cmd>|Siemens</cmd>}}, <{{cmd>|Ampere</cmd>}}, <{{cmd>|Coulomb</cmd>}}, <{{cmd>|Volt</cmd>}}, <{{cmd>|Tesla</}}, {{cmd>|Gauss}}, <{{cmd>|VoltAC</cmd>}}, <{{cmd>|VoltDC</cmd>}}, <{{cmd>|EVolt</}}, {{cmd>|Weber}}* Temperature: <{{cmd>|Degrees</cmd>}}, <{{cmd>|Kelvin</cmd>}}, <{{cmd>|Celsius</cmd>}}, <{{cmd>|Fahrenheit</cmd>}}* Angle: <{{cmd>|Rad</cmd>}}, <{{cmd>|Deg</}}, {{cmd>|Sterant}}* 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>|Gray}}* Informatics: <{{cmd>|Baud</cmd>}}, <{{cmd>|Bit</cmd>}}, <{{cmd>|Byte</cmd>* Other (please sort in): <cmd>Gray</cmd>, <cmd>Weber</cmd>, <cmd>Henry</cmd>, <cmd>Sterant</cmd>, <cmd>Gauss</cmd>}}
* some old dutch (not listed)
 
===Define a new unit===
 
<context source="yes">
\usemodule[units]
\unit[Mynewunit]{Nu}{New Unit}
 
10 \Mynewunit
 
</context>
 
[[Category:Sciences]]
[[Category:Modules]]

Navigation menu