summaryrefslogtreecommitdiff
path: root/tex
diff options
context:
space:
mode:
Diffstat (limited to 'tex')
-rw-r--r--tex/context/base/catc-ctx.tex5
-rw-r--r--tex/context/base/char-def.lua152
-rw-r--r--tex/context/base/cont-new.tex2
-rw-r--r--tex/context/base/context.tex2
-rw-r--r--tex/context/base/enco-ini.mkiv6
-rw-r--r--tex/context/base/font-run.mkiv2
-rw-r--r--tex/context/base/grph-fig.mkiv7
-rw-r--r--tex/context/base/m-chart.mkiv2
-rw-r--r--tex/context/base/m-mathcrap.mkiv4
-rw-r--r--tex/context/base/m-units.mkii (renamed from tex/context/base/m-units.tex)0
-rw-r--r--tex/context/base/m-units.mkiv904
-rw-r--r--tex/context/base/math-ali.mkiv4
-rw-r--r--tex/context/base/math-arr.mkiv14
-rw-r--r--tex/context/base/math-ini.mkiv51
-rw-r--r--tex/context/base/math-lbr.mkii30
-rw-r--r--tex/context/base/math-pln.mkiv4
-rw-r--r--tex/context/base/math-scr.mkiv15
-rw-r--r--tex/context/base/ppchtex.mkiv12
-rw-r--r--tex/context/base/supp-mat.mkiv46
-rw-r--r--tex/context/base/supp-num.mkiv2
-rw-r--r--tex/context/base/x-mathml.mkiv108
-rw-r--r--tex/generic/context/luatex-fonts-merged.lua2
22 files changed, 1191 insertions, 183 deletions
diff --git a/tex/context/base/catc-ctx.tex b/tex/context/base/catc-ctx.tex
index beaa62479..61fd0514a 100644
--- a/tex/context/base/catc-ctx.tex
+++ b/tex/context/base/catc-ctx.tex
@@ -56,8 +56,8 @@
\catcode`\$ = 3
\catcode`\& = 4
\catcode`\# = 6
- \catcode`\^ = 7
- \catcode`\_ = 8
+ \catcode`\^ = 7 % soon we will also get rid of the usage of ^^ so then ^ can also be other
+ \catcode`\_ = \ifnum\texengine=\luatexengine 11 \else 8 \fi
\catcode`\% = 14
\catcode`\@ = 11
\catcode`\! = 11
@@ -165,7 +165,6 @@
\catcode`\> = 2
\stopcatcodetable
-
\startcatcodetable \typcatcodesc
\catcode`\^^I = 12
\catcode`\^^M = 12
diff --git a/tex/context/base/char-def.lua b/tex/context/base/char-def.lua
index c496b4a7a..3e74aa50a 100644
--- a/tex/context/base/char-def.lua
+++ b/tex/context/base/char-def.lua
@@ -50379,6 +50379,8 @@ characters.data={
description="EULER CONSTANT",
direction="l",
linebreak="al",
+ mathclass="variable",
+ mathname="Eulerconst",
specials={ "compat", 0x0190 },
unicodeslot=0x2107,
},
@@ -50435,6 +50437,8 @@ characters.data={
description="PLANCK CONSTANT",
direction="l",
linebreak="al",
+ mathclass="variable",
+ mathname="Plankconst",
specials={ "font", 0x0068 },
unicodeslot=0x210E,
},
@@ -50687,6 +50691,8 @@ characters.data={
description="TURNED GREEK SMALL LETTER IOTA",
direction="on",
linebreak="al",
+ mathclass="variable",
+ mathname="turnediota",
unicodeslot=0x2129,
},
[0x212A]={
@@ -50802,7 +50808,7 @@ characters.data={
description="BET SYMBOL",
direction="l",
linebreak="al",
- mathclass="ord",
+ mathclass="default",
mathname="beth",
specials={ "compat", 0x05D1 },
unicodeslot=0x2136,
@@ -50812,7 +50818,7 @@ characters.data={
description="GIMEL SYMBOL",
direction="l",
linebreak="al",
- mathclass="ord",
+ mathclass="default",
mathname="gimel",
specials={ "compat", 0x05D2 },
unicodeslot=0x2137,
@@ -50822,7 +50828,7 @@ characters.data={
description="DALET SYMBOL",
direction="l",
linebreak="al",
- mathclass="ord",
+ mathclass="default",
mathname="daleth",
specials={ "compat", 0x05D3 },
unicodeslot=0x2138,
@@ -50904,6 +50910,8 @@ characters.data={
description="TURNED SANS-SERIF CAPITAL L",
direction="on",
linebreak="al",
+ mathclass="ord",
+--mathname="sansLturned",-- We need a proper name
unicodeslot=0x2142,
},
[0x2143]={
@@ -50911,6 +50919,8 @@ characters.data={
description="REVERSED SANS-SERIF CAPITAL L",
direction="on",
linebreak="al",
+ mathclass="ord",
+--mathname="sansLmirrored",-- We need a proper name
unicodeslot=0x2143,
},
[0x2144]={
@@ -50918,6 +50928,8 @@ characters.data={
description="TURNED SANS-SERIF CAPITAL Y",
direction="on",
linebreak="al",
+ mathclass="ord",
+--mathname="Yup",-- We need a proper name
unicodeslot=0x2144,
},
[0x2145]={
@@ -50975,6 +50987,8 @@ characters.data={
description="PROPERTY LINE",
direction="on",
linebreak="al",
+ mathclass="ord",
+ mathname="PropertyLine",
unicodeslot=0x214A,
},
[0x214B]={
@@ -50982,6 +50996,8 @@ characters.data={
description="TURNED AMPERSAND",
direction="on",
linebreak="al",
+ mathclass="bin",
+ mathname="upand",
unicodeslot=0x214B,
},
[0x214C]={
@@ -51654,6 +51670,8 @@ characters.data={
description="LEFTWARDS WAVE ARROW",
direction="on",
linebreak="al",
+ mathclass="relation",
+ mathname="leftwavearrow",
unicodeslot=0x219C,
},
[0x219D]={
@@ -51661,6 +51679,8 @@ characters.data={
description="RIGHTWARDS WAVE ARROW",
direction="on",
linebreak="al",
+ mathclass="relation",
+ mathname="rightwavearrow",
unicodeslot=0x219D,
},
[0x219E]={
@@ -51678,7 +51698,7 @@ characters.data={
direction="on",
linebreak="al",
mathclass="relation",
- mathname="twoheadupleftarrow",
+ mathname="twoheaduparrow",
unicodeslot=0x219F,
},
[0x21A0]={
@@ -51696,7 +51716,7 @@ characters.data={
direction="on",
linebreak="al",
mathclass="relation",
- mathname="twoheaddownleftarrow",
+ mathname="twoheaddownarrow",
unicodeslot=0x21A1,
},
[0x21A2]={
@@ -51722,6 +51742,8 @@ characters.data={
description="LEFTWARDS ARROW FROM BAR",
direction="on",
linebreak="al",
+ mathclass="relation",
+ mathname="mapsfrom",
unicodeslot=0x21A4,
},
[0x21A5]={
@@ -51729,6 +51751,8 @@ characters.data={
description="UPWARDS ARROW FROM BAR",
direction="on",
linebreak="al",
+ mathclass="relation",
+ mathname="mapsup",
unicodeslot=0x21A5,
},
[0x21A6]={
@@ -51745,6 +51769,8 @@ characters.data={
description="DOWNWARDS ARROW FROM BAR",
direction="on",
linebreak="al",
+ mathclass="relation",
+ mathname="mapsdown",
unicodeslot=0x21A7,
},
[0x21A8]={
@@ -51753,6 +51779,8 @@ characters.data={
description="UP DOWN ARROW WITH BASE",
direction="on",
linebreak="al",
+ mathclass="ord",
+ mathname="updownarrowbar",
unicodeslot=0x21A8,
},
[0x21A9]={
@@ -51815,6 +51843,8 @@ characters.data={
description="DOWNWARDS ZIGZAG ARROW",
direction="on",
linebreak="al",
+ mathclass="relation",
+ mathname="downzigzagarrow",
unicodeslot=0x21AF,
},
[0x21B0]={
@@ -51841,7 +51871,7 @@ characters.data={
direction="on",
linebreak="al",
mathclass="relation",
- mathname="dlsh", -- from mathabx
+ mathname="Ldsh",
unicodeslot=0x21B2,
},
[0x21B3]={
@@ -51850,7 +51880,7 @@ characters.data={
direction="on",
linebreak="al",
mathclass="relation",
- mathname="drsh", -- from mathabx
+ mathname="Rdsh",
unicodeslot=0x21B3,
},
[0x21B4]={
@@ -51858,6 +51888,8 @@ characters.data={
description="RIGHTWARDS ARROW WITH CORNER DOWNWARDS",
direction="on",
linebreak="al",
+ mathclass="ord",
+ mathname="linefeed",
unicodeslot=0x21B4,
},
[0x21B5]={
@@ -51867,6 +51899,8 @@ characters.data={
description="DOWNWARDS ARROW WITH CORNER LEFTWARDS",
direction="on",
linebreak="al",
+ mathclass="ord",
+ mathname="carriagereturn",
unicodeslot=0x21B5,
},
[0x21B6]={
@@ -51893,6 +51927,8 @@ characters.data={
description="NORTH WEST ARROW TO LONG BAR",
direction="on",
linebreak="al",
+ mathclass="relation",
+ mathname="barovernorthwestarrow",
unicodeslot=0x21B8,
},
[0x21B9]={
@@ -51901,6 +51937,8 @@ characters.data={
description="LEFTWARDS ARROW TO BAR OVER RIGHTWARDS ARROW TO BAR",
direction="on",
linebreak="al",
+ mathclass="relation",
+ mathname="barleftarrowrightarrowba", -- This is a strange name
unicodeslot=0x21B9,
},
[0x21BA]={
@@ -51908,8 +51946,10 @@ characters.data={
description="ANTICLOCKWISE OPEN CIRCLE ARROW",
direction="on",
linebreak="al",
- mathclass="relation",
- mathname="circlearrowright",
+ mathspec = {
+ {class="relation", name="circlearrowright"},
+ {class="relation", name="acwopencirclearrow"},
+ },
unicodeslot=0x21BA,
},
[0x21BB]={
@@ -51917,8 +51957,10 @@ characters.data={
description="CLOCKWISE OPEN CIRCLE ARROW",
direction="on",
linebreak="al",
- mathclass="relation",
- mathname="circlearrowleft",
+ mathspec = {
+ {class="relation", name="circlearrowleft"},
+ {class="relation", name="cwopencirclearrow"},
+ },
unicodeslot=0x21BB,
},
[0x21BC]={
@@ -52246,6 +52288,8 @@ characters.data={
description="UPWARDS ARROW WITH DOUBLE STROKE",
direction="on",
linebreak="al",
+ mathclass="relation",
+ mathname="nHuparrow", -- strange name
unicodeslot=0x21DE,
},
[0x21DF]={
@@ -52253,6 +52297,8 @@ characters.data={
description="DOWNWARDS ARROW WITH DOUBLE STROKE",
direction="on",
linebreak="al",
+ mathclass="relation",
+ mathname="nHdownarrow", -- strange name
unicodeslot=0x21DF,
},
[0x21E0]={
@@ -52261,7 +52307,7 @@ characters.data={
direction="on",
linebreak="al",
mathclass="relation",
- mathname="dashleftarrow",
+ mathname="leftdasharrow",
unicodeslot=0x21E0,
},
[0x21E1]={
@@ -52270,7 +52316,7 @@ characters.data={
direction="on",
linebreak="al",
mathclass="relation",
- mathname="dashuparrow",
+ mathname="updasharrow",
unicodeslot=0x21E1,
},
[0x21E2]={
@@ -52279,7 +52325,7 @@ characters.data={
direction="on",
linebreak="al",
mathspec={
- { class="relation", name="dashrightarrow" } ,
+ { class="relation", name="rightdasharrow" } ,
{ class="relation", name="dasharrow" } ,
},
unicodeslot=0x21E2,
@@ -52290,7 +52336,7 @@ characters.data={
direction="on",
linebreak="al",
mathclass="relation",
- mathname="dashdownarrow",
+ mathname="downdasharrow",
unicodeslot=0x21E3,
},
[0x21E4]={
@@ -52298,6 +52344,8 @@ characters.data={
description="LEFTWARDS ARROW TO BAR",
direction="on",
linebreak="al",
+ mathclass="relation",
+ mathname="barleftarrow",
unicodeslot=0x21E4,
},
[0x21E5]={
@@ -52305,6 +52353,8 @@ characters.data={
description="RIGHTWARDS ARROW TO BAR",
direction="on",
linebreak="al",
+ mathclass="relation",
+ mathname="rightarrowbar",
unicodeslot=0x21E5,
},
[0x21E6]={
@@ -52312,6 +52362,8 @@ characters.data={
description="LEFTWARDS WHITE ARROW",
direction="on",
linebreak="al",
+ mathclass="ord",
+ mathname="leftwhitearrow",
unicodeslot=0x21E6,
},
[0x21E7]={
@@ -52320,6 +52372,8 @@ characters.data={
description="UPWARDS WHITE ARROW",
direction="on",
linebreak="al",
+ mathclass="ord",
+ mathname="upwhitearrow",
unicodeslot=0x21E7,
},
[0x21E8]={
@@ -52327,6 +52381,8 @@ characters.data={
description="RIGHTWARDS WHITE ARROW",
direction="on",
linebreak="al",
+ mathclass="ord",
+ mathname="rightwhitearrow",
unicodeslot=0x21E8,
},
[0x21E9]={
@@ -52334,6 +52390,8 @@ characters.data={
description="DOWNWARDS WHITE ARROW",
direction="on",
linebreak="al",
+ mathclass="ord",
+ mathname="downwhitearrow",
unicodeslot=0x21E9,
},
[0x21EA]={
@@ -52348,6 +52406,8 @@ characters.data={
description="UPWARDS WHITE ARROW ON PEDESTAL",
direction="on",
linebreak="al",
+ mathclass="ord",
+ mathname="whitearrowupfrombar",
unicodeslot=0x21EB,
},
[0x21EC]={
@@ -52411,6 +52471,8 @@ characters.data={
description="RIGHT ARROW WITH SMALL CIRCLE",
direction="on",
linebreak="al",
+ mathclass="relation",
+ mathname="circleonrightarrow",
unicodeslot=0x21F4,
},
[0x21F5]={
@@ -52418,6 +52480,8 @@ characters.data={
description="DOWNWARDS ARROW LEFTWARDS OF UPWARDS ARROW",
direction="on",
linebreak="al",
+ mathclass="relation",
+ mathname="downuparrows",
unicodeslot=0x21F5,
},
[0x21F6]={
@@ -52425,6 +52489,8 @@ characters.data={
description="THREE RIGHTWARDS ARROWS",
direction="on",
linebreak="al",
+ mathclass="relation",
+ mathname="rightthreearrows",
unicodeslot=0x21F6,
},
[0x21F7]={
@@ -52432,6 +52498,8 @@ characters.data={
description="LEFTWARDS ARROW WITH VERTICAL STROKE",
direction="on",
linebreak="al",
+ mathclass="relation",
+ mathname="nvleftarrow",
unicodeslot=0x21F7,
},
[0x21F8]={
@@ -52439,6 +52507,8 @@ characters.data={
description="RIGHTWARDS ARROW WITH VERTICAL STROKE",
direction="on",
linebreak="al",
+ mathclass="relation",
+ mathname="nvrightarrow",
unicodeslot=0x21F8,
},
[0x21F9]={
@@ -52446,6 +52516,8 @@ characters.data={
description="LEFT RIGHT ARROW WITH VERTICAL STROKE",
direction="on",
linebreak="al",
+ mathclass="relation",
+ mathname="nvleftrightarrow",
unicodeslot=0x21F9,
},
[0x21FA]={
@@ -52453,6 +52525,8 @@ characters.data={
description="LEFTWARDS ARROW WITH DOUBLE VERTICAL STROKE",
direction="on",
linebreak="al",
+ mathclass="relation",
+ mathname="nVleftarrow",
unicodeslot=0x21FA,
},
[0x21FB]={
@@ -52460,6 +52534,8 @@ characters.data={
description="RIGHTWARDS ARROW WITH DOUBLE VERTICAL STROKE",
direction="on",
linebreak="al",
+ mathclass="relation",
+ mathname="nVrightarrow",
unicodeslot=0x21FB,
},
[0x21FC]={
@@ -52467,6 +52543,8 @@ characters.data={
description="LEFT RIGHT ARROW WITH DOUBLE VERTICAL STROKE",
direction="on",
linebreak="al",
+ mathclass="relation",
+ mathname="nVleftrightarrow",
unicodeslot=0x21FC,
},
[0x21FD]={
@@ -63379,6 +63457,46 @@ characters.data={
mirror=0x27EA,
unicodeslot=0x27EB,
},
+ [0x27EC]={
+ category="ps",
+ cjkwd="na",
+ description="MATHEMATICAL LEFT WHITE TORTOISE SHELL BRACKET",
+ direction="on",
+ linebreak="op",
+ mirror=0x27ED,
+ unicodeslot=0x27EC,
+ },
+ [0x27ED]={
+ category="pe",
+ cjkwd="na",
+ description="MATHEMATICAL RIGHT WHITE TORTOISE SHELL BRACKET",
+ direction="on",
+ linebreak="cl",
+ mirror=0x27EC,
+ unicodeslot=0x27ED,
+ },
+ [0x27EE]={
+ category="ps",
+ cjkwd="na",
+ description="MATHEMATICAL LEFT FLATTENED PARENTHESIS",
+ direction="on",
+ linebreak="op",
+ mathclass="open",
+ mathname="lgroup",
+ mirror=0x27EF,
+ unicodeslot=0x27EE,
+ },
+ [0x27EF]={
+ category="pe",
+ cjkwd="na",
+ description="MATHEMATICAL RIGHT FLATTENED PARENTHESIS",
+ direction="on",
+ linebreak="cl",
+ mathclass="close",
+ mathname="rgroup",
+ mirror=0x27EE,
+ unicodeslot=0x27EF,
+ },
[0x27F0]={
category="sm",
description="UPWARDS QUADRUPLE ARROW",
@@ -75694,8 +75812,6 @@ characters.data={
direction="on",
linebreak="op",
mirror=0x3015,
- mathclass="open",
- mathname="lgroup",
unicodeslot=0x3014,
},
[0x3015]={
@@ -75705,8 +75821,6 @@ characters.data={
direction="on",
linebreak="cl",
mirror=0x3014,
- mathclass="close",
- mathname="rgroup",
unicodeslot=0x3015,
},
[0x3016]={
diff --git a/tex/context/base/cont-new.tex b/tex/context/base/cont-new.tex
index 7552c0f50..9c610629e 100644
--- a/tex/context/base/cont-new.tex
+++ b/tex/context/base/cont-new.tex
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2011.01.06 17:08}
+\newcontextversion{2011.01.10 09:41}
%D This file is loaded at runtime, thereby providing an
%D excellent place for hacks, patches, extensions and new
diff --git a/tex/context/base/context.tex b/tex/context/base/context.tex
index 544bf7765..3d38e4e54 100644
--- a/tex/context/base/context.tex
+++ b/tex/context/base/context.tex
@@ -20,7 +20,7 @@
%D your styles an modules.
\edef\contextformat {\jobname}
-\edef\contextversion{2011.01.06 17:08}
+\edef\contextversion{2011.01.10 09:41}
%D For those who want to use this:
diff --git a/tex/context/base/enco-ini.mkiv b/tex/context/base/enco-ini.mkiv
index f9fcf3360..33a5e92d7 100644
--- a/tex/context/base/enco-ini.mkiv
+++ b/tex/context/base/enco-ini.mkiv
@@ -481,10 +481,10 @@
% from enco-mis:
\def\fakepercent
- {\mathematics{^{\scriptscriptstyle0}\kern-.25em/\kern-.2em_{\scriptscriptstyle0}}}
+ {\mathematics{\normalsuperscript{\scriptscriptstyle0}\kern-.25em/\kern-.2em\normalsubscript{\scriptscriptstyle0}}}
\def\fakeperthousand
- {\mathematics{^{\scriptscriptstyle0}\kern-.25em/\kern-.2em_{\scriptscriptstyle00}}}
+ {\mathematics{\normalsuperscript{\scriptscriptstyle0}\kern-.25em/\kern-.2em\normalsubscript{\scriptscriptstyle00}}}
\def\fakepermine
{\dontleavehmode
@@ -493,7 +493,7 @@
{\mathematics{+}}%
\hbox to \wd\scratchbox
{\hss
- \mathematics{^{\scriptscriptstyle-}\kern-.4em/\kern-.3em_{\scriptscriptstyle-}}%
+ \mathematics{\normalsuperscript{\scriptscriptstyle-}\kern-.4em/\kern-.3em\normalsubscript{\scriptscriptstyle-}}%
\hss}%
\egroup}
diff --git a/tex/context/base/font-run.mkiv b/tex/context/base/font-run.mkiv
index aad6bebe8..0794a9b85 100644
--- a/tex/context/base/font-run.mkiv
+++ b/tex/context/base/font-run.mkiv
@@ -316,7 +316,7 @@
\starttabulate[||T|T|T|T|T|T|T|T|T|]
\testminimalbaseline{\hbox to 1em{\hss\showstruts\strut\hss}}%
\testminimalbaseline{(/)}%
- \testminimalbaseline{$\frac{1}{2}x^2_3$}
+ \testminimalbaseline{$\frac{1}{2}x\normalsuperscript2\normalsubscript3$}
\stoptabulate
\fi}
diff --git a/tex/context/base/grph-fig.mkiv b/tex/context/base/grph-fig.mkiv
index 2b745d218..b789c51e2 100644
--- a/tex/context/base/grph-fig.mkiv
+++ b/tex/context/base/grph-fig.mkiv
@@ -42,12 +42,9 @@
\def\dodoplaceexternalfigure[#1][#2][#3][#4][#5]%
{\bgroup
\dostarttagged\t!image\empty
- \pushmacro\textunderscore
- \edef\textunderscore{\string_}% brrr, temp hack, still needed?
+ \let\textunderscore\letterunderscore % {\string _} % space needed as _ is now letter in unprotected mode
\calculateexternalfigure[][#1][#2][#3][#4][#5]% [] is dummy dwcomp
- \popmacro\textunderscore
- \global\setbox\foundexternalfigure\naturalvbox attr \imageattribute 2 {\box\foundexternalfigure}%
- \box\foundexternalfigure
+ \naturalvbox attr \imageattribute 2 {\box\foundexternalfigure}%
\dostoptagged
\egroup}
diff --git a/tex/context/base/m-chart.mkiv b/tex/context/base/m-chart.mkiv
index e55a8c942..e18eeb96d 100644
--- a/tex/context/base/m-chart.mkiv
+++ b/tex/context/base/m-chart.mkiv
@@ -94,7 +94,7 @@
\lccode`0=`a\lccode`1=`b\lccode`2=`c\lccode`3=`d\lccode`4=`e%
\lccode`5=`f\lccode`6=`g\lccode`7=`h\lccode`8=`i\lccode`9=`j%
\lccode` =`\_\lccode`-=`\_\lccode`_=`\_%
- \lowercase{\gdef#1{#2}}%
+ \lowercase{\gdef#1{#2}}% todo: make a ctxlua call of this
\egroup}
% een gobble als default is sneller, en dan alleen setten als
diff --git a/tex/context/base/m-mathcrap.mkiv b/tex/context/base/m-mathcrap.mkiv
index 37dbbedeb..0c187155b 100644
--- a/tex/context/base/m-mathcrap.mkiv
+++ b/tex/context/base/m-mathcrap.mkiv
@@ -24,8 +24,8 @@
\unprotect
-\unexpanded\def\mathunicodesupercrap#1{\mathortext{{^{#1}}}{\high{#1}}}
-\unexpanded\def\mathunicodesubcrap #1{\mathortext{{_{#1}}}{\low {#1}}}
+\unexpanded\def\mathunicodesupercrap#1{\mathortext{{\normalsuperscript{#1}}}{\high{#1}}}
+\unexpanded\def\mathunicodesubcrap #1{\mathortext{{\normalsubscript {#1}}}{\low {#1}}}
\ifdefined\installanddefineactivecharacter\else
diff --git a/tex/context/base/m-units.tex b/tex/context/base/m-units.mkii
index 6a899736b..6a899736b 100644
--- a/tex/context/base/m-units.tex
+++ b/tex/context/base/m-units.mkii
diff --git a/tex/context/base/m-units.mkiv b/tex/context/base/m-units.mkiv
new file mode 100644
index 000000000..eec2d8c51
--- /dev/null
+++ b/tex/context/base/m-units.mkiv
@@ -0,0 +1,904 @@
+%D \module
+%D [ file=m-units,
+%D version=1997.03.19,
+%D title=\CONTEXT\ Extra Modules,
+%D subtitle=Scientific Units,
+%D author={Hans Hagen \& Ton Otten},
+%D date=\currentdate,
+%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+%D Scientific units can be typeset in math mode pretty well,
+%D but occasionally one has to take care of spacing.
+%D Furthermore, entering these units is not that natural as
+%D wanted. Therefore this module presents a more natural way of
+%D doing things, like:
+%D
+%D \starttyping
+%D 1.23 \Cubic \Meter \Per \Second
+%D \stoptyping
+%D
+%D This example shows that we use the order in which we say
+%D things, instead of typeset things. There is a separate
+%D manual for this module.
+
+%D Message number~1 deals with overruling the \type {\Degrees}
+%D macro defined in the core modules. Let's say that this is
+%D an upward compatibility issue.
+
+\startmessages dutch library: units
+ title: eenheden
+ 1: gebruik \string\Degrees\space\string\Celsius\space in plaats van \string\Celsius !
+\stopmessages
+
+\startmessages english library: units
+ title: units
+ 1: use \string\Degrees\space\string\Celsius\space instead of \string\Celsius !
+\stopmessages
+
+\startmessages german library: units
+ title: Einheiten
+ 1: Verwende \string\Degrees\space\string\Celsius\space statt \string\Celsius !
+\stopmessages
+
+\startmessages italian library: units
+ title: unita
+ 1: usare \string\Degrees\space\string\Celsius\space invece di \string\Celsius !
+\stopmessages
+
+\startmessages norwegian library: units
+ title: enheter
+ 1: bruk \string\Degrees\space\string\Celsius\space istedenfor \string\Celsius !
+\stopmessages
+
+\startmessages romanian library: units
+ title: unitati
+ 1: folositi \string\Degrees\space\string\Celsius\space in locul \string\Celsius !
+\stopmessages
+
+\startmessages french library: units
+ title: unitas
+ 1: utilisez \string\Degrees\space\string\Celsius\space A la place de \string\Celsius !
+\stopmessages
+
+\unprotect
+
+%D This runtime loadable module implements a way of defining
+%D units. The core macro is \type {\dimension}, a rather clever
+%D one that is able to cooperate with some other dimension
+%D related macros. As said, this module enables user to enter:
+%D
+%D \startbuffer
+%D some 10 \Square \Meter \Per \Second or more
+%D \stopbuffer
+%D
+%D \getbuffer
+%D
+%D as:
+%D
+%D \typebuffer
+%D
+%D The units itself are implemented as synonyms.
+%D
+%D \starttyping
+%D \definesynonyms [unit] [units] [\unitmeaning]
+%D \setupsynonyms [unit] [textstyle=\dimension]
+%D \stoptyping
+%D
+%D This definition means that we can ask for the meaning of a
+%D unit using \type {\unitmeaning} and get a list of used
+%D units by saying \type {\placelistofunits}
+%D
+%D We have to use the command \type {\unitmeaning} instead
+%D of \type {\meaning}, simply because the latter is a \TEX\
+%D primitive we don't want to loose. We use the label text
+%D mechanism for translations.
+
+%D \macros
+%D {dimension}
+%D
+%D The core of this module is the low level macro \type
+%D {\dimension}. Before presenting this macro, it's best to
+%D look at some applications, because it's supposed to show
+%D some intelligence that can beter be understood from the
+%D context.
+%D
+%D The next useless examples show some of the cases we want
+%D to handle in a proper way.
+%D
+%D \startbuffer
+%D ... 10 \Square \Meter \Per \Volt \
+%D ... 10 \Square \Meter \Volt \
+%D ... 10 \Meter \Volt \
+%D ... 10 \Milli \Square \Meter \Per \Volt \
+%D ... 10 \Square \Milli \Meter \Per \Volt \
+%D ... 10 \Meter \Times \Meter \
+%D ... 10 \Square \Meter \Times \Meter \
+%D ... 10 \Square \Milli \Meter \Times \Meter \
+%D \stopbuffer
+%D
+%D \typebuffer
+%D
+%D Becomes:
+%D
+%D \getbuffer
+
+%D \macros
+%D {mathematicstypeface, dimensiontypeface,
+%D dimensionhalfspace, dimensionbackspace}
+%D
+%D There are some low level constants, that can be changed
+%D when needed. Some day I will write a decent setup command.
+
+\def\mathematicstypeface{\rm}
+\def\dimensiontypeface {\tf}
+
+\def\dimensionhalfspace {\ifmmode\,\else\hskip+.1em\relax\fi}
+\def\dimensionbackspace {\ifmmode\!\else\hskip-.1em\relax\fi}
+
+%D \macros
+%D {smashdimensionpower}
+%D
+%D Sometimes the baseline distance is not enough to provide
+%D for superscripts, so we smash their height by default.
+
+\newif\ifsmashdimensionpower \smashdimensionpowertrue
+
+%D The dimension mechanism uses a lot of signals to keep
+%D track if the current state.
+
+\newsignal\dimensionsignal
+\newsignal\dimensionpowersignal
+\newsignal\dimensionmidfixsignal
+\newsignal\dimensionaddfixsignal
+
+\let\thedimensionprefix = \empty
+\let\thedimensionpower = \empty
+
+%D \macros
+%D {spaceddimensions,textdimensions}
+%D
+%D The actual definition of \type {\dimension} overruled the
+%D one in the core modules. The boolean can be used to
+%D force spacing between units. Vergelijk {\Newton \Meter}
+%D eens met {\spaceddimensionstrue \Newton \Meter}. The
+%D rather ugly test prevents problems with nested dimensions.
+
+\newif\ifspaceddimensions \spaceddimensionsfalse % user switch
+\newif\iftextdimensions \textdimensionsfalse % user switch
+
+%D You can see the consequence of forcing text dimensions
+%D when you compare the following code:
+%D
+%D \starttyping
+%D {\rm test \Square \Meter \Per \Second\ ziezo\Degrees} \par
+%D {\ss test \Square \Meter \Per \Second\ ziezo} \par
+%D {\tt test \Square \Meter \Per \Second\ ziezo}
+%D
+%D \textdimensionstrue
+%D
+%D {\rm test \Square \Meter \Per \Second\ ziezo} \par
+%D {\ss test \Square \Meter \Per \Second\ ziezo} \par
+%D {\tt test \Square \Meter \Per \Second\ ziezo}
+%D \stoptyping
+
+\newif\ifnesteddimension \nesteddimensionfalse % local switch
+
+\def\dodimensionpower#1%
+ {\iftextdimensions\expandafter\high\else\expandafter\normalsuperscript\fi{#1}}
+
+\def\ustartmathmode {\iftextdimensions\else\expandafter\startmathmode \fi}
+\def\ustopmathmode {\iftextdimensions\else\expandafter\stopmathmode \fi}
+\def\umathematicstypeface{\iftextdimensions\else\expandafter\mathematicstypeface\fi}
+
+%D In forced text mode, we ignore spacing in monospaced fonts.
+
+\def\udimensionhalfspace {\dodimensionspace\dimensionhalfspace}
+\def\udimensionbackspace {\dodimensionspace\dimensionbackspace}
+
+\def\dodimensionspace
+ {\iftextdimensions
+ \begingroup
+ \setbox0\hbox{i}%
+ \setbox2\hbox{m}%
+ \ifdim\wd0=\wd2
+ \endgroup
+ \@EAEAEA\gobbleoneargument
+ \else
+ \endgroup
+ \fi
+ \fi}
+
+\unexpanded\def\dimension#1%
+ {\begingroup
+ \global\let\savedthedimensionprefix\thedimensionprefix
+ \global\let\savedthedimensionpower\thedimensionpower
+ \unexpanded\def\dimension##1{\global\nesteddimensiontrue}%
+ \let\dimensionprefix\dimension
+ \let\dimensionmidfix\dimension
+ \let\dimensionsuffix\dimension
+ \let\dimensionpower \dimension
+ \global\nesteddimensionfalse
+ \setbox\scratchbox\hbox{\ustartmathmode#1\ustopmathmode}% pre-roll
+ \global\let\thedimensionprefix\savedthedimensionprefix
+ \global\let\thedimensionpower \savedthedimensionpower
+ \endgroup
+ \ifnesteddimension#1\else\dodimension{#1}\fi}
+
+\def\dodimension#1%
+ {\dontbreakdimension
+ \ifdim\scratchdimen=\zeropoint\relax
+ \ifmmode
+ \udimensionhalfspace
+ \udimensionhalfspace
+ \fi
+ \ustartmathmode\dimensiontypeface
+ \else
+ \ustartmathmode\dimensiontypeface
+ \ifspaceddimensions
+ \ifdim\scratchdimen=\dimensionsignal\relax
+ \udimensionhalfspace
+ \else\ifdim\scratchdimen=\dimensionpowersignal\relax
+ \udimensionhalfspace
+ \fi
+ \fi
+ \fi
+ \fi
+ \umathematicstypeface\thedimensionprefix#1%
+ \ifx\thedimensionpower\empty
+ \else\ifsmashdimensionpower
+ \setbox\scratchbox=\hbox
+ {\iftextdimensions
+ \tx\thedimensionpower
+ \else
+ $\scriptstyle\thedimensionpower$%
+ \fi}%
+ \ht\scratchbox=\zeropoint
+ \dodimensionpower{\box\scratchbox}%
+ \else
+ \dodimensionpower{\thedimensionpower}%
+ \fi\fi
+ \ustopmathmode
+ % otherwise nobreak before space in 2 \Milli \Meter\ blabla
+ \doifnotmode{atpragma}{\nobreak}% this was always \nobreak
+ % only test this at pragma
+ \ifx\thedimensionpower\empty
+ \hskip\dimensionsignal
+ \else
+ \hskip\dimensionpowersignal
+ \fi
+ \global\let\thedimensionprefix\empty
+ \global\let\thedimensionpower\empty}
+
+%D \macros
+%D {dontbreakdimension,
+%D dimensionprefix, dimensionaddfix,
+%D dimensionnopfix, dimensionmidfix,
+%D dimensionpower}
+%D
+%D Here are some auxilliary macros.
+
+\def\dontbreakdimension
+ {\scratchdimen\lastskip
+ \unskip
+ \nobreak
+ \hskip\scratchdimen
+ \nobreak}
+
+\def\dimensionprefix#1%
+ {\gdef\thedimensionprefix{#1}}
+
+\def\dimensionaddfix#1%
+ {\unskip
+ %\mathematics{\umathematicstypeface#1}%
+ \ustartmathmode\umathematicstypeface#1\ustopmathmode
+ \nobreak
+ \hskip\dimensionaddfixsignal}
+
+\def\dimensionnopfix#1%
+ {\dontbreakdimension
+ \ifdim\scratchdimen=\dimensionpowersignal\relax
+ \ustartmathmode
+ \else
+ \ustartmathmode
+ \udimensionhalfspace
+ \nobreak
+ \fi
+ \umathematicstypeface#1%
+ \ustopmathmode
+ \nobreak
+ \hskip\dimensionsignal}
+
+\def\dimensionmidfix#1%
+ {\dontbreakdimension
+ \ifdim\scratchdimen=\dimensionpowersignal\relax
+ \ustartmathmode
+ \udimensionbackspace
+ \nobreak
+ \else
+ \ustartmathmode
+ \fi
+ \umathematicstypeface#1%
+ \ustopmathmode
+ \nobreak
+ \hskip\dimensionmidfixsignal}
+
+\def\dimensionpower#1%
+ {\gdef\thedimensionpower{#1}}
+
+%D \macros
+%D {SIunits, noSI, doSI}
+%D
+%D Some low level unit switching macros:
+
+\newif\ifSIunits \SIunitstrue
+
+\def\noSI#1{\begingroup\SIunitsfalse#1\endgroup}
+\def\doSI#1{\begingroup\SIunitstrue #1\endgroup}
+
+%D \macros
+%D {Degrees}
+%D
+%D We can fake the degrees symbol with:
+
+\def\Degrees{\dimensionaddfix{\mathematics{\normalsuperscript\circ}}}
+
+%D \macros
+%D {Unit, NoUnit}
+%D
+%D When a dimension has no leading number, we can use \type
+%D {\Unit}, and when no unit is appended, \type {\NoUnit} is
+%D to be used, just to prevent the prefix migrating to the
+%D next occasion.
+
+\def\Unit {\hskip\dimensionsignal}
+\def\NoUnit {\dimension{}}
+
+%D The mechanism described at the top of this module, depends
+%D on several dimensional components, like prefixes:
+
+\def\Atto {\dimensionprefix{a}}
+\def\Femto {\dimensionprefix{f}}
+\def\Pico {\dimensionprefix{p}}
+\def\Nano {\dimensionprefix{n}}
+\def\Micro {\dimensionprefix{\iftextdimensions u\else\mu\fi}}
+\def\Milli {\dimensionprefix{m}}
+\def\Centi {\dimensionprefix{c}}
+\def\Deci {\dimensionprefix{d}} % 10^{01}
+\def\Hecto {\dimensionprefix{h}} % 10^{02}
+\def\Kilo {\dimensionprefix{k}} % 10^{03}
+\def\Mega {\dimensionprefix{M}} % 10^{06}
+\def\Giga {\dimensionprefix{G}} % 10^{09}
+\def\Tera {\dimensionprefix{T}} % 10^{12}
+\def\Peta {\dimensionprefix{P}} % 10^{15}
+\def\Exa {\dimensionprefix{E}} % 10^{18}
+
+%def\Terra {\dimensionprefix{T}} % for old times sake
+
+\def\Kibi {\dimensionprefix{ki}} % 2^{10}
+\def\Mebi {\dimensionprefix{Mi}} % 2^{20}
+\def\Gibi {\dimensionprefix{Gi}} % 2^{30}
+\def\Tebi {\dimensionprefix{Ti}} % 2^{40}
+\def\Pebi {\dimensionprefix{Pi}} % 2^{50}
+
+%D and binary prefixes:
+
+\def\Kibi {\dimensionprefix{Ki}}
+\def\Mebi {\dimensionprefix{Mi}}
+\def\Gibi {\dimensionprefix{Gi}}
+\def\Tebi {\dimensionprefix{Ti}}
+\def\Pebi {\dimensionprefix{Pi}}
+\def\Exbi {\dimensionprefix{Ei}}
+\def\Zebi {\dimensionprefix{Zi}}
+\def\Yobi {\dimensionprefix{Yi}}
+
+%D and operators:
+
+\def\Times {\dimensionnopfix{\iftextdimensions.\else\cdot\fi}}
+\def\Solidus {\dimensionmidfix{/}}
+\def\Per {\dimensionmidfix{/}}
+\def\OutOf {\dimensionnopfix{:}}
+
+%D and suffixes:
+
+\def\Linear {\dimensionpower{1}}
+\def\Square {\dimensionpower{2}}
+\def\Cubic {\dimensionpower{3}}
+
+\def\Inverse {\dimensionpower{-1}}
+\def\ILinear {\dimensionpower{-1}}
+\def\ISquare {\dimensionpower{-2}}
+\def\ICubic {\dimensionpower{-3}}
+
+%D Apart from these components, the units themselves are
+%D defined using the synonym mechanism. First we define some
+%D length and volume related units.
+
+\getvalue{\v!unit} [Meter] {m} {meter}
+\getvalue{\v!unit} [pMeter] {\Pico \Meter} {picometer}
+\getvalue{\v!unit} [nMeter] {\Nano \Meter} {nanometer}
+\getvalue{\v!unit} [uMeter] {\Micro \Meter} {micrometer}
+\getvalue{\v!unit} [mMeter] {\Milli \Meter} {millimeter}
+\getvalue{\v!unit} [cMeter] {\Centi \Meter} {centimeter}
+\getvalue{\v!unit} [dMeter] {\Deci \Meter} {decimeter}
+\getvalue{\v!unit} [hMeter] {\Hecto \Meter} {hectometer}
+\getvalue{\v!unit} [kMeter] {\Kilo \Meter} {kilometer}
+
+%D After some discussion on the \CONTEXT\ mailing list in
+%D february 2002 it was decided to go from L to l for liters
+%D (Karel Wesselings alternative: \mathematics{\ell}).
+
+\getvalue{\v!unit} [Liter] {l} {liter}
+\getvalue{\v!unit} [mLiter] {\Milli \Liter} {milliliter}
+\getvalue{\v!unit} [cLiter] {\Centi \Liter} {centiliter}
+\getvalue{\v!unit} [dLiter] {\Deci \Liter} {deciliter}
+
+%D Next we define time related units (\type {\ifSI} still dutch only).
+
+\getvalue{\v!unit} [Sec] {s} {\labeltext{u:sec}}
+\getvalue{\v!unit} [fSec] {\Femto \Sec} {\labeltext{u:fsec}}
+\getvalue{\v!unit} [pSec] {\Pico \Sec} {\labeltext{u:psec}}
+\getvalue{\v!unit} [nSec] {\Nano \Sec} {\labeltext{u:nsec}}
+\getvalue{\v!unit} [uSec] {\Micro \Sec} {\labeltext{u:usec}}
+\getvalue{\v!unit} [mSec] {\Milli \Sec} {\labeltext{u:msec}}
+\getvalue{\v!unit} [Year] {\ifSIunits a \else j\fi} {\labeltext{u:year}}
+\getvalue{\v!unit} [Month] {m} {\labeltext{u:month}}
+\getvalue{\v!unit} [Week] {w} {\labeltext{u:week}}
+\getvalue{\v!unit} [Day] {d} {\labeltext{u:day}}
+\getvalue{\v!unit} [Hour] {\ifSIunits h \else u\fi} {\labeltext{u:hour}}
+\getvalue{\v!unit} [Min] {min} {\labeltext{u:min}}
+
+\setuplabeltext
+ [\s!nl]
+ [u:sec=seconde,
+ u:psec=picoseconde,
+ u:fsec=femtoseconde,
+ u:nsec=nanoseconde,
+ u:usec=microseconde,
+ u:msec=milliseconde,
+ u:year=jaar,
+ u:month=maand,
+ u:week=week,
+ u:day=dag,
+ u:hour=uur,
+ u:min=minuten]
+
+\setuplabeltext
+ [\s!en]
+ [u:sec=second,
+ u:fsec=femtosecond,
+ u:psec=picosecond,
+ u:nsec=nanosecond,
+ u:usec=microsecond,
+ u:msec=millisecond,
+ u:year=year,
+ u:month=month,
+ u:week=week,
+ u:day=day,
+ u:hour=hour,
+ u:min=minutes]
+
+\setuplabeltext
+ [\s!de]
+ [u:sec=Sekunde,
+ u:fsec=Femtosekunde,
+ u:psec=Picosekunde,
+ u:nsec=Nanosekunde,
+ u:usec=Microsekunde,
+ u:msec=Millisekunde,
+ u:year=Jahr,
+ u:month=Monat,
+ u:week=Woche,
+ u:day=Tag,
+ u:hour=Stunde,
+ u:min=Minuten]
+
+\setuplabeltext
+ [\s!hr]
+ [u:sec=sekunda,
+ u:fsec=femtosekunda,
+ u:psec=pikosekunda,
+ u:nsec=nanosekunda,
+ u:usec=mikrosekunda,
+ u:msec=milisekunda,
+ u:year=godina,
+ u:month=mjesec,
+ u:week=tjedan,
+ u:day=dan,
+ u:hour=sat,
+ u:min=minuta]
+
+\setuplabeltext
+ [\s!it]
+ [u:sec=secondo,
+ u:fsec=femtosecondo,
+ u:psec=picosecondo,
+ u:nsec=nanosecondo,
+ u:usec=microsecondo,
+ u:msec=millisecondo,
+ u:year=anno,
+ u:month=mese,
+ u:week=settimana,
+ u:day=giorno,
+ u:hour=ora,
+ u:min=minuti]
+
+%D Then we define some angles.
+
+\getvalue{\v!unit} [Rad] {rad} {\labeltext{u:rad}}
+\getvalue{\v!unit} [Deg] {{\mathematics{\normalsuperscript\circ}}} {\labeltext{u:deg}}
+
+\setuplabeltext
+ [\s!nl]
+ [u:rad=hoek radialen,
+ u:deg=hoek graden]
+
+\setuplabeltext
+ [\s!en]
+ [u:rad=angle radians,
+ u:deg=angle degrees]
+
+\setuplabeltext
+ [\s!de]
+ [u:rad=Bogenma\SS,
+ u:deg=Gradma\SS]
+
+\setuplabeltext
+ [\s!hr]
+ [u:rad=radijani,
+ u:deg=kutni stupnjevi]
+
+\setuplabeltext
+ [\s!it]
+ [u:rad=radianti,
+ u:deg=angoli sessagesimali]
+
+%D Rotation and frequency related units are defined by:
+
+\getvalue{\v!unit} [Hertz] {Hz} {Hertz}
+\getvalue{\v!unit} [kHertz] {\Kilo \Hertz} {kilo Hertz}
+\getvalue{\v!unit} [MHertz] {\Mega \Hertz} {mega Hertz}
+\getvalue{\v!unit} [GHertz] {\Giga \Hertz} {giga Hertz}
+\getvalue{\v!unit} [THertz] {\Tera \Hertz} {tera Hertz}
+\getvalue{\v!unit} [mHertz] {\Milli \Hertz} {milli Hertz}
+
+\getvalue{\v!unit} [RevPerSec] {RPS} {\labeltext{u:rps}}
+\getvalue{\v!unit} [RevPerMin] {RPM} {\labeltext{u:rpm}}
+
+\setuplabeltext
+ [\s!nl]
+ [u:rps=omwentelingen per seconde,
+ u:rpm=omwentelingen per minuut]
+
+\setuplabeltext
+ [\s!en]
+ [u:rps=revolutions per second,
+ u:rpm=revolutions per minute]
+
+\setuplabeltext
+ [\s!de]
+ [u:rps=Umdrehungen pro Sekunde,
+ u:rpm=Umdrehungen pro Minute]
+
+\setuplabeltext
+ [\s!hr]
+ [u:rps=okretaji po sekundi,
+ u:rpm=okretaji po minuti]
+
+\setuplabeltext
+ [\s!it]
+ [u:rps=giri al secondo,
+ u:rpm=giri al minuto]
+
+%D Mass and force:
+
+\getvalue{\v!unit} [Gram] {g} {gram}
+\getvalue{\v!unit} [uGram] {\Micro \Gram} {microgram}
+\getvalue{\v!unit} [mGram] {\Milli \Gram} {milligram}
+\getvalue{\v!unit} [kGram] {\Kilo \Gram} {kilogram}
+\getvalue{\v!unit} [Atom] {u} {\labeltext{u:u}}
+
+\getvalue{\v!unit} [Newton] {N} {Newton}
+\getvalue{\v!unit} [kNewton] {\Kilo \Newton} {kilo Newton}
+
+\getvalue{\v!unit} [Pascal] {Pa} {Pascal}
+\getvalue{\v!unit} [mPascal] {\Milli \Pascal} {milli Pascal}
+\getvalue{\v!unit} [kPascal] {\Kilo \Pascal} {kilo Pascal}
+
+\setuplabeltext
+ [\s!nl]
+ [u:u=atomaire massa eenheid]
+
+\setuplabeltext
+ [\s!en]
+ [u:u=atom mass unit]
+
+\setuplabeltext
+ [\s!de]
+ [u:u=Atomare Masseneinheit]
+
+\setuplabeltext
+ [\s!hr]
+ [u:u=unificirana atomska jedinica mase]
+
+\setuplabeltext
+ [\s!it]
+ [u:u=unit\`a di massa atomica]
+
+%D Energy units comes in two alternatives:
+
+\getvalue{\v!unit} [Joule] {J} {Joule}
+\getvalue{\v!unit} [mJoule] {\Milli \Joule} {milli Joule}
+\getvalue{\v!unit} [kJoule] {\Kilo \Joule} {kilo Joule}
+\getvalue{\v!unit} [MJoule] {\Mega \Joule} {mega Joule}
+\getvalue{\v!unit} [GJoule] {\Giga \Joule} {giga Joule}
+
+\getvalue{\v!unit} [Watt] {W} {Watt}
+\getvalue{\v!unit} [mWatt] {\Milli \Watt} {milli Watt}
+\getvalue{\v!unit} [kWatt] {\Kilo \Watt} {kilo Watt}
+\getvalue{\v!unit} [MWatt] {\Mega \Watt} {mega Watt}
+\getvalue{\v!unit} [GWatt] {\Giga \Watt} {giga Watt}
+\getvalue{\v!unit} [TWatt] {\Tera \Watt} {tera Watt}
+
+%D Although Celsius is no longer permitted, we define it by
+%D saying:
+
+\getvalue{\v!unit} [Celsius] {C} {Celsius}
+\getvalue{\v!unit} [Kelvin] {K} {Kelvin}
+\getvalue{\v!unit} [Fahrenheit] {F} {Fahrenheit}
+
+%D Some chemic related units are:
+
+\getvalue{\v!unit} [Mol] {mol} {mol}
+\getvalue{\v!unit} [mMol] {\Milli \Mol} {millimol}
+\getvalue{\v!unit} [kMol] {\Kilo \Mol} {kilomol}
+\getvalue{\v!unit} [Molair] {M} {molair (\Mol \Per \Liter)}
+\getvalue{\v!unit} [Equivalent] {eq} {equivalent}
+\getvalue{\v!unit} [mEquivalent] {\Milli \Equivalent} {milli equivalent}
+
+%D There are quite a lot units related to electricity and
+%D magnetism:
+
+\getvalue{\v!unit} [Farad] {F} {Farad}
+\getvalue{\v!unit} [pFarad] {\Pico \Farad} {pico Farad}
+\getvalue{\v!unit} [nFarad] {\Nano \Farad} {nano Farad}
+\getvalue{\v!unit} [uFarad] {\Micro \Farad} {micro Farad}
+\getvalue{\v!unit} [mFarad] {\Milli \Farad} {milli Farad}
+
+\getvalue{\v!unit} [Ohm] {\Omega} {Ohm}
+\getvalue{\v!unit} [kOhm] {\Kilo \Ohm} {kilo Ohm}
+
+\getvalue{\v!unit} [Siemens] {S} {Siemens}
+
+\getvalue{\v!unit} [Ampere] {A} {Amp\`ere}
+\getvalue{\v!unit} [mAmpere] {\Milli \Ampere} {milli Amp\`ere}
+
+\getvalue{\v!unit} [Coulomb] {C} {Coulomb}
+
+\getvalue{\v!unit} [Volt] {V} {Volt}
+\getvalue{\v!unit} [mVolt] {\Milli \Volt} {milli Volt}
+\getvalue{\v!unit} [kVolt] {\Kilo \Volt} {kilo Volt}
+\getvalue{\v!unit} [eVolt] {eV} {electronvolt}
+\getvalue{\v!unit} [keVolt] {\Kilo \eVolt} {kilo electronvolt}
+\getvalue{\v!unit} [MeVolt] {\Mega \eVolt} {mega electronvolt}
+
+\getvalue{\v!unit} [Tesla] {T} {Tesla}
+
+\getvalue{\v!unit} [VoltAC] {V\normalsubscript{\xbox{ac}}} {\labeltext{u:vac}}
+\getvalue{\v!unit} [VoltDC] {V\normalsubscript{\xbox{dc}}} {\labeltext{u:vdc}}
+
+\setuplabeltext
+ [\s!nl]
+ [u:vac=wisselspanning,
+ u:vdc=gelijkspanning]
+
+\setuplabeltext
+ [\s!en]
+ [u:vac=alternating current,
+ u:vdc=direct current]
+
+\setuplabeltext
+ [\s!de]
+ [u:vac=Wechselspannung,
+ u:vdc=Gleichspannung]
+
+\setuplabeltext
+ [\s!hr]
+ [u:vac=izmjeni\ccaron ni napon,
+ u:vdc=istosmjerni napon]
+
+\setuplabeltext
+ [\s!it]
+ [u:vac=corrente alternata,
+ u:vdc=corrente continua]
+
+%D Network bandwidth is specified in Bits:
+
+\getvalue{\v!unit} [Bit] {bit} {\labeltext{u:bit}}
+\getvalue{\v!unit} [Baud] {Bd} {Baud (Bit/s)}
+
+%D Computer memory size is specified in Bytes:
+
+\getvalue{\v!unit} [Byte] {B} {\labeltext{u:byte}}
+\getvalue{\v!unit} [kByte] {\Kilo \Byte} {kilo Byte}
+\getvalue{\v!unit} [MByte] {\Mega \Byte} {mega Byte}
+\getvalue{\v!unit} [GByte] {\Giga \Byte} {giga Byte}
+\getvalue{\v!unit} [TByte] {\Tera \Byte} {tera Byte}
+
+\setuplabeltext
+ [\s!en]
+ [u:bit=Bit,
+ u:byte=Byte]
+
+\setuplabeltext
+ [\s!hr]
+ [u:bit=bit,
+ u:byte=bajt]
+
+%D Telecommunication call density is specified in Erlangs:
+
+\getvalue{\v!unit} [Erlang] {E} {Erlang}
+
+%D Some radiation related units:
+
+\getvalue{\v!unit} [Bequerel] {Bq} {Bequerel}
+\getvalue{\v!unit} [MBequerel] {\Mega \Bequerel} {Bequerel}
+\getvalue{\v!unit} [Sievert] {Sv} {Sievert}
+\getvalue{\v!unit} [mSievert] {\Milli \Sievert} {milli Sievert}
+
+%D Light:
+
+\getvalue{\v!unit} [Candela] {cd} {Candela}
+
+%D and some sound ones:
+
+\getvalue{\v!unit} [Bell] {B} {Bell}
+\getvalue{\v!unit} [dBell] {\Deci \Bell} {decibel}
+
+%D We also define some non||regular, sometimes even forbidden,
+%D units:
+
+\getvalue{\v!unit} [At] {at} {\labeltext{u:at}}
+\getvalue{\v!unit} [Atm] {atm} {\labeltext{u:atm}}
+\getvalue{\v!unit} [Bar] {bar} {bar (100 \Kilo \Pascal)}
+\getvalue{\v!unit} [EVolt] {eV} {electronvolt}
+\getvalue{\v!unit} [Foot] {ft} {\labeltext{u:ft}}
+\getvalue{\v!unit} [Inch] {inch} {\labeltext{u:inch}}
+\getvalue{\v!unit} [Cal] {cal} {\labeltext{u:cal}}
+\getvalue{\v!unit} [Force] {f} {\labeltext{u:f}}
+\getvalue{\v!unit} [kCal] {\Kilo \Cal} {\labeltext{u:kcal}}
+\getvalue{\v!unit} [Lux] {lux} {lux}
+
+
+\def\xPercent {\dimensionaddfix{\percent }}
+\def\xPromille{\dimensionaddfix{\promille}}
+
+\getvalue{\v!unit} [Percent] {\xPercent } {percent}
+\getvalue{\v!unit} [Permille] {\xPromille} {promille}
+\getvalue{\v!unit} [Promille] {\xPromille} {promille}
+
+%D Some more, thanks to Tobias:
+
+\getvalue{\v!unit} [Gray] {Gr} {Gray}
+\getvalue{\v!unit} [Weber] {Wb} {Weber}
+\getvalue{\v!unit} [Henry] {H} {Henry}
+\getvalue{\v!unit} [Sterant] {sr} {Sterant}
+\getvalue{\v!unit} [Angstrom] {\hbox{\Aring}} {\Aring ngstr\"om}
+\getvalue{\v!unit} [Gauss] {G} {Gauss}
+
+\setuplabeltext
+ [\s!nl]
+ [u:at=technische atmosfeer,
+ u:atm=fysische atmosfeer,
+ u:ft=voet,
+ u:cal=calorie,
+ u:f=kracht (force),
+ u:kcal=kilocalorie]
+
+\setuplabeltext
+ [\s!en]
+ [u:at=technical atmospheric pressure,
+ u:atm=physical atmospheric pressure,
+ u:ft=foot,
+ u:inch=inch,
+ u:cal=calory,
+ u:f=force,
+ u:kcal=kilocalory]
+
+\setuplabeltext
+ [\s!de]
+ [u:at=Technischer atmosph\"arischer Druck,
+ u:atm=physkalischer atmosph\"arischer Druck,
+ u:ft=Fu\SS,
+ u:cal=Kalorien,
+ u:f=Force,
+ u:kcal=Kilokalorien]
+
+\setuplabeltext
+ [\s!hr]
+ [u:at=tehni\ccaron ka atmosfera,
+ u:atm=standardna atmosfera,
+ u:ft=stopa,
+ u:inch=in\ccaron a,
+ u:cal=kalorija,
+ u:f=Force,
+ u:kcal=Kilokalorien]
+
+\setuplabeltext
+ [\s!it]
+ [u:at=pressione atmosferica tecnica,
+ u:atm=pressione atmosfera fisica,
+ u:ft=piede,
+ u:cal=caloria,
+ u:f=forza,
+ u:kcal=chilocaloria]
+
+%D Here are some old ones, still there for compatibility
+%D reasons. These will probably be obsolete in a few years.
+
+\def\MeterTwee {\Square \Meter}
+\def\mMeterTwee {\Square \Milli \Meter}
+\def\cMeterTwee {\Square \Centi \Meter}
+\def\dMeterTwee {\Square \Deci \Meter}
+\def\kMeterTwee {\Square \Kilo \Meter}
+
+\def\MeterDrie {\Cubic \Meter}
+\def\mMeterDrie {\Cubic \Milli \Meter}
+\def\cMeterDrie {\Kubic \Centi \Meter}
+\def\dMeterDrie {\Cubic \Deci \Meter}
+\def\kMeterDrie {\Cubic \Kilo \Meter}
+
+\def\LiterTwee {\Square \Liter}
+\def\SecTwee {\Square \Sec}
+\def\SecMinEen {\Inverse \Sec}
+
+%D To make ourselves happy, we define some dutch specific
+%D units:
+
+\startinterface dutch
+
+ \getvalue{\v!unit} [PaardenKracht] {pk} {paardenkracht}
+ \getvalue{\v!unit} [Duits] {D} {duits}
+ \getvalue{\v!unit} [Kwik] {Hg} {kwikkolom}
+ \getvalue{\v!unit} [Hectare] {ha} {hectare}
+ \getvalue{\v!unit} [kGramForce] {\Kilo \Gram \Force} {kilogramforce}
+ \getvalue{\v!unit} [kWattUur] {\Kilo \Watt \Uur} {kilowattuur}
+ \getvalue{\v!unit} [MeterKwik] {\Meter \Kwik} {meter kwikkolom}
+ \getvalue{\v!unit} [Waterkolom] {WK} {waterkolom}
+ \getvalue{\v!unit} [MeterWater] {\Meter \Waterkolom} {meter waterkolom}
+ \getvalue{\v!unit} [DrogeStof] {ds} {droge stof}
+ \getvalue{\v!unit} [Normaal] {N} {normaal}
+
+ \getvalue{\v!unit} [Ton] {t} {ton}
+ \getvalue{\v!unit} [kTon] {\Kilo \Ton} {kiloton}
+
+ \let \OmwPerSec \RevPerSec
+ \let \OmwPerMin \RevPerMin
+ \let \Graden \Deg
+ \let \PaardeKracht \PaardenKracht
+ \let \Atoom \Atom
+ \let \Heure \Hour
+ \let \Jaar \Year
+ \let \Maand \Month
+ \let \Dag \Day
+ \let \Uur \Hour
+
+\stopinterface
+
+%D Finally we define some equivalents. By using \type {\let}
+%D we can be sure that they don't end up double in the lists of
+%D units.
+
+\let \Second \Sec
+\let \Kubic \Cubic
+\let \IKubic \ICubic
+
+%D Option:
+
+% \def\Micro{\dimensionprefix{\iftextdimensions\mathematics\mu \else\mu \fi}}
+% \def\Times{\dimensionnopfix{\iftextdimensions\mathematics\cdot\else\cdot\fi}}
+
+\protect \endinput
diff --git a/tex/context/base/math-ali.mkiv b/tex/context/base/math-ali.mkiv
index d7979a1c3..cc4986520 100644
--- a/tex/context/base/math-ali.mkiv
+++ b/tex/context/base/math-ali.mkiv
@@ -1038,11 +1038,11 @@
\unexpanded\def\overset#1#2%
{\preparebinrel{#2}%
- \currentbinrel{\mathop{\kern\zeropoint#2}\limits^{#1}}}
+ \currentbinrel{\mathop{\kern\zeropoint#2}\limits\normalsuperscript{#1}}}
\unexpanded\def\underset#1#2%
{\preparebinrel{#2}%
- \currentbinrel{\mathop{\kern\zeropoint#2}\limits_{#1}}}
+ \currentbinrel{\mathop{\kern\zeropoint#2}\limits\normalsubscript{#1}}}
%D The following code comes from \type {math-str.mkiv}.
diff --git a/tex/context/base/math-arr.mkiv b/tex/context/base/math-arr.mkiv
index 389112b16..31f8a66eb 100644
--- a/tex/context/base/math-arr.mkiv
+++ b/tex/context/base/math-arr.mkiv
@@ -52,15 +52,15 @@
\endgroup}
\def\mthfrac#1#2#3#4#5{\mathchoice
- {\domthfrac\displaystyle \textface {#1}{#2}{#3}{#4}{#5}}
- {\domthfrac\textstyle \textface {#1}{#2}{#3}{#4}{#5}}
- {\domthfrac\scriptstyle \scriptface {#1}{#2}{#3}{#4}{#5}}
+ {\domthfrac\displaystyle \textface {#1}{#2}{#3}{#4}{#5}}%
+ {\domthfrac\textstyle \textface {#1}{#2}{#3}{#4}{#5}}%
+ {\domthfrac\scriptstyle \scriptface {#1}{#2}{#3}{#4}{#5}}%
{\domthfrac\scriptscriptstyle\scriptscriptface{#1}{#2}{#3}{#4}{#5}}}
\def\mthsqrt#1#2#3{\mathchoice
- {\domthsqrt\displaystyle \textface {#1}{#2}{#3}}
- {\domthsqrt\textstyle \textface {#1}{#2}{#3}}
- {\domthsqrt\scriptstyle \textface {#1}{#2}{#3}}
+ {\domthsqrt\displaystyle \textface {#1}{#2}{#3}}%
+ {\domthsqrt\textstyle \textface {#1}{#2}{#3}}%
+ {\domthsqrt\scriptstyle \textface {#1}{#2}{#3}}%
{\domthsqrt\scriptscriptstyle\textface {#1}{#2}{#3}}}
% temp here
@@ -114,7 +114,7 @@
$}%
\ifdim\wd2>\dimen0 \dimen0\wd2 \fi
\setbox4\hbox to \dimen0{#3\displaystyle}%
- \mathrel{\mathop{\hbox to \dimen0{\hss\copy4\hss}}\limits^{\box0}_{\box2}}
+ \mathrel{\mathop{\hbox to \dimen0{\hss\copy4\hss}}\limits\normalsuperscript{\box0}\normalsubscript{\box2}}%
\endgroup}
\let\domthxarrsingle\domthxarr
diff --git a/tex/context/base/math-ini.mkiv b/tex/context/base/math-ini.mkiv
index af3334d16..8a5b80a74 100644
--- a/tex/context/base/math-ini.mkiv
+++ b/tex/context/base/math-ini.mkiv
@@ -29,11 +29,6 @@
\ifx\v!compact\undefined \def\v!compact{compact} \fi
-%D New:
-
-\let\startimath\Ustartmath \let\stopimath \Ustopmath
-\let\startdmath\Ustartdisplaymath \let\stopdmath \Ustopmath
-
%D We move these definitions into the format:
% test [[\char948 \ctxlua{tex.sprint(utf.char(948))}]]
@@ -360,52 +355,48 @@
\def\nonknuthmode{\the\everynonknuthmode\let\nonknuthmode\relax}
\def\donknuthmode{\the\everydonknuthmode}
-\ifdefined\normalsuber\else \def\normalsuber{_} \fi
-\ifdefined\normalsuper\else \def\normalsuper{^} \fi
-\ifdefined\normalaltab\else \def\normalaltab{&} \fi
-
\bgroup
- \catcode`_=\activecatcode
- \catcode`^=\activecatcode
- \catcode`&=\activecatcode
+ \catcode`\_=\activecatcode
+ \catcode`\^=\activecatcode
+ \catcode`\&=\activecatcode
\global \everynonknuthmode {\appendtoks
- \let_\normalsuber
- \let^\normalsuper
- \let&\normalaltab
+ \let_\normalsubscript
+ \let^\normalsuperscript
+ \let&\normalmathaligntab
\to \everymathematics}
\egroup
\appendtoks
- \mathcode`_="8000
- \mathcode`^="8000
- \mathcode`&="8000
- \catcode`_=\othercatcode
- \catcode`^=\othercatcode
- \catcode`&=\othercatcode
+ \mathcode`\_="8000
+ \mathcode`\^="8000
+ \mathcode`\&="8000
+ \catcode`\_=\othercatcode
+ \catcode`\^=\othercatcode
+ \catcode`\&=\othercatcode
\to \everynonknuthmode
\appendtoks
- \catcode`_=\subscriptcatcode
- \catcode`^=\superscriptcatcode
- \catcode`&=\alignmentcatcode
+ \catcode`\_=\subscriptcatcode
+ \catcode`\^=\superscriptcatcode
+ \catcode`\&=\alignmentcatcode
\to \everydonknuthmode
\appendtoks
\startextendcatcodetable\ctxcatcodes
- \catcode`_=\othercatcode
- \catcode`^=\othercatcode
- \catcode`&=\othercatcode
+ \catcode`\_=\othercatcode
+ \catcode`\^=\othercatcode
+ \catcode`\&=\othercatcode
\stopextendcatcodetable
\to \everynonknuthmode
\appendtoks
\startextendcatcodetable\ctxcatcodes
- \catcode`_=\subscriptcatcode
- \catcode`^=\superscriptcatcode
- \catcode`&=\alignmentcatcode
+ \catcode`\_=\subscriptcatcode
+ \catcode`\^=\superscriptcatcode
+ \catcode`\&=\alignmentcatcode
\stopextendcatcodetable
\to \everydonknuthmode
diff --git a/tex/context/base/math-lbr.mkii b/tex/context/base/math-lbr.mkii
index cf69eec1f..048559700 100644
--- a/tex/context/base/math-lbr.mkii
+++ b/tex/context/base/math-lbr.mkii
@@ -377,7 +377,7 @@
% we define the whole lot, although only a few differ (esp dot)
% \startmathcollection[lbr]
-%
+%
% \definemathsymbol [acute] [accent] [tf] ["13] % mr -> tf
% \definemathsymbol [grave] [accent] [tf] ["12] % mr -> tf
% \definemathsymbol [ddot] [accent] [tf] ["7F] % mr -> tf
@@ -390,7 +390,7 @@
% \definemathsymbol [dot] [accent] [tf] ["05] % mr -> tf, 5F -> 05
% \definemathsymbol [widetilde] [accent] [ex] ["65] % [ord]
% \definemathsymbol [widehat] [accent] [ex] ["62] % [ord]
-%
+%
% \stopmathcollection
\startmathcollection[lbr:texnansi]
@@ -444,19 +444,19 @@
\stoprawmathcollection
-\def\LBRbig {\@@dobig{8.20}}
-\def\LBRBig {\@@dobig{10.80}}
-\def\LBRbigg {\@@dobig{13.42}}
-\def\LBRBigg {\@@dobig{16.03}}
-\def\LBRbiggg{\@@dobig{17.72}}
-\def\LBRBiggg{\@@dobig{21.25}}
-
-% \def\LBRbig {\@@dobig{0.820}}
-% \def\LBRBig {\@@dobig{1.080}}
-% \def\LBRbigg {\@@dobig{1.342}}
-% \def\LBRBigg {\@@dobig{1.603}}
-% \def\LBRbiggg{\@@dobig{1.772}}
-% \def\LBRBiggg{\@@dobig{2.125}}
+% \def\LBRbig {\@@dobig{8.20}}
+% \def\LBRBig {\@@dobig{10.80}}
+% \def\LBRbigg {\@@dobig{13.42}}
+% \def\LBRBigg {\@@dobig{16.03}}
+% \def\LBRbiggg{\@@dobig{17.72}}
+% \def\LBRBiggg{\@@dobig{21.25}}
+
+\def\LBRbig {\@@dobig{0.820}}
+\def\LBRBig {\@@dobig{1.080}}
+\def\LBRbigg {\@@dobig{1.342}}
+\def\LBRBigg {\@@dobig{1.603}}
+\def\LBRbiggg{\@@dobig{1.772}}
+\def\LBRBiggg{\@@dobig{2.125}}
\startrawmathcollection[lbr]
diff --git a/tex/context/base/math-pln.mkiv b/tex/context/base/math-pln.mkiv
index 6cabb185b..a0fd5ad51 100644
--- a/tex/context/base/math-pln.mkiv
+++ b/tex/context/base/math-pln.mkiv
@@ -59,8 +59,8 @@
\cleaders\hbox{$\mkern-2mu\smash-\mkern-2mu$}\hfill
\mkern-7mu\smash-$}
-\let\sp=^ % will become obsolete
-\let\sb=_ % will become obsolete
+% \let\sp=^ % obsolete
+% \let\sb=_ % obsolete
\ifx\,\undefined \def\,{\mskip \thinmuskip } \fi
\ifx\>\undefined \def\>{\mskip \medmuskip } \fi
diff --git a/tex/context/base/math-scr.mkiv b/tex/context/base/math-scr.mkiv
index caedd5722..adf0320de 100644
--- a/tex/context/base/math-scr.mkiv
+++ b/tex/context/base/math-scr.mkiv
@@ -25,9 +25,6 @@
%D
%D The grid snapping has been removed.
-\global\let\normalsuper=^
-\global\let\normalsuber=_
-
\ifdefined\supersubmode \else \newcount\supersubmode \fi
\ifdefined\newevery \else \everysupersub \EverySuperSub \fi
@@ -37,10 +34,10 @@
[\c!size=\v!normal]
\def\normalsupsub#1#2%
- {^{\the\everysupersub#1}_{\the\everysupersub#2}}
+ {\normalsuperscript{\the\everysupersub#1}\normalsubscript{\the\everysupersub#2}}
-\def\super#1{^{\the\everysupersub#1}}
-\def\suber#1{_{\the\everysupersub#1}}
+\def\super#1{\normalsuperscript{\the\everysupersub#1}}
+\def\suber#1{\normalsubscript {\the\everysupersub#1}}
\def\supsub#1#2{\super{#1}\suber{#2}}
\def\subsup#1#2{\suber{#1}\super{#2}}
@@ -50,14 +47,16 @@
%D We can let \type {^} and \type {_} act like \type {\super}
%D and \type {\sub} by saying \type {\enablesupersub}.
+% the next macro will become obsolete in mkiv
+
\bgroup
\catcode`\^=\activecatcode
\catcode`\_=\activecatcode
\gdef\enablesupersub
{\catcode`\^=\activecatcode
- \def^{\ifmmode\expandafter\super\else\expandafter\normalsuper\fi}%
+ \def^{\ifmmode\expandafter\super\else\expandafter\normalsuperscript\fi}%
\catcode`\_=\activecatcode
- \def_{\ifmmode\expandafter\suber\else\expandafter\normalsuber\fi}}
+ \def_{\ifmmode\expandafter\suber\else\expandafter\normalsubscript \fi}}
\egroup
%D \macros
diff --git a/tex/context/base/ppchtex.mkiv b/tex/context/base/ppchtex.mkiv
index 5a038e9a3..e6c1f2495 100644
--- a/tex/context/base/ppchtex.mkiv
+++ b/tex/context/base/ppchtex.mkiv
@@ -1098,7 +1098,7 @@
\dosetsubscripts
\setbox2=\hbox{\@@dochemicalcolor
$\@@dochemicalstyle{\@@localchemicalformat \chemicaltext}$}%
- \setbox4=\hbox{$\@@dochemicalstyle{\@@localchemicalformat C_2^2}$}%
+ \setbox4=\hbox{$\@@dochemicalstyle{\@@localchemicalformat C\normalsubscript2\normapsuperscript2}$}%
\setbox6=\hbox{$\@@dochemicalstyle{\@@localchemicalformat O}$}% or C
\doresetsubscripts
\doifnot\@@chemicallocation\v!intext
@@ -2008,7 +2008,7 @@
{\@@dochemicalcolor
$\@@dochemicalstyle{\scriptscriptstyle\hskip-.15em#2}$}%
\wd0=0pt
- \big#1_{\hskip.1em\box0}%
+ \big#1\normapsubscript{\hskip.1em\box0}%
\egroup}
\def\disablechemicalspecials%
@@ -2206,13 +2206,11 @@
\doresetsubscripts}%
\mathop{\box0}%
\ifthirdargument
- \doifnot{#2}{}
- {^{\@@dochemicalstyle{\strut#2}}}%
- \doifnot{#3}{}
- {_{\@@dochemicalstyle{\strut#3}}}%
+ \doifnot{#2}{}{\normapsuperscript{\@@dochemicalstyle{\strut#2}}}%
+ \doifnot{#3}{}{\normapsubscript {\@@dochemicalstyle{\strut#3}}}%
\else
\doifnot{#2}{}
- {_{\@@dochemicalstyle{\strut#2}}}%
+ {\normapsubscript{\@@dochemicalstyle{\strut#2}}}%
\fi
\egroup
\chemicalspace}
diff --git a/tex/context/base/supp-mat.mkiv b/tex/context/base/supp-mat.mkiv
index 8549aaa36..4356b6e4e 100644
--- a/tex/context/base/supp-mat.mkiv
+++ b/tex/context/base/supp-mat.mkiv
@@ -46,9 +46,24 @@
%D
%D Which is implemented as:
-\long\def\mathematics#1{\relax \ifmmode#1\else\Ustartmath #1\Ustopmath \fi}
-\long\def\displaymath#1{\noindent \ifmmode#1\else\Ustartdisplaymath#1\Ustopdisplaymath\fi}
-\long\def\inlinemath #1{\dontleavehmode\ifmmode#1\else\Ustartmath #1\Ustopmath \fi}
+\let\normalsuperscript \Usuperscript
+\let\normalsubscript \Usubscript
+\let\normalstartimath \Ustartmath
+\let\normalstopimath \Ustopmath
+\let\normalstartdmath \Ustartdisplaymath
+\let\normalstopdmath \Ustopmath
+\let\normalmathaligntab\aligntab
+
+\let\normalsuper \Usuperscript % obsolete
+\let\normalsuber \Usubscript % obsolete
+\let\startimath \Ustartmath % obsolete, less safe
+\let\stopimath \Ustopmath % obsolete, less safe
+\let\startdmath \Ustartdisplaymath % obsolete, less safe
+\let\stopdmath \Ustopmath % obsolete, less safe
+
+\long\def\mathematics#1{\relax \ifmmode#1\else\normalstartimath#1\normalstopimath\fi}
+\long\def\displaymath#1{\noindent \ifmmode#1\else\normalstartdmath#1\normalstopdmath\fi}
+\long\def\inlinemath #1{\dontleavehmode\ifmmode#1\else\normalstartimath#1\normalstopimath\fi}
\let\m\mathematics % unexpanded?
@@ -58,14 +73,14 @@
{\relax\ifmmode
\let\stopmathmode\relax
\else
- \Ustartmath\let\stopmathmode\Ustopmath
+ \normalstartimath\let\stopmathmode\normalstopimath
\fi}
\unexpanded\def\startmathmode % nested variant
{\relax\ifmmode
\begingroup\let\stopmathmode\endgroup
\else
- \Ustartmath\let\stopmathmode\Ustopmath
+ \normalstartimath\let\stopmathmode\normalstopimath
\fi}
\def\nomathematics#1%
@@ -137,26 +152,17 @@
%D normally provided, and therefore provide \type {\super}
%D and \type{\suber} (\type {\sub} is already taken).
-\global\let\normalsuper=^
-\global\let\normalsuber=_
+\global\let\normalsuper=\normalsuperscript % will become obsolete
+\global\let\normalsuber=\normalsubscript % will become obsolete
\newcount\supersubmode
\newevery\everysupersub \EverySuperSub
-\appendtoks \advance\supersubmode 1\relax \to \everysupersub
+\appendtoks \advance\supersubmode\plusone \to \everysupersub
-% \def\dodosuper#1{\normalsuper{\the\everysupersub#1}}
-% \def\dodosuber#1{\normalsuber{\the\everysupersub#1}}
-%
-% \def\dosuper{\ifx\next\bgroup\expandafter\dodosuper\else\normalsuper\fi}
-% \def\dosuber{\ifx\next\bgroup\expandafter\dodosuber\else\normalsuber\fi}
-%
-% \def\super{\futurelet\next\dosuper}
-% \def\suber{\futurelet\next\dosuber}
-
-\def\super#1{\normalsuper{\the\everysupersub#1}}
-\def\suber#1{\normalsuber{\the\everysupersub#1}}
+\def\super#1{\normalsuperscript{\the\everysupersub#1}}
+\def\suber#1{\normalsubscript {\the\everysupersub#1}}
%D \macros
%D {enablesupsub}
@@ -238,7 +244,7 @@
{\begingroup % added HH, made even more cramped
\setbox\scratchbox\hbox
{\nulldelimiterspace\zeropoint
- \Ustartmath\mathsurround\zeropoint#1\radical\zerocount{#2}\Ustopmath}%
+ \normalstartimath\mathsurround\zeropoint#1\radical\zerocount{#2}\normalstopimath}%
\ht\scratchbox-\dimexpr
\ifx#1\displaystyle
\fontdimen8\textfont3
diff --git a/tex/context/base/supp-num.mkiv b/tex/context/base/supp-num.mkiv
index 3b629b7d4..8dd763b78 100644
--- a/tex/context/base/supp-num.mkiv
+++ b/tex/context/base/supp-num.mkiv
@@ -153,7 +153,7 @@
\long\def\collectdigit#1%
{\ifx#1~%
\savedigit\collecteddigits @%
- \else\if#1_%
+ \else\if#1_% tricky as can be several catcodes ... will become lua code anyway
\savedigit\collecteddigits @%
\else\if\noexpand#1\relax
\let\grabdigit\handledigits
diff --git a/tex/context/base/x-mathml.mkiv b/tex/context/base/x-mathml.mkiv
index e5da5f832..50092ef94 100644
--- a/tex/context/base/x-mathml.mkiv
+++ b/tex/context/base/x-mathml.mkiv
@@ -548,7 +548,7 @@
\doifelse \MMLbasesymbol \v!no {
\MMLcCNbasedata{\xmlflush{#1}}
} {
- \MMLcCNbasedata{\xmlflush{#1}}_{
+ \MMLcCNbasedata{\xmlflush{#1}}\normalsubscript{
\hbox {$
\mr
\scriptscriptstyle
@@ -583,7 +583,7 @@
\stopxmlsetups
\startxmlsetups mml:cn:polar:b
- {\mr e}^{\xmlsnippet{#1}{1}+\xmlsnippet{#1}{3}\thinspace{\mr i}}
+ {\mr e}\normalsuperscript{\xmlsnippet{#1}{1}+\xmlsnippet{#1}{3}\thinspace{\mr i}}
\stopxmlsetups
\startxmlsetups mml:cn:polar:c
@@ -617,7 +617,7 @@
\else
\first
\doifelse \MMLfloatsymbol {dot} \cdot \times
- 10^{\last}
+ 10\normalsuperscript{\last}
\fi \fi
}
\stopxmlsetups
@@ -634,7 +634,7 @@
} {
\xmlsnippet{#1}{1}
\doifelse \MMLenotationsymbol {dot} \cdot
- \times10^{\xmlsnippet{#1}{3}}
+ \times10\normalsuperscript{\xmlsnippet{#1}{3}}
}
\stopxmlsetups
@@ -842,7 +842,7 @@
\startxmlsetups mml:minmax
\xmldoif {#1} {/mml:bvar} {
- {}_{\xmlfirst{#1}{/mml:bvar}}
+ {}\normalsubscript{\xmlfirst{#1}{/mml:bvar}}
}
\left\{
\xmlconcat{#1}{/!(mml:bvar\string|mml:max\string|mml:min)}{\MMLseparator,}
@@ -951,13 +951,13 @@
\gdef\MMLpowerelement{\mmlthird{#1}}% postpone, no xdef
\MMLcreset\mmlsecond{#1}
} {
- \left(\MMLcreset\mmlsecond{#1}\right)^{\MMLcreset\mmlthird{#1}}
+ \left(\MMLcreset\mmlsecond{#1}\right)\normalsuperscript{\MMLcreset\mmlthird{#1}}
}
} {
- \left(\MMLcreset\mmlsecond{#1}\right)^{\MMLcreset\mmlthird{#1}}
+ \left(\MMLcreset\mmlsecond{#1}\right)\normalsuperscript{\MMLcreset\mmlthird{#1}}
}
} {
- \mmlsecond{#1}^{\MMLcreset\mmlthird{#1}}
+ \mmlsecond{#1}\normalsuperscript{\MMLcreset\mmlthird{#1}}
}
\stopxmlsetups
@@ -1043,7 +1043,7 @@
\def\mmlforallexistslist{mml:bvar\string|mml:forall\string|mml:exists\string|mml:condition}
\startxmlsetups mml:forallexists
- _{\xmlconcat{#1}{/mml:bvar}{\MMLseparator,}}
+ \normalsubscript{\xmlconcat{#1}{/mml:bvar}{\MMLseparator,}}
\xmldoifelse {#1} {/mml:condition} {
\thickspace
\begingroup
@@ -1185,17 +1185,17 @@
\startxmlsetups mml:int
\MMLcreset
\xmldoifelse {#1} {/mml:domainofapplication} {
- \int \doMMLlimits{int}_{\xmlfirst{#1}{/mml:domainofapplication}}\relax
+ \int \doMMLlimits{int}\normalsubscript{\xmlfirst{#1}{/mml:domainofapplication}}\relax
} {
\xmldoifelse {#1} {/mml:condition} {
- \int \doMMLlimits{int}_{\xmlfirst{#1}{/mml:condition}}\relax
+ \int \doMMLlimits{int}\normalsubscript{\xmlfirst{#1}{/mml:condition}}\relax
} {
\xmldoifelse {#1} {/mml:lowlimit} {
- \int \doMMLlimits{int}_{\xmlfirst{#1}{/mml:lowlimit}}^{\xmlfirst{#1}{/mml:uplimit}}
+ \int \doMMLlimits{int}\normalsubscript{\xmlfirst{#1}{/mml:lowlimit}}\normalsuperscript{\xmlfirst{#1}{/mml:uplimit}}
} {
% funny, why do we have lowlimit/uplimit then
\xmldoifelse {#1} {/mml:apply/mml:interval} {
- \int \doMMLlimits{int}_{\xmlindex{#1}{/mml:apply}{2}}^{\xmlindex{#1}{/mml:apply}{3}}
+ \int \doMMLlimits{int}\normalsubscript{\xmlindex{#1}{/mml:apply}{2}}\normalsuperscript{\xmlindex{#1}{/mml:apply}{3}}
} {
\int
}
@@ -1228,19 +1228,19 @@
\xmldoifelse {#1} {/mml:lambda} {
% a special case (mathadore/openmath)
\frac {
- d^{\xmlfirst{#1}{/mml:bvar}\xmlfirst{#1}{/mml:cn}}{\xmlfirst{#1}{/mml:lambda}\xmlfirst{#1}{/mml:ci}}
+ d\normalsuperscript{\xmlfirst{#1}{/mml:bvar}\xmlfirst{#1}{/mml:cn}}{\xmlfirst{#1}{/mml:lambda}\xmlfirst{#1}{/mml:ci}}
} {
- d{\xmlfirst{#1}{/mml:bvar}\xmlfirst{#1}{/mml:ci}}^{\xmlfirst{#1}{/mml:bvar}\xmlfirst{#1}{/mml:cn}}
+ d{\xmlfirst{#1}{/mml:bvar}\xmlfirst{#1}{/mml:ci}}\normalsuperscript{\xmlfirst{#1}{/mml:bvar}\xmlfirst{#1}{/mml:cn}}
}
} {
\xmldoifelse {#1} {/mml:bvar} {
\frac {
{\mr d}{
\xmldoifelse {#1} {/mml:degree} {
- ^{\xmlconcat{#1}{/mml:degree}\empty}
+ \normalsuperscript{\xmlconcat{#1}{/mml:degree}\empty}
} {
\xmldoif {#1} {/mml:bvar/mml:degree} {
- ^{\xmlconcat{#1}{/mml:bvar/mml:degree}+}
+ \normalsuperscript{\xmlconcat{#1}{/mml:bvar/mml:degree}+}
}
}
}
@@ -1256,22 +1256,22 @@
{\mr d}
\xmlfirst{#1}{/mml:bvar/!mml:degree}
\xmldoif {#1} {/mml:bvar/mml:degree} {
- ^{\xmlfirst{#1}{/mml:bvar/mml:degree}}
+ \normalsuperscript{\xmlfirst{#1}{/mml:bvar/mml:degree}}
}
}
\doifnot \MMLdifflocation \v!top {
\left(\MMLcreset\xmlfirst{#1}{/(mml:apply\string|mml:ci)}\right)
}
} {
- \xmlconcatrange{#1}{/*}{2}{}^\prime
+ \xmlconcatrange{#1}{/*}{2}{}\normalsuperscript\prime
}
}
} {
\MMLcreset
\xmlfirst{#1}{/(mml:apply\string|mml:ci)}
- % there can be problems with nested diff's: ^^{} error
+ % there can be problems with nested diff's: \normalsuperscript\normalsuperscript{} error
% so we add an empty group here
- {}^
+ {}\normalsuperscript
{
\xmldoifelse {#1} {/mml:degree} {
\edef\mmldegree{\xmlfirst{#1}{/mml:degree/mml:cn}}
@@ -1289,7 +1289,7 @@
\startxmlsetups mml:partialdiff
\xmldoifelse {#1} {/mml:list} {
- {\mr D}_{
+ {\mr D}\normalsubscript{
\begingroup
\setfalse\mmllistdelimiters
\xmlall{#1}{/mml:list}
@@ -1299,7 +1299,7 @@
} {
\xmldoifelse {#1} {/mml:bvar} {
\frac {
- {\mr d}^{
+ {\mr d}\normalsuperscript{
\xmldoifelse {#1} {/mml:degree} {
\xmlconcat{#1}{/mml:degree}\empty
} {
@@ -1314,7 +1314,7 @@
}
{\mr d}\xmlfirst{#1}{/(mml:apply\string|mml:reln\string|mml:ci\string|mml:cn)}
\xmldoif {#1} {/mml:bvar/mml:degree} {
- ^{\xmlfirst{#1}{/mml:bvar/mml:degree}}
+ \normalsuperscript{\xmlfirst{#1}{/mml:bvar/mml:degree}}
}
}
} {
@@ -1326,7 +1326,7 @@
\startxmlsetups mml:divergence \mathopnolimits{div} \xmlall{#1}{/!mml:divergence} \stopxmlsetups
\startxmlsetups mml:grad \mathopnolimits{grad} \xmlall{#1}{/!mml:grad} \stopxmlsetups
\startxmlsetups mml:curl \mathopnolimits{curl} \xmlall{#1}{/!mml:curl} \stopxmlsetups
-\startxmlsetups mml:laplacian \nabla^2 \xmlall{#1}{/!mml:laplacian} \stopxmlsetups
+\startxmlsetups mml:laplacian \nabla\normalsuperscript2 \xmlall{#1}{/!mml:laplacian} \stopxmlsetups
\startxmlsetups mml:ident \mathopnolimits{identity} \xmlall{#1}{/!mml:ident} \stopxmlsetups
\setupMMLappearance[domain] [symbol=]
@@ -1336,7 +1336,7 @@
\doifelsenothing \MMLdomainsymbol {
\mathopnolimits{domain}\MMLcreset\xmlall{#1}{/!mml:domain}
} {
- \MMLdomainsymbol_{\xmlall{#1}{/!mml:domain}}
+ \MMLdomainsymbol\normalsubscript{\xmlall{#1}{/!mml:domain}}
}
\stopxmlsetups
@@ -1344,7 +1344,7 @@
\doifelsenothing \MMLcodomainsymbol {
\mathopnolimits{codomain}\MMLcreset\xmlall{#1}{/!mml:codomain}
} {
- \MMLcodomainsymbol_{\xmlall{#1}{/!mml:codomain}}
+ \MMLcodomainsymbol\normalsubscript{\xmlall{#1}{/!mml:codomain}}
}
\stopxmlsetups
@@ -1414,7 +1414,7 @@
\begingroup
\xmldoifelse {#1} {/(mml:condition\string|mml:bvar\string|mml:lowlimit)} {
\def\mmlsumprodlower{
- _{
+ \normalsubscript{
\xmldoifelse {#1} {/mml:condition} {
\mmlstackedsubscripts{\xmlconcat{#1}{/mml:condition}{\crcr}}
} {
@@ -1430,7 +1430,7 @@
\let\mmlsumprodlower\empty
}
\xmldoifelse {#1} {/mml:uplimit} {
- \def\mmlsumprodupper{^{\xmlfirst{#1}{/mml:uplimit}}}
+ \def\mmlsumprodupper{\normalsuperscript{\xmlfirst{#1}{/mml:uplimit}}}
} {
\let\mmlsumprodupper\empty
}
@@ -1438,10 +1438,10 @@
\edef\mmlintervalfrom{\xmlindex{#1}{/mml:interval}{1}}
\edef\mmlintervalto {\xmlindex{#1}{/mml:interval}{2}}
\ifx \mmlintervalfrom \empty \else
- \def\mmlsumprodlower{_{\xmldoif{#1}{/mml:bvar}{\xmlfirst{#1}{/mml:bvar}{=}}\mmlintervalfrom}}
+ \def\mmlsumprodlower{\normalsubscript{\xmldoif{#1}{/mml:bvar}{\xmlfirst{#1}{/mml:bvar}{=}}\mmlintervalfrom}}
\fi
\ifx \mmlintervalto \empty \else
- \def\mmlsumprodupper{^{\mmlintervalto}}
+ \def\mmlsumprodupper{\normalsuperscript{\mmlintervalto}}
\fi
}
\MMLcreset
@@ -1459,7 +1459,7 @@
\startxmlsetups mml:limit
\MMLcreset \lim
- \doMMLlimits {limit}_{
+ \doMMLlimits {limit}\normalsubscript{
\MMLcreset
\xmldoifelse {#1} {/mml:condition} {
\xmlfirst{#1}{/mml:condition}
@@ -1495,18 +1495,18 @@
\setupMMLappearance[log][\c!location=\v!right]
\startxmlsetups mml:exp
-% {\mr e}^{\xmlfirst{#1}{/mml:apply\string|mml:reln\string|mml:ci\string|mml:cn}}
- {\mr e}^{\xmlfirst{#1}{/!mml:exp}}
+% {\mr e}\normalsuperscript{\xmlfirst{#1}{/mml:apply\string|mml:reln\string|mml:ci\string|mml:cn}}
+ {\mr e}\normalsuperscript{\xmlfirst{#1}{/!mml:exp}}
\stopxmlsetups
\startxmlsetups mml:log
\xmldoifelse {#1} {/mml:logbase} {
\doifelse \MMLloglocation \v!left {
\mathop {
- {}^{\xmlfirst{#1}{/mml:logbase}}\negthinspace\mathopnolimits{log}
+ {}\normalsuperscript{\xmlfirst{#1}{/mml:logbase}}\negthinspace\mathopnolimits{log}
}
} {
- \mathopnolimits{log}_{\xmlfirst{#1}{/mml:logbase}}
+ \mathopnolimits{log}\normalsubscript{\xmlfirst{#1}{/mml:logbase}}
}
% \MMLcreset
\xmlfirst{#1}{/(mml:apply\string|mml:reln\string|mml:ci\string|mml:cn)}
@@ -1528,20 +1528,20 @@
% statistics
-\startxmlsetups mml:mean \overline {\mmlsecond{#1}} \stopxmlsetups
-\startxmlsetups mml:sdev \sigma \left(\MMLcreset\mmlsecond{#1}\right) \stopxmlsetups
-\startxmlsetups mml:variance \sigma \left(\MMLcreset\mmlsecond{#1}\right)^2 \stopxmlsetups
-\startxmlsetups mml:median \mathopnolimits{median}\left(\MMLcreset\mmlsecond{#1}\right) \stopxmlsetups
-\startxmlsetups mml:mode \mathopnolimits{mode} \left(\MMLcreset\mmlsecond{#1}\right) \stopxmlsetups
+\startxmlsetups mml:mean \overline {\mmlsecond{#1}} \stopxmlsetups
+\startxmlsetups mml:sdev \sigma \left(\MMLcreset\mmlsecond{#1}\right) \stopxmlsetups
+\startxmlsetups mml:variance \sigma \left(\MMLcreset\mmlsecond{#1}\right)\normalsuperscript2 \stopxmlsetups
+\startxmlsetups mml:median \mathopnolimits{median}\left(\MMLcreset\mmlsecond{#1}\right) \stopxmlsetups
+\startxmlsetups mml:mode \mathopnolimits{mode} \left(\MMLcreset\mmlsecond{#1}\right) \stopxmlsetups
% moments
\startxmlsetups mml:moment
\left\langle
- \xmlfirst{#1}{/(mml:apply\string|mml:reln\string|mml:ci\string|mml:cn)}^{\xmlfirst{#1}{/mml:degree}}
+ \xmlfirst{#1}{/(mml:apply\string|mml:reln\string|mml:ci\string|mml:cn)}\normalsuperscript{\xmlfirst{#1}{/mml:degree}}
\right\rangle
\xmldoif {#1} {mml:momentabout} {
- _{\xmlfirst{#1}{mml:momentabout}}
+ \normalsubscript{\xmlfirst{#1}{mml:momentabout}}
}
\stopxmlsetups
@@ -1596,11 +1596,11 @@
\stopxmlsetups
\startxmlsetups mml:transpose
- \mmlsecond{#1}^{\mathopnolimits{T}}
+ \mmlsecond{#1}\normalsuperscript{\mathopnolimits{T}}
\stopxmlsetups
\startxmlsetups mml:selector
- \MMLmathinner{\mmlsecond{#1}_{\MMLcreset\xmlconcatrange{#1}{/*}{3}{}{\MMLseparator,}}}
+ \MMLmathinner{\mmlsecond{#1}\normalsubscript{\MMLcreset\xmlconcatrange{#1}{/*}{3}{}{\MMLseparator,}}}
\stopxmlsetups
\startxmlsetups mml:vectorproduct \mmlsecond{#1}\times \mmlthird{#1} \stopxmlsetups
@@ -1700,10 +1700,10 @@
\startxmlsetups mml:function
\ifx\MMLpowerelement\empty
- \ifconditional\xmlinversefunction^{-1}\fi
+ \ifconditional\xmlinversefunction\normalsuperscript{-1}\fi
\setfalse\xmlinversefunction
\else
- ^{\ifconditional\xmlinversefunction-\fi\MMLpowerelement}
+ \normalsuperscript{\ifconditional\xmlinversefunction-\fi\MMLpowerelement}
\setfalse\xmlinversefunction
\glet\MMLpowerelement\empty
\fi
@@ -2075,25 +2075,25 @@
\startxmlsetups mml:msub
\doifelse\MMLscriptsalternative\v!a {
- {\mmlfirst{#1}}_{\mmlsecond{#1}}
+ {\mmlfirst{#1}}\normalsubscript{\mmlsecond{#1}}
} {
- \mmlfirst{#1} _{\mmlsecond{#1}}
+ \mmlfirst{#1} \normalsubscript{\mmlsecond{#1}}
}
\stopxmlsetups
\startxmlsetups mml:msup
\doifelse\MMLscriptsalternative\v!a {
- {\mmlfirst{#1}}^{\mmlsecond{#1}}
+ {\mmlfirst{#1}}\normalsuperscript{\mmlsecond{#1}}
} {
- \mmlfirst{#1} ^{\mmlsecond{#1}}
+ \mmlfirst{#1} \normalsuperscript{\mmlsecond{#1}}
}
\stopxmlsetups
\startxmlsetups mml:msubsup
\doifelse\MMLscriptsalternative\v!a {
- {\mmlfirst{#1}}_{\mmlsecond{#1}}^{\mmlthird{#1}}
+ {\mmlfirst{#1}}\normalsubscript{\mmlsecond{#1}}\normalsuperscript{\mmlthird{#1}}
} {
- \mmlfirst{#1} _{\mmlsecond{#1}}^{\mmlthird{#1}}
+ \mmlfirst{#1} \normalsubscript{\mmlsecond{#1}}\normalsuperscript{\mmlthird{#1}}
}
\stopxmlsetups
@@ -2158,7 +2158,7 @@
\startxmlsetups mml:munderover
\edef\mmlbasetoken{\xmlraw{#1}{/mml:*[1]}}
\edef\mmlbasecommand{\utfmathcommand\mmlbasetoken}
- \mmlexecuteifdefined\mmlbasecommand{\mathematics{\mmlfirst{#1}}}_{\mmlsecond{#1}}^{\mmlthird{#1}}
+ \mmlexecuteifdefined\mmlbasecommand{\mathematics{\mmlfirst{#1}}}\normalsubscript{\mmlsecond{#1}}\normalsuperscript{\mmlthird{#1}}
\stopxmlsetups
% tables (mml:mtable, mml:mtr, mml:mlabledtr, mml:mtd)
diff --git a/tex/generic/context/luatex-fonts-merged.lua b/tex/generic/context/luatex-fonts-merged.lua
index 661011901..c414e285f 100644
--- a/tex/generic/context/luatex-fonts-merged.lua
+++ b/tex/generic/context/luatex-fonts-merged.lua
@@ -1,6 +1,6 @@
-- merged file : luatex-fonts-merged.lua
-- parent file : luatex-fonts.lua
--- merge date : 01/06/11 17:08:04
+-- merge date : 01/10/11 09:41:27
do -- begin closure to overcome local limits and interference