summaryrefslogtreecommitdiff
path: root/tex
diff options
context:
space:
mode:
Diffstat (limited to 'tex')
-rw-r--r--tex/context/base/cont-new.tex2
-rw-r--r--tex/context/base/context.tex2
-rw-r--r--tex/context/base/core-ntb.tex37
-rw-r--r--tex/context/base/enco-ini.tex4
-rw-r--r--tex/context/base/hand-ini.tex12
-rw-r--r--tex/context/base/page-lin.tex1
-rw-r--r--tex/context/base/regi-cp1250.tex4
-rw-r--r--tex/context/base/regi-cp1251.tex152
-rw-r--r--tex/context/base/regi-cp1252.tex156
-rw-r--r--tex/context/base/regi-cp1253.tex153
-rw-r--r--tex/context/base/regi-cp1254.tex153
-rw-r--r--tex/context/base/regi-cp1257.tex153
-rw-r--r--tex/context/base/regi-ini.tex4
-rw-r--r--tex/context/base/regi-iso-8858-1.tex (renamed from tex/context/base/regi-il1.tex)2
-rw-r--r--tex/context/base/regi-iso-8858-2.tex (renamed from tex/context/base/regi-lat.tex)2
-rw-r--r--tex/context/base/regi-iso-8859-15.tex (renamed from tex/context/base/regi-il9.tex)0
-rw-r--r--tex/context/base/regi-iso-8859-7.tex (renamed from tex/context/base/regi-grk.tex)2
-rw-r--r--tex/context/base/regi-syn.tex52
-rw-r--r--tex/context/base/regi-vis.tex296
-rw-r--r--tex/context/base/regi-win.tex150
-rw-r--r--tex/context/base/x-newmme.tex429
-rw-r--r--tex/context/base/x-newmml.tex2374
-rw-r--r--tex/context/base/x-newpml.tex241
-rw-r--r--tex/context/base/xtag-cml.tex38
-rw-r--r--tex/context/interface/keys-cz.xml2
-rw-r--r--tex/context/interface/keys-de.xml2
-rw-r--r--tex/context/interface/keys-en.xml2
-rw-r--r--tex/context/interface/keys-fr.xml2
-rw-r--r--tex/context/interface/keys-it.xml2
-rw-r--r--tex/context/interface/keys-nl.xml2
-rw-r--r--tex/context/interface/keys-ro.xml2
31 files changed, 4063 insertions, 370 deletions
diff --git a/tex/context/base/cont-new.tex b/tex/context/base/cont-new.tex
index a01eb21d6..785955e4c 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{2006.04.07 11:24}
+\newcontextversion{2006.04.09 22:25}
%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 1025fbbf9..4775af74c 100644
--- a/tex/context/base/context.tex
+++ b/tex/context/base/context.tex
@@ -31,7 +31,7 @@
%D 2004.8.30 the low level interface is english. Watch out and adapt
%D your styles an modules.
-\def\contextversion{2006.04.07 11:24}
+\def\contextversion{2006.04.09 22:25}
%D For those who want to use this:
diff --git a/tex/context/base/core-ntb.tex b/tex/context/base/core-ntb.tex
index 1e607eabb..aa0436c32 100644
--- a/tex/context/base/core-ntb.tex
+++ b/tex/context/base/core-ntb.tex
@@ -285,39 +285,6 @@
\let\eTR\relax % handy in \expanded
\setupTABLE[\v!row][\maximumrow][#1]}
-% \long\def\parseTD[#1][#2]#3\eTD % [#2] is dummy that kills spaces
-% {\getparameters[\@@tbl][\c!ny=\tblnr,\c!nx=\tblnc,nc=1,nr=1,#1]%
-% % goto first cell
-% \doloop
-% {\increment\currentcol
-% \doifnottbltag\maximumrow\currentcol\exitloop}%
-% % fill r*c cells and set span
-% \let\row\maximumrow
-% \let\col\currentcol
-% \dorecurse\tblny
-% {\let\col\currentcol
-% \settblcol\row\col\tblnx
-% \ifnum\tblnx>\maximumrowspan\relax
-% \let\maximumrowspan\tblnx
-% \fi
-% \dorecurse\tblnx
-% {\settbltag\row\col\tblnone
-% \increment\col}%
-% \increment\row}%
-% % check max column
-% \decrement\col
-% \ifnum\col>\maximumcol\relax
-% \let\maximumcol\col
-% \fi
-% % set values
-% \settbltag\maximumrow\currentcol\tblcell
-% \settblcol\maximumrow\currentcol\tblnx
-% \settblrow\maximumrow\currentcol\tblny
-% % save text
-% \edef\celltag{{\maximumrow}{\currentcol}}%
-% \@EA\settbltxt\@EA\maximumrow\@EA\currentcol\@EA
-% {\@EA\handleTBLcell\celltag[#1]{#3}}}
-
\long\def\parseTD[#1][#2]#3\eTD % [#2] is dummy that kills spaces
{\getparameters[\@@tbl][\c!ny=\tblnr,\c!nx=\tblnc,nc=1,nr=1,\c!n=\currentcol,#1]%
% goto first cell % NEW, n=cellnumber
@@ -326,8 +293,8 @@
{\ifnum\getvalue{\@@tbl\c!n}=\currentcol\else
\scratchcounter\getvalue{\@@tbl\c!n}%
\advance\scratchcounter-\currentcol
- \advance\scratchcounter\plusone
- \expanded{\parseTD[][\c!nx=\the\scratchcounter]}\eTD
+ \advance\scratchcounter\minusone
+ \expanded{\parseTD[\c!nx=\the\scratchcounter][]}\eTD
\getparameters[\@@tbl][\c!ny=\tblnr,\c!nx=\tblnc,nc=1,nr=1,\c!n=\currentcol,#1]%
\fi}%
\doloop
diff --git a/tex/context/base/enco-ini.tex b/tex/context/base/enco-ini.tex
index 7c4a88814..17c702037 100644
--- a/tex/context/base/enco-ini.tex
+++ b/tex/context/base/enco-ini.tex
@@ -1193,11 +1193,15 @@
% \def\numcharacter#1{\char#1 }
% \let\dochar\numcharacter
+ \def\thechr#1{\char#1 } % just in case \relax interferes
\unexpanded\def\numchr#1{\char#1\relax}
\unexpanded\def\strchr#1{\csname#1\endcsname}
\let\dochar\numchr
+\def\startdirectcharacters {\pushmacro\dochar \let\dochar\thechr}
+\def\stopdirectcharacters {\popmacro \dochar}
+
\def\definecharacter#1 #2 %
{\ifundefined{#1}\setvalue{#1}{\dohandlecharacter{#1}}\fi
% \doifnumberelse{\string#2}
diff --git a/tex/context/base/hand-ini.tex b/tex/context/base/hand-ini.tex
index 19f99f7d2..44fcf2973 100644
--- a/tex/context/base/hand-ini.tex
+++ b/tex/context/base/hand-ini.tex
@@ -585,15 +585,19 @@
\endETEX
\def\redofastenablehandling
- {\edef\fonthandling{\csname\@fha@\@fha@\@fha@\askedfonthandling\endcsname}%
- \rawprocesscommacommand[\fonthandling]\xfastenablehandling}
+ {\startdirectcharacters
+ \edef\fonthandling{\csname\@fha@\@fha@\@fha@\askedfonthandling\endcsname}%
+ \rawprocesscommacommand[\fonthandling]\xfastenablehandling
+ \stopdirectcharacters}
\def\dofastenablehandling
- {\the\everyenablefonthandling
+ {\startdirectcharacters
+ \the\everyenablefonthandling
\edef\fonthandling{\csname\@fha@\@fha@\askedfonthandling\endcsname}%
\checkfonthandling\filoffonthandling
\rawprocesscommacommand[\fonthandling]\dodoenablehandling
- \registerfonthandling\filoffonthandling}
+ \registerfonthandling\filoffonthandling
+ \stopdirectcharacters}
\def\nofastenablehandling
{\the\everyenablefonthandling
diff --git a/tex/context/base/page-lin.tex b/tex/context/base/page-lin.tex
index 9a18347a0..a0b4e84a9 100644
--- a/tex/context/base/page-lin.tex
+++ b/tex/context/base/page-lin.tex
@@ -306,6 +306,7 @@
\let\stoplinenumbering\dostopnummerenVERB
\def\placelinenumber
{\global\linenumber\verbatimlinenumber
+ \global\advance\linenumber \minusone
\doplacelinenumber}%
\fi
\dostartnummeren}
diff --git a/tex/context/base/regi-cp1250.tex b/tex/context/base/regi-cp1250.tex
index b5bbdbf71..b92eb5e31 100644
--- a/tex/context/base/regi-cp1250.tex
+++ b/tex/context/base/regi-cp1250.tex
@@ -12,10 +12,12 @@
%C details.
%D Support for cp1250 input encoding (regime) for Central European languages,
-%D see also iso-8859-2. Usage:
+%D see also iso-8859-2.
%D
+%D Usage:
%D \type{\enableregime[cp1250]} or \type{\enablereregime[windows-1250]}
+
\startregime[cp1250]
\defineactivetoken 128 {\texteuro} % 20AC EURO SIGN
diff --git a/tex/context/base/regi-cp1251.tex b/tex/context/base/regi-cp1251.tex
new file mode 100644
index 000000000..60f04170b
--- /dev/null
+++ b/tex/context/base/regi-cp1251.tex
@@ -0,0 +1,152 @@
+%D \module
+%D [ file=regi-cp1251,
+%D version=2005.12.26,
+%D title=\CONTEXT\ Encoding Macros,
+%D subtitle=cp1251 (Cyrillic),
+%D author=script-generated,
+%D date=\currentdate,
+%D copyright=PRAGMA-ADE]
+%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 Support for cp1251 input encoding (regime) for Cyrillic.
+%D
+%D Usage:
+%D \type{\enableregime[cp1251]} or \type{\enablereregime[windows-1251]}
+
+
+\startregime[cp1251]
+
+\defineactivetoken 128 {\cyrillicDJE} % 0402 CYRILLIC CAPITAL LETTER DJE
+\defineactivetoken 129 {\cyrillicGJE} % 0403 CYRILLIC CAPITAL LETTER GJE
+\defineactivetoken 130 {\quotesinglebase} % 201A SINGLE LOW-9 QUOTATION MARK
+\defineactivetoken 131 {\cyrillicgje} % 0453 CYRILLIC SMALL LETTER GJE
+\defineactivetoken 132 {\quotedblbase} % 201E DOUBLE LOW-9 QUOTATION MARK
+\defineactivetoken 133 {\textellipsis} % 2026 HORIZONTAL ELLIPSIS
+\defineactivetoken 134 {\textdag} % 2020 DAGGER
+\defineactivetoken 135 {\textddag} % 2021 DOUBLE DAGGER
+\defineactivetoken 136 {\texteuro} % 20AC EURO SIGN
+\defineactivetoken 137 {\perthousand} % 2030 PER MILLE SIGN
+\defineactivetoken 138 {\cyrillicLJE} % 0409 CYRILLIC CAPITAL LETTER LJE
+\defineactivetoken 139 {\guilsingleleft} % 2039 SINGLE LEFT-POINTING ANGLE QUOTATION MARK
+\defineactivetoken 140 {\cyrillicNJE} % 040A CYRILLIC CAPITAL LETTER NJE
+\defineactivetoken 141 {\cyrillicKJE} % 040C CYRILLIC CAPITAL LETTER KJE
+\defineactivetoken 142 {\cyrillicTSHE} % 040B CYRILLIC CAPITAL LETTER TSHE
+\defineactivetoken 143 {\cyrillicDZHE} % 040F CYRILLIC CAPITAL LETTER DZHE
+\defineactivetoken 144 {\cyrillicdje} % 0452 CYRILLIC SMALL LETTER DJE
+\defineactivetoken 145 {\quoteleft} % 2018 LEFT SINGLE QUOTATION MARK
+\defineactivetoken 146 {\quoteright} % 2019 RIGHT SINGLE QUOTATION MARK
+\defineactivetoken 147 {\quotedblleft} % 201C LEFT DOUBLE QUOTATION MARK
+\defineactivetoken 148 {\quotedblright} % 201D RIGHT DOUBLE QUOTATION MARK
+\defineactivetoken 149 {\textbullet} % 2022 BULLET
+\defineactivetoken 150 {\endash} % 2013 EN DASH
+\defineactivetoken 151 {\emdash} % 2014 EM DASH
+\defineactivetoken 152 {\unknownchar} % <undefined>
+\defineactivetoken 153 {\trademark} % 2122 TRADE MARK SIGN
+\defineactivetoken 154 {\cyrilliclje} % 0459 CYRILLIC SMALL LETTER LJE
+\defineactivetoken 155 {\guilsingleright} % 203A SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
+\defineactivetoken 156 {\cyrillicnje} % 045A CYRILLIC SMALL LETTER NJE
+\defineactivetoken 157 {\cyrillickje} % 045C CYRILLIC SMALL LETTER KJE
+\defineactivetoken 158 {\cyrillictshe} % 045B CYRILLIC SMALL LETTER TSHE
+\defineactivetoken 159 {\cyrillicdzhe} % 045F CYRILLIC SMALL LETTER DZHE
+\defineactivetoken 160 {\nonbreakablespace} % 00A0 NO-BREAK SPACE
+\defineactivetoken 161 {\cyrillicUSHRT} % 040E CYRILLIC CAPITAL LETTER SHORT U
+\defineactivetoken 162 {\cyrillicushrt} % 045E CYRILLIC SMALL LETTER SHORT U
+\defineactivetoken 163 {\cyrillicJE} % 0408 CYRILLIC CAPITAL LETTER JE
+\defineactivetoken 164 {\textcurrency} % 00A4 CURRENCY SIGN
+\defineactivetoken 165 {\cyrillicGHEupturn} % 0490 CYRILLIC CAPITAL LETTER GHE WITH UPTURN
+\defineactivetoken 166 {\textbrokenbar} % 00A6 BROKEN BAR
+\defineactivetoken 167 {\sectionmark} % 00A7 SECTION SIGN
+\defineactivetoken 168 {\cyrillicYO} % 0401 CYRILLIC CAPITAL LETTER IO
+\defineactivetoken 169 {\copyright} % 00A9 COPYRIGHT SIGN
+\defineactivetoken 170 {\cyrillicIE} % 0404 CYRILLIC CAPITAL LETTER UKRAINIAN IE
+\defineactivetoken 171 {\leftguillemot} % 00AB LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+\defineactivetoken 172 {\textlognot} % 00AC NOT SIGN
+\defineactivetoken 173 {\softhyphen} % 00AD SOFT HYPHEN
+\defineactivetoken 174 {\registered} % 00AE REGISTERED SIGN
+\defineactivetoken 175 {\cyrillicYI} % 0407 CYRILLIC CAPITAL LETTER YI
+\defineactivetoken 176 {\textdegree} % 00B0 DEGREE SIGN
+\defineactivetoken 177 {\textpm} % 00B1 PLUS-MINUS SIGN
+\defineactivetoken 178 {\cyrillicII} % 0406 CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I
+\defineactivetoken 179 {\cyrillicii} % 0456 CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I
+\defineactivetoken 180 {\cyrillicgheupturn} % 0491 CYRILLIC SMALL LETTER GHE WITH UPTURN
+\defineactivetoken 181 {\textmu} % 00B5 MICRO SIGN
+\defineactivetoken 182 {\paragraphmark} % 00B6 PILCROW SIGN
+\defineactivetoken 183 {\periodcentered} % 00B7 MIDDLE DOT
+\defineactivetoken 184 {\cyrillicyo} % 0451 CYRILLIC SMALL LETTER IO
+\defineactivetoken 185 {\textnumero} % 2116 NUMERO SIGN
+\defineactivetoken 186 {\cyrillicie} % 0454 CYRILLIC SMALL LETTER UKRAINIAN IE
+\defineactivetoken 187 {\rightguillemot} % 00BB RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+\defineactivetoken 188 {\cyrillicje} % 0458 CYRILLIC SMALL LETTER JE
+\defineactivetoken 189 {\cyrillicDZE} % 0405 CYRILLIC CAPITAL LETTER DZE
+\defineactivetoken 190 {\cyrillicdze} % 0455 CYRILLIC SMALL LETTER DZE
+\defineactivetoken 191 {\cyrillicyi} % 0457 CYRILLIC SMALL LETTER YI
+\defineactivetoken 192 {\cyrillicA} % 0410 CYRILLIC CAPITAL LETTER A
+\defineactivetoken 193 {\cyrillicB} % 0411 CYRILLIC CAPITAL LETTER BE
+\defineactivetoken 194 {\cyrillicV} % 0412 CYRILLIC CAPITAL LETTER VE
+\defineactivetoken 195 {\cyrillicG} % 0413 CYRILLIC CAPITAL LETTER GHE
+\defineactivetoken 196 {\cyrillicD} % 0414 CYRILLIC CAPITAL LETTER DE
+\defineactivetoken 197 {\cyrillicE} % 0415 CYRILLIC CAPITAL LETTER IE
+\defineactivetoken 198 {\cyrillicZH} % 0416 CYRILLIC CAPITAL LETTER ZHE
+\defineactivetoken 199 {\cyrillicZ} % 0417 CYRILLIC CAPITAL LETTER ZE
+\defineactivetoken 200 {\cyrillicI} % 0418 CYRILLIC CAPITAL LETTER I
+\defineactivetoken 201 {\cyrillicISHRT} % 0419 CYRILLIC CAPITAL LETTER SHORT I
+\defineactivetoken 202 {\cyrillicK} % 041A CYRILLIC CAPITAL LETTER KA
+\defineactivetoken 203 {\cyrillicL} % 041B CYRILLIC CAPITAL LETTER EL
+\defineactivetoken 204 {\cyrillicM} % 041C CYRILLIC CAPITAL LETTER EM
+\defineactivetoken 205 {\cyrillicN} % 041D CYRILLIC CAPITAL LETTER EN
+\defineactivetoken 206 {\cyrillicO} % 041E CYRILLIC CAPITAL LETTER O
+\defineactivetoken 207 {\cyrillicP} % 041F CYRILLIC CAPITAL LETTER PE
+\defineactivetoken 208 {\cyrillicR} % 0420 CYRILLIC CAPITAL LETTER ER
+\defineactivetoken 209 {\cyrillicS} % 0421 CYRILLIC CAPITAL LETTER ES
+\defineactivetoken 210 {\cyrillicT} % 0422 CYRILLIC CAPITAL LETTER TE
+\defineactivetoken 211 {\cyrillicU} % 0423 CYRILLIC CAPITAL LETTER U
+\defineactivetoken 212 {\cyrillicF} % 0424 CYRILLIC CAPITAL LETTER EF
+\defineactivetoken 213 {\cyrillicH} % 0425 CYRILLIC CAPITAL LETTER HA
+\defineactivetoken 214 {\cyrillicC} % 0426 CYRILLIC CAPITAL LETTER TSE
+\defineactivetoken 215 {\cyrillicCH} % 0427 CYRILLIC CAPITAL LETTER CHE
+\defineactivetoken 216 {\cyrillicSH} % 0428 CYRILLIC CAPITAL LETTER SHA
+\defineactivetoken 217 {\cyrillicSHCH} % 0429 CYRILLIC CAPITAL LETTER SHCHA
+\defineactivetoken 218 {\cyrillicHRDSN} % 042A CYRILLIC CAPITAL LETTER HARD SIGN
+\defineactivetoken 219 {\cyrillicERY} % 042B CYRILLIC CAPITAL LETTER YERU
+\defineactivetoken 220 {\cyrillicSFTSN} % 042C CYRILLIC CAPITAL LETTER SOFT SIGN
+\defineactivetoken 221 {\cyrillicEREV} % 042D CYRILLIC CAPITAL LETTER E
+\defineactivetoken 222 {\cyrillicYU} % 042E CYRILLIC CAPITAL LETTER YU
+\defineactivetoken 223 {\cyrillicYA} % 042F CYRILLIC CAPITAL LETTER YA
+\defineactivetoken 224 {\cyrillica} % 0430 CYRILLIC SMALL LETTER A
+\defineactivetoken 225 {\cyrillicb} % 0431 CYRILLIC SMALL LETTER BE
+\defineactivetoken 226 {\cyrillicv} % 0432 CYRILLIC SMALL LETTER VE
+\defineactivetoken 227 {\cyrillicg} % 0433 CYRILLIC SMALL LETTER GHE
+\defineactivetoken 228 {\cyrillicd} % 0434 CYRILLIC SMALL LETTER DE
+\defineactivetoken 229 {\cyrillice} % 0435 CYRILLIC SMALL LETTER IE
+\defineactivetoken 230 {\cyrilliczh} % 0436 CYRILLIC SMALL LETTER ZHE
+\defineactivetoken 231 {\cyrillicz} % 0437 CYRILLIC SMALL LETTER ZE
+\defineactivetoken 232 {\cyrillici} % 0438 CYRILLIC SMALL LETTER I
+\defineactivetoken 233 {\cyrillicishrt} % 0439 CYRILLIC SMALL LETTER SHORT I
+\defineactivetoken 234 {\cyrillick} % 043A CYRILLIC SMALL LETTER KA
+\defineactivetoken 235 {\cyrillicl} % 043B CYRILLIC SMALL LETTER EL
+\defineactivetoken 236 {\cyrillicm} % 043C CYRILLIC SMALL LETTER EM
+\defineactivetoken 237 {\cyrillicn} % 043D CYRILLIC SMALL LETTER EN
+\defineactivetoken 238 {\cyrillico} % 043E CYRILLIC SMALL LETTER O
+\defineactivetoken 239 {\cyrillicp} % 043F CYRILLIC SMALL LETTER PE
+\defineactivetoken 240 {\cyrillicr} % 0440 CYRILLIC SMALL LETTER ER
+\defineactivetoken 241 {\cyrillics} % 0441 CYRILLIC SMALL LETTER ES
+\defineactivetoken 242 {\cyrillict} % 0442 CYRILLIC SMALL LETTER TE
+\defineactivetoken 243 {\cyrillicu} % 0443 CYRILLIC SMALL LETTER U
+\defineactivetoken 244 {\cyrillicf} % 0444 CYRILLIC SMALL LETTER EF
+\defineactivetoken 245 {\cyrillich} % 0445 CYRILLIC SMALL LETTER HA
+\defineactivetoken 246 {\cyrillicc} % 0446 CYRILLIC SMALL LETTER TSE
+\defineactivetoken 247 {\cyrillicch} % 0447 CYRILLIC SMALL LETTER CHE
+\defineactivetoken 248 {\cyrillicsh} % 0448 CYRILLIC SMALL LETTER SHA
+\defineactivetoken 249 {\cyrillicshch} % 0449 CYRILLIC SMALL LETTER SHCHA
+\defineactivetoken 250 {\cyrillichrdsn} % 044A CYRILLIC SMALL LETTER HARD SIGN
+\defineactivetoken 251 {\cyrillicery} % 044B CYRILLIC SMALL LETTER YERU
+\defineactivetoken 252 {\cyrillicsftsn} % 044C CYRILLIC SMALL LETTER SOFT SIGN
+\defineactivetoken 253 {\cyrillicerev} % 044D CYRILLIC SMALL LETTER E
+\defineactivetoken 254 {\cyrillicyu} % 044E CYRILLIC SMALL LETTER YU
+\defineactivetoken 255 {\cyrillicya} % 044F CYRILLIC SMALL LETTER YA
+
+\stopregime
+
diff --git a/tex/context/base/regi-cp1252.tex b/tex/context/base/regi-cp1252.tex
new file mode 100644
index 000000000..3911644ce
--- /dev/null
+++ b/tex/context/base/regi-cp1252.tex
@@ -0,0 +1,156 @@
+%D \module
+%D [ file=regi-cp1252,
+%D version=2005.12.26,
+%D title=\CONTEXT\ Encoding Macros,
+%D subtitle=cp1252 (West European),
+%D author=script-generated,
+%D date=\currentdate,
+%D copyright=PRAGMA-ADE]
+%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 Support for cp1252 input encoding (regime) for West European languages,
+%D see also iso-8859-1 and iso-8859-15.
+%D
+%D (Contributors to the original file: Tobias Burnus, Hans Hagen & Victor Figurnov.)
+%D
+%D Usage:
+%D \type{\enableregime[cp1252]} or \type{\enablereregime[windows-1252]}
+%D % and \enableregime[win] for backward-compatibility
+
+
+\startregime[cp1252]
+
+\defineactivetoken 128 {\texteuro} % 20AC EURO SIGN
+\defineactivetoken 129 {\unknownchar} % <undefined>
+\defineactivetoken 130 {\quotesinglebase} % 201A SINGLE LOW-9 QUOTATION MARK
+\defineactivetoken 131 {\fhook} % 0192 LATIN SMALL LETTER F WITH HOOK
+\defineactivetoken 132 {\quotedblbase} % 201E DOUBLE LOW-9 QUOTATION MARK
+\defineactivetoken 133 {\textellipsis} % 2026 HORIZONTAL ELLIPSIS
+\defineactivetoken 134 {\textdag} % 2020 DAGGER
+\defineactivetoken 135 {\textddag} % 2021 DOUBLE DAGGER
+\defineactivetoken 136 {\textcircumflex} % 02C6 MODIFIER LETTER CIRCUMFLEX ACCENT
+\defineactivetoken 137 {\perthousand} % 2030 PER MILLE SIGN
+\defineactivetoken 138 {\Scaron} % 0160 LATIN CAPITAL LETTER S WITH CARON
+\defineactivetoken 139 {\guilsingleleft} % 2039 SINGLE LEFT-POINTING ANGLE QUOTATION MARK
+\defineactivetoken 140 {\OEligature} % 0152 LATIN CAPITAL LIGATURE OE
+\defineactivetoken 141 {\unknownchar} % <undefined>
+\defineactivetoken 142 {\Zcaron} % 017D LATIN CAPITAL LETTER Z WITH CARON
+\defineactivetoken 143 {\unknownchar} % <undefined>
+\defineactivetoken 144 {\unknownchar} % <undefined>
+\defineactivetoken 145 {\quoteleft} % 2018 LEFT SINGLE QUOTATION MARK
+\defineactivetoken 146 {\quoteright} % 2019 RIGHT SINGLE QUOTATION MARK
+\defineactivetoken 147 {\quotedblleft} % 201C LEFT DOUBLE QUOTATION MARK
+\defineactivetoken 148 {\quotedblright} % 201D RIGHT DOUBLE QUOTATION MARK
+\defineactivetoken 149 {\textbullet} % 2022 BULLET
+\defineactivetoken 150 {\endash} % 2013 EN DASH
+\defineactivetoken 151 {\emdash} % 2014 EM DASH
+\defineactivetoken 152 {\texttilde} % 02DC SMALL TILDE
+\defineactivetoken 153 {\trademark} % 2122 TRADE MARK SIGN
+\defineactivetoken 154 {\scaron} % 0161 LATIN SMALL LETTER S WITH CARON
+\defineactivetoken 155 {\guilsingleright} % 203A SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
+\defineactivetoken 156 {\oeligature} % 0153 LATIN SMALL LIGATURE OE
+\defineactivetoken 157 {\unknownchar} % <undefined>
+\defineactivetoken 158 {\zcaron} % 017E LATIN SMALL LETTER Z WITH CARON
+\defineactivetoken 159 {\Ydiaeresis} % 0178 LATIN CAPITAL LETTER Y WITH DIAERESIS
+\defineactivetoken 160 {\nonbreakablespace} % 00A0 NO-BREAK SPACE
+\defineactivetoken 161 {\exclamdown} % 00A1 INVERTED EXCLAMATION MARK
+\defineactivetoken 162 {\textcent} % 00A2 CENT SIGN
+\defineactivetoken 163 {\textsterling} % 00A3 POUND SIGN
+\defineactivetoken 164 {\textcurrency} % 00A4 CURRENCY SIGN
+\defineactivetoken 165 {\textyen} % 00A5 YEN SIGN
+\defineactivetoken 166 {\textbrokenbar} % 00A6 BROKEN BAR
+\defineactivetoken 167 {\sectionmark} % 00A7 SECTION SIGN
+\defineactivetoken 168 {\textdiaeresis} % 00A8 DIAERESIS
+\defineactivetoken 169 {\copyright} % 00A9 COPYRIGHT SIGN
+\defineactivetoken 170 {\ordfeminine} % 00AA FEMININE ORDINAL INDICATOR
+\defineactivetoken 171 {\leftguillemot} % 00AB LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+\defineactivetoken 172 {\textlognot} % 00AC NOT SIGN
+\defineactivetoken 173 {\softhyphen} % 00AD SOFT HYPHEN
+\defineactivetoken 174 {\registered} % 00AE REGISTERED SIGN
+\defineactivetoken 175 {\textmacron} % 00AF MACRON
+\defineactivetoken 176 {\textdegree} % 00B0 DEGREE SIGN
+\defineactivetoken 177 {\textpm} % 00B1 PLUS-MINUS SIGN
+\defineactivetoken 178 {\twosuperior} % 00B2 SUPERSCRIPT TWO
+\defineactivetoken 179 {\threesuperior} % 00B3 SUPERSCRIPT THREE
+\defineactivetoken 180 {\textacute} % 00B4 ACUTE ACCENT
+\defineactivetoken 181 {\textmu} % 00B5 MICRO SIGN
+\defineactivetoken 182 {\paragraphmark} % 00B6 PILCROW SIGN
+\defineactivetoken 183 {\periodcentered} % 00B7 MIDDLE DOT
+\defineactivetoken 184 {\textcedilla} % 00B8 CEDILLA
+\defineactivetoken 185 {\onesuperior} % 00B9 SUPERSCRIPT ONE
+\defineactivetoken 186 {\ordmasculine} % 00BA MASCULINE ORDINAL INDICATOR
+\defineactivetoken 187 {\rightguillemot} % 00BB RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+\defineactivetoken 188 {\onequarter} % 00BC VULGAR FRACTION ONE QUARTER
+\defineactivetoken 189 {\onehalf} % 00BD VULGAR FRACTION ONE HALF
+\defineactivetoken 190 {\threequarter} % 00BE VULGAR FRACTION THREE QUARTERS
+\defineactivetoken 191 {\questiondown} % 00BF INVERTED QUESTION MARK
+\defineactivetoken 192 {\Agrave} % 00C0 LATIN CAPITAL LETTER A WITH GRAVE
+\defineactivetoken 193 {\Aacute} % 00C1 LATIN CAPITAL LETTER A WITH ACUTE
+\defineactivetoken 194 {\Acircumflex} % 00C2 LATIN CAPITAL LETTER A WITH CIRCUMFLEX
+\defineactivetoken 195 {\Atilde} % 00C3 LATIN CAPITAL LETTER A WITH TILDE
+\defineactivetoken 196 {\Adiaeresis} % 00C4 LATIN CAPITAL LETTER A WITH DIAERESIS
+\defineactivetoken 197 {\Aring} % 00C5 LATIN CAPITAL LETTER A WITH RING ABOVE
+\defineactivetoken 198 {\AEligature} % 00C6 LATIN CAPITAL LETTER AE
+\defineactivetoken 199 {\Ccedilla} % 00C7 LATIN CAPITAL LETTER C WITH CEDILLA
+\defineactivetoken 200 {\Egrave} % 00C8 LATIN CAPITAL LETTER E WITH GRAVE
+\defineactivetoken 201 {\Eacute} % 00C9 LATIN CAPITAL LETTER E WITH ACUTE
+\defineactivetoken 202 {\Ecircumflex} % 00CA LATIN CAPITAL LETTER E WITH CIRCUMFLEX
+\defineactivetoken 203 {\Ediaeresis} % 00CB LATIN CAPITAL LETTER E WITH DIAERESIS
+\defineactivetoken 204 {\Igrave} % 00CC LATIN CAPITAL LETTER I WITH GRAVE
+\defineactivetoken 205 {\Iacute} % 00CD LATIN CAPITAL LETTER I WITH ACUTE
+\defineactivetoken 206 {\Icircumflex} % 00CE LATIN CAPITAL LETTER I WITH CIRCUMFLEX
+\defineactivetoken 207 {\Idiaeresis} % 00CF LATIN CAPITAL LETTER I WITH DIAERESIS
+\defineactivetoken 208 {\Eth} % 00D0 LATIN CAPITAL LETTER ETH
+\defineactivetoken 209 {\Ntilde} % 00D1 LATIN CAPITAL LETTER N WITH TILDE
+\defineactivetoken 210 {\Ograve} % 00D2 LATIN CAPITAL LETTER O WITH GRAVE
+\defineactivetoken 211 {\Oacute} % 00D3 LATIN CAPITAL LETTER O WITH ACUTE
+\defineactivetoken 212 {\Ocircumflex} % 00D4 LATIN CAPITAL LETTER O WITH CIRCUMFLEX
+\defineactivetoken 213 {\Otilde} % 00D5 LATIN CAPITAL LETTER O WITH TILDE
+\defineactivetoken 214 {\Odiaeresis} % 00D6 LATIN CAPITAL LETTER O WITH DIAERESIS
+\defineactivetoken 215 {\textmultiply} % 00D7 MULTIPLICATION SIGN
+\defineactivetoken 216 {\Ostroke} % 00D8 LATIN CAPITAL LETTER O WITH STROKE
+\defineactivetoken 217 {\Ugrave} % 00D9 LATIN CAPITAL LETTER U WITH GRAVE
+\defineactivetoken 218 {\Uacute} % 00DA LATIN CAPITAL LETTER U WITH ACUTE
+\defineactivetoken 219 {\Ucircumflex} % 00DB LATIN CAPITAL LETTER U WITH CIRCUMFLEX
+\defineactivetoken 220 {\Udiaeresis} % 00DC LATIN CAPITAL LETTER U WITH DIAERESIS
+\defineactivetoken 221 {\Yacute} % 00DD LATIN CAPITAL LETTER Y WITH ACUTE
+\defineactivetoken 222 {\Thorn} % 00DE LATIN CAPITAL LETTER THORN
+\defineactivetoken 223 {\ssharp} % 00DF LATIN SMALL LETTER SHARP S
+\defineactivetoken 224 {\agrave} % 00E0 LATIN SMALL LETTER A WITH GRAVE
+\defineactivetoken 225 {\aacute} % 00E1 LATIN SMALL LETTER A WITH ACUTE
+\defineactivetoken 226 {\acircumflex} % 00E2 LATIN SMALL LETTER A WITH CIRCUMFLEX
+\defineactivetoken 227 {\atilde} % 00E3 LATIN SMALL LETTER A WITH TILDE
+\defineactivetoken 228 {\adiaeresis} % 00E4 LATIN SMALL LETTER A WITH DIAERESIS
+\defineactivetoken 229 {\aring} % 00E5 LATIN SMALL LETTER A WITH RING ABOVE
+\defineactivetoken 230 {\aeligature} % 00E6 LATIN SMALL LETTER AE
+\defineactivetoken 231 {\ccedilla} % 00E7 LATIN SMALL LETTER C WITH CEDILLA
+\defineactivetoken 232 {\egrave} % 00E8 LATIN SMALL LETTER E WITH GRAVE
+\defineactivetoken 233 {\eacute} % 00E9 LATIN SMALL LETTER E WITH ACUTE
+\defineactivetoken 234 {\ecircumflex} % 00EA LATIN SMALL LETTER E WITH CIRCUMFLEX
+\defineactivetoken 235 {\ediaeresis} % 00EB LATIN SMALL LETTER E WITH DIAERESIS
+\defineactivetoken 236 {\igrave} % 00EC LATIN SMALL LETTER I WITH GRAVE
+\defineactivetoken 237 {\iacute} % 00ED LATIN SMALL LETTER I WITH ACUTE
+\defineactivetoken 238 {\icircumflex} % 00EE LATIN SMALL LETTER I WITH CIRCUMFLEX
+\defineactivetoken 239 {\idiaeresis} % 00EF LATIN SMALL LETTER I WITH DIAERESIS
+\defineactivetoken 240 {\eth} % 00F0 LATIN SMALL LETTER ETH
+\defineactivetoken 241 {\ntilde} % 00F1 LATIN SMALL LETTER N WITH TILDE
+\defineactivetoken 242 {\ograve} % 00F2 LATIN SMALL LETTER O WITH GRAVE
+\defineactivetoken 243 {\oacute} % 00F3 LATIN SMALL LETTER O WITH ACUTE
+\defineactivetoken 244 {\ocircumflex} % 00F4 LATIN SMALL LETTER O WITH CIRCUMFLEX
+\defineactivetoken 245 {\otilde} % 00F5 LATIN SMALL LETTER O WITH TILDE
+\defineactivetoken 246 {\odiaeresis} % 00F6 LATIN SMALL LETTER O WITH DIAERESIS
+\defineactivetoken 247 {\textdiv} % 00F7 DIVISION SIGN
+\defineactivetoken 248 {\ostroke} % 00F8 LATIN SMALL LETTER O WITH STROKE
+\defineactivetoken 249 {\ugrave} % 00F9 LATIN SMALL LETTER U WITH GRAVE
+\defineactivetoken 250 {\uacute} % 00FA LATIN SMALL LETTER U WITH ACUTE
+\defineactivetoken 251 {\ucircumflex} % 00FB LATIN SMALL LETTER U WITH CIRCUMFLEX
+\defineactivetoken 252 {\udiaeresis} % 00FC LATIN SMALL LETTER U WITH DIAERESIS
+\defineactivetoken 253 {\yacute} % 00FD LATIN SMALL LETTER Y WITH ACUTE
+\defineactivetoken 254 {\thorn} % 00FE LATIN SMALL LETTER THORN
+\defineactivetoken 255 {\ydiaeresis} % 00FF LATIN SMALL LETTER Y WITH DIAERESIS
+
+\stopregime
+
diff --git a/tex/context/base/regi-cp1253.tex b/tex/context/base/regi-cp1253.tex
new file mode 100644
index 000000000..24ec45eac
--- /dev/null
+++ b/tex/context/base/regi-cp1253.tex
@@ -0,0 +1,153 @@
+%D \module
+%D [ file=regi-cp1253,
+%D version=2005.12.26,
+%D title=\CONTEXT\ Encoding Macros,
+%D subtitle=cp1253 (Greek),
+%D author=script-generated,
+%D date=\currentdate,
+%D copyright=PRAGMA-ADE]
+%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 Support for cp1253 input encoding (regime) for Greek,
+%D see also iso-8859-7.
+%D
+%D Usage:
+%D \type{\enableregime[cp1253]} or \type{\enablereregime[windows-1253]}
+
+
+\startregime[cp1253]
+
+\defineactivetoken 128 {\texteuro} % 20AC EURO SIGN
+\defineactivetoken 129 {\unknownchar} % <undefined>
+\defineactivetoken 130 {\quotesinglebase} % 201A SINGLE LOW-9 QUOTATION MARK
+\defineactivetoken 131 {\fhook} % 0192 LATIN SMALL LETTER F WITH HOOK
+\defineactivetoken 132 {\quotedblbase} % 201E DOUBLE LOW-9 QUOTATION MARK
+\defineactivetoken 133 {\textellipsis} % 2026 HORIZONTAL ELLIPSIS
+\defineactivetoken 134 {\textdag} % 2020 DAGGER
+\defineactivetoken 135 {\textddag} % 2021 DOUBLE DAGGER
+\defineactivetoken 136 {\unknownchar} % <undefined>
+\defineactivetoken 137 {\perthousand} % 2030 PER MILLE SIGN
+\defineactivetoken 138 {\unknownchar} % <undefined>
+\defineactivetoken 139 {\guilsingleleft} % 2039 SINGLE LEFT-POINTING ANGLE QUOTATION MARK
+\defineactivetoken 140 {\unknownchar} % <undefined>
+\defineactivetoken 141 {\unknownchar} % <undefined>
+\defineactivetoken 142 {\unknownchar} % <undefined>
+\defineactivetoken 143 {\unknownchar} % <undefined>
+\defineactivetoken 144 {\unknownchar} % <undefined>
+\defineactivetoken 145 {\quoteleft} % 2018 LEFT SINGLE QUOTATION MARK
+\defineactivetoken 146 {\quoteright} % 2019 RIGHT SINGLE QUOTATION MARK
+\defineactivetoken 147 {\quotedblleft} % 201C LEFT DOUBLE QUOTATION MARK
+\defineactivetoken 148 {\quotedblright} % 201D RIGHT DOUBLE QUOTATION MARK
+\defineactivetoken 149 {\textbullet} % 2022 BULLET
+\defineactivetoken 150 {\endash} % 2013 EN DASH
+\defineactivetoken 151 {\emdash} % 2014 EM DASH
+\defineactivetoken 152 {\unknownchar} % <undefined>
+\defineactivetoken 153 {\trademark} % 2122 TRADE MARK SIGN
+\defineactivetoken 154 {\unknownchar} % <undefined>
+\defineactivetoken 155 {\guilsingleright} % 203A SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
+\defineactivetoken 156 {\unknownchar} % <undefined>
+\defineactivetoken 157 {\unknownchar} % <undefined>
+\defineactivetoken 158 {\unknownchar} % <undefined>
+\defineactivetoken 159 {\unknownchar} % <undefined>
+\defineactivetoken 160 {\nonbreakablespace} % 00A0 NO-BREAK SPACE
+\defineactivetoken 161 {\greekdialytikatonos} % 0385 GREEK DIALYTIKA TONOS
+\defineactivetoken 162 {\greekAlphatonos} % 0386 GREEK CAPITAL LETTER ALPHA WITH TONOS
+\defineactivetoken 163 {\textsterling} % 00A3 POUND SIGN
+\defineactivetoken 164 {\textcurrency} % 00A4 CURRENCY SIGN
+\defineactivetoken 165 {\textyen} % 00A5 YEN SIGN
+\defineactivetoken 166 {\textbrokenbar} % 00A6 BROKEN BAR
+\defineactivetoken 167 {\sectionmark} % 00A7 SECTION SIGN
+\defineactivetoken 168 {\textdiaeresis} % 00A8 DIAERESIS
+\defineactivetoken 169 {\copyright} % 00A9 COPYRIGHT SIGN
+\defineactivetoken 170 {\unknownchar} % <undefined>
+\defineactivetoken 171 {\leftguillemot} % 00AB LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+\defineactivetoken 172 {\textlognot} % 00AC NOT SIGN
+\defineactivetoken 173 {\softhyphen} % 00AD SOFT HYPHEN
+\defineactivetoken 174 {\registered} % 00AE REGISTERED SIGN
+\defineactivetoken 175 {\texthorizontalbar} % 2015 HORIZONTAL BAR
+\defineactivetoken 176 {\textdegree} % 00B0 DEGREE SIGN
+\defineactivetoken 177 {\textpm} % 00B1 PLUS-MINUS SIGN
+\defineactivetoken 178 {\twosuperior} % 00B2 SUPERSCRIPT TWO
+\defineactivetoken 179 {\threesuperior} % 00B3 SUPERSCRIPT THREE
+\defineactivetoken 180 {\greektonos} % 0384 GREEK TONOS
+\defineactivetoken 181 {\textmu} % 00B5 MICRO SIGN
+\defineactivetoken 182 {\paragraphmark} % 00B6 PILCROW SIGN
+\defineactivetoken 183 {\periodcentered} % 00B7 MIDDLE DOT
+\defineactivetoken 184 {\greekEpsilontonos} % 0388 GREEK CAPITAL LETTER EPSILON WITH TONOS
+\defineactivetoken 185 {\greekEtatonos} % 0389 GREEK CAPITAL LETTER ETA WITH TONOS
+\defineactivetoken 186 {\greekIotatonos} % 038A GREEK CAPITAL LETTER IOTA WITH TONOS
+\defineactivetoken 187 {\rightguillemot} % 00BB RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+\defineactivetoken 188 {\greekOmicrontonos} % 038C GREEK CAPITAL LETTER OMICRON WITH TONOS
+\defineactivetoken 189 {\onehalf} % 00BD VULGAR FRACTION ONE HALF
+\defineactivetoken 190 {\greekUpsilontonos} % 038E GREEK CAPITAL LETTER UPSILON WITH TONOS
+\defineactivetoken 191 {\greekOmegatonos} % 038F GREEK CAPITAL LETTER OMEGA WITH TONOS
+\defineactivetoken 192 {\greekiotadialytikatonos} % 0390 GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS
+\defineactivetoken 193 {\greekAlpha} % 0391 GREEK CAPITAL LETTER ALPHA
+\defineactivetoken 194 {\greekBeta} % 0392 GREEK CAPITAL LETTER BETA
+\defineactivetoken 195 {\greekGamma} % 0393 GREEK CAPITAL LETTER GAMMA
+\defineactivetoken 196 {\greekDelta} % 0394 GREEK CAPITAL LETTER DELTA
+\defineactivetoken 197 {\greekEpsilon} % 0395 GREEK CAPITAL LETTER EPSILON
+\defineactivetoken 198 {\greekZeta} % 0396 GREEK CAPITAL LETTER ZETA
+\defineactivetoken 199 {\greekEta} % 0397 GREEK CAPITAL LETTER ETA
+\defineactivetoken 200 {\greekTheta} % 0398 GREEK CAPITAL LETTER THETA
+\defineactivetoken 201 {\greekIota} % 0399 GREEK CAPITAL LETTER IOTA
+\defineactivetoken 202 {\greekKappa} % 039A GREEK CAPITAL LETTER KAPPA
+\defineactivetoken 203 {\greekLambda} % 039B GREEK CAPITAL LETTER LAMDA
+\defineactivetoken 204 {\greekMu} % 039C GREEK CAPITAL LETTER MU
+\defineactivetoken 205 {\greekNu} % 039D GREEK CAPITAL LETTER NU
+\defineactivetoken 206 {\greekXi} % 039E GREEK CAPITAL LETTER XI
+\defineactivetoken 207 {\greekOmicron} % 039F GREEK CAPITAL LETTER OMICRON
+\defineactivetoken 208 {\greekPi} % 03A0 GREEK CAPITAL LETTER PI
+\defineactivetoken 209 {\greekRho} % 03A1 GREEK CAPITAL LETTER RHO
+\defineactivetoken 210 {\unknownchar} % <undefined>
+\defineactivetoken 211 {\greekSigma} % 03A3 GREEK CAPITAL LETTER SIGMA
+\defineactivetoken 212 {\greekTau} % 03A4 GREEK CAPITAL LETTER TAU
+\defineactivetoken 213 {\greekUpsilon} % 03A5 GREEK CAPITAL LETTER UPSILON
+\defineactivetoken 214 {\greekPhi} % 03A6 GREEK CAPITAL LETTER PHI
+\defineactivetoken 215 {\greekChi} % 03A7 GREEK CAPITAL LETTER CHI
+\defineactivetoken 216 {\greekPsi} % 03A8 GREEK CAPITAL LETTER PSI
+\defineactivetoken 217 {\greekOmega} % 03A9 GREEK CAPITAL LETTER OMEGA
+\defineactivetoken 218 {\greekIotadialytika} % 03AA GREEK CAPITAL LETTER IOTA WITH DIALYTIKA
+\defineactivetoken 219 {\greekUpsilondialytika} % 03AB GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA
+\defineactivetoken 220 {\greekalphatonos} % 03AC GREEK SMALL LETTER ALPHA WITH TONOS
+\defineactivetoken 221 {\greekepsilontonos} % 03AD GREEK SMALL LETTER EPSILON WITH TONOS
+\defineactivetoken 222 {\greeketatonos} % 03AE GREEK SMALL LETTER ETA WITH TONOS
+\defineactivetoken 223 {\greekiotatonos} % 03AF GREEK SMALL LETTER IOTA WITH TONOS
+\defineactivetoken 224 {\greekupsilondialytikatonos} % 03B0 GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS
+\defineactivetoken 225 {\greekalpha} % 03B1 GREEK SMALL LETTER ALPHA
+\defineactivetoken 226 {\greekbeta} % 03B2 GREEK SMALL LETTER BETA
+\defineactivetoken 227 {\greekgamma} % 03B3 GREEK SMALL LETTER GAMMA
+\defineactivetoken 228 {\greekdelta} % 03B4 GREEK SMALL LETTER DELTA
+\defineactivetoken 229 {\greekepsilon} % 03B5 GREEK SMALL LETTER EPSILON
+\defineactivetoken 230 {\greekzeta} % 03B6 GREEK SMALL LETTER ZETA
+\defineactivetoken 231 {\greeketa} % 03B7 GREEK SMALL LETTER ETA
+\defineactivetoken 232 {\greektheta} % 03B8 GREEK SMALL LETTER THETA
+\defineactivetoken 233 {\greekiota} % 03B9 GREEK SMALL LETTER IOTA
+\defineactivetoken 234 {\greekkappa} % 03BA GREEK SMALL LETTER KAPPA
+\defineactivetoken 235 {\greeklambda} % 03BB GREEK SMALL LETTER LAMDA
+\defineactivetoken 236 {\greekmu} % 03BC GREEK SMALL LETTER MU
+\defineactivetoken 237 {\greeknu} % 03BD GREEK SMALL LETTER NU
+\defineactivetoken 238 {\greekxi} % 03BE GREEK SMALL LETTER XI
+\defineactivetoken 239 {\greekomicron} % 03BF GREEK SMALL LETTER OMICRON
+\defineactivetoken 240 {\greekpi} % 03C0 GREEK SMALL LETTER PI
+\defineactivetoken 241 {\greekrho} % 03C1 GREEK SMALL LETTER RHO
+\defineactivetoken 242 {\greekfinalsigma} % 03C2 GREEK SMALL LETTER FINAL SIGMA
+\defineactivetoken 243 {\greeksigma} % 03C3 GREEK SMALL LETTER SIGMA
+\defineactivetoken 244 {\greektau} % 03C4 GREEK SMALL LETTER TAU
+\defineactivetoken 245 {\greekupsilon} % 03C5 GREEK SMALL LETTER UPSILON
+\defineactivetoken 246 {\greekphi} % 03C6 GREEK SMALL LETTER PHI
+\defineactivetoken 247 {\greekchi} % 03C7 GREEK SMALL LETTER CHI
+\defineactivetoken 248 {\greekpsi} % 03C8 GREEK SMALL LETTER PSI
+\defineactivetoken 249 {\greekomega} % 03C9 GREEK SMALL LETTER OMEGA
+\defineactivetoken 250 {\greekiotadialytika} % 03CA GREEK SMALL LETTER IOTA WITH DIALYTIKA
+\defineactivetoken 251 {\greekupsilondiaeresis} % 03CB GREEK SMALL LETTER UPSILON WITH DIALYTIKA
+\defineactivetoken 252 {\greekomicrontonos} % 03CC GREEK SMALL LETTER OMICRON WITH TONOS
+\defineactivetoken 253 {\greekupsilontonos} % 03CD GREEK SMALL LETTER UPSILON WITH TONOS
+\defineactivetoken 254 {\greekomegatonos} % 03CE GREEK SMALL LETTER OMEGA WITH TONOS
+\defineactivetoken 255 {\unknownchar} % <undefined>
+
+\stopregime
+
diff --git a/tex/context/base/regi-cp1254.tex b/tex/context/base/regi-cp1254.tex
new file mode 100644
index 000000000..4dd509b9d
--- /dev/null
+++ b/tex/context/base/regi-cp1254.tex
@@ -0,0 +1,153 @@
+%D \module
+%D [ file=regi-cp1254,
+%D version=2005.12.26,
+%D title=\CONTEXT\ Encoding Macros,
+%D subtitle=cp1254 (Turkish),
+%D author=script-generated,
+%D date=\currentdate,
+%D copyright=PRAGMA-ADE]
+%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 Support for cp1254 input encoding (regime) for Turkish,
+%D see also iso-8859-9.
+%D
+%D Usage:
+%D \type{\enableregime[cp1254]} or \type{\enablereregime[windows-1254]}
+
+
+\startregime[cp1254]
+
+\defineactivetoken 128 {\texteuro} % 20AC EURO SIGN
+\defineactivetoken 129 {\unknownchar} % <undefined>
+\defineactivetoken 130 {\quotesinglebase} % 201A SINGLE LOW-9 QUOTATION MARK
+\defineactivetoken 131 {\fhook} % 0192 LATIN SMALL LETTER F WITH HOOK
+\defineactivetoken 132 {\quotedblbase} % 201E DOUBLE LOW-9 QUOTATION MARK
+\defineactivetoken 133 {\textellipsis} % 2026 HORIZONTAL ELLIPSIS
+\defineactivetoken 134 {\textdag} % 2020 DAGGER
+\defineactivetoken 135 {\textddag} % 2021 DOUBLE DAGGER
+\defineactivetoken 136 {\textcircumflex} % 02C6 MODIFIER LETTER CIRCUMFLEX ACCENT
+\defineactivetoken 137 {\perthousand} % 2030 PER MILLE SIGN
+\defineactivetoken 138 {\Scaron} % 0160 LATIN CAPITAL LETTER S WITH CARON
+\defineactivetoken 139 {\guilsingleleft} % 2039 SINGLE LEFT-POINTING ANGLE QUOTATION MARK
+\defineactivetoken 140 {\OEligature} % 0152 LATIN CAPITAL LIGATURE OE
+\defineactivetoken 141 {\unknownchar} % <undefined>
+\defineactivetoken 142 {\unknownchar} % <undefined>
+\defineactivetoken 143 {\unknownchar} % <undefined>
+\defineactivetoken 144 {\unknownchar} % <undefined>
+\defineactivetoken 145 {\quoteleft} % 2018 LEFT SINGLE QUOTATION MARK
+\defineactivetoken 146 {\quoteright} % 2019 RIGHT SINGLE QUOTATION MARK
+\defineactivetoken 147 {\quotedblleft} % 201C LEFT DOUBLE QUOTATION MARK
+\defineactivetoken 148 {\quotedblright} % 201D RIGHT DOUBLE QUOTATION MARK
+\defineactivetoken 149 {\textbullet} % 2022 BULLET
+\defineactivetoken 150 {\endash} % 2013 EN DASH
+\defineactivetoken 151 {\emdash} % 2014 EM DASH
+\defineactivetoken 152 {\texttilde} % 02DC SMALL TILDE
+\defineactivetoken 153 {\trademark} % 2122 TRADE MARK SIGN
+\defineactivetoken 154 {\scaron} % 0161 LATIN SMALL LETTER S WITH CARON
+\defineactivetoken 155 {\guilsingleright} % 203A SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
+\defineactivetoken 156 {\oeligature} % 0153 LATIN SMALL LIGATURE OE
+\defineactivetoken 157 {\unknownchar} % <undefined>
+\defineactivetoken 158 {\unknownchar} % <undefined>
+\defineactivetoken 159 {\Ydiaeresis} % 0178 LATIN CAPITAL LETTER Y WITH DIAERESIS
+\defineactivetoken 160 {\nonbreakablespace} % 00A0 NO-BREAK SPACE
+\defineactivetoken 161 {\exclamdown} % 00A1 INVERTED EXCLAMATION MARK
+\defineactivetoken 162 {\textcent} % 00A2 CENT SIGN
+\defineactivetoken 163 {\textsterling} % 00A3 POUND SIGN
+\defineactivetoken 164 {\textcurrency} % 00A4 CURRENCY SIGN
+\defineactivetoken 165 {\textyen} % 00A5 YEN SIGN
+\defineactivetoken 166 {\textbrokenbar} % 00A6 BROKEN BAR
+\defineactivetoken 167 {\sectionmark} % 00A7 SECTION SIGN
+\defineactivetoken 168 {\textdiaeresis} % 00A8 DIAERESIS
+\defineactivetoken 169 {\copyright} % 00A9 COPYRIGHT SIGN
+\defineactivetoken 170 {\ordfeminine} % 00AA FEMININE ORDINAL INDICATOR
+\defineactivetoken 171 {\leftguillemot} % 00AB LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+\defineactivetoken 172 {\textlognot} % 00AC NOT SIGN
+\defineactivetoken 173 {\softhyphen} % 00AD SOFT HYPHEN
+\defineactivetoken 174 {\registered} % 00AE REGISTERED SIGN
+\defineactivetoken 175 {\textmacron} % 00AF MACRON
+\defineactivetoken 176 {\textdegree} % 00B0 DEGREE SIGN
+\defineactivetoken 177 {\textpm} % 00B1 PLUS-MINUS SIGN
+\defineactivetoken 178 {\twosuperior} % 00B2 SUPERSCRIPT TWO
+\defineactivetoken 179 {\threesuperior} % 00B3 SUPERSCRIPT THREE
+\defineactivetoken 180 {\textacute} % 00B4 ACUTE ACCENT
+\defineactivetoken 181 {\textmu} % 00B5 MICRO SIGN
+\defineactivetoken 182 {\paragraphmark} % 00B6 PILCROW SIGN
+\defineactivetoken 183 {\periodcentered} % 00B7 MIDDLE DOT
+\defineactivetoken 184 {\textcedilla} % 00B8 CEDILLA
+\defineactivetoken 185 {\onesuperior} % 00B9 SUPERSCRIPT ONE
+\defineactivetoken 186 {\ordmasculine} % 00BA MASCULINE ORDINAL INDICATOR
+\defineactivetoken 187 {\rightguillemot} % 00BB RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+\defineactivetoken 188 {\onequarter} % 00BC VULGAR FRACTION ONE QUARTER
+\defineactivetoken 189 {\onehalf} % 00BD VULGAR FRACTION ONE HALF
+\defineactivetoken 190 {\threequarter} % 00BE VULGAR FRACTION THREE QUARTERS
+\defineactivetoken 191 {\questiondown} % 00BF INVERTED QUESTION MARK
+\defineactivetoken 192 {\Agrave} % 00C0 LATIN CAPITAL LETTER A WITH GRAVE
+\defineactivetoken 193 {\Aacute} % 00C1 LATIN CAPITAL LETTER A WITH ACUTE
+\defineactivetoken 194 {\Acircumflex} % 00C2 LATIN CAPITAL LETTER A WITH CIRCUMFLEX
+\defineactivetoken 195 {\Atilde} % 00C3 LATIN CAPITAL LETTER A WITH TILDE
+\defineactivetoken 196 {\Adiaeresis} % 00C4 LATIN CAPITAL LETTER A WITH DIAERESIS
+\defineactivetoken 197 {\Aring} % 00C5 LATIN CAPITAL LETTER A WITH RING ABOVE
+\defineactivetoken 198 {\AEligature} % 00C6 LATIN CAPITAL LETTER AE
+\defineactivetoken 199 {\Ccedilla} % 00C7 LATIN CAPITAL LETTER C WITH CEDILLA
+\defineactivetoken 200 {\Egrave} % 00C8 LATIN CAPITAL LETTER E WITH GRAVE
+\defineactivetoken 201 {\Eacute} % 00C9 LATIN CAPITAL LETTER E WITH ACUTE
+\defineactivetoken 202 {\Ecircumflex} % 00CA LATIN CAPITAL LETTER E WITH CIRCUMFLEX
+\defineactivetoken 203 {\Ediaeresis} % 00CB LATIN CAPITAL LETTER E WITH DIAERESIS
+\defineactivetoken 204 {\Igrave} % 00CC LATIN CAPITAL LETTER I WITH GRAVE
+\defineactivetoken 205 {\Iacute} % 00CD LATIN CAPITAL LETTER I WITH ACUTE
+\defineactivetoken 206 {\Icircumflex} % 00CE LATIN CAPITAL LETTER I WITH CIRCUMFLEX
+\defineactivetoken 207 {\Idiaeresis} % 00CF LATIN CAPITAL LETTER I WITH DIAERESIS
+\defineactivetoken 208 {\Gbreve} % 011E LATIN CAPITAL LETTER G WITH BREVE
+\defineactivetoken 209 {\Ntilde} % 00D1 LATIN CAPITAL LETTER N WITH TILDE
+\defineactivetoken 210 {\Ograve} % 00D2 LATIN CAPITAL LETTER O WITH GRAVE
+\defineactivetoken 211 {\Oacute} % 00D3 LATIN CAPITAL LETTER O WITH ACUTE
+\defineactivetoken 212 {\Ocircumflex} % 00D4 LATIN CAPITAL LETTER O WITH CIRCUMFLEX
+\defineactivetoken 213 {\Otilde} % 00D5 LATIN CAPITAL LETTER O WITH TILDE
+\defineactivetoken 214 {\Odiaeresis} % 00D6 LATIN CAPITAL LETTER O WITH DIAERESIS
+\defineactivetoken 215 {\textmultiply} % 00D7 MULTIPLICATION SIGN
+\defineactivetoken 216 {\Ostroke} % 00D8 LATIN CAPITAL LETTER O WITH STROKE
+\defineactivetoken 217 {\Ugrave} % 00D9 LATIN CAPITAL LETTER U WITH GRAVE
+\defineactivetoken 218 {\Uacute} % 00DA LATIN CAPITAL LETTER U WITH ACUTE
+\defineactivetoken 219 {\Ucircumflex} % 00DB LATIN CAPITAL LETTER U WITH CIRCUMFLEX
+\defineactivetoken 220 {\Udiaeresis} % 00DC LATIN CAPITAL LETTER U WITH DIAERESIS
+\defineactivetoken 221 {\Idotaccent} % 0130 LATIN CAPITAL LETTER I WITH DOT ABOVE
+\defineactivetoken 222 {\Scedilla} % 015E LATIN CAPITAL LETTER S WITH CEDILLA
+\defineactivetoken 223 {\ssharp} % 00DF LATIN SMALL LETTER SHARP S
+\defineactivetoken 224 {\agrave} % 00E0 LATIN SMALL LETTER A WITH GRAVE
+\defineactivetoken 225 {\aacute} % 00E1 LATIN SMALL LETTER A WITH ACUTE
+\defineactivetoken 226 {\acircumflex} % 00E2 LATIN SMALL LETTER A WITH CIRCUMFLEX
+\defineactivetoken 227 {\atilde} % 00E3 LATIN SMALL LETTER A WITH TILDE
+\defineactivetoken 228 {\adiaeresis} % 00E4 LATIN SMALL LETTER A WITH DIAERESIS
+\defineactivetoken 229 {\aring} % 00E5 LATIN SMALL LETTER A WITH RING ABOVE
+\defineactivetoken 230 {\aeligature} % 00E6 LATIN SMALL LETTER AE
+\defineactivetoken 231 {\ccedilla} % 00E7 LATIN SMALL LETTER C WITH CEDILLA
+\defineactivetoken 232 {\egrave} % 00E8 LATIN SMALL LETTER E WITH GRAVE
+\defineactivetoken 233 {\eacute} % 00E9 LATIN SMALL LETTER E WITH ACUTE
+\defineactivetoken 234 {\ecircumflex} % 00EA LATIN SMALL LETTER E WITH CIRCUMFLEX
+\defineactivetoken 235 {\ediaeresis} % 00EB LATIN SMALL LETTER E WITH DIAERESIS
+\defineactivetoken 236 {\igrave} % 00EC LATIN SMALL LETTER I WITH GRAVE
+\defineactivetoken 237 {\iacute} % 00ED LATIN SMALL LETTER I WITH ACUTE
+\defineactivetoken 238 {\icircumflex} % 00EE LATIN SMALL LETTER I WITH CIRCUMFLEX
+\defineactivetoken 239 {\idiaeresis} % 00EF LATIN SMALL LETTER I WITH DIAERESIS
+\defineactivetoken 240 {\gbreve} % 011F LATIN SMALL LETTER G WITH BREVE
+\defineactivetoken 241 {\ntilde} % 00F1 LATIN SMALL LETTER N WITH TILDE
+\defineactivetoken 242 {\ograve} % 00F2 LATIN SMALL LETTER O WITH GRAVE
+\defineactivetoken 243 {\oacute} % 00F3 LATIN SMALL LETTER O WITH ACUTE
+\defineactivetoken 244 {\ocircumflex} % 00F4 LATIN SMALL LETTER O WITH CIRCUMFLEX
+\defineactivetoken 245 {\otilde} % 00F5 LATIN SMALL LETTER O WITH TILDE
+\defineactivetoken 246 {\odiaeresis} % 00F6 LATIN SMALL LETTER O WITH DIAERESIS
+\defineactivetoken 247 {\textdiv} % 00F7 DIVISION SIGN
+\defineactivetoken 248 {\ostroke} % 00F8 LATIN SMALL LETTER O WITH STROKE
+\defineactivetoken 249 {\ugrave} % 00F9 LATIN SMALL LETTER U WITH GRAVE
+\defineactivetoken 250 {\uacute} % 00FA LATIN SMALL LETTER U WITH ACUTE
+\defineactivetoken 251 {\ucircumflex} % 00FB LATIN SMALL LETTER U WITH CIRCUMFLEX
+\defineactivetoken 252 {\udiaeresis} % 00FC LATIN SMALL LETTER U WITH DIAERESIS
+\defineactivetoken 253 {\dotlessi} % 0131 LATIN SMALL LETTER DOTLESS I
+\defineactivetoken 254 {\scedilla} % 015F LATIN SMALL LETTER S WITH CEDILLA
+\defineactivetoken 255 {\ydiaeresis} % 00FF LATIN SMALL LETTER Y WITH DIAERESIS
+
+\stopregime
+
diff --git a/tex/context/base/regi-cp1257.tex b/tex/context/base/regi-cp1257.tex
new file mode 100644
index 000000000..0790ef734
--- /dev/null
+++ b/tex/context/base/regi-cp1257.tex
@@ -0,0 +1,153 @@
+%D \module
+%D [ file=regi-cp1257,
+%D version=2005.12.26,
+%D title=\CONTEXT\ Encoding Macros,
+%D subtitle=cp1257 (Windows Baltic),
+%D author=script-generated,
+%D date=\currentdate,
+%D copyright=PRAGMA-ADE]
+%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 Support for cp1257 input encoding (regime) for Baltic languages,
+%D see also iso-8859-4 and iso-8859-13.
+%D
+%D Usage:
+%D \type{\enableregime[cp1257]} or \type{\enablereregime[windows-1257]}
+
+
+\startregime[cp1257]
+
+\defineactivetoken 128 {\texteuro} % 20AC EURO SIGN
+\defineactivetoken 129 {\unknownchar} % <undefined>
+\defineactivetoken 130 {\quotesinglebase} % 201A SINGLE LOW-9 QUOTATION MARK
+\defineactivetoken 131 {\unknownchar} % <undefined>
+\defineactivetoken 132 {\quotedblbase} % 201E DOUBLE LOW-9 QUOTATION MARK
+\defineactivetoken 133 {\textellipsis} % 2026 HORIZONTAL ELLIPSIS
+\defineactivetoken 134 {\textdag} % 2020 DAGGER
+\defineactivetoken 135 {\textddag} % 2021 DOUBLE DAGGER
+\defineactivetoken 136 {\unknownchar} % <undefined>
+\defineactivetoken 137 {\perthousand} % 2030 PER MILLE SIGN
+\defineactivetoken 138 {\unknownchar} % <undefined>
+\defineactivetoken 139 {\guilsingleleft} % 2039 SINGLE LEFT-POINTING ANGLE QUOTATION MARK
+\defineactivetoken 140 {\unknownchar} % <undefined>
+\defineactivetoken 141 {\textdiaeresis} % 00A8 DIAERESIS
+\defineactivetoken 142 {\textcaron} % 02C7 CARON
+\defineactivetoken 143 {\textcedilla} % 00B8 CEDILLA
+\defineactivetoken 144 {\unknownchar} % <undefined>
+\defineactivetoken 145 {\quoteleft} % 2018 LEFT SINGLE QUOTATION MARK
+\defineactivetoken 146 {\quoteright} % 2019 RIGHT SINGLE QUOTATION MARK
+\defineactivetoken 147 {\quotedblleft} % 201C LEFT DOUBLE QUOTATION MARK
+\defineactivetoken 148 {\quotedblright} % 201D RIGHT DOUBLE QUOTATION MARK
+\defineactivetoken 149 {\textbullet} % 2022 BULLET
+\defineactivetoken 150 {\endash} % 2013 EN DASH
+\defineactivetoken 151 {\emdash} % 2014 EM DASH
+\defineactivetoken 152 {\unknownchar} % <undefined>
+\defineactivetoken 153 {\trademark} % 2122 TRADE MARK SIGN
+\defineactivetoken 154 {\unknownchar} % <undefined>
+\defineactivetoken 155 {\guilsingleright} % 203A SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
+\defineactivetoken 156 {\unknownchar} % <undefined>
+\defineactivetoken 157 {\textmacron} % 00AF MACRON
+\defineactivetoken 158 {\textogonek} % 02DB OGONEK
+\defineactivetoken 159 {\unknownchar} % <undefined>
+\defineactivetoken 160 {\nonbreakablespace} % 00A0 NO-BREAK SPACE
+\defineactivetoken 161 {\unknownchar} % <undefined>
+\defineactivetoken 162 {\textcent} % 00A2 CENT SIGN
+\defineactivetoken 163 {\textsterling} % 00A3 POUND SIGN
+\defineactivetoken 164 {\textcurrency} % 00A4 CURRENCY SIGN
+\defineactivetoken 165 {\unknownchar} % <undefined>
+\defineactivetoken 166 {\textbrokenbar} % 00A6 BROKEN BAR
+\defineactivetoken 167 {\sectionmark} % 00A7 SECTION SIGN
+\defineactivetoken 168 {\Ostroke} % 00D8 LATIN CAPITAL LETTER O WITH STROKE
+\defineactivetoken 169 {\copyright} % 00A9 COPYRIGHT SIGN
+\defineactivetoken 170 {\Rcommaaccent} % 0156 LATIN CAPITAL LETTER R WITH CEDILLA
+\defineactivetoken 171 {\leftguillemot} % 00AB LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+\defineactivetoken 172 {\textlognot} % 00AC NOT SIGN
+\defineactivetoken 173 {\softhyphen} % 00AD SOFT HYPHEN
+\defineactivetoken 174 {\registered} % 00AE REGISTERED SIGN
+\defineactivetoken 175 {\AEligature} % 00C6 LATIN CAPITAL LETTER AE
+\defineactivetoken 176 {\textdegree} % 00B0 DEGREE SIGN
+\defineactivetoken 177 {\textpm} % 00B1 PLUS-MINUS SIGN
+\defineactivetoken 178 {\twosuperior} % 00B2 SUPERSCRIPT TWO
+\defineactivetoken 179 {\threesuperior} % 00B3 SUPERSCRIPT THREE
+\defineactivetoken 180 {\textacute} % 00B4 ACUTE ACCENT
+\defineactivetoken 181 {\textmu} % 00B5 MICRO SIGN
+\defineactivetoken 182 {\paragraphmark} % 00B6 PILCROW SIGN
+\defineactivetoken 183 {\periodcentered} % 00B7 MIDDLE DOT
+\defineactivetoken 184 {\ostroke} % 00F8 LATIN SMALL LETTER O WITH STROKE
+\defineactivetoken 185 {\onesuperior} % 00B9 SUPERSCRIPT ONE
+\defineactivetoken 186 {\rcommaaccent} % 0157 LATIN SMALL LETTER R WITH CEDILLA
+\defineactivetoken 187 {\rightguillemot} % 00BB RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+\defineactivetoken 188 {\onequarter} % 00BC VULGAR FRACTION ONE QUARTER
+\defineactivetoken 189 {\onehalf} % 00BD VULGAR FRACTION ONE HALF
+\defineactivetoken 190 {\threequarter} % 00BE VULGAR FRACTION THREE QUARTERS
+\defineactivetoken 191 {\aeligature} % 00E6 LATIN SMALL LETTER AE
+\defineactivetoken 192 {\Aogonek} % 0104 LATIN CAPITAL LETTER A WITH OGONEK
+\defineactivetoken 193 {\Iogonek} % 012E LATIN CAPITAL LETTER I WITH OGONEK
+\defineactivetoken 194 {\Amacron} % 0100 LATIN CAPITAL LETTER A WITH MACRON
+\defineactivetoken 195 {\Cacute} % 0106 LATIN CAPITAL LETTER C WITH ACUTE
+\defineactivetoken 196 {\Adiaeresis} % 00C4 LATIN CAPITAL LETTER A WITH DIAERESIS
+\defineactivetoken 197 {\Aring} % 00C5 LATIN CAPITAL LETTER A WITH RING ABOVE
+\defineactivetoken 198 {\Eogonek} % 0118 LATIN CAPITAL LETTER E WITH OGONEK
+\defineactivetoken 199 {\Emacron} % 0112 LATIN CAPITAL LETTER E WITH MACRON
+\defineactivetoken 200 {\Ccaron} % 010C LATIN CAPITAL LETTER C WITH CARON
+\defineactivetoken 201 {\Eacute} % 00C9 LATIN CAPITAL LETTER E WITH ACUTE
+\defineactivetoken 202 {\Zacute} % 0179 LATIN CAPITAL LETTER Z WITH ACUTE
+\defineactivetoken 203 {\Edotaccent} % 0116 LATIN CAPITAL LETTER E WITH DOT ABOVE
+\defineactivetoken 204 {\Gcommaaccent} % 0122 LATIN CAPITAL LETTER G WITH CEDILLA
+\defineactivetoken 205 {\Kcommaaccent} % 0136 LATIN CAPITAL LETTER K WITH CEDILLA
+\defineactivetoken 206 {\Imacron} % 012A LATIN CAPITAL LETTER I WITH MACRON
+\defineactivetoken 207 {\Lcommaaccent} % 013B LATIN CAPITAL LETTER L WITH CEDILLA
+\defineactivetoken 208 {\Scaron} % 0160 LATIN CAPITAL LETTER S WITH CARON
+\defineactivetoken 209 {\Nacute} % 0143 LATIN CAPITAL LETTER N WITH ACUTE
+\defineactivetoken 210 {\Ncommaaccent} % 0145 LATIN CAPITAL LETTER N WITH CEDILLA
+\defineactivetoken 211 {\Oacute} % 00D3 LATIN CAPITAL LETTER O WITH ACUTE
+\defineactivetoken 212 {\Omacron} % 014C LATIN CAPITAL LETTER O WITH MACRON
+\defineactivetoken 213 {\Otilde} % 00D5 LATIN CAPITAL LETTER O WITH TILDE
+\defineactivetoken 214 {\Odiaeresis} % 00D6 LATIN CAPITAL LETTER O WITH DIAERESIS
+\defineactivetoken 215 {\textmultiply} % 00D7 MULTIPLICATION SIGN
+\defineactivetoken 216 {\Uogonek} % 0172 LATIN CAPITAL LETTER U WITH OGONEK
+\defineactivetoken 217 {\Lstroke} % 0141 LATIN CAPITAL LETTER L WITH STROKE
+\defineactivetoken 218 {\Sacute} % 015A LATIN CAPITAL LETTER S WITH ACUTE
+\defineactivetoken 219 {\Umacron} % 016A LATIN CAPITAL LETTER U WITH MACRON
+\defineactivetoken 220 {\Udiaeresis} % 00DC LATIN CAPITAL LETTER U WITH DIAERESIS
+\defineactivetoken 221 {\Zdotaccent} % 017B LATIN CAPITAL LETTER Z WITH DOT ABOVE
+\defineactivetoken 222 {\Zcaron} % 017D LATIN CAPITAL LETTER Z WITH CARON
+\defineactivetoken 223 {\ssharp} % 00DF LATIN SMALL LETTER SHARP S
+\defineactivetoken 224 {\aogonek} % 0105 LATIN SMALL LETTER A WITH OGONEK
+\defineactivetoken 225 {\iogonek} % 012F LATIN SMALL LETTER I WITH OGONEK
+\defineactivetoken 226 {\amacron} % 0101 LATIN SMALL LETTER A WITH MACRON
+\defineactivetoken 227 {\cacute} % 0107 LATIN SMALL LETTER C WITH ACUTE
+\defineactivetoken 228 {\adiaeresis} % 00E4 LATIN SMALL LETTER A WITH DIAERESIS
+\defineactivetoken 229 {\aring} % 00E5 LATIN SMALL LETTER A WITH RING ABOVE
+\defineactivetoken 230 {\eogonek} % 0119 LATIN SMALL LETTER E WITH OGONEK
+\defineactivetoken 231 {\emacron} % 0113 LATIN SMALL LETTER E WITH MACRON
+\defineactivetoken 232 {\ccaron} % 010D LATIN SMALL LETTER C WITH CARON
+\defineactivetoken 233 {\eacute} % 00E9 LATIN SMALL LETTER E WITH ACUTE
+\defineactivetoken 234 {\zacute} % 017A LATIN SMALL LETTER Z WITH ACUTE
+\defineactivetoken 235 {\edotaccent} % 0117 LATIN SMALL LETTER E WITH DOT ABOVE
+\defineactivetoken 236 {\gcommaaccent} % 0123 LATIN SMALL LETTER G WITH CEDILLA
+\defineactivetoken 237 {\kcommaaccent} % 0137 LATIN SMALL LETTER K WITH CEDILLA
+\defineactivetoken 238 {\imacron} % 012B LATIN SMALL LETTER I WITH MACRON
+\defineactivetoken 239 {\lcommaaccent} % 013C LATIN SMALL LETTER L WITH CEDILLA
+\defineactivetoken 240 {\scaron} % 0161 LATIN SMALL LETTER S WITH CARON
+\defineactivetoken 241 {\nacute} % 0144 LATIN SMALL LETTER N WITH ACUTE
+\defineactivetoken 242 {\ncommaaccent} % 0146 LATIN SMALL LETTER N WITH CEDILLA
+\defineactivetoken 243 {\oacute} % 00F3 LATIN SMALL LETTER O WITH ACUTE
+\defineactivetoken 244 {\omacron} % 014D LATIN SMALL LETTER O WITH MACRON
+\defineactivetoken 245 {\otilde} % 00F5 LATIN SMALL LETTER O WITH TILDE
+\defineactivetoken 246 {\odiaeresis} % 00F6 LATIN SMALL LETTER O WITH DIAERESIS
+\defineactivetoken 247 {\textdiv} % 00F7 DIVISION SIGN
+\defineactivetoken 248 {\uogonek} % 0173 LATIN SMALL LETTER U WITH OGONEK
+\defineactivetoken 249 {\lstroke} % 0142 LATIN SMALL LETTER L WITH STROKE
+\defineactivetoken 250 {\sacute} % 015B LATIN SMALL LETTER S WITH ACUTE
+\defineactivetoken 251 {\umacron} % 016B LATIN SMALL LETTER U WITH MACRON
+\defineactivetoken 252 {\udiaeresis} % 00FC LATIN SMALL LETTER U WITH DIAERESIS
+\defineactivetoken 253 {\zdotaccent} % 017C LATIN SMALL LETTER Z WITH DOT ABOVE
+\defineactivetoken 254 {\zcaron} % 017E LATIN SMALL LETTER Z WITH CARON
+\defineactivetoken 255 {\textdotaccent} % 02D9 DOT ABOVE
+
+\stopregime
+
diff --git a/tex/context/base/regi-ini.tex b/tex/context/base/regi-ini.tex
index 34f157ea4..c13f054b9 100644
--- a/tex/context/base/regi-ini.tex
+++ b/tex/context/base/regi-ini.tex
@@ -37,6 +37,8 @@
\protect
% \useregime[def,uni,ibm,win,il1,mac]
-\useregime[def,uni,lat,win,il1,mac]
+\useregime[def,uni,iso-8858-1,iso-8858-2,cp1252,mac]
+
+% will become: \useregime[def,uni] % rest runtime
\endinput
diff --git a/tex/context/base/regi-il1.tex b/tex/context/base/regi-iso-8858-1.tex
index ec0155c04..dedba4969 100644
--- a/tex/context/base/regi-il1.tex
+++ b/tex/context/base/regi-iso-8858-1.tex
@@ -14,7 +14,7 @@
%D This module is not yet finished since some characters
%D need to be mapped onto symbols, which is work in progress.
-\startregime [il1]
+\startregime [iso-8858-1]
\defineactivetoken 180 {\textacute}
\defineactivetoken 146 {\textacute} % also see 180
diff --git a/tex/context/base/regi-lat.tex b/tex/context/base/regi-iso-8858-2.tex
index 7c1666ac6..7b6e2749a 100644
--- a/tex/context/base/regi-lat.tex
+++ b/tex/context/base/regi-iso-8858-2.tex
@@ -14,7 +14,7 @@
%D This file implements the ISO-8859-2 Central European character
%D set.
-\startregime[latin2]
+\startregime[iso-8858-2]
\defineactivetoken 160 {\nonbreakablespace} %   00A0 NO-BREAK SPACE
\defineactivetoken 161 {\Aogonek} % ¡ 0104 LATIN CAPITAL LETTER A WITH OGONEK
diff --git a/tex/context/base/regi-il9.tex b/tex/context/base/regi-iso-8859-15.tex
index 387404e4b..387404e4b 100644
--- a/tex/context/base/regi-il9.tex
+++ b/tex/context/base/regi-iso-8859-15.tex
diff --git a/tex/context/base/regi-grk.tex b/tex/context/base/regi-iso-8859-7.tex
index 848a4aba5..7cd4b6a30 100644
--- a/tex/context/base/regi-grk.tex
+++ b/tex/context/base/regi-iso-8859-7.tex
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\startregime[grk]
+\startregime[iso-8859-7]
%
% Uppercase Greek letters
diff --git a/tex/context/base/regi-syn.tex b/tex/context/base/regi-syn.tex
index 134114477..53f03f5a3 100644
--- a/tex/context/base/regi-syn.tex
+++ b/tex/context/base/regi-syn.tex
@@ -15,8 +15,54 @@
\unprotect
-\defineregimesynonym[cp-1250] [cp1250]
-\defineregimesynonym[windows-1250][cp1250]
-\defineregimesynonym[1250] [cp1250]
+\defineregimesynonym [windows-1250] [cp1250]
+\defineregimesynonym [windows-1251] [cp1251]
+\defineregimesynonym [windows-1252] [cp1252]
+\defineregimesynonym [windows-1253] [cp1253]
+\defineregimesynonym [windows-1254] [cp1254]
+%defineregimesynonym [windows-1255] [cp1255] % not supported yet (Hebrew)
+%defineregimesynonym [windows-1256] [cp1256] % not supported yet (Arabic)
+\defineregimesynonym [windows-1257] [cp1257]
+%defineregimesynonym [windows-1258] [cp1258] % not supported yet (Vietnamese)
+
+\defineregimesynonym [il1] [iso-8859-1]
+\defineregimesynonym [il2] [iso-8859-2]
+\defineregimesynonym [il3] [iso-8859-3]
+\defineregimesynonym [il4] [iso-8859-4]
+\defineregimesynonym [il5] [iso-8859-9]
+\defineregimesynonym [il6] [iso-8859-10]
+\defineregimesynonym [il7] [iso-8859-13]
+%defineregimesynonym [il8] [iso-8859-14]
+\defineregimesynonym [il9] [iso-8859-15]
+\defineregimesynonym [il10] [iso-8859-16]
+
+\defineregimesynonym [latin1] [iso-8859-1]
+\defineregimesynonym [latin2] [iso-8859-2]
+\defineregimesynonym [latin3] [iso-8859-3]
+\defineregimesynonym [latin4] [iso-8859-4]
+\defineregimesynonym [latin5] [iso-8859-9]
+\defineregimesynonym [latin6] [iso-8859-10]
+\defineregimesynonym [latin7] [iso-8859-13]
+%defineregimesynonym [latin8] [iso-8859-14]
+\defineregimesynonym [latin9] [iso-8859-15]
+\defineregimesynonym [latin10] [iso-8859-16]
+
+% kind of special
+
+\defineregimesynonym [utf-8] [utf]
+\defineregimesynonym [utf8] [utf]
+
+% for historical reasons / compatibility
+
+\defineregimesynonym [windows] [cp1252]
+\defineregimesynonym [win] [cp1252]
+\defineregimesynonym [grk] [iso-8859-7]
+
+% todo: regi-cyp has more in it
+%
+% some day mojca will figure out regi-cyp which has
+% multiple variants in it
+
+\defineregimesynonym [iso88595] [iso-8859-5]
\protect \endinput
diff --git a/tex/context/base/regi-vis.tex b/tex/context/base/regi-vis.tex
index ceac691c4..d1071354f 100644
--- a/tex/context/base/regi-vis.tex
+++ b/tex/context/base/regi-vis.tex
@@ -1,152 +1,158 @@
-% temporary module
+%D \module
+%D [ file=regi-vis,
+%D version=2005.12.26,
+%D title=\CONTEXT\ Encoding Macros,
+%D subtitle=viscii,
+%D author=script-generated,
+%D date=\currentdate,
+%D copyright=PRAGMA-ADE]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
-\startregime[viscii]
-
-\defineactivetoken 2 {\h{uA}}
-\defineactivetoken 5 {\~{uA}}
-\defineactivetoken 6 {\~{^A}}
-\defineactivetoken 20 {\h{Y}}
-\defineactivetoken 23 {\h{Y}}
-\defineactivetoken 24 {\d{Y}}
-\defineactivetoken 25 {\~{Y}}
-\defineactivetoken 30 {\d{Y}}
-
-\defineactivetoken 128 {\d{A}}
-\defineactivetoken 129 {\'{uA}}
-\defineactivetoken 130 {\`{uA}}
-\defineactivetoken 131 {\d{uA}}
-\defineactivetoken 132 {\'{^A}}
-\defineactivetoken 133 {\`{^A}}
-\defineactivetoken 134 {\h{^A}}
-\defineactivetoken 135 {\d{^A}}
-\defineactivetoken 136 {\~{E}}
-\defineactivetoken 137 {\d{E}}
-\defineactivetoken 138 {\'{^E}}
-\defineactivetoken 139 {\`{^E}}
-\defineactivetoken 140 {\h{^E}}
-\defineactivetoken 141 {\~{^E}}
-\defineactivetoken 142 {\d{^E}}
-\defineactivetoken 143 {\'{^O}}
-
-\defineactivetoken 144 {\`{^O}}
-\defineactivetoken 145 {\h{^O}}
-\defineactivetoken 146 {\~{^O}}
-\defineactivetoken 147 {\d{^O}}
-\defineactivetoken 148 {\d{hO}}
-\defineactivetoken 149 {\'{hO}}
-\defineactivetoken 150 {\`{hO}}
-\defineactivetoken 151 {\h{hO}}
-\defineactivetoken 152 {\d{I}}
-\defineactivetoken 153 {\h{O}}
-\defineactivetoken 154 {\d{O}}
-\defineactivetoken 155 {\h{I}}
-\defineactivetoken 156 {\h{U}}
-\defineactivetoken 157 {\~{U}}
-\defineactivetoken 158 {\d{U}}
-\defineactivetoken 159 {\`{Y}}
+%D Support for VISCII input encoding (regime) for Vietnamese.
+%D
+%D Usage:
+%D \type{\enableregime[vis]}
-\defineactivetoken 160 {\~{O}}
-\defineactivetoken 161 {\'{ua}}
-\defineactivetoken 162 {\`{ua}}
-\defineactivetoken 163 {\d{ua}}
-\defineactivetoken 164 {\'{^a}}
-\defineactivetoken 165 {\`{^a}}
-\defineactivetoken 166 {\h{^a}}
-\defineactivetoken 167 {\d{^a}}
-\defineactivetoken 168 {\~{e}}
-\defineactivetoken 169 {\d{ e}}
-\defineactivetoken 170 {\'{^e}}
-\defineactivetoken 171 {\`{^e}}
-\defineactivetoken 172 {\h{^e}}
-\defineactivetoken 173 {\~{^e}}
-\defineactivetoken 174 {\d{^e}}
-\defineactivetoken 175 {\'{^o}}
-\defineactivetoken 176 {\`{^o}}
-\defineactivetoken 177 {\h{^o}}
-\defineactivetoken 178 {\~{^o}}
-\defineactivetoken 179 {\~{hO}}
-\defineactivetoken 180 {\h{O}}
-\defineactivetoken 181 {\d{^o}}
-\defineactivetoken 182 {\`{ho}}
-\defineactivetoken 183 {\h{ho}}
-\defineactivetoken 184 {\d{i}}
-\defineactivetoken 185 {\d{hU}}
-\defineactivetoken 186 {\'{hU}}
-\defineactivetoken 187 {\`{hU}}
-\defineactivetoken 188 {\h{hU}}
-\defineactivetoken 189 {\h{o}}
-\defineactivetoken 190 {\'{ho}}
-\defineactivetoken 191 {\h{U}}
-
-\defineactivetoken 192 {\`{A}}
-\defineactivetoken 193 {\'{A}}
-\defineactivetoken 194 {\^{A}}
-\defineactivetoken 195 {\~{A}}
-\defineactivetoken 196 {\h{A}}
-\defineactivetoken 197 {\u{A}}
-\defineactivetoken 198 {\h{ua}}
-\defineactivetoken 199 {\~{ua}}
-\defineactivetoken 200 {\`{E}}
-\defineactivetoken 201 {\'{E}}
-\defineactivetoken 202 {\^{E}}
-\defineactivetoken 203 {\h{E}}
-\defineactivetoken 204 {\`{I}}
-\defineactivetoken 205 {\'{I}}
-\defineactivetoken 206 {\~{I}}
-\defineactivetoken 207 {\`{y}}
-
-\defineactivetoken 208 {\DJ{}}
-\defineactivetoken 209 {\'{hu}}
-\defineactivetoken 210 {\`{O}}
-\defineactivetoken 211 {\'{O}}
-\defineactivetoken 212 {\^{O}}
-\defineactivetoken 213 {\d{a}}
-\defineactivetoken 214 {\h{y}}
-\defineactivetoken 215 {\`{hu}}
-\defineactivetoken 216 {\h{hu}}
-\defineactivetoken 217 {\`{U}}
-\defineactivetoken 218 {\'{U}}
-\defineactivetoken 219 {\~{y}}
-\defineactivetoken 220 {\d{y}}
-\defineactivetoken 221 {\'{Y}}
-\defineactivetoken 222 {\~{ho}}
-\defineactivetoken 223 {\h{u}}
-
-\defineactivetoken 224 {\`{a}}
-\defineactivetoken 225 {\'{a}}
-\defineactivetoken 226 {\^{a}}
-\defineactivetoken 227 {\~{a}}
-\defineactivetoken 228 {\h{a}}
-\defineactivetoken 229 {\u{a}}
-\defineactivetoken 230 {\~{hu}}
-\defineactivetoken 231 {\~{^a}}
-\defineactivetoken 232 {\`{e}}
-\defineactivetoken 233 {\'{e}}
-\defineactivetoken 234 {\^{e}}
-\defineactivetoken 235 {\h{e}}
-\defineactivetoken 236 {\`{i}}
-\defineactivetoken 237 {\'{i}}
-\defineactivetoken 238 {\~{i}}
-\defineactivetoken 239 {\h{i}}
+\startregime[viscii]
-\defineactivetoken 240 {\dj{}}
-\defineactivetoken 241 {\d{hu}}
-\defineactivetoken 242 {\`{o}}
-\defineactivetoken 243 {\'{o}}
-\defineactivetoken 244 {\^{o}}
-\defineactivetoken 245 {\~{o}}
-\defineactivetoken 246 {\h{o}}
-\defineactivetoken 247 {\d{o}}
-\defineactivetoken 248 {\d{u}}
-\defineactivetoken 249 {\`{u}}
-\defineactivetoken 250 {\'{u}}
-\defineactivetoken 251 {\~{u}}
-\defineactivetoken 252 {\h{u}}
-\defineactivetoken 253 {\'{y}}
-\defineactivetoken 254 {\d{ho}}
-\defineactivetoken 255 {\~{hU}}
+\defineactivetoken 2 {\Abrevehook} % 1EB2 LATIN CAPITAL LETTER A WITH BREVE AND HOOK ABOVE
+\defineactivetoken 5 {\Abrevetilde} % 1EB4 LATIN CAPITAL LETTER A WITH BREVE AND TILDE
+\defineactivetoken 6 {\Acircumflextilde} % 1EAA LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND TILDE
+\defineactivetoken 20 {\Yhook} % 1EF6 LATIN CAPITAL LETTER Y WITH HOOK ABOVE
+\defineactivetoken 25 {\Ytilde} % 1EF8 LATIN CAPITAL LETTER Y WITH TILDE
+\defineactivetoken 30 {\Ydotbelow} % 1EF4 LATIN CAPITAL LETTER Y WITH DOT BELOW
+\defineactivetoken 128 {\Adotbelow} % 1EA0 LATIN CAPITAL LETTER A WITH DOT BELOW
+\defineactivetoken 129 {\Abreveacute} % 1EAE LATIN CAPITAL LETTER A WITH BREVE AND ACUTE
+\defineactivetoken 130 {\Abrevegrave} % 1EB0 LATIN CAPITAL LETTER A WITH BREVE AND GRAVE
+\defineactivetoken 131 {\Abrevedotbelow} % 1EB6 LATIN CAPITAL LETTER A WITH BREVE AND DOT BELOW
+\defineactivetoken 132 {\Acircumflexacute} % 1EA4 LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND ACUTE
+\defineactivetoken 133 {\Acircumflexgrave} % 1EA6 LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND GRAVE
+\defineactivetoken 134 {\Acircumflexhook} % 1EA8 LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND HOOK ABOVE
+\defineactivetoken 135 {\Acircumflexdotbelow} % 1EAC LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND DOT BELOW
+\defineactivetoken 136 {\Etilde} % 1EBC LATIN CAPITAL LETTER E WITH TILDE
+\defineactivetoken 137 {\Edotbelow} % 1EB8 LATIN CAPITAL LETTER E WITH DOT BELOW
+\defineactivetoken 138 {\Ecircumflexacute} % 1EBE LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND ACUTE
+\defineactivetoken 139 {\Ecircumflexgrave} % 1EC0 LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND GRAVE
+\defineactivetoken 140 {\Ecircumflexhook} % 1EC2 LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND HOOK ABOVE
+\defineactivetoken 141 {\Ecircumflextilde} % 1EC4 LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND TILDE
+\defineactivetoken 142 {\Ecircumflexdotbelow} % 1EC6 LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND DOT BELOW
+\defineactivetoken 143 {\Ocircumflexacute} % 1ED0 LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND ACUTE
+\defineactivetoken 144 {\Ocircumflexgrave} % 1ED2 LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND GRAVE
+\defineactivetoken 145 {\Ocircumflexhook} % 1ED4 LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND HOOK ABOVE
+\defineactivetoken 146 {\Ocircumflextilde} % 1ED6 LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND TILDE
+\defineactivetoken 147 {\Ocircumflexdotbelow} % 1ED8 LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND DOT BELOW
+\defineactivetoken 148 {\Ohorndotbelow} % 1EE2 LATIN CAPITAL LETTER O WITH HORN AND DOT BELOW
+\defineactivetoken 149 {\Ohornacute} % 1EDA LATIN CAPITAL LETTER O WITH HORN AND ACUTE
+\defineactivetoken 150 {\Ohorngrave} % 1EDC LATIN CAPITAL LETTER O WITH HORN AND GRAVE
+\defineactivetoken 151 {\Ohornhook} % 1EDE LATIN CAPITAL LETTER O WITH HORN AND HOOK ABOVE
+\defineactivetoken 152 {\Idotbelow} % 1ECA LATIN CAPITAL LETTER I WITH DOT BELOW
+\defineactivetoken 153 {\Ohook} % 1ECE LATIN CAPITAL LETTER O WITH HOOK ABOVE
+\defineactivetoken 154 {\Odotbelow} % 1ECC LATIN CAPITAL LETTER O WITH DOT BELOW
+\defineactivetoken 155 {\Ihook} % 1EC8 LATIN CAPITAL LETTER I WITH HOOK ABOVE
+\defineactivetoken 156 {\Uhook} % 1EE6 LATIN CAPITAL LETTER U WITH HOOK ABOVE
+\defineactivetoken 157 {\Utilde} % 0168 LATIN CAPITAL LETTER U WITH TILDE
+\defineactivetoken 158 {\Udotbelow} % 1EE4 LATIN CAPITAL LETTER U WITH DOT BELOW
+\defineactivetoken 159 {\Ygrave} % 1EF2 LATIN CAPITAL LETTER Y WITH GRAVE
+\defineactivetoken 160 {\Otilde} % 00D5 LATIN CAPITAL LETTER O WITH TILDE
+\defineactivetoken 161 {\abreveacute} % 1EAF LATIN SMALL LETTER A WITH BREVE AND ACUTE
+\defineactivetoken 162 {\abrevegrave} % 1EB1 LATIN SMALL LETTER A WITH BREVE AND GRAVE
+\defineactivetoken 163 {\abrevedotbelow} % 1EB7 LATIN SMALL LETTER A WITH BREVE AND DOT BELOW
+\defineactivetoken 164 {\acircumflexacute} % 1EA5 LATIN SMALL LETTER A WITH CIRCUMFLEX AND ACUTE
+\defineactivetoken 165 {\acircumflexgrave} % 1EA7 LATIN SMALL LETTER A WITH CIRCUMFLEX AND GRAVE
+\defineactivetoken 166 {\Acircumflexhook} % 1EA8 LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND HOOK ABOVE
+\defineactivetoken 167 {\acircumflexdotbelow} % 1EAD LATIN SMALL LETTER A WITH CIRCUMFLEX AND DOT BELOW
+\defineactivetoken 168 {\etilde} % 1EBD LATIN SMALL LETTER E WITH TILDE
+\defineactivetoken 169 {\edotbelow} % 1EB9 LATIN SMALL LETTER E WITH DOT BELOW
+\defineactivetoken 170 {\ecircumflexacute} % 1EBF LATIN SMALL LETTER E WITH CIRCUMFLEX AND ACUTE
+\defineactivetoken 171 {\ecircumflexgrave} % 1EC1 LATIN SMALL LETTER E WITH CIRCUMFLEX AND GRAVE
+\defineactivetoken 172 {\ecircumflexhook} % 1EC3 LATIN SMALL LETTER E WITH CIRCUMFLEX AND HOOK ABOVE
+\defineactivetoken 173 {\ecircumflextilde} % 1EC5 LATIN SMALL LETTER E WITH CIRCUMFLEX AND TILDE
+\defineactivetoken 174 {\ecircumflexdotbelow} % 1EC7 LATIN SMALL LETTER E WITH CIRCUMFLEX AND DOT BELOW
+\defineactivetoken 175 {\ocircumflexacute} % 1ED1 LATIN SMALL LETTER O WITH CIRCUMFLEX AND ACUTE
+\defineactivetoken 176 {\ocircumflexgrave} % 1ED3 LATIN SMALL LETTER O WITH CIRCUMFLEX AND GRAVE
+\defineactivetoken 177 {\ocircumflexhook} % 1ED5 LATIN SMALL LETTER O WITH CIRCUMFLEX AND HOOK ABOVE
+\defineactivetoken 178 {\ocircumflextilde} % 1ED7 LATIN SMALL LETTER O WITH CIRCUMFLEX AND TILDE
+\defineactivetoken 179 {\Ohorntilde} % 1EE0 LATIN CAPITAL LETTER O WITH HORN AND TILDE
+\defineactivetoken 180 {\Ohorn} % 01A0 LATIN CAPITAL LETTER O WITH HORN
+\defineactivetoken 181 {\ocircumflexdotbelow} % 1ED9 LATIN SMALL LETTER O WITH CIRCUMFLEX AND DOT BELOW
+\defineactivetoken 182 {\ohorngrave} % 1EDD LATIN SMALL LETTER O WITH HORN AND GRAVE
+\defineactivetoken 183 {\ohornhook} % 1EDF LATIN SMALL LETTER O WITH HORN AND HOOK ABOVE
+\defineactivetoken 184 {\idotbelow} % 1ECB LATIN SMALL LETTER I WITH DOT BELOW
+\defineactivetoken 185 {\Uhorndotbelow} % 1EF0 LATIN CAPITAL LETTER U WITH HORN AND DOT BELOW
+\defineactivetoken 186 {\Uhornacute} % 1EE8 LATIN CAPITAL LETTER U WITH HORN AND ACUTE
+\defineactivetoken 187 {\Uhorngrave} % 1EEA LATIN CAPITAL LETTER U WITH HORN AND GRAVE
+\defineactivetoken 188 {\Uhornhook} % 1EEC LATIN CAPITAL LETTER U WITH HORN AND HOOK ABOVE
+\defineactivetoken 189 {\ohorn} % 01A1 LATIN SMALL LETTER O WITH HORN
+\defineactivetoken 190 {\ohornacute} % 1EDB LATIN SMALL LETTER O WITH HORN AND ACUTE
+\defineactivetoken 191 {\Uhorn} % 01AF LATIN CAPITAL LETTER U WITH HORN
+\defineactivetoken 192 {\Agrave} % 00C0 LATIN CAPITAL LETTER A WITH GRAVE
+\defineactivetoken 193 {\Aacute} % 00C1 LATIN CAPITAL LETTER A WITH ACUTE
+\defineactivetoken 194 {\Acircumflex} % 00C2 LATIN CAPITAL LETTER A WITH CIRCUMFLEX
+\defineactivetoken 195 {\Atilde} % 00C3 LATIN CAPITAL LETTER A WITH TILDE
+\defineactivetoken 196 {\Ahook} % 1EA2 LATIN CAPITAL LETTER A WITH HOOK ABOVE
+\defineactivetoken 197 {\Abreve} % 0102 LATIN CAPITAL LETTER A WITH BREVE
+\defineactivetoken 198 {\abrevehook} % 1EB3 LATIN SMALL LETTER A WITH BREVE AND HOOK ABOVE
+\defineactivetoken 199 {\abrevetilde} % 1EB5 LATIN SMALL LETTER A WITH BREVE AND TILDE
+\defineactivetoken 200 {\Egrave} % 00C8 LATIN CAPITAL LETTER E WITH GRAVE
+\defineactivetoken 201 {\Eacute} % 00C9 LATIN CAPITAL LETTER E WITH ACUTE
+\defineactivetoken 202 {\Ecircumflex} % 00CA LATIN CAPITAL LETTER E WITH CIRCUMFLEX
+\defineactivetoken 203 {\Ehook} % 1EBA LATIN CAPITAL LETTER E WITH HOOK ABOVE
+\defineactivetoken 204 {\Igrave} % 00CC LATIN CAPITAL LETTER I WITH GRAVE
+\defineactivetoken 205 {\Iacute} % 00CD LATIN CAPITAL LETTER I WITH ACUTE
+\defineactivetoken 206 {\Itilde} % 0128 LATIN CAPITAL LETTER I WITH TILDE
+\defineactivetoken 207 {\ygrave} % 1EF3 LATIN SMALL LETTER Y WITH GRAVE
+\defineactivetoken 208 {\Dstroke} % 0110 LATIN CAPITAL LETTER D WITH STROKE
+\defineactivetoken 209 {\uhornacute} % 1EE9 LATIN SMALL LETTER U WITH HORN AND ACUTE
+\defineactivetoken 210 {\Ograve} % 00D2 LATIN CAPITAL LETTER O WITH GRAVE
+\defineactivetoken 211 {\Oacute} % 00D3 LATIN CAPITAL LETTER O WITH ACUTE
+\defineactivetoken 212 {\Ocircumflex} % 00D4 LATIN CAPITAL LETTER O WITH CIRCUMFLEX
+\defineactivetoken 213 {\adotbelow} % 1EA1 LATIN SMALL LETTER A WITH DOT BELOW
+\defineactivetoken 214 {\yhook} % 1EF7 LATIN SMALL LETTER Y WITH HOOK ABOVE
+\defineactivetoken 215 {\uhorngrave} % 1EEB LATIN SMALL LETTER U WITH HORN AND GRAVE
+\defineactivetoken 216 {\uhornhook} % 1EED LATIN SMALL LETTER U WITH HORN AND HOOK ABOVE
+\defineactivetoken 217 {\Ugrave} % 00D9 LATIN CAPITAL LETTER U WITH GRAVE
+\defineactivetoken 218 {\Uacute} % 00DA LATIN CAPITAL LETTER U WITH ACUTE
+\defineactivetoken 219 {\ytilde} % 1EF9 LATIN SMALL LETTER Y WITH TILDE
+\defineactivetoken 220 {\ydotbelow} % 1EF5 LATIN SMALL LETTER Y WITH DOT BELOW
+\defineactivetoken 221 {\Yacute} % 00DD LATIN CAPITAL LETTER Y WITH ACUTE
+\defineactivetoken 222 {\ohorntilde} % 1EE1 LATIN SMALL LETTER O WITH HORN AND TILDE
+\defineactivetoken 223 {\uhorn} % 01B0 LATIN SMALL LETTER U WITH HORN
+\defineactivetoken 224 {\agrave} % 00E0 LATIN SMALL LETTER A WITH GRAVE
+\defineactivetoken 225 {\aacute} % 00E1 LATIN SMALL LETTER A WITH ACUTE
+\defineactivetoken 226 {\acircumflex} % 00E2 LATIN SMALL LETTER A WITH CIRCUMFLEX
+\defineactivetoken 227 {\atilde} % 00E3 LATIN SMALL LETTER A WITH TILDE
+\defineactivetoken 228 {\ahook} % 1EA3 LATIN SMALL LETTER A WITH HOOK ABOVE
+\defineactivetoken 229 {\abreve} % 0103 LATIN SMALL LETTER A WITH BREVE
+\defineactivetoken 230 {\uhorntilde} % 1EEF LATIN SMALL LETTER U WITH HORN AND TILDE
+\defineactivetoken 231 {\acircumflextilde} % 1EAB LATIN SMALL LETTER A WITH CIRCUMFLEX AND TILDE
+\defineactivetoken 232 {\egrave} % 00E8 LATIN SMALL LETTER E WITH GRAVE
+\defineactivetoken 233 {\eacute} % 00E9 LATIN SMALL LETTER E WITH ACUTE
+\defineactivetoken 234 {\ecircumflex} % 00EA LATIN SMALL LETTER E WITH CIRCUMFLEX
+\defineactivetoken 235 {\ehook} % 1EBB LATIN SMALL LETTER E WITH HOOK ABOVE
+\defineactivetoken 236 {\igrave} % 00EC LATIN SMALL LETTER I WITH GRAVE
+\defineactivetoken 237 {\iacute} % 00ED LATIN SMALL LETTER I WITH ACUTE
+\defineactivetoken 238 {\itilde} % 0129 LATIN SMALL LETTER I WITH TILDE
+\defineactivetoken 239 {\ihook} % 1EC9 LATIN SMALL LETTER I WITH HOOK ABOVE
+\defineactivetoken 240 {\dstroke} % 0111 LATIN SMALL LETTER D WITH STROKE
+\defineactivetoken 241 {\uhorndotbelow} % 1EF1 LATIN SMALL LETTER U WITH HORN AND DOT BELOW
+\defineactivetoken 242 {\ograve} % 00F2 LATIN SMALL LETTER O WITH GRAVE
+\defineactivetoken 243 {\oacute} % 00F3 LATIN SMALL LETTER O WITH ACUTE
+\defineactivetoken 244 {\ocircumflex} % 00F4 LATIN SMALL LETTER O WITH CIRCUMFLEX
+\defineactivetoken 245 {\otilde} % 00F5 LATIN SMALL LETTER O WITH TILDE
+\defineactivetoken 246 {\ohook} % 1ECF LATIN SMALL LETTER O WITH HOOK ABOVE
+\defineactivetoken 247 {\odotbelow} % 1ECD LATIN SMALL LETTER O WITH DOT BELOW
+\defineactivetoken 248 {\udotbelow} % 1EE5 LATIN SMALL LETTER U WITH DOT BELOW
+\defineactivetoken 249 {\ugrave} % 00F9 LATIN SMALL LETTER U WITH GRAVE
+\defineactivetoken 250 {\uacute} % 00FA LATIN SMALL LETTER U WITH ACUTE
+\defineactivetoken 251 {\utilde} % 0169 LATIN SMALL LETTER U WITH TILDE
+\defineactivetoken 252 {\uhook} % 1EE7 LATIN SMALL LETTER U WITH HOOK ABOVE
+\defineactivetoken 253 {\yacute} % 00FD LATIN SMALL LETTER Y WITH ACUTE
+\defineactivetoken 254 {\ohorndotbelow} % 1EE3 LATIN SMALL LETTER O WITH HORN AND DOT BELOW
+\defineactivetoken 255 {\Uhorntilde} % 1EEE LATIN CAPITAL LETTER U WITH HORN AND TILDE
\stopregime
-\endinput
diff --git a/tex/context/base/regi-win.tex b/tex/context/base/regi-win.tex
deleted file mode 100644
index c9a301dff..000000000
--- a/tex/context/base/regi-win.tex
+++ /dev/null
@@ -1,150 +0,0 @@
-%D \module
-%D [ file=regi-win,
-%D version=1997.08.29,
-%D title=\CONTEXT\ Encoding Macros,
-%D subtitle=Windows 1252 ANSI keys,
-%D author={Tobias Burnus \& Hans Hagen \& Victor Figurnov},
-%D date=\currentdate,
-%D copyright=PRAGMA-ADE]
-%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 This module activates the (western) \MSWINDOWS\ high \ANSI\
-%D characters, such as ë and á.
-
-\startregime [windows]
-
-\defineactivetoken 128 {\texteuro}
-\defineactivetoken 129 {\unknownchar}
-\defineactivetoken 130 {\lowerleftsingleninequote}
-\defineactivetoken 131 {\textflorin}
-\defineactivetoken 132 {\lowerleftdoubleninequote}
-\defineactivetoken 133 {\dots}
-\defineactivetoken 134 {\textdag}
-\defineactivetoken 135 {\textddag}
-\defineactivetoken 136 {\textcircumflex}
-\defineactivetoken 137 {\perthousand}
-\defineactivetoken 138 {\Scaron}
-\defineactivetoken 139 {\leftsubguillemot}
-\defineactivetoken 140 {\OEligature}
-\defineactivetoken 141 {\unknownchar}
-\defineactivetoken 142 {\unknownchar}
-\defineactivetoken 143 {\unknownchar}
-\defineactivetoken 144 {\unknownchar}
-\defineactivetoken 145 {\upperleftsinglesixquote}
-\defineactivetoken 146 {\upperrightsingleninequote}
-\defineactivetoken 147 {\upperleftdoublesixquote}
-\defineactivetoken 148 {\upperrightdoubleninequote}
-\defineactivetoken 149 {\textbullet}
-\defineactivetoken 150 {\endash}
-\defineactivetoken 151 {\emdash}
-\defineactivetoken 152 {\texttilde}
-\defineactivetoken 153 {\trademark}
-\defineactivetoken 154 {\scaron}
-\defineactivetoken 155 {\rightsubguillemot}
-\defineactivetoken 156 {\oeligature}
-\defineactivetoken 157 {\unknownchar}
-\defineactivetoken 158 {\unknownchar}
-\defineactivetoken 159 {\Ydiaeresis}
-\defineactivetoken 160 {\nonbreakablespace}
-\defineactivetoken 161 {\exclamdown}
-\defineactivetoken 162 {\textcent}
-\defineactivetoken 163 {\textsterling}
-\defineactivetoken 164 {\textcurrency}
-\defineactivetoken 165 {\textyen}
-\defineactivetoken 166 {\textbrokenbar}
-\defineactivetoken 167 {\sectionmark}
-\defineactivetoken 168 {\textdiaeresis}
-\defineactivetoken 169 {\copyright}
-\defineactivetoken 170 {\ordfeminine}
-\defineactivetoken 171 {\leftguillemot}
-\defineactivetoken 172 {\textlognot}
-\defineactivetoken 173 {\hyphen}
-\defineactivetoken 174 {\registered}
-\defineactivetoken 175 {\textmacron}
-\defineactivetoken 176 {\textdegree}
-\defineactivetoken 177 {\textpm}
-\defineactivetoken 178 {\twosuperior}
-\defineactivetoken 179 {\threesuperior}
-\defineactivetoken 180 {\textacute}
-\defineactivetoken 181 {\textmu}
-\defineactivetoken 182 {\paragraphmark}
-\defineactivetoken 183 {\periodcentered}
-\defineactivetoken 184 {\textcedilla}
-\defineactivetoken 185 {\onesuperior}
-\defineactivetoken 186 {\ordmasculine}
-\defineactivetoken 187 {\rightguillemot}
-\defineactivetoken 188 {\onequarter}
-\defineactivetoken 189 {\onehalf}
-\defineactivetoken 190 {\threequarter}
-\defineactivetoken 191 {\questiondown}
-\defineactivetoken 192 {\Agrave}
-\defineactivetoken 193 {\Aacute}
-\defineactivetoken 194 {\Acircumflex}
-\defineactivetoken 195 {\Atilde}
-\defineactivetoken 196 {\Adiaeresis}
-\defineactivetoken 197 {\Aring}
-\defineactivetoken 198 {\AEligature}
-\defineactivetoken 199 {\Ccedilla}
-\defineactivetoken 200 {\Egrave}
-\defineactivetoken 201 {\Eacute}
-\defineactivetoken 202 {\Ecircumflex}
-\defineactivetoken 203 {\Ediaeresis}
-\defineactivetoken 204 {\Igrave}
-\defineactivetoken 205 {\Iacute}
-\defineactivetoken 206 {\Icircumflex}
-\defineactivetoken 207 {\Idiaeresis}
-\defineactivetoken 208 {\Eth}
-\defineactivetoken 209 {\Ntilde}
-\defineactivetoken 210 {\Ograve}
-\defineactivetoken 211 {\Oacute}
-\defineactivetoken 212 {\Ocircumflex}
-\defineactivetoken 213 {\Otilde}
-\defineactivetoken 214 {\Odiaeresis}
-\defineactivetoken 215 {\textmultiply}
-\defineactivetoken 216 {\Ostroke}
-\defineactivetoken 217 {\Ugrave}
-\defineactivetoken 218 {\Uacute}
-\defineactivetoken 219 {\Ucircumflex}
-\defineactivetoken 220 {\Udiaeresis}
-\defineactivetoken 221 {\Ygrave}
-\defineactivetoken 222 {\thorn}
-\defineactivetoken 223 {\ssharp}
-\defineactivetoken 224 {\agrave}
-\defineactivetoken 225 {\aacute}
-\defineactivetoken 226 {\acircumflex}
-\defineactivetoken 227 {\atilde}
-\defineactivetoken 228 {\adiaeresis}
-\defineactivetoken 229 {\aring}
-\defineactivetoken 230 {\aeligature}
-\defineactivetoken 231 {\ccedilla}
-\defineactivetoken 232 {\egrave}
-\defineactivetoken 233 {\eacute}
-\defineactivetoken 234 {\ecircumflex}
-\defineactivetoken 235 {\ediaeresis}
-\defineactivetoken 236 {\igrave}
-\defineactivetoken 237 {\iacute}
-\defineactivetoken 238 {\icircumflex}
-\defineactivetoken 239 {\idiaeresis}
-\defineactivetoken 240 {\eth}
-\defineactivetoken 241 {\ntilde}
-\defineactivetoken 242 {\ograve}
-\defineactivetoken 243 {\oacute}
-\defineactivetoken 244 {\ocircumflex}
-\defineactivetoken 245 {\otilde}
-\defineactivetoken 246 {\odiaeresis}
-\defineactivetoken 247 {\textdiv}
-\defineactivetoken 248 {\ostroke}
-\defineactivetoken 249 {\ugrave}
-\defineactivetoken 250 {\uacute}
-\defineactivetoken 251 {\ucircumflex}
-\defineactivetoken 252 {\udiaeresis}
-\defineactivetoken 253 {\ygrave}
-\defineactivetoken 254 {\Thorn}
-\defineactivetoken 255 {\ydiaeresis}
-
-\stopregime
-
-\endinput
diff --git a/tex/context/base/x-newmme.tex b/tex/context/base/x-newmme.tex
new file mode 100644
index 000000000..9763de114
--- /dev/null
+++ b/tex/context/base/x-newmme.tex
@@ -0,0 +1,429 @@
+%D \module
+%D [ file=m-newmme,
+%D version=2005.06.10, % 1999.12.20,
+%D title=\CONTEXT\ XML Modules,
+%D subtitle=MathML Entities,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\writestatus{loading}{Context XML Macros (MathML Entities)}
+
+\unprotect
+
+%D Used in the manual:
+
+\def\showMMLentity#1%
+ {\bgroup
+ \doifXMLentityelse{#1}
+ {\let\MMLleft\empty\let\MMLright\empty\mathematics{\getXMLentity{#1}{}}}
+ {\getXMLentity{unknown}}%
+ \egroup}
+
+\newbox\unknownXMLentity
+\setbox\unknownXMLentity\hbox{\inframed[\c!strut=\v!no,\c!offset=1pt]{\ttx ?}}
+
+\defineXMLentity [unknown] {\copy\unknownXMLentity}
+
+%D A (not really needed) precaution:
+
+\ifx\blackboard\undefined
+ \def\blackboard{\ifx\Bbb\undefined\else\expandafter\Bbb\fi}
+\fi
+
+%D Basic entities, greek:
+
+\defineXMLentity [alpha] {\mathematics \alpha}
+\defineXMLentity [beta] {\mathematics \beta}
+\defineXMLentity [gamma] {\mathematics \gamma}
+\defineXMLentity [delta] {\mathematics \delta}
+\defineXMLentity [epsilon] {\mathematics \epsilon}
+\defineXMLentity [zeta] {\mathematics \zeta}
+\defineXMLentity [eta] {\mathematics \eta}
+\defineXMLentity [theta] {\mathematics \theta}
+\defineXMLentity [iota] {\mathematics \iota}
+\defineXMLentity [kappa] {\mathematics \kappa}
+\defineXMLentity [lambda] {\mathematics \lambda}
+\defineXMLentity [theta] {\mathematics \theta}
+\defineXMLentity [mu] {\mathematics \mu}
+\defineXMLentity [nu] {\mathematics \nu}
+\defineXMLentity [xi] {\mathematics \xi}
+\defineXMLentity [pi] {\mathematics \pi}
+\defineXMLentity [rho] {\mathematics \rho}
+\defineXMLentity [sigma] {\mathematics \sigma}
+\defineXMLentity [tau] {\mathematics \tau}
+\defineXMLentity [upsilon] {\mathematics \upsilon}
+\defineXMLentity [phi] {\mathematics \phi}
+\defineXMLentity [chi] {\mathematics \chi}
+\defineXMLentity [psi] {\mathematics \psi}
+\defineXMLentity [omega] {\mathematics \omega}
+
+\defineXMLentity [varepsilon] {\mathematics \varepsilon}
+\defineXMLentity [vartheta] {\mathematics \vartheta}
+\defineXMLentity [varpi] {\mathematics \varpi}
+\defineXMLentity [varrho] {\mathematics \varrho}
+\defineXMLentity [varsigma] {\mathematics \varsigma}
+\defineXMLentity [varphi] {\mathematics \varphi}
+
+\defineXMLentity [epsilonv] {\mathematics \varepsilon}
+\defineXMLentity [thetav] {\mathematics \vartheta}
+\defineXMLentity [piv] {\mathematics \varpi}
+\defineXMLentity [rhov] {\mathematics \varrho}
+\defineXMLentity [sigmav] {\mathematics \varsigma}
+\defineXMLentity [phiv] {\mathematics \varphi}
+
+\defineXMLentity [epsi] {\mathematics \epsilon}
+\defineXMLentity [epsiv] {\mathematics \varepsilon}
+
+\defineXMLentity [Alpha] {A}
+\defineXMLentity [Beta] {B}
+\defineXMLentity [Gamma] {\mathematics \Gamma}
+\defineXMLentity [Delta] {\mathematics \Delta}
+\defineXMLentity [Epsilon] {E}
+\defineXMLentity [Zeta] {Z}
+\defineXMLentity [Eta] {N}
+\defineXMLentity [Theta] {\mathematics \Theta}
+\defineXMLentity [Iota] {I}
+\defineXMLentity [Kappa] {K}
+\defineXMLentity [Lambda] {\mathematics \Lambda}
+\defineXMLentity [Mu] {M}
+\defineXMLentity [Nu] {N}
+\defineXMLentity [Xi] {\mathematics \Xi}
+\defineXMLentity [Pi] {\mathematics \Pi}
+\defineXMLentity [Ro] {R}
+\defineXMLentity [Sigma] {\mathematics \Sigma}
+\defineXMLentity [Tau] {T}
+\defineXMLentity [Upsilon] {\mathematics \Upsilon}
+\defineXMLentity [Phi] {\mathematics \Phi}
+\defineXMLentity [Chi] {X}
+\defineXMLentity [Psi] {\mathematics \Psi}
+\defineXMLentity [Omega] {\mathematics \Omega}
+
+%D Basic entities, hebrew:
+
+\defineXMLentity [aleph] {\mathematics \aleph}
+
+%D Basic entities, functions:
+
+\defineXMLentity [abs] {\mathopnolimits{abs}}
+\defineXMLentity [arg] {\mathopnolimits{arg}}
+\defineXMLentity [codomain] {\mathopnolimits{codomain}}
+\defineXMLentity [curl] {\mathopnolimits{curl}}
+\defineXMLentity [determinant] {\mathopnolimits{det}}
+\defineXMLentity [divergence] {\mathopnolimits{div}}
+\defineXMLentity [domain] {\mathopnolimits{domain}}
+\defineXMLentity [false] {\mathopnolimits{false}}
+\defineXMLentity [gcd] {\mathopnolimits{gcd}}
+\defineXMLentity [grad] {\mathopnolimits{grad}}
+\defineXMLentity [identity] {\mathopnolimits{id}}
+\defineXMLentity [image] {\mathopnolimits{image}}
+\defineXMLentity [lcm] {\mathopnolimits{lcm}}
+\defineXMLentity [max] {\mathopnolimits{max}}
+\defineXMLentity [median] {\mathopnolimits{median}}
+\defineXMLentity [min] {\mathopnolimits{min}}
+\defineXMLentity [mode] {\mathopnolimits{mode}}
+\defineXMLentity [mod] {\mathopnolimits{mod}}
+\defineXMLentity [notanumber] {\mathopnolimits{NaN}}
+\defineXMLentity [otherwise] {\mathopnolimits{otherwise}}
+\defineXMLentity [true] {\mathopnolimits{true}}
+\defineXMLentity [declare] {\mathopnolimits{declare}}
+\defineXMLentity [as] {\mathopnolimits{as}}
+\defineXMLentity [polar] {\mathopnolimits{Polar}}
+
+\defineXMLentity [mathematicald] {d}
+
+\defineXMLentity [imaginaryi] {{\rm i}}
+\defineXMLentity [differentiald] {\partial}
+\defineXMLentity [exponentiale] {{\rm e}}
+\defineXMLentity [capitaldifferentiald] {D}
+
+\defineXMLentity [ii] {\getXMLentity{imaginaryi}}
+\defineXMLentity [dd] {\getXMLentity{differentiald}}
+\defineXMLentity [ee] {\getXMLentity{exponentiale}}
+\defineXMLentity [DD] {\getMMLentity{capitaldifferentiald}}
+
+\defineXMLentity [ImaginaryI] {\getXMLentity{imaginaryi}}
+\defineXMLentity [DifferentialD] {\getXMLentity{differentiald}}
+\defineXMLentity [ExponentialE] {\getXMLentity{exponentiale}}
+\defineXMLentity [CapitalDifferentialD] {\getXMLentity{differentiald}}
+
+\defineXMLentity [NaN] {\getXMLentity{notanumber}}
+\defineXMLentity [NotANumber] {\getXMLentity{notanumber}}
+
+\defineXMLentity [and] {\wedge}
+\defineXMLentity [exists] {\exists}
+\defineXMLentity [forall] {\forall}
+\defineXMLentity [implies] {\Rightarrow}
+\defineXMLentity [not] {\neg}
+\defineXMLentity [or] {\vee}
+\defineXMLentity [xor] {\mathopnolimits{xor}}
+
+\defineXMLentity [imaginary] {\Im}
+\defineXMLentity [real] {\Re}
+
+\defineXMLentity [lceiling] {\lceil}
+\defineXMLentity [rceiling] {\rceil}
+
+\defineXMLentity [lfloor] {\lfloor}
+\defineXMLentity [rfloor] {\rfloor}
+
+\defineXMLentity [ne] {\neq}
+\defineXMLentity [neq] {\neq}
+\defineXMLentity [gt] {>}
+\defineXMLentity [lt] {<}
+\defineXMLentity [ge] {\geq}
+\defineXMLentity [geq] {\geq}
+\defineXMLentity [le] {\leq}
+\defineXMLentity [leq] {\leq}
+
+\defineXMLentity [equivalent] {\equiv}
+\defineXMLentity [equiv] {\equiv}
+\defineXMLentity [approx] {\approx}
+
+\defineXMLentity [factorof] {\mid}
+\defineXMLentity [mapsto] {\mapsto}
+
+\defineXMLentity [int] {\int}
+\defineXMLentity [prime] {\prime}
+\defineXMLentity [laplacian] {\nabla^2}
+\defineXMLentity [partial] {\partial}
+
+\defineXMLentity [union] {\cup}
+\defineXMLentity [intersect] {\cap}
+\defineXMLentity [in] {\in}
+\defineXMLentity [notin] {\not\in}
+\defineXMLentity [subset] {\subset}
+\defineXMLentity [prsubset] {\subseteq}
+\defineXMLentity [notsubset] {\not\subset}
+\defineXMLentity [notprsubset] {\not\subseteq}
+\defineXMLentity [setdiff] {\setminus}
+
+\defineXMLentity [card] {\vert}
+\defineXMLentity [cartesianproduct] {\times}
+
+\defineXMLentity [sum] {\sum}
+\defineXMLentity [prod] {\prod}
+\defineXMLentity [product] {\prod}
+\defineXMLentity [lim] {\lim}
+
+\defineXMLentity [exp] {\mathopnolimits{exp}} % {\exp}
+\defineXMLentity [ln] {\mathopnolimits{ln}} % {\ln}
+\defineXMLentity [log] {\mathopnolimits{log}} % {\log}
+
+\defineXMLentity [sin] {\mathopnolimits{sin}}
+\defineXMLentity [arcsin] {\mathopnolimits{arcsin}}
+\defineXMLentity [sinh] {\mathopnolimits{sinh}}
+\defineXMLentity [arcsinh] {\mathopnolimits{arcsinh}}
+\defineXMLentity [cos] {\mathopnolimits{cos}}
+\defineXMLentity [arccos] {\mathopnolimits{arccos}}
+\defineXMLentity [cosh] {\mathopnolimits{cosh}}
+\defineXMLentity [arccosh] {\mathopnolimits{arccosh}}
+\defineXMLentity [tan] {\mathopnolimits{tan}}
+\defineXMLentity [arctan] {\mathopnolimits{arctan}}
+\defineXMLentity [tanh] {\mathopnolimits{tanh}}
+\defineXMLentity [arctanh] {\mathopnolimits{arctanh}}
+\defineXMLentity [cot] {\mathopnolimits{cot}}
+\defineXMLentity [arccot] {\mathopnolimits{arccot}}
+\defineXMLentity [coth] {\mathopnolimits{coth}}
+\defineXMLentity [arccoth] {\mathopnolimits{arccoth}}
+\defineXMLentity [csc] {\mathopnolimits{csc}}
+\defineXMLentity [arccsc] {\mathopnolimits{arccsc}}
+\defineXMLentity [csch] {\mathopnolimits{csch}}
+\defineXMLentity [arccsch] {\mathopnolimits{arccsch}}
+\defineXMLentity [sec] {\mathopnolimits{sec}}
+\defineXMLentity [arcsec] {\mathopnolimits{arcsec}}
+\defineXMLentity [sech] {\mathopnolimits{sech}}
+\defineXMLentity [arcsech] {\mathopnolimits{arcsech}}
+
+\defineXMLentity [transpose] {^{\rm T}}
+
+\defineXMLentity [plusminus] {\mathematics{\pm}}
+\defineXMLentity [minusplus] {\mathematics{\mp}}
+
+\defineXMLentity [vectorproduct] {\times}
+\defineXMLentity [scalarproduct] {\cdot}
+\defineXMLentity [outerproduct] {\otimes}
+
+\defineXMLentity [integers] {\integers}
+\defineXMLentity [reals] {\reals}
+\defineXMLentity [rationals] {\rationals}
+\defineXMLentity [naturalnumbers] {\naturalnumbers}
+\defineXMLentity [complexes] {\complexes}
+\defineXMLentity [primes] {\primes}
+
+\defineXMLentity [emptyset] {\emptyset}
+\defineXMLentity [pi] {\pi}
+\defineXMLentity [eulergamma] {\gamma}
+\defineXMLentity [infinity] {\mathematics{\infty}}
+
+\defineXMLentity [InvisibleTimes] {}
+\defineXMLentity [InvisibleComma] {}
+\defineXMLentity [ApplyFunction] {}
+
+\defineXMLentity [it] {\getXMLentity{InvisibleTines}}
+\defineXMLentity [ic] {\getXMLentity{InvisibleComma}}
+\defineXMLentity [af] {\getXMLentity{ApplyFunction}}
+
+\defineXMLentity [PlusMinus] {\getXMLentity{plusminus}}
+
+\defineXMLentity [infin] {\getXMLentity{infinity}}
+\defineXMLentity [infty] {\getXMLentity{infinity}}
+\defineXMLentity [part] {\getXMLentity{differentiald}}
+
+\defineXMLentity [RightArrow] {\normalorfiller\rightarrow\rightarrowfill}
+\defineXMLentity [LeftArrow] {\normalorfiller\leftarrow\leftarrowfill}
+\defineXMLentity [UnderBrace] {\normalorfiller\empty\upbracefill}
+\defineXMLentity [OverBrace] {\normalorfiller\empty\downbracefill}
+\defineXMLentity [UnderBar] {\normalorfiller\hrule\hrulefill}
+\defineXMLentity [OverBar] {\normalorfiller\hrule\hrulefill}
+\defineXMLentity [Hat] {\normalorfiller\empty\empty} % todo
+
+\defineXMLentity [downarrow] {\mathortext\downarrow\empty}
+\defineXMLentity [uparrow] {\mathortext\uparrow\empty}
+
+\defineXMLentity [Tab] {\hskip4em}
+\defineXMLentity [NewLine] {\mathortext\empty\crlf}
+\defineXMLentity [IndentingNewLine] {\mathortext\empty\crlf}
+
+\defineXMLentity [NoBreak] {\nobreak}
+\defineXMLentity [GoodBreak] {\goodbreak}
+\defineXMLentity [BadBreak] {\nobreak}
+
+\defineXMLentity [Space] {\getXMLentity{MediumSpace}}
+\defineXMLentity [NonBreakingSpace] {\getXMLentity{MediumSpace}}
+\defineXMLentity [ZeroWidthSpace] {}
+
+\def\somespaceentity#1#2%
+ {\mathortext
+ {\mskip#1mu}
+ {\ifvmode\dontleavehmode\else\unskip\fi\hskip#2em\strut\hskip\zeropoint\ignorespaces}%
+ \relax}
+
+\defineXMLentity [VeryThinSpace] {\somespaceentity {2}{.125}}
+\defineXMLentity [ThinSpace] {\somespaceentity {3}{.25}}
+\defineXMLentity [MediumSpace] {\somespaceentity {4}{.5}}
+\defineXMLentity [ThickSpace] {\somespaceentity {5}{1}}
+\defineXMLentity [NegativeVeryThinSpace] {\somespaceentity{-2}{-.125}}
+\defineXMLentity [NegativeThinSpace] {\somespaceentity{-3}{-.25}}
+\defineXMLentity [NegativeMediumSpace] {\somespaceentity{-4}{-.5}}
+\defineXMLentity [NegativeThickSpace] {\somespaceentity{-5}{-1}}
+
+\defineXMLentity [NegVeryThinSpace] {\getXMLentity{NegativeVeryThinSpace}}
+\defineXMLentity [NegThinSpace] {\getXMLentity{NegativeThinSpace}}
+\defineXMLentity [NegMediumSpace] {\getXMLentity{NegativeMediumSpace}}
+\defineXMLentity [NegThickSpace] {\getXMLentity{NegativeThickSpace}}
+
+\defineXMLentity [nbsp] {\getXMLentity{NonBreakingSpace}}
+\defineXMLentity [thinsp] {\getXMLentity{ThinSpace}}
+\defineXMLentity [medsp] {\getXMLentity{MediumSpace}}
+\defineXMLentity [thicksp] {\getXMLentity{ThickSpace}}
+
+\defineXMLentity [larr] {\getXMLentity{LeftArrow}}
+\defineXMLentity [rarr] {\getXMLentity{RightArrow}}
+
+\ifx\MMLleft \undefined \let\MMLleft \firstofoneargument \fi
+\ifx\MMLright\undefined \let\MMLright\firstofoneargument \fi
+
+
+\defineXMLentity [lbrace] {\normalordelimiter{\{}{\MMLleft \{}}
+\defineXMLentity [rbrace] {\normalordelimiter{\}}{\MMLright\}}}
+\defineXMLentity [lbracket] {\normalordelimiter{[}{\MMLleft [}}
+\defineXMLentity [rbracket] {\normalordelimiter{]}{\MMLright]}}
+\defineXMLentity [lparenthesis] {\normalordelimiter{(}{\MMLleft (}}
+\defineXMLentity [rparenthesis] {\normalordelimiter{)}{\MMLright)}}
+\defineXMLentity [langle] {\normalordelimiter{\langle}{\MMLleft \langle}}
+\defineXMLentity [rangle] {\normalordelimiter{\rangle}{\MMLright\rangle}}
+
+\defineXMLentity [lang] {\getXMLentity{langle}}
+\defineXMLentity [rang] {\getXMLentity{rangle}}
+\defineXMLentity [lbrack] {\getXMLentity{lbracket}}
+\defineXMLentity [rbrack] {\getXMLentity{rbracket}}
+\defineXMLentity [lparent] {\getXMLentity{lparenthesis}}
+\defineXMLentity [rparent] {\getXMLentity{rparenthesis}}
+
+% \bgroup
+% \catcode`\{=12 \doglobal\convertargument{\to\mmllbrace
+% \catcode`\}=12 \doglobal\convertargument}\to\mmlrbrace
+% \egroup
+
+% \expanded{\defineXMLentity[\mmllbrace]}{\getXMLentity{lbrace}}
+% \expanded{\defineXMLentity[\mmlrbrace]}{\getXMLentity{rbrace}}
+
+\expanded{\defineXMLentity[\iftrue \string{\else}\fi]}{\getXMLentity{lbrace}}
+\expanded{\defineXMLentity[\iffalse{\else\string}\fi]}{\getXMLentity{rbrace}}
+
+\defineXMLentity [{[}] {\getXMLentity{lbracket}}
+\defineXMLentity [{]}] {\getXMLentity{rbracket}}
+\defineXMLentity [{(}] {\getXMLentity{lparenthesis}}
+\defineXMLentity [{)}] {\getXMLentity{rparenthesis}}
+
+\defineXMLentity [times] {\mathematics{\times}}
+\defineXMLentity [minus] {\mathematics{-}}
+\defineXMLentity [plus] {\mathematics{+}}
+\defineXMLentity [plusmn] {\mathematics{\pm}}
+
+\defineXMLentity [nabla] {\nabla}
+
+\def\myspecialnormalvert {\mathematics{\vert}}
+\def\myspecialstretchvert{\;\vrule\;}
+
+\defineXMLentity [,] {{,}}
+\defineXMLentity [.] {{.}}
+\defineXMLentity [+] {+}
+\defineXMLentity [-] {-}
+\defineXMLentity [(] {(}
+\defineXMLentity [)] {)}
+\defineXMLentity [<] {\mathematics{<}}
+\defineXMLentity [>] {\mathematics{>}}
+\defineXMLentity [|] {\myspecialnormalvert}
+\defineXMLentity [/] {/}
+\defineXMLentity [*] {\times}
+\defineXMLentity [=] {=}
+
+% \defineXMLentity [(] {\MMLleft (}
+% \defineXMLentity [)] {\MMLright)}
+
+% \defineXMLentity [{[}] {\MMLleft [}
+% \defineXMLentity [{]}] {\MMLright]}
+
+\defineXMLentity [++] {++}
+\defineXMLentity [--] {--}
+\defineXMLentity [//] {//}
+\defineXMLentity [**] {\times\times}
+\defineXMLentity [==] {==}
+
+\defineXMLentity [quot] {"}
+
+\defineXMLentity [triangle] {\mathematics\triangle}
+\defineXMLentity [otimes] {\mathematics\otimes}
+\defineXMLentity [oplus] {\mathematics\oplus}
+\defineXMLentity [cup] {\mathematics\cup}
+\defineXMLentity [cap] {\mathematics\cap}
+\defineXMLentity [sdot] {\mathematics\cdot}
+\defineXMLentity [dot] {\mathematics\cdot}
+\defineXMLentity [sim] {\mathematics\sim}
+\defineXMLentity [circ] {\mathematics\circ}
+\defineXMLentity [dagger] {\mathematics\dagger}
+\defineXMLentity [cdots] {\mathematics\cdots}
+
+\defineXMLentity [...] {\getXMLentity{cdots}}
+\defineXMLentity [continued] {\getXMLentity{cdots}}
+
+\defineXMLentity [sub] {\getXMLentity{subset}}
+\defineXMLentity [sube] {\getXMLentity{prsubset}}
+\defineXMLentity [notprsubset] {\getXMLentity{notprsubset}}
+
+\defineXMLentity [ndash] {\endash}
+\defineXMLentity [mdash] {\emdash}
+
+\defineXMLentity [tex-bar] {\mathematics{\vert}}
+\defineXMLentity [tex-dollar] {\dollar}
+\defineXMLentity [tex-backslash] {\backslash}
+\defineXMLentity [tex-leftbrace] {\mathematics{\{}}
+\defineXMLentity [tex-rightbrace] {\mathematics{\}}}
+
+\protect \endinput
diff --git a/tex/context/base/x-newmml.tex b/tex/context/base/x-newmml.tex
new file mode 100644
index 000000000..bf51a336e
--- /dev/null
+++ b/tex/context/base/x-newmml.tex
@@ -0,0 +1,2374 @@
+%D \module
+%D [ file=x-newmml,
+%D version=2005.06.10, % 1999.12.20,
+%D title=\CONTEXT\ XML Modules,
+%D subtitle=MathML Renderer,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE}]
+%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 Remark: from now on this is a module and no longer an xtag
+%D filter. In due time it will replace the older renderer (which
+%D we will keep around for sentimental reasons).
+
+% \defineXMLentity[x000AF]{\normalorfiller{x}\hrulefill}
+% CHECK FOR: \xmlrent
+% \enablemathpunctuation
+
+%D Then we start defining the rendering macros:
+
+\writestatus{loading}{Context XML Macros (MathML Rederer)}
+
+\startmodule [mathml]
+
+%D First we load the entities:
+
+\usemodule[newmme]
+
+% \setupmodule[a=c]
+% \setupmodule[a=c]
+
+\unprotect
+
+\def\MMLrm{\mr}
+
+%D First we define some general formula elements.
+
+\defineXMLenvironment [formula] [label=,sublabel=]
+ {\dostartXMLformula\placeformula}
+ {\dostopXMLformula}
+
+\defineXMLenvironment [subformula] [label=,sublabel=]
+ {\dostartXMLformula\placesubformula}
+ {\dostopXMLformula}
+
+\def\dostartXMLformula#1%
+ {\doifelsenothingXMLop{label}
+ {\startformula}
+ {\expanded{#1[\XMLop{label}]{\XMLop{sublabel}}}\startformula}}
+
+\def\dostopXMLformula
+ {\stopformula}
+
+%D Since I only had the draft of MathML 2 as example of
+%D rendering, there are probably a lot of omissions and
+%D misinterpretations. At least I learned some bits and
+%D pieces of math rendering.
+%D
+%D The main complications were not so much the math, but to
+%D find the most efficient way to handle elements without
+%D spacing beging messed up. The first implementation was
+%D aimed at getting reasonable output, this second
+%D implementation is already better in terms of handling
+%D nesting, and I will definitely need a third one that has
+%D more efficient and less ugly code.
+%D
+%D The \TEX\ part is not that complicated and once the
+%D preprocessor was okay, the rest way just a lot of keying
+%D and testing. It all comes down to gobbling, redefining,
+%D and not so much to parsing.
+%D
+%D The second implementation expanded the whole math sequence
+%D into an internal \TEX\ representation. This is a rather clean
+%D and fast process. Filtering and testing takes place by
+%D redefining teh internal representation macros.
+%D
+%D The third implementation may look a bit more messy in some
+%D respects. This is because in \TEX\ it's not that trivial to
+%D implement a tree handler. We use a stack for the \type {apply}
+%D element and other sequential content. Occasionally we need to
+%D peek into child elements which involves messy code. This
+%D implementation is closer to the normal \XML\ handling in
+%D \CONTEXT.
+
+%D We start with the parent elements and the option handler.
+
+\defineXMLdirective [mathml] \setupMMLappearance
+
+\defineXMLargument [math] \automathematics
+\defineXMLargument [imath] \inlinemathematics
+\defineXMLargument [dmath] \displaymathematics
+\defineXMLargument [m] \inlinemathematics
+
+%D In the styles, options can be set with:
+
+\def\setupMMLappearance[#1]{\dodoubleargument\getparameters[@@MML#1]}
+
+%D We will apply inner math to all bits and pieces made up by an
+%D \type {apply}.
+
+\def\MMLmathinner
+ {\ifinner \expandafter \firstofoneargument \else \expandafter \mathinner \fi}
+
+%D A few math related macros:
+
+\def\MMLccomma{{,}} % are the extra {} still needed?
+
+\let\MMLctempresetlist\empty \def\setMMLcreset{\edef\MMLctempresetlist}
+
+\newcount\MMLapplydepth \def\MMLcreset{\MMLapplydepth\zerocount}
+
+% Stack handler
+
+\startXMLmapping[xmlstack:test]
+
+ \defineXMLnested
+ [apply]
+ {\startsavingXMLelements}
+ {\stopsavingXMLelements}
+
+% already defined
+%
+% \defineXMLnestedenvironmentsave
+% [xmlstack]
+% {}
+% {\pushXMLnameonstack}
+
+\stopXMLmapping
+
+% already generalized
+
+\def\MMCallnamed#1%
+ {\dorecurse\XMLstacklevel
+ {\expanded{\doifinset{\getXMLstackname\recurselevel}{#1}}
+ {\getXMLstackdata\recurselevel}}}
+
+\def\defMMCfirstnamed#1#2% \cs list
+ {\dorecurse\XMLstacklevel
+ {\expanded{\doifinset{\getXMLstackname\recurselevel}{#2}}
+ {\defXMLstackdata#1\recurselevel\exitloop}}}
+
+\def\defMMCfirstnamedtext#1#2% \cs list
+ {\dorecurse\XMLstacklevel
+ {\expanded{\doifinset{\getXMLstackname\recurselevel}{#2}}
+ {\edef#1{\getXMLstacktext\recurselevel}\exitloop}}}
+
+\def\MMCfirstnamed#1%
+ {\dorecurse\XMLstacklevel
+ {\expanded{\doifinset{\getXMLstackname\recurselevel}{#1}}
+ {\getXMLstackdata\recurselevel\exitloop}}}
+
+\def\MMCnotnamed#1%
+ {\dorecurse\XMLstacklevel
+ {\expanded{\doifnotinset{\getXMLstackname\recurselevel}{#1}}
+ {\getXMLstackdata\recurselevel\exitloop}}}
+
+\let\MMCstackposition\!!zerocount
+
+\def\MMCdoifelsefound#1%
+ {\!!doneafalse
+ \let\MMCstackposition\!!zerocount
+ \dorecurse\XMLstacklevel
+ {\expanded{\doifinset{\getXMLstackname\recurselevel}{#1}}
+ {\let\MMCstackposition\recurselevel\!!doneatrue\exitloop}}%
+ \if!!donea
+ \expandafter\firstoftwoarguments
+ \else
+ \expandafter\secondoftwoarguments
+ \fi}
+
+%D Auxiliary MathML macros: (to be generalized)
+
+\def\doifelseMMCfunction
+ {\begingroup
+ \MMCdoifelsefound{fn}
+ {\donetrue}
+ {\MMCdoifelsefound{apply}
+ {\defMMCfirstnamedtext\ascii{apply}%
+ \startsavingXMLelements % best use a substack so that we donnot need to \edef
+ \ascii
+ \stopsavingXMLelements}
+ {}%
+ \MMCdoifelsefound{fn}
+ {\donetrue}
+ {\defineXMLsave[ci][type=]%
+ \MMCfirstnamed{ci}%
+ \doifelse{\XMLpar{ci}{type}{}}{fn}
+ {\donetrue}
+ {\donefalse}}}%
+ \ifdone
+ \endgroup\expandafter\firstoftwoarguments
+ \else
+ \endgroup\expandafter\secondoftwoarguments
+ \fi}
+
+\def\doifelseMMCfunctioninapply#1#2% grouped
+ {\begingroup
+ \startXMLmapping[xmlstack:test]% take fast alternative
+ \getXMLstackdata{#1}%
+ \expanded{\doifinsetelse{\getXMLstackname\plusone}{#2}}
+ {\stopXMLmapping
+ \endgroup\firstoftwoarguments }
+ {\stopXMLmapping
+ \endgroup\secondoftwoarguments}}
+
+\def\dodoifelseMMCfunctioninapply#1#2%
+ {\startXMLmapping[xmlstack:test]% take fast alternative
+ \getXMLstackdata{#1}%
+ \expanded{\doifinsetelse{\getXMLstackname\plusone}{#2}}
+ {\stopXMLmapping
+ \firstoftwoarguments }
+ {\stopXMLmapping
+ \secondoftwoarguments}}
+
+%D Special features:
+
+\newtoks \@@postponedMMLactions \setfalse \somepostponedMMLactions
+
+\def\postponeMMLactions#1%
+ {\global\settrue\somepostponedMMLactions
+ \global\@@postponedMMLactions\expandafter{\the\@@postponedMMLactions#1}}
+
+\def\postponedMMLactions
+ {\global\setfalse\somepostponedMMLactions
+ \@EA\global\@EA\@@postponedMMLactions\@EA\emptytoks
+ \the\@@postponedMMLactions}
+
+%D A couple of lists:
+
+\def\MMLcmainresetlist
+ {times,divide,power,%
+ lt,gt,eq,leq,geq,%
+ in,inverse,%
+ fn,%
+ floor,ceiling,%
+ mean,%
+ selector,%
+ abs,int,limit,sum,product,%
+ outerproduct,innerproduct,scalarproduct}
+
+\def\MMLcfunctionlist
+ {sin,arcsin,sinh,arcsinh,%
+ cos,arccos,cosh,arccosh,%
+ tan,arctan,tanh,arctanh,%
+ cot,arccot,coth,arccoth,%
+ csc,arccsc,csch,arccsch,%
+ sec,arcsec,sech,arcsech,%
+ ln,exp,log,%
+ abs,int,limit,sum,product,%
+ fn} % ?
+
+\def\MMLcconstructlist
+ {diff,partialdiff,root} % apply goes wrong on 1/2 * (a_2 + b_3)
+
+% apply
+%
+%D We use inner and grouping (begin/end and no b/e) else we
+%D get problems with 1/2(1+2) and alike (todo: ask taco).
+%D
+%D The problem with apply is that we need to take care of
+%D several situations, like:
+%D
+%D \starttyping
+%D <apply> <.../> ...
+%D <apply> <fn> ...
+%D <apply> <apply> <ci> ...
+%D <apply> <apply> <fn> <ci> ...
+%D \stoptyping
+%D
+%D Because we translated version 2 of this renderer into
+%D version 3 the following definitions may be sub optimal or
+%D more complex than actually needed.
+
+\defineXMLnested % why nested? could be just an environment
+ [apply]
+ [open=,close=]
+ {\setups{mmc:apply:start}}
+ {\setups{mmc:apply:stop}}
+
+\startsetups mmc:apply:start
+ \begingroup
+ \startsavingXMLelements
+\stopsetups
+
+% \startsetups mmc:apply:stop
+% \stopsavingXMLelements
+% \MMLmathinner {
+% \expanded{\doifinsetelse{\getXMLstackname\plusone}{\MMLcmainresetlist,\MMLctempresetlist}}
+% \MMLcreset
+% \donothing
+% \ifcase\MMLapplydepth \else
+% \doifXMLparelse{apply}{open} \donothing{\getXMLarguments{apply}{open="("}}% slow
+% \doifXMLparelse{apply}{close}\donothing{\getXMLarguments{apply}{close=")"}}% slow
+% \fi
+% \doifXMLparelse{apply}{open}{\left\XMLpar{apply}{open}{}}\donothing
+% \advance\MMLapplydepth\plusone
+% \begingroup
+% \let\MMLctempresetlist\empty
+% \doifelse {\getXMLstackname\plusone} {apply} {
+% % <apply> <apply> ... </apply> <ci> .. </ci> </apply>
+% \MMLcreset
+% \getXMLstackdata\plusone
+% \ifconditional\somepostponedMMLactions
+% \postponedMMLactions
+% \else
+% \left(\MMLcreset\getXMLstackdata\plustwo\right)
+% \fi
+% } {
+% \doifelse {\getXMLstackname\plusone} {fn} {
+% % also postpone
+% \directsetup{mmc:fn:apply}
+% } {
+% \doifelse {\getXMLstackname\plusone} {ci} {
+% \getXMLstackdata\plusone
+% \ifnum\XMLstacklevel>\plusone
+% \left(\MMLcreset\flushXMLstackwith\plustwo\MMLccomma\right)
+% \fi
+% } {
+% \getXMLstackdata\plusone
+% }
+% }
+% }
+% \endgroup
+% \advance\MMLapplydepth\minusone
+% \doifXMLparelse{apply}{close}{\right\XMLpar{apply}{close}{}}\donothing
+% }
+% \endgroup
+% \stopsetups
+
+\startsetups mmc:apply:stop
+ \stopsavingXMLelements
+ \MMLmathinner {
+ \expanded{\doifinsetelse{\getXMLstackname\plusone}{\MMLcmainresetlist,\MMLctempresetlist}}
+ \MMLcreset
+ \donothing
+ \ifcase\MMLapplydepth \else
+ \doifXMLparelse{apply}{open} \donothing{\getXMLarguments{apply}{open="("}}% slow
+ \doifXMLparelse{apply}{close}\donothing{\getXMLarguments{apply}{close=")"}}% slow
+ \fi
+ \doifXMLparelse{apply}{open}{\left\XMLpar{apply}{open}{}}\donothing
+ \advance\MMLapplydepth\plusone
+ \begingroup
+ \let\MMLctempresetlist\empty
+ \doifelse {\getXMLstackname\plusone} {apply} {
+ % <apply> <apply> ... </apply> <ci> .. </ci> </apply>
+\doifelseMMCfunctioninapply \plusone {plus,minus} {
+ % yet incomplete and rather untested
+ % <apply> <apply> <minus/> <tan/> <cos/> </apply> <ci>x</ci> </apply>
+} {
+ \MMLcreset
+}
+ \getXMLstackdata\plusone
+ \ifconditional\somepostponedMMLactions
+ \postponedMMLactions
+ \else
+ \left(\MMLcreset\getXMLstackdata\plustwo\right)
+ \fi
+ } {
+ \doifelse {\getXMLstackname\plusone} {fn} {
+ % also postpone
+ \directsetup{mmc:fn:apply}
+ } {
+ \doifelse {\getXMLstackname\plusone} {ci} {
+ \getXMLstackdata\plusone
+ \ifnum\XMLstacklevel>\plusone
+ \left(\MMLcreset\flushXMLstackwith\plustwo\MMLccomma\right)
+ \fi
+ } {
+ \getXMLstackdata\plusone
+ }
+ }
+ }
+ \endgroup
+ \advance\MMLapplydepth\minusone
+ \directsetup{apply:flush}
+ \doifXMLparelse{apply}{close}{\right\XMLpar{apply}{close}{}}\donothing
+ }
+ \endgroup
+\stopsetups
+
+\startsetups apply:flush
+\relax
+ \ifcase\MMLapplydepth
+ \ifconditional\somepostponedMMLactions
+ \postponedMMLactions
+ \ifx\MMLpowerelement\empty\else
+ ^{\MMLcreset\MMLpowerelement\empty}
+ \global\let\MMLpowerelement\empty
+ \fi
+ \fi
+ \fi
+\stopsetups
+
+% reln
+
+\defineXMLnestedenvironmentsave [reln]
+ {\writestatus{XML}{MathML element "reln" is obsolete}}
+ {}
+
+% fn
+
+\startsetups mmc:fn:plusminus
+ \ifnum\XMLstacklevel>\plustwo
+ \MMLcreset
+ \left(\expandafter\flushXMLstackwith\expandafter\plustwo\expandafter{\XMLfnoperator}\right)
+ \else
+ \getXMLstackdata\plustwo
+ \fi
+\stopsetups
+
+\startsetups mmc:fn:minusplus
+ \directsetup{mmc:fn:plusminus}
+\stopsetups
+
+\defineXMLnested
+ [fn]
+ {\directsetup{mmc:fn:start}}
+ {\directsetup{mmc:fn:stop}}
+
+\startsetups mmc:fn:apply
+ \begingroup
+ \startsavingXMLelements
+ \rawXMLstacktext\plusone % still on stack, no check, just fn content
+ \stopsavingXMLelements
+ \doifelse {\getXMLstackname\plusone} {ci} {
+ \flattenXMLcontent{\getXMLstackdata\plusone}
+ \doifsetupselse{mmc:fn:\flattenedXMLcontent} {
+ \global\defXMLstackdata\XMLfnoperator\plusone
+ \expanded{\endgroup\noexpand\directsetup{mmc:fn:\flattenedXMLcontent}}
+ } {
+ \endgroup
+ \MMLcreset
+ \getXMLstackdata\plusone
+ \ifnum\XMLstacklevel>\plusone
+ \getXMLentity{NegThinSpace}
+ \left(\MMLcreset\flushXMLstackwith\plustwo\MMLccomma\right)
+ \fi
+ }
+ } {
+ \endgroup
+ \MMLcreset
+ \getXMLstackdata\plusone
+ }
+\stopsetups
+
+\startsetups mmc:fn:start
+ \ifnum\XMLstacklevel>\plustwo
+ \def\MMCfnleft {\left(}
+ \def\MMCfnright{\right)}
+ \else
+ \let\MMCfnleft \relax
+ \let\MMCfnright\relax
+ \fi
+ \begingroup
+ \startsavingXMLelements
+\stopsetups
+
+\startsetups mmc:fn:stop
+ \stopsavingXMLelements
+ \doifelse {\getXMLstackname\plusone} {ci} {
+ \flattenXMLcontent{\getXMLstackdata\plusone}
+ \doifsetupselse{mmc:fn:\flattenedXMLcontent} {
+ \global\defXMLstackdata\XMLfnoperator\plusone
+ \directsetup{mmc:fn:\flattenedXMLcontent}
+ } {
+ \MMLcreset
+ \getXMLstackdata\plusone
+ }
+ \endgroup
+ } {
+ \doifelse {\getXMLstackname\plusone} {apply} {
+ \doifelseMMCfunctioninapply \plusone {plus,minus} {
+ \left(
+ \getXMLstackdata\plusone
+ \right)
+ } {
+ \getXMLstackdata\plusone
+ }
+ \endgroup
+ \ifnum\XMLstacklevel>\plusone
+ \left(
+ \getXMLstackdata\plustwo
+ \right)
+ \fi
+ } {
+ \MMLcreset
+ \getXMLentity{NegThinSpace}
+ \MMCfnleft
+ \ifnum\XMLstacklevel=\plustwo\MMLccomma\fi
+ \flushXMLstackwith\plustwo\MMLccomma
+ \MMCfnright
+ \endgroup
+ }
+ }
+\stopsetups
+
+% c*
+
+\defineXMLargument [ci] [type=] {\XMLval{mmc:ci}{\XMLop{type}} {\firstofoneargument}}
+\defineXMLargument [cn] [type=,base=] {\XMLval{mmc:cn}{\XMLop{type}} {\firstofoneargument}}
+\defineXMLargument [csymbol] [encoding=text] {\XMLval{mmc:cs}{\XMLop{encoding}}{\firstofoneargument}}
+
+\defineXMLsingular [sep] {\MMLcsep} \def\MMLcsep{\,}
+
+\setupMMLappearance[polar] [\c!alternative=\v!a] % a|b|c
+\setupMMLappearance[float] [\c!symbol=\v!no] % \v!yes|dot
+\setupMMLappearance[enotation][\c!symbol=\v!no] % \v!yes|dot
+\setupMMLappearance[base] [\c!symbol=\v!numbers] % digits|characters|text|no
+
+\mapXMLvalue {mmc:ci} {set} {\MMLcCIset}
+\mapXMLvalue {mmc:ci} {vector} {\MMLcCIvector}
+\mapXMLvalue {mmc:ci} {matrix} {\MMLcCImatrix}
+\mapXMLvalue {mmc:ci} {function} {\MMLcCIfunction}
+\mapXMLvalue {mmc:ci} {complex-cartesian} {\MMLccartesian}
+\mapXMLvalue {mmc:ci} {complex} {\MMLccartesian}
+\mapXMLvalue {mmc:ci} {complex-polar} {\MMLcpolar}
+\mapXMLvalue {mmc:ci} {polar} {\MMLcpolar}
+\mapXMLvalue {mmc:ci} {fn} {\MMLcCIfunction}
+
+\mapXMLvalue {mmc:cn} {integer} {\MMLcCNinteger}
+\mapXMLvalue {mmc:cn} {logical} {\MMLcCNlogical}
+\mapXMLvalue {mmc:cn} {rational} {\MMLcCNrational}
+\mapXMLvalue {mmc:cn} {complex-cartesian} {\MMLccartesian}
+\mapXMLvalue {mmc:cn} {complex} {\MMLccartesian}
+\mapXMLvalue {mmc:cn} {complex-polar} {\MMLcpolar}
+\mapXMLvalue {mmc:cn} {polar} {\MMLcpolar}
+\mapXMLvalue {mmc:cn} {e-notation} {\MMLcenotation} % new
+\mapXMLvalue {mmc:cn} {float} {\MMLcfloat} % obsolete
+\mapXMLvalue {mmc:cn} {real} {\MMLcfloat}
+
+\mapXMLvalue {mmc:cs} {text} {\MMLcCStext}
+
+\def\MMLcpolar#1%
+ {\doifdefinedelse{MMLcdopolar\@@MMLpolaralternative}
+ {\getvalue{MMLcdopolar\@@MMLpolaralternative}{#1}}
+ {#1}}
+
+\def\MMLcdopolara#1%
+ {\def\MMLcsep{\MMLccomma}\getXMLentity{polar}\left(#1\right)}
+
+\def\MMLcdopolarb#1%
+ {\def\MMLcsep##1\empty
+ {\getXMLentity{exponentiale}^{##1\mskip2mu\getXMLentity{imaginaryi}}}
+ #1\empty}
+
+\def\MMLcdopolarc#1%
+ {\def\MMLcsep##1\empty
+ {\getXMLentity{exp}\left(##1\mskip2mu\getXMLentity{imaginaryi}\right)}%
+ #1\empty}
+
+\def\MMLccartesian#1%
+ {\def\MMLcsep{+}#1\getXMLentity{imaginaryi}}
+
+% float will be obsolete, an is replace by e-notation
+
+\def\MMLcfloat#1%
+ {\doifelse\@@MMLfloatsymbol\v!no
+% {{\MMLrm#1}}% make sure that e shows up ok
+ {\mfunction{#1}}% make sure that e shows up ok
+ {% we should ignore \entities !
+ \beforesplitstring#1\at e\to\first
+ \aftersplitstring #1\at e\to\last
+ \ifx\first\empty #1\else
+ \ifx\last \empty #1\else
+ \first
+ \doifelse\@@MMLfloatsymbol{dot}\cdot\times
+ 10^{\last}%
+ \fi\fi}}
+
+% we now have:
+
+\def\MMLcenotation#1%
+ {\doifelse\@@MMLenotationsymbol\v!no
+% {\def\MMLcsep {\unskip{\MMLrm e}\ignorespaces}}
+ {\def\MMLcsep {\unskip\mfunction{e}\ignorespaces}}
+ {\def\MMLcsep##1\empty{\doifelse\@@MMLenotationsymbol{dot}\cdot\times10^{##1}}}%
+ #1\empty}
+
+\def\MMLcCIset#1%
+ {{\bbd#1}}
+
+\def\widevec#1%
+ {\vbox{\m@th\ialign{##\crcr
+ \rightarrowfill\crcr\noalign{\nointerlineskip}%
+ $\hfil\displaystyle{#1}\hfil$\crcr}}}
+
+\def\MMLcCIvector#1%
+ {\widevec{#1}}
+
+\def\MMLcCImatrix#1%
+ {{\bi#1}}
+
+\def\MMLcCIfunction#1%
+ {#1\getXMLentity{NegThinSpace}}
+
+\def\MMLcCNinteger#1%
+ {\doifXMLparelse{cn}{base}
+ {\def\MMLcCNbase{\XMLpar{cn}{base}{}}%
+ \doifelse\@@MMLbasesymbol\v!no
+ {\MMLcCNbasedata{#1}}
+% {\MMLcCNbasedata{#1}_{\hbox{$\MMLrm\scriptscriptstyle
+ {\MMLcCNbasedata{#1}_{\mfunction{%
+ \processaction
+ [\@@MMLbasesymbol]
+ [\v!characters=>\MMLcCNbasestring BODH,
+ \v!text=>\MMLcCNbasestring{BIN}{OCT}{DEC}{HEX},
+% \s!unknown=>\MMLcCNbase]$}}}}
+ \s!unknown=>\MMLcCNbase]}}}}
+ {#1}}
+
+\def\MMLcCNbasedata#1%
+% {\ifnum\MMLcCNbase>10{\MMLrm#1}\else#1\fi}
+ {\ifnum\MMLcCNbase>10\mfunction{#1}\else#1\fi}
+
+\def\MMLcCNbasestring#1#2#3#4%
+ {\ifnum\MMLcCNbase= 2 #1\else
+ \ifnum\MMLcCNbase= 8 #2\else
+ \ifnum\MMLcCNbase=10 #3\else
+ \ifnum\MMLcCNbase=16 #4\else
+ \MMLcCNbase \fi\fi\fi\fi}
+
+\def\MMLcCNlogical#1%
+% {{\MMLrm#1}}
+ {\mfunction{#1}}
+
+\bgroup \catcode`\<=\active
+
+ % quick and dirty, best track the stack (todo)
+
+ \gdef\MMLcCNrational#1%
+ {\ConvertConstantAfter\doifinstringelse{sep}{#1}
+ {\doMMLcCNrational#1\empty}
+ {#1}}
+
+ \gdef\doMMLcCNrational#1<sep#2>#3\empty
+ {\hbox{$\frac{#1}{#3}$}}
+
+\egroup
+
+\def\MMLcCStext#1%
+% {{\MMLrm#1}}
+ {\mfunction{#1}}
+
+% interval
+
+\defineXMLnested [interval]
+ [closure=closed]
+ {\directsetup{mmc:interval:start}}
+ {\directsetup{mmc:interval:stop}}
+
+\startsetups mmc:interval:start
+ \begingroup
+ \startsavingXMLelements
+\stopsetups
+
+\startsetups mmc:interval:stop
+ \stopsavingXMLelements
+ \XMLval{mmc:int}{\XMLpar{interval}{closure}{closed}}{error}
+ \endgroup
+\stopsetups
+
+\mapXMLvalue {mmc:int} {closed} {\left[\getXMLstackdata\plusone,\getXMLstackdata\plustwo\right]}
+\mapXMLvalue {mmc:int} {open-closed} {\left(\getXMLstackdata\plusone,\getXMLstackdata\plustwo\right]}
+\mapXMLvalue {mmc:int} {closed-open} {\left[\getXMLstackdata\plusone,\getXMLstackdata\plustwo\right)}
+\mapXMLvalue {mmc:int} {open} {\left(\getXMLstackdata\plusone,\getXMLstackdata\plustwo\right)}
+
+% inverse
+
+\defineXMLcommand [inverse] {\directsetup{mmc:inverse}}
+
+\startsetups mmc:inverse
+ \ifnum\XMLstacklevel>\plustwo
+ \getXMLentity{\getXMLstackname\plustwo}^{-1}
+ \left[\getXMLstackdata\plusthree\right]
+ \else
+ \xdef\MMLpowerelement{-1}
+ \expanded{\postponeMMLactions{\rawXMLstackdata\plustwo}}
+ \eraseXMLdataonstack\plustwo
+ \fi
+\stopsetups
+
+% condition
+
+\defineXMLnested
+ [condition]
+ {\directsetup{mmc:condition:start}}
+ {\directsetup{mmc:condition:stop}}
+
+\startsetups mmc:condition:start
+% \MMCdoifelsefound{bvar} {
+% \MMCfirstnamed{bvar}\mid
+% } { }
+ \begingroup
+ \startsavingXMLelements
+\stopsetups
+
+\startsetups mmc:condition:stop
+ \stopsavingXMLelements
+ \flushXMLstackfrom\plusone
+ \endgroup
+\stopsetups
+
+% declare
+
+\setupMMLappearance[declare][\c!state=\v!start]
+
+\defineXMLnested
+ [declare]
+ {\directsetup{mmc:declare:start}}
+ {\directsetup{mmc:declare:stop}}
+
+\startsetups mmc:declare:start
+ \begingroup
+ \startsavingXMLelements
+\stopsetups
+
+\startsetups mmc:declare:stop
+ \stopsavingXMLelements
+ \doif\@@MMLdeclarestate\v!start {
+ \getXMLentity{declare}\getXMLstackdata\plusone
+ \ifnum\XMLstacklevel>\plusone
+ \getXMLentity{ThickSpace}
+ \getXMLentity{as}
+ \getXMLentity{ThickSpace}
+ \fi
+ \getXMLstackdata\plustwo
+ }
+ \endgroup
+\stopsetups
+
+% lambda
+
+\setupMMLappearance[lambda][\c!alternative=b]
+
+\defineXMLnested
+ [lambda]
+ {\directsetup{mmc:lambda:start}}
+ {\directsetup{mmc:lambda:stop}}
+
+\startsetups mmc:lambda:start
+ \begingroup
+ \startsavingXMLelements
+\stopsetups
+
+\startsetups mmc:lambda:stop
+ \stopsavingXMLelements
+ \doifelse\@@MMLlambdaalternative\v!a {
+ \getXMLentity{lambda}(\flushXMLstackwith\plusone\MMLccomma)
+ } {
+ \countXMLnamedstack{bvar}
+ \ifnum\scratchcounter>\plusone
+ \left(\flushXMLnamedstackwith\plusone{bvar}\MMLccomma\right)
+ \else
+ \MMCfirstnamed{bvar}
+ \fi
+ \getXMLentity{mapsto}
+ \MMCfirstnamed{apply,reln,ci,cn}
+ }
+ \endgroup
+\stopsetups
+
+% compose
+
+\defineXMLcommand [compose] {\directsetup{mmc:compose}}
+
+\startsetups mmc:compose
+ \begingroup
+ \MMLcreset
+ \let\MMLcCIfunction\firstofoneargument % brrr
+ \doifelseMMCfunction {
+ \left(\flushXMLstackwith\plustwo\circ\right)
+ } {
+ \flushXMLstackwith\plustwo\circ
+ }
+ \endgroup
+\stopsetups
+
+\defineXMLcommand [image] {\directsetup{mmc:image}}
+
+\startsetups mmc:image
+ \getXMLentity{image}
+ \left(
+ \begingroup
+ \startlocalsetups [mmc:function]
+ \getXMLentity\currentXMLelement
+ \stoplocalsetups
+ \getXMLstackdata\plustwo
+ \endgroup
+ \right)
+\stopsetups
+
+\setupMMLappearance[piece][\c!separator=]
+
+\def\MMLcPIECEseparator{\doif\@@MMLpieceseparator\v!yes,}
+
+\defineXMLargument[piecewise] {\cases}
+
+\defineXMLnested
+ [piece]
+ {\directsetup{mmc:piece:start}}
+ {\directsetup{mmc:piece:stop}}
+
+\defineXMLenvironmentsave
+ [otherwise]
+ {}
+ {\directsetup{mmc:otherwise}}
+
+\startsetups mmc:piece:start
+ \startsavingXMLelements
+\stopsetups
+
+\startsetups mmc:piece:stop
+ \stopsavingXMLelements
+ \edef\ascii{\getXMLstackdata\plusone}
+ \@EA\XMLRtoks\@EA{\ascii\MMLcPIECEseparator\@col@amp@}
+ \edef\ascii{\getXMLstackdata\plustwo}
+ \@EA\appendtoks\@EA\mathematics\@EA{\ascii}\to\XMLRtoks
+ \the\XMLRtoks\crcr
+\stopsetups
+
+\startsetups mmc:otherwise
+ \XMLflush{otherwise}\MMLcPIECEseparator\@col@amp@\mathematics{\getXMLentity{otherwise}}\crcr
+\stopsetups
+
+\defineXMLcommand [quotient] {\directsetup{mmc:quotient}}
+
+\startsetups mmc:quotient
+ \lfloor\getXMLstackdata\plustwo/\getXMLstackdata\plusthree\rfloor
+\stopsetups
+
+\defineXMLcommand [factorial] {\getXMLstackdata\plustwo !}
+
+\defineXMLcommand [divide] {\directsetup{mmc:divide}}
+
+\setupMMLappearance [divide] [\c!level=\!!maxcard]
+
+\startsetups mmc:divide
+ \increment\MMLcDIVIDElevel
+ \ifnum\MMLcDIVIDElevel>\@@MMLdividelevel\space
+ \getXMLstackdata\plustwo/\getXMLstackdata\plusthree
+ \else
+ \MMLcreset
+ \frac{\MMLcreset\getXMLstackdata\plustwo}{\MMLcreset\getXMLstackdata\plusthree}%
+ \fi
+ \decrement\MMLcDIVIDElevel
+\stopsetups
+
+% min max
+
+\defineXMLcommand [min] {\min\directsetup{mmc:minmax}}
+\defineXMLcommand [max] {\max\directsetup{mmc:minmax}}
+
+\startsetups mmc:minmax
+ \doifelse{\getXMLstackdata\plustwo}{bvar} {
+ {}_{\getXMLstackdata\plustwo}
+ \left\{\flushXMLstackwith\plusthree\MMLccomma\right\}
+ } {
+ \left\{\flushXMLstackwith\plustwo \MMLccomma\right\}
+ }
+\stopsetups
+
+% minus plus
+
+\defineXMLcommand [minus] {\directsetup{mmc:minus}}
+\defineXMLcommand [plus] {\directsetup{mmc:plus}}
+
+\setupMMLappearance [sign] [\c!reduction=\v!yes]
+
+\startsetups mmc:minus
+ \doif \@@MMLsignreduction \v!yes {
+ \setMMLcreset{\MMLcfunctionlist}
+ }
+ \ifcase\XMLstacklevel
+ \or
+ % self
+ \or
+ -\getXMLstackdata\plustwo
+ \else
+ \flushXMLstackwith\plustwo-
+ \fi
+\stopsetups
+
+\startsetups mmc:plus
+ \doifelse \@@MMLsignreduction \v!yes {
+ \setMMLcreset{plus/,minus/,\MMLcfunctionlist,\MMLcconstructlist}
+ \doifelse{\getXMLstackname\plustwo} {apply} {
+ % branch needed, else (a-b) + (c-d) goes wrong
+ % reset check in case of (-x) + 37
+ \begingroup
+ \dodoifelseMMCfunctioninapply \plustwo {minus} {
+ \ifnum\XMLstacklevel>\plustwo
+ \endgroup
+ \else
+ \endgroup
+ \MMLcreset
+ \fi
+ } {
+ \endgroup
+ }
+ \flushXMLstackwith\plustwo +
+ } {
+ \flushXMLstackwith\plustwo {
+ \doifelse {\getXMLstackname\recurselevel} {apply} {
+ \begingroup
+ \dodoifelseMMCfunctioninapply \recurselevel {minus} {
+ \ifnum\XMLstacklevel>\plustwo +\fi
+ } {
+ +
+ }
+ \endgroup
+ \MMLcreset
+ } {
+ +
+ }
+ }
+ }
+ } {
+ \ifcase\XMLstacklevel
+ \or
+ % self
+ \or
+ +\getXMLstackdata\plustwo
+ \else
+ \flushXMLstackwith\plustwo+
+ \fi
+ }
+\stopsetups
+
+% power
+
+\defineXMLcommand [power] {\directsetup{mmc:power}}
+
+\setupMMLappearance[power][\c!reduction=\v!yes]
+
+\let\MMLpowerelement\empty
+
+\startsetups mmc:power
+ \doifelse {\getXMLstackname\plustwo} {apply} {
+ \doifelse\@@MMLpowerreduction\v!yes {
+ \doifelseMMCfunctioninapply \plustwo \MMLcfunctionlist {
+ \xdef\MMLpowerelement{\getXMLstackdata\plusthree}% postpone
+ \MMLcreset\getXMLstackdata\plustwo
+ } {
+ \left(\MMLcreset\getXMLstackdata\plustwo\right)^{\MMLcreset\getXMLstackdata\plusthree}
+ }
+ } {
+ \left(\MMLcreset\getXMLstackdata\plustwo\right)^{\MMLcreset\getXMLstackdata\plusthree}
+ }
+ } {
+ \getXMLstackdata\plustwo^{\MMLcreset\getXMLstackdata\plusthree}
+ }
+\stopsetups
+
+% rem
+
+\defineXMLcommand [rem] {\flushXMLstackwith\plustwo{\getXMLentity{mod}}}
+
+\defineXMLcommand [times] {\directsetup{mmc:times}}
+
+\setupMMLappearance [times] [\c!symbol=\v!no,\c!auto=\v!yes] % new, auto catches cn cn cn
+
+\startsetups mmc:times
+ \setMMLcreset{\MMLcfunctionlist,\MMLcconstructlist}%
+ \doifelse\@@MMLtimesauto\v!no {
+ \let\@@MMLtimes@@symbol\@@MMLtimessymbol
+ } {
+ \countXMLnamedstack {cn}
+ \ifnum\scratchcounter>\plusone
+ \let\@@MMLtimes@@symbol\v!yes
+ \else
+ \let\@@MMLtimes@@symbol\@@MMLtimessymbol
+ \fi
+ }
+ \doifelse\@@MMLtimes@@symbol\v!yes {
+ \flushXMLstackwith\plustwo\times
+ } {
+ \doifelse\@@MMLtimes@@symbol{dot} {
+ \flushXMLstackwith\plustwo\cdot
+ } {
+ \doifelse\@@MMLtimes@@symbol{times} {
+ \flushXMLstackwith\plustwo\times
+ } {
+ \flushXMLstackwith\plustwo\empty
+ }
+ }
+ }
+\stopsetups
+
+\defineXMLcommand [root] {\directsetup{mmc:root}}
+
+\setupMMLappearance[root][\c!symbol=\v!yes]
+
+\startsetups mmc:root
+ \MMCdoifelsefound {degree} {
+ \root
+ \doifnot\@@MMLrootsymbol\v!no{\MMLcreset\MMCfirstnamed{degree}}
+ \of
+ } {
+ \sqrt
+ }
+ {\MMLcreset\MMCfirstnamed{apply,reln,ci,cn}}
+\stopsetups
+
+% gcd
+
+\defineXMLcommand [gcd] {\gcd\left(\MMLcreset\flushXMLstackwith\plustwo\MMLccomma\right)}
+
+% and or xor implies
+
+\defineXMLcommand [and] {\flushXMLstackwith\plustwo{\getXMLentity{and}}}
+\defineXMLcommand [or] {\flushXMLstackwith\plustwo{\getXMLentity{or}}}
+\defineXMLcommand [xor] {\flushXMLstackwith\plustwo{\getXMLentity{xor}}}
+\defineXMLcommand [implies] {\flushXMLstackwith\plustwo{\getXMLentity{implies}}}
+
+% not
+
+\defineXMLcommand [not] {\getXMLentity{not}\getXMLstackdata\plustwo}
+
+% forall exists
+
+\defineXMLcommand [forall] {\directsetup{mmc:forall}}
+\defineXMLcommand [exists] {\directsetup{mmc:exists}}
+
+%D We need to shift left below rotated A.
+
+\startsetups mmc:forall
+ \getXMLentity{forall}
+ \getXMLentity{NegThinSpace}
+ \directsetup{mmc:forall-exists}
+\stopsetups
+
+\startsetups mmc:exists
+ \getXMLentity{exists}
+ \directsetup{mmc:forall-exists}
+\stopsetups
+
+\startsetups mmc:forall-exists
+ _{\flushXMLnamedstackwith\plustwo{bvar}\MMLccomma}
+ \MMCdoifelsefound {condition} {
+ \getXMLentity{ThickSpace}
+ \begingroup
+ \MMCfirstnamed{condition}
+ \endgroup
+ \countXMLnamedstack {apply,reln,ci,cn}
+ \ifcase\scratchcounter
+ \or
+ % == snelle volgende
+ \left\vert \MMLcreset
+ \getXMLentity{MediumSpace}
+ \flushXMLnamedstackwith\plustwo{apply,reln,ci,cn}\empty
+ \right.
+ \else
+ % special case
+ % \defineXMLignore[condition]
+ \collectXMLnamedstack{apply,reln,ci,cn}{\hfill\crcr}
+ \left\vert
+ \matrix{\the\XMLRtoks}
+ \right.
+ \fi
+ } {
+ :\MMCfirstnamed{apply,reln,ci,cn}
+ }
+\stopsetups
+
+\defineXMLcommand [abs] {\left\vert \MMLcreset \flushXMLstackfrom\plustwo \right\vert}
+\defineXMLcommand [conjugate] {{\overline{\MMLcreset \flushXMLstackfrom\plustwo}}} % watch extra {}
+\defineXMLcommand [arg] {\getXMLentity{arg} \left(\MMLcreset\flushXMLstackfrom\plustwo\right)}
+\defineXMLcommand [real] {\getXMLentity{real} \left(\MMLcreset\flushXMLstackfrom\plustwo\right)}
+\defineXMLcommand [imaginary] {\getXMLentity{imaginary}\left(\MMLcreset\flushXMLstackfrom\plustwo\right)}
+\defineXMLcommand [lcm] {\getXMLentity{lcm} \left(\flushXMLstackwith\plustwo\MMLccomma\right)}
+\defineXMLcommand [floor] {\getXMLentity{lfloor} \flushXMLstackfrom\plustwo \getXMLentity{rfloor}}
+\defineXMLcommand [ceiling] {\getXMLentity{lceiling} \flushXMLstackfrom\plustwo \getXMLentity{rceiling}}
+
+% relations
+
+\defineXMLcommand [eq] {\MMLcrelation=}
+\defineXMLcommand [neq] {\MMLcrelation\neq}
+\defineXMLcommand [gt] {\MMLcrelation>}
+\defineXMLcommand [lt] {\MMLcrelation<}
+\defineXMLcommand [geq] {\MMLcrelation\geq}
+\defineXMLcommand [leq] {\MMLcrelation\leq}
+\defineXMLcommand [equivalent] {\MMLcrelation\equiv}
+\defineXMLcommand [approx] {\MMLcrelation\approx}
+\defineXMLcommand [factorof] {\MMLcrelation\mid}
+
+\setupMMLappearance[relation][\c!align=\v!no]
+
+\def\MMLcrelation
+ {\MMLcreset
+ \processaction
+ [\@@MMLrelationalign]
+ [\v!last=>\let\next\lastMMLcrelation ,
+ \v!first=>\let\next\firstMMLcrelation,
+ \v!yes=>\let\next\leftMMLcrelation ,
+ \v!left=>\let\next\leftMMLcrelation ,
+ \v!right=>\let\next\rightMMLcrelation,
+ \s!default=>\let\next\noMMLcrelation ,
+ \s!unknown=>\let\next\noMMLcrelation ]
+ \next}
+
+\def\noMMLcrelation#1%
+ {\flushXMLstackwith\plustwo{#1}}
+
+\def\lastMMLcrelation#1%
+ {\XMLRtoks\emptytoks
+ \dostepwiserecurse\plustwo\XMLstacklevel\plusone
+ {\appendetoks\noexpand\getXMLstackdata{\recurselevel}\to\XMLRtoks
+ \ifnum\recurselevel<\numexpr\XMLstacklevel-1\relax
+ \appendtoks\@col@amp@#1\crcr\to\XMLRtoks
+ \else\ifnum\recurselevel=\numexpr\XMLstacklevel-1\relax
+ \appendtoks\@col@amp@#1\to\XMLRtoks
+ \fi\fi}%
+ \eqalign{\the\XMLRtoks\crcr}}
+
+\def\firstMMLcrelation#1%
+ {\collectXMLstackrows\plusthree{\crcr\@col@amp@#1}%
+ \eqalign{\getXMLstackdata\plustwo\@col@amp@#1\the\XMLRtoks}}
+
+\def\leftMMLcrelation#1%
+ {\collectXMLstackrows\plustwo{\@col@amp@#1\crcr}%
+ \eqalign{\the\XMLRtoks}}
+
+\def\rightMMLcrelation#1%
+ {\collectXMLstackrows\plustwo{\crcr#1{}\@col@amp@}%
+ \eqalign{\@col@amp@\the\XMLRtoks\crcr}}
+
+\defineXMLcommand [becomes] {\MMLcrelation{:=}}
+
+\addtocommalist{becomes/}\MMLcmainresetlist
+
+% calculus and vector calculus
+
+\setupMMLappearance[int][\c!location=\v!top]
+
+\def\doMMLlimits#1%
+ {\doifelsevalue{@@MML#1\c!location}\v!top\limits\nolimits}
+
+\defineXMLnested
+ [domainofapplication]
+ {\directsetup{mmc:domainofapplication:start}}
+ {\directsetup{mmc:domainofapplication:stop}}
+
+\startsetups mmc:domainofapplication:start
+ \begingroup
+ \startsavingXMLelements
+\stopsetups
+
+\startsetups mmc:domainofapplication:stop
+ \stopsavingXMLelements
+% \MMLcreset
+ \flushXMLstackfrom\plusone
+ \endgroup
+\stopsetups
+
+\defineXMLcommand [int] {\directsetup{mmc:int}}
+
+\startsetups mmc:int
+ \MMLcreset
+ \MMCdoifelsefound{domainofapplication} {
+ \int\doMMLlimits{int}_{\MMCfirstnamed{domainofapplication}}\relax
+ } {
+ \MMCdoifelsefound{condition} {
+ \int\doMMLlimits{int}_{\MMCfirstnamed{condition}}\relax
+ } {
+ \MMCdoifelsefound{lowlimit} {
+ \int\doMMLlimits{int}
+ _{\MMCfirstnamed{lowlimit}}
+ ^{\MMCfirstnamed{uplimit}}
+ } {
+ % funny, why do we have lowlimit/uplimit then
+ \MMCdoifelsefound{interval} {
+ \begingroup
+ \startlocalsetups mmc:interval:start %
+ \begingroup
+ \startsavingXMLelements
+ \stoplocalsetups
+ \startlocalsetups mmc:interval:stop %
+ \stopsavingXMLelements
+ \xdef\MMLfirstelement {\getXMLstackdata\plusone}
+ \xdef\MMLsecondelement{\getXMLstackdata\plustwo}
+ \endgroup
+ \stoplocalsetups
+ \globallet\MMLfirstelement \empty
+ \globallet\MMLsecondelement\empty
+ \MMCfirstnamed{interval}
+ \endgroup
+ \int\doMMLlimits{int}
+ _{\MMLfirstelement}
+ ^{\MMLsecondelement}
+ } {
+ \int
+ }
+ }
+ }
+ }
+ \MMLcreset
+ \MMCdoifelsefound{apply} {
+ \doifelseMMCfunction {
+ \MMCfirstnamed{apply}
+ } {
+ % if there are too many () now, we need to be more clever
+ \left(\MMCfirstnamed{apply}\right)
+ }
+ } {
+ \MMCfirstnamed{ci}
+ }
+ \MMCdoifelsefound{bvar} {
+ \,% \getXMLentity{ThinSpace}%
+% {\MMLrm\getXMLentity{mathematicald}}
+ \mfunction{\getXMLentity{mathematicald}}
+ \MMCfirstnamed{bvar}
+ } {
+ % nothing
+ }
+\stopsetups
+
+\setupMMLappearance[diff][\c!location=\v!top]
+
+\defineXMLcommand [diff] {\directsetup{mmc:diff}}
+\defineXMLcommand [partialdiff] {\directsetup{mmc:partialdiff}}
+
+\startsetups mmc:diff
+ \MMLcreset
+ \MMCdoifelsefound{bvar} {
+ \frac {
+ \MMCdoifelsefound{degree} {
+ \collectXMLnamedstack{degree}\empty
+ } {
+ \collectXMLnamedstacknamed{bvar}{degree}+
+ }
+% \begingroup
+% \MMLrm\getXMLentity{mathematicald}
+% \endgroup
+ \mfunction{\getXMLentity{mathematicald}}
+ ^{\the\XMLRtoks}
+ \doif\@@MMLdifflocation\v!top {
+ \MMCdoifelsefound{ci} {
+ \MMCfirstnamed{ci}
+ } {
+% \doifelseMMCfunction {
+ \MMLcreset\MMCfirstnamed{apply}
+% } {
+% \left(\MMLcreset\MMCfirstnamed{apply}\right)
+% }
+ }
+ }
+ } {
+% \begingroup
+% \MMLrm\getXMLentity{mathematicald}
+% \endgroup
+ \mfunction{\getXMLentity{mathematicald}}
+ \begingroup
+ \defineXMLsave[degree]
+ \MMCfirstnamed{bvar}
+ \doifXMLdata{degree} {
+ ^{\XMLflush{degree}}
+ }
+ \endgroup
+ }
+ \doifnot\@@MMLdifflocation\v!top {
+ \left(\MMLcreset\MMCfirstnamed{apply,ci}\right)
+ }
+ } {
+ \flushXMLstackfrom\plustwo^\prime
+ }
+\stopsetups
+
+\startsetups mmc:partialdiff
+ \MMCdoifelsefound{list} {
+ \getXMLentity{capitaldifferentiald}_{
+ \begingroup
+ \setfalse\MMLlistdelimiters
+ \MMCallnamed{list}
+ \endgroup
+ }
+ \MMCfirstnamed{apply,reln,ci,cn}
+ } {
+ \MMCdoifelsefound{bvar} {
+ \frac {
+ \MMCdoifelsefound{degree} {
+ \collectXMLnamedstack{degree}\empty
+ } {
+ \collectXMLnamedstacknamed{bvar}{degree}+
+ }
+ \getXMLentity{differentiald}^{\the\XMLRtoks}
+ % \let\MMLcDEGREE\gobbletwoarguments
+ % \doifelseMMCfunction\MMLcreset\donothing
+ \MMLcreset
+ \MMCfirstnamed{apply,reln,ci,cn}
+ } {
+ \defineXMLnested[bvar]
+ {\directsetup{mmc:bvar:diff:start}}
+ {\directsetup{mmc:bvar:diff:stop}}
+ \MMCfirstnamed{bvar}
+ }
+ } {
+ \MMCfirstnamed{apply,reln,ci,cn}
+ }
+ }
+\stopsetups
+
+\startsetups mmc:bvar:diff:start
+ \begingroup
+ \startsavingXMLelements
+\stopsetups
+
+\startsetups mmc:bvar:diff:stop
+ \stopsavingXMLelements
+ \getXMLentity{differentiald}\MMCfirstnamed{apply,reln,ci,cn}
+ \MMCdoifelsefound{degree} {
+ ^{\MMCfirstnamed{degree}}
+ } {
+ % nothing
+ }
+ \endgroup
+\stopsetups
+
+\def\subMMLcelement #1#2{_{#2}}
+\def\superMMLcelement#1#2{^{#2}}
+
+\defineXMLprocess [lowlimit]
+\defineXMLprocess [uplimit]
+\defineXMLprocess [bvar]
+\defineXMLprocess [degree]
+
+% option:
+%
+% \defineXMLentity [div] {\mathematics{\triangledown\times}}
+% \defineXMLentity [curl] {\mathematics{\triangledown .}}
+% \defineXMLentity [grad] {\mathematics{\triangledown }}
+
+\defineXMLcommand [divergence] {\getXMLentity{divergence}\directsetup{mmc:donamedfunction}}
+\defineXMLcommand [grad] {\getXMLentity {grad}\directsetup{mmc:donamedfunction}}
+\defineXMLcommand [curl] {\getXMLentity {curl}\directsetup{mmc:donamedfunction}}
+\defineXMLcommand [laplacian] {\getXMLentity {laplacian}\directsetup{mmc:donamedfunction}}
+
+\defineXMLcommand [ident] {\getXMLentity {identity}\directsetup{mmc:donamedfunction}}
+\defineXMLcommand [domain] {\getXMLentity {domain}\directsetup{mmc:donamedfunction}}
+\defineXMLcommand [codomain] {\getXMLentity {codomain}\directsetup{mmc:donamedfunction}}
+
+\startsetups mmc:donamedfunction
+% \left(
+% \begingroup
+ \MMLcreset\flushXMLstackfrom\plustwo
+% \endgroup
+% \right)
+\stopsetups
+
+% theory of sets
+
+\defineXMLnested [set]
+ {\setups{mmc:set:start}}
+ {\setups{mmc:set:stop}}
+
+\startsetups mmc:set:start
+ \begingroup
+ \startsavingXMLelements
+\stopsetups
+
+\startsetups mmc:set:stop
+ \stopsavingXMLelements
+ \MMCdoifelsefound{condition} {
+ \left\{\MMCfirstnamed{bvar}\,\middle\vert\,\MMCfirstnamed{condition}\right\}
+ } {
+ \left\{\flushXMLstackwith\plusone\MMLccomma\right\}
+ }
+ \endgroup
+\stopsetups
+
+\defineXMLnested [list]
+ {\setups{mmc:list:start}}
+ {\setups{mmc:list:stop}}
+
+\settrue\MMLlistdelimiters
+
+\startsetups mmc:list:start
+ \begingroup
+ \startsavingXMLelements
+\stopsetups
+
+\startsetups mmc:list:stop
+ \stopsavingXMLelements
+ \ifconditional\MMLlistdelimiters\left [\fi
+ \begingroup
+ \settrue\MMLlistdelimiters
+ \flushXMLstackwith\plusone\MMLccomma
+ \endgroup
+ \ifconditional\MMLlistdelimiters\right]\fi
+ \endgroup
+\stopsetups
+
+\defineXMLcommand [union] {\MMLcset\cup}
+\defineXMLcommand [intersect] {\MMLcset\cap}
+\defineXMLcommand [in] {\MMLcset\in}
+\defineXMLcommand [notin] {\MMLcset{\not\in}}
+\defineXMLcommand [subset] {\MMLcset\subset}
+\defineXMLcommand [prsubset] {\MMLcset\subseteq}
+\defineXMLcommand [notsubset] {\MMLcset{\not\subset}}
+\defineXMLcommand [notprsubset] {\MMLcset{\not\subseteq}}
+\defineXMLcommand [setdiff] {\MMLcset\setminus}
+
+\def\MMLcset#1{\getXMLstackdata\plustwo#1\getXMLstackdata\plusthree}
+
+\defineXMLcommand [card] {\left\vert\flushXMLstackfrom\plustwo\right\vert}
+\defineXMLcommand [cartesianproduct] {\flushXMLstackwith\plustwo\times}
+
+% sequences and series
+
+\defineXMLcommand [sum] {\MMLcSUMandPRODUCT{sum}\sum}
+\defineXMLcommand [product]{\MMLcSUMandPRODUCT{product}\prod}
+
+\setupMMLappearance[sum] [\c!location=\v!top]
+\setupMMLappearance[product][\c!location=\v!top]
+
+\def\stackMMLsubscripts#1%
+ {\vbox
+ {\baselineskip\zeropoint % hack, taco vragen
+ \halign{$\scriptstyle\hss##\hss$\cr#1\crcr}}}
+
+\def\MMLcSUMandPRODUCT#1#2%
+ {\MMCdoifelsefound{condition,bvar,lowlimit}
+ {\def\MMLcSUMlow
+ {_{\MMCdoifelsefound{condition}
+ {\collectXMLnamedstack{condition}{\crcr}%
+ \stackMMLsubscripts{\the\XMLRtoks}}
+ {\MMCdoifelsefound{bvar}
+ {\MMCfirstnamed{bvar}%
+ \MMCdoifelsefound{lowlimit}{=}{}}%
+ {}%
+ \MMCfirstnamed{lowlimit}}}}}
+ {\let\MMLcSUMlow\empty}%
+ \MMCdoifelsefound{uplimit}
+ {\def\MMLcSUMup{^{\MMCfirstnamed{uplimit}}}}
+ {\let\MMLcSUMup\empty}%
+ \MMLcreset#2\doMMLlimits{#1}\MMLcSUMup\MMLcSUMlow
+ \MMLcreset\MMCfirstnamed{apply,ci}}
+
+\defineXMLcommand [limit] {\directsetup{mmc:limit}}
+
+\setupMMLappearance[limit][\c!location=\v!top]
+
+\startsetups mmc:limit
+ \MMLcreset \lim
+ \doMMLlimits{limit}_{
+ \MMLcreset
+ \MMCdoifelsefound {condition} {
+ \MMCfirstnamed{condition}
+ } {
+ \MMCdoifelsefound {bvar} {
+ \MMCfirstnamed{bvar}\rightarrow
+ } {
+ }
+ \MMCfirstnamed{lowlimit}
+ }
+ }
+ \MMCfirstnamed{apply}
+\stopsetups
+
+\defineXMLcommand [tendsto] [type=default] {\directsetup{mmc:tendsto}}
+
+\startsetups mmc:tendsto
+ \MMLcreset \getXMLstackdata\plustwo
+ \processaction
+ [\XMLpar{tendsto}{type}{default}]
+ [ above=>\downarrow,
+ below=>\uparrow,
+ unknown=>\rightarrow]
+ \MMLcreset \getXMLstackdata\plusthree
+\stopsetups
+
+% elementary classical functions
+
+\defineXMLcommand [exp] {\directsetup{mmc:exp}}
+\defineXMLcommand [ln] {\directsetup{mmc:function}}
+\defineXMLcommand [log] {\directsetup{mmc:log}}
+\defineXMLignore [logbase]
+
+\setupMMLappearance[log][\c!location=\v!right]
+
+\startsetups mmc:exp
+ \getXMLentity{exponentiale}^{\MMCfirstnamed{apply,reln,ci,cn}}
+\stopsetups
+
+\startsetups mmc:log
+ \MMCdoifelsefound {logbase} {
+ \doifelse\@@MMLloglocation\v!left {
+ \mathop{{}^{{\defineXMLprocess[logbase]\MMCfirstnamed{logbase}}}
+ \getXMLentity{NegThinSpace}
+ \getXMLentity{log}}
+ } {
+ \getXMLentity{log}_{{\defineXMLprocess[logbase]\MMCfirstnamed{logbase}}}
+ }
+ } {
+ \getXMLentity{log}
+ }
+ \MMLcreset
+ % mmc:function:argument assumes that the apply is second in the row (*1*)
+ % \removeXMLdatafromstack{logbase}
+ \directsetup{mmc:function:argument}
+\stopsetups
+
+% statistics
+
+\defineXMLcommand [mean] {\overline{\getXMLstackdata\plustwo}}
+\defineXMLcommand [sdev] {\sigma(\MMLcreset\getXMLstackdata\plustwo)}
+\defineXMLcommand [variance] {\sigma(\MMLcreset\getXMLstackdata\plustwo)^2}
+\defineXMLcommand [median] {\getXMLentity{median}(\MMLcreset\getXMLstackdata\plustwo)}
+\defineXMLcommand [mode] {\getXMLentity{mode}(\MMLcreset\getXMLstackdata\plustwo)}
+
+% moments
+
+\defineXMLcommand [moment] {\directsetup{mmc:moment}}
+\defineXMLprocess [momentabout]
+
+\startsetups mmc:moment
+ \left\langle\MMCfirstnamed{apply,reln,ci,cn}^{\MMCfirstnamed{degree}}\right\rangle
+ \MMCdoifelsefound{momentabout} {
+ _{\MMCfirstnamed{momentabout}}
+ } {
+ }
+\stopsetups
+
+% linear algebra
+
+\defineXMLcommand [vector] {\directsetup{mmc:vector}} % sequence
+
+\setupMMLappearance [vector] [\c!direction=\v!horizontal]
+
+\defineXMLnested
+ [vector]
+ {\directsetup{mmc:vector:start}}
+ {\directsetup{mmc:vector:stop}}
+
+\startsetups mmc:vector:start
+ \begingroup
+ \startsavingXMLelements
+\stopsetups
+
+
+\startsetups mmc:vector:stop
+ \stopsavingXMLelements
+ \ifnum\XMLstacklevel>\plusone
+ \doifelse\@@MMLvectordirection\v!horizontal {
+ \left(\flushXMLstackwith\plusone\MMLccomma\right)
+ } {
+ \collectXMLstack\crcr
+ \MMLcreset\left(\matrix{\the\XMLRtoks}\right)
+ }
+ \else
+ \overrightarrow{\charhtstrut\getXMLstackdata\plusone}
+ \fi
+ \endgroup
+\stopsetups
+
+\defineXMLnestedenvironmentsave [matrix] {} {\directsetup{mmc:matrix}}
+\defineXMLnestedenvironmentsave [matrixrow] {} {\directsetup{mmc:matrixrow}}
+
+\unexpanded\def\@col@amp@{&}
+
+\settrue\MMCdelmatrix %( ) when true
+
+\startsetups mmc:matrix
+ \begingroup
+ \MMLcreset
+ \defineXMLnestedenvironmentsave [matrixrow] {} {\directsetup{mmc:matrixrow:do}}
+ \ifconditional\MMCdelmatrix
+ \left(\matrix{\XMLflush{matrix}}\right)
+ \else
+ \settrue\MMCdelmatrix
+ \matrix{\XMLflush{matrix}}
+ \fi
+ \endgroup
+\stopsetups
+
+\startsetups mmc:matrixrow
+ \begingroup
+ \MMLcreset
+ \left(\matrix{\directsetup{mmc:matrixrow:do}}\right)
+ \endgroup
+\stopsetups
+
+\startsetups mmc:matrixrow:do
+ \begingroup
+ \startsavingXMLelements
+ \XMLflush{matrixrow}
+ \stopsavingXMLelements
+ \collectXMLstackrows\plusone\@col@amp@
+ \edef\ascii{\the\XMLRtoks}
+ \edef\ascii{\ascii}
+ \expandafter\endgroup\ascii\crcr
+\stopsetups
+
+\defineXMLcommand [determinant] {\directsetup{mmc:determinant}}
+\defineXMLcommand [transpose] {\directsetup{mmc:transpose}}
+\defineXMLcommand [selector] {\directsetup{mmc:selector}}
+
+\startsetups mmc:determinant
+ \begingroup
+ \left|
+ \setfalse\MMCdelmatrix
+ \getXMLstackdata\plustwo
+ \right|
+ \endgroup
+\stopsetups
+
+\startsetups mmc:transpose
+% \getXMLstackdata\plustwo^{\MMLrm T}
+ \getXMLstackdata\plustwo^{\mfunction{T}}
+\stopsetups
+
+\startsetups mmc:selector
+ \MMLmathinner{\getXMLstackdata\plustwo}_{\MMLcreset\flushXMLstackwith\plusthree\MMLccomma}
+\stopsetups
+
+\defineXMLcommand [vectorproduct] {\getXMLstackdata\plustwo\getXMLentity{vectorproduct}\getXMLstackdata\plusthree}
+\defineXMLcommand [scalarproduct] {\getXMLstackdata\plustwo\getXMLentity{scalarproduct}\getXMLstackdata\plusthree}
+\defineXMLcommand [outerproduct] {\getXMLstackdata\plustwo\getXMLentity {outerproduct}\getXMLstackdata\plusthree}
+
+% semantic mapping elements
+
+\defineXMLnested
+ [semantics]
+ {\directsetup{mmc:semantics:start}}
+ {\directsetup{mmc:semantics:stop}}
+
+\startsetups mmc:semantics:start
+ \begingroup
+ \startsavingXMLelements
+\stopsetups
+
+\startsetups mmc:semantics:stop
+ \stopsavingXMLelements
+ \MMCdoifelsefound {annotation} {
+ \flushXMLnamedstackwith\plusone{annotation}\empty
+ } {
+ \flushXMLnamedstackwith\plusone{apply}\empty
+ }
+ \endgroup
+\stopsetups
+
+\defineXMLenvironmentsave
+ [annotation]
+ [encoding=]
+ {}
+ {\directsetup{mmc:annotation}}
+
+\startsetups mmc:annotation
+ \doif{\XMLpar{annotation}{encoding}{}}{TeX} {
+ \XMLtexdata{annotation}
+ }
+\stopsetups
+
+\defineXMLignore [annotation-xml]
+
+% misc
+
+\defineXMLcommand [integers] {\getXMLentity{integers}}
+\defineXMLcommand [reals] {\getXMLentity{reals}}
+\defineXMLcommand [rationals] {\getXMLentity{rationals}}
+\defineXMLcommand [naturalnumbers] {\getXMLentity{naturalnumbers}}
+\defineXMLcommand [complexes] {\getXMLentity{complexes}}
+\defineXMLcommand [primes] {\getXMLentity{primes}}
+\defineXMLcommand [exponentiale] {\getXMLentity{ExponentialE}}
+\defineXMLcommand [imaginaryi] {\getXMLentity{ImaginaryI}}
+% \defineXMLcommand [notanumber] {\mathop{\MMLrm NaN}}
+% \defineXMLcommand [true] {\mathop{\MMLrm true}}
+% \defineXMLcommand [false] {\mathop{\MMLrm false}}
+\defineXMLcommand [notanumber] {\mathop{\mfunction{NaN}}}
+\defineXMLcommand [true] {\mathop{\mfunction{true}}}
+\defineXMLcommand [false] {\mathop{\mfunction{false}}}
+\defineXMLcommand [emptyset] {\mathop{\O}}
+\defineXMLcommand [pi] {\pi}
+\defineXMLcommand [eulergamma] {\gamma}
+\defineXMLcommand [infinity] {\infty}
+
+% gonio functions
+
+\defineXMLcommand[sin] {\directsetup{mmc:function}} \defineXMLcommand[arcsin] {\directsetup{mmc:function}}
+\defineXMLcommand[sinh]{\directsetup{mmc:function}} \defineXMLcommand[arcsinh]{\directsetup{mmc:function}}
+\defineXMLcommand[cos] {\directsetup{mmc:function}} \defineXMLcommand[arccos] {\directsetup{mmc:function}}
+\defineXMLcommand[cosh]{\directsetup{mmc:function}} \defineXMLcommand[arccosh]{\directsetup{mmc:function}}
+\defineXMLcommand[tan] {\directsetup{mmc:function}} \defineXMLcommand[arctan] {\directsetup{mmc:function}}
+\defineXMLcommand[tanh]{\directsetup{mmc:function}} \defineXMLcommand[arctanh]{\directsetup{mmc:function}}
+\defineXMLcommand[cot] {\directsetup{mmc:function}} \defineXMLcommand[arccot] {\directsetup{mmc:function}}
+\defineXMLcommand[coth]{\directsetup{mmc:function}} \defineXMLcommand[arccoth]{\directsetup{mmc:function}}
+\defineXMLcommand[csc] {\directsetup{mmc:function}} \defineXMLcommand[arccsc] {\directsetup{mmc:function}}
+\defineXMLcommand[csch]{\directsetup{mmc:function}} \defineXMLcommand[arccsch]{\directsetup{mmc:function}}
+\defineXMLcommand[sec] {\directsetup{mmc:function}} \defineXMLcommand[arcsec] {\directsetup{mmc:function}}
+\defineXMLcommand[sech]{\directsetup{mmc:function}} \defineXMLcommand[arcsech]{\directsetup{mmc:function}}
+
+\setupMMLappearance[function][\c!reduction=\v!yes]
+
+\startsetups mmc:function
+ \getXMLentity\currentXMLelement
+ \ifx\MMLpowerelement\empty\else
+ ^{\MMLcreset\MMLpowerelement\empty}
+ \getXMLentity{NegThinSpace}
+ \global\let\MMLpowerelement\empty
+ \fi
+ \doif {\getXMLstackname\plusone} {\currentXMLelement} {
+ % rather fuzzy test; looks like an apply case
+ \directsetup{mmc:function:argument}
+ }
+\stopsetups
+
+\startsetups mmc:function:argument
+ \doifelse\@@MMLfunctionreduction\v!yes {
+ % \doifelse {\getXMLstackname\plustwo} {apply} {
+ % \doifelseMMCfunctioninapply \plustwo \MMLcfunctionlist \donefalse \donetrue
+ %
+ % best is to grab the apply (independent of order), (*1*), so:
+ %
+ \MMCdoifelsefound {apply} {
+ \doifelseMMCfunctioninapply \MMCstackposition \MMLcfunctionlist \donefalse \donetrue
+ } {
+ \donefalse
+ }
+ } {
+ \donetrue
+ }
+ % beware, we still flush from 2 up
+ \ifdone
+ \left(\MMLcreset\flushXMLstackfrom\plustwo\right)
+ \else
+ \MMLcreset\flushXMLstackfrom\plustwo
+ \fi
+\stopsetups
+
+% presentation mml
+
+\def\resetMMLseparator
+ {\newcounter\MMLxxcounter
+ \let\lastMMLseparator\empty}
+
+\def\grabMMLseparator#1%
+ {\increment\MMLxxcounter
+ \newcounter\MMLyycounter
+ \expanded{\dograbMMLseparator#1\noexpand\relax}}
+
+\def\dograbMMLseparator
+ {\increment\MMLyycounter
+ \doifnextcharelse\relax
+ {\lastMMLseparator\gobbleoneargument}
+ {\doifnextcharelse\xmlrent\grabMMLseparatora\grabMMLseparatorb}}
+
+\def\grabMMLseparatora#1\xmlrent#2%
+ {\ifnum\MMLxxcounter=\MMLyycounter\space
+ \def\lastMMLseparator{\xmlrent{#2}}%
+ \fi
+ \dograbMMLseparator}
+
+\def\grabMMLseparatorb#1%
+ {\ifnum\MMLxxcounter=\MMLyycounter\space
+ \doifXMLentityelse{#1}
+ {\def\lastMMLseparator{\xmlrent{#1}}}
+ {\def\lastMMLseparator{#1}}%
+ \fi
+ \dograbMMLseparator}
+
+%
+
+\defineXMLargument [mi] \MMLpMI
+\defineXMLargument [mn] \MMLpMN
+\defineXMLargument [mo] \MMLpMO
+
+\def\MMLpMI#1%
+ {\begingroup
+ \setMMLpmathstyle{mstyle}%
+ #1%
+ \endgroup}
+
+% \def\MMLpMN#1%
+% {\begingroup
+% \MMLrm
+% \setMMLpmathstyle{mstyle}%
+% #1%
+% \endgroup}
+
+\def\MMLpMN#1%
+ {\mfunction{\setMMLpmathstyle{mstyle}#1}}
+
+\def\MMLpMO#1% yes or no
+ {\flattenXMLcontent{#1}%
+ \doifXMLentityelse\flattenedXMLcontent
+ {\getXMLentity\flattenedXMLcontent}
+ {\ConvertConstantAfter\doifinstringelse{\xmlrent}{#1} % TODO ! ! ! ! ! ! ! !
+ {#1}
+ {\hbox
+ {\setMMLpmathstyle{mstyle}%
+ \ignorespaces#1\unskip}}}}
+
+% we need to get rid of spaces: <mo> &RightArrow; </mo>
+
+\def\MMLpMO#1% yes or no
+ {\flattenXMLcontent{#1}%
+ \doifXMLentityelse\flattenedXMLcontent
+ {\getXMLentity\flattenedXMLcontent}
+ {\ignorespaces#1\removeunwantedspaces}}
+
+\let\normalright=\right
+\let\normalleft =\left
+
+\def\doMMLleft #1{\pushmacro\left \let\left \empty\normalleft #1\popmacro\left}
+\def\doMMLright#1{\pushmacro\right\let\right\empty\normalright#1\popmacro\right}
+
+\let\MMLpopen \empty
+\let\MMLpclose\empty
+
+\defineXMLnested [mfenced] [open=(,close=),separators=]
+ {\directsetup{mmp:mfenced:start}}
+ {\directsetup{mmp:mfenced:stop}}
+
+\startsetups mmp:mfenced:start
+ \begingroup
+ \startsavingXMLelements
+\stopsetups
+
+\startsetups mmp:mfenced:stop
+ \stopsavingXMLelements
+ \edef\MMLpopen {\XMLpar{mfenced}{open} {}}
+ \edef\MMLpclose{\XMLpar{mfenced}{close}{}}
+ \ifx\MMLpopen \space\let\MMLpopen \empty\fi
+ \ifx\MMLpclose\space\let\MMLpclose\empty\fi
+ \ifx\MMLpopen\empty
+ \ifx\MMLpclose\empty
+ \else
+ \doMMLleft.
+ \fi
+ \else
+ \doMMLleft\MMLpopen
+ \fi
+ \pushmacro\MMLpopen
+ \pushmacro\MMLpclose
+ \doifelsenothing{\XMLpar{mfenced}{separators}{}} {
+ \flushXMLstackfrom\plusone
+ } {
+ \resetMMLseparator
+ \flushXMLstackwith\plusone {
+ \begingroup
+ \let\myspecialnormalvert\myspecialstretchvert
+ \grabMMLseparator{\XMLpar{mfenced}{separators}{}}
+ \endgroup
+ }
+ }
+ \popmacro\MMLpclose
+ \popmacro\MMLpopen
+ \ifx\MMLpclose\empty
+ \ifx\MMLpopen\empty
+ \else
+ \doMMLright.
+ \fi
+ \else
+ \doMMLright\MMLpclose
+ \fi
+ \endgroup
+\stopsetups
+
+% \startbuffer
+% <math><mfenced separators="" open="(" close=")"><mi>x</mi></mfenced></math>
+% <math><mfenced separators="" open="" close=")"><mi>x</mi></mfenced></math>
+% <math><mfenced separators="" open="(" close="" ><mi>x</mi></mfenced></math>
+% <math><mfenced separators="" open="" close="" ><mi>x</mi></mfenced></math>
+% <math><mfenced separators="" open="" close=" "><mi>x</mi></mfenced></math>
+% \stopbuffer
+%
+% \processXMLbuffer
+
+\defineXMLnestedenvironmentsave [menclose] [notation=]
+ {\directsetup{mmp:menclose:start}}
+ {\directsetup{mmp:menclose:stop}}
+
+\startsetups mmp:menclose:start
+ \begingroup
+\stopsetups
+
+\startsetups mmp:menclose:stop
+ \doifelse{\XMLpar{menclose}{notation}{}}{longdiv} {
+ \overline{)\XMLflush{menclose}}
+ } {
+ \XMLflush{menclose}
+ }
+ \endgroup
+\stopsetups
+
+\defineXMLnested [mfrac] [linethickness=]
+ {\directsetup{mmp:mfrac:start}}
+ {\directsetup{mmp:mfrac:stop}}
+
+\startsetups mmp:mfrac:start
+ \begingroup
+ \startsavingXMLelements
+\stopsetups
+
+\startsetups mmp:mfrac:stop
+ \stopsavingXMLelements
+ \doifXMLparelse{mfrac}{linethickness} {
+ \edef\theXMLpar{\XMLpar{mfrac}{linethickness}{1}}
+ \processaction
+ [\theXMLpar]
+ [ thin=>\scratchdimen=.2pt,
+ medium=>\scratchdimen=.4pt,
+ thick=>\scratchdimen=.8pt,
+ unknown=>\setdimensionwithunit\scratchdimen{\theXMLpar}{}]
+ {{\getXMLstackdata\plusone}\above\scratchdimen{\getXMLstackdata\plustwo}}
+ } {
+ \frac{\getXMLstackdata\plusone}{\getXMLstackdata\plustwo}
+ }
+ \endgroup
+\stopsetups
+
+\defineXMLargument
+ [ms]
+ [lquote=\xmlrent{quot},
+ rquote=\xmlrent{quot},
+ fontweight=,
+ fontstyle=,
+ mathstyle=,
+ mathvariant=,
+ background=,
+ color=]
+ {\MMLpSTRING}
+
+\def\MMLpSTRING#1%
+ {\hbox
+ {\tf % else encoding problems
+ \MMLpTEXT{\XMLpar{ms}{lquote}{}%
+ \doMMPpbackground{ms}{\doMMPpcolor{ms}{\setMMLptextstyle{ms}\ignorespaces#1\removeunwantedspaces}}%
+ \XMLpar{ms}{rquote}{}}}}
+
+\defineXMLenvironment
+ [mstyle]
+ [fontweight=,
+ fontstyle=,
+ mathstyle=,
+ mathvariant=,
+ background=,
+ color=]
+ {\begingroup}
+ {\endgroup}
+
+\defineXMLargument [mtext] [CPA] \MMLpTEXT
+\defineXMLargument [merror] [CPA] \MMLpERROR
+\defineXMLargument [mphantom] [CPA] \MMLpPHANTOM
+\defineXMLargument [mpadded] [CPA] \MMLpPADDED
+
+\mapXMLvalue{mmp}{normal} {\tf} \mapXMLvalue{mmp}{double-stuck} {\bf}
+\mapXMLvalue{mmp}{bolditalic} {\bi} \mapXMLvalue{mmp}{bold-italic} {\bi}
+\mapXMLvalue{mmp}{boldslanted}{\bs} \mapXMLvalue{mmp}{bold-slanted} {\bs}
+\mapXMLvalue{mmp}{boldnormal} {\bf} \mapXMLvalue{mmp}{bold} {\bf}
+\mapXMLvalue{mmp}{slanted} {\sl} \mapXMLvalue{mmp}{normalslanted}{\sl}
+\mapXMLvalue{mmp}{italic} {\it} \mapXMLvalue{mmp}{normalitalic} {\it}
+\mapXMLvalue{mmp}{fraktur} {\bf} \mapXMLvalue{mmp}{bold-fraktur} {\bf}
+\mapXMLvalue{mmp}{script} {\tf} \mapXMLvalue{mmp}{bold-script} {\bf}
+
+% and all kind of other crappy names
+
+\def\setMMLptextstyle#1%
+ {\XMLval{mmp}{\XMLpar{#1}{fontweight}{}\XMLpar{#1}{fontstyle}{}}{}}
+
+\def\setMMLpmathstyle#1%
+ {\XMLval{mmp}{\XMLpar{#1}{mathvariant}{}}{}}
+
+\def\doMMPpcolor#1#2%
+ {\doifXMLparelse{#1}{color}{\color[\XMLpar{#1}{color}{}]{#2}}{#2}}
+
+\def\doMMPpbackground#1#2%
+ {\doifXMLparelse{#1}{background}
+ {\inframed
+ [\c!frame=\v!off,
+ \c!background=\v!color,
+ \c!backgroundcolor=\XMLpar{#1}{background}{}]
+ {#2}}
+ {#2}}
+
+\def\MMLpTEXT#1%
+ {\hbox
+ {\tf % else encoding problems
+ \doMMPpbackground{ms}{\doMMPpcolor{ms}{\setMMLptextstyle{ms}\ignorespaces#1\removeunwantedspaces}}}}
+
+\def\MMLpERROR#1%
+ {\hbox{$\displaystyle#1$}}
+
+\def\MMLpPHANTOM#1%
+ {\phantom{\ignorespaces{}#1\unskip}} % watch spacing {} hack
+
+\def\MMLpPADDED#1%
+ {#1}
+
+% mrow
+
+\defineXMLenvironment [mrow] {\resetMMLbounds} {\finishMMLbounds}
+
+% \def\MMLleft #1{\increment\MMLboundslevel\left #1}
+% \def\MMLright#1{\right#1\decrement\MMLboundslevel}
+
+% \def\resetMMLbounds
+% {\let\MMLboundslevel\!!plusone\left.}
+
+% \def\finishMMLbounds
+% {\dorecurse\MMLboundslevel{\right.}}
+
+\def\resetMMLbounds
+ {\pushmacro\MMLboundslevel
+ \newcounter\MMLboundslevel}
+
+\def\MMLleft #1%
+ {\increment\MMLboundslevel
+ \normalleft#1}
+
+\def\MMLright#1%
+ {\ifnum\MMLboundslevel=0 \normalleft.\!\fi
+ \normalright#1%
+ \decrement\MMLboundslevel}
+
+\def\finishMMLbounds
+ {\ifnum\MMLboundslevel>0
+ \normalright.\!%
+ \decrement\MMLboundslevel
+ \expandafter\finishMMLbounds
+ \else
+ \popmacro\MMLboundslevel
+ \fi}
+
+\defineXMLnested [msqrt] {\directsetup{mmp:msqrt:start}} {\directsetup{mmp:msqrt:stop}}
+\defineXMLnested [mroot] {\directsetup{mmp:mroot:start}} {\directsetup{mmp:mroot:stop}}
+
+\startsetups mmp:msqrt:start
+ \begingroup
+ \startsavingXMLelements
+\stopsetups
+
+\startsetups mmp:msqrt:stop
+ \stopsavingXMLelements
+ \sqrt{\flushXMLstackfrom\plusone}
+ \endgroup
+\stopsetups
+
+\startsetups mmp:mroot:start
+ \begingroup
+ \startsavingXMLelements
+\stopsetups
+
+\startsetups mmp:mroot:stop
+ \stopsavingXMLelements
+ \root{\getXMLstackdata\plustwo}\of{\getXMLstackdata\plusone}
+ \endgroup
+\stopsetups
+
+\setupMMLappearance[scripts][\c!alternative=\v!a]
+
+\defineXMLnested [msub] {\directsetup{mmp:msub:start}} {\directsetup{mmp:msub:stop}}
+\defineXMLnested [msup] {\directsetup{mmp:msup:start}} {\directsetup{mmp:msup:stop}}
+\defineXMLnested [msubsup] {\directsetup{mmp:msbp:start}} {\directsetup{mmp:msbp:stop}}
+
+\startsetups mmp:msub:start
+ \begingroup
+ \startsavingXMLelements
+\stopsetups
+
+\startsetups mmp:msub:stop
+ \stopsavingXMLelements
+ \doifelse\@@MMLscriptsalternative\v!a {
+ {\getXMLstackdata\plusone}_{\getXMLstackdata\plustwo}
+ } {
+ \getXMLstackdata\plusone_{\getXMLstackdata\plustwo}
+ }
+ \endgroup
+\stopsetups
+
+\startsetups mmp:msup:start
+ \begingroup
+ \startsavingXMLelements
+\stopsetups
+
+\startsetups mmp:msup:stop
+ \stopsavingXMLelements
+ \doifelse\@@MMLscriptsalternative\v!a {
+ {\getXMLstackdata\plusone}^{\getXMLstackdata\plustwo}
+ } {
+ \getXMLstackdata\plusone^{\getXMLstackdata\plustwo}
+ }
+ \endgroup
+\stopsetups
+
+\startsetups mmp:msbp:start
+ \begingroup
+ \startsavingXMLelements
+\stopsetups
+
+\startsetups mmp:msbp:stop
+ \stopsavingXMLelements
+ \getXMLstackdata\plusone_{\getXMLstackdata\plustwo}^{\getXMLstackdata\plusthree}
+ \endgroup
+\stopsetups
+
+\defineXMLnested [mover] {\directsetup{mmp:mover:start}} {\directsetup{mmp:mover:stop}}
+\defineXMLnested [munder] {\directsetup{mmp:munder:start}} {\directsetup{mmp:munder:stop}}
+\defineXMLnested [munderover] {\directsetup{mmp:munderover:start}} {\directsetup{mmp:munderover:stop}}
+
+\startsetups mmp:mover:start
+ \begingroup
+ \startsavingXMLelements
+\stopsetups
+
+\startsetups mmp:mover:stop
+ \stopsavingXMLelements
+ \mathop{\vbox{\m@th\ialign{\hss##\hss\crcr\noalign{\kern3\p@}%
+ \disabledelimiter\doMMLfiller{\getXMLstackdata\plustwo}
+ \crcr\noalign{\kern3\p@\nointerlineskip}%
+ \disabledelimiter\doMMLfiller{\getXMLstackdata\plusone}
+ \crcr}}}
+ \limits
+ \endgroup
+\stopsetups
+
+\startsetups mmp:munder:start
+ \begingroup
+ \startsavingXMLelements
+\stopsetups
+
+\startsetups mmp:munder:stop
+ \stopsavingXMLelements
+ \mathop{\vtop{\m@th\ialign{\hss##\hss\crcr
+ \disabledelimiter\doMMLfiller{\getXMLstackdata\plusone}
+ \crcr\noalign{\kern3\p@\nointerlineskip}%
+ \disabledelimiter\doMMLfiller{\getXMLstackdata\plustwo}
+ \crcr\noalign{\kern3\p@}}}}
+ \limits
+ \endgroup
+\stopsetups
+
+\startsetups mmp:munderover:start
+ \begingroup
+ \startsavingXMLelements
+\stopsetups
+
+\startsetups mmp:munderover:stop
+ \stopsavingXMLelements
+ \getXMLstackdata\plusone
+ _{\disablefiller\disabledelimiter\getXMLstackdata\plustwo}
+ ^{\disablefiller\disabledelimiter\getXMLstackdata\plusthree}
+ \endgroup
+\stopsetups
+
+\def\doMMLfiller#1%
+ {\pushmacro\doMMLfiller
+ \let\doMMLfiller\gobbleoneargument
+ \gdef\dodoMMLfiller{\disablefiller\mathematics{#1}}%
+ \setbox\scratchbox=\hbox
+ {\def\normalorfiller##1##2%
+ {\gdef\dodoMMLfiller{\enablefiller#1}%
+ \let\normalorfiller\gobbletwoarguments}%
+ $#1$}%
+ \popmacro\doMMLfiller
+ \dodoMMLfiller}
+
+% tables
+
+% obsolete: \setupMMLappearance[mtable][\c!alternative=\v!a]
+
+\mapXMLvalue {mmp:mtable} {align:left} {right}
+\mapXMLvalue {mmp:mtable} {align:right} {left}
+\mapXMLvalue {mmp:mtable} {align:center} {middle}
+
+\mapXMLvalue {mmp:mtable} {frame:none} {off}
+\mapXMLvalue {mmp:mtable} {frame:solid} {on}
+\mapXMLvalue {mmp:mtable} {frame:on} {on}
+
+\defineXMLnested
+ [mtable]
+ [columnalign=,
+ columnspacing=.25ex,
+ rowspacing=.25ex,
+ frame=,
+ color=,
+ background=]
+ {\directsetup{mmp:mtable:start}}
+ {\directsetup{mmp:mtable:stop}}
+
+\defineXMLnestedargument
+ [mtr]
+ {\MMPmtableHANDLEtr}
+
+\defineXMLnestedargument
+ [mlabeledtr]
+ {\MMPmtableHANDLEtr}
+
+\defineXMLnestedargument
+ [mtd]
+ [columnalign=,
+ columnspacing=.25ex,
+ rowspacing=.25ex,
+ frame=,
+ color=,
+ background=]
+ {\MMPmtableHANDLEtd}
+
+\startsetups mmp:mtable:start
+ \vcenter \bgroup
+ \MMLpTABLEsplitter{background} \c!backgroundcolor
+ \MMLpTABLEsplitter{color} \c!color
+ \MMLpTABLEmapper {frame} \c!frame
+ \MMLpTABLEmapper {columnalign}\c!align
+ \setMMLpunit{\XMLpar{mtable}{rowspacing}\empty}{.25ex}
+ \let\MMLpTABLEoffset\MMLpunit
+ \bTABLE[\c!frame=\v!off,\c!background=\v!color,\c!offset=\MMLpTABLEoffset]
+\stopsetups
+
+\startsetups mmp:mtable:stop
+ \eTABLE
+ \egroup
+\stopsetups
+
+\long\def\MMPmtableHANDLEtr#1{%
+ \bTR\ignorespaces#1\removeunwantedspaces\eTR
+}
+
+\long\def\MMPmtableHANDLEtd#1{%
+ \let\theMMLpTABLEmap\empty
+ \MMLpTABLEmap{background} \c!backgroundcolor
+ \MMLpTABLEmap{color} \c!color
+ \MMLpTABLEmap{frame} \c!frame
+ \MMLpTABLEmap{columnalign}\c!align
+ \expanded{\bTD[\theMMLpTABLEmap]}%
+ $\ignorespaces#1\removeunwantedspaces$\eTD
+}
+
+\def\MMLpTABLEmapper#1#2%
+ {\doifXMLparelse{mtable}{#1}
+ {\newcounter\MMLcounter
+ \def\docommando##1%
+ {\increment\MMLcounter
+ \expanded{\setupTABLE[column][\MMLcounter][#2=\XMLval{mmp:mtable}{#2:##1}\empty]}}%
+ \expanded{\processseparatedlist[\XMLpar{mtable}{#1}\empty]}[ ]\docommando}
+ {}}
+
+\def\MMLpTABLEsplitter#1#2%
+ {\doifXMLparelse{mtable}{#1}
+ {\newcounter\MMLcounter
+ \def\docommando##1%
+ {\increment\MMLcounter
+ \expanded{\setupTABLE[column][\MMLcounter][#2=##1]}}%
+ \expanded{\processseparatedlist[\XMLpar{mtable}{#1}\empty]}[ ]\docommando}
+ {}}
+
+\def\MMLpTABLEmap#1#2%
+ {\doifXMLparelse{mtd}{#1}
+ {\edef\theMMLpTABLEmap{#2=\XMLval{mmp:mtable}{#2:\XMLpar{mtd}{#1}\empty}\empty,\theMMLpTABLEmap}}
+ {}}
+
+\defineXMLsingular [mspace] [width=.5em] {\directsetup{mmp:mspace}}
+
+\startsetups mmp:mspace
+ \setMMLpunit{\XMLpar{mspace}{width}{}}{.5em}
+ \hskip\MMLpunit\relax
+\stopsetups
+
+\def\setMMLpunit#1#2% i've forgotten what this means
+ {\setbox\scratchbox=\hbox
+ {\edef\ascii{#1}%
+ \@EA\aftersplitstring\ascii\at.\to\ascii
+ \scratchcounter=\ifx\ascii\empty#1\else\ascii\fi
+ \unskip\unskip}%
+ \ifdim\wd\scratchbox=\zeropoint
+ \edef\MMLpunit{#1em}%
+ \else
+ \edef\ascii{#1}\convertcommand\ascii\to\ascii
+ \convertasciiafter\doifinstringelse{em}{\ascii}{\edef\MMLpunit{#1}}{%
+ \convertasciiafter\doifinstringelse{ex}{\ascii}{\edef\MMLpunit{#1}}{%
+ \convertasciiafter\doifinstringelse{pt}{\ascii}{\edef\MMLpunit{#1}}{%
+ \edef\MMLpunit{#2}}}}%
+ \fi}
+
+% end of tables
+
+\def\setMMLpunit#1#2%
+ {\setbox\scratchbox=\hbox
+ {\edef\ascii{#1}%
+ \@EA\aftersplitstring\ascii\at.\to\ascii
+ \scratchcounter=\ifx\ascii\empty#1\else\ascii\fi
+ \unskip\unskip}%
+ \ifdim\wd\scratchbox=\zeropoint
+ \edef\MMLpunit{#1em}%
+ \else
+ \edef\ascii{#1}\convertcommand\ascii\to\ascii
+ \convertasciiafter\doifinstringelse{em}{\ascii}{\edef\MMLpunit{#1}}{%
+ \convertasciiafter\doifinstringelse{ex}{\ascii}{\edef\MMLpunit{#1}}{%
+ \convertasciiafter\doifinstringelse{pt}{\ascii}{\edef\MMLpunit{#1}}{%
+ \edef\MMLpunit{#2}}}}%
+ \fi}
+
+\defineXMLsingular [mspace] [width=.5em] {\directsetup{mmp:mspace}}
+
+\startsetups mmp:mspace
+ \setMMLpunit{\XMLpar{mspace}{width}{}}{.5em}
+ \hskip\MMLpunit
+\stopsetups
+
+\defineXMLsingular [mglyph] [fontfamily=,index=1,alt=] {\directsetup{mmp:mglyph}}
+
+\startsetups mmp:mglyph
+ \def\MMLpglyph{\XMLpar{mglyph}{fontfamily}{}}%
+ \doifelsenothing{\MMLpglyph} {
+ \hbox{\tttf[fontfamily unspecified]}
+ } {
+ \doifdefinedelse{\MMLpglyph} {
+ \hbox{\getvalue{\MMLpglyph}\char0\XMLpar{mglyph}{index}{1}}
+ } {
+ \doifelsenothing{\XMLpar{mglyph}{alt}{}} {
+ \hbox{\tttf[unknown fontfamily \XMLpar{mglyph}{fontfamily}{}]}
+ } {
+ \hbox{\tttf\XMLpar{mglyph}{alt}{}}
+ }
+ }
+ }
+\stopsetups
+
+\defineXMLsingular [malignmark] {}
+\defineXMLsingular [none] {}
+\defineXMLsingular [mprescripts] {}
+
+\defineXMLnested
+ [mmultiscripts]
+ {\setups{mmp:mmultiscripts:start}}
+ {\setups{mmp:mmultiscripts:stop}}
+
+\startsetups mmp:mmultiscripts:start
+ \begingroup
+ \startsavingXMLelements
+\stopsetups
+
+\startsetups mmp:mmultiscripts:stop
+ \stopsavingXMLelements
+ \donefalse
+ \scratchcounter\zerocount
+ \dorecurse\XMLstacklevel {
+ % watch the extra {}'s
+ \ifdone
+ \ifodd\scratchcounter
+ ^{\getXMLstackdata\recurselevel}{}
+ \else
+ _{\getXMLstackdata\recurselevel}
+ \fi
+ \else
+ \doif{\getXMLstackname\recurselevel}{mprescripts}{\donetrue{}}
+ \fi
+ \ifdone \advance\scratchcounter\plusone \fi
+
+ }
+ \donetrue
+ \scratchcounter\zerocount
+ \dorecurse\XMLstacklevel {
+ \ifdone
+ % watch the extra {}'s
+ \ifcase\scratchcounter
+ \getXMLstackdata\recurselevel
+ \else\ifodd\scratchcounter
+ _{\getXMLstackdata\recurselevel}
+ \else
+ ^{\getXMLstackdata\recurselevel}{}
+ \fi\fi
+ \fi
+ \doif{\getXMLstackname\recurselevel}{mprescripts}{\donefalse}
+ \ifdone \advance\scratchcounter\plusone \fi
+ }
+ \endgroup
+\stopsetups
+
+\stopmodule
+
+\protect \endinput
diff --git a/tex/context/base/x-newpml.tex b/tex/context/base/x-newpml.tex
new file mode 100644
index 000000000..e22aa3392
--- /dev/null
+++ b/tex/context/base/x-newpml.tex
@@ -0,0 +1,241 @@
+%D \module
+%D [ file=xtag-pmu,
+%D version=2001.06.10,
+%D title=\CONTEXT\ XML Support,
+%D subtitle=Units,
+%D author=Hans Hagen,
+%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.
+
+\writestatus{loading}{Context XML Macros (units)}
+
+%D Quick and dirty in||line units:
+%D
+%D \startbuffer
+%D <phys>
+%D <cn> 10 </cn>
+%D <cu> <Newton/> <Square/> <Meter/> <Per/> <Sec/> </cu>
+%D </phys>
+%D \stopbuffer
+%D
+%D \typebuffer \processXMLbuffer
+%D
+%D A more \MATHML||like unit application:
+%D
+%D \startbuffer
+%D <phys> <apply> <unit/>
+%D <cn> 10 </cn>
+%D <csymbol> <Square/> <Meter/> <Per/> <Sec/> </csymbol>
+%D </apply> </phys>
+%D \stopbuffer
+%D
+%D \typebuffer \processXMLbuffer
+%D
+%D A bit more compact:
+%D
+%D \startbuffer
+%D <phys> <apply> <unit/>
+%D <cn> 10 </cn>
+%D <cu> <Square/> <Meter/> <Per/> <Sec/> </cu>
+%D </apply> </phys>
+%D \stopbuffer
+%D
+%D \typebuffer \processXMLbuffer
+%D
+%D A bit more complicated:
+%D
+%D \startbuffer
+%D <phys> <apply> <unit/>
+%D <apply> <divide/> <ci> a </ci> <cn> 10 </cn> </apply>
+%D <cu> <Square/> <Meter/> <Per/> <Sec/> </cu>
+%D </apply> </phys>
+%D \stopbuffer
+%D
+%D \typebuffer \processXMLbuffer
+%D
+%D An alternative (equivalent) for \type {</cu>}:
+%D
+%D \startbuffer
+%D <phys> <apply> <unit/>
+%D <cn> 10 </cn> <cunseq> <Square/> <Meter/> <Per/> <Sec/> </cunseq>
+%D </apply> </phys>
+%D \stopbuffer
+%D
+%D \typebuffer \processXMLbuffer
+
+\usemodule[units]
+
+\unprotect
+
+\defineXMLargument [phys] \automathematics
+\defineXMLargument [iphys] \inlinemathematics
+\defineXMLargument [dphys] \displaymathematics
+
+\defineXMLenvironment
+ [unit]
+ {\ignorespaces}
+ {\removeunwantedspaces}
+
+\defineXMLsingular
+ [unit]
+ [label=]
+ {\XMLop{label}}
+
+\defineXMLsingular
+ [unitmeaning]
+ [label=]
+ {\expanded{\unitmeaning{\XMLop{label}}}}
+
+\let\handlePMLunit\firstofoneargument
+
+%D All unit commands are remapped in a similar way.
+
+\defineXMLsingular [Atto] {\handlePMLunit\Atto}
+\defineXMLsingular [Femto] {\handlePMLunit\Femto}
+\defineXMLsingular [Pico] {\handlePMLunit\Pico}
+\defineXMLsingular [Nano] {\handlePMLunit\Nano}
+\defineXMLsingular [Micro] {\handlePMLunit\Micro}
+\defineXMLsingular [Milli] {\handlePMLunit\Milli}
+\defineXMLsingular [Centi] {\handlePMLunit\Centi}
+\defineXMLsingular [Deci] {\handlePMLunit\Deci}
+\defineXMLsingular [Hecto] {\handlePMLunit\Hecto}
+\defineXMLsingular [Kilo] {\handlePMLunit\Kilo}
+\defineXMLsingular [Mega] {\handlePMLunit\Mega}
+\defineXMLsingular [Giga] {\handlePMLunit\Giga}
+\defineXMLsingular [Terra] {\handlePMLunit\Terra}
+\defineXMLsingular [Peta] {\handlePMLunit\Peta}
+\defineXMLsingular [Exa] {\handlePMLunit\Exa}
+
+\defineXMLsingular [Times] {\handlePMLunit\Times}
+\defineXMLsingular [Solidus] {\handlePMLunit\Solidus}
+\defineXMLsingular [Per] {\handlePMLunit\Per}
+\defineXMLsingular [OutOf] {\handlePMLunit\OutOf}
+
+\defineXMLsingular [Linear] {\handlePMLunit\Linear}
+\defineXMLsingular [Square] {\handlePMLunit\Square}
+\defineXMLsingular [Cubic] {\handlePMLunit\Cubic}
+
+\defineXMLsingular [Inverse] {\handlePMLunit\Inverse}
+
+\defineXMLsingular [Degrees] {\handlePMLunit\Degrees}
+\defineXMLsingular [Meter] {\handlePMLunit\Meter}
+\defineXMLsingular [Liter] {\handlePMLunit\Liter}
+\defineXMLsingular [Sec] {\handlePMLunit\Sec}
+\defineXMLsingular [Year] {\handlePMLunit\Year}
+\defineXMLsingular [Month] {\handlePMLunit\Month}
+\defineXMLsingular [Week] {\handlePMLunit\Week}
+\defineXMLsingular [Day] {\handlePMLunit\Day}
+\defineXMLsingular [Hour] {\handlePMLunit\Hour}
+\defineXMLsingular [Min] {\handlePMLunit\Min}
+\defineXMLsingular [Second] {\handlePMLunit\Sec}
+\defineXMLsingular [Rad] {\handlePMLunit\Rad}
+\defineXMLsingular [Deg] {\handlePMLunit\Deg}
+\defineXMLsingular [Hertz] {\handlePMLunit\Hertz}
+\defineXMLsingular [RevPerSec] {\handlePMLunit\RevPerSec}
+\defineXMLsingular [RevPerMin] {\handlePMLunit\RevPerMin}
+\defineXMLsingular [Gram] {\handlePMLunit\Gram}
+\defineXMLsingular [Atom] {\handlePMLunit\Atom}
+\defineXMLsingular [Newton] {\handlePMLunit\Newton}
+\defineXMLsingular [Pascal] {\handlePMLunit\Pascal}
+\defineXMLsingular [Joule] {\handlePMLunit\Joule}
+\defineXMLsingular [Watt] {\handlePMLunit\Watt}
+\defineXMLsingular [Celsius] {\handlePMLunit\Celsius}
+\defineXMLsingular [Kelvin] {\handlePMLunit\Kelvin}
+\defineXMLsingular [Fahrenheit] {\handlePMLunit\Fahrenheit}
+\defineXMLsingular [Mol] {\handlePMLunit\Mol}
+\defineXMLsingular [Molair] {\handlePMLunit\Molair}
+\defineXMLsingular [Equivalent] {\handlePMLunit\Equivalent}
+\defineXMLsingular [Farad] {\handlePMLunit\Farad}
+\defineXMLsingular [Ohm] {\handlePMLunit\Ohm}
+\defineXMLsingular [Siemens] {\handlePMLunit\Siemens}
+\defineXMLsingular [Ampere] {\handlePMLunit\Ampere}
+\defineXMLsingular [Coulomb] {\handlePMLunit\Coulomb}
+\defineXMLsingular [Volt] {\handlePMLunit\Volt}
+\defineXMLsingular [eVolt] {\handlePMLunit\eVolt}
+\defineXMLsingular [Tesla] {\handlePMLunit\Tesla}
+\defineXMLsingular [VoltAC] {\handlePMLunit\VoltAC}
+\defineXMLsingular [VoltDC] {\handlePMLunit\VoltDC}
+\defineXMLsingular [Baud] {\handlePMLunit\Baud}
+\defineXMLsingular [Bit] {\handlePMLunit\Bit}
+\defineXMLsingular [Byte] {\handlePMLunit\Byte}
+\defineXMLsingular [Bequerel] {\handlePMLunit\Bequerel}
+\defineXMLsingular [Sievert] {\handlePMLunit\Sievert}
+\defineXMLsingular [Candela] {\handlePMLunit\Candela}
+\defineXMLsingular [Bell] {\handlePMLunit\Bell}
+\defineXMLsingular [At] {\handlePMLunit\At}
+\defineXMLsingular [Atm] {\handlePMLunit\Atm}
+\defineXMLsingular [Bar] {\handlePMLunit\Bar}
+\defineXMLsingular [EVolt] {\handlePMLunit\EVolt}
+\defineXMLsingular [Foot] {\handlePMLunit\Foot}
+\defineXMLsingular [Inch] {\handlePMLunit\Inch}
+\defineXMLsingular [Cal] {\handlePMLunit\Cal}
+\defineXMLsingular [Force] {\handlePMLunit\Force}
+\defineXMLsingular [Lux] {\handlePMLunit\Lux}
+\defineXMLsingular [Gray] {\handlePMLunit\Gray}
+\defineXMLsingular [Weber] {\handlePMLunit\Weber}
+\defineXMLsingular [Henry] {\handlePMLunit\Henry}
+\defineXMLsingular [Sterant] {\handlePMLunit\Sterant}
+\defineXMLsingular [Angstrom] {\handlePMLunit\Angstrom}
+\defineXMLsingular [Gauss] {\handlePMLunit\Gauss}
+
+\defineXMLsingular [Percent] {\handlePMLunit\Percent}
+\defineXMLsingular [Promille] {\handlePMLunit\Promille}
+\defineXMLsingular [Permille] {\handlePMLunit\Permille}
+
+\defineXMLsingular [Unit] {\handlePMLunit\Unit}
+\defineXMLsingular [NoUnit] {\handlePMLunit\NoUnit}
+
+\protect \doifnotmode{demo}{\endinput}
+
+\starttext
+
+\startXMLdata
+<phys>
+ <apply> <times/>
+ <cn> 1 </cn>
+ <ci><unit><Milli/><Sec/><Per/><Square/><Kilo/><Meter/></unit> </ci>
+ </apply>
+</phys>
+\stopXMLdata
+
+\startXMLdata
+<phys>
+ <apply> <divide/>
+ <cn> 2 </cn>
+ <ci> <unit><Unit/><Milli/><Sec/><Per/><Square/><Kilo/><Meter/></unit> </ci>
+ </apply>
+</phys>
+\stopXMLdata
+
+\startXMLdata
+<phys>
+ <apply> <times/>
+ <cn> 3 </cn>
+ <ci> <unit> <Milli/> <Sec/> <Per/> <Square/> <Kilo/> <Meter/> </unit> </ci>
+ </apply>
+</phys>
+\stopXMLdata
+
+\startXMLdata
+<phys>
+ <apply> <times/>
+ <cn> 4 </cn>
+ <ci> <unit><Milli/><Sec/><Per/><Square/><Kilo/><Meter/></unit> </ci>
+ </apply>
+</phys>
+\stopXMLdata
+
+\startXMLdata
+<phys>
+ <apply> <times/>
+ <cn> 5 </cn>
+ <ci> <unit> <Milli/> <Sec/> <Per/> <Square/> <Kilo/> <Meter/> </unit> </ci>
+ </apply>
+</phys>
+\stopXMLdata
+
+\stoptext
diff --git a/tex/context/base/xtag-cml.tex b/tex/context/base/xtag-cml.tex
index 1c80ac1a7..ab80a94ec 100644
--- a/tex/context/base/xtag-cml.tex
+++ b/tex/context/base/xtag-cml.tex
@@ -1,6 +1,6 @@
% see mathml, == \defineXMLdirective [mathml] \setupMMLappearance
-\unprotect
+\unprotect
\def\setupCMLappearance[#1]{\dodoubleargument\getparameters[@@CML#1]}
@@ -20,12 +20,12 @@
\remapXMLsequence [ion] [CPA] \doCMLion
\remapXMLsequence [atom] [CPA] \doCMLatom
-\setupCMLappearance [ion] [\c!variant=\v!a]
+\setupCMLappearance [ion] [\c!alternative=\v!a]
\let\CMLtopcaption\empty
\let\CMLbotcaption\empty
-\def\someCMLtext#1%
+\def\someCMLtext#1%
{\ifx\CMLtopcaption\empty
\setbox0\null
\else
@@ -37,14 +37,14 @@
\else
\setbox4\hbox{\txx\setstrut\strut\ignorespaces\CMLbotcaption\unskip}%
\fi
- \scratchdimen=\wd2\advance\scratchdimen-.5em
+ \scratchdimen=\wd2\advance\scratchdimen-.5em
\ifdim\wd0>\scratchdimen
\setbox0\hbox spread .5em{\hss\box0\hss}%
\fi
\ifdim\wd4>\scratchdimen
\setbox4\hbox spread .5em{\hss\box4\hss}%
\fi
- \setbox6=\vbox
+ \setbox6=\vbox
{\offinterlineskip\halign{\hss##\hss\cr\copy0\cr\copy2\cr\copy4\cr}}%
\hbox{\lower\ht4\hbox{\lower\dp2\box6}}}
@@ -80,12 +80,12 @@
\newcounter\nofCMLatoms
\getXMLarguments{cml-i}{n="0" charge="0" #1}%
\doifnotXMLzero{cml-i}{n}\firstofoneargument
- \doifelse\@@CMLionvariant\v!b
+ \doifelse\@@CMLionalternative\v!b
{[\ignorespaces\processXMLRchild{atom,bond/,%
singlebond/,doublebond/,triplebond/}{#2}\unskip]%
\high{\doifnotXMLzero{cml-i}{charge}\CMLscript}}
{\countXMLRchild{atom}{\ignorespaces#2\unskip}%
- \let\nofCMLatoms\nofXMLRchildren
+ \let\nofCMLatoms\nofXMLRchildren
\ignorespaces\processXMLRchild{atom,bond/,%
singlebond/,doublebond/,triplebond/}{#2}\unskip}%
\egroup}%
@@ -95,7 +95,7 @@
{\getXMLarguments{cml-a}{n="0" weight="0" protons="0" charge="0" #1}%
\increment\currentCMLatom
\resetCMLcaption
- %\processXMLRchild{caption}{#2}% not here
+ %\processXMLRchild{caption}{#2}% not here
\someCMLtext
{\bgroup
\lohi
@@ -149,19 +149,19 @@
\def\doCMLequilibrium#1#2{\resetCMLcaption#2\someCMLequilibrium}
\def\doCMLmesomeric #1#2{\resetCMLcaption#2\someCMLmesomeric }
-\def\dosomeCMLarrow#1%
+\def\dosomeCMLarrow#1%
{\quad
\someCMLtext
{$\vcenter{\offinterlineskip\halign{##\cr\hskip3em\cr#1\cr}}$}%
\quad}
-\def\someCMLgives
+\def\someCMLgives
{\someCMLarrow{\rightarrowfill}}
\def\someCMLequilibrium
{\someCMLarrow{\rightarrowfill\cr\noalign{\nointerlineskip}\leftarrowfill}}
-\def\someCMLmesomeric
+\def\someCMLmesomeric
{\someCMLarrow{$\leftarrow\hskip-1em$\rightarrowfill}}
\remapXMLsequence [cml] [caption] [CPA] \doCMLcaption
@@ -182,7 +182,7 @@
\resetCMLcaption
-\remapXMLsingular [bond] [CPA] \doCMLbond
+\remapXMLsingular [bond] [CPA] \doCMLbond
\remapXMLsingular [singlebond] [CPA] \doCMLsinglebond
\remapXMLsingular [doublebond] [CPA] \doCMLdoublebond
\remapXMLsingular [triplebond] [CPA] \doCMLtriplebond
@@ -197,8 +197,8 @@
\doCMLtriplebond
\fi}
-\def\someCMLbond%
- {\hrule \!!width \hsize \!!height .1ex} % .4pt
+\def\someCMLbond
+ {\hrule \!!width \hsize \!!height .1ex} % .4pt
\def\dosomeCMLbond#1#2#3%
{{\setbox\scratchbox=\hbox{$M$}%
@@ -208,15 +208,15 @@
#1\vfill#2\vfill#3%
\vskip.1\wd\scratchbox}}}
-\def\doCMLsinglebond%
+\def\doCMLsinglebond
{\dosomeCMLbond\relax\someCMLbond\relax}
-\def\doCMLdoublebond%
+\def\doCMLdoublebond
{\dosomeCMLbond\someCMLbond\relax\someCMLbond}
-\def\doCMLtriplebond%
+\def\doCMLtriplebond
{\dosomeCMLbond\someCMLbond\someCMLbond\someCMLbond}
-\stopXMLmapping
+\stopXMLmapping
-\protect \endinput
+\protect \endinput
diff --git a/tex/context/interface/keys-cz.xml b/tex/context/interface/keys-cz.xml
index 91f5060a8..170443c9a 100644
--- a/tex/context/interface/keys-cz.xml
+++ b/tex/context/interface/keys-cz.xml
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
-<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="cz" version="2006.04.07 11:24">
+<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="cz" version="2006.04.09 22:25">
<cd:variables>
<cd:variable name="one" value="jedna"/>
diff --git a/tex/context/interface/keys-de.xml b/tex/context/interface/keys-de.xml
index e204e5449..e983e83c5 100644
--- a/tex/context/interface/keys-de.xml
+++ b/tex/context/interface/keys-de.xml
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
-<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="de" version="2006.04.07 11:24">
+<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="de" version="2006.04.09 22:25">
<cd:variables>
<cd:variable name="one" value="eins"/>
diff --git a/tex/context/interface/keys-en.xml b/tex/context/interface/keys-en.xml
index ecf91bbb6..2f59d58ff 100644
--- a/tex/context/interface/keys-en.xml
+++ b/tex/context/interface/keys-en.xml
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
-<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="en" version="2006.04.07 11:24">
+<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="en" version="2006.04.09 22:25">
<cd:variables>
<cd:variable name="one" value="one"/>
diff --git a/tex/context/interface/keys-fr.xml b/tex/context/interface/keys-fr.xml
index dee533da7..ea2c5ba33 100644
--- a/tex/context/interface/keys-fr.xml
+++ b/tex/context/interface/keys-fr.xml
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
-<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="fr" version="2006.04.07 11:24">
+<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="fr" version="2006.04.09 22:25">
<cd:variables>
<cd:variable name="one" value="un"/>
diff --git a/tex/context/interface/keys-it.xml b/tex/context/interface/keys-it.xml
index a17916613..b5f2ba8fc 100644
--- a/tex/context/interface/keys-it.xml
+++ b/tex/context/interface/keys-it.xml
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
-<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="it" version="2006.04.07 11:24">
+<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="it" version="2006.04.09 22:25">
<cd:variables>
<cd:variable name="one" value="uno"/>
diff --git a/tex/context/interface/keys-nl.xml b/tex/context/interface/keys-nl.xml
index be7acbab7..426a1d3ca 100644
--- a/tex/context/interface/keys-nl.xml
+++ b/tex/context/interface/keys-nl.xml
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
-<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="nl" version="2006.04.07 11:24">
+<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="nl" version="2006.04.09 22:25">
<cd:variables>
<cd:variable name="one" value="een"/>
diff --git a/tex/context/interface/keys-ro.xml b/tex/context/interface/keys-ro.xml
index c5dc3bc0e..b3dac45de 100644
--- a/tex/context/interface/keys-ro.xml
+++ b/tex/context/interface/keys-ro.xml
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
-<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="ro" version="2006.04.07 11:24">
+<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="ro" version="2006.04.09 22:25">
<cd:variables>
<cd:variable name="one" value="unu"/>