m-units.mkiv /size: 26 Kb    last modification: 2021-10-28 13:51
1
%D \module
2
%D [ file=m-units,
3
%D version=1997.03.19,
4
%D title=\CONTEXT\ Extra Modules,
5
%D subtitle=Scientific Units,
6
%D author={Hans Hagen \& Ton Otten},
7
%D date=\currentdate,
8
%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
9
%C
10
%C This module is part of the \CONTEXT\ macro||package and is
11
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
12
%C details.
13 14
\ifcase
\contextlmtxmode
\else
\endinput
\fi
15 16
%D Best use the built in unit handle!
17 18
%D Scientific units can be typeset in math mode pretty well,
19
%D but occasionally one has to take care of spacing.
20
%D Furthermore, entering these units is not that natural as
21
%D wanted. Therefore this module presents a more natural way of
22
%D doing things, like:
23
%D
24
%D \starttyping
25
%D 1.23 \Cubic \Meter \Per \Second
26
%D \stoptyping
27
%D
28
%D This example shows that we use the order in which we say
29
%D things, instead of typeset things. There is a separate
30
%D manual for this module.
31 32
%D Message number~1 deals with overruling the \type {\Degrees}
33
%D macro defined in the core modules. Let's say that this is
34
%D an upward compatibility issue.
35 36
\startmessages
dutch
library
:
units
37
title
:
eenheden
38
1
:
gebruik
\string
\Degrees
\space
\string
\Celsius
\space
in
plaats
van
\string
\Celsius
!
39
\stopmessages
40 41
\startmessages
english
library
:
units
42
title
:
units
43
1
:
use
\string
\Degrees
\space
\string
\Celsius
\space
instead
of
\string
\Celsius
!
44
\stopmessages
45 46
\startmessages
german
library
:
units
47
title
:
Einheiten
48
1
:
Verwende
\string
\Degrees
\space
\string
\Celsius
\space
statt
\string
\Celsius
!
49
\stopmessages
50 51
\startmessages
italian
library
:
units
52
title
:
unita
53
1
:
usare
\string
\Degrees
\space
\string
\Celsius
\space
invece
di
\string
\Celsius
!
54
\stopmessages
55 56
\startmessages
norwegian
library
:
units
57
title
:
enheter
58
1
:
bruk
\string
\Degrees
\space
\string
\Celsius
\space
istedenfor
\string
\Celsius
!
59
\stopmessages
60 61
\startmessages
romanian
library
:
units
62
title
:
unitati
63
1
:
folositi
\string
\Degrees
\space
\string
\Celsius
\space
in
locul
\string
\Celsius
!
64
\stopmessages
65 66
\startmessages
french
library
:
units
67
title
:
unitas
68
1
:
utilisez
\string
\Degrees
\space
\string
\Celsius
\space
A
la
place
de
\string
\Celsius
!
69
\stopmessages
70 71
\registerctxluafile
{
x
-
mathml
}
{
}
72 73
\unprotect
74 75
\writestatus
{
\m!units
}
{
The
units
module
is
obsolete
because
functionality
is
built
into
the
core
.
}
76 77
\let
\unit
\undefined
78 79
\definesynonyms
80
[
\v!unit
]
81
[
\v!units
]
82
[
\unitmeaning
]
83 84
\setupsynonyms
85
[
\v!unit
]
86
[
\c!synonymcommand
=
\dimension
]
87 88
\startmodule
[
units
]
89 90
%D This runtime loadable module implements a way of defining
91
%D units. The core macro is \type {\dimension}, a rather clever
92
%D one that is able to cooperate with some other dimension
93
%D related macros. As said, this module enables user to enter:
94
%D
95
%D \starttyping
96
%D some 10 \Square \Meter \Per \Second or more
97
%D \stoptyping
98
%D
99
%D The units itself are implemented as synonyms.
100
%D
101
%D \starttyping
102
%D \definesynonyms [unit] [units] [\unitmeaning]
103
%D \setupsynonyms [unit] [textstyle=\dimension]
104
%D \stoptyping
105
%D
106
%D This definition means that we can ask for the meaning of a
107
%D unit using \type {\unitmeaning} and get a list of used
108
%D units by saying \type {\placelistofunits}
109
%D
110
%D We have to use the command \type {\unitmeaning} instead
111
%D of \type {\meaning}, simply because the latter is a \TEX\
112
%D primitive we don't want to loose. We use the label text
113
%D mechanism for translations.
114 115
%D \macros
116
%D {dimension}
117
%D
118
%D The core of this module is the low level macro \type
119
%D {\dimension}. Before presenting this macro, it's best to
120
%D look at some applications, because it's supposed to show
121
%D some intelligence that can beter be understood from the
122
%D context.
123
%D
124
%D The next useless examples show some of the cases we want
125
%D to handle in a proper way.
126
%D
127
%D \starttyping
128
%D ... 10 \Square \Meter \Per \Volt \
129
%D ... 10 \Square \Meter \Volt \
130
%D ... 10 \Meter \Volt \
131
%D ... 10 \Milli \Square \Meter \Per \Volt \
132
%D ... 10 \Square \Milli \Meter \Per \Volt \
133
%D ... 10 \Meter \Times \Meter \
134
%D ... 10 \Square \Meter \Times \Meter \
135
%D ... 10 \Square \Milli \Meter \Times \Meter \
136
%D \stoptyping
137 138
%D \macros
139
%D {mathematicstypeface, dimensiontypeface,
140
%D dimensionhalfspace, dimensionbackspace}
141
%D
142
%D There are some low level constants, that can be changed
143
%D when needed. Some day I will write a decent setup command.
144 145
\def
\mathematicstypeface
{
\rm
}
146
\def
\dimensiontypeface
{
\tf
}
147 148
\def
\dimensionhalfspace
{
\ifmmode
\,
\else
\hskip
+
.
1
em
\relax
\fi
}
149
\def
\dimensionbackspace
{
\ifmmode
\!
\else
\hskip
-
.
1
em
\relax
\fi
}
150 151
%D \macros
152
%D {smashdimensionpower}
153
%D
154
%D Sometimes the baseline distance is not enough to provide
155
%D for superscripts, so we smash their height by default.
156 157
\newif
\ifsmashdimensionpower
\smashdimensionpowertrue
158 159
%D The dimension mechanism uses a lot of signals to keep
160
%D track if the current state.
161 162
\newsignal
\dimensionsignal
163
\newsignal
\dimensionpowersignal
164
\newsignal
\dimensionmidfixsignal
165
\newsignal
\dimensionaddfixsignal
166 167
\let
\thedimensionprefix
=
\empty
168
\let
\thedimensionpower
=
\empty
169 170
%D \macros
171
%D {spaceddimensions,textdimensions}
172
%D
173
%D The actual definition of \type {\dimension} overruled the
174
%D one in the core modules. The boolean can be used to
175
%D force spacing between units. The rather ugly test prevents
176
%D problems with nested dimensions.
177 178
\newif
\ifspaceddimensions
\spaceddimensionsfalse
% user switch
179
\newif
\iftextdimensions
\textdimensionsfalse
% user switch
180 181
%D You can see the consequence of forcing text dimensions
182
%D when you compare the following code:
183
%D
184
%D \starttyping
185
%D {\rm test \Square \Meter \Per \Second\ ziezo\Degrees} \par
186
%D {\ss test \Square \Meter \Per \Second\ ziezo} \par
187
%D {\tt test \Square \Meter \Per \Second\ ziezo}
188
%D
189
%D \textdimensionstrue
190
%D
191
%D {\rm test \Square \Meter \Per \Second\ ziezo} \par
192
%D {\ss test \Square \Meter \Per \Second\ ziezo} \par
193
%D {\tt test \Square \Meter \Per \Second\ ziezo}
194
%D \stoptyping
195 196
\newif
\ifnesteddimension
\nesteddimensionfalse
% local switch
197 198
\def
\dodimensionpower
#
1
%
199
{
\iftextdimensions
\expandafter
\high
\else
\expandafter
\normalsuperscript
\fi
{
#
1
}
}
200 201
\def
\ustartmathmode
{
\iftextdimensions
\else
\expandafter
\startmathmode
\fi
}
202
\def
\ustopmathmode
{
\iftextdimensions
\else
\expandafter
\stopmathmode
\fi
}
203
\def
\umathematicstypeface
{
\iftextdimensions
\else
\expandafter
\mathematicstypeface
\fi
}
204 205
%D In forced text mode, we ignore spacing in monospaced fonts.
206 207
\def
\udimensionhalfspace
{
\dodimensionspace
\dimensionhalfspace
}
208
\def
\udimensionbackspace
{
\dodimensionspace
\dimensionbackspace
}
209 210
\def
\dodimensionspace
211
{
\iftextdimensions
212
\begingroup
213
\setbox
0
\hbox
{
i
}
%
214
\setbox
2
\hbox
{
m
}
%
215
\ifdim
\wd
0
=
\wd
2
216
\endgroup
217
\doubleexpandafter
\gobbleoneargument
218
\else
219
\endgroup
220
\fi
221
\fi
}
222 223
\unexpanded
\def
\dimension
#
1
%
224
{
\begingroup
225
\glet
\savedthedimensionprefix
\thedimensionprefix
226
\glet
\savedthedimensionpower
\thedimensionpower
227
\unexpanded
\def
\dimension
#
#
1
{
\global
\nesteddimensiontrue
}
%
228
\let
\dimensionprefix
\dimension
229
\let
\dimensionmidfix
\dimension
230
\let
\dimensionsuffix
\dimension
231
\let
\dimensionpower
\dimension
232
\global
\nesteddimensionfalse
233
\setbox
\scratchbox
\hbox
{
\ustartmathmode
#
1
\ustopmathmode
}
% pre-roll
234
\glet
\thedimensionprefix
\savedthedimensionprefix
235
\glet
\thedimensionpower
\savedthedimensionpower
236
\endgroup
237
\ifnesteddimension
#
1
\else
\dodimension
{
#
1
}
\fi
}
238 239
\def
\dodimension
#
1
%
240
{
\dontbreakdimension
241
\ifdim
\scratchdimen
=
\zeropoint
\relax
242
\ifmmode
243
\udimensionhalfspace
244
\udimensionhalfspace
245
\fi
246
\ustartmathmode
\dimensiontypeface
247
\else
248
\ustartmathmode
\dimensiontypeface
249
\ifspaceddimensions
250
\ifdim
\scratchdimen
=
\dimensionsignal
\relax
251
\udimensionhalfspace
252
\else
\ifdim
\scratchdimen
=
\dimensionpowersignal
\relax
253
\udimensionhalfspace
254
\fi
255
\fi
256
\fi
257
\fi
258
\umathematicstypeface
\thedimensionprefix
#
1
%
259
\ifx
\thedimensionpower
\empty
260
\else
\ifsmashdimensionpower
261
\setbox
\scratchbox
=
\hbox
262
{
\iftextdimensions
263
\tx
\thedimensionpower
264
\else
265
\normalstartimath
266
\scriptstyle
\thedimensionpower
267
\normalstopimath
268
\fi
}
%
269
\ht
\scratchbox
=
\zeropoint
270
\dodimensionpower
{
\box
\scratchbox
}
%
271
\else
272
\dodimensionpower
{
\thedimensionpower
}
%
273
\fi
\fi
274
\ustopmathmode
275
% otherwise nobreak before space in 2 \Milli \Meter\ blabla
276
\doifnotmode
{
atpragma
}
{
\nobreak
}
% this was always \nobreak
277
% only test this at pragma
278
\ifx
\thedimensionpower
\empty
279
\hskip
\dimensionsignal
280
\else
281
\hskip
\dimensionpowersignal
282
\fi
283
\glet
\thedimensionprefix
\empty
284
\glet
\thedimensionpower
\empty
}
285 286
%D \macros
287
%D {dontbreakdimension,
288
%D dimensionprefix, dimensionaddfix,
289
%D dimensionnopfix, dimensionmidfix,
290
%D dimensionpower}
291
%D
292
%D Here are some auxilliary macros.
293 294
\def
\dontbreakdimension
295
{
\scratchdimen
\lastskip
296
\unskip
297
\nobreak
298
\hskip
\scratchdimen
299
\nobreak
}
300 301
\def
\dimensionprefix
#
1
%
302
{
\gdef
\thedimensionprefix
{
#
1
}
}
303 304
\def
\dimensionaddfix
#
1
%
305
{
\unskip
306
%\mathematics{\umathematicstypeface#1}%
307
\ustartmathmode
\umathematicstypeface
#
1
\ustopmathmode
308
\nobreak
309
\hskip
\dimensionaddfixsignal
}
310 311
\def
\dimensionnopfix
#
1
%
312
{
\dontbreakdimension
313
\ifdim
\scratchdimen
=
\dimensionpowersignal
\relax
314
\ustartmathmode
315
\else
316
\ustartmathmode
317
\udimensionhalfspace
318
\nobreak
319
\fi
320
\umathematicstypeface
#
1
%
321
\ustopmathmode
322
\nobreak
323
\hskip
\dimensionsignal
}
324 325
\def
\dimensionmidfix
#
1
%
326
{
\dontbreakdimension
327
\ifdim
\scratchdimen
=
\dimensionpowersignal
\relax
328
\ustartmathmode
329
\udimensionbackspace
330
\nobreak
331
\else
332
\ustartmathmode
333
\fi
334
\umathematicstypeface
#
1
%
335
\ustopmathmode
336
\nobreak
337
\hskip
\dimensionmidfixsignal
}
338 339
\def
\dimensionpower
#
1
%
340
{
\gdef
\thedimensionpower
{
#
1
}
}
341 342
%D \macros
343
%D {SIunits, noSI, doSI}
344
%D
345
%D Some low level unit switching macros:
346 347
\newif
\ifSIunits
\SIunitstrue
348 349
\def
\noSI
#
1
{
\begingroup
\SIunitsfalse
#
1
\endgroup
}
350
\def
\doSI
#
1
{
\begingroup
\SIunitstrue
#
1
\endgroup
}
351 352
%D \macros
353
%D {Degrees}
354
%D
355
%D We can fake the degrees symbol with:
356 357
\def
\Degrees
{
\dimensionaddfix
{
\mathematics
{
\normalsuperscript
\circ
}
}
}
358 359
%D \macros
360
%D {Unit, NoUnit}
361
%D
362
%D When a dimension has no leading number, we can use \type
363
%D {\Unit}, and when no unit is appended, \type {\NoUnit} is
364
%D to be used, just to prevent the prefix migrating to the
365
%D next occasion.
366 367
\def
\Unit
{
\hskip
\dimensionsignal
}
368
\def
\NoUnit
{
\dimension
{
}
}
369 370
%D The mechanism described at the top of this module, depends
371
%D on several dimensional components, like prefixes:
372 373
\def
\Atto
{
\dimensionprefix
{
a
}
}
374
\def
\Femto
{
\dimensionprefix
{
f
}
}
375
\def
\Pico
{
\dimensionprefix
{
p
}
}
376
\def
\Nano
{
\dimensionprefix
{
n
}
}
377
\def
\Micro
{
\dimensionprefix
{
\iftextdimensions
u
\else
\mu
\fi
}
}
378
\def
\Milli
{
\dimensionprefix
{
m
}
}
379
\def
\Centi
{
\dimensionprefix
{
c
}
}
380
\def
\Deci
{
\dimensionprefix
{
d
}
}
% 10^{01}
381
\def
\Hecto
{
\dimensionprefix
{
h
}
}
% 10^{02}
382
\def
\Kilo
{
\dimensionprefix
{
k
}
}
% 10^{03}
383
\def
\Mega
{
\dimensionprefix
{
M
}
}
% 10^{06}
384
\def
\Giga
{
\dimensionprefix
{
G
}
}
% 10^{09}
385
\def
\Tera
{
\dimensionprefix
{
T
}
}
% 10^{12}
386
\def
\Peta
{
\dimensionprefix
{
P
}
}
% 10^{15}
387
\def
\Exa
{
\dimensionprefix
{
E
}
}
% 10^{18}
388 389
%def\Terra {\dimensionprefix{T}} % for old times sake
390 391
\def
\Kibi
{
\dimensionprefix
{
ki
}
}
% 2^{10}
392
\def
\Mebi
{
\dimensionprefix
{
Mi
}
}
% 2^{20}
393
\def
\Gibi
{
\dimensionprefix
{
Gi
}
}
% 2^{30}
394
\def
\Tebi
{
\dimensionprefix
{
Ti
}
}
% 2^{40}
395
\def
\Pebi
{
\dimensionprefix
{
Pi
}
}
% 2^{50}
396 397
%D and binary prefixes:
398 399
\def
\Kibi
{
\dimensionprefix
{
Ki
}
}
400
\def
\Mebi
{
\dimensionprefix
{
Mi
}
}
401
\def
\Gibi
{
\dimensionprefix
{
Gi
}
}
402
\def
\Tebi
{
\dimensionprefix
{
Ti
}
}
403
\def
\Pebi
{
\dimensionprefix
{
Pi
}
}
404
\def
\Exbi
{
\dimensionprefix
{
Ei
}
}
405
\def
\Zebi
{
\dimensionprefix
{
Zi
}
}
406
\def
\Yobi
{
\dimensionprefix
{
Yi
}
}
407 408
%D and operators:
409 410
\def
\Times
{
\dimensionnopfix
{
\iftextdimensions
.
\else
\cdot
\fi
}
}
411
\def
\Solidus
{
\dimensionmidfix
{
/
}
}
412
\def
\Per
{
\dimensionmidfix
{
/
}
}
413
\def
\OutOf
{
\dimensionnopfix
{
:
}
}
414 415
%D and suffixes:
416 417
\def
\Linear
{
\dimensionpower
{
1
}
}
418
\def
\Square
{
\dimensionpower
{
2
}
}
419
\def
\Cubic
{
\dimensionpower
{
3
}
}
420 421
\def
\Inverse
{
\dimensionpower
{
-
1
}
}
422
\def
\ILinear
{
\dimensionpower
{
-
1
}
}
423
\def
\ISquare
{
\dimensionpower
{
-
2
}
}
424
\def
\ICubic
{
\dimensionpower
{
-
3
}
}
425 426
%D Apart from these components, the units themselves are
427
%D defined using the synonym mechanism. First we define some
428
%D length and volume related units.
429 430
\getvalue
{
\v!unit
}
[
Meter
]
{
m
}
{
meter
}
431
\getvalue
{
\v!unit
}
[
pMeter
]
{
\Pico
\Meter
}
{
picometer
}
432
\getvalue
{
\v!unit
}
[
nMeter
]
{
\Nano
\Meter
}
{
nanometer
}
433
\getvalue
{
\v!unit
}
[
uMeter
]
{
\Micro
\Meter
}
{
micrometer
}
434
\getvalue
{
\v!unit
}
[
mMeter
]
{
\Milli
\Meter
}
{
millimeter
}
435
\getvalue
{
\v!unit
}
[
cMeter
]
{
\Centi
\Meter
}
{
centimeter
}
436
\getvalue
{
\v!unit
}
[
dMeter
]
{
\Deci
\Meter
}
{
decimeter
}
437
\getvalue
{
\v!unit
}
[
hMeter
]
{
\Hecto
\Meter
}
{
hectometer
}
438
\getvalue
{
\v!unit
}
[
kMeter
]
{
\Kilo
\Meter
}
{
kilometer
}
439 440
%D After some discussion on the \CONTEXT\ mailing list in
441
%D february 2002 it was decided to go from L to l for liters
442
%D (Karel Wesselings alternative: \mathematics{\ell}).
443 444
\getvalue
{
\v!unit
}
[
Liter
]
{
l
}
{
liter
}
445
\getvalue
{
\v!unit
}
[
mLiter
]
{
\Milli
\Liter
}
{
milliliter
}
446
\getvalue
{
\v!unit
}
[
cLiter
]
{
\Centi
\Liter
}
{
centiliter
}
447
\getvalue
{
\v!unit
}
[
dLiter
]
{
\Deci
\Liter
}
{
deciliter
}
448 449
%D Next we define time related units (\type {\ifSI} still dutch only).
450 451
\getvalue
{
\v!unit
}
[
Sec
]
{
s
}
{
\labeltext
{
u
:
sec
}
}
452
\getvalue
{
\v!unit
}
[
fSec
]
{
\Femto
\Sec
}
{
\labeltext
{
u
:
fsec
}
}
453
\getvalue
{
\v!unit
}
[
pSec
]
{
\Pico
\Sec
}
{
\labeltext
{
u
:
psec
}
}
454
\getvalue
{
\v!unit
}
[
nSec
]
{
\Nano
\Sec
}
{
\labeltext
{
u
:
nsec
}
}
455
\getvalue
{
\v!unit
}
[
uSec
]
{
\Micro
\Sec
}
{
\labeltext
{
u
:
usec
}
}
456
\getvalue
{
\v!unit
}
[
mSec
]
{
\Milli
\Sec
}
{
\labeltext
{
u
:
msec
}
}
457
\getvalue
{
\v!unit
}
[
Year
]
{
\ifSIunits
a
\else
j
\fi
}
{
\labeltext
{
u
:
year
}
}
458
\getvalue
{
\v!unit
}
[
Month
]
{
m
}
{
\labeltext
{
u
:
month
}
}
459
\getvalue
{
\v!unit
}
[
Week
]
{
w
}
{
\labeltext
{
u
:
week
}
}
460
\getvalue
{
\v!unit
}
[
Day
]
{
d
}
{
\labeltext
{
u
:
day
}
}
461
\getvalue
{
\v!unit
}
[
Hour
]
{
\ifSIunits
h
\else
u
\fi
}
{
\labeltext
{
u
:
hour
}
}
462
\getvalue
{
\v!unit
}
[
Min
]
{
min
}
{
\labeltext
{
u
:
min
}
}
463 464
\setuplabeltext
465
[
\s!nl
]
466
[
u
:
sec
=
seconde
,
467
u
:
psec
=
picoseconde
,
468
u
:
fsec
=
femtoseconde
,
469
u
:
nsec
=
nanoseconde
,
470
u
:
usec
=
microseconde
,
471
u
:
msec
=
milliseconde
,
472
u
:
year
=
jaar
,
473
u
:
month
=
maand
,
474
u
:
week
=
week
,
475
u
:
day
=
dag
,
476
u
:
hour
=
uur
,
477
u
:
min
=
minuten
]
478 479
\setuplabeltext
480
[
\s!en
]
481
[
u
:
sec
=
second
,
482
u
:
fsec
=
femtosecond
,
483
u
:
psec
=
picosecond
,
484
u
:
nsec
=
nanosecond
,
485
u
:
usec
=
microsecond
,
486
u
:
msec
=
millisecond
,
487
u
:
year
=
year
,
488
u
:
month
=
month
,
489
u
:
week
=
week
,
490
u
:
day
=
day
,
491
u
:
hour
=
hour
,
492
u
:
min
=
minutes
]
493 494
\setuplabeltext
495
[
\s!de
]
496
[
u
:
sec
=
Sekunde
,
497
u
:
fsec
=
Femtosekunde
,
498
u
:
psec
=
Picosekunde
,
499
u
:
nsec
=
Nanosekunde
,
500
u
:
usec
=
Microsekunde
,
501
u
:
msec
=
Millisekunde
,
502
u
:
year
=
Jahr
,
503
u
:
month
=
Monat
,
504
u
:
week
=
Woche
,
505
u
:
day
=
Tag
,
506
u
:
hour
=
Stunde
,
507
u
:
min
=
Minuten
]
508 509
\setuplabeltext
510
[
\s!hr
]
511
[
u
:
sec
=
sekunda
,
512
u
:
fsec
=
femtosekunda
,
513
u
:
psec
=
pikosekunda
,
514
u
:
nsec
=
nanosekunda
,
515
u
:
usec
=
mikrosekunda
,
516
u
:
msec
=
milisekunda
,
517
u
:
year
=
godina
,
518
u
:
month
=
mjesec
,
519
u
:
week
=
tjedan
,
520
u
:
day
=
dan
,
521
u
:
hour
=
sat
,
522
u
:
min
=
minuta
]
523 524
\setuplabeltext
525
[
\s!it
]
526
[
u
:
sec
=
secondo
,
527
u
:
fsec
=
femtosecondo
,
528
u
:
psec
=
picosecondo
,
529
u
:
nsec
=
nanosecondo
,
530
u
:
usec
=
microsecondo
,
531
u
:
msec
=
millisecondo
,
532
u
:
year
=
anno
,
533
u
:
month
=
mese
,
534
u
:
week
=
settimana
,
535
u
:
day
=
giorno
,
536
u
:
hour
=
ora
,
537
u
:
min
=
minuti
]
538 539
%D Then we define some angles.
540 541
\getvalue
{
\v!unit
}
[
Rad
]
{
rad
}
{
\labeltext
{
u
:
rad
}
}
542
\getvalue
{
\v!unit
}
[
Deg
]
{
{
\mathematics
{
\normalsuperscript
\circ
}
}
}
{
\labeltext
{
u
:
deg
}
}
543 544
\setuplabeltext
545
[
\s!nl
]
546
[
u
:
rad
=
hoek
radialen
,
547
u
:
deg
=
hoek
graden
]
548 549
\setuplabeltext
550
[
\s!en
]
551
[
u
:
rad
=
angle
radians
,
552
u
:
deg
=
angle
degrees
]
553 554
\setuplabeltext
555
[
\s!de
]
556
[
u
:
rad
=
Bogenma
\SS
,
557
u
:
deg
=
Gradma
\SS
]
558 559
\setuplabeltext
560
[
\s!hr
]
561
[
u
:
rad
=
radijani
,
562
u
:
deg
=
kutni
stupnjevi
]
563 564
\setuplabeltext
565
[
\s!it
]
566
[
u
:
rad
=
radianti
,
567
u
:
deg
=
angoli
sessagesimali
]
568 569
%D Rotation and frequency related units are defined by:
570 571
\getvalue
{
\v!unit
}
[
Hertz
]
{
Hz
}
{
Hertz
}
572
\getvalue
{
\v!unit
}
[
kHertz
]
{
\Kilo
\Hertz
}
{
kilo
Hertz
}
573
\getvalue
{
\v!unit
}
[
MHertz
]
{
\Mega
\Hertz
}
{
mega
Hertz
}
574
\getvalue
{
\v!unit
}
[
GHertz
]
{
\Giga
\Hertz
}
{
giga
Hertz
}
575
\getvalue
{
\v!unit
}
[
THertz
]
{
\Tera
\Hertz
}
{
tera
Hertz
}
576
\getvalue
{
\v!unit
}
[
mHertz
]
{
\Milli
\Hertz
}
{
milli
Hertz
}
577 578
\getvalue
{
\v!unit
}
[
RevPerSec
]
{
RPS
}
{
\labeltext
{
u
:
rps
}
}
579
\getvalue
{
\v!unit
}
[
RevPerMin
]
{
RPM
}
{
\labeltext
{
u
:
rpm
}
}
580 581
\setuplabeltext
582
[
\s!nl
]
583
[
u
:
rps
=
omwentelingen
per
seconde
,
584
u
:
rpm
=
omwentelingen
per
minuut
]
585 586
\setuplabeltext
587
[
\s!en
]
588
[
u
:
rps
=
revolutions
per
second
,
589
u
:
rpm
=
revolutions
per
minute
]
590 591
\setuplabeltext
592
[
\s!de
]
593
[
u
:
rps
=
Umdrehungen
pro
Sekunde
,
594
u
:
rpm
=
Umdrehungen
pro
Minute
]
595 596
\setuplabeltext
597
[
\s!hr
]
598
[
u
:
rps
=
okretaji
po
sekundi
,
599
u
:
rpm
=
okretaji
po
minuti
]
600 601
\setuplabeltext
602
[
\s!it
]
603
[
u
:
rps
=
giri
al
secondo
,
604
u
:
rpm
=
giri
al
minuto
]
605 606
%D Mass and force:
607 608
\getvalue
{
\v!unit
}
[
Gram
]
{
g
}
{
gram
}
609
\getvalue
{
\v!unit
}
[
uGram
]
{
\Micro
\Gram
}
{
microgram
}
610
\getvalue
{
\v!unit
}
[
mGram
]
{
\Milli
\Gram
}
{
milligram
}
611
\getvalue
{
\v!unit
}
[
kGram
]
{
\Kilo
\Gram
}
{
kilogram
}
612
\getvalue
{
\v!unit
}
[
Atom
]
{
u
}
{
\labeltext
{
u
:
u
}
}
613 614
\getvalue
{
\v!unit
}
[
Newton
]
{
N
}
{
Newton
}
615
\getvalue
{
\v!unit
}
[
kNewton
]
{
\Kilo
\Newton
}
{
kilo
Newton
}
616 617
\getvalue
{
\v!unit
}
[
Pascal
]
{
Pa
}
{
Pascal
}
618
\getvalue
{
\v!unit
}
[
mPascal
]
{
\Milli
\Pascal
}
{
milli
Pascal
}
619
\getvalue
{
\v!unit
}
[
kPascal
]
{
\Kilo
\Pascal
}
{
kilo
Pascal
}
620 621
\setuplabeltext
622
[
\s!nl
]
623
[
u
:
u
=
atomaire
massa
eenheid
]
624 625
\setuplabeltext
626
[
\s!en
]
627
[
u
:
u
=
atom
mass
unit
]
628 629
\setuplabeltext
630
[
\s!de
]
631
[
u
:
u
=
Atomare
Masseneinheit
]
632 633
\setuplabeltext
634
[
\s!hr
]
635
[
u
:
u
=
unificirana
atomska
jedinica
mase
]
636 637
\setuplabeltext
638
[
\s!it
]
639
[
u
:
u
=
unit
\`
a
di
massa
atomica
]
640 641
%D Energy units comes in two alternatives:
642 643
\getvalue
{
\v!unit
}
[
Joule
]
{
J
}
{
Joule
}
644
\getvalue
{
\v!unit
}
[
mJoule
]
{
\Milli
\Joule
}
{
milli
Joule
}
645
\getvalue
{
\v!unit
}
[
kJoule
]
{
\Kilo
\Joule
}
{
kilo
Joule
}
646
\getvalue
{
\v!unit
}
[
MJoule
]
{
\Mega
\Joule
}
{
mega
Joule
}
647
\getvalue
{
\v!unit
}
[
GJoule
]
{
\Giga
\Joule
}
{
giga
Joule
}
648 649
\getvalue
{
\v!unit
}
[
Watt
]
{
W
}
{
Watt
}
650
\getvalue
{
\v!unit
}
[
mWatt
]
{
\Milli
\Watt
}
{
milli
Watt
}
651
\getvalue
{
\v!unit
}
[
kWatt
]
{
\Kilo
\Watt
}
{
kilo
Watt
}
652
\getvalue
{
\v!unit
}
[
MWatt
]
{
\Mega
\Watt
}
{
mega
Watt
}
653
\getvalue
{
\v!unit
}
[
GWatt
]
{
\Giga
\Watt
}
{
giga
Watt
}
654
\getvalue
{
\v!unit
}
[
TWatt
]
{
\Tera
\Watt
}
{
tera
Watt
}
655 656
%D Although Celsius is no longer permitted, we define it by
657
%D saying:
658 659
\getvalue
{
\v!unit
}
[
Celsius
]
{
C
}
{
Celsius
}
660
\getvalue
{
\v!unit
}
[
Kelvin
]
{
K
}
{
Kelvin
}
661
\getvalue
{
\v!unit
}
[
Fahrenheit
]
{
F
}
{
Fahrenheit
}
662 663
%D Some chemic related units are:
664 665
\getvalue
{
\v!unit
}
[
Mol
]
{
mol
}
{
mol
}
666
\getvalue
{
\v!unit
}
[
mMol
]
{
\Milli
\Mol
}
{
millimol
}
667
\getvalue
{
\v!unit
}
[
kMol
]
{
\Kilo
\Mol
}
{
kilomol
}
668
\getvalue
{
\v!unit
}
[
Molair
]
{
M
}
{
molair
(
\Mol
\Per
\Liter
)
}
669
\getvalue
{
\v!unit
}
[
Equivalent
]
{
eq
}
{
equivalent
}
670
\getvalue
{
\v!unit
}
[
mEquivalent
]
{
\Milli
\Equivalent
}
{
milli
equivalent
}
671 672
%D There are quite a lot units related to electricity and
673
%D magnetism:
674 675
\getvalue
{
\v!unit
}
[
Farad
]
{
F
}
{
Farad
}
676
\getvalue
{
\v!unit
}
[
pFarad
]
{
\Pico
\Farad
}
{
pico
Farad
}
677
\getvalue
{
\v!unit
}
[
nFarad
]
{
\Nano
\Farad
}
{
nano
Farad
}
678
\getvalue
{
\v!unit
}
[
uFarad
]
{
\Micro
\Farad
}
{
micro
Farad
}
679
\getvalue
{
\v!unit
}
[
mFarad
]
{
\Milli
\Farad
}
{
milli
Farad
}
680 681
\getvalue
{
\v!unit
}
[
Ohm
]
{
\Omega
}
{
Ohm
}
682
\getvalue
{
\v!unit
}
[
kOhm
]
{
\Kilo
\Ohm
}
{
kilo
Ohm
}
683 684
\getvalue
{
\v!unit
}
[
Siemens
]
{
S
}
{
Siemens
}
685 686
\getvalue
{
\v!unit
}
[
Ampere
]
{
A
}
{
Amp
\`
ere
}
687
\getvalue
{
\v!unit
}
[
mAmpere
]
{
\Milli
\Ampere
}
{
milli
Amp
\`
ere
}
688 689
\getvalue
{
\v!unit
}
[
Coulomb
]
{
C
}
{
Coulomb
}
690 691
\getvalue
{
\v!unit
}
[
Volt
]
{
V
}
{
Volt
}
692
\getvalue
{
\v!unit
}
[
mVolt
]
{
\Milli
\Volt
}
{
milli
Volt
}
693
\getvalue
{
\v!unit
}
[
kVolt
]
{
\Kilo
\Volt
}
{
kilo
Volt
}
694
\getvalue
{
\v!unit
}
[
eVolt
]
{
eV
}
{
electronvolt
}
695
\getvalue
{
\v!unit
}
[
keVolt
]
{
\Kilo
\eVolt
}
{
kilo
electronvolt
}
696
\getvalue
{
\v!unit
}
[
MeVolt
]
{
\Mega
\eVolt
}
{
mega
electronvolt
}
697 698
\getvalue
{
\v!unit
}
[
Tesla
]
{
T
}
{
Tesla
}
699 700
\getvalue
{
\v!unit
}
[
VoltAC
]
{
V
\normalsubscript
{
\xbox
{
ac
}
}
}
{
\labeltext
{
u
:
vac
}
}
701
\getvalue
{
\v!unit
}
[
VoltDC
]
{
V
\normalsubscript
{
\xbox
{
dc
}
}
}
{
\labeltext
{
u
:
vdc
}
}
702 703
\setuplabeltext
704
[
\s!nl
]
705
[
u
:
vac
=
wisselspanning
,
706
u
:
vdc
=
gelijkspanning
]
707 708
\setuplabeltext
709
[
\s!en
]
710
[
u
:
vac
=
alternating
current
,
711
u
:
vdc
=
direct
current
]
712 713
\setuplabeltext
714
[
\s!de
]
715
[
u
:
vac
=
Wechselspannung
,
716
u
:
vdc
=
Gleichspannung
]
717 718
\setuplabeltext
719
[
\s!hr
]
720
[
u
:
vac
=
izmjeni
\ccaron
ni
napon
,
721
u
:
vdc
=
istosmjerni
napon
]
722 723
\setuplabeltext
724
[
\s!it
]
725
[
u
:
vac
=
corrente
alternata
,
726
u
:
vdc
=
corrente
continua
]
727 728
%D Network bandwidth is specified in Bits:
729 730
\getvalue
{
\v!unit
}
[
Bit
]
{
bit
}
{
\labeltext
{
u
:
bit
}
}
731
\getvalue
{
\v!unit
}
[
Baud
]
{
Bd
}
{
Baud
(
Bit
/
s
)
}
732 733
%D Computer memory size is specified in Bytes:
734 735
\getvalue
{
\v!unit
}
[
Byte
]
{
B
}
{
\labeltext
{
u
:
byte
}
}
736
\getvalue
{
\v!unit
}
[
kByte
]
{
\Kilo
\Byte
}
{
kilo
Byte
}
737
\getvalue
{
\v!unit
}
[
MByte
]
{
\Mega
\Byte
}
{
mega
Byte
}
738
\getvalue
{
\v!unit
}
[
GByte
]
{
\Giga
\Byte
}
{
giga
Byte
}
739
\getvalue
{
\v!unit
}
[
TByte
]
{
\Tera
\Byte
}
{
tera
Byte
}
740 741
\setuplabeltext
742
[
\s!en
]
743
[
u
:
bit
=
Bit
,
744
u
:
byte
=
Byte
]
745 746
\setuplabeltext
747
[
\s!hr
]
748
[
u
:
bit
=
bit
,
749
u
:
byte
=
bajt
]
750 751
%D Telecommunication call density is specified in Erlangs:
752 753
\getvalue
{
\v!unit
}
[
Erlang
]
{
E
}
{
Erlang
}
754 755
%D Some radiation related units:
756 757
\getvalue
{
\v!unit
}
[
Bequerel
]
{
Bq
}
{
Bequerel
}
758
\getvalue
{
\v!unit
}
[
MBequerel
]
{
\Mega
\Bequerel
}
{
Bequerel
}
759
\getvalue
{
\v!unit
}
[
Sievert
]
{
Sv
}
{
Sievert
}
760
\getvalue
{
\v!unit
}
[
mSievert
]
{
\Milli
\Sievert
}
{
milli
Sievert
}
761 762
%D Light:
763 764
\getvalue
{
\v!unit
}
[
Candela
]
{
cd
}
{
Candela
}
765 766
%D and some sound ones:
767 768
\getvalue
{
\v!unit
}
[
Bell
]
{
B
}
{
Bell
}
769
\getvalue
{
\v!unit
}
[
dBell
]
{
\Deci
\Bell
}
{
decibel
}
770 771
%D We also define some non||regular, sometimes even forbidden,
772
%D units:
773 774
\getvalue
{
\v!unit
}
[
At
]
{
at
}
{
\labeltext
{
u
:
at
}
}
775
\getvalue
{
\v!unit
}
[
Atm
]
{
atm
}
{
\labeltext
{
u
:
atm
}
}
776
\getvalue
{
\v!unit
}
[
Bar
]
{
bar
}
{
bar
(
1
0
0
\Kilo
\Pascal
)
}
777
\getvalue
{
\v!unit
}
[
EVolt
]
{
eV
}
{
electronvolt
}
778
\getvalue
{
\v!unit
}
[
Foot
]
{
ft
}
{
\labeltext
{
u
:
ft
}
}
779
\getvalue
{
\v!unit
}
[
Inch
]
{
inch
}
{
\labeltext
{
u
:
inch
}
}
780
\getvalue
{
\v!unit
}
[
Cal
]
{
cal
}
{
\labeltext
{
u
:
cal
}
}
781
\getvalue
{
\v!unit
}
[
Force
]
{
f
}
{
\labeltext
{
u
:
f
}
}
782
\getvalue
{
\v!unit
}
[
kCal
]
{
\Kilo
\Cal
}
{
\labeltext
{
u
:
kcal
}
}
783
\getvalue
{
\v!unit
}
[
Lux
]
{
lux
}
{
lux
}
784 785 786
\def
\xPercent
{
\dimensionaddfix
{
\percent
}
}
787
\def
\xPromille
{
\dimensionaddfix
{
\promille
}
}
788 789
\getvalue
{
\v!unit
}
[
Percent
]
{
\xPercent
}
{
percent
}
790
\getvalue
{
\v!unit
}
[
Permille
]
{
\xPromille
}
{
promille
}
791
\getvalue
{
\v!unit
}
[
Promille
]
{
\xPromille
}
{
promille
}
792 793
%D Some more, thanks to Tobias:
794 795
\getvalue
{
\v!unit
}
[
Gray
]
{
Gr
}
{
Gray
}
796
\getvalue
{
\v!unit
}
[
Weber
]
{
Wb
}
{
Weber
}
797
\getvalue
{
\v!unit
}
[
Henry
]
{
H
}
{
Henry
}
798
\getvalue
{
\v!unit
}
[
Sterant
]
{
sr
}
{
Sterant
}
799
\getvalue
{
\v!unit
}
[
Angstrom
]
{
\hbox
{
\Aring
}
}
{
\Aring
ngstr
\"
om
}
800
\getvalue
{
\v!unit
}
[
Gauss
]
{
G
}
{
Gauss
}
801 802
\setuplabeltext
803
[
\s!nl
]
804
[
u
:
at
=
technische
atmosfeer
,
805
u
:
atm
=
fysische
atmosfeer
,
806
u
:
ft
=
voet
,
807
u
:
cal
=
calorie
,
808
u
:
f
=
kracht
(
force
)
,
809
u
:
kcal
=
kilocalorie
]
810 811
\setuplabeltext
812
[
\s!en
]
813
[
u
:
at
=
technical
atmospheric
pressure
,
814
u
:
atm
=
physical
atmospheric
pressure
,
815
u
:
ft
=
foot
,
816
u
:
inch
=
inch
,
817
u
:
cal
=
calory
,
818
u
:
f
=
force
,
819
u
:
kcal
=
kilocalory
]
820 821
\setuplabeltext
822
[
\s!de
]
823
[
u
:
at
=
Technischer
atmosph
\"
arischer
Druck
,
824
u
:
atm
=
physkalischer
atmosph
\"
arischer
Druck
,
825
u
:
ft
=
Fu
\SS
,
826
u
:
cal
=
Kalorien
,
827
u
:
f
=
Force
,
828
u
:
kcal
=
Kilokalorien
]
829 830
\setuplabeltext
831
[
\s!hr
]
832
[
u
:
at
=
tehni
\ccaron
ka
atmosfera
,
833
u
:
atm
=
standardna
atmosfera
,
834
u
:
ft
=
stopa
,
835
u
:
inch
=
in
\ccaron
a
,
836
u
:
cal
=
kalorija
,
837
u
:
f
=
Force
,
838
u
:
kcal
=
Kilokalorien
]
839 840
\setuplabeltext
841
[
\s!it
]
842
[
u
:
at
=
pressione
atmosferica
tecnica
,
843
u
:
atm
=
pressione
atmosfera
fisica
,
844
u
:
ft
=
piede
,
845
u
:
cal
=
caloria
,
846
u
:
f
=
forza
,
847
u
:
kcal
=
chilocaloria
]
848 849
%D Here are some old ones, still there for compatibility
850
%D reasons. These will probably be obsolete in a few years.
851 852
\def
\MeterTwee
{
\Square
\Meter
}
853
\def
\mMeterTwee
{
\Square
\Milli
\Meter
}
854
\def
\cMeterTwee
{
\Square
\Centi
\Meter
}
855
\def
\dMeterTwee
{
\Square
\Deci
\Meter
}
856
\def
\kMeterTwee
{
\Square
\Kilo
\Meter
}
857 858
\def
\MeterDrie
{
\Cubic
\Meter
}
859
\def
\mMeterDrie
{
\Cubic
\Milli
\Meter
}
860
\def
\cMeterDrie
{
\Kubic
\Centi
\Meter
}
861
\def
\dMeterDrie
{
\Cubic
\Deci
\Meter
}
862
\def
\kMeterDrie
{
\Cubic
\Kilo
\Meter
}
863 864
\def
\LiterTwee
{
\Square
\Liter
}
865
\def
\SecTwee
{
\Square
\Sec
}
866
\def
\SecMinEen
{
\Inverse
\Sec
}
867 868
%D To make ourselves happy, we define some dutch specific
869
%D units:
870 871
\startinterface
dutch
872 873
\getvalue
{
\v!unit
}
[
PaardenKracht
]
{
pk
}
{
paardenkracht
}
874
\getvalue
{
\v!unit
}
[
Duits
]
{
D
}
{
duits
}
875
\getvalue
{
\v!unit
}
[
Kwik
]
{
Hg
}
{
kwikkolom
}
876
\getvalue
{
\v!unit
}
[
Hectare
]
{
ha
}
{
hectare
}
877
\getvalue
{
\v!unit
}
[
kGramForce
]
{
\Kilo
\Gram
\Force
}
{
kilogramforce
}
878
\getvalue
{
\v!unit
}
[
kWattUur
]
{
\Kilo
\Watt
\Uur
}
{
kilowattuur
}
879
\getvalue
{
\v!unit
}
[
MeterKwik
]
{
\Meter
\Kwik
}
{
meter
kwikkolom
}
880
\getvalue
{
\v!unit
}
[
Waterkolom
]
{
WK
}
{
waterkolom
}
881
\getvalue
{
\v!unit
}
[
MeterWater
]
{
\Meter
\Waterkolom
}
{
meter
waterkolom
}
882
\getvalue
{
\v!unit
}
[
DrogeStof
]
{
ds
}
{
droge
stof
}
883
\getvalue
{
\v!unit
}
[
Normaal
]
{
N
}
{
normaal
}
884 885
\getvalue
{
\v!unit
}
[
Ton
]
{
t
}
{
ton
}
886
\getvalue
{
\v!unit
}
[
kTon
]
{
\Kilo
\Ton
}
{
kiloton
}
887 888
\let
\OmwPerSec
\RevPerSec
889
\let
\OmwPerMin
\RevPerMin
890
\let
\Graden
\Deg
891
\let
\PaardeKracht
\PaardenKracht
892
\let
\Atoom
\Atom
893
\let
\Heure
\Hour
894
\let
\Jaar
\Year
895
\let
\Maand
\Month
896
\let
\Dag
\Day
897
\let
\Uur
\Hour
898 899
\stopinterface
900 901
%D Finally we define some equivalents. By using \type {\let}
902
%D we can be sure that they don't end up double in the lists of
903
%D units.
904 905
\let
\Second
\Sec
906
\let
\Kubic
\Cubic
907
\let
\IKubic
\ICubic
908 909
%D Option:
910 911
% \def\Micro{\dimensionprefix{\iftextdimensions\mathematics\mu \else\mu \fi}}
912
% \def\Times{\dimensionnopfix{\iftextdimensions\mathematics\cdot\else\cdot\fi}}
913 914
\stopmodule
915 916
\protect
\endinput
917